Search is not available for this dataset
content
stringlengths
60
399M
max_stars_repo_name
stringlengths
6
110
<|start_filename|>htaccess.lua<|end_filename|> -- htaccess for nginx -- Version: 1.2.1 -- Copyright (c) 2017-2021 by <NAME>, Roadfamily LLC -- MIT License -- Compilation: luajit -b htaccess.lua htaccess-bytecode.lua -- TODO: Sometimes code is executed 4 times for each request due to the way nginx handles requests. Make sure it is cached accordingly. -- Error function, returns HTTP 500 and logs an error message local fail = function(msg) if msg then ngx.log(ngx.ERR, msg) end ngx.exit(500) end -- Halts the script execution local die = function() ngx.exit(0) -- os.exit(0) leads to timeouts in nginx end -- Pull some nginx functions to local scope local decode_base64 = ngx.decode_base64 local unescape_uri = ngx.unescape_uri -- Initialize cache local cache_dict = ngx.shared['htaccess'] if not cache_dict then fail('Shared storage DICT "htaccess" not set; define "lua_shared_dict htaccess 16m;" within http configuration block') end -- Calculate a unique request tracing id which remains the same across all subrequests local trace_id = ngx.var.connection..'.'..ngx.var.connection_requests -- Get a cache value local cache_get = function(key) return cache_dict:get_stale(key) end -- Set/delete a cache value local cache_set = function(key, value, expiry_sec) if not value then return cache_dict:delete(key) end if not expiry_sec or expiry_sec < 0.001 then expiry_sec = 1 -- expire in 1 second (default) elseif expiry_sec > 3600 then expiry_sec = 3600 -- don't allow expire values > 1 hour end return cache_dict:set(key, value, expiry_sec) end -- Define request status values local C_STATUS_SUBREQUEST = 1 local C_STATUS_VOID = 9 -- Define directory identified placeholder local C_DIR = '__dir__' -- Get request status from shared storage local request_status = cache_get(trace_id) -- Detect void flag (e.g. from RewriteRule flag [END]) if request_status == C_STATUS_VOID then die() end -- Determine whether or not this is a subrequest local is_subrequest if request_status then is_subrequest = true else is_subrequest = false cache_set(trace_id, C_STATUS_SUBREQUEST) -- Write subrequest status to cache for any following subrequest end -- The original requested URI including query string local org_request_uri = ngx.var.request_uri local org_request_uri_path = org_request_uri:match('^[^%?]+') -- Make sure uri doesn't end on '?', as request_uri will never match that if org_request_uri:len() > org_request_uri_path:len() then org_request_uri = unescape_uri(org_request_uri_path)..org_request_uri:sub(org_request_uri_path:len()+1) else org_request_uri = unescape_uri(org_request_uri_path) end -- The actual requested URI including query string local request_uri_noqs = ngx.var.uri local request_uri = ngx.var.uri if ngx.var.query_string then request_uri = request_uri..'?'..ngx.var.query_string end -- Backup subrequest detection, in case shared storage failed if request_uri ~= org_request_uri then is_subrequest = true end local ip = ngx.var.remote_addr -- The client's real IP address local rootpath = ngx.var.realpath_root..'/' -- The root directory of the current host local request_filepath = ngx.var.request_filename -- The requested full file path resolved to the root directory local request_filename = ngx.var.request_filename:match('/([^/]+)$') -- The requested filename local request_fileext = ngx.var.request_filename:lower():match('%.([^%./]+)$') -- The requested filename's extension (lower case) local request_relative_filepath = request_filepath:sub(rootpath:len()) -- the requested relative file path with leading / (might match the request_uri) if request_filepath:match('/%.htaccess$') or request_filepath:match('/%.htpasswd$') then -- Deny access to any .htaccess or .htpasswd file -- Stick to Apache's default behaviour and return HTTP code 403, even if such a file doesn't exist ngx.exit(403) end -- Check if file is inside document root local in_doc_root = function(filepath) local doc_root = ngx.var.document_root return (filepath:sub(1, doc_root:len()) == doc_root) end -- Make sure all file operations are contained inside document root, fails when not local ensure_doc_root = function(filepath) if not in_doc_root(filepath) then fail(C_SECURITY_VIOLATION_ERROR..': Trying to read file outside of server root directory ("'..doc_root..'"): "'..filepath..'"') end end -- Check if a path exists at the file system -- filepath .... the filename -- soft_fail ... if true, no fail error will be triggered when not in doc root local path_exists = function(filepath, soft_fail) if soft_fail then if not in_doc_root(filepath) then return false end else ensure_doc_root(filepath) -- Security: enforce document root end local ok, _, code = os.rename(filepath, filepath) if not ok then if code == 13 then return true -- Permission denied, but it exists end end return ok end -- Read contents of any file local get_file_contents = function(name) ensure_doc_root(name) -- Security: enforce document root local file = io.open(name, 'r') if file == nil then return nil end local content = file:read('*all') file:close() return content end -- Check IP address against given IP mask (or a full IP address) local ip_matches_mask = function(ip, mask) if ip == mask then return true end if not mask:match('%.$') then return false end if ip:match('^'..mask:gsub('%.', '%.')) then return true else return false end end -- Check IP address against given host name local ip_matches_host = function(ip, host) local hosts_proc = assert(io.popen('getent ahosts '..shell_escape_arg(host)..' | awk \'{ print $1 }\' | sort -u')) -- get all associated IP addresses (IPv4 and IPv6) for host for res_ip in hosts_proc:lines() do if ip:match('^'..res_ip..'%s*$') then return true end end return false end -- Trim string (remove whitespace or other characters at the beginning and the end) local trim = function(str, what) if what == nil then what = '%s' end return tostring(str):gsub('^'..what..'+', '', 1):gsub(''..what..'+$', '', 1) end -- shell escape argument local shell_escape_arg = function(s) if s:match("[^A-Za-z0-9_/:=-]") then s = "'"..s:gsub("'", "'\\''").."'" end return s end -- Make sure the request_filepath is based on the root path (directory security) if request_filepath:sub(1, rootpath:len()) ~= rootpath then die() end -- Try to fetch htaccess lines from cache local htaccess_cache_key = trace_id..'.h' local htaccess = cache_get(htaccess_cache_key) if not htaccess then -- Walk through the path and try to find .htaccess files local last_htaccess_dir = rootpath htaccess = '' -- Tries to process .htaccess in last_htaccess_dir -- Soft fails: If there is no .htaccess file, no error will be triggered local read_htaccess = function() local filename = last_htaccess_dir..'.htaccess' local current_htaccess = get_file_contents(filename) if current_htaccess then current_htaccess = current_htaccess:gsub('^%s*#[^\n]+\n', '', 1):gsub('\n%s*#[^\n]+', '', 1) -- Strip comments if current_htaccess:match(C_DIR) then fail(C_SECURITY_VIOLATION_ERROR) end local relative_dir = last_htaccess_dir:sub(rootpath:len()+1) htaccess = C_DIR..' '..relative_dir..'\n'..htaccess..current_htaccess end end read_htaccess() -- process file in root directory first local next_dir for part in request_filepath:sub(rootpath:len()+1):gmatch('[^/\\]+') do -- Walk through directories and try to process .htaccess file next_dir = last_htaccess_dir..part..'/' if path_exists(last_htaccess_dir) then last_htaccess_dir = next_dir read_htaccess() else break end end end -- Some constants local C_VALUE = -11 local C_CTX_INDEX = -12 local C_INDEXED = -21 local C_MULTIPLE = -22 local C_TYPE = -31 local C_ATTR = -32 -- Initialize global parsed htaccess directives with context flags -- INDEXED means that instead of having integer based content, each directive type holds a key based map with integer based content tables -- EXCLUSIVE returns only the last value for a directive within a context stack, which means that this directive cannot hold multiple values local cdir = { ['allowfirst'] = {}, ['deny'] = {}, ['auth'] = {}, ['authuserfile'] = {}, ['authname'] = {}, ['authcredentials'] = {[C_INDEXED] = true}, ['errordocs'] = {[C_INDEXED] = true}, ['rewritebase'] = {}, ['rewriterules'] = {[C_MULTIPLE] = true}, ['rewrite'] = {}, ['contenttypes'] = {[C_INDEXED] = true} } -- Directive context stack, using mapped table assignments to save memory and table copies local ctx_i = 1 local ctx_map = {{}} local ctx_used = false -- Identifies attributes, even within single or double quotes; returns table of attributes local parse_attributes = function(input_str) local working_str = '' local output = {} local mode = 0 -- 0 = standard, 1 = single quotes, 2 = double quotes for i = 1, string.len(input_str), 1 do local byte = input_str:sub(i,i) if byte:match('%s') then if mode == 0 then if working_str ~= '' then table.insert(output, working_str) end working_str = '' else working_str = working_str..byte end elseif byte == "'" then if mode == 0 then mode = 1 elseif mode == 1 then table.insert(output, working_str) working_str = '' mode = 0 else working_str = working_str..byte end elseif byte == '"' then if mode == 0 then mode = 2 elseif mode == 2 then table.insert(output, working_str) working_str = '' mode = 0 else working_str = working_str..byte end else working_str = working_str..byte end end if working_str ~= '' then table.insert(output, working_str) end return output end -- Add a directive to the global cdir collection -- directive_type ... e.g. 'rewrite' --or-- {'a', 'b'} for indexed parsed directives, e.g. {'authcredentials', username} -- value ............ e.g. true local push_cdir = function(directive_type, value) ctx_used = true local value_to_push = { [C_VALUE] = value, [C_CTX_INDEX] = ctx_i } if type(directive_type)=='table' then local real_type = directive_type[1] local index = directive_type[2] if not cdir[real_type][index] then cdir[real_type][index] = {} end table.insert(cdir[real_type][index], value_to_push) else table.insert(cdir[directive_type], value_to_push) end end -- Helper function to get computed directive value and actual context table -- local resolve_cdir_value = function(value_table) -- if not value_table then -- return nil -- end -- return value_table[C_VALUE], ctx_map[value_table[C_CTX_INDEX]] -- end -- Return computed directive by type -- directive_type ... string of requested type (lowercase), e.g. 'rewriterules' -- index_or_flag .... index of indexed directive (e.g. 'username') or C_MULTIPLE, for which the entire computed table will be returned local get_cdir = function(directive_type, index_or_flag) local has_multiple = (cdir[directive_type][C_MULTIPLE]~=nil) local is_indexed = (cdir[directive_type][C_INDEXED]~=nil) local dataset if index_or_flag and index_or_flag ~= C_MULTIPLE then if not is_indexed then fail(C_SECURITY_VIOLATION_ERROR) end dataset = cdir[directive_type][index_or_flag] else if is_indexed then fail(C_SECURITY_VIOLATION_ERROR) end dataset = cdir[directive_type] end if not dataset then return nil end local computed_list = {} for _, directive in ipairs(dataset) do table.insert(computed_list, directive[C_VALUE]) end if index_or_flag == C_MULTIPLE then if not has_multiple then fail(C_SECURITY_VIOLATION_ERROR) end return computed_list -- return entire list of values else return computed_list[#computed_list] -- return single element (last) end end -- Add context to current directive context stack local push_ctx = function(ctx_type, ctx) local i = ctx_i if ctx_used then i = i + 1 if i > 1 then ctx_map[i] = {} for _, item in ipairs(ctx_map[i-1]) do table.insert(ctx_map[i], { [C_TYPE] = item[C_TYPE], [C_ATTR] = item[C_ATTR] }) end end table.insert(ctx_map[i], { [C_TYPE] = ctx_type, [C_ATTR] = ctx }) ctx_i = i end table.insert(ctx_map[i], { [C_TYPE] = ctx_type, [C_ATTR] = ctx }) ctx_used = false end -- Remove last context from current directive context stack local pop_ctx = function() ctx_map[ctx_i+1] = ctx_map[ctx_i-1] ctx_i = ctx_i + 1 ctx_used = true -- Make sure that if a new context is added right after this call, the stack gets copied and a new index is assigned end -- Remove all contexts; used with new htaccess file local reset_ctx = function() local i = ctx_i ctx_map[i+1] = {} ctx_i = i + 1 ctx_used = false end -- Parse one line of RewriteRule or RewriteCond local parse_rewrite_directive = function(params_cs, is_cond) local result = {} local i = 1 local stub = false local quoted = false for param in params_cs:gmatch('[^%s]+') do if param:sub(1,1) == '"' then quoted = true end if quoted then if not stub then stub = param else stub = stub..' '..param end else result[i] = param end if param:sub(param:len(),param:len()) == '"' then quoted = false result[i] = trim(stub, '"') stub = false end if not quoted then i = i + 1 end end if #result < 3 then result[3] = false else -- Flag separation local flags = trim(result[3], '[%[%]]') result[3] = {} for match in flags:gmatch('[^,]+') do table.insert(result[3], match) end end if not is_cond and result[1]:sub(1,1) == '!' then result[4] = true -- Invertion flag (RewriteRule) result[1] = result[1]:sub(2) elseif is_cond and result[2]:sub(1,1) == '!' then result[4] = true -- Invertion flag (RewriteCond) result[2] = result[2]:sub(2) else result[4] = false end return result end local parsed_rewritebase local parsed_rewriteconds = {} -- Parse and execute one .htaccess directive local parse_htaccess_directive = function(instruction, params_cs, current_dir) local params = params_cs:lower() -- case insensitive directive parameters if instruction == 'allow' then if params:match('from%s+all') then push_cdir('deny', false) else for mask in params:match('from%s+(.*)'):gmatch('[^%s]+') do if (mask:match('%a') and ip_matches_host(ip, mask)) or ip_matches_mask(ip, mask) then push_cdir('deny', false) elseif not get_cdir('allowfirst') then push_cdir('deny', true) end end end elseif instruction == 'deny' then if params:match('from%s+all') then push_cdir('deny', true) else for mask in params:match('from%s+(.*)'):gmatch('[^%s]+') do if (mask:match('%a') and ip_matches_host(ip, mask)) or ip_matches_mask(ip, mask) then push_cdir('deny', true) elseif get_cdir('allowfirst') then push_cdir('deny', false) end end end elseif instruction == 'order' then if params:match('allow%s*,%s*deny') then push_cdir('allowfirst', true) else push_cdir('allowfirst', false) end elseif instruction == 'authuserfile' then push_cdir('auth', true) htpasswd = get_file_contents(params_cs) -- this also checks if file is within root directory; fails on error push_cdir('authuserfile', params_cs) if not htpasswd then fail('AuthUserFile "'..params_cs..'" not found') end for line in htpasswd:gmatch('[^\r\n]+') do line = trim(line) username, password = line:match('([^:]*):(.*)') if username then push_cdir({'authcredentials', username}, password) end end elseif instruction == 'authname' then push_cdir('auth', true) push_cdir('authname', params_cs) elseif instruction == 'authtype' then push_cdir('auth', true) if not params == 'basic' then fail('HTTP Authentication only implemented with AuthType "Basic", requesting "'..params_cs..'"') end elseif instruction == 'require' then if params:match('^all%s+granted') then push_cdir('deny', false) elseif params:match('^all%s+denied') then push_cdir('deny', true) elseif params:match('^valid.+user') then -- HTTP Basic Authentication push_cdir('auth', true) local auth_success = false if ngx.var['http_authorization'] then local type, credentials = ngx.var['http_authorization']:match('([^%s]+)%s+(.*)') if type:lower() == 'basic' then credentials = decode_base64(credentials) local username, password = credentials:match('([^:]+):(.*)') local parsed_passwd = get_cdir('authcredentials', username) if username and password and parsed_passwd then if parsed_passwd == password then -- Plain text password auth_success = true else -- Hashed password; use htpasswd command line tool to verify -- xxx local htpasswd_proc = assert(io.popen('htpasswd -bv '..shell_escape_arg(get_cdir('authuserfile'))..' '..shell_escape_arg(username)..' '..shell_escape_arg(password)..' 2>&1')) for line in htpasswd_proc:lines() do if line:match('^Password for user .* correct.%s*$') then auth_success = true end end end end end end if auth_success == false then ngx.header['WWW-Authenticate'] = 'Basic realm='..get_cdir('authname') ngx.exit(401) end elseif params:match('^group') then fail('"Require group" is unsupported') -- Deny access to avoid false positives else local inverted = false if params:match('^not%s') then inverted = true params = params:gsub('^not%s+', ' ', 1) end if params:match('^ip%s') then for mask in params:match('^ip%s+(.*)'):gmatch('[^%s]+') do if ip_matches_mask(ip, mask) then if inverted then push_cdir('deny', false) else push_cdir('deny', true) end elseif get_cdir('allowfirst') then if inverted then push_cdir('deny', true) else push_cdir('deny', false) end end end elseif params:match('^host%s') then fail('"Require host" unsupported') -- Hostnames are unsupported. Deny access to avoid false positives elseif params:match('^expr%s') then fail('"Require expr" unsupported') -- TODO: Require expr "%{VAR} != 'XYZ'"; check if inverted==true else fail('Unrecognized parameters ("Require '..params_cs..'")') end end elseif instruction == 'redirect' or instruction == 'redirectmatch' or instruction == 'redirectpermanent' or instruction == 'redirecttemp' then local attr = parse_attributes(params_cs) local status = 302 local source, destination local regex = false local three_attrs_possible = true if instruction == 'redirectpermanent' then status = 301 three_attrs_possible = false elseif instruction == 'redirecttemp' then three_attrs_possible = false else if instruction == 'redirectmatch' then regex = true end end local parse_status = function(status_test) local test_number = tonumber(possible_status) if test_number then return test_number end status_test = tostring(status_test) if status_test:match('^[0-9]+$') then return tonumber(status_test) elseif status_test == 'permanent' then return 301 elseif status_test == 'temp' then return 302 elseif status_test == 'seeother' then return 303 elseif status_test == 'gone' then return 410 end return nil end local first_status = parse_status(attr[1]) if three_attrs_possible and attr[3] then status = first_status source = attr[2] destination = attr[3] elseif attr[2] then if three_attrs_possible and first_status then status = first_status if status<300 or status>399 then ngx.exit(status) end destination = attr[2] else source = attr[1] destination = attr[2] end elseif first_status then ngx.exit(first_status) else destination = attr[1] end if destination then local redirect = true if source then redirect = false if regex then if ngx.re.match(request_uri, source) then redirect = true end elseif request_uri == source then redirect = true end end if redirect then ngx.redirect(destination, status) end end elseif instruction == 'errordocument' then status, message = params_cs:match('^([0-9]+)%s+(.*)') if message ~= nil then push_cdir({'errordocs', tonumber(status)}, message) end elseif instruction == 'addtype' then local attr = parse_attributes(params) if attr[1] and attr[2] then local contenttype = attr[1] i = 2 while attr[i] do local ext = attr[i] if ext:sub(1,1) == '.' then ext = ext:sub(2) end push_cdir({'contenttypes', attr[i]}, attr[1]) i = i + 1 end end elseif instruction == 'rewriteengine' then if params == 'on' then push_cdir('rewrite', true) else push_cdir('rewrite', false) end elseif instruction == 'rewritebase' then parsed_rewritebase = trim(params_cs, '/')..'/' if parsed_rewritebase == '/' then parsed_rewritebase = nil end elseif instruction == 'rewritecond' then local rewrite_parsed = parse_rewrite_directive(params_cs, true) if rewrite_parsed then table.insert(parsed_rewriteconds, rewrite_parsed) end elseif instruction == 'rewriterule' then local rewrite_parsed = parse_rewrite_directive(params_cs, false) if rewrite_parsed then push_cdir('rewriterules', {current_dir, parsed_rewritebase, parsed_rewriteconds, rewrite_parsed}) end parsed_rewriteconds = {} -- Reset for next occurence of RewriteCond/RewriteRule; RewriteCond scope is only next RewriteRule elseif instruction == 'rewritemap' then fail('RewriteMap is currently unsupported') -- TODO elseif instruction == 'rewriteoptions' then fail('RewriteOptions is not yet implemented') -- TODO elseif instruction == 'acceptpathinfo' then if params == 'on' then -- TODO elseif params == 'off' and request_uri_noqs ~= request_relative_filepath then ngx.exit(404) end end end -- Replace server variables with their content local replace_server_vars = function(str, track_used_headers) local result = str local svar, replace, first_five local used_headers = {} local whitelist = { ['document_root'] = true, -- %{DOCUMENT_ROOT} ['server_addr'] = true, -- %{SERVER_ADDR} ['server_name'] = true, -- %{SERVER_NAME} ['server_port'] = true, -- %{SERVER_PORT} ['server_protocol'] = true, -- %{SERVER_PROTOCOL} ['https'] = true, -- %{HTTPS} ['remote_addr'] = true, -- %{REMOTE_ADDR} ['remote_host'] = true, -- %{REMOTE_HOST} ['remote_user'] = true, -- %{REMOTE_USER} ['remote_port'] = true, -- %{REMOTE_PORT} ['request_method'] = true, -- %{REQUEST_METHOD} ['request_filename'] = true, -- %{REQUEST_FILENAME} ['request_uri'] = true, -- %{REQUEST_URI} ['query_string'] = true -- %{QUERY_STRING} } for org_svar in str:gmatch('%%{([^}]+)}') do svar = org_svar:lower() -- Make it lowercase, which is nginx convention first_five = svar:sub(1,5):lower() replace = '' -- If variable is not found, use an empty string if first_five == 'http_' then -- %{HTTC_*}, e.g. %{HTTC_HOST} replace = ngx.var[svar] or '' if track_used_headers then table.insert(used_headers, svar:sub(6):gsub('_', '-'):lower()) end elseif first_five == 'http:' then -- %{HTTP:*}, e.g. %{HTTP:Content-Type} svar = svar:sub(6):gsub('-','_'):lower() replace = ngx.var['http_'..svar] or '' if track_used_headers then table.insert(used_headers, svar:gsub('_', '-')) end elseif first_five == 'time_' then -- %{TIME_*}, e.g. %{TIME_YEAR} svar = svar:sub(6) if svar == 'year' then replace = os.date('%Y') elseif svar == 'mon' then replace = os.date('%m') elseif svar == 'day' then replace = os.date('%d') elseif svar == 'hour' then replace = os.date('%H') elseif svar == 'min' then replace = os.date('%M') elseif svar == 'sec' then replace = os.date('%S') elseif svar == 'wday' then replace = os.date('%w') end elseif whitelist[svar] then replace = ngx.var[svar] elseif svar == 'script_filename' then -- %{SCRIPT_FILENAME} replace = ngx.var['fastcgi_script_name'] if not replace or replace == '' then replace = ngx.var['request_filename'] else replace = (ngx.var['document_root']..'/'..script_filename):gsub('/+', '/') end replace = script_filename elseif svar == 'request_scheme' then -- %{REQUEST_SCHEME} replace = ngx.var['scheme'] elseif svar == 'the_request' then -- %{THE_REQUEST} replace = ngx.var['request'] elseif svar == 'ipv6' then -- %{IPV6} if not ngx.var['remote_addr']:match('^[0-9]+%.[0-9]+%.[0-9]+%.[0-9]+$') then replace = 'on' end elseif svar == 'time' then -- %{TIME} replace = os.date('%Y%m%d%H%M%S') end result = result:gsub('%%{'..org_svar..'}', replace)..'' end if track_used_headers then return result, used_headers else return result end end -- Walk through all htaccess statements collected from all directories local block_stack = {} local block_level = 0 local block_ignore_mode = false local block_ignore_until = 0 local tag_name, the_rest, last_tag local current_dir local stat_instructions_used = {} local stat_blocks_used = {} for statement in htaccess:gmatch('[^\r\n]+') do if statement:sub(1,1) == '<' then -- handle blocks if statement:sub(2,2) ~= '/' then -- opening tag <...> tag_name = statement:match('^<([^%s>]+)'):lower() local attr = parse_attributes(statement:sub(string.len(tag_name)+2, string.len(statement)-1)) local use_block = false if not block_ignore_mode then local inverted = false stat_blocks_used[tag_name] = true if tag_name == 'ifmodule' then local module = attr[1]:lower() if module:sub(1,1) == '!' then inverted = true module = module:sub(2) end local supported_modules = { ['rewrite'] = true, ['alias'] = true, ['mime'] = true, ['core'] = true, ['authn_core'] = true, ['authn_file'] = true, ['authz_core'] = true, ['access_compat'] = true, ['version'] = true } module = module:gsub('^mod_', ''):gsub('_module$', ''):gsub('%.c$', '') if supported_modules[module] then use_block = true else use_block = false end elseif tag_name == 'ifdirective' then local directive = attr[1]:lower() if directive:sub(1,1) == '!' then inverted = true directive = directive:sub(2) end if directive and stat_instructions_used[directive] then use_block = true else use_block = false end elseif tag_name == 'ifsection' then local block = attr[1]:lower() if block:sub(1,1) == '!' then inverted = true block = block:sub(2) end if block and stat_blocks_used[block] then use_block = true else use_block = false end elseif tag_name == 'iffile' then local file = attr[1] if file:sub(1,1) == '!' then inverted = true file = file:sub(2) end if path_exists(file, true) then use_block = true else use_block = false end elseif tag_name == 'files' or tag_name == 'filesmatch' then use_block = false local regex = false local test = attr[1] if tag_name == 'filesmatch' then regex = true elseif attr[1] == '~' then regex = true test = attr[2] end if regex then if ngx.re.match(request_filename, test) then use_block = true -- TODO: Add match as environment variable -- <FilesMatch "^(?<sitename>[^/]+)"> ==> %{env:MATCH_SITENAME} end elseif request_filename == test or request_filename:match(test:gsub('%.', '%.'):gsub('%?', '.'):gsub('*', '.+')) then use_block = true end elseif tag_name == 'limit' or tag_name == 'limitexcept' then if tag_name == 'limitexcept' then inverted = true end local method = ngx.var['request_method'] local matches = false for _, limit in ipairs(attr) do if limit == method then matches = true break end end use_block = matches elseif tag_name == 'ifversion' then local simulated_version = '2.4.0' -- Assume Apache version local cmp = '=' local test = attr[1] if attr[2] then cmp = attr[1] test = attr[2] if cmp:sub(1,1) == '!' then inverted = true cmp = cmp:sub(2) end end local regex = false if test:match('^/') and test:match('/$') then regex = true test = test:sub(2):sub() elseif cmp == '~' then regex = true end if regex then use_block = ngx.re.match(simulated_version, test) else local convert_version = function(version) -- calculate a single number out of version string version = tostring(version):gmatch('[0-9]+') local i = 0 local total_version = 0 for num in version do i = i + 1 total_version = total_version + tonumber(num) * 1000000000 * (10 ^ -(i * 3)) end return total_version end local my_version = convert_version(simulated_version) local test_version = convert_version(test) if cmp == '=' or cmp == '==' then use_block = (my_version == test_version) elseif cmp == '>' then use_block = (my_version > test_version) elseif cmp == '>=' then use_block = (my_version >= test_version) elseif cmp == '<' then use_block = (my_version < test_version) elseif cmp == '<=' then use_block = (my_version <= test_version) end end end if inverted then use_block = not use_block end end if use_block then push_ctx(tag_name, attr) elseif not block_ignore_mode then block_ignore_mode = true block_ignore_until = block_level end table.insert(block_stack, tag_name) -- push tag to block stack for tracking opening and closing tags (syntax check) block_level = block_level + 1 else -- closing tag </...> tag_name = statement:match('^</([^>%s]+)'):lower() last_tag = table.remove(block_stack) -- pop last tag from block stack if last_tag ~= tag_name then fail('.htaccess syntax error: Closing </'..tag_name..'> without opening tag') end block_level = block_level - 1 if block_ignore_mode then if block_level == block_ignore_until then block_ignore_mode = false block_ignore_until = 0 end else pop_ctx() end end else local instruction = statement:match('^[^%s]+') if instruction then instruction = instruction:lower() -- directive (lower case) local params_cs = trim(statement:sub(instruction:len()+1)) -- case sensitive directive parameters if instruction == C_DIR then -- virtual directive handing over file path of original .htaccess file -- new .htaccess file - reset all block awareness features block_stack = {} block_level = 0 block_ignore_mode = false block_ignore_until = 0 reset_ctx() -- start with blank contexts push_ctx(C_DIR, params_cs) current_dir = params_cs elseif not block_ignore_mode then stat_instructions_used[instruction] = true parse_htaccess_directive(instruction, params_cs, current_dir) end end end end -- Execute parsed instructions if get_cdir('deny') then ngx.exit(403) end -- Actual rewriting local parsed_rewriterules = get_cdir('rewriterules', C_MULTIPLE) -- Skip rewrite handling if no rules found if get_cdir('rewrite') and #parsed_rewriterules > 0 then -- Rewrite handling local uri = request_uri:sub(2) -- Remove leading '/' to match RewriteRule behaviour within .htaccess files local dir, base, relative_uri, conds, regex, dst, flags, inverted, matches, cond_met, cond_test, cond_expr, cond_pattern, cond_flags, cond_inverted, cond_matches, cond_vary_headers, used_headers, flag, flag_value, regex_options local redirect = false local always_matches = {['^']=true, ['.*']=true, ['^.*']=true, ['^.*$']=true} local skip = 0 for _, ruleset in ipairs(parsed_rewriterules) do if skip > 0 then skip = skip - 1 goto next_ruleset end dir = ruleset[1] base = ruleset[2] or dir if uri:sub(1, base:len()) ~= base then goto next_ruleset end redirect = false relative_uri = uri:sub(base:len()+1) conds = ruleset[3] regex = ruleset[4][1] dst = ruleset[4][2]:gsub('%?$', '', 1) -- Make sure destination doesn't end on '?', as request_uri will never match that flags = ruleset[4][3] inverted = ruleset[4][4] -- RewriteCond handling cond_met = true cond_vary_headers = {} if conds then for _, condset in ipairs(conds) do cond_test = condset[1] if cond_test:lower() == 'expr' then cond_expr = true else cond_expr = false cond_test, used_headers = replace_server_vars(cond_test, true) if used_headers and #used_headers > 0 then for _, h in pairs(used_headers) do cond_vary_headers[h] = true end end end cond_pattern = condset[2] cond_inverted = condset[4] cond_flags = {} regex_options = '' if condset[3] then for _, flag in pairs(condset[3]) do flag = flag:lower() if flag == 'nocase' then -- [NC] flag = 'nc' elseif flag == 'ornext' then -- [OR] flag = 'or' elseif flag == 'novary' then -- [NV] flag = 'nv' end cond_flags[flag] = true end end if cond_flags['nc'] then regex_options = 'i' end if cond_expr then -- 'expr' conditions fail('RewriteCond expressions ("expr ...") are unsupported') -- We don't support expr style conditions due to their weird complexity and redundancy elseif cond_pattern:sub(1,1) == '-' then -- File attribute tests or integer comparisons (case sensitive) local filepath = cond_test:gsub('/$','',1) if cond_pattern == '-d' then -- is directory cond_matches = path_exists(filepath..'/') elseif cond_pattern == '-f' or cond_pattern == '-F' then -- is file cond_matches = path_exists(filepath) and not path_exists(filepath..'/') else fail('RewriteCond pattern unsupported: '..cond_pattern) end elseif cond_pattern:match('^[<>=]') then -- Lexicographical comparisons fail('RewriteCond lexicographical string comparisons are unsupported: '..cond_pattern) else cond_matches = ngx.re.match(cond_test, cond_pattern, regex_options) end if cond_inverted then cond_matches = not cond_matches end if cond_matches then cond_met = true if cond_flags['or'] then goto handle_conds end else cond_met = false if not cond_flags['or'] then goto next_ruleset end end -- Add "Vary" header if no [NV] flag is present and headers have been used if not cond_flags['nv'] then local vary = false for h, _ in pairs(cond_vary_headers) do h = h:sub(1, 1):upper()..h:sub(2):gsub('-%l', string.upper) -- Uppercase header words if vary then vary = vary..', '..h else vary = h end end if vary then ngx.header['Vary'] = vary end end end end ::handle_conds:: if not cond_met then goto next_ruleset end -- Flag handling regex_options = '' local flag_fns = {} -- These functions are being called once rule is matched if flags then for _, rawflag in pairs(flags) do flag = rawflag:match('^[^=]+'):lower() -- flags are case insensitive flag_value = '' if flag then if flag:len() < rawflag:len() then flag_value = rawflag:sub(flag:len()+2) end if flag == 'nc' or flag == 'nocase' then -- [NC] regex_options = regex_options..'i' elseif flag == 'co' or flag == 'cookie' then -- [CO=NAME:VALUE:DOMAIN:lifetime:path:secure:httponly] table.insert(flag_fns, { val = flag_value, fn = function(val) if not val then return end local separator = ':' if val:sub(1,1) == ';' then separator = ';' val = val:sub(2) end stubs = {} for stub in val:gmatch('[^'..separator..']+') do table.insert(stubs, stub) end if not stubs[1] or not stubs[2] then return end local cookie = stubs[1]..'='..stubs[2] if not stubs[3] then goto set_cookie end cookie = cookie..'; Domain='..stubs[3] if not stubs[4] then goto set_cookie end cookie = cookie..'; Expires='..ngx.cookie_time(ngx.time() + stubs[4]*60) if not stubs[5] then goto set_cookie end cookie = cookie..'; Path='..stubs[5] if not stubs[6] then goto set_cookie end if ({['1'] = true, ['secure'] = true, ['true'] = true})[stubs[6]:lower()] then cookie = cookie..'; Secure' end if not stubs[7] then goto set_cookie end if ({['1'] = true, ['httponly'] = true, ['true'] = true})[stubs[7]:lower()] then cookie = cookie..'; HttpOnly' end ::set_cookie:: ngx.header['Set-Cookie'] = cookie end }) elseif flag == 'l' or flag == 'last' then -- [L] -- TODO: Jump to next htaccess in any subdirectory table.insert(flag_fns, { fn = function() cache_set(trace_id, C_STATUS_VOID) -- Mark request as void end }) elseif flag == 'end' then -- [END] table.insert(flag_fns, { fn = function() cache_set(trace_id, C_STATUS_VOID) -- Mark request as void end }) elseif flag == 'bnp' or flag == 'backrefnoplus' then -- [BNP] -- Do nothing, we're gonna use '%20' instead of '+' anyway elseif flag == 'f' or flag == 'forbidden' then -- [F] redirect = 403 elseif flag == 'g' or flag == 'gone' then -- [F] redirect = 410 elseif flag == 'r' or flag == 'redirect' then -- [R] if flag_value:match('^[0-9]+$') then redirect = tonumber(flag_value) else redirect = 302 end elseif flag == 'qsa' or flag == 'qsappend' then -- [QSA] local qs = relative_uri:match('%?.*') if qs then local new_qs = dst:match('%?.*') if new_qs then dst = dst:gsub('%?.*', '', 1)..qs..'&'..new_qs:sub(2) else dst = dst..new_qs end end elseif flag == 'qsd' or flag == 'qsdiscard' then -- [QSD] relative_uri = relative_uri:gsub('%?.*', '', 1) elseif flag == 's' or flag == 'skip' then -- [S=n] if flag_value:match('^[0-9]+$') then skip = flag_value else fail('Invalid flag value: ['..rawflag..'], expecting a number') end else fail('Unsupported RewriteRule flag: '..flag) end end end end -- Match handling if always_matches[regex] then matches = true else matches = ngx.re.match(relative_uri, regex, regex_options) end if inverted then matches = not matches -- Invert matches end if matches then -- Perform flag operations on match for _, flag in pairs(flag_fns) do flag['fn'](flag['val']) end if dst ~= '-' then -- '-' means don't perform a rewrite dst = replace_server_vars(dst) -- Apply server variables if type(matches) == 'table' then -- Replace captured strings from RewriteRule ($n) in dst for i, match in ipairs(matches) do dst = dst:gsub('%$'..i, match:gsub('%%', '%%%%')..'') -- make sure no capture indexes are being used as replacement end end if type(cond_matches) == 'table' then -- Replace captured strings from RewriteCond (%n) in dst for i, match in ipairs(cond_matches) do dst = dst:gsub('%%'..i, match:gsub('%%', '%%%%')..'') -- make sure no capture indexes are being used as replacement end end if (not redirect or not dst:match('^https?://')) and dst:sub(1,1) ~= '/' then dst = '/'..base..dst end if dst:match('%.%.') then fail('Parent directory selector /../ not allowed in RewriteRule for security reasons') end if request_uri ~= dst then if redirect then -- Perform an external redirect or final HTTP status if redirect > 300 and redirect < 400 then ngx.redirect(dst, redirect) else ngx.exit(redirect) end else -- Perform an internal subrequest cache_set(htaccess_cache_key, htaccess, 0.1) -- Cache htaccess lines right before subrequest ngx.exec(dst) end end end end ::next_ruleset:: end end -- Execute directives other than RewriteRule -- Add Content-Type header according to AddType if request_fileext ~= nil then local contenttype = get_cdir('contenttypes', request_fileext) if contenttype ~= nil then ngx.header['Content-Type'] = contenttype end end -- ErrorDocument handling if false then -- TODO: Check if file exists or access denied... how to do that? local status = 404 local response = get_cdir('errordocs', status) if response then if response:sub(1,1) == '/' then -- URI request ngx.exec(response) else if response:match('^https?://') and not response:match('%s') then -- Internal redirect ngx.status = status ngx.redirect(response) else -- String output ngx.status = status ngx.print(response) ngx.exit(status) end end else ngx.exit(status) end end
secondtruth/htaccess-for-nginx
<|start_filename|>modules/core/signal/bench/common_fft.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2011 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2013 LRI UMR 8623 CNRS/Univ Paris Sud XI // Copyright 2012 - 2013 MetaScale SAS // Copyright 2012 <NAME>, Little Endian Ltd. // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef COMMON_FFT_INCLUDED #define COMMON_FFT_INCLUDED #include <nt2/sdk/unit/details/prng.hpp> #include <boost/simd/memory/allocator.hpp> #ifdef __APPLE__ #include <boost/simd/include/functions/scalar/ilog2.hpp> #include "Accelerate/Accelerate.h" //vDSP.h #endif #ifdef _WIN32 #include "windows.h" #endif #include <cstdlib> #include <cstdio> #include <vector> #if defined( BOOST_SIMD_HAS_LRB_SUPPORT ) || defined( BOOST_SIMD_HAS_AVX_SUPPORT ) typedef double T; #else //...zzz...cardinal-must-be-4 limitation... typedef float T; #endif namespace constants { static std::size_t const minimum_dft_log = 5; static std::size_t const maximum_dft_log = 14; static std::size_t const minimum_dft_size = 1 << minimum_dft_log; static std::size_t const maximum_dft_size = 1 << maximum_dft_log; static T const test_data_range_minimum = -1; static T const test_data_range_maximum = +1; } typedef std::vector<T, boost::simd::allocator<T> > dynamic_aligned_array; typedef nt2::static_fft < constants::minimum_dft_size , constants::maximum_dft_size , T> FFT; //============================================================================== // Base Real FFT Experiment //============================================================================== struct real_fft { real_fft( std::size_t n ) : size_(n) , real_time_data_(size_) , real_frequency_data_(size_/2+1) , imag_frequency_data_(size_/2+1) { nt2::roll ( real_frequency_data_ , constants::test_data_range_minimum , constants::test_data_range_maximum ); nt2::roll ( imag_frequency_data_ , constants::test_data_range_minimum , constants::test_data_range_maximum ); } std::size_t size() const { return size_; } friend std::ostream& operator<<(std::ostream& os, real_fft const& p) { return os << "(" << p.size_ << ")"; } std::size_t size_; dynamic_aligned_array real_time_data_; dynamic_aligned_array real_frequency_data_; dynamic_aligned_array imag_frequency_data_; }; //============================================================================== // Base Complex FFT experiment //============================================================================== struct complex_fft { complex_fft ( std::size_t n ) : size_(n) , real_data_(size_) , imag_data_(size_) { nt2::roll ( real_data_ , constants::test_data_range_minimum , constants::test_data_range_maximum ); nt2::roll ( imag_data_ , constants::test_data_range_minimum , constants::test_data_range_maximum ); } std::size_t size() const { return size_*2; } friend std::ostream& operator<<(std::ostream& os, complex_fft const& p) { return os << "(" << p.size_ << ")"; } std::size_t size_; dynamic_aligned_array real_data_; dynamic_aligned_array imag_data_; }; #ifdef __APPLE__ //============================================================================== // Base Apple vDSP Complex FFT experiment //============================================================================== FFTSetup fft_instance_ = 0; struct apple_fft { apple_fft( std::size_t n ) : log2length_( boost::simd::ilog2( n ) ) { } std::size_t log2length() const { return log2length_ ; } std::size_t log2length_; }; //============================================================================== // Base Apple vDSP Real FFT experiment //============================================================================== struct apple_real_fft : public apple_fft, public real_fft { apple_real_fft( std::size_t n ) : apple_fft(n), real_fft(n) {} DSPSplitComplex split_data() { DSPSplitComplex complex_data = { &real_frequency_data_[0] , &imag_frequency_data_[0] }; return complex_data; } }; #endif #endif <|start_filename|>modules/boost/simd/sdk/include/boost/simd/sdk/simd/category.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef BOOST_SIMD_SDK_SIMD_CATEGORY_HPP_INCLUDED #define BOOST_SIMD_SDK_SIMD_CATEGORY_HPP_INCLUDED #include <boost/dispatch/meta/hierarchy_of.hpp> #include <boost/dispatch/meta/property_of.hpp> namespace boost { namespace dispatch { namespace meta { template<class T, class X> struct simd_ : simd_< typename T::parent, X > { typedef simd_< typename T::parent, X > parent; }; template<class T,class X> struct simd_< unspecified_<T>, X > : generic_< typename property_of<T>::type > { typedef generic_< typename property_of<T>::type > parent; }; //============================================================================ // logical_ is the hierarchy of logical<T> and goes straight to fundamental //============================================================================ template<class T> struct logical_ : fundamental_<T> { typedef fundamental_<T> parent; }; //============================================================================ // hierarchies for tags //============================================================================ template<class T> struct abstract_ : unspecified_<T> { typedef unspecified_<T> parent; }; template<class T> struct elementwise_ : unspecified_<T> { typedef unspecified_<T> parent; }; template<class T, class Op, class Neutral> struct reduction_ : unspecified_<T> { typedef unspecified_<T> parent; }; template<class T, class Op, class Neutral> struct cumulative_ : unspecified_<T> { typedef unspecified_<T> parent; }; } } } namespace boost { namespace simd { namespace ext { using boost::dispatch::meta::simd_; using boost::dispatch::meta::logical_; using boost::dispatch::meta::abstract_; using boost::dispatch::meta::elementwise_; using boost::dispatch::meta::reduction_; using boost::dispatch::meta::cumulative_; } } } #endif <|start_filename|>modules/boost/simd/base/include/boost/simd/reduction/functions/maximum.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef BOOST_SIMD_REDUCTION_FUNCTIONS_MAXIMUM_HPP_INCLUDED #define BOOST_SIMD_REDUCTION_FUNCTIONS_MAXIMUM_HPP_INCLUDED #include <boost/simd/include/functor.hpp> #include <boost/dispatch/include/functor.hpp> #include <boost/simd/include/constants/maxinit.hpp> namespace boost { namespace simd { namespace tag { /*! @brief maximum generic tag Represents the maximum function in generic contexts. @par Models: Hierarchy **/ struct max_; struct Maxinit; struct maximum_ : ext::reduction_<maximum_, tag::max_, tag::Maxinit> { /// @brief Parent hierarchy typedef ext::reduction_<maximum_, tag::max_, tag::Maxinit> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_maximum_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::maximum_, Site> dispatching_maximum_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::maximum_, Site>(); } template<class... Args> struct impl_maximum_; } /*! Returns the greatest element of the SIMD vector @par Semantic: For every parameter of type T0 @code scalar_of<T0> r = maximum(a0); @endcode is similar to: @code scalar_of<T0> r = Minf; for(std::size_t i=0;i<cardinal_of<T0>;++i) r = r < a0[i] ? a0[i] : r; @endcode @param a0 @return a value of the scalar type associated to the parameter **/ BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::maximum_, maximum, 1) BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::maximum_, maximum, 2) } } #endif <|start_filename|>modules/core/generative/include/nt2/core/functions/sub2ind.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2011 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2011 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_CORE_FUNCTIONS_SUB2IND_HPP_INCLUDED #define NT2_CORE_FUNCTIONS_SUB2IND_HPP_INCLUDED #include <nt2/include/functor.hpp> #include <nt2/sdk/parameters.hpp> #include <boost/preprocessor/arithmetic/inc.hpp> #include <boost/preprocessor/repetition/repeat_from_to.hpp> namespace nt2 { namespace tag { /*! @brief sub2ind generic tag Represents the sub2ind function in generic contexts. @par Models: Hierarchy **/ struct sub2ind_ : ext::elementwise_<sub2ind_> { typedef ext::elementwise_<sub2ind_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_sub2ind_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::sub2ind_, Site> dispatching_sub2ind_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::sub2ind_, Site>(); } template<class... Args> struct impl_sub2ind_; } #define M0(z,n,t) \ NT2_FUNCTION_IMPLEMENTATION(nt2::tag::sub2ind_, sub2ind, n) \ /**/ BOOST_PP_REPEAT_FROM_TO(2,BOOST_PP_INC(BOOST_PP_INC(NT2_MAX_DIMENSIONS)),M0,~) #undef M0 #if defined(DOXYGEN_ONLY) /*! @brief Convert subscripts to linear indices Determines the linear index equivalents to the specified subscripts for each dimension of an N-dimensional container of size . @param sz Size sequence of target container @param dims Subscript to convert @return A linear index pointing to the same element than \c pos. **/ template<typename Size, typename Dims...> detail::unspecified sub2ind(Size const& sz, Dims const& ... dims); #endif } #endif <|start_filename|>modules/boost/simd/base/include/boost/simd/swar/functions/cummin.hpp<|end_filename|> //============================================================================== // Copyright 2014 <NAME> // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef BOOST_SIMD_SWAR_FUNCTIONS_CUMMIN_HPP_INCLUDED #define BOOST_SIMD_SWAR_FUNCTIONS_CUMMIN_HPP_INCLUDED #include <boost/simd/include/functor.hpp> #include <boost/dispatch/include/functor.hpp> #include <boost/simd/include/functions/min.hpp> #include <boost/simd/constant/constants/inf.hpp> namespace boost { namespace simd { namespace tag { /*! @brief cummin generic tag Represents the cummin function in generic contexts. @par Models: Hierarchy **/ struct cummin_ : ext::cumulative_<cummin_, tag::min_, tag::Inf> { /// @brief Parent hierarchy typedef ext::cumulative_<cummin_, tag::min_, tag::Inf> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_cummin_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::cummin_, Site> dispatching_cummin_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::cummin_, Site>(); } template<class... Args> struct impl_cummin_; } /*! @brief compute the cumulate minimum of the vector elements @par Semantic: For every parameter of type T0 @code T0 r = cummin(a0); @endcode is similar to: @code T r =x; for(int i=0;i < T::static_size; ++i) r[i] += min(r[i-1], r[i]); @endcode @param a0 @return a value of the same type as the second parameter **/ BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::cummin_, cummin, 1) BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::cummin_, cummin, 2) } } #endif <|start_filename|>modules/boost/simd/base/include/boost/simd/constant/constants/allbits.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2011 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2011 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef BOOST_SIMD_CONSTANT_CONSTANTS_ALLBITS_HPP_INCLUDED #define BOOST_SIMD_CONSTANT_CONSTANTS_ALLBITS_HPP_INCLUDED #include <boost/simd/include/functor.hpp> #include <boost/simd/meta/int_c.hpp> #include <boost/simd/meta/float.hpp> #include <boost/simd/meta/double.hpp> #include <boost/simd/constant/hierarchy.hpp> namespace boost { namespace simd { namespace tag { /*! @brief Allbits generic tag Represents the Allbits constant in generic contexts. @par Models: Hierarchy **/ struct Allbits : ext::pure_constant_<Allbits> { typedef double default_type; typedef ext::pure_constant_<Allbits> parent; /// INTERNAL ONLY template<class Target, class Dummy=void> struct apply : meta::int_c<typename Target::type, -1> {}; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_Allbits( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; /// INTERNAL ONLY template<class T, class Dummy> struct Allbits::apply<boost::dispatch::meta::single_<T>,Dummy> : meta::single_ < apply < boost::dispatch::meta::uint32_<uint32_t> , Dummy >::value > {}; /// INTERNAL ONLY template<class T, class Dummy> struct Allbits::apply<boost::dispatch::meta::double_<T>,Dummy> : meta::double_ < apply < boost::dispatch::meta::uint64_<uint64_t> , Dummy >::value > {}; /// INTERNAL ONLY template<class T, class Dummy> struct Allbits::apply<boost::dispatch::meta::uint8_<T>,Dummy> : meta::int_c<T, 0xFF> {}; /// INTERNAL ONLY template<class T, class Dummy> struct Allbits::apply<boost::dispatch::meta::uint16_<T>,Dummy> : meta::int_c<T, 0xFFFFU> {}; /// INTERNAL ONLY template<class T, class Dummy> struct Allbits::apply<boost::dispatch::meta::uint32_<T>,Dummy> : meta::int_c<T, 0xFFFFFFFFUL> {}; /// INTERNAL ONLY template<class T, class Dummy> struct Allbits::apply<boost::dispatch::meta::uint64_<T>,Dummy> : meta::int_c<T, 0xFFFFFFFFFFFFFFFFULL> {}; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::Allbits, Site> dispatching_Allbits(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::Allbits, Site>(); } template<class... Args> struct impl_Allbits; } /*! Generates a value in the chosen type all bits of which are set to 1. @par Semantic: @code T r = Allbits<T>(); @endcode is similar to @code if T is floating point r = Nan<T>(); else if T is signed integral r = -1; else r = Valmax<T>(); @endcode **/ BOOST_SIMD_CONSTANT_IMPLEMENTATION(boost::simd::tag::Allbits, Allbits) } } #include <boost/simd/constant/common.hpp> #endif <|start_filename|>modules/core/base/include/nt2/core/utility/share.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2011 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2011 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_CORE_UTILITY_SHARE_HPP_INCLUDED #define NT2_CORE_UTILITY_SHARE_HPP_INCLUDED /**! * @file * @brief Defines the \c nt2::share Range adaptor **/ #include <iterator> #include <boost/array.hpp> #include <nt2/sdk/memory/fixed_allocator.hpp> namespace nt2 { //============================================================================ /**! * @brief Range adaptor for sharing data within Container * * Convert an ContiguousIterator range into a type suitable to initializing a * container using the \c nt2::shared_ settings. * * @param begin Iterator to the first element of the range to adapt * @param end Iterator to the past-the-end element of the range to adapt * * @return A \c nt2::memory::fixed_allocator adapting the initial Range. * * @code * std::vector<float> v(16); * table<float, shared_> t( share(v.begin(), v.end(), of_size(16) ); * * assert(t(1) == v[0]); * @endcode * * In this example, t will beahve as a regular \c nt2::table but will peruse * the memory owned by the \c std::vector \c v. When \c t will go out of scope, * no memory will be released by \c t itself. * * @note Using shared data is an advanced feature and require precise * monitoring of actual data life span. More precisely, returning shared data * from function while sharing local memory has to be avoided. * **/ //============================================================================ template<class ContiguousIterator> memory::fixed_allocator < typename std::iterator_traits<ContiguousIterator>::value_type > share(ContiguousIterator begin, ContiguousIterator end) { memory::fixed_allocator < typename std::iterator_traits<ContiguousIterator>::value_type > that(begin,end); return that; } //============================================================================ // Overload for static array and boost::array // TODO: std::array support //============================================================================ template<class Type, std::size_t Size> memory::fixed_allocator<Type> share( boost::array<Type,Size>& values) { memory::fixed_allocator<Type> that(values.begin(),values.end()); return that; } template<class Type, std::size_t Size> memory::fixed_allocator<Type> share( Type (&values)[Size]) { memory::fixed_allocator<Type> that(&values[0], &values[0]+Size); return that; } } #endif <|start_filename|>modules/core/polynom/include/nt2/polynom/functions/deconv.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_POLYNOM_FUNCTIONS_DECONV_HPP_INCLUDED #define NT2_POLYNOM_FUNCTIONS_DECONV_HPP_INCLUDED #include <nt2/include/functor.hpp> #include <nt2/sdk/meta/size_as.hpp> #include <nt2/sdk/meta/value_as.hpp> #include <nt2/core/container/dsl/size.hpp> #include <nt2/sdk/meta/tieable_hierarchy.hpp> #include <nt2/core/container/dsl/value_type.hpp> namespace nt2 { namespace tag { /*! @brief deconv generic tag Represents the deconv function in generic contexts. @par Models: Hierarchy **/ struct deconv_ : ext::tieable_<deconv_> { /// @brief Parent hierarchy typedef ext::tieable_<deconv_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_deconv_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::deconv_, Site> dispatching_deconv_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::deconv_, Site>(); } template<class... Args> struct impl_deconv_; } /*! Polynominial euclidian division @par Semantic: For every expressions representing polynomials a and b @code tie(q, r)= deconv(a, b); @endcode Produces 2 polynomials q and r such that (mathematically), a = bq+r and degree(r) < degree(b) @param a0 @param a1 @return a pair of polynomials **/ NT2_FUNCTION_IMPLEMENTATION(tag::deconv_, deconv, 2) } #endif <|start_filename|>modules/core/linalg/include/nt2/linalg/functions/null.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_LINALG_FUNCTIONS_NULL_HPP_INCLUDED #define NT2_LINALG_FUNCTIONS_NULL_HPP_INCLUDED #include <nt2/include/functor.hpp> #include <nt2/sdk/memory/container.hpp> #include <nt2/sdk/meta/size_as.hpp> #include <nt2/sdk/meta/value_as.hpp> #include <nt2/core/container/dsl/value_type.hpp> #include <nt2/core/container/dsl/size.hpp> namespace nt2 { namespace tag { /// @brief Define the tag null_ of functor null struct null_ : ext::abstract_<null_> { typedef ext::abstract_<null_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_null_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::null_, Site> dispatching_null_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::null_, Site>(); } template<class... Args> struct impl_null_; } /*! @brief null: null space of a matrix expression. Computes an orthonormal basis for the null space of a obtained from the singular value decomposition with a given tolerance. @param a0 Matrix to computes null space for @param a1 Tolerance on belonging to the null space. By default, it's equal to length(a)*Eps*w, with w being the largest singular value of a **/ BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::null_, null, 2) /// @overload BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::null_, null, 1) } #endif <|start_filename|>modules/core/statistics/include/nt2/statistics/functions/normcdf.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_STATISTICS_FUNCTIONS_NORMCDF_HPP_INCLUDED #define NT2_STATISTICS_FUNCTIONS_NORMCDF_HPP_INCLUDED #include <nt2/include/functor.hpp> #include <nt2/sdk/meta/size_as.hpp> #include <nt2/sdk/meta/value_as.hpp> #include <nt2/core/container/dsl/size.hpp> #include <nt2/core/container/dsl/value_type.hpp> #include <nt2/sdk/meta/tieable_hierarchy.hpp> #include <nt2/core/utility/max_extent.hpp> namespace nt2 { namespace tag { /*! @brief normcdf generic tag Represents the normcdf function in generic contexts. @par Models: Hierarchy **/ struct normcdf_ : ext::tieable_<normcdf_> { /// @brief Parent hierarchy typedef ext::tieable_<normcdf_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_normcdf_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; struct normcdf0_ : ext::elementwise_<normcdf0_> { /// @brief Parent hierarchy typedef ext::elementwise_<normcdf0_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_normcdf0_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::normcdf_, Site> dispatching_normcdf_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::normcdf_, Site>(); } template<class... Args> struct impl_normcdf_; template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::normcdf0_, Site> dispatching_normcdf0_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::normcdf0_, Site>(); } template<class... Args> struct impl_normcdf0_; } /*! normal cumulative distribution of mean m and standard deviation s @par Semantic: For every table expression and optional mean and standard deviation. @code auto r = normcdf(a0, m, s); @endcode is similar to: @code auto r =erfc(Sqrt_2o_2*((m-a0)/s))/2; @endcode @see @funcref{erfc}, @funcref{Sqrt_2o_2}, @param a0 @param a1 optional mean default to 0 @param a2 optional standard deviation default to 1 @return an expression which eventually will evaluate to the result **/ NT2_FUNCTION_IMPLEMENTATION(tag::normcdf0_, normcdf, 3) /// @overload NT2_FUNCTION_IMPLEMENTATION(tag::normcdf0_, normcdf, 1) /// @overload NT2_FUNCTION_IMPLEMENTATION(tag::normcdf0_, normcdf, 2) /*! normal cumulative distribution of estimated mean m and standard deviation s with bounds estimates @par Semantic: For every table expression and optional mean and standard deviation. @code tie(r, rlo, rup) = normcdf(a0, m, s, cov, alpha); @endcode Returns r = normcdf(a0, m, s), but also produces confidence bounds for p when the input parameters m and s are estimates. cov is a 2-by-2 matrix containing the covariance matrix of the estimated parameters. alpha has a default value of 0.05, and specifies 100*(1-alpha)% confidence bounds. rlo and rup are arrays of the same size as a0 containing the lower and upper confidence bounds. @param a0 @param a1 mean estimate @param a2 standard deviation estimate. @param a3 covariance matrix of the estimated a1 and a2 @param a4 optional confidence bound (default to 0.05) @return an expression which eventually will evaluate to the result **/ NT2_FUNCTION_IMPLEMENTATION(tag::normcdf_, normcdf, 5) /// @overload NT2_FUNCTION_IMPLEMENTATION(tag::normcdf_, normcdf, 4) } namespace nt2 { namespace ext { /// INTERNAL ONLY template<class Domain, int N, class Expr> struct size_of<tag::normcdf_,Domain,N,Expr> // N = 4 or 5 { typedef typename boost::proto::result_of::child_c<Expr&,0> ::value_type::extent_type ext0_t; typedef typename boost::proto::result_of::child_c<Expr&,1> ::value_type::extent_type ext1_t; typedef typename boost::proto::result_of::child_c<Expr&,2> ::value_type::extent_type ext2_t; typedef typename utility::result_of::max_extent<ext2_t, ext1_t, ext0_t>::type result_type; BOOST_FORCEINLINE result_type operator()(Expr& e) const { return utility::max_extent(nt2::extent(boost::proto::child_c<0>(e)), nt2::extent(boost::proto::child_c<1>(e)), nt2::extent(boost::proto::child_c<2>(e))); } }; /// INTERNAL ONLY template<class Domain, class Expr> struct size_of<tag::normcdf_,Domain,1,Expr> : meta::size_as<Expr,0> {}; /// INTERNAL ONLY template<class Domain, int N, class Expr> struct value_type<tag::normcdf_,Domain,N,Expr> : meta::value_as<Expr,0> {}; } } #endif <|start_filename|>modules/boost/simd/base/include/boost/simd/swar/functions/split_multiplies.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef BOOST_SIMD_SWAR_FUNCTIONS_SPLIT_MULTIPLIES_HPP_INCLUDED #define BOOST_SIMD_SWAR_FUNCTIONS_SPLIT_MULTIPLIES_HPP_INCLUDED #include <boost/simd/include/functor.hpp> #include <boost/dispatch/include/functor.hpp> namespace boost { namespace simd { namespace tag { /// @brief Hierarchy tag for split_multiplies function struct split_multiplies_ : ext::elementwise_<split_multiplies_> { typedef ext::elementwise_<split_multiplies_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_split_multiplies_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::split_multiplies_, Site> dispatching_split_multiplies_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::split_multiplies_, Site>(); } template<class... Args> struct impl_split_multiplies_; } /*! @brief SIMD register type-based multiplies and split @c split_multiplies multiplies two x-bit SIMD registers and returns two 2x-bit registers each having half the cardinal of the original inputs. @param a0 LHS of multiplication @param a1 RHS of multiplication @return A Fusion Sequence containing the result of @c a0 * @c a1 **/ BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::split_multiplies_, split_multiplies, 2) BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::split_multiplies_, full_mul, 2) BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::split_multiplies_, wide_mul, 2) /*! @brief SIMD register type-based multiplies and split @c split_multiplies multiplies two x-bit SIMD registers and returns two 2x-bit registers each having half the cardinal of the original inputs. @param a0 LHS of multiplication @param a1 RHS of multiplication @param a2 L-Value that will receive the second sub-part of @c a0 * @c a1 @return The first sub-part of @c a0 * @c a1 **/ BOOST_DISPATCH_FUNCTION_IMPLEMENTATION_TPL( tag::split_multiplies_, split_multiplies , (A0 const &)(A0 const&)(A1&) , 2 ) /*! @brief SIMD register type-based multiplies and split @c split_multiplies multiplies two x-bit SIMD registers and returns two 2x-bit registers each having half the cardinal of the original inputs. @param a0 LHS of multiplication @param a1 RHS of multiplication @param a2 L-Value that will receive the first sub-part of @c a0 * @c a1 @param a3 L-Value that will receive the second sub-part of @c a0 * @c a1 **/ BOOST_DISPATCH_FUNCTION_IMPLEMENTATION_TPL( tag::split_multiplies_, split_multiplies , (A0 const &)(A0 const&)(A1&)(A1&) , 2 ) } } #endif <|start_filename|>modules/core/exponential/include/nt2/exponential/functions/log1p.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_EXPONENTIAL_FUNCTIONS_LOG1P_HPP_INCLUDED #define NT2_EXPONENTIAL_FUNCTIONS_LOG1P_HPP_INCLUDED #include <nt2/include/functor.hpp> namespace nt2 { namespace tag { /*! @brief log1p generic tag Represents the log1p function in generic contexts. @par Models: Hierarchy **/ struct log1p_ : ext::elementwise_<log1p_> { typedef ext::elementwise_<log1p_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_log1p_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::log1p_, Site> dispatching_log1p_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::log1p_, Site>(); } template<class... Args> struct impl_log1p_; } /*! natural logarithm of 1+a0: \f$\log(1+a_0)\f$ \par result is accurate even for small a0 @par Semantic: For every parameter of floating type T0 @code T0 r = log1p(x); @endcode is similar to: @code T0 r = log(1+x); @endcode @param a0 @return a value of the same type as the parameter **/ NT2_FUNCTION_IMPLEMENTATION(tag::log1p_, log1p, 1) } #endif <|start_filename|>modules/boost/simd/base/include/boost/simd/arithmetic/functions/toints.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef BOOST_SIMD_ARITHMETIC_FUNCTIONS_TOINTS_HPP_INCLUDED #define BOOST_SIMD_ARITHMETIC_FUNCTIONS_TOINTS_HPP_INCLUDED #include <boost/simd/include/functor.hpp> #include <boost/dispatch/include/functor.hpp> namespace boost { namespace simd { namespace tag { /*! @brief toints generic tag Represents the toints function in generic contexts. @par Models: Hierarchy **/ struct toints_ : ext::elementwise_<toints_> { /// @brief Parent hierarchy typedef ext::elementwise_<toints_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_toints_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::toints_, Site> dispatching_toints_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::toints_, Site>(); } template<class... Args> struct impl_toints_; } /*! Convert to integer by saturated truncation. @par semantic: For any given value @c x of type @c T: @code as_integer<T> r = toints(x); @endcode The code is similar to: @code as_integer<T> r = static_cast<as_integer<T> >(saturate<as_integer<T> >(x)) @endcode @par Notes: The Inf -Inf and Nan values are treated properly and go respectively to Valmax, Valmin and Zero of the destination integral type All values superior (resp.) less than Valmax (resp. Valmin) of the return type are saturated accordingly. @par Alias @c ifix, @c itrunc, @c saturated_toint @param a0 @return a value of the integer same type associated to the input. **/ BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::toints_, toints, 1) BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::toints_, ifix, 1) BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::toints_, itrunc, 1) BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::toints_, saturated_toint, 1) } } #include <boost/simd/operator/specific/common.hpp> #endif <|start_filename|>modules/core/restructuring/include/nt2/core/functions/reshape.hpp<|end_filename|> //============================================================================== // Copyright 2003 & onward LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 & onward LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_CORE_FUNCTIONS_RESHAPE_HPP_INCLUDED #define NT2_CORE_FUNCTIONS_RESHAPE_HPP_INCLUDED /*! * \file * \brief Defines and implements the nt2::reshape function */ #include <nt2/include/functor.hpp> #include <nt2/sdk/meta/boxed_size.hpp> #include <nt2/sdk/meta/value_as.hpp> #include <nt2/core/container/dsl/value_type.hpp> #include <nt2/core/container/dsl/size.hpp> #include <nt2/sdk/meta/reshaping_hierarchy.hpp> namespace nt2 { namespace tag { struct reshape_ : ext::reshaping_<reshape_> { /// @brief Parent hierarchy typedef ext::reshaping_<reshape_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_reshape_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::reshape_, Site> dispatching_reshape_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::reshape_, Site>(); } template<class... Args> struct impl_reshape_; } //============================================================================ /*! * reshape an expression while keeping its numel constant * * \param xpr Expression to reshape * \param size New size of the expression */ //============================================================================ #define M0(z,n,t) \ NT2_FUNCTION_IMPLEMENTATION(nt2::tag::reshape_, reshape, n) \ NT2_FUNCTION_IMPLEMENTATION_SELF(nt2::tag::reshape_, reshape, n) \ /**/ BOOST_PP_REPEAT_FROM_TO(2,BOOST_PP_INC(BOOST_PP_INC(NT2_MAX_DIMENSIONS)),M0,~) #undef M0 } //============================================================================== // Setup reshape generator traits //============================================================================== namespace nt2 { namespace ext { /// INTERNAL ONLY template<class Domain, class Expr, int N> struct value_type<nt2::tag::reshape_,Domain,N,Expr> : meta::value_as<Expr,0> {}; /// INTERNAL ONLY template<class Domain, class Expr,int N> struct size_of<nt2::tag::reshape_,Domain,N,Expr> : meta::boxed_size<Expr,1> {}; } } #endif <|start_filename|>modules/binding/magma/include/nt2/linalg/functions/magma/gemsv.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_LINALG_FUNCTIONS_MAGMA_GEMSV_HPP_INCLUDED #define NT2_LINALG_FUNCTIONS_MAGMA_GEMSV_HPP_INCLUDED #if defined(NT2_USE_MAGMA) #include <nt2/linalg/functions/gemsv.hpp> #include <nt2/linalg/details/magma_buffer.hpp> #include <nt2/sdk/magma/magma.hpp> #include <nt2/dsl/functions/terminal.hpp> #include <nt2/core/container/table/kind.hpp> #include <nt2/linalg/details/utility/f77_wrapper.hpp> #include <nt2/linalg/details/utility/workspace.hpp> #include <nt2/include/functions/of_size.hpp> #include <nt2/include/functions/height.hpp> #include <nt2/include/functions/width.hpp> #include <nt2/core/container/table/table.hpp> #include <magma.h> #include <cublas.h> namespace nt2 { namespace ext { BOOST_DISPATCH_IMPLEMENT ( gemsv_, nt2::tag::magma_<site> , (A0)(S0)(A1)(S1)(A2)(S2)(site) , ((container_<nt2::tag::table_, double_<A0>, S0 >)) //A ((container_<nt2::tag::table_, double_<A1>, S1 >)) //B ((container_<nt2::tag::table_, double_<A2>, S2 >)) //X ) { typedef nt2_la_int result_type; BOOST_FORCEINLINE result_type operator()(A0& a0, A1 const& a1, A2& a2) const { nt2_la_int n = std::min(nt2::height(a0),nt2::width(a0)); nt2_la_int lda = n; nt2_la_int nhrs = nt2::width(a1); nt2_la_int ldb = a1.leading_size(); nt2_la_int iter,info; nt2::container::table<double> copyb(nt2::of_size(ldb,nhrs)); copyb = a1; nt2::container::table<nt2_la_int> ipiv(nt2::of_size(n,1)); details::magma_buffer<float> swork(n*(n+nhrs),1); details::magma_buffer<double> dwork(n*nhrs,1); details::magma_buffer<nt2_la_int> dipiv(n,1); details::magma_buffer<double> dA(n,n ,a0.data()); details::magma_buffer<double> dB(n,nhrs, copyb.data()); details::magma_buffer<double> dX(n,nhrs); magma_dsgesv_gpu( MagmaNoTrans , n , nhrs , dA.data() , lda , ipiv.data() , dipiv.data() , dB.data() , ldb , dX.data() , ldb , dwork.data() , swork.data() , &iter , &info ); dX.raw( a2.data() ); return iter; } }; BOOST_DISPATCH_IMPLEMENT ( gemsv_, nt2::tag::magma_<site> , (A0)(S0)(A1)(S1)(A2)(S2)(site) , ((container_< nt2::tag::table_, complex_<double_<A0> >, S0 >)) // A ((container_< nt2::tag::table_, complex_<double_<A1> >, S1 >)) // B ((container_< nt2::tag::table_, complex_<double_<A2> >, S2 >)) // X ) { typedef nt2_la_int result_type; typedef std::complex<double> dComplex; typedef cuDoubleComplex* mT; BOOST_FORCEINLINE result_type operator()(A0& a0, A1& a1, A2& a2) const { nt2_la_int n = std::min(nt2::height(a0),nt2::width(a0)); nt2_la_int lda = n; nt2_la_int nhrs = nt2::width(a1); nt2_la_int ldb = a1.leading_size(); nt2_la_int iter,info; nt2::container::table<nt2_la_int> ipiv(nt2::of_size(n,1)); A1 copyb(a1); details::magma_buffer<std::complex<float> > swork(n*(n+nhrs),1); details::magma_buffer<dComplex> dwork(n*nhrs,1); details::magma_buffer<nt2_la_int> dipiv(n,1); details::magma_buffer<dComplex> dA(n,n ,a0.data()); details::magma_buffer<dComplex> dB(n,nhrs, copyb.data()); details::magma_buffer<dComplex> dX(n,nhrs); magma_zcgesv_gpu( MagmaNoTrans , n , nhrs , (cuDoubleComplex*)dA.data() , lda , ipiv.data() , dipiv.data(), (cuDoubleComplex*)dB.data() , ldb , (cuDoubleComplex*)dX.data() , ldb , (cuDoubleComplex*)dwork.data() , (cuFloatComplex*)swork.data(), &iter , &info ); dX.raw( a2.data() ); return iter; } }; } } #endif #endif <|start_filename|>modules/boost/simd/base/include/boost/simd/arithmetic/functions/sqrt.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef BOOST_SIMD_ARITHMETIC_FUNCTIONS_SQRT_HPP_INCLUDED #define BOOST_SIMD_ARITHMETIC_FUNCTIONS_SQRT_HPP_INCLUDED #include <boost/simd/include/functor.hpp> #include <boost/dispatch/include/functor.hpp> namespace boost { namespace simd { namespace tag { /*! @brief sqrt generic tag Represents the sqrt function in generic contexts. @par Models: **/ struct sqrt_ : ext::elementwise_<sqrt_> { typedef ext::elementwise_<sqrt_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_sqrt_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::sqrt_, Site> dispatching_sqrt_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::sqrt_, Site>(); } template<class... Args> struct impl_sqrt_; } /*! Computes the square root of its parameter. For integers it is the truncation of the real square root. @par semantic: For any given value @c x of type @c T: @code T r = sqrt(x); @endcode @param a0 @return a value of the same type as the input. **/ BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::sqrt_, sqrt, 1) } } #endif <|start_filename|>modules/core/gallery/include/nt2/gallery/functions/toeppd.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_GALLERY_FUNCTIONS_TOEPPD_HPP_INCLUDED #define NT2_GALLERY_FUNCTIONS_TOEPPD_HPP_INCLUDED #include <nt2/include/functor.hpp> /*! * \ingroup algebra * \defgroup algebra_toeppd toeppd * * toeppd symmetric positive definite toeplitz matrix. * toeppd(n, w,theta) or toeppd<T>(n, m)is an n-by-n symmetric positive * semi-definite (spd) toeplitz matrix. it is composed of the sum of * m rank 2 (or, for certain theta rank 1) spd toeplitz matrices. * specifically, * t = w(1)*t(theta(1)) + ... + w(m)*t(theta(m)), * where t(theta(k)) has (i,j) element cos(2*pi*theta(k)*(i-j)). * * defaults: m = n, w = rand(m,1), theta = rand(m,1). * * Reference: * <NAME> and <NAME>, Computing the minimum eigenvalue of * a symmetric positive definite Toeplitz matrix, SIAM J. Sci. Stat. * Comput., 7 (1986), pp. 123-131. * * * \par Header file * * \code * #include <nt2/include/functions/toeppd.hpp> * \endcode * **/ namespace nt2 { namespace tag { /*! * \brief Define the tag toeppd_ of functor toeppd * in namespace nt2::tag for toolbox algebra **/ struct toeppd_ : ext::abstract_<toeppd_> { typedef ext::abstract_<toeppd_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_toeppd_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::toeppd_, Site> dispatching_toeppd_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::toeppd_, Site>(); } template<class... Args> struct impl_toeppd_; } BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::toeppd_, toeppd, 3) } #endif <|start_filename|>modules/core/statistics/include/nt2/statistics/functions/norminv.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_STATISTICS_FUNCTIONS_NORMINV_HPP_INCLUDED #define NT2_STATISTICS_FUNCTIONS_NORMINV_HPP_INCLUDED #include <nt2/include/functor.hpp> #include <nt2/sdk/meta/size_as.hpp> #include <nt2/sdk/meta/value_as.hpp> #include <nt2/core/container/dsl/size.hpp> #include <nt2/core/container/dsl/value_type.hpp> #include <nt2/sdk/meta/tieable_hierarchy.hpp> #include <nt2/core/utility/max_extent.hpp> namespace nt2 { namespace tag { /*! @brief norminv generic tag Represents the norminv function in generic contexts. @par Models: Hierarchy **/ struct norminv_ : ext::tieable_<norminv_> { /// @brief Parent hierarchy typedef ext::tieable_<norminv_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_norminv_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; struct norminv0_ : ext::elementwise_<norminv0_> { /// @brief Parent hierarchy typedef ext::elementwise_<norminv0_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_norminv0_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::norminv_, Site> dispatching_norminv_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::norminv_, Site>(); } template<class... Args> struct impl_norminv_; template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::norminv0_, Site> dispatching_norminv0_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::norminv0_, Site>(); } template<class... Args> struct impl_norminv0_; } /*! normal inverse cumulative distribution of mean m and standard deviation s @par Semantic: For every table expression @code auto r = norminv(a0, m, s); @endcode is similar to: @code auto r = -Sqrt_2*erfcinv(2*a0)*s+m; @endcode @param a0 @param a1 @param a2 @return an expression which eventually will evaluate to the result **/ NT2_FUNCTION_IMPLEMENTATION(tag::norminv0_, norminv, 3) /// @overload NT2_FUNCTION_IMPLEMENTATION(tag::norminv0_, norminv, 2) /// @overload NT2_FUNCTION_IMPLEMENTATION(tag::norminv0_, norminv, 1) /*! normal inverse cumulative distribution of mean m and standard deviation s @par Semantic: For every table expression @code tie(r, rlo, rup)= expinv(a0, m, s, cov, alpha); @endcode Returns r = expinv(a0, m, s), but also produces confidence bounds for r when the input parameters m and s are estimates. cov is a 2-by-2 matrix containing the covariance matrix of the estimated parameters. alpha has a default value of 0.05, and specifies 100*(1-alpha)% confidence bounds. rlo and rup are arrays of the same size as a0 containing the lower and upper confidence bounds. @param a0 @param a1 estimated mean @param a2 estimated standard deviation @param a3 covariance of the estimates @param a4 optional confidence bound (default to 0.05) @return an expression which eventually will evaluate to the result **/ NT2_FUNCTION_IMPLEMENTATION(tag::norminv_, norminv, 5) /// @overload NT2_FUNCTION_IMPLEMENTATION(tag::norminv_, norminv, 4) } namespace nt2 { namespace ext { /// INTERNAL ONLY template<class Domain, int N, class Expr> struct size_of<tag::norminv_,Domain,N,Expr> // N = 4 or 5 { typedef typename boost::proto::result_of::child_c<Expr&,0> ::value_type::extent_type ext0_t; typedef typename boost::proto::result_of::child_c<Expr&,1> ::value_type::extent_type ext1_t; typedef typename boost::proto::result_of::child_c<Expr&,1> ::value_type::extent_type ext2_t; typedef typename utility::result_of::max_extent<ext2_t, ext1_t, ext0_t>::type result_type; BOOST_FORCEINLINE result_type operator()(Expr& e) const { return utility::max_extent(nt2::extent(boost::proto::child_c<0>(e)), nt2::extent(boost::proto::child_c<1>(e)), nt2::extent(boost::proto::child_c<2>(e))); } }; /// INTERNAL ONLY template<class Domain, class Expr> struct size_of<tag::norminv_,Domain,1,Expr> : meta::size_as<Expr,0> {}; /// INTERNAL ONLY template<class Domain, int N, class Expr> struct value_type<tag::norminv_,Domain,N,Expr> : meta::value_as<Expr,0> {}; } } #endif <|start_filename|>modules/core/trigonometric/include/nt2/trigonometric/constants/pix2_1.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2011 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2011 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_TRIGONOMETRIC_CONSTANTS_PIX2_1_HPP_INCLUDED #define NT2_TRIGONOMETRIC_CONSTANTS_PIX2_1_HPP_INCLUDED #include <nt2/include/functor.hpp> #include <boost/simd/constant/hierarchy.hpp> #include <boost/simd/constant/register.hpp> namespace nt2 { namespace tag { /*! @brief Pix2_1 generic tag Represents the Pix2_1 constant in generic contexts. @par Models: Hierarchy **/ // 12.56637061 BOOST_SIMD_CONSTANT_REGISTER( Pix2_1, double , 1, 0x40c90f00 , 0x401921fb54400000LL ) } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::Pix2_1, Site> dispatching_Pix2_1(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::Pix2_1, Site>(); } template<class... Args> struct impl_Pix2_1; } /*! Constant used in modular computation involving \f$\pi\f$ @par Semantic: For type T0: @code T0 r = Pix2_1<T0>(); @endcode @return a value of type T0 **/ BOOST_SIMD_CONSTANT_IMPLEMENTATION(tag::Pix2_1, Pix2_1); } #endif <|start_filename|>modules/core/trigonometric/include/nt2/trigonometric/functions/atan2.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_TRIGONOMETRIC_FUNCTIONS_ATAN2_HPP_INCLUDED #define NT2_TRIGONOMETRIC_FUNCTIONS_ATAN2_HPP_INCLUDED #include <nt2/include/functor.hpp> namespace nt2 { namespace tag { /*! @brief atan2 generic tag Represents the atan2 function in generic contexts. @par Models: Hierarchy **/ struct atan2_ : ext::elementwise_<atan2_> { /// @brief Parent hierarchy typedef ext::elementwise_<atan2_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_atan2_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::atan2_, Site> dispatching_atan2_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::atan2_, Site>(); } template<class... Args> struct impl_atan2_; } /*! atan2 function. @par Semantic: For every parameters of floating types respectively T0, T1: @code T0 r = atan2(x, y); @endcode is similar but not fully equivalent to: @code T0 r = atan(y/x);; @endcode as it is quadrant aware. For any real arguments @c x and @c y not both equal to zero, <tt>atan2(x, y)</tt> is the angle in radians between the positive x-axis of a plane and the point given by the coordinates <tt>(y, x)</tt>. It is also the angle in \f$[-\pi,\pi[\f$ such that \f$x/\sqrt{x^2+y^2}\f$ and \f$y/\sqrt{x^2+y^2}\f$ are respectively the sine and the cosine. @see @funcref{nbd_atan2}, @funcref{atan} @param a0 @param a1 @return a value of the same type as the parameters **/ NT2_FUNCTION_IMPLEMENTATION(tag::atan2_, atan2, 2) } #endif <|start_filename|>modules/core/linalg/include/nt2/linalg/functions/norm.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_LINALG_FUNCTIONS_NORM_HPP_INCLUDED #define NT2_LINALG_FUNCTIONS_NORM_HPP_INCLUDED #include <nt2/include/functor.hpp> #include <boost/simd/include/functor.hpp> #include <boost/dispatch/include/functor.hpp> #include <nt2/sdk/memory/container.hpp> namespace nt2 { namespace tag { /*! * \brief Define the tag norm_ of functor norm * in namespace nt2::tag for toolbox algebra **/ struct norm_ : ext::abstract_<norm_> { typedef ext::abstract_<norm_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_norm_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::norm_, Site> dispatching_norm_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::norm_, Site>(); } template<class... Args> struct impl_norm_; } /*! @brief Matricial or vectorial norm norm mimicks the behaviour of the correponding Matlab function @code norm(x, p) @endcode computes @code |--------------|-------------------|-----------------------|----------------------| | Matlab p | NT2 p | matrix | vector | |--------------|-------------------|-----------------------|----------------------| | 1 | 1 or nt2::one_ | max(sum(abs(x))) | sum(abs(x)) | | 2 | 2 or nt2::two_ | max(svd(x)) | sum(abs(x).^2)^(1/2) | | q | q | _ | sum(abs(x).^q)^(1/q) | | inf | nt2::inf_ | max(sum(abs(x'))) | max(abs(x)) | | -inf | nt2::minf_ | _ | min(abs(x)) | | 'fro' | nt2::fro_ | sqrt(sum(diag(x'*x))) | sum(abs(x).^2)^(1/2) | |--------------|-------------------|-----------------------|----------------------| @endcode where q is numeric finite positive different from the other possible values except 1 2 and q the NT2 calls are statically chosen at compile time. If you know exactly what you need, use preferentially mnorm for matrices and globalnorm for vectors. @see{globalnorm}, @see{mnorm} **/ BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::norm_, norm, 2) BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::norm_, norm, 1) } #endif <|start_filename|>modules/core/statistics/include/nt2/statistics/functions/normpdf.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_STATISTICS_FUNCTIONS_NORMPDF_HPP_INCLUDED #define NT2_STATISTICS_FUNCTIONS_NORMPDF_HPP_INCLUDED #include <nt2/include/functor.hpp> namespace nt2 { namespace tag { /*! @brief normpdf generic tag Represents the normpdf function in generic contexts. @par Models: Hierarchy **/ struct normpdf_ : ext::elementwise_<normpdf_> { /// @brief Parent hierarchy typedef ext::elementwise_<normpdf_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_normpdf_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::normpdf_, Site> dispatching_normpdf_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::normpdf_, Site>(); } template<class... Args> struct impl_normpdf_; } /*! normal distribution density of mean m and standard deviation s @par Semantic: For every table expression @code auto r = normpdf(a0, m, s); @endcode is similar to: @code auto r = exp(sqr((a0-m)/s)/2)*Invsqrt_2pi/s; @endcode @see @funcref{exp}, @funcref{sqr}, @funcref{Invsqrt_2pi}, @param a0 @param a1 optional mean default to 0 @param a2 optional standard deviation default to 1 @return an expression which eventually will evaluate to the result **/ NT2_FUNCTION_IMPLEMENTATION(tag::normpdf_, normpdf, 3) /// @overload NT2_FUNCTION_IMPLEMENTATION(tag::normpdf_, normpdf, 2) /// @overload NT2_FUNCTION_IMPLEMENTATION(tag::normpdf_, normpdf, 1) } #endif <|start_filename|>modules/core/linalg/include/nt2/linalg/functions/clinsolve.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2013 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_LINALG_FUNCTIONS_CLINSOLVE_HPP_INCLUDED #define NT2_LINALG_FUNCTIONS_CLINSOLVE_HPP_INCLUDED /*! @file @brief **/ #include <nt2/include/functor.hpp> namespace nt2 { namespace tag { /// @brief Defines gecon function tag struct clinsolve_ : ext::abstract_<clinsolve_> { /// INTERNAL ONLY typedef ext::abstract_<clinsolve_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_clinsolve_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::clinsolve_, Site> dispatching_clinsolve_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::clinsolve_, Site>(); } template<class... Args> struct impl_clinsolve_; } /*! @brief @param @param @return **/ NT2_FUNCTION_IMPLEMENTATION (tag::clinsolve_, clinsolve , 3 ); } #endif <|start_filename|>modules/core/trigonometric/include/nt2/trigonometric/functions/rem_pio2_cephes.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_TRIGONOMETRIC_FUNCTIONS_REM_PIO2_CEPHES_HPP_INCLUDED #define NT2_TRIGONOMETRIC_FUNCTIONS_REM_PIO2_CEPHES_HPP_INCLUDED #include <nt2/include/functor.hpp> namespace nt2 { namespace tag { struct rem_pio2_cephes_ : ext::elementwise_<rem_pio2_cephes_> { /// @brief Parent hierarchy typedef ext::elementwise_<rem_pio2_cephes_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_rem_pio2_cephes_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::rem_pio2_cephes_, Site> dispatching_rem_pio2_cephes_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::rem_pio2_cephes_, Site>(); } template<class... Args> struct impl_rem_pio2_cephes_; } /*! Computes the remainder modulo \f$\pi/2\f$ with cephes algorithm, and return the angle quadrant between 0 and 3. This is a quick version accurate if the input is in \f$[-20\pi,20\pi]\f$. @par Semantic: For every parameters of floating type T0: @code T0 r; as_integer<T0> n; tie(r, n) = rem_pio2_cephes_(x); @endcode is similar to: @code as_integer<T0> n = idivround2even(x,, Pio_2<T0>()); T0 r = remainder(x, Pio_2<T0>());; @endcode @see @funcref{rem_pio2}, @funcref{rem_pio2_straight},@funcref{rem_2pi}, @funcref{rem_pio2_medium}, @param a0 angle in radian @return A pair containing the remainder and quadrant of @c a0 **/ NT2_FUNCTION_IMPLEMENTATION_TPL ( tag::rem_pio2_cephes_ , rem_pio2_cephes,(A0 const&) , 1 ) /*! Computes the remainder modulo \f$\pi/2\f$ with cephes algorithm, and the angle quadrant between 0 and 3. This is a quick version accurate if the input is in \f$[-20\pi,20\pi]\f$. @par Semantic: For every parameters of floating type T0: @code T0 r; as_integer<T0> n; n = rem_pio2_cephes_(x, r); @endcode is similar to: @code as_integer<T0> n = idivround2even(x,, Pio_2<T0>()); T0 r = remainder(x, Pio_2<T0>());; @endcode @see @funcref{rem_pio2}, @funcref{rem_pio2_straight},@funcref{rem_2pi}, @funcref{rem_pio2_medium}, @param a0 angle in radian @param a1 L-Value that will receive the remainder modulo \f$\pi/2\f$ of @c a0 @return the integer value of the quadrant **/ NT2_FUNCTION_IMPLEMENTATION_TPL ( tag::rem_pio2_cephes_ , rem_pio2_cephes , (A0 const&)(A0&) , 1 ) /*! Computes the remainder modulo \f$\pi/2\f$ with cephes algorithm, and the angle quadrant between 0 and 3. This is a quick version accurate if the input is in \f$[-20\pi,20\pi]\f$. @par Semantic: For every parameters of floating type T0: @code T0 r; as_integer<T0> n; rem_pio2_cephes_(x, n, r); @endcode is similar to: @code as_integer<T0> n = idivround2even(x,, Pio_2<T0>()); T0 r = remainder(x, Pio_2<T0>());; @endcode @see @funcref{rem_pio2}, @funcref{rem_pio2_straight},@funcref{rem_2pi}, @funcref{rem_pio2_medium}, @param a0 angle in radian @param a1 L-Value that will receive the quadrant of @c a0 @param a2 L-Value that will receive the remainder modulo \f$\pi/2\f$ of @c a0 **/ NT2_FUNCTION_IMPLEMENTATION_TPL ( tag::rem_pio2_cephes_ , rem_pio2_cephes , (A0 const&)(A1&)(A0&) , 2 ) } #endif <|start_filename|>modules/boost/simd/base/include/boost/simd/constant/constants/minexponent.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2011 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2011 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef BOOST_SIMD_CONSTANT_CONSTANTS_MINEXPONENT_HPP_INCLUDED #define BOOST_SIMD_CONSTANT_CONSTANTS_MINEXPONENT_HPP_INCLUDED #include <boost/simd/include/functor.hpp> #include <boost/simd/meta/int_c.hpp> #include <boost/simd/constant/hierarchy.hpp> namespace boost { namespace simd { namespace tag { /*! @brief Minexponent generic tag Represents the Minexponent constant in generic contexts. @par Models: Hierarchy **/ struct Minexponent : ext::pure_constant_<Minexponent> { typedef double default_type; typedef ext::pure_constant_<Minexponent> parent; /// INTERNAL ONLY template<class Target, class Dummy=void> struct apply : meta::int_c<typename Target::type,0> {}; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_Minexponent( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; /// INTERNAL ONLY template<class T, class Dummy> struct Minexponent::apply<boost::dispatch::meta::single_<T>,Dummy> : meta::int_c<boost::simd::int32_t,-126> {}; /// INTERNAL ONLY template<class T, class Dummy> struct Minexponent::apply<boost::dispatch::meta::double_<T>,Dummy> : meta::int_c<boost::simd::int64_t,-1022> {}; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::Minexponent, Site> dispatching_Minexponent(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::Minexponent, Site>(); } template<class... Args> struct impl_Minexponent; } /*! Generates the smallest floating point exponent. @par Semantic: @code T r = Minexponent<T>(); @endcode is similar to: @code if T is double r = -1022; else if T is float r = -126; @endcode **/ BOOST_SIMD_CONSTANT_IMPLEMENTATION(boost::simd::tag::Minexponent, Minexponent) } } #include <boost/simd/constant/common.hpp> #endif <|start_filename|>modules/core/polynom/include/nt2/polynom/functions/ratfracder.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_POLYNOM_FUNCTIONS_RATFRACDER_HPP_INCLUDED #define NT2_POLYNOM_FUNCTIONS_RATFRACDER_HPP_INCLUDED #include <nt2/include/functor.hpp> #include <nt2/sdk/meta/boxed_size.hpp> #include <nt2/sdk/meta/value_as.hpp> #include <nt2/core/container/dsl/value_type.hpp> #include <nt2/core/container/dsl/size.hpp> #include <nt2/sdk/meta/tieable_hierarchy.hpp> namespace nt2 { namespace tag { /*! @brief ratfracder generic tag Represents the ratfracder function in generic contexts. @par Models: Hierarchy **/ struct ratfracder_ : ext::tieable_<ratfracder_> { /// @brief Parent hierarchy typedef ext::tieable_<ratfracder_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_ratfracder_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::ratfracder_, Site> dispatching_ratfracder_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::ratfracder_, Site>(); } template<class... Args> struct impl_ratfracder_; } /*! Returns the derivative of the polynomial whose coefficients are the elements of vector p. @par Semantic: For every polynomial @code auto r = ratfracder(p); @endcode is similar to @code auto r = polyder(p); @endcode @param a0 @return a value of the same type as the parameter **/ NT2_FUNCTION_IMPLEMENTATION(tag::ratfracder_, ratfracder, 1) /*! Returns the derivative of the polynomial ratio a/b, represented as n/d. @par Semantic: For every polynomial @code tie(n, d) = ratfracder(a, b); @endcode @param a0 @param a1 @return a value of the same type as the parameter **/ NT2_FUNCTION_IMPLEMENTATION(tag::ratfracder_, ratfracder, 2) } namespace nt2 { namespace ext { /// INTERNAL ONLY template<class Domain, class Expr> struct size_of<tag::ratfracder_,Domain,1,Expr> { typedef _2D result_type; BOOST_FORCEINLINE result_type operator()(Expr& e) const { _2D sizee; sizee[0] = 1; size_t na = nt2::numel(boost::proto::value(boost::proto::child_c<0>(e))); sizee[1] = na ? na-1u :0; ; return sizee; } }; /// INTERNAL ONLY template<class Domain, class Expr> struct size_of<tag::ratfracder_,Domain,2,Expr> { typedef _2D result_type; BOOST_FORCEINLINE result_type operator()(Expr& e) const { _2D sizee; sizee[0] = 1; size_t na = nt2::numel(boost::proto::value(boost::proto::child_c<0>(e))); size_t nb = nt2::numel(boost::proto::value(boost::proto::child_c<1>(e))); sizee[1] = std::max(std::max(na+nb ? na+nb-1u : 0u,na),nb); sizee[1] = sizee[1] ? sizee[1]-1u : 0; return sizee; } }; /// INTERNAL ONLY template<class Domain, int N, class Expr> struct value_type<tag::ratfracder_,Domain,N,Expr> : meta::value_as<Expr,0> {}; } } #endif <|start_filename|>modules/core/signal/include/nt2/signal/functions/db.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_SIGNAL_FUNCTIONS_DB_HPP_INCLUDED #define NT2_SIGNAL_FUNCTIONS_DB_HPP_INCLUDED #include <nt2/include/functor.hpp> namespace nt2 { namespace tag { /*! @brief Tag for the db functor **/ struct db_ : ext::elementwise_<db_> { /// @brief Parent hierarchy typedef ext::elementwise_<db_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_db_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::db_, Site> dispatching_db_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::db_, Site>(); } template<class... Args> struct impl_db_; } namespace details { /// INTERNAL ONLY struct voltage_; /// INTERNAL ONLY struct power_; /// INTERNAL ONLY typedef meta::as_<voltage_> voltage_t; /// INTERNAL ONLY typedef meta::as_<power_> power_t; } details::voltage_t const voltage_ = {}; details::power_t const power_ = {}; /*! @brief Converts energy or power to decibels. Computes the decibels from energy or power; The elements of a0 are voltage measurements across a resistance of a2 (default 1) ohm. @par Semantic For any table expression, and mode: @code auto r = db(t, voltage_, n = 1); @endcode or @code auto r = db(t, n = 1); @endcode is equivalent to: @code auto d = mag2db(t, r); @endcode else if mode is power_ @code auto d = db(t, power_); @endcode or @code auto d = db(t); @endcode is equivalent to: @code auto d = pow2db(e); @endcode @see @funcref{pow2db}, @funcref{mag2db} @param a0 Table to process @param a1 mode: can be power_ or voltage_ (default to voltage_) @param a2 optional resistance (only in voltage_ case) @return An expression eventually evaluated to the result **/ NT2_FUNCTION_IMPLEMENTATION(tag::db_, db, 3) /// @overload NT2_FUNCTION_IMPLEMENTATION(tag::db_, db, 2) /// @overload NT2_FUNCTION_IMPLEMENTATION(tag::db_, db, 1) } #endif <|start_filename|>modules/core/base/include/nt2/core/functions/arrayfun.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // Copyright 2011 - 2012 MetaScale SAS // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_CORE_FUNCTIONS_ARRAYFUN_HPP_INCLUDED #define NT2_CORE_FUNCTIONS_ARRAYFUN_HPP_INCLUDED #include <nt2/include/functor.hpp> namespace nt2 { namespace tag { /*! @brief Tag for bsxfun functor **/ struct arrayfun_ : ext::elementwise_<arrayfun_> { typedef ext::elementwise_<arrayfun_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_arrayfun_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::arrayfun_, Site> dispatching_arrayfun_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::arrayfun_, Site>(); } template<class... Args> struct impl_arrayfun_; } /*! @brief Apply element-by-element operation to n expressions arrayfun(f,a,b) applies the element-by-element pfo @c f to expressions @c a and @c b. The corresponding dimensions of @c a and @c b must be equal to each other. @param a0 Polymorphic Function object to apply @param a1 First expression to process @param a2 Second expression to process @param a2 Third expression to process **/ NT2_FUNCTION_IMPLEMENTATION(nt2::tag::arrayfun_, arrayfun, 4) /// @overload NT2_FUNCTION_IMPLEMENTATION(nt2::tag::arrayfun_, arrayfun, 2) /// @overload NT2_FUNCTION_IMPLEMENTATION(nt2::tag::arrayfun_, arrayfun, 3) } #endif <|start_filename|>modules/core/sdk/unit/memory/buffer_non_pod.cpp<|end_filename|> //============================================================================== // Copyright 2003 - 2011 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2011 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifdef _MSC_VER #pragma warning(disable: 4996) // unsafe std::transform #endif #include <algorithm> #include <boost/array.hpp> #include <boost/fusion/adapted/array.hpp> #include <boost/fusion/include/vector_tie.hpp> #include <boost/fusion/include/make_vector.hpp> #include <nt2/sdk/memory/buffer.hpp> #include <nt2/sdk/unit/module.hpp> #include <nt2/sdk/unit/tests/basic.hpp> #include <nt2/sdk/unit/tests/relation.hpp> #include <nt2/sdk/unit/tests/type_expr.hpp> #include <nt2/sdk/unit/tests/exceptions.hpp> #include "object.hpp" //============================================================================== // Test for default buffer ctor //============================================================================== NT2_TEST_CASE( buffer_default_ctor ) { using nt2::memory::buffer; buffer<nt2::object> b; NT2_TEST(b.empty()); NT2_TEST_EQUAL(b.size() , 0u ); NT2_TEST_EQUAL(b.capacity() , 0u ); NT2_TEST_EQUAL(b.begin() , b.end() ); } //============================================================================== // Test for size buffer ctor //============================================================================== NT2_TEST_CASE( buffer_size_ctor ) { using nt2::memory::buffer; buffer<nt2::object> b(5); NT2_TEST(!b.empty()); NT2_TEST_EQUAL(b.size() , 5u ); NT2_TEST_EQUAL(b.capacity() , 5u ); NT2_TEST_EQUAL(b.data() , &b[0] ); for ( std::size_t i = 0; i < 5; ++i ) NT2_TEST_EQUAL( b[i].s, std::string("default") ); } //============================================================================== // Test for dynamic buffer copy ctor //============================================================================== NT2_TEST_CASE( buffer_copy_ctor ) { using nt2::memory::buffer; buffer<nt2::object> b(5); buffer<nt2::object> x(b); NT2_TEST(!x.empty()); NT2_TEST_EQUAL(x.size() , 5u ); NT2_TEST_EQUAL(x.capacity() , 5u ); NT2_TEST_EQUAL(x.data() , &x[0] ); for( std::size_t i = 0; i < 5; ++i ) NT2_TEST_EQUAL( x[i].s, std::string("copied") ); } //============================================================================== // Test for buffer resize //============================================================================== NT2_TEST_CASE( buffer_resize ) { using nt2::memory::buffer; buffer<nt2::object> b(5); b.resize(9); NT2_TEST(!b.empty()); NT2_TEST_EQUAL(b.size() , 9u ); NT2_TEST_EQUAL(b.capacity() , 9u ); NT2_TEST_EQUAL(b.data() , &b[0] ); for( std::size_t i = 0; i < 9; ++i ) NT2_TEST_EQUAL( b[i].s, std::string("default") ); b.resize(3); NT2_TEST(!b.empty()); NT2_TEST_EQUAL(b.size() , 3u ); NT2_TEST_EQUAL(b.capacity() , 9u ); NT2_TEST_EQUAL(b.data() , &b[0] ); for( std::size_t i = 0; i < 3; ++i ) NT2_TEST_EQUAL( b[i].s, std::string("default") ); b.resize(5); NT2_TEST(!b.empty()); NT2_TEST_EQUAL(b.size() , 5u ); NT2_TEST_EQUAL(b.capacity() , 9u ); NT2_TEST_EQUAL(b.data() , &b[0] ); for( std::size_t i = 0; i < 5; ++i ) NT2_TEST_EQUAL( b[i].s, std::string("default") ); b.resize(1); NT2_TEST(!b.empty()); NT2_TEST_EQUAL(b.size() , 1u ); NT2_TEST_EQUAL(b.capacity() , 9u ); NT2_TEST_EQUAL(b.data() , &b[0] ); for( std::size_t i = 0; i < 1; ++i ) NT2_TEST_EQUAL( b[i].s, std::string("default") ); } //============================================================================== // Test for buffer assignment //============================================================================== NT2_TEST_CASE( buffer_assignment ) { using nt2::memory::buffer; buffer<nt2::object> b(5); buffer<nt2::object> x; x = b; NT2_TEST(!x.empty()); NT2_TEST_EQUAL(x.size() , 5u ); NT2_TEST_EQUAL(x.capacity() , 5u ); NT2_TEST_EQUAL(x.data() , &x[0] ); for( std::size_t i = 0; i < 5; ++i ) NT2_TEST_EQUAL( x[i].s, std::string("assigned") ); } //============================================================================== // Test for buffer swap //============================================================================== NT2_TEST_CASE( buffer_swap ) { using nt2::memory::buffer; buffer<nt2::object> b(5); buffer<nt2::object> x(7); swap(x,b); NT2_TEST(!x.empty()); NT2_TEST_EQUAL(x.size() , 5u ); NT2_TEST_EQUAL(x.capacity() , 5u ); NT2_TEST_EQUAL(x.data() , &x[0] ); NT2_TEST(!b.empty()); NT2_TEST_EQUAL(b.size() , 7u ); NT2_TEST_EQUAL(b.capacity() , 7u ); NT2_TEST_EQUAL(b.data() , &b[0] ); for( std::size_t i = 0; i < 5; ++i ) NT2_TEST_EQUAL( x[i].s, std::string("default") ); for( std::size_t i = 0; i < 7; ++i ) NT2_TEST_EQUAL( b[i].s, std::string("default") ); swap(b,x); NT2_TEST(!x.empty()); NT2_TEST_EQUAL(x.size() , 7u ); NT2_TEST_EQUAL(x.capacity() , 7u ); NT2_TEST_EQUAL(x.data() , &x[0] ); NT2_TEST(!b.empty()); NT2_TEST_EQUAL(b.size() , 5u ); NT2_TEST_EQUAL(b.capacity() , 5u ); NT2_TEST_EQUAL(b.data() , &b[0] ); for( std::size_t i = 0; i < 7; ++i ) NT2_TEST_EQUAL( x[i].s, std::string("default") ); for( std::size_t i = 0; i < 5; ++i ) NT2_TEST_EQUAL( b[i].s, std::string("default") ); } //============================================================================== // buffer Range interface //============================================================================== struct f_ { template<class T> std::string operator()(T const&) const { return "transformed"; } }; NT2_TEST_CASE( buffer_iterator ) { using nt2::memory::buffer; buffer<nt2::object> x(5); f_ f; buffer<nt2::object>::iterator b = x.begin(); buffer<nt2::object>::iterator e = x.end(); std::transform(b,e,b,f); for ( std::size_t i = 0; i < 5; ++i ) NT2_TEST_EQUAL( x[i].s, std::string("transformed") ); } NT2_TEST_CASE(buffer_push_back ) { using nt2::memory::buffer; buffer<nt2::object> x(5); for ( std::ptrdiff_t i = 0; i < 5; ++i ) x[i] = nt2::object("foo"); for ( std::ptrdiff_t i = 0; i < 7; ++i ) x.push_back("bar"); NT2_TEST_EQUAL( x.size(), (std::size_t)5+7 ); std::ptrdiff_t i = 0; for ( ; i < 5; ++i ) NT2_TEST_EQUAL( x[i].s, std::string("copied") ); for ( ; i < 5+7; ++i ) NT2_TEST_EQUAL( x[i].s, std::string("copied") ); std::cout << "capacity = " << x.capacity() << std::endl; } NT2_TEST_CASE(buffer_push_back_def ) { using nt2::memory::buffer; buffer<nt2::object> x; for ( std::ptrdiff_t i = 0; i < 7; ++i ) x.push_back("bar"); NT2_TEST_EQUAL( x.size(), (std::size_t)7 ); std::ptrdiff_t i = 0; for ( ; i < 7; ++i ) NT2_TEST_EQUAL( x[i].s, std::string("copied") ); std::cout << "capacity = " << x.capacity() << std::endl; } <|start_filename|>modules/core/adjacent/include/nt2/core/functions/adjfun.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // Copyright 2011 - 2012 MetaScale SAS // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_CORE_FUNCTIONS_ADJFUN_HPP_INCLUDED #define NT2_CORE_FUNCTIONS_ADJFUN_HPP_INCLUDED #include <nt2/include/functor.hpp> #include <nt2/sdk/meta/value_as.hpp> #include <nt2/core/container/dsl/size.hpp> #include <nt2/core/container/dsl/value_type.hpp> namespace nt2 { namespace tag { /*! @brief Tag for adjfun functor **/ struct adjfun_ : ext::elementwise_<adjfun_> { /// @brief Parent hierarchy typedef ext::elementwise_<adjfun_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_adjfun_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::adjfun_, Site> dispatching_adjfun_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::adjfun_, Site>(); } template<class... Args> struct impl_adjfun_; } /*! @brief Apply a function to adjacent element of a table adjfun computes the application of a binary functor @c f to all elements of @c a0. @par Semantic: For any given table expression @c a of size @c [d1,...,dn] which first non singleton dimension is @c k and any binary functor @c f: @code x = adjfun(f,a); @endcode is equivalent to: @code for(int in=1;in<=size(x,n);++in) ... for(int ik=1;ik<=size(x,k)-1;++ik) ... for(int i1=1;in<=size(x,1);++i1) x(i1,...,ik,...,in) = f(a(i1,...,ik+1,...,in),a(i1,...,ik,...,in)); @endcode This semantic implies that if @c a is of size @c [s1 ... sn] then the size of @c adjfun(f,a) is equal to @c [s1 ... sk -1 ... sn]. @param f Binary functor to apply to a @param a Table expression to process @par Example: **/ template<class Functor, class A0> BOOST_FORCEINLINE typename meta::call<tag::adjfun_(Functor const&, A0 const&)>::type adjfun(Functor const& f, A0 const& a) { return typename make_functor<tag::adjfun_, A0>::type()(f,a); } /*! @brief Apply a function to adjacent element of a table along some dimension adjfun computes the application of a binary functor @c f to all elements of @c a0. @par Semantic: For any given table @c a of size @c [d1,d2,...,dn], any binary functor @c f and a dimension index @c k: @code x = adjfun(f,a,k); @endcode is equivalent to: @code for(int in=1;in<=size(x,n);++in) ... for(int ik=1;ik<=size(x,k)-1;++ik) ... for(int i1=1;in<=size(x,1);++i1) x(i1,...,ik,...,in) = f(a(i1,...,ik+1,...,in),a(i1,...,ik,...,in)); @endcode This semantic implies that if @c a is of size @c [s1 ... sn] then the size of @c adjfun(f,a,k) is equal to @c [s1 ... sk -1 ... sn]. @param f Binary functor to apply to a0 @param a Table to process @param k Dimension along which to process @c a0 @par Example: **/ template<class Functor, class A0, class Along> BOOST_FORCEINLINE typename meta::call<tag::adjfun_(Functor const&, A0 const&, Along const&)>::type adjfun(Functor const& f, A0 const& a, Along const& k) { return typename make_functor<tag::adjfun_, A0>::type()(f,a,k); } } namespace nt2 { namespace ext { /// INTERNAL ONLY template<class Domain, int N, class Expr> struct size_of<nt2::tag::adjfun_,Domain,N,Expr> { typedef typename boost::proto::result_of ::child_c<Expr&,0>::value_type::extent_type result_type; BOOST_FORCEINLINE result_type operator ()(Expr& e) const { result_type that = nt2::extent(boost::proto::child_c<0>(e)); std::size_t along = boost::proto::child_c<1>(e); // If non-0 dimension along chosen direction, decrements it if(along >= result_type::static_size) { fix_size(that, boost::mpl::bool_< !(result_type::static_size <= 0) >()); } else { if(that[along]) --that[along]; } return that; } BOOST_FORCEINLINE void fix_size(result_type& that, boost::mpl::true_ const&) const { that[result_type::static_size-1] = 0; } BOOST_FORCEINLINE void fix_size(result_type&, boost::mpl::false_ const&) const {} }; /// INTERNAL ONLY template<class Domain, class Expr, int N> struct value_type<nt2::tag::adjfun_,Domain,N,Expr> { typedef typename boost::proto::result_of:: child_c<Expr&, 0>::value_type::value_type value_t; typedef typename boost::proto::result_of:: child_c<Expr&, 2>::value_type::value_type func_t; typedef typename boost::dispatch::meta:: result_of<func_t(value_t,value_t)>::type type; }; } } #endif <|start_filename|>modules/core/restructuring/include/nt2/core/functions/along.hpp<|end_filename|> //============================================================================== // Copyright 2009 -2015 LRI UMR 8623 CNRS/Univ Paris Sud XI // Copyright 2012 -2015 NumScale SAS // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_CORE_FUNCTIONS_ALONG_HPP_INCLUDED #define NT2_CORE_FUNCTIONS_ALONG_HPP_INCLUDED #include <nt2/include/functor.hpp> #include <nt2/core/container/dsl/details/resize.hpp> namespace nt2 { namespace tag { /*! @brief along generic tag Represents the along function in generic contexts. @par Models: Hierarchy **/ struct along_ : ext::elementwise_<along_> { /// @brief Parent hierarchy typedef ext::elementwise_<along_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_along_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::along_, Site> dispatching_along_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::along_, Site>(); } template<class... Args> struct impl_along_; } /*! Applies an index \c ind on \c expr along the \c i-th dimension by default \c i is the first non-singleton dimension of expr @par Semantic: For every parameters of types respectively T0, T1, T2: @code auto r = along(a0,a1{,a2}); @endcode is similar to: @code auto r = a0(_, ..., a1, ..., _);//where a1 is in a2-th slot of a0 @endcode a2 default to the @funcref{firstnonsingleton} dimension of a0. @param a0 the expression to index @param a1 the indexer @param a2 the dimension on which to index, optional, default to firstnonsingleton(a0) @return a0(_, ..., a1, ..., _) with @c a1 at the @c a2-th argument @return an expression which eventually will evaluate to the result **/ NT2_FUNCTION_IMPLEMENTATION(nt2::tag::along_ , along, 3) /// @overload NT2_FUNCTION_IMPLEMENTATION(nt2::tag::along_ , along, 2) /// @overload NT2_FUNCTION_IMPLEMENTATION_SELF(nt2::tag::along_ , along, 2) /// @overload NT2_FUNCTION_IMPLEMENTATION_SELF(nt2::tag::along_ , along, 3) namespace ext { //============================================================================ // resize function expression - do nothing //============================================================================ template<class Domain, int N, class Expr> struct resize<nt2::tag::along_, Domain, N, Expr> { template<class Sz> BOOST_FORCEINLINE void operator()(Expr&, Sz const&) {} }; } } #endif <|start_filename|>modules/core/base/include/nt2/predicates/functions/arecrosscompatible.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2014 LRI UMR 8623 CNRS/Univ Paris Sud XI // Copyright 2012 - 2014 MetaScale SAS // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_PREDICATES_FUNCTIONS_ARECROSSCOMPATIBLE_HPP_INCLUDED #define NT2_PREDICATES_FUNCTIONS_ARECROSSCOMPATIBLE_HPP_INCLUDED #include <nt2/include/functor.hpp> namespace nt2 { namespace tag { /*! @brief Tag for arecrosscompatible functor **/ struct arecrosscompatible_ : ext::abstract_<arecrosscompatible_> { typedef ext::abstract_<arecrosscompatible_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_arecrosscompatible_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::arecrosscompatible_, Site> dispatching_arecrosscompatible_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::arecrosscompatible_, Site>(); } template<class... Args> struct impl_arecrosscompatible_; } /*! @brief Check for cross product compatibility For two given expressions and a given dimension, arecrosscompatible verifies that both table can be used in a cross product along the chosen dimension. @param a0 First expression to cross product @param a1 Second expression to cross product @param dim Dimension along which the cross product is tested @return a boolean value that evaluates to true if @c a0 and @c a1 can be used in a cross product along thier @c dim dimension. **/ template< class A0, class A1,class D> BOOST_FORCEINLINE typename meta::call < tag::arecrosscompatible_( A0 const&, A1 const& , D const& ) >::type arecrosscompatible(A0 const& a0, A1 const& a1, D const& dim) { return typename make_functor<tag::arecrosscompatible_,A0>::type()(a0,a1,dim); } } #endif <|start_filename|>modules/core/gallery/include/nt2/gallery/functions/parter.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_GALLERY_FUNCTIONS_PARTER_HPP_INCLUDED #define NT2_GALLERY_FUNCTIONS_PARTER_HPP_INCLUDED #include <nt2/include/functor.hpp> /*! * \ingroup algebra * \defgroup algebra_parter parter * * c = parter(n) returns the matrix c such that * c(i,j) = 1/(i-j+0.5). * c is a cauchy matrix and a toeplitz matrix. * most of the singular values of c are very close to pi. * * References: * [1] MathWorks Newsletter, Volume 1, Issue 1, March 1986, page 2. * [2] <NAME> and <NAME>, Introduction to Large Truncated * Toeplitz Matrices, Springer-Verlag, New York, 1999; Sec. 4.5. * [3] <NAME>, On the distribution of the singular values of * Toeplitz matrices, Linear Algebra and Appl., 80(1986), pp. 115-130. * [4] <NAME>, Cauchy-Toeplitz matrices and some applications, * Linear Algebra and Appl., 149 (1991), pp. 1-18. * * \par Header file * * \code * #include <nt2/include/functions/parter.hpp> * \endcode * **/ //============================================================================== // parter actual class forward declaration //============================================================================== namespace nt2 { namespace tag { /*! * \brief Define the tag parter_ of functor parter * in namespace nt2::tag for toolbox algebra **/ struct parter_ : ext::abstract_<parter_> { typedef ext::abstract_<parter_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_parter_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::parter_, Site> dispatching_parter_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::parter_, Site>(); } template<class... Args> struct impl_parter_; } BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::parter_, parter, 2) } #endif <|start_filename|>modules/arch/tbb/include/nt2/sdk/tbb/future/when_all.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2011 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2013 LRI UMR 8623 CNRS/Univ Paris Sud XI // Copyright 2012 - 2013 MetaScale SAS // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_SDK_TBB_FUTURE_WHEN_ALL_HPP_INCLUDED #define NT2_SDK_TBB_FUTURE_WHEN_ALL_HPP_INCLUDED #if defined(NT2_USE_TBB) #include <tbb/tbb.h> #include <tbb/flow_graph.h> #include <nt2/sdk/shared_memory/future.hpp> #include <nt2/sdk/tbb/future/details/tbb_future.hpp> #include <nt2/sdk/tbb/future/details/empty_body.hpp> #include <cstdio> #include <tuple> namespace nt2 { namespace details { struct empty_functor { typedef int result_type; int operator()() const { return 0; } }; template<std::size_t N> struct link_nodes { template <class Future, typename Node_raw, typename Tuple> static void call( Future & f , Node_raw c , Tuple && a ) { tbb::flow::make_edge( *( std::get<N-1>(a).node_ ) , *c ); f.attach_previous_future( std::get<N-1>(a) ); link_nodes<N-1>().call(f,c,a); } }; template<> struct link_nodes<1ul> { template <class Future, typename Node_raw, typename Tuple> static void call( Future & f , Node_raw c , Tuple && a ) { tbb::flow::make_edge( *( std::get<0>(a).node_ ) , *c ); f.attach_previous_future( std::get<0>(a) ); } }; } template<class Site> struct when_all_impl< tag::tbb_<Site> > { typedef typename tbb::flow::continue_node< tbb::flow::continue_msg> node_type; typedef typename details::tbb_future<int> whenall_future; template <typename Future> whenall_future static call( std::vector<Future> & lazy_values ) { whenall_future future_res; node_type * c = new node_type( *(future_res.getWork()), details::tbb_task_wrapper<details::empty_functor,whenall_future> (details::empty_functor(), future_res) ); future_res.getTaskQueue()->push_back(c); for (std::size_t i=0; i<lazy_values.size(); i++) { future_res.attach_previous_future(lazy_values[i]); tbb::flow::make_edge(*(lazy_values[i].node_),*c); } future_res.attach_task(c); return future_res; } template< typename ... A > whenall_future static call( details::tbb_future<A> & ...a ) { whenall_future future_res; node_type * c = new node_type( *future_res.getWork(), details::tbb_task_wrapper<details::empty_functor,whenall_future> ( details::empty_functor() , whenall_future(future_res) ) ); future_res.getTaskQueue()->push_back(c); future_res.attach_task(c); details::link_nodes< sizeof...(A) >() .call(future_res,c,std::tie(a...)); return future_res; } }; } #endif #endif <|start_filename|>modules/boost/simd/base/include/boost/simd/constant/constants/valmin.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2011 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2011 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef BOOST_SIMD_CONSTANT_CONSTANTS_VALMIN_HPP_INCLUDED #define BOOST_SIMD_CONSTANT_CONSTANTS_VALMIN_HPP_INCLUDED #include <boost/simd/include/functor.hpp> #include <boost/simd/meta/int_c.hpp> #include <boost/simd/meta/float.hpp> #include <boost/simd/meta/double.hpp> #include <boost/simd/constant/hierarchy.hpp> #ifdef BOOST_MSVC #pragma warning(push) #pragma warning(disable: 4146) #endif namespace boost { namespace simd { namespace tag { /*! @brief Valmin generic tag Represents the Valmin constant in generic contexts. @par Models: Hierarchy **/ struct Valmin : ext::pure_constant_<Valmin> { typedef double default_type; typedef ext::pure_constant_<Valmin> parent; /// INTERNAL ONLY template<class Target, class Dummy=void> struct apply : meta::int_c < typename Target::type, 0> {}; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_Valmin( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; /// INTERNAL ONLY template<class T, class Dummy> struct Valmin::apply<boost::dispatch::meta::single_<T>,Dummy> : meta::single_<0xFF7FFFFFUL> {}; /// INTERNAL ONLY template<class T, class Dummy> struct Valmin::apply<boost::dispatch::meta::double_<T>,Dummy> : meta::double_<0xFFEFFFFFFFFFFFFFULL> {}; /// INTERNAL ONLY template<class T, class Dummy> struct Valmin::apply<boost::dispatch::meta::int8_<T>,Dummy> : meta::int_c<T, T(-128)> {}; /// INTERNAL ONLY template<class T, class Dummy> struct Valmin::apply<boost::dispatch::meta::int16_<T>,Dummy> : meta::int_c<T, T(-32768)> {}; /// INTERNAL ONLY template<class T, class Dummy> struct Valmin::apply<boost::dispatch::meta::int32_<T>,Dummy> : meta::int_c < T , T(-boost::simd::uint32_t(2147483648UL)) > {}; /// INTERNAL ONLY template<class T, class Dummy> struct Valmin::apply<boost::dispatch::meta::int64_<T>,Dummy> : meta::int_c < T , T(-boost::simd::uint64_t(9223372036854775808ULL)) > {}; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::Valmin, Site> dispatching_Valmin(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::Valmin, Site>(); } template<class... Args> struct impl_Valmin; } /*! Generates the least finite value of a type. @par Semantic: @code T r = Valmin<T>(); @endcode is similar to: @code if T is integral r = 1 << (sizeof(T)*8-1); else if T is double r = -1.7976931348623157e+308; else if T is float r = -3.4028234e+38f; @endcode **/ BOOST_SIMD_CONSTANT_IMPLEMENTATION(boost::simd::tag::Valmin, Valmin) } } #ifdef BOOST_MSVC #pragma warning(pop) #endif #include <boost/simd/constant/common.hpp> #endif <|start_filename|>modules/core/gallery/include/nt2/gallery/functions/tridiag.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_GALLERY_FUNCTIONS_TRIDIAG_HPP_INCLUDED #define NT2_GALLERY_FUNCTIONS_TRIDIAG_HPP_INCLUDED #include <nt2/include/functor.hpp> /*! * \ingroup algebra * \defgroup algebra_tridiag tridiag * * \par Description * tridiagonal matrix * tridiag(x,y,z) is the tridiagonal matrix with * subdiagonal x, diagonal y, and superdiagonal z. * if they are vectors x and z are of dimension one less than y. * but only one vector is necessary if n is not provided the other can * be scalar. Be aware that if x or z is the lone vector, matrix dimension * will be (length(x)+1)X(length(x)+1) (respectively with z). If * y is given length(y)Xlength(y) * * tridiag(n,c,d,e), where c, d, and e are all scalars, * yields the toeplitz tridiagonal matrix of order n with subdiagonal * elements c, diagonal elements d, and superdiagonal elements e. this * matrix has eigenvalues: d + 2*sqrt(c*e)*cos(k*pi/(n+1)), k=1:n. * * tridiag(n) is the same as tridiag(n,-1,2,-1), * which is a symmetric positive definite m-matrix (the negative of the * second difference matrix). * References: * [1] <NAME>, Basic Numerical Mathematics, Vol 2: Numerical Algebra, * Birkhauser, Basel, and Academic Press, New York, 1977, p. 155. * [2] <NAME>, Some continuant determinants arising in * physics and chemistry---II, Proc. Royal Soc. Edin., 63, * A (1952), pp. 232-241. * * \par Header file * * \code * #include <nt2/include/functions/tridiag.hpp> * \endcode * * **/ //============================================================================== // tridiag actual class forward declaration //============================================================================== namespace nt2 { namespace tag { /*! * \brief Define the tag tridiag_ of functor tridiag * in namespace nt2::tag for toolbox algebra **/ struct tridiag_ : ext::abstract_<tridiag_> { typedef ext::abstract_<tridiag_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_tridiag_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::tridiag_, Site> dispatching_tridiag_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::tridiag_, Site>(); } template<class... Args> struct impl_tridiag_; } NT2_FUNCTION_IMPLEMENTATION(tag::tridiag_, tridiag, 4) NT2_FUNCTION_IMPLEMENTATION(tag::tridiag_, tridiag, 3) NT2_FUNCTION_IMPLEMENTATION(tag::tridiag_, tridiag, 2) NT2_FUNCTION_IMPLEMENTATION(tag::tridiag_, tridiag, 1) template<class T, class I> typename meta::call<nt2::tag::tridiag_(const I&, nt2::meta::as_<T>) >::type tridiag(const I& n) { return tridiag(n, nt2::meta::as_<T>()); } } #endif <|start_filename|>modules/boost/simd/base/include/boost/simd/swar/functions/group.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef BOOST_SIMD_SWAR_FUNCTIONS_GROUP_HPP_INCLUDED #define BOOST_SIMD_SWAR_FUNCTIONS_GROUP_HPP_INCLUDED #include <boost/simd/include/functor.hpp> #include <boost/dispatch/include/functor.hpp> namespace boost { namespace simd { namespace tag { /*! @brief group generic tag Represents the group function in generic contexts. @par Models: Hierarchy **/ struct group_ : ext::elementwise_<group_> { /// @brief Parent hierarchy typedef ext::elementwise_<group_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_group_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::group_, Site> dispatching_group_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::group_, Site>(); } template<class... Args> struct impl_group_; } /*! take two SIMD vectors of same type and elements of size n and return a vector collecting the two in a vector in which the elements have size n/2 Of course the applicability is conditioned by the existence of compatible SIMD vector types @par Semantic: For every parameters of type T0 @code downgrade<T0> r = group(a0, a1); @endcode is similar to: @code downgrade<T0> r; for(int i=0;i < T0::static_size; ++i) r[i] = a0[i]; r[i+T0::static_size] = a1[i]; @endcode @par Alias: @c demote, @c narrow @param a0 @return a value of the same type as the second parameter **/ BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::group_, group, 2) BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::group_, group, 1) BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::group_, demote, 1) BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::group_, narrow, 1) } } #endif <|start_filename|>modules/core/euler/include/nt2/euler/functions/simd/common/erfc.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2011 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2011 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_EULER_FUNCTIONS_SIMD_COMMON_ERFC_HPP_INCLUDED #define NT2_EULER_FUNCTIONS_SIMD_COMMON_ERFC_HPP_INCLUDED #include <nt2/euler/functions/erfc.hpp> #include <nt2/euler/functions/details/erf_kernel.hpp> #include <nt2/include/constants/two.hpp> #include <nt2/include/constants/twothird.hpp> #include <nt2/include/constants/zero.hpp> #include <nt2/include/functions/simd/abs.hpp> #include <nt2/include/functions/simd/divides.hpp> #include <nt2/include/functions/simd/exp.hpp> #include <nt2/include/functions/simd/if_else.hpp> #include <nt2/include/functions/simd/inbtrue.hpp> #include <nt2/include/functions/simd/is_less.hpp> #include <nt2/include/functions/simd/is_ltz.hpp> #include <nt2/include/functions/simd/logical_andnot.hpp> #include <nt2/include/functions/simd/minus.hpp> #include <nt2/include/functions/simd/multiplies.hpp> #include <nt2/include/functions/simd/oneminus.hpp> #include <nt2/include/functions/simd/oneplus.hpp> #include <nt2/include/functions/simd/plus.hpp> #include <nt2/include/functions/simd/splat.hpp> #include <nt2/include/functions/simd/sqr.hpp> #include <nt2/include/functions/simd/unary_minus.hpp> #include <nt2/sdk/meta/as_logical.hpp> #include <nt2/sdk/meta/cardinal_of.hpp> #include <boost/simd/sdk/config.hpp> #ifndef BOOST_SIMD_NO_INFINITIES #include <nt2/include/constants/inf.hpp> #include <nt2/include/functions/simd/if_zero_else.hpp> #include <nt2/include/functions/simd/is_equal.hpp> #endif namespace nt2 { namespace ext { BOOST_DISPATCH_IMPLEMENT ( erfc_, tag::cpu_ , (A0)(X) , ((simd_<double_<A0>,X>)) ) { typedef A0 result_type; NT2_FUNCTOR_CALL(1) { typedef typename meta::as_logical<A0>::type bA0; A0 x = nt2::abs(a0); A0 xx = nt2::sqr(x); A0 lim1 = nt2::splat<A0>(0.65); A0 lim2 = nt2::splat<A0>(2.2); bA0 test0 = nt2::is_ltz(a0); bA0 test1 = nt2::lt(x, lim1); A0 r1 = nt2::Zero<A0>(); std::size_t nb = nt2::inbtrue(test1); if(nb > 0) { r1 = nt2::oneminus(x*details::erf_kernel<A0>::erf1(xx)); if (nb >= meta::cardinal_of<A0>::value) return nt2::if_else(test0, nt2::Two<A0>()-r1, r1); } bA0 test2 = nt2::lt(x, lim2); bA0 test3 = nt2::logical_andnot(test2, test1); A0 ex = nt2::exp(-xx); std::size_t nb1 = nt2::inbtrue(test3); if(nb1 > 0) { A0 z = ex*details::erf_kernel<A0>::erfc2(x); r1 = nt2::if_else(test1, r1, z); nb += nb1; if (nb >= meta::cardinal_of<A0>::value) return nt2::if_else(test0, Two<A0>()-r1, r1); } A0 z = ex*details::erf_kernel<A0>::erfc3(x); r1 = nt2::if_else(test2, r1, z); #ifndef BOOST_SIMD_NO_INFINITIES r1 = if_zero_else( eq(x, Inf<A0>()), r1); #endif return nt2::if_else(test0, nt2::Two<A0>()-r1, r1); } }; BOOST_DISPATCH_IMPLEMENT ( erfc_, tag::cpu_ , (A0)(X) , ((simd_<single_<A0>,X>)) ) { typedef A0 result_type; NT2_FUNCTOR_CALL(1) { typedef typename meta::as_logical<A0>::type bA0; A0 x = nt2::abs(a0); bA0 test0 = nt2::is_ltz(a0); A0 r1 = nt2::Zero<A0>(); bA0 test1 = nt2::lt(x, Twothird<A0>()); A0 z = x/oneplus(x); std::size_t nb = nt2::inbtrue(test1); if(nb > 0) { r1 = details::erf_kernel<A0>::erfc3(z); if (nb >= meta::cardinal_of<A0>::value) return nt2::if_else(test0, nt2::Two<A0>()-r1, r1); } z -= nt2::splat<A0>(0.4); A0 r2 = exp(-sqr(x))*details::erf_kernel<A0>::erfc2(z); r1 = if_else(test1, r1, r2); #ifndef BOOST_SIMD_NO_INFINITIES r1 = if_zero_else( eq(x, Inf<A0>()), r1); #endif return nt2::if_else(test0, nt2::Two<A0>()-r1, r1); } }; } } #endif <|start_filename|>modules/boost/simd/base/include/boost/simd/bitwise/functions/bitwise_notand.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef BOOST_SIMD_BITWISE_FUNCTIONS_BITWISE_NOTAND_HPP_INCLUDED #define BOOST_SIMD_BITWISE_FUNCTIONS_BITWISE_NOTAND_HPP_INCLUDED #include <boost/simd/include/functor.hpp> #include <boost/dispatch/include/functor.hpp> namespace boost { namespace simd { namespace tag { /*! @brief bitwise_notand generic tag Represents the bitwise_notand function in generic contexts. @par Models: Hierarchy **/ struct bitwise_notand_ : ext::elementwise_<bitwise_notand_> { /// @brief Parent hierarchy typedef ext::elementwise_<bitwise_notand_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_bitwise_notand_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::bitwise_notand_, Site> dispatching_bitwise_notand_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::bitwise_notand_, Site>(); } template<class... Args> struct impl_bitwise_notand_; } /*! Computes the bitwise and not of its parameters. @par semantic: For any given value @c x, of type @c T1 @c y of type @c T2 of same memory size: @code T1 r = bitwise_notand(x, y); @endcode The code is equivalent to: @code T1 r = ~x & y; @endcode @par Alias b_notand @see @funcref{bitwise_or}, @funcref{bitwise_xor}, @funcref{bitwise_and}, @funcref{bitwise_andnot}, @funcref{bitwise_notor}, @funcref{bitwise_ornot}, @funcref{complement} @param a0 @param a1 @return a value of the same type as the first input. **/ BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::bitwise_notand_, bitwise_notand, 2) BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::bitwise_notand_, b_notand, 2) } } #endif // modified by jt the 25/12/2010 <|start_filename|>modules/core/reduction/include/nt2/core/functions/nanasum2.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // Copyright 2011 - 2012 MetaScale SAS // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_CORE_FUNCTIONS_NANASUM2_HPP_INCLUDED #define NT2_CORE_FUNCTIONS_NANASUM2_HPP_INCLUDED #include <nt2/include/functor.hpp> namespace nt2 { namespace tag { /*! @brief Tag for the nanasum2 functor **/ struct nanasum2_ : ext::abstract_<nanasum2_> { /// @brief Parent hierarchy typedef ext::abstract_<nanasum2_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_nanasum2_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::nanasum2_, Site> dispatching_nanasum2_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::nanasum2_, Site>(); } template<class... Args> struct impl_nanasum2_; } /*! @brief sum of square absolute value of a table expression, suppressing Nans Computes the sum of square absolute value of the non nan elements of a table expression along a given dimension. @par Semantic For any table expression @c t and any integer @c n: @code auto r = nanasum2(t,n); @endcode is equivalent to: @code auto r = asum2(if_zero_else(isnan(t), t),n); @endcode @par Note: n default to firstnonsingleton(t) @see @funcref{firstnonsingleton}, @funcref{asum2}, @funcref{if_zero_else} @param a0 Table expression to process @param a1 Dimension along which to process a0 @return An expression eventually evaluated to the result */ NT2_FUNCTION_IMPLEMENTATION(nt2::tag::nanasum2_ , nanasum2, 2) /// @overload NT2_FUNCTION_IMPLEMENTATION(nt2::tag::nanasum2_ , nanasum2, 1) } #endif <|start_filename|>modules/core/restructuring/include/nt2/core/functions/ifvectvert.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // Copyright 2011 - 2012 MetaScale SAS // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_CORE_FUNCTIONS_IFVECTVERT_HPP_INCLUDED #define NT2_CORE_FUNCTIONS_IFVECTVERT_HPP_INCLUDED #include <nt2/include/functor.hpp> #include <nt2/core/container/dsl/size.hpp> #include <nt2/core/container/dsl/reshaping.hpp> #include <nt2/sdk/meta/reshaping_hierarchy.hpp> #include <nt2/core/container/dsl/value_type.hpp> namespace nt2 { namespace tag { /*! @brief ifvectvert generic tag Represents the ifvectvert function in generic contexts. @par Models: Hierarchy **/ struct ifvectvert_ : ext::reshaping_<ifvectvert_> { /// @brief Parent hierarchy typedef ext::reshaping_<ifvectvert_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_ifvectvert_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::ifvectvert_, Site> dispatching_ifvectvert_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::ifvectvert_, Site>(); } template<class... Args> struct impl_ifvectvert_; } /*! Column reshaping if input is vector @par Semantic: For every parameter of type T0 @code auto r = ifvectvert(a0); @endcode is similar to: @code auto r = isvect(a0) ? colvect(a0) : a0; @endcode @see @funcref{isvect}, @funcref{colvect} @param a0 @return an expression which eventually will evaluate to the result **/ NT2_FUNCTION_IMPLEMENTATION(nt2::tag::ifvectvert_ , ifvectvert, 1) NT2_FUNCTION_IMPLEMENTATION_SELF(nt2::tag::ifvectvert_ , ifvectvert, 1) } #endif <|start_filename|>modules/boost/simd/base/include/boost/simd/operator/functions/logical_or.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2011 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2011 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef BOOST_SIMD_OPERATOR_FUNCTIONS_LOGICAL_OR_HPP_INCLUDED #define BOOST_SIMD_OPERATOR_FUNCTIONS_LOGICAL_OR_HPP_INCLUDED #include <boost/simd/include/functor.hpp> namespace boost { namespace simd { namespace tag { /*! @brief logical_or generic tag Represents the logical_or function in generic contexts. @par Models: Hierarchy **/ struct logical_or_ : ext::elementwise_<logical_or_> { /// @brief Parent hierarchy typedef ext::elementwise_<logical_or_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_logical_or_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::logical_or_, Site> dispatching_logical_or_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::logical_or_, Site>(); } template<class... Args> struct impl_logical_or_; } /*! return the logical or of the two parameters the operands must of the same type Infix notation can be used with operator '||' @par Semantic: For every parameters of types respectively T0, T1: @code as_logical<T0> r = logical_or(a0,a1); @endcode is similar to: @code as_logical<T0> r = a0 || a1; @endcode @par Alias: @c l_or @see @funcref{logical_and}, @funcref{logical_xor}, @funcref{logical_notand}, @funcref{logical_andnot}, @funcref{logical_notor}, @funcref{logical_ornot}, @funcref{logical_not} @param a0 @param a1 @return a logical value **/ BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::logical_or_ , logical_or , 2 ) BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::logical_or_ , l_or , 2 ) } } #include <boost/simd/operator/specific/common.hpp> #endif <|start_filename|>modules/core/combinatorial/include/nt2/combinatorial/functions/is_prime.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_COMBINATORIAL_FUNCTIONS_IS_PRIME_HPP_INCLUDED #define NT2_COMBINATORIAL_FUNCTIONS_IS_PRIME_HPP_INCLUDED #include <nt2/include/functor.hpp> namespace nt2 { namespace tag { /*! @brief is_prime generic tag Represents the is_prime function in generic contexts. @par Models: Hierarchy **/ // struct is_prime_ : ext::elementwise_<is_prime_> { typedef ext::elementwise_<is_prime_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_is_prime_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; struct is_prime_ : ext::abstract_<is_prime_> { /// @brief Parent hierarchy typedef ext::abstract_<is_prime_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_is_prime_(ext::adl_helper(), static_cast<Args&&>(args)...) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::is_prime_, Site> dispatching_is_prime_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::is_prime_, Site>(); } template<class... Args> struct impl_is_prime_; } /*! computes if each element of the table is prime or not in an expression table of logical. @par Semantic: For every table expression @code auto r = is_prime(a0); @endcode an integer is prime if it is positive and has exactly 2 distinct exact divisors. @see @funcref{primes}, @funcref{factor} @param a0 @return an expression which eventually will evaluate to the result **/ NT2_FUNCTION_IMPLEMENTATION(tag::is_prime_,is_prime, 1) NT2_FUNCTION_IMPLEMENTATION(tag::is_prime_,is_prime, 2) } #endif <|start_filename|>modules/boost/simd/base/include/boost/simd/swar/functions/shuffle.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2011 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2011 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef BOOST_SIMD_SWAR_FUNCTIONS_SHUFFLE_HPP_INCLUDED #define BOOST_SIMD_SWAR_FUNCTIONS_SHUFFLE_HPP_INCLUDED #include <boost/simd/include/functor.hpp> #include <boost/simd/sdk/meta/cardinal_of.hpp> #include <boost/simd/swar/functions/details/random_permute.hpp> #include <boost/dispatch/meta/as.hpp> namespace boost { namespace simd { namespace tag { /*! @brief shuffle generic tag Represents the shuffle function in generic contexts. @par Models: Hierarchy **/ struct shuffle_ : ext::unspecified_<shuffle_> { /// @brief Parent hierarchy typedef ext::unspecified_<shuffle_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_shuffle_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::shuffle_, Site> dispatching_shuffle_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::shuffle_, Site>(); } template<class... Args> struct impl_shuffle_; } } } namespace { /// INTERNAL ONLY - local shuffle functor type template<typename T> using shuffle_t = typename boost::dispatch ::make_functor< boost::simd::tag::shuffle_ , T >::type; } namespace boost { namespace simd { /*! @brief SIMD register shuffling Shuffle the elements of one SIMD register following a compile-time permutation pattern passed as a static list of integral constants. @par Semantic: Let's @c T be a SIMD register type of cardinal @c N and <tt>I1,...,In</tt> be @c N integral constant in \f$[-1, N[\f$. For any SIMD register @c v of type @c T, the following code : @code T r = shuffle<I1, ..., In>(v); @endcode is equivalent to @code r[0] = I1 == -1 ? 0 : v[I1]; r[1] = I2 == -1 ? 0 : v[I2]; ... r[N-1] = Ic == -1 ? 0 : v[In]; @endcode @usage{shuffle_idx1.cpp} @tparam Indices Integral constant defining the permutation pattern @param a0 First register to shuffle @return A SIMD register shuffled as per the permutation pattern **/ template<int... Indices, typename A0> BOOST_FORCEINLINE auto shuffle(A0 const& a0) -> decltype(shuffle_t<A0>()(a0,details::random_permute_t<Indices...>())) { static_assert ( boost::simd::meta::cardinal_of<A0>::value == sizeof...(Indices) , "Wrong number of permutation indices" ); return shuffle_t<A0>()(a0,details::random_permute_t<Indices...>()); } /*! @brief SIMD register shuffling Shuffle the elements of two SIMD registers following a compile-time permutation pattern passed as a static list of integral constants. @par Semantic: Let's @c T be a SIMD register type of cardinal @c N and <tt>I1,...,In</tt> be @c N integral constant in \f$[-1, 2N-1[\f$. For any SIMD register @c v1 and @c v2 of type @c T, the following code : @code T r = shuffle<I1, ..., In>(v1,v2); @endcode is equivalent to shuffling the agglomeration of @c v1 and @c v2 and extracting the lower part of the resulting vector. @code r[0] = shuffle<I1,...,Ic>( combine(v1,v2) )[0] r[1] = shuffle<I1,...,Ic>( combine(v1,v2) )[1] ... r[N-1] = shuffle<I1,...,Ic>( combine(v1,v2) )[N-1] @endcode @usage{shuffle_idx2.cpp} @tparam Indices Integral constant defining the permutation pattern @param a0 First register to shuffle @param a1 Second register to shuffle. @return A SIMD register shuffled as per the permutation pattern **/ template<int... Indices, typename A0, typename A1> BOOST_FORCEINLINE auto shuffle(A0 const& a0, A1 const& a1) -> decltype(shuffle_t<A0>()(a0,a1,details::random_permute_t<Indices...>())) { static_assert ( boost::simd::meta::cardinal_of<A0>::value == sizeof...(Indices) && boost::simd::meta::cardinal_of<A1>::value == sizeof...(Indices) , "Wrong number of permutation indices" ); return shuffle_t<A0>()(a0,a1,details::random_permute_t<Indices...>()); } /*! @brief SIMD register shuffling Shuffle the elements of one SIMD register following a compile-time permutation pattern passed as a @metafunction. @par Semantic: Let's @c T be a SIMD register type of cardinal @c N, @c Perm be a binary @metafunction. For any SIMD register @c v of type @c T, the following code: @code T r = shuffle<Perm>(v); @endcode is respectively equivalent to @code T r = shuffle< mpl::apply<Perm, int_<0>, int_<N> >::type::value , ... , mpl::apply<Perm, int_<C-1>, int_<N> >::type::value >(v); @endcode @usage{shuffle_perm2.cpp} @tparam Perm Permutation pattern @metafunction @param a0 First register to shuffle @return A SIMD register shuffled as per the permutation pattern **/ template<typename Perm,typename A0> BOOST_FORCEINLINE auto shuffle(A0 const& a0) -> decltype(shuffle_t<A0>()(a0,boost::dispatch::meta::as_<Perm>())) { return shuffle_t<A0>()(a0,boost::dispatch::meta::as_<Perm>()); } /*! @brief SIMD register shuffling Shuffle the elements of two SIMD registers following a compile-time permutation pattern passed as a @metafunction. @par Semantic: Let's @c T be a SIMD register type of cardinal @c N, @c Perm be a binary @metafunction. For any SIMD register @c v1 and @c v2 of type @c T, the following code: @code T r = shuffle<Perm>(v1,v2); @endcode is equivalent to @code T r = shuffle< mpl::apply<Perm, int_<0>, int_<N> >::type::value , ... , mpl::apply<Perm, int_<C-1>, int_<N> >::type::value >(v1,v2); @endcode @usage{shuffle_perm1.cpp} @tparam Perm Permutation pattern @metafunction @param a0 First register to shuffle @param a1 Second register to shuffle. @return A SIMD register shuffled as per the permutation pattern **/ template<typename Perm, typename A0, typename A1> BOOST_FORCEINLINE auto shuffle(A0 const& a0, A1 const& a1) -> decltype(shuffle_t<A0>()(a0,a1,boost::dispatch::meta::as_<Perm>())) { return shuffle_t<A0>()(a0,a1,boost::dispatch::meta::as_<Perm>()); } } } #endif <|start_filename|>modules/core/gallery/include/nt2/gallery/functions/randcorr.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_GALLERY_FUNCTIONS_RANDCORR_HPP_INCLUDED #define NT2_GALLERY_FUNCTIONS_RANDCORR_HPP_INCLUDED #include <nt2/include/functor.hpp> #include <nt2/include/functions/numel.hpp> #include <nt2/sdk/meta/boxed_size.hpp> #include <nt2/sdk/meta/value_as.hpp> /*! * \ingroup algebra * \defgroup algebra_randcorr randcorr * * randcorr(n) is a random n-by-n correlation matrix with * random eigenvalues from a uniform distribution. * a correlation matrix is a symmetric positive semidefinite matrix with * 1s on the diagonal (see corrcoef). * * randcorr(x) produces a random correlation matrix * having eigenvalues given by the vector x, where length(x) > 1. * x must have nonnegative elements summing to length(x). * * an additional argument, k, can be supplied. * for k = 0 (the default) the diagonal matrix of eigenvalues is initially * subjected to a random orthogonal similarity transformation and then * a sequence of givens rotations is applied. * for k = 1, the initial transformation is omitted. this is much faster, * but the resulting matrix may have some zero entries. * * References: * [1] <NAME> and <NAME>, Population correlation matrices * for sampling experiments, Commun. Statist. Simulation Comput., * B7 (1978), pp. 163-182. * [2] <NAME> and <NAME>, Numerically stable generation of * correlation matrices and their factors, BIT, 40 (2000), pp. 640-651. * * * * \par Header file * * \code * #include <nt2/include/functions/randcorr.hpp> * \endcode * **/ //============================================================================== // randcorr actual class forward declaration //============================================================================== namespace nt2 { namespace tag { /*! * \brief Define the tag randcorr_ of functor randcorr * in namespace nt2::tag for toolbox algebra **/ struct randcorr0_ : ext::abstract_<randcorr0_> { typedef ext::abstract_<randcorr0_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_randcorr0_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; struct randcorr_ : ext::unspecified_<randcorr_> { typedef ext::unspecified_<randcorr_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_randcorr_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::randcorr0_, Site> dispatching_randcorr0_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::randcorr0_, Site>(); } template<class... Args> struct impl_randcorr0_; template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::randcorr_, Site> dispatching_randcorr_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::randcorr_, Site>(); } template<class... Args> struct impl_randcorr_; } NT2_FUNCTION_IMPLEMENTATION(tag::randcorr_, randcorr, 3) NT2_FUNCTION_IMPLEMENTATION(tag::randcorr_, randcorr, 2) NT2_FUNCTION_IMPLEMENTATION(tag::randcorr_, randcorr, 1); } namespace nt2 { namespace ext { template<class Domain, class Expr, int N> struct size_of<tag::randcorr_, Domain, N, Expr> : meta::boxed_size<Expr, 3> {}; template <class Domain, class Expr, int N> struct value_type < tag::randcorr_, Domain,N,Expr> { typedef typename boost::proto::result_of::child_c<Expr&,0>::type tmp_type; typedef typename meta::strip<tmp_type>::type tmp1_type; typedef typename boost::dispatch::meta::semantic_of<tmp1_type >::type t_type; typedef typename meta::strip<t_type>::type tt_type; typedef typename tt_type::value_type type; }; } } #endif <|start_filename|>modules/boost/simd/base/include/boost/simd/ieee/functions/maxnummag.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef BOOST_SIMD_IEEE_FUNCTIONS_MAXNUMMAG_HPP_INCLUDED #define BOOST_SIMD_IEEE_FUNCTIONS_MAXNUMMAG_HPP_INCLUDED #include <boost/simd/include/functor.hpp> #include <boost/dispatch/include/functor.hpp> namespace boost { namespace simd { namespace tag { /*! @brief maxnummag generic tag Represents the maxnummag function in generic contexts. @par Models: Hierarchy **/ struct maxnummag_ : ext::elementwise_<maxnummag_> { /// @brief Parent hierarchy typedef ext::elementwise_<maxnummag_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_maxnummag_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::maxnummag_, Site> dispatching_maxnummag_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::maxnummag_, Site>(); } template<class... Args> struct impl_maxnummag_; } /*! Returns the input value which have the greatest absolute value, ignoring nan. @par Semantic: @code T r = maxnummag(a0,a1); @endcode is similar to: @code T r = isnan(a0) ? a1 : (isnan(a1) ? a0 : maxmag(a0, a1)); @endcode @param a0 @param a1 @return a value of same type as the inputs **/ BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::maxnummag_, maxnummag, 2) } } #endif <|start_filename|>modules/core/reduction/include/nt2/core/functions/meanad.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // Copyright 2011 - 2012 MetaScale SAS // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_CORE_FUNCTIONS_MEANAD_HPP_INCLUDED #define NT2_CORE_FUNCTIONS_MEANAD_HPP_INCLUDED #include <nt2/include/functor.hpp> namespace nt2 { namespace tag { /*! @brief Tag for the meanad functor **/ struct meanad_ : ext::abstract_<meanad_> { typedef ext::abstract_<meanad_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_meanad_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::meanad_, Site> dispatching_meanad_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::meanad_, Site>(); } template<class... Args> struct impl_meanad_; } /*! @brief mean of the absolute deviation to the mean of an expression Computes the mean of the of the absolute deviation to the mean of non nan elements of a table expression along a given dimension. @par Semantic For any table expression @c t and any integer @c n: @code auto r = meanad(t,n); @endcode is equivalent to: @code auto r = mean(abs(a-expand_to(mean(a,n), size(a))), n); @endcode @par Note: n default to firstnonsingleton(t) @see @funcref{firstnonsingleton}, @funcref{mean}, @funcref{abs}, @funcref{size}, @funcref{expand_to} @param a0 Table to process @param a1 Dimension along which to process a0 @return An expression eventually evaluated to the result */ NT2_FUNCTION_IMPLEMENTATION(nt2::tag::meanad_ , meanad, 2) ///@overload NT2_FUNCTION_IMPLEMENTATION(nt2::tag::meanad_ , meanad, 1) } #endif <|start_filename|>modules/boost/simd/base/include/boost/simd/reduction/functions/posmax.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef BOOST_SIMD_REDUCTION_FUNCTIONS_POSMAX_HPP_INCLUDED #define BOOST_SIMD_REDUCTION_FUNCTIONS_POSMAX_HPP_INCLUDED #include <boost/simd/include/functor.hpp> #include <boost/dispatch/include/functor.hpp> namespace boost { namespace simd { namespace tag { /*! @brief posmax generic tag Represents the posmax function in generic contexts. @par Models: Hierarchy **/ struct posmax_ : ext::unspecified_<posmax_> { /// @brief Parent hierarchy typedef ext::unspecified_<posmax_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_posmax_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::posmax_, Site> dispatching_posmax_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::posmax_, Site>(); } template<class... Args> struct impl_posmax_; } /*! Returns the index of the first occurence of greatest element of the SIMD vector @par Semantic: For every parameter of type T0 @code size_t r = posmax(a0); @endcode is similar to: @code scalar_of<T0> m = maximum(a0); size_t r; for(size_t i=0; i < cardinal_of<T0>; i++) if (m == a0[i]) { r = i; break; } @endcode @param a0 @return a size_t value **/ BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::posmax_, posmax, 1) } } #endif <|start_filename|>modules/boost/simd/base/include/boost/simd/arithmetic/functions/touints.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef BOOST_SIMD_ARITHMETIC_FUNCTIONS_TOUINTS_HPP_INCLUDED #define BOOST_SIMD_ARITHMETIC_FUNCTIONS_TOUINTS_HPP_INCLUDED #include <boost/simd/include/functor.hpp> #include <boost/dispatch/include/functor.hpp> namespace boost { namespace simd { namespace tag { /*! @brief touints generic tag Represents the touints function in generic contexts. @par Models: Hierarchy **/ struct touints_ : ext::elementwise_<touints_> { /// @brief Parent hierarchy typedef ext::elementwise_<touints_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_touints_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::touints_, Site> dispatching_touints_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::touints_, Site>(); } template<class... Args> struct impl_touints_; } /*! Convert to unsigned integer by saturated truncation. @par semantic: For any given value @c x of type @c T: @code as_integer<T, unsigned> r = touint(x); @endcode The code is similar to: @code as_integer<T,unsigned> r = static_cast<as_integer<T,unsigned> >(saturate<as_integer<T,unsigned> (x))) @endcode @par Notes: The Inf, Nan and negative values are treated properly and go respectively to Valmax, and Zero of the destination integral type. All values superior (resp. less) than Valmax (resp. Valmin) of the return type are saturated accordingly. @par Alias saturated_toint @see @funcref{toint} @param a0 @return a value of the unsigned integer type associated to the input. **/ BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::touints_, touints, 1) BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::touints_, saturated_touint, 1) } } #endif <|start_filename|>modules/boost/simd/base/include/boost/simd/arithmetic/functions/minmod.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef BOOST_SIMD_ARITHMETIC_FUNCTIONS_MINMOD_HPP_INCLUDED #define BOOST_SIMD_ARITHMETIC_FUNCTIONS_MINMOD_HPP_INCLUDED #include <boost/simd/include/functor.hpp> #include <boost/dispatch/include/functor.hpp> namespace boost { namespace simd { namespace tag { /*! @brief minmod generic tag Represents the minmod function in generic contexts. @par Models: Hierarchy **/ struct minmod_ : ext::elementwise_<minmod_> { /// @brief Parent hierarchy typedef ext::elementwise_<minmod_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_minmod_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::minmod_, Site> dispatching_minmod_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::minmod_, Site>(); } template<class... Args> struct impl_minmod_; } /*! Return the minimum of the two entries if they have the same sign, otherwise 0 @par semantic: For any given value @c x, @c y of type @c T: @code T r = minmod(x, y); @endcode is similar to: @code T r = x*y > 0 ? min(x, y) : 0; @endcode @param a0 @param a1 @return a value of the same type as the inputs. **/ BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::minmod_, minmod, 2) } } #endif <|start_filename|>modules/boost/simd/sdk/include/boost/simd/memory/functions/aligned_store.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // Copyright 2011 - 2014 MetaScale SAS // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef BOOST_SIMD_MEMORY_FUNCTIONS_ALIGNED_STORE_HPP_INCLUDED #define BOOST_SIMD_MEMORY_FUNCTIONS_ALIGNED_STORE_HPP_INCLUDED #include <boost/simd/include/functor.hpp> #include <boost/dispatch/include/functor.hpp> namespace boost { namespace simd { namespace tag { /*! @brief aligned_store generic tag Represents the aligned_store function in generic contexts. @par Models: Hierarchy **/ struct aligned_store_ : ext::abstract_<aligned_store_> { /// @brief Parent hierarchy typedef ext::abstract_<aligned_store_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_aligned_store_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::aligned_store_, Site> dispatching_aligned_store_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::aligned_store_, Site>(); } template<class... Args> struct impl_aligned_store_; } /*! @brief Store a value at an aligned memory location Store a given value into an aligned memory location referenced by either a pointer or a pointer and an offset. To support SIMD idioms like data scattering or non-POD values, both pointer and offset arguments can themselves be SIMD register or Fusion Sequences. @par Semantic: Depending on the type of its arguments, store exhibits different semantics. For any @c x of type @c Value, @c ptr of type @c Pointer, @c offset of type @c Offset and @c mask of type @c Mask, consider: @code aligned_store(x,ptr,offset,mask); @endcode If @c x is a SIMD value, this code is equivalent to: - If @c offset is a scalar integer: @code for(int i=0;i<Value::static_size;++i) if mask[i] *(ptr+offset+i) = x[i]; @endcode - If @c offset is a SIMD integral register: @code for(int i=0;i<Value::static_size;++i) if mask[i] *(ptr+offset[i]) = x[i]; @endcode In this case, the store operation is equivalent to a scatter operation. If @c x and @c ptr are Fusion Sequences of size @c N, this code is equivalent to: @code aligned_storeat_c<0>(x),at_c<0>(ptr),offset); ... aligned_storeat_c<N-1>(x),at_c<N-1>(ptr),offset); @endcode If @c x is a scalar value, this code is equivalent to: @code if (mask) *(ptr+offset) = x; @endcode @usage{memory/aligned_store.cpp} @par Precondition If @c Type is a SIMD register type: @code is_aligned( ptr + offset - Misalignment ) @endcode evaluates to @c true @param val Value to store @param ptr Memory location to store @c val to @param offset Optional memory offset. @param mask Optional logical mask. Only stores values for which the mask is true. **/ template<typename Value, typename Pointer, typename Offset> BOOST_FORCEINLINE void aligned_store(Value const& val, Pointer const& ptr, Offset const& offset) { typename boost::dispatch::meta ::dispatch_call<tag::aligned_store_ ( Value const& , Pointer const& , Offset const& )>::type callee; callee(val, ptr, offset); } /// @overload template<typename Value, typename Pointer, typename Offset, typename Mask> BOOST_FORCEINLINE void aligned_store(Value const& val, Pointer const& ptr, Offset const& offset, Mask const& mask) { typename boost::dispatch::meta ::dispatch_call<tag::aligned_store_ ( Value const& , Pointer const& , Offset const& , Mask const& )>::type callee; callee(val, ptr, offset, mask); } /// @overload template<typename Value, typename Pointer> BOOST_FORCEINLINE void aligned_store(Value const& val, Pointer const& ptr) { typename boost::dispatch::meta ::dispatch_call<tag::aligned_store_ ( Value const& , Pointer const& )>::type callee; callee(val, ptr); } } } #endif <|start_filename|>modules/binding/magma/include/nt2/linalg/functions/magma/sysv.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_LINALG_FUNCTIONS_MAGMA_SYSV_HPP_INCLUDED #define NT2_LINALG_FUNCTIONS_MAGMA_SYSV_HPP_INCLUDED #if defined(NT2_USE_MAGMA) #include <nt2/linalg/functions/sysv.hpp> #include <nt2/sdk/magma/magma.hpp> #include <nt2/include/functions/width.hpp> #include <nt2/linalg/details/utility/f77_wrapper.hpp> #include <magma.h> #include <iostream> namespace nt2 { namespace ext { /// INTERNAL ONLY - Compute the workspace BOOST_DISPATCH_IMPLEMENT ( sysv_, nt2::tag::magma_<site> , (A0)(S0)(A1)(S1)(A2)(S2)(site) , ((container_< nt2::tag::table_, double_<A0>, S0 >)) // A ((container_< nt2::tag::table_, integer_<A1>, S1 >)) // PIV ((container_< nt2::tag::table_, double_<A2>, S2 >)) // B ) { typedef nt2_la_int result_type; BOOST_FORCEINLINE result_type operator()(A0& a0, A1& a1, A2& a2) const { result_type that; nt2_la_int n = nt2::width(a0); nt2_la_int ld = a0.leading_size(); nt2_la_int ldb = a2.leading_size(); nt2_la_int nhrs = nt2::width(a2); magma_uplo_t uplo = MagmaLower; magma_dsysv( uplo, n, nhrs, a0.data(), ld, a1.data(), a2.data() , ldb, &that ); return that; } }; /// INTERNAL ONLY - Compute the workspace BOOST_DISPATCH_IMPLEMENT ( sysv_, nt2::tag::magma_<site> , (A0)(S0)(A1)(S1)(A2)(S2)(site) , ((container_< nt2::tag::table_, single_<A0>, S0 >)) // A ((container_< nt2::tag::table_, integer_<A1>, S1 >)) // PIV ((container_< nt2::tag::table_, single_<A2>, S2 >)) // B ) { typedef nt2_la_int result_type; BOOST_FORCEINLINE result_type operator()(A0& a0, A1& a1, A2& a2) const { result_type that; nt2_la_int n = nt2::width(a0); nt2_la_int ld = a0.leading_size(); nt2_la_int ldb = a2.leading_size(); nt2_la_int nhrs = nt2::width(a2); magma_uplo_t uplo = MagmaLower; magma_ssysv( uplo, n, nhrs, a0.data(), ld, a1.data(), a2.data() , ldb, &that ); return that; } }; //--------------------------------------------Complex-----------------------------------------// /// INTERNAL ONLY - Compute the workspace BOOST_DISPATCH_IMPLEMENT ( sysv_, nt2::tag::magma_<site> , (A0)(S0)(A1)(S1)(A2)(S2)(site) , ((container_< nt2::tag::table_, complex_<double_<A0> >, S0 >)) // A ((container_< nt2::tag::table_, integer_<A1>, S1 >)) // PIV ((container_< nt2::tag::table_, complex_<double_<A2> >, S2 >)) // B ) { typedef nt2_la_int result_type; BOOST_FORCEINLINE result_type operator()(A0& a0, A1& a1, A2& a2) const { result_type that; nt2_la_int n = nt2::width(a0); nt2_la_int ld = a0.leading_size(); nt2_la_int ldb = a2.leading_size(); nt2_la_int nhrs = nt2::width(a2); magma_uplo_t uplo = MagmaLower; magma_zsysv ( uplo, n, nhrs, a0.data(), ld, a1.data(), a2.data() , ldb, &that ); return that; } }; /// INTERNAL ONLY - Compute the workspace BOOST_DISPATCH_IMPLEMENT ( sysv_, nt2::tag::magma_<site> , (A0)(S0)(A1)(S1)(A2)(S2)(site) , ((container_< nt2::tag::table_, complex_<single_<A0> >, S0 >)) // A ((container_< nt2::tag::table_, integer_<A1>, S1 >)) // PIV ((container_< nt2::tag::table_, complex_<single_<A2> >, S2 >)) // B ) { typedef nt2_la_int result_type; BOOST_FORCEINLINE result_type operator()(A0& a0, A1& a1, A2& a2) const { result_type that; nt2_la_int n = nt2::width(a0); nt2_la_int ld = a0.leading_size(); nt2_la_int ldb = a2.leading_size(); nt2_la_int nhrs = nt2::width(a2); magma_uplo_t uplo = MagmaLower; magma_csysv ( uplo, n, nhrs, a0.data(), ld, a1.data(), a2.data() , ldb, &that ); return that; } }; } } #endif #endif <|start_filename|>modules/boost/simd/base/include/boost/simd/arithmetic/functions/divceil.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef BOOST_SIMD_ARITHMETIC_FUNCTIONS_DIVCEIL_HPP_INCLUDED #define BOOST_SIMD_ARITHMETIC_FUNCTIONS_DIVCEIL_HPP_INCLUDED #include <boost/simd/include/functor.hpp> #include <boost/dispatch/include/functor.hpp> namespace boost { namespace simd { namespace tag { /*! @brief divceil generic tag Represents the divceil function in generic contexts. @par Models: Hierarchy **/ struct divceil_ : ext::elementwise_<divceil_> { /// @brief Parent hierarchy typedef ext::elementwise_<divceil_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_divceil_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::divceil_, Site> dispatching_divceil_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::divceil_, Site>(); } template<class... Args> struct impl_divceil_; } /*! Computes the ceil of the division of its parameters. @par semantic: For any given value @c x, @c y of type @c T: @code T r = divceil(x, y); @endcode For floating point values the code is equivalent to: @code T r = ceil(x/y); @endcode for integral types, if y is null, it returns Valmax (resp. Valmin) if x is positive (resp. negative), and 0 if x is null. Take care also that dividing Valmin by -1 for signed integral types has undefined behaviour. @see @funcref{divides}, @funcref{fast_divides}, @funcref{rec}, @funcref{fast_rec}, @funcref{divs}, @funcref{divfloor}, @funcref{divround}, @funcref{divround2even}, @funcref{divfix} @param a0 @param a1 @return a value of the same type as the input. **/ BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::divceil_, divceil, 2) } } #endif <|start_filename|>modules/boost/simd/base/include/boost/simd/predicates/functions/is_not_less.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef BOOST_SIMD_PREDICATES_FUNCTIONS_IS_NOT_LESS_HPP_INCLUDED #define BOOST_SIMD_PREDICATES_FUNCTIONS_IS_NOT_LESS_HPP_INCLUDED #include <boost/simd/include/functor.hpp> #include <boost/dispatch/include/functor.hpp> namespace boost { namespace simd { namespace tag { /*! @brief is_not_less generic tag Represents the is_not_less function in generic contexts. @par Models: Hierarchy **/ struct is_not_less_ : ext::elementwise_<is_not_less_> { /// @brief Parent hierarchy typedef ext::elementwise_<is_not_less_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_is_not_less_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) };} namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::is_not_less_, Site> dispatching_is_not_less_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::is_not_less_, Site>(); } template<class... Args> struct impl_is_not_less_; } /*! TODO Put description here @par Semantic: @code logical<T> r = is_not_less(a0,a1); @endcode is similar to: @code logical<T> r = !(a0 < a1); @endcode @par Note: Due to existence of nan, this is not equivalent to @c is_greater_equal(a0, a1) for floating types @par Alias: @c is_nlt @param a0 @param a1 @return a logical value **/ BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::is_not_less_, is_not_less, 2) BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::is_not_less_, is_nlt, 2) } } #endif <|start_filename|>modules/sdk/functor/include/nt2/include/functor.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2011 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2011 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_INCLUDE_FUNCTOR_HPP_INCLUDED #define NT2_INCLUDE_FUNCTOR_HPP_INCLUDED #include <boost/simd/include/functor.hpp> #include <nt2/sdk/functor/meta/call.hpp> #include <nt2/sdk/functor/preprocessor/call.hpp> #include <nt2/sdk/functor/preprocessor/dispatch.hpp> #include <nt2/sdk/functor/preprocessor/function.hpp> #include <nt2/sdk/functor/site.hpp> #include <nt2/sdk/simd/category.hpp> namespace nt2 { namespace ext { struct adl_helper {}; template<class Tag, class Site> BOOST_FORCEINLINE boost::simd::generic_dispatcher<Tag, Site> dispatching(adl_helper, unknown_<Tag>, unknown_<Site>, ...) { return boost::simd::generic_dispatcher<Tag, Site>(); } } } namespace nt2 { template<class Tag, class Site> struct generic_dispatcher { /* While ICC supports SFINAE with decltype, it seems to cause * infinite compilation times in some cases */ #if defined(BOOST_NO_SFINAE_EXPR) || defined(__INTEL_COMPILER) /*! For compatibility with result_of protocol */ template<class Sig> struct result; // result_of needs to SFINAE in this case template<class This, class... Args> struct result<This(Args...)> : boost::dispatch::meta:: result_of< decltype(dispatching(ext::adl_helper(), Tag(), boost::dispatch::default_site_t<Site>(), boost::dispatch::meta::hierarchy_of_t<Args>()...))(Args...) > { }; template<class... Args> BOOST_FORCEINLINE typename result<generic_dispatcher(Args&&...)>::type operator()(Args&&... args) const { return dispatching(ext::adl_helper(), Tag(), boost::dispatch::default_site_t<Site>(), boost::dispatch::meta::hierarchy_of_t<Args&&>()...)(static_cast<Args&&>(args)...); } #else template<class... Args> BOOST_FORCEINLINE auto operator()(Args&&... args) const BOOST_AUTO_DECLTYPE_BODY_SFINAE( dispatching(ext::adl_helper(), Tag(), boost::dispatch::default_site_t<Site>(), boost::dispatch::meta::hierarchy_of_t<Args&&>()...)(static_cast<Args&&>(args)...) ) #endif }; } #endif <|start_filename|>modules/core/statistics/include/nt2/statistics/functions/lognstat.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_STATISTICS_FUNCTIONS_LOGNSTAT_HPP_INCLUDED #define NT2_STATISTICS_FUNCTIONS_LOGNSTAT_HPP_INCLUDED #include <nt2/include/functor.hpp> namespace nt2 { namespace tag { /// @brief Hierarchy tag for lognstat function struct lognstat_ : ext::elementwise_<lognstat_> { /// @brief Parent hierarchy typedef ext::elementwise_<lognstat_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_lognstat_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::lognstat_, Site> dispatching_lognstat_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::lognstat_, Site>(); } template<class... Args> struct impl_lognstat_; } /*! Computes mean and variance of the lognormal distribution from mean and standard deviation of the associated normal distribution @par Semantic: For every parameters of floating type T0: @code T0 m, v; tie(m, v) = lognstat(mu, sigma); @endcode @see @funcref{lognpdf}, @funcref{logncdf}, @funcref{logninv}, @funcref{lognrnd} @param mu mean of the associated normal distribution @param sigma standard deviation of the associated normal distribution @return A Fusion Sequence containing m and v **/ NT2_FUNCTION_IMPLEMENTATION(tag::lognstat_, lognstat, 2) /*! Computes mean and variance of the lognormal distribution from mean and standard deviation of the associated normal distribution @par Semantic: For every parameters of floating type T0: @code T0 m, v; m = lognstat(mu, sigma, v); @endcode @see @funcref{lognpdf}, @funcref{logncdf}, @funcref{logninv}, @funcref{lognrnd} @param mu mean of the associated normal distribution @param sigma standard deviation of the associated normal distribution @param v L-Value that will receive the variance @return m and computes v **/ NT2_FUNCTION_IMPLEMENTATION_TPL(tag::lognstat_, lognstat,(A0 const&)(A1 const&)(A2&),3) /*! Computes mean and variance of the lognormal distribution from mean and standard deviation of the associated normal distribution @par Semantic: For every parameters of floating type T0: @see @funcref{normpdf}, @funcref{normcdf}, @funcref{norminv}, @funcref{normrnd} @param mu mean of the associated normal distribution @param sigma standard deviation of the associated normal distribution @code T0 m, v; lognstat(mu, sigma, m, v); @endcode @return void, computes m and v @param mu mean of the associated normal distribution @param sigma standard deviation of the associated normal distribution @param m L-Value that will receive the mean @param v L-Value that will receive the variance **/ NT2_FUNCTION_IMPLEMENTATION_TPL(tag::lognstat_, lognstat,(A0 const&)(A1 const&)(A2&)(A3&),4) } #endif <|start_filename|>modules/core/statistics/include/nt2/statistics/functions/unifrnd.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_STATISTICS_FUNCTIONS_UNIFRND_HPP_INCLUDED #define NT2_STATISTICS_FUNCTIONS_UNIFRND_HPP_INCLUDED #include <nt2/include/functor.hpp> namespace nt2 { namespace tag { /*! @brief unifrnd generic tag Represents the unifrnd function in generic contexts. @par Models: Hierarchy **/ struct unifrnd_ : ext::abstract_<unifrnd_> { /// @brief Parent hierarchy typedef ext::abstract_<unifrnd_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_unifrnd_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::unifrnd_, Site> dispatching_unifrnd_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::unifrnd_, Site>(); } template<class... Args> struct impl_unifrnd_; } /*! uniform pseudo random numbers generator @par Semantic: For every table expressions and scalars a and b of type T0 @code auto r = unifrnd(a, b, <sizing parameters>); @endcode generates a table expression of random numbers following the uniform distribution on interval [a, b[ and of size defined by the sizing parameters @code auto r = (b-a)*rand(<sizing parameters>, as_<T0>())+a; @endcode - if as_<T0>() is not present the type of the generated elements is defined as being the type of a, - unifrnd(as_<T0>()) by himself generates one value of type T0, assuming a = 0, b = 1, - unifrnd() assumes T0 is double. @see @funcref{as_}, @funcref{rand} @param a0 points of evaluation @param a1 @param a2 @param a3 @param a4 @param a5 @param a6 @return an expression which eventually will evaluate to the result **/ NT2_FUNCTION_IMPLEMENTATION(nt2::tag::unifrnd_, unifrnd, 7) /// @overload NT2_FUNCTION_IMPLEMENTATION(nt2::tag::unifrnd_, unifrnd, 2) /// @overload NT2_FUNCTION_IMPLEMENTATION(nt2::tag::unifrnd_, unifrnd, 3) /// @overload NT2_FUNCTION_IMPLEMENTATION(nt2::tag::unifrnd_, unifrnd, 4) /// @overload NT2_FUNCTION_IMPLEMENTATION(nt2::tag::unifrnd_, unifrnd, 5) /// @overload NT2_FUNCTION_IMPLEMENTATION(nt2::tag::unifrnd_, unifrnd, 6) } #endif <|start_filename|>modules/arch/shared_memory/include/nt2/core/functions/shared_memory/transform.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2011 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2013 LRI UMR 8623 CNRS/Univ Paris Sud XI // Copyright 2012 - 2013 MetaScale SAS // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_CORE_FUNCTIONS_SHARED_MEMORY_TRANSFORM_HPP_INCLUDED #define NT2_CORE_FUNCTIONS_SHARED_MEMORY_TRANSFORM_HPP_INCLUDED #include <nt2/core/functions/transform.hpp> #include <nt2/sdk/shared_memory.hpp> #include <nt2/sdk/shared_memory/worker/transform.hpp> #include <nt2/sdk/shared_memory/spawner.hpp> #include <nt2/sdk/config/cache.hpp> namespace nt2 { namespace ext { //============================================================================ // Partial Shared Memory elementwise operation // Generates a SPMD loop nest and forward to internal site for evaluation // using the partial transform syntax. //============================================================================ BOOST_DISPATCH_IMPLEMENT ( transform_, (nt2::tag::shared_memory_<BackEnd,Site>) , (Out)(In)(BackEnd)(Site)(Range) , ((ast_<Out, nt2::container::domain>)) ((ast_<In, nt2::container::domain>)) (unspecified_<Range>) ) { typedef void result_type; BOOST_FORCEINLINE result_type operator()(Out& out, In& in, Range range) const { std::size_t grain = config::top_cache_size(2)/sizeof(typename Out::value_type); std::size_t it = range.first; std::size_t sz = range.second; if(!grain) grain = 1u; nt2::worker<tag::transform_,BackEnd,Site,Out,In> w(out,in); nt2::spawner<tag::transform_, BackEnd> s; if(sz > 8*grain) s(w,it,sz,grain); else w(it,sz); } }; } } #endif <|start_filename|>cmake/nt2.boost.cmake<|end_filename|> ################################################################################ # Copyright 2003 - 2011 LASMEA UMR 6602 CNRS/Univ. Clermont II # Copyright 2009 - 2015 LRI UMR 8623 CNRS/Univ Paris Sud XI # Copyright 2012 - 2015 NumScale SAS # # Distributed under the Boost Software License, Version 1.0. # See accompanying file LICENSE.txt or copy at # http://www.boost.org/LICENSE_1_0.txt ################################################################################ ################################################################################ # Find and detect Boost libraries ################################################################################ set(Boost_ADDITIONAL_VERSIONS "1.57") if(NOT Boost_FOUND) find_package( Boost 1.57 QUIET ) if(Boost_VERSION LESS 105700) message(STATUS "[nt2] Boost version ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION} not recent enough, needs 1.57.0") set(Boost_FOUND 0) endif() if(Boost_FOUND) message(STATUS "[nt2] Boost version: ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}") else() message(STATUS "[nt2] Boost NOT found") endif() endif() <|start_filename|>modules/boost/simd/base/include/boost/simd/arithmetic/functions/min.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef BOOST_SIMD_ARITHMETIC_FUNCTIONS_MIN_HPP_INCLUDED #define BOOST_SIMD_ARITHMETIC_FUNCTIONS_MIN_HPP_INCLUDED #include <boost/simd/include/functor.hpp> #include <boost/dispatch/include/functor.hpp> namespace boost { namespace simd { namespace tag { /*! @brief min generic tag Represents the min function in generic contexts. @par Models: Hierarchy **/ struct min_ : ext::elementwise_<min_> { /// @brief Parent hierarchy typedef ext::elementwise_<min_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_min_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::min_, Site> dispatching_min_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::min_, Site>(); } template<class... Args> struct impl_min_; } /*! Computes the smallest of its parameter. @par semantic: For any given value @c x and @c y of type @c T: @code T r = min(x, y); @endcode is similar to: @code T r = if (x < y) ? x : y; @endcode @param a0 @param a1 @return an value of the same type as the input. **/ BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::min_, min, 2) } } #endif <|start_filename|>modules/boost/simd/base/include/boost/simd/arithmetic/functions/correct_fma.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef BOOST_SIMD_ARITHMETIC_FUNCTIONS_CORRECT_FMA_HPP_INCLUDED #define BOOST_SIMD_ARITHMETIC_FUNCTIONS_CORRECT_FMA_HPP_INCLUDED #include <boost/simd/include/functor.hpp> #include <boost/dispatch/include/functor.hpp> namespace boost { namespace simd { namespace tag { /*! @brief correct_fma generic tag Represents the correct_fma function in generic contexts. @par Models: Hierarchy **/ struct correct_fma_ : ext::elementwise_<correct_fma_> { /// @brief Parent hierarchy typedef ext::elementwise_<correct_fma_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_correct_fma_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::correct_fma_, Site> dispatching_correct_fma_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::correct_fma_, Site>(); } template<class... Args> struct impl_correct_fma_; } /*! Computes fused multiply/add of its parameter. @par semantic: For any given value @c a, @c b, @c c of type @c T: @code T r = correct_fma(a, b, c); @endcode is similar to: @code T r = a*b+c; @endcode but with only one rounding @par Note: For integer a*b+c is performed For floating points numbers, always compute the correct fused multiply add, this means the computation of a0*a1+a2 with only one rounding operation. On machines not possessing this hard wired capability this can be very expansive. @c correct_fma is in fact a transitory function that allows to ensure strict fma capabilities, i.e. only one rounding operation and no undue overflow in intermediate computations. If you are using this function for a system with no hard wired fma and are sure that overflow is not a problem you can define BOOST_SIMD_DONT_CARE_CORRECT_FMA_OVERFLOW to get better performances This function is never used internally in boost/simd. See also the @funcref{fma} function. @see @funcref{fma} @param a0 @param a1 @param a2 @return a value of the same type as the input. **/ BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::correct_fma_, correct_fma, 3) } } #endif <|start_filename|>modules/core/linalg/include/nt2/linalg/functions/ggev_wvr.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2013 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_LINALG_FUNCTIONS_GGEV_WVR_HPP_INCLUDED #define NT2_LINALG_FUNCTIONS_GGEV_WVR_HPP_INCLUDED /*! @file @brief Defines and implements ggev_wvr function **/ #include <nt2/include/functor.hpp> namespace nt2 { namespace tag { /// @brief Defines ggev_wvr function tag struct ggev_wvr_ : ext::abstract_<ggev_wvr_> { /// INTERNAL ONLY typedef ext::abstract_<ggev_wvr_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_ggev_wvr_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::ggev_wvr_, Site> dispatching_ggev_wvr_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::ggev_wvr_, Site>(); } template<class... Args> struct impl_ggev_wvr_; } /*! @brief piece of interface to lapack 's/d/c/zggev' routines used by geneig @param @param @return **/ NT2_FUNCTION_IMPLEMENTATION_TPL (tag::ggev_wvr_, ggev_wvr , (A0&)(A1&)(A2&)(A3&)(A4&) , 5 ); NT2_FUNCTION_IMPLEMENTATION_TPL (tag::ggev_wvr_, ggev_wvr , (A0&)(A1&)(A2&)(A3&)(A4&)(A5&) , 6 ); } #endif <|start_filename|>modules/boost/simd/base/include/boost/simd/operator/functions/unary_plus.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2011 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2011 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef BOOST_SIMD_OPERATOR_FUNCTIONS_UNARY_PLUS_HPP_INCLUDED #define BOOST_SIMD_OPERATOR_FUNCTIONS_UNARY_PLUS_HPP_INCLUDED #include <boost/simd/include/functor.hpp> namespace boost { namespace simd { namespace tag { /*! @brief unary_plus generic tag Represents the unary_plus function in generic contexts. @par Models: Hierarchy **/ struct unary_plus_ : ext::elementwise_<unary_plus_> { /// @brief Parent hierarchy typedef ext::elementwise_<unary_plus_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_unary_plus_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::unary_plus_, Site> dispatching_unary_plus_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::unary_plus_, Site>(); } template<class... Args> struct impl_unary_plus_; } /*! return the elementwise unary plus of the parameter Infix notation can be used with operator '+' This is in fact identity. @par Semantic: For every parameter of type T0 @code T0 r = unary_plus(a0); @endcode is similar to: @code T0 r = +a0; @endcode @par Alias: @c identity, @c id @see @funcref{plus}, @funcref{unary_minus} @param a0 @return a value of the same type as the parameter **/ BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::unary_plus_ , unary_plus , 1 ) BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::unary_plus_ , identity , 1 ) BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::unary_plus_ , id , 1 ) } } #include <boost/simd/operator/specific/common.hpp> #endif <|start_filename|>modules/core/linalg/include/nt2/linalg/functions/rot90.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_LINALG_FUNCTIONS_ROT90_HPP_INCLUDED #define NT2_LINALG_FUNCTIONS_ROT90_HPP_INCLUDED #include <nt2/include/functor.hpp> #include <nt2/include/functions/is_odd.hpp> #include <nt2/core/container/dsl/value_type.hpp> #include <nt2/core/container/dsl/size.hpp> #include <nt2/sdk/meta/value_as.hpp> /*! rot90 rotate matrix 90 degrees. rot90(a) is the 90 degree counterclockwise rotation of matrix a. rot90(a,k) is the k*90 degree rotation of a, k = +-1,+-2,... example, a = [1 2 3 b = rot90(a) = [ 3 6 4 5 6 ] 2 5 1 4 ] **/ //============================================================================== // rot90 actual class forward declaration //============================================================================== namespace nt2 { namespace tag { /*! * \brief Define the tag rot90_ of functor rot90 * in namespace nt2::tag for toolbox algebra **/ struct rot90_ : ext::unspecified_<rot90_> { typedef ext::unspecified_<rot90_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_rot90_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; struct rot90_0_ : ext::abstract_<rot90_0_> { typedef ext::abstract_<rot90_0_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_rot90_0_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::rot90_, Site> dispatching_rot90_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::rot90_, Site>(); } template<class... Args> struct impl_rot90_; template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::rot90_0_, Site> dispatching_rot90_0_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::rot90_0_, Site>(); } template<class... Args> struct impl_rot90_0_; } BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::rot90_, rot90, 2) BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::rot90_0_, rot90, 1) } namespace nt2 { namespace ext { template<class Domain, class Expr> struct size_of<tag::rot90_, Domain, 1, Expr> { typedef typename boost::proto::result_of::child_c<Expr&,0>::value_type c0_t; typedef typename c0_t::extent_type result_type; BOOST_FORCEINLINE result_type operator()(Expr& e) const { result_type sizee = boost::proto::child_c<0>(e).extent(); std::swap(sizee[0], sizee[1]); return sizee; } }; template<class Domain, class Expr, int N> struct size_of<tag::rot90_, Domain, N, Expr> { typedef typename boost::proto::result_of::child_c<Expr&,0>::value_type c0_t; typedef typename c0_t::extent_type result_type; BOOST_FORCEINLINE result_type operator()(Expr& e) const { result_type sizee = boost::proto::child_c<0>(e).extent(); int k = boost::proto::child_c<1>(e); if(nt2::is_odd(k)) std::swap(sizee[0], sizee[1]); return sizee; } }; template <class Domain, class Expr, int N> struct value_type<tag::rot90_, Domain, N, Expr> : meta::value_as<Expr,0> {}; } } #endif <|start_filename|>modules/core/reduction/include/nt2/core/functions/expr/globalnormp.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_CORE_FUNCTIONS_EXPR_GLOBALNORMP_HPP_INCLUDED #define NT2_CORE_FUNCTIONS_EXPR_GLOBALNORMP_HPP_INCLUDED #include <nt2/include/functions/globalnormp.hpp> #include <nt2/include/functions/normp.hpp> #include <nt2/include/functions/global.hpp> #include <nt2/core/container/dsl.hpp> #include <boost/dispatch/functor/meta/make_functor.hpp> #include <boost/dispatch/attributes.hpp> namespace nt2 { namespace ext { BOOST_DISPATCH_IMPLEMENT ( globalnormp_, tag::cpu_ , (A0)(A1) , ((ast_<A0, nt2::container::domain>)) (scalar_<arithmetic_<A1> > ) ) { typedef typename meta::call<tag::global_( nt2::functor<tag::normp_> , const A0& , const A1& )>::type result_type; BOOST_FORCEINLINE result_type operator()(A0 const& a0, A1 const& a1) const { return global(nt2::functor<tag::normp_>(), a0, a1); } }; } } #endif <|start_filename|>modules/boost/simd/base/include/boost/simd/ieee/functions/bitfloating.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef BOOST_SIMD_IEEE_FUNCTIONS_BITFLOATING_HPP_INCLUDED #define BOOST_SIMD_IEEE_FUNCTIONS_BITFLOATING_HPP_INCLUDED #include <boost/simd/include/functor.hpp> #include <boost/dispatch/include/functor.hpp> namespace boost { namespace simd { namespace tag { /*! @brief bitfloating generic tag Represents the bitfloating function in generic contexts. @par Models: Hierarchy **/ struct bitfloating_ : ext::elementwise_<bitfloating_> { /// @brief Parent hierarchy typedef ext::elementwise_<bitfloating_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_bitfloating_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::bitfloating_, Site> dispatching_bitfloating_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::bitfloating_, Site>(); } template<class... Args> struct impl_bitfloating_; } /*! Transform a pattern of bits stored in an integer value in a floating point with different formulas according to the integer sign (converse of bitinteger) @par Semantic: @code as_floating<T> r = bitfloating(a0); @endcode is similar to: @code as_floating<T> r = bitwise_cast<as_floating<T> > (a0 >=0 ? a0 : Signmask<T>()-a0); @endcode @param a0 @return a value of the floating type associated to the input **/ BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::bitfloating_, bitfloating, 1) } } #endif <|start_filename|>modules/core/reduction/include/nt2/core/functions/globalmedianad.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // Copyright 2011 - 2012 MetaScale SAS // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_CORE_FUNCTIONS_GLOBALMEDIANAD_HPP_INCLUDED #define NT2_CORE_FUNCTIONS_GLOBALMEDIANAD_HPP_INCLUDED #include <nt2/include/functor.hpp> #include <nt2/include/functions/medianad.hpp> #include <nt2/include/functions/global.hpp> namespace nt2 { namespace tag { /*! @brief Tag for the globalmedianad functor **/ struct globalmedianad_ : ext::abstract_<globalmedianad_> { /// @brief Parent hierarchy typedef ext::abstract_<globalmedianad_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_globalmedianad_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::globalmedianad_, Site> dispatching_globalmedianad_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::globalmedianad_, Site>(); } template<class... Args> struct impl_globalmedianad_; } /*! @brief Median of the absolute deviation of all the elements of an expression Computes the median the absolute deviation to the median of all the elements of a table expression @par Semantic For any table expression : @code T r = globalmedianad(t); @endcode is equivalent to: @code T r = medianad(t(_))(1); @endcode @see @funcref{colon}, @funcref{medianad} @param a0 Table expression to process @return An expression eventually evaluated to the result **/ NT2_FUNCTION_IMPLEMENTATION(nt2::tag::globalmedianad_, globalmedianad, 1) } namespace nt2 { namespace ext { /// INTERNAL ONLY BOOST_DISPATCH_IMPLEMENT ( globalmedianad_, tag::cpu_ , (A0) , (unspecified_<A0>) ) { typedef typename meta::call<tag::global_( nt2::functor<tag::medianad_> , const A0& )>::type result_type; BOOST_FORCEINLINE result_type operator()(A0 const& a0) const { return global(nt2::functor<tag::medianad_>(), a0); } }; } } #endif <|start_filename|>modules/binding/magma/include/nt2/sdk/magma/magma.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2011 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2011 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_SDK_MAGMA_MAGMA_HPP_INCLUDED #define NT2_SDK_MAGMA_MAGMA_HPP_INCLUDED #include <boost/dispatch/functor/forward.hpp> #include <nt2/sdk/cuda/cuda.hpp> namespace nt2 { namespace tag { template<class Site> struct magma_ : cuda_<Site> { typedef cuda_<Site> parent; }; } } #ifdef NT2_USE_MAGMA BOOST_DISPATCH_COMBINE_SITE( nt2::tag::magma_<nt2::tag::cuda_<tag::cpu_>> ) #endif #endif <|start_filename|>modules/core/polynom/include/nt2/polynom/functions/polyfit.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_POLYNOM_FUNCTIONS_POLYFIT_HPP_INCLUDED #define NT2_POLYNOM_FUNCTIONS_POLYFIT_HPP_INCLUDED #include <nt2/include/functor.hpp> #include <nt2/include/functions/numel.hpp> #include <nt2/sdk/meta/size_as.hpp> #include <nt2/sdk/meta/value_as.hpp> #include <nt2/core/container/dsl/size.hpp> #include <nt2/sdk/meta/tieable_hierarchy.hpp> #include <nt2/core/container/dsl/value_type.hpp> namespace nt2 { namespace tag { /*! @brief polyfit generic tag Represents the polyfit function in generic contexts. @par Models: Hierarchy **/ struct polyfit_ : ext::tieable_<polyfit_> { /// @brief Parent hierarchy typedef ext::tieable_<polyfit_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_polyfit_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::polyfit_, Site> dispatching_polyfit_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::polyfit_, Site>(); } template<class... Args> struct impl_polyfit_; } /*! Finds the coefficients of a polynomial p(x) of degree n that of degree n that best fits the data, p(x(i)) to y(i), in the least squares sense the data y. p is a row expression of length n+1 containing the polynomial coefficients in descending powers: @code p(1)*x^n + p(2)*x^(n-1) +...+ p(n)*x + p(n+1). @endcode n default to numel(x)-1, to produce interpolation. @par Semantic: @code auto p = polyfit(x,y{,n}); @endcode or @code tie(p,r,df,normr) = polyfit(x,y{,n}) @endcode or @code tie(p,r,df,normr,mu) = polyfit(x,y{,n}) @endcode returns the polynomial coefficients p and in the second and third options three other results for use with polyval to obtain error estimates for predictions. The triangular factor r from a qr decomposition of the vandermonde matrix of x, the degrees of freedom df, and the norm of the residuals normr. If the data y are normal random, an estimate of the covariance matrix of p is (rinv*rinv')*normr^2/df, where rinv is the inverse of r. With the third option, finds the coefficients of a polynomial in xhat = (x-mu(1))/mu(2) where mu(1) = mean(x) and mu(2) = stdev(x). This centering and scaling transformation improves the numerical properties of both the polynomial and the fitting algorithm. @see @funcref{mean}, @funcref{stdev} @param a0 @param a1 @param a2 if not present default to the common numel of a0 and a1, minus one @return the output(s) depends of the call form **/ NT2_FUNCTION_IMPLEMENTATION(tag::polyfit_, polyfit, 3) /// @overload NT2_FUNCTION_IMPLEMENTATION(tag::polyfit_, polyfit, 2) } namespace nt2 { namespace ext { /// INTERNAL ONLY template<class Domain, int N, class Expr> struct size_of<tag::polyfit_,Domain,N,Expr> { typedef _2D result_type; BOOST_FORCEINLINE result_type operator()(Expr& e) const { _2D sizee; sizee[0] = 1; sizee[1] = size_t(boost::proto::child_c<2>(e))+1; return sizee; } }; /// INTERNAL ONLY template<class Domain, class Expr> struct size_of<tag::polyfit_,Domain,2,Expr> { typedef _2D result_type; BOOST_FORCEINLINE result_type operator()(Expr& e) const { _2D sizee; sizee[0] = 1; sizee[1] = nt2::numel(boost::proto::child_c<0>(e))+1u; return sizee; } }; /// INTERNAL ONLY template<class Domain, int N, class Expr> struct value_type<tag::polyfit_,Domain,N,Expr> : meta::value_as<Expr,0> {}; } } #endif <|start_filename|>modules/core/polynomials/include/nt2/polynomials/functions/polevl.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_POLYNOMIALS_FUNCTIONS_POLEVL_HPP_INCLUDED #define NT2_POLYNOMIALS_FUNCTIONS_POLEVL_HPP_INCLUDED #include <nt2/include/functor.hpp> // polevl(x, p) // This compute the valuation of a polynomial p of degree N at x // The polynomial is supposed to be given by an array of N+1 elements // in decreasing degrees order namespace nt2 { namespace tag { struct polevl_ : ext::elementwise_<polevl_> { typedef ext::elementwise_<polevl_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_polevl_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::polevl_, Site> dispatching_polevl_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::polevl_, Site>(); } template<class... Args> struct impl_polevl_; } NT2_FUNCTION_IMPLEMENTATION(tag::polevl_, polevl, 2) } #endif // modified by jt the 25/12/2010 <|start_filename|>modules/boost/simd/base/include/boost/simd/arithmetic/functions/logical_xor.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef BOOST_SIMD_ARITHMETIC_FUNCTIONS_LOGICAL_XOR_HPP_INCLUDED #define BOOST_SIMD_ARITHMETIC_FUNCTIONS_LOGICAL_XOR_HPP_INCLUDED #include <boost/simd/include/functor.hpp> #include <boost/dispatch/include/functor.hpp> namespace boost { namespace simd { namespace tag { /*! @brief logical_xor generic tag Represents the logical_xor function in generic contexts. @par Models: Hierarchy **/ struct logical_xor_ : ext::elementwise_<logical_xor_> { /// @brief Parent hierarchy typedef ext::elementwise_<logical_xor_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_logical_xor_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::logical_xor_, Site> dispatching_logical_xor_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::logical_xor_, Site>(); } template<class... Args> struct impl_logical_xor_; } /*! Computes the logical xor of its parameter. @par semantic: For any given value @c x and @c y of type @c T: @code as_logical<T> r = logical_xor(x, y); @endcode is similar to: @code as_logical<T> r = !x != !y; @endcode @param a0 @param a1 @return a logical value of the logical type associated to the input. **/ BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::logical_xor_, logical_xor, 2) } } #endif <|start_filename|>modules/core/combinatorial/include/nt2/combinatorial/functions/perms.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_COMBINATORIAL_FUNCTIONS_PERMS_HPP_INCLUDED #define NT2_COMBINATORIAL_FUNCTIONS_PERMS_HPP_INCLUDED #include <nt2/include/functor.hpp> #include <nt2/include/functions/prod.hpp> #include <nt2/include/functions/min.hpp> #include <nt2/sdk/meta/size_as.hpp> #include <nt2/sdk/meta/value_as.hpp> #include <nt2/core/container/dsl/size.hpp> #include <nt2/core/container/dsl/value_type.hpp> namespace nt2 { namespace tag { /*! @brief perms generic tag Represents the perms function in generic contexts. @par Models: Hierarchy **/ struct perms_ : ext::unspecified_<perms_> { /// @brief Parent hierarchy typedef ext::unspecified_<perms_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_perms_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::perms_, Site> dispatching_perms_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::perms_, Site>(); } template<class... Args> struct impl_perms_; } /*! Computes permutations @par Semantic: For every table expression @code auto r = perms(v, k); @endcode returns the first k permutations of the v elements. k defaults to !numel(v) Take care in this last case that numel(v) <= 10 to avoid exhausting memory @param a0 @param a1 @see @funcref{permsn}, @funcref{numel}, @funcref{combs} @return an expression which eventually will evaluate to the result **/ BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::perms_, perms, 2) /// @overload BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::perms_, perms, 1) } namespace nt2 { namespace ext { /// INTERNAL ONLY template<class Domain, class Expr, int N> struct size_of<tag::perms_, Domain, N, Expr> { typedef _2D result_type; BOOST_FORCEINLINE result_type operator()(Expr& e) const { result_type sizee; sizee[0] = nt2::numel(boost::proto::child_c<0>(e)); std::size_t l = 1; for(std::size_t i=2;i<=sizee[0];++i) l *= i; sizee[1] = nt2::min(boost::proto::child_c<1>(e), l); return sizee; } }; /// INTERNAL ONLY template <class Domain, class Expr, int N> struct value_type < tag::perms_, Domain,N,Expr> : meta::value_as<Expr,0> { }; } } #endif <|start_filename|>modules/core/linalg/include/nt2/linalg/functions/mnorm.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_LINALG_FUNCTIONS_MNORM_HPP_INCLUDED #define NT2_LINALG_FUNCTIONS_MNORM_HPP_INCLUDED #include <nt2/include/functor.hpp> #include <nt2/sdk/meta/as_real.hpp> #include <boost/mpl/int.hpp> #include <nt2/include/constants/mone.hpp> #include <nt2/include/constants/zero.hpp> #include <nt2/tags.hpp> namespace nt2 { namespace tag { /*! @brief globalnorm generic tag Represents the mnorm function in generic contexts. @par Models: Hierarchy **/ struct mnorm_ : ext::abstract_<mnorm_> { /// INTERNAL ONLY typedef ext::abstract_<mnorm_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_mnorm_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::mnorm_, Site> dispatching_mnorm_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::mnorm_, Site>(); } template<class... Args> struct impl_mnorm_; } /*! @brief Matricial norm Computes the matricial norms of a matrix expression with static or dynamic choice from by the optional second parameter that can be 1, nt2::tag::one_ 2, nt2::two_, , nt2::inf_ or , nt2::fro_ or the template parameter that can be 1, nt2::tag::one_ 2, nt2::tag::two_, , nt2::tag::inf_ or , nt2::tag::fro_ Call protocols to mnorm are summarized in the following table. We advise to use static calls whenever possible as it prevents cascaded run-time if clauses and goes directly to the right call at execution. @code |-------------------|-------------------|------------------------------|-------------------| | mnorm(a0, p) | |-------------------|-------------------|------------------------------|-------------------| | static p | dynamic p | formula (pseudo-code) | equivalent to | |-------------------|-------------------|------------------------------|-------------------| | nt2::one_ | 1 | max(sum(abs(x))) | mnorm1(x) | | nt2::two_ | 2 | max(svd(x)) | mnorm2(x) | | nt2::inf_ | nt2::Inf<T>() | max(sum(abs(ctrans(x)))) | mnorminf(x) | | nt2::fro_ | -1 | sqrt(sum(diag(ctrans(x)*x))) | mnormfro(x) | |-------------------|-------------------|------------------------------|-------------------| | mnorm<p>(a0) | |-------------------|-------------------|------------------------------|-------------------| | static p | | matrix | | |-------------------|-------------------|------------------------------|-------------------| | nt2::tag::one_ | - | max(sum(abs(x))) | mnorm1(x) | | nt2::tag::two_ | - | max(svd(x)) | mnorm2(x) | | nt2::tag::inf_ | - | max(sum(abs(ctrans(x)))) | mnorminf(x) | | nt2::tag::fro_ | - | sqrt(sum(diag(ctrans(x)*x))) | mnormfro(x) | |-------------------|-------------------|------------------------------|-------------------| @endcode @par Semantic: 1, 2 and inf can be given dynamically or statically as template parameter ie: For any expression @c a0 of type @c A0, the following call: @code as_real<A0::value_type>::type x = mnorm(a0); @endcode is equivalent to: @code as_real<A0::value_type>::type x = svd(a0)(1); @endcode For any expression @c a0 of type @c A0 and any value x in {one_, two_, inf_, fro_} following call: @code as_real<A0::value_type>::type r = mnorm(a0,nt2::x); @endcode or @code as_real<A0::value_type>::type r = mnorm<nt2::tag::x>(a0); @endcode is equivalent to: @code as_real<A0::value_type>::type r = mnormx(a0); @endcode @param a0 Expression to compute the norm of @param a1 Type of norm to compute **/ BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::mnorm_, mnorm, 1) /// @overload BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::mnorm_, mnorm, 2) /// @overload BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::mnorm_, mnorm2, 1) /// @overload template < class T, class A> BOOST_FORCEINLINE typename meta::as_real<typename A::value_type>::type mnorm(const A& a) { return mnorm(a, nt2::meta::as_<T>()); } /// @overload template < int Value, typename A> BOOST_FORCEINLINE typename meta::as_real<typename A::value_type>::type mnorm(const A& a) { return mnorm(a, boost::mpl::int_<Value>()); } } #endif <|start_filename|>modules/binding/magma/include/nt2/linalg/functions/magma/geqp3.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2013 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_LINALG_FUNCTIONS_MAGMA_GEQP3_HPP_INCLUDED #define NT2_LINALG_FUNCTIONS_MAGMA_GEQP3_HPP_INCLUDED #if defined(NT2_USE_MAGMA) #include <nt2/linalg/functions/geqp3.hpp> #include <nt2/include/functions/xerbla.hpp> #include <nt2/sdk/magma/magma.hpp> #include <nt2/dsl/functions/terminal.hpp> #include <nt2/core/container/table/kind.hpp> #include <nt2/linalg/details/utility/f77_wrapper.hpp> #include <nt2/linalg/details/utility/options.hpp> #include <nt2/linalg/details/utility/workspace.hpp> #include <nt2/table.hpp> #include <nt2/include/functions/of_size.hpp> #include <nt2/include/functions/height.hpp> #include <nt2/include/functions/width.hpp> #include <nt2/include/functions/zeros.hpp> #include <magma.h> namespace nt2 { namespace ext { /// INTERNAL ONLY - Compute the workspace BOOST_DISPATCH_IMPLEMENT ( geqp3_, nt2::tag::magma_<site> , (A0)(S0)(A1)(S1)(A2)(S2)(site) , ((container_<nt2::tag::table_, double_<A0>, S0 >)) ((container_<nt2::tag::table_, integer_<A1>, S1 >)) ((container_<nt2::tag::table_, double_<A2>, S2 >)) ) { typedef nt2_la_int result_type; BOOST_FORCEINLINE result_type operator()(A0& a0, A1& a1, A2& a2) const { result_type that; details::workspace<typename A0::value_type> w; nt2_la_int m = nt2::height(a0); nt2_la_int n = nt2::width(a0); nt2_la_int ld = a0.leading_size(); nt2_la_int lwork_query = -1; magma_dgeqp3 ( m, n, 0, ld, 0, 0, w.main() , lwork_query, &that ); w.prepare_main(); nt2::geqp3(a0,a1,a2,w); return that; } }; /// INTERNAL ONLY - Workspace is ready BOOST_DISPATCH_IMPLEMENT ( geqp3_, nt2::tag::magma_<site> , (A0)(S0)(A1)(S1)(A2)(S2)(A3)(site) , ((container_<nt2::tag::table_, double_<A0>, S0 >)) ((container_<nt2::tag::table_, integer_<A1>, S1 >)) ((container_<nt2::tag::table_, double_<A2>, S2 >)) (unspecified_<A3>) ) { typedef nt2_la_int result_type; BOOST_FORCEINLINE result_type operator()(A0& a0, A1& a1,A2& a2, A3& a3) const { result_type that; nt2_la_int m = nt2::height(a0); nt2_la_int n = nt2::width(a0); nt2_la_int ld = a0.leading_size(); nt2_la_int wn = a3.main_size(); a2.resize( nt2::of_size(std::min(n, m), 1) ); magma_dgeqp3 (m, n, a0.data(), ld, a1.data(), a2.data(), a3.main() , wn, &that ); return that; } }; /// INTERNAL ONLY - Compute the workspace BOOST_DISPATCH_IMPLEMENT ( geqp3_, nt2::tag::magma_<site> , (A0)(S0)(A1)(S1)(A2)(S2)(site) , ((container_<nt2::tag::table_, single_<A0>, S0 >)) ((container_<nt2::tag::table_, integer_<A1>, S1 >)) ((container_<nt2::tag::table_, single_<A2>, S2 >)) ) { typedef nt2_la_int result_type; BOOST_FORCEINLINE result_type operator()(A0& a0, A1& a1, A2& a2) const { result_type that; details::workspace<typename A0::value_type> w; nt2_la_int m = nt2::height(a0); nt2_la_int n = nt2::width(a0); nt2_la_int ld = a0.leading_size(); nt2_la_int lwork_query = -1; magma_sgeqp3 (m, n, 0, ld, 0, 0, w.main() , lwork_query, &that ); w.prepare_main(); nt2::geqp3(a0,a1,a2,w); return that; } }; /// INTERNAL ONLY - Workspace is ready BOOST_DISPATCH_IMPLEMENT ( geqp3_, nt2::tag::magma_<site> , (A0)(S0)(A1)(S1)(A2)(S2)(A3)(site) , ((container_<nt2::tag::table_, single_<A0>, S0 >)) ((container_<nt2::tag::table_, integer_<A1>, S1 >)) ((container_<nt2::tag::table_, single_<A2>, S2 >)) (unspecified_<A3>) ) { typedef nt2_la_int result_type; BOOST_FORCEINLINE result_type operator()(A0& a0, A1& a1,A2& a2, A3& a3) const { result_type that; nt2_la_int m = nt2::height(a0); nt2_la_int n = nt2::width(a0); nt2_la_int ld = a0.leading_size(); nt2_la_int wn = a3.main_size(); a2.resize( nt2::of_size(std::min(n, m), 1) ); magma_sgeqp3 (m, n, a0.data(), ld, a1.data(), a2.data(), a3.main() , wn, &that ); return that; } }; //------------------------------------------Complex----------------------------------------// /// INTERNAL ONLY - Compute the workspace BOOST_DISPATCH_IMPLEMENT ( geqp3_, nt2::tag::magma_<site> , (A0)(S0)(A1)(S1)(A2)(S2)(site) , ((container_< nt2::tag::table_, complex_<double_<A0> >, S0 >)) ((container_< nt2::tag::table_, integer_<A1>, S1 >)) ((container_< nt2::tag::table_, complex_<double_<A2> >, S2 >)) ) { typedef nt2_la_int result_type; BOOST_FORCEINLINE result_type operator()(A0& a0, A1& a1, A2& a2) const { result_type that; details::workspace<typename A0::value_type> w; nt2_la_int m = nt2::height(a0); nt2_la_int n = nt2::width(a0); nt2_la_int ld = a0.leading_size(); nt2_la_int lwork_query = -1; magma_zgeqp3(m, n, 0, ld, 0, 0, (cuDoubleComplex*)w.main() , lwork_query, 0, &that ); w.prepare_main(); nt2::geqp3(a0,a1,a2,w); return that; } }; /// INTERNAL ONLY - Workspace is ready BOOST_DISPATCH_IMPLEMENT ( geqp3_, nt2::tag::magma_<site> , (A0)(S0)(A1)(S1)(A2)(S2)(A3)(site) , ((container_< nt2::tag::table_, complex_<double_<A0> >, S0 >)) ((container_< nt2::tag::table_, integer_<A1>, S1 >)) ((container_< nt2::tag::table_, complex_<double_<A2> >, S2 >)) (unspecified_<A3>) ) { typedef nt2_la_int result_type; BOOST_FORCEINLINE result_type operator()(A0& a0, A1& a1,A2& a2, A3& a3) const { result_type that; nt2_la_int m = nt2::height(a0); nt2_la_int n = nt2::width(a0); nt2_la_int ld = a0.leading_size(); nt2_la_int wn = a3.main_size(); nt2::container::table<double> rwork(nt2::of_size(2*n,1)); a2.resize( nt2::of_size(std::min(n, m), 1) ); magma_zgeqp3(m, n, (cuDoubleComplex*)a0.data(), ld, a1.data(), (cuDoubleComplex*)a2.data() ,(cuDoubleComplex*) a3.main(), wn, rwork.data(), &that ); return that; } }; /// INTERNAL ONLY - Compute the workspace BOOST_DISPATCH_IMPLEMENT ( geqp3_, nt2::tag::magma_<site> , (A0)(S0)(A1)(S1)(A2)(S2)(site) , ((container_< nt2::tag::table_, complex_<single_<A0> >, S0 >)) ((container_< nt2::tag::table_, integer_<A1>, S1 >)) ((container_< nt2::tag::table_, complex_<single_<A2> >, S2 >)) ) { typedef nt2_la_int result_type; BOOST_FORCEINLINE result_type operator()(A0& a0, A1& a1, A2& a2) const { result_type that; details::workspace<typename A0::value_type> w; nt2_la_int m = nt2::height(a0); nt2_la_int n = nt2::width(a0); nt2_la_int ld = a0.leading_size(); nt2_la_int lwork_query = -1; magma_cgeqp3(m, n, 0, ld, 0, 0, (cuFloatComplex*)w.main() , lwork_query, 0, &that ); w.prepare_main(); nt2::geqp3(a0,a1,a2,w); return that; } }; /// INTERNAL ONLY - Workspace is ready BOOST_DISPATCH_IMPLEMENT ( geqp3_, nt2::tag::magma_<site> , (A0)(S0)(A1)(S1)(A2)(S2)(A3)(site) , ((container_< nt2::tag::table_, complex_<single_<A0> >, S0 >)) ((container_< nt2::tag::table_, integer_<A1>, S1 >)) ((container_< nt2::tag::table_, complex_<single_<A2> >, S2 >)) (unspecified_<A3>) ) { typedef nt2_la_int result_type; BOOST_FORCEINLINE result_type operator()(A0& a0, A1& a1,A2& a2, A3& a3) const { result_type that; nt2_la_int m = nt2::height(a0); nt2_la_int n = nt2::width(a0); nt2_la_int ld = a0.leading_size(); nt2_la_int wn = a3.main_size(); nt2::container::table<float> rwork(nt2::of_size(2*n,1)); a2.resize( nt2::of_size(std::min(n, m), 1) ); magma_cgeqp3(m, n, (cuFloatComplex*)a0.data(), ld, a1.data(), (cuFloatComplex*)a2.data() , (cuFloatComplex*)a3.main() , wn, rwork.data(), &that ); return that; } }; } } #endif #endif <|start_filename|>modules/core/base/include/nt2/predicates/functions/isvectoralong.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // Copyright 2011 - 2012 MetaScale SAS // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_PREDICATES_FUNCTIONS_ISVECTORALONG_HPP_INCLUDED #define NT2_PREDICATES_FUNCTIONS_ISVECTORALONG_HPP_INCLUDED /*! @file @brief Defines the isvectoralong function **/ #include <nt2/include/functor.hpp> namespace nt2 { namespace tag { /*! @brief Tag for isvectoralong functor **/ struct isvectoralong_ : ext::abstract_<isvectoralong_> { typedef ext::abstract_<isvectoralong_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_isvectoralong_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::isvectoralong_, Site> dispatching_isvectoralong_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::isvectoralong_, Site>(); } template<class... Args> struct impl_isvectoralong_; } // TODO merge as isvector(x,d) ? /*! @brief Is an expression vector shaped along a dimension ? Checks if an expression has a size of the shape [1 1 .. N... 1 1] where the only non-singleton dimension is the kth dimension. @param a0 Expression to inspect @param a1 Dimension along which to check for vector shape @return Boolean value evaluatign to the result of the test **/ NT2_FUNCTION_IMPLEMENTATION(nt2::tag::isvectoralong_, isvectoralong, 2) } #endif <|start_filename|>modules/core/restructuring/include/nt2/core/functions/ctranspose.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_CORE_FUNCTIONS_CTRANSPOSE_HPP_INCLUDED #define NT2_CORE_FUNCTIONS_CTRANSPOSE_HPP_INCLUDED #include <nt2/include/functor.hpp> #include <nt2/core/container/dsl/size.hpp> namespace nt2 { namespace tag { /*! @brief ctranspose generic tag Represents the ctranspose function in generic contexts. @par Models: Hierarchy **/ struct ctranspose_ : ext::elementwise_<ctranspose_> { /// @brief Parent hierarchy typedef ext::elementwise_<ctranspose_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_ctranspose_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::ctranspose_, Site> dispatching_ctranspose_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::ctranspose_, Site>(); } template<class... Args> struct impl_ctranspose_; } /*! Transpose and conjugate a matrix expression. @par Semantic: For every matricial expression @code auto r = ctranspose(a0); @endcode produces r such that for every valid couple of indices i, j: @code r(j, i) = conj(a0(i, j)) @endcode @see @funcref{transpose} @par alias: @c ctrans, @c ct @param a0 @return an expression which eventually will evaluate to the result **/ NT2_FUNCTION_IMPLEMENTATION(nt2::tag::ctranspose_, ctranspose, 1) NT2_FUNCTION_IMPLEMENTATION(nt2::tag::ctranspose_, ctrans, 1) NT2_FUNCTION_IMPLEMENTATION(nt2::tag::ctranspose_, ct , 1) } namespace nt2 { namespace ext { /// INTERNAL ONLY template<class Domain, int N, class Expr> struct size_of<tag::ctranspose_,Domain,N,Expr> { typedef _2D result_type; BOOST_FORCEINLINE result_type operator()(Expr& e) const { //BOOST_ASSERT(ndims(boost::proto::child_c<0>(e)) <= 2); return _2D( boost::fusion::at_c<1>(boost::proto::child_c<0>(e).extent()) , boost::fusion::at_c<0>(boost::proto::child_c<0>(e).extent()) ); } }; } } #endif <|start_filename|>modules/boost/simd/base/include/boost/simd/boolean/functions/if_allbits_else.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef BOOST_SIMD_BOOLEAN_FUNCTIONS_IF_ALLBITS_ELSE_HPP_INCLUDED #define BOOST_SIMD_BOOLEAN_FUNCTIONS_IF_ALLBITS_ELSE_HPP_INCLUDED #include <boost/simd/include/functor.hpp> #include <boost/dispatch/include/functor.hpp> namespace boost { namespace simd { namespace tag { /*! @brief if_allbits_else generic tag Represents the if_allbits_else function in generic contexts. @par Models: Hierarchy **/ struct if_allbits_else_ : ext::elementwise_<if_allbits_else_> { /// @brief Parent hierarchy typedef ext::elementwise_<if_allbits_else_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_if_allbits_else_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::if_allbits_else_, Site> dispatching_if_allbits_else_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::if_allbits_else_, Site>(); } template<class... Args> struct impl_if_allbits_else_; } /*! If a0 is true returns allbits else returns a1 @par Semantic: For every parameters of types respectively T0, T1: @code T1 r = if_allbits_else(a0,a1); @endcode is similar to: @code T r = a0 ? Allbits : a1; @endcode @par Alias: @c if_allbits_else, @c ifallbitselse, @c ifnot_else_allbits, @c ifnotelseallbits, @c if_nan_else, @c ifnanelse, @c ifnot_else_nan, @c ifnotelsenan @see @funcref{genmask} @param a0 @param a1 @return a value of the same type as the second parameter **/ BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::if_allbits_else_, if_allbits_else, 2) BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::if_allbits_else_, ifallbitselse, 2) BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::if_allbits_else_, ifnot_else_allbits, 2) BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::if_allbits_else_, ifnotelseallbits, 2) BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::if_allbits_else_, if_nan_else, 2) BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::if_allbits_else_, ifnanelse, 2) BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::if_allbits_else_, ifnot_else_nan, 2) BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::if_allbits_else_, ifnotelsenan, 2) } } #endif <|start_filename|>modules/boost/simd/base/include/boost/simd/boolean/functions/logical_andnot.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2011 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2011 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef BOOST_SIMD_BOOLEAN_FUNCTIONS_LOGICAL_ANDNOT_HPP_INCLUDED #define BOOST_SIMD_BOOLEAN_FUNCTIONS_LOGICAL_ANDNOT_HPP_INCLUDED #include <boost/simd/include/functor.hpp> #include <boost/dispatch/include/functor.hpp> #include <boost/proto/tags.hpp> namespace boost { namespace simd { namespace tag { /*! @brief logical_andnot generic tag Represents the logical_andnot function in generic contexts. @par Models: Hierarchy **/ struct logical_andnot_ : ext::elementwise_<logical_andnot_> { /// @brief Parent hierarchy typedef ext::elementwise_<logical_andnot_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_logical_andnot_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::logical_andnot_, Site> dispatching_logical_andnot_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::logical_andnot_, Site>(); } template<class... Args> struct impl_logical_andnot_; } /*! return the logical and of the first parameter and of the negation the second parameter the result type is logical type associated to the first parameter @par Semantic: For every parameters of types respectively T0, T1: @code as_logical<T0> r = logical_andnot(a0,a1); @endcode is similar to: @code as_logical<T0> r = a0 && !a1; @endcode @par Alias: @c l_andnot @param a0 @param a1 @return a value of the logical type asssociated to the first parameter **/ BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::logical_andnot_ , logical_andnot , 2) BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::logical_andnot_ , l_andnot , 2) } } #include <boost/simd/operator/specific/common.hpp> #endif <|start_filename|>modules/core/reduction/include/nt2/core/functions/globalmeanad.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // Copyright 2011 - 2012 MetaScale SAS // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_CORE_FUNCTIONS_GLOBALMEANAD_HPP_INCLUDED #define NT2_CORE_FUNCTIONS_GLOBALMEANAD_HPP_INCLUDED #include <nt2/include/functor.hpp> #include <nt2/include/functions/meanad.hpp> #include <nt2/include/functions/global.hpp> namespace nt2 { namespace tag { /*! @brief Tag for the globalmeanad functor **/ struct globalmeanad_ : ext::abstract_<globalmeanad_> { /// @brief Parent hierarchy typedef ext::abstract_<globalmeanad_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_globalmeanad_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::globalmeanad_, Site> dispatching_globalmeanad_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::globalmeanad_, Site>(); } template<class... Args> struct impl_globalmeanad_; } /*! @brief Mean of the absolute deviation of all the elements of an expression Computes the absolute deviation of all the elements of a table expression @par Semantic For any table expression : @code T r = globalmeanad(t); @endcode is equivalent to: @code T r = meanad(t(_))(1); @endcode @see @funcref{colon}, @funcref{meanad} @param a0 Table to process @return An expression eventually evaluated to the result **/ NT2_FUNCTION_IMPLEMENTATION(nt2::tag::globalmeanad_, globalmeanad, 1) } namespace nt2 { namespace ext { /// INTERNAL ONLY BOOST_DISPATCH_IMPLEMENT ( globalmeanad_, tag::cpu_ , (A0) , (unspecified_<A0>) ) { typedef typename meta::call<tag::global_( nt2::functor<tag::meanad_> , const A0& )>::type result_type; BOOST_FORCEINLINE result_type operator()(A0 const& a0) const { return global(nt2::functor<tag::meanad_>(), a0); } }; } } #endif <|start_filename|>modules/boost/simd/base/include/boost/simd/reduction/functions/prod.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef BOOST_SIMD_REDUCTION_FUNCTIONS_PROD_HPP_INCLUDED #define BOOST_SIMD_REDUCTION_FUNCTIONS_PROD_HPP_INCLUDED #include <boost/simd/include/functor.hpp> #include <boost/dispatch/include/functor.hpp> #include <boost/simd/operator/functions/multiplies.hpp> #include <boost/simd/constant/constants/one.hpp> namespace boost { namespace simd { namespace tag { /*! @brief prod generic tag Represents the prod function in generic contexts. @par Models: Hierarchy **/ struct prod_ : ext::reduction_<prod_, tag::multiplies_, tag::One> { /// @brief Parent hierarchy typedef ext::reduction_<prod_, tag::multiplies_, tag::One> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_prod_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::prod_, Site> dispatching_prod_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::prod_, Site>(); } template<class... Args> struct impl_prod_; } /*! Returns the product of the elements of the SIMD vector @par Semantic: For every parameter of type T0 @code scalar<T0> r = prod(a0); @endcode is similar to: @code scalar<T0> r = One; for(result_type i = 0; i != cardinal_of<T0>; ++i) r *= a0[i]; @endcode @param a0 @return a value of the scalar type associated to the parameter **/ BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::prod_, prod, 1) BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::prod_, prod, 2) } } #endif <|start_filename|>modules/core/trigonometric/include/nt2/trigonometric/functions/atan2d.hpp<|end_filename|> //============================================================================== // Copyright 2015 <NAME> // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_TRIGONOMETRIC_FUNCTIONS_ATAN2D_HPP_INCLUDED #define NT2_TRIGONOMETRIC_FUNCTIONS_ATAN2D_HPP_INCLUDED #include <nt2/include/functor.hpp> namespace nt2 { namespace tag { /*! @brief atan2d generic tag Represents the atan2d function in generic contexts. @par Models: Hierarchy **/ struct atan2d_ : ext::elementwise_<atan2d_> { /// @brief Parent hierarchy typedef ext::elementwise_<atan2d_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_atan2d_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::atan2d_, Site> dispatching_atan2d_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::atan2d_, Site>(); } template<class... Args> struct impl_atan2d_; } /*! atan2d function : atan2 in degrees. @par Semantic: For every parameters of floating type T0: @code T0 r = atan2d(x, y); @endcode is similar but not fully equivalent to: @code T0 r = atand(y/x);; @endcode as it is quadrant aware. For any real arguments @c x and @c y not both equal to zero, <tt>atan2d(x, y)</tt> is the angle in degrees between the positive x-axis of a plane and the point given by the coordinates <tt>(y, x)</tt>. It is also the angle in \f$[-180,180[\f$ such that \f$x/\sqrt{x^2+y^2}\f$ and \f$y/\sqrt{x^2+y^2}\f$ are respectively the sine and the cosine. @see @funcref{nbd_atan2}, @funcref{atand} @param a0 @param a1 @return a value of the same type as the parameters **/ NT2_FUNCTION_IMPLEMENTATION(tag::atan2d_, atan2d, 2) } #endif <|start_filename|>modules/boost/simd/sdk/include/boost/simd/memory/functions/aligned_load.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // Copyright 2011 - 2014 MetaScale SAS // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef BOOST_SIMD_MEMORY_FUNCTIONS_ALIGNED_LOAD_HPP_INCLUDED #define BOOST_SIMD_MEMORY_FUNCTIONS_ALIGNED_LOAD_HPP_INCLUDED #include <boost/simd/include/functor.hpp> #include <boost/dispatch/include/functor.hpp> #include <boost/dispatch/meta/as.hpp> namespace boost { namespace simd { namespace tag { /*! @brief aligned_load generic tag Represents the aligned_load function in generic contexts. @par Models: Hierarchy **/ struct aligned_load_ : ext::abstract_<aligned_load_> { /// @brief Parent hierarchy typedef ext::abstract_<aligned_load_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_aligned_load_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::aligned_load_, Site> dispatching_aligned_load_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::aligned_load_, Site>(); } template<class... Args> struct impl_aligned_load_; } /*! @brief Load data from memory Retrieves data from a pointer and an offset using the most efficient operations and register types for the chosen destination type. @pre If @c Type is a SIMD register type, the value of @c ptr + @c offset - @c Misalignment must satisfy SIMD alignment constraint. @par Semantic Depending on the type of its arguments, aligned_load exhibits different semantics. For any type @c Type, @c ptr of type @c Pointer, @c offset of type @c Offset, @c old of type @c Old and @c mask of type @c Mask, consider: @code Type x = aligned_load<Type>(ptr,offset,old,mask); @endcode If @c Type is a SIMD value, this code is equivalent to: - If @c offset is a scalar integer: @code for(int i=0;i<Value::static_size;++i) if (mask[i]) x[i] = *(ptr+offset+i); else x[i] = old[i] @endcode - If @c offset is a SIMD integral register: @code for(int i=0;i<Value::static_size;++i) if (mask[i]) x[i] = *(ptr+offset[i]); else x[i] = old[i]; @endcode In this case, the aligned_load operation is equivalent to a gather operation. If @c Type and @c ptr are Fusion Sequences of size @c N, this code is equivalent to: @code at_c<0>(x) = aligned_load(at_c<0>(ptr),offset); ... at_c<N-1>(x) = aligned_load(at_c<N-1>(ptr),offset); @endcode If @c Type is a scalar type, then it is equivalent to: @code if (mask) x = *(ptr+offset); else x = old; @endcode @par Misalignment handling In all these cases, the @c Misalignment optional template parameter can be used to notify aligned_load that the current pointer used is misaligned by a specific amount. In this case, aligned_load can be issued by using an architecture specific strategy to perform this aligned_loading efficiently. For any type @c T, any pointer @c ptr, value of misalignment @c M, value(s) @c old and logical mask @c mask , the call: @code aligned_load<T, M>(ptr,old,mask); @endcode implies that @code is_aligned(ptr-M) == true @endcode In other case, when misalignment of pointer can't be known at compile-time, use unaligned_aligned_load. @usage{memory/aligned_load.cpp} @tparam Type Type of data to aligned_load from memory @tparam Misalignment Optional misalignment hints @param ptr Memory location to aligned_load data from. @param offset Optional memory offset. @param mask Optional logical mask. Only loads values for which the mask is true. @param old Optional Returns the corresponding entry from old if the mask is set to false. Default is zero. @return A value of type @c Type aligned_loaded from target memory block **/ template<typename Type,int Misalignment,typename Pointer,typename Offset> BOOST_FORCEINLINE Type aligned_load(Pointer const& ptr, Offset const& offset ) { typename boost::dispatch::meta ::dispatch_call<tag::aligned_load_( Pointer const& , boost::dispatch::meta::as_<Type> const& , Offset const& , boost::mpl::int_<Misalignment> const& )>::type callee; return callee ( ptr , boost::dispatch::meta::as_<Type>() , offset , boost::mpl::int_<Misalignment>() ); } /// @overload template<typename Type,int Misalignment,typename Pointer> BOOST_FORCEINLINE Type aligned_load(Pointer const& ptr) { typename boost::dispatch::meta ::dispatch_call<tag::aligned_load_(Pointer const& , boost::dispatch::meta::as_<Type> const& , boost::mpl::int_<Misalignment> const& )>::type callee; return callee ( ptr , boost::dispatch::meta::as_<Type>() , boost::mpl::int_<Misalignment>() ); } /// @overload template<typename Type,typename Pointer,typename Offset> BOOST_FORCEINLINE Type aligned_load(Pointer const& ptr,Offset const& offset) { typename boost::dispatch::meta ::dispatch_call<tag::aligned_load_( Pointer const& , boost::dispatch::meta::as_<Type> const& , Offset const& )>::type callee; return callee(ptr,boost::dispatch::meta::as_<Type>(),offset); } /// @overload template<typename Type,typename Pointer,typename Mask, typename Old> BOOST_FORCEINLINE Type aligned_load(Pointer const& ptr,Mask const& mask, Old const& old) { typename boost::dispatch::meta ::dispatch_call<tag::aligned_load_( Pointer const& , boost::dispatch::meta::as_<Type> const& , Mask const& , Old const& )>::type callee; return callee(ptr,boost::dispatch::meta::as_<Type>(),mask,old); } /// @overload template<typename Type,int Misalignment,typename Pointer,typename Mask,typename Old> BOOST_FORCEINLINE Type aligned_load(Pointer const& ptr,Mask const& mask,Old const& old) { typename boost::dispatch::meta ::dispatch_call<tag::aligned_load_( Pointer const& , boost::dispatch::meta::as_<Type> const& , boost::mpl::int_<Misalignment> const& , Mask const& , Old const& )>::type callee; return callee ( ptr,boost::dispatch::meta::as_<Type>() , boost::mpl::int_<Misalignment>(),mask,old); } /// @overload template<typename Type,typename Pointer,typename Offset,typename Mask,typename Old> BOOST_FORCEINLINE Type aligned_load(Pointer const& ptr, Offset const& offset, Mask const& mask, Old const& old) { typename boost::dispatch::meta ::dispatch_call<tag::aligned_load_( Pointer const& , boost::dispatch::meta::as_<Type> const& , Offset const& , Mask const& , Old const& )>::type callee; return callee ( ptr,boost::dispatch::meta::as_<Type>(),offset , mask,old); } /// @overload template<typename Type,int Misalignment,typename Pointer,typename Offset,typename Mask,typename Old> BOOST_FORCEINLINE Type aligned_load(Pointer const& ptr, Offset const& offset,Mask const& mask,Old const& old) { typename boost::dispatch::meta ::dispatch_call<tag::aligned_load_( Pointer const& , boost::dispatch::meta::as_<Type> const& , Offset const& , boost::mpl::int_<Misalignment> const& , Mask const& , Old const& )>::type callee; return callee ( ptr,boost::dispatch::meta::as_<Type>(),offset , boost::mpl::int_<Misalignment>(),mask,old); } /// @overload template<typename Type,typename Pointer> BOOST_FORCEINLINE Type aligned_load(Pointer const& ptr) { typename boost::dispatch::meta ::dispatch_call<tag::aligned_load_(Pointer const& , boost::dispatch::meta::as_<Type> const& )>::type callee; return callee(ptr,boost::dispatch::meta::as_<Type>()); } } } #endif <|start_filename|>modules/boost/simd/base/include/boost/simd/arithmetic/functions/remround.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef BOOST_SIMD_ARITHMETIC_FUNCTIONS_REMROUND_HPP_INCLUDED #define BOOST_SIMD_ARITHMETIC_FUNCTIONS_REMROUND_HPP_INCLUDED #include <boost/simd/include/functor.hpp> #include <boost/dispatch/include/functor.hpp> namespace boost { namespace simd { namespace tag { /*! @brief rem generic tag Represents the remround function in generic contexts. @par Models: Hierarchy **/ struct remround_ : ext::elementwise_<remround_> { /// @brief Parent hierarchy typedef ext::elementwise_<remround_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_remround_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::remround_, Site> dispatching_remround_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::remround_, Site>(); } template<class... Args> struct impl_remround_; } /*! Computes the remainder of division. The return value is a0-n*a1, where n is the value a0/a1, rounded toward infinity. @par semantic: For any given value @c x, @c y of type @c T: @code T r = remround(x, y); @endcode For floating point values the code is equivalent to: @code T r = x-divround(x, y)*y; @endcode @param a0 @param a1 @return a value of the same type as the input. **/ BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::remround_, remround, 2) } } #endif <|start_filename|>modules/core/polynom/include/nt2/polynom/functions/polyadd.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_POLYNOM_FUNCTIONS_POLYADD_HPP_INCLUDED #define NT2_POLYNOM_FUNCTIONS_POLYADD_HPP_INCLUDED #include <nt2/include/functor.hpp> #include <nt2/sdk/meta/size_as.hpp> #include <nt2/sdk/meta/value_as.hpp> #include <nt2/core/container/dsl/size.hpp> #include <nt2/sdk/meta/tieable_hierarchy.hpp> #include <nt2/core/container/dsl/value_type.hpp> namespace nt2 { namespace tag { /*! @brief polyadd generic tag Represents the polyadd function in generic contexts. @par Models: Hierarchy **/ struct polyadd_ : ext::elementwise_<polyadd_> { /// @brief Parent hierarchy typedef ext::elementwise_<polyadd_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_polyadd_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::polyadd_, Site> dispatching_polyadd_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::polyadd_, Site>(); } template<class... Args> struct impl_polyadd_; } /*! Computes the sum of two polynomials. The polynomials are supposed to be given by an expression representing a vector of coefficients in decreasing degrees order @par Semantic: For every expressions representing polynomials a, b: @code auto r = polyadd(a, b); @endcode is such that if a represents \f$\displaystyle \sum_0^n a_i x^i\f$ and b represents \f$\displaystyle \sum_0^n b_ix^i\f$ then r represents \f$\displaystyle \sum_0^n(a_i+b_i)x^i\f$ @param a0 @param a1 @return an expression **/ NT2_FUNCTION_IMPLEMENTATION(tag::polyadd_, polyadd, 2) } #endif <|start_filename|>modules/binding/magma/include/nt2/linalg/functions/magma/geqrf.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2013 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_LINALG_FUNCTIONS_MAGMA_GEQRF_HPP_INCLUDED #define NT2_LINALG_FUNCTIONS_MAGMA_GEQRF_HPP_INCLUDED #if defined(NT2_USE_MAGMA) #include <nt2/linalg/functions/geqrf.hpp> #include <nt2/sdk/magma/magma.hpp> #include <nt2/dsl/functions/terminal.hpp> #include <nt2/core/container/table/kind.hpp> #include <nt2/linalg/details/utility/f77_wrapper.hpp> #include <nt2/linalg/details/utility/options.hpp> #include <nt2/linalg/details/utility/workspace.hpp> #include <nt2/core/container/table/table.hpp> #include <nt2/include/functions/of_size.hpp> #include <nt2/include/functions/height.hpp> #include <nt2/include/functions/width.hpp> #include <magma.h> namespace nt2 { namespace ext { /// INTERNAL ONLY - Compute the workspace BOOST_DISPATCH_IMPLEMENT ( geqrf_, nt2::tag::magma_<site> , (A0)(S0)(A1)(S1)(site) , ((container_<nt2::tag::table_, double_<A0>, S0 >)) ((container_<nt2::tag::table_, double_<A1>, S1 >)) ) { typedef nt2_la_int result_type; BOOST_FORCEINLINE result_type operator()(A0& a0, A1& a1) const { result_type that; details::workspace<typename A0::value_type> w; nt2_la_int m = nt2::height(a0); nt2_la_int n = nt2::width(a0); nt2_la_int ld = ((m+31)/32)*32; nt2_la_int lwork_query = -1; magma_dgeqrf (m, n, 0, ld, 0, w.main() , lwork_query, &that ); w.prepare_main(); nt2::geqrf(a0,a1,w); return that; } }; /// INTERNAL ONLY - Workspace is ready BOOST_DISPATCH_IMPLEMENT ( geqrf_, nt2::tag::magma_<site> , (A0)(S0)(A1)(S1)(A2)(site) , ((container_<nt2::tag::table_, double_<A0>, S0 >)) ((container_<nt2::tag::table_, double_<A1>, S1 >)) (unspecified_<A2>) ) { typedef nt2_la_int result_type; BOOST_FORCEINLINE result_type operator()(A0& a0, A1& a1,A2& a2) const { result_type that; nt2_la_int m = nt2::height(a0); nt2_la_int n = nt2::width(a0); nt2_la_int ld = a0.leading_size(); nt2_la_int wn = a2.main_size(); a1.resize( nt2::of_size(std::min(n, m), 1) ); magma_dgeqrf( m, n, a0.data(), ld, a1.data(), a2.main() , wn, &that ); return that; } }; /// INTERNAL ONLY - Compute the workspace BOOST_DISPATCH_IMPLEMENT ( geqrf_, nt2::tag::magma_<site> , (A0)(S0)(A1)(S1)(site) , ((container_<nt2::tag::table_, single_<A0>, S0 >)) ((container_<nt2::tag::table_, single_<A1>, S1 >)) ) { typedef nt2_la_int result_type; BOOST_FORCEINLINE result_type operator()(A0& a0, A1& a1) const { details::workspace<typename A0::value_type> w; result_type that; nt2_la_int m = nt2::height(a0); nt2_la_int n = nt2::width(a0); nt2_la_int ld = ((m+31)/32)*32; nt2_la_int lwork_query = -1; magma_sgeqrf(m, n, 0, ld, 0, w.main() , lwork_query, &that ); w.prepare_main(); nt2::geqrf(a0,a1,w); return that; } }; /// INTERNAL ONLY - Workspace is ready BOOST_DISPATCH_IMPLEMENT ( geqrf_, nt2::tag::magma_<site> , (A0)(S0)(A1)(S1)(A2)(site) , ((container_<nt2::tag::table_, single_<A0>, S0 >)) ((container_<nt2::tag::table_, single_<A1>, S1>)) (unspecified_<A2>) ) { typedef nt2_la_int result_type; BOOST_FORCEINLINE result_type operator()(A0& a0, A1& a1,A2& a2) const { result_type that; nt2_la_int m = nt2::height(a0); nt2_la_int n = nt2::width(a0); nt2_la_int ld = a0.leading_size(); nt2_la_int wn = a2.main_size(); a1.resize( nt2::of_size(std::min(n, m), 1) ); magma_sgeqrf( m, n, a0.data(), ld, a1.data(), a2.main() , wn, &that ); return that; } }; //---------------------------------------Complex-----------------------------------------// /// INTERNAL ONLY - Compute the workspace BOOST_DISPATCH_IMPLEMENT ( geqrf_, nt2::tag::magma_<site> , (A0)(S0)(A1)(S1)(site) , ((container_< nt2::tag::table_, complex_<single_<A0> >, S0 >)) ((container_< nt2::tag::table_, complex_<single_<A1> >, S1 >)) ) { typedef nt2_la_int result_type; BOOST_FORCEINLINE result_type operator()(A0& a0, A1& a1) const { result_type that; nt2_la_int m = nt2::height(a0); nt2_la_int n = nt2::width(a0); nt2_la_int ld = a0.leading_size(); nt2_la_int lwork_query = -1; details::workspace<typename A0::value_type> w; a1.resize( nt2::of_size(std::min(n, m), 1) ); magma_cgeqrf(m, n, 0, ld, 0, (cuFloatComplex*) w.main() , lwork_query, &that ); w.prepare_main(); nt2::geqrf(a0,a1,w); return that; } }; /// INTERNAL ONLY - Workspace is ready BOOST_DISPATCH_IMPLEMENT ( geqrf_, nt2::tag::magma_<site> , (A0)(S0)(A1)(S1)(A2)(site) , ((container_< nt2::tag::table_, complex_<single_<A0> >, S0 >)) ((container_< nt2::tag::table_, complex_<single_<A1> >, S1 >)) (unspecified_<A2>) ) { typedef nt2_la_int result_type; BOOST_FORCEINLINE result_type operator()(A0& a0, A1& a1,A2& a2) const { result_type that; nt2_la_int m = nt2::height(a0); nt2_la_int n = nt2::width(a0); nt2_la_int ld = a0.leading_size(); nt2_la_int wn = a2.main_size(); a1.resize( nt2::of_size(std::min(n, m), 1) ); magma_cgeqrf(m, n, (cuFloatComplex*)a0.data(), ld, (cuFloatComplex*)a1.data() , (cuFloatComplex*)a2.main(), wn, &that ); return that; } }; /// INTERNAL ONLY - Compute the workspace BOOST_DISPATCH_IMPLEMENT ( geqrf_, nt2::tag::magma_<site> , (A0)(S0)(A1)(S1)(site) , ((container_< nt2::tag::table_, complex_<double_<A0> >, S0 >)) ((container_< nt2::tag::table_, complex_<double_<A1> >, S1 >)) ) { typedef nt2_la_int result_type; BOOST_FORCEINLINE result_type operator()(A0& a0, A1& a1) const { result_type that; nt2_la_int m = nt2::height(a0); nt2_la_int n = nt2::width(a0); nt2_la_int ld = a0.leading_size(); nt2_la_int lwork_query = -1; details::workspace<typename A0::value_type> w; a1.resize( nt2::of_size(std::min(n, m), 1) ); magma_zgeqrf(m, n, 0, ld, 0, (cuDoubleComplex*)w.main() , lwork_query, &that ); w.prepare_main(); nt2::geqrf(a0,a1,w); return that; } }; /// INTERNAL ONLY - Workspace is ready BOOST_DISPATCH_IMPLEMENT ( geqrf_, nt2::tag::magma_<site> , (A0)(S0)(A1)(S1)(A2)(site) , ((container_< nt2::tag::table_, complex_<double_<A0> >, S0 >)) ((container_< nt2::tag::table_, complex_<double_<A1> >, S1 >)) (unspecified_<A2>) ) { typedef nt2_la_int result_type; BOOST_FORCEINLINE result_type operator()(A0& a0, A1& a1,A2& a2) const { result_type that; nt2_la_int m = nt2::height(a0); nt2_la_int n = nt2::width(a0); nt2_la_int ld = a0.leading_size(); nt2_la_int wn = a2.main_size(); a1.resize( nt2::of_size(std::min(n, m), 1) ); magma_zgeqrf(m, n, (cuDoubleComplex*)a0.data(), ld, (cuDoubleComplex*)a1.data() , (cuDoubleComplex*)a2.main(), wn, &that ); return that; } }; } } #endif #endif <|start_filename|>modules/core/euler/include/nt2/euler/functions/expni.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_EULER_FUNCTIONS_EXPNI_HPP_INCLUDED #define NT2_EULER_FUNCTIONS_EXPNI_HPP_INCLUDED #include <nt2/include/functor.hpp> namespace nt2 { namespace tag { /*! @brief expni generic tag Represents the expni function in generic contexts. @par Models: Hierarchy **/ struct expni_ : ext::elementwise_<expni_> { typedef ext::elementwise_<expni_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_expni_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::expni_, Site> dispatching_expni_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::expni_, Site>(); } template<class... Args> struct impl_expni_; } /*! Computes the exponential integral function @par Semantic: For every parameters of scalar integer type I0 and floating type T1: @code T0 r = expni(a0,a1); @endcode Computes \f$ E_{a_0}(a_1)=\int_0^\infty \frac{e^{-a_1t}}{t^{a_0}} \mbox{d}t\f$ @param a0 is a scalar positive integer @param a1 a floating value @return a value of the same type as the second parameter **/ NT2_FUNCTION_IMPLEMENTATION(tag::expni_, expni, 2) } #endif <|start_filename|>modules/core/trigonometric/include/nt2/trigonometric/functions/fast_tanpi.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_TRIGONOMETRIC_FUNCTIONS_FAST_TANPI_HPP_INCLUDED #define NT2_TRIGONOMETRIC_FUNCTIONS_FAST_TANPI_HPP_INCLUDED #include <nt2/include/functor.hpp> namespace nt2 { namespace tag { /*! @brief fast_tanpi generic tag Represents the fast_tanpi function in generic contexts. @par Models: Hierarchy **/ struct fast_tanpi_ : ext::elementwise_<fast_tanpi_> { /// @brief Parent hierarchy typedef ext::elementwise_<fast_tanpi_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_fast_tanpi_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::fast_tanpi_, Site> dispatching_fast_tanpi_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::fast_tanpi_, Site>(); } template<class... Args> struct impl_fast_tanpi_; } /*! tangent of the angle in pi multiples, in the interval \f$[-1/4, 1/4]\f$, nan outside. @par Semantic: For every parameter of floating type T0 @code T0 r = fast_tanpi(x); @endcode is similar to: @code T0 r = tanpi(x); @endcode @see @funcref{tanpi}, @funcref{proper_tanpi}, @funcref{tan} @param a0 @return a value of the same type as the parameter **/ NT2_FUNCTION_IMPLEMENTATION(tag::fast_tanpi_, fast_tanpi, 1) } #endif <|start_filename|>modules/boost/simd/base/include/boost/simd/operator/functions/shift_right.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2011 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2011 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef BOOST_SIMD_OPERATOR_FUNCTIONS_SHIFT_RIGHT_HPP_INCLUDED #define BOOST_SIMD_OPERATOR_FUNCTIONS_SHIFT_RIGHT_HPP_INCLUDED #include <boost/simd/include/functor.hpp> namespace boost { namespace simd { namespace tag { /*! @brief shift_right generic tag Represents the shift_right function in generic contexts. @par Models: Hierarchy **/ struct shift_right_ : ext::elementwise_<shift_right_> { /// @brief Parent hierarchy typedef ext::elementwise_<shift_right_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_shift_right_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::shift_right_, Site> dispatching_shift_right_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::shift_right_, Site>(); } template<class... Args> struct impl_shift_right_; } /*! return right shift of the first operand by the second that must be of integer type and of the same number of elements as the first parameter Infix notation can be used with operator '>>' @par Semantic: For every parameters of types respectively T0, T1: @code T0 r = shift_right(a0,a1); @endcode is similar to: @code T0 r = a0 >> a1; @endcode @par Alias: @c shra, @c shar, @c shrai @see @funcref{shift_left}, @funcref{shr}, @funcref{rshl}, @funcref{rshr}, @funcref{rol}, @funcref{ror} @param a0 @param a1 @return a value of the same type as the second parameter **/ BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::shift_right_ , shift_right , 2 ) BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::shift_right_ , shra , 2 ) BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::shift_right_ , shar , 2 ) BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::shift_right_ , shrai , 2 ) } } #include <boost/simd/operator/specific/common.hpp> #endif <|start_filename|>modules/boost/simd/base/include/boost/simd/constant/constants/fact_12.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 20012 - 2012 LRI UMR 12623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef BOOST_SIMD_CONSTANT_CONSTANTS_FACT_12_HPP_INCLUDED #define BOOST_SIMD_CONSTANT_CONSTANTS_FACT_12_HPP_INCLUDED #include <boost/simd/include/functor.hpp> #include <boost/simd/constant/register.hpp> #include <boost/simd/constant/hierarchy.hpp> #include <boost/config.hpp> #ifdef BOOST_MSVC #pragma warning(push) #pragma warning(disable: 4310) // truncation of constant #endif namespace boost { namespace simd { namespace tag { /*! @brief Fact_12 generic tag Represents the Fact_12 constant in generic contexts. @par Models: Hierarchy **/ BOOST_SIMD_CONSTANT_REGISTER( Fact_12,double , 479001600,0x4de467e0, 0x41bc8cfc00000000ll ) } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::Fact_12, Site> dispatching_Fact_12(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::Fact_12, Site>(); } template<class... Args> struct impl_Fact_12; } /*! Generates 12! that is 479001600 @par Semantic: @code T r = Fact_12<T>(); @endcode is similar to: @code T r = T(479001600); @endcode **/ BOOST_SIMD_CONSTANT_IMPLEMENTATION(boost::simd::tag::Fact_12, Fact_12) } } #ifdef BOOST_MSVC #pragma warning(pop) #endif #include <boost/simd/constant/common.hpp> #endif <|start_filename|>modules/core/sdk/include/nt2/memory/functions/assign.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2011 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2011 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_MEMORY_FUNCTIONS_ASSIGN_HPP_INCLUDED #define NT2_MEMORY_FUNCTIONS_ASSIGN_HPP_INCLUDED #include <nt2/include/functor.hpp> namespace nt2 { namespace tag { /*! \brief Same as \classref{boost::simd::tag::assign_} **/ struct assign_ : ext::elementwise_<assign_> { typedef ext::elementwise_<assign_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_assign_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::assign_, Site> dispatching_assign_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::assign_, Site>(); } template<class... Args> struct impl_assign_; } /*! \brief Same as \funcref{boost::simd::assign} **/ template<class A0, class... Args> BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE assign(A0&& a0, Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_assign_( ext::adl_helper(), boost::dispatch::default_site_t<A0>(), boost::dispatch::meta::hierarchy_of_t<A0&&>(), boost::dispatch::meta::hierarchy_of_t<Args&&>()... )(static_cast<A0&&>(a0), static_cast<Args&&>(args)...) ) } #endif <|start_filename|>modules/core/interpol/include/nt2/interpol/functions/bsearch.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_INTERPOL_FUNCTIONS_BSEARCH_HPP_INCLUDED #define NT2_INTERPOL_FUNCTIONS_BSEARCH_HPP_INCLUDED #include <nt2/include/functor.hpp> #include <nt2/sdk/meta/size_as.hpp> #include <nt2/core/container/dsl/size.hpp> #include <nt2/core/container/dsl/value_type.hpp> namespace nt2 { namespace tag { /*! @brief bsearch generic tag Represents the bsearch function in generic contexts. @par Models: Hierarchy **/ struct bsearch_ : ext::unspecified_<bsearch_> { /// @brief Parent hierarchy typedef ext::unspecified_<bsearch_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_bsearch_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::bsearch_, Site> dispatching_bsearch_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::bsearch_, Site>(); } template<class... Args> struct impl_bsearch_; } /*! one dimensional binary search \par @par Semantic: For every parameters expressions @code auto index = bsearch(xx, xi); @endcode Performs a binary search of an ordered array of increasing values. and returns the indices of the xi such that xi belongs to the interval [xx(index(i)), xx(index(i)+1)] and the implicit bracket [index(i), index(i)+1] always corresponds to a region within the implicit value range of the value array. Note that this means the relationship of x = xi(i) to xx(index) and xx(index+1) depends on the result region, i.e. the behaviour at the boundaries may not correspond to what you expect. We have the following complete specification of the behaviour. Suppose the input is xx = { x0, x1, ..., xN } - if ( x == x0 ) then index == 0 - if ( x > x0 && x <= x1 ) then index == 0, and similarly for other interior pts - if ( x >= xN ) then index == N-1 @param a0 @param a1 @return a index expression **/ NT2_FUNCTION_IMPLEMENTATION(tag::bsearch_, bsearch, 2) } namespace nt2 { namespace ext { template<class Domain, int N, class Expr> struct size_of<tag::bsearch_, Domain, N, Expr> : meta::size_as<Expr,1> {}; template <class Domain, class Expr, int N> struct value_type < tag::bsearch_, Domain,N,Expr> { typedef typename boost::proto::result_of ::child_c<Expr&, 1>::value_type::value_type elt_t; typedef typename nt2::meta::as_integer<elt_t>::type type; }; } } #endif <|start_filename|>modules/core/extractive/include/nt2/core/functions/triu.hpp<|end_filename|> //============================================================================== // Copyright 2003 & onward LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 & onward LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_CORE_FUNCTIONS_TRIU_HPP_INCLUDED #define NT2_CORE_FUNCTIONS_TRIU_HPP_INCLUDED #include <nt2/include/functor.hpp> namespace nt2 { namespace tag { /*! @brief triu generic tag Represents the triu function in generic contexts. @par Models: Hierarchy **/ struct triu_ : ext::elementwise_<triu_> { /// @brief Parent hierarchy typedef ext::elementwise_<triu_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_triu_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::triu_, Site> dispatching_triu_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::triu_, Site>(); } template<class... Args> struct impl_triu_; } /*! @brief Apply a upper-triangular masking to an expression returns the elements on and above the @c a1-th diagonal of @c a0, 0 elsewhere. - @c a1 = 0 is the main diagonal, - @c a1 > 0 is above the main diagonal, - @c a1 < 0 is below the main diagonal. Apply a mask on an expression that evaluates to 0 everywhere except on the upper triangular part of @c a0. @see funcref{tri1u}, funcref{tril}, funcref{tri1l} @param a0 Expression to mask. **/ NT2_FUNCTION_IMPLEMENTATION(nt2::tag::triu_, triu, 1) /*! @brief Apply an offset upper-triangular masking to an expression Apply a mask on an expression that evaluates to 0 everywhere except on the upper triangular part of @c a0 and @c a1 subdiagonal. @param a0 Expression to mask. @param a1 Diagonal offset to the mask. **/ NT2_FUNCTION_IMPLEMENTATION(nt2::tag::triu_, triu, 2) } #endif <|start_filename|>modules/binding/magma/include/nt2/linalg/details/magma_buffer.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_LINALG_DETAILS_MAGMA_BUFFER_HPP_INCLUDED #define NT2_LINALG_DETAILS_MAGMA_BUFFER_HPP_INCLUDED #include <nt2/sdk/magma/magma.hpp> #include <cublas.h> #include <cstddef> #include <boost/throw_exception.hpp> #include <boost/assert.hpp> #include <new> namespace nt2 { namespace details { //============================================================================ // Allocate a raw buffer of bytes using MAGMA //============================================================================ template<class T> struct magma_buffer { //============================================================================ // Internal typedefs //============================================================================ typedef T value_type; typedef T* pointer; typedef T const* const_pointer; typedef T& reference; typedef T const& const_reference; typedef std::size_t size_type; typedef std::ptrdiff_t difference_type; magma_buffer( size_type h, size_type w, const_pointer host = 0 ) : gpu_ptr_(0), height_(h), width_(w) { void *ptr; cudaError_t status = cudaMalloc ( reinterpret_cast<void**>(&ptr) , h*w*sizeof(value_type) ); if(status != cudaSuccess) BOOST_THROW_EXCEPTION( std::bad_alloc() ); gpu_ptr_ = reinterpret_cast<pointer>(ptr); if(host) { cublasStatus_t e = cublasSetMatrix( h,w,sizeof(value_type) , host , h , gpu_ptr_, h ); BOOST_ASSERT_MSG( e == CUBLAS_STATUS_SUCCESS , "Error in cublasSetMatrix"); } } ~magma_buffer() { cudaFree(gpu_ptr_); } pointer data() const { return gpu_ptr_; } void* raw( pointer host ) const { cublasGetMatrix ( height_, width_, sizeof(value_type) , gpu_ptr_, height_, host, height_ ); return host; } private: pointer gpu_ptr_; size_type height_, width_; }; } } #endif <|start_filename|>modules/core/trigonometric/include/nt2/trigonometric/functions/proper_tanpi.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_TRIGONOMETRIC_FUNCTIONS_PROPER_TANPI_HPP_INCLUDED #define NT2_TRIGONOMETRIC_FUNCTIONS_PROPER_TANPI_HPP_INCLUDED #include <nt2/include/functor.hpp> namespace nt2 { namespace tag { /*! @brief proper_tanpi generic tag Represents the proper_tanpi function in generic contexts. @par Models: Hierarchy **/ struct proper_tanpi_ : ext::elementwise_<proper_tanpi_> { /// @brief Parent hierarchy typedef ext::elementwise_<proper_tanpi_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_proper_tanpi_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::proper_tanpi_, Site> dispatching_proper_tanpi_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::proper_tanpi_, Site>(); } template<class... Args> struct impl_proper_tanpi_; } /*! tangent of angle in \f$\pi\f$ multiples, restricted between -0.5 and +0.5. This function is the inverse of @c atanpi and so is such that @c proper_tanpi(0.5) is inf and @c proper_tanpi(-0.5) is -inf @par Semantic: For every parameter of floating type T0 @code T0 r = proper_tanpi(x); @endcode is similar to: @code T0 r = tanpi(x); @endcode provided input is in \f$]-0.5, 0.5[\f$ @see @funcref{tanpi}, @funcref{fast_tanpi} @param a0 @return a value of the same type as the parameter **/ NT2_FUNCTION_IMPLEMENTATION(tag::proper_tanpi_, proper_tanpi, 1) } #endif // modified by jt the 25/12/2010 <|start_filename|>modules/boost/simd/sdk/include/boost/simd/include/functor.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef BOOST_SIMD_INCLUDE_FUNCTOR_HPP_INCLUDED #define BOOST_SIMD_INCLUDE_FUNCTOR_HPP_INCLUDED #include <boost/simd/sdk/config/types.hpp> #include <boost/simd/sdk/simd/extensions.hpp> #include <boost/simd/sdk/simd/native_fwd.hpp> #include <boost/simd/sdk/simd/category.hpp> #include <boost/dispatch/include/functor.hpp> #include <boost/dispatch/dsl/call.hpp> #include <boost/simd/sdk/functor/preprocessor/function.hpp> #include <boost/simd/sdk/functor/preprocessor/call.hpp> namespace boost { namespace dispatch { template<class Tag, class Site> struct generic_dispatcher { /* While ICC supports SFINAE with decltype, it seems to cause * infinite compilation times in some cases */ #if defined(BOOST_NO_SFINAE_EXPR) || defined(__INTEL_COMPILER) /*! For compatibility with result_of protocol */ template<class Sig> struct result; // result_of needs to SFINAE in this case template<class This, class... Args> struct result<This(Args...)> : boost::dispatch::meta:: result_of< decltype(dispatching(meta::adl_helper(), Tag(), boost::dispatch::default_site_t<Site>(), boost::dispatch::meta::hierarchy_of_t<Args>()...))(Args...) > { }; template<class... Args> BOOST_FORCEINLINE typename result<generic_dispatcher(Args&&...)>::type operator()(Args&&... args) const { return dispatching(meta::adl_helper(), Tag(), boost::dispatch::default_site_t<Site>(), boost::dispatch::meta::hierarchy_of_t<Args&&>()...)(static_cast<Args&&>(args)...); } #else template<class... Args> BOOST_FORCEINLINE auto operator()(Args&&... args) const BOOST_AUTO_DECLTYPE_BODY_SFINAE( dispatching(meta::adl_helper(), Tag(), boost::dispatch::default_site_t<Site>(), boost::dispatch::meta::hierarchy_of_t<Args&&>()...)(static_cast<Args&&>(args)...) ) #endif }; } } namespace boost { namespace simd { namespace ext { struct adl_helper {}; template<class Tag, class Site> BOOST_FORCEINLINE boost::dispatch::generic_dispatcher<Tag, Site> dispatching(adl_helper, unknown_<Tag>, unknown_<Site>, ...) { return boost::dispatch::generic_dispatcher<Tag, Site>(); } } } } namespace boost { namespace simd { template<class Tag, class Site> struct generic_dispatcher { /* While ICC supports SFINAE with decltype, it seems to cause * infinite compilation times in some cases */ #if defined(BOOST_NO_SFINAE_EXPR) || defined(__INTEL_COMPILER) /*! For compatibility with result_of protocol */ template<class Sig> struct result; // result_of needs to SFINAE in this case template<class This, class... Args> struct result<This(Args...)> : boost::dispatch::meta:: result_of< decltype(dispatching(ext::adl_helper(), Tag(), boost::dispatch::default_site_t<Site>(), boost::dispatch::meta::hierarchy_of_t<Args>()...))(Args...) > { }; template<class... Args> BOOST_FORCEINLINE typename result<generic_dispatcher(Args&&...)>::type operator()(Args&&... args) const { return dispatching(ext::adl_helper(), Tag(), boost::dispatch::default_site_t<Site>(), boost::dispatch::meta::hierarchy_of_t<Args&&>()...)(static_cast<Args&&>(args)...); } #else template<class... Args> BOOST_FORCEINLINE auto operator()(Args&&... args) const BOOST_AUTO_DECLTYPE_BODY_SFINAE( dispatching(ext::adl_helper(), Tag(), boost::dispatch::default_site_t<Site>(), boost::dispatch::meta::hierarchy_of_t<Args&&>()...)(static_cast<Args&&>(args)...) ) #endif }; } } #endif <|start_filename|>modules/core/linalg/include/nt2/linalg/functions/schur.hpp<|end_filename|> //============================================================================== // Copyright 2014 - 2015 <NAME> // Copyright 2003 - 2011 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2015 LRI UMR 8623 CNRS/Univ Paris Sud XI // Copyright 2009 - 2015 NumScale SAS // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_LINALG_FUNCTIONS_SCHUR_HPP_INCLUDED #define NT2_LINALG_FUNCTIONS_SCHUR_HPP_INCLUDED #include <nt2/linalg/options.hpp> #include <nt2/include/functor.hpp> #include <nt2/sdk/meta/tieable_hierarchy.hpp> #include <nt2/core/container/dsl/size.hpp> #include <nt2/sdk/meta/size_as.hpp> namespace nt2 { namespace tag { struct schur_ : ext::tieable_<schur_> { typedef ext::tieable_<schur_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_schur_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::schur_, Site> dispatching_schur_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::schur_, Site>(); } template<class... Args> struct impl_schur_; } /** * @brief Perform Schur factorization * * For any given matrix expression, performs a Schur factorization of * said matrix using the specified output layout for the Schur method. * * * possible calls are * t = schur(a); * if a is complex, the complex schur form is returned in matrix t. * the complex schur form is upper triangular with the eigenvalues * of a on the diagonal. * * if a is real, or has only real elements two different decompositions are available. * t = schur(a,real_) has the real eigenvalues on the diagonal and the * complex eigenvalues in 2-by-2 blocks on the diagonal. * t = schur(a,cmplx_) is triangular and is complex. * t = schur(a,real_) is the default for real types entry and in this case is equivalent to * t = schur(a). For complex types entry the complex form is the default and in this case * t = schur(a,cmplx_) is equivalent to schur(a). * * t = schur(a, real_); // all a coefficients must contain real values * t = schur(a, cmplx_); // t must be able to receive complex elts * * tie(u, t) = schur(a, ...) also returns the unitary (orthogonal in the real_ case) matrix u * such that u*t*ctrans(u) == a * tie(u, t, w) = schur(a, ...) returns also the vector w containing the eigenvalues of a (w * is mandatorily complex) * * **/ NT2_FUNCTION_IMPLEMENTATION(tag::schur_, schur, 1) NT2_FUNCTION_IMPLEMENTATION(tag::schur_, schur, 2) } namespace nt2 { namespace ext { template<class Domain, int N, class Expr> struct size_of<tag::schur_,Domain,N,Expr> : meta::size_as<Expr,0> {}; } } #endif <|start_filename|>modules/boost/simd/base/include/boost/simd/swar/functions/all_reduce.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // Copyright 2012 - 2013 MetaScale SAS // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef BOOST_SIMD_SWAR_FUNCTIONS_ALL_REDUCE_HPP_INCLUDED #define BOOST_SIMD_SWAR_FUNCTIONS_ALL_REDUCE_HPP_INCLUDED #include <boost/simd/include/functor.hpp> #include <boost/dispatch/include/functor.hpp> namespace boost { namespace simd { namespace tag { /*! @brief all_reduce generic tag Represents the all_reduce function in generic contexts. **/ struct all_reduce_ : ext::unspecified_<all_reduce_> { /// @brief Parent hierarchy typedef ext::unspecified_<all_reduce_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_all_reduce_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::all_reduce_, Site> dispatching_all_reduce_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::all_reduce_, Site>(); } template<class... Args> struct impl_all_reduce_; } /*! @brief Broadcast reduction Computes a reduction across a vector values and broadcast its value into a full output vector. @par Semantic Depending on the type of its arguments, all_reduce exhibits different semantics. For any SIMD value @c v of type @c Type and any binary function tag @c F: @code Type r = all_reduce<F>(v); @endcode is equivalent to: @code for(int i=0;i<Type::static_size;++i) x[i] = reduce<F>(v); @endcode @param value Value to reduce and broadcast @tparam Tag Function tag of the reduction to apply @return A value containing the broadcast result of the reduction of @c value by the function represented by @c Tag */ template<typename Tag, typename Type> BOOST_FORCEINLINE typename boost::dispatch::meta:: result_of < typename boost::dispatch::meta:: dispatch_call < tag::all_reduce_ ( Type const& , boost::dispatch::meta::as_<Tag> const ) >::type ( Type const& , boost::dispatch::meta::as_<Tag> const ) >::type all_reduce(Type const& value) { typename boost::dispatch::meta ::dispatch_call<tag::all_reduce_ ( Type const& , boost::dispatch::meta::as_<Tag> const )>::type callee; return callee(value,boost::dispatch::meta::as_<Tag>()); } } } #endif <|start_filename|>modules/core/polynom/include/nt2/polynom/functions/compan.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_POLYNOM_FUNCTIONS_COMPAN_HPP_INCLUDED #define NT2_POLYNOM_FUNCTIONS_COMPAN_HPP_INCLUDED #include <nt2/include/functor.hpp> namespace nt2 { namespace tag { /*! @brief compan generic tag Represents the compan function in generic contexts. @par Models: Hierarchy **/ struct compan_ : ext::elementwise_<compan_> { /// @brief Parent hierarchy typedef ext::elementwise_<compan_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_compan_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::compan_, Site> dispatching_compan_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::compan_, Site>(); } template<class... Args> struct impl_compan_; } /*! returns the companion matrix of the input polynomial. @par Semantic: For every expression representing a polynomial @code auto r = compan(p); @endcode @par Note: The eigenvalues of @c compan(p) are the roots of the polynomial. The first row of r is -p(_(2, n))/p(1). null polynomial has compan -1 and non null constant polynomial has compan 0 @see @funcref{colon} @param a0 @return a value of the same type as the parameter **/ NT2_FUNCTION_IMPLEMENTATION(tag::compan_,compan, 1) } #endif <|start_filename|>modules/core/polynom/include/nt2/polynom/functions/polyval.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_POLYNOM_FUNCTIONS_POLYVAL_HPP_INCLUDED #define NT2_POLYNOM_FUNCTIONS_POLYVAL_HPP_INCLUDED #include <nt2/include/functor.hpp> #include <nt2/sdk/meta/size_as.hpp> #include <nt2/sdk/meta/value_as.hpp> #include <nt2/core/container/dsl/size.hpp> #include <nt2/sdk/meta/tieable_hierarchy.hpp> #include <nt2/core/container/dsl/value_type.hpp> namespace nt2 { namespace tag { /*! @brief polyval generic tag Represents the polyval function in generic contexts. @par Models: Hierarchy **/ struct polyval_ : ext::tieable_<polyval_> { /// @brief Parent hierarchy typedef ext::tieable_<polyval_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_polyval_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::polyval_, Site> dispatching_polyval_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::polyval_, Site>(); } template<class... Args> struct impl_polyval_; } /// @overload NT2_FUNCTION_IMPLEMENTATION(tag::polyval_, polyval, 2) /// @overload NT2_FUNCTION_IMPLEMENTATION(tag::polyval_, polyval, 3) /// @overload NT2_FUNCTION_IMPLEMENTATION(tag::polyval_, polyval, 5) /*! computes the value of a polynomial p at x the polynomial is supposed to be given by an array coefficients in decreasing degrees order @par Semantic: For every polynom p and values x: @code tie(y, delta) = polyval(p, x, {r, df, normr}{, mu}); @endcode returns the expression evaluating the polynom at all elements of x delta is an error estimate available if r, df and normr are provided. These are datas that can be generated by @funcref{polyfit}. if mu is provided p is evaluated at (x-mu(1))/mu(2) instead of x. @see @funcref{polyfit} @param a0 mandatory polynomial @param a1 mandatory points of evaluations @param a2 optional, can be mu or r @param a3 optional, mandatory df if r is given @param a4 optional, mandatory normr if r is given @param a5 optional, can be mu if r is given @return an expression or a pair of expressions **/ NT2_FUNCTION_IMPLEMENTATION(tag::polyval_, polyval, 6) } namespace nt2 { namespace ext { /// INTERNAL ONLY template<class Domain, int N, class Expr> struct size_of<tag::polyval_,Domain,N,Expr> { typedef typename boost::proto::result_of::child_c<Expr&,1>::value_type::extent_type result_type; BOOST_FORCEINLINE result_type operator()(Expr& e) const { return boost::proto::child_c<1>(e).extent(); } }; /// INTERNAL ONLY template<class Domain, int N, class Expr> struct value_type<tag::polyval_,Domain,N,Expr> : meta::value_as<Expr,0> {}; } } #endif <|start_filename|>modules/boost/simd/base/include/boost/simd/bitwise/functions/genmaskc.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef BOOST_SIMD_BITWISE_FUNCTIONS_GENMASKC_HPP_INCLUDED #define BOOST_SIMD_BITWISE_FUNCTIONS_GENMASKC_HPP_INCLUDED #include <boost/simd/include/functor.hpp> #include <boost/dispatch/include/functor.hpp> namespace boost { namespace simd { namespace tag { /*! @brief genmaskc generic tag Represents the genmaskc function in generic contexts. @par Models: Hierarchy **/ struct genmaskc_ : ext::elementwise_<genmaskc_> { /// @brief Parent hierarchy typedef ext::elementwise_<genmaskc_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_genmaskc_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::genmaskc_, Site> dispatching_genmaskc_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::genmaskc_, Site>(); } template<class... Args> struct impl_genmaskc_; } /*! Returns a mask of bits. All ones if the input element is zero else all zeros. @par semantic: For any given value @c x of type @c T: @code T r = genmaskc(x); @endcode is similar to @code T r = x ? Zero : Allbits; @endcode @par Alias: @c typed_maskc, @c logical2maskc, @c l2mc, @c typed_maskc, @c if_zero_else_allbits @see @funcref{if_else_allbits} @param a0 @return a value of the type of the input. **/ BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::genmaskc_, genmaskc, 1) BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::genmaskc_, typed_maskc, 1) BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::genmaskc_, logical2maskc, 1) BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::genmaskc_, l2mc, 1) BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::genmaskc_, if_zero_else_allbits, 1) } } #endif <|start_filename|>modules/core/linalg/include/nt2/linalg/functions/llspgen.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_LINALG_FUNCTIONS_LLSPGEN_HPP_INCLUDED #define NT2_LINALG_FUNCTIONS_LLSPGEN_HPP_INCLUDED #include <nt2/include/functor.hpp> #include <nt2/sdk/meta/size_as.hpp> #include <nt2/sdk/meta/value_as.hpp> #include <nt2/core/container/dsl/size.hpp> #include <nt2/sdk/meta/tieable_hierarchy.hpp> #include <nt2/core/container/dsl/value_type.hpp> namespace nt2 { namespace tag { struct llspgen_ : ext::tieable_<llspgen_> { typedef ext::tieable_<llspgen_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_llspgen_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::llspgen_, Site> dispatching_llspgen_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::llspgen_, Site>(); } template<class... Args> struct impl_llspgen_; } /** * @brief Generate LLSP min(Ax-b) such that cond(A) = n^q and residual norm = nr * **/ NT2_FUNCTION_IMPLEMENTATION(tag::llspgen_, llspgen, 4) NT2_FUNCTION_IMPLEMENTATION(tag::llspgen_, llspgen, 5) } namespace nt2 { namespace ext { template<class Domain, int N, class Expr> struct size_of<tag::llspgen_,Domain,N,Expr> { typedef _2D result_type; BOOST_FORCEINLINE result_type operator()(Expr& e) const { return result_type( boost::proto::value( boost::proto::child_c<0>(e) ) , boost::proto::value( boost::proto::child_c<1>(e) ) ); } }; template<class Domain, class Expr> struct value_type<tag::llspgen_,Domain,4,Expr> { typedef double type; }; template<class Domain, class Expr> struct value_type<tag::llspgen_,Domain,5,Expr> { typedef typename boost::proto::result_of::child_c<Expr&,4>::value_type child0; typedef typename child0::value_type type; }; } } #endif <|start_filename|>modules/boost/simd/base/include/boost/simd/ieee/functions/fast_frexp.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef BOOST_SIMD_IEEE_FUNCTIONS_FAST_FREXP_HPP_INCLUDED #define BOOST_SIMD_IEEE_FUNCTIONS_FAST_FREXP_HPP_INCLUDED #include <boost/simd/include/functor.hpp> #include <boost/dispatch/include/functor.hpp> namespace boost { namespace simd { namespace tag { /*! @brief fast_frexp generic tag Represents the fast_frexp function in generic contexts. @par Models: Hierarchy **/ struct fast_frexp_ : ext::elementwise_<fast_frexp_> { /// @brief Parent hierarchy typedef ext::elementwise_<fast_frexp_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_fast_frexp_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::fast_frexp_, Site> dispatching_fast_frexp_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::fast_frexp_, Site>(); } template<class... Args> struct impl_fast_frexp_; } /*! Returns the mantissa and exponent of the input @par Semantic: @code tie(m, e) = fast_frexp(x); @endcode is similar to: @code as_integer<T > e = exponent(x)+1; T m = mantissa(x)/2; @endcode @par Note: The fast prefix indicates that, for speed consideration, the result may be incorrect for special values like inf, -inf nan and zero that deserve special treatment. If you are not sure use @funcref{frexp} at the expense of some more machine cycles. @see @funcref{frexp} @param a0 Value to decompose @return A pair containing the signed mantissa and exponent of @c a0 **/ BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::fast_frexp_, fast_frexp, 1) /*! Returns the mantissa computes the exponent of the input @code m = fast_frexp(x, e); @endcode is similar to: @code as_integer<T > e = exponent(x)+1; T m = mantissa(x)/2; @endcode @par Note: @par Note: The fast prefix indicates that for speed sake the result may be incorrect for limiting values: inf, -inf nan and zero that deserve special treatment. If you are not sure use @c frexp at the expense of some more machine cycles. @param a0 Value to decompose @param a1 L-Value that will receive the exponent of @c a0 @return The mantissa of @c a0 **/ BOOST_DISPATCH_FUNCTION_IMPLEMENTATION_TPL( tag::fast_frexp_ , fast_frexp,(A0 const&)(A1&) , 2 ) /*! Computes the mantissa and the exponent of the input @code m = fast_frexp(x, e); @endcode is similar to: @code as_integer<T > e = exponent(x)+1; T m = mantissa(x)/2; @endcode @par Note: @par Note: The fast prefix indicates that for speed sake the result may be incorrect for limiting values: inf, -inf nan and zero that deserve special treatment. If you are not sure use @c frexp at the expense of some more machine cycles. @param a0 Value to decompose @param a1 L-Value that will receive the mantissa of @c a0 @param a2 L-Value that will receive the exponent of @c a0 **/ BOOST_DISPATCH_FUNCTION_IMPLEMENTATION_TPL( tag::fast_frexp_ , fast_frexp,(A0 const&)(A0&)(A1&) , 2 ) } } #endif <|start_filename|>modules/boost/simd/base/include/boost/simd/predicates/functions/is_odd.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef BOOST_SIMD_PREDICATES_FUNCTIONS_IS_ODD_HPP_INCLUDED #define BOOST_SIMD_PREDICATES_FUNCTIONS_IS_ODD_HPP_INCLUDED #include <boost/simd/include/functor.hpp> #include <boost/dispatch/include/functor.hpp> namespace boost { namespace simd { namespace tag { /*! @brief is_odd generic tag Represents the is_odd function in generic contexts. @par Models: Hierarchy **/ struct is_odd_ : ext::elementwise_<is_odd_> { /// @brief Parent hierarchy typedef ext::elementwise_<is_odd_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_is_odd_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) };} namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::is_odd_, Site> dispatching_is_odd_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::is_odd_, Site>(); } template<class... Args> struct impl_is_odd_; } /*! Returns True or False according a0 is odd or not. @par Semantic: @code logical<T> r = is_odd(a0); @endcode is similar to: @code logical<T> r = (abs(a0)/2)*2 == abs(a0)-1; @endcode @par Note: A floating number a0 is odd if a0-1 is even @param a0 @return a logical value **/ BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::is_odd_, is_odd, 1) } } #endif <|start_filename|>modules/boost/simd/base/include/boost/simd/boolean/functions/negif.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef BOOST_SIMD_BOOLEAN_FUNCTIONS_NEGIF_HPP_INCLUDED #define BOOST_SIMD_BOOLEAN_FUNCTIONS_NEGIF_HPP_INCLUDED #include <boost/simd/include/functor.hpp> #include <boost/dispatch/include/functor.hpp> namespace boost { namespace simd { namespace tag { /*! @brief negif generic tag Represents the negif function in generic contexts. @par Models: Hierarchy **/ struct negif_ : ext::elementwise_<negif_> { /// @brief Parent hierarchy typedef ext::elementwise_<negif_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_negif_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::negif_, Site> dispatching_negif_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::negif_, Site>(); } template<class... Args> struct impl_negif_; } /*! The function returns -a1 if a0 is true and a1 otherwise. The two operands must have the same cardinal. @par Semantic: For every parameters of types respectively T0, T1: @code T1 r = negif(a0,a1); @endcode is similar to: @code T1 r = a0 ? -a1 : a1; @endcode @param a0 @param a1 @return a value of the same type as the second parameter **/ BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::negif_, negif, 2) } } #endif <|start_filename|>modules/core/linalg/include/nt2/linalg/functions/svd.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2013 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_LINALG_FUNCTIONS_SVD_HPP_INCLUDED #define NT2_LINALG_FUNCTIONS_SVD_HPP_INCLUDED #include <nt2/include/functor.hpp> #include <nt2/sdk/meta/size_as.hpp> #include <nt2/sdk/meta/value_as.hpp> #include <nt2/sdk/meta/as_real.hpp> #include <nt2/core/container/dsl/size.hpp> #include <nt2/sdk/meta/tieable_hierarchy.hpp> #include <nt2/core/container/dsl/value_type.hpp> namespace nt2 { namespace tag { struct svd_ : ext::tieable_<svd_> { typedef ext::tieable_<svd_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_svd_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::svd_, Site> dispatching_svd_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::svd_, Site>(); } template<class... Args> struct impl_svd_; } /** s = svd(x) s = svd(x, vector_) s = svd(x, matrix_) tie(u,s,v) = svd(x, matrix_) tie(u,s,v) = svd(x, vector_) tie(u,s,v) = svd(x) tie(u,s,v) = svd(x,0) tie(u,s,v) = svd(x, econ_) tie(u,s,tv) = svd(x, raw_) Description The svd command computes the matrix singular value decomposition. s = svd(x) returns a vector of singular values. tie(u,s,v) = svd(x) or ie(u,s,v) = svd(x, matrix_) produces a diagonal matrix s of the same dimension as x, with nonnegative diagonal elements in decreasing order, and unitary matrices u and v so that x = u*s*ctrans(v). tie(u,s,v) = svd(x,0) produces the "economy size" decomposition. if x is m-by-n with m > n, then svd computes only the first n columns of u and s is n-by-n. tie(u,s,v) = svd(x,econ_) also produces the "economy size" decomposition. if x is m-by-n with m >= n, it is equivalent to svd(x,0). for m < n, only the first m columns of v are computed and s is m-by-m. tie(u,s,tv) = svd(x,raw_) also produces the lapack direct output decomposition. s is a real vector of the singular values and tv is the transconjugate of matrix v. tie(u,s,v) = svd(x, vector_) returns s as a vector but v is not transconjugated. options econ_ and 0 implies s as a matrix, option raw_ implies s as a vector. **/ NT2_FUNCTION_IMPLEMENTATION(tag::svd_, svd, 1) NT2_FUNCTION_IMPLEMENTATION(tag::svd_, svd, 2) } namespace nt2 { namespace ext { template<class Domain, int N, class Expr> struct size_of<tag::svd_,Domain,N,Expr> : meta::size_as<Expr,0> {}; } } #endif <|start_filename|>modules/core/reduction/include/nt2/core/functions/globalprod.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // Copyright 2011 - 2012 MetaScale SAS // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_CORE_FUNCTIONS_GLOBALPROD_HPP_INCLUDED #define NT2_CORE_FUNCTIONS_GLOBALPROD_HPP_INCLUDED #include <nt2/include/functor.hpp> #include <nt2/include/functions/prod.hpp> #include <nt2/include/functions/global.hpp> namespace nt2 { namespace tag { /*! @brief Tag for the functor **/ struct globalprod_ : ext::abstract_<globalprod_> { /// @brief Parent hierarchy typedef ext::abstract_<globalprod_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_globalprod_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::globalprod_, Site> dispatching_globalprod_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::globalprod_, Site>(); } template<class... Args> struct impl_globalprod_; } /*! @brief product of all the elements of a table expression . Computes the product of all the elements of a table expression @par Semantic For any table expression @c t: @code T r = globalprod(t); @endcode is equivalent to: @code T r = prod(a(_))(1); @endcode @param a0 Table expression to process @return A scalar **/ NT2_FUNCTION_IMPLEMENTATION(nt2::tag::globalprod_ , globalprod, 1) } namespace nt2 { namespace ext { /// INTERNAL ONLY BOOST_DISPATCH_IMPLEMENT ( globalprod_, tag::cpu_ , (A0) , (unspecified_<A0>) ) { typedef typename meta::call < tag::global_(nt2::functor<tag::prod_> , const A0&) >::type result_type; BOOST_FORCEINLINE result_type operator()(A0 const& a0) const { return global(nt2::functor<tag::prod_>(), a0); } }; } } #endif <|start_filename|>modules/boost/simd/base/include/boost/simd/operator/functions/is_equal.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2011 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2011 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef BOOST_SIMD_OPERATOR_FUNCTIONS_IS_EQUAL_HPP_INCLUDED #define BOOST_SIMD_OPERATOR_FUNCTIONS_IS_EQUAL_HPP_INCLUDED #include <boost/simd/include/functor.hpp> namespace boost { namespace simd { namespace tag { /*! @brief is_equal generic tag Represents the is_equal function in generic contexts. @par Models: Hierarchy **/ struct is_equal_ : ext::elementwise_<is_equal_> { /// @brief Parent hierarchy typedef ext::elementwise_<is_equal_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_is_equal_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::is_equal_, Site> dispatching_is_equal_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::is_equal_, Site>(); } template<class... Args> struct impl_is_equal_; } /*! Returns True or False according a0 and a1 are equal or not. Infix notation can be used with operator '==' @par Semantic: For every parameters of types respectively T0, T1: @code as_logical<T0> r = is_equal(a0,a1); @endcode is similar to: @code as_logical<T0> r = a0 == a1; @endcode @par Alias: @c eq, @c is_eq @see @funcref{is_not_equal}, @funcref{is_eqz}, @funcref{is_equal_with_equal_nans} @param a0 @param a1 @return a logical value **/ BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::is_equal_, is_equal, 2 ) BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::is_equal_, eq, 2 ) BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::is_equal_, is_eq, 2 ) } } #include <boost/simd/operator/specific/common.hpp> #endif <|start_filename|>modules/core/reduction/include/nt2/core/functions/medianad.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // Copyright 2011 - 2012 MetaScale SAS // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_CORE_FUNCTIONS_MEDIANAD_HPP_INCLUDED #define NT2_CORE_FUNCTIONS_MEDIANAD_HPP_INCLUDED namespace nt2 { namespace tag { /*! @brief Tag for the medianad functor **/ struct medianad_ : ext::abstract_<medianad_> { /// @brief Parent hierarchy typedef ext::abstract_<medianad_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_medianad_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::medianad_, Site> dispatching_medianad_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::medianad_, Site>(); } template<class... Args> struct impl_medianad_; } /*! @brief median of the absolute deviation to the median of a table Computes the meian of the of the absolute deviation to the median of non nan elements of a table expression along a given dimension. @par Semantic For any table expression @c t and any integer @c n: @code auto r = medianad(t,n); @endcode is equivalent to: @code auto r = median(abs(a-expand_to(median(a,n), size(a))), n); @endcode @par Note: n default to firstnonsingleton(t) @see @funcref{firstnonsingleton}, @funcref{median}, @funcref{abs}, @funcref{size}, @funcref{expand_to} @param a0 Table to process @param a1 Dimension along which to process a0 @return An expression eventually evaluated to the result */ NT2_FUNCTION_IMPLEMENTATION(nt2::tag::medianad_ , medianad, 1) NT2_FUNCTION_IMPLEMENTATION(nt2::tag::medianad_ , medianad, 2) } #endif <|start_filename|>modules/core/base/include/nt2/core/functions/swap.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2013 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_CORE_FUNCTIONS_SWAP_HPP_INCLUDED #define NT2_CORE_FUNCTIONS_SWAP_HPP_INCLUDED #include <nt2/include/functor.hpp> namespace nt2 { namespace tag { /// @brief Defines swap function tag struct swap_ : ext::abstract_<swap_> { /// INTERNAL ONLY typedef ext::abstract_<swap_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_swap_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::swap_, Site> dispatching_swap_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::swap_, Site>(); } template<class... Args> struct impl_swap_; } /*! @brief Swap values Swap values between expression of same number of element. @param First expression to swap @param Second expression to swap **/ NT2_FUNCTION_IMPLEMENTATION_TPL(tag::swap_, swap, (A0&)(A1&) , 2); NT2_FUNCTION_IMPLEMENTATION_TPL(tag::swap_, swap, (A0 const&)(A1&) , 2); NT2_FUNCTION_IMPLEMENTATION_TPL(tag::swap_, swap, (A0 &)(A1 const&) , 2); NT2_FUNCTION_IMPLEMENTATION_TPL(tag::swap_, swap, (A0 const&)(A1 const&), 2); } #endif <|start_filename|>modules/boost/simd/base/include/boost/simd/operator/functions/divides.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2011 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2011 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef BOOST_SIMD_OPERATOR_FUNCTIONS_DIVIDES_HPP_INCLUDED #define BOOST_SIMD_OPERATOR_FUNCTIONS_DIVIDES_HPP_INCLUDED #include <boost/simd/include/functor.hpp> namespace boost { namespace simd { namespace tag { /*! @brief divides generic tag Represents the divides function in generic contexts. @par Models: Hierarchy **/ struct divides_ : ext::elementwise_<divides_> { /// @brief Parent hierarchy typedef ext::elementwise_<divides_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_divides_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::divides_, Site> dispatching_divides_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::divides_, Site>(); } template<class... Args> struct impl_divides_; } /*! return the elementwise division of the two parameters Infix notation can be used with operator '/' @par Semantic: For every parameters of types respectively T0, T1: @code T0 r = divides(a0,a1); @endcode is similar to: @code T0 r = a0/a1; @endcode @par Alias: @c div, @c rdiv @see @funcref{fast_divides}, @funcref{rec}, @funcref{fast_rec}, @funcref{divs}, @funcref{divfloor}, @funcref{divceil}, @funcref{divround}, @funcref{divround2even}, @funcref{divfix} @param a0 @param a1 @return a value of the same type as the second parameter **/ BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::divides_ , divides , 2 ) BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::divides_ , div , 2 ) BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::divides_ , rdiv , 2 ) } } #include <boost/simd/operator/specific/common.hpp> #endif <|start_filename|>modules/boost/simd/base/include/boost/simd/reduction/functions/is_included_c.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef BOOST_SIMD_REDUCTION_FUNCTIONS_IS_INCLUDED_C_HPP_INCLUDED #define BOOST_SIMD_REDUCTION_FUNCTIONS_IS_INCLUDED_C_HPP_INCLUDED #include <boost/simd/include/functor.hpp> #include <boost/dispatch/include/functor.hpp> namespace boost { namespace simd { namespace tag { /*! @brief is_included_c generic tag Represents the is_included_c function in generic contexts. @par Models: Hierarchy **/ struct is_included_c_ : ext::unspecified_<is_included_c_> { /// @brief Parent hierarchy typedef ext::unspecified_<is_included_c_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_is_included_c_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::is_included_c_, Site> dispatching_is_included_c_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::is_included_c_, Site>(); } template<class... Args> struct impl_is_included_c_; } /*! Returns True is only if all bits set in a0 are not set in a1 @par Semantic: For every parameters of types respectively T0, T1: @code logical<scalar_of<T0>> r = is_included_c(a0,a1); @endcode is similar to: @code logical<scalar_of<T0>> r = all(a0&a1 == zero); @endcode @par Alias: @c testz, @c are_disjoint @param a0 @param a1 @return a value of the scalar logical type associated to the parameters **/ BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::is_included_c_, is_included_c, 2) BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::is_included_c_, testz, 2) BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::is_included_c_, are_disjoint, 2) } } #endif <|start_filename|>modules/core/trigonometric/include/nt2/trigonometric/constants/sqrt_2opi.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2011 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2011 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_TRIGONOMETRIC_CONSTANTS_SQRT_2OPI_HPP_INCLUDED #define NT2_TRIGONOMETRIC_CONSTANTS_SQRT_2OPI_HPP_INCLUDED #include <nt2/include/functor.hpp> #include <boost/simd/constant/hierarchy.hpp> #include <boost/simd/constant/register.hpp> namespace nt2 { namespace tag { /*! @brief Sqrt_2opi generic tag Represents the Sqrt_2opi constant in generic contexts. @par Models: Hierarchy **/ BOOST_SIMD_CONSTANT_REGISTER( Sqrt_2opi, double , 0, 0x3f4c422a , 0x3fe9884533d43651ll ) } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::Sqrt_2opi, Site> dispatching_Sqrt_2opi(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::Sqrt_2opi, Site>(); } template<class... Args> struct impl_Sqrt_2opi; } /*! Constant \f$\frac{\sqrt2}{\pi}\f$. @par Semantic: For type T0: @code T0 r = Sqrt_2opi<T0>(); @endcode is similar to: @code T0 r = sqrt(Two<T0>())/Pi<T0>(); @endcode @return a value of type T0 **/ BOOST_SIMD_CONSTANT_IMPLEMENTATION(tag::Sqrt_2opi, Sqrt_2opi); } #endif <|start_filename|>modules/core/euler/include/nt2/euler/functions/erfc.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_EULER_FUNCTIONS_ERFC_HPP_INCLUDED #define NT2_EULER_FUNCTIONS_ERFC_HPP_INCLUDED #include <nt2/include/functor.hpp> namespace nt2 { namespace tag { /*! @brief erfc generic tag Represents the erfc function in generic contexts. @par Models: Hierarchy **/ struct erfc_ : ext::elementwise_<erfc_> { /// @brief Parent hierarchy typedef ext::elementwise_<erfc_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_erfc_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::erfc_, Site> dispatching_erfc_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::erfc_, Site>(); } template<class... Args> struct impl_erfc_; } /*! Computes the complementary eroor function @par Semantic: For every parameter of floating type T0 @code T0 r = erfc(a0); @endcode is similar to: @code T0 r = one-erf(x); @endcode @see @funcref{erf}, @funcref{erfinv}, @funcref{erfcinv} @param a0 @return a value of the same type as the parameter **/ NT2_FUNCTION_IMPLEMENTATION(tag::erfc_, erfc, 1) } #endif <|start_filename|>modules/core/gallery/include/nt2/gallery/functions/sobol.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_GALLERY_FUNCTIONS_SOBOL_HPP_INCLUDED #define NT2_GALLERY_FUNCTIONS_SOBOL_HPP_INCLUDED #include <nt2/include/functor.hpp> #include <nt2/sdk/meta/size_as.hpp> #include <nt2/sdk/meta/value_as.hpp> #include <nt2/include/constants/nbmantissabits.hpp> #include <boost/dispatch/dsl/semantic_of.hpp> #include <nt2/core/container/dsl/value_type.hpp> #include <nt2/core/container/dsl/size.hpp> /*! * \ingroup algebra * \defgroup algebra_sobol sobol * sobol(n) is an integer matrix containing a sobol sequence * allowing to define quasi random numbers fitted to Monte-Carlo * integration up to dimension n. * Currently n must be less or equal to 100. * the type of the table element used to store the result is important, * uint32_t or uint64_t will generate different sequences suited for respectively * float and double quasi-random number sequence generation. * * \par Header file * * \code * #include <nt2/include/functions/sobol.hpp> * \endcode * * **/ //============================================================================== // sobol actual class forward declaration //============================================================================== namespace nt2 { namespace tag { /*! * \brief Define the tag sobol_ of functor sobol * in namespace nt2::tag for toolbox algebra **/ struct sobol_ : ext::unspecified_<sobol_> { typedef ext::unspecified_<sobol_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_sobol_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::sobol_, Site> dispatching_sobol_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::sobol_, Site>(); } template<class... Args> struct impl_sobol_; } NT2_FUNCTION_IMPLEMENTATION(tag::sobol_, sobol, 2) template < class T> BOOST_FORCEINLINE typename meta::call<tag::sobol_(size_t,meta::as_<T>)>::type sobol(size_t const & a0) { return sobol(a0, nt2::meta::as_<T>()); } } namespace nt2 { namespace ext { template<class Domain, class Expr, int N> struct size_of<tag::sobol_, Domain, N, Expr> { typedef _2D result_type; BOOST_FORCEINLINE result_type operator()(Expr& e) const { result_type sizee; sizee[1] = boost::proto::value(boost::proto::child_c<0>(e)); sizee[0] = 23; return sizee; } }; template <class Domain, class Expr, int N> struct value_type < tag::sobol_, Domain,N,Expr> { typedef typename boost::proto::result_of::child_c<Expr&,0>::type t_t; typedef typename boost::dispatch::meta::semantic_of<t_t>::type type; }; } } #endif <|start_filename|>modules/core/base/include/nt2/core/functions/length.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // Copyright 2011 - 2012 MetaScale SAS // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_CORE_FUNCTIONS_LENGTH_HPP_INCLUDED #define NT2_CORE_FUNCTIONS_LENGTH_HPP_INCLUDED /*! @file @brief Defines and implements the length function **/ #include <nt2/include/functor.hpp> namespace nt2 { namespace tag { /*! @brief tag for the length functor **/ struct length_ : ext::abstract_<length_> { typedef ext::abstract_<length_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_length_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::length_, Site> dispatching_length_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::length_, Site>(); } template<class... Args> struct impl_length_; } /*! Compute largest dimension of an entity. @param a0 Expression to compute the length in number of elements @return The largest dimension of the size of \c xpr **/ NT2_FUNCTION_IMPLEMENTATION(nt2::tag::length_, length, 1) } #endif <|start_filename|>modules/core/euler/include/nt2/euler/functions/beta.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2011 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2011 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_EULER_FUNCTIONS_BETA_HPP_INCLUDED #define NT2_EULER_FUNCTIONS_BETA_HPP_INCLUDED #include <nt2/include/functor.hpp> namespace nt2 { namespace tag { /*! @brief beta generic tag Represents the beta function in generic contexts. @par Models: Hierarchy **/ struct beta_ : ext::elementwise_<beta_> { /// @brief Parent hierarchy typedef ext::elementwise_<beta_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_beta_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::beta_, Site> dispatching_beta_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::beta_, Site>(); } template<class... Args> struct impl_beta_; } /*! Computes Beta function : \f$ B(a_0,a_1)=\int_0^1 t^{a_0-1}(1-t)^{a_1-1}\mbox{d}t\f$ @par Semantic: For every parameters of floating types respectively T0, T1: @code T0 r = beta(a0,a1); @endcode is similar to: @code T0 r = gamma(a0)*gamma(a1)/gamma(a0+a1); @endcode @see @funcref{gamma} @param a0 @param a1 @return a value of the same type as the parameter **/ NT2_FUNCTION_IMPLEMENTATION(tag::beta_, beta, 2) } #endif <|start_filename|>modules/core/base/include/nt2/core/functions/height.hpp<|end_filename|> //============================================================================== // Copyright 2003 & onward LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 & onward LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_CORE_FUNCTIONS_HEIGHT_HPP_INCLUDED #define NT2_CORE_FUNCTIONS_HEIGHT_HPP_INCLUDED /*! @file @brief Defines and implements the height function **/ #include <nt2/include/functor.hpp> namespace nt2 { namespace tag { /*! @brief Tag for the height functor **/ struct height_ : ext::abstract_<height_> { typedef ext::abstract_<height_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_height_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::height_, Site> dispatching_height_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::height_, Site>(); } template<class... Args> struct impl_height_; } /*! @brief Height of an expression Return the number of element stored alogn the height of an expression. @param a0 Expression to compute the size in number of elements @return The number of elements stored along the height of a0 **/ NT2_FUNCTION_IMPLEMENTATION(nt2::tag::height_, height, 1) } #endif <|start_filename|>modules/boost/simd/base/include/boost/simd/swar/functions/simd/common/shuffle.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2011 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2011 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef BOOST_SIMD_SWAR_FUNCTIONS_SIMD_COMMON_SHUFFLE_HPP_INCLUDED #define BOOST_SIMD_SWAR_FUNCTIONS_SIMD_COMMON_SHUFFLE_HPP_INCLUDED #include <boost/simd/swar/functions/shuffle.hpp> #include <boost/simd/swar/functions/details/shuffler.hpp> #include <boost/simd/include/functions/simd/bitwise_cast.hpp> #include <boost/simd/sdk/meta/as_arithmetic.hpp> #include <boost/simd/sdk/meta/cardinal_of.hpp> namespace boost { namespace simd { namespace ext { BOOST_DISPATCH_IMPLEMENT ( shuffle_ , boost::simd::tag::cpu_ , (A0)(X)(P) , ((simd_<arithmetic_<A0>,X>)) (target_< unspecified_<P> >) ) { typedef A0 result_type; BOOST_FORCEINLINE result_type operator()(A0 const& a0,P const&) const { typename P::type p; return details::shuffler< details::default_matcher , details::default_permutation <meta::cardinal_of<A0>::value> , meta::cardinal_of<A0>::value , 4 >::process(a0,p); } }; BOOST_DISPATCH_IMPLEMENT_IF ( shuffle_, tag::cpu_ , (A0)(X)(P) , ( mpl::equal_to < mpl::sizeof_<A0> , mpl::sizeof_<typename A0::type> > ) , ((simd_< logical_<A0>, X>)) (target_< unspecified_<P> >) ) { typedef A0 result_type; BOOST_FORCEINLINE result_type operator()(A0 const& a0, P const&) const { typedef typename meta::as_arithmetic<A0>::type type; return bitwise_cast <result_type> ( shuffle<typename P::type>( bitwise_cast<type>(a0) )); } }; BOOST_DISPATCH_IMPLEMENT ( shuffle_ , boost::simd::tag::cpu_ , (A0)(X)(P) , ((simd_<arithmetic_<A0>,X>)) ((simd_<arithmetic_<A0>,X>)) (target_< unspecified_<P> >) ) { typedef A0 result_type; BOOST_FORCEINLINE result_type operator()(A0 const& a0,A0 const& a1,P const&) const { typename P::type p; return details::shuffler< details::default_matcher , details::default_permutation <meta::cardinal_of<A0>::value> , meta::cardinal_of<A0>::value , 4 >::process(a0,a1,p); } }; BOOST_DISPATCH_IMPLEMENT_IF ( shuffle_, tag::cpu_ , (A0)(X)(P) , ( mpl::equal_to < mpl::sizeof_<A0> , mpl::sizeof_<typename A0::type> > ) , ((simd_< logical_<A0>, X>)) ((simd_< logical_<A0>, X>)) (target_< unspecified_<P> >) ) { typedef A0 result_type; BOOST_FORCEINLINE result_type operator()(A0 const& a0, A0 const& a1, P const&) const { typedef typename meta::as_arithmetic<A0>::type type; return bitwise_cast <result_type> ( shuffle<typename P::type> ( bitwise_cast<type>(a0) , bitwise_cast<type>(a1) ) ); } }; } } } #endif <|start_filename|>modules/boost/simd/base/include/boost/simd/boolean/functions/if_else_allbits.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef BOOST_SIMD_BOOLEAN_FUNCTIONS_IF_ELSE_ALLBITS_HPP_INCLUDED #define BOOST_SIMD_BOOLEAN_FUNCTIONS_IF_ELSE_ALLBITS_HPP_INCLUDED #include <boost/simd/include/functor.hpp> #include <boost/dispatch/include/functor.hpp> namespace boost { namespace simd { namespace tag { /*! @brief if_else_allbits generic tag Represents the if_else_allbits function in generic contexts. @par Models: Hierarchy **/ struct if_else_allbits_ : ext::elementwise_<if_else_allbits_> { /// @brief Parent hierarchy typedef ext::elementwise_<if_else_allbits_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_if_else_allbits_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::if_else_allbits_, Site> dispatching_if_else_allbits_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::if_else_allbits_, Site>(); } template<class... Args> struct impl_if_else_allbits_; } /*! If a0 is true returns a1 else returns allbits @par Semantic: For every parameters of types respectively T0, T1: @code T r = if_else_allbits(a0,a1); @endcode is similar to: @code T r = a0 ? a1 : allbits; @endcode @par Alias: @c if_else_nan, @c ifelsenan, @c ifnot_nan_else, @c ifnotnanelse, @c if_else_allbits, @c ifelseallbits, @c ifnot_allbits_else, @c ifnotallbitselse, @param a0 @param a1 @return a value of the same type as the second parameter **/ BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::if_else_allbits_, if_else_nan, 2) BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::if_else_allbits_, ifelsenan, 2) BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::if_else_allbits_, ifnot_nan_else, 2) BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::if_else_allbits_, ifnotnanelse, 2) BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::if_else_allbits_, if_else_allbits, 2) BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::if_else_allbits_, ifelseallbits, 2) BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::if_else_allbits_, ifnot_allbits_else, 2) BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::if_else_allbits_, ifnotallbitselse, 2) } } #endif <|start_filename|>modules/core/restructuring/include/nt2/core/functions/rowvect.hpp<|end_filename|> //============================================================================== // Copyright 2003 & onward LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 & onward LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_CORE_FUNCTIONS_ROWVECT_HPP_INCLUDED #define NT2_CORE_FUNCTIONS_ROWVECT_HPP_INCLUDED #include <nt2/include/functor.hpp> #include <nt2/sdk/meta/reshaping_hierarchy.hpp> #include <nt2/core/container/dsl/size.hpp> #include <nt2/core/utility/of_size/mpl_value.hpp> #include <nt2/include/functions/numel.hpp> namespace nt2 { namespace tag { /*! @brief rowvect generic tag Represents the rowvect function in generic contexts. @par Models: Hierarchy **/ struct rowvect_ : ext::reshaping_<rowvect_> { /// @brief Parent hierarchy typedef ext::reshaping_<rowvect_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_rowvect_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::rowvect_, Site> dispatching_rowvect_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::rowvect_, Site>(); } template<class... Args> struct impl_rowvect_; } /*! Reshapes an expression into a row shaped table. @par Semantic: For every table expression @code auto r = rowvect(a0); @endcode is similar to: @code auto r = resize(a0, 1, numel(a0)); @endcode @see @funcref{colvect}, @funcref{resize}, @funcref{numel} @param a0 @return an expression which eventually will evaluate to the result **/ NT2_FUNCTION_IMPLEMENTATION(nt2::tag::rowvect_ , rowvect, 1) } //============================================================================== // Setup rowvect generator traits //============================================================================== namespace nt2 { namespace ext { /// INTERNAL ONLY template<class Domain, int N, class Expr> struct size_of<nt2::tag::rowvect_,Domain,N,Expr> { typedef typename boost::proto::result_of ::child_c<Expr&, 0>::value_type::extent_type ext_t; typedef typename meta::call<tag::numel_(ext_t const&)>::type num; typedef of_size_< 1, mpl_value<num>::value > result_type; BOOST_FORCEINLINE result_type operator()(Expr& e) const { return result_type(1,nt2::numel(boost::proto::child_c<0>(e))); } }; } } #endif <|start_filename|>modules/boost/simd/base/include/boost/simd/constant/constants/fact_7.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2011 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2011 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef BOOST_SIMD_CONSTANT_CONSTANTS_FACT_7_HPP_INCLUDED #define BOOST_SIMD_CONSTANT_CONSTANTS_FACT_7_HPP_INCLUDED #include <boost/simd/include/functor.hpp> #include <boost/simd/constant/register.hpp> #include <boost/simd/constant/hierarchy.hpp> #include <boost/config.hpp> #ifdef BOOST_MSVC #pragma warning(push) #pragma warning(disable: 4310) // truncation of constant #endif namespace boost { namespace simd { namespace tag { /*! @brief Fact_7 generic tag Represents the Fact_7 constant in generic contexts. @par Models: Hierarchy **/ BOOST_SIMD_CONSTANT_REGISTER( Fact_7,double , 5040, 0x459d8000, 0x40b3b00000000000ll ) } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::Fact_7, Site> dispatching_Fact_7(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::Fact_7, Site>(); } template<class... Args> struct impl_Fact_7; } /*! Generates 7! that is 5040 @par Semantic: @code T r = Fact_7<T>(); @endcode is similar to: @code T r = T(5040); @endcode **/ BOOST_SIMD_CONSTANT_IMPLEMENTATION(boost::simd::tag::Fact_7, Fact_7) } } #ifdef BOOST_MSVC #pragma warning(pop) #endif #include <boost/simd/constant/common.hpp> #endif <|start_filename|>modules/core/trigonometric/include/nt2/trigonometric/functions/rem_2pi.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_TRIGONOMETRIC_FUNCTIONS_REM_2PI_HPP_INCLUDED #define NT2_TRIGONOMETRIC_FUNCTIONS_REM_2PI_HPP_INCLUDED #include <nt2/include/functor.hpp> namespace nt2 { namespace tag { /*! @brief rem_2pi generic tag Represents the rem_2pi function in generic contexts. @par Models: Hierarchy **/ struct rem_2pi_ : ext::elementwise_<rem_2pi_> { typedef ext::elementwise_<rem_2pi_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_rem_2pi_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::rem_2pi_, Site> dispatching_rem_2pi_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::rem_2pi_, Site>(); } template<class... Args> struct impl_rem_2pi_; } /*! compute the remainder modulo \f$2\pi\f$. the result is in \f$[-\pi, \pi]\f$. If the input is near \f$\pi\f$ the output can be \f$\pi\f$ or \f$-\pi\f$ depending on register disponibility if extended arithmetic is used. @par Semantic: For every parameter of floating type T0 @code T0 r = rem_2pi(x); @endcode is similar to: @code T0 r = remainder(x, _2_pi<T0>(); @endcode @see @funcref{rem_pio2}, @funcref{rem_pio2_straight},@funcref{rem_pio2_cephes}, @funcref{rem_pio2_medium}, @param a0 @return a value of the same type as the parameter **/ NT2_FUNCTION_IMPLEMENTATION(tag::rem_2pi_, rem_2pi,1) NT2_FUNCTION_IMPLEMENTATION(tag::rem_2pi_, rem_2pi,2) } #endif <|start_filename|>modules/core/sdk/include/nt2/core/functions/extent.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // Copyright 2011 - 2012 MetaScale SAS // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_CORE_FUNCTIONS_EXTENT_HPP_INCLUDED #define NT2_CORE_FUNCTIONS_EXTENT_HPP_INCLUDED /*! @file @brief Defines the extent function **/ #include <nt2/include/functor.hpp> namespace nt2 { namespace tag { /*! @brief Tag for the extent functor **/ struct extent_ : ext::abstract_<extent_> { typedef ext::abstract_<extent_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_extent_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::extent_, Site> dispatching_extent_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::extent_, Site>(); } template<class... Args> struct impl_extent_; } /*! @brief Return the extent of an expression Return the extent, ie the internally optimized representation of an expression dimensions set. @param a0 Expression to inspect @return The extent of a0 **/ NT2_FUNCTION_IMPLEMENTATION(nt2::tag::extent_, extent, 1) } #endif <|start_filename|>modules/boost/simd/base/include/boost/simd/constant/constants/mantissamask.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2011 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2011 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef BOOST_SIMD_CONSTANT_CONSTANTS_MANTISSAMASK_HPP_INCLUDED #define BOOST_SIMD_CONSTANT_CONSTANTS_MANTISSAMASK_HPP_INCLUDED #include <boost/simd/include/functor.hpp> #include <boost/simd/constant/register.hpp> #include <boost/simd/constant/hierarchy.hpp> namespace boost { namespace simd { namespace tag { /*! @brief Mantissamask generic tag Represents the Mantissamask constant in generic contexts. @par Models: Hierarchy **/ BOOST_SIMD_CONSTANT_REGISTER( Mantissamask,double , 0,0x807FFFFFUL,0x800FFFFFFFFFFFFFULL ) } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::Mantissamask, Site> dispatching_Mantissamask(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::Mantissamask, Site>(); } template<class... Args> struct impl_Mantissamask; } /*! Generates a mask used to compute the mantissa of a floating point value @par Semantic: @code as_integer<T> r = Mantissamask<T>(); @endcode @code if T is double r = -2.225073858507200889e-308; else if T is float r = -1.1754942106924410755e-38; @endcode **/ BOOST_SIMD_CONSTANT_IMPLEMENTATION(boost::simd::tag::Mantissamask, Mantissamask) } } #include <boost/simd/constant/common.hpp> #endif <|start_filename|>modules/core/statistics/include/nt2/statistics/functions/expinv.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_STATISTICS_FUNCTIONS_EXPINV_HPP_INCLUDED #define NT2_STATISTICS_FUNCTIONS_EXPINV_HPP_INCLUDED #include <nt2/include/functor.hpp> #include <nt2/sdk/meta/size_as.hpp> #include <nt2/sdk/meta/value_as.hpp> #include <nt2/core/container/dsl/size.hpp> #include <nt2/core/container/dsl/value_type.hpp> #include <nt2/sdk/meta/tieable_hierarchy.hpp> #include <nt2/core/utility/max_extent.hpp> namespace nt2 { namespace tag { /*! @brief expinv generic tag Represents the expinv function in generic contexts. @par Models: Hierarchy **/ struct expinv_ : ext::tieable_<expinv_> { /// @brief Parent hierarchy typedef ext::tieable_<expinv_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_expinv_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; struct expinv0_ : ext::elementwise_<expinv0_> { /// @brief Parent hierarchy typedef ext::elementwise_<expinv0_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_expinv0_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::expinv_, Site> dispatching_expinv_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::expinv_, Site>(); } template<class... Args> struct impl_expinv_; template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::expinv0_, Site> dispatching_expinv0_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::expinv0_, Site>(); } template<class... Args> struct impl_expinv0_; } /*! exponential inverse cumulative distribution @par Semantic: For every table expression @code auto r = expinv(a0, lambda); @endcode is similar to: @code auto r = -log1p(-a0)*lambda; @endcode @see @funcref{log1p} @param a0 @param a1 optional mean default to 1 @return an expression which eventually will evaluate to the result **/ NT2_FUNCTION_IMPLEMENTATION(tag::expinv0_, expinv, 2) /// @overload NT2_FUNCTION_IMPLEMENTATION(tag::expinv0_, expinv, 1) /*! exponential inverse cumulative distribution @par Semantic: For every table expression, mean lambda @code tie(r, rlo, rup)= expinv(a0, lambda, cov, alpha); @endcode Returns r = expinv(a0, lambda), but also produces confidence bounds for r when the input parameter lambda is an estimate. cov is the variance of the estimated lambda. alpha has a default value of 0.05, and specifies 100*(1-alpha)% confidence bounds. rlo and rup are tables of the same size as a0 containing the lower and upper confidence bounds. the bounds are based on a normal approximation for the distribution of the log of the estimate of lambda. @param a0 @param a1 optional mean default to 1 @param a2 variance of the estimated a1 @param a3 optional confidence bound (default to 0.05) @return an expression which eventually will evaluate to the result **/ NT2_FUNCTION_IMPLEMENTATION(tag::expinv_, expinv, 4) /// @overload NT2_FUNCTION_IMPLEMENTATION(tag::expinv_, expinv, 3) } namespace nt2 { namespace ext { /// INTERNAL ONLY template<class Domain, int N, class Expr> // N = 3 or 4 struct size_of<tag::expinv_,Domain,N,Expr> { typedef typename boost::proto::result_of::child_c<Expr&,0> ::value_type::extent_type ext0_t; typedef typename boost::proto::result_of::child_c<Expr&,1> ::value_type::extent_type ext1_t; typedef typename utility::result_of::max_extent< ext1_t, ext0_t>::type result_type; BOOST_FORCEINLINE result_type operator()(Expr& e) const { return utility::max_extent(nt2::extent(boost::proto::child_c<0>(e)), nt2::extent(boost::proto::child_c<1>(e))); } }; /// INTERNAL ONLY template<class Domain, class Expr> struct size_of<tag::expinv_,Domain,1,Expr> : meta::size_as<Expr,0> {}; /// INTERNAL ONLY template<class Domain, int N, class Expr> struct value_type<tag::expinv_,Domain,N,Expr> : meta::value_as<Expr,0> {}; } } #endif <|start_filename|>modules/boost/simd/base/include/boost/simd/swar/functions/deinterleave_first.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef BOOST_SIMD_SWAR_FUNCTIONS_DEINTERLEAVE_FIRST_HPP_INCLUDED #define BOOST_SIMD_SWAR_FUNCTIONS_DEINTERLEAVE_FIRST_HPP_INCLUDED #include <boost/simd/include/functor.hpp> #include <boost/dispatch/include/functor.hpp> namespace boost { namespace simd { namespace tag { /*! @brief deinterleave_first generic tag Represents the deinterleave_first function in generic contexts. @par Models: Hierarchy **/ struct deinterleave_first_ : ext::unspecified_<deinterleave_first_> { /// @brief Parent hierarchy typedef ext::unspecified_<deinterleave_first_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_deinterleave_first_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::deinterleave_first_, Site> dispatching_deinterleave_first_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::deinterleave_first_, Site>(); } template<class... Args> struct impl_deinterleave_first_; } /*! Computes a vector from a combination of the two inputs. @par Semantic: For every parameters of type T0 @code T0 r = deinterleave_first(a,b); @endcode is equivalent to : @code r = [ a[0] a[2] ... a[n/2] b[0] b[2] ... b[n/2] ] @endcode with <tt> n = cardinal_of<T>::value </tt> @param a0 First vector to deinterleave @param a1 Second vector to deinterleave @return a value of the same type as the parameters **/ BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::deinterleave_first_, deinterleave_first, 2) } } #endif <|start_filename|>modules/boost/simd/base/include/boost/simd/constant/constants/signmask.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2011 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2011 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef BOOST_SIMD_CONSTANT_CONSTANTS_SIGNMASK_HPP_INCLUDED #define BOOST_SIMD_CONSTANT_CONSTANTS_SIGNMASK_HPP_INCLUDED #include <boost/simd/include/functor.hpp> #include <boost/simd/meta/float.hpp> #include <boost/simd/meta/int_c.hpp> #include <boost/simd/meta/double.hpp> #include <boost/simd/constant/hierarchy.hpp> namespace boost { namespace simd { namespace tag { /*! @brief Signmask generic tag Represents the Signmask constant in generic contexts. @par Models: Hierarchy **/ struct Signmask : ext::pure_constant_<Signmask> { typedef double default_type; typedef ext::pure_constant_<Signmask> parent; /// INTERNAL ONLY template<class Target, class Dummy=void> struct apply : meta::int_c<typename Target::type,0> {}; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_Signmask( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; /// INTERNAL ONLY template<class T, class Dummy> struct Signmask::apply<boost::dispatch::meta::single_<T>,Dummy> : meta::single_<0x80000000UL> {}; /// INTERNAL ONLY template<class T, class Dummy> struct Signmask::apply<boost::dispatch::meta::double_<T>,Dummy> : meta::double_<0x8000000000000000ULL> {}; /// INTERNAL ONLY template<class T, class Dummy> struct Signmask::apply<boost::dispatch::meta::int8_<T>,Dummy> : meta::int_c<T, boost::simd::int8_t(0x80U)> {}; /// INTERNAL ONLY template<class T, class Dummy> struct Signmask::apply<boost::dispatch::meta::int16_<T>,Dummy> : meta::int_c<T, boost::simd::int16_t(0x8000U)> {}; /// INTERNAL ONLY template<class T, class Dummy> struct Signmask::apply<boost::dispatch::meta::int32_<T>,Dummy> : meta::int_c<T, boost::simd::int32_t(0x80000000UL)> {}; /// INTERNAL ONLY template<class T, class Dummy> struct Signmask::apply<boost::dispatch::meta::int64_<T>,Dummy> : meta::int_c < T , boost::simd::int64_t(0x8000000000000000ULL) > {}; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::Signmask, Site> dispatching_Signmask(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::Signmask, Site>(); } template<class... Args> struct impl_Signmask; } /*! Generate a mask with the lone most significand bit set to one (even if the type is unsigned). @par Semantic: @code T r = Signmask<T>(); @endcode is similar to: @code T r = bitwise_cast<T>(1 << sizeof(T)*8-1); @endcode **/ BOOST_SIMD_CONSTANT_IMPLEMENTATION(boost::simd::tag::Signmask, Signmask) } } #include <boost/simd/constant/common.hpp> #endif <|start_filename|>modules/boost/simd/base/include/boost/simd/constant/constants/five.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2011 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2011 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef BOOST_SIMD_CONSTANT_CONSTANTS_FIVE_HPP_INCLUDED #define BOOST_SIMD_CONSTANT_CONSTANTS_FIVE_HPP_INCLUDED #include <boost/simd/include/functor.hpp> #include <boost/simd/constant/register.hpp> #include <boost/simd/constant/hierarchy.hpp> namespace boost { namespace simd { namespace tag { /*! @brief Five generic tag Represents the Five constant in generic contexts. @par Models: Hierarchy **/ BOOST_SIMD_CONSTANT_REGISTER( Five,double , 5,0x40a00000UL,0x4014000000000000ULL ) } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::Five, Site> dispatching_Five(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::Five, Site>(); } template<class... Args> struct impl_Five; } /*! Generates value 5 in the chosen type @par Semantic: @code T r = Five<T>(); @endcode is similar to: @code T r = T(5); @endcode **/ BOOST_SIMD_CONSTANT_IMPLEMENTATION(boost::simd::tag::Five, Five) } } #include <boost/simd/constant/common.hpp> #endif <|start_filename|>modules/core/sdk/unit/memory/composite_buffer.cpp<|end_filename|> //============================================================================== // Copyright 2003 - 2011 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2011 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #include <boost/config.hpp> #ifdef BOOST_MSVC #pragma warning(disable: 4996) // std::transform on pointers may be unsafe #endif #include <nt2/sdk/memory/buffer.hpp> #include <nt2/sdk/memory/composite_buffer.hpp> #include <boost/fusion/include/adapt_struct.hpp> #include <boost/simd/memory/aligned_array.hpp> #include <boost/fusion/include/io.hpp> #include <boost/fusion/include/make_vector.hpp> #include <nt2/sdk/memory/buffer.hpp> #include <nt2/sdk/unit/module.hpp> #include <nt2/sdk/unit/tests/basic.hpp> #include <nt2/sdk/unit/tests/relation.hpp> #include <nt2/sdk/unit/tests/type_expr.hpp> struct foo { double d; float f; short c; }; BOOST_FUSION_ADAPT_STRUCT(foo,(double,d)(float,f)(short,c)) struct data_type_ { template<class T> struct apply { typedef typename T::data_t type; }; }; //============================================================================== // Checks proper composite internal typedefs based on buffer //============================================================================== NT2_TEST_CASE( composite_buffer_typing ) { using boost::mpl::_; using nt2::meta::value_type_; using nt2::meta::reference_; using nt2::meta::const_reference_; using nt2::meta::pointer_; using nt2::meta::const_pointer_; using nt2::memory::composite_buffer; using nt2::container::composite_reference; using nt2::memory::buffer; NT2_TEST_EXPR_TYPE( (composite_buffer< buffer<foo> >()) , data_type_ , (boost::fusion::vector3<buffer<double>,buffer<float>,buffer<short> >) ); NT2_TEST_EXPR_TYPE( (composite_buffer< buffer<foo> >()) , value_type_<_> , (foo) ); NT2_TEST_EXPR_TYPE( (composite_buffer< buffer<foo> >()) , reference_<_> , (composite_reference<foo>) ); NT2_TEST_EXPR_TYPE( (composite_buffer< buffer<foo> >()) , const_reference_<_> , (composite_reference<foo const>) ); NT2_TEST_EXPR_TYPE( (composite_buffer< buffer<foo> >()) , pointer_<_> , (boost::fusion::vector3<double*,float*,short*>) ); NT2_TEST_EXPR_TYPE( (composite_buffer< buffer<foo> >()) , const_pointer_<_> , (boost::fusion::vector3<double const*,float const*,short const*>) ); } //============================================================================== // Checks proper composite internal typedefs based on aligned_array //============================================================================== NT2_TEST_CASE( composite_aligned_array_typing ) { using boost::mpl::_; using nt2::meta::value_type_; using nt2::meta::reference_; using nt2::meta::const_reference_; using nt2::meta::pointer_; using nt2::meta::const_pointer_; using nt2::memory::composite_buffer; using nt2::container::composite_reference; using boost::simd::aligned_array; NT2_TEST_EXPR_TYPE( (composite_buffer< aligned_array<foo,3,16> >()) , data_type_ , ( boost::fusion:: vector3 < aligned_array<double,3,16> , aligned_array<float,3,16> , aligned_array<short,3,16> > ) ); NT2_TEST_EXPR_TYPE( (composite_buffer< aligned_array<foo,3> >()) , value_type_<_> , (foo) ); NT2_TEST_EXPR_TYPE( (composite_buffer< aligned_array<foo,3> >()) , reference_<_> , (composite_reference<foo>) ); NT2_TEST_EXPR_TYPE( (composite_buffer< aligned_array<foo,3> >()) , const_reference_<_> , (composite_reference<foo const>) ); NT2_TEST_EXPR_TYPE( (composite_buffer< aligned_array<foo,3> >()) , pointer_<_> , (boost::fusion::vector3<double*,float*,short*>) ); NT2_TEST_EXPR_TYPE( (composite_buffer< aligned_array<foo,3> >()) , const_pointer_<_> , (boost::fusion::vector3<double const*,float const*,short const*>) ); } //============================================================================== // composite_buffer default constructor //============================================================================== NT2_TEST_CASE( composite_buffer_default_ctor ) { using nt2::memory::buffer; using nt2::memory::composite_buffer; composite_buffer< buffer<foo> > b; NT2_TEST(b.empty()); NT2_TEST_EQUAL(b.size() , 0u ); NT2_TEST_EQUAL(b.capacity() , 0u ); NT2_TEST_EQUAL(b.begin() , b.end() ); } //============================================================================== // composite_buffer allocator constructor //============================================================================== NT2_TEST_CASE( composite_buffer_allocator_ctor ) { using nt2::memory::buffer; using nt2::memory::composite_buffer; composite_buffer< buffer<foo> >::allocator_type allocs; composite_buffer< buffer<foo> > b(allocs); NT2_TEST(b.empty()); NT2_TEST_EQUAL(b.size() , 0u ); NT2_TEST_GREATER_EQUAL(b.capacity() , 0u ); NT2_TEST_EQUAL(b.begin() , b.end() ); } //============================================================================== // Test for size composite_buffer ctor //============================================================================== NT2_TEST_CASE( composite_buffer_size_ctor ) { using nt2::memory::buffer; using nt2::memory::composite_buffer; composite_buffer< buffer<foo> > b(5); NT2_TEST(!b.empty()); NT2_TEST_EQUAL(b.size() , 5u ); NT2_TEST_GREATER_EQUAL(b.capacity() , 5u ); for ( std::size_t i = 0; i < 5; ++i ) { foo f = {2.*i,3.f*i,short(i)}; b[i] = f; } for ( std::size_t i = 0; i < 5; ++i ) { foo f = {2.*i,3.f*i,short(i)}; NT2_TEST_EQUAL( b[i], boost::fusion::as_vector(f) ); } } //============================================================================== // Test for size+allocator composite_buffer ctor //============================================================================== NT2_TEST_CASE( composite_buffer_size_allocator_ctor ) { using nt2::memory::buffer; using nt2::memory::composite_buffer; composite_buffer< buffer<foo> >::allocator_type allocs; composite_buffer< buffer<foo> > b(5,allocs); NT2_TEST(!b.empty()); NT2_TEST_EQUAL(b.size() , 5u ); NT2_TEST_GREATER_EQUAL(b.capacity() , 5u ); for ( std::size_t i = 0; i < 5; ++i ) { foo f = {2.*i,3.f*i,short(i)}; b[i] = f; } for ( std::size_t i = 0; i < 5; ++i ) { foo f = {2.*i,3.f*i,short(i)}; NT2_TEST_EQUAL( b[i], boost::fusion::as_vector(f) ); } } //============================================================================== // Test for dynamic composite_buffer copy ctor //============================================================================== NT2_TEST_CASE( buffer_data_ctor) { using nt2::memory::buffer; using nt2::memory::composite_buffer; composite_buffer< buffer<foo> > b(5); for ( std::size_t i = 0; i < 5; ++i ) { foo f = {2.*i,3.f*i,short(i)}; b[i] = f; } composite_buffer< buffer<foo> > x(b); NT2_TEST(!x.empty()); NT2_TEST_EQUAL(x.size() , 5u ); NT2_TEST_GREATER_EQUAL(x.capacity() , 5u ); for ( std::size_t i = 0; i < 5; ++i ) { foo f = {2.*i,3.f*i,short(i)}; NT2_TEST_EQUAL( x[i], boost::fusion::as_vector(f) ); } } //============================================================================== // Test for buffer resize //============================================================================== NT2_TEST_CASE(buffer_resize) { using nt2::memory::buffer; using nt2::memory::composite_buffer; composite_buffer< buffer<foo> > b(5); for ( std::size_t i = 0; i < 5; ++i ) { foo f = {2.*i,3.f*i,short(i)}; b[i] = f; } b.resize(3); NT2_TEST(!b.empty()); NT2_TEST_EQUAL(b.size() , 3u ); NT2_TEST_GREATER_EQUAL(b.capacity() , 5u ); for ( std::size_t i = 0; i < 3; ++i ) { foo f = {2.*i,3.f*i,short(i)}; NT2_TEST_EQUAL( b[i], boost::fusion::as_vector(f) ); } b.resize(5); NT2_TEST(!b.empty()); NT2_TEST_EQUAL(b.size() , 5u ); NT2_TEST_GREATER_EQUAL(b.capacity() , 5u ); for ( std::size_t i = 0; i < 5; ++i ) { foo f = {2.*i,3.f*i,short(i)}; NT2_TEST_EQUAL( b[i], boost::fusion::as_vector(f) ); } b.resize(9); NT2_TEST(!b.empty()); NT2_TEST_EQUAL(b.size() , 9u ); NT2_TEST_GREATER_EQUAL(b.capacity() , 9u ); for ( std::size_t i = 0; i < 9; ++i ) { foo f = {-1.*i,i/2.f,short(i+1)}; b[i] = f; } for ( std::size_t i = 0; i < 9; ++i ) { foo f = {-1.*i,i/2.f,short(i+1)}; NT2_TEST_EQUAL( b[i], boost::fusion::as_vector(f) ); } b.resize(1); NT2_TEST(!b.empty()); NT2_TEST_EQUAL(b.size() , 1u ); NT2_TEST_GREATER_EQUAL(b.capacity() , 9u ); for ( std::size_t i = 0; i < 1; ++i ) { foo f = {-1.*i,i/2.f,short(i+1)}; NT2_TEST_EQUAL( b[i], boost::fusion::as_vector(f) ); } } //============================================================================== // Test for buffer assignment //============================================================================== NT2_TEST_CASE(buffer_assignment) { using nt2::memory::buffer; using nt2::memory::composite_buffer; composite_buffer< buffer<foo> > x, b(5); for ( std::size_t i = 0; i < 5; ++i ) { foo f = {2.*i,3.f*i,short(i)}; b[i] = f; } x = b; NT2_TEST(!x.empty()); NT2_TEST_EQUAL(x.size() , 5u ); NT2_TEST_GREATER_EQUAL(x.capacity() , 5u ); for ( std::size_t i = 0; i < 5; ++i ) { foo f = {2.*i,3.f*i,short(i)}; NT2_TEST_EQUAL( x[i], boost::fusion::as_vector(f) ); } } //============================================================================== // Test for buffer swap //============================================================================== NT2_TEST_CASE(buffer_swap) { using nt2::memory::buffer; using nt2::memory::composite_buffer; composite_buffer< buffer<foo> > x(7), b(5); for ( std::size_t i = 0; i < 5; ++i ) { foo f = {2.*i,3.f*i,short(i)}; b[i] = f; } for ( std::size_t i = 0; i < 7; ++i ) { foo f = {2.+i,3.f-i,short(1+i)}; x[i] = f; } swap(x,b); NT2_TEST(!x.empty()); NT2_TEST_EQUAL(x.size() , 5u ); NT2_TEST_GREATER_EQUAL(x.capacity() , 5u ); NT2_TEST(!b.empty()); NT2_TEST_EQUAL(b.size() , 7u ); NT2_TEST_GREATER_EQUAL(b.capacity() , 7u ); for ( std::size_t i = 0; i < 5; ++i ) { foo f = {2.*i,3.f*i,short(i)}; NT2_TEST_EQUAL( x[i], boost::fusion::as_vector(f) ); } for ( std::size_t i = 0; i < 7; ++i ) { foo f = {2.+i,3.f-i,short(1+i)}; NT2_TEST_EQUAL( b[i], boost::fusion::as_vector(f) ); } } //============================================================================== // buffer Range interface //============================================================================== struct f_ { template<class T> T operator()(T const& e) const { T that(e); boost::fusion::at_c<0>(that) *= 2; boost::fusion::at_c<1>(that) *= 10; boost::fusion::at_c<2>(that) *= 3; return e; } }; NT2_TEST_CASE(buffer_iterator) { using nt2::memory::buffer; using nt2::memory::composite_buffer; composite_buffer< buffer<foo> > x(5); composite_buffer< buffer<foo> > const xc(5); for ( std::size_t i = 0; i < 5; ++i ) { foo f = {2.*i,3.f*i,short(i)}; x[i] = f; } f_ f; composite_buffer< buffer<foo> >::iterator b = x.begin(); composite_buffer< buffer<foo> >::iterator e = x.end(); std::transform( b, e, b, f ); for ( std::size_t i = 0; i < 5; ++i ) { foo fx = {4.*i,30.f*i,short(3*i)}; NT2_TEST_EQUAL( x[i], boost::fusion::as_vector(fx) ); } } //============================================================================== // buffer push_back single value //============================================================================== NT2_TEST_CASE_TPL(buffer_push_back, NT2_TYPES ) { using nt2::memory::buffer; using nt2::memory::composite_buffer; composite_buffer< buffer<foo> > x(5); for ( std::size_t i = 0; i < 5; ++i ) { foo f = {2.*i,3.f*i,short(i)}; x[i] = f; } for ( std::size_t i = 0; i < 7; ++i ) { foo f = {-1.*i,3.f/i,short(i/2)}; x.push_back(f); } NT2_TEST_EQUAL( x.size(), 12u ); std::ptrdiff_t i = 0; for ( ; i < 5; ++i ) { foo f = {2.*i,3.f*i,short(i)}; NT2_TEST_EQUAL( x[i], boost::fusion::as_vector(f) ); } for ( ; i < 12; ++i ) { std::ptrdiff_t j = i-5; foo f = {-1.*j,3.f/j,short(j/2)}; NT2_TEST_EQUAL( x[i], boost::fusion::as_vector(f) ); } std::cout << "capacity = " << x.capacity() << std::endl; } //============================================================================== // Test for buffer append range //============================================================================== NT2_TEST_CASE(buffer_append_range) { using nt2::memory::buffer; using nt2::memory::composite_buffer; composite_buffer< buffer<foo> > x(7), b(5); for ( std::size_t i = 0; i < 7; ++i ) { foo f = {2.+i,3.f-i,short(1+i)}; x[i] = f; } for ( std::size_t i = 0; i < 5; ++i ) { foo f = {2.*i,3.f*i,short(i)}; b[i] = f; } x.append(b.begin(),b.end()); NT2_TEST_EQUAL(x.size() , 12u ); NT2_TEST_GREATER_EQUAL(x.capacity(), 12u ); std::size_t i = 0; for( ; i < 7; ++i ) { foo f = {2.+i,3.f-i,short(1+i)}; NT2_TEST_EQUAL( x[i], boost::fusion::as_vector(f) ); } for( ; i < 5; ++i ) { std::size_t j = i - 7; foo f = {2.*j,3.f*j,short(j)}; NT2_TEST_EQUAL( x[i], boost::fusion::as_vector(f) ); } } //============================================================================== // buffer push_back single value in empty buffer //============================================================================== NT2_TEST_CASE_TPL(buffer_push_back_def, NT2_TYPES ) { using nt2::memory::buffer; using nt2::memory::composite_buffer; composite_buffer< buffer<foo> > x; for ( std::size_t i = 0; i < 7; ++i ) { foo f = {-1.*i,3.f/i,short(i/2)}; x.push_back(f); } NT2_TEST_EQUAL( x.size(), 7u ); std::ptrdiff_t i = 0; for ( ; i < 7; ++i ) { foo f = {-1.*i,3.f/i,short(i/2)}; NT2_TEST_EQUAL( x[i], boost::fusion::as_vector(f) ); } std::cout << "capacity = " << x.capacity() << std::endl; } <|start_filename|>modules/boost/simd/base/include/boost/simd/bitwise/functions/rshr.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef BOOST_SIMD_BITWISE_FUNCTIONS_RSHR_HPP_INCLUDED #define BOOST_SIMD_BITWISE_FUNCTIONS_RSHR_HPP_INCLUDED #include <boost/simd/include/functor.hpp> #include <boost/dispatch/include/functor.hpp> namespace boost { namespace simd { namespace tag { /*! @brief rshr generic tag Represents the rshr function in generic contexts. @par Models: Hierarchy **/ struct rshr_ : ext::elementwise_<rshr_> { /// @brief Parent hierarchy typedef ext::elementwise_<rshr_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_rshr_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::rshr_, Site> dispatching_rshr_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::rshr_, Site>(); } template<class... Args> struct impl_rshr_; } /*! Returns the first entry shifted right or left by the absolute value of the second entry, according to its sign. @par semantic: For any given value @c x of type @c T, n of type @c I: @code T r = rshr(x, n); @endcode @see @funcref{rshl}, @funcref{shr}, @funcref{shl} @param a0 @param a1 @return a value of the same type as the first input. **/ BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::rshr_, rshr, 2) } } #endif <|start_filename|>modules/core/euler/include/nt2/euler/functions/details/erf_kernel.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2014 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2014 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_EULER_FUNCTIONS_DETAILS_ERF_KERNEL_HPP_INCLUDED #define NT2_EULER_FUNCTIONS_DETAILS_ERF_KERNEL_HPP_INCLUDED #include <nt2/include/functions/simd/multiplies.hpp> #include <nt2/include/functions/simd/oneminus.hpp> #include <nt2/polynomials/functions/scalar/impl/horner.hpp> #include <nt2/sdk/meta/scalar_of.hpp> //////////////////////////////////////////////////////////////////////////////// // These kernels allows some code factorization between erf and erfc // erfc is 1-erf // each one is better computed as 1 - the other at different spots // where digits cancellation may occur // Also these kernel codes are simd agnostic (generic) //////////////////////////////////////////////////////////////////////////////// namespace nt2 { namespace details { template < class A0, class sA0 = typename meta::scalar_of<A0>::type > struct erf_kernel; template < class A0 > struct erf_kernel < A0, float > { typedef typename meta::scalar_of<A0>::type sA0; // computes erf(a0)/a0 for float or float vectors // xx is sqr(a0) and 0 <= abs(x) <= 2/3 static BOOST_FORCEINLINE A0 erf1(const A0& xx) { return horner<NT2_HORNER_COEFF_T(sA0, 6, (0xba1fc83b, // -6.095205117313012e-04 0x3ba4468d, // 5.013293006147870e-03 0xbcdb61f4, // -2.678010670585737e-02 0x3de70f22, // 1.128218315189123e-01 0xbec0937e, // -3.761252839094832e-01 0x3f906eba) // 1.128379154774254e+00 )> (xx); } // computes erfc(x)*exp(sqr(x)) for float or float vectors // x >= 2/3 static BOOST_FORCEINLINE A0 erfc2(const A0& z) { // approximation of erfc(z1./(1-z1))).*exp((z1./(1-z1)).^2) (z1 = z+0.4) on [0 0.5] // with a polynomial of degree 11 gives 16 ulp on [2/3 inf] for erfc // (exhaustive test against float(erfc(double(x)))) // z is A0 z = x/oneplus(x)-A0(0.4); return horner<NT2_HORNER_COEFF_T(sA0, 11, ( 0xc0283611, // -2.628299919293280e+00 0x40d67e3b, // 6.702908785399893e+00 0xc0cd1a85, // -6.409487379234005e+00 0x4050b063, // 3.260765682222576e+00 0xbfaea865, // -1.364514006347145e+00 0x3e2006f0, // 1.562764709849380e-01 0x3e1175c7, // 1.420508523645926e-01 0x3ec4ca6e, // 3.843569094305250e-01 0x3e243828, // 1.603704761054187e-01 0xbf918a62, // -1.137035586823118e+00 0x3f0a0e8b // 5.392844046572836e-01 ) )> (z); } // computes erfc(x)*exp(sqr(x)) for float or float vectors // x >= 2/3 static BOOST_FORCEINLINE A0 erfc3(const A0& z) { // approximation of erfc(z./(1-z))./(1-z) on [0 0.4] // with a polynomial of degree 8 gives 2 ulp on [0 2/3] for erfc // (exhaustive test against float(erfc(double(x)))) // z is A0 z = x/oneplus(x); return oneminus(z)* horner<NT2_HORNER_COEFF_T(sA0, 9, ( 0x41aa8e55, // 2.1319498e+01 0x401b5680, // 2.4271545e+00 0xc010d956, // -2.2632651e+00 0x3f2cff3b, // 6.7576951e-01 0xc016c985, // -2.3560498e+00 0xbffc9284, // -1.9732213e+00 0xbfa11698, // -1.2585020e+00 0xbe036d7e, // -1.2834737e-01 0x3f7ffffe // 9.9999988e-01 ) )> (z); } }; template < class A0 > struct erf_kernel < A0, double > { typedef typename meta::scalar_of<A0>::type sA0; // computes erf(a0)/a0 for double or double vectors // xx is sqr(a0) and 0 <= abs(a0) <= 0.65 static BOOST_FORCEINLINE A0 erf1(const A0& xx) { return NT2_HORNER_RAT(sA0, 5, 5, xx, (0x3f110512d5b20332ull, // 6.49254556481904E-05 0x3f53b7664358865aull, // 1.20339380863079E-03 0x3fa4a59a4f02579cull, // 4.03259488531795E-02 0x3fc16500f106c0a5ull, // 0.135894887627278 0x3ff20dd750429b61ull // 1.12837916709551 ), (0x3f37ea4332348252ull, // 3.64915280629351E-04 0x3f8166f75999dbd1ull, // 8.49717371168693E-03 0x3fb64536ca92ea2full, // 8.69936222615386E-02 0x3fdd0a84eb1ca867ull, // 0.453767041780003 0x3ff0000000000000ull // 1 ) ); } // computes erfc(x)*exp(x*x) for double or double vectors // 0.65 <= abs(x) <= 2.2 static BOOST_FORCEINLINE A0 erfc2(const A0& x) { return NT2_HORNER_RAT(sA0, 7, 7, x, (0x0ull, // 0 0x3f7cf4cfe0aacbb4ull, // 7.06940843763253E-03 0x3fb2488a6b5cb5e5ull, // 7.14193832506776E-02 0x3fd53dd7a67c7e9full, // 0.331899559578213 0x3fec1986509e687bull, // 0.878115804155882 0x3ff54dfe9b258a60ull, // 1.33154163936765 0x3feffffffbbb552bull // 0.999999992049799 ), (0x3f89a996639b0d00ull, // 1.25304936549413E-02 0x3fc033c113a7deeeull, // 0.126579413030178 0x3fe307622fcff772ull, // 0.594651311286482 0x3ff9e677c2777c3cull, // 1.61876655543871 0x40053b1052dca8bdull, // 2.65383972869776 0x4003adeae79b9708ull, // 2.45992070144246 0x3ff0000000000000ull // 1 ) ); } // computes erfc(x)*exp(x*x) for double or double vectors // 2.2 <= abs(x) <= 6 static BOOST_FORCEINLINE A0 erfc3(const A0& x) { return NT2_HORNER_RAT(sA0, 7, 7, x, (0x0ll, //0 0x3f971d0907ea7a92ull, //2.25716982919218E-02 0x3fc42210f88b9d43ull, //0.157289620742839 0x3fe29be1cff90d94ull, //0.581528574177741 0x3ff44744306832aeull, //1.26739901455873 0x3ff9fa202deb88e5ull, //1.62356584489367 0x3fefff5a9e697ae2ull //0.99992114009714 ), (0x3fa47bd61bbb3843ull, //4.00072964526861E-02 0x3fd1d7ab774bb837ull, //0.278788439273629 0x3ff0cfd4cb6cde9full, //1.05074004614827 0x400315ffdfd5ce91ull, //2.38574194785344 0x400afd487397568full, //3.37367334657285 0x400602f24bf3fdb6ull, //2.75143870676376 0x3ff0000000000000ull //1 ) ); } }; } } #endif <|start_filename|>modules/core/bessel/include/nt2/bessel/functions/i0.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_BESSEL_FUNCTIONS_I0_HPP_INCLUDED #define NT2_BESSEL_FUNCTIONS_I0_HPP_INCLUDED #include <nt2/include/functor.hpp> namespace nt2 { namespace tag { /*! @brief i0 generic tag Represents the i0 function in generic contexts. @par Models: Hierarchy **/ struct i0_ : ext::elementwise_<i0_> { /// @brief Parent hierarchy typedef ext::elementwise_<i0_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_i0_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::i0_, Site> dispatching_i0_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::i0_, Site>(); } template<class... Args> struct impl_i0_; } /*! Modified Bessel function of the first kind of order 0. @par Semantic: For every parameter of floating type T0 @code T0 r = i0(a0); @endcode Computes \f$\displaystyle \sum_0^\infty \frac{(x^2/4)^k}{(k!)^2}\f$ @param a0 @return a value of the same type as the parameter **/ NT2_FUNCTION_IMPLEMENTATION(tag::i0_, i0, 1) } #endif <|start_filename|>modules/core/exponential/include/nt2/exponential/constants/exp_1.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2011 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2011 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_EXPONENTIAL_CONSTANTS_EXP_1_HPP_INCLUDED #define NT2_EXPONENTIAL_CONSTANTS_EXP_1_HPP_INCLUDED #include <nt2/include/functor.hpp> #include <boost/simd/constant/hierarchy.hpp> #include <boost/simd/constant/register.hpp> namespace nt2 { namespace tag { /*! @brief Exp_1 generic tag Represents the Exp_1 constant in generic contexts. @par Models: Hierarchy **/ BOOST_SIMD_CONSTANT_REGISTER( Exp_1, double , 2, 0x402df854 , 0x4005bf0a8b145769LL ) } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::Exp_1, Site> dispatching_Exp_1(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::Exp_1, Site>(); } template<class... Args> struct impl_Exp_1; } /*! Generates constant e. @par Semantic: The e constant is the real number such that \f$\log(e) = 1\f$ @code T r = Exp_1<T>(); @endcode is similar to: @code r = T(2.71828182845904523536028747135266249775724709369995); @endcode **/ BOOST_SIMD_CONSTANT_IMPLEMENTATION(tag::Exp_1, Exp_1); } #endif <|start_filename|>modules/boost/simd/base/include/boost/simd/constant/constants/fact_11.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2011 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 20011 - 2011 LRI UMR 11623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef BOOST_SIMD_CONSTANT_CONSTANTS_FACT_11_HPP_INCLUDED #define BOOST_SIMD_CONSTANT_CONSTANTS_FACT_11_HPP_INCLUDED #include <boost/simd/include/functor.hpp> #include <boost/simd/constant/register.hpp> #include <boost/simd/constant/hierarchy.hpp> #include <boost/config.hpp> #ifdef BOOST_MSVC #pragma warning(push) #pragma warning(disable: 4310) // truncation of constant #endif namespace boost { namespace simd { namespace tag { /*! @brief Fact_11 generic tag Represents the Fact_11 constant in generic contexts. @par Models: Hierarchy **/ BOOST_SIMD_CONSTANT_REGISTER( Fact_11,double , 39916800,0x4c184540,0x418308a800000000ll ) } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::Fact_11, Site> dispatching_Fact_11(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::Fact_11, Site>(); } template<class... Args> struct impl_Fact_11; } /*! Generates 11! that is 39916800, @par Semantic: @code T r = Fact_11<T>(); @endcode is similar to: @code T r = T(39916800); @endcode **/ BOOST_SIMD_CONSTANT_IMPLEMENTATION(boost::simd::tag::Fact_11, Fact_11) } } #ifdef BOOST_MSVC #pragma warning(pop) #endif #include <boost/simd/constant/common.hpp> #endif <|start_filename|>modules/core/gallery/include/nt2/gallery/functions/jordbloc.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_GALLERY_FUNCTIONS_JORDBLOC_HPP_INCLUDED #define NT2_GALLERY_FUNCTIONS_JORDBLOC_HPP_INCLUDED #include <nt2/include/functor.hpp> #include <nt2/include/constants/one.hpp> /*! * \ingroup algebra * \defgroup algebra_jordbloc jordbloc * * \par Description * jordbloc matrix * is the n-by-n jordan block * with eigenvalue lambda. lambda = 1 is the default. * * \par Header file * * \code * #include <nt2/include/functions/jordbloc.hpp> * \endcode * **/ //============================================================================== // jordbloc actual class forward declaration //============================================================================== namespace nt2 { namespace tag { /*! * \brief Define the tag jordbloc_ of functor jordbloc * in namespace nt2::tag for toolbox algebra **/ struct jordbloc_ : ext::abstract_<jordbloc_> { typedef ext::abstract_<jordbloc_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_jordbloc_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::jordbloc_, Site> dispatching_jordbloc_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::jordbloc_, Site>(); } template<class... Args> struct impl_jordbloc_; } NT2_FUNCTION_IMPLEMENTATION(tag::jordbloc_, jordbloc, 2) template<class T, class A0> typename meta::call<tag::jordbloc_(const A0 &, const T &)>::type jordbloc(const A0& n) { return nt2::jordbloc(n, nt2::One<T>()); } template<class A0, class A1, class Target> typename meta::call<tag::jordbloc_(const A0 &, typename Target::type const &)>::type jordbloc(const A0& n, const A1& lambda, const Target&) { typedef typename Target::type t_t; return nt2::jordbloc(n,t_t(lambda)); } } #endif <|start_filename|>modules/binding/magma/include/nt2/linalg/functions/magma/posv.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_LINALG_FUNCTIONS_MAGMA_POSV_HPP_INCLUDED #define NT2_LINALG_FUNCTIONS_MAGMA_POSV_HPP_INCLUDED #if defined(NT2_USE_MAGMA) #include <nt2/linalg/functions/posv.hpp> #include <nt2/include/functions/xerbla.hpp> #include <nt2/sdk/magma/magma.hpp> #include <nt2/dsl/functions/terminal.hpp> #include <nt2/core/container/table/kind.hpp> #include <nt2/include/functions/of_size.hpp> #include <nt2/include/functions/height.hpp> #include <nt2/include/functions/width.hpp> #include <nt2/linalg/details/utility/f77_wrapper.hpp> #include <magma.h> namespace nt2 { namespace ext { BOOST_DISPATCH_IMPLEMENT ( posv_, nt2::tag::magma_<site> , (A0)(S0)(A1)(S1)(site) , ((container_<nt2::tag::table_, double_<A0>, S0 >)) ((container_<nt2::tag::table_, double_<A1>, S1 >)) ) { typedef nt2_la_int result_type; BOOST_FORCEINLINE result_type operator()(A0& a0, A1& a1) const { result_type that; nt2_la_int n = nt2::width(a0); nt2_la_int ld = a0.leading_size(); nt2_la_int ldb = a1.leading_size(); nt2_la_int nhrs = nt2::width(a1); magma_dposv( MagmaLower, n, nhrs, a0.data(), ld, a1.data(), ldb, &that); return that; } }; BOOST_DISPATCH_IMPLEMENT ( posv_, nt2::tag::magma_<site> , (A0)(S0)(A1)(S1)(site) , ((container_<nt2::tag::table_, single_<A0>, S0 >)) ((container_<nt2::tag::table_, single_<A1>, S1 >)) ) { typedef nt2_la_int result_type; BOOST_FORCEINLINE result_type operator()(A0& a0, A1& a1) const { result_type that; nt2_la_int n = nt2::width(a0); nt2_la_int ld = a0.leading_size(); nt2_la_int ldb = a1.leading_size(); nt2_la_int nhrs = nt2::width(a1); magma_sposv( MagmaLower, n, nhrs, a0.data(), ld, a1.data(), ldb , &that ); return that; } }; /// INTERNAL ONLY BOOST_DISPATCH_IMPLEMENT ( posv_, nt2::tag::magma_<site> , (A0)(S0)(A1)(S1)(site) , ((container_< nt2::tag::table_, complex_<double_<A0> >, S0 >)) // A ((container_< nt2::tag::table_, complex_<double_<A1> >, S1 >)) // B ) { typedef nt2_la_int result_type; BOOST_FORCEINLINE result_type operator()(A0& a0, A1& a1) const { result_type that; nt2_la_int n = nt2::width(a0); nt2_la_int ld = a0.leading_size(); nt2_la_int ldb = a1.leading_size(); nt2_la_int nhrs = nt2::width(a1); magma_zposv( MagmaLower, n, nhrs, (cuDoubleComplex*)a0.data(), ld, (cuDoubleComplex*)a1.data(), ldb , &that ); return that; } }; /// INTERNAL ONLY BOOST_DISPATCH_IMPLEMENT ( posv_, nt2::tag::magma_<site> , (A0)(S0)(A1)(S1)(site) , ((container_< nt2::tag::table_, complex_<single_<A0> >, S0 >)) // A ((container_< nt2::tag::table_, complex_<single_<A1> >, S1 >)) // B ) { typedef nt2_la_int result_type; BOOST_FORCEINLINE result_type operator()(A0& a0, A1& a1) const { result_type that; nt2_la_int n = nt2::width(a0); nt2_la_int ld = a0.leading_size(); nt2_la_int ldb = a1.leading_size(); nt2_la_int nhrs = nt2::width(a1); magma_cposv( MagmaLower, n, nhrs, (cuFloatComplex*)a0.data(), ld, (cuFloatComplex*) a1.data(), ldb, &that); return that; } }; } } #endif #endif <|start_filename|>modules/core/gallery/include/nt2/gallery/functions/redheff.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_GALLERY_FUNCTIONS_REDHEFF_HPP_INCLUDED #define NT2_GALLERY_FUNCTIONS_REDHEFF_HPP_INCLUDED #include <nt2/include/functor.hpp> /*! * \ingroup algebra * \defgroup algebra_redheff redheff * * a = gallery('redheff',n) is an n-by-n matrix of 0s and 1s * defined by * a(i,j) = 1, if j = 1 or if i divides j, * = 0 otherwise. * * properties: * a has n-floor(log2(n))-1 eigenvalues equal to 1, * a real eigenvalue (the spectral radius) approximately sqrt(n), * a negative eigenvalue approximately -sqrt(n), * and the remaining eigenvalues are provably "small". * * the riemann hypothesis is true if and only if * det(a) = o( n^(1/2+epsilon) ) for every epsilon > 0. * * note: * Barrett and Jarvis [1] conjecture that "the small eigenvalues * all lie inside the unit circle abs(z) = 1". a proof of this * conjecture, together with a proof that some eigenvalue tends to * zero as n tends to infinity, would yield a new proof of the * prime number theorem. * * Reference: * [1] <NAME> and <NAME>, Spectral Properties of a * Matrix of Redheffer, Linear Algebra and Appl., * 162 (1992), pp. 673-683. * !* \par Header file * * \code * #include <nt2/include/functions/redheff.hpp> * \endcode * **/ //============================================================================== // redheff actual class forward declaration //============================================================================== namespace nt2 { namespace tag { /*! * \brief Define the tag redheff_ of functor redheff * in namespace nt2::tag for toolbox algebra **/ struct redheff_ : ext::abstract_<redheff_> { typedef ext::abstract_<redheff_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_redheff_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::redheff_, Site> dispatching_redheff_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::redheff_, Site>(); } template<class... Args> struct impl_redheff_; } BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::redheff_, redheff, 2) } #endif <|start_filename|>modules/boost/simd/base/include/boost/simd/predicates/functions/is_negative.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef BOOST_SIMD_PREDICATES_FUNCTIONS_IS_NEGATIVE_HPP_INCLUDED #define BOOST_SIMD_PREDICATES_FUNCTIONS_IS_NEGATIVE_HPP_INCLUDED #include <boost/simd/include/functor.hpp> #include <boost/dispatch/include/functor.hpp> namespace boost { namespace simd { namespace tag { /*! @brief is_negative generic tag Represents the is_negative function in generic contexts. @par Models: Hierarchy **/ struct is_negative_ : ext::elementwise_<is_negative_> { /// @brief Parent hierarchy typedef ext::elementwise_<is_negative_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_is_negative_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) };} namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::is_negative_, Site> dispatching_is_negative_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::is_negative_, Site>(); } template<class... Args> struct impl_is_negative_; } /*! Returns True if a0 is negative else False. This function differs from is_ltz from floating point argument, because Mzero is negative but not less than zero. and Mzero is not positive and not greater than zero, It's probably is_ltz that you want. @par Semantic: @code logical<T> r = is_negative(a0); @endcode is similar to: @code if T is signed logical<T> r = bitofsign(a0) == 1; else logical<T> r = False; @endcode @par Note: Mzero is the floating point 'minus zero', i.e. all bits are zero but the sign bit. Such a value is treated as zero by ieee standards. @param a0 @return a logical value **/ BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::is_negative_, is_negative, 1) } } #endif <|start_filename|>modules/boost/simd/sdk/include/boost/simd/memory/functions/bitwise_cast.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2011 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2013 LRI UMR 8623 CNRS/Univ Paris Sud XI // Copyright 2011 - 2013 MetaScale SAS // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef BOOST_SIMD_MEMORY_FUNCTIONS_BITWISE_CAST_HPP_INCLUDED #define BOOST_SIMD_MEMORY_FUNCTIONS_BITWISE_CAST_HPP_INCLUDED #include <boost/simd/include/functor.hpp> #include <boost/dispatch/meta/as.hpp> #include <boost/dispatch/include/functor.hpp> namespace boost { namespace simd { namespace tag { /*! @brief bitwise_cast generic tag Represents the bitwise_cast function in generic contexts. **/ struct bitwise_cast_ : ext::elementwise_<bitwise_cast_> { /// @brief Parent hierarchy typedef ext::elementwise_<bitwise_cast_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_bitwise_cast_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::bitwise_cast_, Site> dispatching_bitwise_cast_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::bitwise_cast_, Site>(); } template<class... Args> struct impl_bitwise_cast_; } /*! @brief Bitwise cast bitwise_cast performs a bit-preserving cast of its parameters into an arbitrary type @c Target. @pre @code sizeof(a0) == sizeof(Target) @endcode @tparam Target Target type to cast toward @param value Value to cast @return A value of type @c Target which is bit-equivalent to @c value. @usage_output{memory/bitwise_cast.cpp,memory/bitwise_cast.out} **/ template<typename Target, typename Value> BOOST_FORCEINLINE typename boost::dispatch::meta:: result_of< typename boost::dispatch::meta:: dispatch_call<tag::bitwise_cast_( Value const& , boost::dispatch::meta::as_<Target> const& ) >::type ( Value const& , boost::dispatch::meta::as_<Target> const& ) >::type bitwise_cast(Value const& value) { typename boost::dispatch::meta:: dispatch_call<tag::bitwise_cast_( Value const& , boost::dispatch::meta::as_<Target> const& ) >::type callee; dispatch::meta::as_<Target> const target = {}; return callee(value, target); } } } #endif <|start_filename|>modules/core/trigonometric/include/nt2/trigonometric/functions/fast_sincospi.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_TRIGONOMETRIC_FUNCTIONS_FAST_SINCOSPI_HPP_INCLUDED #define NT2_TRIGONOMETRIC_FUNCTIONS_FAST_SINCOSPI_HPP_INCLUDED #include <nt2/include/functor.hpp> namespace nt2 { namespace tag { /*! @brief fast_sincospi generic tag Represents the fast_sincospi function in generic contexts. @par Models: Hierarchy **/ struct fast_sincospi_ : ext::elementwise_<fast_sincospi_> { typedef ext::elementwise_<fast_sincospi_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_fast_sincospi_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::fast_sincospi_, Site> dispatching_fast_sincospi_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::fast_sincospi_, Site>(); } template<class... Args> struct impl_fast_sincospi_; } /*! Computes simultaneously sine and cosine from angle in \f$\pi\f$ multiples in the interval \f$[-1/4,1/4]\f$, nan outside. @par Semantic: For every parameter of floating type T0 @code T0 c, s; tie(s, c)= fast_sincospi(a0); @endcode is similar to: @code T0 c = fast_cospi(x); T0 s = fast_sinpi(x); @endcode @see @funcref{fast_sinpi}, @funcref{sincospi}, @funcref{fast_cospi} @param a0 input @return a pair of value of the same type as the parameter **/ NT2_FUNCTION_IMPLEMENTATION(tag::fast_sincospi_, fast_sincospi, 1) /*! Computes simultaneously sine and cosine from angle in \f$\pi\f$ multiples in the interval \f$[-1/4,1/4]\f$, nan outside. @par Semantic: For every parameter of floating type T0 @code T0 c, s; s = fast_sincospi(x, c); @endcode is similar to: @code T0 c = fast_cospi(x); T0 s = fast_sinpi(x); @endcode @see @funcref{fast_sinpi}, @funcref{sincospi}, @funcref{fast_cospi} @param a0 input in pi multiples @param a1 L-Value that will receive the cosine of a0 @return the sine of a0 **/ NT2_FUNCTION_IMPLEMENTATION_TPL(tag::fast_sincospi_, fast_sincospi,(A0 const&)(A1&),2) /*! Computes simultaneously sine and cosine from angle in \f$\pi\f$ multiples in the interval \f$[-1/4,1/4]\f$, nan outside. @par Semantic: For every parameter of floating type T0 @code T0 c, s; fast_sincospi(x, s, c); @endcode is similar to: @code T0 c = fast_cospi(x); T0 s = fast_sinpi(x); @endcode @see @funcref{fast_sinpi}, @funcref{sincospi}, @funcref{fast_cospi} @param a0 input in pi multiples @param a1 L-Value that will receive the sine of a0 @param a2 L-Value that will receive the cosine of a0 **/ NT2_FUNCTION_IMPLEMENTATION_TPL(tag::fast_sincospi_, fast_sincospi,(A0 const&)(A1&)(A2&),3) } #endif <|start_filename|>modules/core/reduction/include/nt2/core/functions/globalnorm.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_CORE_FUNCTIONS_GLOBALNORM_HPP_INCLUDED #define NT2_CORE_FUNCTIONS_GLOBALNORM_HPP_INCLUDED #include <nt2/include/functor.hpp> #include <nt2/sdk/meta/as_real.hpp> #include <boost/mpl/int.hpp> namespace nt2 { namespace tag { /*! @brief globalnorm generic tag Represents the globalnorm function in generic contexts. @par Models: Hierarchy **/ struct globalnorm_ : ext::abstract_<globalnorm_> { /// @brief Parent hierarchy typedef ext::abstract_<globalnorm_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_globalnorm_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::globalnorm_, Site> dispatching_globalnorm_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::globalnorm_, Site>(); } template<class... Args> struct impl_globalnorm_; } /*! @brief Global norm Computes the norm of a whole table expression with static or dynamic choice of the norm computation formula. Call protocols to globalnorm are summarized in the following table. We advise to use static calls whenever possible as it prevents cascaded run-time if clauses and goes directly to the right call at execution. @code |--------------------|-------------------|------------------------------|-------------------| | mnorm(a0, p) | |--------------------|-------------------|------------------------------|-------------------| | static p | dynamic p | formula (pseudo-code) | equivalent to | |--------------------|-------------------|------------------------------|-------------------| | nt2::one_ | 1 | sum(abs(x(_))) | globalnorm1(x) | | nt2::two_ | 2 | sqrt(sum(sqr(abs(x(_))))) | globalnorm2(x) | | - | p (positive) | sum(abs(x)^p)^(1/p) | globalnormp(x,p) | | nt2::inf_ | nt2::Inf<T>() | max(abs((x)) | globalnorminf(x) | | nt2::fro_ | -1 | sqrt(sum(sqr(abs(x(_))))) | globalnormfro(x) | |--------------------|-------------------|------------------------------|-------------------| | mnorm<p>(a0) | |--------------------|-------------------|------------------------------|-------------------| | static p | | matrix | | |--------------------|-------------------|------------------------------|-------------------| | nt2::tag::one_ or 1| - | sum(abs(x(_))) | globalnorm1(x) | | nt2::tag::two_ or 2| - | sqrt(sum(sqr(abs(x(_))))) | globalnorm2(x) | | p (integer only) | - | sum(abs(x)^p)^(1/p) | globalnormp(x,p) | | nt2::tag::inf_ | - | max(abs((x)) | globalnorminf(x) | | nt2::tag::fro_ | - | sqrt(sum(sqr(abs(x(_))))) | globalnormfro(x) | |--------------------|-------------------|------------------------------|-------------------| @endcode @par Semantic: For any expression @c a0 of type @c A0, the following call: @code as_real<A0::value_type>::type x = globalnorm(a0); @endcode is equivalent to: @code as_real<A0::value_type>::type x = globalnorm2(a0); @endcode For any expression @c a0 of type @c A0 and any floating point value @c p, the following call: @code as_real<A0::value_type>::type x = globalnorm(a0,p); @endcode is equivalent to: @code as_real<A0::value_type>::type x = globalnormp(a0,p); @endcode if @c p is finite and to : @code as_real<A0::value_type>::type x = globalmax(abs(a0)); @endcode if @c is +Inf and to : @code as_real<A0::value_type>::type x = globalmin(abs(a0)); @endcode if @c p is -Inf. @note If 0 < p < 1 or p = -inf, globalnorm does not share the properties that define a mathematical norm, but only a quasi-norm if 0 < p < 1 and a notation facility for p = -inf. @par Static Interface globalnorm can also be invoked with a template parameter which is either a functor tag describing the constant value to use instead of @c p or an Integral Constant. For example, @code as_real<A0::value_type>::type x = globalnorm<tag::two_>(a0); @endcode is equivalent to: @code as_real<A0::value_type>::type x = globalnorm2(a0); @endcode Similarly, @code as_real<A0::value_type>::type x = globalnorm<5>(a0); @endcode is equivalent to: @code as_real<A0::value_type>::type x = globalnormp(a0,5); @endcode @note Whenever a constant functor tag or an Integral Constant is used, compile time optimization is performed (if available) so the correct variant of globalnorm is called. For example, calls similar to globalnorm<2>(a0) will invoke globalnorm2(a0) instead of globalnormp(a0, 2), and globalnorm<5>(a0) will simply invoke directly globalnormp(a0, 5) but without any runtime selection. @param a0 Expression to compute the norm of @param a1 Type of norm to compute **/ BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(nt2::tag::globalnorm_, globalnorm, 2) /// @overload BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(nt2::tag::globalnorm_, globalnorm, 1) /// @overload template<typename Tag, typename A0> BOOST_FORCEINLINE typename meta::as_real<typename A0::value_type>::type globalnorm(const A0& a0) { return globalnorm(a0, nt2::meta::as_<Tag>()); } /// @overload template<int Value, typename A0> BOOST_FORCEINLINE typename meta::as_real<typename A0::value_type>::type globalnorm(const A0& a0) { return globalnorm(a0, boost::mpl::int_<Value>() ); } } #endif <|start_filename|>modules/core/trigonometric/include/nt2/trigonometric/constants/_30.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2011 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2011 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_TRIGONOMETRIC_CONSTANTS_30_HPP_INCLUDED #define NT2_TRIGONOMETRIC_CONSTANTS_30_HPP_INCLUDED #include <nt2/include/functor.hpp> #include <boost/simd/constant/hierarchy.hpp> #include <boost/simd/constant/register.hpp> namespace nt2 { namespace tag { /*! @brief _30 generic tag Represents the _30 constant in generic contexts. @par Models: Hierarchy **/ BOOST_SIMD_CONSTANT_REGISTER( _30, double , 30, 0x41f00000UL , 0x403e000000000000ULL ) } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::_30, Site> dispatching__30(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::_30, Site>(); } template<class... Args> struct impl__30; } /*! Constant 30. @par Semantic: For type T0: @code T0 r = _30<T0>(); @endcode is similar to: @code T0 r = 30; @endcode @return a value of type T0 **/ BOOST_SIMD_CONSTANT_IMPLEMENTATION(tag::_30, _30); } #endif <|start_filename|>modules/boost/simd/base/include/boost/simd/constant/constants/thousand.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2011 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2011 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef BOOST_SIMD_CONSTANT_CONSTANTS_THOUSAND_HPP_INCLUDED #define BOOST_SIMD_CONSTANT_CONSTANTS_THOUSAND_HPP_INCLUDED #include <boost/simd/include/functor.hpp> #include <boost/simd/constant/register.hpp> #include <boost/simd/constant/hierarchy.hpp> #include <boost/config.hpp> #ifdef BOOST_MSVC #pragma warning(push) #pragma warning(disable: 4310) // truncation of constant #endif namespace boost { namespace simd { namespace tag { /*! @brief Thousand generic tag Represents the Thousand constant in generic contexts. @par Models: Hierarchy **/ BOOST_SIMD_CONSTANT_REGISTER(Thousand,double,1000, 0x447a0000, 0x408f400000000000ll) } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::Thousand, Site> dispatching_Thousand(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::Thousand, Site>(); } template<class... Args> struct impl_Thousand; } /*! Generates value 1000 @par Semantic: @code T r = Thousand<T>(); @endcode is similar to: @code T r = T(1000); @endcode **/ BOOST_SIMD_CONSTANT_IMPLEMENTATION(boost::simd::tag::Thousand, Thousand) } } #ifdef BOOST_MSVC #pragma warning(pop) #endif #include <boost/simd/constant/common.hpp> #endif <|start_filename|>modules/boost/simd/base/include/boost/simd/arithmetic/functions/two_prod.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef BOOST_SIMD_ARITHMETIC_FUNCTIONS_TWO_PROD_HPP_INCLUDED #define BOOST_SIMD_ARITHMETIC_FUNCTIONS_TWO_PROD_HPP_INCLUDED #include <boost/simd/include/functor.hpp> #include <boost/dispatch/include/functor.hpp> /*! @file @brief Definition of the two_prod function **/ namespace boost { namespace simd { namespace tag { /// @brief Hierarchy tag for two_prod function struct two_prod_ : ext::elementwise_<two_prod_> { typedef ext::elementwise_<two_prod_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_two_prod_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::two_prod_, Site> dispatching_two_prod_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::two_prod_, Site>(); } template<class... Args> struct impl_two_prod_; } /*! @brief For any two reals @c a0 and @c a1 two_prod computes two reals @c r0 and @c r1 so that: @code r0 = a0* a1 r1 = r0 -(a0 * a1) @endcode using perfect arithmetic. Its main usage is to be able to compute sum of reals and the residual error using IEEE 754 arithmetic. @param a0 First parameter of the sum @param a1 Second parameter of the sum @return A Fusion Sequence containing @c a0+a1 and the residual. **/ BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::two_prod_, two_prod, 2) /*! @brief For any two reals @c a0 and @c a1 two_prod computes two reals @c r0 and @c r1 so that: @code r0 = a0 * a1 r1 = r0 -(a0 * a1) @endcode using perfect arithmetic. Its main usage is to be able to compute sum of reals and the residual error using IEEE 754 arithmetic. @param a0 First parameter of the sum @param a1 Second parameter of the sum @param a2 L-Value that will receive @c a0+a1 @return The sum residual. **/ BOOST_DISPATCH_FUNCTION_IMPLEMENTATION_TPL( tag::two_prod_, two_prod , (A0 const&)(A1 const&)(A2&) , 3 ) /*! @brief For any two reals @c a0 and @c a1 two_prod computes two reals @c r0 and @c r1 so that: @code r0 = a0 * a1 r1 = r0 -(a0 * a1) @endcode using perfect arithmetic. Its main usage is to be able to compute sum of reals and the residual error using IEEE 754 arithmetic. @param a0 First parameter of the sum @param a1 Second parameter of the sum @param a2 L-Value that will receive @c a0+a1. @param a3 L-Value that will receive @c a0+a1 residual. **/ BOOST_DISPATCH_FUNCTION_IMPLEMENTATION_TPL( tag::two_prod_, two_prod , (A0 const&)(A1 const&)(A2&)(A3&) , 4 ) } } #endif <|start_filename|>modules/core/reduction/include/nt2/core/functions/globalmax.hpp<|end_filename|> //============================================================================== // Copyright 2003 & onward LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 & onward LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_CORE_FUNCTIONS_GLOBALMAX_HPP_INCLUDED #define NT2_CORE_FUNCTIONS_GLOBALMAX_HPP_INCLUDED #include <nt2/include/functor.hpp> #include <nt2/include/functions/maximum.hpp> #include <nt2/include/functions/global.hpp> #include <nt2/include/functions/is_equal.hpp> #include <nt2/include/functions/globalfind.hpp> namespace nt2 { namespace tag { /*! @brief Tag for the globalmax functor **/ struct globalmax_ : ext::abstract_<globalmax_> { /// @brief Parent hierarchy typedef ext::abstract_<globalmax_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_globalmax_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::globalmax_, Site> dispatching_globalmax_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::globalmax_, Site>(); } template<class... Args> struct impl_globalmax_; } /*! @brief maximum of all the elements of a table expression and its position. Computes maximum of all the elements of a table expression and optionaly its linear index @par Semantic For any table expression @c t: @code T r = globalmax(t); @endcode is equivalent to: @code T r = max(a(_)); @endcode and @code ptrdiff_t i; T m = globalmax(t, i); @endcode is equivalent to: @code T r = max(a(_)); ptrdiff_t i = globalfind(eq(a0, m)) @endcode @see @funcref{colon}, @funcref{max}, @funcref{globalfind} @param a0 Table to process @param a1 optional L-value to receive the index @return An expression eventually evaluated to the result **/ NT2_FUNCTION_IMPLEMENTATION_TPL(tag::globalmax_, globalmax,(A0 const&)(A1&),2) /// @overload NT2_FUNCTION_IMPLEMENTATION_TPL(tag::globalmax_, g_max ,(A0 const&)(A1&),2) /// @overload NT2_FUNCTION_IMPLEMENTATION(nt2::tag::globalmax_ , globalmax, 1) /// @overload NT2_FUNCTION_IMPLEMENTATION(nt2::tag::globalmax_ , g_max, 1) /// @overload } namespace nt2 { namespace ext { /// INTERNAL ONLY BOOST_DISPATCH_IMPLEMENT ( globalmax_, tag::cpu_, (A0), (unspecified_<A0>) ) { typedef typename meta::call<tag::global_(nt2::functor<tag::maximum_> , const A0& )>::type result_type; BOOST_FORCEINLINE result_type operator()(A0 const& a0) const { return nt2::global(nt2::functor<tag::maximum_>(), a0); } }; /// INTERNAL ONLY BOOST_DISPATCH_IMPLEMENT ( globalmax_, tag::cpu_, (A0)(A1), (unspecified_<A0>)(scalar_<integer_<A1> > ) ) { typedef typename meta::call<tag::global_(nt2::functor<tag::maximum_>, const A0&)>::type result_type; BOOST_FORCEINLINE result_type operator()(A0 const& a0, A1 & a1) const { result_type tmp = global(nt2::functor<tag::maximum_>(), a0); A1 k = nt2::globalfind(eq(a0, tmp)); a1 = k; return tmp; } }; } } #endif <|start_filename|>modules/core/statistics/include/nt2/statistics/functions/evstat.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_STATISTICS_FUNCTIONS_EVSTAT_HPP_INCLUDED #define NT2_STATISTICS_FUNCTIONS_EVSTAT_HPP_INCLUDED #include <nt2/include/functor.hpp> namespace nt2 { namespace tag { /// @brief Hierarchy tag for evstat function struct evstat_ : ext::elementwise_<evstat_> { /// @brief Parent hierarchy typedef ext::elementwise_<evstat_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_evstat_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::evstat_, Site> dispatching_evstat_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::evstat_, Site>(); } template<class... Args> struct impl_evstat_; } /*! Computes mean and variance of the extreme value distribution from shape and scale mu and sigma @par Semantic: For every parameters of floating type T0: @code T0 m, v; tie(m, v) = evstat(mu, sigma); @endcode is similar to: @code T0 m = mu; T0 v = sqr(sigma); @endcode @see @funcref{evpdf}, @funcref{evcdf}, @funcref{evinv}, @funcref{evrnd} @param mu mean @param sigma standard deviation @return A Fusion Sequence containing m and v **/ NT2_FUNCTION_IMPLEMENTATION(tag::evstat_, evstat, 2) /*! Computes mean and variance of the extreme value distribution from shape and scale mu and sigma @par Semantic: For every parameters of floating type T0: @code T0 m, v; m = evstat(mu, sigma, v); @endcode is similar to: @code T0 m = mu; T0 v = sqr(sigma); @endcode @see @funcref{evpdf}, @funcref{evcdf}, @funcref{evinv}, @funcref{evrnd} @param mu mean @param sigma standard deviation @param v L-Value that will receive the variance @return m **/ NT2_FUNCTION_IMPLEMENTATION_TPL(tag::evstat_, evstat,(A0 const&)(A1 const&)(A2&),3) /*! Computes mean and variance of the extreme value distribution from shape and scale mu and sigma @par Semantic: For every parameters of floating type T0: @code T0 m, v; evstat(mu, sigma, m, v); @endcode is similar to: @code T0 m = mu; T0 v = sqr(sigma); @endcode @see @funcref{evpdf}, @funcref{evcdf}, @funcref{evinv}, @funcref{evrnd} @param mu mean @param sigma standard deviation @return m and computes v @param a0 angle in radian @param a1 L-Value that will receive the mean value @param a2 L-Value that will receive the variance **/ NT2_FUNCTION_IMPLEMENTATION_TPL(tag::evstat_, evstat,(A0 const&)(A1 const&)(A2&)(A3&),4) } #endif <|start_filename|>modules/boost/simd/base/include/boost/simd/ieee/functions/predecessor.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef BOOST_SIMD_IEEE_FUNCTIONS_PREDECESSOR_HPP_INCLUDED #define BOOST_SIMD_IEEE_FUNCTIONS_PREDECESSOR_HPP_INCLUDED #include <boost/simd/include/functor.hpp> #include <boost/dispatch/include/functor.hpp> namespace boost { namespace simd { namespace tag { /*! @brief predecessor generic tag Represents the predecessor function in generic contexts. @par Models: Hierarchy **/ struct predecessor_ : ext::elementwise_<predecessor_> { /// @brief Parent hierarchy typedef ext::elementwise_<predecessor_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_predecessor_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::predecessor_, Site> dispatching_predecessor_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::predecessor_, Site>(); } template<class... Args> struct impl_predecessor_; } /*! With one parameter it is equivalent to \c prev It is in the type \c A0, the greatest \c A0 elementwise strictly less than \c a0. \par With two parameters, the second is an integer value \c n and the result is equivalent to applying \c prev \c abs(n) times to \c a0. @par Semantic: @code T r = predecessor(x); @endcode computes the greatest value strictly less than x in its type @param a0 @return a value of same type as the inputs **/ BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::predecessor_, predecessor, 1) /*! Returns the n-th greatest element strictly less than the parameter @par Semantic: @code T r = predecessor(x,n); @endcode computes the @c n-th greatest value strictly less than x in its type. n must be positive or null. For integer it saturate at Valmin, for floating point numbers Minf strict predecessors are Nan @param a0 @param a1 @return a value of same type as the inputs **/ BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::predecessor_, predecessor, 2) } } #endif <|start_filename|>modules/core/reduction/include/nt2/core/functions/outer_fold.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2011 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2011 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_CORE_FUNCTIONS_OUTER_FOLD_HPP_INCLUDED #define NT2_CORE_FUNCTIONS_OUTER_FOLD_HPP_INCLUDED #include <nt2/include/functor.hpp> namespace nt2 { namespace tag { struct outer_fold_ : ext::abstract_<outer_fold_> { typedef ext::abstract_<outer_fold_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_outer_fold_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::outer_fold_, Site> dispatching_outer_fold_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::outer_fold_, Site>(); } template<class... Args> struct impl_outer_fold_; } //============================================================================ /*! * Folds elements of \c a1 along inner dimension, possibly in parallel, and store * the result in \c a0. * * \param a0 Expression to store result in * \param a1 Expression to reduce * \param a2 Functor to initialize the accumulator with * \param a3 Function to apply for binary reduction, first argument is accumulator * \param a4 Function to apply for unary reduction (for SIMD usage) * \return nothing */ //============================================================================ BOOST_DISPATCH_FUNCTION_IMPLEMENTATION_TPL(tag::outer_fold_, outer_fold, (A0 const&)(A1 const&)(A2 const&)(A3 const&)(A4 const&), 5) /// @overload BOOST_DISPATCH_FUNCTION_IMPLEMENTATION_TPL(tag::outer_fold_, outer_fold, (A0&)(A1 const&)(A2 const&)(A3 const&)(A4 const&), 5) /// @overload BOOST_DISPATCH_FUNCTION_IMPLEMENTATION_TPL(tag::outer_fold_, outer_fold, (A0 const&)(A1&)(A2 const&)(A3 const&)(A4 const&), 5) /// @overload BOOST_DISPATCH_FUNCTION_IMPLEMENTATION_TPL(tag::outer_fold_, outer_fold, (A0&)(A1&)(A2 const&)(A3 const&)(A4 const&), 5) } #endif <|start_filename|>modules/core/linalg/include/nt2/linalg/functions/expm.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_LINALG_FUNCTIONS_EXPM_HPP_INCLUDED #define NT2_LINALG_FUNCTIONS_EXPM_HPP_INCLUDED #include <nt2/include/functor.hpp> namespace nt2 { namespace tag { /*! * \brief Define the tag expm_ of functor expm * in namespace nt2::tag for toolbox algebra **/ struct expm_ : ext::unspecified_<expm_> { typedef ext::unspecified_<expm_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_expm_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::expm_, Site> dispatching_expm_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::expm_, Site>(); } template<class... Args> struct impl_expm_; } /** * @brief compute exponential of a matricial expression * * expm(a0) must not be confused with exp(a0) that computes on an * elementwise basis the powers of the elements of matrix a0. * * a0 can be a any square matricial expression * * @param a0 Matrix expression or scalar * * @return a matrix containing e^a1 **/ BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::expm_, expm, 1) } #endif <|start_filename|>modules/boost/simd/base/include/boost/simd/boolean/functions/if_zero_else.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef BOOST_SIMD_BOOLEAN_FUNCTIONS_IF_ZERO_ELSE_HPP_INCLUDED #define BOOST_SIMD_BOOLEAN_FUNCTIONS_IF_ZERO_ELSE_HPP_INCLUDED #include <boost/simd/include/functor.hpp> #include <boost/dispatch/include/functor.hpp> namespace boost { namespace simd { namespace tag { /*! @brief if_zero_else generic tag Represents the if_zero_else function in generic contexts. @par Models: Hierarchy **/ struct if_zero_else_ : ext::elementwise_<if_zero_else_> { /// @brief Parent hierarchy typedef ext::elementwise_<if_zero_else_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_if_zero_else_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::if_zero_else_, Site> dispatching_if_zero_else_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::if_zero_else_, Site>(); } template<class... Args> struct impl_if_zero_else_; } /*! If a0 is true returns zero else returns a1 @par Semantic: For every parameters of types respectively T0, T1: @code T r = if_zero_else(a0,a1); @endcode is similar to: @code T r = a0 ? zero :a1; @endcode @par Alias: @c if_zero_else, @c ifzeroelse, @c ifnot_else_zero, @c ifnotelsezero @param a0 @param a1 @return a value of the same type as the second parameter **/ BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::if_zero_else_, if_zero_else, 2) BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::if_zero_else_, ifzeroelse, 2) BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::if_zero_else_, ifnot_else_zero, 2) BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::if_zero_else_, ifnotelsezero, 2) } } #endif <|start_filename|>modules/boost/simd/sdk/include/boost/simd/memory/functions/stream.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2011 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2011 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef BOOST_SIMD_MEMORY_FUNCTIONS_STREAM_HPP_INCLUDED #define BOOST_SIMD_MEMORY_FUNCTIONS_STREAM_HPP_INCLUDED #include <boost/simd/include/functor.hpp> #include <boost/dispatch/include/functor.hpp> namespace boost { namespace simd { namespace tag { /*! @brief stream generic tag Represents the stream function in generic contexts. @par Models: Hierarchy **/ struct stream_ : ext::abstract_<stream_> { /// @brief Parent hierarchy typedef ext::abstract_<stream_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_stream_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::stream_, Site> dispatching_stream_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::stream_, Site>(); } template<class... Args> struct impl_stream_; } /*! @brief Stream a value in memory Store a given value into an arbitrary memory location referenced by either a pointer or a pointer and an offset without polluting the caches. @par Semantic: stream semantic is similar to store semantic except for the fact that no cache pollution occurs on architecture that support such memory operations. On other architecture, stream is simply an alias for store. @param val Value to stream @param ptr Memory location to stream @c val to @param offset Optional memory offset. **/ template<typename Value, typename Pointer, typename Offset> BOOST_FORCEINLINE void stream(Value const& val, Pointer const& ptr, Offset const& offset) { typename boost::dispatch::meta ::dispatch_call<tag::stream_( Value const& , Pointer const& , Offset const& )>::type callee; callee(val, ptr, offset); } /// @overload template<typename Value, typename Pointer> BOOST_FORCEINLINE void stream(Value const& val, Pointer const& ptr) { typename boost::dispatch::meta ::dispatch_call<tag::stream_( Value const& , Pointer const& )>::type callee; callee(val, ptr); } } } #endif <|start_filename|>modules/core/exponential/include/nt2/exponential/functions/pow.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_EXPONENTIAL_FUNCTIONS_POW_HPP_INCLUDED #define NT2_EXPONENTIAL_FUNCTIONS_POW_HPP_INCLUDED #include <nt2/include/functor.hpp> namespace nt2 { namespace tag { /*! @brief pow generic tag Represents the pow function in generic contexts. @par Models: Hierarchy **/ struct pow_ : ext::elementwise_<pow_> { /// @brief Parent hierarchy typedef ext::elementwise_<pow_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_pow_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::pow_, Site> dispatching_pow_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::pow_, Site>(); } template<class... Args> struct impl_pow_; } /*! Computes a0 to a1 @par Semantic: For every parameters of floating types respectively T0, T1: @code T0 r = pow(x,y); @endcode is similar to: @code T0 r = exp(y*log(x)); @endcode @param a0 @param a1 @return a value of the same type as the parameter **/ NT2_FUNCTION_IMPLEMENTATION(tag::pow_, pow, 2) template<long long Exp, class A0> BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE pow(A0 const& a0) BOOST_AUTO_DECLTYPE_BODY( dispatching_pow_( ext::adl_helper(), boost::dispatch::default_site_t<A0>() , boost::dispatch::meta::hierarchy_of_t<A0 const&>() , boost::dispatch::meta::hierarchy_of_t< boost::mpl::integral_c<long long, Exp> >() ) (a0, boost::mpl::integral_c<long long, Exp>()) ) } #endif <|start_filename|>modules/core/statistics/include/nt2/statistics/functions/logncdf.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_STATISTICS_FUNCTIONS_LOGNCDF_HPP_INCLUDED #define NT2_STATISTICS_FUNCTIONS_LOGNCDF_HPP_INCLUDED #include <nt2/include/functor.hpp> #include <nt2/sdk/meta/size_as.hpp> #include <nt2/sdk/meta/value_as.hpp> #include <nt2/core/container/dsl/size.hpp> #include <nt2/core/container/dsl/value_type.hpp> #include <nt2/sdk/meta/tieable_hierarchy.hpp> #include <nt2/core/utility/max_extent.hpp> namespace nt2 { namespace tag { /*! @brief logncdf generic tag Represents the logncdf function in generic contexts. @par Models: Hierarchy **/ struct logncdf_ : ext::tieable_<logncdf_> { /// @brief Parent hierarchy typedef ext::tieable_<logncdf_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_logncdf_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; struct logncdf0_ : ext::elementwise_<logncdf0_> { /// @brief Parent hierarchy typedef ext::elementwise_<logncdf0_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_logncdf0_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::logncdf_, Site> dispatching_logncdf_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::logncdf_, Site>(); } template<class... Args> struct impl_logncdf_; template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::logncdf0_, Site> dispatching_logncdf0_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::logncdf0_, Site>(); } template<class... Args> struct impl_logncdf0_; } /*! log normal cumulative distribution @par Semantic: For every table expression and optional mean and standard deviation of the associated normal distribution. @code auto r = logncdf(a0, m, s); @endcode is similar to: @code auto r =erfc(Sqrt_2o_2*((m-log(a0))/s))/2; @endcode @see @funcref{erfc}, @funcref{Sqrt_2o_2}, @param a0 @param m optional mean of the associated normal distribution, default to 0 @param s optional standard deviation of the associated normal distribution, default to 1 @return an expression which eventually will evaluate to the result **/ NT2_FUNCTION_IMPLEMENTATION(tag::logncdf0_, logncdf, 3) /// @overload NT2_FUNCTION_IMPLEMENTATION(tag::logncdf0_, logncdf, 1) /// @overload NT2_FUNCTION_IMPLEMENTATION(tag::logncdf0_, logncdf, 2) /*! normal cumulative distribution with bounds estimates @par Semantic: @code tie(r, rlo, rup) = logncdf(a0, m, s, cov, alpha); @endcode Returns r = logncdf(a0, m, s), but also produces confidence bounds for p when the input parameters m and s are estimates. cov is a 2-by-2 matrix containing the covariance matrix of the estimated parameters. alpha has a default value of 0.05, and specifies 100*(1-alpha)% confidence bounds. rlo and rup are arrays of the same size as a0 containing the lower and upper confidence bounds. @param a0 @param m estimated mean of the associated normal distribution @param s estimated standard deviation of the associated normal distribution @param cov covariance matrix of the estimated m and s. @param alpha optional confidence bound (default to 0.05) @return r, rlo and rhi as described above **/ NT2_FUNCTION_IMPLEMENTATION(tag::logncdf_, logncdf, 5) /// @overload NT2_FUNCTION_IMPLEMENTATION(tag::logncdf_, logncdf, 4) } namespace nt2 { namespace ext { /// INTERNAL ONLY template<class Domain, int N, class Expr> struct size_of<tag::logncdf_,Domain,N,Expr> // N = 4 or 5 { typedef typename boost::proto::result_of::child_c<Expr&,0> ::value_type::extent_type ext0_t; typedef typename boost::proto::result_of::child_c<Expr&,1> ::value_type::extent_type ext1_t; typedef typename boost::proto::result_of::child_c<Expr&,2> ::value_type::extent_type ext2_t; typedef typename utility::result_of::max_extent<ext2_t, ext1_t, ext0_t>::type result_type; BOOST_FORCEINLINE result_type operator()(Expr& e) const { return utility::max_extent(nt2::extent(boost::proto::child_c<0>(e)), nt2::extent(boost::proto::child_c<1>(e)), nt2::extent(boost::proto::child_c<2>(e))); } }; /// INTERNAL ONLY template<class Domain, class Expr> struct size_of<tag::logncdf_,Domain,1,Expr> : meta::size_as<Expr,0> {}; /// INTERNAL ONLY template<class Domain, int N, class Expr> struct value_type<tag::logncdf_,Domain,N,Expr> : meta::value_as<Expr,0> {}; } } #endif <|start_filename|>modules/core/trigonometric/include/nt2/trigonometric/constants/_120.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2011 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2011 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_TRIGONOMETRIC_CONSTANTS_120_HPP_INCLUDED #define NT2_TRIGONOMETRIC_CONSTANTS_120_HPP_INCLUDED #include <nt2/include/functor.hpp> #include <boost/simd/constant/hierarchy.hpp> #include <boost/simd/constant/register.hpp> namespace nt2 { namespace tag { /*! @brief _120 generic tag Represents the _120 constant in generic contexts. @par Models: Hierarchy **/ BOOST_SIMD_CONSTANT_REGISTER( _120, double , 120, 0x42f00000UL , 0x405e000000000000ULL ) } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::_120, Site> dispatching__120(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::_120, Site>(); } template<class... Args> struct impl__120; } /*! Constant 120. @par Semantic: For type T0: @code T0 r = _120<T0>(); @endcode is similar to: @code T0 r = 120; @endcode @return a value of type T0 **/ BOOST_SIMD_CONSTANT_IMPLEMENTATION(tag::_120, _120); } #endif <|start_filename|>modules/boost/simd/base/include/boost/simd/swar/functions/broadcast.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2011 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2013 LRI UMR 8623 CNRS/Univ Paris Sud XI // Copyright 2011 - 2013 MetaScale SAS // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef BOOST_SIMD_SWAR_FUNCTIONS_BROADCAST_HPP_INCLUDED #define BOOST_SIMD_SWAR_FUNCTIONS_BROADCAST_HPP_INCLUDED #include <boost/simd/include/functor.hpp> #include <boost/dispatch/include/functor.hpp> #include <boost/simd/sdk/meta/cardinal_of.hpp> #include <boost/mpl/assert.hpp> #include <boost/mpl/int.hpp> namespace boost { namespace simd { namespace tag { /*! @brief broadcast generic tag Represents the broadcast function in generic contexts. @par Models: Hierarchy **/ struct broadcast_ : ext::unspecified_<broadcast_> { /// @brief Parent hierarchy typedef ext::unspecified_<broadcast_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_broadcast_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::broadcast_, Site> dispatching_broadcast_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::broadcast_, Site>(); } template<class... Args> struct impl_broadcast_; } /*! @brief Vector element broadcast Splat the Nth element of a SIMD register into a new register @par Semantic: For every parameter of type Type and any integer @c N @code Type r = broadcast<N>(value); @endcode is similar to: @code for(int i=0;i<Type::static_size;++i) r[i] = value[N]; @endcode @param value SIMD register containing the value to broadcast @tparam N index of the value to broadcast everywhere @return A SIMD register full of <tt>value[N]</tt> **/ template<std::size_t N, typename Type> BOOST_FORCEINLINE typename boost::dispatch::meta:: result_of < typename boost::dispatch::meta:: dispatch_call < tag::broadcast_ ( Type const& , boost::mpl::int_<N> const& ) >::type ( Type const& , boost::mpl::int_<N> const& ) >::type broadcast(Type const& value) { typename boost::dispatch::meta ::dispatch_call<tag::broadcast_ ( Type const& , boost::mpl::int_<N> const& )>::type callee; BOOST_MPL_ASSERT_MSG( (N < meta::cardinal_of<Type>::value) , BOOST_SIMD_INVALID_BROADCAST_INDEX , ( typename meta::cardinal_of<Type>::type , boost::mpl::int_<N> ) ); return callee(value,boost::mpl::int_<N>()); } } } #endif <|start_filename|>modules/arch/cuda/unit/general/cuda_buffer.cpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #include <nt2/sdk/cuda/cuda.hpp> #include <nt2/sdk/cuda/memory/buffer.hpp> #include <nt2/table.hpp> #include <nt2/include/functions/ones.hpp> #include <nt2/include/functions/size.hpp> #include <iostream> #include <nt2/sdk/unit/tests/ulp.hpp> #include <nt2/sdk/unit/module.hpp> #include <nt2/sdk/unit/tests/relation.hpp> NT2_TEST_CASE_TPL( cuda_buffer_d, (double) ) { nt2::table<T> entry = nt2::ones(10,1, nt2::meta::as_<T>()); nt2::table<T> result = T(5)* nt2::ones(10,1, nt2::meta::as_<T>()); nt2::table<T> cuda_dst(nt2::of_size(10,1)); nt2::memory::cuda_buffer<T> cudabuffer(entry); T alpha = 5.; int incr =1; cublasDscal( cudabuffer.size(), alpha ,cudabuffer.data(), incr); cudabuffer.data(cuda_dst); NT2_TEST_EQUAL(result, cuda_dst ); NT2_TEST_EQUAL(cudabuffer.size(), entry.size() ); } NT2_TEST_CASE_TPL( cuda_buffer_d_affect_htd, (double) ) { nt2::table<T> entry = nt2::ones(10,1, nt2::meta::as_<T>()); nt2::table<T> result = T(5)* nt2::ones(10,1, nt2::meta::as_<T>()); nt2::table<T> cuda_dst(nt2::of_size(10,1)); nt2::memory::cuda_buffer<T> cudabuffer(10); cudabuffer = entry ; T alpha = 5.; int incr =1; cublasDscal( cudabuffer.size(), alpha ,cudabuffer.data(), incr); cudabuffer.data(cuda_dst); NT2_TEST_EQUAL(result, cuda_dst ); NT2_TEST_EQUAL(cudabuffer.size(), entry.size() ); } NT2_TEST_CASE_TPL( cuda_buffer_d_affect_dtd, (double) ) { nt2::table<T> entry = nt2::ones(10,1, nt2::meta::as_<T>()); nt2::table<T> result = T(5)* nt2::ones(10,1, nt2::meta::as_<T>()); nt2::table<T> cuda_dst(nt2::of_size(10,1)); nt2::memory::cuda_buffer<T> cudabuffer(entry); nt2::memory::cuda_buffer<T> cudabuffer_1; cudabuffer_1 = cudabuffer ; T alpha = 5.; int incr =1; cublasDscal( cudabuffer_1.size(), alpha ,cudabuffer_1.data(), incr); cudabuffer_1.data(cuda_dst); NT2_TEST_EQUAL(result, cuda_dst ); NT2_TEST_EQUAL(cudabuffer_1.size(), entry.size() ); } NT2_TEST_CASE_TPL( cuda_buffer_d_copy, (double) ) { nt2::table<T> entry = nt2::ones(10,1, nt2::meta::as_<T>()); nt2::table<T> result = T(5)* nt2::ones(10,1, nt2::meta::as_<T>()); nt2::table<T> cuda_dst(nt2::of_size(10,1)); nt2::memory::cuda_buffer<T> cudabuffer(entry); nt2::memory::cuda_buffer<T> cudabuffer_1(cudabuffer); T alpha = 5.; int incr =1; cublasDscal( cudabuffer_1.size(), alpha ,cudabuffer_1.data(), incr); cudabuffer_1.data(cuda_dst); NT2_TEST_EQUAL(result, cuda_dst ); NT2_TEST_EQUAL(cudabuffer_1.size(), entry.size() ); } NT2_TEST_CASE_TPL( cuda_buffer_f, (float) ) { nt2::table<T> entry = nt2::ones(10,1, nt2::meta::as_<T>()); nt2::table<T> result = T(5)* nt2::ones(10,1, nt2::meta::as_<T>()); nt2::table<T> cuda_dst(nt2::of_size(10,1)); nt2::memory::cuda_buffer<T> cudabuffer(entry); T alpha = 5.; int incr =1; cublasSscal( cudabuffer.size(), alpha ,cudabuffer.data(), incr); cudabuffer.data(cuda_dst); NT2_TEST_EQUAL(result, cuda_dst ); NT2_TEST_EQUAL(cudabuffer.size(), entry.size() ); } NT2_TEST_CASE_TPL( cuda_buffer_f_copy, (float) ) { nt2::table<T> entry = nt2::ones(10,1, nt2::meta::as_<T>()); nt2::table<T> result = T(5)* nt2::ones(10,1, nt2::meta::as_<T>()); nt2::table<T> cuda_dst(nt2::of_size(10,1)); nt2::memory::cuda_buffer<T> cudabuffer(entry); nt2::memory::cuda_buffer<T> cudabuffer_1(cudabuffer); T alpha = 5.; int incr =1; cublasSscal( cudabuffer_1.size(), alpha ,cudabuffer_1.data(), incr); cudabuffer_1.data(cuda_dst); NT2_TEST_EQUAL(result, cuda_dst ); NT2_TEST_EQUAL(cudabuffer_1.size(), entry.size() ); } NT2_TEST_CASE_TPL( cuda_buffer_f_affect_htd, (float) ) { nt2::table<T> entry = nt2::ones(10,1, nt2::meta::as_<T>()); nt2::table<T> result = T(5)* nt2::ones(10,1, nt2::meta::as_<T>()); nt2::table<T> cuda_dst(nt2::of_size(10,1)); nt2::memory::cuda_buffer<T> cudabuffer(10); cudabuffer = entry ; T alpha = 5.; int incr =1; cublasSscal( cudabuffer.size(), alpha ,cudabuffer.data(), incr); cudabuffer.data(cuda_dst); NT2_TEST_EQUAL(result, cuda_dst ); NT2_TEST_EQUAL(cudabuffer.size(), entry.size() ); } NT2_TEST_CASE_TPL( cuda_buffer_f_affect_dtd, (float) ) { nt2::table<T> entry = nt2::ones(10,1, nt2::meta::as_<T>()); nt2::table<T> result = T(5)* nt2::ones(10,1, nt2::meta::as_<T>()); nt2::table<T> cuda_dst(nt2::of_size(10,1)); nt2::memory::cuda_buffer<T> cudabuffer(entry); nt2::memory::cuda_buffer<T> cudabuffer_1; cudabuffer_1 = cudabuffer ; T alpha = 5.; int incr =1; cublasSscal( cudabuffer_1.size(), alpha ,cudabuffer_1.data(), incr); cudabuffer_1.data(cuda_dst); NT2_TEST_EQUAL(result, cuda_dst ); NT2_TEST_EQUAL(cudabuffer_1.size(), entry.size() ); } <|start_filename|>modules/boost/simd/base/include/boost/simd/ieee/functions/sign.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef BOOST_SIMD_IEEE_FUNCTIONS_SIGN_HPP_INCLUDED #define BOOST_SIMD_IEEE_FUNCTIONS_SIGN_HPP_INCLUDED #include <boost/simd/include/functor.hpp> #include <boost/dispatch/include/functor.hpp> namespace boost { namespace simd { namespace tag { /*! @brief sign generic tag Represents the sign function in generic contexts. @par Models: Hierarchy **/ struct sign_ : ext::elementwise_<sign_> { /// @brief Parent hierarchy typedef ext::elementwise_<sign_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_sign_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::sign_, Site> dispatching_sign_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::sign_, Site>(); } template<class... Args> struct impl_sign_; } /*! Returns the sign of a0. I.e. -1, 0 or 1, according a0 is less than zero, zero or greater than zero. For floating sign of nan is nan @par Semantic: @code T r = sign(x); @endcode is similar to: @code T r = (x > 0) ? T(1) : ((x < 0) ? T(-1) : ((x == 0) ? 0 : Nan<T>())); @endcode @param a0 @return a value of same type as the input **/ BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::sign_, sign, 1) } } #endif <|start_filename|>modules/core/trigonometric/include/nt2/trigonometric/functions/fast_sincos.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_TRIGONOMETRIC_FUNCTIONS_FAST_SINCOS_HPP_INCLUDED #define NT2_TRIGONOMETRIC_FUNCTIONS_FAST_SINCOS_HPP_INCLUDED #include <nt2/include/functor.hpp> namespace nt2 { namespace tag { /*! @brief fast_sincos generic tag Represents the fast_sincos function in generic contexts. @par Models: Hierarchy **/ struct fast_sincos_ : ext::elementwise_<fast_sincos_> { /// @brief Parent hierarchy typedef ext::elementwise_<fast_sincos_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_fast_sincos_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::fast_sincos_, Site> dispatching_fast_sincos_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::fast_sincos_, Site>(); } template<class... Args> struct impl_fast_sincos_; } /*! Computes simultaneously sine and cosine in the interval \f$[-\pi/4, \pi/4]\f$, nan outside. @par Semantic: For every parameter of floating type T0 @code T0 c, s; tie(s, c) = fast_sincos(x); @endcode is similar to: @code T0 c = fast_cos(x); T0 s = fast_sin(x); @endcode @see @funcref{sine}, @funcref{fast_sin}, @funcref{sincos}, @funcref{fast_cos} @param a0 input @return a pair of value of the same type as the parameter **/ NT2_FUNCTION_IMPLEMENTATION(tag::fast_sincos_, fast_sincos, 1) /*! Computes simultaneously sine and cosine in the interval \f$[-\pi/4, \pi/4]\f$, nan outside. @par Semantic: For every parameter of floating type T0 @code T0 c, s; s = fast_sincos(x, c); @endcode is similar to: @code T0 c = fast_cos(x); T0 s = fast_sin(x); @endcode @see @funcref{sine}, @funcref{fast_sin}, @funcref{sincos}, @funcref{fast_cos} @param a0 input @param a1 L-Value that will receive the cosine of a0 @return the sine of a0 **/ NT2_FUNCTION_IMPLEMENTATION_TPL(tag::fast_sincos_, fast_sincos,(A0 const&)(A1&),2) /*! Computes simultaneously sine and cosine in the interval \f$[-\pi/4, \pi/4]\f$, nan outside. @par Semantic: For every parameter of floating type T0 @code T0 c, s; fast_sincos(x, s, c); @endcode is similar to: @code T0 c = fast_cos(x); T0 s = fast_sin(x); @endcode @see @funcref{sine}, @funcref{fast_sin}, @funcref{sincos}, @funcref{fast_cos} @param a0 Value to decompose @param a1 L-Value that will receive the sine of @c a0 @param a2 L-Value that will receive the cosine of @c a0 **/ NT2_FUNCTION_IMPLEMENTATION_TPL(tag::fast_sincos_, fast_sincos,(A0 const&)(A1&)(A2&),3) } #endif <|start_filename|>modules/core/trigonometric/include/nt2/trigonometric/functions/asinpi.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_TRIGONOMETRIC_FUNCTIONS_ASINPI_HPP_INCLUDED #define NT2_TRIGONOMETRIC_FUNCTIONS_ASINPI_HPP_INCLUDED #include <nt2/include/functor.hpp> namespace nt2 { namespace tag { /*! @brief asinpi generic tag Represents the asinpi function in generic contexts. @par Models: Hierarchy **/ struct asinpi_ : ext::elementwise_<asinpi_> { /// @brief Parent hierarchy typedef ext::elementwise_<asinpi_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_asinpi_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::asinpi_, Site> dispatching_asinpi_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::asinpi_, Site>(); } template<class... Args> struct impl_asinpi_; } /*! inverse sine in \f$\pi\f$ multiples. @par Semantic: For every parameter of floating type T0 @code T0 r = asinpi(a0); @endcode Returns the arc @c r in the interval \f$[-0.5, 0.5[\f$ such that <tt>cos(r) == x</tt>. If @c x is outside \f$[-1, 1[\f$ the result is Nan. @param a0 @return a value of the same type as the parameter **/ NT2_FUNCTION_IMPLEMENTATION(tag::asinpi_, asinpi, 1) } #endif <|start_filename|>modules/boost/simd/base/include/boost/simd/constant/constants/maxflint.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2011 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2011 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef BOOST_SIMD_CONSTANT_CONSTANTS_MAXFLINT_HPP_INCLUDED #define BOOST_SIMD_CONSTANT_CONSTANTS_MAXFLINT_HPP_INCLUDED #include <boost/simd/include/functor.hpp> #include <boost/simd/constant/register.hpp> #include <boost/simd/constant/hierarchy.hpp> namespace boost { namespace simd { namespace tag { /*! @brief Maxflint generic tag Represents the Maxflint constant in generic contexts. @par Models: Hierarchy **/ BOOST_SIMD_CONSTANT_REGISTER( Maxflint , double, 1 , 0x4b800000, 0x4340000000000000ll ) } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::Maxflint, Site> dispatching_Maxflint(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::Maxflint, Site>(); } template<class... Args> struct impl_Maxflint; } /*! Generates the least integer value which is exactly representable in floating point numbers and equal to its integral successor. All floating numbers greater than Maxflint are integral. @par Semantic: @code T r = Maxflint<T>(); @endcode is similar to: @code if T is double r = 9007199254740992.0 else if T is float r = 16777216.0f @endcode **/ BOOST_SIMD_CONSTANT_IMPLEMENTATION(boost::simd::tag::Maxflint, Maxflint) } } #include <boost/simd/constant/common.hpp> #endif <|start_filename|>modules/boost/simd/base/include/boost/simd/ieee/functions/signnz.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef BOOST_SIMD_IEEE_FUNCTIONS_SIGNNZ_HPP_INCLUDED #define BOOST_SIMD_IEEE_FUNCTIONS_SIGNNZ_HPP_INCLUDED #include <boost/simd/include/functor.hpp> #include <boost/dispatch/include/functor.hpp> namespace boost { namespace simd { namespace tag { /*! @brief signnz generic tag Represents the signnz function in generic contexts. @par Models: Hierarchy **/ struct signnz_ : ext::elementwise_<signnz_> { /// @brief Parent hierarchy typedef ext::elementwise_<signnz_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_signnz_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::signnz_, Site> dispatching_signnz_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::signnz_, Site>(); } template<class... Args> struct impl_signnz_; } /*! Returns the sign of a0. I.e. -1 or 1, according a0 is negative or positive. This function never returns zero (zero is considered positive for integers, for floating point numbers the bit of sign is taken into account and so we always have signnz(-z) == -signnz(z)). @par Semantic: @code T r = signnz(a0); @endcode is similar to: @code T r = is_nan(x) ? Nan<T>() : (is_negative(x) ? T(-1) : T(1)); @endcode @param a0 @return a value of same type as the input **/ BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::signnz_, signnz, 1) } } #endif <|start_filename|>modules/core/fuzzy/include/nt2/fuzzy/functions/tolerant_round.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_FUZZY_FUNCTIONS_TOLERANT_ROUND_HPP_INCLUDED #define NT2_FUZZY_FUNCTIONS_TOLERANT_ROUND_HPP_INCLUDED #include <nt2/include/functor.hpp> namespace nt2 { namespace tag { /*! @brief tolerant_round generic tag Represents the tolerant_round function in generic contexts. @par Models: Hierarchy **/ struct tolerant_round_ : ext::elementwise_<tolerant_round_> { typedef ext::elementwise_<tolerant_round_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_tolerant_round_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::tolerant_round_, Site> dispatching_tolerant_round_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::tolerant_round_, Site>(); } template<class... Args> struct impl_tolerant_round_; } /*! Computes the rounding with a tolerance of 3 ulps using Hagerty's FL5 function. @par Semantic: For every parameter of floating type T0 @code T0 r = tolerant_round(x); @endcode is similar to: @code T0 r; T0 xp = pred(x); T0 xc = succ(x); if (is_flint(prev(x))) r = pred(x); else if is_flint(next(x)) r = next(x); else r = round(x); @endcode @par Note: See Knuth, Art Of Computer Programming, Vol. 1, Problem 1.2.4-5. @param a0 @return a value of the same type as the parameter **/ NT2_FUNCTION_IMPLEMENTATION(tag::tolerant_round_, tolerant_round, 1) NT2_FUNCTION_IMPLEMENTATION(tag::tolerant_round_, tround, 1) } #endif <|start_filename|>modules/core/signal/include/nt2/signal/functions/globalzero_crossing_rate.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // Copyright 2011 - 2012 MetaScale SAS // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_SIGNAL_FUNCTIONS_GLOBALZERO_CROSSING_RATE_HPP_INCLUDED #define NT2_SIGNAL_FUNCTIONS_GLOBALZERO_CROSSING_RATE_HPP_INCLUDED #include <nt2/include/functor.hpp> #include <nt2/include/functions/zero_crossing_rate.hpp> #include <nt2/include/functions/global.hpp> namespace nt2 { namespace tag { /*! @brief Tag for the golbalzero_crossing_rate functor **/ struct globalzero_crossing_rate_ : ext::abstract_<globalzero_crossing_rate_> { /// @brief Parent hierarchy typedef ext::abstract_<globalzero_crossing_rate_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_globalzero_crossing_rate_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::globalzero_crossing_rate_, Site> dispatching_globalzero_crossing_rate_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::globalzero_crossing_rate_, Site>(); } template<class... Args> struct impl_globalzero_crossing_rate_; } /*! @brief rate of sign changes along a signal Computes the rate of sign changes along all elements of a signal @par Semantic For any table expression and integer: @code auto r = globalzero_crossing_rate(s, n); @endcode is equivalent to: @code auto r = zero_crossing_rate(s(_))(1); @endcode n default to firstnonsingleton(s) @see @funcref{zero_crossing_rate}, @funcref{colon}, @param a0 Table expression to process @return An expression eventually evaluated to the result **/ NT2_FUNCTION_IMPLEMENTATION(nt2::tag::globalzero_crossing_rate_, globalzero_crossing_rate, 1) /// @overload NT2_FUNCTION_IMPLEMENTATION(nt2::tag::globalzero_crossing_rate_, globalzcr, 1) } namespace nt2 { namespace ext { /// INTERNAL ONLY BOOST_DISPATCH_IMPLEMENT ( globalzero_crossing_rate_, tag::cpu_ , (A0) , (unspecified_<A0>) ) { typedef typename meta::call<tag::global_( nt2::functor<tag::zero_crossing_rate_> , const A0& )>::type result_type; BOOST_FORCEINLINE result_type operator()(A0 const& a0) const { return global(nt2::functor<tag::zero_crossing_rate_>(), a0); } }; } } #endif <|start_filename|>modules/core/reduction/include/nt2/core/functions/globalnone.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // Copyright 2011 - 2012 MetaScale SAS // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_CORE_FUNCTIONS_GLOBALNONE_HPP_INCLUDED #define NT2_CORE_FUNCTIONS_GLOBALNONE_HPP_INCLUDED #include <nt2/include/functor.hpp> #include <nt2/include/functions/none.hpp> #include <nt2/include/functions/global.hpp> namespace nt2 { namespace tag { /*! @brief Tag for the globalnone functor **/ struct globalnone_ : ext::abstract_<globalnone_> { /// @brief Parent hierarchy typedef ext::abstract_<globalnone_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_globalnone_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::globalnone_, Site> dispatching_globalnone_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::globalnone_, Site>(); } template<class... Args> struct impl_globalnone_; } /*! @brief Checks that none element of an expression is non-zero @par Semantic For any table expression @c t: @code logical<T> r = globalnone(t); @endcode is equivalent to: @code logical<T> r = none(t(_)); @endcode @see @funcref{colon}, @funcref{none} @param a0 Table to process @return An expression eventually evaluated to the result **/ NT2_FUNCTION_IMPLEMENTATION(nt2::tag::globalnone_ , globalnone, 1) } namespace nt2 { namespace ext { /// INTERNAL ONLY BOOST_DISPATCH_IMPLEMENT ( globalnone_ , tag::cpu_ , (A0) , (unspecified_<A0>) ) { typedef typename meta::call<tag::global_( nt2::functor<tag::none_> , const A0& )>::type result_type; BOOST_FORCEINLINE result_type operator()(A0 const& a0) const { return global(nt2::functor<tag::none_>(), a0); } }; } } #endif <|start_filename|>modules/boost/simd/base/include/boost/simd/arithmetic/functions/abss.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef BOOST_SIMD_ARITHMETIC_FUNCTIONS_ABSS_HPP_INCLUDED #define BOOST_SIMD_ARITHMETIC_FUNCTIONS_ABSS_HPP_INCLUDED #include <boost/simd/include/functor.hpp> #include <boost/dispatch/include/functor.hpp> namespace boost { namespace simd { namespace tag { /*! @brief abss generic tag Represents the abss function in generic contexts. @par Models: Hierarchy **/ struct abss_ : ext::elementwise_<abss_> { /// @brief Parent hierarchy typedef ext::elementwise_<abss_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_abss_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::abss_, Site> dispatching_abss_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::abss_, Site>(); } template<class... Args> struct impl_abss_; } /*! Computes the saturated absolute value of its parameter. @par semantic: For any given value @c x of type @c T: @code T r = abss(x); @endcode is equivalent to: @code T r = (x == Valmin) ? Valmax : (x < T(0) ? -x : x); @endcode @par Note: The function always returns a positive value of the same type as the entry. This is generally equivalent to @c abs functor except for signed integer types for which \c abss(Valmin) is \c Valmax. @par Alias saturated_abs @see @funcref{abs}, @funcref{sqr_abs}, @funcref{sqrs} @param a0 value whose absolute value will be returned. @return a value of the same type as the input. **/ BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::abss_, abss, 1) BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::abss_, saturated_abs, 1) } } #endif <|start_filename|>modules/core/linalg/include/nt2/linalg/functions/sne.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2014 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_LINALG_FUNCTIONS_SNE_HPP_INCLUDED #define NT2_LINALG_FUNCTIONS_SNE_HPP_INCLUDED /*! @file @brief Defines Semi-Normal Equations that solve R'(Rx) = A'b (based on Qr factorization) **/ #include <nt2/include/functor.hpp> namespace nt2 { namespace tag { /// @brief Defines sne function tag struct sne_ : ext::abstract_<sne_> { /// INTERNAL ONLY typedef ext::abstract_<sne_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_sne_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::sne_, Site> dispatching_sne_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::sne_, Site>(); } template<class... Args> struct impl_sne_; } /*! @brief @param @param @return **/ NT2_FUNCTION_IMPLEMENTATION_TPL (tag::sne_, sne , (A0 const&)(A1 const&) , 2 ); } #endif <|start_filename|>modules/core/linalg/include/nt2/linalg/functions/ggev_wvrvl.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2013 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_LINALG_FUNCTIONS_GGEV_WVRVL_HPP_INCLUDED #define NT2_LINALG_FUNCTIONS_GGEV_WVRVL_HPP_INCLUDED /*! @file @brief Defines and implements ggev_wvr function **/ #include <nt2/include/functor.hpp> namespace nt2 { namespace tag { /// @brief Defines ggev_wvrvl function tag struct ggev_wvrvl_ : ext::abstract_<ggev_wvrvl_> { /// INTERNAL ONLY typedef ext::abstract_<ggev_wvrvl_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_ggev_wvrvl_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::ggev_wvrvl_, Site> dispatching_ggev_wvrvl_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::ggev_wvrvl_, Site>(); } template<class... Args> struct impl_ggev_wvrvl_; } /*! @brief piece of interface to lapack 's/d/c/zggev' routines used by geneig @param @param @return **/ NT2_FUNCTION_IMPLEMENTATION_TPL (tag::ggev_wvrvl_, ggev_wvrvl , (A0&)(A1&)(A2&)(A3&)(A4&)(A5&) , 6 ); NT2_FUNCTION_IMPLEMENTATION_TPL (tag::ggev_wvrvl_, ggev_wvrvl , (A0&)(A1&)(A2&)(A3&)(A4&)(A5&)(A6&) , 7 ); } #endif <|start_filename|>modules/core/gallery/include/nt2/gallery/functions/randcolu.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_GALLERY_FUNCTIONS_RANDCOLU_HPP_INCLUDED #define NT2_GALLERY_FUNCTIONS_RANDCOLU_HPP_INCLUDED #include <nt2/include/functor.hpp> #include <nt2/include/functions/numel.hpp> #include <nt2/sdk/meta/boxed_size.hpp> #include <nt2/sdk/meta/value_as.hpp> /*! * \ingroup algebra * \defgroup algebra_randcolu randcolu * * randcolu random matrix with normalized columns and specified singular values. * a = randcolu(n) is a random n-by-n matrix with columns of * unit 2-norm, with random singular values whose squares are from a * uniform distribution. randcolu(n,m), where m >= n, * produces an m-by-n matrix. * a'*a is a correlation matrix of the form produced by * randcorr(n). * * randcolu(x), where x is an n-vector (n > 1), produces * a random n-by-n matrix having singular values given by the vector x. * x must have nonnegative elements whose sum of squares is n. * randcolu(x,m), where m >= n, produces an m-by-n matrix. * randcolu(x,m,k) provides a further option: * for k = 0 (the default) diag(x) is initially subjected to a random * two-sided orthogonal transformation and then a sequence of * givens rotations is applied. * for k = 1, the initial transformation is omitted. this is much faster, * but the resulting matrix may have zero entries. * * Reference: * <NAME> and <NAME>, Numerically stable generation of * correlation matrices and their factors, BIT, 40 (2000), pp. 640-651. * * * \par Header file * * \code * #include <nt2/include/functions/randcolu.hpp> * \endcode * **/ //============================================================================== // randcolu actual class forward declaration //============================================================================== namespace nt2 { namespace tag { /*! * \brief Define the tag randcolu_ of functor randcolu * in namespace nt2::tag for toolbox algebra **/ struct randcolu0_ : ext::abstract_<randcolu0_> { typedef ext::abstract_<randcolu0_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_randcolu0_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; struct randcolu_ : ext::unspecified_<randcolu_> { typedef ext::unspecified_<randcolu_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_randcolu_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::randcolu0_, Site> dispatching_randcolu0_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::randcolu0_, Site>(); } template<class... Args> struct impl_randcolu0_; template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::randcolu_, Site> dispatching_randcolu_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::randcolu_, Site>(); } template<class... Args> struct impl_randcolu_; } NT2_FUNCTION_IMPLEMENTATION(tag::randcolu_, randcolu, 3) NT2_FUNCTION_IMPLEMENTATION(tag::randcolu_, randcolu, 2) NT2_FUNCTION_IMPLEMENTATION(tag::randcolu_, randcolu, 1); } namespace nt2 { namespace ext { template<class Domain, class Expr, int N> struct size_of<tag::randcolu_, Domain, N, Expr> : meta::boxed_size<Expr, 3> {}; template <class Domain, class Expr, int N> struct value_type < tag::randcolu_, Domain,N,Expr> { typedef typename boost::proto::result_of::child_c<Expr&,0>::type tmp_type; typedef typename meta::strip<tmp_type>::type tmp1_type; typedef typename boost::dispatch::meta::semantic_of<tmp1_type >::type t_type; typedef typename meta::strip<t_type>::type tt_type; typedef typename tt_type::value_type type; }; } } #endif <|start_filename|>modules/core/generative/include/nt2/core/functions/cols.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // Copyright 2011 - 2012 MetaScale SAS // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_CORE_FUNCTIONS_COLS_HPP_INCLUDED #define NT2_CORE_FUNCTIONS_COLS_HPP_INCLUDED #include <nt2/include/functor.hpp> #include <nt2/core/functions/details/cols.hpp> #include <nt2/core/container/dsl/generative.hpp> #include <nt2/sdk/meta/generative_hierarchy.hpp> #include <nt2/sdk/parameters.hpp> #include <boost/preprocessor/repetition/repeat_from_to.hpp> #include <boost/preprocessor/arithmetic/inc.hpp> namespace nt2 { namespace tag { /*! @brief cols generic tag Represents the cols function in generic contexts. @par Models: Hierarchy **/ struct cols_ : ext::state_constant_<cols_> { /// @brief Parent hierarchy typedef ext::state_constant_<cols_> parent; /// @brief default value type for untyped calls typedef double default_type; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_cols_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::cols_, Site> dispatching_cols_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::cols_, Site>(); } template<class... Args> struct impl_cols_; } #if defined(DOXYGEN_ONLY) /*! @brief Column index generator Create an array where every element is equal to its column index in an arbitrary base indexing. @par Semantic: cols() semantic depends of its parameters type and quantity: - For any base index @c b of type @c T, the following code: @code auto x = cols(b); @endcode is equivalent to @code T x = b; @endcode - For any base index @c b of type @c T and any Integer @c sz1,...,szn , the following code: @code auto x = cols(sz1,...,szn, b); @endcode generates an expression that evaluates as a @sizes{sz1,szn} table where, for any indexes @c i and @c j, <tt>x(i,j) = T(j+b-1)</tt> - For any base index @c b of type @c T and any Expression @c dims evaluating as a row vector of @c N elements, the following code: @code auto x = cols(dims,b); @endcode generates an expression that evaluates as a @sizes{dims(1),dims(N)} table where, for any indexes @c i and @c j, <tt>x(i,j) = T(j+b-1)</tt> - For any base index @c b of type @c T and any Fusion Sequence @c dims of @c N elements, the following code: @code auto x = cols(dims,b); @endcode generates an expression that evaluates as a @sizes{at_c<1>(dims),at_c<N-1>(dims)} table where, for any indexes @c i and @c j, <tt>x(i,j) = T(j+b-1)</tt> @usage_output{cols.cpp,cols.out} @param dims Size of each dimension, specified as one or more integer values or as a row vector of integer values. If any @c dims is lesser or equal to 0, then the resulting expression is empty. @param base Type specifier of the output. If left unspecified, the resulting expression behaves as an array of double. @return An Expression evaluating as an array of a given type and dimensions. **/ template<typename... Args, typename Index> details::unspecified cols(Args const&... dims, Index const& base); /// @overload template<typename Index> details::unspecified cols(Index const& base); #else #define M0(z,n,t) \ NT2_FUNCTION_IMPLEMENTATION(nt2::tag::cols_, cols, n) \ /**/ BOOST_PP_REPEAT_FROM_TO(1,BOOST_PP_INC(BOOST_PP_INC(NT2_MAX_DIMENSIONS)),M0,~) #undef M0 #endif } namespace nt2 { namespace ext { /// INTERNAL ONLY template<class Domain, class Expr, int N> struct value_type<tag::cols_,Domain,N,Expr> : meta::generative_value<Expr> {}; /// INTERNAL ONLY template<class Domain, class Expr, int N> struct size_of<tag::cols_,Domain,N,Expr> : meta::generative_size<Expr> {}; } } #endif <|start_filename|>modules/core/restructuring/include/nt2/core/functions/colvect.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // Copyright 2011 - 2012 MetaScale SAS // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_CORE_FUNCTIONS_COLVECT_HPP_INCLUDED #define NT2_CORE_FUNCTIONS_COLVECT_HPP_INCLUDED #include <nt2/include/functor.hpp> #include <nt2/sdk/meta/reshaping_hierarchy.hpp> #include <nt2/core/container/dsl/details/resize.hpp> namespace nt2 { namespace tag { /*! @brief colvect generic tag Represents the colvect function in generic contexts. @par Models: Hierarchy **/ struct colvect_ : ext::reshaping_<colvect_> { /// @brief Parent hierarchy typedef ext::reshaping_<colvect_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_colvect_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::colvect_, Site> dispatching_colvect_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::colvect_, Site>(); } template<class... Args> struct impl_colvect_; } /*! Reshapes an expression into a column shaped table. @par Semantic: For every table expression @code auto r = colvect(a0); @endcode is similar to: @code auto r = resize(a0, numel(a0), 1); @endcode @see @funcref{rowvect}, @funcref{resize}, @funcref{numel} @param a0 @return an expression which eventually will evaluate to the result **/ NT2_FUNCTION_IMPLEMENTATION(nt2::tag::colvect_ , colvect, 1) /// INTERNAL ONLY NT2_FUNCTION_IMPLEMENTATION_SELF(nt2::tag::colvect_ , colvect, 1) } namespace nt2 { namespace ext { //============================================================================ // resize colvect expression - do nothing //============================================================================ template<class Domain, int N, class Expr> struct resize<nt2::tag::colvect_, Domain, N, Expr> { template<class Sz> BOOST_FORCEINLINE void operator()(Expr&, Sz const&) {} }; } } #endif <|start_filename|>modules/core/integration/include/nt2/integration/functions/quadgk.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_INTEGRATION_FUNCTIONS_QUADGK_HPP_INCLUDED #define NT2_INTEGRATION_FUNCTIONS_QUADGK_HPP_INCLUDED #include <nt2/integration/interface.hpp> namespace nt2 { namespace tag { struct quadgk_ : ext::unspecified_<quadgk_> { typedef ext::unspecified_<quadgk_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_quadgk_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; // definition of abstol constant for quadgk method /// INTERNAL ONLY BOOST_SIMD_CONSTANT_REGISTER( Quadgkabstol, double , 0, 0x3727c5ac //1.0e-5 , 0x3ddb7cdfd9d7bdbbll //1.0e-10 ) // definition of reltol constant for quadgk method /// INTERNAL ONLY BOOST_SIMD_CONSTANT_REGISTER( Quadgkreltol, double , 0, 0x38d1b717 //1.0e-4 , 0x3eb0c6f7a0b5ed8dll //1.0e-6 ) } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::quadgk_, Site> dispatching_quadgk_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::quadgk_, Site>(); } template<class... Args> struct impl_quadgk_; template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::Quadgkabstol, Site> dispatching_Quadgkabstol(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::Quadgkabstol, Site>(); } template<class... Args> struct impl_Quadgkabstol; template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::Quadgkreltol, Site> dispatching_Quadgkreltol(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::Quadgkreltol, Site>(); } template<class... Args> struct impl_Quadgkreltol; } /// INTERNAL ONLY BOOST_SIMD_CONSTANT_IMPLEMENTATION(tag::Quadgkabstol, Quadgkabstol); /// INTERNAL ONLY BOOST_SIMD_CONSTANT_IMPLEMENTATION(tag::Quadgkreltol, Quadgkreltol); // specialization of abstol/reltol for quadgk method /// INTERNAL ONLY template<class T, class V> struct integ_params<T, V, tag::quadgk_> : integ_params<T, V, void> { typedef typename nt2::integ_params<T, V, void>::real_t real_t; static real_t abstol(){return Quadgkabstol<real_t>(); } static real_t reltol(){return Quadgkreltol<real_t>(); } static bool enabled_singular_a(){ return false; } static bool enabled_singular_b(){ return false; } }; //============================================================================ /*! Applies quadgk algorithm to integrate a function over a real interval using adaptive Gauss-Kronrod quadrature. \param f Function to integrate \param x required points in the interval in ascending order (x can be replaced by 2 abscissae a and b) \param opt Options pack related to the tolerance handling \return a tuple containing the results of the integration, the last error value, the number of required function evaluation and a boolean notifying success of the whole process. Tries to approximates the integral of scalar-valued function f from a to b to within a default error of max(AbsTol,RelTol*|q|). where q is the integration result. This is absolute error control when |q| is sufficiently small and relative error control when |q| is larger. A default tolerance value is used when a tolerance is not specified. The default values : - of nt2::Quadgkabstol<real_t>() is 1.e-10 (double), 1.e-5 (single). - of nt2::Quadgkreltol<real_t>() is 1.e-6 (double), 1.e-4 (single). f is a functor that should accept a vector argument x and return a vector result y, the integrand evaluated at each element of x. This routine mimics Matlab quadgk, but has some behavioural differences. including options passing and obtaining results - a and b can be singular for f. Contrarily to matlab, there is no automatic detection and the options singular_a_ and singular_b_ are by default set to false - as in matlab on can give way points through the computation must go a and b are always added (but never duplicated). The way points mustn't be singular and must be in proper order. If the option return_waypoints is set to true the result is a vector of cumulated integrals from a to each waypoint. Peculiarly result(begin_) is 0 and result(end_) is the integral from a to b. - the abscissae can be complex and the integral a path integral through the lines following the way points in their given order. */ //============================================================================ template<class F, class X, class Xpr> BOOST_FORCEINLINE typename details::integration<F, X, tag::quadgk_>::result_type quadgk(F f, X const& x, nt2::details::option_expr<Xpr> const& opt) { return details::integration<F, X, tag::quadgk_>::call(f, x, opt); } /// @overload template<class F, class X> BOOST_FORCEINLINE typename details::integration<F, X, tag::quadgk_>::result_type quadgk(F f, X const& x) { return details::integration<F, X, tag::quadgk_>::call(f, x); } /// @overload template<class F, class A> BOOST_FORCEINLINE typename details::integration<F, typename details::h2_t<A>::ab_t, tag::quadgk_>::result_type quadgk(F f, A a, A b) { typedef typename details::h2_t<A>::ab_t ab_t; return details::integration<F, ab_t, tag::quadgk_>::call(f, nt2::cath(a, b)); } /// @overload template<class F, class A, class Xpr> BOOST_FORCEINLINE typename details::integration<F, typename details::h2_t<A>::ab_t, tag::quadgk_>::result_type quadgk(F f, A a, A b, nt2::details::option_expr<Xpr> const& opt) { typedef typename details::h2_t<A>::ab_t ab_t; return details::integration<F, ab_t, tag::quadgk_>::call(f, nt2::cath(a, b), opt); } } #endif <|start_filename|>modules/core/gallery/include/nt2/gallery/functions/chow.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_GALLERY_FUNCTIONS_CHOW_HPP_INCLUDED #define NT2_GALLERY_FUNCTIONS_CHOW_HPP_INCLUDED #include <nt2/include/functor.hpp> #include <nt2/core/container/dsl/size.hpp> #include <nt2/core/container/dsl/value_type.hpp> #include <nt2/include/functions/numel.hpp> /*! * \ingroup algebra * \defgroup algebra_chow chow * * \par Description * compute a chow matrix * * \par Header file * * \code * #include <nt2/include/functions/chow.hpp> * \endcode * * * \param n order of the matrix output * * **/ //============================================================================== // chow actual class forward declaration //============================================================================== namespace nt2 { namespace tag { /*! * \brief Define the tag chow_ of functor chow * in namespace nt2::tag for toolbox algebra **/ struct chow_ : ext::unspecified_<chow_> { typedef ext::unspecified_<chow_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_chow_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::chow_, Site> dispatching_chow_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::chow_, Site>(); } template<class... Args> struct impl_chow_; } BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::chow_, chow, 1) BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::chow_, chow, 2) template < class T > container::table<T> chow(size_t n) { return nt2::chow(n, T(1), T(0), meta::as_<T>()); } } namespace nt2 { namespace ext { template<class Domain, class Expr, int N> struct size_of<tag::chow_, Domain, N, Expr> { typedef _2D result_type; BOOST_FORCEINLINE result_type operator()(Expr& e) const { size_t n = boost::proto::child_c<0>(e); result_type sizee; sizee[0] = sizee[1] = n; return sizee; } }; template <class Domain, class Expr, int N> struct value_type < tag::chow_, Domain,N,Expr> { typedef typename boost::proto::result_of::child_c<Expr&,1>::value_type child0; typedef typename child0::value_type type; }; template <class Domain, class Expr> struct value_type < tag::chow_, Domain,1,Expr> { typedef double type; }; } } #endif <|start_filename|>modules/core/extractive/include/nt2/core/functions/line.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // Copyright 2011 - 2012 MetaScale SAS // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_CORE_FUNCTIONS_LINE_HPP_INCLUDED #define NT2_CORE_FUNCTIONS_LINE_HPP_INCLUDED #include <nt2/include/functor.hpp> namespace nt2 { namespace tag { /*! @brief line generic tag Represents the line function in generic contexts. @par Models: Hierarchy **/ struct line_ : ext::elementwise_<line_> { /// @brief Parent hierarchy typedef ext::elementwise_<line_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_line_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::line_, Site> dispatching_line_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::line_, Site>(); } template<class... Args> struct impl_line_; } /*! @brief Oriented slice extraction Returns the oriented slice @c a1 along the first non-singleton dimension of @c a0. @param a0 Source table @param a1 Index of the slice to extract **/ NT2_FUNCTION_IMPLEMENTATION(nt2::tag::line_ , line, 2) /*! @brief Oriented slice extraction Returns the oriented slice @c a1 along dimension @c a2 of @c a0. @param a0 Source table @param a1 Index of the slice to extract @param a2 Dimension to extract along **/ NT2_FUNCTION_IMPLEMENTATION(nt2::tag::line_ , line, 3) } #endif <|start_filename|>modules/core/generative/include/nt2/core/functions/logspace.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // Copyright 2011 - 2012 MetaScale SAS // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_CORE_FUNCTIONS_LOGSPACE_HPP_INCLUDED #define NT2_CORE_FUNCTIONS_LOGSPACE_HPP_INCLUDED #include <nt2/include/functor.hpp> #include <nt2/sdk/meta/generative_hierarchy.hpp> #include <nt2/core/container/dsl/generative.hpp> #include <nt2/core/functions/common/generative.hpp> namespace nt2 { /// INTERNAL ONLY struct regular_t {}; /*! @brief regularity mark-up **/ const meta::as_<regular_t> regular_ = {}; namespace tag { struct logspace_ : ext::state_constant_<logspace_> { typedef ext::state_constant_<logspace_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_logspace_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::logspace_, Site> dispatching_logspace_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::logspace_, Site>(); } template<class... Args> struct impl_logspace_; } NT2_FUNCTION_IMPLEMENTATION(nt2::tag::logspace_, logspace, 2) NT2_FUNCTION_IMPLEMENTATION(nt2::tag::logspace_, logspace, 3) NT2_FUNCTION_IMPLEMENTATION(nt2::tag::logspace_, logspace, 4) } namespace nt2 { namespace ext { /// INTERNAL ONLY template<class Domain, class Expr, int N> struct value_type<tag::logspace_,Domain,N,Expr> : meta::generative_value<Expr> {}; /// INTERNAL ONLY template<class Domain, class Expr, int N> struct size_of<tag::logspace_,Domain,N,Expr> : meta::generative_size<Expr> {}; } } #endif <|start_filename|>modules/boost/simd/base/include/boost/simd/ieee/functions/prev.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef BOOST_SIMD_IEEE_FUNCTIONS_PREV_HPP_INCLUDED #define BOOST_SIMD_IEEE_FUNCTIONS_PREV_HPP_INCLUDED #include <boost/simd/include/functor.hpp> #include <boost/dispatch/include/functor.hpp> namespace boost { namespace simd { namespace tag { /*! @brief prev generic tag Represents the prev function in generic contexts. @par Models: Hierarchy **/ struct prev_ : ext::elementwise_<prev_> { /// @brief Parent hierarchy typedef ext::elementwise_<prev_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_prev_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::prev_, Site> dispatching_prev_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::prev_, Site>(); } template<class... Args> struct impl_prev_; } /*! in the type A0 of a0, the greatest A0 strictly less than a0 @par Semantic: @code T r = prev(a0); @endcode computes the greatest value strictly less than a0 in type T @param a0 @return a value of same type as the input **/ BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::prev_, prev, 1) } } #endif <|start_filename|>modules/core/statistics/include/nt2/statistics/functions/normrnd.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_STATISTICS_FUNCTIONS_NORMRND_HPP_INCLUDED #define NT2_STATISTICS_FUNCTIONS_NORMRND_HPP_INCLUDED #include <nt2/include/functor.hpp> namespace nt2 { namespace tag { /*! @brief normrnd generic tag Represents the normrnd function in generic contexts. @par Models: Hierarchy **/ struct normrnd_ : ext::abstract_<normrnd_> { /// @brief Parent hierarchy typedef ext::abstract_<normrnd_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_normrnd_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::normrnd_, Site> dispatching_normrnd_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::normrnd_, Site>(); } template<class... Args> struct impl_normrnd_; } /*! normal pseudo random numbers generator @par Semantic: For every table expressions and scalars m and s of type T0 @code auto r = normrnd(m, s, <sizing parameters>); @endcode generates a table expression of random numbers following the uniform distribution on interval [a, b[ and of size defined by the sizing parameters @code auto r = s*randn(<sizing parameters>, as_<T0>())+m; @endcode - if as_<T0>() is not present the type of the generated elements is defined as being the type of a, - unifrnd(as_<T0>()) by himself generates one value of type T0, assuming m = 0, s = 1, - unifrnd() assumes T0 is double. @see @funcref{as_}, @funcref{randn} @param a0 points of evaluation @param a1 @param a2 @param a3 @param a4 @param a5 @param a6 @return an expression which eventually will evaluate to the result **/ NT2_FUNCTION_IMPLEMENTATION(nt2::tag::normrnd_, normrnd, 7) /// @overload NT2_FUNCTION_IMPLEMENTATION(nt2::tag::normrnd_, normrnd, 2) /// @overload NT2_FUNCTION_IMPLEMENTATION(nt2::tag::normrnd_, normrnd, 3) /// @overload NT2_FUNCTION_IMPLEMENTATION(nt2::tag::normrnd_, normrnd, 4) /// @overload NT2_FUNCTION_IMPLEMENTATION(nt2::tag::normrnd_, normrnd, 5) /// @overload NT2_FUNCTION_IMPLEMENTATION(nt2::tag::normrnd_, normrnd, 6) /// @overload } #endif <|start_filename|>modules/boost/simd/sdk/include/boost/simd/memory/functions/splat.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2011 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2011 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef BOOST_SIMD_MEMORY_FUNCTIONS_SPLAT_HPP_INCLUDED #define BOOST_SIMD_MEMORY_FUNCTIONS_SPLAT_HPP_INCLUDED #include <boost/simd/include/functor.hpp> #include <boost/dispatch/meta/as.hpp> namespace boost { namespace simd { namespace tag { /*! @brief splat generic tag Represents the splat function in generic contexts. @par Models: Hierarchy **/ struct splat_ : ext::elementwise_<splat_> { /// @brief Parent hierarchy typedef ext::elementwise_<splat_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_splat_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::splat_, Site> dispatching_splat_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::splat_, Site>(); } template<class... Args> struct impl_splat_; } template<class T, class A0> BOOST_FORCEINLINE typename boost::dispatch::meta::call<tag::splat_(A0, boost::dispatch::meta::as_<T>)>::type splat(A0 const& a0) { typename boost::dispatch::make_functor<tag::splat_, A0>::type callee; return callee(a0, boost::dispatch::meta::as_<T>() ); } } } #endif <|start_filename|>modules/boost/simd/base/include/boost/simd/constant/constants/fact_4.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2011 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2011 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef BOOST_SIMD_CONSTANT_CONSTANTS_FACT_4_HPP_INCLUDED #define BOOST_SIMD_CONSTANT_CONSTANTS_FACT_4_HPP_INCLUDED #include <boost/simd/include/functor.hpp> #include <boost/simd/constant/register.hpp> #include <boost/simd/constant/hierarchy.hpp> namespace boost { namespace simd { namespace tag { /*! @brief Fact_4 generic tag Represents the Fact_4 constant in generic contexts. @par Models: Hierarchy **/ BOOST_SIMD_CONSTANT_REGISTER( Fact_4,double , 24, 0x41c00000, 0x4038000000000000ll ) } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::Fact_4, Site> dispatching_Fact_4(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::Fact_4, Site>(); } template<class... Args> struct impl_Fact_4; } /*! Generates 4! that is 24 @par Semantic: @code T r = Fact_4<T>(); @endcode is similar to: @code T r = T(24); @endcode @par Alias Twentyfour **/ BOOST_SIMD_CONSTANT_IMPLEMENTATION(boost::simd::tag::Fact_4, Fact_4) BOOST_SIMD_CONSTANT_IMPLEMENTATION(boost::simd::tag::Fact_4, Twentyfour) } } #include <boost/simd/constant/common.hpp> #endif <|start_filename|>modules/core/sdk/include/nt2/sdk/memory/composite_buffer.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2011 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2011 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_SDK_MEMORY_COMPOSITE_BUFFER_HPP_INCLUDED #define NT2_SDK_MEMORY_COMPOSITE_BUFFER_HPP_INCLUDED #include <boost/mpl/transform.hpp> #include <boost/fusion/adapted/mpl.hpp> #include <boost/fusion/include/mpl.hpp> #include <boost/fusion/include/copy.hpp> #include <boost/fusion/include/swap.hpp> #include <boost/dispatch/meta/value_of.hpp> #include <boost/dispatch/meta/model_of.hpp> #include <nt2/sdk/meta/strip.hpp> #include <nt2/sdk/meta/container_traits.hpp> #include <nt2/sdk/memory/composite_iterator.hpp> #include <nt2/sdk/memory/composite_reference.hpp> #include <nt2/sdk/memory/adapted/composite_buffer.hpp> #include <boost/fusion/include/vector.hpp> #include <boost/fusion/include/for_each.hpp> #include <boost/fusion/include/value_at.hpp> #include <boost/fusion/include/zip_view.hpp> #include <boost/fusion/include/as_vector.hpp> #include <boost/fusion/include/transform_view.hpp> namespace nt2 { namespace memory { //============================================================================ /** * \brief Buffer for composite types * * composite_buffer allow type registered as composite to automatically be * promoted to a structure of array instead of an array of structure. * * \tparam Buffer Buffer to use as an underlying storage **/ //============================================================================ template<typename Buffer> class composite_buffer { public: //========================================================================== // Extract the value type of Buffer and its meta-model, convert the value // to its equivalent fusion tuple and apply a transform to turn each types // in this tuple into a buffer of proper model. //========================================================================== typedef typename Buffer::value_type base_t; typedef typename boost::dispatch::meta::model_of<Buffer>::type model_t; typedef typename boost::fusion::result_of::as_vector<base_t>::type types_t; typedef typename boost::mpl::transform<types_t,model_t>::type data_t; //========================================================================== // Container types //========================================================================== typedef base_t value_type; typedef typename boost::mpl:: transform < data_t , meta::allocator_type_<boost::mpl::_> >::type allocator_type; typedef typename boost::mpl:: transform < data_t , meta::pointer_<boost::mpl::_> >::type pointer; typedef typename boost::mpl:: transform < data_t , meta::const_pointer_<boost::mpl::_> >::type const_pointer; typedef nt2::container::composite_reference<value_type> reference; typedef nt2::container::composite_reference<value_type const> const_reference; typedef composite_iterator< pointer , value_type , reference > iterator; typedef composite_iterator< const_pointer , value_type , const_reference > const_iterator; typedef std::reverse_iterator<iterator> reverse_iterator; typedef std::reverse_iterator<const_iterator> const_reverse_iterator; typedef std::size_t size_type; typedef std::ptrdiff_t difference_type; private: //========================================================================== // Some helper //========================================================================== struct resizer { std::size_t n_; resizer( std::size_t n ) : n_(n) {} template<typename T> BOOST_FORCEINLINE void operator()(T& t) const { t.resize(n_); } }; struct unary_ctor { template<typename T> BOOST_FORCEINLINE void operator()(T const& t) const { typename meta::strip < typename boost::fusion::result_of ::value_at_c<T,0>::type >::type that(boost::fusion::at_c<1>(t)); boost::fusion::at_c<0>(t).swap(that); } }; typedef boost::fusion::vector2<data_t&,allocator_type&> seq_t; typedef boost::fusion::zip_view<seq_t> view_t; public: //========================================================================== // Default constructor //========================================================================== composite_buffer() {} //========================================================================== // Constructor from allocator //========================================================================== composite_buffer(allocator_type a) { boost::fusion::for_each( view_t( seq_t(data_,a) ), unary_ctor() ); } //========================================================================== // Size constructor //========================================================================== composite_buffer( size_type n ) { boost::fusion::for_each(data_, resizer(n) ); } //========================================================================== // Size+Allocator constructor //========================================================================== composite_buffer( size_type n, allocator_type a) { boost::fusion::for_each( view_t( seq_t(data_,a) ), unary_ctor() ); boost::fusion::for_each( data_, resizer(n) ); } //========================================================================== // Resize //========================================================================== void resize( size_type sz ) { boost::fusion::for_each(data_, resizer(sz) ); } private: //========================================================================== // push_back helpers //========================================================================== struct pusher { template<typename T> BOOST_FORCEINLINE void operator()(T const& t) const { boost::fusion::at_c<0>(t).push_back(boost::fusion::at_c<1>(t)); } }; public: //========================================================================== // Resizes and add one element at the end //========================================================================== template<typename T> void push_back( T const& t ) { typedef boost::fusion::vector2<data_t&,T const&> pseq_t; typedef boost::fusion::zip_view<pseq_t> pview_t; boost::fusion::for_each( pview_t( pseq_t(data_,t) ), pusher() ); } //========================================================================== // Resizes and add a range of elements at the end //========================================================================== struct appender { template<typename T> BOOST_FORCEINLINE void operator()(T const& t) const { nt2::memory::append( boost::fusion::at_c<0>(t) , boost::fusion::at_c<1>(t) , boost::fusion::at_c<2>(t) ); } }; template<typename Iterator> void append( Iterator const& b, Iterator const& e ) { typedef typename Iterator::sequence_type iseq_t; typedef boost::fusion::vector3< data_t& , iseq_t const& , iseq_t const& > pseq_t; typedef boost::fusion::zip_view<pseq_t> pview_t; boost::fusion::for_each( pview_t(pseq_t(data_,b,e)), appender() ); } //========================================================================== // Swap //========================================================================== void swap( composite_buffer& src ) { boost::fusion::swap(data_,src.data_); } private: //========================================================================== // Iterators helper //========================================================================== struct beginer { template<class Sig> struct result; template<class This,class Elem> struct result<This(Elem)> : result<This(Elem&)> {}; template<class This,class Elem> struct result<This(Elem&)> { typedef typename Elem::iterator type; }; template<class This,class Elem> struct result<This(Elem const&)> { typedef typename Elem::const_iterator type; }; template<typename T> BOOST_FORCEINLINE typename result<beginer(T&)>::type operator()(T& t) const { return t.begin(); } template<typename T> BOOST_FORCEINLINE typename result<beginer(T const&)>::type operator()(T const& t) const { return t.begin(); } }; struct ender { template<class Sig> struct result; template<class This,class Elem> struct result<This(Elem)> : result<This(Elem&)> {}; template<class This,class Elem> struct result<This(Elem&)> { typedef typename Elem::iterator type; }; template<class This,class Elem> struct result<This(Elem const&)> { typedef typename Elem::const_iterator type; }; template<typename T> BOOST_FORCEINLINE typename result<ender(T&)>::type operator()(T& t) const { return t.end(); } template<typename T> BOOST_FORCEINLINE typename result<ender(T const&)>::type operator()(T const& t) const { return t.end(); } }; public: //========================================================================== // Iterators API //========================================================================== BOOST_FORCEINLINE iterator begin() { boost::fusion::transform_view<data_t,beginer> that(data_,beginer()); return iterator(that); } BOOST_FORCEINLINE const_iterator begin() const { boost::fusion::transform_view<data_t const,beginer> that(data_,beginer()); return const_iterator(that); } BOOST_FORCEINLINE iterator end() { boost::fusion::transform_view<data_t,ender> that(data_, ender() ); return iterator(that); } BOOST_FORCEINLINE const_iterator end() const { boost::fusion::transform_view<data_t const,ender> that(data_, ender() ); return const_iterator(that); } BOOST_FORCEINLINE reverse_iterator rbegin() { return reverse_iterator(end()); } BOOST_FORCEINLINE const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); } BOOST_FORCEINLINE reverse_iterator rend() { return reverse_iterator(begin()); } BOOST_FORCEINLINE const_reverse_iterator rend() const { return const_reverse_iterator(begin()); } private: //========================================================================== // Raw values helper //========================================================================== struct rawer { template<class Sig> struct result; template<class This,class Elem> struct result<This(Elem)> : result<This(Elem&)> {}; template<class This,class Elem> struct result<This(Elem&)> { typedef typename Elem::pointer type; }; template<class This,class Elem> struct result<This(Elem const&)> { typedef typename Elem::const_pointer type; }; template<typename T> BOOST_FORCEINLINE typename result<rawer(T&)>::type operator()(T& t) const { return t.data(); } template<typename T> BOOST_FORCEINLINE typename result<rawer(T const&)>::type operator()(T const& t) const { return t.data(); } }; public: //========================================================================== // Raw values //========================================================================== BOOST_FORCEINLINE pointer data() { boost::fusion::transform_view<data_t,rawer> that(data_, rawer() ); return that; } BOOST_FORCEINLINE const_pointer data() const { boost::fusion::transform_view<data_t const,rawer> that(data_, rawer() ); return that; } //========================================================================== // Size related members //========================================================================== BOOST_FORCEINLINE size_type size() const { return boost::fusion::at_c<0>(data_).size(); } BOOST_FORCEINLINE size_type capacity() const { return boost::fusion::at_c<0>(data_).capacity(); } BOOST_FORCEINLINE bool empty() const { return boost::fusion::at_c<0>(data_).empty(); } //========================================================================== // Random access helper //========================================================================== private: struct indexer { template<class Sig> struct result; template<class This,class Elem> struct result<This(Elem)> : result<This(Elem&)> {}; template<class This,class Elem> struct result<This(Elem&)> { typedef typename Elem::reference type; }; template<class This,class Elem> struct result<This(Elem const&)> { typedef typename Elem::const_reference type; }; size_type i_; indexer(size_type i) : i_(i) {} template<typename T> BOOST_FORCEINLINE typename result<indexer(T&)>::type operator()(T& t) const { return t[i_]; } template<typename T> BOOST_FORCEINLINE typename result<indexer(T const&)>::type operator()(T const& t) const { return t[i_]; } }; //========================================================================== // Random access //========================================================================== public: BOOST_FORCEINLINE reference operator[](size_type i) { boost::fusion::transform_view<data_t,indexer> that(data_,indexer(i)); return that; } BOOST_FORCEINLINE const_reference operator[](size_type i) const { boost::fusion::transform_view<data_t const,indexer> that(data_,indexer(i)); return that; } private: data_t data_; }; //============================================================================ /**! * Swap the contents of two composite_buffer of same type and allocator * settings * \param x First \c composite_buffer to swap * \param y Second \c composite_buffer to swap **/ //============================================================================ template<class B> inline void swap(composite_buffer<B>& x, composite_buffer<B>& y) { x.swap(y); } } } #endif <|start_filename|>modules/boost/simd/base/include/boost/simd/swar/functions/cumsum.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef BOOST_SIMD_SWAR_FUNCTIONS_CUMSUM_HPP_INCLUDED #define BOOST_SIMD_SWAR_FUNCTIONS_CUMSUM_HPP_INCLUDED #include <boost/simd/include/functor.hpp> #include <boost/dispatch/include/functor.hpp> #include <boost/simd/operator/functions/plus.hpp> #include <boost/simd/constant/constants/zero.hpp> namespace boost { namespace simd { namespace tag { /*! @brief cumsum generic tag Represents the cumsum function in generic contexts. @par Models: Hierarchy **/ struct cumsum_ : ext::cumulative_<cumsum_, tag::plus_, tag::Zero> { /// @brief Parent hierarchy typedef ext::cumulative_<cumsum_, tag::plus_, tag::Zero> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_cumsum_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::cumsum_, Site> dispatching_cumsum_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::cumsum_, Site>(); } template<class... Args> struct impl_cumsum_; } /*! compute the cumulate sum of the vector elements @par Semantic: For every parameter of type T0 @code T0 r = cumsum(a0); @endcode is similar to: @code T r =x; for(int i=0;i < T::static_size; ++i) r[i] += r[i-1]; @endcode @param a0 @return a value of the same type as the second parameter **/ BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::cumsum_, cumsum, 1) BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::cumsum_, cumsum, 2) } } #endif <|start_filename|>modules/boost/simd/base/include/boost/simd/reduction/functions/is_included.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef BOOST_SIMD_REDUCTION_FUNCTIONS_IS_INCLUDED_HPP_INCLUDED #define BOOST_SIMD_REDUCTION_FUNCTIONS_IS_INCLUDED_HPP_INCLUDED #include <boost/simd/include/functor.hpp> #include <boost/dispatch/include/functor.hpp> namespace boost { namespace simd { namespace tag { /*! @brief is_included generic tag Represents the is_included function in generic contexts. @par Models: Hierarchy **/ struct is_included_ : ext::unspecified_<is_included_> { /// @brief Parent hierarchy typedef ext::unspecified_<is_included_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_is_included_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::is_included_, Site> dispatching_is_included_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::is_included_, Site>(); } template<class... Args> struct impl_is_included_; } /*! Returns True is only if all bits set in a0 are also set in a1 @par Semantic: For every parameters of type T0: @code logical<scalar_of<T0>> r = is_included(a0,a1); @endcode is similar to: @code logical<scalar_of<T0>> r = all((a0&a1) == a1); @endcode @param a0 @param a1 @return a value of the scalar logical type associated to the parameters **/ BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::is_included_, is_included, 2) BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::is_included_, testz, 2) } } #endif <|start_filename|>modules/core/base/include/nt2/core/functions/globalfind.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // Copyright 2011 - 2012 MetaScale SAS // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_CORE_FUNCTIONS_GLOBALFIND_HPP_INCLUDED #define NT2_CORE_FUNCTIONS_GLOBALFIND_HPP_INCLUDED /*! @file @brief Defines and implements the globalfind function **/ #include <nt2/include/functor.hpp> namespace nt2 { namespace tag { /*! @brief Tag for the globalfind functor **/ struct globalfind_ : ext::abstract_<globalfind_> { typedef ext::abstract_<globalfind_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_globalfind_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::globalfind_, Site> dispatching_globalfind_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::globalfind_, Site>(); } template<class... Args> struct impl_globalfind_; } BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::globalfind_, globalfind, 1) BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::globalfind_, globalfind, 2) } #endif <|start_filename|>modules/core/optimization/include/nt2/optimization/functions/neldermead.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_OPTIMIZATION_FUNCTIONS_NELDERMEAD_HPP_INCLUDED #define NT2_OPTIMIZATION_FUNCTIONS_NELDERMEAD_HPP_INCLUDED #include <nt2/include/functor.hpp> #include <nt2/sdk/option/options.hpp> #include <nt2/optimization/options.hpp> namespace nt2 { namespace tag { /*! @brief neldermead generic tag Represents the neldermead function in generic contexts. @par Models: Hierarchy **/ struct neldermead_ : ext::unspecified_<neldermead_> { /// @brief Parent hierarchy typedef ext::unspecified_<neldermead_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_neldermead_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::neldermead_, Site> dispatching_neldermead_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::neldermead_, Site>(); } template<class... Args> struct impl_neldermead_; } /*! Apply neldermead algorithm to find local minimum of a function \param f Function to optimize \param init Initial value \param steps Which are the unknowns we want to optimize \param opt Options pack related to the minimization handling \return a tuple containing the result of the minimization, the value of the function at minimum, the number of required iteration and a boolean notifying success of convergence. From original FORTRAN77 version by <NAME>. Reference: <NAME>, <NAME>, A simplex method for function minimization, Computer Journal, Volume 7, 1965, pages 308-313. <NAME>, Algorithm AS 47: Function Minimization Using a Simplex Procedure, Applied Statistics, Volume 20, Number 3, 1971, pages 338-345. */ template<class F, class A, class H, class Xpr> BOOST_FORCEINLINE typename boost::dispatch::meta ::call<tag::neldermead_( F , A, H , details::optimization_settings<typename A::value_type> const& ) >::type neldermead(F f, A init, H steps, nt2::details::option_expr<Xpr> const& opt) { typename boost::dispatch::make_functor<tag::neldermead_, F>::type callee; return callee ( f , init , steps , details::optimization_settings<typename A::value_type>(opt) ); } /// @overload template<class F, class A, class H> BOOST_FORCEINLINE typename boost::dispatch::meta ::call<tag::neldermead_( F , A, H , details::optimization_settings<typename A::value_type> const& ) >::type neldermead(F f, A init, H steps) { typename boost::dispatch::make_functor<tag::neldermead_, F>::type callee; return callee ( f , init , steps , details::optimization_settings<typename A::value_type>() ); } } #endif <|start_filename|>modules/boost/simd/base/include/boost/simd/ieee/functions/exponentbits.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef BOOST_SIMD_IEEE_FUNCTIONS_EXPONENTBITS_HPP_INCLUDED #define BOOST_SIMD_IEEE_FUNCTIONS_EXPONENTBITS_HPP_INCLUDED #include <boost/simd/include/functor.hpp> #include <boost/dispatch/include/functor.hpp> namespace boost { namespace simd { namespace tag { /*! @brief exponentbits generic tag Represents the exponentbits function in generic contexts. @par Models: Hierarchy **/ struct exponentbits_ : ext::elementwise_<exponentbits_> { /// @brief Parent hierarchy typedef ext::elementwise_<exponentbits_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_exponentbits_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::exponentbits_, Site> dispatching_exponentbits_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::exponentbits_, Site>(); } template<class... Args> struct impl_exponentbits_; } /*! Returns the exponent bits of the floating input as an integer value. the other bits (sign and mantissa) are just masked. This function is not defined on integral types. @par Semantic: @code as_integer<T> r = exponentbits(x); @endcode is similar to @code as_integer<T> r = x&Exponentmask<T>(); @endcode @param a0 @return a value of the integral type associated to the input **/ BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::exponentbits_, exponentbits, 1) } } #endif <|start_filename|>modules/boost/simd/base/include/boost/simd/bitwise/functions/bitset.hpp<|end_filename|> //============================================================================== // Copyright 2015 J.T. Lapreste // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef BOOST_SIMD_BITWISE_FUNCTIONS_BITSET_HPP_INCLUDED #define BOOST_SIMD_BITWISE_FUNCTIONS_BITSET_HPP_INCLUDED #include <boost/simd/include/functor.hpp> #include <boost/dispatch/include/functor.hpp> namespace boost { namespace simd { namespace tag { /*! @brief bitset generic tag Represents the bitset function in generic contexts. @par Models: Hierarchy **/ struct bitset_ : ext::elementwise_<bitset_> { /// @brief Parent hierarchy typedef ext::elementwise_<bitset_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_bitset_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::bitset_, Site> dispatching_bitset_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::bitset_, Site>(); } template<class... Args> struct impl_bitset_; } /*! Returns x with the ith bit set @par semantic: For any given value @c x of type @c T, i of type @c I: @code as_integer<T> r = bitset(x, i); @endcode @see @funcref{bitset} @param x @param i @return a value of the type of the first input. **/ BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::bitset_, bitset, 2) } } #endif <|start_filename|>modules/core/restructuring/include/nt2/core/functions/squeeze.hpp<|end_filename|> //============================================================================== // Copyright 2003 & onward LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 & onward LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_CORE_FUNCTIONS_SQUEEZE_HPP_INCLUDED #define NT2_CORE_FUNCTIONS_SQUEEZE_HPP_INCLUDED #include <nt2/include/functor.hpp> #include <nt2/core/container/dsl/reshaping.hpp> #include <nt2/sdk/meta/reshaping_hierarchy.hpp> namespace nt2 { namespace tag { /*! @brief squeeze generic tag Represents the squeeze function in generic contexts. @par Models: Hierarchy **/ struct squeeze_ : ext::reshaping_<squeeze_> { /// @brief Parent hierarchy typedef ext::reshaping_<squeeze_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_squeeze_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::squeeze_, Site> dispatching_squeeze_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::squeeze_, Site>(); } template<class... Args> struct impl_squeeze_; } /*! squeeze an expression by removing its singleton dimensions @par Semantic: For every table expression @code auto r = squeeze(a0); @endcode @param a0 @return an expression which eventually will evaluate to the result **/ NT2_FUNCTION_IMPLEMENTATION(nt2::tag::squeeze_, squeeze, 1) } namespace nt2 { namespace ext { /// INTERNAL ONLY template<class Domain, int N, class Expr> struct size_of<nt2::tag::squeeze_,Domain,N,Expr> { typedef typename boost::proto::result_of ::child_c<Expr&,0>::value_type::extent_type result_type; BOOST_FORCEINLINE result_type operator()(Expr& e) const { result_type sizee; result_type ex = boost::proto::child_c<0>(e).extent(); // Squeeze don't affect 2D array if(result_type::static_size <= 2) { sizee = ex; } else { // Copy non singleton dimensions std::size_t u = 0; for(std::size_t i=0;i<result_type::static_size;++i) { if(ex[i] != 1) { sizee[u] = ex[i]; ++u; } } // Ensure non-empty size sizee[0] = sizee[0] ? sizee[0] : 1; } return sizee; } }; } } #endif <|start_filename|>modules/core/polynomials/include/nt2/polynomials/functions/plevl.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_POLYNOMIALS_FUNCTIONS_PLEVL_HPP_INCLUDED #define NT2_POLYNOMIALS_FUNCTIONS_PLEVL_HPP_INCLUDED #include <nt2/include/functor.hpp> // plevl(x, p) // This compute the evaluation of a polynomial p of degree N at x // The polynomial is supposed to be given by an array of N elements // in decreasing degrees order and the leading coef is supposed to be one // and not a part of the polynomial namespace nt2 { namespace tag { struct plevl_ : ext::elementwise_<plevl_> { typedef ext::elementwise_<plevl_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_plevl_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::plevl_, Site> dispatching_plevl_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::plevl_, Site>(); } template<class... Args> struct impl_plevl_; } NT2_FUNCTION_IMPLEMENTATION(tag::plevl_, plevl, 2) NT2_FUNCTION_IMPLEMENTATION(tag::plevl_, p1evl, 2) } #endif // modified by jt the 25/12/2010 <|start_filename|>modules/boost/simd/base/include/boost/simd/ieee/functions/nextpow2.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef BOOST_SIMD_IEEE_FUNCTIONS_NEXTPOW2_HPP_INCLUDED #define BOOST_SIMD_IEEE_FUNCTIONS_NEXTPOW2_HPP_INCLUDED #include <boost/simd/include/functor.hpp> #include <boost/dispatch/include/functor.hpp> namespace boost { namespace simd { namespace tag { /*! @brief nextpow2 generic tag Represents the nextpow2 function in generic contexts. @par Models: Hierarchy **/ struct nextpow2_ : ext::elementwise_<nextpow2_> { /// @brief Parent hierarchy typedef ext::elementwise_<nextpow2_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_nextpow2_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::nextpow2_, Site> dispatching_nextpow2_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::nextpow2_, Site>(); } template<class... Args> struct impl_nextpow2_; } /*! Returns the least n such that abs(x) is less or equal to \f$2^n\f$ @par Semantic: @code T r = nextpow2(a0); @endcode is similar to: @code T n = ceil(log2(abs(x)x)); @endcode @param a0 @return a value of same type as the input **/ BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::nextpow2_, nextpow2, 1) } } #endif <|start_filename|>modules/core/trigonometric/include/nt2/trigonometric/functions/fast_sin.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_TRIGONOMETRIC_FUNCTIONS_FAST_SIN_HPP_INCLUDED #define NT2_TRIGONOMETRIC_FUNCTIONS_FAST_SIN_HPP_INCLUDED #include <nt2/include/functor.hpp> namespace nt2 { namespace tag { /*! @brief fast_sin generic tag Represents the fast_sin function in generic contexts. @par Models: Hierarchy **/ struct fast_sin_ : ext::elementwise_<fast_sin_> { /// @brief Parent hierarchy typedef ext::elementwise_<fast_sin_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_fast_sin_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::fast_sin_, Site> dispatching_fast_sin_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::fast_sin_, Site>(); } template<class... Args> struct impl_fast_sin_; } /*! sine in the interval \f$[-\pi/4, \pi/4]\f$, nan outside. @par Semantic: For every parameter of floating type T0 @code T0 r = fast_sin(x); @endcode is similar to: @code T0 r = sin(x) ; @endcode provided that x belongs to \f$[-\pi/4, \pi/4]\f$ @see @funcref{sine}, @funcref{sin}, @funcref{sincos}, @funcref{sind}, @funcref{sinpi} @param a0 @return a value of the same type as the parameter **/ NT2_FUNCTION_IMPLEMENTATION(tag::fast_sin_, fast_sin, 1) } #endif <|start_filename|>modules/boost/simd/base/include/boost/simd/bitwise/functions/genmask.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef BOOST_SIMD_BITWISE_FUNCTIONS_GENMASK_HPP_INCLUDED #define BOOST_SIMD_BITWISE_FUNCTIONS_GENMASK_HPP_INCLUDED #include <boost/simd/include/functor.hpp> #include <boost/dispatch/include/functor.hpp> namespace boost { namespace simd { namespace tag { /*! @brief genmask generic tag Represents the genmask function in generic contexts. @par Models: Hierarchy **/ struct genmask_ : ext::elementwise_<genmask_> { /// @brief Parent hierarchy typedef ext::elementwise_<genmask_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_genmask_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::genmask_, Site> dispatching_genmask_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::genmask_, Site>(); } template<class... Args> struct impl_genmask_; } /*! Returns a mask of bits. All ones if the input element is non zero else all zeros. @par semantic: For any given value @c x of type @c T: @code T r = genmask(x); @endcode is similar to @code T r = x ? Allbits : Zero; @endcode @par Alias: @c typed_mask, @c logical2mask, @c l2m, @c typed_mask, @c if_allbits_else_zero @see @funcref{if_allbits_else} @param a0 @return a value of the type of the input. **/ BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::genmask_, genmask, 1) BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::genmask_, typed_mask, 1) BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::genmask_, logical2mask, 1) BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::genmask_, l2m, 1) BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::genmask_, if_allbits_else_zero, 1) } } #endif <|start_filename|>modules/core/combinatorial/include/nt2/combinatorial/functions/combs.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_COMBINATORIAL_FUNCTIONS_COMBS_HPP_INCLUDED #define NT2_COMBINATORIAL_FUNCTIONS_COMBS_HPP_INCLUDED #include <nt2/include/functor.hpp> namespace nt2 { namespace tag { /*! @brief combs generic tag Represents the combs function in generic contexts. @par Models: Hierarchy **/ struct combs_ : ext::elementwise_<combs_> { /// @brief Parent hierarchy typedef ext::elementwise_<combs_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_combs_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::combs_, Site> dispatching_combs_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::combs_, Site>(); } template<class... Args> struct impl_combs_; } /*! Computes combination number of combined subvectors. @par Semantic: @code auto r = combs(a0, k); @endcode - when a0 (n) and k are non-negative integers the number of combinations of k elements among n. If n or k are large a warning will be produced indicating possible inexact results. in such cases, the result is only accurate to 15 digits for double-precision inputs, or 8 digits for single-precision inputs. - when a0 is a vector of length n, and k is an integer produces a matrix with n!/k!(n-k)! rows and k columns. each row of the result has k of the elements in the vector v. this syntax is only practical for situations where n is less than about 15. @see @funcref{cnp} @param a0 @param a1 @return an expression which eventually will evaluate to the result **/ NT2_FUNCTION_IMPLEMENTATION(tag::combs_, combs, 2) } #endif <|start_filename|>modules/arch/tbb/include/nt2/sdk/tbb/spawner/scan.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2011 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2013 LRI UMR 8623 CNRS/Univ Paris Sud XI // Copyright 2012 - 2013 MetaScale SAS // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_SDK_TBB_SPAWNER_SCAN_HPP_INCLUDED #define NT2_SDK_TBB_SPAWNER_SCAN_HPP_INCLUDED #if defined(NT2_USE_TBB) #include <tbb/tbb.h> #include <nt2/sdk/tbb/blocked_range.hpp> #include <nt2/sdk/shared_memory/spawner.hpp> #ifndef BOOST_NO_EXCEPTIONS #include <boost/exception_ptr.hpp> #endif namespace nt2 { namespace tag { struct scan_; template<class T> struct tbb_; } namespace details { template<class Worker, class result_type> struct Tbb_Scaner { Tbb_Scaner(Worker & w) :w_(w) { out_ = w.neutral_(nt2::meta::as_<result_type>()); } Tbb_Scaner(Tbb_Scaner& src, tbb::split) : w_(src.w_) { out_ = w_.neutral_(nt2::meta::as_<result_type>()); } template<typename Tag> void operator()(nt2::blocked_range<std::size_t> const& r, Tag) { out_ = w_(out_,r.begin(),r.size(),!Tag::is_final_scan()); }; void reverse_join(Tbb_Scaner& rhs) { out_ = w_.bop_(rhs.out_,out_); } void assign( Tbb_Scaner& b ) { out_ = b.out_; } Worker & w_; result_type out_; private: Tbb_Scaner& operator=(Tbb_Scaner const&); }; } template<class Site, class result_type> struct spawner< tag::scan_, tag::tbb_<Site> , result_type> { spawner(){} template<typename Worker> result_type operator()(Worker & w, std::size_t begin, std::size_t size, std::size_t grain) { #ifndef BOOST_NO_EXCEPTIONS boost::exception_ptr exception; #endif BOOST_ASSERT_MSG( size % grain == 0, "Reduce size not divisible by grain"); details::Tbb_Scaner<Worker,result_type> tbb_w ( w ); #ifndef BOOST_NO_EXCEPTIONS try { #endif tbb::parallel_scan( nt2::blocked_range<std::size_t>(begin,begin+size,grain) , tbb_w ); #ifndef BOOST_NO_EXCEPTIONS } catch(...) { exception = boost::current_exception(); } #endif return tbb_w.out_; } }; } #endif #endif <|start_filename|>modules/core/linalg/include/nt2/linalg/functions/gesvx.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2013 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_LINALG_FUNCTIONS_GESVX_HPP_INCLUDED #define NT2_LINALG_FUNCTIONS_GESVX_HPP_INCLUDED /*! @file @brief Defines and implements lapack gesvx function that computes the solution of real system of linear equations a*x = b with an lu decomposition done with the lapack function dgetrf. Iterative refinement is applied to increase the precision. **/ #include <nt2/include/functor.hpp> namespace nt2 { namespace tag { /// @brief Defines gesvx function tag struct gesvx_ : ext::abstract_<gesvx_> { /// INTERNAL ONLY typedef ext::abstract_<gesvx_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_gesvx_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::gesvx_, Site> dispatching_gesvx_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::gesvx_, Site>(); } template<class... Args> struct impl_gesvx_; } /*! @brief @param @param @return **/ NT2_FUNCTION_IMPLEMENTATION_TPL (tag::gesvx_, gesvx , (A0 const&)(A1 const&)(A2&)(A3&) , 4 ); } #endif <|start_filename|>modules/boost/simd/base/include/boost/simd/ieee/functions/eps.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef BOOST_SIMD_IEEE_FUNCTIONS_EPS_HPP_INCLUDED #define BOOST_SIMD_IEEE_FUNCTIONS_EPS_HPP_INCLUDED #include <boost/simd/include/functor.hpp> #include <boost/dispatch/include/functor.hpp> namespace boost { namespace simd { namespace tag { /*! @brief eps generic tag Represents the eps function in generic contexts. @par Models: Hierarchy **/ struct eps_ : ext::elementwise_<eps_> { /// @brief Parent hierarchy typedef ext::elementwise_<eps_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_eps_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::eps_, Site> dispatching_eps_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::eps_, Site>(); } template<class... Args> struct impl_eps_; } /*! Except for numbers whose absolute value is smaller than Smallestpositivevalue, @c eps(x) returns 2^(exponent(x))*Eps @par Semantic: @code T r = eps(a0); @endcode is similar to: @code if T is floating r = 2^(exponent(x))*Eps<T> else if T is integral r = 1; @endcode @param a0 @return a value of same type as the input **/ BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::eps_, eps, 1) } } #endif <|start_filename|>modules/boost/simd/base/include/boost/simd/swar/functions/sort.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef BOOST_SIMD_SWAR_FUNCTIONS_SORT_HPP_INCLUDED #define BOOST_SIMD_SWAR_FUNCTIONS_SORT_HPP_INCLUDED #include <boost/simd/include/functor.hpp> #include <boost/dispatch/include/functor.hpp> #include <boost/dispatch/meta/tieable.hpp> namespace boost { namespace simd { namespace tag { /*! @brief sort generic tag Represents the sort function in generic contexts. @par Models: Hierarchy **/ struct sort_ : ext::tieable_<sort_> { /// @brief Parent hierarchy typedef ext::tieable_<sort_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_sort_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::sort_, Site> dispatching_sort_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::sort_, Site>(); } template<class... Args> struct impl_sort_; } /*! returns the sorted a0 vector in ascending order @par Semantic: For every parameter of type T0 @code T0 r = sort(a0); @endcode @param a0 @return a value of the same type as the second parameter **/ BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::sort_, sort, 1) BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::sort_, sort, 2) BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::sort_, sort, 3) } } #endif <|start_filename|>modules/core/gallery/include/nt2/gallery/functions/chebvand.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_GALLERY_FUNCTIONS_CHEBVAND_HPP_INCLUDED #define NT2_GALLERY_FUNCTIONS_CHEBVAND_HPP_INCLUDED #include <nt2/include/functor.hpp> /*! * \ingroup algebra * \defgroup algebra_chebvand chebvand * * \par Description * function C = chebvand(m,p) * compute a vandermonde-like matrix for the chebyshev polynomials. * c = chebvand(p), where p is a vector, produces the * (primal) chebyshev vandermonde matrix based on the points p: * c(i,j) = t_{i-1}(p(j)), where t_{i-1} is the chebyshev * polynomial of degree i-1. * chebvand(m,p) is a rectangular version of * chebvand(p) with m rows. * special case: if p is a scalar, then p equally spaced points on * [0,1] are used. * Reference: * [1] <NAME>, Stability analysis of algorithms for solving confluent * Vandermonde-like systems, SIAM J. Matrix Anal. Appl., 11 (1990), * pp. 23-41. * * <NAME>, Dec 1999. * * \par Header file * * \code * #include <nt2/include/functions/chebvand.hpp> * \endcode * **/ //============================================================================== // chebvand actual class forward declaration //============================================================================== namespace nt2 { namespace tag { /*! * \brief Define the tag chebvand_ of functor chebvand * in namespace nt2::tag for toolbox algebra **/ struct chebvand_ : ext::unspecified_<chebvand_> { typedef ext::unspecified_<chebvand_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_chebvand_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::chebvand_, Site> dispatching_chebvand_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::chebvand_, Site>(); } template<class... Args> struct impl_chebvand_; } BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::chebvand_, chebvand, 1) BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::chebvand_, chebvand, 2) BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::chebvand_, chebvand, 3) template < class T > BOOST_FORCEINLINE typename meta::call<tag::chebvand_(size_t, size_t, meta::as_<T>)>::type chebvand(size_t n, size_t k) { return nt2::chebvand(n, k, meta::as_<T>()); } template < class T > BOOST_FORCEINLINE typename meta::call<tag::chebvand_(size_t, meta::as_<T>)>::type chebvand(size_t n) { return nt2::chebvand(n, meta::as_<T>()); } } #endif <|start_filename|>modules/core/trigonometric/include/nt2/trigonometric/constants/_45.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2011 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2011 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_TRIGONOMETRIC_CONSTANTS_45_HPP_INCLUDED #define NT2_TRIGONOMETRIC_CONSTANTS_45_HPP_INCLUDED #include <nt2/include/functor.hpp> #include <boost/simd/constant/hierarchy.hpp> #include <boost/simd/constant/register.hpp> namespace nt2 { namespace tag { /*! @brief _45 generic tag Represents the _45 constant in generic contexts. @par Models: Hierarchy **/ BOOST_SIMD_CONSTANT_REGISTER( _45, double , 45, 0x42340000 , 0x4046800000000000ll ) } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::_45, Site> dispatching__45(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::_45, Site>(); } template<class... Args> struct impl__45; } /*! Constant 45. @par Semantic: For type T0: @code T0 r = _45<T0>(); @endcode is similar to: @code T0 r = 45; @endcode @return a value of type T0 **/ BOOST_SIMD_CONSTANT_IMPLEMENTATION(tag::_45, _45); } #endif <|start_filename|>modules/core/combinatorial/include/nt2/combinatorial/functions/fibonacci.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_COMBINATORIAL_FUNCTIONS_FIBONACCI_HPP_INCLUDED #define NT2_COMBINATORIAL_FUNCTIONS_FIBONACCI_HPP_INCLUDED #include <nt2/include/functor.hpp> #include <nt2/sdk/meta/size_as.hpp> #include <nt2/sdk/meta/value_as.hpp> #include <nt2/core/container/dsl/size.hpp> #include <nt2/core/container/dsl/value_type.hpp> namespace nt2 { namespace tag { /*! @brief fibonacci generic tag Represents the fibonacci function in generic contexts. @par Models: Hierarchy **/ struct fibonacci_ : ext::unspecified_<fibonacci_> { /// @brief Parent hierarchy typedef ext::unspecified_<fibonacci_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_fibonacci_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::fibonacci_, Site> dispatching_fibonacci_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::fibonacci_, Site>(); } template<class... Args> struct impl_fibonacci_; } /*! returns the values selected by n of a fibonacci sequence starting by a and b the values are computed by the Binet formula and rounded if a and b are flint. @par Semantic: For every floating expressions a and b and integer expression n @code auto r = fibonacci(a, b, n); @endcode The recurrence formula defining the fibonacci sequence is: - r(1) = a - r(2) = b - r(i+2) = r(i+1)+r(i), i > 2 @param a0 @param a1 @param a2 @return an expression which eventually will evaluate to the result **/ NT2_FUNCTION_IMPLEMENTATION(tag::fibonacci_,fibonacci, 3) } namespace nt2 { namespace ext { /// INTERNAL ONLY template<class Domain, class Expr, int N> struct size_of<tag::fibonacci_, Domain, N, Expr> { typedef _2D result_type; BOOST_FORCEINLINE result_type operator()(Expr& e) const { result_type sizee = nt2::extent(boost::proto::child_c<2>(e)); return sizee; } }; /// INTERNAL ONLY template <class Domain, class Expr, int N> struct value_type < tag::fibonacci_, Domain,N,Expr> : meta::value_as<Expr,2> { }; } } #endif <|start_filename|>modules/boost/simd/base/include/boost/simd/arithmetic/functions/fast_hypot.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef BOOST_SIMD_ARITHMETIC_FUNCTIONS_FAST_HYPOT_HPP_INCLUDED #define BOOST_SIMD_ARITHMETIC_FUNCTIONS_FAST_HYPOT_HPP_INCLUDED #include <boost/simd/include/functor.hpp> #include <boost/dispatch/include/functor.hpp> namespace boost { namespace simd { namespace tag { /*! @brief fast_hypot generic tag Represents the fast_hypot function in generic contexts. @par Models: Hierarchy **/ struct fast_hypot_ : ext::elementwise_<fast_hypot_> { /// @brief Parent hierarchy typedef ext::elementwise_<fast_hypot_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_fast_hypot_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::fast_hypot_, Site> dispatching_fast_hypot_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::fast_hypot_, Site>(); } template<class... Args> struct impl_fast_hypot_; } /*! Computes \f$(x^2 + y^2)^{1/2}\f$ @par semantic: For any given value @c x, @c y of type @c T: @code T r = fast_hypot(x, y); @endcode The code is equivalent to: @code T r =sqrt(sqr(x)+sqr(y)); @endcode Fast means that nothing is done to avoid overflow or inaccuracies for large values. See @funcref{hypot} if that matters. @param a0 @param a1 @return a value of the same floating type as the input. **/ BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::fast_hypot_, fast_hypot, 2) } } #endif <|start_filename|>modules/core/exponential/include/nt2/exponential/constants/maxlog10.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2011 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2011 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_EXPONENTIAL_CONSTANTS_MAXLOG10_HPP_INCLUDED #define NT2_EXPONENTIAL_CONSTANTS_MAXLOG10_HPP_INCLUDED #include <nt2/include/functor.hpp> #include <boost/simd/constant/hierarchy.hpp> #include <boost/simd/constant/register.hpp> namespace nt2 { namespace tag { /*! @brief Maxlog10 generic tag Represents the Maxlog10 constant in generic contexts. @par Models: Hierarchy **/ BOOST_SIMD_CONSTANT_REGISTER( Maxlog10, double , 0, 0x4218ec59UL , 0x40734413509f79feULL ) } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::Maxlog10, Site> dispatching_Maxlog10(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::Maxlog10, Site>(); } template<class... Args> struct impl_Maxlog10; } /*! Generates constant Maxlog10 used in logarithm/exponential computations @par Semantic: @code T r = Maxlog10<T>(); @endcode is similar to: @code if T is double r = 308.2547155599167; else if T is float r = 38.23080825805664; @endcode **/ BOOST_SIMD_CONSTANT_IMPLEMENTATION(tag::Maxlog10, Maxlog10); } #endif <|start_filename|>modules/boost/simd/base/include/boost/simd/constant/constants/mthree.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2011 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2011 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef BOOST_SIMD_CONSTANT_CONSTANTS_MTHREE_HPP_INCLUDED #define BOOST_SIMD_CONSTANT_CONSTANTS_MTHREE_HPP_INCLUDED #include <boost/simd/include/functor.hpp> #include <boost/simd/constant/register.hpp> #include <boost/simd/constant/hierarchy.hpp> namespace boost { namespace simd { namespace tag { /*! @brief Mthree generic tag Represents the Mthree constant in generic contexts. @par Models: Hierarchy **/ BOOST_SIMD_CONSTANT_REGISTER( Mthree, double, -3 , 0xc0400000UL, 0xc008000000000000ULL ) } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::Mthree, Site> dispatching_Mthree(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::Mthree, Site>(); } template<class... Args> struct impl_Mthree; } /*! Generates value -3 @par Semantic: @code T r = Mthree<T>(); @endcode is similar to: @code T r = T(-3); @endcode **/ BOOST_SIMD_CONSTANT_IMPLEMENTATION(boost::simd::tag::Mthree, Mthree) } } #include <boost/simd/constant/common.hpp> #endif <|start_filename|>modules/core/linalg/include/nt2/linalg/functions/mnormfro.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_LINALG_FUNCTIONS_MNORMFRO_HPP_INCLUDED #define NT2_LINALG_FUNCTIONS_MNORMFRO_HPP_INCLUDED #include <nt2/include/functor.hpp> /*! * \ingroup algebra * \defgroup algebra_mnormfro mnormfro * * \par Description * compute the froboenius norm of a vector or a matrix * * that is : * sqrt(asum2((_)) * * \par Header file * * \code * #include <nt2/include/functions/mnormfro.hpp> * \endcode * * mnormfro can be used as * mnormfro(a) * * \param a the matrix or vector expression a * **/ namespace nt2 { namespace tag { /*! * \brief Define the tag mnormfro_ of functor mnormfro * in namespace nt2::tag for toolbox algebra **/ struct mnormfro_ : ext::abstract_<mnormfro_> { /// INTERNAL ONLY typedef ext::abstract_<mnormfro_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_mnormfro_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::mnormfro_, Site> dispatching_mnormfro_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::mnormfro_, Site>(); } template<class... Args> struct impl_mnormfro_; } BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::mnormfro_, mnormfro, 1) } #endif <|start_filename|>modules/binding/magma/include/nt2/linalg/functions/magma/dgerfs.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_LINALG_FUNCTIONS_MAGMA_DGERFS_HPP_INCLUDED #define NT2_LINALG_FUNCTIONS_MAGMA_DGERFS_HPP_INCLUDED #if defined(NT2_USE_MAGMA) #include <nt2/sdk/magma/magma.hpp> #include <nt2/include/constants/eps.hpp> #include <nt2/linalg/details/utility/f77_wrapper.hpp> #include <nt2/linalg/details/magma_buffer.hpp> #include <nt2/linalg/details/lapack/lange.hpp> #include <nt2/core/container/table/kind.hpp> #include <nt2/include/functions/pow.hpp> #include <magma.h> #include <nt2/core/container/table/table.hpp> #define BWDMAX 1.0 #define ITERMAX 5 magma_int_t dgerfs_gpu(magma_trans_t trans, magma_int_t N, magma_int_t NRHS, double *dA, magma_int_t ldda, double *dAF, magma_int_t lddaf, magma_int_t *IPIV, double *dB, magma_int_t lddb, double *dX, magma_int_t lddx, double *dworkd, magma_int_t *iter, magma_int_t *info) { double c_neg_one = MAGMA_D_NEG_ONE; double c_one = MAGMA_D_ONE; magma_int_t ione = 1; double cte, eps; double Xnrmv, Rnrmv; double Anrm, Xnrm, Rnrm; magma_int_t i, j, iiter; /* Check The Parameters. */ *info = *iter = 0 ; if ( N <0) *info = -1; else if(NRHS<0) *info =-2; else if(ldda < std::max(1,N)) *info =-4; else if( lddb < std::max(1,N)) *info =-8; else if( lddx < std::max(1,N)) *info =-10; if (*info != 0) { magma_xerbla( __func__, -(*info) ); return *info; } if( N == 0 || NRHS == 0 ) return *info; eps = boost::simd::Eps<double>(); Anrm = magmablas_dlange(MagmaInfNorm, N, N, dA, ldda, dworkd ); cte = Anrm * eps * nt2::pow((double)N,0.5) * BWDMAX; if(*info !=0){ *iter = -2 ; goto L40; } if(info[0] !=0){ *iter = -3 ; goto L40; } magmablas_dlacpy(MagmaUpperLower, N, NRHS, dB, lddb, dworkd, N); if ( NRHS == 1 ) magma_dgemv( trans, N, N, c_neg_one, dA, ldda, dX, 1, c_one, dworkd, 1); else magma_dgemm( trans, MagmaNoTrans, N, NRHS, N, c_neg_one, dA, ldda, dX, lddx, c_one, dworkd, N); for(i=0;i<NRHS;i++) { j = magma_idamax( N, dX+i*lddx, 1) ; magma_dgetmatrix( 1, 1, dX+i*lddx+j-1, 1, &Xnrmv, 1 ); Xnrm = NT2_F77NAME(dlange) ( "F", &ione, &ione, &Xnrmv, &ione, NULL ); j = magma_idamax ( N, dworkd+i*N, 1 ); magma_dgetmatrix( 1, 1, dworkd+i*N+j-1, 1, &Rnrmv, 1 ); Rnrm = NT2_F77NAME(dlange) ( "F", &ione, &ione, &Rnrmv, &ione, NULL ); if( Rnrm > (Xnrm*cte) ){ goto L10; } } *iter = 0; return *info; L10: ; for(iiter=1;iiter<ITERMAX;) { *info = 0 ; magma_dgetrs_gpu(trans, N, NRHS, dAF, lddaf, IPIV, dworkd, lddb, info ); if(info[0] != 0){ *iter = -3 ; goto L40; } for(i=0;i<NRHS;i++){ #if MAGMA_VERSION_MAJOR <= 1 && MAGMA_VERSION_MINOR < 4 magmablas_daxpycp(dworkd+i*N, dX+i*lddx, N, dB+i*lddb); #else magmablas_daxpycp(N, dworkd+i*N, dX+i*lddx, dB+i*lddb); #endif } //magmablas_dlacpy(MagmaUpperLower, N, NRHS, dB, lddb, dworkd, N); if( NRHS == 1 ) magma_dgemv( trans, N, N, c_neg_one, dA, ldda, dX, 1, c_one, dworkd, 1); else magma_dgemm( trans, MagmaNoTrans, N, NRHS, N, c_neg_one, dA, ldda, dX, lddx, c_one, dworkd, N); /* Check whether the NRHS normwise backward errors satisfy the stopping criterion. If yes, set ITER=IITER>0 and return. */ for(i=0;i<NRHS;i++) { j = magma_idamax( N, dX+i*lddx, 1) ; magma_dgetmatrix( 1, 1, dX+i*lddx+j-1, 1, &Xnrmv, 1 ); Xnrm = NT2_F77NAME(dlange)( "F", &ione, &ione, &Xnrmv, &ione, NULL ); j = magma_idamax ( N, dworkd+i*N, 1 ); magma_dgetmatrix( 1, 1, dworkd+i*N+j-1, 1, &Rnrmv, 1 ); Rnrm = NT2_F77NAME(dlange)( "F", &ione, &ione, &Rnrmv, &ione, NULL ); if( Rnrm > Xnrm *cte ){ goto L20; } } /* If we are here, the NRHS normwise backward errors satisfy the stopping criterion, we are good to exit. */ *iter = iiter ; return *info; L20: iiter++ ; } /* If we are at this place of the code, this is because we have performed ITER=ITERMAX iterations and never satisified the stopping criterion, set up the ITER flag accordingly and follow up on double precision routine. */ *iter = -ITERMAX - 1 ; L40: if( *info != 0 ){ return *info; } return *info; } magma_int_t sgerfs_gpu(magma_trans_t trans, magma_int_t N, magma_int_t NRHS, float *dA, magma_int_t ldda, float *dAF, magma_int_t lddaf, magma_int_t *IPIV, float *dB, magma_int_t lddb, float *dX, magma_int_t lddx, float *dworks, magma_int_t *iter, magma_int_t *info) { nt2::details::magma_buffer<double> dworkd(N,1); nt2::details::magma_buffer<double> dXd(N,NRHS); nt2::details::magma_buffer<double> dBd(N,NRHS); float c_neg_one = MAGMA_D_NEG_ONE; float c_one = MAGMA_D_ONE; magma_int_t ione = 1; float cte, eps; float Xnrmv, Rnrmv; float Anrm, Xnrm, Rnrm; magma_int_t i, j, iiter,info1; /* Check The Parameters. */ *info = *iter = 0 ; if ( N <0) *info = -1; else if(NRHS<0) *info =-2; else if(ldda < std::max(1,N)) *info =-4; else if( lddb < std::max(1,N)) *info =-8; else if( lddx < std::max(1,N)) *info =-10; if (*info != 0) { magma_xerbla( __func__, -(*info) ); return *info; } if( N == 0 || NRHS == 0 ) return *info; eps = boost::simd::Eps<float>(); Anrm = magmablas_slange(MagmaInfNorm, N, N, dA, ldda, dworks ); cte = Anrm * eps * nt2::pow((float)N,(float)0.5) * BWDMAX; if(*info !=0){ *iter = -2 ; goto L40; } if(info[0] !=0){ *iter = -3 ; goto L40; } magmablas_slacpy(MagmaUpperLower, N, NRHS, dB, lddb, dworks, N); if ( NRHS == 1 ) magma_sgemv( trans, N, N, c_neg_one, dA, ldda, dX, 1, c_one, dworks, 1); else magma_sgemm( trans, MagmaNoTrans, N, NRHS, N, c_neg_one, dA, ldda, dX, lddx, c_one, dworks, N); for(i=0;i<NRHS;i++) { j = magma_isamax( N, dX+i*lddx, 1) ; magma_sgetmatrix( 1, 1, dX+i*lddx+j-1, 1, &Xnrmv, 1 ); Xnrm = NT2_F77NAME(slange) ( "F", &ione, &ione, &Xnrmv, &ione, NULL ); j = magma_isamax ( N, dworks+i*N, 1 ); magma_sgetmatrix( 1, 1, dworks+i*N+j-1, 1, &Rnrmv, 1 ); Rnrm = NT2_F77NAME(slange) ( "F", &ione, &ione, &Rnrmv, &ione, NULL ); if( Rnrm > (Xnrm*cte) ){ goto L10; } } *iter = 0; return *info; L10: ; for(iiter=1;iiter<ITERMAX;) { *info = 0 ; magma_sgetrs_gpu(trans, N, NRHS, dAF, lddaf, IPIV, dworks, lddb, info ); if(info[0] != 0){ *iter = -3 ; goto L40; } // float -> double? for(i=0;i<NRHS;i++){ magmablas_slag2d(N,NRHS,dX,N,dXd.data(),N,&info1); magmablas_slag2d(N,NRHS,dB,N,dBd.data(),N,&info1); magmablas_slag2d(N,c_one,dworks,N,dworkd.data(),N,&info1); #if MAGMA_VERSION_MAJOR <= 1 && MAGMA_VERSION_MINOR < 4 magmablas_daxpycp(dworkd.data()+i*N, dXd.data()+i*lddx, N, dBd.data()+i*lddb); #else magmablas_daxpycp(N, dworkd.data()+i*N, dXd.data()+i*lddx, dBd.data()+i*lddb); #endif magmablas_dlag2s(N,NRHS,dXd.data(),N,dX,N,&info1); magmablas_dlag2s(N,NRHS,dBd.data(),N,dB,N,&info1); magmablas_dlag2s(N,c_one,dworkd.data(),N,dworks,N,&info1); } //magmablas_dlacpy(MagmaUpperLower, N, NRHS, dB, lddb, dworkd, N); if( NRHS == 1 ) magma_sgemv( trans, N, N, c_neg_one, dA, ldda, dX, 1, c_one, dworks, 1); else magma_sgemm( trans, MagmaNoTrans, N, NRHS, N, c_neg_one, dA, ldda, dX, lddx, c_one, dworks, N); /* Check whether the NRHS normwise backward errors satisfy the stopping criterion. If yes, set ITER=IITER>0 and return. */ for(i=0;i<NRHS;i++) { j = magma_isamax( N, dX+i*lddx, 1) ; magma_sgetmatrix( 1, 1, dX+i*lddx+j-1, 1, &Xnrmv, 1 ); Xnrm = NT2_F77NAME(slange)( "F", &ione, &ione, &Xnrmv, &ione, NULL ); j = magma_isamax ( N, dworks+i*N, 1 ); magma_sgetmatrix( 1, 1, dworks+i*N+j-1, 1, &Rnrmv, 1 ); Rnrm = NT2_F77NAME(slange)( "F", &ione, &ione, &Rnrmv, &ione, NULL ); if( Rnrm > Xnrm *cte ){ goto L20; } } /* If we are here, the NRHS normwise backward errors satisfy the stopping criterion, we are good to exit. */ *iter = iiter ; return *info; L20: iiter++ ; } /* If we are at this place of the code, this is because we have performed ITER=ITERMAX iterations and never satisified the stopping criterion, set up the ITER flag accordingly and follow up on double precision routine. */ *iter = -ITERMAX - 1 ; L40: if( *info != 0 ){ return *info; } return *info; } //---------------------------------------Complex------------------------------------// magma_int_t zgerfs_gpu(magma_trans_t trans, magma_int_t N, magma_int_t NRHS, cuDoubleComplex *dA, magma_int_t ldda, cuDoubleComplex *dAF, magma_int_t lddaf, magma_int_t *IPIV, cuDoubleComplex *dB, magma_int_t lddb, cuDoubleComplex *dX, magma_int_t lddx, cuDoubleComplex *dworkd, magma_int_t *iter, magma_int_t *info) { cuDoubleComplex c_neg_one = MAGMA_Z_NEG_ONE; cuDoubleComplex c_one = MAGMA_Z_ONE; magma_int_t ione = 1; double cte, eps; cuDoubleComplex Xnrmv, Rnrmv; double Anrm, Xnrm, Rnrm; magma_int_t i, j, iiter; /* Check The Parameters. */ *info = *iter = 0 ; if ( N <0) *info = -1; else if(NRHS<0) *info =-2; else if(ldda < std::max(1,N)) *info =-4; else if( lddb < std::max(1,N)) *info =-8; else if( lddx < std::max(1,N)) *info =-10; if (*info != 0) { magma_xerbla( __func__, -(*info) ); return *info; } if( N == 0 || NRHS == 0 ) return *info; eps = boost::simd::Eps<double>(); Anrm = magmablas_zlange(MagmaInfNorm, N, N, dA, ldda, (double*)dworkd ); cte = Anrm * eps * nt2::pow((double)N,0.5) * BWDMAX; if(*info !=0){ *iter = -2 ; goto L40; } if(info[0] !=0){ *iter = -3 ; goto L40; } magmablas_zlacpy(MagmaUpperLower, N, NRHS, dB, lddb, dworkd, N); if ( NRHS == 1 ) magma_zgemv( trans, N, N, c_neg_one, dA, ldda, dX, 1, c_one, dworkd, 1); else magma_zgemm( trans, MagmaNoTrans, N, NRHS, N, c_neg_one, dA, ldda, dX, lddx, c_one, dworkd, N); for(i=0;i<NRHS;i++) { j = magma_izamax( N, dX+i*lddx, 1) ; magma_zgetmatrix( 1, 1, dX+i*lddx+j-1, 1, &Xnrmv, 1 ); Xnrm = NT2_F77NAME(zlange) ( "F", &ione, &ione, &Xnrmv, &ione, NULL ); j = magma_izamax ( N, dworkd+i*N, 1 ); magma_zgetmatrix( 1, 1, dworkd+i*N+j-1, 1, &Rnrmv, 1 ); Rnrm = NT2_F77NAME(zlange) ( "F", &ione, &ione, &Rnrmv, &ione, NULL ); if( Rnrm > (Xnrm*cte) ){ goto L10; } } *iter = 0; return *info; L10: ; for(iiter=1;iiter<ITERMAX;) { *info = 0 ; magma_zgetrs_gpu(trans, N, NRHS, dAF, lddaf, IPIV, dworkd, lddb, info ); if(info[0] != 0){ *iter = -3 ; goto L40; } for(i=0;i<NRHS;i++){ #if MAGMA_VERSION_MAJOR <= 1 && MAGMA_VERSION_MINOR < 4 magmablas_zaxpycp(dworkd+i*N, dX+i*lddx, N, dB+i*lddb); #else magmablas_zaxpycp(N, dworkd+i*N, dX+i*lddx, dB+i*lddb); #endif } //magmablas_dlacpy(MagmaUpperLower, N, NRHS, dB, lddb, dworkd, N); if( NRHS == 1 ) magma_zgemv( trans, N, N, c_neg_one, dA, ldda, dX, 1, c_one, dworkd, 1); else magma_zgemm( trans, MagmaNoTrans, N, NRHS, N, c_neg_one, dA, ldda, dX, lddx, c_one, dworkd, N); /* Check whether the NRHS normwise backward errors satisfy the stopping criterion. If yes, set ITER=IITER>0 and return. */ for(i=0;i<NRHS;i++) { j = magma_izamax( N, dX+i*lddx, 1) ; magma_zgetmatrix( 1, 1, dX+i*lddx+j-1, 1, &Xnrmv, 1 ); Xnrm = NT2_F77NAME(zlange)( "F", &ione, &ione, &Xnrmv, &ione, NULL ); j = magma_izamax ( N, dworkd+i*N, 1 ); magma_zgetmatrix( 1, 1, dworkd+i*N+j-1, 1, &Rnrmv, 1 ); Rnrm = NT2_F77NAME(zlange)( "F", &ione, &ione, &Rnrmv, &ione, NULL ); if( Rnrm > Xnrm *cte ){ goto L20; } } /* If we are here, the NRHS normwise backward errors satisfy the stopping criterion, we are good to exit. */ *iter = iiter ; return *info; L20: iiter++ ; } /* If we are at this place of the code, this is because we have performed ITER=ITERMAX iterations and never satisified the stopping criterion, set up the ITER flag accordingly and follow up on double precision routine. */ *iter = -ITERMAX - 1 ; L40: if( *info != 0 ){ return *info; } return *info; } magma_int_t cgerfs_gpu(magma_trans_t trans, magma_int_t N, magma_int_t NRHS, cuFloatComplex *dA, magma_int_t ldda, cuFloatComplex *dAF, magma_int_t lddaf, magma_int_t *IPIV, cuFloatComplex *dB, magma_int_t lddb, cuFloatComplex *dX, magma_int_t lddx, cuFloatComplex *dworkd, magma_int_t *iter, magma_int_t *info) { nt2::details::magma_buffer<std::complex<double> > dworkz(N,1); nt2::details::magma_buffer<std::complex<double> > dXd(N,NRHS); nt2::details::magma_buffer<std::complex<double> > dBd(N,NRHS); cuFloatComplex c_neg_one = MAGMA_C_NEG_ONE; cuFloatComplex c_one = MAGMA_C_ONE; float r_one = MAGMA_D_ONE; magma_int_t ione = 1; double cte, eps; cuFloatComplex Xnrmv, Rnrmv; double Anrm, Xnrm, Rnrm; magma_int_t i, j, iiter,info1; /* Check The Parameters. */ *info = *iter = 0 ; if ( N <0) *info = -1; else if(NRHS<0) *info =-2; else if(ldda < std::max(1,N)) *info =-4; else if( lddb < std::max(1,N)) *info =-8; else if( lddx < std::max(1,N)) *info =-10; if (*info != 0) { magma_xerbla( __func__, -(*info) ); return *info; } if( N == 0 || NRHS == 0 ) return *info; eps = boost::simd::Eps<double>(); Anrm = magmablas_clange(MagmaInfNorm, N, N, dA, ldda, (float*)dworkd ); cte = Anrm * eps * nt2::pow((double)N,0.5) * BWDMAX; if(*info !=0){ *iter = -2 ; goto L40; } if(info[0] !=0){ *iter = -3 ; goto L40; } magmablas_clacpy(MagmaUpperLower, N, NRHS, dB, lddb, dworkd, N); if ( NRHS == 1 ) magma_cgemv( trans, N, N, c_neg_one, dA, ldda, dX, 1, c_one, dworkd, 1); else magma_cgemm( trans, MagmaNoTrans, N, NRHS, N, c_neg_one, dA, ldda, dX, lddx, c_one, dworkd, N); for(i=0;i<NRHS;i++) { j = magma_icamax( N, dX+i*lddx, 1) ; magma_cgetmatrix( 1, 1, dX+i*lddx+j-1, 1, &Xnrmv, 1 ); Xnrm = NT2_F77NAME(clange) ( "F", &ione, &ione, &Xnrmv, &ione, NULL ); j = magma_icamax ( N, dworkd+i*N, 1 ); magma_cgetmatrix( 1, 1, dworkd+i*N+j-1, 1, &Rnrmv, 1 ); Rnrm = NT2_F77NAME(clange) ( "F", &ione, &ione, &Rnrmv, &ione, NULL ); if( Rnrm > (Xnrm*cte) ){ goto L10; } } *iter = 0; return *info; L10: ; for(iiter=1;iiter<ITERMAX;) { *info = 0 ; magma_cgetrs_gpu(trans, N, NRHS, dAF, lddaf, IPIV, dworkd, lddb, info ); if(info[0] != 0){ *iter = -3 ; goto L40; } //float -> double ? for(i=0;i<NRHS;i++){ magmablas_clag2z(N,NRHS,dX,N,(cuDoubleComplex*)dXd.data(),N,&info1); magmablas_clag2z(N,NRHS,dB,N,(cuDoubleComplex*)dBd.data(),N,&info1); magmablas_clag2z(N,r_one,dworkd,N,(cuDoubleComplex*)dworkz.data(),N,&info1); #if MAGMA_VERSION_MAJOR <= 1 && MAGMA_VERSION_MINOR < 4 magmablas_zaxpycp( (cuDoubleComplex*)dworkz.data()+i*N , (cuDoubleComplex*)dXd.data()+i*lddx , N , (cuDoubleComplex*)dBd.data()+i*lddb ); #else magmablas_zaxpycp( N , (cuDoubleComplex*)dworkz.data()+i*N , (cuDoubleComplex*)dXd.data()+i*lddx , (cuDoubleComplex*)dBd.data()+i*lddb ); #endif magmablas_zlag2c(N,NRHS,(cuDoubleComplex*)dXd.data(),N,dX,N,&info1); magmablas_zlag2c(N,NRHS,(cuDoubleComplex*)dBd.data(),N,dB,N,&info1); magmablas_zlag2c(N,r_one,(cuDoubleComplex*)dworkz.data(),N,dworkd,N,&info1); } //magmablas_dlacpy(MagmaUpperLower, N, NRHS, dB, lddb, dworkd, N); if( NRHS == 1 ) magma_cgemv( trans, N, N, c_neg_one, dA, ldda, dX, 1, c_one, dworkd, 1); else magma_cgemm( trans, MagmaNoTrans, N, NRHS, N, c_neg_one, dA, ldda, dX, lddx, c_one, dworkd, N); /* Check whether the NRHS normwise backward errors satisfy the stopping criterion. If yes, set ITER=IITER>0 and return. */ for(i=0;i<NRHS;i++) { j = magma_icamax( N, dX+i*lddx, 1) ; magma_cgetmatrix( 1, 1, dX+i*lddx+j-1, 1, &Xnrmv, 1 ); Xnrm = NT2_F77NAME(clange)("F", &ione, &ione, &Xnrmv, &ione, NULL ); j = magma_icamax ( N, dworkd+i*N, 1 ); magma_cgetmatrix( 1, 1, dworkd+i*N+j-1, 1, &Rnrmv, 1 ); Rnrm = NT2_F77NAME(clange)("F", &ione, &ione, &Rnrmv, &ione, NULL ); if( Rnrm > Xnrm *cte ){ goto L20; } } /* If we are here, the NRHS normwise backward errors satisfy the stopping criterion, we are good to exit. */ *iter = iiter ; return *info; L20: iiter++ ; } /* If we are at this place of the code, this is because we have performed ITER=ITERMAX iterations and never satisified the stopping criterion, set up the ITER flag accordingly and follow up on double precision routine. */ *iter = -ITERMAX - 1 ; L40: if( *info != 0 ){ return *info; } return *info; } #endif #endif <|start_filename|>modules/boost/simd/base/include/boost/simd/swar/functions/splatted_maximum.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // Copyright 2012 - 2013 MetaScale SAS // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef BOOST_SIMD_SWAR_FUNCTIONS_SPLATTED_MAXIMUM_HPP_INCLUDED #define BOOST_SIMD_SWAR_FUNCTIONS_SPLATTED_MAXIMUM_HPP_INCLUDED #include <boost/simd/include/functor.hpp> #include <boost/dispatch/include/functor.hpp> namespace boost { namespace simd { namespace tag { /*! @brief splatted_maximum generic tag Represents the splatted_maximum function in generic contexts. @par Models: Hierarchy **/ /*! @brief splatted_maximum generic tag Represents the splatted_maximum function in generic contexts. **/ struct splatted_maximum_ : ext::unspecified_<splatted_maximum_> { /// @brief Parent hierarchy typedef ext::unspecified_<splatted_maximum_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_splatted_maximum_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::splatted_maximum_, Site> dispatching_splatted_maximum_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::splatted_maximum_, Site>(); } template<class... Args> struct impl_splatted_maximum_; } /*! @brief Splatted maximum Computes the splatted maximum of the element of its argument. @par Semantic Depending on the type of its arguments, splatted_maximum exhibits different semantics. For any type @c Type and value @c v of type @c Type: @code Type r = splatted_maximum(v); @endcode is similar to: @code for(int i=0;i<Type::static_size;++i) x[i] = maximum(v); @endcode @param a0 @return a value of the same type as the parameter **/ BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::splatted_maximum_, splatted_maximum, 1) } } #endif <|start_filename|>modules/core/sdk/include/nt2/core/container/view/shared_view.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2011 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2011 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_CORE_CONTAINER_VIEW_SHARED_VIEW_HPP_INCLUDED #define NT2_CORE_CONTAINER_VIEW_SHARED_VIEW_HPP_INCLUDED #include <nt2/sdk/memory/container_ref.hpp> #include <nt2/sdk/memory/container_shared_ref.hpp> #include <nt2/core/container/view/adapted/shared_view.hpp> #include <boost/dispatch/dsl/semantic_of.hpp> namespace nt2 { namespace container { template<class Expression, class ResultType> struct expression; /* shared_view; an expression of a container_shared_ref terminal. * allows construction from an expression of a container_shared_ref terminal */ template<typename Kind, typename T, typename S> struct shared_view : expression< boost::proto ::basic_expr< nt2::tag::terminal_ , boost::proto::term< memory ::container_shared_ref<Kind,T,S,false> > , 0l > , memory::container<Kind,T,S>& > { typedef memory::container_shared_ref< Kind, T, S, false > container_ref; typedef boost::proto::basic_expr< nt2::tag::terminal_ , boost::proto::term<container_ref> , 0l > basic_expr; typedef memory::container<Kind,T,S>& container_type; typedef expression<basic_expr, container_type> nt2_expression; typedef typename container_ref::iterator iterator; typedef typename container_ref::const_iterator const_iterator; iterator begin() const { return boost::proto::value(*this).begin(); } iterator end() const { return boost::proto::value(*this).end(); } BOOST_FORCEINLINE shared_view() { } BOOST_FORCEINLINE shared_view( nt2_expression const& expr ) : nt2_expression(expr) { } template<class Xpr> BOOST_FORCEINLINE shared_view( Xpr const& expr ) : nt2_expression(basic_expr::make(boost::proto::value(expr))) { } template<class Xpr> void reset(Xpr const& other) { shared_view tmp(other); boost::proto::value(*this) = boost::proto::value(tmp); this->size_ = tmp.size_; } //========================================================================== // Enable base expression handling of assignment //========================================================================== template<class Xpr> BOOST_FORCEINLINE typename boost::disable_if< boost::is_base_of<nt2_expression, Xpr> , shared_view& >::type operator=(Xpr const& xpr) { nt2_expression::operator=(xpr); return *this; } BOOST_FORCEINLINE shared_view& operator=(shared_view const& xpr) { nt2_expression::operator=(xpr); return *this; } template<class Xpr> BOOST_FORCEINLINE typename boost::disable_if< boost::is_base_of<nt2_expression, Xpr> , shared_view const& >::type operator=(Xpr const& xpr) const { nt2_expression::operator=(xpr); return *this; } BOOST_FORCEINLINE shared_view const& operator=(shared_view const& xpr) const { nt2_expression::operator=(xpr); return *this; } }; template<typename Kind, typename T, typename S> struct shared_view<Kind, T const, S> : expression < boost::proto::basic_expr < nt2::tag::terminal_ , boost::proto::term <memory::container_shared_ref<Kind, T const, S, false> > , 0l > , memory::container<Kind,T,S> const& > { typedef memory::container_shared_ref<Kind, T const, S, false > container_ref; typedef boost::proto::basic_expr< nt2::tag::terminal_ , boost::proto::term<container_ref> , 0l > basic_expr; typedef memory::container<Kind,T,S> const& container_type; typedef expression<basic_expr, container_type> nt2_expression; typedef typename container_ref::iterator iterator; typedef typename container_ref::const_iterator const_iterator; iterator begin() const { return boost::proto::value(*this).begin(); } iterator end() const { return boost::proto::value(*this).end(); } BOOST_FORCEINLINE shared_view() { } BOOST_FORCEINLINE shared_view( nt2_expression const& expr ) : nt2_expression(expr) { } template<class Xpr> shared_view( Xpr const& expr ) : nt2_expression(basic_expr::make(boost::proto::value(expr))) { } template<class Xpr> BOOST_FORCEINLINE void reset(Xpr const& other) { shared_view tmp(other); boost::proto::value(*this) = boost::proto::value(tmp); this->size_ = tmp.size_; } //========================================================================== // Enable base expression handling of assignment //========================================================================== template<class Xpr> BOOST_FORCEINLINE typename boost::disable_if< boost::is_base_of<nt2_expression, Xpr> , shared_view& >::type operator=(Xpr const& xpr) { nt2_expression::operator=(xpr); return *this; } BOOST_FORCEINLINE shared_view& operator=(shared_view const& xpr) { nt2_expression::operator=(xpr); return *this; } template<class Xpr> BOOST_FORCEINLINE typename boost::disable_if< boost::is_base_of<nt2_expression, Xpr> , shared_view const& >::type operator=(Xpr const& xpr) const { nt2_expression::operator=(xpr); return *this; } BOOST_FORCEINLINE shared_view const& operator=(shared_view const& xpr) const { nt2_expression::operator=(xpr); return *this; } }; } } namespace nt2 { using nt2::container::shared_view; } #endif <|start_filename|>modules/boost/simd/base/include/boost/simd/arithmetic/functions/sqr_abs.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2011 LASMEA UMR 6602 CNRS/U.B.P. // Copyright 2009 - 2011 LRI UMR 8623 CNRS/Univ. Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef BOOST_SIMD_ARITHMETIC_FUNCTIONS_SQR_ABS_HPP_INCLUDED #define BOOST_SIMD_ARITHMETIC_FUNCTIONS_SQR_ABS_HPP_INCLUDED #include <boost/simd/include/functor.hpp> #include <boost/dispatch/include/functor.hpp> namespace boost { namespace simd { namespace tag { /*! @brief sqr_abs generic tag Represents the sqr_abs function in generic contexts. @par Models: Hierarchy **/ struct sqr_abs_ : ext::elementwise_<sqr_abs_> { /// @brief Parent hierarchy typedef ext::elementwise_<sqr_abs_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_sqr_abs_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::sqr_abs_, Site> dispatching_sqr_abs_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::sqr_abs_, Site>(); } template<class... Args> struct impl_sqr_abs_; } /*! Computes the square of the absolute value of its parameter. @par semantic: For any given value @c x of type @c T: @code T r = sqr_abs(x); @endcode is equivalent to: @code T r = sqr(abs(x)); @endcode @par Alias @c sqr_modulus @param a0 @return a value of the same type as the input. **/ BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::sqr_abs_, sqr_abs, 1) BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::sqr_abs_, sqr_modulus, 1) } } #endif <|start_filename|>modules/core/adjacent/include/nt2/core/functions/cdiff.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // Copyright 2011 - 2012 MetaScale SAS // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_CORE_FUNCTIONS_CDIFF_HPP_INCLUDED #define NT2_CORE_FUNCTIONS_CDIFF_HPP_INCLUDED #include <nt2/include/functor.hpp> #include <nt2/sdk/meta/value_as.hpp> #include <nt2/core/container/dsl/size.hpp> #include <nt2/core/container/dsl/value_type.hpp> namespace nt2 { namespace tag { /*! @brief Tag for the cdiff function **/ struct cdiff_ : ext::elementwise_<cdiff_> { /// @brief Parent hierarchy typedef ext::elementwise_<cdiff_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_cdiff_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::cdiff_, Site> dispatching_cdiff_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::cdiff_, Site>(); } template<class... Args> struct impl_cdiff_; } /*! Computes centered diferences along a dimension @par Semantic: For every table expressions n and p @code auto x = cdiff(a, n); @endcode is similar to: @code for(int in=1;in<=size(x,n);++in) ... for(int ik=2;ik<=size(x,k)-1;++ik) ... for(int i1=1;in<=size(x,1);++i1) x(i1,...,ik,...,in) = a(i1,...,ik+1,...,in)-a(i1,...,ik-1,...,in); @endcode @param a0 @param a1 @return an expression which eventually will evaluate to the result **/ NT2_FUNCTION_IMPLEMENTATION(nt2::tag::cdiff_, cdiff, 2) /// overload NT2_FUNCTION_IMPLEMENTATION(nt2::tag::cdiff_, cdiff, 1) } namespace nt2 { namespace ext { /// INTERNAL ONLY template<class Domain, int N,class Expr> struct size_of<nt2::tag::cdiff_,Domain,N,Expr> { typedef typename boost::proto::result_of ::child_c<Expr&,0>::value_type::extent_type result_type; BOOST_FORCEINLINE result_type operator()(Expr& e) const { result_type sizee(boost::proto::child_c<0>(e).extent()); std::size_t along = boost::proto::value(boost::proto::child_c<1>(e)); sizee[along] = (sizee[along] >= 2) ? sizee[along]-2 : 0; return sizee; } }; /// INTERNAL ONLY template<class Domain, int N, class Expr> struct value_type<nt2::tag::cdiff_,Domain,N,Expr> : meta::value_as<Expr,0> {}; } } #endif <|start_filename|>modules/core/trigonometric/include/nt2/trigonometric/functions/fast_cotd.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_TRIGONOMETRIC_FUNCTIONS_FAST_COTD_HPP_INCLUDED #define NT2_TRIGONOMETRIC_FUNCTIONS_FAST_COTD_HPP_INCLUDED #include <nt2/include/functor.hpp> namespace nt2 { namespace tag { /*! @brief fast_cotd generic tag Represents the fast_cotd function in generic contexts. @par Models: Hierarchy **/ struct fast_cotd_ : ext::elementwise_<fast_cotd_> { /// @brief Parent hierarchy typedef ext::elementwise_<fast_cotd_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_fast_cotd_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::fast_cotd_, Site> dispatching_fast_cotd_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::fast_cotd_, Site>(); } template<class... Args> struct impl_fast_cotd_; } /*! cotangent of the angle in degree, in the interval \f$[-45, 45]\f$, nan outside. @par Semantic: For every parameter of floating type T0 @code T0 r = fast_cotd(x); @endcode is similar to: @code T0 r = cotd(x); @endcode provided that x belongs to \f$[-45, 45]\f$ @see @funcref{cot}, @funcref{cotangent}, @funcref{cotd}, @param a0 @return a value of the same type as the parameter **/ NT2_FUNCTION_IMPLEMENTATION(tag::fast_cotd_, fast_cotd, 1) } #endif <|start_filename|>modules/core/linalg/include/nt2/linalg/functions/logm.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_LINALG_FUNCTIONS_LOGM_HPP_INCLUDED #define NT2_LINALG_FUNCTIONS_LOGM_HPP_INCLUDED #include <nt2/include/functor.hpp> namespace nt2 { namespace tag { /*! * \brief Define the tag logm_ of functor logm * in namespace nt2::tag for toolbox algebra **/ struct logm_ : ext::unspecified_<logm_> { typedef ext::unspecified_<logm_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_logm_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::logm_, Site> dispatching_logm_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::logm_, Site>(); } template<class... Args> struct impl_logm_; } /** * @brief compute natural principal logarithm of a matricial expression * * logm(a0) must not be confused with log(a0) that computes on an * elementwise basis the logarithms of the elements of matrix a0. * * a0 can be a any square matricial expression whose * real eigenvalues are strictly positive * * @param a0 Matrix expression or scalar * * @return a matrix containing logm(a1) **/ BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::logm_, logm, 1) } #endif <|start_filename|>modules/core/linalg/include/nt2/linalg/functions/funm.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_LINALG_FUNCTIONS_FUNM_HPP_INCLUDED #define NT2_LINALG_FUNCTIONS_FUNM_HPP_INCLUDED #include <nt2/include/functor.hpp> namespace nt2 { namespace tag { /*! * \brief Define the tag funm_ of functor funm * in namespace nt2::tag for toolbox algebra **/ struct funm_ : ext::unspecified_<funm_> { typedef ext::unspecified_<funm_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_funm_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::funm_, Site> dispatching_funm_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::funm_, Site>(); } template<class... Args> struct impl_funm_; } /** * @brief funm(f, a) evaluates the functor fun at the square * matrix expression a. f(x,k) must return the k'th derivative of the function * represented by f evaluated at the vector x. * * @return a matrix containing funm(f, a) **/ BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::funm_, funm, 2) } #endif <|start_filename|>modules/core/gallery/include/nt2/gallery/functions/randsvd.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_GALLERY_FUNCTIONS_RANDSVD_HPP_INCLUDED #define NT2_GALLERY_FUNCTIONS_RANDSVD_HPP_INCLUDED #include <nt2/include/functor.hpp> /*! * \ingroup algebra * \defgroup algebra_randsvd randsvd * * randsvd random matrix with pre-assigned singular values. * a = randsvd(m, n, kappa, mode, kl, ku) is a banded random * matrix of order mxn with cond(a) = kappa and singular values from the * distribution mode. * * mode may be one of the following value: * 1: one large singular value, * 2: one small singular value, * 3: geometrically distributed singular values, * 4: arithmetically distributed singular values, * 5: random singular values with uniformly distributed logarithm. * if omitted, mode defaults to 3, and kappa defaults to sqrt(1/eps), * (but if kappa is not given, a target must be : as_<type>(), where type * is the type of the output element). * if mode < 0 then the effect is as for abs(mode) except that in the * original matrix of singular values the order of the diagonal * entries is reversed: small to large instead of large to small. * * kl and ku are the number of lower and upper off-diagonals * respectively. if they are omitted, a full matrix is produced. * if only kl is present, ku defaults to kl. * * special case: kappa < 0 * a is a random full symmetric positive definite matrix with * cond(a) = -kappa and eigenvalues distributed according to * mode. kl and ku, if present, are ignored. * * acknowledgement: * This routine is similar to the more comprehensive Fortran routine * xLATMS in the following reference: * * Reference: * <NAME> and <NAME>, A test matrix generation suite, * LAPACK Working Note #9, Courant Institute of Mathematical * Sciences, New York, 1989. * * * \par Header file * * \code * #include <nt2/include/functions/randsvd.hpp> * \endcode * **/ //============================================================================== // randsvd actual class forward declaration //============================================================================== namespace nt2 { namespace tag { /*! * \brief Define the tag randsvd_ of functor randsvd * in namespace nt2::tag for toolbox algebra **/ struct randsvd_ : ext::unspecified_<randsvd_> { typedef ext::unspecified_<randsvd_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_randsvd_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::randsvd_, Site> dispatching_randsvd_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::randsvd_, Site>(); } template<class... Args> struct impl_randsvd_; } NT2_FUNCTION_IMPLEMENTATION(tag::randsvd_, randsvd, 6) NT2_FUNCTION_IMPLEMENTATION(tag::randsvd_, randsvd, 5) NT2_FUNCTION_IMPLEMENTATION(tag::randsvd_, randsvd, 4) NT2_FUNCTION_IMPLEMENTATION(tag::randsvd_, randsvd, 3) NT2_FUNCTION_IMPLEMENTATION(tag::randsvd_, randsvd, 2) } namespace nt2 { namespace ext { template<class Domain, class Expr, int N> struct size_of<tag::randsvd_, Domain, N, Expr> { typedef _2D result_type; BOOST_FORCEINLINE result_type operator()(Expr& e) const { _2D sizee; sizee[0] = boost::proto::child_c<0>(e); sizee[1] = boost::proto::child_c<1>(e); return sizee; } }; template <class Domain, class Expr, int N> struct value_type < tag::randsvd_, Domain,N,Expr> { typedef typename boost::proto::result_of::child_c<Expr&,2>::type tmp_type; typedef typename meta::strip<tmp_type>::type type; }; } } #endif <|start_filename|>modules/core/signal/include/nt2/signal/functions/db2mag.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_SIGNAL_FUNCTIONS_DB2MAG_HPP_INCLUDED #define NT2_SIGNAL_FUNCTIONS_DB2MAG_HPP_INCLUDED #include <nt2/include/functor.hpp> namespace nt2 { namespace tag { /*! @brief Tag for the db2mag functor **/ struct db2mag_ : ext::elementwise_<db2mag_> { /// @brief Parent hierarchy typedef ext::elementwise_<db2mag_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_db2mag_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::db2mag_, Site> dispatching_db2mag_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::db2mag_, Site>(); } template<class... Args> struct impl_db2mag_; } /*! @brief Convert decibels (dB) to magnitude Computes the decibels to magnitude. @par Semantic For any table expression: @code auto d = db2mag(d); @endcode is equivalent to: @code auto d = exp10(d/2); @endcode @see @funcref{exp10}, @funcref{db}, @funcref{pow2db}, @funcref{db2pow}, @funcref{db2pow} @param a0 Table expression to process @return An expression eventually evaluated to the result **/ NT2_FUNCTION_IMPLEMENTATION(tag::db2mag_, db2mag, 1) } #endif <|start_filename|>modules/core/gallery/include/nt2/gallery/functions/kms.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_GALLERY_FUNCTIONS_KMS_HPP_INCLUDED #define NT2_GALLERY_FUNCTIONS_KMS_HPP_INCLUDED #include <nt2/include/functor.hpp> /*! * \ingroup algebra * \defgroup algebra_kms kms * a = kms(n, rho) is the n-by-n kac-murdock-szego * toeplitz matrix such that * a(i,j) = rho^(abs(i-j)), for real rho. * for complex rho, the same formula holds except that elements * below the diagonal are conjugated. rho defaults to 0.5. * * properties: * a has an ldl' factorization with * l = trnsconj(inv(triw(n,-rho,1))), and * d(i,i) = (1-abs(rho)^2)*eye(n), * except d(1,1) = 1. * a is positive definite if and only if 0 < abs(rho) < 1. * inv(a) is tridiagonal. * * Reference: * <NAME>, Numerical solution of the eigenvalue problem * for Hermitian Toeplitz matrices, SIAM J. Matrix Analysis * and Appl., 10 (1989), pp. 135-146. * * * \par Header file * * \code * #include <nt2/include/functions/kms.hpp> * \endcode * * **/ //============================================================================== // kms actual class forward declaration //============================================================================== namespace nt2 { namespace tag { /*! * \brief Define the tag kms_ of functor kms * in namespace nt2::tag for toolbox algebra **/ struct kms_ : ext::unspecified_<kms_> { typedef ext::unspecified_<kms_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_kms_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::kms_, Site> dispatching_kms_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::kms_, Site>(); } template<class... Args> struct impl_kms_; } NT2_FUNCTION_IMPLEMENTATION(tag::kms_, kms, 1) NT2_FUNCTION_IMPLEMENTATION(tag::kms_, kms, 2) NT2_FUNCTION_IMPLEMENTATION(tag::kms_, kms, 3) template<class T> BOOST_FORCEINLINE typename meta::call<tag::kms_(size_t, meta::as_<T>)>::type kms(size_t n) { return nt2::kms(n, meta::as_<T>()); } } #endif <|start_filename|>modules/core/sdk/include/nt2/sdk/memory/container.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2011 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // Copyright 2012 - 2015 NumScale SAS // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_SDK_MEMORY_CONTAINER_HPP_INCLUDED #define NT2_SDK_MEMORY_CONTAINER_HPP_INCLUDED #include <nt2/core/settings/size.hpp> #include <nt2/core/settings/index.hpp> #include <nt2/core/settings/option.hpp> #include <nt2/core/settings/interleaving.hpp> #include <nt2/core/settings/storage_order.hpp> #include <nt2/core/settings/specific_data.hpp> #include <nt2/core/settings/storage_scheme.hpp> #include <nt2/core/utility/of_size.hpp> #include <nt2/include/functions/scalar/numel.hpp> #include <nt2/include/functions/scalar/ndims.hpp> #include <nt2/sdk/memory/adapted/container.hpp> #include <nt2/sdk/memory/composite_buffer.hpp> #include <boost/core/ignore_unused.hpp> #include <nt2/sdk/meta/container_traits.hpp> #include <boost/fusion/include/is_sequence.hpp> #include <boost/mpl/at.hpp> #include <boost/assert.hpp> #include <algorithm> #ifdef NT2_LOG_COPIES #include <iostream> #endif namespace nt2 { namespace tag { struct table_; } } namespace nt2 { namespace memory { /*! @brief Memory handling typename for nt2 Container container is the base typename handling a container semantic, layout and memory used by nt2 terminals. It is built from a value @c Type, a list of @c Settings describing how it should behave both at runtime and compile-time and a @c Kind describing which kind of high-level behavior the container will have. @tparam Kind Describe the behavior of the container @tparam Type Value type to store in the table @tparam Setting Options list describing the options of the container **/ template<typename Kind, typename Type, typename Settings> struct container : public container_base<Type> { public: /// INTERNAL ONLY Precomputed semantic type typedef Kind kind_type; /// INTERNAL ONLY Precomputed settings type typedef Settings settings_type; /// INTERNAL ONLY storage_scheme option typedef typename meta::option < Settings , tag::storage_scheme_ , Kind >::type scheme_t; /// INTERNAL ONLY Storage Scheme option typedef typename scheme_t::template apply<container> scheme_type; /// INTERNAL ONLY Check if Type is a Fusion Sequence typedef boost::fusion::traits::is_sequence<Type> composite_t; /// INTERNAL ONLY Retrieve interleaving option typedef typename meta::option < Settings , tag::interleaving_ , Kind >::type::interleaving_type inter_t; /// INTERNAL ONLY Base buffer type typedef typename scheme_type::type buffer_t; /*! @brief Container memory buffer type This typedef defines the type used by container to store its values. This type is computed by using the various settings the container may have. **/ typedef typename boost::mpl::if_< boost::mpl::and_<composite_t,inter_t> , composite_buffer<buffer_t> , buffer_t >::type buffer_type; /*! @brief Hardware specific data type Depending on current architecture, container data block may need to be augmented by a hardware specific member that take care of said hardware specificities @see spec_data **/ typedef typename specific_data< typename boost::dispatch:: default_site<Type>::type , Type >::type specific_data_type; /// @brief Allocator type used by the Container typedef typename meta::allocator_type_<buffer_type>::type allocator_type; /// @brief Value type stored by the Container typedef typename buffer_type::value_type value_type; /// @brief Iterator type exposed by the Container typedef typename buffer_type::iterator iterator; /// @brief Constant iterator type exposed by the Container typedef typename buffer_type::const_iterator const_iterator; /// @brief Reference type exposed by the Container typedef typename buffer_type::reference reference; /// @brief Constant reference type exposed by the Container typedef typename buffer_type::const_reference const_reference; /// @brief Size type exposed by the Container typedef typename buffer_type::size_type size_type; /// @brief Interval type exposed by the Container typedef typename buffer_type::difference_type difference_type; /// @brief Pointer type exposed by the Container typedef typename buffer_type::pointer pointer; /// @brief Constant pointer type exposed by the Container typedef typename buffer_type::const_pointer const_pointer; /// @brief Type used to store extent of the data typedef typename meta::option < Settings , tag::of_size_ , Kind >::type extent_type; /// @brief Type used to store base index value of the data typedef typename meta::option < Settings , tag::index_ , Kind >::type index_type; /// @brief Type used to represent the container storage order typedef typename meta::option < Settings , tag::storage_order_ , Kind >::type order_type; /// INTERNAL ONLY detects if default initialization is required typedef typename meta::option < Settings , tag::storage_duration_ , Kind >::type::storage_duration_type duration_t; typedef boost::is_same<duration_t,automatic_> is_automatic_t; /// INTERNAL ONLY Check if static initialization is required /// This is true for non-automatic, non-empty container typedef boost::mpl:: bool_ < ! ( boost::mpl::at_c<typename extent_type::values_type,0> ::type::value <= 0 ) && !is_automatic_t::value > require_static_init; /// INTERNAL ONLY detects if container size is known at compile time typedef boost::mpl:: bool_ <extent_type::static_status || is_automatic_t::value> has_static_size; /*! @brief Default constructor A default-constructed container is initialized to be: - empty if its size is dynamic - preallocated if its size is static or its storage is automatic **/ container() : data_() { init(sizes_, require_static_init()); } #ifdef NT2_LOG_COPIES container(container const& other) : data_(other.data_), sizes_(other.sizes_) { std::cout << "copying container" << std::endl; } container& operator=(container const& other) { data_ = other.data_; sizes_ = other.sizes_; std::cout << "assigning container" << std::endl; return *this; } #endif /*! @brief Constructor from an allocator Construct a container from an allocator instance. Such container is initialized to be: - empty if its size is dynamic - pre-allocated if its size is static or its storage is automatic container is aware of stateful allocator and will handle them properly. @param a Allocator used for container construction **/ container ( allocator_type const& a ) : data_(a) { init(sizes_, require_static_init()); } /*! @brief Construct a container from a dimension set Construct a container from a Fusion RandomAccessSequence of integral values representing the logical number of element in each dimensions. Passing a dimension set to container with automatic storage or set up to use a static dimension set will result in a assert being raised if said dimension set is not compatible with its static size. container is aware of stateful allocator and will handle them properly. @param sz Fusion Sequence to use as dimensions @param a Allocator used for container construction **/ template<typename Size> container ( Size const& sz, allocator_type const& a = allocator_type() ) : data_(a), sizes_(sz) { BOOST_ASSERT_MSG( !has_static_size::value || sz == extent_type() , "Invalid constructor for statically sized container" ); init(sizes_); } /*! @brief container swapping Swap the contents of current container with another container @param y container to swap @c *this with **/ template<typename S2, typename Kind2> BOOST_FORCEINLINE void swap(container<Kind2,Type,S2>& y) { data_.swap(y.data_); sizes_.swap(y.sizes_); this->specifics().swap(y.specifics()); } BOOST_FORCEINLINE void swap(Type& y) { BOOST_ASSERT_MSG( sizes_ == _0D(), "swapping non-singleton container with scalar" ); boost::swap(y, data_[0]); } //========================================================================== /*! * @brief Resize a container using new dimensions set */ //========================================================================== template<typename Size> void resize( Size const& szs ) { resize( szs , boost::mpl::bool_<extent_type::static_status>() , typename is_automatic_t::type() ); } //========================================================================== /*! * @brief Add element at end of container, reshape to 1D */ //========================================================================== void push_back( value_type const& t ) { data_.push_back(t); sizes_ = extent_type(numel(sizes_) + 1); } //========================================================================== /*! * @brief Add range of element at end of container's most external dimension */ //========================================================================== template<typename Container> void push_back(Container const& c, std::size_t d) { BOOST_ASSERT_MSG( d >= (nt2::ndims(sizes_)-1u) , "Dimension for push_back isn't outer dimension" ); BOOST_ASSERT_MSG( d < extent_type::static_size && (empty() || std::equal(c.extent().begin(), c.extent().begin()+std::min(d,c.extent().size()), sizes_.begin())) , "Incompatible size in range push_back" ); if(empty()) sizes_ = c.extent(); else sizes_[d] += (d < c.extent().size()) ? c.extent()[d] : 1u; nt2::memory::append(data_,c.begin(), c.end()); }; template<typename Container> void push_back(Container const& c) { return this->push_back(c, nt2::ndims(c.extent())); } /*! @brief Return the container dimensions set @return A reference to a constant Fusion RandomAccessSequence containing the size of the container over each of its dimensions. **/ BOOST_FORCEINLINE extent_type const& extent() const { return sizes_; } /*! @brief Return the container number of element @return The number of logical element stored in the buffer. **/ BOOST_FORCEINLINE size_type size() const { return data_.size(); } /*! @brief Return the container number of element along the main dimension @return The number of elements stored on the main dimension **/ BOOST_FORCEINLINE size_type leading_size() const { typedef typename boost::mpl ::apply < order_type , boost::mpl::size_t<extent_type::static_size> , boost::mpl::size_t<0U> >::type dim_t; return sizes_[dim_t::value]; } /*! @brief Check for if container is empty @return A boolean that evaluates to @c true if the container number of elements is 0. **/ BOOST_FORCEINLINE bool empty() const { return data_.empty(); } /*! @brief Raw memory accessor @return Pointer to the raw memory of the container **/ BOOST_FORCEINLINE pointer data() { return data_.data(); } /// @overload BOOST_FORCEINLINE const_pointer data() const { return data_.data(); } /*! @brief Container's beginning of data @return Pointer to the beginning of the container underlying sequence **/ BOOST_FORCEINLINE iterator begin() { return data_.begin(); } /// @overload BOOST_FORCEINLINE const_iterator begin() const { return data_.begin(); } /*! @brief Container's end of data @return Pointer to the end of the container underlying sequence **/ BOOST_FORCEINLINE iterator end() { return data_.end(); } /// @overload BOOST_FORCEINLINE const_iterator end() const { return data_.end(); } /*! @brief Random access to container's data @param i Index of the element to access @return Reference to the ith element of the container **/ BOOST_FORCEINLINE reference operator[](size_type i) { this->specifics().synchronize(); return data_[i]; } /// @overload BOOST_FORCEINLINE const_reference operator[](size_type i) const { this->specifics().synchronize(); return data_[i]; } protected: /// INTERNAL ONLY /// Initialization of inner data_ and sizes_ /// Note that the number of non-trivial (nnz) is delegated to storage scheme template<typename Size> BOOST_FORCEINLINE void init( Size const& ) { data_.resize( scheme_type::nnz( sizes_ ) ); } /// INTERNAL ONLY /// Handle the default initialization of statically-sized dynamic container template<typename Size> BOOST_FORCEINLINE void init(Size const& sz, boost::mpl::true_ const& ) { init(sz); } template<typename Size> BOOST_FORCEINLINE void init(Size const&, boost::mpl::false_ const& ) {} /// INTERNAL ONLY - Handle the resize of statically sized container template<typename Size> BOOST_FORCEINLINE void resize ( Size const& szs , boost::mpl::true_ const& , boost::mpl::true_ const& ) { boost::ignore_unused(szs); BOOST_ASSERT_MSG( szs == extent_type() , "Statically sized container can't be resized dynamically" ); } /// INTERNAL ONLY - Handle the resize of dynamic container template<typename Size> BOOST_FORCEINLINE void resize ( Size const& szs , boost::mpl::false_ const& , boost::mpl::false_ const& ) { if( szs != sizes_ ) { sizes_ = extent_type(szs); init(sizes_); } } /// INTERNAL ONLY - Handle the resize of container with static storage_size template<typename Size> BOOST_FORCEINLINE void resize ( Size const& szs , boost::mpl::false_ const& , boost::mpl::true_ const& ) { using szt = typename meta::option < Settings , tag::storage_size_ , Kind >::type::storage_size_type; BOOST_ASSERT_MSG ( nt2::numel(szs) <= szt::value , "Resizing over available storage size" ); sizes_ = extent_type(szs); } private: buffer_type data_; extent_type sizes_; template<typename Kind2, typename T2, typename S2> friend struct container; }; /*! @brief Container generalized swap Swap the contents of two containers @param x First @c container to swap @param y Second @c container to swap **/ template< typename Kind1, typename Kind2 , typename T , typename S1, typename S2 > BOOST_FORCEINLINE void swap(container<Kind1,T,S1>& x, container<Kind2,T,S2>& y) { x.swap(y); } /// @overload template<typename Kind, typename T, typename S> BOOST_FORCEINLINE void swap(T& x, container<Kind, T, S>& y) { y.swap(x); } /// @overload template<typename Kind, typename T, typename S> BOOST_FORCEINLINE void swap(container<Kind, T, S>& x, T& y) { x.swap(y); } } } #endif <|start_filename|>modules/core/trigonometric/include/nt2/trigonometric/functions/fast_sincosd.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_TRIGONOMETRIC_FUNCTIONS_FAST_SINCOSD_HPP_INCLUDED #define NT2_TRIGONOMETRIC_FUNCTIONS_FAST_SINCOSD_HPP_INCLUDED #include <nt2/include/functor.hpp> namespace nt2 { namespace tag { /*! @brief fast_sincosd generic tag Represents the fast_sincosd function in generic contexts. @par Models: Hierarchy **/ struct fast_sincosd_ : ext::elementwise_<fast_sincosd_> { /// @brief Parent hierarchy typedef ext::elementwise_<fast_sincosd_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_fast_sincosd_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::fast_sincosd_, Site> dispatching_fast_sincosd_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::fast_sincosd_, Site>(); } template<class... Args> struct impl_fast_sincosd_; } /*! Computes simultaneously sine and cosine from angle in degree in the interval \f$[-45, 45]\f$, nan outside. @par Semantic: For every parameter of floating type T0 @code T0 c, s; tie(s, c) = fast_sincosd(x); @endcode is similar to: @code T0 c = fast_cosd(x); T0 s = fast_sind(x); @endcode @param a0 @see @funcref{fast_sind}, @funcref{sincosd}, @funcref{fast_cosd} @return a pair of value of the same type as the parameter **/ NT2_FUNCTION_IMPLEMENTATION(tag::fast_sincosd_, fast_sincosd, 1) /*! Computes simultaneously sine and cosine from angle in degree in the interval \f$[-45, 45]\f$, nan outside. @par Semantic: For every parameter of floating type T0 @code T0 c, s; s = fast_sincosd(x, c); @endcode is similar to: @code T0 c = fast_cosd(x); T0 s = fast_sind(x); @endcode @see @funcref{fast_sind}, @funcref{sincosd}, @funcref{fast_cosd} @param a0 @param a1 L-Value that will receive the cosine of a0 @return the sine of a0 **/ NT2_FUNCTION_IMPLEMENTATION_TPL(tag::fast_sincosd_, fast_sincosd,(A0 const&)(A1&),2) /*! Computes simultaneously sine and cosine from angle in degree in the interval \f$[-45, 45]\f$, nan outside. @par Semantic: For every parameter of floating type T0 @code T0 c, s; fast_sincosd(x, s, c); @endcode is similar to: @code T0 c = fast_cosd(x); T0 s = fast_sind(x); @endcode @see @funcref{fast_sind}, @funcref{sincosd}, @funcref{fast_cosd} @param a0 input in degree @param a1 L-Value that will receive the sine of a0 @param a2 L-Value that will receive the cosine of a0 @return a pair of value of the same type as the parameter **/ NT2_FUNCTION_IMPLEMENTATION_TPL(tag::fast_sincosd_, fast_sincosd,(A0 const&)(A1&)(A2&),3) } #endif <|start_filename|>modules/core/polynom/include/nt2/polynom/functions/polyvalm.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_POLYNOM_FUNCTIONS_POLYVALM_HPP_INCLUDED #define NT2_POLYNOM_FUNCTIONS_POLYVALM_HPP_INCLUDED #include <nt2/include/functor.hpp> #include <nt2/sdk/meta/size_as.hpp> #include <nt2/sdk/meta/value_as.hpp> #include <nt2/core/container/dsl/size.hpp> #include <nt2/sdk/meta/tieable_hierarchy.hpp> #include <nt2/core/container/dsl/value_type.hpp> namespace nt2 { namespace tag { /*! @brief polyvalm generic tag Represents the polyvalm function in generic contexts. @par Models: Hierarchy **/ struct polyvalm_ : ext::unspecified_<polyvalm_> { /// @brief Parent hierarchy typedef ext::unspecified_<polyvalm_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_polyvalm_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::polyvalm_, Site> dispatching_polyvalm_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::polyvalm_, Site>(); } template<class... Args> struct impl_polyvalm_; } /*! computes the value of a polynomial p at a square matrix a using matricial product. the polynomial is supposed to be given by an array coefficients in decreasing degrees order @par Semantic: For every expression p representing and a representing a square matrix @code auto r = polyvalm(p, a); @endcode Computes \f$\displaystyle \sum_0^n p_i \mbox{mpow}(a, i)\f$. @see @funcref{mpower} @param a0 @param a1 @return an expression **/ NT2_FUNCTION_IMPLEMENTATION(tag::polyvalm_, polyvalm, 2) } namespace nt2 { namespace ext { /// INTERNAL ONLY template<class Domain, int N, class Expr> struct size_of<tag::polyvalm_,Domain,N,Expr> { typedef typename boost::proto::result_of::child_c<Expr&,1>::value_type::extent_type result_type; BOOST_FORCEINLINE result_type operator()(Expr& e) const { return boost::proto::child_c<1>(e).extent(); } }; /// INTERNAL ONLY template<class Domain, int N, class Expr> struct value_type<tag::polyvalm_,Domain,N,Expr> : meta::value_as<Expr,0> {}; } } #endif <|start_filename|>modules/boost/simd/base/include/boost/simd/reduction/functions/compare_not_equal.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2011 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2011 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef BOOST_SIMD_REDUCTION_FUNCTIONS_COMPARE_NOT_EQUAL_HPP_INCLUDED #define BOOST_SIMD_REDUCTION_FUNCTIONS_COMPARE_NOT_EQUAL_HPP_INCLUDED #include <boost/simd/include/functor.hpp> #include <boost/dispatch/include/functor.hpp> #include <boost/proto/tags.hpp> namespace boost { namespace simd { namespace tag { /*! @brief compare_not_equal generic tag Represents the compare_not_equal function in generic contexts. @par Models: Hierarchy **/ struct compare_not_equal_ : ext::unspecified_<compare_not_equal_> { /// @brief Parent hierarchy typedef ext::unspecified_<compare_not_equal_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_compare_not_equal_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::compare_not_equal_, Site> dispatching_compare_not_equal_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::compare_not_equal_, Site>(); } template<class... Args> struct impl_compare_not_equal_; } /*! Returns a logical scalar that is the result of the lexicographic test for != on elements of the entries, i.e. return true if and only if two corresponding entries elements are not equal. It is probably not what you wish. Have a look to <tt>is_not_equal</tt> @par Semantic: For every parameters of type T0: @code logical<scalar_of<T0>> r = compare_not_equal(a0,a1); @endcode is similar to: @code logical<scalar_of<T0>> r = any(a0 == a1); @endcode @par Alias: @c compare_neq @see @funcref{is_not_equal} @param a0 @param a1 @return a value of the scalar logical type associated to the parameter **/ BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::compare_not_equal_, compare_not_equal , 2 ) BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::compare_not_equal_, compare_neq , 2 ) } } #endif <|start_filename|>modules/core/statistics/include/nt2/statistics/functions/lognpdf.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_STATISTICS_FUNCTIONS_LOGNPDF_HPP_INCLUDED #define NT2_STATISTICS_FUNCTIONS_LOGNPDF_HPP_INCLUDED #include <nt2/include/functor.hpp> namespace nt2 { namespace tag { /*! @brief lognpdf generic tag Represents the lognpdf function in generic contexts. @par Models: Hierarchy **/ struct lognpdf_ : ext::elementwise_<lognpdf_> { /// @brief Parent hierarchy typedef ext::elementwise_<lognpdf_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_lognpdf_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::lognpdf_, Site> dispatching_lognpdf_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::lognpdf_, Site>(); } template<class... Args> struct impl_lognpdf_; } /*! lognormal distribution density @par Semantic: @code auto r = lognpdf(a0, m, s); @endcode is similar to: @code auto r = exp(sqr((a0-m)/s)/2)*Invsqrt_2pi; @endcode @see @funcref{exp}, @funcref{sqr}, @funcref{Invsqrt_2pi}, @param a0 @param m optional mean of the associated normal distribution, default to 0 @param s optional standard deviation of the associated normal distribution, default to 1 @return an expression which eventually will evaluate to the result **/ NT2_FUNCTION_IMPLEMENTATION(tag::lognpdf_, lognpdf, 3) /// @overload NT2_FUNCTION_IMPLEMENTATION(tag::lognpdf_, lognpdf, 2) /// @overload NT2_FUNCTION_IMPLEMENTATION(tag::lognpdf_, lognpdf, 1) } #endif <|start_filename|>modules/core/exponential/include/nt2/exponential/functions/cbrt.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_EXPONENTIAL_FUNCTIONS_CBRT_HPP_INCLUDED #define NT2_EXPONENTIAL_FUNCTIONS_CBRT_HPP_INCLUDED #include <nt2/include/functor.hpp> namespace nt2 { namespace tag { /*! @brief cbrt generic tag Represents the cbrt function in generic contexts. @par Models: Hierarchy **/ struct cbrt_ : ext::elementwise_<cbrt_> { /// @brief Parent hierarchy typedef ext::elementwise_<cbrt_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_cbrt_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::cbrt_, Site> dispatching_cbrt_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::cbrt_, Site>(); } template<class... Args> struct impl_cbrt_; } /*! Compute the cubic root: \f$\sqrt[3]{x}\f$ @par Semantic: For every parameter of floating type T0 @code T0 r = cbrt(x); @endcode is similar to: @code T0 r = pow(x, T0(1/3.0)); @endcode @see @funcref{pow}, @funcref{boost::simd::sqrt} @param a0 @return a value of the same type as the parameter **/ NT2_FUNCTION_IMPLEMENTATION(tag::cbrt_, cbrt, 1) } #endif <|start_filename|>modules/core/trigonometric/include/nt2/trigonometric/functions/fast_tand.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_TRIGONOMETRIC_FUNCTIONS_FAST_TAND_HPP_INCLUDED #define NT2_TRIGONOMETRIC_FUNCTIONS_FAST_TAND_HPP_INCLUDED #include <nt2/include/functor.hpp> namespace nt2 { namespace tag { /*! @brief fast_tand generic tag Represents the fast_tand function in generic contexts. @par Models: Hierarchy **/ struct fast_tand_ : ext::elementwise_<fast_tand_> { /// @brief Parent hierarchy typedef ext::elementwise_<fast_tand_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_fast_tand_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::fast_tand_, Site> dispatching_fast_tand_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::fast_tand_, Site>(); } template<class... Args> struct impl_fast_tand_; } /*! tangent of the angle in degree, in the interval \f$[-45, 45]\f$, nan outside. @par Semantic: For every parameter of floating type T0 @code T0 r = fast_tand(x); @endcode is similar to: @code T0 r = tand(x); @endcode @see @funcref{tand}, @funcref{tan} @param a0 @return a value of the same type as the parameter **/ NT2_FUNCTION_IMPLEMENTATION(tag::fast_tand_, fast_tand, 1) } #endif <|start_filename|>modules/core/reduction/include/nt2/core/functions/var.hpp<|end_filename|> //============================================================================== // Copyright 2003 & onward LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 & onward LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_CORE_FUNCTIONS_VAR_HPP_INCLUDED #define NT2_CORE_FUNCTIONS_VAR_HPP_INCLUDED #include <nt2/include/functor.hpp> namespace nt2 { namespace tag { /*! @brief Tag for the var functor **/ struct var_ : ext::abstract_<var_> { /// @brief Parent hierarchy typedef ext::abstract_<var_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_var_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::var_, Site> dispatching_var_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::var_, Site>(); } template<class... Args> struct impl_var_; } /*! @brief variance of a table along a given dimension Returns the variance of a table along a given dimension @par Semantic For any table expression of T @c t integer or weights w and any integer @c n: @code auto r = var(t, w, n); @endcode is equivalent to: if w is an integer @code size_t h = size(a, n); auto r = asum2(a-mean(a, n))/(w || (h == 1))? h : h-1); @endcode if w is an expression table of positive weights @code auto r = asum2(a-mean(a, w, n))/sum(w); @endcode @par Note: n default to firstnonsingleton(t) @see @funcref{firstnonsingleton}, @funcref{mean}, @funcref{asum2} @param a0 Table expression to process @param a1 normalization hint or table expression of weights @param a2 Dimension along which to process a0 @return An expression eventually evaluated to the result **/ NT2_FUNCTION_IMPLEMENTATION(nt2::tag::var_ , var, 3) /// @overload NT2_FUNCTION_IMPLEMENTATION(nt2::tag::var_ , var, 2) /// @overload NT2_FUNCTION_IMPLEMENTATION(nt2::tag::var_ , var, 1) } #endif <|start_filename|>modules/core/elliptic/include/nt2/elliptic/functions/am.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_ELLIPTIC_FUNCTIONS_AM_HPP_INCLUDED #define NT2_ELLIPTIC_FUNCTIONS_AM_HPP_INCLUDED #include <nt2/include/functor.hpp> namespace nt2 { namespace tag { /*! @brief am generic tag Represents the am function in generic contexts. @par Models: Hierarchy **/ struct am_ : ext::elementwise_<am_> { /// @brief Parent hierarchy typedef ext::elementwise_<am_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_am_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::am_, Site> dispatching_am_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::am_, Site>(); } template<class... Args> struct impl_am_; } /*! Returns the the jacobi's elliptic function am(u,x,{tol}{,choice}) @par Semantic: Let F(phi,k) = F(phi \ alpha) = F(phi | m), be Legendre's elliptic function of the first kind with modulus k, modular angle alpha where k = sin(alpha) or parameter m where m = k^2, i.e. \f$\displaystyle F(\phi,k) = \int_0^\phi \frac{d\theta}{\sqrt{1 - k^2 \sin^2\theta}}\f$ \f$\displaystyle F(\phi \backslash \alpha) = \int_0^\phi \frac{d\theta}{\sqrt{1 - \sin^2\alpha \sin^2\theta}}\f$ \f$\displaystyle F(\phi | m) = \int_0^\phi \frac{d\theta}{\sqrt{1 - m \sin^2\theta}}\f$ This Jacobi elliptic amplitude function, am, is defined as am(u,k) = am(u \ alpha) = am(u | m) = phi where u = F(phi,k) = F(phi \ alpha) = F(phi | m). The second argument of the amplitude function am(u,x) corresponding to the second argument of the elliptic integral of the first kind F(phi,x). x may be the modulus, modular angle, or parameter depending on the value of choice. If a2 = 'm', then x must be between 0 and 1 inclusively and if a2 = 'k', then x must be between -1 and 1 inclusively. @param a0 The first argument of am(u,x) corresponding to the value of the elliptic integral of the first kind u = F(am(u,x),x). @param a1 The second argument of the amplitude function am(u,x) corresponding to the second argument of the elliptic integral of the first kind F(phi,x). x may be the modulus, modular angle, or parameter depending on the value of a2. If a2 = 'm', then x must be between 0 and 1 inclusively and if a2 = 'k', then x must be between -1 and 1 inclusively. @param a3 tol the tolerance on the result accuracy by defaut Eps<T>(), where T is the type of u @param a2 arg The mode of the second argument of am(): If a2 = 'k', then x = k, the modulus of F(phi,k). If A2 = 'a', then x = alpha, the modular angle of F(phi \ alpha), alpha in radians. If arg = 'm', then x = m, the parameter of F(phi | m). The value of arg defaults to 'k'. @return a value of the same type as the first parameter **/ NT2_FUNCTION_IMPLEMENTATION(tag::am_, am, 2) NT2_FUNCTION_IMPLEMENTATION(tag::am_, am, 3) NT2_FUNCTION_IMPLEMENTATION(tag::am_, am, 4) } #endif <|start_filename|>modules/boost/simd/base/include/boost/simd/bitwise/functions/bitwise_select.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef BOOST_SIMD_BITWISE_FUNCTIONS_BITWISE_SELECT_HPP_INCLUDED #define BOOST_SIMD_BITWISE_FUNCTIONS_BITWISE_SELECT_HPP_INCLUDED #include <boost/simd/include/functor.hpp> #include <boost/dispatch/include/functor.hpp> namespace boost { namespace simd { namespace tag { /*! @brief bitwise_select generic tag Represents the bitwise_select function in generic contexts. @par Models: Hierarchy **/ struct bitwise_select_ : ext::elementwise_<bitwise_select_> { /// @brief Parent hierarchy typedef ext::elementwise_<bitwise_select_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_bitwise_select_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::bitwise_select_, Site> dispatching_bitwise_select_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::bitwise_select_, Site>(); } template<class... Args> struct impl_bitwise_select_; } /*! Returns the bitwise selection of bits from the second or third operand according to the setting of the bits of the first operand @par semantic: For any given value @c x, of type @c T1, @c y of type @c T2 and @c z of type @c T2 of same memory size: @code T2 r = bitwise_select(x, y, z); @endcode The code is equivalent to: @code T2 r = (x&y)|(z&~y); @endcode @par Alias b_select @param a0 selector @param a1 bits selected for a0 bits that are on @param a2 bits selected for a0 bits that are off @return a value of the same type as the second input. **/ BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::bitwise_select_, bitwise_select, 3) BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::bitwise_select_, b_select, 3) } } #endif <|start_filename|>modules/boost/simd/base/include/boost/simd/swar/functions/combine.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // Copyright 2012 - 2013 MetaScale SAS // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef BOOST_SIMD_SWAR_FUNCTIONS_COMBINE_HPP_INCLUDED #define BOOST_SIMD_SWAR_FUNCTIONS_COMBINE_HPP_INCLUDED #include <boost/simd/include/functor.hpp> #include <boost/dispatch/include/functor.hpp> namespace boost { namespace simd { namespace tag { /*! @brief combine generic tag Represents the combine function in generic contexts. **/ struct combine_ : ext::unspecified_<combine_> { /// @brief Parent hierarchy typedef ext::unspecified_<combine_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_combine_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::combine_, Site> dispatching_combine_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::combine_, Site>(); } template<class... Args> struct impl_combine_; } /*! @brief Combining vector Join two SIMD register into a register of greater cardinal. @par Semantic @param a0 First part of the combination @param a1 Second part of the combination @return The combined vector */ BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::combine_, combine, 2) } } #endif <|start_filename|>modules/core/restructuring/include/nt2/core/functions/cat.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2014 LRI UMR 8623 CNRS/Univ Paris Sud XI // Copyright 2012 - 2014 NumScale SAS // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_CORE_FUNCTIONS_CAT_HPP_INCLUDED #define NT2_CORE_FUNCTIONS_CAT_HPP_INCLUDED #include <nt2/include/functor.hpp> #include <nt2/include/functions/size.hpp> #include <nt2/include/functions/extent.hpp> #include <nt2/core/container/dsl/size.hpp> #include <nt2/core/container/dsl/value_type.hpp> #include <boost/mpl/assert.hpp> namespace nt2 { namespace tag { /// Tag for @c cat functor struct cat_ : ext::unspecified_<cat_> { /// @brief Parent hierarchy typedef ext::unspecified_<cat_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_cat_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::cat_, Site> dispatching_cat_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::cat_, Site>(); } template<class... Args> struct impl_cat_; } /*! Concatenates tables along specified dimension @param dim Dimension along which to concatenate @param a0 First table to concatenate @param a1 Second table to concatenate @return A lazy expression that will evaluate as the concatenation of a0 and a1 **/ template<class Dimension, class A0, class A1> BOOST_FORCEINLINE typename meta::call<tag::cat_(Dimension const&, A0 const&, A1 const&)>::type cat(Dimension const& dim, A0 const& a0, A1 const& a1) { return typename make_functor<tag::cat_, A0>::type()(dim,a0,a1); } } namespace nt2 { namespace ext { /// INTERNAL ONLY /// Computes the extent of a cat expression as being the "concatenation" of /// the initial tables' size template<class Domain, int N, class Expr> struct size_of<nt2::tag::cat_,Domain,N,Expr> { // Can't be anything else as along is defined at runtime // TODO: Support cat<N>(a0,a1) and computes exact of_size in this case typedef of_size_max result_type; BOOST_FORCEINLINE result_type operator ()(Expr& e) const { // cat with empty matrix return the other matrix if( !numel(boost::proto::child_c<1>(e).extent()) ) { return boost::proto::child_c<2>(e).extent(); } else if( !numel(boost::proto::child_c<2>(e).extent()) ) { return boost::proto::child_c<1>(e).extent(); } // otherwise cat the size properly else { // Direction of concatenation std::size_t along = boost::proto::child_c<0>(e); // Build return size result_type sizee(boost::proto::child_c<1>(e).extent()); sizee[along-1] += nt2::size(boost::proto::child_c<2>(e),along); return sizee; } } }; /// INTERNAL ONLY /// Computes the value type of a cat expression as being the same than first /// child if both children have the same value type template<class Domain, int N, class Expr> struct value_type<nt2::tag::cat_,Domain,N,Expr> { typedef typename boost::proto::result_of ::child_c<Expr&,1>::value_type::value_type type; typedef typename boost::proto::result_of ::child_c<Expr&,2>::value_type::value_type other_type; BOOST_MPL_ASSERT_MSG ( (boost::is_same<type,other_type>::value) , NT2_INCOMPATIBLE_TYPE_IN_CAT_EXPRESSION , (type,other_type) ); }; } } #endif <|start_filename|>modules/core/sdk/include/nt2/core/container/view/view.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2011 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2011 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_CORE_CONTAINER_VIEW_VIEW_HPP_INCLUDED #define NT2_CORE_CONTAINER_VIEW_VIEW_HPP_INCLUDED #include <nt2/sdk/memory/container_ref.hpp> #include <nt2/sdk/memory/container_shared_ref.hpp> #include <nt2/core/container/view/adapted/view.hpp> #include <boost/dispatch/dsl/semantic_of.hpp> #include <boost/config.hpp> #if defined(BOOST_MSVC) #pragma warning( push ) #pragma warning( disable : 4522 ) // multiple assignment operators specified #endif namespace nt2 { namespace tag { struct table_; } } namespace nt2 { namespace container { template<class Expression, class ResultType> struct expression; /* view; an expression of a container_ref terminal. * allows construction from an expression of a container terminal */ template<typename Kind, typename T, typename S> struct view : expression< boost::proto::basic_expr < nt2::tag::terminal_ , boost::proto::term < memory::container_ref < Kind , T , S > > , 0l > , memory::container<Kind, T, S>& > { typedef memory::container_ref<Kind, T, S> container_ref; typedef boost::proto::basic_expr< nt2::tag::terminal_ , boost::proto::term<container_ref> , 0l > basic_expr; typedef memory::container<Kind, T, S>& container_type; typedef expression<basic_expr, container_type> nt2_expression; typedef typename container_ref::iterator iterator; typedef typename container_ref::const_iterator const_iterator; iterator begin() const { return boost::proto::value(*this).begin(); } iterator end() const { return boost::proto::value(*this).end(); } BOOST_FORCEINLINE view() { } BOOST_FORCEINLINE view( nt2_expression const& expr ) : nt2_expression(expr) { } template<class Xpr> BOOST_FORCEINLINE view( Xpr& expr ) : nt2_expression(basic_expr::make(boost::proto::value(expr))) { } template<class Xpr> BOOST_FORCEINLINE view( Xpr const& expr ) : nt2_expression(basic_expr::make(boost::proto::value(expr))) { } template<class Xpr> void reset(Xpr& other) { view tmp(other); boost::proto::value(*this) = boost::proto::value(tmp); this->size_ = tmp.size_; } //========================================================================== // Enable base expression handling of assignment //========================================================================== template<class Xpr> BOOST_FORCEINLINE typename boost::disable_if< boost::is_base_of<nt2_expression, Xpr> , view& >::type operator=(Xpr const& xpr) { nt2_expression::operator=(xpr); return *this; } BOOST_FORCEINLINE view& operator=(view const& xpr) { nt2_expression::operator=(xpr); return *this; } template<class Xpr> BOOST_FORCEINLINE typename boost::disable_if< boost::is_base_of<nt2_expression, Xpr> , view const& >::type operator=(Xpr const& xpr) const { nt2_expression::operator=(xpr); return *this; } BOOST_FORCEINLINE view const& operator=(view const& xpr) const { nt2_expression::operator=(xpr); return *this; } }; template<typename Kind, typename T, typename S> struct view<Kind, T const, S> : expression< boost::proto ::basic_expr< nt2::tag::terminal_ , boost::proto::term < memory::container_ref<Kind,T const,S> > , 0l > , memory::container<Kind,T,S> const& > { typedef memory::container_ref<Kind,T const,S> container_ref; typedef boost::proto::basic_expr< nt2::tag::terminal_ , boost::proto::term< memory::container_ref < Kind , T const , S > > , 0l > basic_expr; typedef memory::container<Kind,T,S> const& container_type; typedef expression<basic_expr, container_type> nt2_expression; typedef typename container_ref::iterator iterator; typedef typename container_ref::const_iterator const_iterator; iterator begin() const { return boost::proto::value(*this).begin(); } iterator end() const { return boost::proto::value(*this).end(); } BOOST_FORCEINLINE view() { } BOOST_FORCEINLINE view( nt2_expression const& expr ) : nt2_expression(expr) { } template<class Xpr> BOOST_FORCEINLINE view( Xpr const& expr ) : nt2_expression(basic_expr::make(boost::proto::value(expr))) { } template<class Xpr> void reset(Xpr const& other) { view tmp(other); boost::proto::value(*this) = boost::proto::value(tmp); this->size_ = tmp.size_; } //========================================================================== // Enable base expression handling of assignment //========================================================================== template<class Xpr> BOOST_FORCEINLINE typename boost::disable_if< boost::is_base_of<nt2_expression, Xpr> , view& >::type operator=(Xpr const& xpr) { nt2_expression::operator=(xpr); return *this; } BOOST_FORCEINLINE view& operator=(view const& xpr) { nt2_expression::operator=(xpr); return *this; } template<class Xpr> BOOST_FORCEINLINE typename boost::disable_if< boost::is_base_of<nt2_expression, Xpr> , view const& >::type operator=(Xpr const& xpr) const { nt2_expression::operator=(xpr); return *this; } BOOST_FORCEINLINE view const& operator=(view const& xpr) const { nt2_expression::operator=(xpr); return *this; } }; } } namespace nt2 { using nt2::container::view; } #endif <|start_filename|>modules/boost/simd/base/include/boost/simd/operator/functions/if_else.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2011 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2011 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef BOOST_SIMD_OPERATOR_FUNCTIONS_IF_ELSE_HPP_INCLUDED #define BOOST_SIMD_OPERATOR_FUNCTIONS_IF_ELSE_HPP_INCLUDED #include <boost/simd/include/functor.hpp> namespace boost { namespace simd { namespace tag { /*! @brief if_else generic tag Represents the if_else function in generic contexts. @par Models: Hierarchy **/ struct if_else_ : ext::elementwise_<if_else_> { /// @brief Parent hierarchy typedef ext::elementwise_<if_else_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_if_else_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; typedef if_else_ select_; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::if_else_, Site> dispatching_if_else_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::if_else_, Site>(); } template<class... Args> struct impl_if_else_; } /*! return the elementwise selected element from the second and third operand according to the non nullity of the first operand. parameters 2 and 3 must share the same type and also the same element size as parameter 1 @par Semantic: For every parameters of types respectively T0, T1, T2: @code T0 r = if_else(a0,a1,a2); @endcode is similar to: @code T0 r = a0 ? a1 : a2; @endcode @par Alias: @c where, @c select, @c sel @see @funcref{if_else_zero}, @funcref{if_else_allbits}, @funcref{if_zero_else}, @funcref{if_allbits_else}, @funcref{if_one_else_zero}, @funcref{if_zero_else_one}, @funcref{bitwise_select} @param a0 @param a1 @param a2 @return a value of the same type as the second parameter **/ BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::if_else_ , if_else , 3 ) BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::if_else_ , where , 3 ) BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::if_else_ , select , 3 ) BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::if_else_ , sel , 3 ) } } #include <boost/simd/operator/specific/common.hpp> #endif <|start_filename|>modules/boost/simd/base/include/boost/simd/arithmetic/functions/fast_toint.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef BOOST_SIMD_ARITHMETIC_FUNCTIONS_FAST_TOINT_HPP_INCLUDED #define BOOST_SIMD_ARITHMETIC_FUNCTIONS_FAST_TOINT_HPP_INCLUDED #include <boost/simd/include/functor.hpp> #include <boost/dispatch/include/functor.hpp> namespace boost { namespace simd { namespace tag { /*! @brief fast_toint generic tag Represents the fast_toint function in generic contexts. @par Models: Hierarchy **/ struct fast_toint_ : ext::elementwise_<fast_toint_> { /// @brief Parent hierarchy typedef ext::elementwise_<fast_toint_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_fast_toint_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::fast_toint_, Site> dispatching_fast_toint_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::fast_toint_, Site>(); } template<class... Args> struct impl_fast_toint_; } /*! Convert to integer by truncation. @par semantic: For any given value @c x of type @c T: @code as_integer<T> r = fast_toint(x); @endcode The code is similar to: @code as_integer<T> r = static_cast<as_integer<T> >(x) @endcode @par Notes: @c fast_toint cast a floating value to the signed integer value of the same bit size. This is done by C casting for scalars and corresponding intrinsic in simd (if available). Peculiarly, that implies that the behaviour of this function on invalid entries is not defined and quite unpredictable. (For instance it is quite frequent that the test: @code fast_toint(Inf<double>()) == fast_toint(1.0/0.0) @endcode will return false whilst the test: @code Inf<double>() == 1.0/0.0 @endcode returns true !) If you intend to use nans and infs entries, consider using fast_toints instead. On integral typed values, it acts as identity. @par Alias fast__fast_toint @param a0 @return a value of the integer type associated to the input. **/ BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::fast_toint_, fast_toint, 1) } } #include <boost/simd/operator/specific/common.hpp> #endif <|start_filename|>modules/core/generative/include/nt2/core/functions/details/colon.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // Copyright 2011 - 2012 MetaScale SAS // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_CORE_FUNCTIONS_DETAILS_COLON_HPP_INCLUDED #define NT2_CORE_FUNCTIONS_DETAILS_COLON_HPP_INCLUDED #include <nt2/core/container/dsl/forward.hpp> #include <nt2/include/functions/simd/fma.hpp> #include <nt2/include/functions/simd/splat.hpp> #include <nt2/include/functions/simd/enumerate.hpp> #include <nt2/include/functions/simd/plus.hpp> #include <nt2/core/functions/table/details/is_vectorizable_indexer.hpp> #include <nt2/core/container/extremum/extremum.hpp> #include <nt2/core/utility/of_size.hpp> #include <nt2/sdk/meta/as_signed.hpp> #include <nt2/sdk/meta/is_signed.hpp> #include <nt2/sdk/meta/constant_adaptor.hpp> #include <nt2/sdk/meta/as.hpp> #include <boost/mpl/bool.hpp> namespace nt2 { namespace tag { struct table_; struct colon_; struct unity_colon_; struct terminal_; } } namespace nt2 { namespace details { /// INTERNAL ONLY /// Factorized code for colon size evaluation template<class L, class S, class U> BOOST_FORCEINLINE std::size_t colon_size(L const& l, S const& s, U const& u) { typedef typename meta::as_signed<L>::type ltype; typedef typename meta::as_signed<U>::type utype; return s ? ( ((u>l)==(s>0)) ? (utype(u)-ltype(l)+s)/s : (u == l)) : u; } /// INTERNAL ONLY /// Factorized code for colon evaluation template<class L, class S, class Pos, class Target> BOOST_FORCEINLINE typename Target::type colon_value(L const& l, S const& s, Pos const& p, Target const&) { typedef typename Target::type type; return nt2::fma ( nt2::enumerate<type>(p) , nt2::splat<type>(s), nt2::splat<type>(l) ); } /// INTERNAL ONLY /// Same sign helper unity_colon_size template<class L, class U, bool B> BOOST_FORCEINLINE std::size_t unity_helper( L const& l, U const& u , boost::mpl::bool_<B> const& , boost::mpl::bool_<B> const& ) { return (u >= l) ? static_cast<std::size_t>(u-l+1) : 0u; } /// INTERNAL ONLY /// signed/unsigned helper unity_colon_size template<class L, class U> BOOST_FORCEINLINE std::size_t unity_helper( L const& l, U const& u , const boost::mpl::true_& , const boost::integral_constant<bool, false>& ) { return (l <= 0) ? static_cast<std::size_t>(u-l+1) : ( u >= static_cast<U>(l) ? static_cast<std::size_t>(u-l+1) : 0u ); } /// INTERNAL ONLY /// unsigned/signed helper unity_colon_size template<class L, class U> BOOST_FORCEINLINE std::size_t unity_helper( L const& l, U const& u , const boost::integral_constant<bool, false>& , const boost::integral_constant<bool, true>& ) { return (u <= 0) ? 0u : ( static_cast<L>(u) >= l ? static_cast<std::size_t>(u-l+1) : 0u ); } /// INTERNAL ONLY /// Factorized code for unity colon size evaluation template<class L, class U> BOOST_FORCEINLINE std::size_t unity_colon_size(L const& l, U const& u) { return unity_helper ( l , u , typename nt2::meta::is_signed<L>::type() , typename nt2::meta::is_signed<U>::type() ); } /// INTERNAL ONLY /// Factorized code for unity colon evaluation template<class T, class Pos, class Target> BOOST_FORCEINLINE typename Target::type unity_colon_value(T const& l, Pos const& p, Target const&) { typedef typename Target::type type; return nt2::enumerate<type>(p)+nt2::splat<type>(l); } /// INTERNAL ONLY /// Storage for relative colon info template<class Begin, class End> struct relative_colon { typedef typename meta::is_extremum<Begin>::type is_begin_t; typedef typename meta::is_extremum<End>::type is_end_t; Begin begin_; End end_; // Computations of lower & upper have to take care of all // begin/end or end/begin combinations template<class B, class S> std::ptrdiff_t lower(B const& b, S const& s) const { return lower(b,s,is_begin_t()); } template<class B, class S> std::ptrdiff_t upper(B const& b, S const& s) const { return upper(b,s,is_end_t()); } private: // lower/upper computations for scalar extremum template<class B, class S> std::ptrdiff_t lower(B const&, S const&, boost::mpl::false_ const&) const { return begin_; } template<class B, class S> std::ptrdiff_t upper(B const&, S const&, boost::mpl::false_ const&) const { return end_; } // lower/upper computations for begin_/end_ template<class B, class S> std::ptrdiff_t lower(B const& b, S const& s, boost::mpl::true_ const&) const { return begin_.index(b,s); } template<class B, class S> std::ptrdiff_t upper(B const& b, S const& s, boost::mpl::true_ const&) const { return end_.index(b,s); } }; } } namespace nt2 { namespace ext { // _(a, b) template<std::size_t N, std::size_t Cardinal> struct is_multiple_of : boost::mpl::bool_< !(N % Cardinal) > { }; template<std::size_t N> struct is_multiple_of<N, 0> : boost::mpl::false_ { }; template<class T, std::ptrdiff_t N, class Cardinal> struct is_vectorizable_indexer< nt2::container::expression< boost::proto::basic_expr< nt2::tag::colon_ , boost::proto::list3< nt2::container::expression< boost::proto::basic_expr< nt2::tag::terminal_ , boost::proto::term< nt2::of_size_<1l, N, 1l, 1l> > , 0l > , nt2::of_size_<1l, N, 1l, 1l> > , nt2::container::expression< boost::proto::basic_expr< nt2::tag::terminal_ , boost::proto::term< nt2::meta::constant_<nt2::tag::unity_colon_, T> > , 0l > , nt2::meta::constant_<nt2::tag::unity_colon_, T> > , nt2::container::expression< boost::proto::basic_expr< nt2::tag::terminal_ , boost::proto::term< boost::dispatch::meta::as_<T> > , 0l > , boost::dispatch::meta::as_<T> > > , 3l > , nt2::memory::container< tag::table_ , T , nt2::settings( nt2::of_size_< 1l , N , 1l , 1l > ) > > , Cardinal > : is_multiple_of<std::size_t(N < 0 ? -N : N), Cardinal::value> { }; } } namespace nt2 { namespace meta { /// INTERNAL ONLY /// colon actual functor : precompute step and just iterate over template<class Base> struct constant_<nt2::tag::colon_, Base> { typedef Base base_type; constant_() {} constant_( Base const& l, Base const& s) : lower_(l), step_(s) {} template<class Pos, class Size,class Target> BOOST_FORCEINLINE typename Target::type operator()(Pos const& p, Size const&, Target const& t) const { return details::colon_value(lower_,step_,p,t); } private: Base lower_, step_; }; /// INTERNAL ONLY /// unity_colon actual functor : just forward form lower bound template<class Base> struct constant_<nt2::tag::unity_colon_, Base> { typedef Base base_type; constant_() {} constant_( Base const& l ) : lower_(l) {} template<class Pos, class Size,class Target> BOOST_FORCEINLINE typename Target::type operator()(Pos const& p, Size const&, Target const& t) const { return details::unity_colon_value(lower_,p,t); } private: Base lower_; }; } } #endif <|start_filename|>modules/core/exponential/include/nt2/exponential/functions/nthroot.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_EXPONENTIAL_FUNCTIONS_NTHROOT_HPP_INCLUDED #define NT2_EXPONENTIAL_FUNCTIONS_NTHROOT_HPP_INCLUDED #include <nt2/include/functor.hpp> namespace nt2 { namespace tag { /*! @brief nthroot generic tag Represents the nthroot function in generic contexts. @par Models: Hierarchy **/ struct nthroot_ : ext::elementwise_<nthroot_> { /// @brief Parent hierarchy typedef ext::elementwise_<nthroot_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_nthroot_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::nthroot_, Site> dispatching_nthroot_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::nthroot_, Site>(); } template<class... Args> struct impl_nthroot_; } /*! nth root function: \f$\sqrt[a_1]{a_0}\f$ \arg a1 must be of integer type \arg if a1 is even and a0 negative the result is nan \arg if a0 is null the result is zero \arg if a0 is one the result is one @par Semantic: For every parameters of floating type T0 and integral type T1: nthroot is more expansive than pow(a0, rec(tofloat(a1))) because it takes care of some limits issues that pow does not mind of. See if it suits you better. @code T0 r = nthroot(x, n); @endcode is similar to: @code T0 r = n >= 0 ? pow(x, rec(T0(n))) : nan; @endcode @see @funcref{pow}, @funcref{rec}, @funcref{sqrt}, @funcref{cbrt} @param a0 must be of floating type @param a1 must be of integral type. @return a value of the same type as the parameter **/ NT2_FUNCTION_IMPLEMENTATION(tag::nthroot_, nthroot, 2) } #endif <|start_filename|>modules/boost/simd/base/include/boost/simd/swar/functions/interleave_odd.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef BOOST_SIMD_SWAR_FUNCTIONS_INTERLEAVE_ODD_HPP_INCLUDED #define BOOST_SIMD_SWAR_FUNCTIONS_INTERLEAVE_ODD_HPP_INCLUDED #include <boost/simd/include/functor.hpp> #include <boost/dispatch/include/functor.hpp> namespace boost { namespace simd { namespace tag { /*! @brief interleave_odd generic tag Represents the interleave_odd function in generic contexts. @par Models: Hierarchy **/ struct interleave_odd_ : ext::unspecified_<interleave_odd_> { /// @brief Parent hierarchy typedef ext::unspecified_<interleave_odd_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_interleave_odd_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::interleave_odd_, Site> dispatching_interleave_odd_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::interleave_odd_, Site>(); } template<class... Args> struct impl_interleave_odd_; } /*! Computes a vector from a combination of the two inputs. @par Semantic: For every parameters of types respectively T0: @code T0 r = interleave_odd(a,b); @endcode is equivalent to : @code r = [ a[1] b[1] a[3] b[3] ... a[n/2+1] b[n/2+1] ] @endcode with <tt> n = cardinal_of<T>::value </tt> @param a0 First vector to interleave @param a1 Second vector to interleave @return a value of the same type as the parameters **/ BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::interleave_odd_, interleave_odd, 2) } } #endif <|start_filename|>modules/core/reduction/include/nt2/core/functions/globalall.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // Copyright 2011 - 2012 MetaScale SAS // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_CORE_FUNCTIONS_GLOBALALL_HPP_INCLUDED #define NT2_CORE_FUNCTIONS_GLOBALALL_HPP_INCLUDED #include <nt2/include/functor.hpp> #include <nt2/include/functions/all.hpp> #include <nt2/include/functions/global.hpp> namespace nt2 { namespace tag { /*! @brief Tag for the globalall functor **/ struct globalall_ : ext::abstract_<globalall_> { /// @brief Parent hierarchy typedef ext::abstract_<globalall_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_globalall_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::globalall_, Site> dispatching_globalall_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::globalall_, Site>(); } template<class... Args> struct impl_globalall_; } /*! @brief Checks that all elements of an expression is non-zero @par Semantic For any table expression @c t: @code logical<T> r = globalall(t); @endcode is equivalent to: @code logical<T> r = all(t(_))(1); @endcode @see @funcref{colon}, @funcref{all} @param a0 Table to process @return An expression eventually evaluated to the result **/ NT2_FUNCTION_IMPLEMENTATION(nt2::tag::globalall_ , globalall, 1) } namespace nt2 { namespace ext { /// INTERNAL ONLY BOOST_DISPATCH_IMPLEMENT ( globalall_ , tag::cpu_ , (A0) , (unspecified_<A0>) ) { typedef typename meta::call<tag::global_( nt2::functor<tag::all_> , const A0& )>::type result_type; BOOST_FORCEINLINE result_type operator()(A0 const& a0) const { return global(nt2::functor<tag::all_>(), a0); } }; } } #endif <|start_filename|>modules/core/linalg/include/nt2/linalg/functions/general/logm.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_LINALG_FUNCTIONS_GENERAL_LOGM_HPP_INCLUDED #define NT2_LINALG_FUNCTIONS_GENERAL_LOGM_HPP_INCLUDED #include <nt2/linalg/functions/logm.hpp> #include <nt2/include/functions/abs.hpp> #include <nt2/include/functions/atanh.hpp> #include <nt2/include/functions/ceil.hpp> #include <nt2/include/functions/cons.hpp> #include <nt2/include/functions/ctranspose.hpp> #include <nt2/include/functions/colon.hpp> #include <nt2/include/functions/diag_of.hpp> #include <nt2/include/functions/divides.hpp> #include <nt2/include/functions/dot.hpp> #include <nt2/include/functions/eye.hpp> #include <nt2/include/functions/find.hpp> #include <nt2/include/functions/from_diag.hpp> #include <nt2/include/functions/globalnone.hpp> #include <nt2/include/functions/isdiagonal.hpp> #include <nt2/include/functions/is_eqz.hpp> #include <nt2/include/functions/is_lez.hpp> #include <nt2/include/functions/length.hpp> #include <nt2/include/functions/linsolve.hpp> #include <nt2/include/functions/log.hpp> #include <nt2/include/functions/logical_and.hpp> #include <nt2/include/functions/minusone.hpp> #include <nt2/include/functions/mtimes.hpp> #include <nt2/include/functions/multiplies.hpp> #include <nt2/include/functions/mnorm1.hpp> #include <nt2/include/functions/oneplus.hpp> #include <nt2/include/functions/schur.hpp> #include <nt2/include/functions/size.hpp> #include <nt2/include/functions/sqr.hpp> #include <nt2/include/functions/sqrt.hpp> #include <nt2/include/functions/symeig.hpp> #include <nt2/include/functions/transpose.hpp> #include <nt2/include/functions/twopower.hpp> #include <nt2/include/functions/zeros.hpp> #include <nt2/include/functions/isempty.hpp> #include <nt2/include/functions/horzcat.hpp> #include <nt2/include/constants/two.hpp> #include <nt2/include/constants/zero.hpp> #include <nt2/core/container/table/table.hpp> #include <nt2/sdk/complex/meta/is_complex.hpp> #include <boost/assert.hpp> namespace nt2 { namespace ext { BOOST_DISPATCH_IMPLEMENT ( logm_, tag::cpu_ , (A0) , (scalar_< unspecified_<A0> >) ) { typedef A0 result_type; NT2_FUNCTOR_CALL(1) { return nt2::log(a0); } }; // logm tag only used for matrix template<class Domain, int N, class Expr> struct size_of<tag::logm_,Domain,N,Expr> { typedef typename boost::proto::result_of::child_c<Expr&,0>::value_type c0_t; typedef _2D result_type; BOOST_FORCEINLINE result_type operator()(Expr& e) const { BOOST_ASSERT_MSG(issquare(boost::proto::child_c<0>(e)), "logm needs a square matrix or a scalar"); return nt2::extent(boost::proto::child_c<0>(e)); } }; BOOST_DISPATCH_IMPLEMENT ( run_assign_, tag::cpu_ , (A0)(A1) , ((ast_<A0, nt2::container::domain>)) ((node_<A1, nt2::tag::logm_, boost::mpl::long_<1>, nt2::container::domain>)) ) { typedef void result_type; typedef typename A1::value_type value_type; typedef typename boost::proto::result_of::child_c<A1&,0>::type Out0; typedef typename meta::as_real<value_type>::type r_type; typedef typename meta::as_complex<r_type>::type cplx_type; typedef typename meta::as_integer<r_type>::type i_type; typedef nt2::table<value_type> tab_t; typedef nt2::table<r_type> btab_t; typedef table<cplx_type> ctab_t; typedef table<i_type> itab_t; typedef typename A0::index_type index_type; BOOST_FORCEINLINE result_type operator()(A0& a0, const A1& a1) const { compute_logm(boost::proto::child_c<0>(a1), a0); } private: template < class T > BOOST_FORCEINLINE static void compute_logm(const T& a0, A0& res) { //u, t and r are complex arrays res.resize(extent(a0)); ctab_t u, t; nt2::tie(u, t) = schur(a0, nt2::cmplx_); BOOST_ASSERT_MSG(nt2::globalnone(is_eqz(nt2::diag_of(t))), "a0 has null eigenvalue(s)"); BOOST_ASSERT_MSG(nt2::globalnone(nt2::logical_and(is_eqz(imag(nt2::diag_of(t))), is_lez(real(nt2::diag_of(t))))), "a0 has non positive real eigenvalue(s)"); if (isdiagonal(t)) { t = nt2::from_diag(nt2::log(nt2::diag_of(t))); BOOST_AUTO_TPL(r, nt2::mtimes(u, nt2::mtimes(t, nt2::ctrans(u)))); transtype(res, r, typename nt2::meta::is_complex<value_type>::type()); return; } else { ctab_t r = zeros(extent(a0), meta::as_<cplx_type>()); r_type delta = 0.1; itab_t ord(nt2::of_size(2u, nt2::size(a0,1))); blocking(diag_of(t),delta, ord); uint32_t lord = nt2::size(ord, 2); for(uint32_t col=1; col <= lord ; ++col) { BOOST_AUTO_TPL(j, nt2::_(ord(1, col), ord(2, col))); uint32_t maxsqrt = 100; itab_t terms(nt2::of_size(1, lord)); uint32_t nj = length(j); ctab_t rj(nt2::of_size(nj, nj)); terms(col) = logm_triang(a0(j, j), maxsqrt, rj); r(j, j) = rj; for(uint32_t row=col-1; row >= 1; --row) { BOOST_AUTO_TPL(i, nt2::_(ord(1, row), ord(2, row))); if (length(i) == 1 && length(j) == 1) { size_t ii = i(1), jj = j(1); BOOST_AUTO_TPL(k, nt2::_(ii+1, jj-1)); cplx_type temp = a0(ii,jj)*(r(ii,ii) - r(jj,jj)); if (!isempty(k)) temp += dot(a0(k,jj), nt2::ctrans(r(ii,k)))- dot(a0(ii,k), nt2::ctrans(r(k,jj))); r(ii,jj) = temp/(a0(ii,ii)-a0(jj,jj)); } else { itab_t k(nt2::of_size(1, 0)); for(uint32_t l = row+1; l < col; ++l) { itab_t k1 = horzcat(k, nt2::_(ord(1, l), ord(2, l))); k = k1; } ctab_t rhs = mtimes(r(i,i), a0(i,j)) - mtimes(a0(i,j), r(j,j)); if(!isempty(k)) rhs += mtimes(r(i,k), a0(k,j)) - mtimes(a0(i,k), r(k,j)); r(i,j) = sylv_tri(a0(i,i),-a0(j,j),rhs); } } ctab_t z = mtimes(mtimes(u, r), ctrans(u)); transtype(res, z, typename nt2::meta::is_complex<value_type>::type()); } } } template < class T, class U, class B > static inline ctab_t sylv_tri(const T& t,const U& u, const B& b) { // sylv_tri solve triangular sylvester equation. // x = sylv_tri(t,u,b) solves the sylvester equation // t*x + x*u = b, where t and u are square upper triangular matrices. uint32_t m = length(t); uint32_t n = length(u); ctab_t x = zeros(m,n, nt2::meta::as_<cplx_type>()); for(uint32_t i = 1; i <= n; ++i) { ctab_t bb = b(nt2::_,i); BOOST_AUTO_TPL(ii, nt2::_(1u, i-1)); if(!isempty(ii)) bb -= mtimes(x(nt2::_,ii),u(ii,i)); x(nt2::_,i) = linsolve(t + u(i,i)*eye(m, meta::as_<cplx_type>()), bb); } return x; } template < class T1, class T2 > BOOST_FORCEINLINE static void transtype(T1& r, T2& z, boost::mpl::false_ const &) { r = real(z); } template < class T1, class T2 > BOOST_FORCEINLINE static void transtype(T1& r, T2& z, boost::mpl::true_ const &) { r = z; } template < class D > static inline void blocking(const D& a0, const r_type& delta, itab_t & ord) { uint32_t n = nt2::size(a0, 1); uint32_t j = 1; ord(1, 1) = 1; for(uint32_t i=2; i <= n; ++i) { if (nt2::abs(a0(i-1)-a0(i)) >= delta) { ord(2, j) = i-1; ord(1, ++j) = i; } } ord(2, j) = n; ord.resize(nt2::of_size(2u, j)); } template < class D1, class D2 > static inline uint32_t logm_triang(const D1& a0, uint32_t maxsqrt, D2& rj) { uint32_t term = 0; if (nt2::size(a0, 1) == 1) { rj(1) = log(a0(1)); } else if(nt2::size(a0, 1) == 2) { logm2by2(a0, maxsqrt, rj); } else { logm_tr(a0, maxsqrt, rj, term); } return term; } template < class D1, class D2 > static inline void logm2by2(const D1& a0, uint32_t /*maxsqrt*/, D2& rj) { value_type a1 = a0(1,1); value_type a2 = a0(2,2); value_type loga1 = log(a1); value_type loga2 = log(a2); rj = nt2::cons(nt2::of_size(2, 2), loga1, Zero<value_type>(), Zero<value_type>(), loga2); if (a1 == a2) { rj(1,2) = a0(1,2)/a1; } else if ((nt2::abs(a1) < nt2::Half<r_type>()*nt2::abs(a2)) || (nt2::abs(a2) < nt2::Half<r_type>()*nt2::abs(a1))) { rj(1,2) = a0(1,2) * (loga2 - loga1) / (a2 - a1); } else // Close eigenvalues. { //dd = (2*atanh((a2-a1)/(a2+a1))) // dd=(dd+ 2*pi*1i*unwinding(loga2-loga1)) / (a2-a1) value_type dd = Two<value_type>()*nt2::atanh(nt2::divides((a2-a1), (a2+a1))); dd += unwind(loga2-loga1, meta::is_complex<value_type>()); dd /= a2-a1; rj(1,2) = nt2::multiplies(a0(1,2), dd); } } static inline r_type unwind(const value_type& /*z*/, boost::mpl::false_) { return Zero<r_type>(); } static inline cplx_type unwind(const value_type& z, boost::mpl::true_) { static const r_type _2pi = nt2::Two<r_type>()*nt2::Pi<r_type>(); return cplx_type(Zero<r_type>(), _2pi*nt2::ceil((imag(z)-nt2::Pi<r_type>())/_2pi)); } template < class D1, class D2 > static inline void logm_tr(const D1& a0, uint32_t maxsqrt, D2& rj, uint32_t& /*term*/) { btab_t xvals = nt2::cons<r_type>(1.6206284795015669e-002, // m = 3 5.3873532631381268e-002, // m = 4 1.1352802267628663e-001, // m = 5 1.8662860613541296e-001, // m = 6 2.6429608311114350e-001 // m = 7 ); ctab_t t = a0; uint32_t k = 0, p = 0; uint32_t n = nt2::size(t, 1); uint32_t m = 0; while (true) { r_type normdiff = nt2::mnorm1(t-eye(n, meta::as_<value_type>())); if (normdiff <= xvals(end_)) { ++p; BOOST_AUTO_TPL( tj1, nt2::find(nt2::le(normdiff, xvals))); uint32_t j1 = tj1(1)+2; normdiff /= 2; BOOST_AUTO_TPL( tj2, nt2::find(nt2::le(normdiff, xvals))); uint32_t j2 = tj2(1)+2; if ((j1-j2 < 2) || (p == 2)) { m = j1; break; } } if (k == maxsqrt) { m = 16; break; } sqrtm_tri(t); ++k; } logm_pf(t-eye(n, meta::as_<cplx_type>()),m, rj); rj *= r_type(twopower(k)); } template < class T > static inline void sqrtm_tri( T& t ) { uint32_t n = nt2::size(t, 1); ctab_t r = nt2::zeros(nt2::of_size(n, n), meta::as_<cplx_type>()); for (uint32_t j=1; j <= n; ++j) { r(j,j) = nt2::sqrt(t(j,j)); for(uint32_t i=j-1; i >= 1; --i) { r(i,j) = t(i,j); if (i+1 <= j-1) { ctab_t z1 = r(i,nt2::_(i+1, j-1)); ctab_t z2 = r(nt2::_(i+1, j-1),j); ctab_t z3 = mtimes(z1, z2); r(i, j) -= z3; } r(i,j) /= (r(i,i) + r(j,j)); } } t = r; } template < class D, class S > static inline void logm_pf(const D& a0, uint32_t m, S& s) { // LOGM_PF Pade approximation to matrix log by partial fraction expansion. // LOGM_PF(A,m) is an [m/m] Pade approximant to LOG(EYE(SIZE(A))+A). uint32_t n = nt2::size(a0, 1); btab_t nodes, wts; gauss_legendre(m, nodes, wts); // Convert from [-1,1] to [0,1]. nodes = oneplus(nodes)/nt2::Two<r_type>(); wts /= Two<r_type>(); s = zeros(n, meta::as_<cplx_type>()); ctab_t p(nt2::of_size(n, n)); for(uint32_t j=1; j <= m; ++j) { p = trans(linsolve(trans(eye(n, meta::as_<r_type>())+nodes(j)*a0), trans(a0))); s += wts(j)*p; } } template < class X, class W > static inline void gauss_legendre( uint32_t n, X& x, W& w ) { //gauss_legendre nodes and weights for gauss-legendre quadrature. // gauss_legendre(n, x, w) computes the nodes x and weights w // for n-point gauss-legendre quadrature. //<NAME> and <NAME>, calculation of gauss quadrature //rules, math. comp., 23(106):221-230, 1969. BOOST_AUTO_TPL(i, nt2::_(nt2::One<r_type>(), r_type(n-1))); btab_t v = i/nt2::sqrt(nt2::minusone(nt2::sqr(nt2::Two<r_type>()*i))); btab_t vv; nt2::tie(x, vv) = nt2::symeig(from_diag(v,-1)+from_diag(v,1), nt2::vector_); w = nt2::Two<r_type>()*nt2::trans(nt2::sqr(vv(1,nt2::_))); } }; } } #endif <|start_filename|>modules/core/optimization/include/nt2/optimization/functions/details/nelder_impl.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_OPTIMIZATION_FUNCTIONS_DETAILS_NELDER_IMPL_HPP_INCLUDED #define NT2_OPTIMIZATION_FUNCTIONS_DETAILS_NELDER_IMPL_HPP_INCLUDED #include <nt2/include/functions/numel.hpp> #include <nt2/include/functions/inbtrue.hpp> #include <nt2/include/functions/globalmin.hpp> #include <nt2/include/functions/globalmax.hpp> #include <nt2/include/functions/global.hpp> #include <nt2/include/functions/center.hpp> #include <nt2/include/functions/asum2.hpp> #include <nt2/include/functions/rowvect.hpp> #include <nt2/include/functions/colvect.hpp> #include <nt2/include/constants/one.hpp> #include <nt2/include/constants/two.hpp> #include <nt2/include/constants/half.hpp> #include <nt2/include/constants/eps.hpp> #include <nt2/core/container/table/table.hpp> #include <nt2/core/container/colon/colon.hpp> #include <nt2/optimization/options.hpp> namespace nt2 { namespace details { template<class T, typename FLOAT = typename T::value_type > class nelder_impl { // sum(fvec^2) is minimized. public : typedef FLOAT float_t; // typedef typename meta::as_logical<float_t>::type bool_t; typedef ptrdiff_t bool_t; typedef T array_t; typedef nt2::container::table<FLOAT> table_t; typedef nt2::container::table<bool_t> btable_t; typedef details::optimization_settings<float_t> otype; nelder_impl() : reqmin(Eps<float_t>()), ynewlo(Nan<float_t>()), konvge(10), icount(0), numres(0), ifault(-1) {} ~nelder_impl() {} template < class FUNC, class S> void optimize( const FUNC& crit, T &start, //unkowns init values const S & steps, //unkowns initial step values const otype & o); //options size_t nbiteration() const { return icount; } float_t lasteval() const { return ynewlo; } bool convok() const { return ifault == 0; } private : float_t reqmin; float_t ynewlo; size_t konvge, icount, numres; ptrdiff_t ifault; }; template<typename T, typename FLOAT> template < class FUNC, class S> void nelder_impl<T, FLOAT>::optimize( const FUNC& fn, T &start, const S & step, const otype& o) { float_t ccoeff, ecoeff, eps, rcoeff; size_t n = numel(start); icount = 0; numres = 0; ifault = 0; ccoeff = Half<float_t>(); ecoeff = Two <float_t>(); eps = float_t(0.001); rcoeff = One<float_t>(); reqmin = o.absolute_tolerance; size_t kcount = o.maximum_iterations; ptrdiff_t jcount = konvge; float_t dn = n; size_t nn = n + 1; float_t del = One<float_t>(); float_t rq = reqmin * dn; table_t p(nt2::of_size(n, nn)); table_t xmin = start; table_t y(nt2::of_size(1, nn)); for(;;) { p(nt2::_, nn) = start; y(nn) = fn ( start ); ++icount; for(size_t j = 1; j <= n; ++j) { float_t x = start(j); start(j) += step(j) * del; p(_, j) = nt2::colvect(start); y(j) = fn ( start ); ++icount; start(j) = x; } // The simplex construction is complete. // Find highest and lowest y values. ynewlo = y(ihi) indicates // the vertex of the simplex to be replaced. size_t ilo; float_t ylo = globalmin(y, ilo); for(;;)// Inner loop. { if ( kcount <= icount ) break; size_t ihi = 1; ynewlo = globalmax(y, ihi); // calculate pbar, the centroid of the simplex vertices // excepting the vertex with y value ynewlo. table_t pbar = (sum(p, 2) - p(_,ihi))/dn; // Reflection through the centroid. table_t pstar = pbar + rcoeff*(pbar-p(_, ihi)); float_t ystar = fn ( pstar ); ++icount; // Successful reflection, so extension. if ( ystar < ylo ) { table_t p2star = pbar + ecoeff * ( pstar - pbar ); float_t y2star = fn ( p2star ); ++icount; if ( ystar < y2star )// Check extension. { p(_, ihi) = pstar; y(ihi) = ystar; } // Retain extension or contraction. else { p(_, ihi) = p2star; y(ihi) = y2star; } } else // No extension. { size_t l = inbtrue(lt(ystar, y)); if ( l > 1 ) { p(_, ihi) = pstar; y(ihi) = ystar; } else if ( l == 0 ) //% Contraction on the Y(IHI) side of the centroid. { table_t p2star = pbar + ccoeff * ( p(_,ihi) - pbar ); float_t y2star = fn ( p2star ); ++icount; if ( y(ihi) < y2star ) // Contract the whole simplex. { for(size_t j = 1; j <= nn; ++j) { for(size_t i = 1; i <= n; ++i) { p(i,j) = ( p(i,j) + p(i,ilo) ) * Half<float_t>(); xmin(i) = p(i,j); } y(j) = fn ( xmin ); ++icount; } ylo = globalmin(y, ilo); continue; } else // Retain contraction. { p(_, ihi) = p2star; y(ihi) = y2star; } } else if ( l == 1 ) //% Contraction on the reflection side of the centroid. { table_t p2star = pbar + ccoeff * ( pstar - pbar ); float_t y2star = fn ( p2star ); ++icount; if ( y2star <= ystar ) //% Retain reflection? { p(_,ihi) = p2star; y(ihi) = y2star; } else { p(_,ihi) = pstar; y(ihi) = ystar; } } } if ( y(ihi) < ylo ) // Check if YLO improved. { ylo = y(ihi); ilo = ihi; } --jcount; if (jcount > 0) continue; if ( icount <= kcount ) //% Check to see if minimum reached. { jcount = konvge; float_t z = nt2::global(nt2::functor<nt2::tag::asum2_>(), nt2::center(y)); if ( z <= rq ) break; } } // Factorial tests to check that YNEWLO is a local minimum. xmin = p(_, ilo); ynewlo = y(ilo); if ( kcount < icount ) { ifault = 2; break; } ifault = 0; for(size_t i = 1; i <= n; ++i) { del = step(i) * eps; xmin(i) = xmin(i) + del; float_t z = fn ( xmin ); ++icount; if ( z < ynewlo ) { ifault = 2; break; } xmin(i) -= del + del; z = fn ( xmin ); ++icount; if ( z < ynewlo ) { ifault = 2; break; } xmin(i) += del; } if ( ifault == 0 ) break; //% Restart the procedure. start = nt2::rowvect(xmin); del = eps; ++numres; } return; } } } #endif <|start_filename|>modules/core/sdk/include/nt2/dsl/functions/evaluate.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2011 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2011 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_DSL_FUNCTIONS_EVALUATE_HPP_INCLUDED #define NT2_DSL_FUNCTIONS_EVALUATE_HPP_INCLUDED #include <boost/simd/dsl/functions/evaluate.hpp> #include <nt2/include/functor.hpp> namespace nt2 { namespace tag { /*! \brief Same as \classref{boost::simd::tag::evaluate_} **/ struct evaluate_ : boost::simd::tag::evaluate_ { typedef boost::simd::tag::evaluate_ parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_evaluate_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::evaluate_, Site> dispatching_evaluate_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::evaluate_, Site>(); } template<class... Args> struct impl_evaluate_; } /*! \brief Same as \funcref{boost::simd::evaluate} **/ template<class A0, class... Args> BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE evaluate(A0&& a0, Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_evaluate_( ext::adl_helper(), boost::dispatch::default_site_t<A0>(), boost::dispatch::meta::hierarchy_of_t<A0&&>(), boost::dispatch::meta::hierarchy_of_t<Args&&>()... )(static_cast<A0&&>(a0), static_cast<Args&&>(args)...) ) } #endif <|start_filename|>modules/core/polynomials/include/nt2/polynomials/functions/tchebeval.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_POLYNOMIALS_FUNCTIONS_TCHEBEVAL_HPP_INCLUDED #define NT2_POLYNOMIALS_FUNCTIONS_TCHEBEVAL_HPP_INCLUDED #include <nt2/include/functor.hpp> namespace nt2 { namespace tag { struct tchebeval_ : ext::elementwise_<tchebeval_> { typedef ext::elementwise_<tchebeval_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_tchebeval_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::tchebeval_, Site> dispatching_tchebeval_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::tchebeval_, Site>(); } template<class... Args> struct impl_tchebeval_; } NT2_FUNCTION_IMPLEMENTATION(tag::tchebeval_, tchebeval, 2) } #endif // modified by jt the 25/12/2010 <|start_filename|>modules/core/elliptic/include/nt2/elliptic/functions/ellipke.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_ELLIPTIC_FUNCTIONS_ELLIPKE_HPP_INCLUDED #define NT2_ELLIPTIC_FUNCTIONS_ELLIPKE_HPP_INCLUDED #include <nt2/include/functor.hpp> namespace nt2 { namespace tag { /// @brief Hierarchy tag for ellipke function struct ellipke_ : ext::elementwise_<ellipke_> { typedef ext::elementwise_<ellipke_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_ellipke_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::ellipke_, Site> dispatching_ellipke_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::ellipke_, Site>(); } template<class... Args> struct impl_ellipke_; } /*! Computes simultaneously the complete elliptic integral of the first and second kinds. @par Semantic: @code T0 k, e; tie(k, e)= ellipke(x); @endcode is similar to: @code T0 k = ellpk(1-x); T0 e = ellpe(1-x); @endcode @see @funcref{ellint_1}, @funcref{ellint_2} @param a0 angle in radian @return A Fusion Sequence containing the sin and cos of @c a0 **/ NT2_FUNCTION_IMPLEMENTATION(tag::ellipke_, ellipke, 1) /*! Computes simultaneously the complete elliptic integral of the first and second kinds. @par Semantic: @code T0 k, e; k = ellipke(x, e); @endcode is similar to: @code T0 k = ellpk(1-x); T0 e = ellpe(1-x); @endcode @see @funcref{ellint_1}, @funcref{ellint_2} @param a0 outside of \f$[0,1]\f$ the result is nan @param a1 accuracy of computation. The default is Eps<A0>(). @return A Fusion Sequence containing the cos of @c a0 **/ NT2_FUNCTION_IMPLEMENTATION(tag::ellipke_, ellipke, 2) /*! Computes simultaneously the complete elliptic integral of the first and second kinds, and allows speed-up versus less accuracy. @par Semantic: @code T0 k, e; k = ellipke(x, t, e); @endcode @see @funcref{ellint_1}, @funcref{ellint_2} @param a0 outside of \f$[0,1]\f$ the result is nan @param a1 accuracy of computation. The default is Eps<A0>(). @param a2 L-Value that will receive the second kind elliptic integral @return the first kind elliptic integral **/ NT2_FUNCTION_IMPLEMENTATION_TPL(tag::ellipke_, ellipke,(A0 const&)(A1 const&)(A2&),3) /*! Computes simultaneously the complete elliptic integral of the first and second kinds, and allows speed-up versus less accuracy. @par Semantic: @code T0 k, e; ellipke(x, t, k, e); @endcode @see @funcref{ellint_1}, @funcref{ellint_2} @param a0 outside of \f$[0,1]\f$ the result is nan @param a1 accuracy of computation. The default is Eps<A0>(). @param a2 L-Value that will receive the first kind elliptic integral @param a3 L-Value that will receive the second kind elliptic integral **/ NT2_FUNCTION_IMPLEMENTATION_TPL(tag::ellipke_, ellipke,(A0 const&)(A1 const&)(A2&)(A3&),4) } #endif <|start_filename|>modules/arch/cuda/cmake/nt2.arch.cuda.dependencies.cmake<|end_filename|> ################################################################################ # Copyright 2003 & onward LASMEA UMR 6602 CNRS/Univ. Clermont II # Copyright 2009 & onward LRI UMR 8623 CNRS/Univ Paris Sud XI # # Distributed under the Boost Software License, Version 1.0. # See accompanying file LICENSE.txt or copy at # http://www.boost.org/LICENSE_1_0.txt ################################################################################ find_package(CUDA) IF(CUDA_FOUND) set(NT2_ARCH.CUDA_COMPILE_FLAGS "-DNT2_HAS_CUDA") set(CUBLAS_LIBRARY ${CUDA_CUBLAS_LIBRARIES}) set(CUDART_LIBRARY ${CUDA_CUDART_LIBRARY}) set(CUBLAS_HEADER ${CUDA_INCLUDE_DIRS}) set(NT2_ARCH.CUDA_DEPENDENCIES_INCLUDE_DIR ${CUDA_INCLUDE_DIRS}) set(NT2_ARCH.CUDA_DEPENDENCIES_LIBRARIES ${CUDA_CUDART_LIBRARY} ${CUBLAS_LIBRARY}) ENDIF(CUDA_FOUND) set(NT2_ARCH.CUDA_DEPENDENCIES_FOUND ${CUDA_FOUND}) set( NT2_ARCH.CUDA_DEPENDENCIES_EXTRA boost.dispatch boost.simd.base core.base core.container.table core.exponential core.generative core.linalg core.reduction core.restructuring core.sdk ) <|start_filename|>modules/core/generative/include/nt2/core/functions/freqspace.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2014 LRI UMR 8623 CNRS/Univ Paris Sud XI // Copyright 2011 - 2014 NumScale SAS // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_CORE_FUNCTIONS_FREQSPACE_HPP_INCLUDED #define NT2_CORE_FUNCTIONS_FREQSPACE_HPP_INCLUDED #include <nt2/include/functor.hpp> #include <nt2/sdk/meta/boxed_size.hpp> #include <nt2/core/container/dsl/size.hpp> #include <nt2/core/container/dsl/value_type.hpp> #include <nt2/sdk/meta/tieable_hierarchy.hpp> #include <nt2/generative/options.hpp> namespace nt2 { namespace tag { /*! @brief Tag for the freqspace functor **/ struct freqspace_ : ext::tieable_<freqspace_> { typedef ext::tieable_<freqspace_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_freqspace_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::freqspace_, Site> dispatching_freqspace_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::freqspace_, Site>(); } template<class... Args> struct impl_freqspace_; } /*! @brief Frequency spacing for frequency responses. freqspace returns the implied frequency range for equally spaced frequency responses. @par 1D Semantic: For any integral @c N : @code f = freqspace(N); @endcoe returns the one-dimensional frequency vector @c f assuming @c N evenly spaced points around the unit circle. It is equivalent to: @code f = _(0,2/N,1); @endcode For any integral @c N : @code tie(f1,f2) = freqspace(N); @endcoe returns the two-dimensional frequency vectors @c f1 and @c f2 for an N-by-N matrix. For N odd, it is equivalent to : @code f1 = f2 = _(-N+1,2,N-1); @endcode For N even, it is equivalent to: @code f1 = f2 = _(-N,2,N-2); @endcode For any integral @c N : @code f = freqspace(N,whole_); @endcode is equivalent to : @code f = _(0,2/N,2*(N-1)/N); @endcode @par 2D Semantic: For any 2 dimensions size <tt>S = [m n]</tt>: @code tie(f1,f2) = freqspace(S); @endcode returns the two-dimensional frequency vectors @c f1 and @c f2 for an m-by-n matrix. [x1,y1] = freqspace(...,'meshgrid') is equivalent to [f1,f2] = freqspace(...); [x1,y1] = meshgrid(f1,f2); **/ NT2_FUNCTION_IMPLEMENTATION(nt2::tag::freqspace_, freqspace, 3) /// @overload NT2_FUNCTION_IMPLEMENTATION(nt2::tag::freqspace_, freqspace, 2) /// @overload NT2_FUNCTION_IMPLEMENTATION(nt2::tag::freqspace_, freqspace, 1) } namespace nt2 { namespace ext { template<class Domain, int N, class Expr> struct size_of<tag::freqspace_,Domain,N,Expr> : meta::boxed_size<Expr,0> {}; template<class Domain, int N, class Expr> struct value_type<tag::freqspace_,Domain,N,Expr> { typedef typename boost::proto::result_of::child_c<Expr&,1>::value_type c_t; typedef typename boost::proto::result_of::value<c_t>::value_type t_t; typedef typename t_t::type type; }; } } #endif <|start_filename|>modules/core/restructuring/include/nt2/core/functions/vertcat.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2011 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2011 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_CORE_FUNCTIONS_VERTCAT_HPP_INCLUDED #define NT2_CORE_FUNCTIONS_VERTCAT_HPP_INCLUDED #include <nt2/include/functor.hpp> namespace nt2 { namespace tag { /*! @brief vertcat generic tag Represents the vertcat function in generic contexts. @par Models: Hierarchy **/ struct vertcat_ : ext::abstract_<vertcat_> { typedef ext::abstract_<vertcat_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_vertcat_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::vertcat_, Site> dispatching_vertcat_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::vertcat_, Site>(); } template<class... Args> struct impl_vertcat_; } /*! Vertical concatenation @par Semantic: For every parameter of type T0 @code T0 r = vertcat(a0); @endcode is similar to: @code auto r = cat(1, a0, a1); @endcode @see @funcref{horzcat}, @funcref{cat} @par alias: @c catv @param a0 @param a1 @return an expression which eventually will evaluate to the result **/ NT2_FUNCTION_IMPLEMENTATION(nt2::tag::vertcat_, vertcat, 2) /// INTERNAL ONLY NT2_FUNCTION_IMPLEMENTATION(nt2::tag::vertcat_, vertcat, 1) /// INTERNAL ONLY NT2_FUNCTION_IMPLEMENTATION(nt2::tag::vertcat_, catv, 1) /// INTERNAL ONLY NT2_FUNCTION_IMPLEMENTATION(nt2::tag::vertcat_, catv, 2) } #endif <|start_filename|>modules/core/reduction/include/nt2/core/functions/globalnormp.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // Copyright 2011 - 2012 MetaScale SAS // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_CORE_FUNCTIONS_GLOBALNORMP_HPP_INCLUDED #define NT2_CORE_FUNCTIONS_GLOBALNORMP_HPP_INCLUDED #include <nt2/include/functor.hpp> namespace nt2 { namespace tag { /*! @brief Tag for the globalnormp functor **/ struct globalnormp_ : ext::abstract_<globalnormp_> { /// @brief Parent hierarchy typedef ext::abstract_<globalnormp_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_globalnormp_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::globalnormp_, Site> dispatching_globalnormp_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::globalnormp_, Site>(); } template<class... Args> struct impl_globalnormp_; } /*! @brief Sum of the p power of absolute values of table to 1/p Computes the 1/p power of the sum of the pth power of the absolute value of all the elements of a table expression: the \f$l_p\f$ norm @par Semantic For any table expression @c t of T and any arithmetic value @c p: @code T r = globalnormp(t,p); @endcode is equivalent to: @code T r = normp(t(_),p)); @endcode @par Note: n default to firstnonsingleton(t) @see @funcref{colon}, @funcref{normp} @param a0 Table to process @param a1 Power at which absolute values are raised @return An expression eventually evaluated to the result **/ NT2_FUNCTION_IMPLEMENTATION(nt2::tag::globalnormp_, globalnormp, 2) } #endif <|start_filename|>modules/core/trigonometric/include/nt2/trigonometric/functions/cospi.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_TRIGONOMETRIC_FUNCTIONS_COSPI_HPP_INCLUDED #define NT2_TRIGONOMETRIC_FUNCTIONS_COSPI_HPP_INCLUDED #include <nt2/include/functor.hpp> namespace nt2 { namespace tag { /*! @brief cospi generic tag Represents the cospi function in generic contexts. @par Models: Hierarchy **/ struct cospi_ : ext::elementwise_<cospi_> { /// @brief Parent hierarchy typedef ext::elementwise_<cospi_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_cospi_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::cospi_, Site> dispatching_cospi_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::cospi_, Site>(); } template<class... Args> struct impl_cospi_; } /*! cosine of angle in \f$\pi\f$ multiples. @par Semantic: For every parameter of floating type T0 @code T0 r = cospi(x); @endcode is similar to: @code T0 r = cos(Pi<T0>()*x);; @endcode @see @funcref{fast_cospi}, @funcref{sincospi}, @funcref{cos}, @funcref{cosd} @param a0 @return a value of the same type as the parameter **/ NT2_FUNCTION_IMPLEMENTATION(tag::cospi_, cospi, 1) } #endif <|start_filename|>modules/boost/simd/base/include/boost/simd/ieee/functions/ulpdist.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef BOOST_SIMD_IEEE_FUNCTIONS_ULPDIST_HPP_INCLUDED #define BOOST_SIMD_IEEE_FUNCTIONS_ULPDIST_HPP_INCLUDED #include <boost/simd/include/functor.hpp> #include <boost/dispatch/include/functor.hpp> namespace boost { namespace simd { namespace tag { /*! @brief ulpdist generic tag Represents the ulpdist function in generic contexts. @par Models: Hierarchy **/ struct ulpdist_ : ext::elementwise_<ulpdist_> { /// @brief Parent hierarchy typedef ext::elementwise_<ulpdist_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_ulpdist_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::ulpdist_, Site> dispatching_ulpdist_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::ulpdist_, Site>(); } template<class... Args> struct impl_ulpdist_; } /*! Returns ulp distance of the two values. @par Semantic: @code T r = ulpdist(a0,a1); @endcode is similar to: @code T r = abs(x-y)/Eps<T>(); @endcode @par Note: If the common type is integer it is the same as @c dist If the common type is floating point the ulpdist is is computed, by the above described method. It is often difficult to answer to the following question: "are these two floating computations results similar enough?". The ulpdist is a way to answer which is tuned for relative errors estimations and peculiarly adapted to cope with the limited bits accuracy of floating point representations. The method is the following: - Properly normalize the two numbers by the same factor in a way that the largest of the two numbers exponents will be brought to zero -Return the absolute difference of these normalized numbers divided by the rounding error Eps The roundind error is the ulp (unit in the last place) value, i.e. the floating number, the exponent of which is 0 and the mantissa is all zeros but a 1 in the last digit (it is not hard coded that way however). This means \f$2^-23\f$ for float and \f$2^-52\f$ for double. \arg For instance if two floating numbers (of same type) have an ulpdist of zero that means that their floating representation are identical. \arg Generally equality up to 0.5 ulp is the best that one can wish beyond strict equality. @par Examples: \arg Typically if a double is compared to the float representation of its floating conversion (they are exceptions as for fully representable reals) the ulpdist will be around 2^26.5 (~10^8) The ulpdist is also roughly equivalent to the number of representable floating points values between two given floating points values. \arg @c ulpdist(1.0,1+Eps\<double\>())==0.5 \arg @c ulpdist(1.0,1+Eps\<double\>()/2)==0.0 \arg @c ulpdist(1.0,1-Eps\<double\>()/2)==0.25 \arg @c ulpdist(1.0,1-Eps\<double\>())==0.5 \arg @c ulpdist(double(Pi\<float\>()),Pi\<double\>())==9.84293e+07 @see @funcref{ulp}, @funcref{Eps}, @funcref{eps} @param a0 @param a1 @return a value of same type as the inputs **/ BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::ulpdist_, ulpdist, 2) } } #endif <|start_filename|>modules/boost/simd/base/include/boost/simd/constant/constants/mzero.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2011 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2011 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef BOOST_SIMD_CONSTANT_CONSTANTS_MZERO_HPP_INCLUDED #define BOOST_SIMD_CONSTANT_CONSTANTS_MZERO_HPP_INCLUDED #include <boost/simd/include/functor.hpp> #include <boost/simd/constant/register.hpp> #include <boost/simd/constant/hierarchy.hpp> namespace boost { namespace simd { namespace tag { /*! @brief Mzero generic tag Represents the Mzero constant in generic contexts. @par Models: Hierarchy **/ BOOST_SIMD_CONSTANT_REGISTER( Mzero, double, 0 , 0x80000000, 0x8000000000000000ULL ) } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::Mzero, Site> dispatching_Mzero(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::Mzero, Site>(); } template<class... Args> struct impl_Mzero; } /*! Generates value -0 @par Semantic: @code T r = Mzero<T>(); @endcode is similar to: @code T r = -T(0); @endcode @ par Note: This is a special constant as it can be used and considered identical to zero, except that for floating point numbers, there is two different representation of zero with different bit of sign. The existence of the sign can be used in special circumstances as choosing between \f$+\infty\f$ and \f$-\infty\f$ instead of nan in computing 1/0. \par The sign of zero can be accessed through the @c is_negative and @c is_positive predicates or the @funcref{boost::simd::bitofsign} function. **/ BOOST_SIMD_CONSTANT_IMPLEMENTATION(boost::simd::tag::Mzero, Mzero) } } #include <boost/simd/constant/common.hpp> #endif <|start_filename|>modules/boost/simd/base/include/boost/simd/constant/constants/sqrtvalmax.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2011 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2011 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef BOOST_SIMD_CONSTANT_CONSTANTS_SQRTVALMAX_HPP_INCLUDED #define BOOST_SIMD_CONSTANT_CONSTANTS_SQRTVALMAX_HPP_INCLUDED #include <boost/simd/include/functor.hpp> #include <boost/simd/constant/register.hpp> #include <boost/simd/constant/hierarchy.hpp> namespace boost { namespace simd { namespace tag { /*! @brief Sqrtvalmax generic tag Represents the Sqrtvalmax constant in generic contexts. @par Models: Hierarchy **/ struct Sqrtvalmax : ext::pure_constant_<Sqrtvalmax> { typedef double default_type; typedef ext::pure_constant_<Sqrtvalmax> parent; /// INTERNAL ONLY template<class Target, class Dummy=void> struct apply : meta::int_c < typename Target::type , typename Target:: type( (typename Target::type(1) << (sizeof(typename Target::type)*CHAR_BIT/2))-1 ) > {}; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_Sqrtvalmax( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; /// INTERNAL ONLY template<class T, class Dummy> struct Sqrtvalmax::apply< boost::dispatch::meta::single_<T>,Dummy> : meta::single_<0x5f800000> {}; /// INTERNAL ONLY template<class T, class Dummy> struct Sqrtvalmax::apply<boost::dispatch::meta::double_<T>,Dummy> : meta::double_<0x5ff0000000000001ll> {}; /// INTERNAL ONLY template<class T, class Dummy> struct Sqrtvalmax::apply<boost::dispatch::meta::int8_<T>,Dummy> : meta::int_c<T, 11> {}; /// INTERNAL ONLY template<class T, class Dummy> struct Sqrtvalmax::apply<boost::dispatch::meta::int16_<T>,Dummy> : meta::int_c<T, 181> {}; /// INTERNAL ONLY template<class T, class Dummy> struct Sqrtvalmax::apply<boost::dispatch::meta::int32_<T>,Dummy> : meta::int_c<T, 46340> {}; /// INTERNAL ONLY template<class T, class Dummy> struct Sqrtvalmax::apply<boost::dispatch::meta::int64_<T>,Dummy> : meta::int_c<T, 3037000499ll> {}; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::Sqrtvalmax, Site> dispatching_Sqrtvalmax(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::Sqrtvalmax, Site>(); } template<class... Args> struct impl_Sqrtvalmax; } /*! Generates the square root of the greatest finite representable value @par Semantic: @code T r = Sqrtvalmax<T>(); @endcode is similar to: @code T r = sqrt(Valmax<T>(); @endcode **/ BOOST_SIMD_CONSTANT_IMPLEMENTATION(boost::simd::tag::Sqrtvalmax, Sqrtvalmax) } } #include <boost/simd/constant/common.hpp> #endif <|start_filename|>modules/core/reduction/include/nt2/core/functions/globalnorm2.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // Copyright 2011 - 2012 MetaScale SAS // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_CORE_FUNCTIONS_GLOBALNORM2_HPP_INCLUDED #define NT2_CORE_FUNCTIONS_GLOBALNORM2_HPP_INCLUDED #include <nt2/include/functor.hpp> #include <nt2/include/functions/norm2.hpp> #include <nt2/include/functions/global.hpp> namespace nt2 { namespace tag { /*! @brief Tag for the globalnorm2 functor **/ struct globalnorm2_ : ext::abstract_<globalnorm2_> { /// @brief Parent hierarchy typedef ext::abstract_<globalnorm2_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_globalnorm2_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::globalnorm2_, Site> dispatching_globalnorm2_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::globalnorm2_, Site>(); } template<class... Args> struct impl_globalnorm2_; } /*! @brief euclidian norm of a whole table expression elements @par Semantic For any table expression of T @c t integer or weights w and any integer @c n: @code T r = globalnorm2(t); @endcode is equivalent to: if w is an integer @code T r = norm2(t(_))(1); @endcode @par Note: n default to firstnonsingleton(t) @par alias: norm_eucl @see @funcref{firstnonsingleton}, @funcref{norm2} @param a0 Table to process @return An expression eventually evaluated to the result **/ NT2_FUNCTION_IMPLEMENTATION(nt2::tag::globalnorm2_, globalnorm2, 1) } namespace nt2 { namespace ext { /// INTERNAL ONLY BOOST_DISPATCH_IMPLEMENT ( globalnorm2_, tag::cpu_ , (A0) , (unspecified_<A0>) ) { typedef typename meta::call<tag::global_( nt2::functor<tag::norm2_> , const A0& )>::type result_type; BOOST_FORCEINLINE result_type operator()(A0 const& a0) const { return global(nt2::functor<tag::norm2_>(), a0); } }; } } #endif <|start_filename|>modules/boost/simd/base/include/boost/simd/swar/functions/interleave_even.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef BOOST_SIMD_SWAR_FUNCTIONS_INTERLEAVE_EVEN_HPP_INCLUDED #define BOOST_SIMD_SWAR_FUNCTIONS_INTERLEAVE_EVEN_HPP_INCLUDED #include <boost/simd/include/functor.hpp> #include <boost/dispatch/include/functor.hpp> namespace boost { namespace simd { namespace tag { /*! @brief interleave_even generic tag Represents the interleave_even function in generic contexts. @par Models: Hierarchy **/ struct interleave_even_ : ext::unspecified_<interleave_even_> { /// @brief Parent hierarchy typedef ext::unspecified_<interleave_even_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_interleave_even_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::interleave_even_, Site> dispatching_interleave_even_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::interleave_even_, Site>(); } template<class... Args> struct impl_interleave_even_; } /*! Computes a vector from a combination of the two inputs. @par Semantic: For every parameters of types respectively T0: @code T0 r = interleave_even(a,b); @endcode is equivalent to : @code r = [ a[0] b[0] a[2] b[2] ... a[n/2] b[n/2] ] @endcode with <tt> n = cardinal_of<T>::value </tt> @param a0 First vector to interleave @param a1 Second vector to interleave @return a value of the same type as the parameters **/ BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::interleave_even_, interleave_even, 2) } } #endif <|start_filename|>modules/core/combinatorial/include/nt2/combinatorial/functions/lcm.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_COMBINATORIAL_FUNCTIONS_LCM_HPP_INCLUDED #define NT2_COMBINATORIAL_FUNCTIONS_LCM_HPP_INCLUDED #include <nt2/include/functor.hpp> namespace nt2 { namespace tag { /*! @brief lcm generic tag Represents the lcm function in generic contexts. @par Models: Hierarchy **/ struct lcm_ : ext::elementwise_<lcm_> { /// @brief Parent hierarchy typedef ext::elementwise_<lcm_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_lcm_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::lcm_, Site> dispatching_lcm_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::lcm_, Site>(); } template<class... Args> struct impl_lcm_; } /*! Computes the least common multiple If parameters are floating point and not flint, nan is returned. @par Semantic: For every table expressions @code auto r = lcm(a0,a1); @endcode - If any input is zero 0 is returned - If parameters are floating point and not flint, nan is returned. @see @funcref{gcd}, @funcref{is_flint} @param a0 @param a1 @return an expression which eventually will evaluate to the result **/ NT2_FUNCTION_IMPLEMENTATION(tag::lcm_, lcm, 2) } #endif <|start_filename|>modules/core/base/include/nt2/predicates/functions/ishermitian.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // Copyright 2011 - 2012 MetaScale SAS // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_PREDICATES_FUNCTIONS_ISHERMITIAN_HPP_INCLUDED #define NT2_PREDICATES_FUNCTIONS_ISHERMITIAN_HPP_INCLUDED /*! @file @brief Defines the ishermitian function **/ #include <nt2/include/functor.hpp> namespace nt2 { namespace tag { /*! @brief Tag for ishermitian functor **/ struct ishermitian_ : ext::abstract_<ishermitian_> { typedef ext::abstract_<ishermitian_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_ishermitian_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::ishermitian_, Site> dispatching_ishermitian_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::ishermitian_, Site>(); } template<class... Args> struct impl_ishermitian_; } /*! @brief Is an expression hermitian ? Checks if an expression is an hermitian matrix. @param a0 Expression to inspect @return Boolean value evaluating to the result of the test **/ NT2_FUNCTION_IMPLEMENTATION(nt2::tag::ishermitian_, ishermitian, 1) } #endif <|start_filename|>modules/boost/simd/base/include/boost/simd/swar/functions/split_high.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef BOOST_SIMD_SWAR_FUNCTIONS_SPLIT_HIGH_HPP_INCLUDED #define BOOST_SIMD_SWAR_FUNCTIONS_SPLIT_HIGH_HPP_INCLUDED #include <boost/simd/include/functor.hpp> #include <boost/dispatch/include/functor.hpp> namespace boost { namespace simd { namespace tag { /*! @brief split_high generic tag Represents the split_high function in generic contexts. @par Models: Hierarchy **/ struct split_high_ : ext::unspecified_<split_high_> { /// @brief Parent hierarchy typedef ext::unspecified_<split_high_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_split_high_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::split_high_, Site> dispatching_split_high_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::split_high_, Site>(); } template<class... Args> struct impl_split_high_; } /*! @brief SIMD register type-based split_high @c split_high extract the higher half of a SIMD register and convert it to the appropriate SIMD register type of corresponding cardinal. @see split_low, split, slice @param a0 Value to process @return THe higher half of a0 converted to the appropriate SIMD type **/ BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::split_high_, split_high, 1) } } #endif <|start_filename|>modules/core/generative/include/nt2/core/functions/fill_pattern.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // Copyright 2011 - 2012 MetaScale SAS // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_CORE_FUNCTIONS_FILL_PATTERN_HPP_INCLUDED #define NT2_CORE_FUNCTIONS_FILL_PATTERN_HPP_INCLUDED #include <nt2/include/functor.hpp> #include <nt2/sdk/meta/value_as.hpp> #include <nt2/sdk/meta/boxed_size.hpp> #include <nt2/core/container/dsl/size.hpp> #include <nt2/core/container/dsl/value_type.hpp> namespace nt2 { namespace tag { /*! @brief fill_pattern generic tag Represents the fill_pattern function in generic contexts. @par Models: Hierarchy **/ struct fill_pattern_ : ext::elementwise_<fill_pattern_> { /// @brief Parent hierarchy typedef ext::elementwise_<fill_pattern_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_fill_pattern_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::fill_pattern_, Site> dispatching_fill_pattern_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::fill_pattern_, Site>(); } template<class... Args> struct impl_fill_pattern_; } #if defined(DOXYGEN_ONLY) /*! @brief Pattern generator Create an array made of a linear repetition of a given pattern matrix. @par Semantic: fill_pattern semantic depends of its parameters type and quantity: - For any Expression @c p and any Integer @c sz1,...,szn , the following code: @code auto x = fill_pattern(p, sz1,...,szn); @endcode generates an expression that evaluates as a @sizes{sz1,szn} table where, for any indexes @c i, <tt>x(i) = p(i%numel(p))</tt>. - For any Expression @c p and any Expression @c dims evaluating as a row vector of @c N elements, the following code: @code auto x = fill_pattern(p, dims); @endcode generates an expression that evaluates as a @sizes{dims(1),dims(N)} table where, for any indexes @c i, <tt>x(i) = p(i%numel(p))</tt>. - For any Expression @c p and any Fusion Sequence @c dims of @c N elements, the following code: @code auto x = fill_pattern(p, dims); @endcode generates an expression that evaluates as a @sizes{at_c<1>(dims),at_c<N-1>(dims)} table where, for any indexes @c i, <tt>x(i) = p(i%numel(p))</tt>. @usage_output{fill_pattern.cpp,fill_pattern.out} @param p Data patter to repeat in the result. @param dims Size of each dimension, specified as one or more integer values or as a row vector of integer values. If any @c dims is lesser or equal to 0, then the resulting expression is empty. @return An Expression evaluating as an array of a given type and dimensions. **/ template<typename Pattern, typename... Dims> details::unspecified fill_pattern(Pattern const& p, Args const&... dims); #else #define M0(z,n,t) \ NT2_FUNCTION_IMPLEMENTATION(nt2::tag::fill_pattern_, fill_pattern, n) \ /**/ BOOST_PP_REPEAT_FROM_TO(2,BOOST_PP_INC(BOOST_PP_INC(NT2_MAX_DIMENSIONS)),M0,~) #undef M0 #endif } namespace nt2 { namespace ext { /// INTERNAL ONLY template<class Domain, int N, class Expr> struct value_type<nt2::tag::fill_pattern_,Domain,N,Expr> : meta::value_as<Expr,1> {}; /// INTERNAL ONLY template<class Domain, int N, class Expr> struct size_of<nt2::tag::fill_pattern_,Domain,N,Expr> : meta::boxed_size<Expr,0> {}; } } #endif <|start_filename|>modules/core/container/table/include/nt2/core/container/table/table.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2011 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2011 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_CORE_CONTAINER_TABLE_TABLE_HPP_INCLUDED #define NT2_CORE_CONTAINER_TABLE_TABLE_HPP_INCLUDED #include <nt2/core/container/dsl.hpp> #include <nt2/core/container/table/kind.hpp> #include <nt2/core/container/table/adapted/table.hpp> #include <nt2/include/functions/construct.hpp> #include <nt2/sdk/memory/container.hpp> // Disable the 'class : multiple assignment operators specified' warning #if defined(BOOST_MSVC) #pragma warning( push ) #pragma warning( disable : 4522 ) // multiple assignment operators specified #endif namespace nt2 { namespace container { template<typename T, typename S> struct table : expression< boost::proto::basic_expr< nt2::tag::terminal_ , boost::proto::term < nt2::memory ::container< nt2::tag::table_ , T,S> > > , nt2::memory::container<nt2::tag::table_,T,S> > { typedef nt2::memory::container<nt2::tag::table_,T,S> container_type; typedef expression< boost::proto::basic_expr< nt2::tag::terminal_ , boost::proto::term<container_type> > , container_type > nt2_expression; typedef typename container_type::pointer pointer; typedef typename container_type::const_pointer const_pointer; typedef typename container_type::iterator iterator; typedef typename container_type::const_iterator const_iterator; typedef typename container_type::allocator_type allocator_type; //========================================================================== // table default constructor //========================================================================== table() {} //========================================================================== // table constructor from its allocator //========================================================================== table( allocator_type const& a ) : nt2_expression(container_type(a)) {} //========================================================================== // table copy constructor //========================================================================== table( table const& a0 ) : nt2_expression(a0) { } //========================================================================== // table constructor from a single initializer. // This version handles initializing from of_size or expression. //========================================================================== template<typename A0> table( A0 const& a0 ) { nt2::construct(*this,a0); } //========================================================================== // table constructor from a pair of initializer. //========================================================================== template<typename A0, typename A1> table( A0 const& a0, A1 const& a1 ) { nt2::construct(*this,a0,a1); } //========================================================================== // table constructor from a triplet of initializer. // This version handles initializing from : { size, Iterator, Iterator } //========================================================================== template<typename A0, typename A1, typename A2> table( A0 const& a0, A1 const& a1, A2 const& a2 ) { nt2::construct(*this,a0,a1,a2); } //========================================================================== // Enable base expression handling of assignment //========================================================================== template<class Xpr> BOOST_FORCEINLINE typename boost::disable_if< boost::is_base_of<nt2_expression, Xpr> , table& >::type operator=(Xpr const& xpr) { nt2_expression::operator=(xpr); return *this; } BOOST_FORCEINLINE table& operator=(table const& xpr) { nt2_expression::operator=(xpr); return *this; } iterator begin() { return boost::proto::value(*this).begin(); } const_iterator begin() const { return boost::proto::value(*this).begin(); } iterator end() { return boost::proto::value(*this).end(); } const_iterator end() const { return boost::proto::value(*this).end(); } }; } } #if defined(BOOST_MSVC) #pragma warning( pop ) #endif #endif <|start_filename|>modules/arch/cuda/include/nt2/sdk/cuda/memory/buffer.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2011 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2011 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_SDK_CUDA_MEMORY_BUFFER_HPP_INCLUDED #define NT2_SDK_CUDA_MEMORY_BUFFER_HPP_INCLUDED #include <nt2/sdk/cuda/cuda.hpp> #include <cublas.h> #include <boost/throw_exception.hpp> #include <boost/assert.hpp> #include <boost/swap.hpp> #include <nt2/sdk/memory/container.hpp> #include <nt2/include/functions/resize.hpp> #include <nt2/include/functions/size.hpp> #include <limits> #define CUDA_ERROR(status) \ { \ BOOST_ASSERT_MSG( status == cudaSuccess \ , cudaGetErrorString(status)); \ } \ namespace nt2 { namespace memory { //============================================================================ /**! * @brief cuda_buffer is a dynamically-sized sequence using dynamic storage. **/ //=========================================================================== template<class T> class cuda_buffer { public: //========================================================================== // Container types //========================================================================== typedef T value_type; typedef T* pointer; typedef T const* const_pointer; typedef T* iterator; typedef T const* const_iterator; typedef T& reference; typedef T const& const_reference; typedef std::size_t size_type; typedef std::ptrdiff_t difference_type; //========================================================================== // Default constructor //========================================================================== cuda_buffer() : begin_(0), end_(0), stream_(0) {} public: //========================================================================== // Size constructor //========================================================================== cuda_buffer( int n) : begin_(0), end_(0), stream_(0) { if(!n) return; CUDA_ERROR(cudaMalloc( reinterpret_cast<void**>(&begin_) , n* sizeof(value_type) )); end_ = begin_ + n; } //========================================================================== // Copy constructor //========================================================================== cuda_buffer( cuda_buffer const& src ) : begin_(0), end_(0), stream_(0) { if(!src.size()) return; CUDA_ERROR(cudaMalloc( reinterpret_cast<void**>(&begin_) , src.size()*sizeof(value_type) )); CUDA_ERROR(cudaMemcpyAsync( begin_ , src.data() , src.size()* sizeof(value_type) , cudaMemcpyDeviceToDevice , stream_ )); end_ = begin_ + src.size(); } template<typename Container> cuda_buffer( Container const& src ) : begin_(0), end_(0), stream_(0) { if(!src.size()) return; CUDA_ERROR(cudaMalloc( reinterpret_cast<void**>(&begin_) , src.size()*sizeof(value_type) )); CUDA_ERROR(cudaMemcpyAsync( begin_ , src.data() , 10 * sizeof(value_type) , cudaMemcpyHostToDevice , stream_ )); end_ = begin_ + src.size(); } //========================================================================== // Destructor //========================================================================== ~cuda_buffer() { if(stream_ != NULL) { cudaStreamDestroy(stream_); } if(begin_) { cudaFree(begin_); } } //========================================================================== // Assignment //========================================================================== cuda_buffer& operator=(cuda_buffer const& src) { if(!src.size()) return *this; if( src.size() > this->size() ) { cudaFree(begin_); CUDA_ERROR(cudaMalloc( reinterpret_cast<void**>(&begin_) , src.size()*sizeof(value_type) )); end_ = begin_ + src.size(); } CUDA_ERROR(cudaMemcpyAsync( begin_ , src.data() , src.size()*sizeof(value_type) , cudaMemcpyDeviceToDevice , stream_ )); return *this; } template<class Container> cuda_buffer& operator=(Container const& src) { if(!src.size()) return *this; if( src.size() > this->size() ) { cudaFree(begin_); CUDA_ERROR(cudaMalloc( reinterpret_cast<void**>(&begin_) , src.size()*sizeof(value_type) )); end_ = begin_ + src.size(); } CUDA_ERROR(cudaMemcpyAsync( begin_ , src.data() , src.size()* sizeof(value_type) , cudaMemcpyHostToDevice , stream_ )); return *this; } //========================================================================== // Swap //========================================================================== void swap( cuda_buffer& src ) { boost::swap(begin_ , src.begin_ ); boost::swap(end_ , src.end_ ); boost::swap(stream_ , src.stream_ ); } //========================================================================== // Iterators //========================================================================== iterator begin() { return begin_; } const_iterator begin() const { return begin_; } iterator end() { return end_; } const_iterator end() const { return end_; } //========================================================================== // Raw values //========================================================================== pointer data() { return begin_; } const_pointer data() const { return begin_; } template<typename Container> void data(Container & dst) const { if(!this->size()) return; if ( dst.size() != this->size() ) dst.resize(nt2::of_size(this->size(),1)); CUDA_ERROR(cudaMemcpyAsync( dst.data() , this->begin_ , this->size() * sizeof(value_type) , cudaMemcpyDeviceToHost, stream_ )); } //========================================================================== // Size related members //========================================================================== inline size_type size() const { return end_ - begin_; } inline bool empty() const { return size() == 0; } inline size_type max_size() const { return (std::numeric_limits<size_type>::max)() / sizeof(T); } //========================================================================== // Stream related -- if neccesary //========================================================================== inline cudaStream_t stream() const { return stream_; } inline cudaError_t setStream() const { return cudaStreamCreate(&stream_); } private: pointer begin_, end_; cudaStream_t stream_; }; //============================================================================ /**! * Swap the contents of two buffer * \param x First \c pointer_buffer to swap * \param y Second \c pointer_buffer to swap **/ //============================================================================ template<class T> inline void swap(cuda_buffer<T>& x, cuda_buffer<T>& y) { x.swap(y); } } } #endif <|start_filename|>modules/core/exponential/include/nt2/exponential/constants/log_2hi.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2011 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2011 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_EXPONENTIAL_CONSTANTS_LOG_2HI_HPP_INCLUDED #define NT2_EXPONENTIAL_CONSTANTS_LOG_2HI_HPP_INCLUDED #include <nt2/include/functor.hpp> #include <boost/simd/constant/hierarchy.hpp> #include <boost/simd/constant/register.hpp> namespace nt2 { namespace tag { /*! @brief log_2hi generic tag Represents the log_2hi constant in generic contexts. @par Models: Hierarchy **/ BOOST_SIMD_CONSTANT_REGISTER( Log_2hi, double , 0, 0x3f318000UL //0.693359375f , 0x3fe62e42fee00000ULL //6.93147180369123816490e-01 ) } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::Log_2hi, Site> dispatching_Log_2hi(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::Log_2hi, Site>(); } template<class... Args> struct impl_Log_2hi; } /*! Generates constant Log_2hi.This constant is coupled with Log2_lo and is used in the float logarithms computations We have double(Log_2hi<float>())+double(Log2_lo<float>()) == Log_2<double>() @par Semantic: @code T r = log_2hi<T>(); @endcode **/ BOOST_SIMD_CONSTANT_IMPLEMENTATION(tag::Log_2hi, Log_2hi); } #endif <|start_filename|>modules/boost/simd/base/include/boost/simd/constant/constants/pi.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2011 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2011 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef BOOST_SIMD_CONSTANT_CONSTANTS_PI_HPP_INCLUDED #define BOOST_SIMD_CONSTANT_CONSTANTS_PI_HPP_INCLUDED #include <boost/simd/include/functor.hpp> #include <boost/simd/constant/register.hpp> #include <boost/simd/constant/hierarchy.hpp> namespace boost { namespace simd { namespace tag { /*! @brief Pi generic tag Represents the Pi constant in generic contexts. @par Models: Hierarchy **/ BOOST_SIMD_CONSTANT_REGISTER( Pi, double, 3 , 0x40490FDB, 0x400921FB54442D18ULL ) } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::Pi, Site> dispatching_Pi(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::Pi, Site>(); } template<class... Args> struct impl_Pi; } /*! Generates value \f$\pi\f$ that is the half length of a circle of radius one ... in normal temperature and pressure conditions. @par Semantic: @code T r = Pi<T>(); @endcode is similar to: @code T r = T(4*atan(1)); @endcode **/ BOOST_SIMD_CONSTANT_IMPLEMENTATION(boost::simd::tag::Pi, Pi) } } #include <boost/simd/constant/common.hpp> #endif <|start_filename|>modules/core/hyperbolic/include/nt2/hyperbolic/functions/sinhcosh.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_HYPERBOLIC_FUNCTIONS_SINHCOSH_HPP_INCLUDED #define NT2_HYPERBOLIC_FUNCTIONS_SINHCOSH_HPP_INCLUDED #include <nt2/include/functor.hpp> namespace nt2 { namespace tag { /// @brief Hierarchy tag for sinhcosh function struct sinhcosh_ : ext::elementwise_<sinhcosh_> { typedef ext::elementwise_<sinhcosh_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_sinhcosh_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::sinhcosh_, Site> dispatching_sinhcosh_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::sinhcosh_, Site>(); } template<class... Args> struct impl_sinhcosh_; } /*! Computes simultaneously the sinh and cosh of the input @par Semantic: @code T0 ch, sh tie(sh, ch)= sinhcosh(x); @endcode is similar to: @code T0 sh = sinh(x); T0 ch = cosh(x); @endcode @see @funcref{sinh}, @funcref{cosh} @param a0 angle in radian @return A Fusion Sequence containing the sinh and cosh of @c a0 **/ NT2_FUNCTION_IMPLEMENTATION(tag::sinhcosh_, sinhcosh, 1) /*! Computes simultaneously the sinh and cosh of the input @par Semantic: @code T0 ch, sh sh = sinhcosh(x, ch); @endcode is similar to: @code T0 sh = sinh(x); T0 ch = cosh(x); @endcode @see @funcref{sinh}, @funcref{cosh} @param a0 angle in radian @param a1 L-Value that will receive the cosh off @c a0 @return the sinh of @c a0 **/ NT2_FUNCTION_IMPLEMENTATION_TPL(tag::sinhcosh_, sinhcosh,(A0 const&)(A1&),2) /*! Computes simultaneously the sinh and cosh of the input @par Semantic: @code T0 ch, sh sinhcosh(x, sh, ch); @endcode is similar to: @code T0 sh = sinh(x); T0 ch = cosh(x); @endcode @see @funcref{sinh}, @funcref{cosh} @param a0 angle in radian @param a1 L-Value that will receive the sinh off @c a0 @param a2 L-Value that will receive the cosh off @c a0 **/ NT2_FUNCTION_IMPLEMENTATION_TPL(tag::sinhcosh_, sinhcosh,(A0 const&)(A1&)(A2&),3) } #endif <|start_filename|>modules/core/interpol/include/nt2/interpol/functions/idxy_bilinear.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_INTERPOL_FUNCTIONS_IDXY_BILINEAR_HPP_INCLUDED #define NT2_INTERPOL_FUNCTIONS_IDXY_BILINEAR_HPP_INCLUDED #include <nt2/include/functor.hpp> #include <nt2/sdk/meta/value_as.hpp> #include <nt2/core/container/dsl/size.hpp> #include <nt2/core/container/dsl/value_type.hpp> #include <boost/mpl/bool.hpp> #include <nt2/sdk/meta/adapted_traits.hpp> namespace nt2 { namespace tag { /*! @brief idxy_bilinear generic tag Represents the idxy_bilinear function in generic contexts. @par Models: Hierarchy **/ struct idxy_bilinear_ : ext::unspecified_<idxy_bilinear_> { /// @brief Parent hierarchy typedef ext::unspecified_<idxy_bilinear_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_idxy_bilinear_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::idxy_bilinear_, Site> dispatching_idxy_bilinear_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::idxy_bilinear_, Site>(); } template<class... Args> struct impl_idxy_bilinear_; } /*! Performs two dimensional idxy_bilinear interpolation given an array a and two vector idx and idy of "real" indices provides the interpolated values along the two chosen array dimensions by bilinear formula. @par Semantic: calls can be of the forms: - idxy_bilinear(a0, idx, idy) - idxy_bilinear(a0, idx, idy, true) allowing extrapolation - idxy_bilinear(a0, idx, idy, val1) putting val1 outside the bounds - idxy_bilinear(a0, idx, idy, val1, val2)}, putting val1 under the index bounds val2 over - idxy_bilinear(a0, idx, idy, val1x val2x, val1y, val2y) - idxy_bilinear(a0, idx, idy, _, dim1, dim2) are the dimensions of interpolation 2 (rows), 1 (columns) of a0 by default - idxy_bilinear(a0, idx, idy, val1, dim1, dim2) - idxy_bilinear(a0, idx, idy, val1, val2, dim1, dim2) - idxy_bilinear(a0, idx, idy, val1x val2x, val1y, val2y, dim1, dim2) can also be used typically if a is a matrix, idx is a value situated between i and i+1 and idy is a value situated between j and j+1 the result is: @code (a(i, j)*(idx-i)+a(i+1, j)*(i+1-idx))*(jdx-j)+ (a(i, j+1)*(idx-i)+a(i+1, j+1)*(i+1-idx))*(j+1-jdx) @endcode @param a0 @param a1 @param a2 @param a3 @param a4 @param a5 @param a6 @param a7 @param a8 @param a9 @return a value of the same type as the parameter **/ NT2_FUNCTION_IMPLEMENTATION(tag::idxy_bilinear_, idxy_bilinear, 10) /// @overload NT2_FUNCTION_IMPLEMENTATION(tag::idxy_bilinear_, idxy_bilinear, 3) /// @overload NT2_FUNCTION_IMPLEMENTATION(tag::idxy_bilinear_, idxy_bilinear, 4) /// @overload NT2_FUNCTION_IMPLEMENTATION(tag::idxy_bilinear_, idxy_bilinear, 5) /// @overload NT2_FUNCTION_IMPLEMENTATION(tag::idxy_bilinear_, idxy_bilinear, 6) /// @overload NT2_FUNCTION_IMPLEMENTATION(tag::idxy_bilinear_, idxy_bilinear, 7) /// @overload NT2_FUNCTION_IMPLEMENTATION(tag::idxy_bilinear_, idxy_bilinear, 9) } namespace nt2 { namespace ext { template<class Domain, class Expr, int N> struct size_of<tag::idxy_bilinear_, Domain, N, Expr> { typedef typename boost::proto::result_of::child_c<Expr&,N-2>::type choice1_t; typedef typename boost::proto::result_of::child_c<Expr&,N-1>::type choice2_t; typedef typename boost::proto::result_of ::child_c<Expr&, 1>::value_type::extent_type result_type; result_type operator()(Expr& e) const { const choice1_t & v1 = boost::proto::child_c<N-2>(e); const choice2_t & v2 = boost::proto::child_c<N-1>(e); typedef typename nt2::meta::is_integral<choice1_t>::type c_t; std::size_t dim1 = 2, dim2 = 1; getdims(boost::proto::child_c<1>(e), v1, v2, dim1, dim2, c_t()); result_type sizee = boost::proto::child_c<0>(e).extent(); sizee[dim1-1] = numel(boost::proto::child_c<1>(e)); sizee[dim2-1] = numel(boost::proto::child_c<2>(e)); return sizee; } template<class X, class C1, class C2> static void getdims( const X &, const C1 &, const C2 & , std::size_t&, std::size_t&, const boost::mpl::false_& ) {} template<class X, class C1, class C2> static void getdims( const X &, const C1& v1, const C2& v2 , std::size_t& dim1, std::size_t& dim2, const boost::mpl::true_& ) { dim1 = v1; dim2 = v2; } }; template <class Domain, class Expr, int N> struct value_type < tag::idxy_bilinear_, Domain,N,Expr> : meta::value_as<Expr,0> {}; } } #endif <|start_filename|>modules/boost/simd/base/include/boost/simd/ieee/functions/ldexp.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef BOOST_SIMD_IEEE_FUNCTIONS_LDEXP_HPP_INCLUDED #define BOOST_SIMD_IEEE_FUNCTIONS_LDEXP_HPP_INCLUDED #include <boost/simd/include/functor.hpp> #include <boost/dispatch/include/functor.hpp> namespace boost { namespace simd { namespace tag { /*! @brief ldexp generic tag Represents the ldexp function in generic contexts. @par Models: Hierarchy **/ struct ldexp_ : ext::elementwise_<ldexp_> { /// @brief Parent hierarchy typedef ext::elementwise_<ldexp_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_ldexp_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::ldexp_, Site> dispatching_ldexp_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::ldexp_, Site>(); } template<class... Args> struct impl_ldexp_; } /*! The function multiply a floating entry \f$a_0\f$ by \f$2^{a_1}\f$ @par Semantic: @code T r = ldexp(a0,a1); @endcode is similar to: @code T r = a0*pow(2, a1); @endcode @param a0 @param a1 @return a value of same type as the inputs **/ BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::ldexp_, ldexp, 2) } } #endif <|start_filename|>modules/core/polynom/include/nt2/polynom/functions/conv.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_POLYNOM_FUNCTIONS_CONV_HPP_INCLUDED #define NT2_POLYNOM_FUNCTIONS_CONV_HPP_INCLUDED #include <nt2/include/functor.hpp> namespace nt2 { namespace tag { /*! @brief conv generic tag Represents the conv function in generic contexts. @par Models: Hierarchy **/ struct conv_ : ext::unspecified_<conv_> { /// @brief Parent hierarchy typedef ext::unspecified_<conv_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_conv_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::conv_, Site> dispatching_conv_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::conv_, Site>(); } template<class... Args> struct impl_conv_; } /*! Polynomials multiplication and vectors convolution @par Semantic: For every expressions a, b representing a polynomial: @code auto r = conv(a, b, shape); @endcode convolves vectors a and b. c = conv(a, b, shape) returns a subvector of the convolution with size specified by shape: - 'f' (default) returns the 'full' convolution, - 's' returns the central part of the convolution that is the 'same' size as a. - 'v' returns only those 'valid' parts of the convolution that are computed without the zero-padded edges. If a and b are vectors representing polynomial coefficients, convolving them is almost equivalent to multiplying the two polynoms. @see @funcref{numel} @param a0 @param a1 @return returns an expression **/ NT2_FUNCTION_IMPLEMENTATION(tag::conv_, conv, 2) } #endif <|start_filename|>modules/core/gallery/include/nt2/gallery/functions/prolate.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_GALLERY_FUNCTIONS_PROLATE_HPP_INCLUDED #define NT2_GALLERY_FUNCTIONS_PROLATE_HPP_INCLUDED #include <nt2/include/functor.hpp> /*! * \ingroup algebra * \defgroup algebra_prolate prolate * * a =prolate(n,w) is the n-by-n prolate matrix with * parameter w. it is a symmetric toeplitz matrix. * if 0 < w < 0.5 then * 1. a is positive definite * 2. the eigenvalues of a are distinct, lie in (0, 1), and tend to * cluster around 0 and 1. * w defaults to 0.25. * * Reference: * <NAME>. The Prolate matrix. Linear Algebra and Appl., * 187:269-278, 1993. * * \par Header file * * \code ! * #include <nt2/include/functions/prolate.hpp> * \endcode * **/ //============================================================================== // prolate actual class forward declaration //============================================================================== namespace nt2 { namespace tag { /*! * \brief Define the tag prolate_ of functor prolate * in namespace nt2::tag for toolbox algebra **/ struct prolate_ : ext::abstract_<prolate_> { typedef ext::abstract_<prolate_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_prolate_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::prolate_, Site> dispatching_prolate_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::prolate_, Site>(); } template<class... Args> struct impl_prolate_; } BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::prolate_, prolate, 2) } #endif <|start_filename|>modules/arch/cuda/unit/functions/trsm.cpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2014 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #include <nt2/include/functions/trsm.hpp> #include <nt2/include/functions/rand.hpp> #include <nt2/include/functions/cons.hpp> #include <nt2/include/functions/mtimes.hpp> #include <nt2/table.hpp> #include <nt2/include/functions/lu.hpp> #include <nt2/sdk/unit/tests/ulp.hpp> #include <nt2/sdk/unit/module.hpp> #include <nt2/sdk/unit/tests/relation.hpp> NT2_TEST_CASE_TPL(trsm, (double) ) { using nt2::_; typedef nt2::table<T> t_t; t_t a = nt2::cons<T>(nt2::of_size(3,3),2,1,1,1,1,1,1,1,2); t_t b = nt2::cons<T>(nt2::of_size(3,1),1,2,5); t_t x = nt2::cons<T>(nt2::of_size(3,1),-1,0,3); t_t y(b); t_t l,u,p; nt2::tie(l,u,p) = nt2::lu(a); char lside = 'l'; char uplo = 'u'; char lplo = 'l'; char diag = 'n'; char notrans= 'n'; y = nt2::mtimes(p,b); nt2::trsm(lside,lplo,notrans,diag,boost::proto::value(l),boost::proto::value(y)); nt2::trsm(lside,uplo,notrans,diag,boost::proto::value(u),boost::proto::value(y)); NT2_TEST_EQUAL( y, x); } <|start_filename|>modules/core/interpol/include/nt2/interpol/functions/pchip.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_INTERPOL_FUNCTIONS_PCHIP_HPP_INCLUDED #define NT2_INTERPOL_FUNCTIONS_PCHIP_HPP_INCLUDED #include <nt2/include/functor.hpp> #include <nt2/sdk/meta/size_as.hpp> #include <nt2/sdk/meta/value_as.hpp> #include <nt2/core/container/dsl/size.hpp> #include <nt2/core/container/dsl/value_type.hpp> namespace nt2 { namespace tag { /*! @brief pchip generic tag Represents the pchip function in generic contexts. @par Models: Hierarchy **/ struct pchip_ : ext::unspecified_<pchip_> { /// @brief Parent hierarchy typedef ext::unspecified_<pchip_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_pchip_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::pchip_, Site> dispatching_pchip_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::pchip_, Site>(); } template<class... Args> struct impl_pchip_; } /*! one dimensional pchip interpolation \par @par Semantic: For every parameters expressions @code auto r = pchip(a0,a1,a2); @endcode search the xi locations i in x using bsearch and returns the polynomial shape-preserving piecewise cubic interpolation in the interval [x(begin_), x(end_)] else depending on extrap value: - nan if extrap is missing or false - extrapolation if extrap is true - value of extrap if the type of extrap is a scalar of the x element type @param a0 @param a1 @param a2 @param a3 @return a value of the same type as the parameter **/ NT2_FUNCTION_IMPLEMENTATION(tag::pchip_, pchip, 4) /// @overload NT2_FUNCTION_IMPLEMENTATION(tag::pchip_, pchip, 3) } namespace nt2 { namespace ext { /// INTERNAL ONLY template<class Domain, class Expr, int N> struct size_of<tag::pchip_, Domain, N, Expr> : meta::size_as<Expr,2> {}; } } #endif <|start_filename|>modules/boost/simd/base/include/boost/simd/swar/functions/enumerate.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2011 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2011 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef BOOST_SIMD_SWAR_FUNCTIONS_ENUMERATE_HPP_INCLUDED #define BOOST_SIMD_SWAR_FUNCTIONS_ENUMERATE_HPP_INCLUDED #include <boost/simd/include/functor.hpp> #include <boost/dispatch/include/functor.hpp> namespace boost { namespace simd { namespace tag { /*! * \brief Define the tag enumerate_ of functor enumerate * in namespace boost::simd::tag for toolbox boost.simd.enumerate **/ struct enumerate_ : ext::unspecified_<enumerate_> { typedef ext::unspecified_<enumerate_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_enumerate_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::enumerate_, Site> dispatching_enumerate_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::enumerate_, Site>(); } template<class... Args> struct impl_enumerate_; } /*! @brief Linear enumeration of value Return a SIMD register containing a linear enumeration of value defined by a seed value and a step. @par Semantic: For any given SIMD type @c T, and any value @c seed and @c step of a scalar type @c S, the following code : @code T r = enumerate<T>(seed, step); @endcode is equivalent to @code T r = make<T>(seed, seed + step, ... , seed + (N-1)*step); @endcode where @c N is the equal to <tt>cardinal_of<T>::value</tt>. For any given SIMD type @c T, and any value @c seed and @c step of a SIMD type @c S, the following code : @code T r = enumerate<T>(seed, step); @endcode is equivalent to @code T r = splat<T>(seed) + splat<T>(step)*enumerate<T>(); @endcode @tparam T Result type of the enumeration @param seed Initial value of the enumeration. By default, @c seed is equals to 0. @param step Scaling factor of the enumeration step. By default, @c step is equals to 1. @return A SIMD register of scalar type @c T **/ template<class T,class A0, class A1> BOOST_FORCEINLINE typename boost::dispatch::meta:: call<tag::enumerate_( A0 const&, A1 const&, boost::dispatch::meta::as_<T> ) >::type enumerate(A0 const& seed, A1 const& step) { typename boost::dispatch::make_functor<tag::enumerate_, A0>::type callee; return callee(seed,step,boost::dispatch::meta::as_<T>()); } /// @overload template<class T,class A0> BOOST_FORCEINLINE typename boost::dispatch::meta:: call<tag::enumerate_( A0 const& , boost::dispatch::meta::as_<T> ) >::type enumerate(A0 const& seed) { typename boost::dispatch::make_functor<tag::enumerate_, A0>::type callee; return callee(seed,boost::dispatch::meta::as_<T>()); } /// @overload template<class T> BOOST_FORCEINLINE typename boost::dispatch::meta:: call<tag::enumerate_( boost::dispatch::meta::as_<T> ) >::type enumerate() { typename boost::dispatch::make_functor<tag::enumerate_, T>::type callee; return callee(boost::dispatch::meta::as_<T>()); } } } #endif <|start_filename|>modules/boost/simd/sdk/include/boost/simd/sdk/prev_power_of_2.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2011 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2013 LRI UMR 8623 CNRS/Univ Paris Sud XI // Copyright 2012 - 2013 MetaScale SAS // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef BOOST_SIMD_SDK_PREV_POWER_OF_2_HPP_INCLUDED #define BOOST_SIMD_SDK_PREV_POWER_OF_2_HPP_INCLUDED namespace boost { namespace simd { /*! @brief Evaluates previous power of 2 Computes the power of two lesser or equal to any given integral value @c n. @par Semantic: For any given integral value @c n: @code std::size_t r = prev_power_of_2(n); @endcode where @c r verifies: @code is_power_of_2(r) == true && r <= n @endcode @param n Integral value. @return An unsigned integral value. **/ inline std::size_t prev_power_of_2(std::size_t n) { if(n==0) return 0; std::size_t x0 = n; std::size_t x1 = x0 | (x0 >> 1); std::size_t x2 = x1 | (x1 >> 2); std::size_t x3 = x2 | (x2 >> 4); std::size_t x4 = x3 | (x3 >> 8); std::size_t x5 = x4 | (x4 >> 16); return (x5 >> 1) + 1; } } } #endif <|start_filename|>modules/boost/simd/sdk/include/boost/simd/sdk/simd/meta/as_simd.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef BOOST_SIMD_SDK_SIMD_META_AS_SIMD_HPP_INCLUDED #define BOOST_SIMD_SDK_SIMD_META_AS_SIMD_HPP_INCLUDED #include <boost/simd/sdk/simd/extensions/meta/tags.hpp> #include <boost/simd/forward/aligned_array.hpp> #include <boost/simd/sdk/simd/preprocessor/repeat.hpp> #include <boost/simd/sdk/config/type_lists.hpp> #include <boost/simd/sdk/config/types.hpp> #include <boost/simd/sdk/config/compiler.hpp> #include <boost/simd/sdk/config/arch.hpp> #include <boost/preprocessor/seq/for_each.hpp> #include <boost/dispatch/meta/na.hpp> #include <boost/type_traits/is_fundamental.hpp> #include <boost/utility/enable_if.hpp> // Forward-declare logical namespace boost { namespace simd { template<class T> struct logical; } } namespace boost { namespace simd { namespace meta { template<class T, class Extension, class Enable = void> struct as_simd { typedef dispatch::meta::na_ type; }; template<std::size_t N, class T> struct as_simd<T, tag::simd_emulation_<N>, typename enable_if< is_fundamental<T> >::type> { typedef boost::simd::aligned_array<T, N / sizeof(T)> type; }; template<std::size_t N, class T> struct as_simd<logical<T>, tag::simd_emulation_<N> > : as_simd<T, tag::simd_emulation_<N> > { }; // Some GCC and Clang versions require full specializations #define M0(r,n,t) \ template<> \ struct as_simd<t, tag::simd_emulation_<n> > \ { \ typedef t type __attribute__((__vector_size__(n))); \ }; \ /**/ // GCC bug with 64-bit integer types on i686 // Also affects GCC 4.8.x on x86-64 #if defined(BOOST_SIMD_COMPILER_GCC) && defined(BOOST_SIMD_ARCH_X86) && ((__GNUC__ == 4 && __GNUC_MINOR__ == 8) || !defined(BOOST_SIMD_ARCH_X86_64)) #define M1(z,n,t) BOOST_PP_SEQ_FOR_EACH(M0, n, BOOST_SIMD_SPLITABLE_TYPES(double)) #else #define M1(z,n,t) BOOST_PP_SEQ_FOR_EACH(M0, n, BOOST_SIMD_TYPES) #endif #ifdef __GNUC__ M0(0, 1, boost::simd::int8_t) M0(0, 1, boost::simd::uint8_t) M0(0, 2, boost::simd::int8_t) M0(0, 2, boost::simd::uint8_t) M0(0, 2, boost::simd::int16_t) M0(0, 2, boost::simd::uint16_t) M0(0, 4, boost::simd::int8_t) M0(0, 4, boost::simd::uint8_t) M0(0, 4, boost::simd::int16_t) M0(0, 4, boost::simd::uint16_t) M0(0, 4, boost::simd::int32_t) M0(0, 4, boost::simd::uint32_t) M0(0, 4, float) BOOST_SIMD_PP_REPEAT_POWER_OF_2_FROM(8, M1, ~) #endif #undef M0 #undef M1 } } } #endif <|start_filename|>modules/core/euler/include/nt2/euler/functions/gammainc.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_EULER_FUNCTIONS_GAMMAINC_HPP_INCLUDED #define NT2_EULER_FUNCTIONS_GAMMAINC_HPP_INCLUDED #include <nt2/include/functor.hpp> namespace nt2 { namespace tag { /*! @brief gammainc generic tag Represents the gammainc function in generic contexts. @par Models: Hierarchy **/ struct gammainc_ : ext::elementwise_<gammainc_> { typedef ext::elementwise_<gammainc_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_gammainc_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::gammainc_, Site> dispatching_gammainc_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::gammainc_, Site>(); } template<class... Args> struct impl_gammainc_; } /*! @brief Incomplete Gamma function Computes the incomplete gamma function. @par Semantic: For any floating-point values @c a0 , @c a1 of type T: @code T r = gammainc(a0,a1); @endcode returns the value computed by the formula: \f$ gammainc(x)=\int_0^{a_1} t^{a_0-1}e^{-t}dt\f @param a0 Lower bound of the incomplete gamma integral @param a1 Upper bound of the incomplete gamma integral @return a value of the same type as the parameter **/ NT2_FUNCTION_IMPLEMENTATION(tag::gammainc_, gammainc, 2) } #endif <|start_filename|>modules/core/exponential/include/nt2/exponential/functions/pow2.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_EXPONENTIAL_FUNCTIONS_POW2_HPP_INCLUDED #define NT2_EXPONENTIAL_FUNCTIONS_POW2_HPP_INCLUDED #include <nt2/include/functor.hpp> namespace nt2 { namespace tag { /*! @brief pow2 generic tag Represents the pow2 function in generic contexts. @par Models: Hierarchy **/ struct pow2_ : ext::elementwise_<pow2_> { /// @brief Parent hierarchy typedef ext::elementwise_<pow2_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_pow2_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::pow2_, Site> dispatching_pow2_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::pow2_, Site>(); } template<class... Args> struct impl_pow2_; } /*! Returns base 2 power of input (the result is undefined on overflow and the functor asserts for invalid input) @par Semantic: For every parameter of type T0 @code T0 r = pow2(x); @endcode is similar to: @code T0 r = exp2(trunc(x)); @endcode @see @funcref{exp2}, @funcref{trunc} @param a0 @return a value of the same type as the first parameter **/ NT2_FUNCTION_IMPLEMENTATION(tag::pow2_, pow2, 1) /*! Returns \f$ x 2^y\f$. (the result is undefined on overflow and the functor asserts for invalid second parameter ) @par Semantic: For every parameters of floating type T0 @code T0 r = pow2(x, y); @endcode is similar to: @code T0 r = x*exp2(trunc(y)); @endcode @see @funcref{exp2}, @funcref{trunc}, @funcref{ldexp} @param a0 @param a1 @return a value of the same type as the parameter **/ NT2_FUNCTION_IMPLEMENTATION(tag::pow2_, pow2, 2) } #endif <|start_filename|>modules/core/sdk/include/nt2/sdk/memory/fixed_allocator.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2011 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2011 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_SDK_MEMORY_FIXED_ALLOCATOR_HPP_INCLUDED #define NT2_SDK_MEMORY_FIXED_ALLOCATOR_HPP_INCLUDED #include <boost/core/ignore_unused.hpp> #include <boost/assert.hpp> #include <cstddef> namespace nt2 { namespace memory { //============================================================================ /**! * fixed_allocator is a stateful allocator that wraps an already allocated * memory range into an allocator interface. **/ //============================================================================ template<class T> struct fixed_allocator { //========================================================================== // Allocator static expression conformance //========================================================================== typedef T value_type; typedef T* pointer; typedef T const* const_pointer; typedef T& reference; typedef T const& const_reference; typedef std::size_t size_type; typedef std::ptrdiff_t difference_type; template<class U> struct rebind { typedef fixed_allocator<U> other; }; //========================================================================== // Ctor/dtor //========================================================================== fixed_allocator() : begin_(0), end_(0) {} fixed_allocator( pointer b, pointer e ) : begin_(b), end_(e) {} ~fixed_allocator() {} //========================================================================== // Transtyping constructor - Only valid if T* and U* are convertible //========================================================================== template<class U> fixed_allocator(fixed_allocator<U> const& src) { begin_ = static_cast<pointer>(src.begin()); end_ = static_cast<pointer>(src.end()); } //========================================================================== // Original pointer value //========================================================================== pointer begin_, end_; //========================================================================== // Pointer accessors //========================================================================== pointer& begin() { return begin_; } pointer const& begin() const { return begin_; } pointer& end() { return end_; } pointer const& end() const { return end_; } //////////////////////////////////////////////////////////////////////////// // Address handling //////////////////////////////////////////////////////////////////////////// pointer address(reference r) { return &r; } const_pointer address(const_reference r) { return &r; } //////////////////////////////////////////////////////////////////////////// // Size handling //////////////////////////////////////////////////////////////////////////// size_type max_size() const { return size_type(end_ - begin_); } //////////////////////////////////////////////////////////////////////////// // Object lifetime handling //////////////////////////////////////////////////////////////////////////// void construct(pointer p, const T& t) { p = new (p) value_type(t); } void destroy(pointer p) { p->~value_type(); } //////////////////////////////////////////////////////////////////////////// // Memory handling //////////////////////////////////////////////////////////////////////////// pointer allocate( size_type s, const void* = 0 ) const { boost::ignore_unused(s); BOOST_ASSERT_MSG ( (s <= max_size()) , "Allocation requests more memory than available in fixed_allocator" ); return begin_; } void deallocate(pointer, size_type) const {} }; //============================================================================ /**! * Checks if two fixed_allocator are equal. Such allocators are equal if and * only if they share the same pointee. **/ //============================================================================ template<class T> bool operator==(fixed_allocator<T> const& lhs, fixed_allocator<T> const& rhs) { return (lhs.begin() == rhs.begin()) && (lhs.end() == rhs.end()); } //============================================================================ /**! * Checks if two fixed_allocator are non-equal. Such allocators are not equal * only if they share different pointees. **/ //============================================================================ template<class T> bool operator!=(fixed_allocator<T> const& lhs, fixed_allocator<T> const& rhs) { return !(lhs == rhs); } } } #endif <|start_filename|>modules/core/euler/include/nt2/euler/functions/digamma.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_EULER_FUNCTIONS_DIGAMMA_HPP_INCLUDED #define NT2_EULER_FUNCTIONS_DIGAMMA_HPP_INCLUDED #include <nt2/include/functor.hpp> namespace nt2 { namespace tag { /*! @brief digamma generic tag Represents the digamma function in generic contexts. @par Models: Hierarchy **/ struct digamma_ : ext::elementwise_<digamma_> { /// @brief Parent hierarchy typedef ext::elementwise_<digamma_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_digamma_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::digamma_, Site> dispatching_digamma_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::digamma_, Site>(); } template<class... Args> struct impl_digamma_; } /*! Computes digamma function, i.e. the logarithmic derivative of the \f$\Gamma\f$ function Note that the accuracy is not uniformly good for negative entries The algorithm used is currently an adapted vesion of the cephes one. For better accuracy in the negative entry case one can use the extern boost_math digamma functor, but at a loss of speed. @par Semantic: For every parameter of floating type T0 @code T0 r = digamma(x); @endcode Computes: \f$\Digamma(a_0) = \frac{\Gamma^\prime(x)}{\Gamma(x}\f$ Note: The function is reliable for positive values, but can be inaccurate at negative inputs around its poles that are the non-positives integers. float version is as good as boost/math one, but the double version is computed using double (!) and can be not so accurate than boost/math which uses long double in these circumstances. @param a0 @return a value of the same type as the parameter **/ NT2_FUNCTION_IMPLEMENTATION(tag::digamma_, digamma, 1) } #endif <|start_filename|>modules/boost/simd/base/include/boost/simd/arithmetic/functions/round.hpp<|end_filename|> //============================================================================== // Copyright 2015 - <NAME> // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2015 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef BOOST_SIMD_ARITHMETIC_FUNCTIONS_ROUND_HPP_INCLUDED #define BOOST_SIMD_ARITHMETIC_FUNCTIONS_ROUND_HPP_INCLUDED #include <boost/simd/include/functor.hpp> #include <boost/dispatch/include/functor.hpp> namespace boost { namespace simd { namespace tag { /*! @brief round generic tag Represents the round function in generic contexts. @par Models: Hierarchy **/ struct round_ : ext::elementwise_<round_> { /// @brief Parent hierarchy typedef ext::elementwise_<round_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_round_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::round_, Site> dispatching_round_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::round_, Site>(); } template<class... Args> struct impl_round_; } /*! Computes the rounded to nearest integer away from 0 @par semantic: For any given value @c x of type @c T: @code T r = round(x); @endcode Returns the nearest integer to x. @par Note: aways from 0 means that half integer values are rounded to the nearest integer of greatest absolute value @param x value to be rounded @return a value of the same type as the input. **/ BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::round_, round, 1) /*! round(x,n) rounds aways from 0 to n digits: @par semantic: For any given value @c x of type @c T and integer n : @code T r = round(x, n); @endcode is equivalent to @code T r = round(x*exp10(n)*exp10(-n)); @endcode @par Note: n > 0: round to n digits to the right of the decimal point. n = 0: round to the nearest integer. n < 0: round to n digits to the left of the decimal point. aways from 0 means that half integer values are rounded to the nearest integer of greatest absolute value @param x value to be rounded @param n number of digits @return a value of the same type as the input. **/ BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::round_, round, 2) } } #endif <|start_filename|>modules/boost/simd/base/include/boost/simd/constant/constants/true.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2011 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2011 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef BOOST_SIMD_CONSTANT_CONSTANTS_TRUE_HPP_INCLUDED #define BOOST_SIMD_CONSTANT_CONSTANTS_TRUE_HPP_INCLUDED #include <boost/simd/include/functor.hpp> #include <boost/simd/constant/register.hpp> #include <boost/simd/constant/hierarchy.hpp> #include <boost/simd/sdk/meta/as_logical.hpp> namespace boost { namespace simd { namespace tag { /*! @brief True generic tag Represents the True constant in generic contexts. @par Models: Hierarchy **/ struct True : ext::pure_constant_<True> { typedef logical<double> default_type; typedef ext::pure_constant_<True> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_True( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::True, Site> dispatching_True(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::True, Site>(); } template<class... Args> struct impl_True; } /*! Generates the value True as a logical associated to chosen type @par Semantic: @code T r = True<T>(); @endcode is similar to: @code auto r = logical<T>(true); @endcode **/ BOOST_SIMD_CONSTANT_IMPLEMENTATION(boost::simd::tag::True, True) } } #include <boost/simd/constant/common.hpp> #endif <|start_filename|>modules/binding/magma/unit/magma/posv.cpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2013 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #include <nt2/include/functions/posv.hpp> #include <nt2/include/functions/eye.hpp> #include <nt2/include/functions/transpose.hpp> #include <nt2/include/functions/zeros.hpp> #include <nt2/include/functions/ones.hpp> #include <nt2/include/functions/width.hpp> #include <nt2/include/functions/height.hpp> #include <nt2/include/functions/mtimes.hpp> #include <nt2/include/functions/cons.hpp> #include <nt2/include/functions/rand.hpp> #include <nt2/table.hpp> #include <nt2/sdk/unit/module.hpp> #include <nt2/sdk/unit/tests/ulp.hpp> #include <nt2/sdk/unit/tests/relation.hpp> NT2_TEST_CASE_TPL(magma_posv, NT2_REAL_TYPES ) { using nt2::_; typedef nt2::table<T> t_t; typedef nt2::table<nt2_la_int> t_i; nt2_la_int n = 2000; t_t a = nt2::rand(2000, 2000, nt2::meta::as_<T>()); t_t b = nt2::rand(2000,1,nt2::meta::as_<T>() ); t_t x(b); a = a + nt2::transpose(a); a = a + T(n)*nt2::eye(n,n,nt2::meta::as_<T>()); nt2_la_int p = 5; p = nt2::posv( boost::proto::value(a), boost::proto::value(x) ); NT2_TEST_EQUAL(p,0); } NT2_TEST_CASE_TPL(magma_posvc, NT2_REAL_TYPES ) { using nt2::_; typedef std::complex<T> cT; typedef nt2::table<cT> t_t; typedef nt2::table<nt2_la_int> t_i; nt2_la_int n = 2000; t_t a = T(10)* nt2::ones (2000, 2000, nt2::meta::as_<cT>()) - T(4)*nt2::eye (2000, 2000, nt2::meta::as_<cT>()); t_t b = nt2::ones (2000, 1, nt2::meta::as_<cT>()); t_t x(b); a = a + nt2::transpose(a); a = a + cT(n)*nt2::eye(n,n,nt2::meta::as_<cT>()); nt2_la_int p = 5; p = nt2::posv( boost::proto::value(a), boost::proto::value(x) ); NT2_TEST_EQUAL(p,0); } <|start_filename|>modules/core/gallery/include/nt2/gallery/functions/pascal.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_GALLERY_FUNCTIONS_PASCAL_HPP_INCLUDED #define NT2_GALLERY_FUNCTIONS_PASCAL_HPP_INCLUDED #include <nt2/include/functor.hpp> #include <nt2/sdk/meta/size_as.hpp> #include <nt2/sdk/meta/value_as.hpp> #include <nt2/core/container/dsl/value_type.hpp> #include <nt2/core/container/dsl/size.hpp> /*! * \ingroup algebra * \defgroup algebra_pascal pascal * * \par Description * compute a chebyshev spectral differentiation matrix. * c = pascal(n,k) is a chebyshev spectral * differentiation matrix of order n. k = 0 (the default) or 1. * for k = 0 ("no boundary conditions"), c is nilpotent, with * mpower(c, n) = 0 and it has the null vector ones(n,1). * c is similar to a jordan block of size n with eigenvalues zero. * for k = 1, c is nonsingular and well conditioned, and its * eigenvalues have negative real parts. * for both k, the computed eigenvector matrix x from eig is * ill-conditioned (mesh(real(x)) is interesting). * * References: * [1] <NAME>, <NAME>, <NAME> and <NAME>, * Spectral Methods in Fluid Dynamics, Springer-Ver<NAME>, * 1988, p. 69. * [2] <NAME> and <NAME>, An instability phenomenon in * spectral methods, SIAM J. Numer. Anal., 24 (1987), pp. 1008-1023. * [3] <NAME>, Computing the inverse of the Chebyshev collocation * derivative, SIAM J. Sci. Stat. Comput., 9 (1988), pp. 1050-1057. * * <NAME>, Dec 1999. * Copyright 1984-2002 The MathWorks, Inc. * * \par Header file * * \code * #include <nt2/include/functions/pascal.hpp> * \endcode * * **/ //============================================================================== // pascal actual class forward declaration //============================================================================== namespace nt2 { namespace tag { /*! * \brief Define the tag pascal_ of functor pascal * in namespace nt2::tag for toolbox algebra **/ struct pascal_ : ext::unspecified_<pascal_> { typedef ext::unspecified_<pascal_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_pascal_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::pascal_, Site> dispatching_pascal_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::pascal_, Site>(); } template<class... Args> struct impl_pascal_; } NT2_FUNCTION_IMPLEMENTATION(tag::pascal_, pascal, 1) NT2_FUNCTION_IMPLEMENTATION(tag::pascal_, pascal, 2) NT2_FUNCTION_IMPLEMENTATION(tag::pascal_, pascal, 3) template < class T > container::table<T> pascal(size_t n, size_t k) { return nt2::pascal(n, k, meta::as_<T>()); } template < class T > container::table<T> pascal(size_t n) { return nt2::pascal(n, 0, meta::as_<T>()); } } namespace nt2 { namespace ext { template<class Domain, class Expr, int N> struct size_of<tag::pascal_, Domain, N, Expr> { typedef _2D result_type; BOOST_FORCEINLINE result_type operator()(Expr& e) const { size_t n = boost::proto::child_c<0>(e); result_type sizee; sizee[0] = sizee[1] = n; return sizee; } }; // template <class Domain, class Expr, int N> // struct value_type < tag::pascal_, Domain,N,Expr> // { // typedef double type; // }; template <class Domain, class Expr, int N> struct value_type < tag::pascal_, Domain,N,Expr> { typedef typename boost::proto::result_of::child_c<Expr&,2>::type tmp_type; typedef typename meta::strip<tmp_type>::type tmp1_type; typedef typename boost::dispatch::meta::semantic_of<tmp1_type >::type t_type; typedef typename t_type::type type; }; } } #endif <|start_filename|>modules/core/sdk/unit/utility/numel.cpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #define NT2_UNIT_MODULE "nt2::numel function" #include <nt2/table.hpp> #include <nt2/include/functions/numel.hpp> #include <nt2/include/functions/of_size.hpp> #include <boost/mpl/vector.hpp> #include <nt2/sdk/unit/module.hpp> #include <nt2/sdk/unit/tests/basic.hpp> #include <nt2/sdk/unit/tests/relation.hpp> #include <nt2/sdk/unit/tests/type_expr.hpp> //////////////////////////////////////////////////////////////////////////////// // numel of arithmetic types //////////////////////////////////////////////////////////////////////////////// NT2_TEST_CASE( fundamental_numel ) { using nt2::numel; using boost::mpl::_; NT2_TEST_EQUAL( numel('4'), 1U ); NT2_TEST_EXPR_TYPE( numel('4'), _, (boost::mpl::size_t<1ul>) ); NT2_TEST_EQUAL( numel(4) , 1U ); NT2_TEST_EXPR_TYPE( numel(4), _, (boost::mpl::size_t<1ul>) ); NT2_TEST_EQUAL( numel(4.) , 1U ); NT2_TEST_EXPR_TYPE( numel(4.), _, (boost::mpl::size_t<1ul>) ); NT2_TEST_EQUAL( numel(4.f), 1U ); NT2_TEST_EXPR_TYPE( numel(4.f), _, (boost::mpl::size_t<1ul>) ); // Numel of fusion vector preserves types boost::fusion::vector<nt2::uint16_t,nt2::uint16_t> fv(2,3); NT2_TEST_EQUAL( numel(fv), nt2::uint16_t(6) ); NT2_TEST_EXPR_TYPE( numel(fv), _, (nt2::uint16_t) ); } //////////////////////////////////////////////////////////////////////////////// // numel of container //////////////////////////////////////////////////////////////////////////////// NT2_TEST_CASE( container_numel ) { using nt2::numel; using nt2::tag::table_; using nt2::of_size; typedef nt2::memory::container<table_,float,nt2::settings()> container_t; container_t t0; container_t t1( of_size(2,1,1,1) ); container_t t2( of_size(2,2,1,1) ); container_t t3( of_size(2,2,2,1) ); container_t t4( of_size(2,2,2,2) ); NT2_TEST_EQUAL( numel(t0), 0U ); NT2_TEST_EQUAL( numel(t1), 2U ); NT2_TEST_EQUAL( numel(t2), 4U ); NT2_TEST_EQUAL( numel(t3), 8U ); NT2_TEST_EQUAL( numel(t4), 16U ); } //////////////////////////////////////////////////////////////////////////////// // numel of table //////////////////////////////////////////////////////////////////////////////// NT2_TEST_CASE( table_numel ) { using nt2::numel; using nt2::of_size; using nt2::table; table<float> t0; table<float> t1( of_size(2) ); table<float> t2( of_size(2,2) ); table<float> t3( of_size(2,2,2) ); table<float> t4( of_size(2,2,2,2) ); NT2_TEST_EQUAL( numel(t0), 0U ); NT2_TEST_EQUAL( numel(t1), 2U ); NT2_TEST_EQUAL( numel(t2), 4U ); NT2_TEST_EQUAL( numel(t3), 8U ); NT2_TEST_EQUAL( numel(t4), 16U ); } //////////////////////////////////////////////////////////////////////////////// // numel of table expression //////////////////////////////////////////////////////////////////////////////// NT2_TEST_CASE( expression_numel ) { using nt2::numel; using nt2::of_size; using nt2::table; table<float> t0; table<float> t1( of_size(2) ); table<float> t2( of_size(2,2) ); table<float> t3( of_size(2,2,2) ); table<float> t4( of_size(2,2,2,2) ); NT2_TEST_EQUAL( numel(-t0), 0U ); NT2_TEST_EQUAL( numel(t1*t1), 2U ); NT2_TEST_EQUAL( numel(t2-t2*t2), 4U ); NT2_TEST_EQUAL( numel(t3/t3+t3), 8U ); NT2_TEST_EQUAL( numel(t4 * -t4), 16U ); } NT2_TEST_CASE( static_numel ) { using nt2::numel; using nt2::of_size_; using nt2::table; using boost::mpl::_; float a; of_size_<2, 3> b; table<float, of_size_<2, 3> > c; boost::mpl::vector_c<nt2::int16_t,2,3,4> mv; NT2_TEST_EXPR_TYPE( numel(a) , _ , boost::mpl::size_t<1> ); NT2_TEST_EXPR_TYPE( numel(b) , _ , ( boost::mpl::integral_c<std::size_t, 6> ) ); NT2_TEST_EXPR_TYPE( numel(c) , _ , ( boost::mpl::integral_c<std::size_t, 6> ) ); NT2_TEST_EXPR_TYPE( numel(mv) , _ , ( boost::mpl::integral_c<nt2::int16_t, 24> ) ); } <|start_filename|>modules/arch/cuda/include/nt2/sdk/cuda/cuda.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2011 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2011 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_SDK_CUDA_CUDA_HPP_INCLUDED #define NT2_SDK_CUDA_CUDA_HPP_INCLUDED #include <boost/dispatch/functor/forward.hpp> namespace nt2 { namespace tag { template<typename Site> struct cuda_ : Site { typedef Site parent; }; } } #ifdef NT2_HAS_CUDA BOOST_DISPATCH_COMBINE_SITE( nt2::tag::cuda_<tag::cpu_> ) #endif #endif <|start_filename|>modules/core/trigonometric/include/nt2/trigonometric/functions/sincos.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_TRIGONOMETRIC_FUNCTIONS_SINCOS_HPP_INCLUDED #define NT2_TRIGONOMETRIC_FUNCTIONS_SINCOS_HPP_INCLUDED #include <nt2/include/functor.hpp> namespace nt2 { namespace tag { /// @brief Hierarchy tag for sincos function struct sincos_ : ext::elementwise_<sincos_> { /// @brief Parent hierarchy typedef ext::elementwise_<sincos_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_sincos_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::sincos_, Site> dispatching_sincos_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::sincos_, Site>(); } template<class... Args> struct impl_sincos_; } /*! Computes simultaneously the sine and cosine of the input @par Semantic: For every parameters of floating type T0: @code T0 s, c; tie(s, c) = sincos(x); @endcode is similar to: @code T0 s = sin(x); T0 c = cos(x); @endcode @see @funcref{fast_sincos}, @funcref{sincosine}, @funcref{sincosd}, @funcref{sincospi} @param a0 angle in radian @return A Fusion Sequence containing the sin and cos of @c a0 **/ NT2_FUNCTION_IMPLEMENTATION(tag::sincos_, sincos, 1) /*! Computes simultaneously the sine and cosine of the input @par Semantic: For every parameters of floating type T0: @code T0 s, c; s = sincos(x, c); @endcode is similar to: @code T0 s = sin(x); T0 c = cos(x); @endcode @param a0 angle in radian @param a1 L-Value that will receive the sin of @c a0 @return the sin of a0 **/ NT2_FUNCTION_IMPLEMENTATION_TPL(tag::sincos_, sincos,(A0 const&)(A1&),2) /*! Computes the sine and cosine of the input For every parameters of floating type T0: @par Semantic: @code T0 s, c; sincos(x, s, c); @endcode is similar to: @code T0 s = sin(x); T0 c = cos(x); @endcode @param a0 angle in radian @param a1 L-Value that will receive the sin of @c a0 @param a2 L-Value that will receive the cos of @c a0 **/ NT2_FUNCTION_IMPLEMENTATION_TPL(tag::sincos_, sincos,(A0 const&)(A1&)(A2&),3) } #endif <|start_filename|>modules/core/gallery/include/nt2/gallery/functions/fiedler.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_GALLERY_FUNCTIONS_FIEDLER_HPP_INCLUDED #define NT2_GALLERY_FUNCTIONS_FIEDLER_HPP_INCLUDED #include <nt2/linalg/options.hpp> #include <nt2/include/functor.hpp> #include <nt2/sdk/meta/size_as.hpp> #include <nt2/sdk/meta/value_as.hpp> #include <nt2/core/container/dsl/size.hpp> #include <nt2/sdk/meta/tieable_hierarchy.hpp> #include <nt2/core/container/dsl/value_type.hpp> /*! * \ingroup algebra * \defgroup algebra_fiedler fiedler * * \par Description * Fiedler fiedler matrix. * a = fiedler(c), where c is an n-vector, is the n-by-n * symmetric matrix with elements abs(c(i)-c(j)). if c is a scalar, * then a = fiedler(_(1, c)). * * a has a dominant positive eigenvalue and all the other eigenvalues * are negative. (szego 1936) * * note: explicit formulas for inv(a) and det(a) are given in (todd 1977) * and attributed to fiedler. these indicate that inv(a) is * tridiagonal except for nonzero (1,n) and (n,1) elements. * * references: * [1] <NAME>, solution to problem 3705, amer. math. monthly, * 43 (1936), pp. 246-259. * [2] <NAME>, basic numerical mathematics, vol. 2: numerical algebra, * birkhauser, basel, and academic press, new york, 1977, p. 159. * * Copyright 1984-2002 The MathWorks, Inc. * $Revision: 1.11 $ $Date: 2002/04/15 03:42:11 $ * * \code * #include <nt2/include/functions/fiedler.hpp> * \endcode * * **/ //============================================================================== // fiedler actual class forward declaration //============================================================================== namespace nt2 { namespace tag { /*! * \brief Define the tag fiedler_ of functor fiedler * in namespace nt2::tag for toolbox algebra **/ struct fiedler_ : ext::abstract_<fiedler_> { typedef ext::abstract_<fiedler_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_fiedler_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::fiedler_, Site> dispatching_fiedler_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::fiedler_, Site>(); } template<class... Args> struct impl_fiedler_; } NT2_FUNCTION_IMPLEMENTATION(tag::fiedler_, fiedler, 1) } namespace nt2 { namespace ext { template<class Domain, int N, class Expr> struct size_of<tag::fiedler_,Domain,N,Expr> : meta::size_as<Expr,0> {}; template<class Domain, int N, class Expr> struct value_type<tag::fiedler_,Domain,N,Expr> : meta::value_as<Expr,1> {}; } } #endif <|start_filename|>modules/boost/simd/base/include/boost/simd/arithmetic/functions/arg.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef BOOST_SIMD_ARITHMETIC_FUNCTIONS_ARG_HPP_INCLUDED #define BOOST_SIMD_ARITHMETIC_FUNCTIONS_ARG_HPP_INCLUDED #include <boost/simd/include/functor.hpp> #include <boost/dispatch/include/functor.hpp> namespace boost { namespace simd { namespace tag { /*! @brief arg generic tag Represents the arg function in generic contexts. @par Models: Hierarchy **/ struct arg_ : ext::elementwise_<arg_> { /// @brief Parent hierarchy typedef ext::elementwise_<arg_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_arg_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::arg_, Site> dispatching_arg_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::arg_, Site>(); } template<class... Args> struct impl_arg_; } /*! Computes the angular orientation of its parameter. @par semantic: For any given value @c x of floating type @c T: @code T r = arg(x); @endcode is equivalent to: @code T r = (is_nan(x)) ? x :(x < zero) ? pi : zero; @endcode @par Note: Always 0 or \f$\pi\f$ according to the input sign, or Nan is the input is Nan. This function is the restriction to real numbers of the complex argument function. @par Alias angle @param a0 @return a value of the type T. **/ BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::arg_, arg, 1) BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::arg_, angle, 1) } } #endif <|start_filename|>modules/core/statistics/include/nt2/statistics/functions/gampdf.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_STATISTICS_FUNCTIONS_GAMPDF_HPP_INCLUDED #define NT2_STATISTICS_FUNCTIONS_GAMPDF_HPP_INCLUDED #include <nt2/include/functor.hpp> namespace nt2 { namespace tag { /*! @brief gampdf generic tag Represents the gampdf function in generic contexts. @par Models: Hierarchy **/ struct gampdf_ : ext::elementwise_<gampdf_> { /// @brief Parent hierarchy typedef ext::elementwise_<gampdf_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_gampdf_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::gampdf_, Site> dispatching_gampdf_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::gampdf_, Site>(); } template<class... Args> struct impl_gampdf_; } /*! gamma distribution @par Semantic: For every table expressions @code auto r = gampdf(a0, shape, scale); @endcode is similar to: @code auto r = (exp((1-shape)*log(a0/scale)-a0-gammaln(shape))/scale; @endcode @see @funcref{exp}, @funcref{log}, @funcref{gammaln}, @param a0 @param a1 shape @param a2 optional scale (default to 1) @return an expression which eventually will evaluate to the result **/ NT2_FUNCTION_IMPLEMENTATION(tag::gampdf_, gampdf, 3) /// @overload NT2_FUNCTION_IMPLEMENTATION(tag::gampdf_, gampdf, 2) } #endif <|start_filename|>modules/core/reduction/include/nt2/core/functions/nansum.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // Copyright 2011 - 2012 MetaScale SAS // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_CORE_FUNCTIONS_NANSUM_HPP_INCLUDED #define NT2_CORE_FUNCTIONS_NANSUM_HPP_INCLUDED #include <nt2/include/functor.hpp> namespace nt2 { namespace tag { /*! @brief Tag for the nansum functor **/ struct nansum_ : ext::abstract_<nansum_> { /// @brief Parent hierarchy typedef ext::abstract_<nansum_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_nansum_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::nansum_, Site> dispatching_nansum_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::nansum_, Site>(); } template<class... Args> struct impl_nansum_; } /*! @brief sum of a table expression, suppressing Nans Computes the sum of the non nan elements of a table expression along a given dimension. @par Semantic For any table expression @c t and any integer @c n: @code auto r = nansum(t,n); @endcode is equivalent to: @code auto r = sum(if_zero_else(isnan(t), t),n); @endcode @par Note: n default to firstnonsingleton(t) @see @funcref{firstnonsingleton}, @funcref{sum}, @funcref{if_zero_else} @param a0 Table expression to process @param a1 Dimension along which to process a0 @return An expression eventually evaluated to the result */ NT2_FUNCTION_IMPLEMENTATION(nt2::tag::nansum_ , nansum, 2) /// @overload NT2_FUNCTION_IMPLEMENTATION(nt2::tag::nansum_ , nansum, 1) } #endif <|start_filename|>modules/core/sdk/include/nt2/sdk/meta/is_container.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2011 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2011 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_SDK_META_IS_CONTAINER_HPP_INCLUDED #define NT2_SDK_META_IS_CONTAINER_HPP_INCLUDED #include <boost/mpl/bool.hpp> #include <boost/mpl/or.hpp> namespace nt2 { namespace details { template<class T, class Enable = void> struct is_container : boost::mpl::false_ {}; template<class T, class Enable = void> struct is_container_ref : boost::mpl::false_ {}; } namespace meta { //========================================================================== /*! * Checks if a given type satisfy the Container concept. * * \tparam T Type to qualify as a potential Container */ //========================================================================== template<class T> struct is_container : details::is_container<T> {}; template<class T> struct is_container<T&> : is_container<T> {}; template<class T> struct is_container<T const> : is_container<T> {}; template<class T> struct is_container_ref : details::is_container_ref<T> {}; template<class T> struct is_container_ref<T&> : is_container_ref<T> {}; template<class T> struct is_container_ref<T const> : is_container_ref<T> {}; template<class T> struct is_container_or_ref : boost::mpl::or_< is_container<T> , is_container_ref<T> > { }; /*! @brief Is an expression a container terminal Checks if a given type T is a terminal holding a container. @tparam T Type to check **/ template<class T, long Arity = T::proto_arity_c> struct is_container_terminal : boost::mpl::false_ { }; /// INTERNAL ONLY template<class T> struct is_container_terminal<T, 0l> : meta::is_container<typename T::proto_child0> { }; } } #endif <|start_filename|>modules/core/extractive/include/nt2/core/functions/tril.hpp<|end_filename|> //============================================================================== // Copyright 2003 & onward LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 & onward LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_CORE_FUNCTIONS_TRIL_HPP_INCLUDED #define NT2_CORE_FUNCTIONS_TRIL_HPP_INCLUDED #include <nt2/include/functor.hpp> namespace nt2 { namespace tag { /*! @brief tril generic tag Represents the tril function in generic contexts. @par Models: Hierarchy **/ struct tril_ : ext::elementwise_<tril_> { /// @brief Parent hierarchy typedef ext::elementwise_<tril_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_tril_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::tril_, Site> dispatching_tril_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::tril_, Site>(); } template<class... Args> struct impl_tril_; } /*! @brief Apply a lower-triangular masking to an expression returns the elements on and below the diagonal of @c a0 and 0 elsewhere. @param a0 Expression to mask. **/ NT2_FUNCTION_IMPLEMENTATION(nt2::tag::tril_, tril, 1) /*! @brief Apply an offset lower-triangular masking to an expression returns the elements on and below the @c a1-th diagonal of @c a0, 0 elsewhere. - @c a1 = 0 is the main diagonal, - @c a1 > 0 is above the main diagonal, - @c a1 < 0 is below the main diagonal. @see funcref{triu}, funcref{tri1u}, funcref{tri1l} @param a0 Expression to mask. @param a1 Diagonal offset to the mask. **/ NT2_FUNCTION_IMPLEMENTATION(nt2::tag::tril_, tril, 2) } #endif <|start_filename|>modules/boost/simd/base/include/boost/simd/ieee/functions/negatenz.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef BOOST_SIMD_IEEE_FUNCTIONS_NEGATENZ_HPP_INCLUDED #define BOOST_SIMD_IEEE_FUNCTIONS_NEGATENZ_HPP_INCLUDED #include <boost/simd/include/functor.hpp> #include <boost/dispatch/include/functor.hpp> namespace boost { namespace simd { namespace tag { /*! @brief negatenz generic tag Represents the negatenz function in generic contexts. @par Models: Hierarchy **/ struct negatenz_ : ext::elementwise_<negatenz_> { /// @brief Parent hierarchy typedef ext::elementwise_<negatenz_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_negatenz_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::negatenz_, Site> dispatching_negatenz_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::negatenz_, Site>(); } template<class... Args> struct impl_negatenz_; } /*! Returns a0 multiplied by the signnz of a1 The result is unspecified if a1 is NaN @par Semantic: @code T r = negatenz(a0,a1); @endcode is similar to: @code T r = a0*signnz(a1) @endcode @param a0 @param a1 @return a value of same type as the inputs **/ BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::negatenz_, negatenz, 2) } } #endif <|start_filename|>modules/core/euler/include/nt2/euler/constants/pi2o_6.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2011 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2011 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_EULER_CONSTANTS_PI2O_6_HPP_INCLUDED #define NT2_EULER_CONSTANTS_PI2O_6_HPP_INCLUDED #include <boost/simd/include/functor.hpp> #include <boost/simd/constant/hierarchy.hpp> #include <boost/simd/constant/register.hpp> #include <boost/config.hpp> #ifdef BOOST_MSVC #pragma warning(push) #pragma warning(disable: 4310) // truncation of constant #endif namespace nt2 { namespace tag { /*! @brief Pi2o_6 generic tag Represents the Pi2o_6 constant in generic contexts. @par Models: Hierarchy **/ BOOST_SIMD_CONSTANT_REGISTER( Pi2o_6, double , 2, 0x3fd28d33LL , 0x3ffa51a6625307d3ULL ) } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::Pi2o_6, Site> dispatching_Pi2o_6(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::Pi2o_6, Site>(); } template<class... Args> struct impl_Pi2o_6; } /*! Generates \f$ \pi^2/6\f$ @par Semantic: @code T r = Pi2o_6<T>(); @endcode is similar to: @code T r = sqr(Pi<T>())/Six<T>(); @endcode **/ BOOST_SIMD_CONSTANT_IMPLEMENTATION(tag::Pi2o_6, Pi2o_6); } #ifdef BOOST_MSVC #pragma warning(pop) #endif #include <boost/simd/constant/common.hpp> #endif <|start_filename|>modules/core/statistics/include/nt2/statistics/functions/normstat.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_STATISTICS_FUNCTIONS_NORMSTAT_HPP_INCLUDED #define NT2_STATISTICS_FUNCTIONS_NORMSTAT_HPP_INCLUDED #include <nt2/include/functor.hpp> namespace nt2 { namespace tag { /// @brief Hierarchy tag for normstat function struct normstat_ : ext::elementwise_<normstat_> { /// @brief Parent hierarchy typedef ext::elementwise_<normstat_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_normstat_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::normstat_, Site> dispatching_normstat_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::normstat_, Site>(); } template<class... Args> struct impl_normstat_; } /*! Computes mean and variance of the normal distribution from mean and standard deviation @par Semantic: For every parameters of floating type T0: @code T0 m, v; tie(m, v) = normstat(mu, sigma); @endcode is similar to: @code T0 m = mu; T0 v = sqr(sigma); @endcode @see @funcref{normpdf}, @funcref{normcdf}, @funcref{norminv}, @funcref{normrnd} @param mu mean @param sigma standard deviation @return A Fusion Sequence containing m and v **/ NT2_FUNCTION_IMPLEMENTATION(tag::normstat_, normstat, 2) /*! Computes mean and variance of the normal distribution from mean and standard deviation @par Semantic: For every parameters of floating type T0: @code T0 m, v; m = normstat(mu, sigma, v); @endcode is similar to: @code T0 m = mu; T0 v = sqr(sigma); @endcode @see @funcref{normpdf}, @funcref{normcdf}, @funcref{norminv}, @funcref{normrnd} @param mu mean @param sigma standard deviation @param v L-Value that will receive the variance @return m **/ NT2_FUNCTION_IMPLEMENTATION_TPL(tag::normstat_, normstat,(A0 const&)(A1 const&)(A2&),3) /*! Computes mean and variance of the normal distribution from mean and standard deviation @par Semantic: For every parameters of floating type T0: @code T0 m, v; normstat(mu, sigma, m, v); @endcode is similar to: @code T0 m = mu; T0 v = sqr(sigma); @endcode @see @funcref{normpdf}, @funcref{normcdf}, @funcref{norminv}, @funcref{normrnd} @param mu mean @param sigma standard deviation @return m and computes v @param a0 angle in radian @param a1 L-Value that will receive the mean value @param a2 L-Value that will receive the variance **/ NT2_FUNCTION_IMPLEMENTATION_TPL(tag::normstat_, normstat,(A0 const&)(A1 const&)(A2&)(A3&),4) } #endif <|start_filename|>modules/core/base/include/nt2/operator/functions/casts.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2014 LRI UMR 8623 CNRS/Univ Paris Sud XI // Copyright 2012 - 2014 MetaScale SAS // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_OPERATOR_FUNCTIONS_CASTS_HPP_INCLUDED #define NT2_OPERATOR_FUNCTIONS_CASTS_HPP_INCLUDED #include <nt2/include/functor.hpp> namespace nt2 { namespace tag { /*! @brief Tag for the casts functor **/ struct casts_ : ext::abstract_<casts_> { typedef ext::abstract_<casts_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_casts_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::casts_, Site> dispatching_casts_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::casts_, Site>(); } template<class... Args> struct impl_casts_; } /*! @brief Expression level type castsing casts convert the value of an expression into values of a different type, with saturation. @tparam T Type to convert a0 to. @param a0 Expression to typecasts **/ template<class T, class A0> BOOST_FORCEINLINE typename meta::call<tag::casts_(A0 const&, meta::as_<T> const&)>::type casts(A0 const& a0) { return typename make_functor<tag::casts_, A0>::type()(a0, meta::as_<T>()); } /*! @brief Expression level type castsing casts convert the value of an expression into values of a different type, with saturation. @param a0 Expression to typecasts @param c Typeclass to convert a0 to **/ template<class T, class A0> BOOST_FORCEINLINE typename meta::call<tag::casts_(A0 const&, meta::as_<T> const&)>::type casts(A0 const& a0, meta::as_<T> const& c) { return typename make_functor<tag::casts_, A0>::type()(a0, c); } } #endif <|start_filename|>modules/core/polynom/include/nt2/polynom/functions/polysub.hpp<|end_filename|> //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_POLYNOM_FUNCTIONS_POLYSUB_HPP_INCLUDED #define NT2_POLYNOM_FUNCTIONS_POLYSUB_HPP_INCLUDED #include <nt2/include/functor.hpp> #include <nt2/sdk/meta/size_as.hpp> #include <nt2/sdk/meta/value_as.hpp> #include <nt2/core/container/dsl/size.hpp> #include <nt2/sdk/meta/tieable_hierarchy.hpp> #include <nt2/core/container/dsl/value_type.hpp> namespace nt2 { namespace tag { /*! @brief polysub generic tag Represents the polysub function in generic contexts. @par Models: Hierarchy **/ struct polysub_ : ext::elementwise_<polysub_> { /// @brief Parent hierarchy typedef ext::elementwise_<polysub_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_polysub_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site> BOOST_FORCEINLINE generic_dispatcher<tag::polysub_, Site> dispatching_polysub_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...) { return generic_dispatcher<tag::polysub_, Site>(); } template<class... Args> struct impl_polysub_; } /*! Computes the difference of two polynomials. The polynomials are supposed to be given by an expression representing a vector of coefficients in decreasing degrees order @par Semantic: For every expressions representing polynomials a, b: @code auto r = polysub(a0,a1); @endcode is such that if a represents \f$\displaystyle \sum_0^n a_i x^i\f$ and b represents \f$\displaystyle \sum_0^n b_ix^i\f$ then r represents \f$\displaystyle \sum_0^n(a_i-b_i)x^i\f$ @param a0 @param a1 @return a value of the same type as the parameter **/ NT2_FUNCTION_IMPLEMENTATION(tag::polysub_, polysub, 2) } #endif
feelpp/nt2
<|start_filename|>test/stress.js<|end_filename|> var RotatingFileStream = require('../index'); var bunyan = require('bunyan'); var uuid = require('uuid'); var mkdirp = require('mkdirp'); var EventEmitter = require('events').EventEmitter; var logzionodejs = require('logzio-nodejs'); var fs = require('fs'); var async = require('async'); var path = require('path'); var apikey = process.argv[2]; var logzio; if (apikey && apikey !== 'local') { logzio = logzionodejs.createLogger({ token: apikey, type: 'rfs ' + process.version }); } else { logzio = {log: function() {}}; } var _ = require('lodash'); var Combinatorics = require('js-combinatorics'); var combinations = { level: ['debug', 'info', 'warn', 'error', 'fatal'], period: ['1m', '1h', '1d', '1m', ''], threshold: [0, 1, 10240, '100k', '1m', '1g'], totalFiles: [0, 1, 2, 5, 10, 20], totalSize: [0, '100k', '1m', '10m', '100m', '1g'], rotateExisting: [true, false], startNewFile: [true, false], gzip: [true, false] }; function validConfig(config) { var valid = (config.totalFiles != 0 || config.totalSize != 0) && (config.threshold != 1 || config.totalFiles != 0) && (config.period != 0 || config.threshold != 0); return valid; } function PerfStats() { var queuelength = 0, byteswritten = 0, logswritten = 0, rotations = 0, rotationtime = 0; function queued(new_queuelength) { queuelength = new_queuelength; } function writebatch(batch_byteswritten, batch_logswritten, batch_queuelength) { queuelength = batch_queuelength; byteswritten += batch_byteswritten; logswritten += batch_logswritten; } function rotation(duration) { rotations += 1; rotationtime += duration; } function report(report) { report.streams += 1; report.queued += queuelength; report.written += logswritten; report.max_queued = queuelength > report.max_queued || report.max_queued === null ? queuelength : report.max_queued; report.min_queued = queuelength < report.min_queued || report.min_queued === null ? queuelength : report.min_queued; report.rotations += rotations; report.rotationtime += rotationtime; } return { queued: queued, writebatch: writebatch, rotation: rotation, report: report }; } function PerfMon() { var base = new EventEmitter(); var stats = []; function addStream(stream) { var stat = PerfStats(); stream.on('perf-queued', stat.queued); stream.on('perf-writebatch', stat.writebatch); stream.on('perf-rotation', stat.rotation); stats.push(stat); } var lastqueued = 0; var lastrotations = 0; var lastrotationtime = 0; var lastwritten = 0; var lastrecordtime = Date.now(); setInterval(function () { var report = { streams: 0, written: 0, queued: 0, max_queued: null, min_queued: null, rotations: 0, rotationtime:0 }; stats.forEach(function (stat) { stat.report(report); }) var period_rotations = report.rotations - lastrotations; var period_rotationtime = report.rotationtime - lastrotationtime; var period_written = report.written - lastwritten; var period_queued = report.queued - lastqueued; lastrotations = report.rotations; lastrotationtime = report.rotationtime; lastwritten = report.written; lastqueued = report.queued; lastrecordtime = Date.now(); report.period_rotations = period_rotations; report.period_rotationtime = period_rotationtime; report.period_averagerotation = period_rotationtime / period_rotations; report.period_written = period_written; report.period_queued = period_queued; base.emit('report', report); }, 10000); return _.extend({}, { addStream: addStream }, base); } function expandCombinations() { var combi = Combinatorics.cartesianProduct( ['1h', '1d', 'X'], [0, 1, '1m', '10m'], [0, 10], [0, '10m'], [true, false], ['basic.log', 'withinsert-%N-file.log', 'datestamped-%Y-%m-%d.log', 'datestampinsterted-%Y-%m-%d-%N-file.log', 'timestamped-%Y-%m-%d-%H-%M-%S.log', 'timestampinserted-%Y-%m-%d-%H-%M-%S-%N-file.log'] ); var streams = []; var dedupe = {}; combi.toArray().forEach(function (streamdef) { var name = streamdef.join('-'); dedupe[name] = 1; var config = { path: 'testlogs/stress/' + name, period: streamdef[0] === 'X' ? 0 : streamdef[0], threshold: streamdef[1], totalFiles: streamdef[2], totalSize: streamdef[3], gzip: streamdef[4] }; if (validConfig(config)) { var stream = { type: 'raw', level: 'debug', stream: RotatingFileStream(config) }; streams.push(stream); } }); return streams; } function hardcodedStreams() { return [{ type: 'raw', level: 'debug', stream: RotatingFileStream({ path: 'testlogs/stress/X-1-10-0-true-datestamped-%Y-%m-%d.log', period: 0, // daily rotation threshold: 1, totalFiles: 10, totalSize: 0, gzip: true }) }] } var log; var multiplier = 4.0; function slowdown() { multiplier *= 1.015; } function speedup() { multiplier *= 0.99; } var i = 0; var active = true; function debugLogger() { setTimeout(function () { log.debug({source: "debugLogger", i: i, data: uuid.v4()}); i += 1; active && debugLogger(); }, (Math.random() * 100) + 500 * multiplier); } function infoLogger() { setTimeout(function () { log.info({source: "infoLogger", i: i, data: uuid.v4()}); i += 1; active && infoLogger(); }, (Math.random() * 1000) + 1000 * multiplier); } function warningLogger() { setTimeout(function () { log.warn({source: "warningLogger", i: i, data: uuid.v4()}); i += 1; active && warningLogger(); }, (Math.random() * 5000) + 10000 * multiplier); } function errorLogger() { setTimeout(function () { log.error({source: "errorLogger", i: i, data: uuid.v4()}); i += 1; active && errorLogger(); }, (Math.random() * 5000) + 10000 * multiplier); } mkdirp('testlogs/stress', function () { var streams = expandCombinations(); // var streams = hardcodedStreams(); var perfMon = PerfMon(); streams.forEach(function (stream) { perfMon.addStream(stream.stream); }); perfMon.on('report', function (report) { report.multiplier = multiplier; var outputpath = 'testlogs/stress'; async.waterfall([ function getFiles(callback) { fs.readdir(outputpath, callback); }, function buildPathsOnFiles(files, callback) { async.map(files, function (file, callback) { callback(null, path.join(outputpath,file)); }, callback); }, function statEachFile(files, callback) { async.map(files, function (item, callback) { fs.stat(item, function (err, stat) { if (err) { if (err.code === 'ENOENT') { callback(null, {size: 0}); } else { callback(err); } } else { callback(null, stat); } }) }, callback); }, function generateStatistics(filestats, callback) { async.reduce(filestats, {count: 0, size: 0}, function (memo, item, callback) { memo.count += 1; memo.size += item.size; callback(null, memo); }, callback); } ], function (err, result) { if (err) { console.log('results', arguments); report.files = 0; report.filesize = 0; report.err = err; } else { report.files = result.count; report.filesize = result.size; report.err = null; } console.log(report); logzio.log(report); }); if (report.period_queued > 100) { slowdown(); } if (report.period_queued > 1000) { slowdown(); } if (report.queued > 10000 && report.period_queued > -100) { slowdown(); } if (report.queued > 20000 && report.period_queued > -100) { slowdown(); } if (report.min_queued > 100 && report.period_queued > -100) { slowdown(); } if (report.queued < 1000) { speedup(); } if (report.period_queued < -1000) { speedup(); } if (report.max_queued < 5) { speedup(); } }); log = bunyan.createLogger({ name: 'foo', streams: streams }); debugLogger(); infoLogger(); warningLogger(); errorLogger(); });
comx/bunyan-rotating-file-stream
<|start_filename|>public/css/press.css<|end_filename|> @charset "UTF-8"; /** * Nestable */ .dd { position: relative; display: block; margin: 0; padding: 0; max-width: 100%; list-style: none; font-size: 13px; line-height: 20px; /** * Nestable Extras */ /** * Nestable Draggable Handles */ } .dd .edit { position: absolute; margin: 0; right: 0; top: 0; cursor: pointer; width: 40px; text-indent: 100%; white-space: nowrap; overflow: hidden; border: 1px solid #ebebeb; background: #ffffff; border-top-right-radius: 0; padding: 10px 10px; height: 42px; } .dd .edit:before { display: block; position: absolute; left: 0; top: 10px; width: 100%; text-align: center; text-indent: 0; color: #495057; font-size: 15px; font-weight: normal; } .dd .dd-list { display: block; position: relative; margin: 0; padding: 0; list-style: none; } .dd .dd-list .dd-list { padding-left: 30px; } .dd .dd-dragel .edit { display: none; } .dd .dd-item, .dd .dd-empty, .dd .dd-placeholder { display: block; position: relative; margin: 0; padding: 0; min-height: 20px; font-size: 13px; line-height: 20px; } .dd .dd-item.dd-collapsed .dd-list, .dd .dd-item.dd-collapsed .dd-collapse { display: none; } .dd .dd-item.dd-collapsed .dd-expand { display: block; } .dd .dd-handle, .dd .dd3-content { display: block; margin: 5px 0; padding: 10px 10px; text-decoration: none; border: 1px solid #ebebeb; background: #ffffff; border-radius: 3px; } .dd .dd-handle:hover, .dd .dd3-content:hover { background: #ffffff; } .dd .dd3-content { padding: 10px 10px 10px 50px; } .dd .dd-item > button { display: block; position: relative; cursor: pointer; float: left; width: 25px; height: 30px; margin: 5px 0; padding: 0; text-indent: 100%; white-space: nowrap; overflow: hidden; border: 0; background: transparent; font-size: 12px; line-height: 1; text-align: center; font-weight: bold; } .dd .dd-item > button.dd-expand { display: none; } .dd .dd-item > button:before { content: "+"; display: block; position: absolute; width: 100%; text-align: center; text-indent: 0; } .dd .dd-item > button[data-action=collapse]:before { content: "-"; } .dd .dd-placeholder { margin: 5px 0; padding: 0; min-height: 30px; background: #f2fbff; border: 1px dashed #b6bcbf; box-sizing: border-box; -moz-box-sizing: border-box; } .dd .dd-empty { margin: 5px 0; padding: 0; box-sizing: border-box; -moz-box-sizing: border-box; border: 1px dashed #bbbbbb; min-height: 100px; background-size: 60px 60px; background: #e5e5e5 0 0, 30px 30px; } .dd .dd-dragel { position: absolute; pointer-events: none; z-index: 9999; } .dd .dd-dragel > .dd-item .dd-handle { margin-top: 0; } .dd .dd-dragel .dd-handle { box-shadow: 2px 4px 6px 0 rgba(0, 0, 0, 0.1); } .dd .nestable-lists { display: block; clear: both; padding: 30px 0; width: 100%; border: 0; border-top: 2px solid #dddddd; border-bottom: 2px solid #dddddd; } @media only screen and (min-width: 700px) { .dd .dd + .dd { margin-left: 2%; } } .dd .dd-hover > .dd-handle { background: #2ea8e5 !important; } .dd .dd-dragel > .dd3-item > .dd3-content { margin: 0; } .dd .dd3-item > button { margin-left: 40px; } .dd .dd3-handle { position: absolute; margin: 0; left: 0; top: 0; cursor: pointer; width: 40px; text-indent: 100%; white-space: nowrap; overflow: hidden; border: 1px solid #ebebeb; background: #ffffff; color: #ffffff; border-top-right-radius: 0; border-bottom-right-radius: 0; } .dd .dd3-handle:before { content: "\2261"; display: block; position: absolute; left: 0; top: 10px; width: 100%; text-align: center; text-indent: 0; color: #495057; font-size: 20px; font-weight: normal; } .dd .dd3-handle:hover { background: #f7f7f7; } <|start_filename|>package.json<|end_filename|> { "private": true, "scripts": { "dev": "NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js", "watch": "NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js", "hot": "NODE_ENV=development webpack-dev-server --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js", "production": "NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js", "eslint": "./node_modules/.bin/eslint resources/js/ --fix" }, "dependencies": { "@babel/plugin-proposal-class-properties": "^7.5.5", "@babel/plugin-transform-block-scoping": "^7.6.0", "@babel/preset-env": "^7.6.0", "axios": "^0.18.1", "babel-preset-env": "^1.7.0", "bootstrap": "^4.3.1", "cross-env": "^5.2.1", "jquery": "^3.4.1", "laravel-mix": "4.0.14", "nestable2": "^1.6.0", "popper.js": "^1.15.0", "startbootstrap-clean-blog": "^5.0.7", "startbootstrap-creative": "^5.1.7", "stimulus": "^1.1.1", "turbolinks": "^5.2.0", "vue": "^2.5.7" }, "devDependencies": { "resolve-url-loader": "2.3.1", "sass": "^1.22.10", "sass-loader": "^7.3.1", "vue-template-compiler": "^2.6.10" } } <|start_filename|>public/mix-manifest.json<|end_filename|> { "/clean-blog/js/app.js": "/clean-blog/js/app.js", "/js/press.js": "/js/press.js", "/css/press.css": "/css/press.css", "/clean-blog/css/app.css": "/clean-blog/css/app.css" } <|start_filename|>resources/js/app.js<|end_filename|> import ComponentsMenu from "./controllers/components/menu_controller"; import FieldsTag from "./controllers/fields/tag_controller"; require('nestable2'); //We can work with this only when we already have an application if (typeof window.application !== 'undefined') { window.application.register('components--menu', ComponentsMenu); window.application.register('fields--tag', FieldsTag); } <|start_filename|>resources/lang/ru.json<|end_filename|> { "Add link to browser favorites": "Добавить ссылку в избранное браузера", "Answer to the question": "Ответ на вопрос", "Categories": "Категории", "Category": "Категории", "Category name": "Название категории", "Category title": "Название категории", "Category was removed": "Категория была удалена", "Category was saved": "Категория была сохранена", "Comment": "Комментарий", "Comment was removed": "Комментарий был удален", "Comment was saved": "Комментарий был сохранен", "Comments": "Комментарии", "Comments allow your website's visitors to have a discussion with you and each other.": "Комментарии позволяют посетителям вашего сайта общаться с вами и друг с другом.", "Do not pass HTTP headers over the link": "Не передавать по ссылке HTTP-заголовки", "Do not pass on the link TIC and PR.": "Не передавать по ссылке ТИЦ и PR.", "Editable version of the current document": "Редактируемая версия текущего документа", "Indicates that the tag (tag) is relevant to the current document": "Указывает, что метка (тег) имеет отношение к текущему документу", "Indicates that you must cache the specified resource in advance": "Указывает, что надо заранее кэшировать указанный ресурс", "Link to a colleague's page": "Ссылка на страницу коллеги по работе", "Link to a colleague's page (not at work)": "Ссылка на страницу коллеги (не по работе)", "Link to a document with help": "Ссылка на документ со справкой", "Link to a page with a license agreement or copyrights": "Ссылка на страницу с лицензионным соглашением или авторскими правами", "Link to author page on another domain": "Ссылка на страницу автора на другом домене", "Link to content": "Ссылка на содержание", "Link to friend page": "Ссылка на страницу друга", "Link to next page or section": "Ссылка на следующую страницу или раздел", "Link to page with details": "Ссылка на страницу с подробностями", "Link to search": "Ссылка на поиск", "Link to the first page": "Ссылка на первую страницу", "Link to the last page": "Ссылка на последнюю страницу", "Link to the page about the author on the same domain": "Ссылка на страницу об авторе на том же домене", "Link to the page with contact information": "Ссылка на страницу с контактной информацией", "Link to the parent page": "Ссылка на родительскую страницу", "Link to the previous page or section": "Ссылка на предыдущую страницу или раздел", "Link to the site archive": "Ссылка на архив сайта", "Menu": "Меню", "Permanent link to a section or entry": "Постоянная ссылка на раздел или запись", "Posted by": "Опубликовано", "Page": "Страница", "Post": "Запись", "Posts": "Записи", "Question": "Вопрос", "Section or chapter of the current document": "Раздел или глава текущего документа", "Header menu": "Верхнее меню", "Sidebar menu": "Боковое меню", "Footer menu": "Нижнее меню" }
tabuna/CMS2
<|start_filename|>redis-manager-dashboard/src/main/java/com/newegg/ec/redis/util/RedisNodeUtil.java<|end_filename|> package com.newegg.ec.redis.util; import com.newegg.ec.redis.entity.RedisNode; import java.util.List; import java.util.Objects; import static com.newegg.ec.redis.entity.RedisNode.CONNECTED; import static com.newegg.ec.redis.entity.RedisNode.UNCONNECTED; import static com.newegg.ec.redis.util.RedisUtil.REDIS_MODE_CLUSTER; /** * @author Jay.H.Zou * @date 4/5/2020 */ public class RedisNodeUtil { private RedisNodeUtil() { } public static boolean equals(RedisNode redisNode1, RedisNode redisNode2) { return Objects.equals(redisNode1.getHost(), redisNode2.getHost()) && redisNode1.getPort() == redisNode2.getPort(); } public static void setRedisRunStatus(String redisModel, List<RedisNode> redisNodeList) { redisNodeList.forEach(redisNode -> { setRedisRunStatus(redisModel, redisNode); }); } public static void setRedisRunStatus(String redisModel, RedisNode redisNode) { boolean telnet = NetworkUtil.telnet(redisNode.getHost(), redisNode.getPort()); redisNode.setRunStatus(telnet); if (!Objects.equals(redisModel, REDIS_MODE_CLUSTER)) { redisNode.setLinkState(telnet ? CONNECTED : UNCONNECTED); } } } <|start_filename|>redis-manager-dashboard/src/main/java/com/newegg/ec/redis/plugin/rct/report/impl/PrefixDataConverse.java<|end_filename|> package com.newegg.ec.redis.plugin.rct.report.impl; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.newegg.ec.redis.entity.ExcelData; import com.newegg.ec.redis.entity.ReportData; import com.newegg.ec.redis.plugin.rct.report.IAnalyzeDataConverse; import com.newegg.ec.redis.util.BytesConverseUtil; import com.newegg.ec.redis.util.ListSortUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.text.DecimalFormat; import java.util.*; /** * @ClassName PrefixDataConverseService * @Description TODO * @Author kz37 * @Date 2018/10/19 */ public class PrefixDataConverse implements IAnalyzeDataConverse { private final static Logger LOG = LoggerFactory.getLogger(PrefixDataConverse.class); private static DecimalFormat df = new DecimalFormat("0.0000"); /** * 转换数据 * @param newSetData '{"prefix":"kyle","itemCount":"2","bytes":"1056"}' * @param oldSetData * @return */ @Override public Map<String, List<ExcelData>> getPrefixAnalyzerData(Set<String> newSetData, Map<String, ReportData> latestPrefixData) { Map<String, ReportData> reportDataMap = toReportDataMap(newSetData); //计算增长率 if(null != latestPrefixData) { setGrowthRate(reportDataMap, latestPrefixData); } Map<String, List<ExcelData>> mapResult = getPrefixAnalyzerBodyData(reportDataMap); List<ExcelData> excelDataList = mapResult.get(getMemorySheetName()); for(ExcelData excelData : excelDataList) { //对 list的第2个值做转换,List prefixKey,Memory Size, BytesConverseUtil.converseBytes(excelData.getTableData(), 1); } return mapResult; } // @Override // public Map<String, List<ExcelData>> getExcelDataBytes(Set<String> newSetData) { // Map<String, List<ExcelData>> mapResult = new HashMap<>(2); // Map<String, ReportData> reportDataMap = toReportDataMap(newSetData); // mapResult.putAll(getPrefixAnalyzerBodyData(reportDataMap)); // return mapResult; // } @Override public Map<String, String> getMapJsonString(Set<String> newSetData) { Map<String, String> mapResult = new HashMap<>(2); Map<String, ReportData> reportDataMap = toReportDataMap(newSetData); Map<String, List<ExcelData>> excelDataMap = getPrefixAnalyzerBodyData(reportDataMap); List<JSONObject> dataType = new ArrayList<>(); JSONObject jsonObject; try { // prefix count List<ExcelData> excelDataCountList = excelDataMap.get(getCountSheetName()); for(ExcelData excelData : excelDataCountList) { for(List<String> data : excelData.getTableData()) { jsonObject = new JSONObject(); jsonObject.put("prefixKey", data.get(0)); jsonObject.put("keyCount", data.get(1)); dataType.add(jsonObject); } } mapResult.put(getCountSheetName(), JSON.toJSONString(dataType)); dataType = new ArrayList<>(); // prefix memory List<ExcelData> excelDataMemList = excelDataMap.get(getMemorySheetName()); for(ExcelData excelData : excelDataMemList) { for(List<String> data : excelData.getTableData()) { jsonObject = new JSONObject(); jsonObject.put("prefixKey", data.get(0)); jsonObject.put("memorySize", data.get(1)); dataType.add(jsonObject); } } mapResult.put(getMemorySheetName(), JSON.toJSONString(dataType)); } catch (Exception e) { LOG.error("PrefixDataConverse getMapJsonString faile"); } return mapResult; } private Map<String, ReportData> toReportDataMap(Set<String> newSetData){ Map<String, ReportData> reportDataHashMap = new HashMap<String, ReportData>(100); if(null != newSetData) { JSONObject jsonObject = null; String prefix = null; ReportData reportData = null; for(String object : newSetData) { jsonObject = JSON.parseObject(object); if(jsonObject.containsKey("prefix")){ prefix = jsonObject.getString("prefix"); } if(jsonObject.containsKey("prefixKey")){ prefix = jsonObject.getString("prefixKey"); } reportData = reportDataHashMap.get(prefix); long itemCount = 0L; if(jsonObject.containsKey("itemCount")){ itemCount = Long.parseLong(jsonObject.getString("itemCount")); } if(jsonObject.containsKey("keyCount")){ itemCount = Long.parseLong(jsonObject.getString("keyCount")); } long bytes = 0L; if(jsonObject.containsKey("bytes")){ bytes = Long.parseLong(jsonObject.getString("bytes")); } if(jsonObject.containsKey("memorySize")){ bytes = Long.parseLong(jsonObject.getString("memorySize")); } if(null == reportData) { reportData = new ReportData(); reportData.setCount(itemCount); reportData.setBytes(bytes); reportData.setKey(prefix); } else { reportData.setCount(itemCount+reportData.getCount()); reportData.setBytes(bytes + reportData.getBytes()); } reportDataHashMap.put(prefix, reportData); } } return reportDataHashMap; } private Map<String, ReportData> setGrowthRate(Map<String, ReportData> newReportDataMap, Map<String, ReportData> oldReportDataMap) { ReportData oldReportData = null; ReportData newReportData = null; for(Map.Entry<String, ReportData> entry : oldReportDataMap.entrySet()) { oldReportData = entry.getValue(); newReportData = newReportDataMap.get(oldReportData.getKey()); if(null != newReportData) { newReportData.setCountGrowthRate(calculateGrowthRate(newReportData.getCount(), oldReportData.getCount())); newReportData.setBytesGrowthRate(calculateGrowthRate(newReportData.getBytes(), oldReportData.getBytes())); } } return newReportDataMap; } private Map<String, List<ExcelData>> getPrefixAnalyzerBodyData(Map<String, ReportData> reportDataMap) { Map<String, List<ExcelData>> resultMap = new HashMap<>(5); List<List<String>> countSheetData = new ArrayList<List<String>>(100); List<List<String>> memorySheetData = new ArrayList<List<String>>(100); List<String> oneRow = null; for(Map.Entry<String, ReportData> entry : reportDataMap.entrySet()) { oneRow = converseReportDataToCountList(entry.getValue()); countSheetData.add(oneRow); oneRow = converseReportDataToMemoryList(entry.getValue()); memorySheetData.add(oneRow); } ListSortUtil.sortListListStringDesc(countSheetData, 1); ListSortUtil.sortListListStringDesc(memorySheetData, 1); // BytesConverseUtil.converseBytes(memorySheetData, 1); ExcelData countData = new ExcelData(0, countSheetData); ExcelData memoryData = new ExcelData(0, memorySheetData); List<ExcelData> countListData = new ArrayList<>(); countListData.add(countData); List<ExcelData> memoryListData = new ArrayList<>(); memoryListData.add(memoryData); resultMap.put(getCountSheetName(), countListData); resultMap.put(getMemorySheetName(), memoryListData); return resultMap; } private List<String> converseReportDataToCountList(ReportData reportData) { List<String> result = new ArrayList<>(5); result.add(reportData.getKey()); result.add(String.valueOf(reportData.getCount())); result.add(df.format(reportData.getCountGrowthRate())); return result; } private List<String> converseReportDataToMemoryList(ReportData reportData) { List<String> result = new ArrayList<>(5); result.add(reportData.getKey()); result.add(String.valueOf(reportData.getBytes())); result.add(df.format(reportData.getBytesGrowthRate())); return result; } private double calculateGrowthRate(long newData, long oldData) { if(oldData == 0) { return 0; } double growthRate = (newData - oldData) * 1.0D / oldData; return growthRate; } private String getCountSheetName() { return IAnalyzeDataConverse.PREFIX_KEY_BY_COUNT; } private String getMemorySheetName() { return IAnalyzeDataConverse.PREFIX_KEY_BY_MEMORY; } } <|start_filename|>redis-manager-dashboard/src/main/java/com/newegg/ec/redis/client/IRedisClient.java<|end_filename|> package com.newegg.ec.redis.client; import com.newegg.ec.redis.entity.AutoCommandParam; import com.newegg.ec.redis.entity.NodeRole; import com.newegg.ec.redis.entity.RedisNode; import redis.clients.jedis.ClusterReset; import redis.clients.jedis.HostAndPort; import redis.clients.jedis.Jedis; import redis.clients.jedis.params.MigrateParams; import redis.clients.jedis.util.Slowlog; import java.util.List; import java.util.Map; import java.util.Set; /** * @author Jay.H.Zou * @date 2019/7/18 */ public interface IRedisClient extends IDatabaseCommand { /** * Get jedis client * * @return */ Jedis getJedisClient(); /** * Get redis node info * * @return */ Map<String, String> getInfo() throws Exception; /** * Get redis node info with sub key * * @param section * @return */ Map<String, String> getInfo(String section) throws Exception; Map<String, String> getClusterInfo() throws Exception; Set<String> scan(AutoCommandParam autoCommandParam); /** * Get redis memory info * <p> * Just support redis 4, 4+ * * @return */ String getMemory(); /** * Get redis memory info with sub key * <p> * Just support redis 4, 4+ * * @param subKey * @return */ String getMemory(String subKey); /** * just for standalone mode * * @return */ List<RedisNode> nodes() throws Exception; List<RedisNode> clusterNodes() throws Exception; List<RedisNode> sentinelNodes(Set<HostAndPort> hostAndPorts) throws Exception; Long dbSize(); /** * 持久化 */ String bgSave(); Long lastSave(); String bgRewriteAof(); NodeRole role() throws Exception; /** 客户端于服务端 */ /** * 测试密码是否正确 * * @param password * @return */ boolean auth(String password); /** * stop node * * @return "" */ boolean shutdown(); String clientList(); /** * change config * * @param key * @param value * @return */ boolean setConfig(String key, String value); /** config */ /** * Get redis configuration * * @return */ Map<String, String> getConfig(); /** * Get redis configuration with sub key * * @param pattern * @return */ Map<String, String> getConfig(String pattern); /** * Rewrite redis configuration * * @return */ boolean rewriteConfig(); /** * 该命令主要用于nodes.conf节点状态文件丢失或被删除的情况下重新生成文件。 * * @return */ String clusterSaveConfig(); /** Debug */ /** * Ping redis * * @return */ boolean ping(); /** * Get slow log * * @return */ List<Slowlog> getSlowLog(int size); /** * @return OK */ boolean clientSetName(String clientName); String clusterMeet(String host, int port); /** * Be slave * 重新配置一个节点成为指定master的salve节点 * * @param nodeId * @return */ boolean clusterReplicate(String nodeId); /** * Be master * 该命令只能在群集slave节点执行,让slave节点进行一次人工故障切换 * * @return */ boolean clusterFailOver(); String clusterAddSlots(int... slots); String clusterSetSlotNode(int slot, String nodeId); String clusterSetSlotImporting(int slot, String nodeId); String clusterSetSlotMigrating(int slot, String nodeId); List<String> clusterGetKeysInSlot(int slot, int count); String clusterSetSlotStable(int slot); boolean clusterForget(String nodeId); String clusterReset(ClusterReset reset); String migrate(String host, int port, String key, int destinationDb, int timeout); String migrate(String host, int port, int destinationDB, int timeout, MigrateParams params, String... keys); /** * old name: slaveOf * * @param host * @param port * @return OK */ boolean replicaOf(String host, int port); /** * standalone forget this node * * @return */ String replicaNoOne(); String memoryPurge(); List<Map<String, String>> getSentinelMasters(); List<String> getMasterAddrByName(String masterName); List<Map<String, String>> sentinelSlaves(String masterName); boolean monitorMaster(String masterName, String ip, int port, int quorum); boolean failoverMaster(String masterName); boolean sentinelRemove(String masterName); Long resetConfig(String pattern); boolean sentinelSet(String masterName, Map<String, String> parameterMap); /** * Close client * * @return */ void close(); } <|start_filename|>redis-manager-dashboard/src/main/java/com/newegg/ec/redis/entity/RDBAnalyze.java<|end_filename|> package com.newegg.ec.redis.entity; import java.util.List; /** * @author Kyle.K.Zhao * @date 1/8/2020 16:26 */ public class RDBAnalyze { private Long id; private boolean autoAnalyze; private String schedule; private String dataPath; private String prefixes; private boolean report; private String mailTo; private boolean manual; /** *analyzer 例:0,5,6 0代表report 5 代表ExportKeyByPrefix 6代表ExportKeyByFilter */ private String analyzer; private Long clusterId; private Cluster cluster; private List<String> nodes; private Long groupId; public List<String> getNodes() { return nodes; } public boolean isManual() { return manual; } public void setManual(boolean manual) { this.manual = manual; } public void setNodes(List<String> nodes) { this.nodes = nodes; } public Cluster getCluster() { return cluster; } public void setCluster(Cluster cluster) { this.cluster = cluster; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public boolean isAutoAnalyze() { return autoAnalyze; } public void setAutoAnalyze(boolean autoAnalyze) { this.autoAnalyze = autoAnalyze; } public String getSchedule() { return schedule; } public void setSchedule(String schedule) { this.schedule = schedule; } public String getDataPath() { return dataPath; } public void setDataPath(String dataPath) { this.dataPath = dataPath; } public String getPrefixes() { return prefixes; } public void setPrefixes(String prefixes) { this.prefixes = prefixes; } public boolean isReport() { return report; } public void setReport(boolean report) { this.report = report; } public String getMailTo() { return mailTo; } public void setMailTo(String mailTo) { this.mailTo = mailTo; } public String getAnalyzer() { return analyzer; } public void setAnalyzer(String analyzer) { this.analyzer = analyzer; } public Long getClusterId() { return clusterId; } public void setClusterId(Long clusterId) { this.clusterId = clusterId; } public Long getGroupId() { return groupId; } public void setGroupId(Long groupId) { this.groupId = groupId; } } <|start_filename|>redis-manager-dashboard/src/main/java/com/newegg/ec/redis/entity/SentinelMaster.java<|end_filename|> package com.newegg.ec.redis.entity; import java.sql.Timestamp; /** * 1) 1) "name" * 2) "master" * 3) "ip" * 4) "xxxxxxxx" * 5) "port" * 6) "16379" * 7) "runid" * 8) "3e3095a707d111e7467d8830e52e04d04ad53f92" * 9) "flags" * 10) "s_down,o_down,master" * 11) "link-pending-commands" * 12) "0" * 13) "link-refcount" * 14) "1" * 15) "last-ping-sent" * 16) "3706617" * 17) "last-ok-ping-reply" * 18) "3706617" * 19) "last-ping-reply" * 20) "631" * 21) "s-down-time" * 22) "3701566" * 23) "o-down-time" * 24) "3701476" * 25) "down-after-milliseconds" * 26) "5000" * 27) "info-refresh" * 28) "2238" * 29) "role-reported" * 30) "master" * 31) "role-reported-time" * 32) "3706617" * 33) "config-epoch" * 34) "22" * 35) "num-slaves" * 36) "3" * 37) "num-other-sentinels" * 38) "5" * 39) "quorum" * 40) "4" * 41) "failover-timeout" * 42) "180000" * 43) "parallel-syncs" * 44) "1" * * @author Everly.J.Ju * @date 2020/01/22 */ public class SentinelMaster { private Integer sentinelMasterId; private Integer clusterId; private Integer groupId; private String name; private String host; private Integer port; private String flags; private String lastMasterNode; private String status; private Long linkPendingCommands; private Long linkRefcount; private Long lastPingSent; private Long lastOkPingReply; private Long lastPingReply; private Long sDownTime; private Long oDownTime; private Long downAfterMilliseconds; private Long infoRefresh; private String roleReported; private Long roleReportedTime; private Long configEpoch; private Integer numSlaves; private Integer sentinels; private Integer quorum; private Long failoverTimeout; private Integer parallelSyncs; private String authPass; private boolean monitor; private boolean masterChanged; private Timestamp updateTime; public Integer getSentinelMasterId() { return sentinelMasterId; } public void setSentinelMasterId(Integer sentinelMasterId) { this.sentinelMasterId = sentinelMasterId; } public Integer getClusterId() { return clusterId; } public void setClusterId(Integer clusterId) { this.clusterId = clusterId; } public Integer getGroupId() { return groupId; } public void setGroupId(Integer groupId) { this.groupId = groupId; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getHost() { return host; } public void setHost(String host) { this.host = host; } public Integer getPort() { return port; } public void setPort(Integer port) { this.port = port; } public String getFlags() { return flags; } public void setFlags(String flags) { this.flags = flags; } public String getLastMasterNode() { return lastMasterNode; } public void setLastMasterNode(String lastMasterNode) { this.lastMasterNode = lastMasterNode; } public String getStatus() { return status; } public void setStatus(String status) { this.status = status; } public Long getLinkPendingCommands() { return linkPendingCommands; } public void setLinkPendingCommands(Long linkPendingCommands) { this.linkPendingCommands = linkPendingCommands; } public Long getLinkRefcount() { return linkRefcount; } public void setLinkRefcount(Long linkRefcount) { this.linkRefcount = linkRefcount; } public Long getLastPingSent() { return lastPingSent; } public void setLastPingSent(Long lastPingSent) { this.lastPingSent = lastPingSent; } public Long getLastOkPingReply() { return lastOkPingReply; } public void setLastOkPingReply(Long lastOkPingReply) { this.lastOkPingReply = lastOkPingReply; } public Long getLastPingReply() { return lastPingReply; } public void setLastPingReply(Long lastPingReply) { this.lastPingReply = lastPingReply; } public Long getsDownTime() { return sDownTime; } public void setsDownTime(Long sDownTime) { this.sDownTime = sDownTime; } public Long getoDownTime() { return oDownTime; } public void setoDownTime(Long oDownTime) { this.oDownTime = oDownTime; } public Long getDownAfterMilliseconds() { return downAfterMilliseconds; } public void setDownAfterMilliseconds(Long downAfterMilliseconds) { this.downAfterMilliseconds = downAfterMilliseconds; } public Long getInfoRefresh() { return infoRefresh; } public void setInfoRefresh(Long infoRefresh) { this.infoRefresh = infoRefresh; } public String getRoleReported() { return roleReported; } public void setRoleReported(String roleReported) { this.roleReported = roleReported; } public Long getRoleReportedTime() { return roleReportedTime; } public void setRoleReportedTime(Long roleReportedTime) { this.roleReportedTime = roleReportedTime; } public Long getConfigEpoch() { return configEpoch; } public void setConfigEpoch(Long configEpoch) { this.configEpoch = configEpoch; } public Integer getNumSlaves() { return numSlaves; } public void setNumSlaves(Integer numSlaves) { this.numSlaves = numSlaves; } public Integer getSentinels() { return sentinels; } public void setSentinels(Integer sentinels) { this.sentinels = sentinels; } public Integer getQuorum() { return quorum; } public void setQuorum(Integer quorum) { this.quorum = quorum; } public Long getFailoverTimeout() { return failoverTimeout; } public void setFailoverTimeout(Long failoverTimeout) { this.failoverTimeout = failoverTimeout; } public Integer getParallelSyncs() { return parallelSyncs; } public void setParallelSyncs(Integer parallelSyncs) { this.parallelSyncs = parallelSyncs; } public String getAuthPass() { return authPass; } public void setAuthPass(String authPass) { this.authPass = authPass; } public boolean getMonitor() { return monitor; } public void setMonitor(boolean monitor) { this.monitor = monitor; } public boolean getMasterChanged() { return masterChanged; } public void setMasterChanged(boolean masterChanged) { this.masterChanged = masterChanged; } public Timestamp getUpdateTime() { return updateTime; } public void setUpdateTime(Timestamp updateTime) { this.updateTime = updateTime; } } <|start_filename|>redis-manager-dashboard/src/main/java/com/newegg/ec/redis/service/INodeInfoService.java<|end_filename|> package com.newegg.ec.redis.service; import com.newegg.ec.redis.entity.NodeInfo; import com.newegg.ec.redis.entity.NodeInfoParam; import java.util.List; /** * @author Jay.H.Zou * @date 2019/7/22 */ public interface INodeInfoService { void createNodeInfoTable(Integer clusterId); void deleteNodeInfoTable(Integer clusterId); boolean isNodeInfoTableExist(Integer clusterId); List<NodeInfo> getNodeInfoList(NodeInfoParam nodeInfoParam); NodeInfo getLastTimeNodeInfo(NodeInfoParam nodeInfoParam); List<NodeInfo> getLastTimeNodeInfoList(NodeInfoParam nodeInfoParam); boolean addNodeInfo(NodeInfoParam nodeInfoParam, List<NodeInfo> nodeInfoList); boolean cleanupNodeInfo(Integer clusterId); } <|start_filename|>redis-manager-dashboard/src/main/java/com/newegg/ec/redis/plugin/install/service/impl/DockerNodeOperation.java<|end_filename|> package com.newegg.ec.redis.plugin.install.service.impl; import com.google.common.base.Strings; import com.newegg.ec.redis.entity.Cluster; import com.newegg.ec.redis.entity.Machine; import com.newegg.ec.redis.entity.RedisNode; import com.newegg.ec.redis.exception.ConfigurationException; import com.newegg.ec.redis.plugin.install.entity.InstallationLogContainer; import com.newegg.ec.redis.plugin.install.entity.InstallationParam; import com.newegg.ec.redis.plugin.install.service.AbstractNodeOperation; import com.newegg.ec.redis.plugin.install.DockerClientOperation; import com.newegg.ec.redis.util.RedisUtil; import com.newegg.ec.redis.util.SignUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.event.ContextRefreshedEvent; import org.springframework.stereotype.Component; import java.util.*; import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; import static com.newegg.ec.redis.util.RedisConfigUtil.*; import static com.newegg.ec.redis.util.SignUtil.SPACE; /** * @author Jay.H.Zou * @date 2019/8/12 */ @Component public class DockerNodeOperation extends AbstractNodeOperation { private static final Logger logger = LoggerFactory.getLogger(DockerNodeOperation.class); @Value("${redis-manager.installation.docker.images}") private String images; public static final String DOCKER_INSTALL_BASE_PATH = "/data/redis/docker/"; @Autowired private DockerClientOperation dockerClientOperation; @Override public void onApplicationEvent(ContextRefreshedEvent contextRefreshedEvent) { INSTALL_BASE_PATH = DOCKER_INSTALL_BASE_PATH; if (Strings.isNullOrEmpty(images)) { throw new ConfigurationException("images not allow empty!"); } } @Override public List<String> getImageList() { return new ArrayList<>(Arrays.asList(SignUtil.splitByCommas(images.replace(SPACE, "")))); } /** * 检测连接是否正常 * 检查机器内存Memory资源 * 检查 docker 环境(开启docker远程访问), 2375 * * @param installationParam * @return */ @Override public boolean checkEnvironment(InstallationParam installationParam) { String clusterName = installationParam.getCluster().getClusterName(); List<Machine> machineList = installationParam.getMachineList(); for (Machine machine : machineList) { String host = machine.getHost(); try { dockerClientOperation.getDockerInfo(host); } catch (Exception e) { String message = "Check docker environment failed, host: " + host; InstallationLogContainer.appendLog(clusterName, message); InstallationLogContainer.appendLog(clusterName, e.getMessage()); logger.error(message, e); return false; } } return true; } @Override public boolean pullImage(InstallationParam installationParam) { List<Machine> machineList = installationParam.getMachineList(); Cluster cluster = installationParam.getCluster(); String clusterName = cluster.getClusterName(); String image = cluster.getImage(); List<Future<Boolean>> resultFutureList = new ArrayList<>(machineList.size()); for (Machine machine : machineList) { resultFutureList.add(threadPool.submit(() -> { String host = machine.getHost(); try { dockerClientOperation.pullImage(host, image); return true; } catch (InterruptedException e) { String message = "Pull docker image failed, host: " + host; InstallationLogContainer.appendLog(clusterName, message); InstallationLogContainer.appendLog(clusterName, e.getMessage()); logger.error(message, e); return false; } })); } for (Future<Boolean> resultFuture : resultFutureList) { try { if (!resultFuture.get(TIMEOUT, TimeUnit.MINUTES)) { return false; } } catch (Exception e) { InstallationLogContainer.appendLog(clusterName, e.getMessage()); logger.error("", e); return false; } } return true; } /** * run container * * @param installationParam * @return */ @Override public boolean install(InstallationParam installationParam) { List<RedisNode> allRedisNodes = installationParam.getRedisNodeList(); Cluster cluster = installationParam.getCluster(); for (RedisNode redisNode : allRedisNodes) { boolean start = start(cluster, redisNode); if (!start) { return false; } } return true; } @Override public boolean start(Cluster cluster, RedisNode redisNode) { String image = cluster.getImage(); String clusterName = cluster.getClusterName(); int port = redisNode.getPort(); String host = redisNode.getHost(); String containerName = RedisUtil.generateContainerName(clusterName, port); try { String containerId = redisNode.getContainerId(); if (Strings.isNullOrEmpty(containerId)) { containerId = dockerClientOperation.createContainer(host, port, image, containerName); redisNode.setContainerId(containerId); redisNode.setContainerName(containerName); } dockerClientOperation.runContainer(host, containerId); return true; } catch (Exception e) { String message = "Start container failed, host: " + host + ", port: " + port; InstallationLogContainer.appendLog(clusterName, message); InstallationLogContainer.appendLog(clusterName, e.getMessage()); logger.error(message, e); return false; } } @Override public boolean stop(Cluster cluster, RedisNode redisNode) { try { dockerClientOperation.stopContainer(redisNode.getHost(), redisNode.getContainerId()); return true; } catch (Exception e) { logger.error("Stop container failed, host: " + redisNode.getHost() + ", container name: " + redisNode.getContainerName()); return false; } } @Override public boolean restart(Cluster cluster, RedisNode redisNode) { try { dockerClientOperation.restartContainer(redisNode.getHost(), redisNode.getContainerId()); return true; } catch (Exception e) { logger.error("Restart container failed, host: " + redisNode.getHost() + ", container name: " + redisNode.getContainerName()); return false; } } @Override public boolean remove(Cluster cluster, RedisNode redisNode) { try { dockerClientOperation.removeContainer(redisNode.getHost(), redisNode.getContainerId()); return true; } catch (Exception e) { logger.error("Remove container failed, host: " + redisNode.getHost() + ", container name: " + redisNode.getContainerName()); return false; } } @Override public Map<String, String> getBaseConfigs(String bind, int port, String dir) { Map<String, String> configs = new HashMap<>(3); configs.put(DAEMONIZE, "no"); configs.put(BIND, bind); configs.put(PORT, port + ""); configs.put(DIR, "/data/"); return configs; } } <|start_filename|>redis-manager-dashboard/src/main/java/com/newegg/ec/redis/util/SentinelConfigUtil.java<|end_filename|> package com.newegg.ec.redis.util; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; /** * @author Everly.J.Ju * @date 2020/1/22 */ public class SentinelConfigUtil { private static final Map<String, String> CONFIG_DESC_MAP = new ConcurrentHashMap<>(); static { CONFIG_DESC_MAP.put("sentinel monitor mymaster", "Protected mode is a layer of security protection, in order to avoid that Redis instances left open on the internet are accessed and exploited"); CONFIG_DESC_MAP.put("sentinel auth-pass mymaster", "TCP listen() backlog"); CONFIG_DESC_MAP.put("sentinel down-after-milliseconds", "Close the connection after a client is idle for N seconds (0 to disable)"); CONFIG_DESC_MAP.put("sentinel parallel-syncs mymaste", "A reasonable value for this option is N seconds."); CONFIG_DESC_MAP.put("sentinel failover-timeout", ""); CONFIG_DESC_MAP.put("sentinel failover-timeout mymaster", "Creating a pid file is best effort: if Redis is not able to create it nothing bad happens, the server will start and run normally."); CONFIG_DESC_MAP.put("sentinel notification-script mymaster", "Specify the server verbosity level (debug, verbose, notice, warning)."); CONFIG_DESC_MAP.put("logfile", "Specify the log file name."); CONFIG_DESC_MAP.put("sentinel client-reconfig-script mymaster", "To enable logging to the system logger, just set 'syslog-enabled' to yes, and optionally update the other syslog parameters to suit your needs."); } public static class SentinelConfig { private boolean enable; private String configKey; private String configValue; private String desc; public SentinelConfig() { } public SentinelConfig(String configKey, String configValue, int mode) { this(true, configKey, configValue, null); } public SentinelConfig(boolean enable, String configKey, String configValue, int mode) { this(enable, configKey, configValue, null); } public SentinelConfig(boolean enable, String configKey, String configValue, String desc) { this.enable = enable; this.configKey = configKey; this.configValue = configValue; this.desc = desc; } public boolean isEnable() { return enable; } public void setEnable(boolean enable) { this.enable = enable; } public String getConfigKey() { return configKey; } public void setConfigKey(String configKey) { this.configKey = configKey; } public String getConfigValue() { return configValue; } public void setConfigValue(String configValue) { this.configValue = configValue; } public String getDesc() { return desc; } public void setDesc(String desc) { this.desc = desc; } @Override public String toString() { return "SentinelConfig{" + "enable=" + enable + ", configKey='" + configKey + '\'' + ", configValue='" + configValue + '\'' + ", desc='" + desc + '\'' + '}'; } } } <|start_filename|>redis-manager-dashboard/src/main/java/com/newegg/ec/redis/util/RedisClusterInfoUtil.java<|end_filename|> package com.newegg.ec.redis.util; import com.alibaba.fastjson.JSONObject; import com.google.common.base.CaseFormat; import com.google.common.base.Strings; import com.newegg.ec.redis.entity.Cluster; import java.io.IOException; import java.util.Map; import java.util.Objects; /** * TODO: move to clusterService * * @author Jay.H.Zou * @date 8/2/2019 */ public class RedisClusterInfoUtil { public static final String OK = "ok"; public static final String FAIL = "fail"; public static final String CLUSTER_STATE = "cluster_state"; public static final String CLUSTER_SLOTS_ASSIGNED = "cluster_slots_assigned"; public static final String CLUSTER_SLOT_OK = "cluster_slots_ok"; public static final String CLUSTER_SLOTS_PFAIL = "cluster_slots_pfail"; public static final String CLUSTER_SLOTS_FAIL = "cluster_slots_fail"; public static final String CLUSTER_KNOWN_NODES = "cluster_known_nodes"; public static final String CLUSTER_SIZE = "cluster_size"; public static Cluster parseClusterInfoToObject(Map<String, String> clusterInfoMap) throws IOException { JSONObject infoJSONObject = new JSONObject(); for (Map.Entry<String, String> entry : clusterInfoMap.entrySet()) { String key = entry.getKey(); String value = entry.getValue(); if (Strings.isNullOrEmpty(key) || Strings.isNullOrEmpty(value)) { continue; } String field = CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, key); // 计算集群状态 if (Objects.equals(key, CLUSTER_STATE)) { Cluster.ClusterState clusterState = calculateClusterState(value); infoJSONObject.put(field, clusterState); continue; } infoJSONObject.put(field, value); } return infoJSONObject.toJavaObject(Cluster.class); } /** * 目前以 cluster info 为标准 * * @param clusterState * @return */ private static Cluster.ClusterState calculateClusterState(String clusterState) { return Objects.equals(clusterState, OK) ? Cluster.ClusterState.HEALTH : Cluster.ClusterState.BAD; } } <|start_filename|>redis-manager-dashboard/src/main/java/com/newegg/ec/redis/util/BytesConverseUtil.java<|end_filename|> package com.newegg.ec.redis.util; import java.text.DecimalFormat; import java.util.List; /** * @author kz37 * @date 2018/10/25 */ public class BytesConverseUtil { public static String getSize(long size) { StringBuffer bytes = new StringBuffer(); DecimalFormat format = new DecimalFormat("###.0"); if (size >= 1024 * 1024 * 1024) { double i = (size / (1024.0 * 1024.0 * 1024.0)); bytes.append(format.format(i)).append("GB"); } else if (size >= 1024 * 1024) { double i = (size / (1024.0 * 1024.0)); bytes.append(format.format(i)).append("MB"); } else if (size >= 1024) { double i = (size / (1024.0)); bytes.append(format.format(i)).append("KB"); } else if (size < 1024) { if (size <= 0) { bytes.append("0B"); } else { bytes.append((int) size).append("B"); } } return bytes.toString(); } public static void converseBytes(List<List<String>> datas, int index){ for(int i = 0; i < datas.size(); i++){ datas.get(i).set(index, getSize(Long.parseLong(datas.get(i).get(index)))); } } } <|start_filename|>redis-manager-dashboard/src/main/java/com/newegg/ec/redis/util/LinuxInfoUtil.java<|end_filename|> package com.newegg.ec.redis.util; import ch.ethz.ssh2.Connection; import com.google.common.base.Strings; import com.newegg.ec.redis.entity.Machine; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.net.InetAddress; import java.net.NetworkInterface; import java.util.Enumeration; import java.util.HashMap; import java.util.Map; /** * Check Memory * Check CPU * File Operation * * @author Jay.H.Zou * @date 7/20/2019 */ public class LinuxInfoUtil { private static final Logger logger = LoggerFactory.getLogger(LinuxInfoUtil.class); public static final String MEMORY_FREE = "memory_free"; public static final String VERSION = "version"; private LinuxInfoUtil() { } public static String getIp() { String ip = ""; try { for (Enumeration<NetworkInterface> en = NetworkInterface.getNetworkInterfaces(); en.hasMoreElements(); ) { NetworkInterface intf = en.nextElement(); String name = intf.getName(); if (!name.contains("docker") && !name.contains("lo")) { for (Enumeration<InetAddress> enumIpAddr = intf.getInetAddresses(); enumIpAddr.hasMoreElements(); ) { //获得IP InetAddress inetAddress = enumIpAddr.nextElement(); if (!inetAddress.isLoopbackAddress()) { String ipAddress = inetAddress.getHostAddress().toString(); if (!ipAddress.contains("::") && !ipAddress.contains("0:0:") && !ipAddress.contains("fe80") && !"127.0.0.1".equals(ip)) { ip = ipAddress; } } } } } } catch (Exception e) { logger.error("get current ip failed.", e); ip = null; } return ip; } public static boolean login(Machine machine) throws Exception { Connection connection = null; try { connection = SSH2Util.getConnection(machine); } finally { if (connection != null) { connection.close(); } } return true; } public static Map<String, String> getLinuxInfo(Machine machine) throws Exception { String result = SSH2Util.execute(machine, getInfoCommand()); return formatResult(result); } private static String getInfoCommand() { String command = "export TERM=linux;res=\"\"\n" + formatCommand(VERSION, "`cat /proc/version`") + formatCommand(MEMORY_FREE, "`free -g | grep Mem | awk '{print $4}'`") + "echo -e $res"; return command; } /** * @param field * @param command * @return */ private static String formatCommand(String field, String command) { return "res=${res}\"" + field + "'" + command + "\\n" + "\"\n"; } private static Map<String, String> formatResult(String result) { Map<String, String> infoMap = new HashMap(16); String[] lines = result.split("\n"); for (String line : lines) { if (Strings.isNullOrEmpty(line)) { continue; } String[] tmp = line.split("'"); if (tmp.length > 1) { infoMap.put(tmp[0].trim(), tmp[1].trim()); } else { infoMap.put(tmp[0].trim(), ""); } } return infoMap; } } <|start_filename|>redis-manager-dashboard/src/main/java/com/newegg/ec/redis/schedule/AlertMessageSchedule.java<|end_filename|> package com.newegg.ec.redis.schedule; import com.alibaba.fastjson.JSONObject; import com.google.common.base.CaseFormat; import com.google.common.base.Strings; import com.google.common.collect.ArrayListMultimap; import com.google.common.collect.Lists; import com.google.common.collect.Multimap; import com.google.common.util.concurrent.ThreadFactoryBuilder; import com.newegg.ec.redis.entity.*; import com.newegg.ec.redis.plugin.alert.entity.AlertChannel; import com.newegg.ec.redis.plugin.alert.entity.AlertRecord; import com.newegg.ec.redis.plugin.alert.entity.AlertRule; import com.newegg.ec.redis.plugin.alert.service.IAlertChannelService; import com.newegg.ec.redis.plugin.alert.service.IAlertRecordService; import com.newegg.ec.redis.plugin.alert.service.IAlertRuleService; import com.newegg.ec.redis.plugin.alert.service.IAlertService; import com.newegg.ec.redis.service.*; import com.newegg.ec.redis.util.RedisUtil; import com.newegg.ec.redis.util.SignUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationListener; import org.springframework.context.event.ContextRefreshedEvent; import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; import java.math.BigDecimal; import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.Objects; import java.util.concurrent.ExecutorService; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; import static com.newegg.ec.redis.entity.NodeRole.MASTER; import static com.newegg.ec.redis.entity.NodeRole.SLAVE; import static com.newegg.ec.redis.entity.RedisNode.CONNECTED; import static com.newegg.ec.redis.util.RedisUtil.REDIS_MODE_SENTINEL; import static com.newegg.ec.redis.util.SignUtil.EQUAL_SIGN; import static com.newegg.ec.redis.util.TimeUtil.FIVE_SECONDS; import static javax.management.timer.Timer.ONE_MINUTE; import static javax.management.timer.Timer.ONE_SECOND; /** * @author Jay.H.Zou * @date 7/30/2019 */ @Component public class AlertMessageSchedule implements IDataCollection, IDataCleanup, ApplicationListener<ContextRefreshedEvent> { private static final Logger logger = LoggerFactory.getLogger(AlertMessageSchedule.class); /** * 0: email * 1: wechat web hook * 2: dingding web hook * 3: wechat app */ private static final int EMAIL = 0; private static final int WECHAT_WEB_HOOK = 1; private static final int DINGDING_WEB_HOOK = 2; private static final int WECHAT_APP = 3; private static final int ALERT_RECORD_LIMIT = 16; @Autowired private IGroupService groupService; @Autowired private IClusterService clusterService; @Autowired private IRedisNodeService redisNodeService; @Autowired private ISentinelMastersService sentinelMastersService; @Autowired private IAlertRuleService alertRuleService; @Autowired private IAlertChannelService alertChannelService; @Autowired private IAlertRecordService alertRecordService; @Autowired private INodeInfoService nodeInfoService; @Autowired private IAlertService emailAlert; @Autowired private IAlertService wechatWebHookAlert; @Autowired private IAlertService dingDingWebHookAlert; @Autowired private IAlertService wechatAppAlert; private ExecutorService threadPool; @Override public void onApplicationEvent(ContextRefreshedEvent contextRefreshedEvent) { int coreSize = Runtime.getRuntime().availableProcessors(); threadPool = new ThreadPoolExecutor(coreSize, coreSize, 60L, TimeUnit.SECONDS, new LinkedBlockingQueue<>(), new ThreadFactoryBuilder().setNameFormat("redis-notify-pool-thread-%d").build()); } /** * * 获取 node info 进行计算 * 获取 node status 计算 */ @Async @Scheduled(cron = "0 0/1 * * * ? ") @Override public void collect() { List<Group> allGroup = groupService.getAllGroup(); if (allGroup != null && !allGroup.isEmpty()) { logger.info("Start to check alert rules..."); allGroup.forEach(group -> { threadPool.submit(new AlertTask(group)); }); } } /** * 每天凌晨0点实行一次,清理数据 */ @Async @Scheduled(cron = "0 0 0 * * ?") @Override public void cleanup() { alertRecordService.cleanAlertRecordByTime(); } private class AlertTask implements Runnable { private Group group; AlertTask(Group group) { this.group = group; } @Override public void run() { try { Integer groupId = group.getGroupId(); // 获取 cluster List<Cluster> clusterList = clusterService.getClusterListByGroupId(groupId); if (clusterList == null || clusterList.isEmpty()) { return; } // 获取有效的规则 List<AlertRule> validAlertRuleList = getValidAlertRuleList(groupId); if (validAlertRuleList == null || validAlertRuleList.isEmpty()) { return; } // 更新规则 updateRuleLastCheckTime(validAlertRuleList); // 获取 AlertChannel List<AlertChannel> validAlertChannelList = alertChannelService.getAlertChannelByGroupId(groupId); clusterList.forEach(cluster -> { List<Integer> ruleIdList = idsToIntegerList(cluster.getRuleIds()); // 获取集群规则 List<AlertRule> alertRuleList = validAlertRuleList.stream() .filter(alertRule -> alertRule.getGlobal() || ruleIdList.contains(alertRule.getRuleId())) .collect(Collectors.toList()); if (alertRuleList.isEmpty()) { return; } List<AlertRecord> alertRecordList = getAlertRecords(group, cluster, alertRuleList); if (alertRecordList.isEmpty()) { return; } // save to database saveRecordToDB(cluster.getClusterName(), alertRecordList); logger.info("Start to send alert message..."); // 获取告警通道并发送消息 Multimap<Integer, AlertChannel> channelMultimap = getAlertChannelByIds(validAlertChannelList, cluster.getChannelIds()); if (channelMultimap != null && !channelMultimap.isEmpty() && !alertRecordList.isEmpty()) { distribution(channelMultimap, alertRecordList); } }); } catch (Exception e) { logger.error("Alert task failed, group name = " + group.getGroupName(), e); } } } private List<AlertRecord> getAlertRecords(Group group, Cluster cluster, List<AlertRule> alertRuleList) { List<AlertRecord> alertRecordList = new ArrayList<>(); // 获取 node info 级别告警 alertRecordList.addAll(getNodeInfoAlertRecord(group, cluster, alertRuleList)); // 获取集群级别的告警 alertRecordList.addAll(getClusterAlertRecord(group, cluster, alertRuleList)); return alertRecordList; } private List<AlertRecord> getNodeInfoAlertRecord(Group group, Cluster cluster, List<AlertRule> alertRuleList) { List<AlertRecord> alertRecordList = new ArrayList<>(); // 获取 node info 列表 NodeInfoParam nodeInfoParam = new NodeInfoParam(cluster.getClusterId(), TimeType.MINUTE, null); List<NodeInfo> lastTimeNodeInfoList = nodeInfoService.getLastTimeNodeInfoList(nodeInfoParam); // 构建告警记录 for (AlertRule alertRule : alertRuleList) { if (alertRule.getClusterAlert()) { continue; } for (NodeInfo nodeInfo : lastTimeNodeInfoList) { if (isNotify(nodeInfo, alertRule)) { alertRecordList.add(buildNodeInfoAlertRecord(group, cluster, nodeInfo, alertRule)); } } } return alertRecordList; } /** * cluster/standalone check * <p> * 1.connect cluster/standalone failed * 2.cluster(mode) cluster_state isn't ok * 3.node not in cluster/standalone * 4.node shutdown, not in cluster, bad flags, bad link state, unknown role * * @param group * @param cluster * @param alertRuleList * @return */ private List<AlertRecord> getClusterAlertRecord(Group group, Cluster cluster, List<AlertRule> alertRuleList) { List<AlertRecord> alertRecordList = new ArrayList<>(); String seedNodes = cluster.getNodes(); for (AlertRule alertRule : alertRuleList) { if (!alertRule.getClusterAlert()) { continue; } Cluster.ClusterState clusterState = cluster.getClusterState(); if (!Objects.equals(Cluster.ClusterState.HEALTH, clusterState)) { alertRecordList.add(buildClusterAlertRecord(group, cluster, alertRule, seedNodes, "Cluster state is " + clusterState)); } List<RedisNode> redisNodeList = redisNodeService.getRedisNodeList(cluster.getClusterId()); redisNodeList.forEach(redisNode -> { String node = RedisUtil.getNodeString(redisNode); boolean runStatus = redisNode.getRunStatus(); boolean inCluster = redisNode.getInCluster(); String flags = redisNode.getFlags(); boolean flagsNormal = Objects.equals(flags, SLAVE.getValue()) || Objects.equals(flags, MASTER.getValue()); String linkState = redisNode.getLinkState(); NodeRole nodeRole = redisNode.getNodeRole(); // 节点角色为 UNKNOWN boolean nodeRoleNormal = Objects.equals(nodeRole, MASTER) || Objects.equals(nodeRole, SLAVE); String reason = ""; if (!runStatus) { reason = node + " is shutdown;\n"; } if (!inCluster) { reason += node + " not in cluster;\n"; } if (!flagsNormal) { reason += node + " has bad flags: " + flags + ";\n"; } if (!Objects.equals(linkState, CONNECTED)) { reason += node + " " + linkState + ";\n"; } if (!nodeRoleNormal) { reason += node + " role is " + nodeRole + ";\n"; } if (!Strings.isNullOrEmpty(reason)) { alertRecordList.add(buildClusterAlertRecord(group, cluster, alertRule, node, reason)); } }); if (Objects.equals(REDIS_MODE_SENTINEL, cluster.getRedisMode())) { List<AlertRecord> sentinelMasterRecord = getSentinelMasterRecord(group, cluster, alertRule); alertRecordList.addAll(sentinelMasterRecord); } } return alertRecordList; } /** * 1. not monitor * 2. master changed * 3. status or state not ok * * @param group * @param cluster * @param alertRule * @return */ private List<AlertRecord> getSentinelMasterRecord(Group group, Cluster cluster, AlertRule alertRule) { List<AlertRecord> alertRecordList = new ArrayList<>(); List<SentinelMaster> sentinelMasterList = sentinelMastersService.getSentinelMasterByClusterId(cluster.getClusterId()); sentinelMasterList.forEach(sentinelMaster -> { String node = RedisUtil.getNodeString(sentinelMaster.getHost(), sentinelMaster.getPort()); String masterName = sentinelMaster.getName(); String flags = sentinelMaster.getFlags(); String status = sentinelMaster.getStatus(); String reason = ""; if (!sentinelMaster.getMonitor()) { reason += masterName + " is not being monitored now.\n"; } if (sentinelMaster.getMasterChanged()) { reason += masterName + " failover, old master: " + sentinelMaster.getLastMasterNode() + ", new master: " + node + ".\n"; } if (!Objects.equals(flags, MASTER.getValue())) { reason += masterName + " flags: " + flags + ".\n"; } if (!Objects.equals("ok", status)) { reason += masterName + " status: " + status + ".\n"; } if (!Strings.isNullOrEmpty(reason)) { alertRecordList.add(buildClusterAlertRecord(group, cluster, alertRule, node, reason)); } }); return alertRecordList; } /** * 获取 group 下没有冻结(valid == true)且满足时间周期(nowTime - lastCheckTime >= cycleTime)的规则 * * @param groupId * @return */ private List<AlertRule> getValidAlertRuleList(Integer groupId) { List<AlertRule> validAlertRuleList = alertRuleService.getAlertRuleByGroupId(groupId); if (validAlertRuleList == null || validAlertRuleList.isEmpty()) { return null; } validAlertRuleList.removeIf(alertRule -> !isRuleValid(alertRule)); return validAlertRuleList; } private Multimap<Integer, AlertChannel> getAlertChannelByIds(List<AlertChannel> validAlertChannelList, String channelIds) { List<Integer> channelIdList = idsToIntegerList(channelIds); List<AlertChannel> alertChannelList = new ArrayList<>(); if (validAlertChannelList == null || validAlertChannelList.isEmpty()) { return null; } validAlertChannelList.forEach(alertChannel -> { if (channelIdList.contains(alertChannel.getChannelId())) { alertChannelList.add(alertChannel); } }); return classifyChannel(alertChannelList); } private Multimap<Integer, AlertChannel> classifyChannel(List<AlertChannel> alertChannelList) { Multimap<Integer, AlertChannel> channelMultimap = ArrayListMultimap.create(); alertChannelList.forEach(alertChannel -> { channelMultimap.put(alertChannel.getChannelType(), alertChannel); }); return channelMultimap; } /** * "1,2,3,4" => [1, 2, 3, 4] * * @param ids * @return */ private List<Integer> idsToIntegerList(String ids) { List<Integer> idList = new ArrayList<>(); if (Strings.isNullOrEmpty(ids)) { return idList; } String[] idArr = SignUtil.splitByCommas(ids); for (String id : idArr) { idList.add(Integer.parseInt(id)); } return idList; } /** * 校验监控指标是否达到阈值 * * @param nodeInfo * @param alertRule * @return */ private boolean isNotify(NodeInfo nodeInfo, AlertRule alertRule) { JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(nodeInfo)); String alertKey = alertRule.getRuleKey(); double alertValue = alertRule.getRuleValue(); String nodeInfoField = CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, alertKey); Double actualVal = jsonObject.getDouble(nodeInfoField); if (actualVal == null) { return false; } int compareType = alertRule.getCompareType(); return compare(alertValue, actualVal, compareType); } /** * 检验规则是否可用 * * @param alertRule * @return */ private boolean isRuleValid(AlertRule alertRule) { // 规则状态是否有效 if (!alertRule.getValid()) { return false; } // 检测时间 long lastCheckTime = alertRule.getLastCheckTime().getTime(); long checkCycle = alertRule.getCheckCycle() * ONE_MINUTE; long duration = System.currentTimeMillis() - lastCheckTime; return duration >= checkCycle; } /** * 比较类型 * 0: 相等 * 1: 大于 * -1: 小于 * 2: 不等于 */ private boolean compare(double alertValue, double actualValue, int compareType) { BigDecimal alertValueBigDecimal = BigDecimal.valueOf(alertValue); BigDecimal actualValueBigDecimal = BigDecimal.valueOf(actualValue); switch (compareType) { case 0: return alertValueBigDecimal.equals(actualValueBigDecimal); case 1: return actualValueBigDecimal.compareTo(alertValueBigDecimal) > 0; case -1: return actualValueBigDecimal.compareTo(alertValueBigDecimal) < 0; case 2: return !alertValueBigDecimal.equals(actualValueBigDecimal); default: return false; } } private AlertRecord buildNodeInfoAlertRecord(Group group, Cluster cluster, NodeInfo nodeInfo, AlertRule rule) { JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(nodeInfo)); AlertRecord record = new AlertRecord(); String alertKey = rule.getRuleKey(); String nodeInfoField = CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, alertKey); Double actualVal = jsonObject.getDouble(nodeInfoField); record.setGroupId(group.getGroupId()); record.setGroupName(group.getGroupName()); record.setClusterId(cluster.getClusterId()); record.setClusterName(cluster.getClusterName()); record.setRuleId(rule.getRuleId()); record.setRedisNode(nodeInfo.getNode()); record.setAlertRule(rule.getRuleKey() + getCompareSign(rule.getCompareType()) + rule.getRuleValue()); record.setActualData(rule.getRuleKey() + EQUAL_SIGN + actualVal); record.setCheckCycle(rule.getCheckCycle()); record.setRuleInfo(rule.getRuleInfo()); record.setClusterAlert(rule.getClusterAlert()); return record; } private AlertRecord buildClusterAlertRecord(Group group, Cluster cluster, AlertRule rule, String nodes, String reason) { AlertRecord record = new AlertRecord(); record.setGroupId(group.getGroupId()); record.setGroupName(group.getGroupName()); record.setClusterId(cluster.getClusterId()); record.setClusterName(cluster.getClusterName()); record.setRuleId(rule.getRuleId()); record.setRedisNode(nodes); record.setAlertRule("Cluster Alert"); record.setActualData(reason); record.setCheckCycle(rule.getCheckCycle()); record.setRuleInfo(rule.getRuleInfo()); record.setClusterAlert(rule.getClusterAlert()); return record; } /** * 0: = * 1: > * -1: < * 2: != * * @param compareType * @return */ private String getCompareSign(Integer compareType) { switch (compareType) { case 0: return "="; case 1: return ">"; case -1: return "<"; case 2: return "!="; default: return "/"; } } /** * 给各通道发送消息 * 由于部分通道对于消息长度、频率等有限制,此处做了分批、微延迟处理 * * @param channelMultimap * @param alertRecordList */ private void distribution(Multimap<Integer, AlertChannel> channelMultimap, List<AlertRecord> alertRecordList) { alert(emailAlert, channelMultimap.get(EMAIL), alertRecordList); List<List<AlertRecord>> partition = Lists.partition(alertRecordList, ALERT_RECORD_LIMIT); int size = partition.size(); long waitSecond = size > 10 ? FIVE_SECONDS : ONE_SECOND; partition.forEach(partAlertRecordList -> { alert(wechatWebHookAlert, channelMultimap.get(WECHAT_WEB_HOOK), partAlertRecordList); alert(dingDingWebHookAlert, channelMultimap.get(DINGDING_WEB_HOOK), partAlertRecordList); alert(wechatAppAlert, channelMultimap.get(WECHAT_APP), partAlertRecordList); try { Thread.sleep(waitSecond); } catch (InterruptedException ignored) { } }); } private void alert(IAlertService alertService, Collection<AlertChannel> alertChannelCollection, List<AlertRecord> alertRecordList) { alertChannelCollection.forEach(alertChannel -> alertService.alert(alertChannel, alertRecordList)); } private void saveRecordToDB(String clusterName, List<AlertRecord> alertRecordList) { if (alertRecordList.isEmpty()) { return; } try { alertRecordService.addAlertRecord(alertRecordList); } catch (Exception e) { logger.error("Save alert to db failed, cluster name = " + clusterName, e); } } private void updateRuleLastCheckTime(List<AlertRule> validAlertRuleList) { try { List<Integer> ruleIdList = validAlertRuleList.stream().map(AlertRule::getRuleId).collect(Collectors.toList()); alertRuleService.updateAlertRuleLastCheckTime(ruleIdList); } catch (Exception e) { logger.error("Update alert rule last check time, " + validAlertRuleList, e); } } } <|start_filename|>redis-manager-dashboard/src/main/java/com/newegg/ec/redis/util/SignUtil.java<|end_filename|> package com.newegg.ec.redis.util; /** * @author Jay.H.Zou * @date 8/7/2019 */ public class SignUtil { public static final String COMMAS = ","; public static final String MINUS = "-"; public static final String EQUAL_SIGN = "="; public static final String COLON = ":"; public static final String SEMICOLON = ";"; public static final String AITE = "@"; public static final String SPACE = " "; public static final String SLASH = "/"; private SignUtil() { } public static String replaceSpaceToMinus(String str) { return str.replace(SPACE, MINUS); } public static String[] splitByMinus(String str) { return splitBySign(str, MINUS); } public static String[] splitByCommas(String str) { return splitBySign(str, COMMAS); } public static String[] splitByEqualSign(String str) { return splitBySign(str, EQUAL_SIGN); } public static String[] splitByColon(String str) { return splitBySign(str, COLON); } public static String[] splitBySemicolon(String str) { return splitBySign(str, SEMICOLON); } public static String[] splitByAite(String str) { return splitBySign(str, AITE); } public static String[] splitBySpace(String str) { return splitBySign(str, SPACE); } public static String[] splitBySign(String str, String sign) { String[] split = str.split(sign); for (int i = 0; i < split.length; i++) { split[i] = split[i].trim(); } return split; } } <|start_filename|>redis-manager-dashboard/src/main/java/com/newegg/ec/redis/service/impl/RdbAnalyzeService.java<|end_filename|> package com.newegg.ec.redis.service.impl; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.newegg.ec.redis.client.RedisClient; import com.newegg.ec.redis.client.RedisClientFactory; import com.newegg.ec.redis.config.RCTConfig; import com.newegg.ec.redis.dao.IRdbAnalyze; import com.newegg.ec.redis.dao.IRdbAnalyzeResult; import com.newegg.ec.redis.entity.*; import com.newegg.ec.redis.plugin.rct.cache.AppCache; import com.newegg.ec.redis.plugin.rct.thread.AnalyzerStatusThread; import com.newegg.ec.redis.schedule.RDBScheduleJob; import com.newegg.ec.redis.service.IRdbAnalyzeService; import com.newegg.ec.redis.util.EurekaUtil; import org.apache.commons.lang.StringUtils; import org.quartz.SchedulerException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Service; import org.springframework.web.client.RestTemplate; import redis.clients.jedis.Jedis; import java.net.InetAddress; import java.util.*; import java.util.Map.Entry; @Service public class RdbAnalyzeService implements IRdbAnalyzeService { private static final Logger LOG = LoggerFactory.getLogger(RdbAnalyzeService.class); @Autowired RCTConfig config; @Autowired IRdbAnalyze iRdbAnalyze; @Autowired ClusterService clusterService; @Autowired RedisService redisService; @Autowired RdbAnalyzeService rdbAnalyzeService; @Autowired RestTemplate restTemplate; @Autowired RdbAnalyzeResultService rdbAnalyzeResultService; @Autowired ScheduleTaskService taskService; @Autowired IRdbAnalyzeResult rdbAnalyzeResultMapper; /** * 执行RDB分析任务 * * @param id * @return { status:true/false, message:"...." } */ @Override public JSONObject allocationRDBAnalyzeJob(Long id) { RDBAnalyze rdbAnalyze = this.selectById(id); return allocationRDBAnalyzeJob(rdbAnalyze); } @Override public JSONObject allocationRDBAnalyzeJob(RDBAnalyze rdbAnalyze) { JSONObject responseResult = new JSONObject(); // 校验是否有任务在运行。 boolean flag = ifRDBAnalyzeIsRunning(rdbAnalyze.getId()); if (flag) { responseResult.put("status", Boolean.FALSE); responseResult.put("message", "There is a task in progress!"); return responseResult; } // 启动状态监听线程,检查各个分析器分析状态和进程,分析完毕后,写数据库,发送邮件 Thread analyzerStatusThread = new Thread(new AnalyzerStatusThread(this, restTemplate, rdbAnalyze, config.getEmail(), rdbAnalyzeResultService)); analyzerStatusThread.start(); responseResult.put("status", true); return responseResult; } // 执行RCT任务分发 public JSONObject assignAnalyzeJob(RDBAnalyze rdbAnalyze){ JSONObject responseResult = new JSONObject(); responseResult.put("status", Boolean.TRUE); int[] analyzer = null; if (rdbAnalyze.getAnalyzer().contains(",")) { String[] str = rdbAnalyze.getAnalyzer().split(","); analyzer = new int[str.length]; for (int i = 0; i < str.length; i++) { analyzer[i] = Integer.parseInt(str[i]); } } else { analyzer = new int[1]; analyzer[0] = Integer.parseInt(rdbAnalyze.getAnalyzer()); } JSONArray tempArray = new JSONArray(); RedisClient redisClient = null; Cluster cluster = rdbAnalyze.getCluster(); String redisHost = cluster.getNodes().split(",")[0].split(":")[0]; String redisPort = cluster.getNodes().split(",")[0].split(":")[1]; // 集群中所有的host Map<String, String> clusterNodesIP = new HashMap<>(); // 最终需要分析的机器及端口 Map<String, Set<String>> generateRule = new HashMap<>(); try { if (config.isDevEnable()) { clusterNodesIP.put(InetAddress.getLocalHost().getHostAddress(), config.getDevRDBPort()); Set<String> set = new HashSet<>(); set.add(config.getDevRDBPort()); generateRule.put(InetAddress.getLocalHost().getHostAddress(), set); rdbAnalyze.setDataPath(config.getDevRDBPath()); } else { // 获取集群中有哪些节点进行分析 if (StringUtils.isNotBlank(cluster.getRedisPassword())) { redisClient = RedisClientFactory.buildRedisClient(new RedisNode(redisHost,Integer.parseInt(redisPort)),cluster.getRedisPassword()); } else { redisClient = RedisClientFactory.buildRedisClient(new RedisNode(redisHost,Integer.parseInt(redisPort)),null); } // 集群中是否指定节点进行分析 if(rdbAnalyze.getNodes() != null && !"-1".equalsIgnoreCase(rdbAnalyze.getNodes().get(0))){ //指定节点进行分析 List<String> nodeList = rdbAnalyze.getNodes(); Set<String> ports = null; for (String node :nodeList){ String[] nodeStr = node.split(":"); if(generateRule.containsKey(nodeStr[0])){ ports = generateRule.get(nodeStr[0]); }else { ports = new HashSet<>(); } clusterNodesIP.put(nodeStr[0],nodeStr[0]); ports.add(nodeStr[1]); generateRule.put(nodeStr[0],ports); } }else{ clusterNodesIP = redisClient.nodesIP(cluster); generateRule = RedisClient.generateAnalyzeRule(redisClient.nodesMap(cluster)); } } } catch (Exception e1) { responseResult.put("status", Boolean.FALSE); responseResult.put("message", e1.getMessage()); return responseResult; } finally { if (null != redisClient) { redisClient.close(); } } long scheduleID = System.currentTimeMillis(); responseResult.put("scheduleID", scheduleID); // 初始化进度状态 generateRule.forEach((host,ports) -> { ports.forEach(port -> { updateCurrentAnalyzerStatus(rdbAnalyze.getId(), scheduleID, host, port, 0,true, AnalyzeStatus.NOTINIT); }); }); List<AnalyzeInstance> analyzeInstances = EurekaUtil.getRegisterNodes(); Map<String, AnalyzeInstance> analyzeInstancesMap = new HashMap<>(analyzeInstances.size()); // 本次场景只会一个host一个AnalyzeInstance for (AnalyzeInstance instance : analyzeInstances) { analyzeInstancesMap.put(instance.getHost(), instance); } List<AnalyzeInstance> needAnalyzeInstances = new ArrayList<>(); // 如果存在某个节点不存活,则拒绝执行本次任务 for (String host : clusterNodesIP.keySet()) { AnalyzeInstance analyzeInstance = analyzeInstancesMap.get(host); if (analyzeInstance == null) { LOG.error("analyzeInstance inactive. ip:{}", host); responseResult.put("status", Boolean.FALSE); responseResult.put("message", host + " analyzeInstance inactive!"); return responseResult; } needAnalyzeInstances.add(analyzeInstance); } // 保存分析job到数据库 saveToResult(rdbAnalyze,scheduleID); responseResult.put("needAnalyzeInstances",needAnalyzeInstances); for (String host : clusterNodesIP.keySet()) { // 处理无RDB备份策略情况 if ((!config.isDevEnable()) && config.isRdbGenerateEnable() && generateRule.containsKey(host)) { Set<String> ports = generateRule.get(host); ports.forEach(port -> { Jedis jedis = null; try { jedis = new Jedis(host, Integer.parseInt(port)); if (StringUtils.isNotBlank(cluster.getRedisPassword())) { jedis.auth(cluster.getRedisPassword()); } List<String> configs = jedis.configGet("save"); // 如果没有配置RDB持久化策略,那么使用命令生成RDB文件 if (configs == null || configs.size() == 0 || (configs.size() == 2 && StringUtils.isBlank(configs.get(1)))) { // 调用save命令前设置执行状态为save updateCurrentAnalyzerStatus(rdbAnalyze.getId(), scheduleID, host, port, 0,true, AnalyzeStatus.SAVE); rdbBgsave(jedis,host,port); // 获取分析节点状态 queryAnalyzeStatus(rdbAnalyze.getId(), needAnalyzeInstances); } } catch (Exception e) { LOG.error("rdb generate error.", e); } finally { if (jedis != null) { jedis.close(); } } }); } // 如果某个服务器上没有分配到分析节点,则直接跳过 if(!generateRule.containsKey(host)){ continue; } // 调用分析器执行任务, 如果执行失败则停止进行分析任务 if(!requestAnalyze(scheduleID, rdbAnalyze, analyzeInstancesMap.get(host), generateRule, analyzer)){ responseResult.put("status", Boolean.FALSE); return responseResult; } } AppCache.scheduleProcess.put(rdbAnalyze.getId(), scheduleID); if (!config.isDevEnable()) { // 设置db数据量 cacheDBSize(generateRule); } return responseResult; } // 更新分析器状态 public void queryAnalyzeStatus(Long analyzeId, List<AnalyzeInstance> analyzeInstances){ List<ScheduleDetail> scheduleDetails = AppCache.scheduleDetailMap.get(analyzeId); for (AnalyzeInstance analyzeInstance : analyzeInstances) { for (ScheduleDetail scheduleDetail : scheduleDetails) { if (!(AnalyzeStatus.DONE.equals(scheduleDetail.getStatus()) || AnalyzeStatus.CANCELED.equals(scheduleDetail.getStatus()) || AnalyzeStatus.ERROR.equals(scheduleDetail.getStatus()) || AnalyzeStatus.NOTINIT.equals(scheduleDetail.getStatus()) || AnalyzeStatus.SAVE.equals(scheduleDetail.getStatus()))) { String instanceStr = scheduleDetail.getInstance(); if (analyzeInstance.getHost().equals(instanceStr.split(":")[0])) { getAnalyzerStatusRest(analyzeId, analyzeInstance, scheduleDetails); break; } } } } } // 获取分析器状态 private void getAnalyzerStatusRest(Long analyzeId,AnalyzeInstance instance,List<ScheduleDetail> scheduleDetails) { if (null == instance) { LOG.warn("analyzeInstance is null!"); return; } // String url = "http://1172.16.31.10:8082/status"; String host = instance.getHost(); String url = "http://" + host + ":" + instance.getPort() + "/status"; try { ResponseEntity<String> responseEntity = restTemplate.getForEntity(url, String.class); String str = responseEntity.getBody(); JSONObject result = JSONObject.parseObject(str); if (null == result) { LOG.warn("get status URL :" + url + " no response!"); return; } else { handleAnalyzerStatusMessage(analyzeId, host, result); } } catch (Exception e) { AppCache.scheduleDetailMap.get(analyzeId).forEach(s -> { if(s.getInstance().startsWith(host)){ s.setStatus(AnalyzeStatus.ERROR); } }); LOG.error("getAnalyzerStatusRest failed!", e); } } // 解析分析器返回信息 private void handleAnalyzerStatusMessage(Long analyzeId,String host, JSONObject message) { String analyzeIP = message.getString("ip"); if (message.get("scheduleInfo") == null || "".equals(message.getString("scheduleInfo").trim())) { return; } JSONObject scheduleInfo = message.getJSONObject("scheduleInfo"); Long scheduleID = scheduleInfo.getLong("scheduleID"); Map<String, Map<String, String>> rdbAnalyzeStatus = (Map<String, Map<String, String>>) message .get("rdbAnalyzeStatus"); for (Entry<String, Map<String, String>> entry : rdbAnalyzeStatus.entrySet()) { String port = entry.getKey(); if (entry.getValue() == null) { continue; } Map<String, String> analyzeInfo = entry.getValue(); AnalyzeStatus status = AnalyzeStatus.fromString(analyzeInfo.get("status")); String count = analyzeInfo.get("count"); String instance = analyzeIP + ":" + port; if (count == null || count.equals("")) { count = "0"; } updateCurrentAnalyzerStatus(analyzeId, scheduleID, host, port, Integer.parseInt(count),true, status); } } // 发送分析任务 private boolean requestAnalyze(long scheduleID, RDBAnalyze rdbAnalyze, AnalyzeInstance analyzeInstance, Map<String, Set<String>> generateRule, int[] analyzer){ // 执行任务分发 String host = analyzeInstance.getHost(); String url = "http://" + analyzeInstance.getHost() + ":" + analyzeInstance.getPort() + "/receivedSchedule"; //String url = "http://127.0.0.1:8082/receivedSchedule"; ScheduleInfo scheduleInfo = new ScheduleInfo(scheduleID, rdbAnalyze.getDataPath(), rdbAnalyze.getPrefixes(), generateRule.get(host), analyzer); HttpHeaders headers = new HttpHeaders(); headers.add("Content-Type", "application/json"); HttpEntity<ScheduleInfo> httpEntity = new HttpEntity<ScheduleInfo>(scheduleInfo, headers); boolean status = Boolean.FALSE; try { ResponseEntity<String> executeResult = restTemplate.postForEntity(url, httpEntity, String.class); JSONObject responseMessage = JSONObject.parseObject(executeResult.getBody()); if (!responseMessage.getBooleanValue("checked")) { LOG.error("allocation {} scheduleJob response error. responseMessage:{}", analyzeInstance.toString(), responseMessage.toJSONString()); deleteResult(rdbAnalyze,scheduleID); } else { status = Boolean.TRUE; } } catch (Exception e) { LOG.error("allocation {} scheduleJob fail. ", analyzeInstance.toString(), e); deleteResult(rdbAnalyze,scheduleID); } // 更改页面进度显示状态 Set<String> ports = generateRule.get(host); for (String port : ports) { if(status){ updateCurrentAnalyzerStatus(rdbAnalyze.getId(), scheduleID, host, port, 0, status, AnalyzeStatus.CHECKING); } else { updateCurrentAnalyzerStatus(rdbAnalyze.getId(), scheduleID, host, port, 0, status, AnalyzeStatus.ERROR); } } return status; } private void updateCurrentAnalyzerStatus(Long analyzeID, long scheduleID, String host, String port, int process, boolean stats, AnalyzeStatus analyzeStatus) { String instance = host + ":" + port; ScheduleDetail scheduleDetail = new ScheduleDetail(scheduleID, instance, process, stats, analyzeStatus); List<ScheduleDetail> scheduleDetails = AppCache.scheduleDetailMap.computeIfAbsent(analyzeID, k -> new ArrayList<>()); if(scheduleDetails.contains(scheduleDetail)){ int i = scheduleDetails.indexOf(scheduleDetail); scheduleDetails.set(i, scheduleDetail); }else { scheduleDetails.add(scheduleDetail); } } // 将每个需要分析的redis实例的key数量写入到缓存中 private void cacheDBSize(Map<String, Set<String>> generateRule){ for (Entry<String, Set<String>> map : generateRule.entrySet()) { String ip = map.getKey(); for (String ports : map.getValue()) { Jedis jedis = null; try { jedis = new Jedis(ip, Integer.parseInt(ports)); AppCache.keyCountMap.put(ip + ":" + ports, Float.parseFloat(String.valueOf(jedis.dbSize()))); } catch (Exception e) { LOG.error("redis get db size has error!", e); } finally { if (jedis != null) { jedis.close(); } } } } } private void saveToResult(RDBAnalyze rdbAnalyze,Long scheduleId){ RDBAnalyzeResult rdbAnalyzeResult = new RDBAnalyzeResult(); rdbAnalyzeResult.setAnalyzeConfig(JSONObject.toJSONString(rdbAnalyze)); rdbAnalyzeResult.setClusterId(Long.parseLong(rdbAnalyze.getCluster().getClusterId().toString())); rdbAnalyzeResult.setScheduleId(scheduleId); rdbAnalyzeResult.setGroupId(rdbAnalyze.getGroupId()); rdbAnalyzeResult.setDone(false); rdbAnalyzeResultService.add(rdbAnalyzeResult); } public void deleteResult(RDBAnalyze rdbAnalyze,Long scheduleId){ Map<String,Long> map = new HashMap<>(); map.put("cluster_id",rdbAnalyze.getClusterId()); map.put("schedule_id",scheduleId); rdbAnalyzeResultMapper.deleteRdbAnalyzeResult(map); } @Override public JSONObject cancelRDBAnalyze(String instance, String scheduleID) { JSONObject result = new JSONObject(); if (null == instance || "".equals(instance)) { LOG.warn("instance is null!"); result.put("canceled", false); return result; } Map<String, Long> rdbAnalyzeResult = new HashMap<String, Long>(); rdbAnalyzeResult.put("cluster_id", Long.valueOf(instance)); rdbAnalyzeResult.put("schedule_id", Long.valueOf(scheduleID)); rdbAnalyzeResultMapper.deleteRdbAnalyzeResult(rdbAnalyzeResult); Cluster cluster = clusterService.getClusterById(Integer.valueOf(instance)); String[] hostAndPort = cluster.getNodes().split(",")[0].split(":"); List<AnalyzeInstance> analyzeInstances = EurekaUtil.getRegisterNodes(); AnalyzeInstance analyzeInstance = null; for (AnalyzeInstance analyze : analyzeInstances) { if (hostAndPort[0].equals(analyze.getHost())) { analyzeInstance = analyze; break; } } if (null == analyzeInstance) { LOG.warn("analyzeInstance is null!"); result.put("canceled", false); return result; } // String url = "http://127.0.0.1:8082/cancel"; String url = "http://" + analyzeInstance.getHost() + ":" + analyzeInstance.getPort() + "/cancel"; try { ResponseEntity<String> responseEntity = restTemplate.getForEntity(url, String.class); result = JSONObject.parseObject(responseEntity.getBody()); if (null == result) { LOG.warn("URL :" + url + " no response"); result = new JSONObject(); result.put("canceled", false); return result; } } catch (Exception e) { LOG.error("canceledInstance is failed!", e); result = new JSONObject(); result.put("canceled", false); return result; } return result; } @Override public RDBAnalyze selectById(Long id) { return iRdbAnalyze.selectById(id); } @Override public boolean update(RDBAnalyze rdbAnalyze) { int result = iRdbAnalyze.updateRdbAnalyze(rdbAnalyze); return checkResult(result); } @Override public boolean add(RDBAnalyze rdbAnalyze) { int result = iRdbAnalyze.insert(rdbAnalyze); return checkResult(result); } @Override public List<RDBAnalyze> list(Long groupId) { List<RDBAnalyze> results = iRdbAnalyze.queryList(groupId); return results; } @Override public List<RDBAnalyze> selectALL() { return iRdbAnalyze.list(); } @Override public boolean checkResult(Integer result) { if (result > 0) { return true; } else { return false; } } @Override public RDBAnalyze getRDBAnalyzeByPid(Long cluster_id) { RDBAnalyze rdbAnalyze = iRdbAnalyze.getRDBAnalyzeByCluster_id(cluster_id); return rdbAnalyze; } @Override public RDBAnalyze getRDBAnalyzeById(Long id) { return iRdbAnalyze.getRDBAnalyzeById(id); } /** * * @param * @return boolean true: has task running false: no task running */ @Override public boolean ifRDBAnalyzeIsRunning(Long id) { List<ScheduleDetail> scheduleDetail = AppCache.scheduleDetailMap.get(id); // default no task running boolean result = false; if (scheduleDetail != null && scheduleDetail.size() > 0) { for (ScheduleDetail scheduleDetails : scheduleDetail) { AnalyzeStatus status = scheduleDetails.getStatus(); if ((!status.equals(AnalyzeStatus.DONE)) && (!status.equals(AnalyzeStatus.CANCELED)) && (!status.equals(AnalyzeStatus.ERROR))) { result = true; break; } } } return result; } /** * get Redis Id Base * * @return rdb_analyze.id */ @Override public Long getRedisIDBasePID(Long cluster_id) { if (null == cluster_id) { return null; } return iRdbAnalyze.getRDBAnalyzeIdByCluster_id(cluster_id); } @Override public boolean updateRdbAnalyze(RDBAnalyze rdbAnalyze) { return checkResult(iRdbAnalyze.updateRdbAnalyze(rdbAnalyze)); } public void updateJob() { updateJob(); } @Override public void updateJob(RDBAnalyze rdbAnalyze) { try { taskService.addTask(rdbAnalyze, RDBScheduleJob.class); } catch (SchedulerException e) { LOG.warn("schedule job update faild!message:{}", e.getMessage()); } } @Override public void rdbBgsave(Jedis jedis, String host, String port) { Long currentTime = System.currentTimeMillis(); Long oldLastsave = jedis.lastsave(); LOG.info("RCT start to generate redis rdb file.{}:{}", host, port); jedis.bgsave(); boolean isCheck = true; while(isCheck) { try { //等待5s,查看rdb文件是否生成完毕! Thread.sleep(5000); } catch (Exception e) { e.printStackTrace(); } Long lastsave = jedis.lastsave(); if(!lastsave.equals(oldLastsave)) { isCheck = false; } } LOG.info("RCT generate redis rdb file success. cost time:{} ms", (System.currentTimeMillis()-currentTime)); } /** * 根据id查询pid * * @param id * @return */ @Override public Long selectClusterIdById(Long id) { if (null == id) { return null; } return iRdbAnalyze.selectClusterIdById(id); } @Override public void createRdbAnalyzeTable() { iRdbAnalyze.createRdbAnalyzeTable(); } @Override public boolean deleteRdbAnalyze(Long id) { return checkResult(iRdbAnalyze.delete(id)); } @Override public boolean exitsRdbAnalyze(RDBAnalyze rdbAnalyze) { return checkResult(iRdbAnalyze.exits(rdbAnalyze)); } } <|start_filename|>redis-manager-dashboard/src/main/java/com/newegg/ec/redis/plugin/rct/thread/AnalyzerStatusThread.java<|end_filename|> package com.newegg.ec.redis.plugin.rct.thread; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.newegg.ec.redis.config.RCTConfig; import com.newegg.ec.redis.entity.*; import com.newegg.ec.redis.plugin.rct.cache.AppCache; import com.newegg.ec.redis.plugin.rct.report.EmailSendReport; import com.newegg.ec.redis.plugin.rct.report.IAnalyzeDataConverse; import com.newegg.ec.redis.plugin.rct.report.converseFactory.ReportDataConverseFacotry; import com.newegg.ec.redis.service.impl.RdbAnalyzeResultService; import com.newegg.ec.redis.service.impl.RdbAnalyzeService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.http.ResponseEntity; import org.springframework.web.client.RestTemplate; import java.util.*; /** * @author:Truman.P.Du * @createDate: 2018年10月19日 下午1:48:52 * @version:1.0 * @description: */ public class AnalyzerStatusThread implements Runnable { private static final Logger LOG = LoggerFactory.getLogger(AnalyzerStatusThread.class); private List<ScheduleDetail> scheduleDetails; private List<AnalyzeInstance> analyzeInstances; private RestTemplate restTemplate; private RDBAnalyze rdbAnalyze; private RCTConfig.Email emailInfo; private RdbAnalyzeResultService rdbAnalyzeResultService; private RdbAnalyzeService rdbAnalyzeService; public AnalyzerStatusThread(RdbAnalyzeService rdbAnalyzeService, RestTemplate restTemplate, RDBAnalyze rdbAnalyze, RCTConfig.Email emailInfo, RdbAnalyzeResultService rdbAnalyzeResultService) { this.rdbAnalyzeService = rdbAnalyzeService; this.restTemplate = restTemplate; this.rdbAnalyze = rdbAnalyze; this.emailInfo = emailInfo; this.rdbAnalyzeResultService = rdbAnalyzeResultService; } @Override public void run() { JSONObject res = rdbAnalyzeService.assignAnalyzeJob(rdbAnalyze); Long scheduleID = res.getLongValue("scheduleID"); if(!res.getBoolean("status")){ LOG.warn("Assign job fail."); // 执行失败,删除任务 AppCache.scheduleDetailMap.remove(rdbAnalyze.getId()); if(scheduleID != 0L){ rdbAnalyzeService.deleteResult(rdbAnalyze, scheduleID); } return; } this.analyzeInstances = (List<AnalyzeInstance>)res.get("needAnalyzeInstances"); scheduleDetails = AppCache.scheduleDetailMap.get(rdbAnalyze.getId()); // 获取所有analyzer运行状态 while (AppCache.isNeedAnalyzeStastus(rdbAnalyze.getId())) { // 更新分析器状态 rdbAnalyzeService.queryAnalyzeStatus(rdbAnalyze.getId(), analyzeInstances); try { // 每次循环休眠一次 Thread.sleep(500); } catch (InterruptedException e) { e.printStackTrace(); } } AppCache.scheduleDetailMap.get(rdbAnalyze.getId()).forEach(s -> { if(AnalyzeStatus.ERROR.equals(s.getStatus())){ rdbAnalyzeService.deleteResult(rdbAnalyze, s.getScheduleID()); return; } }); // 当所有analyzer运行完成,获取所有analyzer报表分析结果 if (AppCache.isAnalyzeComplete(rdbAnalyze)) { Map<String, Set<String>> reportData = new HashMap<>(); Map<String,Long>temp = new HashMap<>(); for (AnalyzeInstance analyzeInstance : analyzeInstances) { try { Map<String, Set<String>> instanceReportData = getAnalyzerReportRest(analyzeInstance); if (reportData.size() == 0) { reportData.putAll(instanceReportData); } else { for(String key:instanceReportData.keySet()) { Set<String> newData = instanceReportData.get(key); if(reportData.containsKey(key)) { Set<String> oldData = reportData.get(key); oldData.addAll(newData); reportData.put(key, oldData); }else { reportData.put(key, newData); } } } } catch (Exception e) { LOG.error("get analyzer report has error.", e); } } try { Map<String, ReportData> latestPrefixData = rdbAnalyzeResultService.getReportDataLatest(rdbAnalyze.getClusterId(), scheduleID); Map<String, String> dbResult = new HashMap<>(); IAnalyzeDataConverse analyzeDataConverse = null; for (Map.Entry<String, Set<String>> entry : reportData.entrySet()) { analyzeDataConverse = ReportDataConverseFacotry.getReportDataConverse(entry.getKey()); if (null != analyzeDataConverse) { dbResult.putAll(analyzeDataConverse.getMapJsonString(entry.getValue())); } } dbResult = rdbAnalyzeResultService.combinePrefixKey(dbResult); try { rdbAnalyzeResultService.reportDataWriteToDb(rdbAnalyze, dbResult); }catch (Exception e) { LOG.error("reportDataWriteToDb has error.", e); } if(rdbAnalyze.isReport()) { EmailSendReport emailSendReport = new EmailSendReport(); emailSendReport.sendEmailReport(rdbAnalyze, emailInfo, dbResult, latestPrefixData); } } catch (Exception e) { LOG.error("email report has error.", e); }finally { for (AnalyzeInstance analyzeInstance : analyzeInstances) { String url = "http://"+analyzeInstance.getHost()+":"+analyzeInstance.getPort()+"/clear"; @SuppressWarnings("unused") ResponseEntity<String> responseEntity = restTemplate.getForEntity(url, String.class); } } } } private Map<String, Set<String>> getAnalyzerReportRest(AnalyzeInstance instance) { if (null == instance) { LOG.warn("analyzeInstance is null!"); return null; } // String url = "http://127.0.0.1:8082/report"; String host = instance.getHost(); String url = "http://" + host + ":" + instance.getPort() + "/report"; try { ResponseEntity<String> responseEntity = restTemplate.getForEntity(url, String.class); String str = responseEntity.getBody(); if (null == str) { LOG.warn("get report URL :" + url + " no response!"); return null; } else { return handleAnalyzerReportMessage(str); } } catch (Exception e) { LOG.error("getAnalyzerReportRest failed!", e); return null; } } @SuppressWarnings("unchecked") private Map<String, Set<String>> handleAnalyzerReportMessage(String message) { Map<String, JSONArray> reportMessage = (Map<String, JSONArray>) JSON.parse(message); Map<String, Set<String>> result = new HashMap<>(); if (reportMessage != null && reportMessage.size() > 0) { for (String type : reportMessage.keySet()) { JSONArray array = reportMessage.get(type); List<String> list = JSONObject.parseArray(array.toJSONString(), String.class); Set<String> set = new HashSet<>(list); result.put(type, set); } } return result; } } <|start_filename|>redis-manager-dashboard/src/main/java/com/newegg/ec/redis/util/FileUtil.java<|end_filename|> package com.newegg.ec.redis.util; import com.google.common.io.Files; import org.apache.commons.lang.StringUtils; import java.io.File; /** * @author kz37 * @date 2018/10/19 */ public class FileUtil { public static void copyFile(String source, String dest) throws Exception { if (StringUtils.isBlank(source) || StringUtils.isBlank(dest)) { throw new Exception("source or dest must not blank."); } File sourceFile = new File(source); File destFile = new File(dest); if (!destFile.exists()) { destFile.getParentFile().mkdirs(); } Files.copy(sourceFile, destFile); } } <|start_filename|>redis-manager-dashboard/src/main/java/com/newegg/ec/redis/plugin/install/service/impl/MachineNodeOperation.java<|end_filename|> package com.newegg.ec.redis.plugin.install.service.impl; import com.google.common.base.Strings; import com.google.common.collect.Multimap; import com.newegg.ec.redis.client.RedisClient; import com.newegg.ec.redis.client.RedisClientFactory; import com.newegg.ec.redis.entity.Cluster; import com.newegg.ec.redis.entity.Machine; import com.newegg.ec.redis.entity.RedisNode; import com.newegg.ec.redis.plugin.install.entity.InstallationLogContainer; import com.newegg.ec.redis.plugin.install.entity.InstallationParam; import com.newegg.ec.redis.plugin.install.service.AbstractNodeOperation; import com.newegg.ec.redis.service.IMachineService; import com.newegg.ec.redis.util.SSH2Util; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.event.ContextRefreshedEvent; import org.springframework.stereotype.Component; import java.io.File; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; import static com.newegg.ec.redis.config.SystemConfig.MACHINE_PACKAGE_ORIGINAL_PATH; import static com.newegg.ec.redis.util.RedisConfigUtil.*; import static com.newegg.ec.redis.util.SignUtil.COLON; import static com.newegg.ec.redis.util.SignUtil.SLASH; /** * @author Jay.H.Zou * @date 2019/8/13 */ @Component public class MachineNodeOperation extends AbstractNodeOperation { private static final Logger logger = LoggerFactory.getLogger(MachineNodeOperation.class); public static final String MACHINE_INSTALL_BASE_PATH = "/data/redis/machine/"; @Value("${redis-manager.installation.machine.package-path}") private String packagePath; @Autowired private IMachineService machineService; @Override public void onApplicationEvent(ContextRefreshedEvent contextRefreshedEvent) { INSTALL_BASE_PATH = MACHINE_INSTALL_BASE_PATH; } @Override public List<String> getImageList() { File file = new File(packagePath); List<String> imageList = new ArrayList<>(); File[] packageFiles = file.listFiles(item -> { String name = item.getName(); return item.isFile() && (name.endsWith("tar") || name.endsWith("tar.gz")); }); if (packageFiles == null) { return imageList; } for (File packageFile : packageFiles) { imageList.add(packageFile.getName()); } return imageList; } @Override public boolean checkEnvironment(InstallationParam installationParam) { return true; } /** * 从本机copy到目标机器上 * * @return */ @Override public boolean pullImage(InstallationParam installationParam) { boolean sudo = installationParam.isSudo(); Cluster cluster = installationParam.getCluster(); String clusterName = cluster.getClusterName(); String image = cluster.getImage(); // eg: ip:port/redis/machine/xxx.tar.gz String url = systemConfig.getCurrentHost() + COLON + systemConfig.getServerPort() + MACHINE_PACKAGE_ORIGINAL_PATH + image; List<Machine> machineList = installationParam.getMachineList(); String tempPath = INSTALL_BASE_PATH + "data/"; List<Future<Boolean>> resultFutureList = new ArrayList<>(machineList.size()); for (Machine machine : machineList) { resultFutureList.add(threadPool.submit(() -> { try { SSH2Util.copyFileToRemote(machine, tempPath, url, sudo); return true; } catch (Exception e) { String message = "Pull machine image failed, host: " + machine.getHost(); InstallationLogContainer.appendLog(clusterName, message); InstallationLogContainer.appendLog(clusterName, e.getMessage()); logger.error(message, e); return false; } })); } for (Future<Boolean> resultFuture : resultFutureList) { try { if (!resultFuture.get(TIMEOUT, TimeUnit.MINUTES)) { return false; } } catch (Exception e) { InstallationLogContainer.appendLog(clusterName, e.getMessage()); logger.error("", e); return false; } } String tempPackagePath = tempPath + SLASH + image; Multimap<Machine, RedisNode> machineAndRedisNode = installationParam.getMachineAndRedisNode(); for (Map.Entry<Machine, RedisNode> entry : machineAndRedisNode.entries()) { Machine machine = entry.getKey(); RedisNode redisNode = entry.getValue(); String targetPath = INSTALL_BASE_PATH + redisNode.getPort(); try { // 解压到目标目录 String result = SSH2Util.unzipToTargetPath(machine, tempPackagePath, targetPath, sudo); if (!Strings.isNullOrEmpty(result)) { InstallationLogContainer.appendLog(clusterName, "Unzip failed, host: " + machine.getHost()); InstallationLogContainer.appendLog(clusterName, result); return false; } } catch (Exception e) { InstallationLogContainer.appendLog(clusterName, "Unzip failed, host: " + machine.getHost()); InstallationLogContainer.appendLog(clusterName, "Unzip failed, host: " + machine.getHost()); logger.error("", e); return false; } } return true; } @Override public boolean install(InstallationParam installationParam) { Multimap<Machine, RedisNode> machineAndRedisNode = installationParam.getMachineAndRedisNode(); Cluster cluster = installationParam.getCluster(); for (Map.Entry<Machine, RedisNode> entry : machineAndRedisNode.entries()) { RedisNode redisNode = entry.getValue(); boolean start = start(cluster, redisNode); if (!start) { return false; } } return true; } @Override public boolean start(Cluster cluster, RedisNode redisNode) { String clusterName = cluster.getClusterName(); String template = "cd %s; sudo ./redis-server redis.conf"; int port = redisNode.getPort(); String targetPath = INSTALL_BASE_PATH + port; String host = redisNode.getHost(); try { Machine machine = machineService.getMachineByHost(cluster.getGroupId(), host); if (machine == null) { return false; } String command = String.format(template, targetPath); String execute = SSH2Util.execute(machine, command); InstallationLogContainer.appendLog(clusterName, execute); if (Strings.isNullOrEmpty(execute)) { return true; } command = command.replace("sudo", ""); String execute2 = SSH2Util.execute(machine, command); if (Strings.isNullOrEmpty(execute2)) { return true; } InstallationLogContainer.appendLog(clusterName, execute2); return false; } catch (Exception e) { String message = "Start the installation package failed, host: " + host + ", port: " + port; InstallationLogContainer.appendLog(clusterName, message); InstallationLogContainer.appendLog(clusterName, e.getMessage()); logger.error(message, e); return false; } } @Override public boolean stop(Cluster cluster, RedisNode redisNode) { try { RedisClient redisClient = RedisClientFactory.buildRedisClient(redisNode, cluster.getRedisPassword()); redisClient.shutdown(); return true; } catch (Exception e) { logger.error("Stop redis node failed, " + redisNode.getHost() + ":" + redisNode.getPort(), e); return false; } } @Override public boolean restart(Cluster cluster, RedisNode redisNode) { boolean stop = stop(cluster, redisNode); boolean start = start(cluster, redisNode); return stop && start; } @Override public boolean remove(Cluster cluster, RedisNode redisNode) { String targetPath = INSTALL_BASE_PATH + redisNode.getPort(); Machine machine = machineService.getMachineByHost(cluster.getGroupId(), redisNode.getHost()); try { String rm = SSH2Util.rm(machine, targetPath, true); if (Strings.isNullOrEmpty(rm)) { return true; } String rm2 = SSH2Util.rm(machine, targetPath, false); if (Strings.isNullOrEmpty(rm2)) { return true; } logger.error("Remove redis node failed, host: " + redisNode.getHost() + ", port: " + redisNode.getPort()); return false; } catch (Exception e) { logger.error("Remove redis node failed, host: " + redisNode.getHost() + ", port: " + redisNode.getPort(), e); return false; } } @Override public Map<String, String> getBaseConfigs(String bind, int port, String dir) { Map<String, String> configs = new HashMap<>(4); configs.put(DAEMONIZE, "yes"); configs.put(BIND, bind); configs.put(PORT, port + ""); configs.put(DIR, dir); return configs; } } <|start_filename|>redis-manager-dashboard/src/main/java/com/newegg/ec/redis/plugin/install/DockerClientOperation.java<|end_filename|> package com.newegg.ec.redis.plugin.install; import com.github.dockerjava.api.DockerClient; import com.github.dockerjava.api.command.*; import com.github.dockerjava.api.model.*; import com.github.dockerjava.core.DefaultDockerClientConfig; import com.github.dockerjava.core.DockerClientBuilder; import com.github.dockerjava.core.command.PullImageResultCallback; import com.github.dockerjava.netty.NettyDockerCmdExecFactory; import com.google.common.base.Strings; import com.newegg.ec.redis.util.CommonUtil; import com.newegg.ec.redis.util.SignUtil; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; import java.util.*; import static com.newegg.ec.redis.plugin.install.service.impl.DockerNodeOperation.DOCKER_INSTALL_BASE_PATH; import static com.newegg.ec.redis.util.RedisConfigUtil.REDIS_CONF; /** * docker-java api: https://github.com/docker-java/docker-java/wiki * * @author Jay.H.Zou * @date 2019/8/12 */ @Component public class DockerClientOperation { @Value("${redis-manager.installation.docker.docker-host:tcp://%s:2375}") private String dockerHost = "tcp://%s:2375/"; private static final String VOLUME = DOCKER_INSTALL_BASE_PATH + "%d:/data"; public static final String REDIS_DEFAULT_WORK_DIR = "/data/"; static DockerCmdExecFactory dockerCmdExecFactory = new NettyDockerCmdExecFactory() // .withReadTimeout(300000) .withConnectTimeout(300000); // .withMaxTotalConnections(1000) // .withMaxPerRouteConnections(100); /** * Get docker client * * @param ip * @return */ public DockerClient getDockerClient(String ip) { DefaultDockerClientConfig.Builder builder = DefaultDockerClientConfig.createDefaultConfigBuilder() .withDockerHost(String.format(dockerHost, ip)); DefaultDockerClientConfig config = builder.build(); DockerClient dockerClient = DockerClientBuilder.getInstance(config).withDockerCmdExecFactory(dockerCmdExecFactory).build(); return dockerClient; } public Info getDockerInfo(String ip) { DockerClient dockerClient = getDockerClient(ip); return dockerClient.infoCmd().exec(); } /** * @param ip * @param repository * @return repoTags, imageId */ public List<String> searchImages(String ip, String repository) { DockerClient dockerClient = getDockerClient(ip); List<String> searchImages = new ArrayList<>(); List<SearchItem> searchItems = dockerClient.searchImagesCmd(repository).exec(); for (SearchItem searchItem : searchItems) { String name = searchItem.getName(); searchImages.add(name); } return searchImages; } /** * @param ip * @param imageName * @return repoTags, imageId */ public Map<String, String> getImages(String ip, String imageName) { DockerClient dockerClient = getDockerClient(ip); ListImagesCmd listImagesCmd = dockerClient.listImagesCmd(); if (!Strings.isNullOrEmpty(imageName)) { listImagesCmd.withImageNameFilter(imageName); } List<Image> images = listImagesCmd.exec(); Map<String, String> imageMap = new HashMap<>(); Iterator<Image> iterator = images.iterator(); while (iterator.hasNext()) { Image next = iterator.next(); String[] repoTags = next.getRepoTags(); for (String repoTag : repoTags) { imageMap.put(repoTag, next.getId()); } } return imageMap; } /** * 判断 image 是否存在 * * @param ip * @param image * @return */ public boolean imageExist(String ip, String image) { Map<String, String> images = getImages(ip, image); return images != null && !images.isEmpty(); } public InspectContainerResponse inspectContainer(String ip, String containerId) { DockerClient dockerClient = getDockerClient(ip); return dockerClient.inspectContainerCmd(containerId).exec(); } /** * redis.conf 由程序生成并修改 * <p> * Start docker container with expose port * sudo docker run \ * --name redis-instance-8000 \ * --net host \ * -d -v /data/redis/docker/8000:/data \ * redis:4.0.14 \ * redis-server /data/redis.conf * * @param ip * @param port * @param image * @return */ public String createContainer(String ip, int port, String image, String containerName) { DockerClient dockerClient = getDockerClient(ip); String bind = String.format(VOLUME, port); CreateContainerResponse container = dockerClient.createContainerCmd(image) // container name .withName(CommonUtil.replaceSpace(containerName)) // host 模式启动 .withHostConfig(new HostConfig().withNetworkMode("host")) // 挂载 .withBinds(Bind.parse(bind)) // 自动启动 .withRestartPolicy(RestartPolicy.alwaysRestart()) // 配置文件 .withCmd(REDIS_DEFAULT_WORK_DIR + REDIS_CONF) .exec(); return container.getId(); } public String runContainer(String ip, String containerId) { DockerClient dockerClient = getDockerClient(ip); dockerClient.startContainerCmd(containerId).exec(); return containerId; } /** * Stop docker container * * @param ip * @param containerId * @return */ public void restartContainer(String ip, String containerId) { DockerClient dockerClient = getDockerClient(ip); dockerClient.restartContainerCmd(containerId).exec(); } /** * Stop docker container * * @param ip * @param containerId * @return */ public void stopContainer(String ip, String containerId) { DockerClient dockerClient = getDockerClient(ip); dockerClient.stopContainerCmd(containerId).exec(); } /** * Remove docker container * * @param ip * @param containerId * @return */ public void removeContainer(String ip, String containerId) { DockerClient dockerClient = getDockerClient(ip); dockerClient.removeContainerCmd(containerId).exec(); } /** * @param ip * @param repository * @param tag * @return * @throws InterruptedException */ public boolean pullImage(String ip, String repository, String tag) throws InterruptedException { DockerClient dockerClient = getDockerClient(ip); PullImageCmd pullImageCmd = dockerClient.pullImageCmd(repository); if (!Strings.isNullOrEmpty(tag)) { pullImageCmd.withTag(tag); } pullImageCmd.exec(new PullImageResultCallback()).awaitCompletion(); return true; } /** * @param ip * @param repositoryAndTag * @return * @throws InterruptedException */ public boolean pullImage(String ip, String repositoryAndTag) throws InterruptedException { String[] repoAndTag = SignUtil.splitByColon(repositoryAndTag); String tag = null; if (repoAndTag.length > 1) { tag = repoAndTag[1]; } String repository = repoAndTag[0]; return pullImage(ip, repository, tag); } } <|start_filename|>redis-manager-dashboard/src/main/java/com/newegg/ec/redis/plugin/install/service/InstallationOperation.java<|end_filename|> package com.newegg.ec.redis.plugin.install.service; import com.newegg.ec.redis.plugin.install.entity.InstallationParam; import java.util.List; /** * @author Jay.H.Zou * @date 7/26/2019 */ public interface InstallationOperation { double MIN_MEMORY_FREE = 0.5; /** * @return */ List<String> getImageList(); /** * 检查机器内存CPU资源 * 不同安装方式的环境监测 * 检查所有机器之间是否网络相通, n! 次 * * @param installationParam * @return */ boolean checkEnvironment(InstallationParam installationParam); /** * 1.从内存中获取相应版本的配置 * 2.根据不同安装方式更改相应的配置 * 3.根据安装的集群模式更改配置 * * @return */ boolean pullConfig(InstallationParam installationParam); boolean pullImage(InstallationParam installationParam); boolean install(InstallationParam installationParam); } <|start_filename|>redis-manager-ui/redis-manager-vue/src/api/rctapi.js<|end_filename|> import axios from 'axios' import message from '@/utils/message.js' import { store } from '@/vuex/store.js' import router from '@/router' /** * use RCTAPI or API * eg: getAnalyseResults * async getAnalyseResults (groupId) { * const res = await getAnalyzeResults() * //处理数据 * console.log(res.data) * } * @param {*} url url * @param {*} method GET | POST | DELETE | PUT, default GET * @param {*} params {} */ function RCTAPI (url, method = 'GET', params = {}) { return new Promise((resolve, reject) => { service({ method: method, url: url, headers: {'UserIp': store.getters.getUserIp}, data: method === 'POST' || method === 'PUT' ? params : null, params: method === 'GET' || method === 'DELETE' ? params : null // baseURL: root, // withCredentials: true //开启cookies }).then(res => { resolve(res) }).catch(err => { // reject(err) if (err.response && (err.response.code === 401 || err.response.status === 404)) { message.warning('user infomation has expried,please login!') router.push({ name: 'login' }) } return Promise.reject(new Error('error')) }) }) } // message.error('user infomation has expried,please login!') // router.push({ name: 'login' }) /** * eg: deletAnalyze * async deletAnalyze (groupId) { * const res = await deletAnalyze(1).then(res => { * //处理数据 * console.log(res.data.data) * }) * } * @param {*} url url * @param {*} method GET | POST | DELETE | PUT, default GET * @param {*} params {} */ function API (url, method = 'GET', params = {}) { return service({ method: method, url: url, headers: {'UserIp': store.getters.getUserIp}, data: method === 'POST' || method === 'PUT' ? params : null, params: method === 'GET' || method === 'DELETE' ? params : null }) } if (process.env.NODE_ENV === 'development') { axios.defaults.baseURL = '/apis' } else if (process.env.NODE_ENV === 'production') { axios.defaults.baseURL = '/' } const service = axios.create({ timeout: 120000 }) service.interceptors.response.use( response => { const res = response.data if (res.code !== 0) { message.error(res.data || 'error') return Promise.reject(new Error(res.data || 'error')) } else { return Promise.resolve(res) } }, error => { if (error.response && (error.response.code === 401 || error.response.status === 404)) { message.warning('user infomation has expried,please login!') router.push({ name: 'login' }) } return Promise.reject(new Error('error')) // return Promise.reject(error) } ) export const cronExpress = (cron) => API(`/rdb/test_corn`, 'POST', cron) export const analyzeJob = (data) => API(`/rdb/allocation_job`, 'POST', data) export const getClusterNodes = (id) => API(`/node-manage/getAllNodeList/${id}`) export const getCluster = (id) => API(`/cluster/getClusterList/${id}`) export const getAnalysisList = (id) => API(`/rdb?groupId=${id}`) export const addAnalysisList = (data) => API(`/rdb`, 'POST', data) export const updateAnalyzeList = (data) => API(`/rdb`, 'PUT', data) export const deletAnalyze = (id) => API(`/rdb?id=${id}`, 'DELETE') export const getAnalyzeResults = (groupId) => RCTAPI(`/rdb/results?groupId=${groupId}`) export const getPieByType = (analyzeResultId) => RCTAPI('/rdb/chart/DataTypeAnalyze', 'GET', {analyzeResultId}) export const getPrefixKeysCount = (analyzeResultId, prefixKey) => RCTAPI('/rdb/line/prefix/PrefixKeyByCount', 'GET', {analyzeResultId, prefixKey}) export const getPrefixKeysMemory = (analyzeResultId, prefixKey) => RCTAPI('/rdb/line/prefix/PrefixKeyByMemory', 'GET', {analyzeResultId, prefixKey}) export const getTop1000KeysByPrefix = (analyzeResultId) => API('/rdb/table/prefix', 'GET', {analyzeResultId}) export const getKeysTTLInfo = (analyzeResultId) => API('/rdb/chart/TTLAnalyze', 'GET', {analyzeResultId}) export const getTop1000KeysByType = (analyzeResultId, type) => RCTAPI('/rdb/top_key', 'GET', { analyzeResultId, type }) export const getTop1000KeysByString = (analyzeResultId) => RCTAPI('/rdb/top_key', 'GET', { analyzeResultId, type: 0 }) export const getTop1000KeysByHash = (analyzeResultId) => RCTAPI('/rdb/top_key', 'GET', { analyzeResultId, type: 5 }) export const getTop1000KeysByList = (analyzeResultId) => RCTAPI('/rdb/top_key', 'GET', { analyzeResultId, type: 10 }) export const getTop1000KeysBySet = (analyzeResultId) => RCTAPI('/rdb/top_key', 'GET', { analyzeResultId, type: 15 }) export const getTimeData = (analyzeResultId) => RCTAPI('/rdb/all/schedule_id', 'GET', { analyzeResultId }) export const getScheduleDetail = (id) => API(`/rdb/schedule_detail/${id}`) export const cancelAnalyzeTask = (id, scheduleID) => API(`/rdb/cance_job/${id}/${scheduleID}`) export const getSelectKeys = (analyzeResultId) => RCTAPI('/rdb/all/key_prefix', 'GET', { analyzeResultId }) <|start_filename|>redis-manager-dashboard/src/main/java/com/newegg/ec/redis/RedisManagerApplication.java<|end_filename|> package com.newegg.ec.redis; import org.mybatis.spring.annotation.MapperScan; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer; import org.springframework.scheduling.annotation.EnableAsync; import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.transaction.annotation.EnableTransactionManagement; /** * start * * @author Jay.H.Zou * @date 2019/7/17 */ @EnableScheduling @EnableAsync @EnableTransactionManagement @MapperScan({"com.newegg.ec.redis.dao", "com.newegg.ec.redis.plugin"}) @EnableEurekaServer @SpringBootApplication public class RedisManagerApplication { public static void main(String[] args) { SpringApplication.run(RedisManagerApplication.class); } } <|start_filename|>redis-manager-dashboard/src/main/java/com/newegg/ec/redis/util/ExcelUtil.java<|end_filename|> package com.newegg.ec.redis.util; import com.newegg.ec.redis.entity.ExcelData; import org.apache.poi.ss.usermodel.*; import org.apache.poi.xssf.usermodel.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.*; import java.util.List; import java.util.Map; /** * @ClassName ExcelUtil * @Description TODO * @Author kz37 * @Date 2018/10/18 */ public class ExcelUtil { private final static Logger LOG = LoggerFactory.getLogger(ExcelUtil.class); /** * please close workbook,after used! * @param dataMap * @param file * @return * @throws Exception */ public static Workbook writeExcel(Map<String, List<ExcelData>> dataMap, File file) throws Exception{ XSSFWorkbook workbook = new XSSFWorkbook(new FileInputStream(file)); for(Map.Entry<String, List<ExcelData>> entry : dataMap.entrySet()) { try { writeOneSheet(workbook, entry.getValue(), entry.getKey()); } catch (Exception e) { LOG.error("write workbook error!", e); } } return workbook; } private static void writeOneSheet(XSSFWorkbook xssfWorkbook, List<ExcelData> excelListData, String sheetName) { XSSFSheet sheet = xssfWorkbook.getSheet(sheetName); if(null == sheet) { sheet = xssfWorkbook.createSheet(sheetName); } List<String> rowData = null; for(ExcelData excelData : excelListData) { //XSSFCellStyle cellStyle = null; List<List<String>> sheetData = excelData.getTableData(); int startColumn = excelData.getStartColumn(); for(int i = 0; i < sheetData.size(); i++) { rowData = sheetData.get(i); writeOneRow(i, sheet, rowData, startColumn); } } } /*private static XSSFCellStyle getTableHeadStyle(XSSFWorkbook workbook) { XSSFCellStyle cellStyle = workbook.createCellStyle(); // Horizontal center cellStyle.setAlignment(HorizontalAlignment.CENTER); IndexedColorMap colorMap = workbook.getStylesSource().getIndexedColors(); // set head color XSSFColor blue = new XSSFColor(new java.awt.Color(79, 129, 189), colorMap); cellStyle.setFillForegroundColor(blue); cellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND); // font head color XSSFFont font = workbook.createFont(); XSSFColor white = new XSSFColor(new java.awt.Color(255, 255, 255), colorMap); font.setColor(white); cellStyle.setFont(font); return cellStyle; } private static XSSFCellStyle setBorder(XSSFCellStyle cellStyle) { cellStyle.setBorderBottom(BorderStyle.THIN); cellStyle.setBottomBorderColor(IndexedColors.BLACK.getIndex()); cellStyle.setBorderLeft(BorderStyle.THIN); cellStyle.setLeftBorderColor(IndexedColors.BLACK.getIndex()); cellStyle.setBorderRight(BorderStyle.THIN); cellStyle.setRightBorderColor(IndexedColors.BLACK.getIndex()); cellStyle.setBorderTop(BorderStyle.THIN); cellStyle.setTopBorderColor(IndexedColors.BLACK.getIndex()); return cellStyle; } private static XSSFCellStyle getTableBodyStyle(XSSFWorkbook workbook) { XSSFCellStyle cellStyle = workbook.createCellStyle(); // Horizontal center cellStyle.setAlignment(HorizontalAlignment.CENTER); XSSFFont font = workbook.createFont(); font.setFontName("Calibri"); cellStyle.setFont(font); return cellStyle; } private static void writeOneRow(int rowNumber, XSSFSheet sheet, List<String> data, XSSFCellStyle style) { XSSFRow row = sheet.createRow(rowNumber + 1);; XSSFCell cell = null; for(int i = 0; i < data.size(); i++) { cell = row.createCell(i); if(isNumber(data.get(i))){ cell.setCellValue(Double.parseDouble(data.get(i))); } else { cell.setCellValue(data.get(i)); } cell.setCellStyle(style); //sheet.autoSizeColumn(i); } }*/ private static boolean isNumber(String s){ try { Double.parseDouble(s); } catch (NumberFormatException e) { return false; } return true; } private static void writeOneRow(int rowNumber, XSSFSheet sheet, List<String> data, int startColumn) { XSSFCellStyle style = null; XSSFRow row = null; XSSFCell cell = null; /* if(rowNumber == 0){ //第一行采用excel中的格式 row = sheet.getRow(rowNumber + 1); }*/ row = sheet.getRow(rowNumber + 1); if( null == row){ row = sheet.createRow(rowNumber + 1); } for(int i = 0; i < data.size(); i++) { //cell = row.createCell(i); if(null == data.get(i) || data.get(i).equals("")) { startColumn++; continue; } if(rowNumber == 0){ cell = row.getCell(startColumn); } else { cell = row.createCell(startColumn); style = sheet.getRow(1).getCell(startColumn).getCellStyle(); cell.setCellStyle(style); } if(isNumber(data.get(i))){ cell.setCellValue(Double.parseDouble(data.get(i))); } else { cell.setCellValue(data.get(i)); } //sheet.autoSizeColumn(startColumn); startColumn++; } } public static void closeCloseable(Closeable closeable) { if(null != closeable) { try{ closeable.close(); } catch (Exception e) { LOG.error("close closeable fail!", e); } } } public static void writeFile(File file, Workbook workbook) { FileOutputStream fileOutputStream = null; try{ fileOutputStream = new FileOutputStream(file); workbook.write(fileOutputStream); } catch (FileNotFoundException e){ LOG.error("File Not Found", e); } catch (IOException e) { LOG.error("write to file failed!", e); } finally { closeCloseable(fileOutputStream); } } public static void writeExcelToFile(Map<String, List<ExcelData>> dataMap, String fileName) throws Exception{ writeExcelToFile(dataMap, fileName != null ? new File(fileName) : null); } public static void writeExcelToFile(Map<String, List<ExcelData>> dataMap, File file) throws Exception{ Workbook workbook = null; try { workbook = writeExcel(dataMap, file); writeFile(file, workbook); } catch (Exception e) { LOG.error("write Excel data to file error", e); } finally { closeCloseable(workbook); } } } <|start_filename|>redis-manager-dashboard/src/main/java/com/newegg/ec/redis/dao/IRdbAnalyze.java<|end_filename|> package com.newegg.ec.redis.dao; import com.newegg.ec.redis.entity.RDBAnalyze; import com.newegg.ec.redis.entity.RDBAnalyzeProvider; import org.apache.ibatis.annotations.*; import java.util.List; /** * @author Kyle.K.Zhao * @date 1/8/2020 16:26 */ @Mapper public interface IRdbAnalyze { @Update("UPDATE rdb_analyze SET schedule = #{schedule},auto_analyze=#{autoAnalyze}, " + "dataPath=#{dataPath}," + "prefixes=#{prefixes},is_report=#{report},analyzer=#{analyzer},mailTo=#{mailTo}" + "WHERE cluster_id = #{clusterId} AND group_id = #{groupId}") Integer updateRdbAnalyze(RDBAnalyze rdbAnalyze); @Select("select * from rdb_analyze where group_id=#{groupId}") @Results({ @Result(column = "id", property = "id"), @Result(column = "schedule", property = "schedule"), @Result(column = "auto_analyze", property = "autoAnalyze"), @Result(column = "dataPath", property = "dataPath"), @Result(column = "cluster_id", property = "cluster",one=@One(select="com.newegg.ec.redis.dao.IClusterDao.selectClusterById")), @Result(column = "prefixes", property = "prefixes"), @Result(column = "is_report", property = "report"), @Result(column = "analyzer", property = "analyzer"), @Result(column = "cluster_id", property = "clusterId"), @Result(column = "mailTo", property = "mailTo"), @Result(column = "group_id", property = "groupId") }) List<RDBAnalyze> queryList(@Param("groupId") Long groupId); @Select("select * from rdb_analyze") @Results({ @Result(column = "id", property = "id"), @Result(column = "schedule", property = "schedule"), @Result(column = "auto_analyze", property = "autoAnalyze"), @Result(column = "dataPath", property = "dataPath"), @Result(column = "cluster_id", property = "cluster",one=@One(select="com.newegg.ec.redis.dao.IClusterDao.selectClusterById")), @Result(column = "prefixes", property = "prefixes"), @Result(column = "is_report", property = "report"), @Result(column = "analyzer", property = "analyzer"), @Result(column = "cluster_id", property = "clusterId"), @Result(column = "mailTo", property = "mailTo"), @Result(column = "group_id", property = "groupId") }) List<RDBAnalyze> list(); @Select("select * from rdb_analyze where id=#{id}") @Results({ @Result(column = "id", property = "id"), @Result(column = "schedule", property = "schedule"), @Result(column = "auto_analyze", property = "autoAnalyze"), @Result(column = "dataPath", property = "dataPath"), @Result(column = "cluster_id", property = "cluster",one=@One(select="com.newegg.ec.redis.dao.IClusterDao.selectClusterById")), @Result(column = "prefixes", property = "prefixes"), @Result(column = "is_report", property = "report"), @Result(column = "analyzer", property = "analyzer"), @Result(column = "cluster_id", property = "clusterId"), @Result(column = "mailTo", property = "mailTo"), @Result(column = "group_id", property = "groupId") }) RDBAnalyze selectById(Long id); @Select("CREATE TABLE IF NOT EXISTS `rdb_analyze` (" + " `id` int(11) NOT NULL AUTO_INCREMENT," + " `auto_analyze` int(11) NOT NULL," + " `schedule` varchar(255) DEFAULT NULL," + " `dataPath` varchar(255) DEFAULT NULL," + " `prefixes` varchar(255) DEFAULT NULL," + " `is_report` int(11) DEFAULT NULL," + " `mailTo` varchar(255) DEFAULT NULL," + " `analyzer` varchar(255) DEFAULT NULL," + " `cluster_id` int(11) DEFAULT NULL," + " `group_id` int(11) DEFAULT NULL," + " PRIMARY KEY (`id`)" + ") ENGINE=InnoDB AUTO_INCREMENT=35 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;") void createRdbAnalyzeTable(); @Select("select id from rdb_analyze where cluster_id = #{cluster_id}") Long getRDBAnalyzeIdByCluster_id(Long cluster_id); @Select("select cluster_id from rdb_analyze where id=#{id}") Long selectClusterIdById(Long id); @Select("select * from rdb_analyze where cluster_id = #{cluster_id}") RDBAnalyze getRDBAnalyzeByCluster_id(Long cluster_id); @Select("select * from rdb_analyze where id = #{id}") RDBAnalyze getRDBAnalyzeById(Long id); @Insert("insert into rdb_analyze (auto_analyze,schedule,dataPath,prefixes,is_report,mailTo,analyzer,cluster_id,group_id) " + "values (#{autoAnalyze},#{schedule},#{dataPath},#{prefixes},#{report},#{mailTo},#{analyzer},#{clusterId},#{groupId})") @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id") Integer insert(RDBAnalyze rdbAnalyze); @Delete("DELETE FROM rdb_analyze WHERE id = #{id}") Integer delete(Long id); @Select("select count(1) from rdb_analyze where group_id=#{groupId} and cluster_id=#{clusterId}") int exits(RDBAnalyze rdbAnalyze); } <|start_filename|>redis-manager-dashboard/src/main/java/com/newegg/ec/redis/entity/TopKeyReportData.java<|end_filename|> package com.newegg.ec.redis.entity; /** * @author kz37 * @date 2018/10/23 */ public class TopKeyReportData { private String key; private String dataType; private long bytes; private long count; public String getKey() { return key; } public void setKey(String key) { this.key = key; } public String getDataType() { return dataType; } public void setDataType(String dataType) { this.dataType = dataType; } public long getBytes() { return bytes; } public void setBytes(long bytes) { this.bytes = bytes; } public long getCount() { return count; } public void setCount(long count) { this.count = count; } } <|start_filename|>redis-manager-dashboard/src/main/java/com/newegg/ec/redis/controller/SentinelMasterController.java<|end_filename|> package com.newegg.ec.redis.controller; import com.alibaba.fastjson.JSONObject; import com.newegg.ec.redis.aop.annotation.OperationLog; import com.newegg.ec.redis.entity.OperationObjectType; import com.newegg.ec.redis.entity.OperationType; import com.newegg.ec.redis.entity.Result; import com.newegg.ec.redis.entity.SentinelMaster; import com.newegg.ec.redis.service.IClusterService; import com.newegg.ec.redis.service.IRedisService; import com.newegg.ec.redis.service.ISentinelMastersService; import com.newegg.ec.redis.util.RedisUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.*; import java.util.ArrayList; import java.util.List; import java.util.Map; /** * @author Everly.J.Ju * @date 2020/2/12 */ @RequestMapping("/sentinel/*") @Controller public class SentinelMasterController { private static final Logger logger = LoggerFactory.getLogger(SentinelMasterController.class); @Autowired private IRedisService redisService; @Autowired private ISentinelMastersService sentinelMastersService; @Autowired private IClusterService clusterService; @RequestMapping(value = "/getSentinelMasterList/{clusterId}", method = RequestMethod.GET) @ResponseBody public Result getMasterInformation(@PathVariable("clusterId") Integer clusterId) { List<SentinelMaster> sentinelMaster = sentinelMastersService.getSentinelMasterByClusterId(clusterId); return Result.successResult(sentinelMaster); } @RequestMapping(value = "/getSentinelMasterByName", method = RequestMethod.POST) @ResponseBody public Result getSentinelMasterById(@RequestBody SentinelMaster sentinelMaster) { SentinelMaster sentinelMasterByName = sentinelMastersService.getSentinelMasterByMasterName(sentinelMaster.getClusterId(), sentinelMaster.getName()); return sentinelMasterByName != null ? Result.successResult(sentinelMaster) : Result.failResult(); } @RequestMapping(value = "/getSentinelMasterInfo", method = RequestMethod.POST) @ResponseBody public Result getSentinelMasterInfo(@RequestBody SentinelMaster sentinelMaster) { Map<String, String> masterMap = redisService.getSentinelMasterInfoByName(sentinelMaster); if (masterMap == null) { return Result.failResult(); } List<JSONObject> infoList = new ArrayList<>(); masterMap.forEach((key, value) -> { JSONObject jsonObject = new JSONObject(); jsonObject.put("key", key); jsonObject.put("value", value); infoList.add(jsonObject); }); return Result.successResult(infoList); } //新增,移除 sentinel master @RequestMapping(value = "/addSentinelMaster", method = RequestMethod.POST) @ResponseBody @OperationLog(type = OperationType.UPDATE, objType = OperationObjectType.CLUSTER) public Result add(@RequestBody SentinelMaster sentinelMaster) { boolean result = sentinelMastersService.addSentinelMaster(sentinelMaster); return result ? Result.successResult() : Result.failResult(); } @RequestMapping(value = "/deleteSentinelMaster", method = RequestMethod.POST) @ResponseBody @OperationLog(type = OperationType.UPDATE, objType = OperationObjectType.CLUSTER) public Result deleteSentinelMaster(@RequestBody SentinelMaster sentinelMaster) { boolean result = redisService.sentinelRemove(sentinelMaster) && sentinelMastersService.deleteSentinelMasterByName(sentinelMaster.getClusterId(), sentinelMaster.getName()); return result ? Result.successResult() : Result.failResult(); } @RequestMapping(value = "/monitorMaster", method = RequestMethod.POST) @ResponseBody @OperationLog(type = OperationType.UPDATE, objType = OperationObjectType.CLUSTER) public Result monitorMaster(@RequestBody SentinelMaster sentinelMaster) { boolean result = redisService.monitorMaster(sentinelMaster); if (result) { boolean saveResult = sentinelMastersService.addSentinelMaster(sentinelMaster); return saveResult ? Result.successResult() : Result.failResult(); } return Result.failResult(); } @RequestMapping(value = "/updateSentinelMaster", method = RequestMethod.POST) @ResponseBody @OperationLog(type = OperationType.UPDATE, objType = OperationObjectType.CLUSTER) public Result updateSentinelMaster(@RequestBody SentinelMaster sentinelMaster) { boolean result = redisService.sentinelSet(sentinelMaster); if (result) { boolean saveResult = sentinelMastersService.updateSentinelMaster(sentinelMaster); return saveResult ? Result.successResult() : Result.failResult(); } return Result.failResult(); } @RequestMapping(value = "/failoverSentinelMaster", method = RequestMethod.POST) @ResponseBody @OperationLog(type = OperationType.UPDATE, objType = OperationObjectType.CLUSTER) public Result failoverSentinelMaster(@RequestBody SentinelMaster sentinelMaster) { boolean result = redisService.failoverMaster(sentinelMaster); if (result) { Map<String, String> sentinelMasterInfoByName = redisService.getSentinelMasterInfoByName(sentinelMaster); String ip = sentinelMasterInfoByName.get("ip"); Integer port = Integer.parseInt(sentinelMasterInfoByName.get("port")); sentinelMaster.setHost(ip); sentinelMaster.setPort(port); sentinelMaster.setLastMasterNode(RedisUtil.getNodeString(ip, port)); boolean saveResult = sentinelMastersService.updateSentinelMaster(sentinelMaster); return saveResult ? Result.successResult() : Result.failResult(); } return Result.failResult(); } @RequestMapping(value = "/getSentinelMasterSlaves", method = RequestMethod.POST) @ResponseBody public Result getSentinelMasterSlaves(@RequestBody SentinelMaster sentinelMaster) { List<Map<String, String>> slaves = redisService.sentinelSlaves(sentinelMaster); if (slaves == null) { return Result.failResult(); } List<JSONObject> infoList = new ArrayList<>(); for (Map<String, String> slave : slaves) { slave.forEach((key, value) -> { JSONObject jsonObject = new JSONObject(); jsonObject.put("key", key); jsonObject.put("value", value); infoList.add(jsonObject); }); } return Result.successResult(infoList); } } <|start_filename|>redis-manager-dashboard/src/main/java/com/newegg/ec/redis/entity/ReportData.java<|end_filename|> package com.newegg.ec.redis.entity; /** * @author Kyle.K.Zhao * @date 1/8/2020 16:26 */ public class ReportData { private String key; private long count; private double countGrowthRate; private long bytes; private double bytesGrowthRate; public String getKey() { return key; } public void setKey(String key) { this.key = key; } public long getCount() { return count; } public void setCount(long count) { this.count = count; } public double getCountGrowthRate() { return countGrowthRate; } public void setCountGrowthRate(double countGrowthRate) { this.countGrowthRate = countGrowthRate; } public long getBytes() { return bytes; } public void setBytes(long bytes) { this.bytes = bytes; } public double getBytesGrowthRate() { return bytesGrowthRate; } public void setBytesGrowthRate(double bytesGrowthRate) { this.bytesGrowthRate = bytesGrowthRate; } @Override public String toString() { return "ReportData [prefix="+key+",count="+count+",countGrowthRate="+countGrowthRate+ ",bytes=" + bytes + ",bytesGrowthRate="+bytesGrowthRate+"]"; } } <|start_filename|>redis-manager-dashboard/src/main/java/com/newegg/ec/redis/service/IRdbAnalyzeResultService.java<|end_filename|> package com.newegg.ec.redis.service; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.newegg.ec.redis.entity.Cluster; import com.newegg.ec.redis.entity.RDBAnalyze; import com.newegg.ec.redis.entity.RDBAnalyzeResult; import com.newegg.ec.redis.entity.ReportData; import java.util.List; import java.util.Map; import java.util.Set; public interface IRdbAnalyzeResultService { void delete(Long id); void add(RDBAnalyzeResult rdbAnalyzeResult); List<RDBAnalyzeResult> selectList(Long groupId); RDBAnalyzeResult reportDataWriteToDb(RDBAnalyze rdbAnalyze, Map<String, String> data); Object getListStringFromResult(Long analyzeResultId, String key) throws Exception; JSONObject getPrefixLineByCountOrMem(Long analyzeResultId, String type, int top, String prefixKey); JSONArray getPrefixType(Long analyzeResultId) throws Exception; Map<String, ReportData> getReportDataLatest(Long clusterId, Long scheduleId); void createRdbAnalyzeResultTable(); List<RDBAnalyzeResult> getAllAnalyzeResult(List<RDBAnalyzeResult> results, List<Cluster> clusters); List<RDBAnalyzeResult> selectAllRecentlyResultById(Long resultId); Object getTopKeyFromResultByKey(Long analyzeResultId, Long key) throws Exception; } <|start_filename|>redis-manager-ui/redis-manager-vue/src/utils/format.js<|end_filename|> export function formatBytes (bytes) { if (bytes === 0) return '0 B' let k = 1024 // or 1000 let sizes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'] let i = Math.floor(Math.log(bytes) / Math.log(k)) return `${(bytes / Math.pow(k, i)).toFixed(1)} ${sizes[i]}` } export function formatterInput (value) { if (value) { return value.toString().replace(/(\d)(?=(\d{3})+(?:\.\d+)?$)/g, '$1,') } else { return '0' } }; <|start_filename|>redis-manager-dashboard/src/main/java/com/newegg/ec/redis/util/EurekaUtil.java<|end_filename|> package com.newegg.ec.redis.util; import com.netflix.discovery.shared.Applications; import com.netflix.eureka.EurekaServerContextHolder; import com.netflix.eureka.registry.PeerAwareInstanceRegistry; import com.newegg.ec.redis.entity.AnalyzeInstance; import java.util.ArrayList; import java.util.List; /** * @author:Truman.P.Du * @createDate: 2018年10月11日 下午1:46:13 * @version:1.0 * @description: Eureka工具类 */ public class EurekaUtil { /** * 获取eureka注册节点 * * @return List<AnalyzeInstance> */ public static List<AnalyzeInstance> getRegisterNodes() { PeerAwareInstanceRegistry registry = EurekaServerContextHolder.getInstance().getServerContext().getRegistry(); Applications applications = registry.getApplications(); List<AnalyzeInstance> analyzes = new ArrayList<>(); applications.getRegisteredApplications().forEach((registeredApplication) -> { registeredApplication.getInstances().forEach((instance) -> { AnalyzeInstance analyzeInstance = new AnalyzeInstance(instance.getIPAddr(), instance.getPort()); analyzes.add(analyzeInstance); }); }); return analyzes; } } <|start_filename|>redis-manager-dashboard/src/main/java/com/newegg/ec/redis/entity/RDBAnalyzeProvider.java<|end_filename|> package com.newegg.ec.redis.entity; import org.apache.ibatis.annotations.Param; import org.apache.ibatis.jdbc.SQL; /** * @author kz37 * @version 1.0.0 */ public class RDBAnalyzeProvider extends SQL { private static final String TABLE_NAME = "rdb_analyze"; public String updateRdbAnalyze(@Param("rdbAnalyze") RDBAnalyze rdbAnalyze) { return new SQL(){{ UPDATE(TABLE_NAME); SET("auto_analyze = #{rdbAnalyze.autoAnalyze}"); SET("schedule = #{rdbAnalyze.schedule}"); SET("dataPath = #{rdbAnalyze.dataPath}"); SET("prefixes = #{rdbAnalyze.prefixes}"); SET("is_report = #{rdbAnalyze.report}"); SET("mailTo = #{rdbAnalyze.mailTo}"); SET("analyzer = #{rdbAnalyze.analyzer}"); WHERE("id = #{rdbAnalyze.id}"); }}.toString(); } } <|start_filename|>redis-manager-dashboard/src/main/java/com/newegg/ec/redis/service/IRdbScheduleJob.java<|end_filename|> package com.newegg.ec.redis.service; import org.quartz.Job; /** * @author Kyle.K.Zhao * @date 1/9/2020 08:22 */ public interface IRdbScheduleJob extends Job{ } <|start_filename|>redis-manager-dashboard/src/main/java/com/newegg/ec/redis/controller/NodeManageController.java<|end_filename|> package com.newegg.ec.redis.controller; import com.alibaba.fastjson.JSONObject; import com.google.common.base.Strings; import com.newegg.ec.redis.aop.annotation.OperationLog; import com.newegg.ec.redis.entity.*; import com.newegg.ec.redis.plugin.install.service.AbstractNodeOperation; import com.newegg.ec.redis.service.IClusterService; import com.newegg.ec.redis.service.IMachineService; import com.newegg.ec.redis.service.IRedisNodeService; import com.newegg.ec.redis.service.IRedisService; import com.newegg.ec.redis.util.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.*; import redis.clients.jedis.HostAndPort; import java.util.*; import static com.newegg.ec.redis.util.RedisConfigUtil.*; import static com.newegg.ec.redis.util.RedisUtil.REDIS_MODE_CLUSTER; import static com.newegg.ec.redis.util.TimeUtil.FIVE_SECONDS; /** * @author Jay.H.Zou * @date 9/25/2019 */ @RequestMapping("/node-manage/*") @Controller public class NodeManageController { private static final Logger logger = LoggerFactory.getLogger(NodeManageController.class); @Autowired private IClusterService clusterService; @Autowired private IRedisService redisService; @Autowired private IRedisNodeService redisNodeService; @Autowired private IMachineService machineService; /** * 在此处理 node 之间的关系 * * @param clusterId * @return */ @RequestMapping(value = "/getAllNodeList/{clusterId}", method = RequestMethod.GET) @ResponseBody public Result getAllNodeList(@PathVariable("clusterId") Integer clusterId) { Cluster cluster = clusterService.getClusterById(clusterId); if (cluster == null) { return Result.failResult().setMessage("Get cluster failed."); } List<RedisNode> redisNodeList = redisService.getRealRedisNodeList(cluster); List<RedisNode> redisNodeSorted = redisNodeService.sortRedisNodeList(redisNodeList); return Result.successResult(redisNodeSorted); } @RequestMapping(value = "/getAllNodeListWithStatus/{clusterId}", method = RequestMethod.GET) @ResponseBody public Result getAllNodeListWithStatus(@PathVariable("clusterId") Integer clusterId) { List<RedisNode> redisNodeList = redisNodeService.getMergedRedisNodeList(clusterId); return Result.successResult(redisNodeService.sortRedisNodeList(redisNodeList)); } @RequestMapping(value = "/getNodeInfo", method = RequestMethod.POST) @ResponseBody public Result getNodeInfo(@RequestBody RedisNode redisNode) { Integer clusterId = redisNode.getClusterId(); Cluster cluster = clusterService.getClusterById(clusterId); HostAndPort hostAndPort = new HostAndPort(redisNode.getHost(), redisNode.getPort()); Map<String, String> infoMap = redisService.getNodeInfo(hostAndPort, cluster.getRedisPassword()); if (infoMap == null) { return Result.failResult(); } List<JSONObject> infoList = new ArrayList<>(); infoMap.forEach((key, value) -> { JSONObject jsonObject = new JSONObject(); jsonObject.put("key", key); jsonObject.put("value", value); jsonObject.put("description", RedisNodeInfoUtil.getNodeInfoItemDesc(key)); infoList.add(jsonObject); }); return Result.successResult(infoList); } @RequestMapping(value = "/getConfig", method = RequestMethod.POST) @ResponseBody public Result getConfig(@RequestBody RedisNode redisNode) { Integer clusterId = redisNode.getClusterId(); Cluster cluster = clusterService.getClusterById(clusterId); Map<String, String> configMap = redisService.getConfig(redisNode, cluster.getRedisPassword(), null); if (configMap == null) { return Result.failResult(); } List<JSONObject> configList = new ArrayList<>(); configMap.forEach((key, value) -> { JSONObject jsonObject = new JSONObject(); jsonObject.put("key", key); jsonObject.put("value", value); jsonObject.put("description", RedisConfigUtil.getConfigItemDesc(key)); configList.add(jsonObject); }); return Result.successResult(configList); } @RequestMapping(value = "/getConfigCurrentValue", method = RequestMethod.POST) @ResponseBody public Result getConfigCurrentValue(@RequestBody JSONObject jsonObject) { Cluster cluster = jsonObject.getObject("cluster", Cluster.class); String configKey = jsonObject.getString("configKey"); List<RedisNode> redisNodeList = redisService.getRealRedisNodeList(cluster); List<JSONObject> configList = new ArrayList<>(redisNodeList.size()); redisNodeList.forEach(redisNode -> { Map<String, String> configMap = redisService.getConfig(redisNode, cluster.getRedisPassword(), configKey); JSONObject config = new JSONObject(); config.put("redisNode", RedisUtil.getNodeString(redisNode)); if (configMap != null) { config.put("configValue", configMap.get(configKey)); } configList.add(config); }); return Result.successResult(configList); } @RequestMapping(value = "/getRedisConfigKeyList", method = RequestMethod.GET) @ResponseBody public Result getRedisConfigKeyList() { Set<String> configKeyList = RedisConfigUtil.getConfigKeyList(); configKeyList.removeIf(configKey -> Objects.equals(configKey, REQUIRE_PASS) || Objects.equals(configKey, MASTER_AUTH) || Objects.equals(configKey, BIND) || Objects.equals(configKey, PORT) || Objects.equals(configKey, DIR) || Objects.equals(configKey, DAEMONIZE)); return Result.successResult(configKeyList); } @RequestMapping(value = "/updateRedisConfig", method = RequestMethod.POST) @ResponseBody @OperationLog(type = OperationType.UPDATE, objType = OperationObjectType.REDIS_CONFIG) public Result updateRedisConfig(@RequestBody JSONObject jsonObject) { Integer clusterId = jsonObject.getInteger("clusterId"); RedisConfigUtil.RedisConfig redisConfig = jsonObject.getObject("redisConfig", RedisConfigUtil.RedisConfig.class); Cluster cluster = clusterService.getClusterById(clusterId); boolean result = redisService.setConfigBatch(cluster, redisConfig); return result ? Result.successResult() : Result.failResult(); } /** * TODO: jedis 暂无该 API,需自己完成 * * @param redisNodeList * @return */ @RequestMapping(value = "/purgeMemory", method = RequestMethod.POST) @ResponseBody @OperationLog(type = OperationType.PURGE_MEMORY, objType = OperationObjectType.NODE) public Result purgeMemory(@RequestBody List<RedisNode> redisNodeList) { if (!verifyRedisNodeList(redisNodeList)) { return Result.failResult(); } return Result.successResult(); } @RequestMapping(value = "/forget", method = RequestMethod.POST) @ResponseBody @OperationLog(type = OperationType.FORGET, objType = OperationObjectType.NODE) public Result forget(@RequestBody List<RedisNode> redisNodeList) { Result result = clusterOperate(redisNodeList, (cluster, redisNode) -> { String node = RedisUtil.getNodeString(redisNode); String nodes = cluster.getNodes(); if (nodes.contains(node)) { logger.warn("I can't forget " + node + ", because it in the database"); return true; } return redisService.clusterForget(cluster, redisNode); }); return result; } @RequestMapping(value = "/moveSlot", method = RequestMethod.POST) @ResponseBody @OperationLog(type = OperationType.MOVE_SLOT, objType = OperationObjectType.NODE) public Result moveSlot(@RequestBody JSONObject jsonObject) { RedisNode redisNode = jsonObject.getObject("redisNode", RedisNode.class); SlotBalanceUtil.Shade slot = jsonObject.getObject("slotRange", SlotBalanceUtil.Shade.class); Cluster cluster = getCluster(redisNode.getClusterId()); boolean result = redisService.clusterMoveSlots(cluster, redisNode, slot); return result ? Result.successResult() : Result.failResult(); } @RequestMapping(value = "/replicateOf", method = RequestMethod.POST) @ResponseBody @OperationLog(type = OperationType.REPLICATE_OF, objType = OperationObjectType.NODE) public Result replicateOf(@RequestBody List<RedisNode> redisNodeList) { Result result = clusterOperate(redisNodeList, (cluster, redisNode) -> redisService.clusterReplicate(cluster, redisNode.getMasterId(), redisNode)); return result; } @RequestMapping(value = "/standaloneForget", method = RequestMethod.POST) @ResponseBody @OperationLog(type = OperationType.FORGET, objType = OperationObjectType.NODE) public Result standaloneForget(@RequestBody List<RedisNode> redisNodeList) { Result result = clusterOperate(redisNodeList, (cluster, redisNode) -> redisService.standaloneReplicaNoOne(cluster, redisNode)); return result; } @RequestMapping(value = "/standaloneReplicateOf", method = RequestMethod.POST) @ResponseBody @OperationLog(type = OperationType.REPLICATE_OF, objType = OperationObjectType.NODE) public Result standaloneReplicateOf(@RequestBody List<RedisNode> redisNodeList) { Result result = clusterOperate(redisNodeList, (cluster, redisNode) -> { String masterNode = redisNode.getMasterId(); HostAndPort hostAndPort = RedisUtil.nodesToHostAndPort(masterNode); RedisNode masterRedisNode = RedisNode.masterRedisNode(hostAndPort); String resultMessage = redisService.standaloneReplicaOf(cluster, masterRedisNode, redisNode); return Strings.isNullOrEmpty(resultMessage); }); return result; } @RequestMapping(value = "/failOver", method = RequestMethod.POST) @ResponseBody @OperationLog(type = OperationType.FAIL_OVER, objType = OperationObjectType.NODE) public Result failOver(@RequestBody List<RedisNode> redisNodeList) { Result result = clusterOperate(redisNodeList, (cluster, redisNode) -> redisService.clusterFailOver(cluster, redisNode)); return result; } @RequestMapping(value = "/start", method = RequestMethod.POST) @ResponseBody @OperationLog(type = OperationType.START, objType = OperationObjectType.NODE) public Result start(@RequestBody List<RedisNode> redisNodeList) { Result result = nodeOperate(redisNodeList, (cluster, redisNode, abstractNodeOperation) -> { if (NetworkUtil.telnet(redisNode.getHost(), redisNode.getPort())) { return true; } else { return abstractNodeOperation.start(cluster, redisNode); } }); return result; } @RequestMapping(value = "/stop", method = RequestMethod.POST) @ResponseBody @OperationLog(type = OperationType.STOP, objType = OperationObjectType.NODE) public Result stop(@RequestBody List<RedisNode> redisNodeList) { Result result = nodeOperate(redisNodeList, (cluster, redisNode, abstractNodeOperation) -> { if (NetworkUtil.telnet(redisNode.getHost(), redisNode.getPort())) { return abstractNodeOperation.stop(cluster, redisNode); } else { return false; } }); return result; } @RequestMapping(value = "/restart", method = RequestMethod.POST) @ResponseBody @OperationLog(type = OperationType.RESTART, objType = OperationObjectType.NODE) public Result restart(@RequestBody List<RedisNode> redisNodeList) { Result result = nodeOperate(redisNodeList, (cluster, redisNode, abstractNodeOperation) -> { if (NetworkUtil.telnet(redisNode.getHost(), redisNode.getPort())) { return abstractNodeOperation.restart(cluster, redisNode); } else { return abstractNodeOperation.start(cluster, redisNode); } }); return result; } @RequestMapping(value = "/delete", method = RequestMethod.POST) @ResponseBody @OperationLog(type = OperationType.DELETE, objType = OperationObjectType.NODE) public Result delete(@RequestBody List<RedisNode> redisNodeList) { Result result = nodeOperate(redisNodeList, (cluster, redisNode, abstractNodeOperation) -> { if (NetworkUtil.telnet(redisNode.getHost(), redisNode.getPort())) { return false; } else { abstractNodeOperation.remove(cluster, redisNode); redisNodeService.deleteRedisNodeById(redisNode.getRedisNodeId()); return true; } }); return result; } @RequestMapping(value = "/editConfig", method = RequestMethod.POST) @ResponseBody public Result editConfig(@RequestBody List<RedisNode> redisNodeList, RedisConfigUtil.RedisConfig redisConfig) { return Result.successResult(); } @RequestMapping(value = "/importNode", method = RequestMethod.POST) @ResponseBody @OperationLog(type = OperationType.IMPORT, objType = OperationObjectType.NODE) public Result importNode(@RequestBody List<RedisNode> redisNodeList) { try { RedisNode firstRedisNode = redisNodeList.get(0); final Cluster cluster = getCluster(firstRedisNode.getClusterId()); String result = redisService.clusterImport(cluster, redisNodeList); return Strings.isNullOrEmpty(result) ? Result.successResult() : Result.failResult().setMessage(result); } catch (Exception e) { e.printStackTrace(); return Result.failResult().setMessage(e.getMessage()); } } @RequestMapping(value = "/initSlots", method = RequestMethod.POST) @ResponseBody @OperationLog(type = OperationType.INIT_SLOTS, objType = OperationObjectType.CLUSTER) public Result initSlots(@RequestBody Cluster cluster) { cluster = clusterService.getClusterById(cluster.getClusterId()); String result = redisService.initSlots(cluster); return Strings.isNullOrEmpty(result) ? Result.successResult() : Result.failResult().setMessage(result); } private Cluster getCluster(Integer clusterId) { return clusterService.getClusterById(clusterId); } private boolean verifyRedisNodeList(List<RedisNode> redisNodeList) { return redisNodeList != null && !redisNodeList.isEmpty(); } /** * cluster operation * * @param redisNodeList * @param clusterHandler * @return */ private Result clusterOperate(List<RedisNode> redisNodeList, ClusterHandler clusterHandler) { if (!verifyRedisNodeList(redisNodeList)) { return Result.failResult(); } Integer clusterId = redisNodeList.get(0).getClusterId(); Cluster cluster = getCluster(clusterId); StringBuffer messageBuffer = new StringBuffer(); redisNodeList.forEach(redisNode -> { try { String[] nodeArr = SignUtil.splitByCommas(cluster.getNodes()); String node = RedisUtil.getNodeString(redisNode); if (nodeArr.length > 1) { StringBuilder newNodes = new StringBuilder(); for (String nodeItem : nodeArr) { if (!Objects.equals(node, nodeItem) && !Strings.isNullOrEmpty(nodeItem)) { newNodes.append(nodeItem).append(SignUtil.COMMAS); } } cluster.setNodes(newNodes.toString()); clusterService.updateNodes(cluster); } boolean handleResult = clusterHandler.handle(cluster, redisNode); if (!handleResult) { messageBuffer.append(redisNode.getHost() + ":" + redisNode.getPort() + " operation failed.\n"); } } catch (Exception e) { logger.error("Operation failed.", e); } }); String message = messageBuffer.toString(); return Strings.isNullOrEmpty(message) ? Result.successResult() : Result.failResult().setMessage(message); } /** * node operation * * @param redisNodeList * @param nodeHandler * @return */ private Result nodeOperate(List<RedisNode> redisNodeList, NodeHandler nodeHandler) { if (!verifyRedisNodeList(redisNodeList)) { return Result.failResult(); } Integer clusterId = redisNodeList.get(0).getClusterId(); Cluster cluster = getCluster(clusterId); AbstractNodeOperation nodeOperation = clusterService.getNodeOperation(cluster.getInstallationEnvironment()); StringBuffer messageBuffer = new StringBuffer(); redisNodeList.forEach(redisNode -> { try { String[] nodeArr = SignUtil.splitByCommas(cluster.getNodes()); String node = RedisUtil.getNodeString(redisNode); if (nodeArr.length > 1) { StringBuilder newNodes = new StringBuilder(); for (String nodeItem : nodeArr) { if (!Objects.equals(node, nodeItem) && !Strings.isNullOrEmpty(nodeItem)) { newNodes.append(nodeItem).append(SignUtil.COMMAS); } } cluster.setNodes(newNodes.toString()); clusterService.updateNodes(cluster); } boolean handleResult = nodeHandler.handle(cluster, redisNode, nodeOperation); if (!handleResult) { messageBuffer.append(redisNode.getHost() + ":" + redisNode.getPort() + " operation failed.\n"); } } catch (Exception e) { logger.error("Node operation failed.", e); } }); String message = messageBuffer.toString(); return Strings.isNullOrEmpty(message) ? Result.successResult() : Result.failResult().setMessage(message); } interface ClusterHandler { boolean handle(Cluster cluster, RedisNode redisNode); } interface NodeHandler { boolean handle(Cluster cluster, RedisNode redisNode, AbstractNodeOperation abstractNodeOperation); } } <|start_filename|>redis-manager-dashboard/src/main/java/com/newegg/ec/redis/config/QuartzSchedule.java<|end_filename|> package com.newegg.ec.redis.config; import com.newegg.ec.redis.plugin.rct.common.JobFactory; import com.newegg.ec.redis.schedule.RDBScheduleJob; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.scheduling.quartz.JobDetailFactoryBean; import org.springframework.scheduling.quartz.SchedulerFactoryBean; import java.io.IOException; /** * @author Kyle.K.Zhao * @date 1/9/2020 08:18 */ @Configuration public class QuartzSchedule { @Autowired private JobFactory jobFactory; @Bean(name = "schedulerFactoryBean") public SchedulerFactoryBean schedulerFactoryBean() throws IOException { SchedulerFactoryBean factory = new SchedulerFactoryBean(); factory.setOverwriteExistingJobs(true); // 延时启动 factory.setStartupDelay(20); // 自定义Job Factory,用于Spring注入 factory.setJobFactory(jobFactory); return factory; } @Bean(name = "rdbScheduleJob") public JobDetailFactoryBean rdbScheduleJob() { JobDetailFactoryBean jobDetail = new JobDetailFactoryBean(); jobDetail.setJobClass(RDBScheduleJob.class); return jobDetail; } } <|start_filename|>redis-manager-dashboard/src/main/java/com/newegg/ec/redis/service/ISentinelMastersService.java<|end_filename|> package com.newegg.ec.redis.service; import com.newegg.ec.redis.entity.SentinelMaster; import java.util.List; /** * @author Jay.H.Zou * @date 1/22/2020 */ public interface ISentinelMastersService { List<SentinelMaster> getSentinelMasterByClusterId(Integer clusterId); SentinelMaster getSentinelMasterByMasterName(Integer clusterId, String masterName); SentinelMaster getSentinelMasterById(Integer sentinelMasterId); boolean updateSentinelMaster(SentinelMaster sentinelMaster); boolean addSentinelMaster(SentinelMaster sentinelMaster); boolean deleteSentinelMasterByName(Integer clusterId, String masterName); boolean deleteSentinelMasterByClusterId(Integer clusterId); } <|start_filename|>redis-manager-dashboard/src/main/java/com/newegg/ec/redis/entity/RDBAnalyzeResult.java<|end_filename|> package com.newegg.ec.redis.entity; /** * @author Kyle.K.Zhao * @date 1/8/2020 16:26 */ public class RDBAnalyzeResult { private Long id; private Long groupId; private Long scheduleId; private Long clusterId; private String analyzeConfig; private String result; private boolean done; private String clusterName; public boolean isDone() { return done; } public void setDone(boolean done) { this.done = done; } public Long getGroupId() { return groupId; } public void setGroupId(Long groupId) { this.groupId = groupId; } public String getClusterName() { return clusterName; } public void setClusterName(String clusterName) { this.clusterName = clusterName; } public Long getClusterId() { return clusterId; } public void setClusterId(Long clusterId) { this.clusterId = clusterId; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public Long getScheduleId() { return scheduleId; } public void setScheduleId(Long scheduleId) { this.scheduleId = scheduleId; } public String getResult() { return result; } public void setResult(String result) { this.result = result; } public String getAnalyzeConfig() { return analyzeConfig; } public void setAnalyzeConfig(String analyzeConfig) { this.analyzeConfig = analyzeConfig; } } <|start_filename|>redis-manager-dashboard/src/main/java/com/newegg/ec/redis/entity/RedisNode.java<|end_filename|> package com.newegg.ec.redis.entity; import redis.clients.jedis.HostAndPort; import java.sql.Timestamp; /** * For * * @author Jay.H.Zou * @date 7/25/2019 */ public class RedisNode { public static final String CONNECTED = "connected"; public static final String UNCONNECTED = "unconnected"; /** * mysql table id */ private Integer redisNodeId; private Integer groupId; private Integer clusterId; private String nodeId; /*** * 如果节点是slave,并且已知master节点,则这里列出master节点ID,否则的话这里列出"-" */ private String masterId; private String host; private int port; private NodeRole nodeRole; /** * myself: 当前连接的节点 * master: 节点是master. * slave: 节点是slave. * fail?: 节点处于PFAIL 状态。 当前节点无法联系,但逻辑上是可达的 (非 FAIL 状态). * fail: 节点处于FAIL 状态. 大部分节点都无法与其取得联系将会将改节点由 PFAIL 状态升级至FAIL状态。 * handshake: 还未取得信任的节点,当前正在与其进行握手. * noaddr: 没有地址的节点(No address known for this node). * noflags: 连个标记都没有(No flags at all). */ private String flags; /** * link-state: node-to-node 集群总线使用的链接的状态,我们使用这个链接与集群中其他节点进行通信.值可以是 connected 和 disconnected. */ private String linkState; private String slotRange; private int slotNumber; private String containerId; private String containerName; private boolean inCluster; private boolean runStatus; private Timestamp insertTime; private Timestamp updateTime; public RedisNode() { } public RedisNode(String host, int port, NodeRole nodeRole) { this(null, host, port, nodeRole); } public RedisNode(String nodeId, String host, int port, NodeRole nodeRole) { this.nodeId = nodeId; this.host = host; this.port = port; this.nodeRole = nodeRole; } public RedisNode(String host, int port) { this(host, port, NodeRole.UNKNOWN); } public static RedisNode masterRedisNode(String host, int port) { return new RedisNode(host, port, NodeRole.MASTER); } public static RedisNode masterRedisNode(HostAndPort hostAndPort) { return new RedisNode(hostAndPort.getHost(), hostAndPort.getPort(), NodeRole.MASTER); } public static RedisNode masterRedisNode(String nodeId, String host, int port) { return new RedisNode(nodeId, host, port, NodeRole.MASTER); } public static RedisNode slaveRedisNode(String host, int port) { return new RedisNode(host, port, NodeRole.SLAVE); } public static RedisNode slaveRedisNode(String nodeId, String host, int port) { return new RedisNode(nodeId, host, port, NodeRole.SLAVE); } public Integer getRedisNodeId() { return redisNodeId; } public void setRedisNodeId(Integer redisNodeId) { this.redisNodeId = redisNodeId; } public Integer getGroupId() { return groupId; } public void setGroupId(Integer groupId) { this.groupId = groupId; } public Integer getClusterId() { return clusterId; } public void setClusterId(Integer clusterId) { this.clusterId = clusterId; } public String getNodeId() { return nodeId; } public void setNodeId(String nodeId) { this.nodeId = nodeId; } public String getMasterId() { return masterId; } public void setMasterId(String masterId) { this.masterId = masterId; } public String getHost() { return host; } public void setHost(String host) { this.host = host; } public int getPort() { return port; } public void setPort(int port) { this.port = port; } public NodeRole getNodeRole() { return nodeRole; } public void setNodeRole(NodeRole nodeRole) { this.nodeRole = nodeRole; } public String getFlags() { return flags; } public void setFlags(String flags) { this.flags = flags; } public String getLinkState() { return linkState; } public void setLinkState(String linkState) { this.linkState = linkState; } public String getSlotRange() { return slotRange; } public void setSlotRange(String slotRange) { this.slotRange = slotRange; } public int getSlotNumber() { return slotNumber; } public void setSlotNumber(int slotNumber) { this.slotNumber = slotNumber; } public String getContainerId() { return containerId; } public void setContainerId(String containerId) { this.containerId = containerId; } public String getContainerName() { return containerName; } public void setContainerName(String containerName) { this.containerName = containerName; } public boolean getInCluster() { return inCluster; } public void setInCluster(boolean inCluster) { this.inCluster = inCluster; } public boolean getRunStatus() { return runStatus; } public void setRunStatus(boolean runStatus) { this.runStatus = runStatus; } public Timestamp getInsertTime() { return insertTime; } public void setInsertTime(Timestamp insertTime) { this.insertTime = insertTime; } public Timestamp getUpdateTime() { return updateTime; } public void setUpdateTime(Timestamp updateTime) { this.updateTime = updateTime; } } <|start_filename|>redis-manager-dashboard/src/test/java/com/newegg/ec/redis/util/StringUtilTest.java<|end_filename|> package com.newegg.ec.redis.util; import com.alibaba.fastjson.JSONObject; import com.newegg.ec.redis.RedisManagerApplication; import com.newegg.ec.redis.entity.RDBAnalyzeResult; import com.newegg.ec.redis.service.impl.RdbAnalyzeResultService; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import java.util.HashMap; import java.util.Map; @RunWith(SpringJUnit4ClassRunner.class) @SpringBootTest(classes = RedisManagerApplication.class) public class StringUtilTest { @Autowired private RdbAnalyzeResultService rdbAnalyzeResultService; @Test public void sortStr() { RDBAnalyzeResult rdbAnalyzeResults = rdbAnalyzeResultService.selectResultById(850L); String analyze = rdbAnalyzeResults.getResult(); Map<String, String> map = new HashMap<>(); JSONObject object = JSONObject.parseObject(analyze); object.keySet().forEach(key -> { map.put(key, object.getString(key)); }); rdbAnalyzeResultService.combinePrefixKey(map).forEach((k,v)->{ System.out.println(k+":"+v); }); } } <|start_filename|>redis-manager-dashboard/src/main/java/com/newegg/ec/redis/plugin/install/entity/InstallationLogContainer.java<|end_filename|> package com.newegg.ec.redis.plugin.install.entity; import com.google.common.base.Strings; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.concurrent.BlockingDeque; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.LinkedBlockingDeque; import java.util.concurrent.TimeUnit; /** * TODO: 并发问题 * * @author Jay.H.Zou * @date 4/5/2020 */ public class InstallationLogContainer { private static final Map<String, BlockingDeque<String>> INSTALLATION_LOG = new ConcurrentHashMap<>(); public static boolean isNotUsed(String clusterName) { return !INSTALLATION_LOG.containsKey(clusterName); } public static void remove(String clusterName) { INSTALLATION_LOG.remove(clusterName); } public static void appendLog(String clusterName, String message) { BlockingDeque<String> logQueue = getLogDeque(clusterName); if (!Strings.isNullOrEmpty(message)) { logQueue.add("[Installation] " + message); } } public static List<String> getLogs(String clusterName) { List<String> logs = new LinkedList<>(); BlockingDeque<String> logContainer = getLogDeque(clusterName); try { while (!logContainer.isEmpty()) { String log = logContainer.pollFirst(1, TimeUnit.SECONDS); if (!Strings.isNullOrEmpty(log)) { logs.add(log); } } } catch (InterruptedException e) { e.printStackTrace(); } return logs; } private static BlockingDeque<String> getLogDeque(String clusterName) { BlockingDeque<String> logDeque = INSTALLATION_LOG.get(clusterName); if (logDeque == null) { logDeque = new LinkedBlockingDeque<>(); } INSTALLATION_LOG.put(clusterName, logDeque); return logDeque; } } <|start_filename|>redis-manager-dashboard/src/main/java/com/newegg/ec/redis/util/RedisUtil.java<|end_filename|> package com.newegg.ec.redis.util; import com.google.common.base.Strings; import com.newegg.ec.redis.entity.RedisNode; import redis.clients.jedis.HostAndPort; import java.io.BufferedReader; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStreamReader; import java.nio.charset.StandardCharsets; import java.util.HashSet; import java.util.LinkedHashMap; import java.util.Map; import java.util.Set; import static com.newegg.ec.redis.util.SignUtil.MINUS; /** * @author Jay.H.Zou * @date 7/26/2019 */ public class RedisUtil { public static final String REDIS_MODE_STANDALONE = "standalone"; public static final String REDIS_MODE_CLUSTER = "cluster"; public static final String REDIS_MODE_SENTINEL = "sentinel"; /** * nodes 相关 */ public static final String IP = "ip"; public static final String PORT = "port"; public static final String ROLE = "role"; /** * 还未取得信任的节点,当前正在与其进行握手 */ public static final String HANDSHAKE = "handshake"; /** * 节点处于FAIL 状态, 大部分节点都无法与其取得联系将会将改节点由 PFAIL 状态升级至FAIL状态 */ public static final String FAIL = "fail"; /** * 节点处于PFAIL 状态, 当前节点无法联系,但逻辑上是可达的 (非 FAIL 状态). */ public static final String PFAIL = "fail?"; /** * 没有地址的节点(No address known for this node) */ public static final String NOADDR = "noaddr"; /** * 没有地址的节点(No address known for this node) */ public static final String NOFLAGS = "noflags"; public static final String MASTER_HOST = "master_host"; public static final String MASTER_PORT = "master_port"; private RedisUtil() { } /** * info => map * cluster info => map * * @param info * @return * @throws IOException */ public static Map<String, String> parseInfoToMap(String info) throws IOException { Map<String, String> infoMap = new LinkedHashMap<>(); BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(new ByteArrayInputStream(info.getBytes(StandardCharsets.UTF_8)), StandardCharsets.UTF_8)); String line; while ((line = bufferedReader.readLine()) != null) { String[] keyValue = SignUtil.splitByColon(line); if (keyValue.length < 2) { continue; } String key = keyValue[0]; String value = keyValue[1]; if (Strings.isNullOrEmpty(key) || Strings.isNullOrEmpty(value)) { continue; } infoMap.put(key, value); } return infoMap; } public static Set<HostAndPort> nodesToHostAndPortSet(String nodes) { String[] nodeList = SignUtil.splitByCommas(nodes); int length = nodeList.length; Set<HostAndPort> hostAndPortSet = new HashSet<>(length); if (length > 0) { for (String node : nodeList) { String[] ipAndPort = SignUtil.splitByColon(node); HostAndPort hostAndPort = new HostAndPort(ipAndPort[0], Integer.parseInt(ipAndPort[1])); hostAndPortSet.add(hostAndPort); } } return hostAndPortSet; } public static HostAndPort nodesToHostAndPort(String node) { Set<HostAndPort> hostAndPortSet = nodesToHostAndPortSet(node); return hostAndPortSet.iterator().next(); } public static String[] removeCommandAndKey(String[] list) { int length = list.length; String[] items = new String[length - 2]; for (int i = 2, j = 0; i < length; i++, j++) { items[j] = list[i]; } return items; } public static String getKey(String command) { return SignUtil.splitBySpace(command)[1]; } public static String getNodeString(RedisNode redisNode) { return redisNode.getHost() + SignUtil.COLON + redisNode.getPort(); } public static String getNodeString(String host, int port) { return host + SignUtil.COLON + port; } public static String generateContainerName(String clusterName, int port) { String containerNamePrefix = SignUtil.replaceSpaceToMinus(clusterName); if (containerNamePrefix.endsWith(MINUS)) { return (containerNamePrefix + port).toLowerCase(); } else { return (containerNamePrefix + MINUS + port).toLowerCase(); } } } <|start_filename|>redis-manager-dashboard/src/main/java/com/newegg/ec/redis/entity/ScheduleInfo.java<|end_filename|> package com.newegg.ec.redis.entity; import java.util.Arrays; import java.util.HashSet; import java.util.Set; /** * @author:Truman.P.Du * @createDate: 2018年4月11日 下午1:59:17 * @version:1.0 * @description: */ public class ScheduleInfo { private long scheduleID; private String dataPath; private String prefixes; private int[] analyzerTypes; private Set<String> ports = new HashSet<>(); public ScheduleInfo() { } public ScheduleInfo(long scheduleID, String dataPath, String prefixes, Set<String> ports, int[] analyzerTypes) { this.scheduleID = scheduleID; this.dataPath = dataPath; this.prefixes = prefixes; this.ports = ports; this.analyzerTypes = analyzerTypes; } public long getScheduleID() { return scheduleID; } public void setScheduleID(long scheduleID) { this.scheduleID = scheduleID; } public String getDataPath() { return dataPath; } public void setDataPath(String dataPath) { this.dataPath = dataPath; } public Set<String> getPorts() { return ports; } public void setPorts(Set<String> ports) { this.ports = ports; } public String getPrefixes() { return prefixes; } public void setPrefixes(String prefixes) { this.prefixes = prefixes; } public int[] getAnalyzerTypes() { return analyzerTypes; } public void setAnalyzerTypes(int[] analyzerTypes) { this.analyzerTypes = analyzerTypes; } @Override public String toString() { return "ScheduleInfo [scheduleID=" + scheduleID + ", dataPath=" + dataPath + ", prefixes=" + prefixes + ", analyzerTypes=" + Arrays.toString(analyzerTypes) + ", ports=" + ports + "]"; } } <|start_filename|>redis-manager-dashboard/src/main/java/com/newegg/ec/redis/schedule/ClusterUpdateSchedule.java<|end_filename|> package com.newegg.ec.redis.schedule; import com.google.common.util.concurrent.ThreadFactoryBuilder; import com.newegg.ec.redis.dao.IClusterDao; import com.newegg.ec.redis.entity.Cluster; import com.newegg.ec.redis.entity.NodeRole; import com.newegg.ec.redis.entity.RedisNode; import com.newegg.ec.redis.entity.SentinelMaster; import com.newegg.ec.redis.service.IClusterService; import com.newegg.ec.redis.service.IRedisNodeService; import com.newegg.ec.redis.service.IRedisService; import com.newegg.ec.redis.service.ISentinelMastersService; import com.newegg.ec.redis.util.RedisNodeUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationListener; import org.springframework.context.event.ContextRefreshedEvent; import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.Objects; import java.util.concurrent.ExecutorService; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; import static com.newegg.ec.redis.entity.NodeRole.MASTER; import static com.newegg.ec.redis.entity.NodeRole.SLAVE; import static com.newegg.ec.redis.entity.RedisNode.CONNECTED; import static com.newegg.ec.redis.util.RedisUtil.REDIS_MODE_SENTINEL; /** * 2020/03/08: 为了降低代码耦合,cluster, redis node, sentinel master 信息的更新在此进行 * <p> * 1.cluster: * 1) cluster info 相关信息更新 * 2) 根据节点状态(runState, inCluster, flags)设置健康状态 * 2. redis node: * 1) 新增节点自动写入 database,如果写入失败,则忽略 * 2) 更新节点状态, runState, inCluster, flags, linked * * @author Jay.H.Zou * @date 2020/3/8 */ @Component public class ClusterUpdateSchedule implements IDataCollection, ApplicationListener<ContextRefreshedEvent> { private static final Logger logger = LoggerFactory.getLogger(ClusterUpdateSchedule.class); @Autowired private IClusterService clusterService; @Autowired private IRedisService redisService; @Autowired private IRedisNodeService redisNodeService; @Autowired private ISentinelMastersService sentinelMastersService; private ExecutorService threadPool; @Override public void onApplicationEvent(ContextRefreshedEvent contextRefreshedEvent) { int coreSize = Runtime.getRuntime().availableProcessors(); threadPool = new ThreadPoolExecutor(coreSize, coreSize, 60L, TimeUnit.SECONDS, new LinkedBlockingQueue<>(), new ThreadFactoryBuilder().setNameFormat("cluster-update-pool-thread-%d").build()); } @Async @Scheduled(cron = "30 0/1 * * * ?") @Override public void collect() { List<Cluster> clusterList = clusterService.getAllClusterList(); if (clusterList == null || clusterList.isEmpty()) { return; } logger.info("Start update node status and cluster status..."); clusterList.forEach(cluster -> threadPool.submit(new ClusterUpdateTask(cluster))); } private class ClusterUpdateTask implements Runnable { private Cluster cluster; public ClusterUpdateTask(Cluster cluster) { this.cluster = cluster; } @Override public void run() { try { addNewNodeToDB(cluster); Cluster.ClusterState clusterStateByNode = updateRedisNodeState(cluster); // update sentinel master if (Objects.equals(REDIS_MODE_SENTINEL, cluster.getRedisMode())) { updateSentinelMasters(cluster); } updateCluster(clusterStateByNode, cluster); } catch (Exception e) { logger.error("Update cluster failed, cluster name = " + cluster.getClusterName(), e); } } } private void updateCluster(Cluster.ClusterState clusterState, Cluster cluster) { Cluster completedCluster = clusterService.completeClusterInfo(cluster); // 再次判断集群状态 Cluster.ClusterState clusterStateByInfo = completedCluster.getClusterState(); if (Objects.equals(clusterStateByInfo, Cluster.ClusterState.BAD)) { clusterState = clusterStateByInfo; } try { completedCluster.setClusterState(clusterState); clusterService.updateCluster(completedCluster); } catch (Exception e) { logger.error("Update cluster completed info failed, cluster name = " + cluster.getClusterName(), e); } } private void addNewNodeToDB(Cluster cluster) { Integer clusterId = cluster.getClusterId(); List<RedisNode> realRedisNodeList = redisService.getRealRedisNodeList(cluster); List<RedisNode> dbRedisNodeList = redisNodeService.getRedisNodeList(clusterId); for (RedisNode dbRedisNode : dbRedisNodeList) { realRedisNodeList.removeIf(redisNode -> RedisNodeUtil.equals(redisNode, dbRedisNode)); } if (!realRedisNodeList.isEmpty()) { RedisNodeUtil.setRedisRunStatus(cluster.getRedisMode(), realRedisNodeList); redisNodeService.addRedisNodeList(realRedisNodeList); } } /** * 更新所有 redis node 状态 * * @param cluster * @return 如果节点有问题,则改变 cluster state 为 WARN */ private Cluster.ClusterState updateRedisNodeState(Cluster cluster) { Cluster.ClusterState clusterState = Cluster.ClusterState.HEALTH; List<RedisNode> redisNodeList = redisNodeService.getMergedRedisNodeList(cluster.getClusterId()); for (RedisNode redisNode : redisNodeList) { boolean runStatus = redisNode.getRunStatus(); boolean inCluster = redisNode.getInCluster(); String flags = redisNode.getFlags(); boolean flagsNormal = Objects.equals(flags, SLAVE.getValue()) || Objects.equals(flags, MASTER.getValue()); String linkState = redisNode.getLinkState(); NodeRole nodeRole = redisNode.getNodeRole(); // 节点角色为 UNKNOWN boolean nodeRoleNormal = Objects.equals(nodeRole, MASTER) || Objects.equals(nodeRole, SLAVE); if (!runStatus || !inCluster || !flagsNormal || !Objects.equals(linkState, CONNECTED) || !nodeRoleNormal) { clusterState = Cluster.ClusterState.WARN; } redisNodeService.updateRedisNode(redisNode); } return clusterState; } /** * @param cluster */ private void updateSentinelMasters(Cluster cluster) { Integer clusterId = cluster.getClusterId(); List<SentinelMaster> newSentinelMasters = new LinkedList<>(); List<SentinelMaster> realSentinelMasterList = redisService.getSentinelMasters(clusterService.getClusterById(clusterId)); Iterator<SentinelMaster> iterator = realSentinelMasterList.iterator(); while (iterator.hasNext()) { SentinelMaster sentinelMaster = iterator.next(); SentinelMaster sentinelMasterByMasterName = sentinelMastersService.getSentinelMasterByMasterName(clusterId, sentinelMaster.getName()); sentinelMaster.setGroupId(cluster.getGroupId()); sentinelMaster.setClusterId(clusterId); if (sentinelMasterByMasterName == null) { newSentinelMasters.add(sentinelMaster); iterator.remove(); } } realSentinelMasterList.forEach(sentinelMaster -> sentinelMastersService.updateSentinelMaster(sentinelMaster)); newSentinelMasters.forEach(sentinelMaster -> sentinelMastersService.addSentinelMaster(sentinelMaster)); } } <|start_filename|>redis-manager-dashboard/src/main/java/com/newegg/ec/redis/service/IRedisNodeService.java<|end_filename|> package com.newegg.ec.redis.service; import com.newegg.ec.redis.entity.Cluster; import com.newegg.ec.redis.entity.RedisNode; import com.newegg.ec.redis.plugin.install.service.AbstractNodeOperation; import java.util.List; /** * @author Jay.H.Zou * @date 2019/7/19 */ public interface IRedisNodeService { List<RedisNode> getRedisNodeList(Integer clusterId); List<RedisNode> getMergedRedisNodeList(Integer clusterId); boolean existRedisNode(RedisNode redisNode); List<RedisNode> mergeRedisNode(List<RedisNode> realRedisNodeList, List<RedisNode> dbRedisNodeList); boolean addRedisNode(RedisNode redisNode); boolean addRedisNodeList(List<RedisNode> redisNodeList); boolean updateRedisNode(RedisNode redisNode); boolean deleteRedisNodeListByClusterId(Integer clusterId); boolean deleteRedisNodeById(Integer redisNodeId); List<RedisNode> sortRedisNodeList(List<RedisNode> redisNodeList); } <|start_filename|>redis-manager-dashboard/src/main/java/com/newegg/ec/redis/util/ListSortUtil.java<|end_filename|> package com.newegg.ec.redis.util; import com.alibaba.fastjson.JSONObject; import java.util.Collections; import java.util.List; /** * @author kz37 * @date 2018/10/20 */ public class ListSortUtil { /** * List<List<String>> * @param sort 排序的List * @param index 根据内部List的下标值进行排序 */ public static void sortListListStringAsc(List<List<String>> sort, int index) { Collections.sort(sort, (l1, l2) -> { return compareDouble(l1.get(index),l2.get(index)); }); } public static void sortListListStringDesc(List<List<String>> sort, int index) { Collections.sort(sort, (l1, l2) -> { return -compareDouble(l1.get(index),l2.get(index)); }); } public static int compareDouble(Double d1, Double d2) { if(Double.compare(d1, d2) > 0) { return 1; } else if(Double.compare(d1, d2) < 0) { return -1; } else { return 0; } } public static int compareDouble(String s1, String s2) throws NumberFormatException{ Double d1 = Double.parseDouble(s1); Double d2 = Double.parseDouble(s2); return compareDouble(d1, d2); } public static void sortByKeyValueDesc(List<JSONObject> jsonObjectList, String key) { Collections.sort(jsonObjectList, (l1, l2) -> { return -compareDouble(l1.getString(key),l2.getString(key)); }); } } <|start_filename|>redis-manager-dashboard/src/main/java/com/newegg/ec/redis/schedule/NodeInfoMinuteCollection.java<|end_filename|> package com.newegg.ec.redis.schedule; import com.google.common.util.concurrent.ThreadFactoryBuilder; import com.newegg.ec.redis.entity.Cluster; import com.newegg.ec.redis.entity.TimeType; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.context.event.ContextRefreshedEvent; import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; import java.util.List; import java.util.concurrent.ExecutorService; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; /** * Collect redis information by minute * * @author Jay.H.Zou * @date 2019/7/22 */ @Component public class NodeInfoMinuteCollection extends NodeInfoCollectionAbstract { private static final Logger logger = LoggerFactory.getLogger(NodeInfoMinuteCollection.class); private ExecutorService threadPool; @Override public void onApplicationEvent(ContextRefreshedEvent contextRefreshedEvent) { coreSize = Runtime.getRuntime().availableProcessors(); threadPool = new ThreadPoolExecutor(coreSize, coreSize * 4, 60L, TimeUnit.SECONDS, new LinkedBlockingQueue<>(), new ThreadFactoryBuilder().setNameFormat("collect-node-info-pool-thread-%d").build(), new ThreadPoolExecutor.AbortPolicy()); } /** * 一分钟收集一次 RedisNode 数据,并计算以 MINUTE 为单位的 avg, max, min */ @Async @Scheduled(cron = "0 0/1 * * * ? ") @Override public void collect() { List<Cluster> allClusterList = clusterService.getAllClusterList(); if (allClusterList == null || allClusterList.isEmpty()) { return; } logger.info("Start collecting node info (minute), cluster number = " + allClusterList.size()); for (Cluster cluster : allClusterList) { threadPool.submit(new CollectNodeInfoTask(cluster, TimeType.MINUTE)); } } } <|start_filename|>redis-manager-dashboard/src/main/java/com/newegg/ec/redis/plugin/rct/cache/AppCache.java<|end_filename|> package com.newegg.ec.redis.plugin.rct.cache; import com.newegg.ec.redis.entity.AnalyzeStatus; import com.newegg.ec.redis.entity.RDBAnalyze; import com.newegg.ec.redis.entity.ScheduleDetail; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ScheduledFuture; /** * @author:Truman.P.Du * @createDate: 2018年10月19日 下午1:29:56 * @version:1.0 * @description: 应用静态缓存 */ public class AppCache { // <rdbAnalyzeID,scheduleID> public static Map<Long, Long> scheduleProcess = new HashMap<>(); // <rdbAnalyzeID,List<ScheduleDetail>> public static Map<Long, List<ScheduleDetail>> scheduleDetailMap = new ConcurrentHashMap<>(); public static Map<String, Float> keyCountMap = new ConcurrentHashMap<>(); public static Map<String, Map<ScheduledFuture<?>,String>> taskList = new ConcurrentHashMap<String, Map<ScheduledFuture<?>,String>>(); /** * 根据rdbAnalyzeID判断当前集群分析任务是否完成 * * @param rdbAnalyzeID * @return */ public static boolean isAnalyzeSuccess(Long rdbAnalyzeID) { List<ScheduleDetail> scheduleDetails = scheduleDetailMap.get(rdbAnalyzeID); if (scheduleDetails != null && scheduleDetails.size() > 0) { boolean status = true; for (ScheduleDetail scheduleDetail : scheduleDetails) { if (!AnalyzeStatus.DONE.equals(scheduleDetail.getStatus())) { status = false; break; } } return status; } return true; } /** * 根据ID判断是否分析完成 * * @param RDBAnalyze * rdbAnalyze * @return */ public static boolean isAnalyzeComplete(RDBAnalyze rdbAnalyze) { List<ScheduleDetail> scheduleDetails = scheduleDetailMap.get(rdbAnalyze.getId()); if (scheduleDetails != null && scheduleDetails.size() > 0) { boolean status = true; for (ScheduleDetail scheduleDetail : scheduleDetails) { if (!AnalyzeStatus.DONE.equals(scheduleDetail.getStatus())) { status = false; break; } } return status; } return false; } /** * 根据rdbAnalyzeID判断是否需要继续获取分析器执行状态 * * @param rdbAnalyzeID * @return */ public static boolean isNeedAnalyzeStastus(Long rdbAnalyzeID) { List<ScheduleDetail> scheduleDetails = scheduleDetailMap.get(rdbAnalyzeID); if (scheduleDetails != null && scheduleDetails.size() > 0) { boolean status = false; for (ScheduleDetail scheduleDetail : scheduleDetails) { if (!(AnalyzeStatus.DONE.equals(scheduleDetail.getStatus()) || AnalyzeStatus.CANCELED.equals(scheduleDetail.getStatus()) || AnalyzeStatus.ERROR.equals(scheduleDetail.getStatus()))) { status = true; break; } } return status; } return false; } public static Long getRdbAnalyzeIDByScheduleID(Long scheduleID) { for (Map.Entry<Long, Long> entry : scheduleProcess.entrySet()) { if (entry.getValue().equals(scheduleID)) { return entry.getKey(); } } return null; } } <|start_filename|>redis-manager-dashboard/src/main/java/com/newegg/ec/redis/controller/InstallationController.java<|end_filename|> package com.newegg.ec.redis.controller; import com.newegg.ec.redis.aop.annotation.OperationLog; import com.newegg.ec.redis.config.SystemConfig; import com.newegg.ec.redis.entity.OperationObjectType; import com.newegg.ec.redis.entity.OperationType; import com.newegg.ec.redis.entity.Result; import com.newegg.ec.redis.plugin.install.InstallationTemplate; import com.newegg.ec.redis.plugin.install.entity.InstallationLogContainer; import com.newegg.ec.redis.plugin.install.entity.InstallationParam; import com.newegg.ec.redis.plugin.install.service.AbstractNodeOperation; import com.newegg.ec.redis.plugin.install.service.impl.DockerNodeOperation; import com.newegg.ec.redis.plugin.install.service.impl.HumpbackNodeOperation; import com.newegg.ec.redis.plugin.install.service.impl.MachineNodeOperation; import com.newegg.ec.redis.service.IClusterService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.*; import java.util.List; /** * @author Jay.H.Zou * @date 9/28/2019 */ @RequestMapping("/installation/*") @Controller public class InstallationController { private static final Logger logger = LoggerFactory.getLogger(InstallationController.class); @Autowired private DockerNodeOperation dockerNodeOperation; @Autowired private MachineNodeOperation machineNodeOperation; @Autowired private HumpbackNodeOperation humpbackNodeOperation; @Autowired private InstallationTemplate installationTemplate; @Autowired private IClusterService clusterService; @Autowired private SystemConfig systemConfig; @RequestMapping(value = "getDockerImages", method = RequestMethod.GET) @ResponseBody public Result getDockerImages() { try { List<String> imageList = dockerNodeOperation.getImageList(); return Result.successResult(imageList); } catch (Exception e) { logger.error("Get docker image list failed.", e); return Result.failResult().setMessage("Get docker image list failed."); } } @RequestMapping(value = "getMachineImages", method = RequestMethod.GET) @ResponseBody public Result getMachineImages() { try { List<String> imageList = machineNodeOperation.getImageList(); return Result.successResult(imageList); } catch (Exception e) { logger.error("Get machine image list failed.", e); return Result.failResult().setMessage("Get machine image list failed."); } } @RequestMapping(value = "getHumpbackImages", method = RequestMethod.GET) @ResponseBody public Result getHumpbackImages() { try { List<String> imageList = humpbackNodeOperation.getImageList(); return Result.successResult(imageList); } catch (Exception e) { logger.error("Get humpback image list failed.", e); return Result.failResult().setMessage("Get humpback image list failed."); } } /********************************* Installation step *********************************/ @RequestMapping(value = "installFlow", method = RequestMethod.POST) @ResponseBody @OperationLog(type = OperationType.INSTALL, objType = OperationObjectType.CLUSTER) public Result install(@RequestBody InstallationParam installationParam) { Integer installationEnvironment = installationParam.getCluster().getInstallationEnvironment(); AbstractNodeOperation nodeOperation = clusterService.getNodeOperation(installationEnvironment); boolean result = installationTemplate.installFlow(nodeOperation, installationParam); InstallationLogContainer.remove(installationParam.getCluster().getClusterName()); return result ? Result.successResult() : Result.failResult(); } @RequestMapping(value = "/validateClusterName/{clusterName}", method = RequestMethod.GET) @ResponseBody public Result validateClusterName(@PathVariable("clusterName") String clusterName) { return Result.successResult(); } @RequestMapping(value = "/getInstallationLogs/{clusterName}", method = RequestMethod.GET) @ResponseBody public Result getInstallationLogs(@PathVariable("clusterName") String clusterName) { List<String> logs = InstallationLogContainer.getLogs(clusterName); return Result.successResult(logs); } /*@RequestMapping(value = "prepareForInstallation", method = RequestMethod.POST) @ResponseBody public Result prepareForInstallation(@RequestBody InstallationParam installationParam) { Integer installationEnvironment = installationParam.getInstallationEnvironment(); AbstractNodeOperation nodeOperation = getNodeOperation(installationEnvironment); boolean prepareSuccess = installationTemplate.prepareForInstallation(nodeOperation, installationParam); if (!prepareSuccess) { return Result.failResult(); } List<String> redisNodes = new LinkedList<>(); Map<RedisNode, Collection<RedisNode>> topology = installationParam.getTopology().asMap(); topology.forEach((masterNode, replicaCol) -> { redisNodes.add(masterNode.getHost() + ":" + masterNode.getPort() + masterNode.getNodeRole().getValue()); replicaCol.forEach(replica -> { redisNodes.add(replica.getHost() + ":" + replica.getPort() + replica.getNodeRole().getValue()); }); }); JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(installationParam)); jsonObject.put("redisNodes", redisNodes); return Result.successResult(jsonObject); }*/ /* @RequestMapping(value = "environmentCheck", method = RequestMethod.POST) @ResponseBody public Result environmentCheck(@RequestBody InstallationParam installationParam) { return Result.successResult(); } @RequestMapping(value = "pullImage", method = RequestMethod.POST) @ResponseBody public Result pullImage(@RequestBody InstallationParam installationParam) { return Result.successResult(); } @RequestMapping(value = "pullConfig", method = RequestMethod.POST) @ResponseBody public Result pullConfig(@RequestBody InstallationParam installationParam) { return Result.successResult(); } @RequestMapping(value = "install", method = RequestMethod.POST) @ResponseBody public Result install(@RequestBody InstallationParam installationParam) { return Result.successResult(); } @RequestMapping(value = "init", method = RequestMethod.POST) @ResponseBody public Result init(@RequestBody InstallationParam installationParam) { return Result.successResult(); }*/ /********************************* Installation step *********************************/ } <|start_filename|>redis-manager-dashboard/src/main/java/com/newegg/ec/redis/controller/oauth/AuthService.java<|end_filename|> package com.newegg.ec.redis.controller.oauth; import com.alibaba.fastjson.JSONObject; import com.google.common.base.Strings; import com.newegg.ec.redis.config.SystemConfig; import com.newegg.ec.redis.entity.User; import com.newegg.ec.redis.util.LinuxInfoUtil; import com.newegg.ec.redis.util.SignUtil; import com.newegg.ec.redis.util.httpclient.HttpClientUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import java.io.IOException; /** * authorization code * * @author Jay.H.Zou * @date 10/19/2019 */ @Component public class AuthService implements IOAuthService<String> { private static final Logger logger = LoggerFactory.getLogger(AuthService.class); @Autowired private SystemConfig systemConfig; @Override public User oauthLogin(String data) { // build request body JSONObject requestBody = new JSONObject(); requestBody.put("Code", data); requestBody.put("SiteKey", systemConfig.getSiteKey()); requestBody.put("SiteSecret", systemConfig.getSiteSecret()); String authorizationServer = systemConfig.getAuthorizationServer(); String postResponse = null; try { postResponse = HttpClientUtil.post(authorizationServer + "/api/token", requestBody); } catch (IOException e) { logger.error("Get auth token failed.", e); return null; } JSONObject response = JSONObject.parseObject(postResponse); String token = response.getString("Token"); JSONObject userInfo = null; if (!Strings.isNullOrEmpty(token)) { String userInfoStr; try { userInfoStr = HttpClientUtil.get(authorizationServer + "/api/user?token=" + token); } catch (IOException e) { return null; } userInfo = JSONObject.parseObject(userInfoStr); } if (userInfo == null) { return null; } User user = new User(); String userName = userInfo.getString("UserName"); String avatar = userInfo.getJSONObject("DomainUser").getString("Avatar"); user.setUserName(userName); user.setAvatar(avatar); return user; } @Override public boolean signOut() { String urlTemplate = "%s/api/%s?callback=%s"; String authorizationServer = systemConfig.getAuthorizationServer(); String siteKey = systemConfig.getSiteKey(); String serverAddress = LinuxInfoUtil.getIp() + SignUtil.COLON + systemConfig.getServerPort(); try { HttpClientUtil.get(String.format(urlTemplate, authorizationServer, siteKey, serverAddress)); } catch (IOException e) { logger.error("Auth sign out failed.", e); } return false; } } <|start_filename|>redis-manager-dashboard/src/main/java/com/newegg/ec/redis/service/IScheduleTaskService.java<|end_filename|> package com.newegg.ec.redis.service; import org.quartz.Job; import org.quartz.SchedulerException; import java.util.List; public interface IScheduleTaskService { public void addTask(Object object, Class<? extends Job> jobClass) throws SchedulerException; public void delTask(String jobId) throws SchedulerException; public List<String> getRecentTriggerTime(String cron); public String getJobStatus(String triggerName) throws SchedulerException; } <|start_filename|>redis-manager-dashboard/src/main/java/com/newegg/ec/redis/service/impl/SentinelMastersService.java<|end_filename|> package com.newegg.ec.redis.service.impl; import com.google.common.base.Strings; import com.newegg.ec.redis.dao.ISentinelMastersDao; import com.newegg.ec.redis.entity.SentinelMaster; import com.newegg.ec.redis.service.IClusterService; import com.newegg.ec.redis.service.IRedisService; import com.newegg.ec.redis.service.ISentinelMastersService; import com.newegg.ec.redis.util.RedisUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.Objects; /** * @author Jay.H.Zou * @date 1/22/2020 */ @Service public class SentinelMastersService implements ISentinelMastersService { private static final Logger logger = LoggerFactory.getLogger(SentinelMastersService.class); @Autowired private ISentinelMastersDao sentinelMastersDao; @Autowired private IRedisService redisService; @Autowired private IClusterService clusterService; @Override public List<SentinelMaster> getSentinelMasterByClusterId(Integer clusterId) { try { List<SentinelMaster> realSentinelMasterList = redisService.getSentinelMasters(clusterService.getClusterById(clusterId)); List<SentinelMaster> dbSentinelMasterList = sentinelMastersDao.selectSentinelMasterByClusterId(clusterId); return mergeRedisNode(realSentinelMasterList, dbSentinelMasterList); } catch (Exception e) { logger.error("Get sentinel masters by cluster id failed.", e); return null; } } private List<SentinelMaster> mergeRedisNode(List<SentinelMaster> realSentinelMasterList, List<SentinelMaster> dbSentinelMasterList) { List<SentinelMaster> sentinelMasterList = new LinkedList<>(); Iterator<SentinelMaster> realIterator = realSentinelMasterList.iterator(); while (realIterator.hasNext()) { SentinelMaster realSentinelMaster = realIterator.next(); realSentinelMaster.setMonitor(true); Iterator<SentinelMaster> dbIterator = dbSentinelMasterList.iterator(); while (dbIterator.hasNext()) { SentinelMaster dbSentinelMaster = dbIterator.next(); if (Objects.equals(realSentinelMaster.getName(), dbSentinelMaster.getName())) { String masterNode = RedisUtil.getNodeString(dbSentinelMaster.getHost(), dbSentinelMaster.getPort()); boolean masterNodeChanged = !Objects.equals(dbSentinelMaster.getLastMasterNode(), masterNode); realSentinelMaster.setSentinelMasterId(dbSentinelMaster.getSentinelMasterId()); realSentinelMaster.setMasterChanged(masterNodeChanged); realSentinelMaster.setLastMasterNode(dbSentinelMaster.getLastMasterNode()); realIterator.remove(); dbIterator.remove(); } } sentinelMasterList.add(realSentinelMaster); } if (dbSentinelMasterList.isEmpty()) { return sentinelMasterList; } dbSentinelMasterList.forEach(dbSentinelMaster -> { dbSentinelMaster.setMonitor(false); String masterNode = RedisUtil.getNodeString(dbSentinelMaster.getHost(), dbSentinelMaster.getPort()); boolean masterNodeChanged = !Objects.equals(dbSentinelMaster.getLastMasterNode(), masterNode); dbSentinelMaster.setMasterChanged(masterNodeChanged); sentinelMasterList.add(dbSentinelMaster); }); return sentinelMasterList; } @Override public SentinelMaster getSentinelMasterByMasterName(Integer clusterId, String masterName) { try { if (Strings.isNullOrEmpty(masterName)) { logger.warn("master name can't be null."); return null; } return sentinelMastersDao.selectSentinelMasterByMasterName(clusterId, masterName); } catch (Exception e) { logger.info("Get sentinel master by master name failed.", e); return null; } } @Override public SentinelMaster getSentinelMasterById(Integer sentinelMasterId) { try { return sentinelMastersDao.selectSentinelMasterById(sentinelMasterId); } catch (Exception e) { logger.error("Get sentinel master by id failed.", e); return null; } } @Override public boolean updateSentinelMaster(SentinelMaster sentinelMaster) { try { return sentinelMastersDao.updateSentinelMaster(sentinelMaster) > 0; } catch (Exception e) { logger.error("Update sentinel master failed, " + sentinelMaster, e); return false; } } @Override public boolean addSentinelMaster(SentinelMaster sentinelMaster) { try { sentinelMaster.setLastMasterNode(RedisUtil.getNodeString(sentinelMaster.getHost(), sentinelMaster.getPort())); return sentinelMastersDao.insertSentinelMaster(sentinelMaster) > 0; } catch (Exception e) { logger.error("Add sentinel master failed. ", e); return false; } } @Override public boolean deleteSentinelMasterByName(Integer clusterId, String masterName) { try { return sentinelMastersDao.deleteSentinelMasterByName(clusterId, masterName) > 0; } catch (Exception e) { logger.error("Remove sentinel master failed.", e); return false; } } @Override public boolean deleteSentinelMasterByClusterId(Integer clusterId) { try { return sentinelMastersDao.deleteSentinelMasterByClusterId(clusterId) > 0; } catch (Exception e) { logger.error("Delete sentinel master failed. ", e); return false; } } } <|start_filename|>redis-manager-dashboard/src/main/java/com/newegg/ec/redis/entity/AnalyzerConstant.java<|end_filename|> package com.newegg.ec.redis.entity; /** * @author:Truman.P.Du * @createDate: 2018年10月16日 上午10:30:32 * @version:1.0 * @description: 分析器对照关系 */ public class AnalyzerConstant { public static int DEFAULT_ANALYZER = 0; public static int DATA_TYPE_ANALYZER = 1; public static int PREFIX_ANALYZER = 2; public static int TOP_KEY_ANALYZER = 3; public static int TTL_ANALYZER = 4; public static int EXPORT_KEY_BY_PREFIX_ANALYZER = 5; public static int EXPORT_KEY_BY_FILTER_ANALYZER = 6; } <|start_filename|>redis-manager-dashboard/src/main/java/com/newegg/ec/redis/util/NetworkUtil.java<|end_filename|> package com.newegg.ec.redis.util; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.IOException; import java.net.*; /** * Check port * Ping * * @author Jay.H.Zou * @date 7/20/2019 */ public class NetworkUtil { private static final Logger logger = LoggerFactory.getLogger(NetworkUtil.class); private static final int TIMEOUT = 2000; private NetworkUtil() { } public static boolean checkFreePort(String ip, int port) { try { return !connect(ip, port); } catch (Exception e) { logger.info(ip + ":" + port + " is free."); return true; } } public static boolean telnet(String ip, int port) { try { return connect(ip, port); } catch (Exception e) { logger.warn(ip + ":" + port + " can't access."); return false; } } private static boolean connect(String ip, int port) throws IOException { Socket socket = new Socket(); try { socket.connect(new InetSocketAddress(ip, port), TIMEOUT); return socket.isConnected(); } finally { try { socket.close(); } catch (IOException ignore) { } } } } <|start_filename|>redis-manager-dashboard/src/main/java/com/newegg/ec/redis/plugin/alert/service/IAlertRecordService.java<|end_filename|> package com.newegg.ec.redis.plugin.alert.service; import com.newegg.ec.redis.plugin.alert.entity.AlertRecord; import java.sql.Timestamp; import java.util.List; import java.util.Map; /** * @author Jay.H.Zou * @date 8/31/2019 */ public interface IAlertRecordService { Map<String, Object> getAlertRecordByClusterId(Integer clusterId, Integer pageNo, Integer pageSize); boolean addAlertRecord(List<AlertRecord> alertRecordList); boolean deleteAlertRecordById(Integer recordId); boolean deleteAlertRecordByIds(List<Integer> recordIdList); boolean cleanAlertRecordByTime(); Integer getAlertRecordNumber(Integer groupId); } <|start_filename|>redis-manager-dashboard/src/main/java/com/newegg/ec/redis/plugin/rct/report/IAnalyzeDataConverse.java<|end_filename|> package com.newegg.ec.redis.plugin.rct.report; import com.newegg.ec.redis.entity.ExcelData; import com.newegg.ec.redis.entity.ReportData; import java.util.List; import java.util.Map; import java.util.Set; /** *@author kz37 *@date 2018/10/19 */ public interface IAnalyzeDataConverse { String PREFIX_KEY_BY_COUNT = "PrefixKeyByCount"; String PREFIX_KEY_BY_MEMORY = "PrefixKeyByMemory"; String DATA_TYPE_ANALYZE = "DataTypeAnalyze"; String TOP_KEY_ANALYZE= "TopKeyAnalyze"; String TTL_ANALYZE = "TTLAnalyze"; /** * 在Excel中从第几列开始写 */ int TOP_KEY_STRING_DATA = 0; int TOP_KEY_HASH_DATA = 5; int TOP_KEY_LIST_DATA = 10; int TOP_KEY_SET_DATA = 15; Map<String, List<ExcelData>> getPrefixAnalyzerData(Set<String> newSetData, Map<String, ReportData> latestPrefixData); Map<String, String> getMapJsonString(Set<String> newSetData); } <|start_filename|>redis-manager-dashboard/src/main/java/com/newegg/ec/redis/dao/IGroupDao.java<|end_filename|> package com.newegg.ec.redis.dao; import com.newegg.ec.redis.entity.Group; import org.apache.ibatis.annotations.*; import java.util.List; /** * Manage group * * @author Jay.H.Zou * @date 7/19/2019 */ @Mapper public interface IGroupDao { @Select("SELECT * FROM `group`") List<Group> selectAllGroup(); @Select("<script>" + "SELECT " + "distinct group.group_id AS group_id, " + "group.group_name AS group_name, " + "group.group_info AS group_info, " + "group.update_time AS update_time " + "FROM `group`, group_user " + "WHERE group_user.grant_group_id = group.group_id " + "<if test='userId != null'>" + "AND group_user.user_id = #{userId} " + "</if>" + "ORDER BY group_name" + "</script>") List<Group> selectGroupByUserId(@Param("userId") Integer userId); @Select("SELECT * FROM `group` WHERE group_name = #{groupName}") Group selectGroupByGroupName(String groupName); @Select("SELECT * FROM `group` WHERE group_id = #{groupId}") Group selectGroupById(Integer groupId); @Insert("INSERT INTO `group` (group_name, group_info, update_time) " + "VALUES (#{groupName}, #{groupInfo}, NOW())") @Options(useGeneratedKeys = true, keyProperty = "groupId", keyColumn = "group_id") int insertGroup(Group group); @Update("UPDATE `group` SET group_name = #{groupName}, group_info = #{groupInfo}, update_time = NOW() WHERE group_id = #{groupId}") int updateGroup(Group group); @Delete("DELETE FROM `group` WHERE group_id = #{groupId}") int deleteGroupById(Integer groupId); @Select("create TABLE IF NOT EXISTS `group` (" + "group_id integer(4) NOT NULL AUTO_INCREMENT, " + "group_name varchar(255) NOT NULL, " + "group_info varchar(255) DEFAULT NULL, " + "update_time datetime(0) NOT NULL, " + "PRIMARY KEY (group_id), " + "UNIQUE KEY (group_name) " + ") ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;") void createGroupTable(); } <|start_filename|>redis-manager-dashboard/src/main/java/com/newegg/ec/redis/dao/ISentinelMastersDao.java<|end_filename|> package com.newegg.ec.redis.dao; import com.newegg.ec.redis.entity.SentinelMaster; import org.apache.ibatis.annotations.*; import java.util.List; /** * @author Jay.H.Zou * @date 1/22/2020 */ @Mapper public interface ISentinelMastersDao { @Select("SELECT * FROM sentinel_masters WHERE cluster_id = #{clusterId}") List<SentinelMaster> selectSentinelMasterByClusterId(Integer clusterId); @Select("SELECT * FROM sentinel_masters WHERE cluster_id = #{clusterId} AND name = #{name}") SentinelMaster selectSentinelMasterByMasterName(@Param("clusterId") Integer clusterId, @Param("name") String name); @Select("SELECT * FROM sentinel_masters WHERE sentinel_master_id = #{sentinelMasterId}") SentinelMaster selectSentinelMasterById(Integer sentinelMasterId); @Update("UPDATE sentinel_masters SET host = #{host} , port = #{port}, flags = #{flags}, " + "status = #{status}, link_pending_commands = #{linkPendingCommands}, link_refcount = #{linkRefcount}, " + "last_ping_sent = #{lastPingSent}, last_ok_ping_reply = #{lastOkPingReply}, last_ping_reply = #{lastPingReply}, " + "s_down_time = #{sDownTime}, o_down_time = #{oDownTime}, down_after_milliseconds = #{downAfterMilliseconds}, info_refresh = #{infoRefresh}, " + "role_reported = #{roleReported}, role_reported_time = #{roleReportedTime}, config_epoch = #{configEpoch}, num_slaves = #{numSlaves}, sentinels = #{sentinels}, " + "quorum = #{quorum} , failover_timeout = #{failoverTimeout}, parallel_syncs = #{parallelSyncs}, auth_pass = #{authPass}, update_time = NOW() " + "WHERE cluster_id = #{clusterId} AND name = #{name}") int updateSentinelMaster(SentinelMaster sentinelMaster); @Insert("INSERT INTO sentinel_masters (cluster_id, group_id, name, host, port, flags, last_master_node, " + "status, link_pending_commands, link_refcount, last_ping_sent, last_ok_ping_reply, last_ping_reply, " + "s_down_time, o_down_time, down_after_milliseconds, info_refresh, role_reported, role_reported_time, config_epoch, " + "num_slaves, sentinels, quorum, failover_timeout, parallel_syncs, auth_pass, update_time) " + "VALUES " + "(#{clusterId}, #{groupId}, #{name}, #{host}, #{port}, #{flags}, #{lastMasterNode}, " + "#{status}, #{linkPendingCommands}, #{linkRefcount}, #{lastPingSent}, #{lastOkPingReply}, #{lastPingReply}, " + "#{sDownTime}, #{oDownTime}, #{downAfterMilliseconds}, #{infoRefresh}, #{roleReported}, #{roleReportedTime}, #{configEpoch}, " + "#{numSlaves}, #{sentinels}, #{quorum}, #{failoverTimeout}, #{parallelSyncs}, #{authPass}, NOW())") int insertSentinelMaster(SentinelMaster sentinelMaster); @Delete("DELETE FROM sentinel_masters WHERE cluster_id = #{clusterId} AND name = #{name}") int deleteSentinelMasterByName(@Param("clusterId") Integer clusterId, @Param("name") String name); @Delete("DELETE FROM sentinel_masters WHERE sentinel_master_id = #{cluster_id}") int deleteSentinelMasterByClusterId(Integer clusterId); @Select("create TABLE IF NOT EXISTS `sentinel_masters` (\n" + "sentinel_master_id integer(4) NOT NULL AUTO_INCREMENT,\n" + "cluster_id integer(4) NOT NULL,\n" + "group_id integer(4) NOT NULL,\n" + "name varchar(255) NOT NULL,\n" + "host varchar(255) NOT NULL,\n" + "port integer(4) NOT NULL,\n" + "flags varchar(255) DEFAULT NULL,\n" + "last_master_node varchar(255) DEFAULT NULL,\n" + "status varchar(50) DEFAULT NULL,\n" + "link_pending_commands bigint(20) DEFAULT NULL,\n" + "link_refcount bigint(20) DEFAULT NULL,\n" + "last_ping_sent bigint(20) DEFAULT NULL,\n" + "last_ok_ping_reply bigint(20) DEFAULT NULL,\n" + "last_ping_reply bigint(20) DEFAULT NULL,\n" + "s_down_time bigint(20) DEFAULT NULL,\n" + "o_down_time bigint(20) DEFAULT NULL,\n" + "down_after_milliseconds bigint(20) DEFAULT NULL,\n" + "info_refresh bigint(20) DEFAULT NULL,\n" + "role_reported varchar(50) DEFAULT NULL,\n" + "role_reported_time bigint(20) DEFAULT NULL,\n" + "config_epoch bigint(20) DEFAULT NULL,\n" + "num_slaves integer(4) DEFAULT NULL,\n" + "sentinels integer(4) DEFAULT NULL,\n" + "quorum integer(4) DEFAULT NULL,\n" + "failover_timeout bigint(4) DEFAULT NULL,\n" + "parallel_syncs integer(4) DEFAULT NULL,\n" + "auth_pass varchar(255) DEFAULT NULL,\n" + "update_time datetime(0) NOT NULL,\n" + "PRIMARY KEY (sentinel_master_id),\n" + "UNIQUE KEY `master_name` (cluster_id, name) " + ") ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;") void createSentinelMastersTable(); } <|start_filename|>redis-manager-dashboard/src/main/java/com/newegg/ec/redis/client/RedisClient.java<|end_filename|> package com.newegg.ec.redis.client; import com.google.common.base.Strings; import com.newegg.ec.redis.entity.*; import com.newegg.ec.redis.util.RedisUtil; import com.newegg.ec.redis.util.SignUtil; import org.apache.commons.lang.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import redis.clients.jedis.*; import redis.clients.jedis.exceptions.JedisConnectionException; import redis.clients.jedis.params.MigrateParams; import redis.clients.jedis.util.Slowlog; import java.io.BufferedReader; import java.io.ByteArrayInputStream; import java.io.InputStreamReader; import java.nio.charset.StandardCharsets; import java.util.*; import static com.newegg.ec.redis.client.RedisURI.TIMEOUT; import static com.newegg.ec.redis.util.RedisUtil.*; /** * @author Jay.H.Zou * @date 2019/7/22 */ public class RedisClient implements IRedisClient { private static final Logger logger = LoggerFactory.getLogger(RedisClient.class); private static final String OK = "OK"; private static final String PONG = "PONG"; /** * info subkey */ public static final String SERVER = "server"; public static final String KEYSPACE = "keyspace"; public static final String MEMORY = "memory"; public static final String REPLICATION = "replication"; public static final String SENTINEL = "sentinel"; private Jedis jedis; private RedisURI redisURI; public RedisClient(RedisURI redisURI) { this.redisURI = redisURI; String redisPassword = redisURI.getRequirePass(); String clientName = redisURI.getClientName(); Set<HostAndPort> hostAndPortSet = redisURI.getHostAndPortSet(); for (HostAndPort hostAndPort : hostAndPortSet) { try { jedis = new Jedis(hostAndPort.getHost(), hostAndPort.getPort(), TIMEOUT, TIMEOUT); if (!Strings.isNullOrEmpty(redisPassword)) { jedis.auth(redisPassword); } if (!Strings.isNullOrEmpty(clientName)) { jedis.clientSetname(clientName); } if (ping()) { break; } } catch (JedisConnectionException e) { // try next nodes close(); } } } @Override public Jedis getJedisClient() { return jedis; } @Override public Map<String, String> getInfo() throws Exception { return RedisUtil.parseInfoToMap(jedis.info()); } @Override public Map<String, String> getInfo(String section) throws Exception { return RedisUtil.parseInfoToMap(jedis.info(section)); } @Override public Map<String, String> getClusterInfo() throws Exception { return RedisUtil.parseInfoToMap(jedis.clusterInfo()); } @Override public Set<String> scan(AutoCommandParam autoCommandParam) { ScanParams scanParams = autoCommandParam.buildScanParams(); jedis.select(autoCommandParam.getDatabase()); ScanResult<String> scanResult = jedis.scan(autoCommandParam.getCursor(), scanParams); return new LinkedHashSet<>(scanResult.getResult()); } /** * redis 4, 4+ * memory info * * @return */ @Override public String getMemory() { return null; } /** * redis 4, 4+ * memory info * * @return */ @Override public String getMemory(String subKey) { return null; } /** * standalone nodes * <p> * role:master * connected_slaves:2 * slave0:ip=127.0.0.1,port=8801,state=online,offset=152173185,lag=1 * slave1:ip=127.0.0.1,port=8802,state=online,offset=152173185,lag=1 * <p> * role:slave * master_host:127.0.0.1 * master_port:8800 * master_link_status:up * * @return */ @Override public List<RedisNode> nodes() throws Exception { List<RedisNode> nodeList = new ArrayList<>(); Map<String, String> infoMap = getInfo(REPLICATION); String role = infoMap.get(ROLE); String masterHost; Integer masterPort; // 使用 master node 进行连接 if (Objects.equals(role, NodeRole.SLAVE.getValue())) { close(); masterHost = infoMap.get(MASTER_HOST); masterPort = Integer.parseInt(infoMap.get(MASTER_PORT)); RedisURI masterURI = new RedisURI(new HostAndPort(masterHost, masterPort), redisURI.getRequirePass()); RedisClient redisClient = RedisClientFactory.buildRedisClient(masterURI); infoMap = redisClient.getInfo(REPLICATION); redisClient.close(); } else { Set<HostAndPort> hostAndPortSet = redisURI.getHostAndPortSet(); HostAndPort hostAndPort = hostAndPortSet.iterator().next(); masterHost = hostAndPort.getHost(); masterPort = hostAndPort.getPort(); } for (Map.Entry<String, String> node : infoMap.entrySet()) { String infoKey = node.getKey(); String infoValue = node.getValue(); if (!infoKey.contains(NodeRole.SLAVE.getValue())) { continue; } String[] keyAndValues = SignUtil.splitByCommas(infoValue); if (keyAndValues.length < 2) { continue; } String slaveIp = null; String slavePort = null; for (String keyAndValue : keyAndValues) { String[] keyAndValueArray = SignUtil.splitByEqualSign(keyAndValue); String key = keyAndValueArray[0]; String val = keyAndValueArray[1]; if (Objects.equals(key, IP)) { slaveIp = val; } else if (Objects.equals(key, PORT)) { slavePort = val; } } if (!Strings.isNullOrEmpty(slaveIp) && !Strings.isNullOrEmpty(slavePort)) { RedisNode redisNode = new RedisNode(slaveIp, Integer.parseInt(slavePort), NodeRole.SLAVE); redisNode.setFlags(NodeRole.SLAVE.getValue()); nodeList.add(redisNode); } } if (!Strings.isNullOrEmpty(masterHost)) { RedisNode masterNode = new RedisNode(); masterNode.setNodeRole(NodeRole.MASTER); masterNode.setHost(masterHost); masterNode.setPort(masterPort); masterNode.setFlags(NodeRole.MASTER.getValue()); nodeList.add(masterNode); } return nodeList; } /** * <id> <ip:port> <flags> <master> <ping-sent> <pong-recv> <config-epoch> <link-state> <slot> ... <slot> * * @return * @throws Exception */ @Override public List<RedisNode> clusterNodes() throws Exception { String nodes = jedis.clusterNodes(); BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(new ByteArrayInputStream(nodes.getBytes(StandardCharsets.UTF_8)), StandardCharsets.UTF_8)); String line; List<RedisNode> redisNodeList = new ArrayList<>(); while ((line = bufferedReader.readLine()) != null) { String[] item = SignUtil.splitBySpace(line); String nodeId = item[0].trim(); String ipPort = item[1]; // noaddr 可知有此标记的节点属于无用节点 if (line.contains("noaddr")){ logger.warn("find a useless node: {}", line); continue; } Set<HostAndPort> hostAndPortSet = RedisUtil.nodesToHostAndPortSet(SignUtil.splitByAite(ipPort)[0]); HostAndPort hostAndPort = hostAndPortSet.iterator().next(); String flags = item[2]; String masterId = item[3]; String linkState = item[7]; RedisNode redisNode = new RedisNode(nodeId, hostAndPort.getHost(), hostAndPort.getPort(), null); if (flags.contains("myself")) { flags = flags.substring(7); } redisNode.setFlags(flags); redisNode.setMasterId(masterId); redisNode.setLinkState(linkState); int length = item.length; if (length > 8) { int slotNumber = 0; StringBuilder slotRang = new StringBuilder(); for (int i = 8; i < length; i++) { String slotRangeItem = item[i]; String[] startAndEnd = SignUtil.splitByMinus(slotRangeItem); if (startAndEnd.length == 1) { slotNumber += 1; } else { slotNumber += Integer.parseInt(startAndEnd[1]) - Integer.parseInt(startAndEnd[0]) + 1; } slotRang.append(slotRangeItem); if (i < length - 1) { slotRang.append(SignUtil.COMMAS); } } redisNode.setSlotRange(slotRang.toString()); redisNode.setSlotNumber(slotNumber); } if (flags.contains(NodeRole.MASTER.getValue())) { redisNode.setNodeRole(NodeRole.MASTER); } else if (flags.contains(NodeRole.SLAVE.getValue())) { redisNode.setNodeRole(NodeRole.SLAVE); } else { redisNode.setNodeRole(NodeRole.UNKNOWN); } redisNodeList.add(redisNode); } return redisNodeList; } @Override public List<RedisNode> sentinelNodes(Set<HostAndPort> hostAndPorts) { List<RedisNode> redisNodeList = new ArrayList<>(hostAndPorts.size()); hostAndPorts.forEach(hostAndPort -> { RedisNode redisNode = RedisNode.masterRedisNode(hostAndPort); redisNode.setNodeId(hostAndPort.toString()); redisNode.setFlags(NodeRole.MASTER.getValue()); redisNode.setNodeRole(NodeRole.MASTER); redisNodeList.add(redisNode); }); return redisNodeList; } @Override public boolean exists(String key) { return jedis.exists(key); } @Override public String type(String key) { return jedis.type(key); } @Override public long ttl(String key) { return jedis.ttl(key); } @Override public Long del(String key) { return jedis.del(key); } @Override public AutoCommandResult query(AutoCommandParam autoCommandParam) { String key = autoCommandParam.getKey(); // for future int count = autoCommandParam.getCount(); int database = autoCommandParam.getDatabase(); jedis.select(database); String type = type(key); long ttl = ttl(key); Object value = null; switch (type) { case TYPE_STRING: value = jedis.get(key); break; case TYPE_HASH: value = jedis.hgetAll(key); break; case TYPE_LIST: value = jedis.lrange(key, 0, -1); break; case TYPE_SET: value = jedis.smembers(key); break; case TYPE_ZSET: value = jedis.zrangeWithScores(key, 0, -1); break; default: break; } return new AutoCommandResult(ttl, type, value); } @Override public Object string(DataCommandsParam dataCommandsParam) { jedis.select(dataCommandsParam.getDatabase()); String command = dataCommandsParam.getCommand(); String[] list = SignUtil.splitBySpace(command); String cmd = command.toUpperCase(); String key = list[1]; Object result = null; if (cmd.startsWith(GET)) { result = jedis.get(key); } else if (cmd.startsWith(SET)) { result = jedis.set(key, list[2]); } return result; } @Override public Object hash(DataCommandsParam dataCommandsParam) { jedis.select(dataCommandsParam.getDatabase()); AutoCommandResult autoCommandResult = new AutoCommandResult(); String command = dataCommandsParam.getCommand(); String[] list = SignUtil.splitBySpace(command); String cmd = command.toUpperCase(); String key = list[1]; Object result = null; if (cmd.startsWith(HGETALL)) { result = jedis.hgetAll(key); } else if (cmd.startsWith(HGET)) { result = jedis.hget(key, list[2]); } else if (cmd.startsWith(HMGET)) { String[] items = removeCommandAndKey(list); result = jedis.hmget(key, items); } else if (cmd.startsWith(HKEYS)) { result = jedis.hkeys(key); } else if (cmd.startsWith(HSET)) { Map<String, String> hash = new HashMap<>(); String[] items = removeCommandAndKey(list); for (int i = 0; i < items.length; i += 2) { hash.put(items[i], items[i + 1]); } result = jedis.hset(key, hash); } autoCommandResult.setValue(result); return autoCommandResult; } @Override public Object list(DataCommandsParam dataCommandsParam) { jedis.select(dataCommandsParam.getDatabase()); String command = dataCommandsParam.getCommand(); String[] list = SignUtil.splitBySpace(command); String cmd = command.toUpperCase(); String key = list[1]; String[] items = removeCommandAndKey(list); Object result = null; if (cmd.startsWith(LPUSH)) { result = jedis.lpush(key, items); } else if (cmd.startsWith(RPUSH)) { result = jedis.rpush(key, items); } else if (cmd.startsWith(LINDEX)) { result = jedis.lindex(key, Integer.parseInt(list[2])); } else if (cmd.startsWith(LLEN)) { result = jedis.llen(key); } else if (cmd.startsWith(LRANGE)) { int start = Integer.parseInt(list[2]); int stop = Integer.parseInt(list[3]); result = jedis.lrange(key, start, stop); } return result; } @Override public Object set(DataCommandsParam dataCommandsParam) { jedis.select(dataCommandsParam.getDatabase()); String command = dataCommandsParam.getCommand(); String[] list = SignUtil.splitBySpace(command); String cmd = command.toUpperCase(); String key = list[1]; Object result = null; if (cmd.startsWith(SCARD)) { result = jedis.scard(key); } else if (cmd.startsWith(SADD)) { result = jedis.sadd(key, removeCommandAndKey(list)); } else if (cmd.startsWith(SMEMBERS)) { result = jedis.smembers(key); } else if (cmd.startsWith(SRANDMEMBER)) { int count = 1; if (list.length > 2) { count = Integer.parseInt(list[2]); } result = jedis.srandmember(key, count); } return result; } @Override public Object zset(DataCommandsParam dataCommandsParam) { jedis.select(dataCommandsParam.getDatabase()); String command = dataCommandsParam.getCommand(); String[] list = SignUtil.splitBySpace(command); String cmd = command.toUpperCase(); String key = list[1]; String param1 = list[2]; String param2 = list[3]; Object result = null; if (cmd.startsWith(ZCARD)) { result = jedis.zcard(key); } else if (cmd.startsWith(ZSCORE)) { result = jedis.zscore(key, param1); } else if (cmd.startsWith(ZCOUNT)) { result = jedis.zcount(key, param1, param2); } else if (cmd.startsWith(ZRANGE)) { int start = Integer.parseInt(param1); int stop = Integer.parseInt(param2); if (list.length > 4) { result = jedis.zrangeWithScores(key, start, stop); } else { result = jedis.zrange(key, start, stop); } } else if (cmd.startsWith(ZADD)) { result = jedis.zadd(key, Double.valueOf(param1), param2); } return result; } @Override public Object type(DataCommandsParam dataCommandsParam) { jedis.select(dataCommandsParam.getDatabase()); String command = dataCommandsParam.getCommand(); String key = RedisUtil.getKey(command); return type(key); } @Override public Object del(DataCommandsParam dataCommandsParam) { jedis.select(dataCommandsParam.getDatabase()); String command = dataCommandsParam.getCommand(); String key = RedisUtil.getKey(command); return del(key); } @Override public Long dbSize() { return jedis.dbSize(); } @Override public String bgSave() { return jedis.bgsave(); } @Override public Long lastSave() { return jedis.lastsave(); } @Override public String bgRewriteAof() { return jedis.bgrewriteaof(); } @Override public NodeRole role() throws Exception { Map<String, String> infoMap = getInfo(REPLICATION); String role = infoMap.get(ROLE); return NodeRole.value(role); } @Override public boolean auth(String password) { return Objects.equals(jedis.auth(password), OK); } @Override public boolean shutdown() { return Strings.isNullOrEmpty(jedis.shutdown()); } /** * addr=127.0.0.1:43143 fd=6 age=183 idle=0 flags=N db=0 sub=0 psub=0 multi=-1 qbuf=0 qbuf-free=32768 obl=0 oll=0 omem=0 events=r cmd=client * addr=127.0.0.1:43163 fd=5 age=35 idle=15 flags=N db=0 sub=0 psub=0 multi=-1 qbuf=0 qbuf-free=0 obl=0 oll=0 omem=0 events=r cmd=ping * addr=127.0.0.1:43167 fd=7 age=24 idle=6 flags=N db=0 sub=0 psub=0 multi=-1 qbuf=0 qbuf-free=0 obl=0 oll=0 omem=0 events=r cmd=get * * @return */ @Override public String clientList() { return jedis.clientList(); } @Override public boolean setConfig(String configKey, String configValue) { String result = jedis.configSet(configKey, configValue); return Objects.equals(result, OK); } @Override public Map<String, String> getConfig() { return getConfig("*"); } @Override public Map<String, String> getConfig(String pattern) { List<String> configList = jedis.configGet(pattern); Map<String, String> configMap = new LinkedHashMap<>(); for (int i = 0, length = configList.size(); i < length; i += 2) { String key = configList.get(i); if (Strings.isNullOrEmpty(key)) { continue; } configMap.put(key, configList.get(i + 1)); } return configMap; } @Override public boolean rewriteConfig() { return Objects.equals(jedis.configRewrite(), OK); } @Override public String clusterSaveConfig() { return jedis.clusterSaveConfig(); } @Override public boolean ping() { String ping = jedis.ping(); return !Strings.isNullOrEmpty(ping) && Objects.equals(ping.toUpperCase(), PONG); } @Override public List<Slowlog> getSlowLog(int size) { return jedis.slowlogGet(size); } @Override public boolean clientSetName(String clientName) { return Objects.equals(jedis.clientSetname(clientName), OK); } @Override public String clusterMeet(String host, int port) { return jedis.clusterMeet(host, port); } @Override public boolean clusterReplicate(String nodeId) { return Objects.equals(jedis.clusterReplicate(nodeId), OK); } @Override public boolean clusterFailOver() { return Objects.equals(jedis.clusterFailover(), OK); } @Override public String clusterAddSlots(int... slots) { return jedis.clusterAddSlots(slots); } @Override public String clusterSetSlotNode(int slot, String nodeId) { return jedis.clusterSetSlotNode(slot, nodeId); } @Override public String clusterSetSlotImporting(int slot, String nodeId) { return jedis.clusterSetSlotImporting(slot, nodeId); } @Override public String clusterSetSlotMigrating(int slot, String nodeId) { return jedis.clusterSetSlotMigrating(slot, nodeId); } @Override public List<String> clusterGetKeysInSlot(int slot, int count) { return jedis.clusterGetKeysInSlot(slot, count); } @Override public String clusterSetSlotStable(int slot) { return jedis.clusterSetSlotStable(slot); } @Override public boolean clusterForget(String nodeId) { return Objects.equals(jedis.clusterForget(nodeId), OK); } @Override public String clusterReset(ClusterReset reset) { return jedis.clusterReset(reset); } @Override public String migrate(String host, int port, String key, int destinationDb, int timeout) { return jedis.migrate(host, port, key, 0, timeout); } @Override public String migrate(String host, int port, int destinationDB, int timeout, MigrateParams params, String... keys) { return jedis.migrate(host, port, destinationDB, timeout, params, keys); } @Override public boolean replicaOf(String host, int port) { return Objects.equals(jedis.slaveof(host, port), OK); } @Override public String replicaNoOne() { return jedis.slaveofNoOne(); } @Override public String memoryPurge() { return null; } @Override public List<Map<String, String>> getSentinelMasters() { return jedis.sentinelMasters(); } @Override public List<String> getMasterAddrByName(String masterName) { return jedis.sentinelGetMasterAddrByName(masterName); } @Override public List<Map<String, String>> sentinelSlaves(String masterName) { return jedis.sentinelSlaves(masterName); } @Override public boolean monitorMaster(String masterName, String ip, int port, int quorum) { return Objects.equals(jedis.sentinelMonitor(masterName, ip, port, quorum), OK); } @Override public boolean failoverMaster(String masterName) { return Objects.equals(jedis.sentinelFailover(masterName), OK); } @Override public boolean sentinelRemove(String masterName) { return Objects.equals(jedis.sentinelRemove(masterName), OK); } @Override public Long resetConfig(String pattern) { return jedis.sentinelReset(pattern); } @Override public boolean sentinelSet(String masterName, Map<String, String> parameterMap) { return Objects.equals(jedis.sentinelSet(masterName, parameterMap), OK); } @Override public void close() { try { if (jedis != null) { jedis.close(); } } catch (Exception ignored) { } } /** * 获取该Redis所有节点IP信息 * * @return */ public Map<String, String> nodesIP(Cluster cluster) { Map<String, String> nodesIP = new HashMap<>(); if ("cluster".equals(cluster.getRedisMode())) { nodesIP = this.clusterNodesIP(cluster); } else { nodesIP = this.standAloneNodesIP(cluster); } return nodesIP; } /** * 获取该stand alone Redis所有节点IP信息 * * @return */ public Map<String, String> standAloneNodesIP(Cluster cluster) { Map<String, String> nodesIPs = new HashMap<>(); List<String> nodesList = this.standAloneRedisNodes(cluster); for(String node : nodesList) { String host = node.split(":")[0]; nodesIPs.put(host, host); } return nodesIPs; } /** * 获取该RedisCluster所有节点IP信息 * * @return */ public Map<String, String> clusterNodesIP(Cluster cluster) { String redisUrl = cluster.getNodes().split(",")[0]; String redisHost = redisUrl.split(":")[0]; int redisPort = Integer.parseInt(redisUrl.split(":")[1]); JedisCluster jedisCluster = new JedisCluster(new HostAndPort(redisHost,redisPort)); Map<String, JedisPool> nodes = jedisCluster.getClusterNodes(); Map<String, String> clusterNodesIP = new HashMap<>(); nodes.forEach((k, v) -> { String host = k.split(":")[0]; clusterNodesIP.put(host, host); }); return clusterNodesIP; } public List<String> standAloneRedisNodes(Cluster cluster) { String redisUrl = cluster.getNodes().split(",")[0]; String redisHost = redisUrl.split(":")[0]; int redisPort = Integer.parseInt(redisUrl.split(":")[1]); Jedis satandAloneJedis = new Jedis(redisHost,redisPort); if (StringUtils.isNotBlank(cluster.getRedisPassword())) { satandAloneJedis.auth(cluster.getRedisPassword()); } Set<String> allNodes = new HashSet<>(); allNodes.add(redisUrl); String res = satandAloneJedis.info("Replication"); String[] resArr = res.split("\n"); // master or slave String role = resArr[1].split(":")[1]; if("slave".equals(role.trim())){ String masterHost = resArr[2].split(":")[1].trim(); String masterPort = resArr[3].split(":")[1].trim(); allNodes.add(masterHost+":"+masterPort); satandAloneJedis = new Jedis(masterHost,Integer.parseInt(masterPort)); if (StringUtils.isNotBlank(cluster.getRedisPassword())) { satandAloneJedis.auth(cluster.getRedisPassword()); } res= satandAloneJedis.info("Replication"); resArr = res.split("\n"); } for(String str : resArr) { if(str.contains("ip") && str.contains("port")) { String[] hostAndportArr = str.split(":")[1].split(","); String host = hostAndportArr[0].substring(hostAndportArr[0].indexOf("=")+1);; String port = hostAndportArr[1].substring(hostAndportArr[1].indexOf("=")+1); if(!allNodes.contains(host+":"+port)) { allNodes.add(host+":"+port); } if(!allNodes.contains(host+":"+redisPort)) { allNodes.add(host+":"+redisPort); } } } List<String>nodes = new ArrayList<>(allNodes); return nodes; } public Map<String, List<String>> nodesMap(Cluster cluster) { Map<String, List<String>> nodes = new HashMap<>(); if ("cluster".equals(cluster.getRedisMode())) { nodes = this.clusterNodesMap(cluster); } else { nodes = this.standAloneNodesMap(cluster); } return nodes; } public Map<String, List<String>> standAloneNodesMap(Cluster cluster) { Map<String, List<String>> nodes = new HashMap<>(); String redisUrl = cluster.getNodes().split(",")[0]; String redisHost = redisUrl.split(":")[0]; int redisPort = Integer.parseInt(redisUrl.split(":")[1]); Jedis satandAloneJedis = new Jedis(redisHost,redisPort); if (StringUtils.isNotBlank(cluster.getRedisPassword())) { satandAloneJedis.auth(cluster.getRedisPassword()); } String res = satandAloneJedis.info("Replication"); String[] resArr = res.split("\n"); // master or slave String role = resArr[1].split(":")[1]; // slave前提下的master信息 String masterHost = ""; String masterPort = ""; int flag = 0; if("slave".equals(role.trim())) { masterHost = resArr[2].split(":")[1].trim(); masterPort = resArr[3].split(":")[1].trim(); satandAloneJedis = new Jedis(masterHost,Integer.parseInt(masterPort)); if (StringUtils.isNotBlank(cluster.getRedisPassword())) { satandAloneJedis.auth(cluster.getRedisPassword()); } res= satandAloneJedis.info("Replication"); resArr = res.split("\n"); flag = 1; } List<String> slaves = new ArrayList<>(); for(String str : resArr) { if(str.contains("ip") && str.contains("port")) { String[] hostAndportArr = str.split(":")[1].split(","); String host = hostAndportArr[0].substring(hostAndportArr[0].indexOf("=")+1);; String port = hostAndportArr[1].substring(hostAndportArr[1].indexOf("=")+1); slaves.add(host+":"+port); if(flag == 0) { nodes.put(redisHost+":"+redisPort, slaves); } else { nodes.put(masterHost+":"+masterPort, slaves); } } } return nodes; } /** * 获取该RedisCluster所有Master对应slave 信息 <k,v> k=master ip:port v=[{slave * ip:port},{slave ip:port}] * * @return */ public Map<String, List<String>> clusterNodesMap(Cluster cluster) { String redisUrl = cluster.getNodes().split(",")[0]; String redisHost = redisUrl.split(":")[0]; int redisPort = Integer.parseInt(redisUrl.split(":")[1]); JedisCluster jedisCluster = new JedisCluster(new HostAndPort(redisHost,redisPort)); Map<String, JedisPool> nodes = jedisCluster.getClusterNodes(); Map<String, List<String>> clusterNodes = new HashMap<>(); String nodesStr = ""; for (String key : nodes.keySet()) { JedisPool jedisPool = nodes.get(key); Jedis jedisTemp = jedisPool.getResource(); nodesStr = jedisTemp.clusterNodes(); jedisTemp.close(); break; } String[] nodesArray = nodesStr.split("\n"); List<RedisNodeTemp> redisNodes = new ArrayList<>(); Map<String, String> temp = new HashMap<>(); for (String node : nodesArray) { if (node.indexOf("fail") > 0) { continue; } RedisNodeTemp redisNodeTemp = new RedisNodeTemp(); String[] detail = node.split(" "); if (node.contains("master")) { temp.put(detail[0], detail[1]); redisNodeTemp.setRole(0); redisNodeTemp.setPid("0"); } else { redisNodeTemp.setRole(1); redisNodeTemp.setPid(detail[3]); } redisNodeTemp.setHostAndPort(detail[1]); redisNodeTemp.setId(detail[0]); redisNodes.add(redisNodeTemp); } for (RedisNodeTemp node : redisNodes) { if (node.getRole() == 0) { continue; } if (temp.containsKey(node.getPid())) { String key = temp.get(node.getPid()); if (clusterNodes.containsKey(key)) { List<String> slaves = clusterNodes.get(key); List<String> slaves2 = new ArrayList<>(); slaves.add(node.getHostAndPort()); key = key.split("@")[0]; for (int i = 0;i<slaves.size();i++){ slaves2.add(slaves.get(i).split("@")[0]); } clusterNodes.put(key, slaves2); } else { List<String> slaves = new ArrayList<>(); List<String> slaves2 = new ArrayList<>(); slaves.add(node.getHostAndPort()); key = key.split("@")[0]; for (int i = 0;i<slaves.size();i++){ slaves2.add(slaves.get(i).split("@")[0]); } clusterNodes.put(key, slaves2); } } } return clusterNodes; } /** * 根据<master:slaves>获取执行分析任务ports规则 * 即获取其中一个slave,尽量保持均衡在不同机器上 * * @param clusterNodesMap * @return <ip:ports> */ public static Map<String, Set<String>> generateAnalyzeRule(Map<String, List<String>> clusterNodesMap) { // 通过该map存储不同IP分配的数量,按照规则,优先分配数量最小的IP Map<String, Integer> staticsResult = new HashMap<>(); Map<String, Set<String>> generateRule = new HashMap<>(); // 此处排序是为了将slave数量最小的优先分配 List<Map.Entry<String, List<String>>> sortList = new LinkedList<>(clusterNodesMap.entrySet()); Collections.sort(sortList, new Comparator<Map.Entry<String, List<String>>>() { @Override public int compare(Map.Entry<String, List<String>> o1, Map.Entry<String, List<String>> o2) { return o1.getValue().size() - o2.getValue().size(); } }); for (Map.Entry<String, List<String>> entry : sortList) { List<String> slaves = entry.getValue(); boolean isSelected = false; String tempPort = null; String tempIP = null; int num = 0; for (String slave : slaves) { String ip = slave.split(":")[0]; String port = slave.split(":")[1]; // 统计组里面不存在的IP优先分配 if (!staticsResult.containsKey(ip)) { staticsResult.put(ip, 1); Set<String> generatePorts = generateRule.get(ip); if (generatePorts == null) { generatePorts = new HashSet<>(); } generatePorts.add(port); generateRule.put(ip, generatePorts); isSelected = true; break; } else { // 此处是为了求出被使用最少的IP Integer staticsNum = staticsResult.get(ip); if (num == 0) { num = staticsNum; tempPort = port; tempIP = ip; continue; } if (staticsNum < num) { tempPort = port; tempIP = ip; num = staticsNum; } } } // 如果上面未分配,则选择staticsResult中数值最小的那个slave if (!isSelected) { if (slaves != null && slaves.size() > 0) { if (tempPort != null) { Set<String> generatePorts = generateRule.get(tempIP); if (generatePorts == null) { generatePorts = new HashSet<>(); } generatePorts.add(tempPort); generateRule.put(tempIP, generatePorts); staticsResult.put(tempIP, staticsResult.get(tempIP) + 1); } } } } return generateRule; } class RedisNodeTemp { private String id; private String pid; private String hostAndPort; // 0:master 1:slave private int role; public String getId() { return id; } public void setId(String id) { this.id = id; } public String getPid() { return pid; } public void setPid(String pid) { this.pid = pid; } public String getHostAndPort() { return hostAndPort; } public void setHostAndPort(String hostAndPort) { this.hostAndPort = hostAndPort; } public int getRole() { return role; } public void setRole(int role) { this.role = role; } } }
seamhhp/redis-manager
<|start_filename|>src/suppressions/all.js<|end_filename|> suppressions['all'] = Suppressions.create( ( () => { var list = []; for (let locale in suppressions) { list = list.concat(suppressions[locale].list); } return list; })() ) <|start_filename|>src/nullSuppressions.js<|end_filename|> export class NullSuppressions { static instance; constructor() { if (this.instance) { return this.instance; } this.instance = this; } shouldBreak(_cursor) { return true; } } <|start_filename|>src/split.js<|end_filename|> let split = (breakIter, funcName, str) => { let result = []; breakIter[funcName](str, (text, _start, _stop) => { result.push(text); }); return result; }; export const wordSplit = (str, suppressions) => { return split(new BreakIterator(suppressions), 'eachWord', str); }; export const sentenceSplit = (str, suppressions) => { return split(new BreakIterator(suppressions), 'eachSentence', str); }; export const graphemeSplit = (str, suppressions) => { return split(new BreakIterator(suppressions), 'eachGraphemeCluster', str); }; export const lineSplit = (str, suppressions) => { return split(new BreakIterator(suppressions), 'eachLine', str); }; <|start_filename|>src/categoryTable.js<|end_filename|> class CategoryTable { constructor(values) { this.values = values; } get(codepoint) { return this.find(codepoint)[2]; } // private find(codepoint) { var lo = 0, hi = this.values.length; while (lo <= hi) { let mid = Math.floor((hi + lo) / 2); let current = this.values[mid]; if (codepoint < current[0]) { hi = mid - 1; } else if (codepoint > current[1]) { lo = mid + 1; } else { return current; } } // we should realistically never get here return null; } } <|start_filename|>demo.js<|end_filename|> var cldrSegmentation = require('./dist/cldr-segmentation.js'); var breakIter = new cldrSegmentation.BreakIterator(cldrSegmentation.suppressions.en); var str = "I like Mrs. Patterson, she's nice."; breakIter.eachSentence(str, function(str, start, stop) { console.log("'" + str + "': " + start + ", " + stop); }); breakIter.eachWord(str, function(str, start, stop) { console.log("'" + str + "': " + start + ", " + stop); }); <|start_filename|>src/cursor.js<|end_filename|> class Cursor { constructor(text) { this.text = text; this.length = text.length; this.codepoints = utfstring.stringToCodePoints(text); this.reset(); } advance(amount = 1) { for (var i = 0; i < amount; i ++) { let cp = this.getCodePoint(); if (cp > 0xFFFF) { this.actualPosition += 2; } else { this.actualPosition ++; } this.logicalPosition ++; } } retreat(amount = 1) { for (var i = 0; i < amount; i ++) { this.logicalPosition --; let cp = this.getCodePoint(); if (cp > 0xFFFF) { this.actualPosition -= 2; } else { this.actualPosition --; } } } reset() { this.logicalPosition = 0; this.actualPosition = 0; } isEos() { return this.logicalPosition >= this.codepoints.length; } getCodePoint(pos = this.logicalPosition) { return this.codepoints[pos]; } slice(start, finish) { return utfstring.codePointsToString( this.codepoints.slice(start, finish) ); } } <|start_filename|>src/stateMachine.js<|end_filename|> const START_STATE = 1; const STOP_STATE = 0; const NEXT_STATES = 4; const ACCEPTING = 0; class StateMachine { static getInstance(boundaryType) { let cache = StateMachine.getCache(); if (cache[boundaryType] === undefined) { let rsrc = RuleSet[boundaryType]; cache[boundaryType] = new StateMachine( boundaryType, new Metadata(rsrc.metadata), new StateTable(rsrc.forwardTable.table, rsrc.forwardTable.flags), new CategoryTable(rsrc.categoryTable) ); } return cache[boundaryType]; } static getCache() { if (this.cache === undefined) { this.cache = {}; } return this.cache; } constructor(boundaryType, metadata, ftable, categoryTable) { this.boundaryType = boundaryType; this.metadata = metadata; this.ftable = ftable; this.categoryTable = categoryTable; } handleNext(cursor) { var initialPosition = cursor.actualPosition; var result = cursor.actualPosition; var state = START_STATE; var row = this.getRowIndex(state); var category = 3; var mode = 'run'; if (this.ftable.isBofRequired()) { category = 2; mode = 'start'; } while (state != STOP_STATE) { if (cursor.isEos()) { if (mode === 'stop') { break; } mode = 'stop'; category = 1; } else if (mode === 'run') { category = this.categoryTable.get(cursor.getCodePoint()); if ((category & 0x4000) != 0) { category &= ~0x4000; } cursor.advance(); } else { mode = 'run'; } state = this.ftable.get(row + NEXT_STATES + category); row = this.getRowIndex(state); if (this.ftable.get(row + ACCEPTING) == -1) { // match found result = cursor.actualPosition; } } while (cursor.actualPosition != result) { cursor.retreat(); } // don't let cursor get stuck if (cursor.actualPosition === initialPosition) { cursor.advance(); } return result; } // private getRowIndex(state) { return state * (this.metadata.getCategoryCount() + 4); } } <|start_filename|>src/ruleSet.js<|end_filename|> export class RuleSet { static create(boundaryType, suppressions) { return new RuleSet( StateMachine.getInstance(boundaryType), suppressions ); } constructor(stateMachine, suppressions) { this.stateMachine = stateMachine; this.suppressions = suppressions || new NullSuppressions(); } eachBoundary(str, callback) { let cursor = new Cursor(str); // Let the state machine find the first boundary for the line // boundary type. This helps pass nearly all the Unicode // segmentation tests, so it must be the right thing to do. // Normally the first boundary is the implicit start of text // boundary, but potentially not for the line rules? if (this.stateMachine.boundaryType !== 'line') { callback(0); } while (!cursor.isEos()) { this.stateMachine.handleNext(cursor); if (this.suppressions.shouldBreak(cursor)) { callback(cursor.actualPosition); } } } getBoundaryType() { return this.stateMachine.boundaryType; } } <|start_filename|>spec/wordSplit.spec.js<|end_filename|> ( () => { let path = require('path'); let dist = path.normalize(path.join(__dirname, '..', 'dist')); if (module.paths.indexOf(dist) < 0) { module.paths.push(dist); } let cldrSegmentation = require('cldr-segmentation'); describe('#wordSplit', () => { it('splits correctly', () => { let str = "I like Mrs. Murphy. She's nice."; let result = cldrSegmentation.wordSplit(str); expect(result).toEqual( ['I', ' ', 'like', ' ', 'Mrs', '.', ' ', 'Murphy', '.', ' ', "She's", ' ', 'nice', '.'] ); }); }); })(); <|start_filename|>src/stateTable.js<|end_filename|> const BOF_REQUIRED_FLAG = 2; class StateTable { constructor(values, flags) { this.values = values; this.flags = flags; } get(idx) { return this.values[idx]; } isBofRequired() { return (this.flags & BOF_REQUIRED_FLAG) != 0; } } <|start_filename|>src/metadata.js<|end_filename|> class Metadata { constructor(values) { this.values = values; } getCategoryCount() { return this.values.categoryCount; } }
KevinSoulat/cldr-segmentation.js
<|start_filename|>src/test/java/io/nats/client/api/ConsumerConfigurationTests.java<|end_filename|> // Copyright 2020 The NATS Authors // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at: // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package io.nats.client.api; import io.nats.client.support.DateTimeUtils; import io.nats.client.utils.TestBase; import org.junit.jupiter.api.Test; import java.time.Duration; import java.time.ZonedDateTime; import static io.nats.client.utils.ResourceUtils.dataAsString; import static org.junit.jupiter.api.Assertions.*; public class ConsumerConfigurationTests extends TestBase { @Test public void testBuilder() { ZonedDateTime zdt = ZonedDateTime.of(2012, 1, 12, 6, 30, 1, 500, DateTimeUtils.ZONE_ID_GMT); ConsumerConfiguration c = ConsumerConfiguration.builder() .ackPolicy(AckPolicy.Explicit) .ackWait(Duration.ofSeconds(99)) // duration .deliverPolicy(DeliverPolicy.ByStartSequence) .description("blah") .durable(DURABLE) .filterSubject("fs") .maxDeliver(5555) .maxAckPending(6666) .rateLimit(4242) .replayPolicy(ReplayPolicy.Original) .sampleFrequency("10s") .startSequence(2001) .startTime(zdt) .deliverSubject(DELIVER) .flowControl(66000) // duration .maxPullWaiting(73) .maxBatch(55) .maxExpires(77000) // duration .inactiveThreshold(88000) // duration .headersOnly(true) .backoff(1000, 2000, 3000) .build(); assertAsBuilt(c, zdt); ConsumerCreateRequest ccr = new ConsumerCreateRequest(STREAM, c); assertEquals(STREAM, ccr.getStreamName()); assertNotNull(ccr.getConfig()); String json = ccr.toJson(); c = new ConsumerConfiguration(json); assertAsBuilt(c, zdt); assertNotNull(ccr.toString()); // COVERAGE assertNotNull(c.toString()); // COVERAGE // flow control idle heartbeat combo c = ConsumerConfiguration.builder() .flowControl(Duration.ofMillis(501)).build(); assertTrue(c.isFlowControl()); assertEquals(501, c.getIdleHeartbeat().toMillis()); c = ConsumerConfiguration.builder() .flowControl(502).build(); assertTrue(c.isFlowControl()); assertEquals(502, c.getIdleHeartbeat().toMillis()); // millis instead of duration coverage // supply null as deliverPolicy, ackPolicy , replayPolicy, c = ConsumerConfiguration.builder() .deliverPolicy(null) .ackPolicy(null) .replayPolicy(null) .ackWait(9000) // millis .idleHeartbeat(6000) // millis .build(); assertEquals(AckPolicy.Explicit, c.getAckPolicy()); assertEquals(DeliverPolicy.All, c.getDeliverPolicy()); assertEquals(ReplayPolicy.Instant, c.getReplayPolicy()); assertEquals(Duration.ofSeconds(9), c.getAckWait()); assertEquals(Duration.ofSeconds(6), c.getIdleHeartbeat()); ConsumerConfiguration original = ConsumerConfiguration.builder().build(); validateDefault(original); ConsumerConfiguration ccTest = ConsumerConfiguration.builder(null).build(); validateDefault(ccTest); ccTest = new ConsumerConfiguration.Builder(null).build(); validateDefault(ccTest); ccTest = ConsumerConfiguration.builder(original).build(); validateDefault(ccTest); } private void validateDefault(ConsumerConfiguration cc) { assertDefaultCc(cc); assertFalse(cc.deliverPolicyWasSet()); assertFalse(cc.ackPolicyWasSet()); assertFalse(cc.replayPolicyWasSet()); assertFalse(cc.startSeqWasSet()); assertFalse(cc.maxDeliverWasSet()); assertFalse(cc.rateLimitWasSet()); assertFalse(cc.maxAckPendingWasSet()); assertFalse(cc.maxPullWaitingWasSet()); assertFalse(cc.flowControlWasSet()); assertFalse(cc.headersOnlyWasSet()); assertFalse(cc.maxBatchWasSet()); } private void assertAsBuilt(ConsumerConfiguration c, ZonedDateTime zdt) { assertEquals(AckPolicy.Explicit, c.getAckPolicy()); assertEquals(Duration.ofSeconds(99), c.getAckWait()); assertEquals(DeliverPolicy.ByStartSequence, c.getDeliverPolicy()); assertEquals("blah", c.getDescription()); assertEquals(DURABLE, c.getDurable()); assertEquals("fs", c.getFilterSubject()); assertEquals(5555, c.getMaxDeliver()); assertEquals(6666, c.getMaxAckPending()); assertEquals(4242, c.getRateLimit()); assertEquals(ReplayPolicy.Original, c.getReplayPolicy()); assertEquals("10s", c.getSampleFrequency()); assertEquals(2001, c.getStartSequence()); assertEquals(zdt, c.getStartTime()); assertEquals(DELIVER, c.getDeliverSubject()); assertTrue(c.isFlowControl()); assertEquals(Duration.ofSeconds(66), c.getIdleHeartbeat()); assertEquals(73, c.getMaxPullWaiting()); assertEquals(55, c.getMaxBatch()); assertEquals(Duration.ofSeconds(77), c.getMaxExpires()); assertEquals(Duration.ofSeconds(88), c.getInactiveThreshold()); assertTrue(c.isHeadersOnly()); assertTrue(c.deliverPolicyWasSet()); assertTrue(c.ackPolicyWasSet()); assertTrue(c.replayPolicyWasSet()); assertTrue(c.startSeqWasSet()); assertTrue(c.maxDeliverWasSet()); assertTrue(c.rateLimitWasSet()); assertTrue(c.maxAckPendingWasSet()); assertTrue(c.maxPullWaitingWasSet()); assertTrue(c.flowControlWasSet()); assertTrue(c.headersOnlyWasSet()); assertTrue(c.maxBatchWasSet()); assertEquals(3, c.getBackoff().size()); assertEquals(Duration.ofSeconds(1), c.getBackoff().get(0)); assertEquals(Duration.ofSeconds(2), c.getBackoff().get(1)); assertEquals(Duration.ofSeconds(3), c.getBackoff().get(2)); } @Test public void testParsingAndSetters() { String configJSON = dataAsString("ConsumerConfiguration.json"); ConsumerConfiguration c = new ConsumerConfiguration(configJSON); assertEquals("foo-desc", c.getDescription()); assertEquals(DeliverPolicy.All, c.getDeliverPolicy()); assertEquals(AckPolicy.All, c.getAckPolicy()); assertEquals(Duration.ofSeconds(30), c.getAckWait()); assertEquals(Duration.ofSeconds(20), c.getIdleHeartbeat()); assertEquals(10, c.getMaxDeliver()); assertEquals(73, c.getRateLimit()); assertEquals(ReplayPolicy.Original, c.getReplayPolicy()); assertEquals(2020, c.getStartTime().getYear(), 2020); assertEquals(21, c.getStartTime().getSecond(), 21); assertEquals("foo-durable", c.getDurable()); assertEquals("bar", c.getDeliverSubject()); assertEquals("foo-filter", c.getFilterSubject()); assertEquals(42, c.getMaxAckPending()); assertEquals("sample_freq-value", c.getSampleFrequency()); assertTrue(c.isFlowControl()); assertEquals(128, c.getMaxPullWaiting()); assertTrue(c.isHeadersOnly()); assertEquals(99, c.getStartSequence()); assertEquals(55, c.getMaxBatch()); assertEquals(Duration.ofSeconds(40), c.getMaxExpires()); assertEquals(Duration.ofSeconds(50), c.getInactiveThreshold()); assertEquals(3, c.getBackoff().size()); assertEquals(Duration.ofSeconds(1), c.getBackoff().get(0)); assertEquals(Duration.ofSeconds(2), c.getBackoff().get(1)); assertEquals(Duration.ofSeconds(3), c.getBackoff().get(2)); assertDefaultCc(new ConsumerConfiguration("{}")); } private static void assertDefaultCc(ConsumerConfiguration c) { assertEquals(DeliverPolicy.All, c.getDeliverPolicy()); assertEquals(AckPolicy.Explicit, c.getAckPolicy()); assertEquals(ReplayPolicy.Instant, c.getReplayPolicy()); assertNull(c.getDurable()); assertNull(c.getDeliverGroup()); assertNull(c.getDeliverSubject()); assertNull(c.getFilterSubject()); assertNull(c.getDescription()); assertNull(c.getSampleFrequency()); assertNull(c.getAckWait()); assertNull(c.getIdleHeartbeat()); assertNull(c.getStartTime()); assertFalse(c.isFlowControl()); assertFalse(c.isHeadersOnly()); assertEquals(0, c.getStartSequence()); assertEquals(-1, c.getMaxDeliver()); assertEquals(0, c.getRateLimit()); assertEquals(-1, c.getMaxAckPending()); assertEquals(-1, c.getMaxPullWaiting()); assertEquals(0, c.getBackoff().size()); } } <|start_filename|>src/test/java/io/nats/client/utils/TestBase.java<|end_filename|> // Copyright 2015-2018 The NATS Authors // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at: // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package io.nats.client.utils; import io.nats.client.*; import io.nats.client.impl.NatsMessage; import org.opentest4j.AssertionFailedError; import java.io.IOException; import java.nio.charset.StandardCharsets; import java.time.Duration; import java.util.concurrent.TimeUnit; import java.util.concurrent.locks.LockSupport; import static io.nats.client.support.NatsConstants.DOT; import static io.nats.examples.ExampleUtils.uniqueEnough; import static org.junit.jupiter.api.Assertions.*; public class TestBase { public static final String PLAIN = "plain"; public static final String HAS_SPACE = "has space"; public static final String HAS_PRINTABLE = "has-print!able"; public static final String HAS_DOT = "has.dot"; public static final String HAS_STAR = "has*star"; public static final String HAS_GT = "has>gt"; public static final String HAS_DASH = "has-dash"; public static final String HAS_UNDER = "has_under"; public static final String HAS_DOLLAR = "has$dollar"; public static final String HAS_LOW = "has\tlower\rthan\nspace"; public static final String HAS_127 = "has" + (char)127 + "127"; public static final String HAS_FWD_SLASH = "has/fwd/slash"; public static final String HAS_EQUALS = "has=equals"; public static final String HAS_TIC = "has`tic"; public static final long STANDARD_CONNECTION_WAIT_MS = 5000; public static final long STANDARD_FLUSH_TIMEOUT_MS = 2000; public static final long MEDIUM_FLUSH_TIMEOUT_MS = 5000; public static final long LONG_TIMEOUT_MS = 15000; public static final long VERY_LONG_TIMEOUT_MS = 20000; // ---------------------------------------------------------------------------------------------------- // runners // ---------------------------------------------------------------------------------------------------- public interface InServerTest { void test(Connection nc) throws Exception; } public static void runInServer(InServerTest inServerTest) throws Exception { runInServer(false, false, inServerTest); } public static void runInServer(Options.Builder builder, InServerTest inServerTest) throws Exception { runInServer(false, false, builder, inServerTest); } public static void runInServer(boolean debug, InServerTest inServerTest) throws Exception { runInServer(debug, false, inServerTest); } public static void runInJsServer(InServerTest inServerTest) throws Exception { runInServer(false, true, inServerTest); } public static void runInJsServer(Options.Builder builder, InServerTest inServerTest) throws Exception { runInServer(false, true, builder, inServerTest); } public static void runInJsServer(boolean debug, InServerTest inServerTest) throws Exception { runInServer(debug, true, inServerTest); } public static void runInServer(boolean debug, boolean jetstream, InServerTest inServerTest) throws Exception { try (NatsTestServer ts = new NatsTestServer(debug, jetstream); Connection nc = standardConnection(ts.getURI())) { inServerTest.test(nc); } } public static void runInServer(boolean debug, boolean jetstream, Options.Builder builder, InServerTest inServerTest) throws Exception { try (NatsTestServer ts = new NatsTestServer(debug, jetstream); Connection nc = standardConnection(builder.server(ts.getURI()).build())) { inServerTest.test(nc); } } public static void runInExternalServer(InServerTest inServerTest) throws Exception { runInExternalServer(Options.DEFAULT_URL, inServerTest); } public static void runInExternalServer(String url, InServerTest inServerTest) throws Exception { try (Connection nc = Nats.connect(url)) { inServerTest.test(nc); } } // ---------------------------------------------------------------------------------------------------- // data makers // ---------------------------------------------------------------------------------------------------- public static final String STREAM = "stream"; public static final String MIRROR = "mirror"; public static final String SOURCE = "source"; public static final String SUBJECT = "subject"; public static final String SUBJECT_STAR = SUBJECT + ".*"; public static final String SUBJECT_GT = SUBJECT + ".>"; public static final String QUEUE = "queue"; public static final String DURABLE = "durable"; public static final String PUSH_DURABLE = "push-" + DURABLE; public static final String PULL_DURABLE = "pull-" + DURABLE; public static final String DELIVER = "deliver"; public static final String MESSAGE_ID = "mid"; public static final String BUCKET = "bucket"; public static final String KEY = "key"; public static final String DATA = "data"; public static String stream(int seq) { return STREAM + "-" + seq; } public static String mirror(int seq) { return MIRROR + "-" + seq; } public static String source(int seq) { return SOURCE + "-" + seq; } public static String subject(int seq) { return SUBJECT + "-" + seq; } public static String subjectDot(String field) { return SUBJECT + DOT + field; } public static String queue(int seq) { return QUEUE + "-" + seq; } public static String durable(int seq) { return DURABLE + "-" + seq; } public static String durable(String vary, int seq) { return DURABLE + "-" + vary + "-" + seq; } public static String deliver(int seq) { return DELIVER + "-" + seq; } public static String bucket(int seq) { return BUCKET + "-" + seq; } public static String key(int seq) { return KEY + "-" + seq; } public static String messageId(int seq) { return MESSAGE_ID + "-" + seq; } public static String data(int seq) { return DATA + "-" + seq; } public static byte[] dataBytes(int seq) { return data(seq).getBytes(StandardCharsets.US_ASCII); } public static NatsMessage getDataMessage(String data) { return new NatsMessage(SUBJECT, null, data.getBytes(StandardCharsets.US_ASCII)); } // ---------------------------------------------------------------------------------------------------- // assertions // ---------------------------------------------------------------------------------------------------- public static void assertConnected(Connection conn) { assertSame(Connection.Status.CONNECTED, conn.getStatus(), () -> expectingMessage(conn, Connection.Status.CONNECTED)); } public static void assertNotConnected(Connection conn) { assertNotSame(Connection.Status.CONNECTED, conn.getStatus(), () -> "Failed not expecting Connection Status " + Connection.Status.CONNECTED.name()); } public static void assertClosed(Connection conn) { assertSame(Connection.Status.CLOSED, conn.getStatus(), () -> expectingMessage(conn, Connection.Status.CLOSED)); } public static void assertCanConnect() throws IOException, InterruptedException { standardCloseConnection( standardConnection() ); } public static void assertCanConnect(String serverURL) throws IOException, InterruptedException { standardCloseConnection( standardConnection(serverURL) ); } public static void assertCanConnect(Options options) throws IOException, InterruptedException { standardCloseConnection( standardConnection(options) ); } public static void assertCanConnectAndPubSub() throws IOException, InterruptedException { Connection conn = standardConnection(); assertPubSub(conn); standardCloseConnection(conn); } public static void assertCanConnectAndPubSub(String serverURL) throws IOException, InterruptedException { Connection conn = standardConnection(serverURL); assertPubSub(conn); standardCloseConnection(conn); } public static void assertCanConnectAndPubSub(Options options) throws IOException, InterruptedException { Connection conn = standardConnection(options); assertPubSub(conn); standardCloseConnection(conn); } public static void assertByteArraysEqual(byte[] data1, byte[] data2) { if (data1 == null) { assertNull(data2); return; } assertNotNull(data2); assertEquals(data1.length, data2.length); for (int x = 0; x < data1.length; x++) { assertEquals(data1[x], data2[x]); } } public static void assertPubSub(Connection conn) throws InterruptedException { String subject = "sub" + uniqueEnough(); String data = "data" + uniqueEnough(); Subscription sub = conn.subscribe(subject); conn.publish(subject, data.getBytes()); Message m = sub.nextMessage(Duration.ofSeconds(2)); assertNotNull(m); assertEquals(data, new String(m.getData())); } // ---------------------------------------------------------------------------------------------------- // utils / macro utils // ---------------------------------------------------------------------------------------------------- public static void sleep(long ms) { try { Thread.sleep(ms); } catch (InterruptedException ignored) { /* ignored */ } } public static void park(Duration d) { try { LockSupport.parkNanos(d.toNanos()); } catch (Exception ignored) { /* ignored */ } } public static void debugPrintln(Object... debug) { StringBuilder sb = new StringBuilder(); sb.append(System.currentTimeMillis()); sb.append(" ["); sb.append(Thread.currentThread().getName()); sb.append(","); sb.append(Thread.currentThread().getPriority()); sb.append("] "); boolean flag = true; for (Object o : debug) { if (flag) { flag = false; } else { sb.append(" | "); } sb.append(o); } System.out.println(sb.toString()); } // ---------------------------------------------------------------------------------------------------- // flush // ---------------------------------------------------------------------------------------------------- public static void flushConnection(Connection conn) { flushConnection(conn, Duration.ofMillis(STANDARD_FLUSH_TIMEOUT_MS)); } public static void flushConnection(Connection conn, long timeoutMillis) { flushConnection(conn, Duration.ofMillis(timeoutMillis)); } public static void flushConnection(Connection conn, Duration timeout) { try { conn.flush(timeout); } catch (Exception exp) { /* ignored */ } } public static void flushAndWait(Connection conn, TestHandler handler, long flushTimeoutMillis, long waitForStatusMillis) { flushConnection(conn, flushTimeoutMillis); handler.waitForStatusChange(waitForStatusMillis, TimeUnit.MILLISECONDS); } public static void flushAndWaitLong(Connection conn, TestHandler handler) { flushAndWait(conn, handler, STANDARD_FLUSH_TIMEOUT_MS, LONG_TIMEOUT_MS); } // ---------------------------------------------------------------------------------------------------- // connect or wait for a connection // ---------------------------------------------------------------------------------------------------- public static Connection standardConnection() throws IOException, InterruptedException { return standardConnectionWait( Nats.connect() ); } public static Connection standardConnection(String serverURL) throws IOException, InterruptedException { return standardConnectionWait( Nats.connect(serverURL) ); } public static Connection standardConnection(Options options) throws IOException, InterruptedException { return standardConnectionWait( Nats.connect(options) ); } public static Connection standardConnection(Options options, TestHandler handler) throws IOException, InterruptedException { return standardConnectionWait( Nats.connect(options), handler ); } public static Connection standardConnectionWait(Connection conn, TestHandler handler) { return standardConnectionWait(conn, handler, STANDARD_CONNECTION_WAIT_MS); } public static Connection standardConnectionWait(Connection conn, TestHandler handler, long millis) { handler.waitForStatusChange(millis, TimeUnit.MILLISECONDS); assertConnected(conn); return conn; } public static Connection standardConnectionWait(Connection conn) { return connectionWait(conn, STANDARD_CONNECTION_WAIT_MS); } public static Connection connectionWait(Connection conn, long millis) { return waitUntilStatus(conn, millis, Connection.Status.CONNECTED); } // ---------------------------------------------------------------------------------------------------- // close // ---------------------------------------------------------------------------------------------------- public static void standardCloseConnection(Connection conn) { closeConnection(conn, STANDARD_CONNECTION_WAIT_MS); } public static void closeConnection(Connection conn, long millis) { if (conn != null) { close(conn); waitUntilStatus(conn, millis, Connection.Status.CLOSED); assertClosed(conn); } } public static void close(Connection conn) { try { conn.close(); } catch (InterruptedException e) { /* ignored */ } } // ---------------------------------------------------------------------------------------------------- // connection waiting // ---------------------------------------------------------------------------------------------------- public static Connection waitUntilStatus(Connection conn, long millis, Connection.Status waitUntilStatus) { long times = (millis + 99) / 100; for (long x = 0; x < times; x++) { sleep(100); if (conn.getStatus() == waitUntilStatus) { return conn; } } throw new AssertionFailedError(expectingMessage(conn, waitUntilStatus)); } private static String expectingMessage(Connection conn, Connection.Status expecting) { return "Failed expecting Connection Status " + expecting.name() + " but was " + conn.getStatus(); } } <|start_filename|>src/main/java/io/nats/client/support/NatsJetStreamClientError.java<|end_filename|> package io.nats.client.support; public class NatsJetStreamClientError { private static final int KIND_ILLEGAL_ARGUMENT = 0; private static final int KIND_ILLEGAL_STATE = 1; private static final String SUB = "SUB"; private static final String SO = "SO"; public static final NatsJetStreamClientError JsSubPullCantHaveDeliverGroup = new NatsJetStreamClientError(SUB, 90001, "Pull subscriptions can't have a deliver group."); public static final NatsJetStreamClientError JsSubPullCantHaveDeliverSubject = new NatsJetStreamClientError(SUB, 90002, "Pull subscriptions can't have a deliver subject."); public static final NatsJetStreamClientError JsSubPushCantHaveMaxPullWaiting = new NatsJetStreamClientError(SUB, 90003, "Push subscriptions cannot supply max pull waiting."); public static final NatsJetStreamClientError JsSubQueueDeliverGroupMismatch = new NatsJetStreamClientError(SUB, 90004, "Queue / deliver group mismatch."); public static final NatsJetStreamClientError JsSubFcHbNotValidPull = new NatsJetStreamClientError(SUB, 90005, "Flow Control and/or heartbeat is not valid with a pull subscription."); public static final NatsJetStreamClientError JsSubFcHbHbNotValidQueue = new NatsJetStreamClientError(SUB, 90006, "Flow Control and/or heartbeat is not valid in queue mode."); public static final NatsJetStreamClientError JsSubNoMatchingStreamForSubject = new NatsJetStreamClientError(SUB, 90007, "No matching streams for subject.", KIND_ILLEGAL_STATE); public static final NatsJetStreamClientError JsSubConsumerAlreadyConfiguredAsPush = new NatsJetStreamClientError(SUB, 90008, "Consumer is already configured as a push consumer."); public static final NatsJetStreamClientError JsSubConsumerAlreadyConfiguredAsPull = new NatsJetStreamClientError(SUB, 90009, "Consumer is already configured as a pull consumer."); public static final NatsJetStreamClientError JsSubSubjectDoesNotMatchFilter = new NatsJetStreamClientError(SUB, 90011, "Subject does not match consumer configuration filter."); public static final NatsJetStreamClientError JsSubConsumerAlreadyBound = new NatsJetStreamClientError(SUB, 90012, "Consumer is already bound to a subscription."); public static final NatsJetStreamClientError JsSubExistingConsumerNotQueue = new NatsJetStreamClientError(SUB, 90013, "Existing consumer is not configured as a queue / deliver group."); public static final NatsJetStreamClientError JsSubExistingConsumerIsQueue = new NatsJetStreamClientError(SUB, 90014, "Existing consumer is configured as a queue / deliver group."); public static final NatsJetStreamClientError JsSubExistingQueueDoesNotMatchRequestedQueue = new NatsJetStreamClientError(SUB, 90015, "Existing consumer deliver group does not match requested queue / deliver group."); public static final NatsJetStreamClientError JsSubExistingConsumerCannotBeModified = new NatsJetStreamClientError(SUB, 90016, "Existing consumer cannot be modified."); public static final NatsJetStreamClientError JsSubConsumerNotFoundRequiredInBind = new NatsJetStreamClientError(SUB, 90017, "Consumer not found, required in bind mode."); public static final NatsJetStreamClientError JsSubOrderedNotAllowOnQueues = new NatsJetStreamClientError(SUB, 90018, "Ordered consumer not allowed on queues."); public static final NatsJetStreamClientError JsSubPushCantHaveMaxBatch = new NatsJetStreamClientError(SUB, 90019, "Push subscriptions cannot supply max batch."); public static final NatsJetStreamClientError JsSoDurableMismatch = new NatsJetStreamClientError(SO, 90101, "Builder durable must match the consumer configuration durable if both are provided."); public static final NatsJetStreamClientError JsSoDeliverGroupMismatch = new NatsJetStreamClientError(SO, 90102, "Builder deliver group must match the consumer configuration deliver group if both are provided."); public static final NatsJetStreamClientError JsSoDeliverSubjectMismatch = new NatsJetStreamClientError(SO, 90103, "Builder deliver subject must match the consumer configuration deliver subject if both are provided."); public static final NatsJetStreamClientError JsSoOrderedNotAllowedWithBind = new NatsJetStreamClientError(SO, 90104, "Bind is not allowed with an ordered consumer."); public static final NatsJetStreamClientError JsSoOrderedNotAllowedWithDeliverGroup = new NatsJetStreamClientError(SO, 90105, "Deliver group is not allowed with an ordered consumer."); public static final NatsJetStreamClientError JsSoOrderedNotAllowedWithDurable = new NatsJetStreamClientError(SO, 90106, "Durable is not allowed with an ordered consumer."); public static final NatsJetStreamClientError JsSoOrderedNotAllowedWithDeliverSubject = new NatsJetStreamClientError(SO, 90107, "Deliver subject is not allowed with an ordered consumer."); public static final NatsJetStreamClientError JsSoOrderedRequiresAckPolicyNone = new NatsJetStreamClientError(SO, 90108, "Deliver subject is not allowed with an ordered consumer."); public static final NatsJetStreamClientError JsSoOrderedRequiresMaxDeliver = new NatsJetStreamClientError(SO, 90109, "Max deliver is limited to 1 with an ordered consumer."); private final String id; private final String message; private final int kind; public NatsJetStreamClientError(String group, int code, String description) { this(group, code, description, KIND_ILLEGAL_ARGUMENT); } public NatsJetStreamClientError(String group, int code, String description, int kind) { id = String.format("%s-%d", group, code); message = String.format("[%s] %s", id, description); this.kind = kind; } public RuntimeException instance() { return _instance(message); } public RuntimeException instance(String extraMessage) { return _instance(message + " " + extraMessage); } private RuntimeException _instance(String msg) { if (kind == KIND_ILLEGAL_ARGUMENT) { return new IllegalArgumentException(msg); } return new IllegalStateException(msg); } public String id() { return id; } public String message() { return message; } } <|start_filename|>src/test/java/io/nats/client/impl/JetStreamManagementTests.java<|end_filename|> // Copyright 2020 The NATS Authors // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at: // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package io.nats.client.impl; import io.nats.client.*; import io.nats.client.api.*; import org.junit.jupiter.api.Test; import java.io.IOException; import java.time.Duration; import java.time.ZonedDateTime; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import static org.junit.jupiter.api.Assertions.*; public class JetStreamManagementTests extends JetStreamTestBase { @Test public void testStreamCreate() throws Exception { runInJsServer(nc -> { long now = ZonedDateTime.now().toEpochSecond(); JetStreamManagement jsm = nc.jetStreamManagement(); StreamConfiguration sc = StreamConfiguration.builder() .name(STREAM) .storageType(StorageType.Memory) .subjects(subject(0), subject(1)) .build(); StreamInfo si = jsm.addStream(sc); assertTrue(now <= si.getCreateTime().toEpochSecond()); assertNotNull(si.getConfiguration()); sc = si.getConfiguration(); assertEquals(STREAM, sc.getName()); assertEquals(2, sc.getSubjects().size()); assertEquals(subject(0), sc.getSubjects().get(0)); assertEquals(subject(1), sc.getSubjects().get(1)); assertEquals(RetentionPolicy.Limits, sc.getRetentionPolicy()); assertEquals(DiscardPolicy.Old, sc.getDiscardPolicy()); assertEquals(StorageType.Memory, sc.getStorageType()); assertNotNull(si.getStreamState()); assertEquals(-1, sc.getMaxConsumers()); assertEquals(-1, sc.getMaxMsgs()); assertEquals(-1, sc.getMaxBytes()); assertEquals(-1, sc.getMaxMsgSize()); assertEquals(1, sc.getReplicas()); assertEquals(Duration.ZERO, sc.getMaxAge()); assertEquals(Duration.ofSeconds(120), sc.getDuplicateWindow()); assertFalse(sc.getNoAck()); assertNull(sc.getTemplateOwner()); StreamState ss = si.getStreamState(); assertEquals(0, ss.getMsgCount()); assertEquals(0, ss.getByteCount()); assertEquals(0, ss.getFirstSequence()); assertEquals(0, ss.getLastSequence()); assertEquals(0, ss.getConsumerCount()); }); } @Test public void testStreamCreateWithNoSubject() throws Exception { runInJsServer(nc -> { long now = ZonedDateTime.now().toEpochSecond(); JetStreamManagement jsm = nc.jetStreamManagement(); StreamConfiguration sc = StreamConfiguration.builder() .name(STREAM) .storageType(StorageType.Memory) .build(); StreamInfo si = jsm.addStream(sc); assertTrue(now <= si.getCreateTime().toEpochSecond()); sc = si.getConfiguration(); assertEquals(STREAM, sc.getName()); assertEquals(1, sc.getSubjects().size()); assertEquals(STREAM, sc.getSubjects().get(0)); assertEquals(RetentionPolicy.Limits, sc.getRetentionPolicy()); assertEquals(DiscardPolicy.Old, sc.getDiscardPolicy()); assertEquals(StorageType.Memory, sc.getStorageType()); assertNotNull(si.getConfiguration()); assertNotNull(si.getStreamState()); assertEquals(-1, sc.getMaxConsumers()); assertEquals(-1, sc.getMaxMsgs()); assertEquals(-1, sc.getMaxBytes()); assertEquals(-1, sc.getMaxMsgSize()); assertEquals(1, sc.getReplicas()); assertEquals(Duration.ZERO, sc.getMaxAge()); assertEquals(Duration.ofSeconds(120), sc.getDuplicateWindow()); assertFalse(sc.getNoAck()); assertNull(sc.getTemplateOwner()); StreamState ss = si.getStreamState(); assertEquals(0, ss.getMsgCount()); assertEquals(0, ss.getByteCount()); assertEquals(0, ss.getFirstSequence()); assertEquals(0, ss.getLastSequence()); assertEquals(0, ss.getConsumerCount()); }); } @Test public void testUpdateStream() throws Exception { runInJsServer(nc -> { JetStreamManagement jsm = nc.jetStreamManagement(); StreamInfo si = addTestStream(jsm); StreamConfiguration sc = si.getConfiguration(); assertNotNull(sc); assertEquals(STREAM, sc.getName()); assertNotNull(sc.getSubjects()); assertEquals(2, sc.getSubjects().size()); assertEquals(subject(0), sc.getSubjects().get(0)); assertEquals(subject(1), sc.getSubjects().get(1)); assertEquals(-1, sc.getMaxMsgs()); assertEquals(-1, sc.getMaxBytes()); assertEquals(-1, sc.getMaxMsgSize()); assertEquals(Duration.ZERO, sc.getMaxAge()); assertEquals(StorageType.Memory, sc.getStorageType()); assertEquals(DiscardPolicy.Old, sc.getDiscardPolicy()); assertEquals(1, sc.getReplicas()); assertFalse(sc.getNoAck()); assertEquals(Duration.ofMinutes(2), sc.getDuplicateWindow()); assertNull(sc.getTemplateOwner()); sc = StreamConfiguration.builder() .name(STREAM) .storageType(StorageType.Memory) .subjects(subject(0), subject(1), subject(2)) .maxMessages(42) .maxBytes(43) .maxMsgSize(44) .maxAge(Duration.ofDays(100)) .discardPolicy(DiscardPolicy.New) .noAck(true) .duplicateWindow(Duration.ofMinutes(3)) .build(); si = jsm.updateStream(sc); assertNotNull(si); sc = si.getConfiguration(); assertNotNull(sc); assertEquals(STREAM, sc.getName()); assertNotNull(sc.getSubjects()); assertEquals(3, sc.getSubjects().size()); assertEquals(subject(0), sc.getSubjects().get(0)); assertEquals(subject(1), sc.getSubjects().get(1)); assertEquals(subject(2), sc.getSubjects().get(2)); assertEquals(42, sc.getMaxMsgs()); assertEquals(43, sc.getMaxBytes()); assertEquals(44, sc.getMaxMsgSize()); assertEquals(Duration.ofDays(100), sc.getMaxAge()); assertEquals(StorageType.Memory, sc.getStorageType()); assertEquals(DiscardPolicy.New, sc.getDiscardPolicy()); assertEquals(1, sc.getReplicas()); assertTrue(sc.getNoAck()); assertEquals(Duration.ofMinutes(3), sc.getDuplicateWindow()); assertNull(sc.getTemplateOwner()); }); } @Test public void testAddUpdateStreamInvalids() throws Exception { runInJsServer(nc -> { JetStreamManagement jsm = nc.jetStreamManagement(); StreamConfiguration scNoName = StreamConfiguration.builder().build(); assertThrows(IllegalArgumentException.class, () -> jsm.addStream(null)); assertThrows(IllegalArgumentException.class, () -> jsm.addStream(scNoName)); assertThrows(IllegalArgumentException.class, () -> jsm.updateStream(null)); assertThrows(IllegalArgumentException.class, () -> jsm.updateStream(scNoName)); // cannot update non existent stream StreamConfiguration sc = getTestStreamConfiguration(); // stream not added yet assertThrows(JetStreamApiException.class, () -> jsm.updateStream(sc)); // add the stream jsm.addStream(sc); // cannot change MaxConsumers StreamConfiguration scMaxCon = getTestStreamConfigurationBuilder() .maxConsumers(2) .build(); assertThrows(JetStreamApiException.class, () -> jsm.updateStream(scMaxCon)); // cannot change RetentionPolicy StreamConfiguration scReten = getTestStreamConfigurationBuilder() .retentionPolicy(RetentionPolicy.Interest) .build(); assertThrows(JetStreamApiException.class, () -> jsm.updateStream(scReten)); }); } private static StreamInfo addTestStream(JetStreamManagement jsm) throws IOException, JetStreamApiException { StreamInfo si = jsm.addStream(getTestStreamConfiguration()); assertNotNull(si); return si; } private static StreamConfiguration getTestStreamConfiguration() { return getTestStreamConfigurationBuilder().build(); } private static StreamConfiguration.Builder getTestStreamConfigurationBuilder() { return StreamConfiguration.builder() .name(STREAM) .storageType(StorageType.Memory) .subjects(subject(0), subject(1)); } @Test public void testGetStreamInfo() throws Exception { runInJsServer(nc -> { JetStreamManagement jsm = nc.jetStreamManagement(); assertThrows(JetStreamApiException.class, () -> jsm.getStreamInfo(STREAM)); String[] subjects = new String[6]; for (int x = 0; x < 5; x++) { subjects[x] = subject(x); } subjects[5] = "foo.>"; createMemoryStream(jsm, STREAM, subjects); List<PublishAck> packs = new ArrayList<>(); JetStream js = nc.jetStream(); for (int x = 0; x < 5; x++) { jsPublish(js, subject(x), x + 1); PublishAck pa = jsPublish(js, subject(x), data(x + 2)); packs.add(pa); jsm.deleteMessage(STREAM, pa.getSeqno()); } jsPublish(js, "foo.bar", 6); StreamInfo si = jsm.getStreamInfo(STREAM); assertEquals(STREAM, si.getConfiguration().getName()); assertEquals(6, si.getStreamState().getSubjectCount()); assertNull(si.getStreamState().getSubjects()); assertEquals(5, si.getStreamState().getDeletedCount()); assertEquals(0, si.getStreamState().getDeleted().size()); si = jsm.getStreamInfo(STREAM, StreamInfoOptions.builder().allSubjects().deletedDetails().build()); assertEquals(STREAM, si.getConfiguration().getName()); assertEquals(6, si.getStreamState().getSubjectCount()); List<Subject> list = si.getStreamState().getSubjects(); assertNotNull(list); assertEquals(5, si.getStreamState().getDeletedCount()); assertEquals(5, si.getStreamState().getDeleted().size()); assertEquals(6, list.size()); Map<String, Subject> map = new HashMap<>(); for (Subject su : list) { map.put(su.getName(), su); } for (int x = 0; x < 5; x++) { Subject s = map.get(subject(x)); assertNotNull(s); assertEquals(x + 1, s.getCount()); } Subject s = map.get("foo.bar"); assertNotNull(s); assertEquals(6, s.getCount()); for (PublishAck pa : packs) { assertTrue(si.getStreamState().getDeleted().contains(pa.getSeqno())); } }); } @Test public void testDeleteStream() throws Exception { runInJsServer(nc -> { JetStreamManagement jsm = nc.jetStreamManagement(); JetStreamApiException jsapiEx = assertThrows(JetStreamApiException.class, () -> jsm.deleteStream(STREAM)); assertEquals(10059, jsapiEx.getApiErrorCode()); createDefaultTestStream(jsm); assertNotNull(jsm.getStreamInfo(STREAM)); assertTrue(jsm.deleteStream(STREAM)); jsapiEx = assertThrows(JetStreamApiException.class, () -> jsm.getStreamInfo(STREAM)); assertEquals(10059, jsapiEx.getApiErrorCode()); jsapiEx = assertThrows(JetStreamApiException.class, () -> jsm.deleteStream(STREAM)); assertEquals(10059, jsapiEx.getApiErrorCode()); }); } @Test public void testPurgeStreamAndOptions() throws Exception { runInJsServer(nc -> { // invalid to have both keep and seq assertThrows(IllegalArgumentException.class, () -> PurgeOptions.builder().keep(1).sequence(1).build()); JetStreamManagement jsm = nc.jetStreamManagement(); // error to purge a stream that does not exist assertThrows(JetStreamApiException.class, () -> jsm.purgeStream(STREAM)); createMemoryStream(jsm, STREAM, subject(1), subject(2)); StreamInfo si = jsm.getStreamInfo(STREAM); assertEquals(0, si.getStreamState().getMsgCount()); jsPublish(nc, subject(1), 10); si = jsm.getStreamInfo(STREAM); assertEquals(10, si.getStreamState().getMsgCount()); PurgeOptions options = PurgeOptions.builder().keep(7).build(); PurgeResponse pr = jsm.purgeStream(STREAM, options); assertTrue(pr.isSuccess()); assertEquals(3, pr.getPurged()); options = PurgeOptions.builder().sequence(9).build(); pr = jsm.purgeStream(STREAM, options); assertTrue(pr.isSuccess()); assertEquals(5, pr.getPurged()); si = jsm.getStreamInfo(STREAM); assertEquals(2, si.getStreamState().getMsgCount()); pr = jsm.purgeStream(STREAM); assertTrue(pr.isSuccess()); assertEquals(2, pr.getPurged()); si = jsm.getStreamInfo(STREAM); assertEquals(0, si.getStreamState().getMsgCount()); jsPublish(nc, subject(1), 10); jsPublish(nc, subject(2), 10); si = jsm.getStreamInfo(STREAM); assertEquals(20, si.getStreamState().getMsgCount()); jsm.purgeStream(STREAM, PurgeOptions.subject(subject(1))); si = jsm.getStreamInfo(STREAM); assertEquals(10, si.getStreamState().getMsgCount()); options = PurgeOptions.builder().subject(subject(1)).sequence(1).build(); assertEquals(subject(1), options.getSubject()); assertEquals(1, options.getSequence()); options = PurgeOptions.builder().subject(subject(1)).keep(2).build(); assertEquals(2, options.getKeep()); }); } @Test public void testAddDeleteConsumer() throws Exception { runInJsServer(nc -> { JetStreamManagement jsm = nc.jetStreamManagement(); createMemoryStream(jsm, STREAM, subject(0), subject(1)); List<ConsumerInfo> list = jsm.getConsumers(STREAM); assertEquals(0, list.size()); final ConsumerConfiguration cc = ConsumerConfiguration.builder().build(); IllegalArgumentException iae = assertThrows(IllegalArgumentException.class, () -> jsm.addOrUpdateConsumer(null, cc)); assertTrue(iae.getMessage().contains("Stream cannot be null or empty")); iae = assertThrows(IllegalArgumentException.class, () -> jsm.addOrUpdateConsumer(STREAM, null)); assertTrue(iae.getMessage().contains("Config cannot be null")); iae = assertThrows(IllegalArgumentException.class, () -> jsm.addOrUpdateConsumer(STREAM, cc)); assertTrue(iae.getMessage().contains("Durable cannot be null")); final ConsumerConfiguration cc0 = ConsumerConfiguration.builder() .durable(durable(0)) .build(); ConsumerInfo ci = jsm.addOrUpdateConsumer(STREAM, cc0); assertEquals(durable(0), ci.getName()); assertEquals(durable(0), ci.getConsumerConfiguration().getDurable()); assertNull(ci.getConsumerConfiguration().getDeliverSubject()); final ConsumerConfiguration cc1 = ConsumerConfiguration.builder() .durable(durable(1)) .deliverSubject(deliver(1)) .build(); ci = jsm.addOrUpdateConsumer(STREAM, cc1); assertEquals(durable(1), ci.getName()); assertEquals(durable(1), ci.getConsumerConfiguration().getDurable()); assertEquals(deliver(1), ci.getConsumerConfiguration().getDeliverSubject()); List<String> consumers = jsm.getConsumerNames(STREAM); assertEquals(2, consumers.size()); assertTrue(jsm.deleteConsumer(STREAM, cc1.getDurable())); consumers = jsm.getConsumerNames(STREAM); assertEquals(1, consumers.size()); assertThrows(JetStreamApiException.class, () -> jsm.deleteConsumer(STREAM, cc1.getDurable())); }); } @Test public void testValidConsumerUpdates() throws Exception { runInJsServer(nc -> { JetStreamManagement jsm = nc.jetStreamManagement(); createMemoryStream(jsm, STREAM, SUBJECT_GT); ConsumerConfiguration cc = prepForUpdateTest(jsm); cc = ConsumerConfiguration.builder(cc).deliverSubject(deliver(2)).build(); assertValidAddOrUpdate(jsm, cc); cc = prepForUpdateTest(jsm); cc = ConsumerConfiguration.builder(cc).ackWait(Duration.ofSeconds(5)).build(); assertValidAddOrUpdate(jsm, cc); cc = prepForUpdateTest(jsm); cc = ConsumerConfiguration.builder(cc).rateLimit(100).build(); assertValidAddOrUpdate(jsm, cc); cc = prepForUpdateTest(jsm); cc = ConsumerConfiguration.builder(cc).maxAckPending(100).build(); assertValidAddOrUpdate(jsm, cc); cc = prepForUpdateTest(jsm); cc = ConsumerConfiguration.builder(cc).maxDeliver(4).build(); assertValidAddOrUpdate(jsm, cc); }); } @Test public void testInvalidConsumerUpdates() throws Exception { runInJsServer(nc -> { JetStreamManagement jsm = nc.jetStreamManagement(); createMemoryStream(jsm, STREAM, SUBJECT_GT); ConsumerConfiguration cc = prepForUpdateTest(jsm); cc = ConsumerConfiguration.builder(cc).deliverPolicy(DeliverPolicy.New).build(); assertInvalidConsumerUpdate(jsm, cc); cc = prepForUpdateTest(jsm); cc = ConsumerConfiguration.builder(cc).filterSubject(SUBJECT_STAR).build(); assertInvalidConsumerUpdate(jsm, cc); cc = prepForUpdateTest(jsm); cc = ConsumerConfiguration.builder(cc).idleHeartbeat(Duration.ofMillis(111)).build(); assertInvalidConsumerUpdate(jsm, cc); }); } private ConsumerConfiguration prepForUpdateTest(JetStreamManagement jsm) throws IOException, JetStreamApiException { try { jsm.deleteConsumer(STREAM, durable(1)); } catch (Exception e) { /* ignore */ } ConsumerConfiguration cc = ConsumerConfiguration.builder() .durable(durable(1)) .ackPolicy(AckPolicy.Explicit) .deliverSubject(deliver(1)) .maxDeliver(3) .filterSubject(SUBJECT_GT) .build(); assertValidAddOrUpdate(jsm, cc); return cc; } private void assertInvalidConsumerUpdate(JetStreamManagement jsm, ConsumerConfiguration cc) { JetStreamApiException e = assertThrows(JetStreamApiException.class, () -> jsm.addOrUpdateConsumer(STREAM, cc)); assertEquals(10012, e.getApiErrorCode()); assertEquals(500, e.getErrorCode()); } private void assertValidAddOrUpdate(JetStreamManagement jsm, ConsumerConfiguration cc) throws IOException, JetStreamApiException { ConsumerInfo ci = jsm.addOrUpdateConsumer(STREAM, cc); ConsumerConfiguration cicc = ci.getConsumerConfiguration(); assertEquals(cc.getDurable(), ci.getName()); assertEquals(cc.getDurable(), cicc.getDurable()); assertEquals(cc.getDeliverSubject(), cicc.getDeliverSubject()); assertEquals(cc.getMaxDeliver(), cicc.getMaxDeliver()); assertEquals(cc.getDeliverPolicy(), cicc.getDeliverPolicy()); List<String> consumers = jsm.getConsumerNames(STREAM); assertEquals(1, consumers.size()); assertEquals(cc.getDurable(), consumers.get(0)); } @Test public void testCreateConsumersWithFilters() throws Exception { runInJsServer(nc -> { JetStreamManagement jsm = nc.jetStreamManagement(); createDefaultTestStream(jsm); // plain subject ConsumerConfiguration.Builder builder = ConsumerConfiguration.builder().durable(DURABLE); jsm.addOrUpdateConsumer(STREAM, builder.filterSubject(SUBJECT).build()); assertThrows(JetStreamApiException.class, () -> jsm.addOrUpdateConsumer(STREAM, builder.filterSubject(subjectDot("not-match")).build())); // wildcard subject jsm.deleteStream(STREAM); createMemoryStream(jsm, STREAM, SUBJECT_STAR); jsm.addOrUpdateConsumer(STREAM, builder.filterSubject(subjectDot("A")).build()); assertThrows(JetStreamApiException.class, () -> jsm.addOrUpdateConsumer(STREAM, builder.filterSubject(subjectDot("not-match")).build())); // gt subject jsm.deleteStream(STREAM); createMemoryStream(jsm, STREAM, SUBJECT_GT); jsm.addOrUpdateConsumer(STREAM, builder.filterSubject(subjectDot("A")).build()); assertThrows(JetStreamApiException.class, () -> jsm.addOrUpdateConsumer(STREAM, builder.filterSubject(subjectDot("not-match")).build())); // try to filter against durable with mismatch, pull JetStream js = nc.jetStream(); jsm.addOrUpdateConsumer(STREAM, ConsumerConfiguration.builder() .durable(durable(42)) .filterSubject(subjectDot("F")) .build() ); }); } @Test public void testGetConsumerInfo() throws Exception { runInJsServer(nc -> { JetStreamManagement jsm = nc.jetStreamManagement(); createDefaultTestStream(jsm); assertThrows(JetStreamApiException.class, () -> jsm.getConsumerInfo(STREAM, DURABLE)); ConsumerConfiguration cc = ConsumerConfiguration.builder().durable(DURABLE).build(); ConsumerInfo ci = jsm.addOrUpdateConsumer(STREAM, cc); assertEquals(STREAM, ci.getStreamName()); assertEquals(DURABLE, ci.getName()); ci = jsm.getConsumerInfo(STREAM, DURABLE); assertEquals(STREAM, ci.getStreamName()); assertEquals(DURABLE, ci.getName()); assertThrows(JetStreamApiException.class, () -> jsm.getConsumerInfo(STREAM, durable(999))); }); } @Test public void testGetConsumers() throws Exception { runInJsServer(nc -> { JetStreamManagement jsm = nc.jetStreamManagement(); createMemoryStream(jsm, STREAM, subject(0), subject(1)); addConsumers(jsm, STREAM, 600, "A", null); // getConsumers pages at 256 List<ConsumerInfo> list = jsm.getConsumers(STREAM); assertEquals(600, list.size()); addConsumers(jsm, STREAM, 500, "B", null); // getConsumerNames pages at 1024 List<String> names = jsm.getConsumerNames(STREAM); assertEquals(1100, names.size()); }); } private void addConsumers(JetStreamManagement jsm, String stream, int count, String durableVary, String filterSubject) throws IOException, JetStreamApiException { for (int x = 1; x <= count; x++) { String dur = durable(durableVary, x); ConsumerConfiguration cc = ConsumerConfiguration.builder() .durable(dur) .filterSubject(filterSubject) .build(); ConsumerInfo ci = jsm.addOrUpdateConsumer(stream, cc); assertEquals(dur, ci.getName()); assertEquals(dur, ci.getConsumerConfiguration().getDurable()); assertNull(ci.getConsumerConfiguration().getDeliverSubject()); } } @Test public void testGetStreams() throws Exception { runInJsServer(nc -> { JetStreamManagement jsm = nc.jetStreamManagement(); addStreams(jsm, 600, 0); // getStreams pages at 256 List<StreamInfo> list = jsm.getStreams(); assertEquals(600, list.size()); addStreams(jsm, 500, 600); // getStreamNames pages at 1024 List<String> names = jsm.getStreamNames(); assertEquals(1100, names.size()); }); } private void addStreams(JetStreamManagement jsm, int count, int adj) throws IOException, JetStreamApiException { for (int x = 0; x < count; x++) { createMemoryStream(jsm, stream(x + adj), subject(x + adj)); } } @Test public void testGetAndDeleteMessage() throws Exception { runInJsServer(nc -> { createDefaultTestStream(nc); JetStream js = nc.jetStream(); Headers h = new Headers(); h.add("foo", "bar"); ZonedDateTime beforeCreated = ZonedDateTime.now(); js.publish(NatsMessage.builder().subject(SUBJECT).headers(h).data(dataBytes(1)).build()); js.publish(NatsMessage.builder().subject(SUBJECT).build()); JetStreamManagement jsm = nc.jetStreamManagement(); MessageInfo mi = jsm.getMessage(STREAM, 1); assertNotNull(mi.toString()); assertEquals(SUBJECT, mi.getSubject()); assertEquals(data(1), new String(mi.getData())); assertEquals(1, mi.getSeq()); assertTrue(mi.getTime().toEpochSecond() >= beforeCreated.toEpochSecond()); assertNotNull(mi.getHeaders()); assertEquals("bar", mi.getHeaders().get("foo").get(0)); mi = jsm.getMessage(STREAM, 2); assertNotNull(mi.toString()); assertEquals(SUBJECT, mi.getSubject()); assertNull(mi.getData()); assertEquals(2, mi.getSeq()); assertTrue(mi.getTime().toEpochSecond() >= beforeCreated.toEpochSecond()); assertNull(mi.getHeaders()); assertTrue(jsm.deleteMessage(STREAM, 1)); assertThrows(JetStreamApiException.class, () -> jsm.deleteMessage(STREAM, 1)); assertThrows(JetStreamApiException.class, () -> jsm.getMessage(STREAM, 1)); assertThrows(JetStreamApiException.class, () -> jsm.getMessage(STREAM, 3)); assertThrows(JetStreamApiException.class, () -> jsm.deleteMessage(stream(999), 1)); assertThrows(JetStreamApiException.class, () -> jsm.getMessage(stream(999), 1)); }); } @Test public void testAuthCreateUpdateStream() throws Exception { try (NatsTestServer ts = new NatsTestServer("src/test/resources/js_authorization.conf", false)) { Options optionsSrc = new Options.Builder().server(ts.getURI()) .userInfo("serviceup".toCharArray(), "uppass".toCharArray()).build(); try (Connection nc = Nats.connect(optionsSrc)) { JetStreamManagement jsm = nc.jetStreamManagement(); // add streams with both account StreamConfiguration sc = StreamConfiguration.builder() .name(STREAM) .storageType(StorageType.Memory) .subjects(subject(1)) .build(); StreamInfo si = jsm.addStream(sc); sc = StreamConfiguration.builder(si.getConfiguration()) .addSubjects(subject(2)) .build(); jsm.updateStream(sc); } } } @Test public void testSealed() throws Exception { runInJsServer(nc -> { JetStreamManagement jsm = nc.jetStreamManagement(); StreamInfo si = createMemoryStream(jsm, STREAM, SUBJECT); assertFalse(si.getConfiguration().getSealed()); StreamConfiguration sc = new StreamConfiguration.Builder(si.getConfiguration()) { @Override public StreamConfiguration build() { sealed(true); return super.build(); } }.build(); si = jsm.updateStream(sc); assertTrue(si.getConfiguration().getSealed()); }); } } <|start_filename|>src/test/java/io/nats/client/impl/JetStreamGeneralTests.java<|end_filename|> // Copyright 2020 The NATS Authors // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at: // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package io.nats.client.impl; import io.nats.client.*; import io.nats.client.api.*; import io.nats.client.support.RandomUtils; import org.junit.jupiter.api.Test; import java.io.IOException; import java.time.Duration; import java.time.ZonedDateTime; import java.util.List; import java.util.concurrent.TimeoutException; import static io.nats.client.api.ConsumerConfiguration.*; import static io.nats.client.support.NatsConstants.EMPTY; import static io.nats.client.support.NatsJetStreamClientError.*; import static org.junit.jupiter.api.Assertions.*; public class JetStreamGeneralTests extends JetStreamTestBase { @Test public void testJetStreamContextCreate() throws Exception { runInJsServer(nc -> { createDefaultTestStream(nc); // tries management functions nc.jetStreamManagement().getAccountStatistics(); // another management nc.jetStream().publish(SUBJECT, dataBytes(1)); }); } @Test public void testJetNotEnabled() throws Exception { runInServer(nc -> { // get normal context, try to do an operation JetStream js = nc.jetStream(); assertThrows(IOException.class, () -> js.subscribe(SUBJECT)); // get management context, try to do an operation JetStreamManagement jsm = nc.jetStreamManagement(); assertThrows(IOException.class, jsm::getAccountStatistics); }); } @Test public void testJetEnabledGoodAccount() throws Exception { try (NatsTestServer ts = new NatsTestServer("src/test/resources/js_authorization.conf", false, true)) { Options options = new Options.Builder().server(ts.getURI()) .userInfo("serviceup".toCharArray(), "uppass".toCharArray()).build(); Connection nc = standardConnection(options); nc.jetStreamManagement(); nc.jetStream(); } } @Test public void testJetStreamPublishDefaultOptions() throws Exception { runInJsServer(nc -> { createDefaultTestStream(nc); JetStream js = nc.jetStream(); PublishAck ack = jsPublish(js); assertEquals(1, ack.getSeqno()); }); } @Test public void testConnectionClosing() throws Exception { runInJsServer(nc -> { nc.close(); assertThrows(IOException.class, nc::jetStream); assertThrows(IOException.class, nc::jetStreamManagement); }); } @Test public void testCreateWithOptionsForCoverage() throws Exception { runInJsServer(nc -> { JetStreamOptions jso = JetStreamOptions.builder().build(); nc.jetStream(jso); nc.jetStreamManagement(jso); }); } @Test public void testMiscMetaDataCoverage() { Message jsMsg = getTestJsMessage(); assertTrue(jsMsg.isJetStream()); // two calls to msg.metaData are for coverage to test lazy initializer assertNotNull(jsMsg.metaData()); // this call takes a different path assertNotNull(jsMsg.metaData()); // this call shows that the lazy will work } @Test public void testJetStreamSubscribe() throws Exception { runInJsServer(nc -> { JetStream js = nc.jetStream(); JetStreamManagement jsm = nc.jetStreamManagement(); createDefaultTestStream(jsm); jsPublish(js); // default ephemeral subscription. Subscription s = js.subscribe(SUBJECT); Message m = s.nextMessage(DEFAULT_TIMEOUT); assertNotNull(m); assertEquals(DATA, new String(m.getData())); List<String> names = jsm.getConsumerNames(STREAM); assertEquals(1, names.size()); // default subscribe options // ephemeral subscription. s = js.subscribe(SUBJECT, PushSubscribeOptions.builder().build()); m = s.nextMessage(DEFAULT_TIMEOUT); assertNotNull(m); assertEquals(DATA, new String(m.getData())); names = jsm.getConsumerNames(STREAM); assertEquals(2, names.size()); // set the stream PushSubscribeOptions pso = PushSubscribeOptions.builder().stream(STREAM).durable(DURABLE).build(); s = js.subscribe(SUBJECT, pso); m = s.nextMessage(DEFAULT_TIMEOUT); assertNotNull(m); assertEquals(DATA, new String(m.getData())); names = jsm.getConsumerNames(STREAM); assertEquals(3, names.size()); // coverage Dispatcher dispatcher = nc.createDispatcher(); js.subscribe(SUBJECT); js.subscribe(SUBJECT, (PushSubscribeOptions)null); js.subscribe(SUBJECT, QUEUE, null); js.subscribe(SUBJECT, dispatcher, mh -> {}, false); js.subscribe(SUBJECT, dispatcher, mh -> {}, false, null); js.subscribe(SUBJECT, QUEUE, dispatcher, mh -> {}, false, null); // bind with w/o subject jsm.addOrUpdateConsumer(STREAM, builder() .durable(durable(101)) .deliverSubject(deliver(101)) .build()); PushSubscribeOptions psoBind = PushSubscribeOptions.bind(STREAM, durable(101)); unsubscribeEnsureNotBound(js.subscribe(null, psoBind)); unsubscribeEnsureNotBound(js.subscribe("", psoBind)); JetStreamSubscription sub = js.subscribe(null, dispatcher, mh -> {}, false, psoBind); unsubscribeEnsureNotBound(dispatcher, sub); js.subscribe("", dispatcher, mh -> {}, false, psoBind); jsm.addOrUpdateConsumer(STREAM, builder() .durable(durable(102)) .deliverSubject(deliver(102)) .deliverGroup(queue(102)) .build()); psoBind = PushSubscribeOptions.bind(STREAM, durable(102)); unsubscribeEnsureNotBound(js.subscribe(null, queue(102), psoBind)); unsubscribeEnsureNotBound(js.subscribe("", queue(102), psoBind)); sub = js.subscribe(null, queue(102), dispatcher, mh -> {}, false, psoBind); unsubscribeEnsureNotBound(dispatcher, sub); js.subscribe("", queue(102), dispatcher, mh -> {}, false, psoBind); }); } @Test public void testJetStreamSubscribeErrors() throws Exception { runInJsServer(nc -> { JetStream js = nc.jetStream(); // stream not found PushSubscribeOptions psoInvalidStream = PushSubscribeOptions.builder().stream(STREAM).build(); assertThrows(JetStreamApiException.class, () -> js.subscribe(SUBJECT, psoInvalidStream)); // subject IllegalArgumentException iae = assertThrows(IllegalArgumentException.class, () -> js.subscribe(null)); assertTrue(iae.getMessage().startsWith("Subject")); iae = assertThrows(IllegalArgumentException.class, () -> js.subscribe(HAS_SPACE)); assertTrue(iae.getMessage().startsWith("Subject")); iae = assertThrows(IllegalArgumentException.class, () -> js.subscribe(null, (PushSubscribeOptions)null)); assertTrue(iae.getMessage().startsWith("Subject")); // queue iae = assertThrows(IllegalArgumentException.class, () -> js.subscribe(SUBJECT, HAS_SPACE, null)); assertTrue(iae.getMessage().startsWith("Queue")); iae = assertThrows(IllegalArgumentException.class, () -> js.subscribe(SUBJECT, HAS_SPACE, null, null, false, null)); assertTrue(iae.getMessage().startsWith("Queue")); // dispatcher iae = assertThrows(IllegalArgumentException.class, () -> js.subscribe(SUBJECT, null, null, false)); assertTrue(iae.getMessage().startsWith("Dispatcher")); iae = assertThrows(IllegalArgumentException.class, () -> js.subscribe(SUBJECT, null, null, false, null)); assertTrue(iae.getMessage().startsWith("Dispatcher")); iae = assertThrows(IllegalArgumentException.class, () -> js.subscribe(SUBJECT, QUEUE, null, null, false, null)); assertTrue(iae.getMessage().startsWith("Dispatcher")); // handler Dispatcher dispatcher = nc.createDispatcher(); iae = assertThrows(IllegalArgumentException.class, () -> js.subscribe(SUBJECT, dispatcher, null, false)); assertTrue(iae.getMessage().startsWith("Handler")); iae = assertThrows(IllegalArgumentException.class, () -> js.subscribe(SUBJECT, dispatcher, null, false, null)); assertTrue(iae.getMessage().startsWith("Handler")); iae = assertThrows(IllegalArgumentException.class, () -> js.subscribe(SUBJECT, QUEUE, dispatcher, null, false, null)); assertTrue(iae.getMessage().startsWith("Handler")); }); } @Test public void testFilterSubjectEphemeral() throws Exception { runInJsServer(nc -> { // Create our JetStream context. JetStream js = nc.jetStream(); String subjectWild = SUBJECT + ".*"; String subjectA = SUBJECT + ".A"; String subjectB = SUBJECT + ".B"; // create the stream. createMemoryStream(nc, STREAM, subjectWild); jsPublish(js, subjectA, 1); jsPublish(js, subjectB, 1); jsPublish(js, subjectA, 1); jsPublish(js, subjectB, 1); // subscribe to the wildcard ConsumerConfiguration cc = builder().ackPolicy(AckPolicy.None).build(); PushSubscribeOptions pso = PushSubscribeOptions.builder().configuration(cc).build(); JetStreamSubscription sub = js.subscribe(subjectWild, pso); nc.flush(Duration.ofSeconds(1)); Message m = sub.nextMessage(Duration.ofSeconds(1)); assertEquals(subjectA, m.getSubject()); assertEquals(1, m.metaData().streamSequence()); m = sub.nextMessage(Duration.ofSeconds(1)); assertEquals(subjectB, m.getSubject()); assertEquals(2, m.metaData().streamSequence()); m = sub.nextMessage(Duration.ofSeconds(1)); assertEquals(subjectA, m.getSubject()); assertEquals(3, m.metaData().streamSequence()); m = sub.nextMessage(Duration.ofSeconds(1)); assertEquals(subjectB, m.getSubject()); assertEquals(4, m.metaData().streamSequence()); // subscribe to A cc = builder().filterSubject(subjectA).ackPolicy(AckPolicy.None).build(); pso = PushSubscribeOptions.builder().configuration(cc).build(); sub = js.subscribe(subjectWild, pso); nc.flush(Duration.ofSeconds(1)); m = sub.nextMessage(Duration.ofSeconds(1)); assertEquals(subjectA, m.getSubject()); assertEquals(1, m.metaData().streamSequence()); m = sub.nextMessage(Duration.ofSeconds(1)); assertEquals(subjectA, m.getSubject()); assertEquals(3, m.metaData().streamSequence()); m = sub.nextMessage(Duration.ofSeconds(1)); assertNull(m); // subscribe to B cc = builder().filterSubject(subjectB).ackPolicy(AckPolicy.None).build(); pso = PushSubscribeOptions.builder().configuration(cc).build(); sub = js.subscribe(subjectWild, pso); nc.flush(Duration.ofSeconds(1)); m = sub.nextMessage(Duration.ofSeconds(1)); assertEquals(subjectB, m.getSubject()); assertEquals(2, m.metaData().streamSequence()); m = sub.nextMessage(Duration.ofSeconds(1)); assertEquals(subjectB, m.getSubject()); assertEquals(4, m.metaData().streamSequence()); m = sub.nextMessage(Duration.ofSeconds(1)); assertNull(m); }); } @Test public void testPrefix() throws Exception { String prefix = "tar.api"; String streamMadeBySrc = "stream-made-by-src"; String streamMadeByTar = "stream-made-by-tar"; String subjectMadeBySrc = "sub-made-by.src"; String subjectMadeByTar = "sub-made-by.tar"; try (NatsTestServer ts = new NatsTestServer("src/test/resources/js_prefix.conf", false)) { Options optionsSrc = new Options.Builder().server(ts.getURI()) .userInfo("src".toCharArray(), "spass".toCharArray()).build(); Options optionsTar = new Options.Builder().server(ts.getURI()) .userInfo("tar".toCharArray(), "tpass".toCharArray()).build(); try (Connection ncSrc = Nats.connect(optionsSrc); Connection ncTar = Nats.connect(optionsTar) ) { // Setup JetStreamOptions. SOURCE does not need prefix JetStreamOptions jsoSrc = JetStreamOptions.builder().build(); JetStreamOptions jsoTar = JetStreamOptions.builder().prefix(prefix).build(); // Management api allows us to create streams JetStreamManagement jsmSrc = ncSrc.jetStreamManagement(jsoSrc); JetStreamManagement jsmTar = ncTar.jetStreamManagement(jsoTar); // add streams with both account StreamConfiguration scSrc = StreamConfiguration.builder() .name(streamMadeBySrc) .storageType(StorageType.Memory) .subjects(subjectMadeBySrc) .build(); jsmSrc.addStream(scSrc); StreamConfiguration scTar = StreamConfiguration.builder() .name(streamMadeByTar) .storageType(StorageType.Memory) .subjects(subjectMadeByTar) .build(); jsmTar.addStream(scTar); JetStream jsSrc = ncSrc.jetStream(jsoSrc); JetStream jsTar = ncTar.jetStream(jsoTar); jsSrc.publish(subjectMadeBySrc, "src-src".getBytes()); jsSrc.publish(subjectMadeByTar, "src-tar".getBytes()); jsTar.publish(subjectMadeBySrc, "tar-src".getBytes()); jsTar.publish(subjectMadeByTar, "tar-tar".getBytes()); // subscribe and read messages readPrefixMessages(ncSrc, jsSrc, subjectMadeBySrc, "src"); readPrefixMessages(ncSrc, jsSrc, subjectMadeByTar, "tar"); readPrefixMessages(ncTar, jsTar, subjectMadeBySrc, "src"); readPrefixMessages(ncTar, jsTar, subjectMadeByTar, "tar"); } } } private void readPrefixMessages(Connection nc, JetStream js, String subject, String dest) throws InterruptedException, IOException, JetStreamApiException, TimeoutException { JetStreamSubscription sub = js.subscribe(subject); nc.flush(Duration.ofSeconds(1)); List<Message> msgs = readMessagesAck(sub); assertEquals(2, msgs.size()); assertEquals(subject, msgs.get(0).getSubject()); assertEquals(subject, msgs.get(1).getSubject()); assertEquals("src-" + dest, new String(msgs.get(0).getData())); assertEquals("tar-" + dest, new String(msgs.get(1).getData())); } @Test public void testBindPush() throws Exception { runInJsServer(nc -> { createDefaultTestStream(nc); JetStream js = nc.jetStream(); jsPublish(js, SUBJECT, 1, 1); PushSubscribeOptions pso = PushSubscribeOptions.builder() .durable(DURABLE) .build(); JetStreamSubscription s = js.subscribe(SUBJECT, pso); Message m = s.nextMessage(DEFAULT_TIMEOUT); assertNotNull(m); assertEquals(data(1), new String(m.getData())); m.ack(); unsubscribeEnsureNotBound(s); jsPublish(js, SUBJECT, 2, 1); pso = PushSubscribeOptions.builder() .stream(STREAM) .durable(DURABLE) .bind(true) .build(); s = js.subscribe(SUBJECT, pso); m = s.nextMessage(DEFAULT_TIMEOUT); assertNotNull(m); assertEquals(data(2), new String(m.getData())); m.ack(); unsubscribeEnsureNotBound(s); jsPublish(js, SUBJECT, 3, 1); pso = PushSubscribeOptions.bind(STREAM, DURABLE); s = js.subscribe(SUBJECT, pso); m = s.nextMessage(DEFAULT_TIMEOUT); assertNotNull(m); assertEquals(data(3), new String(m.getData())); assertThrows(IllegalArgumentException.class, () -> PushSubscribeOptions.builder().stream(STREAM).bind(true).build()); assertThrows(IllegalArgumentException.class, () -> PushSubscribeOptions.builder().durable(DURABLE).bind(true).build()); assertThrows(IllegalArgumentException.class, () -> PushSubscribeOptions.builder().stream(EMPTY).bind(true).build()); assertThrows(IllegalArgumentException.class, () -> PushSubscribeOptions.builder().stream(STREAM).durable(EMPTY).bind(true).build()); }); } @Test public void testBindPull() throws Exception { runInJsServer(nc -> { createDefaultTestStream(nc); JetStream js = nc.jetStream(); jsPublish(js, SUBJECT, 1, 1); PullSubscribeOptions pso = PullSubscribeOptions.builder() .durable(DURABLE) .build(); JetStreamSubscription s = js.subscribe(SUBJECT, pso); s.pull(1); Message m = s.nextMessage(DEFAULT_TIMEOUT); assertNotNull(m); assertEquals(data(1), new String(m.getData())); m.ack(); unsubscribeEnsureNotBound(s); jsPublish(js, SUBJECT, 2, 1); pso = PullSubscribeOptions.builder() .stream(STREAM) .durable(DURABLE) .bind(true) .build(); s = js.subscribe(SUBJECT, pso); s.pull(1); m = s.nextMessage(DEFAULT_TIMEOUT); assertNotNull(m); assertEquals(data(2), new String(m.getData())); m.ack(); unsubscribeEnsureNotBound(s); jsPublish(js, SUBJECT, 3, 1); pso = PullSubscribeOptions.bind(STREAM, DURABLE); s = js.subscribe(SUBJECT, pso); s.pull(1); m = s.nextMessage(DEFAULT_TIMEOUT); assertNotNull(m); assertEquals(data(3), new String(m.getData())); }); } @Test public void testBindErrors() throws Exception { runInJsServer(nc -> { JetStream js = nc.jetStream(); createDefaultTestStream(nc); // bind errors PushSubscribeOptions pushbinderr = PushSubscribeOptions.bind(STREAM, "binddur"); IllegalArgumentException iae = assertThrows(IllegalArgumentException.class, () -> js.subscribe(SUBJECT, pushbinderr)); assertTrue(iae.getMessage().contains(JsSubConsumerNotFoundRequiredInBind.id())); PullSubscribeOptions pullbinderr = PullSubscribeOptions.bind(STREAM, "binddur"); iae = assertThrows(IllegalArgumentException.class, () -> js.subscribe(SUBJECT, pullbinderr)); assertTrue(iae.getMessage().contains(JsSubConsumerNotFoundRequiredInBind.id())); }); } @Test public void testFilterMismatchErrors() throws Exception { runInJsServer(nc -> { JetStreamManagement jsm = nc.jetStreamManagement(); JetStream js = nc.jetStream(); // single subject createMemoryStream(jsm, STREAM, SUBJECT); // will work as SubscribeSubject equals Filter Subject subscribeOk(js, jsm, SUBJECT, SUBJECT); subscribeOk(js, jsm, ">", ">"); subscribeOk(js, jsm, "*", "*"); // will work as SubscribeSubject != empty Filter Subject, // b/c Stream has exactly 1 subject and is a match. subscribeOk(js, jsm, "", SUBJECT); // will work as SubscribeSubject != Filter Subject of '>' // b/c Stream has exactly 1 subject and is a match. subscribeOk(js, jsm, ">", SUBJECT); // will not work subscribeEx(js, jsm, "*", SUBJECT); // multiple subjects no wildcards jsm.deleteStream(STREAM); createMemoryStream(jsm, STREAM, SUBJECT, subject(2)); // will work as SubscribeSubject equals Filter Subject subscribeOk(js, jsm, SUBJECT, SUBJECT); subscribeOk(js, jsm, ">", ">"); subscribeOk(js, jsm, "*", "*"); // will not work because stream has more than 1 subject subscribeEx(js, jsm, "", SUBJECT); subscribeEx(js, jsm, ">", SUBJECT); subscribeEx(js, jsm, "*", SUBJECT); // multiple subjects via '>' jsm.deleteStream(STREAM); createMemoryStream(jsm, STREAM, SUBJECT_GT); // will work, exact matches subscribeOk(js, jsm, subjectDot("1"), subjectDot("1")); subscribeOk(js, jsm, ">", ">"); // will not work because mismatch / stream has more than 1 subject subscribeEx(js, jsm, "", subjectDot("1")); subscribeEx(js, jsm, ">", subjectDot("1")); subscribeEx(js, jsm, SUBJECT_GT, subjectDot("1")); // multiple subjects via '*' jsm.deleteStream(STREAM); createMemoryStream(jsm, STREAM, SUBJECT_STAR); // will work, exact matches subscribeOk(js, jsm, subjectDot("1"), subjectDot("1")); subscribeOk(js, jsm, ">", ">"); // will not work because mismatch / stream has more than 1 subject subscribeEx(js, jsm, "", subjectDot("1")); subscribeEx(js, jsm, ">", subjectDot("1")); subscribeEx(js, jsm, SUBJECT_STAR, subjectDot("1")); }); } private void subscribeOk(JetStream js, JetStreamManagement jsm, String fs, String ss) throws IOException, JetStreamApiException { int i = RandomUtils.PRAND.nextInt(); // just want a unique number setupConsumer(jsm, i, fs); unsubscribeEnsureNotBound(js.subscribe(ss, builder().durable(durable(i)).buildPushSubscribeOptions())); } private void subscribeEx(JetStream js, JetStreamManagement jsm, String fs, String ss) throws IOException, JetStreamApiException { int i = RandomUtils.PRAND.nextInt(); // just want a unique number setupConsumer(jsm, i, fs); IllegalArgumentException iae = assertThrows(IllegalArgumentException.class, () -> js.subscribe(ss, builder().durable(durable(i)).buildPushSubscribeOptions())); assertTrue(iae.getMessage().contains(JsSubSubjectDoesNotMatchFilter.id())); } private void setupConsumer(JetStreamManagement jsm, int i, String fs) throws IOException, JetStreamApiException { jsm.addOrUpdateConsumer(STREAM, builder().deliverSubject(deliver(i)).durable(durable(i)).filterSubject(fs).build()); } @Test public void testBindDurableDeliverSubject() throws Exception { runInJsServer(nc -> { JetStreamManagement jsm = nc.jetStreamManagement(); JetStream js = nc.jetStream(); // create the stream. createDefaultTestStream(jsm); // create a durable push subscriber - has deliver subject ConsumerConfiguration ccDurPush = builder() .durable(durable(1)) .deliverSubject(deliver(1)) .build(); jsm.addOrUpdateConsumer(STREAM, ccDurPush); // create a durable pull subscriber - notice no deliver subject ConsumerConfiguration ccDurPull = builder() .durable(durable(2)) .build(); jsm.addOrUpdateConsumer(STREAM, ccDurPull); // try to pull subscribe against a push durable IllegalArgumentException iae = assertThrows(IllegalArgumentException.class, () -> js.subscribe(SUBJECT, PullSubscribeOptions.builder().durable(durable(1)).build()) ); assertTrue(iae.getMessage().contains(JsSubConsumerAlreadyConfiguredAsPush.id())); // try to pull bind against a push durable iae = assertThrows(IllegalArgumentException.class, () -> js.subscribe(SUBJECT, PullSubscribeOptions.bind(STREAM, durable(1))) ); assertTrue(iae.getMessage().contains(JsSubConsumerAlreadyConfiguredAsPush.id())); // this one is okay JetStreamSubscription sub = js.subscribe(SUBJECT, PullSubscribeOptions.builder().durable(durable(2)).build()); unsubscribeEnsureNotBound(sub); // so I can re-use the durable // try to push subscribe against a pull durable iae = assertThrows(IllegalArgumentException.class, () -> js.subscribe(SUBJECT, PushSubscribeOptions.builder().durable(durable(2)).build()) ); assertTrue(iae.getMessage().contains(JsSubConsumerAlreadyConfiguredAsPull.id())); // try to push bind against a pull durable iae = assertThrows(IllegalArgumentException.class, () -> js.subscribe(SUBJECT, PushSubscribeOptions.bind(STREAM, durable(2))) ); assertTrue(iae.getMessage().contains(JsSubConsumerAlreadyConfiguredAsPull.id())); // this one is okay js.subscribe(SUBJECT, PushSubscribeOptions.builder().durable(durable(1)).build()); }); } @Test public void testConsumerIsNotModified() throws Exception { runInJsServer(nc -> { JetStream js = nc.jetStream(); JetStreamManagement jsm = nc.jetStreamManagement(); createDefaultTestStream(jsm); // test with config in issue 105 ConsumerConfiguration cc = builder() .description("desc") .ackPolicy(AckPolicy.Explicit) .deliverPolicy(DeliverPolicy.All) .deliverSubject(deliver(1)) .deliverGroup(queue(1)) .durable(durable(1)) .maxAckPending(65000) .maxDeliver(5) .maxBatch(10) .replayPolicy(ReplayPolicy.Instant) .build(); jsm.addOrUpdateConsumer(STREAM, cc); PushSubscribeOptions pushOpts = PushSubscribeOptions.bind(STREAM, durable(1)); js.subscribe(SUBJECT, queue(1), pushOpts); // should not throw an error // testing numerics cc = builder() .deliverPolicy(DeliverPolicy.ByStartSequence) .deliverSubject(deliver(21)) .durable(durable(21)) .startSequence(42) .maxDeliver(43) .maxBatch(47) .rateLimit(44) .maxAckPending(45) .build(); jsm.addOrUpdateConsumer(STREAM, cc); pushOpts = PushSubscribeOptions.bind(STREAM, durable(21)); js.subscribe(SUBJECT, pushOpts); // should not throw an error cc = builder() .durable(durable(22)) .maxPullWaiting(46) .build(); jsm.addOrUpdateConsumer(STREAM, cc); PullSubscribeOptions pullOpts = PullSubscribeOptions.bind(STREAM, durable(22)); js.subscribe(SUBJECT, pullOpts); // should not throw an error // testing DateTime cc = builder() .deliverPolicy(DeliverPolicy.ByStartTime) .deliverSubject(deliver(3)) .durable(durable(3)) .startTime(ZonedDateTime.now().plusHours(1)) .build(); jsm.addOrUpdateConsumer(STREAM, cc); pushOpts = PushSubscribeOptions.bind(STREAM, durable(3)); js.subscribe(SUBJECT, pushOpts); // should not throw an error // testing boolean and duration cc = builder() .deliverSubject(deliver(4)) .durable(durable(4)) .flowControl(1000) .headersOnly(true) .maxExpires(30000) .inactiveThreshold(40000) .ackWait(2000) .build(); jsm.addOrUpdateConsumer(STREAM, cc); pushOpts = PushSubscribeOptions.bind(STREAM, durable(4)); js.subscribe(SUBJECT, pushOpts); // should not throw an error // testing enums cc = builder() .deliverSubject(deliver(5)) .durable(durable(5)) .deliverPolicy(DeliverPolicy.Last) .ackPolicy(AckPolicy.None) .replayPolicy(ReplayPolicy.Original) .build(); jsm.addOrUpdateConsumer(STREAM, cc); pushOpts = PushSubscribeOptions.bind(STREAM, durable(5)); js.subscribe(SUBJECT, pushOpts); // should not throw an error }); } @Test public void testSubscribeDurableConsumerMustMatch() throws Exception { runInJsServer(nc -> { JetStream js = nc.jetStream(); JetStreamManagement jsm = nc.jetStreamManagement(); createDefaultTestStream(jsm); // push nc.jetStreamManagement().addOrUpdateConsumer(STREAM, pushDurableBuilder().build()); changeExPush(js, pushDurableBuilder().deliverPolicy(DeliverPolicy.Last), "deliverPolicy"); changeExPush(js, pushDurableBuilder().deliverPolicy(DeliverPolicy.New), "deliverPolicy"); changeExPush(js, pushDurableBuilder().ackPolicy(AckPolicy.None), "ackPolicy"); changeExPush(js, pushDurableBuilder().ackPolicy(AckPolicy.All), "ackPolicy"); changeExPush(js, pushDurableBuilder().replayPolicy(ReplayPolicy.Original), "replayPolicy"); changeExPush(js, pushDurableBuilder().flowControl(10000), "flowControl"); changeExPush(js, pushDurableBuilder().headersOnly(true), "headersOnly"); changeExPush(js, pushDurableBuilder().startTime(ZonedDateTime.now()), "startTime"); changeExPush(js, pushDurableBuilder().ackWait(Duration.ofMillis(1)), "ackWait"); changeExPush(js, pushDurableBuilder().description("x"), "description"); changeExPush(js, pushDurableBuilder().sampleFrequency("x"), "sampleFrequency"); changeExPush(js, pushDurableBuilder().idleHeartbeat(Duration.ofMillis(1000)), "idleHeartbeat"); changeExPush(js, pushDurableBuilder().maxExpires(Duration.ofMillis(1000)), "maxExpires"); changeExPush(js, pushDurableBuilder().inactiveThreshold(Duration.ofMillis(1000)), "inactiveThreshold"); // value changeExPush(js, pushDurableBuilder().maxDeliver(LongChangeHelper.MAX_DELIVER.Min), "maxDeliver"); changeExPush(js, pushDurableBuilder().maxAckPending(0), "maxAckPending"); changeExPush(js, pushDurableBuilder().ackWait(0), "ackWait"); // value unsigned changeExPush(js, pushDurableBuilder().startSequence(1), "startSequence"); changeExPush(js, pushDurableBuilder().rateLimit(1), "rateLimit"); // unset doesn't fail because the server provides a value equal to the unset changeOkPush(js, pushDurableBuilder().maxDeliver(LongChangeHelper.MAX_DELIVER.Unset)); // unset doesn't fail because the server does not provide a value // negatives are considered the unset changeOkPush(js, pushDurableBuilder().startSequence(ULONG_UNSET)); changeOkPush(js, pushDurableBuilder().startSequence(-1)); changeOkPush(js, pushDurableBuilder().rateLimit(ULONG_UNSET)); changeOkPush(js, pushDurableBuilder().rateLimit(-1)); // unset fail b/c the server does set a value that is not equal to the unset or the minimum changeExPush(js, pushDurableBuilder().maxAckPending(LONG_UNSET), "maxAckPending"); changeExPush(js, pushDurableBuilder().maxAckPending(0), "maxAckPending"); changeExPush(js, pushDurableBuilder().ackWait(LONG_UNSET), "ackWait"); changeExPush(js, pushDurableBuilder().ackWait(0), "ackWait"); // pull nc.jetStreamManagement().addOrUpdateConsumer(STREAM, pullDurableBuilder().build()); // value changeExPull(js, pullDurableBuilder().maxPullWaiting(0), "maxPullWaiting"); changeExPull(js, pullDurableBuilder().maxBatch(0), "maxBatch"); // unsets fail b/c the server does set a value changeExPull(js, pullDurableBuilder().maxPullWaiting(-1), "maxPullWaiting"); // unset changeOkPull(js, pullDurableBuilder().maxBatch(-1)); }); } private void changeOkPush(JetStream js, Builder builder) throws IOException, JetStreamApiException { unsubscribeEnsureNotBound(js.subscribe(SUBJECT, builder.buildPushSubscribeOptions())); } private void changeOkPull(JetStream js, Builder builder) throws IOException, JetStreamApiException { unsubscribeEnsureNotBound(js.subscribe(SUBJECT, builder.buildPullSubscribeOptions())); } private void changeExPush(JetStream js, Builder builder, String changedField) { IllegalArgumentException iae = assertThrows(IllegalArgumentException.class, () -> js.subscribe(SUBJECT, PushSubscribeOptions.builder().configuration(builder.build()).build())); _changeEx(iae, changedField); } private void changeExPull(JetStream js, Builder builder, String changedField) { IllegalArgumentException iae = assertThrows(IllegalArgumentException.class, () -> js.subscribe(SUBJECT, PullSubscribeOptions.builder().configuration(builder.build()).build())); _changeEx(iae, changedField); } private void _changeEx(IllegalArgumentException iae, String changedField) { String iaeMessage = iae.getMessage(); assertTrue(iaeMessage.contains(JsSubExistingConsumerCannotBeModified.id())); assertTrue(iaeMessage.contains(changedField)); } private Builder pushDurableBuilder() { return builder().durable(PUSH_DURABLE).deliverSubject(DELIVER); } private Builder pullDurableBuilder() { return builder().durable(PULL_DURABLE); } @Test public void testGetConsumerInfoFromSubscription() throws Exception { runInJsServer(nc -> { // Create our JetStream context. JetStream js = nc.jetStream(); // create the stream. createDefaultTestStream(nc); JetStreamSubscription sub = js.subscribe(SUBJECT); nc.flush(Duration.ofSeconds(1)); // flush outgoing communication with/to the server ConsumerInfo ci = sub.getConsumerInfo(); assertEquals(STREAM, ci.getStreamName()); }); } @Test public void testInternalLookupConsumerInfoCoverage() throws Exception { runInJsServer(nc -> { JetStream js = nc.jetStream(); // create the stream. createDefaultTestStream(nc); // - consumer not found // - stream does not exist JetStreamSubscription sub = js.subscribe(SUBJECT); assertNull(((NatsJetStream)js).lookupConsumerInfo(STREAM, DURABLE)); assertThrows(JetStreamApiException.class, () -> ((NatsJetStream)js).lookupConsumerInfo(stream(999), DURABLE)); }); } @Test public void testGetJetStreamValidatedConnectionCoverage() { NatsJetStreamMessage njsm = new NatsJetStreamMessage(); IllegalStateException ise = assertThrows(IllegalStateException.class, njsm::getJetStreamValidatedConnection); assertTrue(ise.getMessage().contains("subscription")); njsm.subscription = new NatsSubscription("sid", "sub", "q", null, null); ise = assertThrows(IllegalStateException.class, njsm::getJetStreamValidatedConnection); assertTrue(ise.getMessage().contains("connection")); } @Test public void testMoreCreateSubscriptionErrors() throws Exception { runInJsServer(nc -> { JetStream js = nc.jetStream(); IllegalStateException ise = assertThrows(IllegalStateException.class, () -> js.subscribe(SUBJECT)); assertTrue(ise.getMessage().contains(JsSubNoMatchingStreamForSubject.id())); // create the stream. createDefaultTestStream(nc); // general pull push validation ConsumerConfiguration ccCantHave = builder().durable("pulldur").deliverGroup("cantHave").build(); PullSubscribeOptions pullCantHaveDlvrGrp = PullSubscribeOptions.builder().configuration(ccCantHave).build(); IllegalArgumentException iae = assertThrows(IllegalArgumentException.class, () -> js.subscribe(SUBJECT, pullCantHaveDlvrGrp)); assertTrue(iae.getMessage().contains(JsSubPullCantHaveDeliverGroup.id())); ccCantHave = builder().durable("pulldur").deliverSubject("cantHave").build(); PullSubscribeOptions pullCantHaveDlvrSub = PullSubscribeOptions.builder().configuration(ccCantHave).build(); iae = assertThrows(IllegalArgumentException.class, () -> js.subscribe(SUBJECT, pullCantHaveDlvrSub)); assertTrue(iae.getMessage().contains(JsSubPullCantHaveDeliverSubject.id())); ccCantHave = builder().maxPullWaiting(1L).build(); PushSubscribeOptions pushCantHaveMpw = PushSubscribeOptions.builder().configuration(ccCantHave).build(); iae = assertThrows(IllegalArgumentException.class, () -> js.subscribe(SUBJECT, pushCantHaveMpw)); assertTrue(iae.getMessage().contains(JsSubPushCantHaveMaxPullWaiting.id())); ccCantHave = builder().maxBatch(1L).build(); PushSubscribeOptions pushCantHaveMb = PushSubscribeOptions.builder().configuration(ccCantHave).build(); iae = assertThrows(IllegalArgumentException.class, () -> js.subscribe(SUBJECT, pushCantHaveMb)); assertTrue(iae.getMessage().contains(JsSubPushCantHaveMaxBatch.id())); // create some consumers PushSubscribeOptions psoDurNoQ = PushSubscribeOptions.builder().durable("durNoQ").build(); js.subscribe(SUBJECT, psoDurNoQ); PushSubscribeOptions psoDurYesQ = PushSubscribeOptions.builder().durable("durYesQ").build(); js.subscribe(SUBJECT, "yesQ", psoDurYesQ); // already bound iae = assertThrows(IllegalArgumentException.class, () -> js.subscribe(SUBJECT, psoDurNoQ)); assertTrue(iae.getMessage().contains(JsSubConsumerAlreadyBound.id())); // queue match PushSubscribeOptions qmatch = PushSubscribeOptions.builder() .durable("qmatchdur").deliverGroup("qmatchq").build(); iae = assertThrows(IllegalArgumentException.class, () -> js.subscribe(SUBJECT, "qnotmatch", qmatch)); assertTrue(iae.getMessage().contains(JsSubQueueDeliverGroupMismatch.id())); // queue vs config iae = assertThrows(IllegalArgumentException.class, () -> js.subscribe(SUBJECT, "notConfigured", psoDurNoQ)); assertTrue(iae.getMessage().contains(JsSubExistingConsumerNotQueue.id())); PushSubscribeOptions psoNoVsYes = PushSubscribeOptions.builder().durable("durYesQ").build(); iae = assertThrows(IllegalArgumentException.class, () -> js.subscribe(SUBJECT, psoNoVsYes)); assertTrue(iae.getMessage().contains(JsSubExistingConsumerIsQueue.id())); PushSubscribeOptions psoYesVsNo = PushSubscribeOptions.builder().durable("durYesQ").build(); iae = assertThrows(IllegalArgumentException.class, () -> js.subscribe(SUBJECT, "qnotmatch", psoYesVsNo)); assertTrue(iae.getMessage().contains(JsSubExistingQueueDoesNotMatchRequestedQueue.id())); // flow control heartbeat push / pull ConsumerConfiguration ccFc = builder().durable("ccFcDur").flowControl(1000).build(); ConsumerConfiguration ccHb = builder().durable("ccHbDur").idleHeartbeat(1000).build(); PullSubscribeOptions psoPullCcFc = PullSubscribeOptions.builder().configuration(ccFc).build(); iae = assertThrows(IllegalArgumentException.class, () -> js.subscribe(SUBJECT, psoPullCcFc)); assertTrue(iae.getMessage().contains(JsSubFcHbNotValidPull.id())); PullSubscribeOptions psoPullCcHb = PullSubscribeOptions.builder().configuration(ccHb).build(); iae = assertThrows(IllegalArgumentException.class, () -> js.subscribe(SUBJECT, psoPullCcHb)); assertTrue(iae.getMessage().contains(JsSubFcHbNotValidPull.id())); PushSubscribeOptions psoPushCcFc = PushSubscribeOptions.builder().configuration(ccFc).build(); iae = assertThrows(IllegalArgumentException.class, () -> js.subscribe(SUBJECT, "cantHaveQ", psoPushCcFc)); assertTrue(iae.getMessage().contains(JsSubFcHbHbNotValidQueue.id())); PushSubscribeOptions psoPushCcHb = PushSubscribeOptions.builder().configuration(ccHb).build(); iae = assertThrows(IllegalArgumentException.class, () -> js.subscribe(SUBJECT, "cantHaveQ", psoPushCcHb)); assertTrue(iae.getMessage().contains(JsSubFcHbHbNotValidQueue.id())); }); } }
nats-io/java-nats
<|start_filename|>pkg/retrieval/retrieval.go<|end_filename|> package retrieval import ( "archive/zip" "context" "io" "time" pb "github.com/CovidShield/server/pkg/proto/covidshield" "github.com/Shopify/goose/logger" "google.golang.org/protobuf/proto" ) var log = logger.New("retrieval") const ( maxKeysPerFile = 750000 ) var ( signatureAlgorithm = "1.2.840.10045.4.3.2" // required by protocol verificationKeyVersion = "v1" verificationKeyID = "302" binHeader = []byte("EK Export v1 ") binHeaderLength = 16 ) func min(a, b int) int { if a < b { return a } return b } // It's still really unclear to me when A/G wants us to use MCC and when we're // expected/permitted to use some other identifier. It would be great to get // more clarity on this. func transformRegion(reg string) string { if reg == "302" { return "CA" } return reg } func SerializeTo( ctx context.Context, w io.Writer, keys []*pb.TemporaryExposureKey, region string, startTimestamp, endTimestamp time.Time, signer Signer, ) (int, error) { zipw := zip.NewWriter(w) one := int32(1) start := uint64(startTimestamp.Unix()) end := uint64(endTimestamp.Unix()) sigInfo := &pb.SignatureInfo{ VerificationKeyVersion: &verificationKeyVersion, VerificationKeyId: &verificationKeyID, SignatureAlgorithm: &signatureAlgorithm, } region = transformRegion(region) tekExport := &pb.TemporaryExposureKeyExport{ StartTimestamp: &start, EndTimestamp: &end, Region: &region, BatchNum: &one, BatchSize: &one, SignatureInfos: []*pb.SignatureInfo{sigInfo}, Keys: keys, } exportBinData, err := proto.Marshal(tekExport) if err != nil { return -1, err } sig, err := signer.Sign(append(binHeader, exportBinData...)) if err != nil { return -1, err } sigList := &pb.TEKSignatureList{ Signatures: []*pb.TEKSignature{&pb.TEKSignature{ SignatureInfo: sigInfo, BatchNum: &one, BatchSize: &one, Signature: sig, }}, } exportSigData, err := proto.Marshal(sigList) if err != nil { return -1, err } totalN := 0 f, err := zipw.Create("export.bin") if err != nil { return -1, err } n, err := f.Write(binHeader) if err != nil { return -1, err } totalN += n if n != binHeaderLength { panic("header len") } n, err = f.Write(exportBinData) if err != nil { return -1, err } totalN += n if n != len(exportBinData) { panic("len") } f, err = zipw.Create("export.sig") if err != nil { return -1, err } n, err = f.Write(exportSigData) if err != nil { return -1, err } totalN += n if n != len(exportSigData) { panic("len") } return totalN, zipw.Close() }
scoates/covid-alert-server
<|start_filename|>src/core/utils/constants.js<|end_filename|> export const ALL_STATES_KEY = "*"; export const SAME_STATE_KEY = "_"; <|start_filename|>__tests__/index.js<|end_filename|> import { init } from "../"; describe("init type check", () => { test("init is a defined function", () => { expect(init).toBeDefined(); expect(init).toBeInstanceOf(Function); }); }); <|start_filename|>src/core/Store.js<|end_filename|> import _ from "lodash"; import Machine from "./Machine"; export const MACHINES = Symbol("MACHINES"); function createMachinesFromConfiguration(machineConfiguration) { const entries = _.entries(machineConfiguration); const machines = _.reduce( entries, (acc, currentValue) => { const [machineName, machineConfiguration] = currentValue; return { ...acc, [machineName]: new Machine({ ...machineConfiguration, name: machineName }) }; }, {} ); return machines; } export default class Store { constructor(machineConfiguration) { this[MACHINES] = createMachinesFromConfiguration(machineConfiguration); } getMachines() { return this[MACHINES]; } getData() { const result = {}; for (const machineName in this[MACHINES]) { const machine = this[MACHINES][machineName]; result[machine.getName()] = { value: machine.getValue(), state: machine.getState() }; } return result; } getMachinesFromMachineNames(machineNamesList) { return machineNamesList.map(name => this[MACHINES][name]); } subscribeTo(machineNamesList) { console.log(this[MACHINES], machineNamesList); } } <|start_filename|>src/armin.js<|end_filename|> import Store from "./core/Store"; import { createMachine } from "./core/Machine"; import init from "./core/init" export { Store }; export { createMachine }; export { init }; export default init; <|start_filename|>example/simple.js<|end_filename|> import React, {Component} from "react"; import { render } from "react-dom"; import { init } from "../src/armin"; const toggler = { allStates: ["showing", "hiding"], state: "hiding", reducers: { show: { from: ["hiding"], setState: () => "showing" }, hide: { from: ["showing"], setState: () => "hiding" } } }; const counter = { allStates: ["ready", "running", "stopped"], state: "ready", value: 0, reducers: { increment: { from: ["ready", "running"], setState: () => "running", setValue: ({ value }) => value + 1 }, stop: { from: ["ready", "running"], setState: () => "stopped" }, restart: { from: ["stopped"], setState: () => "ready", setValue: ({ value }) => 0 } }, effects: { incrementAsync() { return setInterval(() => { this.increment(); }, 100); } } }; const { store, Provider, createConsumer } = init({ toggler, counter }); class Counter extends React.Component { timers = []; startIncrementAsync = () => { this.timers.push(this.props.counter.incrementAsync()); }; stop = () => { this.timers.forEach(timer => clearInterval(timer)); this.timers = []; this.props.counter.stop(); }; render() { const { counter } = this.props; return ( <div> <p> {" "} <button disabled={!counter.can.increment} onClick={counter.increment}> Increment </button>{" "} <button disabled={!counter.can.increment} onClick={this.startIncrementAsync} > Increment every 100s </button>{" "} </p> <p> {counter.value} </p> <p> {" "} <button disabled={!counter.can.restart} onClick={counter.restart}> Restart </button>{" "} <button disabled={!counter.can.stop} onClick={this.stop}> Stop </button>{" "} </p> </div> ); } } const Consumer = createConsumer(["toggler", "counter"]); export default class Home extends React.Component { render() { return ( <Provider> <Consumer> {([toggler, counter]) => { return ( <div> <p>State {toggler.state}</p> <p>Value {toggler.value}</p> <p> <button disabled={!toggler.can.show} onClick={toggler.show}> Show </button> <button disabled={!toggler.can.hide} onClick={toggler.hide}> Hide </button> </p> <hr /> <Counter counter={counter} /> </div> ); }} </Consumer> </Provider> ); } } render(<Home />, window.store); <|start_filename|>src/core/init.js<|end_filename|> import React from "react"; import PropTypes from "prop-types"; import createReactContext from "create-react-context"; import Store from "./Store"; export default function init(storeConfig) { const StoreContext = createReactContext(null); const store = new Store(storeConfig); class Provider extends React.Component { static propTypes = { children : PropTypes.any } state = { value: store }; render() { return ( <StoreContext.Provider value={this.state.value}> {this.props.children} </StoreContext.Provider> ); } } function createConsumer(to) { const DUMMY_STATE = {}; return class Consumer extends React.Component { static propTypes = { children : PropTypes.any } subscriptions = []; onUpdate = cb => { this.setState(DUMMY_STATE, cb); }; unsubscribe = () => { this.subscriptions.forEach(subscription => subscription()); }; subscribe = machines => { this.unsubscribe(); this.subscriptions = machines.map(machine => machine.subscribe(this.onUpdate) ); }; componentWillUnmount() { this.unsubscribe(); } render() { return ( <StoreContext.Consumer> {store => { const machines = store.getMachinesFromMachineNames(to); this.subscribe(machines); const machineControllers = machines.map(machine => machine.getController() ); return this.props.children(machineControllers); }} </StoreContext.Consumer> ); } }; } return { store, createConsumer, Provider }; } <|start_filename|>example/counter.js<|end_filename|> import React, { Component } from "react"; import { render } from "react-dom"; import { createMachine } from "../src/armin"; const { Provider, Consumer } = createMachine({ allStates: ["ready", "running", "stopped"], state: "ready", value: 0, reducers: { increment: { setValue: ({ value, state }, payload = 1) => value + payload, setState: () => "running" }, decrement: { from: ["running"], setValue: ({ value, state }, payload = 1) => value - payload, setState: (opts, setValue) => setValue <= 0 ? "stopped" : "running" }, stop: { from: ["ready", "running"], setValue: ({ value }) => value, setState: () => "stopped" } }, effects: { async incrementAsync() { console.log("waiting"); await new Promise(resolve => setTimeout(() => { console.log("done waiting"); resolve(); }, 1000) ); this.increment(5); } } }); export default class Counter extends Component { render() { return ( <Provider> <Consumer> {machineController => { console.log(machineController); return ( <div> <p> <button disabled={!machineController.can.increment} onClick={e => machineController.increment(2)} > Increment By 2 </button> </p> <p>Value is {machineController.value}</p> <p> <button disabled={!machineController.can.decrement} onClick={() => machineController.decrement(1)} > Decrement </button> </p> <p> <button disabled={!machineController.can.increment} onClick={e => machineController.incrementAsync()} > Wait for a second and increment by 5 </button> </p> <p> <button disabled={!machineController.can.stop} onClick={() => machineController.stop()} > Stop counter </button> </p> </div> ); }} </Consumer> </Provider> ); } } render(<Counter />, window.counter); <|start_filename|>src/core/Machine.js<|end_filename|> import React from "react"; import PropTypes from "prop-types"; import createReactContext from "create-react-context"; import { createMachineConfigWithDefaults } from "./utils/index"; export const ALL_STATES = Symbol("ALL_STATES"); export const INTERNAL_STATE = Symbol("INTERNAL_STATE"); export const INTERNAL_VALUE = Symbol("INTERNAL_VALUE"); export const REDUCERS = Symbol("REDUCERS"); export const EFFECTS = Symbol("EFFECTS"); export const LISTENERS = Symbol("LISTENERS"); export const MACHINE_NAME = Symbol("NAME"); // This function will add reducers // as methods on to the controller export function createControllerMembersFromReducers() { const reducers = this[REDUCERS]; const members = {}; for (const key in reducers) { // Create a function that has access to // value and state as the first argument // pass the original args in order members[key] = (...args) => { // invoke the original function inside // reducers const currentState = this.getState(); const currentValue = this.getValue(); try { const reducer = reducers[key]; // can the reducer dispatch? if (reducer.canDispatch(currentState)) { const { nextValue, nextState } = reducer.dispatch( { value: currentValue, state: currentState }, ...args ); // Update internal value this.setValue(nextValue); this.setState(nextState); // Broadcast changes to listeners this.broadcast(); return nextValue; } else { // No valid action console.warn( `${reducer.getName()} has no valid action for state ${currentState}. Aborting.` ); return currentValue; } } catch (err) { console.error(err); } }; } return members; } export function createControllerMembersFromEffects() { const effects = this[EFFECTS]; const members = {}; for (const key in effects) { // Create a function that has access to // value and state as the first argument // pass the original args in order const machine = this; members[key] = function(...args) { console.log("effects", this); // we want the controller to be able to call it's members // from it's effects // hence we call it with the this reference // we do not update values here; return effects[key].call( this, { value: machine.getValue(), state: machine.getState() }, ...args ); }; } return members; } // this function will tell whether a particular reducer // can dispatch in the current state or not export function getReducerDispatchablities() { const reducers = this[REDUCERS]; const currentState = this.getState(); const members = {}; for (const reducerName in reducers) { members[reducerName] = reducers[reducerName].canDispatch(currentState); } return members; } // this function will tell whether the machine is // in a particular state or not // basically controller.is.ready // or controller.is.stopped etc export function getControllerIsAttribute() { const currentState = this.getState(); const members = {}; this[ALL_STATES].reduce((acc, nextValue) => { acc[nextValue] = nextValue === currentState; return acc; }, members); return members; } export default class Machine { constructor(machineConfig) { const { name, allStates, initialState, initialValue, reducers, effects } = createMachineConfigWithDefaults(machineConfig); this[ALL_STATES] = allStates; this[INTERNAL_STATE] = initialState; this[INTERNAL_VALUE] = initialValue; this[REDUCERS] = reducers; this[EFFECTS] = effects; this[MACHINE_NAME] = name; this[LISTENERS] = []; } setState(nextState) { this[INTERNAL_STATE] = nextState; return nextState; } setValue(nextValue) { this[INTERNAL_VALUE] = nextValue; return nextValue; } getState() { return this[INTERNAL_STATE]; } getValue() { return this[INTERNAL_VALUE]; } getName() { return this[MACHINE_NAME]; } getController() { return { value: this.getValue(), state: this.getState(), ...createControllerMembersFromReducers.call(this), ...createControllerMembersFromEffects.call(this), can: getReducerDispatchablities.call(this), is: getControllerIsAttribute.call(this) }; } broadcast() { this[LISTENERS].forEach(listener => listener()); } subscribe(fn) { this[LISTENERS] = [...this[LISTENERS], fn]; return () => { this.unsubscribe(fn); }; } unsubscribe(fn) { this[LISTENERS] = this[LISTENERS].filter(func => func !== fn); } } /** * createMachine - creates Machine and returns a Provider and Consumer * * @param {type} machineConfig description * @return {type} description */ export function createMachine(machineConfig) { const MachineContext = createReactContext(null); const machine = new Machine(machineConfig); class Provider extends React.Component { static propTypes = { children : PropTypes.any } constructor(props) { super(props); this.unsubscribe = machine.subscribe(() => { this.setState({ value: machine.getController() }); }); this.state = { value: machine.getController() }; } componentWillUnmount() { this.unsubscribe(); } render() { return ( <MachineContext.Provider value={this.state.value}> {this.props.children} </MachineContext.Provider> ); } } class Consumer extends React.Component { static propTypes = { children : PropTypes.any } render() { return ( <MachineContext.Consumer> {machineController => this.props.children(machineController)} </MachineContext.Consumer> ); } } return { Provider, Consumer }; } <|start_filename|>example/todos.js<|end_filename|> import React, { Component } from "react"; import { render } from "react-dom"; import { createMachine } from "../src/armin"; const { Provider, Consumer } = createMachine({ allStates: ["ready", "editing"], state: "ready", value: { list: [ { text: "Finish visa process", isCompleted: false } ], editingTodoId: null }, reducers: { editTodo: { from: ["ready"], setState: () => "editing" }, finishEditing: { from: ["editing"], setState: () => "ready" }, toggleIsCompleted: { setValue: ({ value }, index, isCompleted) => ({ ...value, list: [ ...value.list.slice(0, index), { ...value.list[index], isCompleted }, ...value.list.slice(index + 1) ] }) }, addTodo: { setValue: ({ value }, { text, isCompleted }) => { return { ...value, list: [...value.list, { text, isCompleted }] }; } } } }); class TodoForm extends Component { state = { text: "", isCompleted: false }; handleSubmit = e => { e.preventDefault(); if (this.state.text) { this.props.onSubmit({ text: this.state.text, isCompleted: this.state.isCompleted }); this.setState({ text: "", isCompleted: false }); } }; changeText = e => this.setState({ text: e.target.value }); changeIsCompleted = e => this.setState({ isCompleted: e.target.checked }); render() { const { canSubmit } = this.props; return ( <form onSubmit={this.handleSubmit}> <input type="checkbox" disabled={!canSubmit} checked={this.state.isCompleted} onChange={this.changeIsCompleted} /> <input value={this.state.text} disabled={!canSubmit} onChange={this.changeText} /> <button type="submit" disabled={!canSubmit}> Submit </button> </form> ); } } class DisplayTodo extends Component { changeIsCompleted = e => { this.props.onToggleIsCompleted(this.props.index, e.target.checked); }; render() { const { canToggleIsCompleted, todo } = this.props; return ( <p> <input type="checkbox" disabled={!canToggleIsCompleted} checked={todo.isCompleted} onChange={this.changeIsCompleted} /> <span>{todo.text}</span> </p> ); } } export default class Todos extends Component { attemptAddTodo = fn => e => { e.preventDefault(); }; render() { return ( <Provider> <Consumer> {todosController => { console.log(todosController); return ( <div> {todosController.value.list.map((todo, index) => ( <DisplayTodo key={index} canToggleIsCompleted={todosController.can.toggleIsCompleted} onToggleIsCompleted={todosController.toggleIsCompleted} index={index} todo={todo} /> ))} <TodoForm onSubmit={todosController.addTodo} canSubmit={todosController.can.addTodo} /> </div> ); }} </Consumer> </Provider> ); } } render(<Todos />, window.todos); <|start_filename|>src/core/utils/Reducer.js<|end_filename|> import _ from "lodash"; export const NAME = Symbol("NAME"); export const FOR_STATES = Symbol("FOR_STATES"); export const COMPUTE_NEXT_VALUE = Symbol("COMPUTE_NEXT_VALUE"); export const COMPUTE_NEXT_STATE = Symbol("COMPUTE_NEXT_STATE"); export const NOOP_COMPUTE_NEXT_STATE = ({ state }) => state; export const NOOP_COMPUTE_NEXT_VALUE = ({ value }) => value; export default class Reducer { static getMembersFromConfiguration(configuration, allStates) { let forStates = allStates, computeNextValue = NOOP_COMPUTE_NEXT_VALUE, computeNextState = NOOP_COMPUTE_NEXT_STATE; if (_.isFunction(configuration)) { // generate forStates and computeNextState // configuration is computeNextValue computeNextValue = configuration; } else if (_.isObject(configuration)) { const { from: _forStates = allStates, setValue: _computeNextValue = NOOP_COMPUTE_NEXT_VALUE, setState: _computeNextState = NOOP_COMPUTE_NEXT_STATE } = configuration; if ( !_.isFunction(computeNextValue) || !_.isFunction(computeNextState) || !Array.isArray(forStates) ) { throw new Error("Invalid config"); } forStates = _forStates; computeNextValue = _computeNextValue; computeNextState = _computeNextState; } else { throw new Error("Expected an object or a function"); } return { forStates, computeNextValue, computeNextState }; } constructor(name, configuration, allStates) { const { forStates, computeNextValue, computeNextState } = Reducer.getMembersFromConfiguration(configuration, allStates); this[NAME] = name; this[FOR_STATES] = forStates; this[COMPUTE_NEXT_STATE] = computeNextState; this[COMPUTE_NEXT_VALUE] = computeNextValue; } getName() { return this[NAME]; } canDispatch(state) { return this[FOR_STATES].includes(state); } dispatch(opts, ...restArgs) { const nextValue = this[COMPUTE_NEXT_VALUE](opts, ...restArgs); const nextState = this[COMPUTE_NEXT_STATE](opts, nextValue, ...restArgs); return { nextValue, nextState }; } } <|start_filename|>src/core/utils/index.js<|end_filename|> import Reducer from "./Reducer"; export function createReducersFromConfig(reducersConfig = {}, allStates) { const members = {}; for (const reducerName in reducersConfig) { members[reducerName] = new Reducer( reducerName, reducersConfig[reducerName], allStates ); } return members; } export function createMachineConfigWithDefaults(machineConfig) { const { name = "localMachine", allStates = [], state: initialState = "start", value: initialValue = null, reducers: reducersConfig = {}, stateTransitions = {}, effects = {} } = machineConfig; return { name, allStates, initialState, initialValue, reducers: createReducersFromConfig(reducersConfig, allStates), stateTransitions, effects }; }
imbhargav5/mach-store
<|start_filename|>example/lib/main.dart<|end_filename|> import 'package:flutter/material.dart'; import 'package:quran/quran.dart' as quran; void main() { runApp(MaterialApp( home: Scaffold( appBar: AppBar( title: Text("Quran Demo"), ), body: SafeArea( child: Padding( padding: EdgeInsets.all(15.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text("Juz Number: \n" + quran.getJuzNumber(18, 1).toString()), Text("\nJuz URL: \n" + quran.getJuzURL(15)), Text("\nSurah and Verses in Juz 15: \n" + quran.getSurahAndVersesFromJuz(15).toString()), Text("\nSurah Name: \n" + quran.getSurahName(18)), Text("\nSurah Name (English): \n" + quran.getSurahNameEnglish(18)), Text("\nSurah URL: \n" + quran.getSurahURL(18)), Text("\nTotal Verses: \n" + quran.getVerseCount(18).toString()), Text("\nPlace of Revelation: \n" + quran.getPlaceOfRevelation(18)), Text("\nBasmala: \n" + quran.getBasmala()), Text("\nVerse 1: \n" + quran.getVerse(18, 1)) ], ), ), ), ), )); }
SpicierEwe/quran
<|start_filename|>cpp/include/libaddressinput/ondemand_supplier.h<|end_filename|> // Copyright (C) 2014 Google Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #ifndef I18N_ADDRESSINPUT_ONDEMAND_SUPPLIER_H_ #define I18N_ADDRESSINPUT_ONDEMAND_SUPPLIER_H_ #include <libaddressinput/callback.h> #include <libaddressinput/supplier.h> #include <map> #include <memory> #include <string> namespace i18n { namespace addressinput { class LookupKey; class Retriever; class Rule; class Source; class Storage; // An implementation of the Supplier interface that owns a Retriever object, // through which it loads address metadata as needed, creating Rule objects and // caching these. // // When using an OndemandSupplier, address validation will benefit from address // metadata server synonym resolution, because the server will be contacted for // every new LookupKey (ie. every LookupKey that isn't on canonical form and // isn't already cached). // // The maximum size of this cache is naturally limited to the amount of data // available from the data server. (Currently this is less than 12,000 items of // in total less than 2 MB of JSON data.) class OndemandSupplier : public Supplier { public: OndemandSupplier(const OndemandSupplier&) = delete; OndemandSupplier& operator=(const OndemandSupplier&) = delete; // Takes ownership of |source| and |storage|. OndemandSupplier(const Source* source, Storage* storage); ~OndemandSupplier() override; // Loads the metadata needed for |lookup_key|, then calls |supplied|. void Supply(const LookupKey& lookup_key, const Callback& supplied) override; // For now, this is identical to Supply. void SupplyGlobally(const LookupKey& lookup_key, const Callback& supplied) override; private: const std::unique_ptr<const Retriever> retriever_; std::map<std::string, const Rule*> rule_cache_; }; } // namespace addressinput } // namespace i18n #endif // I18N_ADDRESSINPUT_ONDEMAND_SUPPLIER_H_
Tianhao25/libaddressinput
<|start_filename|>seneca helper/AppDelegate.h<|end_filename|> // // AppDelegate.h // seneca helper // // Created by <NAME> on 4/20/17. // Copyright © 2017 <NAME>. All rights reserved. // #import <Cocoa/Cocoa.h> @interface AppDelegate : NSObject <NSApplicationDelegate> @end
jcbages/seneca
<|start_filename|>test/tests/renderer/renderToStaticMarkup.js<|end_filename|> import * as React from 'react'; import { expect } from 'chai'; import renderToStaticMarkup from '../../../src/renderer/renderToStaticMarkup'; import App from './includes/App'; import FailureApp from './includes/FailureApp'; describe('renderToStaticMarkup', () => { it('should do render to static markup', function (done) { this.timeout(15000); renderToStaticMarkup(<App/>) .then(({ html, state, modules }) => { expect(html).to.equal('<div><div>foobar</div></div>'); expect(state).to.deep.equal({ '1': { message: 'foobar' }}); expect(modules).to.have.lengthOf(1); done(); }) }); it('should handle errors properly', () => { renderToStaticMarkup(<FailureApp/>) .then(() => { throw new Error('should not be called') }) .catch(e => { expect(e.message).to.equal('aw snap!') }) }) }); <|start_filename|>test/tests/components/fetchState/fetchState.js<|end_filename|> import * as React from 'react'; import { renderToStaticMarkup } from '../../../../src/index'; import { expect } from 'chai'; import Foo from './includes/Foo'; describe('fetchState', () => { it('should do fetchState for component', function(done) { this.timeout(15000); renderToStaticMarkup(<Foo/>) .then((result) => { expect(result.html).to.equal('<div>foobar</div>'); done(); }); }); }); <|start_filename|>src/stats/extractModules.js<|end_filename|> import validateStats from '../utils/validateStats'; function parseWebpack(module, publicPath) { return { id: module.id, files: module.files.map(item => publicPath + item) }; } function parseSystemImportTransformer(module, publicPath) { return { id: module.id, files: [publicPath + module.name] }; } function findModule(module, chunks) { const match = chunks.find(chunk => module.info.id == chunk.id); if (match) return match; for (let i = 0, len = chunks.length; i < len; ++i) { if (chunks[i].modules) { const match = findModule(module, chunks[i].modules); if (match) return match; } } return null; } function extractModule(module, stats) { if (module.info.type === 'webpack') { const match = findModule(module, stats.chunks); return match ? parseWebpack(match, stats.publicPath || '') : match; } else if (module.info.type === 'systemImportTransformer') { const match = findModule(module, stats.chunks); return match ? parseSystemImportTransformer(match, stats.publicPath || '') : match; } } export default (modules, stats) => { validateStats(stats); if (modules && Object.prototype.toString.call(modules) === '[object Array]') { return modules.map(module => extractModule(module, stats)); } return []; }; <|start_filename|>src/module/cache.js<|end_filename|> import { isWebpack, getWebpackId, isSystemImportTransformer } from './info'; import { caller, dirname, join } from '../utils'; let pool = {}; const signature = (module, systemImport) => { const loadFunc = systemImport.toString(); if (isWebpack(loadFunc) && isSystemImportTransformer(loadFunc)) { const parent = dirname(caller()[0].getFileName()); const id = getWebpackId(loadFunc); return `${parent}_${id}`; } else if (isWebpack(loadFunc)) { return getWebpackId(loadFunc); } if (typeof module === 'object' && typeof module.parent === 'object' && typeof module.parent.id !== 'undefined') { return `${module.parent.id}_${systemImport.toString()}`.replace(/[\(\)]/g, '_').replace(/[^0-9a-zA-Z\/_\\]/g, ''); } return null; } export const add = (module, systemImport, result) => { const key = signature(module, systemImport); if (key !== null) pool[key] = result; } export const fetch = (module, systemImport) => { const key = signature(module, systemImport); if (key !== null && typeof pool[key] !== 'undefined') return pool[key]; return null; } export const exists = (module, systemImport) => { const key = signature(module, systemImport); return key !== null && typeof pool[key] !== 'undefined'; } export const all = () => pool; export const clear = () => { for (let prop in pool) { if (pool.hasOwnProperty(prop)) { delete pool[prop]; } } }; <|start_filename|>src/module/preload.js<|end_filename|> import { getWebpackId } from './info'; const pool = {}; const signature = (module, systemImport) => getWebpackId(systemImport.toString()); export const fetch = (module, systemImport) => { const key = signature(module, systemImport); if (key !== null && typeof pool[key] !== 'undefined') return pool[key]; return null; } export const exists = (module, systemImport) => { const key = signature(module, systemImport); return key !== null && typeof pool[key] !== 'undefined'; } const loadScript = url => { return new Promise(resolve => { if (!url.match(/\.map$/)) { var head = document.getElementsByTagName('head')[0]; var script = document.createElement('script'); script.type = 'text/javascript'; script.src = '/' + url.replace(/^\//, ''); script.onreadystatechange = resolve(script); script.onload = resolve(script); head.appendChild(script); } else { resolve(null); } }); } const fetchModuleInformation = modules => { return new Promise((resolve) => { const prevWebpackJsonp = webpackJsonp; const finalModules = {}; let fileLoading = 0; const scripts = []; const finish = () => { scripts.forEach(script => script.parentElement.removeChild(script)); webpackJsonp = prevWebpackJsonp; resolve(finalModules); }; webpackJsonp = (ids, modules) => { let index = -1; for (let prop in modules) { if (modules.hasOwnProperty(prop)) { index++; if (typeof ids[index] !== 'undefined') { finalModules[ids[index]] = prop; } } } if (fileLoading === 0) { finish(); } }; modules.forEach(module => { module.files.forEach(file => { fileLoading++; loadScript(file) .then(script => { fileLoading--; if (script) scripts.push(script); }); }) }) }); }; const loadWebpackModules = (modules) => { return new Promise((resolve) => { let moduleLoading = 0; for (let prop in modules) { if (modules.hasOwnProperty(prop)) { moduleLoading++; __webpack_require__.e(prop) .then(__webpack_require__.bind(null, modules[prop])) .then(m => { moduleLoading--; pool[prop] = m; if (moduleLoading === 0) { resolve(pool); } }); } } }); } export default (modules) => { return new Promise((resolve) => { if ( typeof modules !== 'object' || Object.prototype.toString.call(modules) !== '[object Array]' || modules.length < 1 ) { return resolve([]); } fetchModuleInformation(modules) .then(loadWebpackModules) .then(resolve) }); }; <|start_filename|>test/tests/utils.js<|end_filename|> import { expect } from 'chai'; import isNode from '../../src/utils/isNode'; describe('utils', () => { it('isNode', () => { expect(isNode()).to.be.true; }); }); <|start_filename|>test/tests/index.js<|end_filename|> import { expect } from 'chai'; import { extractModules, fetchState, Module, preload, renderToString, renderToStaticMarkup, ServerStateProvider } from '../../src/index'; describe('index', () => { it('should be exported', () => { expect(extractModules).to.exist; expect(fetchState).to.exist; expect(Module).to.exist; expect(preload).to.exist; expect(renderToString).to.exist; expect(renderToStaticMarkup).to.exist; expect(ServerStateProvider).to.exist; }); }); <|start_filename|>src/renderer/renderToString.js<|end_filename|> import renderPass from './renderPass'; import { clear } from '../module/cache'; export default (element) => { return new Promise((resolve, reject) => { clear(); const context = { resolve, reject, modulesLoading: 0, fetchingStates: 0 }; renderPass(context, element); }); }; <|start_filename|>src/utils/validateStats.js<|end_filename|> export default function (stats) { if ( (typeof stats === 'undefined' || !stats) || (!stats.modules || Object.prototype.toString.call(stats.modules) !== '[object Array]') || (!stats.chunks || Object.prototype.toString.call(stats.chunks) !== '[object Array]') || (!stats.entrypoints || typeof stats.entrypoints !== 'object') ) throw new Error('Stats is malformed.'); } <|start_filename|>test/tests/components/fetchState/withDone.js<|end_filename|> import * as React from 'react'; import { expect } from 'chai'; import { renderToStaticMarkup } from 'react-dom/server' import { withDone } from '../../../../src'; describe('withDone', () => { it('should pass done property to component', function(done) { const Component = props => { expect(props.done).to.be.a('Function'); done(); return null; } const ComponentWithDone = withDone(Component); renderToStaticMarkup(<ComponentWithDone />); }); }); <|start_filename|>test/tests/components/module/module.js<|end_filename|> import * as React from 'react'; import { renderToStaticMarkup } from 'react-dom/server'; import { expect } from 'chai'; import Module from '../../../../src/components/Module'; import webpack from 'webpack'; import webpackConfig from './includes/webpack.config'; import { exec } from 'child_process'; describe('module', () => { it('should load module using babel plugin', function(done) { this.timeout(15000); renderToStaticMarkup( <Module module={() => System.import('./includes/Foo')} name="foo" > { Foo => Foo && <Foo /> } </Module> ); setTimeout(() => { const result = renderToStaticMarkup( <Module module={() => System.import('./includes/Foo')} name="foo" > { Foo => Foo && <Foo.default/> } </Module> ); expect(result).to.match(/foobar/); done(); }); }); it('should load module using webpack bundle', function(done) { this.timeout(15000); webpack(webpackConfig, () => { System.import('./includes/bundle').then(({ default: App }) => { renderToStaticMarkup(<App/>); setTimeout(() => { const result = renderToStaticMarkup(<App/>); expect(result).to.match(/foobar/); done(); }); }); }); }); it('should load module using webpack bundle with pathinfo true', function(done) { this.timeout(15000); const config = { ...webpackConfig }; config.output = { ...config.output, pathinfo: true }; webpack(config, () => { System.import('./includes/bundle').then(({ default: App }) => { renderToStaticMarkup(<App/>); setTimeout(() => { const result = renderToStaticMarkup(<App/>); expect(result).to.match(/foobar/); done(); }); }); }); }); it('should load module using webpack bundle with production settings', function(done) { this.timeout(15000); exec('./node_modules/.bin/webpack --config test/tests/components/module/includes/webpack.config.js -p', () => { System.import('./includes/bundle').then(({ default: App }) => { renderToStaticMarkup(<App/>); setTimeout(() => { const result = renderToStaticMarkup(<App/>); expect(result).to.match(/foobar/); done(); }); }); }); }); }); <|start_filename|>src/renderer/renderPass.js<|end_filename|> import React from 'react'; import { renderToString, renderToStaticMarkup } from 'react-dom/server'; import AsyncRenderer from '../components/AsyncRenderer'; import removeDuplicateModules from '../utils/removeDuplicateModules'; const renderPass = (context, element, staticMarkup = false) => { context.callback = () => { if (context.finishedLoadingModules && !context.statesRenderPass) { context.statesRenderPass = true; context.renderResult = renderPass(context, element, staticMarkup); if (context.fetchingStates <= 0 && context.modulesLoading <= 0) { context.resolve({ html: context.renderResult, state: context.fetchStateResults === undefined ? null : context.fetchStateResults, modules: context.modules === undefined ? null : removeDuplicateModules(context.modules) }); } } else if (context.finishedLoadingModules && context.statesRenderPass || !context.hasModules) { context.renderResult = renderPass(context, element, staticMarkup); if (context.fetchingStates <= 0 && context.modulesLoading <= 0) { context.resolve({ html: context.renderResult, state: context.fetchStateResults === undefined ? null : context.fetchStateResults, modules: context.modules === undefined ? null : removeDuplicateModules(context.modules) }); } } }; let component = ( <AsyncRenderer context={context}> {element} </AsyncRenderer> ); let result; try { if (staticMarkup) { result = renderToStaticMarkup(component); } else { result = renderToString(component); } } catch (e) { return context.reject(e); } if (!context.hasModules && !context.hasStates) { context.resolve({ html: result, state: context.fetchStateResults === undefined ? null : context.fetchStateResults, modules: context.modules === undefined ? null : removeDuplicateModules(context.modules) }); } return result; }; export default renderPass; <|start_filename|>src/utils/dirname.js<|end_filename|> export default function (path) { const indexOfSlash = __dirname.indexOf('/'); const indexOfBackslash = __dirname.indexOf('\\'); let separator; if (indexOfBackslash === -1 || indexOfSlash > indexOfBackslash) { separator = '/'; } else { separator = '\\'; } const parts = path.split(separator); parts.pop(); return parts.join(separator); } <|start_filename|>src/utils/index.js<|end_filename|> export { default as caller } from './caller'; export { default as dirname } from './dirname'; export { default as isNode } from './isNode'; export { default as join } from './join'; export { default as removeDuplicateModules } from './removeDuplicateModules'; export { default as validateStats } from './validateStats'; <|start_filename|>src/utils/join.js<|end_filename|> export default function (...paths) { const indexOfSlash = __dirname.indexOf('/'); const indexOfBackslash = __dirname.indexOf('\\'); let separator; if (indexOfBackslash === -1 || indexOfSlash > indexOfBackslash) { separator = '/'; paths = paths.map(path => path.replace(/^\.\//, '/').replace(/\/$/, '').replace(/^\//, '')); } else { separator = '\\'; paths = paths.map(path => path.replace(/^\.\\/, '\\').replace(/\\$/, '').replace(/^\\/, '')); } return separator + paths.join(separator); } <|start_filename|>src/utils/isNode.js<|end_filename|> export default function() { return typeof global === 'object' && typeof process === 'object' && Object.prototype.toString.call(process) === '[object process]'; } <|start_filename|>src/module/info.js<|end_filename|> import dirname from '../utils/dirname'; import join from '../utils/join'; import caller from '../utils/caller'; export const isWebpack = loadFunc => { return ( loadFunc.match(/\/\* System\.import \*\/\(([^\)]*)\)/) || // webpack minimized loadFunc.match(/function[^}]*return[^}]*[a-zA-Z]\.[a-zA-Z]\([0-9]*\)\.then\([a-zA-Z]\.bind\(null, ?[0-9]*\)/) || // webpack minimized - arrow function loadFunc.match(/\(\)=>[a-zA-Z]\.[a-zA-Z]\([0-9]*\)\.then\([a-zA-Z]\.bind\(null, ?[0-9]*\)/) || // webpack normal loadFunc.match(/__webpack_require__/) || // webpack normal loadFunc.match(/r\.require\.loader/) ) ? true : false; }; export const isSystemImportTransformer = loadFunc => { return loadFunc.match(/ImportTransformer/) ? true : false; }; export const getWebpackId = loadFunc => { let matches = loadFunc.match(/\/\* System\.import \*\/\(([^\)]*)\)/); if (typeof matches === 'object' && matches !== null && typeof matches[1] !== 'undefined') { return matches[1]; } // webpack minimized matches = loadFunc.match(/function[^}]*return[^}]*[a-zA-Z]\.[a-zA-Z]\(([0-9]*)\)\.then\([a-zA-Z]\.bind\(null, ?[0-9]*\)/); if (typeof matches === 'object' && matches !== null && typeof matches[1] !== 'undefined') { return matches[1]; } // webpack normal matches = loadFunc.match(/function[^}]*return[^}]*\(([0-9]*)\).then/); if (typeof matches === 'object' && matches !== null && typeof matches[1] !== 'undefined') { return matches[1]; } // webpack normal - arrow function matches = loadFunc.match(/\(\)\s=>\s.*\(([0-9]*)\).then/); if (typeof matches === 'object' && matches !== null && typeof matches[1] !== 'undefined') { return matches[1]; } // system import matches = loadFunc.match(/__webpack_require__\(\(?([0-9]*)\)?\)\)/); if (typeof matches === 'object' && matches !== null && typeof matches[1] !== 'undefined') { return matches[1]; } // system import minimized matches = loadFunc.match(/Promise\.resolve\(n\(([0-9]*)\)\)/); if (typeof matches === 'object' && matches !== null && typeof matches[1] !== 'undefined') { return matches[1]; } return null; }; export const infoFromWebpack = loadFunc => ({ id: getWebpackId(loadFunc) }); export const infoFromSystemImportTransformer = (loadFunc, module) => { const matches = loadFunc.match(/require\(([^)\]]*)/); let file = matches[1].replace(/[\[\('"\\]*/g, ''); let parent; try { parent = caller()[0].getFileName(); } catch (err) { } if (!parent && module && typeof module.parent !== 'undefined' && typeof module.parent.filename !== 'undefined') { parent = module.parent.filename; } return { filename: join(dirname(parent), file), id: getWebpackId(loadFunc) }; }; export default (currentModule, loadFunc) => { loadFunc = loadFunc.toString(); let finalModule = {}; if (isSystemImportTransformer(loadFunc)) { finalModule = { type: 'systemImportTransformer', ...finalModule, ...infoFromSystemImportTransformer(loadFunc, currentModule) }; } else if (isWebpack(loadFunc)) { finalModule = { type: 'webpack', ...finalModule, ...infoFromWebpack(loadFunc) }; } return () => { return finalModule; }; }; <|start_filename|>test/tests/stats/extractModules.js<|end_filename|> import * as React from 'react'; import { expect } from 'chai'; import webpack from 'webpack'; import webpackConfig from './includes/webpack.config'; import renderToString from '../../../src/renderer/renderToString'; import extractModules from '../../../src/stats/extractModules'; describe('stats', () => { it('should extract modules from webpack stats', function (done) { this.timeout(15000); webpack(webpackConfig, () => { Promise.all([System.import('./includes/bundle'), System.import('./includes/stats.json')]) .then(([{default: App}, stats]) => { renderToString(<App/>) .then(({ modules }) => { const extractedModules = extractModules(modules, stats); expect(extractedModules[0]).to.have.property('id'); expect(extractedModules[0]).to.have.property('files'); done(); }) }); }); }); }); <|start_filename|>src/index.js<|end_filename|> export { default as extractModules } from './stats/extractModules'; export { default as fetchState, withDone } from './components/fetchState'; export { default as Module } from './components/Module'; export { default as preload } from './module/preload'; export { default as renderToString } from './renderer/renderToString'; export { default as renderToStaticMarkup } from './renderer/renderToStaticMarkup'; export { default as ServerStateProvider } from './components/ServerStateProvider'; <|start_filename|>src/utils/removeDuplicateModules.js<|end_filename|> export default array => { const stack = []; return array.filter(item => { if (item.info.type === 'webpack') { const result = stack.indexOf(item.info.id); if (result === -1) { stack.push(item.info.id); return true; } } else { const result = stack.indexOf(item.info.filename); if (result === -1) { stack.push(item.info.filename); return true; } } return false; }); }; <|start_filename|>src/module/load.js<|end_filename|> import { default as info } from './info'; export default (currentModule, load) => { const nextInfo = info(currentModule, load); return (load) => load.then(loadedModule => { const info = nextInfo(); return { info, module: loadedModule }; }); }; <|start_filename|>test/tests/components/module/includes/app.js<|end_filename|> import * as React from 'react'; import Module from '../../../../../src/components/Module'; export default props => ( <Module module={() => System.import('./Foo')} name="foo" > { Foo => Foo && <Foo.default/> } </Module> );
mehrdad-shokri/react-router-server
<|start_filename|>buscanime/lib/src/model/constants.dart<|end_filename|> const String baseUrl = 'https://api.jikan.moe/v3'; enum SeasonType { winter, spring, summer, fall } enum ForumType { all, episode, other } enum GenreType { anime, manga } enum HistoryType { anime, manga } enum SearchType { anime, manga, person, character } enum TopType { anime, manga, people, characters } enum TopSubtype { airing, upcoming, tv, movie, ova, special, manga, novels, oneshots, doujin, manhwa, manhua, bypopularity, favorite, } enum ListType { all, completed, watching, reading, onhold, dropped, plantowatch, plantoread, } enum WeekDay { monday, tuesday, wednesday, thursday, friday, saturday, sunday, other, unknown, }
Waffle631/Proyecto-IWG
<|start_filename|>src/test/java/com/aliyun/odps/jdbc/OdpsPreparedStatementTest.java<|end_filename|> /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package com.aliyun.odps.jdbc; import java.math.BigDecimal; import java.sql.Connection; import java.sql.Date; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.sql.Time; import java.sql.Timestamp; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.TimeZone; import org.junit.Assert; import org.junit.Test; import com.aliyun.odps.data.Record; import com.aliyun.odps.data.RecordWriter; import com.aliyun.odps.data.Varchar; import com.aliyun.odps.tunnel.TableTunnel; public class OdpsPreparedStatementTest { @Test public void testSetAll() throws Exception { Statement stmt = TestManager.getInstance().conn.createStatement(); stmt.executeUpdate("drop table if exists dual;"); stmt.executeUpdate("create table if not exists dual(id bigint);"); TableTunnel.UploadSession upload = TestManager.getInstance().tunnel.createUploadSession( TestManager.getInstance().odps.getDefaultProject(), "dual"); RecordWriter writer = upload.openRecordWriter(0); Record r = upload.newRecord(); r.setBigint(0, 42L); writer.write(r); writer.close(); upload.commit(new Long[]{0L}); PreparedStatement pstmt; pstmt = TestManager.getInstance().conn.prepareStatement( "select ? c1, ? c2, ? c3, ? c4, ? c5, ? c6, " + "? c7, ? c8, ? c9, ? c10, ? c11, ? c12, ? c13 from dual;"); long unixtime = new java.util.Date().getTime(); pstmt.setBigDecimal(1, BigDecimal.TEN); pstmt.setBoolean(2, Boolean.TRUE); pstmt.setByte(3, Byte.MAX_VALUE); pstmt.setDate(4, new Date(unixtime)); pstmt.setDouble(5, Double.MAX_VALUE); pstmt.setFloat(6, Float.MAX_VALUE); pstmt.setInt(7, Integer.MAX_VALUE); pstmt.setObject(8, 0.314); pstmt.setLong(9, Long.MAX_VALUE); pstmt.setShort(10, Short.MAX_VALUE); pstmt.setString(11, "hello"); pstmt.setTime(12, new Time(unixtime)); pstmt.setTimestamp(13, Timestamp.valueOf("2019-05-27 00:00:00.123456789")); { ResultSet rs = pstmt.executeQuery(); rs.next(); Assert.assertEquals(BigDecimal.TEN, rs.getBigDecimal(1)); Assert.assertEquals(Boolean.TRUE, rs.getBoolean(2)); Assert.assertEquals(Byte.MAX_VALUE, rs.getByte(3)); Assert.assertEquals(new Date(unixtime).toString(), rs.getDate(4).toString()); Assert.assertEquals(Double.MAX_VALUE, rs.getDouble(5), 0); Assert.assertEquals(Float.MAX_VALUE, rs.getFloat(6), 0); Assert.assertEquals(Integer.MAX_VALUE, rs.getInt(7)); Assert.assertEquals(0.314, rs.getDouble(8), 0); Assert.assertEquals(Long.MAX_VALUE, rs.getLong(9)); Assert.assertEquals(Short.MAX_VALUE, rs.getShort(10)); Assert.assertEquals("hello", rs.getString(11)); Assert.assertEquals(new Time(unixtime).toString(), rs.getTime(12).toString()); Assert.assertEquals("2019-05-27 00:00:00.123456789", rs.getTimestamp(13).toString()); rs.close(); } pstmt.close(); } @Test public void testSetAllWithNewType() throws SQLException, ParseException { Connection conn = TestManager.getInstance().conn; Statement ddl = conn.createStatement(); ddl.execute("set odps.sql.type.system.odps2=true;"); ddl.execute("set odps.sql.decimal.odps2=true;"); ddl.executeUpdate("drop table if exists insert_with_new_type;"); ddl.executeUpdate("create table insert_with_new_type(c1 TINYINT, c2 SMALLINT, c3 INT," + "c4 BIGINT, c5 FLOAT, c6 DOUBLE, c7 DECIMAL(38, 18), c8 VARCHAR(255)," + "c9 STRING, c10 DATETIME, c11 TIMESTAMP, c12 BOOLEAN, c13 DATE);"); PreparedStatement ps = conn.prepareStatement("insert into insert_with_new_type values " + "(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);"); SimpleDateFormat datetimeFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); java.util.Date datetime = datetimeFormat.parse("2019-09-23 14:25:00"); java.sql.Timestamp timestamp = java.sql.Timestamp.valueOf("2019-09-23 14:33:57.777"); Calendar gmtCalendar = new Calendar .Builder() .setTimeZone(TimeZone.getTimeZone("GMT")) .setCalendarType("iso8601") .set(Calendar.YEAR, 2020) .set(Calendar.MONTH, Calendar.JANUARY) .set(Calendar.DAY_OF_MONTH, 1).build(); java.sql.Date date = new java.sql.Date(gmtCalendar.getTime().getTime()); ps.setByte(1, new Byte("127")); ps.setShort(2, new Short("32767")); ps.setInt(3, new Integer("2147483647")); ps.setLong(4, new Long("9223372036854775807")); ps.setFloat(5, new Float("3.14")); ps.setDouble(6, new Double("3.141592653589")); ps.setBigDecimal(7, new BigDecimal("3.1415926535897932")); ps.setString(8, "foo"); ps.setString(9, "bar"); ps.setDate(10, new java.sql.Date(datetime.getTime())); ps.setTimestamp(11,timestamp); ps.setBoolean(12, true); ps.setDate(13, date); ps.execute(); Statement query = conn.createStatement(); ResultSet rs = query.executeQuery("select * from insert_with_new_type;"); while (rs.next()) { Assert.assertEquals(127, (byte) rs.getObject(1)); Assert.assertEquals(32767, (short) rs.getObject(2)); Assert.assertEquals(2147483647, (int) rs.getObject(3)); Assert.assertEquals(9223372036854775807L, (long) rs.getObject(4)); Assert.assertEquals(3.14, (float) rs.getObject(5), 0.001); Assert.assertEquals(3.141592653589, (double) rs.getObject(6), 0.0000000000001); Assert.assertEquals(new BigDecimal("3.1415926535897932"), rs.getObject(7)); Assert.assertEquals(new Varchar("foo"), rs.getObject(8)); Assert.assertEquals("bar", rs.getObject(9)); Assert.assertEquals(datetime.toString(), rs.getObject(10).toString()); Assert.assertEquals(timestamp.toString(), rs.getObject(11).toString()); Assert.assertEquals(true, rs.getObject(12)); Assert.assertEquals(date.getTime(), rs.getDate(13).getTime()); } ddl.executeUpdate("drop table if exists batch_insert_with_new_type;"); ddl.close(); } @Test public void testBatchInsert() throws Exception { Connection conn = TestManager.getInstance().conn; Statement ddl = conn.createStatement(); ddl.executeUpdate("drop table if exists employee_test;"); ddl.executeUpdate( "create table employee_test(c1 bigint, c2 string, c3 datetime, c4 boolean, c5 double, c6 decimal);"); ddl.close(); PreparedStatement ps = conn.prepareStatement( "insert into employee_test values (?, ?, ?, ?, ?, ?);"); final int batchSize = 10000; int count = 0; long unixtime = new java.util.Date().getTime(); for (int i = 0; i < 10; i++) { ps.setLong(1, 9999); ps.setString(2, "hello"); ps.setTime(3, new Time(unixtime)); ps.setBoolean(4, true); ps.setDouble(5, 3.141590261234F); ps.setBigDecimal(6, BigDecimal.TEN); ps.addBatch(); if(++count % batchSize == 0) { ps.executeBatch(); } } ps.executeBatch(); // insert remaining records ps.close(); Statement query = conn.createStatement(); ResultSet rs = query.executeQuery("select * from employee_test"); while (rs.next()) { Assert.assertEquals(rs.getInt(1), 9999); Assert.assertEquals(rs.getString(2), "hello"); Assert.assertEquals(rs.getTime(3), new Time(unixtime)); Assert.assertTrue(rs.getBoolean(4)); Assert.assertEquals(rs.getDouble(5), 3.141590261234F, 0); Assert.assertEquals(rs.getBigDecimal(6), BigDecimal.TEN); count--; } Assert.assertEquals(count, 0); rs.close(); query.close(); } @Test public void testBatchInsertWithNewType() throws SQLException, ParseException { Connection conn = TestManager.getInstance().conn; Statement ddl = conn.createStatement(); ddl.execute("set odps.sql.type.system.odps2=true;"); ddl.execute("set odps.sql.decimal.odps2=true;"); ddl.executeUpdate("drop table if exists batch_insert_with_new_type;"); ddl.executeUpdate("create table batch_insert_with_new_type(c1 TINYINT, c2 SMALLINT, c3 INT, " + "c4 BIGINT, c5 FLOAT, c6 DOUBLE, c7 DECIMAL(38, 18), c8 VARCHAR(255), " + "c9 STRING, c10 DATETIME, c11 TIMESTAMP, c12 BOOLEAN, c13 DATE);"); PreparedStatement ps = conn.prepareStatement("insert into batch_insert_with_new_type values " + "(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);"); // insert 10 rows SimpleDateFormat datetimeFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); java.util.Date datetime = datetimeFormat.parse("2019-09-23 14:25:00"); java.sql.Timestamp timestamp = java.sql.Timestamp.valueOf("2019-09-23 14:33:57.777"); Calendar gmtCalendar = new Calendar .Builder() .setTimeZone(TimeZone.getTimeZone("GMT")) .setCalendarType("iso8601") .set(Calendar.YEAR, 2020) .set(Calendar.MONTH, Calendar.JANUARY) .set(Calendar.DAY_OF_MONTH, 1).build(); java.sql.Date date = new java.sql.Date(gmtCalendar.getTime().getTime()); for (int i = 0; i < 10; i++) { ps.setByte(1, new Byte("127")); ps.setShort(2, new Short("32767")); ps.setInt(3, new Integer("2147483647")); ps.setLong(4, new Long("9223372036854775807")); ps.setFloat(5, new Float("3.14")); ps.setDouble(6, new Double("3.141592653589")); ps.setBigDecimal(7, new BigDecimal("3.141592653589793238")); ps.setString(8, "foo"); ps.setString(9, "bar"); ps.setTimestamp(10, new java.sql.Timestamp(datetime.getTime())); ps.setTimestamp(11,timestamp); ps.setBoolean(12, true); ps.setDate(13, date); ps.addBatch(); } int[] results = ps.executeBatch(); ps.close(); for (int i : results) { Assert.assertEquals(1, i); } Statement query = conn.createStatement(); ResultSet rs = query.executeQuery("select * from batch_insert_with_new_type;"); while (rs.next()) { Assert.assertEquals(127, (byte) rs.getObject(1)); Assert.assertEquals(32767, (short) rs.getObject(2)); Assert.assertEquals(2147483647, (int) rs.getObject(3)); Assert.assertEquals(9223372036854775807L, (long) rs.getObject(4)); Assert.assertEquals(3.14, (float) rs.getObject(5), 0.001); Assert.assertEquals(3.141592653589, (double) rs.getObject(6), 0.0000000000001); Assert.assertEquals(new BigDecimal("3.141592653589793238"), rs.getObject(7)); Assert.assertEquals(new Varchar("foo"), rs.getObject(8)); Assert.assertEquals("bar", rs.getObject(9)); Assert.assertEquals(datetime.getTime(), ((java.util.Date) rs.getObject(10)).getTime()); Assert.assertEquals(timestamp.getTime(), ((java.sql.Timestamp) rs.getObject(11)).getTime()); Assert.assertEquals(timestamp.getNanos(), ((java.sql.Timestamp) rs.getObject(11)).getNanos()); Assert.assertEquals(true, rs.getObject(12)); Assert.assertEquals(date.getTime(), rs.getDate(13).getTime()); } ddl.executeUpdate("drop table if exists batch_insert_with_new_type;"); ddl.close(); } @Test public void testBatchInsertNullAndFetch() throws Exception { Connection conn = TestManager.getInstance().conn; Statement ddl = conn.createStatement(); ddl.executeUpdate("drop table if exists employee_test;"); ddl.executeUpdate("create table employee_test(c1 bigint, c2 string, c3 datetime, c4 boolean, c5 double, c6 decimal);"); ddl.close(); PreparedStatement ps = conn.prepareStatement( "insert into employee_test values (?, ?, ?, ?, ?, ?);"); final int batchSize = 20; int count = 0; for (int i = 0; i < 120; i++) { ps.setNull(1, -1); ps.setNull(2, -1); ps.setNull(3, -1); ps.setNull(4, -1); ps.setNull(5, -1); ps.setNull(6, -1); ps.addBatch(); if(++count % batchSize == 0) { ps.executeBatch(); } } ps.executeBatch(); // insert remaining records ps.close(); Statement query = conn.createStatement(); ResultSet rs = query.executeQuery("select * from employee_test"); while (rs.next()) { Assert.assertEquals(0, rs.getInt(1)); Assert.assertTrue(rs.wasNull()); Assert.assertNull(rs.getString(2)); Assert.assertTrue(rs.wasNull()); Assert.assertNull(rs.getTime(3)); Assert.assertTrue(rs.wasNull()); Assert.assertFalse(rs.getBoolean(4)); Assert.assertTrue(rs.wasNull()); Assert.assertEquals(0.0f, rs.getFloat(5), 0); Assert.assertTrue(rs.wasNull()); Assert.assertNull(rs.getBigDecimal(6)); Assert.assertTrue(rs.wasNull()); count--; } Assert.assertEquals(0, count); rs.close(); query.close(); } } <|start_filename|>example/src/main/java/Pagination.java<|end_filename|> import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.Scanner; public class Pagination { private static void printPage(ResultSet res, int start, int count) throws SQLException { // 表头 int columnCount = res.getMetaData().getColumnCount(); for (int i = 0; i < columnCount; i++) { System.out.print(res.getMetaData().getColumnName(i + 1)); if (i < columnCount - 1) { System.out.print(" | "); } else { System.out.print("\n"); } } // 表内容 res.absolute(start - 1); int c = 0; while (res.next()) { for (int i = 0; i < columnCount; i++) { System.out.print(res.getString(i + 1)); if (i < columnCount - 1) { System.out.print(" | "); } else { System.out.print("\n"); } } c++; if (c == count) { break; } } } public static void main(String[] args) throws SQLException { if (args.length < 3) { System.out.println("Usage: Pagination connection_string sql record_per_page"); System.out.println( " eg. Pagination 'jdbc:odps:http://service.odps.aliyun.com/api?project=odpsdemo?accessId=...&accessKey=...&charset=UTF-8' 'select * from dual' 10"); System.exit(1); } String connectionString = args[0]; String sql = args[1]; int recordPerPage = Integer.parseInt(args[2]); try { String driverName = "com.aliyun.odps.jdbc.OdpsDriver"; Class.forName(driverName); } catch (ClassNotFoundException e) { e.printStackTrace(); System.exit(1); } System.out.println("Connection: " + connectionString); Connection conn = DriverManager.getConnection(connectionString); ResultSet res; // SQL 只需运行一次,不要每显式一页都运行一个全新的 SQL System.out.println("Running : " + sql); if (sql.trim().equalsIgnoreCase("show tables")) { res = conn.getMetaData().getTables(null, null, null, null); } else { Statement stmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); res = stmt.executeQuery(sql); } // 获得 ResultSet 的记录数 res.last(); int recordCount = res.getRow(); // 计算页数 int pageCount = (int) Math.ceil(1.0 * recordCount / recordPerPage); while (true) { System.out.print("Page Count " + pageCount + ", please input page number (0 to exit): "); Scanner scanner = new Scanner(System.in); int p = scanner.nextInt(); if (p == 0) { break; } // 根据输入的页号 p 显式页 printPage(res, (p - 1) * recordPerPage + 1, recordPerPage); } // 退出分页时关闭 ResultSet 和 Connection res.close(); conn.close(); } } <|start_filename|>example/src/main/java/OdpsJdbcClient.java<|end_filename|> import java.io.IOException; import java.io.InputStream; import java.sql.SQLException; import java.sql.Connection; import java.sql.ResultSet; import java.sql.Statement; import java.sql.DriverManager; import java.util.Properties; public class OdpsJdbcClient { private static String driverName = "com.aliyun.odps.jdbc.OdpsDriver"; /** * @param args * @throws SQLException */ public static void main(String[] args) throws SQLException { try { Class.forName(driverName); } catch (ClassNotFoundException e) { e.printStackTrace(); System.exit(1); } // fill in the information string Properties odpsConfig = new Properties(); InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream("conf.properties"); try { odpsConfig.load(is); } catch (IOException e) { e.printStackTrace(); System.exit(1); } String accessId = odpsConfig.getProperty("access_id"); String accessKey = odpsConfig.getProperty("access_key"); Connection conn = DriverManager.getConnection(odpsConfig.getProperty("endpoint"), accessId, accessKey); Statement stmt = conn.createStatement(); String tableName = "testOdpsDriverTable"; stmt.execute("drop table if exists " + tableName); stmt.execute("create table " + tableName + " (key int, value string)"); String sql; ResultSet res; // insert a record sql = String.format("insert into table %s select 24 key, 'hours' value from (select count(1) from %s) a", tableName, tableName); System.out.println("Running: " + sql); int count = stmt.executeUpdate(sql); System.out.println("updated records: " + count); // select * query sql = "select * from " + tableName; System.out.println("Running: " + sql); res = stmt.executeQuery(sql); while (res.next()) { System.out.println(String.valueOf(res.getInt(1)) + "\t" + res.getString(2)); } // regular query sql = "select count(1) from " + tableName; System.out.println("Running: " + sql); res = stmt.executeQuery(sql); while (res.next()) { System.out.println(res.getString(1)); } } } <|start_filename|>src/main/java/com/aliyun/odps/jdbc/JdbcSessionTest.java<|end_filename|> package com.aliyun.odps.jdbc; import java.sql.*; public class JdbcSessionTest { // res will be closed in this function private static void printResultSet(ResultSet res) throws SQLException { int columnCount = res.getMetaData().getColumnCount(); for (int i = 0; i < columnCount; i++) { System.out.print(res.getMetaData().getColumnName(i + 1)); if (i < columnCount - 1) { System.out.print(" | "); } else { System.out.print("\n"); } } while (res.next()) { for (int i = 0; i < columnCount; i++) { System.out.print(res.getString(i + 1)); if (i < columnCount - 1) { System.out.print(" | "); } else { System.out.print("\n"); } } } res.close(); } public static void main(String[] args) throws SQLException { if (args.length < 2) { System.out.println("Usage: java -cp odps-jdbc-...-jar-with-dependencies.jar com.aliyun.odps.jdbc.JdbcTest connection_string sql"); System.out.println( " eg. JdbcTest 'jdbc:odps:http://service.odps.aliyun.com/api?project=odpsdemo&accessId=..." + "&accessKey=...&charset=UTF-8&interactiveMode=true&interactiveServiceName=public.default&majorVersion=default&longPolling=false' 'select * from dual'"); System.exit(1); } String connectionString = args[0]; String sql = args[1]; try { String driverName = "com.aliyun.odps.jdbc.OdpsDriver"; Class.forName(driverName); } catch (ClassNotFoundException e) { e.printStackTrace(); System.exit(1); } System.out.println("Connection: " + connectionString); Connection conn = DriverManager.getConnection(connectionString); ResultSet res; try { System.out.println("Running : " + sql); if (sql.trim().equalsIgnoreCase("show tables")) { res = conn.getMetaData().getTables(null, null, null, null); } else { Statement stmt = conn.createStatement(); res = stmt.executeQuery(sql); } System.out.println("Result :"); printResultSet(res); } catch (Exception e) { throw e; } finally { conn.close(); } } } <|start_filename|>src/main/java/com/aliyun/odps/jdbc/OdpsStatement.java<|end_filename|> /* * Licensed to the Apache Software Foundation (ASF) under one or more contributor license * agreements. See the NOTICE file distributed with this work for additional information regarding * copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance with the License. You may obtain a * copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under the License * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express * or implied. See the License for the specific language governing permissions and limitations under * the License. */ package com.aliyun.odps.jdbc; import java.io.BufferedReader; import java.io.IOException; import java.io.StringReader; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.SQLFeatureNotSupportedException; import java.sql.SQLWarning; import java.sql.Statement; import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.stream.Collectors; import com.aliyun.odps.*; import com.aliyun.odps.Instance.Status; import com.aliyun.odps.Instance.TaskStatus; import com.aliyun.odps.sqa.SQLExecutor; import org.apache.commons.lang.StringEscapeUtils; import com.aliyun.odps.jdbc.utils.OdpsLogger; import com.aliyun.odps.jdbc.utils.Utils; import com.aliyun.odps.task.SQLTask; import com.aliyun.odps.tunnel.InstanceTunnel; import com.aliyun.odps.tunnel.InstanceTunnel.DownloadSession; import com.aliyun.odps.tunnel.TunnelException; import com.aliyun.odps.type.TypeInfo; import com.aliyun.odps.type.TypeInfoFactory; import com.aliyun.odps.utils.StringUtils; public class OdpsStatement extends WrapperAdapter implements Statement { /** * TODO: Hack, remove later */ private static Pattern DESC_TABLE_PATTERN = Pattern.compile( "\\s*(DESCRIBE|DESC)\\s+([^;]+);?", Pattern.CASE_INSENSITIVE|Pattern.DOTALL); private static Pattern SHOW_TABLES_PATTERN = Pattern.compile( "\\s*SHOW\\s+TABLES\\s*;?", Pattern.CASE_INSENSITIVE|Pattern.DOTALL); private static Pattern SHOW_PARTITIONS_PATTERN = Pattern.compile( "\\s*SHOW\\s+PARTITIONS\\s+([^;]+);?", Pattern.CASE_INSENSITIVE|Pattern.DOTALL); private static final Pattern TABLE_PARTITION_PATTERN = Pattern.compile( "\\s*([\\w\\.]+)(\\s*|(\\s+PARTITION\\s*\\((.*)\\)))\\s*", Pattern.CASE_INSENSITIVE); public static String[] parseTablePartition(String tablePartition) { String[] ret = new String[2]; Matcher m = TABLE_PARTITION_PATTERN.matcher(tablePartition); boolean match = m.matches(); if (match && m.groupCount() >= 1) { ret[0] = m.group(1); } if (match && m.groupCount() >= 4) { ret[1] = m.group(4); } return ret; } private void descTablePartition(String tablePartition) throws SQLException { String[] parsedTablePartition = parseTablePartition(tablePartition); if (parsedTablePartition[0] == null) { throw new SQLException("Invalid argument: " + tablePartition); } OdpsResultSetMetaData meta = new OdpsResultSetMetaData( Arrays.asList("col_name", "data_type", "comment"), Arrays.asList(TypeInfoFactory.STRING, TypeInfoFactory.STRING, TypeInfoFactory.STRING)); List<Object[]> rows = new LinkedList<>(); try { Table t = connHandle.getOdps().tables().get(parsedTablePartition[0]); addColumnDesc(t.getSchema().getColumns(), rows); addColumnDesc(t.getSchema().getPartitionColumns(), rows); if (t.isPartitioned()) { rows.add(new String[] {"", null, null}); rows.add(new String[] {"# Partition Information", null, null}); rows.add(new String[] {"# col_name", "data_type", "comment"}); rows.add(new String[] {"", null, null}); addColumnDesc(t.getSchema().getPartitionColumns(), rows); if (parsedTablePartition[1] != null) { Partition partition = t.getPartition(new PartitionSpec(parsedTablePartition[1])); PartitionSpec spec = partition.getPartitionSpec(); rows.add(new String[] {"", null, null}); rows.add(new String[] {"# Detailed Partition Information", null, null}); List<String> partitionValues = partition.getPartitionSpec().keys() .stream() .map(spec::get) .collect(Collectors.toList()); rows.add(new String[] {"Partition Value:", String.join(", ",partitionValues), null}); rows.add(new String[] {"Database:", connHandle.getOdps().getDefaultProject(), null}); rows.add(new String[] {"Table:", parsedTablePartition[0], null}); rows.add(new String[] {"CreateTime:", partition.getCreatedTime().toString(), null}); rows.add(new String[] {"LastDDLTime:", partition.getLastMetaModifiedTime().toString(), null}); rows.add(new String[] {"LastModifiedTime:", partition.getLastDataModifiedTime().toString(), null}); } } } catch (Exception e) { throw new SQLException(e); } resultSet = new OdpsStaticResultSet(connHandle, meta, rows.iterator()); } private void addColumnDesc(List<Column> columns, List<Object[]> rows) { for (Column c : columns) { String[] row = new String[3]; row[0] = c.getName(); row[1] = c.getTypeInfo().getTypeName(); row[2] = c.getComment(); rows.add(row); } } private void showTables() throws SQLException { OdpsResultSetMetaData meta = new OdpsResultSetMetaData(Collections.singletonList("tab_name"), Collections.singletonList(TypeInfoFactory.STRING)); List<Object[]> rows = new LinkedList<>(); for (Table table : connHandle.getOdps().tables()) { rows.add(new String[] {table.getName()}); } resultSet = new OdpsStaticResultSet(connHandle, meta, rows.iterator()); } private void showPartitions(String table) throws SQLException { OdpsResultSetMetaData meta = new OdpsResultSetMetaData(Collections.singletonList("partition"), Collections.singletonList(TypeInfoFactory.STRING)); List<Object[]> rows = new LinkedList<>(); for (Partition partition : connHandle.getOdps().tables().get(table).getPartitions()) { rows.add(new String[] {partition.getPartitionSpec().toString(false, true)}); } resultSet = new OdpsStaticResultSet(connHandle, meta, rows.iterator()); } private OdpsConnection connHandle; private Instance executeInstance = null; private ResultSet resultSet = null; private int updateCount = -1; private int queryTimeout = -1; // result cache in session mode com.aliyun.odps.data.ResultSet sessionResultSet = null; // when the update count is fetched by the client, set this true // Then the next call the getUpdateCount() will return -1, indicating there's no more results. // see Issue #15 boolean updateCountFetched = false; private boolean isClosed = false; private boolean isCancelled = false; private static final int POLLING_INTERVAL = 3000; private static final String JDBC_SQL_TASK_NAME = "jdbc_sql_task"; private static ResultSet EMPTY_RESULT_SET = null; static { try { OdpsResultSetMetaData meta = new OdpsResultSetMetaData(Collections.singletonList("N/A"), Collections.singletonList(TypeInfoFactory.STRING)); EMPTY_RESULT_SET = new OdpsStaticResultSet(null, meta, null); } catch (SQLException e) { e.printStackTrace(); } } /** * The attributes of result set produced by this statement */ protected boolean isResultSetScrollable = false; private Properties sqlTaskProperties; /** * The suggestion of fetch direction which might be ignored by the resultSet generated */ enum FetchDirection { FORWARD, REVERSE, UNKNOWN } protected FetchDirection resultSetFetchDirection = FetchDirection.UNKNOWN; protected int resultSetMaxRows = 0; protected int resultSetFetchSize = 10000; //Unit: result record row count, only applied in interactive mode protected Long resultCountLimit = null; //Unit: Bytes, only applied in interactive mode protected Long resultSizeLimit = null; protected boolean enableLimit = false; private SQLWarning warningChain = null; OdpsStatement(OdpsConnection conn) { this(conn, false); } OdpsStatement(OdpsConnection conn, boolean isResultSetScrollable) { this.connHandle = conn; sqlTaskProperties = (Properties) conn.getSqlTaskProperties().clone(); this.resultCountLimit = conn.getCountLimit(); this.resultSizeLimit = conn.getSizeLimit(); this.enableLimit = conn.enableLimit(); this.isResultSetScrollable = isResultSetScrollable; } @Override public void addBatch(String sql) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public void cancel() throws SQLException { checkClosed(); if (isCancelled || executeInstance == null) { return; } try { if (connHandle.runningInInteractiveMode()) { connHandle.getExecutor().cancel(); connHandle.log.info("submit cancel query instance id=" + executeInstance.getId()); } else { // If the instance has already terminated, calling Instance.stop# results in an exception. // Checking the instance status before calling Instance.stop# could handle most cases. But // if the instance terminated after the checking, an exception would still be thrown. if (!executeInstance.isTerminated()) { executeInstance.stop(); connHandle.log.info("submit cancel to instance id=" + executeInstance.getId()); } } } catch (OdpsException e) { throw new SQLException(e); } isCancelled = true; } @Override public void clearBatch() throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public void clearWarnings() throws SQLException { warningChain = null; } @Override public void close() throws SQLException { if (isClosed) { return; } if (resultSet != null) { resultSet.close(); resultSet = null; } connHandle.log.info("the statement has been closed"); connHandle = null; executeInstance = null; sessionResultSet = null; isClosed = true; } @Override public void closeOnCompletion() throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public int[] executeBatch() throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public synchronized ResultSet executeQuery(String sql) throws SQLException { Properties properties = new Properties(); // TODO: hack, remove later Matcher descTablePatternMatcher = DESC_TABLE_PATTERN.matcher(sql); Matcher showTablesPatternMatcher = SHOW_TABLES_PATTERN.matcher(sql); Matcher showPartitionsPatternMatcher = SHOW_PARTITIONS_PATTERN.matcher(sql); if (descTablePatternMatcher.matches()) { descTablePartition(descTablePatternMatcher.group(2)); return getResultSet(); } else if (showTablesPatternMatcher.matches()) { showTables(); return getResultSet(); } else if (showPartitionsPatternMatcher.matches()) { showPartitions(showPartitionsPatternMatcher.group(1)); return getResultSet(); } else { String query = Utils.parseSetting(sql, properties); if (StringUtils.isNullOrEmpty(query)) { // only settings, just set properties processSetClause(properties); return EMPTY_RESULT_SET; } // otherwise those properties is just for this query if (processUseClause(query)) { return EMPTY_RESULT_SET; } checkClosed(); beforeExecute(); runSQL(query, properties); return hasResultSet(query) ? getResultSet() : EMPTY_RESULT_SET; } } @Override public synchronized int executeUpdate(String sql) throws SQLException { Properties properties = new Properties(); String query = Utils.parseSetting(sql, properties); if (StringUtils.isNullOrEmpty(query)) { // only settings, just set properties processSetClause(properties); return 0; } // otherwise those properties is just for this query if (connHandle.runningInInteractiveMode()) { throw new SQLFeatureNotSupportedException("executeUpdate() is not supported in session mode."); } checkClosed(); beforeExecute(); runSQL(query, properties); return updateCount >= 0 ? updateCount : 0; } @Override public int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public int executeUpdate(String sql, int[] columnIndexes) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public int executeUpdate(String sql, String[] columnNames) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public boolean execute(String sql, int autoGeneratedKeys) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public boolean execute(String sql) throws SQLException { // short cut for SET clause Properties properties = new Properties(); // TODO: hack, remove later Matcher descTablePatternMatcher = DESC_TABLE_PATTERN.matcher(sql); Matcher showTablesPatternMatcher = SHOW_TABLES_PATTERN.matcher(sql); Matcher showPartitionsPatternMatcher = SHOW_PARTITIONS_PATTERN.matcher(sql); if (descTablePatternMatcher.matches()) { descTablePartition(descTablePatternMatcher.group(2)); return true; } else if (showTablesPatternMatcher.matches()) { showTables(); return true; } else if (showPartitionsPatternMatcher.matches()) { showPartitions(showPartitionsPatternMatcher.group(1)); return true; } else { String query = Utils.parseSetting(sql, properties); if (StringUtils.isNullOrEmpty(query)) { // only settings, just set properties processSetClause(properties); return false; } // otherwise those properties is just for this query if (processUseClause(query)) { return false; } checkClosed(); beforeExecute(); runSQL(query, properties); return hasResultSet(query); } } public boolean hasResultSet(String sql) throws SQLException { if (connHandle.runningInInteractiveMode()) { return true; } if (updateCount == 0) { return isQuery(sql); } else { return updateCount < 0; } } /** * * @param sql sql statement * @return if the input sql statement is a query statement * @throws SQLException */ public static boolean isQuery(String sql) throws SQLException { BufferedReader reader = new BufferedReader(new StringReader(sql)); try { String line; while ((line = reader.readLine()) != null) { if (line.matches("^\\s*(--|#).*")) { // skip the comment starting with '--' or '#' continue; } if (line.matches("^\\s*$")) { // skip the whitespace line continue; } // The first none-comment line start with "select" if (line.matches("(?i)^(\\s*)(SELECT).*$")) { return true; } else { break; } } } catch (IOException e) { throw new SQLException(e); } return false; } private void processSetClause(Properties properties) { for (String key : properties.stringPropertyNames()) { connHandle.log.info("set sql task property: " + key + "=" + properties.getProperty(key)); if (!connHandle.disableConnSetting()) { connHandle.getSqlTaskProperties().setProperty(key, properties.getProperty(key)); } sqlTaskProperties.setProperty(key, properties.getProperty(key)); } } private boolean processUseClause(String sql) throws SQLFeatureNotSupportedException { if (sql.matches("(?i)^(\\s*)(USE)(\\s+)(.*);?(\\s*)$")) { if (sql.contains(";")) { sql = sql.replace(';', ' '); } int i = sql.toLowerCase().indexOf("use"); String project = sql.substring(i + 3).trim(); if (project.length() > 0) { if (connHandle.runningInInteractiveMode()) { throw new SQLFeatureNotSupportedException( "ODPS-1850001 - 'use project' is not supported in odps jdbc for now."); } connHandle.getOdps().setDefaultProject(project); connHandle.log.info("set project to " + project); } return true; } return false; } @Override public boolean execute(String sql, int[] columnIndexes) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public boolean execute(String sql, String[] columnNames) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public OdpsConnection getConnection() throws SQLException { return connHandle; } @Override public int getFetchDirection() throws SQLException { checkClosed(); int direction; switch (resultSetFetchDirection) { case FORWARD: direction = ResultSet.FETCH_FORWARD; break; case REVERSE: direction = ResultSet.FETCH_REVERSE; break; default: direction = ResultSet.FETCH_UNKNOWN; } return direction; } @Override public int getFetchSize() throws SQLException { checkClosed(); return resultSetFetchSize; } @Override public void setFetchSize(int rows) throws SQLException { checkClosed(); resultSetFetchSize = rows; } @Override public ResultSet getGeneratedKeys() throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public int getMaxFieldSize() throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public int getMaxRows() throws SQLException { return resultSetMaxRows; } @Override public void setMaxRows(int max) throws SQLException { if (max < 0) { throw new SQLException("max must be >= 0"); } this.resultSetMaxRows = max; } @Override public boolean getMoreResults() throws SQLException { return false; } @Override public boolean getMoreResults(int current) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public int getQueryTimeout() throws SQLException { if (!connHandle.runningInInteractiveMode()) { throw new SQLFeatureNotSupportedException(); } else { return queryTimeout; } } @Override public void setQueryTimeout(int seconds) throws SQLException { if (seconds <= 0) { throw new IllegalArgumentException("Invalid query timeout:" + String.valueOf(seconds)); } if (!connHandle.runningInInteractiveMode()) { connHandle.log.error("OdpsDriver do not support query timeout, setQueryTimeout: " + seconds); } else { queryTimeout = seconds; } } @Override public ResultSet getResultSet() throws SQLException { long startTime = System.currentTimeMillis(); if (resultSet == null || resultSet.isClosed()) { DownloadSession session; InstanceTunnel tunnel = new InstanceTunnel(connHandle.getOdps()); String te = connHandle.getTunnelEndpoint(); if (!StringUtils.isNullOrEmpty(te)) { connHandle.log.info("using tunnel endpoint: " + te); tunnel.setEndpoint(te); } if (!connHandle.runningInInteractiveMode()) { // Create a download session through tunnel try { try { session = tunnel.createDownloadSession(connHandle.getOdps().getDefaultProject(), executeInstance.getId()); } catch (TunnelException e1) { connHandle.log.error("create download session failed: " + e1.getMessage()); connHandle.log.error("fallback to limit mode"); session = tunnel.createDownloadSession(connHandle.getOdps().getDefaultProject(), executeInstance.getId(), true); } connHandle.log.debug("create download session id=" + session.getId()); resultSet = isResultSetScrollable ? new OdpsScollResultSet(this, getResultMeta(session.getSchema().getColumns()), session, OdpsScollResultSet.ResultMode.OFFLINE) : new OdpsForwardResultSet(this, getResultMeta(session.getSchema().getColumns()), session, startTime); } catch (TunnelException e) { connHandle.log.error("create download session for session failed: " + e.getMessage()); e.printStackTrace(); if ("InstanceTypeNotSupported".equalsIgnoreCase(e.getErrorCode())) { return null; } else { throw new SQLException("create download session failed: instance id=" + executeInstance.getId() + ", Error:" + e.getMessage(), e); } } catch (IOException e) { connHandle.log.error("create download session for session failed: " + e.getMessage()); e.printStackTrace(); throw new SQLException("create download session failed: instance id=" + executeInstance.getId() + ", Error:" + e.getMessage(), e); } } else { if (sessionResultSet != null) { try { session = tunnel.createDirectDownloadSession( connHandle.getOdps().getDefaultProject(), connHandle.getExecutor().getInstance().getId(), connHandle.getExecutor().getTaskName(), connHandle.getExecutor().getSubqueryId(), enableLimit); OdpsResultSetMetaData meta = getResultMeta(sessionResultSet.getTableSchema().getColumns()); resultSet = isResultSetScrollable ? new OdpsScollResultSet(this, meta, session, OdpsScollResultSet.ResultMode.INTERACTIVE) : new OdpsSessionForwardResultSet(this, meta, sessionResultSet, startTime); sessionResultSet = null; } catch (TunnelException e) { connHandle.log.error("create download session for session failed: " + e.getMessage()); e.printStackTrace(); throw new SQLException("create session resultset failed: instance id=" + connHandle.getExecutor().getInstance().getId() + ", Error:" + e.getMessage(), e); } catch (IOException e) { connHandle.log.error("create download session for session failed: " + e.getMessage()); e.printStackTrace(); throw new SQLException("create session resultset failed: instance id=" + connHandle.getExecutor().getInstance().getId() + ", Error:" + e.getMessage(), e); } } } } return resultSet; } private OdpsResultSetMetaData getResultMeta(List<Column> columns) { // Read schema List<String> columnNames = new ArrayList<String>(); List<TypeInfo> columnSqlTypes = new ArrayList<TypeInfo>(); for (Column col : columns) { columnNames.add(col.getName()); columnSqlTypes.add(col.getTypeInfo()); } return new OdpsResultSetMetaData(columnNames, columnSqlTypes); } @Override public int getResultSetConcurrency() throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public int getResultSetHoldability() throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public int getResultSetType() throws SQLException { return ResultSet.TYPE_FORWARD_ONLY; } @Override public synchronized int getUpdateCount() throws SQLException { checkClosed(); if (updateCountFetched){ return -1; } updateCountFetched = true; if (executeInstance == null) { return -1; } return updateCount; } @Override public SQLWarning getWarnings() throws SQLException { return warningChain; } @Override public boolean isCloseOnCompletion() throws SQLException { return false; } @Override public boolean isClosed() throws SQLException { return isClosed; } @Override public boolean isPoolable() throws SQLException { return false; } @Override public void setCursorName(String name) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public void setEscapeProcessing(boolean enable) throws SQLException { } @Override public void setFetchDirection(int direction) throws SQLException { switch (direction) { case ResultSet.FETCH_FORWARD: resultSetFetchDirection = FetchDirection.FORWARD; break; case ResultSet.FETCH_REVERSE: resultSetFetchDirection = FetchDirection.REVERSE; break; case ResultSet.FETCH_UNKNOWN: resultSetFetchDirection = FetchDirection.UNKNOWN; break; default: throw new SQLException("invalid argument for setFetchDirection()"); } } @Override public void setMaxFieldSize(int max) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public void setPoolable(boolean poolable) throws SQLException { throw new SQLFeatureNotSupportedException(); } private void beforeExecute() throws SQLException { // If the statement re-executes another query, the previously-generated resultSet // will be implicit closed. And the corresponding temp table will be dropped as well. if (resultSet != null) { resultSet.close(); resultSet = null; } executeInstance = null; sessionResultSet = null; isClosed = false; isCancelled = false; updateCount = -1; updateCountFetched = false; } protected OdpsLogger getParentLogger() { return connHandle.log; } protected void checkClosed() throws SQLException { if (isClosed) { throw new SQLException("The statement has been closed"); } } private void runSQLOffline( String sql, Odps odps, Map<String,String> settings) throws SQLException, OdpsException { long begin = System.currentTimeMillis(); executeInstance = SQLTask.run(odps, odps.getDefaultProject(), sql, JDBC_SQL_TASK_NAME, settings, null); LogView logView = new LogView(odps); if (connHandle.getLogviewHost() != null) { logView.setLogViewHost(connHandle.getLogviewHost()); } String logViewUrl = logView.generateLogView(executeInstance, 7 * 24); connHandle.log.info("Run SQL: " + sql); connHandle.log.info(logViewUrl); warningChain = new SQLWarning(logViewUrl); // Poll the task status within the instance boolean complete = false; // 等待 instance 结束 while (!complete) { try { Thread.sleep(POLLING_INTERVAL); } catch (InterruptedException e) { break; } complete = Status.TERMINATED.equals(executeInstance.getStatus()); } TaskStatus taskStatus = executeInstance.getTaskStatus().get(JDBC_SQL_TASK_NAME); if (taskStatus == null) { connHandle.log.warn("Failed to get task status. " + "The instance may have been killed before its task was created."); } else { switch (taskStatus.getStatus()) { case SUCCESS: connHandle.log.debug("sql status: success"); break; case FAILED: try { String reason = executeInstance.getTaskResults().get(JDBC_SQL_TASK_NAME); connHandle.log.error("execute sql [" + sql + "] failed: " + reason); throw new SQLException("execute sql [" + sql + "] failed: " + reason, "FAILED"); } catch (OdpsException e) { connHandle.log.error("Fail to get task status:" + sql, e); throw new SQLException("Fail to get task status", e); } case CANCELLED: connHandle.log.info("execute instance cancelled"); throw new SQLException("execute instance cancelled", "CANCELLED"); case WAITING: case RUNNING: case SUSPENDED: connHandle.log.debug("sql status: " + taskStatus.getStatus()); break; default: } } long end = System.currentTimeMillis(); connHandle.log.info("It took me " + (end - begin) + " ms to run sql"); // extract update count Instance.TaskSummary taskSummary = null; try { taskSummary = executeInstance.getTaskSummary(JDBC_SQL_TASK_NAME); } catch (OdpsException e) { // update count become uncertain here connHandle.log.warn("Failed to get TaskSummary: instance_id=" + executeInstance.getId() + ", taskname=" + JDBC_SQL_TASK_NAME); } if (taskSummary != null) { updateCount = Utils.getSinkCountFromTaskSummary( StringEscapeUtils.unescapeJava(taskSummary.getJsonSummary())); } else { connHandle.log.warn("task summary is empty"); } connHandle.log.debug("successfully updated " + updateCount + " records"); } private void runSQLInSession(String sql, Map<String,String> settings) throws SQLException, OdpsException { long begin = System.currentTimeMillis(); SQLExecutor executor = connHandle.getExecutor(); if (queryTimeout != -1 && !settings.containsKey("odps.sql.session.query.timeout")) { settings.put("odps.sql.session.query.timeout", String.valueOf(queryTimeout)); } Long autoSelectLimit = connHandle.getAutoSelectLimit(); if (autoSelectLimit != null && autoSelectLimit > 0) { settings.put("odps.sql.select.auto.limit", autoSelectLimit.toString()); } executor.run(sql, settings); try { sessionResultSet = executor.getResultSet(0L, resultCountLimit, resultSizeLimit, enableLimit); List<String> exeLog = executor.getExecutionLog(); if (!exeLog.isEmpty()) { for (String log : exeLog) { connHandle.log.warn("Session execution log:" + log); } } } catch (IOException e) { connHandle.log.error("Run SQL failed", e); throw new SQLException("execute sql [" + sql + "] instance:[" + executor.getInstance().getId() + "] failed: " + e.getMessage(), e); } catch (OdpsException e) { connHandle.log.error("Run SQL failed", e); throw new SQLException("execute sql [" + sql + "] instance:[" + executor.getInstance().getId() + "] failed: " + e.getMessage(), e); } long end = System.currentTimeMillis(); connHandle.log.info("It took me " + (end - begin) + " ms to run sql"); executeInstance = executor.getInstance(); String logView = executor.getLogView(); connHandle.log.info("Run SQL: " + sql + ", LogView:" + logView); warningChain = new SQLWarning(executor.getSummary()); } private void runSQL(String sql, Properties properties) throws SQLException { try { // If the client forget to end with a semi-colon, append it. if (!sql.endsWith(";")) { sql += ";"; } Odps odps = connHandle.getOdps(); Map<String,String> settings = new HashMap<>(); for (String key : sqlTaskProperties.stringPropertyNames()) { settings.put(key, sqlTaskProperties.getProperty(key)); } if (properties != null && !properties.isEmpty()) { for (String key : properties.stringPropertyNames()) { settings.put(key, properties.getProperty(key)); } } if (!settings.isEmpty()) { connHandle.log.info("Enabled SQL task properties: " + settings); } if (!connHandle.runningInInteractiveMode()) { runSQLOffline(sql, odps, settings); } else { runSQLInSession(sql, settings); } } catch (OdpsException e) { connHandle.log.error("Fail to run sql: " + sql, e); throw new SQLException("Fail to run sql:" + sql + ", Error:" + e.toString(), e); } } public Instance getExecuteInstance() { return executeInstance; } public static String getDefaultTaskName() { return JDBC_SQL_TASK_NAME; } public Properties getSqlTaskProperties() { return sqlTaskProperties; } } <|start_filename|>src/main/java/com/aliyun/odps/jdbc/OdpsDriver.java<|end_filename|> /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package com.aliyun.odps.jdbc; import java.sql.Connection; import java.sql.Driver; import java.sql.DriverManager; import java.sql.DriverPropertyInfo; import java.sql.SQLException; import java.sql.SQLFeatureNotSupportedException; import java.util.Properties; import java.util.logging.Logger; import com.aliyun.odps.jdbc.utils.ConnectionResource; import com.aliyun.odps.jdbc.utils.Utils; public class OdpsDriver implements Driver { static { try { DriverManager.registerDriver(new OdpsDriver()); } catch (SQLException e) { e.printStackTrace(); } } /** * Is this driver JDBC compliant? */ private static final boolean JDBC_COMPLIANT = false; public OdpsDriver() { SecurityManager security = System.getSecurityManager(); if (security != null) { security.checkWrite("odps"); } } @Override public Connection connect(String url, Properties info) throws SQLException { return acceptsURL(url) ? new OdpsConnection(url, info) : null; } @Override public boolean acceptsURL(String url) throws SQLException { return ConnectionResource.acceptURL(url); } // each element is a DriverPropertyInfo object representing a connection URL attribute // that has not already been specified. @Override public DriverPropertyInfo[] getPropertyInfo(String url, Properties info) throws SQLException { ConnectionResource connRes = new ConnectionResource(url, info); DriverPropertyInfo accessIdProp = new DriverPropertyInfo(ConnectionResource.ACCESS_ID_PROP_KEY, connRes.getAccessId()); accessIdProp.required = true; accessIdProp.description = "ODPS access id"; DriverPropertyInfo accessKeyProp = new DriverPropertyInfo(ConnectionResource.ACCESS_KEY_PROP_KEY, connRes.getAccessKey()); accessKeyProp.required = true; accessKeyProp.description = "ODPS access key"; DriverPropertyInfo projectProp = new DriverPropertyInfo(ConnectionResource.PROJECT_PROP_KEY, connRes.getProject()); projectProp.required = true; projectProp.description = "ODPS default project"; DriverPropertyInfo charsetProp = new DriverPropertyInfo(ConnectionResource.CHARSET_PROP_KEY, connRes.getCharset()); charsetProp.required = false; charsetProp.description = "character set for the string type"; charsetProp.choices = new String[]{"UTF-8", "GBK"}; DriverPropertyInfo logviewProp = new DriverPropertyInfo(ConnectionResource.LOGVIEW_HOST_PROP_KEY, connRes.getLogview()); logviewProp.required = false; logviewProp.description = "logview host"; return new DriverPropertyInfo[]{accessIdProp, accessKeyProp, projectProp, charsetProp}; } @Override public int getMajorVersion() { try { return Integer.parseInt(Utils.retrieveVersion("driver.version").split("\\.")[0]); } catch (Exception e) { e.printStackTrace(); return 1; } } @Override public int getMinorVersion() { try { return Integer.parseInt(Utils.retrieveVersion("driver.version").split("\\.")[1]); } catch (Exception e) { e.printStackTrace(); return 0; } } @Override public boolean jdbcCompliant() { return JDBC_COMPLIANT; } public Logger getParentLogger() throws SQLFeatureNotSupportedException { return Logger.getLogger("com.aliyun.odps.jdbc"); } } <|start_filename|>src/main/java/com/aliyun/odps/jdbc/utils/Utils.java<|end_filename|> /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package com.aliyun.odps.jdbc.utils; import java.io.IOException; import java.util.Map; import java.util.Properties; import com.aliyun.odps.utils.StringUtils; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonParser; public class Utils { public static final String JDBC_USER_AGENT = "odps.idata.useragent"; public static final String JDBCKey = "driver.version"; public static final String SDKKey = "sdk.version"; public static String JDBCVersion = "JDBC-Version:" + retrieveVersion(JDBCKey); public static String SDKVersion = "SDK-Version:" + retrieveVersion(SDKKey); // see http://stackoverflow.com/questions/3697449/retrieve-version-from-maven-pom-xml-in-code public static String retrieveVersion(String key) { Properties prop = new Properties(); try { prop.load(Utils.class.getResourceAsStream("/version.properties")); return prop.getProperty(key); } catch (IOException e) { return "unknown"; } } public static boolean matchPattern(String s, String pattern) { if (StringUtils.isNullOrEmpty(pattern)) { return true; } pattern = pattern.toLowerCase(); s = s.toLowerCase(); if (pattern.contains("%") || pattern.contains("_")) { // (?<!a) looks 1 char behind and ensure not equal String wildcard = pattern.replaceAll("(?<!\\\\)%", "\\\\w*").replaceAll("(?<!\\\\)_", "\\\\w"); // escape / and % wildcard = wildcard.replace("\\%", "%").replace("\\_", "_"); if (!s.matches(wildcard)) { return false; } } else { if (!s.equals(pattern)) { return false; } } return true; } // return record count of sum(Outputs) in json summary // -1 if no Outputs public static int getSinkCountFromTaskSummary(String jsonSummary) { if (StringUtils.isNullOrEmpty(jsonSummary)) { return -1; } int ret = 0; try { JsonObject summary = new JsonParser().parse(jsonSummary).getAsJsonObject(); JsonObject outputs = summary.getAsJsonObject("Outputs"); if ("{}".equals(outputs.toString())) { return -1; } for (Map.Entry<String, JsonElement> entry : outputs.entrySet()) { ret += entry.getValue().getAsJsonArray().get(0).getAsInt(); } } catch (Exception e) { // do nothing e.printStackTrace(); } return ret; } public static String parseSetting(String sql, Properties properties) { if (StringUtils.isNullOrEmpty(sql)) { throw new IllegalArgumentException("Invalid query :" + sql); } sql = sql.trim(); if (!sql.endsWith(";")) { sql += ";"; } int index = 0; int end = 0; while ((end = sql.indexOf(';', index)) != -1) { String s = sql.substring(index, end); if (s.toUpperCase().matches("(?i)^(\\s*)(SET)(\\s+)(.*)=(.*);?(\\s*)$")) { // handle one setting int i = s.toLowerCase().indexOf("set"); String pairString = s.substring(i + 3); String[] pair = pairString.split("="); properties.put(pair[0].trim(), pair[1].trim()); index = end + 1; } else { // break if there is no settings before break; } } if (index >= sql.length()) { // only settings, no query behind return null; } else { // trim setting before query return sql.substring(index).trim(); } } } <|start_filename|>src/test/java/com/aliyun/odps/jdbc/utils/ConnectionResourceTest.java<|end_filename|> /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package com.aliyun.odps.jdbc.utils; import java.util.Properties; import org.junit.Assert; import org.junit.Test; public class ConnectionResourceTest { @Test public void connectionURLMinimumTest() { ConnectionResource cr = new ConnectionResource("jdbc:odps:haha?project=xixi", null); Assert.assertEquals("haha", cr.getEndpoint()); Assert.assertEquals("xixi", cr.getProject()); Assert.assertEquals(null, cr.getAccessId()); Assert.assertEquals(null, cr.getAccessKey()); Assert.assertEquals(null, cr.getLogview()); Assert.assertEquals("UTF-8", cr.getCharset()); } @Test public void connectionURLFullTest() { ConnectionResource cr = new ConnectionResource("jdbc:odps:haha?project=xixi&accessId=idid&accessKey=keykey&" + "logview=loglog&charset=setset&lifecycle=5&loglevel=FATAL", null); Assert.assertEquals("haha", cr.getEndpoint()); Assert.assertEquals("xixi", cr.getProject()); Assert.assertEquals("idid", cr.getAccessId()); Assert.assertEquals("keykey", cr.getAccessKey()); Assert.assertEquals("loglog", cr.getLogview()); Assert.assertEquals("setset", cr.getCharset()); } @Test public void connectionInfoFullTest() { Properties info = new Properties(); info.put("access_id", "idid"); info.put("access_key", "keykey"); info.put("logview_host", "loglog"); info.put("charset", "setset"); info.put("lifecycle", "5"); info.put("log_level", "FATAL"); ConnectionResource cr = new ConnectionResource("jdbc:odps:haha?project=xixi", info); Assert.assertEquals("haha", cr.getEndpoint()); Assert.assertEquals("xixi", cr.getProject()); Assert.assertEquals("idid", cr.getAccessId()); Assert.assertEquals("keykey", cr.getAccessKey()); Assert.assertEquals("loglog", cr.getLogview()); Assert.assertEquals("setset", cr.getCharset()); } @Test public void connectionInfoOverrideTest() { Properties info = new Properties(); info.put("access_id", "id"); info.put("access_key", "key"); info.put("logview_host", "log"); info.put("charset", "set"); info.put("lifecycle", "100"); info.put("log_level", "FATAL"); ConnectionResource cr = new ConnectionResource("jdbc:odps:haha?project=xixi&accessId=idid&accessKey=keykey&" + "logview=loglog&charset=setset&lifecycle=5&loglevel=INFO", info); Assert.assertEquals("haha", cr.getEndpoint()); Assert.assertEquals("xixi", cr.getProject()); Assert.assertEquals("id", cr.getAccessId()); Assert.assertEquals("key", cr.getAccessKey()); Assert.assertEquals("log", cr.getLogview()); Assert.assertEquals("set", cr.getCharset()); } } <|start_filename|>src/test/java/com/aliyun/odps/jdbc/ImplicitTypeConversionTest.java<|end_filename|> /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package com.aliyun.odps.jdbc; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import java.io.IOException; import java.io.UnsupportedEncodingException; import java.math.BigDecimal; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.sql.Timestamp; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.HashMap; import java.util.Map; import java.util.TimeZone; import org.junit.AfterClass; import org.junit.Assert; import org.junit.BeforeClass; import org.junit.Test; import com.aliyun.odps.Column; import com.aliyun.odps.OdpsException; import com.aliyun.odps.OdpsType; import com.aliyun.odps.TableSchema; import com.aliyun.odps.data.Record; import com.aliyun.odps.data.RecordWriter; import com.aliyun.odps.data.Varchar; import com.aliyun.odps.jdbc.utils.JdbcColumn; import com.aliyun.odps.tunnel.TableTunnel; import com.aliyun.odps.tunnel.TableTunnel.UploadSession; import com.aliyun.odps.type.TypeInfoFactory; /** * This test will create a table with all the data type of ODPS 2.0 and create */ public class ImplicitTypeConversionTest { private static final String TEST_TABLE = "implicit_type_conversion_test"; private static final String TEST_TABLE_NULL = "implicit_type_conversion_test_null"; private static final String TINYINT_COL = "t_tinyint"; private static final String SMALLINT_COL = "t_smallint"; private static final String INT_COL = "t_int"; private static final String BIGINT_COL = "t_bigint"; private static final String FLOAT_COL = "t_float"; private static final String DOUBLT_COL = "t_double"; private static final String DECIMAL_COL = "t_decimal"; private static final String VARCHAR_COL = "t_varchar"; private static final String STRING_COL_1 = "t_string_1"; private static final String STRING_COL_2 = "t_string_2"; private static final String DATETIME_COL = "t_datetime"; private static final String TIMESTAMP_COL = "t_timestamp"; private static final String BOOLEAN_COL = "t_boolean"; private static final String TINYINT_VAL = "1"; private static final String SMALLINT_VAL = "2"; private static final String INT_VAL = "3"; private static final String BIGINT_VAL = "4"; private static final String FLOAT_VAL = "4.5"; private static final String DOUBLE_VAL = "4.56"; private static final String DECIMAL_VAL = "4.567"; private static final String VARCHAR_VAL = "4.5678"; private static final String STRING_VAL_1 = "5"; private static final String STRING_VAL_2 = "2019-05-23 00:00:00"; private static Date DATETIME_VAL; private static Timestamp TIMESTAMP_VAL; private static final boolean BOOLEAN_VAL = true; private static ResultSet rs; private static ResultSet rsNull; // The charset in configuration must be 'UTF-8', which is the default value, or the test may fail private static String charset = "UTF-8"; private static SimpleDateFormat dateFormat = new SimpleDateFormat(JdbcColumn.ODPS_DATETIME_FORMAT); @BeforeClass public static void setUp() throws OdpsException, IOException, ParseException, SQLException { createTestTable(); createTestTableNull(); } private static void createTestTable() throws OdpsException, IOException, ParseException, SQLException { // Create table for test TestManager tm = TestManager.getInstance(); tm.odps.tables().delete(TEST_TABLE, true); TableSchema schema = getTestTableSchema(); Map<String, String> hints = new HashMap<String, String>(); hints.put("odps.sql.type.system.odps2", "true"); tm.odps.tables().create( tm.odps.getDefaultProject(), TEST_TABLE, schema, null, true, null,hints, null); // Upload a record TableTunnel tunnel = new TableTunnel(tm.odps); UploadSession uploadSession = tunnel.createUploadSession( tm.odps.getDefaultProject(), TEST_TABLE); RecordWriter writer = uploadSession.openRecordWriter(0); Record r = uploadSession.newRecord(); r.set(TINYINT_COL, Byte.parseByte(TINYINT_VAL)); r.set(SMALLINT_COL, Short.parseShort(SMALLINT_VAL)); r.set(INT_COL, Integer.parseInt(INT_VAL)); r.set(BIGINT_COL, Long.parseLong(BIGINT_VAL)); r.set(FLOAT_COL, Float.parseFloat(FLOAT_VAL)); r.set(DOUBLT_COL, Double.parseDouble(DOUBLE_VAL)); r.set(DECIMAL_COL, new BigDecimal(DECIMAL_VAL)); r.set(VARCHAR_COL, new Varchar(VARCHAR_VAL)); r.set(STRING_COL_1, STRING_VAL_1); r.set(STRING_COL_2, STRING_VAL_2); DATETIME_VAL = dateFormat.parse("2019-05-23 00:00:00"); r.set(DATETIME_COL, DATETIME_VAL); TIMESTAMP_VAL = Timestamp.valueOf("2019-05-23 00:00:00.123456789"); r.set(TIMESTAMP_COL, TIMESTAMP_VAL); r.set(BOOLEAN_COL, BOOLEAN_VAL); writer.write(r); writer.close(); uploadSession.commit(); // Query the test String sql = "select * from " + TEST_TABLE; Statement stmt = tm.conn.createStatement(); stmt.execute(sql); rs = stmt.getResultSet(); rs.next(); } private static void createTestTableNull() throws OdpsException, IOException, SQLException { // Create table for test TestManager tm = TestManager.getInstance(); tm.odps.tables().delete(TEST_TABLE_NULL, true); TableSchema schema = getTestTableSchema(); Map<String, String> hints = new HashMap<String, String>(); hints.put("odps.sql.type.system.odps2", "true"); tm.odps.tables().create( tm.odps.getDefaultProject(), TEST_TABLE_NULL, schema, null, true, null,hints, null); // Upload a record TableTunnel tunnel = new TableTunnel(tm.odps); UploadSession uploadSession = tunnel.createUploadSession( tm.odps.getDefaultProject(), TEST_TABLE_NULL); RecordWriter writer = uploadSession.openRecordWriter(0); Record r = uploadSession.newRecord(); r.set(TINYINT_COL, null); r.set(SMALLINT_COL, null); r.set(INT_COL, null); r.set(BIGINT_COL, null); r.set(FLOAT_COL, null); r.set(DOUBLT_COL, null); r.set(DECIMAL_COL, null); r.set(VARCHAR_COL, null); r.set(STRING_COL_1, null); r.set(STRING_COL_2, null); r.set(DATETIME_COL, null); r.set(TIMESTAMP_COL, null); r.set(BOOLEAN_COL, null); writer.write(r); writer.close(); uploadSession.commit(); // Query the test String sql = "select * from " + TEST_TABLE_NULL; Statement stmt = tm.conn.createStatement(); stmt.execute(sql); rsNull = stmt.getResultSet(); rsNull.next(); } private static TableSchema getTestTableSchema() { TableSchema schema = new TableSchema(); schema.addColumn( new Column(TINYINT_COL, TypeInfoFactory.getPrimitiveTypeInfo(OdpsType.TINYINT))); schema.addColumn( new Column(SMALLINT_COL, TypeInfoFactory.getPrimitiveTypeInfo(OdpsType.SMALLINT))); schema.addColumn( new Column(INT_COL, TypeInfoFactory.getPrimitiveTypeInfo(OdpsType.INT))); schema.addColumn( new Column(BIGINT_COL, TypeInfoFactory.getPrimitiveTypeInfo(OdpsType.BIGINT))); schema.addColumn( new Column(FLOAT_COL, TypeInfoFactory.getPrimitiveTypeInfo(OdpsType.FLOAT))); schema.addColumn( new Column(DOUBLT_COL, TypeInfoFactory.getPrimitiveTypeInfo(OdpsType.DOUBLE))); schema.addColumn( new Column(DECIMAL_COL, TypeInfoFactory.getDecimalTypeInfo(54,18))); schema.addColumn( new Column(VARCHAR_COL, TypeInfoFactory.getVarcharTypeInfo(200))); schema.addColumn( new Column(STRING_COL_1, TypeInfoFactory.getPrimitiveTypeInfo(OdpsType.STRING))); schema.addColumn( new Column(STRING_COL_2, TypeInfoFactory.getPrimitiveTypeInfo(OdpsType.STRING))); schema.addColumn( new Column(DATETIME_COL, TypeInfoFactory.getPrimitiveTypeInfo(OdpsType.DATETIME))); schema.addColumn( new Column(TIMESTAMP_COL, TypeInfoFactory.getPrimitiveTypeInfo(OdpsType.TIMESTAMP))); schema.addColumn( new Column(BOOLEAN_COL, TypeInfoFactory.getPrimitiveTypeInfo(OdpsType.BOOLEAN))); return schema; } @AfterClass public static void tearDown() throws OdpsException, SQLException { rs.close(); rsNull.close(); TestManager tm = TestManager.getInstance(); tm.odps.tables().delete(TEST_TABLE, true); tm.odps.tables().delete(TEST_TABLE_NULL, true); } /** * Test transformation from Byte object (from ODPS SDK) to JDBC types * @throws SQLException */ @Test public void testGetTinyInt() throws SQLException { Byte expected = Byte.parseByte(TINYINT_VAL); byte byteRes = rs.getByte(TINYINT_COL); assertEquals(expected.byteValue(), byteRes); // Valid implicit conversions short shortRes = rs.getShort(TINYINT_COL); assertEquals(expected.shortValue(), shortRes); int intRes = rs.getInt(TINYINT_COL); assertEquals(expected.intValue(), intRes); long longRes = rs.getLong(TINYINT_COL); assertEquals(expected.longValue(), longRes); float floatRes = rs.getFloat(TINYINT_COL); assertEquals(expected.floatValue(), floatRes, 0.0001); double doubleRes = rs.getDouble(TINYINT_COL); assertEquals(expected.doubleValue(), doubleRes, 0.0001); String stringRes = rs.getString(TINYINT_COL); assertEquals(expected.toString(), stringRes); byte[] byteArrayRes = rs.getBytes(TINYINT_COL); assertEquals(new String(expected.toString().getBytes()), new String(byteArrayRes)); boolean booleanRes = rs.getBoolean(TINYINT_COL); assertEquals(BOOLEAN_VAL, booleanRes); // Invalid implicit conversions try { rs.getBigDecimal(TINYINT_COL); fail(); } catch (SQLException e) { assertTrue(e.getMessage().contains("Cannot transform")); } try { rs.getDate(TINYINT_COL); fail(); } catch (SQLException e) { assertTrue(e.getMessage().contains("Cannot transform")); } try { rs.getTime(TINYINT_COL); fail(); } catch (SQLException e) { assertTrue(e.getMessage().contains("Cannot transform")); } try { rs.getTimestamp(TINYINT_COL); fail(); } catch (SQLException e) { assertTrue(e.getMessage().contains("Cannot transform")); } } @Test public void testGetSmallInt() throws SQLException { Short expected = Short.parseShort(SMALLINT_VAL); short shortRes = rs.getShort(SMALLINT_COL); assertEquals(expected.shortValue(), shortRes); // Valid implicit conversions byte byteRes = rs.getByte(SMALLINT_COL); assertEquals(expected.byteValue(), byteRes); int intRes = rs.getInt(SMALLINT_COL); assertEquals(expected.intValue(), intRes); long longRes = rs.getLong(SMALLINT_COL); assertEquals(expected.longValue(), longRes); float floatRes = rs.getFloat(SMALLINT_COL); assertEquals(expected.floatValue(), floatRes, 0.0001); double doubleRes = rs.getDouble(SMALLINT_COL); assertEquals(expected.doubleValue(), doubleRes, 0.0001); String stringRes = rs.getString(SMALLINT_COL); assertEquals(expected.toString(), stringRes); byte[] byteArrayRes = rs.getBytes(SMALLINT_COL); assertEquals(new String(expected.toString().getBytes()), new String(byteArrayRes)); boolean booleanRes = rs.getBoolean(SMALLINT_COL); assertEquals(BOOLEAN_VAL, booleanRes); // Invalid implicit conversions try { rs.getBigDecimal(SMALLINT_COL); fail(); } catch (SQLException e) { assertTrue(e.getMessage().contains("Cannot transform")); } try { rs.getDate(SMALLINT_COL); fail(); } catch (SQLException e) { assertTrue(e.getMessage().contains("Cannot transform")); } try { rs.getTime(SMALLINT_COL); fail(); } catch (SQLException e) { assertTrue(e.getMessage().contains("Cannot transform")); } try { rs.getTimestamp(SMALLINT_COL); fail(); } catch (SQLException e) { assertTrue(e.getMessage().contains("Cannot transform")); } } @Test public void testGetInt() throws SQLException { Integer expected = Integer.parseInt(INT_VAL); int intRes = rs.getInt(INT_COL); assertEquals(expected.intValue(), intRes); // Valid implicit conversions byte byteRes = rs.getByte(INT_COL); assertEquals(expected.byteValue(), byteRes); short shortRes = rs.getShort(INT_COL); assertEquals(expected.shortValue(), shortRes); long longRes = rs.getLong(INT_COL); assertEquals(expected.longValue(), longRes); float floatRes = rs.getFloat(INT_COL); assertEquals(expected.floatValue(), floatRes, 0.0001); double doubleRes = rs.getDouble(INT_COL); assertEquals(expected.doubleValue(), doubleRes, 0.0001); String stringRes = rs.getString(INT_COL); assertEquals(expected.toString(), stringRes); byte[] byteArrayRes = rs.getBytes(INT_COL); assertEquals(new String(expected.toString().getBytes()), new String(byteArrayRes)); boolean booleanRes = rs.getBoolean(INT_COL); assertEquals(BOOLEAN_VAL, booleanRes); // Invalid implicit conversions try { rs.getBigDecimal(INT_COL); fail(); } catch (SQLException e) { assertTrue(e.getMessage().contains("Cannot transform")); } try { rs.getDate(INT_COL); fail(); } catch (SQLException e) { assertTrue(e.getMessage().contains("Cannot transform")); } try { rs.getTime(INT_COL); fail(); } catch (SQLException e) { assertTrue(e.getMessage().contains("Cannot transform")); } try { rs.getTimestamp(INT_COL); fail(); } catch (SQLException e) { assertTrue(e.getMessage().contains("Cannot transform")); } } @Test public void testGetBigInt() throws SQLException { Long expected = Long.parseLong(BIGINT_VAL); long longRes = rs.getLong(BIGINT_COL); assertEquals(expected.longValue(), longRes); // Valid implicit conversions byte byteRes = rs.getByte(BIGINT_COL); assertEquals(expected.byteValue(), byteRes); short shortRes = rs.getShort(BIGINT_COL); assertEquals(expected.shortValue(), shortRes); int intRes = rs.getInt(BIGINT_COL); assertEquals(expected.intValue(), intRes); float floatRes = rs.getFloat(BIGINT_COL); assertEquals(expected.floatValue(), floatRes, 0.0001); double doubleRes = rs.getDouble(BIGINT_COL); assertEquals(expected.doubleValue(), doubleRes, 0.0001); String stringRes = rs.getString(BIGINT_COL); assertEquals(expected.toString(), stringRes); byte[] byteArrayRes = rs.getBytes(BIGINT_COL); assertEquals(new String(expected.toString().getBytes()), new String(byteArrayRes)); boolean booleanRes = rs.getBoolean(BIGINT_COL); assertEquals(BOOLEAN_VAL, booleanRes); // Invalid implicit conversions try { rs.getBigDecimal(BIGINT_COL); fail(); } catch (SQLException e) { assertTrue(e.getMessage().contains("Cannot transform")); } try { rs.getDate(BIGINT_COL); fail(); } catch (SQLException e) { assertTrue(e.getMessage().contains("Cannot transform")); } try { rs.getTime(BIGINT_COL); fail(); } catch (SQLException e) { assertTrue(e.getMessage().contains("Cannot transform")); } try { rs.getTimestamp(BIGINT_COL); fail(); } catch (SQLException e) { assertTrue(e.getMessage().contains("Cannot transform")); } } @Test public void testGetFloat() throws SQLException { Float expected = Float.parseFloat(FLOAT_VAL); float floatRes = rs.getFloat(FLOAT_COL); assertEquals(expected, floatRes, 0.0001); // Valid implicit conversions byte byteRes = rs.getByte(FLOAT_COL); assertEquals(expected.byteValue(), byteRes); short shortRes = rs.getShort(FLOAT_COL); assertEquals(expected.shortValue(), shortRes); int intRes = rs.getInt(FLOAT_COL); assertEquals(expected.intValue(), intRes); long longRes = rs.getLong(FLOAT_COL); assertEquals(expected.longValue(), longRes); double doubleRes = rs.getDouble(FLOAT_COL); assertEquals(expected.doubleValue(), doubleRes, 0.0001); String stringRes = rs.getString(FLOAT_COL); assertEquals(expected.toString(), stringRes); byte[] byteArrayRes = rs.getBytes(FLOAT_COL); assertEquals(new String(expected.toString().getBytes()), new String(byteArrayRes)); boolean booleanRes = rs.getBoolean(FLOAT_COL); assertEquals(BOOLEAN_VAL, booleanRes); // Invalid implicit conversions try { rs.getBigDecimal(FLOAT_COL); fail(); } catch (SQLException e) { assertTrue(e.getMessage().contains("Cannot transform")); } try { rs.getDate(FLOAT_COL); fail(); } catch (SQLException e) { assertTrue(e.getMessage().contains("Cannot transform")); } try { rs.getTime(FLOAT_COL); fail(); } catch (SQLException e) { assertTrue(e.getMessage().contains("Cannot transform")); } try { rs.getTimestamp(FLOAT_COL); fail(); } catch (SQLException e) { assertTrue(e.getMessage().contains("Cannot transform")); } } @Test public void testGetDouble() throws SQLException { Double expected = Double.parseDouble(DOUBLE_VAL); double doubleRes = rs.getDouble(DOUBLT_COL); assertEquals(expected, doubleRes, 0.0001); // Valid implicit conversions byte byteRes = rs.getByte(DOUBLT_COL); assertEquals(expected.byteValue(), byteRes); short shortRes = rs.getShort(DOUBLT_COL); assertEquals(expected.shortValue(), shortRes); int intRes = rs.getInt(DOUBLT_COL); assertEquals(expected.intValue(), intRes); long longRes = rs.getLong(DOUBLT_COL); assertEquals(expected.longValue(), longRes); float floatRes = rs.getFloat(DOUBLT_COL); assertEquals(expected.floatValue(), floatRes, 0.0001); String stringRes = rs.getString(DOUBLT_COL); assertEquals(expected.toString(), stringRes); byte[] byteArrayRes = rs.getBytes(DOUBLT_COL); assertEquals(new String(expected.toString().getBytes()), new String(byteArrayRes)); boolean booleanRes = rs.getBoolean(DOUBLT_COL); assertEquals(BOOLEAN_VAL, booleanRes); // Invalid implicit conversions try { rs.getBigDecimal(DOUBLT_COL); fail(); } catch (SQLException e) { assertTrue(e.getMessage().contains("Cannot transform")); } try { rs.getDate(DOUBLT_COL); fail(); } catch (SQLException e) { assertTrue(e.getMessage().contains("Cannot transform")); } try { rs.getTime(DOUBLT_COL); fail(); } catch (SQLException e) { assertTrue(e.getMessage().contains("Cannot transform")); } try { rs.getTimestamp(DOUBLT_COL); fail(); } catch (SQLException e) { assertTrue(e.getMessage().contains("Cannot transform")); } } @Test public void testGetDecimal() throws SQLException { BigDecimal expected = new BigDecimal(DECIMAL_VAL); BigDecimal bigDecimalRes = rs.getBigDecimal(DECIMAL_COL); assertEquals(expected, bigDecimalRes); // Valid implicit conversions byte byteRes = rs.getByte(DECIMAL_COL); assertEquals(expected.byteValue(), byteRes); short shortRes = rs.getShort(DECIMAL_COL); assertEquals(expected.shortValue(), shortRes); int intRes = rs.getInt(DECIMAL_COL); assertEquals(expected.intValue(), intRes); long longRes = rs.getLong(DECIMAL_COL); assertEquals(expected.longValue(), longRes); float floatRes = rs.getFloat(DECIMAL_COL); assertEquals(expected.floatValue(), floatRes, 0.0001); double doubleRes = rs.getDouble(DECIMAL_COL); assertEquals(expected.doubleValue(), doubleRes, 0.0001); String stringRes = rs.getString(DECIMAL_COL); assertEquals(expected.toString(), stringRes); byte[] byteArrayRes = rs.getBytes(DECIMAL_COL); assertEquals(new String(expected.toString().getBytes()), new String(byteArrayRes)); boolean booleanRes = rs.getBoolean(DECIMAL_COL); assertEquals(BOOLEAN_VAL, booleanRes); // Invalid implicit conversions try { rs.getDate(DECIMAL_COL); fail(); } catch (SQLException e) { assertTrue(e.getMessage().contains("Cannot transform")); } try { rs.getTime(DECIMAL_COL); fail(); } catch (SQLException e) { assertTrue(e.getMessage().contains("Cannot transform")); } try { rs.getTimestamp(DECIMAL_COL); fail(); } catch (SQLException e) { assertTrue(e.getMessage().contains("Cannot transform")); } } @Test public void testGetVarchar() throws SQLException, UnsupportedEncodingException { Varchar expected = new Varchar(VARCHAR_VAL); // Valid implicit conversions String stringRes = rs.getString(VARCHAR_COL); assertEquals(expected.toString(), stringRes); byte[] byteArrayRes = rs.getBytes(VARCHAR_COL); assertEquals(new String(expected.toString().getBytes(), charset), new String(byteArrayRes)); // Invalid implicit conversions try { rs.getByte(VARCHAR_COL); fail(); } catch (SQLException e) { assertTrue(e.getMessage().contains("Cannot transform")); } try { rs.getShort(VARCHAR_COL); fail(); } catch (SQLException e) { assertTrue(e.getMessage().contains("Cannot transform")); } try { rs.getInt(VARCHAR_COL); fail(); } catch (SQLException e) { assertTrue(e.getMessage().contains("Cannot transform")); } try { rs.getLong(VARCHAR_COL); fail(); } catch (SQLException e) { assertTrue(e.getMessage().contains("Cannot transform")); } try { rs.getFloat(VARCHAR_COL); fail(); } catch (SQLException e) { assertTrue(e.getMessage().contains("Cannot transform")); } try { rs.getDouble(VARCHAR_COL); fail(); } catch (SQLException e) { assertTrue(e.getMessage().contains("Cannot transform")); } try { rs.getBigDecimal(VARCHAR_COL); fail(); } catch (SQLException e) { assertTrue(e.getMessage().contains("Cannot transform")); } try { rs.getDate(DECIMAL_COL); fail(); } catch (SQLException e) { assertTrue(e.getMessage().contains("Cannot transform")); } try { rs.getTime(DECIMAL_COL); fail(); } catch (SQLException e) { assertTrue(e.getMessage().contains("Cannot transform")); } try { rs.getTimestamp(DECIMAL_COL); fail(); } catch (SQLException e) { assertTrue(e.getMessage().contains("Cannot transform")); } try { rs.getBoolean(VARCHAR_COL); fail(); } catch (SQLException e) { assertTrue(e.getMessage().contains("Cannot transform")); } } @Test public void testGetString() throws SQLException, ParseException { String expected1 = STRING_VAL_1; String expected2 = STRING_VAL_2; String stringRes = rs.getString(STRING_COL_1); assertEquals(expected1, stringRes); // Valid implicit conversions short shortRes = rs.getShort(STRING_COL_1); assertEquals(Short.parseShort(expected1), shortRes); int intRes = rs.getInt(STRING_COL_1); assertEquals(Integer.parseInt(expected1), intRes); long longRes = rs.getLong(STRING_COL_1); assertEquals(Long.parseLong(expected1), longRes); float floatRes = rs.getFloat(STRING_COL_1); assertEquals(Float.parseFloat(expected1), floatRes, 0.0001); double doubleRes = rs.getDouble(STRING_COL_1); assertEquals(Double.parseDouble(expected1), doubleRes, 0.0001); byte[] byteArrayRes = rs.getBytes(STRING_COL_1); assertEquals(expected1, new String(byteArrayRes)); Date date = dateFormat.parse(expected2); java.sql.Date dateRes = rs.getDate(STRING_COL_2); assertEquals(date, dateRes); // Because of JdbcColumn.ODPS_DATETIME_FORMAT, the millisecond part will be removed java.sql.Time timeRes = rs.getTime(STRING_COL_2); assertEquals(date.getTime(), timeRes.getTime()); java.sql.Timestamp timestampRes = rs.getTimestamp(STRING_COL_2); assertEquals(Timestamp.valueOf(expected2), timestampRes); boolean booleanRes = rs.getBoolean(STRING_COL_1); assertEquals(BOOLEAN_VAL, booleanRes); // Invalid implicit conversions try { rs.getByte(STRING_COL_1); fail(); } catch (SQLException e) { assertTrue(e.getMessage().contains("Cannot transform")); } try { rs.getBigDecimal(STRING_COL_1); fail(); } catch (SQLException e) { assertTrue(e.getMessage().contains("Cannot transform")); } } @Test public void testGetDatetime() throws SQLException, UnsupportedEncodingException, ParseException { java.sql.Date expected = new java.sql.Date(DATETIME_VAL.getTime()); // Valid implicit conversions String stringRes = rs.getString(DATETIME_COL); assertEquals(dateFormat.format(expected), stringRes); byte[] byteArrayRes = rs.getBytes(DATETIME_COL); assertEquals(dateFormat.format(expected), new String(byteArrayRes, charset)); java.sql.Date dateRes = rs.getDate(DATETIME_COL); assertEquals(expected, dateRes); java.sql.Time timeRes = rs.getTime(DATETIME_COL); assertEquals(expected.getTime(), timeRes.getTime()); Timestamp timestampRes = rs.getTimestamp(DATETIME_COL); assertEquals(expected.getTime(), timestampRes.getTime()); // Invalid implicit conversions try { rs.getByte(DATETIME_COL); fail(); } catch (SQLException e) { assertTrue(e.getMessage().contains("Cannot transform")); } try { rs.getShort(DATETIME_COL); fail(); } catch (SQLException e) { assertTrue(e.getMessage().contains("Cannot transform")); } try { rs.getInt(DATETIME_COL); fail(); } catch (SQLException e) { assertTrue(e.getMessage().contains("Cannot transform")); } try { rs.getLong(DATETIME_COL); fail(); } catch (SQLException e) { assertTrue(e.getMessage().contains("Cannot transform")); } try { rs.getFloat(DATETIME_COL); fail(); } catch (SQLException e) { assertTrue(e.getMessage().contains("Cannot transform")); } try { rs.getDouble(DATETIME_COL); fail(); } catch (SQLException e) { assertTrue(e.getMessage().contains("Cannot transform")); } try { rs.getBigDecimal(DATETIME_COL); fail(); } catch (SQLException e) { assertTrue(e.getMessage().contains("Cannot transform")); } try { rs.getBoolean(DATETIME_COL); fail(); } catch (SQLException e) { assertTrue(e.getMessage().contains("Cannot transform")); } } @Test public void testGetTimestamp() throws SQLException, UnsupportedEncodingException, ParseException { Timestamp expected = TIMESTAMP_VAL; Timestamp timestampRes = rs.getTimestamp(TIMESTAMP_COL); assertEquals(expected, timestampRes); // Valid implicit conversions // getString can only get milliseconds String stringRes = rs.getString(TIMESTAMP_COL); assertEquals(expected.getTime(), Timestamp.valueOf(stringRes).getTime()); assertEquals(expected.getNanos() / 1000000, Timestamp.valueOf(stringRes).getNanos() / 1000000); byte[] byteArrayRes = rs.getBytes(TIMESTAMP_COL); assertEquals(expected, Timestamp.valueOf(new String(byteArrayRes, charset))); java.sql.Date dateRes = rs.getDate(TIMESTAMP_COL); assertEquals(expected.getTime(), dateRes.getTime()); java.sql.Time timeRes = rs.getTime(TIMESTAMP_COL); assertEquals(expected.getTime(), timeRes.getTime()); // Invalid implicit conversions try { rs.getByte(TIMESTAMP_COL); fail(); } catch (SQLException e) { assertTrue(e.getMessage().contains("Cannot transform")); } try { rs.getShort(TIMESTAMP_COL); fail(); } catch (SQLException e) { assertTrue(e.getMessage().contains("Cannot transform")); } try { rs.getInt(TIMESTAMP_COL); fail(); } catch (SQLException e) { assertTrue(e.getMessage().contains("Cannot transform")); } try { rs.getLong(TIMESTAMP_COL); fail(); } catch (SQLException e) { assertTrue(e.getMessage().contains("Cannot transform")); } try { rs.getFloat(TIMESTAMP_COL); fail(); } catch (SQLException e) { assertTrue(e.getMessage().contains("Cannot transform")); } try { rs.getDouble(TIMESTAMP_COL); fail(); } catch (SQLException e) { assertTrue(e.getMessage().contains("Cannot transform")); } try { rs.getBigDecimal(TIMESTAMP_COL); fail(); } catch (SQLException e) { assertTrue(e.getMessage().contains("Cannot transform")); } try { rs.getBoolean(TIMESTAMP_COL); fail(); } catch (SQLException e) { assertTrue(e.getMessage().contains("Cannot transform")); } } @Test public void testGetBoolean() throws SQLException, UnsupportedEncodingException { boolean expected = BOOLEAN_VAL; boolean booleanRes = rs.getBoolean(BOOLEAN_COL); assertEquals(expected, booleanRes); // Valid implicit conversions String stringRes = rs.getString(BOOLEAN_COL); assertEquals(expected, Boolean.valueOf(stringRes)); byte[] byteArrayRes = rs.getBytes(BOOLEAN_COL); assertEquals(expected, Boolean.valueOf(new String(byteArrayRes, charset))); // Invalid implicit conversions try { rs.getByte(BOOLEAN_COL); fail(); } catch (SQLException e) { assertTrue(e.getMessage().contains("Cannot transform")); } try { rs.getShort(BOOLEAN_COL); fail(); } catch (SQLException e) { assertTrue(e.getMessage().contains("Cannot transform")); } try { rs.getInt(BOOLEAN_COL); fail(); } catch (SQLException e) { assertTrue(e.getMessage().contains("Cannot transform")); } try { rs.getLong(BOOLEAN_COL); fail(); } catch (SQLException e) { assertTrue(e.getMessage().contains("Cannot transform")); } try { rs.getFloat(BOOLEAN_COL); fail(); } catch (SQLException e) { assertTrue(e.getMessage().contains("Cannot transform")); } try { rs.getDouble(BOOLEAN_COL); fail(); } catch (SQLException e) { assertTrue(e.getMessage().contains("Cannot transform")); } try { rs.getBigDecimal(BOOLEAN_COL); fail(); } catch (SQLException e) { assertTrue(e.getMessage().contains("Cannot transform")); } try { rs.getDate(BOOLEAN_COL); fail(); } catch (SQLException e) { assertTrue(e.getMessage().contains("Cannot transform")); } try { rs.getTime(BOOLEAN_COL); fail(); } catch (SQLException e) { assertTrue(e.getMessage().contains("Cannot transform")); } try { rs.getTimestamp(BOOLEAN_COL); fail(); } catch (SQLException e) { assertTrue(e.getMessage().contains("Cannot transform")); } } @Test public void testGetStringWithCalendar() throws SQLException { // Here we pass a calendar with timezone JSP (Japen Standard Time, GMT+9) to getTime, getDate, // and getTimestamp. Expected return value should be one hour earlier. E.g. the string in ODPS // is "2019-06-12 00:00:00", the expected return value should be "2019-06-11 23:00:00" String expectedTime = "23:00:00"; String expectedDate = "2019-05-22"; String expectedTimestamp = "2019-05-22 23:00:00.0"; Calendar cal = Calendar.getInstance(); cal.setTimeZone(TimeZone.getTimeZone("Asia/Tokyo")); Date date = rs.getDate(STRING_COL_2, cal); java.sql.Time time = rs.getTime(STRING_COL_2, cal); Timestamp timestamp = rs.getTimestamp(STRING_COL_2, cal); Assert.assertEquals(expectedDate, date.toString()); Assert.assertEquals(expectedTime, time.toString()); Assert.assertEquals(expectedTimestamp, timestamp.toString()); } @Test public void testGetNull() throws SQLException { Assert.assertEquals(0, rsNull.getByte(1)); Assert.assertEquals(0, rsNull.getShort(2)); Assert.assertEquals(0, rsNull.getInt(3)); Assert.assertEquals(0, rsNull.getLong(4)); Assert.assertEquals(0, rsNull.getFloat(5), 0.001); Assert.assertEquals(0, rsNull.getDouble(6), 0.001); Assert.assertNull(rsNull.getBigDecimal(7)); Assert.assertNull(rsNull.getString(8)); Assert.assertNull(rsNull.getString(9)); Assert.assertNull(rsNull.getString(10)); Assert.assertNull(rsNull.getDate(11)); Assert.assertNull(rsNull.getTimestamp(12)); Assert.assertFalse(rsNull.getBoolean(13)); } } <|start_filename|>src/test/java/com/aliyun/odps/jdbc/TestManager.java<|end_filename|> /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package com.aliyun.odps.jdbc; import java.io.IOException; import java.io.InputStream; import java.sql.Connection; import java.sql.DriverManager; import java.sql.Statement; import java.util.Properties; import org.junit.Assert; import com.aliyun.odps.Odps; import com.aliyun.odps.account.Account; import com.aliyun.odps.account.AliyunAccount; import com.aliyun.odps.tunnel.TableTunnel; /** * This class manage a global JDBC connection and multiple testing instances * can access it simultaneously. It will also close the connection automatically. */ public class TestManager { public Connection conn; public Connection sessionConn; public Odps odps; public TableTunnel tunnel; private static final TestManager cf = new TestManager(); protected void finalize() throws Throwable{ if (sessionConn != null) { sessionConn.close(); } } private TestManager() { try { Properties odpsConfig = new Properties(); InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream("conf.properties"); odpsConfig.load(is); Class.forName("com.aliyun.odps.jdbc.OdpsDriver"); String endpoint = odpsConfig.getProperty("end_point"); String project = odpsConfig.getProperty("project_name"); String username = odpsConfig.getProperty("access_id"); String password = odpsConfig.getProperty("access_key"); String loglevel = odpsConfig.getProperty("log_level"); String logview = odpsConfig.getProperty("logview_host"); String enableLimit = odpsConfig.getProperty("enable_limit"); String autoSelectLimit = odpsConfig.getProperty("auto_select_limit"); String url = String.format("jdbc:odps:%s?project=%s&loglevel=%s&logview=%s", endpoint, project, loglevel, logview); // pass project name via url conn = DriverManager.getConnection(url, username, password); Assert.assertNotNull(conn); Statement stmt = conn.createStatement(); stmt.execute("set odps.sql.hive.compatible=true;"); stmt.execute("set odps.sql.preparse.odps2=lot;"); stmt.execute("set odps.sql.planner.mode=lot;"); stmt.execute("set odps.sql.planner.parser.odps2=true;"); stmt.execute("set odps.sql.ddl.odps2=true;"); stmt.execute("set odps.sql.runtime.mode=executionengine;"); stmt.execute("set odps.compiler.verify=true;"); stmt.execute("set odps.compiler.output.format=lot,pot;"); String serviceName = odpsConfig.getProperty("interactive_service_name"); String urlSession = String.format("jdbc:odps:%s?project=%s&loglevel=%s&logview=%s&interactiveMode=true&interactiveServiceName=%s" + "&enableLimit=%s&autoSelectLimit=%s", endpoint, project, loglevel, logview, serviceName, enableLimit, autoSelectLimit); // pass project name via url sessionConn = DriverManager.getConnection(urlSession, username, password); Assert.assertNotNull(sessionConn); Statement sessionConnStatement = sessionConn.createStatement(); sessionConnStatement.execute("set odps.sql.hive.compatible=true;"); sessionConnStatement.execute("set odps.sql.preparse.odps2=lot;"); sessionConnStatement.execute("set odps.sql.planner.mode=lot;"); sessionConnStatement.execute("set odps.sql.planner.parser.odps2=true;"); sessionConnStatement.execute("set odps.sql.ddl.odps2=true;"); sessionConnStatement.execute("set odps.sql.runtime.mode=executionengine;"); sessionConnStatement.execute("set odps.compiler.verify=true;"); sessionConnStatement.execute("set odps.compiler.output.format=lot,pot;"); Account account = new AliyunAccount(username, password); odps = new Odps(account); odps.setEndpoint(endpoint); odps.setDefaultProject(project); Assert.assertNotNull(odps); tunnel = new TableTunnel(odps); Assert.assertNotNull(tunnel); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (java.sql.SQLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } public static TestManager getInstance() { return cf; } } <|start_filename|>src/main/java/com/aliyun/odps/jdbc/utils/transformer/to/odps/ToOdpsTransformerFactory.java<|end_filename|> /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package com.aliyun.odps.jdbc.utils.transformer.to.odps; import com.aliyun.odps.OdpsType; import java.sql.SQLException; import java.util.HashMap; import java.util.Map; public class ToOdpsTransformerFactory { private ToOdpsTransformerFactory() { } private static ToOdpsTinyintTransformer TINYINT_TRANSFORMER = new ToOdpsTinyintTransformer(); private static ToOdpsSmallintTransformer SMALLINT_TRANSFORMER = new ToOdpsSmallintTransformer(); private static ToOdpsIntTransformer INT_TRANSFORMER = new ToOdpsIntTransformer(); private static ToOdpsBigIntTransformer BIGINT_TRANSFORMER = new ToOdpsBigIntTransformer(); private static ToOdpsFloatTransformer FLOAT_TRANSFORMER = new ToOdpsFloatTransformer(); private static ToOdpsDoubleTransformer DOUBLE_TRANSFORMER = new ToOdpsDoubleTransformer(); private static ToOdpsDecimalTransformer DECIMAL_TRANSFORMER = new ToOdpsDecimalTransformer(); private static ToOdpsVarcharTransformer VARCHAR_TRANSFORMER = new ToOdpsVarcharTransformer(); private static ToOdpsStringTransformer STRING_TRANSFORMER = new ToOdpsStringTransformer(); private static ToOdpsDatetimeTransformer DATETIME_TRANSFORMER = new ToOdpsDatetimeTransformer(); private static ToOdpsTimeStampTransformer TIMESTAMP_TRANSFORMER = new ToOdpsTimeStampTransformer(); private static ToOdpsDateTransformer DATE_TRANSFORMER = new ToOdpsDateTransformer(); private static ToOdpsBooleanTransformer BOOLEAN_TRANSFORMER = new ToOdpsBooleanTransformer(); private static final Map<OdpsType, AbstractToOdpsTransformer> ODPS_TYPE_TO_TRANSFORMER = new HashMap<>(); static { ODPS_TYPE_TO_TRANSFORMER.put(OdpsType.TINYINT, TINYINT_TRANSFORMER); ODPS_TYPE_TO_TRANSFORMER.put(OdpsType.SMALLINT, SMALLINT_TRANSFORMER); ODPS_TYPE_TO_TRANSFORMER.put(OdpsType.INT, INT_TRANSFORMER); ODPS_TYPE_TO_TRANSFORMER.put(OdpsType.BIGINT, BIGINT_TRANSFORMER); ODPS_TYPE_TO_TRANSFORMER.put(OdpsType.FLOAT, FLOAT_TRANSFORMER); ODPS_TYPE_TO_TRANSFORMER.put(OdpsType.DOUBLE, DOUBLE_TRANSFORMER); ODPS_TYPE_TO_TRANSFORMER.put(OdpsType.DECIMAL, DECIMAL_TRANSFORMER); ODPS_TYPE_TO_TRANSFORMER.put(OdpsType.VARCHAR, VARCHAR_TRANSFORMER); ODPS_TYPE_TO_TRANSFORMER.put(OdpsType.STRING, STRING_TRANSFORMER); ODPS_TYPE_TO_TRANSFORMER.put(OdpsType.DATETIME, DATETIME_TRANSFORMER); ODPS_TYPE_TO_TRANSFORMER.put(OdpsType.TIMESTAMP, TIMESTAMP_TRANSFORMER); ODPS_TYPE_TO_TRANSFORMER.put(OdpsType.DATE, DATE_TRANSFORMER); ODPS_TYPE_TO_TRANSFORMER.put(OdpsType.BOOLEAN, BOOLEAN_TRANSFORMER); } public static AbstractToOdpsTransformer getTransformer(OdpsType odpsType) throws SQLException { AbstractToOdpsTransformer transformer = ODPS_TYPE_TO_TRANSFORMER.get(odpsType); if (transformer == null) { throw new SQLException("Not supported ODPS type: " + odpsType); } return transformer; } } <|start_filename|>src/test/java/com/aliyun/odps/jdbc/utils/TestUtils.java<|end_filename|> /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package com.aliyun.odps.jdbc.utils; import java.lang.management.ManagementFactory; import java.util.Random; import java.util.concurrent.atomic.AtomicLong; import com.aliyun.odps.Odps; import com.aliyun.odps.OdpsException; import com.aliyun.odps.Project; public class TestUtils { private static AtomicLong counter = new AtomicLong(); private static Project project = null; private static String processName = ManagementFactory.getRuntimeMXBean().getName(); private static String processID = processName.substring(0, processName.indexOf('@')); private static Random random = new Random(); public static Project getProject(Odps odps) throws OdpsException { if (project == null) { project = odps.projects().get(); } return project; } public static String getVersion() { return "tunnel_aliyunsdk_" + processID + "_"; } public static String getRandomProjectName() { String projectName = "otopen_prj_" + processID + "_" + System.currentTimeMillis() + "_" + counter.addAndGet(1); System.out.println(projectName); return projectName; } public static String getRandomTableName() { return getVersion() + "table_" + System.currentTimeMillis() + "_" + counter.addAndGet(1); } public static String getRandomVolumeName() { return getVersion() + "volume_" + System.currentTimeMillis() + "_" + counter.addAndGet(1); } public static String getRandomPartitionName() { return "pt_" + System.currentTimeMillis() + "_" + counter.addAndGet(1); } public static String getRandomFileName() { return "file_" + System.currentTimeMillis() + "_" + counter.addAndGet(1); } public static float randomFloat() { return random.nextFloat(); } public static double randomDouble() { return random.nextDouble(); } public static byte[] randomBytes() { byte[] res = new byte[randomInt(200)]; random.nextBytes(res); return res; } public static int randomInt() { return random.nextInt(); } public static int randomInt(int bound) { // [1, bound] return random.nextInt(bound) + 1; } public static boolean randomBoolean() { return random.nextBoolean(); } public static long randomLong() { return random.nextLong(); } public static byte randomByte() { return (byte) random.nextInt(Byte.MAX_VALUE); } public static short randomShort() { return (short) random.nextInt(Short.MAX_VALUE); } public static String randomString() { return randomString(random.nextInt(200) + 1); } public static String randomString(int length) { StringBuilder builder = new StringBuilder(length); for (int i = 0; i < length; i++) { int a = random.nextInt(128); builder.append((char) (a)); } return builder.toString(); } public static java.util.Date randomDate() { return new java.util.Date(System.currentTimeMillis() + 86400000 * TestUtils.randomInt(100000)); } } <|start_filename|>src/main/java/com/aliyun/odps/jdbc/OdpsResultSetMetaData.java<|end_filename|> /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package com.aliyun.odps.jdbc; import java.sql.ResultSetMetaData; import java.sql.SQLException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import com.aliyun.odps.OdpsType; import com.aliyun.odps.jdbc.utils.JdbcColumn; import com.aliyun.odps.type.TypeInfo; public class OdpsResultSetMetaData extends WrapperAdapter implements ResultSetMetaData { private final List<String> columnNames; private final List<OdpsType> columnTypes; private final List<? extends TypeInfo> typeInfos; private Map<String, Integer> nameIndexMap; private String catalogName = " "; private String schemeName = " "; private String tableName = " "; OdpsResultSetMetaData(List<String> columnNames, List<? extends TypeInfo> typeInfos) { this.columnNames = columnNames; this.typeInfos = typeInfos; this.columnTypes = new ArrayList<OdpsType>(); if (columnNames != null) { for (int i = 0; i < columnNames.size(); i++) { columnTypes.add(typeInfos.get(i).getOdpsType()); } } } @Override public String getCatalogName(int column) throws SQLException { return catalogName; } @Override public String getColumnClassName(int column) throws SQLException { OdpsType type = columnTypes.get(toZeroIndex(column)); return JdbcColumn.columnClassName(type); } @Override public int getColumnCount() throws SQLException { return columnNames.size(); } @Override public int getColumnDisplaySize(int column) throws SQLException { TypeInfo typeInfo = typeInfos.get(toZeroIndex(column)); return JdbcColumn.columnDisplaySize(typeInfo); } @Override public String getColumnLabel(int column) throws SQLException { return columnNames.get(toZeroIndex(column)); } @Override public String getColumnName(int column) throws SQLException { return columnNames.get(toZeroIndex(column)); } @Override public int getColumnType(int column) throws SQLException { OdpsType type = columnTypes.get(toZeroIndex(column)); return JdbcColumn.odpsTypeToSqlType(type); } @Override public String getColumnTypeName(int column) throws SQLException { TypeInfo typeInfo = typeInfos.get(toZeroIndex(column)); return typeInfo.getTypeName(); } public TypeInfo getColumnOdpsType(int column) throws SQLException { return typeInfos.get(toZeroIndex(column)); } @Override public int getPrecision(int column) throws SQLException { TypeInfo typeInfo = typeInfos.get(toZeroIndex(column)); return JdbcColumn.columnPrecision(typeInfo); } @Override public int getScale(int column) throws SQLException { OdpsType type = columnTypes.get(toZeroIndex(column)); TypeInfo typeInfo = typeInfos.get(toZeroIndex(column)); return JdbcColumn.columnScale(type, typeInfo); } @Override public String getSchemaName(int column) throws SQLException { return schemeName; } @Override public String getTableName(int column) throws SQLException { return tableName; } @Override public boolean isAutoIncrement(int column) throws SQLException { return false; } @Override public boolean isCaseSensitive(int column) throws SQLException { OdpsType type = columnTypes.get(toZeroIndex(column)); return JdbcColumn.columnCaseSensitive(type); } @Override public boolean isCurrency(int column) throws SQLException { return false; } @Override public boolean isDefinitelyWritable(int column) throws SQLException { return false; } // TODO: check @Override public int isNullable(int column) throws SQLException { return ResultSetMetaData.columnNullable; } @Override public boolean isReadOnly(int column) throws SQLException { return true; } @Override public boolean isSearchable(int column) throws SQLException { return true; } @Override public boolean isSigned(int column) throws SQLException { OdpsType type = columnTypes.get(toZeroIndex(column)); return JdbcColumn.columnSigned(type); } @Override public boolean isWritable(int column) throws SQLException { return false; } public void setTableName(String table) { tableName = table; } public void setSchemeName(String scheme) { schemeName = scheme; } public void setCatalogName(String catalog) { catalogName = catalog; } /** * Used by other classes for querying the index from column name * * @param name * column name * @return column index */ public int getColumnIndex(String name) { if (nameIndexMap == null) { nameIndexMap = new HashMap<String, Integer>(); for (int i = 0; i < columnNames.size(); ++i) { nameIndexMap.put(columnNames.get(i), i + 1); nameIndexMap.put(columnNames.get(i).toLowerCase(), i + 1); } } Integer index = nameIndexMap.get(name); if (index == null) { String lowerName = name.toLowerCase(); if (lowerName.equals(name)) { return -1; } index = nameIndexMap.get(name); } if (index == null) { return -1; } return index; } protected int toZeroIndex(int column) { if (column <= 0 || column > columnNames.size()) { throw new IllegalArgumentException(); } return column - 1; } } <|start_filename|>example/src/main/java/HikariCP.java<|end_filename|> import java.io.IOException; import java.io.InputStream; import java.sql.SQLException; import java.sql.Connection; import java.sql.ResultSet; import java.sql.Statement; import java.util.Properties; import com.zaxxer.hikari.HikariDataSource; public class HikariCP { private static String driverName = "com.aliyun.odps.jdbc.OdpsDriver"; /** * @param args * @throws SQLException */ public static void main(String[] args) throws SQLException { try { Class.forName(driverName); } catch (ClassNotFoundException e) { e.printStackTrace(); System.exit(1); } // fill in the information string Properties odpsConfig = new Properties(); InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream("conf.properties"); try { odpsConfig.load(is); } catch (IOException e) { e.printStackTrace(); System.exit(1); } try { HikariDataSource ds = new HikariDataSource(); ds.setDriverClassName(driverName); ds.setJdbcUrl(odpsConfig.getProperty("connection_string")); ds.setUsername(odpsConfig.getProperty("username")); ds.setPassword(<PASSWORD>("password")); ds.setMaximumPoolSize(5); ds.setConnectionTimeout(3000); ds.setAutoCommit(false); ds.setReadOnly(false); Connection conn = ds.getConnection(); Statement stmt = conn.createStatement(); String tableName = "testOdpsDriverTable"; stmt.execute("drop table if exists " + tableName); stmt.execute("create table " + tableName + " (key int, value string)"); String sql; ResultSet res; // insert a record sql = String.format( "insert into table %s select 24 key, 'hours' value from (select count(1) from %s) a", tableName, tableName); System.out.println("Running: " + sql); int count = stmt.executeUpdate(sql); System.out.println("updated records: " + count); // select * query sql = "select * from " + tableName; System.out.println("Running: " + sql); res = stmt.executeQuery(sql); while (res.next()) { System.out.println(String.valueOf(res.getInt(1)) + "\t" + res.getString(2)); } // regular query sql = "select count(1) from " + tableName; System.out.println("Running: " + sql); res = stmt.executeQuery(sql); while (res.next()) { System.out.println(res.getString(1)); } ds.close(); } catch (Exception e) { e.printStackTrace(); System.exit(1); } } } <|start_filename|>src/test/java/com/aliyun/odps/jdbc/OdpsDatabaseMetaDataTest.java<|end_filename|> /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package com.aliyun.odps.jdbc; import java.sql.DatabaseMetaData; import java.sql.ResultSet; import java.sql.ResultSetMetaData; import java.sql.SQLException; import java.sql.Statement; import org.junit.AfterClass; import org.junit.Assert; import org.junit.BeforeClass; import org.junit.Test; public class OdpsDatabaseMetaDataTest { static DatabaseMetaData databaseMetaData; @BeforeClass public static void setUp() throws Exception { databaseMetaData = TestManager.getInstance().conn.getMetaData(); System.out.println(databaseMetaData.getCatalogTerm()); System.out.println(databaseMetaData.getProcedureTerm()); System.out.println(databaseMetaData.getSchemaTerm()); } @AfterClass public static void tearDown() throws Exception { } private void printRs(ResultSet rs) throws Exception { ResultSetMetaData meta = rs.getMetaData(); for (int i = 1; i <= meta.getColumnCount(); i++) { System.out.printf("\t" + meta.getColumnName(i)); } for (int i = 1; i <= meta.getColumnCount(); i++) { System.out.printf("\t" + meta.getColumnTypeName(i)); } System.out.println(); while(rs.next()) { for (int i = 1; i <= meta.getColumnCount(); i++) { System.out.printf("\t" + rs.getObject(i)); } System.out.println(); } } //@Test public void testGetTables() throws Exception { { ResultSet rs = databaseMetaData.getTables(null, null, "%test", null); Assert.assertNotNull(rs); while (rs.next()) { Assert.assertTrue(rs.getString("TABLE_NAME").endsWith("test")); Assert.assertTrue(rs.getString("TABLE_TYPE").equals("TABLE")); } rs.close(); } { ResultSet rs = databaseMetaData.getTables(null, null, null, new String[] {"VIEW"}); Assert.assertNotNull(rs); while (rs.next()) { Assert.assertTrue(rs.getString("TABLE_TYPE").equals("VIEW")); } rs.close(); } } @Test public void testGetFunctions() throws Exception { ResultSet rs = databaseMetaData.getFunctions(null, null, null); Assert.assertNotNull(rs); printRs(rs); rs.close(); } @Test public void testGetColumns() throws Exception { Statement stmt = TestManager.getInstance().conn.createStatement(); stmt.executeUpdate("drop table if exists dual;"); stmt.executeUpdate("create table if not exists dual(id bigint);"); stmt.close(); ResultSet rs = databaseMetaData.getColumns(null, null, "dual", null); Assert.assertNotNull(rs); printRs(rs); rs.close(); } @Test public void testGetUDTs() throws Exception { ResultSet rs = databaseMetaData.getUDTs(null, null, null, null); Assert.assertNotNull(rs); printRs(rs); rs.close(); } @Test public void testGetPrimaryKeys() throws Exception { ResultSet rs = databaseMetaData.getPrimaryKeys(null, null, null); Assert.assertNotNull(rs); printRs(rs); rs.close(); } @Test public void testGetProcedures() throws Exception { ResultSet rs = databaseMetaData.getProcedures(null, null, null); Assert.assertNotNull(rs); printRs(rs); rs.close(); } @Test public void testGetCatalogs() throws SQLException { String projectName = TestManager.getInstance().odps.getDefaultProject(); try (ResultSet rs = databaseMetaData.getCatalogs()) { int count = 0; boolean includesDefaultProject = false; boolean includesPublicDataSet = false; while (rs.next()) { String catalog = rs.getString(OdpsDatabaseMetaData.COL_NAME_TABLE_CAT); if (catalog.equalsIgnoreCase(projectName)) { includesDefaultProject = true; } else if (OdpsDatabaseMetaData.PRJ_NAME_MAXCOMPUTE_PUBLIC_DATA.equalsIgnoreCase(catalog)) { includesPublicDataSet = true; } count += 1; System.out.println(catalog); } Assert.assertTrue(includesDefaultProject); Assert.assertTrue(includesPublicDataSet); Assert.assertEquals(2, count); } } @Test public void testGetSchemas() throws SQLException { String projectName = TestManager.getInstance().odps.getDefaultProject(); // Without any filter try (ResultSet rs = databaseMetaData.getSchemas(null, null)) { int count = 0; boolean includesDefaultProject = false; boolean includesPublicDataSet = false; while (rs.next()) { String schema = rs.getString(OdpsDatabaseMetaData.COL_NAME_TABLE_SCHEM); String catalog = rs.getString(OdpsDatabaseMetaData.COL_NAME_TABLE_CATALOG); Assert.assertEquals(schema, catalog); if (catalog.equalsIgnoreCase(projectName)) { includesDefaultProject = true; } else if (OdpsDatabaseMetaData.PRJ_NAME_MAXCOMPUTE_PUBLIC_DATA.equalsIgnoreCase(catalog)) { includesPublicDataSet = true; } count += 1; System.out.println(String.format("%s.%s", catalog, schema)); } Assert.assertTrue(includesDefaultProject); Assert.assertTrue(includesPublicDataSet); Assert.assertEquals(2, count); } // Filtered by catalog name try (ResultSet rs = databaseMetaData.getSchemas(OdpsDatabaseMetaData.PRJ_NAME_MAXCOMPUTE_PUBLIC_DATA, null)) { int count = 0; boolean includesDefaultProject = false; boolean includesPublicDataSet = false; while (rs.next()) { String schema = rs.getString(OdpsDatabaseMetaData.COL_NAME_TABLE_SCHEM); String catalog = rs.getString(OdpsDatabaseMetaData.COL_NAME_TABLE_CATALOG); Assert.assertEquals(schema, catalog); if (catalog.equalsIgnoreCase(projectName)) { includesDefaultProject = true; } else if (OdpsDatabaseMetaData.PRJ_NAME_MAXCOMPUTE_PUBLIC_DATA.equalsIgnoreCase(catalog)) { includesPublicDataSet = true; } count += 1; System.out.println(String.format("%s.%s", catalog, schema)); } Assert.assertFalse(includesDefaultProject); Assert.assertTrue(includesPublicDataSet); Assert.assertEquals(1, count); } try (ResultSet rs = databaseMetaData.getSchemas(projectName, null)) { int count = 0; boolean includesDefaultProject = false; boolean includesPublicDataSet = false; while (rs.next()) { String schema = rs.getString(OdpsDatabaseMetaData.COL_NAME_TABLE_SCHEM); String catalog = rs.getString(OdpsDatabaseMetaData.COL_NAME_TABLE_CATALOG); Assert.assertEquals(schema, catalog); if (catalog.equalsIgnoreCase(projectName)) { includesDefaultProject = true; } else if (OdpsDatabaseMetaData.PRJ_NAME_MAXCOMPUTE_PUBLIC_DATA.equalsIgnoreCase(catalog)) { includesPublicDataSet = true; } count += 1; System.out.println(String.format("%s.%s", catalog, schema)); } Assert.assertTrue(includesDefaultProject); Assert.assertFalse(includesPublicDataSet); Assert.assertEquals(1, count); } } } <|start_filename|>src/main/java/com/aliyun/odps/jdbc/utils/JdbcColumn.java<|end_filename|> /* * Licensed to the Apache Software Foundation (ASF) under one or more contributor license * agreements. See the NOTICE file distributed with this work for additional information regarding * copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance with the License. You may obtain a * copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under the License * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express * or implied. See the License for the specific language governing permissions and limitations under * the License. */ package com.aliyun.odps.jdbc.utils; import java.sql.DatabaseMetaData; import java.sql.SQLException; import java.sql.Types; import java.util.HashMap; import java.util.Map; import com.aliyun.odps.OdpsType; import com.aliyun.odps.data.OdpsTypeTransformer; import com.aliyun.odps.type.CharTypeInfo; import com.aliyun.odps.type.DecimalTypeInfo; import com.aliyun.odps.type.SimplePrimitiveTypeInfo; import com.aliyun.odps.type.TypeInfo; import com.aliyun.odps.type.VarcharTypeInfo; /** * Wrap around column attributes in this class so that we can display getColumns() easily. */ public class JdbcColumn { public static final String ODPS_TIMESTAMP_FORMAT = "yyyy-MM-dd HH:mm:ss.SSS"; public static final String ODPS_DATETIME_FORMAT = "yyyy-MM-dd HH:mm:ss"; public static final String ODPS_DATE_FORMAT = "yyyy-MM-dd"; public static final String ODPS_TIME_FORMAT = "HH:mm:ss"; public static final int ODPS_DECIMAL_PRECISON = 54; public static final int ODPS_DECIMAL_SCALE = 18; public static final int ODPS_STRING_CHARACTERS = 8 * 1024 * 1024 / 3; private static Map<OdpsType, Integer> ODPS_SQLTYPE_MAPPER = new HashMap<>(); static { ODPS_SQLTYPE_MAPPER.put(OdpsType.VOID, java.sql.Types.NULL); ODPS_SQLTYPE_MAPPER.put(OdpsType.BIGINT, java.sql.Types.BIGINT); ODPS_SQLTYPE_MAPPER.put(OdpsType.STRING, java.sql.Types.VARCHAR); ODPS_SQLTYPE_MAPPER.put(OdpsType.DATETIME, java.sql.Types.TIMESTAMP); ODPS_SQLTYPE_MAPPER.put(OdpsType.DOUBLE, java.sql.Types.DOUBLE); ODPS_SQLTYPE_MAPPER.put(OdpsType.BOOLEAN, java.sql.Types.BOOLEAN); ODPS_SQLTYPE_MAPPER.put(OdpsType.DECIMAL, java.sql.Types.DECIMAL); ODPS_SQLTYPE_MAPPER.put(OdpsType.ARRAY, java.sql.Types.ARRAY); ODPS_SQLTYPE_MAPPER.put(OdpsType.MAP, java.sql.Types.JAVA_OBJECT); ODPS_SQLTYPE_MAPPER.put(OdpsType.STRUCT, java.sql.Types.STRUCT); ODPS_SQLTYPE_MAPPER.put(OdpsType.INT, java.sql.Types.INTEGER); ODPS_SQLTYPE_MAPPER.put(OdpsType.TINYINT, java.sql.Types.TINYINT); ODPS_SQLTYPE_MAPPER.put(OdpsType.SMALLINT, java.sql.Types.SMALLINT); ODPS_SQLTYPE_MAPPER.put(OdpsType.DATE, java.sql.Types.DATE); ODPS_SQLTYPE_MAPPER.put(OdpsType.TIMESTAMP, java.sql.Types.TIMESTAMP); ODPS_SQLTYPE_MAPPER.put(OdpsType.FLOAT, java.sql.Types.FLOAT); ODPS_SQLTYPE_MAPPER.put(OdpsType.CHAR, java.sql.Types.CHAR); ODPS_SQLTYPE_MAPPER.put(OdpsType.BINARY, java.sql.Types.BINARY); ODPS_SQLTYPE_MAPPER.put(OdpsType.VARCHAR, java.sql.Types.VARCHAR); ODPS_SQLTYPE_MAPPER.put(OdpsType.INTERVAL_YEAR_MONTH, java.sql.Types.OTHER); ODPS_SQLTYPE_MAPPER.put(OdpsType.INTERVAL_DAY_TIME, java.sql.Types.OTHER); } private final String columnName; private final String tableName; private final String tableSchema; private final OdpsType type; private final String comment; private final int ordinalPos; private final TypeInfo typeInfo; public JdbcColumn(String columnName, String tableName, String tableSchema, OdpsType type, TypeInfo typeInfo, String comment, int ordinalPos) { this.columnName = columnName; this.tableName = tableName; this.tableSchema = tableSchema; this.type = type; this.typeInfo = typeInfo; this.comment = comment; this.ordinalPos = ordinalPos; } public static int odpsTypeToSqlType(OdpsType type) throws SQLException { if (ODPS_SQLTYPE_MAPPER.containsKey(type)) { return ODPS_SQLTYPE_MAPPER.get(type); } throw new SQLException("Invalid odps type: " + type); } public static String columnClassName(OdpsType type) throws SQLException { return OdpsTypeTransformer.odpsTypeToJavaType(type).getName(); } public static int columnDisplaySize(TypeInfo typeInfo) throws SQLException { // according to odpsTypeToSqlType possible options are: int columnType = odpsTypeToSqlType(typeInfo.getOdpsType()); switch (columnType) { case Types.NULL: return 4; // "NULL" case Types.BOOLEAN: return columnPrecision(typeInfo); case Types.CHAR: case Types.VARCHAR: return columnPrecision(typeInfo); case Types.BINARY: return Integer.MAX_VALUE; // hive has no max limit for binary case Types.TINYINT: case Types.SMALLINT: case Types.INTEGER: case Types.BIGINT: return columnPrecision(typeInfo) + 1; // allow +/- case Types.DATE: return 10; case Types.TIMESTAMP: return columnPrecision(typeInfo); // see // http://download.oracle.com/javase/6/docs/api/constant-values.html#java.lang.Float.MAX_EXPONENT case Types.FLOAT: return 24; // e.g. -(17#).e-### // see // http://download.oracle.com/javase/6/docs/api/constant-values.html#java.lang.Double.MAX_EXPONENT case Types.DOUBLE: return 25; // e.g. -(17#).e-#### case Types.DECIMAL: return columnPrecision(typeInfo) + 2; // '-' sign and '.' case Types.OTHER: case Types.JAVA_OBJECT: return columnPrecision(typeInfo); case Types.ARRAY: case Types.STRUCT: return Integer.MAX_VALUE; default: throw new SQLException("Invalid odps type: " + columnType); } } public static int columnPrecision(TypeInfo typeInfo) throws SQLException { int columnType = odpsTypeToSqlType(typeInfo.getOdpsType()); // according to odpsTypeToSqlType possible options are: switch (columnType) { case Types.NULL: return 0; case Types.BOOLEAN: return 1; case Types.CHAR: case Types.VARCHAR: if (typeInfo instanceof VarcharTypeInfo) { return ((VarcharTypeInfo) typeInfo).getLength(); } if (typeInfo instanceof CharTypeInfo) { return ((CharTypeInfo) typeInfo).getLength(); } return Integer.MAX_VALUE; // hive has no max limit for strings case Types.BINARY: return Integer.MAX_VALUE; // hive has no max limit for binary case Types.TINYINT: return 3; case Types.SMALLINT: return 5; case Types.INTEGER: return 10; case Types.BIGINT: return 19; case Types.FLOAT: return 7; case Types.DOUBLE: return 15; case Types.DATE: return 10; case Types.TIMESTAMP: return 29; case Types.DECIMAL: return ((DecimalTypeInfo) typeInfo).getPrecision(); case Types.OTHER: case Types.JAVA_OBJECT: { if (typeInfo instanceof SimplePrimitiveTypeInfo) { SimplePrimitiveTypeInfo spti = (SimplePrimitiveTypeInfo) typeInfo; if (OdpsType.INTERVAL_YEAR_MONTH.equals(spti.getOdpsType())) { // -yyyyyyy-mm : should be more than enough return 11; } else if (OdpsType.INTERVAL_DAY_TIME.equals(spti.getOdpsType())) { // -ddddddddd hh:mm:ss.nnnnnnnnn return 29; } } return Integer.MAX_VALUE; } case Types.ARRAY: case Types.STRUCT: return Integer.MAX_VALUE; default: throw new SQLException("Invalid odps type: " + columnType); } } public static int columnScale(OdpsType type, TypeInfo typeInfo) throws SQLException { int columnType = odpsTypeToSqlType(type); // according to odpsTypeToSqlType possible options are: switch (columnType) { case Types.NULL: case Types.BOOLEAN: case Types.CHAR: case Types.VARCHAR: case Types.TINYINT: case Types.SMALLINT: case Types.INTEGER: case Types.BIGINT: case Types.DATE: case Types.BINARY: return 0; case Types.FLOAT: return 7; case Types.DOUBLE: return 15; case Types.TIMESTAMP: return 9; case Types.DECIMAL: return ((DecimalTypeInfo) typeInfo).getScale(); case Types.OTHER: case Types.JAVA_OBJECT: case Types.ARRAY: case Types.STRUCT: return 0; default: throw new SQLException("Invalid odps type: " + columnType); } } public static boolean columnCaseSensitive(OdpsType type) throws SQLException { int columnType = odpsTypeToSqlType(type); // according to odpsTypeToSqlType possible options are: switch (columnType) { case Types.NULL: case Types.BOOLEAN: case Types.TINYINT: case Types.SMALLINT: case Types.INTEGER: case Types.BIGINT: case Types.DATE: case Types.BINARY: case Types.FLOAT: case Types.DOUBLE: case Types.TIMESTAMP: case Types.DECIMAL: case Types.OTHER: case Types.JAVA_OBJECT: case Types.ARRAY: case Types.STRUCT: return false; case Types.CHAR: case Types.VARCHAR: return true; default: throw new SQLException("Invalid odps type: " + columnType); } } public static boolean columnSigned(OdpsType type) throws SQLException { int columnType = odpsTypeToSqlType(type); // according to odpsTypeToSqlType possible options are: switch (columnType) { case Types.NULL: case Types.BOOLEAN: case Types.DATE: case Types.BINARY: case Types.TIMESTAMP: case Types.OTHER: case Types.JAVA_OBJECT: case Types.ARRAY: case Types.STRUCT: case Types.CHAR: case Types.VARCHAR: return false; case Types.TINYINT: case Types.SMALLINT: case Types.INTEGER: case Types.BIGINT: case Types.FLOAT: case Types.DOUBLE: case Types.DECIMAL: return true; default: throw new SQLException("unknown OdpsType"); } } public String getColumnName() { return columnName; } public String getTableName() { return tableName; } public String getTableSchema() { return tableSchema; } public int getType() throws SQLException { return odpsTypeToSqlType(type); } public String getComment() { return comment; } public String getTypeName() { return typeInfo.getTypeName(); } public int getOrdinalPos() { return ordinalPos; } public int getNumPercRaidx() { return 10; } public int getIsNullable() { return DatabaseMetaData.columnNullable; } public String getIsNullableString() { switch (getIsNullable()) { case (DatabaseMetaData.columnNoNulls): return "NO"; case (DatabaseMetaData.columnNullable): return "YES"; case (DatabaseMetaData.columnNullableUnknown): return null; default: return null; } } public int getDecimalDigits() { return 0; } } <|start_filename|>src/test/java/com/aliyun/odps/jdbc/ConnectionResourceTest.java<|end_filename|> /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package com.aliyun.odps.jdbc; import java.io.FileInputStream; import java.util.List; import java.util.Map; import java.util.Properties; import org.junit.Assert; import org.junit.Test; import com.aliyun.odps.jdbc.utils.ConnectionResource; public class ConnectionResourceTest { @Test public void testConnectionResourceTest() throws Exception { String odpsConfigFile = getClass().getClassLoader().getResource("odps_config.ini").getPath(); String url1 = "jdbc:odps:http://1.1.1.1:8100/api?project=p1&loglevel=debug&accessId=123&accessKey=234%3D" + "&tunnel_endpoint=http%3A%2F%2F1.1.1.1%3A8066&logConfFile=/Users/emerson/logback.xml" + "&odps_config=" + odpsConfigFile; ConnectionResource resource = new ConnectionResource(url1, null); Assert.assertEquals("http://1.1.1.1:8100/api", resource.getEndpoint()); Assert.assertEquals("p2", resource.getProject()); Assert.assertEquals("345", resource.getAccessId()); Assert.assertEquals("456=", resource.getAccessKey()); Assert.assertEquals("UTF-8", resource.getCharset()); Assert.assertEquals("logback1.xml", resource.getLogConfFile()); Assert.assertEquals(null, resource.getLogview()); Assert.assertEquals("http://1.1.1.1:8066", resource.getTunnelEndpoint()); Assert.assertEquals(false, resource.isInteractiveMode()); Assert.assertEquals("sn", resource.getInteractiveServiceName()); Assert.assertEquals("default1", resource.getMajorVersion()); Map<String, List<String>> tables = resource.getTables(); Assert.assertEquals(2, tables.size()); Assert.assertTrue(tables.containsKey("project1")); Assert.assertEquals(2, tables.get("project1").size()); Assert.assertTrue(tables.get("project1").contains("table1")); Assert.assertTrue(tables.get("project1").contains("table2")); Assert.assertTrue(tables.containsKey("project2")); Assert.assertEquals(3, tables.get("project2").size()); Assert.assertTrue(tables.get("project2").contains("table1")); Assert.assertTrue(tables.get("project2").contains("table2")); Assert.assertTrue(tables.get("project2").contains("table3")); String logConfigFile = getClass().getClassLoader().getResource("logback.xml").getPath(); String url2 = "jdbc:odps:http://1.1.1.1:8100/api?project=p1&loglevel=debug&accessId=123" + "&accessKey=234%3D&logview_host=http://abc.com:8080" + "&tunnelEndpoint=http://1.1.1.1:8066&interactiveMode=true" + "&interactiveServiceName=sn&interactiveTimeout=11" + "&tableList=project1.table1,project1.table2,project2.table1,project2.table2,project2.table3" + "&majorVersion=default1&logConfFile=" + logConfigFile; resource = new ConnectionResource(url2, null); Assert.assertEquals(true, resource.isInteractiveMode()); Assert.assertEquals("http://1.1.1.1:8100/api", resource.getEndpoint()); Assert.assertEquals("p1", resource.getProject()); Assert.assertEquals("123", resource.getAccessId()); Assert.assertEquals("234=", resource.getAccessKey()); Assert.assertEquals(logConfigFile, resource.getLogConfFile()); Assert.assertEquals("UTF-8", resource.getCharset()); Assert.assertEquals(logConfigFile, resource.getLogConfFile()); Assert.assertEquals("http://abc.com:8080", resource.getLogview()); Assert.assertEquals("http://1.1.1.1:8066", resource.getTunnelEndpoint()); tables = resource.getTables(); Assert.assertEquals(2, tables.size()); Assert.assertTrue(tables.containsKey("project1")); Assert.assertEquals(2, tables.get("project1").size()); Assert.assertTrue(tables.get("project1").contains("table1")); Assert.assertTrue(tables.get("project1").contains("table2")); Assert.assertTrue(tables.containsKey("project2")); Assert.assertEquals(3, tables.get("project2").size()); Assert.assertTrue(tables.get("project2").contains("table1")); Assert.assertTrue(tables.get("project2").contains("table2")); Assert.assertTrue(tables.get("project2").contains("table3")); Properties info = new Properties(); info.load(new FileInputStream(odpsConfigFile)); resource = new ConnectionResource(url2, info); Assert.assertEquals("http://1.1.1.1:8100/api", resource.getEndpoint()); Assert.assertEquals("p2", resource.getProject()); Assert.assertEquals("345", resource.getAccessId()); Assert.assertEquals("456=", resource.getAccessKey()); Assert.assertEquals("UTF-8", resource.getCharset()); Assert.assertEquals("logback1.xml", resource.getLogConfFile()); Assert.assertEquals("http://abc.com:8080", resource.getLogview()); Assert.assertEquals("http://1.1.1.1:8066", resource.getTunnelEndpoint()); Assert.assertEquals("sn", resource.getInteractiveServiceName()); Assert.assertEquals("default1", resource.getMajorVersion()); tables = resource.getTables(); Assert.assertEquals(2, tables.size()); Assert.assertTrue(tables.containsKey("project1")); Assert.assertEquals(2, tables.get("project1").size()); Assert.assertTrue(tables.get("project1").contains("table1")); Assert.assertTrue(tables.get("project1").contains("table2")); Assert.assertTrue(tables.containsKey("project2")); Assert.assertEquals(3, tables.get("project2").size()); Assert.assertTrue(tables.get("project2").contains("table1")); Assert.assertTrue(tables.get("project2").contains("table2")); Assert.assertTrue(tables.get("project2").contains("table3")); } } <|start_filename|>src/test/java/com/aliyun/odps/jdbc/OdpsResultSetTest.java<|end_filename|> /* * Licensed to the Apache Software Foundation (ASF) under one or more contributor license * agreements. See the NOTICE file distributed with this work for additional information regarding * copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance with the License. You may obtain a * copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under the License * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express * or implied. See the License for the specific language governing permissions and limitations under * the License. */ package com.aliyun.odps.jdbc; import java.math.BigDecimal; import java.sql.Date; import java.sql.ResultSet; import java.sql.ResultSetMetaData; import java.sql.SQLException; import java.sql.Statement; import java.sql.Time; import java.sql.Timestamp; import java.text.SimpleDateFormat; import java.util.TimeZone; import org.junit.AfterClass; import org.junit.Assert; import org.junit.BeforeClass; import org.junit.Test; import com.aliyun.odps.PartitionSpec; import com.aliyun.odps.data.Record; import com.aliyun.odps.data.RecordWriter; import com.aliyun.odps.tunnel.TableTunnel; public class OdpsResultSetTest { static Statement stmt; static long unixTimeNow; static SimpleDateFormat formatter; static String nowStr; static String odpsNowStr; static String decimalValue; static String decimalStr; static String odpsDecimalStr; static BigDecimal bigDecimal; @BeforeClass public static void setUp() throws Exception { stmt = TestManager.getInstance().conn.createStatement(); stmt.executeUpdate("drop table if exists dual;"); stmt.executeUpdate("create table if not exists dual(id bigint);"); TableTunnel.UploadSession upload = TestManager.getInstance().tunnel.createUploadSession( TestManager.getInstance().odps.getDefaultProject(), "dual"); RecordWriter writer = upload.openRecordWriter(0); Record r = upload.newRecord(); r.setBigint(0, 42L); writer.write(r); writer.close(); upload.commit(new Long[] {0L}); formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); unixTimeNow = new java.util.Date().getTime(); nowStr = formatter.format(unixTimeNow); odpsNowStr = "cast('" + nowStr + "' as datetime)"; decimalValue = "55.123456789012345"; decimalStr = decimalValue + "BD"; odpsDecimalStr = "cast('" + decimalValue + "' as decimal(38,18))"; bigDecimal = new BigDecimal(decimalValue); } @AfterClass public static void tearDown() throws Exception { stmt.executeUpdate("drop table if exists dual;"); stmt.close(); } @Test public void testSelectFromPartition() throws Exception { stmt.executeUpdate("drop table if exists select_from_partition"); stmt.executeUpdate("create table if not exists select_from_partition(id bigint) partitioned by (par_col string)"); stmt.executeUpdate("alter table select_from_partition add partition (par_col='a')"); PartitionSpec ps = new PartitionSpec("par_col='a'"); TableTunnel.UploadSession upload = TestManager.getInstance().tunnel.createUploadSession( TestManager.getInstance().odps.getDefaultProject(), "select_from_partition", ps); RecordWriter writer = upload.openRecordWriter(0); Record r = upload.newRecord(); r.setBigint(0, 42L); writer.write(r); writer.close(); upload.commit(new Long[] {0L}); ResultSet rs = stmt.executeQuery("select * from select_from_partition where par_col='a'"); rs.next(); Assert.assertEquals(42L, rs.getInt(1)); rs.close(); stmt.executeUpdate("drop table if exists select_from_partition"); } @Test public void testGetSelectStar() throws Exception { ResultSet rs = stmt.executeQuery("select * from dual;"); rs.next(); Assert.assertEquals(42L, rs.getInt(1)); rs.close(); } @Test public void testGetSelectCountStar() throws Exception { ResultSet rs = stmt.executeQuery("select count(*) from dual;"); rs.next(); Assert.assertEquals(1, rs.getInt(1)); rs.close(); } @Test public void testGetSelectEmbedded() throws Exception { // ResultSet // rs = stmt.executeQuery("select 1 c1, 2.2 c2, null c3, 'haha' c4 from dual;"); ResultSet rs = stmt.executeQuery("select 1 c1, 2.2 c2, 'haha' c3 from dual;"); ResultSetMetaData meta = rs.getMetaData(); Assert.assertEquals("c1", meta.getColumnName(1)); Assert.assertEquals("c2", meta.getColumnName(2)); Assert.assertEquals("c3", meta.getColumnName(3)); // Assert.assertEquals("c4", meta.getColumnName(4)); Assert.assertEquals("INT", meta.getColumnTypeName(1)); Assert.assertEquals("DOUBLE", meta.getColumnTypeName(2)); // TODO: SDK treats com.aliyun.odps.OdpsType.VOID as string? Assert.assertEquals("STRING", meta.getColumnTypeName(3)); // Assert.assertEquals("STRING", meta.getColumnTypeName(4)); rs.next(); Assert.assertEquals(1, rs.getInt(1)); Assert.assertEquals(2.2, rs.getDouble(2), 0); //Assert.assertEquals(0, rs.getInt(3)); //Assert.assertTrue(rs.wasNull()); Assert.assertEquals("haha", rs.getString(3)); rs.close(); } @Test public void testGetObject() throws Exception { ResultSet rs = stmt.executeQuery("select * from (select 1L id, 1.5 weight from dual" + " union all select 2 id, 2.9 weight from dual) x order by id desc limit 2;"); { rs.next(); Assert.assertEquals(2, ((Long) rs.getObject(1)).longValue()); Assert.assertEquals(2, ((Long) rs.getObject("id")).longValue()); Assert.assertEquals(2.9, ((Double) rs.getObject(2)).doubleValue(), 0); Assert.assertEquals(2.9, ((Double) rs.getObject("weight")).doubleValue(), 0); } { rs.next(); Assert.assertEquals(1, ((Long) rs.getObject(1)).longValue()); Assert.assertEquals(1, ((Long) rs.getObject("id")).longValue()); Assert.assertEquals(1.5, ((Double) rs.getObject(2)).doubleValue(), 0); Assert.assertEquals(1.5, ((Double) rs.getObject("weight")).doubleValue(), 0); } rs.close(); } @Test public void testGetBoolean() throws Exception { // cast from BOOLEAN, STRING, DOUBLE, BIGINT ResultSet rs = stmt.executeQuery("select true c1, false c2, '42' c3, '0' c4, " + "3.14 c5, 0.0 c6, 95 c7, 0 c8 from dual;"); { rs.next(); Assert.assertEquals(true, rs.getBoolean(1)); Assert.assertEquals(false, rs.getBoolean(2)); Assert.assertEquals(true, rs.getBoolean(3)); Assert.assertEquals(false, rs.getBoolean(4)); Assert.assertEquals(true, rs.getBoolean(5)); Assert.assertEquals(false, rs.getBoolean(6)); Assert.assertEquals(true, rs.getBoolean(7)); Assert.assertEquals(false, rs.getBoolean(8)); } rs.close(); } @Test public void testGetByte() throws Exception { // cast from BIGINT, DOUBLE, DECIMAL ResultSet rs = stmt.executeQuery(String.format("select 1943 c1, 3.1415926 c2, %s c3 from dual;", odpsDecimalStr)); { rs.next(); Assert.assertEquals((byte) 1943, rs.getByte(1)); Assert.assertEquals((byte) 3.1415926, rs.getByte(2)); Assert.assertEquals(bigDecimal.byteValue(), rs.getByte(3)); } rs.close(); } @Test public void testGetInteger() throws Exception { // cast from BIGINT, DOUBLE, DECIMAL, STRING ResultSet rs = stmt.executeQuery(String.format( "select 1943 c1, 3.1415926 c2, %s c3, '1234' c4 from dual;", odpsDecimalStr)); { rs.next(); Assert.assertEquals(1943, rs.getInt(1)); Assert.assertEquals((int) 3.1415926, rs.getInt(2)); Assert.assertEquals(bigDecimal.intValue(), rs.getInt(3)); Assert.assertEquals(1234, rs.getInt(4)); Assert.assertEquals((short) 1943, rs.getShort(1)); Assert.assertEquals((short) 3.1415926, rs.getShort(2)); Assert.assertEquals(bigDecimal.shortValue(), rs.getShort(3)); Assert.assertEquals((short) 1234, rs.getShort(4)); Assert.assertEquals((long) 1943, rs.getLong(1)); Assert.assertEquals((long) 3.1415926, rs.getLong(2)); Assert.assertEquals(bigDecimal.longValue(), rs.getLong(3)); Assert.assertEquals((long) 1234, rs.getLong(4)); } rs.close(); } @Test public void testGetFloatPoint() throws Exception { // cast from BIGINT, DOUBLE, DECIMAL, STRING ResultSet rs = stmt.executeQuery(String.format( "select 1943 c1, 3.1415926 c2, %s c3, '3.1415926' c4 from dual;", odpsDecimalStr)); { rs.next(); Assert.assertEquals((double) 1943, rs.getDouble(1), 0); Assert.assertEquals(3.1415926, rs.getDouble(2), 0); Assert.assertEquals(bigDecimal.doubleValue(), rs.getDouble(3), 0); Assert.assertEquals(3.1415926, rs.getDouble(4), 0); Assert.assertEquals((float) 1943, rs.getFloat(1), 0); Assert.assertEquals((float) 3.1415926, rs.getFloat(2), 0); Assert.assertEquals(bigDecimal.floatValue(), rs.getFloat(3), 0); Assert.assertEquals((float) 3.1415926, rs.getFloat(4), 0); } rs.close(); } @Test public void testGetBigDecimal() throws Exception { // cast from STRING, DECIMAL ResultSet rs = stmt.executeQuery(String.format("select %s c1, %s c2 from dual;", decimalStr, odpsDecimalStr)); { rs.next(); Assert.assertEquals(bigDecimal, rs.getBigDecimal(1)); Assert.assertEquals(bigDecimal, rs.getBigDecimal(2)); } rs.close(); } @Test public void testGetTimeFormat() throws Exception { // cast from STRING, DATETIME ResultSet rs = stmt.executeQuery(String.format("select DATETIME'%s' c1, %s c2 from dual;", nowStr, odpsNowStr)); { rs.next(); Assert.assertEquals(new Date(unixTimeNow).toString(), rs.getDate(1).toString()); Assert.assertEquals(new Date(unixTimeNow).toString(), rs.getDate(2).toString()); Assert.assertEquals(new Time(unixTimeNow).toString(), rs.getTime(1).toString()); Assert.assertEquals(new Time(unixTimeNow).toString(), rs.getTime(2).toString()); Assert.assertEquals(formatter.format(new Timestamp(unixTimeNow)), formatter.format(rs.getTimestamp(1))); Assert.assertEquals(formatter.format(new Timestamp(unixTimeNow)), formatter.format(rs.getTimestamp(2))); } rs.close(); } @Test public void testGetString() throws Exception { // cast from STRING, DOUBLE, BIGINT, DATETIME, DECIMAL ResultSet rs = stmt.executeQuery(String.format( "select 'alibaba' c1, 0.5 c2, 1 c3, %s c4, %s c5, true c6 from dual;", odpsNowStr, odpsDecimalStr)); { rs.next(); Assert.assertEquals("alibaba", rs.getString(1)); Assert.assertEquals("alibaba", rs.getString("c1")); Assert.assertEquals("0.5", rs.getString(2)); Assert.assertEquals("1", rs.getString(3)); Assert.assertEquals(nowStr, rs.getString(4)); Assert.assertEquals(decimalValue, rs.getString(5)); Assert.assertEquals(Boolean.TRUE.toString(), rs.getString(6)); } rs.close(); } @Test public void testGetStringForComplexType() throws Exception { // complex map column String sql = "select map_from_entries(array(struct(1, \"a\"),struct(2, \"b\")))"; ResultSet rs = stmt.executeQuery(sql); { rs.next(); Assert.assertEquals("{\"2\":\"b\",\"1\":\"a\"}", rs.getString(1)); } rs.close(); } @Test public void testGetTimestampWithTimeZone() throws SQLException { TimeZone tz = ((OdpsConnection) TestManager.getInstance().conn).getProjectTimeZone(); // Make sure the project's time zone is not UTC, or this test case will always pass. Assert.assertNotEquals(0, tz.getRawOffset()); long timestampWithoutTimeZone; try (ResultSet rs = stmt.executeQuery(String.format("select %s c1 from dual;", odpsNowStr))) { rs.next(); timestampWithoutTimeZone = rs.getTimestamp(1).getTime(); } long timestampWithTimeZone; ((OdpsConnection) TestManager.getInstance().conn).setUseProjectTimeZone(true); try (ResultSet rs = stmt.executeQuery(String.format("select %s c1 from dual;", odpsNowStr))) { rs.next(); timestampWithTimeZone = rs.getTimestamp(1).getTime(); } finally { ((OdpsConnection) TestManager.getInstance().conn).setUseProjectTimeZone(false); } Assert.assertEquals(tz.getRawOffset(),timestampWithTimeZone - timestampWithoutTimeZone); } } <|start_filename|>src/main/java/com/aliyun/odps/jdbc/utils/OdpsFormatter.java<|end_filename|> package com.aliyun.odps.jdbc.utils; import java.sql.Timestamp; import java.util.logging.Formatter; import java.util.logging.LogRecord; public class OdpsFormatter extends Formatter { @Override public synchronized String format(LogRecord record) { Timestamp timestamp = new Timestamp(record.getMillis()); String format = "[%s] [connection-%s] [%s] %s\n"; return String.format( format, record.getLevel(), record.getLoggerName(), timestamp.toString(), record.getMessage()); } } <|start_filename|>src/test/java/com/aliyun/odps/jdbc/OdpsSessionScollResultSetTest.java<|end_filename|> /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package com.aliyun.odps.jdbc; import java.sql.Connection; import java.sql.ResultSet; import java.sql.Statement; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; import org.junit.Assert; import com.aliyun.odps.data.Record; import com.aliyun.odps.data.RecordWriter; import com.aliyun.odps.tunnel.TableTunnel; public class OdpsSessionScollResultSetTest { private static Connection conn; private static Connection sessionConn; private static Statement stmt; private static ResultSet rs; private static String INPUT_TABLE_NAME = "statement_test_table_input"; private static final String SQL = "set odps.sql.select.auto.limit=-1;set odps.sql.session.result.cache.enable=false;select * from " + INPUT_TABLE_NAME; private static final int ROWS = 100000; @BeforeClass public static void setUp() throws Exception { conn = TestManager.getInstance().conn; sessionConn = TestManager.getInstance().sessionConn; OdpsConnection odpsConn = (OdpsConnection) sessionConn; odpsConn.setEnableLimit(false); stmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); stmt.executeUpdate("drop table if exists " + INPUT_TABLE_NAME); stmt.executeUpdate("create table if not exists "+ INPUT_TABLE_NAME +"(id bigint);"); TableTunnel.UploadSession upload = TestManager.getInstance().tunnel.createUploadSession( TestManager.getInstance().odps.getDefaultProject(), INPUT_TABLE_NAME); RecordWriter writer = upload.openRecordWriter(0); Record r = upload.newRecord(); for (int i = 0; i < ROWS; i++) { r.setBigint(0, (long) i); writer.write(r); } writer.close(); upload.commit(new Long[]{0L}); stmt = sessionConn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); rs = stmt.executeQuery(SQL); Assert.assertEquals(ResultSet.FETCH_UNKNOWN, rs.getFetchDirection()); } @AfterClass public static void tearDown() throws Exception { stmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); stmt.executeUpdate("drop table if exists " + INPUT_TABLE_NAME); rs.close(); stmt.close(); } @Test public void testGetType() throws Exception { Assert.assertEquals(ResultSet.TYPE_SCROLL_INSENSITIVE, rs.getType()); } @Test public void testSetFetchDirection() throws Exception { rs.setFetchDirection(ResultSet.FETCH_FORWARD); Assert.assertEquals(ResultSet.FETCH_FORWARD, rs.getFetchDirection()); rs.setFetchDirection(ResultSet.FETCH_REVERSE); Assert.assertEquals(ResultSet.FETCH_REVERSE, rs.getFetchDirection()); rs.setFetchDirection(ResultSet.FETCH_UNKNOWN); Assert.assertEquals(ResultSet.FETCH_UNKNOWN, rs.getFetchDirection()); } @Test public void testSetFetchSize() throws Exception { rs.setFetchDirection(ResultSet.FETCH_FORWARD); rs.setFetchSize(12345); Assert.assertEquals(12345, rs.getFetchSize()); { int i = 0; while (rs.next()) { Assert.assertEquals(i, rs.getInt(1)); i++; } } Assert.assertEquals(true, rs.isAfterLast()); } @Test public void testBorderCase() throws Exception { rs.afterLast(); Assert.assertEquals(true, rs.isAfterLast()); rs.beforeFirst(); Assert.assertEquals(true, rs.isBeforeFirst()); rs.first(); Assert.assertEquals(true, rs.isFirst()); rs.last(); Assert.assertEquals(true, rs.isLast()); } @Test public void testReverse10K() throws Exception { rs.setFetchDirection(ResultSet.FETCH_REVERSE); rs.setFetchSize(10000); { int i = ROWS; while (rs.previous()) { Assert.assertEquals(i, rs.getRow()); Assert.assertEquals(i - 1, rs.getInt(1)); i--; } Assert.assertEquals(0, i); } Assert.assertEquals(true, rs.isBeforeFirst()); } @Test public void testForward10K() throws Exception { rs.setFetchDirection(ResultSet.FETCH_FORWARD); rs.setFetchSize(100000); long start = System.currentTimeMillis(); { int i = 0; while (rs.next()) { Assert.assertEquals(i + 1, rs.getRow()); Assert.assertEquals(i, rs.getInt(1)); i++; } Assert.assertEquals(ROWS, i); } long end = System.currentTimeMillis(); System.out.printf("step\t%d\tmillis\t%d\n", rs.getFetchSize(), end - start); Assert.assertEquals(true, rs.isAfterLast()); } @Test public void testForward100K() throws Exception { rs.setFetchDirection(ResultSet.FETCH_FORWARD); rs.setFetchSize(100000); long start = System.currentTimeMillis(); { int i = 0; while (rs.next()) { Assert.assertEquals(i + 1, rs.getRow()); Assert.assertEquals(i, rs.getInt(1)); i++; } Assert.assertEquals(ROWS, i); } long end = System.currentTimeMillis(); System.out.printf("step\t%d\tmillis\t%d\n", rs.getFetchSize(), end - start); Assert.assertEquals(true, rs.isAfterLast()); } @Test public void testForward5K() throws Exception { rs.setFetchDirection(ResultSet.FETCH_FORWARD); rs.setFetchSize(5000); long start = System.currentTimeMillis(); { int i = 0; while (rs.next()) { Assert.assertEquals(i + 1, rs.getRow()); Assert.assertEquals(i, rs.getInt(1)); i++; } Assert.assertEquals(ROWS, i); } long end = System.currentTimeMillis(); System.out.printf("step\t%d\tmillis\t%d\n", rs.getFetchSize(), end - start); Assert.assertEquals(true, rs.isAfterLast()); } @Test public void testRandomAccess() throws Exception { rs.setFetchSize(5000); // free walk Assert.assertTrue(rs.absolute(245)); Assert.assertEquals(245, rs.getRow()); Assert.assertEquals(244, rs.getInt(1)); Assert.assertTrue(rs.relative(2)); Assert.assertEquals(247, rs.getRow()); Assert.assertEquals(246, rs.getInt(1)); Assert.assertTrue(rs.relative(-5)); Assert.assertEquals(242, rs.getRow()); Assert.assertEquals(241, rs.getInt(1)); Assert.assertFalse(rs.relative(-500)); Assert.assertEquals(true, rs.isBeforeFirst()); Assert.assertTrue(rs.absolute(-1)); Assert.assertEquals(ROWS, rs.getRow()); Assert.assertEquals(ROWS - 1, rs.getInt(1)); Assert.assertTrue(rs.absolute(-1024)); Assert.assertEquals(ROWS - 1023, rs.getRow()); Assert.assertEquals(ROWS - 1024, rs.getInt(1)); // absolute to the exact bound Assert.assertTrue(rs.absolute(1)); Assert.assertEquals(true, rs.isFirst()); Assert.assertEquals(0, rs.getInt(1)); Assert.assertFalse(rs.relative(-1)); Assert.assertEquals(true, rs.isBeforeFirst()); Assert.assertTrue(rs.absolute(ROWS)); Assert.assertEquals(true, rs.isLast()); Assert.assertEquals(ROWS - 1, rs.getInt(1)); Assert.assertTrue(rs.absolute(-ROWS)); Assert.assertEquals(true, rs.isFirst()); Assert.assertEquals(0, rs.getInt(1)); // absolute out of bound Assert.assertFalse(rs.absolute(0)); Assert.assertEquals(true, rs.isBeforeFirst()); Assert.assertFalse(rs.absolute(ROWS + 1)); Assert.assertEquals(true, rs.isAfterLast()); Assert.assertFalse(rs.relative(1)); Assert.assertEquals(true, rs.isAfterLast()); Assert.assertFalse(rs.absolute(-ROWS - 1)); Assert.assertEquals(true, rs.isBeforeFirst()); } } <|start_filename|>src/main/java/com/aliyun/odps/jdbc/utils/transformer/to/jdbc/ToJdbcTimestampTransformer.java<|end_filename|> /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package com.aliyun.odps.jdbc.utils.transformer.to.jdbc; import java.sql.SQLException; import java.sql.Timestamp; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.TimeZone; public class ToJdbcTimestampTransformer extends AbstractToJdbcDateTypeTransformer { @Override public Object transform( Object o, String charset, Calendar cal, TimeZone timeZone) throws SQLException { if (o == null) { return null; } if (java.util.Date.class.isInstance(o)) { long time = ((java.util.Date) o).getTime(); if (timeZone != null) { time += timeZone.getOffset(time); } int nanos = 0; if (o instanceof java.sql.Timestamp) { nanos = ((java.sql.Timestamp) o).getNanos(); } java.sql.Timestamp ts = new java.sql.Timestamp(time); ts.setNanos(nanos); return ts; } else if (o instanceof byte[]) { try { // Acceptable pattern yyyy-MM-dd HH:mm:ss[.f...] SimpleDateFormat datetimeFormat = DATETIME_FORMAT.get(); if (cal != null) { datetimeFormat.setCalendar(cal); } // A timestamp string has two parts: datetime part and nano value part. We will firstly // process the datetime part and apply the timezone. The nano value part will be set to the // timestamp object later, since it has nothing to do with timezone. // Deal with the datetime part, apply the timezone String timestampStr = encodeBytes((byte[]) o, charset); int dotIndex = timestampStr.indexOf('.'); Date date; if (dotIndex == -1) { date = datetimeFormat.parse(timestampStr); } else { date = datetimeFormat.parse(timestampStr.substring(0, dotIndex)); } // Overwrite the datetime part Timestamp timestamp = java.sql.Timestamp.valueOf(timestampStr); int nanoValue = timestamp.getNanos(); timestamp.setTime(date.getTime()); timestamp.setNanos(nanoValue); return timestamp; } catch (IllegalArgumentException e) { String errorMsg = getTransformationErrMsg(o, java.sql.Timestamp.class); throw new SQLException(errorMsg); } catch (ParseException e) { String errorMsg = getTransformationErrMsg(o, java.sql.Timestamp.class); throw new SQLException(errorMsg); } finally { restoreToDefaultCalendar(); } } else { String errorMsg = getInvalidTransformationErrorMsg(o.getClass(), java.sql.Timestamp.class); throw new SQLException(errorMsg); } } } <|start_filename|>src/main/java/com/aliyun/odps/jdbc/utils/transformer/to/jdbc/ToJdbcTransformerFactory.java<|end_filename|> /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package com.aliyun.odps.jdbc.utils.transformer.to.jdbc; import java.math.BigDecimal; import java.sql.SQLException; import java.util.HashMap; import java.util.Map; public class ToJdbcTransformerFactory { private ToJdbcTransformerFactory() { } private static final ToJdbcByteTransformer BYTE_TRANSFORMER = new ToJdbcByteTransformer(); private static final ToJdbcShortTransformer SHORT_TRANSFORMER = new ToJdbcShortTransformer(); private static final ToJdbcIntTransformer INT_TRANSFORMER = new ToJdbcIntTransformer(); private static final ToJdbcLongTransformer LONG_TRANSFORMER = new ToJdbcLongTransformer(); private static final ToJdbcFloatTransformer FLOAT_TRANSFORMER = new ToJdbcFloatTransformer(); private static final ToJdbcDoubleTransformer DOUBLE_TRANSFORMER = new ToJdbcDoubleTransformer(); private static final ToJdbcBigDecimalTransformer BIG_DECIMAL_TRANSFORMER = new ToJdbcBigDecimalTransformer(); private static final ToJdbcStringTransformer STRING_TRANSFORMER = new ToJdbcStringTransformer(); private static final ToJdbcByteArrayTransformer BYTE_ARRAY_TRANSFORMER = new ToJdbcByteArrayTransformer(); private static final ToJdbcDateTransformer DATE_TRANSFORMER = new ToJdbcDateTransformer(); private static final ToJdbcTimeTransfomer TIME_TRANSFORMER = new ToJdbcTimeTransfomer(); private static final ToJdbcTimestampTransformer TIMESTAMP_TRANSFORMER = new ToJdbcTimestampTransformer(); private static final ToJdbcBooleanTransformer BOOLEAN_TRANSFORMER = new ToJdbcBooleanTransformer(); private static final Map<Class, AbstractToJdbcTransformer> JDBC_CLASS_TO_TRANSFORMER = new HashMap<Class, AbstractToJdbcTransformer>(); static { JDBC_CLASS_TO_TRANSFORMER.put(byte.class, BYTE_TRANSFORMER); JDBC_CLASS_TO_TRANSFORMER.put(short.class, SHORT_TRANSFORMER); JDBC_CLASS_TO_TRANSFORMER.put(int.class, INT_TRANSFORMER); JDBC_CLASS_TO_TRANSFORMER.put(long.class, LONG_TRANSFORMER); JDBC_CLASS_TO_TRANSFORMER.put(float.class, FLOAT_TRANSFORMER); JDBC_CLASS_TO_TRANSFORMER.put(double.class, DOUBLE_TRANSFORMER); JDBC_CLASS_TO_TRANSFORMER.put(BigDecimal.class, BIG_DECIMAL_TRANSFORMER); JDBC_CLASS_TO_TRANSFORMER.put(String.class, STRING_TRANSFORMER); JDBC_CLASS_TO_TRANSFORMER.put(byte[].class, BYTE_ARRAY_TRANSFORMER); JDBC_CLASS_TO_TRANSFORMER.put(java.sql.Date.class, DATE_TRANSFORMER); JDBC_CLASS_TO_TRANSFORMER.put(java.sql.Time.class, TIME_TRANSFORMER); JDBC_CLASS_TO_TRANSFORMER.put(java.sql.Timestamp.class, TIMESTAMP_TRANSFORMER); JDBC_CLASS_TO_TRANSFORMER.put(boolean.class, BOOLEAN_TRANSFORMER); } public static AbstractToJdbcTransformer getTransformer(Class jdbcCls) throws SQLException { AbstractToJdbcTransformer transformer = JDBC_CLASS_TO_TRANSFORMER.get(jdbcCls); if (transformer == null) { throw new SQLException("Not supported JDBC class: " + jdbcCls.getName()); } return transformer; } } <|start_filename|>src/main/java/com/aliyun/odps/jdbc/utils/transformer/to/jdbc/ToJdbcDateTransformer.java<|end_filename|> /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package com.aliyun.odps.jdbc.utils.transformer.to.jdbc; import java.sql.SQLException; import java.text.ParseException; import java.text.SimpleDateFormat; import java.time.LocalDate; import java.util.Calendar; import java.util.TimeZone; public class ToJdbcDateTransformer extends AbstractToJdbcDateTypeTransformer { @Override public Object transform( Object o, String charset, Calendar cal, TimeZone timeZone) throws SQLException { if (o == null) { return null; } if (java.util.Date.class.isInstance(o)) { long time = ((java.util.Date) o).getTime(); if (timeZone != null) { time += timeZone.getOffset(time); } return new java.sql.Date(time); } else if (o instanceof LocalDate) { LocalDate localDate = (LocalDate) o; Calendar calendar = (Calendar) DEFAULT_CALENDAR.get().clone(); calendar.clear(); calendar.set( localDate.getYear(), // Starts from 0 localDate.getMonth().getValue() - 1, localDate.getDayOfMonth()); return new java.sql.Date(calendar.getTime().getTime()); } else if (o instanceof byte[]) { try { SimpleDateFormat datetimeFormat = DATETIME_FORMAT.get(); SimpleDateFormat dateFormat = DATE_FORMAT.get(); if (cal != null) { datetimeFormat.setCalendar(cal); dateFormat.setCalendar(cal); } try { return new java.sql.Date( datetimeFormat.parse(encodeBytes((byte[]) o, charset)).getTime()); } catch (ParseException ignored) { } try { return new java.sql.Date(dateFormat.parse(encodeBytes((byte[]) o, charset)).getTime()); } catch (ParseException ignored) { } String errorMsg = getTransformationErrMsg(encodeBytes((byte[]) o, charset), java.sql.Date.class); throw new SQLException(errorMsg); } finally { restoreToDefaultCalendar(); } } else { String errorMsg = getInvalidTransformationErrorMsg(o.getClass(), java.sql.Date.class); throw new SQLException(errorMsg); } } } <|start_filename|>src/main/java/com/aliyun/odps/jdbc/utils/OdpsLogger.java<|end_filename|> package com.aliyun.odps.jdbc.utils; import java.io.File; import java.io.IOException; import java.io.PrintWriter; import java.io.StringWriter; import java.nio.file.Paths; import java.util.Map; import java.util.Objects; import java.util.concurrent.ConcurrentHashMap; import java.util.logging.ConsoleHandler; import java.util.logging.FileHandler; import java.util.logging.Handler; import java.util.logging.Level; import java.util.logging.Logger; import com.aliyun.odps.jdbc.OdpsDriver; public class OdpsLogger { private static final String DEFAULT_OUTPUT_DIR = "/tmp"; private static Map<String, FileHandler> pathToFileHandler = new ConcurrentHashMap<>(); private boolean enableOdpsLogger = false; private Logger odpsLogger; private org.slf4j.Logger sl4jLogger; /** * Constructor * * @param name For both odps and sl4j logger, name of the logger * @param outputPath For odps logger, output path for file handler * @param toConsole For odps logger, output to console or not * @param enableOdpsLogger For odps logger, enable or not * @param configFilePath For sl4j logger, config file path */ public OdpsLogger(String name, String outputPath, String configFilePath, boolean toConsole, boolean enableOdpsLogger) { this.enableOdpsLogger = enableOdpsLogger; Objects.requireNonNull(name); // Init odps logger if (outputPath == null) { outputPath = getDefaultOutputPath(); } if (enableOdpsLogger) { odpsLogger = Logger.getLogger(name); odpsLogger.setLevel(Level.ALL); if (toConsole) { Handler consoleHandler = new ConsoleHandler(); consoleHandler.setFormatter(new OdpsFormatter()); consoleHandler.setLevel(Level.ALL); odpsLogger.addHandler(consoleHandler); } } try { FileHandler fileHandler; if (pathToFileHandler.containsKey(outputPath)) { fileHandler = pathToFileHandler.get(outputPath); } else { fileHandler = new FileHandler(outputPath, true); fileHandler.setFormatter(new OdpsFormatter()); fileHandler.setLevel(Level.ALL); pathToFileHandler.put(outputPath, fileHandler); } if (enableOdpsLogger) { odpsLogger.addHandler(fileHandler); } } catch (IOException e) { // ignore } // Init sl4j logger sl4jLogger = LoggerFactory.getLogger(configFilePath, name); } public synchronized void debug(String msg) { if (enableOdpsLogger) { odpsLogger.fine(msg); } sl4jLogger.debug(msg); } public synchronized void info(String msg) { if (enableOdpsLogger) { odpsLogger.info(msg); } sl4jLogger.info(msg); } public synchronized void warn(String msg) { if (enableOdpsLogger) { odpsLogger.warning(msg); } sl4jLogger.warn(msg); } public synchronized void error(String msg) { if (enableOdpsLogger) { odpsLogger.severe(msg); } sl4jLogger.error(msg); } public synchronized void error(String msg, Throwable e) { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); e.printStackTrace(pw); if (enableOdpsLogger) { odpsLogger.severe(msg); odpsLogger.severe(sw.toString()); } sl4jLogger.error(msg, e); } /** * Return the default output path. This method tries to return the dir of source code. If it is * not allowed due to security reason, return "/tmp" * * @return default output path */ public static String getDefaultOutputPath() { String outputPath; try { outputPath = new File(OdpsDriver.class.getProtectionDomain().getCodeSource() .getLocation().toURI()).getParent(); } catch (Exception e) { outputPath = DEFAULT_OUTPUT_DIR; } return Paths.get(outputPath, "jdbc.log").toString(); } } <|start_filename|>src/main/java/com/aliyun/odps/jdbc/OdpsSessionForwardResultSet.java<|end_filename|> /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package com.aliyun.odps.jdbc; import com.aliyun.odps.data.Record; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; public class OdpsSessionForwardResultSet extends OdpsResultSet implements ResultSet { private Object[] currentRow; com.aliyun.odps.data.ResultSet resultSet; private int fetchedRows = 0; // max row count can be read private int totalRows = Integer.MAX_VALUE; private boolean isClosed = false; private long startTime; OdpsSessionForwardResultSet(OdpsStatement stmt, OdpsResultSetMetaData meta, com.aliyun.odps.data.ResultSet resultSet, long startTime) throws SQLException { super(stmt.getConnection(), stmt, meta); // maxRows take effect only if it > 0 if (stmt.resultSetMaxRows > 0) { totalRows = stmt.resultSetMaxRows; } this.resultSet = resultSet; this.startTime = startTime; } protected void checkClosed() throws SQLException { if (isClosed) { throw new SQLException("The result set has been closed"); } } @Override public int getRow() throws SQLException { checkClosed(); return (int) fetchedRows; } @Override public int getType() throws SQLException { return ResultSet.TYPE_FORWARD_ONLY; } @Override public boolean isClosed() throws SQLException { return isClosed; } @Override public void close() throws SQLException { if (isClosed) { return; } isClosed = true; conn.log.debug("the result set has been closed"); } @Override public boolean next() throws SQLException { checkClosed(); if (fetchedRows == totalRows || !resultSet.hasNext()) { conn.log.info("It took me " + (System.currentTimeMillis() - startTime) + " ms to fetch all records, count:" + fetchedRows); return false; } Record record = resultSet.next(); int columns = record.getColumnCount(); currentRow = new Object[columns]; for (int i = 0; i < columns; i++) { currentRow[i] = record.get(i); } fetchedRows++; return true; } @Override protected Object[] rowAtCursor() throws SQLException { if (currentRow == null) { throw new SQLException("the row should be not-null, row=" + fetchedRows); } if (currentRow.length == 0) { throw new SQLException("the row should have more than 1 column , row=" + fetchedRows); } return currentRow; } } <|start_filename|>src/main/java/com/aliyun/odps/jdbc/OdpsResultSet.java<|end_filename|> /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package com.aliyun.odps.jdbc; import java.io.InputStream; import java.io.Reader; import java.math.BigDecimal; import java.net.URL; import java.sql.Array; import java.sql.Blob; import java.sql.Clob; import java.sql.NClob; import java.sql.Ref; import java.sql.ResultSet; import java.sql.RowId; import java.sql.SQLException; import java.sql.SQLFeatureNotSupportedException; import java.sql.SQLWarning; import java.sql.SQLXML; import java.sql.Time; import java.sql.Timestamp; import java.util.Calendar; import java.util.Map; import java.util.TimeZone; import com.aliyun.odps.jdbc.utils.transformer.to.jdbc.AbstractToJdbcDateTypeTransformer; import com.aliyun.odps.jdbc.utils.transformer.to.jdbc.AbstractToJdbcTransformer; import com.aliyun.odps.jdbc.utils.transformer.to.jdbc.ToJdbcTransformerFactory; import com.aliyun.odps.type.TypeInfo; public abstract class OdpsResultSet extends WrapperAdapter implements ResultSet { private OdpsResultSetMetaData meta; private OdpsStatement stmt; protected OdpsConnection conn; private boolean wasNull = false; private SQLWarning warningChain = null; OdpsResultSet(OdpsConnection conn, OdpsStatement stmt, OdpsResultSetMetaData meta) { this.stmt = stmt; this.meta = meta; this.conn = conn; } @Override public int getFetchDirection() throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public void setFetchDirection(int direction) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public int getFetchSize() throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public void setFetchSize(int rows) throws SQLException { conn.log.warn("Unsupported method call: OdpsResultSet#setFetchSize, ignored"); } @Override public boolean absolute(int row) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public void afterLast() throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public void beforeFirst() throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public void cancelRowUpdates() throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public void clearWarnings() throws SQLException { warningChain = null; } @Override public void deleteRow() throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public boolean first() throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public Array getArray(int columnIndex) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public Array getArray(String columnLabel) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public InputStream getAsciiStream(int columnIndex) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public InputStream getAsciiStream(String columnLabel) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public BigDecimal getBigDecimal(int columnIndex) throws SQLException { Object val = getInnerObject(columnIndex); return (BigDecimal) transformToJdbcType(val, BigDecimal.class); } @Override public BigDecimal getBigDecimal(String columnLabel) throws SQLException { int columnIndex = findColumn(columnLabel); return getBigDecimal(columnIndex); } /** * The column index can be retrieved by name through the ResultSetMetaData. * * @param columnLabel * the name of the column * @return the column index * @throws SQLException invalid label */ @Override public int findColumn(String columnLabel) throws SQLException { int index = getMetaData().getColumnIndex(columnLabel); if (index == -1) { throw new SQLException("the column label is invalid"); } return index; } @Override public BigDecimal getBigDecimal(int columnIndex, int scale) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public BigDecimal getBigDecimal(String columnLabel, int scale) throws SQLException { throw new SQLFeatureNotSupportedException(); } // Accessor abstract Object[] rowAtCursor() throws SQLException; // Do not call this method within OdpsResultSet class, call getInnerObject instead @Override public Object getObject(int columnIndex) throws SQLException { Object obj = getInnerObject(columnIndex); if (obj instanceof byte[]) { String charset = conn.getCharset(); return AbstractToJdbcTransformer.encodeBytes((byte[]) obj, charset); } return obj; } // The implementation stores STRING as byte[], but JDBC can only see String. // We need this method to cover since we only want to convert bytes[] to string as // late as in the real getObject(). private Object getInnerObject(int columnIndex) throws SQLException { Object[] row = rowAtCursor(); if (columnIndex < 1 || columnIndex > row.length) { throw new SQLException("column index must be >=1 and <=" + rowAtCursor().length); } Object obj = row[columnIndex - 1]; wasNull = (obj == null); return obj; } @Override public Object getObject(String columnLabel) throws SQLException { int columnIndex = findColumn(columnLabel); return getObject(columnIndex); } @Override public Object getObject(int columnIndex, Map<String, Class<?>> map) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public Object getObject(String columnLabel, Map<String, Class<?>> map) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public <T> T getObject(int columnIndex, Class<T> type) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public <T> T getObject(String columnLabel, Class<T> type) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public InputStream getBinaryStream(int columnIndex) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public InputStream getBinaryStream(String columnLabel) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public Blob getBlob(int columnIndex) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public Blob getBlob(String columnLabel) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public boolean getBoolean(int columnIndex) throws SQLException { Object obj = getInnerObject(columnIndex); return (Boolean) transformToJdbcType(obj, boolean.class); } @Override public boolean getBoolean(String columnLabel) throws SQLException { int columnIndex = findColumn(columnLabel); return getBoolean(columnIndex); } @Override public byte getByte(int columnIndex) throws SQLException { Object obj = getInnerObject(columnIndex); return (Byte) transformToJdbcType(obj, byte.class); } @Override public byte getByte(String columnLabel) throws SQLException { int columnIndex = findColumn(columnLabel); return getByte(columnIndex); } @Override public byte[] getBytes(int columnIndex) throws SQLException { Object obj = getInnerObject(columnIndex); return (byte[]) transformToJdbcType(obj, byte[].class); } @Override public byte[] getBytes(String columnLabel) throws SQLException { int columnIndex = findColumn(columnLabel); return getBytes(columnIndex); } @Override public Reader getCharacterStream(int columnIndex) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public Reader getCharacterStream(String columnLabel) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public Clob getClob(int columnIndex) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public Clob getClob(String columnLabel) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public int getConcurrency() throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public String getCursorName() throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public java.sql.Date getDate(int columnIndex) throws SQLException { return getDate(columnIndex, null); } @Override public java.sql.Date getDate(String columnLabel) throws SQLException { int columnIndex = findColumn(columnLabel); return getDate(columnIndex); } @Override public java.sql.Date getDate(int columnIndex, Calendar cal) throws SQLException { Object obj = getInnerObject(columnIndex); return (java.sql.Date) transformToJdbcType(obj, java.sql.Date.class, cal); } @Override public java.sql.Date getDate(String columnLabel, Calendar cal) throws SQLException { int columnIndex = findColumn(columnLabel); return getDate(columnIndex, cal); } @Override public double getDouble(int columnIndex) throws SQLException { Object obj = getInnerObject(columnIndex); return (Double) transformToJdbcType(obj, double.class); } @Override public double getDouble(String columnLabel) throws SQLException { int columnIndex = findColumn(columnLabel); return getDouble(columnIndex); } @Override public float getFloat(int columnIndex) throws SQLException { Object obj = getInnerObject(columnIndex); return (Float) transformToJdbcType(obj, float.class); } @Override public float getFloat(String columnLabel) throws SQLException { int columnIndex = findColumn(columnLabel); return getFloat(columnIndex); } @Override public int getHoldability() throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public int getInt(int columnIndex) throws SQLException { Object obj = getInnerObject(columnIndex); return (Integer) transformToJdbcType(obj, int.class); } @Override public int getInt(String columnLabel) throws SQLException { int columnIndex = findColumn(columnLabel); return getInt(columnIndex); } @Override public long getLong(int columnIndex) throws SQLException { Object obj = getInnerObject(columnIndex); return (Long) transformToJdbcType(obj, long.class); } @Override public long getLong(String columnLabel) throws SQLException { int columnIndex = findColumn(columnLabel); return getLong(columnIndex); } @Override public OdpsResultSetMetaData getMetaData() throws SQLException { return meta; } @Override public Reader getNCharacterStream(int columnIndex) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public Reader getNCharacterStream(String columnLabel) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public NClob getNClob(int columnIndex) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public NClob getNClob(String columnLabel) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public String getNString(int columnIndex) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public String getString(int columnIndex) throws SQLException { Object obj = getInnerObject(columnIndex); return (String) transformToJdbcType(obj, String.class, null, meta.getColumnOdpsType(columnIndex)); } @Override public String getNString(String columnLabel) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public String getString(String columnLabel) throws SQLException { int columnIndex = findColumn(columnLabel); return getString(columnIndex); } @Override public Ref getRef(int columnIndex) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public Ref getRef(String columnLabel) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public int getRow() throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public RowId getRowId(int columnIndex) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public RowId getRowId(String columnLabel) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public SQLXML getSQLXML(int columnIndex) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public SQLXML getSQLXML(String columnLabel) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public short getShort(int columnIndex) throws SQLException { Object obj = getInnerObject(columnIndex); return (Short) transformToJdbcType(obj, short.class); } @Override public short getShort(String columnLabel) throws SQLException { int columnIndex = findColumn(columnLabel); return getShort(columnIndex); } @Override public OdpsStatement getStatement() throws SQLException { return stmt; } @Override public Time getTime(int columnIndex) throws SQLException { return getTime(columnIndex, null); } @Override public Time getTime(String columnLabel) throws SQLException { int columnIndex = findColumn(columnLabel); return getTime(columnIndex); } @Override public Time getTime(int columnIndex, Calendar cal) throws SQLException { Object obj = getInnerObject(columnIndex); return (java.sql.Time) transformToJdbcType(obj, java.sql.Time.class, cal); } @Override public Time getTime(String columnLabel, Calendar cal) throws SQLException { int columnIndex = findColumn(columnLabel); return getTime(columnIndex, cal); } @Override public Timestamp getTimestamp(int columnIndex) throws SQLException { return getTimestamp(columnIndex, null); } @Override public Timestamp getTimestamp(String columnLabel) throws SQLException { int columnIndex = findColumn(columnLabel); return getTimestamp(columnIndex); } @Override public Timestamp getTimestamp(int columnIndex, Calendar cal) throws SQLException { Object obj = getInnerObject(columnIndex); return (Timestamp) transformToJdbcType(obj, Timestamp.class, cal); } @Override public Timestamp getTimestamp(String columnLabel, Calendar cal) throws SQLException { int columnIndex = findColumn(columnLabel); return getTimestamp(columnIndex, cal); } @Override public int getType() throws SQLException { return ResultSet.TYPE_FORWARD_ONLY; } @Override public URL getURL(int columnIndex) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public URL getURL(String columnLabel) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public InputStream getUnicodeStream(int columnIndex) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public InputStream getUnicodeStream(String columnLabel) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public SQLWarning getWarnings() throws SQLException { return warningChain; } @Override public void insertRow() throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public boolean isAfterLast() throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public boolean isBeforeFirst() throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public boolean isClosed() throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public boolean isFirst() throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public boolean isLast() throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public boolean last() throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public void moveToCurrentRow() throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public void moveToInsertRow() throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public boolean previous() throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public void refreshRow() throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public boolean relative(int rows) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public boolean rowDeleted() throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public boolean rowInserted() throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public boolean rowUpdated() throws SQLException { throw new SQLFeatureNotSupportedException(); } private Object transformToJdbcType(Object o, Class jdbcCls) throws SQLException { AbstractToJdbcTransformer transformer = ToJdbcTransformerFactory.getTransformer(jdbcCls); return transformer.transform(o, conn.getCharset()); } private Object transformToJdbcType(Object o, Class jdbcCls, TypeInfo typeInfo) throws SQLException { AbstractToJdbcTransformer transformer = ToJdbcTransformerFactory.getTransformer(jdbcCls); return transformer.transform(o, conn.getCharset(), typeInfo); } private Object transformToJdbcType(Object o, Class jdbcCls, Calendar cal) throws SQLException { return transformToJdbcType(o, jdbcCls, cal, null); } private Object transformToJdbcType(Object o, Class jdbcCls, Calendar cal, TypeInfo typeInfo) throws SQLException { AbstractToJdbcTransformer transformer = ToJdbcTransformerFactory.getTransformer(jdbcCls); TimeZone timeZone = null; if (stmt != null) { String sessionTimeZoneId = stmt.getSqlTaskProperties().getProperty("odps.sql.timezone", null); if (sessionTimeZoneId != null) { timeZone = TimeZone.getTimeZone(sessionTimeZoneId); } else { timeZone = conn.isUseProjectTimeZone() ? conn.getProjectTimeZone() : null; } } return ((AbstractToJdbcDateTypeTransformer) transformer).transform(o, conn.getCharset(), cal, timeZone, typeInfo); } @Override public void updateArray(int columnIndex, Array x) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public void updateArray(String columnLabel, Array x) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public void updateAsciiStream(int columnIndex, InputStream x) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public void updateAsciiStream(String columnLabel, InputStream x) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public void updateAsciiStream(int columnIndex, InputStream x, int length) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public void updateAsciiStream(String columnLabel, InputStream x, int length) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public void updateAsciiStream(int columnIndex, InputStream x, long length) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public void updateAsciiStream(String columnLabel, InputStream x, long length) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public void updateBigDecimal(int columnIndex, BigDecimal x) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public void updateBigDecimal(String columnLabel, BigDecimal x) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public void updateBinaryStream(int columnIndex, InputStream x) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public void updateBinaryStream(String columnLabel, InputStream x) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public void updateBinaryStream(int columnIndex, InputStream x, int length) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public void updateBinaryStream(String columnLabel, InputStream x, int length) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public void updateBinaryStream(int columnIndex, InputStream x, long length) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public void updateBinaryStream(String columnLabel, InputStream x, long length) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public void updateBlob(int columnIndex, Blob x) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public void updateBlob(String columnLabel, Blob x) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public void updateBlob(int columnIndex, InputStream inputStream) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public void updateBlob(String columnLabel, InputStream inputStream) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public void updateBlob(int columnIndex, InputStream inputStream, long length) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public void updateBlob(String columnLabel, InputStream inputStream, long length) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public void updateBoolean(int columnIndex, boolean x) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public void updateBoolean(String columnLabel, boolean x) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public void updateByte(int columnIndex, byte x) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public void updateByte(String columnLabel, byte x) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public void updateBytes(int columnIndex, byte[] x) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public void updateBytes(String columnLabel, byte[] x) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public void updateCharacterStream(int columnIndex, Reader x) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public void updateCharacterStream(String columnLabel, Reader reader) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public void updateCharacterStream(int columnIndex, Reader x, int length) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public void updateCharacterStream(String columnLabel, Reader reader, int length) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public void updateCharacterStream(int columnIndex, Reader x, long length) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public void updateCharacterStream(String columnLabel, Reader reader, long length) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public void updateClob(int columnIndex, Clob x) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public void updateClob(String columnLabel, Clob x) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public void updateClob(int columnIndex, Reader reader) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public void updateClob(String columnLabel, Reader reader) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public void updateClob(int columnIndex, Reader reader, long length) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public void updateClob(String columnLabel, Reader reader, long length) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public void updateDate(int columnIndex, java.sql.Date x) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public void updateDate(String columnLabel, java.sql.Date x) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public void updateDouble(int columnIndex, double x) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public void updateDouble(String columnLabel, double x) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public void updateFloat(int columnIndex, float x) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public void updateFloat(String columnLabel, float x) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public void updateInt(int columnIndex, int x) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public void updateInt(String columnLabel, int x) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public void updateLong(int columnIndex, long x) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public void updateLong(String columnLabel, long x) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public void updateNCharacterStream(int columnIndex, Reader x) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public void updateNCharacterStream(String columnLabel, Reader reader) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public void updateNCharacterStream(int columnIndex, Reader x, long length) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public void updateNCharacterStream(String columnLabel, Reader reader, long length) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public void updateNClob(int columnIndex, NClob nClob) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public void updateNClob(String columnLabel, NClob nClob) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public void updateNClob(int columnIndex, Reader reader) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public void updateNClob(String columnLabel, Reader reader) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public void updateNClob(int columnIndex, Reader reader, long length) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public void updateNClob(String columnLabel, Reader reader, long length) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public void updateNString(int columnIndex, String nString) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public void updateNString(String columnLabel, String nString) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public void updateNull(int columnIndex) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public void updateNull(String columnLabel) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public void updateObject(int columnIndex, Object x) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public void updateObject(String columnLabel, Object x) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public void updateObject(int columnIndex, Object x, int scaleOrLength) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public void updateObject(String columnLabel, Object x, int scaleOrLength) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public void updateRef(int columnIndex, Ref x) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public void updateRef(String columnLabel, Ref x) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public void updateRow() throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public void updateRowId(int columnIndex, RowId x) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public void updateRowId(String columnLabel, RowId x) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public void updateSQLXML(int columnIndex, SQLXML xmlObject) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public void updateSQLXML(String columnLabel, SQLXML xmlObject) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public void updateShort(int columnIndex, short x) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public void updateShort(String columnLabel, short x) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public void updateString(int columnIndex, String x) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public void updateString(String columnLabel, String x) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public void updateTime(int columnIndex, Time x) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public void updateTime(String columnLabel, Time x) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public void updateTimestamp(int columnIndex, Timestamp x) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public void updateTimestamp(String columnLabel, Timestamp x) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public boolean wasNull() throws SQLException { return wasNull; } } <|start_filename|>src/main/java/com/aliyun/odps/jdbc/utils/transformer/to/jdbc/ToJdbcStringTransformer.java<|end_filename|> /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package com.aliyun.odps.jdbc.utils.transformer.to.jdbc; import java.sql.SQLException; import java.sql.Timestamp; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Calendar.Builder; import java.util.Date; import java.util.LinkedHashMap; import java.util.Map; import java.util.TimeZone; import com.aliyun.odps.data.SimpleStruct; import com.aliyun.odps.data.Struct; import com.aliyun.odps.jdbc.utils.JdbcColumn; import com.aliyun.odps.type.TypeInfo; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.JsonElement; import com.google.gson.JsonPrimitive; import com.google.gson.JsonSerializer; public class ToJdbcStringTransformer extends AbstractToJdbcDateTypeTransformer { @Override public Object transform( Object o, String charset, Calendar cal, TimeZone timeZone, TypeInfo odpsType) throws SQLException { if (o == null) { return null; } // The argument cal should always be ignored since MaxCompute stores timezone information. if (o instanceof byte[]) { return encodeBytes((byte[]) o, charset); } else if (java.util.Date.class.isInstance(o)) { Builder calendarBuilder = new Calendar.Builder() .setCalendarType("iso8601") .setLenient(true); if (timeZone != null) { calendarBuilder.setTimeZone(timeZone); } Calendar calendar = calendarBuilder.build(); try { if (java.sql.Timestamp.class.isInstance(o)) { // MaxCompute TIMESTAMP TIMESTAMP_FORMAT.get().setCalendar(calendar); return TIMESTAMP_FORMAT.get().format(o); } else if (java.sql.Date.class.isInstance(o)) { // MaxCompute DATE DATE_FORMAT.get().setCalendar(calendar); return DATE_FORMAT.get().format(o); } else { // MaxCompute DATETIME DATETIME_FORMAT.get().setCalendar(calendar); return DATETIME_FORMAT.get().format(o); } } finally { restoreToDefaultCalendar(); } } else { if (odpsType != null) { switch (odpsType.getOdpsType()) { case ARRAY: case MAP: { return GSON_FORMAT.get().toJson(o); } case STRUCT: { return GSON_FORMAT.get().toJson(normalizeStruct(o)); } default: { return o.toString(); } } } return o.toString(); } } @Override public Object transform(Object o, String charset, Calendar cal, TimeZone timeZone) throws SQLException { return transform(o, charset, cal, timeZone, null); } private static JsonElement normalizeStruct(Object object) { Map<String, Object> values = new LinkedHashMap<>(); Struct struct = (Struct) object; for (int i = 0; i < struct.getFieldCount(); i++) { values.put(struct.getFieldName(i), struct.getFieldValue(i)); } return new Gson().toJsonTree(values); } static ThreadLocal<Gson> GSON_FORMAT = ThreadLocal.withInitial(() -> { JsonSerializer<Date> dateTimeSerializer = (date, type, jsonSerializationContext) -> { if (date == null) { return null; } return new JsonPrimitive(DATETIME_FORMAT.get().format(date)); }; JsonSerializer<Timestamp> timestampSerializer = (timestamp, type, jsonSerializationContext) -> { if (timestamp == null) { return null; } return new JsonPrimitive(TIMESTAMP_FORMAT.get().format(timestamp)); }; JsonSerializer<SimpleStruct> structSerializer = (struct, type, jsonSerializationContext) -> { if (struct == null) { return null; } return normalizeStruct(struct); }; return new GsonBuilder() .registerTypeAdapter(Date.class, dateTimeSerializer) .registerTypeAdapter(Timestamp.class, timestampSerializer) .registerTypeAdapter(SimpleStruct.class, structSerializer) .serializeNulls() .create(); }); } <|start_filename|>src/main/java/com/aliyun/odps/jdbc/utils/LoggerFactory.java<|end_filename|> /* * Licensed to the Apache Software Foundation (ASF) under one or more contributor license * agreements. See the NOTICE file distributed with this work for additional information regarding * copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance with the License. You may obtain a * copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under the License * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express * or implied. See the License for the specific language governing permissions and limitations under * the License. */ package com.aliyun.odps.jdbc.utils; import java.io.File; import java.lang.reflect.Method; import java.net.URL; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import org.slf4j.Logger; public class LoggerFactory { private static Map<String, Logger> cache = new ConcurrentHashMap<String, Logger>(); @SuppressWarnings({"rawtypes", "unchecked"}) public static Logger getLogger(String logConfFile, String name) { if (cache.containsKey(name)) { return cache.get(name); } Logger logger = null; if (logConfFile != null) { try { Class loggerContextClazz = Class.forName("ch.qos.logback.classic.LoggerContext"); Class contextInitializerClazz = Class.forName("ch.qos.logback.classic.util.ContextInitializer"); Object loggerContext = loggerContextClazz.newInstance(); Object contextInitializer = contextInitializerClazz.getConstructor(loggerContextClazz).newInstance(loggerContext); Method configureByResourceMethod = contextInitializerClazz.getMethod("configureByResource", URL.class); URL url = new File(logConfFile).toURI().toURL(); configureByResourceMethod.invoke(contextInitializer, url); Method getLoggerMethod = loggerContextClazz.getMethod("getLogger", String.class); logger = (Logger) getLoggerMethod.invoke(loggerContext, name); logger.debug("Configure logConf Successfully : {}", url); } catch (Throwable e) { org.slf4j.LoggerFactory.getLogger(name).error( "Configure logConf failed: " + logConfFile + " , replace with application's default conf ~ ", e); logger = org.slf4j.LoggerFactory.getLogger(name); } } else { logger = org.slf4j.LoggerFactory.getLogger(name); } cache.put(name, logger); return logger; } } <|start_filename|>src/main/java/com/aliyun/odps/jdbc/OdpsDatabaseMetaData.java<|end_filename|> /* * Licensed to the Apache Software Foundation (ASF) under one or more contributor license * agreements. See the NOTICE file distributed with this work for additional information regarding * copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance with the License. You may obtain a * copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under the License * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express * or implied. See the License for the specific language governing permissions and limitations under * the License. */ package com.aliyun.odps.jdbc; import java.sql.DatabaseMetaData; import java.sql.ResultSet; import java.sql.RowIdLifetime; import java.sql.SQLException; import java.sql.SQLFeatureNotSupportedException; import java.sql.Types; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.Map.Entry; import java.util.Objects; import com.aliyun.odps.Column; import com.aliyun.odps.Function; import com.aliyun.odps.OdpsException; import com.aliyun.odps.Project; import com.aliyun.odps.Table; import com.aliyun.odps.account.AliyunAccount; import com.aliyun.odps.jdbc.utils.JdbcColumn; import com.aliyun.odps.jdbc.utils.OdpsLogger; import com.aliyun.odps.jdbc.utils.Utils; import com.aliyun.odps.type.TypeInfo; import com.aliyun.odps.type.TypeInfoFactory; import com.aliyun.odps.utils.StringUtils; public class OdpsDatabaseMetaData extends WrapperAdapter implements DatabaseMetaData { private final OdpsLogger log; private static final String PRODUCT_NAME = "MaxCompute/ODPS"; private static final String DRIVER_NAME = "odps-jdbc"; private static final String SCHEMA_TERM = "project"; private static final String CATALOG_TERM = "project"; private static final String PROCEDURE_TERM = "N/A"; // Table types public static final String TABLE_TYPE_TABLE = "TABLE"; public static final String TABLE_TYPE_VIEW = "VIEW"; // Column names public static final String COL_NAME_TABLE_CAT = "TABLE_CAT"; public static final String COL_NAME_TABLE_CATALOG = "TABLE_CATALOG"; public static final String COL_NAME_TABLE_SCHEM = "TABLE_SCHEM"; public static final String COL_NAME_TABLE_NAME = "TABLE_NAME"; public static final String COL_NAME_TABLE_TYPE = "TABLE_TYPE"; public static final String COL_NAME_REMARKS = "REMARKS"; public static final String COL_NAME_TYPE_CAT = "TYPE_CAT"; public static final String COL_NAME_TYPE_SCHEM = "TYPE_SCHEM"; public static final String COL_NAME_TYPE_NAME = "TYPE_NAME"; public static final String COL_NAME_SELF_REFERENCING_COL_NAME = "SELF_REFERENCING_COL_NAME"; public static final String COL_NAME_REF_GENERATION = "REF_GENERATION"; // MaxCompute public data set project public static final String PRJ_NAME_MAXCOMPUTE_PUBLIC_DATA = "MAXCOMPUTE_PUBLIC_DATA"; private static final int TABLE_NAME_LENGTH = 128; private OdpsConnection conn; OdpsDatabaseMetaData(OdpsConnection conn) { this.conn = conn; this.log = conn.log; } @Override public boolean allProceduresAreCallable() throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public boolean allTablesAreSelectable() throws SQLException { return true; } @Override public String getURL() throws SQLException { return conn.getOdps().getEndpoint(); } @Override public String getUserName() throws SQLException { AliyunAccount account = (AliyunAccount) conn.getOdps().getAccount(); return account.getAccessId(); } @Override public boolean isReadOnly() throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public boolean nullsAreSortedHigh() throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public boolean nullsAreSortedLow() throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public boolean nullsAreSortedAtStart() throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public boolean nullsAreSortedAtEnd() throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public String getDatabaseProductName() throws SQLException { return PRODUCT_NAME; } @Override public String getDatabaseProductVersion() throws SQLException { return Utils.retrieveVersion("sdk.version"); } @Override public String getDriverName() throws SQLException { return DRIVER_NAME; } @Override public String getDriverVersion() throws SQLException { return Utils.retrieveVersion("driver.version"); } @Override public int getDriverMajorVersion() { try { return Integer.parseInt(Utils.retrieveVersion("driver.version").split("\\.")[0]); } catch (Exception e) { e.printStackTrace(); return 1; } } @Override public int getDriverMinorVersion() { try { return Integer.parseInt(Utils.retrieveVersion("driver.version").split("\\.")[1]); } catch (Exception e) { e.printStackTrace(); return 0; } } @Override public boolean usesLocalFiles() throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public boolean usesLocalFilePerTable() throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public boolean supportsMixedCaseIdentifiers() throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public boolean storesUpperCaseIdentifiers() throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public boolean storesLowerCaseIdentifiers() throws SQLException { return true; } @Override public boolean storesMixedCaseIdentifiers() throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public boolean supportsMixedCaseQuotedIdentifiers() throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public boolean storesUpperCaseQuotedIdentifiers() throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public boolean storesLowerCaseQuotedIdentifiers() throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public boolean storesMixedCaseQuotedIdentifiers() throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public String getIdentifierQuoteString() throws SQLException { return "`"; } @Override public String getSQLKeywords() throws SQLException { return "overwrite "; } @Override public String getNumericFunctions() throws SQLException { return " "; } @Override public String getStringFunctions() throws SQLException { return " "; } @Override public String getSystemFunctions() throws SQLException { return " "; } @Override public String getTimeDateFunctions() throws SQLException { return " "; } @Override public String getSearchStringEscape() throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public String getExtraNameCharacters() throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public boolean supportsAlterTableWithAddColumn() throws SQLException { return true; } @Override public boolean supportsAlterTableWithDropColumn() throws SQLException { return false; } @Override public boolean supportsColumnAliasing() throws SQLException { return true; } @Override public boolean nullPlusNonNullIsNull() throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public boolean supportsConvert() throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public boolean supportsConvert(int fromType, int toType) throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public boolean supportsTableCorrelationNames() throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public boolean supportsDifferentTableCorrelationNames() throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public boolean supportsExpressionsInOrderBy() throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public boolean supportsOrderByUnrelated() throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public boolean supportsGroupBy() throws SQLException { return true; } @Override public boolean supportsGroupByUnrelated() throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public boolean supportsGroupByBeyondSelect() throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public boolean supportsLikeEscapeClause() throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public boolean supportsMultipleResultSets() throws SQLException { return false; } @Override public boolean supportsMultipleTransactions() throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public boolean supportsNonNullableColumns() throws SQLException { return false; } @Override public boolean supportsMinimumSQLGrammar() throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public boolean supportsCoreSQLGrammar() throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public boolean supportsExtendedSQLGrammar() throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public boolean supportsANSI92EntryLevelSQL() throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public boolean supportsANSI92IntermediateSQL() throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public boolean supportsANSI92FullSQL() throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public boolean supportsIntegrityEnhancementFacility() throws SQLException { return false; } @Override public boolean supportsOuterJoins() throws SQLException { return true; } @Override public boolean supportsFullOuterJoins() throws SQLException { return true; } @Override public boolean supportsLimitedOuterJoins() throws SQLException { return true; } @Override public String getSchemaTerm() throws SQLException { return SCHEMA_TERM; } @Override public String getProcedureTerm() throws SQLException { return PROCEDURE_TERM; } @Override public String getCatalogTerm() throws SQLException { return CATALOG_TERM; } @Override public boolean isCatalogAtStart() throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public String getCatalogSeparator() throws SQLException { return "."; } @Override public boolean supportsSchemasInDataManipulation() throws SQLException { return false; } @Override public boolean supportsSchemasInProcedureCalls() throws SQLException { return false; } @Override public boolean supportsSchemasInTableDefinitions() throws SQLException { return false; } @Override public boolean supportsSchemasInIndexDefinitions() throws SQLException { return false; } @Override public boolean supportsSchemasInPrivilegeDefinitions() throws SQLException { return false; } @Override public boolean supportsCatalogsInDataManipulation() throws SQLException { return true; } @Override public boolean supportsCatalogsInProcedureCalls() throws SQLException { return true; } @Override public boolean supportsCatalogsInTableDefinitions() throws SQLException { return true; } @Override public boolean supportsCatalogsInIndexDefinitions() throws SQLException { return true; } @Override public boolean supportsCatalogsInPrivilegeDefinitions() throws SQLException { return true; } @Override public boolean supportsPositionedDelete() throws SQLException { return false; } @Override public boolean supportsPositionedUpdate() throws SQLException { return false; } @Override public boolean supportsSelectForUpdate() throws SQLException { return false; } @Override public boolean supportsStoredProcedures() throws SQLException { return false; } @Override public boolean supportsSubqueriesInComparisons() throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public boolean supportsSubqueriesInExists() throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public boolean supportsSubqueriesInIns() throws SQLException { return false; } @Override public boolean supportsSubqueriesInQuantifieds() throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public boolean supportsCorrelatedSubqueries() throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public boolean supportsUnion() throws SQLException { return false; } @Override public boolean supportsUnionAll() throws SQLException { return true; } @Override public boolean supportsOpenCursorsAcrossCommit() throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public boolean supportsOpenCursorsAcrossRollback() throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public boolean supportsOpenStatementsAcrossCommit() throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public boolean supportsOpenStatementsAcrossRollback() throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public int getMaxBinaryLiteralLength() throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public int getMaxCharLiteralLength() throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public int getMaxColumnNameLength() throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public int getMaxColumnsInGroupBy() throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public int getMaxColumnsInIndex() throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public int getMaxColumnsInOrderBy() throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public int getMaxColumnsInSelect() throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public int getMaxColumnsInTable() throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public int getMaxConnections() throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public int getMaxCursorNameLength() throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public int getMaxIndexLength() throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public int getMaxSchemaNameLength() throws SQLException { return 32; } @Override public int getMaxProcedureNameLength() throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public int getMaxCatalogNameLength() throws SQLException { return 32; } @Override public int getMaxRowSize() throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public boolean doesMaxRowSizeIncludeBlobs() throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public int getMaxStatementLength() throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public int getMaxStatements() throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public int getMaxTableNameLength() throws SQLException { return TABLE_NAME_LENGTH; } @Override public int getMaxTablesInSelect() throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public int getMaxUserNameLength() throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public int getDefaultTransactionIsolation() throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public boolean supportsTransactions() throws SQLException { return false; } @Override public boolean supportsTransactionIsolationLevel(int level) throws SQLException { return false; } @Override public boolean supportsDataDefinitionAndDataManipulationTransactions() throws SQLException { return false; } @Override public boolean supportsDataManipulationTransactionsOnly() throws SQLException { return false; } @Override public boolean dataDefinitionCausesTransactionCommit() throws SQLException { return false; } @Override public boolean dataDefinitionIgnoredInTransactions() throws SQLException { return false; } @Override public ResultSet getProcedures(String catalog, String schemaPattern, String procedureNamePattern) throws SQLException { // Return an empty result set OdpsResultSetMetaData meta = new OdpsResultSetMetaData(Arrays.asList("PROCEDURE_CAT", "PROCEDURE_SCHEM", "PROCEDURE_NAME", "RESERVERD", "RESERVERD", "RESERVERD", "REMARKS", "PROCEDURE_TYPE", "SPECIFIC_NAME"), Arrays.asList(TypeInfoFactory.STRING, TypeInfoFactory.STRING, TypeInfoFactory.STRING, TypeInfoFactory.STRING, TypeInfoFactory.STRING, TypeInfoFactory.STRING, TypeInfoFactory.STRING, TypeInfoFactory.BIGINT, TypeInfoFactory.STRING)); return new OdpsStaticResultSet(getConnection(), meta); } @Override public ResultSet getProcedureColumns(String catalog, String schemaPattern, String procedureNamePattern, String columnNamePattern) throws SQLException { // Return an empty result set OdpsResultSetMetaData meta = new OdpsResultSetMetaData(Arrays.asList("STUPID_PLACEHOLDERS", "USELESS_PLACEHOLDER"), Arrays.asList(TypeInfoFactory.STRING, TypeInfoFactory.STRING)); return new OdpsStaticResultSet(getConnection(), meta); } @Override public ResultSet getTables( String catalog, String schemaPattern, String tableNamePattern, String[] types) throws SQLException { long begin = System.currentTimeMillis(); List<Object[]> rows = new ArrayList<>(); try { if (!conn.getTables().isEmpty()) { for (Entry<String, List<String>> entry : conn.getTables().entrySet()) { LinkedList<String> tables = new LinkedList<>(); String projectName = entry.getKey(); if (!catalogMatches(catalog, projectName) || !schemaMatches(schemaPattern, projectName)) { continue; } for (String tableName : entry.getValue()) { if (Utils.matchPattern(tableName, tableNamePattern) && conn.getOdps().tables().exists(projectName, tableName)) { tables.add(tableName); } } if (tables.size() > 0) { convertTableNamesToRows(types, rows, projectName, tables); } } } else { ResultSet schemas = getSchemas(catalog, schemaPattern); List<Table> tables = new LinkedList<>(); // Iterate through all the available catalog & schemas while (schemas.next()) { if (catalogMatches(catalog, schemas.getString(COL_NAME_TABLE_CATALOG)) && schemaMatches(schemaPattern, schemas.getString(COL_NAME_TABLE_SCHEM))) { // Enable the argument 'extended' so that the returned table objects contains all the // information needed by JDBC, like comment and type. Iterator<Table> iter = conn.getOdps().tables().iterator( schemas.getString(COL_NAME_TABLE_SCHEM), null, true); while (iter.hasNext()) { Table t = iter.next(); String tableName = t.getName(); if (!Utils.matchPattern(tableName, tableNamePattern)) { continue; } tables.add(t); if (tables.size() == 100) { convertTablesToRows(types, rows, tables); } } } } if (tables.size() > 0) { convertTablesToRows(types, rows, tables); } schemas.close(); } } catch (Exception e) { throw new SQLException(e); } long end = System.currentTimeMillis(); log.info("It took me " + (end - begin) + " ms to get " + rows.size() + " Tables"); OdpsResultSetMetaData meta = new OdpsResultSetMetaData( Arrays.asList( COL_NAME_TABLE_CAT, COL_NAME_TABLE_SCHEM, COL_NAME_TABLE_NAME, COL_NAME_TABLE_TYPE, COL_NAME_REMARKS, COL_NAME_TYPE_CAT, COL_NAME_TYPE_SCHEM, COL_NAME_TYPE_NAME, COL_NAME_SELF_REFERENCING_COL_NAME, COL_NAME_REF_GENERATION), Arrays.asList( TypeInfoFactory.STRING, TypeInfoFactory.STRING, TypeInfoFactory.STRING, TypeInfoFactory.STRING, TypeInfoFactory.STRING, TypeInfoFactory.STRING, TypeInfoFactory.STRING, TypeInfoFactory.STRING, TypeInfoFactory.STRING, TypeInfoFactory.STRING)); sortRows(rows, new int[] {3, 0, 1, 2}); return new OdpsStaticResultSet(getConnection(), meta, rows.iterator()); } private boolean catalogMatches(String catalog, String actual) { return catalog == null || catalog.equalsIgnoreCase(actual); } private boolean schemaMatches(String schemaPattern, String actual) { return Utils.matchPattern(actual, schemaPattern); } private void convertTableNamesToRows( String[] types, List<Object[]> rows, String projectName, List<String> names) throws OdpsException { LinkedList<Table> tables = new LinkedList<>(); tables.addAll(conn.getOdps().tables().loadTables(projectName, names)); convertTablesToRows(types, rows, tables); } private void convertTablesToRows(String[] types, List<Object[]> rows, List<Table> tables) { for (Table t : tables) { String tableType = t.isVirtualView() ? TABLE_TYPE_VIEW : TABLE_TYPE_TABLE; if (types != null && types.length != 0) { if (!Arrays.asList(types).contains(tableType)) { continue; } } Object[] rowVals = { t.getProject(), t.getProject(), t.getName(), tableType, t.getComment(), null, null, null, null, null}; rows.add(rowVals); } tables.clear(); } @Override public ResultSet getSchemas() throws SQLException { return getSchemas(null, null); } @Override public ResultSet getSchemas(String catalog, String schemaPattern) throws SQLException { OdpsResultSetMetaData meta = new OdpsResultSetMetaData( Arrays.asList(COL_NAME_TABLE_SCHEM, COL_NAME_TABLE_CATALOG), Arrays.asList(TypeInfoFactory.STRING, TypeInfoFactory.STRING)); List<Object[]> rows = new ArrayList<>(); // In MaxCompute, catalog == schema == project. String schema = catalog; // Project MAXCOMPUTE_PUBLIC_DATA includes MaxCompute public data sets. It is available in // almost all the regions of every public MaxCompute service, but may not be available in // private services. try { if (catalogMatches(catalog, PRJ_NAME_MAXCOMPUTE_PUBLIC_DATA) && schemaMatches(schemaPattern, PRJ_NAME_MAXCOMPUTE_PUBLIC_DATA) && conn.getOdps().projects().exists(PRJ_NAME_MAXCOMPUTE_PUBLIC_DATA)) { rows.add(new String[] {PRJ_NAME_MAXCOMPUTE_PUBLIC_DATA, PRJ_NAME_MAXCOMPUTE_PUBLIC_DATA}); } } catch (OdpsException e) { String errMsg = "Failed to access project: " + e.getMessage(); conn.log.debug(errMsg); } try { if (catalog == null) { // The follow code block implements the actual interface DatabaseMetaData#getCatalogs. But // since list projects is quite slow right now, this impl is commented out. // for (Project p : conn.getOdps().projects().iterable(null)) { // if (!PRJ_NAME_MAXCOMPUTE_PUBLIC_DATA.equals(p.getName()) // && Utils.matchPattern(p.getName(), schemaPattern)) { // rows.add(new String[]{p.getName(), p.getName()}); // } // } if (!PRJ_NAME_MAXCOMPUTE_PUBLIC_DATA.equalsIgnoreCase(conn.getOdps().getDefaultProject())) { rows.add( new String[]{conn.getOdps().getDefaultProject(), conn.getOdps().getDefaultProject()}); } } else { if (!PRJ_NAME_MAXCOMPUTE_PUBLIC_DATA.equalsIgnoreCase(schema) && Utils.matchPattern(schema, schemaPattern) && conn.getOdps().projects().exists(schema)) { rows.add(new String[]{schema, schema}); } } } catch (OdpsException | RuntimeException e) { throw new SQLException(e); } sortRows(rows, new int[] {1, 0}); return new OdpsStaticResultSet(getConnection(), meta, rows.iterator()); } @Override public ResultSet getCatalogs() throws SQLException { OdpsResultSetMetaData meta = new OdpsResultSetMetaData( Collections.singletonList(COL_NAME_TABLE_CAT), Collections.singletonList(TypeInfoFactory.STRING)); List<Object[]> rows = new ArrayList<>(); // Project MAXCOMPUTE_PUBLIC_DATA includes MaxCompute public data sets. It is available in // almost all the regions of every public MaxCompute service, but may not be available in // private services. try { if (conn.getOdps().projects().exists(PRJ_NAME_MAXCOMPUTE_PUBLIC_DATA)) { rows.add(new String[] {PRJ_NAME_MAXCOMPUTE_PUBLIC_DATA}); } } catch (OdpsException e) { String errMsg = "Failed to access project: " + e.getMessage(); conn.log.debug(errMsg); } // The follow code block implements the actual interface DatabaseMetaData#getCatalogs. But since // list projects is quite slow right now, this impl is commented out. // try { // for (Project p : conn.getOdps().projects().iterable(null)) { // rows.add(new String[] {p.getName()}); // } // } catch (RuntimeException e) { // throw new SQLException(e); // } if (!PRJ_NAME_MAXCOMPUTE_PUBLIC_DATA.equalsIgnoreCase(conn.getOdps().getDefaultProject())) { rows.add(new String[]{conn.getOdps().getDefaultProject()}); } sortRows(rows, new int[] {0}); return new OdpsStaticResultSet(getConnection(), meta, rows.iterator()); } /** * Sort rows by specified columns. * * @param rows Rows. Elements in the list cannot be null and must have the same length. * @param columnsToSort Indexes of columns to sort. */ private void sortRows(List<Object[]> rows, int[] columnsToSort) { rows.sort((row1, row2) -> { Objects.requireNonNull(row1); Objects.requireNonNull(row2); if (row1.length != row2.length) { throw new IllegalArgumentException("Rows have different length"); } for (int i = 0; i < row1.length; i++) { for (int idx : columnsToSort) { if (row1[idx] != null && row2[idx] != null) { int ret = ((String) row1[idx]).compareTo((String) row2[idx]); if (ret == 0) { continue; } return ret; } else if (row1[idx] != null && row2[idx] == null) { return 1; } else if (row1[idx] == null && row2[idx] != null) { return -1; } } } return 0; }); } @Override public ResultSet getTableTypes() throws SQLException { List<Object[]> rows = new ArrayList<>(); OdpsResultSetMetaData meta = new OdpsResultSetMetaData( Arrays.asList(COL_NAME_TABLE_TYPE), Arrays.asList(TypeInfoFactory.STRING)); rows.add(new String[] {TABLE_TYPE_TABLE}); rows.add(new String[] {TABLE_TYPE_VIEW}); return new OdpsStaticResultSet(getConnection(), meta, rows.iterator()); } @Override public ResultSet getColumns( String catalog, String schemaPattern, String tableNamePattern, String columnNamePattern) throws SQLException { long begin = System.currentTimeMillis(); if (tableNamePattern == null) { throw new SQLException("Table name must be given when getColumns"); } List<Object[]> rows = new ArrayList<Object[]>(); if (!tableNamePattern.trim().isEmpty() && !"%".equals(tableNamePattern.trim()) && !"*".equals(tableNamePattern.trim())) { try { Table table; if (StringUtils.isNullOrEmpty(schemaPattern)) { table = conn.getOdps().tables().get(tableNamePattern); } else { table = conn.getOdps().tables().get(schemaPattern, tableNamePattern); } table.reload(); // Read column & partition column information from table schema List<Column> columns = new LinkedList<>(); columns.addAll(table.getSchema().getColumns()); columns.addAll(table.getSchema().getPartitionColumns()); for (int i = 0; i < columns.size(); i++) { Column col = columns.get(i); JdbcColumn jdbcCol = new JdbcColumn(col.getName(), tableNamePattern, table.getProject(), col.getTypeInfo().getOdpsType(), col.getTypeInfo(), col.getComment(), i + 1); Object[] rowVals = {catalog, jdbcCol.getTableSchema(), jdbcCol.getTableName(), jdbcCol.getColumnName(), (long) jdbcCol.getType(), jdbcCol.getTypeName(), null, null, (long) jdbcCol.getDecimalDigits(), (long) jdbcCol.getNumPercRaidx(), (long) jdbcCol.getIsNullable(), jdbcCol.getComment(), null, null, null, null, (long) jdbcCol.getOrdinalPos(), jdbcCol.getIsNullableString(), null, null, null, null}; rows.add(rowVals); } } catch (OdpsException e) { throw new SQLException("catalog=" + catalog + ",schemaPattern=" + schemaPattern + ",tableNamePattern=" + tableNamePattern + ",columnNamePattern" + columnNamePattern, e); } } long end = System.currentTimeMillis(); log.info("It took me " + (end - begin) + " ms to get " + rows.size() + " columns"); // Build result set meta data OdpsResultSetMetaData meta = new OdpsResultSetMetaData(Arrays.asList("TABLE_CAT", "TABLE_SCHEM", "TABLE_NAME", "COLUMN_NAME", "DATA_TYPE", "TYPE_NAME", "COLUMN_SIZE", "BUFFER_LENGTH", "DECIMAL_DIGITS", "NUM_PERC_RADIX", "NULLABLE", "REMARKS", "COLUMN_DEF", "SQL_DATA_TYPE", "SQL_DATETIME_SUB", "CHAR_OCTET_LENGTH", "ORDINAL_POSITION", "IS_NULLABLE", "SCOPE_CATALOG", "SCOPE_SCHEMA", "SCOPE_TABLE", "SOURCE_DATA_TYPE"), Arrays.asList(TypeInfoFactory.STRING, TypeInfoFactory.STRING, TypeInfoFactory.STRING, TypeInfoFactory.STRING, TypeInfoFactory.BIGINT, TypeInfoFactory.STRING, TypeInfoFactory.BIGINT, TypeInfoFactory.BIGINT, TypeInfoFactory.BIGINT, TypeInfoFactory.BIGINT, TypeInfoFactory.BIGINT, TypeInfoFactory.STRING, TypeInfoFactory.STRING, TypeInfoFactory.BIGINT, TypeInfoFactory.BIGINT, TypeInfoFactory.BIGINT, TypeInfoFactory.BIGINT, TypeInfoFactory.STRING, TypeInfoFactory.STRING, TypeInfoFactory.STRING, TypeInfoFactory.STRING, TypeInfoFactory.BIGINT)); return new OdpsStaticResultSet(getConnection(), meta, rows.iterator()); } @Override public ResultSet getColumnPrivileges(String catalog, String schema, String table, String columnNamePattern) throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public ResultSet getTablePrivileges(String catalog, String schemaPattern, String tableNamePattern) throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public ResultSet getBestRowIdentifier(String catalog, String schema, String table, int scope, boolean nullable) throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public ResultSet getVersionColumns(String catalog, String schema, String table) throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public ResultSet getPrimaryKeys(String catalog, String schema, String table) throws SQLException { // Return an empty result set OdpsResultSetMetaData meta = new OdpsResultSetMetaData(Arrays.asList("TABLE_CAT", "TABLE_SCHEM", "TABLE_NAME", "COLUMN_NAME", "KEY_SEQ", "PK_NAME"), Arrays.asList(TypeInfoFactory.STRING, TypeInfoFactory.STRING, TypeInfoFactory.STRING, TypeInfoFactory.STRING, TypeInfoFactory.BIGINT, TypeInfoFactory.STRING)); return new OdpsStaticResultSet(getConnection(), meta); } @Override public ResultSet getImportedKeys(String catalog, String schema, String table) throws SQLException { // Return an empty result set OdpsResultSetMetaData meta = new OdpsResultSetMetaData(Arrays.asList("PKTABLE_CAT", "PKTABLE_SCHEM", "PKTABLE_NAME", "PKCOLUMN_NAME", "FKTABLE_CAT", "FKTABLE_SCHEM", "FKTABLE_NAME", "FKCOLUMN_NAME", "KEY_SEQ", "UPDATE_RULE", "DELETE_RULE", "FK_NAME", "PK_NAME", "DEFERRABILITY"), Arrays.asList(TypeInfoFactory.STRING, TypeInfoFactory.STRING, TypeInfoFactory.STRING, TypeInfoFactory.STRING, TypeInfoFactory.STRING, TypeInfoFactory.STRING, TypeInfoFactory.STRING, TypeInfoFactory.STRING, TypeInfoFactory.BIGINT, TypeInfoFactory.BIGINT, TypeInfoFactory.BIGINT, TypeInfoFactory.STRING, TypeInfoFactory.STRING, TypeInfoFactory.STRING)); return new OdpsStaticResultSet(getConnection(), meta); } @Override public ResultSet getExportedKeys(String catalog, String schema, String table) throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public ResultSet getCrossReference(String parentCatalog, String parentSchema, String parentTable, String foreignCatalog, String foreignSchema, String foreignTable) throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public ResultSet getTypeInfo() throws SQLException { List<String> columnNames = Arrays.asList("TYPE_NAME", "DATA_TYPE", "PRECISION", "LITERAL_PREFIX", "LITERAL_SUFFIX", "CREATE_PARAMS", "NULLABLE", "CASE_SENSITIVE", "SEARCHABLE", "UNSIGNED_ATTRIBUTE", "FIXED_PREC_SCALE", "AUTO_INCREMENT", "LOCAL_TYPE_NAME", "MINIMUM_SCALE", "MAXIMUM_SCALE", "SQL_DATA_TYPE", "SQL_DATETIME_SUB", "NUM_PREC_RADIX"); List<TypeInfo> columnTypes = Arrays.asList(TypeInfoFactory.STRING, TypeInfoFactory.INT, TypeInfoFactory.INT, TypeInfoFactory.STRING, TypeInfoFactory.STRING, TypeInfoFactory.STRING, TypeInfoFactory.SMALLINT, TypeInfoFactory.BOOLEAN, TypeInfoFactory.SMALLINT, TypeInfoFactory.BOOLEAN, TypeInfoFactory.BOOLEAN, TypeInfoFactory.BOOLEAN, TypeInfoFactory.STRING, TypeInfoFactory.SMALLINT, TypeInfoFactory.SMALLINT, TypeInfoFactory.INT, TypeInfoFactory.INT, TypeInfoFactory.INT); OdpsResultSetMetaData meta = new OdpsResultSetMetaData(columnNames, columnTypes); List<Object[]> rows = new ArrayList<>(); rows.add(new Object[] {TypeInfoFactory.TINYINT.getTypeName(), Types.TINYINT, 3, null, "Y", null, typeNullable, null, typePredBasic, false, false, false, null, 0, 0, null, null, 10}); rows.add(new Object[] {TypeInfoFactory.SMALLINT.getTypeName(), Types.SMALLINT, 5, null, "S", null, typeNullable, null, typePredBasic, false, false, false, null, 0, 0, null, null, 10}); rows.add(new Object[] {TypeInfoFactory.INT.getTypeName(), Types.INTEGER, 10, null, null, null, typeNullable, null, typePredBasic, false, false, false, null, 0, 0, null, null, 10}); rows.add(new Object[] {TypeInfoFactory.BIGINT.getTypeName(), Types.BIGINT, 19, null, "L", null, typeNullable, null, typePredBasic, false, false, false, null, 0, 0, null, null, 10}); rows.add(new Object[] {TypeInfoFactory.BINARY.getTypeName(), Types.BINARY, 8 * 1024 * 1024, null, null, null, typeNullable, null, typePredNone, false, false, false, null, 0, 0, null, null, null}); rows.add(new Object[] {TypeInfoFactory.FLOAT.getTypeName(), Types.FLOAT, null, null, null, null, typeNullable, null, typePredBasic, false, false, false, null, null, null, null, null, 2}); rows.add(new Object[] {TypeInfoFactory.DOUBLE.getTypeName(), Types.DOUBLE, null, null, null, null, typeNullable, null, typePredBasic, false, false, false, null, null, null, null, null, 2}); rows.add(new Object[] {TypeInfoFactory.DECIMAL.getTypeName(), Types.DECIMAL, 38, null, "BD", null, typeNullable, null, typePredBasic, false, true, false, null, 18, 18, null, null, 10}); rows.add(new Object[] {"VARCHAR", Types.VARCHAR, null, null, null, "PRECISION", typeNullable, true, typePredChar, false, false, false, null, null, null, null, null, null}); rows.add(new Object[] {"CHAR", Types.CHAR, null, null, null, "PRECISION", typeNullable, true, typePredChar, false, false, false, null, null, null, null, null, null}); rows.add(new Object[] {TypeInfoFactory.STRING, Types.VARCHAR, 8 * 1024 * 1024, "\"", "\"", null, typeNullable, true, typePredChar, false, false, false, null, null, null, null, null, null}); // yyyy-mm-dd rows.add(new Object[] {TypeInfoFactory.DATE, Types.DATE, 10, "DATE'", "'", null, typeNullable, null, typePredBasic, false, false, false, null, null, null, null, null, null}); // yyyy-mm-dd hh:MM:ss.SSS rows.add(new Object[] {TypeInfoFactory.DATETIME, Types.TIMESTAMP, 23, "DATETIME'", "'", null, typeNullable, null, typePredBasic, false, false, false, null, null, null, null, null, null}); // yyyy-mm-dd hh:MM:ss.SSSSSSSSS rows.add(new Object[] {TypeInfoFactory.TIMESTAMP, Types.TIMESTAMP, 29, "TIMESTAMP'", "'", null, typeNullable, null, typePredBasic, false, false, false, null, null, null, null, null, null}); rows.add(new Object[] {TypeInfoFactory.BOOLEAN, Types.BOOLEAN, null, null, null, null, typeNullable, null, typePredBasic, false, false, false, null, null, null, null, null, null}); return new OdpsStaticResultSet(getConnection(), meta, rows.iterator()); } @Override public ResultSet getIndexInfo(String catalog, String schema, String table, boolean unique, boolean approximate) throws SQLException { OdpsResultSetMetaData meta = new OdpsResultSetMetaData( Arrays.asList("TABLE_CAT", "TABLE_SCHEM", "TABLE_NAME", "NON_UNIQUE", "INDEX_QUALIFIER", "INDEX_NAME", "TYPE", "ORDINAL_POSITION", "COLUMN_NAME", "ASC_OR_DESC", "CARDINALITY", "PAGES", "FILTER_CONDITION"), Arrays.asList(TypeInfoFactory.STRING, TypeInfoFactory.STRING, TypeInfoFactory.STRING, TypeInfoFactory.BOOLEAN, TypeInfoFactory.STRING, TypeInfoFactory.STRING, TypeInfoFactory.SMALLINT, TypeInfoFactory.SMALLINT, TypeInfoFactory.STRING, TypeInfoFactory.STRING, TypeInfoFactory.BIGINT, TypeInfoFactory.BIGINT, TypeInfoFactory.STRING)); // Return an empty result set since index is unsupported in MaxCompute return new OdpsStaticResultSet(getConnection(), meta, Collections.emptyIterator()); } @Override public boolean supportsResultSetType(int type) throws SQLException { if (type == ResultSet.TYPE_FORWARD_ONLY || type == ResultSet.TYPE_SCROLL_INSENSITIVE) { return true; } else { return false; } } @Override public boolean supportsResultSetConcurrency(int type, int concurrency) throws SQLException { return false; } @Override public boolean ownUpdatesAreVisible(int type) throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public boolean ownDeletesAreVisible(int type) throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public boolean ownInsertsAreVisible(int type) throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public boolean othersUpdatesAreVisible(int type) throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public boolean othersDeletesAreVisible(int type) throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public boolean othersInsertsAreVisible(int type) throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public boolean updatesAreDetected(int type) throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public boolean deletesAreDetected(int type) throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public boolean insertsAreDetected(int type) throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public boolean supportsBatchUpdates() throws SQLException { return false; } @Override public ResultSet getUDTs(String catalog, String schemaPattern, String typeNamePattern, int[] types) throws SQLException { // Return an empty result set OdpsResultSetMetaData meta = new OdpsResultSetMetaData(Arrays.asList("TYPE_CAT", "TYPE_SCHEM", "TYPE_NAME", "CLASS_NAME", "DATA_TYPE", "REMARKS", "BASE_TYPE"), Arrays.asList( TypeInfoFactory.STRING, TypeInfoFactory.STRING, TypeInfoFactory.STRING, TypeInfoFactory.STRING, TypeInfoFactory.BIGINT, TypeInfoFactory.STRING, TypeInfoFactory.BIGINT)); return new OdpsStaticResultSet(getConnection(), meta); } @Override public OdpsConnection getConnection() throws SQLException { return conn; } @Override public boolean supportsSavepoints() throws SQLException { return false; } @Override public boolean supportsNamedParameters() throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public boolean supportsMultipleOpenResults() throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public boolean supportsGetGeneratedKeys() throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public ResultSet getSuperTypes(String catalog, String schemaPattern, String typeNamePattern) throws SQLException { return null; } @Override public ResultSet getSuperTables(String catalog, String schemaPattern, String tableNamePattern) throws SQLException { return null; } @Override public ResultSet getAttributes(String catalog, String schemaPattern, String typeNamePattern, String attributeNamePattern) throws SQLException { return null; } @Override public boolean supportsResultSetHoldability(int holdability) throws SQLException { return false; } @Override public int getResultSetHoldability() throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public int getDatabaseMajorVersion() throws SQLException { try { return Integer.parseInt(Utils.retrieveVersion("sdk.version").split("\\.")[0]); } catch (Exception e) { e.printStackTrace(); return 1; } } @Override public int getDatabaseMinorVersion() throws SQLException { try { return Integer.parseInt(Utils.retrieveVersion("sdk.version").split("\\.")[1]); } catch (Exception e) { e.printStackTrace(); return 0; } } @Override public int getJDBCMajorVersion() throws SQLException { // TODO: risky return 4; } @Override public int getJDBCMinorVersion() throws SQLException { return 0; } @Override public int getSQLStateType() throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public boolean locatorsUpdateCopy() throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public boolean supportsStatementPooling() throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public RowIdLifetime getRowIdLifetime() throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public boolean supportsStoredFunctionsUsingCallSyntax() throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public boolean autoCommitFailureClosesAllResultSets() throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public ResultSet getClientInfoProperties() throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public ResultSet getFunctions(String catalog, String schemaPattern, String functionNamePattern) throws SQLException { long begin = System.currentTimeMillis(); List<Object[]> rows = new ArrayList<Object[]>(); for (Function f : conn.getOdps().functions()) { Object[] rowVals = {null, null, f.getName(), 0, (long) functionResultUnknown, null}; rows.add(rowVals); } long end = System.currentTimeMillis(); log.info("It took me " + (end - begin) + " ms to get " + rows.size() + " functions"); OdpsResultSetMetaData meta = new OdpsResultSetMetaData(Arrays.asList("FUNCTION_CAT", "FUNCTION_SCHEM", "FUNCTION_NAME", "REMARKS", "FUNCTION_TYPE", "SPECIFIC_NAME"), Arrays.asList(TypeInfoFactory.STRING, TypeInfoFactory.STRING, TypeInfoFactory.STRING, TypeInfoFactory.STRING, TypeInfoFactory.BIGINT, TypeInfoFactory.STRING)); return new OdpsStaticResultSet(getConnection(), meta, rows.iterator()); } @Override public ResultSet getFunctionColumns(String catalog, String schemaPattern, String functionNamePattern, String columnNamePattern) throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public ResultSet getPseudoColumns(String catalog, String schemaPattern, String tableNamePattern, String columnNamePattern) throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public boolean generatedKeyAlwaysReturned() throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } } <|start_filename|>src/main/java/com/aliyun/odps/jdbc/utils/transformer/to/jdbc/AbstractToJdbcDateTypeTransformer.java<|end_filename|> package com.aliyun.odps.jdbc.utils.transformer.to.jdbc; import com.aliyun.odps.OdpsType; import com.aliyun.odps.jdbc.utils.JdbcColumn; import com.aliyun.odps.type.TypeInfo; import java.sql.SQLException; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.TimeZone; public abstract class AbstractToJdbcDateTypeTransformer extends AbstractToJdbcTransformer { static ThreadLocal<Calendar> DEFAULT_CALENDAR = ThreadLocal.withInitial(() -> new Calendar.Builder().setCalendarType("iso8601").setTimeZone(TimeZone.getTimeZone("GMT")).build()); static ThreadLocal<SimpleDateFormat> TIMESTAMP_FORMAT = ThreadLocal.withInitial(() -> new SimpleDateFormat(JdbcColumn.ODPS_TIMESTAMP_FORMAT)); static ThreadLocal<SimpleDateFormat> DATETIME_FORMAT = ThreadLocal.withInitial(() -> new SimpleDateFormat(JdbcColumn.ODPS_DATETIME_FORMAT)); static ThreadLocal<SimpleDateFormat> DATE_FORMAT = ThreadLocal.withInitial(() -> new SimpleDateFormat(JdbcColumn.ODPS_DATE_FORMAT)); static ThreadLocal<SimpleDateFormat> TIME_FORMAT = ThreadLocal.withInitial(() -> new SimpleDateFormat(JdbcColumn.ODPS_TIME_FORMAT)); @Override public Object transform(Object o, String charset) throws SQLException { return this.transform(o, charset, null, null); } @Override public Object transform(Object o, String charset, TypeInfo odpsType) throws SQLException { return this.transform(o, charset, null, null, odpsType); } /** * Transform ODPS SDK object to an instance of java.util.Date subclass * @param o java object from ODPS SDK * @param charset charset to encode byte array * @param cal a calendar object to construct java.util.Date object * @return JDBC object * @throws SQLException */ public abstract Object transform( Object o, String charset, Calendar cal, TimeZone timeZone) throws SQLException; public Object transform( Object o, String charset, Calendar cal, TimeZone timeZone, TypeInfo odpsType) throws SQLException { //default implement return transform(o, charset, cal, timeZone); } void restoreToDefaultCalendar() { TIMESTAMP_FORMAT.get().setCalendar(Calendar.getInstance()); DATETIME_FORMAT.get().setCalendar(Calendar.getInstance()); DATE_FORMAT.get().setCalendar(Calendar.getInstance()); TIME_FORMAT.get().setCalendar(Calendar.getInstance()); } } <|start_filename|>src/main/java/com/aliyun/odps/jdbc/utils/ConnectionResource.java<|end_filename|> /* * Licensed to the Apache Software Foundation (ASF) under one or more contributor license * agreements. See the NOTICE file distributed with this work for additional information regarding * copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance with the License. You may obtain a * copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under the License * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express * or implied. See the License for the specific language governing permissions and limitations under * the License. */ package com.aliyun.odps.jdbc.utils; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.io.UnsupportedEncodingException; import java.lang.reflect.Type; import java.net.URLDecoder; import java.util.ArrayList; import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Properties; import com.aliyun.odps.sqa.FallbackPolicy; import com.aliyun.odps.utils.GsonObjectBuilder; import com.aliyun.odps.utils.StringUtils; import com.google.gson.reflect.TypeToken; public class ConnectionResource { private static final String JDBC_ODPS_URL_PREFIX = "jdbc:odps:"; private static final String CHARSET_DEFAULT_VALUE = "UTF-8"; private static final String LIFECYCLE_DEFAULT_VALUE = "3"; private static final String MAJOR_VERSION_DEFAULT_VALUE = "default"; private static final String INTERACTIVE_SERVICE_NAME_DEFAULT_VALUE = "public.default"; /** * keys to retrieve properties from url. */ private static final String ODPS_CONF_URL_KEY = "odps_config"; private static final String ACCESS_ID_URL_KEY = "accessId"; private static final String ACCESS_KEY_URL_KEY = "accessKey"; private static final String PROJECT_URL_KEY = "project"; private static final String EXECUTE_PROJECT_URL_KEY = "executeProject"; private static final String CHARSET_URL_KEY = "charset"; private static final String LOGVIEW_URL_KEY = "logview"; private static final String TUNNEL_ENDPOINT_URL_KEY = "tunnelEndpoint"; private static final String TUNNEL_RESULT_RETRY_TIME_URL_KEY = "tunnelRetryTime"; private static final String LOG_CONF_FILE_URL_KEY = "logConfFile"; private static final String INTERACTIVE_MODE_URL_KEY = "interactiveMode"; private static final String SERVICE_NAME_URL_KEY = "interactiveServiceName"; private static final String MAJOR_VERSION_URL_KEY = "majorVersion"; private static final String ENABLE_ODPS_LOGGER_URL_KEY = "enableOdpsLogger"; private static final String TABLE_LIST_URL_KEY = "tableList"; private static final String FALLBACK_FOR_UNKNOWN_URL_KEY = "fallbackForUnknownError"; private static final String FALLBACK_FOR_RESOURCE_URL_KEY = "fallbackForResourceNotEnough"; private static final String FALLBACK_FOR_UPGRADING_URL_KEY = "fallbackForUpgrading"; private static final String FALLBACK_FOR_TIMEOUT_URL_KEY = "fallbackForRunningTimeout"; private static final String FALLBACK_FOR_UNSUPPORTED_URL_KEY = "fallbackForUnsupportedFeature"; private static final String ALWAYS_FALLBACK_URL_KEY = "alwaysFallback"; private static final String DISABLE_FALLBACK_URL_KEY = "disableFallback"; private static final String AUTO_SELECT_LIMIT_URL_KEY = "autoSelectLimit"; //Unit: result record row count, only applied in interactive mode private static final String INSTANCE_TUNNEL_MAX_RECORD_URL_KEY = "instanceTunnelMaxRecord"; //Unit: Bytes, only applied in interactive mode private static final String INSTANCE_TUNNEL_MAX_SIZE_URL_KEY = "instanceTunnelMaxSize"; private static final String STS_TOKEN_URL_KEY = "stsToken"; private static final String DISABLE_CONN_SETTING_URL_KEY = "disableConnectionSetting"; private static final String USE_PROJECT_TIME_ZONE_URL_KEY = "useProjectTimeZone"; private static final String ENABLE_LIMIT_URL_KEY = "enableLimit"; private static final String SETTINGS_URL_KEY = "settings"; /** * Keys to retrieve properties from info. * * public since they are accessed in getPropInfo() */ public static final String ACCESS_ID_PROP_KEY = "access_id"; public static final String ACCESS_KEY_PROP_KEY = "access_key"; public static final String PROJECT_PROP_KEY = "project_name"; public static final String EXECUTE_PROJECT_PROP_KEY = "execute_project_name"; public static final String CHARSET_PROP_KEY = "charset"; public static final String LOGVIEW_HOST_PROP_KEY = "logview_host"; public static final String TUNNEL_ENDPOINT_PROP_KEY = "tunnel_endpoint"; public static final String TUNNEL_RESULT_RETRY_TIME_PROP_KEY = "tunnel_retry_time"; public static final String LOG_CONF_FILE_PROP_KEY = "log_conf_file"; public static final String INTERACTIVE_MODE_PROP_KEY = "interactive_mode"; public static final String SERVICE_NAME_PROP_KEY = "interactive_service_name"; public static final String MAJOR_VERSION_PROP_KEY = "major_version"; public static final String ENABLE_ODPS_LOGGER_PROP_KEY = "enable_odps_logger"; public static final String TABLE_LIST_PROP_KEY = "table_list"; private static final String FALLBACK_FOR_UNKNOWN_PROP_KEY = "fallback_for_unknownerror"; private static final String FALLBACK_FOR_RESOURCE_PROP_KEY = "fallback_for_resourcenotenough"; private static final String FALLBACK_FOR_UPGRADING_PROP_KEY = "fallback_for_upgrading"; private static final String FALLBACK_FOR_TIMEOUT_PROP_KEY = "fallback_for_runningtimeout"; private static final String FALLBACK_FOR_UNSUPPORTED_PROP_KEY = "fallback_for_unsupportedfeature"; private static final String ALWAYS_FALLBACK_PROP_KEY = "always_fallback"; private static final String DISABLE_FALLBACK_PROP_KEY = "disable_fallback"; private static final String AUTO_SELECT_LIMIT_PROP_KEY = "auto_select_limit"; //Unit: result record row count, only applied in interactive mode private static final String INSTANCE_TUNNEL_MAX_RECORD_PROP_KEY = "instance_tunnel_max_record"; //Unit: Bytes, only applied in interactive mode private static final String INSTANCE_TUNNEL_MAX_SIZE_PROP_KEY = "instance_tunnel_max_size"; private static final String STS_TOKEN_PROP_KEY = "sts_token"; private static final String DISABLE_CONN_SETTING_PROP_KEY = "disable_connection_setting"; private static final String USE_PROJECT_TIME_ZONE_PROP_KEY = "use_project_time_zone"; private static final String ENABLE_LIMIT_PROP_KEY = "enable_limit"; private static final String SETTINGS_PROP_KEY = "settings"; // This is to support DriverManager.getConnection(url, user, password) API, // which put the 'user' and 'password' to the 'info'. // So the `access_id` and `access_key` have aliases. private static final String ACCESS_ID_PROP_KEY_ALT = "user"; private static final String ACCESS_KEY_PROP_KEY_ALT = "password"; private String endpoint; private String accessId; private String accessKey; private String project; private String executeProject; private String charset; private String logview; private String tunnelEndpoint; private String logConfFile; private boolean interactiveMode; private String interactiveServiceName; private String majorVersion; private boolean enableOdpsLogger = false; private Map<String, List<String>> tables = new HashMap<>(); private FallbackPolicy fallbackPolicy = FallbackPolicy.alwaysFallbackPolicy(); private Long autoSelectLimit; private Long countLimit; private Long sizeLimit; private int tunnelRetryTime; private String stsToken; private boolean disableConnSetting = false; private boolean useProjectTimeZone = false; private boolean enableLimit = false; private Map<String, String> settings = new HashMap<>(); public static boolean acceptURL(String url) { return (url != null) && url.startsWith(JDBC_ODPS_URL_PREFIX); } public ConnectionResource(String url, Properties info) { Map<String, String> paramsInURL = extractParamsFromUrl(url); init(info, paramsInURL); } @SuppressWarnings("rawtypes") void init(Properties info, Map<String, String> paramsInURL) { List<Map> maps = new ArrayList<Map>(); if (paramsInURL.get(ODPS_CONF_URL_KEY) != null) { try { InputStream inputStream = new FileInputStream(paramsInURL.get(ODPS_CONF_URL_KEY)); if (inputStream != null) { Properties props = new Properties(); props.load(inputStream); maps.add(props); } } catch (IOException e) { throw new RuntimeException("Load odps conf failed:", e); } } else { maps.add(info); maps.add(paramsInURL); } accessId = tryGetFirstNonNullValueByAltMapAndAltKey( maps, null, ACCESS_ID_PROP_KEY_ALT, ACCESS_ID_PROP_KEY, ACCESS_ID_URL_KEY); accessKey = tryGetFirstNonNullValueByAltMapAndAltKey( maps, null, ACCESS_KEY_PROP_KEY_ALT, ACCESS_KEY_PROP_KEY, ACCESS_KEY_URL_KEY); if (accessKey != null) { try { accessKey = URLDecoder.decode(accessKey, CHARSET_DEFAULT_VALUE); } catch (UnsupportedEncodingException e) { accessKey = URLDecoder.decode(accessKey); } } charset = tryGetFirstNonNullValueByAltMapAndAltKey(maps, CHARSET_DEFAULT_VALUE, CHARSET_PROP_KEY, CHARSET_URL_KEY); project = tryGetFirstNonNullValueByAltMapAndAltKey(maps, null, PROJECT_PROP_KEY, PROJECT_URL_KEY); executeProject = tryGetFirstNonNullValueByAltMapAndAltKey(maps, null, EXECUTE_PROJECT_PROP_KEY, EXECUTE_PROJECT_URL_KEY); logview = tryGetFirstNonNullValueByAltMapAndAltKey(maps, null, LOGVIEW_HOST_PROP_KEY, LOGVIEW_URL_KEY); tunnelEndpoint = tryGetFirstNonNullValueByAltMapAndAltKey(maps, null, TUNNEL_ENDPOINT_PROP_KEY, TUNNEL_ENDPOINT_URL_KEY); tunnelRetryTime = Integer.parseInt( tryGetFirstNonNullValueByAltMapAndAltKey(maps, "6", TUNNEL_RESULT_RETRY_TIME_PROP_KEY, TUNNEL_RESULT_RETRY_TIME_URL_KEY) ); logConfFile = tryGetFirstNonNullValueByAltMapAndAltKey(maps, null, LOG_CONF_FILE_PROP_KEY, LOG_CONF_FILE_URL_KEY); interactiveMode = Boolean.valueOf( tryGetFirstNonNullValueByAltMapAndAltKey(maps, "false", INTERACTIVE_MODE_PROP_KEY, INTERACTIVE_MODE_URL_KEY)); interactiveServiceName = tryGetFirstNonNullValueByAltMapAndAltKey(maps, INTERACTIVE_SERVICE_NAME_DEFAULT_VALUE, SERVICE_NAME_PROP_KEY, SERVICE_NAME_URL_KEY); majorVersion = tryGetFirstNonNullValueByAltMapAndAltKey(maps, null, MAJOR_VERSION_PROP_KEY, MAJOR_VERSION_URL_KEY); enableOdpsLogger = Boolean.valueOf( tryGetFirstNonNullValueByAltMapAndAltKey(maps, "false", ENABLE_ODPS_LOGGER_PROP_KEY, ENABLE_ODPS_LOGGER_URL_KEY) ); fallbackPolicy.fallback4ResourceNotEnough(Boolean.valueOf( tryGetFirstNonNullValueByAltMapAndAltKey(maps, "true", FALLBACK_FOR_RESOURCE_PROP_KEY, FALLBACK_FOR_RESOURCE_URL_KEY) )); fallbackPolicy.fallback4RunningTimeout(Boolean.valueOf( tryGetFirstNonNullValueByAltMapAndAltKey(maps, "true", FALLBACK_FOR_TIMEOUT_PROP_KEY, FALLBACK_FOR_TIMEOUT_URL_KEY) )); fallbackPolicy.fallback4Upgrading(Boolean.valueOf( tryGetFirstNonNullValueByAltMapAndAltKey(maps, "true", FALLBACK_FOR_UPGRADING_PROP_KEY, FALLBACK_FOR_UPGRADING_URL_KEY) )); fallbackPolicy.fallback4UnsupportedFeature(Boolean.valueOf( tryGetFirstNonNullValueByAltMapAndAltKey(maps, "true", FALLBACK_FOR_UNSUPPORTED_PROP_KEY, FALLBACK_FOR_UNSUPPORTED_URL_KEY) )); fallbackPolicy.fallback4UnknownError(Boolean.valueOf( tryGetFirstNonNullValueByAltMapAndAltKey(maps, "true", FALLBACK_FOR_UNKNOWN_PROP_KEY, FALLBACK_FOR_UNKNOWN_URL_KEY) )); boolean alwaysFallback = Boolean.valueOf( tryGetFirstNonNullValueByAltMapAndAltKey(maps, "false", ALWAYS_FALLBACK_PROP_KEY, ALWAYS_FALLBACK_URL_KEY) ); if (alwaysFallback) { fallbackPolicy = FallbackPolicy.alwaysFallbackPolicy(); } boolean disableFallback = Boolean.valueOf( tryGetFirstNonNullValueByAltMapAndAltKey(maps, "false", DISABLE_FALLBACK_PROP_KEY, DISABLE_FALLBACK_URL_KEY) ); if (disableFallback) { fallbackPolicy = FallbackPolicy.nonFallbackPolicy(); } stsToken = tryGetFirstNonNullValueByAltMapAndAltKey(maps, null, STS_TOKEN_PROP_KEY, STS_TOKEN_URL_KEY); autoSelectLimit = Long.valueOf( tryGetFirstNonNullValueByAltMapAndAltKey(maps, "-1", AUTO_SELECT_LIMIT_PROP_KEY, AUTO_SELECT_LIMIT_URL_KEY) ); countLimit = Long.valueOf( tryGetFirstNonNullValueByAltMapAndAltKey(maps, "-1", INSTANCE_TUNNEL_MAX_RECORD_PROP_KEY, INSTANCE_TUNNEL_MAX_RECORD_URL_KEY) ); if (countLimit <= 0L){ countLimit = null; } sizeLimit = Long.valueOf( tryGetFirstNonNullValueByAltMapAndAltKey(maps, "-1", INSTANCE_TUNNEL_MAX_SIZE_PROP_KEY, INSTANCE_TUNNEL_MAX_SIZE_URL_KEY) ); if (sizeLimit <= 0L){ sizeLimit = null; } disableConnSetting = Boolean.valueOf( tryGetFirstNonNullValueByAltMapAndAltKey(maps, "false", DISABLE_CONN_SETTING_PROP_KEY, DISABLE_CONN_SETTING_URL_KEY) ); useProjectTimeZone = Boolean.valueOf( tryGetFirstNonNullValueByAltMapAndAltKey(maps, "false", USE_PROJECT_TIME_ZONE_PROP_KEY, USE_PROJECT_TIME_ZONE_URL_KEY) ); enableLimit = Boolean.valueOf( tryGetFirstNonNullValueByAltMapAndAltKey(maps, "true", ENABLE_LIMIT_PROP_KEY, ENABLE_LIMIT_URL_KEY) ); // The option 'tableList' accepts table names in pattern: // <project name>.<table name>(,<project name>.<table name>)* // // This option is used to accelerate table loading. For a project contains thousands of tables, // BI software such as Tableau may load all the tables when the software starts and it could // take several minutes before the user could really start using it. To avoid this situation, // users could specify the table names they are going to use and the driver will only load // these tables. String tablesStr = tryGetFirstNonNullValueByAltMapAndAltKey(maps, null, TABLE_LIST_PROP_KEY, TABLE_LIST_URL_KEY); if (!StringUtils.isNullOrEmpty(tablesStr)) { for (String tableStr : tablesStr.split(",")) { String[] parts = tableStr.split("\\."); if (parts.length != 2) { throw new IllegalArgumentException("Invalid table name: " + tableStr); } tables.computeIfAbsent(parts[0], p -> new LinkedList<>()); tables.get(parts[0]).add(parts[1]); } } String globalSettingsInJson = tryGetFirstNonNullValueByAltMapAndAltKey( maps, null, SETTINGS_URL_KEY, SETTINGS_PROP_KEY); if (globalSettingsInJson != null) { Type type = new TypeToken<Map<String, String>>() {}.getType(); settings.putAll(GsonObjectBuilder.get().fromJson(globalSettingsInJson, type)); } } @SuppressWarnings("deprecation") private Map<String, String> extractParamsFromUrl(String url) { Map<String, String> paramsInURL = new HashMap<String, String>(); url = url.substring(JDBC_ODPS_URL_PREFIX.length()); int atPos = url.indexOf("?"); if (atPos == -1) { endpoint = url; } else { endpoint = url.substring(0, atPos); String query = url.substring(atPos + 1); String[] pairs = query.split("&"); for (String pair : pairs) { int pos = pair.indexOf("="); if (pos > 0) { paramsInURL.put(URLDecoder.decode(pair.substring(0, pos)), URLDecoder.decode(pair.substring(pos + 1))); } else { paramsInURL.put(URLDecoder.decode(pair), null); } } } return paramsInURL; } public String getEndpoint() { return endpoint; } public String getProject() { return project; } public String getExecuteProject() { return executeProject; } public String getCharset() { return charset; } public String getAccessId() { return accessId; } public String getAccessKey() { return accessKey; } public String getLogview() { return logview; } public String getTunnelEndpoint() { return tunnelEndpoint; } public int getTunnelRetryTime() { return tunnelRetryTime; } public String getLogConfFile() { return logConfFile; } public String getInteractiveServiceName() { return interactiveServiceName; } public String getMajorVersion() { return majorVersion; } public boolean isEnableOdpsLogger() { return enableOdpsLogger; } public Long getAutoSelectLimit() { return autoSelectLimit; } public Long getCountLimit() { return countLimit; } public Long getSizeLimit() { return sizeLimit; } @SuppressWarnings("rawtypes") private static String tryGetFirstNonNullValueByAltMapAndAltKey(List<Map> maps, String defaultValue, String... altKeys) { String value = null; for (Map map : maps) { if (map != null) { for (String key : altKeys) { if ((value = (String) map.get(key)) != null) { return value; } } } } return defaultValue; } public boolean isInteractiveMode() { return interactiveMode; } public Map<String, List<String>> getTables() { return tables; } public FallbackPolicy getFallbackPolicy() { return fallbackPolicy; } public String getStsToken() { return stsToken; } public boolean isDisableConnSetting() { return disableConnSetting; } public boolean isUseProjectTimeZone() { return useProjectTimeZone; } public boolean isEnableLimit() { return enableLimit; } public Map<String, String> getSettings() { return settings; } } <|start_filename|>src/main/java/com/aliyun/odps/jdbc/utils/transformer/to/jdbc/ToJdbcByteArrayTransformer.java<|end_filename|> /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package com.aliyun.odps.jdbc.utils.transformer.to.jdbc; import java.sql.SQLException; import java.text.SimpleDateFormat; import com.aliyun.odps.data.Binary; import com.aliyun.odps.jdbc.utils.JdbcColumn; public class ToJdbcByteArrayTransformer extends AbstractToJdbcTransformer { @Override public Object transform(Object o, String charset) throws SQLException { if (o == null) { return null; } if (o instanceof byte[]) { return o; } else if (java.util.Date.class.isInstance(o)) { if (java.sql.Timestamp.class.isInstance(o)) { return o.toString().getBytes(); } SimpleDateFormat dateFormat = new SimpleDateFormat(JdbcColumn.ODPS_DATETIME_FORMAT); return dateFormat.format(((java.util.Date) o)).getBytes(); } else if (o instanceof Binary) { return ((Binary) o).data(); } else { return o.toString().getBytes(); } } } <|start_filename|>src/main/java/com/aliyun/odps/jdbc/OdpsConnection.java<|end_filename|> /* * Licensed to the Apache Software Foundation (ASF) under one or more contributor license * agreements. See the NOTICE file distributed with this work for additional information regarding * copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance with the License. You may obtain a * copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under the License * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express * or implied. See the License for the specific language governing permissions and limitations under * the License. */ package com.aliyun.odps.jdbc; import com.aliyun.odps.account.StsAccount; import com.aliyun.odps.jdbc.utils.OdpsLogger; import java.sql.Array; import java.sql.Blob; import java.sql.CallableStatement; import java.sql.Clob; import java.sql.Connection; import java.sql.DatabaseMetaData; import java.sql.NClob; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLClientInfoException; import java.sql.SQLException; import java.sql.SQLFeatureNotSupportedException; import java.sql.SQLWarning; import java.sql.SQLXML; import java.sql.Savepoint; import java.sql.Statement; import java.sql.Struct; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Properties; import java.util.TimeZone; import java.util.concurrent.Executor; import java.util.concurrent.atomic.AtomicLong; import org.slf4j.MDC; import com.aliyun.odps.Odps; import com.aliyun.odps.OdpsException; import com.aliyun.odps.account.Account; import com.aliyun.odps.account.AliyunAccount; import com.aliyun.odps.jdbc.utils.ConnectionResource; import com.aliyun.odps.jdbc.utils.Utils; import com.aliyun.odps.sqa.FallbackPolicy; import com.aliyun.odps.sqa.SQLExecutor; import com.aliyun.odps.sqa.SQLExecutorBuilder; import com.aliyun.odps.utils.StringUtils; public class OdpsConnection extends WrapperAdapter implements Connection { private static final AtomicLong CONNECTION_ID_GENERATOR = new AtomicLong(0); private final Odps odps; private final TimeZone tz; private final Properties info; private final List<Statement> stmtHandles; /** * For each connection, keep a character set label for layout the ODPS's byte[] storage */ private final String charset; private final String logviewHost; private boolean isClosed = false; /** * Per-connection logger. All its statements produced by this connection will share this logger */ protected OdpsLogger log; private SQLWarning warningChain = null; private String connectionId; private final Properties sqlTaskProperties = new Properties(); private String tunnelEndpoint; private String majorVersion; private static final String MAJOR_VERSION = "odps.task.major.version"; private static String ODPS_SETTING_PREFIX = "odps."; private boolean interactiveMode = false; private Long autoSelectLimit = null; private Map<String, List<String>> tables; //Unit: result record row count, only applied in interactive mode private Long resultCountLimit = null; //Unit: Bytes, only applied in interactive mode private Long resultSizeLimit = null; //Tunnel get result retry time, tunnel will retry every 10s private int tunnelRetryTime; private boolean disableConnSetting = false; private boolean useProjectTimeZone = false; private boolean enableLimit = false; private SQLExecutor executor = null; private String executeProject = null; OdpsConnection(String url, Properties info) throws SQLException { ConnectionResource connRes = new ConnectionResource(url, info); String accessId = connRes.getAccessId(); String accessKey = connRes.getAccessKey(); String charset = connRes.getCharset(); String project = connRes.getProject(); String endpoint = connRes.getEndpoint(); String tunnelEndpoint = connRes.getTunnelEndpoint(); String logviewHost = connRes.getLogview(); String logConfFile = connRes.getLogConfFile(); String serviceName = connRes.getInteractiveServiceName(); String stsToken = connRes.getStsToken(); sqlTaskProperties.put(Utils.JDBC_USER_AGENT, Utils.JDBCVersion + " " + Utils.SDKVersion); connectionId = Long.toString(CONNECTION_ID_GENERATOR.incrementAndGet()); MDC.put("connectionId", connectionId); log = new OdpsLogger(connectionId, null, logConfFile, false, connRes.isEnableOdpsLogger()); String version = Utils.retrieveVersion("driver.version"); log.info("ODPS JDBC driver, Version " + version); log.info(String.format("endpoint=%s, project=%s", endpoint, project)); log.info("JVM timezone : " + TimeZone.getDefault().getID()); log.info(String.format("charset=%s, logview host=%s", charset, logviewHost)); Account account; if (stsToken == null || stsToken.length() <= 0) { account = new AliyunAccount(accessId, accessKey); } else { account = new StsAccount(accessId, accessKey, stsToken); } log.debug("debug mode on"); odps = new Odps(account); odps.setEndpoint(endpoint); odps.setDefaultProject(project); odps.setUserAgent("odps-jdbc-" + version); this.info = info; this.charset = charset; this.logviewHost = logviewHost; this.tunnelEndpoint = tunnelEndpoint; this.stmtHandles = new ArrayList<>(); this.sqlTaskProperties.putAll(connRes.getSettings()); this.tunnelRetryTime = connRes.getTunnelRetryTime(); this.majorVersion = connRes.getMajorVersion(); this.interactiveMode = connRes.isInteractiveMode(); this.tables = Collections.unmodifiableMap(connRes.getTables()); this.executeProject = connRes.getExecuteProject(); this.autoSelectLimit = connRes.getAutoSelectLimit(); this.resultCountLimit = connRes.getCountLimit(); this.resultSizeLimit = connRes.getSizeLimit(); this.disableConnSetting = connRes.isDisableConnSetting(); this.useProjectTimeZone = connRes.isUseProjectTimeZone(); this.enableLimit = connRes.isEnableLimit(); try { long startTime = System.currentTimeMillis(); // Default value for odps.sql.timezone String timeZoneId = "Asia/Shanghai"; String projectTimeZoneId = odps.projects().get().getProperty("odps.sql.timezone"); if (!StringUtils.isNullOrEmpty(projectTimeZoneId)) { timeZoneId = projectTimeZoneId; } log.info("Project timezone: " + timeZoneId); tz = TimeZone.getTimeZone(timeZoneId); if (interactiveMode) { long cost = System.currentTimeMillis() - startTime; log.info(String.format("load project meta infos time cost=%d", cost)); initSQLExecutor(serviceName, connRes.getFallbackPolicy()); } String msg = "Connect to odps project %s successfully"; log.info(String.format(msg, odps.getDefaultProject())); } catch (OdpsException e) { log.error("Connect to odps failed:" + e.getMessage()); throw new SQLException(e); } } public void initSQLExecutor(String serviceName, FallbackPolicy fallbackPolicy) throws OdpsException { // only support major version when attaching a session Map<String, String> hints = new HashMap<>(); if (!StringUtils.isNullOrEmpty(majorVersion)) { hints.put(MAJOR_VERSION, majorVersion); } for (String key : info.stringPropertyNames()) { if (key.startsWith(ODPS_SETTING_PREFIX)) { hints.put(key, info.getProperty(key)); } } SQLExecutorBuilder builder = new SQLExecutorBuilder(); Odps executeOdps = this.odps; if (!StringUtils.isNullOrEmpty(executeProject)) { executeOdps = this.odps.clone(); executeOdps.setDefaultProject(executeProject); } builder.odps(executeOdps) .properties(hints) .serviceName(serviceName) .fallbackPolicy(fallbackPolicy) .enableReattach(true) .tunnelEndpoint(tunnelEndpoint) .tunnelGetResultMaxRetryTime(tunnelRetryTime) .taskName(OdpsStatement.getDefaultTaskName()); long startTime = System.currentTimeMillis(); executor = builder.build(); if (interactiveMode && executor.getInstance() != null) { long cost = System.currentTimeMillis() - startTime; log.info(String.format("Attach success, instanceId:%s, attach and get tunnel endpoint time cost=%d", executor.getInstance().getId(), cost)); } } @Override public OdpsPreparedStatement prepareStatement(String sql) throws SQLException { OdpsPreparedStatement stmt = new OdpsPreparedStatement(this, sql); stmtHandles.add(stmt); return stmt; } @Override public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public PreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public PreparedStatement prepareStatement(String sql, String[] columnNames) throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } /** * Only support the following type * * @param sql the prepared sql * @param resultSetType TYPE_SCROLL_INSENSITIVE or ResultSet.TYPE_FORWARD_ONLY * @param resultSetConcurrency CONCUR_READ_ONLY * @return OdpsPreparedStatement * @throws SQLException wrong type */ @Override public OdpsPreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException { checkClosed(); if (resultSetType == ResultSet.TYPE_SCROLL_SENSITIVE) { throw new SQLFeatureNotSupportedException("Statement with resultset type: " + resultSetType + " is not supported"); } if (resultSetConcurrency == ResultSet.CONCUR_UPDATABLE) { throw new SQLFeatureNotSupportedException("Statement with resultset concurrency: " + resultSetConcurrency + " is not supported"); } boolean isResultSetScrollable = (resultSetType == ResultSet.TYPE_SCROLL_INSENSITIVE); OdpsPreparedStatement stmt = new OdpsPreparedStatement(this, sql, isResultSetScrollable); stmtHandles.add(stmt); return stmt; } @Override public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public CallableStatement prepareCall(String sql) throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException { throw new SQLFeatureNotSupportedException(); } @Override public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public String nativeSQL(String sql) throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public void setAutoCommit(boolean autoCommit) throws SQLException { if (!autoCommit) { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " to false is not supported!!!"); throw new SQLFeatureNotSupportedException("disabling autocommit is not supported"); } } @Override public boolean getAutoCommit() throws SQLException { return true; } @Override public void commit() throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public void rollback() throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public void rollback(Savepoint savepoint) throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public void close() throws SQLException { MDC.remove("connectionId"); if (!isClosed) { for (Statement stmt : stmtHandles) { if (stmt != null && !stmt.isClosed()) { stmt.close(); } } if (runningInInteractiveMode()) { executor.close(); } } isClosed = true; log.info("connection closed"); } @Override public boolean isClosed() throws SQLException { return isClosed; } @Override public DatabaseMetaData getMetaData() throws SQLException { checkClosed(); return new OdpsDatabaseMetaData(this); } @Override public void setReadOnly(boolean readOnly) throws SQLException { if (readOnly) { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException("enabling read-only is not supported"); } } @Override public boolean isReadOnly() throws SQLException { return false; } /** * ODPS doesn't support the concept of catalog Each connection is associated with one endpoint * (embedded in the connection url). Each endpoint has a couple of projects (schema) */ @Override public void setCatalog(String catalog) throws SQLException { } @Override public String getCatalog() throws SQLException { return null; } @Override public void setTransactionIsolation(int level) throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public int getTransactionIsolation() throws SQLException { return Connection.TRANSACTION_NONE; } @Override public SQLWarning getWarnings() throws SQLException { return warningChain; } @Override public void clearWarnings() throws SQLException { warningChain = null; } @Override public Map<String, Class<?>> getTypeMap() throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public void setTypeMap(Map<String, Class<?>> map) throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public void setHoldability(int holdability) throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public int getHoldability() throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public Savepoint setSavepoint() throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public Savepoint setSavepoint(String name) throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public void releaseSavepoint(Savepoint savepoint) throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public OdpsStatement createStatement() throws SQLException { checkClosed(); OdpsStatement stmt = new OdpsStatement(this, false); stmtHandles.add(stmt); return stmt; } /** * Only support the following type: * * @param resultSetType TYPE_SCROLL_INSENSITIVE or ResultSet.TYPE_FORWARD_ONLY * @param resultSetConcurrency CONCUR_READ_ONLY * @return OdpsStatement object * @throws SQLException wrong type */ @Override public OdpsStatement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException { checkClosed(); boolean isResultSetScrollable; switch (resultSetType) { case ResultSet.TYPE_FORWARD_ONLY: isResultSetScrollable = false; break; case ResultSet.TYPE_SCROLL_INSENSITIVE: isResultSetScrollable = true; break; default: throw new SQLFeatureNotSupportedException( "only support statement with ResultSet type: TYPE_SCROLL_INSENSITIVE, ResultSet.TYPE_FORWARD_ONLY"); } switch (resultSetConcurrency) { case ResultSet.CONCUR_READ_ONLY: break; default: throw new SQLFeatureNotSupportedException( "only support statement with ResultSet concurrency: CONCUR_READ_ONLY"); } OdpsStatement stmt = new OdpsStatement(this, isResultSetScrollable); stmtHandles.add(stmt); return stmt; } @Override public Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public Clob createClob() throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public Blob createBlob() throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public NClob createNClob() throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public SQLXML createSQLXML() throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public boolean isValid(int timeout) throws SQLException { // connection validation is already done in constructor, always return true here return true; } @Override public void setClientInfo(Properties properties) throws SQLClientInfoException { this.info.putAll(properties); } @Override public void setClientInfo(String name, String value) throws SQLClientInfoException { this.info.put(name, value); } @Override public Properties getClientInfo() throws SQLException { return info; } @Override public String getClientInfo(String name) throws SQLException { return info.getProperty(name); } @Override public Array createArrayOf(String typeName, Object[] elements) throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public Struct createStruct(String typeName, Object[] attributes) throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public void setSchema(String schema) throws SQLException { checkClosed(); odps.setDefaultProject(schema); } @Override public String getSchema() throws SQLException { checkClosed(); return odps.getDefaultProject(); } @Override public void abort(Executor executor) throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public void setNetworkTimeout(Executor executor, int milliseconds) throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } @Override public int getNetworkTimeout() throws SQLException { log.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " is not supported!!!"); throw new SQLFeatureNotSupportedException(); } public Odps getOdps() { return this.odps; } public TimeZone getProjectTimeZone() { return tz; } public boolean isUseProjectTimeZone() { return useProjectTimeZone; } /** * For test * @param useProjectTimeZone */ public void setUseProjectTimeZone(boolean useProjectTimeZone) { this.useProjectTimeZone = useProjectTimeZone; } private void checkClosed() throws SQLException { if (isClosed) { throw new SQLException("the connection has already been closed"); } } protected String getCharset() { return charset; } protected String getLogviewHost() { return logviewHost; } public Properties getSqlTaskProperties() { return sqlTaskProperties; } public String getTunnelEndpoint() { return tunnelEndpoint; } public SQLExecutor getExecutor() { return executor; } public boolean runningInInteractiveMode() { return interactiveMode; } public Map<String, List<String>> getTables() { return tables; } public String getExecuteProject() { return executeProject; } public Long getAutoSelectLimit() { return autoSelectLimit; } public Long getCountLimit() { return resultCountLimit; } public Long getSizeLimit() { return resultSizeLimit; } public boolean disableConnSetting() { return disableConnSetting; } public boolean enableLimit() { return enableLimit; } public void setEnableLimit(boolean enableLimit) { this.enableLimit = enableLimit; } } <|start_filename|>example/src/main/java/DataDumpBenchmark.java<|end_filename|> import java.io.InputStream; import java.lang.System; import java.sql.PreparedStatement; import java.sql.SQLException; import java.sql.Connection; import java.sql.ResultSet; import java.sql.Statement; import java.sql.DriverManager; import java.util.ArrayList; import java.util.List; import java.util.Properties; import java.util.concurrent.Callable; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; public class DataDumpBenchmark { private static String driverName = "com.aliyun.odps.jdbc.OdpsDriver"; static String joinStrings(String[] s, String glue) { int k = s.length; if (k == 0) { return null; } StringBuilder out = new StringBuilder(); out.append(s[0]); for (int x = 1; x < k; ++x) { out.append(glue).append(s[x]); } return out.toString(); } /** * @param args * @throws SQLException */ public static void main(String[] args) throws SQLException { final int batchSize; final int splitNum; final Properties odpsConfig = new Properties(); try { splitNum = Integer.parseInt(args[0]); batchSize = Integer.parseInt(args[1]); System.out.println("split size: " + batchSize); System.out.println("batch size: " + splitNum); Class.forName(driverName); InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream("conf.properties"); odpsConfig.load(is); } catch (Exception e) { System.out.println(e); return; } final Connection connSource = DriverManager.getConnection( "jdbc:odps:" + odpsConfig.getProperty("endpoint_1") + "?project=meta_dev&loglevel=debug&", odpsConfig.getProperty("access_id_1"), odpsConfig.getProperty("access_key_1")); final Connection connTarget = DriverManager.getConnection( "jdbc:odps:" + odpsConfig.getProperty("endpoint_2") + "?project=odps_test_sqltask_finance&loglevel=debug", odpsConfig.getProperty("access_id_2"), odpsConfig.getProperty("access_key_2")); String sourceSchema = "meta"; String sourceTable = "m_instance"; String targetTable = "m_instance_copy"; String sourceWhere = "ds = '20151120'"; String splitColumn = "start_time"; ResultSet cols = connSource.getMetaData().getColumns(null, sourceSchema, sourceTable, null); List<String> nameTypePairs = new ArrayList<String>(); List<String> questionMarks = new ArrayList<String>(); while (cols.next()) { nameTypePairs.add(cols.getString("COLUMN_NAME") + " " + cols.getString("TYPE_NAME")); questionMarks.add("?"); } final int colNums = nameTypePairs.size(); if (sourceSchema != null) { sourceTable = sourceSchema + "." + sourceTable; } String createTableSql = "create table " + targetTable + "(" + joinStrings(nameTypePairs.toArray(new String[nameTypePairs.size()]), ", ") + ")"; final String insertValuesSql = "insert into " + targetTable + " values (" + joinStrings(questionMarks.toArray(new String[questionMarks.size()]), ", ") + ")"; String rangeSql = "select max(" + splitColumn + "), min(" + splitColumn + ") from " + sourceTable; if (sourceWhere != null) { rangeSql += " where " + sourceWhere; } Statement ddl = connTarget.createStatement(); ddl.executeUpdate("drop table if exists " + targetTable); ddl.executeUpdate(createTableSql); ddl.close(); Statement query = connSource.createStatement(); ResultSet range = query.executeQuery(rangeSql); long max, min; range.next(); max = range.getLong(1); min = range.getLong(2); range.close(); query.close(); long[] markers = new long[splitNum + 1]; markers[0] = min; for (int i = 1; i < splitNum; i++) { markers[i] = markers[i - 1] + (max - min + 1) / splitNum; } markers[splitNum] = max; String[] cutters = new String[splitNum]; for (int i = 0; i < splitNum - 1; i++) { cutters[i] = markers[i] + " <= " + splitColumn + " and " + splitColumn + " < " + markers[i + 1]; } cutters[splitNum - 1] = markers[splitNum - 1] + " <= " + splitColumn + " and " + splitColumn + " <= " + markers[splitNum]; connSource.close(); connTarget.close(); long start = System.currentTimeMillis(); ArrayList<Callable<Long>> callList = new ArrayList<Callable<Long>>(); for (int i = 0; i < splitNum; i++) { String selectSql = "select * from " + sourceTable + " where "; selectSql += cutters[i]; if (sourceWhere != null) { selectSql += " and " + sourceWhere; } final String selectSql2 = selectSql; Callable<Long> call = new Callable<Long>() { public Long call() throws Exception { final Connection connSource = DriverManager.getConnection( "jdbc:odps:" + odpsConfig.getProperty("endpoint_1") + "?project=meta_dev&loglevel=debug&", odpsConfig.getProperty("access_id_1"), odpsConfig.getProperty("access_key_1")); final Connection connTarget = DriverManager.getConnection( "jdbc:odps:" + odpsConfig.getProperty("endpoint_2") + "?project=odps_test_sqltask_finance&loglevel=debug", odpsConfig.getProperty("access_id_2"), odpsConfig.getProperty("access_key_2")); Statement query = connSource.createStatement(); PreparedStatement insert = connTarget.prepareStatement(insertValuesSql); ResultSet rs = query.executeQuery(selectSql2); long start = System.currentTimeMillis(); long now = start; int count = 0; while (rs.next()) { for (int i = 0; i < colNums; i++) { try { insert.setObject((i + 1), rs.getObject(i + 1)); } catch (SQLException e) { e.printStackTrace(); System.exit(1); } } insert.addBatch(); if (++count % batchSize == 0) { insert.executeBatch(); long end = System.currentTimeMillis(); System.out.printf("batch time: %.2f seconds\n", (float) (end - now) / 1000); now = end; } } insert.executeBatch(); // insert remaining records rs.close(); query.close(); insert.close(); connSource.close(); connTarget.close(); return 0L; } }; callList.add(call); } ExecutorService executors = Executors.newFixedThreadPool(2); try { executors.invokeAll(callList); } catch (InterruptedException e) { e.printStackTrace(); return; } executors.shutdown(); System.out.printf("total: %.2f minutes\n", (float) (System.currentTimeMillis() - start) / 1000 / 60); } } <|start_filename|>src/test/java/com/aliyun/odps/jdbc/OdpsStatementTest.java<|end_filename|> /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package com.aliyun.odps.jdbc; import java.io.IOException; import java.sql.Connection; import java.sql.ResultSet; import java.sql.ResultSetMetaData; import java.sql.SQLException; import java.sql.Statement; import java.util.Calendar; import java.util.Date; import java.util.TimeZone; import org.junit.AfterClass; import org.junit.Assert; import org.junit.BeforeClass; import org.junit.Test; import com.aliyun.odps.data.Record; import com.aliyun.odps.data.RecordWriter; import com.aliyun.odps.tunnel.TableTunnel; public class OdpsStatementTest { private static Connection conn = TestManager.getInstance().conn; private static final int ROWS = 100000; private static String OUTPUT_TABLE_NAME = "statement_test_table_output"; private static String INPUT_TABLE_NAME = "statement_test_table_input"; private static String PARTITIONED_TABLE_NAME = "partitioned_table_name"; @BeforeClass public static void setUp() throws Exception { Statement stmt = TestManager.getInstance().conn.createStatement(); stmt.executeUpdate("drop table if exists " + INPUT_TABLE_NAME); stmt.executeUpdate("drop table if exists " + OUTPUT_TABLE_NAME); stmt.executeUpdate("drop table if exists " + PARTITIONED_TABLE_NAME); stmt.executeUpdate("create table if not exists " + INPUT_TABLE_NAME + "(id bigint);"); stmt.executeUpdate("create table if not exists " + OUTPUT_TABLE_NAME + "(id bigint);"); stmt.executeUpdate("create table if not exists " + PARTITIONED_TABLE_NAME + "(foo bigint) partitioned by (bar string);"); stmt.executeUpdate("alter table " + PARTITIONED_TABLE_NAME + " add partition (bar='hello')"); stmt.close(); TableTunnel.UploadSession upload = TestManager.getInstance().tunnel.createUploadSession( TestManager.getInstance().odps.getDefaultProject(), INPUT_TABLE_NAME); RecordWriter writer = upload.openRecordWriter(0); Record r = upload.newRecord(); for (int i = 0; i < ROWS; i++) { r.setBigint(0, (long) i); writer.write(r); } writer.close(); upload.commit(new Long[]{0L}); } @AfterClass public static void tearDown() throws Exception { Statement stmt = conn.createStatement(); stmt.executeUpdate("drop table if exists " + INPUT_TABLE_NAME); stmt.executeUpdate("drop table if exists " + OUTPUT_TABLE_NAME); stmt.close(); } @Test public void testExecuteSet() throws Exception { Statement stmt = conn.createStatement(); Assert.assertFalse(stmt.execute(" set sql.x.y = 123 ;")); Assert.assertFalse(stmt.execute(" set sql.a.b= 1111")); Assert.assertFalse(stmt.execute("SET sql.c.d =abcdefgh")); ResultSet rs = stmt.executeQuery("select * from " + INPUT_TABLE_NAME); stmt.close(); } @Test public void testExecuteQuery() throws Exception { Statement stmt = conn.createStatement(); ResultSet rs = stmt.executeQuery("select * from " + INPUT_TABLE_NAME); Assert.assertEquals(ResultSet.TYPE_FORWARD_ONLY, rs.getType()); long start = System.currentTimeMillis(); { int i = 0; while (rs.next()) { Assert.assertEquals(i + 1, rs.getRow()); Assert.assertEquals(i, rs.getInt(1)); i++; } } long end = System.currentTimeMillis(); System.out.printf("step\tmillis\t%d\n", end - start); rs.close(); Assert.assertTrue(rs.isClosed()); stmt.close(); Assert.assertTrue(stmt.isClosed()); } @Test public void testSelectNullQuery() throws Exception { Statement stmt = conn.createStatement(); ResultSet rs = stmt.executeQuery("select null from " + INPUT_TABLE_NAME); Assert.assertEquals(ResultSet.TYPE_FORWARD_ONLY, rs.getType()); long start = System.currentTimeMillis(); { int i = 0; while (rs.next()) { Assert.assertEquals(i + 1, rs.getRow()); Assert.assertEquals(null, rs.getObject(1)); Assert.assertEquals(null, rs.getString(1)); i++; } } long end = System.currentTimeMillis(); System.out.printf("step\tmillis\t%d\n", end - start); rs.close(); Assert.assertTrue(rs.isClosed()); stmt.close(); Assert.assertTrue(stmt.isClosed()); } @Test public void testSetMaxRows() throws Exception { Statement stmt = conn.createStatement(); stmt.setMaxRows(45678); Assert.assertEquals(45678, stmt.getMaxRows()); ResultSet rs = stmt.executeQuery("select * from " + INPUT_TABLE_NAME); { int i = 0; while (rs.next()) { Assert.assertEquals(i + 1, rs.getRow()); Assert.assertEquals(i, rs.getInt(1)); i++; } Assert.assertEquals(45678, i); } rs.close(); stmt.close(); } @Test public void testExecuteUpdate() throws Exception { Statement stmt = conn.createStatement(); String sql = "insert into table " + OUTPUT_TABLE_NAME + " select * from " + INPUT_TABLE_NAME; int updateCount = stmt.executeUpdate(sql); Assert.assertEquals(ROWS, updateCount); stmt.close(); } /** * Thread for a sql to be cancelled */ class ExecuteSQL implements Runnable { Statement stmt; public Thread mythread; String sql; ExecuteSQL(Statement stmt, String sql) { this.stmt = stmt; this.sql = sql; mythread = new Thread(this, "sql thread"); System.out.println("thread created: " + mythread); } public void run() { try { System.out.println("trigger sql"); boolean kind = stmt.execute(sql); System.out.println(kind ? "query ok" : "update ok"); } catch (SQLException e) { System.out.println("run sql fail: " + e.getMessage()); } } } /** * Thread class for cancelling sql */ class CancelSQL implements Runnable { Statement stmt; public Thread mythread; CancelSQL(Statement stmt) { this.stmt = stmt; mythread = new Thread(this, "cancel thread"); System.out.println("thread created: " + mythread); } public void run() { try { System.out.println("trigger cancel"); stmt.cancel(); } catch (SQLException e) { System.out.println("cancel fail: " + e.getMessage()); } } } @Test public void testCancelQuery() throws Exception { Statement stmt = conn.createStatement(); String sql = "select * from " + INPUT_TABLE_NAME + " limit 10000;"; ExecuteSQL updateIt = new ExecuteSQL(stmt, sql); CancelSQL cancelIt = new CancelSQL(stmt); // kicks-off execution 4s earlier updateIt.mythread.start(); Thread.sleep(4000); cancelIt.mythread.start(); updateIt.mythread.join(); cancelIt.mythread.join(); stmt.close(); } @Test public void testCancelUpdate() throws Exception { Statement stmt = conn.createStatement(); String sql = "insert into table " + OUTPUT_TABLE_NAME + " select * from " + INPUT_TABLE_NAME + " limit 10000;"; ExecuteSQL updateIt = new ExecuteSQL(stmt, sql); CancelSQL cancelIt = new CancelSQL(stmt); // kicks-off execution 4s earlier updateIt.mythread.start(); Thread.sleep(4000); cancelIt.mythread.start(); updateIt.mythread.join(); cancelIt.mythread.join(); stmt.close(); } @Test public void testExecuteQueryEmpty() throws Exception { Statement stmt = conn.createStatement(); String sql = "select * from " + INPUT_TABLE_NAME + " where id < 0;"; ResultSet rs = stmt.executeQuery(sql); Assert.assertNotNull(rs); ResultSetMetaData rsmd = rs.getMetaData(); Assert.assertEquals(1, rsmd.getColumnCount()); stmt.close(); } @Test public void testExecuteMissingSemiColon() throws Exception { Statement stmt = conn.createStatement(); Assert.assertEquals(true, stmt.execute("select 1 id from " + INPUT_TABLE_NAME + " limit 1;")); ResultSet rs = stmt.getResultSet(); { rs.next(); Assert.assertEquals(1, rs.getInt(1)); } Assert.assertEquals(true, stmt.execute( "select 1 id \n,2 height\nfrom " + INPUT_TABLE_NAME + " limit 1;")); rs = stmt.getResultSet(); { rs.next(); Assert.assertEquals(1, rs.getInt(1)); } Assert.assertEquals(true, stmt.execute("select 1 id from " + INPUT_TABLE_NAME + " limit 1")); rs = stmt.getResultSet(); { rs.next(); Assert.assertEquals(1, rs.getInt(1)); } Assert.assertEquals(true, stmt.execute( "select 1 id \n,2 height\nfrom " + INPUT_TABLE_NAME + " limit 1")); rs = stmt.getResultSet(); { rs.next(); Assert.assertEquals(1, rs.getInt(1)); } rs.close(); stmt.close(); } @Test public void testQueryOrUpdate() throws Exception { Assert.assertTrue(OdpsStatement.isQuery("select 1 id, 1.5 weight from dual;")); Assert.assertTrue(OdpsStatement.isQuery(" select 1 id from dual;")); Assert.assertTrue(OdpsStatement.isQuery("\nselect 1 id from dual;")); Assert.assertTrue(OdpsStatement.isQuery("\t\r\nselect 1 id from dual;")); Assert.assertTrue(OdpsStatement.isQuery("SELECT 1 id from dual;")); Assert.assertTrue(OdpsStatement.isQuery(" SELECT 1 id from dual;")); Assert.assertTrue(OdpsStatement.isQuery(" SELECT 1 id--xixi\n from dual;")); Assert.assertTrue(OdpsStatement.isQuery("--abcd\nSELECT 1 id from dual;")); Assert.assertTrue(OdpsStatement.isQuery("--abcd\n--hehehe\nSELECT 1 id from dual;")); Assert.assertTrue(OdpsStatement.isQuery("--abcd\n--hehehe\n\t \t select 1 id from dual;")); Assert.assertFalse( OdpsStatement.isQuery("insert into table yichao_test_table_output select 1 id from dual;")); Assert.assertFalse(OdpsStatement.isQuery( "insert into table\nyichao_test_table_output\nselect 1 id from dual;")); } @Test public void testDescTable() { try (Statement stmt = TestManager.getInstance().conn.createStatement()) { stmt.execute("desc " + PARTITIONED_TABLE_NAME); try (ResultSet rs = stmt.getResultSet()) { int columnCount = rs.getMetaData().getColumnCount(); while (rs.next()) { for (int i = 1; i <= columnCount; i++) { System.out.print(rs.getString(i)); if (i == columnCount) { System.out.print("\n"); } else { System.out.print(", "); } } } } } catch (SQLException e) { e.printStackTrace(); } } @Test public void testDescPartition() { try (Statement stmt = TestManager.getInstance().conn.createStatement()) { stmt.execute("desc " + PARTITIONED_TABLE_NAME + " partition (bar='hello');"); try (ResultSet rs = stmt.getResultSet()) { int columnCount = rs.getMetaData().getColumnCount(); while (rs.next()) { for (int i = 1; i <= columnCount; i++) { System.out.print(rs.getString(i)); if (i == columnCount) { System.out.print("\n"); } else { System.out.print(", "); } } } } } catch (SQLException e) { e.printStackTrace(); } } @Test public void testShowTables() { try (Statement stmt = TestManager.getInstance().conn.createStatement()) { stmt.execute("show tables;"); try (ResultSet rs = stmt.getResultSet()) { int columnCount = rs.getMetaData().getColumnCount(); while (rs.next()) { for (int i = 1; i <= columnCount; i++) { System.out.print(rs.getString(i)); if (i == columnCount) { System.out.print("\n"); } else { System.out.print(", "); } } } } } catch (SQLException e) { e.printStackTrace(); } } @Test public void testShowPartitions() { try (Statement stmt = TestManager.getInstance().conn.createStatement()) { stmt.execute("show partitions " + PARTITIONED_TABLE_NAME); try (ResultSet rs = stmt.getResultSet()) { int columnCount = rs.getMetaData().getColumnCount(); while (rs.next()) { for (int i = 1; i <= columnCount; i++) { System.out.print(rs.getString(i)); if (i == columnCount) { System.out.print("\n"); } else { System.out.print(", "); } } } } } catch (SQLException e) { e.printStackTrace(); } } @Test public void testSetTimeZone() { Calendar jvmCalendar = Calendar.getInstance(); jvmCalendar.set(2020, Calendar.JANUARY, 1, 0, 0,0); long localTimestampInSecond = jvmCalendar.toInstant().getEpochSecond(); try (Statement stmt = TestManager.getInstance().conn.createStatement()) { stmt.execute("SET odps.sql.timezone=UTC"); try (ResultSet rs = stmt.executeQuery("SELECT CAST('2020-01-01 00:00:00' AS DATETIME)")) { while (rs.next()) { Date utcDate = rs.getTimestamp(1); long utcTimestampInSecond = utcDate.getTime() / 1000; Assert.assertEquals( utcTimestampInSecond - localTimestampInSecond, TimeZone.getDefault().getOffset(utcDate.getTime()) / 1000); } } } catch (SQLException e) { e.printStackTrace(); } } } <|start_filename|>src/main/java/com/aliyun/odps/jdbc/utils/transformer/to/jdbc/ToJdbcTimeTransfomer.java<|end_filename|> /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package com.aliyun.odps.jdbc.utils.transformer.to.jdbc; import java.sql.SQLException; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.TimeZone; public class ToJdbcTimeTransfomer extends AbstractToJdbcDateTypeTransformer { @Override public Object transform( Object o, String charset, Calendar cal, TimeZone timeZone) throws SQLException { if (o == null) { return null; } if (java.util.Date.class.isInstance(o)) { long time = ((java.util.Date) o).getTime(); if (timeZone != null) { time += timeZone.getOffset(time); } return new java.sql.Time(time); } else if (o instanceof byte[]) { try { SimpleDateFormat datetimeFormat = DATETIME_FORMAT.get(); SimpleDateFormat timeFormat = TIME_FORMAT.get(); if (cal != null) { datetimeFormat.setCalendar(cal); timeFormat.setCalendar(cal); } try { return new java.sql.Time( datetimeFormat.parse(encodeBytes((byte[]) o, charset)).getTime()); } catch (ParseException ignored) { } try { return new java.sql.Time(timeFormat.parse(encodeBytes((byte[]) o, charset)).getTime()); } catch (ParseException ignored) { } String errorMsg = getTransformationErrMsg(encodeBytes((byte[]) o, charset), java.sql.Time.class); throw new SQLException(errorMsg); } finally { restoreToDefaultCalendar(); } } else { String errorMsg = getInvalidTransformationErrorMsg(o.getClass(), java.sql.Timestamp.class); throw new SQLException(errorMsg); } } } <|start_filename|>src/test/java/com/aliyun/odps/jdbc/OdpsNewTypeTest.java<|end_filename|> /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package com.aliyun.odps.jdbc; import java.io.IOException; import java.math.BigDecimal; import java.sql.Date; import java.sql.ResultSet; import java.sql.ResultSetMetaData; import java.sql.SQLException; import java.sql.Statement; import java.sql.Timestamp; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.TreeMap; import org.junit.AfterClass; import org.junit.Assert; import org.junit.BeforeClass; import org.junit.Test; import com.aliyun.odps.Column; import com.aliyun.odps.Odps; import com.aliyun.odps.OdpsException; import com.aliyun.odps.OdpsType; import com.aliyun.odps.TableSchema; import com.aliyun.odps.data.ArrayRecord; import com.aliyun.odps.data.Binary; import com.aliyun.odps.data.Char; import com.aliyun.odps.data.RecordWriter; import com.aliyun.odps.data.SimpleStruct; import com.aliyun.odps.data.Varchar; import com.aliyun.odps.jdbc.utils.TestUtils; import com.aliyun.odps.tunnel.TableTunnel; import com.aliyun.odps.tunnel.TunnelException; import com.aliyun.odps.type.StructTypeInfo; import com.aliyun.odps.type.TypeInfo; import com.aliyun.odps.type.TypeInfoFactory; public class OdpsNewTypeTest { static Statement stmt; static ResultSet rs; static ResultSetMetaData rsmd; static String table = "jdbc_test_" + System.currentTimeMillis(); static Odps odps = TestManager.getInstance().odps; static int v1; static long v2; static String v3; static BigDecimal v4; static byte v5; static short v6; static double v7; static float v8; static boolean v9; static Date v10; static java.util.Date v11; static Timestamp v12; static Varchar v13; static Char v14; static Binary v15; static List v16; static Map<Long, String> v17; static SimpleStruct v18; @BeforeClass public static void setUp() throws Exception { stmt = TestManager.getInstance().conn.createStatement(); stmt.executeUpdate("drop table if exists " + table + ";"); createTableWithAllNewTypes(odps, table); uploadData(); } @AfterClass public static void tearDown() throws Exception { if (rs != null) rs.close(); if (stmt != null) stmt.close(); // odps.tables().delete(table, true); } @Test public void testQuery() throws SQLException { String sql = "select * from " + table; ResultSet rs = stmt.executeQuery(sql); while (rs.next()) { System.out.println(v1); System.out.println(rs.getString(1)); Assert.assertEquals(v1, rs.getInt(1)); System.out.println(v2); System.out.println(rs.getString(2)); Assert.assertEquals(v2, rs.getLong(2)); System.out.println(v3); System.out.println(rs.getString(3)); Assert.assertEquals(v3, rs.getString(3)); System.out.println(v4); System.out.println(rs.getString(4)); Assert.assertEquals(v4, rs.getBigDecimal(4)); System.out.println(v5); System.out.println(rs.getString(5)); Assert.assertEquals(v5, rs.getByte(5)); System.out.println(v6); System.out.println(rs.getString(6)); Assert.assertEquals(v6, rs.getShort(6)); System.out.println(v7); System.out.println(rs.getString(7)); Assert.assertEquals(v7, rs.getDouble(7), 0.0000000001); System.out.println(v8); System.out.println(rs.getString(8)); Assert.assertEquals(v8, rs.getFloat(8), 0.00001); System.out.println(v9); System.out.println(rs.getString(9)); Assert.assertEquals(v9, rs.getBoolean(9)); System.out.println(v10); System.out.println(rs.getString(10)); Assert.assertEquals(v10.toString(), rs.getDate(10).toString()); System.out.println(v11); System.out.println(rs.getString(11)); Assert.assertEquals(v11.getTime(), rs.getTimestamp(11).getTime()); System.out.println(v12); System.out.println(rs.getString(12)); Assert.assertEquals(new Timestamp(v12.getTime()), rs.getTimestamp(12)); System.out.println(v13); System.out.println(rs.getString(13)); Assert.assertEquals(v13.toString(), rs.getString(13)); Assert.assertEquals(v13, rs.getObject(13)); System.out.println("v14:" + v14); System.out.println("v14 length:" + v14.length()); System.out.println(rs.getString(14)); System.out.println(rs.getString(14).length()); Assert.assertNotEquals(v14.toString(), rs.getString(14)); Assert.assertEquals(v14.toString().trim(), rs.getString(14).trim()); Assert.assertEquals(2, rs.getString(14).length()); System.out.println(v15); System.out.println(rs.getString(15)); Assert.assertEquals(v15.toString(), rs.getString(15)); Assert.assertEquals(v15, rs.getObject(15)); System.out.println(v16); System.out.println(rs.getString(16)); Assert.assertEquals(v16.toString(), rs.getString(16)); Assert.assertEquals(v16, rs.getObject(16)); System.out.println(v17); System.out.println(rs.getString(17)); Assert.assertEquals(v17.toString(), rs.getString(17)); Assert.assertEquals(v17, rs.getObject(17)); System.out.println(v18.getFieldCount()); System.out.println(((SimpleStruct) rs.getObject(18)).getFieldCount()); Assert.assertEquals(v18.getFieldCount(), ((SimpleStruct) rs.getObject(18)).getFieldCount()); List<Object> fields = ((SimpleStruct) rs.getObject(18)).getFieldValues(); for (int i = 0; i < v18.getFieldValues().size(); i++) { System.out.println("index:" + i); System.out.println(v18.getFieldValues().get(i)); System.out.println(fields.get(i)); if (fields.get(i) instanceof Double) { Assert.assertEquals((Double) v18.getFieldValues().get(i), (Double) fields.get(i), 0.0000000001); } else if (fields.get(i) instanceof Float) { Assert.assertEquals((Float) v18.getFieldValues().get(i), (Float) fields.get(i), 0.00001); } else if (fields.get(i) instanceof Map) { Map m1 = (Map) v18.getFieldValues().get(i); Map m2 = new TreeMap((Map) fields.get(i)); Assert.assertNotEquals(m1.toString(), m2.toString()); for (Object k : m1.keySet()) { String v1 = m1.get(k).toString().trim(); String v2 = m2.get(k).toString().trim(); Assert.assertEquals(v1, v2); } } else { Assert.assertEquals(v18.getFieldValues().get(i), fields.get(i)); } } } } private static void uploadData() throws TunnelException, IOException { TableTunnel.UploadSession up = TestManager.getInstance().tunnel.createUploadSession(odps.getDefaultProject(), table); RecordWriter writer = up.openRecordWriter(0); ArrayRecord r = new ArrayRecord(up.getSchema().getColumns().toArray(new Column[0])); v1 = TestUtils.randomInt(); r.setInt(0, v1); v2 = TestUtils.randomLong(); r.setBigint(1, v2); v3 = TestUtils.randomString(); r.setString(2, v3); v4 = new BigDecimal("10.231"); r.setDecimal(3, v4); v5 = TestUtils.randomByte(); r.setTinyint(4, v5); v6 = TestUtils.randomShort(); r.setSmallint(5, v6); v7 = TestUtils.randomDouble(); r.setDouble(6, v7); v8 = TestUtils.randomFloat(); r.setFloat(7, v8); v9 = TestUtils.randomBoolean(); r.setBoolean(8, v9); v11 = TestUtils.randomDate(); v10 = new Date(v11.getTime()); r.setDate(9, v10); r.setDatetime(10, v11); v12 = new Timestamp(v11.getTime()); r.setTimestamp(11, v12); v13 = new Varchar(TestUtils.randomString(1), 1); r.setVarchar(12, v13); v14 = new Char(TestUtils.randomString(1), 2); r.setChar(13, v14); v15 = new Binary(TestUtils.randomBytes()); r.setBinary(14, v15); Integer[] ints = {TestUtils.randomInt(), TestUtils.randomInt(), TestUtils.randomInt()}; v16 = Arrays.asList(ints); r.setArray(15, v16); v17 = new HashMap<Long, String>(); v17.put(TestUtils.randomLong(), TestUtils.randomString()); r.setMap(16, v17); List<Object> values = new ArrayList<Object>(); values.add(TestUtils.randomString()); values.add(TestUtils.randomInt()); Map<Varchar, Char> parents = new TreeMap<Varchar, Char>(); parents.put(new Varchar("papa"), new Char(TestUtils.randomString(10))); parents.put(new Varchar("mama"), new Char(TestUtils.randomString(10))); values.add(parents); values.add(TestUtils.randomFloat()); String[] hobbies = {TestUtils.randomString(), TestUtils.randomString()}; values.add(Arrays.asList(hobbies)); v18 = new SimpleStruct((StructTypeInfo) up.getSchema().getColumn("col18").getTypeInfo(), values); r.setStruct(17, v18); writer.write(r); writer.close(); Long[] blocks = up.getBlockList(); Assert.assertEquals(1, blocks.length); up.commit(new Long[] {0L}); } private static void createTableWithAllNewTypes(Odps odps, String tableName) throws OdpsException, SQLException { TableSchema schema = new TableSchema(); schema.addColumn(new Column("col0", OdpsType.INT)); schema.addColumn(new Column("col1", OdpsType.BIGINT)); schema.addColumn(new Column("col2", OdpsType.STRING)); schema.addColumn(new Column("col3", OdpsType.DECIMAL)); schema.addColumn(new Column("col4", OdpsType.TINYINT)); schema.addColumn(new Column("col5", OdpsType.SMALLINT)); schema.addColumn(new Column("col6", OdpsType.DOUBLE)); schema.addColumn(new Column("col7", OdpsType.FLOAT)); schema.addColumn(new Column("col8", OdpsType.BOOLEAN)); schema.addColumn(new Column("col9", OdpsType.DATE)); schema.addColumn(new Column("col10", OdpsType.DATETIME)); schema.addColumn(new Column("col11", OdpsType.TIMESTAMP)); schema.addColumn(new Column("col13", TypeInfoFactory.getVarcharTypeInfo(2))); schema.addColumn(new Column("col14", TypeInfoFactory.getCharTypeInfo(2))); schema.addColumn(new Column("col15", OdpsType.BINARY)); schema.addColumn(new Column("col16", TypeInfoFactory.getArrayTypeInfo(TypeInfoFactory.INT))); schema.addColumn(new Column("col17", TypeInfoFactory.getMapTypeInfo(TypeInfoFactory.BIGINT, TypeInfoFactory.STRING))); String[] names = {"name", "age", "parents", "salary", "hobbies"}; TypeInfo[] types = { TypeInfoFactory.STRING, TypeInfoFactory.INT, TypeInfoFactory.getMapTypeInfo(TypeInfoFactory.getVarcharTypeInfo(20), TypeInfoFactory.getCharTypeInfo(20)), TypeInfoFactory.FLOAT, TypeInfoFactory.getArrayTypeInfo(TypeInfoFactory.STRING)}; schema.addColumn(new Column("col18", TypeInfoFactory.getStructTypeInfo(Arrays.asList(names), Arrays.asList(types)))); createTableWithHints(odps, tableName, schema); } private static void createTableWithHints(Odps odps, String tableName, TableSchema schema) throws OdpsException, SQLException { String sql = getSQLString(odps.getDefaultProject(), tableName, schema, null, false, null); System.out.println(sql); stmt.execute(sql); } private static String getSQLString(String projectName, String tableName, TableSchema schema, String comment, boolean ifNotExists, Long lifeCycle) { if (projectName == null || tableName == null || schema == null) { throw new IllegalArgumentException(); } StringBuilder sb = new StringBuilder(); sb.append("CREATE TABLE "); if (ifNotExists) { sb.append(" IF NOT EXISTS "); } sb.append(projectName).append(".`").append(tableName).append("` ("); List<Column> columns = schema.getColumns(); for (int i = 0; i < columns.size(); i++) { Column c = columns.get(i); sb.append("`").append(c.getName()).append("` ").append(c.getTypeInfo().getTypeName()); if (c.getComment() != null) { sb.append(" COMMENT '").append(c.getComment()).append("'"); } if (i + 1 < columns.size()) { sb.append(','); } } sb.append(')'); if (comment != null) { sb.append(" COMMENT '" + comment + "' "); } List<Column> pcolumns = schema.getPartitionColumns(); if (pcolumns.size() > 0) { sb.append(" PARTITIONED BY ("); for (int i = 0; i < pcolumns.size(); i++) { Column c = pcolumns.get(i); sb.append(c.getName()).append(" ").append(c.getTypeInfo().getTypeName()); if (c.getComment() != null) { sb.append(" COMMENT '").append(c.getComment()).append("'"); } if (i + 1 < pcolumns.size()) { sb.append(','); } } sb.append(')'); } if (lifeCycle != null) { sb.append(" LIFECYCLE ").append(lifeCycle); } sb.append(';'); return sb.toString(); } }
junchaoWu/aliyun-odps-jdbc
<|start_filename|>test/express_server_test.js<|end_filename|> const http = require('http') const test = require('eater/runner').test const express = require('express') const earlyHints = require('../') const mustCall = require('must-call') const AssertStream = require('assert-stream') const assert = require('assert') const path = require('path') test('as express middleware', () => { const app = express() app.use(earlyHints([ { path: '/style.css', rel: 'preload' }, { path: '/main.js', rel: 'preload', as: 'script' }, { path: '/font.woff', as: 'font' } ])) app.use(express.static(path.join(__dirname, 'public'))) const server = app.listen('0', mustCall(() => { http.get(`http://localhost:${server.address().port}/`, mustCall((res) => { assert.strictEqual(res.statusCode, 103) assert.strictEqual(res.statusMessage, 'Early Hints') assert.deepStrictEqual(res.headers, { link: '</style.css>; rel=preload; , </main.js>; rel=preload; as=script;, </font.woff>; rel=preload; as=font;' }) const assertStream = new AssertStream() assertStream.expect(/<body>Hello<\/body>/) res.connection.pipe(assertStream) server.close() }) ) })) }) <|start_filename|>index.js<|end_filename|> 'use strict' const CRLF = '\r\n' const PRELOAD = 'preload' const linkFormat = (resource) => { if (typeof resource === 'string') { return `Link: <${resource}>; rel=${PRELOAD}${CRLF}` } return `Link: <${resource.path}>; rel=${resource.rel || PRELOAD}; ${resource.as ? `as=${resource.as};` : ''}${CRLF}` } module.exports = (resources) => (_, res, next) => { if (!res) { throw new Error('Response object is not found') } res.connection.write('HTTP/1.1 103 Early Hints' + CRLF) resources.forEach((resource) => { res.connection.write(linkFormat(resource)) }) res.connection.write(CRLF) if (typeof next === 'function') { next() } } <|start_filename|>package.json<|end_filename|> { "name": "early-hints", "version": "0.1.0", "description": "103 Early Hints library to help http2 push", "main": "index.js", "directories": { "test": "test" }, "scripts": { "test": "eater", "lint": "standard" }, "repository": { "type": "git", "url": "git+https://github.com/yosuke-furukawa/early-hints.git" }, "keywords": [ "early", "hints", "http/2", "103", "resource", "hints" ], "author": "yosuke-furukawa", "license": "MIT", "bugs": { "url": "https://github.com/yosuke-furukawa/early-hints/issues" }, "homepage": "https://github.com/yosuke-furukawa/early-hints#readme", "devDependencies": { "assert-stream": "1.1.1", "eater": "4.0.4", "express": "4.17.1", "standard": "15.0.0" } } <|start_filename|>test/basic_http_server_test.js<|end_filename|> const http = require('http') const fs = require('fs') const path = require('path') const earlyHints = require('../') const AssertStream = require('assert-stream') const assert = require('assert') const test = require('eater/runner').test const mustCall = require('must-call') test('return 103 early hints', () => { const server = http.createServer((req, res) => { if (req.url === '/') { earlyHints(['/style.css'])(req, res) } else if (req.url === '/style.css') { res.setHeader('Content-Type', 'text/css') return fs.createReadStream(path.join(__dirname, req.url)).pipe(res) } res.setHeader('Content-Type', 'text/html') fs.createReadStream(path.join(__dirname, '/index.html')).pipe(res) }).listen(0, () => { http.get(`http://localhost:${server.address().port}/`, mustCall((res) => { assert.strictEqual(res.statusCode, 103) assert.strictEqual(res.statusMessage, 'Early Hints') assert.deepStrictEqual(res.headers, { link: '</style.css>; rel=preload' }) const assertStream = new AssertStream() assertStream.expect(/200 OK/) res.connection.pipe(assertStream) server.close() })) }) }) test('return 103 early hints to use path and rel', () => { const server = http.createServer((req, res) => { if (req.url === '/') { earlyHints([ { path: '/style.css', rel: 'preload' }, { path: '/main.js', rel: 'preload', as: 'script' }, { path: '/page.woff', as: 'font' } ])(req, res) } res.setHeader('Content-Type', 'text/html') fs.createReadStream(path.join(__dirname, '/index.html')).pipe(res) }).listen(0, () => { http.get(`http://localhost:${server.address().port}/`, mustCall((res) => { assert.strictEqual(res.statusCode, 103) assert.strictEqual(res.statusMessage, 'Early Hints') assert.deepStrictEqual(res.headers, { link: '</style.css>; rel=preload; , </main.js>; rel=preload; as=script;, </page.woff>; rel=preload; as=font;' }) const assertStream = new AssertStream() assertStream.expect(/200 OK/) res.connection.pipe(assertStream) server.close() })) }) })
yosuke-furukawa/early-hints
<|start_filename|>font/sfnt.go<|end_filename|> package font import ( "encoding/binary" "fmt" "math" "sort" "time" "golang.org/x/text/encoding" "golang.org/x/text/encoding/charmap" "golang.org/x/text/encoding/unicode" "golang.org/x/text/transform" ) // MaxCmapSegments is the maximum number of cmap segments that will be accepted. const MaxCmapSegments = 20000 // Pather is an interface to append a glyph's path to canvas.Path. type Pather interface { MoveTo(float64, float64) LineTo(float64, float64) QuadTo(float64, float64, float64, float64) CubeTo(float64, float64, float64, float64, float64, float64) Close() } // Hinting specifies the type of hinting to use (none supported yes). type Hinting int // see Hinting const ( NoHinting Hinting = iota ) // SFNT is a parsed OpenType font. type SFNT struct { Data []byte Version string IsCFF, IsTrueType bool // only one can be true Tables map[string][]byte // required Cmap *cmapTable Head *headTable Hhea *hheaTable Hmtx *hmtxTable Maxp *maxpTable Name *nameTable OS2 *os2Table Post *postTable // TrueType Glyf *glyfTable Loca *locaTable // CFF CFF *cffTable // optional Kern *kernTable Vhea *vheaTable //Hdmx *hdmxTable // TODO Vmtx *vmtxTable Gpos *gposTable // TODO //Gsub *gsubTable // TODO //Gasp *gaspTable // TODO //Base *baseTable // TODO } // NumGlyphs returns the number of glyphs the font contains. func (sfnt *SFNT) NumGlyphs() uint16 { return sfnt.Maxp.NumGlyphs } // GlyphIndex returns the glyphID for a given rune. func (sfnt *SFNT) GlyphIndex(r rune) uint16 { return sfnt.Cmap.Get(r) } // GlyphName returns the name of the glyph. func (sfnt *SFNT) GlyphName(glyphID uint16) string { return sfnt.Post.Get(glyphID) } // GlyphPath draws the glyph's contour as a path to the pather interface. It will use the specified ppem (pixels-per-EM) for hinting purposes. The path is draws to the (x,y) coordinate and scaled using the given scale factor. func (sfnt *SFNT) GlyphPath(p Pather, glyphID, ppem uint16, x, y int32, scale float64, hinting Hinting) error { if sfnt.IsTrueType { return sfnt.Glyf.ToPath(p, glyphID, ppem, x, y, scale, hinting) } else if sfnt.IsCFF { return sfnt.CFF.ToPath(p, glyphID, ppem, x, y, scale, hinting) } return fmt.Errorf("only TrueType and CFF are supported") } // GlyphAdvance returns the advance width of the glyph. func (sfnt *SFNT) GlyphAdvance(glyphID uint16) uint16 { return sfnt.Hmtx.Advance(glyphID) } // GlyphVerticalAdvance returns the vertical advance width of the glyph. func (sfnt *SFNT) GlyphVerticalAdvance(glyphID uint16) uint16 { if sfnt.Vmtx == nil { return sfnt.Head.UnitsPerEm } return sfnt.Vmtx.Advance(glyphID) } // Kerning returns the kerning between two glyphs, i.e. the advance correction for glyph pairs. func (sfnt *SFNT) Kerning(left, right uint16) int16 { if sfnt.Kern == nil { return 0 } return sfnt.Kern.Get(left, right) } // ParseSFNT parses an OpenType file format (TTF, OTF, TTC). The index is used for font collections to select a single font. func ParseSFNT(b []byte, index int) (*SFNT, error) { if len(b) < 12 || math.MaxUint32 < len(b) { return nil, ErrInvalidFontData } r := NewBinaryReader(b) sfntVersion := r.ReadString(4) isCollection := sfntVersion == "ttcf" if isCollection { majorVersion := r.ReadUint16() minorVersion := r.ReadUint16() if majorVersion != 1 && majorVersion != 2 || minorVersion != 0 { return nil, fmt.Errorf("bad TTC version") } numFonts := r.ReadUint32() if index < 0 || numFonts <= uint32(index) { return nil, fmt.Errorf("bad font index %d", index) } if r.Len() < 4*numFonts { return nil, ErrInvalidFontData } _ = r.ReadBytes(uint32(4 * index)) offset := r.ReadUint32() var length uint32 if uint32(index)+1 == numFonts { length = uint32(len(b)) - offset } else { length = r.ReadUint32() - offset } if uint32(len(b))-8 < offset || uint32(len(b))-8-offset < length { return nil, ErrInvalidFontData } r.Seek(offset) sfntVersion = r.ReadString(4) } else if index != 0 { return nil, fmt.Errorf("bad font index %d", index) } if sfntVersion != "OTTO" && binary.BigEndian.Uint32([]byte(sfntVersion)) != 0x00010000 { return nil, fmt.Errorf("bad SFNT version") } numTables := r.ReadUint16() _ = r.ReadUint16() // searchRange _ = r.ReadUint16() // entrySelector _ = r.ReadUint16() // rangeShift if r.Len() < 16*uint32(numTables) { // can never exceed uint32 as numTables is uint16 return nil, ErrInvalidFontData } tables := make(map[string][]byte, numTables) for i := 0; i < int(numTables); i++ { tag := r.ReadString(4) _ = r.ReadUint32() // checksum offset := r.ReadUint32() length := r.ReadUint32() padding := (4 - length&3) & 3 if uint32(len(b)) <= offset || uint32(len(b))-offset < length || uint32(len(b))-offset-length < padding { return nil, ErrInvalidFontData } if tag == "head" { if length < 12 { return nil, ErrInvalidFontData } // to check checksum for head table, replace the overal checksum with zero and reset it at the end //checksumAdjustment := binary.BigEndian.Uint32(b[offset+8:]) //binary.BigEndian.PutUint32(b[offset+8:], 0x00000000) //if calcChecksum(b[offset:offset+length+padding]) != checksum { // return nil, fmt.Errorf("%s: bad checksum", tag) //} //binary.BigEndian.PutUint32(b[offset+8:], checksumAdjustment) //} else if calcChecksum(b[offset:offset+length+padding]) != checksum { // return nil, fmt.Errorf("%s: bad checksum", tag) } tables[tag] = b[offset : offset+length : offset+length] } // TODO: check file checksum sfnt := &SFNT{} sfnt.Data = b sfnt.Version = sfntVersion sfnt.IsCFF = sfntVersion == "OTTO" sfnt.IsTrueType = binary.BigEndian.Uint32([]byte(sfntVersion)) == 0x00010000 sfnt.Tables = tables if isCollection { sfnt.Data = sfnt.Write() } requiredTables := []string{"cmap", "head", "hhea", "hmtx", "maxp", "name", "OS/2", "post"} if sfnt.IsTrueType { requiredTables = append(requiredTables, "glyf", "loca") } for _, requiredTable := range requiredTables { if _, ok := tables[requiredTable]; !ok { return nil, fmt.Errorf("%s: missing table", requiredTable) } } if sfnt.IsCFF { _, hasCFF := tables["CFF "] _, hasCFF2 := tables["CFF2"] if !hasCFF && !hasCFF2 { return nil, fmt.Errorf("CFF: missing table") } else if hasCFF && hasCFF2 { return nil, fmt.Errorf("CFF2: CFF table already exists") } } // maxp and hhea tables are required for other tables to be parse first if err := sfnt.parseHead(); err != nil { return nil, err } else if err := sfnt.parseMaxp(); err != nil { return nil, err } else if err := sfnt.parseHhea(); err != nil { return nil, err } if sfnt.IsTrueType { if err := sfnt.parseLoca(); err != nil { return nil, err } } tableNames := make([]string, len(tables)) for tableName := range tables { tableNames = append(tableNames, tableName) } sort.Strings(tableNames) for _, tableName := range tableNames { var err error switch tableName { case "CFF ": err = sfnt.parseCFF() case "CFF2": err = sfnt.parseCFF2() case "cmap": err = sfnt.parseCmap() case "glyf": err = sfnt.parseGlyf() case "GPOS": err = sfnt.parseGPOS() case "hmtx": err = sfnt.parseHmtx() case "kern": err = sfnt.parseKern() case "name": err = sfnt.parseName() case "OS/2": err = sfnt.parseOS2() case "post": err = sfnt.parsePost() case "vhea": err = sfnt.parseVhea() case "vmtx": err = sfnt.parseVmtx() } if err != nil { return nil, err } } if sfnt.OS2.Version <= 1 { sfnt.estimateOS2() } return sfnt, nil } //////////////////////////////////////////////////////////////// type cmapFormat0 struct { GlyphIdArray [256]uint8 UnicodeMap map[uint16]rune } func (subtable *cmapFormat0) Get(r rune) (uint16, bool) { if r < 0 || 256 <= r { return 0, false } return uint16(subtable.GlyphIdArray[r]), true } func (subtable *cmapFormat0) ToUnicode(glyphID uint16) (rune, bool) { if 256 <= glyphID { return 0, false } else if subtable.UnicodeMap == nil { subtable.UnicodeMap = make(map[uint16]rune, 256) for r, id := range subtable.GlyphIdArray { subtable.UnicodeMap[uint16(id)] = rune(r) } } r, ok := subtable.UnicodeMap[glyphID] return r, ok } type cmapFormat4 struct { StartCode []uint16 EndCode []uint16 IdDelta []int16 IdRangeOffset []uint16 GlyphIdArray []uint16 UnicodeMap map[uint16]rune } func (subtable *cmapFormat4) Get(r rune) (uint16, bool) { if r < 0 || 65536 <= r { return 0, false } n := len(subtable.StartCode) for i := 0; i < n; i++ { if uint16(r) <= subtable.EndCode[i] && subtable.StartCode[i] <= uint16(r) { if subtable.IdRangeOffset[i] == 0 { // is modulo 65536 with the idDelta cast and addition overflow return uint16(subtable.IdDelta[i]) + uint16(r), true } // idRangeOffset/2 -> offset value to index of words // r-startCode -> difference of rune with startCode // -(n-1) -> subtract offset from the current idRangeOffset item index := int(subtable.IdRangeOffset[i]/2) + int(uint16(r)-subtable.StartCode[i]) - (n - i) return subtable.GlyphIdArray[index], true // index is always valid } } return 0, false } func (subtable *cmapFormat4) ToUnicode(glyphID uint16) (rune, bool) { if subtable.UnicodeMap == nil { subtable.UnicodeMap = map[uint16]rune{} n := len(subtable.StartCode) for i := 0; i < n; i++ { for r := subtable.StartCode[i]; r < subtable.EndCode[i]; r++ { var id uint16 if subtable.IdRangeOffset[i] == 0 { // is modulo 65536 with the idDelta cast and addition overflow id = uint16(subtable.IdDelta[i]) + r } else { // idRangeOffset/2 -> offset value to index of words // r-startCode -> difference of rune with startCode // -(n-1) -> subtract offset from the current idRangeOffset item index := int(subtable.IdRangeOffset[i]/2) + int(r-subtable.StartCode[i]) - (n - i) id = subtable.GlyphIdArray[index] } subtable.UnicodeMap[id] = rune(r) } } } r, ok := subtable.UnicodeMap[glyphID] return r, ok } type cmapFormat6 struct { FirstCode uint16 GlyphIdArray []uint16 } func (subtable *cmapFormat6) Get(r rune) (uint16, bool) { if r < int32(subtable.FirstCode) || uint32(len(subtable.GlyphIdArray)) <= uint32(r)-uint32(subtable.FirstCode) { return 0, false } return subtable.GlyphIdArray[uint32(r)-uint32(subtable.FirstCode)], true } func (subtable *cmapFormat6) ToUnicode(glyphID uint16) (rune, bool) { for i, id := range subtable.GlyphIdArray { if id == glyphID { return rune(subtable.FirstCode) + rune(i), true } } return 0, false } type cmapFormat12 struct { StartCharCode []uint32 EndCharCode []uint32 StartGlyphID []uint32 UnicodeMap map[uint16]rune } func (subtable *cmapFormat12) Get(r rune) (uint16, bool) { if r < 0 { return 0, false } for i := 0; i < len(subtable.StartCharCode); i++ { if uint32(r) <= subtable.EndCharCode[i] && subtable.StartCharCode[i] <= uint32(r) { return uint16((uint32(r) - subtable.StartCharCode[i]) + subtable.StartGlyphID[i]), true } } return 0, false } func (subtable *cmapFormat12) ToUnicode(glyphID uint16) (rune, bool) { if subtable.UnicodeMap == nil { subtable.UnicodeMap = map[uint16]rune{} for i := 0; i < len(subtable.StartCharCode); i++ { for r := subtable.StartCharCode[i]; r < subtable.EndCharCode[i]; r++ { id := uint16((uint32(r) - subtable.StartCharCode[i]) + subtable.StartGlyphID[i]) subtable.UnicodeMap[id] = rune(r) } } } r, ok := subtable.UnicodeMap[glyphID] return r, ok } type cmapEncodingRecord struct { PlatformID uint16 EncodingID uint16 Format uint16 Subtable uint16 } type cmapSubtable interface { Get(rune) (uint16, bool) ToUnicode(uint16) (rune, bool) } type cmapTable struct { EncodingRecords []cmapEncodingRecord Subtables []cmapSubtable } func (cmap *cmapTable) Get(r rune) uint16 { for _, subtable := range cmap.Subtables { if glyphID, ok := subtable.Get(r); ok { return glyphID } } return 0 } func (cmap *cmapTable) ToUnicode(glyphID uint16) rune { for _, subtable := range cmap.Subtables { if r, ok := subtable.ToUnicode(glyphID); ok { return r } } return 0 } func (sfnt *SFNT) parseCmap() error { // requires data from maxp b, ok := sfnt.Tables["cmap"] if !ok { return fmt.Errorf("cmap: missing table") } else if len(b) < 4 { return fmt.Errorf("cmap: bad table") } sfnt.Cmap = &cmapTable{} r := NewBinaryReader(b) if r.ReadUint16() != 0 { return fmt.Errorf("cmap: bad version") } numTables := r.ReadUint16() if uint32(len(b)) < 4+8*uint32(numTables) { return fmt.Errorf("cmap: bad table") } // find and extract subtables and make sure they don't overlap each other offsets, lengths := []uint32{0}, []uint32{4 + 8*uint32(numTables)} for j := 0; j < int(numTables); j++ { platformID := r.ReadUint16() encodingID := r.ReadUint16() subtableID := -1 offset := r.ReadUint32() if uint32(len(b))-8 < offset { // subtable must be at least 8 bytes long to extract length return fmt.Errorf("cmap: bad subtable %d", j) } for i := 0; i < len(offsets); i++ { if offsets[i] < offset && offset < lengths[i] { return fmt.Errorf("cmap: bad subtable %d", j) } } // extract subtable length rs := NewBinaryReader(b[offset:]) format := rs.ReadUint16() var length uint32 if format == 0 || format == 2 || format == 4 || format == 6 { length = uint32(rs.ReadUint16()) } else if format == 8 || format == 10 || format == 12 || format == 13 { _ = rs.ReadUint16() // reserved length = rs.ReadUint32() } else if format == 14 { length = rs.ReadUint32() } else { return fmt.Errorf("cmap: bad format %d for subtable %d", format, j) } if length < 8 || math.MaxUint32-offset < length { return fmt.Errorf("cmap: bad subtable %d", j) } for i := 0; i < len(offsets); i++ { if offset == offsets[i] && length == lengths[i] { subtableID = int(i) break } else if offset <= offsets[i] && offsets[i] < offset+length { return fmt.Errorf("cmap: bad subtable %d", j) } } rs.buf = rs.buf[:length:length] if subtableID == -1 { subtableID = len(sfnt.Cmap.Subtables) offsets = append(offsets, offset) lengths = append(lengths, length) switch format { case 0: if rs.Len() != 258 { return fmt.Errorf("cmap: bad subtable %d", j) } _ = rs.ReadUint16() // languageID subtable := &cmapFormat0{} copy(subtable.GlyphIdArray[:], rs.ReadBytes(256)) for _, glyphID := range subtable.GlyphIdArray { if sfnt.Maxp.NumGlyphs <= uint16(glyphID) { return fmt.Errorf("cmap: bad glyphID in subtable %d", j) } } sfnt.Cmap.Subtables = append(sfnt.Cmap.Subtables, subtable) case 4: if rs.Len() < 10 { return fmt.Errorf("cmap: bad subtable %d", j) } _ = rs.ReadUint16() // languageID segCount := rs.ReadUint16() if segCount%2 != 0 || segCount == 0 { return fmt.Errorf("cmap: bad segCount in subtable %d", j) } segCount /= 2 if MaxCmapSegments < segCount { return fmt.Errorf("cmap: too many segments in subtable %d", j) } _ = rs.ReadUint16() // searchRange _ = rs.ReadUint16() // entrySelector _ = rs.ReadUint16() // rangeShift subtable := &cmapFormat4{} if rs.Len() < 2+8*uint32(segCount) { return fmt.Errorf("cmap: bad subtable %d", j) } subtable.EndCode = make([]uint16, segCount) for i := 0; i < int(segCount); i++ { endCode := rs.ReadUint16() if 0 < i && endCode <= subtable.EndCode[i-1] { return fmt.Errorf("cmap: bad endCode in subtable %d", j) } subtable.EndCode[i] = endCode } _ = rs.ReadUint16() // reservedPad subtable.StartCode = make([]uint16, segCount) for i := 0; i < int(segCount); i++ { startCode := rs.ReadUint16() if subtable.EndCode[i] < startCode || 0 < i && startCode <= subtable.EndCode[i-1] { return fmt.Errorf("cmap: bad startCode in subtable %d", j) } subtable.StartCode[i] = startCode } if subtable.StartCode[segCount-1] != 0xFFFF || subtable.EndCode[segCount-1] != 0xFFFF { return fmt.Errorf("cmap: bad last startCode or endCode in subtable %d", j) } subtable.IdDelta = make([]int16, segCount) for i := 0; i < int(segCount-1); i++ { subtable.IdDelta[i] = rs.ReadInt16() } _ = rs.ReadUint16() // last value may be invalid subtable.IdDelta[segCount-1] = 1 glyphIdArrayLength := rs.Len() - 2*uint32(segCount) if glyphIdArrayLength%2 != 0 { return fmt.Errorf("cmap: bad subtable %d", j) } glyphIdArrayLength /= 2 subtable.IdRangeOffset = make([]uint16, segCount) for i := 0; i < int(segCount-1); i++ { idRangeOffset := rs.ReadUint16() if idRangeOffset%2 != 0 { return fmt.Errorf("cmap: bad idRangeOffset in subtable %d", j) } else if idRangeOffset != 0 { index := int(idRangeOffset/2) + int(subtable.EndCode[i]-subtable.StartCode[i]) - (int(segCount) - i) if index < 0 || glyphIdArrayLength <= uint32(index) { return fmt.Errorf("cmap: bad idRangeOffset in subtable %d", j) } } subtable.IdRangeOffset[i] = idRangeOffset } _ = rs.ReadUint16() // last value may be invalid subtable.IdRangeOffset[segCount-1] = 0 subtable.GlyphIdArray = make([]uint16, glyphIdArrayLength) for i := 0; i < int(glyphIdArrayLength); i++ { glyphID := rs.ReadUint16() if sfnt.Maxp.NumGlyphs <= glyphID { return fmt.Errorf("cmap: bad glyphID in subtable %d", j) } subtable.GlyphIdArray[i] = glyphID } sfnt.Cmap.Subtables = append(sfnt.Cmap.Subtables, subtable) case 6: if rs.Len() < 6 { return fmt.Errorf("cmap: bad subtable %d", j) } _ = rs.ReadUint16() // language subtable := &cmapFormat6{} subtable.FirstCode = rs.ReadUint16() entryCount := rs.ReadUint16() if rs.Len() < 2*uint32(entryCount) { return fmt.Errorf("cmap: bad subtable %d", j) } subtable.GlyphIdArray = make([]uint16, entryCount) for i := 0; i < int(entryCount); i++ { subtable.GlyphIdArray[i] = rs.ReadUint16() } sfnt.Cmap.Subtables = append(sfnt.Cmap.Subtables, subtable) case 12: if rs.Len() < 8 { return fmt.Errorf("cmap: bad subtable %d", j) } _ = rs.ReadUint32() // language numGroups := rs.ReadUint32() if MaxCmapSegments < numGroups { return fmt.Errorf("cmap: too many segments in subtable %d", j) } else if rs.Len() < 12*numGroups { return fmt.Errorf("cmap: bad subtable %d", j) } subtable := &cmapFormat12{} subtable.StartCharCode = make([]uint32, numGroups) subtable.EndCharCode = make([]uint32, numGroups) subtable.StartGlyphID = make([]uint32, numGroups) for i := 0; i < int(numGroups); i++ { startCharCode := rs.ReadUint32() endCharCode := rs.ReadUint32() startGlyphID := rs.ReadUint32() if endCharCode < startCharCode || 0 < i && startCharCode <= subtable.EndCharCode[i-1] { return fmt.Errorf("cmap: bad character code range in subtable %d", j) } else if uint32(sfnt.Maxp.NumGlyphs) <= endCharCode-startCharCode || uint32(sfnt.Maxp.NumGlyphs)-(endCharCode-startCharCode) <= startGlyphID { return fmt.Errorf("cmap: bad glyphID in subtable %d", j) } subtable.StartCharCode[i] = startCharCode subtable.EndCharCode[i] = endCharCode subtable.StartGlyphID[i] = startGlyphID } sfnt.Cmap.Subtables = append(sfnt.Cmap.Subtables, subtable) } } sfnt.Cmap.EncodingRecords = append(sfnt.Cmap.EncodingRecords, cmapEncodingRecord{ PlatformID: platformID, EncodingID: encodingID, Format: format, Subtable: uint16(subtableID), }) } return nil } //////////////////////////////////////////////////////////////// type headTable struct { FontRevision uint32 Flags [16]bool UnitsPerEm uint16 Created, Modified time.Time XMin, YMin, XMax, YMax int16 MacStyle [16]bool LowestRecPPEM uint16 FontDirectionHint int16 IndexToLocFormat int16 GlyphDataFormat int16 } func (sfnt *SFNT) parseHead() error { b, ok := sfnt.Tables["head"] if !ok { return fmt.Errorf("head: missing table") } else if len(b) != 54 { return fmt.Errorf("head: bad table") } sfnt.Head = &headTable{} r := NewBinaryReader(b) majorVersion := r.ReadUint16() minorVersion := r.ReadUint16() if majorVersion != 1 && minorVersion != 0 { return fmt.Errorf("head: bad version") } sfnt.Head.FontRevision = r.ReadUint32() _ = r.ReadUint32() // checksumAdjustment if r.ReadUint32() != 0x5F0F3CF5 { // magicNumber return fmt.Errorf("head: bad magic version") } sfnt.Head.Flags = Uint16ToFlags(r.ReadUint16()) sfnt.Head.UnitsPerEm = r.ReadUint16() created := r.ReadUint64() modified := r.ReadUint64() if math.MaxInt64 < created || math.MaxInt64 < modified { return fmt.Errorf("head: created and/or modified dates too large") } sfnt.Head.Created = time.Date(1904, 1, 1, 0, 0, 0, 0, time.UTC).Add(time.Second * time.Duration(created)) sfnt.Head.Modified = time.Date(1904, 1, 1, 0, 0, 0, 0, time.UTC).Add(time.Second * time.Duration(modified)) sfnt.Head.XMin = r.ReadInt16() sfnt.Head.YMin = r.ReadInt16() sfnt.Head.XMax = r.ReadInt16() sfnt.Head.YMax = r.ReadInt16() sfnt.Head.MacStyle = Uint16ToFlags(r.ReadUint16()) sfnt.Head.LowestRecPPEM = r.ReadUint16() sfnt.Head.FontDirectionHint = r.ReadInt16() sfnt.Head.IndexToLocFormat = r.ReadInt16() if sfnt.Head.IndexToLocFormat != 0 && sfnt.Head.IndexToLocFormat != 1 { return fmt.Errorf("head: bad indexToLocFormat") } sfnt.Head.GlyphDataFormat = r.ReadInt16() return nil } //////////////////////////////////////////////////////////////// type hheaTable struct { Ascender int16 Descender int16 LineGap int16 AdvanceWidthMax uint16 MinLeftSideBearing int16 MinRightSideBearing int16 XMaxExtent int16 CaretSlopeRise int16 CaretSlopeRun int16 CaretOffset int16 MetricDataFormat int16 NumberOfHMetrics uint16 } func (sfnt *SFNT) parseHhea() error { // requires data from maxp b, ok := sfnt.Tables["hhea"] if !ok { return fmt.Errorf("hhea: missing table") } else if len(b) != 36 { return fmt.Errorf("hhea: bad table") } sfnt.Hhea = &hheaTable{} r := NewBinaryReader(b) majorVersion := r.ReadUint16() minorVersion := r.ReadUint16() if majorVersion != 1 && minorVersion != 0 { return fmt.Errorf("hhea: bad version") } sfnt.Hhea.Ascender = r.ReadInt16() sfnt.Hhea.Descender = r.ReadInt16() sfnt.Hhea.LineGap = r.ReadInt16() sfnt.Hhea.AdvanceWidthMax = r.ReadUint16() sfnt.Hhea.MinLeftSideBearing = r.ReadInt16() sfnt.Hhea.MinRightSideBearing = r.ReadInt16() sfnt.Hhea.XMaxExtent = r.ReadInt16() sfnt.Hhea.CaretSlopeRise = r.ReadInt16() sfnt.Hhea.CaretSlopeRun = r.ReadInt16() sfnt.Hhea.CaretOffset = r.ReadInt16() _ = r.ReadInt16() // reserved _ = r.ReadInt16() // reserved _ = r.ReadInt16() // reserved _ = r.ReadInt16() // reserved sfnt.Hhea.MetricDataFormat = r.ReadInt16() sfnt.Hhea.NumberOfHMetrics = r.ReadUint16() if sfnt.Maxp.NumGlyphs < sfnt.Hhea.NumberOfHMetrics || sfnt.Hhea.NumberOfHMetrics == 0 { return fmt.Errorf("hhea: bad numberOfHMetrics") } return nil } //////////////////////////////////////////////////////////////// type vheaTable struct { Ascent int16 Descent int16 LineGap int16 AdvanceHeightMax int16 MinTopSideBearing int16 MinBottomSideBearing int16 YMaxExtent int16 CaretSlopeRise int16 CaretSlopeRun int16 CaretOffset int16 MetricDataFormat int16 NumberOfVMetrics uint16 } func (sfnt *SFNT) parseVhea() error { // requires data from maxp b, ok := sfnt.Tables["vhea"] if !ok { return fmt.Errorf("vhea: missing table") } else if len(b) != 36 { return fmt.Errorf("vhea: bad table") } sfnt.Vhea = &vheaTable{} r := NewBinaryReader(b) majorVersion := r.ReadUint16() minorVersion := r.ReadUint16() if majorVersion != 1 && minorVersion != 0 && minorVersion != 1 { return fmt.Errorf("vhea: bad version") } sfnt.Vhea.Ascent = r.ReadInt16() sfnt.Vhea.Descent = r.ReadInt16() sfnt.Vhea.LineGap = r.ReadInt16() sfnt.Vhea.AdvanceHeightMax = r.ReadInt16() sfnt.Vhea.MinTopSideBearing = r.ReadInt16() sfnt.Vhea.MinBottomSideBearing = r.ReadInt16() sfnt.Vhea.YMaxExtent = r.ReadInt16() sfnt.Vhea.CaretSlopeRise = r.ReadInt16() sfnt.Vhea.CaretSlopeRun = r.ReadInt16() sfnt.Vhea.CaretOffset = r.ReadInt16() _ = r.ReadInt16() // reserved _ = r.ReadInt16() // reserved _ = r.ReadInt16() // reserved _ = r.ReadInt16() // reserved sfnt.Vhea.MetricDataFormat = r.ReadInt16() sfnt.Vhea.NumberOfVMetrics = r.ReadUint16() if sfnt.Maxp.NumGlyphs < sfnt.Vhea.NumberOfVMetrics || sfnt.Vhea.NumberOfVMetrics == 0 { return fmt.Errorf("vhea: bad numberOfVMetrics") } return nil } //////////////////////////////////////////////////////////////// type hmtxLongHorMetric struct { AdvanceWidth uint16 LeftSideBearing int16 } type hmtxTable struct { HMetrics []hmtxLongHorMetric LeftSideBearings []int16 } func (hmtx *hmtxTable) LeftSideBearing(glyphID uint16) int16 { if uint16(len(hmtx.HMetrics)) <= glyphID { return hmtx.LeftSideBearings[glyphID-uint16(len(hmtx.HMetrics))] } return hmtx.HMetrics[glyphID].LeftSideBearing } func (hmtx *hmtxTable) Advance(glyphID uint16) uint16 { if uint16(len(hmtx.HMetrics)) <= glyphID { glyphID = uint16(len(hmtx.HMetrics)) - 1 } return hmtx.HMetrics[glyphID].AdvanceWidth } func (sfnt *SFNT) parseHmtx() error { // requires data from hhea and maxp b, ok := sfnt.Tables["hmtx"] length := 4*uint32(sfnt.Hhea.NumberOfHMetrics) + 2*uint32(sfnt.Maxp.NumGlyphs-sfnt.Hhea.NumberOfHMetrics) if !ok { return fmt.Errorf("hmtx: missing table") } else if uint32(len(b)) != length { return fmt.Errorf("hmtx: bad table") } sfnt.Hmtx = &hmtxTable{} // numberOfHMetrics is smaller than numGlyphs sfnt.Hmtx.HMetrics = make([]hmtxLongHorMetric, sfnt.Hhea.NumberOfHMetrics) sfnt.Hmtx.LeftSideBearings = make([]int16, sfnt.Maxp.NumGlyphs-sfnt.Hhea.NumberOfHMetrics) r := NewBinaryReader(b) for i := 0; i < int(sfnt.Hhea.NumberOfHMetrics); i++ { sfnt.Hmtx.HMetrics[i].AdvanceWidth = r.ReadUint16() sfnt.Hmtx.HMetrics[i].LeftSideBearing = r.ReadInt16() } for i := 0; i < int(sfnt.Maxp.NumGlyphs-sfnt.Hhea.NumberOfHMetrics); i++ { sfnt.Hmtx.LeftSideBearings[i] = r.ReadInt16() } return nil } //////////////////////////////////////////////////////////////// type vmtxLongVerMetric struct { AdvanceHeight uint16 TopSideBearing int16 } type vmtxTable struct { VMetrics []vmtxLongVerMetric TopSideBearings []int16 } func (vmtx *vmtxTable) TopSideBearing(glyphID uint16) int16 { if uint16(len(vmtx.VMetrics)) <= glyphID { return vmtx.TopSideBearings[glyphID-uint16(len(vmtx.VMetrics))] } return vmtx.VMetrics[glyphID].TopSideBearing } func (vmtx *vmtxTable) Advance(glyphID uint16) uint16 { if uint16(len(vmtx.VMetrics)) <= glyphID { glyphID = uint16(len(vmtx.VMetrics)) - 1 } return vmtx.VMetrics[glyphID].AdvanceHeight } func (sfnt *SFNT) parseVmtx() error { // requires data from vhea and maxp if sfnt.Vhea == nil { return fmt.Errorf("vhea: missing table") } b, ok := sfnt.Tables["vmtx"] length := 4*uint32(sfnt.Vhea.NumberOfVMetrics) + 2*uint32(sfnt.Maxp.NumGlyphs-sfnt.Vhea.NumberOfVMetrics) if !ok { return fmt.Errorf("vmtx: missing table") } else if uint32(len(b)) != length { return fmt.Errorf("vmtx: bad table") } sfnt.Vmtx = &vmtxTable{} // numberOfVMetrics is smaller than numGlyphs sfnt.Vmtx.VMetrics = make([]vmtxLongVerMetric, sfnt.Vhea.NumberOfVMetrics) sfnt.Vmtx.TopSideBearings = make([]int16, sfnt.Maxp.NumGlyphs-sfnt.Vhea.NumberOfVMetrics) r := NewBinaryReader(b) for i := 0; i < int(sfnt.Vhea.NumberOfVMetrics); i++ { sfnt.Vmtx.VMetrics[i].AdvanceHeight = r.ReadUint16() sfnt.Vmtx.VMetrics[i].TopSideBearing = r.ReadInt16() } for i := 0; i < int(sfnt.Maxp.NumGlyphs-sfnt.Vhea.NumberOfVMetrics); i++ { sfnt.Vmtx.TopSideBearings[i] = r.ReadInt16() } return nil } //////////////////////////////////////////////////////////////// type kernPair struct { Key uint32 Value int16 } type kernFormat0 struct { Coverage [8]bool Pairs []kernPair } func (subtable *kernFormat0) Get(l, r uint16) int16 { key := uint32(l)<<16 | uint32(r) lo, hi := 0, len(subtable.Pairs) for lo < hi { mid := (lo + hi) / 2 // can be rounded down if odd pair := subtable.Pairs[mid] if pair.Key < key { lo = mid + 1 } else if key < pair.Key { hi = mid } else { return pair.Value } } return 0 } type kernTable struct { Subtables []kernFormat0 } func (kern *kernTable) Get(l, r uint16) (k int16) { for _, subtable := range kern.Subtables { if !subtable.Coverage[1] { // kerning values k += subtable.Get(l, r) } else if min := subtable.Get(l, r); k < min { // minimum values (usually last subtable) k = min // TODO: test minimal kerning } } return } func (sfnt *SFNT) parseKern() error { b, ok := sfnt.Tables["kern"] if !ok { return fmt.Errorf("kern: missing table") } else if len(b) < 4 { return fmt.Errorf("kern: bad table") } r := NewBinaryReader(b) majorVersion := r.ReadUint16() if majorVersion != 0 && majorVersion != 1 { return fmt.Errorf("kern: bad version %d", majorVersion) } var nTables uint32 if majorVersion == 0 { nTables = uint32(r.ReadUint16()) } else if majorVersion == 1 { minorVersion := r.ReadUint16() if minorVersion != 0 { return fmt.Errorf("kern: bad minor version %d", minorVersion) } nTables = r.ReadUint32() } sfnt.Kern = &kernTable{} for j := 0; j < int(nTables); j++ { if r.Len() < 6 { return fmt.Errorf("kern: bad subtable %d", j) } subtable := kernFormat0{} startPos := r.Pos() subtableVersion := r.ReadUint16() if subtableVersion != 0 { // TODO: supported other kern subtable versions continue } length := r.ReadUint16() format := r.ReadUint8() subtable.Coverage = Uint8ToFlags(r.ReadUint8()) if format != 0 { // TODO: supported other kern subtable formats continue } if r.Len() < 8 { return fmt.Errorf("kern: bad subtable %d", j) } nPairs := r.ReadUint16() _ = r.ReadUint16() // searchRange _ = r.ReadUint16() // entrySelector _ = r.ReadUint16() // rangeShift if uint32(length) < 14+6*uint32(nPairs) { return fmt.Errorf("kern: bad length for subtable %d", j) } subtable.Pairs = make([]kernPair, nPairs) for i := 0; i < int(nPairs); i++ { subtable.Pairs[i].Key = r.ReadUint32() subtable.Pairs[i].Value = r.ReadInt16() if 0 < i && subtable.Pairs[i].Key <= subtable.Pairs[i-1].Key { return fmt.Errorf("kern: bad left right pair for subtable %d", j) } } // read unread bytes if length is bigger _ = r.ReadBytes(uint32(length) - (r.Pos() - startPos)) sfnt.Kern.Subtables = append(sfnt.Kern.Subtables, subtable) } return nil } //////////////////////////////////////////////////////////////// type maxpTable struct { NumGlyphs uint16 MaxPoints uint16 MaxContours uint16 MaxCompositePoints uint16 MaxCompositeContours uint16 MaxZones uint16 MaxTwilightPoints uint16 MaxStorage uint16 MaxFunctionDefs uint16 MaxInstructionDefs uint16 MaxStackElements uint16 MaxSizeOfInstructions uint16 MaxComponentElements uint16 MaxComponentDepth uint16 } func (sfnt *SFNT) parseMaxp() error { b, ok := sfnt.Tables["maxp"] if !ok { return fmt.Errorf("maxp: missing table") } sfnt.Maxp = &maxpTable{} r := NewBinaryReader(b) version := r.ReadBytes(4) sfnt.Maxp.NumGlyphs = r.ReadUint16() if binary.BigEndian.Uint32(version) == 0x00005000 && !sfnt.IsTrueType && len(b) == 6 { return nil } else if binary.BigEndian.Uint32(version) == 0x00010000 && !sfnt.IsCFF && len(b) == 32 { sfnt.Maxp.MaxPoints = r.ReadUint16() sfnt.Maxp.MaxContours = r.ReadUint16() sfnt.Maxp.MaxCompositePoints = r.ReadUint16() sfnt.Maxp.MaxCompositeContours = r.ReadUint16() sfnt.Maxp.MaxZones = r.ReadUint16() sfnt.Maxp.MaxTwilightPoints = r.ReadUint16() sfnt.Maxp.MaxStorage = r.ReadUint16() sfnt.Maxp.MaxFunctionDefs = r.ReadUint16() sfnt.Maxp.MaxInstructionDefs = r.ReadUint16() sfnt.Maxp.MaxStackElements = r.ReadUint16() sfnt.Maxp.MaxSizeOfInstructions = r.ReadUint16() sfnt.Maxp.MaxComponentElements = r.ReadUint16() sfnt.Maxp.MaxComponentDepth = r.ReadUint16() return nil } return fmt.Errorf("maxp: bad table") } //////////////////////////////////////////////////////////////// type nameRecord struct { Platform PlatformID Encoding EncodingID Language uint16 Name NameID Value []byte } func (record nameRecord) String() string { var decoder *encoding.Decoder if record.Platform == PlatformUnicode || record.Platform == PlatformWindows { decoder = unicode.UTF16(unicode.BigEndian, unicode.IgnoreBOM).NewDecoder() } else if record.Platform == PlatformMacintosh && record.Encoding == EncodingMacintoshRoman { decoder = charmap.Macintosh.NewDecoder() } s, _, err := transform.String(decoder, string(record.Value)) if err == nil { return s } return string(record.Value) } type nameLangTagRecord struct { Value []byte } func (record nameLangTagRecord) String() string { decoder := unicode.UTF16(unicode.BigEndian, unicode.IgnoreBOM).NewDecoder() s, _, err := transform.String(decoder, string(record.Value)) if err == nil { return s } return string(record.Value) } type nameTable struct { NameRecord []nameRecord LangTag []nameLangTagRecord } func (t *nameTable) Get(name NameID) []nameRecord { records := []nameRecord{} for _, record := range t.NameRecord { if record.Name == name { records = append(records, record) } } return records } func (sfnt *SFNT) parseName() error { b, ok := sfnt.Tables["name"] if !ok { return fmt.Errorf("name: missing table") } else if len(b) < 6 { return fmt.Errorf("name: bad table") } sfnt.Name = &nameTable{} r := NewBinaryReader(b) version := r.ReadUint16() if version != 0 && version != 1 { return fmt.Errorf("name: bad version") } count := r.ReadUint16() storageOffset := r.ReadUint16() if uint32(len(b)) < 6+12*uint32(count) || uint16(len(b)) < storageOffset { return fmt.Errorf("name: bad table") } sfnt.Name.NameRecord = make([]nameRecord, count) for i := 0; i < int(count); i++ { sfnt.Name.NameRecord[i].Platform = PlatformID(r.ReadUint16()) sfnt.Name.NameRecord[i].Encoding = EncodingID(r.ReadUint16()) sfnt.Name.NameRecord[i].Language = r.ReadUint16() sfnt.Name.NameRecord[i].Name = NameID(r.ReadUint16()) length := r.ReadUint16() offset := r.ReadUint16() if uint16(len(b))-storageOffset < offset || uint16(len(b))-storageOffset-offset < length { return fmt.Errorf("name: bad table") } sfnt.Name.NameRecord[i].Value = b[storageOffset+offset : storageOffset+offset+length] } if version == 1 { if uint32(len(b)) < 6+12*uint32(count)+2 { return fmt.Errorf("name: bad table") } langTagCount := r.ReadUint16() if uint32(len(b)) < 6+12*uint32(count)+2+4*uint32(langTagCount) { return fmt.Errorf("name: bad table") } sfnt.Name.LangTag = make([]nameLangTagRecord, langTagCount) for i := 0; i < int(langTagCount); i++ { length := r.ReadUint16() offset := r.ReadUint16() if uint16(len(b))-storageOffset < offset || uint16(len(b))-storageOffset-offset < length { return fmt.Errorf("name: bad table") } sfnt.Name.LangTag[i].Value = b[storageOffset+offset : storageOffset+offset+length] } } if r.Pos() != uint32(storageOffset) { return fmt.Errorf("name: bad storageOffset") } return nil } //////////////////////////////////////////////////////////////// type os2Table struct { Version uint16 XAvgCharWidth int16 UsWeightClass uint16 UsWidthClass uint16 FsType uint16 YSubscriptXSize int16 YSubscriptYSize int16 YSubscriptXOffset int16 YSubscriptYOffset int16 YSuperscriptXSize int16 YSuperscriptYSize int16 YSuperscriptXOffset int16 YSuperscriptYOffset int16 YStrikeoutSize int16 YStrikeoutPosition int16 SFamilyClass int16 BFamilyType uint8 BSerifStyle uint8 BWeight uint8 BProportion uint8 BContrast uint8 BStrokeVariation uint8 BArmStyle uint8 BLetterform uint8 BMidline uint8 BXHeight uint8 UlUnicodeRange1 uint32 UlUnicodeRange2 uint32 UlUnicodeRange3 uint32 UlUnicodeRange4 uint32 AchVendID [4]byte FsSelection uint16 UsFirstCharIndex uint16 UsLastCharIndex uint16 STypoAscender int16 STypoDescender int16 STypoLineGap int16 UsWinAscent uint16 UsWinDescent uint16 UlCodePageRange1 uint32 UlCodePageRange2 uint32 SxHeight int16 SCapHeight int16 UsDefaultChar uint16 UsBreakChar uint16 UsMaxContent uint16 UsLowerOpticalPointSize uint16 UsUpperOpticalPointSize uint16 } func (sfnt *SFNT) parseOS2() error { b, ok := sfnt.Tables["OS/2"] if !ok { return fmt.Errorf("OS/2: missing table") } else if len(b) < 68 { return fmt.Errorf("OS/2: bad table") } r := NewBinaryReader(b) sfnt.OS2 = &os2Table{} sfnt.OS2.Version = r.ReadUint16() if 5 < sfnt.OS2.Version { return fmt.Errorf("OS/2: bad version") } else if sfnt.OS2.Version == 0 && len(b) != 68 && len(b) != 78 || sfnt.OS2.Version == 1 && len(b) != 86 || 2 <= sfnt.OS2.Version && sfnt.OS2.Version <= 4 && len(b) != 96 || sfnt.OS2.Version == 5 && len(b) != 100 { return fmt.Errorf("OS/2: bad table") } sfnt.OS2.XAvgCharWidth = r.ReadInt16() sfnt.OS2.UsWeightClass = r.ReadUint16() sfnt.OS2.UsWidthClass = r.ReadUint16() sfnt.OS2.FsType = r.ReadUint16() sfnt.OS2.YSubscriptXSize = r.ReadInt16() sfnt.OS2.YSubscriptYSize = r.ReadInt16() sfnt.OS2.YSubscriptXOffset = r.ReadInt16() sfnt.OS2.YSubscriptYOffset = r.ReadInt16() sfnt.OS2.YSuperscriptXSize = r.ReadInt16() sfnt.OS2.YSuperscriptYSize = r.ReadInt16() sfnt.OS2.YSuperscriptXOffset = r.ReadInt16() sfnt.OS2.YSuperscriptYOffset = r.ReadInt16() sfnt.OS2.YStrikeoutSize = r.ReadInt16() sfnt.OS2.YStrikeoutPosition = r.ReadInt16() sfnt.OS2.SFamilyClass = r.ReadInt16() sfnt.OS2.BFamilyType = r.ReadUint8() sfnt.OS2.BSerifStyle = r.ReadUint8() sfnt.OS2.BWeight = r.ReadUint8() sfnt.OS2.BProportion = r.ReadUint8() sfnt.OS2.BContrast = r.ReadUint8() sfnt.OS2.BStrokeVariation = r.ReadUint8() sfnt.OS2.BArmStyle = r.ReadUint8() sfnt.OS2.BLetterform = r.ReadUint8() sfnt.OS2.BMidline = r.ReadUint8() sfnt.OS2.BXHeight = r.ReadUint8() sfnt.OS2.UlUnicodeRange1 = r.ReadUint32() sfnt.OS2.UlUnicodeRange2 = r.ReadUint32() sfnt.OS2.UlUnicodeRange3 = r.ReadUint32() sfnt.OS2.UlUnicodeRange4 = r.ReadUint32() copy(sfnt.OS2.AchVendID[:], r.ReadBytes(4)) sfnt.OS2.FsSelection = r.ReadUint16() sfnt.OS2.UsFirstCharIndex = r.ReadUint16() sfnt.OS2.UsLastCharIndex = r.ReadUint16() if 78 <= len(b) { sfnt.OS2.STypoAscender = r.ReadInt16() sfnt.OS2.STypoDescender = r.ReadInt16() sfnt.OS2.STypoLineGap = r.ReadInt16() sfnt.OS2.UsWinAscent = r.ReadUint16() sfnt.OS2.UsWinDescent = r.ReadUint16() } if sfnt.OS2.Version == 0 { return nil } sfnt.OS2.UlCodePageRange1 = r.ReadUint32() sfnt.OS2.UlCodePageRange2 = r.ReadUint32() if sfnt.OS2.Version == 1 { return nil } sfnt.OS2.SxHeight = r.ReadInt16() sfnt.OS2.SCapHeight = r.ReadInt16() sfnt.OS2.UsDefaultChar = r.ReadUint16() sfnt.OS2.UsBreakChar = r.ReadUint16() sfnt.OS2.UsMaxContent = r.ReadUint16() if 2 <= sfnt.OS2.Version && sfnt.OS2.Version <= 4 { return nil } sfnt.OS2.UsLowerOpticalPointSize = r.ReadUint16() sfnt.OS2.UsUpperOpticalPointSize = r.ReadUint16() return nil } type bboxPather struct { xMin, xMax, yMin, yMax float64 } func (p *bboxPather) MoveTo(x float64, y float64) { p.xMin = math.Min(p.xMin, x) p.xMax = math.Max(p.xMax, x) p.yMin = math.Min(p.yMin, y) p.yMax = math.Max(p.yMax, y) } func (p *bboxPather) LineTo(x float64, y float64) { p.xMin = math.Min(p.xMin, x) p.xMax = math.Max(p.xMax, x) p.yMin = math.Min(p.yMin, y) p.yMax = math.Max(p.yMax, y) } func (p *bboxPather) QuadTo(cpx float64, cpy float64, x float64, y float64) { p.xMin = math.Min(math.Min(p.xMin, cpx), x) p.xMax = math.Max(math.Max(p.xMax, cpx), x) p.yMin = math.Min(math.Min(p.yMin, cpy), y) p.yMax = math.Max(math.Max(p.yMax, cpy), y) } func (p *bboxPather) CubeTo(cpx1 float64, cpy1 float64, cpx2 float64, cpy2 float64, x float64, y float64) { p.xMin = math.Min(math.Min(math.Min(p.xMin, cpx1), cpx2), x) p.xMax = math.Max(math.Max(math.Max(p.xMax, cpx1), cpx2), x) p.yMin = math.Min(math.Min(math.Min(p.yMin, cpy1), cpy2), y) p.yMax = math.Max(math.Max(math.Max(p.yMax, cpy1), cpy2), y) } func (p *bboxPather) Close() { } func (sfnt *SFNT) estimateOS2() { if sfnt.IsTrueType { contour, err := sfnt.Glyf.Contour(sfnt.GlyphIndex('x'), 0) if err == nil { sfnt.OS2.SxHeight = contour.YMax } contour, err = sfnt.Glyf.Contour(sfnt.GlyphIndex('H'), 0) if err == nil { sfnt.OS2.SCapHeight = contour.YMax } } else if sfnt.IsCFF { p := &bboxPather{} if err := sfnt.CFF.ToPath(p, sfnt.GlyphIndex('x'), 0, 0, 0, 1.0, NoHinting); err == nil { sfnt.OS2.SxHeight = int16(p.yMax) } p = &bboxPather{} if err := sfnt.CFF.ToPath(p, sfnt.GlyphIndex('H'), 0, 0, 0, 1.0, NoHinting); err == nil { sfnt.OS2.SCapHeight = int16(p.yMax) } } } //////////////////////////////////////////////////////////////// type postTable struct { ItalicAngle uint32 UnderlinePosition int16 UnderlineThickness int16 IsFixedPitch uint32 MinMemType42 uint32 MaxMemType42 uint32 MinMemType1 uint32 MaxMemType1 uint32 GlyphNameIndex []uint16 stringData []string } func (post *postTable) Get(glyphID uint16) string { if len(post.GlyphNameIndex) <= int(glyphID) { return "" } index := post.GlyphNameIndex[glyphID] if index < 258 { return macintoshGlyphNames[index] } else if len(post.stringData) < int(index)-258 { return "" } return post.stringData[index-258] } func (sfnt *SFNT) parsePost() error { // requires data from maxp and CFF2 b, ok := sfnt.Tables["post"] if !ok { return fmt.Errorf("post: missing table") } else if len(b) < 32 { return fmt.Errorf("post: bad table") } _, isCFF2 := sfnt.Tables["CFF2"] sfnt.Post = &postTable{} r := NewBinaryReader(b) version := r.ReadUint32() sfnt.Post.ItalicAngle = r.ReadUint32() sfnt.Post.UnderlinePosition = r.ReadInt16() sfnt.Post.UnderlineThickness = r.ReadInt16() sfnt.Post.IsFixedPitch = r.ReadUint32() sfnt.Post.MinMemType42 = r.ReadUint32() sfnt.Post.MaxMemType42 = r.ReadUint32() sfnt.Post.MinMemType1 = r.ReadUint32() sfnt.Post.MaxMemType1 = r.ReadUint32() if version == 0x00010000 && sfnt.IsTrueType && len(b) == 32 { return nil } else if version == 0x00020000 && (sfnt.IsTrueType || isCFF2) && 34 <= len(b) { // can be used for TrueType and CFF2 fonts, we check for this in the CFF table if r.ReadUint16() != sfnt.Maxp.NumGlyphs { return fmt.Errorf("post: numGlyphs does not match maxp table numGlyphs") } if uint32(len(b)) < 34+2*uint32(sfnt.Maxp.NumGlyphs) { return fmt.Errorf("post: bad table") } // get string data first r.Seek(34 + 2*uint32(sfnt.Maxp.NumGlyphs)) for 2 <= r.Len() { length := r.ReadUint8() if r.Len() < uint32(length) || 63 < length { return fmt.Errorf("post: bad stringData") } sfnt.Post.stringData = append(sfnt.Post.stringData, r.ReadString(uint32(length))) } if 1 < r.Len() { return fmt.Errorf("post: bad stringData") } r.Seek(34) sfnt.Post.GlyphNameIndex = make([]uint16, sfnt.Maxp.NumGlyphs) for i := 0; i < int(sfnt.Maxp.NumGlyphs); i++ { index := r.ReadUint16() if 258 <= index && len(sfnt.Post.stringData) < int(index)-258 { return fmt.Errorf("post: bad stringData") } sfnt.Post.GlyphNameIndex[i] = index } return nil } else if version == 0x00025000 && sfnt.IsTrueType && len(b) == 32 { return fmt.Errorf("post: version 2.5 not supported") } else if version == 0x00030000 && len(b) == 32 { return nil } return fmt.Errorf("post: bad version") } <|start_filename|>font/sfnt_layout.go<|end_filename|> package font import "fmt" type langSys struct { requiredFeatureIndex uint16 featureIndices []uint16 } type scriptList map[ScriptTag]map[LanguageTag]langSys func (scriptList scriptList) getLangSys(scriptTag ScriptTag, languageTag LanguageTag) (langSys, bool) { script, ok := scriptList[scriptTag] if !ok || scriptTag == UnknownScript { script, ok = scriptList[DefaultScript] if !ok { return langSys{}, false } } langSys, ok := script[languageTag] if !ok || languageTag == UnknownLanguage { langSys = script[DefaultLanguage] // always present } return langSys, true } func (sfnt *SFNT) parseScriptList(b []byte) (scriptList, error) { r := NewBinaryReader(b) r2 := NewBinaryReader(b) r3 := NewBinaryReader(b) scriptCount := r.ReadUint16() scripts := make(scriptList, scriptCount) for i := 0; i < int(scriptCount); i++ { scriptTag := ScriptTag(r.ReadString(4)) scriptOffset := r.ReadUint16() r2.Seek(uint32(scriptOffset)) defaultLangSysOffset := r2.ReadUint16() langSysCount := r2.ReadUint16() langSyss := make(map[LanguageTag]langSys, langSysCount) for j := -1; j < int(langSysCount); j++ { var langSysTag LanguageTag var langSysOffset uint16 if j == -1 { langSysTag = DefaultLanguage // permanently reserved and cannot be used in font langSysOffset = defaultLangSysOffset } else { langSysTag = LanguageTag(r2.ReadString(4)) langSysOffset = r2.ReadUint16() if langSysTag == DefaultLanguage { return scripts, fmt.Errorf("bad language tag") } } r3.Seek(uint32(scriptOffset) + uint32(langSysOffset)) lookupOrderOffset := r3.ReadUint16() if lookupOrderOffset != 0 { return scripts, fmt.Errorf("lookupOrderOffset must be NULL") } requiredFeatureIndex := r3.ReadUint16() featureIndexCount := r3.ReadUint16() featureIndices := make([]uint16, featureIndexCount) for k := 0; k < int(featureIndexCount); k++ { featureIndices[k] = r3.ReadUint16() } langSyss[langSysTag] = langSys{ requiredFeatureIndex: requiredFeatureIndex, featureIndices: featureIndices, } } scripts[scriptTag] = langSyss } return scripts, nil } //////////////////////////////////////////////////////////////// type featureList struct { tag []FeatureTag feature [][]uint16 } func (featureList featureList) get(i uint16) (FeatureTag, []uint16, error) { if int(i) < len(featureList.tag) { return featureList.tag[i], featureList.feature[i], nil } return UnknownFeature, nil, fmt.Errorf("invalid feature index") } func (sfnt *SFNT) parseFeatureList(b []byte) featureList { r := NewBinaryReader(b) r2 := NewBinaryReader(b) featureCount := r.ReadUint16() tags := make([]FeatureTag, featureCount) features := make([][]uint16, featureCount) for i := uint16(0); i < featureCount; i++ { featureTag := FeatureTag(r.ReadString(4)) featureOffset := r.ReadUint16() r2.Seek(uint32(featureOffset)) _ = r2.ReadUint16() // featureParamsOffset lookupIndexCount := r2.ReadUint16() lookupListIndices := make([]uint16, lookupIndexCount) for j := 0; j < int(lookupIndexCount); j++ { lookupListIndices[j] = r2.ReadUint16() } tags[i] = featureTag features[i] = lookupListIndices } return featureList{ tag: tags, feature: features, } } //////////////////////////////////////////////////////////////// type lookup struct { lookupType uint16 lookupFlag uint16 subtable [][]byte markFilteringSet uint16 } type lookupList []lookup func (sfnt *SFNT) parseLookupList(b []byte) lookupList { r := NewBinaryReader(b) r2 := NewBinaryReader(b) lookupCount := r.ReadUint16() lookups := make(lookupList, lookupCount) for i := 0; i < int(lookupCount); i++ { lookupOffset := r.ReadUint16() r2.Seek(uint32(lookupOffset)) lookups[i].lookupType = r2.ReadUint16() lookups[i].lookupFlag = r2.ReadUint16() subtableCount := r2.ReadUint16() lookups[i].subtable = make([][]byte, subtableCount) for j := 0; j < int(subtableCount); j++ { subtableOffset := r2.ReadUint16() lookups[i].subtable[j] = b[lookupOffset+subtableOffset:] } lookups[i].markFilteringSet = r2.ReadUint16() } return lookups } //////////////////////////////////////////////////////////////// type featureVariationsList struct { Data []byte } //////////////////////////////////////////////////////////////// type coverageTable interface { Index(uint16) (uint16, bool) } type coverageFormat1 struct { glyphArray []uint16 } func (table *coverageFormat1) Index(glyphID uint16) (uint16, bool) { for i, coverageGlyphID := range table.glyphArray { if coverageGlyphID < glyphID { break } else if coverageGlyphID == glyphID { return uint16(i), true } } return 0, false } type coverageFormat2 struct { startGlyphID []uint16 endGlyphID []uint16 startCoverageIndex []uint16 } func (table *coverageFormat2) Index(glyphID uint16) (uint16, bool) { for i := 0; i < len(table.startGlyphID); i++ { if table.endGlyphID[i] < glyphID { break } else if table.startGlyphID[i] <= glyphID { return table.startCoverageIndex[i] + glyphID - table.startGlyphID[i], true } } return 0, false } func (sfnt *SFNT) parseCoverageTable(b []byte) (coverageTable, error) { r := NewBinaryReader(b) coverageFormat := r.ReadUint16() if coverageFormat == 1 { glyphCount := r.ReadUint16() glyphArray := make([]uint16, glyphCount) for i := 0; i < int(glyphCount); i++ { glyphArray[i] = r.ReadUint16() } return &coverageFormat1{ glyphArray: glyphArray, }, nil } else if coverageFormat == 2 { rangeCount := r.ReadUint16() startGlyphIDs := make([]uint16, rangeCount) endGlyphIDs := make([]uint16, rangeCount) startCoverageIndices := make([]uint16, rangeCount) for i := 0; i < int(rangeCount); i++ { startGlyphIDs[i] = r.ReadUint16() endGlyphIDs[i] = r.ReadUint16() startCoverageIndices[i] = r.ReadUint16() } return &coverageFormat2{ startGlyphID: startGlyphIDs, endGlyphID: endGlyphIDs, startCoverageIndex: startCoverageIndices, }, nil } return nil, fmt.Errorf("bad coverage table format") } //////////////////////////////////////////////////////////////// type classDefTable interface { Get(uint16) uint16 } type classDefFormat1 struct { startGlyphID uint16 classValueArray []uint16 } func (table *classDefFormat1) Get(glyphID uint16) uint16 { if table.startGlyphID <= glyphID && glyphID-table.startGlyphID < uint16(len(table.classValueArray)) { return table.classValueArray[glyphID-table.startGlyphID] } return 0 } type classRangeRecord struct { startGlyphID uint16 endGlyphID uint16 class uint16 } type classDefFormat2 []classRangeRecord func (table classDefFormat2) Get(glyphID uint16) uint16 { for _, classRange := range table { if glyphID < classRange.startGlyphID { break } else if classRange.startGlyphID <= glyphID && glyphID <= classRange.endGlyphID { return classRange.class } } return 0 } func (sfnt *SFNT) parseClassDefTable(b []byte, classCount uint16) (classDefTable, error) { r := NewBinaryReader(b) classFormat := r.ReadUint16() if classFormat == 1 { startGlyphID := r.ReadUint16() glyphCount := r.ReadUint16() classValueArray := make([]uint16, glyphCount) for i := 0; i < int(glyphCount); i++ { classValueArray[i] = r.ReadUint16() if classCount <= classValueArray[i] { return nil, fmt.Errorf("bad class value") } } return &classDefFormat1{ startGlyphID: startGlyphID, classValueArray: classValueArray, }, nil } else if classFormat == 2 { classRangeCount := r.ReadUint16() classRangeRecords := make(classDefFormat2, classRangeCount) for i := 0; i < int(classRangeCount); i++ { classRangeRecords[i].startGlyphID = r.ReadUint16() classRangeRecords[i].endGlyphID = r.ReadUint16() classRangeRecords[i].class = r.ReadUint16() if classCount <= classRangeRecords[i].class { return nil, fmt.Errorf("bad class value") } } return classRangeRecords, nil } return nil, fmt.Errorf("bad class definition table format") } //////////////////////////////////////////////////////////////// type ValueRecord struct { XPlacement int16 YPlacement int16 XAdvance int16 YAdvance int16 XPlaDeviceOffset uint16 YPlaDeviceOffset uint16 XAdvDeviceOffset uint16 YAdvDeviceOffset uint16 } func (sfnt *SFNT) parseValueRecord(r *BinaryReader, valueFormat uint16) (valueRecord ValueRecord) { if valueFormat == 0 { return } else if valueFormat&0x0001 != 0 { // X_PLACEMENT valueRecord.XPlacement = r.ReadInt16() } else if valueFormat&0x0002 != 0 { // Y_PLACEMENT valueRecord.YPlacement = r.ReadInt16() } else if valueFormat&0x0004 != 0 { // X_ADVANCE valueRecord.XAdvance = r.ReadInt16() } else if valueFormat&0x0008 != 0 { // Y_ADVANCE valueRecord.YAdvance = r.ReadInt16() } else if valueFormat&0x0010 != 0 { // X_PLACEMENT_DEVICE valueRecord.XPlaDeviceOffset = r.ReadUint16() } else if valueFormat&0x0020 != 0 { // Y_PLACEMENT_DEVICE valueRecord.YPlaDeviceOffset = r.ReadUint16() } else if valueFormat&0x0040 != 0 { // X_ADVANCE_DEVICE valueRecord.XAdvDeviceOffset = r.ReadUint16() } else if valueFormat&0x0080 != 0 { // Y_ADVANCE_DEVICE valueRecord.YAdvDeviceOffset = r.ReadUint16() } return } //////////////////////////////////////////////////////////////// type singlePosTables []singlePosTable func (tables singlePosTables) Get(glyphID uint16) (ValueRecord, bool) { for _, table := range tables { if valueRecord, ok := table.Get(glyphID); ok { return valueRecord, true } } return ValueRecord{}, false } type singlePosTable interface { Get(uint16) (ValueRecord, bool) } type singlePosFormat1 struct { coverageTable valueRecord ValueRecord } func (table *singlePosFormat1) Get(glyphID uint16) (ValueRecord, bool) { if _, ok := table.Index(glyphID); ok { return table.valueRecord, true } return ValueRecord{}, false } type singlePosFormat2 struct { coverageTable valueRecord []ValueRecord } func (table *singlePosFormat2) Get(glyphID uint16) (ValueRecord, bool) { if i, ok := table.Index(glyphID); ok { return table.valueRecord[i], true } return ValueRecord{}, false } func (sfnt *SFNT) parseSinglePosTable(b []byte) (interface{}, error) { r := NewBinaryReader(b) posFormat := r.ReadUint16() coverageOffset := r.ReadUint16() coverageTable, err := sfnt.parseCoverageTable(b[coverageOffset:]) if err != nil { return nil, err } valueFormat := r.ReadUint16() if posFormat == 1 { valueRecord := sfnt.parseValueRecord(r, valueFormat) return &singlePosFormat1{ coverageTable: coverageTable, valueRecord: valueRecord, }, nil } else if posFormat == 2 { valueCount := r.ReadUint16() valueRecord := make([]ValueRecord, valueCount) for i := 0; i < int(valueCount); i++ { valueRecord[i] = sfnt.parseValueRecord(r, valueFormat) } return &singlePosFormat2{ coverageTable: coverageTable, valueRecord: valueRecord, }, nil } return nil, fmt.Errorf("bad single adjustment positioning table format") } //////////////////////////////////////////////////////////////// type pairPosTables []pairPosTable func (tables pairPosTables) Get(glyphID1, glyphID2 uint16) (ValueRecord, ValueRecord, bool) { for _, table := range tables { if valueRecord1, valueRecord2, ok := table.Get(glyphID1, glyphID2); ok { return valueRecord1, valueRecord2, true } } return ValueRecord{}, ValueRecord{}, false } type pairPosTable interface { Get(uint16, uint16) (ValueRecord, ValueRecord, bool) } type pairValueRecord struct { secondGlyph uint16 valueRecord1 ValueRecord valueRecord2 ValueRecord } type pairPosFormat1 struct { coverageTable pairSet [][]pairValueRecord } func (table *pairPosFormat1) Get(glyphID1, glyphID2 uint16) (ValueRecord, ValueRecord, bool) { if i, ok := table.Index(glyphID1); ok { for j := 0; j < len(table.pairSet[i]); j++ { if table.pairSet[i][j].secondGlyph == glyphID2 { return table.pairSet[i][j].valueRecord1, table.pairSet[i][j].valueRecord2, true } else if glyphID2 < table.pairSet[i][j].secondGlyph { break } } } return ValueRecord{}, ValueRecord{}, false } type class2Record struct { valueRecord1 ValueRecord valueRecord2 ValueRecord } type pairPosFormat2 struct { coverageTable classDef1 classDefTable classDef2 classDefTable class1Records [][]class2Record } func (table *pairPosFormat2) Get(glyphID1, glyphID2 uint16) (ValueRecord, ValueRecord, bool) { if _, ok := table.Index(glyphID1); ok { class1 := table.classDef1.Get(glyphID1) class2 := table.classDef1.Get(glyphID2) return table.class1Records[class1][class2].valueRecord1, table.class1Records[class1][class2].valueRecord2, true } return ValueRecord{}, ValueRecord{}, false } func (sfnt *SFNT) parsePairPosTable(b []byte) (interface{}, error) { r := NewBinaryReader(b) r2 := NewBinaryReader(b) posFormat := r.ReadUint16() coverageOffset := r.ReadUint16() coverageTable, err := sfnt.parseCoverageTable(b[coverageOffset:]) if err != nil { return nil, err } valueFormat1 := r.ReadUint16() valueFormat2 := r.ReadUint16() if posFormat == 1 { pairSetCount := r.ReadUint16() pairSet := make([][]pairValueRecord, pairSetCount) for i := 0; i < int(pairSetCount); i++ { pairSetOffset := r.ReadUint16() r2.Seek(uint32(pairSetOffset)) pairValueCount := r2.ReadUint16() pairValueRecords := make([]pairValueRecord, pairValueCount) for j := 0; j < int(pairValueCount); j++ { pairValueRecords[j].secondGlyph = r2.ReadUint16() pairValueRecords[j].valueRecord1 = sfnt.parseValueRecord(r2, valueFormat1) pairValueRecords[j].valueRecord2 = sfnt.parseValueRecord(r2, valueFormat2) } pairSet[i] = pairValueRecords } return &pairPosFormat1{ coverageTable: coverageTable, pairSet: pairSet, }, nil } else if posFormat == 2 { classDef1Offset := r.ReadUint16() classDef2Offset := r.ReadUint16() class1Count := r.ReadUint16() class2Count := r.ReadUint16() classDef1, err := sfnt.parseClassDefTable(b[classDef1Offset:], class1Count) if err != nil { return nil, err } classDef2 := classDef1 if classDef1Offset != classDef2Offset { if classDef2, err = sfnt.parseClassDefTable(b[classDef2Offset:], class2Count); err != nil { return nil, err } } class1Records := make([][]class2Record, class1Count) for j := 0; j < int(class1Count); j++ { class1Records[j] = make([]class2Record, class2Count) for i := 0; i < int(class2Count); i++ { class1Records[j][i].valueRecord1 = sfnt.parseValueRecord(r, valueFormat1) class1Records[j][i].valueRecord2 = sfnt.parseValueRecord(r, valueFormat2) } } return &pairPosFormat2{ coverageTable: coverageTable, classDef1: classDef1, classDef2: classDef2, class1Records: class1Records, }, nil } return nil, fmt.Errorf("bad single adjustment positioning table format") } //////////////////////////////////////////////////////////////// type gposTable struct { scriptList featureList lookupList featureVariationsList tables []interface{} } func (table *gposTable) GetLookups(script ScriptTag, language LanguageTag, features []FeatureTag) ([]interface{}, error) { var featureIndices []uint16 if langSys, ok := table.scriptList.getLangSys(script, language); ok { featureIndices = append([]uint16{langSys.requiredFeatureIndex}, langSys.featureIndices...) } var lookupIndices []uint16 for _, feature := range featureIndices { tag, lookups, err := table.featureList.get(feature) if err != nil { return nil, err } for _, selectedTag := range features { if selectedTag == tag { // insert to list and sort InsertLoop: for _, lookup := range lookups { for i, lookupIndex := range lookupIndices { if lookupIndex < lookup { lookupIndices = append(lookupIndices[:i], append([]uint16{lookup}, lookupIndices[i:]...)...) } else if lookupIndex == lookup { break InsertLoop } } } break } } } tables := make([]interface{}, len(lookupIndices)) for i := 0; i < len(lookupIndices); i++ { tables[i] = table.tables[lookupIndices[i]] } return tables, nil } func (sfnt *SFNT) parseGPOS() error { b, ok := sfnt.Tables["GPOS"] if !ok { return fmt.Errorf("GPOS: missing table") } else if len(b) < 32 { return fmt.Errorf("GPOS: bad table") } sfnt.Gpos = &gposTable{} r := NewBinaryReader(b) majorVersion := r.ReadUint16() minorVersion := r.ReadUint16() if majorVersion != 1 && minorVersion != 0 && minorVersion != 1 { return fmt.Errorf("GPOS: bad version") } var err error scriptListOffset := r.ReadUint16() if len(b)-2 < int(scriptListOffset) { return fmt.Errorf("GPOS: bad scriptList offset") } sfnt.Gpos.scriptList, err = sfnt.parseScriptList(b[scriptListOffset:]) if err != nil { return fmt.Errorf("GPOS: %w", err) } featureListOffset := r.ReadUint16() if len(b)-2 < int(featureListOffset) { return fmt.Errorf("GPOS: bad featureList offset") } sfnt.Gpos.featureList = sfnt.parseFeatureList(b[featureListOffset:]) lookupListOffset := r.ReadUint16() if len(b)-2 < int(lookupListOffset) { return fmt.Errorf("GPOS: bad lookupList offset") } sfnt.Gpos.lookupList = sfnt.parseLookupList(b[lookupListOffset:]) subtableMap := map[uint16]func([]byte) (interface{}, error){ 1: sfnt.parseSinglePosTable, 2: sfnt.parsePairPosTable, } sfnt.Gpos.tables = make([]interface{}, len(sfnt.Gpos.lookupList)) for j, lookup := range sfnt.Gpos.lookupList { if parseSubtable, ok := subtableMap[lookup.lookupType]; ok { tables := make([]interface{}, len(lookup.subtable)) for i, data := range lookup.subtable { var err error tables[i], err = parseSubtable(data) if err != nil { return fmt.Errorf("GPOS: %w", err) } } sfnt.Gpos.tables[j] = tables } else if lookup.lookupType == 0 || 9 < lookup.lookupType { return fmt.Errorf("bad lookup table type") } } var featureVariationsOffset uint32 if minorVersion == 1 { featureVariationsOffset = r.ReadUint32() if len(b)-8 < int(featureVariationsOffset) { return fmt.Errorf("GPOS: bad featureVariations offset") } sfnt.Gpos.featureVariationsList = featureVariationsList{b[featureVariationsOffset:]} } return nil }
kenshaw/canvas
<|start_filename|>imports/documents.json<|end_filename|> {"documents":[{"id":9,"insert_ts":"2021-12-20 21:46:49","update_ts":"2021-12-20 21:48:55","user_id":1,"parent_type":"library","parent_id":null,"visibility":"public","title":"Threat Modelling: STRIDE model","content":"STRIDE is a model for identifying computer security threats. It provides a mnemonic for security threats in six categories\n\nThe threats are:\n\n- Spoofing\n- Tampering\n- Repudiation\n- Information disclosure (privacy breach or data leak)\n- Denial of service\n- Elevation of privilege\n\nThe STRIDE was initially created as part of the process of threat modeling. STRIDE is a model of threats, used to help reason and find threats to a system. It is used in conjunction with a model of the target system that can be constructed in parallel. This includes a full breakdown of processes, data stores, data flows, and trust boundaries\n","user_name":"admin"},{"id":7,"insert_ts":"2021-12-20 21:45:00","update_ts":"2021-12-20 21:51:23","user_id":1,"parent_type":"library","parent_id":null,"visibility":"public","title":"Scoping questionnaire for black box or whitebox security tests","content":"## General information\n\n### 1. What is the business requirement for this penetration test?*\n\nFor example, is the driver for this to comply with an audit requirement, or are you seeking to proactively evaluate the security in your environment?\n\n(_) This is required by a regulatory audit or standard.\n(_) Proactive internal decision to determine all weaknesses.\n\n### 2. Will you also conduct a white box pen test or black box test or BOTH?*\n\n[White Box can be best described as a test where specific information has been provided in order to focus the effort. This tests the threat of internal attacks, say originating from people who have access to your network and know a lot about the services, ports, apps, etc running\n\nBlack Box can be best described as a test where no information is provided by the client and the approach is left entirely to the penetration tester (analyst) to determine a means for exploitation \u2013 this helps you understand the threat of external attacks]\n\n(_) I will conduct a white box pentest.\n(_) I will conduct a black box pentest.\n(_) I need both.\n\n### 3. How many IP addresses and\/or applications are included as in\u2010scope for this testing? Please list them, including multiple sites, etc. *\n\nIn case you need a white box pen test, provide the following:\n\n1. IP address range (Internal & External).\n2. Few of the staff\u2019s email addresses & their names for assessing the level of security awareness\n\n___________________________________________\n\n### 4. What are the objectives? *\n\nSelect all objectives that apply\n\n[_] Map out vulnerabilities\n[_] Demonstrate that the vulnerabilities can be exploited\n[_] Actual exploitation of vulnerability in a network system or application\n[_] Obtain privileged access; exploit buffer overflows, SQL injection attacks, etc.\n\n### 5. What is the \u201ctarget\u201d of the Penetration test? Is it;*\n\n[_] An application\n[_] A website\n[_] A network\n[_] A wireless network\n[_] Others\n\n### 6. Do you also want the following tests to be performed?*\n\nSocial Engineering test \u2013 to gain sensitive information from one or more of your employees (to infer or solicit sensitive information)\n\nPlease explain fully:\n___________________________________________\n\n### 7. Will this testing be done on a production environment? *\n\nYou need to understand that certain exploitation of vulnerabilities to determine and\/or prove a weakness could crash your system or cause it to reboot.\n\nOur team is not liable for downtime caused by proving the system\u2019s weakness to attack.\n\n### 8. If production environments must not be affected, does a similar environment (development and\/or test systems) exist that can be used to conduct the pen test?*\n\n### 9 . Are the business owners aware of this pen test? *\n\nAre key stakeholders (business owners) aware that the nature of a pen test is to attack the system as a hacker (or hostile actor) would, in order to learn and prove the system\u2019s weakness?\n\nIn addition to identifying vulnerabilities, if found, we will attempt to exploit them and then show you the results.\n\n### 10. At what time do you want these tests to be performed? *\n\n## Contact Details\n\n### Who is the technical point of contact?\n\n## Additional information? *\n\n","user_name":"admin"},{"id":8,"insert_ts":"2021-12-20 21:45:00","update_ts":null,"user_id":1,"parent_type":"library","parent_id":null,"visibility":"private","title":"Links","content":"CVSS calculator\\\n[https:\/\/www.first.org\/cvss\/calculator\/3.0](https:\/\/www.first.org\/cvss\/calculator\/3.0)\\\n\nExample pentest reports\\\n[https:\/\/pentestreports.com](https:\/\/pentestreports.com)","user_name":"admin"}]} <|start_filename|>config.json<|end_filename|> { "jwt": { "issuer": "reconmap.org", "audience": "reconmap.com", "key": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, "cors": { "allowedOrigins": [ "http://localhost:5500" ] }, "database": { "host": "rmap-mysql", "username": "reconmapper", "password": "<PASSWORD>", "name": "reconmap" }, "smtp": { "host": "", "port": 587, "username": "", "password": "", "fromEmail": "<EMAIL>", "fromName": "Reconmap" }, "integrations": {} }
noraj/reconmap
<|start_filename|>static/skin/heike.css<|end_filename|> body { background: #111; } #canvas {background: #111; z-index: -1;top:0; position: absolute; display: block; margin: 0 auto; } .typecho-login { background: rgba(0, 0, 0, 0.7); display: block; padding: 10px 20px; border-radius: 5px; margin-top: 20vh; color: #fff; } input[type=text], input[type=password], input[type=email], textarea { background: transparent;/*输入框透明*/ color: #fff; } .primary { background-color: #3a3a3a;/*按钮颜色重写*/ } .primary:hover { background-color: #2f2f2f;/*按钮hover颜色重写*/ } .typecho-login .more-link { margin-top: 0; } a { color: #00c14d;/*默认超链接颜色*/ } .typecho-login h1 { margin: 10px 0 0; } .i-logo, .i-logo-s { width: 228px; height: 36px; opacity: 0.7; background:url(../logo/typecho-logo.png) no-repeat; } <|start_filename|>static/skin/Earlyspringimpression.css<|end_filename|> body { font-family: roboto,sans-serif; text-align: center; background-image: url(../img/Earlyspringimpression.jpg); background-repeat: no-repeat; background-attachment: fixed; background-position: center; background-size: cover; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; } .typecho-login { color: #fff; } .typecho-login .more-link a { color: #fff; } .primary {color: #daf2f4; background-color: #39e6c2;/*按钮颜色重写*/ } .primary:hover { background-color: #22cca8; color: #ffffff;/*按钮hover颜色重写*/ } .typecho-login .more-link { margin-top: 0; color: #fff; } .typecho-login h1 { margin: 10px 0 0; } input[type=text], input[type=password], input[type=email], textarea{ background: rgba(255, 255, 255, 0.38);border-color: transparent;outline: none; } .i-logo, .i-logo-s { width: 228px; height: 36px; opacity: 1; background:url(../logo/typecho-logo.png) no-repeat; } .i-logo:hover, .i-logo-s:hover { filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=100); opacity: 1; } <|start_filename|>static/skin/MarineGiant.css<|end_filename|> body { font-family: roboto,sans-serif; text-align: center; background-image: url(../img/MarineGiant.jpg); background-repeat: no-repeat; background-attachment: fixed; background-position: center; background-size: cover; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; } .typecho-login input::-webkit-input-placeholder { /* WebKit browsers */ color: #e07dac; } .typecho-login input:-moz-placeholder { /* Mozilla Firefox 4 to 18 */ color: #e07dac; } .typecho-login input::-moz-placeholder { /* Mozilla Firefox 19+ */ color: #e07dac; } .typecho-login input:-ms-input-placeholder { /* Internet Explorer 10+ */ color: #e07dac; } .typecho-login { background: rgba(68, 11, 56, 0.38); color: #fff; display: block; padding: 15px 25px; margin-top: 20vh; } .typecho-login a{ color: #fff; } .primary {color: #ffffff; background-color: #c95876;/*按钮颜色重写*/ } .primary:hover { background-color: #a03d5c;/*按钮hover颜色重写*/ } .typecho-login .more-link { margin-top: 0; color: #ffffff; } .typecho-login h1 { margin: 10px 0 0; } input[type=text], input[type=password], input[type=email], textarea{ background: rgba(66, 13, 61, 0.69); color: #fff; border-color: transparent; outline: none; } .i-logo, .i-logo-s { width: 228px; height: 36px; opacity: 1; background:url(../logo/typecho-logo.png) no-repeat; } .i-logo:hover, .i-logo-s:hover { filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=100); opacity: 1; } <|start_filename|>static/skin/mohu.css<|end_filename|> body{ font-family: roboto,sans-serif; text-align: center; background-image: url(../img/mohu.jpg); background-repeat: no-repeat; background-attachment: fixed; background-position: center; background-size: cover; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; } body::before { content: ''; position: fixed; width: 100%; height: 100%; top: 0; left: 0; will-change: transform; z-index: -1; background-image: url(../img/mohu.jpg); background-repeat: no-repeat; background-attachment: fixed; background-position: center; background-size: cover; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; -moz-filter: blur(10px) brightness(.88); -webkit-filter: blur(10px) brightness(.88); -o-filter: blur(10px) brightness(.88); -ms-filter: blur(10px) brightness(.88); filter: blur(10px) brightness(.88); } .typecho-login { background: rgba(255, 255, 255, 0.68); display: block; padding: 10px 20px; border-radius: 15px; margin-top: 20vh; -moz-box-shadow: 0 0 10px #ffffff; box-shadow: 0 0 10px #ffffff; } .primary {border-radius: 15px; background-color: rgba(255, 86, 87, .7);/*按钮颜色重写*/ } .primary:hover { background-color: rgba(255, 86, 87);/*按钮hover颜色重写*/ } .typecho-login .more-link { margin-top: 0; color: rgba(255, 86, 87); } .typecho-login h1 { margin: 10px 0 0; } .i-logo, .i-logo-s { width: 228px; height: 36px; opacity: 0.7; background:url(../logo/typecho-logo-dark.png) no-repeat; } a { color: rgba(255, 86, 87, .7); } a:hover { color: rgba(255, 86, 87); text-decoration: none; } input[type=text], input[type=password], input[type=email], textarea { border-radius: 15px;} <|start_filename|>static/skin/white.css<|end_filename|> body { font-family: roboto,sans-serif; text-align: center; background-image: url(../img/white.jpg); background-repeat: no-repeat; background-attachment: fixed; background-position: center; background-size: cover; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; } .typecho-login { background: rgba(255, 255, 255, 0.68); display: block; padding: 10px 20px; border-radius: 5px; margin-top: 20vh; -moz-box-shadow: 0 0 10px #ffffff; box-shadow: 0 0 10px #ffffff; } .primary { background-color: #3a3a3a;/*按钮颜色重写*/ } .primary:hover { background-color: #2f2f2f;/*按钮hover颜色重写*/ } .typecho-login .more-link { margin-top: 0; color: #bbb; } .typecho-login h1 { margin: 10px 0 0; } .i-logo, .i-logo-s { width: 228px; height: 36px; opacity: 0.7; background:url(../logo/typecho-logo-dark.png) no-repeat; } <|start_filename|>static/skin/black.css<|end_filename|> body { font-family: roboto,sans-serif; text-align: center; background-image: url(../img/black.jpg); background-repeat: no-repeat; background-attachment: fixed; background-position: center; background-size: cover; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; } .typecho-login { background: rgba(0, 0, 0, 0.7); display: block; padding: 10px 20px; border-radius: 5px; margin-top: 20vh; color: #fff; } input[type=text], input[type=password], input[type=email], textarea { background: transparent;/*输入框透明*/ color: #fff; } .primary { background-color: #3a3a3a;/*按钮颜色重写*/ } .primary:hover { background-color: #2f2f2f;/*按钮hover颜色重写*/ } .typecho-login .more-link { margin-top: 0; } a { color: #00a9ff;/*默认超链接颜色*/ } .typecho-login h1 { margin: 10px 0 0; } .i-logo, .i-logo-s { width: 228px; height: 36px; opacity: 0.7; background:url(../logo/typecho-logo.png) no-repeat; }
wangjiezhe/SimpleAdmin
<|start_filename|>ffxvBenchCustom/SigScan.h<|end_filename|> #pragma once #include <cstdint> uintptr_t sigScan(const char* pattern, bool isData = false); <|start_filename|>ffxvBenchCustom/ffxvBenchCustom.h<|end_filename|> #pragma once #define WINVER 0x0601 #define _WIN32_WINNT 0x0601 #include <winsdkver.h> #include <SDKDDKVer.h> #define WIN32_LEAN_AND_MEAN #include <Windows.h> #include <cstdint> <|start_filename|>ffxvBenchCustom/SigScan.cpp<|end_filename|> #include "ffxvBenchCustom.h" #include <dbghelp.h> #include <iomanip> #include <malloc.h> #include <string> #include <vector> #include <algorithm> // Stolen from // https://github.com/CommitteeOfZero/LanguageBarrier/blob/multi-game/LanguageBarrier/SigScan.cpp // https://raw.githubusercontent.com/learn-more/findpattern-bench/master/patterns/atom0s_mrexodia.h namespace { using namespace std; struct PatternByte { struct PatternNibble { unsigned char data; bool wildcard; } nibble[2]; }; static string FormatPattern(string patterntext) { string result; int len = patterntext.length(); for (int i = 0; i < len; i++) if (patterntext[i] == '?' || isxdigit(patterntext[i])) result += toupper(patterntext[i]); return result; } static int HexChToInt(char ch) { if (ch >= '0' && ch <= '9') return ch - '0'; else if (ch >= 'A' && ch <= 'F') return ch - 'A' + 10; else if (ch >= 'a' && ch <= 'f') return ch - 'a' + 10; return 0; } static bool TransformPattern(string patterntext, vector<PatternByte> &pattern) { pattern.clear(); patterntext = FormatPattern(patterntext); int len = patterntext.length(); if (!len) return false; if (len % 2) // not a multiple of 2 { patterntext += '?'; len++; } PatternByte newByte; for (int i = 0, j = 0; i < len; i++) { if (patterntext[i] == '?') // wildcard { newByte.nibble[j].wildcard = true; // match anything } else // hex { newByte.nibble[j].wildcard = false; newByte.nibble[j].data = HexChToInt(patterntext[i]) & 0xF; } j++; if (j == 2) // two nibbles = one byte { j = 0; pattern.push_back(newByte); } } return true; } static bool MatchByte(const unsigned char byte, const PatternByte &pbyte) { int matched = 0; unsigned char n1 = (byte >> 4) & 0xF; if (pbyte.nibble[0].wildcard) matched++; else if (pbyte.nibble[0].data == n1) matched++; unsigned char n2 = byte & 0xF; if (pbyte.nibble[1].wildcard) matched++; else if (pbyte.nibble[1].data == n2) matched++; return (matched == 2); } uintptr_t FindPattern(vector<unsigned char> data, const char *pszPattern, uintptr_t baseAddress, size_t offset, int occurrence) { // Build vectored pattern.. vector<PatternByte> patterndata; if (!TransformPattern(pszPattern, patterndata)) return NULL; // The result count for multiple results.. int resultCount = 0; vector<unsigned char>::iterator scanStart = data.begin(); while (true) { // Search for the pattern.. vector<unsigned char>::iterator ret = search(scanStart, data.end(), patterndata.begin(), patterndata.end(), MatchByte); // Did we find a match.. if (ret != data.end()) { // If we hit the usage count, return the result.. if (occurrence == 0 || resultCount == occurrence) return baseAddress + distance(data.begin(), ret) + offset; // Increment the found count and scan again.. resultCount++; scanStart = ++ret; } else break; } return NULL; } } // namespace uintptr_t sigScan(const char *pattern, bool isData = false) { HMODULE exeModule = GetModuleHandle(NULL); IMAGE_NT_HEADERS *pNtHdr = ImageNtHeader(exeModule); IMAGE_SECTION_HEADER *pSectionHdr = (IMAGE_SECTION_HEADER *)((uint8_t *)&(pNtHdr->OptionalHeader) + pNtHdr->FileHeader.SizeOfOptionalHeader); for (size_t i = 0; i < pNtHdr->FileHeader.NumberOfSections; i++) { if (isData == !!(pSectionHdr->Characteristics & IMAGE_SCN_MEM_EXECUTE)) continue; uintptr_t baseAddress = (uintptr_t)exeModule + pSectionHdr->VirtualAddress; std::vector<unsigned char> rawData((unsigned char *)baseAddress, (unsigned char *)baseAddress + pSectionHdr->Misc.VirtualSize); uintptr_t retval = (uintptr_t)FindPattern(rawData, pattern, baseAddress, 0, 0); if (retval != NULL) { return retval; } pSectionHdr++; } return NULL; } <|start_filename|>ffxvBenchCustom/ffxvBenchCustom.cpp<|end_filename|> #include "ffxvBenchCustom.h" #include <cstdint> #include <cstdio> #include <shellapi.h> #define DIRECTINPUT_VERSION 0x0800 #include <dinput.h> #include "SigScan.h" #include <MinHook.h> typedef HRESULT(WINAPI *DirectInput8CreateProc)(HINSTANCE hinst, DWORD dwVersion, REFIID riidltf, LPVOID *ppvOut, LPUNKNOWN punkOuter); static DirectInput8CreateProc realDirectInput8Create = NULL; static HINSTANCE hRealDinput8 = NULL; static bool patched = false; static bool configIsModified = false; static const char LoadBenchmarkGraphicsIniSig[] = "48 8B C4 55 48 8B EC 48 ?? ?? ?? ?? ?? ?? 48 ?? ?? ?? ?? ?? ?? ?? 48 89 " "58 08 48 89 70 10 48 89 78 18 4C 89 70 20 48 8B FA"; typedef void(__fastcall *LoadBenchmarkGraphicsIniProc)(void *state, const char *path); static LoadBenchmarkGraphicsIniProc LoadBenchmarkGraphicsIniOrig = NULL; static LoadBenchmarkGraphicsIniProc LoadBenchmarkGraphicsIniReal = NULL; static const char EngineLoadStringSig[] = "40 53 48 83 EC 20 48 8B D9 48 8B 09 48 3B CA"; typedef int64_t(__fastcall *EngineLoadStringProc)(void *dst, const char *src); static EngineLoadStringProc EngineLoadString = NULL; static const char SubmitBenchmarkResultsSig[] = "40 55 56 57 48 8D 6C 24 B9 48 ?? ?? ?? ?? ?? ?? 48 ?? ?? ?? ?? ?? ?? ?? " "?? ?? ?? ?? ?? ?? ?? ?? 48 8B DA"; typedef void(__fastcall *SubmitBenchmarkResultsProc)(uintptr_t a1, uintptr_t a2); static SubmitBenchmarkResultsProc SubmitBenchmarkResultsOrig = NULL; static SubmitBenchmarkResultsProc SubmitBenchmarkResultsReal = NULL; static const char defaultIniPath[] = "config\\GraphicsConfig_BenchmarkMiddle.ini"; static const wchar_t standardLowPath[] = L"config\\GraphicsConfig_BenchmarkLow.ini"; static const wchar_t standardMiddlePath[] = L"config\\GraphicsConfig_BenchmarkMiddle.ini"; static const wchar_t standardHighPath[] = L"config\\GraphicsConfig_BenchmarkHigh.ini"; static const uintptr_t graphicsConfigOffset = 440; void __fastcall SubmitBenchmarkResultsHook(uintptr_t a1, uintptr_t a2) { // let's try not to screw up SE's stat collection, shall we? if (configIsModified) return; return SubmitBenchmarkResultsReal(a1, a2); } void __fastcall LoadBenchmarkGraphicsIniHook(void *state, const char *path) { // path is cut off after a space, so we need to parse the commandline argument // ourselves const wchar_t *realpath = NULL; int nArgs; wchar_t **arglist = CommandLineToArgvW(GetCommandLineW(), &nArgs); for (int i = 0; i < nArgs; i++) { if (_wcsicmp(arglist[i], L"--graphicsIni") == 0 && i + 1 < nArgs) { realpath = arglist[i + 1]; break; } } if (realpath == NULL) { return LoadBenchmarkGraphicsIniReal(state, defaultIniPath); } if (_wcsicmp(realpath, standardLowPath) == 0 || _wcsicmp(realpath, standardMiddlePath) == 0 || _wcsicmp(realpath, standardHighPath) == 0) { return LoadBenchmarkGraphicsIniReal(state, path); } wchar_t expandedPath[MAX_PATH]; ExpandEnvironmentStringsW(realpath, expandedPath, MAX_PATH); FILE *ini; errno_t err = _wfopen_s(&ini, expandedPath, L"rb"); if (err != 0) { MessageBoxA(NULL, "Custom settings INI file not found/readable, continuing with " "default settings", "Custom settings", MB_OK); return LoadBenchmarkGraphicsIniReal(state, defaultIniPath); } configIsModified = true; fseek(ini, 0L, SEEK_END); int iniSz = ftell(ini); fseek(ini, 0L, SEEK_SET); char *text = (char *)calloc(iniSz, 1); fread(text, 1, iniSz, ini); fclose(ini); void *graphicsConfig = (void *)((uintptr_t)state + graphicsConfigOffset); EngineLoadString(graphicsConfig, text); } void patch() { MH_STATUS mhStatus = MH_Initialize(); if (mhStatus != MH_OK) { MessageBoxA(NULL, "Custom settings failed to initialize, continuing with default " "settings", "Custom settings", MB_OK); return; } EngineLoadString = (EngineLoadStringProc)sigScan(EngineLoadStringSig); LoadBenchmarkGraphicsIniOrig = (LoadBenchmarkGraphicsIniProc)sigScan(LoadBenchmarkGraphicsIniSig); SubmitBenchmarkResultsOrig = (SubmitBenchmarkResultsProc)sigScan(SubmitBenchmarkResultsSig); if (EngineLoadString == NULL || LoadBenchmarkGraphicsIniOrig == NULL || SubmitBenchmarkResultsOrig == NULL) { MessageBoxA(NULL, "Failed to find functions, continuing with default settings", "Custom settings", MB_OK); return; } if (MH_CreateHook((void *)SubmitBenchmarkResultsOrig, (void *)SubmitBenchmarkResultsHook, (void **)&SubmitBenchmarkResultsReal) != MH_OK || MH_EnableHook((void *)SubmitBenchmarkResultsOrig) != MH_OK || MH_CreateHook((void *)LoadBenchmarkGraphicsIniOrig, (void *)LoadBenchmarkGraphicsIniHook, (void **)&LoadBenchmarkGraphicsIniReal) != MH_OK || MH_EnableHook((void *)LoadBenchmarkGraphicsIniOrig) != MH_OK) { MessageBoxA(NULL, "Failed to hook functions, continuing with default settings", "Custom settings", MB_OK); return; } } #pragma comment(linker, "/EXPORT:DirectInput8Create=ProxyDirectInput8Create") extern "C" HRESULT WINAPI ProxyDirectInput8Create(HINSTANCE hinst, DWORD dwVersion, REFIID riidltf, LPVOID *ppvOut, LPUNKNOWN punkOuter) { if (!hRealDinput8) { TCHAR expandedPath[MAX_PATH]; ExpandEnvironmentStrings(L"%WINDIR%\\System32\\dinput8.dll", expandedPath, MAX_PATH); hRealDinput8 = LoadLibrary(expandedPath); if (!hRealDinput8) return DIERR_OUTOFMEMORY; realDirectInput8Create = (DirectInput8CreateProc)GetProcAddress( hRealDinput8, "DirectInput8Create"); if (!realDirectInput8Create) return DIERR_OUTOFMEMORY; } return realDirectInput8Create(hinst, dwVersion, riidltf, ppvOut, punkOuter); } BOOLEAN WINAPI DllMain(IN HINSTANCE hDllHandle, IN DWORD nReason, IN LPVOID Reserved) { if (nReason == DLL_PROCESS_ATTACH) { if (!patched) { patch(); patched = true; } } return TRUE; }
drdaxxy/ffxvBenchCustom
<|start_filename|>examples/demo.coffee<|end_filename|> {Parser, serialise, transform} = require '../lib/transformer' coffeeCompile = require('coffee-script').compile fs = require 'fs' start = new Date() parseTree = new Parser().parse(fs.readFileSync('./car.coffee', 'utf8')) console.log 'Parse tree:' console.log JSON.stringify(parseTree, null, 4) console.log 'Transformed to coffee:' coffeescriptCode = serialise parseTree console.log coffeescriptCode console.log 'Compiled to JS:' console.log(coffeeCompile(coffeescriptCode)) end = new Date() console.log "done in #{end - start}ms"
jjoos/coffee-react-transform
<|start_filename|>common/config.h<|end_filename|> // the configured options and settings for Tutorial #define THUNDER_TRADER_VERSION_MAJOR 1 #define THUNDER_TRADER_VERSION_MINOR 0 <|start_filename|>common/trade_headers/AtmMarketDataPluginInterface.h<|end_filename|> #ifndef _COMPRETRADESYSTEMHEADERS_ATMMARKETDATAPLUGININTERFACE_H_ #define _COMPRETRADESYSTEMHEADERS_ATMMARKETDATAPLUGININTERFACE_H_ #include "StrategyData.h" #include "StrategyDefine.h" #include <unordered_map> #include <atomic> #ifndef BOOST_SPIRIT_THREADSAFE #define BOOST_SPIRIT_THREADSAFE #endif #include <boost/property_tree/ptree.hpp> #include <sstream> #include <string> #include <boost/thread.hpp> #include <unordered_map> #include "AtmPluginInterface.h" using namespace std; using namespace boost::property_tree; class MAtmMarketDataPluginInterface: public MAtmPluginInterface { public: virtual bool IsPedding() = 0; virtual void MDInit(const ptree &) = 0; virtual void MDHotUpdate(const ptree &) = 0; virtual void Pause() = 0; virtual void Continue() = 0; virtual void MDUnload() = 0; virtual void MDAttachStrategy( MStrategy *, TMarketDataIdType, const unordered_map<string, string> &, boost::shared_mutex &, atomic_uint_least64_t *) = 0; virtual void MDDetachStrategy(MStrategy*) = 0; }; #endif <|start_filename|>common/trade_headers/TradePluginContextInterface.h<|end_filename|> #ifndef _COMMONFILES_COMPRETRADESYSTEMHEADERS_TRADEPLUGINCONTEXTINTERFACE_H_ #define _COMMONFILES_COMPRETRADESYSTEMHEADERS_TRADEPLUGINCONTEXTINTERFACE_H_ #include "StrategyData.h" using namespace StrategyData; class MTradePluginContextInterface { public: virtual void OnTrade( TOrderRefIdType, TOrderSysIdType, TPriceType, TVolumeType) = 0; virtual void OnOrder( TOrderRefIdType, TOrderSysIdType, TOrderStatusType, TPriceType, TTradedVolumeType, TRemainVolumeType ) = 0; }; #endif <|start_filename|>trade/trade_plugins/TWS_TDPlugin/TWS_TDPlugin.h<|end_filename|> #ifndef _QFCOMPRETRADESYSTEM_ATMTRADEPLUGINS_TWS_TDPLUGIN_H_ #define _QFCOMPRETRADESYSTEM_ATMTRADEPLUGINS_TWS_TDPLUGIN_H_ #include <boost/thread.hpp> #include <thread> // std::thread #include <mutex> // std::mutex, std::unique_lock #include <condition_variable> // std::condition_variable #include <atomic> #include <boost/asio.hpp> #include <memory> #include <boost/date_time/posix_time/posix_time.hpp> #include <thread> #include <future> #include <tuple> #include <boost/log/common.hpp> #include "AtmTradePluginInterface.h" #include "TradePluginContextInterface.h" #include "TwsApi/TwsApi.h" #include "TwsApi/TwsDataStructDef.h" #include "TwsApi/TwsDataTypeDef.h" #include "TwsApi/TwsSpi.h" #include "SeverityLevel.h" using namespace boost::posix_time; using namespace boost::gregorian; using namespace boost::asio; using namespace std; class CTWS_TDPlugin : public MAtmTradePluginInterface, public CTwsSpi { boost::log::sources::severity_logger< severity_levels > m_Logger; io_service m_IOservice; deadline_timer m_StartAndStopCtrlTimer; std::future<bool> m_futTimerThreadFuture; MTradePluginContextInterface * m_pTradePluginContext = nullptr; MTwsApi * m_pUserApi = nullptr;//Init at Start() string m_strServerAddress;//Init at Start() unsigned int m_uPort;//Init at Start() unsigned int m_uClientID;//Init at Start() bool m_boolIsOnline = false;//Init at Start() unsigned int m_uAccountNumber = 0;//Init at CTWS_TDPlugin() unsigned int m_uRequestID = 0;//Init at Start() unsigned int m_uIncreasePart = 0;//Init at OnRspUserLogin() TTwsOrderIdType m_intNextValidId;//Init at OnRspUserLogin() TTwsTimeType m_LongServerTime;//Init at OnRspUserLogin() char m_strManagedAccounts[64];//Init at OnRspUserLogin() std::mutex m_mtxLoginSignal; condition_variable m_cvLoginSignalCV; std::mutex m_mtxLogoutSignal; condition_variable m_cvLogoutSignalCV; date GetTradeday(ptime _Current); date m_dateTradeDay; boost::shared_mutex m_mtxProtectCancelAmount; map<string, int> m_mapCancelAmount; int m_intInitAmountOfCancelChancesPerDay; public: static const string s_strAccountKeyword; CTWS_TDPlugin(); ~CTWS_TDPlugin(); int m_intRefCount = 0; atomic_bool m_abIsPending; bool IsPedding(); virtual bool IsOnline(); virtual void IncreaseRefCount(); virtual void DescreaseRefCount(); virtual int GetRefCount(); virtual void CheckSymbolValidity(const unordered_map<string, string> &); virtual string GetCurrentKeyword(); virtual string GetProspectiveKeyword(const ptree &); virtual void GetState(ptree & out); virtual void TDInit(const ptree &, MTradePluginContextInterface*, unsigned int AccountNumber); virtual void TDHotUpdate(const ptree &); virtual void TDUnload(); void UpdateAccountInfo(const ptree & in); virtual TOrderRefIdType TDBasicMakeOrder( TOrderType ordertype, unordered_map<string, string> & instrument, TOrderDirectionType direction, TOrderOffsetType offset, TVolumeType volume, TPriceType LimitPrice, TOrderRefIdType orderRefBase ); virtual TLastErrorIdType TDBasicCancelOrder(TOrderRefIdType, unordered_map<string, string> &, TOrderSysIdType); virtual int TDGetRemainAmountOfCancelChances(const char *); private: bool Start(); bool Stop(); void ShowMessage(severity_levels, const char * fmt, ...); void TimerHandler(boost::asio::deadline_timer* timer, const boost::system::error_code& err); virtual void OnRspUserLogin(CTwsRspUserLoginField * loginField, bool IsSucceed); virtual void OnRspError(int ErrID, int ErrCode, const char * ErrMsg); virtual void OnDisconnected(); virtual void OnRtnOrder(CTwsOrderField *); virtual void OnRtnTrade(CTwsTradeField *); }; #endif <|start_filename|>common/SimulateKernelInterface.h<|end_filename|> #pragma once //#include "stdafx.h" #include "StrategyContext.h" #include "StrategyData.h" #include "Tick\Tick.h" #include "SimulateKernelEnvironment.h" #include <vector> #include <unordered_map> #include "TickDataContainer.h" #include "BackTestResult.h" #include <memory> using namespace std; using namespace std::tr1; //AFX_EXT_CLASS #define Simulate_HasMessage (1<<0) #define Simulate_HasProbes (1<<1) #define Simulate_HasOnTickTimeConsuming (1<<2) #define Simulate_HasOrders (1<<3) class AFX_EXT_CLASS MSimulateKernelInterface : public MStrategyContext { public: static MSimulateKernelInterface* CreateSimulateKernel(MSimulateKernelEnvironment *); virtual void StartBackTest( MStrategy* pStrategy,/*IN*/ vector<string> tickFiles, string strInArchiveFile,/*IN*/ string strOutArchiveFile,/*IN*/ const ptree config,/*IN*/ unsigned int flags,/*IN*/ CBackTestResult * /*OUT*/ ) = 0; virtual void Release() = 0; #pragma region StrategyContext virtual bool ShowMessage(TStrategyIdType, const char *, ...) = 0; virtual bool GetNextMeddle(TStrategyIdType, char * retbuffer, unsigned int maxlength) = 0; virtual TOrderRefIdType MakeOrder( TStrategyIdType, TOrderType, TOrderDirectionType, TOrderOffsetType, TVolumeType, TPriceType, TMarketDataIdType, TCustomRefPartType) = 0; virtual TLastErrorIdType CancelOrder( TStrategyIdType, TOrderRefIdType, TOrderSysIdType, TMarketDataIdType) = 0; virtual void UpdateChart() = 0; #pragma endregion }; <|start_filename|>common/StrategyContext.h<|end_filename|> #pragma once #include "StrategyData.h" #include "StrategyInquiryDataInterface.h" #include <functional> using namespace StrategyData; using namespace std; class COrder; class MStrategyContext { public: virtual bool Inquery(TStrategyIdType stid, MStrategyInquiryDataInterface *) = 0; virtual bool MeddleResponse(TStrategyIdType, const char *, ...) = 0; virtual bool ShowMessage(TStrategyIdType, const char *, ...) = 0; virtual bool GetNextMeddle(TStrategyIdType, char * retbuffer,unsigned int maxlength) = 0; virtual TOrderRefIdType MakeOrder( TStrategyIdType, TOrderType, TOrderDirectionType, TOrderOffsetType, TVolumeType, TPriceType, TMarketDataIdType, TCustomRefPartType) = 0; virtual TLastErrorIdType CancelOrder( TStrategyIdType, TOrderRefIdType, TOrderSysIdType, TMarketDataIdType) = 0; virtual void UpdateChart() = 0; virtual bool GetSharedValue(TSharedIndexType i, double & ret) = 0; virtual bool IncreaseSharedValue(TSharedIndexType i,double dt, function<bool(double)>) = 0; virtual bool DecreaseSharedValue(TSharedIndexType i,double dt, function<bool(double)>) = 0; virtual bool SetSharedValue(TSharedIndexType i, double newvalue, function<bool(double)>) = 0; virtual int GetRemainCancelAmount(TStrategyIdType, TMarketDataIdType) = 0; }; <|start_filename|>third/HsStock/HsStockTradeApiInterface.h<|end_filename|> #ifndef _COMMONFILES_HSSTOCK_HSSTOCKTRADEAPIINTERFACE_H_ #define _COMMONFILES_HSSTOCK_HSSTOCKTRADEAPIINTERFACE_H_ #ifdef WIN32 #ifdef _EXPORT #define MD_API_EXPORT __declspec(dllexport) #else #define MD_API_EXPORT __declspec(dllimport) #endif #endif #ifdef LINUX #ifdef _EXPORT #define MD_API_EXPORT __attribute__((visibility("default"))) #else #define MD_API_EXPORT #endif #endif #include "HsStockTradeDataStructs.h" class MHsStockTradeSpi { public: virtual void OnRspWarnning(const CHsStockTradeRspInfoField *pRspInfo) {}; virtual void OnRspError(const CHsStockTradeRspInfoField *pRspInfo) {}; virtual void OnFrontConnected() {}; virtual void OnRspUserLogin(const CHsStockTradeRspUserLoginField * pRsp, const CHsStockTradeRspInfoField *pRspInfo) {}; virtual void OnRspQueryMoney(const CHsStockTradeRspQueryMoneyField * pRsp, const CHsStockTradeRspInfoField *pRspInfo) {}; virtual void OnRspQueryTrade(const CHsStockOutputOrderTradeField * pRsp, const CHsStockTradeRspInfoField *pRspInfo) {}; virtual void OnRspQueryEntrust(const CHsStockOutputOrderEntrustField * pRsp, const CHsStockTradeRspInfoField *pRspInfo) {}; virtual void OnRtnOrder(const CHsStockTradeOrderField *pOrder) {}; virtual void OnRtnTrade(const CHsStockTradeTradeField *pTrade) {}; }; class MD_API_EXPORT MHsStockTradeApiInterface { public: static MHsStockTradeApiInterface * CreateApi(); virtual void Init( long lBranchCode, const char * strAddress, const char * strAddressBackup, unsigned short uPort, MHsStockTradeSpi* spi) = 0; virtual void UnInit() = 0; virtual void Release() = 0; virtual int ReqUserLogin(const char *szAccount, const char *szPassWord) = 0; virtual int ReqQueryMoney() = 0; virtual int ReqOrderInsert(const CHsStockTradeInputOrderField *pInputOrder, long * entrust_no) = 0; virtual void ReqOrderCancel(const CHsStockInputOrderCancelField *pInputOrderAction) = 0; virtual void ReqOrderTrade(const CHsStockInputOrderTradeField *pInputOrderAction) = 0; virtual void ReqOrderEntrust(const CHsStockInputOrderEntrustField *pInputOrderAction) = 0; }; #endif <|start_filename|>common/CrossPlatformDefinitions.h<|end_filename|> #ifndef CrossPlatformDefinitions_H #define CrossPlatformDefinitions_H #include <stdio.h> #ifdef WIN32 #define _WIN32_WINNT 0x0501 #include <windows.h> #define FILE_PATH_SEPARATOR '\\' #define snprintf _snprintf #define LockTypeName CRITICAL_SECTION #define InitLock(name) InitializeCriticalSection(&name) #define Lock(name) EnterCriticalSection(&name) #define UnLock(name) LeaveCriticalSection(&name) #define DelLock(name) DeleteCriticalSection(&name) #define StrategyHandleType HINSTANCE #define LoadStrategyBin(filename) LoadLibrary(filename) #define UnLoadStrategyBin(handle) FreeLibrary(handle) #define GetProcessAddressByName(handle,name) GetProcAddress(handle, name) #else #include <dlfcn.h> #include <pthread.h> #include <linux/unistd.h> #include <sys/syscall.h> #include <iconv.h> #include<fcntl.h> #include<sys/types.h> #include<unistd.h> #define FILE_PATH_SEPARATOR '/' #define LockTypeName LockTypeName #define InitLock(name) pthread_spin_init(&name,PTHREAD_PROCESS_PRIVATE) #define Lock(name) pthread_spin_lock(&name) #define UnLock(name) UnLock(name) #define DelLock(name) pthread_spin_destroy(&name); #define StrategyHandleType void * #define LoadStrategyBin(filename) dlopen(filename,RTLD_NOW) #define UnLoadStrategyBin(handle) dlclose(handle) #define dlsym(handle,name) GetProcAddress(handle, name) #endif #endif <|start_filename|>trade/trade_plugins/TEMPLATE_ANY_TDPlugin/TEMPLATE_ANY_TDPlugin.h<|end_filename|> #ifndef QFCOMPRETRADESYSTEM_ATMTRADEPLUGINS_TEMPLATE_TDPLUGIN_TEMPLATE_ANY_TDPlugin_H_ #define QFCOMPRETRADESYSTEM_ATMTRADEPLUGINS_TEMPLATE_TDPLUGIN_TEMPLATE_ANY_TDPlugin_H_ #include <boost/thread.hpp> #include <thread> // std::thread #include <mutex> // std::mutex, std::unique_lock #include <condition_variable> // std::condition_variable #include <atomic> #include <boost/asio.hpp> #include <memory> #include <boost/date_time/posix_time/posix_time.hpp> #include <thread> #include <future> #include <tuple> #include <boost/log/common.hpp> #include "AtmTradePluginInterface.h" #include "TradePluginContextInterface.h" #include "SeverityLevel.h" using namespace boost::posix_time; using namespace boost::gregorian; using namespace boost::asio; using namespace std; class CTEMPLATE_ANY_TDPlugin : public MAtmTradePluginInterface { boost::log::sources::severity_logger< severity_levels > m_Logger; date GetTradeday(ptime _Current); date m_dateTradeDay; boost::shared_mutex m_mtxProtectCancelAmount; map<string, int> m_mapCancelAmount; int m_intInitAmountOfCancelChancesPerDay; public: static const string s_strAccountKeyword; CTEMPLATE_ANY_TDPlugin(); ~CTEMPLATE_ANY_TDPlugin(); int m_intRefCount = 0; atomic_bool m_abIsPending = false; bool IsPedding(); virtual bool IsOnline(); virtual void IncreaseRefCount(); virtual void DescreaseRefCount(); virtual int GetRefCount(); virtual void CheckSymbolValidity(const unordered_map<string, string> &); virtual string GetCurrentKeyword(); virtual string GetProspectiveKeyword(const ptree &); virtual void GetState(ptree & out); virtual void TDInit(const ptree &, MTradePluginContextInterface*, unsigned int AccountNumber); virtual void TDHotUpdate(const ptree &); virtual void TDUnload(); virtual TOrderRefIdType TDBasicMakeOrder( TOrderType ordertype, unordered_map<string, string> & instrument, TOrderDirectionType direction, TOrderOffsetType offset, TVolumeType volume, TPriceType LimitPrice, TOrderRefIdType orderRefBase ); virtual TLastErrorIdType TDBasicCancelOrder(TOrderRefIdType, unordered_map<string, string> &, TOrderSysIdType); virtual int TDGetRemainAmountOfCancelChances(const char *); private: bool Start(); bool Stop(); void ShowMessage(severity_levels, const char * fmt, ...); void TimerHandler(boost::asio::deadline_timer* timer, const boost::system::error_code& err); }; #endif <|start_filename|>common/trade_headers/SeverityLevel.h<|end_filename|> #ifndef _COMMONFILES_COMPRETRADESYSTEMHEADERS_SEVERITYLEVEL_H_ #define _COMMONFILES_COMPRETRADESYSTEMHEADERS_SEVERITYLEVEL_H_ enum severity_levels { normal, warning, error }; #endif <|start_filename|>strategies/strategy_common/arbitrage_base_future.cpp<|end_filename|> // StrategyDemo.cpp : 定义 DLL 应用程序的导出函数。 // #define _EXPORTS #define EXPORT_STRATEGY #include "StrategyDefine.h" #include "StrategyData.h" #include "Tick.h" #include "StockTick.h" #include <cmath> #include <list> #include <string> #include "Order.h" #include <fstream> #include <atomic> #include "ArbitrageBaseFuture.h" #include "OrderRefResolve.h" #include <numeric> using namespace std; class CInquiryMarkNetCurvePoint :public MStrategyInquiryDataInterface { public: virtual bool ValueToString(char * buf, size_t len) { if (strlen("netcurve") < len - 1) { strncpy(buf, "netcurve", len); return true; } else return false; } virtual void Release() { delete this; }; }; bool CArbitrageBase::IsSupport(TStrategyTickType ticktype) { return true; }; CArbitrageBase::CArbitrageBase(MStrategyContext* context, TStrategyIdType strategyid) : g_pStrategyContext(context), g_StrategyId(strategyid) { if (context == NULL) throw 1; } void CArbitrageBase::OnLoad(const char * fname) { if (nullptr == fname) throw runtime_error("fname is nullptr."); ifstream is(fname, std::ios::binary); if (is.is_open()) { boost::archive::binary_iarchive ia(is); ia >> *this;is.close(); } else throw runtime_error("can not open file."); } void CArbitrageBase::OnSave(const char * fname) { if (nullptr == fname) throw runtime_error("fname is nullptr."); ofstream os(fname, std::ios::binary); if (os.is_open()) { boost::archive::binary_oarchive oa(os); oa << *this;os.close(); } else throw runtime_error("can not open file."); } TLastErrorIdType CArbitrageBase::OnInit(ptime currentTime) { double Value=0.0; if (SHAREDVALUE_GET(m_intSharedValueIndex, Value) == false) { LOG("Can not find shared value index %d", m_intSharedValueIndex); return TLastErrorIdType::LB1_INVALID_VAL; } LOG("Strategy:%d-Valid Copies=%lf",g_StrategyId ,Value); // 全局变量区 m_datePositionTradeDay = ptime(not_a_date_time).date(); /*m_Position[Subtrahend_Index].Init(); m_Position[Minuend_Index].Init();*/ m_Position[Subtrahend_Index].Init(); m_Position[Minuend_Index].Init(); m_ptimeGlobalCurrentTime = min_date_time; m_Order[Subtrahend_Index].Init(); m_Order[Minuend_Index].Init(); m_booIsPedding = false; m_boolHasInitialize[0] = m_boolHasInitialize[1] = false; ShowPosition(); SetPresupposedPosition(currentTime,PresupposedPositionType,PresupposedPositionTradeDayType); return LB1_NO_ERROR; } TLastErrorIdType CArbitrageBase::OnInit_FromArchive(ptime currentTime) { SetPresupposedPosition(currentTime,PresupposedPositionType, PresupposedPositionTradeDayType); ShowPosition(); return LB1_NO_ERROR; } bool CArbitrageBase::OnGetPositionInfo(int *) { return false; }; bool CArbitrageBase::OnGetCustomInfo(char * out_buf, size_t len) { if (0 == GetMinuendPosition().m_uLongPosition && 0 == GetMinuendPosition().m_uShortPosition && 0 == GetSubtrahendPosition().m_uLongPosition && 0 == GetSubtrahendPosition().m_uShortPosition) { snprintf(out_buf, len, "empty"); } else if ( (0 == GetMinuendPosition().m_uLongPosition && 0 != GetMinuendPosition().m_uShortPosition && 0 != GetSubtrahendPosition().m_uLongPosition && 0 == GetSubtrahendPosition().m_uShortPosition) || (0 != GetMinuendPosition().m_uLongPosition && 0 == GetMinuendPosition().m_uShortPosition && 0 == GetSubtrahendPosition().m_uLongPosition && 0 != GetSubtrahendPosition().m_uShortPosition) ) { snprintf(out_buf, len, "M(%.2u|%.2u) S(%.2u|%.2u)", GetMinuendPosition().m_uLongPosition, GetMinuendPosition().m_uShortPosition, GetSubtrahendPosition().m_uLongPosition, GetSubtrahendPosition().m_uShortPosition); } else { snprintf(out_buf, len, "error"); } return true; }; bool CArbitrageBase::OnGetFloatingProfit(double *) { return false; } bool CArbitrageBase::OnGetStatus(char *, size_t) { return false; } void CArbitrageBase::MakeOrder(TTradeSignalType Signal, unsigned int copies, TVolumeType MinuendVolume, TVolumeType SubtrahendVolume) { if (TEnumBuyMinuend_SellSubtrahend_Increase == Signal || TEnumSellMinuend_BuySubtrahend_Increase == Signal) { if (SHAREDVALUE_DEC(m_intSharedValueIndex, copies, [&copies](double c) { return c >= copies; })) { m_uLockedCopies = copies; } else return; } m_Order[Minuend_Index].vol = MinuendVolume; m_Order[Subtrahend_Index].vol = SubtrahendVolume; m_Order[Minuend_Index].dealVol = 0; m_Order[Subtrahend_Index].dealVol = 0; m_booIsPedding = true; switch (Signal) { case TEnumBuyMinuend_SellSubtrahend_Increase://对应于LB1_BuyO { auto temp_ref = g_pStrategyContext->MakeOrder(g_StrategyId, static_cast<TOrderType>(MakeOrderType), LB1_Buy, LB1_Increase, m_Order[Minuend_Index].vol, m_tickData[Minuend_Index].m_dbAskPrice[0] + MinuendBadSlipTickCount*MinuendMinPriceTick, Minuend_Index, 0); if (LB1_NullOrderRef == temp_ref) { if (SHAREDVALUE_INC(m_intSharedValueIndex, copies, [](double) {return true;}) == false) { LOG("Can not increase shared value[%d]", m_intSharedValueIndex); } return; } m_Order[Minuend_Index].inRef = temp_ref; get<TrR_BetTradedList>(m_lstTradedLog[Minuend_Index]).clear(); get<TrR_BetTradedList>(m_lstTradedLog[Subtrahend_Index]).clear(); get<TrR_Direction>(m_lstTradedLog[Minuend_Index]) = LB1_Buy; get<TrR_Direction>(m_lstTradedLog[Subtrahend_Index]) = LB1_Sell; get<TrR_BetTarPrice>(m_lstTradedLog[Minuend_Index]) = m_tickData[Minuend_Index].m_dbAskPrice[0]; get<TrR_BetTime>(m_lstTradedLog[Minuend_Index]) = m_ptimeGlobalCurrentTime; LOG("CustomArbitrageStrategy[%d]: TEnumBuyMinuend_SellSubtrahend_Increase", g_StrategyId); m_Order[Minuend_Index].inSysID = ""; m_Order[Minuend_Index].orderTime = m_ptimeGlobalCurrentTime; m_Order[Minuend_Index].tradeState = T_OI_W; m_Order[Subtrahend_Index].tradeState = T_OI_INI; m_Order[Minuend_Index].direction_In = LB1_Buy; m_Order[Subtrahend_Index].direction_In = LB1_Sell; m_Order[Minuend_Index].direction_Out = LB1_Sell; m_Order[Subtrahend_Index].direction_Out = LB1_Buy; }; break; case TEnumSellMinuend_BuySubtrahend_Increase://对应于LB1_SellO { auto temp_ref = g_pStrategyContext->MakeOrder(g_StrategyId, static_cast<TOrderType>(MakeOrderType), LB1_Sell, LB1_Increase, m_Order[Minuend_Index].vol, m_tickData[Minuend_Index].m_dbBidPrice[0] - MinuendBadSlipTickCount*MinuendMinPriceTick, Minuend_Index, 0); if (LB1_NullOrderRef == temp_ref) { if (SHAREDVALUE_INC(m_intSharedValueIndex, copies, [](double) {return true;}) == false) { LOG("Can not increase shared value[%d]", m_intSharedValueIndex); } return; } m_Order[Minuend_Index].inRef = temp_ref; get<TrR_BetTradedList>(m_lstTradedLog[Minuend_Index]).clear(); get<TrR_BetTradedList>(m_lstTradedLog[Subtrahend_Index]).clear(); get<TrR_Direction>(m_lstTradedLog[Minuend_Index]) = LB1_Sell; get<TrR_Direction>(m_lstTradedLog[Subtrahend_Index]) = LB1_Buy; get<TrR_BetTarPrice>(m_lstTradedLog[Minuend_Index]) = m_tickData[Minuend_Index].m_dbBidPrice[0]; get<TrR_BetTime>(m_lstTradedLog[Minuend_Index]) = m_ptimeGlobalCurrentTime; LOG("CustomArbitrageStrategy[%d]: TEnumSellMinuend_BuySubtrahend_Increase", g_StrategyId); m_Order[Minuend_Index].inSysID = ""; m_Order[Minuend_Index].orderTime = m_ptimeGlobalCurrentTime; m_Order[Minuend_Index].tradeState = T_OI_W; m_Order[Subtrahend_Index].tradeState = T_OI_INI; m_Order[Minuend_Index].direction_In = LB1_Sell; m_Order[Subtrahend_Index].direction_In = LB1_Buy; m_Order[Minuend_Index].direction_Out = LB1_Buy; m_Order[Subtrahend_Index].direction_Out = LB1_Sell; } break; case TEnumBuyMinuend_SellSubtrahend_Descrease://对应于LB1_BuyC { TOrderOffsetType offset; if (GetTradeday(m_ptimeGlobalCurrentTime) == m_datePositionTradeDay) offset = LB1_DecreaseToday; else offset = LB1_Decrease; auto temp_ref = g_pStrategyContext->MakeOrder(g_StrategyId,static_cast<TOrderType>(MakeOrderType), LB1_Buy, offset, m_Order[Minuend_Index].vol, m_tickData[Minuend_Index].m_dbAskPrice[0] + MinuendBadSlipTickCount*MinuendMinPriceTick, Minuend_Index, static_cast<unsigned int>(offset) );//以最新价挂单下单 if (LB1_NullOrderRef == temp_ref) return; m_Order[Minuend_Index].outRef = temp_ref; get<TrR_ClearTradedList>(m_lstTradedLog[Minuend_Index]).clear(); get<TrR_ClearTradedList>(m_lstTradedLog[Subtrahend_Index]).clear(); get<TrR_ClearTarPrice>(m_lstTradedLog[Minuend_Index]) = m_tickData[Minuend_Index].m_dbAskPrice[0]; get<TrR_ClearTime>(m_lstTradedLog[Minuend_Index]) = m_ptimeGlobalCurrentTime; LOG("CustomArbitrageStrategy[%d]: TEnumBuyMinuend_SellSubtrahend_Descrease", g_StrategyId); m_Order[Minuend_Index].outSysID = ""; m_Order[Minuend_Index].orderTime = m_ptimeGlobalCurrentTime; m_Order[Minuend_Index].tradeState = T_OO_W; m_Order[Subtrahend_Index].tradeState = T_OO_INI; m_Order[Minuend_Index].direction_In = LB1_Sell; m_Order[Subtrahend_Index].direction_In = LB1_Buy; m_Order[Minuend_Index].direction_Out = LB1_Buy; m_Order[Subtrahend_Index].direction_Out = LB1_Sell; }; break; case TEnumSellMinuend_BuySubtrahend_Descrease://对应于LB1_SellC { TOrderOffsetType offset; if (GetTradeday(m_ptimeGlobalCurrentTime) == m_datePositionTradeDay) offset = LB1_DecreaseToday; else offset = LB1_Decrease; auto temp_ref = g_pStrategyContext->MakeOrder(g_StrategyId,static_cast<TOrderType>(MakeOrderType), LB1_Sell, offset, m_Order[Minuend_Index].vol, m_tickData[Minuend_Index].m_dbBidPrice[0] - MinuendBadSlipTickCount*MinuendMinPriceTick, Minuend_Index, static_cast<unsigned int>(offset) );//以最新价挂单下单 if (LB1_NullOrderRef == temp_ref) return; m_Order[Minuend_Index].outRef = temp_ref; get<TrR_ClearTradedList>(m_lstTradedLog[Minuend_Index]).clear(); get<TrR_ClearTradedList>(m_lstTradedLog[Subtrahend_Index]).clear(); get<TrR_ClearTarPrice>(m_lstTradedLog[Minuend_Index]) = m_tickData[Minuend_Index].m_dbBidPrice[0]; get<TrR_ClearTime>(m_lstTradedLog[Minuend_Index]) = m_ptimeGlobalCurrentTime; LOG("CustomArbitrageStrategy[%d]: TEnumSellMinuend_BuySubtrahend_Descrease", g_StrategyId); m_Order[Minuend_Index].outSysID = ""; m_Order[Minuend_Index].orderTime = m_ptimeGlobalCurrentTime; m_Order[Minuend_Index].tradeState = T_OO_W; m_Order[Subtrahend_Index].tradeState = T_OO_INI; m_Order[Minuend_Index].direction_In = LB1_Buy; m_Order[Subtrahend_Index].direction_In = LB1_Sell; m_Order[Minuend_Index].direction_Out = LB1_Sell; m_Order[Subtrahend_Index].direction_Out = LB1_Buy; }; break; default:break; } } bool CArbitrageBase::CanExcute() { return false == m_booIsPedding; } bool CArbitrageBase::ParamAndProbeInit(CParNode * ParamStruct, TProbeStructType ProbeStruct) { unsigned int m_uProbeBeginIndex = 0; unsigned int m_uParamBeginIndex = 0; if (NULL == ParamStruct) return false; m_uParamBeginIndex = 0; while (strlen(m_array2ParameterStruct[m_uParamBeginIndex].m_arrayParname) != 0) m_uParamBeginIndex++; for (auto i = m_uParamBeginIndex;i < MAXPARCOUNT;i++) { m_array2ParameterStruct[i] = (*(ParamStruct + i - m_uParamBeginIndex)); if (strlen(m_array2ParameterStruct[i].m_arrayParname)==0) break; } if (ProbeStruct == NULL) return false; m_uProbeBeginIndex = 0; while (NULL != m_array2ProbeStruct[m_uProbeBeginIndex][0].m_AtomicDoublePointer) m_uProbeBeginIndex++; for (auto i = m_uProbeBeginIndex;i < MAX_GRAPH_COUNT;i++) { for (auto t = 0;t < MAX_SERIAL_PER_GRAPH;t++) { m_array2ProbeStruct[i][t] = (*(ProbeStruct + (i - m_uProbeBeginIndex)))[t]; if (NULL == m_array2ProbeStruct[i][t].m_AtomicDoublePointer) break; } if (NULL == m_array2ProbeStruct[i][0].m_AtomicDoublePointer) break; }; return true; } CPosition & CArbitrageBase::GetMinuendPosition() { return m_Position[Minuend_Index]; } CPosition & CArbitrageBase::GetSubtrahendPosition() { return m_Position[Subtrahend_Index]; } CFutureTick & CArbitrageBase::GetMinuendTick() { return m_tickData[Minuend_Index]; } CFutureTick & CArbitrageBase::GetSubtrahendTick() { return m_tickData[Subtrahend_Index]; } TPriceType CArbitrageBase::GetMinuendMinPriceTick() { return MinuendMinPriceTick; } TPriceType CArbitrageBase::GetSubtrahendMinPriceTick() { return SubtrahendMinPriceTick; } int CArbitrageBase::GetMinuendMultipNumber() { return m_intMinuendMultipNumber; } int CArbitrageBase::GetSubtrahendMultipNumber() { return m_intSubtrahendMultipNumber; } bool CArbitrageBase::IsTwoLegHasInited() { if (false == m_boolHasInitialize[0] || false == m_boolHasInitialize[1]) return false; else return true; } void CArbitrageBase::ShowPosition() { double Value = 0.0; if (SHAREDVALUE_GET(m_intSharedValueIndex, Value) == false) LOG("Can not find shared value index %d", m_intSharedValueIndex); else LOG("Strategy[%d]: ValidCopies[%d]=%lf,WriteCsv=%d", g_StrategyId,m_intSharedValueIndex, Value, WriteCsv); LOG("Strategy[%d]: PositionTime:%s", g_StrategyId, to_simple_string(m_datePositionTradeDay).c_str()); LOG("Strategy[%d]: Minuend [Long:%d(%.2lf)][Short:%d(%.2lf)]", g_StrategyId, GetMinuendPosition().m_uLongPosition, GetMinuendPosition().m_dbLongTurnover, GetMinuendPosition().m_uShortPosition, GetMinuendPosition().m_dbShortTurnover ); LOG("Strategy[%d]: Subtrahend [Long:%d(%.2lf)][Short:%d(%.2lf)]", g_StrategyId, GetSubtrahendPosition().m_uLongPosition, GetSubtrahendPosition().m_dbLongTurnover, GetSubtrahendPosition().m_uShortPosition, GetSubtrahendPosition().m_dbShortTurnover ); } void CArbitrageBase::SetPresupposedPosition(ptime _ptimeGlobalT,int _PresupposedPositionType, int _PresupposedPositionTradeDayType) { if (PresupposedPosition_Default != _PresupposedPositionType) {//有预设仓位 GetMinuendPosition().Init(); GetSubtrahendPosition().Init(); if (PresupposedPosition_MinuendLong_SubtrahendShort == _PresupposedPositionType) { GetMinuendPosition().m_uLongPosition = 1; GetSubtrahendPosition().m_uShortPosition = 1; if (PresupposedPositionTradeDay_Today == _PresupposedPositionTradeDayType) { if (_ptimeGlobalT.time_of_day() < time_duration(13, 0, 0, 0)) m_datePositionTradeDay = _ptimeGlobalT.date(); else { if(_ptimeGlobalT.date().day_of_week() == Friday) m_datePositionTradeDay = _ptimeGlobalT.date() + days(3); else m_datePositionTradeDay = _ptimeGlobalT.date() + days(1); } } else if (PresupposedPositionTradeDay_Yesterday == _PresupposedPositionTradeDayType) { if (_ptimeGlobalT.time_of_day() < time_duration(13, 0, 0, 0)) m_datePositionTradeDay = _ptimeGlobalT.date() - days(1); else m_datePositionTradeDay = _ptimeGlobalT.date(); } } else if (PresupposedPosition_MinuendShort_SubtrahendLong == _PresupposedPositionType) { GetMinuendPosition().m_uShortPosition = 1; GetSubtrahendPosition().m_uLongPosition = 1; if (PresupposedPositionTradeDay_Today == _PresupposedPositionTradeDayType) { if (_ptimeGlobalT.time_of_day() < time_duration(13, 0, 0, 0)) m_datePositionTradeDay = _ptimeGlobalT.date(); else { if (_ptimeGlobalT.date().day_of_week() == Friday) m_datePositionTradeDay = _ptimeGlobalT.date() + days(3); else m_datePositionTradeDay = _ptimeGlobalT.date() + days(1); } } else if (PresupposedPositionTradeDay_Yesterday == _PresupposedPositionTradeDayType) { if (_ptimeGlobalT.time_of_day() < time_duration(13, 0, 0, 0)) m_datePositionTradeDay = _ptimeGlobalT.date() - days(1); else m_datePositionTradeDay = _ptimeGlobalT.date(); } } ShowPosition(); } } string CArbitrageBase::GetLogFileName() { char buf[64]; sprintf(buf, "%d-%s.csv", g_StrategyId, to_iso_string(m_ptimeGlobalCurrentTime.date()).c_str()); return buf; } date CArbitrageBase::GetTradeday(ptime _Current) { if (_Current.time_of_day() < time_duration(12, 0, 0, 0))//这个地方不要卡的太死 return _Current.date(); else { if(_Current.date().day_of_week().as_enum() == Friday) return _Current.date() + days(3); else return _Current.date() + days(1); } } void CArbitrageBase::OnTick(TMarketDataIdType dataid, const CTick * pDepthMarketData) { if (0 != dataid && 1 != dataid)//双腿策略 return; if (pDepthMarketData->m_dbAskPrice[0] <= 0 || pDepthMarketData->m_dbAskPrice[0] >= 10e9 || pDepthMarketData->m_dbBidPrice[0] <= 0 || pDepthMarketData->m_dbBidPrice[0] >= 10e9 || pDepthMarketData->m_dbLastPrice <= 0 || pDepthMarketData->m_dbLastPrice >= 10e9 ) { //LOG("Strategy[%d]: dataid(%d) error", g_StrategyId, dataid); } else { m_boolHasInitialize[dataid] = true; m_tickData[dataid] = *static_cast<const CFutureTick*>(pDepthMarketData); } if (false == m_boolHasInitialize[0] || false == m_boolHasInitialize[1]) return; m_ptimeGlobalCurrentTime = max(m_ptimeGlobalCurrentTime, pDepthMarketData->m_datetimeUTCDateTime); // 撤单!! if ( (m_Order[Subtrahend_Index].tradeState == T_OI_W) && (m_ptimeGlobalCurrentTime - m_Order[Subtrahend_Index].orderTime > milliseconds(OrderWaitTime)) && (m_Order[Subtrahend_Index].inSysID.size() > 0) ) CANCEL(m_Order[Subtrahend_Index].inRef,(char*)m_Order[Subtrahend_Index].inSysID.c_str(), 0); if ( (m_Order[Subtrahend_Index].tradeState == T_OO_W) && (m_ptimeGlobalCurrentTime - m_Order[Subtrahend_Index].orderTime > milliseconds(OrderWaitTime)) && (m_Order[Subtrahend_Index].outSysID.size() > 0) ) CANCEL(m_Order[Subtrahend_Index].outRef,(char*)m_Order[Subtrahend_Index].outSysID.c_str(), 0); if ( (m_Order[Minuend_Index].tradeState == T_OI_W) && (m_ptimeGlobalCurrentTime - m_Order[Minuend_Index].orderTime > milliseconds(OrderWaitTime)) && (m_Order[Minuend_Index].inSysID.size() > 0) ) CANCEL(m_Order[Minuend_Index].inRef,(char*)m_Order[Minuend_Index].inSysID.c_str(), 1); if ( (m_Order[Minuend_Index].tradeState == T_OO_W) && (m_ptimeGlobalCurrentTime - m_Order[Minuend_Index].orderTime > milliseconds(OrderWaitTime)) && (m_Order[Minuend_Index].outSysID.size() > 0) ) CANCEL(m_Order[Minuend_Index].outRef,(char*)m_Order[Minuend_Index].outSysID.c_str(), 1); //结算重置 if ( m_Order[Subtrahend_Index].tradeState == T_OI_F && m_Order[Minuend_Index].tradeState == T_OI_F ) { m_Order[Subtrahend_Index].tradeState = T_INI;//T_OO_INI m_Order[Minuend_Index].tradeState = T_INI; m_booIsPedding=false; m_datePositionTradeDay = GetTradeday(m_ptimeGlobalCurrentTime); ShowPosition(); } if ( ( m_Order[Subtrahend_Index].tradeState == T_OO_INI && m_Order[Minuend_Index].tradeState == T_OO_INI) || (m_Order[Subtrahend_Index].tradeState == T_OI_INI && m_Order[Minuend_Index].tradeState == T_OI_INI ) ) { m_Order[Subtrahend_Index].tradeState = T_INI; m_Order[Minuend_Index].tradeState = T_INI; m_booIsPedding = false; m_Order[Subtrahend_Index].inSysID = ""; m_Order[Subtrahend_Index].outSysID = ""; m_Order[Minuend_Index].inSysID = ""; m_Order[Minuend_Index].outSysID = ""; } if ( m_Order[Subtrahend_Index].tradeState == T_OO_F && m_Order[Minuend_Index].tradeState == T_OO_F ) { m_Order[Subtrahend_Index].tradeState = T_INI; m_Order[Minuend_Index].tradeState = T_INI; m_booIsPedding = false; if (SHAREDVALUE_INC(m_intSharedValueIndex, m_uLockedCopies, [](double) {return true;}) == false) { LOG("Can not increase shared value[%d]", m_intSharedValueIndex); } double GainAndLose = 0; if ( abs(m_Position[Minuend_Index].m_dbLongTurnover) > 10e-8 || abs(m_Position[Subtrahend_Index].m_dbShortTurnover) > 10e-8 ) {//如果Minuend持有多头,Subtrahend就持有空头->做多价差 GainAndLose = m_Position[Subtrahend_Index].m_dbShortTurnover*GetSubtrahendMultipNumber() - m_Position[Minuend_Index].m_dbLongTurnover*GetMinuendMultipNumber(); } else { GainAndLose = m_Position[Minuend_Index].m_dbShortTurnover*GetMinuendMultipNumber() - m_Position[Subtrahend_Index].m_dbLongTurnover*GetSubtrahendMultipNumber(); } double MinuendFee = m_Position[Minuend_Index].m_dbAccuFee[0] + m_Position[Minuend_Index].m_dbAccuFee[1] + m_Position[Minuend_Index].m_dbAccuFee[2] + m_Position[Minuend_Index].m_dbAccuFee[3]; double SubtrahendFee = m_Position[Subtrahend_Index].m_dbAccuFee[0] + m_Position[Subtrahend_Index].m_dbAccuFee[1] + m_Position[Subtrahend_Index].m_dbAccuFee[2] + m_Position[Subtrahend_Index].m_dbAccuFee[3]; ptime MinuendBetTime = get<TrR_BetTime>(m_lstTradedLog[Minuend_Index]); //ptime SubtrahendBetTime = get<TrR_BetTime>(m_lstTradedLog[Subtrahend_Index]); ptime MinuendClearTime = get<TrR_ClearTime>(m_lstTradedLog[Minuend_Index]); //ptime SubtrahendClearTime = get<TrR_ClearTime>(m_lstTradedLog[Subtrahend_Index]); // 入场价格 TPriceType MinuendBetTarPrice = get<TrR_BetTarPrice>(m_lstTradedLog[Minuend_Index]); TPriceType SubtrahendBetTarPrice = get<TrR_BetTarPrice>(m_lstTradedLog[Subtrahend_Index]); TVolumeType MinuendBetTradedVolume= accumulate( get<TrR_BetTradedList>(m_lstTradedLog[Minuend_Index]).begin(), get<TrR_BetTradedList>(m_lstTradedLog[Minuend_Index]).end(), 0, [](int a, list< pair<TPriceType, TVolumeType> >::value_type & b)->int { return a + b.second; }); TPriceType MinuendBetTradedPrice = accumulate( get<TrR_BetTradedList>(m_lstTradedLog[Minuend_Index]).begin(), get<TrR_BetTradedList>(m_lstTradedLog[Minuend_Index]).end(), 0.0, [](double a, list< pair<TPriceType, TVolumeType> >::value_type & b)->double { return a + b.first*static_cast<double>(b.second); }) / MinuendBetTradedVolume; TVolumeType SubtrahendBetTradedVolume= accumulate( get<TrR_BetTradedList>(m_lstTradedLog[Subtrahend_Index]).begin(), get<TrR_BetTradedList>(m_lstTradedLog[Subtrahend_Index]).end(), 0, [](int a, list< pair<TPriceType, TVolumeType> >::value_type & b)->int { return a + b.second; }); TPriceType SubtrahendBetTradedPrice = accumulate( get<TrR_BetTradedList>(m_lstTradedLog[Subtrahend_Index]).begin(), get<TrR_BetTradedList>(m_lstTradedLog[Subtrahend_Index]).end(), 0.0, [](double a, list< pair<TPriceType, TVolumeType> >::value_type & b)->double { return a + b.first*static_cast<double>(b.second); }) / SubtrahendBetTradedVolume; // 出场价格 TPriceType MinuendClearTarPrice = get<TrR_ClearTarPrice>(m_lstTradedLog[Minuend_Index]); TPriceType SubtrahendClearTarPrice = get<TrR_ClearTarPrice>(m_lstTradedLog[Subtrahend_Index]); TVolumeType MinuendClearTradedVolume= accumulate( get<TrR_ClearTradedList>(m_lstTradedLog[Minuend_Index]).begin(), get<TrR_ClearTradedList>(m_lstTradedLog[Minuend_Index]).end(), 0, [](int a, list< pair<TPriceType, TVolumeType> >::value_type & b)->int { return a + b.second; }); TPriceType MinuendClearTradedPrice = accumulate( get<TrR_ClearTradedList>(m_lstTradedLog[Minuend_Index]).begin(), get<TrR_ClearTradedList>(m_lstTradedLog[Minuend_Index]).end(), 0.0, [](double a, list< pair<TPriceType, TVolumeType> >::value_type & b)->double { return a + b.first*static_cast<double>(b.second); }) / MinuendClearTradedVolume; TVolumeType SubtrahendClearTradedVolume= accumulate( get<TrR_ClearTradedList>(m_lstTradedLog[Subtrahend_Index]).begin(), get<TrR_ClearTradedList>(m_lstTradedLog[Subtrahend_Index]).end(), 0, [](int a, list< pair<TPriceType, TVolumeType> >::value_type & b)->int { return a + b.second; }); TPriceType SubtrahendClearTradedPrice = accumulate( get<TrR_ClearTradedList>(m_lstTradedLog[Subtrahend_Index]).begin(), get<TrR_ClearTradedList>(m_lstTradedLog[Subtrahend_Index]).end(), 0.0, [](double a, list< pair<TPriceType, TVolumeType> >::value_type & b)->double { return a + b.first*static_cast<double>(b.second); }) / SubtrahendClearTradedVolume; //表头:操作类型,净利润,损益,M手续费,S手续费,M入场滑点,S入场滑点,M出场滑点,S出场滑点, //M入场时间,M出场时间,M手数,S手数,M入场盘口,M入场均价,S入场盘口,S入场均价,M出场盘口,M出场均价,S出场盘口,S出场均价 char buf[2048]; sprintf(buf, "%s,%.4lf,%.4lf,%.4lf,%.4lf,%.4lf,%.4lf,%.4lf,%.4lf,%s,%s,%d,%d,%.4lf,%.4lf,%.4lf,%.4lf,%.4lf,%.4lf,%.4lf,%.4lf", get<TrR_Direction>(m_lstTradedLog[Minuend_Index])==LB1_Buy?"BetRise":"BetDrop", GainAndLose - MinuendFee- SubtrahendFee, GainAndLose, MinuendFee, SubtrahendFee, abs(MinuendBetTarPrice- MinuendBetTradedPrice), abs(SubtrahendBetTarPrice - SubtrahendBetTradedPrice), abs(MinuendClearTarPrice - MinuendClearTradedPrice), abs(SubtrahendClearTarPrice - SubtrahendClearTradedPrice), to_iso_string(MinuendBetTime).c_str(), to_iso_string(MinuendClearTime).c_str(), MinuendBetTradedVolume, SubtrahendBetTradedVolume, MinuendBetTarPrice, MinuendBetTradedPrice, SubtrahendBetTarPrice, SubtrahendBetTradedPrice, MinuendClearTarPrice, MinuendClearTradedPrice, SubtrahendClearTarPrice,SubtrahendClearTradedPrice); LOG(buf); MEDDLERESPONSE(buf); if (WriteCsv != 0) { ofstream log(GetLogFileName(), ios::app); if (log.is_open()) { log << buf << endl; log.close(); } } m_Position[Minuend_Index].Init(); m_Position[Subtrahend_Index].Init(); ShowPosition(); INQUIRY(new CInquiryMarkNetCurvePoint()); } } void CArbitrageBase::OnTrade( TOrderRefIdType ref, TOrderSysIdType sys, TVolumeType volume, TPriceType price, TOrderDirectionType dir, TOrderOffsetType offset) { if (ref == m_Order[Minuend_Index].outRef) { get<TrR_ClearTradedList>(m_lstTradedLog[Minuend_Index]).push_back(make_pair(price, volume)); if (m_Order[Subtrahend_Index].tradeState == T_OO_INI) { m_Order[Subtrahend_Index].outRef = g_pStrategyContext->MakeOrder(g_StrategyId,static_cast<TOrderType>(MakeOrderType), m_Order[Subtrahend_Index].direction_Out, static_cast<TOrderOffsetType>(_OrderRef2StrategyCustomPart(ref)),//LB1_Decrease, m_Order[Subtrahend_Index].vol, (LB1_Buy == m_Order[Subtrahend_Index].direction_Out ? m_tickData[Subtrahend_Index].m_dbAskPrice[0] + SubtrahendBadSlipTickCount*SubtrahendMinPriceTick : m_tickData[Subtrahend_Index].m_dbBidPrice[0] - SubtrahendBadSlipTickCount*SubtrahendMinPriceTick ), Subtrahend_Index, _OrderRef2StrategyCustomPart(ref)); get<TrR_ClearTarPrice>(m_lstTradedLog[Subtrahend_Index]) = (LB1_Buy == m_Order[Subtrahend_Index].direction_Out ? m_tickData[Subtrahend_Index].m_dbAskPrice[0] : m_tickData[Subtrahend_Index].m_dbBidPrice[0] ); get<TrR_ClearTime>(m_lstTradedLog[Subtrahend_Index]) = m_ptimeGlobalCurrentTime; m_Order[Subtrahend_Index].outSysID = ""; m_Order[Subtrahend_Index].orderTime = m_ptimeGlobalCurrentTime; m_Order[Subtrahend_Index].tradeState = T_OO_W; } m_Order[Minuend_Index].dealVol += volume; if (LB1_Buy == m_Order[Minuend_Index].direction_Out) { m_Position[Minuend_Index].m_dbShortTurnover -= price*volume; m_Position[Minuend_Index].m_uShortPosition -= volume; } else { m_Position[Minuend_Index].m_dbLongTurnover -= price*volume; m_Position[Minuend_Index].m_uLongPosition -= volume; } auto Offset = static_cast<TOrderOffsetType>(_OrderRef2StrategyCustomPart(ref)); m_Position[Minuend_Index].m_dbAccuFee[Offset] += FEE_TYPE_FIX == m_intFeeType[Minuend_Index] ? m_dbFeeRatio[Offset][Minuend_Index] * volume : m_dbFeeRatio[Offset][Minuend_Index] * price*volume*m_intMinuendMultipNumber; if (m_Order[Minuend_Index].dealVol >= m_Order[Minuend_Index].vol) m_Order[Minuend_Index].tradeState = T_OO_F; } else if (ref == m_Order[Minuend_Index].inRef) { get<TrR_BetTradedList>(m_lstTradedLog[Minuend_Index]).push_back(make_pair(price, volume)); if (m_Order[Subtrahend_Index].tradeState == T_OI_INI) { m_Order[Subtrahend_Index].inRef = g_pStrategyContext->MakeOrder(g_StrategyId,static_cast<TOrderType>(MakeOrderType), m_Order[Subtrahend_Index].direction_In, LB1_Increase, m_Order[Subtrahend_Index].vol, (LB1_Buy == m_Order[Subtrahend_Index].direction_In ? m_tickData[Subtrahend_Index].m_dbAskPrice[0] + SubtrahendBadSlipTickCount*SubtrahendMinPriceTick : m_tickData[Subtrahend_Index].m_dbBidPrice[0] - SubtrahendBadSlipTickCount*SubtrahendMinPriceTick ), Subtrahend_Index,0); get<TrR_BetTarPrice>(m_lstTradedLog[Subtrahend_Index]) = (LB1_Buy == m_Order[Subtrahend_Index].direction_In ? m_tickData[Subtrahend_Index].m_dbAskPrice[0] : m_tickData[Subtrahend_Index].m_dbBidPrice[0] ); get<TrR_BetTime>(m_lstTradedLog[Subtrahend_Index]) = m_ptimeGlobalCurrentTime; m_Order[Subtrahend_Index].inSysID = ""; m_Order[Subtrahend_Index].orderTime = m_ptimeGlobalCurrentTime; m_Order[Subtrahend_Index].tradeState = T_OI_W; } m_Order[Minuend_Index].dealVol += volume; if (LB1_Buy == m_Order[Minuend_Index].direction_In) { m_Position[Minuend_Index].m_dbLongTurnover += price*volume; m_Position[Minuend_Index].m_uLongPosition += volume; } else { m_Position[Minuend_Index].m_dbShortTurnover += price*volume; m_Position[Minuend_Index].m_uShortPosition += volume; } auto Offset = static_cast<TOrderOffsetType>(_OrderRef2StrategyCustomPart(ref)); m_Position[Minuend_Index].m_dbAccuFee[Offset] += FEE_TYPE_FIX == m_intFeeType[Minuend_Index] ? m_dbFeeRatio[Offset][Minuend_Index] * volume : m_dbFeeRatio[Offset][Minuend_Index] * price*volume*m_intMinuendMultipNumber; if (m_Order[Minuend_Index].dealVol >= m_Order[Minuend_Index].vol) m_Order[Minuend_Index].tradeState = T_OI_F; } else if (ref == m_Order[Subtrahend_Index].outRef) { get<TrR_ClearTradedList>(m_lstTradedLog[Subtrahend_Index]).push_back(make_pair(price, volume)); m_Order[Subtrahend_Index].dealVol += volume; if (LB1_Buy == m_Order[Subtrahend_Index].direction_Out) { m_Position[Subtrahend_Index].m_dbShortTurnover -= price*volume; m_Position[Subtrahend_Index].m_uShortPosition -= volume; } else { m_Position[Subtrahend_Index].m_dbLongTurnover -= price*volume; m_Position[Subtrahend_Index].m_uLongPosition -= volume; } auto Offset = static_cast<TOrderOffsetType>(_OrderRef2StrategyCustomPart(ref)); m_Position[Subtrahend_Index].m_dbAccuFee[Offset] += FEE_TYPE_FIX == m_intFeeType[Subtrahend_Index] ? m_dbFeeRatio[Offset][Subtrahend_Index] * volume : m_dbFeeRatio[Offset][Subtrahend_Index] * price * volume * m_intSubtrahendMultipNumber; if (m_Order[Subtrahend_Index].dealVol >= m_Order[Subtrahend_Index].vol) m_Order[Subtrahend_Index].tradeState = T_OO_F; } else if (ref == m_Order[Subtrahend_Index].inRef) { get<TrR_BetTradedList>(m_lstTradedLog[Subtrahend_Index]).push_back(make_pair(price, volume)); m_Order[Subtrahend_Index].dealVol += volume; if (LB1_Buy == m_Order[Subtrahend_Index].direction_In) { m_Position[Subtrahend_Index].m_dbLongTurnover += price*volume; m_Position[Subtrahend_Index].m_uLongPosition += volume; } else { m_Position[Subtrahend_Index].m_dbShortTurnover += price*volume; m_Position[Subtrahend_Index].m_uShortPosition += volume; } auto Offset = static_cast<TOrderOffsetType>(_OrderRef2StrategyCustomPart(ref)); m_Position[Subtrahend_Index].m_dbAccuFee[Offset] += FEE_TYPE_FIX == m_intFeeType[Subtrahend_Index] ? m_dbFeeRatio[Offset][Subtrahend_Index] * volume : m_dbFeeRatio[Offset][Subtrahend_Index] * price*volume*m_intSubtrahendMultipNumber; if (m_Order[Subtrahend_Index].dealVol >= m_Order[Subtrahend_Index].vol) m_Order[Subtrahend_Index].tradeState = T_OI_F; } else { LOG("[!][OnTrade][!four]ThisRef=%d m_Order[Minuend_Index].outRef=%d m_Order[Minuend_Index].inRef=%d m_Order[Subtrahend_Index].outRef=%d m_Order[Subtrahend_Index].inRef=%d", ref, m_Order[Minuend_Index].outRef, m_Order[Minuend_Index].inRef, m_Order[Subtrahend_Index].outRef, m_Order[Subtrahend_Index].inRef ); LOG("[!][OnTrade][!four]ThisRef=%d m_Order[Minuend_Index].dealVol=%d m_Order[Minuend_Index].dealVol=%d m_Order[Subtrahend_Index].dealVol=%d m_Order[Subtrahend_Index].dealVol=%d", ref, m_Order[Minuend_Index].dealVol, m_Order[Minuend_Index].dealVol, m_Order[Subtrahend_Index].dealVol, m_Order[Subtrahend_Index].dealVol ); } } void CArbitrageBase::OnOrder( TOrderRefIdType ref, TOrderSysIdType sysId, TOrderDirectionType direction, TOrderStatusType Status, TPriceType LimitPrice, TTradedVolumeType VolumeTraded, TRemainVolumeType VolumeRemain) { if (Status == LB1_StatusCanceled) { if (ref==m_Order[Minuend_Index].inRef) { if (VolumeTraded == 0 && m_Order[Minuend_Index].dealVol == 0) { m_Order[Minuend_Index].tradeState = T_OI_INI; m_Order[Subtrahend_Index].tradeState = T_OI_INI; if (SHAREDVALUE_INC(m_intSharedValueIndex, m_uLockedCopies, [](double) {return true;}) == false) { LOG("Can not increase shared value[%d]", m_intSharedValueIndex); } } else { m_Order[Minuend_Index].inRef = g_pStrategyContext->MakeOrder(g_StrategyId,static_cast<TOrderType>(MakeOrderType), m_Order[Minuend_Index].direction_In, LB1_Increase, VolumeRemain, LB1_Buy == m_Order[Minuend_Index].direction_In ? m_tickData[Minuend_Index].m_dbAskPrice[0] + (MinuendBadSlipTickCount + 1) * MinuendMinPriceTick : m_tickData[Minuend_Index].m_dbBidPrice[0] - (MinuendBadSlipTickCount + 1) * MinuendMinPriceTick, Minuend_Index,0); m_Order[Minuend_Index].inSysID = ""; m_Order[Minuend_Index].orderTime = m_ptimeGlobalCurrentTime; } return; } else if (ref==m_Order[Minuend_Index].outRef) { if (VolumeTraded == 0 && m_Order[Minuend_Index].dealVol == 0) { m_Order[Minuend_Index].tradeState = T_OO_INI; m_Order[Subtrahend_Index].tradeState = T_OO_INI; } else { m_Order[Minuend_Index].outRef = g_pStrategyContext->MakeOrder(g_StrategyId,static_cast<TOrderType>(MakeOrderType),//bug20150715 m_Order[Minuend_Index].direction_Out,//bug20150715 static_cast<TOrderOffsetType>(_OrderRef2StrategyCustomPart(ref)), //LB1_Decrease, VolumeRemain, LB1_Buy == m_Order[Minuend_Index].direction_Out ? m_tickData[Minuend_Index].m_dbAskPrice[0] + (MinuendBadSlipTickCount + 1) * MinuendMinPriceTick : m_tickData[Minuend_Index].m_dbBidPrice[0] - (MinuendBadSlipTickCount + 1) * MinuendMinPriceTick, 1, _OrderRef2StrategyCustomPart(ref)); m_Order[Minuend_Index].outSysID = ""; m_Order[Minuend_Index].orderTime = m_ptimeGlobalCurrentTime; } return; } else if (ref==m_Order[Subtrahend_Index].inRef) { m_Order[Subtrahend_Index].inRef = g_pStrategyContext->MakeOrder(g_StrategyId,static_cast<TOrderType>(MakeOrderType), m_Order[Subtrahend_Index].direction_In, LB1_Increase, VolumeRemain, LB1_Buy == m_Order[Subtrahend_Index].direction_In ? m_tickData[Subtrahend_Index].m_dbAskPrice[0] + (SubtrahendBadSlipTickCount+1) * SubtrahendMinPriceTick : m_tickData[Subtrahend_Index].m_dbBidPrice[0] - (SubtrahendBadSlipTickCount+1) * SubtrahendMinPriceTick, Subtrahend_Index,0); m_Order[Subtrahend_Index].inSysID = ""; m_Order[Subtrahend_Index].orderTime = m_ptimeGlobalCurrentTime; return; } else if (ref==m_Order[Subtrahend_Index].outRef) { m_Order[Subtrahend_Index].outRef = g_pStrategyContext->MakeOrder(g_StrategyId,static_cast<TOrderType>(MakeOrderType), m_Order[Subtrahend_Index].direction_Out, static_cast<TOrderOffsetType>(_OrderRef2StrategyCustomPart(ref)),//LB1_Decrease, VolumeRemain, LB1_Buy == m_Order[Subtrahend_Index].direction_Out ? m_tickData[Subtrahend_Index].m_dbAskPrice[0] + (SubtrahendBadSlipTickCount+1) * SubtrahendMinPriceTick : m_tickData[Subtrahend_Index].m_dbBidPrice[0] - (SubtrahendBadSlipTickCount+1) * SubtrahendMinPriceTick, 0, _OrderRef2StrategyCustomPart(ref)); m_Order[Subtrahend_Index].outSysID = ""; m_Order[Subtrahend_Index].orderTime = m_ptimeGlobalCurrentTime; return; } } else { if (ref == m_Order[Subtrahend_Index].inRef) m_Order[Subtrahend_Index].inSysID = sysId; else if (ref == m_Order[Subtrahend_Index].outRef) m_Order[Subtrahend_Index].outSysID = sysId; else if (ref == m_Order[Minuend_Index].inRef) m_Order[Minuend_Index].inSysID = sysId; else if (ref == m_Order[Minuend_Index].outRef) m_Order[Minuend_Index].outSysID = sysId; } } void CArbitrageBase::OnEndup() { } void CArbitrageBase::OnRelease() { delete this; } CArbitrageBase::~CArbitrageBase() {} <|start_filename|>strategies/arbitrage_future/arbitrage_future.cpp<|end_filename|> #include "ArbitrageBaseFuture.h" #include <numeric> #include <tuple> #include "boost/serialization/serialization.hpp" #include "boost/archive/binary_oarchive.hpp" #include "boost/archive/binary_iarchive.hpp" #include "boost/serialization/export.hpp" #include "boost/serialization/vector.hpp" #include "boost/serialization/deque.hpp" #include "boost/serialization/map.hpp" #include "boost/serialization/split_member.hpp" #include "boost/serialization/utility.hpp" #include <functional> using namespace std; #define UpperI 0 #define LowerI 1 #define LastI 2 namespace boost { namespace serialization { template<class Archive, class F, class S, class T> inline void serialize( Archive & ar, std::tuple<F, S, T> & p, const unsigned int ) { ar & get<0>(p); ar & get<1>(p); ar & get<2>(p); } } } class CMyStrategy : public CArbitrageBase { public: CMyStrategy(); CMyStrategy(MStrategyContext* context, TStrategyIdType strategyid); bool IsSupport(TStrategyTickType ticktype) { return true; } bool OnInquiry(MStrategyInquiryDataInterface*) { return true; }; void OnLoad(const char * fname) { if (nullptr == fname) throw runtime_error("fname is nullptr."); ifstream is(fname, std::ios::binary); if (is.is_open()) { boost::archive::binary_iarchive ia(is); ia & boost::serialization::base_object<CArbitrageBase>(*this); ia & *this; is.close(); } else throw runtime_error("can not open file."); }; void OnSave(const char * fname) { if (nullptr == fname) throw runtime_error("fname is nullptr."); ofstream os(fname, std::ios::binary); if (os.is_open()) { boost::archive::binary_oarchive oa(os); oa & boost::serialization::base_object<CArbitrageBase>(*this); oa & *this; os.close(); } else throw runtime_error("can not open file."); }; BEGIN_SERIALIZATION // 参数 SERIALIZATION(BarTypeSecond) SERIALIZATION(m_intMinuendVolumePerCopy) SERIALIZATION(m_intSubtrahendVolumePerCopy) SERIALIZATION(m_intWindowsLen) SERIALIZATION(m_dbWidth) SERIALIZATION(m_dbInitMiddleWidth) SERIALIZATION(m_dbCurrentMiddleWidth) SERIALIZATION(m_intAlgorithmType) SERIALIZATION(m_intCopies) SERIALIZATION(m_tdMorningPeriodBegin) SERIALIZATION(m_tdMorningPeriodEnd) SERIALIZATION(m_tdAfternoonPeriodBegin) SERIALIZATION(m_tdAfternoonPeriodEnd) SERIALIZATION(m_tdNightPeriodBegin) SERIALIZATION(m_tdNightPeriodEnd) // ForBar SERIALIZATION(m_intLastBarCycleNumber) SERIALIZATION(m_barUpperSpreadBar) SERIALIZATION(m_barLowerSpreadBar) SERIALIZATION(m_barLastSpreadBar) SERIALIZATION(m_dateCurrentDate) SERIALIZATION(m_uBarCount_Overall) SERIALIZATION(m_uBarCount_Inday) // 全局变量 SERIALIZATION(m_deqHisteryBars) SERIALIZATION(m_intbarCount) SERIALIZATION(m_ptimeGlobalCurrentTime) SERIALIZATION(m_boolStrategyOnOff) END_SERIALIZATION BEGIN_PARAMETER_BIND PARAMETER_INT(BarTypeSecond) PARAMETER_INT(m_intMinuendVolumePerCopy) PARAMETER_INT(m_intSubtrahendVolumePerCopy) PARAMETER_INT(m_intWindowsLen) PARAMETER_DOUBLE(m_dbWidth) PARAMETER_DOUBLE(m_dbInitMiddleWidth) PARAMETER_INT(m_intAlgorithmType) PARAMETER_INT(m_intCopies) PARAMETER_TIMEDURATION(m_tdMorningPeriodBegin) PARAMETER_TIMEDURATION(m_tdMorningPeriodEnd) PARAMETER_TIMEDURATION(m_tdAfternoonPeriodBegin) PARAMETER_TIMEDURATION(m_tdAfternoonPeriodEnd) PARAMETER_TIMEDURATION(m_tdNightPeriodBegin) PARAMETER_TIMEDURATION(m_tdNightPeriodEnd) END_PARAMETER_BIND_ BEGIN_PROBE_BIND BEGIN_GRAPH PROBE(&m_adbUpperSpread_Close, "m_adbUpperSpread_close", TProbe_Color_Green) PROBE(&m_adbLowerSpread_Close, "m_adbLowerSpread_close", TProbe_Color_Blue) PROBE(&m_adbUpper, "m_adbUpper", TProbe_Color_Yellow) PROBE(&m_HasRisenSoClear, "m_HasRisenSoClear", TProbe_Color_Blue_Weak) PROBE(&m_HasDroppedSoClear, "m_HasDroppedSoClear", TProbe_Color_Green_Weak) PROBE(&m_adbLower, "m_adbLower", TProbe_Color_Yellow) END_GRAPH("Line") END_PROBE_BIND_ BEGIN_SHOW(Show) // 参数 SHOW_UINT(BarTypeSecond) SHOW_INT(m_intMinuendVolumePerCopy) SHOW_INT(m_intSubtrahendVolumePerCopy) SHOW_INT(m_intWindowsLen) SHOW_DOUBLE(m_dbWidth) SHOW_DOUBLE(m_dbInitMiddleWidth) SHOW_DOUBLE(m_dbCurrentMiddleWidth) SHOW_INT(GetMinuendMultipNumber()) SHOW_INT(GetSubtrahendMultipNumber()) SHOW_INT(m_intAlgorithmType) SHOW_INT(m_intCopies) SHOW_STRING(to_simple_string(m_tdMorningPeriodBegin).c_str()) SHOW_STRING(to_simple_string(m_tdMorningPeriodEnd).c_str()) SHOW_STRING(to_simple_string(m_tdAfternoonPeriodBegin).c_str()) SHOW_STRING(to_simple_string(m_tdAfternoonPeriodEnd).c_str()) SHOW_STRING(to_simple_string(m_tdNightPeriodBegin).c_str()) SHOW_STRING(to_simple_string(m_tdNightPeriodEnd).c_str()) // ForBar SHOW_INT(m_intLastBarCycleNumber) SHOW_UINT(m_uBarCount_Overall) SHOW_UINT(m_uBarCount_Inday) // 全局变量 SHOW_UINT(m_deqHisteryBars.size()) SHOW_INT(m_intbarCount) SHOW_STRING(to_simple_string(m_ptimeGlobalCurrentTime).c_str()) SHOW_INT(m_boolStrategyOnOff) END_SHOW TLastErrorIdType OnInit(ptime); void OnTick(TMarketDataIdType, const CTick *); // 参数 int BarTypeSecond = 60; int m_intMinuendVolumePerCopy = 1; int m_intSubtrahendVolumePerCopy = 1; int m_intWindowsLen = 60; double m_dbWidth = 5.0; double m_dbInitMiddleWidth = 0; int m_intAlgorithmType = 0; int m_intCopies = 1; time_duration m_tdMorningPeriodBegin = time_duration(1, 2, 0, 0); time_duration m_tdMorningPeriodEnd = time_duration(3, 29, 30, 0); time_duration m_tdAfternoonPeriodBegin = time_duration(5, 28, 0, 0); time_duration m_tdAfternoonPeriodEnd = time_duration(6, 55, 0, 0); time_duration m_tdNightPeriodBegin = time_duration(13, 2, 0, 0); time_duration m_tdNightPeriodEnd = time_duration(18, 28, 0, 0); // ForBar int m_intLastBarCycleNumber; CBar m_barUpperSpreadBar; CBar m_barLowerSpreadBar; CBar m_barLastSpreadBar; date m_dateCurrentDate; unsigned int m_uBarCount_Overall; unsigned int m_uBarCount_Inday; // 全局变量 double m_dbCurrentMiddleWidth = 0; deque<tuple<CBar, CBar, CBar>> m_deqHisteryBars; int m_intbarCount = -1; ptime m_ptimeGlobalCurrentTime; bool m_boolStrategyOnOff = true; private: atomic<double> m_adbUpperSpread_Close; atomic<double> m_adbLowerSpread_Close; //atomic<double> m_adbLastSpread_Close; atomic<double> m_adbUpper; atomic<double> m_adbMiddle; atomic<double> m_adbLower; atomic<double> m_HasRisenSoClear; atomic<double> m_HasDroppedSoClear; const vector< function<tuple<double,double,double> ()>> m_vecAlgorithms= { std::bind([](const deque<tuple<CBar, CBar, CBar>> & _deqHisteryBars,const double & _dbWidth)->tuple<double,double,double> { double _upper = accumulate( _deqHisteryBars.begin(), _deqHisteryBars.end(), 0.0, [](double a, const tuple<CBar, CBar, CBar> & b)->double { return a + get<LastI>(b).m_dbHighest; } ) / _deqHisteryBars.size(); double _lower = accumulate( _deqHisteryBars.begin(), _deqHisteryBars.end(), 0.0, [](double a, const tuple<CBar, CBar, CBar> & b)->double { return a + get<LastI>(b).m_dbLowest; } ) / _deqHisteryBars.size(); double _middle = (_upper + _lower) / 2; double UpperLine = _middle + (_upper - _middle)*_dbWidth; double MiddleLine = _middle; double LowerLine = _middle - (_middle - _lower)*_dbWidth; return make_tuple(UpperLine, MiddleLine, LowerLine); },std::ref(m_deqHisteryBars),std::ref(m_dbWidth)), std::bind([](const deque<tuple<CBar, CBar, CBar>> & _deqHisteryBars,const double &_dbWidth)->tuple<double,double,double> { auto _intWindowsLen = _deqHisteryBars.size(); double _upper = accumulate( _deqHisteryBars.begin(), _deqHisteryBars.end(), 0.0, [](double a, const tuple<CBar, CBar, CBar> & b)->double { return a + get<LastI>(b).m_dbHighest; } ) / _deqHisteryBars.size(); double _lower = accumulate( _deqHisteryBars.begin(), _deqHisteryBars.end(), 0.0, [](double a, const tuple<CBar, CBar, CBar> & b)->double { return a + get<LastI>(b).m_dbLowest; } ) / _deqHisteryBars.size(); unsigned int BeginMulti = _deqHisteryBars.size(); double _middle = accumulate( _deqHisteryBars.begin(), _deqHisteryBars.end(), 0.0, [&BeginMulti](double a, const tuple<CBar, CBar, CBar> & b)->double { return a + get<LastI>(b).m_dbClose*(BeginMulti--); } ) / ((1 + (double)_intWindowsLen)*(double)_intWindowsLen / 2); double UpperLine = _middle + (_upper - _lower) / 2.0*_dbWidth; double MiddleLine = _middle; double LowerLine = _middle - (_upper - _lower) / 2.0*_dbWidth; return make_tuple(UpperLine, MiddleLine, LowerLine); },std::ref(m_deqHisteryBars),std::ref(m_dbWidth)) }; }; CMyStrategy::CMyStrategy() : CArbitrageBase(nullptr, 0) { } CMyStrategy::CMyStrategy(MStrategyContext* context, TStrategyIdType strategyid): CArbitrageBase(context, strategyid) { ParamAndProbeInit(m_array2ParameterStruct, m_array2ProbeStruct); } TLastErrorIdType CMyStrategy::OnInit(ptime CurrentTime) { // 参数合法性检查 // ForBar m_intLastBarCycleNumber = -1;//当前周期编号:当前时间距离凌晨0:0:0的总秒数除以Bar周期并且取整,当值为-1时表示未初始化 m_barUpperSpreadBar.Init(BarTypeSecond); m_barLowerSpreadBar.Init(BarTypeSecond); m_barLastSpreadBar.Init(BarTypeSecond); m_uBarCount_Overall = 0; m_uBarCount_Inday = 0; // 全局变量 m_dbCurrentMiddleWidth = m_dbInitMiddleWidth; m_deqHisteryBars.clear(); m_deqHisteryBars.push_back(tuple<CBar, CBar, CBar>()); m_intbarCount = -1; m_dateCurrentDate = m_ptimeGlobalCurrentTime.date(); m_boolStrategyOnOff = true; m_adbUpper.store(PROBE_NULL_VALUE); m_adbMiddle.store(PROBE_NULL_VALUE); m_adbLower.store(PROBE_NULL_VALUE); m_HasRisenSoClear.store(PROBE_NULL_VALUE); m_HasDroppedSoClear.store(PROBE_NULL_VALUE); m_adbUpperSpread_Close.store(PROBE_NULL_VALUE); m_adbLowerSpread_Close.store(PROBE_NULL_VALUE); return CArbitrageBase::OnInit(CurrentTime); } void CMyStrategy::OnTick(TMarketDataIdType dataid, const CTick *pDepthMarketData) { CArbitrageBase::OnTick(dataid, pDepthMarketData); if (IsTwoLegHasInited() == false) return; // 更新K线 m_barUpperSpreadBar.m_dbClose = GetMinuendTick().m_dbAskPrice[0] * m_intMinuendVolumePerCopy*GetMinuendMultipNumber() - GetSubtrahendTick().m_dbBidPrice[0] * m_intSubtrahendVolumePerCopy*GetSubtrahendMultipNumber(); m_barLowerSpreadBar.m_dbClose = GetMinuendTick().m_dbBidPrice[0] * m_intMinuendVolumePerCopy*GetMinuendMultipNumber() - GetSubtrahendTick().m_dbAskPrice[0] * m_intSubtrahendVolumePerCopy*GetSubtrahendMultipNumber(); m_barLastSpreadBar.m_dbClose = GetMinuendTick().m_dbLastPrice * m_intMinuendVolumePerCopy*GetMinuendMultipNumber() - GetSubtrahendTick().m_dbLastPrice * m_intSubtrahendVolumePerCopy*GetSubtrahendMultipNumber(); m_ptimeGlobalCurrentTime = max(GetMinuendTick().m_datetimeUTCDateTime, GetSubtrahendTick().m_datetimeUTCDateTime); if (-1 == m_intLastBarCycleNumber) { //这段程序只执行两次 m_barUpperSpreadBar.m_dbOpen = m_barUpperSpreadBar.m_dbHighest = m_barUpperSpreadBar.m_dbLowest = m_barUpperSpreadBar.m_dbClose; m_barLowerSpreadBar.m_dbOpen = m_barLowerSpreadBar.m_dbHighest = m_barLowerSpreadBar.m_dbLowest = m_barLowerSpreadBar.m_dbClose; m_barLastSpreadBar.m_dbOpen = m_barLastSpreadBar.m_dbHighest = m_barLastSpreadBar.m_dbLowest = m_barLastSpreadBar.m_dbClose; m_uBarCount_Overall = 0; m_uBarCount_Inday = 0; m_intLastBarCycleNumber = CYCLE_NUM_OF_UTC(m_ptimeGlobalCurrentTime, BarTypeSecond); m_dateCurrentDate = m_ptimeGlobalCurrentTime.date(); } if (m_ptimeGlobalCurrentTime.date() != m_dateCurrentDate) { m_uBarCount_Inday = -1; } m_dateCurrentDate = m_ptimeGlobalCurrentTime.date(); auto SelfCycleNum = CYCLE_NUM_OF_UTC(m_ptimeGlobalCurrentTime, BarTypeSecond); if (SelfCycleNum>m_intLastBarCycleNumber) { m_intLastBarCycleNumber = SelfCycleNum; m_barUpperSpreadBar.m_dbOpen = m_barUpperSpreadBar.m_dbHighest = m_barUpperSpreadBar.m_dbLowest = m_barUpperSpreadBar.m_dbClose; m_barLowerSpreadBar.m_dbOpen = m_barLowerSpreadBar.m_dbHighest = m_barLowerSpreadBar.m_dbLowest = m_barLowerSpreadBar.m_dbClose; m_barLastSpreadBar.m_dbOpen = m_barLastSpreadBar.m_dbHighest = m_barLastSpreadBar.m_dbLowest = m_barLastSpreadBar.m_dbClose; ++m_uBarCount_Overall; ++m_uBarCount_Inday; } else { if (m_barUpperSpreadBar.m_dbClose > m_barUpperSpreadBar.m_dbHighest) m_barUpperSpreadBar.m_dbHighest = m_barUpperSpreadBar.m_dbClose; if (m_barUpperSpreadBar.m_dbClose<m_barUpperSpreadBar.m_dbLowest) m_barUpperSpreadBar.m_dbLowest = m_barUpperSpreadBar.m_dbClose; if (m_barLowerSpreadBar.m_dbClose > m_barLowerSpreadBar.m_dbHighest) m_barLowerSpreadBar.m_dbHighest = m_barLowerSpreadBar.m_dbClose; if (m_barLowerSpreadBar.m_dbClose<m_barLowerSpreadBar.m_dbLowest) m_barLowerSpreadBar.m_dbLowest = m_barLowerSpreadBar.m_dbClose; if (m_barLastSpreadBar.m_dbClose > m_barLastSpreadBar.m_dbHighest) m_barLastSpreadBar.m_dbHighest = m_barLastSpreadBar.m_dbClose; if (m_barLastSpreadBar.m_dbClose<m_barLastSpreadBar.m_dbLowest) m_barLastSpreadBar.m_dbLowest = m_barLastSpreadBar.m_dbClose; } m_adbUpper.store(PROBE_NULL_VALUE); m_adbMiddle.store(PROBE_NULL_VALUE); m_adbLower.store(PROBE_NULL_VALUE); m_HasRisenSoClear.store(PROBE_NULL_VALUE); m_HasDroppedSoClear.store(PROBE_NULL_VALUE); m_adbUpperSpread_Close.store(m_barUpperSpreadBar.m_dbClose); m_adbLowerSpread_Close.store(m_barLowerSpreadBar.m_dbClose); //m_adbLastSpread_Close.store(m_barLastSpreadBar.m_dbClose); // 保存HisteryBarLength根历史bar if (m_intbarCount != static_cast<int>(m_uBarCount_Overall) && -1 != m_intbarCount) { m_deqHisteryBars.push_front(make_tuple(m_barUpperSpreadBar, m_barLowerSpreadBar, m_barLastSpreadBar)); if (m_deqHisteryBars.size()> static_cast<size_t>(m_intWindowsLen)) m_deqHisteryBars.pop_back(); } else m_deqHisteryBars.front() = make_tuple(m_barUpperSpreadBar, m_barLowerSpreadBar, m_barLastSpreadBar); m_intbarCount = m_uBarCount_Overall; auto res = m_vecAlgorithms[m_intAlgorithmType%m_vecAlgorithms.size()](); double UpperLine = get<0>(res); double MiddleLine = get<1>(res); double LowerLine = get<2>(res); m_adbUpper.store(UpperLine); m_adbMiddle.store(MiddleLine); m_adbLower.store(LowerLine); m_HasRisenSoClear.store(MiddleLine - m_dbCurrentMiddleWidth); m_HasDroppedSoClear.store(MiddleLine + m_dbCurrentMiddleWidth); if (m_boolStrategyOnOff&&m_deqHisteryBars.size() >= static_cast<size_t>(m_intWindowsLen)) { bool IsNearLimitPrice = GetMinuendTick().m_dbLastPrice > static_cast<CFutureTick*>(&GetMinuendTick())->m_dbUpperLimitPrice - GetMinuendMinPriceTick() * 10 || GetMinuendTick().m_dbLastPrice < static_cast<CFutureTick*>(&GetMinuendTick())->m_dbLowerLimitPrice + GetMinuendMinPriceTick() * 10 || GetSubtrahendTick().m_dbLastPrice > static_cast<CFutureTick*>(&GetSubtrahendTick())->m_dbUpperLimitPrice - GetSubtrahendMinPriceTick() * 10 || GetSubtrahendTick().m_dbLastPrice < static_cast<CFutureTick*>(&GetSubtrahendTick())->m_dbLowerLimitPrice + GetSubtrahendMinPriceTick() * 10; bool IsTimeOk = (m_ptimeGlobalCurrentTime.time_of_day() > m_tdMorningPeriodBegin&&m_ptimeGlobalCurrentTime.time_of_day() < m_tdMorningPeriodEnd) || (m_ptimeGlobalCurrentTime.time_of_day() > m_tdAfternoonPeriodBegin&&m_ptimeGlobalCurrentTime.time_of_day() < m_tdAfternoonPeriodEnd) || (m_ptimeGlobalCurrentTime.time_of_day() > m_tdNightPeriodBegin&&m_ptimeGlobalCurrentTime.time_of_day() < m_tdNightPeriodEnd); if (CanExcute() && (false == IsNearLimitPrice) && (IsTimeOk)) { if (//目前无仓位 0 == GetSubtrahendPosition().m_uLongPosition && 0 == GetMinuendPosition().m_uLongPosition && 0 == GetSubtrahendPosition().m_uShortPosition && 0 == GetMinuendPosition().m_uShortPosition && (REMAINCANCELAMOUNT(0)>50) && (REMAINCANCELAMOUNT(1)>50) ) { if (m_barLowerSpreadBar.m_dbClose > UpperLine) MakeOrder(TEnumSellMinuend_BuySubtrahend_Increase, m_intCopies, m_intMinuendVolumePerCopy*m_intCopies, m_intSubtrahendVolumePerCopy*m_intCopies);//M-S 卖出M 买入S 赌价差会下降 else if (m_barUpperSpreadBar.m_dbClose < LowerLine) MakeOrder(TEnumBuyMinuend_SellSubtrahend_Increase, m_intCopies, m_intMinuendVolumePerCopy*m_intCopies, m_intSubtrahendVolumePerCopy*m_intCopies);//M-S 买入M 卖出S 赌价差会上升 } else if (//M-S M持空头 S持多头 价差下降到中轨就平仓 0 != GetMinuendPosition().m_uShortPosition && 0 != GetSubtrahendPosition().m_uLongPosition && m_barUpperSpreadBar.m_dbClose < MiddleLine + m_dbCurrentMiddleWidth ) { MakeOrder(TEnumBuyMinuend_SellSubtrahend_Descrease, m_intCopies, m_intMinuendVolumePerCopy*m_intCopies, m_intSubtrahendVolumePerCopy*m_intCopies); } else if (//M-S M持多头 S持空头 价差上升到中轨就平仓 0 != GetMinuendPosition().m_uLongPosition && 0 != GetSubtrahendPosition().m_uShortPosition && m_barLowerSpreadBar.m_dbClose > MiddleLine - m_dbCurrentMiddleWidth ) { MakeOrder(TEnumSellMinuend_BuySubtrahend_Descrease, m_intCopies, m_intMinuendVolumePerCopy*m_intCopies, m_intSubtrahendVolumePerCopy*m_intCopies); } } } // 干预策略 char buf[1024]; if (true == MEDDLE(buf, 1024)) { string cmd = buf; if ("betrise" == cmd) { if (CanExcute()) { if (//目前无仓位 0 == GetSubtrahendPosition().m_uLongPosition && 0 == GetMinuendPosition().m_uLongPosition && 0 == GetSubtrahendPosition().m_uShortPosition && 0 == GetMinuendPosition().m_uShortPosition ) { MakeOrder(TEnumBuyMinuend_SellSubtrahend_Increase, m_intCopies, m_intMinuendVolumePerCopy*m_intCopies, m_intSubtrahendVolumePerCopy*m_intCopies);//M-S 买入M 卖出S 赌价差会上升 } else LOG("strategy[%d]: Strategy has position so can not increase", g_StrategyId); } } if ("betdrop" == cmd) { if (CanExcute()) { if (//目前无仓位 0 == GetSubtrahendPosition().m_uLongPosition && 0 == GetMinuendPosition().m_uLongPosition && 0 == GetSubtrahendPosition().m_uShortPosition && 0 == GetMinuendPosition().m_uShortPosition ) { MakeOrder(TEnumSellMinuend_BuySubtrahend_Increase, m_intCopies, m_intMinuendVolumePerCopy*m_intCopies, m_intSubtrahendVolumePerCopy*m_intCopies);//M-S 卖出M 买入S 赌价差会下降 } else LOG("strategy[%d]: Strategy has position so can not increase", g_StrategyId); } } if ("clear" == cmd) { if (//M-S M持空头 S持多头 价差下降到中轨就平仓 0 != GetMinuendPosition().m_uShortPosition && 0 != GetSubtrahendPosition().m_uLongPosition ) { MakeOrder(TEnumBuyMinuend_SellSubtrahend_Descrease, m_intCopies, m_intMinuendVolumePerCopy*m_intCopies, m_intSubtrahendVolumePerCopy*m_intCopies); } else if (//M-S M持多头 S持空头 价差上升到中轨就平仓 0 != GetMinuendPosition().m_uLongPosition && 0 != GetSubtrahendPosition().m_uShortPosition ) { MakeOrder(TEnumSellMinuend_BuySubtrahend_Descrease, m_intCopies, m_intMinuendVolumePerCopy*m_intCopies, m_intSubtrahendVolumePerCopy*m_intCopies); } else LOG("strategy[%d]: Strategy has no position so can not decrease", g_StrategyId); } if ("position" == cmd) { ShowPosition(); } else if ("show" == cmd) { Show(); } else if ("on" == cmd) { m_boolStrategyOnOff = true; } else if ("off" == cmd) { m_boolStrategyOnOff = false; } else if ("inc_copies" == cmd) { if (0 == GetSubtrahendPosition().m_uLongPosition && 0 == GetMinuendPosition().m_uLongPosition && 0 == GetSubtrahendPosition().m_uShortPosition && 0 == GetMinuendPosition().m_uShortPosition) { m_intCopies++; LOG("Strategy[%d]: Current Copies:%d",g_StrategyId, m_intCopies); } else { LOG("Strategy[%d]: Cannot modify copies.", g_StrategyId); } } else if ("dec_copies" == cmd) { if (0 == GetSubtrahendPosition().m_uLongPosition && 0 == GetMinuendPosition().m_uLongPosition && 0 == GetSubtrahendPosition().m_uShortPosition && 0 == GetMinuendPosition().m_uShortPosition) { if(m_intCopies>1) m_intCopies--; LOG("Strategy[%d]: Current Copies:%d", g_StrategyId, m_intCopies); } else { LOG("Strategy[%d]: Cannot modify copies.", g_StrategyId); } } else if ("inc_middlewidth" == cmd) { double dt = 0; switch (m_intAlgorithmType%m_vecAlgorithms.size()) { case 0:dt = (UpperLine - LowerLine) / m_dbWidth / 2 * 0.1;break; case 1:dt = (UpperLine - LowerLine) / m_dbWidth * 0.1;break; } m_dbCurrentMiddleWidth += dt; } else if ("dec_middlewidth" == cmd) { double dt = 0; switch (m_intAlgorithmType%m_vecAlgorithms.size()) { case 0:dt = (UpperLine - LowerLine) / m_dbWidth / 2 * 0.1;break; case 1:dt = (UpperLine - LowerLine) / m_dbWidth * 0.1;break; } m_dbCurrentMiddleWidth -= dt; } else if ("reset_middlewidth" == cmd) { m_dbCurrentMiddleWidth = m_dbInitMiddleWidth; } } } // 导出函数 extern "C" { STRATEGY_INTERFACE MStrategy * CreateStrategyObject(MStrategyContext*context, TStrategyIdType stid)\ { MStrategy * ret; try { ret = new CMyStrategy(context, stid); } catch (...) { return NULL; } return ret; } } <|start_filename|>common/tick/Tick.h<|end_filename|> #ifndef _TICK #define _TICK #include "StrategyData.h" #include <boost/date_time/gregorian/gregorian.hpp> #include <boost/date_time/posix_time/posix_time.hpp> #include <boost/date_time/posix_time/time_serialize.hpp> using namespace boost::posix_time; using namespace StrategyData; using namespace std; #define MAX_QUOTATIONS_DEPTH 5 class CTick { public: TMarketDataIdType m_uDataID; TInstrumentIDType m_strInstrumentID; ptime m_datetimeUTCDateTime; TPriceType m_dbLastPrice; TVolumeType m_intVolume; TPriceType m_dbBidPrice[MAX_QUOTATIONS_DEPTH]; TPriceType m_dbAskPrice[MAX_QUOTATIONS_DEPTH]; TVolumeType m_intBidVolume[MAX_QUOTATIONS_DEPTH]; TVolumeType m_intAskVolume[MAX_QUOTATIONS_DEPTH]; template<class Archive> void serialize(Archive& ar, const unsigned int version) { ar & m_uDataID; ar & m_strInstrumentID; ar & m_datetimeUTCDateTime; ar & m_dbLastPrice; ar & m_intVolume; ar & m_dbBidPrice; ar & m_dbAskPrice; ar & m_intBidVolume; ar & m_intAskVolume; } }; #endif <|start_filename|>common/SimulateKernelEnvironment.h<|end_filename|> #pragma once class MSimulateKernelEnvironment { public: virtual void OnUpdateProgress(unsigned int cur, unsigned int overall) = 0; virtual void OnBackTestFinished() = 0; }; <|start_filename|>common/StrategyData.h<|end_filename|> #pragma once #include <string> #include <map> #include <vector> #include <boost/date_time/gregorian/gregorian.hpp> #include <boost/date_time/posix_time/posix_time.hpp> #include <atomic> using namespace boost::posix_time; using namespace std; class CTick; class MStrategyContext; class MStrategy; namespace StrategyData { typedef int TSharedIndexType; typedef long long TOrderRefIdType; #define LB1_NullOrderRef -1 typedef unsigned int TCustomRefPartType; typedef char * TOrderSysIdType; typedef long long TActionIdType; typedef int TVolumeType; typedef int TTradedVolumeType; typedef int TRemainVolumeType; typedef double TPriceType; typedef int TStrategyIdType; typedef char TInstrumentIDType[32]; enum TLastErrorIdType{ LB1_NO_ERROR, LB1_NULL_PTR, LB1_INVALID_VAL }; typedef unsigned int TMarketDataIdType; enum TOrderPriceType{ OPLastPrice, OPAskPrice1, OPAskPrice2, OPAskPrice3, OPAskPrice4, OPAskPrice5, OPBidPrice1, OPBidPrice2, OPBidPrice3, OPBidPrice4, OPBidPrice5, }; enum TStrategyTickType { FutureTick, OptionTick, ForexTick,StockTick,TwsTick }; enum TPositionType{ LB1_Long, LB1_Short }; enum TSoundType{ LB1_Warming, LB1_Error }; enum THedgeFlagType{ LB1_Speculation, LB1_Arbitrage, LB1_Hedge }; enum TOrderDirectionType{ LB1_Buy=0, LB1_Sell=1, LB1_UnknownDirection=2 }; enum TOrderOffsetType{ LB1_Increase, LB1_Decrease, LB1_DecreaseYesterday, LB1_DecreaseToday, LB1_UnknownOffset }; enum TOrderType{ LB1_NormalLimitOrderType=0, LB1_MarketOrderType=1, LB1_FOKLimitOrderType=2, LB1_FAKLimitOrderType=3 }; enum TOrderStatusType{ LB1_StatusNoTradeQueueing, LB1_StatusPartTradedQueueing, LB1_StatusAllTraded, LB1_StatusCanceled, LB1_StatusUnknown }; #define MAXPARNAMELENGTH 64 struct CParNode{ char m_arrayParname[MAXPARNAMELENGTH]; int32_t m_intOption; int * m_pIntAddress; double * m_pDoubleAddress; time_duration * m_pTimeDuraAddress; char * m_pStringAddress; }; #define MAXPARCOUNT 128 typedef MStrategy * (*TFNCreateStrategyObject)(MStrategyContext*, TStrategyIdType); #define BEGIN_PARAMETER_BIND CParNode m_array2ParameterStruct[MAXPARCOUNT+1] = { #define END_PARAMETER_BIND { "",0,nullptr,nullptr,nullptr,nullptr}};\ public:\ CParNode * GetParamStruct(){return m_array2ParameterStruct;}; #define NO_PARAMETER public:CParNode * GetParamStruct(){return NULL;}; #define PARAMETER_INT(ParVar) {#ParVar,0, &ParVar,nullptr,nullptr,nullptr}, #define PARAMETER_DOUBLE(ParVar) {#ParVar,0, nullptr,&ParVar,nullptr,nullptr}, #define PARAMETER_TIMEDURATION(ParVar) {#ParVar,0, nullptr,nullptr,&ParVar,nullptr}, #define PARAMETER_STRING(ParVar) {#ParVar,sizeof(ParVar),nullptr,nullptr,nullptr,ParVar }, #define CANCEL(OrderRef,sysid,dataid) g_pStrategyContext->CancelOrder(g_StrategyId,(OrderRef),(sysid),(dataid)) #define REMAINCANCELAMOUNT(dataid) g_pStrategyContext->GetRemainCancelAmount(g_StrategyId,(dataid)) #define ORDER(id) g_pStrategyContext->GetOrder((id)) #define LIMITORDER(Direction,Offset,Volume,Price,DataId) g_pStrategyContext->MakeOrder(g_StrategyId,(LB1_NormalLimitOrderType),(Direction),(Offset),(Volume),(Price),(DataId),0) #define LIMITORDER_Ex(Direction,Offset,Volume,Price,DataId,Custom) g_pStrategyContext->MakeOrder(g_StrategyId,(LB1_NormalLimitOrderType),(Direction),(Offset),(Volume),(Price),(DataId),(Custom)) #define MARKETORDER(Direction,Offset,Volume,Price,DataId) g_pStrategyContext->MakeOrder(g_StrategyId,(LB1_MarketOrderType),(Direction),(Offset),(Volume),(Price),(DataId),0) #define FAKLIMITORDER(b,c,d,e,f) g_pStrategyContext->MakeOrder(g_StrategyId,(LB1_FAKLimitOrderType),(Direction),(Offset),(Volume),(Price),(DataId),0) #define FOKLIMITORDER(b,c,d,e,f) g_pStrategyContext->MakeOrder(g_StrategyId,(LB1_FOKLimitOrderType),(Direction),(Offset),(Volume),(Price),(DataId),0) #define SHAREDVALUE_GET(index,ret) g_pStrategyContext->GetSharedValue(index,ret) #define SHAREDVALUE_INC(index,dt,discriminate) g_pStrategyContext->IncreaseSharedValue(index,dt,discriminate) #define SHAREDVALUE_DEC(index,dt,discriminate) g_pStrategyContext->DecreaseSharedValue(index,dt,discriminate) #define SHAREDVALUE_SET(index,nv,discriminate) g_pStrategyContext->SetSharedValue(index,nv,discriminate) #define MEDDLE(outbuf,len) g_pStrategyContext->GetNextMeddle(g_StrategyId,(outbuf),(len)) #define INQUIRY(data) g_pStrategyContext->Inquery(g_StrategyId,data) #ifdef WIN32 #define MEDDLERESPONSE(a,...) g_pStrategyContext->MeddleResponse(g_StrategyId,(a),__VA_ARGS__) #define LOG(a,...) g_pStrategyContext->ShowMessage(g_StrategyId,(a),__VA_ARGS__) #else #define MEDDLERESPONSE(a,args...) g_pStrategyContext->MeddleResponse(g_StrategyId,(a),##args) #define LOG(a,args...) g_pStrategyContext->ShowMessage(g_StrategyId,(a),##args) #endif #define INCREASE_COUNTER(CounterName) g_pStrategyContext->IncreaseCounter(g_StrategyId,CounterName) #define DESCREASE_COUNTER(CounterName) g_pStrategyContext->DescreaseCounter(g_StrategyId,CounterName) #define SerialonVice(name,value) g_pStrategyContext->SerialOnVice(g_StrategyId,(name),(value)) enum TProbeColorType { TProbe_Color_Red, TProbe_Color_Green, TProbe_Color_Blue, TProbe_Color_Yellow, TProbe_Color_Purple, TProbe_Color_Jacinth, TProbe_Color_Peachblow, TProbe_Color_Royalblue, TProbe_Color_Powderblue, TProbe_Color_Red_Weak, TProbe_Color_Green_Weak, TProbe_Color_Blue_Weak, TProbe_Color_Yellow_Weak, TProbe_Color_Purple_Weak, TProbe_Color_Jacinth_Weak, TProbe_Color_Peachblow_Weak, TProbe_Color_Royalblue_Weak, TProbe_Color_Powderblue_Weak }; enum TProbeType { DoubleProbe, IntProbe, DateTimeProbe }; struct CProbeNode { atomic<double> * m_AtomicDoublePointer; atomic<unsigned int> * AtomicCounterOverallPointer; char m_strProbeName[50]; TProbeColorType m_enumColor; }; #define PROBE_NULL_VALUE (-999999.0F) #define MAX_GRAPH_COUNT 8 #define MAX_SERIAL_PER_GRAPH 10 #define NO_PROBE public:TProbeStructType GetProbeStruct(){return nullptr;}; #define BEGIN_PROBE_BIND CProbeNode m_array2ProbeStruct[MAX_GRAPH_COUNT+1][MAX_SERIAL_PER_GRAPH+1] = { #define END_PROBE_BIND {{ nullptr,nullptr,"",TProbe_Color_Powderblue}}};\ public:\ TProbeStructType GetProbeStruct(){return m_array2ProbeStruct;}; #define BEGIN_GRAPH { #define END_GRAPH(style) { nullptr,nullptr,style,TProbe_Color_Red}}, #define PROBE(Pointer,Name,Color) {Pointer,nullptr,Name,Color}, #define PROBE_EX(Pointer,Index,Name,Color) {Pointer,Index,Name,Color}, #define BEGIN_CANDLESTICKS_GRAPH(open,high,low,close,begintime) {\ {high,nullptr,"_high_",TProbe_Color_Blue},\ {low,nullptr,"_low_",TProbe_Color_Green},\ {open,begintime,"_open_",TProbe_Color_Blue},\ {close,nullptr,"_close_",TProbe_Color_Red}, #define END_CANDLESTICKS_GRAPH(volume) {volume,nullptr,"_volume_",TProbe_Color_Red},{ nullptr,nullptr,"Candlesticks",TProbe_Color_Red}}, typedef CProbeNode(*TProbeStructType)[MAX_SERIAL_PER_GRAPH + 1]; #define STRATEGY_TEMPLATE_DECLARE(CLASSNAME) MStrategyContext * g_pStrategyContext;\ TStrategyIdType g_StrategyId;\ CLASSNAME(MStrategyContext* context, TStrategyIdType strategyid);\ void OnSave(const char *);\ void OnLoad(const char *);\ void OnRelease();\ virtual ~CLASSNAME(); #define STRATEGY_TEMPLATE_DEFINITION(CLASSNAME) \ extern "C" {STRATEGY_INTERFACE MStrategy * CreateStrategyObject(MStrategyContext*context, TStrategyIdType stid)\ {MStrategy * ret;\ try { ret = new CLASSNAME(context, stid); }\ catch (...) { return NULL; }\ return ret;}}\ CLASSNAME::CLASSNAME(MStrategyContext* context, TStrategyIdType strategyid)\ :g_pStrategyContext(context),g_StrategyId(strategyid)\ {if (context == NULL) throw 1;}\ void CLASSNAME::OnRelease(){delete this;}\ void CLASSNAME::OnLoad(const char * fname) { \ if(nullptr == fname) throw runtime_error("fname is nullptr."); \ ifstream is(fname,std::ios::binary); \ if (is.is_open()){boost::archive::binary_iarchive ia(is);ia >> *this;is.close();} else throw runtime_error("can not open file.");} \ void CLASSNAME::OnSave(const char * fname) { \ if(nullptr == fname) throw runtime_error("fname is nullptr."); \ ofstream os(fname,std::ios::binary); \ if (os.is_open()){boost::archive::binary_oarchive oa(os);oa << *this;os.close();} else throw runtime_error("can not open file.");} \ CLASSNAME::~CLASSNAME(){}; #define SERIALIZATION(var) ar & var; #define BEGIN_SERIALIZATION friend class boost::serialization::access;\ template<class Archive> void serialize(Archive& ar, const unsigned int version){ #define END_SERIALIZATION }; #define BEGIN_SHOW(FunctionName) void FunctionName(){LOG("Strategy[%d]: -----begin show------", g_StrategyId); #define SHOW_INT(name) LOG("Strategy[%d]: "#name"=%d", g_StrategyId, (int)name); #define SHOW_UINT(name) LOG("Strategy[%d]: "#name"=%u", g_StrategyId, (unsigned int)name); #define SHOW_DOUBLE(name) LOG("Strategy[%d]: "#name"=%lf", g_StrategyId, (double)name); #define SHOW_STRING(name) LOG("Strategy[%d]: "#name"=%s", g_StrategyId, (const char*)name); #define END_SHOW LOG("Strategy[%d]: -----end show------", g_StrategyId);} }; <|start_filename|>strategies/simple_strategy/simple_strategy.cpp<|end_filename|> #include "Order.h" #include "StrategyDefine.h" #include "StrategyData.h" #include "Tick.h" #include "FutureTick.h" #include "StockTick.h" #include "FutureTick.h" #include "OptionTick.h" #include <cmath> #include <list> #include <string> #include <fstream> using namespace std; class MyStrategy : public MStrategy { public: STRATEGY_TEMPLATE_DECLARE(MyStrategy) BEGIN_SERIALIZATION SERIALIZATION(a) SERIALIZATION(b) SERIALIZATION(c) END_SERIALIZATION int a = 5; double b = 0.2; int c = 2; int aa = 5; double bb = 0.2; int cc = 2; BEGIN_PARAMETER_BIND PARAMETER_INT(a) PARAMETER_DOUBLE(b) PARAMETER_INT(c) PARAMETER_INT(aa) PARAMETER_DOUBLE(bb) PARAMETER_INT(cc) END_PARAMETER_BIND bool IsSupport(TStrategyTickType ticktype) { return true; } BEGIN_PROBE_BIND BEGIN_GRAPH PROBE(&out_AskPrice1, "out_AskPrice1", TProbe_Color_Green) END_GRAPH("Line") BEGIN_GRAPH PROBE(&out_BidPrice1, "out_BidPrice1", TProbe_Color_Blue) END_GRAPH("Line") END_PROBE_BIND bool OnInquiry(MStrategyInquiryDataInterface*); TLastErrorIdType OnInit(ptime); void OnTick(TMarketDataIdType, const CTick *); void OnTrade( TOrderRefIdType, TOrderSysIdType, TVolumeType, TPriceType, TOrderDirectionType, TOrderOffsetType); void OnOrder( TOrderRefIdType, TOrderSysIdType, TOrderDirectionType, TOrderStatusType, TPriceType, TTradedVolumeType, TRemainVolumeType ); void OnEndup(); TLastErrorIdType OnInit_FromArchive(ptime) { return TLastErrorIdType::LB1_NO_ERROR; }; TOrderRefIdType m_intIncreaseRef; TOrderRefIdType m_intDecreaseRef; enum { NoPosition, Increase_ing_Position, HasPosition, Descrease_ing_Position } m_enumPosition = NoPosition; bool OnGetPositionInfo(int *) { return true; } bool OnGetCustomInfo(char *, size_t) { return true; } bool OnGetFloatingProfit(double *) { return true; } bool OnGetStatus(char *, size_t) { return true; } unsigned int m_uCounter = 0; private: atomic<double> out_AskPrice1; atomic<double> out_BidPrice1; }; STRATEGY_TEMPLATE_DEFINITION(MyStrategy) bool MyStrategy::OnInquiry(MStrategyInquiryDataInterface * data) { return true; } TLastErrorIdType MyStrategy::OnInit(ptime) { m_enumPosition = NoPosition; m_uCounter = 0; return LB1_NO_ERROR; } void MyStrategy::OnTick(TMarketDataIdType dataid, const CTick *pDepthMarketData) { out_AskPrice1.store(pDepthMarketData->m_dbAskPrice[0]); out_BidPrice1.store(pDepthMarketData->m_dbBidPrice[0]); m_uCounter++; switch (m_enumPosition) { case NoPosition: { if (m_uCounter % 111 == 0) { m_intIncreaseRef = LIMITORDER(LB1_Buy, LB1_Increase, 1, pDepthMarketData->m_dbAskPrice[0] + 10, 0); m_enumPosition = Increase_ing_Position; } };break; case Increase_ing_Position: { };break; case HasPosition: { if (m_uCounter % 222 == 0) { m_intDecreaseRef = LIMITORDER(LB1_Sell, LB1_Decrease, 1, pDepthMarketData->m_dbBidPrice[0] - 10, 0); m_enumPosition = Descrease_ing_Position; } };break; case Descrease_ing_Position: { };break; } } void MyStrategy::OnEndup() { } void MyStrategy::OnTrade( TOrderRefIdType ref, TOrderSysIdType sys, TVolumeType volume, TPriceType price, TOrderDirectionType dir, TOrderOffsetType offset) { switch (m_enumPosition) { case NoPosition: { };break; case Increase_ing_Position: { if (ref == m_intIncreaseRef) { m_enumPosition = HasPosition; } };break; case HasPosition: { };break; case Descrease_ing_Position: { if (ref == m_intDecreaseRef) { m_enumPosition = NoPosition; } };break; } } void MyStrategy::OnOrder( TOrderRefIdType ref, TOrderSysIdType sysId, TOrderDirectionType direction, TOrderStatusType Status, TPriceType LimitPrice, TTradedVolumeType VolumeTraded, TRemainVolumeType VolumeRemain) { } <|start_filename|>common/StrategyDefine.h<|end_filename|> #ifndef _STRATEGY_DEFINE_H_ #define _STRATEGY_DEFINE_H_ #include "StrategyData.h" #include "StrategyContext.h" #include "StrategyInquiryDataInterface.h" #include <map> #include <boost/date_time/gregorian/gregorian.hpp> #include <boost/date_time/posix_time/posix_time.hpp> #include "boost/serialization/serialization.hpp" #include "boost/archive/binary_oarchive.hpp" #include "boost/archive/binary_iarchive.hpp" #include "boost/serialization/export.hpp" #include "boost/serialization/vector.hpp" #include "boost/serialization/deque.hpp" #include "boost/serialization/map.hpp" #include "boost/serialization/split_member.hpp" #include "boost/serialization/utility.hpp" #include "boost/serialization/list.hpp" #include <istream> #include <ostream> using namespace boost::posix_time; using namespace boost::gregorian; using namespace StrategyData; using namespace std; class MStrategyContext; class MTick; #ifdef WIN32 #ifdef EXPORT_STRATEGY #define STRATEGY_INTERFACE __declspec(dllexport) #else #define STRATEGY_INTERFACE __declspec(dllimport) #endif #else #define STRATEGY_INTERFACE #endif class STRATEGY_INTERFACE MStrategy { public: //Get address of strategy graph prob struct virtual TProbeStructType GetProbeStruct() = 0; //Get the strategy which store the param virtual CParNode * GetParamStruct() = 0; //Response when received a customed inquery virtual bool OnInquiry(MStrategyInquiryDataInterface*) = 0; virtual bool IsSupport(TStrategyTickType) = 0; virtual TLastErrorIdType OnInit(ptime CurrentTime) = 0; virtual TLastErrorIdType OnInit_FromArchive(ptime CurrentTime) = 0; //Market data callback virtual void OnTick(TMarketDataIdType, const CTick *) = 0; //Order has traded callback virtual void OnTrade( TOrderRefIdType, TOrderSysIdType, TVolumeType, TPriceType, TOrderDirectionType, TOrderOffsetType ) = 0; //Order status has changed callback virtual void OnOrder( TOrderRefIdType, TOrderSysIdType, TOrderDirectionType, TOrderStatusType, TPriceType, TTradedVolumeType, TRemainVolumeType ) = 0; virtual void OnEndup() = 0; virtual void OnRelease() = 0; virtual void OnSave(const char * ) = 0; virtual void OnLoad(const char * ) = 0; virtual bool OnGetPositionInfo(int *) = 0; virtual bool OnGetCustomInfo(char *, size_t) = 0; virtual bool OnGetFloatingProfit(double *) = 0; virtual bool OnGetStatus(char *, size_t) = 0; }; #endif <|start_filename|>trade/main.cpp<|end_filename|> #include <string> #include <sys/stat.h> #include <iostream> #include <memory> #include <boost/date_time/posix_time/posix_time.hpp> #include <boost/log/trivial.hpp> #include <boost/log/core.hpp> #include <boost/log/expressions.hpp> #include <stdexcept> #include <string> #include <boost/smart_ptr/shared_ptr.hpp> #include <boost/thread/thread.hpp> #include <boost/date_time/posix_time/posix_time.hpp> #include <boost/log/common.hpp> #include <boost/log/expressions.hpp> #include <boost/log/attributes.hpp> #include <boost/log/sources/logger.hpp> #include <boost/log/sinks/sync_frontend.hpp> #include <boost/log/sinks/text_multifile_backend.hpp> #include <boost/log/common.hpp> #include <boost/log/expressions.hpp> #include <boost/log/attributes.hpp> #include <boost/log/sources/logger.hpp> #include <boost/log/sinks/sync_frontend.hpp> #include <boost/log/sinks/text_file_backend.hpp> #include <boost/log/sinks/sync_frontend.hpp> #include <boost/log/sinks/syslog_backend.hpp> #include "OrderRefResolve.h" #include <boost/log/trivial.hpp> #include <boost/log/utility/setup/console.hpp> #include <boost/log/utility/setup/common_attributes.hpp> #include <boost/log/attributes/named_scope.hpp> #include <boost/date_time/posix_time/posix_time.hpp> #include <boost/log/support/date_time.hpp> #include <boost/log/common.hpp> #include <boost/log/expressions.hpp> #include <boost/log/expressions/keyword.hpp> #include <boost/log/attributes.hpp> #include <boost/log/attributes/timer.hpp> #include <boost/log/sources/logger.hpp> #include <boost/log/sources/severity_logger.hpp> #include <boost/log/sinks/sync_frontend.hpp> #include <boost/log/sinks/text_file_backend.hpp> #include <boost/log/utility/setup/file.hpp> #include <boost/log/utility/setup/console.hpp> #include <boost/log/utility/setup/common_attributes.hpp> #include <boost/log/attributes/named_scope.hpp> #include "public.h" namespace logging = boost::log; namespace attrs = boost::log::attributes; namespace src = boost::log::sources; namespace sinks = boost::log::sinks; namespace expr = boost::log::expressions; namespace keywords = boost::log::keywords; using namespace boost::posix_time; using namespace boost::gregorian; #ifndef BOOST_SPIRIT_THREADSAFE #define BOOST_SPIRIT_THREADSAFE #endif #include <boost/property_tree/ptree.hpp> #include <boost/property_tree/json_parser.hpp> using namespace boost::property_tree; #include "trade_service.h" #include "CommuModForServInterface.h" using namespace std; // g++ -D BOOST_SPIRIT_THREADSAFE char ProcessName[256]; void InitLog(std::string configFile) { ptree g_Config; boost::property_tree::read_json(configFile, g_Config); auto LogConfig = g_Config.find("logconfig"); if (LogConfig != g_Config.not_found()) { auto LogtypeNode = LogConfig->second.find("logtype"); if(LogtypeNode== LogConfig->second.not_found()) throw std::runtime_error("[error]Can not find 'LogConfig.Logtype' Value."); string LogTypeString = LogtypeNode->second.data(); if (LogTypeString.find("syslog")!= std::string::npos) { string _ServerAddress=""; unsigned short _Port = 0; if (LogConfig->second.find("syslog") != LogConfig->second.not_found()) { auto Syslog = LogConfig->second.find("syslog"); if (Syslog->second.find("serveraddress") != Syslog->second.not_found()) _ServerAddress = Syslog->second.find("serveraddress")->second.data(); else throw std::runtime_error("[error]invalid 'logconfig.syslog.serveraddress' value."); if (Syslog->second.find("port") != Syslog->second.not_found()) _Port = atoi(Syslog->second.find("port")->second.data().c_str()); else throw std::runtime_error("[error]invalid 'logconfig.syslog.port' value."); } else throw std::runtime_error("[error]could not find 'logconfig.syslog' node."); boost::shared_ptr< sinks::synchronous_sink< sinks::syslog_backend > > sink(new sinks::synchronous_sink< sinks::syslog_backend >()); sinks::syslog::custom_severity_mapping< severity_levels > mapping("Severity"); mapping[severity_levels::normal] = sinks::syslog::info; mapping[severity_levels::warning] = sinks::syslog::warning; mapping[severity_levels::error] = sinks::syslog::critical; sink->locked_backend()->set_severity_mapper(mapping); sink->locked_backend()->set_target_address(_ServerAddress, _Port); logging::core::get()->add_sink(sink); } if (LogTypeString.find("file") != std::string::npos) { string LogFileHead = "_"; int RotationSize = 1024; bool AutoFlush = true; if (LogConfig->second.find("file") != LogConfig->second.not_found()) { auto FileLogNode = LogConfig->second.find("file"); if (FileLogNode->second.find("filenamehead") != FileLogNode->second.not_found()) LogFileHead = FileLogNode->second.find("filenamehead")->second.data(); if (FileLogNode->second.find("rotationsize") != FileLogNode->second.not_found()) RotationSize = atoi(FileLogNode->second.find("rotationsize")->second.data().c_str()); if (FileLogNode->second.find("autoflush") != FileLogNode->second.not_found()) AutoFlush = FileLogNode->second.find("autoflush")->second.data()=="true"? true : false; } else throw std::runtime_error("[error]could not find 'logconfig.file' node."); typedef sinks::synchronous_sink<sinks::text_file_backend> TextSink; boost::shared_ptr<sinks::text_file_backend> backend1 = boost::make_shared<sinks::text_file_backend>( keywords::file_name = LogFileHead+"%Y-%m-%d_%H-%M-%S.%N.log", keywords::rotation_size = RotationSize, keywords::time_based_rotation = sinks::file::rotation_at_time_point(0, 0, 0), keywords::min_free_space = 30 * 1024 * 1024); backend1->auto_flush(AutoFlush); boost::shared_ptr<TextSink> sink(new TextSink(backend1)); //sink->set_formatter(formatter); logging::core::get()->add_sink(sink); } if (LogTypeString.find("console") != std::string::npos) { auto console_sink = logging::add_console_log(); //console_sink->set_formatter(formatter); logging::core::get()->add_sink(console_sink); } } else throw std::runtime_error("[error]could not find 'logconfig' node."); } int main(int argc,char *argv[]) { if (argc < 3) { cout<<"Usage:ATM.exe %ConfigFileName%.json sysNumber [daemon]"<<endl; return 0; } #ifndef WIN32 if (argc > 3 && argv[3] && strcmp(argv[3], "daemon") == 0) { pid_t pc = fork(); if (pc < 0) { printf("error fork\n"); exit(1); } else if (pc>0) exit(0); setsid(); cout<<chdir(".")<<endl;; umask(0); } #endif try { strncpy(ProcessName, argv[0], sizeof(ProcessName)); if(atoi(argv[2])>_MaxAccountNumber) throw std::runtime_error("sysNumber error"); InitLog(argv[1]); boost::log::sources::severity_logger< severity_levels > m_Logger; BOOST_LOG_SEV(m_Logger, normal) << "Run.SystemNumber="<< argv[2] << " [" << to_iso_string(microsec_clock::universal_time()) << "]"; CTradeService service(argv[1],atoi(argv[2])); service.Start(); service.Join(); } catch (std::exception & exp) { std::cout << exp.what() << endl; return 1; } return 0; } <|start_filename|>common/QuantFundHFTBackTestTypedefine.h<|end_filename|> #ifndef _CommonFiles_QuantFundHFTBackTestTypedefine_h_ #define _CommonFiles_QuantFundHFTBackTestTypedefine_h_ #include <vector> #include <string> #include "StrategyData.h" #include "StrategyContext.h" using namespace std; typedef vector< pair< string/*Type*/, vector< std::tuple< string/*Name*/, TProbeColorType/*Color*/, std::shared_ptr<vector<unsigned int>>/*Index*/, std::shared_ptr<vector<float>>/*Value*/ >/*Data*/ > > > TNormalGraphProbeInfoType; typedef vector< vector< std::tuple< string/*Name*/, TProbeColorType/*Color*/, std::shared_ptr<vector<unsigned int>>/*Index*/, std::shared_ptr<vector<float>>/*Value*/ > > > TCandlesticksGraphProbeInfoType; #endif <|start_filename|>trade/trade_service.h<|end_filename|> #ifndef _QFCOMPRETRADESYSTEM_ATM_TRADESERVICE_H_ #define _QFCOMPRETRADESYSTEM_ATM_TRADESERVICE_H_ //#define CTP_FUTURE_MDPlugin //#define CTP_FUTURE_TDPlugin // //#define DFITC_SOP_MDPlugin //#define DFITC_SOP_TDPlugin // //#define DFITC_STOCK_MDPlugin // //#define HSCICC_STOCK_TDPlugin // //#define QT_STOCK_MDPlugin // //#define TEMPLATE_ANY_TDPluginvim // //#define FIX_CYCLE_PRICE_MDPlugin //#define FEMAS_FUTURE_MDPlugin #include "public.h" #ifdef CTP_FUTURE_MDPlugin #include "CTP_FUTURE_MDPlugin/CTP_FUTURE_MDPlugin.h" #endif #ifdef CTP_FUTURE_TDPlugin #include "CTP_FUTURE_TDPlugin/CTP_FUTURE_TDPlugin.h" #endif #ifdef DFITC_SOP_MDPlugin #include "DFITC_SOP_MDPlugin/DFITC_SOP_MDPlugin.h" #endif #ifdef DFITC_SOP_TDPlugin #include "DFITC_SOP_TDPlugin/DFITC_SOP_TDPlugin.h" #endif #ifdef DFITC_STOCK_MDPlugin #include "DFITC_STOCK_MDPlugin/DFITC_STOCK_MDPlugin.h" #endif #ifdef QT_STOCK_MDPlugin #include "QT_STOCK_MDPlugin/QT_STOCK_MDPlugin.h" #endif #ifdef TEMPLATE_ANY_TDPlugin #include "TEMPLATE_ANY_TDPlugin/TEMPLATE_ANY_TDPlugin.h" #endif #ifdef FIX_CYCLE_PRICE_MDPlugin #include "FIX_CYCLE_PRICE_MDPlugin/FIX_CYCLE_PRICE_MDPlugin.h" #endif #ifdef FEMAS_FUTURE_MDPlugin #include "FEMAS_FUTURE_MDPlugin/FEMAS_FUTURE_MDPlugin.h" #endif #ifdef FEMAS_FUTURE_TDPlugin #include "FEMAS_FUTURE_TDPlugin/FEMAS_FUTURE_TDPlugin.h" #endif #ifdef TWS_MDPlugin #include "TWS_MDPlugin/TWS_MDPlugin.h" #endif #ifdef TWS_TDPlugin #include "TWS_TDPlugin/TWS_TDPlugin.h" #endif #include <functional> #include <list> #include <memory> #include <mutex> #include <string> #include <sstream> #include <queue> #include <unordered_map> #include <boost/thread/mutex.hpp> #include <boost/thread/shared_mutex.hpp> #include <boost/log/common.hpp> #include "CommuModForServInterface.h" #include "AtmMarketDataPluginInterface.h" #include "AtmTradePluginInterface.h" #include "TradePluginContextInterface.h" #include "OrderRefResolve.h" #include "StrategyContext.h" #include <boost/filesystem/path.hpp> #include <boost/filesystem/operations.hpp> #include <boost/filesystem.hpp> #include "SeverityLevel.h" using namespace std; using namespace std::placeholders; #define MEDDLE_RESPONSE_MAXLEN 1024 #define STRATEGY_MESSAGE_MAXLEN 1024 class CStrategyNode { public: CStrategyNode() :m_pStrategy(nullptr) {} void clear() { m_dateActionDate = second_clock::universal_time().date(); m_uMaxIncreaseOrderCountPerDay = 10; m_uRemainIncreaseOrderCountPerDay = 10; m_treeConfig.clear(); m_pathStrategyPath.clear(); m_pBinHandle = nullptr; m_pStrategy = nullptr; unordered_map<TMarketDataIdType, pair< MAtmTradePluginInterface*, unordered_map<string, string> > >().swap(m_mapDataid2TradeApi); vector<pair<string, vector< std::tuple<string, TProbeColorType, atomic<double>*, atomic<unsigned int>*> > > >().swap(m_vecProbeInfo); unordered_map<TMarketDataIdType, MAtmMarketDataPluginInterface*>().swap(m_mapDataid2MarketDataApi); m_auProbeUpdateDatetime.store(0); while (m_queueMeddleQueue.empty() == false) m_queueMeddleQueue.pop(); while (m_queueMeddleResponseQueue.empty() == false) m_queueMeddleResponseQueue.pop(); } date m_dateActionDate; std::atomic<std::uint64_t> m_uMaxIncreaseOrderCountPerDay; std::atomic<std::uint64_t> m_uRemainIncreaseOrderCountPerDay; unsigned int m_uStrategyID; ptree m_treeConfig; boost::filesystem::path m_pathStrategyPath; StrategyHandleType m_pBinHandle; MStrategy * m_pStrategy; boost::shared_mutex m_mtxPropectStrategy; unordered_map<TMarketDataIdType, pair< MAtmTradePluginInterface*,unordered_map<string,string> > > m_mapDataid2TradeApi; vector<pair<string, vector< std::tuple<string, TProbeColorType,atomic<double>*, atomic<unsigned int>*> > > > m_vecProbeInfo; unordered_map<TMarketDataIdType, MAtmMarketDataPluginInterface*> m_mapDataid2MarketDataApi; atomic_uint_least64_t m_auProbeUpdateDatetime; boost::shared_mutex m_mtxPropectMeddleQueue; queue<string> m_queueMeddleQueue; boost::shared_mutex m_mtxPropectMeddleResponseQueue; queue<pair<ptime,string>> m_queueMeddleResponseQueue; }; typedef boost::log::sources::severity_logger< severity_levels >& LoggerType; typedef std::shared_ptr<MAtmPluginInterface> PluginPtrType; typedef std::shared_ptr<MAtmMarketDataPluginInterface> MDPluginPtrType; typedef std::shared_ptr<MAtmTradePluginInterface> TDPluginPtrType; typedef PluginPtrType(*TPluginFactory)(); #define PLUGIN(name,classname) {name,make_pair([]()->PluginPtrType {return PluginPtrType(new classname());},classname::s_strAccountKeyword)} enum class PackageHandlerParamType { MarketData, Trade, Nothing }; class CTradeService : public CCommuModForServSpi, public MStrategyContext, public MTradePluginContextInterface { const unordered_map<string, pair<TPluginFactory, string> > m_mapAMarketDataPFactories = { #ifdef CTP_FUTURE_MDPlugin PLUGIN("ctp",CCTP_FUTURE_MDPlugin), #endif #ifdef DFITC_SOP_MDPlugin PLUGIN("dfitc_sop",CDFITC_SOP_MDPlugin), #endif #ifdef DFITC_STOCK_MDPlugin PLUGIN("dfitc_stock",CDFITC_STOCK_MDPlugin), #endif #ifdef QT_STOCK_MDPlugin PLUGIN("quant_tech_stock",CQT_STOCK_MDPlugin), #endif #ifdef FEMAS_FUTURE_MDPlugin PLUGIN("femas_future",CFEMAS_FUTURE_MDPlugin), #endif #ifdef TWS_MDPlugin PLUGIN("tws",CTWS_MDPlugin), #endif #ifdef FIX_CYCLE_PRICE_MDPlugin PLUGIN("fix_cycle_price",CFixCyclePricePluginImp) #endif }; const unordered_map<string, pair<TPluginFactory, string> > m_mapATradePFactories = { #ifdef CTP_FUTURE_TDPlugin PLUGIN("ctp",CCTP_FUTURE_TDPlugin), #endif #ifdef DFITC_SOP_TDPlugin PLUGIN("dfitc_sop",CDFITC_SOP_TDPlugin), #endif #ifdef FEMAS_FUTURE_TDPlugin PLUGIN("femas_future",CFEMAS_FUTURE_TDPlugin), #endif #ifdef TWS_TDPlugin PLUGIN("tws",CTWS_TDPlugin), #endif #ifdef TEMPLATE_ANY_TDPlugin PLUGIN("template",CTEMPLATE_ANY_TDPlugin) #endif }; typedef void (CTradeService::*TPackageHandlerFuncType)(PackageHandlerParamType, const ptree & in, ptree &out); #define HANDLER(fn,param) (std::bind(&CTradeService::fn,this,PackageHandlerParamType::param,std::placeholders::_1,std::placeholders::_2)) const unordered_map<string, function<void(const ptree & in, ptree &out)>> m_mapString2PackageHandlerType = { //获取源类型 { "reqgetsupportedmdtypes", HANDLER(ReqGetSupportedTypes, MarketData)}, { "reqgetsupportedtdtypes", HANDLER(ReqGetSupportedTypes, Trade) }, //获取现有的源 { "reqgetallmarketdatasource", HANDLER(ReqGetAllSource, MarketData)}, { "reqgetalltradesource", HANDLER(ReqGetAllSource, Trade) }, //增加源 { "reqaddmarketdatasource", HANDLER(ReqAddSource, MarketData) }, { "reqaddtradesource", HANDLER(ReqAddSource, Trade) }, //删除源 { "reqdelmarketdatasource", HANDLER(ReqDelSource, MarketData) }, { "reqdeltradesource", HANDLER(ReqDelSource, Trade) }, { "reqallstrategybin", HANDLER(ReqAllStrategyBin, Nothing) }, { "reqallarchivefile", HANDLER(ReqAllArchiveFile, Nothing) }, { "reqdeploynewstrategy", HANDLER(ReqDeployNewStrategy, Nothing) }, { "reqgetallrunningstrategies", HANDLER(ReqGetAllRunningStrategies, Nothing) }, { "reqcancelrunningstrategies", HANDLER(ReqCancelRunningStrategies, Nothing) }, { "reqgetprobe", HANDLER(ReqGetProbe, Nothing) }, { "reqmeddle", HANDLER(ReqMeddle, Nothing) }, { "reqgetmeddleresponse", HANDLER(ReqGetMeddleResponse, Nothing) }, { "reqstrategyparams", HANDLER(ReqStrategyParams, Nothing) }, { "reqstrategyconfigjson", HANDLER(ReqStrategyConfigJson, Nothing) }, { "requpdatestrategybin", HANDLER(ReqUpdateStrategyBin, Nothing) }, { "reqmodifysharedvalue", HANDLER(ReqModifySharedValue, Nothing) }, { "reqallsharedvalue", HANDLER(ReqAllSharedValue, Nothing) }, { "reqsetordertickets", HANDLER(ReqSetOrderTickets, Nothing) }, { "getpositioninfo", HANDLER(ReqGetPositionInfo, Nothing) }, { "getcustominfo", HANDLER(ReqGetCustomInfo, Nothing) }, { "getfloatingprofit", HANDLER(ReqGetFloatingProfit, Nothing) }, { "getstatus", HANDLER(ReqStatus, Nothing) }, }; boost::log::sources::severity_logger< severity_levels > m_Logger; std::string m_strConfigFile; unsigned int m_uSystemNumber = 0; //仅一下三个数据结构需要互斥:策略数组\行情源数组\交易源数组 //策略数组:保存所有策略,该数据结构需要互斥保护 boost::shared_mutex m_mtxAllStrategys; CStrategyNode m_arrayAllStrategys[(_MaxStrategyID+1)]; //管理所有行情源与交易源,这两个数据结构需要互斥保护 pair<vector<PluginPtrType>, boost::shared_mutex> m_vecAllMarketDataSource;//行情源数组 pair<vector<PluginPtrType>, boost::shared_mutex> m_vecAllTradeSource;//交易源数组 boost::shared_mutex m_mtxSharedValue; unordered_map<TSharedIndexType, double> m_mapSharedValue; public: CTradeService(std::string configFile,unsigned int sysnum); ~CTradeService(); void Start(); void Join(); private: void MakeError(ptree & out, const char * fmt,...); string GetAddress(); unsigned short GetListenPort(); std::string GetStrategyBinPath(); size_t GetNetHandlerThreadCount(); MCommuModForServInterface * m_pApi = nullptr; void DeployStrategy(const ptree &, unsigned int & strategyid); void CancelStrategy(unsigned int strategyid, string & sarchive,ptree & config); virtual void OnCommunicate(const ptree & in, ptree & out); #define PACKAGE_HANDLER(fun_name) void fun_name (PackageHandlerParamType,const ptree & in, ptree &out); PACKAGE_HANDLER(ReqGetSupportedTypes) PACKAGE_HANDLER(ReqGetAllSource) PACKAGE_HANDLER(ReqAddSource) PACKAGE_HANDLER(ReqDelSource) PACKAGE_HANDLER(ReqAllStrategyBin) PACKAGE_HANDLER(ReqAllArchiveFile) PACKAGE_HANDLER(ReqDeployNewStrategy) PACKAGE_HANDLER(ReqGetAllRunningStrategies) PACKAGE_HANDLER(ReqCancelRunningStrategies) PACKAGE_HANDLER(ReqGetProbe) PACKAGE_HANDLER(ReqMeddle) PACKAGE_HANDLER(ReqGetMeddleResponse) PACKAGE_HANDLER(ReqStrategyParams) PACKAGE_HANDLER(ReqStrategyConfigJson) PACKAGE_HANDLER(ReqUpdateStrategyBin) PACKAGE_HANDLER(ReqModifySharedValue) PACKAGE_HANDLER(ReqAllSharedValue) PACKAGE_HANDLER(ReqSetOrderTickets) PACKAGE_HANDLER(ReqGetPositionInfo) PACKAGE_HANDLER(ReqGetCustomInfo) PACKAGE_HANDLER(ReqGetFloatingProfit) PACKAGE_HANDLER(ReqStatus) virtual bool Inquery(TStrategyIdType stid, MStrategyInquiryDataInterface *); virtual bool MeddleResponse(TStrategyIdType, const char *, ...); virtual bool ShowMessage(TStrategyIdType, const char *, ...); virtual bool GetNextMeddle(TStrategyIdType, char * retbuffer, unsigned int maxlength); virtual TOrderRefIdType MakeOrder( TStrategyIdType, TOrderType, TOrderDirectionType, TOrderOffsetType, TVolumeType, TPriceType, TMarketDataIdType, TCustomRefPartType); virtual TLastErrorIdType CancelOrder( TStrategyIdType, TOrderRefIdType, TOrderSysIdType, TMarketDataIdType); virtual void UpdateChart(); virtual bool GetSharedValue(TSharedIndexType i, double & ret); virtual bool IncreaseSharedValue(TSharedIndexType i, double dt, function<bool(double)>); virtual bool DecreaseSharedValue(TSharedIndexType i, double dt, function<bool(double)>); virtual bool SetSharedValue(TSharedIndexType i, double newvalue, function<bool(double)>); virtual int GetRemainCancelAmount(TStrategyIdType, TMarketDataIdType); virtual void OnTrade( TOrderRefIdType, TOrderSysIdType, TPriceType, TVolumeType); virtual void OnOrder( TOrderRefIdType, TOrderSysIdType, TOrderStatusType, TPriceType, TTradedVolumeType, TRemainVolumeType ); }; #endif <|start_filename|>common/BackTestResult.h<|end_filename|> #include "QuantFundHFTBackTestTypedefine.h" #include <vector> #include <unordered_map> #include <map> #include "ReportStructs.h" #include <string> #include "Order.h" #include "Tick.h" #include <boost/date_time/posix_time/posix_time.hpp> using namespace boost::posix_time; using namespace boost::gregorian; using namespace boost::posix_time; using namespace HFTReportNamespace; class CBackTestResult { public: unsigned int m_uSerialLength; TNormalGraphProbeInfoType m_vecNGraphProbeInfo; TCandlesticksGraphProbeInfoType m_vecKGraphProbeInfo; vector<ptime> m_vecTimeSerial; vector<pair<ptime, wstring> > m_vecMessages; unordered_map<TOrderRefIdType, COrder> m_mapOrders; unordered_map<string, string> m_mapCriterions; vector<pair<ptime, MStrategyInquiryDataInterface*>> m_vecInqueries; map<date, CReportForDay> m_mapReportForDay; unordered_map<string, CInstrumentInfoForReport> m_mapInsInfo; vector<TOrderRefIdType> m_vecOrderedOrderRefs; string m_strInsidInfoFile; vector<string> m_vecInstruments; vector<CTick> m_vecLastTick; vector<float> m_vecOrderProfit; vector<float> m_vecCumProfit; vector<float> m_vecCumFee; vector<float> m_vecCumNet; vector<ptime> m_vecTimeLable; vector<float> m_vecCumProfit2; vector<float> m_vecCumFee2; vector<float> m_vecCumNet2; vector<ptime> m_vecTimeLable2; vector<ptime> m_vecMarks; double m_dbMaximumDrawdown = -1; unsigned int m_intWinCnt; unsigned int m_intLoseCnt; unsigned int m_intEqueCnt; double m_dbWinMoney; double m_dbLoseMoney; float m_dbCumProfit_Closed = 0.0f; float m_dbCumProfit_UnClosed = 0.0f; float m_dbCumFee = 0.0f; unordered_map<TSharedIndexType, double> m_mapSharedValue; void Init() { m_uSerialLength = 0; m_vecNGraphProbeInfo.clear(); m_vecKGraphProbeInfo.clear(); m_vecTimeSerial.clear(); m_vecMessages.clear(); m_mapOrders.clear(); m_mapCriterions.clear(); m_vecInqueries.clear(); m_mapReportForDay.clear(); m_mapInsInfo.clear(); m_vecOrderedOrderRefs.clear(); m_strInsidInfoFile.clear(); m_vecInstruments.clear(); m_vecLastTick.clear(); m_vecOrderProfit.clear(); m_vecCumProfit.clear(); m_vecCumFee.clear(); m_vecCumNet.clear(); m_vecTimeLable.clear(); m_vecCumProfit2.clear(); m_vecCumFee2.clear(); m_vecCumNet2.clear(); m_vecTimeLable2.clear(); m_vecMarks.clear(); m_dbMaximumDrawdown = -1; m_intWinCnt = 0; m_intLoseCnt = 0; m_intEqueCnt = 0; m_dbWinMoney = 0; m_dbLoseMoney = 0; m_dbCumProfit_Closed = 0.0f; m_dbCumProfit_UnClosed = 0.0f; m_dbCumFee = 0.0f; m_mapSharedValue.clear(); } }; <|start_filename|>common/TickDataContainer.h<|end_filename|> #ifndef _TICKDATACONTAINER_H #define _TICKDATACONTAINER_H #include <string> #include <memory> #include <algorithm> #include <vector> #include <fstream> #include <set> #include <sstream> #include <istream> #include <ostream> #include <algorithm> #include <unordered_map> #include <tuple> #include <boost/date_time/gregorian/gregorian.hpp> #include <boost/date_time/posix_time/posix_time.hpp> #include <boost/serialization/serialization.hpp> #include <boost/archive/binary_oarchive.hpp> #include <boost/archive/binary_iarchive.hpp> #include <boost/serialization/export.hpp> #include <boost/property_tree/ptree.hpp> #include <boost/property_tree/json_parser.hpp> #include <boost/serialization/vector.hpp> #include <boost/serialization/split_member.hpp> #include <boost/date_time/posix_time/time_serialize.hpp> #include <mutex> #include "StrategyData.h" #pragma region ptree #include <boost/property_tree/ptree.hpp> #include <boost/property_tree/json_parser.hpp> using namespace boost::property_tree; #pragma endregion using namespace boost::posix_time; using namespace boost::gregorian; using namespace std; using namespace StrategyData; void AbandonOverlap(vector<CTick*>&result); class MTickDataContainerInterface { public: virtual TStrategyTickType GetTickType() = 0; virtual CTick* operator[](unsigned int) = 0; virtual vector<CTick*>::iterator begin() = 0; virtual vector<CTick*>::iterator end() = 0; virtual void Release() = 0; virtual void LoadFromDB(const char * jsonstring, std::mutex & mtx) = 0; virtual void SaveToFile(ostream & file) = 0; virtual size_t GetLength() = 0; }; template<class T, TStrategyTickType Type> class CTickData :public MTickDataContainerInterface { public: CTickData<T,Type>() : m_enumTickType(Type) {}; virtual TStrategyTickType GetTickType() { return m_enumTickType; }; virtual CTick * operator[](unsigned int index) { return m_vecTickPointerContainer[index]; }; virtual void Release() { delete this; }; virtual void LoadFromDB(const char * jsonstring,std::mutex & mtx) { m_vecTicks.clear(); m_vecTickPointerContainer.clear(); std::unique_lock<std::mutex> _lock(mtx,std::defer_lock); _lock.lock(); LoadFromDatabase<T>(jsonstring, m_vecTicks); _lock.unlock(); m_vecTickPointerContainer.reserve(m_vecTicks.size()); for_each(m_vecTicks.begin(), m_vecTicks.end(), [this](T&tar) {m_vecTickPointerContainer.push_back(&tar);}); AbandonOverlap(m_vecTickPointerContainer); } /*virtual void LoadFromFile(istream & file) { m_vecTicks.clear(); m_vecTickPointerContainer.clear(); boost::archive::binary_iarchive ia(file); ia >> *this; m_vecTickPointerContainer.reserve(m_vecTicks.size()); for_each( m_vecTicks.begin(), m_vecTicks.end(), [this](T&tar) {m_vecTickPointerContainer.push_back(&tar);}); }*/ virtual void SaveToFile(ostream & file) { boost::archive::binary_oarchive oa(file); oa & m_enumTickType; auto len = m_vecTicks.size(); oa & len; for (size_t i = 0;i < len;i++) oa & m_vecTicks[i]; } virtual size_t GetLength() { return m_vecTicks.size(); }; virtual vector<CTick*>::iterator begin() { return m_vecTickPointerContainer.begin(); }; virtual vector<CTick*>::iterator end() { return m_vecTickPointerContainer.end(); }; vector<CTick*> m_vecTickPointerContainer; vector<T> m_vecTicks; TStrategyTickType m_enumTickType; }; #endif <|start_filename|>common/tick/FutureTick.h<|end_filename|> #ifndef _FUTURE_TICK #define _FUTURE_TICK #include "Tick.h" class CFutureTick: public CTick { public: TPriceType m_dbLowerLimitPrice; TPriceType m_dbUpperLimitPrice; TPriceType m_dbAveragePrice; TPriceType m_dbPreSettlementPrice; TPriceType m_dbPreClosePrice; double m_dbTurnover; double m_dbOpenInterest; TPriceType m_dbOpenPrice; TPriceType m_dbHighestPrice; TPriceType m_dbLowestPrice; TPriceType m_dbClosePrice; template<class Archive> void serialize(Archive& ar, const unsigned int version) { ar & boost::serialization::base_object<CTick>(*this); ar & m_dbLowerLimitPrice; ar & m_dbUpperLimitPrice; ar & m_dbAveragePrice; ar & m_dbPreSettlementPrice; ar & m_dbPreClosePrice; ar & m_dbTurnover; ar & m_dbOpenInterest; ar & m_dbOpenPrice; ar & m_dbHighestPrice; ar & m_dbLowestPrice; ar & m_dbClosePrice; } }; #endif <|start_filename|>trade/md_plugins/DFITC_SOP_MDPlugin/DFITC_SOP_MDPlugin.h<|end_filename|> #ifndef _QFCOMPRETRADESYSTEM_ATMMARKETDATAPLUGINS_CTP_MDPLUGIN_DFITC_SOP_MDPlugin_H_ #define _QFCOMPRETRADESYSTEM_ATMMARKETDATAPLUGINS_CTP_MDPLUGIN_DFITC_SOP_MDPlugin_H_ #include <string> #include <boost/log/common.hpp> #include <boost/thread.hpp> #include <mutex> #include <condition_variable> #include <atomic> #include <boost/asio.hpp> #include <memory> #include <boost/date_time/posix_time/posix_time.hpp> #include <thread> #include <future> #include <tuple> #include "DFITCSECMdApi.h" #include "SeverityLevel.h" #include "OptionTick.h" #include "AtmMarketDataPluginInterface.h" using namespace boost::posix_time; using namespace boost::gregorian; using namespace boost::asio; using namespace std; class CDFITC_SOP_MDPlugin : public MAtmMarketDataPluginInterface, public DFITCSECMdSpi { boost::log::sources::severity_logger< severity_levels > m_Logger; io_service m_IOservice; deadline_timer m_StartAndStopCtrlTimer; std::future<bool> m_futTimerThreadFuture; string m_strServerAddress; string m_strAccountID; string m_strPassword; std::shared_ptr<DFITCSECMdApi> m_pUserApi; unsigned int m_uRequestID = 0; bool m_boolIsOnline = false; std::mutex m_mtxLoginSignal; condition_variable m_cvLoginSignalCV; std::mutex m_mtxLogoutSignal; condition_variable m_cvLogoutSignalCV; boost::shared_mutex m_mapObserverStructProtector; unordered_map<string, pair<COptionTick,list< tuple < MStrategy*, TMarketDataIdType, boost::shared_mutex*,atomic_uint_least64_t *> > > > m_mapInsid2Strategys; unordered_map< MStrategy*, list<string> > m_mapStrategy2Insids; public: static const string s_strTypeword; static const string s_strAccountKeyword; CDFITC_SOP_MDPlugin(); ~CDFITC_SOP_MDPlugin(); int m_intRefCount = 0; atomic_bool m_abIsPending; bool IsPedding(); virtual bool IsOnline(); virtual void IncreaseRefCount(); virtual void DescreaseRefCount(); virtual int GetRefCount(); virtual void CheckSymbolValidity(const unordered_map<string, string> &); virtual string GetCurrentKeyword(); virtual string GetProspectiveKeyword(const ptree &); virtual void GetState(ptree & out); virtual void MDInit(const ptree &); virtual void MDHotUpdate(const ptree &); virtual void MDUnload(); atomic<bool> m_adbIsPauseed; virtual void Pause(); virtual void Continue(); virtual void MDAttachStrategy( MStrategy *, TMarketDataIdType, const unordered_map<string, string> &, boost::shared_mutex &, atomic_uint_least64_t *); virtual void MDDetachStrategy(MStrategy*/*IN*/); private: bool Start(); void Stop(); void ShowMessage(severity_levels,const char * fmt, ...); void TimerHandler(boost::asio::deadline_timer* timer, const boost::system::error_code& err); virtual void OnFrontConnected(); virtual void OnFrontDisconnected(int nReason); virtual void OnRspSOPUserLogin(struct DFITCSECRspUserLoginField * pRspUserLogin, struct DFITCSECRspInfoField * pRspInfo); virtual void OnRspSOPUserLogout(struct DFITCSECRspUserLogoutField * pRspUsrLogout, struct DFITCSECRspInfoField * pRspInfo); virtual void OnRspSOPSubMarketData(struct DFITCSECSpecificInstrumentField * pSpecificInstrument, struct DFITCSECRspInfoField * pRspInfo); virtual void OnRspSOPUnSubMarketData(struct DFITCSECSpecificInstrumentField * pSpecificInstrument, struct DFITCSECRspInfoField * pRspInfo); virtual void OnRspError(struct DFITCSECRspInfoField *pRspInfo); virtual void OnSOPMarketData(struct DFITCSOPDepthMarketDataField * pMarketDataField); }; #endif <|start_filename|>common/StrategyData.cpp<|end_filename|> #include "Order.h" #include <string> #include "StrategyData.h" #include <boost/date_time/gregorian/gregorian.hpp> #include <boost/date_time/posix_time/posix_time.hpp> #include <fstream> #include <algorithm> #include <unordered_map> #ifndef BOOST_SPIRIT_THREADSAFE #define BOOST_SPIRIT_THREADSAFE #endif #include <boost/property_tree/ptree.hpp> #include <boost/property_tree/json_parser.hpp> #include <boost/date_time/posix_time/posix_time.hpp> using namespace std::tr1; using namespace boost::posix_time; using namespace std; using namespace StrategyData; bool LoadStrategyParam(string filename, CParNode * ppar) { if (NULL == ppar) return false; unordered_map<string, string> pars; ifstream inFile(filename, ios::binary); if (inFile.is_open()) { try { boost::property_tree::ptree in_config; boost::property_tree::read_json(inFile, in_config); auto ParamNode = in_config.find("param"); if (ParamNode != in_config.not_found()) { for (auto & node : ParamNode->second) pars[node.first] = node.second.data(); } } catch (std::exception & err) { return false; } inFile.close(); } else return false; for (unsigned int index = 0;strlen(ppar[index].m_arrayParname) != 0;index++) { if (pars.find(ppar[index].m_arrayParname) != pars.end()) { if (nullptr != ppar[index].m_pIntAddress) *ppar[index].m_pIntAddress = atoi(pars[ppar[index].m_arrayParname].c_str()); else if (nullptr != ppar[index].m_pDoubleAddress) *ppar[index].m_pDoubleAddress = atof(pars[ppar[index].m_arrayParname].c_str()); else if (nullptr != ppar[index].m_pTimeDuraAddress) *ppar[index].m_pTimeDuraAddress = duration_from_string(pars[ppar[index].m_arrayParname]); else if (nullptr != ppar[index].m_pStringAddress) snprintf(ppar[index].m_pStringAddress, ppar[index].m_intOption,"%s", pars[ppar[index].m_arrayParname].c_str()); } } return true; } <|start_filename|>develop/pysimulate/simulate_kernel.cpp<|end_filename|> #include "stdafx.h" //#include "SimulateKernelInterface.h" #include "MySimulateKernel.h" #include "DlgConfig.h" #include <unordered_map> #include <fstream> #include <atomic> #include "OrderRefResolve.h" #include <boost/filesystem/path.hpp> #include <boost/filesystem/operations.hpp> #include <boost/filesystem.hpp> #include "Tick.h" #include "FutureTick.h" #include "OptionTick.h" #include "TwsTick.h" #include "StockTick.h" #include "ForexTick.h" #include <limits> #include <numeric> #pragma region ptree #define BOOST_SPIRIT_THREADSAFE #include <boost/property_tree/ptree.hpp> #include <boost/property_tree/json_parser.hpp> using namespace boost::property_tree; #pragma endregion using namespace std::tr1; using namespace std; #include "QuantFundHFTBackTestTypedefine.h" #ifdef _DEBUG #define new DEBUG_NEW #endif void AbandonOverlap(vector<CTick*>&result); class MSimulateKernelInterface; __declspec(dllexport) MSimulateKernelInterface * MSimulateKernelInterface::CreateSimulateKernel(MSimulateKernelEnvironment *_env) { MSimulateKernelInterface * ret; try { ret = new CMySimulateKernel(_env); } catch (bad_alloc&) { return NULL; } return ret; } //template <typename T> //T Mid(T a, T b, T c) //{ //#define SWAP(x,y) (temp=x,x=y,y=temp) // T temp; // if (a > b) // SWAP(a, b); // if (b > c)//9 8 7 // SWAP(b, c); // if (a > b)//9 8 7 // SWAP(a, b); // return b; //} // //#define CURRENTTIME_UINT64 (m_vecSortedTick->GetTickSerial()[m_uCurrentTickIndex]->m_datetimeUTCDateTime) void ThrowException(const char * fmt, ...) { va_list args; char buf[1024]; va_start(args, fmt); vsprintf_s(buf, fmt, args); va_end(args); throw std::exception(buf); } #define SIM_KER_THROW(fmt,...) ThrowException(fmt"[file:%s line:%d]",__VA_ARGS__,__FILE__,__LINE__); class CDataSerial { public: ifstream m_File; CFutureTick m_tickFutureTick; CStockTick m_tickStockTick; COptionTick m_tickOptionTick; CTwsTick m_tickTwsTick; CForexTick m_tickForexTick; boost::archive::binary_iarchive * m_pInputArchive = nullptr; TStrategyTickType m_enumTickType; size_t m_intLength = 0; size_t m_intRemainTickCount = 0; TMarketDataIdType m_uDataid = 0; bool Init(string filename) { try { m_File.open(filename, ios::binary|ios::in); if (m_File.is_open()) { m_pInputArchive = new boost::archive::binary_iarchive(m_File); *m_pInputArchive & m_enumTickType; *m_pInputArchive & m_intRemainTickCount; m_intLength = m_intRemainTickCount; SetNextTick(); } else return false; return true; } catch (...) { return false; } } bool SetNextTick() { try { switch (m_enumTickType) { case FutureTick: {*m_pInputArchive & m_tickFutureTick; m_tickFutureTick.m_uDataID = m_uDataid;} break; case OptionTick: {*m_pInputArchive & m_tickOptionTick; m_tickOptionTick.m_uDataID = m_uDataid;} break; case ForexTick: {*m_pInputArchive & m_tickForexTick; m_tickForexTick.m_uDataID = m_uDataid;} break; case StockTick: {*m_pInputArchive & m_tickStockTick; m_tickStockTick.m_uDataID = m_uDataid;} break; case TwsTick: {*m_pInputArchive & m_tickTwsTick; m_tickTwsTick.m_uDataID = m_uDataid;} break; } } catch (std::exception & err) { return false; } return true; } ptime & GetTime() { switch (m_enumTickType) { case TStrategyTickType::FutureTick: return m_tickFutureTick.m_datetimeUTCDateTime; case TStrategyTickType::OptionTick: return m_tickOptionTick.m_datetimeUTCDateTime; case TStrategyTickType::ForexTick: return m_tickForexTick.m_datetimeUTCDateTime; case TStrategyTickType::StockTick: return m_tickStockTick.m_datetimeUTCDateTime; case TStrategyTickType::TwsTick: return m_tickTwsTick.m_datetimeUTCDateTime; } return m_tickFutureTick.m_datetimeUTCDateTime; } CTick * GetTick() { switch (m_enumTickType) { case TStrategyTickType::FutureTick: return dynamic_cast<CTick * >(&m_tickFutureTick); case TStrategyTickType::OptionTick: return dynamic_cast<CTick * >(&m_tickOptionTick); case TStrategyTickType::ForexTick: return dynamic_cast<CTick * >(&m_tickForexTick); case TStrategyTickType::StockTick: return dynamic_cast<CTick * >(&m_tickStockTick); case TStrategyTickType::TwsTick: return dynamic_cast<CTick * >(&m_tickTwsTick); } return dynamic_cast<CTick * >(&m_tickFutureTick); } ~CDataSerial() { if (m_pInputArchive) delete m_pInputArchive; if (m_File.is_open()) m_File.close(); } }; auto MergeTickCompaire = [](CDataSerial * a, CDataSerial * b)->bool { if (a->GetTime() > b->GetTime()) return true; else if (a->GetTime() < b->GetTime()) return false; else return strcmp(a->GetTick()->m_strInstrumentID, b->GetTick()->m_strInstrumentID) > 0; }; CMySimulateKernel::CMySimulateKernel(MSimulateKernelEnvironment * _env):m_environment(_env) { m_enumTradePriceType = TradePrice_BestPrice; } void CMySimulateKernel::Release() { delete this; } void CMySimulateKernel::StartBackTest( MStrategy * pStrategy,/*IN*/ vector<string> tickFiles, string strInArchiveFile,/*IN*/ string strOutArchiveFile,/*IN*/ const ptree config,/*IN*/ unsigned int flags,/*IN*/ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// CBackTestResult * out/*OUT*/ ) { if (nullptr == pStrategy) SIM_KER_THROW("MStrategy pointer is nullptr."); if (nullptr == out) SIM_KER_THROW("out pointer is nullptr."); if(tickFiles.empty()) SIM_KER_THROW("tickFiles is empty."); m_uFlags = flags; m_Out = out; m_vecProbeUpdateList.clear(); m_listOrdersTobeHandle.clear(); mapSysId2OrderRef.clear(); m_vecOnTickTimeConsuming.clear(); out->Init(); out->m_vecNGraphProbeInfo.clear(); out->m_vecKGraphProbeInfo.clear(); out->m_vecTimeSerial.clear(); out->m_vecMessages.clear(); out->m_mapOrders.clear(); out->m_mapCriterions.clear(); out->m_vecInqueries.clear(); out->m_uSerialLength = 0; time_duration SubmitDelay = milliseconds(200); time_duration CancelDelay = milliseconds(90); size_t OverAllTickCount = 0; ptime InitTime = max_date_time; LARGE_INTEGER Freq; LARGE_INTEGER WinBegin; LARGE_INTEGER WinEnd; unsigned int m_uCurrentTickIndex = 0; #pragma region 读取配置 auto SimulateKernelNode = config.find("SimulateKernel"); if (config.not_found() != SimulateKernelNode) { auto TradePriceTypeNode = SimulateKernelNode->second.find("TradePriceType"); if (TradePriceTypeNode != SimulateKernelNode->second.not_found()) { string TradePriceTypeString = TradePriceTypeNode->second.data(); if ("FixPrice" == TradePriceTypeString) { m_enumTradePriceType = TradePrice_FixPrice; } else if ("BestPrice" == TradePriceTypeString) { m_enumTradePriceType = TradePrice_BestPrice; } } else m_enumTradePriceType = TradePrice_BestPrice; auto AutoUpdateChartNode = SimulateKernelNode->second.find("AutoUpdateChart"); if (AutoUpdateChartNode != SimulateKernelNode->second.not_found()) { string AutoUpdateChartNodeString = AutoUpdateChartNode->second.data(); if ("On" == AutoUpdateChartNodeString) { m_boolAutoUpdateChart = true; } else if ("Off" == AutoUpdateChartNodeString) { m_boolAutoUpdateChart = false; } } else m_boolAutoUpdateChart = true; auto SharedValueInitNode = SimulateKernelNode->second.find("SharedValueInit"); if (SharedValueInitNode != SimulateKernelNode->second.not_found()) { for (auto & node : SharedValueInitNode->second) m_Out->m_mapSharedValue[atoi(node.first.c_str())] = atof(node.second.data().c_str()); } auto SubmitDelayMillisNode = SimulateKernelNode->second.find("SubmitDelayMillis"); if (SubmitDelayMillisNode != SimulateKernelNode->second.not_found()) SubmitDelay = milliseconds(atoi(SubmitDelayMillisNode->second.data().c_str())); auto CancelDelayMillisNode = SimulateKernelNode->second.find("CancelDelayMillis"); if (CancelDelayMillisNode != SimulateKernelNode->second.not_found()) CancelDelay = milliseconds(atoi(CancelDelayMillisNode->second.data().c_str())); } #pragma endregion priority_queue<CDataSerial *, vector<CDataSerial *>, decltype(MergeTickCompaire) > que(MergeTickCompaire); TProbeStructType ProbeMatrix = pStrategy->GetProbeStruct(); if (flags&Simulate_HasOnTickTimeConsuming) QueryPerformanceFrequency(&Freq); // 获取时钟周期 for (size_t i = 0;i < tickFiles.size();i++) { auto temp = new CDataSerial(); if(false == temp->Init(tickFiles[i])) SIM_KER_THROW("Could not open file %s", tickFiles[i].c_str()); temp->m_uDataid = i; que.push(temp); --temp->m_intRemainTickCount; OverAllTickCount += temp->m_intLength; out->m_vecInstruments.push_back(temp->GetTick()->m_strInstrumentID); if (temp->GetTick()->m_datetimeUTCDateTime < InitTime) InitTime = temp->GetTick()->m_datetimeUTCDateTime; } if(OverAllTickCount == 0) SIM_KER_THROW("There is no tick date."); m_pCurrentTop = que.top(); out->m_vecLastTick.resize(tickFiles.size()); if ((flags&Simulate_HasProbes)&&nullptr != ProbeMatrix) { m_Out->m_vecTimeSerial.reserve(OverAllTickCount); for (auto _Graph = 0;;_Graph++) { if (nullptr == ProbeMatrix[_Graph][0].m_AtomicDoublePointer) break; else { vector< std::tuple< string/*name*/, TProbeColorType/*Color*/, std::shared_ptr<vector<unsigned int>>/*Index*/, std::shared_ptr<vector<float>>/*Value*/ > > tempInfo; TProbeNodeType temp; for (auto _Serial = 0;;_Serial++) { if (nullptr == ProbeMatrix[_Graph][_Serial].m_AtomicDoublePointer) { if (strcmp("Candlesticks", ProbeMatrix[_Graph][_Serial].m_strProbeName) == 0) { m_Out->m_vecKGraphProbeInfo.push_back(tempInfo); } else { m_Out->m_vecNGraphProbeInfo.push_back(make_pair(ProbeMatrix[_Graph][_Serial].m_strProbeName, tempInfo)); } break; } else { tempInfo.push_back( make_tuple( ProbeMatrix[_Graph][_Serial].m_strProbeName, ProbeMatrix[_Graph][_Serial].m_enumColor, std::shared_ptr<vector<unsigned int>>(new vector<unsigned int>(), [](vector<unsigned int> * p) {if (p)delete p;}), std::shared_ptr<vector<float>>(new vector<float>(), [](vector<float> * p) {if (p)delete p;}) ) ); m_vecProbeUpdateList.push_back( make_tuple( get<2>(tempInfo[tempInfo.size() - 1]), get<3>(tempInfo[tempInfo.size() - 1]), ProbeMatrix[_Graph][_Serial].AtomicCounterOverallPointer, ProbeMatrix[_Graph][_Serial].m_AtomicDoublePointer ) ); //vecProbeUpdateList.push_back(make_pair(make_pair(y, x), make_pair(ProbeMatrix[y][x].AtomicCounterOverallPointer,ProbeMatrix[y][x].m_AtomicDoublePointer))); } } } } } if ( (flags&Simulate_HasProbes) && (flags&Simulate_HasCustomFloatProfit) ) { m_Out->m_vecCustomFloatingProfit.reserve(OverAllTickCount); m_Out->m_vecCustomFloatingProfitTimeSerial.reserve(OverAllTickCount); } m_environment->OnUpdateProgress(0, OverAllTickCount); if(flags&Simulate_HasOnTickTimeConsuming) m_vecOnTickTimeConsuming.resize(OverAllTickCount); if (strInArchiveFile.empty()) { if (TLastErrorIdType::LB1_NO_ERROR != pStrategy->OnInit(InitTime - microseconds(100))) { SIM_KER_THROW("OnInit Failed."); } } else { try { pStrategy->OnLoad(strInArchiveFile.c_str()); } catch (std::exception & err) { AfxMessageBox(L"载入文档错误"); } if (TLastErrorIdType::LB1_NO_ERROR != pStrategy->OnInit_FromArchive(InitTime - microseconds(100))) throw std::exception("OnInit_FromArchive Failed."); } while (que.empty() == false) { m_pCurrentTop = que.top(); que.pop(); { m_pLastTick_Global = m_pCurrentTop->GetTick(); string temp = to_iso_string(m_pLastTick_Global->m_datetimeUTCDateTime) + " " + m_pLastTick_Global->m_strInstrumentID; #pragma region 推送给策略 if (flags&Simulate_HasOnTickTimeConsuming) QueryPerformanceCounter(&WinBegin); pStrategy->OnTick( static_cast<TMarketDataIdType>(m_pLastTick_Global->m_uDataID), m_pLastTick_Global ); if (flags&Simulate_HasOnTickTimeConsuming) { QueryPerformanceCounter(&WinEnd); m_vecOnTickTimeConsuming[m_uCurrentTickIndex] = (WinEnd.QuadPart - WinBegin.QuadPart) * 1000000 / Freq.QuadPart; } if ( (flags&Simulate_HasProbes) && (flags&Simulate_HasCustomFloatProfit) ) { double FloatingProfit=0; if (pStrategy->OnGetFloatingProfit(&FloatingProfit)&&abs(FloatingProfit)>0.0001) { m_Out->m_vecCustomFloatingProfit.push_back(FloatingProfit); m_Out->m_vecCustomFloatingProfitTimeSerial.push_back(m_pLastTick_Global->m_datetimeUTCDateTime); } } #pragma endregion for (auto ord : m_listOrdersTobeHandle) {//检查待处理列表里是否有报单被激活 if ( false == ord->m_boolActived && m_pLastTick_Global->m_datetimeUTCDateTime >= ord->m_u64UTCDateTime + SubmitDelay ) ord->m_boolActived = true; } if (m_listOrdersTobeHandle.size() != 0) { do { m_boolNewOrder = false; m_boolNewCancel = false; auto ord = m_listOrdersTobeHandle.begin(); while (ord != m_listOrdersTobeHandle.end()) { switch ((*ord)->m_enumOrderStatus) { case LB1_StatusUnknown: { (*ord)->m_enumOrderStatus = LB1_StatusNoTradeQueueing; ShowMessage( -1, "%s OnRtnOrder (Before) OrderID:%lld CancelID:%s Price:%10.4lf VolumeTraded:%10d VolumeRemaind:%10d Status:%d", to_iso_string(m_pLastTick_Global->m_datetimeUTCDateTime).c_str(), (*ord)->m_OrderID, (TOrderSysIdType)(*ord)->m_strOrderSysID.c_str(), (*ord)->m_LimitPrice, (*ord)->m_TradedVolume, (*ord)->m_Volume, (*ord)->m_enumOrderStatus); pStrategy->OnOrder( (*ord)->m_OrderID, (TOrderSysIdType)(*ord)->m_strOrderSysID.c_str(), (*ord)->m_enumDirection, TOrderStatusType::LB1_StatusNoTradeQueueing, 0, (*ord)->m_TradedVolume, (*ord)->m_Volume ); //++ord; } case LB1_StatusPartTradedQueueing: case LB1_StatusNoTradeQueueing: { if ( ((*ord)->m_boolActived)//如果报单已经被激活 && ((*ord)->m_uDataId == m_pLastTick_Global->m_uDataID)//如果当前tick与该报单的DataID一致 ) { CTick * DeterminantTick_Channel = m_pLastTick_Global; bool CanDeal = false; switch (m_enumTradePriceType) { case TradePrice_FixPrice: CanDeal = (*ord)->m_enumDirection == LB1_Buy ? ( (*ord)->m_LimitPrice >= DeterminantTick_Channel->m_dbAskPrice[0] || (*ord)->m_LimitPrice > DeterminantTick_Channel->m_dbLastPrice ) : ( (*ord)->m_LimitPrice <= DeterminantTick_Channel->m_dbBidPrice[0] || (*ord)->m_LimitPrice < DeterminantTick_Channel->m_dbLastPrice ); break; case TradePrice_BestPrice: CanDeal = (*ord)->m_enumDirection == LB1_Buy ? ((*ord)->m_LimitPrice >= DeterminantTick_Channel->m_dbAskPrice[0]) : ((*ord)->m_LimitPrice <= DeterminantTick_Channel->m_dbBidPrice[0]); break; } if (CanDeal) { TPriceType TrPriThisTime = 0.0; TVolumeType TrVolThisTime = 0; switch (m_enumTradePriceType) { case TradePrice_FixPrice: { TrPriThisTime = (*ord)->m_LimitPrice;//成交价格就是下单的价格 if (LB1_Buy == (*ord)->m_enumDirection) TrVolThisTime = min( (*ord)->m_Volume - (*ord)->m_TradedVolume, DeterminantTick_Channel->m_intAskVolume[0] );//成交量按照第一档成交 else TrVolThisTime = min( (*ord)->m_Volume - (*ord)->m_TradedVolume, DeterminantTick_Channel->m_intBidVolume[0] );//成交量按照第一档成交 } break; case TradePrice_BestPrice: { TVolumeType tarVolume = ((*ord)->m_Volume - (*ord)->m_TradedVolume); TVolumeType accVolume = 0; double tarSum = 0; if (LB1_Buy == (*ord)->m_enumDirection) { for (unsigned int i = 0;i < MAX_QUOTATIONS_DEPTH;i++) { if ((*ord)->m_LimitPrice < DeterminantTick_Channel->m_dbAskPrice[i]) break; if (tarVolume == accVolume) break; TVolumeType thisLevelVolume = min(tarVolume - accVolume, DeterminantTick_Channel->m_intAskVolume[i]); tarSum += thisLevelVolume*DeterminantTick_Channel->m_dbAskPrice[i]; accVolume += thisLevelVolume; } } else if (LB1_Sell == (*ord)->m_enumDirection) { for (unsigned int i = 0;i < MAX_QUOTATIONS_DEPTH;i++) { if ((*ord)->m_LimitPrice > DeterminantTick_Channel->m_dbBidPrice[i]) break; if (tarVolume == accVolume) break; TVolumeType thisLevelVolume = min(tarVolume - accVolume, DeterminantTick_Channel->m_intBidVolume[i]); tarSum += thisLevelVolume*DeterminantTick_Channel->m_dbBidPrice[i]; accVolume += thisLevelVolume; } } TrPriThisTime = tarSum / accVolume; TrVolThisTime = accVolume; } break; } if (0 != TrVolThisTime) { (*ord)->m_TradeLimitPrice = TrPriThisTime; (*ord)->m_TradedVolume += TrVolThisTime; (*ord)->m_u64TradeUTCDateTime = m_pLastTick_Global->m_datetimeUTCDateTime; if ((*ord)->m_TradedVolume == (*ord)->m_Volume) (*ord)->m_enumOrderStatus = LB1_StatusAllTraded; else (*ord)->m_enumOrderStatus = LB1_StatusPartTradedQueueing; ShowMessage( -1, "%s OnRtnTrade (Before) OrderID:%lld CancelID:%s Price:%10.4lf VolumeTraded:%10d", to_iso_string((*ord)->m_u64TradeUTCDateTime).c_str(), (*ord)->m_OrderID, (TOrderSysIdType)(*ord)->m_strOrderSysID.c_str(), (*ord)->m_TradeLimitPrice, TrVolThisTime);//(*ord)->m_TradedVolume pStrategy->OnTrade( (*ord)->m_OrderID, (TOrderSysIdType)(*ord)->m_strOrderSysID.c_str(), TrVolThisTime,//(*ord)->m_TradedVolume, (*ord)->m_TradeLimitPrice, (*ord)->m_enumDirection, (*ord)->m_enumOffset ); ShowMessage( -1, "%s OnRtnOrder (Before) OrderID:%lld CancelID:%s Price:%10.4lf VolumeTraded:%10d VolumeRemaind:%10d Status:%d ", to_iso_string(m_pLastTick_Global->m_datetimeUTCDateTime).c_str(), (*ord)->m_OrderID, (TOrderSysIdType)(*ord)->m_strOrderSysID.c_str(), (*ord)->m_LimitPrice, (*ord)->m_TradedVolume, (*ord)->m_Volume - (*ord)->m_TradedVolume, (*ord)->m_enumOrderStatus); pStrategy->OnOrder( (*ord)->m_OrderID, (TOrderSysIdType)(*ord)->m_strOrderSysID.c_str(), (*ord)->m_enumDirection, (*ord)->m_enumOrderStatus, (*ord)->m_TradeLimitPrice, (*ord)->m_TradedVolume, (*ord)->m_Volume - (*ord)->m_TradedVolume ); if (LB1_StatusAllTraded == (*ord)->m_enumOrderStatus) m_listOrdersTobeHandle.erase(ord++); else ++ord; } else ++ord; } else ++ord; } else ++ord; } break; case LB1_StatusCanceled: { if (m_pLastTick_Global->m_datetimeUTCDateTime >= (*ord)->m_u64TryCancelUTCDateTime + CancelDelay) { (*ord)->m_u64CanceledUTCDateTime = m_pLastTick_Global->m_datetimeUTCDateTime; ShowMessage( -1, "%s OnRtnOrder (Before) OrderID:%lld CancelID:%s Price:%10.4lf VolumeTraded:%10d VolumeRemaind:%10d Status:%d ", to_iso_string(m_pLastTick_Global->m_datetimeUTCDateTime).c_str(), (*ord)->m_OrderID, (TOrderSysIdType)(*ord)->m_strOrderSysID.c_str(), (*ord)->m_LimitPrice, (*ord)->m_TradedVolume, (*ord)->m_Volume - (*ord)->m_TradedVolume, LB1_StatusCanceled); pStrategy->OnOrder( (*ord)->m_OrderID, (TOrderSysIdType)(*ord)->m_strOrderSysID.c_str(), (*ord)->m_enumDirection, LB1_StatusCanceled, 0, (*ord)->m_TradedVolume, (*ord)->m_Volume - (*ord)->m_TradedVolume); m_listOrdersTobeHandle.erase(ord++); } else ++ord; } break; } } } while (m_boolNewOrder || m_boolNewCancel); } m_uCurrentTickIndex++; if (m_boolAutoUpdateChart) UpdateChart(); if (m_uCurrentTickIndex % 1000 == 0) m_environment->OnUpdateProgress(m_uCurrentTickIndex, OverAllTickCount); } if (m_pCurrentTop->m_intRemainTickCount > 0) { m_pCurrentTop->SetNextTick(); que.push(m_pCurrentTop); if (1 == m_pCurrentTop->m_intRemainTickCount) out->m_vecLastTick[m_pCurrentTop->m_uDataid] = *m_pCurrentTop->GetTick(); --m_pCurrentTop->m_intRemainTickCount; }else delete m_pCurrentTop; } pStrategy->OnEndup(); if (false == strOutArchiveFile.empty()) { try { pStrategy->OnSave(strOutArchiveFile.c_str()); } catch (std::exception & err) { AfxMessageBox(L"保存错误"); } } char buf[128]; if (flags&Simulate_HasOnTickTimeConsuming) { double SumConsume = 0; for (auto i : m_vecOnTickTimeConsuming) SumConsume += i; double AverageConsume = SumConsume / m_vecOnTickTimeConsuming.size(); sprintf_s(buf, "%lf", AverageConsume); m_Out->m_mapCriterions["OnTick函数耗时平均值(微秒)"] = buf; } double PositiveSlip = 0; unsigned int CancelCount = 0; for (auto & ord : m_Out->m_mapOrders) { if (ord.second.m_TradedVolume > 0) PositiveSlip += abs(ord.second.m_LimitPrice - ord.second.m_TradeLimitPrice); else CancelCount++; } sprintf_s(buf, "%lf", PositiveSlip); m_Out->m_mapCriterions["有利滑点"] = buf; sprintf_s(buf, "%d", CancelCount); m_Out->m_mapCriterions["撤单次数"] = buf; m_environment->OnUpdateProgress(m_Out->m_uSerialLength, m_Out->m_uSerialLength); m_environment->OnBackTestFinished(); } #pragma region StrategyContext bool CMySimulateKernel::Inquery(TStrategyIdType stid, MStrategyInquiryDataInterface * inquery) { m_Out->m_vecInqueries.push_back(make_pair(m_pCurrentTop->GetTick()->m_datetimeUTCDateTime,inquery)); return true; } bool CMySimulateKernel::MeddleResponse(TStrategyIdType, const char *, ...) { return true; } bool CMySimulateKernel::ShowMessage(TStrategyIdType, const char * fmt, ...) { if (Simulate_HasMessage&m_uFlags) { va_list args; char buf[1024]; va_start(args, fmt); vsprintf_s(buf, fmt, args); va_end(args); wstring mes = CA2W(buf); m_Out->m_vecMessages.push_back( make_pair( m_pCurrentTop->GetTick()->m_datetimeUTCDateTime, mes ) ); } return true; } bool CMySimulateKernel::GetNextMeddle(TStrategyIdType, char * retbuffer, unsigned int maxlength) { return false; } TOrderRefIdType CMySimulateKernel::MakeOrder( TStrategyIdType strategyid, TOrderType, TOrderDirectionType direction, TOrderOffsetType offset, TVolumeType volume, TPriceType LimitPrice, TMarketDataIdType DataId, TCustomRefPartType custom) { char sysid[30]; m_boolNewOrder = true; COrder ord; ord.m_boolActived = false; ord.m_u64TradeUTCDateTime = not_a_date_time;//成交时间 ord.m_enumOrderStatus = LB1_StatusUnknown; ord.m_u64TryCancelUTCDateTime = not_a_date_time; ord.m_u64CanceledUTCDateTime = not_a_date_time; ord.m_TradeLimitPrice = -1;//实际成交 ord.m_TradedVolume = 0;//实际成交手数 ord.m_enumOrderType = LB1_NormalLimitOrderType; ord.m_enumDirection = direction; ord.m_enumOffset = offset; ord.m_Volume = volume; ord.m_LimitPrice = LimitPrice; ord.m_uDataId = DataId; ord.m_u64UTCDateTime =m_pCurrentTop->GetTick()->m_datetimeUTCDateTime; ord.m_OrderID = (m_Out->m_mapOrders.size()<< _StrategyCustomBitCount)+ (custom & _MaskFor4Bit); sprintf_s(sysid, "%lld", ord.m_OrderID); ord.m_strOrderSysID = sysid; mapSysId2OrderRef[sysid] = ord.m_OrderID; m_Out->m_mapOrders[ord.m_OrderID] = ord; m_listOrdersTobeHandle.push_back(&m_Out->m_mapOrders[ord.m_OrderID]); ShowMessage( -1, "%s LimitOrder (Before) OrderID:%lld DataID:%1d Price:%10.4lf Direction:%s Offset:%s Volume:%10d", to_iso_string(ord.m_u64UTCDateTime).c_str(), ord.m_OrderID, DataId, LimitPrice, direction == LB1_Buy ? "Buy" : "Sell", offset == LB1_Increase ? "+" : "-", volume); return ord.m_OrderID; } TLastErrorIdType CMySimulateKernel::CancelOrder( TStrategyIdType, TOrderRefIdType, TOrderSysIdType sysid, TMarketDataIdType dataid) { m_boolNewCancel = true; if (mapSysId2OrderRef.find(sysid) == mapSysId2OrderRef.end()) return LB1_INVALID_VAL;//如果策略撤销一个不存在的单子,则返回无效 if ( find_if( m_listOrdersTobeHandle.begin(), m_listOrdersTobeHandle.end(), [sysid](const COrder* ord) { return ord->m_strOrderSysID == string(sysid); }) == m_listOrdersTobeHandle.end() )//如果策略撤销一个已经稳定的单子,则忽略 return LB1_NO_ERROR; if (LB1_StatusCanceled == m_Out->m_mapOrders[mapSysId2OrderRef[sysid]].m_enumOrderStatus) return LB1_NO_ERROR;//如果策略撤销一个已经被撤消过一次的单子,则忽略 m_Out->m_mapOrders[mapSysId2OrderRef[sysid]].m_u64TryCancelUTCDateTime = m_pCurrentTop->GetTick()->m_datetimeUTCDateTime; m_Out->m_mapOrders[mapSysId2OrderRef[sysid]].m_enumOrderStatus = LB1_StatusCanceled; ShowMessage( -1, "%s CancOrder (Before) CancelID:%s", to_iso_string(m_Out->m_mapOrders[mapSysId2OrderRef[sysid]].m_u64TryCancelUTCDateTime).c_str(), sysid); return LB1_NO_ERROR; } void CMySimulateKernel::UpdateChart() { #pragma region 取探针数据 if (Simulate_HasProbes&m_uFlags) { m_Out->m_uSerialLength++; for (auto & data : m_vecProbeUpdateList) { get<Index_ResBuff>(data)->push_back(get<IndexAddr>(data) == nullptr ? 0 : get<IndexAddr>(data)->load()); get<Value_ResBuff>(data)->push_back(get<ValueAddr>(data)->load()); } m_Out->m_vecTimeSerial.push_back(m_pLastTick_Global->m_datetimeUTCDateTime); } #pragma endregion } bool CMySimulateKernel::GetSharedValue(TSharedIndexType i, double & ret) { if (m_Out->m_mapSharedValue.find(i) != m_Out->m_mapSharedValue.end()) { ret = m_Out->m_mapSharedValue[i]; return true; } else return false; } bool CMySimulateKernel::IncreaseSharedValue(TSharedIndexType i, double dt, function<bool(double)> issatisfy) { if (m_Out->m_mapSharedValue.find(i) == m_Out->m_mapSharedValue.end()) return false; if (issatisfy(m_Out->m_mapSharedValue[i])) { m_Out->m_mapSharedValue[i] += dt; ShowMessage(-1,"SharedValue[%d]=%lf", i, m_Out->m_mapSharedValue[i]); return true; } else return false; } bool CMySimulateKernel::DecreaseSharedValue(TSharedIndexType i, double dt, function<bool(double)> issatisfy) { if (m_Out->m_mapSharedValue.find(i) == m_Out->m_mapSharedValue.end()) return false; if (issatisfy(m_Out->m_mapSharedValue[i])) { m_Out->m_mapSharedValue[i] -= dt; ShowMessage(-1, "SharedValue[%d]=%lf", i, m_Out->m_mapSharedValue[i]); return true; } else return false; } bool CMySimulateKernel::SetSharedValue(TSharedIndexType i, double newvalue, function<bool(double)> issatisfy) { if (issatisfy(m_Out->m_mapSharedValue[i])) { m_Out->m_mapSharedValue[i] = newvalue; ShowMessage(-1, "SharedValue[%d]=%lf", i, m_Out->m_mapSharedValue[i]); return true; } else return false; } int CMySimulateKernel::GetRemainCancelAmount(TStrategyIdType, TMarketDataIdType) { return (std::numeric_limits<int>::max)(); } #pragma endregion <|start_filename|>trade/public.h<|end_filename|> #ifndef _COMMONFILES_COMPRETRADESYSTEMHEADERS_PUBLIC_H_ #define _COMMONFILES_COMPRETRADESYSTEMHEADERS_PUBLIC_H_ #define ARCHIVE_FILE_SUFFIX ".sarchive" #ifdef WIN32 #define WIN32_LEAN_AND_MEAN #include <windows.h> #define _WIN32_WINNT 0x0501 #define FILE_PATH_SEPARATOR "\\" #define STRATEGY_SUFFIX ".dll" #define snprintf _snprintf typedef HINSTANCE StrategyHandleType; #define LoadStrategyBin(filename) LoadLibraryA(filename) #define UnLoadStrategyBin(handle) FreeLibrary(handle) #define GetProcessAddressByName(handle,name) GetProcAddress(handle, name) #else #include <dlfcn.h> #include <pthread.h> #include <linux/unistd.h> #include <sys/syscall.h> #include <iconv.h> #include<fcntl.h> #include<sys/types.h> #include<unistd.h> #define FILE_PATH_SEPARATOR "/" #define STRATEGY_SUFFIX ".so" typedef void * StrategyHandleType; #define LoadStrategyBin(filename) dlopen(filename,RTLD_NOW) #define UnLoadStrategyBin(handle) dlclose(handle) #define GetProcessAddressByName(handle,name) dlsym(handle,name) #endif #endif <|start_filename|>common/ReportKernelInterface.h<|end_filename|> //#include "stdafx.h" #include "StrategyContext.h" #include "StrategyData.h" #include "Order.h" #include <map> #include <vector> #include "ReportStructs.h" #include <unordered_map> #define BOOST_SPIRIT_THREADSAFE #include <boost/property_tree/ptree.hpp> #include <boost/property_tree/json_parser.hpp> using namespace boost::property_tree; #include "BackTestResult.h" using namespace std::tr1; using namespace std; using namespace HFTReportNamespace; typedef unordered_map<TOrderRefIdType, COrder> TOrderMapType; typedef unordered_map<TMarketDataIdType, CInstrumentInfoForReport> TInsInfoMapType; typedef map<date, CReportForDay> TEachDayReportType; class AFX_EXT_CLASS MReportKernelInterface { public: static MReportKernelInterface* CreateReportKernel(); virtual bool Calculate(CBackTestResult * inandout, const ptree config) = 0; virtual void Release() = 0; }; <|start_filename|>third/TwsApi/TwsApi.h<|end_filename|> #pragma once #include "TwsSpi.h" #include "TwsDataStructDef.h" #ifdef WIN32 #ifdef _EXPORT #define EXPORT_INTERFACE __declspec(dllexport) #else #define EXPORT_INTERFACE __declspec(dllimport) #endif #else #define EXPORT_INTERFACE #endif class EXPORT_INTERFACE MTwsApi { public: static MTwsApi * CreateApi(); virtual void RegisterSpi(CTwsSpi *pSpi) = 0; virtual int Connect(const char * pAddress,unsigned int port, unsigned int clientID) = 0; virtual int DisConnect() = 0; virtual int SubscribeMarketData(const CTwsContractField *) = 0; virtual int UnSubscribeMarketData(const CTwsContractField *) = 0; virtual int Release() = 0; virtual bool GetValue(const char * key, const char * currency, char * retval, size_t len) = 0; virtual TTwsOrderIdType ReqOrderInsert(CTwsContractField *, CTwsInputOrderField *) = 0; virtual void ReqOrderCancel(TTwsOrderIdType) = 0; }; <|start_filename|>common/ReportStructs.h<|end_filename|> #pragma once #include <boost/date_time/gregorian/gregorian.hpp> #include <boost/date_time/posix_time/posix_time.hpp> #include "StrategyData.h" using namespace boost::posix_time; using namespace boost::gregorian; namespace HFTReportNamespace { using namespace StrategyData; enum _charge_type { _charge_type_Fix, _charge_type_Float }; struct CInstrumentInfoForReport { unsigned int m_uMultiNumber; _charge_type open_type; double open_value; _charge_type close_type; double close_value; }; struct CReportForDay { CReportForDay(): m_uOrderCount(0), m_dbCoveredProfit(0.0), m_dbUnCoveredProfit(0.0), m_dbFee(0.0){} unsigned int m_uOrderCount; TPriceType m_dbCoveredProfit; TPriceType m_dbUnCoveredProfit; TPriceType m_dbFee; }; struct CForEveryOrder { CForEveryOrder( ptime ActionTime, TOrderRefIdType orderid, double Profit, double AccumulatedProfit) :m_timeActionTime(ActionTime), m_OrderId(orderid), m_dbProfit(Profit), m_dbAccumulatedProfit(AccumulatedProfit){} ptime m_timeActionTime; TOrderRefIdType m_OrderId; double m_dbProfit; double m_dbAccumulatedProfit; }; } <|start_filename|>common/tick/StockTick.h<|end_filename|> #ifndef _STOCK_TICK_H_ #define _STOCK_TICK_H_ #include "Tick.h" class CStockTick : public CTick { public: TPriceType m_dbUpperLimitPrice; TPriceType m_dbLowerLimitPrice; TPriceType m_dbOpenPrice; TPriceType m_dbHighestPrice; TPriceType m_dbLowestPrice; TPriceType m_dbPreClosePrice; template<class Archive> void serialize(Archive& ar, const unsigned int version) { ar & boost::serialization::base_object<CTick>(*this); ar & m_dbUpperLimitPrice; ar & m_dbLowerLimitPrice; ar & m_dbOpenPrice; ar & m_dbHighestPrice; ar & m_dbLowestPrice; ar & m_dbPreClosePrice; } }; #endif <|start_filename|>common/trade_headers/AtmTradePluginInterface.h<|end_filename|> #ifndef _COMPRETRADESYSTEMHEADERS_ATMTRADEPLUGININTERFACE_H_ #define _COMPRETRADESYSTEMHEADERS_ATMTRADEPLUGININTERFACE_H_ #include "StrategyData.h" #include "StrategyDefine.h" #ifndef BOOST_SPIRIT_THREADSAFE #define BOOST_SPIRIT_THREADSAFE #endif #include <boost/property_tree/ptree.hpp> #include "TradePluginContextInterface.h" #include <unordered_map> #include "AtmPluginInterface.h" using namespace StrategyData; using namespace std; using namespace boost::property_tree; class MAtmTradePluginInterface: public MAtmPluginInterface { public: virtual bool IsPedding() = 0; virtual void TDInit(const ptree &, MTradePluginContextInterface*, unsigned int AccountNumber) = 0; virtual void TDHotUpdate(const ptree &) = 0; virtual void TDUnload() = 0; virtual TOrderRefIdType TDBasicMakeOrder( TOrderType ordertype, unordered_map<string, string> & instrument, TOrderDirectionType direction, TOrderOffsetType offset, TVolumeType volume, TPriceType LimitPrice, TOrderRefIdType orderRefBase ) = 0; virtual TLastErrorIdType TDBasicCancelOrder(TOrderRefIdType,unordered_map<string, string> &, TOrderSysIdType) = 0; virtual int TDGetRemainAmountOfCancelChances(const char *) = 0; }; #endif <|start_filename|>common/tick/OptionTick.h<|end_filename|> #ifndef _OPTION_TICK #define _OPTION_TICK #include "Tick.h" enum TTradingPhaseCodeType { AuctionPhase,TradingPhase, CircuitBreakingPhase }; class COptionTick : public CTick { public: ptime m_datetimeTradingDateTime; TPriceType m_dbOpenPrice; TPriceType m_dbHighestPrice; TPriceType m_dbLowestPrice; TPriceType m_dbClosePrice; TPriceType m_dbAuctionPrice; TTradingPhaseCodeType m_enumPhase; template<class Archive> void serialize(Archive& ar, const unsigned int version) { ar & boost::serialization::base_object<CTick>(*this); ar & m_datetimeTradingDateTime; ar & m_dbOpenPrice; ar & m_dbHighestPrice; ar & m_dbLowestPrice; ar & m_dbClosePrice; ar & m_dbAuctionPrice; ar & m_enumPhase; } }; #endif <|start_filename|>third/TwsApi/TwsDataTypeDef.h<|end_filename|> #ifndef _TWS_DATA_TYPE_DEF_H_ #define _TWS_DATA_TYPE_DEF_H_ typedef unsigned long TTwsOrderIdType; typedef long TTwsTimeType; typedef double TTwsPriceType; typedef long TTwsVolumeType; typedef unsigned int TTwsClientIDType; enum TTwsCurrencyType {USD,JPY,GBP,CHF,}; enum TTwsActionType { Tws_BUY, Tws_SELL, Tws_SSHORT }; enum TTwsTimeInForceType { Tws_DAY, Tws_GTC, Tws_IOC, Tws_GTD }; enum TTwsSecTypeType { Tws_STK, Tws_OPT, Tws_FUT, Tws_IND, Tws_FOP, Tws_CASH, Tws_BAG}; enum TTwsOrderSideType { Tws_BOT, Tws_SLD}; enum TTwsOrderStatusType { Tws_PendingSubmit , Tws_PendingCancel, Tws_PreSubmitted, Tws_Submitted, Tws_Cancelled, Tws_Filled, Tws_Inactive}; #endif <|start_filename|>trade/connection.cpp<|end_filename|> #include "connection.hpp" #include <vector> #include <boost/bind.hpp> #include <sstream> #include <iostream> #include <string> #ifndef BOOST_SPIRIT_THREADSAFE #define BOOST_SPIRIT_THREADSAFE #endif #include <boost/property_tree/ptree.hpp> #include <boost/property_tree/json_parser.hpp> using namespace boost::property_tree; using namespace std; namespace http { namespace server2 { connection::connection(boost::asio::io_service& io_service, CCommuModForServSpi * handler) : socket_(io_service), request_handler_(handler) {} boost::asio::ip::tcp::socket& connection::socket() { return socket_; } size_t connection::ReadComplete(const boost::system::error_code & err, size_t bytes) { if (err) return 0; if (bytes >= MAX_READ_BUFFER_LENGTH) return 0; if (bytes < sizeof(int32_t)) return 1; else { if (*(int32_t*)read_buffer_ <= static_cast<int32_t>(bytes)) { read_buffer_[*(int32_t*)read_buffer_] = 0; return 0; } else return 1; } } void connection::start() { async_read( socket_, boost::asio::buffer(read_buffer_, MAX_READ_BUFFER_LENGTH), boost::bind(&connection::ReadComplete, this, _1, _2), boost::bind(&connection::handle_read, shared_from_this(), boost::asio::placeholders::error, boost::asio::placeholders::bytes_transferred) ); } void connection::handle_read(const boost::system::error_code& e, std::size_t bytes_transferred) { if (!e) { std::stringstream in_ss, out_ss; ptree in_tree, out_tree; try { in_ss << read_buffer_ + sizeof(int32_t); read_json(in_ss, in_tree); request_handler_->OnCommunicate(in_tree, out_tree); write_json(out_ss, out_tree); if (out_ss.str().size() > MAX_WRITE_BUFFER_LENGTH - sizeof(int32_t)) throw std::runtime_error("The size of output is longer than MAX_WRITE_BUFFER_LENGTH"); *((int32_t*)write_buffer_)= out_ss.str().size()+sizeof(int32_t); strcpy(write_buffer_ + sizeof(int32_t), out_ss.str().c_str()); write_buffer_[out_ss.str().size() + sizeof(int32_t)] = 0; } catch (std::exception &err) { ptree error; error.put("error", err.what()); std::stringstream ss_error; write_json(ss_error, error); *((int32_t*)write_buffer_) = strlen(ss_error.str().c_str())+sizeof(int32_t); strcpy(write_buffer_ + sizeof(int32_t), ss_error.str().c_str()); write_buffer_[ss_error.str().size() + sizeof(int32_t)] = 0; } catch (...) { ptree error; error.put("error", "CommunicateError"); std::stringstream ss_error; write_json(ss_error, error); *((int32_t*)write_buffer_) = strlen(ss_error.str().c_str()) + sizeof(int32_t); strcpy(write_buffer_ + sizeof(int32_t), ss_error.str().c_str()); write_buffer_[ss_error.str().size() + sizeof(int32_t)] = 0; } boost::asio::async_write(socket_, boost::asio::buffer(write_buffer_, *((int32_t*)write_buffer_)), boost::bind(&connection::handle_write, shared_from_this(), boost::asio::placeholders::error)); } } void connection::handle_write(const boost::system::error_code& e) { if (!e) { boost::system::error_code ignored_ec; socket_.shutdown(boost::asio::ip::tcp::socket::shutdown_both, ignored_ec); } } } } <|start_filename|>trade/md_plugins/TWS_MDPlugin/TWS_MDPlugin.h<|end_filename|> #ifndef _QFCOMPRETRADESYSTEM_ATMMARKETDATAPLUGINS_TWS_MDPlugin_H_ #define _QFCOMPRETRADESYSTEM_ATMMARKETDATAPLUGINS_TWS_MDPlugin_H_ #include <string> #include <boost/thread.hpp> #include <thread> // std::thread #include <mutex> // std::mutex, std::unique_lock #include <condition_variable> // std::condition_variable #include <atomic> #include <boost/asio.hpp> #include <memory> #include <boost/date_time/posix_time/posix_time.hpp> #include <future> #include <tuple> #include <boost/log/common.hpp> #include "TwsApi/TwsApi.h" #include "TwsApi/TwsDataStructDef.h" #include "TwsApi/TwsDataTypeDef.h" #include "TwsApi/TwsSpi.h" #include "SeverityLevel.h" #include <vector> #include "TwsTick.h" #include "AtmPluginInterface.h" #include "AtmMarketDataPluginInterface.h" using namespace boost::posix_time; using namespace boost::gregorian; using namespace boost::asio; using namespace std; class CTWS_MDPlugin : public MAtmMarketDataPluginInterface, public CTwsSpi { boost::log::sources::severity_logger< severity_levels > m_Logger; io_service m_IOservice; deadline_timer m_StartAndStopCtrlTimer; std::future<bool> m_futTimerThreadFuture; string m_strServerAddress; unsigned int m_uPort; unsigned int m_uClientID; std::shared_ptr<MTwsApi> m_pUserApi; unsigned int m_uRequestID = 0; bool m_boolIsOnline = false; std::mutex m_mtxLoginSignal; condition_variable m_cvLoginSignalCV; boost::shared_mutex m_mapObserverStructProtector; unordered_map<string, pair<CTwsTick,list< tuple < MStrategy*, TMarketDataIdType, boost::shared_mutex*, atomic_uint_least64_t *> > > > m_mapInsid2Strategys; unordered_map< MStrategy*, list<string> > m_mapStrategy2Insids; public: static const string s_strAccountKeyword; CTWS_MDPlugin(); ~CTWS_MDPlugin(); int m_intRefCount = 0; atomic_bool m_abIsPending; bool IsPedding(); virtual bool IsOnline(); virtual void IncreaseRefCount(); virtual void DescreaseRefCount(); virtual int GetRefCount(); virtual void CheckSymbolValidity(const unordered_map<string, string> &); virtual string GetCurrentKeyword(); virtual string GetProspectiveKeyword(const ptree &); virtual void GetState(ptree & out); virtual void MDInit(const ptree &); virtual void MDHotUpdate(const ptree &); virtual void MDUnload(); atomic<bool> m_adbIsPauseed= false; virtual void Pause(); virtual void Continue(); virtual void MDAttachStrategy( MStrategy *, TMarketDataIdType, const unordered_map<string, string> &, boost::shared_mutex &, atomic_uint_least64_t *); virtual void MDDetachStrategy(MStrategy*/*IN*/); private: bool Start(); void Stop(); void ShowMessage(severity_levels,const char * fmt, ...); void TimerHandler(boost::asio::deadline_timer* timer, const boost::system::error_code& err); virtual void OnRspUserLogin(CTwsRspUserLoginField * loginField, bool IsSucceed); virtual void OnRtnDepthMarketData(CTwsDepthMarketDataField * pDepthMarketData); virtual void OnRspError(int ErrID, int ErrCode, const char * ErrMsg); virtual void OnDisconnected(); }; #endif <|start_filename|>common/tick/TwsTick.h<|end_filename|> #ifndef _TWS_TICK_H_ #define _TWS_TICK_H_ #include <boost/date_time/gregorian/gregorian.hpp> #include <boost/date_time/posix_time/posix_time.hpp> #include "Tick.h" using namespace boost::posix_time; using namespace boost::gregorian; using namespace boost::posix_time; class CTwsTick : public CTick { public: bool m_boolValid; long m_longConId; char m_strSecType[8]; char m_strExpiry[8]; //double m_dbStrike; //char m_strRight[64]; //char m_strMultiplier[64]; char m_strExchange[10]; char m_strPrimaryExchange[10]; char m_strCurrency[6]; //char m_strLocalSymbol[10]; //char m_strTradingClass[10]; //bool m_boolIncludeExpired; //char m_strSecIdType[10]; //char m_strSecId[10]; //double m_dbOpenPrice; //double m_dbHighPrice; //double m_dbLowPrice; //double m_dbClosePrice; int m_intLastSize; template<class Archive> void serialize(Archive& ar, const unsigned int version) { ar & boost::serialization::base_object<CTick>(*this); ar & m_boolValid; ar & m_longConId; ar & m_strSecType; ar & m_strExpiry; //ar & m_dbStrike; //ar & m_strRight; //ar & m_strMultiplier; ar & m_strExchange; ar & m_strPrimaryExchange; ar & m_strCurrency; //ar & m_strLocalSymbol; //ar & m_strTradingClass; //ar & m_boolIncludeExpired; //ar & m_strSecIdType; //ar & m_strSecId; //ar & m_dbOpenPrice; //ar & m_dbHighPrice; //ar & m_dbLowPrice; //ar & m_dbClosePrice; ar & m_intLastSize; } }; #endif <|start_filename|>common/trade_headers/public.h<|end_filename|> #ifndef _QFCOMPRETRADESYSTEM_ATM_PUBLIC_H_ #define _QFCOMPRETRADESYSTEM_ATM_PUBLIC_H_ enum severity_levels { normal, warning, error }; #endif <|start_filename|>common/tick/ForexTick.h<|end_filename|> #ifndef _FOREX_TICK #define _FOREX_TICK #include "Tick.h" class CForexTick : public CTick { public: template<class Archive> void serialize(Archive& ar, const unsigned int version) { ar & boost::serialization::base_object<CTick>(*this); } }; #endif <|start_filename|>trade/trade_service.cpp<|end_filename|> //#include "stdafx.h" #include <fstream> #include <string> #include <iostream> #include <memory> #include <exception> #include <sstream> #include <algorithm> #include <boost/regex.hpp> #include "public.h" #include "OrderRefResolve.h" #include <boost/date_time/posix_time/posix_time.hpp> using namespace boost::posix_time; using namespace boost::gregorian; #include <boost/log/common.hpp> #ifndef WIN32 #include <unistd.h> #endif #ifndef BOOST_SPIRIT_THREADSAFE #define BOOST_SPIRIT_THREADSAFE #endif #include <boost/property_tree/ptree.hpp> #include <boost/property_tree/json_parser.hpp> using namespace boost::property_tree; namespace logging = boost::log; namespace attrs = boost::log::attributes; namespace src = boost::log::sources; namespace sinks = boost::log::sinks; namespace expr = boost::log::expressions; namespace keywords = boost::log::keywords; using namespace boost::property_tree; using namespace std; #include "trade_service.h" #include "OrderRefResolve.h" string GetNodeData(string name, const ptree & root) { auto Node = root.find(name); if (Node == root.not_found()) { char buf[128]; snprintf(buf, sizeof(buf), "can not find <%s>", name.c_str()); throw std::runtime_error(buf); } else return Node->second.data(); } extern char ProcessName[256]; class CPauseMdSourceRAII { vector<PluginPtrType> * m_P; public: CPauseMdSourceRAII(vector<PluginPtrType> * p) :m_P(p) {}; void Pause() { for(auto & ptr: *m_P) dynamic_cast<MAtmMarketDataPluginInterface*>(ptr.get())->Pause(); } ~CPauseMdSourceRAII() { for (auto & ptr : *m_P) dynamic_cast<MAtmMarketDataPluginInterface*>(ptr.get())->Continue(); }; }; class CDynamicLinkLibraryRAII { StrategyHandleType m_hHandle; public: StrategyHandleType GetHandle() { return m_hHandle; }; CDynamicLinkLibraryRAII(const char * name) { m_hHandle = LoadStrategyBin(name); } ~CDynamicLinkLibraryRAII() { if(m_hHandle) UnLoadStrategyBin(m_hHandle); } }; CTradeService::CTradeService(std::string configFile, unsigned int sysnum):m_strConfigFile(configFile) { m_uSystemNumber = sysnum; m_vecAllTradeSource.first.resize(_MaxAccountNumber + 1); } CTradeService::~CTradeService() { if (m_pApi) { m_pApi->Release(); m_pApi = nullptr; } } void CTradeService::Start() { auto temp=MCommuModForServInterface::CreateApi(GetAddress().c_str(),GetListenPort(), this, GetNetHandlerThreadCount()); m_pApi = temp; if (m_pApi) m_pApi->StartListen(); } void CTradeService::Join() { #ifdef WIN32 Sleep(INFINITE); #else sleep(0); #endif } std::string CTradeService::GetStrategyBinPath() { ptree g_Config; boost::property_tree::read_json(m_strConfigFile, g_Config); if (g_Config.find("basic") != g_Config.not_found()) { auto Basic = g_Config.find("basic"); if (Basic->second.find("strategypath") != Basic->second.not_found()) { std::string _strategypath = Basic->second.find("strategypath")->second.data(); return _strategypath; } else throw std::runtime_error("[error]could not find 'basic.strategypath' node."); } else throw std::runtime_error("[error]could not find 'basic' node."); } unsigned short CTradeService::GetListenPort() { ptree g_Config; boost::property_tree::read_json(m_strConfigFile, g_Config); if (g_Config.find("basic") != g_Config.not_found()) { auto Basic = g_Config.find("basic"); if (Basic->second.find("listenport") != Basic->second.not_found()) { unsigned short _ListenPort = atoi(Basic->second.find("listenport")->second.data().c_str()); if (0 == _ListenPort) throw std::runtime_error("[error]invalid 'basic.listenport' value."); else return _ListenPort; } else throw std::runtime_error("[error]could not find 'basic.listenport' node."); } else throw std::runtime_error("[error]could not find 'basic' node."); } size_t CTradeService::GetNetHandlerThreadCount() { ptree g_Config; boost::property_tree::read_json(m_strConfigFile, g_Config); if (g_Config.find("basic") != g_Config.not_found()) { auto Basic = g_Config.find("basic"); if (Basic->second.find("nethandlerthreadcount") != Basic->second.not_found()) { unsigned short _NetHandlerThreadCount = atoi(Basic->second.find("nethandlerthreadcount")->second.data().c_str()); if (0 == _NetHandlerThreadCount) throw std::runtime_error("[error]invalid 'basic.nethandlerthreadcount' value."); else return _NetHandlerThreadCount; } else throw std::runtime_error("[error]could not find 'basic.nethandlerthreadcount' node."); } else throw std::runtime_error("[error]could not find 'basic' node."); } void CTradeService::DeployStrategy(const ptree & in,unsigned int & strategyid) { //策略数组互斥: 写互斥 //行情源数组互斥: 读互斥 //交易源数组互斥: 读互斥 string Bin, Archive, ParFile; unordered_map<TMarketDataIdType, pair<vector<PluginPtrType>::iterator, unordered_map<string, string> > > _MD_DataChannelConfig; unordered_map<TMarketDataIdType, pair<vector<PluginPtrType>::iterator, unordered_map<string, string> > > _TD_DataChannelConfig; unsigned int StrategyID = 0; StrategyHandleType _pBinHandle = nullptr; MStrategy * _pStrategy = nullptr; unordered_map<string, string> _paramMap; unsigned int _maxIncreaseOrderCountPerDay = 10; auto MiocpdNode= in.find("maxincreaseordercountperday"); if (MiocpdNode != in.not_found()) _maxIncreaseOrderCountPerDay = atoi(MiocpdNode->second.data().c_str()); auto BinNode = in.find("bin"); if (BinNode == in.not_found() || BinNode->second.data().size() == 0) throw std::runtime_error("Invalid <bin>"); else Bin = string(GetStrategyBinPath()) + FILE_PATH_SEPARATOR + BinNode->second.data() + STRATEGY_SUFFIX; auto ArchiveNode = in.find("archive"); if (ArchiveNode == in.not_found()) Archive = ""; else { if (false == ArchiveNode->second.data().empty()) Archive = ArchiveNode->second.data(); } auto ParamNode = in.find("param"); if (ParamNode != in.not_found()) { for (auto & par : ParamNode->second) _paramMap[par.first] = par.second.data(); } auto DataIDNode = in.find("dataid"); if (DataIDNode == in.not_found()) throw std::runtime_error("Can not find <dataid>."); boost::shared_lock<boost::shared_mutex> rlock_MD(m_vecAllMarketDataSource.second, boost::defer_lock); boost::shared_lock<boost::shared_mutex> rlock_TD(m_vecAllTradeSource.second, boost::defer_lock); boost::unique_lock<boost::shared_mutex> wlock_ST(m_mtxAllStrategys, boost::defer_lock); std::lock(rlock_MD, rlock_TD, wlock_ST); for (auto & PerDataIdNode : DataIDNode->second) { TMarketDataIdType dataid = atoi(PerDataIdNode.first.c_str()); vector<PluginPtrType>::iterator mdsresult; vector<PluginPtrType>::iterator tdsresult; unordered_map<string, string> instrumentid; auto MarketDataSourceNode = PerDataIdNode.second.find("marketdatasource"); if (PerDataIdNode.second.not_found() != MarketDataSourceNode) { mdsresult = find_if( m_vecAllMarketDataSource.first.begin(), m_vecAllMarketDataSource.first.end(), [MarketDataSourceNode](PluginPtrType ptr) { if (ptr && ptr->GetCurrentKeyword() == MarketDataSourceNode->second.data()) return true; else return false; } ); if (mdsresult == m_vecAllMarketDataSource.first.end()) { string exp = "This marketdatasource(" + MarketDataSourceNode->second.data() + ") does not exist."; throw std::runtime_error(exp.c_str()); } } else throw std::runtime_error("Can not find <marketdatasource>."); auto TradeSourceNode = PerDataIdNode.second.find("tradesource"); if (PerDataIdNode.second.not_found() != TradeSourceNode) { tdsresult = find_if( m_vecAllTradeSource.first.begin(), m_vecAllTradeSource.first.end(), [TradeSourceNode](PluginPtrType ptr) { if ( ptr && ptr->GetCurrentKeyword() == TradeSourceNode->second.data()) return true; else return false; } ); if (tdsresult == m_vecAllTradeSource.first.end()) throw std::runtime_error("This tradesource does not exist."); } else throw std::runtime_error("Can not find <tradesource>."); auto SymbolDefineNode = PerDataIdNode.second.find("symboldefine"); if (PerDataIdNode.second.not_found() != SymbolDefineNode) { for (auto & attr : SymbolDefineNode->second) instrumentid[attr.first] = attr.second.data(); } else throw std::runtime_error("Can not find <symboldefine>."); _MD_DataChannelConfig[dataid] = make_pair(mdsresult, instrumentid); _TD_DataChannelConfig[dataid] = make_pair(tdsresult, instrumentid); } for (auto & cfg : _MD_DataChannelConfig) (*cfg.second.first)->CheckSymbolValidity(cfg.second.second); for (auto & cfg : _TD_DataChannelConfig) (*cfg.second.first)->CheckSymbolValidity(cfg.second.second); for (;(StrategyID <= _MaxStrategyID) && (nullptr != m_arrayAllStrategys[StrategyID].m_pStrategy); StrategyID++); if (StrategyID > _MaxStrategyID) throw std::runtime_error("Too many strategys MaxStrategyID."); _pBinHandle = LoadStrategyBin(Bin.c_str()); if (nullptr == _pBinHandle) throw std::runtime_error("loadstrategybin failed."); typedef MStrategy * (*TFNCreateStrategyObject)(MStrategyContext*, TStrategyIdType); auto Creator = (TFNCreateStrategyObject)GetProcessAddressByName(_pBinHandle, "CreateStrategyObject"); if (nullptr == Creator) { UnLoadStrategyBin(_pBinHandle); throw std::runtime_error("can not export creator."); } _pStrategy = (*Creator)(this, StrategyID); if (nullptr == _pStrategy) { UnLoadStrategyBin(_pBinHandle); throw std::runtime_error("can not create strategy."); } m_arrayAllStrategys[StrategyID].clear(); m_arrayAllStrategys[StrategyID].m_pBinHandle = _pBinHandle; m_arrayAllStrategys[StrategyID].m_pStrategy = _pStrategy; m_arrayAllStrategys[StrategyID].m_uStrategyID = StrategyID; m_arrayAllStrategys[StrategyID].m_pathStrategyPath = boost::filesystem::path(Bin); m_arrayAllStrategys[StrategyID].m_treeConfig = in; m_arrayAllStrategys[StrategyID].m_uMaxIncreaseOrderCountPerDay = _maxIncreaseOrderCountPerDay; m_arrayAllStrategys[StrategyID].m_uRemainIncreaseOrderCountPerDay = _maxIncreaseOrderCountPerDay; m_arrayAllStrategys[StrategyID].m_dateActionDate = second_clock::universal_time().date(); string error = ""; if (!Archive.empty()) { try { m_arrayAllStrategys[StrategyID].m_pStrategy->OnLoad(Archive.c_str()); } catch (std::exception & err) { error = string("Strategy load archive exception.") + err.what(); } } if (error.empty()) { CParNode * ppar = m_arrayAllStrategys[StrategyID].m_pStrategy->GetParamStruct(); if (ppar && (false == _paramMap.empty())) { for (auto & par : _paramMap) { bool Found = false; for (unsigned int index = 0;(index < MAXPARNAMELENGTH) && (strlen(ppar[index].m_arrayParname) != 0);index++) { if (strcmp(ppar[index].m_arrayParname, par.first.c_str()) == 0) { Found = true; if (nullptr != ppar[index].m_pIntAddress) *ppar[index].m_pIntAddress = atoi(par.second.c_str()); else if (nullptr != ppar[index].m_pDoubleAddress) *ppar[index].m_pDoubleAddress = atof(par.second.c_str()); else if (nullptr != ppar[index].m_pTimeDuraAddress) { time_duration temptd; try { temptd = duration_from_string(par.second); } catch (...) { break; } *ppar[index].m_pTimeDuraAddress = temptd; } else if (nullptr != ppar[index].m_pStringAddress) snprintf(ppar[index].m_pStringAddress, ppar[index].m_intOption, "%s",par.second.c_str()); break; } } if (false == Found) { error = "can not find param {" + par.first + "}"; break; } } } } if (error.empty()) { if (Archive.empty()) { if (m_arrayAllStrategys[StrategyID].m_pStrategy->OnInit(microsec_clock::universal_time()) != TLastErrorIdType::LB1_NO_ERROR) error = "Strategy OnInit failed."; } else if (m_arrayAllStrategys[StrategyID].m_pStrategy->OnInit_FromArchive(microsec_clock::universal_time()) != TLastErrorIdType::LB1_NO_ERROR) { error = "Strategy OnInit failed."; } } if (error.empty() == false) { m_arrayAllStrategys[StrategyID].m_pStrategy->OnRelease(); UnLoadStrategyBin(m_arrayAllStrategys[StrategyID].m_pBinHandle); m_arrayAllStrategys[StrategyID].clear(); throw std::runtime_error(error.c_str()); } auto & ProbeInfo = m_arrayAllStrategys[StrategyID].m_vecProbeInfo; TProbeStructType ProbeMatrix = m_arrayAllStrategys[StrategyID].m_pStrategy->GetProbeStruct(); if (nullptr != ProbeMatrix) { for (auto y = 0;;y++) { if (nullptr == ProbeMatrix[y][0].m_AtomicDoublePointer) break; else { ProbeInfo.push_back(make_pair("", vector< std::tuple<string, TProbeColorType, atomic<double>*, atomic<unsigned >*> >())); for (auto x = 0;;x++) { if (nullptr == ProbeMatrix[y][x].m_AtomicDoublePointer) { ProbeInfo[y].first = ProbeMatrix[y][x].m_strProbeName; break; } else { ProbeInfo[y].second.push_back( make_tuple( ProbeMatrix[y][x].m_strProbeName, ProbeMatrix[y][x].m_enumColor, ProbeMatrix[y][x].m_AtomicDoublePointer, ProbeMatrix[y][x].AtomicCounterOverallPointer ) ); } } } } } for (auto & cfg : _TD_DataChannelConfig) { m_arrayAllStrategys[StrategyID].m_mapDataid2TradeApi[cfg.first] = make_pair( dynamic_cast<MAtmTradePluginInterface*>(cfg.second.first->get()), cfg.second.second); (*cfg.second.first)->IncreaseRefCount(); } for (auto & cfg : _MD_DataChannelConfig) { auto Source = dynamic_cast<MAtmMarketDataPluginInterface*>(cfg.second.first->get()); m_arrayAllStrategys[StrategyID].m_mapDataid2MarketDataApi[cfg.first] = Source; Source->MDAttachStrategy( _pStrategy, cfg.first, cfg.second.second, m_arrayAllStrategys[StrategyID].m_mtxPropectStrategy, &m_arrayAllStrategys[StrategyID].m_auProbeUpdateDatetime); (*cfg.second.first)->IncreaseRefCount(); } strategyid = StrategyID; } void CTradeService::CancelStrategy(unsigned int StrategyID, string & sarchive, ptree & config) { boost::shared_lock<boost::shared_mutex> rlock_MD(m_vecAllMarketDataSource.second, boost::defer_lock); boost::shared_lock<boost::shared_mutex> rlock_TD(m_vecAllTradeSource.second, boost::defer_lock); boost::shared_lock<boost::shared_mutex> rlock_ST(m_mtxAllStrategys, boost::defer_lock); std::lock(rlock_MD, rlock_TD, rlock_ST); auto & Strategy = m_arrayAllStrategys[StrategyID]; if (nullptr == Strategy.m_pStrategy) throw std::runtime_error("this strategyid does not exists."); config = Strategy.m_treeConfig; for (auto & dataid : Strategy.m_mapDataid2MarketDataApi) { dataid.second->MDDetachStrategy(Strategy.m_pStrategy); dynamic_cast<MAtmPluginInterface*>(dataid.second)->DescreaseRefCount(); } for (auto & dataid : Strategy.m_mapDataid2TradeApi) dynamic_cast<MAtmPluginInterface*>(dataid.second.first)->DescreaseRefCount(); auto SArchiveFilePath = Strategy.m_pathStrategyPath; string timePart = to_iso_string(microsec_clock::local_time()); string SArchiveFileName = SArchiveFilePath.filename().string() + "." + timePart + ARCHIVE_FILE_SUFFIX; try { Strategy.m_pStrategy->OnSave(SArchiveFileName.c_str()); } catch (std::exception & err) { BOOST_LOG_SEV(m_Logger, severity_levels::normal) << ProcessName << ": "<<err.what(); SArchiveFileName = ""; } Strategy.m_pStrategy->OnEndup(); Strategy.m_pStrategy->OnRelease(); if (Strategy.m_pBinHandle) UnLoadStrategyBin(Strategy.m_pBinHandle); Strategy.clear(); sarchive = SArchiveFileName; } void CTradeService::OnCommunicate(const ptree & in, ptree & out) { if (in.find("type") != in.not_found()) { auto Type = in.find("type")->second.data(); auto PackageHandler = m_mapString2PackageHandlerType.find(Type); if(PackageHandler == m_mapString2PackageHandlerType.end()) MakeError(out, "invalid <type>"); else { try { PackageHandler->second(in, out); } catch (std::exception & err) { out.clear(); MakeError(out, err.what()); } } } else MakeError(out, "Can not find <type>."); } void CTradeService::MakeError(ptree & out, const char * fmt, ...) { out.put("type", "error"); char buf[STRATEGY_MESSAGE_MAXLEN]; va_list arg; va_start(arg, fmt); auto n=vsnprintf(buf, STRATEGY_MESSAGE_MAXLEN, fmt, arg); va_end(arg); if (n > -1 && n < STRATEGY_MESSAGE_MAXLEN) out.put("errormsg", buf); else out.put("errormsg", "!<buffer is too short to put this message>"); } string CTradeService::GetAddress() { ptree g_Config; boost::property_tree::read_json(m_strConfigFile, g_Config); if (g_Config.find("basic") != g_Config.not_found()) { auto Basic = g_Config.find("basic"); if (Basic->second.find("address") != Basic->second.not_found()) { string _Address = Basic->second.find("address")->second.data().c_str(); if (_Address.empty()) throw std::runtime_error("[error]invalid 'basic.address' value."); else return _Address; } else throw std::runtime_error("[error]could not find 'basic.address' node."); } else throw std::runtime_error("[error]could not find 'basic' node."); } void CTradeService::ReqGetSupportedTypes(PackageHandlerParamType param, const ptree & in, ptree & out) { //只访问常量数据结构,不需要互斥 const unordered_map<string, pair<TPluginFactory, string> > * target=nullptr; if (PackageHandlerParamType::MarketData == param) { out.put("type", "rspgetsupportedmdtypes"); target = &m_mapAMarketDataPFactories; } else { out.put("type", "rspgetsupportedtdtypes"); target = &m_mapATradePFactories; } for (auto & sup : *target) out.put(sup.first, sup.second.second); } void CTradeService::ReqGetAllSource(PackageHandlerParamType param, const ptree & in, ptree & out) { //策略数组互斥: 不需要 //行情源数组互斥: 需要(只读) //交易源数组互斥: 需要(只读) pair<vector<PluginPtrType>, boost::shared_mutex> * target=nullptr; if (PackageHandlerParamType::MarketData == param) target = &m_vecAllMarketDataSource; else target = &m_vecAllTradeSource; boost::shared_lock<boost::shared_mutex> lock(target->second); for (auto mds : target->first) { if (mds) { ptree StateTree; mds->GetState(StateTree); out.add_child(mds->GetCurrentKeyword(), StateTree); } } } void CTradeService::ReqAddSource(PackageHandlerParamType param, const ptree & in, ptree &out) { //策略数组互斥: 不需要 //行情源数组互斥: 需要(写) //交易源数组互斥: 需要(写) const unordered_map<string, pair<TPluginFactory, string> > * tarFactoryMap = nullptr; pair<vector<PluginPtrType>, boost::shared_mutex> * tarContainer = nullptr; if (PackageHandlerParamType::MarketData == param) { tarFactoryMap = &m_mapAMarketDataPFactories; tarContainer = &m_vecAllMarketDataSource; } else { tarFactoryMap = &m_mapATradePFactories; tarContainer = &m_vecAllTradeSource; } if (in.find("sourcetype") != in.not_found()) { auto SourceType = in.find("sourcetype")->second.data(); auto SourceTypeItr = tarFactoryMap->find(SourceType); if (SourceTypeItr != tarFactoryMap->end()) { auto ObjectPlugin = SourceTypeItr->second.first(); boost::unique_lock<boost::shared_mutex> lock(tarContainer->second); auto FindResult= find_if( tarContainer->first.begin(), tarContainer->first.end(), [ObjectPlugin, in](PluginPtrType CurrentPlugin) { return CurrentPlugin && (CurrentPlugin->GetCurrentKeyword() == ObjectPlugin->GetProspectiveKeyword(in));} ); if (FindResult!=tarContainer->first.end()) { if (PackageHandlerParamType::MarketData == param) { MAtmMarketDataPluginInterface * mdObjectPlugin = dynamic_cast<MAtmMarketDataPluginInterface*>(FindResult->get()); if (mdObjectPlugin->IsPedding()) { out.put("type", "rspaddmarketdatasource"); out.put("result", "market data source is pedding."); } else { mdObjectPlugin->MDHotUpdate(in); out.put("type", "rspaddmarketdatasource"); out.put("result", "market data source hotupdate succeed."); } } else { MAtmTradePluginInterface * tdObjectPlugin = dynamic_cast<MAtmTradePluginInterface*>(FindResult->get()); //已经获取了交易源列表的锁 boost::shared_lock<boost::shared_mutex> rlock_MD(m_vecAllMarketDataSource.second, boost::defer_lock); boost::unique_lock<boost::shared_mutex> wlock_ST(m_mtxAllStrategys, boost::defer_lock); std::lock(rlock_MD, wlock_ST); CPauseMdSourceRAII _PlugsPauseRaii(&m_vecAllMarketDataSource.first); _PlugsPauseRaii.Pause(); if (tdObjectPlugin->IsPedding()) { out.put("type", "rspaddtradesource"); out.put("result", "trade source is pedding."); } else { tdObjectPlugin->TDHotUpdate(in); out.put("type", "rspaddtradesource"); out.put("result", "trade source hotupdate succeed."); } } } else { if (PackageHandlerParamType::MarketData == param) { MAtmMarketDataPluginInterface * mdObjectPlugin = dynamic_cast<MAtmMarketDataPluginInterface*>(ObjectPlugin.get()); mdObjectPlugin->MDInit(in); tarContainer->first.push_back(ObjectPlugin); vector<PluginPtrType>(tarContainer->first).swap(tarContainer->first); out.put("type", "rspaddmarketdatasource"); out.put("result", "market data source init succeed."); } else { unsigned int NewAccountNumber = 0; for (;NewAccountNumber < tarContainer->first.size();NewAccountNumber++) { if (tarContainer->first[NewAccountNumber] == nullptr) break; } if (NewAccountNumber >= tarContainer->first.size()) throw std::runtime_error("too much account exists in this process,maxmun 32"); MAtmTradePluginInterface * tdObjectPlugin = dynamic_cast<MAtmTradePluginInterface*>(ObjectPlugin.get()); tdObjectPlugin->TDInit(in, this, NewAccountNumber);// tarContainer->first[NewAccountNumber] = ObjectPlugin; out.put("type", "rspaddtradesource"); out.put("result", "trade source init succeed."); } } } else { string exp = "the sourcetype " + SourceType + " does not support"; throw std::runtime_error(exp.c_str()); } } else throw std::runtime_error("can not find <sourcetype>"); } void CTradeService::ReqDelSource(PackageHandlerParamType param, const ptree & in, ptree & out) { //策略数组互斥: 不需要 //行情源数组互斥: 需要(写) //交易源数组互斥: 需要(写) pair<vector<PluginPtrType>, boost::shared_mutex> * tarContainer = nullptr; if (PackageHandlerParamType::MarketData == param) tarContainer = &m_vecAllMarketDataSource; else tarContainer = &m_vecAllTradeSource; auto Keyword = in.find("keyword"); if (Keyword != in.not_found()) { auto strKeyword = Keyword->second.data(); boost::unique_lock<boost::shared_mutex> lock(tarContainer->second); auto findres = find_if( tarContainer->first.begin(), tarContainer->first.end(), [strKeyword](PluginPtrType ptr) { if (ptr&&ptr->GetCurrentKeyword() == strKeyword) return true; else return false;} ); if (findres == tarContainer->first.end()) { string exp = "the keyword " + strKeyword + " does not exists."; out.put("type", "rspdelmarketdatasource"); out.put("result", exp); } else { if((*findres)->IsPedding()) throw std::runtime_error("this source is pedding"); if ((*findres)->GetRefCount()>0) throw std::runtime_error("some strategy is dependent on it"); if (PackageHandlerParamType::MarketData == param) { MAtmMarketDataPluginInterface * tdObjectPlugin = dynamic_cast<MAtmMarketDataPluginInterface*>((*findres).get()); tdObjectPlugin->MDUnload(); tarContainer->first.erase(findres); out.put("type", "rspdelmarketdatasource"); } else { MAtmTradePluginInterface * tdObjectPlugin = dynamic_cast<MAtmTradePluginInterface*>((*findres).get()); tdObjectPlugin->TDUnload(); findres->reset(); out.put("type", "rspdeltradesource"); } out.put("result", "succeed."); } } else throw std::runtime_error("can not find <keyword>"); } void CTradeService::ReqAllStrategyBin(PackageHandlerParamType param, const ptree & in, ptree & out) { //策略数组互斥: 不需要 //行情源数组互斥: 不需要 //交易源数组互斥: 不需要 namespace fs = boost::filesystem; std::string strategypath = GetStrategyBinPath(); fs::path fullpath(strategypath); fs::directory_iterator item_begin(fullpath); fs::directory_iterator item_end; unsigned int count = 0; for (;item_begin != item_end; item_begin++) { if (false == fs::is_directory(*item_begin)&& item_begin->path().extension().string()== STRATEGY_SUFFIX) { string BinName = item_begin->path().string(); StrategyHandleType handle = LoadStrategyBin(BinName.c_str()); if (nullptr == handle) { #ifdef WIN32 #else BOOST_LOG_SEV(m_Logger, severity_levels::normal) << ProcessName << ": " << dlerror() << " [" << to_iso_string(microsec_clock::universal_time()) << "]"; #endif continue; } else { if (nullptr != GetProcessAddressByName(handle, "CreateStrategyObject")) { char buf[64]; sprintf(buf, "%u", count); string filename = item_begin->path().filename().string(); string bin = filename.substr(0, filename.size() - strlen(STRATEGY_SUFFIX)); out.put(buf, bin); count++; } UnLoadStrategyBin(handle); } } } } void CTradeService::ReqAllArchiveFile(PackageHandlerParamType param, const ptree & in, ptree & out) { //策略数组互斥: 不需要 //行情源数组互斥: 不需要 //交易源数组互斥: 不需要 auto StrategyNameNode = in.find("strategyname"); if(in.not_found()==StrategyNameNode) throw std::runtime_error("can not find <strategyname>"); string strategyName = StrategyNameNode->second.data(); namespace fs = boost::filesystem; std::string strategypath = GetStrategyBinPath(); fs::path fullpath(strategypath); fs::directory_iterator item_begin(fullpath); fs::directory_iterator item_end; unsigned int count = 0; for (;item_begin != item_end; item_begin++) { if (false == fs::is_directory(*item_begin) && item_begin->path().extension().string() == ARCHIVE_FILE_SUFFIX) { string filename = item_begin->path().filename().generic_string(); if (filename.substr(0, strategyName.size()) == strategyName) { char buf[64]; sprintf(buf, "%u", count); out.put(buf, filename); count++; } } } } void CTradeService::ReqDeployNewStrategy(PackageHandlerParamType param, const ptree & in, ptree & out) { unsigned int StrategyID; DeployStrategy(in, StrategyID); out.put("result", "Deploy Strategy succeed."); } void CTradeService::ReqGetAllRunningStrategies(PackageHandlerParamType param, const ptree & in, ptree & out) { //策略数组互斥: 读互斥 //行情源数组互斥: 不需要 //交易源数组互斥: 不需要 boost::shared_lock<boost::shared_mutex> rlock_ST(m_mtxAllStrategys); for (unsigned int i = 0;i <= (_MaxStrategyID);i++) { auto & str = m_arrayAllStrategys[i]; if (nullptr != str.m_pStrategy) { stringstream ss; ss << i; string StrategyID; ss >> StrategyID; ptree Context; auto CommentNode = str.m_treeConfig.find("comment"); auto BinNode = str.m_treeConfig.find("bin"); if (CommentNode != str.m_treeConfig.not_found()) Context.put("comment", CommentNode->second.data()); if (BinNode != str.m_treeConfig.not_found()) Context.put("bin", BinNode->second.data()); Context.put("maxtickets", m_arrayAllStrategys[i].m_uMaxIncreaseOrderCountPerDay); Context.put("remaintickets", m_arrayAllStrategys[i].m_uRemainIncreaseOrderCountPerDay); int position_info; char custom_info[512] = { "-" }; { boost::unique_lock<boost::shared_mutex> wlock_ST(str.m_mtxPropectStrategy, boost::try_to_lock); if (wlock_ST.owns_lock()) { if(str.m_pStrategy->OnGetPositionInfo(&position_info)) Context.put("position", position_info); if (str.m_pStrategy->OnGetCustomInfo(custom_info, sizeof(custom_info))) { custom_info[sizeof(custom_info) - 1] = '\0'; Context.put("custom", custom_info); } } } out.put_child(StrategyID, Context); } } } void CTradeService::ReqCancelRunningStrategies(PackageHandlerParamType param, const ptree & in, ptree & out) { //策略数组互斥: 写互斥 //行情源数组互斥: 读互斥 //交易源数组互斥: 读互斥 auto StrategyNode = in.find("strategyid"); if (in.not_found() == StrategyNode) throw std::runtime_error("can not find <strategyid>"); unsigned int StrategyID = atoi(StrategyNode->second.data().c_str()); if(StrategyID>_MaxStrategyID) throw std::runtime_error("invalid <strategyid>"); string SArchiveFileName; ptree Config; string Result = ""; CancelStrategy(StrategyID, SArchiveFileName, Config); if (Config.find("param") != Config.not_found()) Config.erase("param"); auto archiveNode = Config.find("archive"); if (archiveNode != Config.not_found()) archiveNode->second.data() = SArchiveFileName; else Config.put("archive", SArchiveFileName); string redeploy = to_iso_string(microsec_clock::local_time()) + ".json"; std::shared_ptr<ofstream> save( new ofstream(redeploy), [](ofstream * file) { if (file) { if (file->is_open()) file->close(); delete file; } }); if (save->is_open()) { try { write_json(*save.get(), Config); Result = string("cancel strategy succeed,the redeploy json file is ") + redeploy; } catch (std::exception & err) { Result = string("cancel strategy succeed,But could not write_json redeploy json file. ") + redeploy; } } else Result="cancel strategy succeed.But could not open redeploy json file."; out.put("result", Result); out.put_child("redeploy", Config); } void CTradeService::ReqGetProbe(PackageHandlerParamType param, const ptree & in, ptree & out) { //策略数组互斥: 读互斥 //行情源数组互斥: 不需要 //交易源数组互斥: 不需要 auto StrategyIDnode = in.find("strategyid"); if (in.not_found() == StrategyIDnode) throw std::runtime_error("Can not find <strategyid>"); unsigned int StrategyID = atoi(StrategyIDnode->second.data().c_str()); boost::shared_lock<boost::shared_mutex> rlock3(m_mtxAllStrategys); if(nullptr== m_arrayAllStrategys[StrategyID].m_pStrategy) throw std::runtime_error("This strategy does not exists"); auto & ProbeInfo=m_arrayAllStrategys[StrategyID].m_vecProbeInfo; uint_least64_t datetime = m_arrayAllStrategys[StrategyID].m_auProbeUpdateDatetime.load(); out.put("rawdatetime", datetime); if (ProbeInfo.empty()) return; unsigned int i = 0; ptree allGraph; for (auto & subset : ProbeInfo) { ptree subsetTree; stringstream ss1; string id; ss1 << i; ss1 >> id; ptree serialTree; for (auto & serial : subset.second) { stringstream ss2, ss3; string _strcolor, _strvalue; ptree OneSerial; OneSerial.put("name", get<0>(serial)); ss2 << static_cast<unsigned int>(get<1>(serial)); ss2 >> _strcolor; OneSerial.put("color", _strcolor); double val = (*get<2>(serial)).load(); if(abs(val-PROBE_NULL_VALUE)<10e-6) ss3 <<"NULL" ; else ss3 << val; ss3 >> _strvalue; OneSerial.put("value", _strvalue); if (get<3>(serial) != nullptr) OneSerial.put("count_overall", (*get<3>(serial)).load()); serialTree.put_child(get<0>(serial), OneSerial); } subsetTree.put("style", subset.first); subsetTree.put_child("serials", serialTree); allGraph.put_child(id, subsetTree); i++; } out.put_child("graph", allGraph); } void CTradeService::ReqMeddle(PackageHandlerParamType param, const ptree & in, ptree & out) { //策略数组互斥: 读互斥 //行情源数组互斥: 不需要 //交易源数组互斥: 不需要 auto StrategyIDnode = in.find("strategyid"); if (in.not_found() == StrategyIDnode) throw std::runtime_error("Can not find <strategyid>"); auto Commandnode = in.find("command"); if (in.not_found() == Commandnode) throw std::runtime_error("Can not find <command>"); unsigned int StrategyID = atoi(StrategyIDnode->second.data().c_str()); boost::shared_lock<boost::shared_mutex> rlock_ST(m_mtxAllStrategys); auto & strategy = m_arrayAllStrategys[StrategyID]; if (nullptr == strategy.m_pStrategy) throw std::runtime_error("This strategy does not exists"); else { boost::unique_lock<boost::shared_mutex> wlock(strategy.m_mtxPropectMeddleQueue); string command = Commandnode->second.data(); strategy.m_queueMeddleQueue.push(command); out.put("result", "send meddle string \'"+ command +"\' succeed."); } } void CTradeService::ReqGetMeddleResponse(PackageHandlerParamType param, const ptree & in, ptree & out) { //策略数组互斥: 读互斥 //行情源数组互斥: 不需要 //交易源数组互斥: 不需要 auto StrategyIDnode = in.find("strategyid"); if (in.not_found() == StrategyIDnode) throw std::runtime_error("Can not find <strategyid>"); unsigned int StrategyID = atoi(StrategyIDnode->second.data().c_str()); boost::shared_lock<boost::shared_mutex> rlock(m_mtxAllStrategys); auto & strategy = m_arrayAllStrategys[StrategyID]; if (nullptr == strategy.m_pStrategy) throw std::runtime_error("This strategy does not exists"); else { boost::unique_lock<boost::shared_mutex> wlock(strategy.m_mtxPropectMeddleResponseQueue); int count = 15; while (count >= 0 && (!strategy.m_queueMeddleResponseQueue.empty())) { char buf[16]; sprintf(buf, "%d", count); out.put( buf, to_iso_string(strategy.m_queueMeddleResponseQueue.front().first)+":"+strategy.m_queueMeddleResponseQueue.front().second); strategy.m_queueMeddleResponseQueue.pop(); count--; } } } void CTradeService::ReqStrategyParams(PackageHandlerParamType, const ptree & in, ptree & out) { //策略数组互斥: 不需要 //行情源数组互斥: 不需要 //交易源数组互斥: 不需要 auto StrategyBinNode = in.find("strategybin"); if (in.not_found() == StrategyBinNode) throw std::runtime_error("Can not find <strategybin>"); else { string strategypath = string(GetStrategyBinPath()) + FILE_PATH_SEPARATOR + StrategyBinNode->second.data()+ STRATEGY_SUFFIX; CDynamicLinkLibraryRAII DynamicLinkLib(strategypath.c_str()); if (nullptr == DynamicLinkLib.GetHandle()) throw std::runtime_error("Can not open this strategy bin."); else { auto Creator = (TFNCreateStrategyObject)GetProcessAddressByName(DynamicLinkLib.GetHandle(), "CreateStrategyObject"); if (nullptr!= Creator) { boost::shared_ptr<MStrategy> pStrategy( Creator(this, _MaxStrategyID + 1), [](MStrategy*ptr) { if (ptr) ptr->OnRelease(); }); if (nullptr != pStrategy) { auto ArchiveFileNode = in.find("archivefile"); if (ArchiveFileNode != in.not_found()) { try { pStrategy->OnLoad(ArchiveFileNode->second.data().c_str()); } catch (std::exception & err) { throw std::runtime_error((string("Can not create strategy.") + err.what()).c_str()); } } auto ppar=pStrategy->GetParamStruct(); if (nullptr != ppar) { for (unsigned int iCount = 0;(iCount < MAXPARNAMELENGTH) && (strlen(ppar[iCount].m_arrayParname) != 0);iCount++) { char buf[1024]; if (nullptr != ppar[iCount].m_pIntAddress) snprintf(buf, sizeof(buf), "%d", *ppar[iCount].m_pIntAddress); else if (nullptr != ppar[iCount].m_pDoubleAddress) snprintf(buf, sizeof(buf), "%lf", *ppar[iCount].m_pDoubleAddress); else if (nullptr != ppar[iCount].m_pTimeDuraAddress) snprintf(buf, sizeof(buf), "%s", to_simple_string(*ppar[iCount].m_pTimeDuraAddress).c_str()); else if (nullptr != ppar[iCount].m_pStringAddress) snprintf(buf, sizeof(buf), "%s", ppar[iCount].m_pStringAddress); out.put(ppar[iCount].m_arrayParname, buf); } } } else throw std::runtime_error("Can not create strategy."); } else throw std::runtime_error("Can not find object creator in this bin."); } } } void CTradeService::ReqStrategyConfigJson(PackageHandlerParamType, const ptree & in, ptree & out) { auto StrategyIdNode = in.find("strategyid"); if (in.not_found() == StrategyIdNode) throw std::runtime_error("Can not find <strategyid>"); else { boost::shared_lock<boost::shared_mutex> rlock_ST(m_mtxAllStrategys); unsigned int Strategyid = atoi(StrategyIdNode->second.data().c_str()); if(Strategyid>_MaxStrategyID || Strategyid<0 || nullptr==m_arrayAllStrategys[Strategyid].m_pStrategy) throw std::runtime_error("Invalid strategyid"); out.put_child("result", m_arrayAllStrategys[Strategyid].m_treeConfig); } } void CTradeService::ReqUpdateStrategyBin(PackageHandlerParamType, const ptree & in, ptree & out) { auto StrategyIdNode = in.find("strategyid"); auto NewStrategyBin = in.find("newbin"); if (StrategyIdNode != in.not_found() && NewStrategyBin != in.not_found()) { unsigned int Strategyid = atoi(StrategyIdNode->second.data().c_str()); if(Strategyid>_MaxStrategyID) throw std::runtime_error("valid strategyid"); ptree config; string archiveFilename; string OldStrategyBin; CancelStrategy(Strategyid, archiveFilename, config); if(archiveFilename.empty()) throw std::runtime_error("save archive failed,the strategy is canceled!!"); if (config.find("param") != config.not_found()) config.erase("param"); auto binNode = config.find("bin"); if (binNode != config.not_found()) { OldStrategyBin = binNode->second.data(); binNode->second.data() = NewStrategyBin->second.data(); } else config.put("bin", NewStrategyBin->second.data()); auto archiveNode = config.find("archive"); if (archiveNode != config.not_found()) archiveNode->second.data() = archiveFilename; else config.put("archive", archiveFilename); unsigned int NewStrategyID = 0; string Result = "succeed"; try { DeployStrategy(config, NewStrategyID); } catch (std::exception & err) { Result = string("failed ")+err.what(); config.find("bin")->second.data() = OldStrategyBin; try { DeployStrategy(config, NewStrategyID); } catch (std::exception & e) { Result = string("error ") + err.what(); } } out.put("result", Result); } else throw std::runtime_error("Can not find <strategyid>"); } void CTradeService::ReqModifySharedValue(PackageHandlerParamType, const ptree & in, ptree & out) { //写锁 unsigned int ValueId = 0; double NewValue = 0.0; auto ValueIdNode = in.find("valueid"); if (ValueIdNode != in.not_found()) ValueId = atoi(ValueIdNode->second.data().c_str()); else throw std::runtime_error("can not find <valueid>"); auto NewValueNode = in.find("newvalue"); if (NewValueNode != in.not_found()) NewValue = atof(NewValueNode->second.data().c_str()); else throw std::runtime_error("can not find <newvalue>"); SetSharedValue(ValueId, NewValue, [](double) {return true;}); out.put("type", "rspmodifysharedvalue"); out.put("newvalue", NewValue); } void CTradeService::ReqAllSharedValue(PackageHandlerParamType, const ptree & in, ptree & out) { //读锁 boost::shared_lock<boost::shared_mutex> rlock(m_mtxSharedValue,boost::try_to_lock); if (rlock.owns_lock()) { out.put("type", "rspallsharedvalue"); ptree values; char buf[64]; for (auto & p : m_mapSharedValue) { sprintf(buf, "%u", p.first); values.put(buf, p.second); } out.add_child("values", values); } } void CTradeService::ReqSetOrderTickets(PackageHandlerParamType, const ptree & in, ptree & out) { auto StrategyID = atoi(GetNodeData("strategyid", in).c_str()); auto MaxTicket = atoi(GetNodeData("maxticket", in).c_str()); auto RemainTicket = atoi(GetNodeData("remainticket", in).c_str()); boost::shared_lock<boost::shared_mutex> rlock1(m_mtxAllStrategys); if(StrategyID>_MaxStrategyID|| StrategyID<0) throw std::runtime_error("strategyid error."); if(nullptr == m_arrayAllStrategys[StrategyID].m_pStrategy) throw std::runtime_error("strategyid does not exist."); if(RemainTicket>MaxTicket) throw std::runtime_error("currentticket need be equal or smaller than maxticket."); m_arrayAllStrategys[StrategyID].m_uMaxIncreaseOrderCountPerDay = MaxTicket; m_arrayAllStrategys[StrategyID].m_uRemainIncreaseOrderCountPerDay = RemainTicket; } void CTradeService::ReqGetPositionInfo(PackageHandlerParamType, const ptree & in, ptree & out) { auto StrategyID = atoi(GetNodeData("strategyid", in).c_str()); boost::shared_lock<boost::shared_mutex> rlock1(m_mtxAllStrategys, boost::try_to_lock); if (rlock1.owns_lock()) { if (StrategyID > _MaxStrategyID || StrategyID < 0) throw std::runtime_error("strategyid error."); if (nullptr == m_arrayAllStrategys[StrategyID].m_pStrategy) throw std::runtime_error("strategyid does not exist."); boost::unique_lock<boost::shared_mutex> wlock_strategy(m_arrayAllStrategys[StrategyID].m_mtxPropectStrategy, boost::try_to_lock); if (wlock_strategy.owns_lock()) { int out_position; if (m_arrayAllStrategys[StrategyID].m_pStrategy->OnGetPositionInfo(&out_position)) { out.put("result", "valid"); out.put("positioninfo", out_position); } else out.put("result", "undefined"); } else out.put("result", "unknown"); } else out.put("result", "unknown"); } void CTradeService::ReqGetCustomInfo(PackageHandlerParamType, const ptree & in, ptree & out) { auto StrategyID = atoi(GetNodeData("strategyid", in).c_str()); boost::shared_lock<boost::shared_mutex> rlock1(m_mtxAllStrategys,boost::try_to_lock); if (rlock1.owns_lock()) { if (StrategyID > _MaxStrategyID || StrategyID < 0) throw std::runtime_error("strategyid error."); if (nullptr == m_arrayAllStrategys[StrategyID].m_pStrategy) throw std::runtime_error("strategyid does not exist."); boost::unique_lock<boost::shared_mutex> wlock_strategy(m_arrayAllStrategys[StrategyID].m_mtxPropectStrategy, boost::try_to_lock); if (wlock_strategy.owns_lock()) { char CustomBuf[1024] = {"-"}; if (m_arrayAllStrategys[StrategyID].m_pStrategy->OnGetCustomInfo(CustomBuf, sizeof(CustomBuf))) { CustomBuf[sizeof(CustomBuf) - 1] = '\0'; out.put("result", "valid"); out.put("custominfo", CustomBuf); } else out.put("result", "undefined"); } else out.put("result", "unknown"); } else out.put("result", "unknown"); } void CTradeService::ReqGetFloatingProfit(PackageHandlerParamType, const ptree & in, ptree & out) { std::string StrategiesList = GetNodeData("strategyid", in).c_str(); vector<int> strategids_vec; const boost::regex check_format_reg("([0-9]+,?)+"); boost::cmatch what; if (boost::regex_match(StrategiesList.c_str(), what, check_format_reg)) { const boost::regex digit_reg("(\\d+),?"); for(boost::sregex_iterator it(StrategiesList.begin(), StrategiesList.end(), digit_reg), end; it != end; ++it) strategids_vec.push_back(atoi((*it)[1].str().c_str())); } else throw std::runtime_error("strategyid list error."); boost::shared_lock<boost::shared_mutex> rlock1(m_mtxAllStrategys, boost::try_to_lock); if (rlock1.owns_lock()) { for (auto StrategyID : strategids_vec) { if (StrategyID > _MaxStrategyID || StrategyID < 0) throw std::runtime_error("strategyid error."); if (nullptr == m_arrayAllStrategys[StrategyID].m_pStrategy) throw std::runtime_error("strategyid does not exist."); } double sum_floating_profit = 0; for (auto StrategyID : strategids_vec) { boost::unique_lock<boost::shared_mutex> wlock_strategy(m_arrayAllStrategys[StrategyID].m_mtxPropectStrategy); double profit = 0; if (m_arrayAllStrategys[StrategyID].m_pStrategy->OnGetFloatingProfit(&profit)) sum_floating_profit += profit; else std::runtime_error("some strategy does not support floating profit."); } out.put("result", sum_floating_profit); } else out.put("result", "unknown"); } void CTradeService::ReqStatus(PackageHandlerParamType, const ptree & in, ptree & out) { auto StrategyID = atoi(GetNodeData("strategyid", in).c_str()); boost::shared_lock<boost::shared_mutex> rlock1(m_mtxAllStrategys, boost::try_to_lock); if (rlock1.owns_lock()) { if (StrategyID > _MaxStrategyID || StrategyID < 0) throw std::runtime_error("strategyid error."); if (nullptr == m_arrayAllStrategys[StrategyID].m_pStrategy) throw std::runtime_error("strategyid does not exist."); boost::unique_lock<boost::shared_mutex> wlock_strategy(m_arrayAllStrategys[StrategyID].m_mtxPropectStrategy, boost::try_to_lock); if (wlock_strategy.owns_lock()) { char StatusBuf[256] = { "-" }; if (m_arrayAllStrategys[StrategyID].m_pStrategy->OnGetStatus(StatusBuf, sizeof(StatusBuf))) { StatusBuf[sizeof(StatusBuf) - 1] = '\0'; out.put("result", "valid"); out.put("status", StatusBuf); } else out.put("result", "undefined"); } else out.put("result", "unknown"); } else out.put("result", "unknown"); } bool CTradeService::Inquery(TStrategyIdType stid, MStrategyInquiryDataInterface * inquery) { inquery->Release(); return false; } bool CTradeService::MeddleResponse(TStrategyIdType StrategyID, const char * fmt, ...) { boost::shared_lock<boost::shared_mutex> rlock(m_mtxAllStrategys, boost::try_to_lock); if (rlock.owns_lock()) { auto & strategy = m_arrayAllStrategys[StrategyID]; if (nullptr == strategy.m_pStrategy) return false; else { char buf[MEDDLE_RESPONSE_MAXLEN]; va_list arg; va_start(arg, fmt); vsnprintf(buf, MEDDLE_RESPONSE_MAXLEN, fmt, arg); va_end(arg); boost::unique_lock<boost::shared_mutex> wlock(strategy.m_mtxPropectMeddleResponseQueue, boost::try_to_lock); if (wlock.owns_lock()) { strategy.m_queueMeddleResponseQueue.push(make_pair(microsec_clock::universal_time(), buf)); return true; } else return false; } } else return false; } bool CTradeService::ShowMessage(TStrategyIdType stid, const char * fmt, ...) { char buf[STRATEGY_MESSAGE_MAXLEN]; va_list arg; va_start(arg, fmt); vsnprintf(buf, STRATEGY_MESSAGE_MAXLEN, fmt, arg); va_end(arg); BOOST_LOG_SEV(m_Logger, severity_levels::normal) << ProcessName << "|" << stid << ": " <<buf << " [" << to_iso_string(microsec_clock::universal_time()) << "]"; return true; } bool CTradeService::GetNextMeddle(TStrategyIdType StrategyID, char * retbuffer, unsigned int maxlength) { boost::shared_lock<boost::shared_mutex> rlock(m_mtxAllStrategys, boost::try_to_lock); if (rlock.owns_lock()) { auto & strategy = m_arrayAllStrategys[StrategyID]; if (nullptr == strategy.m_pStrategy) return false; else { boost::unique_lock<boost::shared_mutex> wlock(strategy.m_mtxPropectMeddleQueue, boost::try_to_lock); if (wlock.owns_lock()) { if (strategy.m_queueMeddleQueue.empty()) return false; else { string nextmeddle = strategy.m_queueMeddleQueue.front(); strategy.m_queueMeddleQueue.pop(); if (nextmeddle.size() > maxlength - 1) return false; else { strncpy(retbuffer, nextmeddle.c_str(), maxlength); return true; } } } else return false; } } else return false; } TOrderRefIdType CTradeService::MakeOrder( TStrategyIdType stid, TOrderType type, TOrderDirectionType dir, TOrderOffsetType offset, TVolumeType volume, TPriceType price, TMarketDataIdType dataid, TCustomRefPartType custom) { boost::shared_lock<boost::shared_mutex> rlock1(m_mtxAllStrategys); if (nullptr == m_arrayAllStrategys[stid].m_pStrategy) { BOOST_LOG_SEV(m_Logger, severity_levels::error) << ProcessName <<"|"<< stid << ": "<<"Limitorder with invalid strategyid "<< stid << " [" << to_iso_string(microsec_clock::universal_time()) << "]"; return LB1_NullOrderRef; } if (LB1_Increase == offset) {//风控 if (second_clock::universal_time().date() != m_arrayAllStrategys[stid].m_dateActionDate) { m_arrayAllStrategys[stid].m_uRemainIncreaseOrderCountPerDay.store(m_arrayAllStrategys[stid].m_uMaxIncreaseOrderCountPerDay.load()); m_arrayAllStrategys[stid].m_dateActionDate = second_clock::universal_time().date(); } if (0 == m_arrayAllStrategys[stid].m_uRemainIncreaseOrderCountPerDay) { BOOST_LOG_SEV(m_Logger, severity_levels::error) << ProcessName << "|" << stid << ": "<<"There is no limitorder tickets today!"; return LB1_NullOrderRef; } else --m_arrayAllStrategys[stid].m_uRemainIncreaseOrderCountPerDay; } auto API = m_arrayAllStrategys[stid].m_mapDataid2TradeApi[dataid]; if (false == API.first->IsOnline()) { BOOST_LOG_SEV(m_Logger, severity_levels::error) << ProcessName << "|" << stid << ": "<<"make order when API is offline" << " [" << to_iso_string(microsec_clock::universal_time()) << "]";; return LB1_NullOrderRef; } TOrderRefIdType orderRefBase = _StrategyCustom2OrderRefPart(custom) + _StrategyID2OrderRefPart(stid) + _OrderDirection2OrderRefPart(dir) + _OrderOffset2OrderRefPart(offset) + _SystemNumberPart2OrderRefPart(m_uSystemNumber); auto OrderRef= API.first->TDBasicMakeOrder(type,API.second, dir, offset, volume, price, orderRefBase); BOOST_LOG_SEV(m_Logger, severity_levels::normal) << ProcessName << "|" << stid << ": " << "LimitOrder Volume:"<< volume << " Price:"<< price << " Ref:"<< OrderRef << " Custom:" << _OrderRef2StrategyCustomPart(OrderRef) << " SystemN:" << _OrderRef2SystemNumberPart(OrderRef) << " AccountN:" << _OrderRef2AccountNumberPart(OrderRef) << " OrderInc:" << _OrderRef2OrderIncreasePart(OrderRef) << " RemainTickets:"<< m_arrayAllStrategys[stid].m_uRemainIncreaseOrderCountPerDay << " [" << to_iso_string(microsec_clock::universal_time()) << "]"; return OrderRef; } TLastErrorIdType CTradeService::CancelOrder(TStrategyIdType stid,TOrderRefIdType ref, TOrderSysIdType sys, TMarketDataIdType dataid) { boost::shared_lock<boost::shared_mutex> rlock1(m_mtxAllStrategys); if (nullptr == m_arrayAllStrategys[stid].m_pStrategy) { BOOST_LOG_SEV(m_Logger, severity_levels::error) << ProcessName << "|" << stid << ": " <<"Cancel order with invalid strategyid " << stid << " [" << to_iso_string(microsec_clock::universal_time()) << "]";; return LB1_INVALID_VAL; } auto & API = m_arrayAllStrategys[stid].m_mapDataid2TradeApi[dataid]; if (false == API.first->IsOnline()) { BOOST_LOG_SEV(m_Logger, severity_levels::error) << ProcessName << "|" << stid << ": " << "cancel order when API is offline" << " [" << to_iso_string(microsec_clock::universal_time()) << "]";; return LB1_INVALID_VAL; } auto res = API.first->TDBasicCancelOrder(ref, API.second, sys); BOOST_LOG_SEV(m_Logger, severity_levels::normal) << ProcessName << "|" << stid << ": " << "Cancel order "<< ref<< ((TLastErrorIdType::LB1_NO_ERROR == res)?" Succeed":" Failed") << " [" << to_iso_string(microsec_clock::universal_time()) << "]";; return res; } void CTradeService::UpdateChart() { } bool CTradeService::GetSharedValue(TSharedIndexType i,double & ret) { boost::shared_lock<boost::shared_mutex> rlock(m_mtxSharedValue); if (m_mapSharedValue.find(i) != m_mapSharedValue.end()) { ret = m_mapSharedValue[i]; return true; } else return false; } bool CTradeService::IncreaseSharedValue(TSharedIndexType i, double dt, function<bool(double)> issatisfy) { boost::unique_lock<boost::shared_mutex> wlock(m_mtxSharedValue); if (m_mapSharedValue.find(i) == m_mapSharedValue.end()) return false; if (issatisfy(m_mapSharedValue[i])) { m_mapSharedValue[i] += dt; BOOST_LOG_SEV(m_Logger, severity_levels::normal) << ProcessName << ": " <<"SharedValue[" << i << "]=" << m_mapSharedValue[i] << " [" << to_iso_string(microsec_clock::universal_time()) << "]"; return true; } else return false; } bool CTradeService::DecreaseSharedValue(TSharedIndexType i, double dt, function<bool(double)> issatisfy) { boost::unique_lock<boost::shared_mutex> wlock(m_mtxSharedValue); if (m_mapSharedValue.find(i) == m_mapSharedValue.end()) return false; if (issatisfy(m_mapSharedValue[i])) { m_mapSharedValue[i] -= dt; BOOST_LOG_SEV(m_Logger, severity_levels::normal) << ProcessName<< ": " << "SharedValue[" << i << "]=" << m_mapSharedValue[i] << " [" << to_iso_string(microsec_clock::universal_time()) << "]"; return true; } else return false; } bool CTradeService::SetSharedValue(TSharedIndexType i, double newvalue, function<bool(double)> issatisfy) { boost::unique_lock<boost::shared_mutex> wlock(m_mtxSharedValue); if (issatisfy(m_mapSharedValue[i])) { m_mapSharedValue[i] = newvalue; BOOST_LOG_SEV(m_Logger, severity_levels::normal) << ProcessName << ": " << "SharedValue[" << i << "]=" << m_mapSharedValue[i] << " [" << to_iso_string(microsec_clock::universal_time()) << "]"; return true; } else return false; } int CTradeService::GetRemainCancelAmount(TStrategyIdType stid, TMarketDataIdType dataid) { boost::shared_lock<boost::shared_mutex> rlock1(m_mtxAllStrategys); if (stid< 0 || stid>_MaxStrategyID) return 0; if (nullptr == m_arrayAllStrategys[stid].m_pStrategy) { BOOST_LOG_SEV(m_Logger, severity_levels::error) << ProcessName << "|" << stid << ": " << "Cancel order with invalid strategyid " << stid << " [" << to_iso_string(microsec_clock::universal_time()) << "]";; return 0; } auto & API = m_arrayAllStrategys[stid].m_mapDataid2TradeApi[dataid]; return API.first->TDGetRemainAmountOfCancelChances(API.second["instrumentid"].c_str()); } void CTradeService::OnTrade( TOrderRefIdType Ref, TOrderSysIdType Sys, TPriceType Price, TVolumeType Volume) { unsigned int CustomPart = _OrderRef2StrategyCustomPart(Ref); unsigned int StrategyIDPart = _OrderRef2StrategyIDPart(Ref); unsigned int DirectionPart = _OrderRef2OrderDirectionPart(Ref); unsigned int OffsetPart = _OrderRef2OrderOffsetPart(Ref); unsigned int SystemNumberPart = _OrderRef2SystemNumberPart(Ref); unsigned int AccountNumberPart = _OrderRef2AccountNumberPart(Ref); unsigned int OrderIncreasePart = _OrderRef2OrderIncreasePart(Ref); if (SystemNumberPart != m_uSystemNumber) return; boost::shared_lock<boost::shared_mutex> rlock1(m_mtxAllStrategys/*,boost::defer_lock*/); auto & StrategyNode = m_arrayAllStrategys[StrategyIDPart]; if (nullptr == StrategyNode.m_pStrategy) return; boost::unique_lock<boost::shared_mutex> wlock2(StrategyNode.m_mtxPropectStrategy/*, boost::defer_lock*/); //std::lock(rlock1, wlock2); StrategyNode.m_pStrategy->OnTrade( Ref, Sys, Volume, Price, static_cast<StrategyData::TOrderDirectionType>(DirectionPart), static_cast<StrategyData::TOrderOffsetType>(OffsetPart) ); BOOST_LOG_SEV(m_Logger, severity_levels::normal) << ProcessName << "|" << StrategyIDPart << ": " << "Strategy" << StrategyIDPart << ": OnTrade" << " Ref:" << Ref << " Price:" << Price << " Volume:" << Volume << " Custom:" << CustomPart << " SystemN:" << SystemNumberPart << " AccountN:" << AccountNumberPart << " OrderInc:" << OrderIncreasePart << " [" << to_iso_string(microsec_clock::universal_time()) << "]"; ; } void CTradeService::OnOrder( TOrderRefIdType Ref, TOrderSysIdType Sys, TOrderStatusType Status, TPriceType Price, TTradedVolumeType TradedV, TRemainVolumeType RemainV) { unsigned int CustomPart = _OrderRef2StrategyCustomPart(Ref); unsigned int StrategyIDPart = _OrderRef2StrategyIDPart(Ref); unsigned int DirectionPart = _OrderRef2OrderDirectionPart(Ref); unsigned int OffsetPart = _OrderRef2OrderOffsetPart(Ref); unsigned int SystemNumberPart = _OrderRef2SystemNumberPart(Ref); unsigned int AccountNumberPart = _OrderRef2AccountNumberPart(Ref); unsigned int OrderIncreasePart = _OrderRef2OrderIncreasePart(Ref ); if (SystemNumberPart != m_uSystemNumber) return; boost::shared_lock<boost::shared_mutex> rlock1(m_mtxAllStrategys/*, boost::defer_lock*/); auto & StrategyNode = m_arrayAllStrategys[StrategyIDPart]; if (nullptr == StrategyNode.m_pStrategy) return; boost::unique_lock<boost::shared_mutex> wlock2(StrategyNode.m_mtxPropectStrategy/*, boost::defer_lock*/); //std::lock(rlock1, wlock2); StrategyNode.m_pStrategy->OnOrder( Ref, Sys, static_cast<StrategyData::TOrderDirectionType>(DirectionPart), Status, Price, TradedV, RemainV ); string _strStatus; switch (Status) { case LB1_StatusNoTradeQueueing:_strStatus = "NoTradeQueueing";break; case LB1_StatusPartTradedQueueing:_strStatus = "PartTradedQueueing";break; case LB1_StatusAllTraded:_strStatus = "AllTraded";break; case LB1_StatusCanceled:_strStatus = "Canceled";break; case LB1_StatusUnknown:_strStatus = "Unknown";break; } BOOST_LOG_SEV(m_Logger, severity_levels::normal) << ProcessName << "|" << StrategyIDPart << ": " << "Strategy" << StrategyIDPart << ": OnOrder" << " Ref:"<< Ref << " Sys:" << Sys << " Dir:" << ((static_cast<StrategyData::TOrderDirectionType>(DirectionPart)==LB1_Buy) ? "Buy":"Sell") << " Offset:" << ((static_cast<StrategyData::TOrderOffsetType>(OffsetPart) == LB1_Increase) ? "Increase" : "Decrease") << " Status:" << _strStatus << " Price:" << Price << " TradedVolume:" << TradedV << " RemainVolume:" << RemainV << " Custom:"<< CustomPart << " SystemN:" << SystemNumberPart << " AccountN:" << AccountNumberPart << " OrderInc:" << OrderIncreasePart << " [" << to_iso_string(microsec_clock::universal_time()) << "]"; ; } <|start_filename|>common/Order.h<|end_filename|> #pragma once #include <set> #include <map> #include <queue> #include <string> #include <vector> #include <list> #include "StrategyData.h" #include <tuple> #include <unordered_map> using namespace std; using namespace StrategyData; class COrder { public: string m_strOrderSysID; TOrderRefIdType m_OrderID; TOrderType m_enumOrderType; unsigned int m_uDataId; TOrderDirectionType m_enumDirection; TOrderOffsetType m_enumOffset; TOrderStatusType m_enumOrderStatus; ptime m_u64UTCDateTime; ptime m_u64TradeUTCDateTime; ptime m_u64TryCancelUTCDateTime; ptime m_u64CanceledUTCDateTime; TPriceType m_LimitPrice; TPriceType m_TradeLimitPrice; TVolumeType m_Volume; TVolumeType m_TradedVolume; TVolumeType m_RemainderPositionForReport; double m_dbProfit; double m_dbCommission; TOrderRefIdType m_uTargetPositionOrder; bool m_boolActived; unordered_map< TMarketDataIdType, std::tuple<unsigned int, double, unsigned int, double> > m_mapPositionInfo; bool operator<(COrder & ord) { return m_u64UTCDateTime < ord.m_u64UTCDateTime; } }; <|start_filename|>common/OrderRefResolve.h<|end_filename|> #ifndef _QFCOMPRETRADESYSTEM_ORDERREFRESOLVE_H_ #define _QFCOMPRETRADESYSTEM_ORDERREFRESOLVE_H_ template<int N> struct PowerOfTwo { static const long long val = 2 * PowerOfTwo<N - 1>::val; }; template<> struct PowerOfTwo<0> { static const long long val = 1 ; }; #define _MaskFor1Bit 0x1 #define _MaskFor2Bit 0x3 #define _MaskFor3Bit 0x7 #define _MaskFor4Bit 0xF #define _MaskFor5Bit 0x1F #define _MaskFor6Bit 0x3F #define _MaskFor7Bit 0x7F #define _MaskFor8Bit 0xFF #define _StrategyCustomBitCount 3 #define _MaskForStrategyCustom _MaskFor3Bit #define _StrategyIDBitCount 8 #define _MaskForStrategyID _MaskFor8Bit #define _OrderDirectionBitCount 1 #define _MaskForOrderDirection _MaskFor1Bit #define _OrderOffsetBitCount 2 #define _MaskForOrderOffset _MaskFor2Bit #define _SystemNumberBitCount 3 #define _MaskForSystemNumber _MaskFor3Bit #define _AccountNumberBitCount 4 #define _MaskForAccountNumber _MaskFor4Bit #define _MaxStrategyCustom (PowerOfTwo<_StrategyCustomBitCount>::val-1) #define _MaxStrategyID (PowerOfTwo<_StrategyIDBitCount>::val-1) #define _MaxOrderDirection (PowerOfTwo<_OrderDirectionBitCount>::val-1) #define _MaxOrderOffset (PowerOfTwo<_OrderOffsetBitCount>::val-1) #define _MaxSystemNumber (PowerOfTwo<_SystemNumberBitCount>::val-1) #define _MaxAccountNumber (PowerOfTwo<_AccountNumberBitCount>::val-1) #define _OrderRef2StrategyCustomPart(OrderRef) ( (OrderRef) & _MaskForStrategyCustom) #define _OrderRef2StrategyIDPart(OrderRef) (((OrderRef)>>(_StrategyCustomBitCount)) & _MaskForStrategyID) #define _OrderRef2OrderDirectionPart(OrderRef) (((OrderRef)>>(_StrategyCustomBitCount+_StrategyIDBitCount)) & _MaskForOrderDirection) #define _OrderRef2OrderOffsetPart(OrderRef) (((OrderRef)>>(_StrategyCustomBitCount+_StrategyIDBitCount+_OrderDirectionBitCount)) & _MaskForOrderOffset) #define _OrderRef2SystemNumberPart(OrderRef) (((OrderRef)>>(_StrategyCustomBitCount+_StrategyIDBitCount+_OrderDirectionBitCount+_OrderOffsetBitCount)) & _MaskForSystemNumber) #define _OrderRef2AccountNumberPart(OrderRef) (((OrderRef)>>(_StrategyCustomBitCount+_StrategyIDBitCount+_OrderDirectionBitCount+_OrderOffsetBitCount+_SystemNumberBitCount)) & _MaskForAccountNumber) #define _OrderRef2OrderIncreasePart(OrderRef) (((OrderRef)>>(_StrategyCustomBitCount+_StrategyIDBitCount+_OrderDirectionBitCount+_OrderOffsetBitCount+_SystemNumberBitCount+_AccountNumberBitCount))) #define _StrategyCustom2OrderRefPart(StrategyCustom) ((StrategyCustom) & _MaskForStrategyCustom) #define _StrategyID2OrderRefPart(StrategyID) (((StrategyID) & _MaskForStrategyID) << (_StrategyCustomBitCount)) #define _OrderDirection2OrderRefPart(OrderDirection) (((OrderDirection) & _MaskForOrderDirection) << (_StrategyCustomBitCount+_StrategyIDBitCount)) #define _OrderOffset2OrderRefPart(OrderOffset) (((OrderOffset) & _MaskForOrderOffset) << (_StrategyCustomBitCount+_StrategyIDBitCount+_OrderDirectionBitCount)) #define _SystemNumberPart2OrderRefPart(SystemPart) (((SystemPart) & _MaskForSystemNumber) << (_StrategyCustomBitCount+_StrategyIDBitCount+_OrderDirectionBitCount+_OrderOffsetBitCount)) #define _AccountNumberPart2OrderRefPart(AccountPart) (((AccountPart) & _MaskForAccountNumber) << (_StrategyCustomBitCount+_StrategyIDBitCount+_OrderDirectionBitCount+_OrderOffsetBitCount+_SystemNumberBitCount)) #define _OrderIncreasePart2OrderRefPart(OrderIncreasePart) (((OrderIncreasePart)) << (_StrategyCustomBitCount+_StrategyIDBitCount+_OrderDirectionBitCount+_OrderOffsetBitCount+_SystemNumberBitCount+_AccountNumberBitCount)) #define _OrderRefBase(StrategyCustom,StrategyID,OrderDirection,OrderOffset,AccountPart,SystemPart) \ (_StrategyCustom2OrderRefPart(StrategyCustom)+_StrategyID2OrderRefPart(StrategyID)+_OrderDirection2OrderRefPart(OrderDirection) \ +_OrderOffset2OrderRefPart(OrderOffset)+_SystemNumberPart2OrderRefPart(SystemPart)+_AccountNumberPart2OrderRefPart(AccountPart)) #define _OrderRef(OrderNumber,Base) (((OrderNumber)<<(_StrategyCustomBitCount+_StrategyIDBitCount+_OrderDirectionBitCount+_OrderOffsetBitCount+_SystemNumberBitCount)+_AccountNumberBitCount)+(Base)) #endif <|start_filename|>third/TwsApi/TwsSpi.h<|end_filename|> #pragma once #include "TwsDataStructDef.h" class CTwsSpi { public: virtual void OnRspUserLogin(CTwsRspUserLoginField * loginField, bool IsSucceed) {}; virtual void OnRtnDepthMarketData(CTwsDepthMarketDataField * pDepthMarketData) {}; virtual void OnRspError(int ErrID,int ErrCode, const char * ErrMsg) {}; virtual void OnDisconnected() {}; virtual void OnRtnOrder(CTwsOrderField * ) {}; virtual void OnRtnTrade(CTwsTradeField * ) {}; }; <|start_filename|>trade/connection.hpp<|end_filename|> #ifndef HTTP_SERVER2_CONNECTION_HPP #define HTTP_SERVER2_CONNECTION_HPP #include <boost/asio.hpp> #include <boost/array.hpp> #include <boost/noncopyable.hpp> #include <boost/shared_ptr.hpp> #include <boost/enable_shared_from_this.hpp> #include "CommuModForServInterface.h" #include <string> namespace http { namespace server2 { #define MAX_READ_BUFFER_LENGTH 102400 #define MAX_WRITE_BUFFER_LENGTH 102400 /// Represents a single connection from a client. class connection : public boost::enable_shared_from_this<connection>, private boost::noncopyable { public: /// Construct a connection with the given io_service. explicit connection(boost::asio::io_service& io_service, CCommuModForServSpi * handler); /// Get the socket associated with the connection. boost::asio::ip::tcp::socket& socket(); size_t ReadComplete(const boost::system::error_code & err, size_t bytes); /// Start the first asynchronous operation for the connection. void start(); private: /// Handle completion of a read operation. void handle_read(const boost::system::error_code& e, std::size_t bytes_transferred); /// Handle completion of a write operation. void handle_write(const boost::system::error_code& e); /// Socket for the connection. boost::asio::ip::tcp::socket socket_; /// The handler used to process the incoming request. CCommuModForServSpi * request_handler_; /// Buffer for incoming data. char read_buffer_[MAX_READ_BUFFER_LENGTH]; char write_buffer_[MAX_WRITE_BUFFER_LENGTH]; }; typedef boost::shared_ptr<connection> connection_ptr; } // namespace server2 } // namespace http #endif // HTTP_SERVER2_CONNECTION_HPP <|start_filename|>common/trade_headers/CommuModForServInterface.h<|end_filename|> #ifndef _COMPRETRADESYSTEMHEADERS_COMMUMODFORSERVINTERFACE_H #define _COMPRETRADESYSTEMHEADERS_COMMUMODFORSERVINTERFACE_H #ifdef WIN32 #ifdef _EXPORT #define EXPORT_INTERFACE __declspec(dllexport) #else #define EXPORT_INTERFACE __declspec(dllimport) #endif #else #define EXPORT_INTERFACE #endif #include <sstream> #include <memory> #ifndef BOOST_SPIRIT_THREADSAFE #define BOOST_SPIRIT_THREADSAFE #endif #include <boost/property_tree/ptree.hpp> #include <boost/property_tree/json_parser.hpp> using namespace boost::property_tree; class CCommuModForServSpi { public: virtual void OnCommunicate(const ptree & in, ptree & out) = 0; }; class MCommuModForServInterface { public: static MCommuModForServInterface * CreateApi( const char * address, unsigned int _Port, CCommuModForServSpi * _Spi, size_t _threadCount); virtual bool StartListen() = 0; virtual void StopListen() = 0; virtual void Release() = 0; }; #endif <|start_filename|>common/AutoPend.h<|end_filename|> #ifndef _COMMONFILES_AUTOPEND_H_ #define _COMMONFILES_AUTOPEND_H_ #include <atomic> class CAutoPend { std::atomic_bool & m_IsPending; public: CAutoPend(std::atomic_bool & _IsPending); ~CAutoPend(); }; #endif <|start_filename|>common/AbandonOverlap.cpp<|end_filename|> #include <vector> #include "Tick\Tick.h" using namespace std; void AbandonOverlap(vector<CTick*>&result) { auto OverAllSerialLength = result.size(); unsigned int incment = 1; unsigned int Be = 0; while (Be + incment<OverAllSerialLength) { if ( result[Be + incment]->m_datetimeUTCDateTime == result[Be]->m_datetimeUTCDateTime ) { string temp = to_simple_string(result[Be + incment]->m_datetimeUTCDateTime); result[Be + incment]->m_datetimeUTCDateTime += microseconds(incment); temp = to_simple_string(result[Be + incment]->m_datetimeUTCDateTime); ++incment; } else { Be += incment; incment = 1; } } } <|start_filename|>common/trade_headers/AtmPluginInterface.h<|end_filename|> #ifndef _COMPRETRADESYSTEMHEADERS_MATMPLUGINMANAGEINTERFACE_H_ #define _COMPRETRADESYSTEMHEADERS_MATMPLUGINMANAGEINTERFACE_H_ #include <string> #include <unordered_map> #ifndef BOOST_SPIRIT_THREADSAFE #define BOOST_SPIRIT_THREADSAFE #endif #include <boost/property_tree/ptree.hpp> #include <boost/property_tree/json_parser.hpp> using namespace boost::property_tree; using namespace std; class MAtmPluginInterface { public: virtual bool IsPedding() = 0; virtual bool IsOnline() = 0; virtual void GetState(ptree & out) = 0; virtual void IncreaseRefCount() = 0; virtual void DescreaseRefCount() = 0; virtual int GetRefCount() = 0; virtual void CheckSymbolValidity(const unordered_map<string, string> &) = 0; virtual string GetCurrentKeyword() = 0; virtual string GetProspectiveKeyword(const ptree &) = 0; }; #endif <|start_filename|>common/AutoPend.cpp<|end_filename|> #include "AutoPend.h" CAutoPend::CAutoPend(std::atomic_bool & _IsPending):m_IsPending(_IsPending) { m_IsPending.store(true); } CAutoPend::~CAutoPend() { m_IsPending.store(false); } <|start_filename|>common/trade_headers/CommuModForClieInterface.h<|end_filename|> #ifndef COMMUNICATIONMODULEFORCLIENT_COMMUMODFORCLIEINTERFACE_H #define COMMUNICATIONMODULEFORCLIENT_COMMUMODFORCLIEINTERFACE_H #include <sstream> typedef size_t (*PFNCommunicateType)(char * address, unsigned int port, std::stringstream & in, std::stringstream & out); #endif <|start_filename|>common/StrategyInquiryDataInterface.h<|end_filename|> #ifndef _MSTRATEGYINQUIRYRESPONSEINTERFACE #define _MSTRATEGYINQUIRYRESPONSEINTERFACE class MStrategyInquiryDataInterface { public: virtual bool ValueToString(char * buf, size_t len) = 0; virtual void Release() = 0; }; #endif <|start_filename|>develop/pysimulate/simulate_kernel.h<|end_filename|> // SimulateKernel.cpp : 定义 DLL 的初始化例程。 // #include "StrategyData.h" #include "StrategyContext.h" #include "SimulateKernelInterface.h" #include "SimulateKernelEnvironment.h" #include "Order.h" #include <queue> #include <list> #include <boost/date_time/gregorian/gregorian.hpp> #include <boost/date_time/posix_time/posix_time.hpp> #include "resource.h" #include "StrategyDefine.h" #include <unordered_map> //#include "TickLoader.h" #include "FutureTick.h" #include "StockTick.h" #include "QuantFundHFTBackTestTypedefine.h" #include <memory> #include <tuple> using namespace boost::posix_time; using namespace boost::gregorian; using namespace std; enum TTradePriceType { TradePrice_FixPrice, TradePrice_BestPrice, }; #define Index_ResBuff 0 #define Value_ResBuff 1 #define IndexAddr 2 #define ValueAddr 3 typedef std::tuple< std::shared_ptr<vector<unsigned int>>/*Index*/, std::shared_ptr<vector<float>>/*Value*/, atomic<unsigned int>*/*IndexAddr*/, atomic<double>*/*ValueAddr*/> TProbeNodeType; class CDataSerial; class CMySimulateKernel : public MSimulateKernelInterface { public: TTradePriceType m_enumTradePriceType = TradePrice_BestPrice; bool m_boolNewOrder = false; bool m_boolNewCancel = false; CDataSerial * m_pCurrentTop; list<COrder*> m_listOrdersTobeHandle; map<string, TOrderRefIdType> mapSysId2OrderRef; vector<unsigned int> m_vecOnTickTimeConsuming; vector<TProbeNodeType> m_vecProbeUpdateList; bool m_boolAutoUpdateChart = true; unsigned int m_uFlags = Simulate_HasMessage | Simulate_HasProbes | Simulate_HasOnTickTimeConsuming; // 保存输出信息指针 CBackTestResult * m_Out; MSimulateKernelEnvironment * m_environment; CTick * m_pLastTick_Global; CMySimulateKernel(MSimulateKernelEnvironment *_env); virtual void Release(); virtual void StartBackTest( MStrategy* pStrategy,/*IN*/ vector<string> tickFiles, string strInArchiveFile,/*IN*/ string strOutArchiveFile,/*IN*/ const ptree config,/*IN*/ unsigned int flags,/*IN*/ CBackTestResult * /*OUT*/ ); // StrategyContext virtual bool Inquery(TStrategyIdType stid, MStrategyInquiryDataInterface *); virtual bool MeddleResponse(TStrategyIdType, const char *, ...); virtual bool ShowMessage(TStrategyIdType, const char *, ...); virtual bool GetNextMeddle(TStrategyIdType, char * retbuffer, unsigned int maxlength); virtual TOrderRefIdType MakeOrder( TStrategyIdType, TOrderType, TOrderDirectionType, TOrderOffsetType, TVolumeType, TPriceType, TMarketDataIdType, TCustomRefPartType); virtual TLastErrorIdType CancelOrder( TStrategyIdType, TOrderRefIdType, TOrderSysIdType, TMarketDataIdType); virtual void UpdateChart(); virtual bool GetSharedValue(TSharedIndexType i, double & ret); virtual bool IncreaseSharedValue(TSharedIndexType i, double dt, function<bool(double)>); virtual bool DecreaseSharedValue(TSharedIndexType i, double dt, function<bool(double)>); virtual bool SetSharedValue(TSharedIndexType i, double newvalue, function<bool(double)>); virtual int GetRemainCancelAmount(TStrategyIdType, TMarketDataIdType); };
zhuzhenping/thunder-trader
<|start_filename|>memfs.go<|end_filename|> package stream import ( "bytes" "errors" "io" "os" "sync" "sync/atomic" ) // ErrNotFoundInMem is returned when an in-memory FileSystem cannot find a file. var ErrNotFoundInMem = errors.New("not found") type memfs struct { mu sync.RWMutex files map[string]*memFile } // NewMemFS returns a New in-memory FileSystem func NewMemFS() FileSystem { return &memfs{ files: make(map[string]*memFile), } } func (fs *memfs) Create(key string) (File, error) { fs.mu.Lock() defer fs.mu.Unlock() file := newMemFile(key) fs.files[key] = file return file, nil } func newMemFile(name string) *memFile { file := &memFile{ name: name, r: bytes.NewBuffer(nil), } file.buf.Store([]byte(nil)) file.memReader.memFile = file return file } func (fs *memfs) Open(key string) (File, error) { fs.mu.RLock() defer fs.mu.RUnlock() if f, ok := fs.files[key]; ok { return &memReader{memFile: f}, nil } return nil, ErrNotFoundInMem } func (fs *memfs) Remove(key string) error { fs.mu.Lock() defer fs.mu.Unlock() delete(fs.files, key) return nil } type memFile struct { mu sync.Mutex name string r *bytes.Buffer buf atomic.Value writerClosed int32 memReader } func (f *memFile) Name() string { return f.name } func (f *memFile) Write(p []byte) (int, error) { if atomic.LoadInt32(&f.writerClosed) == 1 { return 0, os.ErrClosed } if len(p) > 0 { f.mu.Lock() n, err := f.r.Write(p) f.buf.Store(f.r.Bytes()) f.mu.Unlock() return n, err } return len(p), nil } func (f *memFile) Bytes() []byte { return f.buf.Load().([]byte) } func (f *memFile) Close() error { atomic.SwapInt32(&f.writerClosed, 1) return nil } type memReader struct { *memFile n int readerClosed int32 } func (r *memReader) ReadAt(p []byte, off int64) (n int, err error) { if atomic.LoadInt32(&r.readerClosed) == 1 { return 0, os.ErrClosed } data := r.Bytes() if int64(len(data)) < off { return 0, io.EOF } n, err = bytes.NewReader(data[off:]).ReadAt(p, 0) return n, err } func (r *memReader) Read(p []byte) (n int, err error) { if atomic.LoadInt32(&r.readerClosed) == 1 { return 0, os.ErrClosed } n, err = bytes.NewReader(r.Bytes()[r.n:]).Read(p) r.n += n return n, err } func (r *memReader) Close() error { atomic.SwapInt32(&r.readerClosed, 1) return nil } <|start_filename|>bench_test.go<|end_filename|> package stream import ( "bytes" "io" "io/ioutil" "math/rand" "sync" "testing" ) const testDataSize = 10 * 1024 * 1024 func BenchmarkInMemoryStream(b *testing.B) { benchmarkStream(NewMemFS(), b) } func BenchmarkOnDiskStream(b *testing.B) { benchmarkStream(StdFileSystem, b) } func benchmarkStream(fs FileSystem, b *testing.B) { b.ReportAllocs() // load random bytes rnd := io.LimitReader(rand.New(rand.NewSource(0)), testDataSize) buf := bytes.NewBuffer(nil) io.Copy(buf, rnd) // allocate stream w, err := NewStream("hello", fs) if err != nil { b.Fatal(err) } defer w.Remove() // test parallel writer/reader speed var once sync.Once b.RunParallel(func(pb *testing.PB) { for pb.Next() { // fill writer once.Do(func() { go func() { io.Copy(w, buf) w.Close() }() }) // read all r, _ := w.NextReader() io.Copy(ioutil.Discard, r) r.Close() } }) }
jonasi/stream
<|start_filename|>public/freetds-1.00.23/src/replacements/socketpair.c<|end_filename|> /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 2011 <NAME> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include <config.h> #if !defined(HAVE_SOCKETPAIR) #if defined(_WIN32) #include <winsock2.h> #include <windows.h> #endif #if HAVE_UNISTD_H #include <unistd.h> #endif /* HAVE_UNISTD_H */ #if HAVE_ERRNO_H #include <errno.h> #endif #include <freetds/tds.h> #include "replacements.h" int tds_socketpair(int domain, int type, int protocol, TDS_SYS_SOCKET sv[2]) { struct sockaddr_in sa, sa2; SOCKLEN_T addrlen; TDS_SYS_SOCKET s; if (!sv) return -1; /* create a listener */ s = socket(AF_INET, type, 0); if (TDS_IS_SOCKET_INVALID(s)) return -1; sv[1] = INVALID_SOCKET; sv[0] = socket(AF_INET, type, 0); if (TDS_IS_SOCKET_INVALID(sv[0])) goto Cleanup; /* bind to a random port */ sa.sin_family = AF_INET; sa.sin_addr.s_addr = htonl(INADDR_LOOPBACK); sa.sin_port = 0; if (bind(s, (struct sockaddr*) &sa, sizeof(sa)) < 0) goto Cleanup; if (listen(s, 1) < 0) goto Cleanup; /* connect to kernel choosen port */ addrlen = sizeof(sa); if (tds_getsockname(s, (struct sockaddr*) &sa, &addrlen) < 0) goto Cleanup; if (connect(sv[0], (struct sockaddr*) &sa, sizeof(sa)) < 0) goto Cleanup; addrlen = sizeof(sa2); sv[1] = tds_accept(s, (struct sockaddr*) &sa2, &addrlen); if (TDS_IS_SOCKET_INVALID(sv[1])) goto Cleanup; /* check proper connection */ addrlen = sizeof(sa); if (tds_getsockname(sv[0], (struct sockaddr*) &sa, &addrlen) < 0) goto Cleanup; addrlen = sizeof(sa2); if (tds_getpeername(sv[1], (struct sockaddr*) &sa2, &addrlen) < 0) goto Cleanup; if (sa.sin_family != sa2.sin_family || sa.sin_port != sa2.sin_port || sa.sin_addr.s_addr != sa2.sin_addr.s_addr) goto Cleanup; CLOSESOCKET(s); return 0; Cleanup: CLOSESOCKET(s); CLOSESOCKET(sv[0]); CLOSESOCKET(sv[1]); return -1; } #endif <|start_filename|>public/freetds-1.00.23/src/tds/sec_negotiate_openssl.h<|end_filename|> /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 2015 <NAME> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include <openssl/rand.h> #include <openssl/bio.h> #include <openssl/pem.h> #include <openssl/err.h> /** * \ingroup libtds * \defgroup auth Authentication * Functions for handling authentication. */ /** * \addtogroup auth * @{ */ #ifndef HAVE_OPENSSL #error HAVE_OPENSSL not defines, this file should not be included #endif static void* tds5_rsa_encrypt(const void *key, size_t key_len, const void *nonce, size_t nonce_len, const char *pwd, size_t *em_size) { RSA *rsa = NULL; BIO *keybio; TDS_UCHAR *message = NULL; size_t message_len, pwd_len; TDS_UCHAR *em = NULL; int result; keybio = BIO_new_mem_buf((void*) key, key_len); if (keybio == NULL) goto error; rsa = PEM_read_bio_RSAPublicKey(keybio, &rsa, NULL, NULL); if (!rsa) goto error; pwd_len = strlen(pwd); message_len = nonce_len + pwd_len; message = tds_new(TDS_UCHAR, message_len); if (!message) goto error; memcpy(message, nonce, nonce_len); memcpy(message + nonce_len, pwd, pwd_len); em = tds_new(TDS_UCHAR, BN_num_bytes(rsa->n)); if (!em) goto error; result = RSA_public_encrypt(message_len, message, em, rsa, RSA_PKCS1_OAEP_PADDING); if (result < 0) goto error; free(message); RSA_free(rsa); BIO_free(keybio); *em_size = result; return em; error: free(message); free(em); RSA_free(rsa); BIO_free(keybio); return NULL; } /** @} */ <|start_filename|>public/freetds-1.00.23/vms/vmsarg_mapping_bcp.c<|end_filename|> /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 2010 <NAME> <EMAIL> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. /* * Mapping table for the BCP command. */ int vmsarg_mapping (int *nvargs, char *vms_arg[], char *unix_arg[], char *unix_narg[], char *vms_key[], char *unix_key[], char *separator[], int flags[], char *pattern[], char **outverb, int *action_flags, char **arg_symbol, char **image_name) { *nvargs = 26; *action_flags = 1301; vms_arg[1] = "TABLE_NAME"; flags[1] = 1; unix_arg[1] = "$"; vms_arg[2] = "DIRECTION"; flags[2] = 1; unix_arg[2] = "$"; vms_arg[3] = "DATA_FILE"; flags[3] = 1; unix_arg[3] = "$"; vms_arg[4] = "MAX_ERRORS"; flags[4] = 1; unix_arg[4] = "-m"; vms_arg[5] = "FORMAT_FILE"; flags[5] = 1; unix_arg[5] = "-f"; vms_arg[6] = "ERRORFILE"; flags[6] = 1; unix_arg[6] = "-e"; vms_arg[7] = "FIRST_ROW"; flags[7] = 1; unix_arg[7] = "-F"; vms_arg[8] = "LAST_ROW"; flags[8] = 1; unix_arg[8] = "-L"; vms_arg[9] = "BATCH_SIZE"; flags[9] = 1; unix_arg[9] = "-b"; vms_arg[10] = "NATIVE_DEFAULT"; flags[10] = 1; unix_arg[10] = "-n"; vms_arg[11] = "CHARACTER_DEFAULT"; flags[11] = 1; unix_arg[11] = "-c"; vms_arg[12] = "COLUMN_TERMINATOR"; flags[12] = 1; unix_arg[12] = "-t"; vms_arg[13] = "ROW_TERMINATOR"; flags[13] = 1; unix_arg[13] = "-r"; vms_arg[14] = "USERNAME"; flags[14] = 1; unix_arg[14] = "-U"; vms_arg[15] = "PASSWORD"; flags[15] = 1; unix_arg[15] = "-P"; vms_arg[16] = "SERVER_NAME"; flags[16] = 1; unix_arg[16] = "-S"; vms_arg[17] = "INPUT"; flags[17] = 1; unix_arg[17] = "-i"; vms_arg[18] = "OUTPUT"; flags[18] = 1; unix_arg[18] = "-o"; vms_arg[19] = "TDSPACKETSIZE"; flags[19] = 1; unix_arg[19] = "-A"; vms_arg[20] = "TEXTSIZE"; flags[20] = 1; unix_arg[20] = "-T"; vms_arg[21] = "VERSION"; flags[21] = 1; unix_arg[21] = "-v"; vms_arg[22] = "DISPCHARSET"; flags[22] = 1; unix_arg[22] = "-a"; vms_arg[23] = "LANGUAGE"; flags[23] = 1; unix_arg[23] = "-z"; vms_arg[24] = "CLIENTCHARSET"; flags[24] = 1; unix_arg[24] = "-J"; vms_arg[25] = "IDENTITY"; flags[25] = 1; unix_arg[25] = "-E"; vms_arg[26] = "ENCRYPT"; flags[26] = 1; unix_arg[26] = "-X"; return 1; } <|start_filename|>public/freetds-1.00.23/include/des.h<|end_filename|> #ifndef DES_H #define DES_H #ifdef HAVE_NETTLE #include <nettle/des.h> typedef struct des_ctx DES_KEY; #endif #include <freetds/pushvis.h> typedef unsigned char des_cblock[8]; #ifndef HAVE_NETTLE typedef struct des_key { unsigned char kn[16][8]; TDS_UINT sp[8][64]; unsigned char iperm[16][16][8]; unsigned char fperm[16][16][8]; } DES_KEY; int tds_des_set_key(DES_KEY * dkey, const des_cblock user_key, int len); void tds_des_encrypt(DES_KEY * key, des_cblock block); #endif void tds_des_set_odd_parity(des_cblock key); int tds_des_ecb_encrypt(const void *plaintext, int len, DES_KEY * akey, unsigned char *output); #include <freetds/popvis.h> #ifdef HAVE_NETTLE static inline void tds_des_encrypt(DES_KEY * key, des_cblock block) { nettle_des_encrypt(key, sizeof(des_cblock), block, block); } static inline int tds_des_set_key(DES_KEY * dkey, const des_cblock user_key, int len) { return nettle_des_set_key(dkey, user_key); } #endif #endif /* !DES_H */ <|start_filename|>public/freetds-1.00.23/include/freetds/stream.h<|end_filename|> /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 2013 <NAME> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifndef _freetds_stream_h_ #define _freetds_stream_h_ #ifndef _tds_h_ #error Include tds.h first #endif #include <freetds/pushvis.h> /** define a stream of data used for input */ typedef struct tds_input_stream { /** read some data * Return 0 if end of stream * Return <0 if error (actually not defined) */ int (*read)(struct tds_input_stream *stream, void *ptr, size_t len); } TDSINSTREAM; /** define a stream of data used for output */ typedef struct tds_output_stream { /** write len bytes from buffer, return <0 if error or len */ int (*write)(struct tds_output_stream *stream, size_t len); /** * write buffer. client will write data into this buffer. * not required that buffer is the result of any alloc function * so buffer pointer can point in the middle of another buffer. * client will write up to buf_len. * client should not cache buffer and buf_len before a call * to write as write can change these values. */ char *buffer; size_t buf_len; } TDSOUTSTREAM; /** Convert a stream from istream to ostream using a specific conversion */ TDSRET tds_convert_stream(TDSSOCKET * tds, TDSICONV * char_conv, TDS_ICONV_DIRECTION direction, TDSINSTREAM * istream, TDSOUTSTREAM *ostream); /** Copy data from a stream to another */ TDSRET tds_copy_stream(TDSSOCKET * tds, TDSINSTREAM * istream, TDSOUTSTREAM * ostream); /* Additional streams */ /** input stream to read data from tds protocol */ typedef struct tds_datain_stream { TDSINSTREAM stream; size_t wire_size; /**< bytes still to read */ TDSSOCKET *tds; } TDSDATAINSTREAM; void tds_datain_stream_init(TDSDATAINSTREAM * stream, TDSSOCKET * tds, size_t wire_size); /** output stream to write data to tds protocol */ typedef struct tds_dataout_stream { TDSOUTSTREAM stream; TDSSOCKET *tds; size_t written; } TDSDATAOUTSTREAM; void tds_dataout_stream_init(TDSDATAOUTSTREAM * stream, TDSSOCKET * tds); /** input stream to read data from a static buffer */ typedef struct tds_staticin_stream { TDSINSTREAM stream; const char *buffer; size_t buf_left; } TDSSTATICINSTREAM; void tds_staticin_stream_init(TDSSTATICINSTREAM * stream, const void *ptr, size_t len); /** output stream to write data to a static buffer. * stream.buffer contains the pointer where stream will write to. */ typedef struct tds_staticout_stream { TDSOUTSTREAM stream; } TDSSTATICOUTSTREAM; void tds_staticout_stream_init(TDSSTATICOUTSTREAM * stream, void *ptr, size_t len); /** output stream to write data to a dynamic buffer */ typedef struct tds_dynamic_stream { TDSOUTSTREAM stream; /** where is stored the pointer */ void **buf; /** currently allocated buffer */ size_t allocated; /** size of data inside buffer */ size_t size; } TDSDYNAMICSTREAM; TDSRET tds_dynamic_stream_init(TDSDYNAMICSTREAM * stream, void **ptr, size_t allocated); #include <freetds/popvis.h> #endif <|start_filename|>public/freetds-1.00.23/doc/userguide.css<|end_filename|> /* * $Id: userguide.css,v 1.1 2005-10-03 02:52:29 jklowden Exp $ */ /* Set the screen background to gray */ .SCREEN { background-color: #F0F0F0; } /* Render user input as boldface */ .USERINPUT { font-weight: bold; } /* Make filenames green (why not?) */ .FILENAME { color: #007a00; } <|start_filename|>public/freetds-1.00.23/misc/cmake_checks.c<|end_filename|> #define _GNU_SOURCE #include <stdarg.h> #include <stdio.h> int main(int argc, char **argv) { #if defined(CHECK_ASPRINTF) char *p = NULL; int len = asprintf(&p, "%d", 123)"); #elif defined(CHECK_VASPRINTF) va_list va; char *p = NULL; int len = vasprintf(&p, "%d", va); #elif defined(CHECK_SNPRINTF) char buf[128]; int len = snprintf(buf, 128, "%d", 123); #elif defined(CHECK__SNPRINTF) char buf[128]; int len = _snprintf(buf, 128, "%d", 123); #elif defined(CHECK_VSNPRINTF) va_list va; char buf[128]; int len = vsnprintf(buf, 128, "%d", va); #elif defined(CHECK__VSNPRINTF) va_list va; char buf[128]; int len = _vsnprintf(buf, 128, "%d", va); #elif defined(CHECK__VSCPRINTF) va_list va; int len = _vscprintf("%d", va); #else #error "Check function not specified correctly" #endif return 0; } <|start_filename|>public/freetds-1.00.23/win32/freetds/sysconfdir.h<|end_filename|> #define FREETDS_SYSCONFDIR "c:" <|start_filename|>public/freetds-1.00.23/include/freetds/proto.h<|end_filename|> /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 <NAME> * Copyright (C) 2010, 2011 <NAME> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ /* * This file contains defines and structures strictly related to TDS protocol */ typedef struct tdsnumeric { unsigned char precision; unsigned char scale; unsigned char array[33]; } TDS_NUMERIC; typedef struct tdsoldmoney { TDS_INT mnyhigh; TDS_UINT mnylow; } TDS_OLD_MONEY; typedef union tdsmoney { TDS_OLD_MONEY tdsoldmoney; TDS_INT8 mny; } TDS_MONEY; typedef struct tdsmoney4 { TDS_INT mny4; } TDS_MONEY4; typedef struct tdsdatetime { TDS_INT dtdays; TDS_INT dttime; } TDS_DATETIME; typedef struct tdsdatetime4 { TDS_USMALLINT days; TDS_USMALLINT minutes; } TDS_DATETIME4; typedef struct tdsunique { TDS_UINT Data1; TDS_USMALLINT Data2; TDS_USMALLINT Data3; TDS_UCHAR Data4[8]; } TDS_UNIQUE; typedef TDS_INT TDS_DATE; typedef TDS_INT TDS_TIME; typedef TDS_UINT8 TDS_BIGTIME; typedef TDS_UINT8 TDS_BIGDATETIME; #define TDS5_PARAMFMT2_TOKEN 32 /* 0x20 */ #define TDS_LANGUAGE_TOKEN 33 /* 0x21 TDS 5.0 only */ #define TDS_ORDERBY2_TOKEN 34 /* 0x22 */ #define TDS_ROWFMT2_TOKEN 97 /* 0x61 TDS 5.0 only */ #define TDS_MSG_TOKEN 101 /* 0x65 TDS 5.0 only */ #define TDS_LOGOUT_TOKEN 113 /* 0x71 TDS 5.0 only? ct_close() */ #define TDS_RETURNSTATUS_TOKEN 121 /* 0x79 */ #define TDS_PROCID_TOKEN 124 /* 0x7C TDS 4.2 only - TDS_PROCID */ #define TDS7_RESULT_TOKEN 129 /* 0x81 TDS 7.0 only */ #define TDS7_COMPUTE_RESULT_TOKEN 136 /* 0x88 TDS 7.0 only */ #define TDS_COLNAME_TOKEN 160 /* 0xA0 TDS 4.2 only */ #define TDS_COLFMT_TOKEN 161 /* 0xA1 TDS 4.2 only - TDS_COLFMT */ #define TDS_DYNAMIC2_TOKEN 163 /* 0xA3 */ #define TDS_TABNAME_TOKEN 164 /* 0xA4 */ #define TDS_COLINFO_TOKEN 165 /* 0xA5 */ #define TDS_OPTIONCMD_TOKEN 166 /* 0xA6 */ #define TDS_COMPUTE_NAMES_TOKEN 167 /* 0xA7 */ #define TDS_COMPUTE_RESULT_TOKEN 168 /* 0xA8 */ #define TDS_ORDERBY_TOKEN 169 /* 0xA9 TDS_ORDER */ #define TDS_ERROR_TOKEN 170 /* 0xAA */ #define TDS_INFO_TOKEN 171 /* 0xAB */ #define TDS_PARAM_TOKEN 172 /* 0xAC RETURNVALUE? */ #define TDS_LOGINACK_TOKEN 173 /* 0xAD */ #define TDS_CONTROL_FEATUREEXTACK_TOKEN \ 174 /* 0xAE TDS_CONTROL/TDS_FEATUREEXTACK */ #define TDS_ROW_TOKEN 209 /* 0xD1 */ #define TDS_NBC_ROW_TOKEN 210 /* 0xD2 as of TDS 7.3.B */ #define TDS_CMP_ROW_TOKEN 211 /* 0xD3 */ #define TDS5_PARAMS_TOKEN 215 /* 0xD7 TDS 5.0 only */ #define TDS_CAPABILITY_TOKEN 226 /* 0xE2 */ #define TDS_ENVCHANGE_TOKEN 227 /* 0xE3 */ #define TDS_SESSIONSTATE_TOKEN 228 /* 0xE4 TDS 7.4 */ #define TDS_EED_TOKEN 229 /* 0xE5 */ #define TDS_DBRPC_TOKEN 230 /* 0xE6 TDS 5.0 only */ #define TDS5_DYNAMIC_TOKEN 231 /* 0xE7 TDS 5.0 only */ #define TDS5_PARAMFMT_TOKEN 236 /* 0xEC TDS 5.0 only */ #define TDS_AUTH_TOKEN 237 /* 0xED TDS 7.0 only */ #define TDS_RESULT_TOKEN 238 /* 0xEE */ #define TDS_DONE_TOKEN 253 /* 0xFD TDS_DONE */ #define TDS_DONEPROC_TOKEN 254 /* 0xFE TDS_DONEPROC */ #define TDS_DONEINPROC_TOKEN 255 /* 0xFF TDS_DONEINPROC */ /* CURSOR support: TDS 5.0 only*/ #define TDS_CURCLOSE_TOKEN 128 /* 0x80 TDS 5.0 only */ #define TDS_CURDELETE_TOKEN 129 /* 0x81 TDS 5.0 only */ #define TDS_CURFETCH_TOKEN 130 /* 0x82 TDS 5.0 only */ #define TDS_CURINFO_TOKEN 131 /* 0x83 TDS 5.0 only */ #define TDS_CUROPEN_TOKEN 132 /* 0x84 TDS 5.0 only */ #define TDS_CURDECLARE_TOKEN 134 /* 0x86 TDS 5.0 only */ /* environment type field */ #define TDS_ENV_DATABASE 1 #define TDS_ENV_LANG 2 #define TDS_ENV_CHARSET 3 #define TDS_ENV_PACKSIZE 4 #define TDS_ENV_LCID 5 #define TDS_ENV_SQLCOLLATION 7 #define TDS_ENV_BEGINTRANS 8 #define TDS_ENV_COMMITTRANS 9 #define TDS_ENV_ROLLBACKTRANS 10 /* Microsoft internal stored procedure id's */ #define TDS_SP_CURSOR 1 #define TDS_SP_CURSOROPEN 2 #define TDS_SP_CURSORPREPARE 3 #define TDS_SP_CURSOREXECUTE 4 #define TDS_SP_CURSORPREPEXEC 5 #define TDS_SP_CURSORUNPREPARE 6 #define TDS_SP_CURSORFETCH 7 #define TDS_SP_CURSOROPTION 8 #define TDS_SP_CURSORCLOSE 9 #define TDS_SP_EXECUTESQL 10 #define TDS_SP_PREPARE 11 #define TDS_SP_EXECUTE 12 #define TDS_SP_PREPEXEC 13 #define TDS_SP_PREPEXECRPC 14 #define TDS_SP_UNPREPARE 15 /* * <rant> Sybase does an awful job of this stuff, non null ints of size 1 2 * and 4 have there own codes but nullable ints are lumped into INTN * sheesh! </rant> */ typedef enum { SYBCHAR = 47, /* 0x2F */ SYBVARCHAR = 39, /* 0x27 */ SYBINTN = 38, /* 0x26 */ SYBINT1 = 48, /* 0x30 */ SYBINT2 = 52, /* 0x34 */ SYBINT4 = 56, /* 0x38 */ SYBFLT8 = 62, /* 0x3E */ SYBDATETIME = 61, /* 0x3D */ SYBBIT = 50, /* 0x32 */ SYBTEXT = 35, /* 0x23 */ SYBNTEXT = 99, /* 0x63 */ SYBIMAGE = 34, /* 0x22 */ SYBMONEY4 = 122, /* 0x7A */ SYBMONEY = 60, /* 0x3C */ SYBDATETIME4 = 58, /* 0x3A */ SYBREAL = 59, /* 0x3B */ SYBBINARY = 45, /* 0x2D */ SYBVOID = 31, /* 0x1F */ SYBVARBINARY = 37, /* 0x25 */ SYBBITN = 104, /* 0x68 */ SYBNUMERIC = 108, /* 0x6C */ SYBDECIMAL = 106, /* 0x6A */ SYBFLTN = 109, /* 0x6D */ SYBMONEYN = 110, /* 0x6E */ SYBDATETIMN = 111, /* 0x6F */ /* * MS only types */ SYBNVARCHAR = 103, /* 0x67 */ SYBINT8 = 127, /* 0x7F */ XSYBCHAR = 175, /* 0xAF */ XSYBVARCHAR = 167, /* 0xA7 */ XSYBNVARCHAR = 231, /* 0xE7 */ XSYBNCHAR = 239, /* 0xEF */ XSYBVARBINARY = 165, /* 0xA5 */ XSYBBINARY = 173, /* 0xAD */ SYBUNIQUE = 36, /* 0x24 */ SYBVARIANT = 98, /* 0x62 */ SYBMSUDT = 240, /* 0xF0 */ SYBMSXML = 241, /* 0xF1 */ SYBMSDATE = 40, /* 0x28 */ SYBMSTIME = 41, /* 0x29 */ SYBMSDATETIME2 = 42, /* 0x2a */ SYBMSDATETIMEOFFSET = 43,/* 0x2b */ /* * Sybase only types */ SYBLONGBINARY = 225, /* 0xE1 */ SYBUINT1 = 64, /* 0x40 */ SYBUINT2 = 65, /* 0x41 */ SYBUINT4 = 66, /* 0x42 */ SYBUINT8 = 67, /* 0x43 */ SYBBLOB = 36, /* 0x24 */ SYBBOUNDARY = 104, /* 0x68 */ SYBDATE = 49, /* 0x31 */ SYBDATEN = 123, /* 0x7B */ SYB5INT8 = 191, /* 0xBF */ SYBINTERVAL = 46, /* 0x2E */ SYBLONGCHAR = 175, /* 0xAF */ SYBSENSITIVITY = 103, /* 0x67 */ SYBSINT1 = 176, /* 0xB0 */ SYBTIME = 51, /* 0x33 */ SYBTIMEN = 147, /* 0x93 */ SYBUINTN = 68, /* 0x44 */ SYBUNITEXT = 174, /* 0xAE */ SYBXML = 163, /* 0xA3 */ SYB5BIGDATETIME = 187, /* 0xBB */ SYB5BIGTIME = 188, /* 0xBC */ } TDS_SERVER_TYPE; typedef enum { USER_UNICHAR_TYPE = 34, /* 0x22 */ USER_UNIVARCHAR_TYPE = 35 /* 0x23 */ } TDS_USER_TYPE; /* compute operator */ #define SYBAOPCNT 75 /* 0x4B */ #define SYBAOPCNTU 76 /* 0x4C, obsolete */ #define SYBAOPSUM 77 /* 0x4D */ #define SYBAOPSUMU 78 /* 0x4E, obsolete */ #define SYBAOPAVG 79 /* 0x4F */ #define SYBAOPAVGU 80 /* 0x50, obsolete */ #define SYBAOPMIN 81 /* 0x51 */ #define SYBAOPMAX 82 /* 0x52 */ /* mssql2k compute operator */ #define SYBAOPCNT_BIG 9 /* 0x09 */ #define SYBAOPSTDEV 48 /* 0x30 */ #define SYBAOPSTDEVP 49 /* 0x31 */ #define SYBAOPVAR 50 /* 0x32 */ #define SYBAOPVARP 51 /* 0x33 */ #define SYBAOPCHECKSUM_AGG 114 /* 0x72 */ /** * options that can be sent with a TDS_OPTIONCMD token */ typedef enum { TDS_OPT_SET = 1 /**< Set an option. */ , TDS_OPT_DEFAULT = 2 /**< Set option to its default value. */ , TDS_OPT_LIST = 3 /**< Request current setting of a specific option. */ , TDS_OPT_INFO = 4 /**< Report current setting of a specific option. */ } TDS_OPTION_CMD; typedef enum { TDS_OPT_DATEFIRST = 1 /* 0x01 */ , TDS_OPT_TEXTSIZE = 2 /* 0x02 */ , TDS_OPT_STAT_TIME = 3 /* 0x03 */ , TDS_OPT_STAT_IO = 4 /* 0x04 */ , TDS_OPT_ROWCOUNT = 5 /* 0x05 */ , TDS_OPT_NATLANG = 6 /* 0x06 */ , TDS_OPT_DATEFORMAT = 7 /* 0x07 */ , TDS_OPT_ISOLATION = 8 /* 0x08 */ , TDS_OPT_AUTHON = 9 /* 0x09 */ , TDS_OPT_CHARSET = 10 /* 0x0a */ , TDS_OPT_SHOWPLAN = 13 /* 0x0d */ , TDS_OPT_NOEXEC = 14 /* 0x0e */ , TDS_OPT_ARITHIGNOREON = 15 /* 0x0f */ , TDS_OPT_ARITHABORTON = 17 /* 0x11 */ , TDS_OPT_PARSEONLY = 18 /* 0x12 */ , TDS_OPT_GETDATA = 20 /* 0x14 */ , TDS_OPT_NOCOUNT = 21 /* 0x15 */ , TDS_OPT_FORCEPLAN = 23 /* 0x17 */ , TDS_OPT_FORMATONLY = 24 /* 0x18 */ , TDS_OPT_CHAINXACTS = 25 /* 0x19 */ , TDS_OPT_CURCLOSEONXACT = 26 /* 0x1a */ , TDS_OPT_FIPSFLAG = 27 /* 0x1b */ , TDS_OPT_RESTREES = 28 /* 0x1c */ , TDS_OPT_IDENTITYON = 29 /* 0x1d */ , TDS_OPT_CURREAD = 30 /* 0x1e */ , TDS_OPT_CURWRITE = 31 /* 0x1f */ , TDS_OPT_IDENTITYOFF = 32 /* 0x20 */ , TDS_OPT_AUTHOFF = 33 /* 0x21 */ , TDS_OPT_ANSINULL = 34 /* 0x22 */ , TDS_OPT_QUOTED_IDENT = 35 /* 0x23 */ , TDS_OPT_ARITHIGNOREOFF = 36 /* 0x24 */ , TDS_OPT_ARITHABORTOFF = 37 /* 0x25 */ , TDS_OPT_TRUNCABORT = 38 /* 0x26 */ } TDS_OPTION; enum { TDS_OPT_ARITHOVERFLOW = 0x01, TDS_OPT_NUMERICTRUNC = 0x02 }; enum TDS_OPT_DATEFIRST_CHOICE { TDS_OPT_MONDAY = 1, TDS_OPT_TUESDAY = 2, TDS_OPT_WEDNESDAY = 3, TDS_OPT_THURSDAY = 4, TDS_OPT_FRIDAY = 5, TDS_OPT_SATURDAY = 6, TDS_OPT_SUNDAY = 7 }; enum TDS_OPT_DATEFORMAT_CHOICE { TDS_OPT_FMTMDY = 1, TDS_OPT_FMTDMY = 2, TDS_OPT_FMTYMD = 3, TDS_OPT_FMTYDM = 4, TDS_OPT_FMTMYD = 5, TDS_OPT_FMTDYM = 6 }; enum TDS_OPT_ISOLATION_CHOICE { TDS_OPT_LEVEL0 = 0, TDS_OPT_LEVEL1 = 1, TDS_OPT_LEVEL2 = 2, TDS_OPT_LEVEL3 = 3 }; typedef enum tds_packet_type { TDS_QUERY = 1, TDS_LOGIN = 2, TDS_RPC = 3, TDS_REPLY = 4, TDS_CANCEL = 6, TDS_BULK = 7, TDS7_TRANS = 14, /* transaction management */ TDS_NORMAL = 15, TDS7_LOGIN = 16, TDS7_AUTH = 17, TDS71_PRELOGIN = 18, TDS72_SMP = 0x53 } TDS_PACKET_TYPE; /** * TDS 7.1 collation informations. */ typedef struct { TDS_USMALLINT locale_id; /* master..syslanguages.lcid */ TDS_USMALLINT flags; TDS_UCHAR charset_id; /* or zero */ } TDS71_COLLATION; /** * TDS 7.2 SMP packet header */ typedef struct { TDS_UCHAR signature; /* TDS72_SMP */ TDS_UCHAR type; TDS_USMALLINT sid; TDS_UINT size; TDS_UINT seq; TDS_UINT wnd; } TDS72_SMP_HEADER; enum { TDS_SMP_SYN = 1, TDS_SMP_ACK = 2, TDS_SMP_FIN = 4, TDS_SMP_DATA = 8, }; /* SF stands for "sort flag" */ #define TDS_SF_BIN (TDS_USMALLINT) 0x100 #define TDS_SF_WIDTH_INSENSITIVE (TDS_USMALLINT) 0x080 #define TDS_SF_KATATYPE_INSENSITIVE (TDS_USMALLINT) 0x040 #define TDS_SF_ACCENT_SENSITIVE (TDS_USMALLINT) 0x020 #define TDS_SF_CASE_INSENSITIVE (TDS_USMALLINT) 0x010 /* UT stands for user type */ #define TDS_UT_TIMESTAMP 80 /* mssql login options flags */ enum option_flag1_values { TDS_BYTE_ORDER_X86 = 0, TDS_CHARSET_ASCII = 0, TDS_DUMPLOAD_ON = 0, TDS_FLOAT_IEEE_754 = 0, TDS_INIT_DB_WARN = 0, TDS_SET_LANG_OFF = 0, TDS_USE_DB_SILENT = 0, TDS_BYTE_ORDER_68000 = 0x01, TDS_CHARSET_EBDDIC = 0x02, TDS_FLOAT_VAX = 0x04, TDS_FLOAT_ND5000 = 0x08, TDS_DUMPLOAD_OFF = 0x10, /* prevent BCP */ TDS_USE_DB_NOTIFY = 0x20, TDS_INIT_DB_FATAL = 0x40, TDS_SET_LANG_ON = 0x80 }; enum option_flag2_values { TDS_INIT_LANG_WARN = 0, TDS_INTEGRATED_SECURTY_OFF = 0, TDS_ODBC_OFF = 0, TDS_USER_NORMAL = 0, /* SQL Server login */ TDS_INIT_LANG_REQUIRED = 0x01, TDS_ODBC_ON = 0x02, TDS_TRANSACTION_BOUNDARY71 = 0x04, /* removed in TDS 7.2 */ TDS_CACHE_CONNECT71 = 0x08, /* removed in TDS 7.2 */ TDS_USER_SERVER = 0x10, /* reserved */ TDS_USER_REMUSER = 0x20, /* DQ login */ TDS_USER_SQLREPL = 0x40, /* replication login */ TDS_INTEGRATED_SECURITY_ON = 0x80 }; enum option_flag3_values { TDS_RESTRICTED_COLLATION = 0, TDS_CHANGE_PASSWORD = 0x01, /* TDS 7.2 */ TDS_SEND_YUKON_BINARY_XML = 0x02, /* TDS 7.2 */ TDS_REQUEST_USER_INSTANCE = 0x04, /* TDS 7.2 */ TDS_UNKNOWN_COLLATION_HANDLING = 0x08, /* TDS 7.3 */ TDS_EXTENSION = 0x10, /* TDS 7.4 */ }; enum type_flags { TDS_OLEDB_ON = 0x10, TDS_READONLY_INTENT = 0x20, }; /* Sybase dynamic types */ enum dynamic_types { TDS_DYN_PREPARE = 0x01, TDS_DYN_EXEC = 0x02, TDS_DYN_DEALLOC = 0x04, TDS_DYN_EXEC_IMMED = 0x08, TDS_DYN_PROCNAME = 0x10, TDS_DYN_ACK = 0x20, TDS_DYN_DESCIN = 0x40, TDS_DYN_DESCOUT = 0x80, }; /* http://jtds.sourceforge.net/apiCursors.html */ /* Cursor scroll option, must be one of 0x01 - 0x10, OR'd with other bits */ enum { TDS_CUR_TYPE_KEYSET = 0x0001, /* default */ TDS_CUR_TYPE_DYNAMIC = 0x0002, TDS_CUR_TYPE_FORWARD = 0x0004, TDS_CUR_TYPE_STATIC = 0x0008, TDS_CUR_TYPE_FASTFORWARDONLY = 0x0010, TDS_CUR_TYPE_PARAMETERIZED = 0x1000, TDS_CUR_TYPE_AUTO_FETCH = 0x2000 }; enum { TDS_CUR_CONCUR_READ_ONLY = 1, TDS_CUR_CONCUR_SCROLL_LOCKS = 2, TDS_CUR_CONCUR_OPTIMISTIC = 4, /* default */ TDS_CUR_CONCUR_OPTIMISTIC_VALUES = 8 }; /* TDS 4/5 login*/ #define TDS_MAXNAME 30 /* maximum login name lenghts */ #define TDS_PROGNLEN 10 /* maximum program lenght */ #define TDS_PKTLEN 6 /* maximum packet lenght in login */ /* TDS 5 login security flags */ enum { TDS5_SEC_LOG_ENCRYPT = 1, TDS5_SEC_LOG_CHALLENGE = 2, TDS5_SEC_LOG_LABELS = 4, TDS5_SEC_LOG_APPDEFINED = 8, TDS5_SEC_LOG_SECSESS = 16, TDS5_SEC_LOG_ENCRYPT2 = 32, TDS5_SEC_LOG_NONCE = 128 }; <|start_filename|>public/freetds-1.00.23/vms/vargdefs.h<|end_filename|> /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 2010 <NAME> <EMAIL> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. /* * Definitions used by the VMSARG parsing and mapping routines. * * Based on VMSARG Version 2.0 by <NAME> <<EMAIL>> * * Extensively revised for inclusion in FreeTDS by <NAME>. * * From the VMSARG 2.0 documentation: * * The product is aimed at . . . people who are porting a package from * Unix to VMS. This software is made freely available for inclusion in * such products, whether they are freeware, public domain or commercial. * No licensing is required. */ #if __CRTL_VER >= 70302000 && !defined(__VAX) #define QUAL_LENGTH (4000+1) #define S_LENGTH (4096+1) #else #define QUAL_LENGTH (255+1) #define S_LENGTH (1024+1) #endif #define MAX_ARGS 255 /* bit fields for arg flags. */ #define VARG_M_AFFIRM 1 #define VARG_M_NEGATIVE 2 #define VARG_M_KEYWORDS 4 #define VARG_M_SEPARATOR 8 #define VARG_M_DATE 16 #define VARG_M_APPEND 32 #define VARG_M_HELP 64 /* bit fields for action flags. */ #define VARGACT_M_UPPER 1 #define VARGACT_M_LOWER 2 #define VARGACT_M_SPECIAL 4 #define VARGACT_M_ESCAPE 8 #define VARGACT_M_DOUBLE 16 #define VARGACT_M_IMAGE 32 #define VARGACT_M_SYMBOL 64 #define VARGACT_M_COMMAND 128 #define VARGACT_M_RETURN 256 #define VARGACT_M_PROTECT 512 #define VARGACT_M_UNIXARG 1024 #define VARGACT_M_PROTMASK 1+2+4+8+16 <|start_filename|>public/freetds-1.00.23/include/freetds/thread.h<|end_filename|> /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * * Copyright (C) 2005 <NAME> * Copyright (C) 2010-2012 <NAME> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifndef TDSTHREAD_H #define TDSTHREAD_H 1 #undef TDS_HAVE_MUTEX #if defined(_THREAD_SAFE) && defined(TDS_HAVE_PTHREAD_MUTEX) #include <pthread.h> #include <freetds/pushvis.h> typedef pthread_mutex_t tds_raw_mutex; #define TDS_RAW_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER static inline void tds_raw_mutex_lock(tds_raw_mutex *mtx) { pthread_mutex_lock(mtx); } static inline int tds_raw_mutex_trylock(tds_raw_mutex *mtx) { return pthread_mutex_trylock(mtx); } static inline void tds_raw_mutex_unlock(tds_raw_mutex *mtx) { pthread_mutex_unlock(mtx); } static inline int tds_raw_mutex_init(tds_raw_mutex *mtx) { return pthread_mutex_init(mtx, NULL); } static inline void tds_raw_mutex_free(tds_raw_mutex *mtx) { pthread_mutex_destroy(mtx); } typedef pthread_cond_t tds_condition; int tds_raw_cond_init(tds_condition *cond); static inline int tds_raw_cond_destroy(tds_condition *cond) { return pthread_cond_destroy(cond); } static inline int tds_raw_cond_signal(tds_condition *cond) { return pthread_cond_signal(cond); } static inline int tds_raw_cond_wait(tds_condition *cond, tds_raw_mutex *mtx) { return pthread_cond_wait(cond, mtx); } int tds_raw_cond_timedwait(tds_condition *cond, tds_raw_mutex *mtx, int timeout_sec); #define TDS_HAVE_MUTEX 1 typedef pthread_t tds_thread; typedef pthread_t tds_thread_id; typedef void *(*tds_thread_proc)(void *arg); #define TDS_THREAD_PROC_DECLARE(name, arg) \ void *name(void *arg) static inline int tds_thread_create(tds_thread *ret, tds_thread_proc proc, void *arg) { return pthread_create(ret, NULL, proc, arg); } static inline int tds_thread_create_detached(tds_thread_proc proc, void *arg) { tds_thread th; int ret = pthread_create(&th, NULL, proc, arg); if (!ret) pthread_detach(th); return ret; } static inline int tds_thread_join(tds_thread th, void **ret) { return pthread_join(th, ret); } static inline tds_thread_id tds_thread_get_current_id(void) { return pthread_self(); } static inline int tds_thread_is_current(tds_thread_id th) { return pthread_equal(th, pthread_self()); } #include <freetds/popvis.h> #elif defined(_WIN32) struct ptw32_mcs_node_t_; typedef struct { struct ptw32_mcs_node_t_ *lock; LONG done; CRITICAL_SECTION crit; } tds_raw_mutex; #define TDS_RAW_MUTEX_INITIALIZER { NULL, 0 } static inline int tds_raw_mutex_init(tds_raw_mutex *mtx) { mtx->lock = NULL; mtx->done = 0; return 0; } void tds_win_mutex_lock(tds_raw_mutex *mutex); static inline void tds_raw_mutex_lock(tds_raw_mutex *mtx) { if ((mtx)->done) EnterCriticalSection(&(mtx)->crit); else tds_win_mutex_lock(mtx); } int tds_raw_mutex_trylock(tds_raw_mutex *mtx); static inline void tds_raw_mutex_unlock(tds_raw_mutex *mtx) { LeaveCriticalSection(&(mtx)->crit); } static inline void tds_raw_mutex_free(tds_raw_mutex *mtx) { if ((mtx)->done) { DeleteCriticalSection(&(mtx)->crit); (mtx)->done = 0; } } #define TDS_HAVE_MUTEX 1 /* easy way, only single signal supported */ typedef void *TDS_CONDITION_VARIABLE; typedef union { HANDLE ev; TDS_CONDITION_VARIABLE cv; } tds_condition; extern int (*tds_raw_cond_init)(tds_condition *cond); extern int (*tds_raw_cond_destroy)(tds_condition *cond); extern int (*tds_raw_cond_signal)(tds_condition *cond); extern int (*tds_raw_cond_timedwait)(tds_condition *cond, tds_raw_mutex *mtx, int timeout_sec); static inline int tds_raw_cond_wait(tds_condition *cond, tds_raw_mutex *mtx) { return tds_raw_cond_timedwait(cond, mtx, -1); } typedef HANDLE tds_thread; typedef DWORD tds_thread_id; typedef void *(WINAPI *tds_thread_proc)(void *arg); #define TDS_THREAD_PROC_DECLARE(name, arg) \ void *WINAPI name(void *arg) static inline int tds_thread_create(tds_thread *ret, tds_thread_proc proc, void *arg) { *ret = CreateThread(NULL, 0, (DWORD (WINAPI *)(void*)) proc, arg, 0, NULL); return *ret != NULL ? 0 : 11 /* EAGAIN */; } static inline int tds_thread_create_detached(tds_thread_proc proc, void *arg) { HANDLE h = CreateThread(NULL, 0, (DWORD (WINAPI *)(void*)) proc, arg, 0, NULL); if (h) return 0; CloseHandle(h); return 11 /* EAGAIN */; } static inline int tds_thread_join(tds_thread th, void **ret) { if (WaitForSingleObject(th, INFINITE) == WAIT_OBJECT_0) { DWORD r; if (ret && GetExitCodeThread(th, &r)) *ret = (void*) (((char*)0) + r); CloseHandle(th); return 0; } CloseHandle(th); return 22 /* EINVAL */; } static inline tds_thread_id tds_thread_get_current_id(void) { return GetCurrentThreadId(); } static inline int tds_thread_is_current(tds_thread_id th) { return th == GetCurrentThreadId(); } #else /* define noops as "successful" */ typedef struct { } tds_raw_mutex; #define TDS_RAW_MUTEX_INITIALIZER {} static inline void tds_raw_mutex_lock(tds_raw_mutex *mtx) { } static inline int tds_raw_mutex_trylock(tds_raw_mutex *mtx) { return 0; } static inline void tds_raw_mutex_unlock(tds_raw_mutex *mtx) { } static inline int tds_raw_mutex_init(tds_raw_mutex *mtx) { return 0; } static inline void tds_raw_mutex_free(tds_raw_mutex *mtx) { } typedef struct { } tds_condition; static inline int tds_raw_cond_init(tds_condition *cond) { return 0; } static inline int tds_raw_cond_destroy(tds_condition *cond) { return 0; } #define tds_raw_cond_signal(cond) \ FreeTDS_Condition_not_compiled #define tds_raw_cond_wait(cond, mtx) \ FreeTDS_Condition_not_compiled #define tds_raw_cond_timedwait(cond, mtx, timeout_sec) \ FreeTDS_Condition_not_compiled typedef struct { } tds_thread; typedef int tds_thread_id; typedef void *(*tds_thread_proc)(void *arg); #define TDS_THREAD_PROC_DECLARE(name, arg) \ void *name(void *arg) #define tds_thread_create(ret, proc, arg) \ FreeTDS_Thread_not_compiled #define tds_thread_create_detached(proc, arg) \ FreeTDS_Thread_not_compiled #define tds_thread_join(th, ret) \ FreeTDS_Thread_not_compiled static inline tds_thread_id tds_thread_get_current_id(void) { return 0; } static inline int tds_thread_is_current(tds_thread_id th) { return 1; } #endif #ifdef TDS_HAVE_MUTEX # define tds_cond_init tds_raw_cond_init # define tds_cond_destroy tds_raw_cond_destroy # define tds_cond_signal tds_raw_cond_signal # if !ENABLE_EXTRA_CHECKS # define TDS_MUTEX_INITIALIZER TDS_RAW_MUTEX_INITIALIZER # define tds_mutex tds_raw_mutex # define tds_mutex_lock tds_raw_mutex_lock # define tds_mutex_trylock tds_raw_mutex_trylock # define tds_mutex_unlock tds_raw_mutex_unlock # define tds_mutex_check_owned(mtx) do {} while(0) # define tds_mutex_init tds_raw_mutex_init # define tds_mutex_free tds_raw_mutex_free # define tds_cond_wait tds_raw_cond_wait # define tds_cond_timedwait tds_raw_cond_timedwait # else # include <assert.h> typedef struct tds_mutex { tds_raw_mutex mtx; volatile int locked; volatile tds_thread_id locked_by; } tds_mutex; # define TDS_MUTEX_INITIALIZER { TDS_RAW_MUTEX_INITIALIZER, 0 } static inline void tds_mutex_lock(tds_mutex *mtx) { assert(mtx); tds_raw_mutex_lock(&mtx->mtx); assert(!mtx->locked); mtx->locked = 1; mtx->locked_by = tds_thread_get_current_id(); } static inline int tds_mutex_trylock(tds_mutex *mtx) { int ret; assert(mtx); ret = tds_raw_mutex_trylock(&mtx->mtx); if (!ret) { assert(!mtx->locked); mtx->locked = 1; mtx->locked_by = tds_thread_get_current_id(); } return ret; } static inline void tds_mutex_unlock(tds_mutex *mtx) { assert(mtx && mtx->locked); mtx->locked = 0; tds_raw_mutex_unlock(&mtx->mtx); } static inline void tds_mutex_check_owned(tds_mutex *mtx) { int ret; assert(mtx); ret = tds_raw_mutex_trylock(&mtx->mtx); assert(ret); assert(mtx->locked); assert(tds_thread_is_current(mtx->locked_by)); } static inline int tds_mutex_init(tds_mutex *mtx) { mtx->locked = 0; return tds_raw_mutex_init(&mtx->mtx); } static inline void tds_mutex_free(tds_mutex *mtx) { assert(mtx && !mtx->locked); tds_raw_mutex_free(&mtx->mtx); } static inline int tds_cond_wait(tds_condition *cond, tds_mutex *mtx) { int ret; assert(mtx && mtx->locked); mtx->locked = 0; ret = tds_raw_cond_wait(cond, &mtx->mtx); mtx->locked = 1; mtx->locked_by = tds_thread_get_current_id(); return ret; } static inline int tds_cond_timedwait(tds_condition *cond, tds_mutex *mtx, int timeout_sec) { int ret; assert(mtx && mtx->locked); mtx->locked = 0; ret = tds_raw_cond_timedwait(cond, &mtx->mtx, timeout_sec); mtx->locked = 1; mtx->locked_by = tds_thread_get_current_id(); return ret; } # endif #endif #endif <|start_filename|>public/freetds-1.00.23/include/freetds/sysconfdir.h<|end_filename|> #define FREETDS_SYSCONFDIR "/usr/local/etc" <|start_filename|>public/freetds-1.00.23/include/freetds/dlist.tmpl.h<|end_filename|> /* Dlist - dynamic list * Copyright (C) 2016 <NAME> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #if !defined(DLIST_NAME) || !defined(DLIST_TYPE) || !defined(DLIST_LIST_TYPE) #error Required defines missing! #endif typedef struct { dlist_ring ring; } DLIST_LIST_TYPE; #undef DLIST_ITEM #define DLIST_ITEM(ring) ((DLIST_TYPE *) (((char *) (ring)) - TDS_OFFSET(DLIST_TYPE, DLIST_NAME(item)))) static inline void DLIST_NAME(check)(DLIST_LIST_TYPE *list) { #if ENABLE_EXTRA_CHECKS assert(list != NULL); dlist_ring_check(&list->ring); #endif } static inline void DLIST_NAME(init)(DLIST_LIST_TYPE *list) { list->ring.next = list->ring.prev = &list->ring; DLIST_NAME(check)(list); } static inline DLIST_TYPE *DLIST_NAME(first)(DLIST_LIST_TYPE *list) { return list->ring.next == &list->ring ? NULL : DLIST_ITEM(list->ring.next); } static inline DLIST_TYPE *DLIST_NAME(last)(DLIST_LIST_TYPE *list) { return list->ring.prev == &list->ring ? NULL : DLIST_ITEM(list->ring.prev); } static inline DLIST_TYPE *DLIST_NAME(next)(DLIST_LIST_TYPE *list, DLIST_TYPE *item) { return item->DLIST_NAME(item).next == &list->ring ? NULL : DLIST_ITEM(item->DLIST_NAME(item).next); } static inline DLIST_TYPE *DLIST_NAME(prev)(DLIST_LIST_TYPE *list, DLIST_TYPE *item) { return item->DLIST_NAME(item).prev == &list->ring ? NULL : DLIST_ITEM(item->DLIST_NAME(item).prev); } static inline void DLIST_NAME(prepend)(DLIST_LIST_TYPE *list, DLIST_TYPE *item) { DLIST_NAME(check)(list); assert(item->DLIST_NAME(item).next == NULL && item->DLIST_NAME(item).prev == NULL); list->ring.next->prev = &item->DLIST_NAME(item); item->DLIST_NAME(item).next = list->ring.next; item->DLIST_NAME(item).prev = &list->ring; list->ring.next = &item->DLIST_NAME(item); assert(item->DLIST_NAME(item).next != NULL && item->DLIST_NAME(item).prev != NULL); DLIST_NAME(check)(list); } static inline void DLIST_NAME(append)(DLIST_LIST_TYPE *list, DLIST_TYPE *item) { DLIST_NAME(check)(list); assert(item->DLIST_NAME(item).next == NULL && item->DLIST_NAME(item).prev == NULL); list->ring.prev->next = &item->DLIST_NAME(item); item->DLIST_NAME(item).prev = list->ring.prev; item->DLIST_NAME(item).next = &list->ring; list->ring.prev = &item->DLIST_NAME(item); assert(item->DLIST_NAME(item).next != NULL && item->DLIST_NAME(item).prev != NULL); DLIST_NAME(check)(list); } static inline void DLIST_NAME(remove)(DLIST_LIST_TYPE *list, DLIST_TYPE *item) { dlist_ring *prev = item->DLIST_NAME(item).prev, *next = item->DLIST_NAME(item).next; DLIST_NAME(check)(list); if (prev) prev->next = next; if (next) next->prev = prev; item->DLIST_NAME(item).prev = NULL; item->DLIST_NAME(item).next = NULL; DLIST_NAME(check)(list); } static inline bool DLIST_NAME(in_list)(DLIST_LIST_TYPE *list, DLIST_TYPE *item) { DLIST_NAME(check)(list); return item->DLIST_NAME(item).prev != NULL || item->DLIST_NAME(item).next != NULL; } #undef DLIST_ITEM #undef DLIST_NAME #undef DLIST_TYPE #undef DLIST_LIST_TYPE <|start_filename|>public/freetds-1.00.23/include/freetds/checks.h<|end_filename|> /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 2004 <NAME> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifndef TDS_CHECKS_H #define TDS_CHECKS_H #include <freetds/pushvis.h> #if ENABLE_EXTRA_CHECKS #define CHECK_STRUCT_EXTRA(func,s) func(s) #else #define CHECK_STRUCT_EXTRA(func,s) #endif #define CHECK_TDS_EXTRA(tds) CHECK_STRUCT_EXTRA(tds_check_tds_extra,tds) #define CHECK_CONTEXT_EXTRA(ctx) CHECK_STRUCT_EXTRA(tds_check_context_extra,ctx) #define CHECK_TDSENV_EXTRA(env) CHECK_STRUCT_EXTRA(tds_check_env_extra,env) #define CHECK_COLUMN_EXTRA(column) CHECK_STRUCT_EXTRA(tds_check_column_extra,column) #define CHECK_RESULTINFO_EXTRA(res_info) CHECK_STRUCT_EXTRA(tds_check_resultinfo_extra,res_info) #define CHECK_PARAMINFO_EXTRA(res_info) CHECK_STRUCT_EXTRA(tds_check_resultinfo_extra,res_info) #define CHECK_CURSOR_EXTRA(cursor) CHECK_STRUCT_EXTRA(tds_check_cursor_extra,cursor) #define CHECK_DYNAMIC_EXTRA(dynamic) CHECK_STRUCT_EXTRA(tds_check_dynamic_extra,dynamic) #define CHECK_CONN_EXTRA(conn) #if ENABLE_EXTRA_CHECKS void tds_check_tds_extra(const TDSSOCKET * tds); void tds_check_context_extra(const TDSCONTEXT * ctx); void tds_check_env_extra(const TDSENV * env); void tds_check_column_extra(const TDSCOLUMN * column); void tds_check_resultinfo_extra(const TDSRESULTINFO * res_info); void tds_check_cursor_extra(const TDSCURSOR * cursor); void tds_check_dynamic_extra(const TDSDYNAMIC * dynamic); #endif #if defined(HAVE_VALGRIND_MEMCHECK_H) && ENABLE_EXTRA_CHECKS # include <valgrind/memcheck.h> # define TDS_MARK_UNDEFINED(ptr, len) VALGRIND_MAKE_MEM_UNDEFINED(ptr, len) #else # define TDS_MARK_UNDEFINED(ptr, len) do {} while(0) #endif #include <freetds/popvis.h> #endif /* TDS_CHECKS_H */ <|start_filename|>public/freetds-1.00.23/vms/edit.c<|end_filename|> /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 2010 <NAME> <EMAIL> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ /* $Id: edit.c,v */ #include <namdef.h> #include <descrip.h> #include <stsdef.h> #include <tpu$routines.h> #include <string.h> #include <unixlib.h> #if defined(NAML$C_MAXRSS) && !defined(__VAX) # define VMS_MAXRSS (NAML$C_MAXRSS+1) #else # define VMS_MAXRSS (NAM$C_MAXRSS+1) #endif char vms_fnm[VMS_MAXRSS]; static int get_vms_name(char *, int); int edit(const char *editor, const char *arg) { $DESCRIPTOR(fnm_dsc, ""); int status; decc$to_vms(arg, get_vms_name, 0, 0); fnm_dsc.dsc$a_pointer = vms_fnm; fnm_dsc.dsc$w_length = strlen(vms_fnm); if (fnm_dsc.dsc$a_pointer == NULL || fnm_dsc.dsc$w_length == 0) return -1; status = TPU$EDIT(&fnm_dsc, &fnm_dsc); if ($VMS_STATUS_SUCCESS(status)) return 0; else return -1; } static int get_vms_name(char *name, int type) { strncpy(vms_fnm, name, VMS_MAXRSS); return 1; } int reset_term() { return 0; } <|start_filename|>public/freetds-1.00.23/include/md5.h<|end_filename|> #ifndef MD5_H #define MD5_H #ifndef HAVE_NETTLE #include <freetds/pushvis.h> struct MD5Context { TDS_UINT buf[4]; TDS_UINT8 bytes; unsigned char in[64]; }; void MD5Init(struct MD5Context *context); void MD5Update(struct MD5Context *context, unsigned char const *buf, size_t len); void MD5Final(struct MD5Context *context, unsigned char *digest); /* * This is needed to make RSAREF happy on some MS-DOS compilers. */ typedef struct MD5Context MD5_CTX; #include <freetds/popvis.h> #else #include <nettle/md5.h> typedef struct md5_ctx MD5_CTX; static inline void MD5Init(MD5_CTX *ctx) { nettle_md5_init(ctx); } static inline void MD5Update(MD5_CTX *ctx, unsigned char const *buf, size_t len) { nettle_md5_update(ctx, len, buf); } static inline void MD5Final(MD5_CTX *ctx, unsigned char *digest) { nettle_md5_digest(ctx, 16, digest); } #endif #endif /* !MD5_H */ <|start_filename|>public/freetds-1.00.23/include/hmac_md5.h<|end_filename|> /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 2008 <NAME> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifndef _hmac_md5_h_ #define _hmac_md5_h_ #include <freetds/pushvis.h> void hmac_md5(const unsigned char key[16], const unsigned char* data, size_t data_len, unsigned char* digest); #include <freetds/popvis.h> #endif <|start_filename|>public/freetds-1.00.23/include/freetds/popvis.h<|end_filename|> #if defined(__GNUC__) && __GNUC__ >= 4 && !defined(__MINGW32__) #pragma GCC visibility pop #endif <|start_filename|>public/freetds-1.00.23/include/odbcss.h<|end_filename|> /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 2008 <NAME> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifndef _odbcss_h_ #define _odbcss_h_ #ifdef TDSODBC_BCP #include <sql.h> #endif #ifdef __cplusplus extern "C" { #endif #define SQL_DIAG_SS_MSGSTATE (-1150) #define SQL_DIAG_SS_LINE (-1154) #define SQL_SOPT_SS_QUERYNOTIFICATION_TIMEOUT 1233 #define SQL_SOPT_SS_QUERYNOTIFICATION_MSGTEXT 1234 #define SQL_SOPT_SS_QUERYNOTIFICATION_OPTIONS 1235 #ifndef SQL_SS_LENGTH_UNLIMITED #define SQL_SS_LENGTH_UNLIMITED 0 #endif #ifndef SQL_COPT_SS_BASE #define SQL_COPT_SS_BASE 1200 #endif #ifndef SQL_COPT_SS_MARS_ENABLED #define SQL_COPT_SS_MARS_ENABLED (SQL_COPT_SS_BASE+24) #endif #ifndef SQL_COPT_SS_OLDPWD #define SQL_COPT_SS_OLDPWD (SQL_COPT_SS_BASE+26) #endif #define SQL_INFO_FREETDS_TDS_VERSION 1300 #ifndef SQL_MARS_ENABLED_NO #define SQL_MARS_ENABLED_NO 0 #endif #ifndef SQL_MARS_ENABLED_YES #define SQL_MARS_ENABLED_YES 1 #endif #ifndef SQL_SS_VARIANT #define SQL_SS_VARIANT (-150) #endif #ifndef SQL_SS_UDT #define SQL_SS_UDT (-151) #endif #ifndef SQL_SS_XML #define SQL_SS_XML (-152) #endif #ifndef SQL_SS_TABLE #define SQL_SS_TABLE (-153) #endif #ifndef SQL_SS_TIME2 #define SQL_SS_TIME2 (-154) #endif #ifndef SQL_SS_TIMESTAMPOFFSET #define SQL_SS_TIMESTAMPOFFSET (-155) #endif /* * these types are used from conversion from client to server */ #ifndef SQL_C_SS_TIME2 #define SQL_C_SS_TIME2 (0x4000) #endif #ifndef SQL_C_SS_TIMESTAMPOFFSET #define SQL_C_SS_TIMESTAMPOFFSET (0x4001) #endif #ifndef SQL_CA_SS_BASE #define SQL_CA_SS_BASE 1200 #endif #ifndef SQL_CA_SS_UDT_CATALOG_NAME #define SQL_CA_SS_UDT_CATALOG_NAME (SQL_CA_SS_BASE+18) #endif #ifndef SQL_CA_SS_UDT_SCHEMA_NAME #define SQL_CA_SS_UDT_SCHEMA_NAME (SQL_CA_SS_BASE+19) #endif #ifndef SQL_CA_SS_UDT_TYPE_NAME #define SQL_CA_SS_UDT_TYPE_NAME (SQL_CA_SS_BASE+20) #endif #ifndef SQL_CA_SS_UDT_ASSEMBLY_TYPE_NAME #define SQL_CA_SS_UDT_ASSEMBLY_TYPE_NAME (SQL_CA_SS_BASE+21) #endif #ifndef SQL_CA_SS_XML_SCHEMACOLLECTION_CATALOG_NAME #define SQL_CA_SS_XML_SCHEMACOLLECTION_CATALOG_NAME (SQL_CA_SS_BASE+22) #endif #ifndef SQL_CA_SS_XML_SCHEMACOLLECTION_SCHEMA_NAME #define SQL_CA_SS_XML_SCHEMACOLLECTION_SCHEMA_NAME (SQL_CA_SS_BASE+23) #endif #ifndef SQL_CA_SS_XML_SCHEMACOLLECTION_NAME #define SQL_CA_SS_XML_SCHEMACOLLECTION_NAME (SQL_CA_SS_BASE+24) #endif typedef struct tagSS_TIME2_STRUCT { SQLUSMALLINT hour; SQLUSMALLINT minute; SQLUSMALLINT second; SQLUINTEGER fraction; } SQL_SS_TIME2_STRUCT; typedef struct tagSS_TIMESTAMPOFFSET_STRUCT { SQLSMALLINT year; SQLUSMALLINT month; SQLUSMALLINT day; SQLUSMALLINT hour; SQLUSMALLINT minute; SQLUSMALLINT second; SQLUINTEGER fraction; SQLSMALLINT timezone_hour; SQLSMALLINT timezone_minute; } SQL_SS_TIMESTAMPOFFSET_STRUCT; #ifdef TDSODBC_BCP #ifndef SUCCEED #define SUCCEED 1 #endif #ifndef FAIL #define FAIL 0 #endif #ifndef BCPKEEPIDENTITY #define BCPKEEPIDENTITY 8 #endif #ifndef BCPHINTS #define BCPHINTS 6 #endif #define BCP_DIRECTION_IN 1 #define SQL_COPT_SS_BCP (SQL_COPT_SS_BASE+19) #define SQL_BCP_OFF 0 #define SQL_BCP_ON 1 #define SQL_COPT_TDSODBC_IMPL_BASE 1500 #define SQL_COPT_TDSODBC_IMPL_BCP_INITA (SQL_COPT_TDSODBC_IMPL_BASE) #define SQL_COPT_TDSODBC_IMPL_BCP_CONTROL (SQL_COPT_TDSODBC_IMPL_BASE+1) #define SQL_COPT_TDSODBC_IMPL_BCP_COLPTR (SQL_COPT_TDSODBC_IMPL_BASE+2) #define SQL_COPT_TDSODBC_IMPL_BCP_SENDROW (SQL_COPT_TDSODBC_IMPL_BASE+3) #define SQL_COPT_TDSODBC_IMPL_BCP_BATCH (SQL_COPT_TDSODBC_IMPL_BASE+4) #define SQL_COPT_TDSODBC_IMPL_BCP_DONE (SQL_COPT_TDSODBC_IMPL_BASE+5) #define SQL_COPT_TDSODBC_IMPL_BCP_BIND (SQL_COPT_TDSODBC_IMPL_BASE+6) #define SQL_COPT_TDSODBC_IMPL_BCP_INITW (SQL_COPT_TDSODBC_IMPL_BASE+7) #define SQL_VARLEN_DATA -10 /* copied from sybdb.h which was copied from tds.h */ /* TODO find a much better way... */ enum { BCP_TYPE_SQLCHAR = 47, /* 0x2F */ #define BCP_TYPE_SQLCHAR BCP_TYPE_SQLCHAR BCP_TYPE_SQLVARCHAR = 39, /* 0x27 */ #define BCP_TYPE_SQLVARCHAR BCP_TYPE_SQLVARCHAR BCP_TYPE_SQLINTN = 38, /* 0x26 */ #define BCP_TYPE_SQLINTN BCP_TYPE_SQLINTN BCP_TYPE_SQLINT1 = 48, /* 0x30 */ #define BCP_TYPE_SQLINT1 BCP_TYPE_SQLINT1 BCP_TYPE_SQLINT2 = 52, /* 0x34 */ #define BCP_TYPE_SQLINT2 BCP_TYPE_SQLINT2 BCP_TYPE_SQLINT4 = 56, /* 0x38 */ #define BCP_TYPE_SQLINT4 BCP_TYPE_SQLINT4 BCP_TYPE_SQLINT8 = 127, /* 0x7F */ #define BCP_TYPE_SQLINT8 BCP_TYPE_SQLINT8 BCP_TYPE_SQLFLT8 = 62, /* 0x3E */ #define BCP_TYPE_SQLFLT8 BCP_TYPE_SQLFLT8 BCP_TYPE_SQLDATETIME = 61, /* 0x3D */ #define BCP_TYPE_SQLDATETIME BCP_TYPE_SQLDATETIME BCP_TYPE_SQLBIT = 50, /* 0x32 */ #define BCP_TYPE_SQLBIT BCP_TYPE_SQLBIT BCP_TYPE_SQLBITN = 104, /* 0x68 */ #define BCP_TYPE_SQLBITN BCP_TYPE_SQLBITN BCP_TYPE_SQLTEXT = 35, /* 0x23 */ #define BCP_TYPE_SQLTEXT BCP_TYPE_SQLTEXT BCP_TYPE_SQLNTEXT = 99, /* 0x63 */ #define BCP_TYPE_SQLNTEXT BCP_TYPE_SQLNTEXT BCP_TYPE_SQLIMAGE = 34, /* 0x22 */ #define BCP_TYPE_SQLIMAGE BCP_TYPE_SQLIMAGE BCP_TYPE_SQLMONEY4 = 122, /* 0x7A */ #define BCP_TYPE_SQLMONEY4 BCP_TYPE_SQLMONEY4 BCP_TYPE_SQLMONEY = 60, /* 0x3C */ #define BCP_TYPE_SQLMONEY BCP_TYPE_SQLMONEY BCP_TYPE_SQLDATETIME4 = 58, /* 0x3A */ #define BCP_TYPE_SQLDATETIME4 BCP_TYPE_SQLDATETIME4 BCP_TYPE_SQLREAL = 59, /* 0x3B */ BCP_TYPE_SQLFLT4 = 59, /* 0x3B */ #define BCP_TYPE_SQLREAL BCP_TYPE_SQLREAL #define BCP_TYPE_SQLFLT4 BCP_TYPE_SQLFLT4 BCP_TYPE_SQLBINARY = 45, /* 0x2D */ #define BCP_TYPE_SQLBINARY BCP_TYPE_SQLBINARY BCP_TYPE_SQLVOID = 31, /* 0x1F */ #define BCP_TYPE_SQLVOID BCP_TYPE_SQLVOID BCP_TYPE_SQLVARBINARY = 37, /* 0x25 */ #define BCP_TYPE_SQLVARBINARY BCP_TYPE_SQLVARBINARY BCP_TYPE_SQLNUMERIC = 108, /* 0x6C */ #define BCP_TYPE_SQLNUMERIC BCP_TYPE_SQLNUMERIC BCP_TYPE_SQLDECIMAL = 106, /* 0x6A */ #define BCP_TYPE_SQLDECIMAL BCP_TYPE_SQLDECIMAL BCP_TYPE_SQLFLTN = 109, /* 0x6D */ #define BCP_TYPE_SQLFLTN BCP_TYPE_SQLFLTN BCP_TYPE_SQLMONEYN = 110, /* 0x6E */ #define BCP_TYPE_SQLMONEYN BCP_TYPE_SQLMONEYN BCP_TYPE_SQLDATETIMN = 111, /* 0x6F */ #define BCP_TYPE_SQLDATETIMN BCP_TYPE_SQLDATETIMN BCP_TYPE_SQLNVARCHAR = 103, /* 0x67 */ #define BCP_TYPE_SQLNVARCHAR BCP_TYPE_SQLNVARCHAR BCP_TYPE_SQLUNIQUEID = 36, /* 0x24 */ #define BCP_TYPE_SQLUNIQUEID BCP_TYPE_SQLUNIQUEID BCP_TYPE_SQLDATETIME2 = 42, /* 0x2a */ #define BCP_TYPE_SQLDATETIME2 BCP_TYPE_SQLDATETIME2 }; typedef struct { int dtdays; int dttime; } DBDATETIME; #ifdef _MSC_VER #define TDSODBC_INLINE __inline #else #define TDSODBC_INLINE __inline__ #endif struct tdsodbc_impl_bcp_init_params { const void *tblname; const void *hfile; const void *errfile; int direction; }; static TDSODBC_INLINE RETCODE SQL_API bcp_initA(HDBC hdbc, const char *tblname, const char *hfile, const char *errfile, int direction) { struct tdsodbc_impl_bcp_init_params params = {tblname, hfile, errfile, direction}; return SQL_SUCCEEDED(SQLSetConnectAttr(hdbc, SQL_COPT_TDSODBC_IMPL_BCP_INITA, &params, SQL_IS_POINTER)) ? SUCCEED : FAIL; } static TDSODBC_INLINE RETCODE SQL_API bcp_initW(HDBC hdbc, const SQLWCHAR *tblname, const SQLWCHAR *hfile, const SQLWCHAR *errfile, int direction) { struct tdsodbc_impl_bcp_init_params params = {tblname, hfile, errfile, direction}; return SQL_SUCCEEDED(SQLSetConnectAttr(hdbc, SQL_COPT_TDSODBC_IMPL_BCP_INITW, &params, SQL_IS_POINTER)) ? SUCCEED : FAIL; } struct tdsodbc_impl_bcp_control_params { int field; void *value; }; static TDSODBC_INLINE RETCODE SQL_API bcp_control(HDBC hdbc, int field, void *value) { struct tdsodbc_impl_bcp_control_params params = {field, value}; return SQL_SUCCEEDED(SQLSetConnectAttr(hdbc, SQL_COPT_TDSODBC_IMPL_BCP_CONTROL, &params, SQL_IS_POINTER)) ? SUCCEED : FAIL; } struct tdsodbc_impl_bcp_colptr_params { const unsigned char * colptr; int table_column; }; static TDSODBC_INLINE RETCODE SQL_API bcp_colptr(HDBC hdbc, const unsigned char * colptr, int table_column) { struct tdsodbc_impl_bcp_colptr_params params = {colptr, table_column}; return SQL_SUCCEEDED(SQLSetConnectAttr(hdbc, SQL_COPT_TDSODBC_IMPL_BCP_COLPTR, &params, SQL_IS_POINTER)) ? SUCCEED : FAIL; } static TDSODBC_INLINE RETCODE SQL_API bcp_sendrow(HDBC hdbc) { return SQL_SUCCEEDED(SQLSetConnectAttr(hdbc, SQL_COPT_TDSODBC_IMPL_BCP_SENDROW, NULL, SQL_IS_POINTER)) ? SUCCEED : FAIL; } struct tdsodbc_impl_bcp_batch_params { int rows; }; static TDSODBC_INLINE int SQL_API bcp_batch(HDBC hdbc) { struct tdsodbc_impl_bcp_batch_params params = {-1}; return SQL_SUCCEEDED(SQLSetConnectAttr(hdbc, SQL_COPT_TDSODBC_IMPL_BCP_BATCH, &params, SQL_IS_POINTER)) ? params.rows : -1; } struct tdsodbc_impl_bcp_done_params { int rows; }; static TDSODBC_INLINE int SQL_API bcp_done(HDBC hdbc) { struct tdsodbc_impl_bcp_done_params params = {-1}; return SQL_SUCCEEDED(SQLSetConnectAttr(hdbc, SQL_COPT_TDSODBC_IMPL_BCP_DONE, &params, SQL_IS_POINTER)) ? params.rows : -1; } struct tdsodbc_impl_bcp_bind_params { const unsigned char * varaddr; int prefixlen; int varlen; const unsigned char * terminator; int termlen; int vartype; int table_column; }; static TDSODBC_INLINE RETCODE SQL_API bcp_bind(HDBC hdbc, const unsigned char * varaddr, int prefixlen, int varlen, const unsigned char * terminator, int termlen, int vartype, int table_column) { struct tdsodbc_impl_bcp_bind_params params = {varaddr, prefixlen, varlen, terminator, termlen, vartype, table_column}; return SQL_SUCCEEDED(SQLSetConnectAttr(hdbc, SQL_COPT_TDSODBC_IMPL_BCP_BIND, &params, SQL_IS_POINTER)) ? SUCCEED : FAIL; } #ifdef UNICODE #define bcp_init bcp_initW #else #define bcp_init bcp_initA #endif #endif /* TDSODBC_BCP */ #ifdef __cplusplus } #endif #endif /* _odbcss_h_ */ <|start_filename|>public/freetds-1.00.23/src/tds/num_limits.h<|end_filename|> #define LIMIT_INDEXES_ADJUST 4 static const signed char limit_indexes[79]= { 0, /* 0 */ -3, /* 1 */ -6, /* 2 */ -9, /* 3 */ -12, /* 4 */ -15, /* 5 */ -18, /* 6 */ -21, /* 7 */ -24, /* 8 */ -27, /* 9 */ -30, /* 10 */ -32, /* 11 */ -34, /* 12 */ -36, /* 13 */ -38, /* 14 */ -40, /* 15 */ -42, /* 16 */ -44, /* 17 */ -46, /* 18 */ -48, /* 19 */ -50, /* 20 */ -51, /* 21 */ -52, /* 22 */ -53, /* 23 */ -54, /* 24 */ -55, /* 25 */ -56, /* 26 */ -57, /* 27 */ -58, /* 28 */ -59, /* 29 */ -59, /* 30 */ -59, /* 31 */ -59, /* 32 */ -60, /* 33 */ -61, /* 34 */ -62, /* 35 */ -63, /* 36 */ -64, /* 37 */ -65, /* 38 */ -66, /* 39 */ -66, /* 40 */ -66, /* 41 */ -66, /* 42 */ -66, /* 43 */ -66, /* 44 */ -66, /* 45 */ -66, /* 46 */ -66, /* 47 */ -66, /* 48 */ -66, /* 49 */ -65, /* 50 */ -64, /* 51 */ -63, /* 52 */ -62, /* 53 */ -61, /* 54 */ -60, /* 55 */ -59, /* 56 */ -58, /* 57 */ -57, /* 58 */ -55, /* 59 */ -53, /* 60 */ -51, /* 61 */ -49, /* 62 */ -47, /* 63 */ -45, /* 64 */ -44, /* 65 */ -43, /* 66 */ -42, /* 67 */ -41, /* 68 */ -39, /* 69 */ -37, /* 70 */ -35, /* 71 */ -33, /* 72 */ -31, /* 73 */ -29, /* 74 */ -27, /* 75 */ -25, /* 76 */ -23, /* 77 */ -21, /* 78 */ }; static const TDS_WORD limits[]= { 0x00000001u, /* 0 */ 0x0000000au, /* 1 */ 0x00000064u, /* 2 */ 0x000003e8u, /* 3 */ 0x00002710u, /* 4 */ 0x000186a0u, /* 5 */ 0x000f4240u, /* 6 */ 0x00989680u, /* 7 */ 0x05f5e100u, /* 8 */ 0x3b9aca00u, /* 9 */ 0x00000002u, /* 10 */ 0x540be400u, /* 11 */ 0x00000017u, /* 12 */ 0x4876e800u, /* 13 */ 0x000000e8u, /* 14 */ 0xd4a51000u, /* 15 */ 0x00000918u, /* 16 */ 0x4e72a000u, /* 17 */ 0x00005af3u, /* 18 */ 0x107a4000u, /* 19 */ 0x00038d7eu, /* 20 */ 0xa4c68000u, /* 21 */ 0x002386f2u, /* 22 */ 0x6fc10000u, /* 23 */ 0x01634578u, /* 24 */ 0x5d8a0000u, /* 25 */ 0x0de0b6b3u, /* 26 */ 0xa7640000u, /* 27 */ 0x8ac72304u, /* 28 */ 0x89e80000u, /* 29 */ 0x00000005u, /* 30 */ 0x6bc75e2du, /* 31 */ 0x63100000u, /* 32 */ 0x00000036u, /* 33 */ 0x35c9adc5u, /* 34 */ 0xdea00000u, /* 35 */ 0x0000021eu, /* 36 */ 0x19e0c9bau, /* 37 */ 0xb2400000u, /* 38 */ 0x0000152du, /* 39 */ 0x02c7e14au, /* 40 */ 0xf6800000u, /* 41 */ 0x0000d3c2u, /* 42 */ 0x1bceccedu, /* 43 */ 0xa1000000u, /* 44 */ 0x00084595u, /* 45 */ 0x16140148u, /* 46 */ 0x4a000000u, /* 47 */ 0x0052b7d2u, /* 48 */ 0xdcc80cd2u, /* 49 */ 0xe4000000u, /* 50 */ 0x033b2e3cu, /* 51 */ 0x9fd0803cu, /* 52 */ 0xe8000000u, /* 53 */ 0x204fce5eu, /* 54 */ 0x3e250261u, /* 55 */ 0x10000000u, /* 56 */ 0x00000001u, /* 57 */ 0x431e0faeu, /* 58 */ 0x6d7217cau, /* 59 */ 0xa0000000u, /* 60 */ 0x0000000cu, /* 61 */ 0x9f2c9cd0u, /* 62 */ 0x4674edeau, /* 63 */ 0x40000000u, /* 64 */ 0x0000007eu, /* 65 */ 0x37be2022u, /* 66 */ 0xc0914b26u, /* 67 */ 0x80000000u, /* 68 */ 0x000004eeu, /* 69 */ 0x2d6d415bu, /* 70 */ 0x85acef81u, /* 71 */ 0x0000314du, /* 72 */ 0xc6448d93u, /* 73 */ 0x38c15b0au, /* 74 */ 0x0001ed09u, /* 75 */ 0xbead87c0u, /* 76 */ 0x378d8e64u, /* 77 */ 0x00134261u, /* 78 */ 0x72c74d82u, /* 79 */ 0x2b878fe8u, /* 80 */ 0x00c097ceu, /* 81 */ 0x7bc90715u, /* 82 */ 0xb34b9f10u, /* 83 */ 0x0785ee10u, /* 84 */ 0xd5da46d9u, /* 85 */ 0x00f436a0u, /* 86 */ 0x4b3b4ca8u, /* 87 */ 0x5a86c47au, /* 88 */ 0x098a2240u, /* 89 */ 0x00000002u, /* 90 */ 0xf050fe93u, /* 91 */ 0x8943acc4u, /* 92 */ 0x5f655680u, /* 93 */ 0x0000001du, /* 94 */ 0x6329f1c3u, /* 95 */ 0x5ca4bfabu, /* 96 */ 0xb9f56100u, /* 97 */ 0x00000125u, /* 98 */ 0xdfa371a1u, /* 99 */ 0x9e6f7cb5u, /* 100 */ 0x4395ca00u, /* 101 */ 0x00000b7au, /* 102 */ 0xbc627050u, /* 103 */ 0x305adf14u, /* 104 */ 0xa3d9e400u, /* 105 */ 0x000072cbu, /* 106 */ 0x5bd86321u, /* 107 */ 0xe38cb6ceu, /* 108 */ 0x6682e800u, /* 109 */ 0x00047bf1u, /* 110 */ 0x9673df52u, /* 111 */ 0xe37f2410u, /* 112 */ 0x011d1000u, /* 113 */ 0x002cd76fu, /* 114 */ 0xe086b93cu, /* 115 */ 0xe2f768a0u, /* 116 */ 0x0b22a000u, /* 117 */ 0x01c06a5eu, /* 118 */ 0xc5433c60u, /* 119 */ 0xddaa1640u, /* 120 */ 0x6f5a4000u, /* 121 */ 0x118427b3u, /* 122 */ 0xb4a05bc8u, /* 123 */ 0xa8a4de84u, /* 124 */ 0x59868000u, /* 125 */ 0xaf298d05u, /* 126 */ 0x0e4395d6u, /* 127 */ 0x9670b12bu, /* 128 */ 0x7f410000u, /* 129 */ 0x00000006u, /* 130 */ 0xd79f8232u, /* 131 */ 0x8ea3da61u, /* 132 */ 0xe066ebb2u, /* 133 */ 0xf88a0000u, /* 134 */ 0x00000044u, /* 135 */ 0x6c3b15f9u, /* 136 */ 0x926687d2u, /* 137 */ 0xc40534fdu, /* 138 */ 0xb5640000u, /* 139 */ 0x000002acu, /* 140 */ 0x3a4edbbfu, /* 141 */ 0xb8014e3bu, /* 142 */ 0xa83411e9u, /* 143 */ 0x15e80000u, /* 144 */ 0x00001abau, /* 145 */ 0x4714957du, /* 146 */ 0x300d0e54u, /* 147 */ 0x9208b31au, /* 148 */ 0xdb100000u, /* 149 */ 0x00010b46u, /* 150 */ 0xc6cdd6e3u, /* 151 */ 0xe0828f4du, /* 152 */ 0xb456ff0cu, /* 153 */ 0x8ea00000u, /* 154 */ 0x000a70c3u, /* 155 */ 0xc40a64e6u, /* 156 */ 0xc5199909u, /* 157 */ 0x0b65f67du, /* 158 */ 0x92400000u, /* 159 */ 0x006867a5u, /* 160 */ 0xa867f103u, /* 161 */ 0xb2fffa5au, /* 162 */ 0x71fba0e7u, /* 163 */ 0xb6800000u, /* 164 */ 0x04140c78u, /* 165 */ 0x940f6a24u, /* 166 */ 0xfdffc788u, /* 167 */ 0x73d4490du, /* 168 */ 0x21000000u, /* 169 */ 0x28c87cb5u, /* 170 */ 0xc89a2571u, /* 171 */ 0xebfdcb54u, /* 172 */ 0x864ada83u, /* 173 */ 0x4a000000u, /* 174 */ 0x00000001u, /* 175 */ 0x97d4df19u, /* 176 */ 0xd6057673u, /* 177 */ 0x37e9f14du, /* 178 */ 0x3eec8920u, /* 179 */ 0xe4000000u, /* 180 */ 0x0000000fu, /* 181 */ 0xee50b702u, /* 182 */ 0x5c36a080u, /* 183 */ 0x2f236d04u, /* 184 */ 0x753d5b48u, /* 185 */ 0xe8000000u, /* 186 */ 0x0000009fu, /* 187 */ 0x4f272617u, /* 188 */ 0x9a224501u, /* 189 */ 0xd762422cu, /* 190 */ 0x946590d9u, /* 191 */ 0x10000000u, /* 192 */ 0x00000639u, /* 193 */ 0x17877cecu, /* 194 */ 0x0556b212u, /* 195 */ 0x69d695bdu, /* 196 */ 0xcbf7a87au, /* 197 */ 0xa0000000u, /* 198 */ 0x00003e3au, /* 199 */ 0xeb4ae138u, /* 200 */ 0x3562f4b8u, /* 201 */ 0x2261d969u, /* 202 */ 0xf7ac94cau, /* 203 */ 0x40000000u, /* 204 */ 0x00026e4du, /* 205 */ 0x30eccc32u, /* 206 */ 0x15dd8f31u, /* 207 */ 0x57d27e23u, /* 208 */ 0xacbdcfe6u, /* 209 */ 0x80000000u, /* 210 */ 0x00184f03u, /* 211 */ 0xe93ff9f4u, /* 212 */ 0xdaa797edu, /* 213 */ 0x6e38ed64u, /* 214 */ 0xbf6a1f01u, /* 215 */ 0x00f31627u, /* 216 */ 0x1c7fc390u, /* 217 */ 0x8a8bef46u, /* 218 */ 0x4e3945efu, /* 219 */ 0x7a25360au, /* 220 */ 0x097edd87u, /* 221 */ 0x1cfda3a5u, /* 222 */ 0x697758bfu, /* 223 */ 0x0e3cbb5au, /* 224 */ 0xc5741c64u, /* 225 */ 0x5ef4a747u, /* 226 */ 0x21e86476u, /* 227 */ 0x1ea97776u, /* 228 */ 0x8e5f518bu, /* 229 */ 0xb6891be8u, /* 230 */ 0x00000003u, /* 231 */ 0xb58e88c7u, /* 232 */ 0x5313ec9du, /* 233 */ 0x329eaaa1u, /* 234 */ 0x8fb92f75u, /* 235 */ 0x215b1710u, /* 236 */ 0x00000025u, /* 237 */ 0x179157c9u, /* 238 */ 0x3ec73e23u, /* 239 */ 0xfa32aa4fu, /* 240 */ 0x9d3bda93u, /* 241 */ 0x4d8ee6a0u, /* 242 */ 0x00000172u, /* 243 */ 0xebad6ddcu, /* 244 */ 0x73c86d67u, /* 245 */ 0xc5faa71cu, /* 246 */ 0x245689c1u, /* 247 */ 0x07950240u, /* 248 */ 0x00000e7du, /* 249 */ 0x34c64a9cu, /* 250 */ 0x85d4460du, /* 251 */ 0xbbca8719u, /* 252 */ 0x6b61618au, /* 253 */ 0x4bd21680u, /* 254 */ 0x000090e4u, /* 255 */ 0x0fbeea1du, /* 256 */ 0x3a4abc89u, /* 257 */ 0x55e946feu, /* 258 */ 0x31cdcf66u, /* 259 */ 0xf634e100u, /* 260 */ 0x0005a8e8u, /* 261 */ 0x9d752524u, /* 262 */ 0x46eb5d5du, /* 263 */ 0x5b1cc5edu, /* 264 */ 0xf20a1a05u, /* 265 */ 0x9e10ca00u, /* 266 */ 0x00389916u, /* 267 */ 0x2693736au, /* 268 */ 0xc531a5a5u, /* 269 */ 0x8f1fbb4bu, /* 270 */ 0x74650438u, /* 271 */ 0x2ca7e400u, /* 272 */ 0x0235faddu, /* 273 */ 0x81c2822bu, /* 274 */ 0xb3f07877u, /* 275 */ 0x973d50f2u, /* 276 */ 0x8bf22a31u, /* 277 */ 0xbe8ee800u, /* 278 */ 0x161bcca7u, /* 279 */ 0x119915b5u, /* 280 */ 0x0764b4abu, /* 281 */ 0xe8652979u, /* 282 */ 0x7775a5f1u, /* 283 */ 0x71951000u, /* 284 */ 0xdd15fe86u, /* 285 */ 0xaffad912u, /* 286 */ 0x49ef0eb7u, /* 287 */ 0x13f39ebeu, /* 288 */ 0xaa987b6eu, /* 289 */ 0x6fd2a000u, /* 290 */ }; <|start_filename|>public/freetds-1.00.23/include/freetds/sysdep_private.h<|end_filename|> /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 <NAME> * Copyright (C) 2010 <NAME> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifndef _tds_sysdep_private_h_ #define _tds_sysdep_private_h_ #define TDS_ADDITIONAL_SPACE 16 #ifdef MSG_NOSIGNAL # define TDS_NOSIGNAL MSG_NOSIGNAL #else # define TDS_NOSIGNAL 0L #endif #ifdef __cplusplus extern "C" { #if 0 } #endif #endif #ifdef __INCvxWorksh #include <ioLib.h> /* for FIONBIO */ #endif /* __INCvxWorksh */ #if defined(DOS32X) #define READSOCKET(a,b,c) recv((a), (b), (c), TDS_NOSIGNAL) #define WRITESOCKET(a,b,c) send((a), (b), (c), TDS_NOSIGNAL) #define CLOSESOCKET(a) closesocket((a)) #define IOCTLSOCKET(a,b,c) ioctlsocket((a), (b), (char*)(c)) #define SOCKLEN_T int #define select select_s typedef int pid_t; #define strcasecmp stricmp #define strncasecmp strnicmp /* TODO this has nothing to do with ip ... */ #define getpid() _gethostid() #endif /* defined(DOS32X) */ #if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(_WIN64) #include <winsock2.h> #include <ws2tcpip.h> #include <windows.h> #define READSOCKET(a,b,c) recv((a), (char *) (b), (c), TDS_NOSIGNAL) #define WRITESOCKET(a,b,c) send((a), (const char *) (b), (c), TDS_NOSIGNAL) #define CLOSESOCKET(a) closesocket((a)) #define IOCTLSOCKET(a,b,c) ioctlsocket((a), (b), (c)) #define SOCKLEN_T int int tds_socket_init(void); #define INITSOCKET() tds_socket_init() void tds_socket_done(void); #define DONESOCKET() tds_socket_done() #define NETDB_REENTRANT 1 /* BSD-style netdb interface is reentrant */ #define TDSSOCK_EINTR WSAEINTR #define TDSSOCK_EINPROGRESS WSAEWOULDBLOCK #define TDSSOCK_ETIMEDOUT WSAETIMEDOUT #define TDSSOCK_WOULDBLOCK(e) ((e)==WSAEWOULDBLOCK) #define TDSSOCK_ECONNRESET WSAECONNRESET #define sock_errno WSAGetLastError() #define set_sock_errno(err) WSASetLastError(err) #define sock_strerror(n) tds_prwsaerror(n) #define sock_strerror_free(s) tds_prwsaerror_free(s) #ifndef __MINGW32__ typedef DWORD pid_t; #endif #undef strcasecmp #define strcasecmp stricmp #undef strncasecmp #define strncasecmp strnicmp #if defined(HAVE__SNPRINTF) && !defined(HAVE_SNPRINTF) #define snprintf _snprintf #endif #ifndef WIN32 #define WIN32 1 #endif #if defined(_WIN64) && !defined(WIN64) #define WIN64 1 #endif #define TDS_SDIR_SEPARATOR "\\" /* use macros to use new style names */ #if defined(__MSVCRT__) || defined(_MSC_VER) /* Use API as always present and not causing problems */ #undef getpid #define getpid() GetCurrentProcessId() #define strdup(s) _strdup(s) #define unlink(f) _unlink(f) #define putenv(s) _putenv(s) #undef fileno #define fileno(f) _fileno(f) #define stricmp(s1,s2) _stricmp(s1,s2) #define strnicmp(s1,s2,n) _strnicmp(s1,s2,n) #endif #endif /* defined(WIN32) || defined(_WIN32) || defined(__WIN32__) */ #ifndef sock_errno #define sock_errno errno #endif #ifndef set_sock_errno #define set_sock_errno(err) do { errno = (err); } while(0) #endif #ifndef sock_strerror #define sock_strerror(n) strerror(n) #define sock_strerror_free(s) do {} while(0) #endif #ifndef TDSSOCK_EINTR #define TDSSOCK_EINTR EINTR #endif #ifndef TDSSOCK_EINPROGRESS #define TDSSOCK_EINPROGRESS EINPROGRESS #endif #ifndef TDSSOCK_ETIMEDOUT #define TDSSOCK_ETIMEDOUT ETIMEDOUT #endif #ifndef TDSSOCK_WOULDBLOCK # if defined(EWOULDBLOCK) && EAGAIN != EWOULDBLOCK # define TDSSOCK_WOULDBLOCK(e) ((e)==EAGAIN||(e)==EWOULDBLOCK) # else # define TDSSOCK_WOULDBLOCK(e) ((e)==EAGAIN) # endif #endif #ifndef TDSSOCK_ECONNRESET #define TDSSOCK_ECONNRESET ECONNRESET #endif #ifndef INITSOCKET #define INITSOCKET() 0 #endif /* !INITSOCKET */ #ifndef DONESOCKET #define DONESOCKET() do { } while(0) #endif /* !DONESOCKET */ #ifndef READSOCKET # ifdef MSG_NOSIGNAL # define READSOCKET(s,b,l) recv((s), (b), (l), MSG_NOSIGNAL) # else # define READSOCKET(s,b,l) read((s), (b), (l)) # endif #endif /* !READSOCKET */ #ifndef WRITESOCKET # ifdef MSG_NOSIGNAL # define WRITESOCKET(s,b,l) send((s), (b), (l), MSG_NOSIGNAL) # else # define WRITESOCKET(s,b,l) write((s), (b), (l)) # endif #endif /* !WRITESOCKET */ #ifndef CLOSESOCKET #define CLOSESOCKET(s) close((s)) #endif /* !CLOSESOCKET */ #ifndef IOCTLSOCKET #define IOCTLSOCKET(s,b,l) ioctl((s), (b), (l)) #endif /* !IOCTLSOCKET */ #ifndef SOCKLEN_T # define SOCKLEN_T socklen_t #endif #if !defined(__WIN32__) && !defined(_WIN32) && !defined(WIN32) typedef int TDS_SYS_SOCKET; #define INVALID_SOCKET -1 #define TDS_IS_SOCKET_INVALID(s) ((s) < 0) #else typedef SOCKET TDS_SYS_SOCKET; #define TDS_IS_SOCKET_INVALID(s) ((s) == INVALID_SOCKET) #endif #define tds_accept accept #define tds_getpeername getpeername #define tds_getsockopt getsockopt #define tds_getsockname getsockname #define tds_recvfrom recvfrom #if defined(__hpux__) && SIZEOF_VOID_P == 8 && SIZEOF_INT == 4 # if HAVE__XPG_ACCEPT # undef tds_accept # define tds_accept _xpg_accept # elif HAVE___ACCEPT # undef tds_accept # define tds_accept __accept # endif # if HAVE__XPG_GETPEERNAME # undef tds_getpeername # define tds_getpeername _xpg_getpeername # elif HAVE___GETPEERNAME # undef tds_getpeername # define tds_getpeername __getpeername # endif # if HAVE__XPG_GETSOCKOPT # undef tds_getsockopt # define tds_getsockopt _xpg_getsockopt # elif HAVE___GETSOCKOPT # undef tds_getsockopt # define tds_getsockopt __getsockopt # endif # if HAVE__XPG_GETSOCKNAME # undef tds_getsockname # define tds_getsockname _xpg_getsockname # elif HAVE___GETSOCKNAME # undef tds_getsockname # define tds_getsockname __getsockname # endif # if HAVE__XPG_RECVFROM # undef tds_recvfrom # define tds_recvfrom _xpg_recvfrom # elif HAVE___RECVFROM # undef tds_recvfrom # define tds_recvfrom __recvfrom # endif #endif #ifndef TDS_SDIR_SEPARATOR #define TDS_SDIR_SEPARATOR "/" #endif /* !TDS_SDIR_SEPARATOR */ #ifdef HAVE_INTTYPES_H #include <inttypes.h> #endif #ifndef PRId64 #define PRId64 TDS_I64_PREFIX "d" #endif #ifndef PRIu64 #define PRIu64 TDS_I64_PREFIX "u" #endif #ifndef PRIx64 #define PRIx64 TDS_I64_PREFIX "x" #endif #ifdef __cplusplus #if 0 { #endif } #endif #endif /* _tds_sysdep_private_h_ */ <|start_filename|>public/freetds-1.00.23/win32/installfreetds.bat<|end_filename|> @echo off REM This shell script installs the FreeTDS ODBC driver set dest=%windir%\System IF EXIST %windir%\System32\ODBCCONF.exe SET dest=%windir%\System32 ECHO Installing to %dest% COPY /Y Debug\FreeTDS.dll %dest%\FreeTDS.dll CD %dest% regsvr32 FreeTDS.dll <|start_filename|>public/freetds-1.00.23/doc/tds_ssl.html<|end_filename|> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>SSL and TDS</title> </head> <body> <h2>How to enable encryption on MSSQL</h2> <h3>Under Linux (or any system that have openssl)</h3> <pre> # create a file containing key and self-signed certificate openssl req \ -x509 -nodes -days 365 \ -newkey rsa:1024 -keyout mycert.pem -out mycert.pem # export mycert.pem as PKCS#12 file, mycert.pfx openssl pkcs12 -export \ -out mycert.pfx -in mycert.pem \ -name "My Certificate" </pre> <p>So we created a mycert.pfx certificate ready to be imported <h3>Under Windows</h3> <p>Open MMC and add certificates snap-in, add our certificate under <b>personal</b> and under <b>ca root</b> (to validate it) <p>Add to the registry the thumbprint of our certificato so to be used by mssql. For examples <pre> REGEDIT4 [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSSQLServer\MSSQLServer\SuperSocketNetLib] "Certificate"=hex:DD,5F,6C,EE,47,8E,0C,C0,74,8B,C4,71,8D,87,1C,E6,07,20,F2,28 </pre> <p>Restart MSSQL <p>Check event viewer for results <h2>Encryption protocol</h2> <p>Prelogin packet (tds 7.1 only) <p>&gt;From client to server <pre> 00000000 12 01 00 34 00 00 00 00 00 00 15 00 06 01 00 1b ...4.... ........ 00000010 00 01 02 00 1c 00 0c 03 00 28 00 04 ff 08 00 01 ........ .(...... 00000020 55 00 00 01 4d 53 53 51 4c 53 65 72 76 65 72 00 U...MSSQ LServer. 00000030 38 09 00 00 8... </pre> <table border=1> <tr><th>Header</th><th>Description</th><th>Value</th></tr> <tr><td> 00 00 15 00 06 </td><td> netlib version (0) start from 0x15 length 0x06 </td><td> 8.341.0 </td></tr> <tr><td> 01 00 1b 00 01 </td><td> encrypt flag (1) start from 0x1b length 0x01 </td><td> 1, see below </td></tr> <tr><td> 02 00 1c 00 0c </td><td> instance name (2) start from 0x1c length 0x0c </td><td> "MSSQLServer\0" (as you note string is null terminated) </td></tr> <tr><td> 03 00 28 00 04 </td><td> process id (3) start from 0x28 length 0x04 </td><td> 0x938 (why in little endian ??) </td></tr> <tr><td> ff </td><td> end </td><td> &nbsp; </td></tr> </table> <p>Meaning of encryption flag (client): <ul> <li>0x00 normal <li>0x01 high encryption (128 bit ??) </ul> <p>MSSQL 2005 have 9.0.0 as a version and have a single byte option 4 (always seen as zero, I don't know the meaning). <p>&gt;From server to client <pre> 00000000 04 01 00 25 00 00 01 00 00 00 15 00 06 01 00 1b ...%.... ........ 00000010 00 01 02 00 1c 00 01 03 00 1d 00 00 ff 08 00 02 ........ ........ 00000020 f8 00 00 01 00 </pre> <p>Similar <table border=1> <tr><th>Header</th><th>Description</th><th>Value</th></tr> <tr><td> 00 00 15 00 06 </td><td> version (0) start from 0x15 length 0x06 </td><td> 8.0.760.0 </td></tr> <tr><td> 01 00 1b 00 01 </td><td> encrypt flag (1) start from 0x1b length 0x01 </td><td> 1, see below </td></tr> <tr><td> 02 00 1c 00 01 </td><td> instance name (2) start from 0x1c length 0x01 </td><td> "\0" (still null terminatted) </td></tr> <tr><td> 03 00 1d 00 00 </td><td> process id (3) start from 0x1d length 0x0 </td><td> no info </td></tr> <tr><td> ff </td><td> end </td><td> &nbsp; </td></tr> </table> <p>Meaning of encryption flag (server): <ul> <li>0x02, no certificate, no encryption required just do normal jobs (like FreeTDS) <li>0x00, certificate, no force flag on server, prelogin to see certificate (TLS 1.0, not SSL 2 or 3 !!) login encrypted, after login do normal TDS (not encrypted) <li>0x01, certificate, high encryption required by client prelogin to see certificate login encrypted, after login changed crypt (my client close connection perhaps a configuration problem...) <li>0x03, certificate enabled, force encryption configured on server prelogin like 0x00, remains in SSL after login </ul> <p>Note that mssql2k unpatched do not set last packet flag (byte 2) for this packet. <p>Following a valid encrypted connection (0x00 from server, no force) <p>&gt;From client to server <pre> 00000034 12 01 00 46 00 00 00 00 16 03 01 00 39 01 00 00 ...F.... ....9... 00000044 35 03 01 41 b9 5e 02 f8 7d 45 81 31 d9 73 9e 93 5..A.^.. }E.1.s.. 00000054 91 b2 dd f4 4a 80 a3 92 a8 0f aa 67 32 8a 72 6d ....J... ...g2.rm 00000064 4b 22 07 00 00 0e 00 09 00 64 00 62 00 03 00 06 K"...... .d.b.... 00000074 00 12 00 63 01 00 ...c.. </pre> <p>prelogin packet (0x12), content TLS 1.0 (you can see a ClientHell0, see RFC 2246) <p>&gt;From server to client <pre> 00000025 04 01 03 da 00 00 01 00 16 03 01 03 cd 02 00 00 ........ ........ 00000035 46 03 01 41 b9 5e 03 4b c1 bf 9b a5 7d 83 74 57 F..A.^.K ....}.tW 00000045 00 03 de b5 fb fc 4d f8 84 15 ce 07 d9 ab fe 2b ......M. .......+ 00000055 57 3c ad 20 96 10 00 00 6f 31 af e4 17 ae 2a 2b W&lt;. .... o1....*+ 00000065 37 29 0e 57 8a 4d 1d 32 aa d9 ed 62 6b 3d 3c d1 7).W.M.2 ...bk=&lt;. 00000075 d1 c6 a9 cb 00 09 00 0b 00 03 7b 00 03 78 00 03 ........ ..{..x.. 00000085 75 30 82 03 71 30 82 02 da a0 03 02 01 02 02 01 u0..q0.. ........ 00000095 00 30 0d 06 09 2a 86 48 86 f7 0d 01 01 04 05 00 .0...*.H ........ 000000A5 30 81 88 31 0b 30 09 06 03 55 04 06 13 02 49 54 0..1.0.. .U....IT 000000B5 31 10 30 0e 06 03 55 04 08 13 07 42 6f 6c 6f 67 1.0...U. ...Bolog 000000C5 6e 61 31 10 30 0e 06 03 55 04 07 13 07 42 6f 6c na1.0... U....Bol ... omissis... </pre> <p>normal reply packet (0x4), ServerHello(2), content TLS (certificate). <p>NOTE: if server send certificate request client (MS ODBC) crash so I think this is not supported. <p>&gt;From client to server <pre> 0000007A 12 01 00 c6 00 00 00 00 16 03 01 00 86 10 00 00 ........ ........ 0000008A 82 00 80 3a c6 96 ba 55 ce 8e 4b a4 e2 d7 b7 bd ...:...U ..K..... 0000009A 5d 5e f4 28 30 c6 c7 b9 4e 66 60 80 45 ce cb 4e ]^.(0... Nf`.E..N 000000AA f6 f7 91 d7 9b 05 79 f8 ad f7 c7 13 77 36 cb 8c ......y. ....w6.. 000000BA 04 58 33 3f 51 c8 0a bb 6a 95 8f 65 a1 e9 74 c5 .X3?Q... j..e..t. 000000CA c9 c6 4a 11 b1 36 87 84 f2 96 82 d0 19 8a dd dc ..J..6.. ........ 000000DA d1 32 6a 32 ab 73 47 76 58 69 16 fd 9f 0b bd d7 .2j2.sGv Xi...... 000000EA 72 79 a7 86 9a 71 2b 70 9a d1 8f e2 54 63 46 81 ry...q+p ....TcF. 000000FA 3e 6d 8a f7 8d 2e 26 02 3f 2d 0c a1 bc 63 ac 0a &gt;m....&amp;. ?-...c.. 0000010A 8a 38 0e 14 03 01 00 01 01 16 03 01 00 28 12 09 .8...... .....(.. 0000011A d5 2d 93 8c 60 aa ae ec e3 9b 2b 3c 27 63 46 ad .-..`... ..+&lt;'cF. 0000012A b1 b9 3d 1e 06 60 18 49 6d bb 76 80 8b 7b 51 70 ..=..`.I m.v..{Qp 0000013A b7 79 14 b8 ba 62 .y...b </pre> <p>prelogin (0x12), still TLS handshake, client_key_exchange (??) (0x16, 0x10), change crypt (0x14), handshake (crypted) <p>&gt;From server to client <pre> 000003FF 04 01 00 3b 00 00 01 00 14 03 01 00 01 01 16 03 ...;.... ........ 0000040F 01 00 28 96 3c 2e 41 42 09 d3 a8 77 82 19 7f 4b ..(.&lt;.AB ...w...K 0000041F ac 04 b8 96 4b f1 65 c2 35 9e ef 6a 1d c2 41 2d ....K.e. 5..j..A- 0000042F a3 98 b8 2b 5c 0f 40 d1 98 b0 1e ...+\.@. ... </pre> <p>normal reply (0x4), still TLS <p>0x14 means change crypt, followed by 0x16 (handshake crypted). <p>&gt;From client to server <pre> 00000140 17 03 01 01 08 d7 3a b5 c3 fd a7 4d 14 b7 ce c7 ......:. ...M.... 00000150 c6 6f f3 c5 03 1c 5c 86 7b 15 98 45 2a 93 73 c7 .o....\. {..E*.s. 00000160 72 75 72 23 c2 11 20 7d 5c b1 be e7 ac 72 ac b3 rur#.. } \....r.. 00000170 47 41 4f 45 d8 fa 22 2b 94 b1 67 a5 7f de af 96 GAOE.."+ ..g..... 00000180 05 ad bb fc e4 33 66 3a a2 f1 8d c5 5f 84 8b 38 .....3f: ...._..8 00000190 86 b0 df e8 87 e7 2c 26 e6 c0 66 2e b1 53 86 40 ......,&amp; ..f..S.@ 000001A0 98 0d 9e 2f 49 0b 17 b2 9d 55 d3 e3 7e 08 ca b9 .../I... .U..~... 000001B0 de 62 87 23 14 98 6e 10 d0 dd c2 94 70 4c 33 4b .b.#..n. ....pL3K 000001C0 09 8d b8 46 e5 a2 31 52 4d 89 06 b2 10 a8 ed b0 ...F..1R M....... 000001D0 a8 21 02 79 ab 99 de 67 28 a3 6c ea 18 88 b5 63 .!.y...g (.l....c 000001E0 02 ab f4 a1 78 0d 83 ec b6 7b 61 7d 42 d2 38 bb ....x... .{a}B.8. 000001F0 50 fc e1 9e 1e e0 51 69 93 ea 05 9f d5 a4 a8 2b P.....Qi .......+ 00000200 18 7f 79 4f 29 1a c0 35 3c 55 83 b0 9f af b7 de ..yO)..5 &lt;U...... 00000210 6d 2d 12 fa 27 ef 28 6b a9 83 12 e6 a1 09 58 00 m-..'.(k ......X. 00000220 30 b3 3d f0 60 00 97 84 ee 28 b0 ae 31 78 50 d7 0.=.`... .(..1xP. 00000230 85 82 19 9f 57 ca a6 1c d2 81 0f 6b 2d fb 47 41 ....W... ...k-.GA 00000240 37 58 8a ba 4f 38 f6 00 23 24 56 c2 35 7X..O8.. #$V.5 </pre> <p>Well... you can note that this it's not a TDS packet !!! This is a fully crypted packet (login packet). <p>&gt;From server to client <pre> 0000043A 04 01 01 79 00 33 01 00 e3 1b 00 01 06 6d 00 61 ...y.3.. .....m.a 0000044A 00 73 00 74 00 65 00 72 00 06 6d 00 61 00 73 00 .s.t.e.r ..m.a.s. 0000045A 74 00 65 00 72 00 ab 66 00 45 16 00 00 02 00 25 t.e.r..f .E.....% 0000046A 00 43 00 68 00 61 00 6e 00 67 00 65 00 64 00 20 .C.h.a.n .g.e.d. 0000047A 00 64 00 61 00 74 00 61 00 62 00 61 00 73 00 65 .d.a.t.a .b.a.s.e 0000048A 00 20 00 63 00 6f 00 6e 00 74 00 65 00 78 00 74 . .c.o.n .t.e.x.t 0000049A 00 20 00 74 00 6f 00 20 00 27 00 6d 00 61 00 73 . .t.o. .'.m.a.s ... omissis ... </pre> <p>Now normal data follow. In this case server used flag 0 (see above). <p>With force login (0x03 from server) after crypted login packet server and client continue to keep encrypting full packets <p>Note that uncrypted packets are still splitted using packet size selected during login (that is usually 4096 bytes). </body> </html> <|start_filename|>public/freetds-1.00.23/include/freetds/convert.h<|end_filename|> /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 1998-1999 <NAME> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifndef _tdsconvert_h_ #define _tdsconvert_h_ #include <freetds/pushvis.h> #ifdef __cplusplus extern "C" { #if 0 } #endif #endif typedef union conv_result { /* fixed */ TDS_TINYINT ti; TDS_SMALLINT si; TDS_USMALLINT usi; TDS_INT i; TDS_UINT ui; TDS_INT8 bi; TDS_UINT8 ubi; TDS_FLOAT f; TDS_REAL r; TDS_MONEY m; TDS_MONEY4 m4; TDS_DATETIME dt; TDS_DATETIME4 dt4; TDS_DATETIMEALL dta; TDS_TIME time; TDS_DATE date; TDS_BIGTIME bigtime; TDS_BIGDATETIME bigdatetime; TDS_NUMERIC n; TDS_UNIQUE u; /* variable */ TDS_CHAR *c; TDS_CHAR *ib; /* sized buffer types */ struct cc_t { TDS_CHAR *c; TDS_UINT len; } cc; struct cb_t { TDS_CHAR *ib; TDS_UINT len; } cb; } CONV_RESULT; /* * Failure return codes for tds_convert() */ #define TDS_CONVERT_FAIL -1 /* unspecified failure */ #define TDS_CONVERT_NOAVAIL -2 /* conversion does not exist */ #define TDS_CONVERT_SYNTAX -3 /* syntax error in source field */ #define TDS_CONVERT_NOMEM -4 /* insufficient memory */ #define TDS_CONVERT_OVERFLOW -5 /* result too large */ /* sized types */ #define TDS_CONVERT_CHAR 256 #define TDS_CONVERT_BINARY 257 unsigned char tds_willconvert(int srctype, int desttype); TDS_SERVER_TYPE tds_get_null_type(TDS_SERVER_TYPE srctype); TDS_INT tds_char2hex(TDS_CHAR *dest, TDS_UINT destlen, const TDS_CHAR * src, TDS_UINT srclen); TDS_INT tds_convert(const TDSCONTEXT * context, int srctype, const TDS_CHAR * src, TDS_UINT srclen, int desttype, CONV_RESULT * cr); size_t tds_strftime(char *buf, size_t maxsize, const char *format, const TDSDATEREC * timeptr, int prec); #ifdef __cplusplus #if 0 { #endif } #endif #include <freetds/popvis.h> #endif /* _tdsconvert_h_ */ <|start_filename|>public/freetds-1.00.23/include/md4.h<|end_filename|> #ifndef MD4_H #define MD4_H #ifndef HAVE_NETTLE #include <freetds/pushvis.h> struct MD4Context { TDS_UINT buf[4]; TDS_UINT8 bytes; unsigned char in[64]; }; void MD4Init(struct MD4Context *context); void MD4Update(struct MD4Context *context, unsigned char const *buf, size_t len); void MD4Final(struct MD4Context *context, unsigned char *digest); typedef struct MD4Context MD4_CTX; #include <freetds/popvis.h> #else #include <nettle/md4.h> typedef struct md4_ctx MD4_CTX; static inline void MD4Init(MD4_CTX *ctx) { nettle_md4_init(ctx); } static inline void MD4Update(MD4_CTX *ctx, unsigned char const *buf, size_t len) { nettle_md4_update(ctx, len, buf); } static inline void MD4Final(MD4_CTX *ctx, unsigned char *digest) { nettle_md4_digest(ctx, 16, digest); } #endif #endif /* !MD4_H */ <|start_filename|>public/freetds-1.00.23/samples/debug.c<|end_filename|> /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 1998-1999 <NAME> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <netdb.h> #include <errno.h> #include <stdio.h> #include <ctype.h> #include <string.h> #include <sys/signal.h> #include <sys/wait.h> static char software_version[] = "$Id: debug.c,v 1.2 2001-10-13 00:02:54 brianb Exp $"; static void *no_unused_var_warn[] = {software_version, no_unused_var_warn}; extern errno; get_incoming (int fd) { FILE *out; int len, i, offs=0; unsigned char buf[BUFSIZ]; out = fopen("client.out","w"); while ((len = read(fd, buf, BUFSIZ)) > 0) { fprintf (out,"len is %d\n",len); for (i=0;i<len;i++) { fprintf (out, "%d:%d",i,buf[i]); if (buf[i]>=' ' && buf[i]<'z') fprintf(out," %c",buf[i]); fprintf(out,"\n"); } fflush(out); } close(fd); fclose(out); } <|start_filename|>public/freetds-1.00.23/src/replacements/poll.c<|end_filename|> /* * poll(2) implemented with select(2), for systems without poll(2). * Warning: a call to this poll() takes about 4K of stack space. * * This file and the accompanying poll.h * are based on poll.h in C++ by * * <NAME> <EMAIL> December 2000 * This code is in the public domain. * * Updated May 2002: * * fix crash when an fd is less than 0 * * set errno=EINVAL if an fd is greater or equal to FD_SETSIZE * * don't set POLLIN or POLLOUT in revents if it wasn't requested * in events (only happens when an fd is in the poll set twice) * * Converted to C and spruced up by <NAME> December 2008. */ #include <config.h> #ifndef HAVE_POLL #include <stdarg.h> #include <stdio.h> #if HAVE_UNISTD_H #include <unistd.h> #endif /* HAVE_UNISTD_H */ #include "replacements.h" #if HAVE_SYS_TYPES_H #include <sys/types.h> #endif /* HAVE_SYS_TYPES_H */ #if HAVE_ERRNO_H #include <errno.h> #endif /* HAVE_ERRNO_H */ #include <freetds/time.h> #include <string.h> #include <assert.h> int tds_poll(struct pollfd fds[], int nfds, int timeout) { struct timeval tv, *tvp; fd_set fdsr, fdsw, fdsp; struct pollfd *p; const struct pollfd *endp = fds? fds + nfds : NULL; int selected, polled = 0, maxfd = 0; #if defined(_WIN32) typedef int (WSAAPI *WSAPoll_t)(struct pollfd fds[], ULONG nfds, INT timeout); static WSAPoll_t poll_p = (WSAPoll_t) -1; if (poll_p == (WSAPoll_t) -1) { HMODULE mod; poll_p = NULL; mod = GetModuleHandle("ws2_32"); if (mod) poll_p = (WSAPoll_t) GetProcAddress(mod, "WSAPoll"); } /* Windows 2008 have WSAPoll which is semantically equal to poll */ if (poll_p != NULL) return poll_p(fds, nfds, timeout); #endif if (fds == NULL) { errno = EFAULT; return -1; } FD_ZERO(&fdsr); FD_ZERO(&fdsw); FD_ZERO(&fdsp); /* * Transcribe flags from the poll set to the fd sets. * Also ensure we don't exceed select's capabilities. */ for (p = fds; p < endp; p++) { /* Negative fd checks nothing and always reports zero */ if (p->fd < 0) { continue; } #if defined(_WIN32) /* Win32 cares about the number of descriptors, not the highest one. */ ++maxfd; #else if (p->fd > maxfd) maxfd = p->fd; #endif /* POLLERR is never set coming in; poll(2) always reports errors */ /* But don't report if we're not listening to anything at all. */ if (p->events & POLLIN) FD_SET(p->fd, &fdsr); if (p->events & POLLOUT) FD_SET(p->fd, &fdsw); if (p->events != 0) FD_SET(p->fd, &fdsp); } /* * If any FD is too big for select(2), we need to return an error. * Which one, though, is debatable. There's no defined errno for * this for poll(2) because it's an "impossible" condition; * there's no such thing as "too many" FD's to check. * select(2) returns EINVAL, and so do we. * EFAULT might be better. */ #if !defined(_WIN32) if (maxfd > FD_SETSIZE) { assert(FD_SETSIZE > 0); errno = EINVAL; return -1; } #endif /* * poll timeout is in milliseconds. Convert to struct timeval. * timeout == -1: wait forever : select timeout of NULL * timeout == 0: return immediately : select timeout of zero */ if (timeout >= 0) { tv.tv_sec = timeout / 1000; tv.tv_usec = (timeout % 1000) * 1000; tvp = &tv; } else { tvp = NULL; } /* * call select(2) */ if ((selected = select(maxfd+1, &fdsr, &fdsw, &fdsp, tvp)) < 0) { return -1; /* error */ } /* timeout, clear all result bits and return zero. */ if (selected == 0) { for (p = fds; p < endp; p++) { p->revents = 0; } return 0; } /* * Select found something * Transcribe result from fd sets to poll set. * Return the number of ready fds. */ for (polled=0, p=fds; p < endp; p++) { p->revents = 0; /* Negative fd always reports zero */ if (p->fd < 0) { continue; } if ((p->events & POLLIN) && FD_ISSET(p->fd, &fdsr)) { p->revents |= POLLIN; } if ((p->events & POLLOUT) && FD_ISSET(p->fd, &fdsw)) { p->revents |= POLLOUT; } if ((p->events != 0) && FD_ISSET(p->fd, &fdsp)) { p->revents |= POLLERR; } if (p->revents) polled++; } assert(polled == selected); return polled; } #endif /* HAVE_POLL */ <|start_filename|>public/freetds-1.00.23/samples/dyntest.c<|end_filename|> #include <stdio.h> #include <ctpublic.h> void execute(CS_COMMAND *cmd, char *id, CS_DATAFMT *datafmt, char *p1, char *p2, double p3, double p4) ; int main() { CS_CONTEXT *ctx; CS_CONNECTION *conn; CS_COMMAND *cmd; CS_RETCODE ret; CS_RETCODE restype; CS_DATAFMT datafmt[10]; ret = cs_ctx_alloc(CS_VERSION_100, &ctx); ret = ct_init(ctx, CS_VERSION_100); ret = ct_con_alloc(ctx, &conn); ret = ct_con_props(conn, CS_SET, CS_USERNAME, "guest", CS_NULLTERM, NULL); ret = ct_con_props(conn, CS_SET, CS_PASSWORD, "<PASSWORD>", CS_NULLTERM, NULL); /* ret = ct_con_props(conn, CS_SET, CS_IFILE, "/devl/t3624bb/myinterf", CS_NULLTERM, NULL); */ ret = ct_connect(conn, "JDBC", CS_NULLTERM); ret = ct_cmd_alloc(conn, &cmd); ret = ct_command(cmd, CS_LANG_CMD, "drop table tempdb..prepare_bug ", CS_NULLTERM, CS_UNUSED); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_command() failed\n"); exit(1); } ret = ct_send(cmd); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_send() failed\n"); exit(1); } while(ct_results(cmd, &restype) == CS_SUCCEED) ; ret = ct_command(cmd, CS_LANG_CMD, "create table tempdb..prepare_bug (c1 char(20), c2 varchar(255), p1 float, p2 real) ", CS_NULLTERM, CS_UNUSED); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_command() failed\n"); exit(1); } ret = ct_send(cmd); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_send() failed\n"); exit(1); } while(ct_results(cmd, &restype) == CS_SUCCEED) ; ct_dynamic(cmd, CS_PREPARE, "BUG", CS_NULLTERM, "insert tempdb..prepare_bug values(?, ?, ?, ?)", CS_NULLTERM); if(ct_send(cmd) != CS_SUCCEED) { fprintf(stderr,"ct_send failed in prepare"); exit(1); } while(ct_results(cmd, &restype) == CS_SUCCEED) ; /* ---- Sybase has now created a temporary stored proc ---- now - describe the parameters */ ct_dynamic(cmd, CS_DESCRIBE_INPUT, "BUG", CS_NULLTERM, NULL, CS_UNUSED); ct_send(cmd); while(ct_results(cmd, &restype) == CS_SUCCEED) { if(restype == CS_DESCRIBE_RESULT) { CS_INT num_param, outlen; int i; ct_res_info(cmd, CS_NUMDATA, &num_param, CS_UNUSED, &outlen); for(i = 1; i <= num_param; ++i) { ct_describe(cmd, i, &datafmt[i-1]); printf("column type: %d size: %d\n", datafmt[i-1].datatype, datafmt[i-1].maxlength); } } } /* ---- Now we have CS_DATAFMT struct for each of the input params ---- to the request. ---- so we can execute it with some parameters */ execute(cmd, "BUG", &datafmt[0], "test", "Jan 1 1988", 123.4, 222.334); /* ---- from now on it's a standard fetch all results loop... */ while(ct_results(cmd, &restype) == CS_SUCCEED) { printf("got restype %d\n", restype); if(restype == CS_ROW_RESULT) { int numcols, rows; char string[20]; int i, len, ind, ival; CS_DATAFMT output[2]; ct_res_info(cmd, CS_NUMDATA, &numcols, CS_UNUSED, NULL); for(i = 0; i < numcols; ++i) { ct_describe(cmd, (i + 1), &output[i]); if(output[i].datatype == CS_CHAR_TYPE) { ct_bind(cmd, (i + 1), &output[i], &string, &len, &ind); } else { ct_bind(cmd, (i + 1), &output[i], &ival, &len, &ind); } } while(ct_fetch(cmd, CS_UNUSED, CS_UNUSED, CS_UNUSED, &rows) == CS_SUCCEED) { printf("data = %.3s - %d\n", string, ival); } } } } void execute(CS_COMMAND *cmd, char *id, CS_DATAFMT *datafmt, char *p1, char *p2, double p3, double p4) { CS_INT restype; printf("execute called with %s, %s, %f, %f\n", p1, p2, p3, p4); ct_dynamic(cmd, CS_EXECUTE, id, CS_NULLTERM, NULL, CS_UNUSED); datafmt[0].datatype = CS_CHAR_TYPE; ct_param(cmd, &datafmt[0], p1, CS_NULLTERM, 0); datafmt[1].datatype = CS_CHAR_TYPE; ct_param(cmd, &datafmt[1], p2, CS_NULLTERM, 0); datafmt[2].datatype = CS_FLOAT_TYPE; ct_param(cmd, &datafmt[2], &p3, sizeof(double), 0); datafmt[3].datatype = CS_FLOAT_TYPE; ct_param(cmd, &datafmt[3], &p4, sizeof(double), 0); ct_send(cmd); } <|start_filename|>public/freetds-1.00.23/include/freetds/bool.h<|end_filename|> /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 2015 <NAME> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifndef freetds_bool_h_ #define freetds_bool_h_ #ifndef __cplusplus #ifdef HAVE_STDBOOL_H #include <stdbool.h> #else #undef true #undef false #undef bool #define bool int #define true 1 #define false 0 #endif #endif #endif /* freetds_bool_h_ */ <|start_filename|>public/freetds-1.00.23/src/replacements/getaddrinfo.c<|end_filename|> /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 2013 <NAME> * Copyright (C) 2013 <NAME> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include <config.h> #if !defined(HAVE_GETADDRINFO) #include <stdio.h> #include <stdlib.h> #include <assert.h> #include <freetds/tds.h> #include <freetds/sysdep_private.h> #include "replacements.h" /* Incomplete implementation, single ipv4 addr, service does not work, hints do not work */ int tds_getaddrinfo(const char *node, const char *service, const struct tds_addrinfo *hints, struct tds_addrinfo **res) { struct tds_addrinfo *addr; struct sockaddr_in *sin = NULL; struct hostent *host; in_addr_t ipaddr; char buffer[4096]; struct hostent result; int h_errnop, port = 0; assert(node != NULL); if ((addr = (tds_addrinfo *) calloc(1, sizeof(struct tds_addrinfo))) == NULL) goto Cleanup; if ((sin = (struct sockaddr_in *) calloc(1, sizeof(struct sockaddr_in))) == NULL) goto Cleanup; addr->ai_addr = (struct sockaddr *) sin; addr->ai_addrlen = sizeof(struct sockaddr_in); addr->ai_family = AF_INET; if ((ipaddr = inet_addr(node)) == INADDR_NONE) { if ((host = tds_gethostbyname_r(node, &result, buffer, sizeof(buffer), &h_errnop)) == NULL) goto Cleanup; if (host->h_name) addr->ai_canonname = strdup(host->h_name); ipaddr = *(in_addr_t *) host->h_addr; } if (service) { port = atoi(service); if (!port) port = tds_getservice(service); } sin->sin_family = AF_INET; sin->sin_addr.s_addr = ipaddr; sin->sin_port = htons(port); *res = addr; return 0; Cleanup: if (addr != NULL) tds_freeaddrinfo(addr); return -1; } /* Incomplete implementation, ipv4 only, port does not work, flags do not work */ int tds_getnameinfo(const struct sockaddr *sa, size_t salen, char *host, size_t hostlen, char *serv, size_t servlen, int flags) { struct sockaddr_in *sin = (struct sockaddr_in *) sa; if (sa->sa_family != AF_INET) return EAI_FAMILY; if (host == NULL || hostlen < 16) return EAI_OVERFLOW; #if defined(AF_INET) && HAVE_INET_NTOP inet_ntop(AF_INET, &sin->sin_addr, host, hostlen); #elif HAVE_INET_NTOA_R inet_ntoa_r(sin->sin_addr, host, hostlen); #else strlcpy(hostip, inet_ntoa(sin->sin_addr), hostlen); #endif return 0; } void tds_freeaddrinfo(struct tds_addrinfo *addr) { assert(addr != NULL); free(addr->ai_canonname); free(addr->ai_addr); free(addr); } #endif <|start_filename|>public/freetds-1.00.23/include/freetds/dlist.h<|end_filename|> /* Dlist - dynamic list * Copyright (C) 2016 <NAME> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef TDS_DLIST_H #define TDS_DLIST_H typedef struct dlist_ring { struct dlist_ring *next; struct dlist_ring *prev; } dlist_ring; #if ENABLE_EXTRA_CHECKS void dlist_ring_check(dlist_ring *ring); #endif #define DLIST_FIELDS(name) \ dlist_ring name #define DLIST_FOREACH(prefix, list, p) \ for (p = prefix ## _ ## first(list); p != NULL; p = prefix ## _ ## next(list, p)) #endif /* TDS_DLIST_H */ <|start_filename|>public/freetds-1.00.23/include/freetds/server.h<|end_filename|> /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 1998-1999 <NAME> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifndef _tdsserver_h_ #define _tdsserver_h_ #endif #ifdef __cplusplus extern "C" { #endif #if 0 } #endif /* login.c */ unsigned char *tds7_decrypt_pass(const unsigned char *crypt_pass, int len, unsigned char *clear_pass); TDSSOCKET *tds_listen(TDSCONTEXT * ctx, int ip_port); int tds_read_login(TDSSOCKET * tds, TDSLOGIN * login); int tds7_read_login(TDSSOCKET * tds, TDSLOGIN * login); TDSLOGIN *tds_alloc_read_login(TDSSOCKET * tds); /* query.c */ char *tds_get_query(TDSSOCKET * tds); char *tds_get_generic_query(TDSSOCKET * tds); /* server.c */ void tds_env_change(TDSSOCKET * tds, int type, const char *oldvalue, const char *newvalue); void tds_send_msg(TDSSOCKET * tds, int msgno, int msgstate, int severity, const char *msgtext, const char *srvname, const char *procname, int line); void tds_send_login_ack(TDSSOCKET * tds, const char *progname); void tds_send_eed(TDSSOCKET * tds, int msgno, int msgstate, int severity, char *msgtext, char *srvname, char *procname, int line); void tds_send_err(TDSSOCKET * tds, int severity, int dberr, int oserr, char *dberrstr, char *oserrstr); void tds_send_capabilities_token(TDSSOCKET * tds); /* TODO remove, use tds_send_done */ void tds_send_done_token(TDSSOCKET * tds, TDS_SMALLINT flags, TDS_INT numrows); void tds_send_done(TDSSOCKET * tds, int token, TDS_SMALLINT flags, TDS_INT numrows); void tds_send_control_token(TDSSOCKET * tds, TDS_SMALLINT numcols); void tds_send_col_name(TDSSOCKET * tds, TDSRESULTINFO * resinfo); void tds_send_col_info(TDSSOCKET * tds, TDSRESULTINFO * resinfo); void tds_send_result(TDSSOCKET * tds, TDSRESULTINFO * resinfo); void tds7_send_result(TDSSOCKET * tds, TDSRESULTINFO * resinfo); void tds_send_table_header(TDSSOCKET * tds, TDSRESULTINFO * resinfo); void tds_send_row(TDSSOCKET * tds, TDSRESULTINFO * resinfo); void tds71_send_prelogin(TDSSOCKET * tds); #if 0 { #endif #ifdef __cplusplus } #endif <|start_filename|>public/freetds-1.00.23/include/replacements/poll.h<|end_filename|> /** \file * \brief Provide poll call where missing */ #if !defined(_REPLACEMENTS_POLL_H) && !defined(HAVE_POLL) #define _REPLACEMENTS_POLL_H #include <config.h> #if HAVE_LIMITS_H #include <limits.h> #endif #if HAVE_SYS_SELECT_H #include <sys/select.h> #endif #if defined(_WIN32) #include <winsock2.h> #endif #if defined(__VMS) #include <time.h> /* FD_SETSIZE is in here */ #endif #if !defined(FD_SETSIZE) # if !defined(OPEN_MAX) # error cannot establish FD_SETSIZE # endif #define FD_SETSIZE OPEN_MAX #endif #include <freetds/pushvis.h> #ifndef _WIN32 /* poll flags */ # define POLLIN 0x0001 # define POLLOUT 0x0004 # define POLLERR 0x0008 /* synonyms */ # define POLLNORM POLLIN # define POLLPRI POLLIN # define POLLRDNORM POLLIN # define POLLRDBAND POLLIN # define POLLWRNORM POLLOUT # define POLLWRBAND POLLOUT /* ignored */ # define POLLHUP 0x0010 # define POLLNVAL 0x0020 typedef struct pollfd { int fd; /* file descriptor to poll */ short events; /* events of interest on fd */ short revents; /* events that occurred on fd */ } pollfd_t; #else /* Windows */ /* * Windows use different constants then Unix * Newer version have a WSAPoll which is equal to Unix poll */ # if !defined(POLLRDNORM) && !defined(POLLWRNORM) # define POLLIN 0x0300 # define POLLOUT 0x0010 # define POLLERR 0x0001 # define POLLRDNORM 0x0100 # define POLLWRNORM 0x0010 typedef struct pollfd { SOCKET fd; /* file descriptor to poll */ short events; /* events of interest on fd */ short revents; /* events that occurred on fd */ } pollfd_t; # else typedef struct pollfd pollfd_t; # endif #endif #undef poll int tds_poll(struct pollfd fds[], int nfds, int timeout); #define poll(fds, nfds, timeout) tds_poll(fds, nfds, timeout) #include <freetds/popvis.h> #endif <|start_filename|>public/freetds-1.00.23/include/freetds/time.h<|end_filename|> #if TIME_WITH_SYS_TIME # include <sys/time.h> # include <time.h> #else # if HAVE_SYS_TIME_H # include <sys/time.h> # else # include <time.h> # endif #endif <|start_filename|>public/freetds-1.00.23/include/freetds/pushvis.h<|end_filename|> #if defined(__GNUC__) && __GNUC__ >= 4 && !defined(__MINGW32__) #pragma GCC visibility push(hidden) #endif <|start_filename|>public/freetds-1.00.23/include/freetds/string.h<|end_filename|> /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 <NAME> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifndef _tdsstring_h_ #define _tdsstring_h_ #include <freetds/pushvis.h> /** \addtogroup dstring * @{ */ /** Internal representation for an empty string */ extern const struct tds_dstr tds_str_empty; /** Initializer, used to initialize string like in the following example * @code * DSTR s = DSTR_INITIALIZER; * @endcode */ #define DSTR_INITIALIZER ((struct tds_dstr*) &tds_str_empty) /** init a string with empty */ static inline void tds_dstr_init(DSTR * s) { *(s) = DSTR_INITIALIZER; } /** test if string is empty */ static inline int tds_dstr_isempty(DSTR * s) { return (*s)->dstr_size == 0; } /** * Returns a buffer to edit the string. * Be careful to avoid buffer overflows and remember to * set the correct length at the end of the editing if changed. */ static inline char * tds_dstr_buf(DSTR * s) { return (*s)->dstr_s; } /** Returns a C version (NUL terminated string) of dstr */ static inline const char * tds_dstr_cstr(DSTR * s) { return (*s)->dstr_s; } /** Returns the length of the string in bytes */ static inline size_t tds_dstr_len(DSTR * s) { return (*s)->dstr_size; } /** Make a string empty */ #define tds_dstr_empty(s) \ tds_dstr_free(s) void tds_dstr_zero(DSTR * s); void tds_dstr_free(DSTR * s); DSTR* tds_dstr_dup(DSTR * s, const DSTR * src) TDS_WUR; DSTR* tds_dstr_copy(DSTR * s, const char *src) TDS_WUR; DSTR* tds_dstr_copyn(DSTR * s, const char *src, size_t length) TDS_WUR; DSTR* tds_dstr_set(DSTR * s, char *src) TDS_WUR; DSTR* tds_dstr_setlen(DSTR *s, size_t length); DSTR* tds_dstr_alloc(DSTR *s, size_t length) TDS_WUR; /** @} */ #include <freetds/popvis.h> #endif /* _tdsstring_h_ */
thepriyakadam/hrms
<|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_AnimationEvent_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_AnimationEvent_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.AnimationEvent(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.AnimationEvent), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_stringParameter(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnimationEvent; var result = obj.stringParameter; Puerts.PuertsDLL.ReturnString(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_stringParameter(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnimationEvent; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.stringParameter = argHelper.GetString(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_floatParameter(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnimationEvent; var result = obj.floatParameter; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_floatParameter(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnimationEvent; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.floatParameter = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_intParameter(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnimationEvent; var result = obj.intParameter; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_intParameter(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnimationEvent; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.intParameter = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_objectReferenceParameter(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnimationEvent; var result = obj.objectReferenceParameter; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_objectReferenceParameter(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnimationEvent; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.objectReferenceParameter = argHelper.Get<UnityEngine.Object>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_functionName(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnimationEvent; var result = obj.functionName; Puerts.PuertsDLL.ReturnString(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_functionName(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnimationEvent; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.functionName = argHelper.GetString(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_time(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnimationEvent; var result = obj.time; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_time(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnimationEvent; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.time = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_messageOptions(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnimationEvent; var result = obj.messageOptions; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_messageOptions(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnimationEvent; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.messageOptions = (UnityEngine.SendMessageOptions)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_isFiredByLegacy(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnimationEvent; var result = obj.isFiredByLegacy; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_isFiredByAnimator(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnimationEvent; var result = obj.isFiredByAnimator; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_animationState(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnimationEvent; var result = obj.animationState; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_animatorStateInfo(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnimationEvent; var result = obj.animatorStateInfo; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_animatorClipInfo(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnimationEvent; var result = obj.animatorClipInfo; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"stringParameter", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_stringParameter, Setter = S_stringParameter} }, {"floatParameter", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_floatParameter, Setter = S_floatParameter} }, {"intParameter", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_intParameter, Setter = S_intParameter} }, {"objectReferenceParameter", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_objectReferenceParameter, Setter = S_objectReferenceParameter} }, {"functionName", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_functionName, Setter = S_functionName} }, {"time", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_time, Setter = S_time} }, {"messageOptions", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_messageOptions, Setter = S_messageOptions} }, {"isFiredByLegacy", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_isFiredByLegacy, Setter = null} }, {"isFiredByAnimator", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_isFiredByAnimator, Setter = null} }, {"animationState", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_animationState, Setter = null} }, {"animatorStateInfo", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_animatorStateInfo, Setter = null} }, {"animatorClipInfo", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_animatorClipInfo, Setter = null} }, } }; } } } <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/test/MultiRowType1.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.test { public sealed partial class MultiRowType1 : Bright.Config.BeanBase { public MultiRowType1(ByteBuf _buf) { Id = _buf.ReadInt(); X = _buf.ReadInt(); } public MultiRowType1(int id, int x ) { this.Id = id; this.X = x; } public static MultiRowType1 DeserializeMultiRowType1(ByteBuf _buf) { return new test.MultiRowType1(_buf); } public readonly int Id; public readonly int X; public const int ID = 540474970; public override int GetTypeId() => ID; public void Resolve(Dictionary<string, object> _tables) { OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); public override string ToString() { return "{ " + "Id:" + Id + "," + "X:" + X + "," + "}"; } } } <|start_filename|>Projects/GenerateDatas/convert_lua/role.TbRoleLevelExpAttr/37.lua<|end_filename|> return { level = 37, need_exp = 23000, clothes_attrs = { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, }, } <|start_filename|>Projects/DataTemplates/template_erlang2/test_tbtestglobal.erl<|end_filename|> %% test.TbTestGlobal -module(test_tbtestglobal) -export([get/1,get_ids/0]) get() -> #{ unlock_equip => 10, unlock_hero => 20 }; get_ids() -> []. <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_MatchTargetWeightMask_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_MatchTargetWeightMask_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = argHelper1.GetFloat(false); var result = new UnityEngine.MatchTargetWeightMask(Arg0,Arg1); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.MatchTargetWeightMask), result); } } if (paramLen == 0) { { var result = new UnityEngine.MatchTargetWeightMask(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.MatchTargetWeightMask), result); } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.MatchTargetWeightMask constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_positionXYZWeight(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.MatchTargetWeightMask)Puerts.Utils.GetSelf((int)data, self); var result = obj.positionXYZWeight; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_positionXYZWeight(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.MatchTargetWeightMask)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.positionXYZWeight = argHelper.Get<UnityEngine.Vector3>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_rotationWeight(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.MatchTargetWeightMask)Puerts.Utils.GetSelf((int)data, self); var result = obj.rotationWeight; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_rotationWeight(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.MatchTargetWeightMask)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.rotationWeight = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"positionXYZWeight", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_positionXYZWeight, Setter = S_positionXYZWeight} }, {"rotationWeight", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_rotationWeight, Setter = S_rotationWeight} }, } }; } } } <|start_filename|>Projects/DataTemplates/template_erlang2/test_tbtestexternaltype.erl<|end_filename|> %% test.TbTestExternalType -module(test_tbtestexternaltype) -export([get/1,get_ids/0]) get(1) -> #{ id => 1, audio_type => 1, color => bean }. get(2) -> #{ id => 2, audio_type => 2, color => bean }. get_ids() -> [1,2]. <|start_filename|>Projects/DataTemplates/template_lua/test_tbmultiunionindexlist.lua<|end_filename|> return {id1=1,id2=1,id3="ab1",num=1,desc="desc1",} <|start_filename|>Projects/DataTemplates/template_erlang/test_tbtestexternaltype.erl<|end_filename|> %% test.TbTestExternalType get(1) -> #{id => 1,audio_type => 1,color => #{r => 0.2,g => 0.2,b => 0.4,a => 1}}. get(2) -> #{id => 2,audio_type => 2,color => #{r => 0.2,g => 0.2,b => 0.4,a => 0.8}}. <|start_filename|>Projects/DataTemplates/template_lua2/test_tbcompositejsontable2.lua<|end_filename|> -- test.TbCompositeJsonTable2 return { [1] = { id=1, y=100, }, [3] = { id=3, y=300, }, } <|start_filename|>Projects/DataTemplates/template_lua2/role_tbrolelevelbonuscoefficient.lua<|end_filename|> -- role.TbRoleLevelBonusCoefficient return { [1001] = { id=1001, distinct_bonus_infos= { { effective_level=1, bonus_info= { { type=4, coefficient=1, }, { type=2, coefficient=1, }, }, }, { effective_level=10, bonus_info= { { type=4, coefficient=1.5, }, { type=2, coefficient=2, }, }, }, { effective_level=20, bonus_info= { { type=4, coefficient=2, }, { type=2, coefficient=3, }, }, }, { effective_level=30, bonus_info= { { type=4, coefficient=2.5, }, { type=2, coefficient=4, }, }, }, { effective_level=40, bonus_info= { { type=4, coefficient=3, }, { type=2, coefficient=5, }, }, }, { effective_level=50, bonus_info= { { type=4, coefficient=3.5, }, { type=2, coefficient=6, }, }, }, { effective_level=60, bonus_info= { { type=4, coefficient=4, }, { type=2, coefficient=7, }, }, }, }, }, } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_ResourcesAPI_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_ResourcesAPI_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.ResourcesAPI constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_overrideAPI(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.ResourcesAPI.overrideAPI; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_overrideAPI(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.ResourcesAPI.overrideAPI = argHelper.Get<UnityEngine.ResourcesAPI>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"overrideAPI", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_overrideAPI, Setter = S_overrideAPI} }, } }; } } } <|start_filename|>Projects/java_json/src/gen/cfg/ai/KeyQueryOperator.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.ai; import com.google.gson.JsonElement; import com.google.gson.JsonObject; public abstract class KeyQueryOperator { public KeyQueryOperator(JsonObject __json__) { } public KeyQueryOperator() { } public static KeyQueryOperator deserializeKeyQueryOperator(JsonObject __json__) { switch (__json__.get("__type__").getAsString()) { case "IsSet": return new cfg.ai.IsSet(__json__); case "IsNotSet": return new cfg.ai.IsNotSet(__json__); case "BinaryOperator": return new cfg.ai.BinaryOperator(__json__); default: throw new bright.serialization.SerializationException(); } } public abstract int getTypeId(); public void resolve(java.util.HashMap<String, Object> _tables) { } @Override public String toString() { return "{ " + "}"; } } <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/test/TestJson2.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.test { public sealed partial class TestJson2 : Bright.Config.BeanBase { public TestJson2(ByteBuf _buf) { Id = _buf.ReadInt(); {int n = System.Math.Min(_buf.ReadSize(), _buf.Size);M1 = new System.Collections.Generic.Dictionary<int, int>(n * 3 / 2);for(var i = 0 ; i < n ; i++) { int _k; _k = _buf.ReadInt(); int _v; _v = _buf.ReadInt(); M1.Add(_k, _v);}} {int n = System.Math.Min(_buf.ReadSize(), _buf.Size);M2 = new System.Collections.Generic.Dictionary<long, int>(n * 3 / 2);for(var i = 0 ; i < n ; i++) { long _k; _k = _buf.ReadLong(); int _v; _v = _buf.ReadInt(); M2.Add(_k, _v);}} {int n = System.Math.Min(_buf.ReadSize(), _buf.Size);M3 = new System.Collections.Generic.Dictionary<string, int>(n * 3 / 2);for(var i = 0 ; i < n ; i++) { string _k; _k = _buf.ReadString(); int _v; _v = _buf.ReadInt(); M3.Add(_k, _v);}} {int n = System.Math.Min(_buf.ReadSize(), _buf.Size);M4 = new System.Collections.Generic.Dictionary<string, test.DemoType1>(n * 3 / 2);for(var i = 0 ; i < n ; i++) { string _k; _k = _buf.ReadString(); test.DemoType1 _v; _v = test.DemoType1.DeserializeDemoType1(_buf); M4.Add(_k, _v);}} } public TestJson2(int id, System.Collections.Generic.Dictionary<int, int> m1, System.Collections.Generic.Dictionary<long, int> m2, System.Collections.Generic.Dictionary<string, int> m3, System.Collections.Generic.Dictionary<string, test.DemoType1> m4 ) { this.Id = id; this.M1 = m1; this.M2 = m2; this.M3 = m3; this.M4 = m4; } public static TestJson2 DeserializeTestJson2(ByteBuf _buf) { return new test.TestJson2(_buf); } public readonly int Id; public readonly System.Collections.Generic.Dictionary<int, int> M1; public readonly System.Collections.Generic.Dictionary<long, int> M2; public readonly System.Collections.Generic.Dictionary<string, int> M3; public readonly System.Collections.Generic.Dictionary<string, test.DemoType1> M4; public const int ID = 1942237276; public override int GetTypeId() => ID; public void Resolve(Dictionary<string, object> _tables) { foreach(var _e in M4.Values) { _e?.Resolve(_tables); } OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); public override string ToString() { return "{ " + "Id:" + Id + "," + "M1:" + Bright.Common.StringUtil.CollectionToString(M1) + "," + "M2:" + Bright.Common.StringUtil.CollectionToString(M2) + "," + "M3:" + Bright.Common.StringUtil.CollectionToString(M3) + "," + "M4:" + Bright.Common.StringUtil.CollectionToString(M4) + "," + "}"; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_ShaderVariantCollection_ShaderVariant_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_ShaderVariantCollection_ShaderVariant_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { if (paramLen >= 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Shader), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(string), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Shader>(false); var Arg1 = (UnityEngine.Rendering.PassType)argHelper1.GetInt32(false); var Arg2 = argHelper2.GetParams<string>(info, 2, paramLen); var result = new UnityEngine.ShaderVariantCollection.ShaderVariant(Arg0,Arg1,Arg2); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.ShaderVariantCollection.ShaderVariant), result); } } if (paramLen == 0) { { var result = new UnityEngine.ShaderVariantCollection.ShaderVariant(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.ShaderVariantCollection.ShaderVariant), result); } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.ShaderVariantCollection.ShaderVariant constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_shader(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ShaderVariantCollection.ShaderVariant)Puerts.Utils.GetSelf((int)data, self); var result = obj.shader; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_shader(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ShaderVariantCollection.ShaderVariant)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.shader = argHelper.Get<UnityEngine.Shader>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_passType(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ShaderVariantCollection.ShaderVariant)Puerts.Utils.GetSelf((int)data, self); var result = obj.passType; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_passType(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ShaderVariantCollection.ShaderVariant)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.passType = (UnityEngine.Rendering.PassType)argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_keywords(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ShaderVariantCollection.ShaderVariant)Puerts.Utils.GetSelf((int)data, self); var result = obj.keywords; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_keywords(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ShaderVariantCollection.ShaderVariant)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.keywords = argHelper.Get<string[]>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"shader", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_shader, Setter = S_shader} }, {"passType", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_passType, Setter = S_passType} }, {"keywords", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_keywords, Setter = S_keywords} }, } }; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/Bright_Serialization_ByteBuf_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class Bright_Serialization_ByteBuf_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { if (paramLen == 0) { { var result = new Bright.Serialization.ByteBuf(); return Puerts.Utils.GetObjectPtr((int)data, typeof(Bright.Serialization.ByteBuf), result); } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var result = new Bright.Serialization.ByteBuf(Arg0); return Puerts.Utils.GetObjectPtr((int)data, typeof(Bright.Serialization.ByteBuf), result); } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(byte[]), false, false)) { var Arg0 = argHelper0.Get<byte[]>(false); var result = new Bright.Serialization.ByteBuf(Arg0); return Puerts.Utils.GetObjectPtr((int)data, typeof(Bright.Serialization.ByteBuf), result); } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(byte[]), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<byte[]>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var result = new Bright.Serialization.ByteBuf(Arg0,Arg1,Arg2); return Puerts.Utils.GetObjectPtr((int)data, typeof(Bright.Serialization.ByteBuf), result); } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject | Puerts.JsValueType.Function, typeof(System.Action<Bright.Serialization.ByteBuf>), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<System.Action<Bright.Serialization.ByteBuf>>(false); var result = new Bright.Serialization.ByteBuf(Arg0,Arg1); return Puerts.Utils.GetObjectPtr((int)data, typeof(Bright.Serialization.ByteBuf), result); } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to Bright.Serialization.ByteBuf constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_Wrap(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<byte[]>(false); var result = Bright.Serialization.ByteBuf.Wrap(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Replace(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as Bright.Serialization.ByteBuf; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(byte[]), false, false)) { var Arg0 = argHelper0.Get<byte[]>(false); obj.Replace(Arg0); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(byte[]), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<byte[]>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); obj.Replace(Arg0,Arg1,Arg2); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to Replace"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_AddWriteIndex(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as Bright.Serialization.ByteBuf; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); obj.AddWriteIndex(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_AddReadIndex(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as Bright.Serialization.ByteBuf; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); obj.AddReadIndex(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_CopyData(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as Bright.Serialization.ByteBuf; { { var result = obj.CopyData(); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_DiscardReadBytes(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as Bright.Serialization.ByteBuf; { { obj.DiscardReadBytes(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_WriteBytesWithoutSize(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as Bright.Serialization.ByteBuf; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(byte[]), false, false)) { var Arg0 = argHelper0.Get<byte[]>(false); obj.WriteBytesWithoutSize(Arg0); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(byte[]), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<byte[]>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); obj.WriteBytesWithoutSize(Arg0,Arg1,Arg2); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to WriteBytesWithoutSize"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Clear(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as Bright.Serialization.ByteBuf; { { obj.Clear(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_EnsureWrite(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as Bright.Serialization.ByteBuf; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); obj.EnsureWrite(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Append(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as Bright.Serialization.ByteBuf; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetByte(false); obj.Append(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_WriteBool(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as Bright.Serialization.ByteBuf; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetBoolean(false); obj.WriteBool(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ReadBool(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as Bright.Serialization.ByteBuf; { { var result = obj.ReadBool(); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_WriteByte(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as Bright.Serialization.ByteBuf; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetByte(false); obj.WriteByte(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ReadByte(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as Bright.Serialization.ByteBuf; { { var result = obj.ReadByte(); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_WriteShort(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as Bright.Serialization.ByteBuf; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt16(false); obj.WriteShort(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ReadShort(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as Bright.Serialization.ByteBuf; { { var result = obj.ReadShort(); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ReadFshort(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as Bright.Serialization.ByteBuf; { { var result = obj.ReadFshort(); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_WriteFshort(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as Bright.Serialization.ByteBuf; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt16(false); obj.WriteFshort(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_WriteInt(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as Bright.Serialization.ByteBuf; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); obj.WriteInt(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ReadInt(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as Bright.Serialization.ByteBuf; { { var result = obj.ReadInt(); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_WriteUint(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as Bright.Serialization.ByteBuf; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetUInt32(false); obj.WriteUint(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ReadUint(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as Bright.Serialization.ByteBuf; { { var result = obj.ReadUint(); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_WriteUint_Unsafe(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as Bright.Serialization.ByteBuf; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetUInt32(false); obj.WriteUint_Unsafe(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ReadUint_Unsafe(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as Bright.Serialization.ByteBuf; { { var result = obj.ReadUint_Unsafe(); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ReadFint(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as Bright.Serialization.ByteBuf; { { var result = obj.ReadFint(); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_WriteFint(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as Bright.Serialization.ByteBuf; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); obj.WriteFint(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ReadFint_Safe(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as Bright.Serialization.ByteBuf; { { var result = obj.ReadFint_Safe(); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_WriteFint_Safe(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as Bright.Serialization.ByteBuf; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); obj.WriteFint_Safe(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_WriteLong(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as Bright.Serialization.ByteBuf; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt64(false); obj.WriteLong(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ReadLong(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as Bright.Serialization.ByteBuf; { { var result = obj.ReadLong(); Puerts.PuertsDLL.ReturnBigInt(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ReadUlong(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as Bright.Serialization.ByteBuf; { { var result = obj.ReadUlong(); Puerts.PuertsDLL.ReturnBigInt(isolate, info, (long)result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_WriteFlong(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as Bright.Serialization.ByteBuf; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt64(false); obj.WriteFlong(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ReadFlong(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as Bright.Serialization.ByteBuf; { { var result = obj.ReadFlong(); Puerts.PuertsDLL.ReturnBigInt(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_WriteFloat(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as Bright.Serialization.ByteBuf; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetFloat(false); obj.WriteFloat(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ReadFloat(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as Bright.Serialization.ByteBuf; { { var result = obj.ReadFloat(); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_WriteDouble(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as Bright.Serialization.ByteBuf; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetDouble(false); obj.WriteDouble(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ReadDouble(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as Bright.Serialization.ByteBuf; { { var result = obj.ReadDouble(); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_WriteSize(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as Bright.Serialization.ByteBuf; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); obj.WriteSize(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ReadSize(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as Bright.Serialization.ByteBuf; { { var result = obj.ReadSize(); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_WriteSint(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as Bright.Serialization.ByteBuf; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); obj.WriteSint(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ReadSint(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as Bright.Serialization.ByteBuf; { { var result = obj.ReadSint(); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_WriteSlong(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as Bright.Serialization.ByteBuf; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt64(false); obj.WriteSlong(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ReadSlong(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as Bright.Serialization.ByteBuf; { { var result = obj.ReadSlong(); Puerts.PuertsDLL.ReturnBigInt(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_WriteString(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as Bright.Serialization.ByteBuf; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetString(false); obj.WriteString(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ReadString(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as Bright.Serialization.ByteBuf; { { var result = obj.ReadString(); Puerts.PuertsDLL.ReturnString(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_WriteBytes(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as Bright.Serialization.ByteBuf; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<byte[]>(false); obj.WriteBytes(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ReadBytes(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as Bright.Serialization.ByteBuf; { { var result = obj.ReadBytes(); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_WriteComplex(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as Bright.Serialization.ByteBuf; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.Numerics.Complex>(false); obj.WriteComplex(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ReadComplex(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as Bright.Serialization.ByteBuf; { { var result = obj.ReadComplex(); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_WriteVector2(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as Bright.Serialization.ByteBuf; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.Numerics.Vector2>(false); obj.WriteVector2(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ReadVector2(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as Bright.Serialization.ByteBuf; { { var result = obj.ReadVector2(); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_WriteVector3(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as Bright.Serialization.ByteBuf; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.Numerics.Vector3>(false); obj.WriteVector3(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ReadVector3(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as Bright.Serialization.ByteBuf; { { var result = obj.ReadVector3(); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_WriteVector4(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as Bright.Serialization.ByteBuf; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.Numerics.Vector4>(false); obj.WriteVector4(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ReadVector4(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as Bright.Serialization.ByteBuf; { { var result = obj.ReadVector4(); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_WriteQuaternion(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as Bright.Serialization.ByteBuf; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.Numerics.Quaternion>(false); obj.WriteQuaternion(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ReadQuaternion(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as Bright.Serialization.ByteBuf; { { var result = obj.ReadQuaternion(); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_WriteMatrix4x4(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as Bright.Serialization.ByteBuf; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.Numerics.Matrix4x4>(false); obj.WriteMatrix4x4(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ReadMatrix4x4(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as Bright.Serialization.ByteBuf; { { var result = obj.ReadMatrix4x4(); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_WriteByteBufWithSize(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as Bright.Serialization.ByteBuf; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<Bright.Serialization.ByteBuf>(false); obj.WriteByteBufWithSize(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_WriteByteBufWithoutSize(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as Bright.Serialization.ByteBuf; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<Bright.Serialization.ByteBuf>(false); obj.WriteByteBufWithoutSize(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_TryReadByte(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as Bright.Serialization.ByteBuf; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetByte(true); var result = obj.TryReadByte(out Arg0); argHelper0.SetByRefValue(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_TryDeserializeInplaceByteBuf(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as Bright.Serialization.ByteBuf; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<Bright.Serialization.ByteBuf>(false); var result = obj.TryDeserializeInplaceByteBuf(Arg0,Arg1); Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_WriteRawTag(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as Bright.Serialization.ByteBuf; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetByte(false); obj.WriteRawTag(Arg0); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetByte(false); var Arg1 = argHelper1.GetByte(false); obj.WriteRawTag(Arg0,Arg1); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetByte(false); var Arg1 = argHelper1.GetByte(false); var Arg2 = argHelper2.GetByte(false); obj.WriteRawTag(Arg0,Arg1,Arg2); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to WriteRawTag"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_BeginWriteSegment(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as Bright.Serialization.ByteBuf; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(true); obj.BeginWriteSegment(out Arg0); argHelper0.SetByRefValue(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_EndWriteSegment(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as Bright.Serialization.ByteBuf; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); obj.EndWriteSegment(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ReadSegment(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as Bright.Serialization.ByteBuf; if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, true, true) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, true, true)) { var Arg0 = argHelper0.GetInt32(true); var Arg1 = argHelper1.GetInt32(true); obj.ReadSegment(out Arg0,out Arg1); argHelper0.SetByRefValue(Arg0); argHelper1.SetByRefValue(Arg1); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(Bright.Serialization.ByteBuf), false, false)) { var Arg0 = argHelper0.Get<Bright.Serialization.ByteBuf>(false); obj.ReadSegment(Arg0); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to ReadSegment"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_EnterSegment(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as Bright.Serialization.ByteBuf; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<Bright.Serialization.SegmentSaveState>(true); obj.EnterSegment(out Arg0); argHelper0.SetByRefValue(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_LeaveSegment(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as Bright.Serialization.ByteBuf; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<Bright.Serialization.SegmentSaveState>(false); obj.LeaveSegment(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ToString(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as Bright.Serialization.ByteBuf; { { var result = obj.ToString(); Puerts.PuertsDLL.ReturnString(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Equals(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as Bright.Serialization.ByteBuf; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.Any, typeof(System.Object), false, false)) { var Arg0 = argHelper0.Get<System.Object>(false); var result = obj.Equals(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(Bright.Serialization.ByteBuf), false, false)) { var Arg0 = argHelper0.Get<Bright.Serialization.ByteBuf>(false); var result = obj.Equals(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to Equals"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Clone(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as Bright.Serialization.ByteBuf; { { var result = obj.Clone(); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_FromString(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetString(false); var result = Bright.Serialization.ByteBuf.FromString(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetHashCode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as Bright.Serialization.ByteBuf; { { var result = obj.GetHashCode(); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Release(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as Bright.Serialization.ByteBuf; { { obj.Release(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ReadArrayBuffer(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as Bright.Serialization.ByteBuf; { { var result = obj.ReadArrayBuffer(); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_WriteArrayBuffer(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as Bright.Serialization.ByteBuf; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<Puerts.ArrayBuffer>(false); obj.WriteArrayBuffer(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_ReaderIndex(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as Bright.Serialization.ByteBuf; var result = obj.ReaderIndex; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_ReaderIndex(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as Bright.Serialization.ByteBuf; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.ReaderIndex = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_WriterIndex(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as Bright.Serialization.ByteBuf; var result = obj.WriterIndex; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_WriterIndex(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as Bright.Serialization.ByteBuf; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.WriterIndex = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_Capacity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as Bright.Serialization.ByteBuf; var result = obj.Capacity; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_Size(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as Bright.Serialization.ByteBuf; var result = obj.Size; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_Empty(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as Bright.Serialization.ByteBuf; var result = obj.Empty; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_NotEmpty(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as Bright.Serialization.ByteBuf; var result = obj.NotEmpty; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_Bytes(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as Bright.Serialization.ByteBuf; var result = obj.Bytes; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_Remaining(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as Bright.Serialization.ByteBuf; var result = obj.Remaining; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_NotCompactWritable(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as Bright.Serialization.ByteBuf; var result = obj.NotCompactWritable; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_StringCacheFinder(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = Bright.Serialization.ByteBuf.StringCacheFinder; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_StringCacheFinder(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); Bright.Serialization.ByteBuf.StringCacheFinder = argHelper.Get<System.Func<byte[], int, int, string>>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "Wrap", IsStatic = true}, F_Wrap }, { new Puerts.MethodKey {Name = "Replace", IsStatic = false}, M_Replace }, { new Puerts.MethodKey {Name = "AddWriteIndex", IsStatic = false}, M_AddWriteIndex }, { new Puerts.MethodKey {Name = "AddReadIndex", IsStatic = false}, M_AddReadIndex }, { new Puerts.MethodKey {Name = "CopyData", IsStatic = false}, M_CopyData }, { new Puerts.MethodKey {Name = "DiscardReadBytes", IsStatic = false}, M_DiscardReadBytes }, { new Puerts.MethodKey {Name = "WriteBytesWithoutSize", IsStatic = false}, M_WriteBytesWithoutSize }, { new Puerts.MethodKey {Name = "Clear", IsStatic = false}, M_Clear }, { new Puerts.MethodKey {Name = "EnsureWrite", IsStatic = false}, M_EnsureWrite }, { new Puerts.MethodKey {Name = "Append", IsStatic = false}, M_Append }, { new Puerts.MethodKey {Name = "WriteBool", IsStatic = false}, M_WriteBool }, { new Puerts.MethodKey {Name = "ReadBool", IsStatic = false}, M_ReadBool }, { new Puerts.MethodKey {Name = "WriteByte", IsStatic = false}, M_WriteByte }, { new Puerts.MethodKey {Name = "ReadByte", IsStatic = false}, M_ReadByte }, { new Puerts.MethodKey {Name = "WriteShort", IsStatic = false}, M_WriteShort }, { new Puerts.MethodKey {Name = "ReadShort", IsStatic = false}, M_ReadShort }, { new Puerts.MethodKey {Name = "ReadFshort", IsStatic = false}, M_ReadFshort }, { new Puerts.MethodKey {Name = "WriteFshort", IsStatic = false}, M_WriteFshort }, { new Puerts.MethodKey {Name = "WriteInt", IsStatic = false}, M_WriteInt }, { new Puerts.MethodKey {Name = "ReadInt", IsStatic = false}, M_ReadInt }, { new Puerts.MethodKey {Name = "WriteUint", IsStatic = false}, M_WriteUint }, { new Puerts.MethodKey {Name = "ReadUint", IsStatic = false}, M_ReadUint }, { new Puerts.MethodKey {Name = "WriteUint_Unsafe", IsStatic = false}, M_WriteUint_Unsafe }, { new Puerts.MethodKey {Name = "ReadUint_Unsafe", IsStatic = false}, M_ReadUint_Unsafe }, { new Puerts.MethodKey {Name = "ReadFint", IsStatic = false}, M_ReadFint }, { new Puerts.MethodKey {Name = "WriteFint", IsStatic = false}, M_WriteFint }, { new Puerts.MethodKey {Name = "ReadFint_Safe", IsStatic = false}, M_ReadFint_Safe }, { new Puerts.MethodKey {Name = "WriteFint_Safe", IsStatic = false}, M_WriteFint_Safe }, { new Puerts.MethodKey {Name = "WriteLong", IsStatic = false}, M_WriteLong }, { new Puerts.MethodKey {Name = "ReadLong", IsStatic = false}, M_ReadLong }, { new Puerts.MethodKey {Name = "ReadUlong", IsStatic = false}, M_ReadUlong }, { new Puerts.MethodKey {Name = "WriteFlong", IsStatic = false}, M_WriteFlong }, { new Puerts.MethodKey {Name = "ReadFlong", IsStatic = false}, M_ReadFlong }, { new Puerts.MethodKey {Name = "WriteFloat", IsStatic = false}, M_WriteFloat }, { new Puerts.MethodKey {Name = "ReadFloat", IsStatic = false}, M_ReadFloat }, { new Puerts.MethodKey {Name = "WriteDouble", IsStatic = false}, M_WriteDouble }, { new Puerts.MethodKey {Name = "ReadDouble", IsStatic = false}, M_ReadDouble }, { new Puerts.MethodKey {Name = "WriteSize", IsStatic = false}, M_WriteSize }, { new Puerts.MethodKey {Name = "ReadSize", IsStatic = false}, M_ReadSize }, { new Puerts.MethodKey {Name = "WriteSint", IsStatic = false}, M_WriteSint }, { new Puerts.MethodKey {Name = "ReadSint", IsStatic = false}, M_ReadSint }, { new Puerts.MethodKey {Name = "WriteSlong", IsStatic = false}, M_WriteSlong }, { new Puerts.MethodKey {Name = "ReadSlong", IsStatic = false}, M_ReadSlong }, { new Puerts.MethodKey {Name = "WriteString", IsStatic = false}, M_WriteString }, { new Puerts.MethodKey {Name = "ReadString", IsStatic = false}, M_ReadString }, { new Puerts.MethodKey {Name = "WriteBytes", IsStatic = false}, M_WriteBytes }, { new Puerts.MethodKey {Name = "ReadBytes", IsStatic = false}, M_ReadBytes }, { new Puerts.MethodKey {Name = "WriteComplex", IsStatic = false}, M_WriteComplex }, { new Puerts.MethodKey {Name = "ReadComplex", IsStatic = false}, M_ReadComplex }, { new Puerts.MethodKey {Name = "WriteVector2", IsStatic = false}, M_WriteVector2 }, { new Puerts.MethodKey {Name = "ReadVector2", IsStatic = false}, M_ReadVector2 }, { new Puerts.MethodKey {Name = "WriteVector3", IsStatic = false}, M_WriteVector3 }, { new Puerts.MethodKey {Name = "ReadVector3", IsStatic = false}, M_ReadVector3 }, { new Puerts.MethodKey {Name = "WriteVector4", IsStatic = false}, M_WriteVector4 }, { new Puerts.MethodKey {Name = "ReadVector4", IsStatic = false}, M_ReadVector4 }, { new Puerts.MethodKey {Name = "WriteQuaternion", IsStatic = false}, M_WriteQuaternion }, { new Puerts.MethodKey {Name = "ReadQuaternion", IsStatic = false}, M_ReadQuaternion }, { new Puerts.MethodKey {Name = "WriteMatrix4x4", IsStatic = false}, M_WriteMatrix4x4 }, { new Puerts.MethodKey {Name = "ReadMatrix4x4", IsStatic = false}, M_ReadMatrix4x4 }, { new Puerts.MethodKey {Name = "WriteByteBufWithSize", IsStatic = false}, M_WriteByteBufWithSize }, { new Puerts.MethodKey {Name = "WriteByteBufWithoutSize", IsStatic = false}, M_WriteByteBufWithoutSize }, { new Puerts.MethodKey {Name = "TryReadByte", IsStatic = false}, M_TryReadByte }, { new Puerts.MethodKey {Name = "TryDeserializeInplaceByteBuf", IsStatic = false}, M_TryDeserializeInplaceByteBuf }, { new Puerts.MethodKey {Name = "WriteRawTag", IsStatic = false}, M_WriteRawTag }, { new Puerts.MethodKey {Name = "BeginWriteSegment", IsStatic = false}, M_BeginWriteSegment }, { new Puerts.MethodKey {Name = "EndWriteSegment", IsStatic = false}, M_EndWriteSegment }, { new Puerts.MethodKey {Name = "ReadSegment", IsStatic = false}, M_ReadSegment }, { new Puerts.MethodKey {Name = "EnterSegment", IsStatic = false}, M_EnterSegment }, { new Puerts.MethodKey {Name = "LeaveSegment", IsStatic = false}, M_LeaveSegment }, { new Puerts.MethodKey {Name = "ToString", IsStatic = false}, M_ToString }, { new Puerts.MethodKey {Name = "Equals", IsStatic = false}, M_Equals }, { new Puerts.MethodKey {Name = "Clone", IsStatic = false}, M_Clone }, { new Puerts.MethodKey {Name = "FromString", IsStatic = true}, F_FromString }, { new Puerts.MethodKey {Name = "GetHashCode", IsStatic = false}, M_GetHashCode }, { new Puerts.MethodKey {Name = "Release", IsStatic = false}, M_Release }, { new Puerts.MethodKey {Name = "ReadArrayBuffer", IsStatic = false}, M_ReadArrayBuffer }, { new Puerts.MethodKey {Name = "WriteArrayBuffer", IsStatic = false}, M_WriteArrayBuffer }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"ReaderIndex", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_ReaderIndex, Setter = S_ReaderIndex} }, {"WriterIndex", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_WriterIndex, Setter = S_WriterIndex} }, {"Capacity", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_Capacity, Setter = null} }, {"Size", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_Size, Setter = null} }, {"Empty", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_Empty, Setter = null} }, {"NotEmpty", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_NotEmpty, Setter = null} }, {"Bytes", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_Bytes, Setter = null} }, {"Remaining", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_Remaining, Setter = null} }, {"NotCompactWritable", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_NotCompactWritable, Setter = null} }, {"StringCacheFinder", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_StringCacheFinder, Setter = S_StringCacheFinder} }, } }; } } } <|start_filename|>Projects/GenerateDatas/convert_lua/role.TbRoleLevelExpAttr/54.lua<|end_filename|> return { level = 54, need_exp = 95000, clothes_attrs = { 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, }, } <|start_filename|>Projects/GenerateDatas/convert_lua/role.TbRoleLevelExpAttr/99.lua<|end_filename|> return { level = 99, need_exp = 320000, clothes_attrs = { 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, }, } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_Graphics_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_Graphics_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.Graphics(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.Graphics), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_ClearRandomWriteTargets(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { { UnityEngine.Graphics.ClearRandomWriteTargets(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_ExecuteCommandBuffer(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Rendering.CommandBuffer>(false); UnityEngine.Graphics.ExecuteCommandBuffer(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_ExecuteCommandBufferAsync(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<UnityEngine.Rendering.CommandBuffer>(false); var Arg1 = (UnityEngine.Rendering.ComputeQueueType)argHelper1.GetInt32(false); UnityEngine.Graphics.ExecuteCommandBufferAsync(Arg0,Arg1); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_SetRenderTarget(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RenderTexture), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.RenderTexture>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = (UnityEngine.CubemapFace)argHelper2.GetInt32(false); var Arg3 = argHelper3.GetInt32(false); UnityEngine.Graphics.SetRenderTarget(Arg0,Arg1,Arg2,Arg3); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.RenderBuffer), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.RenderBuffer), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.RenderBuffer>(false); var Arg1 = argHelper1.Get<UnityEngine.RenderBuffer>(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = (UnityEngine.CubemapFace)argHelper3.GetInt32(false); UnityEngine.Graphics.SetRenderTarget(Arg0,Arg1,Arg2,Arg3); return; } } if (paramLen == 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.RenderBuffer), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.RenderBuffer), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.RenderBuffer>(false); var Arg1 = argHelper1.Get<UnityEngine.RenderBuffer>(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = (UnityEngine.CubemapFace)argHelper3.GetInt32(false); var Arg4 = argHelper4.GetInt32(false); UnityEngine.Graphics.SetRenderTarget(Arg0,Arg1,Arg2,Arg3,Arg4); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RenderBuffer[]), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.RenderBuffer), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.RenderBuffer[]>(false); var Arg1 = argHelper1.Get<UnityEngine.RenderBuffer>(false); UnityEngine.Graphics.SetRenderTarget(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RenderTexture), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.RenderTexture>(false); var Arg1 = argHelper1.GetInt32(false); UnityEngine.Graphics.SetRenderTarget(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.RenderBuffer), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.RenderBuffer), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.RenderBuffer>(false); var Arg1 = argHelper1.Get<UnityEngine.RenderBuffer>(false); UnityEngine.Graphics.SetRenderTarget(Arg0,Arg1); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.RenderTargetSetup), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.RenderTargetSetup>(false); UnityEngine.Graphics.SetRenderTarget(Arg0); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RenderTexture), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.RenderTexture>(false); UnityEngine.Graphics.SetRenderTarget(Arg0); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RenderTexture), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.RenderTexture>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = (UnityEngine.CubemapFace)argHelper2.GetInt32(false); UnityEngine.Graphics.SetRenderTarget(Arg0,Arg1,Arg2); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.RenderBuffer), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.RenderBuffer), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.RenderBuffer>(false); var Arg1 = argHelper1.Get<UnityEngine.RenderBuffer>(false); var Arg2 = argHelper2.GetInt32(false); UnityEngine.Graphics.SetRenderTarget(Arg0,Arg1,Arg2); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SetRenderTarget"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_SetRandomWriteTarget(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RenderTexture), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.RenderTexture>(false); UnityEngine.Graphics.SetRandomWriteTarget(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.ComputeBuffer), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.ComputeBuffer>(false); UnityEngine.Graphics.SetRandomWriteTarget(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GraphicsBuffer), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.GraphicsBuffer>(false); UnityEngine.Graphics.SetRandomWriteTarget(Arg0,Arg1); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.ComputeBuffer), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.ComputeBuffer>(false); var Arg2 = argHelper2.GetBoolean(false); UnityEngine.Graphics.SetRandomWriteTarget(Arg0,Arg1,Arg2); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GraphicsBuffer), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.GraphicsBuffer>(false); var Arg2 = argHelper2.GetBoolean(false); UnityEngine.Graphics.SetRandomWriteTarget(Arg0,Arg1,Arg2); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SetRandomWriteTarget"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_CopyTexture(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Texture>(false); var Arg1 = argHelper1.Get<UnityEngine.Texture>(false); UnityEngine.Graphics.CopyTexture(Arg0,Arg1); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Texture>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.Get<UnityEngine.Texture>(false); var Arg3 = argHelper3.GetInt32(false); UnityEngine.Graphics.CopyTexture(Arg0,Arg1,Arg2,Arg3); return; } } if (paramLen == 6) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture), false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Texture>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.Get<UnityEngine.Texture>(false); var Arg4 = argHelper4.GetInt32(false); var Arg5 = argHelper5.GetInt32(false); UnityEngine.Graphics.CopyTexture(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); return; } } if (paramLen == 12) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); var argHelper7 = new Puerts.ArgumentHelper((int)data, isolate, info, 7); var argHelper8 = new Puerts.ArgumentHelper((int)data, isolate, info, 8); var argHelper9 = new Puerts.ArgumentHelper((int)data, isolate, info, 9); var argHelper10 = new Puerts.ArgumentHelper((int)data, isolate, info, 10); var argHelper11 = new Puerts.ArgumentHelper((int)data, isolate, info, 11); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper7.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture), false, false) && argHelper8.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper9.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper10.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper11.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Texture>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetInt32(false); var Arg4 = argHelper4.GetInt32(false); var Arg5 = argHelper5.GetInt32(false); var Arg6 = argHelper6.GetInt32(false); var Arg7 = argHelper7.Get<UnityEngine.Texture>(false); var Arg8 = argHelper8.GetInt32(false); var Arg9 = argHelper9.GetInt32(false); var Arg10 = argHelper10.GetInt32(false); var Arg11 = argHelper11.GetInt32(false); UnityEngine.Graphics.CopyTexture(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7,Arg8,Arg9,Arg10,Arg11); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to CopyTexture"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_ConvertTexture(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Texture>(false); var Arg1 = argHelper1.Get<UnityEngine.Texture>(false); var result = UnityEngine.Graphics.ConvertTexture(Arg0,Arg1); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Texture>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.Get<UnityEngine.Texture>(false); var Arg3 = argHelper3.GetInt32(false); var result = UnityEngine.Graphics.ConvertTexture(Arg0,Arg1,Arg2,Arg3); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to ConvertTexture"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_CreateAsyncGraphicsFence(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = (UnityEngine.Rendering.SynchronisationStage)argHelper0.GetInt32(false); var result = UnityEngine.Graphics.CreateAsyncGraphicsFence(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 0) { { var result = UnityEngine.Graphics.CreateAsyncGraphicsFence(); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to CreateAsyncGraphicsFence"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_CreateGraphicsFence(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = (UnityEngine.Rendering.GraphicsFenceType)argHelper0.GetInt32(false); var Arg1 = (UnityEngine.Rendering.SynchronisationStageFlags)argHelper1.GetInt32(false); var result = UnityEngine.Graphics.CreateGraphicsFence(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_WaitOnAsyncGraphicsFence(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rendering.GraphicsFence), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rendering.GraphicsFence>(false); UnityEngine.Graphics.WaitOnAsyncGraphicsFence(Arg0); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rendering.GraphicsFence), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rendering.GraphicsFence>(false); var Arg1 = (UnityEngine.Rendering.SynchronisationStage)argHelper1.GetInt32(false); UnityEngine.Graphics.WaitOnAsyncGraphicsFence(Arg0,Arg1); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to WaitOnAsyncGraphicsFence"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_DrawTexture(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 10) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); var argHelper7 = new Puerts.ArgumentHelper((int)data, isolate, info, 7); var argHelper8 = new Puerts.ArgumentHelper((int)data, isolate, info, 8); var argHelper9 = new Puerts.ArgumentHelper((int)data, isolate, info, 9); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper7.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Color), false, false) && argHelper8.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper9.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.Get<UnityEngine.Texture>(false); var Arg2 = argHelper2.Get<UnityEngine.Rect>(false); var Arg3 = argHelper3.GetInt32(false); var Arg4 = argHelper4.GetInt32(false); var Arg5 = argHelper5.GetInt32(false); var Arg6 = argHelper6.GetInt32(false); var Arg7 = argHelper7.Get<UnityEngine.Color>(false); var Arg8 = argHelper8.Get<UnityEngine.Material>(false); var Arg9 = argHelper9.GetInt32(false); UnityEngine.Graphics.DrawTexture(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7,Arg8,Arg9); return; } } if (paramLen == 9) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); var argHelper7 = new Puerts.ArgumentHelper((int)data, isolate, info, 7); var argHelper8 = new Puerts.ArgumentHelper((int)data, isolate, info, 8); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper7.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper8.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.Get<UnityEngine.Texture>(false); var Arg2 = argHelper2.Get<UnityEngine.Rect>(false); var Arg3 = argHelper3.GetInt32(false); var Arg4 = argHelper4.GetInt32(false); var Arg5 = argHelper5.GetInt32(false); var Arg6 = argHelper6.GetInt32(false); var Arg7 = argHelper7.Get<UnityEngine.Material>(false); var Arg8 = argHelper8.GetInt32(false); UnityEngine.Graphics.DrawTexture(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7,Arg8); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper7.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Color), false, false) && argHelper8.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.Get<UnityEngine.Texture>(false); var Arg2 = argHelper2.Get<UnityEngine.Rect>(false); var Arg3 = argHelper3.GetInt32(false); var Arg4 = argHelper4.GetInt32(false); var Arg5 = argHelper5.GetInt32(false); var Arg6 = argHelper6.GetInt32(false); var Arg7 = argHelper7.Get<UnityEngine.Color>(false); var Arg8 = argHelper8.Get<UnityEngine.Material>(false); UnityEngine.Graphics.DrawTexture(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7,Arg8); return; } } if (paramLen == 8) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); var argHelper7 = new Puerts.ArgumentHelper((int)data, isolate, info, 7); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper7.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.Get<UnityEngine.Texture>(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetInt32(false); var Arg4 = argHelper4.GetInt32(false); var Arg5 = argHelper5.GetInt32(false); var Arg6 = argHelper6.Get<UnityEngine.Material>(false); var Arg7 = argHelper7.GetInt32(false); UnityEngine.Graphics.DrawTexture(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper7.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Color), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.Get<UnityEngine.Texture>(false); var Arg2 = argHelper2.Get<UnityEngine.Rect>(false); var Arg3 = argHelper3.GetInt32(false); var Arg4 = argHelper4.GetInt32(false); var Arg5 = argHelper5.GetInt32(false); var Arg6 = argHelper6.GetInt32(false); var Arg7 = argHelper7.Get<UnityEngine.Color>(false); UnityEngine.Graphics.DrawTexture(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper7.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.Get<UnityEngine.Texture>(false); var Arg2 = argHelper2.Get<UnityEngine.Rect>(false); var Arg3 = argHelper3.GetInt32(false); var Arg4 = argHelper4.GetInt32(false); var Arg5 = argHelper5.GetInt32(false); var Arg6 = argHelper6.GetInt32(false); var Arg7 = argHelper7.Get<UnityEngine.Material>(false); UnityEngine.Graphics.DrawTexture(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.Get<UnityEngine.Texture>(false); var Arg2 = argHelper2.Get<UnityEngine.Material>(false); var Arg3 = argHelper3.GetInt32(false); UnityEngine.Graphics.DrawTexture(Arg0,Arg1,Arg2,Arg3); return; } } if (paramLen == 7) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.Get<UnityEngine.Texture>(false); var Arg2 = argHelper2.Get<UnityEngine.Rect>(false); var Arg3 = argHelper3.GetInt32(false); var Arg4 = argHelper4.GetInt32(false); var Arg5 = argHelper5.GetInt32(false); var Arg6 = argHelper6.GetInt32(false); UnityEngine.Graphics.DrawTexture(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.Get<UnityEngine.Texture>(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetInt32(false); var Arg4 = argHelper4.GetInt32(false); var Arg5 = argHelper5.GetInt32(false); var Arg6 = argHelper6.Get<UnityEngine.Material>(false); UnityEngine.Graphics.DrawTexture(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6); return; } } if (paramLen == 6) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.Get<UnityEngine.Texture>(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetInt32(false); var Arg4 = argHelper4.GetInt32(false); var Arg5 = argHelper5.GetInt32(false); UnityEngine.Graphics.DrawTexture(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.Get<UnityEngine.Texture>(false); var Arg2 = argHelper2.Get<UnityEngine.Material>(false); UnityEngine.Graphics.DrawTexture(Arg0,Arg1,Arg2); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.Get<UnityEngine.Texture>(false); UnityEngine.Graphics.DrawTexture(Arg0,Arg1); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to DrawTexture"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_DrawMeshNow(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Quaternion), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3>(false); var Arg2 = argHelper2.Get<UnityEngine.Quaternion>(false); var Arg3 = argHelper3.GetInt32(false); UnityEngine.Graphics.DrawMeshNow(Arg0,Arg1,Arg2,Arg3); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Matrix4x4), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh>(false); var Arg1 = argHelper1.Get<UnityEngine.Matrix4x4>(false); var Arg2 = argHelper2.GetInt32(false); UnityEngine.Graphics.DrawMeshNow(Arg0,Arg1,Arg2); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Quaternion), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3>(false); var Arg2 = argHelper2.Get<UnityEngine.Quaternion>(false); UnityEngine.Graphics.DrawMeshNow(Arg0,Arg1,Arg2); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Matrix4x4), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh>(false); var Arg1 = argHelper1.Get<UnityEngine.Matrix4x4>(false); UnityEngine.Graphics.DrawMeshNow(Arg0,Arg1); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to DrawMeshNow"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_DrawMesh(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 11) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); var argHelper7 = new Puerts.ArgumentHelper((int)data, isolate, info, 7); var argHelper8 = new Puerts.ArgumentHelper((int)data, isolate, info, 8); var argHelper9 = new Puerts.ArgumentHelper((int)data, isolate, info, 9); var argHelper10 = new Puerts.ArgumentHelper((int)data, isolate, info, 10); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Quaternion), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Camera), false, false) && argHelper6.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper7.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.MaterialPropertyBlock), false, false) && argHelper8.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper9.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper10.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3>(false); var Arg2 = argHelper2.Get<UnityEngine.Quaternion>(false); var Arg3 = argHelper3.Get<UnityEngine.Material>(false); var Arg4 = argHelper4.GetInt32(false); var Arg5 = argHelper5.Get<UnityEngine.Camera>(false); var Arg6 = argHelper6.GetInt32(false); var Arg7 = argHelper7.Get<UnityEngine.MaterialPropertyBlock>(false); var Arg8 = argHelper8.GetBoolean(false); var Arg9 = argHelper9.GetBoolean(false); var Arg10 = argHelper10.GetBoolean(false); UnityEngine.Graphics.DrawMesh(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7,Arg8,Arg9,Arg10); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Quaternion), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Camera), false, false) && argHelper6.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper7.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.MaterialPropertyBlock), false, false) && argHelper8.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper9.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper10.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Transform), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3>(false); var Arg2 = argHelper2.Get<UnityEngine.Quaternion>(false); var Arg3 = argHelper3.Get<UnityEngine.Material>(false); var Arg4 = argHelper4.GetInt32(false); var Arg5 = argHelper5.Get<UnityEngine.Camera>(false); var Arg6 = argHelper6.GetInt32(false); var Arg7 = argHelper7.Get<UnityEngine.MaterialPropertyBlock>(false); var Arg8 = (UnityEngine.Rendering.ShadowCastingMode)argHelper8.GetInt32(false); var Arg9 = argHelper9.GetBoolean(false); var Arg10 = argHelper10.Get<UnityEngine.Transform>(false); UnityEngine.Graphics.DrawMesh(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7,Arg8,Arg9,Arg10); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Matrix4x4), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Camera), false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.MaterialPropertyBlock), false, false) && argHelper7.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper8.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper9.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Transform), false, false) && argHelper10.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh>(false); var Arg1 = argHelper1.Get<UnityEngine.Matrix4x4>(false); var Arg2 = argHelper2.Get<UnityEngine.Material>(false); var Arg3 = argHelper3.GetInt32(false); var Arg4 = argHelper4.Get<UnityEngine.Camera>(false); var Arg5 = argHelper5.GetInt32(false); var Arg6 = argHelper6.Get<UnityEngine.MaterialPropertyBlock>(false); var Arg7 = (UnityEngine.Rendering.ShadowCastingMode)argHelper7.GetInt32(false); var Arg8 = argHelper8.GetBoolean(false); var Arg9 = argHelper9.Get<UnityEngine.Transform>(false); var Arg10 = argHelper10.GetBoolean(false); UnityEngine.Graphics.DrawMesh(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7,Arg8,Arg9,Arg10); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Matrix4x4), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Camera), false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.MaterialPropertyBlock), false, false) && argHelper7.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper8.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper9.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Transform), false, false) && argHelper10.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh>(false); var Arg1 = argHelper1.Get<UnityEngine.Matrix4x4>(false); var Arg2 = argHelper2.Get<UnityEngine.Material>(false); var Arg3 = argHelper3.GetInt32(false); var Arg4 = argHelper4.Get<UnityEngine.Camera>(false); var Arg5 = argHelper5.GetInt32(false); var Arg6 = argHelper6.Get<UnityEngine.MaterialPropertyBlock>(false); var Arg7 = (UnityEngine.Rendering.ShadowCastingMode)argHelper7.GetInt32(false); var Arg8 = argHelper8.GetBoolean(false); var Arg9 = argHelper9.Get<UnityEngine.Transform>(false); var Arg10 = (UnityEngine.Rendering.LightProbeUsage)argHelper10.GetInt32(false); UnityEngine.Graphics.DrawMesh(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7,Arg8,Arg9,Arg10); return; } } if (paramLen == 12) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); var argHelper7 = new Puerts.ArgumentHelper((int)data, isolate, info, 7); var argHelper8 = new Puerts.ArgumentHelper((int)data, isolate, info, 8); var argHelper9 = new Puerts.ArgumentHelper((int)data, isolate, info, 9); var argHelper10 = new Puerts.ArgumentHelper((int)data, isolate, info, 10); var argHelper11 = new Puerts.ArgumentHelper((int)data, isolate, info, 11); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Quaternion), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Camera), false, false) && argHelper6.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper7.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.MaterialPropertyBlock), false, false) && argHelper8.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper9.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper10.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Transform), false, false) && argHelper11.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3>(false); var Arg2 = argHelper2.Get<UnityEngine.Quaternion>(false); var Arg3 = argHelper3.Get<UnityEngine.Material>(false); var Arg4 = argHelper4.GetInt32(false); var Arg5 = argHelper5.Get<UnityEngine.Camera>(false); var Arg6 = argHelper6.GetInt32(false); var Arg7 = argHelper7.Get<UnityEngine.MaterialPropertyBlock>(false); var Arg8 = (UnityEngine.Rendering.ShadowCastingMode)argHelper8.GetInt32(false); var Arg9 = argHelper9.GetBoolean(false); var Arg10 = argHelper10.Get<UnityEngine.Transform>(false); var Arg11 = argHelper11.GetBoolean(false); UnityEngine.Graphics.DrawMesh(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7,Arg8,Arg9,Arg10,Arg11); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Matrix4x4), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Camera), false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.MaterialPropertyBlock), false, false) && argHelper7.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper8.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper9.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Transform), false, false) && argHelper10.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper11.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.LightProbeProxyVolume), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh>(false); var Arg1 = argHelper1.Get<UnityEngine.Matrix4x4>(false); var Arg2 = argHelper2.Get<UnityEngine.Material>(false); var Arg3 = argHelper3.GetInt32(false); var Arg4 = argHelper4.Get<UnityEngine.Camera>(false); var Arg5 = argHelper5.GetInt32(false); var Arg6 = argHelper6.Get<UnityEngine.MaterialPropertyBlock>(false); var Arg7 = (UnityEngine.Rendering.ShadowCastingMode)argHelper7.GetInt32(false); var Arg8 = argHelper8.GetBoolean(false); var Arg9 = argHelper9.Get<UnityEngine.Transform>(false); var Arg10 = (UnityEngine.Rendering.LightProbeUsage)argHelper10.GetInt32(false); var Arg11 = argHelper11.Get<UnityEngine.LightProbeProxyVolume>(false); UnityEngine.Graphics.DrawMesh(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7,Arg8,Arg9,Arg10,Arg11); return; } } if (paramLen == 10) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); var argHelper7 = new Puerts.ArgumentHelper((int)data, isolate, info, 7); var argHelper8 = new Puerts.ArgumentHelper((int)data, isolate, info, 8); var argHelper9 = new Puerts.ArgumentHelper((int)data, isolate, info, 9); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Matrix4x4), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Camera), false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.MaterialPropertyBlock), false, false) && argHelper7.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper8.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper9.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh>(false); var Arg1 = argHelper1.Get<UnityEngine.Matrix4x4>(false); var Arg2 = argHelper2.Get<UnityEngine.Material>(false); var Arg3 = argHelper3.GetInt32(false); var Arg4 = argHelper4.Get<UnityEngine.Camera>(false); var Arg5 = argHelper5.GetInt32(false); var Arg6 = argHelper6.Get<UnityEngine.MaterialPropertyBlock>(false); var Arg7 = argHelper7.GetBoolean(false); var Arg8 = argHelper8.GetBoolean(false); var Arg9 = argHelper9.GetBoolean(false); UnityEngine.Graphics.DrawMesh(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7,Arg8,Arg9); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Quaternion), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Camera), false, false) && argHelper6.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper7.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.MaterialPropertyBlock), false, false) && argHelper8.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper9.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3>(false); var Arg2 = argHelper2.Get<UnityEngine.Quaternion>(false); var Arg3 = argHelper3.Get<UnityEngine.Material>(false); var Arg4 = argHelper4.GetInt32(false); var Arg5 = argHelper5.Get<UnityEngine.Camera>(false); var Arg6 = argHelper6.GetInt32(false); var Arg7 = argHelper7.Get<UnityEngine.MaterialPropertyBlock>(false); var Arg8 = argHelper8.GetBoolean(false); var Arg9 = argHelper9.GetBoolean(false); UnityEngine.Graphics.DrawMesh(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7,Arg8,Arg9); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Quaternion), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Camera), false, false) && argHelper6.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper7.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.MaterialPropertyBlock), false, false) && argHelper8.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper9.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3>(false); var Arg2 = argHelper2.Get<UnityEngine.Quaternion>(false); var Arg3 = argHelper3.Get<UnityEngine.Material>(false); var Arg4 = argHelper4.GetInt32(false); var Arg5 = argHelper5.Get<UnityEngine.Camera>(false); var Arg6 = argHelper6.GetInt32(false); var Arg7 = argHelper7.Get<UnityEngine.MaterialPropertyBlock>(false); var Arg8 = (UnityEngine.Rendering.ShadowCastingMode)argHelper8.GetInt32(false); var Arg9 = argHelper9.GetBoolean(false); UnityEngine.Graphics.DrawMesh(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7,Arg8,Arg9); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Matrix4x4), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Camera), false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.MaterialPropertyBlock), false, false) && argHelper7.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper8.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper9.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Transform), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh>(false); var Arg1 = argHelper1.Get<UnityEngine.Matrix4x4>(false); var Arg2 = argHelper2.Get<UnityEngine.Material>(false); var Arg3 = argHelper3.GetInt32(false); var Arg4 = argHelper4.Get<UnityEngine.Camera>(false); var Arg5 = argHelper5.GetInt32(false); var Arg6 = argHelper6.Get<UnityEngine.MaterialPropertyBlock>(false); var Arg7 = (UnityEngine.Rendering.ShadowCastingMode)argHelper7.GetInt32(false); var Arg8 = argHelper8.GetBoolean(false); var Arg9 = argHelper9.Get<UnityEngine.Transform>(false); UnityEngine.Graphics.DrawMesh(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7,Arg8,Arg9); return; } } if (paramLen == 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Quaternion), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3>(false); var Arg2 = argHelper2.Get<UnityEngine.Quaternion>(false); var Arg3 = argHelper3.Get<UnityEngine.Material>(false); var Arg4 = argHelper4.GetInt32(false); UnityEngine.Graphics.DrawMesh(Arg0,Arg1,Arg2,Arg3,Arg4); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Matrix4x4), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Camera), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh>(false); var Arg1 = argHelper1.Get<UnityEngine.Matrix4x4>(false); var Arg2 = argHelper2.Get<UnityEngine.Material>(false); var Arg3 = argHelper3.GetInt32(false); var Arg4 = argHelper4.Get<UnityEngine.Camera>(false); UnityEngine.Graphics.DrawMesh(Arg0,Arg1,Arg2,Arg3,Arg4); return; } } if (paramLen == 6) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Quaternion), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Camera), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3>(false); var Arg2 = argHelper2.Get<UnityEngine.Quaternion>(false); var Arg3 = argHelper3.Get<UnityEngine.Material>(false); var Arg4 = argHelper4.GetInt32(false); var Arg5 = argHelper5.Get<UnityEngine.Camera>(false); UnityEngine.Graphics.DrawMesh(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Matrix4x4), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Camera), false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh>(false); var Arg1 = argHelper1.Get<UnityEngine.Matrix4x4>(false); var Arg2 = argHelper2.Get<UnityEngine.Material>(false); var Arg3 = argHelper3.GetInt32(false); var Arg4 = argHelper4.Get<UnityEngine.Camera>(false); var Arg5 = argHelper5.GetInt32(false); UnityEngine.Graphics.DrawMesh(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); return; } } if (paramLen == 7) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Quaternion), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Camera), false, false) && argHelper6.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3>(false); var Arg2 = argHelper2.Get<UnityEngine.Quaternion>(false); var Arg3 = argHelper3.Get<UnityEngine.Material>(false); var Arg4 = argHelper4.GetInt32(false); var Arg5 = argHelper5.Get<UnityEngine.Camera>(false); var Arg6 = argHelper6.GetInt32(false); UnityEngine.Graphics.DrawMesh(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Matrix4x4), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Camera), false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.MaterialPropertyBlock), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh>(false); var Arg1 = argHelper1.Get<UnityEngine.Matrix4x4>(false); var Arg2 = argHelper2.Get<UnityEngine.Material>(false); var Arg3 = argHelper3.GetInt32(false); var Arg4 = argHelper4.Get<UnityEngine.Camera>(false); var Arg5 = argHelper5.GetInt32(false); var Arg6 = argHelper6.Get<UnityEngine.MaterialPropertyBlock>(false); UnityEngine.Graphics.DrawMesh(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6); return; } } if (paramLen == 8) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); var argHelper7 = new Puerts.ArgumentHelper((int)data, isolate, info, 7); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Quaternion), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Camera), false, false) && argHelper6.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper7.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.MaterialPropertyBlock), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3>(false); var Arg2 = argHelper2.Get<UnityEngine.Quaternion>(false); var Arg3 = argHelper3.Get<UnityEngine.Material>(false); var Arg4 = argHelper4.GetInt32(false); var Arg5 = argHelper5.Get<UnityEngine.Camera>(false); var Arg6 = argHelper6.GetInt32(false); var Arg7 = argHelper7.Get<UnityEngine.MaterialPropertyBlock>(false); UnityEngine.Graphics.DrawMesh(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Matrix4x4), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Camera), false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.MaterialPropertyBlock), false, false) && argHelper7.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh>(false); var Arg1 = argHelper1.Get<UnityEngine.Matrix4x4>(false); var Arg2 = argHelper2.Get<UnityEngine.Material>(false); var Arg3 = argHelper3.GetInt32(false); var Arg4 = argHelper4.Get<UnityEngine.Camera>(false); var Arg5 = argHelper5.GetInt32(false); var Arg6 = argHelper6.Get<UnityEngine.MaterialPropertyBlock>(false); var Arg7 = argHelper7.GetBoolean(false); UnityEngine.Graphics.DrawMesh(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Matrix4x4), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Camera), false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.MaterialPropertyBlock), false, false) && argHelper7.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh>(false); var Arg1 = argHelper1.Get<UnityEngine.Matrix4x4>(false); var Arg2 = argHelper2.Get<UnityEngine.Material>(false); var Arg3 = argHelper3.GetInt32(false); var Arg4 = argHelper4.Get<UnityEngine.Camera>(false); var Arg5 = argHelper5.GetInt32(false); var Arg6 = argHelper6.Get<UnityEngine.MaterialPropertyBlock>(false); var Arg7 = (UnityEngine.Rendering.ShadowCastingMode)argHelper7.GetInt32(false); UnityEngine.Graphics.DrawMesh(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7); return; } } if (paramLen == 9) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); var argHelper7 = new Puerts.ArgumentHelper((int)data, isolate, info, 7); var argHelper8 = new Puerts.ArgumentHelper((int)data, isolate, info, 8); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Quaternion), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Camera), false, false) && argHelper6.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper7.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.MaterialPropertyBlock), false, false) && argHelper8.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3>(false); var Arg2 = argHelper2.Get<UnityEngine.Quaternion>(false); var Arg3 = argHelper3.Get<UnityEngine.Material>(false); var Arg4 = argHelper4.GetInt32(false); var Arg5 = argHelper5.Get<UnityEngine.Camera>(false); var Arg6 = argHelper6.GetInt32(false); var Arg7 = argHelper7.Get<UnityEngine.MaterialPropertyBlock>(false); var Arg8 = argHelper8.GetBoolean(false); UnityEngine.Graphics.DrawMesh(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7,Arg8); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Quaternion), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Camera), false, false) && argHelper6.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper7.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.MaterialPropertyBlock), false, false) && argHelper8.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3>(false); var Arg2 = argHelper2.Get<UnityEngine.Quaternion>(false); var Arg3 = argHelper3.Get<UnityEngine.Material>(false); var Arg4 = argHelper4.GetInt32(false); var Arg5 = argHelper5.Get<UnityEngine.Camera>(false); var Arg6 = argHelper6.GetInt32(false); var Arg7 = argHelper7.Get<UnityEngine.MaterialPropertyBlock>(false); var Arg8 = (UnityEngine.Rendering.ShadowCastingMode)argHelper8.GetInt32(false); UnityEngine.Graphics.DrawMesh(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7,Arg8); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Matrix4x4), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Camera), false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.MaterialPropertyBlock), false, false) && argHelper7.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper8.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh>(false); var Arg1 = argHelper1.Get<UnityEngine.Matrix4x4>(false); var Arg2 = argHelper2.Get<UnityEngine.Material>(false); var Arg3 = argHelper3.GetInt32(false); var Arg4 = argHelper4.Get<UnityEngine.Camera>(false); var Arg5 = argHelper5.GetInt32(false); var Arg6 = argHelper6.Get<UnityEngine.MaterialPropertyBlock>(false); var Arg7 = argHelper7.GetBoolean(false); var Arg8 = argHelper8.GetBoolean(false); UnityEngine.Graphics.DrawMesh(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7,Arg8); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Matrix4x4), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Camera), false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.MaterialPropertyBlock), false, false) && argHelper7.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper8.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh>(false); var Arg1 = argHelper1.Get<UnityEngine.Matrix4x4>(false); var Arg2 = argHelper2.Get<UnityEngine.Material>(false); var Arg3 = argHelper3.GetInt32(false); var Arg4 = argHelper4.Get<UnityEngine.Camera>(false); var Arg5 = argHelper5.GetInt32(false); var Arg6 = argHelper6.Get<UnityEngine.MaterialPropertyBlock>(false); var Arg7 = (UnityEngine.Rendering.ShadowCastingMode)argHelper7.GetInt32(false); var Arg8 = argHelper8.GetBoolean(false); UnityEngine.Graphics.DrawMesh(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7,Arg8); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Matrix4x4), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh>(false); var Arg1 = argHelper1.Get<UnityEngine.Matrix4x4>(false); var Arg2 = argHelper2.Get<UnityEngine.Material>(false); var Arg3 = argHelper3.GetInt32(false); UnityEngine.Graphics.DrawMesh(Arg0,Arg1,Arg2,Arg3); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to DrawMesh"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_DrawMeshInstanced(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 12) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); var argHelper7 = new Puerts.ArgumentHelper((int)data, isolate, info, 7); var argHelper8 = new Puerts.ArgumentHelper((int)data, isolate, info, 8); var argHelper9 = new Puerts.ArgumentHelper((int)data, isolate, info, 9); var argHelper10 = new Puerts.ArgumentHelper((int)data, isolate, info, 10); var argHelper11 = new Puerts.ArgumentHelper((int)data, isolate, info, 11); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Matrix4x4[]), false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.MaterialPropertyBlock), false, false) && argHelper6.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper7.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper8.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper9.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Camera), false, false) && argHelper10.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper11.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.LightProbeProxyVolume), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.Get<UnityEngine.Material>(false); var Arg3 = argHelper3.Get<UnityEngine.Matrix4x4[]>(false); var Arg4 = argHelper4.GetInt32(false); var Arg5 = argHelper5.Get<UnityEngine.MaterialPropertyBlock>(false); var Arg6 = (UnityEngine.Rendering.ShadowCastingMode)argHelper6.GetInt32(false); var Arg7 = argHelper7.GetBoolean(false); var Arg8 = argHelper8.GetInt32(false); var Arg9 = argHelper9.Get<UnityEngine.Camera>(false); var Arg10 = (UnityEngine.Rendering.LightProbeUsage)argHelper10.GetInt32(false); var Arg11 = argHelper11.Get<UnityEngine.LightProbeProxyVolume>(false); UnityEngine.Graphics.DrawMeshInstanced(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7,Arg8,Arg9,Arg10,Arg11); return; } } if (paramLen == 11) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); var argHelper7 = new Puerts.ArgumentHelper((int)data, isolate, info, 7); var argHelper8 = new Puerts.ArgumentHelper((int)data, isolate, info, 8); var argHelper9 = new Puerts.ArgumentHelper((int)data, isolate, info, 9); var argHelper10 = new Puerts.ArgumentHelper((int)data, isolate, info, 10); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Matrix4x4>), false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.MaterialPropertyBlock), false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper7.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper8.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Camera), false, false) && argHelper9.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper10.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.LightProbeProxyVolume), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.Get<UnityEngine.Material>(false); var Arg3 = argHelper3.Get<System.Collections.Generic.List<UnityEngine.Matrix4x4>>(false); var Arg4 = argHelper4.Get<UnityEngine.MaterialPropertyBlock>(false); var Arg5 = (UnityEngine.Rendering.ShadowCastingMode)argHelper5.GetInt32(false); var Arg6 = argHelper6.GetBoolean(false); var Arg7 = argHelper7.GetInt32(false); var Arg8 = argHelper8.Get<UnityEngine.Camera>(false); var Arg9 = (UnityEngine.Rendering.LightProbeUsage)argHelper9.GetInt32(false); var Arg10 = argHelper10.Get<UnityEngine.LightProbeProxyVolume>(false); UnityEngine.Graphics.DrawMeshInstanced(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7,Arg8,Arg9,Arg10); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Matrix4x4[]), false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.MaterialPropertyBlock), false, false) && argHelper6.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper7.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper8.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper9.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Camera), false, false) && argHelper10.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.Get<UnityEngine.Material>(false); var Arg3 = argHelper3.Get<UnityEngine.Matrix4x4[]>(false); var Arg4 = argHelper4.GetInt32(false); var Arg5 = argHelper5.Get<UnityEngine.MaterialPropertyBlock>(false); var Arg6 = (UnityEngine.Rendering.ShadowCastingMode)argHelper6.GetInt32(false); var Arg7 = argHelper7.GetBoolean(false); var Arg8 = argHelper8.GetInt32(false); var Arg9 = argHelper9.Get<UnityEngine.Camera>(false); var Arg10 = (UnityEngine.Rendering.LightProbeUsage)argHelper10.GetInt32(false); UnityEngine.Graphics.DrawMeshInstanced(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7,Arg8,Arg9,Arg10); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Matrix4x4[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.Get<UnityEngine.Material>(false); var Arg3 = argHelper3.Get<UnityEngine.Matrix4x4[]>(false); UnityEngine.Graphics.DrawMeshInstanced(Arg0,Arg1,Arg2,Arg3); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Matrix4x4>), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.Get<UnityEngine.Material>(false); var Arg3 = argHelper3.Get<System.Collections.Generic.List<UnityEngine.Matrix4x4>>(false); UnityEngine.Graphics.DrawMeshInstanced(Arg0,Arg1,Arg2,Arg3); return; } } if (paramLen == 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Matrix4x4[]), false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.Get<UnityEngine.Material>(false); var Arg3 = argHelper3.Get<UnityEngine.Matrix4x4[]>(false); var Arg4 = argHelper4.GetInt32(false); UnityEngine.Graphics.DrawMeshInstanced(Arg0,Arg1,Arg2,Arg3,Arg4); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Matrix4x4>), false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.MaterialPropertyBlock), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.Get<UnityEngine.Material>(false); var Arg3 = argHelper3.Get<System.Collections.Generic.List<UnityEngine.Matrix4x4>>(false); var Arg4 = argHelper4.Get<UnityEngine.MaterialPropertyBlock>(false); UnityEngine.Graphics.DrawMeshInstanced(Arg0,Arg1,Arg2,Arg3,Arg4); return; } } if (paramLen == 6) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Matrix4x4[]), false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.MaterialPropertyBlock), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.Get<UnityEngine.Material>(false); var Arg3 = argHelper3.Get<UnityEngine.Matrix4x4[]>(false); var Arg4 = argHelper4.GetInt32(false); var Arg5 = argHelper5.Get<UnityEngine.MaterialPropertyBlock>(false); UnityEngine.Graphics.DrawMeshInstanced(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Matrix4x4>), false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.MaterialPropertyBlock), false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.Get<UnityEngine.Material>(false); var Arg3 = argHelper3.Get<System.Collections.Generic.List<UnityEngine.Matrix4x4>>(false); var Arg4 = argHelper4.Get<UnityEngine.MaterialPropertyBlock>(false); var Arg5 = (UnityEngine.Rendering.ShadowCastingMode)argHelper5.GetInt32(false); UnityEngine.Graphics.DrawMeshInstanced(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); return; } } if (paramLen == 7) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Matrix4x4[]), false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.MaterialPropertyBlock), false, false) && argHelper6.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.Get<UnityEngine.Material>(false); var Arg3 = argHelper3.Get<UnityEngine.Matrix4x4[]>(false); var Arg4 = argHelper4.GetInt32(false); var Arg5 = argHelper5.Get<UnityEngine.MaterialPropertyBlock>(false); var Arg6 = (UnityEngine.Rendering.ShadowCastingMode)argHelper6.GetInt32(false); UnityEngine.Graphics.DrawMeshInstanced(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Matrix4x4>), false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.MaterialPropertyBlock), false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.Get<UnityEngine.Material>(false); var Arg3 = argHelper3.Get<System.Collections.Generic.List<UnityEngine.Matrix4x4>>(false); var Arg4 = argHelper4.Get<UnityEngine.MaterialPropertyBlock>(false); var Arg5 = (UnityEngine.Rendering.ShadowCastingMode)argHelper5.GetInt32(false); var Arg6 = argHelper6.GetBoolean(false); UnityEngine.Graphics.DrawMeshInstanced(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6); return; } } if (paramLen == 8) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); var argHelper7 = new Puerts.ArgumentHelper((int)data, isolate, info, 7); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Matrix4x4[]), false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.MaterialPropertyBlock), false, false) && argHelper6.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper7.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.Get<UnityEngine.Material>(false); var Arg3 = argHelper3.Get<UnityEngine.Matrix4x4[]>(false); var Arg4 = argHelper4.GetInt32(false); var Arg5 = argHelper5.Get<UnityEngine.MaterialPropertyBlock>(false); var Arg6 = (UnityEngine.Rendering.ShadowCastingMode)argHelper6.GetInt32(false); var Arg7 = argHelper7.GetBoolean(false); UnityEngine.Graphics.DrawMeshInstanced(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Matrix4x4>), false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.MaterialPropertyBlock), false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper7.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.Get<UnityEngine.Material>(false); var Arg3 = argHelper3.Get<System.Collections.Generic.List<UnityEngine.Matrix4x4>>(false); var Arg4 = argHelper4.Get<UnityEngine.MaterialPropertyBlock>(false); var Arg5 = (UnityEngine.Rendering.ShadowCastingMode)argHelper5.GetInt32(false); var Arg6 = argHelper6.GetBoolean(false); var Arg7 = argHelper7.GetInt32(false); UnityEngine.Graphics.DrawMeshInstanced(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7); return; } } if (paramLen == 9) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); var argHelper7 = new Puerts.ArgumentHelper((int)data, isolate, info, 7); var argHelper8 = new Puerts.ArgumentHelper((int)data, isolate, info, 8); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Matrix4x4[]), false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.MaterialPropertyBlock), false, false) && argHelper6.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper7.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper8.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.Get<UnityEngine.Material>(false); var Arg3 = argHelper3.Get<UnityEngine.Matrix4x4[]>(false); var Arg4 = argHelper4.GetInt32(false); var Arg5 = argHelper5.Get<UnityEngine.MaterialPropertyBlock>(false); var Arg6 = (UnityEngine.Rendering.ShadowCastingMode)argHelper6.GetInt32(false); var Arg7 = argHelper7.GetBoolean(false); var Arg8 = argHelper8.GetInt32(false); UnityEngine.Graphics.DrawMeshInstanced(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7,Arg8); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Matrix4x4>), false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.MaterialPropertyBlock), false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper7.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper8.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Camera), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.Get<UnityEngine.Material>(false); var Arg3 = argHelper3.Get<System.Collections.Generic.List<UnityEngine.Matrix4x4>>(false); var Arg4 = argHelper4.Get<UnityEngine.MaterialPropertyBlock>(false); var Arg5 = (UnityEngine.Rendering.ShadowCastingMode)argHelper5.GetInt32(false); var Arg6 = argHelper6.GetBoolean(false); var Arg7 = argHelper7.GetInt32(false); var Arg8 = argHelper8.Get<UnityEngine.Camera>(false); UnityEngine.Graphics.DrawMeshInstanced(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7,Arg8); return; } } if (paramLen == 10) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); var argHelper7 = new Puerts.ArgumentHelper((int)data, isolate, info, 7); var argHelper8 = new Puerts.ArgumentHelper((int)data, isolate, info, 8); var argHelper9 = new Puerts.ArgumentHelper((int)data, isolate, info, 9); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Matrix4x4[]), false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.MaterialPropertyBlock), false, false) && argHelper6.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper7.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper8.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper9.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Camera), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.Get<UnityEngine.Material>(false); var Arg3 = argHelper3.Get<UnityEngine.Matrix4x4[]>(false); var Arg4 = argHelper4.GetInt32(false); var Arg5 = argHelper5.Get<UnityEngine.MaterialPropertyBlock>(false); var Arg6 = (UnityEngine.Rendering.ShadowCastingMode)argHelper6.GetInt32(false); var Arg7 = argHelper7.GetBoolean(false); var Arg8 = argHelper8.GetInt32(false); var Arg9 = argHelper9.Get<UnityEngine.Camera>(false); UnityEngine.Graphics.DrawMeshInstanced(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7,Arg8,Arg9); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Matrix4x4>), false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.MaterialPropertyBlock), false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper7.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper8.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Camera), false, false) && argHelper9.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.Get<UnityEngine.Material>(false); var Arg3 = argHelper3.Get<System.Collections.Generic.List<UnityEngine.Matrix4x4>>(false); var Arg4 = argHelper4.Get<UnityEngine.MaterialPropertyBlock>(false); var Arg5 = (UnityEngine.Rendering.ShadowCastingMode)argHelper5.GetInt32(false); var Arg6 = argHelper6.GetBoolean(false); var Arg7 = argHelper7.GetInt32(false); var Arg8 = argHelper8.Get<UnityEngine.Camera>(false); var Arg9 = (UnityEngine.Rendering.LightProbeUsage)argHelper9.GetInt32(false); UnityEngine.Graphics.DrawMeshInstanced(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7,Arg8,Arg9); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to DrawMeshInstanced"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_DrawMeshInstancedProcedural(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 12) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); var argHelper7 = new Puerts.ArgumentHelper((int)data, isolate, info, 7); var argHelper8 = new Puerts.ArgumentHelper((int)data, isolate, info, 8); var argHelper9 = new Puerts.ArgumentHelper((int)data, isolate, info, 9); var argHelper10 = new Puerts.ArgumentHelper((int)data, isolate, info, 10); var argHelper11 = new Puerts.ArgumentHelper((int)data, isolate, info, 11); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Bounds), false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.MaterialPropertyBlock), false, false) && argHelper6.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper7.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper8.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper9.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Camera), false, false) && argHelper10.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper11.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.LightProbeProxyVolume), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.Get<UnityEngine.Material>(false); var Arg3 = argHelper3.Get<UnityEngine.Bounds>(false); var Arg4 = argHelper4.GetInt32(false); var Arg5 = argHelper5.Get<UnityEngine.MaterialPropertyBlock>(false); var Arg6 = (UnityEngine.Rendering.ShadowCastingMode)argHelper6.GetInt32(false); var Arg7 = argHelper7.GetBoolean(false); var Arg8 = argHelper8.GetInt32(false); var Arg9 = argHelper9.Get<UnityEngine.Camera>(false); var Arg10 = (UnityEngine.Rendering.LightProbeUsage)argHelper10.GetInt32(false); var Arg11 = argHelper11.Get<UnityEngine.LightProbeProxyVolume>(false); UnityEngine.Graphics.DrawMeshInstancedProcedural(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7,Arg8,Arg9,Arg10,Arg11); return; } } if (paramLen == 11) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); var argHelper7 = new Puerts.ArgumentHelper((int)data, isolate, info, 7); var argHelper8 = new Puerts.ArgumentHelper((int)data, isolate, info, 8); var argHelper9 = new Puerts.ArgumentHelper((int)data, isolate, info, 9); var argHelper10 = new Puerts.ArgumentHelper((int)data, isolate, info, 10); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Bounds), false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.MaterialPropertyBlock), false, false) && argHelper6.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper7.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper8.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper9.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Camera), false, false) && argHelper10.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.Get<UnityEngine.Material>(false); var Arg3 = argHelper3.Get<UnityEngine.Bounds>(false); var Arg4 = argHelper4.GetInt32(false); var Arg5 = argHelper5.Get<UnityEngine.MaterialPropertyBlock>(false); var Arg6 = (UnityEngine.Rendering.ShadowCastingMode)argHelper6.GetInt32(false); var Arg7 = argHelper7.GetBoolean(false); var Arg8 = argHelper8.GetInt32(false); var Arg9 = argHelper9.Get<UnityEngine.Camera>(false); var Arg10 = (UnityEngine.Rendering.LightProbeUsage)argHelper10.GetInt32(false); UnityEngine.Graphics.DrawMeshInstancedProcedural(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7,Arg8,Arg9,Arg10); return; } } if (paramLen == 10) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); var argHelper7 = new Puerts.ArgumentHelper((int)data, isolate, info, 7); var argHelper8 = new Puerts.ArgumentHelper((int)data, isolate, info, 8); var argHelper9 = new Puerts.ArgumentHelper((int)data, isolate, info, 9); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Bounds), false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.MaterialPropertyBlock), false, false) && argHelper6.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper7.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper8.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper9.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Camera), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.Get<UnityEngine.Material>(false); var Arg3 = argHelper3.Get<UnityEngine.Bounds>(false); var Arg4 = argHelper4.GetInt32(false); var Arg5 = argHelper5.Get<UnityEngine.MaterialPropertyBlock>(false); var Arg6 = (UnityEngine.Rendering.ShadowCastingMode)argHelper6.GetInt32(false); var Arg7 = argHelper7.GetBoolean(false); var Arg8 = argHelper8.GetInt32(false); var Arg9 = argHelper9.Get<UnityEngine.Camera>(false); UnityEngine.Graphics.DrawMeshInstancedProcedural(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7,Arg8,Arg9); return; } } if (paramLen == 9) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); var argHelper7 = new Puerts.ArgumentHelper((int)data, isolate, info, 7); var argHelper8 = new Puerts.ArgumentHelper((int)data, isolate, info, 8); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Bounds), false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.MaterialPropertyBlock), false, false) && argHelper6.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper7.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper8.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.Get<UnityEngine.Material>(false); var Arg3 = argHelper3.Get<UnityEngine.Bounds>(false); var Arg4 = argHelper4.GetInt32(false); var Arg5 = argHelper5.Get<UnityEngine.MaterialPropertyBlock>(false); var Arg6 = (UnityEngine.Rendering.ShadowCastingMode)argHelper6.GetInt32(false); var Arg7 = argHelper7.GetBoolean(false); var Arg8 = argHelper8.GetInt32(false); UnityEngine.Graphics.DrawMeshInstancedProcedural(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7,Arg8); return; } } if (paramLen == 8) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); var argHelper7 = new Puerts.ArgumentHelper((int)data, isolate, info, 7); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Bounds), false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.MaterialPropertyBlock), false, false) && argHelper6.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper7.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.Get<UnityEngine.Material>(false); var Arg3 = argHelper3.Get<UnityEngine.Bounds>(false); var Arg4 = argHelper4.GetInt32(false); var Arg5 = argHelper5.Get<UnityEngine.MaterialPropertyBlock>(false); var Arg6 = (UnityEngine.Rendering.ShadowCastingMode)argHelper6.GetInt32(false); var Arg7 = argHelper7.GetBoolean(false); UnityEngine.Graphics.DrawMeshInstancedProcedural(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7); return; } } if (paramLen == 7) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Bounds), false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.MaterialPropertyBlock), false, false) && argHelper6.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.Get<UnityEngine.Material>(false); var Arg3 = argHelper3.Get<UnityEngine.Bounds>(false); var Arg4 = argHelper4.GetInt32(false); var Arg5 = argHelper5.Get<UnityEngine.MaterialPropertyBlock>(false); var Arg6 = (UnityEngine.Rendering.ShadowCastingMode)argHelper6.GetInt32(false); UnityEngine.Graphics.DrawMeshInstancedProcedural(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6); return; } } if (paramLen == 6) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Bounds), false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.MaterialPropertyBlock), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.Get<UnityEngine.Material>(false); var Arg3 = argHelper3.Get<UnityEngine.Bounds>(false); var Arg4 = argHelper4.GetInt32(false); var Arg5 = argHelper5.Get<UnityEngine.MaterialPropertyBlock>(false); UnityEngine.Graphics.DrawMeshInstancedProcedural(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); return; } } if (paramLen == 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Bounds), false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.Get<UnityEngine.Material>(false); var Arg3 = argHelper3.Get<UnityEngine.Bounds>(false); var Arg4 = argHelper4.GetInt32(false); UnityEngine.Graphics.DrawMeshInstancedProcedural(Arg0,Arg1,Arg2,Arg3,Arg4); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to DrawMeshInstancedProcedural"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_DrawMeshInstancedIndirect(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 13) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); var argHelper7 = new Puerts.ArgumentHelper((int)data, isolate, info, 7); var argHelper8 = new Puerts.ArgumentHelper((int)data, isolate, info, 8); var argHelper9 = new Puerts.ArgumentHelper((int)data, isolate, info, 9); var argHelper10 = new Puerts.ArgumentHelper((int)data, isolate, info, 10); var argHelper11 = new Puerts.ArgumentHelper((int)data, isolate, info, 11); var argHelper12 = new Puerts.ArgumentHelper((int)data, isolate, info, 12); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Bounds), false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.ComputeBuffer), false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.MaterialPropertyBlock), false, false) && argHelper7.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper8.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper9.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper10.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Camera), false, false) && argHelper11.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper12.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.LightProbeProxyVolume), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.Get<UnityEngine.Material>(false); var Arg3 = argHelper3.Get<UnityEngine.Bounds>(false); var Arg4 = argHelper4.Get<UnityEngine.ComputeBuffer>(false); var Arg5 = argHelper5.GetInt32(false); var Arg6 = argHelper6.Get<UnityEngine.MaterialPropertyBlock>(false); var Arg7 = (UnityEngine.Rendering.ShadowCastingMode)argHelper7.GetInt32(false); var Arg8 = argHelper8.GetBoolean(false); var Arg9 = argHelper9.GetInt32(false); var Arg10 = argHelper10.Get<UnityEngine.Camera>(false); var Arg11 = (UnityEngine.Rendering.LightProbeUsage)argHelper11.GetInt32(false); var Arg12 = argHelper12.Get<UnityEngine.LightProbeProxyVolume>(false); UnityEngine.Graphics.DrawMeshInstancedIndirect(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7,Arg8,Arg9,Arg10,Arg11,Arg12); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Bounds), false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GraphicsBuffer), false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.MaterialPropertyBlock), false, false) && argHelper7.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper8.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper9.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper10.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Camera), false, false) && argHelper11.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper12.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.LightProbeProxyVolume), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.Get<UnityEngine.Material>(false); var Arg3 = argHelper3.Get<UnityEngine.Bounds>(false); var Arg4 = argHelper4.Get<UnityEngine.GraphicsBuffer>(false); var Arg5 = argHelper5.GetInt32(false); var Arg6 = argHelper6.Get<UnityEngine.MaterialPropertyBlock>(false); var Arg7 = (UnityEngine.Rendering.ShadowCastingMode)argHelper7.GetInt32(false); var Arg8 = argHelper8.GetBoolean(false); var Arg9 = argHelper9.GetInt32(false); var Arg10 = argHelper10.Get<UnityEngine.Camera>(false); var Arg11 = (UnityEngine.Rendering.LightProbeUsage)argHelper11.GetInt32(false); var Arg12 = argHelper12.Get<UnityEngine.LightProbeProxyVolume>(false); UnityEngine.Graphics.DrawMeshInstancedIndirect(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7,Arg8,Arg9,Arg10,Arg11,Arg12); return; } } if (paramLen == 12) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); var argHelper7 = new Puerts.ArgumentHelper((int)data, isolate, info, 7); var argHelper8 = new Puerts.ArgumentHelper((int)data, isolate, info, 8); var argHelper9 = new Puerts.ArgumentHelper((int)data, isolate, info, 9); var argHelper10 = new Puerts.ArgumentHelper((int)data, isolate, info, 10); var argHelper11 = new Puerts.ArgumentHelper((int)data, isolate, info, 11); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Bounds), false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.ComputeBuffer), false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.MaterialPropertyBlock), false, false) && argHelper7.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper8.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper9.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper10.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Camera), false, false) && argHelper11.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.Get<UnityEngine.Material>(false); var Arg3 = argHelper3.Get<UnityEngine.Bounds>(false); var Arg4 = argHelper4.Get<UnityEngine.ComputeBuffer>(false); var Arg5 = argHelper5.GetInt32(false); var Arg6 = argHelper6.Get<UnityEngine.MaterialPropertyBlock>(false); var Arg7 = (UnityEngine.Rendering.ShadowCastingMode)argHelper7.GetInt32(false); var Arg8 = argHelper8.GetBoolean(false); var Arg9 = argHelper9.GetInt32(false); var Arg10 = argHelper10.Get<UnityEngine.Camera>(false); var Arg11 = (UnityEngine.Rendering.LightProbeUsage)argHelper11.GetInt32(false); UnityEngine.Graphics.DrawMeshInstancedIndirect(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7,Arg8,Arg9,Arg10,Arg11); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Bounds), false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GraphicsBuffer), false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.MaterialPropertyBlock), false, false) && argHelper7.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper8.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper9.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper10.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Camera), false, false) && argHelper11.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.Get<UnityEngine.Material>(false); var Arg3 = argHelper3.Get<UnityEngine.Bounds>(false); var Arg4 = argHelper4.Get<UnityEngine.GraphicsBuffer>(false); var Arg5 = argHelper5.GetInt32(false); var Arg6 = argHelper6.Get<UnityEngine.MaterialPropertyBlock>(false); var Arg7 = (UnityEngine.Rendering.ShadowCastingMode)argHelper7.GetInt32(false); var Arg8 = argHelper8.GetBoolean(false); var Arg9 = argHelper9.GetInt32(false); var Arg10 = argHelper10.Get<UnityEngine.Camera>(false); var Arg11 = (UnityEngine.Rendering.LightProbeUsage)argHelper11.GetInt32(false); UnityEngine.Graphics.DrawMeshInstancedIndirect(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7,Arg8,Arg9,Arg10,Arg11); return; } } if (paramLen == 11) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); var argHelper7 = new Puerts.ArgumentHelper((int)data, isolate, info, 7); var argHelper8 = new Puerts.ArgumentHelper((int)data, isolate, info, 8); var argHelper9 = new Puerts.ArgumentHelper((int)data, isolate, info, 9); var argHelper10 = new Puerts.ArgumentHelper((int)data, isolate, info, 10); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Bounds), false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.ComputeBuffer), false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.MaterialPropertyBlock), false, false) && argHelper7.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper8.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper9.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper10.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Camera), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.Get<UnityEngine.Material>(false); var Arg3 = argHelper3.Get<UnityEngine.Bounds>(false); var Arg4 = argHelper4.Get<UnityEngine.ComputeBuffer>(false); var Arg5 = argHelper5.GetInt32(false); var Arg6 = argHelper6.Get<UnityEngine.MaterialPropertyBlock>(false); var Arg7 = (UnityEngine.Rendering.ShadowCastingMode)argHelper7.GetInt32(false); var Arg8 = argHelper8.GetBoolean(false); var Arg9 = argHelper9.GetInt32(false); var Arg10 = argHelper10.Get<UnityEngine.Camera>(false); UnityEngine.Graphics.DrawMeshInstancedIndirect(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7,Arg8,Arg9,Arg10); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Bounds), false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GraphicsBuffer), false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.MaterialPropertyBlock), false, false) && argHelper7.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper8.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper9.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper10.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Camera), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.Get<UnityEngine.Material>(false); var Arg3 = argHelper3.Get<UnityEngine.Bounds>(false); var Arg4 = argHelper4.Get<UnityEngine.GraphicsBuffer>(false); var Arg5 = argHelper5.GetInt32(false); var Arg6 = argHelper6.Get<UnityEngine.MaterialPropertyBlock>(false); var Arg7 = (UnityEngine.Rendering.ShadowCastingMode)argHelper7.GetInt32(false); var Arg8 = argHelper8.GetBoolean(false); var Arg9 = argHelper9.GetInt32(false); var Arg10 = argHelper10.Get<UnityEngine.Camera>(false); UnityEngine.Graphics.DrawMeshInstancedIndirect(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7,Arg8,Arg9,Arg10); return; } } if (paramLen == 10) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); var argHelper7 = new Puerts.ArgumentHelper((int)data, isolate, info, 7); var argHelper8 = new Puerts.ArgumentHelper((int)data, isolate, info, 8); var argHelper9 = new Puerts.ArgumentHelper((int)data, isolate, info, 9); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Bounds), false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.ComputeBuffer), false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.MaterialPropertyBlock), false, false) && argHelper7.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper8.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper9.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.Get<UnityEngine.Material>(false); var Arg3 = argHelper3.Get<UnityEngine.Bounds>(false); var Arg4 = argHelper4.Get<UnityEngine.ComputeBuffer>(false); var Arg5 = argHelper5.GetInt32(false); var Arg6 = argHelper6.Get<UnityEngine.MaterialPropertyBlock>(false); var Arg7 = (UnityEngine.Rendering.ShadowCastingMode)argHelper7.GetInt32(false); var Arg8 = argHelper8.GetBoolean(false); var Arg9 = argHelper9.GetInt32(false); UnityEngine.Graphics.DrawMeshInstancedIndirect(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7,Arg8,Arg9); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Bounds), false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GraphicsBuffer), false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.MaterialPropertyBlock), false, false) && argHelper7.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper8.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper9.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.Get<UnityEngine.Material>(false); var Arg3 = argHelper3.Get<UnityEngine.Bounds>(false); var Arg4 = argHelper4.Get<UnityEngine.GraphicsBuffer>(false); var Arg5 = argHelper5.GetInt32(false); var Arg6 = argHelper6.Get<UnityEngine.MaterialPropertyBlock>(false); var Arg7 = (UnityEngine.Rendering.ShadowCastingMode)argHelper7.GetInt32(false); var Arg8 = argHelper8.GetBoolean(false); var Arg9 = argHelper9.GetInt32(false); UnityEngine.Graphics.DrawMeshInstancedIndirect(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7,Arg8,Arg9); return; } } if (paramLen == 9) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); var argHelper7 = new Puerts.ArgumentHelper((int)data, isolate, info, 7); var argHelper8 = new Puerts.ArgumentHelper((int)data, isolate, info, 8); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Bounds), false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.ComputeBuffer), false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.MaterialPropertyBlock), false, false) && argHelper7.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper8.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.Get<UnityEngine.Material>(false); var Arg3 = argHelper3.Get<UnityEngine.Bounds>(false); var Arg4 = argHelper4.Get<UnityEngine.ComputeBuffer>(false); var Arg5 = argHelper5.GetInt32(false); var Arg6 = argHelper6.Get<UnityEngine.MaterialPropertyBlock>(false); var Arg7 = (UnityEngine.Rendering.ShadowCastingMode)argHelper7.GetInt32(false); var Arg8 = argHelper8.GetBoolean(false); UnityEngine.Graphics.DrawMeshInstancedIndirect(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7,Arg8); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Bounds), false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GraphicsBuffer), false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.MaterialPropertyBlock), false, false) && argHelper7.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper8.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.Get<UnityEngine.Material>(false); var Arg3 = argHelper3.Get<UnityEngine.Bounds>(false); var Arg4 = argHelper4.Get<UnityEngine.GraphicsBuffer>(false); var Arg5 = argHelper5.GetInt32(false); var Arg6 = argHelper6.Get<UnityEngine.MaterialPropertyBlock>(false); var Arg7 = (UnityEngine.Rendering.ShadowCastingMode)argHelper7.GetInt32(false); var Arg8 = argHelper8.GetBoolean(false); UnityEngine.Graphics.DrawMeshInstancedIndirect(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7,Arg8); return; } } if (paramLen == 8) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); var argHelper7 = new Puerts.ArgumentHelper((int)data, isolate, info, 7); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Bounds), false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.ComputeBuffer), false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.MaterialPropertyBlock), false, false) && argHelper7.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.Get<UnityEngine.Material>(false); var Arg3 = argHelper3.Get<UnityEngine.Bounds>(false); var Arg4 = argHelper4.Get<UnityEngine.ComputeBuffer>(false); var Arg5 = argHelper5.GetInt32(false); var Arg6 = argHelper6.Get<UnityEngine.MaterialPropertyBlock>(false); var Arg7 = (UnityEngine.Rendering.ShadowCastingMode)argHelper7.GetInt32(false); UnityEngine.Graphics.DrawMeshInstancedIndirect(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Bounds), false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GraphicsBuffer), false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.MaterialPropertyBlock), false, false) && argHelper7.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.Get<UnityEngine.Material>(false); var Arg3 = argHelper3.Get<UnityEngine.Bounds>(false); var Arg4 = argHelper4.Get<UnityEngine.GraphicsBuffer>(false); var Arg5 = argHelper5.GetInt32(false); var Arg6 = argHelper6.Get<UnityEngine.MaterialPropertyBlock>(false); var Arg7 = (UnityEngine.Rendering.ShadowCastingMode)argHelper7.GetInt32(false); UnityEngine.Graphics.DrawMeshInstancedIndirect(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7); return; } } if (paramLen == 7) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Bounds), false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.ComputeBuffer), false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.MaterialPropertyBlock), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.Get<UnityEngine.Material>(false); var Arg3 = argHelper3.Get<UnityEngine.Bounds>(false); var Arg4 = argHelper4.Get<UnityEngine.ComputeBuffer>(false); var Arg5 = argHelper5.GetInt32(false); var Arg6 = argHelper6.Get<UnityEngine.MaterialPropertyBlock>(false); UnityEngine.Graphics.DrawMeshInstancedIndirect(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Bounds), false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GraphicsBuffer), false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.MaterialPropertyBlock), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.Get<UnityEngine.Material>(false); var Arg3 = argHelper3.Get<UnityEngine.Bounds>(false); var Arg4 = argHelper4.Get<UnityEngine.GraphicsBuffer>(false); var Arg5 = argHelper5.GetInt32(false); var Arg6 = argHelper6.Get<UnityEngine.MaterialPropertyBlock>(false); UnityEngine.Graphics.DrawMeshInstancedIndirect(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6); return; } } if (paramLen == 6) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Bounds), false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.ComputeBuffer), false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.Get<UnityEngine.Material>(false); var Arg3 = argHelper3.Get<UnityEngine.Bounds>(false); var Arg4 = argHelper4.Get<UnityEngine.ComputeBuffer>(false); var Arg5 = argHelper5.GetInt32(false); UnityEngine.Graphics.DrawMeshInstancedIndirect(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Bounds), false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GraphicsBuffer), false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.Get<UnityEngine.Material>(false); var Arg3 = argHelper3.Get<UnityEngine.Bounds>(false); var Arg4 = argHelper4.Get<UnityEngine.GraphicsBuffer>(false); var Arg5 = argHelper5.GetInt32(false); UnityEngine.Graphics.DrawMeshInstancedIndirect(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); return; } } if (paramLen == 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Bounds), false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.ComputeBuffer), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.Get<UnityEngine.Material>(false); var Arg3 = argHelper3.Get<UnityEngine.Bounds>(false); var Arg4 = argHelper4.Get<UnityEngine.ComputeBuffer>(false); UnityEngine.Graphics.DrawMeshInstancedIndirect(Arg0,Arg1,Arg2,Arg3,Arg4); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Bounds), false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GraphicsBuffer), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.Get<UnityEngine.Material>(false); var Arg3 = argHelper3.Get<UnityEngine.Bounds>(false); var Arg4 = argHelper4.Get<UnityEngine.GraphicsBuffer>(false); UnityEngine.Graphics.DrawMeshInstancedIndirect(Arg0,Arg1,Arg2,Arg3,Arg4); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to DrawMeshInstancedIndirect"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_DrawProceduralNow(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = (UnityEngine.MeshTopology)argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); UnityEngine.Graphics.DrawProceduralNow(Arg0,Arg1,Arg2); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GraphicsBuffer), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = (UnityEngine.MeshTopology)argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.GraphicsBuffer>(false); var Arg2 = argHelper2.GetInt32(false); UnityEngine.Graphics.DrawProceduralNow(Arg0,Arg1,Arg2); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = (UnityEngine.MeshTopology)argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); UnityEngine.Graphics.DrawProceduralNow(Arg0,Arg1); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GraphicsBuffer), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = (UnityEngine.MeshTopology)argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.GraphicsBuffer>(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetInt32(false); UnityEngine.Graphics.DrawProceduralNow(Arg0,Arg1,Arg2,Arg3); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to DrawProceduralNow"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_DrawProceduralIndirectNow(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.ComputeBuffer), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = (UnityEngine.MeshTopology)argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.ComputeBuffer>(false); var Arg2 = argHelper2.GetInt32(false); UnityEngine.Graphics.DrawProceduralIndirectNow(Arg0,Arg1,Arg2); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GraphicsBuffer), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.ComputeBuffer), false, false)) { var Arg0 = (UnityEngine.MeshTopology)argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.GraphicsBuffer>(false); var Arg2 = argHelper2.Get<UnityEngine.ComputeBuffer>(false); UnityEngine.Graphics.DrawProceduralIndirectNow(Arg0,Arg1,Arg2); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GraphicsBuffer), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = (UnityEngine.MeshTopology)argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.GraphicsBuffer>(false); var Arg2 = argHelper2.GetInt32(false); UnityEngine.Graphics.DrawProceduralIndirectNow(Arg0,Arg1,Arg2); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GraphicsBuffer), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GraphicsBuffer), false, false)) { var Arg0 = (UnityEngine.MeshTopology)argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.GraphicsBuffer>(false); var Arg2 = argHelper2.Get<UnityEngine.GraphicsBuffer>(false); UnityEngine.Graphics.DrawProceduralIndirectNow(Arg0,Arg1,Arg2); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.ComputeBuffer), false, false)) { var Arg0 = (UnityEngine.MeshTopology)argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.ComputeBuffer>(false); UnityEngine.Graphics.DrawProceduralIndirectNow(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GraphicsBuffer), false, false)) { var Arg0 = (UnityEngine.MeshTopology)argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.GraphicsBuffer>(false); UnityEngine.Graphics.DrawProceduralIndirectNow(Arg0,Arg1); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GraphicsBuffer), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.ComputeBuffer), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = (UnityEngine.MeshTopology)argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.GraphicsBuffer>(false); var Arg2 = argHelper2.Get<UnityEngine.ComputeBuffer>(false); var Arg3 = argHelper3.GetInt32(false); UnityEngine.Graphics.DrawProceduralIndirectNow(Arg0,Arg1,Arg2,Arg3); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GraphicsBuffer), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GraphicsBuffer), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = (UnityEngine.MeshTopology)argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.GraphicsBuffer>(false); var Arg2 = argHelper2.Get<UnityEngine.GraphicsBuffer>(false); var Arg3 = argHelper3.GetInt32(false); UnityEngine.Graphics.DrawProceduralIndirectNow(Arg0,Arg1,Arg2,Arg3); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to DrawProceduralIndirectNow"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_DrawProcedural(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 10) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); var argHelper7 = new Puerts.ArgumentHelper((int)data, isolate, info, 7); var argHelper8 = new Puerts.ArgumentHelper((int)data, isolate, info, 8); var argHelper9 = new Puerts.ArgumentHelper((int)data, isolate, info, 9); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Bounds), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Camera), false, false) && argHelper6.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.MaterialPropertyBlock), false, false) && argHelper7.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper8.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper9.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Material>(false); var Arg1 = argHelper1.Get<UnityEngine.Bounds>(false); var Arg2 = (UnityEngine.MeshTopology)argHelper2.GetInt32(false); var Arg3 = argHelper3.GetInt32(false); var Arg4 = argHelper4.GetInt32(false); var Arg5 = argHelper5.Get<UnityEngine.Camera>(false); var Arg6 = argHelper6.Get<UnityEngine.MaterialPropertyBlock>(false); var Arg7 = (UnityEngine.Rendering.ShadowCastingMode)argHelper7.GetInt32(false); var Arg8 = argHelper8.GetBoolean(false); var Arg9 = argHelper9.GetInt32(false); UnityEngine.Graphics.DrawProcedural(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7,Arg8,Arg9); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Bounds), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GraphicsBuffer), false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Camera), false, false) && argHelper7.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.MaterialPropertyBlock), false, false) && argHelper8.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper9.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Material>(false); var Arg1 = argHelper1.Get<UnityEngine.Bounds>(false); var Arg2 = (UnityEngine.MeshTopology)argHelper2.GetInt32(false); var Arg3 = argHelper3.Get<UnityEngine.GraphicsBuffer>(false); var Arg4 = argHelper4.GetInt32(false); var Arg5 = argHelper5.GetInt32(false); var Arg6 = argHelper6.Get<UnityEngine.Camera>(false); var Arg7 = argHelper7.Get<UnityEngine.MaterialPropertyBlock>(false); var Arg8 = (UnityEngine.Rendering.ShadowCastingMode)argHelper8.GetInt32(false); var Arg9 = argHelper9.GetBoolean(false); UnityEngine.Graphics.DrawProcedural(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7,Arg8,Arg9); return; } } if (paramLen == 9) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); var argHelper7 = new Puerts.ArgumentHelper((int)data, isolate, info, 7); var argHelper8 = new Puerts.ArgumentHelper((int)data, isolate, info, 8); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Bounds), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Camera), false, false) && argHelper6.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.MaterialPropertyBlock), false, false) && argHelper7.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper8.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Material>(false); var Arg1 = argHelper1.Get<UnityEngine.Bounds>(false); var Arg2 = (UnityEngine.MeshTopology)argHelper2.GetInt32(false); var Arg3 = argHelper3.GetInt32(false); var Arg4 = argHelper4.GetInt32(false); var Arg5 = argHelper5.Get<UnityEngine.Camera>(false); var Arg6 = argHelper6.Get<UnityEngine.MaterialPropertyBlock>(false); var Arg7 = (UnityEngine.Rendering.ShadowCastingMode)argHelper7.GetInt32(false); var Arg8 = argHelper8.GetBoolean(false); UnityEngine.Graphics.DrawProcedural(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7,Arg8); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Bounds), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GraphicsBuffer), false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Camera), false, false) && argHelper7.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.MaterialPropertyBlock), false, false) && argHelper8.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Material>(false); var Arg1 = argHelper1.Get<UnityEngine.Bounds>(false); var Arg2 = (UnityEngine.MeshTopology)argHelper2.GetInt32(false); var Arg3 = argHelper3.Get<UnityEngine.GraphicsBuffer>(false); var Arg4 = argHelper4.GetInt32(false); var Arg5 = argHelper5.GetInt32(false); var Arg6 = argHelper6.Get<UnityEngine.Camera>(false); var Arg7 = argHelper7.Get<UnityEngine.MaterialPropertyBlock>(false); var Arg8 = (UnityEngine.Rendering.ShadowCastingMode)argHelper8.GetInt32(false); UnityEngine.Graphics.DrawProcedural(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7,Arg8); return; } } if (paramLen == 8) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); var argHelper7 = new Puerts.ArgumentHelper((int)data, isolate, info, 7); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Bounds), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Camera), false, false) && argHelper6.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.MaterialPropertyBlock), false, false) && argHelper7.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Material>(false); var Arg1 = argHelper1.Get<UnityEngine.Bounds>(false); var Arg2 = (UnityEngine.MeshTopology)argHelper2.GetInt32(false); var Arg3 = argHelper3.GetInt32(false); var Arg4 = argHelper4.GetInt32(false); var Arg5 = argHelper5.Get<UnityEngine.Camera>(false); var Arg6 = argHelper6.Get<UnityEngine.MaterialPropertyBlock>(false); var Arg7 = (UnityEngine.Rendering.ShadowCastingMode)argHelper7.GetInt32(false); UnityEngine.Graphics.DrawProcedural(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Bounds), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GraphicsBuffer), false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Camera), false, false) && argHelper7.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.MaterialPropertyBlock), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Material>(false); var Arg1 = argHelper1.Get<UnityEngine.Bounds>(false); var Arg2 = (UnityEngine.MeshTopology)argHelper2.GetInt32(false); var Arg3 = argHelper3.Get<UnityEngine.GraphicsBuffer>(false); var Arg4 = argHelper4.GetInt32(false); var Arg5 = argHelper5.GetInt32(false); var Arg6 = argHelper6.Get<UnityEngine.Camera>(false); var Arg7 = argHelper7.Get<UnityEngine.MaterialPropertyBlock>(false); UnityEngine.Graphics.DrawProcedural(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7); return; } } if (paramLen == 7) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Bounds), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Camera), false, false) && argHelper6.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.MaterialPropertyBlock), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Material>(false); var Arg1 = argHelper1.Get<UnityEngine.Bounds>(false); var Arg2 = (UnityEngine.MeshTopology)argHelper2.GetInt32(false); var Arg3 = argHelper3.GetInt32(false); var Arg4 = argHelper4.GetInt32(false); var Arg5 = argHelper5.Get<UnityEngine.Camera>(false); var Arg6 = argHelper6.Get<UnityEngine.MaterialPropertyBlock>(false); UnityEngine.Graphics.DrawProcedural(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Bounds), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GraphicsBuffer), false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Camera), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Material>(false); var Arg1 = argHelper1.Get<UnityEngine.Bounds>(false); var Arg2 = (UnityEngine.MeshTopology)argHelper2.GetInt32(false); var Arg3 = argHelper3.Get<UnityEngine.GraphicsBuffer>(false); var Arg4 = argHelper4.GetInt32(false); var Arg5 = argHelper5.GetInt32(false); var Arg6 = argHelper6.Get<UnityEngine.Camera>(false); UnityEngine.Graphics.DrawProcedural(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6); return; } } if (paramLen == 6) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Bounds), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Camera), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Material>(false); var Arg1 = argHelper1.Get<UnityEngine.Bounds>(false); var Arg2 = (UnityEngine.MeshTopology)argHelper2.GetInt32(false); var Arg3 = argHelper3.GetInt32(false); var Arg4 = argHelper4.GetInt32(false); var Arg5 = argHelper5.Get<UnityEngine.Camera>(false); UnityEngine.Graphics.DrawProcedural(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Bounds), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GraphicsBuffer), false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Material>(false); var Arg1 = argHelper1.Get<UnityEngine.Bounds>(false); var Arg2 = (UnityEngine.MeshTopology)argHelper2.GetInt32(false); var Arg3 = argHelper3.Get<UnityEngine.GraphicsBuffer>(false); var Arg4 = argHelper4.GetInt32(false); var Arg5 = argHelper5.GetInt32(false); UnityEngine.Graphics.DrawProcedural(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); return; } } if (paramLen == 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Bounds), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Material>(false); var Arg1 = argHelper1.Get<UnityEngine.Bounds>(false); var Arg2 = (UnityEngine.MeshTopology)argHelper2.GetInt32(false); var Arg3 = argHelper3.GetInt32(false); var Arg4 = argHelper4.GetInt32(false); UnityEngine.Graphics.DrawProcedural(Arg0,Arg1,Arg2,Arg3,Arg4); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Bounds), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GraphicsBuffer), false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Material>(false); var Arg1 = argHelper1.Get<UnityEngine.Bounds>(false); var Arg2 = (UnityEngine.MeshTopology)argHelper2.GetInt32(false); var Arg3 = argHelper3.Get<UnityEngine.GraphicsBuffer>(false); var Arg4 = argHelper4.GetInt32(false); UnityEngine.Graphics.DrawProcedural(Arg0,Arg1,Arg2,Arg3,Arg4); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Bounds), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Material>(false); var Arg1 = argHelper1.Get<UnityEngine.Bounds>(false); var Arg2 = (UnityEngine.MeshTopology)argHelper2.GetInt32(false); var Arg3 = argHelper3.GetInt32(false); UnityEngine.Graphics.DrawProcedural(Arg0,Arg1,Arg2,Arg3); return; } } if (paramLen == 11) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); var argHelper7 = new Puerts.ArgumentHelper((int)data, isolate, info, 7); var argHelper8 = new Puerts.ArgumentHelper((int)data, isolate, info, 8); var argHelper9 = new Puerts.ArgumentHelper((int)data, isolate, info, 9); var argHelper10 = new Puerts.ArgumentHelper((int)data, isolate, info, 10); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Bounds), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GraphicsBuffer), false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Camera), false, false) && argHelper7.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.MaterialPropertyBlock), false, false) && argHelper8.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper9.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper10.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Material>(false); var Arg1 = argHelper1.Get<UnityEngine.Bounds>(false); var Arg2 = (UnityEngine.MeshTopology)argHelper2.GetInt32(false); var Arg3 = argHelper3.Get<UnityEngine.GraphicsBuffer>(false); var Arg4 = argHelper4.GetInt32(false); var Arg5 = argHelper5.GetInt32(false); var Arg6 = argHelper6.Get<UnityEngine.Camera>(false); var Arg7 = argHelper7.Get<UnityEngine.MaterialPropertyBlock>(false); var Arg8 = (UnityEngine.Rendering.ShadowCastingMode)argHelper8.GetInt32(false); var Arg9 = argHelper9.GetBoolean(false); var Arg10 = argHelper10.GetInt32(false); UnityEngine.Graphics.DrawProcedural(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7,Arg8,Arg9,Arg10); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to DrawProcedural"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_DrawProceduralIndirect(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 10) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); var argHelper7 = new Puerts.ArgumentHelper((int)data, isolate, info, 7); var argHelper8 = new Puerts.ArgumentHelper((int)data, isolate, info, 8); var argHelper9 = new Puerts.ArgumentHelper((int)data, isolate, info, 9); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Bounds), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.ComputeBuffer), false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Camera), false, false) && argHelper6.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.MaterialPropertyBlock), false, false) && argHelper7.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper8.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper9.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Material>(false); var Arg1 = argHelper1.Get<UnityEngine.Bounds>(false); var Arg2 = (UnityEngine.MeshTopology)argHelper2.GetInt32(false); var Arg3 = argHelper3.Get<UnityEngine.ComputeBuffer>(false); var Arg4 = argHelper4.GetInt32(false); var Arg5 = argHelper5.Get<UnityEngine.Camera>(false); var Arg6 = argHelper6.Get<UnityEngine.MaterialPropertyBlock>(false); var Arg7 = (UnityEngine.Rendering.ShadowCastingMode)argHelper7.GetInt32(false); var Arg8 = argHelper8.GetBoolean(false); var Arg9 = argHelper9.GetInt32(false); UnityEngine.Graphics.DrawProceduralIndirect(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7,Arg8,Arg9); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Bounds), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GraphicsBuffer), false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.ComputeBuffer), false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Camera), false, false) && argHelper7.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.MaterialPropertyBlock), false, false) && argHelper8.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper9.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Material>(false); var Arg1 = argHelper1.Get<UnityEngine.Bounds>(false); var Arg2 = (UnityEngine.MeshTopology)argHelper2.GetInt32(false); var Arg3 = argHelper3.Get<UnityEngine.GraphicsBuffer>(false); var Arg4 = argHelper4.Get<UnityEngine.ComputeBuffer>(false); var Arg5 = argHelper5.GetInt32(false); var Arg6 = argHelper6.Get<UnityEngine.Camera>(false); var Arg7 = argHelper7.Get<UnityEngine.MaterialPropertyBlock>(false); var Arg8 = (UnityEngine.Rendering.ShadowCastingMode)argHelper8.GetInt32(false); var Arg9 = argHelper9.GetBoolean(false); UnityEngine.Graphics.DrawProceduralIndirect(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7,Arg8,Arg9); return; } } if (paramLen == 9) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); var argHelper7 = new Puerts.ArgumentHelper((int)data, isolate, info, 7); var argHelper8 = new Puerts.ArgumentHelper((int)data, isolate, info, 8); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Bounds), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.ComputeBuffer), false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Camera), false, false) && argHelper6.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.MaterialPropertyBlock), false, false) && argHelper7.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper8.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Material>(false); var Arg1 = argHelper1.Get<UnityEngine.Bounds>(false); var Arg2 = (UnityEngine.MeshTopology)argHelper2.GetInt32(false); var Arg3 = argHelper3.Get<UnityEngine.ComputeBuffer>(false); var Arg4 = argHelper4.GetInt32(false); var Arg5 = argHelper5.Get<UnityEngine.Camera>(false); var Arg6 = argHelper6.Get<UnityEngine.MaterialPropertyBlock>(false); var Arg7 = (UnityEngine.Rendering.ShadowCastingMode)argHelper7.GetInt32(false); var Arg8 = argHelper8.GetBoolean(false); UnityEngine.Graphics.DrawProceduralIndirect(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7,Arg8); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Bounds), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GraphicsBuffer), false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.ComputeBuffer), false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Camera), false, false) && argHelper7.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.MaterialPropertyBlock), false, false) && argHelper8.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Material>(false); var Arg1 = argHelper1.Get<UnityEngine.Bounds>(false); var Arg2 = (UnityEngine.MeshTopology)argHelper2.GetInt32(false); var Arg3 = argHelper3.Get<UnityEngine.GraphicsBuffer>(false); var Arg4 = argHelper4.Get<UnityEngine.ComputeBuffer>(false); var Arg5 = argHelper5.GetInt32(false); var Arg6 = argHelper6.Get<UnityEngine.Camera>(false); var Arg7 = argHelper7.Get<UnityEngine.MaterialPropertyBlock>(false); var Arg8 = (UnityEngine.Rendering.ShadowCastingMode)argHelper8.GetInt32(false); UnityEngine.Graphics.DrawProceduralIndirect(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7,Arg8); return; } } if (paramLen == 8) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); var argHelper7 = new Puerts.ArgumentHelper((int)data, isolate, info, 7); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Bounds), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.ComputeBuffer), false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Camera), false, false) && argHelper6.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.MaterialPropertyBlock), false, false) && argHelper7.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Material>(false); var Arg1 = argHelper1.Get<UnityEngine.Bounds>(false); var Arg2 = (UnityEngine.MeshTopology)argHelper2.GetInt32(false); var Arg3 = argHelper3.Get<UnityEngine.ComputeBuffer>(false); var Arg4 = argHelper4.GetInt32(false); var Arg5 = argHelper5.Get<UnityEngine.Camera>(false); var Arg6 = argHelper6.Get<UnityEngine.MaterialPropertyBlock>(false); var Arg7 = (UnityEngine.Rendering.ShadowCastingMode)argHelper7.GetInt32(false); UnityEngine.Graphics.DrawProceduralIndirect(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Bounds), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GraphicsBuffer), false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.ComputeBuffer), false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Camera), false, false) && argHelper7.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.MaterialPropertyBlock), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Material>(false); var Arg1 = argHelper1.Get<UnityEngine.Bounds>(false); var Arg2 = (UnityEngine.MeshTopology)argHelper2.GetInt32(false); var Arg3 = argHelper3.Get<UnityEngine.GraphicsBuffer>(false); var Arg4 = argHelper4.Get<UnityEngine.ComputeBuffer>(false); var Arg5 = argHelper5.GetInt32(false); var Arg6 = argHelper6.Get<UnityEngine.Camera>(false); var Arg7 = argHelper7.Get<UnityEngine.MaterialPropertyBlock>(false); UnityEngine.Graphics.DrawProceduralIndirect(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7); return; } } if (paramLen == 7) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Bounds), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.ComputeBuffer), false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Camera), false, false) && argHelper6.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.MaterialPropertyBlock), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Material>(false); var Arg1 = argHelper1.Get<UnityEngine.Bounds>(false); var Arg2 = (UnityEngine.MeshTopology)argHelper2.GetInt32(false); var Arg3 = argHelper3.Get<UnityEngine.ComputeBuffer>(false); var Arg4 = argHelper4.GetInt32(false); var Arg5 = argHelper5.Get<UnityEngine.Camera>(false); var Arg6 = argHelper6.Get<UnityEngine.MaterialPropertyBlock>(false); UnityEngine.Graphics.DrawProceduralIndirect(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Bounds), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GraphicsBuffer), false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.ComputeBuffer), false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Camera), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Material>(false); var Arg1 = argHelper1.Get<UnityEngine.Bounds>(false); var Arg2 = (UnityEngine.MeshTopology)argHelper2.GetInt32(false); var Arg3 = argHelper3.Get<UnityEngine.GraphicsBuffer>(false); var Arg4 = argHelper4.Get<UnityEngine.ComputeBuffer>(false); var Arg5 = argHelper5.GetInt32(false); var Arg6 = argHelper6.Get<UnityEngine.Camera>(false); UnityEngine.Graphics.DrawProceduralIndirect(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6); return; } } if (paramLen == 6) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Bounds), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.ComputeBuffer), false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Camera), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Material>(false); var Arg1 = argHelper1.Get<UnityEngine.Bounds>(false); var Arg2 = (UnityEngine.MeshTopology)argHelper2.GetInt32(false); var Arg3 = argHelper3.Get<UnityEngine.ComputeBuffer>(false); var Arg4 = argHelper4.GetInt32(false); var Arg5 = argHelper5.Get<UnityEngine.Camera>(false); UnityEngine.Graphics.DrawProceduralIndirect(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Bounds), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GraphicsBuffer), false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.ComputeBuffer), false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Material>(false); var Arg1 = argHelper1.Get<UnityEngine.Bounds>(false); var Arg2 = (UnityEngine.MeshTopology)argHelper2.GetInt32(false); var Arg3 = argHelper3.Get<UnityEngine.GraphicsBuffer>(false); var Arg4 = argHelper4.Get<UnityEngine.ComputeBuffer>(false); var Arg5 = argHelper5.GetInt32(false); UnityEngine.Graphics.DrawProceduralIndirect(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); return; } } if (paramLen == 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Bounds), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.ComputeBuffer), false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Material>(false); var Arg1 = argHelper1.Get<UnityEngine.Bounds>(false); var Arg2 = (UnityEngine.MeshTopology)argHelper2.GetInt32(false); var Arg3 = argHelper3.Get<UnityEngine.ComputeBuffer>(false); var Arg4 = argHelper4.GetInt32(false); UnityEngine.Graphics.DrawProceduralIndirect(Arg0,Arg1,Arg2,Arg3,Arg4); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Bounds), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GraphicsBuffer), false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.ComputeBuffer), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Material>(false); var Arg1 = argHelper1.Get<UnityEngine.Bounds>(false); var Arg2 = (UnityEngine.MeshTopology)argHelper2.GetInt32(false); var Arg3 = argHelper3.Get<UnityEngine.GraphicsBuffer>(false); var Arg4 = argHelper4.Get<UnityEngine.ComputeBuffer>(false); UnityEngine.Graphics.DrawProceduralIndirect(Arg0,Arg1,Arg2,Arg3,Arg4); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Bounds), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.ComputeBuffer), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Material>(false); var Arg1 = argHelper1.Get<UnityEngine.Bounds>(false); var Arg2 = (UnityEngine.MeshTopology)argHelper2.GetInt32(false); var Arg3 = argHelper3.Get<UnityEngine.ComputeBuffer>(false); UnityEngine.Graphics.DrawProceduralIndirect(Arg0,Arg1,Arg2,Arg3); return; } } if (paramLen == 11) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); var argHelper7 = new Puerts.ArgumentHelper((int)data, isolate, info, 7); var argHelper8 = new Puerts.ArgumentHelper((int)data, isolate, info, 8); var argHelper9 = new Puerts.ArgumentHelper((int)data, isolate, info, 9); var argHelper10 = new Puerts.ArgumentHelper((int)data, isolate, info, 10); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Bounds), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GraphicsBuffer), false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.ComputeBuffer), false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Camera), false, false) && argHelper7.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.MaterialPropertyBlock), false, false) && argHelper8.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper9.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper10.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Material>(false); var Arg1 = argHelper1.Get<UnityEngine.Bounds>(false); var Arg2 = (UnityEngine.MeshTopology)argHelper2.GetInt32(false); var Arg3 = argHelper3.Get<UnityEngine.GraphicsBuffer>(false); var Arg4 = argHelper4.Get<UnityEngine.ComputeBuffer>(false); var Arg5 = argHelper5.GetInt32(false); var Arg6 = argHelper6.Get<UnityEngine.Camera>(false); var Arg7 = argHelper7.Get<UnityEngine.MaterialPropertyBlock>(false); var Arg8 = (UnityEngine.Rendering.ShadowCastingMode)argHelper8.GetInt32(false); var Arg9 = argHelper9.GetBoolean(false); var Arg10 = argHelper10.GetInt32(false); UnityEngine.Graphics.DrawProceduralIndirect(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7,Arg8,Arg9,Arg10); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to DrawProceduralIndirect"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_Blit(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RenderTexture), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Texture>(false); var Arg1 = argHelper1.Get<UnityEngine.RenderTexture>(false); UnityEngine.Graphics.Blit(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Texture>(false); var Arg1 = argHelper1.Get<UnityEngine.Material>(false); UnityEngine.Graphics.Blit(Arg0,Arg1); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RenderTexture), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Texture>(false); var Arg1 = argHelper1.Get<UnityEngine.RenderTexture>(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetInt32(false); UnityEngine.Graphics.Blit(Arg0,Arg1,Arg2,Arg3); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RenderTexture), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Texture>(false); var Arg1 = argHelper1.Get<UnityEngine.RenderTexture>(false); var Arg2 = argHelper2.Get<UnityEngine.Vector2>(false); var Arg3 = argHelper3.Get<UnityEngine.Vector2>(false); UnityEngine.Graphics.Blit(Arg0,Arg1,Arg2,Arg3); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RenderTexture), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Texture>(false); var Arg1 = argHelper1.Get<UnityEngine.RenderTexture>(false); var Arg2 = argHelper2.Get<UnityEngine.Material>(false); var Arg3 = argHelper3.GetInt32(false); UnityEngine.Graphics.Blit(Arg0,Arg1,Arg2,Arg3); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Texture>(false); var Arg1 = argHelper1.Get<UnityEngine.Material>(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetInt32(false); UnityEngine.Graphics.Blit(Arg0,Arg1,Arg2,Arg3); return; } } if (paramLen == 6) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RenderTexture), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Texture>(false); var Arg1 = argHelper1.Get<UnityEngine.RenderTexture>(false); var Arg2 = argHelper2.Get<UnityEngine.Vector2>(false); var Arg3 = argHelper3.Get<UnityEngine.Vector2>(false); var Arg4 = argHelper4.GetInt32(false); var Arg5 = argHelper5.GetInt32(false); UnityEngine.Graphics.Blit(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); return; } } if (paramLen == 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RenderTexture), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Texture>(false); var Arg1 = argHelper1.Get<UnityEngine.RenderTexture>(false); var Arg2 = argHelper2.Get<UnityEngine.Material>(false); var Arg3 = argHelper3.GetInt32(false); var Arg4 = argHelper4.GetInt32(false); UnityEngine.Graphics.Blit(Arg0,Arg1,Arg2,Arg3,Arg4); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RenderTexture), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Texture>(false); var Arg1 = argHelper1.Get<UnityEngine.RenderTexture>(false); var Arg2 = argHelper2.Get<UnityEngine.Material>(false); UnityEngine.Graphics.Blit(Arg0,Arg1,Arg2); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Texture>(false); var Arg1 = argHelper1.Get<UnityEngine.Material>(false); var Arg2 = argHelper2.GetInt32(false); UnityEngine.Graphics.Blit(Arg0,Arg1,Arg2); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to Blit"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_BlitMultiTap(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen >= 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RenderTexture), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Texture>(false); var Arg1 = argHelper1.Get<UnityEngine.RenderTexture>(false); var Arg2 = argHelper2.Get<UnityEngine.Material>(false); var Arg3 = argHelper3.GetParams<UnityEngine.Vector2>(info, 3, paramLen); UnityEngine.Graphics.BlitMultiTap(Arg0,Arg1,Arg2,Arg3); return; } } if (paramLen >= 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RenderTexture), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Texture>(false); var Arg1 = argHelper1.Get<UnityEngine.RenderTexture>(false); var Arg2 = argHelper2.Get<UnityEngine.Material>(false); var Arg3 = argHelper3.GetInt32(false); var Arg4 = argHelper4.GetParams<UnityEngine.Vector2>(info, 4, paramLen); UnityEngine.Graphics.BlitMultiTap(Arg0,Arg1,Arg2,Arg3,Arg4); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to BlitMultiTap"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_activeColorGamut(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Graphics.activeColorGamut; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_activeTier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Graphics.activeTier; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_activeTier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.Graphics.activeTier = (UnityEngine.Rendering.GraphicsTier)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_preserveFramebufferAlpha(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Graphics.preserveFramebufferAlpha; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_minOpenGLESVersion(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Graphics.minOpenGLESVersion; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_activeColorBuffer(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Graphics.activeColorBuffer; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_activeDepthBuffer(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Graphics.activeDepthBuffer; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "ClearRandomWriteTargets", IsStatic = true}, F_ClearRandomWriteTargets }, { new Puerts.MethodKey {Name = "ExecuteCommandBuffer", IsStatic = true}, F_ExecuteCommandBuffer }, { new Puerts.MethodKey {Name = "ExecuteCommandBufferAsync", IsStatic = true}, F_ExecuteCommandBufferAsync }, { new Puerts.MethodKey {Name = "SetRenderTarget", IsStatic = true}, F_SetRenderTarget }, { new Puerts.MethodKey {Name = "SetRandomWriteTarget", IsStatic = true}, F_SetRandomWriteTarget }, { new Puerts.MethodKey {Name = "CopyTexture", IsStatic = true}, F_CopyTexture }, { new Puerts.MethodKey {Name = "ConvertTexture", IsStatic = true}, F_ConvertTexture }, { new Puerts.MethodKey {Name = "CreateAsyncGraphicsFence", IsStatic = true}, F_CreateAsyncGraphicsFence }, { new Puerts.MethodKey {Name = "CreateGraphicsFence", IsStatic = true}, F_CreateGraphicsFence }, { new Puerts.MethodKey {Name = "WaitOnAsyncGraphicsFence", IsStatic = true}, F_WaitOnAsyncGraphicsFence }, { new Puerts.MethodKey {Name = "DrawTexture", IsStatic = true}, F_DrawTexture }, { new Puerts.MethodKey {Name = "DrawMeshNow", IsStatic = true}, F_DrawMeshNow }, { new Puerts.MethodKey {Name = "DrawMesh", IsStatic = true}, F_DrawMesh }, { new Puerts.MethodKey {Name = "DrawMeshInstanced", IsStatic = true}, F_DrawMeshInstanced }, { new Puerts.MethodKey {Name = "DrawMeshInstancedProcedural", IsStatic = true}, F_DrawMeshInstancedProcedural }, { new Puerts.MethodKey {Name = "DrawMeshInstancedIndirect", IsStatic = true}, F_DrawMeshInstancedIndirect }, { new Puerts.MethodKey {Name = "DrawProceduralNow", IsStatic = true}, F_DrawProceduralNow }, { new Puerts.MethodKey {Name = "DrawProceduralIndirectNow", IsStatic = true}, F_DrawProceduralIndirectNow }, { new Puerts.MethodKey {Name = "DrawProcedural", IsStatic = true}, F_DrawProcedural }, { new Puerts.MethodKey {Name = "DrawProceduralIndirect", IsStatic = true}, F_DrawProceduralIndirect }, { new Puerts.MethodKey {Name = "Blit", IsStatic = true}, F_Blit }, { new Puerts.MethodKey {Name = "BlitMultiTap", IsStatic = true}, F_BlitMultiTap }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"activeColorGamut", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_activeColorGamut, Setter = null} }, {"activeTier", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_activeTier, Setter = S_activeTier} }, {"preserveFramebufferAlpha", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_preserveFramebufferAlpha, Setter = null} }, {"minOpenGLESVersion", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_minOpenGLESVersion, Setter = null} }, {"activeColorBuffer", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_activeColorBuffer, Setter = null} }, {"activeDepthBuffer", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_activeDepthBuffer, Setter = null} }, } }; } } } <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/ai/EExecutor.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ namespace cfg.ai { public enum EExecutor { CLIENT = 0, SERVER = 1, } } <|start_filename|>Projects/Go_json/gen/src/cfg/condition.Condition.go<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg import "errors" type ConditionCondition struct { } const TypeId_ConditionCondition = 183625704 func (*ConditionCondition) GetTypeId() int32 { return 183625704 } func (_v *ConditionCondition)Deserialize(_buf map[string]interface{}) (err error) { return } func DeserializeConditionCondition(_buf map[string]interface{}) (interface{}, error) { var id string var _ok_ bool if id, _ok_ = _buf["__type__"].(string) ; !_ok_ { return nil, errors.New("type id missing") } switch id { case "TimeRange": _v := &ConditionTimeRange{}; if err := _v.Deserialize(_buf); err != nil { return nil, errors.New("condition.TimeRange") } else { return _v, nil } case "MultiRoleCondition": _v := &ConditionMultiRoleCondition{}; if err := _v.Deserialize(_buf); err != nil { return nil, errors.New("condition.MultiRoleCondition") } else { return _v, nil } case "GenderLimit": _v := &ConditionGenderLimit{}; if err := _v.Deserialize(_buf); err != nil { return nil, errors.New("condition.GenderLimit") } else { return _v, nil } case "MinLevel": _v := &ConditionMinLevel{}; if err := _v.Deserialize(_buf); err != nil { return nil, errors.New("condition.MinLevel") } else { return _v, nil } case "MaxLevel": _v := &ConditionMaxLevel{}; if err := _v.Deserialize(_buf); err != nil { return nil, errors.New("condition.MaxLevel") } else { return _v, nil } case "MinMaxLevel": _v := &ConditionMinMaxLevel{}; if err := _v.Deserialize(_buf); err != nil { return nil, errors.New("condition.MinMaxLevel") } else { return _v, nil } case "ClothesPropertyScoreGreaterThan": _v := &ConditionClothesPropertyScoreGreaterThan{}; if err := _v.Deserialize(_buf); err != nil { return nil, errors.New("condition.ClothesPropertyScoreGreaterThan") } else { return _v, nil } case "ContainsItem": _v := &ConditionContainsItem{}; if err := _v.Deserialize(_buf); err != nil { return nil, errors.New("condition.ContainsItem") } else { return _v, nil } default: return nil, errors.New("unknown type id") } } <|start_filename|>DesignerConfigs/Datas/tag_datas/not_tag.lua<|end_filename|> return { id = 100, value = "导出", } <|start_filename|>Projects/DataTemplates/template_lua2/test_tbsingleton.lua<|end_filename|> -- test.TbSingleton return { id=5, name={key='key_name',text="aabbcc"}, date= { x1=1, time= { start_time=398966400, end_time=936806400, }, }, }, <|start_filename|>Projects/GenerateDatas/convert_lua/test.TbTestBeRef/4.lua<|end_filename|> return { id = 4, count = 10, } <|start_filename|>Projects/Java_bin/src/main/gen/cfg/test/InnerGroup.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.test; import bright.serialization.*; public final class InnerGroup { public InnerGroup(ByteBuf _buf) { y1 = _buf.readInt(); y2 = _buf.readInt(); y3 = _buf.readInt(); y4 = _buf.readInt(); } public InnerGroup(int y1, int y2, int y3, int y4 ) { this.y1 = y1; this.y2 = y2; this.y3 = y3; this.y4 = y4; } public final int y1; public final int y2; public final int y3; public final int y4; public void resolve(java.util.HashMap<String, Object> _tables) { } @Override public String toString() { return "{ " + "y1:" + y1 + "," + "y2:" + y2 + "," + "y3:" + y3 + "," + "y4:" + y4 + "," + "}"; } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_ParticleSystem_LightsModule_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_ParticleSystem_LightsModule_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.ParticleSystem.LightsModule constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_enabled(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.LightsModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.enabled; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_enabled(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.LightsModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.enabled = argHelper.GetBoolean(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_ratio(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.LightsModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.ratio; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_ratio(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.LightsModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.ratio = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_useRandomDistribution(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.LightsModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.useRandomDistribution; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_useRandomDistribution(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.LightsModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.useRandomDistribution = argHelper.GetBoolean(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_light(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.LightsModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.light; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_light(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.LightsModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.light = argHelper.Get<UnityEngine.Light>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_useParticleColor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.LightsModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.useParticleColor; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_useParticleColor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.LightsModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.useParticleColor = argHelper.GetBoolean(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_sizeAffectsRange(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.LightsModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.sizeAffectsRange; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_sizeAffectsRange(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.LightsModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.sizeAffectsRange = argHelper.GetBoolean(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_alphaAffectsIntensity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.LightsModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.alphaAffectsIntensity; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_alphaAffectsIntensity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.LightsModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.alphaAffectsIntensity = argHelper.GetBoolean(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_range(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.LightsModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.range; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_range(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.LightsModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.range = argHelper.Get<UnityEngine.ParticleSystem.MinMaxCurve>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_rangeMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.LightsModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.rangeMultiplier; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_rangeMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.LightsModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.rangeMultiplier = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_intensity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.LightsModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.intensity; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_intensity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.LightsModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.intensity = argHelper.Get<UnityEngine.ParticleSystem.MinMaxCurve>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_intensityMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.LightsModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.intensityMultiplier; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_intensityMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.LightsModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.intensityMultiplier = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_maxLights(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.LightsModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.maxLights; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_maxLights(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.LightsModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.maxLights = argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"enabled", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_enabled, Setter = S_enabled} }, {"ratio", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_ratio, Setter = S_ratio} }, {"useRandomDistribution", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_useRandomDistribution, Setter = S_useRandomDistribution} }, {"light", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_light, Setter = S_light} }, {"useParticleColor", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_useParticleColor, Setter = S_useParticleColor} }, {"sizeAffectsRange", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_sizeAffectsRange, Setter = S_sizeAffectsRange} }, {"alphaAffectsIntensity", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_alphaAffectsIntensity, Setter = S_alphaAffectsIntensity} }, {"range", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_range, Setter = S_range} }, {"rangeMultiplier", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_rangeMultiplier, Setter = S_rangeMultiplier} }, {"intensity", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_intensity, Setter = S_intensity} }, {"intensityMultiplier", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_intensityMultiplier, Setter = S_intensityMultiplier} }, {"maxLights", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_maxLights, Setter = S_maxLights} }, } }; } } } <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/limit/WeeklyLimit.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.limit { public sealed partial class WeeklyLimit : limit.LimitBase { public WeeklyLimit(ByteBuf _buf) : base(_buf) { Num = _buf.ReadInt(); } public WeeklyLimit(int num ) : base() { this.Num = num; } public static WeeklyLimit DeserializeWeeklyLimit(ByteBuf _buf) { return new limit.WeeklyLimit(_buf); } public readonly int Num; public const int ID = -252187161; public override int GetTypeId() => ID; public override void Resolve(Dictionary<string, object> _tables) { base.Resolve(_tables); OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); public override string ToString() { return "{ " + "Num:" + Num + "," + "}"; } } } <|start_filename|>Projects/GenerateDatas/convert_lua/test.TbTestBeRef/7.lua<|end_filename|> return { id = 7, count = 10, } <|start_filename|>Projects/GenerateDatas/convert_lua/l10n.TbL10NDemo/16.lua<|end_filename|> return { id = 16, text = {key='/demo/6',text="测试6"}, } <|start_filename|>Projects/Csharp_DotNet5_bin/Gen/test/TestSep.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.test { public sealed class TestSep : Bright.Config.BeanBase { public TestSep(ByteBuf _buf) { Id = _buf.ReadInt(); X1_l10n_key = _buf.ReadString(); X1 = _buf.ReadString(); X2 = test.SepBean1.DeserializeSepBean1(_buf); X3 = test.SepVector.DeserializeSepVector(_buf); {int n = System.Math.Min(_buf.ReadSize(), _buf.Size);X4 = new System.Collections.Generic.List<test.SepVector>(n);for(var i = 0 ; i < n ; i++) { test.SepVector _e; _e = test.SepVector.DeserializeSepVector(_buf); X4.Add(_e);}} {int n = System.Math.Min(_buf.ReadSize(), _buf.Size);X5 = new System.Collections.Generic.List<test.SepBean1>(n);for(var i = 0 ; i < n ; i++) { test.SepBean1 _e; _e = test.SepBean1.DeserializeSepBean1(_buf); X5.Add(_e);}} {int n = System.Math.Min(_buf.ReadSize(), _buf.Size);X6 = new System.Collections.Generic.List<test.SepBean1>(n);for(var i = 0 ; i < n ; i++) { test.SepBean1 _e; _e = test.SepBean1.DeserializeSepBean1(_buf); X6.Add(_e);}} } public static TestSep DeserializeTestSep(ByteBuf _buf) { return new test.TestSep(_buf); } public int Id { get; private set; } public string X1 { get; private set; } public string X1_l10n_key { get; } public test.SepBean1 X2 { get; private set; } /// <summary> /// SepVector已经定义了sep=,属性 /// </summary> public test.SepVector X3 { get; private set; } /// <summary> /// 用;来分割数据,然后顺序读入SepVector /// </summary> public System.Collections.Generic.List<test.SepVector> X4 { get; private set; } /// <summary> /// 用,分割数据,然后顺序读入 /// </summary> public System.Collections.Generic.List<test.SepBean1> X5 { get; private set; } /// <summary> /// 用;分割数据,然后再将每个数据用,分割,读入 /// </summary> public System.Collections.Generic.List<test.SepBean1> X6 { get; private set; } public const int __ID__ = -543221520; public override int GetTypeId() => __ID__; public void Resolve(Dictionary<string, object> _tables) { X2?.Resolve(_tables); X3?.Resolve(_tables); foreach(var _e in X4) { _e?.Resolve(_tables); } foreach(var _e in X5) { _e?.Resolve(_tables); } foreach(var _e in X6) { _e?.Resolve(_tables); } } public void TranslateText(System.Func<string, string, string> translator) { X1 = translator(X1_l10n_key, X1); X2?.TranslateText(translator); X3?.TranslateText(translator); foreach(var _e in X4) { _e?.TranslateText(translator); } foreach(var _e in X5) { _e?.TranslateText(translator); } foreach(var _e in X6) { _e?.TranslateText(translator); } } public override string ToString() { return "{ " + "Id:" + Id + "," + "X1:" + X1 + "," + "X2:" + X2 + "," + "X3:" + X3 + "," + "X4:" + Bright.Common.StringUtil.CollectionToString(X4) + "," + "X5:" + Bright.Common.StringUtil.CollectionToString(X5) + "," + "X6:" + Bright.Common.StringUtil.CollectionToString(X6) + "," + "}"; } } } <|start_filename|>Projects/GenerateDatas/convert_lua/ai.TbBlackboard/demo_parent.lua<|end_filename|> return { name = "demo_parent", desc = "demo parent", parent_name = "", keys = { { name = "v1", desc = "v1 haha", is_static = false, type = 1, type_class_name = "", }, }, } <|start_filename|>Projects/Go_json/gen/src/cfg/test.CompactString.go<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg import "errors" type TestCompactString struct { Id int32 S2 string S3 string } const TypeId_TestCompactString = 1968089240 func (*TestCompactString) GetTypeId() int32 { return 1968089240 } func (_v *TestCompactString)Deserialize(_buf map[string]interface{}) (err error) { { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["id"].(float64); !_ok_ { err = errors.New("id error"); return }; _v.Id = int32(_tempNum_) } { var _ok_ bool; if _v.S2, _ok_ = _buf["s2"].(string); !_ok_ { err = errors.New("s2 error"); return } } { var _ok_ bool; if _v.S3, _ok_ = _buf["s3"].(string); !_ok_ { err = errors.New("s3 error"); return } } return } func DeserializeTestCompactString(_buf map[string]interface{}) (*TestCompactString, error) { v := &TestCompactString{} if err := v.Deserialize(_buf); err == nil { return v, nil } else { return nil, err } } <|start_filename|>Projects/GenerateDatas/convert_lua/tag.TbTestTag/3003.lua<|end_filename|> return { id = 3003, value = "test", } <|start_filename|>Projects/DataTemplates/template_erlang2/error_tberrorinfo.erl<|end_filename|> %% error.TbErrorInfo -module(error_tberrorinfo) -export([get/1,get_ids/0]) get("EXAMPLE_FLASH") -> #{ code => "EXAMPLE_FLASH", desc => "这是一个例子飘窗", style => bean }. get("EXAMPLE_MSGBOX") -> #{ code => "EXAMPLE_MSGBOX", desc => "例子弹框,消息决定行为", style => bean }. get("EXAMPLE_DLG_OK") -> #{ code => "EXAMPLE_DLG_OK", desc => "例子:单按钮提示,用户自己提供回调", style => bean }. get("EXAMPLE_DLG_OK_CANCEL") -> #{ code => "EXAMPLE_DLG_OK_CANCEL", desc => "例子:双按钮提示,用户自己提供回调", style => bean }. get("ROLE_CREATE_NAME_INVALID_CHAR") -> #{ code => "ROLE_CREATE_NAME_INVALID_CHAR", desc => "角色名字有非法字符", style => bean }. get("ROLE_CREATE_NAME_EMPTY") -> #{ code => "ROLE_CREATE_NAME_EMPTY", desc => "名字为空", style => bean }. get("ROLE_CREATE_NAME_EXCEED_MAX_LENGTH") -> #{ code => "ROLE_CREATE_NAME_EXCEED_MAX_LENGTH", desc => "名字太长", style => bean }. get("ROLE_CREATE_ROLE_LIST_FULL") -> #{ code => "ROLE_CREATE_ROLE_LIST_FULL", desc => "角色列表已满", style => bean }. get("ROLE_CREATE_INVALID_PROFESSION") -> #{ code => "ROLE_CREATE_INVALID_PROFESSION", desc => "非法职业", style => bean }. get("PARAM_ILLEGAL") -> #{ code => "PARAM_ILLEGAL", desc => "参数非法", style => bean }. get("BAG_IS_FULL") -> #{ code => "BAG_IS_FULL", desc => "背包已满", style => bean }. get("ITEM_NOT_ENOUGH") -> #{ code => "ITEM_NOT_ENOUGH", desc => "道具不足", style => bean }. get("ITEM_IN_BAG") -> #{ code => "ITEM_IN_BAG", desc => "道具已在背包中", style => bean }. get("GENDER_NOT_MATCH") -> #{ code => "GENDER_NOT_MATCH", desc => "", style => bean }. get("LEVEL_TOO_LOW") -> #{ code => "LEVEL_TOO_LOW", desc => "等级太低", style => bean }. get("LEVEL_TOO_HIGH") -> #{ code => "LEVEL_TOO_HIGH", desc => "等级太高", style => bean }. get("EXCEED_LIMIT") -> #{ code => "EXCEED_LIMIT", desc => "超过限制", style => bean }. get("OVER_TIME") -> #{ code => "OVER_TIME", desc => "超时", style => bean }. get("SKILL_NOT_IN_LIST") -> #{ code => "SKILL_NOT_IN_LIST", desc => "", style => bean }. get("SKILL_NOT_COOLDOWN") -> #{ code => "SKILL_NOT_COOLDOWN", desc => "", style => bean }. get("SKILL_TARGET_NOT_EXIST") -> #{ code => "SKILL_TARGET_NOT_EXIST", desc => "", style => bean }. get("SKILL_ANOTHER_CASTING") -> #{ code => "SKILL_ANOTHER_CASTING", desc => "", style => bean }. get("MAIL_TYPE_ERROR") -> #{ code => "MAIL_TYPE_ERROR", desc => "邮件类型错误", style => bean }. get("MAIL_HAVE_DELETED") -> #{ code => "MAIL_HAVE_DELETED", desc => "邮件已删除", style => bean }. get("MAIL_AWARD_HAVE_RECEIVED") -> #{ code => "MAIL_AWARD_HAVE_RECEIVED", desc => "邮件奖励已领取", style => bean }. get("MAIL_OPERATE_TYPE_ERROR") -> #{ code => "MAIL_OPERATE_TYPE_ERROR", desc => "邮件操作类型错误", style => bean }. get("MAIL_CONDITION_NOT_MEET") -> #{ code => "MAIL_CONDITION_NOT_MEET", desc => "邮件条件不满足", style => bean }. get("MAIL_NO_AWARD") -> #{ code => "MAIL_NO_AWARD", desc => "邮件没有奖励", style => bean }. get("MAIL_BOX_IS_FULL") -> #{ code => "MAIL_BOX_IS_FULL", desc => "邮箱已满", style => bean }. get("NO_INTERACTION_COMPONENT") -> #{ code => "NO_INTERACTION_COMPONENT", desc => "在被拾取对象上,找不到交互组件!!", style => bean }. get("BUTTON_TOO_MANY_CLICKS") -> #{ code => "BUTTON_TOO_MANY_CLICKS", desc => "点击次数太多了", style => bean }. get("SKILL_ENEYGY_LACK") -> #{ code => "SKILL_ENEYGY_LACK", desc => "技能能量不足", style => bean }. get("SKILL_IS_COOLINGDOWN") -> #{ code => "SKILL_IS_COOLINGDOWN", desc => "技能冷却中", style => bean }. get("SKILL_NO_REACTION_OBJ") -> #{ code => "SKILL_NO_REACTION_OBJ", desc => "当前没有对技能生效的物体", style => bean }. get("SKILL_NOT_UNLOCKED") -> #{ code => "SKILL_NOT_UNLOCKED", desc => "技能尚未解锁", style => bean }. get("SKILL_IS_GROUP_COLLINGDOWN") -> #{ code => "SKILL_IS_GROUP_COLLINGDOWN", desc => "技能释放中", style => bean }. get("CLOTH_CHANGE_TOO_FAST") -> #{ code => "CLOTH_CHANGE_TOO_FAST", desc => "暖暖正在换衣服中,请稍等", style => bean }. get("CLOTH_CHANGE_NOT_ALLOW") -> #{ code => "CLOTH_CHANGE_NOT_ALLOW", desc => "当前状态不允许换装", style => bean }. get("CLOTH_CHANGE_SAME") -> #{ code => "CLOTH_CHANGE_SAME", desc => "换的还是目前的套装", style => bean }. get("HAS_BIND_SERVER") -> #{ code => "HAS_BIND_SERVER", desc => "已经绑定过该服务器", style => bean }. get("AUTH_FAIL") -> #{ code => "AUTH_FAIL", desc => "认证失败", style => bean }. get("NOT_BIND_SERVER") -> #{ code => "NOT_BIND_SERVER", desc => "没有绑定服务器", style => bean }. get("SERVER_ACCESS_FAIL") -> #{ code => "SERVER_ACCESS_FAIL", desc => "访问服务器失败", style => bean }. get("SERVER_NOT_EXISTS") -> #{ code => "SERVER_NOT_EXISTS", desc => "该服务器不存在", style => bean }. get("SUIT_NOT_UNLOCK") -> #{ code => "SUIT_NOT_UNLOCK", desc => "套装尚未解锁", style => bean }. get("SUIT_COMPONENT_NOT_UNLOCK") -> #{ code => "SUIT_COMPONENT_NOT_UNLOCK", desc => "部件尚未解锁", style => bean }. get("SUIT_STATE_ERROR") -> #{ code => "SUIT_STATE_ERROR", desc => "套装状态错误", style => bean }. get("SUIT_COMPONENT_STATE_ERROR") -> #{ code => "SUIT_COMPONENT_STATE_ERROR", desc => "部件状态错误", style => bean }. get("SUIT_COMPONENT_NO_NEED_LEARN") -> #{ code => "SUIT_COMPONENT_NO_NEED_LEARN", desc => "设计图纸对应的部件均已完成学习", style => bean }. get_ids() -> [EXAMPLE_FLASH,EXAMPLE_MSGBOX,EXAMPLE_DLG_OK,EXAMPLE_DLG_OK_CANCEL,ROLE_CREATE_NAME_INVALID_CHAR,ROLE_CREATE_NAME_EMPTY,ROLE_CREATE_NAME_EXCEED_MAX_LENGTH,ROLE_CREATE_ROLE_LIST_FULL,ROLE_CREATE_INVALID_PROFESSION,PARAM_ILLEGAL,BAG_IS_FULL,ITEM_NOT_ENOUGH,ITEM_IN_BAG,GENDER_NOT_MATCH,LEVEL_TOO_LOW,LEVEL_TOO_HIGH,EXCEED_LIMIT,OVER_TIME,SKILL_NOT_IN_LIST,SKILL_NOT_COOLDOWN,SKILL_TARGET_NOT_EXIST,SKILL_ANOTHER_CASTING,MAIL_TYPE_ERROR,MAIL_HAVE_DELETED,MAIL_AWARD_HAVE_RECEIVED,MAIL_OPERATE_TYPE_ERROR,MAIL_CONDITION_NOT_MEET,MAIL_NO_AWARD,MAIL_BOX_IS_FULL,NO_INTERACTION_COMPONENT,BUTTON_TOO_MANY_CLICKS,SKILL_ENEYGY_LACK,SKILL_IS_COOLINGDOWN,SKILL_NO_REACTION_OBJ,SKILL_NOT_UNLOCKED,SKILL_IS_GROUP_COLLINGDOWN,CLOTH_CHANGE_TOO_FAST,CLOTH_CHANGE_NOT_ALLOW,CLOTH_CHANGE_SAME,HAS_BIND_SERVER,AUTH_FAIL,NOT_BIND_SERVER,SERVER_ACCESS_FAIL,SERVER_NOT_EXISTS,SUIT_NOT_UNLOCK,SUIT_COMPONENT_NOT_UNLOCK,SUIT_STATE_ERROR,SUIT_COMPONENT_STATE_ERROR,SUIT_COMPONENT_NO_NEED_LEARN]. <|start_filename|>Projects/Java_bin/src/main/gen/cfg/test/TestSize.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.test; import bright.serialization.*; public final class TestSize { public TestSize(ByteBuf _buf) { id = _buf.readInt(); {int n = Math.min(_buf.readSize(), _buf.size());x1 = new int[n];for(int i = 0 ; i < n ; i++) { int _e;_e = _buf.readInt(); x1[i] = _e;}} {int n = Math.min(_buf.readSize(), _buf.size());x2 = new java.util.ArrayList<Integer>(n);for(int i = 0 ; i < n ; i++) { Integer _e; _e = _buf.readInt(); x2.add(_e);}} {int n = Math.min(_buf.readSize(), _buf.size());x3 = new java.util.HashSet<Integer>(n * 3 / 2);for(int i = 0 ; i < n ; i++) { Integer _e; _e = _buf.readInt(); x3.add(_e);}} {int n = Math.min(_buf.readSize(), _buf.size());x4 = new java.util.HashMap<Integer, Integer>(n * 3 / 2);for(int i = 0 ; i < n ; i++) { Integer _k; _k = _buf.readInt(); Integer _v; _v = _buf.readInt(); x4.put(_k, _v);}} } public TestSize(int id, int[] x1, java.util.ArrayList<Integer> x2, java.util.HashSet<Integer> x3, java.util.HashMap<Integer, Integer> x4 ) { this.id = id; this.x1 = x1; this.x2 = x2; this.x3 = x3; this.x4 = x4; } public final int id; public final int[] x1; public final java.util.ArrayList<Integer> x2; public final java.util.HashSet<Integer> x3; public final java.util.HashMap<Integer, Integer> x4; public void resolve(java.util.HashMap<String, Object> _tables) { } @Override public String toString() { return "{ " + "id:" + id + "," + "x1:" + x1 + "," + "x2:" + x2 + "," + "x3:" + x3 + "," + "x4:" + x4 + "," + "}"; } } <|start_filename|>Projects/GenerateDatas/convert_lua/item.TbItem/1020400001.lua<|end_filename|> return { id = 1020400001, name = "初始裤子", major_type = 2, minor_type = 242, max_pile_num = 1, quality = 0, icon = "/Game/UI/UIText/UI_TestIcon_1.UI_TestIcon_1", icon_backgroud = "", icon_mask = "", desc = "初始下装", show_order = 9, quantifier = "件", show_in_bag = true, min_show_level = 5, batch_usable = true, progress_time_when_use = 1, show_hint_when_use = false, droppable = false, use_type = 0, } <|start_filename|>Projects/Java_bin/src/main/gen/cfg/mail/SystemMail.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.mail; import bright.serialization.*; public final class SystemMail { public SystemMail(ByteBuf _buf) { id = _buf.readInt(); title = _buf.readString(); sender = _buf.readString(); content = _buf.readString(); {int n = Math.min(_buf.readSize(), _buf.size());award = new java.util.ArrayList<Integer>(n);for(int i = 0 ; i < n ; i++) { Integer _e; _e = _buf.readInt(); award.add(_e);}} } public SystemMail(int id, String title, String sender, String content, java.util.ArrayList<Integer> award ) { this.id = id; this.title = title; this.sender = sender; this.content = content; this.award = award; } public final int id; public final String title; public final String sender; public final String content; public final java.util.ArrayList<Integer> award; public void resolve(java.util.HashMap<String, Object> _tables) { } @Override public String toString() { return "{ " + "id:" + id + "," + "title:" + title + "," + "sender:" + sender + "," + "content:" + content + "," + "award:" + award + "," + "}"; } } <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/test/TestString.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.test { public sealed partial class TestString : Bright.Config.BeanBase { public TestString(ByteBuf _buf) { Id = _buf.ReadInt(); S1 = _buf.ReadString(); Cs1 = test.CompactString.DeserializeCompactString(_buf); Cs2 = test.CompactString.DeserializeCompactString(_buf); } public TestString(int id, string s1, test.CompactString cs1, test.CompactString cs2 ) { this.Id = id; this.S1 = s1; this.Cs1 = cs1; this.Cs2 = cs2; } public static TestString DeserializeTestString(ByteBuf _buf) { return new test.TestString(_buf); } public readonly int Id; public readonly string S1; public readonly test.CompactString Cs1; public readonly test.CompactString Cs2; public const int ID = 338485823; public override int GetTypeId() => ID; public void Resolve(Dictionary<string, object> _tables) { Cs1?.Resolve(_tables); Cs2?.Resolve(_tables); OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); public override string ToString() { return "{ " + "Id:" + Id + "," + "S1:" + S1 + "," + "Cs1:" + Cs1 + "," + "Cs2:" + Cs2 + "," + "}"; } } } <|start_filename|>Projects/GenerateDatas/convert_lua/test.TbTestNull/22.lua<|end_filename|> return { id = 22, x1 = 1, x2 = 2, x3 = { x1 = 3, }, x4 = { _name = 'DemoD2', x1 = 1, x2 = 2, }, s1 = "asfs", s2 = {key='/asf/asfa',text="abcdef"}, } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_ContactPoint2D_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_ContactPoint2D_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.ContactPoint2D constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_point(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ContactPoint2D)Puerts.Utils.GetSelf((int)data, self); var result = obj.point; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_normal(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ContactPoint2D)Puerts.Utils.GetSelf((int)data, self); var result = obj.normal; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_separation(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ContactPoint2D)Puerts.Utils.GetSelf((int)data, self); var result = obj.separation; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_normalImpulse(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ContactPoint2D)Puerts.Utils.GetSelf((int)data, self); var result = obj.normalImpulse; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_tangentImpulse(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ContactPoint2D)Puerts.Utils.GetSelf((int)data, self); var result = obj.tangentImpulse; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_relativeVelocity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ContactPoint2D)Puerts.Utils.GetSelf((int)data, self); var result = obj.relativeVelocity; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_collider(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ContactPoint2D)Puerts.Utils.GetSelf((int)data, self); var result = obj.collider; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_otherCollider(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ContactPoint2D)Puerts.Utils.GetSelf((int)data, self); var result = obj.otherCollider; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_rigidbody(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ContactPoint2D)Puerts.Utils.GetSelf((int)data, self); var result = obj.rigidbody; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_otherRigidbody(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ContactPoint2D)Puerts.Utils.GetSelf((int)data, self); var result = obj.otherRigidbody; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_enabled(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ContactPoint2D)Puerts.Utils.GetSelf((int)data, self); var result = obj.enabled; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"point", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_point, Setter = null} }, {"normal", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_normal, Setter = null} }, {"separation", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_separation, Setter = null} }, {"normalImpulse", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_normalImpulse, Setter = null} }, {"tangentImpulse", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_tangentImpulse, Setter = null} }, {"relativeVelocity", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_relativeVelocity, Setter = null} }, {"collider", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_collider, Setter = null} }, {"otherCollider", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_otherCollider, Setter = null} }, {"rigidbody", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_rigidbody, Setter = null} }, {"otherRigidbody", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_otherRigidbody, Setter = null} }, {"enabled", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_enabled, Setter = null} }, } }; } } } <|start_filename|>Projects/DataTemplates/template_lua/test_tbtestnull.lua<|end_filename|> return { [10] = {id=10,}, [11] = {id=11,}, [12] = {id=12,x1=1,x2=1,x3={x1=1,},x4={ _name='DemoD2',x1=2,x2=3,},s1="asf",s2={key='key1',text="abcdef"},}, [20] = {id=20,}, [21] = {id=21,}, [22] = {id=22,x1=1,x2=2,x3={x1=3,},x4={ _name='DemoD2',x1=1,x2=2,},s1="asfs",s2={key='/asf/asfa',text="abcdef"},}, [30] = {id=30,x1=1,x2=1,x3={x1=1,},x4={ _name='DemoD2',x1=1,x2=22,},s1="abcd",s2={key='asdfasew',text="hahaha"},}, [31] = {id=31,}, [1] = {id=1,}, [2] = {id=2,x1=1,x2=1,x3={x1=3,},x4={ _name='DemoD2',x1=1,x2=2,},s1="asfasfasf",s2={key='/keyasf',text="asf"},}, [3] = {id=3,s1="",s2={key='',text=""},}, } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/TsScripts/output/Main.js<|end_filename|> "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const cfg = require("Gen/Cfg/Types"); const csharp_1 = require("csharp"); let tables = new cfg.Tables(f => { let data = csharp_1.JsHelpers.ReadAllText(csharp_1.UnityEngine.Application.dataPath + "/../../GenerateDatas/json", f + ".json"); return JSON.parse(data); }); console.log(tables.TbGlobalConfig.bagCapacity); console.log(tables.TbItem.get(1).name); console.log("== load succ =="); <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_ParticleSystem_MinMaxGradient_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_ParticleSystem_MinMaxGradient_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Color), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Color>(false); var result = new UnityEngine.ParticleSystem.MinMaxGradient(Arg0); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.ParticleSystem.MinMaxGradient), result); } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Gradient), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Gradient>(false); var result = new UnityEngine.ParticleSystem.MinMaxGradient(Arg0); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.ParticleSystem.MinMaxGradient), result); } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Color), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Color), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Color>(false); var Arg1 = argHelper1.Get<UnityEngine.Color>(false); var result = new UnityEngine.ParticleSystem.MinMaxGradient(Arg0,Arg1); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.ParticleSystem.MinMaxGradient), result); } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Gradient), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Gradient), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Gradient>(false); var Arg1 = argHelper1.Get<UnityEngine.Gradient>(false); var result = new UnityEngine.ParticleSystem.MinMaxGradient(Arg0,Arg1); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.ParticleSystem.MinMaxGradient), result); } } if (paramLen == 0) { { var result = new UnityEngine.ParticleSystem.MinMaxGradient(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.ParticleSystem.MinMaxGradient), result); } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.ParticleSystem.MinMaxGradient constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Evaluate(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MinMaxGradient)Puerts.Utils.GetSelf((int)data, self); if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetFloat(false); var result = obj.Evaluate(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.GetFloat(false); var result = obj.Evaluate(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to Evaluate"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_mode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MinMaxGradient)Puerts.Utils.GetSelf((int)data, self); var result = obj.mode; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_mode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MinMaxGradient)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.mode = (UnityEngine.ParticleSystemGradientMode)argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_gradientMax(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MinMaxGradient)Puerts.Utils.GetSelf((int)data, self); var result = obj.gradientMax; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_gradientMax(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MinMaxGradient)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.gradientMax = argHelper.Get<UnityEngine.Gradient>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_gradientMin(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MinMaxGradient)Puerts.Utils.GetSelf((int)data, self); var result = obj.gradientMin; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_gradientMin(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MinMaxGradient)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.gradientMin = argHelper.Get<UnityEngine.Gradient>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_colorMax(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MinMaxGradient)Puerts.Utils.GetSelf((int)data, self); var result = obj.colorMax; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_colorMax(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MinMaxGradient)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.colorMax = argHelper.Get<UnityEngine.Color>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_colorMin(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MinMaxGradient)Puerts.Utils.GetSelf((int)data, self); var result = obj.colorMin; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_colorMin(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MinMaxGradient)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.colorMin = argHelper.Get<UnityEngine.Color>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_color(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MinMaxGradient)Puerts.Utils.GetSelf((int)data, self); var result = obj.color; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_color(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MinMaxGradient)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.color = argHelper.Get<UnityEngine.Color>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_gradient(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MinMaxGradient)Puerts.Utils.GetSelf((int)data, self); var result = obj.gradient; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_gradient(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MinMaxGradient)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.gradient = argHelper.Get<UnityEngine.Gradient>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "Evaluate", IsStatic = false}, M_Evaluate }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"mode", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_mode, Setter = S_mode} }, {"gradientMax", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_gradientMax, Setter = S_gradientMax} }, {"gradientMin", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_gradientMin, Setter = S_gradientMin} }, {"colorMax", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_colorMax, Setter = S_colorMax} }, {"colorMin", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_colorMin, Setter = S_colorMin} }, {"color", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_color, Setter = S_color} }, {"gradient", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_gradient, Setter = S_gradient} }, } }; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_AudioReverbZone_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_AudioReverbZone_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.AudioReverbZone(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.AudioReverbZone), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_minDistance(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AudioReverbZone; var result = obj.minDistance; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_minDistance(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AudioReverbZone; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.minDistance = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_maxDistance(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AudioReverbZone; var result = obj.maxDistance; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_maxDistance(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AudioReverbZone; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.maxDistance = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_reverbPreset(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AudioReverbZone; var result = obj.reverbPreset; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_reverbPreset(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AudioReverbZone; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.reverbPreset = (UnityEngine.AudioReverbPreset)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_room(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AudioReverbZone; var result = obj.room; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_room(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AudioReverbZone; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.room = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_roomHF(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AudioReverbZone; var result = obj.roomHF; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_roomHF(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AudioReverbZone; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.roomHF = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_roomLF(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AudioReverbZone; var result = obj.roomLF; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_roomLF(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AudioReverbZone; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.roomLF = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_decayTime(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AudioReverbZone; var result = obj.decayTime; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_decayTime(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AudioReverbZone; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.decayTime = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_decayHFRatio(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AudioReverbZone; var result = obj.decayHFRatio; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_decayHFRatio(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AudioReverbZone; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.decayHFRatio = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_reflections(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AudioReverbZone; var result = obj.reflections; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_reflections(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AudioReverbZone; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.reflections = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_reflectionsDelay(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AudioReverbZone; var result = obj.reflectionsDelay; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_reflectionsDelay(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AudioReverbZone; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.reflectionsDelay = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_reverb(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AudioReverbZone; var result = obj.reverb; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_reverb(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AudioReverbZone; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.reverb = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_reverbDelay(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AudioReverbZone; var result = obj.reverbDelay; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_reverbDelay(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AudioReverbZone; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.reverbDelay = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_HFReference(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AudioReverbZone; var result = obj.HFReference; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_HFReference(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AudioReverbZone; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.HFReference = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_LFReference(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AudioReverbZone; var result = obj.LFReference; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_LFReference(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AudioReverbZone; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.LFReference = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_diffusion(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AudioReverbZone; var result = obj.diffusion; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_diffusion(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AudioReverbZone; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.diffusion = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_density(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AudioReverbZone; var result = obj.density; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_density(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AudioReverbZone; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.density = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"minDistance", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_minDistance, Setter = S_minDistance} }, {"maxDistance", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_maxDistance, Setter = S_maxDistance} }, {"reverbPreset", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_reverbPreset, Setter = S_reverbPreset} }, {"room", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_room, Setter = S_room} }, {"roomHF", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_roomHF, Setter = S_roomHF} }, {"roomLF", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_roomLF, Setter = S_roomLF} }, {"decayTime", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_decayTime, Setter = S_decayTime} }, {"decayHFRatio", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_decayHFRatio, Setter = S_decayHFRatio} }, {"reflections", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_reflections, Setter = S_reflections} }, {"reflectionsDelay", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_reflectionsDelay, Setter = S_reflectionsDelay} }, {"reverb", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_reverb, Setter = S_reverb} }, {"reverbDelay", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_reverbDelay, Setter = S_reverbDelay} }, {"HFReference", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_HFReference, Setter = S_HFReference} }, {"LFReference", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_LFReference, Setter = S_LFReference} }, {"diffusion", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_diffusion, Setter = S_diffusion} }, {"density", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_density, Setter = S_density} }, } }; } } } <|start_filename|>Projects/Csharp_DotNet5_json_ExportServer/Gen/role/LevelExpAttr.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; using System.Text.Json; namespace cfg.role { public sealed class LevelExpAttr : Bright.Config.BeanBase { public LevelExpAttr(JsonElement _json) { Level = _json.GetProperty("level").GetInt32(); NeedExp = _json.GetProperty("need_exp").GetInt64(); { var _json0 = _json.GetProperty("clothes_attrs"); ClothesAttrs = new System.Collections.Generic.List<int>(_json0.GetArrayLength()); foreach(JsonElement __e in _json0.EnumerateArray()) { int __v; __v = __e.GetInt32(); ClothesAttrs.Add(__v); } } } public LevelExpAttr(int level, long need_exp, System.Collections.Generic.List<int> clothes_attrs ) { this.Level = level; this.NeedExp = need_exp; this.ClothesAttrs = clothes_attrs; } public static LevelExpAttr DeserializeLevelExpAttr(JsonElement _json) { return new role.LevelExpAttr(_json); } public int Level { get; private set; } public long NeedExp { get; private set; } public System.Collections.Generic.List<int> ClothesAttrs { get; private set; } public const int __ID__ = -1569837022; public override int GetTypeId() => __ID__; public void Resolve(Dictionary<string, object> _tables) { } public void TranslateText(System.Func<string, string, string> translator) { } public override string ToString() { return "{ " + "Level:" + Level + "," + "NeedExp:" + NeedExp + "," + "ClothesAttrs:" + Bright.Common.StringUtil.CollectionToString(ClothesAttrs) + "," + "}"; } } } <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/condition/MultiRoleCondition.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.condition { public sealed partial class MultiRoleCondition : condition.RoleCondition { public MultiRoleCondition(ByteBuf _buf) : base(_buf) { {int n = System.Math.Min(_buf.ReadSize(), _buf.Size);Conditions = new condition.RoleCondition[n];for(var i = 0 ; i < n ; i++) { condition.RoleCondition _e;_e = condition.RoleCondition.DeserializeRoleCondition(_buf); Conditions[i] = _e;}} } public MultiRoleCondition(condition.RoleCondition[] conditions ) : base() { this.Conditions = conditions; } public static MultiRoleCondition DeserializeMultiRoleCondition(ByteBuf _buf) { return new condition.MultiRoleCondition(_buf); } public readonly condition.RoleCondition[] Conditions; public const int ID = 934079583; public override int GetTypeId() => ID; public override void Resolve(Dictionary<string, object> _tables) { base.Resolve(_tables); foreach(var _e in Conditions) { _e?.Resolve(_tables); } OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); public override string ToString() { return "{ " + "Conditions:" + Bright.Common.StringUtil.CollectionToString(Conditions) + "," + "}"; } } } <|start_filename|>Projects/GenerateDatas/convert_lua/l10n.TbL10NDemo/12.lua<|end_filename|> return { id = 12, text = {key='/demo/2',text="测试2"}, } <|start_filename|>Projects/Lua_Unity_xlua_lua/Assets/Lua/Data/bonus_tbdrop.lua<|end_filename|> return { [1] = {id=1,desc="奖励一个物品",client_show_items={},bonus={ _name='OneItem',item_id=1021490001,},}, [2] = {id=2,desc="随机掉落一个",client_show_items={},bonus={ _name='OneItem',item_id=1021490001,},}, } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_Mesh_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_Mesh_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.Mesh(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.Mesh), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetIndexBufferParams(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Mesh; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.GetInt32(false); var Arg1 = (UnityEngine.Rendering.IndexFormat)argHelper1.GetInt32(false); obj.SetIndexBufferParams(Arg0,Arg1); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetVertexAttribute(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Mesh; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); var result = obj.GetVertexAttribute(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_HasVertexAttribute(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Mesh; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = (UnityEngine.Rendering.VertexAttribute)argHelper0.GetInt32(false); var result = obj.HasVertexAttribute(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetVertexAttributeDimension(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Mesh; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = (UnityEngine.Rendering.VertexAttribute)argHelper0.GetInt32(false); var result = obj.GetVertexAttributeDimension(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetVertexAttributeFormat(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Mesh; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = (UnityEngine.Rendering.VertexAttribute)argHelper0.GetInt32(false); var result = obj.GetVertexAttributeFormat(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetNativeVertexBufferPtr(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Mesh; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); var result = obj.GetNativeVertexBufferPtr(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetNativeIndexBufferPtr(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Mesh; { { var result = obj.GetNativeIndexBufferPtr(); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ClearBlendShapes(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Mesh; { { obj.ClearBlendShapes(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetBlendShapeName(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Mesh; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); var result = obj.GetBlendShapeName(Arg0); Puerts.PuertsDLL.ReturnString(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetBlendShapeIndex(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Mesh; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetString(false); var result = obj.GetBlendShapeIndex(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetBlendShapeFrameCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Mesh; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); var result = obj.GetBlendShapeFrameCount(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetBlendShapeFrameWeight(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Mesh; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var result = obj.GetBlendShapeFrameWeight(Arg0,Arg1); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetBlendShapeFrameVertices(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Mesh; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.Get<UnityEngine.Vector3[]>(false); var Arg3 = argHelper3.Get<UnityEngine.Vector3[]>(false); var Arg4 = argHelper4.Get<UnityEngine.Vector3[]>(false); obj.GetBlendShapeFrameVertices(Arg0,Arg1,Arg2,Arg3,Arg4); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_AddBlendShapeFrame(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Mesh; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.Get<UnityEngine.Vector3[]>(false); var Arg3 = argHelper3.Get<UnityEngine.Vector3[]>(false); var Arg4 = argHelper4.Get<UnityEngine.Vector3[]>(false); obj.AddBlendShapeFrame(Arg0,Arg1,Arg2,Arg3,Arg4); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetBoneWeights(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Mesh; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<Unity.Collections.NativeArray<byte>>(false); var Arg1 = argHelper1.Get<Unity.Collections.NativeArray<UnityEngine.BoneWeight1>>(false); obj.SetBoneWeights(Arg0,Arg1); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetAllBoneWeights(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Mesh; { { var result = obj.GetAllBoneWeights(); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetBonesPerVertex(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Mesh; { { var result = obj.GetBonesPerVertex(); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetSubMesh(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Mesh; if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rendering.SubMeshDescriptor), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.Rendering.SubMeshDescriptor>(false); var Arg2 = (UnityEngine.Rendering.MeshUpdateFlags)argHelper2.GetInt32(false); obj.SetSubMesh(Arg0,Arg1,Arg2); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rendering.SubMeshDescriptor), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.Rendering.SubMeshDescriptor>(false); obj.SetSubMesh(Arg0,Arg1); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SetSubMesh"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetSubMesh(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Mesh; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); var result = obj.GetSubMesh(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_MarkModified(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Mesh; { { obj.MarkModified(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetUVDistributionMetric(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Mesh; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); var result = obj.GetUVDistributionMetric(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetVertices(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Mesh; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.Collections.Generic.List<UnityEngine.Vector3>>(false); obj.GetVertices(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetVertices(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Mesh; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Vector3>), false, false)) { var Arg0 = argHelper0.Get<System.Collections.Generic.List<UnityEngine.Vector3>>(false); obj.SetVertices(Arg0); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3[]>(false); obj.SetVertices(Arg0); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Vector3>), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<System.Collections.Generic.List<UnityEngine.Vector3>>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); obj.SetVertices(Arg0,Arg1,Arg2); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3[]), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3[]>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); obj.SetVertices(Arg0,Arg1,Arg2); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Vector3>), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<System.Collections.Generic.List<UnityEngine.Vector3>>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = (UnityEngine.Rendering.MeshUpdateFlags)argHelper3.GetInt32(false); obj.SetVertices(Arg0,Arg1,Arg2,Arg3); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3[]), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3[]>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = (UnityEngine.Rendering.MeshUpdateFlags)argHelper3.GetInt32(false); obj.SetVertices(Arg0,Arg1,Arg2,Arg3); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SetVertices"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetNormals(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Mesh; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.Collections.Generic.List<UnityEngine.Vector3>>(false); obj.GetNormals(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetNormals(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Mesh; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Vector3>), false, false)) { var Arg0 = argHelper0.Get<System.Collections.Generic.List<UnityEngine.Vector3>>(false); obj.SetNormals(Arg0); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3[]>(false); obj.SetNormals(Arg0); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Vector3>), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<System.Collections.Generic.List<UnityEngine.Vector3>>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); obj.SetNormals(Arg0,Arg1,Arg2); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3[]), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3[]>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); obj.SetNormals(Arg0,Arg1,Arg2); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Vector3>), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<System.Collections.Generic.List<UnityEngine.Vector3>>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = (UnityEngine.Rendering.MeshUpdateFlags)argHelper3.GetInt32(false); obj.SetNormals(Arg0,Arg1,Arg2,Arg3); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3[]), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3[]>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = (UnityEngine.Rendering.MeshUpdateFlags)argHelper3.GetInt32(false); obj.SetNormals(Arg0,Arg1,Arg2,Arg3); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SetNormals"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetTangents(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Mesh; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.Collections.Generic.List<UnityEngine.Vector4>>(false); obj.GetTangents(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetTangents(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Mesh; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Vector4>), false, false)) { var Arg0 = argHelper0.Get<System.Collections.Generic.List<UnityEngine.Vector4>>(false); obj.SetTangents(Arg0); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector4[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector4[]>(false); obj.SetTangents(Arg0); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Vector4>), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<System.Collections.Generic.List<UnityEngine.Vector4>>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); obj.SetTangents(Arg0,Arg1,Arg2); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector4[]), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector4[]>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); obj.SetTangents(Arg0,Arg1,Arg2); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Vector4>), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<System.Collections.Generic.List<UnityEngine.Vector4>>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = (UnityEngine.Rendering.MeshUpdateFlags)argHelper3.GetInt32(false); obj.SetTangents(Arg0,Arg1,Arg2,Arg3); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector4[]), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector4[]>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = (UnityEngine.Rendering.MeshUpdateFlags)argHelper3.GetInt32(false); obj.SetTangents(Arg0,Arg1,Arg2,Arg3); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SetTangents"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetColors(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Mesh; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Color>), false, false)) { var Arg0 = argHelper0.Get<System.Collections.Generic.List<UnityEngine.Color>>(false); obj.GetColors(Arg0); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Color32>), false, false)) { var Arg0 = argHelper0.Get<System.Collections.Generic.List<UnityEngine.Color32>>(false); obj.GetColors(Arg0); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetColors"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetColors(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Mesh; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Color>), false, false)) { var Arg0 = argHelper0.Get<System.Collections.Generic.List<UnityEngine.Color>>(false); obj.SetColors(Arg0); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Color[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Color[]>(false); obj.SetColors(Arg0); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Color32>), false, false)) { var Arg0 = argHelper0.Get<System.Collections.Generic.List<UnityEngine.Color32>>(false); obj.SetColors(Arg0); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Color32[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Color32[]>(false); obj.SetColors(Arg0); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Color>), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<System.Collections.Generic.List<UnityEngine.Color>>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); obj.SetColors(Arg0,Arg1,Arg2); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Color[]), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Color[]>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); obj.SetColors(Arg0,Arg1,Arg2); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Color32>), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<System.Collections.Generic.List<UnityEngine.Color32>>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); obj.SetColors(Arg0,Arg1,Arg2); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Color32[]), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Color32[]>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); obj.SetColors(Arg0,Arg1,Arg2); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Color>), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<System.Collections.Generic.List<UnityEngine.Color>>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = (UnityEngine.Rendering.MeshUpdateFlags)argHelper3.GetInt32(false); obj.SetColors(Arg0,Arg1,Arg2,Arg3); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Color[]), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Color[]>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = (UnityEngine.Rendering.MeshUpdateFlags)argHelper3.GetInt32(false); obj.SetColors(Arg0,Arg1,Arg2,Arg3); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Color32>), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<System.Collections.Generic.List<UnityEngine.Color32>>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = (UnityEngine.Rendering.MeshUpdateFlags)argHelper3.GetInt32(false); obj.SetColors(Arg0,Arg1,Arg2,Arg3); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Color32[]), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Color32[]>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = (UnityEngine.Rendering.MeshUpdateFlags)argHelper3.GetInt32(false); obj.SetColors(Arg0,Arg1,Arg2,Arg3); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SetColors"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetUVs(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Mesh; if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Vector2>), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<System.Collections.Generic.List<UnityEngine.Vector2>>(false); obj.SetUVs(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Vector3>), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<System.Collections.Generic.List<UnityEngine.Vector3>>(false); obj.SetUVs(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Vector4>), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<System.Collections.Generic.List<UnityEngine.Vector4>>(false); obj.SetUVs(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2[]), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2[]>(false); obj.SetUVs(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3[]), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3[]>(false); obj.SetUVs(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector4[]), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.Vector4[]>(false); obj.SetUVs(Arg0,Arg1); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Vector2>), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<System.Collections.Generic.List<UnityEngine.Vector2>>(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetInt32(false); obj.SetUVs(Arg0,Arg1,Arg2,Arg3); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Vector3>), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<System.Collections.Generic.List<UnityEngine.Vector3>>(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetInt32(false); obj.SetUVs(Arg0,Arg1,Arg2,Arg3); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Vector4>), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<System.Collections.Generic.List<UnityEngine.Vector4>>(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetInt32(false); obj.SetUVs(Arg0,Arg1,Arg2,Arg3); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2[]), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2[]>(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetInt32(false); obj.SetUVs(Arg0,Arg1,Arg2,Arg3); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3[]), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3[]>(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetInt32(false); obj.SetUVs(Arg0,Arg1,Arg2,Arg3); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector4[]), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.Vector4[]>(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetInt32(false); obj.SetUVs(Arg0,Arg1,Arg2,Arg3); return; } } if (paramLen == 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Vector2>), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<System.Collections.Generic.List<UnityEngine.Vector2>>(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetInt32(false); var Arg4 = (UnityEngine.Rendering.MeshUpdateFlags)argHelper4.GetInt32(false); obj.SetUVs(Arg0,Arg1,Arg2,Arg3,Arg4); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Vector3>), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<System.Collections.Generic.List<UnityEngine.Vector3>>(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetInt32(false); var Arg4 = (UnityEngine.Rendering.MeshUpdateFlags)argHelper4.GetInt32(false); obj.SetUVs(Arg0,Arg1,Arg2,Arg3,Arg4); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Vector4>), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<System.Collections.Generic.List<UnityEngine.Vector4>>(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetInt32(false); var Arg4 = (UnityEngine.Rendering.MeshUpdateFlags)argHelper4.GetInt32(false); obj.SetUVs(Arg0,Arg1,Arg2,Arg3,Arg4); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2[]), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2[]>(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetInt32(false); var Arg4 = (UnityEngine.Rendering.MeshUpdateFlags)argHelper4.GetInt32(false); obj.SetUVs(Arg0,Arg1,Arg2,Arg3,Arg4); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3[]), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3[]>(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetInt32(false); var Arg4 = (UnityEngine.Rendering.MeshUpdateFlags)argHelper4.GetInt32(false); obj.SetUVs(Arg0,Arg1,Arg2,Arg3,Arg4); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector4[]), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.Vector4[]>(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetInt32(false); var Arg4 = (UnityEngine.Rendering.MeshUpdateFlags)argHelper4.GetInt32(false); obj.SetUVs(Arg0,Arg1,Arg2,Arg3,Arg4); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SetUVs"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetUVs(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Mesh; if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Vector2>), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<System.Collections.Generic.List<UnityEngine.Vector2>>(false); obj.GetUVs(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Vector3>), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<System.Collections.Generic.List<UnityEngine.Vector3>>(false); obj.GetUVs(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Vector4>), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<System.Collections.Generic.List<UnityEngine.Vector4>>(false); obj.GetUVs(Arg0,Arg1); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetUVs"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetVertexAttributes(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Mesh; if (paramLen == 0) { { var result = obj.GetVertexAttributes(); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rendering.VertexAttributeDescriptor[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rendering.VertexAttributeDescriptor[]>(false); var result = obj.GetVertexAttributes(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Rendering.VertexAttributeDescriptor>), false, false)) { var Arg0 = argHelper0.Get<System.Collections.Generic.List<UnityEngine.Rendering.VertexAttributeDescriptor>>(false); var result = obj.GetVertexAttributes(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetVertexAttributes"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetVertexBufferParams(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Mesh; if (paramLen >= 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rendering.VertexAttributeDescriptor), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetParams<UnityEngine.Rendering.VertexAttributeDescriptor>(info, 1, paramLen); obj.SetVertexBufferParams(Arg0,Arg1); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(Unity.Collections.NativeArray<UnityEngine.Rendering.VertexAttributeDescriptor>), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<Unity.Collections.NativeArray<UnityEngine.Rendering.VertexAttributeDescriptor>>(false); obj.SetVertexBufferParams(Arg0,Arg1); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SetVertexBufferParams"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_AcquireReadOnlyMeshData(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh>(false); var result = UnityEngine.Mesh.AcquireReadOnlyMeshData(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh[]>(false); var result = UnityEngine.Mesh.AcquireReadOnlyMeshData(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Mesh>), false, false)) { var Arg0 = argHelper0.Get<System.Collections.Generic.List<UnityEngine.Mesh>>(false); var result = UnityEngine.Mesh.AcquireReadOnlyMeshData(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to AcquireReadOnlyMeshData"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_AllocateWritableMeshData(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); var result = UnityEngine.Mesh.AllocateWritableMeshData(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_ApplyAndDisposeWritableMeshData(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh.MeshDataArray), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh.MeshDataArray>(false); var Arg1 = argHelper1.Get<UnityEngine.Mesh>(false); var Arg2 = (UnityEngine.Rendering.MeshUpdateFlags)argHelper2.GetInt32(false); UnityEngine.Mesh.ApplyAndDisposeWritableMeshData(Arg0,Arg1,Arg2); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh.MeshDataArray), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh[]), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh.MeshDataArray>(false); var Arg1 = argHelper1.Get<UnityEngine.Mesh[]>(false); var Arg2 = (UnityEngine.Rendering.MeshUpdateFlags)argHelper2.GetInt32(false); UnityEngine.Mesh.ApplyAndDisposeWritableMeshData(Arg0,Arg1,Arg2); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh.MeshDataArray), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Mesh>), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh.MeshDataArray>(false); var Arg1 = argHelper1.Get<System.Collections.Generic.List<UnityEngine.Mesh>>(false); var Arg2 = (UnityEngine.Rendering.MeshUpdateFlags)argHelper2.GetInt32(false); UnityEngine.Mesh.ApplyAndDisposeWritableMeshData(Arg0,Arg1,Arg2); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh.MeshDataArray), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh.MeshDataArray>(false); var Arg1 = argHelper1.Get<UnityEngine.Mesh>(false); UnityEngine.Mesh.ApplyAndDisposeWritableMeshData(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh.MeshDataArray), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh.MeshDataArray>(false); var Arg1 = argHelper1.Get<UnityEngine.Mesh[]>(false); UnityEngine.Mesh.ApplyAndDisposeWritableMeshData(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh.MeshDataArray), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Mesh>), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh.MeshDataArray>(false); var Arg1 = argHelper1.Get<System.Collections.Generic.List<UnityEngine.Mesh>>(false); UnityEngine.Mesh.ApplyAndDisposeWritableMeshData(Arg0,Arg1); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to ApplyAndDisposeWritableMeshData"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetTriangles(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Mesh; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var result = obj.GetTriangles(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetBoolean(false); var result = obj.GetTriangles(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<int>), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<System.Collections.Generic.List<int>>(false); var Arg1 = argHelper1.GetInt32(false); obj.GetTriangles(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<ushort>), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<System.Collections.Generic.List<ushort>>(false); var Arg1 = argHelper1.GetInt32(false); obj.GetTriangles(Arg0,Arg1); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<int>), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.Get<System.Collections.Generic.List<int>>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetBoolean(false); obj.GetTriangles(Arg0,Arg1,Arg2); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<ushort>), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.Get<System.Collections.Generic.List<ushort>>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetBoolean(false); obj.GetTriangles(Arg0,Arg1,Arg2); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetTriangles"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetIndices(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Mesh; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var result = obj.GetIndices(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetBoolean(false); var result = obj.GetIndices(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<int>), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<System.Collections.Generic.List<int>>(false); var Arg1 = argHelper1.GetInt32(false); obj.GetIndices(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<ushort>), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<System.Collections.Generic.List<ushort>>(false); var Arg1 = argHelper1.GetInt32(false); obj.GetIndices(Arg0,Arg1); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<int>), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.Get<System.Collections.Generic.List<int>>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetBoolean(false); obj.GetIndices(Arg0,Arg1,Arg2); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<ushort>), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.Get<System.Collections.Generic.List<ushort>>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetBoolean(false); obj.GetIndices(Arg0,Arg1,Arg2); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetIndices"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetIndexStart(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Mesh; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); var result = obj.GetIndexStart(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetIndexCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Mesh; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); var result = obj.GetIndexCount(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetBaseVertex(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Mesh; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); var result = obj.GetBaseVertex(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetTriangles(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Mesh; if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(int[]), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<int[]>(false); var Arg1 = argHelper1.GetInt32(false); obj.SetTriangles(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(ushort[]), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<ushort[]>(false); var Arg1 = argHelper1.GetInt32(false); obj.SetTriangles(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<int>), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<System.Collections.Generic.List<int>>(false); var Arg1 = argHelper1.GetInt32(false); obj.SetTriangles(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<ushort>), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<System.Collections.Generic.List<ushort>>(false); var Arg1 = argHelper1.GetInt32(false); obj.SetTriangles(Arg0,Arg1); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(int[]), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.Get<int[]>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetBoolean(false); obj.SetTriangles(Arg0,Arg1,Arg2); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(ushort[]), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.Get<ushort[]>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetBoolean(false); obj.SetTriangles(Arg0,Arg1,Arg2); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<int>), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.Get<System.Collections.Generic.List<int>>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetBoolean(false); obj.SetTriangles(Arg0,Arg1,Arg2); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<ushort>), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.Get<System.Collections.Generic.List<ushort>>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetBoolean(false); obj.SetTriangles(Arg0,Arg1,Arg2); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(int[]), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<int[]>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetBoolean(false); var Arg3 = argHelper3.GetInt32(false); obj.SetTriangles(Arg0,Arg1,Arg2,Arg3); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(int[]), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<int[]>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetInt32(false); obj.SetTriangles(Arg0,Arg1,Arg2,Arg3); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(ushort[]), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<ushort[]>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetBoolean(false); var Arg3 = argHelper3.GetInt32(false); obj.SetTriangles(Arg0,Arg1,Arg2,Arg3); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(ushort[]), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<ushort[]>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetInt32(false); obj.SetTriangles(Arg0,Arg1,Arg2,Arg3); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<int>), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<System.Collections.Generic.List<int>>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetBoolean(false); var Arg3 = argHelper3.GetInt32(false); obj.SetTriangles(Arg0,Arg1,Arg2,Arg3); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<int>), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<System.Collections.Generic.List<int>>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetInt32(false); obj.SetTriangles(Arg0,Arg1,Arg2,Arg3); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<ushort>), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<System.Collections.Generic.List<ushort>>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetBoolean(false); var Arg3 = argHelper3.GetInt32(false); obj.SetTriangles(Arg0,Arg1,Arg2,Arg3); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<ushort>), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<System.Collections.Generic.List<ushort>>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetInt32(false); obj.SetTriangles(Arg0,Arg1,Arg2,Arg3); return; } } if (paramLen == 6) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(int[]), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<int[]>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetInt32(false); var Arg4 = argHelper4.GetBoolean(false); var Arg5 = argHelper5.GetInt32(false); obj.SetTriangles(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(ushort[]), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<ushort[]>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetInt32(false); var Arg4 = argHelper4.GetBoolean(false); var Arg5 = argHelper5.GetInt32(false); obj.SetTriangles(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<int>), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<System.Collections.Generic.List<int>>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetInt32(false); var Arg4 = argHelper4.GetBoolean(false); var Arg5 = argHelper5.GetInt32(false); obj.SetTriangles(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<ushort>), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<System.Collections.Generic.List<ushort>>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetInt32(false); var Arg4 = argHelper4.GetBoolean(false); var Arg5 = argHelper5.GetInt32(false); obj.SetTriangles(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); return; } } if (paramLen == 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(int[]), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.Get<int[]>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetInt32(false); var Arg4 = argHelper4.GetBoolean(false); obj.SetTriangles(Arg0,Arg1,Arg2,Arg3,Arg4); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(ushort[]), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.Get<ushort[]>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetInt32(false); var Arg4 = argHelper4.GetBoolean(false); obj.SetTriangles(Arg0,Arg1,Arg2,Arg3,Arg4); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<int>), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.Get<System.Collections.Generic.List<int>>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetInt32(false); var Arg4 = argHelper4.GetBoolean(false); obj.SetTriangles(Arg0,Arg1,Arg2,Arg3,Arg4); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<ushort>), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.Get<System.Collections.Generic.List<ushort>>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetInt32(false); var Arg4 = argHelper4.GetBoolean(false); obj.SetTriangles(Arg0,Arg1,Arg2,Arg3,Arg4); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SetTriangles"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetIndices(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Mesh; if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(int[]), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<int[]>(false); var Arg1 = (UnityEngine.MeshTopology)argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); obj.SetIndices(Arg0,Arg1,Arg2); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(ushort[]), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<ushort[]>(false); var Arg1 = (UnityEngine.MeshTopology)argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); obj.SetIndices(Arg0,Arg1,Arg2); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<int>), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<System.Collections.Generic.List<int>>(false); var Arg1 = (UnityEngine.MeshTopology)argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); obj.SetIndices(Arg0,Arg1,Arg2); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<ushort>), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<System.Collections.Generic.List<ushort>>(false); var Arg1 = (UnityEngine.MeshTopology)argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); obj.SetIndices(Arg0,Arg1,Arg2); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(int[]), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.Get<int[]>(false); var Arg1 = (UnityEngine.MeshTopology)argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetBoolean(false); obj.SetIndices(Arg0,Arg1,Arg2,Arg3); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(ushort[]), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.Get<ushort[]>(false); var Arg1 = (UnityEngine.MeshTopology)argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetBoolean(false); obj.SetIndices(Arg0,Arg1,Arg2,Arg3); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<int>), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.Get<System.Collections.Generic.List<int>>(false); var Arg1 = (UnityEngine.MeshTopology)argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetBoolean(false); obj.SetIndices(Arg0,Arg1,Arg2,Arg3); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<ushort>), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.Get<System.Collections.Generic.List<ushort>>(false); var Arg1 = (UnityEngine.MeshTopology)argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetBoolean(false); obj.SetIndices(Arg0,Arg1,Arg2,Arg3); return; } } if (paramLen == 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(int[]), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<int[]>(false); var Arg1 = (UnityEngine.MeshTopology)argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetBoolean(false); var Arg4 = argHelper4.GetInt32(false); obj.SetIndices(Arg0,Arg1,Arg2,Arg3,Arg4); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(int[]), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<int[]>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = (UnityEngine.MeshTopology)argHelper3.GetInt32(false); var Arg4 = argHelper4.GetInt32(false); obj.SetIndices(Arg0,Arg1,Arg2,Arg3,Arg4); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(ushort[]), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<ushort[]>(false); var Arg1 = (UnityEngine.MeshTopology)argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetBoolean(false); var Arg4 = argHelper4.GetInt32(false); obj.SetIndices(Arg0,Arg1,Arg2,Arg3,Arg4); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(ushort[]), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<ushort[]>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = (UnityEngine.MeshTopology)argHelper3.GetInt32(false); var Arg4 = argHelper4.GetInt32(false); obj.SetIndices(Arg0,Arg1,Arg2,Arg3,Arg4); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<int>), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<System.Collections.Generic.List<int>>(false); var Arg1 = (UnityEngine.MeshTopology)argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetBoolean(false); var Arg4 = argHelper4.GetInt32(false); obj.SetIndices(Arg0,Arg1,Arg2,Arg3,Arg4); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<int>), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<System.Collections.Generic.List<int>>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = (UnityEngine.MeshTopology)argHelper3.GetInt32(false); var Arg4 = argHelper4.GetInt32(false); obj.SetIndices(Arg0,Arg1,Arg2,Arg3,Arg4); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<ushort>), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<System.Collections.Generic.List<ushort>>(false); var Arg1 = (UnityEngine.MeshTopology)argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetBoolean(false); var Arg4 = argHelper4.GetInt32(false); obj.SetIndices(Arg0,Arg1,Arg2,Arg3,Arg4); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<ushort>), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<System.Collections.Generic.List<ushort>>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = (UnityEngine.MeshTopology)argHelper3.GetInt32(false); var Arg4 = argHelper4.GetInt32(false); obj.SetIndices(Arg0,Arg1,Arg2,Arg3,Arg4); return; } } if (paramLen == 7) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(int[]), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<int[]>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = (UnityEngine.MeshTopology)argHelper3.GetInt32(false); var Arg4 = argHelper4.GetInt32(false); var Arg5 = argHelper5.GetBoolean(false); var Arg6 = argHelper6.GetInt32(false); obj.SetIndices(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(ushort[]), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<ushort[]>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = (UnityEngine.MeshTopology)argHelper3.GetInt32(false); var Arg4 = argHelper4.GetInt32(false); var Arg5 = argHelper5.GetBoolean(false); var Arg6 = argHelper6.GetInt32(false); obj.SetIndices(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<int>), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<System.Collections.Generic.List<int>>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = (UnityEngine.MeshTopology)argHelper3.GetInt32(false); var Arg4 = argHelper4.GetInt32(false); var Arg5 = argHelper5.GetBoolean(false); var Arg6 = argHelper6.GetInt32(false); obj.SetIndices(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<ushort>), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<System.Collections.Generic.List<ushort>>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = (UnityEngine.MeshTopology)argHelper3.GetInt32(false); var Arg4 = argHelper4.GetInt32(false); var Arg5 = argHelper5.GetBoolean(false); var Arg6 = argHelper6.GetInt32(false); obj.SetIndices(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6); return; } } if (paramLen == 6) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(int[]), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.Get<int[]>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = (UnityEngine.MeshTopology)argHelper3.GetInt32(false); var Arg4 = argHelper4.GetInt32(false); var Arg5 = argHelper5.GetBoolean(false); obj.SetIndices(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(ushort[]), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.Get<ushort[]>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = (UnityEngine.MeshTopology)argHelper3.GetInt32(false); var Arg4 = argHelper4.GetInt32(false); var Arg5 = argHelper5.GetBoolean(false); obj.SetIndices(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<int>), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.Get<System.Collections.Generic.List<int>>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = (UnityEngine.MeshTopology)argHelper3.GetInt32(false); var Arg4 = argHelper4.GetInt32(false); var Arg5 = argHelper5.GetBoolean(false); obj.SetIndices(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<ushort>), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.Get<System.Collections.Generic.List<ushort>>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = (UnityEngine.MeshTopology)argHelper3.GetInt32(false); var Arg4 = argHelper4.GetInt32(false); var Arg5 = argHelper5.GetBoolean(false); obj.SetIndices(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SetIndices"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetSubMeshes(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Mesh; if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rendering.SubMeshDescriptor[]), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rendering.SubMeshDescriptor[]>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = (UnityEngine.Rendering.MeshUpdateFlags)argHelper3.GetInt32(false); obj.SetSubMeshes(Arg0,Arg1,Arg2,Arg3); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Rendering.SubMeshDescriptor>), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<System.Collections.Generic.List<UnityEngine.Rendering.SubMeshDescriptor>>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = (UnityEngine.Rendering.MeshUpdateFlags)argHelper3.GetInt32(false); obj.SetSubMeshes(Arg0,Arg1,Arg2,Arg3); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rendering.SubMeshDescriptor[]), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rendering.SubMeshDescriptor[]>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); obj.SetSubMeshes(Arg0,Arg1,Arg2); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Rendering.SubMeshDescriptor>), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<System.Collections.Generic.List<UnityEngine.Rendering.SubMeshDescriptor>>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); obj.SetSubMeshes(Arg0,Arg1,Arg2); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rendering.SubMeshDescriptor[]), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rendering.SubMeshDescriptor[]>(false); var Arg1 = (UnityEngine.Rendering.MeshUpdateFlags)argHelper1.GetInt32(false); obj.SetSubMeshes(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Rendering.SubMeshDescriptor>), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<System.Collections.Generic.List<UnityEngine.Rendering.SubMeshDescriptor>>(false); var Arg1 = (UnityEngine.Rendering.MeshUpdateFlags)argHelper1.GetInt32(false); obj.SetSubMeshes(Arg0,Arg1); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rendering.SubMeshDescriptor[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rendering.SubMeshDescriptor[]>(false); obj.SetSubMeshes(Arg0); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Rendering.SubMeshDescriptor>), false, false)) { var Arg0 = argHelper0.Get<System.Collections.Generic.List<UnityEngine.Rendering.SubMeshDescriptor>>(false); obj.SetSubMeshes(Arg0); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SetSubMeshes"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetBindposes(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Mesh; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.Collections.Generic.List<UnityEngine.Matrix4x4>>(false); obj.GetBindposes(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetBoneWeights(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Mesh; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.Collections.Generic.List<UnityEngine.BoneWeight>>(false); obj.GetBoneWeights(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Clear(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Mesh; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.GetBoolean(false); obj.Clear(Arg0); return; } } if (paramLen == 0) { { obj.Clear(); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to Clear"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_RecalculateBounds(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Mesh; if (paramLen == 0) { { obj.RecalculateBounds(); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = (UnityEngine.Rendering.MeshUpdateFlags)argHelper0.GetInt32(false); obj.RecalculateBounds(Arg0); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to RecalculateBounds"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_RecalculateNormals(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Mesh; if (paramLen == 0) { { obj.RecalculateNormals(); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = (UnityEngine.Rendering.MeshUpdateFlags)argHelper0.GetInt32(false); obj.RecalculateNormals(Arg0); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to RecalculateNormals"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_RecalculateTangents(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Mesh; if (paramLen == 0) { { obj.RecalculateTangents(); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = (UnityEngine.Rendering.MeshUpdateFlags)argHelper0.GetInt32(false); obj.RecalculateTangents(Arg0); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to RecalculateTangents"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_RecalculateUVDistributionMetric(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Mesh; if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetFloat(false); obj.RecalculateUVDistributionMetric(Arg0,Arg1); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); obj.RecalculateUVDistributionMetric(Arg0); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to RecalculateUVDistributionMetric"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_RecalculateUVDistributionMetrics(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Mesh; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetFloat(false); obj.RecalculateUVDistributionMetrics(Arg0); return; } } if (paramLen == 0) { { obj.RecalculateUVDistributionMetrics(); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to RecalculateUVDistributionMetrics"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_MarkDynamic(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Mesh; { { obj.MarkDynamic(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_UploadMeshData(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Mesh; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetBoolean(false); obj.UploadMeshData(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Optimize(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Mesh; { { obj.Optimize(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_OptimizeIndexBuffers(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Mesh; { { obj.OptimizeIndexBuffers(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_OptimizeReorderVertexBuffer(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Mesh; { { obj.OptimizeReorderVertexBuffer(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetTopology(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Mesh; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); var result = obj.GetTopology(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_CombineMeshes(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Mesh; if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.CombineInstance[]), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.CombineInstance[]>(false); var Arg1 = argHelper1.GetBoolean(false); var Arg2 = argHelper2.GetBoolean(false); var Arg3 = argHelper3.GetBoolean(false); obj.CombineMeshes(Arg0,Arg1,Arg2,Arg3); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.CombineInstance[]), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.CombineInstance[]>(false); var Arg1 = argHelper1.GetBoolean(false); var Arg2 = argHelper2.GetBoolean(false); obj.CombineMeshes(Arg0,Arg1,Arg2); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.CombineInstance[]), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.CombineInstance[]>(false); var Arg1 = argHelper1.GetBoolean(false); obj.CombineMeshes(Arg0,Arg1); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.CombineInstance[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.CombineInstance[]>(false); obj.CombineMeshes(Arg0); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to CombineMeshes"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_indexFormat(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Mesh; var result = obj.indexFormat; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_indexFormat(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Mesh; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.indexFormat = (UnityEngine.Rendering.IndexFormat)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_vertexBufferCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Mesh; var result = obj.vertexBufferCount; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_blendShapeCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Mesh; var result = obj.blendShapeCount; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_bindposes(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Mesh; var result = obj.bindposes; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_bindposes(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Mesh; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.bindposes = argHelper.Get<UnityEngine.Matrix4x4[]>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_isReadable(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Mesh; var result = obj.isReadable; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_vertexCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Mesh; var result = obj.vertexCount; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_subMeshCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Mesh; var result = obj.subMeshCount; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_subMeshCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Mesh; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.subMeshCount = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_bounds(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Mesh; var result = obj.bounds; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_bounds(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Mesh; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.bounds = argHelper.Get<UnityEngine.Bounds>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_vertices(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Mesh; var result = obj.vertices; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_vertices(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Mesh; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.vertices = argHelper.Get<UnityEngine.Vector3[]>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_normals(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Mesh; var result = obj.normals; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_normals(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Mesh; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.normals = argHelper.Get<UnityEngine.Vector3[]>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_tangents(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Mesh; var result = obj.tangents; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_tangents(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Mesh; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.tangents = argHelper.Get<UnityEngine.Vector4[]>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_uv(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Mesh; var result = obj.uv; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_uv(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Mesh; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.uv = argHelper.Get<UnityEngine.Vector2[]>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_uv2(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Mesh; var result = obj.uv2; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_uv2(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Mesh; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.uv2 = argHelper.Get<UnityEngine.Vector2[]>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_uv3(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Mesh; var result = obj.uv3; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_uv3(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Mesh; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.uv3 = argHelper.Get<UnityEngine.Vector2[]>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_uv4(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Mesh; var result = obj.uv4; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_uv4(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Mesh; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.uv4 = argHelper.Get<UnityEngine.Vector2[]>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_uv5(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Mesh; var result = obj.uv5; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_uv5(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Mesh; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.uv5 = argHelper.Get<UnityEngine.Vector2[]>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_uv6(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Mesh; var result = obj.uv6; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_uv6(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Mesh; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.uv6 = argHelper.Get<UnityEngine.Vector2[]>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_uv7(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Mesh; var result = obj.uv7; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_uv7(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Mesh; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.uv7 = argHelper.Get<UnityEngine.Vector2[]>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_uv8(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Mesh; var result = obj.uv8; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_uv8(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Mesh; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.uv8 = argHelper.Get<UnityEngine.Vector2[]>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_colors(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Mesh; var result = obj.colors; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_colors(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Mesh; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.colors = argHelper.Get<UnityEngine.Color[]>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_colors32(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Mesh; var result = obj.colors32; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_colors32(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Mesh; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.colors32 = argHelper.Get<UnityEngine.Color32[]>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_vertexAttributeCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Mesh; var result = obj.vertexAttributeCount; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_triangles(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Mesh; var result = obj.triangles; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_triangles(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Mesh; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.triangles = argHelper.Get<int[]>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_boneWeights(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Mesh; var result = obj.boneWeights; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_boneWeights(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Mesh; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.boneWeights = argHelper.Get<UnityEngine.BoneWeight[]>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "SetIndexBufferParams", IsStatic = false}, M_SetIndexBufferParams }, { new Puerts.MethodKey {Name = "GetVertexAttribute", IsStatic = false}, M_GetVertexAttribute }, { new Puerts.MethodKey {Name = "HasVertexAttribute", IsStatic = false}, M_HasVertexAttribute }, { new Puerts.MethodKey {Name = "GetVertexAttributeDimension", IsStatic = false}, M_GetVertexAttributeDimension }, { new Puerts.MethodKey {Name = "GetVertexAttributeFormat", IsStatic = false}, M_GetVertexAttributeFormat }, { new Puerts.MethodKey {Name = "GetNativeVertexBufferPtr", IsStatic = false}, M_GetNativeVertexBufferPtr }, { new Puerts.MethodKey {Name = "GetNativeIndexBufferPtr", IsStatic = false}, M_GetNativeIndexBufferPtr }, { new Puerts.MethodKey {Name = "ClearBlendShapes", IsStatic = false}, M_ClearBlendShapes }, { new Puerts.MethodKey {Name = "GetBlendShapeName", IsStatic = false}, M_GetBlendShapeName }, { new Puerts.MethodKey {Name = "GetBlendShapeIndex", IsStatic = false}, M_GetBlendShapeIndex }, { new Puerts.MethodKey {Name = "GetBlendShapeFrameCount", IsStatic = false}, M_GetBlendShapeFrameCount }, { new Puerts.MethodKey {Name = "GetBlendShapeFrameWeight", IsStatic = false}, M_GetBlendShapeFrameWeight }, { new Puerts.MethodKey {Name = "GetBlendShapeFrameVertices", IsStatic = false}, M_GetBlendShapeFrameVertices }, { new Puerts.MethodKey {Name = "AddBlendShapeFrame", IsStatic = false}, M_AddBlendShapeFrame }, { new Puerts.MethodKey {Name = "SetBoneWeights", IsStatic = false}, M_SetBoneWeights }, { new Puerts.MethodKey {Name = "GetAllBoneWeights", IsStatic = false}, M_GetAllBoneWeights }, { new Puerts.MethodKey {Name = "GetBonesPerVertex", IsStatic = false}, M_GetBonesPerVertex }, { new Puerts.MethodKey {Name = "SetSubMesh", IsStatic = false}, M_SetSubMesh }, { new Puerts.MethodKey {Name = "GetSubMesh", IsStatic = false}, M_GetSubMesh }, { new Puerts.MethodKey {Name = "MarkModified", IsStatic = false}, M_MarkModified }, { new Puerts.MethodKey {Name = "GetUVDistributionMetric", IsStatic = false}, M_GetUVDistributionMetric }, { new Puerts.MethodKey {Name = "GetVertices", IsStatic = false}, M_GetVertices }, { new Puerts.MethodKey {Name = "SetVertices", IsStatic = false}, M_SetVertices }, { new Puerts.MethodKey {Name = "GetNormals", IsStatic = false}, M_GetNormals }, { new Puerts.MethodKey {Name = "SetNormals", IsStatic = false}, M_SetNormals }, { new Puerts.MethodKey {Name = "GetTangents", IsStatic = false}, M_GetTangents }, { new Puerts.MethodKey {Name = "SetTangents", IsStatic = false}, M_SetTangents }, { new Puerts.MethodKey {Name = "GetColors", IsStatic = false}, M_GetColors }, { new Puerts.MethodKey {Name = "SetColors", IsStatic = false}, M_SetColors }, { new Puerts.MethodKey {Name = "SetUVs", IsStatic = false}, M_SetUVs }, { new Puerts.MethodKey {Name = "GetUVs", IsStatic = false}, M_GetUVs }, { new Puerts.MethodKey {Name = "GetVertexAttributes", IsStatic = false}, M_GetVertexAttributes }, { new Puerts.MethodKey {Name = "SetVertexBufferParams", IsStatic = false}, M_SetVertexBufferParams }, { new Puerts.MethodKey {Name = "AcquireReadOnlyMeshData", IsStatic = true}, F_AcquireReadOnlyMeshData }, { new Puerts.MethodKey {Name = "AllocateWritableMeshData", IsStatic = true}, F_AllocateWritableMeshData }, { new Puerts.MethodKey {Name = "ApplyAndDisposeWritableMeshData", IsStatic = true}, F_ApplyAndDisposeWritableMeshData }, { new Puerts.MethodKey {Name = "GetTriangles", IsStatic = false}, M_GetTriangles }, { new Puerts.MethodKey {Name = "GetIndices", IsStatic = false}, M_GetIndices }, { new Puerts.MethodKey {Name = "GetIndexStart", IsStatic = false}, M_GetIndexStart }, { new Puerts.MethodKey {Name = "GetIndexCount", IsStatic = false}, M_GetIndexCount }, { new Puerts.MethodKey {Name = "GetBaseVertex", IsStatic = false}, M_GetBaseVertex }, { new Puerts.MethodKey {Name = "SetTriangles", IsStatic = false}, M_SetTriangles }, { new Puerts.MethodKey {Name = "SetIndices", IsStatic = false}, M_SetIndices }, { new Puerts.MethodKey {Name = "SetSubMeshes", IsStatic = false}, M_SetSubMeshes }, { new Puerts.MethodKey {Name = "GetBindposes", IsStatic = false}, M_GetBindposes }, { new Puerts.MethodKey {Name = "GetBoneWeights", IsStatic = false}, M_GetBoneWeights }, { new Puerts.MethodKey {Name = "Clear", IsStatic = false}, M_Clear }, { new Puerts.MethodKey {Name = "RecalculateBounds", IsStatic = false}, M_RecalculateBounds }, { new Puerts.MethodKey {Name = "RecalculateNormals", IsStatic = false}, M_RecalculateNormals }, { new Puerts.MethodKey {Name = "RecalculateTangents", IsStatic = false}, M_RecalculateTangents }, { new Puerts.MethodKey {Name = "RecalculateUVDistributionMetric", IsStatic = false}, M_RecalculateUVDistributionMetric }, { new Puerts.MethodKey {Name = "RecalculateUVDistributionMetrics", IsStatic = false}, M_RecalculateUVDistributionMetrics }, { new Puerts.MethodKey {Name = "MarkDynamic", IsStatic = false}, M_MarkDynamic }, { new Puerts.MethodKey {Name = "UploadMeshData", IsStatic = false}, M_UploadMeshData }, { new Puerts.MethodKey {Name = "Optimize", IsStatic = false}, M_Optimize }, { new Puerts.MethodKey {Name = "OptimizeIndexBuffers", IsStatic = false}, M_OptimizeIndexBuffers }, { new Puerts.MethodKey {Name = "OptimizeReorderVertexBuffer", IsStatic = false}, M_OptimizeReorderVertexBuffer }, { new Puerts.MethodKey {Name = "GetTopology", IsStatic = false}, M_GetTopology }, { new Puerts.MethodKey {Name = "CombineMeshes", IsStatic = false}, M_CombineMeshes }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"indexFormat", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_indexFormat, Setter = S_indexFormat} }, {"vertexBufferCount", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_vertexBufferCount, Setter = null} }, {"blendShapeCount", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_blendShapeCount, Setter = null} }, {"bindposes", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_bindposes, Setter = S_bindposes} }, {"isReadable", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_isReadable, Setter = null} }, {"vertexCount", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_vertexCount, Setter = null} }, {"subMeshCount", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_subMeshCount, Setter = S_subMeshCount} }, {"bounds", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_bounds, Setter = S_bounds} }, {"vertices", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_vertices, Setter = S_vertices} }, {"normals", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_normals, Setter = S_normals} }, {"tangents", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_tangents, Setter = S_tangents} }, {"uv", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_uv, Setter = S_uv} }, {"uv2", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_uv2, Setter = S_uv2} }, {"uv3", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_uv3, Setter = S_uv3} }, {"uv4", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_uv4, Setter = S_uv4} }, {"uv5", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_uv5, Setter = S_uv5} }, {"uv6", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_uv6, Setter = S_uv6} }, {"uv7", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_uv7, Setter = S_uv7} }, {"uv8", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_uv8, Setter = S_uv8} }, {"colors", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_colors, Setter = S_colors} }, {"colors32", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_colors32, Setter = S_colors32} }, {"vertexAttributeCount", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_vertexAttributeCount, Setter = null} }, {"triangles", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_triangles, Setter = S_triangles} }, {"boneWeights", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_boneWeights, Setter = S_boneWeights} }, } }; } } } <|start_filename|>Projects/DataTemplates/template_erlang2/test_tbtestexcelbean.erl<|end_filename|> %% test.TbTestExcelBean -module(test_tbtestexcelbean) -export([get/1,get_ids/0]) get(1) -> #{ x1 => 1, x2 => "xx", x3 => 2, x4 => 2.5 }. get(2) -> #{ x1 => 2, x2 => "zz", x3 => 2, x4 => 4.3 }. get(3) -> #{ x1 => 3, x2 => "ww", x3 => 2, x4 => 5 }. get(4) -> #{ x1 => 4, x2 => "ee", x3 => 2, x4 => 6 }. get_ids() -> [1,2,3,4]. <|start_filename|>Projects/Csharp_CustomTemplate_EncryptMemory/Gen/ai/UeLoop.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using System; using Newtonsoft.Json; using Scripts; namespace cfg.ai { [Serializable] public partial class UeLoop : AConfig { [JsonProperty("num_loops")] private int _num_loops { get; set; } [JsonIgnore] public EncryptInt num_loops { get; private set; } = new(); public bool infinite_loop { get; set; } [JsonProperty("infinite_loop_timeout_time")] private float _infinite_loop_timeout_time { get; set; } [JsonIgnore] public EncryptFloat infinite_loop_timeout_time { get; private set; } = new(); public override void EndInit() { num_loops = _num_loops; infinite_loop_timeout_time = _infinite_loop_timeout_time; } public override string ToString() => JsonConvert.SerializeObject(this); } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_ParticleSystem_LifetimeByEmitterSpeedModule_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_ParticleSystem_LifetimeByEmitterSpeedModule_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.ParticleSystem.LifetimeByEmitterSpeedModule constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_enabled(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.LifetimeByEmitterSpeedModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.enabled; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_enabled(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.LifetimeByEmitterSpeedModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.enabled = argHelper.GetBoolean(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_curve(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.LifetimeByEmitterSpeedModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.curve; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_curve(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.LifetimeByEmitterSpeedModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.curve = argHelper.Get<UnityEngine.ParticleSystem.MinMaxCurve>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_curveMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.LifetimeByEmitterSpeedModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.curveMultiplier; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_curveMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.LifetimeByEmitterSpeedModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.curveMultiplier = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_range(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.LifetimeByEmitterSpeedModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.range; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_range(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.LifetimeByEmitterSpeedModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.range = argHelper.Get<UnityEngine.Vector2>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"enabled", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_enabled, Setter = S_enabled} }, {"curve", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_curve, Setter = S_curve} }, {"curveMultiplier", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_curveMultiplier, Setter = S_curveMultiplier} }, {"range", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_range, Setter = S_range} }, } }; } } } <|start_filename|>Projects/GenerateDatas/convert_lua/role.TbRoleLevelExpAttr/14.lua<|end_filename|> return { level = 14, need_exp = 3000, clothes_attrs = { 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, }, } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_LightingSettings_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_LightingSettings_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.LightingSettings(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.LightingSettings), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_bakedGI(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightingSettings; var result = obj.bakedGI; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_bakedGI(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightingSettings; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.bakedGI = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_realtimeGI(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightingSettings; var result = obj.realtimeGI; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_realtimeGI(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightingSettings; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.realtimeGI = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_realtimeEnvironmentLighting(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightingSettings; var result = obj.realtimeEnvironmentLighting; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_realtimeEnvironmentLighting(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightingSettings; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.realtimeEnvironmentLighting = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_autoGenerate(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightingSettings; var result = obj.autoGenerate; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_autoGenerate(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightingSettings; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.autoGenerate = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_mixedBakeMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightingSettings; var result = obj.mixedBakeMode; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_mixedBakeMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightingSettings; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.mixedBakeMode = (UnityEngine.MixedLightingMode)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_albedoBoost(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightingSettings; var result = obj.albedoBoost; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_albedoBoost(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightingSettings; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.albedoBoost = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_indirectScale(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightingSettings; var result = obj.indirectScale; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_indirectScale(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightingSettings; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.indirectScale = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_lightmapper(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightingSettings; var result = obj.lightmapper; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_lightmapper(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightingSettings; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.lightmapper = (UnityEngine.LightingSettings.Lightmapper)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_lightmapMaxSize(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightingSettings; var result = obj.lightmapMaxSize; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_lightmapMaxSize(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightingSettings; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.lightmapMaxSize = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_lightmapResolution(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightingSettings; var result = obj.lightmapResolution; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_lightmapResolution(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightingSettings; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.lightmapResolution = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_lightmapPadding(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightingSettings; var result = obj.lightmapPadding; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_lightmapPadding(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightingSettings; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.lightmapPadding = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_compressLightmaps(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightingSettings; var result = obj.compressLightmaps; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_compressLightmaps(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightingSettings; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.compressLightmaps = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_ao(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightingSettings; var result = obj.ao; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_ao(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightingSettings; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.ao = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_aoMaxDistance(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightingSettings; var result = obj.aoMaxDistance; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_aoMaxDistance(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightingSettings; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.aoMaxDistance = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_aoExponentIndirect(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightingSettings; var result = obj.aoExponentIndirect; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_aoExponentIndirect(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightingSettings; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.aoExponentIndirect = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_aoExponentDirect(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightingSettings; var result = obj.aoExponentDirect; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_aoExponentDirect(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightingSettings; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.aoExponentDirect = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_extractAO(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightingSettings; var result = obj.extractAO; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_extractAO(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightingSettings; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.extractAO = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_directionalityMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightingSettings; var result = obj.directionalityMode; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_directionalityMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightingSettings; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.directionalityMode = (UnityEngine.LightmapsMode)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_exportTrainingData(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightingSettings; var result = obj.exportTrainingData; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_exportTrainingData(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightingSettings; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.exportTrainingData = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_trainingDataDestination(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightingSettings; var result = obj.trainingDataDestination; Puerts.PuertsDLL.ReturnString(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_trainingDataDestination(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightingSettings; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.trainingDataDestination = argHelper.GetString(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_indirectResolution(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightingSettings; var result = obj.indirectResolution; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_indirectResolution(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightingSettings; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.indirectResolution = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_finalGather(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightingSettings; var result = obj.finalGather; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_finalGather(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightingSettings; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.finalGather = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_finalGatherRayCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightingSettings; var result = obj.finalGatherRayCount; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_finalGatherRayCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightingSettings; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.finalGatherRayCount = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_finalGatherFiltering(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightingSettings; var result = obj.finalGatherFiltering; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_finalGatherFiltering(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightingSettings; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.finalGatherFiltering = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_sampling(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightingSettings; var result = obj.sampling; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_sampling(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightingSettings; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.sampling = (UnityEngine.LightingSettings.Sampling)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_directSampleCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightingSettings; var result = obj.directSampleCount; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_directSampleCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightingSettings; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.directSampleCount = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_indirectSampleCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightingSettings; var result = obj.indirectSampleCount; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_indirectSampleCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightingSettings; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.indirectSampleCount = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_maxBounces(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightingSettings; var result = obj.maxBounces; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_maxBounces(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightingSettings; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.maxBounces = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_minBounces(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightingSettings; var result = obj.minBounces; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_minBounces(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightingSettings; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.minBounces = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_prioritizeView(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightingSettings; var result = obj.prioritizeView; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_prioritizeView(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightingSettings; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.prioritizeView = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_filteringMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightingSettings; var result = obj.filteringMode; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_filteringMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightingSettings; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.filteringMode = (UnityEngine.LightingSettings.FilterMode)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_denoiserTypeDirect(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightingSettings; var result = obj.denoiserTypeDirect; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_denoiserTypeDirect(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightingSettings; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.denoiserTypeDirect = (UnityEngine.LightingSettings.DenoiserType)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_denoiserTypeIndirect(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightingSettings; var result = obj.denoiserTypeIndirect; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_denoiserTypeIndirect(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightingSettings; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.denoiserTypeIndirect = (UnityEngine.LightingSettings.DenoiserType)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_denoiserTypeAO(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightingSettings; var result = obj.denoiserTypeAO; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_denoiserTypeAO(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightingSettings; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.denoiserTypeAO = (UnityEngine.LightingSettings.DenoiserType)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_filterTypeDirect(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightingSettings; var result = obj.filterTypeDirect; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_filterTypeDirect(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightingSettings; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.filterTypeDirect = (UnityEngine.LightingSettings.FilterType)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_filterTypeIndirect(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightingSettings; var result = obj.filterTypeIndirect; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_filterTypeIndirect(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightingSettings; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.filterTypeIndirect = (UnityEngine.LightingSettings.FilterType)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_filterTypeAO(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightingSettings; var result = obj.filterTypeAO; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_filterTypeAO(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightingSettings; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.filterTypeAO = (UnityEngine.LightingSettings.FilterType)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_filteringGaussRadiusDirect(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightingSettings; var result = obj.filteringGaussRadiusDirect; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_filteringGaussRadiusDirect(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightingSettings; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.filteringGaussRadiusDirect = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_filteringGaussRadiusIndirect(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightingSettings; var result = obj.filteringGaussRadiusIndirect; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_filteringGaussRadiusIndirect(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightingSettings; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.filteringGaussRadiusIndirect = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_filteringGaussRadiusAO(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightingSettings; var result = obj.filteringGaussRadiusAO; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_filteringGaussRadiusAO(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightingSettings; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.filteringGaussRadiusAO = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_filteringAtrousPositionSigmaDirect(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightingSettings; var result = obj.filteringAtrousPositionSigmaDirect; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_filteringAtrousPositionSigmaDirect(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightingSettings; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.filteringAtrousPositionSigmaDirect = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_filteringAtrousPositionSigmaIndirect(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightingSettings; var result = obj.filteringAtrousPositionSigmaIndirect; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_filteringAtrousPositionSigmaIndirect(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightingSettings; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.filteringAtrousPositionSigmaIndirect = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_filteringAtrousPositionSigmaAO(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightingSettings; var result = obj.filteringAtrousPositionSigmaAO; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_filteringAtrousPositionSigmaAO(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightingSettings; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.filteringAtrousPositionSigmaAO = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_environmentSampleCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightingSettings; var result = obj.environmentSampleCount; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_environmentSampleCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightingSettings; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.environmentSampleCount = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_lightProbeSampleCountMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightingSettings; var result = obj.lightProbeSampleCountMultiplier; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_lightProbeSampleCountMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightingSettings; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.lightProbeSampleCountMultiplier = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"bakedGI", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_bakedGI, Setter = S_bakedGI} }, {"realtimeGI", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_realtimeGI, Setter = S_realtimeGI} }, {"realtimeEnvironmentLighting", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_realtimeEnvironmentLighting, Setter = S_realtimeEnvironmentLighting} }, {"autoGenerate", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_autoGenerate, Setter = S_autoGenerate} }, {"mixedBakeMode", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_mixedBakeMode, Setter = S_mixedBakeMode} }, {"albedoBoost", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_albedoBoost, Setter = S_albedoBoost} }, {"indirectScale", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_indirectScale, Setter = S_indirectScale} }, {"lightmapper", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_lightmapper, Setter = S_lightmapper} }, {"lightmapMaxSize", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_lightmapMaxSize, Setter = S_lightmapMaxSize} }, {"lightmapResolution", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_lightmapResolution, Setter = S_lightmapResolution} }, {"lightmapPadding", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_lightmapPadding, Setter = S_lightmapPadding} }, {"compressLightmaps", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_compressLightmaps, Setter = S_compressLightmaps} }, {"ao", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_ao, Setter = S_ao} }, {"aoMaxDistance", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_aoMaxDistance, Setter = S_aoMaxDistance} }, {"aoExponentIndirect", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_aoExponentIndirect, Setter = S_aoExponentIndirect} }, {"aoExponentDirect", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_aoExponentDirect, Setter = S_aoExponentDirect} }, {"extractAO", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_extractAO, Setter = S_extractAO} }, {"directionalityMode", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_directionalityMode, Setter = S_directionalityMode} }, {"exportTrainingData", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_exportTrainingData, Setter = S_exportTrainingData} }, {"trainingDataDestination", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_trainingDataDestination, Setter = S_trainingDataDestination} }, {"indirectResolution", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_indirectResolution, Setter = S_indirectResolution} }, {"finalGather", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_finalGather, Setter = S_finalGather} }, {"finalGatherRayCount", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_finalGatherRayCount, Setter = S_finalGatherRayCount} }, {"finalGatherFiltering", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_finalGatherFiltering, Setter = S_finalGatherFiltering} }, {"sampling", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_sampling, Setter = S_sampling} }, {"directSampleCount", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_directSampleCount, Setter = S_directSampleCount} }, {"indirectSampleCount", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_indirectSampleCount, Setter = S_indirectSampleCount} }, {"maxBounces", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_maxBounces, Setter = S_maxBounces} }, {"minBounces", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_minBounces, Setter = S_minBounces} }, {"prioritizeView", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_prioritizeView, Setter = S_prioritizeView} }, {"filteringMode", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_filteringMode, Setter = S_filteringMode} }, {"denoiserTypeDirect", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_denoiserTypeDirect, Setter = S_denoiserTypeDirect} }, {"denoiserTypeIndirect", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_denoiserTypeIndirect, Setter = S_denoiserTypeIndirect} }, {"denoiserTypeAO", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_denoiserTypeAO, Setter = S_denoiserTypeAO} }, {"filterTypeDirect", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_filterTypeDirect, Setter = S_filterTypeDirect} }, {"filterTypeIndirect", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_filterTypeIndirect, Setter = S_filterTypeIndirect} }, {"filterTypeAO", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_filterTypeAO, Setter = S_filterTypeAO} }, {"filteringGaussRadiusDirect", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_filteringGaussRadiusDirect, Setter = S_filteringGaussRadiusDirect} }, {"filteringGaussRadiusIndirect", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_filteringGaussRadiusIndirect, Setter = S_filteringGaussRadiusIndirect} }, {"filteringGaussRadiusAO", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_filteringGaussRadiusAO, Setter = S_filteringGaussRadiusAO} }, {"filteringAtrousPositionSigmaDirect", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_filteringAtrousPositionSigmaDirect, Setter = S_filteringAtrousPositionSigmaDirect} }, {"filteringAtrousPositionSigmaIndirect", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_filteringAtrousPositionSigmaIndirect, Setter = S_filteringAtrousPositionSigmaIndirect} }, {"filteringAtrousPositionSigmaAO", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_filteringAtrousPositionSigmaAO, Setter = S_filteringAtrousPositionSigmaAO} }, {"environmentSampleCount", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_environmentSampleCount, Setter = S_environmentSampleCount} }, {"lightProbeSampleCountMultiplier", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_lightProbeSampleCountMultiplier, Setter = S_lightProbeSampleCountMultiplier} }, } }; } } } <|start_filename|>Projects/Go_json/gen/src/cfg/ai.DistanceLessThan.go<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg import "errors" type AiDistanceLessThan struct { Id int32 NodeName string FlowAbortMode int32 Actor1Key string Actor2Key string Distance float32 ReverseResult bool } const TypeId_AiDistanceLessThan = -1207170283 func (*AiDistanceLessThan) GetTypeId() int32 { return -1207170283 } func (_v *AiDistanceLessThan)Deserialize(_buf map[string]interface{}) (err error) { { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["id"].(float64); !_ok_ { err = errors.New("id error"); return }; _v.Id = int32(_tempNum_) } { var _ok_ bool; if _v.NodeName, _ok_ = _buf["node_name"].(string); !_ok_ { err = errors.New("node_name error"); return } } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["flow_abort_mode"].(float64); !_ok_ { err = errors.New("flow_abort_mode error"); return }; _v.FlowAbortMode = int32(_tempNum_) } { var _ok_ bool; if _v.Actor1Key, _ok_ = _buf["actor1_key"].(string); !_ok_ { err = errors.New("actor1_key error"); return } } { var _ok_ bool; if _v.Actor2Key, _ok_ = _buf["actor2_key"].(string); !_ok_ { err = errors.New("actor2_key error"); return } } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["distance"].(float64); !_ok_ { err = errors.New("distance error"); return }; _v.Distance = float32(_tempNum_) } { var _ok_ bool; if _v.ReverseResult, _ok_ = _buf["reverse_result"].(bool); !_ok_ { err = errors.New("reverse_result error"); return } } return } func DeserializeAiDistanceLessThan(_buf map[string]interface{}) (*AiDistanceLessThan, error) { v := &AiDistanceLessThan{} if err := v.Deserialize(_buf); err == nil { return v, nil } else { return nil, err } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_UI_VertexHelper_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_UI_VertexHelper_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { if (paramLen == 0) { { var result = new UnityEngine.UI.VertexHelper(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.UI.VertexHelper), result); } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh>(false); var result = new UnityEngine.UI.VertexHelper(Arg0); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.UI.VertexHelper), result); } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.UI.VertexHelper constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Dispose(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.VertexHelper; { { obj.Dispose(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Clear(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.VertexHelper; { { obj.Clear(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_PopulateUIVertex(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.VertexHelper; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<UnityEngine.UIVertex>(true); var Arg1 = argHelper1.GetInt32(false); obj.PopulateUIVertex(ref Arg0,Arg1); argHelper0.SetByRefValue(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetUIVertex(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.VertexHelper; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<UnityEngine.UIVertex>(false); var Arg1 = argHelper1.GetInt32(false); obj.SetUIVertex(Arg0,Arg1); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_FillMesh(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.VertexHelper; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Mesh>(false); obj.FillMesh(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_AddVert(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.VertexHelper; if (paramLen == 8) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); var argHelper7 = new Puerts.ArgumentHelper((int)data, isolate, info, 7); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Color32), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector4), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector4), false, false) && argHelper4.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector4), false, false) && argHelper5.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector4), false, false) && argHelper6.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper7.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector4), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = argHelper1.Get<UnityEngine.Color32>(false); var Arg2 = argHelper2.Get<UnityEngine.Vector4>(false); var Arg3 = argHelper3.Get<UnityEngine.Vector4>(false); var Arg4 = argHelper4.Get<UnityEngine.Vector4>(false); var Arg5 = argHelper5.Get<UnityEngine.Vector4>(false); var Arg6 = argHelper6.Get<UnityEngine.Vector3>(false); var Arg7 = argHelper7.Get<UnityEngine.Vector4>(false); obj.AddVert(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7); return; } } if (paramLen == 6) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Color32), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector4), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector4), false, false) && argHelper4.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper5.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector4), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = argHelper1.Get<UnityEngine.Color32>(false); var Arg2 = argHelper2.Get<UnityEngine.Vector4>(false); var Arg3 = argHelper3.Get<UnityEngine.Vector4>(false); var Arg4 = argHelper4.Get<UnityEngine.Vector3>(false); var Arg5 = argHelper5.Get<UnityEngine.Vector4>(false); obj.AddVert(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Color32), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector4), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = argHelper1.Get<UnityEngine.Color32>(false); var Arg2 = argHelper2.Get<UnityEngine.Vector4>(false); obj.AddVert(Arg0,Arg1,Arg2); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.UIVertex), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.UIVertex>(false); obj.AddVert(Arg0); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to AddVert"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_AddTriangle(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.VertexHelper; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); obj.AddTriangle(Arg0,Arg1,Arg2); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_AddUIVertexQuad(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.VertexHelper; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.UIVertex[]>(false); obj.AddUIVertexQuad(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_AddUIVertexStream(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.VertexHelper; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<System.Collections.Generic.List<UnityEngine.UIVertex>>(false); var Arg1 = argHelper1.Get<System.Collections.Generic.List<int>>(false); obj.AddUIVertexStream(Arg0,Arg1); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_AddUIVertexTriangleStream(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.VertexHelper; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.Collections.Generic.List<UnityEngine.UIVertex>>(false); obj.AddUIVertexTriangleStream(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetUIVertexStream(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.VertexHelper; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.Collections.Generic.List<UnityEngine.UIVertex>>(false); obj.GetUIVertexStream(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_currentVertCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.VertexHelper; var result = obj.currentVertCount; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_currentIndexCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.VertexHelper; var result = obj.currentIndexCount; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "Dispose", IsStatic = false}, M_Dispose }, { new Puerts.MethodKey {Name = "Clear", IsStatic = false}, M_Clear }, { new Puerts.MethodKey {Name = "PopulateUIVertex", IsStatic = false}, M_PopulateUIVertex }, { new Puerts.MethodKey {Name = "SetUIVertex", IsStatic = false}, M_SetUIVertex }, { new Puerts.MethodKey {Name = "FillMesh", IsStatic = false}, M_FillMesh }, { new Puerts.MethodKey {Name = "AddVert", IsStatic = false}, M_AddVert }, { new Puerts.MethodKey {Name = "AddTriangle", IsStatic = false}, M_AddTriangle }, { new Puerts.MethodKey {Name = "AddUIVertexQuad", IsStatic = false}, M_AddUIVertexQuad }, { new Puerts.MethodKey {Name = "AddUIVertexStream", IsStatic = false}, M_AddUIVertexStream }, { new Puerts.MethodKey {Name = "AddUIVertexTriangleStream", IsStatic = false}, M_AddUIVertexTriangleStream }, { new Puerts.MethodKey {Name = "GetUIVertexStream", IsStatic = false}, M_GetUIVertexStream }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"currentVertCount", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_currentVertCount, Setter = null} }, {"currentIndexCount", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_currentIndexCount, Setter = null} }, } }; } } } <|start_filename|>Projects/DataTemplates/template_lua/l10n_tbpatchdemo.lua<|end_filename|> return { [11] = {id=11,value=1,}, [12] = {id=12,value=2,}, [13] = {id=13,value=3,}, [14] = {id=14,value=4,}, [15] = {id=15,value=5,}, [16] = {id=16,value=6,}, [17] = {id=17,value=7,}, [18] = {id=18,value=8,}, } <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/test/TbTestGlobal.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.test { public sealed partial class TbTestGlobal { private readonly test.TestGlobal _data; public TbTestGlobal(ByteBuf _buf) { int n = _buf.ReadSize(); if (n != 1) throw new SerializationException("table mode=one, but size != 1"); _data = test.TestGlobal.DeserializeTestGlobal(_buf); } public int UnlockEquip => _data.UnlockEquip; public int UnlockHero => _data.UnlockHero; public void Resolve(Dictionary<string, object> _tables) { _data.Resolve(_tables); OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_Projector_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_Projector_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.Projector(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.Projector), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_nearClipPlane(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Projector; var result = obj.nearClipPlane; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_nearClipPlane(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Projector; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.nearClipPlane = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_farClipPlane(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Projector; var result = obj.farClipPlane; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_farClipPlane(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Projector; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.farClipPlane = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_fieldOfView(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Projector; var result = obj.fieldOfView; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_fieldOfView(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Projector; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.fieldOfView = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_aspectRatio(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Projector; var result = obj.aspectRatio; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_aspectRatio(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Projector; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.aspectRatio = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_orthographic(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Projector; var result = obj.orthographic; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_orthographic(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Projector; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.orthographic = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_orthographicSize(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Projector; var result = obj.orthographicSize; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_orthographicSize(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Projector; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.orthographicSize = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_ignoreLayers(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Projector; var result = obj.ignoreLayers; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_ignoreLayers(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Projector; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.ignoreLayers = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_material(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Projector; var result = obj.material; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_material(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Projector; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.material = argHelper.Get<UnityEngine.Material>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"nearClipPlane", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_nearClipPlane, Setter = S_nearClipPlane} }, {"farClipPlane", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_farClipPlane, Setter = S_farClipPlane} }, {"fieldOfView", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_fieldOfView, Setter = S_fieldOfView} }, {"aspectRatio", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_aspectRatio, Setter = S_aspectRatio} }, {"orthographic", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_orthographic, Setter = S_orthographic} }, {"orthographicSize", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_orthographicSize, Setter = S_orthographicSize} }, {"ignoreLayers", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_ignoreLayers, Setter = S_ignoreLayers} }, {"material", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_material, Setter = S_material} }, } }; } } } <|start_filename|>Projects/Lua_Unity_xlua_lua/Assets/Lua/Data/test_tbtestberef.lua<|end_filename|> return { [1] = {id=1,count=10,}, [2] = {id=2,count=10,}, [3] = {id=3,count=10,}, [4] = {id=4,count=10,}, [5] = {id=5,count=10,}, [6] = {id=6,count=10,}, [7] = {id=7,count=10,}, [8] = {id=8,count=10,}, [9] = {id=9,count=10,}, [10] = {id=10,count=10,}, } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_FrameTiming_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_FrameTiming_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.FrameTiming constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_cpuTimePresentCalled(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.FrameTiming)Puerts.Utils.GetSelf((int)data, self); var result = obj.cpuTimePresentCalled; Puerts.PuertsDLL.ReturnBigInt(isolate, info, (long)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_cpuTimePresentCalled(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.FrameTiming)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.cpuTimePresentCalled = argHelper.GetUInt64(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_cpuFrameTime(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.FrameTiming)Puerts.Utils.GetSelf((int)data, self); var result = obj.cpuFrameTime; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_cpuFrameTime(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.FrameTiming)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.cpuFrameTime = argHelper.GetDouble(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_cpuTimeFrameComplete(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.FrameTiming)Puerts.Utils.GetSelf((int)data, self); var result = obj.cpuTimeFrameComplete; Puerts.PuertsDLL.ReturnBigInt(isolate, info, (long)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_cpuTimeFrameComplete(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.FrameTiming)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.cpuTimeFrameComplete = argHelper.GetUInt64(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_gpuFrameTime(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.FrameTiming)Puerts.Utils.GetSelf((int)data, self); var result = obj.gpuFrameTime; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_gpuFrameTime(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.FrameTiming)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.gpuFrameTime = argHelper.GetDouble(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_heightScale(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.FrameTiming)Puerts.Utils.GetSelf((int)data, self); var result = obj.heightScale; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_heightScale(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.FrameTiming)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.heightScale = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_widthScale(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.FrameTiming)Puerts.Utils.GetSelf((int)data, self); var result = obj.widthScale; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_widthScale(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.FrameTiming)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.widthScale = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_syncInterval(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.FrameTiming)Puerts.Utils.GetSelf((int)data, self); var result = obj.syncInterval; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_syncInterval(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.FrameTiming)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.syncInterval = argHelper.GetUInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"cpuTimePresentCalled", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_cpuTimePresentCalled, Setter = S_cpuTimePresentCalled} }, {"cpuFrameTime", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_cpuFrameTime, Setter = S_cpuFrameTime} }, {"cpuTimeFrameComplete", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_cpuTimeFrameComplete, Setter = S_cpuTimeFrameComplete} }, {"gpuFrameTime", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_gpuFrameTime, Setter = S_gpuFrameTime} }, {"heightScale", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_heightScale, Setter = S_heightScale} }, {"widthScale", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_widthScale, Setter = S_widthScale} }, {"syncInterval", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_syncInterval, Setter = S_syncInterval} }, } }; } } } <|start_filename|>Projects/DataTemplates/template_erlang2/test_tbcompositejsontable2.erl<|end_filename|> %% test.TbCompositeJsonTable2 -module(test_tbcompositejsontable2) -export([get/1,get_ids/0]) get(1) -> #{ id => 1, y => 100 }. get(3) -> #{ id => 3, y => 300 }. get_ids() -> [1,3]. <|start_filename|>Projects/Csharp_DotNet5_json_ExportServer/Gen/error/TbErrorInfo.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; using System.Text.Json; namespace cfg.error { public sealed class TbErrorInfo { private readonly Dictionary<string, error.ErrorInfo> _dataMap; private readonly List<error.ErrorInfo> _dataList; public TbErrorInfo(JsonElement _json) { _dataMap = new Dictionary<string, error.ErrorInfo>(); _dataList = new List<error.ErrorInfo>(); foreach(JsonElement _row in _json.EnumerateArray()) { var _v = error.ErrorInfo.DeserializeErrorInfo(_row); _dataList.Add(_v); _dataMap.Add(_v.Code, _v); } } public Dictionary<string, error.ErrorInfo> DataMap => _dataMap; public List<error.ErrorInfo> DataList => _dataList; public error.ErrorInfo GetOrDefault(string key) => _dataMap.TryGetValue(key, out var v) ? v : null; public error.ErrorInfo Get(string key) => _dataMap[key]; public error.ErrorInfo this[string key] => _dataMap[key]; public void Resolve(Dictionary<string, object> _tables) { foreach(var v in _dataList) { v.Resolve(_tables); } } public void TranslateText(System.Func<string, string, string> translator) { foreach(var v in _dataList) { v.TranslateText(translator); } } } } <|start_filename|>Projects/Go_json/gen/src/cfg/ai.IsSet.go<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg type AiIsSet struct { } const TypeId_AiIsSet = 1635350898 func (*AiIsSet) GetTypeId() int32 { return 1635350898 } func (_v *AiIsSet)Deserialize(_buf map[string]interface{}) (err error) { return } func DeserializeAiIsSet(_buf map[string]interface{}) (*AiIsSet, error) { v := &AiIsSet{} if err := v.Deserialize(_buf); err == nil { return v, nil } else { return nil, err } } <|start_filename|>Projects/java_json/src/gen/cfg/test/TestRow.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.test; import com.google.gson.JsonElement; import com.google.gson.JsonObject; public final class TestRow { public TestRow(JsonObject __json__) { x = __json__.get("x").getAsInt(); y = __json__.get("y").getAsBoolean(); z = __json__.get("z").getAsString(); a = new cfg.test.Test3(__json__.get("a").getAsJsonObject()); { com.google.gson.JsonArray _json0_ = __json__.get("b").getAsJsonArray(); b = new java.util.ArrayList<Integer>(_json0_.size()); for(JsonElement __e : _json0_) { int __v; __v = __e.getAsInt(); b.add(__v); } } } public TestRow(int x, boolean y, String z, cfg.test.Test3 a, java.util.ArrayList<Integer> b ) { this.x = x; this.y = y; this.z = z; this.a = a; this.b = b; } public static TestRow deserializeTestRow(JsonObject __json__) { return new TestRow(__json__); } public final int x; public final boolean y; public final String z; public final cfg.test.Test3 a; public final java.util.ArrayList<Integer> b; public void resolve(java.util.HashMap<String, Object> _tables) { if (a != null) {a.resolve(_tables);} } @Override public String toString() { return "{ " + "x:" + x + "," + "y:" + y + "," + "z:" + z + "," + "a:" + a + "," + "b:" + b + "," + "}"; } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_ParticleSystem_MinMaxCurve_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_ParticleSystem_MinMaxCurve_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetFloat(false); var result = new UnityEngine.ParticleSystem.MinMaxCurve(Arg0); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.ParticleSystem.MinMaxCurve), result); } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.AnimationCurve), false, false)) { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.Get<UnityEngine.AnimationCurve>(false); var result = new UnityEngine.ParticleSystem.MinMaxCurve(Arg0,Arg1); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.ParticleSystem.MinMaxCurve), result); } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.GetFloat(false); var result = new UnityEngine.ParticleSystem.MinMaxCurve(Arg0,Arg1); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.ParticleSystem.MinMaxCurve), result); } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.AnimationCurve), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.AnimationCurve), false, false)) { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.Get<UnityEngine.AnimationCurve>(false); var Arg2 = argHelper2.Get<UnityEngine.AnimationCurve>(false); var result = new UnityEngine.ParticleSystem.MinMaxCurve(Arg0,Arg1,Arg2); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.ParticleSystem.MinMaxCurve), result); } } if (paramLen == 0) { { var result = new UnityEngine.ParticleSystem.MinMaxCurve(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.ParticleSystem.MinMaxCurve), result); } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.ParticleSystem.MinMaxCurve constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Evaluate(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MinMaxCurve)Puerts.Utils.GetSelf((int)data, self); if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetFloat(false); var result = obj.Evaluate(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.GetFloat(false); var result = obj.Evaluate(Arg0,Arg1); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to Evaluate"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_mode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MinMaxCurve)Puerts.Utils.GetSelf((int)data, self); var result = obj.mode; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_mode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MinMaxCurve)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.mode = (UnityEngine.ParticleSystemCurveMode)argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_curveMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MinMaxCurve)Puerts.Utils.GetSelf((int)data, self); var result = obj.curveMultiplier; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_curveMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MinMaxCurve)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.curveMultiplier = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_curveMax(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MinMaxCurve)Puerts.Utils.GetSelf((int)data, self); var result = obj.curveMax; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_curveMax(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MinMaxCurve)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.curveMax = argHelper.Get<UnityEngine.AnimationCurve>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_curveMin(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MinMaxCurve)Puerts.Utils.GetSelf((int)data, self); var result = obj.curveMin; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_curveMin(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MinMaxCurve)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.curveMin = argHelper.Get<UnityEngine.AnimationCurve>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_constantMax(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MinMaxCurve)Puerts.Utils.GetSelf((int)data, self); var result = obj.constantMax; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_constantMax(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MinMaxCurve)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.constantMax = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_constantMin(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MinMaxCurve)Puerts.Utils.GetSelf((int)data, self); var result = obj.constantMin; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_constantMin(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MinMaxCurve)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.constantMin = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_constant(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MinMaxCurve)Puerts.Utils.GetSelf((int)data, self); var result = obj.constant; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_constant(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MinMaxCurve)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.constant = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_curve(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MinMaxCurve)Puerts.Utils.GetSelf((int)data, self); var result = obj.curve; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_curve(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MinMaxCurve)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.curve = argHelper.Get<UnityEngine.AnimationCurve>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "Evaluate", IsStatic = false}, M_Evaluate }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"mode", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_mode, Setter = S_mode} }, {"curveMultiplier", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_curveMultiplier, Setter = S_curveMultiplier} }, {"curveMax", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_curveMax, Setter = S_curveMax} }, {"curveMin", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_curveMin, Setter = S_curveMin} }, {"constantMax", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_constantMax, Setter = S_constantMax} }, {"constantMin", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_constantMin, Setter = S_constantMin} }, {"constant", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_constant, Setter = S_constant} }, {"curve", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_curve, Setter = S_curve} }, } }; } } } <|start_filename|>Projects/DataTemplates/template_lua/test_tbnotindexlist.lua<|end_filename|> return {x=1,y=2,} <|start_filename|>Projects/GenerateDatas/convert_lua/l10n.TbPatchDemo/16.lua<|end_filename|> return { id = 16, value = 6, } <|start_filename|>Projects/Go_json/gen/src/cfg/test.CompositeJsonTable2.go<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg import "errors" type TestCompositeJsonTable2 struct { Id int32 Y int32 } const TypeId_TestCompositeJsonTable2 = 1566207895 func (*TestCompositeJsonTable2) GetTypeId() int32 { return 1566207895 } func (_v *TestCompositeJsonTable2)Deserialize(_buf map[string]interface{}) (err error) { { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["id"].(float64); !_ok_ { err = errors.New("id error"); return }; _v.Id = int32(_tempNum_) } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["y"].(float64); !_ok_ { err = errors.New("y error"); return }; _v.Y = int32(_tempNum_) } return } func DeserializeTestCompositeJsonTable2(_buf map[string]interface{}) (*TestCompositeJsonTable2, error) { v := &TestCompositeJsonTable2{} if err := v.Deserialize(_buf); err == nil { return v, nil } else { return nil, err } } <|start_filename|>Projects/DataTemplates/template_erlang2/l10n_tbpatchdemo.erl<|end_filename|> %% l10n.TbPatchDemo -module(l10n_tbpatchdemo) -export([get/1,get_ids/0]) get(11) -> #{ id => 11, value => 1 }. get(12) -> #{ id => 12, value => 2 }. get(13) -> #{ id => 13, value => 3 }. get(14) -> #{ id => 14, value => 4 }. get(15) -> #{ id => 15, value => 5 }. get(16) -> #{ id => 16, value => 6 }. get(17) -> #{ id => 17, value => 7 }. get(18) -> #{ id => 18, value => 8 }. get_ids() -> [11,12,13,14,15,16,17,18]. <|start_filename|>Projects/Csharp_Unity_bin_use_UnityEngine_Vector/Assets/Gen/ai/Blackboard.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.ai { public sealed class Blackboard : Bright.Config.BeanBase { public Blackboard(ByteBuf _buf) { Name = _buf.ReadString(); Desc = _buf.ReadString(); ParentName = _buf.ReadString(); {int n = System.Math.Min(_buf.ReadSize(), _buf.Size);Keys = new System.Collections.Generic.List<ai.BlackboardKey>(n);for(var i = 0 ; i < n ; i++) { ai.BlackboardKey _e; _e = ai.BlackboardKey.DeserializeBlackboardKey(_buf); Keys.Add(_e);}} } public static Blackboard DeserializeBlackboard(ByteBuf _buf) { return new ai.Blackboard(_buf); } public string Name { get; private set; } public string Desc { get; private set; } public string ParentName { get; private set; } public ai.Blackboard ParentName_Ref { get; private set; } public System.Collections.Generic.List<ai.BlackboardKey> Keys { get; private set; } public const int __ID__ = 1576193005; public override int GetTypeId() => __ID__; public void Resolve(Dictionary<string, object> _tables) { this.ParentName_Ref = (_tables["ai.TbBlackboard"] as ai.TbBlackboard).GetOrDefault(ParentName); foreach(var _e in Keys) { _e?.Resolve(_tables); } } public void TranslateText(System.Func<string, string, string> translator) { foreach(var _e in Keys) { _e?.TranslateText(translator); } } public override string ToString() { return "{ " + "Name:" + Name + "," + "Desc:" + Desc + "," + "ParentName:" + ParentName + "," + "Keys:" + Bright.Common.StringUtil.CollectionToString(Keys) + "," + "}"; } } } <|start_filename|>Projects/java_json/src/gen/cfg/item/EItemQuality.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.item; /** * 道具品质 */ public enum EItemQuality { /** * 白 */ WHITE(0), /** * 绿 */ GREEN(1), /** * 蓝 */ BLUE(2), /** * 紫 */ PURPLE(3), /** * 金 */ GOLDEN(4), ; private final int value; public int getValue() { return value; } EItemQuality(int value) { this.value = value; } public static EItemQuality valueOf(int value) { if (value == 0) return WHITE; if (value == 1) return GREEN; if (value == 2) return BLUE; if (value == 3) return PURPLE; if (value == 4) return GOLDEN; throw new IllegalArgumentException(""); } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_WebCamDevice_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_WebCamDevice_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.WebCamDevice constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_name(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.WebCamDevice)Puerts.Utils.GetSelf((int)data, self); var result = obj.name; Puerts.PuertsDLL.ReturnString(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_isFrontFacing(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.WebCamDevice)Puerts.Utils.GetSelf((int)data, self); var result = obj.isFrontFacing; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_kind(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.WebCamDevice)Puerts.Utils.GetSelf((int)data, self); var result = obj.kind; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_depthCameraName(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.WebCamDevice)Puerts.Utils.GetSelf((int)data, self); var result = obj.depthCameraName; Puerts.PuertsDLL.ReturnString(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_isAutoFocusPointSupported(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.WebCamDevice)Puerts.Utils.GetSelf((int)data, self); var result = obj.isAutoFocusPointSupported; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_availableResolutions(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.WebCamDevice)Puerts.Utils.GetSelf((int)data, self); var result = obj.availableResolutions; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"name", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_name, Setter = null} }, {"isFrontFacing", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_isFrontFacing, Setter = null} }, {"kind", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_kind, Setter = null} }, {"depthCameraName", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_depthCameraName, Setter = null} }, {"isAutoFocusPointSupported", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_isAutoFocusPointSupported, Setter = null} }, {"availableResolutions", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_availableResolutions, Setter = null} }, } }; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_TouchScreenKeyboard_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_TouchScreenKeyboard_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); var argHelper7 = new Puerts.ArgumentHelper((int)data, isolate, info, 7); { var Arg0 = argHelper0.GetString(false); var Arg1 = (UnityEngine.TouchScreenKeyboardType)argHelper1.GetInt32(false); var Arg2 = argHelper2.GetBoolean(false); var Arg3 = argHelper3.GetBoolean(false); var Arg4 = argHelper4.GetBoolean(false); var Arg5 = argHelper5.GetBoolean(false); var Arg6 = argHelper6.GetString(false); var Arg7 = argHelper7.GetInt32(false); var result = new UnityEngine.TouchScreenKeyboard(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.TouchScreenKeyboard), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_Open(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 8) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); var argHelper7 = new Puerts.ArgumentHelper((int)data, isolate, info, 7); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper7.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = (UnityEngine.TouchScreenKeyboardType)argHelper1.GetInt32(false); var Arg2 = argHelper2.GetBoolean(false); var Arg3 = argHelper3.GetBoolean(false); var Arg4 = argHelper4.GetBoolean(false); var Arg5 = argHelper5.GetBoolean(false); var Arg6 = argHelper6.GetString(false); var Arg7 = argHelper7.GetInt32(false); var result = UnityEngine.TouchScreenKeyboard.Open(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 7) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = (UnityEngine.TouchScreenKeyboardType)argHelper1.GetInt32(false); var Arg2 = argHelper2.GetBoolean(false); var Arg3 = argHelper3.GetBoolean(false); var Arg4 = argHelper4.GetBoolean(false); var Arg5 = argHelper5.GetBoolean(false); var Arg6 = argHelper6.GetString(false); var result = UnityEngine.TouchScreenKeyboard.Open(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 6) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = (UnityEngine.TouchScreenKeyboardType)argHelper1.GetInt32(false); var Arg2 = argHelper2.GetBoolean(false); var Arg3 = argHelper3.GetBoolean(false); var Arg4 = argHelper4.GetBoolean(false); var Arg5 = argHelper5.GetBoolean(false); var result = UnityEngine.TouchScreenKeyboard.Open(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = (UnityEngine.TouchScreenKeyboardType)argHelper1.GetInt32(false); var Arg2 = argHelper2.GetBoolean(false); var Arg3 = argHelper3.GetBoolean(false); var Arg4 = argHelper4.GetBoolean(false); var result = UnityEngine.TouchScreenKeyboard.Open(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = (UnityEngine.TouchScreenKeyboardType)argHelper1.GetInt32(false); var Arg2 = argHelper2.GetBoolean(false); var Arg3 = argHelper3.GetBoolean(false); var result = UnityEngine.TouchScreenKeyboard.Open(Arg0,Arg1,Arg2,Arg3); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = (UnityEngine.TouchScreenKeyboardType)argHelper1.GetInt32(false); var Arg2 = argHelper2.GetBoolean(false); var result = UnityEngine.TouchScreenKeyboard.Open(Arg0,Arg1,Arg2); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = (UnityEngine.TouchScreenKeyboardType)argHelper1.GetInt32(false); var result = UnityEngine.TouchScreenKeyboard.Open(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var result = UnityEngine.TouchScreenKeyboard.Open(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to Open"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_isSupported(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.TouchScreenKeyboard.isSupported; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_isInPlaceEditingAllowed(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.TouchScreenKeyboard.isInPlaceEditingAllowed; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_text(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TouchScreenKeyboard; var result = obj.text; Puerts.PuertsDLL.ReturnString(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_text(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TouchScreenKeyboard; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.text = argHelper.GetString(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_hideInput(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.TouchScreenKeyboard.hideInput; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_hideInput(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.TouchScreenKeyboard.hideInput = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_active(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TouchScreenKeyboard; var result = obj.active; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_active(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TouchScreenKeyboard; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.active = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_status(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TouchScreenKeyboard; var result = obj.status; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_characterLimit(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TouchScreenKeyboard; var result = obj.characterLimit; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_characterLimit(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TouchScreenKeyboard; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.characterLimit = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_canGetSelection(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TouchScreenKeyboard; var result = obj.canGetSelection; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_canSetSelection(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TouchScreenKeyboard; var result = obj.canSetSelection; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_selection(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TouchScreenKeyboard; var result = obj.selection; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_selection(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TouchScreenKeyboard; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.selection = argHelper.Get<UnityEngine.RangeInt>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_type(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TouchScreenKeyboard; var result = obj.type; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_targetDisplay(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TouchScreenKeyboard; var result = obj.targetDisplay; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_targetDisplay(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TouchScreenKeyboard; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.targetDisplay = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_area(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.TouchScreenKeyboard.area; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_visible(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.TouchScreenKeyboard.visible; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "Open", IsStatic = true}, F_Open }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"isSupported", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_isSupported, Setter = null} }, {"isInPlaceEditingAllowed", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_isInPlaceEditingAllowed, Setter = null} }, {"text", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_text, Setter = S_text} }, {"hideInput", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_hideInput, Setter = S_hideInput} }, {"active", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_active, Setter = S_active} }, {"status", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_status, Setter = null} }, {"characterLimit", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_characterLimit, Setter = S_characterLimit} }, {"canGetSelection", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_canGetSelection, Setter = null} }, {"canSetSelection", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_canSetSelection, Setter = null} }, {"selection", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_selection, Setter = S_selection} }, {"type", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_type, Setter = null} }, {"targetDisplay", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_targetDisplay, Setter = S_targetDisplay} }, {"area", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_area, Setter = null} }, {"visible", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_visible, Setter = null} }, } }; } } } <|start_filename|>Projects/GenerateDatas/convert_lua/role.TbRoleLevelExpAttr/20.lua<|end_filename|> return { level = 20, need_exp = 6000, clothes_attrs = { 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, }, } <|start_filename|>Projects/Go_json/gen/src/cfg/item.ECurrencyType.go<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg const ( ItemECurrencyType_DIAMOND = 1 ItemECurrencyType_GOLD = 2 ItemECurrencyType_SILVER = 3 ItemECurrencyType_EXP = 4 ItemECurrencyType_POWER_POINT = 5 ) <|start_filename|>Projects/Lua_Unity_tolua_bin/Assets/Main.cs<|end_filename|> using System.Collections; using System.Collections.Generic; using UnityEngine; using LuaInterface; public class Main : MonoBehaviour { // Start is called before the first frame update void Start() { LuaState lua = new LuaState(); lua.Start(); LuaBinder.Bind(lua); string hello = @" (require 'TestGen').Start() "; lua.DoString(hello, "Main.cs"); lua.CheckTop(); lua.Dispose(); lua = null; } // Update is called once per frame void Update() { } } <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/test/DemoD2.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.test { public sealed partial class DemoD2 : test.DemoDynamic { public DemoD2(ByteBuf _buf) : base(_buf) { X2 = _buf.ReadInt(); } public DemoD2(int x1, int x2 ) : base(x1) { this.X2 = x2; } public static DemoD2 DeserializeDemoD2(ByteBuf _buf) { return new test.DemoD2(_buf); } public readonly int X2; public const int ID = -2138341747; public override int GetTypeId() => ID; public override void Resolve(Dictionary<string, object> _tables) { base.Resolve(_tables); OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); public override string ToString() { return "{ " + "X1:" + X1 + "," + "X2:" + X2 + "," + "}"; } } } <|start_filename|>Projects/GenerateDatas/convert_lua/item.TbItemExtra/1110020016.lua<|end_filename|> return { _name = 'DesignDrawing', id = 1110020016, learn_component_id = { 1021309132, }, } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_PropertyName_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_PropertyName_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var result = new UnityEngine.PropertyName(Arg0); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.PropertyName), result); } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.PropertyName), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.PropertyName>(false); var result = new UnityEngine.PropertyName(Arg0); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.PropertyName), result); } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var result = new UnityEngine.PropertyName(Arg0); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.PropertyName), result); } } if (paramLen == 0) { { var result = new UnityEngine.PropertyName(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.PropertyName), result); } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.PropertyName constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_IsNullOrEmpty(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.PropertyName>(false); var result = UnityEngine.PropertyName.IsNullOrEmpty(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetHashCode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.PropertyName)Puerts.Utils.GetSelf((int)data, self); { { var result = obj.GetHashCode(); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Equals(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.PropertyName)Puerts.Utils.GetSelf((int)data, self); if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.Any, typeof(System.Object), false, false)) { var Arg0 = argHelper0.Get<System.Object>(false); var result = obj.Equals(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.PropertyName), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.PropertyName>(false); var result = obj.Equals(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to Equals"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ToString(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.PropertyName)Puerts.Utils.GetSelf((int)data, self); { { var result = obj.ToString(); Puerts.PuertsDLL.ReturnString(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void O_op_Equality(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var arg0 = argHelper0.Get<UnityEngine.PropertyName>(false); var arg1 = argHelper1.Get<UnityEngine.PropertyName>(false); var result = arg0 == arg1; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void O_op_Inequality(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var arg0 = argHelper0.Get<UnityEngine.PropertyName>(false); var arg1 = argHelper1.Get<UnityEngine.PropertyName>(false); var result = arg0 != arg1; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "IsNullOrEmpty", IsStatic = true}, F_IsNullOrEmpty }, { new Puerts.MethodKey {Name = "GetHashCode", IsStatic = false}, M_GetHashCode }, { new Puerts.MethodKey {Name = "Equals", IsStatic = false}, M_Equals }, { new Puerts.MethodKey {Name = "ToString", IsStatic = false}, M_ToString }, { new Puerts.MethodKey {Name = "op_Equality", IsStatic = true}, O_op_Equality}, { new Puerts.MethodKey {Name = "op_Inequality", IsStatic = true}, O_op_Inequality}, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { } }; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_ParticleSystem_EmitParams_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_ParticleSystem_EmitParams_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.ParticleSystem.EmitParams constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ResetPosition(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.EmitParams)Puerts.Utils.GetSelf((int)data, self); { { obj.ResetPosition(); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ResetVelocity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.EmitParams)Puerts.Utils.GetSelf((int)data, self); { { obj.ResetVelocity(); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ResetAxisOfRotation(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.EmitParams)Puerts.Utils.GetSelf((int)data, self); { { obj.ResetAxisOfRotation(); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ResetRotation(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.EmitParams)Puerts.Utils.GetSelf((int)data, self); { { obj.ResetRotation(); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ResetAngularVelocity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.EmitParams)Puerts.Utils.GetSelf((int)data, self); { { obj.ResetAngularVelocity(); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ResetStartSize(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.EmitParams)Puerts.Utils.GetSelf((int)data, self); { { obj.ResetStartSize(); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ResetStartColor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.EmitParams)Puerts.Utils.GetSelf((int)data, self); { { obj.ResetStartColor(); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ResetRandomSeed(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.EmitParams)Puerts.Utils.GetSelf((int)data, self); { { obj.ResetRandomSeed(); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ResetStartLifetime(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.EmitParams)Puerts.Utils.GetSelf((int)data, self); { { obj.ResetStartLifetime(); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ResetMeshIndex(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.EmitParams)Puerts.Utils.GetSelf((int)data, self); { { obj.ResetMeshIndex(); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_particle(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.EmitParams)Puerts.Utils.GetSelf((int)data, self); var result = obj.particle; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_particle(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.EmitParams)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.particle = argHelper.Get<UnityEngine.ParticleSystem.Particle>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_position(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.EmitParams)Puerts.Utils.GetSelf((int)data, self); var result = obj.position; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_position(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.EmitParams)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.position = argHelper.Get<UnityEngine.Vector3>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_applyShapeToPosition(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.EmitParams)Puerts.Utils.GetSelf((int)data, self); var result = obj.applyShapeToPosition; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_applyShapeToPosition(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.EmitParams)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.applyShapeToPosition = argHelper.GetBoolean(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_velocity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.EmitParams)Puerts.Utils.GetSelf((int)data, self); var result = obj.velocity; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_velocity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.EmitParams)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.velocity = argHelper.Get<UnityEngine.Vector3>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_startLifetime(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.EmitParams)Puerts.Utils.GetSelf((int)data, self); var result = obj.startLifetime; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_startLifetime(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.EmitParams)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.startLifetime = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_startSize(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.EmitParams)Puerts.Utils.GetSelf((int)data, self); var result = obj.startSize; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_startSize(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.EmitParams)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.startSize = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_startSize3D(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.EmitParams)Puerts.Utils.GetSelf((int)data, self); var result = obj.startSize3D; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_startSize3D(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.EmitParams)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.startSize3D = argHelper.Get<UnityEngine.Vector3>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_axisOfRotation(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.EmitParams)Puerts.Utils.GetSelf((int)data, self); var result = obj.axisOfRotation; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_axisOfRotation(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.EmitParams)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.axisOfRotation = argHelper.Get<UnityEngine.Vector3>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_rotation(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.EmitParams)Puerts.Utils.GetSelf((int)data, self); var result = obj.rotation; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_rotation(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.EmitParams)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.rotation = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_rotation3D(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.EmitParams)Puerts.Utils.GetSelf((int)data, self); var result = obj.rotation3D; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_rotation3D(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.EmitParams)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.rotation3D = argHelper.Get<UnityEngine.Vector3>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_angularVelocity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.EmitParams)Puerts.Utils.GetSelf((int)data, self); var result = obj.angularVelocity; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_angularVelocity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.EmitParams)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.angularVelocity = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_angularVelocity3D(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.EmitParams)Puerts.Utils.GetSelf((int)data, self); var result = obj.angularVelocity3D; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_angularVelocity3D(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.EmitParams)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.angularVelocity3D = argHelper.Get<UnityEngine.Vector3>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_startColor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.EmitParams)Puerts.Utils.GetSelf((int)data, self); var result = obj.startColor; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_startColor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.EmitParams)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.startColor = argHelper.Get<UnityEngine.Color32>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_randomSeed(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.EmitParams)Puerts.Utils.GetSelf((int)data, self); var result = obj.randomSeed; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_randomSeed(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.EmitParams)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.randomSeed = argHelper.GetUInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_meshIndex(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.EmitParams)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.meshIndex = argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "ResetPosition", IsStatic = false}, M_ResetPosition }, { new Puerts.MethodKey {Name = "ResetVelocity", IsStatic = false}, M_ResetVelocity }, { new Puerts.MethodKey {Name = "ResetAxisOfRotation", IsStatic = false}, M_ResetAxisOfRotation }, { new Puerts.MethodKey {Name = "ResetRotation", IsStatic = false}, M_ResetRotation }, { new Puerts.MethodKey {Name = "ResetAngularVelocity", IsStatic = false}, M_ResetAngularVelocity }, { new Puerts.MethodKey {Name = "ResetStartSize", IsStatic = false}, M_ResetStartSize }, { new Puerts.MethodKey {Name = "ResetStartColor", IsStatic = false}, M_ResetStartColor }, { new Puerts.MethodKey {Name = "ResetRandomSeed", IsStatic = false}, M_ResetRandomSeed }, { new Puerts.MethodKey {Name = "ResetStartLifetime", IsStatic = false}, M_ResetStartLifetime }, { new Puerts.MethodKey {Name = "ResetMeshIndex", IsStatic = false}, M_ResetMeshIndex }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"particle", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_particle, Setter = S_particle} }, {"position", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_position, Setter = S_position} }, {"applyShapeToPosition", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_applyShapeToPosition, Setter = S_applyShapeToPosition} }, {"velocity", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_velocity, Setter = S_velocity} }, {"startLifetime", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_startLifetime, Setter = S_startLifetime} }, {"startSize", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_startSize, Setter = S_startSize} }, {"startSize3D", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_startSize3D, Setter = S_startSize3D} }, {"axisOfRotation", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_axisOfRotation, Setter = S_axisOfRotation} }, {"rotation", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_rotation, Setter = S_rotation} }, {"rotation3D", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_rotation3D, Setter = S_rotation3D} }, {"angularVelocity", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_angularVelocity, Setter = S_angularVelocity} }, {"angularVelocity3D", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_angularVelocity3D, Setter = S_angularVelocity3D} }, {"startColor", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_startColor, Setter = S_startColor} }, {"randomSeed", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_randomSeed, Setter = S_randomSeed} }, {"meshIndex", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = null, Setter = S_meshIndex} }, } }; } } } <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/common/Dummy.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.common { public sealed partial class Dummy : Bright.Config.BeanBase { public Dummy(ByteBuf _buf) { Id = _buf.ReadInt(); Limit = limit.LimitBase.DeserializeLimitBase(_buf); } public Dummy(int id, limit.LimitBase limit ) { this.Id = id; this.Limit = limit; } public static Dummy DeserializeDummy(ByteBuf _buf) { return new common.Dummy(_buf); } public readonly int Id; public readonly limit.LimitBase Limit; public const int ID = -985084219; public override int GetTypeId() => ID; public void Resolve(Dictionary<string, object> _tables) { Limit?.Resolve(_tables); OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); public override string ToString() { return "{ " + "Id:" + Id + "," + "Limit:" + Limit + "," + "}"; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_UI_AnimationTriggers_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_UI_AnimationTriggers_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.UI.AnimationTriggers(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.UI.AnimationTriggers), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_normalTrigger(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.AnimationTriggers; var result = obj.normalTrigger; Puerts.PuertsDLL.ReturnString(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_normalTrigger(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.AnimationTriggers; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.normalTrigger = argHelper.GetString(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_highlightedTrigger(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.AnimationTriggers; var result = obj.highlightedTrigger; Puerts.PuertsDLL.ReturnString(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_highlightedTrigger(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.AnimationTriggers; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.highlightedTrigger = argHelper.GetString(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_pressedTrigger(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.AnimationTriggers; var result = obj.pressedTrigger; Puerts.PuertsDLL.ReturnString(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_pressedTrigger(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.AnimationTriggers; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.pressedTrigger = argHelper.GetString(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_selectedTrigger(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.AnimationTriggers; var result = obj.selectedTrigger; Puerts.PuertsDLL.ReturnString(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_selectedTrigger(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.AnimationTriggers; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.selectedTrigger = argHelper.GetString(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_disabledTrigger(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.AnimationTriggers; var result = obj.disabledTrigger; Puerts.PuertsDLL.ReturnString(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_disabledTrigger(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.AnimationTriggers; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.disabledTrigger = argHelper.GetString(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"normalTrigger", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_normalTrigger, Setter = S_normalTrigger} }, {"highlightedTrigger", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_highlightedTrigger, Setter = S_highlightedTrigger} }, {"pressedTrigger", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_pressedTrigger, Setter = S_pressedTrigger} }, {"selectedTrigger", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_selectedTrigger, Setter = S_selectedTrigger} }, {"disabledTrigger", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_disabledTrigger, Setter = S_disabledTrigger} }, } }; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_CustomRenderTextureUpdateZone_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_CustomRenderTextureUpdateZone_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.CustomRenderTextureUpdateZone constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_updateZoneCenter(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.CustomRenderTextureUpdateZone)Puerts.Utils.GetSelf((int)data, self); var result = obj.updateZoneCenter; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_updateZoneCenter(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.CustomRenderTextureUpdateZone)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.updateZoneCenter = argHelper.Get<UnityEngine.Vector3>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_updateZoneSize(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.CustomRenderTextureUpdateZone)Puerts.Utils.GetSelf((int)data, self); var result = obj.updateZoneSize; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_updateZoneSize(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.CustomRenderTextureUpdateZone)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.updateZoneSize = argHelper.Get<UnityEngine.Vector3>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_rotation(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.CustomRenderTextureUpdateZone)Puerts.Utils.GetSelf((int)data, self); var result = obj.rotation; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_rotation(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.CustomRenderTextureUpdateZone)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.rotation = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_passIndex(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.CustomRenderTextureUpdateZone)Puerts.Utils.GetSelf((int)data, self); var result = obj.passIndex; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_passIndex(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.CustomRenderTextureUpdateZone)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.passIndex = argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_needSwap(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.CustomRenderTextureUpdateZone)Puerts.Utils.GetSelf((int)data, self); var result = obj.needSwap; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_needSwap(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.CustomRenderTextureUpdateZone)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.needSwap = argHelper.GetBoolean(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"updateZoneCenter", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_updateZoneCenter, Setter = S_updateZoneCenter} }, {"updateZoneSize", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_updateZoneSize, Setter = S_updateZoneSize} }, {"rotation", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_rotation, Setter = S_rotation} }, {"passIndex", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_passIndex, Setter = S_passIndex} }, {"needSwap", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_needSwap, Setter = S_needSwap} }, } }; } } } <|start_filename|>Projects/DataTemplates/template_erlang2/mail_tbglobalmail.erl<|end_filename|> %% mail.TbGlobalMail -module(mail_tbglobalmail) -export([get/1,get_ids/0]) get(21) -> #{ id => 21, title => "测试1", sender => "系统", content => "测试内容1", award => array, all_server => true, server_list => array, platform => "1", channel => "1", min_max_level => bean, register_time => bean, mail_time => bean }. get(22) -> #{ id => 22, title => "", sender => "系统", content => "测试内容2", award => array, all_server => false, server_list => array, platform => "1", channel => "1", min_max_level => bean, register_time => bean, mail_time => bean }. get(23) -> #{ id => 23, title => "", sender => "系统", content => "测试内容3", award => array, all_server => false, server_list => array, platform => "1", channel => "1", min_max_level => bean, register_time => bean, mail_time => bean }. get(24) -> #{ id => 24, title => "", sender => "系统", content => "测试内容3", award => array, all_server => false, server_list => array, platform => "1", channel => "1", min_max_level => bean, register_time => bean, mail_time => bean }. get_ids() -> [21,22,23,24]. <|start_filename|>Projects/Lua_Unity_xlua_lua/Assets/Lua/Data/test_tbtestexcelbean.lua<|end_filename|> return { [1] = {x1=1,x2="xx",x3=2,x4=2.5,}, [2] = {x1=2,x2="zz",x3=2,x4=4.3,}, [3] = {x1=3,x2="ww",x3=2,x4=5,}, [4] = {x1=4,x2="ee",x3=2,x4=6,}, } <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/test/DemoGroup.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.test { public sealed partial class DemoGroup : Bright.Config.BeanBase { public DemoGroup(ByteBuf _buf) { Id = _buf.ReadInt(); X1 = _buf.ReadInt(); X2 = _buf.ReadInt(); X3 = _buf.ReadInt(); X4 = _buf.ReadInt(); X5 = test.InnerGroup.DeserializeInnerGroup(_buf); } public DemoGroup(int id, int x1, int x2, int x3, int x4, test.InnerGroup x5 ) { this.Id = id; this.X1 = x1; this.X2 = x2; this.X3 = x3; this.X4 = x4; this.X5 = x5; } public static DemoGroup DeserializeDemoGroup(ByteBuf _buf) { return new test.DemoGroup(_buf); } public readonly int Id; public readonly int X1; public readonly int X2; public readonly int X3; public readonly int X4; public readonly test.InnerGroup X5; public const int ID = -379263008; public override int GetTypeId() => ID; public void Resolve(Dictionary<string, object> _tables) { X5?.Resolve(_tables); OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); public override string ToString() { return "{ " + "Id:" + Id + "," + "X1:" + X1 + "," + "X2:" + X2 + "," + "X3:" + X3 + "," + "X4:" + X4 + "," + "X5:" + X5 + "," + "}"; } } } <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/blueprint/ParamInfo.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.blueprint { public sealed partial class ParamInfo : Bright.Config.BeanBase { public ParamInfo(ByteBuf _buf) { Name = _buf.ReadString(); Type = _buf.ReadString(); IsRef = _buf.ReadBool(); } public ParamInfo(string name, string type, bool is_ref ) { this.Name = name; this.Type = type; this.IsRef = is_ref; } public static ParamInfo DeserializeParamInfo(ByteBuf _buf) { return new blueprint.ParamInfo(_buf); } public readonly string Name; public readonly string Type; public readonly bool IsRef; public const int ID = -729799392; public override int GetTypeId() => ID; public void Resolve(Dictionary<string, object> _tables) { OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); public override string ToString() { return "{ " + "Name:" + Name + "," + "Type:" + Type + "," + "IsRef:" + IsRef + "," + "}"; } } } <|start_filename|>Projects/DataTemplates/template_lua/test_tbtestexternaltype.lua<|end_filename|> return { [1] = {id=1,audio_type=1,color={r=0.2,g=0.2,b=0.4,a=1,},}, [2] = {id=2,audio_type=2,color={r=0.2,g=0.2,b=0.4,a=0.8,},}, } <|start_filename|>Projects/Go_json/gen/src/cfg/condition.ContainsItem.go<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg import "errors" type ConditionContainsItem struct { ItemId int32 Num int32 Reverse bool } const TypeId_ConditionContainsItem = 1961145317 func (*ConditionContainsItem) GetTypeId() int32 { return 1961145317 } func (_v *ConditionContainsItem)Deserialize(_buf map[string]interface{}) (err error) { { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["item_id"].(float64); !_ok_ { err = errors.New("item_id error"); return }; _v.ItemId = int32(_tempNum_) } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["num"].(float64); !_ok_ { err = errors.New("num error"); return }; _v.Num = int32(_tempNum_) } { var _ok_ bool; if _v.Reverse, _ok_ = _buf["reverse"].(bool); !_ok_ { err = errors.New("reverse error"); return } } return } func DeserializeConditionContainsItem(_buf map[string]interface{}) (*ConditionContainsItem, error) { v := &ConditionContainsItem{} if err := v.Deserialize(_buf); err == nil { return v, nil } else { return nil, err } } <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/limit/MonthlyLimit.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.limit { public sealed partial class MonthlyLimit : limit.LimitBase { public MonthlyLimit(ByteBuf _buf) : base(_buf) { Num = _buf.ReadInt(); } public MonthlyLimit(int num ) : base() { this.Num = num; } public static MonthlyLimit DeserializeMonthlyLimit(ByteBuf _buf) { return new limit.MonthlyLimit(_buf); } public readonly int Num; public const int ID = 2063279905; public override int GetTypeId() => ID; public override void Resolve(Dictionary<string, object> _tables) { base.Resolve(_tables); OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); public override string ToString() { return "{ " + "Num:" + Num + "," + "}"; } } } <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/ai/FlowNode.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.ai { public abstract partial class FlowNode : ai.Node { public FlowNode(ByteBuf _buf) : base(_buf) { {int n = System.Math.Min(_buf.ReadSize(), _buf.Size);Decorators = new System.Collections.Generic.List<ai.Decorator>(n);for(var i = 0 ; i < n ; i++) { ai.Decorator _e; _e = ai.Decorator.DeserializeDecorator(_buf); Decorators.Add(_e);}} {int n = System.Math.Min(_buf.ReadSize(), _buf.Size);Services = new System.Collections.Generic.List<ai.Service>(n);for(var i = 0 ; i < n ; i++) { ai.Service _e; _e = ai.Service.DeserializeService(_buf); Services.Add(_e);}} } public FlowNode(int id, string node_name, System.Collections.Generic.List<ai.Decorator> decorators, System.Collections.Generic.List<ai.Service> services ) : base(id,node_name) { this.Decorators = decorators; this.Services = services; } public static FlowNode DeserializeFlowNode(ByteBuf _buf) { switch (_buf.ReadInt()) { case ai.Sequence.ID: return new ai.Sequence(_buf); case ai.Selector.ID: return new ai.Selector(_buf); case ai.SimpleParallel.ID: return new ai.SimpleParallel(_buf); case ai.UeWait.ID: return new ai.UeWait(_buf); case ai.UeWaitBlackboardTime.ID: return new ai.UeWaitBlackboardTime(_buf); case ai.MoveToTarget.ID: return new ai.MoveToTarget(_buf); case ai.ChooseSkill.ID: return new ai.ChooseSkill(_buf); case ai.MoveToRandomLocation.ID: return new ai.MoveToRandomLocation(_buf); case ai.MoveToLocation.ID: return new ai.MoveToLocation(_buf); case ai.DebugPrint.ID: return new ai.DebugPrint(_buf); default: throw new SerializationException(); } } public readonly System.Collections.Generic.List<ai.Decorator> Decorators; public readonly System.Collections.Generic.List<ai.Service> Services; public override void Resolve(Dictionary<string, object> _tables) { base.Resolve(_tables); foreach(var _e in Decorators) { _e?.Resolve(_tables); } foreach(var _e in Services) { _e?.Resolve(_tables); } OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); public override string ToString() { return "{ " + "Id:" + Id + "," + "NodeName:" + NodeName + "," + "Decorators:" + Bright.Common.StringUtil.CollectionToString(Decorators) + "," + "Services:" + Bright.Common.StringUtil.CollectionToString(Services) + "," + "}"; } } } <|start_filename|>Projects/DataTemplates/template_erlang2/role_tbrolelevelbonuscoefficient.erl<|end_filename|> %% role.TbRoleLevelBonusCoefficient -module(role_tbrolelevelbonuscoefficient) -export([get/1,get_ids/0]) get(1001) -> #{ id => 1001, distinct_bonus_infos => array }. get_ids() -> [1001]. <|start_filename|>Projects/java_json/src/gen/cfg/test/DemoE1.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.test; import com.google.gson.JsonElement; import com.google.gson.JsonObject; public final class DemoE1 extends cfg.test.DemoD3 { public DemoE1(JsonObject __json__) { super(__json__); x4 = __json__.get("x4").getAsInt(); } public DemoE1(int x1, int x3, int x4 ) { super(x1, x3); this.x4 = x4; } public static DemoE1 deserializeDemoE1(JsonObject __json__) { return new DemoE1(__json__); } public final int x4; public static final int __ID__ = -2138341717; @Override public int getTypeId() { return __ID__; } @Override public void resolve(java.util.HashMap<String, Object> _tables) { super.resolve(_tables); } @Override public String toString() { return "{ " + "x1:" + x1 + "," + "x3:" + x3 + "," + "x4:" + x4 + "," + "}"; } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_LOD_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_LOD_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Renderer[]), false, false)) { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.Get<UnityEngine.Renderer[]>(false); var result = new UnityEngine.LOD(Arg0,Arg1); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.LOD), result); } } if (paramLen == 0) { { var result = new UnityEngine.LOD(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.LOD), result); } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.LOD constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_screenRelativeTransitionHeight(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.LOD)Puerts.Utils.GetSelf((int)data, self); var result = obj.screenRelativeTransitionHeight; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_screenRelativeTransitionHeight(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.LOD)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.screenRelativeTransitionHeight = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_fadeTransitionWidth(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.LOD)Puerts.Utils.GetSelf((int)data, self); var result = obj.fadeTransitionWidth; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_fadeTransitionWidth(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.LOD)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.fadeTransitionWidth = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_renderers(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.LOD)Puerts.Utils.GetSelf((int)data, self); var result = obj.renderers; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_renderers(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.LOD)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.renderers = argHelper.Get<UnityEngine.Renderer[]>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"screenRelativeTransitionHeight", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_screenRelativeTransitionHeight, Setter = S_screenRelativeTransitionHeight} }, {"fadeTransitionWidth", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_fadeTransitionWidth, Setter = S_fadeTransitionWidth} }, {"renderers", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_renderers, Setter = S_renderers} }, } }; } } } <|start_filename|>Projects/java_json/src/corelib/bright/serialization/ITypeId.java<|end_filename|> package bright.serialization; public interface ITypeId { int getTypeId(); } <|start_filename|>Projects/Csharp_CustomTemplate_EncryptMemory/Gen/ai/UeTimeLimit.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using System; using Newtonsoft.Json; using Scripts; namespace cfg.ai { [Serializable] public partial class UeTimeLimit : AConfig { [JsonProperty("limit_time")] private float _limit_time { get; set; } [JsonIgnore] public EncryptFloat limit_time { get; private set; } = new(); public override void EndInit() { limit_time = _limit_time; } public override string ToString() => JsonConvert.SerializeObject(this); } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_UI_AspectRatioFitter_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_UI_AspectRatioFitter_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.UI.AspectRatioFitter constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetLayoutHorizontal(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.AspectRatioFitter; { { obj.SetLayoutHorizontal(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetLayoutVertical(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.AspectRatioFitter; { { obj.SetLayoutVertical(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_IsComponentValidOnObject(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.AspectRatioFitter; { { var result = obj.IsComponentValidOnObject(); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_IsAspectModeValid(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.AspectRatioFitter; { { var result = obj.IsAspectModeValid(); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_aspectMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.AspectRatioFitter; var result = obj.aspectMode; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_aspectMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.AspectRatioFitter; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.aspectMode = (UnityEngine.UI.AspectRatioFitter.AspectMode)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_aspectRatio(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.AspectRatioFitter; var result = obj.aspectRatio; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_aspectRatio(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.AspectRatioFitter; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.aspectRatio = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "SetLayoutHorizontal", IsStatic = false}, M_SetLayoutHorizontal }, { new Puerts.MethodKey {Name = "SetLayoutVertical", IsStatic = false}, M_SetLayoutVertical }, { new Puerts.MethodKey {Name = "IsComponentValidOnObject", IsStatic = false}, M_IsComponentValidOnObject }, { new Puerts.MethodKey {Name = "IsAspectModeValid", IsStatic = false}, M_IsAspectModeValid }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"aspectMode", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_aspectMode, Setter = S_aspectMode} }, {"aspectRatio", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_aspectRatio, Setter = S_aspectRatio} }, } }; } } } <|start_filename|>Projects/Java_bin/src/main/gen/cfg/test/DemoType2.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.test; import bright.serialization.*; public final class DemoType2 { public DemoType2(ByteBuf _buf) { x4 = _buf.readInt(); x1 = _buf.readBool(); x2 = _buf.readByte(); x3 = _buf.readShort(); x5 = _buf.readLong(); x6 = _buf.readFloat(); x7 = _buf.readDouble(); x80 = _buf.readFshort(); x8 = _buf.readFint(); x9 = _buf.readFlong(); x10 = _buf.readString(); x12 = new cfg.test.DemoType1(_buf); x13 = cfg.test.DemoEnum.valueOf(_buf.readInt()); x14 = cfg.test.DemoDynamic.deserializeDemoDynamic(_buf); _buf.readString(); s1 = _buf.readString(); v2 = _buf.readVector2(); v3 = _buf.readVector3(); v4 = _buf.readVector4(); t1 = _buf.readInt(); {int n = Math.min(_buf.readSize(), _buf.size());k1 = new int[n];for(int i = 0 ; i < n ; i++) { int _e;_e = _buf.readInt(); k1[i] = _e;}} {int n = Math.min(_buf.readSize(), _buf.size());k2 = new java.util.ArrayList<Integer>(n);for(int i = 0 ; i < n ; i++) { Integer _e; _e = _buf.readInt(); k2.add(_e);}} {int n = Math.min(_buf.readSize(), _buf.size());k5 = new java.util.HashSet<Integer>(n * 3 / 2);for(int i = 0 ; i < n ; i++) { Integer _e; _e = _buf.readInt(); k5.add(_e);}} {int n = Math.min(_buf.readSize(), _buf.size());k8 = new java.util.HashMap<Integer, Integer>(n * 3 / 2);for(int i = 0 ; i < n ; i++) { Integer _k; _k = _buf.readInt(); Integer _v; _v = _buf.readInt(); k8.put(_k, _v);}} {int n = Math.min(_buf.readSize(), _buf.size());k9 = new java.util.ArrayList<cfg.test.DemoE2>(n);for(int i = 0 ; i < n ; i++) { cfg.test.DemoE2 _e; _e = new cfg.test.DemoE2(_buf); k9.add(_e);}} {int n = Math.min(_buf.readSize(), _buf.size());k15 = new cfg.test.DemoDynamic[n];for(int i = 0 ; i < n ; i++) { cfg.test.DemoDynamic _e;_e = cfg.test.DemoDynamic.deserializeDemoDynamic(_buf); k15[i] = _e;}} } public DemoType2(int x4, boolean x1, byte x2, short x3, long x5, float x6, double x7, short x8_0, int x8, long x9, String x10, cfg.test.DemoType1 x12, cfg.test.DemoEnum x13, cfg.test.DemoDynamic x14, String s1, bright.math.Vector2 v2, bright.math.Vector3 v3, bright.math.Vector4 v4, int t1, int[] k1, java.util.ArrayList<Integer> k2, java.util.HashSet<Integer> k5, java.util.HashMap<Integer, Integer> k8, java.util.ArrayList<cfg.test.DemoE2> k9, cfg.test.DemoDynamic[] k15 ) { this.x4 = x4; this.x1 = x1; this.x2 = x2; this.x3 = x3; this.x5 = x5; this.x6 = x6; this.x7 = x7; this.x80 = x8_0; this.x8 = x8; this.x9 = x9; this.x10 = x10; this.x12 = x12; this.x13 = x13; this.x14 = x14; this.s1 = s1; this.v2 = v2; this.v3 = v3; this.v4 = v4; this.t1 = t1; this.k1 = k1; this.k2 = k2; this.k5 = k5; this.k8 = k8; this.k9 = k9; this.k15 = k15; } public final int x4; public final boolean x1; public final byte x2; public final short x3; public final long x5; public final float x6; public final double x7; public final short x80; public final int x8; public final long x9; public final String x10; public final cfg.test.DemoType1 x12; public final cfg.test.DemoEnum x13; public final cfg.test.DemoDynamic x14; public final String s1; public final bright.math.Vector2 v2; public final bright.math.Vector3 v3; public final bright.math.Vector4 v4; public final int t1; public final int[] k1; public final java.util.ArrayList<Integer> k2; public final java.util.HashSet<Integer> k5; public final java.util.HashMap<Integer, Integer> k8; public final java.util.ArrayList<cfg.test.DemoE2> k9; public final cfg.test.DemoDynamic[] k15; public void resolve(java.util.HashMap<String, Object> _tables) { if (x12 != null) {x12.resolve(_tables);} if (x14 != null) {x14.resolve(_tables);} for(cfg.test.DemoE2 _e : k9) { if (_e != null) _e.resolve(_tables); } for(cfg.test.DemoDynamic _e : k15) { if (_e != null) _e.resolve(_tables); } } @Override public String toString() { return "{ " + "x4:" + x4 + "," + "x1:" + x1 + "," + "x2:" + x2 + "," + "x3:" + x3 + "," + "x5:" + x5 + "," + "x6:" + x6 + "," + "x7:" + x7 + "," + "x80:" + x80 + "," + "x8:" + x8 + "," + "x9:" + x9 + "," + "x10:" + x10 + "," + "x12:" + x12 + "," + "x13:" + x13 + "," + "x14:" + x14 + "," + "s1:" + s1 + "," + "v2:" + v2 + "," + "v3:" + v3 + "," + "v4:" + v4 + "," + "t1:" + t1 + "," + "k1:" + k1 + "," + "k2:" + k2 + "," + "k5:" + k5 + "," + "k8:" + k8 + "," + "k9:" + k9 + "," + "k15:" + k15 + "," + "}"; } } <|start_filename|>Projects/java_json/src/gen/cfg/ai/EFlowAbortMode.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.ai; public enum EFlowAbortMode { NONE(0), LOWER_PRIORITY(1), SELF(2), BOTH(3), ; private final int value; public int getValue() { return value; } EFlowAbortMode(int value) { this.value = value; } public static EFlowAbortMode valueOf(int value) { if (value == 0) return NONE; if (value == 1) return LOWER_PRIORITY; if (value == 2) return SELF; if (value == 3) return BOTH; throw new IllegalArgumentException(""); } } <|start_filename|>Projects/DataTemplates/template_lua/test_tbsingleton.lua<|end_filename|> return {id=5,name={key='key_name',text="aabbcc"},date={ _name='DemoD5',x1=1,time={start_time=398966400,end_time=936806400,},},} <|start_filename|>Projects/DataTemplates/template_erlang/test_tbdemogroup.erl<|end_filename|> %% test.TbDemoGroup get(1) -> #{id => 1,x1 => 1,x2 => 2,x3 => 3,x4 => 4,x5 => #{y1 => 10,y2 => 20,y3 => 30,y4 => 40}}. get(2) -> #{id => 2,x1 => 1,x2 => 2,x3 => 3,x4 => 4,x5 => #{y1 => 10,y2 => 20,y3 => 30,y4 => 40}}. get(3) -> #{id => 3,x1 => 1,x2 => 2,x3 => 3,x4 => 4,x5 => #{y1 => 10,y2 => 20,y3 => 30,y4 => 40}}. get(4) -> #{id => 4,x1 => 1,x2 => 2,x3 => 3,x4 => 4,x5 => #{y1 => 10,y2 => 20,y3 => 30,y4 => 40}}. <|start_filename|>Projects/DataTemplates/template_lua2/test_tbtestsize.lua<|end_filename|> -- test.TbTestSize return { [1] = { id=1, x1= { 1, 2, }, x2= { 3, 4, }, x3= { 5, 6, }, x4= { [1] = 2, [3] = 4, }, }, } <|start_filename|>Projects/GenerateDatas/convert_lua/test.TbDemoPrimitive/3.lua<|end_filename|> return { x1 = false, x2 = 1, x3 = 2, x4 = 3, x5 = 4, x6 = 5, x7 = 6, s1 = "hello", s2 = {key='/test/key1',text="测试本地化字符串1"}, v2 = {x=1,y=2}, v3 = {x=2,y=3,z=4}, v4 = {x=4,y=5,z=6,w=7}, t1 = 2000-1-2 00:05:00, } <|start_filename|>Projects/GenerateDatas/convert_lua/role.TbRoleLevelExpAttr/4.lua<|end_filename|> return { level = 4, need_exp = 300, clothes_attrs = { 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, }, } <|start_filename|>Projects/Csharp_DotNet5_bin/Gen/test/TestRef.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.test { public sealed class TestRef : Bright.Config.BeanBase { public TestRef(ByteBuf _buf) { Id = _buf.ReadInt(); X1 = _buf.ReadInt(); X12 = _buf.ReadInt(); X2 = _buf.ReadInt(); X3 = _buf.ReadInt(); {int n = System.Math.Min(_buf.ReadSize(), _buf.Size);A1 = new int[n];for(var i = 0 ; i < n ; i++) { int _e;_e = _buf.ReadInt(); A1[i] = _e;}} {int n = System.Math.Min(_buf.ReadSize(), _buf.Size);A2 = new int[n];for(var i = 0 ; i < n ; i++) { int _e;_e = _buf.ReadInt(); A2[i] = _e;}} {int n = System.Math.Min(_buf.ReadSize(), _buf.Size);B1 = new System.Collections.Generic.List<int>(n);for(var i = 0 ; i < n ; i++) { int _e; _e = _buf.ReadInt(); B1.Add(_e);}} {int n = System.Math.Min(_buf.ReadSize(), _buf.Size);B2 = new System.Collections.Generic.List<int>(n);for(var i = 0 ; i < n ; i++) { int _e; _e = _buf.ReadInt(); B2.Add(_e);}} {int n = System.Math.Min(_buf.ReadSize(), _buf.Size);C1 = new System.Collections.Generic.HashSet<int>(/*n * 3 / 2*/);for(var i = 0 ; i < n ; i++) { int _e; _e = _buf.ReadInt(); C1.Add(_e);}} {int n = System.Math.Min(_buf.ReadSize(), _buf.Size);C2 = new System.Collections.Generic.HashSet<int>(/*n * 3 / 2*/);for(var i = 0 ; i < n ; i++) { int _e; _e = _buf.ReadInt(); C2.Add(_e);}} {int n = System.Math.Min(_buf.ReadSize(), _buf.Size);D1 = new System.Collections.Generic.Dictionary<int, int>(n * 3 / 2);for(var i = 0 ; i < n ; i++) { int _k; _k = _buf.ReadInt(); int _v; _v = _buf.ReadInt(); D1.Add(_k, _v);}} {int n = System.Math.Min(_buf.ReadSize(), _buf.Size);D2 = new System.Collections.Generic.Dictionary<int, int>(n * 3 / 2);for(var i = 0 ; i < n ; i++) { int _k; _k = _buf.ReadInt(); int _v; _v = _buf.ReadInt(); D2.Add(_k, _v);}} E1 = _buf.ReadInt(); E2 = _buf.ReadLong(); E3 = _buf.ReadString(); F1 = _buf.ReadInt(); F2 = _buf.ReadLong(); F3 = _buf.ReadString(); } public static TestRef DeserializeTestRef(ByteBuf _buf) { return new test.TestRef(_buf); } public int Id { get; private set; } public int X1 { get; private set; } public test.TestBeRef X1_Ref { get; private set; } public int X12 { get; private set; } public int X2 { get; private set; } public test.TestBeRef X2_Ref { get; private set; } public int X3 { get; private set; } public int[] A1 { get; private set; } public int[] A2 { get; private set; } public System.Collections.Generic.List<int> B1 { get; private set; } public System.Collections.Generic.List<int> B2 { get; private set; } public System.Collections.Generic.HashSet<int> C1 { get; private set; } public System.Collections.Generic.HashSet<int> C2 { get; private set; } public System.Collections.Generic.Dictionary<int, int> D1 { get; private set; } public System.Collections.Generic.Dictionary<int, int> D2 { get; private set; } public int E1 { get; private set; } public long E2 { get; private set; } public string E3 { get; private set; } public int F1 { get; private set; } public long F2 { get; private set; } public string F3 { get; private set; } public const int __ID__ = -543222491; public override int GetTypeId() => __ID__; public void Resolve(Dictionary<string, object> _tables) { this.X1_Ref = (_tables["test.TbTestBeRef"] as test.TbTestBeRef).GetOrDefault(X1); this.X2_Ref = (_tables["test.TbTestBeRef"] as test.TbTestBeRef).GetOrDefault(X2); } public void TranslateText(System.Func<string, string, string> translator) { } public override string ToString() { return "{ " + "Id:" + Id + "," + "X1:" + X1 + "," + "X12:" + X12 + "," + "X2:" + X2 + "," + "X3:" + X3 + "," + "A1:" + Bright.Common.StringUtil.CollectionToString(A1) + "," + "A2:" + Bright.Common.StringUtil.CollectionToString(A2) + "," + "B1:" + Bright.Common.StringUtil.CollectionToString(B1) + "," + "B2:" + Bright.Common.StringUtil.CollectionToString(B2) + "," + "C1:" + Bright.Common.StringUtil.CollectionToString(C1) + "," + "C2:" + Bright.Common.StringUtil.CollectionToString(C2) + "," + "D1:" + Bright.Common.StringUtil.CollectionToString(D1) + "," + "D2:" + Bright.Common.StringUtil.CollectionToString(D2) + "," + "E1:" + E1 + "," + "E2:" + E2 + "," + "E3:" + E3 + "," + "F1:" + F1 + "," + "F2:" + F2 + "," + "F3:" + F3 + "," + "}"; } } } <|start_filename|>Projects/java_json/src/gen/cfg/item/EClothersTag.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.item; public enum EClothersTag { /** * 防晒 */ FANG_SHAI(1), /** * 舞者 */ WU_ZHE(2), ; private final int value; public int getValue() { return value; } EClothersTag(int value) { this.value = value; } public static EClothersTag valueOf(int value) { if (value == 1) return FANG_SHAI; if (value == 2) return WU_ZHE; throw new IllegalArgumentException(""); } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_UI_Text_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_UI_Text_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.UI.Text constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_FontTextureChanged(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Text; { { obj.FontTextureChanged(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetGenerationSettings(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Text; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var result = obj.GetGenerationSettings(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetTextAnchorPivot(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = (UnityEngine.TextAnchor)argHelper0.GetInt32(false); var result = UnityEngine.UI.Text.GetTextAnchorPivot(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_CalculateLayoutInputHorizontal(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Text; { { obj.CalculateLayoutInputHorizontal(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_CalculateLayoutInputVertical(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Text; { { obj.CalculateLayoutInputVertical(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_cachedTextGenerator(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Text; var result = obj.cachedTextGenerator; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_cachedTextGeneratorForLayout(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Text; var result = obj.cachedTextGeneratorForLayout; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_mainTexture(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Text; var result = obj.mainTexture; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_font(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Text; var result = obj.font; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_font(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Text; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.font = argHelper.Get<UnityEngine.Font>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_text(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Text; var result = obj.text; Puerts.PuertsDLL.ReturnString(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_text(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Text; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.text = argHelper.GetString(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_supportRichText(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Text; var result = obj.supportRichText; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_supportRichText(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Text; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.supportRichText = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_resizeTextForBestFit(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Text; var result = obj.resizeTextForBestFit; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_resizeTextForBestFit(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Text; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.resizeTextForBestFit = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_resizeTextMinSize(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Text; var result = obj.resizeTextMinSize; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_resizeTextMinSize(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Text; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.resizeTextMinSize = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_resizeTextMaxSize(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Text; var result = obj.resizeTextMaxSize; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_resizeTextMaxSize(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Text; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.resizeTextMaxSize = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_alignment(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Text; var result = obj.alignment; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_alignment(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Text; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.alignment = (UnityEngine.TextAnchor)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_alignByGeometry(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Text; var result = obj.alignByGeometry; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_alignByGeometry(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Text; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.alignByGeometry = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_fontSize(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Text; var result = obj.fontSize; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_fontSize(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Text; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.fontSize = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_horizontalOverflow(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Text; var result = obj.horizontalOverflow; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_horizontalOverflow(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Text; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.horizontalOverflow = (UnityEngine.HorizontalWrapMode)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_verticalOverflow(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Text; var result = obj.verticalOverflow; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_verticalOverflow(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Text; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.verticalOverflow = (UnityEngine.VerticalWrapMode)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_lineSpacing(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Text; var result = obj.lineSpacing; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_lineSpacing(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Text; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.lineSpacing = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_fontStyle(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Text; var result = obj.fontStyle; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_fontStyle(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Text; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.fontStyle = (UnityEngine.FontStyle)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_pixelsPerUnit(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Text; var result = obj.pixelsPerUnit; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_minWidth(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Text; var result = obj.minWidth; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_preferredWidth(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Text; var result = obj.preferredWidth; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_flexibleWidth(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Text; var result = obj.flexibleWidth; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_minHeight(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Text; var result = obj.minHeight; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_preferredHeight(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Text; var result = obj.preferredHeight; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_flexibleHeight(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Text; var result = obj.flexibleHeight; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_layoutPriority(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Text; var result = obj.layoutPriority; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "FontTextureChanged", IsStatic = false}, M_FontTextureChanged }, { new Puerts.MethodKey {Name = "GetGenerationSettings", IsStatic = false}, M_GetGenerationSettings }, { new Puerts.MethodKey {Name = "GetTextAnchorPivot", IsStatic = true}, F_GetTextAnchorPivot }, { new Puerts.MethodKey {Name = "CalculateLayoutInputHorizontal", IsStatic = false}, M_CalculateLayoutInputHorizontal }, { new Puerts.MethodKey {Name = "CalculateLayoutInputVertical", IsStatic = false}, M_CalculateLayoutInputVertical }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"cachedTextGenerator", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_cachedTextGenerator, Setter = null} }, {"cachedTextGeneratorForLayout", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_cachedTextGeneratorForLayout, Setter = null} }, {"mainTexture", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_mainTexture, Setter = null} }, {"font", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_font, Setter = S_font} }, {"text", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_text, Setter = S_text} }, {"supportRichText", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_supportRichText, Setter = S_supportRichText} }, {"resizeTextForBestFit", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_resizeTextForBestFit, Setter = S_resizeTextForBestFit} }, {"resizeTextMinSize", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_resizeTextMinSize, Setter = S_resizeTextMinSize} }, {"resizeTextMaxSize", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_resizeTextMaxSize, Setter = S_resizeTextMaxSize} }, {"alignment", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_alignment, Setter = S_alignment} }, {"alignByGeometry", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_alignByGeometry, Setter = S_alignByGeometry} }, {"fontSize", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_fontSize, Setter = S_fontSize} }, {"horizontalOverflow", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_horizontalOverflow, Setter = S_horizontalOverflow} }, {"verticalOverflow", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_verticalOverflow, Setter = S_verticalOverflow} }, {"lineSpacing", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_lineSpacing, Setter = S_lineSpacing} }, {"fontStyle", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_fontStyle, Setter = S_fontStyle} }, {"pixelsPerUnit", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_pixelsPerUnit, Setter = null} }, {"minWidth", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_minWidth, Setter = null} }, {"preferredWidth", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_preferredWidth, Setter = null} }, {"flexibleWidth", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_flexibleWidth, Setter = null} }, {"minHeight", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_minHeight, Setter = null} }, {"preferredHeight", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_preferredHeight, Setter = null} }, {"flexibleHeight", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_flexibleHeight, Setter = null} }, {"layoutPriority", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_layoutPriority, Setter = null} }, } }; } } } <|start_filename|>Projects/Csharp_Unity_bin_use_UnityEngine_Vector/Assets/Gen/ai/KeyData.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.ai { public abstract class KeyData : Bright.Config.BeanBase { public KeyData(ByteBuf _buf) { } public static KeyData DeserializeKeyData(ByteBuf _buf) { switch (_buf.ReadInt()) { case ai.FloatKeyData.__ID__: return new ai.FloatKeyData(_buf); case ai.IntKeyData.__ID__: return new ai.IntKeyData(_buf); case ai.StringKeyData.__ID__: return new ai.StringKeyData(_buf); case ai.BlackboardKeyData.__ID__: return new ai.BlackboardKeyData(_buf); default: throw new SerializationException(); } } public virtual void Resolve(Dictionary<string, object> _tables) { } public virtual void TranslateText(System.Func<string, string, string> translator) { } public override string ToString() { return "{ " + "}"; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_LensFlare_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_LensFlare_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.LensFlare(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.LensFlare), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_brightness(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LensFlare; var result = obj.brightness; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_brightness(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LensFlare; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.brightness = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_fadeSpeed(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LensFlare; var result = obj.fadeSpeed; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_fadeSpeed(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LensFlare; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.fadeSpeed = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_color(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LensFlare; var result = obj.color; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_color(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LensFlare; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.color = argHelper.Get<UnityEngine.Color>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_flare(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LensFlare; var result = obj.flare; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_flare(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LensFlare; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.flare = argHelper.Get<UnityEngine.Flare>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"brightness", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_brightness, Setter = S_brightness} }, {"fadeSpeed", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_fadeSpeed, Setter = S_fadeSpeed} }, {"color", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_color, Setter = S_color} }, {"flare", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_flare, Setter = S_flare} }, } }; } } } <|start_filename|>Projects/DataTemplates/template_json/ai_tbblackboard.json<|end_filename|> { "attack_or_patrol": {"name":"attack_or_patrol","desc":"demo hahaha","parent_name":"","keys":[{"name":"OriginPosition","desc":"","is_static":false,"type":5,"type_class_name":""},{"name":"TargetActor","desc":"x2 haha","is_static":false,"type":10,"type_class_name":""},{"name":"AcceptableRadius","desc":"x3 haha","is_static":false,"type":3,"type_class_name":""},{"name":"CurChooseSkillId","desc":"x4 haha","is_static":false,"type":2,"type_class_name":""}]} , "demo": {"name":"demo","desc":"demo hahaha","parent_name":"demo_parent","keys":[{"name":"x1","desc":"x1 haha","is_static":false,"type":1,"type_class_name":""},{"name":"x2","desc":"x2 haha","is_static":false,"type":2,"type_class_name":""},{"name":"x3","desc":"x3 haha","is_static":false,"type":3,"type_class_name":""},{"name":"x4","desc":"x4 haha","is_static":false,"type":4,"type_class_name":""},{"name":"x5","desc":"x5 haha","is_static":false,"type":5,"type_class_name":""},{"name":"x6","desc":"x6 haha","is_static":false,"type":6,"type_class_name":""},{"name":"x7","desc":"x7 haha","is_static":false,"type":7,"type_class_name":""},{"name":"x8","desc":"x8 haha","is_static":false,"type":8,"type_class_name":""},{"name":"x9","desc":"x9 haha","is_static":false,"type":9,"type_class_name":"ABC"},{"name":"x10","desc":"x10 haha","is_static":false,"type":10,"type_class_name":"OBJECT"}]} , "demo_parent": {"name":"demo_parent","desc":"demo parent","parent_name":"","keys":[{"name":"v1","desc":"v1 haha","is_static":false,"type":1,"type_class_name":""}]} } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_ParticleSystemForceField_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_ParticleSystemForceField_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.ParticleSystemForceField(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.ParticleSystemForceField), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_shape(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ParticleSystemForceField; var result = obj.shape; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_shape(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ParticleSystemForceField; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.shape = (UnityEngine.ParticleSystemForceFieldShape)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_startRange(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ParticleSystemForceField; var result = obj.startRange; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_startRange(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ParticleSystemForceField; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.startRange = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_endRange(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ParticleSystemForceField; var result = obj.endRange; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_endRange(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ParticleSystemForceField; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.endRange = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_length(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ParticleSystemForceField; var result = obj.length; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_length(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ParticleSystemForceField; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.length = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_gravityFocus(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ParticleSystemForceField; var result = obj.gravityFocus; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_gravityFocus(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ParticleSystemForceField; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.gravityFocus = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_rotationRandomness(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ParticleSystemForceField; var result = obj.rotationRandomness; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_rotationRandomness(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ParticleSystemForceField; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.rotationRandomness = argHelper.Get<UnityEngine.Vector2>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_multiplyDragByParticleSize(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ParticleSystemForceField; var result = obj.multiplyDragByParticleSize; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_multiplyDragByParticleSize(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ParticleSystemForceField; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.multiplyDragByParticleSize = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_multiplyDragByParticleVelocity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ParticleSystemForceField; var result = obj.multiplyDragByParticleVelocity; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_multiplyDragByParticleVelocity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ParticleSystemForceField; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.multiplyDragByParticleVelocity = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_vectorField(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ParticleSystemForceField; var result = obj.vectorField; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_vectorField(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ParticleSystemForceField; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.vectorField = argHelper.Get<UnityEngine.Texture3D>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_directionX(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ParticleSystemForceField; var result = obj.directionX; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_directionX(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ParticleSystemForceField; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.directionX = argHelper.Get<UnityEngine.ParticleSystem.MinMaxCurve>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_directionY(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ParticleSystemForceField; var result = obj.directionY; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_directionY(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ParticleSystemForceField; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.directionY = argHelper.Get<UnityEngine.ParticleSystem.MinMaxCurve>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_directionZ(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ParticleSystemForceField; var result = obj.directionZ; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_directionZ(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ParticleSystemForceField; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.directionZ = argHelper.Get<UnityEngine.ParticleSystem.MinMaxCurve>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_gravity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ParticleSystemForceField; var result = obj.gravity; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_gravity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ParticleSystemForceField; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.gravity = argHelper.Get<UnityEngine.ParticleSystem.MinMaxCurve>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_rotationSpeed(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ParticleSystemForceField; var result = obj.rotationSpeed; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_rotationSpeed(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ParticleSystemForceField; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.rotationSpeed = argHelper.Get<UnityEngine.ParticleSystem.MinMaxCurve>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_rotationAttraction(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ParticleSystemForceField; var result = obj.rotationAttraction; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_rotationAttraction(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ParticleSystemForceField; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.rotationAttraction = argHelper.Get<UnityEngine.ParticleSystem.MinMaxCurve>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_drag(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ParticleSystemForceField; var result = obj.drag; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_drag(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ParticleSystemForceField; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.drag = argHelper.Get<UnityEngine.ParticleSystem.MinMaxCurve>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_vectorFieldSpeed(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ParticleSystemForceField; var result = obj.vectorFieldSpeed; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_vectorFieldSpeed(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ParticleSystemForceField; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.vectorFieldSpeed = argHelper.Get<UnityEngine.ParticleSystem.MinMaxCurve>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_vectorFieldAttraction(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ParticleSystemForceField; var result = obj.vectorFieldAttraction; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_vectorFieldAttraction(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ParticleSystemForceField; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.vectorFieldAttraction = argHelper.Get<UnityEngine.ParticleSystem.MinMaxCurve>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"shape", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_shape, Setter = S_shape} }, {"startRange", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_startRange, Setter = S_startRange} }, {"endRange", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_endRange, Setter = S_endRange} }, {"length", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_length, Setter = S_length} }, {"gravityFocus", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_gravityFocus, Setter = S_gravityFocus} }, {"rotationRandomness", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_rotationRandomness, Setter = S_rotationRandomness} }, {"multiplyDragByParticleSize", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_multiplyDragByParticleSize, Setter = S_multiplyDragByParticleSize} }, {"multiplyDragByParticleVelocity", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_multiplyDragByParticleVelocity, Setter = S_multiplyDragByParticleVelocity} }, {"vectorField", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_vectorField, Setter = S_vectorField} }, {"directionX", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_directionX, Setter = S_directionX} }, {"directionY", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_directionY, Setter = S_directionY} }, {"directionZ", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_directionZ, Setter = S_directionZ} }, {"gravity", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_gravity, Setter = S_gravity} }, {"rotationSpeed", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_rotationSpeed, Setter = S_rotationSpeed} }, {"rotationAttraction", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_rotationAttraction, Setter = S_rotationAttraction} }, {"drag", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_drag, Setter = S_drag} }, {"vectorFieldSpeed", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_vectorFieldSpeed, Setter = S_vectorFieldSpeed} }, {"vectorFieldAttraction", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_vectorFieldAttraction, Setter = S_vectorFieldAttraction} }, } }; } } } <|start_filename|>Projects/Csharp_CustomTemplate_EncryptMemory/Gen/test/DemoPrimitiveTypesTable.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using System; using Newtonsoft.Json; using Scripts; namespace cfg.test { [Serializable] public partial class DemoPrimitiveTypesTable : AConfig { public bool x1 { get; set; } public byte x2 { get; set; } public short x3 { get; set; } [JsonProperty("x4")] private int _x4 { get; set; } [JsonIgnore] public EncryptInt x4 { get; private set; } = new(); [JsonProperty("x5")] private long _x5 { get; set; } [JsonIgnore] public EncryptLong x5 { get; private set; } = new(); [JsonProperty("x6")] private float _x6 { get; set; } [JsonIgnore] public EncryptFloat x6 { get; private set; } = new(); [JsonProperty("x7")] private double _x7 { get; set; } [JsonIgnore] public EncryptDouble x7 { get; private set; } = new(); public string s1 { get; set; } public string s2 { get; set; } public string S2_l10n_key { get; } public System.Numerics.Vector2 v2 { get; set; } public System.Numerics.Vector3 v3 { get; set; } public System.Numerics.Vector4 v4 { get; set; } public int t1 { get; set; } public override void EndInit() { x4 = _x4; x5 = _x5; x6 = _x6; x7 = _x7; } public override string ToString() => JsonConvert.SerializeObject(this); } } <|start_filename|>Projects/DataTemplates/template_lua2/test_tbtestref.lua<|end_filename|> -- test.TbTestRef return { [1] = { id=1, x1=1, x1_2=1, x2=2, a1= { 1, 2, }, a2= { 2, 3, }, b1= { 3, 4, }, b2= { 4, 5, }, c1= { 5, 6, 7, }, c2= { 6, 7, }, d1= { [1] = 2, [3] = 4, }, d2= { [1] = 2, [3] = 4, }, e1=1, e2=11, e3="ab5", f1=1, f2=11, f3="ab5", }, [2] = { id=2, x1=1, x1_2=1, x2=2, a1= { 1, 3, }, a2= { 2, 4, }, b1= { 3, 5, }, b2= { 4, 6, }, c1= { 5, 6, 8, }, c2= { 6, 8, }, d1= { [1] = 2, [3] = 4, }, d2= { [1] = 2, [3] = 4, }, e1=1, e2=11, e3="ab5", f1=1, f2=11, f3="ab5", }, [3] = { id=3, x1=1, x1_2=1, x2=2, a1= { 1, 4, }, a2= { 2, 5, }, b1= { 3, 6, }, b2= { 4, 7, }, c1= { 5, 6, 9, }, c2= { 6, 9, }, d1= { [1] = 2, [3] = 4, }, d2= { [1] = 2, [3] = 4, }, e1=1, e2=11, e3="ab5", f1=1, f2=11, f3="ab5", }, } <|start_filename|>Projects/Java_bin/src/main/gen/cfg/common/TbGlobalConfig.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.common; import bright.serialization.*; public final class TbGlobalConfig { private final cfg.common.GlobalConfig _data; public final cfg.common.GlobalConfig data() { return _data; } public TbGlobalConfig(ByteBuf _buf) { int n = _buf.readSize(); if (n != 1) throw new SerializationException("table mode=one, but size != 1"); _data = new cfg.common.GlobalConfig(_buf); } /** * 背包容量 */ public int getBagCapacity() { return _data.bagCapacity; } public int getBagCapacitySpecial() { return _data.bagCapacitySpecial; } public int getBagTempExpendableCapacity() { return _data.bagTempExpendableCapacity; } public int getBagTempToolCapacity() { return _data.bagTempToolCapacity; } public int getBagInitCapacity() { return _data.bagInitCapacity; } public int getQuickBagCapacity() { return _data.quickBagCapacity; } public int getClothBagCapacity() { return _data.clothBagCapacity; } public int getClothBagInitCapacity() { return _data.clothBagInitCapacity; } public int getClothBagCapacitySpecial() { return _data.clothBagCapacitySpecial; } public Integer getBagInitItemsDropId() { return _data.bagInitItemsDropId; } public int getMailBoxCapacity() { return _data.mailBoxCapacity; } public float getDamageParamC() { return _data.damageParamC; } public float getDamageParamE() { return _data.damageParamE; } public float getDamageParamF() { return _data.damageParamF; } public float getDamageParamD() { return _data.damageParamD; } public float getRoleSpeed() { return _data.roleSpeed; } public float getMonsterSpeed() { return _data.monsterSpeed; } public int getInitEnergy() { return _data.initEnergy; } public int getInitViality() { return _data.initViality; } public int getMaxViality() { return _data.maxViality; } public int getPerVialityRecoveryTime() { return _data.perVialityRecoveryTime; } public void resolve(java.util.HashMap<String, Object> _tables) { _data.resolve(_tables); } } <|start_filename|>Projects/DataTemplates/template_lua2/test_tbfulltypes.lua<|end_filename|> -- test.TbFullTypes return { [1] = { x4=1, x1=true, x2=5, x3=1, x5=13234234234, x6=1.28, x7=1.23457891, x8_0=1234, x8=1234, x9=111111111, x10="huang", x12= { x1=1988, }, x13=1, x14= { x1=1, x2=2, }, s1={key='test/a',text="xxx"}, v2={x=1,y=2}, v3={x=2,y=3,z=4}, v4={x=10.2,y=2.3,z=3.4,w=12.8}, t1=935460549, k1= { 1, 2, 3, }, k2= { 1, 2, 4, }, k5= { 1, 2, 7, }, k8= { [1] = 2, [3] = 4, }, k9= { { y1=1, y2=true, }, { y1=2, y2=false, }, }, k15= { { x1=1, x2=2, }, { x1=1, x3=2, x4=3, }, }, }, [2] = { x4=2, x1=false, x2=0, x3=2, x5=0, x6=0, x7=0, x8_0=0, x8=0, x9=0, x10="", x12= { x1=1988, }, x13=1, x14= { x1=1, x2=2, }, s1={key='name',text="asdfa2"}, v2={x=1,y=2}, v3={x=2,y=3,z=4}, v4={x=10.2,y=2.3,z=3.4,w=12.8}, t1=935460549, k1= { 1, 2, 3, }, k2= { 1, 2, 4, }, k5= { 1, 2, 7, }, k8= { [1] = 2, [3] = 4, }, k9= { { y1=1, y2=true, }, { y1=2, y2=false, }, }, k15= { { x1=1, x2=2, }, { x1=1, x3=2, x4=5, }, }, }, [3] = { x4=3, x1=false, x2=0, x3=3, x5=0, x6=0, x7=0, x8_0=0, x8=0, x9=0, x10="", x12= { x1=1988, }, x13=1, x14= { x1=1, x2=2, }, s1={key='name',text="asdfa2"}, v2={x=0,y=0}, v3={x=0,y=0,z=0}, v4={x=0,y=0,z=0,w=0}, t1=1577808000, k1= { 1, 2, 3, }, k2= { 1, 2, 4, }, k5= { 1, 2, 7, }, k8= { [1] = 2, [3] = 4, }, k9= { { y1=1, y2=true, }, { y1=2, y2=false, }, }, k15= { { x1=1, x2=2, }, { x1=1, x3=2, x4=6, }, }, }, [4] = { x4=4, x1=false, x2=5, x3=4, x5=0, x6=0, x7=0, x8_0=0, x8=0, x9=0, x10="", x12= { x1=1988, }, x13=1, x14= { x1=1, x2=2, }, s1={key='key1',text="asdfa4"}, v2={x=1,y=2}, v3={x=2,y=3,z=4}, v4={x=10.2,y=2.3,z=3.4,w=12.8}, t1=933732549, k1= { 1, 2, 3, }, k2= { 1, 2, 4, }, k5= { 1, 2, 7, }, k8= { [1] = 2, [3] = 4, }, k9= { { y1=1, y2=true, }, { y1=2, y2=false, }, }, k15= { { x1=1, x2=2, }, { x1=1, x3=2, x4=7, }, }, }, [5] = { x4=5, x1=false, x2=5, x3=6, x5=13234234234, x6=1.28, x7=1.23457891, x8_0=1234, x8=1234, x9=111111111, x10="huang", x12= { x1=1988, }, x13=1, x14= { x1=1, x2=2, }, s1={key='',text=""}, v2={x=1,y=2}, v3={x=2,y=3,z=4}, v4={x=10.2,y=2.3,z=3.4,w=12.8}, t1=1577808000, k1= { 1, 2, 3, }, k2= { 1, 2, 4, }, k5= { 1, 2, 7, }, k8= { [1] = 2, [3] = 4, }, k9= { { y1=1, y2=true, }, { y1=2, y2=false, }, }, k15= { { x1=1, x2=2, }, { x1=1, x3=2, x4=8, }, }, }, [6] = { x4=6, x1=true, x2=5, x3=7, x5=13234234234, x6=1.28, x7=1.23457891, x8_0=1234, x8=1234, x9=111111111, x10="huang", x12= { x1=1988, }, x13=1, x14= { x1=1, x2=2, }, s1={key='',text=""}, v2={x=1,y=2}, v3={x=2,y=3,z=4}, v4={x=10.2,y=2.3,z=3.4,w=12.8}, t1=935460549, k1= { 1, 2, 3, }, k2= { 1, 2, 4, }, k5= { 1, 2, 7, }, k8= { [1] = 2, [3] = 4, }, k9= { { y1=1, y2=true, }, { y1=2, y2=false, }, }, k15= { { x1=1, x2=2, }, { x1=1, x3=2, x4=9, }, }, }, [7] = { x4=7, x1=true, x2=5, x3=8, x5=1213123, x6=1.28, x7=1.23457891, x8_0=1234, x8=1234, x9=111111111, x10="huang", x12= { x1=1988, }, x13=1, x14= { x1=1, x2=2, }, s1={key='key2',text="<PASSWORD>"}, v2={x=1,y=2}, v3={x=2,y=3,z=4}, v4={x=10.2,y=2.3,z=3.4,w=12.8}, t1=1577808000, k1= { 1, 2, 3, }, k2= { 1, 2, 4, }, k5= { 1, 2, 7, }, k8= { [1] = 2, [3] = 4, }, k9= { { y1=1, y2=true, }, { y1=2, y2=false, }, }, k15= { { x1=1, x2=2, }, { x1=1, x3=2, x4=10, }, }, }, [8] = { x4=8, x1=true, x2=5, x3=9, x5=13234234234, x6=1.28, x7=1.23457891, x8_0=1234, x8=1234, x9=111111111, x10="huang", x12= { x1=1988, }, x13=2, x14= { x1=1, x2=2, }, s1={key='key3',text="asdfa8"}, v2={x=1,y=2}, v3={x=2,y=3,z=4}, v4={x=10.2,y=2.3,z=3.4,w=12.8}, t1=935460549, k1= { 1, 2, 3, }, k2= { 1, 2, 4, }, k5= { 1, 2, 7, }, k8= { [1] = 2, [3] = 4, }, k9= { { y1=1, y2=true, }, { y1=2, y2=false, }, }, k15= { { x1=1, x2=2, }, { x1=1, x3=2, x4=11, }, }, }, [9] = { x4=9, x1=true, x2=5, x3=128, x5=13234234234, x6=1.28, x7=1.23457891, x8_0=1234, x8=1234, x9=111111111, x10="huang", x12= { x1=1988, }, x13=1, x14= { x1=1, x2=2, }, s1={key='key3',text="asdfa8"}, v2={x=1,y=2}, v3={x=2,y=3,z=4}, v4={x=10.2,y=2.3,z=3.4,w=12.8}, t1=935460549, k1= { 1, 2, 3, }, k2= { 1, 2, 4, }, k5= { 1, 2, 7, }, k8= { [1] = 2, [3] = 4, }, k9= { { y1=1, y2=true, }, { y1=2, y2=false, }, }, k15= { { x1=1, x2=2, }, { x1=1, x3=2, x4=11, }, }, }, [10] = { x4=10, x1=true, x2=5, x3=128, x5=13234234234, x6=1.28, x7=1.23457891, x8_0=1234, x8=1234, x9=111111111, x10="huang", x12= { x1=1989, }, x13=1, x14= { x1=1, x2=3, }, s1={key='key4',text="asdfa9"}, v2={x=1,y=3}, v3={x=2,y=3,z=5}, v4={x=10.2,y=2.3,z=3.4,w=12.9}, t1=935460550, k1= { 1, 2, 4, }, k2= { 1, 2, 4, }, k5= { 1, 2, 7, }, k8= { [1] = 2, [3] = 5, }, k9= { { y1=1, y2=true, }, { y1=3, y2=false, }, }, k15= { { x1=1, x2=2, }, { x1=1, x3=2, x4=12, }, }, }, [12] = { x4=12, x1=true, x2=5, x3=128, x5=13234234234, x6=1.28, x7=1.23457891, x8_0=1234, x8=1234, x9=111111111, x10="huang", x12= { x1=1990, }, x13=2, x14= { x1=1, x2=4, }, s1={key='key5',text="asdfa10"}, v2={x=1,y=4}, v3={x=2,y=3,z=6}, v4={x=10.2,y=2.3,z=3.4,w=12.1}, t1=935460551, k1= { 1, 2, 5, }, k2= { 1, 2, 4, }, k5= { 1, 2, 7, }, k8= { [1] = 2, [3] = 6, }, k9= { { y1=1, y2=true, }, { y1=4, y2=false, }, }, k15= { { x1=1, x2=2, }, { x1=1, x3=2, x4=13, }, }, }, [30] = { x4=30, x1=true, x2=5, x3=128, x5=13234234234, x6=1.28, x7=1.23457891, x8_0=1234, x8=1234, x9=111111111, x10="huang", x12= { x1=1991, }, x13=4, x14= { x1=1, x2=5, }, s1={key='key6',text="<PASSWORD>a11"}, v2={x=1,y=5}, v3={x=2,y=3,z=7}, v4={x=10.2,y=2.3,z=3.4,w=12.11}, t1=935460552, k1= { 1, 2, 6, }, k2= { 1, 2, 4, }, k5= { 1, 2, 7, }, k8= { [1] = 2, [3] = 7, }, k9= { { y1=1, y2=true, }, { y1=5, y2=false, }, }, k15= { { x1=1, x2=2, }, { x1=1, x3=2, x4=14, }, }, }, } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_PhysicsScene2D_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_PhysicsScene2D_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.PhysicsScene2D constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ToString(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.PhysicsScene2D)Puerts.Utils.GetSelf((int)data, self); { { var result = obj.ToString(); Puerts.PuertsDLL.ReturnString(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetHashCode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.PhysicsScene2D)Puerts.Utils.GetSelf((int)data, self); { { var result = obj.GetHashCode(); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Equals(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.PhysicsScene2D)Puerts.Utils.GetSelf((int)data, self); if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.Any, typeof(System.Object), false, false)) { var Arg0 = argHelper0.Get<System.Object>(false); var result = obj.Equals(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.PhysicsScene2D), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.PhysicsScene2D>(false); var result = obj.Equals(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to Equals"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_IsValid(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.PhysicsScene2D)Puerts.Utils.GetSelf((int)data, self); { { var result = obj.IsValid(); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_IsEmpty(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.PhysicsScene2D)Puerts.Utils.GetSelf((int)data, self); { { var result = obj.IsEmpty(); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Simulate(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.PhysicsScene2D)Puerts.Utils.GetSelf((int)data, self); { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetFloat(false); var result = obj.Simulate(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Linecast(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.PhysicsScene2D)Puerts.Utils.GetSelf((int)data, self); if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.GetInt32(false); var result = obj.Linecast(Arg0,Arg1,Arg2); Puerts.ResultHelper.Set((int)data, isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.Get<UnityEngine.ContactFilter2D>(false); var result = obj.Linecast(Arg0,Arg1,Arg2); Puerts.ResultHelper.Set((int)data, isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit2D[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.Get<UnityEngine.RaycastHit2D[]>(false); var result = obj.Linecast(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var result = obj.Linecast(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit2D[]), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.Get<UnityEngine.RaycastHit2D[]>(false); var Arg3 = argHelper3.GetInt32(false); var result = obj.Linecast(Arg0,Arg1,Arg2,Arg3); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit2D[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.Get<UnityEngine.ContactFilter2D>(false); var Arg3 = argHelper3.Get<UnityEngine.RaycastHit2D[]>(false); var result = obj.Linecast(Arg0,Arg1,Arg2,Arg3); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.RaycastHit2D>), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.Get<UnityEngine.ContactFilter2D>(false); var Arg3 = argHelper3.Get<System.Collections.Generic.List<UnityEngine.RaycastHit2D>>(false); var result = obj.Linecast(Arg0,Arg1,Arg2,Arg3); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to Linecast"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Raycast(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.PhysicsScene2D)Puerts.Utils.GetSelf((int)data, self); if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.GetInt32(false); var result = obj.Raycast(Arg0,Arg1,Arg2,Arg3); Puerts.ResultHelper.Set((int)data, isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.Get<UnityEngine.ContactFilter2D>(false); var result = obj.Raycast(Arg0,Arg1,Arg2,Arg3); Puerts.ResultHelper.Set((int)data, isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit2D[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.Get<UnityEngine.RaycastHit2D[]>(false); var result = obj.Raycast(Arg0,Arg1,Arg2,Arg3); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.GetFloat(false); var result = obj.Raycast(Arg0,Arg1,Arg2); Puerts.ResultHelper.Set((int)data, isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } if (paramLen == 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit2D[]), false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.Get<UnityEngine.RaycastHit2D[]>(false); var Arg4 = argHelper4.GetInt32(false); var result = obj.Raycast(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit2D[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.Get<UnityEngine.ContactFilter2D>(false); var Arg4 = argHelper4.Get<UnityEngine.RaycastHit2D[]>(false); var result = obj.Raycast(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.RaycastHit2D>), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.Get<UnityEngine.ContactFilter2D>(false); var Arg4 = argHelper4.Get<System.Collections.Generic.List<UnityEngine.RaycastHit2D>>(false); var result = obj.Raycast(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to Raycast"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_CircleCast(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.PhysicsScene2D)Puerts.Utils.GetSelf((int)data, self); if (paramLen == 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.Get<UnityEngine.Vector2>(false); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.GetInt32(false); var result = obj.CircleCast(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.ResultHelper.Set((int)data, isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.Get<UnityEngine.Vector2>(false); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.Get<UnityEngine.ContactFilter2D>(false); var result = obj.CircleCast(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.ResultHelper.Set((int)data, isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit2D[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.Get<UnityEngine.Vector2>(false); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.Get<UnityEngine.RaycastHit2D[]>(false); var result = obj.CircleCast(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.Get<UnityEngine.Vector2>(false); var Arg3 = argHelper3.GetFloat(false); var result = obj.CircleCast(Arg0,Arg1,Arg2,Arg3); Puerts.ResultHelper.Set((int)data, isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } if (paramLen == 6) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit2D[]), false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.Get<UnityEngine.Vector2>(false); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.Get<UnityEngine.RaycastHit2D[]>(false); var Arg5 = argHelper5.GetInt32(false); var result = obj.CircleCast(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false) && argHelper5.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit2D[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.Get<UnityEngine.Vector2>(false); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.Get<UnityEngine.ContactFilter2D>(false); var Arg5 = argHelper5.Get<UnityEngine.RaycastHit2D[]>(false); var result = obj.CircleCast(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false) && argHelper5.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.RaycastHit2D>), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.Get<UnityEngine.Vector2>(false); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.Get<UnityEngine.ContactFilter2D>(false); var Arg5 = argHelper5.Get<System.Collections.Generic.List<UnityEngine.RaycastHit2D>>(false); var result = obj.CircleCast(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to CircleCast"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_BoxCast(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.PhysicsScene2D)Puerts.Utils.GetSelf((int)data, self); if (paramLen == 6) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.Get<UnityEngine.Vector2>(false); var Arg4 = argHelper4.GetFloat(false); var Arg5 = argHelper5.GetInt32(false); var result = obj.BoxCast(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); Puerts.ResultHelper.Set((int)data, isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.Get<UnityEngine.Vector2>(false); var Arg4 = argHelper4.GetFloat(false); var Arg5 = argHelper5.Get<UnityEngine.ContactFilter2D>(false); var result = obj.BoxCast(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); Puerts.ResultHelper.Set((int)data, isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit2D[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.Get<UnityEngine.Vector2>(false); var Arg4 = argHelper4.GetFloat(false); var Arg5 = argHelper5.Get<UnityEngine.RaycastHit2D[]>(false); var result = obj.BoxCast(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } if (paramLen == 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.Get<UnityEngine.Vector2>(false); var Arg4 = argHelper4.GetFloat(false); var result = obj.BoxCast(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.ResultHelper.Set((int)data, isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } if (paramLen == 7) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit2D[]), false, false) && argHelper6.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.Get<UnityEngine.Vector2>(false); var Arg4 = argHelper4.GetFloat(false); var Arg5 = argHelper5.Get<UnityEngine.RaycastHit2D[]>(false); var Arg6 = argHelper6.GetInt32(false); var result = obj.BoxCast(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false) && argHelper6.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit2D[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.Get<UnityEngine.Vector2>(false); var Arg4 = argHelper4.GetFloat(false); var Arg5 = argHelper5.Get<UnityEngine.ContactFilter2D>(false); var Arg6 = argHelper6.Get<UnityEngine.RaycastHit2D[]>(false); var result = obj.BoxCast(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false) && argHelper6.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.RaycastHit2D>), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.Get<UnityEngine.Vector2>(false); var Arg4 = argHelper4.GetFloat(false); var Arg5 = argHelper5.Get<UnityEngine.ContactFilter2D>(false); var Arg6 = argHelper6.Get<System.Collections.Generic.List<UnityEngine.RaycastHit2D>>(false); var result = obj.BoxCast(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to BoxCast"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_CapsuleCast(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.PhysicsScene2D)Puerts.Utils.GetSelf((int)data, self); if (paramLen == 7) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = (UnityEngine.CapsuleDirection2D)argHelper2.GetInt32(false); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.Get<UnityEngine.Vector2>(false); var Arg5 = argHelper5.GetFloat(false); var Arg6 = argHelper6.GetInt32(false); var result = obj.CapsuleCast(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6); Puerts.ResultHelper.Set((int)data, isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = (UnityEngine.CapsuleDirection2D)argHelper2.GetInt32(false); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.Get<UnityEngine.Vector2>(false); var Arg5 = argHelper5.GetFloat(false); var Arg6 = argHelper6.Get<UnityEngine.ContactFilter2D>(false); var result = obj.CapsuleCast(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6); Puerts.ResultHelper.Set((int)data, isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit2D[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = (UnityEngine.CapsuleDirection2D)argHelper2.GetInt32(false); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.Get<UnityEngine.Vector2>(false); var Arg5 = argHelper5.GetFloat(false); var Arg6 = argHelper6.Get<UnityEngine.RaycastHit2D[]>(false); var result = obj.CapsuleCast(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } if (paramLen == 6) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = (UnityEngine.CapsuleDirection2D)argHelper2.GetInt32(false); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.Get<UnityEngine.Vector2>(false); var Arg5 = argHelper5.GetFloat(false); var result = obj.CapsuleCast(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); Puerts.ResultHelper.Set((int)data, isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } if (paramLen == 8) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); var argHelper7 = new Puerts.ArgumentHelper((int)data, isolate, info, 7); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit2D[]), false, false) && argHelper7.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = (UnityEngine.CapsuleDirection2D)argHelper2.GetInt32(false); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.Get<UnityEngine.Vector2>(false); var Arg5 = argHelper5.GetFloat(false); var Arg6 = argHelper6.Get<UnityEngine.RaycastHit2D[]>(false); var Arg7 = argHelper7.GetInt32(false); var result = obj.CapsuleCast(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false) && argHelper7.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit2D[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = (UnityEngine.CapsuleDirection2D)argHelper2.GetInt32(false); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.Get<UnityEngine.Vector2>(false); var Arg5 = argHelper5.GetFloat(false); var Arg6 = argHelper6.Get<UnityEngine.ContactFilter2D>(false); var Arg7 = argHelper7.Get<UnityEngine.RaycastHit2D[]>(false); var result = obj.CapsuleCast(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false) && argHelper7.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.RaycastHit2D>), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = (UnityEngine.CapsuleDirection2D)argHelper2.GetInt32(false); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.Get<UnityEngine.Vector2>(false); var Arg5 = argHelper5.GetFloat(false); var Arg6 = argHelper6.Get<UnityEngine.ContactFilter2D>(false); var Arg7 = argHelper7.Get<System.Collections.Generic.List<UnityEngine.RaycastHit2D>>(false); var result = obj.CapsuleCast(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to CapsuleCast"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetRayIntersection(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.PhysicsScene2D)Puerts.Utils.GetSelf((int)data, self); if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Ray), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Ray>(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.GetInt32(false); var result = obj.GetRayIntersection(Arg0,Arg1,Arg2); Puerts.ResultHelper.Set((int)data, isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Ray), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit2D[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Ray>(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.Get<UnityEngine.RaycastHit2D[]>(false); var result = obj.GetRayIntersection(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Ray), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Ray>(false); var Arg1 = argHelper1.GetFloat(false); var result = obj.GetRayIntersection(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Ray), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit2D[]), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Ray>(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.Get<UnityEngine.RaycastHit2D[]>(false); var Arg3 = argHelper3.GetInt32(false); var result = obj.GetRayIntersection(Arg0,Arg1,Arg2,Arg3); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetRayIntersection"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_OverlapPoint(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.PhysicsScene2D)Puerts.Utils.GetSelf((int)data, self); if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.GetInt32(false); var result = obj.OverlapPoint(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.ContactFilter2D>(false); var result = obj.OverlapPoint(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Collider2D[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Collider2D[]>(false); var result = obj.OverlapPoint(Arg0,Arg1); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var result = obj.OverlapPoint(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Collider2D[]), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Collider2D[]>(false); var Arg2 = argHelper2.GetInt32(false); var result = obj.OverlapPoint(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Collider2D[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.ContactFilter2D>(false); var Arg2 = argHelper2.Get<UnityEngine.Collider2D[]>(false); var result = obj.OverlapPoint(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Collider2D>), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.ContactFilter2D>(false); var Arg2 = argHelper2.Get<System.Collections.Generic.List<UnityEngine.Collider2D>>(false); var result = obj.OverlapPoint(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to OverlapPoint"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_OverlapCircle(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.PhysicsScene2D)Puerts.Utils.GetSelf((int)data, self); if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.GetInt32(false); var result = obj.OverlapCircle(Arg0,Arg1,Arg2); Puerts.ResultHelper.Set((int)data, isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.Get<UnityEngine.ContactFilter2D>(false); var result = obj.OverlapCircle(Arg0,Arg1,Arg2); Puerts.ResultHelper.Set((int)data, isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Collider2D[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.Get<UnityEngine.Collider2D[]>(false); var result = obj.OverlapCircle(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.GetFloat(false); var result = obj.OverlapCircle(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Collider2D[]), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.Get<UnityEngine.Collider2D[]>(false); var Arg3 = argHelper3.GetInt32(false); var result = obj.OverlapCircle(Arg0,Arg1,Arg2,Arg3); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Collider2D[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.Get<UnityEngine.ContactFilter2D>(false); var Arg3 = argHelper3.Get<UnityEngine.Collider2D[]>(false); var result = obj.OverlapCircle(Arg0,Arg1,Arg2,Arg3); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Collider2D>), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.Get<UnityEngine.ContactFilter2D>(false); var Arg3 = argHelper3.Get<System.Collections.Generic.List<UnityEngine.Collider2D>>(false); var result = obj.OverlapCircle(Arg0,Arg1,Arg2,Arg3); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to OverlapCircle"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_OverlapBox(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.PhysicsScene2D)Puerts.Utils.GetSelf((int)data, self); if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.GetInt32(false); var result = obj.OverlapBox(Arg0,Arg1,Arg2,Arg3); Puerts.ResultHelper.Set((int)data, isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.Get<UnityEngine.ContactFilter2D>(false); var result = obj.OverlapBox(Arg0,Arg1,Arg2,Arg3); Puerts.ResultHelper.Set((int)data, isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Collider2D[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.Get<UnityEngine.Collider2D[]>(false); var result = obj.OverlapBox(Arg0,Arg1,Arg2,Arg3); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.GetFloat(false); var result = obj.OverlapBox(Arg0,Arg1,Arg2); Puerts.ResultHelper.Set((int)data, isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } if (paramLen == 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Collider2D[]), false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.Get<UnityEngine.Collider2D[]>(false); var Arg4 = argHelper4.GetInt32(false); var result = obj.OverlapBox(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Collider2D[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.Get<UnityEngine.ContactFilter2D>(false); var Arg4 = argHelper4.Get<UnityEngine.Collider2D[]>(false); var result = obj.OverlapBox(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Collider2D>), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.Get<UnityEngine.ContactFilter2D>(false); var Arg4 = argHelper4.Get<System.Collections.Generic.List<UnityEngine.Collider2D>>(false); var result = obj.OverlapBox(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to OverlapBox"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_OverlapArea(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.PhysicsScene2D)Puerts.Utils.GetSelf((int)data, self); if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.GetInt32(false); var result = obj.OverlapArea(Arg0,Arg1,Arg2); Puerts.ResultHelper.Set((int)data, isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.Get<UnityEngine.ContactFilter2D>(false); var result = obj.OverlapArea(Arg0,Arg1,Arg2); Puerts.ResultHelper.Set((int)data, isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Collider2D[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.Get<UnityEngine.Collider2D[]>(false); var result = obj.OverlapArea(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var result = obj.OverlapArea(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Collider2D[]), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.Get<UnityEngine.Collider2D[]>(false); var Arg3 = argHelper3.GetInt32(false); var result = obj.OverlapArea(Arg0,Arg1,Arg2,Arg3); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Collider2D[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.Get<UnityEngine.ContactFilter2D>(false); var Arg3 = argHelper3.Get<UnityEngine.Collider2D[]>(false); var result = obj.OverlapArea(Arg0,Arg1,Arg2,Arg3); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Collider2D>), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.Get<UnityEngine.ContactFilter2D>(false); var Arg3 = argHelper3.Get<System.Collections.Generic.List<UnityEngine.Collider2D>>(false); var result = obj.OverlapArea(Arg0,Arg1,Arg2,Arg3); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to OverlapArea"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_OverlapCapsule(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.PhysicsScene2D)Puerts.Utils.GetSelf((int)data, self); if (paramLen == 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = (UnityEngine.CapsuleDirection2D)argHelper2.GetInt32(false); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.GetInt32(false); var result = obj.OverlapCapsule(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.ResultHelper.Set((int)data, isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = (UnityEngine.CapsuleDirection2D)argHelper2.GetInt32(false); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.Get<UnityEngine.ContactFilter2D>(false); var result = obj.OverlapCapsule(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.ResultHelper.Set((int)data, isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Collider2D[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = (UnityEngine.CapsuleDirection2D)argHelper2.GetInt32(false); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.Get<UnityEngine.Collider2D[]>(false); var result = obj.OverlapCapsule(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = (UnityEngine.CapsuleDirection2D)argHelper2.GetInt32(false); var Arg3 = argHelper3.GetFloat(false); var result = obj.OverlapCapsule(Arg0,Arg1,Arg2,Arg3); Puerts.ResultHelper.Set((int)data, isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } if (paramLen == 6) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Collider2D[]), false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = (UnityEngine.CapsuleDirection2D)argHelper2.GetInt32(false); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.Get<UnityEngine.Collider2D[]>(false); var Arg5 = argHelper5.GetInt32(false); var result = obj.OverlapCapsule(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false) && argHelper5.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Collider2D[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = (UnityEngine.CapsuleDirection2D)argHelper2.GetInt32(false); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.Get<UnityEngine.ContactFilter2D>(false); var Arg5 = argHelper5.Get<UnityEngine.Collider2D[]>(false); var result = obj.OverlapCapsule(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false) && argHelper5.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Collider2D>), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = (UnityEngine.CapsuleDirection2D)argHelper2.GetInt32(false); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.Get<UnityEngine.ContactFilter2D>(false); var Arg5 = argHelper5.Get<System.Collections.Generic.List<UnityEngine.Collider2D>>(false); var result = obj.OverlapCapsule(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to OverlapCapsule"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_OverlapCollider(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Collider2D), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Collider2D[]), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Collider2D>(false); var Arg1 = argHelper1.Get<UnityEngine.Collider2D[]>(false); var Arg2 = argHelper2.GetInt32(false); var result = UnityEngine.PhysicsScene2D.OverlapCollider(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Collider2D), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Collider2D[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Collider2D>(false); var Arg1 = argHelper1.Get<UnityEngine.ContactFilter2D>(false); var Arg2 = argHelper2.Get<UnityEngine.Collider2D[]>(false); var result = UnityEngine.PhysicsScene2D.OverlapCollider(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Collider2D), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Collider2D>), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Collider2D>(false); var Arg1 = argHelper1.Get<UnityEngine.ContactFilter2D>(false); var Arg2 = argHelper2.Get<System.Collections.Generic.List<UnityEngine.Collider2D>>(false); var result = UnityEngine.PhysicsScene2D.OverlapCollider(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Collider2D), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Collider2D[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Collider2D>(false); var Arg1 = argHelper1.Get<UnityEngine.Collider2D[]>(false); var result = UnityEngine.PhysicsScene2D.OverlapCollider(Arg0,Arg1); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to OverlapCollider"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void O_op_Equality(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var arg0 = argHelper0.Get<UnityEngine.PhysicsScene2D>(false); var arg1 = argHelper1.Get<UnityEngine.PhysicsScene2D>(false); var result = arg0 == arg1; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void O_op_Inequality(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var arg0 = argHelper0.Get<UnityEngine.PhysicsScene2D>(false); var arg1 = argHelper1.Get<UnityEngine.PhysicsScene2D>(false); var result = arg0 != arg1; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "ToString", IsStatic = false}, M_ToString }, { new Puerts.MethodKey {Name = "GetHashCode", IsStatic = false}, M_GetHashCode }, { new Puerts.MethodKey {Name = "Equals", IsStatic = false}, M_Equals }, { new Puerts.MethodKey {Name = "IsValid", IsStatic = false}, M_IsValid }, { new Puerts.MethodKey {Name = "IsEmpty", IsStatic = false}, M_IsEmpty }, { new Puerts.MethodKey {Name = "Simulate", IsStatic = false}, M_Simulate }, { new Puerts.MethodKey {Name = "Linecast", IsStatic = false}, M_Linecast }, { new Puerts.MethodKey {Name = "Raycast", IsStatic = false}, M_Raycast }, { new Puerts.MethodKey {Name = "CircleCast", IsStatic = false}, M_CircleCast }, { new Puerts.MethodKey {Name = "BoxCast", IsStatic = false}, M_BoxCast }, { new Puerts.MethodKey {Name = "CapsuleCast", IsStatic = false}, M_CapsuleCast }, { new Puerts.MethodKey {Name = "GetRayIntersection", IsStatic = false}, M_GetRayIntersection }, { new Puerts.MethodKey {Name = "OverlapPoint", IsStatic = false}, M_OverlapPoint }, { new Puerts.MethodKey {Name = "OverlapCircle", IsStatic = false}, M_OverlapCircle }, { new Puerts.MethodKey {Name = "OverlapBox", IsStatic = false}, M_OverlapBox }, { new Puerts.MethodKey {Name = "OverlapArea", IsStatic = false}, M_OverlapArea }, { new Puerts.MethodKey {Name = "OverlapCapsule", IsStatic = false}, M_OverlapCapsule }, { new Puerts.MethodKey {Name = "OverlapCollider", IsStatic = true}, F_OverlapCollider }, { new Puerts.MethodKey {Name = "op_Equality", IsStatic = true}, O_op_Equality}, { new Puerts.MethodKey {Name = "op_Inequality", IsStatic = true}, O_op_Inequality}, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { } }; } } } <|start_filename|>Projects/DataTemplates/template_erlang2/ai_tbbehaviortree.erl<|end_filename|> %% ai.TbBehaviorTree -module(ai_tbbehaviortree) -export([get/1,get_ids/0]) get(10002) -> #{ id => 10002, name => "random move", desc => "demo behaviour tree haha", blackboard_id => "demo", root => bean }. get_ids() -> [10002]. <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_CrashReport_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_CrashReport_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.CrashReport constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_RemoveAll(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { { UnityEngine.CrashReport.RemoveAll(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Remove(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CrashReport; { { obj.Remove(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_reports(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.CrashReport.reports; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_lastReport(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.CrashReport.lastReport; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_time(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CrashReport; var result = obj.time; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_text(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CrashReport; var result = obj.text; Puerts.PuertsDLL.ReturnString(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "RemoveAll", IsStatic = true}, F_RemoveAll }, { new Puerts.MethodKey {Name = "Remove", IsStatic = false}, M_Remove }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"reports", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_reports, Setter = null} }, {"lastReport", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_lastReport, Setter = null} }, {"time", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_time, Setter = null} }, {"text", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_text, Setter = null} }, } }; } } } <|start_filename|>Projects/DataTemplates/template_erlang/test_tbexcelfromjsonmultirow.erl<|end_filename|> %% test.TbExcelFromJsonMultiRow get(1) -> #{id => 1,x => 5,items => [#{x => 1,y => true,z => "abcd",a => #{x => 10,y => 100},b => [1,3,5]},#{x => 2,y => false,z => "abcd",a => #{x => 22,y => 33},b => [4,5]}]}. get(2) -> #{id => 2,x => 9,items => [#{x => 2,y => true,z => "abcd",a => #{x => 10,y => 11},b => [1,3,5]},#{x => 4,y => false,z => "abcd",a => #{x => 22,y => 33},b => [4,5]},#{x => 5,y => false,z => "abcd",a => #{x => 22,y => 33},b => [4,5]}]}. <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_ParticleSystem_SizeBySpeedModule_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_ParticleSystem_SizeBySpeedModule_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.ParticleSystem.SizeBySpeedModule constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_enabled(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.SizeBySpeedModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.enabled; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_enabled(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.SizeBySpeedModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.enabled = argHelper.GetBoolean(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_size(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.SizeBySpeedModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.size; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_size(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.SizeBySpeedModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.size = argHelper.Get<UnityEngine.ParticleSystem.MinMaxCurve>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_sizeMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.SizeBySpeedModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.sizeMultiplier; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_sizeMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.SizeBySpeedModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.sizeMultiplier = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_x(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.SizeBySpeedModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.x; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_x(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.SizeBySpeedModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.x = argHelper.Get<UnityEngine.ParticleSystem.MinMaxCurve>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_xMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.SizeBySpeedModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.xMultiplier; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_xMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.SizeBySpeedModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.xMultiplier = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_y(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.SizeBySpeedModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.y; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_y(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.SizeBySpeedModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.y = argHelper.Get<UnityEngine.ParticleSystem.MinMaxCurve>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_yMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.SizeBySpeedModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.yMultiplier; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_yMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.SizeBySpeedModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.yMultiplier = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_z(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.SizeBySpeedModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.z; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_z(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.SizeBySpeedModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.z = argHelper.Get<UnityEngine.ParticleSystem.MinMaxCurve>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_zMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.SizeBySpeedModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.zMultiplier; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_zMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.SizeBySpeedModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.zMultiplier = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_separateAxes(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.SizeBySpeedModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.separateAxes; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_separateAxes(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.SizeBySpeedModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.separateAxes = argHelper.GetBoolean(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_range(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.SizeBySpeedModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.range; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_range(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.SizeBySpeedModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.range = argHelper.Get<UnityEngine.Vector2>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"enabled", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_enabled, Setter = S_enabled} }, {"size", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_size, Setter = S_size} }, {"sizeMultiplier", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_sizeMultiplier, Setter = S_sizeMultiplier} }, {"x", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_x, Setter = S_x} }, {"xMultiplier", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_xMultiplier, Setter = S_xMultiplier} }, {"y", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_y, Setter = S_y} }, {"yMultiplier", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_yMultiplier, Setter = S_yMultiplier} }, {"z", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_z, Setter = S_z} }, {"zMultiplier", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_zMultiplier, Setter = S_zMultiplier} }, {"separateAxes", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_separateAxes, Setter = S_separateAxes} }, {"range", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_range, Setter = S_range} }, } }; } } } <|start_filename|>Projects/GenerateDatas/convert_lua/role.TbRoleLevelExpAttr/87.lua<|end_filename|> return { level = 87, need_exp = 260000, clothes_attrs = { 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, }, } <|start_filename|>ProtoProjects/go/gen/src/proto/test.Child21.go<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package proto import ( "bright/serialization" ) import "errors" type TestChild21 struct { A1 int32 A24 int32 } const TypeId_TestChild21 = 0 func (*TestChild21) GetTypeId() int32 { return 0 } func (_v *TestChild21)Serialize(_buf *serialization.ByteBuf) { _buf.WriteInt(_v.A1) _buf.WriteInt(_v.A24) } func (_v *TestChild21)Deserialize(_buf *serialization.ByteBuf) (err error) { { if _v.A1, err = _buf.ReadInt(); err != nil { err = errors.New("_v.A1 error"); return } } { if _v.A24, err = _buf.ReadInt(); err != nil { err = errors.New("_v.A24 error"); return } } return } func SerializeTestChild21(_v interface{}, _buf *serialization.ByteBuf) { _b := _v.(serialization.ISerializable) _buf.WriteInt(_b.GetTypeId()) _b.Serialize(_buf) } func DeserializeTestChild21(_buf *serialization.ByteBuf) (_v serialization.ISerializable, err error) { var id int32 if id, err = _buf.ReadInt() ; err != nil { return } switch id { case 10: _v = &TestChild31{}; if err = _v.Deserialize(_buf); err != nil { return nil, err } else { return } case 11: _v = &TestChild32{}; if err = _v.Deserialize(_buf); err != nil { return nil, err } else { return } default: return nil, errors.New("unknown type id") } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_BuoyancyEffector2D_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_BuoyancyEffector2D_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.BuoyancyEffector2D(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.BuoyancyEffector2D), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_surfaceLevel(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.BuoyancyEffector2D; var result = obj.surfaceLevel; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_surfaceLevel(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.BuoyancyEffector2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.surfaceLevel = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_density(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.BuoyancyEffector2D; var result = obj.density; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_density(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.BuoyancyEffector2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.density = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_linearDrag(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.BuoyancyEffector2D; var result = obj.linearDrag; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_linearDrag(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.BuoyancyEffector2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.linearDrag = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_angularDrag(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.BuoyancyEffector2D; var result = obj.angularDrag; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_angularDrag(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.BuoyancyEffector2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.angularDrag = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_flowAngle(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.BuoyancyEffector2D; var result = obj.flowAngle; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_flowAngle(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.BuoyancyEffector2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.flowAngle = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_flowMagnitude(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.BuoyancyEffector2D; var result = obj.flowMagnitude; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_flowMagnitude(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.BuoyancyEffector2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.flowMagnitude = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_flowVariation(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.BuoyancyEffector2D; var result = obj.flowVariation; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_flowVariation(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.BuoyancyEffector2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.flowVariation = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"surfaceLevel", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_surfaceLevel, Setter = S_surfaceLevel} }, {"density", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_density, Setter = S_density} }, {"linearDrag", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_linearDrag, Setter = S_linearDrag} }, {"angularDrag", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_angularDrag, Setter = S_angularDrag} }, {"flowAngle", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_flowAngle, Setter = S_flowAngle} }, {"flowMagnitude", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_flowMagnitude, Setter = S_flowMagnitude} }, {"flowVariation", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_flowVariation, Setter = S_flowVariation} }, } }; } } } <|start_filename|>Projects/Java_bin/src/main/gen/cfg/test/TbCompositeJsonTable3.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.test; import bright.serialization.*; public final class TbCompositeJsonTable3 { private final cfg.test.CompositeJsonTable3 _data; public final cfg.test.CompositeJsonTable3 data() { return _data; } public TbCompositeJsonTable3(ByteBuf _buf) { int n = _buf.readSize(); if (n != 1) throw new SerializationException("table mode=one, but size != 1"); _data = new cfg.test.CompositeJsonTable3(_buf); } public int getA() { return _data.a; } public int getB() { return _data.b; } public void resolve(java.util.HashMap<String, Object> _tables) { _data.resolve(_tables); } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_SparseTexture_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_SparseTexture_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = (UnityEngine.Experimental.Rendering.DefaultFormat)argHelper2.GetInt32(false); var Arg3 = argHelper3.GetInt32(false); var result = new UnityEngine.SparseTexture(Arg0,Arg1,Arg2,Arg3); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.SparseTexture), result); } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = (UnityEngine.Experimental.Rendering.GraphicsFormat)argHelper2.GetInt32(false); var Arg3 = argHelper3.GetInt32(false); var result = new UnityEngine.SparseTexture(Arg0,Arg1,Arg2,Arg3); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.SparseTexture), result); } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = (UnityEngine.TextureFormat)argHelper2.GetInt32(false); var Arg3 = argHelper3.GetInt32(false); var result = new UnityEngine.SparseTexture(Arg0,Arg1,Arg2,Arg3); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.SparseTexture), result); } } if (paramLen == 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = (UnityEngine.TextureFormat)argHelper2.GetInt32(false); var Arg3 = argHelper3.GetInt32(false); var Arg4 = argHelper4.GetBoolean(false); var result = new UnityEngine.SparseTexture(Arg0,Arg1,Arg2,Arg3,Arg4); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.SparseTexture), result); } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.SparseTexture constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_UpdateTile(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SparseTexture; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.Get<UnityEngine.Color32[]>(false); obj.UpdateTile(Arg0,Arg1,Arg2,Arg3); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_UpdateTileRaw(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SparseTexture; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.Get<byte[]>(false); obj.UpdateTileRaw(Arg0,Arg1,Arg2,Arg3); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_UnloadTile(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SparseTexture; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); obj.UnloadTile(Arg0,Arg1,Arg2); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_tileWidth(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SparseTexture; var result = obj.tileWidth; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_tileHeight(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SparseTexture; var result = obj.tileHeight; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_isCreated(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SparseTexture; var result = obj.isCreated; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "UpdateTile", IsStatic = false}, M_UpdateTile }, { new Puerts.MethodKey {Name = "UpdateTileRaw", IsStatic = false}, M_UpdateTileRaw }, { new Puerts.MethodKey {Name = "UnloadTile", IsStatic = false}, M_UnloadTile }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"tileWidth", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_tileWidth, Setter = null} }, {"tileHeight", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_tileHeight, Setter = null} }, {"isCreated", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_isCreated, Setter = null} }, } }; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_AudioRenderer_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_AudioRenderer_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.AudioRenderer(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.AudioRenderer), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_Start(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { { var result = UnityEngine.AudioRenderer.Start(); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_Stop(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { { var result = UnityEngine.AudioRenderer.Stop(); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetSampleCountForCaptureFrame(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { { var result = UnityEngine.AudioRenderer.GetSampleCountForCaptureFrame(); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_Render(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<Unity.Collections.NativeArray<float>>(false); var result = UnityEngine.AudioRenderer.Render(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "Start", IsStatic = true}, F_Start }, { new Puerts.MethodKey {Name = "Stop", IsStatic = true}, F_Stop }, { new Puerts.MethodKey {Name = "GetSampleCountForCaptureFrame", IsStatic = true}, F_GetSampleCountForCaptureFrame }, { new Puerts.MethodKey {Name = "Render", IsStatic = true}, F_Render }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { } }; } } } <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/condition/ContainsItem.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.condition { public sealed partial class ContainsItem : condition.RoleCondition { public ContainsItem(ByteBuf _buf) : base(_buf) { ItemId = _buf.ReadInt(); Num = _buf.ReadInt(); Reverse = _buf.ReadBool(); } public ContainsItem(int item_id, int num, bool reverse ) : base() { this.ItemId = item_id; this.Num = num; this.Reverse = reverse; } public static ContainsItem DeserializeContainsItem(ByteBuf _buf) { return new condition.ContainsItem(_buf); } public readonly int ItemId; public item.Item ItemId_Ref; public readonly int Num; public readonly bool Reverse; public const int ID = 1961145317; public override int GetTypeId() => ID; public override void Resolve(Dictionary<string, object> _tables) { base.Resolve(_tables); this.ItemId_Ref = (_tables["item.TbItem"] as item.TbItem).GetOrDefault(ItemId); OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); public override string ToString() { return "{ " + "ItemId:" + ItemId + "," + "Num:" + Num + "," + "Reverse:" + Reverse + "," + "}"; } } } <|start_filename|>Projects/GenerateDatas/convert_lua/tag.TbTestTag/2.lua<|end_filename|> return { id = 2, value = "导出", } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_StateMachineBehaviour_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_StateMachineBehaviour_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.StateMachineBehaviour constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_OnStateEnter(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.StateMachineBehaviour; if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Animator), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.AnimatorStateInfo), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Animator>(false); var Arg1 = argHelper1.Get<UnityEngine.AnimatorStateInfo>(false); var Arg2 = argHelper2.GetInt32(false); obj.OnStateEnter(Arg0,Arg1,Arg2); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Animator), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.AnimatorStateInfo), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Animations.AnimatorControllerPlayable), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Animator>(false); var Arg1 = argHelper1.Get<UnityEngine.AnimatorStateInfo>(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.Get<UnityEngine.Animations.AnimatorControllerPlayable>(false); obj.OnStateEnter(Arg0,Arg1,Arg2,Arg3); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to OnStateEnter"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_OnStateUpdate(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.StateMachineBehaviour; if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Animator), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.AnimatorStateInfo), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Animator>(false); var Arg1 = argHelper1.Get<UnityEngine.AnimatorStateInfo>(false); var Arg2 = argHelper2.GetInt32(false); obj.OnStateUpdate(Arg0,Arg1,Arg2); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Animator), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.AnimatorStateInfo), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Animations.AnimatorControllerPlayable), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Animator>(false); var Arg1 = argHelper1.Get<UnityEngine.AnimatorStateInfo>(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.Get<UnityEngine.Animations.AnimatorControllerPlayable>(false); obj.OnStateUpdate(Arg0,Arg1,Arg2,Arg3); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to OnStateUpdate"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_OnStateExit(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.StateMachineBehaviour; if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Animator), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.AnimatorStateInfo), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Animator>(false); var Arg1 = argHelper1.Get<UnityEngine.AnimatorStateInfo>(false); var Arg2 = argHelper2.GetInt32(false); obj.OnStateExit(Arg0,Arg1,Arg2); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Animator), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.AnimatorStateInfo), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Animations.AnimatorControllerPlayable), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Animator>(false); var Arg1 = argHelper1.Get<UnityEngine.AnimatorStateInfo>(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.Get<UnityEngine.Animations.AnimatorControllerPlayable>(false); obj.OnStateExit(Arg0,Arg1,Arg2,Arg3); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to OnStateExit"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_OnStateMove(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.StateMachineBehaviour; if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Animator), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.AnimatorStateInfo), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Animator>(false); var Arg1 = argHelper1.Get<UnityEngine.AnimatorStateInfo>(false); var Arg2 = argHelper2.GetInt32(false); obj.OnStateMove(Arg0,Arg1,Arg2); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Animator), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.AnimatorStateInfo), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Animations.AnimatorControllerPlayable), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Animator>(false); var Arg1 = argHelper1.Get<UnityEngine.AnimatorStateInfo>(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.Get<UnityEngine.Animations.AnimatorControllerPlayable>(false); obj.OnStateMove(Arg0,Arg1,Arg2,Arg3); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to OnStateMove"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_OnStateIK(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.StateMachineBehaviour; if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Animator), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.AnimatorStateInfo), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Animator>(false); var Arg1 = argHelper1.Get<UnityEngine.AnimatorStateInfo>(false); var Arg2 = argHelper2.GetInt32(false); obj.OnStateIK(Arg0,Arg1,Arg2); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Animator), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.AnimatorStateInfo), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Animations.AnimatorControllerPlayable), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Animator>(false); var Arg1 = argHelper1.Get<UnityEngine.AnimatorStateInfo>(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.Get<UnityEngine.Animations.AnimatorControllerPlayable>(false); obj.OnStateIK(Arg0,Arg1,Arg2,Arg3); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to OnStateIK"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_OnStateMachineEnter(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.StateMachineBehaviour; if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Animator), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Animator>(false); var Arg1 = argHelper1.GetInt32(false); obj.OnStateMachineEnter(Arg0,Arg1); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Animator), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Animations.AnimatorControllerPlayable), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Animator>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.Get<UnityEngine.Animations.AnimatorControllerPlayable>(false); obj.OnStateMachineEnter(Arg0,Arg1,Arg2); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to OnStateMachineEnter"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_OnStateMachineExit(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.StateMachineBehaviour; if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Animator), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Animator>(false); var Arg1 = argHelper1.GetInt32(false); obj.OnStateMachineExit(Arg0,Arg1); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Animator), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Animations.AnimatorControllerPlayable), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Animator>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.Get<UnityEngine.Animations.AnimatorControllerPlayable>(false); obj.OnStateMachineExit(Arg0,Arg1,Arg2); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to OnStateMachineExit"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "OnStateEnter", IsStatic = false}, M_OnStateEnter }, { new Puerts.MethodKey {Name = "OnStateUpdate", IsStatic = false}, M_OnStateUpdate }, { new Puerts.MethodKey {Name = "OnStateExit", IsStatic = false}, M_OnStateExit }, { new Puerts.MethodKey {Name = "OnStateMove", IsStatic = false}, M_OnStateMove }, { new Puerts.MethodKey {Name = "OnStateIK", IsStatic = false}, M_OnStateIK }, { new Puerts.MethodKey {Name = "OnStateMachineEnter", IsStatic = false}, M_OnStateMachineEnter }, { new Puerts.MethodKey {Name = "OnStateMachineExit", IsStatic = false}, M_OnStateMachineExit }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { } }; } } } <|start_filename|>Projects/java_json/src/gen/cfg/ai/UeCooldown.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.ai; import com.google.gson.JsonElement; import com.google.gson.JsonObject; public final class UeCooldown extends cfg.ai.Decorator { public UeCooldown(JsonObject __json__) { super(__json__); cooldownTime = __json__.get("cooldown_time").getAsFloat(); } public UeCooldown(int id, String node_name, cfg.ai.EFlowAbortMode flow_abort_mode, float cooldown_time ) { super(id, node_name, flow_abort_mode); this.cooldownTime = cooldown_time; } public static UeCooldown deserializeUeCooldown(JsonObject __json__) { return new UeCooldown(__json__); } public final float cooldownTime; public static final int __ID__ = -951439423; @Override public int getTypeId() { return __ID__; } @Override public void resolve(java.util.HashMap<String, Object> _tables) { super.resolve(_tables); } @Override public String toString() { return "{ " + "id:" + id + "," + "nodeName:" + nodeName + "," + "flowAbortMode:" + flowAbortMode + "," + "cooldownTime:" + cooldownTime + "," + "}"; } } <|start_filename|>ProtoProjects/go/gen_code_bin.bat<|end_filename|> set WORKSPACE=..\.. set GEN_CLIENT=%WORKSPACE%\Tools\Luban.Client\Luban.Client.exe set PROTO_ROOT=%WORKSPACE%\ProtoDefines %GEN_CLIENT% -h %LUBAN_SERVER_IP% -j proto --^ -d %PROTO_ROOT%\__root__.xml ^ --output_code_dir gen/src/proto ^ --gen_type go ^ -s all pause <|start_filename|>Projects/Go_json/gen/src/cfg/test.H1.go<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg import "errors" type TestH1 struct { Y2 *TestH2 Y3 int32 } const TypeId_TestH1 = -1422503995 func (*TestH1) GetTypeId() int32 { return -1422503995 } func (_v *TestH1)Deserialize(_buf map[string]interface{}) (err error) { { var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _buf["y2"].(map[string]interface{}); !_ok_ { err = errors.New("y2 error"); return }; if _v.Y2, err = DeserializeTestH2(_x_); err != nil { return } } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["y3"].(float64); !_ok_ { err = errors.New("y3 error"); return }; _v.Y3 = int32(_tempNum_) } return } func DeserializeTestH1(_buf map[string]interface{}) (*TestH1, error) { v := &TestH1{} if err := v.Deserialize(_buf); err == nil { return v, nil } else { return nil, err } } <|start_filename|>Projects/Csharp_DotNet5_json_ExportServer/Gen/item/TreasureBox.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; using System.Text.Json; namespace cfg.item { public sealed class TreasureBox : item.ItemExtra { public TreasureBox(JsonElement _json) : base(_json) { { if (_json.TryGetProperty("key_item_id", out var _j) && _j.ValueKind != JsonValueKind.Null) { KeyItemId = _j.GetInt32(); } else { KeyItemId = null; } } OpenLevel = condition.MinLevel.DeserializeMinLevel(_json.GetProperty("open_level")); UseOnObtain = _json.GetProperty("use_on_obtain").GetBoolean(); { var _json0 = _json.GetProperty("drop_ids"); DropIds = new System.Collections.Generic.List<int>(_json0.GetArrayLength()); foreach(JsonElement __e in _json0.EnumerateArray()) { int __v; __v = __e.GetInt32(); DropIds.Add(__v); } } { var _json0 = _json.GetProperty("choose_list"); ChooseList = new System.Collections.Generic.List<item.ChooseOneBonus>(_json0.GetArrayLength()); foreach(JsonElement __e in _json0.EnumerateArray()) { item.ChooseOneBonus __v; __v = item.ChooseOneBonus.DeserializeChooseOneBonus(__e); ChooseList.Add(__v); } } } public TreasureBox(int id, int? key_item_id, condition.MinLevel open_level, bool use_on_obtain, System.Collections.Generic.List<int> drop_ids, System.Collections.Generic.List<item.ChooseOneBonus> choose_list ) : base(id) { this.KeyItemId = key_item_id; this.OpenLevel = open_level; this.UseOnObtain = use_on_obtain; this.DropIds = drop_ids; this.ChooseList = choose_list; } public static TreasureBox DeserializeTreasureBox(JsonElement _json) { return new item.TreasureBox(_json); } public int? KeyItemId { get; private set; } public condition.MinLevel OpenLevel { get; private set; } public bool UseOnObtain { get; private set; } public System.Collections.Generic.List<int> DropIds { get; private set; } public System.Collections.Generic.List<item.ChooseOneBonus> ChooseList { get; private set; } public const int __ID__ = 1494222369; public override int GetTypeId() => __ID__; public override void Resolve(Dictionary<string, object> _tables) { base.Resolve(_tables); OpenLevel?.Resolve(_tables); foreach(var _e in ChooseList) { _e?.Resolve(_tables); } } public override void TranslateText(System.Func<string, string, string> translator) { base.TranslateText(translator); OpenLevel?.TranslateText(translator); foreach(var _e in ChooseList) { _e?.TranslateText(translator); } } public override string ToString() { return "{ " + "Id:" + Id + "," + "KeyItemId:" + KeyItemId + "," + "OpenLevel:" + OpenLevel + "," + "UseOnObtain:" + UseOnObtain + "," + "DropIds:" + Bright.Common.StringUtil.CollectionToString(DropIds) + "," + "ChooseList:" + Bright.Common.StringUtil.CollectionToString(ChooseList) + "," + "}"; } } } <|start_filename|>Projects/java_json/src/gen/cfg/bonus/WeightItems.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.bonus; import com.google.gson.JsonElement; import com.google.gson.JsonObject; public final class WeightItems extends cfg.bonus.Bonus { public WeightItems(JsonObject __json__) { super(__json__); { com.google.gson.JsonArray _json0_ = __json__.get("item_list").getAsJsonArray(); int _n = _json0_.size(); itemList = new cfg.bonus.WeightItemInfo[_n]; int _index=0; for(JsonElement __e : _json0_) { cfg.bonus.WeightItemInfo __v; __v = new cfg.bonus.WeightItemInfo(__e.getAsJsonObject()); itemList[_index++] = __v; } } } public WeightItems(cfg.bonus.WeightItemInfo[] item_list ) { super(); this.itemList = item_list; } public static WeightItems deserializeWeightItems(JsonObject __json__) { return new WeightItems(__json__); } public final cfg.bonus.WeightItemInfo[] itemList; public static final int __ID__ = -356202311; @Override public int getTypeId() { return __ID__; } @Override public void resolve(java.util.HashMap<String, Object> _tables) { super.resolve(_tables); for(cfg.bonus.WeightItemInfo _e : itemList) { if (_e != null) _e.resolve(_tables); } } @Override public String toString() { return "{ " + "itemList:" + itemList + "," + "}"; } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_WWWForm_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_WWWForm_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.WWWForm(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.WWWForm), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_AddField(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.WWWForm; if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.GetString(false); obj.AddField(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.GetInt32(false); obj.AddField(Arg0,Arg1); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Text.Encoding), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.GetString(false); var Arg2 = argHelper2.Get<System.Text.Encoding>(false); obj.AddField(Arg0,Arg1,Arg2); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to AddField"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_AddBinaryData(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.WWWForm; if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(byte[]), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<byte[]>(false); obj.AddBinaryData(Arg0,Arg1); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(byte[]), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<byte[]>(false); var Arg2 = argHelper2.GetString(false); obj.AddBinaryData(Arg0,Arg1,Arg2); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(byte[]), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<byte[]>(false); var Arg2 = argHelper2.GetString(false); var Arg3 = argHelper3.GetString(false); obj.AddBinaryData(Arg0,Arg1,Arg2,Arg3); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to AddBinaryData"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_headers(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.WWWForm; var result = obj.headers; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_data(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.WWWForm; var result = obj.data; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "AddField", IsStatic = false}, M_AddField }, { new Puerts.MethodKey {Name = "AddBinaryData", IsStatic = false}, M_AddBinaryData }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"headers", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_headers, Setter = null} }, {"data", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_data, Setter = null} }, } }; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_AnchoredJoint2D_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_AnchoredJoint2D_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.AnchoredJoint2D(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.AnchoredJoint2D), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_anchor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnchoredJoint2D; var result = obj.anchor; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_anchor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnchoredJoint2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.anchor = argHelper.Get<UnityEngine.Vector2>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_connectedAnchor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnchoredJoint2D; var result = obj.connectedAnchor; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_connectedAnchor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnchoredJoint2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.connectedAnchor = argHelper.Get<UnityEngine.Vector2>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_autoConfigureConnectedAnchor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnchoredJoint2D; var result = obj.autoConfigureConnectedAnchor; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_autoConfigureConnectedAnchor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnchoredJoint2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.autoConfigureConnectedAnchor = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"anchor", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_anchor, Setter = S_anchor} }, {"connectedAnchor", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_connectedAnchor, Setter = S_connectedAnchor} }, {"autoConfigureConnectedAnchor", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_autoConfigureConnectedAnchor, Setter = S_autoConfigureConnectedAnchor} }, } }; } } } <|start_filename|>Projects/Csharp_Unity_bin_use_UnityEngine_Vector/Assets/Gen/ai/SimpleParallel.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.ai { public sealed class SimpleParallel : ai.ComposeNode { public SimpleParallel(ByteBuf _buf) : base(_buf) { FinishMode = (ai.EFinishMode)_buf.ReadInt(); MainTask = ai.Task.DeserializeTask(_buf); BackgroundNode = ai.FlowNode.DeserializeFlowNode(_buf); } public static SimpleParallel DeserializeSimpleParallel(ByteBuf _buf) { return new ai.SimpleParallel(_buf); } public ai.EFinishMode FinishMode { get; private set; } public ai.Task MainTask { get; private set; } public ai.FlowNode BackgroundNode { get; private set; } public const int __ID__ = -1952582529; public override int GetTypeId() => __ID__; public override void Resolve(Dictionary<string, object> _tables) { base.Resolve(_tables); MainTask?.Resolve(_tables); BackgroundNode?.Resolve(_tables); } public override void TranslateText(System.Func<string, string, string> translator) { base.TranslateText(translator); MainTask?.TranslateText(translator); BackgroundNode?.TranslateText(translator); } public override string ToString() { return "{ " + "Id:" + Id + "," + "NodeName:" + NodeName + "," + "Decorators:" + Bright.Common.StringUtil.CollectionToString(Decorators) + "," + "Services:" + Bright.Common.StringUtil.CollectionToString(Services) + "," + "FinishMode:" + FinishMode + "," + "MainTask:" + MainTask + "," + "BackgroundNode:" + BackgroundNode + "," + "}"; } } } <|start_filename|>Projects/GenerateDatas/convert_lua/role.TbRoleLevelExpAttr/26.lua<|end_filename|> return { level = 26, need_exp = 9000, clothes_attrs = { 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, }, } <|start_filename|>Projects/java_json/src/gen/cfg/test/ETestEmptyEnum.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.test; public enum ETestEmptyEnum { ; private final int value; public int getValue() { return value; } ETestEmptyEnum(int value) { this.value = value; } public static ETestEmptyEnum valueOf(int value) { throw new IllegalArgumentException(""); } } <|start_filename|>Projects/Csharp_CustomTemplate_EncryptMemory/Gen/test/InnerGroup.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using System; using Newtonsoft.Json; using Scripts; namespace cfg.test { [Serializable] public partial class InnerGroup : AConfig { [JsonProperty("y1")] private int _y1 { get; set; } [JsonIgnore] public EncryptInt y1 { get; private set; } = new(); [JsonProperty("y2")] private int _y2 { get; set; } [JsonIgnore] public EncryptInt y2 { get; private set; } = new(); [JsonProperty("y3")] private int _y3 { get; set; } [JsonIgnore] public EncryptInt y3 { get; private set; } = new(); [JsonProperty("y4")] private int _y4 { get; set; } [JsonIgnore] public EncryptInt y4 { get; private set; } = new(); public override void EndInit() { y1 = _y1; y2 = _y2; y3 = _y3; y4 = _y4; } public override string ToString() => JsonConvert.SerializeObject(this); } } <|start_filename|>Projects/Cpp_bin/bright/math/Vector4.hpp<|end_filename|> #pragma once namespace bright { namespace math { struct Vector4 { float x; float y; float z; float w; Vector4() : x(0), y(0), z(0), w(0) {} Vector4(float x, float y, float z, float w) : x(x), y(y), z(z), w(w) {} }; } } <|start_filename|>Projects/java_json/src/gen/cfg/l10n/L10NDemo.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.l10n; import com.google.gson.JsonElement; import com.google.gson.JsonObject; public final class L10NDemo { public L10NDemo(JsonObject __json__) { id = __json__.get("id").getAsInt(); __json__.get("text").getAsJsonObject().get("key").getAsString(); text = __json__.get("text").getAsJsonObject().get("text").getAsString(); } public L10NDemo(int id, String text ) { this.id = id; this.text = text; } public static L10NDemo deserializeL10NDemo(JsonObject __json__) { return new L10NDemo(__json__); } public final int id; public final String text; public void resolve(java.util.HashMap<String, Object> _tables) { } @Override public String toString() { return "{ " + "id:" + id + "," + "text:" + text + "," + "}"; } } <|start_filename|>Projects/DataTemplates/template_json/item_tbitemfunc.json<|end_filename|> { "401": {"minor_type":401,"func_type":0,"method":"使用","close_bag_ui":true} , "1102": {"minor_type":1102,"func_type":1,"method":"使用","close_bag_ui":false} } <|start_filename|>Projects/Lua_Unity_xlua_lua/Assets/Lua/Data/test_tbtestglobal.lua<|end_filename|> return {unlock_equip=10,unlock_hero=20,} <|start_filename|>Projects/Java_bin/src/main/gen/cfg/common/GlobalConfig.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.common; import bright.serialization.*; public final class GlobalConfig { public GlobalConfig(ByteBuf _buf) { bagCapacity = _buf.readInt(); bagCapacitySpecial = _buf.readInt(); bagTempExpendableCapacity = _buf.readInt(); bagTempToolCapacity = _buf.readInt(); bagInitCapacity = _buf.readInt(); quickBagCapacity = _buf.readInt(); clothBagCapacity = _buf.readInt(); clothBagInitCapacity = _buf.readInt(); clothBagCapacitySpecial = _buf.readInt(); if(_buf.readBool()){ bagInitItemsDropId = _buf.readInt(); } else { bagInitItemsDropId = null; } mailBoxCapacity = _buf.readInt(); damageParamC = _buf.readFloat(); damageParamE = _buf.readFloat(); damageParamF = _buf.readFloat(); damageParamD = _buf.readFloat(); roleSpeed = _buf.readFloat(); monsterSpeed = _buf.readFloat(); initEnergy = _buf.readInt(); initViality = _buf.readInt(); maxViality = _buf.readInt(); perVialityRecoveryTime = _buf.readInt(); } public GlobalConfig(int bag_capacity, int bag_capacity_special, int bag_temp_expendable_capacity, int bag_temp_tool_capacity, int bag_init_capacity, int quick_bag_capacity, int cloth_bag_capacity, int cloth_bag_init_capacity, int cloth_bag_capacity_special, Integer bag_init_items_drop_id, int mail_box_capacity, float damage_param_c, float damage_param_e, float damage_param_f, float damage_param_d, float role_speed, float monster_speed, int init_energy, int init_viality, int max_viality, int per_viality_recovery_time ) { this.bagCapacity = bag_capacity; this.bagCapacitySpecial = bag_capacity_special; this.bagTempExpendableCapacity = bag_temp_expendable_capacity; this.bagTempToolCapacity = bag_temp_tool_capacity; this.bagInitCapacity = bag_init_capacity; this.quickBagCapacity = quick_bag_capacity; this.clothBagCapacity = cloth_bag_capacity; this.clothBagInitCapacity = cloth_bag_init_capacity; this.clothBagCapacitySpecial = cloth_bag_capacity_special; this.bagInitItemsDropId = bag_init_items_drop_id; this.mailBoxCapacity = mail_box_capacity; this.damageParamC = damage_param_c; this.damageParamE = damage_param_e; this.damageParamF = damage_param_f; this.damageParamD = damage_param_d; this.roleSpeed = role_speed; this.monsterSpeed = monster_speed; this.initEnergy = init_energy; this.initViality = init_viality; this.maxViality = max_viality; this.perVialityRecoveryTime = per_viality_recovery_time; } /** * 背包容量 */ public final int bagCapacity; public final int bagCapacitySpecial; public final int bagTempExpendableCapacity; public final int bagTempToolCapacity; public final int bagInitCapacity; public final int quickBagCapacity; public final int clothBagCapacity; public final int clothBagInitCapacity; public final int clothBagCapacitySpecial; public final Integer bagInitItemsDropId; public cfg.bonus.DropInfo bagInitItemsDropId_Ref; public final int mailBoxCapacity; public final float damageParamC; public final float damageParamE; public final float damageParamF; public final float damageParamD; public final float roleSpeed; public final float monsterSpeed; public final int initEnergy; public final int initViality; public final int maxViality; public final int perVialityRecoveryTime; public void resolve(java.util.HashMap<String, Object> _tables) { this.bagInitItemsDropId_Ref = this.bagInitItemsDropId != null ? ((cfg.bonus.TbDrop)_tables.get("bonus.TbDrop")).get(bagInitItemsDropId) : null; } @Override public String toString() { return "{ " + "bagCapacity:" + bagCapacity + "," + "bagCapacitySpecial:" + bagCapacitySpecial + "," + "bagTempExpendableCapacity:" + bagTempExpendableCapacity + "," + "bagTempToolCapacity:" + bagTempToolCapacity + "," + "bagInitCapacity:" + bagInitCapacity + "," + "quickBagCapacity:" + quickBagCapacity + "," + "clothBagCapacity:" + clothBagCapacity + "," + "clothBagInitCapacity:" + clothBagInitCapacity + "," + "clothBagCapacitySpecial:" + clothBagCapacitySpecial + "," + "bagInitItemsDropId:" + bagInitItemsDropId + "," + "mailBoxCapacity:" + mailBoxCapacity + "," + "damageParamC:" + damageParamC + "," + "damageParamE:" + damageParamE + "," + "damageParamF:" + damageParamF + "," + "damageParamD:" + damageParamD + "," + "roleSpeed:" + roleSpeed + "," + "monsterSpeed:" + monsterSpeed + "," + "initEnergy:" + initEnergy + "," + "initViality:" + initViality + "," + "maxViality:" + maxViality + "," + "perVialityRecoveryTime:" + perVialityRecoveryTime + "," + "}"; } } <|start_filename|>Benchmark/gen_lua.bat<|end_filename|> set GEN_CLIENT=..\Tools\Luban.Client\Luban.Client.exe set DEFINE_FILE=Defines\__root__.xml %GEN_CLIENT% -h %LUBAN_SERVER_IP% -j cfg --^ -d %DEFINE_FILE%^ --input_data_dir Datas ^ --output_data_dir data_lua ^ --gen_types data_lua ^ -s all pause <|start_filename|>Projects/GenerateDatas/convert_lua/role.TbRoleLevelExpAttr/17.lua<|end_filename|> return { level = 17, need_exp = 4500, clothes_attrs = { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, }, } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_GUILayoutUtility_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_GUILayoutUtility_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.GUILayoutUtility(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.GUILayoutUtility), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetRect(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIContent), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.GUIContent>(false); var Arg1 = argHelper1.Get<UnityEngine.GUIStyle>(false); var result = UnityEngine.GUILayoutUtility.GetRect(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.GetFloat(false); var result = UnityEngine.GUILayoutUtility.GetRect(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen >= 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIContent), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUILayoutOption), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.GUIContent>(false); var Arg1 = argHelper1.Get<UnityEngine.GUIStyle>(false); var Arg2 = argHelper2.GetParams<UnityEngine.GUILayoutOption>(info, 2, paramLen); var result = UnityEngine.GUILayoutUtility.GetRect(Arg0,Arg1,Arg2); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUILayoutOption), false, false)) { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.GetParams<UnityEngine.GUILayoutOption>(info, 2, paramLen); var result = UnityEngine.GUILayoutUtility.GetRect(Arg0,Arg1,Arg2); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false)) { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.Get<UnityEngine.GUIStyle>(false); var result = UnityEngine.GUILayoutUtility.GetRect(Arg0,Arg1,Arg2); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen >= 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUILayoutOption), false, false)) { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.Get<UnityEngine.GUIStyle>(false); var Arg3 = argHelper3.GetParams<UnityEngine.GUILayoutOption>(info, 3, paramLen); var result = UnityEngine.GUILayoutUtility.GetRect(Arg0,Arg1,Arg2,Arg3); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.GetFloat(false); var result = UnityEngine.GUILayoutUtility.GetRect(Arg0,Arg1,Arg2,Arg3); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false)) { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.Get<UnityEngine.GUIStyle>(false); var result = UnityEngine.GUILayoutUtility.GetRect(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen >= 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUILayoutOption), false, false)) { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.GetParams<UnityEngine.GUILayoutOption>(info, 4, paramLen); var result = UnityEngine.GUILayoutUtility.GetRect(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen >= 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false) && argHelper5.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUILayoutOption), false, false)) { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.Get<UnityEngine.GUIStyle>(false); var Arg5 = argHelper5.GetParams<UnityEngine.GUILayoutOption>(info, 5, paramLen); var result = UnityEngine.GUILayoutUtility.GetRect(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetRect"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetLastRect(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { { var result = UnityEngine.GUILayoutUtility.GetLastRect(); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetAspectRect(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetFloat(false); var result = UnityEngine.GUILayoutUtility.GetAspectRect(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false)) { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.Get<UnityEngine.GUIStyle>(false); var result = UnityEngine.GUILayoutUtility.GetAspectRect(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen >= 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUILayoutOption), false, false)) { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.GetParams<UnityEngine.GUILayoutOption>(info, 1, paramLen); var result = UnityEngine.GUILayoutUtility.GetAspectRect(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen >= 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUILayoutOption), false, false)) { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.Get<UnityEngine.GUIStyle>(false); var Arg2 = argHelper2.GetParams<UnityEngine.GUILayoutOption>(info, 2, paramLen); var result = UnityEngine.GUILayoutUtility.GetAspectRect(Arg0,Arg1,Arg2); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetAspectRect"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "GetRect", IsStatic = true}, F_GetRect }, { new Puerts.MethodKey {Name = "GetLastRect", IsStatic = true}, F_GetLastRect }, { new Puerts.MethodKey {Name = "GetAspectRect", IsStatic = true}, F_GetAspectRect }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { } }; } } } <|start_filename|>ProtoProjects/Csharp_Unity/Assets/Gen/test/AllType.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; namespace proto.test { public sealed class AllType : Bright.Serialization.BeanBase { public AllType() { } public AllType(Bright.Common.NotNullInitialization _) { A1 = ""; A2 = System.Array.Empty<byte>(); B1 = System.Array.Empty<int>(); B2 = System.Array.Empty<test.Simple>(); B3 = System.Array.Empty<test.Dyn>(); C1 = new System.Collections.Generic.List<int>(); C2 = new System.Collections.Generic.List<test.Simple>(); C3 = new System.Collections.Generic.List<test.Dyn>(); D1 = new System.Collections.Generic.HashSet<int>(); E1 = new System.Collections.Generic.Dictionary<int,int>(); E2 = new System.Collections.Generic.Dictionary<int,test.Simple>(); E3 = new System.Collections.Generic.Dictionary<int,test.Dyn>(); } public static void SerializeAllType(ByteBuf _buf, AllType x) { x.Serialize(_buf); } public static AllType DeserializeAllType(ByteBuf _buf) { var x = new test.AllType(); x.Deserialize(_buf); return x; } public bool X1; public byte X2; public short X3; public short X4; public int X5; public int X6; public long X7; public long X8; public string A1; public byte[] A2; public int[] B1; public test.Simple[] B2; public test.Dyn[] B3; public System.Collections.Generic.List<int> C1; public System.Collections.Generic.List<test.Simple> C2; public System.Collections.Generic.List<test.Dyn> C3; public System.Collections.Generic.HashSet<int> D1; public System.Collections.Generic.Dictionary<int, int> E1; public System.Collections.Generic.Dictionary<int, test.Simple> E2; public System.Collections.Generic.Dictionary<int, test.Dyn> E3; public const int __ID__ = 0; public override int GetTypeId() => __ID__; public override void Serialize(ByteBuf _buf) { _buf.WriteBool(X1); _buf.WriteByte(X2); _buf.WriteShort(X3); _buf.WriteFshort(X4); _buf.WriteInt(X5); _buf.WriteFint(X6); _buf.WriteLong(X7); _buf.WriteFlong(X8); _buf.WriteString(A1); _buf.WriteBytes(A2); { _buf.WriteSize(B1.Length); foreach(var _e in B1) { _buf.WriteInt(_e); } } { _buf.WriteSize(B2.Length); foreach(var _e in B2) { test.Simple.SerializeSimple(_buf, _e); } } { _buf.WriteSize(B3.Length); foreach(var _e in B3) { test.Dyn.SerializeDyn(_buf, _e); } } { _buf.WriteSize(C1.Count); foreach(var _e in C1) { _buf.WriteInt(_e); } } { _buf.WriteSize(C2.Count); foreach(var _e in C2) { test.Simple.SerializeSimple(_buf, _e); } } { _buf.WriteSize(C3.Count); foreach(var _e in C3) { test.Dyn.SerializeDyn(_buf, _e); } } { _buf.WriteSize(D1.Count); foreach(var _e in D1) { _buf.WriteInt(_e); } } { _buf.WriteSize(E1.Count); foreach(var _e in E1) { _buf.WriteInt(_e.Key); _buf.WriteInt(_e.Value); } } { _buf.WriteSize(E2.Count); foreach(var _e in E2) { _buf.WriteInt(_e.Key); test.Simple.SerializeSimple(_buf, _e.Value); } } { _buf.WriteSize(E3.Count); foreach(var _e in E3) { _buf.WriteInt(_e.Key); test.Dyn.SerializeDyn(_buf, _e.Value); } } } public override void Deserialize(ByteBuf _buf) { X1 = _buf.ReadBool(); X2 = _buf.ReadByte(); X3 = _buf.ReadShort(); X4 = _buf.ReadFshort(); X5 = _buf.ReadInt(); X6 = _buf.ReadFint(); X7 = _buf.ReadLong(); X8 = _buf.ReadFlong(); A1 = _buf.ReadString(); A2 = _buf.ReadBytes(); {int n = System.Math.Min(_buf.ReadSize(), _buf.Size);B1 = new int[n];for(var i = 0 ; i < n ; i++) { int _e;_e = _buf.ReadInt(); B1[i] = _e;}} {int n = System.Math.Min(_buf.ReadSize(), _buf.Size);B2 = new test.Simple[n];for(var i = 0 ; i < n ; i++) { test.Simple _e;_e = test.Simple.DeserializeSimple(_buf); B2[i] = _e;}} {int n = System.Math.Min(_buf.ReadSize(), _buf.Size);B3 = new test.Dyn[n];for(var i = 0 ; i < n ; i++) { test.Dyn _e;_e = test.Dyn.DeserializeDyn(_buf); B3[i] = _e;}} {int n = System.Math.Min(_buf.ReadSize(), _buf.Size);C1 = new System.Collections.Generic.List<int>(n);for(var i = 0 ; i < n ; i++) { int _e; _e = _buf.ReadInt(); C1.Add(_e);}} {int n = System.Math.Min(_buf.ReadSize(), _buf.Size);C2 = new System.Collections.Generic.List<test.Simple>(n);for(var i = 0 ; i < n ; i++) { test.Simple _e; _e = test.Simple.DeserializeSimple(_buf); C2.Add(_e);}} {int n = System.Math.Min(_buf.ReadSize(), _buf.Size);C3 = new System.Collections.Generic.List<test.Dyn>(n);for(var i = 0 ; i < n ; i++) { test.Dyn _e; _e = test.Dyn.DeserializeDyn(_buf); C3.Add(_e);}} {int n = System.Math.Min(_buf.ReadSize(), _buf.Size);D1 = new System.Collections.Generic.HashSet<int>(/*n * 3 / 2*/);for(var i = 0 ; i < n ; i++) { int _e; _e = _buf.ReadInt(); D1.Add(_e);}} {int n = System.Math.Min(_buf.ReadSize(), _buf.Size);E1 = new System.Collections.Generic.Dictionary<int, int>(n * 3 / 2);for(var i = 0 ; i < n ; i++) { int _k; _k = _buf.ReadInt(); int _v; _v = _buf.ReadInt(); E1.Add(_k, _v);}} {int n = System.Math.Min(_buf.ReadSize(), _buf.Size);E2 = new System.Collections.Generic.Dictionary<int, test.Simple>(n * 3 / 2);for(var i = 0 ; i < n ; i++) { int _k; _k = _buf.ReadInt(); test.Simple _v; _v = test.Simple.DeserializeSimple(_buf); E2.Add(_k, _v);}} {int n = System.Math.Min(_buf.ReadSize(), _buf.Size);E3 = new System.Collections.Generic.Dictionary<int, test.Dyn>(n * 3 / 2);for(var i = 0 ; i < n ; i++) { int _k; _k = _buf.ReadInt(); test.Dyn _v; _v = test.Dyn.DeserializeDyn(_buf); E3.Add(_k, _v);}} } public override string ToString() { return "test.AllType{ " + "X1:" + X1 + "," + "X2:" + X2 + "," + "X3:" + X3 + "," + "X4:" + X4 + "," + "X5:" + X5 + "," + "X6:" + X6 + "," + "X7:" + X7 + "," + "X8:" + X8 + "," + "A1:" + A1 + "," + "A2:" + A2 + "," + "B1:" + Bright.Common.StringUtil.CollectionToString(B1) + "," + "B2:" + Bright.Common.StringUtil.CollectionToString(B2) + "," + "B3:" + Bright.Common.StringUtil.CollectionToString(B3) + "," + "C1:" + Bright.Common.StringUtil.CollectionToString(C1) + "," + "C2:" + Bright.Common.StringUtil.CollectionToString(C2) + "," + "C3:" + Bright.Common.StringUtil.CollectionToString(C3) + "," + "D1:" + Bright.Common.StringUtil.CollectionToString(D1) + "," + "E1:" + Bright.Common.StringUtil.CollectionToString(E1) + "," + "E2:" + Bright.Common.StringUtil.CollectionToString(E2) + "," + "E3:" + Bright.Common.StringUtil.CollectionToString(E3) + "," + "}"; } } } <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/blueprint/EnumField.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.blueprint { public sealed partial class EnumField : Bright.Config.BeanBase { public EnumField(ByteBuf _buf) { Name = _buf.ReadString(); Value = _buf.ReadInt(); } public EnumField(string name, int value ) { this.Name = name; this.Value = value; } public static EnumField DeserializeEnumField(ByteBuf _buf) { return new blueprint.EnumField(_buf); } public readonly string Name; public readonly int Value; public const int ID = 1830049470; public override int GetTypeId() => ID; public void Resolve(Dictionary<string, object> _tables) { OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); public override string ToString() { return "{ " + "Name:" + Name + "," + "Value:" + Value + "," + "}"; } } } <|start_filename|>Projects/java_json/src/gen/cfg/ai/Node.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.ai; import com.google.gson.JsonElement; import com.google.gson.JsonObject; public abstract class Node { public Node(JsonObject __json__) { id = __json__.get("id").getAsInt(); nodeName = __json__.get("node_name").getAsString(); } public Node(int id, String node_name ) { this.id = id; this.nodeName = node_name; } public static Node deserializeNode(JsonObject __json__) { switch (__json__.get("__type__").getAsString()) { case "UeSetDefaultFocus": return new cfg.ai.UeSetDefaultFocus(__json__); case "ExecuteTimeStatistic": return new cfg.ai.ExecuteTimeStatistic(__json__); case "ChooseTarget": return new cfg.ai.ChooseTarget(__json__); case "KeepFaceTarget": return new cfg.ai.KeepFaceTarget(__json__); case "GetOwnerPlayer": return new cfg.ai.GetOwnerPlayer(__json__); case "UpdateDailyBehaviorProps": return new cfg.ai.UpdateDailyBehaviorProps(__json__); case "UeLoop": return new cfg.ai.UeLoop(__json__); case "UeCooldown": return new cfg.ai.UeCooldown(__json__); case "UeTimeLimit": return new cfg.ai.UeTimeLimit(__json__); case "UeBlackboard": return new cfg.ai.UeBlackboard(__json__); case "UeForceSuccess": return new cfg.ai.UeForceSuccess(__json__); case "IsAtLocation": return new cfg.ai.IsAtLocation(__json__); case "DistanceLessThan": return new cfg.ai.DistanceLessThan(__json__); case "Sequence": return new cfg.ai.Sequence(__json__); case "Selector": return new cfg.ai.Selector(__json__); case "SimpleParallel": return new cfg.ai.SimpleParallel(__json__); case "UeWait": return new cfg.ai.UeWait(__json__); case "UeWaitBlackboardTime": return new cfg.ai.UeWaitBlackboardTime(__json__); case "MoveToTarget": return new cfg.ai.MoveToTarget(__json__); case "ChooseSkill": return new cfg.ai.ChooseSkill(__json__); case "MoveToRandomLocation": return new cfg.ai.MoveToRandomLocation(__json__); case "MoveToLocation": return new cfg.ai.MoveToLocation(__json__); case "DebugPrint": return new cfg.ai.DebugPrint(__json__); default: throw new bright.serialization.SerializationException(); } } public final int id; public final String nodeName; public abstract int getTypeId(); public void resolve(java.util.HashMap<String, Object> _tables) { } @Override public String toString() { return "{ " + "id:" + id + "," + "nodeName:" + nodeName + "," + "}"; } } <|start_filename|>Projects/Java_bin/src/main/gen/cfg/bonus/Bonus.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.bonus; import bright.serialization.*; public abstract class Bonus { public Bonus(ByteBuf _buf) { } public Bonus() { } public static Bonus deserializeBonus(ByteBuf _buf) { switch (_buf.readInt()) { case cfg.bonus.OneItem.__ID__: return new cfg.bonus.OneItem(_buf); case cfg.bonus.OneItems.__ID__: return new cfg.bonus.OneItems(_buf); case cfg.bonus.Item.__ID__: return new cfg.bonus.Item(_buf); case cfg.bonus.Items.__ID__: return new cfg.bonus.Items(_buf); case cfg.bonus.CoefficientItem.__ID__: return new cfg.bonus.CoefficientItem(_buf); case cfg.bonus.WeightItems.__ID__: return new cfg.bonus.WeightItems(_buf); case cfg.bonus.ProbabilityItems.__ID__: return new cfg.bonus.ProbabilityItems(_buf); case cfg.bonus.MultiBonus.__ID__: return new cfg.bonus.MultiBonus(_buf); case cfg.bonus.ProbabilityBonus.__ID__: return new cfg.bonus.ProbabilityBonus(_buf); case cfg.bonus.WeightBonus.__ID__: return new cfg.bonus.WeightBonus(_buf); case cfg.bonus.DropBonus.__ID__: return new cfg.bonus.DropBonus(_buf); default: throw new SerializationException(); } } public abstract int getTypeId(); public void resolve(java.util.HashMap<String, Object> _tables) { } @Override public String toString() { return "{ " + "}"; } } <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/test/DefineFromExcelOne.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.test { /// <summary> /// /// </summary> public sealed partial class DefineFromExcelOne : Bright.Config.BeanBase { public DefineFromExcelOne(ByteBuf _buf) { UnlockEquip = _buf.ReadInt(); UnlockHero = _buf.ReadInt(); DefaultAvatar = _buf.ReadString(); DefaultItem = _buf.ReadString(); } public DefineFromExcelOne(int unlock_equip, int unlock_hero, string default_avatar, string default_item ) { this.UnlockEquip = unlock_equip; this.UnlockHero = unlock_hero; this.DefaultAvatar = default_avatar; this.DefaultItem = default_item; } public static DefineFromExcelOne DeserializeDefineFromExcelOne(ByteBuf _buf) { return new test.DefineFromExcelOne(_buf); } /// <summary> /// 装备解锁等级_描述 /// </summary> public readonly int UnlockEquip; /// <summary> /// 英雄解锁等级 /// </summary> public readonly int UnlockHero; /// <summary> /// 默认头像 /// </summary> public readonly string DefaultAvatar; public readonly string DefaultItem; public const int ID = 528039504; public override int GetTypeId() => ID; public void Resolve(Dictionary<string, object> _tables) { OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); public override string ToString() { return "{ " + "UnlockEquip:" + UnlockEquip + "," + "UnlockHero:" + UnlockHero + "," + "DefaultAvatar:" + DefaultAvatar + "," + "DefaultItem:" + DefaultItem + "," + "}"; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_UI_ICanvasElement_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_UI_ICanvasElement_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.UI.ICanvasElement constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Rebuild(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.ICanvasElement; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = (UnityEngine.UI.CanvasUpdate)argHelper0.GetInt32(false); obj.Rebuild(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_LayoutComplete(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.ICanvasElement; { { obj.LayoutComplete(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GraphicUpdateComplete(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.ICanvasElement; { { obj.GraphicUpdateComplete(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_IsDestroyed(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.ICanvasElement; { { var result = obj.IsDestroyed(); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_transform(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.ICanvasElement; var result = obj.transform; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "Rebuild", IsStatic = false}, M_Rebuild }, { new Puerts.MethodKey {Name = "LayoutComplete", IsStatic = false}, M_LayoutComplete }, { new Puerts.MethodKey {Name = "GraphicUpdateComplete", IsStatic = false}, M_GraphicUpdateComplete }, { new Puerts.MethodKey {Name = "IsDestroyed", IsStatic = false}, M_IsDestroyed }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"transform", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_transform, Setter = null} }, } }; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_RenderTargetSetup_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_RenderTargetSetup_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { if (paramLen == 8) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); var argHelper7 = new Puerts.ArgumentHelper((int)data, isolate, info, 7); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RenderBuffer[]), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.RenderBuffer), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rendering.RenderBufferLoadAction[]), false, false) && argHelper5.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rendering.RenderBufferStoreAction[]), false, false) && argHelper6.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper7.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.RenderBuffer[]>(false); var Arg1 = argHelper1.Get<UnityEngine.RenderBuffer>(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = (UnityEngine.CubemapFace)argHelper3.GetInt32(false); var Arg4 = argHelper4.Get<UnityEngine.Rendering.RenderBufferLoadAction[]>(false); var Arg5 = argHelper5.Get<UnityEngine.Rendering.RenderBufferStoreAction[]>(false); var Arg6 = (UnityEngine.Rendering.RenderBufferLoadAction)argHelper6.GetInt32(false); var Arg7 = (UnityEngine.Rendering.RenderBufferStoreAction)argHelper7.GetInt32(false); var result = new UnityEngine.RenderTargetSetup(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.RenderTargetSetup), result); } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.RenderBuffer), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.RenderBuffer), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.RenderBuffer>(false); var Arg1 = argHelper1.Get<UnityEngine.RenderBuffer>(false); var result = new UnityEngine.RenderTargetSetup(Arg0,Arg1); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.RenderTargetSetup), result); } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RenderBuffer[]), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.RenderBuffer), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.RenderBuffer[]>(false); var Arg1 = argHelper1.Get<UnityEngine.RenderBuffer>(false); var result = new UnityEngine.RenderTargetSetup(Arg0,Arg1); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.RenderTargetSetup), result); } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.RenderBuffer), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.RenderBuffer), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.RenderBuffer>(false); var Arg1 = argHelper1.Get<UnityEngine.RenderBuffer>(false); var Arg2 = argHelper2.GetInt32(false); var result = new UnityEngine.RenderTargetSetup(Arg0,Arg1,Arg2); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.RenderTargetSetup), result); } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RenderBuffer[]), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.RenderBuffer), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.RenderBuffer[]>(false); var Arg1 = argHelper1.Get<UnityEngine.RenderBuffer>(false); var Arg2 = argHelper2.GetInt32(false); var result = new UnityEngine.RenderTargetSetup(Arg0,Arg1,Arg2); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.RenderTargetSetup), result); } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.RenderBuffer), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.RenderBuffer), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.RenderBuffer>(false); var Arg1 = argHelper1.Get<UnityEngine.RenderBuffer>(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = (UnityEngine.CubemapFace)argHelper3.GetInt32(false); var result = new UnityEngine.RenderTargetSetup(Arg0,Arg1,Arg2,Arg3); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.RenderTargetSetup), result); } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RenderBuffer[]), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.RenderBuffer), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.RenderBuffer[]>(false); var Arg1 = argHelper1.Get<UnityEngine.RenderBuffer>(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = (UnityEngine.CubemapFace)argHelper3.GetInt32(false); var result = new UnityEngine.RenderTargetSetup(Arg0,Arg1,Arg2,Arg3); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.RenderTargetSetup), result); } } if (paramLen == 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.RenderBuffer), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.RenderBuffer), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.RenderBuffer>(false); var Arg1 = argHelper1.Get<UnityEngine.RenderBuffer>(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = (UnityEngine.CubemapFace)argHelper3.GetInt32(false); var Arg4 = argHelper4.GetInt32(false); var result = new UnityEngine.RenderTargetSetup(Arg0,Arg1,Arg2,Arg3,Arg4); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.RenderTargetSetup), result); } } if (paramLen == 0) { { var result = new UnityEngine.RenderTargetSetup(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.RenderTargetSetup), result); } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.RenderTargetSetup constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_color(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.RenderTargetSetup)Puerts.Utils.GetSelf((int)data, self); var result = obj.color; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_color(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.RenderTargetSetup)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.color = argHelper.Get<UnityEngine.RenderBuffer[]>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_depth(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.RenderTargetSetup)Puerts.Utils.GetSelf((int)data, self); var result = obj.depth; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_depth(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.RenderTargetSetup)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.depth = argHelper.Get<UnityEngine.RenderBuffer>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_mipLevel(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.RenderTargetSetup)Puerts.Utils.GetSelf((int)data, self); var result = obj.mipLevel; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_mipLevel(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.RenderTargetSetup)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.mipLevel = argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_cubemapFace(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.RenderTargetSetup)Puerts.Utils.GetSelf((int)data, self); var result = obj.cubemapFace; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_cubemapFace(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.RenderTargetSetup)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.cubemapFace = (UnityEngine.CubemapFace)argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_depthSlice(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.RenderTargetSetup)Puerts.Utils.GetSelf((int)data, self); var result = obj.depthSlice; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_depthSlice(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.RenderTargetSetup)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.depthSlice = argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_colorLoad(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.RenderTargetSetup)Puerts.Utils.GetSelf((int)data, self); var result = obj.colorLoad; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_colorLoad(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.RenderTargetSetup)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.colorLoad = argHelper.Get<UnityEngine.Rendering.RenderBufferLoadAction[]>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_colorStore(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.RenderTargetSetup)Puerts.Utils.GetSelf((int)data, self); var result = obj.colorStore; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_colorStore(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.RenderTargetSetup)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.colorStore = argHelper.Get<UnityEngine.Rendering.RenderBufferStoreAction[]>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_depthLoad(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.RenderTargetSetup)Puerts.Utils.GetSelf((int)data, self); var result = obj.depthLoad; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_depthLoad(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.RenderTargetSetup)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.depthLoad = (UnityEngine.Rendering.RenderBufferLoadAction)argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_depthStore(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.RenderTargetSetup)Puerts.Utils.GetSelf((int)data, self); var result = obj.depthStore; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_depthStore(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.RenderTargetSetup)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.depthStore = (UnityEngine.Rendering.RenderBufferStoreAction)argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"color", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_color, Setter = S_color} }, {"depth", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_depth, Setter = S_depth} }, {"mipLevel", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_mipLevel, Setter = S_mipLevel} }, {"cubemapFace", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_cubemapFace, Setter = S_cubemapFace} }, {"depthSlice", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_depthSlice, Setter = S_depthSlice} }, {"colorLoad", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_colorLoad, Setter = S_colorLoad} }, {"colorStore", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_colorStore, Setter = S_colorStore} }, {"depthLoad", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_depthLoad, Setter = S_depthLoad} }, {"depthStore", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_depthStore, Setter = S_depthStore} }, } }; } } } <|start_filename|>Projects/DataTemplates/template_erlang2/test_tbtestberef.erl<|end_filename|> %% test.TbTestBeRef -module(test_tbtestberef) -export([get/1,get_ids/0]) get(1) -> #{ id => 1, count => 10 }. get(2) -> #{ id => 2, count => 10 }. get(3) -> #{ id => 3, count => 10 }. get(4) -> #{ id => 4, count => 10 }. get(5) -> #{ id => 5, count => 10 }. get(6) -> #{ id => 6, count => 10 }. get(7) -> #{ id => 7, count => 10 }. get(8) -> #{ id => 8, count => 10 }. get(9) -> #{ id => 9, count => 10 }. get(10) -> #{ id => 10, count => 10 }. get_ids() -> [1,2,3,4,5,6,7,8,9,10]. <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_RaycastHit_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_RaycastHit_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.RaycastHit constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_collider(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.RaycastHit)Puerts.Utils.GetSelf((int)data, self); var result = obj.collider; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_point(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.RaycastHit)Puerts.Utils.GetSelf((int)data, self); var result = obj.point; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_point(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.RaycastHit)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.point = argHelper.Get<UnityEngine.Vector3>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_normal(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.RaycastHit)Puerts.Utils.GetSelf((int)data, self); var result = obj.normal; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_normal(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.RaycastHit)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.normal = argHelper.Get<UnityEngine.Vector3>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_barycentricCoordinate(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.RaycastHit)Puerts.Utils.GetSelf((int)data, self); var result = obj.barycentricCoordinate; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_barycentricCoordinate(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.RaycastHit)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.barycentricCoordinate = argHelper.Get<UnityEngine.Vector3>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_distance(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.RaycastHit)Puerts.Utils.GetSelf((int)data, self); var result = obj.distance; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_distance(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.RaycastHit)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.distance = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_triangleIndex(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.RaycastHit)Puerts.Utils.GetSelf((int)data, self); var result = obj.triangleIndex; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_textureCoord(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.RaycastHit)Puerts.Utils.GetSelf((int)data, self); var result = obj.textureCoord; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_textureCoord2(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.RaycastHit)Puerts.Utils.GetSelf((int)data, self); var result = obj.textureCoord2; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_transform(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.RaycastHit)Puerts.Utils.GetSelf((int)data, self); var result = obj.transform; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_rigidbody(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.RaycastHit)Puerts.Utils.GetSelf((int)data, self); var result = obj.rigidbody; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_articulationBody(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.RaycastHit)Puerts.Utils.GetSelf((int)data, self); var result = obj.articulationBody; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_lightmapCoord(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.RaycastHit)Puerts.Utils.GetSelf((int)data, self); var result = obj.lightmapCoord; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"collider", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_collider, Setter = null} }, {"point", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_point, Setter = S_point} }, {"normal", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_normal, Setter = S_normal} }, {"barycentricCoordinate", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_barycentricCoordinate, Setter = S_barycentricCoordinate} }, {"distance", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_distance, Setter = S_distance} }, {"triangleIndex", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_triangleIndex, Setter = null} }, {"textureCoord", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_textureCoord, Setter = null} }, {"textureCoord2", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_textureCoord2, Setter = null} }, {"transform", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_transform, Setter = null} }, {"rigidbody", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_rigidbody, Setter = null} }, {"articulationBody", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_articulationBody, Setter = null} }, {"lightmapCoord", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_lightmapCoord, Setter = null} }, } }; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_Gizmos_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_Gizmos_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.Gizmos(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.Gizmos), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_DrawLine(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3>(false); UnityEngine.Gizmos.DrawLine(Arg0,Arg1); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_DrawWireSphere(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = argHelper1.GetFloat(false); UnityEngine.Gizmos.DrawWireSphere(Arg0,Arg1); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_DrawSphere(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = argHelper1.GetFloat(false); UnityEngine.Gizmos.DrawSphere(Arg0,Arg1); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_DrawWireCube(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3>(false); UnityEngine.Gizmos.DrawWireCube(Arg0,Arg1); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_DrawCube(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3>(false); UnityEngine.Gizmos.DrawCube(Arg0,Arg1); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_DrawMesh(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Quaternion), false, false) && argHelper4.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.Get<UnityEngine.Vector3>(false); var Arg3 = argHelper3.Get<UnityEngine.Quaternion>(false); var Arg4 = argHelper4.Get<UnityEngine.Vector3>(false); UnityEngine.Gizmos.DrawMesh(Arg0,Arg1,Arg2,Arg3,Arg4); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Quaternion), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3>(false); var Arg2 = argHelper2.Get<UnityEngine.Quaternion>(false); UnityEngine.Gizmos.DrawMesh(Arg0,Arg1,Arg2); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.Get<UnityEngine.Vector3>(false); UnityEngine.Gizmos.DrawMesh(Arg0,Arg1,Arg2); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3>(false); UnityEngine.Gizmos.DrawMesh(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh>(false); var Arg1 = argHelper1.GetInt32(false); UnityEngine.Gizmos.DrawMesh(Arg0,Arg1); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh>(false); UnityEngine.Gizmos.DrawMesh(Arg0); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Quaternion), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3>(false); var Arg2 = argHelper2.Get<UnityEngine.Quaternion>(false); var Arg3 = argHelper3.Get<UnityEngine.Vector3>(false); UnityEngine.Gizmos.DrawMesh(Arg0,Arg1,Arg2,Arg3); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Quaternion), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.Get<UnityEngine.Vector3>(false); var Arg3 = argHelper3.Get<UnityEngine.Quaternion>(false); UnityEngine.Gizmos.DrawMesh(Arg0,Arg1,Arg2,Arg3); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to DrawMesh"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_DrawWireMesh(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Quaternion), false, false) && argHelper4.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.Get<UnityEngine.Vector3>(false); var Arg3 = argHelper3.Get<UnityEngine.Quaternion>(false); var Arg4 = argHelper4.Get<UnityEngine.Vector3>(false); UnityEngine.Gizmos.DrawWireMesh(Arg0,Arg1,Arg2,Arg3,Arg4); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Quaternion), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3>(false); var Arg2 = argHelper2.Get<UnityEngine.Quaternion>(false); UnityEngine.Gizmos.DrawWireMesh(Arg0,Arg1,Arg2); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.Get<UnityEngine.Vector3>(false); UnityEngine.Gizmos.DrawWireMesh(Arg0,Arg1,Arg2); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3>(false); UnityEngine.Gizmos.DrawWireMesh(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh>(false); var Arg1 = argHelper1.GetInt32(false); UnityEngine.Gizmos.DrawWireMesh(Arg0,Arg1); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh>(false); UnityEngine.Gizmos.DrawWireMesh(Arg0); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Quaternion), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3>(false); var Arg2 = argHelper2.Get<UnityEngine.Quaternion>(false); var Arg3 = argHelper3.Get<UnityEngine.Vector3>(false); UnityEngine.Gizmos.DrawWireMesh(Arg0,Arg1,Arg2,Arg3); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Quaternion), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.Get<UnityEngine.Vector3>(false); var Arg3 = argHelper3.Get<UnityEngine.Quaternion>(false); UnityEngine.Gizmos.DrawWireMesh(Arg0,Arg1,Arg2,Arg3); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to DrawWireMesh"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_DrawIcon(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = argHelper1.GetString(false); var Arg2 = argHelper2.GetBoolean(false); UnityEngine.Gizmos.DrawIcon(Arg0,Arg1,Arg2); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Color), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = argHelper1.GetString(false); var Arg2 = argHelper2.GetBoolean(false); var Arg3 = argHelper3.Get<UnityEngine.Color>(false); UnityEngine.Gizmos.DrawIcon(Arg0,Arg1,Arg2,Arg3); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = argHelper1.GetString(false); UnityEngine.Gizmos.DrawIcon(Arg0,Arg1); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to DrawIcon"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_DrawGUITexture(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 7) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.Get<UnityEngine.Texture>(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetInt32(false); var Arg4 = argHelper4.GetInt32(false); var Arg5 = argHelper5.GetInt32(false); var Arg6 = argHelper6.Get<UnityEngine.Material>(false); UnityEngine.Gizmos.DrawGUITexture(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.Get<UnityEngine.Texture>(false); UnityEngine.Gizmos.DrawGUITexture(Arg0,Arg1); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.Get<UnityEngine.Texture>(false); var Arg2 = argHelper2.Get<UnityEngine.Material>(false); UnityEngine.Gizmos.DrawGUITexture(Arg0,Arg1,Arg2); return; } } if (paramLen == 6) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.Get<UnityEngine.Texture>(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetInt32(false); var Arg4 = argHelper4.GetInt32(false); var Arg5 = argHelper5.GetInt32(false); UnityEngine.Gizmos.DrawGUITexture(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to DrawGUITexture"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_DrawFrustum(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.GetFloat(false); UnityEngine.Gizmos.DrawFrustum(Arg0,Arg1,Arg2,Arg3,Arg4); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_DrawRay(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Ray), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Ray>(false); UnityEngine.Gizmos.DrawRay(Arg0); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3>(false); UnityEngine.Gizmos.DrawRay(Arg0,Arg1); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to DrawRay"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_color(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Gizmos.color; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_color(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.Gizmos.color = argHelper.Get<UnityEngine.Color>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_matrix(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Gizmos.matrix; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_matrix(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.Gizmos.matrix = argHelper.Get<UnityEngine.Matrix4x4>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_exposure(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Gizmos.exposure; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_exposure(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.Gizmos.exposure = argHelper.Get<UnityEngine.Texture>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_probeSize(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Gizmos.probeSize; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "DrawLine", IsStatic = true}, F_DrawLine }, { new Puerts.MethodKey {Name = "DrawWireSphere", IsStatic = true}, F_DrawWireSphere }, { new Puerts.MethodKey {Name = "DrawSphere", IsStatic = true}, F_DrawSphere }, { new Puerts.MethodKey {Name = "DrawWireCube", IsStatic = true}, F_DrawWireCube }, { new Puerts.MethodKey {Name = "DrawCube", IsStatic = true}, F_DrawCube }, { new Puerts.MethodKey {Name = "DrawMesh", IsStatic = true}, F_DrawMesh }, { new Puerts.MethodKey {Name = "DrawWireMesh", IsStatic = true}, F_DrawWireMesh }, { new Puerts.MethodKey {Name = "DrawIcon", IsStatic = true}, F_DrawIcon }, { new Puerts.MethodKey {Name = "DrawGUITexture", IsStatic = true}, F_DrawGUITexture }, { new Puerts.MethodKey {Name = "DrawFrustum", IsStatic = true}, F_DrawFrustum }, { new Puerts.MethodKey {Name = "DrawRay", IsStatic = true}, F_DrawRay }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"color", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_color, Setter = S_color} }, {"matrix", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_matrix, Setter = S_matrix} }, {"exposure", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_exposure, Setter = S_exposure} }, {"probeSize", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_probeSize, Setter = null} }, } }; } } } <|start_filename|>Projects/Cpp_bin/bright/CommonMacros.h<|end_filename|> #pragma once #include <cstdint> #include <vector> #include <unordered_set> #include <unordered_map> #include <string> #include <functional> #include "math/Vector2.hpp" #include "math/Vector3.hpp" #include "math/Vector4.hpp" namespace bright { typedef std::uint8_t byte; typedef std::int16_t int16; typedef std::int32_t int32; typedef std::int64_t int64; typedef float float32; typedef double float64; typedef std::string String; typedef std::vector<byte> Bytes; typedef ::bright::math::Vector2 Vector2; typedef ::bright::math::Vector3 Vector3; typedef ::bright::math::Vector4 Vector4; typedef std::int32_t datetime; template<typename T> using Vector = std::vector<T>; template<typename T> using HashSet = std::unordered_set<T>; template<typename K, typename V> using HashMap = std::unordered_map<K, V>; template <typename T> using SharedPtr = std::shared_ptr<T>; template <typename T> using Function = std::function<T>; template <typename T> using Loader=::bright::Function<bool(T&, const ::bright::String&)>; using TextTranslator = ::bright::Function<bool(const ::bright::String&, ::bright::String&)>; } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_LightProbes_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_LightProbes_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.LightProbes constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_Tetrahedralize(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { { UnityEngine.LightProbes.Tetrahedralize(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_TetrahedralizeAsync(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { { UnityEngine.LightProbes.TetrahedralizeAsync(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetInterpolatedProbe(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = argHelper1.Get<UnityEngine.Renderer>(false); var Arg2 = argHelper2.Get<UnityEngine.Rendering.SphericalHarmonicsL2>(true); UnityEngine.LightProbes.GetInterpolatedProbe(Arg0,Arg1,out Arg2); argHelper2.SetByRefValue(Arg2); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_CalculateInterpolatedLightAndOcclusionProbes(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3[]), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rendering.SphericalHarmonicsL2[]), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector4[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3[]>(false); var Arg1 = argHelper1.Get<UnityEngine.Rendering.SphericalHarmonicsL2[]>(false); var Arg2 = argHelper2.Get<UnityEngine.Vector4[]>(false); UnityEngine.LightProbes.CalculateInterpolatedLightAndOcclusionProbes(Arg0,Arg1,Arg2); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Vector3>), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Rendering.SphericalHarmonicsL2>), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Vector4>), false, false)) { var Arg0 = argHelper0.Get<System.Collections.Generic.List<UnityEngine.Vector3>>(false); var Arg1 = argHelper1.Get<System.Collections.Generic.List<UnityEngine.Rendering.SphericalHarmonicsL2>>(false); var Arg2 = argHelper2.Get<System.Collections.Generic.List<UnityEngine.Vector4>>(false); UnityEngine.LightProbes.CalculateInterpolatedLightAndOcclusionProbes(Arg0,Arg1,Arg2); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to CalculateInterpolatedLightAndOcclusionProbes"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_positions(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightProbes; var result = obj.positions; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_bakedProbes(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightProbes; var result = obj.bakedProbes; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_bakedProbes(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightProbes; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.bakedProbes = argHelper.Get<UnityEngine.Rendering.SphericalHarmonicsL2[]>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_count(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightProbes; var result = obj.count; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_cellCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightProbes; var result = obj.cellCount; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void A_tetrahedralizationCompleted(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.LightProbes.tetrahedralizationCompleted += argHelper.Get<System.Action>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void R_tetrahedralizationCompleted(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.LightProbes.tetrahedralizationCompleted -= argHelper.Get<System.Action>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void A_needsRetetrahedralization(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.LightProbes.needsRetetrahedralization += argHelper.Get<System.Action>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void R_needsRetetrahedralization(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.LightProbes.needsRetetrahedralization -= argHelper.Get<System.Action>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "Tetrahedralize", IsStatic = true}, F_Tetrahedralize }, { new Puerts.MethodKey {Name = "TetrahedralizeAsync", IsStatic = true}, F_TetrahedralizeAsync }, { new Puerts.MethodKey {Name = "GetInterpolatedProbe", IsStatic = true}, F_GetInterpolatedProbe }, { new Puerts.MethodKey {Name = "CalculateInterpolatedLightAndOcclusionProbes", IsStatic = true}, F_CalculateInterpolatedLightAndOcclusionProbes }, { new Puerts.MethodKey {Name = "add_tetrahedralizationCompleted", IsStatic = true}, A_tetrahedralizationCompleted}, { new Puerts.MethodKey {Name = "remove_tetrahedralizationCompleted", IsStatic = true}, R_tetrahedralizationCompleted}, { new Puerts.MethodKey {Name = "add_needsRetetrahedralization", IsStatic = true}, A_needsRetetrahedralization}, { new Puerts.MethodKey {Name = "remove_needsRetetrahedralization", IsStatic = true}, R_needsRetetrahedralization}, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"positions", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_positions, Setter = null} }, {"bakedProbes", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_bakedProbes, Setter = S_bakedProbes} }, {"count", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_count, Setter = null} }, {"cellCount", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_cellCount, Setter = null} }, } }; } } } <|start_filename|>Projects/DataTemplates/template_erlang2/test_tbfulltypes.erl<|end_filename|> %% test.TbFullTypes -module(test_tbfulltypes) -export([get/1,get_ids/0]) get(1) -> #{ x4 => 1, x1 => true, x2 => 5, x3 => 1, x5 => 13234234234, x6 => 1.28, x7 => 1.23457891, x8_0 => 1234, x8 => 1234, x9 => 111111111, x10 => "huang", x12 => bean, x13 => 1, x14 => bean, s1 => xxx, v2 => {"1","2"}, v3 => {"2","3","4"}, v4 => {"10.2","2.3","3.4","12.8"}, t1 => 935460549, k1 => array, k2 => array, k5 => array, k8 => map, k9 => array, k15 => array }. get(2) -> #{ x4 => 2, x1 => false, x2 => 0, x3 => 2, x5 => 0, x6 => 0, x7 => 0, x8_0 => 0, x8 => 0, x9 => 0, x10 => "", x12 => bean, x13 => 1, x14 => bean, s1 => asdfa2, v2 => {"1","2"}, v3 => {"2","3","4"}, v4 => {"10.2","2.3","3.4","12.8"}, t1 => 935460549, k1 => array, k2 => array, k5 => array, k8 => map, k9 => array, k15 => array }. get(3) -> #{ x4 => 3, x1 => false, x2 => 0, x3 => 3, x5 => 0, x6 => 0, x7 => 0, x8_0 => 0, x8 => 0, x9 => 0, x10 => "", x12 => bean, x13 => 1, x14 => bean, s1 => asdfa2, v2 => {"0","0"}, v3 => {"0","0","0"}, v4 => {"0","0","0","0"}, t1 => 1577808000, k1 => array, k2 => array, k5 => array, k8 => map, k9 => array, k15 => array }. get(4) -> #{ x4 => 4, x1 => false, x2 => 5, x3 => 4, x5 => 0, x6 => 0, x7 => 0, x8_0 => 0, x8 => 0, x9 => 0, x10 => "", x12 => bean, x13 => 1, x14 => bean, s1 => asdfa4, v2 => {"1","2"}, v3 => {"2","3","4"}, v4 => {"10.2","2.3","3.4","12.8"}, t1 => 933732549, k1 => array, k2 => array, k5 => array, k8 => map, k9 => array, k15 => array }. get(5) -> #{ x4 => 5, x1 => false, x2 => 5, x3 => 6, x5 => 13234234234, x6 => 1.28, x7 => 1.23457891, x8_0 => 1234, x8 => 1234, x9 => 111111111, x10 => "huang", x12 => bean, x13 => 1, x14 => bean, s1 => , v2 => {"1","2"}, v3 => {"2","3","4"}, v4 => {"10.2","2.3","3.4","12.8"}, t1 => 1577808000, k1 => array, k2 => array, k5 => array, k8 => map, k9 => array, k15 => array }. get(6) -> #{ x4 => 6, x1 => true, x2 => 5, x3 => 7, x5 => 13234234234, x6 => 1.28, x7 => 1.23457891, x8_0 => 1234, x8 => 1234, x9 => 111111111, x10 => "huang", x12 => bean, x13 => 1, x14 => bean, s1 => , v2 => {"1","2"}, v3 => {"2","3","4"}, v4 => {"10.2","2.3","3.4","12.8"}, t1 => 935460549, k1 => array, k2 => array, k5 => array, k8 => map, k9 => array, k15 => array }. get(7) -> #{ x4 => 7, x1 => true, x2 => 5, x3 => 8, x5 => 1213123, x6 => 1.28, x7 => 1.23457891, x8_0 => 1234, x8 => 1234, x9 => 111111111, x10 => "huang", x12 => bean, x13 => 1, x14 => bean, s1 => asdfa7, v2 => {"1","2"}, v3 => {"2","3","4"}, v4 => {"10.2","2.3","3.4","12.8"}, t1 => 1577808000, k1 => array, k2 => array, k5 => array, k8 => map, k9 => array, k15 => array }. get(8) -> #{ x4 => 8, x1 => true, x2 => 5, x3 => 9, x5 => 13234234234, x6 => 1.28, x7 => 1.23457891, x8_0 => 1234, x8 => 1234, x9 => 111111111, x10 => "huang", x12 => bean, x13 => 2, x14 => bean, s1 => asdfa8, v2 => {"1","2"}, v3 => {"2","3","4"}, v4 => {"10.2","2.3","3.4","12.8"}, t1 => 935460549, k1 => array, k2 => array, k5 => array, k8 => map, k9 => array, k15 => array }. get(9) -> #{ x4 => 9, x1 => true, x2 => 5, x3 => 128, x5 => 13234234234, x6 => 1.28, x7 => 1.23457891, x8_0 => 1234, x8 => 1234, x9 => 111111111, x10 => "huang", x12 => bean, x13 => 1, x14 => bean, s1 => asdfa8, v2 => {"1","2"}, v3 => {"2","3","4"}, v4 => {"10.2","2.3","3.4","12.8"}, t1 => 935460549, k1 => array, k2 => array, k5 => array, k8 => map, k9 => array, k15 => array }. get(10) -> #{ x4 => 10, x1 => true, x2 => 5, x3 => 128, x5 => 13234234234, x6 => 1.28, x7 => 1.23457891, x8_0 => 1234, x8 => 1234, x9 => 111111111, x10 => "huang", x12 => bean, x13 => 1, x14 => bean, s1 => asdfa9, v2 => {"1","3"}, v3 => {"2","3","5"}, v4 => {"10.2","2.3","3.4","12.9"}, t1 => 935460550, k1 => array, k2 => array, k5 => array, k8 => map, k9 => array, k15 => array }. get(12) -> #{ x4 => 12, x1 => true, x2 => 5, x3 => 128, x5 => 13234234234, x6 => 1.28, x7 => 1.23457891, x8_0 => 1234, x8 => 1234, x9 => 111111111, x10 => "huang", x12 => bean, x13 => 2, x14 => bean, s1 => asdfa10, v2 => {"1","4"}, v3 => {"2","3","6"}, v4 => {"10.2","2.3","3.4","12.1"}, t1 => 935460551, k1 => array, k2 => array, k5 => array, k8 => map, k9 => array, k15 => array }. get(30) -> #{ x4 => 30, x1 => true, x2 => 5, x3 => 128, x5 => 13234234234, x6 => 1.28, x7 => 1.23457891, x8_0 => 1234, x8 => 1234, x9 => 111111111, x10 => "huang", x12 => bean, x13 => 4, x14 => bean, s1 => asdfa11, v2 => {"1","5"}, v3 => {"2","3","7"}, v4 => {"10.2","2.3","3.4","12.11"}, t1 => 935460552, k1 => array, k2 => array, k5 => array, k8 => map, k9 => array, k15 => array }. get_ids() -> [1,2,3,4,5,6,7,8,9,10,12,30]. <|start_filename|>Projects/L10N/config_data/test_tbtestref.lua<|end_filename|> return { [1] = {id=1,x1=1,x1_2=1,x2=2,a1={1,2,},a2={2,3,},b1={3,4,},b2={4,5,},c1={5,6,7,},c2={6,7,},d1={[1]=2,[3]=4,},d2={[1]=2,[3]=4,},e1=1,e2=11,e3="ab5",f1=1,f2=11,f3="ab5",}, [2] = {id=2,x1=1,x1_2=1,x2=2,a1={1,3,},a2={2,4,},b1={3,5,},b2={4,6,},c1={5,6,8,},c2={6,8,},d1={[1]=2,[3]=4,},d2={[1]=2,[3]=4,},e1=1,e2=11,e3="ab5",f1=1,f2=11,f3="ab5",}, [3] = {id=3,x1=1,x1_2=1,x2=2,a1={1,4,},a2={2,5,},b1={3,6,},b2={4,7,},c1={5,6,9,},c2={6,9,},d1={[1]=2,[3]=4,},d2={[1]=2,[3]=4,},e1=1,e2=11,e3="ab5",f1=1,f2=11,f3="ab5",}, } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_SubsystemManager_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_SubsystemManager_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.SubsystemManager constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetAllSubsystemDescriptors(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.Collections.Generic.List<UnityEngine.ISubsystemDescriptor>>(false); UnityEngine.SubsystemManager.GetAllSubsystemDescriptors(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void A_beforeReloadSubsystems(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.SubsystemManager.beforeReloadSubsystems += argHelper.Get<System.Action>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void R_beforeReloadSubsystems(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.SubsystemManager.beforeReloadSubsystems -= argHelper.Get<System.Action>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void A_afterReloadSubsystems(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.SubsystemManager.afterReloadSubsystems += argHelper.Get<System.Action>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void R_afterReloadSubsystems(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.SubsystemManager.afterReloadSubsystems -= argHelper.Get<System.Action>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void A_reloadSubsytemsStarted(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.SubsystemManager.reloadSubsytemsStarted += argHelper.Get<System.Action>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void R_reloadSubsytemsStarted(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.SubsystemManager.reloadSubsytemsStarted -= argHelper.Get<System.Action>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void A_reloadSubsytemsCompleted(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.SubsystemManager.reloadSubsytemsCompleted += argHelper.Get<System.Action>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void R_reloadSubsytemsCompleted(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.SubsystemManager.reloadSubsytemsCompleted -= argHelper.Get<System.Action>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "GetAllSubsystemDescriptors", IsStatic = true}, F_GetAllSubsystemDescriptors }, { new Puerts.MethodKey {Name = "add_beforeReloadSubsystems", IsStatic = true}, A_beforeReloadSubsystems}, { new Puerts.MethodKey {Name = "remove_beforeReloadSubsystems", IsStatic = true}, R_beforeReloadSubsystems}, { new Puerts.MethodKey {Name = "add_afterReloadSubsystems", IsStatic = true}, A_afterReloadSubsystems}, { new Puerts.MethodKey {Name = "remove_afterReloadSubsystems", IsStatic = true}, R_afterReloadSubsystems}, { new Puerts.MethodKey {Name = "add_reloadSubsytemsStarted", IsStatic = true}, A_reloadSubsytemsStarted}, { new Puerts.MethodKey {Name = "remove_reloadSubsytemsStarted", IsStatic = true}, R_reloadSubsytemsStarted}, { new Puerts.MethodKey {Name = "add_reloadSubsytemsCompleted", IsStatic = true}, A_reloadSubsytemsCompleted}, { new Puerts.MethodKey {Name = "remove_reloadSubsytemsCompleted", IsStatic = true}, R_reloadSubsytemsCompleted}, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { } }; } } } <|start_filename|>Projects/DataTemplates/template_lua2/test_tbdetectcsvencoding.lua<|end_filename|> -- test.TbDetectCsvEncoding return { [21] = { id=21, name="测试编码", }, [22] = { id=22, name="还果园国要", }, [23] = { id=23, name="工枯加盟仍", }, [11] = { id=11, name="测试编码", }, [12] = { id=12, name="还果园国要", }, [13] = { id=13, name="工枯加盟仍", }, [31] = { id=31, name="测试编码", }, [32] = { id=32, name="还果园国要", }, [33] = { id=33, name="工枯加盟仍", }, [1] = { id=1, name="测试编码", }, [2] = { id=2, name="还果园国要", }, [3] = { id=3, name="工枯加盟仍", }, } <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/l10n/PatchDemo.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.l10n { public sealed partial class PatchDemo : Bright.Config.BeanBase { public PatchDemo(ByteBuf _buf) { Id = _buf.ReadInt(); Value = _buf.ReadInt(); } public PatchDemo(int id, int value ) { this.Id = id; this.Value = value; } public static PatchDemo DeserializePatchDemo(ByteBuf _buf) { return new l10n.PatchDemo(_buf); } public readonly int Id; public readonly int Value; public const int ID = -1707294656; public override int GetTypeId() => ID; public void Resolve(Dictionary<string, object> _tables) { OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); public override string ToString() { return "{ " + "Id:" + Id + "," + "Value:" + Value + "," + "}"; } } } <|start_filename|>Projects/GenerateDatas/convert_lua/item.TbItemExtra/1020300001.lua<|end_filename|> return { _name = 'Clothes', id = 1020300001, attack = 100, hp = 1000, energy_limit = 5, energy_resume = 1, } <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/test/DemoType2.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.test { public sealed partial class DemoType2 : Bright.Config.BeanBase { public DemoType2(ByteBuf _buf) { X4 = _buf.ReadInt(); X1 = _buf.ReadBool(); X2 = _buf.ReadByte(); X3 = _buf.ReadShort(); X5 = _buf.ReadLong(); X6 = _buf.ReadFloat(); X7 = _buf.ReadDouble(); X80 = _buf.ReadFshort(); X8 = _buf.ReadFint(); X9 = _buf.ReadFlong(); X10 = _buf.ReadString(); X12 = test.DemoType1.DeserializeDemoType1(_buf); X13 = (test.DemoEnum)_buf.ReadInt(); X14 = test.DemoDynamic.DeserializeDemoDynamic(_buf); S1 = _buf.ReadString(); V2 = _buf.ReadVector2(); V3 = _buf.ReadVector3(); V4 = _buf.ReadVector4(); T1 = _buf.ReadInt(); {int n = System.Math.Min(_buf.ReadSize(), _buf.Size);K1 = new int[n];for(var i = 0 ; i < n ; i++) { int _e;_e = _buf.ReadInt(); K1[i] = _e;}} {int n = System.Math.Min(_buf.ReadSize(), _buf.Size);K2 = new System.Collections.Generic.List<int>(n);for(var i = 0 ; i < n ; i++) { int _e; _e = _buf.ReadInt(); K2.Add(_e);}} {int n = System.Math.Min(_buf.ReadSize(), _buf.Size);K5 = new System.Collections.Generic.HashSet<int>(/*n * 3 / 2*/);for(var i = 0 ; i < n ; i++) { int _e; _e = _buf.ReadInt(); K5.Add(_e);}} {int n = System.Math.Min(_buf.ReadSize(), _buf.Size);K8 = new System.Collections.Generic.Dictionary<int, int>(n * 3 / 2);for(var i = 0 ; i < n ; i++) { int _k; _k = _buf.ReadInt(); int _v; _v = _buf.ReadInt(); K8.Add(_k, _v);}} {int n = System.Math.Min(_buf.ReadSize(), _buf.Size);K9 = new System.Collections.Generic.List<test.DemoE2>(n);for(var i = 0 ; i < n ; i++) { test.DemoE2 _e; _e = test.DemoE2.DeserializeDemoE2(_buf); K9.Add(_e);}} {int n = System.Math.Min(_buf.ReadSize(), _buf.Size);K15 = new test.DemoDynamic[n];for(var i = 0 ; i < n ; i++) { test.DemoDynamic _e;_e = test.DemoDynamic.DeserializeDemoDynamic(_buf); K15[i] = _e;}} } public DemoType2(int x4, bool x1, byte x2, short x3, long x5, float x6, double x7, short x8_0, int x8, long x9, string x10, test.DemoType1 x12, test.DemoEnum x13, test.DemoDynamic x14, string s1, System.Numerics.Vector2 v2, System.Numerics.Vector3 v3, System.Numerics.Vector4 v4, int t1, int[] k1, System.Collections.Generic.List<int> k2, System.Collections.Generic.HashSet<int> k5, System.Collections.Generic.Dictionary<int, int> k8, System.Collections.Generic.List<test.DemoE2> k9, test.DemoDynamic[] k15 ) { this.X4 = x4; this.X1 = x1; this.X2 = x2; this.X3 = x3; this.X5 = x5; this.X6 = x6; this.X7 = x7; this.X80 = x8_0; this.X8 = x8; this.X9 = x9; this.X10 = x10; this.X12 = x12; this.X13 = x13; this.X14 = x14; this.S1 = s1; this.V2 = v2; this.V3 = v3; this.V4 = v4; this.T1 = t1; this.K1 = k1; this.K2 = k2; this.K5 = k5; this.K8 = k8; this.K9 = k9; this.K15 = k15; } public static DemoType2 DeserializeDemoType2(ByteBuf _buf) { return new test.DemoType2(_buf); } public readonly int X4; public readonly bool X1; public readonly byte X2; public readonly short X3; public test.DemoType2 X3_Ref; public readonly long X5; public readonly float X6; public readonly double X7; public readonly short X80; public readonly int X8; public readonly long X9; public readonly string X10; public readonly test.DemoType1 X12; public readonly test.DemoEnum X13; public readonly test.DemoDynamic X14; public readonly string S1; public readonly System.Numerics.Vector2 V2; public readonly System.Numerics.Vector3 V3; public readonly System.Numerics.Vector4 V4; public readonly int T1; public readonly int[] K1; public readonly System.Collections.Generic.List<int> K2; public readonly System.Collections.Generic.HashSet<int> K5; public readonly System.Collections.Generic.Dictionary<int, int> K8; public readonly System.Collections.Generic.List<test.DemoE2> K9; public readonly test.DemoDynamic[] K15; public const int ID = -367048295; public override int GetTypeId() => ID; public void Resolve(Dictionary<string, object> _tables) { this.X3_Ref = (_tables["test.TbFullTypes"] as test.TbFullTypes).GetOrDefault(X3); X12?.Resolve(_tables); X14?.Resolve(_tables); foreach(var _e in K9) { _e?.Resolve(_tables); } foreach(var _e in K15) { _e?.Resolve(_tables); } OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); public override string ToString() { return "{ " + "X4:" + X4 + "," + "X1:" + X1 + "," + "X2:" + X2 + "," + "X3:" + X3 + "," + "X5:" + X5 + "," + "X6:" + X6 + "," + "X7:" + X7 + "," + "X80:" + X80 + "," + "X8:" + X8 + "," + "X9:" + X9 + "," + "X10:" + X10 + "," + "X12:" + X12 + "," + "X13:" + X13 + "," + "X14:" + X14 + "," + "S1:" + S1 + "," + "V2:" + V2 + "," + "V3:" + V3 + "," + "V4:" + V4 + "," + "T1:" + T1 + "," + "K1:" + Bright.Common.StringUtil.CollectionToString(K1) + "," + "K2:" + Bright.Common.StringUtil.CollectionToString(K2) + "," + "K5:" + Bright.Common.StringUtil.CollectionToString(K5) + "," + "K8:" + Bright.Common.StringUtil.CollectionToString(K8) + "," + "K9:" + Bright.Common.StringUtil.CollectionToString(K9) + "," + "K15:" + Bright.Common.StringUtil.CollectionToString(K15) + "," + "}"; } } } <|start_filename|>Projects/DataTemplates/template_erlang/error_tberrorinfo.erl<|end_filename|> %% error.TbErrorInfo get("EXAMPLE_FLASH") -> #{code => "EXAMPLE_FLASH",desc => "这是一个例子飘窗",style => #{name__ => "ErrorStyleTip"}}. get("EXAMPLE_MSGBOX") -> #{code => "EXAMPLE_MSGBOX",desc => "例子弹框,消息决定行为",style => #{name__ => "ErrorStyleMsgbox",btn_name => "要重启了",operation => 1}}. get("EXAMPLE_DLG_OK") -> #{code => "EXAMPLE_DLG_OK",desc => "例子:单按钮提示,用户自己提供回调",style => #{name__ => "ErrorStyleDlgOk",btn_name => "联知道了"}}. get("EXAMPLE_DLG_OK_CANCEL") -> #{code => "EXAMPLE_DLG_OK_CANCEL",desc => "例子:双按钮提示,用户自己提供回调",style => #{name__ => "ErrorStyleDlgOkCancel",btn1_name => "别",btn2_name => "好"}}. get("ROLE_CREATE_NAME_INVALID_CHAR") -> #{code => "ROLE_CREATE_NAME_INVALID_CHAR",desc => "角色名字有非法字符",style => #{name__ => "ErrorStyleTip"}}. get("ROLE_CREATE_NAME_EMPTY") -> #{code => "ROLE_CREATE_NAME_EMPTY",desc => "名字为空",style => #{name__ => "ErrorStyleTip"}}. get("ROLE_CREATE_NAME_EXCEED_MAX_LENGTH") -> #{code => "ROLE_CREATE_NAME_EXCEED_MAX_LENGTH",desc => "名字太长",style => #{name__ => "ErrorStyleTip"}}. get("ROLE_CREATE_ROLE_LIST_FULL") -> #{code => "ROLE_CREATE_ROLE_LIST_FULL",desc => "角色列表已满",style => #{name__ => "ErrorStyleTip"}}. get("ROLE_CREATE_INVALID_PROFESSION") -> #{code => "ROLE_CREATE_INVALID_PROFESSION",desc => "非法职业",style => #{name__ => "ErrorStyleTip"}}. get("PARAM_ILLEGAL") -> #{code => "PARAM_ILLEGAL",desc => "参数非法",style => #{name__ => "ErrorStyleTip"}}. get("BAG_IS_FULL") -> #{code => "BAG_IS_FULL",desc => "背包已满",style => #{name__ => "ErrorStyleTip"}}. get("ITEM_NOT_ENOUGH") -> #{code => "ITEM_NOT_ENOUGH",desc => "道具不足",style => #{name__ => "ErrorStyleTip"}}. get("ITEM_IN_BAG") -> #{code => "ITEM_IN_BAG",desc => "道具已在背包中",style => #{name__ => "ErrorStyleTip"}}. get("GENDER_NOT_MATCH") -> #{code => "GENDER_NOT_MATCH",desc => "",style => #{name__ => "ErrorStyleTip"}}. get("LEVEL_TOO_LOW") -> #{code => "LEVEL_TOO_LOW",desc => "等级太低",style => #{name__ => "ErrorStyleTip"}}. get("LEVEL_TOO_HIGH") -> #{code => "LEVEL_TOO_HIGH",desc => "等级太高",style => #{name__ => "ErrorStyleTip"}}. get("EXCEED_LIMIT") -> #{code => "EXCEED_LIMIT",desc => "超过限制",style => #{name__ => "ErrorStyleTip"}}. get("OVER_TIME") -> #{code => "OVER_TIME",desc => "超时",style => #{name__ => "ErrorStyleTip"}}. get("SKILL_NOT_IN_LIST") -> #{code => "SKILL_NOT_IN_LIST",desc => "",style => #{name__ => "ErrorStyleTip"}}. get("SKILL_NOT_COOLDOWN") -> #{code => "SKILL_NOT_COOLDOWN",desc => "",style => #{name__ => "ErrorStyleTip"}}. get("SKILL_TARGET_NOT_EXIST") -> #{code => "SKILL_TARGET_NOT_EXIST",desc => "",style => #{name__ => "ErrorStyleTip"}}. get("SKILL_ANOTHER_CASTING") -> #{code => "SKILL_ANOTHER_CASTING",desc => "",style => #{name__ => "ErrorStyleTip"}}. get("MAIL_TYPE_ERROR") -> #{code => "MAIL_TYPE_ERROR",desc => "邮件类型错误",style => #{name__ => "ErrorStyleTip"}}. get("MAIL_HAVE_DELETED") -> #{code => "MAIL_HAVE_DELETED",desc => "邮件已删除",style => #{name__ => "ErrorStyleTip"}}. get("MAIL_AWARD_HAVE_RECEIVED") -> #{code => "MAIL_AWARD_HAVE_RECEIVED",desc => "邮件奖励已领取",style => #{name__ => "ErrorStyleTip"}}. get("MAIL_OPERATE_TYPE_ERROR") -> #{code => "MAIL_OPERATE_TYPE_ERROR",desc => "邮件操作类型错误",style => #{name__ => "ErrorStyleTip"}}. get("MAIL_CONDITION_NOT_MEET") -> #{code => "MAIL_CONDITION_NOT_MEET",desc => "邮件条件不满足",style => #{name__ => "ErrorStyleTip"}}. get("MAIL_NO_AWARD") -> #{code => "MAIL_NO_AWARD",desc => "邮件没有奖励",style => #{name__ => "ErrorStyleTip"}}. get("MAIL_BOX_IS_FULL") -> #{code => "MAIL_BOX_IS_FULL",desc => "邮箱已满",style => #{name__ => "ErrorStyleTip"}}. get("NO_INTERACTION_COMPONENT") -> #{code => "NO_INTERACTION_COMPONENT",desc => "在被拾取对象上,找不到交互组件!!",style => #{name__ => "ErrorStyleTip"}}. get("BUTTON_TOO_MANY_CLICKS") -> #{code => "BUTTON_TOO_MANY_CLICKS",desc => "点击次数太多了",style => #{name__ => "ErrorStyleTip"}}. get("SKILL_ENEYGY_LACK") -> #{code => "SKILL_ENEYGY_LACK",desc => "技能能量不足",style => #{name__ => "ErrorStyleTip"}}. get("SKILL_IS_COOLINGDOWN") -> #{code => "SKILL_IS_COOLINGDOWN",desc => "技能冷却中",style => #{name__ => "ErrorStyleTip"}}. get("SKILL_NO_REACTION_OBJ") -> #{code => "SKILL_NO_REACTION_OBJ",desc => "当前没有对技能生效的物体",style => #{name__ => "ErrorStyleTip"}}. get("SKILL_NOT_UNLOCKED") -> #{code => "SKILL_NOT_UNLOCKED",desc => "技能尚未解锁",style => #{name__ => "ErrorStyleTip"}}. get("SKILL_IS_GROUP_COLLINGDOWN") -> #{code => "SKILL_IS_GROUP_COLLINGDOWN",desc => "技能释放中",style => #{name__ => "ErrorStyleTip"}}. get("CLOTH_CHANGE_TOO_FAST") -> #{code => "CLOTH_CHANGE_TOO_FAST",desc => "暖暖正在换衣服中,请稍等",style => #{name__ => "ErrorStyleTip"}}. get("CLOTH_CHANGE_NOT_ALLOW") -> #{code => "CLOTH_CHANGE_NOT_ALLOW",desc => "当前状态不允许换装",style => #{name__ => "ErrorStyleTip"}}. get("CLOTH_CHANGE_SAME") -> #{code => "CLOTH_CHANGE_SAME",desc => "换的还是目前的套装",style => #{name__ => "ErrorStyleTip"}}. get("HAS_BIND_SERVER") -> #{code => "HAS_BIND_SERVER",desc => "已经绑定过该服务器",style => #{name__ => "ErrorStyleMsgbox",btn_name => "ok",operation => 1}}. get("AUTH_FAIL") -> #{code => "AUTH_FAIL",desc => "认证失败",style => #{name__ => "ErrorStyleMsgbox",btn_name => "ok",operation => 1}}. get("NOT_BIND_SERVER") -> #{code => "NOT_BIND_SERVER",desc => "没有绑定服务器",style => #{name__ => "ErrorStyleMsgbox",btn_name => "ok",operation => 1}}. get("SERVER_ACCESS_FAIL") -> #{code => "SERVER_ACCESS_FAIL",desc => "访问服务器失败",style => #{name__ => "ErrorStyleMsgbox",btn_name => "ok",operation => 1}}. get("SERVER_NOT_EXISTS") -> #{code => "SERVER_NOT_EXISTS",desc => "该服务器不存在",style => #{name__ => "ErrorStyleMsgbox",btn_name => "ok",operation => 1}}. get("SUIT_NOT_UNLOCK") -> #{code => "SUIT_NOT_UNLOCK",desc => "套装尚未解锁",style => #{name__ => "ErrorStyleTip"}}. get("SUIT_COMPONENT_NOT_UNLOCK") -> #{code => "SUIT_COMPONENT_NOT_UNLOCK",desc => "部件尚未解锁",style => #{name__ => "ErrorStyleTip"}}. get("SUIT_STATE_ERROR") -> #{code => "SUIT_STATE_ERROR",desc => "套装状态错误",style => #{name__ => "ErrorStyleTip"}}. get("SUIT_COMPONENT_STATE_ERROR") -> #{code => "SUIT_COMPONENT_STATE_ERROR",desc => "部件状态错误",style => #{name__ => "ErrorStyleTip"}}. get("SUIT_COMPONENT_NO_NEED_LEARN") -> #{code => "SUIT_COMPONENT_NO_NEED_LEARN",desc => "设计图纸对应的部件均已完成学习",style => #{name__ => "ErrorStyleTip"}}. <|start_filename|>Projects/GenerateDatas/convert_lua/ai.TbBlackboard/demo.lua<|end_filename|> return { name = "demo", desc = "demo hahaha", parent_name = "demo_parent", keys = { { name = "x1", desc = "x1 haha", is_static = false, type = 1, type_class_name = "", }, { name = "x2", desc = "x2 haha", is_static = false, type = 2, type_class_name = "", }, { name = "x3", desc = "x3 haha", is_static = false, type = 3, type_class_name = "", }, { name = "x4", desc = "x4 haha", is_static = false, type = 4, type_class_name = "", }, { name = "x5", desc = "x5 haha", is_static = false, type = 5, type_class_name = "", }, { name = "x6", desc = "x6 haha", is_static = false, type = 6, type_class_name = "", }, { name = "x7", desc = "x7 haha", is_static = false, type = 7, type_class_name = "", }, { name = "x8", desc = "x8 haha", is_static = false, type = 8, type_class_name = "", }, { name = "x9", desc = "x9 haha", is_static = false, type = 9, type_class_name = "ABC", }, { name = "x10", desc = "x10 haha", is_static = false, type = 10, type_class_name = "OBJECT", }, }, } <|start_filename|>Projects/java_json/src/gen/cfg/test/DemoDynamic.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.test; import com.google.gson.JsonElement; import com.google.gson.JsonObject; public abstract class DemoDynamic { public DemoDynamic(JsonObject __json__) { x1 = __json__.get("x1").getAsInt(); } public DemoDynamic(int x1 ) { this.x1 = x1; } public static DemoDynamic deserializeDemoDynamic(JsonObject __json__) { switch (__json__.get("__type__").getAsString()) { case "DemoD2": return new cfg.test.DemoD2(__json__); case "DemoE1": return new cfg.test.DemoE1(__json__); case "DemoD5": return new cfg.test.DemoD5(__json__); default: throw new bright.serialization.SerializationException(); } } public final int x1; public abstract int getTypeId(); public void resolve(java.util.HashMap<String, Object> _tables) { } @Override public String toString() { return "{ " + "x1:" + x1 + "," + "}"; } } <|start_filename|>Projects/GenerateDatas/convert_lua/role.TbRoleLevelExpAttr/68.lua<|end_filename|> return { level = 68, need_exp = 165000, clothes_attrs = { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, }, } <|start_filename|>Projects/Java_bin/src/main/gen/cfg/ai/BinaryOperator.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.ai; import bright.serialization.*; public final class BinaryOperator extends cfg.ai.KeyQueryOperator { public BinaryOperator(ByteBuf _buf) { super(_buf); oper = cfg.ai.EOperator.valueOf(_buf.readInt()); data = cfg.ai.KeyData.deserializeKeyData(_buf); } public BinaryOperator(cfg.ai.EOperator oper, cfg.ai.KeyData data ) { super(); this.oper = oper; this.data = data; } public final cfg.ai.EOperator oper; public final cfg.ai.KeyData data; public static final int __ID__ = -979891605; @Override public int getTypeId() { return __ID__; } @Override public void resolve(java.util.HashMap<String, Object> _tables) { super.resolve(_tables); if (data != null) {data.resolve(_tables);} } @Override public String toString() { return "{ " + "oper:" + oper + "," + "data:" + data + "," + "}"; } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_DetailPrototype_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_DetailPrototype_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { if (paramLen == 0) { { var result = new UnityEngine.DetailPrototype(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.DetailPrototype), result); } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.DetailPrototype), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.DetailPrototype>(false); var result = new UnityEngine.DetailPrototype(Arg0); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.DetailPrototype), result); } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.DetailPrototype constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Equals(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.DetailPrototype; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.Object>(false); var result = obj.Equals(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetHashCode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.DetailPrototype; { { var result = obj.GetHashCode(); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Validate(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.DetailPrototype; if (paramLen == 0) { { var result = obj.Validate(); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, true, true)) { var Arg0 = argHelper0.GetString(true); var result = obj.Validate(out Arg0); argHelper0.SetByRefValue(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to Validate"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_prototype(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.DetailPrototype; var result = obj.prototype; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_prototype(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.DetailPrototype; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.prototype = argHelper.Get<UnityEngine.GameObject>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_prototypeTexture(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.DetailPrototype; var result = obj.prototypeTexture; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_prototypeTexture(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.DetailPrototype; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.prototypeTexture = argHelper.Get<UnityEngine.Texture2D>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_minWidth(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.DetailPrototype; var result = obj.minWidth; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_minWidth(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.DetailPrototype; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.minWidth = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_maxWidth(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.DetailPrototype; var result = obj.maxWidth; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_maxWidth(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.DetailPrototype; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.maxWidth = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_minHeight(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.DetailPrototype; var result = obj.minHeight; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_minHeight(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.DetailPrototype; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.minHeight = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_maxHeight(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.DetailPrototype; var result = obj.maxHeight; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_maxHeight(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.DetailPrototype; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.maxHeight = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_noiseSpread(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.DetailPrototype; var result = obj.noiseSpread; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_noiseSpread(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.DetailPrototype; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.noiseSpread = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_holeEdgePadding(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.DetailPrototype; var result = obj.holeEdgePadding; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_holeEdgePadding(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.DetailPrototype; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.holeEdgePadding = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_healthyColor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.DetailPrototype; var result = obj.healthyColor; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_healthyColor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.DetailPrototype; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.healthyColor = argHelper.Get<UnityEngine.Color>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_dryColor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.DetailPrototype; var result = obj.dryColor; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_dryColor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.DetailPrototype; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.dryColor = argHelper.Get<UnityEngine.Color>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_renderMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.DetailPrototype; var result = obj.renderMode; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_renderMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.DetailPrototype; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.renderMode = (UnityEngine.DetailRenderMode)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_usePrototypeMesh(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.DetailPrototype; var result = obj.usePrototypeMesh; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_usePrototypeMesh(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.DetailPrototype; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.usePrototypeMesh = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "Equals", IsStatic = false}, M_Equals }, { new Puerts.MethodKey {Name = "GetHashCode", IsStatic = false}, M_GetHashCode }, { new Puerts.MethodKey {Name = "Validate", IsStatic = false}, M_Validate }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"prototype", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_prototype, Setter = S_prototype} }, {"prototypeTexture", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_prototypeTexture, Setter = S_prototypeTexture} }, {"minWidth", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_minWidth, Setter = S_minWidth} }, {"maxWidth", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_maxWidth, Setter = S_maxWidth} }, {"minHeight", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_minHeight, Setter = S_minHeight} }, {"maxHeight", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_maxHeight, Setter = S_maxHeight} }, {"noiseSpread", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_noiseSpread, Setter = S_noiseSpread} }, {"holeEdgePadding", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_holeEdgePadding, Setter = S_holeEdgePadding} }, {"healthyColor", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_healthyColor, Setter = S_healthyColor} }, {"dryColor", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_dryColor, Setter = S_dryColor} }, {"renderMode", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_renderMode, Setter = S_renderMode} }, {"usePrototypeMesh", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_usePrototypeMesh, Setter = S_usePrototypeMesh} }, } }; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_TextMesh_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_TextMesh_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.TextMesh(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.TextMesh), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_text(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextMesh; var result = obj.text; Puerts.PuertsDLL.ReturnString(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_text(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextMesh; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.text = argHelper.GetString(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_font(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextMesh; var result = obj.font; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_font(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextMesh; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.font = argHelper.Get<UnityEngine.Font>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_fontSize(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextMesh; var result = obj.fontSize; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_fontSize(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextMesh; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.fontSize = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_fontStyle(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextMesh; var result = obj.fontStyle; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_fontStyle(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextMesh; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.fontStyle = (UnityEngine.FontStyle)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_offsetZ(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextMesh; var result = obj.offsetZ; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_offsetZ(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextMesh; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.offsetZ = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_alignment(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextMesh; var result = obj.alignment; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_alignment(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextMesh; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.alignment = (UnityEngine.TextAlignment)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_anchor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextMesh; var result = obj.anchor; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_anchor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextMesh; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.anchor = (UnityEngine.TextAnchor)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_characterSize(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextMesh; var result = obj.characterSize; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_characterSize(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextMesh; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.characterSize = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_lineSpacing(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextMesh; var result = obj.lineSpacing; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_lineSpacing(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextMesh; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.lineSpacing = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_tabSize(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextMesh; var result = obj.tabSize; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_tabSize(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextMesh; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.tabSize = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_richText(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextMesh; var result = obj.richText; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_richText(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextMesh; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.richText = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_color(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextMesh; var result = obj.color; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_color(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextMesh; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.color = argHelper.Get<UnityEngine.Color>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"text", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_text, Setter = S_text} }, {"font", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_font, Setter = S_font} }, {"fontSize", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_fontSize, Setter = S_fontSize} }, {"fontStyle", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_fontStyle, Setter = S_fontStyle} }, {"offsetZ", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_offsetZ, Setter = S_offsetZ} }, {"alignment", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_alignment, Setter = S_alignment} }, {"anchor", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_anchor, Setter = S_anchor} }, {"characterSize", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_characterSize, Setter = S_characterSize} }, {"lineSpacing", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_lineSpacing, Setter = S_lineSpacing} }, {"tabSize", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_tabSize, Setter = S_tabSize} }, {"richText", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_richText, Setter = S_richText} }, {"color", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_color, Setter = S_color} }, } }; } } } <|start_filename|>Projects/GenerateDatas/convert_lua/role.TbRoleLevelExpAttr/67.lua<|end_filename|> return { level = 67, need_exp = 160000, clothes_attrs = { 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, }, } <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/blueprint/TbClazz.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.blueprint { public sealed partial class TbClazz { private readonly Dictionary<string, blueprint.Clazz> _dataMap; private readonly List<blueprint.Clazz> _dataList; public TbClazz(ByteBuf _buf) { _dataMap = new Dictionary<string, blueprint.Clazz>(); _dataList = new List<blueprint.Clazz>(); for(int n = _buf.ReadSize() ; n > 0 ; --n) { blueprint.Clazz _v; _v = blueprint.Clazz.DeserializeClazz(_buf); _dataList.Add(_v); _dataMap.Add(_v.Name, _v); } } public Dictionary<string, blueprint.Clazz> DataMap => _dataMap; public List<blueprint.Clazz> DataList => _dataList; public T GetOrDefaultAs<T>(string key) where T : blueprint.Clazz => _dataMap.TryGetValue(key, out var v) ? (T)v : null; public T GetAs<T>(string key) where T : blueprint.Clazz => (T)_dataMap[key]; public blueprint.Clazz GetOrDefault(string key) => _dataMap.TryGetValue(key, out var v) ? v : null; public blueprint.Clazz Get(string key) => _dataMap[key]; public blueprint.Clazz this[string key] => _dataMap[key]; public void Resolve(Dictionary<string, object> _tables) { foreach(var v in _dataList) { v.Resolve(_tables); } OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); } } <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/ai/Decorator.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.ai { public abstract partial class Decorator : ai.Node { public Decorator(ByteBuf _buf) : base(_buf) { FlowAbortMode = (ai.EFlowAbortMode)_buf.ReadInt(); } public Decorator(int id, string node_name, ai.EFlowAbortMode flow_abort_mode ) : base(id,node_name) { this.FlowAbortMode = flow_abort_mode; } public static Decorator DeserializeDecorator(ByteBuf _buf) { switch (_buf.ReadInt()) { case ai.UeLoop.ID: return new ai.UeLoop(_buf); case ai.UeCooldown.ID: return new ai.UeCooldown(_buf); case ai.UeTimeLimit.ID: return new ai.UeTimeLimit(_buf); case ai.UeBlackboard.ID: return new ai.UeBlackboard(_buf); case ai.UeForceSuccess.ID: return new ai.UeForceSuccess(_buf); case ai.IsAtLocation.ID: return new ai.IsAtLocation(_buf); case ai.DistanceLessThan.ID: return new ai.DistanceLessThan(_buf); default: throw new SerializationException(); } } public readonly ai.EFlowAbortMode FlowAbortMode; public override void Resolve(Dictionary<string, object> _tables) { base.Resolve(_tables); OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); public override string ToString() { return "{ " + "Id:" + Id + "," + "NodeName:" + NodeName + "," + "FlowAbortMode:" + FlowAbortMode + "," + "}"; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_HingeJoint_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_HingeJoint_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.HingeJoint(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.HingeJoint), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_motor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.HingeJoint; var result = obj.motor; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_motor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.HingeJoint; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.motor = argHelper.Get<UnityEngine.JointMotor>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_limits(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.HingeJoint; var result = obj.limits; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_limits(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.HingeJoint; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.limits = argHelper.Get<UnityEngine.JointLimits>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_spring(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.HingeJoint; var result = obj.spring; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_spring(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.HingeJoint; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.spring = argHelper.Get<UnityEngine.JointSpring>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_useMotor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.HingeJoint; var result = obj.useMotor; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_useMotor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.HingeJoint; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.useMotor = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_useLimits(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.HingeJoint; var result = obj.useLimits; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_useLimits(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.HingeJoint; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.useLimits = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_useSpring(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.HingeJoint; var result = obj.useSpring; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_useSpring(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.HingeJoint; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.useSpring = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_velocity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.HingeJoint; var result = obj.velocity; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_angle(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.HingeJoint; var result = obj.angle; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"motor", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_motor, Setter = S_motor} }, {"limits", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_limits, Setter = S_limits} }, {"spring", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_spring, Setter = S_spring} }, {"useMotor", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_useMotor, Setter = S_useMotor} }, {"useLimits", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_useLimits, Setter = S_useLimits} }, {"useSpring", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_useSpring, Setter = S_useSpring} }, {"velocity", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_velocity, Setter = null} }, {"angle", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_angle, Setter = null} }, } }; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_AnimatorTransitionInfo_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_AnimatorTransitionInfo_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.AnimatorTransitionInfo constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_IsName(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.AnimatorTransitionInfo)Puerts.Utils.GetSelf((int)data, self); { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetString(false); var result = obj.IsName(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_IsUserName(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.AnimatorTransitionInfo)Puerts.Utils.GetSelf((int)data, self); { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetString(false); var result = obj.IsUserName(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_fullPathHash(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.AnimatorTransitionInfo)Puerts.Utils.GetSelf((int)data, self); var result = obj.fullPathHash; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_nameHash(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.AnimatorTransitionInfo)Puerts.Utils.GetSelf((int)data, self); var result = obj.nameHash; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_userNameHash(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.AnimatorTransitionInfo)Puerts.Utils.GetSelf((int)data, self); var result = obj.userNameHash; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_durationUnit(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.AnimatorTransitionInfo)Puerts.Utils.GetSelf((int)data, self); var result = obj.durationUnit; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_duration(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.AnimatorTransitionInfo)Puerts.Utils.GetSelf((int)data, self); var result = obj.duration; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_normalizedTime(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.AnimatorTransitionInfo)Puerts.Utils.GetSelf((int)data, self); var result = obj.normalizedTime; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_anyState(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.AnimatorTransitionInfo)Puerts.Utils.GetSelf((int)data, self); var result = obj.anyState; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "IsName", IsStatic = false}, M_IsName }, { new Puerts.MethodKey {Name = "IsUserName", IsStatic = false}, M_IsUserName }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"fullPathHash", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_fullPathHash, Setter = null} }, {"nameHash", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_nameHash, Setter = null} }, {"userNameHash", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_userNameHash, Setter = null} }, {"durationUnit", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_durationUnit, Setter = null} }, {"duration", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_duration, Setter = null} }, {"normalizedTime", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_normalizedTime, Setter = null} }, {"anyState", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_anyState, Setter = null} }, } }; } } } <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/test/DemoD3.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.test { public abstract partial class DemoD3 : test.DemoDynamic { public DemoD3(ByteBuf _buf) : base(_buf) { X3 = _buf.ReadInt(); } public DemoD3(int x1, int x3 ) : base(x1) { this.X3 = x3; } public static DemoD3 DeserializeDemoD3(ByteBuf _buf) { switch (_buf.ReadInt()) { case test.DemoE1.ID: return new test.DemoE1(_buf); default: throw new SerializationException(); } } public readonly int X3; public override void Resolve(Dictionary<string, object> _tables) { base.Resolve(_tables); OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); public override string ToString() { return "{ " + "X1:" + X1 + "," + "X3:" + X3 + "," + "}"; } } } <|start_filename|>Projects/TypeScript_NodeJs_json/app.js<|end_filename|> "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const Types = require("./Gen/Types"); var fs = require('fs'); console.log('Hello world'); function loader(file) { let data = fs.readFileSync('config_data/' + file, 'utf8'); return JSON.parse(data); } //let tables = new cfg.Tables(loader); let tables = new Types.cfg.Tables(loader); console.log(tables); //# sourceMappingURL=app.js.map <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_TrailRenderer_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_TrailRenderer_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.TrailRenderer(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.TrailRenderer), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetPosition(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TrailRenderer; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3>(false); obj.SetPosition(Arg0,Arg1); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetPosition(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TrailRenderer; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); var result = obj.GetPosition(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Clear(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TrailRenderer; { { obj.Clear(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_BakeMesh(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TrailRenderer; if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh>(false); var Arg1 = argHelper1.GetBoolean(false); obj.BakeMesh(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Camera), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh>(false); var Arg1 = argHelper1.Get<UnityEngine.Camera>(false); obj.BakeMesh(Arg0,Arg1); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh>(false); obj.BakeMesh(Arg0); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Camera), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh>(false); var Arg1 = argHelper1.Get<UnityEngine.Camera>(false); var Arg2 = argHelper2.GetBoolean(false); obj.BakeMesh(Arg0,Arg1,Arg2); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to BakeMesh"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetPositions(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TrailRenderer; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3[]>(false); var result = obj.GetPositions(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(Unity.Collections.NativeArray<UnityEngine.Vector3>), false, false)) { var Arg0 = argHelper0.Get<Unity.Collections.NativeArray<UnityEngine.Vector3>>(false); var result = obj.GetPositions(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(Unity.Collections.NativeSlice<UnityEngine.Vector3>), false, false)) { var Arg0 = argHelper0.Get<Unity.Collections.NativeSlice<UnityEngine.Vector3>>(false); var result = obj.GetPositions(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetPositions"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetPositions(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TrailRenderer; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3[]>(false); obj.SetPositions(Arg0); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(Unity.Collections.NativeArray<UnityEngine.Vector3>), false, false)) { var Arg0 = argHelper0.Get<Unity.Collections.NativeArray<UnityEngine.Vector3>>(false); obj.SetPositions(Arg0); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(Unity.Collections.NativeSlice<UnityEngine.Vector3>), false, false)) { var Arg0 = argHelper0.Get<Unity.Collections.NativeSlice<UnityEngine.Vector3>>(false); obj.SetPositions(Arg0); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SetPositions"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_AddPosition(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TrailRenderer; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); obj.AddPosition(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_AddPositions(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TrailRenderer; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3[]>(false); obj.AddPositions(Arg0); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(Unity.Collections.NativeArray<UnityEngine.Vector3>), false, false)) { var Arg0 = argHelper0.Get<Unity.Collections.NativeArray<UnityEngine.Vector3>>(false); obj.AddPositions(Arg0); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(Unity.Collections.NativeSlice<UnityEngine.Vector3>), false, false)) { var Arg0 = argHelper0.Get<Unity.Collections.NativeSlice<UnityEngine.Vector3>>(false); obj.AddPositions(Arg0); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to AddPositions"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_time(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TrailRenderer; var result = obj.time; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_time(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TrailRenderer; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.time = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_startWidth(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TrailRenderer; var result = obj.startWidth; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_startWidth(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TrailRenderer; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.startWidth = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_endWidth(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TrailRenderer; var result = obj.endWidth; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_endWidth(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TrailRenderer; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.endWidth = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_widthMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TrailRenderer; var result = obj.widthMultiplier; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_widthMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TrailRenderer; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.widthMultiplier = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_autodestruct(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TrailRenderer; var result = obj.autodestruct; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_autodestruct(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TrailRenderer; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.autodestruct = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_emitting(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TrailRenderer; var result = obj.emitting; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_emitting(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TrailRenderer; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.emitting = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_numCornerVertices(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TrailRenderer; var result = obj.numCornerVertices; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_numCornerVertices(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TrailRenderer; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.numCornerVertices = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_numCapVertices(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TrailRenderer; var result = obj.numCapVertices; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_numCapVertices(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TrailRenderer; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.numCapVertices = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_minVertexDistance(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TrailRenderer; var result = obj.minVertexDistance; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_minVertexDistance(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TrailRenderer; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.minVertexDistance = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_startColor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TrailRenderer; var result = obj.startColor; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_startColor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TrailRenderer; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.startColor = argHelper.Get<UnityEngine.Color>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_endColor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TrailRenderer; var result = obj.endColor; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_endColor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TrailRenderer; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.endColor = argHelper.Get<UnityEngine.Color>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_positionCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TrailRenderer; var result = obj.positionCount; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_shadowBias(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TrailRenderer; var result = obj.shadowBias; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_shadowBias(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TrailRenderer; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.shadowBias = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_generateLightingData(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TrailRenderer; var result = obj.generateLightingData; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_generateLightingData(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TrailRenderer; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.generateLightingData = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_textureMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TrailRenderer; var result = obj.textureMode; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_textureMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TrailRenderer; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.textureMode = (UnityEngine.LineTextureMode)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_alignment(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TrailRenderer; var result = obj.alignment; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_alignment(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TrailRenderer; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.alignment = (UnityEngine.LineAlignment)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_widthCurve(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TrailRenderer; var result = obj.widthCurve; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_widthCurve(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TrailRenderer; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.widthCurve = argHelper.Get<UnityEngine.AnimationCurve>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_colorGradient(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TrailRenderer; var result = obj.colorGradient; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_colorGradient(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TrailRenderer; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.colorGradient = argHelper.Get<UnityEngine.Gradient>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "SetPosition", IsStatic = false}, M_SetPosition }, { new Puerts.MethodKey {Name = "GetPosition", IsStatic = false}, M_GetPosition }, { new Puerts.MethodKey {Name = "Clear", IsStatic = false}, M_Clear }, { new Puerts.MethodKey {Name = "BakeMesh", IsStatic = false}, M_BakeMesh }, { new Puerts.MethodKey {Name = "GetPositions", IsStatic = false}, M_GetPositions }, { new Puerts.MethodKey {Name = "SetPositions", IsStatic = false}, M_SetPositions }, { new Puerts.MethodKey {Name = "AddPosition", IsStatic = false}, M_AddPosition }, { new Puerts.MethodKey {Name = "AddPositions", IsStatic = false}, M_AddPositions }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"time", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_time, Setter = S_time} }, {"startWidth", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_startWidth, Setter = S_startWidth} }, {"endWidth", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_endWidth, Setter = S_endWidth} }, {"widthMultiplier", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_widthMultiplier, Setter = S_widthMultiplier} }, {"autodestruct", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_autodestruct, Setter = S_autodestruct} }, {"emitting", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_emitting, Setter = S_emitting} }, {"numCornerVertices", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_numCornerVertices, Setter = S_numCornerVertices} }, {"numCapVertices", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_numCapVertices, Setter = S_numCapVertices} }, {"minVertexDistance", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_minVertexDistance, Setter = S_minVertexDistance} }, {"startColor", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_startColor, Setter = S_startColor} }, {"endColor", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_endColor, Setter = S_endColor} }, {"positionCount", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_positionCount, Setter = null} }, {"shadowBias", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_shadowBias, Setter = S_shadowBias} }, {"generateLightingData", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_generateLightingData, Setter = S_generateLightingData} }, {"textureMode", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_textureMode, Setter = S_textureMode} }, {"alignment", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_alignment, Setter = S_alignment} }, {"widthCurve", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_widthCurve, Setter = S_widthCurve} }, {"colorGradient", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_colorGradient, Setter = S_colorGradient} }, } }; } } } <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/blueprint/Field.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.blueprint { public sealed partial class Field : Bright.Config.BeanBase { public Field(ByteBuf _buf) { Name = _buf.ReadString(); Type = _buf.ReadString(); Desc = _buf.ReadString(); } public Field(string name, string type, string desc ) { this.Name = name; this.Type = type; this.Desc = desc; } public static Field DeserializeField(ByteBuf _buf) { return new blueprint.Field(_buf); } public readonly string Name; public readonly string Type; public readonly string Desc; public const int ID = 1694158271; public override int GetTypeId() => ID; public void Resolve(Dictionary<string, object> _tables) { OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); public override string ToString() { return "{ " + "Name:" + Name + "," + "Type:" + Type + "," + "Desc:" + Desc + "," + "}"; } } } <|start_filename|>Projects/Java_bin/src/main/gen/cfg/ai/Node.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.ai; import bright.serialization.*; public abstract class Node { public Node(ByteBuf _buf) { id = _buf.readInt(); nodeName = _buf.readString(); } public Node(int id, String node_name ) { this.id = id; this.nodeName = node_name; } public static Node deserializeNode(ByteBuf _buf) { switch (_buf.readInt()) { case cfg.ai.UeSetDefaultFocus.__ID__: return new cfg.ai.UeSetDefaultFocus(_buf); case cfg.ai.ExecuteTimeStatistic.__ID__: return new cfg.ai.ExecuteTimeStatistic(_buf); case cfg.ai.ChooseTarget.__ID__: return new cfg.ai.ChooseTarget(_buf); case cfg.ai.KeepFaceTarget.__ID__: return new cfg.ai.KeepFaceTarget(_buf); case cfg.ai.GetOwnerPlayer.__ID__: return new cfg.ai.GetOwnerPlayer(_buf); case cfg.ai.UpdateDailyBehaviorProps.__ID__: return new cfg.ai.UpdateDailyBehaviorProps(_buf); case cfg.ai.UeLoop.__ID__: return new cfg.ai.UeLoop(_buf); case cfg.ai.UeCooldown.__ID__: return new cfg.ai.UeCooldown(_buf); case cfg.ai.UeTimeLimit.__ID__: return new cfg.ai.UeTimeLimit(_buf); case cfg.ai.UeBlackboard.__ID__: return new cfg.ai.UeBlackboard(_buf); case cfg.ai.UeForceSuccess.__ID__: return new cfg.ai.UeForceSuccess(_buf); case cfg.ai.IsAtLocation.__ID__: return new cfg.ai.IsAtLocation(_buf); case cfg.ai.DistanceLessThan.__ID__: return new cfg.ai.DistanceLessThan(_buf); case cfg.ai.Sequence.__ID__: return new cfg.ai.Sequence(_buf); case cfg.ai.Selector.__ID__: return new cfg.ai.Selector(_buf); case cfg.ai.SimpleParallel.__ID__: return new cfg.ai.SimpleParallel(_buf); case cfg.ai.UeWait.__ID__: return new cfg.ai.UeWait(_buf); case cfg.ai.UeWaitBlackboardTime.__ID__: return new cfg.ai.UeWaitBlackboardTime(_buf); case cfg.ai.MoveToTarget.__ID__: return new cfg.ai.MoveToTarget(_buf); case cfg.ai.ChooseSkill.__ID__: return new cfg.ai.ChooseSkill(_buf); case cfg.ai.MoveToRandomLocation.__ID__: return new cfg.ai.MoveToRandomLocation(_buf); case cfg.ai.MoveToLocation.__ID__: return new cfg.ai.MoveToLocation(_buf); case cfg.ai.DebugPrint.__ID__: return new cfg.ai.DebugPrint(_buf); default: throw new SerializationException(); } } public final int id; public final String nodeName; public abstract int getTypeId(); public void resolve(java.util.HashMap<String, Object> _tables) { } @Override public String toString() { return "{ " + "id:" + id + "," + "nodeName:" + nodeName + "," + "}"; } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_ArticulationReducedSpace_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_ArticulationReducedSpace_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetFloat(false); var result = new UnityEngine.ArticulationReducedSpace(Arg0); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.ArticulationReducedSpace), result); } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.GetFloat(false); var result = new UnityEngine.ArticulationReducedSpace(Arg0,Arg1); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.ArticulationReducedSpace), result); } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.GetFloat(false); var result = new UnityEngine.ArticulationReducedSpace(Arg0,Arg1,Arg2); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.ArticulationReducedSpace), result); } } if (paramLen == 0) { { var result = new UnityEngine.ArticulationReducedSpace(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.ArticulationReducedSpace), result); } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.ArticulationReducedSpace constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_dofCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ArticulationReducedSpace)Puerts.Utils.GetSelf((int)data, self); var result = obj.dofCount; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_dofCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ArticulationReducedSpace)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.dofCount = argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void GetItem(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ArticulationReducedSpace)Puerts.Utils.GetSelf((int)data, self); var keyHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (keyHelper.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var key = keyHelper.GetInt32(false); var result = obj[key]; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void SetItem(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ArticulationReducedSpace)Puerts.Utils.GetSelf((int)data, self); var keyHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var valueHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (keyHelper.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var key = keyHelper.GetInt32(false); obj[key] = valueHelper.GetFloat(false); return; } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "get_Item", IsStatic = false}, GetItem }, { new Puerts.MethodKey {Name = "set_Item", IsStatic = false}, SetItem}, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"dofCount", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_dofCount, Setter = S_dofCount} }, } }; } } } <|start_filename|>Projects/Java_bin/src/main/gen/cfg/test/MultiRowRecord.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.test; import bright.serialization.*; public final class MultiRowRecord { public MultiRowRecord(ByteBuf _buf) { id = _buf.readInt(); name = _buf.readString(); {int n = Math.min(_buf.readSize(), _buf.size());oneRows = new java.util.ArrayList<cfg.test.MultiRowType1>(n);for(int i = 0 ; i < n ; i++) { cfg.test.MultiRowType1 _e; _e = new cfg.test.MultiRowType1(_buf); oneRows.add(_e);}} {int n = Math.min(_buf.readSize(), _buf.size());multiRows1 = new java.util.ArrayList<cfg.test.MultiRowType1>(n);for(int i = 0 ; i < n ; i++) { cfg.test.MultiRowType1 _e; _e = new cfg.test.MultiRowType1(_buf); multiRows1.add(_e);}} {int n = Math.min(_buf.readSize(), _buf.size());multiRows2 = new cfg.test.MultiRowType1[n];for(int i = 0 ; i < n ; i++) { cfg.test.MultiRowType1 _e;_e = new cfg.test.MultiRowType1(_buf); multiRows2[i] = _e;}} {int n = Math.min(_buf.readSize(), _buf.size());multiRows4 = new java.util.HashMap<Integer, cfg.test.MultiRowType2>(n * 3 / 2);for(int i = 0 ; i < n ; i++) { Integer _k; _k = _buf.readInt(); cfg.test.MultiRowType2 _v; _v = new cfg.test.MultiRowType2(_buf); multiRows4.put(_k, _v);}} {int n = Math.min(_buf.readSize(), _buf.size());multiRows5 = new java.util.ArrayList<cfg.test.MultiRowType3>(n);for(int i = 0 ; i < n ; i++) { cfg.test.MultiRowType3 _e; _e = new cfg.test.MultiRowType3(_buf); multiRows5.add(_e);}} {int n = Math.min(_buf.readSize(), _buf.size());multiRows6 = new java.util.HashMap<Integer, cfg.test.MultiRowType2>(n * 3 / 2);for(int i = 0 ; i < n ; i++) { Integer _k; _k = _buf.readInt(); cfg.test.MultiRowType2 _v; _v = new cfg.test.MultiRowType2(_buf); multiRows6.put(_k, _v);}} {int n = Math.min(_buf.readSize(), _buf.size());multiRows7 = new java.util.HashMap<Integer, Integer>(n * 3 / 2);for(int i = 0 ; i < n ; i++) { Integer _k; _k = _buf.readInt(); Integer _v; _v = _buf.readInt(); multiRows7.put(_k, _v);}} } public MultiRowRecord(int id, String name, java.util.ArrayList<cfg.test.MultiRowType1> one_rows, java.util.ArrayList<cfg.test.MultiRowType1> multi_rows1, cfg.test.MultiRowType1[] multi_rows2, java.util.HashMap<Integer, cfg.test.MultiRowType2> multi_rows4, java.util.ArrayList<cfg.test.MultiRowType3> multi_rows5, java.util.HashMap<Integer, cfg.test.MultiRowType2> multi_rows6, java.util.HashMap<Integer, Integer> multi_rows7 ) { this.id = id; this.name = name; this.oneRows = one_rows; this.multiRows1 = multi_rows1; this.multiRows2 = multi_rows2; this.multiRows4 = multi_rows4; this.multiRows5 = multi_rows5; this.multiRows6 = multi_rows6; this.multiRows7 = multi_rows7; } public final int id; public final String name; public final java.util.ArrayList<cfg.test.MultiRowType1> oneRows; public final java.util.ArrayList<cfg.test.MultiRowType1> multiRows1; public final cfg.test.MultiRowType1[] multiRows2; public final java.util.HashMap<Integer, cfg.test.MultiRowType2> multiRows4; public final java.util.ArrayList<cfg.test.MultiRowType3> multiRows5; public final java.util.HashMap<Integer, cfg.test.MultiRowType2> multiRows6; public final java.util.HashMap<Integer, Integer> multiRows7; public void resolve(java.util.HashMap<String, Object> _tables) { for(cfg.test.MultiRowType1 _e : oneRows) { if (_e != null) _e.resolve(_tables); } for(cfg.test.MultiRowType1 _e : multiRows1) { if (_e != null) _e.resolve(_tables); } for(cfg.test.MultiRowType1 _e : multiRows2) { if (_e != null) _e.resolve(_tables); } for(cfg.test.MultiRowType2 _e : multiRows4.values()) { if (_e != null) _e.resolve(_tables); } for(cfg.test.MultiRowType3 _e : multiRows5) { if (_e != null) _e.resolve(_tables); } for(cfg.test.MultiRowType2 _e : multiRows6.values()) { if (_e != null) _e.resolve(_tables); } } @Override public String toString() { return "{ " + "id:" + id + "," + "name:" + name + "," + "oneRows:" + oneRows + "," + "multiRows1:" + multiRows1 + "," + "multiRows2:" + multiRows2 + "," + "multiRows4:" + multiRows4 + "," + "multiRows5:" + multiRows5 + "," + "multiRows6:" + multiRows6 + "," + "multiRows7:" + multiRows7 + "," + "}"; } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_JointMotor_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_JointMotor_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.JointMotor constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_targetVelocity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.JointMotor)Puerts.Utils.GetSelf((int)data, self); var result = obj.targetVelocity; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_targetVelocity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.JointMotor)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.targetVelocity = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_force(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.JointMotor)Puerts.Utils.GetSelf((int)data, self); var result = obj.force; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_force(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.JointMotor)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.force = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_freeSpin(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.JointMotor)Puerts.Utils.GetSelf((int)data, self); var result = obj.freeSpin; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_freeSpin(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.JointMotor)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.freeSpin = argHelper.GetBoolean(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"targetVelocity", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_targetVelocity, Setter = S_targetVelocity} }, {"force", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_force, Setter = S_force} }, {"freeSpin", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_freeSpin, Setter = S_freeSpin} }, } }; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_UI_Selectable_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_UI_Selectable_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.UI.Selectable constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_AllSelectablesNoAlloc(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.UI.Selectable[]>(false); var result = UnityEngine.UI.Selectable.AllSelectablesNoAlloc(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_IsInteractable(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Selectable; { { var result = obj.IsInteractable(); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_FindSelectable(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Selectable; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var result = obj.FindSelectable(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_FindSelectableOnLeft(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Selectable; { { var result = obj.FindSelectableOnLeft(); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_FindSelectableOnRight(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Selectable; { { var result = obj.FindSelectableOnRight(); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_FindSelectableOnUp(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Selectable; { { var result = obj.FindSelectableOnUp(); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_FindSelectableOnDown(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Selectable; { { var result = obj.FindSelectableOnDown(); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_OnMove(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Selectable; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.EventSystems.AxisEventData>(false); obj.OnMove(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_OnPointerDown(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Selectable; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.EventSystems.PointerEventData>(false); obj.OnPointerDown(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_OnPointerUp(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Selectable; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.EventSystems.PointerEventData>(false); obj.OnPointerUp(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_OnPointerEnter(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Selectable; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.EventSystems.PointerEventData>(false); obj.OnPointerEnter(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_OnPointerExit(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Selectable; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.EventSystems.PointerEventData>(false); obj.OnPointerExit(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_OnSelect(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Selectable; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.EventSystems.BaseEventData>(false); obj.OnSelect(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_OnDeselect(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Selectable; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.EventSystems.BaseEventData>(false); obj.OnDeselect(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Select(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Selectable; { { obj.Select(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_allSelectablesArray(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.UI.Selectable.allSelectablesArray; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_allSelectableCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.UI.Selectable.allSelectableCount; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_navigation(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Selectable; var result = obj.navigation; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_navigation(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Selectable; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.navigation = argHelper.Get<UnityEngine.UI.Navigation>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_transition(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Selectable; var result = obj.transition; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_transition(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Selectable; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.transition = (UnityEngine.UI.Selectable.Transition)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_colors(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Selectable; var result = obj.colors; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_colors(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Selectable; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.colors = argHelper.Get<UnityEngine.UI.ColorBlock>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_spriteState(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Selectable; var result = obj.spriteState; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_spriteState(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Selectable; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.spriteState = argHelper.Get<UnityEngine.UI.SpriteState>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_animationTriggers(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Selectable; var result = obj.animationTriggers; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_animationTriggers(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Selectable; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.animationTriggers = argHelper.Get<UnityEngine.UI.AnimationTriggers>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_targetGraphic(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Selectable; var result = obj.targetGraphic; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_targetGraphic(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Selectable; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.targetGraphic = argHelper.Get<UnityEngine.UI.Graphic>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_interactable(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Selectable; var result = obj.interactable; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_interactable(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Selectable; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.interactable = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_image(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Selectable; var result = obj.image; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_image(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Selectable; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.image = argHelper.Get<UnityEngine.UI.Image>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_animator(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Selectable; var result = obj.animator; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "AllSelectablesNoAlloc", IsStatic = true}, F_AllSelectablesNoAlloc }, { new Puerts.MethodKey {Name = "IsInteractable", IsStatic = false}, M_IsInteractable }, { new Puerts.MethodKey {Name = "FindSelectable", IsStatic = false}, M_FindSelectable }, { new Puerts.MethodKey {Name = "FindSelectableOnLeft", IsStatic = false}, M_FindSelectableOnLeft }, { new Puerts.MethodKey {Name = "FindSelectableOnRight", IsStatic = false}, M_FindSelectableOnRight }, { new Puerts.MethodKey {Name = "FindSelectableOnUp", IsStatic = false}, M_FindSelectableOnUp }, { new Puerts.MethodKey {Name = "FindSelectableOnDown", IsStatic = false}, M_FindSelectableOnDown }, { new Puerts.MethodKey {Name = "OnMove", IsStatic = false}, M_OnMove }, { new Puerts.MethodKey {Name = "OnPointerDown", IsStatic = false}, M_OnPointerDown }, { new Puerts.MethodKey {Name = "OnPointerUp", IsStatic = false}, M_OnPointerUp }, { new Puerts.MethodKey {Name = "OnPointerEnter", IsStatic = false}, M_OnPointerEnter }, { new Puerts.MethodKey {Name = "OnPointerExit", IsStatic = false}, M_OnPointerExit }, { new Puerts.MethodKey {Name = "OnSelect", IsStatic = false}, M_OnSelect }, { new Puerts.MethodKey {Name = "OnDeselect", IsStatic = false}, M_OnDeselect }, { new Puerts.MethodKey {Name = "Select", IsStatic = false}, M_Select }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"allSelectablesArray", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_allSelectablesArray, Setter = null} }, {"allSelectableCount", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_allSelectableCount, Setter = null} }, {"navigation", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_navigation, Setter = S_navigation} }, {"transition", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_transition, Setter = S_transition} }, {"colors", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_colors, Setter = S_colors} }, {"spriteState", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_spriteState, Setter = S_spriteState} }, {"animationTriggers", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_animationTriggers, Setter = S_animationTriggers} }, {"targetGraphic", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_targetGraphic, Setter = S_targetGraphic} }, {"interactable", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_interactable, Setter = S_interactable} }, {"image", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_image, Setter = S_image} }, {"animator", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_animator, Setter = null} }, } }; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_CullingGroupEvent_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_CullingGroupEvent_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.CullingGroupEvent constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_index(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.CullingGroupEvent)Puerts.Utils.GetSelf((int)data, self); var result = obj.index; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_isVisible(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.CullingGroupEvent)Puerts.Utils.GetSelf((int)data, self); var result = obj.isVisible; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_wasVisible(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.CullingGroupEvent)Puerts.Utils.GetSelf((int)data, self); var result = obj.wasVisible; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_hasBecomeVisible(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.CullingGroupEvent)Puerts.Utils.GetSelf((int)data, self); var result = obj.hasBecomeVisible; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_hasBecomeInvisible(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.CullingGroupEvent)Puerts.Utils.GetSelf((int)data, self); var result = obj.hasBecomeInvisible; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_currentDistance(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.CullingGroupEvent)Puerts.Utils.GetSelf((int)data, self); var result = obj.currentDistance; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_previousDistance(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.CullingGroupEvent)Puerts.Utils.GetSelf((int)data, self); var result = obj.previousDistance; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"index", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_index, Setter = null} }, {"isVisible", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_isVisible, Setter = null} }, {"wasVisible", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_wasVisible, Setter = null} }, {"hasBecomeVisible", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_hasBecomeVisible, Setter = null} }, {"hasBecomeInvisible", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_hasBecomeInvisible, Setter = null} }, {"currentDistance", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_currentDistance, Setter = null} }, {"previousDistance", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_previousDistance, Setter = null} }, } }; } } } <|start_filename|>Projects/DataTemplates/template_json2/ai_tbbehaviortree.json<|end_filename|> { "10002": { "id" : 10002, "name" : "random move", "desc" : "demo behaviour tree haha", "blackboard_id" : "demo", "root" : { "_name":"Sequence","id":1,"node_name":"test","decorators":[{ "_name":"UeLoop","id":3,"node_name":"","flow_abort_mode":2,"num_loops":0,"infinite_loop":true,"infinite_loop_timeout_time":-1}],"services":[],"children":[{ "_name":"UeWait","id":30,"node_name":"","decorators":[],"services":[],"ignore_restart_self":false,"wait_time":1,"random_deviation":0.5},{ "_name":"MoveToRandomLocation","id":75,"node_name":"","decorators":[],"services":[],"ignore_restart_self":false,"origin_position_key":"x5","radius":30}]} } } <|start_filename|>Projects/GenerateDatas/convert_lua/mail.TbSystemMail/13.lua<|end_filename|> return { id = 13, title = "测试3", sender = "系统", content = "测试内容3", award = { 1, }, } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_UI_GridLayoutGroup_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_UI_GridLayoutGroup_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.UI.GridLayoutGroup constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_CalculateLayoutInputHorizontal(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.GridLayoutGroup; { { obj.CalculateLayoutInputHorizontal(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_CalculateLayoutInputVertical(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.GridLayoutGroup; { { obj.CalculateLayoutInputVertical(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetLayoutHorizontal(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.GridLayoutGroup; { { obj.SetLayoutHorizontal(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetLayoutVertical(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.GridLayoutGroup; { { obj.SetLayoutVertical(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_startCorner(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.GridLayoutGroup; var result = obj.startCorner; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_startCorner(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.GridLayoutGroup; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.startCorner = (UnityEngine.UI.GridLayoutGroup.Corner)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_startAxis(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.GridLayoutGroup; var result = obj.startAxis; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_startAxis(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.GridLayoutGroup; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.startAxis = (UnityEngine.UI.GridLayoutGroup.Axis)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_cellSize(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.GridLayoutGroup; var result = obj.cellSize; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_cellSize(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.GridLayoutGroup; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.cellSize = argHelper.Get<UnityEngine.Vector2>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_spacing(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.GridLayoutGroup; var result = obj.spacing; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_spacing(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.GridLayoutGroup; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.spacing = argHelper.Get<UnityEngine.Vector2>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_constraint(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.GridLayoutGroup; var result = obj.constraint; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_constraint(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.GridLayoutGroup; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.constraint = (UnityEngine.UI.GridLayoutGroup.Constraint)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_constraintCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.GridLayoutGroup; var result = obj.constraintCount; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_constraintCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.GridLayoutGroup; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.constraintCount = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "CalculateLayoutInputHorizontal", IsStatic = false}, M_CalculateLayoutInputHorizontal }, { new Puerts.MethodKey {Name = "CalculateLayoutInputVertical", IsStatic = false}, M_CalculateLayoutInputVertical }, { new Puerts.MethodKey {Name = "SetLayoutHorizontal", IsStatic = false}, M_SetLayoutHorizontal }, { new Puerts.MethodKey {Name = "SetLayoutVertical", IsStatic = false}, M_SetLayoutVertical }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"startCorner", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_startCorner, Setter = S_startCorner} }, {"startAxis", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_startAxis, Setter = S_startAxis} }, {"cellSize", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_cellSize, Setter = S_cellSize} }, {"spacing", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_spacing, Setter = S_spacing} }, {"constraint", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_constraint, Setter = S_constraint} }, {"constraintCount", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_constraintCount, Setter = S_constraintCount} }, } }; } } } <|start_filename|>Projects/GenerateDatas/convert_lua/error.TbCodeInfo/302.lua<|end_filename|> return { code = 302, key = "LEVEL_TOO_HIGH", } <|start_filename|>Projects/java_json/src/gen/cfg/ai/BlackboardKey.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.ai; import com.google.gson.JsonElement; import com.google.gson.JsonObject; public final class BlackboardKey { public BlackboardKey(JsonObject __json__) { name = __json__.get("name").getAsString(); desc = __json__.get("desc").getAsString(); isStatic = __json__.get("is_static").getAsBoolean(); type = cfg.ai.EKeyType.valueOf(__json__.get("type").getAsInt()); typeClassName = __json__.get("type_class_name").getAsString(); } public BlackboardKey(String name, String desc, boolean is_static, cfg.ai.EKeyType type, String type_class_name ) { this.name = name; this.desc = desc; this.isStatic = is_static; this.type = type; this.typeClassName = type_class_name; } public static BlackboardKey deserializeBlackboardKey(JsonObject __json__) { return new BlackboardKey(__json__); } public final String name; public final String desc; public final boolean isStatic; public final cfg.ai.EKeyType type; public final String typeClassName; public void resolve(java.util.HashMap<String, Object> _tables) { } @Override public String toString() { return "{ " + "name:" + name + "," + "desc:" + desc + "," + "isStatic:" + isStatic + "," + "type:" + type + "," + "typeClassName:" + typeClassName + "," + "}"; } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_HumanDescription_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_HumanDescription_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.HumanDescription constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_upperArmTwist(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.HumanDescription)Puerts.Utils.GetSelf((int)data, self); var result = obj.upperArmTwist; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_upperArmTwist(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.HumanDescription)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.upperArmTwist = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_lowerArmTwist(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.HumanDescription)Puerts.Utils.GetSelf((int)data, self); var result = obj.lowerArmTwist; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_lowerArmTwist(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.HumanDescription)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.lowerArmTwist = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_upperLegTwist(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.HumanDescription)Puerts.Utils.GetSelf((int)data, self); var result = obj.upperLegTwist; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_upperLegTwist(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.HumanDescription)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.upperLegTwist = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_lowerLegTwist(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.HumanDescription)Puerts.Utils.GetSelf((int)data, self); var result = obj.lowerLegTwist; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_lowerLegTwist(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.HumanDescription)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.lowerLegTwist = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_armStretch(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.HumanDescription)Puerts.Utils.GetSelf((int)data, self); var result = obj.armStretch; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_armStretch(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.HumanDescription)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.armStretch = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_legStretch(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.HumanDescription)Puerts.Utils.GetSelf((int)data, self); var result = obj.legStretch; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_legStretch(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.HumanDescription)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.legStretch = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_feetSpacing(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.HumanDescription)Puerts.Utils.GetSelf((int)data, self); var result = obj.feetSpacing; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_feetSpacing(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.HumanDescription)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.feetSpacing = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_hasTranslationDoF(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.HumanDescription)Puerts.Utils.GetSelf((int)data, self); var result = obj.hasTranslationDoF; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_hasTranslationDoF(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.HumanDescription)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.hasTranslationDoF = argHelper.GetBoolean(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_human(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.HumanDescription)Puerts.Utils.GetSelf((int)data, self); var result = obj.human; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_human(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.HumanDescription)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.human = argHelper.Get<UnityEngine.HumanBone[]>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_skeleton(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.HumanDescription)Puerts.Utils.GetSelf((int)data, self); var result = obj.skeleton; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_skeleton(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.HumanDescription)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.skeleton = argHelper.Get<UnityEngine.SkeletonBone[]>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"upperArmTwist", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_upperArmTwist, Setter = S_upperArmTwist} }, {"lowerArmTwist", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_lowerArmTwist, Setter = S_lowerArmTwist} }, {"upperLegTwist", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_upperLegTwist, Setter = S_upperLegTwist} }, {"lowerLegTwist", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_lowerLegTwist, Setter = S_lowerLegTwist} }, {"armStretch", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_armStretch, Setter = S_armStretch} }, {"legStretch", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_legStretch, Setter = S_legStretch} }, {"feetSpacing", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_feetSpacing, Setter = S_feetSpacing} }, {"hasTranslationDoF", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_hasTranslationDoF, Setter = S_hasTranslationDoF} }, {"human", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_human, Setter = S_human} }, {"skeleton", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_skeleton, Setter = S_skeleton} }, } }; } } } <|start_filename|>Projects/DataTemplates/template_erlang/test_tbtestindex.erl<|end_filename|> %% test.TbTestIndex get(1) -> #{id => 1,eles => [#{x1 => 1},#{x1 => 2},#{x1 => 3},#{x1 => 4},#{x1 => 5}]}. get(2) -> #{id => 2,eles => [#{x1 => 1},#{x1 => 2},#{x1 => 3},#{x1 => 4},#{x1 => 5}]}. get(3) -> #{id => 3,eles => [#{x1 => 1},#{x1 => 2},#{x1 => 3},#{x1 => 4},#{x1 => 5}]}. get(4) -> #{id => 4,eles => [#{x1 => 1},#{x1 => 2},#{x1 => 3},#{x1 => 4},#{x1 => 5}]}. <|start_filename|>Projects/GenerateDatas/convert_lua/role.TbRoleLevelExpAttr/96.lua<|end_filename|> return { level = 96, need_exp = 305000, clothes_attrs = { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, }, } <|start_filename|>Projects/Go_json/gen/src/cfg/item.Item.go<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg import "errors" type ItemItem struct { Id int32 Name string MajorType int32 MinorType int32 MaxPileNum int32 Quality int32 Icon string IconBackgroud string IconMask string Desc string ShowOrder int32 Quantifier string ShowInBag bool MinShowLevel int32 BatchUsable bool ProgressTimeWhenUse float32 ShowHintWhenUse bool Droppable bool Price *int32 UseType int32 LevelUpId *int32 } const TypeId_ItemItem = 2107285806 func (*ItemItem) GetTypeId() int32 { return 2107285806 } func (_v *ItemItem)Deserialize(_buf map[string]interface{}) (err error) { { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["id"].(float64); !_ok_ { err = errors.New("id error"); return }; _v.Id = int32(_tempNum_) } { var _ok_ bool; if _v.Name, _ok_ = _buf["name"].(string); !_ok_ { err = errors.New("name error"); return } } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["major_type"].(float64); !_ok_ { err = errors.New("major_type error"); return }; _v.MajorType = int32(_tempNum_) } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["minor_type"].(float64); !_ok_ { err = errors.New("minor_type error"); return }; _v.MinorType = int32(_tempNum_) } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["max_pile_num"].(float64); !_ok_ { err = errors.New("max_pile_num error"); return }; _v.MaxPileNum = int32(_tempNum_) } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["quality"].(float64); !_ok_ { err = errors.New("quality error"); return }; _v.Quality = int32(_tempNum_) } { var _ok_ bool; if _v.Icon, _ok_ = _buf["icon"].(string); !_ok_ { err = errors.New("icon error"); return } } { var _ok_ bool; if _v.IconBackgroud, _ok_ = _buf["icon_backgroud"].(string); !_ok_ { err = errors.New("icon_backgroud error"); return } } { var _ok_ bool; if _v.IconMask, _ok_ = _buf["icon_mask"].(string); !_ok_ { err = errors.New("icon_mask error"); return } } { var _ok_ bool; if _v.Desc, _ok_ = _buf["desc"].(string); !_ok_ { err = errors.New("desc error"); return } } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["show_order"].(float64); !_ok_ { err = errors.New("show_order error"); return }; _v.ShowOrder = int32(_tempNum_) } { var _ok_ bool; if _v.Quantifier, _ok_ = _buf["quantifier"].(string); !_ok_ { err = errors.New("quantifier error"); return } } { var _ok_ bool; if _v.ShowInBag, _ok_ = _buf["show_in_bag"].(bool); !_ok_ { err = errors.New("show_in_bag error"); return } } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["min_show_level"].(float64); !_ok_ { err = errors.New("min_show_level error"); return }; _v.MinShowLevel = int32(_tempNum_) } { var _ok_ bool; if _v.BatchUsable, _ok_ = _buf["batch_usable"].(bool); !_ok_ { err = errors.New("batch_usable error"); return } } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["progress_time_when_use"].(float64); !_ok_ { err = errors.New("progress_time_when_use error"); return }; _v.ProgressTimeWhenUse = float32(_tempNum_) } { var _ok_ bool; if _v.ShowHintWhenUse, _ok_ = _buf["show_hint_when_use"].(bool); !_ok_ { err = errors.New("show_hint_when_use error"); return } } { var _ok_ bool; if _v.Droppable, _ok_ = _buf["droppable"].(bool); !_ok_ { err = errors.New("droppable error"); return } } { var _ok_ bool; var __json_price__ interface{}; if __json_price__, _ok_ = _buf["price"]; !_ok_ || __json_price__ == nil { return } else { var __x__ int32; { var _ok_ bool; var _x_ float64; if _x_, _ok_ = __json_price__.(float64); !_ok_ { err = errors.New("__x__ error"); return }; __x__ = int32(_x_) }; _v.Price = &__x__ }} { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["use_type"].(float64); !_ok_ { err = errors.New("use_type error"); return }; _v.UseType = int32(_tempNum_) } { var _ok_ bool; var __json_level_up_id__ interface{}; if __json_level_up_id__, _ok_ = _buf["level_up_id"]; !_ok_ || __json_level_up_id__ == nil { return } else { var __x__ int32; { var _ok_ bool; var _x_ float64; if _x_, _ok_ = __json_level_up_id__.(float64); !_ok_ { err = errors.New("__x__ error"); return }; __x__ = int32(_x_) }; _v.LevelUpId = &__x__ }} return } func DeserializeItemItem(_buf map[string]interface{}) (*ItemItem, error) { v := &ItemItem{} if err := v.Deserialize(_buf); err == nil { return v, nil } else { return nil, err } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_PlatformEffector2D_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_PlatformEffector2D_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.PlatformEffector2D(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.PlatformEffector2D), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_useOneWay(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.PlatformEffector2D; var result = obj.useOneWay; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_useOneWay(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.PlatformEffector2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.useOneWay = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_useOneWayGrouping(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.PlatformEffector2D; var result = obj.useOneWayGrouping; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_useOneWayGrouping(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.PlatformEffector2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.useOneWayGrouping = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_useSideFriction(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.PlatformEffector2D; var result = obj.useSideFriction; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_useSideFriction(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.PlatformEffector2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.useSideFriction = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_useSideBounce(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.PlatformEffector2D; var result = obj.useSideBounce; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_useSideBounce(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.PlatformEffector2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.useSideBounce = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_surfaceArc(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.PlatformEffector2D; var result = obj.surfaceArc; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_surfaceArc(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.PlatformEffector2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.surfaceArc = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_sideArc(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.PlatformEffector2D; var result = obj.sideArc; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_sideArc(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.PlatformEffector2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.sideArc = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_rotationalOffset(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.PlatformEffector2D; var result = obj.rotationalOffset; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_rotationalOffset(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.PlatformEffector2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.rotationalOffset = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"useOneWay", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_useOneWay, Setter = S_useOneWay} }, {"useOneWayGrouping", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_useOneWayGrouping, Setter = S_useOneWayGrouping} }, {"useSideFriction", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_useSideFriction, Setter = S_useSideFriction} }, {"useSideBounce", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_useSideBounce, Setter = S_useSideBounce} }, {"surfaceArc", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_surfaceArc, Setter = S_surfaceArc} }, {"sideArc", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_sideArc, Setter = S_sideArc} }, {"rotationalOffset", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_rotationalOffset, Setter = S_rotationalOffset} }, } }; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_ParticleSystem_CustomDataModule_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_ParticleSystem_CustomDataModule_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.ParticleSystem.CustomDataModule constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.CustomDataModule)Puerts.Utils.GetSelf((int)data, self); { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = (UnityEngine.ParticleSystemCustomData)argHelper0.GetInt32(false); var Arg1 = (UnityEngine.ParticleSystemCustomDataMode)argHelper1.GetInt32(false); obj.SetMode(Arg0,Arg1); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.CustomDataModule)Puerts.Utils.GetSelf((int)data, self); { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = (UnityEngine.ParticleSystemCustomData)argHelper0.GetInt32(false); var result = obj.GetMode(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetVectorComponentCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.CustomDataModule)Puerts.Utils.GetSelf((int)data, self); { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = (UnityEngine.ParticleSystemCustomData)argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); obj.SetVectorComponentCount(Arg0,Arg1); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetVectorComponentCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.CustomDataModule)Puerts.Utils.GetSelf((int)data, self); { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = (UnityEngine.ParticleSystemCustomData)argHelper0.GetInt32(false); var result = obj.GetVectorComponentCount(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetVector(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.CustomDataModule)Puerts.Utils.GetSelf((int)data, self); { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = (UnityEngine.ParticleSystemCustomData)argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.Get<UnityEngine.ParticleSystem.MinMaxCurve>(false); obj.SetVector(Arg0,Arg1,Arg2); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetVector(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.CustomDataModule)Puerts.Utils.GetSelf((int)data, self); { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = (UnityEngine.ParticleSystemCustomData)argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var result = obj.GetVector(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetColor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.CustomDataModule)Puerts.Utils.GetSelf((int)data, self); { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = (UnityEngine.ParticleSystemCustomData)argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.ParticleSystem.MinMaxGradient>(false); obj.SetColor(Arg0,Arg1); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetColor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.CustomDataModule)Puerts.Utils.GetSelf((int)data, self); { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = (UnityEngine.ParticleSystemCustomData)argHelper0.GetInt32(false); var result = obj.GetColor(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_enabled(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.CustomDataModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.enabled; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_enabled(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.CustomDataModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.enabled = argHelper.GetBoolean(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "SetMode", IsStatic = false}, M_SetMode }, { new Puerts.MethodKey {Name = "GetMode", IsStatic = false}, M_GetMode }, { new Puerts.MethodKey {Name = "SetVectorComponentCount", IsStatic = false}, M_SetVectorComponentCount }, { new Puerts.MethodKey {Name = "GetVectorComponentCount", IsStatic = false}, M_GetVectorComponentCount }, { new Puerts.MethodKey {Name = "SetVector", IsStatic = false}, M_SetVector }, { new Puerts.MethodKey {Name = "GetVector", IsStatic = false}, M_GetVector }, { new Puerts.MethodKey {Name = "SetColor", IsStatic = false}, M_SetColor }, { new Puerts.MethodKey {Name = "GetColor", IsStatic = false}, M_GetColor }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"enabled", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_enabled, Setter = S_enabled} }, } }; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_TextGenerator_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_TextGenerator_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { if (paramLen == 0) { { var result = new UnityEngine.TextGenerator(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.TextGenerator), result); } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var result = new UnityEngine.TextGenerator(Arg0); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.TextGenerator), result); } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.TextGenerator constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Invalidate(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextGenerator; { { obj.Invalidate(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetCharacters(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextGenerator; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.Collections.Generic.List<UnityEngine.UICharInfo>>(false); obj.GetCharacters(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetLines(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextGenerator; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.Collections.Generic.List<UnityEngine.UILineInfo>>(false); obj.GetLines(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetVertices(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextGenerator; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.Collections.Generic.List<UnityEngine.UIVertex>>(false); obj.GetVertices(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetPreferredWidth(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextGenerator; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<UnityEngine.TextGenerationSettings>(false); var result = obj.GetPreferredWidth(Arg0,Arg1); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetPreferredHeight(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextGenerator; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<UnityEngine.TextGenerationSettings>(false); var result = obj.GetPreferredHeight(Arg0,Arg1); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_PopulateWithErrors(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextGenerator; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<UnityEngine.TextGenerationSettings>(false); var Arg2 = argHelper2.Get<UnityEngine.GameObject>(false); var result = obj.PopulateWithErrors(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Populate(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextGenerator; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<UnityEngine.TextGenerationSettings>(false); var result = obj.Populate(Arg0,Arg1); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetVerticesArray(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextGenerator; { { var result = obj.GetVerticesArray(); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetCharactersArray(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextGenerator; { { var result = obj.GetCharactersArray(); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetLinesArray(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextGenerator; { { var result = obj.GetLinesArray(); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_characterCountVisible(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextGenerator; var result = obj.characterCountVisible; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_verts(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextGenerator; var result = obj.verts; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_characters(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextGenerator; var result = obj.characters; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_lines(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextGenerator; var result = obj.lines; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_rectExtents(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextGenerator; var result = obj.rectExtents; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_vertexCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextGenerator; var result = obj.vertexCount; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_characterCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextGenerator; var result = obj.characterCount; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_lineCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextGenerator; var result = obj.lineCount; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_fontSizeUsedForBestFit(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextGenerator; var result = obj.fontSizeUsedForBestFit; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "Invalidate", IsStatic = false}, M_Invalidate }, { new Puerts.MethodKey {Name = "GetCharacters", IsStatic = false}, M_GetCharacters }, { new Puerts.MethodKey {Name = "GetLines", IsStatic = false}, M_GetLines }, { new Puerts.MethodKey {Name = "GetVertices", IsStatic = false}, M_GetVertices }, { new Puerts.MethodKey {Name = "GetPreferredWidth", IsStatic = false}, M_GetPreferredWidth }, { new Puerts.MethodKey {Name = "GetPreferredHeight", IsStatic = false}, M_GetPreferredHeight }, { new Puerts.MethodKey {Name = "PopulateWithErrors", IsStatic = false}, M_PopulateWithErrors }, { new Puerts.MethodKey {Name = "Populate", IsStatic = false}, M_Populate }, { new Puerts.MethodKey {Name = "GetVerticesArray", IsStatic = false}, M_GetVerticesArray }, { new Puerts.MethodKey {Name = "GetCharactersArray", IsStatic = false}, M_GetCharactersArray }, { new Puerts.MethodKey {Name = "GetLinesArray", IsStatic = false}, M_GetLinesArray }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"characterCountVisible", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_characterCountVisible, Setter = null} }, {"verts", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_verts, Setter = null} }, {"characters", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_characters, Setter = null} }, {"lines", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_lines, Setter = null} }, {"rectExtents", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_rectExtents, Setter = null} }, {"vertexCount", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_vertexCount, Setter = null} }, {"characterCount", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_characterCount, Setter = null} }, {"lineCount", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_lineCount, Setter = null} }, {"fontSizeUsedForBestFit", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_fontSizeUsedForBestFit, Setter = null} }, } }; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Bin/TsScripts/package.json<|end_filename|> { "name": "tsscripts", "version": "1.0.0", "description": "ts project", "scripts": { "build": "tsc -p tsconfig.json", "postbuild2": "node copyJsFile.js output ../Assets/Puerts/Resources", "watch": "watch 'npm run build' src" } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_LightmapData_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_LightmapData_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.LightmapData(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.LightmapData), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_lightmapColor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightmapData; var result = obj.lightmapColor; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_lightmapColor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightmapData; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.lightmapColor = argHelper.Get<UnityEngine.Texture2D>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_lightmapDir(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightmapData; var result = obj.lightmapDir; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_lightmapDir(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightmapData; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.lightmapDir = argHelper.Get<UnityEngine.Texture2D>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_shadowMask(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightmapData; var result = obj.shadowMask; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_shadowMask(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightmapData; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.shadowMask = argHelper.Get<UnityEngine.Texture2D>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"lightmapColor", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_lightmapColor, Setter = S_lightmapColor} }, {"lightmapDir", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_lightmapDir, Setter = S_lightmapDir} }, {"shadowMask", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_shadowMask, Setter = S_shadowMask} }, } }; } } } <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/mail/GlobalMail.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.mail { public sealed partial class GlobalMail : Bright.Config.BeanBase { public GlobalMail(ByteBuf _buf) { Id = _buf.ReadInt(); Title = _buf.ReadString(); Sender = _buf.ReadString(); Content = _buf.ReadString(); {int n = System.Math.Min(_buf.ReadSize(), _buf.Size);Award = new System.Collections.Generic.List<int>(n);for(var i = 0 ; i < n ; i++) { int _e; _e = _buf.ReadInt(); Award.Add(_e);}} AllServer = _buf.ReadBool(); {int n = System.Math.Min(_buf.ReadSize(), _buf.Size);ServerList = new System.Collections.Generic.List<int>(n);for(var i = 0 ; i < n ; i++) { int _e; _e = _buf.ReadInt(); ServerList.Add(_e);}} Platform = _buf.ReadString(); Channel = _buf.ReadString(); MinMaxLevel = condition.MinMaxLevel.DeserializeMinMaxLevel(_buf); RegisterTime = condition.TimeRange.DeserializeTimeRange(_buf); MailTime = condition.TimeRange.DeserializeTimeRange(_buf); } public GlobalMail(int id, string title, string sender, string content, System.Collections.Generic.List<int> award, bool all_server, System.Collections.Generic.List<int> server_list, string platform, string channel, condition.MinMaxLevel min_max_level, condition.TimeRange register_time, condition.TimeRange mail_time ) { this.Id = id; this.Title = title; this.Sender = sender; this.Content = content; this.Award = award; this.AllServer = all_server; this.ServerList = server_list; this.Platform = platform; this.Channel = channel; this.MinMaxLevel = min_max_level; this.RegisterTime = register_time; this.MailTime = mail_time; } public static GlobalMail DeserializeGlobalMail(ByteBuf _buf) { return new mail.GlobalMail(_buf); } public readonly int Id; public readonly string Title; public readonly string Sender; public readonly string Content; public readonly System.Collections.Generic.List<int> Award; public readonly bool AllServer; public readonly System.Collections.Generic.List<int> ServerList; public readonly string Platform; public readonly string Channel; public readonly condition.MinMaxLevel MinMaxLevel; public readonly condition.TimeRange RegisterTime; public readonly condition.TimeRange MailTime; public const int ID = -287571791; public override int GetTypeId() => ID; public void Resolve(Dictionary<string, object> _tables) { MinMaxLevel?.Resolve(_tables); RegisterTime?.Resolve(_tables); MailTime?.Resolve(_tables); OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); public override string ToString() { return "{ " + "Id:" + Id + "," + "Title:" + Title + "," + "Sender:" + Sender + "," + "Content:" + Content + "," + "Award:" + Bright.Common.StringUtil.CollectionToString(Award) + "," + "AllServer:" + AllServer + "," + "ServerList:" + Bright.Common.StringUtil.CollectionToString(ServerList) + "," + "Platform:" + Platform + "," + "Channel:" + Channel + "," + "MinMaxLevel:" + MinMaxLevel + "," + "RegisterTime:" + RegisterTime + "," + "MailTime:" + MailTime + "," + "}"; } } } <|start_filename|>Projects/GenerateDatas/convert_lua/test.TbTestExcelBean/1.lua<|end_filename|> return { x1 = 1, x2 = "xx", x3 = 2, x4 = 2.5, } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_Rect_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_Rect_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.GetFloat(false); var result = new UnityEngine.Rect(Arg0,Arg1,Arg2,Arg3); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.Rect), result); } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var result = new UnityEngine.Rect(Arg0,Arg1); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.Rect), result); } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var result = new UnityEngine.Rect(Arg0); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.Rect), result); } } if (paramLen == 0) { { var result = new UnityEngine.Rect(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.Rect), result); } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.Rect constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_MinMaxRect(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.GetFloat(false); var result = UnityEngine.Rect.MinMaxRect(Arg0,Arg1,Arg2,Arg3); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Set(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Rect)Puerts.Utils.GetSelf((int)data, self); { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.GetFloat(false); obj.Set(Arg0,Arg1,Arg2,Arg3); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Contains(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Rect)Puerts.Utils.GetSelf((int)data, self); if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var result = obj.Contains(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var result = obj.Contains(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = argHelper1.GetBoolean(false); var result = obj.Contains(Arg0,Arg1); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to Contains"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Overlaps(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Rect)Puerts.Utils.GetSelf((int)data, self); if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var result = obj.Overlaps(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.GetBoolean(false); var result = obj.Overlaps(Arg0,Arg1); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to Overlaps"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_NormalizedToPoint(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var result = UnityEngine.Rect.NormalizedToPoint(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_PointToNormalized(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var result = UnityEngine.Rect.PointToNormalized(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetHashCode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Rect)Puerts.Utils.GetSelf((int)data, self); { { var result = obj.GetHashCode(); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Equals(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Rect)Puerts.Utils.GetSelf((int)data, self); if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.Any, typeof(System.Object), false, false)) { var Arg0 = argHelper0.Get<System.Object>(false); var result = obj.Equals(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var result = obj.Equals(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to Equals"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ToString(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Rect)Puerts.Utils.GetSelf((int)data, self); if (paramLen == 0) { { var result = obj.ToString(); Puerts.PuertsDLL.ReturnString(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var result = obj.ToString(Arg0); Puerts.PuertsDLL.ReturnString(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.IFormatProvider), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<System.IFormatProvider>(false); var result = obj.ToString(Arg0,Arg1); Puerts.PuertsDLL.ReturnString(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to ToString"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_zero(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Rect.zero; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_x(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Rect)Puerts.Utils.GetSelf((int)data, self); var result = obj.x; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_x(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Rect)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.x = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_y(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Rect)Puerts.Utils.GetSelf((int)data, self); var result = obj.y; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_y(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Rect)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.y = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_position(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Rect)Puerts.Utils.GetSelf((int)data, self); var result = obj.position; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_position(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Rect)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.position = argHelper.Get<UnityEngine.Vector2>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_center(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Rect)Puerts.Utils.GetSelf((int)data, self); var result = obj.center; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_center(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Rect)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.center = argHelper.Get<UnityEngine.Vector2>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_min(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Rect)Puerts.Utils.GetSelf((int)data, self); var result = obj.min; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_min(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Rect)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.min = argHelper.Get<UnityEngine.Vector2>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_max(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Rect)Puerts.Utils.GetSelf((int)data, self); var result = obj.max; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_max(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Rect)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.max = argHelper.Get<UnityEngine.Vector2>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_width(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Rect)Puerts.Utils.GetSelf((int)data, self); var result = obj.width; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_width(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Rect)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.width = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_height(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Rect)Puerts.Utils.GetSelf((int)data, self); var result = obj.height; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_height(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Rect)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.height = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_size(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Rect)Puerts.Utils.GetSelf((int)data, self); var result = obj.size; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_size(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Rect)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.size = argHelper.Get<UnityEngine.Vector2>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_xMin(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Rect)Puerts.Utils.GetSelf((int)data, self); var result = obj.xMin; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_xMin(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Rect)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.xMin = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_yMin(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Rect)Puerts.Utils.GetSelf((int)data, self); var result = obj.yMin; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_yMin(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Rect)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.yMin = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_xMax(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Rect)Puerts.Utils.GetSelf((int)data, self); var result = obj.xMax; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_xMax(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Rect)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.xMax = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_yMax(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Rect)Puerts.Utils.GetSelf((int)data, self); var result = obj.yMax; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_yMax(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Rect)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.yMax = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void O_op_Inequality(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var arg0 = argHelper0.Get<UnityEngine.Rect>(false); var arg1 = argHelper1.Get<UnityEngine.Rect>(false); var result = arg0 != arg1; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void O_op_Equality(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var arg0 = argHelper0.Get<UnityEngine.Rect>(false); var arg1 = argHelper1.Get<UnityEngine.Rect>(false); var result = arg0 == arg1; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "MinMaxRect", IsStatic = true}, F_MinMaxRect }, { new Puerts.MethodKey {Name = "Set", IsStatic = false}, M_Set }, { new Puerts.MethodKey {Name = "Contains", IsStatic = false}, M_Contains }, { new Puerts.MethodKey {Name = "Overlaps", IsStatic = false}, M_Overlaps }, { new Puerts.MethodKey {Name = "NormalizedToPoint", IsStatic = true}, F_NormalizedToPoint }, { new Puerts.MethodKey {Name = "PointToNormalized", IsStatic = true}, F_PointToNormalized }, { new Puerts.MethodKey {Name = "GetHashCode", IsStatic = false}, M_GetHashCode }, { new Puerts.MethodKey {Name = "Equals", IsStatic = false}, M_Equals }, { new Puerts.MethodKey {Name = "ToString", IsStatic = false}, M_ToString }, { new Puerts.MethodKey {Name = "op_Inequality", IsStatic = true}, O_op_Inequality}, { new Puerts.MethodKey {Name = "op_Equality", IsStatic = true}, O_op_Equality}, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"zero", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_zero, Setter = null} }, {"x", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_x, Setter = S_x} }, {"y", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_y, Setter = S_y} }, {"position", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_position, Setter = S_position} }, {"center", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_center, Setter = S_center} }, {"min", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_min, Setter = S_min} }, {"max", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_max, Setter = S_max} }, {"width", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_width, Setter = S_width} }, {"height", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_height, Setter = S_height} }, {"size", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_size, Setter = S_size} }, {"xMin", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_xMin, Setter = S_xMin} }, {"yMin", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_yMin, Setter = S_yMin} }, {"xMax", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_xMax, Setter = S_xMax} }, {"yMax", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_yMax, Setter = S_yMax} }, } }; } } } <|start_filename|>Projects/Csharp_DotNet5_json_ExportServer/Gen/item/Item.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; using System.Text.Json; namespace cfg.item { /// <summary> /// 道具 /// </summary> public sealed class Item : Bright.Config.BeanBase { public Item(JsonElement _json) { Id = _json.GetProperty("id").GetInt32(); Name = _json.GetProperty("name").GetString(); MajorType = (item.EMajorType)_json.GetProperty("major_type").GetInt32(); MinorType = (item.EMinorType)_json.GetProperty("minor_type").GetInt32(); MaxPileNum = _json.GetProperty("max_pile_num").GetInt32(); Quality = (item.EItemQuality)_json.GetProperty("quality").GetInt32(); IconBackgroud = _json.GetProperty("icon_backgroud").GetString(); IconMask = _json.GetProperty("icon_mask").GetString(); Desc = _json.GetProperty("desc").GetString(); ShowOrder = _json.GetProperty("show_order").GetInt32(); Quantifier = _json.GetProperty("quantifier").GetString(); ShowInBag = _json.GetProperty("show_in_bag").GetBoolean(); MinShowLevel = _json.GetProperty("min_show_level").GetInt32(); BatchUsable = _json.GetProperty("batch_usable").GetBoolean(); ProgressTimeWhenUse = _json.GetProperty("progress_time_when_use").GetSingle(); ShowHintWhenUse = _json.GetProperty("show_hint_when_use").GetBoolean(); Droppable = _json.GetProperty("droppable").GetBoolean(); { if (_json.TryGetProperty("price", out var _j) && _j.ValueKind != JsonValueKind.Null) { Price = _j.GetInt32(); } else { Price = null; } } UseType = (item.EUseType)_json.GetProperty("use_type").GetInt32(); { if (_json.TryGetProperty("level_up_id", out var _j) && _j.ValueKind != JsonValueKind.Null) { LevelUpId = _j.GetInt32(); } else { LevelUpId = null; } } } public Item(int id, string name, item.EMajorType major_type, item.EMinorType minor_type, int max_pile_num, item.EItemQuality quality, string icon_backgroud, string icon_mask, string desc, int show_order, string quantifier, bool show_in_bag, int min_show_level, bool batch_usable, float progress_time_when_use, bool show_hint_when_use, bool droppable, int? price, item.EUseType use_type, int? level_up_id ) { this.Id = id; this.Name = name; this.MajorType = major_type; this.MinorType = minor_type; this.MaxPileNum = max_pile_num; this.Quality = quality; this.IconBackgroud = icon_backgroud; this.IconMask = icon_mask; this.Desc = desc; this.ShowOrder = show_order; this.Quantifier = quantifier; this.ShowInBag = show_in_bag; this.MinShowLevel = min_show_level; this.BatchUsable = batch_usable; this.ProgressTimeWhenUse = progress_time_when_use; this.ShowHintWhenUse = show_hint_when_use; this.Droppable = droppable; this.Price = price; this.UseType = use_type; this.LevelUpId = level_up_id; } public static Item DeserializeItem(JsonElement _json) { return new item.Item(_json); } /// <summary> /// 道具id /// </summary> public int Id { get; private set; } public string Name { get; private set; } public item.EMajorType MajorType { get; private set; } public item.EMinorType MinorType { get; private set; } public int MaxPileNum { get; private set; } public item.EItemQuality Quality { get; private set; } public string IconBackgroud { get; private set; } public string IconMask { get; private set; } public string Desc { get; private set; } public int ShowOrder { get; private set; } public string Quantifier { get; private set; } public bool ShowInBag { get; private set; } public int MinShowLevel { get; private set; } public bool BatchUsable { get; private set; } public float ProgressTimeWhenUse { get; private set; } public bool ShowHintWhenUse { get; private set; } public bool Droppable { get; private set; } public int? Price { get; private set; } public item.EUseType UseType { get; private set; } public int? LevelUpId { get; private set; } public const int __ID__ = 2107285806; public override int GetTypeId() => __ID__; public void Resolve(Dictionary<string, object> _tables) { } public void TranslateText(System.Func<string, string, string> translator) { } public override string ToString() { return "{ " + "Id:" + Id + "," + "Name:" + Name + "," + "MajorType:" + MajorType + "," + "MinorType:" + MinorType + "," + "MaxPileNum:" + MaxPileNum + "," + "Quality:" + Quality + "," + "IconBackgroud:" + IconBackgroud + "," + "IconMask:" + IconMask + "," + "Desc:" + Desc + "," + "ShowOrder:" + ShowOrder + "," + "Quantifier:" + Quantifier + "," + "ShowInBag:" + ShowInBag + "," + "MinShowLevel:" + MinShowLevel + "," + "BatchUsable:" + BatchUsable + "," + "ProgressTimeWhenUse:" + ProgressTimeWhenUse + "," + "ShowHintWhenUse:" + ShowHintWhenUse + "," + "Droppable:" + Droppable + "," + "Price:" + Price + "," + "UseType:" + UseType + "," + "LevelUpId:" + LevelUpId + "," + "}"; } } } <|start_filename|>Projects/GenerateDatas/convert_lua/role.TbRoleLevelExpAttr/6.lua<|end_filename|> return { level = 6, need_exp = 500, clothes_attrs = { 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, }, } <|start_filename|>Projects/DataTemplates/template_erlang2/test_tbdemogroupdefinefromexcel.erl<|end_filename|> %% test.TbDemoGroupDefineFromExcel -module(test_tbdemogroupdefinefromexcel) -export([get/1,get_ids/0]) get(1) -> #{ id => 1, x1 => 1, x2 => 2, x3 => 3, x4 => 4, x5 => bean }. get(2) -> #{ id => 2, x1 => 1, x2 => 2, x3 => 3, x4 => 4, x5 => bean }. get(3) -> #{ id => 3, x1 => 1, x2 => 2, x3 => 3, x4 => 4, x5 => bean }. get(4) -> #{ id => 4, x1 => 1, x2 => 2, x3 => 3, x4 => 4, x5 => bean }. get_ids() -> [1,2,3,4]. <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_Grid_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_Grid_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.Grid(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.Grid), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetCellCenterLocal(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Grid; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Vector3Int>(false); var result = obj.GetCellCenterLocal(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetCellCenterWorld(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Grid; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Vector3Int>(false); var result = obj.GetCellCenterWorld(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_Swizzle(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = (UnityEngine.GridLayout.CellSwizzle)argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3>(false); var result = UnityEngine.Grid.Swizzle(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_InverseSwizzle(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = (UnityEngine.GridLayout.CellSwizzle)argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3>(false); var result = UnityEngine.Grid.InverseSwizzle(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_cellSize(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Grid; var result = obj.cellSize; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_cellSize(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Grid; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.cellSize = argHelper.Get<UnityEngine.Vector3>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_cellGap(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Grid; var result = obj.cellGap; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_cellGap(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Grid; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.cellGap = argHelper.Get<UnityEngine.Vector3>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_cellLayout(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Grid; var result = obj.cellLayout; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_cellLayout(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Grid; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.cellLayout = (UnityEngine.GridLayout.CellLayout)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_cellSwizzle(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Grid; var result = obj.cellSwizzle; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_cellSwizzle(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Grid; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.cellSwizzle = (UnityEngine.GridLayout.CellSwizzle)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "GetCellCenterLocal", IsStatic = false}, M_GetCellCenterLocal }, { new Puerts.MethodKey {Name = "GetCellCenterWorld", IsStatic = false}, M_GetCellCenterWorld }, { new Puerts.MethodKey {Name = "Swizzle", IsStatic = true}, F_Swizzle }, { new Puerts.MethodKey {Name = "InverseSwizzle", IsStatic = true}, F_InverseSwizzle }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"cellSize", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_cellSize, Setter = S_cellSize} }, {"cellGap", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_cellGap, Setter = S_cellGap} }, {"cellLayout", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_cellLayout, Setter = S_cellLayout} }, {"cellSwizzle", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_cellSwizzle, Setter = S_cellSwizzle} }, } }; } } } <|start_filename|>Projects/DataTemplates/template_lua2/l10n_tbpatchdemo.lua<|end_filename|> -- l10n.TbPatchDemo return { [11] = { id=11, value=1, }, [12] = { id=12, value=2, }, [13] = { id=13, value=3, }, [14] = { id=14, value=4, }, [15] = { id=15, value=5, }, [16] = { id=16, value=6, }, [17] = { id=17, value=7, }, [18] = { id=18, value=8, }, } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_Microphone_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_Microphone_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.Microphone(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.Microphone), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_Start(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.GetBoolean(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetInt32(false); var result = UnityEngine.Microphone.Start(Arg0,Arg1,Arg2,Arg3); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_End(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetString(false); UnityEngine.Microphone.End(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_IsRecording(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetString(false); var result = UnityEngine.Microphone.IsRecording(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetPosition(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetString(false); var result = UnityEngine.Microphone.GetPosition(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetDeviceCaps(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.GetInt32(true); var Arg2 = argHelper2.GetInt32(true); UnityEngine.Microphone.GetDeviceCaps(Arg0,out Arg1,out Arg2); argHelper1.SetByRefValue(Arg1); argHelper2.SetByRefValue(Arg2); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_devices(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Microphone.devices; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "Start", IsStatic = true}, F_Start }, { new Puerts.MethodKey {Name = "End", IsStatic = true}, F_End }, { new Puerts.MethodKey {Name = "IsRecording", IsStatic = true}, F_IsRecording }, { new Puerts.MethodKey {Name = "GetPosition", IsStatic = true}, F_GetPosition }, { new Puerts.MethodKey {Name = "GetDeviceCaps", IsStatic = true}, F_GetDeviceCaps }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"devices", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_devices, Setter = null} }, } }; } } } <|start_filename|>Projects/java_json/src/corelib/bright/serialization/ByteBuf.java<|end_filename|> package bright.serialization; import bright.math.Vector2; import bright.math.Vector3; import bright.math.Vector4; import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; import java.util.Arrays; import java.util.Stack; public class ByteBuf { public static final byte[] EMPTY_BYTES = new byte[0]; private static final Charset MARSHAL_CHARSET = StandardCharsets.UTF_8; private byte[] data; private int beginPos; private int endPos; private int capacity; public ByteBuf() { this(EMPTY_BYTES, 0, 0); } public ByteBuf(int initCapacity) { this(new byte[initCapacity], 0, 0); } public ByteBuf(byte[] data) { this(data, 0, data.length); } public ByteBuf(byte[] data, int beginPos, int endPos) { this.data = data; this.beginPos = beginPos; this.endPos = endPos; this.capacity = data.length; } // public static Octets wrap(byte[] bytes) { // return new Octets(bytes, 0, bytes.length); // } // // public static Octets wrap(byte[] bytes, int beginPos, int len) { // return new Octets(bytes, beginPos, beginPos + len); // } private final static ThreadLocal<Stack<ByteBuf>> pool = ThreadLocal.withInitial(Stack::new); public static ByteBuf alloc() { Stack<ByteBuf> p = pool.get(); if(!p.empty()) { return p.pop(); } else { return new ByteBuf(); } } public static ByteBuf free(ByteBuf os) { os.clear(); return pool.get().push(os); } public void replace(byte[] data, int beginPos, int endPos) { this.data = data; this.beginPos = beginPos; this.endPos = endPos; this.capacity = data.length; } public void replace(byte[] data) { this.data = data; this.beginPos = 0; this.endPos = this.capacity = data.length; } public void sureRead(int n) { if (beginPos + n > endPos) { throw new SerializationException("read not enough"); } } private int chooseNewSize(int originSize, int needSize) { int newSize = Math.max(originSize, 12); while (newSize < needSize) { newSize = newSize * 3 / 2; } return newSize; } public void sureWrite(int n) { if (endPos + n > capacity) { int curSize = endPos - beginPos; int needSize = curSize + n; if (needSize > capacity) { capacity = chooseNewSize(capacity, needSize); byte[] newData = new byte[capacity]; System.arraycopy(data, beginPos, newData, 0, curSize); data = newData; } else { System.arraycopy(data, beginPos, data, 0, curSize); } beginPos = 0; endPos = curSize; } } public void writeSize(int x) { writeCompactUint(x); } public int readSize() { return readCompactUint(); } public void writeShort(short x) { writeCompactShort(x); } public short readShort() { return readCompactShort(); } public short readCompactShort() { sureRead(1); int h = (data[beginPos] & 0xff); if (h < 0x80) { beginPos++; return (short)h; } else if (h < 0xc0) { sureRead(2); int x = ((h & 0x3f) << 8) | (data[beginPos + 1] & 0xff); beginPos += 2; return (short)x; } else if( (h == 0xff)){ sureRead(3); int x = ((data[beginPos + 1] & 0xff) << 8) | (data[beginPos + 2] & 0xff); beginPos += 3; return (short)x; } else { throw new SerializationException("exceed max short"); } } public void writeCompactShort(short x) { if (x >= 0) { if (x < 0x80) { sureWrite(1); data[endPos++] = (byte) x; return; } else if (x < 0x4000) { sureWrite(2); data[endPos + 1] = (byte) x; data[endPos] = (byte) ((x >> 8) | 0x80); endPos += 2; return; } } sureWrite(3); data[endPos] = (byte) 0xff; data[endPos + 2] = (byte) x; data[endPos + 1] = (byte) (x >> 8); endPos += 3; } public int readCompactInt() { sureRead(1); int h = data[beginPos] & 0xff; if (h < 0x80) { beginPos++; return h; } else if (h < 0xc0) { sureRead(2); int x = ((h & 0x3f) << 8) | (data[beginPos + 1] & 0xff); beginPos += 2; return x; } else if (h < 0xe0) { sureRead(3); int x = ((h & 0x1f) << 16) | ((data[beginPos + 1] & 0xff) << 8) | (data[beginPos + 2] & 0xff); beginPos += 3; return x; } else if (h < 0xf0) { sureRead(4); int x = ((h & 0x0f) << 24) | ((data[beginPos + 1] & 0xff) << 16) | ((data[beginPos + 2] & 0xff) << 8) | (data[beginPos + 3] & 0xff); beginPos += 4; return x; } else { sureRead(5); int x = ((data[beginPos + 1] & 0xff) << 24) | ((data[beginPos + 2] & 0xff) << 16) | ((data[beginPos + 3] & 0xff) << 8) | (data[beginPos + 4] & 0xff); beginPos += 5; return x; } } public void writeCompactInt(int x) { if (x >= 0) { if (x < 0x80) { sureWrite(1); data[endPos++] = (byte) x; return; } else if (x < 0x4000) { sureWrite(2); data[endPos + 1] = (byte) x; data[endPos] = (byte) ((x >> 8) | 0x80); endPos += 2; return; } else if (x < 0x200000) { sureWrite(3); data[endPos + 2] = (byte) x; data[endPos + 1] = (byte) (x >> 8); data[endPos] = (byte) ((x >> 16) | 0xc0); endPos += 3; return; } else if (x < 0x10000000) { sureWrite(4); data[endPos + 3] = (byte) x; data[endPos + 2] = (byte) (x >> 8); data[endPos + 1] = (byte) (x >> 16); data[endPos] = (byte) ((x >> 24) | 0xe0); endPos += 4; return; } } sureWrite(5); data[endPos] = (byte) 0xf0; data[endPos + 4] = (byte) x; data[endPos + 3] = (byte) (x >> 8); data[endPos + 2] = (byte) (x >> 16); data[endPos + 1] = (byte) (x >> 24); endPos += 5; } public long readCompactLong() { sureRead(1); int h = data[beginPos] & 0xff; if (h < 0x80) { beginPos++; return h; } else if (h < 0xc0) { sureRead(2); int x = ((h & 0x3f) << 8) | (data[beginPos + 1] & 0xff); beginPos += 2; return x; } else if (h < 0xe0) { sureRead(3); int x = ((h & 0x1f) << 16) | ((data[(beginPos + 1)] & 0xff) << 8) | (data[(beginPos + 2)] & 0xff); beginPos += 3; return x; } else if (h < 0xf0) { sureRead(4); int x = ((h & 0x0f) << 24) | ((data[(beginPos + 1)] & 0xff) << 16) | ((data[(beginPos + 2)] & 0xff) << 8) | (data[(beginPos + 3)] & 0xff); beginPos += 4; return x; } else if (h < 0xf8) { sureRead(5); int xl = (data[(beginPos + 1)] << 24) | ((data[(beginPos + 2)] & 0xff) << 16) | ((data[(beginPos + 3)] & 0xff) << 8) | (data[(beginPos + 4)] & 0xff); int xh = h & 0x07; beginPos += 5; return ((long) xh << 32) | (xl & 0xffffffffL); } else if (h < 0xfc) { sureRead(6); int xl = (data[(beginPos + 2)] << 24) | ((data[(beginPos + 3)] & 0xff) << 16) | ((data[(beginPos + 4)] & 0xff) << 8) | (data[(beginPos + 5)] & 0xff); int xh = ((h & 0x03) << 8) | (data[(beginPos + 1)] & 0xff); beginPos += 6; return ((long) xh << 32) | (xl & 0xffffffffL); } else if (h < 0xfe) { sureRead(7); int xl = (data[(beginPos + 3)] << 24) | ((data[(beginPos + 4)] & 0xff) << 16) | ((data[(beginPos + 5)] & 0xff) << 8) | (data[(beginPos + 6)] & 0xff); int xh = ((h & 0x01) << 16) | ((data[(beginPos + 1)] & 0xff) << 8) | (data[(beginPos + 2)] & 0xff); beginPos += 7; return ((long) xh << 32) | (xl & 0xffffffffL); } else if (h < 0xff) { sureRead(8); int xl = (data[(beginPos + 4)] << 24) | ((data[(beginPos + 5)] & 0xff) << 16) | ((data[(beginPos + 6)] & 0xff) << 8) | (data[(beginPos + 7)] & 0xff); int xh = /*((h & 0x0) << 16) | */ ((data[(beginPos + 1)] & 0xff) << 16) | ((data[(beginPos + 2)] & 0xff) << 8) | (data[(beginPos + 3)] & 0xff); beginPos += 8; return ((long) xh << 32) | (xl & 0xffffffffL); } else { sureRead(9); int xl = (data[(beginPos + 5)] << 24) | ((data[(beginPos + 6)] & 0xff) << 16) | ((data[(beginPos + 7)] & 0xff) << 8) | (data[(beginPos + 8)] & 0xff); int xh = (data[(beginPos + 1)] << 24) | ((data[(beginPos + 2)] & 0xff) << 16) | ((data[(beginPos + 3)] & 0xff) << 8) | (data[(beginPos + 4)] & 0xff); beginPos += 9; return ((long) xh << 32) | (xl & 0xffffffffL); } } public void writeCompactLong(long x) { if (x >= 0) { if (x < 0x80) { sureWrite(1); data[(endPos++)] = (byte) x; return; } else if (x < 0x4000) { sureWrite(2); data[(endPos + 1)] = (byte) x; data[(endPos)] = (byte) ((x >> 8) | 0x80); endPos += 2; return; } else if (x < 0x200000) { sureWrite(3); data[(endPos + 2)] = (byte) x; data[(endPos + 1)] = (byte) (x >> 8); data[(endPos)] = (byte) ((x >> 16) | 0xc0); endPos += 3; return; } else if (x < 0x10000000) { sureWrite(4); data[(endPos + 3)] = (byte) x; data[(endPos + 2)] = (byte) (x >> 8); data[(endPos + 1)] = (byte) (x >> 16); data[(endPos)] = (byte) ((x >> 24) | 0xe0); endPos += 4; return; } else if (x < 0x800000000L) { sureWrite(5); data[(endPos + 4)] = (byte) x; data[(endPos + 3)] = (byte) (x >> 8); data[(endPos + 2)] = (byte) (x >> 16); data[(endPos + 1)] = (byte) (x >> 24); data[(endPos)] = (byte) ((x >> 32) | 0xf0); endPos += 5; return; } else if (x < 0x40000000000L) { sureWrite(6); data[(endPos + 5)] = (byte) x; data[(endPos + 4)] = (byte) (x >> 8); data[(endPos + 3)] = (byte) (x >> 16); data[(endPos + 2)] = (byte) (x >> 24); data[(endPos + 1)] = (byte) (x >> 32); data[(endPos)] = (byte) ((x >> 40) | 0xf8); endPos += 6; return; } else if (x < 0x200000000000L) { sureWrite(7); data[(endPos + 6)] = (byte) x; data[(endPos + 5)] = (byte) (x >> 8); data[(endPos + 4)] = (byte) (x >> 16); data[(endPos + 3)] = (byte) (x >> 24); data[(endPos + 2)] = (byte) (x >> 32); data[(endPos + 1)] = (byte) (x >> 40); data[(endPos)] = (byte) ((x >> 48) | 0xfc); endPos += 7; return; } else if (x < 0x100000000000000L) { sureWrite(8); data[(endPos + 7)] = (byte) x; data[(endPos + 6)] = (byte) (x >> 8); data[(endPos + 5)] = (byte) (x >> 16); data[(endPos + 4)] = (byte) (x >> 24); data[(endPos + 3)] = (byte) (x >> 32); data[(endPos + 2)] = (byte) (x >> 40); data[(endPos + 1)] = (byte) (x >> 48); data[(endPos)] = /*(x >> 56) | */ (byte) 0xfe; endPos += 8; return; } } sureWrite(9); data[(endPos + 8)] = (byte) x; data[(endPos + 7)] = (byte) (x >> 8); data[(endPos + 6)] = (byte) (x >> 16); data[(endPos + 5)] = (byte) (x >> 24); data[(endPos + 4)] = (byte) (x >> 32); data[(endPos + 3)] = (byte) (x >> 40); data[(endPos + 2)] = (byte) (x >> 48); data[(endPos + 1)] = (byte) (x >> 56); data[(endPos)] = (byte) 0xff; endPos += 9; } public int readCompactUint() { int n = readCompactInt(); if (n >= 0) { return n; } else { throw new SerializationException("unmarshal CompactUnit"); } } public void writeCompactUint(int x) { writeCompactInt(x); } // public void writeCompactUint(ByteBuf byteBuf, int x) { // if (x >= 0) { // if (x < 0x80) { // byteBuf.writeByte(x); // } else if (x < 0x4000) { // byteBuf.writeShort(x | 0x8000); // } else if (x < 0x200000) { // byteBuf.writeMedium(x | 0xc00000); // } else if (x < 0x10000000) { // byteBuf.writeInt(x | 0xe0000000); // } else { // throw new RuntimeException("exceed max unit"); // } // } // } public int readInt() { return readCompactInt(); } public void writeInt(int x) { writeCompactInt(x); } public long readLong() { return readCompactLong(); } public void writeLong(long x) { writeCompactLong(x); } public void writeSint(int x) { writeInt((x << 1) | (x >>> 31)); } public int readSint() { int x = readInt(); return (x >>> 1) | ((x&1) << 31); } public void writeSlong(long x) { writeLong((x << 1) | (x >>> 63)); } public long readSlong() { long x = readLong(); return (x >>> 1) | ((x&1L) << 63); } public short readFshort() { sureRead(4); int x = (data[(beginPos)] & 0xff) | ((data[(beginPos + 1)] & 0xff) << 8); beginPos += 2; return (short)x; } public void writeFshort(short x) { sureWrite(2); data[(endPos)] = (byte) (x & 0xff); data[(endPos + 1)] = (byte) ((x >> 8) & 0xff); endPos += 2; } public int readFint() { sureRead(4); int x = (data[(beginPos)] & 0xff) | ((data[(beginPos + 1)] & 0xff) << 8) | ((data[(beginPos + 2)] & 0xff) << 16) | ((data[(beginPos + 3)] & 0xff) << 24); beginPos += 4; return x; } public void writeFint(int x) { sureWrite(4); data[(endPos)] = (byte) (x & 0xff); data[(endPos + 1)] = (byte) ((x >> 8) & 0xff); data[(endPos + 2)] = (byte) ((x >> 16) & 0xff); data[(endPos + 3)] = (byte) ((x >> 24) & 0xff); endPos += 4; } public long readFlong() { sureRead(8); long x = ((data[(beginPos + 7)] & 0xffL) << 56) | ((data[(beginPos + 6)] & 0xffL) << 48) | ((data[(beginPos + 5)] & 0xffL) << 40) | ((data[(beginPos + 4)] & 0xffL) << 32) | ((data[(beginPos + 3)] & 0xffL) << 24) | ((data[(beginPos + 2)] & 0xffL) << 16) | ((data[(beginPos + 1)] & 0xffL) << 8) | (data[(beginPos)] & 0xffL); beginPos += 8; return x; } public void writeFlong(long x) { sureWrite(8); data[(endPos + 7)] = (byte) (x >> 56); data[(endPos + 6)] = (byte) (x >> 48); data[(endPos + 5)] = (byte) (x >> 40); data[(endPos + 4)] = (byte) (x >> 32); data[(endPos + 3)] = (byte) (x >> 24); data[(endPos + 2)] = (byte) (x >> 16); data[(endPos + 1)] = (byte) (x >> 8); data[(endPos)] = (byte) x; endPos += 8; } public float readFloat() { return Float.intBitsToFloat(readFint()); } public void writeFloat(float z) { writeFint(Float.floatToIntBits(z)); } public double readDouble() { return Double.longBitsToDouble(readFlong()); } public void writeDouble(double z) { writeFlong(Double.doubleToLongBits(z)); } public void writeVector2(Vector2 v) { writeFloat(v.x); writeFloat(v.y); } public Vector2 readVector2() { return new Vector2(readFloat(), readFloat()); } public void writeVector3(Vector3 v) { writeFloat(v.x); writeFloat(v.y); writeFloat(v.z); } public Vector3 readVector3() { return new Vector3(readFloat(), readFloat(), readFloat()); } public void writeVector4(Vector4 v) { writeFloat(v.x); writeFloat(v.y); writeFloat(v.z); writeFloat(v.w); } public Vector4 readVector4() { return new Vector4(readFloat(), readFloat(), readFloat(), readFloat()); } public String readString() { int n = readSize(); if(n > 0) { sureRead(n); int start = beginPos; beginPos += n; return new String(data, start, n, ByteBuf.MARSHAL_CHARSET); } else { return ""; } } public void writeString(String x) { if(x.length() > 0) { byte[] bytes = x.getBytes(ByteBuf.MARSHAL_CHARSET); int n = bytes.length; writeCompactUint(n); sureWrite(n); System.arraycopy(bytes, 0, data, endPos, n); endPos += n; } else { writeCompactUint(0); } } public void writeOctets(ByteBuf o) { int n = o.size(); writeCompactUint(n); if(n > 0) { sureWrite(n); System.arraycopy(o.data, o.beginPos, this.data, this.endPos, n); this.endPos += n; } } public ByteBuf readOctets() { int n = readSize(); sureRead(n); int start = beginPos; beginPos += n; return new ByteBuf(Arrays.copyOfRange(data, start, beginPos)); } public ByteBuf readOctets(ByteBuf o) { int n = readSize(); sureRead(n); int start = beginPos; beginPos += n; o.sureWrite(n); System.arraycopy(data, start, o.data, o.endPos, n); o.endPos += n; return o; } public byte[] readBytes() { int n = readSize(); if(n > 0) { sureRead(n); int start = beginPos; beginPos += n; return Arrays.copyOfRange(data, start, beginPos); } else { return EMPTY_BYTES; } } public void writeBytes(byte[] x) { int n = x.length; writeCompactUint(n); if(n > 0) { sureWrite(n); System.arraycopy(x, 0, data, endPos, n); endPos += n; } } public boolean readBool() { sureRead(1); return data[(beginPos++)] != 0; } public void writeBool(boolean x) { sureWrite(1); data[(endPos++)] = x ? (byte) 1 : 0; } public byte readByte() { sureRead(1); return data[(beginPos++)]; } public void writeByte(byte x) { sureWrite(1); data[endPos++] = x; } // public void writeTo(ByteBuf byteBuf) { // int n = size(); // writeCompactUint(byteBuf, n); // byteBuf.writeBytes(data, beginPos, n); // } public void writeTo(ByteBuf os) { int n = size(); os.writeCompactUint(n); os.sureWrite(n); System.arraycopy(data, beginPos, os.data, os.endPos, n); os.endPos += n; } // public void readFrom(ByteBuf byteBuf) { // int n = byteBuf.readableBytes(); // sureWrite(n); // byteBuf.readBytes(data, endPos, n); // endPos += n; // } public void wrapRead(ByteBuf src, int size) { this.data = src.data; this.beginPos = src.beginPos; this.endPos = src.beginPos += size; this.capacity = src.capacity; } public void clear() { beginPos = 0; endPos = 0; } public int size() { return endPos - beginPos; } public boolean empty() { return endPos == beginPos; } public boolean nonEmpty() { return endPos > beginPos; } public int readerIndex() { return beginPos; } public void rollbackReadIndex(int readerMark) { beginPos = readerMark; } public void skip(int n) { sureRead(n); beginPos += n; } public void skipBytes() { int n = readSize(); sureRead(n); beginPos += n; } public byte[] array() { return data; } public byte[] copyRemainData() { return Arrays.copyOfRange(data, beginPos, endPos); } public String toString() { StringBuilder b = new StringBuilder(); for (int i = beginPos; i < endPos; i++) { b.append(data[i]).append(","); } return b.toString(); } public static ByteBuf fromString(String value) { if(value.isEmpty()) { return new ByteBuf(); } String[] ss = value.split(","); byte[] data = new byte[ss.length]; for (int i = 0; i < data.length; i++) { data[i] = (byte)Integer.parseInt(ss[i]); } return new ByteBuf(data); } @Override public boolean equals(Object x) { if (!(x instanceof ByteBuf)) return false; ByteBuf o = (ByteBuf) x; if (size() != o.size()) return false; for (int i = beginPos; i < endPos; i++) { if (data[i] != o.data[o.beginPos + i - beginPos]) return false; } return true; } } <|start_filename|>Projects/Csharp_CustomTemplate_EncryptMemory/Gen/item/Item.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using System; using Newtonsoft.Json; using Scripts; namespace cfg.item { /// <summary> /// 道具 /// </summary> [Serializable] public partial class Item : AConfig { public string name { get; set; } public item.EMajorType major_type { get; set; } public item.EMinorType minor_type { get; set; } [JsonProperty("max_pile_num")] private int _max_pile_num { get; set; } [JsonIgnore] public EncryptInt max_pile_num { get; private set; } = new(); public item.EItemQuality quality { get; set; } public string icon { get; set; } public string icon_backgroud { get; set; } public string icon_mask { get; set; } public string desc { get; set; } [JsonProperty("show_order")] private int _show_order { get; set; } [JsonIgnore] public EncryptInt show_order { get; private set; } = new(); public string quantifier { get; set; } public bool show_in_bag { get; set; } [JsonProperty("min_show_level")] private int _min_show_level { get; set; } [JsonIgnore] public EncryptInt min_show_level { get; private set; } = new(); public bool batch_usable { get; set; } [JsonProperty("progress_time_when_use")] private float _progress_time_when_use { get; set; } [JsonIgnore] public EncryptFloat progress_time_when_use { get; private set; } = new(); public bool show_hint_when_use { get; set; } public bool droppable { get; set; } [JsonProperty("price")] private int? _price { get; set; } [JsonIgnore] public EncryptInt price { get; private set; } = new(); public item.EUseType use_type { get; set; } [JsonProperty("level_up_id")] private int? _level_up_id { get; set; } [JsonIgnore] public EncryptInt level_up_id { get; private set; } = new(); public override void EndInit() { max_pile_num = _max_pile_num; show_order = _show_order; min_show_level = _min_show_level; progress_time_when_use = _progress_time_when_use; price = _price; level_up_id = _level_up_id; } public override string ToString() => JsonConvert.SerializeObject(this); } } <|start_filename|>Projects/DataTemplates/template_erlang2/test_tbexcelfromjsonmultirow.erl<|end_filename|> %% test.TbExcelFromJsonMultiRow -module(test_tbexcelfromjsonmultirow) -export([get/1,get_ids/0]) get(1) -> #{ id => 1, x => 5, items => array }. get(2) -> #{ id => 2, x => 9, items => array }. get_ids() -> [1,2]. <|start_filename|>Projects/DataTemplates/template_erlang2/test_tbexcelfromjson.erl<|end_filename|> %% test.TbExcelFromJson -module(test_tbexcelfromjson) -export([get/1,get_ids/0]) get(1) -> #{ x4 => 1, x1 => true, x5 => 100, x6 => 1.2, s1 => "hq", s2 => aabbcc, v2 => {"1","2"}, v3 => {"1.1","2.2","3.4"}, v4 => {"10.1","11.2","12.3","13.4"}, t1 => 631123200, x12 => bean, x13 => 1, x14 => bean, k1 => array, k8 => map, k9 => array, k15 => array }. get(2) -> #{ x4 => 2, x1 => true, x5 => 100, x6 => 1.2, s1 => "hq", s2 => aabbcc, v2 => {"1","2"}, v3 => {"1.1","2.2","3.4"}, v4 => {"10.1","11.2","12.3","13.4"}, t1 => 631123200, x12 => bean, x13 => 2, x14 => bean, k1 => array, k8 => map, k9 => array, k15 => array }. get(3) -> #{ x4 => 3, x1 => true, x5 => 100, x6 => 1.2, s1 => "hq", s2 => aabbcc, v2 => {"1","2"}, v3 => {"1.1","2.2","3.4"}, v4 => {"10.1","11.2","12.3","13.4"}, t1 => 631123200, x12 => bean, x13 => 4, x14 => bean, k1 => array, k8 => map, k9 => array, k15 => array }. get(6) -> #{ x4 => 6, x1 => false, x5 => 100, x6 => 1.2, s1 => "hq", s2 => aabbcc, v2 => {"1","2"}, v3 => {"1.1","2.2","3.4"}, v4 => {"10.1","11.2","12.3","13.4"}, t1 => 631123200, x12 => bean, x13 => 4, x14 => bean, k1 => array, k8 => map, k9 => array, k15 => array }. get(7) -> #{ x4 => 7, x1 => false, x5 => 100, x6 => 1.2, s1 => "hq", s2 => aabbcc, v2 => {"1","3"}, v3 => {"1.1","2.2","3.5"}, v4 => {"10.1","11.2","12.3","13.5"}, t1 => 631209600, x12 => bean, x13 => 4, x14 => bean, k1 => array, k8 => map, k9 => array, k15 => array }. get(8) -> #{ x4 => 8, x1 => false, x5 => 100, x6 => 1.2, s1 => "hq", s2 => aabbcc, v2 => {"1","4"}, v3 => {"1.1","2.2","3.6"}, v4 => {"10.1","11.2","12.3","13.6"}, t1 => 631296000, x12 => bean, x13 => 4, x14 => bean, k1 => array, k8 => map, k9 => array, k15 => array }. get_ids() -> [1,2,3,6,7,8]. <|start_filename|>ProtoProjects/go/gen/src/proto/test.Dyn.go<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package proto import ( "bright/serialization" ) import "errors" type TestDyn struct { A1 int32 } const TypeId_TestDyn = 0 func (*TestDyn) GetTypeId() int32 { return 0 } func (_v *TestDyn)Serialize(_buf *serialization.ByteBuf) { _buf.WriteInt(_v.A1) } func (_v *TestDyn)Deserialize(_buf *serialization.ByteBuf) (err error) { { if _v.A1, err = _buf.ReadInt(); err != nil { err = errors.New("_v.A1 error"); return } } return } func SerializeTestDyn(_v interface{}, _buf *serialization.ByteBuf) { _b := _v.(serialization.ISerializable) _buf.WriteInt(_b.GetTypeId()) _b.Serialize(_buf) } func DeserializeTestDyn(_buf *serialization.ByteBuf) (_v serialization.ISerializable, err error) { var id int32 if id, err = _buf.ReadInt() ; err != nil { return } switch id { case 1: _v = &TestChild2{}; if err = _v.Deserialize(_buf); err != nil { return nil, err } else { return } case 10: _v = &TestChild31{}; if err = _v.Deserialize(_buf); err != nil { return nil, err } else { return } case 11: _v = &TestChild32{}; if err = _v.Deserialize(_buf); err != nil { return nil, err } else { return } default: return nil, errors.New("unknown type id") } } <|start_filename|>Projects/GenerateDatas/convert_lua/role.TbRoleLevelExpAttr/98.lua<|end_filename|> return { level = 98, need_exp = 315000, clothes_attrs = { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, }, } <|start_filename|>Projects/DataTemplates/template_erlang2/test_tbtestsize.erl<|end_filename|> %% test.TbTestSize -module(test_tbtestsize) -export([get/1,get_ids/0]) get(1) -> #{ id => 1, x1 => array, x2 => array, x3 => array, x4 => map }. get_ids() -> [1]. <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_ParticleSystem_CollisionModule_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_ParticleSystem_CollisionModule_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.ParticleSystem.CollisionModule constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_AddPlane(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.CollisionModule)Puerts.Utils.GetSelf((int)data, self); { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Transform>(false); obj.AddPlane(Arg0); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_RemovePlane(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.CollisionModule)Puerts.Utils.GetSelf((int)data, self); if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); obj.RemovePlane(Arg0); Puerts.Utils.SetSelf((int)data, self, obj); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Transform), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Transform>(false); obj.RemovePlane(Arg0); Puerts.Utils.SetSelf((int)data, self, obj); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to RemovePlane"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetPlane(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.CollisionModule)Puerts.Utils.GetSelf((int)data, self); { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.Transform>(false); obj.SetPlane(Arg0,Arg1); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetPlane(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.CollisionModule)Puerts.Utils.GetSelf((int)data, self); { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); var result = obj.GetPlane(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_enabled(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.CollisionModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.enabled; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_enabled(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.CollisionModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.enabled = argHelper.GetBoolean(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_type(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.CollisionModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.type; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_type(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.CollisionModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.type = (UnityEngine.ParticleSystemCollisionType)argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_mode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.CollisionModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.mode; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_mode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.CollisionModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.mode = (UnityEngine.ParticleSystemCollisionMode)argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_dampen(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.CollisionModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.dampen; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_dampen(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.CollisionModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.dampen = argHelper.Get<UnityEngine.ParticleSystem.MinMaxCurve>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_dampenMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.CollisionModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.dampenMultiplier; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_dampenMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.CollisionModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.dampenMultiplier = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_bounce(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.CollisionModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.bounce; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_bounce(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.CollisionModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.bounce = argHelper.Get<UnityEngine.ParticleSystem.MinMaxCurve>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_bounceMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.CollisionModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.bounceMultiplier; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_bounceMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.CollisionModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.bounceMultiplier = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_lifetimeLoss(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.CollisionModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.lifetimeLoss; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_lifetimeLoss(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.CollisionModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.lifetimeLoss = argHelper.Get<UnityEngine.ParticleSystem.MinMaxCurve>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_lifetimeLossMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.CollisionModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.lifetimeLossMultiplier; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_lifetimeLossMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.CollisionModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.lifetimeLossMultiplier = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_minKillSpeed(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.CollisionModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.minKillSpeed; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_minKillSpeed(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.CollisionModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.minKillSpeed = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_maxKillSpeed(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.CollisionModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.maxKillSpeed; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_maxKillSpeed(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.CollisionModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.maxKillSpeed = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_collidesWith(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.CollisionModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.collidesWith; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_collidesWith(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.CollisionModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.collidesWith = argHelper.Get<UnityEngine.LayerMask>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_enableDynamicColliders(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.CollisionModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.enableDynamicColliders; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_enableDynamicColliders(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.CollisionModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.enableDynamicColliders = argHelper.GetBoolean(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_maxCollisionShapes(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.CollisionModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.maxCollisionShapes; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_maxCollisionShapes(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.CollisionModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.maxCollisionShapes = argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_quality(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.CollisionModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.quality; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_quality(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.CollisionModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.quality = (UnityEngine.ParticleSystemCollisionQuality)argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_voxelSize(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.CollisionModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.voxelSize; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_voxelSize(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.CollisionModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.voxelSize = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_radiusScale(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.CollisionModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.radiusScale; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_radiusScale(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.CollisionModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.radiusScale = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_sendCollisionMessages(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.CollisionModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.sendCollisionMessages; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_sendCollisionMessages(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.CollisionModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.sendCollisionMessages = argHelper.GetBoolean(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_colliderForce(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.CollisionModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.colliderForce; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_colliderForce(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.CollisionModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.colliderForce = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_multiplyColliderForceByCollisionAngle(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.CollisionModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.multiplyColliderForceByCollisionAngle; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_multiplyColliderForceByCollisionAngle(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.CollisionModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.multiplyColliderForceByCollisionAngle = argHelper.GetBoolean(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_multiplyColliderForceByParticleSpeed(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.CollisionModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.multiplyColliderForceByParticleSpeed; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_multiplyColliderForceByParticleSpeed(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.CollisionModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.multiplyColliderForceByParticleSpeed = argHelper.GetBoolean(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_multiplyColliderForceByParticleSize(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.CollisionModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.multiplyColliderForceByParticleSize; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_multiplyColliderForceByParticleSize(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.CollisionModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.multiplyColliderForceByParticleSize = argHelper.GetBoolean(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_planeCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.CollisionModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.planeCount; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "AddPlane", IsStatic = false}, M_AddPlane }, { new Puerts.MethodKey {Name = "RemovePlane", IsStatic = false}, M_RemovePlane }, { new Puerts.MethodKey {Name = "SetPlane", IsStatic = false}, M_SetPlane }, { new Puerts.MethodKey {Name = "GetPlane", IsStatic = false}, M_GetPlane }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"enabled", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_enabled, Setter = S_enabled} }, {"type", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_type, Setter = S_type} }, {"mode", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_mode, Setter = S_mode} }, {"dampen", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_dampen, Setter = S_dampen} }, {"dampenMultiplier", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_dampenMultiplier, Setter = S_dampenMultiplier} }, {"bounce", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_bounce, Setter = S_bounce} }, {"bounceMultiplier", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_bounceMultiplier, Setter = S_bounceMultiplier} }, {"lifetimeLoss", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_lifetimeLoss, Setter = S_lifetimeLoss} }, {"lifetimeLossMultiplier", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_lifetimeLossMultiplier, Setter = S_lifetimeLossMultiplier} }, {"minKillSpeed", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_minKillSpeed, Setter = S_minKillSpeed} }, {"maxKillSpeed", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_maxKillSpeed, Setter = S_maxKillSpeed} }, {"collidesWith", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_collidesWith, Setter = S_collidesWith} }, {"enableDynamicColliders", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_enableDynamicColliders, Setter = S_enableDynamicColliders} }, {"maxCollisionShapes", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_maxCollisionShapes, Setter = S_maxCollisionShapes} }, {"quality", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_quality, Setter = S_quality} }, {"voxelSize", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_voxelSize, Setter = S_voxelSize} }, {"radiusScale", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_radiusScale, Setter = S_radiusScale} }, {"sendCollisionMessages", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_sendCollisionMessages, Setter = S_sendCollisionMessages} }, {"colliderForce", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_colliderForce, Setter = S_colliderForce} }, {"multiplyColliderForceByCollisionAngle", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_multiplyColliderForceByCollisionAngle, Setter = S_multiplyColliderForceByCollisionAngle} }, {"multiplyColliderForceByParticleSpeed", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_multiplyColliderForceByParticleSpeed, Setter = S_multiplyColliderForceByParticleSpeed} }, {"multiplyColliderForceByParticleSize", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_multiplyColliderForceByParticleSize, Setter = S_multiplyColliderForceByParticleSize} }, {"planeCount", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_planeCount, Setter = null} }, } }; } } } <|start_filename|>ProtoProjects/Csharp_Unity/Assets/Gen/test/Dyn.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; namespace proto.test { public abstract class Dyn : Bright.Serialization.BeanBase { public Dyn() { } public Dyn(Bright.Common.NotNullInitialization _) { } public static void SerializeDyn(ByteBuf _buf, Dyn x) { if (x != null) { _buf.WriteInt(x.GetTypeId()); x.Serialize(_buf); } else { _buf.WriteInt(0); } } public static Dyn DeserializeDyn(ByteBuf _buf) { test.Dyn x; switch (_buf.ReadInt()) { case 0 : return null; case test.Child2.__ID__: x = new test.Child2(); break; case test.Child31.__ID__: x = new test.Child31(); break; case test.Child32.__ID__: x = new test.Child32(); break; default: throw new SerializationException(); } x.Deserialize(_buf); return x; } public int A1; } } <|start_filename|>Projects/java_json/src/gen/cfg/ai/Blackboard.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.ai; import com.google.gson.JsonElement; import com.google.gson.JsonObject; public final class Blackboard { public Blackboard(JsonObject __json__) { name = __json__.get("name").getAsString(); desc = __json__.get("desc").getAsString(); parentName = __json__.get("parent_name").getAsString(); { com.google.gson.JsonArray _json0_ = __json__.get("keys").getAsJsonArray(); keys = new java.util.ArrayList<cfg.ai.BlackboardKey>(_json0_.size()); for(JsonElement __e : _json0_) { cfg.ai.BlackboardKey __v; __v = new cfg.ai.BlackboardKey(__e.getAsJsonObject()); keys.add(__v); } } } public Blackboard(String name, String desc, String parent_name, java.util.ArrayList<cfg.ai.BlackboardKey> keys ) { this.name = name; this.desc = desc; this.parentName = parent_name; this.keys = keys; } public static Blackboard deserializeBlackboard(JsonObject __json__) { return new Blackboard(__json__); } public final String name; public final String desc; public final String parentName; public cfg.ai.Blackboard parentName_Ref; public final java.util.ArrayList<cfg.ai.BlackboardKey> keys; public void resolve(java.util.HashMap<String, Object> _tables) { this.parentName_Ref = ((cfg.ai.TbBlackboard)_tables.get("ai.TbBlackboard")).get(parentName); for(cfg.ai.BlackboardKey _e : keys) { if (_e != null) _e.resolve(_tables); } } @Override public String toString() { return "{ " + "name:" + name + "," + "desc:" + desc + "," + "parentName:" + parentName + "," + "keys:" + keys + "," + "}"; } } <|start_filename|>Projects/Go_json/gen/src/cfg/error.ErrorStyleDlgOkCancel.go<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg import "errors" type ErrorErrorStyleDlgOkCancel struct { Btn1Name string Btn2Name string } const TypeId_ErrorErrorStyleDlgOkCancel = 971221414 func (*ErrorErrorStyleDlgOkCancel) GetTypeId() int32 { return 971221414 } func (_v *ErrorErrorStyleDlgOkCancel)Deserialize(_buf map[string]interface{}) (err error) { { var _ok_ bool; if _v.Btn1Name, _ok_ = _buf["btn1_name"].(string); !_ok_ { err = errors.New("btn1_name error"); return } } { var _ok_ bool; if _v.Btn2Name, _ok_ = _buf["btn2_name"].(string); !_ok_ { err = errors.New("btn2_name error"); return } } return } func DeserializeErrorErrorStyleDlgOkCancel(_buf map[string]interface{}) (*ErrorErrorStyleDlgOkCancel, error) { v := &ErrorErrorStyleDlgOkCancel{} if err := v.Deserialize(_buf); err == nil { return v, nil } else { return nil, err } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_SpriteMask_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_SpriteMask_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.SpriteMask(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.SpriteMask), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_frontSortingLayerID(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SpriteMask; var result = obj.frontSortingLayerID; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_frontSortingLayerID(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SpriteMask; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.frontSortingLayerID = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_frontSortingOrder(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SpriteMask; var result = obj.frontSortingOrder; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_frontSortingOrder(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SpriteMask; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.frontSortingOrder = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_backSortingLayerID(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SpriteMask; var result = obj.backSortingLayerID; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_backSortingLayerID(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SpriteMask; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.backSortingLayerID = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_backSortingOrder(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SpriteMask; var result = obj.backSortingOrder; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_backSortingOrder(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SpriteMask; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.backSortingOrder = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_alphaCutoff(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SpriteMask; var result = obj.alphaCutoff; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_alphaCutoff(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SpriteMask; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.alphaCutoff = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_sprite(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SpriteMask; var result = obj.sprite; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_sprite(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SpriteMask; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.sprite = argHelper.Get<UnityEngine.Sprite>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_isCustomRangeActive(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SpriteMask; var result = obj.isCustomRangeActive; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_isCustomRangeActive(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SpriteMask; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.isCustomRangeActive = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_spriteSortPoint(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SpriteMask; var result = obj.spriteSortPoint; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_spriteSortPoint(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SpriteMask; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.spriteSortPoint = (UnityEngine.SpriteSortPoint)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"frontSortingLayerID", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_frontSortingLayerID, Setter = S_frontSortingLayerID} }, {"frontSortingOrder", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_frontSortingOrder, Setter = S_frontSortingOrder} }, {"backSortingLayerID", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_backSortingLayerID, Setter = S_backSortingLayerID} }, {"backSortingOrder", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_backSortingOrder, Setter = S_backSortingOrder} }, {"alphaCutoff", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_alphaCutoff, Setter = S_alphaCutoff} }, {"sprite", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_sprite, Setter = S_sprite} }, {"isCustomRangeActive", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_isCustomRangeActive, Setter = S_isCustomRangeActive} }, {"spriteSortPoint", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_spriteSortPoint, Setter = S_spriteSortPoint} }, } }; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_AsyncOperation_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_AsyncOperation_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.AsyncOperation(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.AsyncOperation), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_isDone(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AsyncOperation; var result = obj.isDone; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_progress(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AsyncOperation; var result = obj.progress; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_priority(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AsyncOperation; var result = obj.priority; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_priority(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AsyncOperation; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.priority = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_allowSceneActivation(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AsyncOperation; var result = obj.allowSceneActivation; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_allowSceneActivation(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AsyncOperation; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.allowSceneActivation = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void A_completed(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AsyncOperation; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.completed += argHelper.Get<System.Action<UnityEngine.AsyncOperation>>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void R_completed(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AsyncOperation; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.completed -= argHelper.Get<System.Action<UnityEngine.AsyncOperation>>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "add_completed", IsStatic = false}, A_completed}, { new Puerts.MethodKey {Name = "remove_completed", IsStatic = false}, R_completed}, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"isDone", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_isDone, Setter = null} }, {"progress", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_progress, Setter = null} }, {"priority", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_priority, Setter = S_priority} }, {"allowSceneActivation", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_allowSceneActivation, Setter = S_allowSceneActivation} }, } }; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_Font_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_Font_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { if (paramLen == 0) { { var result = new UnityEngine.Font(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.Font), result); } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var result = new UnityEngine.Font(Arg0); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.Font), result); } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.Font constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_CreateDynamicFontFromOSFont(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.GetInt32(false); var result = UnityEngine.Font.CreateDynamicFontFromOSFont(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(string[]), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<string[]>(false); var Arg1 = argHelper1.GetInt32(false); var result = UnityEngine.Font.CreateDynamicFontFromOSFont(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to CreateDynamicFontFromOSFont"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetMaxVertsForString(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetString(false); var result = UnityEngine.Font.GetMaxVertsForString(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_HasCharacter(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Font; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.Char>(false); var result = obj.HasCharacter(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetOSInstalledFontNames(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { { var result = UnityEngine.Font.GetOSInstalledFontNames(); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetPathsToOSFonts(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { { var result = UnityEngine.Font.GetPathsToOSFonts(); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetCharacterInfo(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Font; if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.CharacterInfo), true, true) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<System.Char>(false); var Arg1 = argHelper1.Get<UnityEngine.CharacterInfo>(true); var Arg2 = argHelper2.GetInt32(false); var Arg3 = (UnityEngine.FontStyle)argHelper3.GetInt32(false); var result = obj.GetCharacterInfo(Arg0,out Arg1,Arg2,Arg3); argHelper1.SetByRefValue(Arg1); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.CharacterInfo), true, true) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<System.Char>(false); var Arg1 = argHelper1.Get<UnityEngine.CharacterInfo>(true); var Arg2 = argHelper2.GetInt32(false); var result = obj.GetCharacterInfo(Arg0,out Arg1,Arg2); argHelper1.SetByRefValue(Arg1); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.CharacterInfo), true, true)) { var Arg0 = argHelper0.Get<System.Char>(false); var Arg1 = argHelper1.Get<UnityEngine.CharacterInfo>(true); var result = obj.GetCharacterInfo(Arg0,out Arg1); argHelper1.SetByRefValue(Arg1); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetCharacterInfo"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_RequestCharactersInTexture(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Font; if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = (UnityEngine.FontStyle)argHelper2.GetInt32(false); obj.RequestCharactersInTexture(Arg0,Arg1,Arg2); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.GetInt32(false); obj.RequestCharactersInTexture(Arg0,Arg1); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); obj.RequestCharactersInTexture(Arg0); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to RequestCharactersInTexture"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_material(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Font; var result = obj.material; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_material(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Font; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.material = argHelper.Get<UnityEngine.Material>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_fontNames(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Font; var result = obj.fontNames; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_fontNames(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Font; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.fontNames = argHelper.Get<string[]>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_dynamic(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Font; var result = obj.dynamic; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_ascent(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Font; var result = obj.ascent; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_fontSize(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Font; var result = obj.fontSize; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_characterInfo(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Font; var result = obj.characterInfo; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_characterInfo(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Font; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.characterInfo = argHelper.Get<UnityEngine.CharacterInfo[]>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_lineHeight(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Font; var result = obj.lineHeight; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void A_textureRebuilt(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.Font.textureRebuilt += argHelper.Get<System.Action<UnityEngine.Font>>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void R_textureRebuilt(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.Font.textureRebuilt -= argHelper.Get<System.Action<UnityEngine.Font>>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "CreateDynamicFontFromOSFont", IsStatic = true}, F_CreateDynamicFontFromOSFont }, { new Puerts.MethodKey {Name = "GetMaxVertsForString", IsStatic = true}, F_GetMaxVertsForString }, { new Puerts.MethodKey {Name = "HasCharacter", IsStatic = false}, M_HasCharacter }, { new Puerts.MethodKey {Name = "GetOSInstalledFontNames", IsStatic = true}, F_GetOSInstalledFontNames }, { new Puerts.MethodKey {Name = "GetPathsToOSFonts", IsStatic = true}, F_GetPathsToOSFonts }, { new Puerts.MethodKey {Name = "GetCharacterInfo", IsStatic = false}, M_GetCharacterInfo }, { new Puerts.MethodKey {Name = "RequestCharactersInTexture", IsStatic = false}, M_RequestCharactersInTexture }, { new Puerts.MethodKey {Name = "add_textureRebuilt", IsStatic = true}, A_textureRebuilt}, { new Puerts.MethodKey {Name = "remove_textureRebuilt", IsStatic = true}, R_textureRebuilt}, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"material", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_material, Setter = S_material} }, {"fontNames", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_fontNames, Setter = S_fontNames} }, {"dynamic", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_dynamic, Setter = null} }, {"ascent", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_ascent, Setter = null} }, {"fontSize", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_fontSize, Setter = null} }, {"characterInfo", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_characterInfo, Setter = S_characterInfo} }, {"lineHeight", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_lineHeight, Setter = null} }, } }; } } } <|start_filename|>Projects/DataTemplates/template_lua/test_tbteststring.lua<|end_filename|> return { [1] = {id=1,s1="asfas",cs1={id=1,s2="asf",s3="aaa",},cs2={id=1,s2="asf",s3="aaa",},}, [2] = {id=2,s1="adsf\"",cs1={id=2,s2="",s3="bbb",},cs2={id=2,s2="",s3="bbb",},}, [3] = {id=3,s1="升级到10级\"\"",cs1={id=3,s2="asdfas",s3="",},cs2={id=3,s2="asdfas",s3="",},}, [4] = {id=4,s1="asdfa",cs1={id=4,s2="",s3="",},cs2={id=4,s2="",s3="",},}, } <|start_filename|>Projects/Go_json/gen/src/cfg/condition.MultiRoleCondition.go<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg import "errors" type ConditionMultiRoleCondition struct { Conditions []interface{} } const TypeId_ConditionMultiRoleCondition = 934079583 func (*ConditionMultiRoleCondition) GetTypeId() int32 { return 934079583 } func (_v *ConditionMultiRoleCondition)Deserialize(_buf map[string]interface{}) (err error) { { var _arr_ []interface{} var _ok_ bool if _arr_, _ok_ = _buf["conditions"].([]interface{}); !_ok_ { err = errors.New("conditions error"); return } _v.Conditions = make([]interface{}, 0, len(_arr_)) for _, _e_ := range _arr_ { var _list_v_ interface{} { var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _e_.(map[string]interface{}); !_ok_ { err = errors.New("_list_v_ error"); return }; if _list_v_, err = DeserializeConditionRoleCondition(_x_); err != nil { return } } _v.Conditions = append(_v.Conditions, _list_v_) } } return } func DeserializeConditionMultiRoleCondition(_buf map[string]interface{}) (*ConditionMultiRoleCondition, error) { v := &ConditionMultiRoleCondition{} if err := v.Deserialize(_buf); err == nil { return v, nil } else { return nil, err } } <|start_filename|>Projects/java_json/src/gen/cfg/test/ExcelFromJsonMultiRow.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.test; import com.google.gson.JsonElement; import com.google.gson.JsonObject; public final class ExcelFromJsonMultiRow { public ExcelFromJsonMultiRow(JsonObject __json__) { id = __json__.get("id").getAsInt(); x = __json__.get("x").getAsInt(); { com.google.gson.JsonArray _json0_ = __json__.get("items").getAsJsonArray(); items = new java.util.ArrayList<cfg.test.TestRow>(_json0_.size()); for(JsonElement __e : _json0_) { cfg.test.TestRow __v; __v = new cfg.test.TestRow(__e.getAsJsonObject()); items.add(__v); } } } public ExcelFromJsonMultiRow(int id, int x, java.util.ArrayList<cfg.test.TestRow> items ) { this.id = id; this.x = x; this.items = items; } public static ExcelFromJsonMultiRow deserializeExcelFromJsonMultiRow(JsonObject __json__) { return new ExcelFromJsonMultiRow(__json__); } public final int id; public final int x; public final java.util.ArrayList<cfg.test.TestRow> items; public void resolve(java.util.HashMap<String, Object> _tables) { for(cfg.test.TestRow _e : items) { if (_e != null) _e.resolve(_tables); } } @Override public String toString() { return "{ " + "id:" + id + "," + "x:" + x + "," + "items:" + items + "," + "}"; } } <|start_filename|>Projects/GenerateDatas/convert_lua/tag.TbTestTag/100.lua<|end_filename|> return { id = 100, value = "导出", } <|start_filename|>Projects/GenerateDatas/convert_lua/test.TbDetectCsvEncoding/13.lua<|end_filename|> return { id = 13, name = "工枯加盟仍", } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_PhysicsJobOptions2D_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_PhysicsJobOptions2D_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.PhysicsJobOptions2D constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_useMultithreading(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.PhysicsJobOptions2D)Puerts.Utils.GetSelf((int)data, self); var result = obj.useMultithreading; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_useMultithreading(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.PhysicsJobOptions2D)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.useMultithreading = argHelper.GetBoolean(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_useConsistencySorting(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.PhysicsJobOptions2D)Puerts.Utils.GetSelf((int)data, self); var result = obj.useConsistencySorting; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_useConsistencySorting(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.PhysicsJobOptions2D)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.useConsistencySorting = argHelper.GetBoolean(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_interpolationPosesPerJob(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.PhysicsJobOptions2D)Puerts.Utils.GetSelf((int)data, self); var result = obj.interpolationPosesPerJob; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_interpolationPosesPerJob(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.PhysicsJobOptions2D)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.interpolationPosesPerJob = argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_newContactsPerJob(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.PhysicsJobOptions2D)Puerts.Utils.GetSelf((int)data, self); var result = obj.newContactsPerJob; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_newContactsPerJob(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.PhysicsJobOptions2D)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.newContactsPerJob = argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_collideContactsPerJob(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.PhysicsJobOptions2D)Puerts.Utils.GetSelf((int)data, self); var result = obj.collideContactsPerJob; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_collideContactsPerJob(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.PhysicsJobOptions2D)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.collideContactsPerJob = argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_clearFlagsPerJob(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.PhysicsJobOptions2D)Puerts.Utils.GetSelf((int)data, self); var result = obj.clearFlagsPerJob; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_clearFlagsPerJob(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.PhysicsJobOptions2D)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.clearFlagsPerJob = argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_clearBodyForcesPerJob(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.PhysicsJobOptions2D)Puerts.Utils.GetSelf((int)data, self); var result = obj.clearBodyForcesPerJob; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_clearBodyForcesPerJob(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.PhysicsJobOptions2D)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.clearBodyForcesPerJob = argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_syncDiscreteFixturesPerJob(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.PhysicsJobOptions2D)Puerts.Utils.GetSelf((int)data, self); var result = obj.syncDiscreteFixturesPerJob; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_syncDiscreteFixturesPerJob(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.PhysicsJobOptions2D)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.syncDiscreteFixturesPerJob = argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_syncContinuousFixturesPerJob(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.PhysicsJobOptions2D)Puerts.Utils.GetSelf((int)data, self); var result = obj.syncContinuousFixturesPerJob; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_syncContinuousFixturesPerJob(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.PhysicsJobOptions2D)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.syncContinuousFixturesPerJob = argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_findNearestContactsPerJob(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.PhysicsJobOptions2D)Puerts.Utils.GetSelf((int)data, self); var result = obj.findNearestContactsPerJob; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_findNearestContactsPerJob(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.PhysicsJobOptions2D)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.findNearestContactsPerJob = argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_updateTriggerContactsPerJob(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.PhysicsJobOptions2D)Puerts.Utils.GetSelf((int)data, self); var result = obj.updateTriggerContactsPerJob; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_updateTriggerContactsPerJob(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.PhysicsJobOptions2D)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.updateTriggerContactsPerJob = argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_islandSolverCostThreshold(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.PhysicsJobOptions2D)Puerts.Utils.GetSelf((int)data, self); var result = obj.islandSolverCostThreshold; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_islandSolverCostThreshold(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.PhysicsJobOptions2D)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.islandSolverCostThreshold = argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_islandSolverBodyCostScale(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.PhysicsJobOptions2D)Puerts.Utils.GetSelf((int)data, self); var result = obj.islandSolverBodyCostScale; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_islandSolverBodyCostScale(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.PhysicsJobOptions2D)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.islandSolverBodyCostScale = argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_islandSolverContactCostScale(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.PhysicsJobOptions2D)Puerts.Utils.GetSelf((int)data, self); var result = obj.islandSolverContactCostScale; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_islandSolverContactCostScale(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.PhysicsJobOptions2D)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.islandSolverContactCostScale = argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_islandSolverJointCostScale(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.PhysicsJobOptions2D)Puerts.Utils.GetSelf((int)data, self); var result = obj.islandSolverJointCostScale; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_islandSolverJointCostScale(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.PhysicsJobOptions2D)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.islandSolverJointCostScale = argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_islandSolverBodiesPerJob(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.PhysicsJobOptions2D)Puerts.Utils.GetSelf((int)data, self); var result = obj.islandSolverBodiesPerJob; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_islandSolverBodiesPerJob(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.PhysicsJobOptions2D)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.islandSolverBodiesPerJob = argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_islandSolverContactsPerJob(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.PhysicsJobOptions2D)Puerts.Utils.GetSelf((int)data, self); var result = obj.islandSolverContactsPerJob; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_islandSolverContactsPerJob(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.PhysicsJobOptions2D)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.islandSolverContactsPerJob = argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"useMultithreading", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_useMultithreading, Setter = S_useMultithreading} }, {"useConsistencySorting", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_useConsistencySorting, Setter = S_useConsistencySorting} }, {"interpolationPosesPerJob", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_interpolationPosesPerJob, Setter = S_interpolationPosesPerJob} }, {"newContactsPerJob", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_newContactsPerJob, Setter = S_newContactsPerJob} }, {"collideContactsPerJob", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_collideContactsPerJob, Setter = S_collideContactsPerJob} }, {"clearFlagsPerJob", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_clearFlagsPerJob, Setter = S_clearFlagsPerJob} }, {"clearBodyForcesPerJob", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_clearBodyForcesPerJob, Setter = S_clearBodyForcesPerJob} }, {"syncDiscreteFixturesPerJob", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_syncDiscreteFixturesPerJob, Setter = S_syncDiscreteFixturesPerJob} }, {"syncContinuousFixturesPerJob", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_syncContinuousFixturesPerJob, Setter = S_syncContinuousFixturesPerJob} }, {"findNearestContactsPerJob", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_findNearestContactsPerJob, Setter = S_findNearestContactsPerJob} }, {"updateTriggerContactsPerJob", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_updateTriggerContactsPerJob, Setter = S_updateTriggerContactsPerJob} }, {"islandSolverCostThreshold", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_islandSolverCostThreshold, Setter = S_islandSolverCostThreshold} }, {"islandSolverBodyCostScale", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_islandSolverBodyCostScale, Setter = S_islandSolverBodyCostScale} }, {"islandSolverContactCostScale", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_islandSolverContactCostScale, Setter = S_islandSolverContactCostScale} }, {"islandSolverJointCostScale", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_islandSolverJointCostScale, Setter = S_islandSolverJointCostScale} }, {"islandSolverBodiesPerJob", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_islandSolverBodiesPerJob, Setter = S_islandSolverBodiesPerJob} }, {"islandSolverContactsPerJob", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_islandSolverContactsPerJob, Setter = S_islandSolverContactsPerJob} }, } }; } } } <|start_filename|>Projects/Java_bin/src/main/gen/cfg/error/ErrorInfo.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.error; import bright.serialization.*; public final class ErrorInfo { public ErrorInfo(ByteBuf _buf) { code = _buf.readString(); desc = _buf.readString(); style = cfg.error.ErrorStyle.deserializeErrorStyle(_buf); } public ErrorInfo(String code, String desc, cfg.error.ErrorStyle style ) { this.code = code; this.desc = desc; this.style = style; } public final String code; public final String desc; public final cfg.error.ErrorStyle style; public void resolve(java.util.HashMap<String, Object> _tables) { if (style != null) {style.resolve(_tables);} } @Override public String toString() { return "{ " + "code:" + code + "," + "desc:" + desc + "," + "style:" + style + "," + "}"; } } <|start_filename|>Projects/Protobuf_bin/gen_pb_code.bat<|end_filename|> protoc -I=pb_schemas --csharp_out=Gen pb_schemas\config.proto pause <|start_filename|>Projects/GenerateDatas/convert_lua/error.TbCodeInfo/102.lua<|end_filename|> return { code = 102, key = "ROLE_CREATE_NAME_EXCEED_MAX_LENGTH", } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_Camera_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_Camera_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.Camera(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.Camera), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Reset(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; { { obj.Reset(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ResetTransparencySortSettings(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; { { obj.ResetTransparencySortSettings(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ResetAspect(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; { { obj.ResetAspect(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ResetCullingMatrix(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; { { obj.ResetCullingMatrix(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetReplacementShader(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<UnityEngine.Shader>(false); var Arg1 = argHelper1.GetString(false); obj.SetReplacementShader(Arg0,Arg1); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ResetReplacementShader(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; { { obj.ResetReplacementShader(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetGateFittedFieldOfView(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; { { var result = obj.GetGateFittedFieldOfView(); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetGateFittedLensShift(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; { { var result = obj.GetGateFittedLensShift(); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetTargetBuffers(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.RenderBuffer), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.RenderBuffer), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.RenderBuffer>(false); var Arg1 = argHelper1.Get<UnityEngine.RenderBuffer>(false); obj.SetTargetBuffers(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RenderBuffer[]), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.RenderBuffer), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.RenderBuffer[]>(false); var Arg1 = argHelper1.Get<UnityEngine.RenderBuffer>(false); obj.SetTargetBuffers(Arg0,Arg1); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SetTargetBuffers"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ResetWorldToCameraMatrix(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; { { obj.ResetWorldToCameraMatrix(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ResetProjectionMatrix(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; { { obj.ResetProjectionMatrix(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_CalculateObliqueMatrix(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Vector4>(false); var result = obj.CalculateObliqueMatrix(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_WorldToScreenPoint(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = (UnityEngine.Camera.MonoOrStereoscopicEye)argHelper1.GetInt32(false); var result = obj.WorldToScreenPoint(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var result = obj.WorldToScreenPoint(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to WorldToScreenPoint"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_WorldToViewportPoint(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = (UnityEngine.Camera.MonoOrStereoscopicEye)argHelper1.GetInt32(false); var result = obj.WorldToViewportPoint(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var result = obj.WorldToViewportPoint(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to WorldToViewportPoint"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ViewportToWorldPoint(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = (UnityEngine.Camera.MonoOrStereoscopicEye)argHelper1.GetInt32(false); var result = obj.ViewportToWorldPoint(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var result = obj.ViewportToWorldPoint(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to ViewportToWorldPoint"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ScreenToWorldPoint(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = (UnityEngine.Camera.MonoOrStereoscopicEye)argHelper1.GetInt32(false); var result = obj.ScreenToWorldPoint(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var result = obj.ScreenToWorldPoint(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to ScreenToWorldPoint"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ScreenToViewportPoint(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var result = obj.ScreenToViewportPoint(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ViewportToScreenPoint(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var result = obj.ViewportToScreenPoint(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ViewportPointToRay(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = (UnityEngine.Camera.MonoOrStereoscopicEye)argHelper1.GetInt32(false); var result = obj.ViewportPointToRay(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var result = obj.ViewportPointToRay(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to ViewportPointToRay"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ScreenPointToRay(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = (UnityEngine.Camera.MonoOrStereoscopicEye)argHelper1.GetInt32(false); var result = obj.ScreenPointToRay(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var result = obj.ScreenPointToRay(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to ScreenPointToRay"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_CalculateFrustumCorners(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = (UnityEngine.Camera.MonoOrStereoscopicEye)argHelper2.GetInt32(false); var Arg3 = argHelper3.Get<UnityEngine.Vector3[]>(false); obj.CalculateFrustumCorners(Arg0,Arg1,Arg2,Arg3); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_CalculateProjectionMatrixFromPhysicalProperties(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 7) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Matrix4x4), true, true) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Camera.GateFitParameters), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Matrix4x4>(true); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.Get<UnityEngine.Vector2>(false); var Arg3 = argHelper3.Get<UnityEngine.Vector2>(false); var Arg4 = argHelper4.GetFloat(false); var Arg5 = argHelper5.GetFloat(false); var Arg6 = argHelper6.Get<UnityEngine.Camera.GateFitParameters>(false); UnityEngine.Camera.CalculateProjectionMatrixFromPhysicalProperties(out Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6); argHelper0.SetByRefValue(Arg0); return; } } if (paramLen == 6) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Matrix4x4), true, true) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Matrix4x4>(true); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.Get<UnityEngine.Vector2>(false); var Arg3 = argHelper3.Get<UnityEngine.Vector2>(false); var Arg4 = argHelper4.GetFloat(false); var Arg5 = argHelper5.GetFloat(false); UnityEngine.Camera.CalculateProjectionMatrixFromPhysicalProperties(out Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); argHelper0.SetByRefValue(Arg0); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to CalculateProjectionMatrixFromPhysicalProperties"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_FocalLengthToFieldOfView(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.GetFloat(false); var result = UnityEngine.Camera.FocalLengthToFieldOfView(Arg0,Arg1); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_FieldOfViewToFocalLength(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.GetFloat(false); var result = UnityEngine.Camera.FieldOfViewToFocalLength(Arg0,Arg1); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_HorizontalToVerticalFieldOfView(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.GetFloat(false); var result = UnityEngine.Camera.HorizontalToVerticalFieldOfView(Arg0,Arg1); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_VerticalToHorizontalFieldOfView(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.GetFloat(false); var result = UnityEngine.Camera.VerticalToHorizontalFieldOfView(Arg0,Arg1); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetStereoNonJitteredProjectionMatrix(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = (UnityEngine.Camera.StereoscopicEye)argHelper0.GetInt32(false); var result = obj.GetStereoNonJitteredProjectionMatrix(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetStereoViewMatrix(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = (UnityEngine.Camera.StereoscopicEye)argHelper0.GetInt32(false); var result = obj.GetStereoViewMatrix(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_CopyStereoDeviceProjectionMatrixToNonJittered(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = (UnityEngine.Camera.StereoscopicEye)argHelper0.GetInt32(false); obj.CopyStereoDeviceProjectionMatrixToNonJittered(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetStereoProjectionMatrix(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = (UnityEngine.Camera.StereoscopicEye)argHelper0.GetInt32(false); var result = obj.GetStereoProjectionMatrix(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetStereoProjectionMatrix(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = (UnityEngine.Camera.StereoscopicEye)argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.Matrix4x4>(false); obj.SetStereoProjectionMatrix(Arg0,Arg1); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ResetStereoProjectionMatrices(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; { { obj.ResetStereoProjectionMatrices(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetStereoViewMatrix(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = (UnityEngine.Camera.StereoscopicEye)argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.Matrix4x4>(false); obj.SetStereoViewMatrix(Arg0,Arg1); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ResetStereoViewMatrices(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; { { obj.ResetStereoViewMatrices(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetAllCameras(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Camera[]>(false); var result = UnityEngine.Camera.GetAllCameras(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_RenderToCubemap(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Cubemap), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Cubemap>(false); var Arg1 = argHelper1.GetInt32(false); var result = obj.RenderToCubemap(Arg0,Arg1); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RenderTexture), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.RenderTexture>(false); var Arg1 = argHelper1.GetInt32(false); var result = obj.RenderToCubemap(Arg0,Arg1); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Cubemap), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Cubemap>(false); var result = obj.RenderToCubemap(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RenderTexture), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.RenderTexture>(false); var result = obj.RenderToCubemap(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RenderTexture), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.RenderTexture>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = (UnityEngine.Camera.MonoOrStereoscopicEye)argHelper2.GetInt32(false); var result = obj.RenderToCubemap(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to RenderToCubemap"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Render(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; { { obj.Render(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_RenderWithShader(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<UnityEngine.Shader>(false); var Arg1 = argHelper1.GetString(false); obj.RenderWithShader(Arg0,Arg1); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_RenderDontRestore(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; { { obj.RenderDontRestore(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SubmitRenderRequests(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.Collections.Generic.List<UnityEngine.Camera.RenderRequest>>(false); obj.SubmitRenderRequests(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_SetupCurrent(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Camera>(false); UnityEngine.Camera.SetupCurrent(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_CopyFrom(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Camera>(false); obj.CopyFrom(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_RemoveCommandBuffers(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = (UnityEngine.Rendering.CameraEvent)argHelper0.GetInt32(false); obj.RemoveCommandBuffers(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_RemoveAllCommandBuffers(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; { { obj.RemoveAllCommandBuffers(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_AddCommandBuffer(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = (UnityEngine.Rendering.CameraEvent)argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.Rendering.CommandBuffer>(false); obj.AddCommandBuffer(Arg0,Arg1); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_AddCommandBufferAsync(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = (UnityEngine.Rendering.CameraEvent)argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.Rendering.CommandBuffer>(false); var Arg2 = (UnityEngine.Rendering.ComputeQueueType)argHelper2.GetInt32(false); obj.AddCommandBufferAsync(Arg0,Arg1,Arg2); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_RemoveCommandBuffer(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = (UnityEngine.Rendering.CameraEvent)argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.Rendering.CommandBuffer>(false); obj.RemoveCommandBuffer(Arg0,Arg1); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetCommandBuffers(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = (UnityEngine.Rendering.CameraEvent)argHelper0.GetInt32(false); var result = obj.GetCommandBuffers(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_TryGetCullingParameters(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rendering.ScriptableCullingParameters), true, true)) { var Arg0 = argHelper0.Get<UnityEngine.Rendering.ScriptableCullingParameters>(true); var result = obj.TryGetCullingParameters(out Arg0); argHelper0.SetByRefValue(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rendering.ScriptableCullingParameters), true, true)) { var Arg0 = argHelper0.GetBoolean(false); var Arg1 = argHelper1.Get<UnityEngine.Rendering.ScriptableCullingParameters>(true); var result = obj.TryGetCullingParameters(Arg0,out Arg1); argHelper1.SetByRefValue(Arg1); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to TryGetCullingParameters"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_nearClipPlane(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var result = obj.nearClipPlane; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_nearClipPlane(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.nearClipPlane = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_farClipPlane(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var result = obj.farClipPlane; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_farClipPlane(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.farClipPlane = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_fieldOfView(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var result = obj.fieldOfView; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_fieldOfView(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.fieldOfView = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_renderingPath(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var result = obj.renderingPath; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_renderingPath(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.renderingPath = (UnityEngine.RenderingPath)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_actualRenderingPath(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var result = obj.actualRenderingPath; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_allowHDR(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var result = obj.allowHDR; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_allowHDR(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.allowHDR = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_allowMSAA(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var result = obj.allowMSAA; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_allowMSAA(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.allowMSAA = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_allowDynamicResolution(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var result = obj.allowDynamicResolution; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_allowDynamicResolution(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.allowDynamicResolution = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_forceIntoRenderTexture(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var result = obj.forceIntoRenderTexture; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_forceIntoRenderTexture(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.forceIntoRenderTexture = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_orthographicSize(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var result = obj.orthographicSize; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_orthographicSize(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.orthographicSize = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_orthographic(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var result = obj.orthographic; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_orthographic(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.orthographic = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_opaqueSortMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var result = obj.opaqueSortMode; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_opaqueSortMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.opaqueSortMode = (UnityEngine.Rendering.OpaqueSortMode)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_transparencySortMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var result = obj.transparencySortMode; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_transparencySortMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.transparencySortMode = (UnityEngine.TransparencySortMode)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_transparencySortAxis(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var result = obj.transparencySortAxis; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_transparencySortAxis(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.transparencySortAxis = argHelper.Get<UnityEngine.Vector3>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_depth(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var result = obj.depth; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_depth(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.depth = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_aspect(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var result = obj.aspect; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_aspect(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.aspect = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_velocity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var result = obj.velocity; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_cullingMask(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var result = obj.cullingMask; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_cullingMask(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.cullingMask = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_eventMask(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var result = obj.eventMask; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_eventMask(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.eventMask = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_layerCullSpherical(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var result = obj.layerCullSpherical; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_layerCullSpherical(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.layerCullSpherical = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_cameraType(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var result = obj.cameraType; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_cameraType(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.cameraType = (UnityEngine.CameraType)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_overrideSceneCullingMask(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var result = obj.overrideSceneCullingMask; Puerts.PuertsDLL.ReturnBigInt(isolate, info, (long)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_overrideSceneCullingMask(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.overrideSceneCullingMask = argHelper.GetUInt64(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_layerCullDistances(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var result = obj.layerCullDistances; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_layerCullDistances(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.layerCullDistances = argHelper.Get<float[]>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_useOcclusionCulling(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var result = obj.useOcclusionCulling; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_useOcclusionCulling(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.useOcclusionCulling = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_cullingMatrix(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var result = obj.cullingMatrix; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_cullingMatrix(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.cullingMatrix = argHelper.Get<UnityEngine.Matrix4x4>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_backgroundColor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var result = obj.backgroundColor; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_backgroundColor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.backgroundColor = argHelper.Get<UnityEngine.Color>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_clearFlags(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var result = obj.clearFlags; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_clearFlags(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.clearFlags = (UnityEngine.CameraClearFlags)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_depthTextureMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var result = obj.depthTextureMode; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_depthTextureMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.depthTextureMode = (UnityEngine.DepthTextureMode)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_clearStencilAfterLightingPass(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var result = obj.clearStencilAfterLightingPass; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_clearStencilAfterLightingPass(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.clearStencilAfterLightingPass = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_usePhysicalProperties(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var result = obj.usePhysicalProperties; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_usePhysicalProperties(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.usePhysicalProperties = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_sensorSize(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var result = obj.sensorSize; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_sensorSize(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.sensorSize = argHelper.Get<UnityEngine.Vector2>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_lensShift(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var result = obj.lensShift; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_lensShift(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.lensShift = argHelper.Get<UnityEngine.Vector2>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_focalLength(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var result = obj.focalLength; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_focalLength(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.focalLength = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_gateFit(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var result = obj.gateFit; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_gateFit(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.gateFit = (UnityEngine.Camera.GateFitMode)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_rect(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var result = obj.rect; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_rect(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.rect = argHelper.Get<UnityEngine.Rect>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_pixelRect(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var result = obj.pixelRect; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_pixelRect(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.pixelRect = argHelper.Get<UnityEngine.Rect>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_pixelWidth(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var result = obj.pixelWidth; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_pixelHeight(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var result = obj.pixelHeight; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_scaledPixelWidth(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var result = obj.scaledPixelWidth; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_scaledPixelHeight(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var result = obj.scaledPixelHeight; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_targetTexture(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var result = obj.targetTexture; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_targetTexture(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.targetTexture = argHelper.Get<UnityEngine.RenderTexture>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_activeTexture(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var result = obj.activeTexture; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_targetDisplay(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var result = obj.targetDisplay; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_targetDisplay(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.targetDisplay = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_cameraToWorldMatrix(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var result = obj.cameraToWorldMatrix; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_worldToCameraMatrix(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var result = obj.worldToCameraMatrix; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_worldToCameraMatrix(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.worldToCameraMatrix = argHelper.Get<UnityEngine.Matrix4x4>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_projectionMatrix(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var result = obj.projectionMatrix; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_projectionMatrix(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.projectionMatrix = argHelper.Get<UnityEngine.Matrix4x4>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_nonJitteredProjectionMatrix(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var result = obj.nonJitteredProjectionMatrix; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_nonJitteredProjectionMatrix(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.nonJitteredProjectionMatrix = argHelper.Get<UnityEngine.Matrix4x4>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_useJitteredProjectionMatrixForTransparentRendering(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var result = obj.useJitteredProjectionMatrixForTransparentRendering; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_useJitteredProjectionMatrixForTransparentRendering(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.useJitteredProjectionMatrixForTransparentRendering = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_previousViewProjectionMatrix(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var result = obj.previousViewProjectionMatrix; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_main(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Camera.main; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_current(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Camera.current; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_scene(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var result = obj.scene; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_scene(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.scene = argHelper.Get<UnityEngine.SceneManagement.Scene>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_stereoEnabled(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var result = obj.stereoEnabled; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_stereoSeparation(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var result = obj.stereoSeparation; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_stereoSeparation(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.stereoSeparation = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_stereoConvergence(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var result = obj.stereoConvergence; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_stereoConvergence(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.stereoConvergence = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_areVRStereoViewMatricesWithinSingleCullTolerance(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var result = obj.areVRStereoViewMatricesWithinSingleCullTolerance; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_stereoTargetEye(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var result = obj.stereoTargetEye; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_stereoTargetEye(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.stereoTargetEye = (UnityEngine.StereoTargetEyeMask)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_stereoActiveEye(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var result = obj.stereoActiveEye; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_allCamerasCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Camera.allCamerasCount; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_allCameras(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Camera.allCameras; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_commandBufferCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Camera; var result = obj.commandBufferCount; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_onPreCull(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Camera.onPreCull; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_onPreCull(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.Camera.onPreCull = argHelper.Get<UnityEngine.Camera.CameraCallback>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_onPreRender(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Camera.onPreRender; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_onPreRender(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.Camera.onPreRender = argHelper.Get<UnityEngine.Camera.CameraCallback>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_onPostRender(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Camera.onPostRender; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_onPostRender(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.Camera.onPostRender = argHelper.Get<UnityEngine.Camera.CameraCallback>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "Reset", IsStatic = false}, M_Reset }, { new Puerts.MethodKey {Name = "ResetTransparencySortSettings", IsStatic = false}, M_ResetTransparencySortSettings }, { new Puerts.MethodKey {Name = "ResetAspect", IsStatic = false}, M_ResetAspect }, { new Puerts.MethodKey {Name = "ResetCullingMatrix", IsStatic = false}, M_ResetCullingMatrix }, { new Puerts.MethodKey {Name = "SetReplacementShader", IsStatic = false}, M_SetReplacementShader }, { new Puerts.MethodKey {Name = "ResetReplacementShader", IsStatic = false}, M_ResetReplacementShader }, { new Puerts.MethodKey {Name = "GetGateFittedFieldOfView", IsStatic = false}, M_GetGateFittedFieldOfView }, { new Puerts.MethodKey {Name = "GetGateFittedLensShift", IsStatic = false}, M_GetGateFittedLensShift }, { new Puerts.MethodKey {Name = "SetTargetBuffers", IsStatic = false}, M_SetTargetBuffers }, { new Puerts.MethodKey {Name = "ResetWorldToCameraMatrix", IsStatic = false}, M_ResetWorldToCameraMatrix }, { new Puerts.MethodKey {Name = "ResetProjectionMatrix", IsStatic = false}, M_ResetProjectionMatrix }, { new Puerts.MethodKey {Name = "CalculateObliqueMatrix", IsStatic = false}, M_CalculateObliqueMatrix }, { new Puerts.MethodKey {Name = "WorldToScreenPoint", IsStatic = false}, M_WorldToScreenPoint }, { new Puerts.MethodKey {Name = "WorldToViewportPoint", IsStatic = false}, M_WorldToViewportPoint }, { new Puerts.MethodKey {Name = "ViewportToWorldPoint", IsStatic = false}, M_ViewportToWorldPoint }, { new Puerts.MethodKey {Name = "ScreenToWorldPoint", IsStatic = false}, M_ScreenToWorldPoint }, { new Puerts.MethodKey {Name = "ScreenToViewportPoint", IsStatic = false}, M_ScreenToViewportPoint }, { new Puerts.MethodKey {Name = "ViewportToScreenPoint", IsStatic = false}, M_ViewportToScreenPoint }, { new Puerts.MethodKey {Name = "ViewportPointToRay", IsStatic = false}, M_ViewportPointToRay }, { new Puerts.MethodKey {Name = "ScreenPointToRay", IsStatic = false}, M_ScreenPointToRay }, { new Puerts.MethodKey {Name = "CalculateFrustumCorners", IsStatic = false}, M_CalculateFrustumCorners }, { new Puerts.MethodKey {Name = "CalculateProjectionMatrixFromPhysicalProperties", IsStatic = true}, F_CalculateProjectionMatrixFromPhysicalProperties }, { new Puerts.MethodKey {Name = "FocalLengthToFieldOfView", IsStatic = true}, F_FocalLengthToFieldOfView }, { new Puerts.MethodKey {Name = "FieldOfViewToFocalLength", IsStatic = true}, F_FieldOfViewToFocalLength }, { new Puerts.MethodKey {Name = "HorizontalToVerticalFieldOfView", IsStatic = true}, F_HorizontalToVerticalFieldOfView }, { new Puerts.MethodKey {Name = "VerticalToHorizontalFieldOfView", IsStatic = true}, F_VerticalToHorizontalFieldOfView }, { new Puerts.MethodKey {Name = "GetStereoNonJitteredProjectionMatrix", IsStatic = false}, M_GetStereoNonJitteredProjectionMatrix }, { new Puerts.MethodKey {Name = "GetStereoViewMatrix", IsStatic = false}, M_GetStereoViewMatrix }, { new Puerts.MethodKey {Name = "CopyStereoDeviceProjectionMatrixToNonJittered", IsStatic = false}, M_CopyStereoDeviceProjectionMatrixToNonJittered }, { new Puerts.MethodKey {Name = "GetStereoProjectionMatrix", IsStatic = false}, M_GetStereoProjectionMatrix }, { new Puerts.MethodKey {Name = "SetStereoProjectionMatrix", IsStatic = false}, M_SetStereoProjectionMatrix }, { new Puerts.MethodKey {Name = "ResetStereoProjectionMatrices", IsStatic = false}, M_ResetStereoProjectionMatrices }, { new Puerts.MethodKey {Name = "SetStereoViewMatrix", IsStatic = false}, M_SetStereoViewMatrix }, { new Puerts.MethodKey {Name = "ResetStereoViewMatrices", IsStatic = false}, M_ResetStereoViewMatrices }, { new Puerts.MethodKey {Name = "GetAllCameras", IsStatic = true}, F_GetAllCameras }, { new Puerts.MethodKey {Name = "RenderToCubemap", IsStatic = false}, M_RenderToCubemap }, { new Puerts.MethodKey {Name = "Render", IsStatic = false}, M_Render }, { new Puerts.MethodKey {Name = "RenderWithShader", IsStatic = false}, M_RenderWithShader }, { new Puerts.MethodKey {Name = "RenderDontRestore", IsStatic = false}, M_RenderDontRestore }, { new Puerts.MethodKey {Name = "SubmitRenderRequests", IsStatic = false}, M_SubmitRenderRequests }, { new Puerts.MethodKey {Name = "SetupCurrent", IsStatic = true}, F_SetupCurrent }, { new Puerts.MethodKey {Name = "CopyFrom", IsStatic = false}, M_CopyFrom }, { new Puerts.MethodKey {Name = "RemoveCommandBuffers", IsStatic = false}, M_RemoveCommandBuffers }, { new Puerts.MethodKey {Name = "RemoveAllCommandBuffers", IsStatic = false}, M_RemoveAllCommandBuffers }, { new Puerts.MethodKey {Name = "AddCommandBuffer", IsStatic = false}, M_AddCommandBuffer }, { new Puerts.MethodKey {Name = "AddCommandBufferAsync", IsStatic = false}, M_AddCommandBufferAsync }, { new Puerts.MethodKey {Name = "RemoveCommandBuffer", IsStatic = false}, M_RemoveCommandBuffer }, { new Puerts.MethodKey {Name = "GetCommandBuffers", IsStatic = false}, M_GetCommandBuffers }, { new Puerts.MethodKey {Name = "TryGetCullingParameters", IsStatic = false}, M_TryGetCullingParameters }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"nearClipPlane", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_nearClipPlane, Setter = S_nearClipPlane} }, {"farClipPlane", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_farClipPlane, Setter = S_farClipPlane} }, {"fieldOfView", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_fieldOfView, Setter = S_fieldOfView} }, {"renderingPath", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_renderingPath, Setter = S_renderingPath} }, {"actualRenderingPath", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_actualRenderingPath, Setter = null} }, {"allowHDR", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_allowHDR, Setter = S_allowHDR} }, {"allowMSAA", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_allowMSAA, Setter = S_allowMSAA} }, {"allowDynamicResolution", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_allowDynamicResolution, Setter = S_allowDynamicResolution} }, {"forceIntoRenderTexture", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_forceIntoRenderTexture, Setter = S_forceIntoRenderTexture} }, {"orthographicSize", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_orthographicSize, Setter = S_orthographicSize} }, {"orthographic", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_orthographic, Setter = S_orthographic} }, {"opaqueSortMode", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_opaqueSortMode, Setter = S_opaqueSortMode} }, {"transparencySortMode", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_transparencySortMode, Setter = S_transparencySortMode} }, {"transparencySortAxis", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_transparencySortAxis, Setter = S_transparencySortAxis} }, {"depth", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_depth, Setter = S_depth} }, {"aspect", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_aspect, Setter = S_aspect} }, {"velocity", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_velocity, Setter = null} }, {"cullingMask", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_cullingMask, Setter = S_cullingMask} }, {"eventMask", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_eventMask, Setter = S_eventMask} }, {"layerCullSpherical", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_layerCullSpherical, Setter = S_layerCullSpherical} }, {"cameraType", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_cameraType, Setter = S_cameraType} }, {"overrideSceneCullingMask", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_overrideSceneCullingMask, Setter = S_overrideSceneCullingMask} }, {"layerCullDistances", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_layerCullDistances, Setter = S_layerCullDistances} }, {"useOcclusionCulling", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_useOcclusionCulling, Setter = S_useOcclusionCulling} }, {"cullingMatrix", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_cullingMatrix, Setter = S_cullingMatrix} }, {"backgroundColor", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_backgroundColor, Setter = S_backgroundColor} }, {"clearFlags", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_clearFlags, Setter = S_clearFlags} }, {"depthTextureMode", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_depthTextureMode, Setter = S_depthTextureMode} }, {"clearStencilAfterLightingPass", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_clearStencilAfterLightingPass, Setter = S_clearStencilAfterLightingPass} }, {"usePhysicalProperties", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_usePhysicalProperties, Setter = S_usePhysicalProperties} }, {"sensorSize", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_sensorSize, Setter = S_sensorSize} }, {"lensShift", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_lensShift, Setter = S_lensShift} }, {"focalLength", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_focalLength, Setter = S_focalLength} }, {"gateFit", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_gateFit, Setter = S_gateFit} }, {"rect", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_rect, Setter = S_rect} }, {"pixelRect", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_pixelRect, Setter = S_pixelRect} }, {"pixelWidth", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_pixelWidth, Setter = null} }, {"pixelHeight", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_pixelHeight, Setter = null} }, {"scaledPixelWidth", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_scaledPixelWidth, Setter = null} }, {"scaledPixelHeight", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_scaledPixelHeight, Setter = null} }, {"targetTexture", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_targetTexture, Setter = S_targetTexture} }, {"activeTexture", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_activeTexture, Setter = null} }, {"targetDisplay", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_targetDisplay, Setter = S_targetDisplay} }, {"cameraToWorldMatrix", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_cameraToWorldMatrix, Setter = null} }, {"worldToCameraMatrix", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_worldToCameraMatrix, Setter = S_worldToCameraMatrix} }, {"projectionMatrix", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_projectionMatrix, Setter = S_projectionMatrix} }, {"nonJitteredProjectionMatrix", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_nonJitteredProjectionMatrix, Setter = S_nonJitteredProjectionMatrix} }, {"useJitteredProjectionMatrixForTransparentRendering", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_useJitteredProjectionMatrixForTransparentRendering, Setter = S_useJitteredProjectionMatrixForTransparentRendering} }, {"previousViewProjectionMatrix", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_previousViewProjectionMatrix, Setter = null} }, {"main", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_main, Setter = null} }, {"current", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_current, Setter = null} }, {"scene", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_scene, Setter = S_scene} }, {"stereoEnabled", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_stereoEnabled, Setter = null} }, {"stereoSeparation", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_stereoSeparation, Setter = S_stereoSeparation} }, {"stereoConvergence", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_stereoConvergence, Setter = S_stereoConvergence} }, {"areVRStereoViewMatricesWithinSingleCullTolerance", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_areVRStereoViewMatricesWithinSingleCullTolerance, Setter = null} }, {"stereoTargetEye", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_stereoTargetEye, Setter = S_stereoTargetEye} }, {"stereoActiveEye", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_stereoActiveEye, Setter = null} }, {"allCamerasCount", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_allCamerasCount, Setter = null} }, {"allCameras", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_allCameras, Setter = null} }, {"commandBufferCount", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_commandBufferCount, Setter = null} }, {"onPreCull", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_onPreCull, Setter = S_onPreCull} }, {"onPreRender", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_onPreRender, Setter = S_onPreRender} }, {"onPostRender", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_onPostRender, Setter = S_onPostRender} }, } }; } } } <|start_filename|>Projects/DataTemplates/template_lua2/ai_tbblackboard.lua<|end_filename|> -- ai.TbBlackboard return { ["attack_or_patrol"] = { name="attack_or_patrol", desc="demo hahaha", parent_name="", keys= { { name="OriginPosition", desc="", is_static=false, type=5, type_class_name="", }, { name="TargetActor", desc="x2 haha", is_static=false, type=10, type_class_name="", }, { name="AcceptableRadius", desc="x3 haha", is_static=false, type=3, type_class_name="", }, { name="CurChooseSkillId", desc="x4 haha", is_static=false, type=2, type_class_name="", }, }, }, ["demo"] = { name="demo", desc="demo hahaha", parent_name="demo_parent", keys= { { name="x1", desc="x1 haha", is_static=false, type=1, type_class_name="", }, { name="x2", desc="x2 haha", is_static=false, type=2, type_class_name="", }, { name="x3", desc="x3 haha", is_static=false, type=3, type_class_name="", }, { name="x4", desc="x4 haha", is_static=false, type=4, type_class_name="", }, { name="x5", desc="x5 haha", is_static=false, type=5, type_class_name="", }, { name="x6", desc="x6 haha", is_static=false, type=6, type_class_name="", }, { name="x7", desc="x7 haha", is_static=false, type=7, type_class_name="", }, { name="x8", desc="x8 haha", is_static=false, type=8, type_class_name="", }, { name="x9", desc="x9 haha", is_static=false, type=9, type_class_name="ABC", }, { name="x10", desc="x10 haha", is_static=false, type=10, type_class_name="OBJECT", }, }, }, ["demo_parent"] = { name="demo_parent", desc="demo parent", parent_name="", keys= { { name="v1", desc="v1 haha", is_static=false, type=1, type_class_name="", }, }, }, } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_Joint_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_Joint_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.Joint(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.Joint), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_connectedBody(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Joint; var result = obj.connectedBody; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_connectedBody(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Joint; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.connectedBody = argHelper.Get<UnityEngine.Rigidbody>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_connectedArticulationBody(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Joint; var result = obj.connectedArticulationBody; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_connectedArticulationBody(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Joint; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.connectedArticulationBody = argHelper.Get<UnityEngine.ArticulationBody>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_axis(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Joint; var result = obj.axis; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_axis(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Joint; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.axis = argHelper.Get<UnityEngine.Vector3>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_anchor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Joint; var result = obj.anchor; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_anchor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Joint; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.anchor = argHelper.Get<UnityEngine.Vector3>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_connectedAnchor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Joint; var result = obj.connectedAnchor; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_connectedAnchor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Joint; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.connectedAnchor = argHelper.Get<UnityEngine.Vector3>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_autoConfigureConnectedAnchor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Joint; var result = obj.autoConfigureConnectedAnchor; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_autoConfigureConnectedAnchor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Joint; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.autoConfigureConnectedAnchor = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_breakForce(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Joint; var result = obj.breakForce; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_breakForce(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Joint; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.breakForce = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_breakTorque(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Joint; var result = obj.breakTorque; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_breakTorque(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Joint; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.breakTorque = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_enableCollision(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Joint; var result = obj.enableCollision; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_enableCollision(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Joint; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.enableCollision = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_enablePreprocessing(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Joint; var result = obj.enablePreprocessing; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_enablePreprocessing(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Joint; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.enablePreprocessing = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_massScale(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Joint; var result = obj.massScale; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_massScale(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Joint; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.massScale = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_connectedMassScale(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Joint; var result = obj.connectedMassScale; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_connectedMassScale(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Joint; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.connectedMassScale = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_currentForce(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Joint; var result = obj.currentForce; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_currentTorque(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Joint; var result = obj.currentTorque; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"connectedBody", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_connectedBody, Setter = S_connectedBody} }, {"connectedArticulationBody", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_connectedArticulationBody, Setter = S_connectedArticulationBody} }, {"axis", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_axis, Setter = S_axis} }, {"anchor", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_anchor, Setter = S_anchor} }, {"connectedAnchor", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_connectedAnchor, Setter = S_connectedAnchor} }, {"autoConfigureConnectedAnchor", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_autoConfigureConnectedAnchor, Setter = S_autoConfigureConnectedAnchor} }, {"breakForce", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_breakForce, Setter = S_breakForce} }, {"breakTorque", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_breakTorque, Setter = S_breakTorque} }, {"enableCollision", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_enableCollision, Setter = S_enableCollision} }, {"enablePreprocessing", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_enablePreprocessing, Setter = S_enablePreprocessing} }, {"massScale", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_massScale, Setter = S_massScale} }, {"connectedMassScale", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_connectedMassScale, Setter = S_connectedMassScale} }, {"currentForce", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_currentForce, Setter = null} }, {"currentTorque", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_currentTorque, Setter = null} }, } }; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_RaycastHit2D_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_RaycastHit2D_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.RaycastHit2D constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_CompareTo(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.RaycastHit2D)Puerts.Utils.GetSelf((int)data, self); { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.RaycastHit2D>(false); var result = obj.CompareTo(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_centroid(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.RaycastHit2D)Puerts.Utils.GetSelf((int)data, self); var result = obj.centroid; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_centroid(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.RaycastHit2D)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.centroid = argHelper.Get<UnityEngine.Vector2>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_point(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.RaycastHit2D)Puerts.Utils.GetSelf((int)data, self); var result = obj.point; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_point(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.RaycastHit2D)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.point = argHelper.Get<UnityEngine.Vector2>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_normal(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.RaycastHit2D)Puerts.Utils.GetSelf((int)data, self); var result = obj.normal; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_normal(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.RaycastHit2D)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.normal = argHelper.Get<UnityEngine.Vector2>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_distance(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.RaycastHit2D)Puerts.Utils.GetSelf((int)data, self); var result = obj.distance; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_distance(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.RaycastHit2D)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.distance = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_fraction(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.RaycastHit2D)Puerts.Utils.GetSelf((int)data, self); var result = obj.fraction; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_fraction(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.RaycastHit2D)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.fraction = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_collider(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.RaycastHit2D)Puerts.Utils.GetSelf((int)data, self); var result = obj.collider; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_rigidbody(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.RaycastHit2D)Puerts.Utils.GetSelf((int)data, self); var result = obj.rigidbody; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_transform(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.RaycastHit2D)Puerts.Utils.GetSelf((int)data, self); var result = obj.transform; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "CompareTo", IsStatic = false}, M_CompareTo }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"centroid", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_centroid, Setter = S_centroid} }, {"point", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_point, Setter = S_point} }, {"normal", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_normal, Setter = S_normal} }, {"distance", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_distance, Setter = S_distance} }, {"fraction", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_fraction, Setter = S_fraction} }, {"collider", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_collider, Setter = null} }, {"rigidbody", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_rigidbody, Setter = null} }, {"transform", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_transform, Setter = null} }, } }; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_RemoteConfigSettings_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_RemoteConfigSettings_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetString(false); var result = new UnityEngine.RemoteConfigSettings(Arg0); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.RemoteConfigSettings), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Dispose(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RemoteConfigSettings; { { obj.Dispose(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_QueueConfig(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Any, typeof(System.Object), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<System.Object>(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetString(false); var result = UnityEngine.RemoteConfigSettings.QueueConfig(Arg0,Arg1,Arg2,Arg3); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Any, typeof(System.Object), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<System.Object>(false); var Arg2 = argHelper2.GetInt32(false); var result = UnityEngine.RemoteConfigSettings.QueueConfig(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Any, typeof(System.Object), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<System.Object>(false); var result = UnityEngine.RemoteConfigSettings.QueueConfig(Arg0,Arg1); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to QueueConfig"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_SendDeviceInfoInConfigRequest(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { { var result = UnityEngine.RemoteConfigSettings.SendDeviceInfoInConfigRequest(); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_AddSessionTag(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetString(false); UnityEngine.RemoteConfigSettings.AddSessionTag(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ForceUpdate(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RemoteConfigSettings; { { obj.ForceUpdate(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_WasLastUpdatedFromServer(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RemoteConfigSettings; { { var result = obj.WasLastUpdatedFromServer(); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetInt(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RemoteConfigSettings; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var result = obj.GetInt(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.GetInt32(false); var result = obj.GetInt(Arg0,Arg1); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetInt"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetLong(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RemoteConfigSettings; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var result = obj.GetLong(Arg0); Puerts.PuertsDLL.ReturnBigInt(isolate, info, result); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.BigInt, null, false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.GetInt64(false); var result = obj.GetLong(Arg0,Arg1); Puerts.PuertsDLL.ReturnBigInt(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetLong"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetFloat(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RemoteConfigSettings; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var result = obj.GetFloat(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.GetFloat(false); var result = obj.GetFloat(Arg0,Arg1); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetFloat"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetString(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RemoteConfigSettings; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var result = obj.GetString(Arg0); Puerts.PuertsDLL.ReturnString(isolate, info, result); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.GetString(false); var result = obj.GetString(Arg0,Arg1); Puerts.PuertsDLL.ReturnString(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetString"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetBool(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RemoteConfigSettings; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var result = obj.GetBool(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.GetBoolean(false); var result = obj.GetBool(Arg0,Arg1); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetBool"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_HasKey(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RemoteConfigSettings; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetString(false); var result = obj.HasKey(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RemoteConfigSettings; { { var result = obj.GetCount(); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetKeys(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RemoteConfigSettings; { { var result = obj.GetKeys(); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetObject(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RemoteConfigSettings; if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Type), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.Get<System.Type>(false); var Arg1 = argHelper1.GetString(false); var result = obj.GetObject(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Any, typeof(System.Object), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<System.Object>(false); var result = obj.GetObject(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Type), false, false)) { var Arg0 = argHelper0.Get<System.Type>(false); var result = obj.GetObject(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetObject"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetDictionary(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RemoteConfigSettings; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var result = obj.GetDictionary(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 0) { { var result = obj.GetDictionary(); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetDictionary"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void A_Updated(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RemoteConfigSettings; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.Updated += argHelper.Get<System.Action<bool>>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void R_Updated(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RemoteConfigSettings; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.Updated -= argHelper.Get<System.Action<bool>>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "Dispose", IsStatic = false}, M_Dispose }, { new Puerts.MethodKey {Name = "QueueConfig", IsStatic = true}, F_QueueConfig }, { new Puerts.MethodKey {Name = "SendDeviceInfoInConfigRequest", IsStatic = true}, F_SendDeviceInfoInConfigRequest }, { new Puerts.MethodKey {Name = "AddSessionTag", IsStatic = true}, F_AddSessionTag }, { new Puerts.MethodKey {Name = "ForceUpdate", IsStatic = false}, M_ForceUpdate }, { new Puerts.MethodKey {Name = "WasLastUpdatedFromServer", IsStatic = false}, M_WasLastUpdatedFromServer }, { new Puerts.MethodKey {Name = "GetInt", IsStatic = false}, M_GetInt }, { new Puerts.MethodKey {Name = "GetLong", IsStatic = false}, M_GetLong }, { new Puerts.MethodKey {Name = "GetFloat", IsStatic = false}, M_GetFloat }, { new Puerts.MethodKey {Name = "GetString", IsStatic = false}, M_GetString }, { new Puerts.MethodKey {Name = "GetBool", IsStatic = false}, M_GetBool }, { new Puerts.MethodKey {Name = "HasKey", IsStatic = false}, M_HasKey }, { new Puerts.MethodKey {Name = "GetCount", IsStatic = false}, M_GetCount }, { new Puerts.MethodKey {Name = "GetKeys", IsStatic = false}, M_GetKeys }, { new Puerts.MethodKey {Name = "GetObject", IsStatic = false}, M_GetObject }, { new Puerts.MethodKey {Name = "GetDictionary", IsStatic = false}, M_GetDictionary }, { new Puerts.MethodKey {Name = "add_Updated", IsStatic = false}, A_Updated}, { new Puerts.MethodKey {Name = "remove_Updated", IsStatic = false}, R_Updated}, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { } }; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_UI_FontData_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_UI_FontData_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.UI.FontData(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.UI.FontData), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_defaultFontData(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.UI.FontData.defaultFontData; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_font(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.FontData; var result = obj.font; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_font(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.FontData; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.font = argHelper.Get<UnityEngine.Font>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_fontSize(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.FontData; var result = obj.fontSize; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_fontSize(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.FontData; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.fontSize = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_fontStyle(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.FontData; var result = obj.fontStyle; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_fontStyle(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.FontData; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.fontStyle = (UnityEngine.FontStyle)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_bestFit(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.FontData; var result = obj.bestFit; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_bestFit(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.FontData; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.bestFit = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_minSize(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.FontData; var result = obj.minSize; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_minSize(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.FontData; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.minSize = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_maxSize(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.FontData; var result = obj.maxSize; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_maxSize(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.FontData; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.maxSize = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_alignment(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.FontData; var result = obj.alignment; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_alignment(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.FontData; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.alignment = (UnityEngine.TextAnchor)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_alignByGeometry(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.FontData; var result = obj.alignByGeometry; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_alignByGeometry(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.FontData; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.alignByGeometry = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_richText(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.FontData; var result = obj.richText; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_richText(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.FontData; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.richText = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_horizontalOverflow(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.FontData; var result = obj.horizontalOverflow; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_horizontalOverflow(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.FontData; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.horizontalOverflow = (UnityEngine.HorizontalWrapMode)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_verticalOverflow(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.FontData; var result = obj.verticalOverflow; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_verticalOverflow(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.FontData; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.verticalOverflow = (UnityEngine.VerticalWrapMode)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_lineSpacing(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.FontData; var result = obj.lineSpacing; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_lineSpacing(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.FontData; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.lineSpacing = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"defaultFontData", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_defaultFontData, Setter = null} }, {"font", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_font, Setter = S_font} }, {"fontSize", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_fontSize, Setter = S_fontSize} }, {"fontStyle", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_fontStyle, Setter = S_fontStyle} }, {"bestFit", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_bestFit, Setter = S_bestFit} }, {"minSize", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_minSize, Setter = S_minSize} }, {"maxSize", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_maxSize, Setter = S_maxSize} }, {"alignment", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_alignment, Setter = S_alignment} }, {"alignByGeometry", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_alignByGeometry, Setter = S_alignByGeometry} }, {"richText", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_richText, Setter = S_richText} }, {"horizontalOverflow", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_horizontalOverflow, Setter = S_horizontalOverflow} }, {"verticalOverflow", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_verticalOverflow, Setter = S_verticalOverflow} }, {"lineSpacing", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_lineSpacing, Setter = S_lineSpacing} }, } }; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_Random_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_Random_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.Random constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_InitState(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); UnityEngine.Random.InitState(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_Range(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.GetFloat(false); var result = UnityEngine.Random.Range(Arg0,Arg1); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var result = UnityEngine.Random.Range(Arg0,Arg1); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to Range"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_ColorHSV(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 0) { { var result = UnityEngine.Random.ColorHSV(); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.GetFloat(false); var result = UnityEngine.Random.ColorHSV(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.GetFloat(false); var result = UnityEngine.Random.ColorHSV(Arg0,Arg1,Arg2,Arg3); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 6) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.GetFloat(false); var Arg5 = argHelper5.GetFloat(false); var result = UnityEngine.Random.ColorHSV(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 8) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); var argHelper7 = new Puerts.ArgumentHelper((int)data, isolate, info, 7); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper7.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.GetFloat(false); var Arg5 = argHelper5.GetFloat(false); var Arg6 = argHelper6.GetFloat(false); var Arg7 = argHelper7.GetFloat(false); var result = UnityEngine.Random.ColorHSV(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to ColorHSV"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_state(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Random.state; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_state(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.Random.state = argHelper.Get<UnityEngine.Random.State>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_value(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Random.value; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_insideUnitSphere(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Random.insideUnitSphere; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_insideUnitCircle(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Random.insideUnitCircle; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_onUnitSphere(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Random.onUnitSphere; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_rotation(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Random.rotation; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_rotationUniform(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Random.rotationUniform; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "InitState", IsStatic = true}, F_InitState }, { new Puerts.MethodKey {Name = "Range", IsStatic = true}, F_Range }, { new Puerts.MethodKey {Name = "ColorHSV", IsStatic = true}, F_ColorHSV }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"state", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_state, Setter = S_state} }, {"value", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_value, Setter = null} }, {"insideUnitSphere", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_insideUnitSphere, Setter = null} }, {"insideUnitCircle", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_insideUnitCircle, Setter = null} }, {"onUnitSphere", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_onUnitSphere, Setter = null} }, {"rotation", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_rotation, Setter = null} }, {"rotationUniform", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_rotationUniform, Setter = null} }, } }; } } } <|start_filename|>Projects/Csharp_DotNet5_json_ExportServer/Gen/test/TestMap.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; using System.Text.Json; namespace cfg.test { public sealed class TestMap : Bright.Config.BeanBase { public TestMap(JsonElement _json) { Id = _json.GetProperty("id").GetInt32(); { var _json0 = _json.GetProperty("x1"); X1 = new System.Collections.Generic.Dictionary<int, int>(_json0.GetArrayLength()); foreach(JsonElement __e in _json0.EnumerateArray()) { int __k; __k = __e[0].GetInt32(); int __v; __v = __e[1].GetInt32(); X1.Add(__k, __v); } } { var _json0 = _json.GetProperty("x2"); X2 = new System.Collections.Generic.Dictionary<long, int>(_json0.GetArrayLength()); foreach(JsonElement __e in _json0.EnumerateArray()) { long __k; __k = __e[0].GetInt64(); int __v; __v = __e[1].GetInt32(); X2.Add(__k, __v); } } { var _json0 = _json.GetProperty("x3"); X3 = new System.Collections.Generic.Dictionary<string, int>(_json0.GetArrayLength()); foreach(JsonElement __e in _json0.EnumerateArray()) { string __k; __k = __e[0].GetString(); int __v; __v = __e[1].GetInt32(); X3.Add(__k, __v); } } { var _json0 = _json.GetProperty("x4"); X4 = new System.Collections.Generic.Dictionary<test.DemoEnum, int>(_json0.GetArrayLength()); foreach(JsonElement __e in _json0.EnumerateArray()) { test.DemoEnum __k; __k = (test.DemoEnum)__e[0].GetInt32(); int __v; __v = __e[1].GetInt32(); X4.Add(__k, __v); } } } public TestMap(int id, System.Collections.Generic.Dictionary<int, int> x1, System.Collections.Generic.Dictionary<long, int> x2, System.Collections.Generic.Dictionary<string, int> x3, System.Collections.Generic.Dictionary<test.DemoEnum, int> x4 ) { this.Id = id; this.X1 = x1; this.X2 = x2; this.X3 = x3; this.X4 = x4; } public static TestMap DeserializeTestMap(JsonElement _json) { return new test.TestMap(_json); } public int Id { get; private set; } public test.TestIndex Id_Ref { get; private set; } public System.Collections.Generic.Dictionary<int, int> X1 { get; private set; } public System.Collections.Generic.Dictionary<long, int> X2 { get; private set; } public System.Collections.Generic.Dictionary<string, int> X3 { get; private set; } public System.Collections.Generic.Dictionary<test.DemoEnum, int> X4 { get; private set; } public const int __ID__ = -543227410; public override int GetTypeId() => __ID__; public void Resolve(Dictionary<string, object> _tables) { this.Id_Ref = (_tables["test.TbTestIndex"] as test.TbTestIndex).GetOrDefault(Id); } public void TranslateText(System.Func<string, string, string> translator) { } public override string ToString() { return "{ " + "Id:" + Id + "," + "X1:" + Bright.Common.StringUtil.CollectionToString(X1) + "," + "X2:" + Bright.Common.StringUtil.CollectionToString(X2) + "," + "X3:" + Bright.Common.StringUtil.CollectionToString(X3) + "," + "X4:" + Bright.Common.StringUtil.CollectionToString(X4) + "," + "}"; } } } <|start_filename|>Projects/Csharp_Unity_bin_use_UnityEngine_Vector/Assets/Gen/bonus/OneItems.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.bonus { public sealed class OneItems : bonus.Bonus { public OneItems(ByteBuf _buf) : base(_buf) { {int n = System.Math.Min(_buf.ReadSize(), _buf.Size);Items = new int[n];for(var i = 0 ; i < n ; i++) { int _e;_e = _buf.ReadInt(); Items[i] = _e;}} } public static OneItems DeserializeOneItems(ByteBuf _buf) { return new bonus.OneItems(_buf); } public int[] Items { get; private set; } public const int __ID__ = 400179721; public override int GetTypeId() => __ID__; public override void Resolve(Dictionary<string, object> _tables) { base.Resolve(_tables); } public override void TranslateText(System.Func<string, string, string> translator) { base.TranslateText(translator); } public override string ToString() { return "{ " + "Items:" + Bright.Common.StringUtil.CollectionToString(Items) + "," + "}"; } } } <|start_filename|>Projects/java_json/src/gen/cfg/test/MultiRowType2.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.test; import com.google.gson.JsonElement; import com.google.gson.JsonObject; public final class MultiRowType2 { public MultiRowType2(JsonObject __json__) { id = __json__.get("id").getAsInt(); x = __json__.get("x").getAsInt(); y = __json__.get("y").getAsFloat(); } public MultiRowType2(int id, int x, float y ) { this.id = id; this.x = x; this.y = y; } public static MultiRowType2 deserializeMultiRowType2(JsonObject __json__) { return new MultiRowType2(__json__); } public final int id; public final int x; public final float y; public void resolve(java.util.HashMap<String, Object> _tables) { } @Override public String toString() { return "{ " + "id:" + id + "," + "x:" + x + "," + "y:" + y + "," + "}"; } } <|start_filename|>Projects/Go_json/gen/src/cfg/test.DemoGroup.go<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg import "errors" type TestDemoGroup struct { Id int32 X1 int32 X2 int32 X3 int32 X4 int32 X5 *TestInnerGroup } const TypeId_TestDemoGroup = -379263008 func (*TestDemoGroup) GetTypeId() int32 { return -379263008 } func (_v *TestDemoGroup)Deserialize(_buf map[string]interface{}) (err error) { { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["id"].(float64); !_ok_ { err = errors.New("id error"); return }; _v.Id = int32(_tempNum_) } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["x1"].(float64); !_ok_ { err = errors.New("x1 error"); return }; _v.X1 = int32(_tempNum_) } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["x2"].(float64); !_ok_ { err = errors.New("x2 error"); return }; _v.X2 = int32(_tempNum_) } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["x3"].(float64); !_ok_ { err = errors.New("x3 error"); return }; _v.X3 = int32(_tempNum_) } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["x4"].(float64); !_ok_ { err = errors.New("x4 error"); return }; _v.X4 = int32(_tempNum_) } { var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _buf["x5"].(map[string]interface{}); !_ok_ { err = errors.New("x5 error"); return }; if _v.X5, err = DeserializeTestInnerGroup(_x_); err != nil { return } } return } func DeserializeTestDemoGroup(_buf map[string]interface{}) (*TestDemoGroup, error) { v := &TestDemoGroup{} if err := v.Deserialize(_buf); err == nil { return v, nil } else { return nil, err } } <|start_filename|>Projects/java_json/src/gen/cfg/test/TbTestGlobal.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.test; import com.google.gson.JsonElement; public final class TbTestGlobal { private final cfg.test.TestGlobal _data; public final cfg.test.TestGlobal data() { return _data; } public TbTestGlobal(JsonElement __json__) { int n = __json__.getAsJsonArray().size(); if (n != 1) throw new bright.serialization.SerializationException("table mode=one, but size != 1"); _data = new cfg.test.TestGlobal(__json__.getAsJsonArray().get(0).getAsJsonObject()); } public int getUnlockEquip() { return _data.unlockEquip; } public int getUnlockHero() { return _data.unlockHero; } public void resolve(java.util.HashMap<String, Object> _tables) { _data.resolve(_tables); } } <|start_filename|>Projects/java_json/src/gen/cfg/item/EUseType.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.item; public enum EUseType { /** * 手动 */ MANUAL(0), /** * 自动 */ AUTO(1), ; private final int value; public int getValue() { return value; } EUseType(int value) { this.value = value; } public static EUseType valueOf(int value) { if (value == 0) return MANUAL; if (value == 1) return AUTO; throw new IllegalArgumentException(""); } } <|start_filename|>Projects/java_json/src/gen/cfg/item/Item.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.item; import com.google.gson.JsonElement; import com.google.gson.JsonObject; /** * 道具 */ public final class Item { public Item(JsonObject __json__) { id = __json__.get("id").getAsInt(); name = __json__.get("name").getAsString(); majorType = cfg.item.EMajorType.valueOf(__json__.get("major_type").getAsInt()); minorType = cfg.item.EMinorType.valueOf(__json__.get("minor_type").getAsInt()); maxPileNum = __json__.get("max_pile_num").getAsInt(); quality = cfg.item.EItemQuality.valueOf(__json__.get("quality").getAsInt()); icon = __json__.get("icon").getAsString(); iconBackgroud = __json__.get("icon_backgroud").getAsString(); iconMask = __json__.get("icon_mask").getAsString(); desc = __json__.get("desc").getAsString(); showOrder = __json__.get("show_order").getAsInt(); quantifier = __json__.get("quantifier").getAsString(); showInBag = __json__.get("show_in_bag").getAsBoolean(); minShowLevel = __json__.get("min_show_level").getAsInt(); batchUsable = __json__.get("batch_usable").getAsBoolean(); progressTimeWhenUse = __json__.get("progress_time_when_use").getAsFloat(); showHintWhenUse = __json__.get("show_hint_when_use").getAsBoolean(); droppable = __json__.get("droppable").getAsBoolean(); { if (__json__.has("price") && !__json__.get("price").isJsonNull()) { price = __json__.get("price").getAsInt(); } else { price = null; } } useType = cfg.item.EUseType.valueOf(__json__.get("use_type").getAsInt()); { if (__json__.has("level_up_id") && !__json__.get("level_up_id").isJsonNull()) { levelUpId = __json__.get("level_up_id").getAsInt(); } else { levelUpId = null; } } } public Item(int id, String name, cfg.item.EMajorType major_type, cfg.item.EMinorType minor_type, int max_pile_num, cfg.item.EItemQuality quality, String icon, String icon_backgroud, String icon_mask, String desc, int show_order, String quantifier, boolean show_in_bag, int min_show_level, boolean batch_usable, float progress_time_when_use, boolean show_hint_when_use, boolean droppable, Integer price, cfg.item.EUseType use_type, Integer level_up_id ) { this.id = id; this.name = name; this.majorType = major_type; this.minorType = minor_type; this.maxPileNum = max_pile_num; this.quality = quality; this.icon = icon; this.iconBackgroud = icon_backgroud; this.iconMask = icon_mask; this.desc = desc; this.showOrder = show_order; this.quantifier = quantifier; this.showInBag = show_in_bag; this.minShowLevel = min_show_level; this.batchUsable = batch_usable; this.progressTimeWhenUse = progress_time_when_use; this.showHintWhenUse = show_hint_when_use; this.droppable = droppable; this.price = price; this.useType = use_type; this.levelUpId = level_up_id; } public static Item deserializeItem(JsonObject __json__) { return new Item(__json__); } /** * 道具id */ public final int id; public final String name; public final cfg.item.EMajorType majorType; public final cfg.item.EMinorType minorType; public final int maxPileNum; public final cfg.item.EItemQuality quality; public final String icon; public final String iconBackgroud; public final String iconMask; public final String desc; public final int showOrder; public final String quantifier; public final boolean showInBag; public final int minShowLevel; public final boolean batchUsable; public final float progressTimeWhenUse; public final boolean showHintWhenUse; public final boolean droppable; public final Integer price; public final cfg.item.EUseType useType; public final Integer levelUpId; public void resolve(java.util.HashMap<String, Object> _tables) { } @Override public String toString() { return "{ " + "id:" + id + "," + "name:" + name + "," + "majorType:" + majorType + "," + "minorType:" + minorType + "," + "maxPileNum:" + maxPileNum + "," + "quality:" + quality + "," + "icon:" + icon + "," + "iconBackgroud:" + iconBackgroud + "," + "iconMask:" + iconMask + "," + "desc:" + desc + "," + "showOrder:" + showOrder + "," + "quantifier:" + quantifier + "," + "showInBag:" + showInBag + "," + "minShowLevel:" + minShowLevel + "," + "batchUsable:" + batchUsable + "," + "progressTimeWhenUse:" + progressTimeWhenUse + "," + "showHintWhenUse:" + showHintWhenUse + "," + "droppable:" + droppable + "," + "price:" + price + "," + "useType:" + useType + "," + "levelUpId:" + levelUpId + "," + "}"; } } <|start_filename|>Projects/Go_json/gen/src/cfg/ai.Service.go<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg import "errors" type AiService struct { Id int32 NodeName string } const TypeId_AiService = -472395057 func (*AiService) GetTypeId() int32 { return -472395057 } func (_v *AiService)Deserialize(_buf map[string]interface{}) (err error) { { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["id"].(float64); !_ok_ { err = errors.New("id error"); return }; _v.Id = int32(_tempNum_) } { var _ok_ bool; if _v.NodeName, _ok_ = _buf["node_name"].(string); !_ok_ { err = errors.New("node_name error"); return } } return } func DeserializeAiService(_buf map[string]interface{}) (interface{}, error) { var id string var _ok_ bool if id, _ok_ = _buf["__type__"].(string) ; !_ok_ { return nil, errors.New("type id missing") } switch id { case "UeSetDefaultFocus": _v := &AiUeSetDefaultFocus{}; if err := _v.Deserialize(_buf); err != nil { return nil, errors.New("ai.UeSetDefaultFocus") } else { return _v, nil } case "ExecuteTimeStatistic": _v := &AiExecuteTimeStatistic{}; if err := _v.Deserialize(_buf); err != nil { return nil, errors.New("ai.ExecuteTimeStatistic") } else { return _v, nil } case "ChooseTarget": _v := &AiChooseTarget{}; if err := _v.Deserialize(_buf); err != nil { return nil, errors.New("ai.ChooseTarget") } else { return _v, nil } case "KeepFaceTarget": _v := &AiKeepFaceTarget{}; if err := _v.Deserialize(_buf); err != nil { return nil, errors.New("ai.KeepFaceTarget") } else { return _v, nil } case "GetOwnerPlayer": _v := &AiGetOwnerPlayer{}; if err := _v.Deserialize(_buf); err != nil { return nil, errors.New("ai.GetOwnerPlayer") } else { return _v, nil } case "UpdateDailyBehaviorProps": _v := &AiUpdateDailyBehaviorProps{}; if err := _v.Deserialize(_buf); err != nil { return nil, errors.New("ai.UpdateDailyBehaviorProps") } else { return _v, nil } default: return nil, errors.New("unknown type id") } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_AndroidJNIHelper_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_AndroidJNIHelper_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.AndroidJNIHelper constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetConstructorID(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(System.IntPtr), false, false)) { var Arg0 = argHelper0.Get<System.IntPtr>(false); var result = UnityEngine.AndroidJNIHelper.GetConstructorID(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(System.IntPtr), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.GetString(false); var result = UnityEngine.AndroidJNIHelper.GetConstructorID(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(System.IntPtr), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Object[]), false, false)) { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.Get<System.Object[]>(false); var result = UnityEngine.AndroidJNIHelper.GetConstructorID(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetConstructorID"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetMethodID(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(System.IntPtr), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.GetString(false); var result = UnityEngine.AndroidJNIHelper.GetMethodID(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(System.IntPtr), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.GetString(false); var Arg2 = argHelper2.GetString(false); var result = UnityEngine.AndroidJNIHelper.GetMethodID(Arg0,Arg1,Arg2); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(System.IntPtr), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.GetString(false); var Arg2 = argHelper2.GetString(false); var Arg3 = argHelper3.GetBoolean(false); var result = UnityEngine.AndroidJNIHelper.GetMethodID(Arg0,Arg1,Arg2,Arg3); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(System.IntPtr), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Object[]), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.GetString(false); var Arg2 = argHelper2.Get<System.Object[]>(false); var Arg3 = argHelper3.GetBoolean(false); var result = UnityEngine.AndroidJNIHelper.GetMethodID(Arg0,Arg1,Arg2,Arg3); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetMethodID"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetFieldID(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(System.IntPtr), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.GetString(false); var result = UnityEngine.AndroidJNIHelper.GetFieldID(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(System.IntPtr), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.GetString(false); var Arg2 = argHelper2.GetString(false); var result = UnityEngine.AndroidJNIHelper.GetFieldID(Arg0,Arg1,Arg2); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(System.IntPtr), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.GetString(false); var Arg2 = argHelper2.GetString(false); var Arg3 = argHelper3.GetBoolean(false); var result = UnityEngine.AndroidJNIHelper.GetFieldID(Arg0,Arg1,Arg2,Arg3); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetFieldID"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_CreateJavaRunnable(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.AndroidJavaRunnable>(false); var result = UnityEngine.AndroidJNIHelper.CreateJavaRunnable(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_CreateJavaProxy(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.AndroidJavaProxy>(false); var result = UnityEngine.AndroidJNIHelper.CreateJavaProxy(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_ConvertToJNIArray(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.Array>(false); var result = UnityEngine.AndroidJNIHelper.ConvertToJNIArray(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_CreateJNIArgArray(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.Object[]>(false); var result = UnityEngine.AndroidJNIHelper.CreateJNIArgArray(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_DeleteJNIArgArray(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<System.Object[]>(false); var Arg1 = argHelper1.Get<UnityEngine.jvalue[]>(false); UnityEngine.AndroidJNIHelper.DeleteJNIArgArray(Arg0,Arg1); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetSignature(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.Any, typeof(System.Object), false, false)) { var Arg0 = argHelper0.Get<System.Object>(false); var result = UnityEngine.AndroidJNIHelper.GetSignature(Arg0); Puerts.PuertsDLL.ReturnString(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Object[]), false, false)) { var Arg0 = argHelper0.Get<System.Object[]>(false); var result = UnityEngine.AndroidJNIHelper.GetSignature(Arg0); Puerts.PuertsDLL.ReturnString(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetSignature"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_debug(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.AndroidJNIHelper.debug; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_debug(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.AndroidJNIHelper.debug = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "GetConstructorID", IsStatic = true}, F_GetConstructorID }, { new Puerts.MethodKey {Name = "GetMethodID", IsStatic = true}, F_GetMethodID }, { new Puerts.MethodKey {Name = "GetFieldID", IsStatic = true}, F_GetFieldID }, { new Puerts.MethodKey {Name = "CreateJavaRunnable", IsStatic = true}, F_CreateJavaRunnable }, { new Puerts.MethodKey {Name = "CreateJavaProxy", IsStatic = true}, F_CreateJavaProxy }, { new Puerts.MethodKey {Name = "ConvertToJNIArray", IsStatic = true}, F_ConvertToJNIArray }, { new Puerts.MethodKey {Name = "CreateJNIArgArray", IsStatic = true}, F_CreateJNIArgArray }, { new Puerts.MethodKey {Name = "DeleteJNIArgArray", IsStatic = true}, F_DeleteJNIArgArray }, { new Puerts.MethodKey {Name = "GetSignature", IsStatic = true}, F_GetSignature }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"debug", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_debug, Setter = S_debug} }, } }; } } } <|start_filename|>Projects/GenerateDatas/convert_lua/role.TbRoleLevelExpAttr/33.lua<|end_filename|> return { level = 33, need_exp = 15000, clothes_attrs = { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, }, } <|start_filename|>Projects/GenerateDatas/convert_lua/role.TbRoleLevelExpAttr/52.lua<|end_filename|> return { level = 52, need_exp = 85000, clothes_attrs = { 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, }, } <|start_filename|>Projects/Go_json/gen/src/cfg/ai.KeepFaceTarget.go<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg import "errors" type AiKeepFaceTarget struct { Id int32 NodeName string TargetActorKey string } const TypeId_AiKeepFaceTarget = 1195270745 func (*AiKeepFaceTarget) GetTypeId() int32 { return 1195270745 } func (_v *AiKeepFaceTarget)Deserialize(_buf map[string]interface{}) (err error) { { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["id"].(float64); !_ok_ { err = errors.New("id error"); return }; _v.Id = int32(_tempNum_) } { var _ok_ bool; if _v.NodeName, _ok_ = _buf["node_name"].(string); !_ok_ { err = errors.New("node_name error"); return } } { var _ok_ bool; if _v.TargetActorKey, _ok_ = _buf["target_actor_key"].(string); !_ok_ { err = errors.New("target_actor_key error"); return } } return } func DeserializeAiKeepFaceTarget(_buf map[string]interface{}) (*AiKeepFaceTarget, error) { v := &AiKeepFaceTarget{} if err := v.Deserialize(_buf); err == nil { return v, nil } else { return nil, err } } <|start_filename|>Projects/GenerateDatas/convert_lua/role.TbRoleLevelExpAttr/49.lua<|end_filename|> return { level = 49, need_exp = 70000, clothes_attrs = { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, }, } <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/test/DemoDynamic.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.test { public abstract partial class DemoDynamic : Bright.Config.BeanBase { public DemoDynamic(ByteBuf _buf) { X1 = _buf.ReadInt(); } public DemoDynamic(int x1 ) { this.X1 = x1; } public static DemoDynamic DeserializeDemoDynamic(ByteBuf _buf) { switch (_buf.ReadInt()) { case test.DemoD2.ID: return new test.DemoD2(_buf); case test.DemoE1.ID: return new test.DemoE1(_buf); case test.DemoD5.ID: return new test.DemoD5(_buf); default: throw new SerializationException(); } } public readonly int X1; public virtual void Resolve(Dictionary<string, object> _tables) { OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); public override string ToString() { return "{ " + "X1:" + X1 + "," + "}"; } } } <|start_filename|>Projects/Csharp_CustomTemplate_EncryptMemory/Gen/item/TreasureBox.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using System; using Newtonsoft.Json; using Scripts; namespace cfg.item { [Serializable] public partial class TreasureBox : AConfig { [JsonProperty("key_item_id")] private int? _key_item_id { get; set; } [JsonIgnore] public EncryptInt key_item_id { get; private set; } = new(); [JsonProperty] public condition.MinLevel open_level { get; set; } public bool use_on_obtain { get; set; } public System.Collections.Generic.List<int> drop_ids { get; set; } public System.Collections.Generic.List<item.ChooseOneBonus> choose_list { get; set; } public override void EndInit() { key_item_id = _key_item_id; open_level.EndInit(); foreach(var _e in choose_list) { _e.EndInit(); } } public override string ToString() => JsonConvert.SerializeObject(this); } } <|start_filename|>Projects/Csharp_Unity_bin_use_UnityEngine_Vector/Assets/Gen/test/DemoDynamic.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.test { public abstract class DemoDynamic : Bright.Config.BeanBase { public DemoDynamic(ByteBuf _buf) { X1 = _buf.ReadInt(); } public static DemoDynamic DeserializeDemoDynamic(ByteBuf _buf) { switch (_buf.ReadInt()) { case test.DemoD2.__ID__: return new test.DemoD2(_buf); case test.DemoE1.__ID__: return new test.DemoE1(_buf); case test.DemoD5.__ID__: return new test.DemoD5(_buf); default: throw new SerializationException(); } } public int X1 { get; private set; } public virtual void Resolve(Dictionary<string, object> _tables) { } public virtual void TranslateText(System.Func<string, string, string> translator) { } public override string ToString() { return "{ " + "X1:" + X1 + "," + "}"; } } } <|start_filename|>Projects/java_json/src/gen/cfg/test/DemoSingletonType.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.test; import com.google.gson.JsonElement; import com.google.gson.JsonObject; public final class DemoSingletonType { public DemoSingletonType(JsonObject __json__) { id = __json__.get("id").getAsInt(); __json__.get("name").getAsJsonObject().get("key").getAsString(); name = __json__.get("name").getAsJsonObject().get("text").getAsString(); date = cfg.test.DemoDynamic.deserializeDemoDynamic(__json__.get("date").getAsJsonObject()); } public DemoSingletonType(int id, String name, cfg.test.DemoDynamic date ) { this.id = id; this.name = name; this.date = date; } public static DemoSingletonType deserializeDemoSingletonType(JsonObject __json__) { return new DemoSingletonType(__json__); } public final int id; public final String name; public final cfg.test.DemoDynamic date; public void resolve(java.util.HashMap<String, Object> _tables) { if (date != null) {date.resolve(_tables);} } @Override public String toString() { return "{ " + "id:" + id + "," + "name:" + name + "," + "date:" + date + "," + "}"; } } <|start_filename|>Projects/Java_bin/src/main/gen/cfg/test/TestDesc.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.test; import bright.serialization.*; public final class TestDesc { public TestDesc(ByteBuf _buf) { id = _buf.readInt(); name = _buf.readString(); a1 = _buf.readInt(); a2 = _buf.readInt(); x1 = new cfg.test.H1(_buf); {int n = Math.min(_buf.readSize(), _buf.size());x2 = new java.util.ArrayList<cfg.test.H2>(n);for(int i = 0 ; i < n ; i++) { cfg.test.H2 _e; _e = new cfg.test.H2(_buf); x2.add(_e);}} {int n = Math.min(_buf.readSize(), _buf.size());x3 = new cfg.test.H2[n];for(int i = 0 ; i < n ; i++) { cfg.test.H2 _e;_e = new cfg.test.H2(_buf); x3[i] = _e;}} } public TestDesc(int id, String name, int a1, int a2, cfg.test.H1 x1, java.util.ArrayList<cfg.test.H2> x2, cfg.test.H2[] x3 ) { this.id = id; this.name = name; this.a1 = a1; this.a2 = a2; this.x1 = x1; this.x2 = x2; this.x3 = x3; } public final int id; /** * 禁止 */ public final String name; /** * 测试换行<br/>第2行<br/>第3层 */ public final int a1; /** * 测试转义 &lt; &amp; % / # &gt; */ public final int a2; public final cfg.test.H1 x1; /** * 这是x2 */ public final java.util.ArrayList<cfg.test.H2> x2; public final cfg.test.H2[] x3; public void resolve(java.util.HashMap<String, Object> _tables) { if (x1 != null) {x1.resolve(_tables);} for(cfg.test.H2 _e : x2) { if (_e != null) _e.resolve(_tables); } for(cfg.test.H2 _e : x3) { if (_e != null) _e.resolve(_tables); } } @Override public String toString() { return "{ " + "id:" + id + "," + "name:" + name + "," + "a1:" + a1 + "," + "a2:" + a2 + "," + "x1:" + x1 + "," + "x2:" + x2 + "," + "x3:" + x3 + "," + "}"; } } <|start_filename|>Projects/DataTemplates/template_json/test_tbdefinefromexcelone.json<|end_filename|> {"unlock_equip":10,"unlock_hero":20,"default_avatar":"Assets/Icon/DefaultAvatar.png","default_item":"Assets/Icon/DefaultAvatar.png"} <|start_filename|>Projects/Java_bin/src/main/gen/cfg/role/LevelBonus.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.role; import bright.serialization.*; public final class LevelBonus { public LevelBonus(ByteBuf _buf) { id = _buf.readInt(); {int n = Math.min(_buf.readSize(), _buf.size());distinctBonusInfos = new java.util.ArrayList<cfg.role.DistinctBonusInfos>(n);for(int i = 0 ; i < n ; i++) { cfg.role.DistinctBonusInfos _e; _e = new cfg.role.DistinctBonusInfos(_buf); distinctBonusInfos.add(_e);}} } public LevelBonus(int id, java.util.ArrayList<cfg.role.DistinctBonusInfos> distinct_bonus_infos ) { this.id = id; this.distinctBonusInfos = distinct_bonus_infos; } public final int id; public final java.util.ArrayList<cfg.role.DistinctBonusInfos> distinctBonusInfos; public void resolve(java.util.HashMap<String, Object> _tables) { for(cfg.role.DistinctBonusInfos _e : distinctBonusInfos) { if (_e != null) _e.resolve(_tables); } } @Override public String toString() { return "{ " + "id:" + id + "," + "distinctBonusInfos:" + distinctBonusInfos + "," + "}"; } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Js/JsHelpers.cs<|end_filename|> using Bright.Serialization; using Puerts; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; public class JsHelpers { public static ByteBuf LoadFromFile(string baseDir, string file) { return new ByteBuf(File.ReadAllBytes(Path.Combine(baseDir, file))); } public static string ReadAllText(string baseDir, string file) { return File.ReadAllText(Path.Combine(baseDir, file), Encoding.UTF8); } } <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/ai/UeWait.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.ai { public sealed partial class UeWait : ai.Task { public UeWait(ByteBuf _buf) : base(_buf) { WaitTime = _buf.ReadFloat(); RandomDeviation = _buf.ReadFloat(); } public UeWait(int id, string node_name, System.Collections.Generic.List<ai.Decorator> decorators, System.Collections.Generic.List<ai.Service> services, bool ignore_restart_self, float wait_time, float random_deviation ) : base(id,node_name,decorators,services,ignore_restart_self) { this.WaitTime = wait_time; this.RandomDeviation = random_deviation; } public static UeWait DeserializeUeWait(ByteBuf _buf) { return new ai.UeWait(_buf); } public readonly float WaitTime; public readonly float RandomDeviation; public const int ID = -512994101; public override int GetTypeId() => ID; public override void Resolve(Dictionary<string, object> _tables) { base.Resolve(_tables); OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); public override string ToString() { return "{ " + "Id:" + Id + "," + "NodeName:" + NodeName + "," + "Decorators:" + Bright.Common.StringUtil.CollectionToString(Decorators) + "," + "Services:" + Bright.Common.StringUtil.CollectionToString(Services) + "," + "IgnoreRestartSelf:" + IgnoreRestartSelf + "," + "WaitTime:" + WaitTime + "," + "RandomDeviation:" + RandomDeviation + "," + "}"; } } } <|start_filename|>ProtoProjects/go/gen/src/proto/ProtocolStub.go<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package proto import "bright/net" type ProtocolFactory = func () net.Protocol var ProtocolStub map[int]ProtocolFactory func init() { ProtocolStub = make(map[int]ProtocolFactory) ProtocolStub[23983] = func () net.Protocol { return &TestTestProto1{} } ProtocolStub[1234] = func () net.Protocol { return &TestFoo{} } ProtocolStub[8879] = func () net.Protocol { return &TestTestRpc{} } ProtocolStub[2355] = func () net.Protocol { return &TestTestRpc2{} } } <|start_filename|>Projects/java_json/src/gen/cfg/test/MultiRowTitle.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.test; import com.google.gson.JsonElement; import com.google.gson.JsonObject; public final class MultiRowTitle { public MultiRowTitle(JsonObject __json__) { id = __json__.get("id").getAsInt(); name = __json__.get("name").getAsString(); x1 = new cfg.test.H1(__json__.get("x1").getAsJsonObject()); { com.google.gson.JsonArray _json0_ = __json__.get("x2").getAsJsonArray(); x2 = new java.util.ArrayList<cfg.test.H2>(_json0_.size()); for(JsonElement __e : _json0_) { cfg.test.H2 __v; __v = new cfg.test.H2(__e.getAsJsonObject()); x2.add(__v); } } { com.google.gson.JsonArray _json0_ = __json__.get("x3").getAsJsonArray(); int _n = _json0_.size(); x3 = new cfg.test.H2[_n]; int _index=0; for(JsonElement __e : _json0_) { cfg.test.H2 __v; __v = new cfg.test.H2(__e.getAsJsonObject()); x3[_index++] = __v; } } { com.google.gson.JsonArray _json0_ = __json__.get("x4").getAsJsonArray(); int _n = _json0_.size(); x4 = new cfg.test.H2[_n]; int _index=0; for(JsonElement __e : _json0_) { cfg.test.H2 __v; __v = new cfg.test.H2(__e.getAsJsonObject()); x4[_index++] = __v; } } } public MultiRowTitle(int id, String name, cfg.test.H1 x1, java.util.ArrayList<cfg.test.H2> x2, cfg.test.H2[] x3, cfg.test.H2[] x4 ) { this.id = id; this.name = name; this.x1 = x1; this.x2 = x2; this.x3 = x3; this.x4 = x4; } public static MultiRowTitle deserializeMultiRowTitle(JsonObject __json__) { return new MultiRowTitle(__json__); } public final int id; public final String name; public final cfg.test.H1 x1; public final java.util.ArrayList<cfg.test.H2> x2; public final cfg.test.H2[] x3; public final cfg.test.H2[] x4; public void resolve(java.util.HashMap<String, Object> _tables) { if (x1 != null) {x1.resolve(_tables);} for(cfg.test.H2 _e : x2) { if (_e != null) _e.resolve(_tables); } for(cfg.test.H2 _e : x3) { if (_e != null) _e.resolve(_tables); } for(cfg.test.H2 _e : x4) { if (_e != null) _e.resolve(_tables); } } @Override public String toString() { return "{ " + "id:" + id + "," + "name:" + name + "," + "x1:" + x1 + "," + "x2:" + x2 + "," + "x3:" + x3 + "," + "x4:" + x4 + "," + "}"; } } <|start_filename|>Projects/GenerateDatas/convert_json/item.TbItem/1.json<|end_filename|> { "id": 1, "name": "钻石", "major_type": "货币", "minor_type": "钻石", "max_pile_num": 9999999, "quality": "白", "icon": "/Game/UI/UIText/UI_TestIcon_3.UI_TestIcon_3", "icon_backgroud": "", "icon_mask": "", "desc": "rmb兑换的主要货币", "show_order": 1, "quantifier": "个", "show_in_bag": true, "min_show_level": 5, "batch_usable": true, "progress_time_when_use": 1, "show_hint_when_use": false, "droppable": false, "use_type": "手动" } <|start_filename|>Projects/CfgValidator/Gen/test/ExcelFromJson.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; using System.Text.Json; namespace cfg.test { public sealed class ExcelFromJson : Bright.Config.BeanBase { public ExcelFromJson(JsonElement _json) { X4 = _json.GetProperty("x4").GetInt32(); X1 = _json.GetProperty("x1").GetBoolean(); X5 = _json.GetProperty("x5").GetInt64(); X6 = _json.GetProperty("x6").GetSingle(); S1 = _json.GetProperty("s1").GetString(); S2_l10n_key = _json.GetProperty("s2").GetProperty("key").GetString();S2 = _json.GetProperty("s2").GetProperty("text").GetString(); { var _json0 = _json.GetProperty("v2"); float __x; __x = _json0.GetProperty("x").GetSingle(); float __y; __y = _json0.GetProperty("y").GetSingle(); V2 = new System.Numerics.Vector2(__x, __y); } { var _json0 = _json.GetProperty("v3"); float __x; __x = _json0.GetProperty("x").GetSingle(); float __y; __y = _json0.GetProperty("y").GetSingle(); float __z; __z = _json0.GetProperty("z").GetSingle(); V3 = new System.Numerics.Vector3(__x, __y,__z); } { var _json0 = _json.GetProperty("v4"); float __x; __x = _json0.GetProperty("x").GetSingle(); float __y; __y = _json0.GetProperty("y").GetSingle(); float __z; __z = _json0.GetProperty("z").GetSingle(); float __w; __w = _json0.GetProperty("w").GetSingle(); V4 = new System.Numerics.Vector4(__x, __y, __z, __w); } T1 = _json.GetProperty("t1").GetInt32(); X12 = test.DemoType1.DeserializeDemoType1(_json.GetProperty("x12")); X13 = (test.DemoEnum)_json.GetProperty("x13").GetInt32(); X14 = test.DemoDynamic.DeserializeDemoDynamic(_json.GetProperty("x14")); { var _json0 = _json.GetProperty("k1"); int _n = _json0.GetArrayLength(); K1 = new int[_n]; int _index=0; foreach(JsonElement __e in _json0.EnumerateArray()) { int __v; __v = __e.GetInt32(); K1[_index++] = __v; } } { var _json0 = _json.GetProperty("k8"); K8 = new System.Collections.Generic.Dictionary<int, int>(_json0.GetArrayLength()); foreach(JsonElement __e in _json0.EnumerateArray()) { int __k; __k = __e[0].GetInt32(); int __v; __v = __e[1].GetInt32(); K8.Add(__k, __v); } } { var _json0 = _json.GetProperty("k9"); K9 = new System.Collections.Generic.List<test.DemoE2>(_json0.GetArrayLength()); foreach(JsonElement __e in _json0.EnumerateArray()) { test.DemoE2 __v; __v = test.DemoE2.DeserializeDemoE2(__e); K9.Add(__v); } } { var _json0 = _json.GetProperty("k15"); int _n = _json0.GetArrayLength(); K15 = new test.DemoDynamic[_n]; int _index=0; foreach(JsonElement __e in _json0.EnumerateArray()) { test.DemoDynamic __v; __v = test.DemoDynamic.DeserializeDemoDynamic(__e); K15[_index++] = __v; } } } public ExcelFromJson(int x4, bool x1, long x5, float x6, string s1, string s2, System.Numerics.Vector2 v2, System.Numerics.Vector3 v3, System.Numerics.Vector4 v4, int t1, test.DemoType1 x12, test.DemoEnum x13, test.DemoDynamic x14, int[] k1, System.Collections.Generic.Dictionary<int, int> k8, System.Collections.Generic.List<test.DemoE2> k9, test.DemoDynamic[] k15 ) { this.X4 = x4; this.X1 = x1; this.X5 = x5; this.X6 = x6; this.S1 = s1; this.S2 = s2; this.V2 = v2; this.V3 = v3; this.V4 = v4; this.T1 = t1; this.X12 = x12; this.X13 = x13; this.X14 = x14; this.K1 = k1; this.K8 = k8; this.K9 = k9; this.K15 = k15; } public static ExcelFromJson DeserializeExcelFromJson(JsonElement _json) { return new test.ExcelFromJson(_json); } public int X4 { get; private set; } public bool X1 { get; private set; } public long X5 { get; private set; } public float X6 { get; private set; } public string S1 { get; private set; } public string S2 { get; private set; } public string S2_l10n_key { get; } public System.Numerics.Vector2 V2 { get; private set; } public System.Numerics.Vector3 V3 { get; private set; } public System.Numerics.Vector4 V4 { get; private set; } public int T1 { get; private set; } public test.DemoType1 X12 { get; private set; } public test.DemoEnum X13 { get; private set; } public test.DemoDynamic X14 { get; private set; } public int[] K1 { get; private set; } public System.Collections.Generic.Dictionary<int, int> K8 { get; private set; } public System.Collections.Generic.List<test.DemoE2> K9 { get; private set; } public test.DemoDynamic[] K15 { get; private set; } public const int __ID__ = -1485706483; public override int GetTypeId() => __ID__; public void Resolve(Dictionary<string, object> _tables) { X12?.Resolve(_tables); X14?.Resolve(_tables); foreach(var _e in K9) { _e?.Resolve(_tables); } foreach(var _e in K15) { _e?.Resolve(_tables); } } public void TranslateText(System.Func<string, string, string> translator) { S2 = translator(S2_l10n_key, S2); X12?.TranslateText(translator); X14?.TranslateText(translator); foreach(var _e in K9) { _e?.TranslateText(translator); } foreach(var _e in K15) { _e?.TranslateText(translator); } } public override string ToString() { return "{ " + "X4:" + X4 + "," + "X1:" + X1 + "," + "X5:" + X5 + "," + "X6:" + X6 + "," + "S1:" + S1 + "," + "S2:" + S2 + "," + "V2:" + V2 + "," + "V3:" + V3 + "," + "V4:" + V4 + "," + "T1:" + T1 + "," + "X12:" + X12 + "," + "X13:" + X13 + "," + "X14:" + X14 + "," + "K1:" + Bright.Common.StringUtil.CollectionToString(K1) + "," + "K8:" + Bright.Common.StringUtil.CollectionToString(K8) + "," + "K9:" + Bright.Common.StringUtil.CollectionToString(K9) + "," + "K15:" + Bright.Common.StringUtil.CollectionToString(K15) + "," + "}"; } } } <|start_filename|>Projects/DataTemplates/template_erlang2/common_tbglobalconfig.erl<|end_filename|> %% common.TbGlobalConfig -module(common_tbglobalconfig) -export([get/1,get_ids/0]) get() -> #{ bag_capacity => 500, bag_capacity_special => 50, bag_temp_expendable_capacity => 10, bag_temp_tool_capacity => 4, bag_init_capacity => 100, quick_bag_capacity => 4, cloth_bag_capacity => 1000, cloth_bag_init_capacity => 500, cloth_bag_capacity_special => 50, bag_init_items_drop_id => 1, mail_box_capacity => 100, damage_param_c => 1, damage_param_e => 0.75, damage_param_f => 10, damage_param_d => 0.8, role_speed => 5, monster_speed => 5, init_energy => 0, init_viality => 100, max_viality => 100, per_viality_recovery_time => 300 }; get_ids() -> []. <|start_filename|>Projects/Java_bin/src/main/gen/cfg/ai/Decorator.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.ai; import bright.serialization.*; public abstract class Decorator extends cfg.ai.Node { public Decorator(ByteBuf _buf) { super(_buf); flowAbortMode = cfg.ai.EFlowAbortMode.valueOf(_buf.readInt()); } public Decorator(int id, String node_name, cfg.ai.EFlowAbortMode flow_abort_mode ) { super(id, node_name); this.flowAbortMode = flow_abort_mode; } public static Decorator deserializeDecorator(ByteBuf _buf) { switch (_buf.readInt()) { case cfg.ai.UeLoop.__ID__: return new cfg.ai.UeLoop(_buf); case cfg.ai.UeCooldown.__ID__: return new cfg.ai.UeCooldown(_buf); case cfg.ai.UeTimeLimit.__ID__: return new cfg.ai.UeTimeLimit(_buf); case cfg.ai.UeBlackboard.__ID__: return new cfg.ai.UeBlackboard(_buf); case cfg.ai.UeForceSuccess.__ID__: return new cfg.ai.UeForceSuccess(_buf); case cfg.ai.IsAtLocation.__ID__: return new cfg.ai.IsAtLocation(_buf); case cfg.ai.DistanceLessThan.__ID__: return new cfg.ai.DistanceLessThan(_buf); default: throw new SerializationException(); } } public final cfg.ai.EFlowAbortMode flowAbortMode; @Override public void resolve(java.util.HashMap<String, Object> _tables) { super.resolve(_tables); } @Override public String toString() { return "{ " + "id:" + id + "," + "nodeName:" + nodeName + "," + "flowAbortMode:" + flowAbortMode + "," + "}"; } } <|start_filename|>Projects/Csharp_DotNet5_json_ExportServer/Gen/test/SepBean1.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; using System.Text.Json; namespace cfg.test { public sealed class SepBean1 : Bright.Config.BeanBase { public SepBean1(JsonElement _json) { A = _json.GetProperty("a").GetInt32(); B = _json.GetProperty("b").GetInt32(); C = _json.GetProperty("c").GetString(); } public SepBean1(int a, int b, string c ) { this.A = a; this.B = b; this.C = c; } public static SepBean1 DeserializeSepBean1(JsonElement _json) { return new test.SepBean1(_json); } public int A { get; private set; } public int B { get; private set; } public string C { get; private set; } public const int __ID__ = -1534339393; public override int GetTypeId() => __ID__; public void Resolve(Dictionary<string, object> _tables) { } public void TranslateText(System.Func<string, string, string> translator) { } public override string ToString() { return "{ " + "A:" + A + "," + "B:" + B + "," + "C:" + C + "," + "}"; } } } <|start_filename|>Projects/java_json/src/gen/cfg/blueprint/Method.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.blueprint; import com.google.gson.JsonElement; import com.google.gson.JsonObject; public abstract class Method { public Method(JsonObject __json__) { name = __json__.get("name").getAsString(); desc = __json__.get("desc").getAsString(); isStatic = __json__.get("is_static").getAsBoolean(); returnType = __json__.get("return_type").getAsString(); { com.google.gson.JsonArray _json0_ = __json__.get("parameters").getAsJsonArray(); parameters = new java.util.ArrayList<cfg.blueprint.ParamInfo>(_json0_.size()); for(JsonElement __e : _json0_) { cfg.blueprint.ParamInfo __v; __v = new cfg.blueprint.ParamInfo(__e.getAsJsonObject()); parameters.add(__v); } } } public Method(String name, String desc, boolean is_static, String return_type, java.util.ArrayList<cfg.blueprint.ParamInfo> parameters ) { this.name = name; this.desc = desc; this.isStatic = is_static; this.returnType = return_type; this.parameters = parameters; } public static Method deserializeMethod(JsonObject __json__) { switch (__json__.get("__type__").getAsString()) { case "AbstraceMethod": return new cfg.blueprint.AbstraceMethod(__json__); case "ExternalMethod": return new cfg.blueprint.ExternalMethod(__json__); case "BlueprintMethod": return new cfg.blueprint.BlueprintMethod(__json__); default: throw new bright.serialization.SerializationException(); } } public final String name; public final String desc; public final boolean isStatic; public final String returnType; public final java.util.ArrayList<cfg.blueprint.ParamInfo> parameters; public abstract int getTypeId(); public void resolve(java.util.HashMap<String, Object> _tables) { for(cfg.blueprint.ParamInfo _e : parameters) { if (_e != null) _e.resolve(_tables); } } @Override public String toString() { return "{ " + "name:" + name + "," + "desc:" + desc + "," + "isStatic:" + isStatic + "," + "returnType:" + returnType + "," + "parameters:" + parameters + "," + "}"; } } <|start_filename|>Projects/java_json/src/gen/cfg/bonus/Bonus.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.bonus; import com.google.gson.JsonElement; import com.google.gson.JsonObject; public abstract class Bonus { public Bonus(JsonObject __json__) { } public Bonus() { } public static Bonus deserializeBonus(JsonObject __json__) { switch (__json__.get("__type__").getAsString()) { case "OneItem": return new cfg.bonus.OneItem(__json__); case "OneItems": return new cfg.bonus.OneItems(__json__); case "Item": return new cfg.bonus.Item(__json__); case "Items": return new cfg.bonus.Items(__json__); case "CoefficientItem": return new cfg.bonus.CoefficientItem(__json__); case "WeightItems": return new cfg.bonus.WeightItems(__json__); case "ProbabilityItems": return new cfg.bonus.ProbabilityItems(__json__); case "MultiBonus": return new cfg.bonus.MultiBonus(__json__); case "ProbabilityBonus": return new cfg.bonus.ProbabilityBonus(__json__); case "WeightBonus": return new cfg.bonus.WeightBonus(__json__); case "DropBonus": return new cfg.bonus.DropBonus(__json__); default: throw new bright.serialization.SerializationException(); } } public abstract int getTypeId(); public void resolve(java.util.HashMap<String, Object> _tables) { } @Override public String toString() { return "{ " + "}"; } } <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/role/TbRoleLevelBonusCoefficient.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.role { public sealed partial class TbRoleLevelBonusCoefficient { private readonly Dictionary<int, role.LevelBonus> _dataMap; private readonly List<role.LevelBonus> _dataList; public TbRoleLevelBonusCoefficient(ByteBuf _buf) { _dataMap = new Dictionary<int, role.LevelBonus>(); _dataList = new List<role.LevelBonus>(); for(int n = _buf.ReadSize() ; n > 0 ; --n) { role.LevelBonus _v; _v = role.LevelBonus.DeserializeLevelBonus(_buf); _dataList.Add(_v); _dataMap.Add(_v.Id, _v); } } public Dictionary<int, role.LevelBonus> DataMap => _dataMap; public List<role.LevelBonus> DataList => _dataList; public role.LevelBonus GetOrDefault(int key) => _dataMap.TryGetValue(key, out var v) ? v : null; public role.LevelBonus Get(int key) => _dataMap[key]; public role.LevelBonus this[int key] => _dataMap[key]; public void Resolve(Dictionary<string, object> _tables) { foreach(var v in _dataList) { v.Resolve(_tables); } OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_Physics2D_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_Physics2D_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.Physics2D(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.Physics2D), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_Simulate(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetFloat(false); var result = UnityEngine.Physics2D.Simulate(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_SyncTransforms(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { { UnityEngine.Physics2D.SyncTransforms(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_IgnoreCollision(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Collider2D), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Collider2D), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Collider2D>(false); var Arg1 = argHelper1.Get<UnityEngine.Collider2D>(false); UnityEngine.Physics2D.IgnoreCollision(Arg0,Arg1); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Collider2D), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Collider2D), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Collider2D>(false); var Arg1 = argHelper1.Get<UnityEngine.Collider2D>(false); var Arg2 = argHelper2.GetBoolean(false); UnityEngine.Physics2D.IgnoreCollision(Arg0,Arg1,Arg2); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to IgnoreCollision"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetIgnoreCollision(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<UnityEngine.Collider2D>(false); var Arg1 = argHelper1.Get<UnityEngine.Collider2D>(false); var result = UnityEngine.Physics2D.GetIgnoreCollision(Arg0,Arg1); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_IgnoreLayerCollision(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); UnityEngine.Physics2D.IgnoreLayerCollision(Arg0,Arg1); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetBoolean(false); UnityEngine.Physics2D.IgnoreLayerCollision(Arg0,Arg1,Arg2); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to IgnoreLayerCollision"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetIgnoreLayerCollision(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var result = UnityEngine.Physics2D.GetIgnoreLayerCollision(Arg0,Arg1); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_SetLayerCollisionMask(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); UnityEngine.Physics2D.SetLayerCollisionMask(Arg0,Arg1); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetLayerCollisionMask(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); var result = UnityEngine.Physics2D.GetLayerCollisionMask(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_IsTouching(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Collider2D), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Collider2D), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Collider2D>(false); var Arg1 = argHelper1.Get<UnityEngine.Collider2D>(false); var result = UnityEngine.Physics2D.IsTouching(Arg0,Arg1); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Collider2D), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Collider2D>(false); var Arg1 = argHelper1.Get<UnityEngine.ContactFilter2D>(false); var result = UnityEngine.Physics2D.IsTouching(Arg0,Arg1); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Collider2D), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Collider2D), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Collider2D>(false); var Arg1 = argHelper1.Get<UnityEngine.Collider2D>(false); var Arg2 = argHelper2.Get<UnityEngine.ContactFilter2D>(false); var result = UnityEngine.Physics2D.IsTouching(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to IsTouching"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_IsTouchingLayers(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Collider2D), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Collider2D>(false); var result = UnityEngine.Physics2D.IsTouchingLayers(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Collider2D), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Collider2D>(false); var Arg1 = argHelper1.GetInt32(false); var result = UnityEngine.Physics2D.IsTouchingLayers(Arg0,Arg1); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to IsTouchingLayers"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_Distance(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<UnityEngine.Collider2D>(false); var Arg1 = argHelper1.Get<UnityEngine.Collider2D>(false); var result = UnityEngine.Physics2D.Distance(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_ClosestPoint(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Collider2D), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Collider2D>(false); var result = UnityEngine.Physics2D.ClosestPoint(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rigidbody2D), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Rigidbody2D>(false); var result = UnityEngine.Physics2D.ClosestPoint(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to ClosestPoint"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_Linecast(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var result = UnityEngine.Physics2D.Linecast(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.GetInt32(false); var result = UnityEngine.Physics2D.Linecast(Arg0,Arg1,Arg2); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetFloat(false); var result = UnityEngine.Physics2D.Linecast(Arg0,Arg1,Arg2,Arg3); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit2D[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.Get<UnityEngine.ContactFilter2D>(false); var Arg3 = argHelper3.Get<UnityEngine.RaycastHit2D[]>(false); var result = UnityEngine.Physics2D.Linecast(Arg0,Arg1,Arg2,Arg3); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.RaycastHit2D>), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.Get<UnityEngine.ContactFilter2D>(false); var Arg3 = argHelper3.Get<System.Collections.Generic.List<UnityEngine.RaycastHit2D>>(false); var result = UnityEngine.Physics2D.Linecast(Arg0,Arg1,Arg2,Arg3); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.GetFloat(false); var result = UnityEngine.Physics2D.Linecast(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to Linecast"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_LinecastAll(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var result = UnityEngine.Physics2D.LinecastAll(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.GetInt32(false); var result = UnityEngine.Physics2D.LinecastAll(Arg0,Arg1,Arg2); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetFloat(false); var result = UnityEngine.Physics2D.LinecastAll(Arg0,Arg1,Arg2,Arg3); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.GetFloat(false); var result = UnityEngine.Physics2D.LinecastAll(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to LinecastAll"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_LinecastNonAlloc(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit2D[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.Get<UnityEngine.RaycastHit2D[]>(false); var result = UnityEngine.Physics2D.LinecastNonAlloc(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit2D[]), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.Get<UnityEngine.RaycastHit2D[]>(false); var Arg3 = argHelper3.GetInt32(false); var result = UnityEngine.Physics2D.LinecastNonAlloc(Arg0,Arg1,Arg2,Arg3); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit2D[]), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.Get<UnityEngine.RaycastHit2D[]>(false); var Arg3 = argHelper3.GetInt32(false); var Arg4 = argHelper4.GetFloat(false); var result = UnityEngine.Physics2D.LinecastNonAlloc(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 6) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit2D[]), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.Get<UnityEngine.RaycastHit2D[]>(false); var Arg3 = argHelper3.GetInt32(false); var Arg4 = argHelper4.GetFloat(false); var Arg5 = argHelper5.GetFloat(false); var result = UnityEngine.Physics2D.LinecastNonAlloc(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to LinecastNonAlloc"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_Raycast(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var result = UnityEngine.Physics2D.Raycast(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.GetFloat(false); var result = UnityEngine.Physics2D.Raycast(Arg0,Arg1,Arg2); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.GetInt32(false); var result = UnityEngine.Physics2D.Raycast(Arg0,Arg1,Arg2,Arg3); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit2D[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.Get<UnityEngine.ContactFilter2D>(false); var Arg3 = argHelper3.Get<UnityEngine.RaycastHit2D[]>(false); var result = UnityEngine.Physics2D.Raycast(Arg0,Arg1,Arg2,Arg3); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.RaycastHit2D>), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.Get<UnityEngine.ContactFilter2D>(false); var Arg3 = argHelper3.Get<System.Collections.Generic.List<UnityEngine.RaycastHit2D>>(false); var result = UnityEngine.Physics2D.Raycast(Arg0,Arg1,Arg2,Arg3); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.GetInt32(false); var Arg4 = argHelper4.GetFloat(false); var result = UnityEngine.Physics2D.Raycast(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit2D[]), false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.Get<UnityEngine.ContactFilter2D>(false); var Arg3 = argHelper3.Get<UnityEngine.RaycastHit2D[]>(false); var Arg4 = argHelper4.GetFloat(false); var result = UnityEngine.Physics2D.Raycast(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.RaycastHit2D>), false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.Get<UnityEngine.ContactFilter2D>(false); var Arg3 = argHelper3.Get<System.Collections.Generic.List<UnityEngine.RaycastHit2D>>(false); var Arg4 = argHelper4.GetFloat(false); var result = UnityEngine.Physics2D.Raycast(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 6) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.GetInt32(false); var Arg4 = argHelper4.GetFloat(false); var Arg5 = argHelper5.GetFloat(false); var result = UnityEngine.Physics2D.Raycast(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to Raycast"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_RaycastNonAlloc(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit2D[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.Get<UnityEngine.RaycastHit2D[]>(false); var result = UnityEngine.Physics2D.RaycastNonAlloc(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit2D[]), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.Get<UnityEngine.RaycastHit2D[]>(false); var Arg3 = argHelper3.GetFloat(false); var result = UnityEngine.Physics2D.RaycastNonAlloc(Arg0,Arg1,Arg2,Arg3); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit2D[]), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.Get<UnityEngine.RaycastHit2D[]>(false); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.GetInt32(false); var result = UnityEngine.Physics2D.RaycastNonAlloc(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 6) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit2D[]), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.Get<UnityEngine.RaycastHit2D[]>(false); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.GetInt32(false); var Arg5 = argHelper5.GetFloat(false); var result = UnityEngine.Physics2D.RaycastNonAlloc(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 7) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit2D[]), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.Get<UnityEngine.RaycastHit2D[]>(false); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.GetInt32(false); var Arg5 = argHelper5.GetFloat(false); var Arg6 = argHelper6.GetFloat(false); var result = UnityEngine.Physics2D.RaycastNonAlloc(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to RaycastNonAlloc"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_RaycastAll(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var result = UnityEngine.Physics2D.RaycastAll(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.GetFloat(false); var result = UnityEngine.Physics2D.RaycastAll(Arg0,Arg1,Arg2); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.GetInt32(false); var result = UnityEngine.Physics2D.RaycastAll(Arg0,Arg1,Arg2,Arg3); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.GetInt32(false); var Arg4 = argHelper4.GetFloat(false); var result = UnityEngine.Physics2D.RaycastAll(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 6) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.GetInt32(false); var Arg4 = argHelper4.GetFloat(false); var Arg5 = argHelper5.GetFloat(false); var result = UnityEngine.Physics2D.RaycastAll(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to RaycastAll"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_CircleCast(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.Get<UnityEngine.Vector2>(false); var result = UnityEngine.Physics2D.CircleCast(Arg0,Arg1,Arg2); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.Get<UnityEngine.Vector2>(false); var Arg3 = argHelper3.GetFloat(false); var result = UnityEngine.Physics2D.CircleCast(Arg0,Arg1,Arg2,Arg3); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.Get<UnityEngine.Vector2>(false); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.GetInt32(false); var result = UnityEngine.Physics2D.CircleCast(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit2D[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.Get<UnityEngine.Vector2>(false); var Arg3 = argHelper3.Get<UnityEngine.ContactFilter2D>(false); var Arg4 = argHelper4.Get<UnityEngine.RaycastHit2D[]>(false); var result = UnityEngine.Physics2D.CircleCast(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.RaycastHit2D>), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.Get<UnityEngine.Vector2>(false); var Arg3 = argHelper3.Get<UnityEngine.ContactFilter2D>(false); var Arg4 = argHelper4.Get<System.Collections.Generic.List<UnityEngine.RaycastHit2D>>(false); var result = UnityEngine.Physics2D.CircleCast(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 6) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.Get<UnityEngine.Vector2>(false); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.GetInt32(false); var Arg5 = argHelper5.GetFloat(false); var result = UnityEngine.Physics2D.CircleCast(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit2D[]), false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.Get<UnityEngine.Vector2>(false); var Arg3 = argHelper3.Get<UnityEngine.ContactFilter2D>(false); var Arg4 = argHelper4.Get<UnityEngine.RaycastHit2D[]>(false); var Arg5 = argHelper5.GetFloat(false); var result = UnityEngine.Physics2D.CircleCast(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.RaycastHit2D>), false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.Get<UnityEngine.Vector2>(false); var Arg3 = argHelper3.Get<UnityEngine.ContactFilter2D>(false); var Arg4 = argHelper4.Get<System.Collections.Generic.List<UnityEngine.RaycastHit2D>>(false); var Arg5 = argHelper5.GetFloat(false); var result = UnityEngine.Physics2D.CircleCast(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 7) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.Get<UnityEngine.Vector2>(false); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.GetInt32(false); var Arg5 = argHelper5.GetFloat(false); var Arg6 = argHelper6.GetFloat(false); var result = UnityEngine.Physics2D.CircleCast(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to CircleCast"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_CircleCastAll(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.Get<UnityEngine.Vector2>(false); var result = UnityEngine.Physics2D.CircleCastAll(Arg0,Arg1,Arg2); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.Get<UnityEngine.Vector2>(false); var Arg3 = argHelper3.GetFloat(false); var result = UnityEngine.Physics2D.CircleCastAll(Arg0,Arg1,Arg2,Arg3); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.Get<UnityEngine.Vector2>(false); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.GetInt32(false); var result = UnityEngine.Physics2D.CircleCastAll(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 6) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.Get<UnityEngine.Vector2>(false); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.GetInt32(false); var Arg5 = argHelper5.GetFloat(false); var result = UnityEngine.Physics2D.CircleCastAll(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 7) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.Get<UnityEngine.Vector2>(false); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.GetInt32(false); var Arg5 = argHelper5.GetFloat(false); var Arg6 = argHelper6.GetFloat(false); var result = UnityEngine.Physics2D.CircleCastAll(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to CircleCastAll"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_CircleCastNonAlloc(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit2D[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.Get<UnityEngine.Vector2>(false); var Arg3 = argHelper3.Get<UnityEngine.RaycastHit2D[]>(false); var result = UnityEngine.Physics2D.CircleCastNonAlloc(Arg0,Arg1,Arg2,Arg3); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit2D[]), false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.Get<UnityEngine.Vector2>(false); var Arg3 = argHelper3.Get<UnityEngine.RaycastHit2D[]>(false); var Arg4 = argHelper4.GetFloat(false); var result = UnityEngine.Physics2D.CircleCastNonAlloc(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 6) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit2D[]), false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.Get<UnityEngine.Vector2>(false); var Arg3 = argHelper3.Get<UnityEngine.RaycastHit2D[]>(false); var Arg4 = argHelper4.GetFloat(false); var Arg5 = argHelper5.GetInt32(false); var result = UnityEngine.Physics2D.CircleCastNonAlloc(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 7) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit2D[]), false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.Get<UnityEngine.Vector2>(false); var Arg3 = argHelper3.Get<UnityEngine.RaycastHit2D[]>(false); var Arg4 = argHelper4.GetFloat(false); var Arg5 = argHelper5.GetInt32(false); var Arg6 = argHelper6.GetFloat(false); var result = UnityEngine.Physics2D.CircleCastNonAlloc(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 8) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); var argHelper7 = new Puerts.ArgumentHelper((int)data, isolate, info, 7); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit2D[]), false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper7.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.Get<UnityEngine.Vector2>(false); var Arg3 = argHelper3.Get<UnityEngine.RaycastHit2D[]>(false); var Arg4 = argHelper4.GetFloat(false); var Arg5 = argHelper5.GetInt32(false); var Arg6 = argHelper6.GetFloat(false); var Arg7 = argHelper7.GetFloat(false); var result = UnityEngine.Physics2D.CircleCastNonAlloc(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to CircleCastNonAlloc"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_BoxCast(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.Get<UnityEngine.Vector2>(false); var result = UnityEngine.Physics2D.BoxCast(Arg0,Arg1,Arg2,Arg3); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.Get<UnityEngine.Vector2>(false); var Arg4 = argHelper4.GetFloat(false); var result = UnityEngine.Physics2D.BoxCast(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 6) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.Get<UnityEngine.Vector2>(false); var Arg4 = argHelper4.GetFloat(false); var Arg5 = argHelper5.GetInt32(false); var result = UnityEngine.Physics2D.BoxCast(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper4.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false) && argHelper5.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit2D[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.Get<UnityEngine.Vector2>(false); var Arg4 = argHelper4.Get<UnityEngine.ContactFilter2D>(false); var Arg5 = argHelper5.Get<UnityEngine.RaycastHit2D[]>(false); var result = UnityEngine.Physics2D.BoxCast(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper4.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false) && argHelper5.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.RaycastHit2D>), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.Get<UnityEngine.Vector2>(false); var Arg4 = argHelper4.Get<UnityEngine.ContactFilter2D>(false); var Arg5 = argHelper5.Get<System.Collections.Generic.List<UnityEngine.RaycastHit2D>>(false); var result = UnityEngine.Physics2D.BoxCast(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 7) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.Get<UnityEngine.Vector2>(false); var Arg4 = argHelper4.GetFloat(false); var Arg5 = argHelper5.GetInt32(false); var Arg6 = argHelper6.GetFloat(false); var result = UnityEngine.Physics2D.BoxCast(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper4.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false) && argHelper5.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit2D[]), false, false) && argHelper6.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.Get<UnityEngine.Vector2>(false); var Arg4 = argHelper4.Get<UnityEngine.ContactFilter2D>(false); var Arg5 = argHelper5.Get<UnityEngine.RaycastHit2D[]>(false); var Arg6 = argHelper6.GetFloat(false); var result = UnityEngine.Physics2D.BoxCast(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper4.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false) && argHelper5.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.RaycastHit2D>), false, false) && argHelper6.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.Get<UnityEngine.Vector2>(false); var Arg4 = argHelper4.Get<UnityEngine.ContactFilter2D>(false); var Arg5 = argHelper5.Get<System.Collections.Generic.List<UnityEngine.RaycastHit2D>>(false); var Arg6 = argHelper6.GetFloat(false); var result = UnityEngine.Physics2D.BoxCast(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 8) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); var argHelper7 = new Puerts.ArgumentHelper((int)data, isolate, info, 7); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper7.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.Get<UnityEngine.Vector2>(false); var Arg4 = argHelper4.GetFloat(false); var Arg5 = argHelper5.GetInt32(false); var Arg6 = argHelper6.GetFloat(false); var Arg7 = argHelper7.GetFloat(false); var result = UnityEngine.Physics2D.BoxCast(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to BoxCast"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_BoxCastAll(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.Get<UnityEngine.Vector2>(false); var result = UnityEngine.Physics2D.BoxCastAll(Arg0,Arg1,Arg2,Arg3); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.Get<UnityEngine.Vector2>(false); var Arg4 = argHelper4.GetFloat(false); var result = UnityEngine.Physics2D.BoxCastAll(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 6) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.Get<UnityEngine.Vector2>(false); var Arg4 = argHelper4.GetFloat(false); var Arg5 = argHelper5.GetInt32(false); var result = UnityEngine.Physics2D.BoxCastAll(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 7) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.Get<UnityEngine.Vector2>(false); var Arg4 = argHelper4.GetFloat(false); var Arg5 = argHelper5.GetInt32(false); var Arg6 = argHelper6.GetFloat(false); var result = UnityEngine.Physics2D.BoxCastAll(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 8) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); var argHelper7 = new Puerts.ArgumentHelper((int)data, isolate, info, 7); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper7.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.Get<UnityEngine.Vector2>(false); var Arg4 = argHelper4.GetFloat(false); var Arg5 = argHelper5.GetInt32(false); var Arg6 = argHelper6.GetFloat(false); var Arg7 = argHelper7.GetFloat(false); var result = UnityEngine.Physics2D.BoxCastAll(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to BoxCastAll"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_BoxCastNonAlloc(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit2D[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.Get<UnityEngine.Vector2>(false); var Arg4 = argHelper4.Get<UnityEngine.RaycastHit2D[]>(false); var result = UnityEngine.Physics2D.BoxCastNonAlloc(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 6) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit2D[]), false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.Get<UnityEngine.Vector2>(false); var Arg4 = argHelper4.Get<UnityEngine.RaycastHit2D[]>(false); var Arg5 = argHelper5.GetFloat(false); var result = UnityEngine.Physics2D.BoxCastNonAlloc(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 7) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit2D[]), false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.Get<UnityEngine.Vector2>(false); var Arg4 = argHelper4.Get<UnityEngine.RaycastHit2D[]>(false); var Arg5 = argHelper5.GetFloat(false); var Arg6 = argHelper6.GetInt32(false); var result = UnityEngine.Physics2D.BoxCastNonAlloc(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 8) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); var argHelper7 = new Puerts.ArgumentHelper((int)data, isolate, info, 7); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit2D[]), false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper7.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.Get<UnityEngine.Vector2>(false); var Arg4 = argHelper4.Get<UnityEngine.RaycastHit2D[]>(false); var Arg5 = argHelper5.GetFloat(false); var Arg6 = argHelper6.GetInt32(false); var Arg7 = argHelper7.GetFloat(false); var result = UnityEngine.Physics2D.BoxCastNonAlloc(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 9) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); var argHelper7 = new Puerts.ArgumentHelper((int)data, isolate, info, 7); var argHelper8 = new Puerts.ArgumentHelper((int)data, isolate, info, 8); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit2D[]), false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper7.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper8.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.Get<UnityEngine.Vector2>(false); var Arg4 = argHelper4.Get<UnityEngine.RaycastHit2D[]>(false); var Arg5 = argHelper5.GetFloat(false); var Arg6 = argHelper6.GetInt32(false); var Arg7 = argHelper7.GetFloat(false); var Arg8 = argHelper8.GetFloat(false); var result = UnityEngine.Physics2D.BoxCastNonAlloc(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7,Arg8); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to BoxCastNonAlloc"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_CapsuleCast(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = (UnityEngine.CapsuleDirection2D)argHelper2.GetInt32(false); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.Get<UnityEngine.Vector2>(false); var result = UnityEngine.Physics2D.CapsuleCast(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 6) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = (UnityEngine.CapsuleDirection2D)argHelper2.GetInt32(false); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.Get<UnityEngine.Vector2>(false); var Arg5 = argHelper5.GetFloat(false); var result = UnityEngine.Physics2D.CapsuleCast(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 7) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = (UnityEngine.CapsuleDirection2D)argHelper2.GetInt32(false); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.Get<UnityEngine.Vector2>(false); var Arg5 = argHelper5.GetFloat(false); var Arg6 = argHelper6.GetInt32(false); var result = UnityEngine.Physics2D.CapsuleCast(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper5.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false) && argHelper6.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit2D[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = (UnityEngine.CapsuleDirection2D)argHelper2.GetInt32(false); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.Get<UnityEngine.Vector2>(false); var Arg5 = argHelper5.Get<UnityEngine.ContactFilter2D>(false); var Arg6 = argHelper6.Get<UnityEngine.RaycastHit2D[]>(false); var result = UnityEngine.Physics2D.CapsuleCast(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper5.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false) && argHelper6.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.RaycastHit2D>), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = (UnityEngine.CapsuleDirection2D)argHelper2.GetInt32(false); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.Get<UnityEngine.Vector2>(false); var Arg5 = argHelper5.Get<UnityEngine.ContactFilter2D>(false); var Arg6 = argHelper6.Get<System.Collections.Generic.List<UnityEngine.RaycastHit2D>>(false); var result = UnityEngine.Physics2D.CapsuleCast(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 8) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); var argHelper7 = new Puerts.ArgumentHelper((int)data, isolate, info, 7); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper7.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = (UnityEngine.CapsuleDirection2D)argHelper2.GetInt32(false); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.Get<UnityEngine.Vector2>(false); var Arg5 = argHelper5.GetFloat(false); var Arg6 = argHelper6.GetInt32(false); var Arg7 = argHelper7.GetFloat(false); var result = UnityEngine.Physics2D.CapsuleCast(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper5.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false) && argHelper6.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit2D[]), false, false) && argHelper7.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = (UnityEngine.CapsuleDirection2D)argHelper2.GetInt32(false); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.Get<UnityEngine.Vector2>(false); var Arg5 = argHelper5.Get<UnityEngine.ContactFilter2D>(false); var Arg6 = argHelper6.Get<UnityEngine.RaycastHit2D[]>(false); var Arg7 = argHelper7.GetFloat(false); var result = UnityEngine.Physics2D.CapsuleCast(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper5.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false) && argHelper6.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.RaycastHit2D>), false, false) && argHelper7.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = (UnityEngine.CapsuleDirection2D)argHelper2.GetInt32(false); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.Get<UnityEngine.Vector2>(false); var Arg5 = argHelper5.Get<UnityEngine.ContactFilter2D>(false); var Arg6 = argHelper6.Get<System.Collections.Generic.List<UnityEngine.RaycastHit2D>>(false); var Arg7 = argHelper7.GetFloat(false); var result = UnityEngine.Physics2D.CapsuleCast(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 9) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); var argHelper7 = new Puerts.ArgumentHelper((int)data, isolate, info, 7); var argHelper8 = new Puerts.ArgumentHelper((int)data, isolate, info, 8); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper7.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper8.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = (UnityEngine.CapsuleDirection2D)argHelper2.GetInt32(false); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.Get<UnityEngine.Vector2>(false); var Arg5 = argHelper5.GetFloat(false); var Arg6 = argHelper6.GetInt32(false); var Arg7 = argHelper7.GetFloat(false); var Arg8 = argHelper8.GetFloat(false); var result = UnityEngine.Physics2D.CapsuleCast(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7,Arg8); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to CapsuleCast"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_CapsuleCastAll(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = (UnityEngine.CapsuleDirection2D)argHelper2.GetInt32(false); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.Get<UnityEngine.Vector2>(false); var result = UnityEngine.Physics2D.CapsuleCastAll(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 6) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = (UnityEngine.CapsuleDirection2D)argHelper2.GetInt32(false); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.Get<UnityEngine.Vector2>(false); var Arg5 = argHelper5.GetFloat(false); var result = UnityEngine.Physics2D.CapsuleCastAll(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 7) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = (UnityEngine.CapsuleDirection2D)argHelper2.GetInt32(false); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.Get<UnityEngine.Vector2>(false); var Arg5 = argHelper5.GetFloat(false); var Arg6 = argHelper6.GetInt32(false); var result = UnityEngine.Physics2D.CapsuleCastAll(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 8) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); var argHelper7 = new Puerts.ArgumentHelper((int)data, isolate, info, 7); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper7.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = (UnityEngine.CapsuleDirection2D)argHelper2.GetInt32(false); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.Get<UnityEngine.Vector2>(false); var Arg5 = argHelper5.GetFloat(false); var Arg6 = argHelper6.GetInt32(false); var Arg7 = argHelper7.GetFloat(false); var result = UnityEngine.Physics2D.CapsuleCastAll(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 9) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); var argHelper7 = new Puerts.ArgumentHelper((int)data, isolate, info, 7); var argHelper8 = new Puerts.ArgumentHelper((int)data, isolate, info, 8); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper7.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper8.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = (UnityEngine.CapsuleDirection2D)argHelper2.GetInt32(false); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.Get<UnityEngine.Vector2>(false); var Arg5 = argHelper5.GetFloat(false); var Arg6 = argHelper6.GetInt32(false); var Arg7 = argHelper7.GetFloat(false); var Arg8 = argHelper8.GetFloat(false); var result = UnityEngine.Physics2D.CapsuleCastAll(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7,Arg8); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to CapsuleCastAll"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_CapsuleCastNonAlloc(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 6) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper5.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit2D[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = (UnityEngine.CapsuleDirection2D)argHelper2.GetInt32(false); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.Get<UnityEngine.Vector2>(false); var Arg5 = argHelper5.Get<UnityEngine.RaycastHit2D[]>(false); var result = UnityEngine.Physics2D.CapsuleCastNonAlloc(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 7) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper5.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit2D[]), false, false) && argHelper6.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = (UnityEngine.CapsuleDirection2D)argHelper2.GetInt32(false); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.Get<UnityEngine.Vector2>(false); var Arg5 = argHelper5.Get<UnityEngine.RaycastHit2D[]>(false); var Arg6 = argHelper6.GetFloat(false); var result = UnityEngine.Physics2D.CapsuleCastNonAlloc(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 8) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); var argHelper7 = new Puerts.ArgumentHelper((int)data, isolate, info, 7); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper5.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit2D[]), false, false) && argHelper6.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper7.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = (UnityEngine.CapsuleDirection2D)argHelper2.GetInt32(false); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.Get<UnityEngine.Vector2>(false); var Arg5 = argHelper5.Get<UnityEngine.RaycastHit2D[]>(false); var Arg6 = argHelper6.GetFloat(false); var Arg7 = argHelper7.GetInt32(false); var result = UnityEngine.Physics2D.CapsuleCastNonAlloc(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 9) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); var argHelper7 = new Puerts.ArgumentHelper((int)data, isolate, info, 7); var argHelper8 = new Puerts.ArgumentHelper((int)data, isolate, info, 8); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper5.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit2D[]), false, false) && argHelper6.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper7.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper8.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = (UnityEngine.CapsuleDirection2D)argHelper2.GetInt32(false); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.Get<UnityEngine.Vector2>(false); var Arg5 = argHelper5.Get<UnityEngine.RaycastHit2D[]>(false); var Arg6 = argHelper6.GetFloat(false); var Arg7 = argHelper7.GetInt32(false); var Arg8 = argHelper8.GetFloat(false); var result = UnityEngine.Physics2D.CapsuleCastNonAlloc(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7,Arg8); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 10) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); var argHelper7 = new Puerts.ArgumentHelper((int)data, isolate, info, 7); var argHelper8 = new Puerts.ArgumentHelper((int)data, isolate, info, 8); var argHelper9 = new Puerts.ArgumentHelper((int)data, isolate, info, 9); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper5.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit2D[]), false, false) && argHelper6.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper7.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper8.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper9.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = (UnityEngine.CapsuleDirection2D)argHelper2.GetInt32(false); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.Get<UnityEngine.Vector2>(false); var Arg5 = argHelper5.Get<UnityEngine.RaycastHit2D[]>(false); var Arg6 = argHelper6.GetFloat(false); var Arg7 = argHelper7.GetInt32(false); var Arg8 = argHelper8.GetFloat(false); var Arg9 = argHelper9.GetFloat(false); var result = UnityEngine.Physics2D.CapsuleCastNonAlloc(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7,Arg8,Arg9); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to CapsuleCastNonAlloc"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetRayIntersection(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Ray), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Ray>(false); var result = UnityEngine.Physics2D.GetRayIntersection(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Ray), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Ray>(false); var Arg1 = argHelper1.GetFloat(false); var result = UnityEngine.Physics2D.GetRayIntersection(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Ray), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Ray>(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.GetInt32(false); var result = UnityEngine.Physics2D.GetRayIntersection(Arg0,Arg1,Arg2); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetRayIntersection"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetRayIntersectionAll(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Ray), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Ray>(false); var result = UnityEngine.Physics2D.GetRayIntersectionAll(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Ray), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Ray>(false); var Arg1 = argHelper1.GetFloat(false); var result = UnityEngine.Physics2D.GetRayIntersectionAll(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Ray), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Ray>(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.GetInt32(false); var result = UnityEngine.Physics2D.GetRayIntersectionAll(Arg0,Arg1,Arg2); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetRayIntersectionAll"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetRayIntersectionNonAlloc(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Ray), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit2D[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Ray>(false); var Arg1 = argHelper1.Get<UnityEngine.RaycastHit2D[]>(false); var result = UnityEngine.Physics2D.GetRayIntersectionNonAlloc(Arg0,Arg1); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Ray), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit2D[]), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Ray>(false); var Arg1 = argHelper1.Get<UnityEngine.RaycastHit2D[]>(false); var Arg2 = argHelper2.GetFloat(false); var result = UnityEngine.Physics2D.GetRayIntersectionNonAlloc(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Ray), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit2D[]), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Ray>(false); var Arg1 = argHelper1.Get<UnityEngine.RaycastHit2D[]>(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.GetInt32(false); var result = UnityEngine.Physics2D.GetRayIntersectionNonAlloc(Arg0,Arg1,Arg2,Arg3); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetRayIntersectionNonAlloc"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_OverlapPoint(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var result = UnityEngine.Physics2D.OverlapPoint(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.GetInt32(false); var result = UnityEngine.Physics2D.OverlapPoint(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetFloat(false); var result = UnityEngine.Physics2D.OverlapPoint(Arg0,Arg1,Arg2); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Collider2D[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.ContactFilter2D>(false); var Arg2 = argHelper2.Get<UnityEngine.Collider2D[]>(false); var result = UnityEngine.Physics2D.OverlapPoint(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Collider2D>), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.ContactFilter2D>(false); var Arg2 = argHelper2.Get<System.Collections.Generic.List<UnityEngine.Collider2D>>(false); var result = UnityEngine.Physics2D.OverlapPoint(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.GetFloat(false); var result = UnityEngine.Physics2D.OverlapPoint(Arg0,Arg1,Arg2,Arg3); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to OverlapPoint"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_OverlapPointAll(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var result = UnityEngine.Physics2D.OverlapPointAll(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.GetInt32(false); var result = UnityEngine.Physics2D.OverlapPointAll(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetFloat(false); var result = UnityEngine.Physics2D.OverlapPointAll(Arg0,Arg1,Arg2); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.GetFloat(false); var result = UnityEngine.Physics2D.OverlapPointAll(Arg0,Arg1,Arg2,Arg3); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to OverlapPointAll"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_OverlapPointNonAlloc(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Collider2D[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Collider2D[]>(false); var result = UnityEngine.Physics2D.OverlapPointNonAlloc(Arg0,Arg1); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Collider2D[]), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Collider2D[]>(false); var Arg2 = argHelper2.GetInt32(false); var result = UnityEngine.Physics2D.OverlapPointNonAlloc(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Collider2D[]), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Collider2D[]>(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetFloat(false); var result = UnityEngine.Physics2D.OverlapPointNonAlloc(Arg0,Arg1,Arg2,Arg3); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Collider2D[]), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Collider2D[]>(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.GetFloat(false); var result = UnityEngine.Physics2D.OverlapPointNonAlloc(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to OverlapPointNonAlloc"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_OverlapCircle(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.GetFloat(false); var result = UnityEngine.Physics2D.OverlapCircle(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.GetInt32(false); var result = UnityEngine.Physics2D.OverlapCircle(Arg0,Arg1,Arg2); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetFloat(false); var result = UnityEngine.Physics2D.OverlapCircle(Arg0,Arg1,Arg2,Arg3); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Collider2D[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.Get<UnityEngine.ContactFilter2D>(false); var Arg3 = argHelper3.Get<UnityEngine.Collider2D[]>(false); var result = UnityEngine.Physics2D.OverlapCircle(Arg0,Arg1,Arg2,Arg3); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Collider2D>), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.Get<UnityEngine.ContactFilter2D>(false); var Arg3 = argHelper3.Get<System.Collections.Generic.List<UnityEngine.Collider2D>>(false); var result = UnityEngine.Physics2D.OverlapCircle(Arg0,Arg1,Arg2,Arg3); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.GetFloat(false); var result = UnityEngine.Physics2D.OverlapCircle(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to OverlapCircle"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_OverlapCircleAll(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.GetFloat(false); var result = UnityEngine.Physics2D.OverlapCircleAll(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.GetInt32(false); var result = UnityEngine.Physics2D.OverlapCircleAll(Arg0,Arg1,Arg2); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetFloat(false); var result = UnityEngine.Physics2D.OverlapCircleAll(Arg0,Arg1,Arg2,Arg3); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.GetFloat(false); var result = UnityEngine.Physics2D.OverlapCircleAll(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to OverlapCircleAll"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_OverlapCircleNonAlloc(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Collider2D[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.Get<UnityEngine.Collider2D[]>(false); var result = UnityEngine.Physics2D.OverlapCircleNonAlloc(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Collider2D[]), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.Get<UnityEngine.Collider2D[]>(false); var Arg3 = argHelper3.GetInt32(false); var result = UnityEngine.Physics2D.OverlapCircleNonAlloc(Arg0,Arg1,Arg2,Arg3); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Collider2D[]), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.Get<UnityEngine.Collider2D[]>(false); var Arg3 = argHelper3.GetInt32(false); var Arg4 = argHelper4.GetFloat(false); var result = UnityEngine.Physics2D.OverlapCircleNonAlloc(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 6) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Collider2D[]), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.Get<UnityEngine.Collider2D[]>(false); var Arg3 = argHelper3.GetInt32(false); var Arg4 = argHelper4.GetFloat(false); var Arg5 = argHelper5.GetFloat(false); var result = UnityEngine.Physics2D.OverlapCircleNonAlloc(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to OverlapCircleNonAlloc"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_OverlapBox(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.GetFloat(false); var result = UnityEngine.Physics2D.OverlapBox(Arg0,Arg1,Arg2); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.GetInt32(false); var result = UnityEngine.Physics2D.OverlapBox(Arg0,Arg1,Arg2,Arg3); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.GetInt32(false); var Arg4 = argHelper4.GetFloat(false); var result = UnityEngine.Physics2D.OverlapBox(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Collider2D[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.Get<UnityEngine.ContactFilter2D>(false); var Arg4 = argHelper4.Get<UnityEngine.Collider2D[]>(false); var result = UnityEngine.Physics2D.OverlapBox(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Collider2D>), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.Get<UnityEngine.ContactFilter2D>(false); var Arg4 = argHelper4.Get<System.Collections.Generic.List<UnityEngine.Collider2D>>(false); var result = UnityEngine.Physics2D.OverlapBox(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 6) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.GetInt32(false); var Arg4 = argHelper4.GetFloat(false); var Arg5 = argHelper5.GetFloat(false); var result = UnityEngine.Physics2D.OverlapBox(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to OverlapBox"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_OverlapBoxAll(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.GetFloat(false); var result = UnityEngine.Physics2D.OverlapBoxAll(Arg0,Arg1,Arg2); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.GetInt32(false); var result = UnityEngine.Physics2D.OverlapBoxAll(Arg0,Arg1,Arg2,Arg3); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.GetInt32(false); var Arg4 = argHelper4.GetFloat(false); var result = UnityEngine.Physics2D.OverlapBoxAll(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 6) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.GetInt32(false); var Arg4 = argHelper4.GetFloat(false); var Arg5 = argHelper5.GetFloat(false); var result = UnityEngine.Physics2D.OverlapBoxAll(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to OverlapBoxAll"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_OverlapBoxNonAlloc(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Collider2D[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.Get<UnityEngine.Collider2D[]>(false); var result = UnityEngine.Physics2D.OverlapBoxNonAlloc(Arg0,Arg1,Arg2,Arg3); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Collider2D[]), false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.Get<UnityEngine.Collider2D[]>(false); var Arg4 = argHelper4.GetInt32(false); var result = UnityEngine.Physics2D.OverlapBoxNonAlloc(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 6) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Collider2D[]), false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.Get<UnityEngine.Collider2D[]>(false); var Arg4 = argHelper4.GetInt32(false); var Arg5 = argHelper5.GetFloat(false); var result = UnityEngine.Physics2D.OverlapBoxNonAlloc(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 7) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Collider2D[]), false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.Get<UnityEngine.Collider2D[]>(false); var Arg4 = argHelper4.GetInt32(false); var Arg5 = argHelper5.GetFloat(false); var Arg6 = argHelper6.GetFloat(false); var result = UnityEngine.Physics2D.OverlapBoxNonAlloc(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to OverlapBoxNonAlloc"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_OverlapArea(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var result = UnityEngine.Physics2D.OverlapArea(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.GetInt32(false); var result = UnityEngine.Physics2D.OverlapArea(Arg0,Arg1,Arg2); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetFloat(false); var result = UnityEngine.Physics2D.OverlapArea(Arg0,Arg1,Arg2,Arg3); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Collider2D[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.Get<UnityEngine.ContactFilter2D>(false); var Arg3 = argHelper3.Get<UnityEngine.Collider2D[]>(false); var result = UnityEngine.Physics2D.OverlapArea(Arg0,Arg1,Arg2,Arg3); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Collider2D>), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.Get<UnityEngine.ContactFilter2D>(false); var Arg3 = argHelper3.Get<System.Collections.Generic.List<UnityEngine.Collider2D>>(false); var result = UnityEngine.Physics2D.OverlapArea(Arg0,Arg1,Arg2,Arg3); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.GetFloat(false); var result = UnityEngine.Physics2D.OverlapArea(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to OverlapArea"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_OverlapAreaAll(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var result = UnityEngine.Physics2D.OverlapAreaAll(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.GetInt32(false); var result = UnityEngine.Physics2D.OverlapAreaAll(Arg0,Arg1,Arg2); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetFloat(false); var result = UnityEngine.Physics2D.OverlapAreaAll(Arg0,Arg1,Arg2,Arg3); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.GetFloat(false); var result = UnityEngine.Physics2D.OverlapAreaAll(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to OverlapAreaAll"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_OverlapAreaNonAlloc(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Collider2D[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.Get<UnityEngine.Collider2D[]>(false); var result = UnityEngine.Physics2D.OverlapAreaNonAlloc(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Collider2D[]), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.Get<UnityEngine.Collider2D[]>(false); var Arg3 = argHelper3.GetInt32(false); var result = UnityEngine.Physics2D.OverlapAreaNonAlloc(Arg0,Arg1,Arg2,Arg3); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Collider2D[]), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.Get<UnityEngine.Collider2D[]>(false); var Arg3 = argHelper3.GetInt32(false); var Arg4 = argHelper4.GetFloat(false); var result = UnityEngine.Physics2D.OverlapAreaNonAlloc(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 6) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Collider2D[]), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.Get<UnityEngine.Collider2D[]>(false); var Arg3 = argHelper3.GetInt32(false); var Arg4 = argHelper4.GetFloat(false); var Arg5 = argHelper5.GetFloat(false); var result = UnityEngine.Physics2D.OverlapAreaNonAlloc(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to OverlapAreaNonAlloc"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_OverlapCapsule(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = (UnityEngine.CapsuleDirection2D)argHelper2.GetInt32(false); var Arg3 = argHelper3.GetFloat(false); var result = UnityEngine.Physics2D.OverlapCapsule(Arg0,Arg1,Arg2,Arg3); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = (UnityEngine.CapsuleDirection2D)argHelper2.GetInt32(false); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.GetInt32(false); var result = UnityEngine.Physics2D.OverlapCapsule(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 6) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = (UnityEngine.CapsuleDirection2D)argHelper2.GetInt32(false); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.GetInt32(false); var Arg5 = argHelper5.GetFloat(false); var result = UnityEngine.Physics2D.OverlapCapsule(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false) && argHelper5.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Collider2D[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = (UnityEngine.CapsuleDirection2D)argHelper2.GetInt32(false); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.Get<UnityEngine.ContactFilter2D>(false); var Arg5 = argHelper5.Get<UnityEngine.Collider2D[]>(false); var result = UnityEngine.Physics2D.OverlapCapsule(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false) && argHelper5.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Collider2D>), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = (UnityEngine.CapsuleDirection2D)argHelper2.GetInt32(false); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.Get<UnityEngine.ContactFilter2D>(false); var Arg5 = argHelper5.Get<System.Collections.Generic.List<UnityEngine.Collider2D>>(false); var result = UnityEngine.Physics2D.OverlapCapsule(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 7) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = (UnityEngine.CapsuleDirection2D)argHelper2.GetInt32(false); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.GetInt32(false); var Arg5 = argHelper5.GetFloat(false); var Arg6 = argHelper6.GetFloat(false); var result = UnityEngine.Physics2D.OverlapCapsule(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to OverlapCapsule"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_OverlapCapsuleAll(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = (UnityEngine.CapsuleDirection2D)argHelper2.GetInt32(false); var Arg3 = argHelper3.GetFloat(false); var result = UnityEngine.Physics2D.OverlapCapsuleAll(Arg0,Arg1,Arg2,Arg3); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = (UnityEngine.CapsuleDirection2D)argHelper2.GetInt32(false); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.GetInt32(false); var result = UnityEngine.Physics2D.OverlapCapsuleAll(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 6) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = (UnityEngine.CapsuleDirection2D)argHelper2.GetInt32(false); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.GetInt32(false); var Arg5 = argHelper5.GetFloat(false); var result = UnityEngine.Physics2D.OverlapCapsuleAll(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 7) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = (UnityEngine.CapsuleDirection2D)argHelper2.GetInt32(false); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.GetInt32(false); var Arg5 = argHelper5.GetFloat(false); var Arg6 = argHelper6.GetFloat(false); var result = UnityEngine.Physics2D.OverlapCapsuleAll(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to OverlapCapsuleAll"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_OverlapCapsuleNonAlloc(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Collider2D[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = (UnityEngine.CapsuleDirection2D)argHelper2.GetInt32(false); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.Get<UnityEngine.Collider2D[]>(false); var result = UnityEngine.Physics2D.OverlapCapsuleNonAlloc(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 6) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Collider2D[]), false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = (UnityEngine.CapsuleDirection2D)argHelper2.GetInt32(false); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.Get<UnityEngine.Collider2D[]>(false); var Arg5 = argHelper5.GetInt32(false); var result = UnityEngine.Physics2D.OverlapCapsuleNonAlloc(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 7) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Collider2D[]), false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = (UnityEngine.CapsuleDirection2D)argHelper2.GetInt32(false); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.Get<UnityEngine.Collider2D[]>(false); var Arg5 = argHelper5.GetInt32(false); var Arg6 = argHelper6.GetFloat(false); var result = UnityEngine.Physics2D.OverlapCapsuleNonAlloc(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 8) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); var argHelper7 = new Puerts.ArgumentHelper((int)data, isolate, info, 7); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Collider2D[]), false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper7.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = (UnityEngine.CapsuleDirection2D)argHelper2.GetInt32(false); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.Get<UnityEngine.Collider2D[]>(false); var Arg5 = argHelper5.GetInt32(false); var Arg6 = argHelper6.GetFloat(false); var Arg7 = argHelper7.GetFloat(false); var result = UnityEngine.Physics2D.OverlapCapsuleNonAlloc(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to OverlapCapsuleNonAlloc"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_OverlapCollider(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Collider2D), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Collider2D[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Collider2D>(false); var Arg1 = argHelper1.Get<UnityEngine.ContactFilter2D>(false); var Arg2 = argHelper2.Get<UnityEngine.Collider2D[]>(false); var result = UnityEngine.Physics2D.OverlapCollider(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Collider2D), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Collider2D>), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Collider2D>(false); var Arg1 = argHelper1.Get<UnityEngine.ContactFilter2D>(false); var Arg2 = argHelper2.Get<System.Collections.Generic.List<UnityEngine.Collider2D>>(false); var result = UnityEngine.Physics2D.OverlapCollider(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to OverlapCollider"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetContacts(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Collider2D), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Collider2D), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactPoint2D[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Collider2D>(false); var Arg1 = argHelper1.Get<UnityEngine.Collider2D>(false); var Arg2 = argHelper2.Get<UnityEngine.ContactFilter2D>(false); var Arg3 = argHelper3.Get<UnityEngine.ContactPoint2D[]>(false); var result = UnityEngine.Physics2D.GetContacts(Arg0,Arg1,Arg2,Arg3); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Collider2D), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Collider2D), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.ContactPoint2D>), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Collider2D>(false); var Arg1 = argHelper1.Get<UnityEngine.Collider2D>(false); var Arg2 = argHelper2.Get<UnityEngine.ContactFilter2D>(false); var Arg3 = argHelper3.Get<System.Collections.Generic.List<UnityEngine.ContactPoint2D>>(false); var result = UnityEngine.Physics2D.GetContacts(Arg0,Arg1,Arg2,Arg3); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Collider2D), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactPoint2D[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Collider2D>(false); var Arg1 = argHelper1.Get<UnityEngine.ContactPoint2D[]>(false); var result = UnityEngine.Physics2D.GetContacts(Arg0,Arg1); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Collider2D), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Collider2D[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Collider2D>(false); var Arg1 = argHelper1.Get<UnityEngine.Collider2D[]>(false); var result = UnityEngine.Physics2D.GetContacts(Arg0,Arg1); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rigidbody2D), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactPoint2D[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rigidbody2D>(false); var Arg1 = argHelper1.Get<UnityEngine.ContactPoint2D[]>(false); var result = UnityEngine.Physics2D.GetContacts(Arg0,Arg1); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rigidbody2D), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Collider2D[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rigidbody2D>(false); var Arg1 = argHelper1.Get<UnityEngine.Collider2D[]>(false); var result = UnityEngine.Physics2D.GetContacts(Arg0,Arg1); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Collider2D), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.ContactPoint2D>), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Collider2D>(false); var Arg1 = argHelper1.Get<System.Collections.Generic.List<UnityEngine.ContactPoint2D>>(false); var result = UnityEngine.Physics2D.GetContacts(Arg0,Arg1); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Collider2D), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Collider2D>), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Collider2D>(false); var Arg1 = argHelper1.Get<System.Collections.Generic.List<UnityEngine.Collider2D>>(false); var result = UnityEngine.Physics2D.GetContacts(Arg0,Arg1); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rigidbody2D), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.ContactPoint2D>), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rigidbody2D>(false); var Arg1 = argHelper1.Get<System.Collections.Generic.List<UnityEngine.ContactPoint2D>>(false); var result = UnityEngine.Physics2D.GetContacts(Arg0,Arg1); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rigidbody2D), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Collider2D>), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rigidbody2D>(false); var Arg1 = argHelper1.Get<System.Collections.Generic.List<UnityEngine.Collider2D>>(false); var result = UnityEngine.Physics2D.GetContacts(Arg0,Arg1); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Collider2D), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactPoint2D[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Collider2D>(false); var Arg1 = argHelper1.Get<UnityEngine.ContactFilter2D>(false); var Arg2 = argHelper2.Get<UnityEngine.ContactPoint2D[]>(false); var result = UnityEngine.Physics2D.GetContacts(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Collider2D), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Collider2D[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Collider2D>(false); var Arg1 = argHelper1.Get<UnityEngine.ContactFilter2D>(false); var Arg2 = argHelper2.Get<UnityEngine.Collider2D[]>(false); var result = UnityEngine.Physics2D.GetContacts(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rigidbody2D), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactPoint2D[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rigidbody2D>(false); var Arg1 = argHelper1.Get<UnityEngine.ContactFilter2D>(false); var Arg2 = argHelper2.Get<UnityEngine.ContactPoint2D[]>(false); var result = UnityEngine.Physics2D.GetContacts(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rigidbody2D), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Collider2D[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rigidbody2D>(false); var Arg1 = argHelper1.Get<UnityEngine.ContactFilter2D>(false); var Arg2 = argHelper2.Get<UnityEngine.Collider2D[]>(false); var result = UnityEngine.Physics2D.GetContacts(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Collider2D), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.ContactPoint2D>), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Collider2D>(false); var Arg1 = argHelper1.Get<UnityEngine.ContactFilter2D>(false); var Arg2 = argHelper2.Get<System.Collections.Generic.List<UnityEngine.ContactPoint2D>>(false); var result = UnityEngine.Physics2D.GetContacts(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Collider2D), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Collider2D>), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Collider2D>(false); var Arg1 = argHelper1.Get<UnityEngine.ContactFilter2D>(false); var Arg2 = argHelper2.Get<System.Collections.Generic.List<UnityEngine.Collider2D>>(false); var result = UnityEngine.Physics2D.GetContacts(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rigidbody2D), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.ContactPoint2D>), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rigidbody2D>(false); var Arg1 = argHelper1.Get<UnityEngine.ContactFilter2D>(false); var Arg2 = argHelper2.Get<System.Collections.Generic.List<UnityEngine.ContactPoint2D>>(false); var result = UnityEngine.Physics2D.GetContacts(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rigidbody2D), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Collider2D>), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rigidbody2D>(false); var Arg1 = argHelper1.Get<UnityEngine.ContactFilter2D>(false); var Arg2 = argHelper2.Get<System.Collections.Generic.List<UnityEngine.Collider2D>>(false); var result = UnityEngine.Physics2D.GetContacts(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetContacts"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_defaultPhysicsScene(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Physics2D.defaultPhysicsScene; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_velocityIterations(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Physics2D.velocityIterations; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_velocityIterations(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.Physics2D.velocityIterations = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_positionIterations(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Physics2D.positionIterations; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_positionIterations(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.Physics2D.positionIterations = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_gravity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Physics2D.gravity; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_gravity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.Physics2D.gravity = argHelper.Get<UnityEngine.Vector2>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_queriesHitTriggers(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Physics2D.queriesHitTriggers; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_queriesHitTriggers(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.Physics2D.queriesHitTriggers = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_queriesStartInColliders(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Physics2D.queriesStartInColliders; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_queriesStartInColliders(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.Physics2D.queriesStartInColliders = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_callbacksOnDisable(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Physics2D.callbacksOnDisable; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_callbacksOnDisable(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.Physics2D.callbacksOnDisable = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_reuseCollisionCallbacks(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Physics2D.reuseCollisionCallbacks; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_reuseCollisionCallbacks(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.Physics2D.reuseCollisionCallbacks = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_autoSyncTransforms(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Physics2D.autoSyncTransforms; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_autoSyncTransforms(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.Physics2D.autoSyncTransforms = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_simulationMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Physics2D.simulationMode; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_simulationMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.Physics2D.simulationMode = (UnityEngine.SimulationMode2D)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_jobOptions(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Physics2D.jobOptions; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_jobOptions(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.Physics2D.jobOptions = argHelper.Get<UnityEngine.PhysicsJobOptions2D>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_velocityThreshold(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Physics2D.velocityThreshold; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_velocityThreshold(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.Physics2D.velocityThreshold = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_maxLinearCorrection(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Physics2D.maxLinearCorrection; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_maxLinearCorrection(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.Physics2D.maxLinearCorrection = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_maxAngularCorrection(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Physics2D.maxAngularCorrection; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_maxAngularCorrection(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.Physics2D.maxAngularCorrection = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_maxTranslationSpeed(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Physics2D.maxTranslationSpeed; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_maxTranslationSpeed(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.Physics2D.maxTranslationSpeed = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_maxRotationSpeed(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Physics2D.maxRotationSpeed; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_maxRotationSpeed(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.Physics2D.maxRotationSpeed = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_defaultContactOffset(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Physics2D.defaultContactOffset; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_defaultContactOffset(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.Physics2D.defaultContactOffset = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_baumgarteScale(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Physics2D.baumgarteScale; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_baumgarteScale(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.Physics2D.baumgarteScale = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_baumgarteTOIScale(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Physics2D.baumgarteTOIScale; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_baumgarteTOIScale(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.Physics2D.baumgarteTOIScale = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_timeToSleep(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Physics2D.timeToSleep; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_timeToSleep(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.Physics2D.timeToSleep = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_linearSleepTolerance(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Physics2D.linearSleepTolerance; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_linearSleepTolerance(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.Physics2D.linearSleepTolerance = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_angularSleepTolerance(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Physics2D.angularSleepTolerance; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_angularSleepTolerance(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.Physics2D.angularSleepTolerance = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_alwaysShowColliders(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Physics2D.alwaysShowColliders; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_alwaysShowColliders(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.Physics2D.alwaysShowColliders = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_showColliderSleep(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Physics2D.showColliderSleep; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_showColliderSleep(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.Physics2D.showColliderSleep = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_showColliderContacts(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Physics2D.showColliderContacts; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_showColliderContacts(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.Physics2D.showColliderContacts = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_showColliderAABB(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Physics2D.showColliderAABB; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_showColliderAABB(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.Physics2D.showColliderAABB = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_contactArrowScale(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Physics2D.contactArrowScale; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_contactArrowScale(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.Physics2D.contactArrowScale = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_colliderAwakeColor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Physics2D.colliderAwakeColor; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_colliderAwakeColor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.Physics2D.colliderAwakeColor = argHelper.Get<UnityEngine.Color>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_colliderAsleepColor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Physics2D.colliderAsleepColor; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_colliderAsleepColor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.Physics2D.colliderAsleepColor = argHelper.Get<UnityEngine.Color>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_colliderContactColor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Physics2D.colliderContactColor; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_colliderContactColor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.Physics2D.colliderContactColor = argHelper.Get<UnityEngine.Color>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_colliderAABBColor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Physics2D.colliderAABBColor; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_colliderAABBColor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.Physics2D.colliderAABBColor = argHelper.Get<UnityEngine.Color>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_IgnoreRaycastLayer(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Physics2D.IgnoreRaycastLayer; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_DefaultRaycastLayers(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Physics2D.DefaultRaycastLayers; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_AllLayers(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Physics2D.AllLayers; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "Simulate", IsStatic = true}, F_Simulate }, { new Puerts.MethodKey {Name = "SyncTransforms", IsStatic = true}, F_SyncTransforms }, { new Puerts.MethodKey {Name = "IgnoreCollision", IsStatic = true}, F_IgnoreCollision }, { new Puerts.MethodKey {Name = "GetIgnoreCollision", IsStatic = true}, F_GetIgnoreCollision }, { new Puerts.MethodKey {Name = "IgnoreLayerCollision", IsStatic = true}, F_IgnoreLayerCollision }, { new Puerts.MethodKey {Name = "GetIgnoreLayerCollision", IsStatic = true}, F_GetIgnoreLayerCollision }, { new Puerts.MethodKey {Name = "SetLayerCollisionMask", IsStatic = true}, F_SetLayerCollisionMask }, { new Puerts.MethodKey {Name = "GetLayerCollisionMask", IsStatic = true}, F_GetLayerCollisionMask }, { new Puerts.MethodKey {Name = "IsTouching", IsStatic = true}, F_IsTouching }, { new Puerts.MethodKey {Name = "IsTouchingLayers", IsStatic = true}, F_IsTouchingLayers }, { new Puerts.MethodKey {Name = "Distance", IsStatic = true}, F_Distance }, { new Puerts.MethodKey {Name = "ClosestPoint", IsStatic = true}, F_ClosestPoint }, { new Puerts.MethodKey {Name = "Linecast", IsStatic = true}, F_Linecast }, { new Puerts.MethodKey {Name = "LinecastAll", IsStatic = true}, F_LinecastAll }, { new Puerts.MethodKey {Name = "LinecastNonAlloc", IsStatic = true}, F_LinecastNonAlloc }, { new Puerts.MethodKey {Name = "Raycast", IsStatic = true}, F_Raycast }, { new Puerts.MethodKey {Name = "RaycastNonAlloc", IsStatic = true}, F_RaycastNonAlloc }, { new Puerts.MethodKey {Name = "RaycastAll", IsStatic = true}, F_RaycastAll }, { new Puerts.MethodKey {Name = "CircleCast", IsStatic = true}, F_CircleCast }, { new Puerts.MethodKey {Name = "CircleCastAll", IsStatic = true}, F_CircleCastAll }, { new Puerts.MethodKey {Name = "CircleCastNonAlloc", IsStatic = true}, F_CircleCastNonAlloc }, { new Puerts.MethodKey {Name = "BoxCast", IsStatic = true}, F_BoxCast }, { new Puerts.MethodKey {Name = "BoxCastAll", IsStatic = true}, F_BoxCastAll }, { new Puerts.MethodKey {Name = "BoxCastNonAlloc", IsStatic = true}, F_BoxCastNonAlloc }, { new Puerts.MethodKey {Name = "CapsuleCast", IsStatic = true}, F_CapsuleCast }, { new Puerts.MethodKey {Name = "CapsuleCastAll", IsStatic = true}, F_CapsuleCastAll }, { new Puerts.MethodKey {Name = "CapsuleCastNonAlloc", IsStatic = true}, F_CapsuleCastNonAlloc }, { new Puerts.MethodKey {Name = "GetRayIntersection", IsStatic = true}, F_GetRayIntersection }, { new Puerts.MethodKey {Name = "GetRayIntersectionAll", IsStatic = true}, F_GetRayIntersectionAll }, { new Puerts.MethodKey {Name = "GetRayIntersectionNonAlloc", IsStatic = true}, F_GetRayIntersectionNonAlloc }, { new Puerts.MethodKey {Name = "OverlapPoint", IsStatic = true}, F_OverlapPoint }, { new Puerts.MethodKey {Name = "OverlapPointAll", IsStatic = true}, F_OverlapPointAll }, { new Puerts.MethodKey {Name = "OverlapPointNonAlloc", IsStatic = true}, F_OverlapPointNonAlloc }, { new Puerts.MethodKey {Name = "OverlapCircle", IsStatic = true}, F_OverlapCircle }, { new Puerts.MethodKey {Name = "OverlapCircleAll", IsStatic = true}, F_OverlapCircleAll }, { new Puerts.MethodKey {Name = "OverlapCircleNonAlloc", IsStatic = true}, F_OverlapCircleNonAlloc }, { new Puerts.MethodKey {Name = "OverlapBox", IsStatic = true}, F_OverlapBox }, { new Puerts.MethodKey {Name = "OverlapBoxAll", IsStatic = true}, F_OverlapBoxAll }, { new Puerts.MethodKey {Name = "OverlapBoxNonAlloc", IsStatic = true}, F_OverlapBoxNonAlloc }, { new Puerts.MethodKey {Name = "OverlapArea", IsStatic = true}, F_OverlapArea }, { new Puerts.MethodKey {Name = "OverlapAreaAll", IsStatic = true}, F_OverlapAreaAll }, { new Puerts.MethodKey {Name = "OverlapAreaNonAlloc", IsStatic = true}, F_OverlapAreaNonAlloc }, { new Puerts.MethodKey {Name = "OverlapCapsule", IsStatic = true}, F_OverlapCapsule }, { new Puerts.MethodKey {Name = "OverlapCapsuleAll", IsStatic = true}, F_OverlapCapsuleAll }, { new Puerts.MethodKey {Name = "OverlapCapsuleNonAlloc", IsStatic = true}, F_OverlapCapsuleNonAlloc }, { new Puerts.MethodKey {Name = "OverlapCollider", IsStatic = true}, F_OverlapCollider }, { new Puerts.MethodKey {Name = "GetContacts", IsStatic = true}, F_GetContacts }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"defaultPhysicsScene", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_defaultPhysicsScene, Setter = null} }, {"velocityIterations", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_velocityIterations, Setter = S_velocityIterations} }, {"positionIterations", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_positionIterations, Setter = S_positionIterations} }, {"gravity", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_gravity, Setter = S_gravity} }, {"queriesHitTriggers", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_queriesHitTriggers, Setter = S_queriesHitTriggers} }, {"queriesStartInColliders", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_queriesStartInColliders, Setter = S_queriesStartInColliders} }, {"callbacksOnDisable", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_callbacksOnDisable, Setter = S_callbacksOnDisable} }, {"reuseCollisionCallbacks", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_reuseCollisionCallbacks, Setter = S_reuseCollisionCallbacks} }, {"autoSyncTransforms", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_autoSyncTransforms, Setter = S_autoSyncTransforms} }, {"simulationMode", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_simulationMode, Setter = S_simulationMode} }, {"jobOptions", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_jobOptions, Setter = S_jobOptions} }, {"velocityThreshold", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_velocityThreshold, Setter = S_velocityThreshold} }, {"maxLinearCorrection", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_maxLinearCorrection, Setter = S_maxLinearCorrection} }, {"maxAngularCorrection", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_maxAngularCorrection, Setter = S_maxAngularCorrection} }, {"maxTranslationSpeed", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_maxTranslationSpeed, Setter = S_maxTranslationSpeed} }, {"maxRotationSpeed", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_maxRotationSpeed, Setter = S_maxRotationSpeed} }, {"defaultContactOffset", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_defaultContactOffset, Setter = S_defaultContactOffset} }, {"baumgarteScale", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_baumgarteScale, Setter = S_baumgarteScale} }, {"baumgarteTOIScale", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_baumgarteTOIScale, Setter = S_baumgarteTOIScale} }, {"timeToSleep", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_timeToSleep, Setter = S_timeToSleep} }, {"linearSleepTolerance", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_linearSleepTolerance, Setter = S_linearSleepTolerance} }, {"angularSleepTolerance", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_angularSleepTolerance, Setter = S_angularSleepTolerance} }, {"alwaysShowColliders", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_alwaysShowColliders, Setter = S_alwaysShowColliders} }, {"showColliderSleep", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_showColliderSleep, Setter = S_showColliderSleep} }, {"showColliderContacts", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_showColliderContacts, Setter = S_showColliderContacts} }, {"showColliderAABB", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_showColliderAABB, Setter = S_showColliderAABB} }, {"contactArrowScale", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_contactArrowScale, Setter = S_contactArrowScale} }, {"colliderAwakeColor", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_colliderAwakeColor, Setter = S_colliderAwakeColor} }, {"colliderAsleepColor", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_colliderAsleepColor, Setter = S_colliderAsleepColor} }, {"colliderContactColor", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_colliderContactColor, Setter = S_colliderContactColor} }, {"colliderAABBColor", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_colliderAABBColor, Setter = S_colliderAABBColor} }, {"IgnoreRaycastLayer", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_IgnoreRaycastLayer, Setter = null} }, {"DefaultRaycastLayers", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_DefaultRaycastLayers, Setter = null} }, {"AllLayers", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_AllLayers, Setter = null} }, } }; } } } <|start_filename|>Projects/Go_json/gen/src/cfg/item.EClothesHidePartType.go<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg const ( ItemEClothesHidePartType_CHEST = 0 ItemEClothesHidePartType_HEAD = 1 ItemEClothesHidePartType_SPINE_UPPER = 2 ItemEClothesHidePartType_SPINE_LOWER = 3 ItemEClothesHidePartType_HIP = 4 ItemEClothesHidePartType_LEG_UPPER = 5 ItemEClothesHidePartType_LEG_MIDDLE = 6 ItemEClothesHidePartType_LEG_LOWER = 7 ) <|start_filename|>Projects/Go_json/gen/src/cfg/item.ChooseOneBonus.go<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg import "errors" type ItemChooseOneBonus struct { DropId int32 IsUnique bool } const TypeId_ItemChooseOneBonus = 228058347 func (*ItemChooseOneBonus) GetTypeId() int32 { return 228058347 } func (_v *ItemChooseOneBonus)Deserialize(_buf map[string]interface{}) (err error) { { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["drop_id"].(float64); !_ok_ { err = errors.New("drop_id error"); return }; _v.DropId = int32(_tempNum_) } { var _ok_ bool; if _v.IsUnique, _ok_ = _buf["is_unique"].(bool); !_ok_ { err = errors.New("is_unique error"); return } } return } func DeserializeItemChooseOneBonus(_buf map[string]interface{}) (*ItemChooseOneBonus, error) { v := &ItemChooseOneBonus{} if err := v.Deserialize(_buf); err == nil { return v, nil } else { return nil, err } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_AnimationState_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_AnimationState_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.AnimationState(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.AnimationState), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_AddMixingTransform(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnimationState; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Transform), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Transform>(false); obj.AddMixingTransform(Arg0); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Transform), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Transform>(false); var Arg1 = argHelper1.GetBoolean(false); obj.AddMixingTransform(Arg0,Arg1); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to AddMixingTransform"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_RemoveMixingTransform(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnimationState; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Transform>(false); obj.RemoveMixingTransform(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_enabled(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnimationState; var result = obj.enabled; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_enabled(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnimationState; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.enabled = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_weight(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnimationState; var result = obj.weight; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_weight(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnimationState; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.weight = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_wrapMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnimationState; var result = obj.wrapMode; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_wrapMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnimationState; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.wrapMode = (UnityEngine.WrapMode)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_time(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnimationState; var result = obj.time; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_time(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnimationState; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.time = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_normalizedTime(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnimationState; var result = obj.normalizedTime; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_normalizedTime(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnimationState; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.normalizedTime = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_speed(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnimationState; var result = obj.speed; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_speed(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnimationState; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.speed = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_normalizedSpeed(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnimationState; var result = obj.normalizedSpeed; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_normalizedSpeed(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnimationState; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.normalizedSpeed = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_length(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnimationState; var result = obj.length; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_layer(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnimationState; var result = obj.layer; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_layer(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnimationState; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.layer = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_clip(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnimationState; var result = obj.clip; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_name(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnimationState; var result = obj.name; Puerts.PuertsDLL.ReturnString(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_name(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnimationState; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.name = argHelper.GetString(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_blendMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnimationState; var result = obj.blendMode; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_blendMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnimationState; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.blendMode = (UnityEngine.AnimationBlendMode)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "AddMixingTransform", IsStatic = false}, M_AddMixingTransform }, { new Puerts.MethodKey {Name = "RemoveMixingTransform", IsStatic = false}, M_RemoveMixingTransform }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"enabled", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_enabled, Setter = S_enabled} }, {"weight", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_weight, Setter = S_weight} }, {"wrapMode", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_wrapMode, Setter = S_wrapMode} }, {"time", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_time, Setter = S_time} }, {"normalizedTime", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_normalizedTime, Setter = S_normalizedTime} }, {"speed", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_speed, Setter = S_speed} }, {"normalizedSpeed", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_normalizedSpeed, Setter = S_normalizedSpeed} }, {"length", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_length, Setter = null} }, {"layer", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_layer, Setter = S_layer} }, {"clip", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_clip, Setter = null} }, {"name", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_name, Setter = S_name} }, {"blendMode", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_blendMode, Setter = S_blendMode} }, } }; } } } <|start_filename|>Projects/DataTemplates/template_erlang2/test_tbtestset.erl<|end_filename|> %% test.TbTestSet -module(test_tbtestset) -export([get/1,get_ids/0]) get(1) -> #{ id => 1, x1 => array, x2 => array, x3 => array, x4 => array }. get(2) -> #{ id => 2, x1 => array, x2 => array, x3 => array, x4 => array }. get_ids() -> [1,2]. <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_WheelFrictionCurve_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_WheelFrictionCurve_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.WheelFrictionCurve constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_extremumSlip(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.WheelFrictionCurve)Puerts.Utils.GetSelf((int)data, self); var result = obj.extremumSlip; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_extremumSlip(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.WheelFrictionCurve)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.extremumSlip = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_extremumValue(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.WheelFrictionCurve)Puerts.Utils.GetSelf((int)data, self); var result = obj.extremumValue; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_extremumValue(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.WheelFrictionCurve)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.extremumValue = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_asymptoteSlip(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.WheelFrictionCurve)Puerts.Utils.GetSelf((int)data, self); var result = obj.asymptoteSlip; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_asymptoteSlip(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.WheelFrictionCurve)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.asymptoteSlip = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_asymptoteValue(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.WheelFrictionCurve)Puerts.Utils.GetSelf((int)data, self); var result = obj.asymptoteValue; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_asymptoteValue(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.WheelFrictionCurve)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.asymptoteValue = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_stiffness(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.WheelFrictionCurve)Puerts.Utils.GetSelf((int)data, self); var result = obj.stiffness; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_stiffness(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.WheelFrictionCurve)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.stiffness = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"extremumSlip", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_extremumSlip, Setter = S_extremumSlip} }, {"extremumValue", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_extremumValue, Setter = S_extremumValue} }, {"asymptoteSlip", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_asymptoteSlip, Setter = S_asymptoteSlip} }, {"asymptoteValue", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_asymptoteValue, Setter = S_asymptoteValue} }, {"stiffness", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_stiffness, Setter = S_stiffness} }, } }; } } } <|start_filename|>Projects/Java_bin/src/main/gen/cfg/ai/IntKeyData.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.ai; import bright.serialization.*; public final class IntKeyData extends cfg.ai.KeyData { public IntKeyData(ByteBuf _buf) { super(_buf); value = _buf.readInt(); } public IntKeyData(int value ) { super(); this.value = value; } public final int value; public static final int __ID__ = -342751904; @Override public int getTypeId() { return __ID__; } @Override public void resolve(java.util.HashMap<String, Object> _tables) { super.resolve(_tables); } @Override public String toString() { return "{ " + "value:" + value + "," + "}"; } } <|start_filename|>Projects/java_json/src/gen/cfg/ai/EFinishMode.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.ai; public enum EFinishMode { IMMEDIATE(0), DELAYED(1), ; private final int value; public int getValue() { return value; } EFinishMode(int value) { this.value = value; } public static EFinishMode valueOf(int value) { if (value == 0) return IMMEDIATE; if (value == 1) return DELAYED; throw new IllegalArgumentException(""); } } <|start_filename|>DesignerConfigs/Datas/test/misc_datas/demo.lua<|end_filename|> return { x1 = false, x2 = 2, x3 = 128, x4 = 22, x5 = 112233445566, x6 = 1.3, x7 = 1122, x8 = 12, x8_0 = 13, x9 = 123, x10 = "yf", x12 = {x1=1}, x13 = "D", x14 = { __type__="DemoD2", x1 = 1, x2=3}, s1 = { key="lua/key1", text="lua text "}, v2 = {x= 1,y = 2}, v3 = {x=0.1, y= 0.2,z=0.3}, v4 = {x=1,y=2,z=3.5,w=4}, t1 = "1970-01-01 00:00:00", k1 = {1,2}, k2 = {2,3}, k3 = {3,4}, k4 = {1,2}, k5 = {1,3}, k6 = {1,2}, k7 = {1,8}, k8 = {[2]=10,[3]=12}, k9 = {{y1=1,y2=true}, {y1=10,y2=false}}, k15 = {{ __type__="DemoD2", x1 = 1, x2=3}}, } <|start_filename|>Projects/Csharp_CustomTemplate_EncryptMemory/Gen/test/TestExcelBean1.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using System; using Newtonsoft.Json; using Scripts; namespace cfg.test { /// <summary> /// 这是个测试excel结构 /// </summary> [Serializable] public partial class TestExcelBean1 : AConfig { /// <summary> /// 最高品质 /// </summary> [JsonProperty("x1")] private int _x1 { get; set; } [JsonIgnore] public EncryptInt x1 { get; private set; } = new(); /// <summary> /// 黑色的 /// </summary> public string x2 { get; set; } /// <summary> /// 蓝色的 /// </summary> [JsonProperty("x3")] private int _x3 { get; set; } [JsonIgnore] public EncryptInt x3 { get; private set; } = new(); /// <summary> /// 最差品质 /// </summary> [JsonProperty("x4")] private float _x4 { get; set; } [JsonIgnore] public EncryptFloat x4 { get; private set; } = new(); public override void EndInit() { x1 = _x1; x3 = _x3; x4 = _x4; } public override string ToString() => JsonConvert.SerializeObject(this); } } <|start_filename|>Projects/DataTemplates/template_lua2/test_tbtestberef.lua<|end_filename|> -- test.TbTestBeRef return { [1] = { id=1, count=10, }, [2] = { id=2, count=10, }, [3] = { id=3, count=10, }, [4] = { id=4, count=10, }, [5] = { id=5, count=10, }, [6] = { id=6, count=10, }, [7] = { id=7, count=10, }, [8] = { id=8, count=10, }, [9] = { id=9, count=10, }, [10] = { id=10, count=10, }, } <|start_filename|>Projects/Csharp_Unity_bin_use_UnityEngine_Vector/Assets/Gen/condition/RoleCondition.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.condition { public abstract class RoleCondition : condition.Condition { public RoleCondition(ByteBuf _buf) : base(_buf) { } public static RoleCondition DeserializeRoleCondition(ByteBuf _buf) { switch (_buf.ReadInt()) { case condition.MultiRoleCondition.__ID__: return new condition.MultiRoleCondition(_buf); case condition.GenderLimit.__ID__: return new condition.GenderLimit(_buf); case condition.MinLevel.__ID__: return new condition.MinLevel(_buf); case condition.MaxLevel.__ID__: return new condition.MaxLevel(_buf); case condition.MinMaxLevel.__ID__: return new condition.MinMaxLevel(_buf); case condition.ClothesPropertyScoreGreaterThan.__ID__: return new condition.ClothesPropertyScoreGreaterThan(_buf); case condition.ContainsItem.__ID__: return new condition.ContainsItem(_buf); default: throw new SerializationException(); } } public override void Resolve(Dictionary<string, object> _tables) { base.Resolve(_tables); } public override void TranslateText(System.Func<string, string, string> translator) { base.TranslateText(translator); } public override string ToString() { return "{ " + "}"; } } } <|start_filename|>ProtoProjects/Typescript_Unity_Puerts/Assets/Scripts/Libs/Bright.Core/Common/StringUtil.cs<|end_filename|> using System; using System.Collections.Generic; using System.Text; namespace Bright.Common { public static class StringUtil { public static string ToStr(object o) { return ToStr(o, new StringBuilder()); } public static string ToStr(object o, StringBuilder sb) { foreach (var p in o.GetType().GetFields()) { sb.Append($"{p.Name} = {p.GetValue(o)},"); } foreach (var p in o.GetType().GetProperties()) { sb.Append($"{p.Name} = {p.GetValue(o)},"); } return sb.ToString(); } public static string ArrayToString<T>(T[] arr) { return "[" + string.Join(",", arr) + "]"; } public static string CollectionToString<T>(IEnumerable<T> arr) { return "[" + string.Join(",", arr) + "]"; } public static string CollectionToString<TK, TV>(IDictionary<TK, TV> dic) { var sb = new StringBuilder('{'); foreach (var e in dic) { sb.Append(e.Key).Append(':'); sb.Append(e.Value).Append(','); } sb.Append('}'); return sb.ToString(); } } } <|start_filename|>Projects/GenerateDatas/convert_lua/role.TbRoleLevelExpAttr/3.lua<|end_filename|> return { level = 3, need_exp = 200, clothes_attrs = { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, }, } <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/tag/TestTag.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.tag { public sealed partial class TestTag : Bright.Config.BeanBase { public TestTag(ByteBuf _buf) { Id = _buf.ReadInt(); Value = _buf.ReadString(); } public TestTag(int id, string value ) { this.Id = id; this.Value = value; } public static TestTag DeserializeTestTag(ByteBuf _buf) { return new tag.TestTag(_buf); } public readonly int Id; public readonly string Value; public const int ID = 1742933812; public override int GetTypeId() => ID; public void Resolve(Dictionary<string, object> _tables) { OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); public override string ToString() { return "{ " + "Id:" + Id + "," + "Value:" + Value + "," + "}"; } } } <|start_filename|>Projects/Java_bin/src/main/gen/cfg/ai/UeTimeLimit.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.ai; import bright.serialization.*; public final class UeTimeLimit extends cfg.ai.Decorator { public UeTimeLimit(ByteBuf _buf) { super(_buf); limitTime = _buf.readFloat(); } public UeTimeLimit(int id, String node_name, cfg.ai.EFlowAbortMode flow_abort_mode, float limit_time ) { super(id, node_name, flow_abort_mode); this.limitTime = limit_time; } public final float limitTime; public static final int __ID__ = 338469720; @Override public int getTypeId() { return __ID__; } @Override public void resolve(java.util.HashMap<String, Object> _tables) { super.resolve(_tables); } @Override public String toString() { return "{ " + "id:" + id + "," + "nodeName:" + nodeName + "," + "flowAbortMode:" + flowAbortMode + "," + "limitTime:" + limitTime + "," + "}"; } } <|start_filename|>Projects/GenerateDatas/convert_lua/test.TbDetectCsvEncoding/22.lua<|end_filename|> return { id = 22, name = "还果园国要", } <|start_filename|>Projects/java_json/src/gen/cfg/item/EClothesHidePartType.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.item; public enum EClothesHidePartType { /** * 胸部 */ CHEST(0), /** * 手 */ HEAD(1), /** * 脊柱上 */ SPINE_UPPER(2), /** * 脊柱下 */ SPINE_LOWER(3), /** * 臀部 */ HIP(4), /** * 腿上 */ LEG_UPPER(5), /** * 腿中 */ LEG_MIDDLE(6), /** * 腿下 */ LEG_LOWER(7), ; private final int value; public int getValue() { return value; } EClothesHidePartType(int value) { this.value = value; } public static EClothesHidePartType valueOf(int value) { if (value == 0) return CHEST; if (value == 1) return HEAD; if (value == 2) return SPINE_UPPER; if (value == 3) return SPINE_LOWER; if (value == 4) return HIP; if (value == 5) return LEG_UPPER; if (value == 6) return LEG_MIDDLE; if (value == 7) return LEG_LOWER; throw new IllegalArgumentException(""); } } <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/ai/UpdateDailyBehaviorProps.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.ai { public sealed partial class UpdateDailyBehaviorProps : ai.Service { public UpdateDailyBehaviorProps(ByteBuf _buf) : base(_buf) { SatietyKey = _buf.ReadString(); EnergyKey = _buf.ReadString(); MoodKey = _buf.ReadString(); SatietyLowerThresholdKey = _buf.ReadString(); SatietyUpperThresholdKey = _buf.ReadString(); EnergyLowerThresholdKey = _buf.ReadString(); EnergyUpperThresholdKey = _buf.ReadString(); MoodLowerThresholdKey = _buf.ReadString(); MoodUpperThresholdKey = _buf.ReadString(); } public UpdateDailyBehaviorProps(int id, string node_name, string satiety_key, string energy_key, string mood_key, string satiety_lower_threshold_key, string satiety_upper_threshold_key, string energy_lower_threshold_key, string energy_upper_threshold_key, string mood_lower_threshold_key, string mood_upper_threshold_key ) : base(id,node_name) { this.SatietyKey = satiety_key; this.EnergyKey = energy_key; this.MoodKey = mood_key; this.SatietyLowerThresholdKey = satiety_lower_threshold_key; this.SatietyUpperThresholdKey = satiety_upper_threshold_key; this.EnergyLowerThresholdKey = energy_lower_threshold_key; this.EnergyUpperThresholdKey = energy_upper_threshold_key; this.MoodLowerThresholdKey = mood_lower_threshold_key; this.MoodUpperThresholdKey = mood_upper_threshold_key; } public static UpdateDailyBehaviorProps DeserializeUpdateDailyBehaviorProps(ByteBuf _buf) { return new ai.UpdateDailyBehaviorProps(_buf); } public readonly string SatietyKey; public readonly string EnergyKey; public readonly string MoodKey; public readonly string SatietyLowerThresholdKey; public readonly string SatietyUpperThresholdKey; public readonly string EnergyLowerThresholdKey; public readonly string EnergyUpperThresholdKey; public readonly string MoodLowerThresholdKey; public readonly string MoodUpperThresholdKey; public const int ID = -61887372; public override int GetTypeId() => ID; public override void Resolve(Dictionary<string, object> _tables) { base.Resolve(_tables); OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); public override string ToString() { return "{ " + "Id:" + Id + "," + "NodeName:" + NodeName + "," + "SatietyKey:" + SatietyKey + "," + "EnergyKey:" + EnergyKey + "," + "MoodKey:" + MoodKey + "," + "SatietyLowerThresholdKey:" + SatietyLowerThresholdKey + "," + "SatietyUpperThresholdKey:" + SatietyUpperThresholdKey + "," + "EnergyLowerThresholdKey:" + EnergyLowerThresholdKey + "," + "EnergyUpperThresholdKey:" + EnergyUpperThresholdKey + "," + "MoodLowerThresholdKey:" + MoodLowerThresholdKey + "," + "MoodUpperThresholdKey:" + MoodUpperThresholdKey + "," + "}"; } } } <|start_filename|>Projects/Csharp_Unity_bin_use_UnityEngine_Vector/Assets/Gen/condition/MultiRoleCondition.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.condition { public sealed class MultiRoleCondition : condition.RoleCondition { public MultiRoleCondition(ByteBuf _buf) : base(_buf) { {int n = System.Math.Min(_buf.ReadSize(), _buf.Size);Conditions = new condition.RoleCondition[n];for(var i = 0 ; i < n ; i++) { condition.RoleCondition _e;_e = condition.RoleCondition.DeserializeRoleCondition(_buf); Conditions[i] = _e;}} } public static MultiRoleCondition DeserializeMultiRoleCondition(ByteBuf _buf) { return new condition.MultiRoleCondition(_buf); } public condition.RoleCondition[] Conditions { get; private set; } public const int __ID__ = 934079583; public override int GetTypeId() => __ID__; public override void Resolve(Dictionary<string, object> _tables) { base.Resolve(_tables); foreach(var _e in Conditions) { _e?.Resolve(_tables); } } public override void TranslateText(System.Func<string, string, string> translator) { base.TranslateText(translator); foreach(var _e in Conditions) { _e?.TranslateText(translator); } } public override string ToString() { return "{ " + "Conditions:" + Bright.Common.StringUtil.CollectionToString(Conditions) + "," + "}"; } } } <|start_filename|>Projects/DataTemplates/template_erlang/test_tbtestdesc.erl<|end_filename|> %% test.TbTestDesc get(1) -> #{id => 1,name => "xxx",a1 => 0,a2 => 0,x1 => #{y2 => #{z2 => 2,z3 => 3},y3 => 4},x2 => [#{z2 => 1,z3 => 2},#{z2 => 3,z3 => 4}],x3 => [#{z2 => 1,z3 => 2},#{z2 => 3,z3 => 4}]}. <|start_filename|>Projects/java_json/src/gen/cfg/blueprint/EnumField.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.blueprint; import com.google.gson.JsonElement; import com.google.gson.JsonObject; public final class EnumField { public EnumField(JsonObject __json__) { name = __json__.get("name").getAsString(); value = __json__.get("value").getAsInt(); } public EnumField(String name, int value ) { this.name = name; this.value = value; } public static EnumField deserializeEnumField(JsonObject __json__) { return new EnumField(__json__); } public final String name; public final int value; public void resolve(java.util.HashMap<String, Object> _tables) { } @Override public String toString() { return "{ " + "name:" + name + "," + "value:" + value + "," + "}"; } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_EdgeCollider2D_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_EdgeCollider2D_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.EdgeCollider2D(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.EdgeCollider2D), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Reset(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.EdgeCollider2D; { { obj.Reset(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetPoints(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.EdgeCollider2D; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.Collections.Generic.List<UnityEngine.Vector2>>(false); var result = obj.GetPoints(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetPoints(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.EdgeCollider2D; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.Collections.Generic.List<UnityEngine.Vector2>>(false); var result = obj.SetPoints(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_edgeRadius(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.EdgeCollider2D; var result = obj.edgeRadius; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_edgeRadius(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.EdgeCollider2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.edgeRadius = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_edgeCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.EdgeCollider2D; var result = obj.edgeCount; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_pointCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.EdgeCollider2D; var result = obj.pointCount; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_points(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.EdgeCollider2D; var result = obj.points; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_points(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.EdgeCollider2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.points = argHelper.Get<UnityEngine.Vector2[]>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_useAdjacentStartPoint(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.EdgeCollider2D; var result = obj.useAdjacentStartPoint; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_useAdjacentStartPoint(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.EdgeCollider2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.useAdjacentStartPoint = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_useAdjacentEndPoint(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.EdgeCollider2D; var result = obj.useAdjacentEndPoint; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_useAdjacentEndPoint(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.EdgeCollider2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.useAdjacentEndPoint = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_adjacentStartPoint(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.EdgeCollider2D; var result = obj.adjacentStartPoint; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_adjacentStartPoint(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.EdgeCollider2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.adjacentStartPoint = argHelper.Get<UnityEngine.Vector2>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_adjacentEndPoint(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.EdgeCollider2D; var result = obj.adjacentEndPoint; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_adjacentEndPoint(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.EdgeCollider2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.adjacentEndPoint = argHelper.Get<UnityEngine.Vector2>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "Reset", IsStatic = false}, M_Reset }, { new Puerts.MethodKey {Name = "GetPoints", IsStatic = false}, M_GetPoints }, { new Puerts.MethodKey {Name = "SetPoints", IsStatic = false}, M_SetPoints }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"edgeRadius", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_edgeRadius, Setter = S_edgeRadius} }, {"edgeCount", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_edgeCount, Setter = null} }, {"pointCount", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_pointCount, Setter = null} }, {"points", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_points, Setter = S_points} }, {"useAdjacentStartPoint", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_useAdjacentStartPoint, Setter = S_useAdjacentStartPoint} }, {"useAdjacentEndPoint", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_useAdjacentEndPoint, Setter = S_useAdjacentEndPoint} }, {"adjacentStartPoint", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_adjacentStartPoint, Setter = S_adjacentStartPoint} }, {"adjacentEndPoint", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_adjacentEndPoint, Setter = S_adjacentEndPoint} }, } }; } } } <|start_filename|>Projects/Go_json/gen/src/cfg/test.TbExcelFromJsonMultiRow.go<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg type TestTbExcelFromJsonMultiRow struct { _dataMap map[int32]*TestExcelFromJsonMultiRow _dataList []*TestExcelFromJsonMultiRow } func NewTestTbExcelFromJsonMultiRow(_buf []map[string]interface{}) (*TestTbExcelFromJsonMultiRow, error) { _dataList := make([]*TestExcelFromJsonMultiRow, 0, len(_buf)) dataMap := make(map[int32]*TestExcelFromJsonMultiRow) for _, _ele_ := range _buf { if _v, err2 := DeserializeTestExcelFromJsonMultiRow(_ele_); err2 != nil { return nil, err2 } else { _dataList = append(_dataList, _v) dataMap[_v.Id] = _v } } return &TestTbExcelFromJsonMultiRow{_dataList:_dataList, _dataMap:dataMap}, nil } func (table *TestTbExcelFromJsonMultiRow) GetDataMap() map[int32]*TestExcelFromJsonMultiRow { return table._dataMap } func (table *TestTbExcelFromJsonMultiRow) GetDataList() []*TestExcelFromJsonMultiRow { return table._dataList } func (table *TestTbExcelFromJsonMultiRow) Get(key int32) *TestExcelFromJsonMultiRow { return table._dataMap[key] } <|start_filename|>Projects/Java_bin/src/main/gen/cfg/ai/Service.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.ai; import bright.serialization.*; public abstract class Service extends cfg.ai.Node { public Service(ByteBuf _buf) { super(_buf); } public Service(int id, String node_name ) { super(id, node_name); } public static Service deserializeService(ByteBuf _buf) { switch (_buf.readInt()) { case cfg.ai.UeSetDefaultFocus.__ID__: return new cfg.ai.UeSetDefaultFocus(_buf); case cfg.ai.ExecuteTimeStatistic.__ID__: return new cfg.ai.ExecuteTimeStatistic(_buf); case cfg.ai.ChooseTarget.__ID__: return new cfg.ai.ChooseTarget(_buf); case cfg.ai.KeepFaceTarget.__ID__: return new cfg.ai.KeepFaceTarget(_buf); case cfg.ai.GetOwnerPlayer.__ID__: return new cfg.ai.GetOwnerPlayer(_buf); case cfg.ai.UpdateDailyBehaviorProps.__ID__: return new cfg.ai.UpdateDailyBehaviorProps(_buf); default: throw new SerializationException(); } } @Override public void resolve(java.util.HashMap<String, Object> _tables) { super.resolve(_tables); } @Override public String toString() { return "{ " + "id:" + id + "," + "nodeName:" + nodeName + "," + "}"; } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_UI_ColorBlock_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_UI_ColorBlock_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.UI.ColorBlock constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Equals(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.UI.ColorBlock)Puerts.Utils.GetSelf((int)data, self); if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.Any, typeof(System.Object), false, false)) { var Arg0 = argHelper0.Get<System.Object>(false); var result = obj.Equals(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.UI.ColorBlock), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.UI.ColorBlock>(false); var result = obj.Equals(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to Equals"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetHashCode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.UI.ColorBlock)Puerts.Utils.GetSelf((int)data, self); { { var result = obj.GetHashCode(); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_normalColor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.UI.ColorBlock)Puerts.Utils.GetSelf((int)data, self); var result = obj.normalColor; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_normalColor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.UI.ColorBlock)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.normalColor = argHelper.Get<UnityEngine.Color>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_highlightedColor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.UI.ColorBlock)Puerts.Utils.GetSelf((int)data, self); var result = obj.highlightedColor; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_highlightedColor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.UI.ColorBlock)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.highlightedColor = argHelper.Get<UnityEngine.Color>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_pressedColor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.UI.ColorBlock)Puerts.Utils.GetSelf((int)data, self); var result = obj.pressedColor; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_pressedColor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.UI.ColorBlock)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.pressedColor = argHelper.Get<UnityEngine.Color>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_selectedColor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.UI.ColorBlock)Puerts.Utils.GetSelf((int)data, self); var result = obj.selectedColor; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_selectedColor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.UI.ColorBlock)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.selectedColor = argHelper.Get<UnityEngine.Color>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_disabledColor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.UI.ColorBlock)Puerts.Utils.GetSelf((int)data, self); var result = obj.disabledColor; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_disabledColor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.UI.ColorBlock)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.disabledColor = argHelper.Get<UnityEngine.Color>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_colorMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.UI.ColorBlock)Puerts.Utils.GetSelf((int)data, self); var result = obj.colorMultiplier; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_colorMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.UI.ColorBlock)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.colorMultiplier = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_fadeDuration(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.UI.ColorBlock)Puerts.Utils.GetSelf((int)data, self); var result = obj.fadeDuration; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_fadeDuration(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.UI.ColorBlock)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.fadeDuration = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_defaultColorBlock(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.UI.ColorBlock.defaultColorBlock; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_defaultColorBlock(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.UI.ColorBlock.defaultColorBlock = argHelper.Get<UnityEngine.UI.ColorBlock>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void O_op_Equality(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var arg0 = argHelper0.Get<UnityEngine.UI.ColorBlock>(false); var arg1 = argHelper1.Get<UnityEngine.UI.ColorBlock>(false); var result = arg0 == arg1; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void O_op_Inequality(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var arg0 = argHelper0.Get<UnityEngine.UI.ColorBlock>(false); var arg1 = argHelper1.Get<UnityEngine.UI.ColorBlock>(false); var result = arg0 != arg1; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "Equals", IsStatic = false}, M_Equals }, { new Puerts.MethodKey {Name = "GetHashCode", IsStatic = false}, M_GetHashCode }, { new Puerts.MethodKey {Name = "op_Equality", IsStatic = true}, O_op_Equality}, { new Puerts.MethodKey {Name = "op_Inequality", IsStatic = true}, O_op_Inequality}, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"normalColor", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_normalColor, Setter = S_normalColor} }, {"highlightedColor", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_highlightedColor, Setter = S_highlightedColor} }, {"pressedColor", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_pressedColor, Setter = S_pressedColor} }, {"selectedColor", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_selectedColor, Setter = S_selectedColor} }, {"disabledColor", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_disabledColor, Setter = S_disabledColor} }, {"colorMultiplier", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_colorMultiplier, Setter = S_colorMultiplier} }, {"fadeDuration", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_fadeDuration, Setter = S_fadeDuration} }, {"defaultColorBlock", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_defaultColorBlock, Setter = S_defaultColorBlock} }, } }; } } } <|start_filename|>Projects/Csharp_Unity_ILRuntime_bin/gen_code_bin.bat<|end_filename|> set WORKSPACE=..\.. set GEN_CLIENT=%WORKSPACE%\Tools\Luban.Client\Luban.Client.exe set CONF_ROOT=%WORKSPACE%\DesignerConfigs %GEN_CLIENT% -h %LUBAN_SERVER_IP% -j cfg --^ -d %CONF_ROOT%\Defines\__root__.xml ^ --input_data_dir %CONF_ROOT%\Datas ^ --output_code_dir HotFix_Project/Gen ^ --output_data_dir ..\GenerateDatas\bin ^ --gen_types code_cs_bin,data_bin ^ -s all pause <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_UI_Image_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_UI_Image_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.UI.Image constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_DisableSpriteOptimizations(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Image; { { obj.DisableSpriteOptimizations(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_OnBeforeSerialize(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Image; { { obj.OnBeforeSerialize(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_OnAfterDeserialize(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Image; { { obj.OnAfterDeserialize(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetNativeSize(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Image; { { obj.SetNativeSize(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_CalculateLayoutInputHorizontal(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Image; { { obj.CalculateLayoutInputHorizontal(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_CalculateLayoutInputVertical(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Image; { { obj.CalculateLayoutInputVertical(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_IsRaycastLocationValid(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Image; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Camera>(false); var result = obj.IsRaycastLocationValid(Arg0,Arg1); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_sprite(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Image; var result = obj.sprite; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_sprite(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Image; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.sprite = argHelper.Get<UnityEngine.Sprite>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_overrideSprite(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Image; var result = obj.overrideSprite; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_overrideSprite(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Image; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.overrideSprite = argHelper.Get<UnityEngine.Sprite>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_type(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Image; var result = obj.type; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_type(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Image; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.type = (UnityEngine.UI.Image.Type)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_preserveAspect(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Image; var result = obj.preserveAspect; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_preserveAspect(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Image; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.preserveAspect = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_fillCenter(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Image; var result = obj.fillCenter; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_fillCenter(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Image; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.fillCenter = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_fillMethod(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Image; var result = obj.fillMethod; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_fillMethod(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Image; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.fillMethod = (UnityEngine.UI.Image.FillMethod)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_fillAmount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Image; var result = obj.fillAmount; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_fillAmount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Image; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.fillAmount = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_fillClockwise(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Image; var result = obj.fillClockwise; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_fillClockwise(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Image; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.fillClockwise = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_fillOrigin(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Image; var result = obj.fillOrigin; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_fillOrigin(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Image; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.fillOrigin = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_alphaHitTestMinimumThreshold(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Image; var result = obj.alphaHitTestMinimumThreshold; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_alphaHitTestMinimumThreshold(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Image; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.alphaHitTestMinimumThreshold = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_useSpriteMesh(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Image; var result = obj.useSpriteMesh; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_useSpriteMesh(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Image; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.useSpriteMesh = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_defaultETC1GraphicMaterial(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.UI.Image.defaultETC1GraphicMaterial; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_mainTexture(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Image; var result = obj.mainTexture; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_hasBorder(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Image; var result = obj.hasBorder; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_pixelsPerUnitMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Image; var result = obj.pixelsPerUnitMultiplier; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_pixelsPerUnitMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Image; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.pixelsPerUnitMultiplier = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_pixelsPerUnit(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Image; var result = obj.pixelsPerUnit; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_material(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Image; var result = obj.material; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_material(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Image; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.material = argHelper.Get<UnityEngine.Material>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_minWidth(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Image; var result = obj.minWidth; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_preferredWidth(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Image; var result = obj.preferredWidth; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_flexibleWidth(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Image; var result = obj.flexibleWidth; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_minHeight(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Image; var result = obj.minHeight; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_preferredHeight(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Image; var result = obj.preferredHeight; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_flexibleHeight(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Image; var result = obj.flexibleHeight; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_layoutPriority(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Image; var result = obj.layoutPriority; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "DisableSpriteOptimizations", IsStatic = false}, M_DisableSpriteOptimizations }, { new Puerts.MethodKey {Name = "OnBeforeSerialize", IsStatic = false}, M_OnBeforeSerialize }, { new Puerts.MethodKey {Name = "OnAfterDeserialize", IsStatic = false}, M_OnAfterDeserialize }, { new Puerts.MethodKey {Name = "SetNativeSize", IsStatic = false}, M_SetNativeSize }, { new Puerts.MethodKey {Name = "CalculateLayoutInputHorizontal", IsStatic = false}, M_CalculateLayoutInputHorizontal }, { new Puerts.MethodKey {Name = "CalculateLayoutInputVertical", IsStatic = false}, M_CalculateLayoutInputVertical }, { new Puerts.MethodKey {Name = "IsRaycastLocationValid", IsStatic = false}, M_IsRaycastLocationValid }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"sprite", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_sprite, Setter = S_sprite} }, {"overrideSprite", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_overrideSprite, Setter = S_overrideSprite} }, {"type", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_type, Setter = S_type} }, {"preserveAspect", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_preserveAspect, Setter = S_preserveAspect} }, {"fillCenter", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_fillCenter, Setter = S_fillCenter} }, {"fillMethod", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_fillMethod, Setter = S_fillMethod} }, {"fillAmount", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_fillAmount, Setter = S_fillAmount} }, {"fillClockwise", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_fillClockwise, Setter = S_fillClockwise} }, {"fillOrigin", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_fillOrigin, Setter = S_fillOrigin} }, {"alphaHitTestMinimumThreshold", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_alphaHitTestMinimumThreshold, Setter = S_alphaHitTestMinimumThreshold} }, {"useSpriteMesh", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_useSpriteMesh, Setter = S_useSpriteMesh} }, {"defaultETC1GraphicMaterial", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_defaultETC1GraphicMaterial, Setter = null} }, {"mainTexture", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_mainTexture, Setter = null} }, {"hasBorder", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_hasBorder, Setter = null} }, {"pixelsPerUnitMultiplier", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_pixelsPerUnitMultiplier, Setter = S_pixelsPerUnitMultiplier} }, {"pixelsPerUnit", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_pixelsPerUnit, Setter = null} }, {"material", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_material, Setter = S_material} }, {"minWidth", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_minWidth, Setter = null} }, {"preferredWidth", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_preferredWidth, Setter = null} }, {"flexibleWidth", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_flexibleWidth, Setter = null} }, {"minHeight", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_minHeight, Setter = null} }, {"preferredHeight", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_preferredHeight, Setter = null} }, {"flexibleHeight", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_flexibleHeight, Setter = null} }, {"layoutPriority", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_layoutPriority, Setter = null} }, } }; } } } <|start_filename|>Projects/DataTemplates/template_erlang/test_tbcompositejsontable1.erl<|end_filename|> %% test.TbCompositeJsonTable1 get(1) -> #{id => 1,x => "aaa1"}. get(2) -> #{id => 2,x => "xx2"}. get(11) -> #{id => 11,x => "aaa11"}. get(12) -> #{id => 12,x => "xx12"}. <|start_filename|>Projects/GenerateDatas/convert_lua/l10n.TbPatchDemo/13.lua<|end_filename|> return { id = 13, value = 3, } <|start_filename|>Projects/GenerateDatas/convert_lua/role.TbRoleLevelExpAttr/12.lua<|end_filename|> return { level = 12, need_exp = 2000, clothes_attrs = { 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, }, } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_LocalizationAsset_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_LocalizationAsset_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.LocalizationAsset(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.LocalizationAsset), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetLocalizedString(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LocalizationAsset; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.GetString(false); obj.SetLocalizedString(Arg0,Arg1); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetLocalizedString(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LocalizationAsset; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetString(false); var result = obj.GetLocalizedString(Arg0); Puerts.PuertsDLL.ReturnString(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_localeIsoCode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LocalizationAsset; var result = obj.localeIsoCode; Puerts.PuertsDLL.ReturnString(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_localeIsoCode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LocalizationAsset; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.localeIsoCode = argHelper.GetString(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_isEditorAsset(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LocalizationAsset; var result = obj.isEditorAsset; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_isEditorAsset(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LocalizationAsset; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.isEditorAsset = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "SetLocalizedString", IsStatic = false}, M_SetLocalizedString }, { new Puerts.MethodKey {Name = "GetLocalizedString", IsStatic = false}, M_GetLocalizedString }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"localeIsoCode", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_localeIsoCode, Setter = S_localeIsoCode} }, {"isEditorAsset", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_isEditorAsset, Setter = S_isEditorAsset} }, } }; } } } <|start_filename|>Projects/GenerateDatas/convert_lua/test.TbDemoGroup_S/4.lua<|end_filename|> return { id = 4, x1 = 1, x2 = 2, x3 = 3, x4 = 4, x5 = { y1 = 10, y2 = 20, y3 = 30, y4 = 40, }, } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_CubemapArray_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_CubemapArray_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = (UnityEngine.Experimental.Rendering.DefaultFormat)argHelper2.GetInt32(false); var Arg3 = (UnityEngine.Experimental.Rendering.TextureCreationFlags)argHelper3.GetInt32(false); var result = new UnityEngine.CubemapArray(Arg0,Arg1,Arg2,Arg3); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.CubemapArray), result); } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = (UnityEngine.Experimental.Rendering.GraphicsFormat)argHelper2.GetInt32(false); var Arg3 = (UnityEngine.Experimental.Rendering.TextureCreationFlags)argHelper3.GetInt32(false); var result = new UnityEngine.CubemapArray(Arg0,Arg1,Arg2,Arg3); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.CubemapArray), result); } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = (UnityEngine.TextureFormat)argHelper2.GetInt32(false); var Arg3 = argHelper3.GetBoolean(false); var result = new UnityEngine.CubemapArray(Arg0,Arg1,Arg2,Arg3); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.CubemapArray), result); } } if (paramLen == 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = (UnityEngine.Experimental.Rendering.GraphicsFormat)argHelper2.GetInt32(false); var Arg3 = (UnityEngine.Experimental.Rendering.TextureCreationFlags)argHelper3.GetInt32(false); var Arg4 = argHelper4.GetInt32(false); var result = new UnityEngine.CubemapArray(Arg0,Arg1,Arg2,Arg3,Arg4); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.CubemapArray), result); } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = (UnityEngine.TextureFormat)argHelper2.GetInt32(false); var Arg3 = argHelper3.GetInt32(false); var Arg4 = argHelper4.GetBoolean(false); var result = new UnityEngine.CubemapArray(Arg0,Arg1,Arg2,Arg3,Arg4); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.CubemapArray), result); } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = (UnityEngine.TextureFormat)argHelper2.GetInt32(false); var Arg3 = argHelper3.GetBoolean(false); var Arg4 = argHelper4.GetBoolean(false); var result = new UnityEngine.CubemapArray(Arg0,Arg1,Arg2,Arg3,Arg4); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.CubemapArray), result); } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.CubemapArray constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetPixels(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CubemapArray; if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = (UnityEngine.CubemapFace)argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var result = obj.GetPixels(Arg0,Arg1,Arg2); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = (UnityEngine.CubemapFace)argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var result = obj.GetPixels(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetPixels"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetPixels32(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CubemapArray; if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = (UnityEngine.CubemapFace)argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var result = obj.GetPixels32(Arg0,Arg1,Arg2); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = (UnityEngine.CubemapFace)argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var result = obj.GetPixels32(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetPixels32"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetPixels(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CubemapArray; if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Color[]), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Color[]>(false); var Arg1 = (UnityEngine.CubemapFace)argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetInt32(false); obj.SetPixels(Arg0,Arg1,Arg2,Arg3); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Color[]), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Color[]>(false); var Arg1 = (UnityEngine.CubemapFace)argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); obj.SetPixels(Arg0,Arg1,Arg2); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SetPixels"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetPixels32(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CubemapArray; if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Color32[]), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Color32[]>(false); var Arg1 = (UnityEngine.CubemapFace)argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetInt32(false); obj.SetPixels32(Arg0,Arg1,Arg2,Arg3); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Color32[]), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Color32[]>(false); var Arg1 = (UnityEngine.CubemapFace)argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); obj.SetPixels32(Arg0,Arg1,Arg2); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SetPixels32"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Apply(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CubemapArray; if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.GetBoolean(false); var Arg1 = argHelper1.GetBoolean(false); obj.Apply(Arg0,Arg1); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.GetBoolean(false); obj.Apply(Arg0); return; } } if (paramLen == 0) { { obj.Apply(); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to Apply"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_cubemapCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CubemapArray; var result = obj.cubemapCount; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_format(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CubemapArray; var result = obj.format; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_isReadable(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CubemapArray; var result = obj.isReadable; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "GetPixels", IsStatic = false}, M_GetPixels }, { new Puerts.MethodKey {Name = "GetPixels32", IsStatic = false}, M_GetPixels32 }, { new Puerts.MethodKey {Name = "SetPixels", IsStatic = false}, M_SetPixels }, { new Puerts.MethodKey {Name = "SetPixels32", IsStatic = false}, M_SetPixels32 }, { new Puerts.MethodKey {Name = "Apply", IsStatic = false}, M_Apply }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"cubemapCount", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_cubemapCount, Setter = null} }, {"format", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_format, Setter = null} }, {"isReadable", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_isReadable, Setter = null} }, } }; } } } <|start_filename|>Projects/Csharp_CustomTemplate_EncryptMemory/Gen/role/DistinctBonusInfos.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using System; using Newtonsoft.Json; using Scripts; namespace cfg.role { [Serializable] public partial class DistinctBonusInfos : AConfig { [JsonProperty("effective_level")] private int _effective_level { get; set; } [JsonIgnore] public EncryptInt effective_level { get; private set; } = new(); public System.Collections.Generic.List<role.BonusInfo> bonus_info { get; set; } public override void EndInit() { effective_level = _effective_level; foreach(var _e in bonus_info) { _e.EndInit(); } } public override string ToString() => JsonConvert.SerializeObject(this); } } <|start_filename|>Projects/Csharp_Unity_bin_use_UnityEngine_Vector/Assets/Gen/test/TestMap.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.test { public sealed class TestMap : Bright.Config.BeanBase { public TestMap(ByteBuf _buf) { Id = _buf.ReadInt(); {int n = System.Math.Min(_buf.ReadSize(), _buf.Size);X1 = new System.Collections.Generic.Dictionary<int, int>(n * 3 / 2);for(var i = 0 ; i < n ; i++) { int _k; _k = _buf.ReadInt(); int _v; _v = _buf.ReadInt(); X1.Add(_k, _v);}} {int n = System.Math.Min(_buf.ReadSize(), _buf.Size);X2 = new System.Collections.Generic.Dictionary<long, int>(n * 3 / 2);for(var i = 0 ; i < n ; i++) { long _k; _k = _buf.ReadLong(); int _v; _v = _buf.ReadInt(); X2.Add(_k, _v);}} {int n = System.Math.Min(_buf.ReadSize(), _buf.Size);X3 = new System.Collections.Generic.Dictionary<string, int>(n * 3 / 2);for(var i = 0 ; i < n ; i++) { string _k; _k = _buf.ReadString(); int _v; _v = _buf.ReadInt(); X3.Add(_k, _v);}} {int n = System.Math.Min(_buf.ReadSize(), _buf.Size);X4 = new System.Collections.Generic.Dictionary<test.DemoEnum, int>(n * 3 / 2);for(var i = 0 ; i < n ; i++) { test.DemoEnum _k; _k = (test.DemoEnum)_buf.ReadInt(); int _v; _v = _buf.ReadInt(); X4.Add(_k, _v);}} } public static TestMap DeserializeTestMap(ByteBuf _buf) { return new test.TestMap(_buf); } public int Id { get; private set; } public test.TestIndex Id_Ref { get; private set; } public System.Collections.Generic.Dictionary<int, int> X1 { get; private set; } public System.Collections.Generic.Dictionary<long, int> X2 { get; private set; } public System.Collections.Generic.Dictionary<string, int> X3 { get; private set; } public System.Collections.Generic.Dictionary<test.DemoEnum, int> X4 { get; private set; } public const int __ID__ = -543227410; public override int GetTypeId() => __ID__; public void Resolve(Dictionary<string, object> _tables) { this.Id_Ref = (_tables["test.TbTestIndex"] as test.TbTestIndex).GetOrDefault(Id); } public void TranslateText(System.Func<string, string, string> translator) { } public override string ToString() { return "{ " + "Id:" + Id + "," + "X1:" + Bright.Common.StringUtil.CollectionToString(X1) + "," + "X2:" + Bright.Common.StringUtil.CollectionToString(X2) + "," + "X3:" + Bright.Common.StringUtil.CollectionToString(X3) + "," + "X4:" + Bright.Common.StringUtil.CollectionToString(X4) + "," + "}"; } } } <|start_filename|>Projects/DataTemplates/template_lua2/test_tbcompositejsontable1.lua<|end_filename|> -- test.TbCompositeJsonTable1 return { [1] = { id=1, x="aaa1", }, [2] = { id=2, x="xx2", }, [11] = { id=11, x="aaa11", }, [12] = { id=12, x="xx12", }, } <|start_filename|>Projects/GenerateDatas/convert_lua/l10n.TbL10NDemo/11.lua<|end_filename|> return { id = 11, text = {key='/demo/1',text="测试1"}, } <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/item/Dymmy.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.item { public sealed partial class Dymmy : item.ItemExtra { public Dymmy(ByteBuf _buf) : base(_buf) { Cost = cost.Cost.DeserializeCost(_buf); } public Dymmy(int id, cost.Cost cost ) : base(id) { this.Cost = cost; } public static Dymmy DeserializeDymmy(ByteBuf _buf) { return new item.Dymmy(_buf); } public readonly cost.Cost Cost; public const int ID = 896889705; public override int GetTypeId() => ID; public override void Resolve(Dictionary<string, object> _tables) { base.Resolve(_tables); Cost?.Resolve(_tables); OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); public override string ToString() { return "{ " + "Id:" + Id + "," + "Cost:" + Cost + "," + "}"; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_TreeInstance_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_TreeInstance_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.TreeInstance constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_position(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.TreeInstance)Puerts.Utils.GetSelf((int)data, self); var result = obj.position; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_position(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.TreeInstance)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.position = argHelper.Get<UnityEngine.Vector3>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_widthScale(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.TreeInstance)Puerts.Utils.GetSelf((int)data, self); var result = obj.widthScale; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_widthScale(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.TreeInstance)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.widthScale = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_heightScale(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.TreeInstance)Puerts.Utils.GetSelf((int)data, self); var result = obj.heightScale; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_heightScale(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.TreeInstance)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.heightScale = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_rotation(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.TreeInstance)Puerts.Utils.GetSelf((int)data, self); var result = obj.rotation; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_rotation(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.TreeInstance)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.rotation = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_color(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.TreeInstance)Puerts.Utils.GetSelf((int)data, self); var result = obj.color; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_color(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.TreeInstance)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.color = argHelper.Get<UnityEngine.Color32>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_lightmapColor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.TreeInstance)Puerts.Utils.GetSelf((int)data, self); var result = obj.lightmapColor; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_lightmapColor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.TreeInstance)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.lightmapColor = argHelper.Get<UnityEngine.Color32>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_prototypeIndex(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.TreeInstance)Puerts.Utils.GetSelf((int)data, self); var result = obj.prototypeIndex; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_prototypeIndex(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.TreeInstance)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.prototypeIndex = argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"position", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_position, Setter = S_position} }, {"widthScale", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_widthScale, Setter = S_widthScale} }, {"heightScale", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_heightScale, Setter = S_heightScale} }, {"rotation", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_rotation, Setter = S_rotation} }, {"color", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_color, Setter = S_color} }, {"lightmapColor", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_lightmapColor, Setter = S_lightmapColor} }, {"prototypeIndex", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_prototypeIndex, Setter = S_prototypeIndex} }, } }; } } } <|start_filename|>Projects/java_json/src/gen/cfg/role/DistinctBonusInfos.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.role; import com.google.gson.JsonElement; import com.google.gson.JsonObject; public final class DistinctBonusInfos { public DistinctBonusInfos(JsonObject __json__) { effectiveLevel = __json__.get("effective_level").getAsInt(); { com.google.gson.JsonArray _json0_ = __json__.get("bonus_info").getAsJsonArray(); bonusInfo = new java.util.ArrayList<cfg.role.BonusInfo>(_json0_.size()); for(JsonElement __e : _json0_) { cfg.role.BonusInfo __v; __v = new cfg.role.BonusInfo(__e.getAsJsonObject()); bonusInfo.add(__v); } } } public DistinctBonusInfos(int effective_level, java.util.ArrayList<cfg.role.BonusInfo> bonus_info ) { this.effectiveLevel = effective_level; this.bonusInfo = bonus_info; } public static DistinctBonusInfos deserializeDistinctBonusInfos(JsonObject __json__) { return new DistinctBonusInfos(__json__); } public final int effectiveLevel; public final java.util.ArrayList<cfg.role.BonusInfo> bonusInfo; public void resolve(java.util.HashMap<String, Object> _tables) { for(cfg.role.BonusInfo _e : bonusInfo) { if (_e != null) _e.resolve(_tables); } } @Override public String toString() { return "{ " + "effectiveLevel:" + effectiveLevel + "," + "bonusInfo:" + bonusInfo + "," + "}"; } } <|start_filename|>Projects/Java_bin/src/main/gen/cfg/test/TestGlobal.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.test; import bright.serialization.*; public final class TestGlobal { public TestGlobal(ByteBuf _buf) { unlockEquip = _buf.readInt(); unlockHero = _buf.readInt(); } public TestGlobal(int unlock_equip, int unlock_hero ) { this.unlockEquip = unlock_equip; this.unlockHero = unlock_hero; } public final int unlockEquip; public final int unlockHero; public void resolve(java.util.HashMap<String, Object> _tables) { } @Override public String toString() { return "{ " + "unlockEquip:" + unlockEquip + "," + "unlockHero:" + unlockHero + "," + "}"; } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_StaticBatchingUtility_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_StaticBatchingUtility_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.StaticBatchingUtility(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.StaticBatchingUtility), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_Combine(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GameObject), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.GameObject>(false); UnityEngine.StaticBatchingUtility.Combine(Arg0); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GameObject[]), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GameObject), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.GameObject[]>(false); var Arg1 = argHelper1.Get<UnityEngine.GameObject>(false); UnityEngine.StaticBatchingUtility.Combine(Arg0,Arg1); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to Combine"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "Combine", IsStatic = true}, F_Combine }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { } }; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_GeometryUtility_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_GeometryUtility_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.GeometryUtility(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.GeometryUtility), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_CalculateFrustumPlanes(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Camera), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Camera>(false); var result = UnityEngine.GeometryUtility.CalculateFrustumPlanes(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Matrix4x4), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Matrix4x4>(false); var result = UnityEngine.GeometryUtility.CalculateFrustumPlanes(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Camera), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Plane[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Camera>(false); var Arg1 = argHelper1.Get<UnityEngine.Plane[]>(false); UnityEngine.GeometryUtility.CalculateFrustumPlanes(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Matrix4x4), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Plane[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Matrix4x4>(false); var Arg1 = argHelper1.Get<UnityEngine.Plane[]>(false); UnityEngine.GeometryUtility.CalculateFrustumPlanes(Arg0,Arg1); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to CalculateFrustumPlanes"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_CalculateBounds(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<UnityEngine.Vector3[]>(false); var Arg1 = argHelper1.Get<UnityEngine.Matrix4x4>(false); var result = UnityEngine.GeometryUtility.CalculateBounds(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_TryCreatePlaneFromPolygon(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<UnityEngine.Vector3[]>(false); var Arg1 = argHelper1.Get<UnityEngine.Plane>(true); var result = UnityEngine.GeometryUtility.TryCreatePlaneFromPolygon(Arg0,out Arg1); argHelper1.SetByRefValue(Arg1); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_TestPlanesAABB(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<UnityEngine.Plane[]>(false); var Arg1 = argHelper1.Get<UnityEngine.Bounds>(false); var result = UnityEngine.GeometryUtility.TestPlanesAABB(Arg0,Arg1); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "CalculateFrustumPlanes", IsStatic = true}, F_CalculateFrustumPlanes }, { new Puerts.MethodKey {Name = "CalculateBounds", IsStatic = true}, F_CalculateBounds }, { new Puerts.MethodKey {Name = "TryCreatePlaneFromPolygon", IsStatic = true}, F_TryCreatePlaneFromPolygon }, { new Puerts.MethodKey {Name = "TestPlanesAABB", IsStatic = true}, F_TestPlanesAABB }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { } }; } } } <|start_filename|>Projects/GenerateDatas/convert_lua/error.TbCodeInfo/206.lua<|end_filename|> return { code = 206, key = "ITEM_IN_BAG", } <|start_filename|>Projects/Java_bin/src/main/gen/cfg/ai/FlowNode.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.ai; import bright.serialization.*; public abstract class FlowNode extends cfg.ai.Node { public FlowNode(ByteBuf _buf) { super(_buf); {int n = Math.min(_buf.readSize(), _buf.size());decorators = new java.util.ArrayList<cfg.ai.Decorator>(n);for(int i = 0 ; i < n ; i++) { cfg.ai.Decorator _e; _e = cfg.ai.Decorator.deserializeDecorator(_buf); decorators.add(_e);}} {int n = Math.min(_buf.readSize(), _buf.size());services = new java.util.ArrayList<cfg.ai.Service>(n);for(int i = 0 ; i < n ; i++) { cfg.ai.Service _e; _e = cfg.ai.Service.deserializeService(_buf); services.add(_e);}} } public FlowNode(int id, String node_name, java.util.ArrayList<cfg.ai.Decorator> decorators, java.util.ArrayList<cfg.ai.Service> services ) { super(id, node_name); this.decorators = decorators; this.services = services; } public static FlowNode deserializeFlowNode(ByteBuf _buf) { switch (_buf.readInt()) { case cfg.ai.Sequence.__ID__: return new cfg.ai.Sequence(_buf); case cfg.ai.Selector.__ID__: return new cfg.ai.Selector(_buf); case cfg.ai.SimpleParallel.__ID__: return new cfg.ai.SimpleParallel(_buf); case cfg.ai.UeWait.__ID__: return new cfg.ai.UeWait(_buf); case cfg.ai.UeWaitBlackboardTime.__ID__: return new cfg.ai.UeWaitBlackboardTime(_buf); case cfg.ai.MoveToTarget.__ID__: return new cfg.ai.MoveToTarget(_buf); case cfg.ai.ChooseSkill.__ID__: return new cfg.ai.ChooseSkill(_buf); case cfg.ai.MoveToRandomLocation.__ID__: return new cfg.ai.MoveToRandomLocation(_buf); case cfg.ai.MoveToLocation.__ID__: return new cfg.ai.MoveToLocation(_buf); case cfg.ai.DebugPrint.__ID__: return new cfg.ai.DebugPrint(_buf); default: throw new SerializationException(); } } public final java.util.ArrayList<cfg.ai.Decorator> decorators; public final java.util.ArrayList<cfg.ai.Service> services; @Override public void resolve(java.util.HashMap<String, Object> _tables) { super.resolve(_tables); for(cfg.ai.Decorator _e : decorators) { if (_e != null) _e.resolve(_tables); } for(cfg.ai.Service _e : services) { if (_e != null) _e.resolve(_tables); } } @Override public String toString() { return "{ " + "id:" + id + "," + "nodeName:" + nodeName + "," + "decorators:" + decorators + "," + "services:" + services + "," + "}"; } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_BoundingSphere_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_BoundingSphere_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = argHelper1.GetFloat(false); var result = new UnityEngine.BoundingSphere(Arg0,Arg1); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.BoundingSphere), result); } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector4), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector4>(false); var result = new UnityEngine.BoundingSphere(Arg0); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.BoundingSphere), result); } } if (paramLen == 0) { { var result = new UnityEngine.BoundingSphere(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.BoundingSphere), result); } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.BoundingSphere constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_position(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.BoundingSphere)Puerts.Utils.GetSelf((int)data, self); var result = obj.position; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_position(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.BoundingSphere)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.position = argHelper.Get<UnityEngine.Vector3>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_radius(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.BoundingSphere)Puerts.Utils.GetSelf((int)data, self); var result = obj.radius; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_radius(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.BoundingSphere)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.radius = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"position", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_position, Setter = S_position} }, {"radius", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_radius, Setter = S_radius} }, } }; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_BillboardAsset_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_BillboardAsset_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.BillboardAsset(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.BillboardAsset), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetImageTexCoords(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.BillboardAsset; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Vector4>), false, false)) { var Arg0 = argHelper0.Get<System.Collections.Generic.List<UnityEngine.Vector4>>(false); obj.GetImageTexCoords(Arg0); return; } } if (paramLen == 0) { { var result = obj.GetImageTexCoords(); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetImageTexCoords"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetImageTexCoords(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.BillboardAsset; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Vector4>), false, false)) { var Arg0 = argHelper0.Get<System.Collections.Generic.List<UnityEngine.Vector4>>(false); obj.SetImageTexCoords(Arg0); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector4[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector4[]>(false); obj.SetImageTexCoords(Arg0); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SetImageTexCoords"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetVertices(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.BillboardAsset; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Vector2>), false, false)) { var Arg0 = argHelper0.Get<System.Collections.Generic.List<UnityEngine.Vector2>>(false); obj.GetVertices(Arg0); return; } } if (paramLen == 0) { { var result = obj.GetVertices(); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetVertices"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetVertices(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.BillboardAsset; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Vector2>), false, false)) { var Arg0 = argHelper0.Get<System.Collections.Generic.List<UnityEngine.Vector2>>(false); obj.SetVertices(Arg0); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2[]>(false); obj.SetVertices(Arg0); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SetVertices"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetIndices(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.BillboardAsset; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<ushort>), false, false)) { var Arg0 = argHelper0.Get<System.Collections.Generic.List<ushort>>(false); obj.GetIndices(Arg0); return; } } if (paramLen == 0) { { var result = obj.GetIndices(); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetIndices"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetIndices(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.BillboardAsset; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<ushort>), false, false)) { var Arg0 = argHelper0.Get<System.Collections.Generic.List<ushort>>(false); obj.SetIndices(Arg0); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(ushort[]), false, false)) { var Arg0 = argHelper0.Get<ushort[]>(false); obj.SetIndices(Arg0); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SetIndices"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_width(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.BillboardAsset; var result = obj.width; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_width(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.BillboardAsset; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.width = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_height(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.BillboardAsset; var result = obj.height; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_height(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.BillboardAsset; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.height = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_bottom(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.BillboardAsset; var result = obj.bottom; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_bottom(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.BillboardAsset; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.bottom = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_imageCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.BillboardAsset; var result = obj.imageCount; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_vertexCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.BillboardAsset; var result = obj.vertexCount; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_indexCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.BillboardAsset; var result = obj.indexCount; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_material(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.BillboardAsset; var result = obj.material; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_material(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.BillboardAsset; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.material = argHelper.Get<UnityEngine.Material>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "GetImageTexCoords", IsStatic = false}, M_GetImageTexCoords }, { new Puerts.MethodKey {Name = "SetImageTexCoords", IsStatic = false}, M_SetImageTexCoords }, { new Puerts.MethodKey {Name = "GetVertices", IsStatic = false}, M_GetVertices }, { new Puerts.MethodKey {Name = "SetVertices", IsStatic = false}, M_SetVertices }, { new Puerts.MethodKey {Name = "GetIndices", IsStatic = false}, M_GetIndices }, { new Puerts.MethodKey {Name = "SetIndices", IsStatic = false}, M_SetIndices }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"width", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_width, Setter = S_width} }, {"height", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_height, Setter = S_height} }, {"bottom", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_bottom, Setter = S_bottom} }, {"imageCount", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_imageCount, Setter = null} }, {"vertexCount", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_vertexCount, Setter = null} }, {"indexCount", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_indexCount, Setter = null} }, {"material", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_material, Setter = S_material} }, } }; } } } <|start_filename|>Projects/java_json/src/main/Main.java<|end_filename|> import com.google.gson.Gson; import com.google.gson.JsonParser; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Paths; public class Main { public static void main(String[] args) throws IOException { cfg.Tables tables = new cfg.Tables(file -> JsonParser.parseString( Files.readString(Paths.get("../GenerateDatas/json", file + ".json")))); System.out.println("== run == " + tables.getTbGlobalConfig().getBagCapacity()); } } <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/ai/SimpleParallel.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.ai { public sealed partial class SimpleParallel : ai.ComposeNode { public SimpleParallel(ByteBuf _buf) : base(_buf) { FinishMode = (ai.EFinishMode)_buf.ReadInt(); MainTask = ai.Task.DeserializeTask(_buf); BackgroundNode = ai.FlowNode.DeserializeFlowNode(_buf); } public SimpleParallel(int id, string node_name, System.Collections.Generic.List<ai.Decorator> decorators, System.Collections.Generic.List<ai.Service> services, ai.EFinishMode finish_mode, ai.Task main_task, ai.FlowNode background_node ) : base(id,node_name,decorators,services) { this.FinishMode = finish_mode; this.MainTask = main_task; this.BackgroundNode = background_node; } public static SimpleParallel DeserializeSimpleParallel(ByteBuf _buf) { return new ai.SimpleParallel(_buf); } public readonly ai.EFinishMode FinishMode; public readonly ai.Task MainTask; public readonly ai.FlowNode BackgroundNode; public const int ID = -1952582529; public override int GetTypeId() => ID; public override void Resolve(Dictionary<string, object> _tables) { base.Resolve(_tables); MainTask?.Resolve(_tables); BackgroundNode?.Resolve(_tables); OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); public override string ToString() { return "{ " + "Id:" + Id + "," + "NodeName:" + NodeName + "," + "Decorators:" + Bright.Common.StringUtil.CollectionToString(Decorators) + "," + "Services:" + Bright.Common.StringUtil.CollectionToString(Services) + "," + "FinishMode:" + FinishMode + "," + "MainTask:" + MainTask + "," + "BackgroundNode:" + BackgroundNode + "," + "}"; } } } <|start_filename|>Projects/Cpp_Unreal_bin/Source/Cpp_Unreal/Cpp_Unreal.h<|end_filename|> // Copyright 1998-2019 Epic Games, Inc. All Rights Reserved. #pragma once #include "CoreMinimal.h" class CPP_UNREAL_API MainModule : public IModuleInterface { public: virtual void StartupModule() override; }; <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_Rigidbody2D_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_Rigidbody2D_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.Rigidbody2D(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.Rigidbody2D), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetRotation(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody2D; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetFloat(false); obj.SetRotation(Arg0); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Quaternion), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Quaternion>(false); obj.SetRotation(Arg0); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SetRotation"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_MovePosition(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody2D; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); obj.MovePosition(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_MoveRotation(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody2D; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetFloat(false); obj.MoveRotation(Arg0); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Quaternion), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Quaternion>(false); obj.MoveRotation(Arg0); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to MoveRotation"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_IsSleeping(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody2D; { { var result = obj.IsSleeping(); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_IsAwake(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody2D; { { var result = obj.IsAwake(); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Sleep(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody2D; { { obj.Sleep(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_WakeUp(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody2D; { { obj.WakeUp(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_IsTouching(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody2D; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Collider2D), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Collider2D>(false); var result = obj.IsTouching(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.ContactFilter2D>(false); var result = obj.IsTouching(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Collider2D), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Collider2D>(false); var Arg1 = argHelper1.Get<UnityEngine.ContactFilter2D>(false); var result = obj.IsTouching(Arg0,Arg1); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to IsTouching"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_IsTouchingLayers(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody2D; if (paramLen == 0) { { var result = obj.IsTouchingLayers(); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var result = obj.IsTouchingLayers(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to IsTouchingLayers"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_OverlapPoint(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody2D; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var result = obj.OverlapPoint(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Distance(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody2D; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Collider2D>(false); var result = obj.Distance(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ClosestPoint(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody2D; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var result = obj.ClosestPoint(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_AddForce(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody2D; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); obj.AddForce(Arg0); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = (UnityEngine.ForceMode2D)argHelper1.GetInt32(false); obj.AddForce(Arg0,Arg1); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to AddForce"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_AddRelativeForce(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody2D; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); obj.AddRelativeForce(Arg0); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = (UnityEngine.ForceMode2D)argHelper1.GetInt32(false); obj.AddRelativeForce(Arg0,Arg1); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to AddRelativeForce"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_AddForceAtPosition(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody2D; if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); obj.AddForceAtPosition(Arg0,Arg1); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = (UnityEngine.ForceMode2D)argHelper2.GetInt32(false); obj.AddForceAtPosition(Arg0,Arg1,Arg2); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to AddForceAtPosition"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_AddTorque(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody2D; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetFloat(false); obj.AddTorque(Arg0); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetFloat(false); var Arg1 = (UnityEngine.ForceMode2D)argHelper1.GetInt32(false); obj.AddTorque(Arg0,Arg1); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to AddTorque"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetPoint(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody2D; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var result = obj.GetPoint(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetRelativePoint(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody2D; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var result = obj.GetRelativePoint(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetVector(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody2D; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var result = obj.GetVector(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetRelativeVector(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody2D; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var result = obj.GetRelativeVector(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetPointVelocity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody2D; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var result = obj.GetPointVelocity(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetRelativePointVelocity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody2D; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var result = obj.GetRelativePointVelocity(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_OverlapCollider(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody2D; if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Collider2D[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.ContactFilter2D>(false); var Arg1 = argHelper1.Get<UnityEngine.Collider2D[]>(false); var result = obj.OverlapCollider(Arg0,Arg1); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Collider2D>), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.ContactFilter2D>(false); var Arg1 = argHelper1.Get<System.Collections.Generic.List<UnityEngine.Collider2D>>(false); var result = obj.OverlapCollider(Arg0,Arg1); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to OverlapCollider"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetContacts(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody2D; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactPoint2D[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.ContactPoint2D[]>(false); var result = obj.GetContacts(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.ContactPoint2D>), false, false)) { var Arg0 = argHelper0.Get<System.Collections.Generic.List<UnityEngine.ContactPoint2D>>(false); var result = obj.GetContacts(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Collider2D[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Collider2D[]>(false); var result = obj.GetContacts(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Collider2D>), false, false)) { var Arg0 = argHelper0.Get<System.Collections.Generic.List<UnityEngine.Collider2D>>(false); var result = obj.GetContacts(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactPoint2D[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.ContactFilter2D>(false); var Arg1 = argHelper1.Get<UnityEngine.ContactPoint2D[]>(false); var result = obj.GetContacts(Arg0,Arg1); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.ContactPoint2D>), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.ContactFilter2D>(false); var Arg1 = argHelper1.Get<System.Collections.Generic.List<UnityEngine.ContactPoint2D>>(false); var result = obj.GetContacts(Arg0,Arg1); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Collider2D[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.ContactFilter2D>(false); var Arg1 = argHelper1.Get<UnityEngine.Collider2D[]>(false); var result = obj.GetContacts(Arg0,Arg1); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Collider2D>), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.ContactFilter2D>(false); var Arg1 = argHelper1.Get<System.Collections.Generic.List<UnityEngine.Collider2D>>(false); var result = obj.GetContacts(Arg0,Arg1); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetContacts"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetAttachedColliders(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody2D; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Collider2D[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Collider2D[]>(false); var result = obj.GetAttachedColliders(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Collider2D>), false, false)) { var Arg0 = argHelper0.Get<System.Collections.Generic.List<UnityEngine.Collider2D>>(false); var result = obj.GetAttachedColliders(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetAttachedColliders"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Cast(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody2D; if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit2D[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.RaycastHit2D[]>(false); var result = obj.Cast(Arg0,Arg1); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.RaycastHit2D>), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<System.Collections.Generic.List<UnityEngine.RaycastHit2D>>(false); var result = obj.Cast(Arg0,Arg1); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit2D[]), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.RaycastHit2D[]>(false); var Arg2 = argHelper2.GetFloat(false); var result = obj.Cast(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.RaycastHit2D>), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<System.Collections.Generic.List<UnityEngine.RaycastHit2D>>(false); var Arg2 = argHelper2.GetFloat(false); var result = obj.Cast(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit2D[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.ContactFilter2D>(false); var Arg2 = argHelper2.Get<UnityEngine.RaycastHit2D[]>(false); var result = obj.Cast(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit2D[]), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.ContactFilter2D>(false); var Arg2 = argHelper2.Get<UnityEngine.RaycastHit2D[]>(false); var Arg3 = argHelper3.GetFloat(false); var result = obj.Cast(Arg0,Arg1,Arg2,Arg3); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.RaycastHit2D>), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.ContactFilter2D>(false); var Arg2 = argHelper2.Get<System.Collections.Generic.List<UnityEngine.RaycastHit2D>>(false); var Arg3 = argHelper3.GetFloat(false); var result = obj.Cast(Arg0,Arg1,Arg2,Arg3); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to Cast"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_position(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody2D; var result = obj.position; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_position(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.position = argHelper.Get<UnityEngine.Vector2>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_rotation(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody2D; var result = obj.rotation; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_rotation(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.rotation = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_velocity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody2D; var result = obj.velocity; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_velocity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.velocity = argHelper.Get<UnityEngine.Vector2>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_angularVelocity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody2D; var result = obj.angularVelocity; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_angularVelocity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.angularVelocity = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_useAutoMass(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody2D; var result = obj.useAutoMass; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_useAutoMass(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.useAutoMass = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_mass(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody2D; var result = obj.mass; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_mass(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.mass = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_sharedMaterial(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody2D; var result = obj.sharedMaterial; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_sharedMaterial(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.sharedMaterial = argHelper.Get<UnityEngine.PhysicsMaterial2D>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_centerOfMass(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody2D; var result = obj.centerOfMass; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_centerOfMass(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.centerOfMass = argHelper.Get<UnityEngine.Vector2>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_worldCenterOfMass(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody2D; var result = obj.worldCenterOfMass; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_inertia(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody2D; var result = obj.inertia; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_inertia(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.inertia = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_drag(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody2D; var result = obj.drag; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_drag(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.drag = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_angularDrag(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody2D; var result = obj.angularDrag; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_angularDrag(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.angularDrag = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_gravityScale(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody2D; var result = obj.gravityScale; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_gravityScale(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.gravityScale = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_bodyType(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody2D; var result = obj.bodyType; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_bodyType(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.bodyType = (UnityEngine.RigidbodyType2D)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_useFullKinematicContacts(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody2D; var result = obj.useFullKinematicContacts; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_useFullKinematicContacts(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.useFullKinematicContacts = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_isKinematic(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody2D; var result = obj.isKinematic; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_isKinematic(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.isKinematic = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_freezeRotation(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody2D; var result = obj.freezeRotation; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_freezeRotation(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.freezeRotation = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_constraints(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody2D; var result = obj.constraints; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_constraints(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.constraints = (UnityEngine.RigidbodyConstraints2D)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_simulated(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody2D; var result = obj.simulated; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_simulated(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.simulated = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_interpolation(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody2D; var result = obj.interpolation; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_interpolation(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.interpolation = (UnityEngine.RigidbodyInterpolation2D)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_sleepMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody2D; var result = obj.sleepMode; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_sleepMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.sleepMode = (UnityEngine.RigidbodySleepMode2D)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_collisionDetectionMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody2D; var result = obj.collisionDetectionMode; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_collisionDetectionMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.collisionDetectionMode = (UnityEngine.CollisionDetectionMode2D)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_attachedColliderCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody2D; var result = obj.attachedColliderCount; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "SetRotation", IsStatic = false}, M_SetRotation }, { new Puerts.MethodKey {Name = "MovePosition", IsStatic = false}, M_MovePosition }, { new Puerts.MethodKey {Name = "MoveRotation", IsStatic = false}, M_MoveRotation }, { new Puerts.MethodKey {Name = "IsSleeping", IsStatic = false}, M_IsSleeping }, { new Puerts.MethodKey {Name = "IsAwake", IsStatic = false}, M_IsAwake }, { new Puerts.MethodKey {Name = "Sleep", IsStatic = false}, M_Sleep }, { new Puerts.MethodKey {Name = "WakeUp", IsStatic = false}, M_WakeUp }, { new Puerts.MethodKey {Name = "IsTouching", IsStatic = false}, M_IsTouching }, { new Puerts.MethodKey {Name = "IsTouchingLayers", IsStatic = false}, M_IsTouchingLayers }, { new Puerts.MethodKey {Name = "OverlapPoint", IsStatic = false}, M_OverlapPoint }, { new Puerts.MethodKey {Name = "Distance", IsStatic = false}, M_Distance }, { new Puerts.MethodKey {Name = "ClosestPoint", IsStatic = false}, M_ClosestPoint }, { new Puerts.MethodKey {Name = "AddForce", IsStatic = false}, M_AddForce }, { new Puerts.MethodKey {Name = "AddRelativeForce", IsStatic = false}, M_AddRelativeForce }, { new Puerts.MethodKey {Name = "AddForceAtPosition", IsStatic = false}, M_AddForceAtPosition }, { new Puerts.MethodKey {Name = "AddTorque", IsStatic = false}, M_AddTorque }, { new Puerts.MethodKey {Name = "GetPoint", IsStatic = false}, M_GetPoint }, { new Puerts.MethodKey {Name = "GetRelativePoint", IsStatic = false}, M_GetRelativePoint }, { new Puerts.MethodKey {Name = "GetVector", IsStatic = false}, M_GetVector }, { new Puerts.MethodKey {Name = "GetRelativeVector", IsStatic = false}, M_GetRelativeVector }, { new Puerts.MethodKey {Name = "GetPointVelocity", IsStatic = false}, M_GetPointVelocity }, { new Puerts.MethodKey {Name = "GetRelativePointVelocity", IsStatic = false}, M_GetRelativePointVelocity }, { new Puerts.MethodKey {Name = "OverlapCollider", IsStatic = false}, M_OverlapCollider }, { new Puerts.MethodKey {Name = "GetContacts", IsStatic = false}, M_GetContacts }, { new Puerts.MethodKey {Name = "GetAttachedColliders", IsStatic = false}, M_GetAttachedColliders }, { new Puerts.MethodKey {Name = "Cast", IsStatic = false}, M_Cast }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"position", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_position, Setter = S_position} }, {"rotation", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_rotation, Setter = S_rotation} }, {"velocity", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_velocity, Setter = S_velocity} }, {"angularVelocity", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_angularVelocity, Setter = S_angularVelocity} }, {"useAutoMass", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_useAutoMass, Setter = S_useAutoMass} }, {"mass", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_mass, Setter = S_mass} }, {"sharedMaterial", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_sharedMaterial, Setter = S_sharedMaterial} }, {"centerOfMass", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_centerOfMass, Setter = S_centerOfMass} }, {"worldCenterOfMass", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_worldCenterOfMass, Setter = null} }, {"inertia", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_inertia, Setter = S_inertia} }, {"drag", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_drag, Setter = S_drag} }, {"angularDrag", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_angularDrag, Setter = S_angularDrag} }, {"gravityScale", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_gravityScale, Setter = S_gravityScale} }, {"bodyType", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_bodyType, Setter = S_bodyType} }, {"useFullKinematicContacts", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_useFullKinematicContacts, Setter = S_useFullKinematicContacts} }, {"isKinematic", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_isKinematic, Setter = S_isKinematic} }, {"freezeRotation", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_freezeRotation, Setter = S_freezeRotation} }, {"constraints", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_constraints, Setter = S_constraints} }, {"simulated", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_simulated, Setter = S_simulated} }, {"interpolation", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_interpolation, Setter = S_interpolation} }, {"sleepMode", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_sleepMode, Setter = S_sleepMode} }, {"collisionDetectionMode", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_collisionDetectionMode, Setter = S_collisionDetectionMode} }, {"attachedColliderCount", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_attachedColliderCount, Setter = null} }, } }; } } } <|start_filename|>Projects/Csharp_Unity_bin_use_UnityEngine_Vector/Assets/Gen/bonus/DropInfo.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.bonus { public sealed class DropInfo : Bright.Config.BeanBase { public DropInfo(ByteBuf _buf) { Id = _buf.ReadInt(); Desc = _buf.ReadString(); {int n = System.Math.Min(_buf.ReadSize(), _buf.Size);ClientShowItems = new System.Collections.Generic.List<bonus.ShowItemInfo>(n);for(var i = 0 ; i < n ; i++) { bonus.ShowItemInfo _e; _e = bonus.ShowItemInfo.DeserializeShowItemInfo(_buf); ClientShowItems.Add(_e);}} Bonus = bonus.Bonus.DeserializeBonus(_buf); } public static DropInfo DeserializeDropInfo(ByteBuf _buf) { return new bonus.DropInfo(_buf); } public int Id { get; private set; } public string Desc { get; private set; } public System.Collections.Generic.List<bonus.ShowItemInfo> ClientShowItems { get; private set; } public bonus.Bonus Bonus { get; private set; } public const int __ID__ = -2014781108; public override int GetTypeId() => __ID__; public void Resolve(Dictionary<string, object> _tables) { foreach(var _e in ClientShowItems) { _e?.Resolve(_tables); } Bonus?.Resolve(_tables); } public void TranslateText(System.Func<string, string, string> translator) { foreach(var _e in ClientShowItems) { _e?.TranslateText(translator); } Bonus?.TranslateText(translator); } public override string ToString() { return "{ " + "Id:" + Id + "," + "Desc:" + Desc + "," + "ClientShowItems:" + Bright.Common.StringUtil.CollectionToString(ClientShowItems) + "," + "Bonus:" + Bonus + "," + "}"; } } } <|start_filename|>Projects/DataTemplates/template_lua/test_tbexcelfromjsonmultirow.lua<|end_filename|> return { [1] = {id=1,x=5,items={{x=1,y=true,z="abcd",a={x=10,y=100,},b={1,3,5,},},{x=2,y=false,z="abcd",a={x=22,y=33,},b={4,5,},},},}, [2] = {id=2,x=9,items={{x=2,y=true,z="abcd",a={x=10,y=11,},b={1,3,5,},},{x=4,y=false,z="abcd",a={x=22,y=33,},b={4,5,},},{x=5,y=false,z="abcd",a={x=22,y=33,},b={4,5,},},},}, } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_UI_LayoutElement_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_UI_LayoutElement_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.UI.LayoutElement constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_CalculateLayoutInputHorizontal(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.LayoutElement; { { obj.CalculateLayoutInputHorizontal(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_CalculateLayoutInputVertical(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.LayoutElement; { { obj.CalculateLayoutInputVertical(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_ignoreLayout(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.LayoutElement; var result = obj.ignoreLayout; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_ignoreLayout(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.LayoutElement; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.ignoreLayout = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_minWidth(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.LayoutElement; var result = obj.minWidth; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_minWidth(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.LayoutElement; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.minWidth = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_minHeight(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.LayoutElement; var result = obj.minHeight; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_minHeight(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.LayoutElement; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.minHeight = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_preferredWidth(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.LayoutElement; var result = obj.preferredWidth; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_preferredWidth(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.LayoutElement; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.preferredWidth = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_preferredHeight(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.LayoutElement; var result = obj.preferredHeight; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_preferredHeight(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.LayoutElement; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.preferredHeight = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_flexibleWidth(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.LayoutElement; var result = obj.flexibleWidth; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_flexibleWidth(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.LayoutElement; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.flexibleWidth = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_flexibleHeight(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.LayoutElement; var result = obj.flexibleHeight; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_flexibleHeight(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.LayoutElement; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.flexibleHeight = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_layoutPriority(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.LayoutElement; var result = obj.layoutPriority; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_layoutPriority(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.LayoutElement; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.layoutPriority = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "CalculateLayoutInputHorizontal", IsStatic = false}, M_CalculateLayoutInputHorizontal }, { new Puerts.MethodKey {Name = "CalculateLayoutInputVertical", IsStatic = false}, M_CalculateLayoutInputVertical }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"ignoreLayout", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_ignoreLayout, Setter = S_ignoreLayout} }, {"minWidth", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_minWidth, Setter = S_minWidth} }, {"minHeight", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_minHeight, Setter = S_minHeight} }, {"preferredWidth", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_preferredWidth, Setter = S_preferredWidth} }, {"preferredHeight", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_preferredHeight, Setter = S_preferredHeight} }, {"flexibleWidth", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_flexibleWidth, Setter = S_flexibleWidth} }, {"flexibleHeight", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_flexibleHeight, Setter = S_flexibleHeight} }, {"layoutPriority", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_layoutPriority, Setter = S_layoutPriority} }, } }; } } } <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/condition/MinMaxLevel.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.condition { public sealed partial class MinMaxLevel : condition.BoolRoleCondition { public MinMaxLevel(ByteBuf _buf) : base(_buf) { Min = _buf.ReadInt(); Max = _buf.ReadInt(); } public MinMaxLevel(int min, int max ) : base() { this.Min = min; this.Max = max; } public static MinMaxLevel DeserializeMinMaxLevel(ByteBuf _buf) { return new condition.MinMaxLevel(_buf); } public readonly int Min; public readonly int Max; public const int ID = 907499647; public override int GetTypeId() => ID; public override void Resolve(Dictionary<string, object> _tables) { base.Resolve(_tables); OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); public override string ToString() { return "{ " + "Min:" + Min + "," + "Max:" + Max + "," + "}"; } } } <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/error/CodeInfo.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.error { public sealed partial class CodeInfo : Bright.Config.BeanBase { public CodeInfo(ByteBuf _buf) { Code = (error.EErrorCode)_buf.ReadInt(); Key = _buf.ReadString(); } public CodeInfo(error.EErrorCode code, string key ) { this.Code = code; this.Key = key; } public static CodeInfo DeserializeCodeInfo(ByteBuf _buf) { return new error.CodeInfo(_buf); } public readonly error.EErrorCode Code; public readonly string Key; public const int ID = -1942481535; public override int GetTypeId() => ID; public void Resolve(Dictionary<string, object> _tables) { OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); public override string ToString() { return "{ " + "Code:" + Code + "," + "Key:" + Key + "," + "}"; } } } <|start_filename|>Projects/DataTemplates/template_lua2/test_tbdemogroup_c.lua<|end_filename|> -- test.TbDemoGroup_C return { [1] = { id=1, x1=1, x2=2, x3=3, x4=4, x5= { y1=10, y2=20, y3=30, y4=40, }, }, [2] = { id=2, x1=1, x2=2, x3=3, x4=4, x5= { y1=10, y2=20, y3=30, y4=40, }, }, [3] = { id=3, x1=1, x2=2, x3=3, x4=4, x5= { y1=10, y2=20, y3=30, y4=40, }, }, [4] = { id=4, x1=1, x2=2, x3=3, x4=4, x5= { y1=10, y2=20, y3=30, y4=40, }, }, } <|start_filename|>Projects/Csharp_CustomTemplate_EncryptMemory/Assets/Tests/EncryptTest.cs<|end_filename|> using System.Collections; using NUnit.Framework; using Scripts; using Unity.PerformanceTesting; using UnityEngine.TestTools; namespace Tests { public class EncryptTest { [Test, Performance] public void Int_Get_100000_10() { int init = 0; Measure.Method( () => { int temp = init; } ). IterationsPerMeasurement(100000). MeasurementCount(10). Run(); } [Test, Performance] public void Int_Encrypt_Get_100000_10() { EncryptInt init = 0; Measure.Method( () => { int temp = init; } ). IterationsPerMeasurement(100000). MeasurementCount(10). Run(); } [Test, Performance] public void Int_Add_100000_10() { int sum = 0; Measure.Method(() => { sum++; }).IterationsPerMeasurement(100000).MeasurementCount(10).Run(); } [Test, Performance] public void Encrypt_Int_Add_100000_10() { EncryptInt sum = 0; Measure.Method(() => { sum++; }).IterationsPerMeasurement(100000).MeasurementCount(10).Run(); } [Test, Performance] public void Mut_Int_100000_10() { int sum = 1; Measure.Method(() => { sum *= 5; }).IterationsPerMeasurement(100000).MeasurementCount(10).Run(); } [Test, Performance] public void Encrypt_Int_Mut_100000_10() { EncryptInt sum = 1; Measure.Method(() => { sum *= 5; }).IterationsPerMeasurement(100000).MeasurementCount(10).Run(); } [Test, Performance] public void Int_Div_100000_10() { int sum = 100000; Measure.Method(() => { sum /= 5; }).IterationsPerMeasurement(100000).MeasurementCount(10).Run(); } [Test, Performance] public void Encrypt_Int_Div_100000_10() { EncryptInt sum = 100000; Measure.Method(() => { sum /= 5; }).IterationsPerMeasurement(100000).MeasurementCount(10).Run(); } } } <|start_filename|>Projects/Java_bin/src/main/gen/cfg/test/DefineFromExcelOne.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.test; import bright.serialization.*; public final class DefineFromExcelOne { public DefineFromExcelOne(ByteBuf _buf) { unlockEquip = _buf.readInt(); unlockHero = _buf.readInt(); defaultAvatar = _buf.readString(); defaultItem = _buf.readString(); } public DefineFromExcelOne(int unlock_equip, int unlock_hero, String default_avatar, String default_item ) { this.unlockEquip = unlock_equip; this.unlockHero = unlock_hero; this.defaultAvatar = default_avatar; this.defaultItem = default_item; } /** * 装备解锁等级 */ public final int unlockEquip; /** * 英雄解锁等级 */ public final int unlockHero; public final String defaultAvatar; public final String defaultItem; public void resolve(java.util.HashMap<String, Object> _tables) { } @Override public String toString() { return "{ " + "unlockEquip:" + unlockEquip + "," + "unlockHero:" + unlockHero + "," + "defaultAvatar:" + defaultAvatar + "," + "defaultItem:" + defaultItem + "," + "}"; } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_ParticleSystem_ForceOverLifetimeModule_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_ParticleSystem_ForceOverLifetimeModule_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.ParticleSystem.ForceOverLifetimeModule constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_enabled(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ForceOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.enabled; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_enabled(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ForceOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.enabled = argHelper.GetBoolean(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_x(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ForceOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.x; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_x(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ForceOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.x = argHelper.Get<UnityEngine.ParticleSystem.MinMaxCurve>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_y(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ForceOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.y; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_y(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ForceOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.y = argHelper.Get<UnityEngine.ParticleSystem.MinMaxCurve>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_z(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ForceOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.z; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_z(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ForceOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.z = argHelper.Get<UnityEngine.ParticleSystem.MinMaxCurve>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_xMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ForceOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.xMultiplier; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_xMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ForceOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.xMultiplier = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_yMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ForceOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.yMultiplier; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_yMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ForceOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.yMultiplier = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_zMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ForceOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.zMultiplier; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_zMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ForceOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.zMultiplier = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_space(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ForceOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.space; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_space(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ForceOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.space = (UnityEngine.ParticleSystemSimulationSpace)argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_randomized(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ForceOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.randomized; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_randomized(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ForceOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.randomized = argHelper.GetBoolean(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"enabled", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_enabled, Setter = S_enabled} }, {"x", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_x, Setter = S_x} }, {"y", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_y, Setter = S_y} }, {"z", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_z, Setter = S_z} }, {"xMultiplier", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_xMultiplier, Setter = S_xMultiplier} }, {"yMultiplier", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_yMultiplier, Setter = S_yMultiplier} }, {"zMultiplier", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_zMultiplier, Setter = S_zMultiplier} }, {"space", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_space, Setter = S_space} }, {"randomized", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_randomized, Setter = S_randomized} }, } }; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_AndroidJavaObject_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_AndroidJavaObject_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(string[]), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<string[]>(false); var result = new UnityEngine.AndroidJavaObject(Arg0,Arg1); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.AndroidJavaObject), result); } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.AndroidJavaObject[]), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<UnityEngine.AndroidJavaObject[]>(false); var result = new UnityEngine.AndroidJavaObject(Arg0,Arg1); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.AndroidJavaObject), result); } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.AndroidJavaClass[]), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<UnityEngine.AndroidJavaClass[]>(false); var result = new UnityEngine.AndroidJavaObject(Arg0,Arg1); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.AndroidJavaObject), result); } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.AndroidJavaProxy[]), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<UnityEngine.AndroidJavaProxy[]>(false); var result = new UnityEngine.AndroidJavaObject(Arg0,Arg1); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.AndroidJavaObject), result); } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.AndroidJavaRunnable[]), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<UnityEngine.AndroidJavaRunnable[]>(false); var result = new UnityEngine.AndroidJavaObject(Arg0,Arg1); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.AndroidJavaObject), result); } } if (paramLen >= 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Object), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.GetParams<System.Object>(info, 1, paramLen); var result = new UnityEngine.AndroidJavaObject(Arg0,Arg1); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.AndroidJavaObject), result); } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.AndroidJavaObject constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Dispose(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AndroidJavaObject; { { obj.Dispose(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Call(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AndroidJavaObject; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.GetParams<System.Object>(info, 1, paramLen); obj.Call(Arg0,Arg1); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_CallStatic(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AndroidJavaObject; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.GetParams<System.Object>(info, 1, paramLen); obj.CallStatic(Arg0,Arg1); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetRawObject(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AndroidJavaObject; { { var result = obj.GetRawObject(); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetRawClass(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AndroidJavaObject; { { var result = obj.GetRawClass(); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "Dispose", IsStatic = false}, M_Dispose }, { new Puerts.MethodKey {Name = "Call", IsStatic = false}, M_Call }, { new Puerts.MethodKey {Name = "CallStatic", IsStatic = false}, M_CallStatic }, { new Puerts.MethodKey {Name = "GetRawObject", IsStatic = false}, M_GetRawObject }, { new Puerts.MethodKey {Name = "GetRawClass", IsStatic = false}, M_GetRawClass }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { } }; } } } <|start_filename|>Projects/Csharp_Unity_bin_ExternalTypes/Assets/Gen/test/AccessFlag.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ namespace cfg.test { [System.Flags] public enum AccessFlag { WRITE = 1, READ = 2, TRUNCATE = 4, NEW = 8, READ_WRITE = WRITE|READ, } } <|start_filename|>Projects/GenerateDatas/convert_lua/error.TbCodeInfo/400.lua<|end_filename|> return { code = 400, key = "SKILL_NOT_IN_LIST", } <|start_filename|>Projects/GenerateDatas/convert_lua/error.TbCodeInfo/700.lua<|end_filename|> return { code = 700, key = "MAIL_TYPE_ERROR", } <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/limit/LimitBase.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.limit { public abstract partial class LimitBase : Bright.Config.BeanBase { public LimitBase(ByteBuf _buf) { } public LimitBase() { } public static LimitBase DeserializeLimitBase(ByteBuf _buf) { switch (_buf.ReadInt()) { case limit.DailyLimit.ID: return new limit.DailyLimit(_buf); case limit.MultiDayLimit.ID: return new limit.MultiDayLimit(_buf); case limit.WeeklyLimit.ID: return new limit.WeeklyLimit(_buf); case limit.MonthlyLimit.ID: return new limit.MonthlyLimit(_buf); case limit.CoolDown.ID: return new limit.CoolDown(_buf); case limit.GroupCoolDown.ID: return new limit.GroupCoolDown(_buf); default: throw new SerializationException(); } } public virtual void Resolve(Dictionary<string, object> _tables) { OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); public override string ToString() { return "{ " + "}"; } } } <|start_filename|>Projects/Csharp_CustomTemplate_EncryptMemory/Assets/Scripts/ConfigManager.cs<|end_filename|> using System; using System.Collections.Generic; using Cysharp.Threading.Tasks; using UnityEngine; namespace Scripts { public class ConfigManager { public static ConfigManager Instance => _instance ??= new ConfigManager(); private static ConfigManager _instance; private readonly Dictionary<Type, ACategory> _all_configs = new(); /// <summary> /// 异步加载所有用 Config 标记的配置表 /// </summary> public async UniTask Load() { var tasks = new List<UniTask>(); try { _all_configs.Clear(); List<ACategory> for_load = new List<ACategory>(); var types = GetType().Assembly.GetTypes(); foreach(Type type in types) { object[] attrs = type.GetCustomAttributes(typeof(ConfigAttribute), true); if(attrs.Length == 0) { continue; } object obj = Activator.CreateInstance(type); if(obj is not ACategory icategory) { Debug.LogError($"[ConfigComponent] {type.Name} not inherit form ACategory"); continue; } for_load.Add(icategory); } foreach(ACategory category in for_load) { tasks.Add(category.BeginInit()); } await UniTask.WhenAll(tasks); foreach(ACategory category in for_load) { category.InternalEndInit(); category.EndInit(); _all_configs[category.GetConfigType] = category; } } catch(Exception e) { Debug.LogError(e); } } public AConfig GetOne(Type type) { _all_configs.TryGetValue(type, out var category); if(category is null) { Debug.LogError($"[ConfigComponent] not found key: {type.FullName}"); return null; } return category.GetOne(); } public T GetOne<T>() where T : AConfig { return(T) GetOne(typeof(T)); } public AConfig Get(Type type, int id) { _all_configs.TryGetValue(type, out var category); if(category is null) { Debug.LogError($"[ConfigComponent] not found key: {type.FullName}"); return null; } return category.TryGet(id); } public T Get<T>(int id) where T : AConfig { return(T) Get(typeof(T), id); } public AConfig[] GetAll(Type type) { _all_configs.TryGetValue(type, out var category); if(category is null) { Debug.LogError($"[ConfigComponent] not found key: {type.FullName}"); return null; } return category.GetAll(); } public AConfig[] GetAll<T>() where T : AConfig { return GetAll(typeof(T)); } public ACategory GetCategory(Type type) { _all_configs.TryGetValue(type, out var category); return category; } public ACategory GetCategory<T>() where T : AConfig { return GetCategory(typeof(T)); } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_Keyframe_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_Keyframe_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.GetFloat(false); var result = new UnityEngine.Keyframe(Arg0,Arg1); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.Keyframe), result); } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.GetFloat(false); var result = new UnityEngine.Keyframe(Arg0,Arg1,Arg2,Arg3); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.Keyframe), result); } } if (paramLen == 6) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.GetFloat(false); var Arg5 = argHelper5.GetFloat(false); var result = new UnityEngine.Keyframe(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.Keyframe), result); } } if (paramLen == 0) { { var result = new UnityEngine.Keyframe(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.Keyframe), result); } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.Keyframe constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_time(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Keyframe)Puerts.Utils.GetSelf((int)data, self); var result = obj.time; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_time(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Keyframe)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.time = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_value(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Keyframe)Puerts.Utils.GetSelf((int)data, self); var result = obj.value; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_value(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Keyframe)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.value = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_inTangent(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Keyframe)Puerts.Utils.GetSelf((int)data, self); var result = obj.inTangent; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_inTangent(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Keyframe)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.inTangent = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_outTangent(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Keyframe)Puerts.Utils.GetSelf((int)data, self); var result = obj.outTangent; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_outTangent(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Keyframe)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.outTangent = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_inWeight(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Keyframe)Puerts.Utils.GetSelf((int)data, self); var result = obj.inWeight; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_inWeight(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Keyframe)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.inWeight = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_outWeight(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Keyframe)Puerts.Utils.GetSelf((int)data, self); var result = obj.outWeight; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_outWeight(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Keyframe)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.outWeight = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_weightedMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Keyframe)Puerts.Utils.GetSelf((int)data, self); var result = obj.weightedMode; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_weightedMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Keyframe)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.weightedMode = (UnityEngine.WeightedMode)argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"time", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_time, Setter = S_time} }, {"value", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_value, Setter = S_value} }, {"inTangent", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_inTangent, Setter = S_inTangent} }, {"outTangent", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_outTangent, Setter = S_outTangent} }, {"inWeight", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_inWeight, Setter = S_inWeight} }, {"outWeight", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_outWeight, Setter = S_outWeight} }, {"weightedMode", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_weightedMode, Setter = S_weightedMode} }, } }; } } } <|start_filename|>Projects/GenerateDatas/convert_lua/error.TbCodeInfo/200.lua<|end_filename|> return { code = 200, key = "PARAM_ILLEGAL", } <|start_filename|>Projects/Java_bin/src/main/gen/cfg/bonus/DropInfo.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.bonus; import bright.serialization.*; public final class DropInfo { public DropInfo(ByteBuf _buf) { id = _buf.readInt(); desc = _buf.readString(); {int n = Math.min(_buf.readSize(), _buf.size());clientShowItems = new java.util.ArrayList<cfg.bonus.ShowItemInfo>(n);for(int i = 0 ; i < n ; i++) { cfg.bonus.ShowItemInfo _e; _e = new cfg.bonus.ShowItemInfo(_buf); clientShowItems.add(_e);}} bonus = cfg.bonus.Bonus.deserializeBonus(_buf); } public DropInfo(int id, String desc, java.util.ArrayList<cfg.bonus.ShowItemInfo> client_show_items, cfg.bonus.Bonus bonus ) { this.id = id; this.desc = desc; this.clientShowItems = client_show_items; this.bonus = bonus; } public final int id; public final String desc; public final java.util.ArrayList<cfg.bonus.ShowItemInfo> clientShowItems; public final cfg.bonus.Bonus bonus; public void resolve(java.util.HashMap<String, Object> _tables) { for(cfg.bonus.ShowItemInfo _e : clientShowItems) { if (_e != null) _e.resolve(_tables); } if (bonus != null) {bonus.resolve(_tables);} } @Override public String toString() { return "{ " + "id:" + id + "," + "desc:" + desc + "," + "clientShowItems:" + clientShowItems + "," + "bonus:" + bonus + "," + "}"; } } <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/test/DemoSingletonType.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.test { public sealed partial class DemoSingletonType : Bright.Config.BeanBase { public DemoSingletonType(ByteBuf _buf) { Id = _buf.ReadInt(); Name = _buf.ReadString(); Date = test.DemoDynamic.DeserializeDemoDynamic(_buf); } public DemoSingletonType(int id, string name, test.DemoDynamic date ) { this.Id = id; this.Name = name; this.Date = date; } public static DemoSingletonType DeserializeDemoSingletonType(ByteBuf _buf) { return new test.DemoSingletonType(_buf); } public readonly int Id; public readonly string Name; public readonly test.DemoDynamic Date; public const int ID = 539196998; public override int GetTypeId() => ID; public void Resolve(Dictionary<string, object> _tables) { Date?.Resolve(_tables); OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); public override string ToString() { return "{ " + "Id:" + Id + "," + "Name:" + Name + "," + "Date:" + Date + "," + "}"; } } } <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/error/ErrorStyleDlgOkCancel.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.error { public sealed partial class ErrorStyleDlgOkCancel : error.ErrorStyle { public ErrorStyleDlgOkCancel(ByteBuf _buf) : base(_buf) { Btn1Name = _buf.ReadString(); Btn2Name = _buf.ReadString(); } public ErrorStyleDlgOkCancel(string btn1_name, string btn2_name ) : base() { this.Btn1Name = btn1_name; this.Btn2Name = btn2_name; } public static ErrorStyleDlgOkCancel DeserializeErrorStyleDlgOkCancel(ByteBuf _buf) { return new error.ErrorStyleDlgOkCancel(_buf); } public readonly string Btn1Name; public readonly string Btn2Name; public const int ID = 971221414; public override int GetTypeId() => ID; public override void Resolve(Dictionary<string, object> _tables) { base.Resolve(_tables); OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); public override string ToString() { return "{ " + "Btn1Name:" + Btn1Name + "," + "Btn2Name:" + Btn2Name + "," + "}"; } } } <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/bonus/ProbabilityItems.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.bonus { public sealed partial class ProbabilityItems : bonus.Bonus { public ProbabilityItems(ByteBuf _buf) : base(_buf) { {int n = System.Math.Min(_buf.ReadSize(), _buf.Size);ItemList = new bonus.ProbabilityItemInfo[n];for(var i = 0 ; i < n ; i++) { bonus.ProbabilityItemInfo _e;_e = bonus.ProbabilityItemInfo.DeserializeProbabilityItemInfo(_buf); ItemList[i] = _e;}} } public ProbabilityItems(bonus.ProbabilityItemInfo[] item_list ) : base() { this.ItemList = item_list; } public static ProbabilityItems DeserializeProbabilityItems(ByteBuf _buf) { return new bonus.ProbabilityItems(_buf); } public readonly bonus.ProbabilityItemInfo[] ItemList; public const int ID = 366387866; public override int GetTypeId() => ID; public override void Resolve(Dictionary<string, object> _tables) { base.Resolve(_tables); foreach(var _e in ItemList) { _e?.Resolve(_tables); } OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); public override string ToString() { return "{ " + "ItemList:" + Bright.Common.StringUtil.CollectionToString(ItemList) + "," + "}"; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_GUI_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_GUI_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.GUI(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.GUI), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_SetNextControlName(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetString(false); UnityEngine.GUI.SetNextControlName(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetNameOfFocusedControl(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { { var result = UnityEngine.GUI.GetNameOfFocusedControl(); Puerts.PuertsDLL.ReturnString(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_FocusControl(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetString(false); UnityEngine.GUI.FocusControl(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_DragWindow(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); UnityEngine.GUI.DragWindow(Arg0); return; } } if (paramLen == 0) { { UnityEngine.GUI.DragWindow(); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to DragWindow"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_BringWindowToFront(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); UnityEngine.GUI.BringWindowToFront(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_BringWindowToBack(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); UnityEngine.GUI.BringWindowToBack(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_FocusWindow(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); UnityEngine.GUI.FocusWindow(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_UnfocusWindow(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { { UnityEngine.GUI.UnfocusWindow(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_Label(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.GetString(false); UnityEngine.GUI.Label(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.Get<UnityEngine.Texture>(false); UnityEngine.GUI.Label(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIContent), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.Get<UnityEngine.GUIContent>(false); UnityEngine.GUI.Label(Arg0,Arg1); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.GetString(false); var Arg2 = argHelper2.Get<UnityEngine.GUIStyle>(false); UnityEngine.GUI.Label(Arg0,Arg1,Arg2); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.Get<UnityEngine.Texture>(false); var Arg2 = argHelper2.Get<UnityEngine.GUIStyle>(false); UnityEngine.GUI.Label(Arg0,Arg1,Arg2); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIContent), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.Get<UnityEngine.GUIContent>(false); var Arg2 = argHelper2.Get<UnityEngine.GUIStyle>(false); UnityEngine.GUI.Label(Arg0,Arg1,Arg2); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to Label"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_DrawTexture(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.Get<UnityEngine.Texture>(false); UnityEngine.GUI.DrawTexture(Arg0,Arg1); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.Get<UnityEngine.Texture>(false); var Arg2 = (UnityEngine.ScaleMode)argHelper2.GetInt32(false); UnityEngine.GUI.DrawTexture(Arg0,Arg1,Arg2); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.Get<UnityEngine.Texture>(false); var Arg2 = (UnityEngine.ScaleMode)argHelper2.GetInt32(false); var Arg3 = argHelper3.GetBoolean(false); UnityEngine.GUI.DrawTexture(Arg0,Arg1,Arg2,Arg3); return; } } if (paramLen == 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.Get<UnityEngine.Texture>(false); var Arg2 = (UnityEngine.ScaleMode)argHelper2.GetInt32(false); var Arg3 = argHelper3.GetBoolean(false); var Arg4 = argHelper4.GetFloat(false); UnityEngine.GUI.DrawTexture(Arg0,Arg1,Arg2,Arg3,Arg4); return; } } if (paramLen == 8) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); var argHelper7 = new Puerts.ArgumentHelper((int)data, isolate, info, 7); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Color), false, false) && argHelper6.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper7.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.Get<UnityEngine.Texture>(false); var Arg2 = (UnityEngine.ScaleMode)argHelper2.GetInt32(false); var Arg3 = argHelper3.GetBoolean(false); var Arg4 = argHelper4.GetFloat(false); var Arg5 = argHelper5.Get<UnityEngine.Color>(false); var Arg6 = argHelper6.GetFloat(false); var Arg7 = argHelper7.GetFloat(false); UnityEngine.GUI.DrawTexture(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Color), false, false) && argHelper6.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector4), false, false) && argHelper7.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.Get<UnityEngine.Texture>(false); var Arg2 = (UnityEngine.ScaleMode)argHelper2.GetInt32(false); var Arg3 = argHelper3.GetBoolean(false); var Arg4 = argHelper4.GetFloat(false); var Arg5 = argHelper5.Get<UnityEngine.Color>(false); var Arg6 = argHelper6.Get<UnityEngine.Vector4>(false); var Arg7 = argHelper7.GetFloat(false); UnityEngine.GUI.DrawTexture(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Color), false, false) && argHelper6.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector4), false, false) && argHelper7.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector4), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.Get<UnityEngine.Texture>(false); var Arg2 = (UnityEngine.ScaleMode)argHelper2.GetInt32(false); var Arg3 = argHelper3.GetBoolean(false); var Arg4 = argHelper4.GetFloat(false); var Arg5 = argHelper5.Get<UnityEngine.Color>(false); var Arg6 = argHelper6.Get<UnityEngine.Vector4>(false); var Arg7 = argHelper7.Get<UnityEngine.Vector4>(false); UnityEngine.GUI.DrawTexture(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to DrawTexture"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_DrawTextureWithTexCoords(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.Get<UnityEngine.Texture>(false); var Arg2 = argHelper2.Get<UnityEngine.Rect>(false); UnityEngine.GUI.DrawTextureWithTexCoords(Arg0,Arg1,Arg2); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.Get<UnityEngine.Texture>(false); var Arg2 = argHelper2.Get<UnityEngine.Rect>(false); var Arg3 = argHelper3.GetBoolean(false); UnityEngine.GUI.DrawTextureWithTexCoords(Arg0,Arg1,Arg2,Arg3); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to DrawTextureWithTexCoords"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_Box(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.GetString(false); UnityEngine.GUI.Box(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.Get<UnityEngine.Texture>(false); UnityEngine.GUI.Box(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIContent), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.Get<UnityEngine.GUIContent>(false); UnityEngine.GUI.Box(Arg0,Arg1); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.GetString(false); var Arg2 = argHelper2.Get<UnityEngine.GUIStyle>(false); UnityEngine.GUI.Box(Arg0,Arg1,Arg2); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.Get<UnityEngine.Texture>(false); var Arg2 = argHelper2.Get<UnityEngine.GUIStyle>(false); UnityEngine.GUI.Box(Arg0,Arg1,Arg2); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIContent), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.Get<UnityEngine.GUIContent>(false); var Arg2 = argHelper2.Get<UnityEngine.GUIStyle>(false); UnityEngine.GUI.Box(Arg0,Arg1,Arg2); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to Box"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_Button(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.GetString(false); var result = UnityEngine.GUI.Button(Arg0,Arg1); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.Get<UnityEngine.Texture>(false); var result = UnityEngine.GUI.Button(Arg0,Arg1); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIContent), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.Get<UnityEngine.GUIContent>(false); var result = UnityEngine.GUI.Button(Arg0,Arg1); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.GetString(false); var Arg2 = argHelper2.Get<UnityEngine.GUIStyle>(false); var result = UnityEngine.GUI.Button(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.Get<UnityEngine.Texture>(false); var Arg2 = argHelper2.Get<UnityEngine.GUIStyle>(false); var result = UnityEngine.GUI.Button(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIContent), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.Get<UnityEngine.GUIContent>(false); var Arg2 = argHelper2.Get<UnityEngine.GUIStyle>(false); var result = UnityEngine.GUI.Button(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to Button"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_RepeatButton(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.GetString(false); var result = UnityEngine.GUI.RepeatButton(Arg0,Arg1); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.Get<UnityEngine.Texture>(false); var result = UnityEngine.GUI.RepeatButton(Arg0,Arg1); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIContent), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.Get<UnityEngine.GUIContent>(false); var result = UnityEngine.GUI.RepeatButton(Arg0,Arg1); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.GetString(false); var Arg2 = argHelper2.Get<UnityEngine.GUIStyle>(false); var result = UnityEngine.GUI.RepeatButton(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.Get<UnityEngine.Texture>(false); var Arg2 = argHelper2.Get<UnityEngine.GUIStyle>(false); var result = UnityEngine.GUI.RepeatButton(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIContent), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.Get<UnityEngine.GUIContent>(false); var Arg2 = argHelper2.Get<UnityEngine.GUIStyle>(false); var result = UnityEngine.GUI.RepeatButton(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to RepeatButton"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_TextField(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.GetString(false); var result = UnityEngine.GUI.TextField(Arg0,Arg1); Puerts.PuertsDLL.ReturnString(isolate, info, result); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.GetString(false); var Arg2 = argHelper2.GetInt32(false); var result = UnityEngine.GUI.TextField(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnString(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.GetString(false); var Arg2 = argHelper2.Get<UnityEngine.GUIStyle>(false); var result = UnityEngine.GUI.TextField(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnString(isolate, info, result); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.GetString(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.Get<UnityEngine.GUIStyle>(false); var result = UnityEngine.GUI.TextField(Arg0,Arg1,Arg2,Arg3); Puerts.PuertsDLL.ReturnString(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to TextField"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_PasswordField(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.GetString(false); var Arg2 = argHelper2.Get<System.Char>(false); var result = UnityEngine.GUI.PasswordField(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnString(isolate, info, result); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.GetString(false); var Arg2 = argHelper2.Get<System.Char>(false); var Arg3 = argHelper3.GetInt32(false); var result = UnityEngine.GUI.PasswordField(Arg0,Arg1,Arg2,Arg3); Puerts.PuertsDLL.ReturnString(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.GetString(false); var Arg2 = argHelper2.Get<System.Char>(false); var Arg3 = argHelper3.Get<UnityEngine.GUIStyle>(false); var result = UnityEngine.GUI.PasswordField(Arg0,Arg1,Arg2,Arg3); Puerts.PuertsDLL.ReturnString(isolate, info, result); return; } } if (paramLen == 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.GetString(false); var Arg2 = argHelper2.Get<System.Char>(false); var Arg3 = argHelper3.GetInt32(false); var Arg4 = argHelper4.Get<UnityEngine.GUIStyle>(false); var result = UnityEngine.GUI.PasswordField(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.PuertsDLL.ReturnString(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to PasswordField"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_TextArea(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.GetString(false); var result = UnityEngine.GUI.TextArea(Arg0,Arg1); Puerts.PuertsDLL.ReturnString(isolate, info, result); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.GetString(false); var Arg2 = argHelper2.GetInt32(false); var result = UnityEngine.GUI.TextArea(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnString(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.GetString(false); var Arg2 = argHelper2.Get<UnityEngine.GUIStyle>(false); var result = UnityEngine.GUI.TextArea(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnString(isolate, info, result); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.GetString(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.Get<UnityEngine.GUIStyle>(false); var result = UnityEngine.GUI.TextArea(Arg0,Arg1,Arg2,Arg3); Puerts.PuertsDLL.ReturnString(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to TextArea"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_Toggle(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.GetBoolean(false); var Arg2 = argHelper2.GetString(false); var result = UnityEngine.GUI.Toggle(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.GetBoolean(false); var Arg2 = argHelper2.Get<UnityEngine.Texture>(false); var result = UnityEngine.GUI.Toggle(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIContent), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.GetBoolean(false); var Arg2 = argHelper2.Get<UnityEngine.GUIContent>(false); var result = UnityEngine.GUI.Toggle(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.GetBoolean(false); var Arg2 = argHelper2.GetString(false); var Arg3 = argHelper3.Get<UnityEngine.GUIStyle>(false); var result = UnityEngine.GUI.Toggle(Arg0,Arg1,Arg2,Arg3); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.GetBoolean(false); var Arg2 = argHelper2.Get<UnityEngine.Texture>(false); var Arg3 = argHelper3.Get<UnityEngine.GUIStyle>(false); var result = UnityEngine.GUI.Toggle(Arg0,Arg1,Arg2,Arg3); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIContent), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.GetBoolean(false); var Arg2 = argHelper2.Get<UnityEngine.GUIContent>(false); var Arg3 = argHelper3.Get<UnityEngine.GUIStyle>(false); var result = UnityEngine.GUI.Toggle(Arg0,Arg1,Arg2,Arg3); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } } if (paramLen == 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIContent), false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetBoolean(false); var Arg3 = argHelper3.Get<UnityEngine.GUIContent>(false); var Arg4 = argHelper4.Get<UnityEngine.GUIStyle>(false); var result = UnityEngine.GUI.Toggle(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to Toggle"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_Toolbar(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(string[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.Get<string[]>(false); var result = UnityEngine.GUI.Toolbar(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.Get<UnityEngine.Texture[]>(false); var result = UnityEngine.GUI.Toolbar(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIContent[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.Get<UnityEngine.GUIContent[]>(false); var result = UnityEngine.GUI.Toolbar(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(string[]), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.Get<string[]>(false); var Arg3 = argHelper3.Get<UnityEngine.GUIStyle>(false); var result = UnityEngine.GUI.Toolbar(Arg0,Arg1,Arg2,Arg3); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture[]), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.Get<UnityEngine.Texture[]>(false); var Arg3 = argHelper3.Get<UnityEngine.GUIStyle>(false); var result = UnityEngine.GUI.Toolbar(Arg0,Arg1,Arg2,Arg3); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIContent[]), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.Get<UnityEngine.GUIContent[]>(false); var Arg3 = argHelper3.Get<UnityEngine.GUIStyle>(false); var result = UnityEngine.GUI.Toolbar(Arg0,Arg1,Arg2,Arg3); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIContent[]), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.Get<UnityEngine.GUIContent[]>(false); var Arg3 = argHelper3.Get<UnityEngine.GUIStyle>(false); var Arg4 = (UnityEngine.GUI.ToolbarButtonSize)argHelper4.GetInt32(false); var result = UnityEngine.GUI.Toolbar(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to Toolbar"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_SelectionGrid(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(string[]), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.Get<string[]>(false); var Arg3 = argHelper3.GetInt32(false); var result = UnityEngine.GUI.SelectionGrid(Arg0,Arg1,Arg2,Arg3); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture[]), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.Get<UnityEngine.Texture[]>(false); var Arg3 = argHelper3.GetInt32(false); var result = UnityEngine.GUI.SelectionGrid(Arg0,Arg1,Arg2,Arg3); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIContent[]), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.Get<UnityEngine.GUIContent[]>(false); var Arg3 = argHelper3.GetInt32(false); var result = UnityEngine.GUI.SelectionGrid(Arg0,Arg1,Arg2,Arg3); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(string[]), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.Get<string[]>(false); var Arg3 = argHelper3.GetInt32(false); var Arg4 = argHelper4.Get<UnityEngine.GUIStyle>(false); var result = UnityEngine.GUI.SelectionGrid(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture[]), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.Get<UnityEngine.Texture[]>(false); var Arg3 = argHelper3.GetInt32(false); var Arg4 = argHelper4.Get<UnityEngine.GUIStyle>(false); var result = UnityEngine.GUI.SelectionGrid(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIContent[]), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.Get<UnityEngine.GUIContent[]>(false); var Arg3 = argHelper3.GetInt32(false); var Arg4 = argHelper4.Get<UnityEngine.GUIStyle>(false); var result = UnityEngine.GUI.SelectionGrid(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SelectionGrid"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_HorizontalSlider(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.GetFloat(false); var result = UnityEngine.GUI.HorizontalSlider(Arg0,Arg1,Arg2,Arg3); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 6) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false) && argHelper5.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.Get<UnityEngine.GUIStyle>(false); var Arg5 = argHelper5.Get<UnityEngine.GUIStyle>(false); var result = UnityEngine.GUI.HorizontalSlider(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 7) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false) && argHelper5.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false) && argHelper6.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.Get<UnityEngine.GUIStyle>(false); var Arg5 = argHelper5.Get<UnityEngine.GUIStyle>(false); var Arg6 = argHelper6.Get<UnityEngine.GUIStyle>(false); var result = UnityEngine.GUI.HorizontalSlider(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to HorizontalSlider"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_VerticalSlider(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.GetFloat(false); var result = UnityEngine.GUI.VerticalSlider(Arg0,Arg1,Arg2,Arg3); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 6) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false) && argHelper5.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.Get<UnityEngine.GUIStyle>(false); var Arg5 = argHelper5.Get<UnityEngine.GUIStyle>(false); var result = UnityEngine.GUI.VerticalSlider(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 7) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false) && argHelper5.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false) && argHelper6.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.Get<UnityEngine.GUIStyle>(false); var Arg5 = argHelper5.Get<UnityEngine.GUIStyle>(false); var Arg6 = argHelper6.Get<UnityEngine.GUIStyle>(false); var result = UnityEngine.GUI.VerticalSlider(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to VerticalSlider"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_Slider(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 10) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); var argHelper7 = new Puerts.ArgumentHelper((int)data, isolate, info, 7); var argHelper8 = new Puerts.ArgumentHelper((int)data, isolate, info, 8); var argHelper9 = new Puerts.ArgumentHelper((int)data, isolate, info, 9); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false) && argHelper6.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false) && argHelper7.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper8.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper9.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.GetFloat(false); var Arg5 = argHelper5.Get<UnityEngine.GUIStyle>(false); var Arg6 = argHelper6.Get<UnityEngine.GUIStyle>(false); var Arg7 = argHelper7.GetBoolean(false); var Arg8 = argHelper8.GetInt32(false); var Arg9 = argHelper9.Get<UnityEngine.GUIStyle>(false); var result = UnityEngine.GUI.Slider(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7,Arg8,Arg9); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 9) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); var argHelper7 = new Puerts.ArgumentHelper((int)data, isolate, info, 7); var argHelper8 = new Puerts.ArgumentHelper((int)data, isolate, info, 8); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false) && argHelper6.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false) && argHelper7.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper8.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.GetFloat(false); var Arg5 = argHelper5.Get<UnityEngine.GUIStyle>(false); var Arg6 = argHelper6.Get<UnityEngine.GUIStyle>(false); var Arg7 = argHelper7.GetBoolean(false); var Arg8 = argHelper8.GetInt32(false); var result = UnityEngine.GUI.Slider(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7,Arg8); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to Slider"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_HorizontalScrollbar(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.GetFloat(false); var result = UnityEngine.GUI.HorizontalScrollbar(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 6) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.GetFloat(false); var Arg5 = argHelper5.Get<UnityEngine.GUIStyle>(false); var result = UnityEngine.GUI.HorizontalScrollbar(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to HorizontalScrollbar"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_VerticalScrollbar(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.GetFloat(false); var result = UnityEngine.GUI.VerticalScrollbar(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 6) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.GetFloat(false); var Arg5 = argHelper5.Get<UnityEngine.GUIStyle>(false); var result = UnityEngine.GUI.VerticalScrollbar(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to VerticalScrollbar"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_BeginClip(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.Get<UnityEngine.Vector2>(false); var Arg3 = argHelper3.GetBoolean(false); UnityEngine.GUI.BeginClip(Arg0,Arg1,Arg2,Arg3); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); UnityEngine.GUI.BeginClip(Arg0); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to BeginClip"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_BeginGroup(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); UnityEngine.GUI.BeginGroup(Arg0); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.GetString(false); UnityEngine.GUI.BeginGroup(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.Get<UnityEngine.Texture>(false); UnityEngine.GUI.BeginGroup(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIContent), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.Get<UnityEngine.GUIContent>(false); UnityEngine.GUI.BeginGroup(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.Get<UnityEngine.GUIStyle>(false); UnityEngine.GUI.BeginGroup(Arg0,Arg1); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.GetString(false); var Arg2 = argHelper2.Get<UnityEngine.GUIStyle>(false); UnityEngine.GUI.BeginGroup(Arg0,Arg1,Arg2); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.Get<UnityEngine.Texture>(false); var Arg2 = argHelper2.Get<UnityEngine.GUIStyle>(false); UnityEngine.GUI.BeginGroup(Arg0,Arg1,Arg2); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIContent), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.Get<UnityEngine.GUIContent>(false); var Arg2 = argHelper2.Get<UnityEngine.GUIStyle>(false); UnityEngine.GUI.BeginGroup(Arg0,Arg1,Arg2); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to BeginGroup"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_EndGroup(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { { UnityEngine.GUI.EndGroup(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_EndClip(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { { UnityEngine.GUI.EndClip(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_BeginScrollView(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.Get<UnityEngine.Rect>(false); var result = UnityEngine.GUI.BeginScrollView(Arg0,Arg1,Arg2); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.Get<UnityEngine.Rect>(false); var Arg3 = argHelper3.GetBoolean(false); var Arg4 = argHelper4.GetBoolean(false); var result = UnityEngine.GUI.BeginScrollView(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.Get<UnityEngine.Rect>(false); var Arg3 = argHelper3.Get<UnityEngine.GUIStyle>(false); var Arg4 = argHelper4.Get<UnityEngine.GUIStyle>(false); var result = UnityEngine.GUI.BeginScrollView(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 7) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false) && argHelper6.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.Get<UnityEngine.Rect>(false); var Arg3 = argHelper3.GetBoolean(false); var Arg4 = argHelper4.GetBoolean(false); var Arg5 = argHelper5.Get<UnityEngine.GUIStyle>(false); var Arg6 = argHelper6.Get<UnityEngine.GUIStyle>(false); var result = UnityEngine.GUI.BeginScrollView(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to BeginScrollView"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_EndScrollView(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 0) { { UnityEngine.GUI.EndScrollView(); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.GetBoolean(false); UnityEngine.GUI.EndScrollView(Arg0); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to EndScrollView"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_ScrollTo(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); UnityEngine.GUI.ScrollTo(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_ScrollTowards(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.GetFloat(false); var result = UnityEngine.GUI.ScrollTowards(Arg0,Arg1); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_Window(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject | Puerts.JsValueType.Function, typeof(UnityEngine.GUI.WindowFunction), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.Rect>(false); var Arg2 = argHelper2.Get<UnityEngine.GUI.WindowFunction>(false); var Arg3 = argHelper3.GetString(false); var result = UnityEngine.GUI.Window(Arg0,Arg1,Arg2,Arg3); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject | Puerts.JsValueType.Function, typeof(UnityEngine.GUI.WindowFunction), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.Rect>(false); var Arg2 = argHelper2.Get<UnityEngine.GUI.WindowFunction>(false); var Arg3 = argHelper3.Get<UnityEngine.Texture>(false); var result = UnityEngine.GUI.Window(Arg0,Arg1,Arg2,Arg3); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject | Puerts.JsValueType.Function, typeof(UnityEngine.GUI.WindowFunction), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIContent), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.Rect>(false); var Arg2 = argHelper2.Get<UnityEngine.GUI.WindowFunction>(false); var Arg3 = argHelper3.Get<UnityEngine.GUIContent>(false); var result = UnityEngine.GUI.Window(Arg0,Arg1,Arg2,Arg3); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject | Puerts.JsValueType.Function, typeof(UnityEngine.GUI.WindowFunction), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.Rect>(false); var Arg2 = argHelper2.Get<UnityEngine.GUI.WindowFunction>(false); var Arg3 = argHelper3.GetString(false); var Arg4 = argHelper4.Get<UnityEngine.GUIStyle>(false); var result = UnityEngine.GUI.Window(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject | Puerts.JsValueType.Function, typeof(UnityEngine.GUI.WindowFunction), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture), false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.Rect>(false); var Arg2 = argHelper2.Get<UnityEngine.GUI.WindowFunction>(false); var Arg3 = argHelper3.Get<UnityEngine.Texture>(false); var Arg4 = argHelper4.Get<UnityEngine.GUIStyle>(false); var result = UnityEngine.GUI.Window(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject | Puerts.JsValueType.Function, typeof(UnityEngine.GUI.WindowFunction), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIContent), false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.Rect>(false); var Arg2 = argHelper2.Get<UnityEngine.GUI.WindowFunction>(false); var Arg3 = argHelper3.Get<UnityEngine.GUIContent>(false); var Arg4 = argHelper4.Get<UnityEngine.GUIStyle>(false); var result = UnityEngine.GUI.Window(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to Window"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_ModalWindow(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject | Puerts.JsValueType.Function, typeof(UnityEngine.GUI.WindowFunction), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.Rect>(false); var Arg2 = argHelper2.Get<UnityEngine.GUI.WindowFunction>(false); var Arg3 = argHelper3.GetString(false); var result = UnityEngine.GUI.ModalWindow(Arg0,Arg1,Arg2,Arg3); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject | Puerts.JsValueType.Function, typeof(UnityEngine.GUI.WindowFunction), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.Rect>(false); var Arg2 = argHelper2.Get<UnityEngine.GUI.WindowFunction>(false); var Arg3 = argHelper3.Get<UnityEngine.Texture>(false); var result = UnityEngine.GUI.ModalWindow(Arg0,Arg1,Arg2,Arg3); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject | Puerts.JsValueType.Function, typeof(UnityEngine.GUI.WindowFunction), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIContent), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.Rect>(false); var Arg2 = argHelper2.Get<UnityEngine.GUI.WindowFunction>(false); var Arg3 = argHelper3.Get<UnityEngine.GUIContent>(false); var result = UnityEngine.GUI.ModalWindow(Arg0,Arg1,Arg2,Arg3); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject | Puerts.JsValueType.Function, typeof(UnityEngine.GUI.WindowFunction), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.Rect>(false); var Arg2 = argHelper2.Get<UnityEngine.GUI.WindowFunction>(false); var Arg3 = argHelper3.GetString(false); var Arg4 = argHelper4.Get<UnityEngine.GUIStyle>(false); var result = UnityEngine.GUI.ModalWindow(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject | Puerts.JsValueType.Function, typeof(UnityEngine.GUI.WindowFunction), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture), false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.Rect>(false); var Arg2 = argHelper2.Get<UnityEngine.GUI.WindowFunction>(false); var Arg3 = argHelper3.Get<UnityEngine.Texture>(false); var Arg4 = argHelper4.Get<UnityEngine.GUIStyle>(false); var result = UnityEngine.GUI.ModalWindow(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject | Puerts.JsValueType.Function, typeof(UnityEngine.GUI.WindowFunction), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIContent), false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.Rect>(false); var Arg2 = argHelper2.Get<UnityEngine.GUI.WindowFunction>(false); var Arg3 = argHelper3.Get<UnityEngine.GUIContent>(false); var Arg4 = argHelper4.Get<UnityEngine.GUIStyle>(false); var result = UnityEngine.GUI.ModalWindow(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to ModalWindow"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_color(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.GUI.color; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_color(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.GUI.color = argHelper.Get<UnityEngine.Color>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_backgroundColor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.GUI.backgroundColor; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_backgroundColor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.GUI.backgroundColor = argHelper.Get<UnityEngine.Color>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_contentColor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.GUI.contentColor; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_contentColor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.GUI.contentColor = argHelper.Get<UnityEngine.Color>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_changed(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.GUI.changed; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_changed(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.GUI.changed = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_enabled(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.GUI.enabled; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_enabled(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.GUI.enabled = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_depth(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.GUI.depth; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_depth(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.GUI.depth = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_skin(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.GUI.skin; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_skin(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.GUI.skin = argHelper.Get<UnityEngine.GUISkin>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_matrix(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.GUI.matrix; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_matrix(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.GUI.matrix = argHelper.Get<UnityEngine.Matrix4x4>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_tooltip(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.GUI.tooltip; Puerts.PuertsDLL.ReturnString(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_tooltip(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.GUI.tooltip = argHelper.GetString(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "SetNextControlName", IsStatic = true}, F_SetNextControlName }, { new Puerts.MethodKey {Name = "GetNameOfFocusedControl", IsStatic = true}, F_GetNameOfFocusedControl }, { new Puerts.MethodKey {Name = "FocusControl", IsStatic = true}, F_FocusControl }, { new Puerts.MethodKey {Name = "DragWindow", IsStatic = true}, F_DragWindow }, { new Puerts.MethodKey {Name = "BringWindowToFront", IsStatic = true}, F_BringWindowToFront }, { new Puerts.MethodKey {Name = "BringWindowToBack", IsStatic = true}, F_BringWindowToBack }, { new Puerts.MethodKey {Name = "FocusWindow", IsStatic = true}, F_FocusWindow }, { new Puerts.MethodKey {Name = "UnfocusWindow", IsStatic = true}, F_UnfocusWindow }, { new Puerts.MethodKey {Name = "Label", IsStatic = true}, F_Label }, { new Puerts.MethodKey {Name = "DrawTexture", IsStatic = true}, F_DrawTexture }, { new Puerts.MethodKey {Name = "DrawTextureWithTexCoords", IsStatic = true}, F_DrawTextureWithTexCoords }, { new Puerts.MethodKey {Name = "Box", IsStatic = true}, F_Box }, { new Puerts.MethodKey {Name = "Button", IsStatic = true}, F_Button }, { new Puerts.MethodKey {Name = "RepeatButton", IsStatic = true}, F_RepeatButton }, { new Puerts.MethodKey {Name = "TextField", IsStatic = true}, F_TextField }, { new Puerts.MethodKey {Name = "PasswordField", IsStatic = true}, F_PasswordField }, { new Puerts.MethodKey {Name = "TextArea", IsStatic = true}, F_TextArea }, { new Puerts.MethodKey {Name = "Toggle", IsStatic = true}, F_Toggle }, { new Puerts.MethodKey {Name = "Toolbar", IsStatic = true}, F_Toolbar }, { new Puerts.MethodKey {Name = "SelectionGrid", IsStatic = true}, F_SelectionGrid }, { new Puerts.MethodKey {Name = "HorizontalSlider", IsStatic = true}, F_HorizontalSlider }, { new Puerts.MethodKey {Name = "VerticalSlider", IsStatic = true}, F_VerticalSlider }, { new Puerts.MethodKey {Name = "Slider", IsStatic = true}, F_Slider }, { new Puerts.MethodKey {Name = "HorizontalScrollbar", IsStatic = true}, F_HorizontalScrollbar }, { new Puerts.MethodKey {Name = "VerticalScrollbar", IsStatic = true}, F_VerticalScrollbar }, { new Puerts.MethodKey {Name = "BeginClip", IsStatic = true}, F_BeginClip }, { new Puerts.MethodKey {Name = "BeginGroup", IsStatic = true}, F_BeginGroup }, { new Puerts.MethodKey {Name = "EndGroup", IsStatic = true}, F_EndGroup }, { new Puerts.MethodKey {Name = "EndClip", IsStatic = true}, F_EndClip }, { new Puerts.MethodKey {Name = "BeginScrollView", IsStatic = true}, F_BeginScrollView }, { new Puerts.MethodKey {Name = "EndScrollView", IsStatic = true}, F_EndScrollView }, { new Puerts.MethodKey {Name = "ScrollTo", IsStatic = true}, F_ScrollTo }, { new Puerts.MethodKey {Name = "ScrollTowards", IsStatic = true}, F_ScrollTowards }, { new Puerts.MethodKey {Name = "Window", IsStatic = true}, F_Window }, { new Puerts.MethodKey {Name = "ModalWindow", IsStatic = true}, F_ModalWindow }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"color", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_color, Setter = S_color} }, {"backgroundColor", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_backgroundColor, Setter = S_backgroundColor} }, {"contentColor", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_contentColor, Setter = S_contentColor} }, {"changed", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_changed, Setter = S_changed} }, {"enabled", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_enabled, Setter = S_enabled} }, {"depth", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_depth, Setter = S_depth} }, {"skin", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_skin, Setter = S_skin} }, {"matrix", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_matrix, Setter = S_matrix} }, {"tooltip", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_tooltip, Setter = S_tooltip} }, } }; } } } <|start_filename|>Projects/GenerateDatas/convert_lua/error.TbCodeInfo/704.lua<|end_filename|> return { code = 704, key = "MAIL_OPERATE_TYPE_ERROR", } <|start_filename|>Projects/DataTemplates/template_erlang/test_tbmultiindexlist.erl<|end_filename|> %% test.TbMultiIndexList get() -> #{id1 => 1,id2 => 1,id3 => "ab1",num => 1,desc => "desc1"}. <|start_filename|>Projects/GenerateDatas/convert_lua/test.TbDefineFromExcelOne/1.lua<|end_filename|> return { unlock_equip = 10, unlock_hero = 20, default_avatar = "Assets/Icon/DefaultAvatar.png", default_item = "Assets/Icon/DefaultAvatar.png", } <|start_filename|>Projects/Go_json/gen/src/cfg/test.DemoSingletonType.go<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg import "errors" type TestDemoSingletonType struct { Id int32 Name string Date interface{} } const TypeId_TestDemoSingletonType = 539196998 func (*TestDemoSingletonType) GetTypeId() int32 { return 539196998 } func (_v *TestDemoSingletonType)Deserialize(_buf map[string]interface{}) (err error) { { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["id"].(float64); !_ok_ { err = errors.New("id error"); return }; _v.Id = int32(_tempNum_) } {var _ok_ bool; var __json_text__ map[string]interface{}; if __json_text__, _ok_ = _buf["name"].(map[string]interface{}) ; !_ok_ { err = errors.New("_v.Name error"); return }; { var _ok_ bool; if _, _ok_ = __json_text__["key"].(string); !_ok_ { err = errors.New("key error"); return } }; { var _ok_ bool; if _v.Name, _ok_ = __json_text__["text"].(string); !_ok_ { err = errors.New("text error"); return } } } { var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _buf["date"].(map[string]interface{}); !_ok_ { err = errors.New("date error"); return }; if _v.Date, err = DeserializeTestDemoDynamic(_x_); err != nil { return } } return } func DeserializeTestDemoSingletonType(_buf map[string]interface{}) (*TestDemoSingletonType, error) { v := &TestDemoSingletonType{} if err := v.Deserialize(_buf); err == nil { return v, nil } else { return nil, err } } <|start_filename|>Projects/GenerateDatas/convert_lua/item.TbItemExtra/1110020005.lua<|end_filename|> return { _name = 'DesignDrawing', id = 1110020005, learn_component_id = { 1021300002, }, } <|start_filename|>Projects/java_json/src/gen/cfg/role/LevelExpAttr.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.role; import com.google.gson.JsonElement; import com.google.gson.JsonObject; public final class LevelExpAttr { public LevelExpAttr(JsonObject __json__) { level = __json__.get("level").getAsInt(); needExp = __json__.get("need_exp").getAsLong(); { com.google.gson.JsonArray _json0_ = __json__.get("clothes_attrs").getAsJsonArray(); clothesAttrs = new java.util.ArrayList<Integer>(_json0_.size()); for(JsonElement __e : _json0_) { int __v; __v = __e.getAsInt(); clothesAttrs.add(__v); } } } public LevelExpAttr(int level, long need_exp, java.util.ArrayList<Integer> clothes_attrs ) { this.level = level; this.needExp = need_exp; this.clothesAttrs = clothes_attrs; } public static LevelExpAttr deserializeLevelExpAttr(JsonObject __json__) { return new LevelExpAttr(__json__); } public final int level; public final long needExp; public final java.util.ArrayList<Integer> clothesAttrs; public void resolve(java.util.HashMap<String, Object> _tables) { } @Override public String toString() { return "{ " + "level:" + level + "," + "needExp:" + needExp + "," + "clothesAttrs:" + clothesAttrs + "," + "}"; } } <|start_filename|>Projects/GenerateDatas/convert_lua/role.TbRoleLevelExpAttr/46.lua<|end_filename|> return { level = 46, need_exp = 55000, clothes_attrs = { 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, }, } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_WindZone_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_WindZone_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.WindZone(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.WindZone), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_mode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.WindZone; var result = obj.mode; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_mode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.WindZone; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.mode = (UnityEngine.WindZoneMode)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_radius(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.WindZone; var result = obj.radius; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_radius(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.WindZone; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.radius = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_windMain(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.WindZone; var result = obj.windMain; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_windMain(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.WindZone; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.windMain = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_windTurbulence(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.WindZone; var result = obj.windTurbulence; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_windTurbulence(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.WindZone; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.windTurbulence = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_windPulseMagnitude(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.WindZone; var result = obj.windPulseMagnitude; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_windPulseMagnitude(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.WindZone; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.windPulseMagnitude = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_windPulseFrequency(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.WindZone; var result = obj.windPulseFrequency; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_windPulseFrequency(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.WindZone; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.windPulseFrequency = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"mode", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_mode, Setter = S_mode} }, {"radius", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_radius, Setter = S_radius} }, {"windMain", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_windMain, Setter = S_windMain} }, {"windTurbulence", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_windTurbulence, Setter = S_windTurbulence} }, {"windPulseMagnitude", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_windPulseMagnitude, Setter = S_windPulseMagnitude} }, {"windPulseFrequency", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_windPulseFrequency, Setter = S_windPulseFrequency} }, } }; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_UI_DefaultControls_Resources_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_UI_DefaultControls_Resources_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.UI.DefaultControls.Resources constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_standard(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.UI.DefaultControls.Resources)Puerts.Utils.GetSelf((int)data, self); var result = obj.standard; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_standard(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.UI.DefaultControls.Resources)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.standard = argHelper.Get<UnityEngine.Sprite>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_background(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.UI.DefaultControls.Resources)Puerts.Utils.GetSelf((int)data, self); var result = obj.background; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_background(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.UI.DefaultControls.Resources)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.background = argHelper.Get<UnityEngine.Sprite>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_inputField(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.UI.DefaultControls.Resources)Puerts.Utils.GetSelf((int)data, self); var result = obj.inputField; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_inputField(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.UI.DefaultControls.Resources)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.inputField = argHelper.Get<UnityEngine.Sprite>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_knob(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.UI.DefaultControls.Resources)Puerts.Utils.GetSelf((int)data, self); var result = obj.knob; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_knob(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.UI.DefaultControls.Resources)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.knob = argHelper.Get<UnityEngine.Sprite>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_checkmark(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.UI.DefaultControls.Resources)Puerts.Utils.GetSelf((int)data, self); var result = obj.checkmark; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_checkmark(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.UI.DefaultControls.Resources)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.checkmark = argHelper.Get<UnityEngine.Sprite>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_dropdown(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.UI.DefaultControls.Resources)Puerts.Utils.GetSelf((int)data, self); var result = obj.dropdown; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_dropdown(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.UI.DefaultControls.Resources)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.dropdown = argHelper.Get<UnityEngine.Sprite>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_mask(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.UI.DefaultControls.Resources)Puerts.Utils.GetSelf((int)data, self); var result = obj.mask; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_mask(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.UI.DefaultControls.Resources)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.mask = argHelper.Get<UnityEngine.Sprite>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"standard", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_standard, Setter = S_standard} }, {"background", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_background, Setter = S_background} }, {"inputField", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_inputField, Setter = S_inputField} }, {"knob", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_knob, Setter = S_knob} }, {"checkmark", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_checkmark, Setter = S_checkmark} }, {"dropdown", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_dropdown, Setter = S_dropdown} }, {"mask", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_mask, Setter = S_mask} }, } }; } } } <|start_filename|>Projects/Csharp_CustomTemplate_EncryptMemory/Gen/test/DefineFromExcel.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using System; using Newtonsoft.Json; using Scripts; namespace cfg.test { [Serializable] public partial class DefineFromExcel : AConfig { /// <summary> /// 字段x1 /// </summary> public bool x1 { get; set; } [JsonProperty("x5")] private long _x5 { get; set; } [JsonIgnore] public EncryptLong x5 { get; private set; } = new(); [JsonProperty("x6")] private float _x6 { get; set; } [JsonIgnore] public EncryptFloat x6 { get; private set; } = new(); [JsonProperty("x8")] private int _x8 { get; set; } [JsonIgnore] public EncryptInt x8 { get; private set; } = new(); public string x10 { get; set; } public test.ETestQuality x13 { get; set; } [JsonProperty] public test.DemoDynamic x14 { get; set; } public System.Numerics.Vector2 v2 { get; set; } public int t1 { get; set; } public int[] k1 { get; set; } public System.Collections.Generic.Dictionary<int, int> k8 { get; set; } public System.Collections.Generic.List<test.DemoE2> k9 { get; set; } public override void EndInit() { x5 = _x5; x6 = _x6; x8 = _x8; x14.EndInit(); foreach(var _e in k9) { _e.EndInit(); } } public override string ToString() => JsonConvert.SerializeObject(this); } } <|start_filename|>Projects/java_json/src/gen/cfg/bonus/WeightBonusInfo.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.bonus; import com.google.gson.JsonElement; import com.google.gson.JsonObject; public final class WeightBonusInfo { public WeightBonusInfo(JsonObject __json__) { bonus = cfg.bonus.Bonus.deserializeBonus(__json__.get("bonus").getAsJsonObject()); weight = __json__.get("weight").getAsInt(); } public WeightBonusInfo(cfg.bonus.Bonus bonus, int weight ) { this.bonus = bonus; this.weight = weight; } public static WeightBonusInfo deserializeWeightBonusInfo(JsonObject __json__) { return new WeightBonusInfo(__json__); } public final cfg.bonus.Bonus bonus; public final int weight; public void resolve(java.util.HashMap<String, Object> _tables) { if (bonus != null) {bonus.resolve(_tables);} } @Override public String toString() { return "{ " + "bonus:" + bonus + "," + "weight:" + weight + "," + "}"; } } <|start_filename|>Projects/Csharp_CustomTemplate_EncryptMemory/Assets/Scripts/Init.cs<|end_filename|> using System; using cfg.bonus; using Cysharp.Threading.Tasks; using UnityEngine; namespace Scripts { public class Init : MonoBehaviour { private void Awake() { _Init().Forget(Debug.LogError); } private async UniTask _Init() { await ConfigManager.Instance.Load(); // ConfigManager.Instance.Get<Config配置对象>(配置的 id); } } } <|start_filename|>Projects/GenerateDatas/convert_lua/l10n.TbL10NDemo/18.lua<|end_filename|> return { id = 18, text = {key='/demo/8',text="测试8"}, } <|start_filename|>Projects/DataTemplates/template_lua2/ai_tbbehaviortree.lua<|end_filename|> -- ai.TbBehaviorTree return { [10002] = { id=10002, name="<NAME>", desc="demo behaviour tree haha", blackboard_id="demo", root= { id=1, node_name="test", decorators= { { id=3, node_name="", flow_abort_mode=2, num_loops=0, infinite_loop=true, infinite_loop_timeout_time=-1, }, }, services= { }, children= { { id=30, node_name="", decorators= { }, services= { }, ignore_restart_self=false, wait_time=1, random_deviation=0.5, }, { id=75, node_name="", decorators= { }, services= { }, ignore_restart_self=false, origin_position_key="x5", radius=30, }, }, }, }, } <|start_filename|>Projects/DataTemplates/gen_template_erlang.bat<|end_filename|> set WORKSPACE=..\.. set GEN_CLIENT=%WORKSPACE%\Tools\Luban.ClientServer\Luban.ClientServer.exe set CONF_ROOT=%WORKSPACE%\DesignerConfigs %GEN_CLIENT% --template_search_path CustomTemplates -j cfg --^ -d %CONF_ROOT%\Defines\__root__.xml ^ --input_data_dir %CONF_ROOT%\Datas ^ --output_data_dir template_erlang ^ --gen_types data_template --template:data:file erlang ^ -s all ^ pause <|start_filename|>Projects/Csharp_Unity_bin_use_UnityEngine_Vector/Assets/Gen/test/DemoGroup.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.test { public sealed class DemoGroup : Bright.Config.BeanBase { public DemoGroup(ByteBuf _buf) { Id = _buf.ReadInt(); X1 = _buf.ReadInt(); X2 = _buf.ReadInt(); X3 = _buf.ReadInt(); X4 = _buf.ReadInt(); X5 = test.InnerGroup.DeserializeInnerGroup(_buf); } public static DemoGroup DeserializeDemoGroup(ByteBuf _buf) { return new test.DemoGroup(_buf); } public int Id { get; private set; } public int X1 { get; private set; } public int X2 { get; private set; } public int X3 { get; private set; } public int X4 { get; private set; } public test.InnerGroup X5 { get; private set; } public const int __ID__ = -379263008; public override int GetTypeId() => __ID__; public void Resolve(Dictionary<string, object> _tables) { X5?.Resolve(_tables); } public void TranslateText(System.Func<string, string, string> translator) { X5?.TranslateText(translator); } public override string ToString() { return "{ " + "Id:" + Id + "," + "X1:" + X1 + "," + "X2:" + X2 + "," + "X3:" + X3 + "," + "X4:" + X4 + "," + "X5:" + X5 + "," + "}"; } } } <|start_filename|>Projects/GenerateDatas/convert_lua/role.TbRoleLevelExpAttr/83.lua<|end_filename|> return { level = 83, need_exp = 240000, clothes_attrs = { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, }, } <|start_filename|>Projects/Csharp_CustomTemplate_EncryptMemory/Gen/bonus/DropInfo.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using System; using Newtonsoft.Json; using Scripts; namespace cfg.bonus { [Serializable] public partial class DropInfo : AConfig { public string desc { get; set; } public System.Collections.Generic.List<bonus.ShowItemInfo> client_show_items { get; set; } [JsonProperty] public bonus.Bonus bonus { get; set; } public override void EndInit() { foreach(var _e in client_show_items) { _e.EndInit(); } bonus.EndInit(); } public override string ToString() => JsonConvert.SerializeObject(this); } } <|start_filename|>Projects/Java_bin/src/main/gen/cfg/blueprint/EnumClazz.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.blueprint; import bright.serialization.*; public final class EnumClazz extends cfg.blueprint.Clazz { public EnumClazz(ByteBuf _buf) { super(_buf); {int n = Math.min(_buf.readSize(), _buf.size());enums = new java.util.ArrayList<cfg.blueprint.EnumField>(n);for(int i = 0 ; i < n ; i++) { cfg.blueprint.EnumField _e; _e = new cfg.blueprint.EnumField(_buf); enums.add(_e);}} } public EnumClazz(String name, String desc, java.util.ArrayList<cfg.blueprint.Clazz> parents, java.util.ArrayList<cfg.blueprint.Method> methods, java.util.ArrayList<cfg.blueprint.EnumField> enums ) { super(name, desc, parents, methods); this.enums = enums; } public final java.util.ArrayList<cfg.blueprint.EnumField> enums; public static final int __ID__ = 1827364892; @Override public int getTypeId() { return __ID__; } @Override public void resolve(java.util.HashMap<String, Object> _tables) { super.resolve(_tables); for(cfg.blueprint.EnumField _e : enums) { if (_e != null) _e.resolve(_tables); } } @Override public String toString() { return "{ " + "name:" + name + "," + "desc:" + desc + "," + "parents:" + parents + "," + "methods:" + methods + "," + "enums:" + enums + "," + "}"; } } <|start_filename|>Projects/Go_json/gen/src/cfg/test.TestGlobal.go<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg import "errors" type TestTestGlobal struct { UnlockEquip int32 UnlockHero int32 } const TypeId_TestTestGlobal = -12548655 func (*TestTestGlobal) GetTypeId() int32 { return -12548655 } func (_v *TestTestGlobal)Deserialize(_buf map[string]interface{}) (err error) { { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["unlock_equip"].(float64); !_ok_ { err = errors.New("unlock_equip error"); return }; _v.UnlockEquip = int32(_tempNum_) } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["unlock_hero"].(float64); !_ok_ { err = errors.New("unlock_hero error"); return }; _v.UnlockHero = int32(_tempNum_) } return } func DeserializeTestTestGlobal(_buf map[string]interface{}) (*TestTestGlobal, error) { v := &TestTestGlobal{} if err := v.Deserialize(_buf); err == nil { return v, nil } else { return nil, err } } <|start_filename|>Projects/DataTemplates/template_erlang/blueprint_tbclazz.erl<|end_filename|> %% blueprint.TbClazz get("int") -> #{name__ => "NormalClazz",name => "int",desc => "primity type:int",parents => [],methods => [],is_abstract => false,fields => []}. <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_FrustumPlanes_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_FrustumPlanes_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.FrustumPlanes constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_left(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.FrustumPlanes)Puerts.Utils.GetSelf((int)data, self); var result = obj.left; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_left(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.FrustumPlanes)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.left = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_right(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.FrustumPlanes)Puerts.Utils.GetSelf((int)data, self); var result = obj.right; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_right(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.FrustumPlanes)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.right = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_bottom(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.FrustumPlanes)Puerts.Utils.GetSelf((int)data, self); var result = obj.bottom; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_bottom(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.FrustumPlanes)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.bottom = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_top(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.FrustumPlanes)Puerts.Utils.GetSelf((int)data, self); var result = obj.top; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_top(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.FrustumPlanes)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.top = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_zNear(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.FrustumPlanes)Puerts.Utils.GetSelf((int)data, self); var result = obj.zNear; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_zNear(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.FrustumPlanes)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.zNear = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_zFar(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.FrustumPlanes)Puerts.Utils.GetSelf((int)data, self); var result = obj.zFar; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_zFar(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.FrustumPlanes)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.zFar = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"left", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_left, Setter = S_left} }, {"right", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_right, Setter = S_right} }, {"bottom", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_bottom, Setter = S_bottom} }, {"top", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_top, Setter = S_top} }, {"zNear", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_zNear, Setter = S_zNear} }, {"zFar", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_zFar, Setter = S_zFar} }, } }; } } } <|start_filename|>Projects/Java_bin/src/main/gen/cfg/test/DemoE1.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.test; import bright.serialization.*; public final class DemoE1 extends cfg.test.DemoD3 { public DemoE1(ByteBuf _buf) { super(_buf); x4 = _buf.readInt(); } public DemoE1(int x1, int x3, int x4 ) { super(x1, x3); this.x4 = x4; } public final int x4; public static final int __ID__ = -2138341717; @Override public int getTypeId() { return __ID__; } @Override public void resolve(java.util.HashMap<String, Object> _tables) { super.resolve(_tables); } @Override public String toString() { return "{ " + "x1:" + x1 + "," + "x3:" + x3 + "," + "x4:" + x4 + "," + "}"; } } <|start_filename|>Projects/GenerateDatas/convert_lua/test.TbTestNull/31.lua<|end_filename|> return { id = 31, } <|start_filename|>DesignerConfigs/Datas/tag_datas/tag_any.lua<|end_filename|> return { __tag__ = "any", id = 104, value="any", } <|start_filename|>Projects/Csharp_Unity_bin_use_UnityEngine_Vector/Assets/Gen/ai/TbBlackboard.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.ai { public sealed class TbBlackboard { private readonly Dictionary<string, ai.Blackboard> _dataMap; private readonly List<ai.Blackboard> _dataList; public TbBlackboard(ByteBuf _buf) { _dataMap = new Dictionary<string, ai.Blackboard>(); _dataList = new List<ai.Blackboard>(); for(int n = _buf.ReadSize() ; n > 0 ; --n) { ai.Blackboard _v; _v = ai.Blackboard.DeserializeBlackboard(_buf); _dataList.Add(_v); _dataMap.Add(_v.Name, _v); } } public Dictionary<string, ai.Blackboard> DataMap => _dataMap; public List<ai.Blackboard> DataList => _dataList; public ai.Blackboard GetOrDefault(string key) => _dataMap.TryGetValue(key, out var v) ? v : null; public ai.Blackboard Get(string key) => _dataMap[key]; public ai.Blackboard this[string key] => _dataMap[key]; public void Resolve(Dictionary<string, object> _tables) { foreach(var v in _dataList) { v.Resolve(_tables); } } public void TranslateText(System.Func<string, string, string> translator) { foreach(var v in _dataList) { v.TranslateText(translator); } } } } <|start_filename|>Projects/GenerateDatas/convert_lua/role.TbRoleLevelExpAttr/88.lua<|end_filename|> return { level = 88, need_exp = 265000, clothes_attrs = { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, }, } <|start_filename|>Projects/DataTemplates/template_erlang2/test_tbteststring.erl<|end_filename|> %% test.TbTestString -module(test_tbteststring) -export([get/1,get_ids/0]) get(1) -> #{ id => 1, s1 => "asfas", cs1 => bean, cs2 => bean }. get(2) -> #{ id => 2, s1 => "adsf\"", cs1 => bean, cs2 => bean }. get(3) -> #{ id => 3, s1 => "升级到10级\"\"", cs1 => bean, cs2 => bean }. get(4) -> #{ id => 4, s1 => "asdfa", cs1 => bean, cs2 => bean }. get_ids() -> [1,2,3,4]. <|start_filename|>Projects/Java_bin/src/main/gen/cfg/bonus/CoefficientItem.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.bonus; import bright.serialization.*; public final class CoefficientItem extends cfg.bonus.Bonus { public CoefficientItem(ByteBuf _buf) { super(_buf); bonusId = _buf.readInt(); bonusList = new cfg.bonus.Items(_buf); } public CoefficientItem(int bonus_id, cfg.bonus.Items bonus_list ) { super(); this.bonusId = bonus_id; this.bonusList = bonus_list; } public final int bonusId; public final cfg.bonus.Items bonusList; public static final int __ID__ = -229470727; @Override public int getTypeId() { return __ID__; } @Override public void resolve(java.util.HashMap<String, Object> _tables) { super.resolve(_tables); if (bonusList != null) {bonusList.resolve(_tables);} } @Override public String toString() { return "{ " + "bonusId:" + bonusId + "," + "bonusList:" + bonusList + "," + "}"; } } <|start_filename|>Projects/java_json/src/gen/cfg/blueprint/EnumClazz.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.blueprint; import com.google.gson.JsonElement; import com.google.gson.JsonObject; public final class EnumClazz extends cfg.blueprint.Clazz { public EnumClazz(JsonObject __json__) { super(__json__); { com.google.gson.JsonArray _json0_ = __json__.get("enums").getAsJsonArray(); enums = new java.util.ArrayList<cfg.blueprint.EnumField>(_json0_.size()); for(JsonElement __e : _json0_) { cfg.blueprint.EnumField __v; __v = new cfg.blueprint.EnumField(__e.getAsJsonObject()); enums.add(__v); } } } public EnumClazz(String name, String desc, java.util.ArrayList<cfg.blueprint.Clazz> parents, java.util.ArrayList<cfg.blueprint.Method> methods, java.util.ArrayList<cfg.blueprint.EnumField> enums ) { super(name, desc, parents, methods); this.enums = enums; } public static EnumClazz deserializeEnumClazz(JsonObject __json__) { return new EnumClazz(__json__); } public final java.util.ArrayList<cfg.blueprint.EnumField> enums; public static final int __ID__ = 1827364892; @Override public int getTypeId() { return __ID__; } @Override public void resolve(java.util.HashMap<String, Object> _tables) { super.resolve(_tables); for(cfg.blueprint.EnumField _e : enums) { if (_e != null) _e.resolve(_tables); } } @Override public String toString() { return "{ " + "name:" + name + "," + "desc:" + desc + "," + "parents:" + parents + "," + "methods:" + methods + "," + "enums:" + enums + "," + "}"; } } <|start_filename|>Projects/java_json/src/gen/cfg/item/InteractionItem.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.item; import com.google.gson.JsonElement; import com.google.gson.JsonObject; public final class InteractionItem extends cfg.item.ItemExtra { public InteractionItem(JsonObject __json__) { super(__json__); { if (__json__.has("attack_num") && !__json__.get("attack_num").isJsonNull()) { attackNum = __json__.get("attack_num").getAsInt(); } else { attackNum = null; } } holdingStaticMesh = __json__.get("holding_static_mesh").getAsString(); holdingStaticMeshMat = __json__.get("holding_static_mesh_mat").getAsString(); } public InteractionItem(int id, Integer attack_num, String holding_static_mesh, String holding_static_mesh_mat ) { super(id); this.attackNum = attack_num; this.holdingStaticMesh = holding_static_mesh; this.holdingStaticMeshMat = holding_static_mesh_mat; } public static InteractionItem deserializeInteractionItem(JsonObject __json__) { return new InteractionItem(__json__); } public final Integer attackNum; public final String holdingStaticMesh; public final String holdingStaticMeshMat; public static final int __ID__ = 640937802; @Override public int getTypeId() { return __ID__; } @Override public void resolve(java.util.HashMap<String, Object> _tables) { super.resolve(_tables); } @Override public String toString() { return "{ " + "id:" + id + "," + "attackNum:" + attackNum + "," + "holdingStaticMesh:" + holdingStaticMesh + "," + "holdingStaticMeshMat:" + holdingStaticMeshMat + "," + "}"; } } <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/blueprint/Clazz.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.blueprint { public abstract partial class Clazz : Bright.Config.BeanBase { public Clazz(ByteBuf _buf) { Name = _buf.ReadString(); Desc = _buf.ReadString(); {int n = System.Math.Min(_buf.ReadSize(), _buf.Size);Parents = new System.Collections.Generic.List<blueprint.Clazz>(n);for(var i = 0 ; i < n ; i++) { blueprint.Clazz _e; _e = blueprint.Clazz.DeserializeClazz(_buf); Parents.Add(_e);}} {int n = System.Math.Min(_buf.ReadSize(), _buf.Size);Methods = new System.Collections.Generic.List<blueprint.Method>(n);for(var i = 0 ; i < n ; i++) { blueprint.Method _e; _e = blueprint.Method.DeserializeMethod(_buf); Methods.Add(_e);}} } public Clazz(string name, string desc, System.Collections.Generic.List<blueprint.Clazz> parents, System.Collections.Generic.List<blueprint.Method> methods ) { this.Name = name; this.Desc = desc; this.Parents = parents; this.Methods = methods; } public static Clazz DeserializeClazz(ByteBuf _buf) { switch (_buf.ReadInt()) { case blueprint.Interface.ID: return new blueprint.Interface(_buf); case blueprint.NormalClazz.ID: return new blueprint.NormalClazz(_buf); case blueprint.EnumClazz.ID: return new blueprint.EnumClazz(_buf); default: throw new SerializationException(); } } public readonly string Name; public readonly string Desc; public readonly System.Collections.Generic.List<blueprint.Clazz> Parents; public readonly System.Collections.Generic.List<blueprint.Method> Methods; public virtual void Resolve(Dictionary<string, object> _tables) { foreach(var _e in Parents) { _e?.Resolve(_tables); } foreach(var _e in Methods) { _e?.Resolve(_tables); } OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); public override string ToString() { return "{ " + "Name:" + Name + "," + "Desc:" + Desc + "," + "Parents:" + Bright.Common.StringUtil.CollectionToString(Parents) + "," + "Methods:" + Bright.Common.StringUtil.CollectionToString(Methods) + "," + "}"; } } } <|start_filename|>Projects/java_json/src/gen/cfg/role/EProfession.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.role; public enum EProfession { TEST_PROFESSION(1), ; private final int value; public int getValue() { return value; } EProfession(int value) { this.value = value; } public static EProfession valueOf(int value) { if (value == 1) return TEST_PROFESSION; throw new IllegalArgumentException(""); } } <|start_filename|>Projects/Csharp_Unity_bin_use_UnityEngine_Vector/Assets/Gen/ai/Sequence.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.ai { public sealed class Sequence : ai.ComposeNode { public Sequence(ByteBuf _buf) : base(_buf) { {int n = System.Math.Min(_buf.ReadSize(), _buf.Size);Children = new System.Collections.Generic.List<ai.FlowNode>(n);for(var i = 0 ; i < n ; i++) { ai.FlowNode _e; _e = ai.FlowNode.DeserializeFlowNode(_buf); Children.Add(_e);}} } public static Sequence DeserializeSequence(ByteBuf _buf) { return new ai.Sequence(_buf); } public System.Collections.Generic.List<ai.FlowNode> Children { get; private set; } public const int __ID__ = -1789006105; public override int GetTypeId() => __ID__; public override void Resolve(Dictionary<string, object> _tables) { base.Resolve(_tables); foreach(var _e in Children) { _e?.Resolve(_tables); } } public override void TranslateText(System.Func<string, string, string> translator) { base.TranslateText(translator); foreach(var _e in Children) { _e?.TranslateText(translator); } } public override string ToString() { return "{ " + "Id:" + Id + "," + "NodeName:" + NodeName + "," + "Decorators:" + Bright.Common.StringUtil.CollectionToString(Decorators) + "," + "Services:" + Bright.Common.StringUtil.CollectionToString(Services) + "," + "Children:" + Bright.Common.StringUtil.CollectionToString(Children) + "," + "}"; } } } <|start_filename|>Projects/DataTemplates/template_erlang/test_tbnotindexlist.erl<|end_filename|> %% test.TbNotIndexList get() -> #{x => 1,y => 2}. <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_LightBakingOutput_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_LightBakingOutput_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.LightBakingOutput constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_probeOcclusionLightIndex(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.LightBakingOutput)Puerts.Utils.GetSelf((int)data, self); var result = obj.probeOcclusionLightIndex; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_probeOcclusionLightIndex(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.LightBakingOutput)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.probeOcclusionLightIndex = argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_occlusionMaskChannel(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.LightBakingOutput)Puerts.Utils.GetSelf((int)data, self); var result = obj.occlusionMaskChannel; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_occlusionMaskChannel(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.LightBakingOutput)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.occlusionMaskChannel = argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_lightmapBakeType(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.LightBakingOutput)Puerts.Utils.GetSelf((int)data, self); var result = obj.lightmapBakeType; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_lightmapBakeType(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.LightBakingOutput)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.lightmapBakeType = (UnityEngine.LightmapBakeType)argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_mixedLightingMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.LightBakingOutput)Puerts.Utils.GetSelf((int)data, self); var result = obj.mixedLightingMode; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_mixedLightingMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.LightBakingOutput)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.mixedLightingMode = (UnityEngine.MixedLightingMode)argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_isBaked(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.LightBakingOutput)Puerts.Utils.GetSelf((int)data, self); var result = obj.isBaked; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_isBaked(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.LightBakingOutput)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.isBaked = argHelper.GetBoolean(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"probeOcclusionLightIndex", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_probeOcclusionLightIndex, Setter = S_probeOcclusionLightIndex} }, {"occlusionMaskChannel", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_occlusionMaskChannel, Setter = S_occlusionMaskChannel} }, {"lightmapBakeType", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_lightmapBakeType, Setter = S_lightmapBakeType} }, {"mixedLightingMode", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_mixedLightingMode, Setter = S_mixedLightingMode} }, {"isBaked", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_isBaked, Setter = S_isBaked} }, } }; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_ConfigurableJoint_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_ConfigurableJoint_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.ConfigurableJoint(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.ConfigurableJoint), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_secondaryAxis(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ConfigurableJoint; var result = obj.secondaryAxis; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_secondaryAxis(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ConfigurableJoint; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.secondaryAxis = argHelper.Get<UnityEngine.Vector3>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_xMotion(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ConfigurableJoint; var result = obj.xMotion; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_xMotion(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ConfigurableJoint; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.xMotion = (UnityEngine.ConfigurableJointMotion)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_yMotion(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ConfigurableJoint; var result = obj.yMotion; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_yMotion(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ConfigurableJoint; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.yMotion = (UnityEngine.ConfigurableJointMotion)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_zMotion(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ConfigurableJoint; var result = obj.zMotion; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_zMotion(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ConfigurableJoint; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.zMotion = (UnityEngine.ConfigurableJointMotion)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_angularXMotion(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ConfigurableJoint; var result = obj.angularXMotion; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_angularXMotion(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ConfigurableJoint; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.angularXMotion = (UnityEngine.ConfigurableJointMotion)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_angularYMotion(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ConfigurableJoint; var result = obj.angularYMotion; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_angularYMotion(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ConfigurableJoint; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.angularYMotion = (UnityEngine.ConfigurableJointMotion)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_angularZMotion(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ConfigurableJoint; var result = obj.angularZMotion; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_angularZMotion(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ConfigurableJoint; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.angularZMotion = (UnityEngine.ConfigurableJointMotion)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_linearLimitSpring(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ConfigurableJoint; var result = obj.linearLimitSpring; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_linearLimitSpring(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ConfigurableJoint; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.linearLimitSpring = argHelper.Get<UnityEngine.SoftJointLimitSpring>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_angularXLimitSpring(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ConfigurableJoint; var result = obj.angularXLimitSpring; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_angularXLimitSpring(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ConfigurableJoint; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.angularXLimitSpring = argHelper.Get<UnityEngine.SoftJointLimitSpring>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_angularYZLimitSpring(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ConfigurableJoint; var result = obj.angularYZLimitSpring; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_angularYZLimitSpring(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ConfigurableJoint; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.angularYZLimitSpring = argHelper.Get<UnityEngine.SoftJointLimitSpring>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_linearLimit(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ConfigurableJoint; var result = obj.linearLimit; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_linearLimit(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ConfigurableJoint; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.linearLimit = argHelper.Get<UnityEngine.SoftJointLimit>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_lowAngularXLimit(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ConfigurableJoint; var result = obj.lowAngularXLimit; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_lowAngularXLimit(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ConfigurableJoint; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.lowAngularXLimit = argHelper.Get<UnityEngine.SoftJointLimit>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_highAngularXLimit(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ConfigurableJoint; var result = obj.highAngularXLimit; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_highAngularXLimit(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ConfigurableJoint; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.highAngularXLimit = argHelper.Get<UnityEngine.SoftJointLimit>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_angularYLimit(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ConfigurableJoint; var result = obj.angularYLimit; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_angularYLimit(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ConfigurableJoint; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.angularYLimit = argHelper.Get<UnityEngine.SoftJointLimit>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_angularZLimit(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ConfigurableJoint; var result = obj.angularZLimit; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_angularZLimit(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ConfigurableJoint; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.angularZLimit = argHelper.Get<UnityEngine.SoftJointLimit>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_targetPosition(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ConfigurableJoint; var result = obj.targetPosition; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_targetPosition(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ConfigurableJoint; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.targetPosition = argHelper.Get<UnityEngine.Vector3>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_targetVelocity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ConfigurableJoint; var result = obj.targetVelocity; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_targetVelocity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ConfigurableJoint; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.targetVelocity = argHelper.Get<UnityEngine.Vector3>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_xDrive(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ConfigurableJoint; var result = obj.xDrive; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_xDrive(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ConfigurableJoint; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.xDrive = argHelper.Get<UnityEngine.JointDrive>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_yDrive(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ConfigurableJoint; var result = obj.yDrive; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_yDrive(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ConfigurableJoint; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.yDrive = argHelper.Get<UnityEngine.JointDrive>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_zDrive(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ConfigurableJoint; var result = obj.zDrive; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_zDrive(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ConfigurableJoint; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.zDrive = argHelper.Get<UnityEngine.JointDrive>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_targetRotation(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ConfigurableJoint; var result = obj.targetRotation; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_targetRotation(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ConfigurableJoint; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.targetRotation = argHelper.Get<UnityEngine.Quaternion>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_targetAngularVelocity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ConfigurableJoint; var result = obj.targetAngularVelocity; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_targetAngularVelocity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ConfigurableJoint; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.targetAngularVelocity = argHelper.Get<UnityEngine.Vector3>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_rotationDriveMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ConfigurableJoint; var result = obj.rotationDriveMode; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_rotationDriveMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ConfigurableJoint; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.rotationDriveMode = (UnityEngine.RotationDriveMode)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_angularXDrive(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ConfigurableJoint; var result = obj.angularXDrive; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_angularXDrive(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ConfigurableJoint; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.angularXDrive = argHelper.Get<UnityEngine.JointDrive>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_angularYZDrive(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ConfigurableJoint; var result = obj.angularYZDrive; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_angularYZDrive(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ConfigurableJoint; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.angularYZDrive = argHelper.Get<UnityEngine.JointDrive>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_slerpDrive(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ConfigurableJoint; var result = obj.slerpDrive; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_slerpDrive(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ConfigurableJoint; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.slerpDrive = argHelper.Get<UnityEngine.JointDrive>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_projectionMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ConfigurableJoint; var result = obj.projectionMode; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_projectionMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ConfigurableJoint; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.projectionMode = (UnityEngine.JointProjectionMode)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_projectionDistance(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ConfigurableJoint; var result = obj.projectionDistance; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_projectionDistance(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ConfigurableJoint; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.projectionDistance = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_projectionAngle(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ConfigurableJoint; var result = obj.projectionAngle; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_projectionAngle(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ConfigurableJoint; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.projectionAngle = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_configuredInWorldSpace(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ConfigurableJoint; var result = obj.configuredInWorldSpace; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_configuredInWorldSpace(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ConfigurableJoint; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.configuredInWorldSpace = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_swapBodies(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ConfigurableJoint; var result = obj.swapBodies; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_swapBodies(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ConfigurableJoint; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.swapBodies = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"secondaryAxis", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_secondaryAxis, Setter = S_secondaryAxis} }, {"xMotion", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_xMotion, Setter = S_xMotion} }, {"yMotion", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_yMotion, Setter = S_yMotion} }, {"zMotion", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_zMotion, Setter = S_zMotion} }, {"angularXMotion", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_angularXMotion, Setter = S_angularXMotion} }, {"angularYMotion", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_angularYMotion, Setter = S_angularYMotion} }, {"angularZMotion", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_angularZMotion, Setter = S_angularZMotion} }, {"linearLimitSpring", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_linearLimitSpring, Setter = S_linearLimitSpring} }, {"angularXLimitSpring", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_angularXLimitSpring, Setter = S_angularXLimitSpring} }, {"angularYZLimitSpring", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_angularYZLimitSpring, Setter = S_angularYZLimitSpring} }, {"linearLimit", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_linearLimit, Setter = S_linearLimit} }, {"lowAngularXLimit", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_lowAngularXLimit, Setter = S_lowAngularXLimit} }, {"highAngularXLimit", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_highAngularXLimit, Setter = S_highAngularXLimit} }, {"angularYLimit", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_angularYLimit, Setter = S_angularYLimit} }, {"angularZLimit", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_angularZLimit, Setter = S_angularZLimit} }, {"targetPosition", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_targetPosition, Setter = S_targetPosition} }, {"targetVelocity", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_targetVelocity, Setter = S_targetVelocity} }, {"xDrive", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_xDrive, Setter = S_xDrive} }, {"yDrive", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_yDrive, Setter = S_yDrive} }, {"zDrive", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_zDrive, Setter = S_zDrive} }, {"targetRotation", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_targetRotation, Setter = S_targetRotation} }, {"targetAngularVelocity", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_targetAngularVelocity, Setter = S_targetAngularVelocity} }, {"rotationDriveMode", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_rotationDriveMode, Setter = S_rotationDriveMode} }, {"angularXDrive", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_angularXDrive, Setter = S_angularXDrive} }, {"angularYZDrive", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_angularYZDrive, Setter = S_angularYZDrive} }, {"slerpDrive", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_slerpDrive, Setter = S_slerpDrive} }, {"projectionMode", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_projectionMode, Setter = S_projectionMode} }, {"projectionDistance", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_projectionDistance, Setter = S_projectionDistance} }, {"projectionAngle", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_projectionAngle, Setter = S_projectionAngle} }, {"configuredInWorldSpace", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_configuredInWorldSpace, Setter = S_configuredInWorldSpace} }, {"swapBodies", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_swapBodies, Setter = S_swapBodies} }, } }; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_PhysicMaterial_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_PhysicMaterial_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { if (paramLen == 0) { { var result = new UnityEngine.PhysicMaterial(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.PhysicMaterial), result); } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var result = new UnityEngine.PhysicMaterial(Arg0); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.PhysicMaterial), result); } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.PhysicMaterial constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_bounciness(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.PhysicMaterial; var result = obj.bounciness; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_bounciness(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.PhysicMaterial; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.bounciness = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_dynamicFriction(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.PhysicMaterial; var result = obj.dynamicFriction; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_dynamicFriction(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.PhysicMaterial; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.dynamicFriction = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_staticFriction(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.PhysicMaterial; var result = obj.staticFriction; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_staticFriction(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.PhysicMaterial; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.staticFriction = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_frictionCombine(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.PhysicMaterial; var result = obj.frictionCombine; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_frictionCombine(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.PhysicMaterial; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.frictionCombine = (UnityEngine.PhysicMaterialCombine)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_bounceCombine(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.PhysicMaterial; var result = obj.bounceCombine; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_bounceCombine(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.PhysicMaterial; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.bounceCombine = (UnityEngine.PhysicMaterialCombine)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"bounciness", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_bounciness, Setter = S_bounciness} }, {"dynamicFriction", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_dynamicFriction, Setter = S_dynamicFriction} }, {"staticFriction", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_staticFriction, Setter = S_staticFriction} }, {"frictionCombine", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_frictionCombine, Setter = S_frictionCombine} }, {"bounceCombine", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_bounceCombine, Setter = S_bounceCombine} }, } }; } } } <|start_filename|>Projects/GenerateDatas/convert_lua/test.TbDetectCsvEncoding/32.lua<|end_filename|> return { id = 32, name = "还果园国要", } <|start_filename|>Projects/GenerateDatas/convert_lua/test.TbTestGlobal/1.lua<|end_filename|> return { unlock_equip = 10, unlock_hero = 20, } <|start_filename|>Projects/DataTemplates/template_erlang2/ai_tbblackboard.erl<|end_filename|> %% ai.TbBlackboard -module(ai_tbblackboard) -export([get/1,get_ids/0]) get("attack_or_patrol") -> #{ name => "attack_or_patrol", desc => "demo hahaha", parent_name => "", keys => array }. get("demo") -> #{ name => "demo", desc => "demo hahaha", parent_name => "demo_parent", keys => array }. get("demo_parent") -> #{ name => "demo_parent", desc => "demo parent", parent_name => "", keys => array }. get_ids() -> [attack_or_patrol,demo,demo_parent]. <|start_filename|>Projects/Java_bin/src/main/gen/cfg/error/ErrorStyleDlgOk.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.error; import bright.serialization.*; public final class ErrorStyleDlgOk extends cfg.error.ErrorStyle { public ErrorStyleDlgOk(ByteBuf _buf) { super(_buf); btnName = _buf.readString(); } public ErrorStyleDlgOk(String btn_name ) { super(); this.btnName = btn_name; } public final String btnName; public static final int __ID__ = -2010134516; @Override public int getTypeId() { return __ID__; } @Override public void resolve(java.util.HashMap<String, Object> _tables) { super.resolve(_tables); } @Override public String toString() { return "{ " + "btnName:" + btnName + "," + "}"; } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_UIVertex_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_UIVertex_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.UIVertex constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_position(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.UIVertex)Puerts.Utils.GetSelf((int)data, self); var result = obj.position; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_position(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.UIVertex)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.position = argHelper.Get<UnityEngine.Vector3>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_normal(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.UIVertex)Puerts.Utils.GetSelf((int)data, self); var result = obj.normal; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_normal(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.UIVertex)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.normal = argHelper.Get<UnityEngine.Vector3>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_tangent(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.UIVertex)Puerts.Utils.GetSelf((int)data, self); var result = obj.tangent; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_tangent(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.UIVertex)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.tangent = argHelper.Get<UnityEngine.Vector4>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_color(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.UIVertex)Puerts.Utils.GetSelf((int)data, self); var result = obj.color; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_color(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.UIVertex)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.color = argHelper.Get<UnityEngine.Color32>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_uv0(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.UIVertex)Puerts.Utils.GetSelf((int)data, self); var result = obj.uv0; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_uv0(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.UIVertex)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.uv0 = argHelper.Get<UnityEngine.Vector4>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_uv1(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.UIVertex)Puerts.Utils.GetSelf((int)data, self); var result = obj.uv1; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_uv1(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.UIVertex)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.uv1 = argHelper.Get<UnityEngine.Vector4>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_uv2(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.UIVertex)Puerts.Utils.GetSelf((int)data, self); var result = obj.uv2; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_uv2(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.UIVertex)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.uv2 = argHelper.Get<UnityEngine.Vector4>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_uv3(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.UIVertex)Puerts.Utils.GetSelf((int)data, self); var result = obj.uv3; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_uv3(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.UIVertex)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.uv3 = argHelper.Get<UnityEngine.Vector4>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_simpleVert(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.UIVertex.simpleVert; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_simpleVert(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.UIVertex.simpleVert = argHelper.Get<UnityEngine.UIVertex>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"position", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_position, Setter = S_position} }, {"normal", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_normal, Setter = S_normal} }, {"tangent", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_tangent, Setter = S_tangent} }, {"color", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_color, Setter = S_color} }, {"uv0", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_uv0, Setter = S_uv0} }, {"uv1", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_uv1, Setter = S_uv1} }, {"uv2", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_uv2, Setter = S_uv2} }, {"uv3", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_uv3, Setter = S_uv3} }, {"simpleVert", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_simpleVert, Setter = S_simpleVert} }, } }; } } } <|start_filename|>Projects/java_json/src/gen/cfg/test/InnerGroup.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.test; import com.google.gson.JsonElement; import com.google.gson.JsonObject; public final class InnerGroup { public InnerGroup(JsonObject __json__) { y1 = __json__.get("y1").getAsInt(); y2 = __json__.get("y2").getAsInt(); y3 = __json__.get("y3").getAsInt(); y4 = __json__.get("y4").getAsInt(); } public InnerGroup(int y1, int y2, int y3, int y4 ) { this.y1 = y1; this.y2 = y2; this.y3 = y3; this.y4 = y4; } public static InnerGroup deserializeInnerGroup(JsonObject __json__) { return new InnerGroup(__json__); } public final int y1; public final int y2; public final int y3; public final int y4; public void resolve(java.util.HashMap<String, Object> _tables) { } @Override public String toString() { return "{ " + "y1:" + y1 + "," + "y2:" + y2 + "," + "y3:" + y3 + "," + "y4:" + y4 + "," + "}"; } } <|start_filename|>Projects/GenerateDatas/convert_lua/l10n.TbPatchDemo/17.lua<|end_filename|> return { id = 17, value = 7, } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_AndroidJNI_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_AndroidJNI_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.AndroidJNI constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_AttachCurrentThread(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { { var result = UnityEngine.AndroidJNI.AttachCurrentThread(); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_DetachCurrentThread(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { { var result = UnityEngine.AndroidJNI.DetachCurrentThread(); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetVersion(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { { var result = UnityEngine.AndroidJNI.GetVersion(); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_FindClass(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetString(false); var result = UnityEngine.AndroidJNI.FindClass(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_FromReflectedMethod(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var result = UnityEngine.AndroidJNI.FromReflectedMethod(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_FromReflectedField(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var result = UnityEngine.AndroidJNI.FromReflectedField(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_ToReflectedMethod(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.Get<System.IntPtr>(false); var Arg2 = argHelper2.GetBoolean(false); var result = UnityEngine.AndroidJNI.ToReflectedMethod(Arg0,Arg1,Arg2); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_ToReflectedField(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.Get<System.IntPtr>(false); var Arg2 = argHelper2.GetBoolean(false); var result = UnityEngine.AndroidJNI.ToReflectedField(Arg0,Arg1,Arg2); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetSuperclass(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var result = UnityEngine.AndroidJNI.GetSuperclass(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_IsAssignableFrom(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.Get<System.IntPtr>(false); var result = UnityEngine.AndroidJNI.IsAssignableFrom(Arg0,Arg1); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_Throw(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var result = UnityEngine.AndroidJNI.Throw(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_ThrowNew(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.GetString(false); var result = UnityEngine.AndroidJNI.ThrowNew(Arg0,Arg1); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_ExceptionOccurred(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { { var result = UnityEngine.AndroidJNI.ExceptionOccurred(); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_ExceptionDescribe(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { { UnityEngine.AndroidJNI.ExceptionDescribe(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_ExceptionClear(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { { UnityEngine.AndroidJNI.ExceptionClear(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_FatalError(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetString(false); UnityEngine.AndroidJNI.FatalError(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_PushLocalFrame(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); var result = UnityEngine.AndroidJNI.PushLocalFrame(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_PopLocalFrame(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var result = UnityEngine.AndroidJNI.PopLocalFrame(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_NewGlobalRef(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var result = UnityEngine.AndroidJNI.NewGlobalRef(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_DeleteGlobalRef(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.IntPtr>(false); UnityEngine.AndroidJNI.DeleteGlobalRef(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_NewWeakGlobalRef(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var result = UnityEngine.AndroidJNI.NewWeakGlobalRef(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_DeleteWeakGlobalRef(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.IntPtr>(false); UnityEngine.AndroidJNI.DeleteWeakGlobalRef(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_NewLocalRef(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var result = UnityEngine.AndroidJNI.NewLocalRef(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_DeleteLocalRef(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.IntPtr>(false); UnityEngine.AndroidJNI.DeleteLocalRef(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_IsSameObject(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.Get<System.IntPtr>(false); var result = UnityEngine.AndroidJNI.IsSameObject(Arg0,Arg1); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_EnsureLocalCapacity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); var result = UnityEngine.AndroidJNI.EnsureLocalCapacity(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_AllocObject(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var result = UnityEngine.AndroidJNI.AllocObject(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_NewObject(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.Get<System.IntPtr>(false); var Arg2 = argHelper2.Get<UnityEngine.jvalue[]>(false); var result = UnityEngine.AndroidJNI.NewObject(Arg0,Arg1,Arg2); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetObjectClass(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var result = UnityEngine.AndroidJNI.GetObjectClass(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_IsInstanceOf(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.Get<System.IntPtr>(false); var result = UnityEngine.AndroidJNI.IsInstanceOf(Arg0,Arg1); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetMethodID(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.GetString(false); var Arg2 = argHelper2.GetString(false); var result = UnityEngine.AndroidJNI.GetMethodID(Arg0,Arg1,Arg2); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetFieldID(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.GetString(false); var Arg2 = argHelper2.GetString(false); var result = UnityEngine.AndroidJNI.GetFieldID(Arg0,Arg1,Arg2); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetStaticMethodID(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.GetString(false); var Arg2 = argHelper2.GetString(false); var result = UnityEngine.AndroidJNI.GetStaticMethodID(Arg0,Arg1,Arg2); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetStaticFieldID(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.GetString(false); var Arg2 = argHelper2.GetString(false); var result = UnityEngine.AndroidJNI.GetStaticFieldID(Arg0,Arg1,Arg2); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_NewString(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var result = UnityEngine.AndroidJNI.NewString(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Char[]), false, false)) { var Arg0 = argHelper0.Get<System.Char[]>(false); var result = UnityEngine.AndroidJNI.NewString(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to NewString"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_NewStringUTF(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetString(false); var result = UnityEngine.AndroidJNI.NewStringUTF(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetStringChars(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var result = UnityEngine.AndroidJNI.GetStringChars(Arg0); Puerts.PuertsDLL.ReturnString(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetStringLength(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var result = UnityEngine.AndroidJNI.GetStringLength(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetStringUTFLength(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var result = UnityEngine.AndroidJNI.GetStringUTFLength(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetStringUTFChars(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var result = UnityEngine.AndroidJNI.GetStringUTFChars(Arg0); Puerts.PuertsDLL.ReturnString(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_CallStringMethod(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.Get<System.IntPtr>(false); var Arg2 = argHelper2.Get<UnityEngine.jvalue[]>(false); var result = UnityEngine.AndroidJNI.CallStringMethod(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnString(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_CallObjectMethod(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.Get<System.IntPtr>(false); var Arg2 = argHelper2.Get<UnityEngine.jvalue[]>(false); var result = UnityEngine.AndroidJNI.CallObjectMethod(Arg0,Arg1,Arg2); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_CallIntMethod(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.Get<System.IntPtr>(false); var Arg2 = argHelper2.Get<UnityEngine.jvalue[]>(false); var result = UnityEngine.AndroidJNI.CallIntMethod(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_CallBooleanMethod(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.Get<System.IntPtr>(false); var Arg2 = argHelper2.Get<UnityEngine.jvalue[]>(false); var result = UnityEngine.AndroidJNI.CallBooleanMethod(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_CallShortMethod(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.Get<System.IntPtr>(false); var Arg2 = argHelper2.Get<UnityEngine.jvalue[]>(false); var result = UnityEngine.AndroidJNI.CallShortMethod(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_CallSByteMethod(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.Get<System.IntPtr>(false); var Arg2 = argHelper2.Get<UnityEngine.jvalue[]>(false); var result = UnityEngine.AndroidJNI.CallSByteMethod(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_CallCharMethod(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.Get<System.IntPtr>(false); var Arg2 = argHelper2.Get<UnityEngine.jvalue[]>(false); var result = UnityEngine.AndroidJNI.CallCharMethod(Arg0,Arg1,Arg2); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_CallFloatMethod(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.Get<System.IntPtr>(false); var Arg2 = argHelper2.Get<UnityEngine.jvalue[]>(false); var result = UnityEngine.AndroidJNI.CallFloatMethod(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_CallDoubleMethod(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.Get<System.IntPtr>(false); var Arg2 = argHelper2.Get<UnityEngine.jvalue[]>(false); var result = UnityEngine.AndroidJNI.CallDoubleMethod(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_CallLongMethod(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.Get<System.IntPtr>(false); var Arg2 = argHelper2.Get<UnityEngine.jvalue[]>(false); var result = UnityEngine.AndroidJNI.CallLongMethod(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnBigInt(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_CallVoidMethod(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.Get<System.IntPtr>(false); var Arg2 = argHelper2.Get<UnityEngine.jvalue[]>(false); UnityEngine.AndroidJNI.CallVoidMethod(Arg0,Arg1,Arg2); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetStringField(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.Get<System.IntPtr>(false); var result = UnityEngine.AndroidJNI.GetStringField(Arg0,Arg1); Puerts.PuertsDLL.ReturnString(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetObjectField(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.Get<System.IntPtr>(false); var result = UnityEngine.AndroidJNI.GetObjectField(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetBooleanField(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.Get<System.IntPtr>(false); var result = UnityEngine.AndroidJNI.GetBooleanField(Arg0,Arg1); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetSByteField(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.Get<System.IntPtr>(false); var result = UnityEngine.AndroidJNI.GetSByteField(Arg0,Arg1); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetCharField(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.Get<System.IntPtr>(false); var result = UnityEngine.AndroidJNI.GetCharField(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetShortField(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.Get<System.IntPtr>(false); var result = UnityEngine.AndroidJNI.GetShortField(Arg0,Arg1); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetIntField(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.Get<System.IntPtr>(false); var result = UnityEngine.AndroidJNI.GetIntField(Arg0,Arg1); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetLongField(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.Get<System.IntPtr>(false); var result = UnityEngine.AndroidJNI.GetLongField(Arg0,Arg1); Puerts.PuertsDLL.ReturnBigInt(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetFloatField(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.Get<System.IntPtr>(false); var result = UnityEngine.AndroidJNI.GetFloatField(Arg0,Arg1); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetDoubleField(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.Get<System.IntPtr>(false); var result = UnityEngine.AndroidJNI.GetDoubleField(Arg0,Arg1); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_SetStringField(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.Get<System.IntPtr>(false); var Arg2 = argHelper2.GetString(false); UnityEngine.AndroidJNI.SetStringField(Arg0,Arg1,Arg2); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_SetObjectField(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.Get<System.IntPtr>(false); var Arg2 = argHelper2.Get<System.IntPtr>(false); UnityEngine.AndroidJNI.SetObjectField(Arg0,Arg1,Arg2); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_SetBooleanField(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.Get<System.IntPtr>(false); var Arg2 = argHelper2.GetBoolean(false); UnityEngine.AndroidJNI.SetBooleanField(Arg0,Arg1,Arg2); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_SetSByteField(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.Get<System.IntPtr>(false); var Arg2 = argHelper2.GetSByte(false); UnityEngine.AndroidJNI.SetSByteField(Arg0,Arg1,Arg2); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_SetCharField(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.Get<System.IntPtr>(false); var Arg2 = argHelper2.Get<System.Char>(false); UnityEngine.AndroidJNI.SetCharField(Arg0,Arg1,Arg2); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_SetShortField(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.Get<System.IntPtr>(false); var Arg2 = argHelper2.GetInt16(false); UnityEngine.AndroidJNI.SetShortField(Arg0,Arg1,Arg2); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_SetIntField(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.Get<System.IntPtr>(false); var Arg2 = argHelper2.GetInt32(false); UnityEngine.AndroidJNI.SetIntField(Arg0,Arg1,Arg2); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_SetLongField(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.Get<System.IntPtr>(false); var Arg2 = argHelper2.GetInt64(false); UnityEngine.AndroidJNI.SetLongField(Arg0,Arg1,Arg2); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_SetFloatField(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.Get<System.IntPtr>(false); var Arg2 = argHelper2.GetFloat(false); UnityEngine.AndroidJNI.SetFloatField(Arg0,Arg1,Arg2); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_SetDoubleField(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.Get<System.IntPtr>(false); var Arg2 = argHelper2.GetDouble(false); UnityEngine.AndroidJNI.SetDoubleField(Arg0,Arg1,Arg2); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_CallStaticStringMethod(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.Get<System.IntPtr>(false); var Arg2 = argHelper2.Get<UnityEngine.jvalue[]>(false); var result = UnityEngine.AndroidJNI.CallStaticStringMethod(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnString(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_CallStaticObjectMethod(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.Get<System.IntPtr>(false); var Arg2 = argHelper2.Get<UnityEngine.jvalue[]>(false); var result = UnityEngine.AndroidJNI.CallStaticObjectMethod(Arg0,Arg1,Arg2); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_CallStaticIntMethod(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.Get<System.IntPtr>(false); var Arg2 = argHelper2.Get<UnityEngine.jvalue[]>(false); var result = UnityEngine.AndroidJNI.CallStaticIntMethod(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_CallStaticBooleanMethod(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.Get<System.IntPtr>(false); var Arg2 = argHelper2.Get<UnityEngine.jvalue[]>(false); var result = UnityEngine.AndroidJNI.CallStaticBooleanMethod(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_CallStaticShortMethod(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.Get<System.IntPtr>(false); var Arg2 = argHelper2.Get<UnityEngine.jvalue[]>(false); var result = UnityEngine.AndroidJNI.CallStaticShortMethod(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_CallStaticSByteMethod(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.Get<System.IntPtr>(false); var Arg2 = argHelper2.Get<UnityEngine.jvalue[]>(false); var result = UnityEngine.AndroidJNI.CallStaticSByteMethod(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_CallStaticCharMethod(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.Get<System.IntPtr>(false); var Arg2 = argHelper2.Get<UnityEngine.jvalue[]>(false); var result = UnityEngine.AndroidJNI.CallStaticCharMethod(Arg0,Arg1,Arg2); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_CallStaticFloatMethod(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.Get<System.IntPtr>(false); var Arg2 = argHelper2.Get<UnityEngine.jvalue[]>(false); var result = UnityEngine.AndroidJNI.CallStaticFloatMethod(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_CallStaticDoubleMethod(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.Get<System.IntPtr>(false); var Arg2 = argHelper2.Get<UnityEngine.jvalue[]>(false); var result = UnityEngine.AndroidJNI.CallStaticDoubleMethod(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_CallStaticLongMethod(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.Get<System.IntPtr>(false); var Arg2 = argHelper2.Get<UnityEngine.jvalue[]>(false); var result = UnityEngine.AndroidJNI.CallStaticLongMethod(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnBigInt(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_CallStaticVoidMethod(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.Get<System.IntPtr>(false); var Arg2 = argHelper2.Get<UnityEngine.jvalue[]>(false); UnityEngine.AndroidJNI.CallStaticVoidMethod(Arg0,Arg1,Arg2); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetStaticStringField(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.Get<System.IntPtr>(false); var result = UnityEngine.AndroidJNI.GetStaticStringField(Arg0,Arg1); Puerts.PuertsDLL.ReturnString(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetStaticObjectField(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.Get<System.IntPtr>(false); var result = UnityEngine.AndroidJNI.GetStaticObjectField(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetStaticBooleanField(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.Get<System.IntPtr>(false); var result = UnityEngine.AndroidJNI.GetStaticBooleanField(Arg0,Arg1); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetStaticSByteField(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.Get<System.IntPtr>(false); var result = UnityEngine.AndroidJNI.GetStaticSByteField(Arg0,Arg1); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetStaticCharField(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.Get<System.IntPtr>(false); var result = UnityEngine.AndroidJNI.GetStaticCharField(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetStaticShortField(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.Get<System.IntPtr>(false); var result = UnityEngine.AndroidJNI.GetStaticShortField(Arg0,Arg1); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetStaticIntField(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.Get<System.IntPtr>(false); var result = UnityEngine.AndroidJNI.GetStaticIntField(Arg0,Arg1); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetStaticLongField(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.Get<System.IntPtr>(false); var result = UnityEngine.AndroidJNI.GetStaticLongField(Arg0,Arg1); Puerts.PuertsDLL.ReturnBigInt(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetStaticFloatField(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.Get<System.IntPtr>(false); var result = UnityEngine.AndroidJNI.GetStaticFloatField(Arg0,Arg1); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetStaticDoubleField(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.Get<System.IntPtr>(false); var result = UnityEngine.AndroidJNI.GetStaticDoubleField(Arg0,Arg1); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_SetStaticStringField(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.Get<System.IntPtr>(false); var Arg2 = argHelper2.GetString(false); UnityEngine.AndroidJNI.SetStaticStringField(Arg0,Arg1,Arg2); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_SetStaticObjectField(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.Get<System.IntPtr>(false); var Arg2 = argHelper2.Get<System.IntPtr>(false); UnityEngine.AndroidJNI.SetStaticObjectField(Arg0,Arg1,Arg2); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_SetStaticBooleanField(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.Get<System.IntPtr>(false); var Arg2 = argHelper2.GetBoolean(false); UnityEngine.AndroidJNI.SetStaticBooleanField(Arg0,Arg1,Arg2); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_SetStaticSByteField(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.Get<System.IntPtr>(false); var Arg2 = argHelper2.GetSByte(false); UnityEngine.AndroidJNI.SetStaticSByteField(Arg0,Arg1,Arg2); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_SetStaticCharField(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.Get<System.IntPtr>(false); var Arg2 = argHelper2.Get<System.Char>(false); UnityEngine.AndroidJNI.SetStaticCharField(Arg0,Arg1,Arg2); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_SetStaticShortField(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.Get<System.IntPtr>(false); var Arg2 = argHelper2.GetInt16(false); UnityEngine.AndroidJNI.SetStaticShortField(Arg0,Arg1,Arg2); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_SetStaticIntField(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.Get<System.IntPtr>(false); var Arg2 = argHelper2.GetInt32(false); UnityEngine.AndroidJNI.SetStaticIntField(Arg0,Arg1,Arg2); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_SetStaticLongField(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.Get<System.IntPtr>(false); var Arg2 = argHelper2.GetInt64(false); UnityEngine.AndroidJNI.SetStaticLongField(Arg0,Arg1,Arg2); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_SetStaticFloatField(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.Get<System.IntPtr>(false); var Arg2 = argHelper2.GetFloat(false); UnityEngine.AndroidJNI.SetStaticFloatField(Arg0,Arg1,Arg2); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_SetStaticDoubleField(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.Get<System.IntPtr>(false); var Arg2 = argHelper2.GetDouble(false); UnityEngine.AndroidJNI.SetStaticDoubleField(Arg0,Arg1,Arg2); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_ToBooleanArray(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<bool[]>(false); var result = UnityEngine.AndroidJNI.ToBooleanArray(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_ToSByteArray(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<sbyte[]>(false); var result = UnityEngine.AndroidJNI.ToSByteArray(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_ToCharArray(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.Char[]>(false); var result = UnityEngine.AndroidJNI.ToCharArray(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_ToShortArray(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<short[]>(false); var result = UnityEngine.AndroidJNI.ToShortArray(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_ToIntArray(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<int[]>(false); var result = UnityEngine.AndroidJNI.ToIntArray(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_ToLongArray(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<long[]>(false); var result = UnityEngine.AndroidJNI.ToLongArray(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_ToFloatArray(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<float[]>(false); var result = UnityEngine.AndroidJNI.ToFloatArray(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_ToDoubleArray(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<double[]>(false); var result = UnityEngine.AndroidJNI.ToDoubleArray(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_ToObjectArray(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.IntPtr[]), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(System.IntPtr), false, false)) { var Arg0 = argHelper0.Get<System.IntPtr[]>(false); var Arg1 = argHelper1.Get<System.IntPtr>(false); var result = UnityEngine.AndroidJNI.ToObjectArray(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.IntPtr[]), false, false)) { var Arg0 = argHelper0.Get<System.IntPtr[]>(false); var result = UnityEngine.AndroidJNI.ToObjectArray(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to ToObjectArray"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_FromBooleanArray(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var result = UnityEngine.AndroidJNI.FromBooleanArray(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_FromSByteArray(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var result = UnityEngine.AndroidJNI.FromSByteArray(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_FromCharArray(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var result = UnityEngine.AndroidJNI.FromCharArray(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_FromShortArray(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var result = UnityEngine.AndroidJNI.FromShortArray(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_FromIntArray(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var result = UnityEngine.AndroidJNI.FromIntArray(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_FromLongArray(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var result = UnityEngine.AndroidJNI.FromLongArray(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_FromFloatArray(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var result = UnityEngine.AndroidJNI.FromFloatArray(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_FromDoubleArray(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var result = UnityEngine.AndroidJNI.FromDoubleArray(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_FromObjectArray(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var result = UnityEngine.AndroidJNI.FromObjectArray(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetArrayLength(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var result = UnityEngine.AndroidJNI.GetArrayLength(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_NewBooleanArray(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); var result = UnityEngine.AndroidJNI.NewBooleanArray(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_NewSByteArray(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); var result = UnityEngine.AndroidJNI.NewSByteArray(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_NewCharArray(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); var result = UnityEngine.AndroidJNI.NewCharArray(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_NewShortArray(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); var result = UnityEngine.AndroidJNI.NewShortArray(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_NewIntArray(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); var result = UnityEngine.AndroidJNI.NewIntArray(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_NewLongArray(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); var result = UnityEngine.AndroidJNI.NewLongArray(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_NewFloatArray(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); var result = UnityEngine.AndroidJNI.NewFloatArray(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_NewDoubleArray(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); var result = UnityEngine.AndroidJNI.NewDoubleArray(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_NewObjectArray(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<System.IntPtr>(false); var Arg2 = argHelper2.Get<System.IntPtr>(false); var result = UnityEngine.AndroidJNI.NewObjectArray(Arg0,Arg1,Arg2); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetBooleanArrayElement(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.GetInt32(false); var result = UnityEngine.AndroidJNI.GetBooleanArrayElement(Arg0,Arg1); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetSByteArrayElement(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.GetInt32(false); var result = UnityEngine.AndroidJNI.GetSByteArrayElement(Arg0,Arg1); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetCharArrayElement(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.GetInt32(false); var result = UnityEngine.AndroidJNI.GetCharArrayElement(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetShortArrayElement(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.GetInt32(false); var result = UnityEngine.AndroidJNI.GetShortArrayElement(Arg0,Arg1); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetIntArrayElement(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.GetInt32(false); var result = UnityEngine.AndroidJNI.GetIntArrayElement(Arg0,Arg1); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetLongArrayElement(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.GetInt32(false); var result = UnityEngine.AndroidJNI.GetLongArrayElement(Arg0,Arg1); Puerts.PuertsDLL.ReturnBigInt(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetFloatArrayElement(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.GetInt32(false); var result = UnityEngine.AndroidJNI.GetFloatArrayElement(Arg0,Arg1); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetDoubleArrayElement(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.GetInt32(false); var result = UnityEngine.AndroidJNI.GetDoubleArrayElement(Arg0,Arg1); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetObjectArrayElement(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.GetInt32(false); var result = UnityEngine.AndroidJNI.GetObjectArrayElement(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_SetBooleanArrayElement(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetBoolean(false); UnityEngine.AndroidJNI.SetBooleanArrayElement(Arg0,Arg1,Arg2); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_SetSByteArrayElement(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetSByte(false); UnityEngine.AndroidJNI.SetSByteArrayElement(Arg0,Arg1,Arg2); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_SetCharArrayElement(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.Get<System.Char>(false); UnityEngine.AndroidJNI.SetCharArrayElement(Arg0,Arg1,Arg2); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_SetShortArrayElement(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt16(false); UnityEngine.AndroidJNI.SetShortArrayElement(Arg0,Arg1,Arg2); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_SetIntArrayElement(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); UnityEngine.AndroidJNI.SetIntArrayElement(Arg0,Arg1,Arg2); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_SetLongArrayElement(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt64(false); UnityEngine.AndroidJNI.SetLongArrayElement(Arg0,Arg1,Arg2); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_SetFloatArrayElement(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetFloat(false); UnityEngine.AndroidJNI.SetFloatArrayElement(Arg0,Arg1,Arg2); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_SetDoubleArrayElement(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetDouble(false); UnityEngine.AndroidJNI.SetDoubleArrayElement(Arg0,Arg1,Arg2); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_SetObjectArrayElement(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.Get<System.IntPtr>(false); UnityEngine.AndroidJNI.SetObjectArrayElement(Arg0,Arg1,Arg2); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "AttachCurrentThread", IsStatic = true}, F_AttachCurrentThread }, { new Puerts.MethodKey {Name = "DetachCurrentThread", IsStatic = true}, F_DetachCurrentThread }, { new Puerts.MethodKey {Name = "GetVersion", IsStatic = true}, F_GetVersion }, { new Puerts.MethodKey {Name = "FindClass", IsStatic = true}, F_FindClass }, { new Puerts.MethodKey {Name = "FromReflectedMethod", IsStatic = true}, F_FromReflectedMethod }, { new Puerts.MethodKey {Name = "FromReflectedField", IsStatic = true}, F_FromReflectedField }, { new Puerts.MethodKey {Name = "ToReflectedMethod", IsStatic = true}, F_ToReflectedMethod }, { new Puerts.MethodKey {Name = "ToReflectedField", IsStatic = true}, F_ToReflectedField }, { new Puerts.MethodKey {Name = "GetSuperclass", IsStatic = true}, F_GetSuperclass }, { new Puerts.MethodKey {Name = "IsAssignableFrom", IsStatic = true}, F_IsAssignableFrom }, { new Puerts.MethodKey {Name = "Throw", IsStatic = true}, F_Throw }, { new Puerts.MethodKey {Name = "ThrowNew", IsStatic = true}, F_ThrowNew }, { new Puerts.MethodKey {Name = "ExceptionOccurred", IsStatic = true}, F_ExceptionOccurred }, { new Puerts.MethodKey {Name = "ExceptionDescribe", IsStatic = true}, F_ExceptionDescribe }, { new Puerts.MethodKey {Name = "ExceptionClear", IsStatic = true}, F_ExceptionClear }, { new Puerts.MethodKey {Name = "FatalError", IsStatic = true}, F_FatalError }, { new Puerts.MethodKey {Name = "PushLocalFrame", IsStatic = true}, F_PushLocalFrame }, { new Puerts.MethodKey {Name = "PopLocalFrame", IsStatic = true}, F_PopLocalFrame }, { new Puerts.MethodKey {Name = "NewGlobalRef", IsStatic = true}, F_NewGlobalRef }, { new Puerts.MethodKey {Name = "DeleteGlobalRef", IsStatic = true}, F_DeleteGlobalRef }, { new Puerts.MethodKey {Name = "NewWeakGlobalRef", IsStatic = true}, F_NewWeakGlobalRef }, { new Puerts.MethodKey {Name = "DeleteWeakGlobalRef", IsStatic = true}, F_DeleteWeakGlobalRef }, { new Puerts.MethodKey {Name = "NewLocalRef", IsStatic = true}, F_NewLocalRef }, { new Puerts.MethodKey {Name = "DeleteLocalRef", IsStatic = true}, F_DeleteLocalRef }, { new Puerts.MethodKey {Name = "IsSameObject", IsStatic = true}, F_IsSameObject }, { new Puerts.MethodKey {Name = "EnsureLocalCapacity", IsStatic = true}, F_EnsureLocalCapacity }, { new Puerts.MethodKey {Name = "AllocObject", IsStatic = true}, F_AllocObject }, { new Puerts.MethodKey {Name = "NewObject", IsStatic = true}, F_NewObject }, { new Puerts.MethodKey {Name = "GetObjectClass", IsStatic = true}, F_GetObjectClass }, { new Puerts.MethodKey {Name = "IsInstanceOf", IsStatic = true}, F_IsInstanceOf }, { new Puerts.MethodKey {Name = "GetMethodID", IsStatic = true}, F_GetMethodID }, { new Puerts.MethodKey {Name = "GetFieldID", IsStatic = true}, F_GetFieldID }, { new Puerts.MethodKey {Name = "GetStaticMethodID", IsStatic = true}, F_GetStaticMethodID }, { new Puerts.MethodKey {Name = "GetStaticFieldID", IsStatic = true}, F_GetStaticFieldID }, { new Puerts.MethodKey {Name = "NewString", IsStatic = true}, F_NewString }, { new Puerts.MethodKey {Name = "NewStringUTF", IsStatic = true}, F_NewStringUTF }, { new Puerts.MethodKey {Name = "GetStringChars", IsStatic = true}, F_GetStringChars }, { new Puerts.MethodKey {Name = "GetStringLength", IsStatic = true}, F_GetStringLength }, { new Puerts.MethodKey {Name = "GetStringUTFLength", IsStatic = true}, F_GetStringUTFLength }, { new Puerts.MethodKey {Name = "GetStringUTFChars", IsStatic = true}, F_GetStringUTFChars }, { new Puerts.MethodKey {Name = "CallStringMethod", IsStatic = true}, F_CallStringMethod }, { new Puerts.MethodKey {Name = "CallObjectMethod", IsStatic = true}, F_CallObjectMethod }, { new Puerts.MethodKey {Name = "CallIntMethod", IsStatic = true}, F_CallIntMethod }, { new Puerts.MethodKey {Name = "CallBooleanMethod", IsStatic = true}, F_CallBooleanMethod }, { new Puerts.MethodKey {Name = "CallShortMethod", IsStatic = true}, F_CallShortMethod }, { new Puerts.MethodKey {Name = "CallSByteMethod", IsStatic = true}, F_CallSByteMethod }, { new Puerts.MethodKey {Name = "CallCharMethod", IsStatic = true}, F_CallCharMethod }, { new Puerts.MethodKey {Name = "CallFloatMethod", IsStatic = true}, F_CallFloatMethod }, { new Puerts.MethodKey {Name = "CallDoubleMethod", IsStatic = true}, F_CallDoubleMethod }, { new Puerts.MethodKey {Name = "CallLongMethod", IsStatic = true}, F_CallLongMethod }, { new Puerts.MethodKey {Name = "CallVoidMethod", IsStatic = true}, F_CallVoidMethod }, { new Puerts.MethodKey {Name = "GetStringField", IsStatic = true}, F_GetStringField }, { new Puerts.MethodKey {Name = "GetObjectField", IsStatic = true}, F_GetObjectField }, { new Puerts.MethodKey {Name = "GetBooleanField", IsStatic = true}, F_GetBooleanField }, { new Puerts.MethodKey {Name = "GetSByteField", IsStatic = true}, F_GetSByteField }, { new Puerts.MethodKey {Name = "GetCharField", IsStatic = true}, F_GetCharField }, { new Puerts.MethodKey {Name = "GetShortField", IsStatic = true}, F_GetShortField }, { new Puerts.MethodKey {Name = "GetIntField", IsStatic = true}, F_GetIntField }, { new Puerts.MethodKey {Name = "GetLongField", IsStatic = true}, F_GetLongField }, { new Puerts.MethodKey {Name = "GetFloatField", IsStatic = true}, F_GetFloatField }, { new Puerts.MethodKey {Name = "GetDoubleField", IsStatic = true}, F_GetDoubleField }, { new Puerts.MethodKey {Name = "SetStringField", IsStatic = true}, F_SetStringField }, { new Puerts.MethodKey {Name = "SetObjectField", IsStatic = true}, F_SetObjectField }, { new Puerts.MethodKey {Name = "SetBooleanField", IsStatic = true}, F_SetBooleanField }, { new Puerts.MethodKey {Name = "SetSByteField", IsStatic = true}, F_SetSByteField }, { new Puerts.MethodKey {Name = "SetCharField", IsStatic = true}, F_SetCharField }, { new Puerts.MethodKey {Name = "SetShortField", IsStatic = true}, F_SetShortField }, { new Puerts.MethodKey {Name = "SetIntField", IsStatic = true}, F_SetIntField }, { new Puerts.MethodKey {Name = "SetLongField", IsStatic = true}, F_SetLongField }, { new Puerts.MethodKey {Name = "SetFloatField", IsStatic = true}, F_SetFloatField }, { new Puerts.MethodKey {Name = "SetDoubleField", IsStatic = true}, F_SetDoubleField }, { new Puerts.MethodKey {Name = "CallStaticStringMethod", IsStatic = true}, F_CallStaticStringMethod }, { new Puerts.MethodKey {Name = "CallStaticObjectMethod", IsStatic = true}, F_CallStaticObjectMethod }, { new Puerts.MethodKey {Name = "CallStaticIntMethod", IsStatic = true}, F_CallStaticIntMethod }, { new Puerts.MethodKey {Name = "CallStaticBooleanMethod", IsStatic = true}, F_CallStaticBooleanMethod }, { new Puerts.MethodKey {Name = "CallStaticShortMethod", IsStatic = true}, F_CallStaticShortMethod }, { new Puerts.MethodKey {Name = "CallStaticSByteMethod", IsStatic = true}, F_CallStaticSByteMethod }, { new Puerts.MethodKey {Name = "CallStaticCharMethod", IsStatic = true}, F_CallStaticCharMethod }, { new Puerts.MethodKey {Name = "CallStaticFloatMethod", IsStatic = true}, F_CallStaticFloatMethod }, { new Puerts.MethodKey {Name = "CallStaticDoubleMethod", IsStatic = true}, F_CallStaticDoubleMethod }, { new Puerts.MethodKey {Name = "CallStaticLongMethod", IsStatic = true}, F_CallStaticLongMethod }, { new Puerts.MethodKey {Name = "CallStaticVoidMethod", IsStatic = true}, F_CallStaticVoidMethod }, { new Puerts.MethodKey {Name = "GetStaticStringField", IsStatic = true}, F_GetStaticStringField }, { new Puerts.MethodKey {Name = "GetStaticObjectField", IsStatic = true}, F_GetStaticObjectField }, { new Puerts.MethodKey {Name = "GetStaticBooleanField", IsStatic = true}, F_GetStaticBooleanField }, { new Puerts.MethodKey {Name = "GetStaticSByteField", IsStatic = true}, F_GetStaticSByteField }, { new Puerts.MethodKey {Name = "GetStaticCharField", IsStatic = true}, F_GetStaticCharField }, { new Puerts.MethodKey {Name = "GetStaticShortField", IsStatic = true}, F_GetStaticShortField }, { new Puerts.MethodKey {Name = "GetStaticIntField", IsStatic = true}, F_GetStaticIntField }, { new Puerts.MethodKey {Name = "GetStaticLongField", IsStatic = true}, F_GetStaticLongField }, { new Puerts.MethodKey {Name = "GetStaticFloatField", IsStatic = true}, F_GetStaticFloatField }, { new Puerts.MethodKey {Name = "GetStaticDoubleField", IsStatic = true}, F_GetStaticDoubleField }, { new Puerts.MethodKey {Name = "SetStaticStringField", IsStatic = true}, F_SetStaticStringField }, { new Puerts.MethodKey {Name = "SetStaticObjectField", IsStatic = true}, F_SetStaticObjectField }, { new Puerts.MethodKey {Name = "SetStaticBooleanField", IsStatic = true}, F_SetStaticBooleanField }, { new Puerts.MethodKey {Name = "SetStaticSByteField", IsStatic = true}, F_SetStaticSByteField }, { new Puerts.MethodKey {Name = "SetStaticCharField", IsStatic = true}, F_SetStaticCharField }, { new Puerts.MethodKey {Name = "SetStaticShortField", IsStatic = true}, F_SetStaticShortField }, { new Puerts.MethodKey {Name = "SetStaticIntField", IsStatic = true}, F_SetStaticIntField }, { new Puerts.MethodKey {Name = "SetStaticLongField", IsStatic = true}, F_SetStaticLongField }, { new Puerts.MethodKey {Name = "SetStaticFloatField", IsStatic = true}, F_SetStaticFloatField }, { new Puerts.MethodKey {Name = "SetStaticDoubleField", IsStatic = true}, F_SetStaticDoubleField }, { new Puerts.MethodKey {Name = "ToBooleanArray", IsStatic = true}, F_ToBooleanArray }, { new Puerts.MethodKey {Name = "ToSByteArray", IsStatic = true}, F_ToSByteArray }, { new Puerts.MethodKey {Name = "ToCharArray", IsStatic = true}, F_ToCharArray }, { new Puerts.MethodKey {Name = "ToShortArray", IsStatic = true}, F_ToShortArray }, { new Puerts.MethodKey {Name = "ToIntArray", IsStatic = true}, F_ToIntArray }, { new Puerts.MethodKey {Name = "ToLongArray", IsStatic = true}, F_ToLongArray }, { new Puerts.MethodKey {Name = "ToFloatArray", IsStatic = true}, F_ToFloatArray }, { new Puerts.MethodKey {Name = "ToDoubleArray", IsStatic = true}, F_ToDoubleArray }, { new Puerts.MethodKey {Name = "ToObjectArray", IsStatic = true}, F_ToObjectArray }, { new Puerts.MethodKey {Name = "FromBooleanArray", IsStatic = true}, F_FromBooleanArray }, { new Puerts.MethodKey {Name = "FromSByteArray", IsStatic = true}, F_FromSByteArray }, { new Puerts.MethodKey {Name = "FromCharArray", IsStatic = true}, F_FromCharArray }, { new Puerts.MethodKey {Name = "FromShortArray", IsStatic = true}, F_FromShortArray }, { new Puerts.MethodKey {Name = "FromIntArray", IsStatic = true}, F_FromIntArray }, { new Puerts.MethodKey {Name = "FromLongArray", IsStatic = true}, F_FromLongArray }, { new Puerts.MethodKey {Name = "FromFloatArray", IsStatic = true}, F_FromFloatArray }, { new Puerts.MethodKey {Name = "FromDoubleArray", IsStatic = true}, F_FromDoubleArray }, { new Puerts.MethodKey {Name = "FromObjectArray", IsStatic = true}, F_FromObjectArray }, { new Puerts.MethodKey {Name = "GetArrayLength", IsStatic = true}, F_GetArrayLength }, { new Puerts.MethodKey {Name = "NewBooleanArray", IsStatic = true}, F_NewBooleanArray }, { new Puerts.MethodKey {Name = "NewSByteArray", IsStatic = true}, F_NewSByteArray }, { new Puerts.MethodKey {Name = "NewCharArray", IsStatic = true}, F_NewCharArray }, { new Puerts.MethodKey {Name = "NewShortArray", IsStatic = true}, F_NewShortArray }, { new Puerts.MethodKey {Name = "NewIntArray", IsStatic = true}, F_NewIntArray }, { new Puerts.MethodKey {Name = "NewLongArray", IsStatic = true}, F_NewLongArray }, { new Puerts.MethodKey {Name = "NewFloatArray", IsStatic = true}, F_NewFloatArray }, { new Puerts.MethodKey {Name = "NewDoubleArray", IsStatic = true}, F_NewDoubleArray }, { new Puerts.MethodKey {Name = "NewObjectArray", IsStatic = true}, F_NewObjectArray }, { new Puerts.MethodKey {Name = "GetBooleanArrayElement", IsStatic = true}, F_GetBooleanArrayElement }, { new Puerts.MethodKey {Name = "GetSByteArrayElement", IsStatic = true}, F_GetSByteArrayElement }, { new Puerts.MethodKey {Name = "GetCharArrayElement", IsStatic = true}, F_GetCharArrayElement }, { new Puerts.MethodKey {Name = "GetShortArrayElement", IsStatic = true}, F_GetShortArrayElement }, { new Puerts.MethodKey {Name = "GetIntArrayElement", IsStatic = true}, F_GetIntArrayElement }, { new Puerts.MethodKey {Name = "GetLongArrayElement", IsStatic = true}, F_GetLongArrayElement }, { new Puerts.MethodKey {Name = "GetFloatArrayElement", IsStatic = true}, F_GetFloatArrayElement }, { new Puerts.MethodKey {Name = "GetDoubleArrayElement", IsStatic = true}, F_GetDoubleArrayElement }, { new Puerts.MethodKey {Name = "GetObjectArrayElement", IsStatic = true}, F_GetObjectArrayElement }, { new Puerts.MethodKey {Name = "SetBooleanArrayElement", IsStatic = true}, F_SetBooleanArrayElement }, { new Puerts.MethodKey {Name = "SetSByteArrayElement", IsStatic = true}, F_SetSByteArrayElement }, { new Puerts.MethodKey {Name = "SetCharArrayElement", IsStatic = true}, F_SetCharArrayElement }, { new Puerts.MethodKey {Name = "SetShortArrayElement", IsStatic = true}, F_SetShortArrayElement }, { new Puerts.MethodKey {Name = "SetIntArrayElement", IsStatic = true}, F_SetIntArrayElement }, { new Puerts.MethodKey {Name = "SetLongArrayElement", IsStatic = true}, F_SetLongArrayElement }, { new Puerts.MethodKey {Name = "SetFloatArrayElement", IsStatic = true}, F_SetFloatArrayElement }, { new Puerts.MethodKey {Name = "SetDoubleArrayElement", IsStatic = true}, F_SetDoubleArrayElement }, { new Puerts.MethodKey {Name = "SetObjectArrayElement", IsStatic = true}, F_SetObjectArrayElement }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { } }; } } } <|start_filename|>Projects/Go_json/gen/src/cfg/test.TbSingleton.go<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg import "errors" type TestTbSingleton struct { _data *TestDemoSingletonType } func NewTestTbSingleton(_buf []map[string]interface{}) (*TestTbSingleton, error) { if len(_buf) != 1 { return nil, errors.New(" size != 1 ") } else { if _v, err2 := DeserializeTestDemoSingletonType(_buf[0]); err2 != nil { return nil, err2 } else { return &TestTbSingleton{_data:_v}, nil } } } func (table *TestTbSingleton) Get() *TestDemoSingletonType { return table._data } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_Sprite_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_Sprite_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.Sprite constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetPhysicsShapeCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Sprite; { { var result = obj.GetPhysicsShapeCount(); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetPhysicsShapePointCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Sprite; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); var result = obj.GetPhysicsShapePointCount(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetPhysicsShape(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Sprite; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<System.Collections.Generic.List<UnityEngine.Vector2>>(false); var result = obj.GetPhysicsShape(Arg0,Arg1); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_OverridePhysicsShape(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Sprite; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.Collections.Generic.IList<UnityEngine.Vector2[]>>(false); obj.OverridePhysicsShape(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_OverrideGeometry(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Sprite; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<UnityEngine.Vector2[]>(false); var Arg1 = argHelper1.Get<ushort[]>(false); obj.OverrideGeometry(Arg0,Arg1); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_Create(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 8) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); var argHelper7 = new Puerts.ArgumentHelper((int)data, isolate, info, 7); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture2D), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector4), false, false) && argHelper7.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Texture2D>(false); var Arg1 = argHelper1.Get<UnityEngine.Rect>(false); var Arg2 = argHelper2.Get<UnityEngine.Vector2>(false); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.GetUInt32(false); var Arg5 = (UnityEngine.SpriteMeshType)argHelper5.GetInt32(false); var Arg6 = argHelper6.Get<UnityEngine.Vector4>(false); var Arg7 = argHelper7.GetBoolean(false); var result = UnityEngine.Sprite.Create(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 7) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture2D), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector4), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Texture2D>(false); var Arg1 = argHelper1.Get<UnityEngine.Rect>(false); var Arg2 = argHelper2.Get<UnityEngine.Vector2>(false); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.GetUInt32(false); var Arg5 = (UnityEngine.SpriteMeshType)argHelper5.GetInt32(false); var Arg6 = argHelper6.Get<UnityEngine.Vector4>(false); var result = UnityEngine.Sprite.Create(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 6) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture2D), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Texture2D>(false); var Arg1 = argHelper1.Get<UnityEngine.Rect>(false); var Arg2 = argHelper2.Get<UnityEngine.Vector2>(false); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.GetUInt32(false); var Arg5 = (UnityEngine.SpriteMeshType)argHelper5.GetInt32(false); var result = UnityEngine.Sprite.Create(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture2D), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Texture2D>(false); var Arg1 = argHelper1.Get<UnityEngine.Rect>(false); var Arg2 = argHelper2.Get<UnityEngine.Vector2>(false); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.GetUInt32(false); var result = UnityEngine.Sprite.Create(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture2D), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Texture2D>(false); var Arg1 = argHelper1.Get<UnityEngine.Rect>(false); var Arg2 = argHelper2.Get<UnityEngine.Vector2>(false); var Arg3 = argHelper3.GetFloat(false); var result = UnityEngine.Sprite.Create(Arg0,Arg1,Arg2,Arg3); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture2D), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Texture2D>(false); var Arg1 = argHelper1.Get<UnityEngine.Rect>(false); var Arg2 = argHelper2.Get<UnityEngine.Vector2>(false); var result = UnityEngine.Sprite.Create(Arg0,Arg1,Arg2); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to Create"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_bounds(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Sprite; var result = obj.bounds; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_rect(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Sprite; var result = obj.rect; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_border(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Sprite; var result = obj.border; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_texture(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Sprite; var result = obj.texture; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_pixelsPerUnit(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Sprite; var result = obj.pixelsPerUnit; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_spriteAtlasTextureScale(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Sprite; var result = obj.spriteAtlasTextureScale; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_associatedAlphaSplitTexture(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Sprite; var result = obj.associatedAlphaSplitTexture; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_pivot(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Sprite; var result = obj.pivot; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_packed(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Sprite; var result = obj.packed; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_packingMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Sprite; var result = obj.packingMode; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_packingRotation(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Sprite; var result = obj.packingRotation; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_textureRect(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Sprite; var result = obj.textureRect; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_textureRectOffset(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Sprite; var result = obj.textureRectOffset; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_vertices(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Sprite; var result = obj.vertices; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_triangles(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Sprite; var result = obj.triangles; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_uv(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Sprite; var result = obj.uv; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "GetPhysicsShapeCount", IsStatic = false}, M_GetPhysicsShapeCount }, { new Puerts.MethodKey {Name = "GetPhysicsShapePointCount", IsStatic = false}, M_GetPhysicsShapePointCount }, { new Puerts.MethodKey {Name = "GetPhysicsShape", IsStatic = false}, M_GetPhysicsShape }, { new Puerts.MethodKey {Name = "OverridePhysicsShape", IsStatic = false}, M_OverridePhysicsShape }, { new Puerts.MethodKey {Name = "OverrideGeometry", IsStatic = false}, M_OverrideGeometry }, { new Puerts.MethodKey {Name = "Create", IsStatic = true}, F_Create }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"bounds", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_bounds, Setter = null} }, {"rect", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_rect, Setter = null} }, {"border", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_border, Setter = null} }, {"texture", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_texture, Setter = null} }, {"pixelsPerUnit", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_pixelsPerUnit, Setter = null} }, {"spriteAtlasTextureScale", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_spriteAtlasTextureScale, Setter = null} }, {"associatedAlphaSplitTexture", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_associatedAlphaSplitTexture, Setter = null} }, {"pivot", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_pivot, Setter = null} }, {"packed", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_packed, Setter = null} }, {"packingMode", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_packingMode, Setter = null} }, {"packingRotation", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_packingRotation, Setter = null} }, {"textureRect", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_textureRect, Setter = null} }, {"textureRectOffset", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_textureRectOffset, Setter = null} }, {"vertices", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_vertices, Setter = null} }, {"triangles", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_triangles, Setter = null} }, {"uv", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_uv, Setter = null} }, } }; } } } <|start_filename|>ProtoProjects/Csharp_Unity/Assets/Bright.Net/Codecs/Rpc.cs<|end_filename|> using Bright.Serialization; using Bright.Threading; namespace Bright.Net.Codecs { public abstract class Rpc : Protocol { private readonly static AtomicLong s_nextRpcId = new AtomicLong(); public static long AllocNextRpcId() => s_nextRpcId.IncrementAndGet(); public long RpcId { get; protected set; } public bool IsRequest { get; protected set; } public abstract BeanBase ObjArg { get; protected set; } public abstract BeanBase ObjRes { get; protected set; } public void InitAsObjRequest(BeanBase arg) { RpcId = AllocNextRpcId(); IsRequest = true; ObjArg = arg; } public void InitAsObjResponse(long rpcId, BeanBase res) { RpcId = rpcId; IsRequest = false; ObjRes = res; } } public abstract class Rpc<TArg, TRes> : Rpc where TArg : BeanBase, new() where TRes : BeanBase, new() { public override BeanBase ObjArg { get => Arg; protected set => Arg = (TArg)value; } public override BeanBase ObjRes { get => Res; protected set => Res = (TRes)value; } public TArg Arg { get; set; } public TRes Res { get; set; } public void InitAsRequest(TArg arg) { RpcId = AllocNextRpcId(); IsRequest = true; Arg = arg; } public void InitAsResponse(long rpcId, TRes res) { RpcId = rpcId; IsRequest = false; ObjRes = res; } public sealed override void Serialize(ByteBuf buf) { if (IsRequest) { buf.WriteLong((RpcId << 1)); Arg.Serialize(buf); } else { buf.WriteLong((RpcId << 1) | 1L); Res.Serialize(buf); } } public sealed override void Deserialize(ByteBuf buf) { long rpcIdAndRequest = buf.ReadLong(); RpcId = rpcIdAndRequest >> 1; IsRequest = (rpcIdAndRequest & 0x1L) == 0; if (IsRequest) { var a = new TArg(); a.Deserialize(buf); Arg = a; } else { var r = new TRes(); r.Deserialize(buf); Res = r; } } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_ParticleSystem_TriggerModule_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_ParticleSystem_TriggerModule_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.ParticleSystem.TriggerModule constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_AddCollider(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.TriggerModule)Puerts.Utils.GetSelf((int)data, self); { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Component>(false); obj.AddCollider(Arg0); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_RemoveCollider(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.TriggerModule)Puerts.Utils.GetSelf((int)data, self); if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); obj.RemoveCollider(Arg0); Puerts.Utils.SetSelf((int)data, self, obj); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Component), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Component>(false); obj.RemoveCollider(Arg0); Puerts.Utils.SetSelf((int)data, self, obj); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to RemoveCollider"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetCollider(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.TriggerModule)Puerts.Utils.GetSelf((int)data, self); { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.Component>(false); obj.SetCollider(Arg0,Arg1); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetCollider(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.TriggerModule)Puerts.Utils.GetSelf((int)data, self); { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); var result = obj.GetCollider(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_enabled(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.TriggerModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.enabled; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_enabled(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.TriggerModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.enabled = argHelper.GetBoolean(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_inside(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.TriggerModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.inside; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_inside(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.TriggerModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.inside = (UnityEngine.ParticleSystemOverlapAction)argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_outside(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.TriggerModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.outside; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_outside(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.TriggerModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.outside = (UnityEngine.ParticleSystemOverlapAction)argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_enter(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.TriggerModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.enter; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_enter(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.TriggerModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.enter = (UnityEngine.ParticleSystemOverlapAction)argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_exit(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.TriggerModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.exit; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_exit(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.TriggerModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.exit = (UnityEngine.ParticleSystemOverlapAction)argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_colliderQueryMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.TriggerModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.colliderQueryMode; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_colliderQueryMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.TriggerModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.colliderQueryMode = (UnityEngine.ParticleSystemColliderQueryMode)argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_radiusScale(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.TriggerModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.radiusScale; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_radiusScale(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.TriggerModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.radiusScale = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_colliderCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.TriggerModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.colliderCount; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "AddCollider", IsStatic = false}, M_AddCollider }, { new Puerts.MethodKey {Name = "RemoveCollider", IsStatic = false}, M_RemoveCollider }, { new Puerts.MethodKey {Name = "SetCollider", IsStatic = false}, M_SetCollider }, { new Puerts.MethodKey {Name = "GetCollider", IsStatic = false}, M_GetCollider }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"enabled", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_enabled, Setter = S_enabled} }, {"inside", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_inside, Setter = S_inside} }, {"outside", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_outside, Setter = S_outside} }, {"enter", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_enter, Setter = S_enter} }, {"exit", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_exit, Setter = S_exit} }, {"colliderQueryMode", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_colliderQueryMode, Setter = S_colliderQueryMode} }, {"radiusScale", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_radiusScale, Setter = S_radiusScale} }, {"colliderCount", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_colliderCount, Setter = null} }, } }; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_ContactFilter2D_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_ContactFilter2D_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.ContactFilter2D constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_NoFilter(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ContactFilter2D)Puerts.Utils.GetSelf((int)data, self); { { var result = obj.NoFilter(); Puerts.ResultHelper.Set((int)data, isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ClearLayerMask(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ContactFilter2D)Puerts.Utils.GetSelf((int)data, self); { { obj.ClearLayerMask(); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetLayerMask(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ContactFilter2D)Puerts.Utils.GetSelf((int)data, self); { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.LayerMask>(false); obj.SetLayerMask(Arg0); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ClearDepth(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ContactFilter2D)Puerts.Utils.GetSelf((int)data, self); { { obj.ClearDepth(); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetDepth(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ContactFilter2D)Puerts.Utils.GetSelf((int)data, self); { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.GetFloat(false); obj.SetDepth(Arg0,Arg1); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ClearNormalAngle(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ContactFilter2D)Puerts.Utils.GetSelf((int)data, self); { { obj.ClearNormalAngle(); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetNormalAngle(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ContactFilter2D)Puerts.Utils.GetSelf((int)data, self); { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.GetFloat(false); obj.SetNormalAngle(Arg0,Arg1); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_IsFilteringTrigger(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ContactFilter2D)Puerts.Utils.GetSelf((int)data, self); { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Collider2D>(false); var result = obj.IsFilteringTrigger(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_IsFilteringLayerMask(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ContactFilter2D)Puerts.Utils.GetSelf((int)data, self); { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.GameObject>(false); var result = obj.IsFilteringLayerMask(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_IsFilteringDepth(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ContactFilter2D)Puerts.Utils.GetSelf((int)data, self); { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.GameObject>(false); var result = obj.IsFilteringDepth(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_IsFilteringNormalAngle(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ContactFilter2D)Puerts.Utils.GetSelf((int)data, self); if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var result = obj.IsFilteringNormalAngle(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetFloat(false); var result = obj.IsFilteringNormalAngle(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to IsFilteringNormalAngle"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_isFiltering(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ContactFilter2D)Puerts.Utils.GetSelf((int)data, self); var result = obj.isFiltering; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_useTriggers(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ContactFilter2D)Puerts.Utils.GetSelf((int)data, self); var result = obj.useTriggers; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_useTriggers(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ContactFilter2D)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.useTriggers = argHelper.GetBoolean(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_useLayerMask(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ContactFilter2D)Puerts.Utils.GetSelf((int)data, self); var result = obj.useLayerMask; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_useLayerMask(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ContactFilter2D)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.useLayerMask = argHelper.GetBoolean(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_useDepth(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ContactFilter2D)Puerts.Utils.GetSelf((int)data, self); var result = obj.useDepth; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_useDepth(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ContactFilter2D)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.useDepth = argHelper.GetBoolean(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_useOutsideDepth(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ContactFilter2D)Puerts.Utils.GetSelf((int)data, self); var result = obj.useOutsideDepth; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_useOutsideDepth(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ContactFilter2D)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.useOutsideDepth = argHelper.GetBoolean(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_useNormalAngle(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ContactFilter2D)Puerts.Utils.GetSelf((int)data, self); var result = obj.useNormalAngle; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_useNormalAngle(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ContactFilter2D)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.useNormalAngle = argHelper.GetBoolean(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_useOutsideNormalAngle(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ContactFilter2D)Puerts.Utils.GetSelf((int)data, self); var result = obj.useOutsideNormalAngle; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_useOutsideNormalAngle(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ContactFilter2D)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.useOutsideNormalAngle = argHelper.GetBoolean(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_layerMask(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ContactFilter2D)Puerts.Utils.GetSelf((int)data, self); var result = obj.layerMask; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_layerMask(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ContactFilter2D)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.layerMask = argHelper.Get<UnityEngine.LayerMask>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_minDepth(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ContactFilter2D)Puerts.Utils.GetSelf((int)data, self); var result = obj.minDepth; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_minDepth(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ContactFilter2D)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.minDepth = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_maxDepth(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ContactFilter2D)Puerts.Utils.GetSelf((int)data, self); var result = obj.maxDepth; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_maxDepth(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ContactFilter2D)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.maxDepth = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_minNormalAngle(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ContactFilter2D)Puerts.Utils.GetSelf((int)data, self); var result = obj.minNormalAngle; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_minNormalAngle(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ContactFilter2D)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.minNormalAngle = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_maxNormalAngle(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ContactFilter2D)Puerts.Utils.GetSelf((int)data, self); var result = obj.maxNormalAngle; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_maxNormalAngle(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ContactFilter2D)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.maxNormalAngle = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_NormalAngleUpperLimit(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.ContactFilter2D.NormalAngleUpperLimit; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "NoFilter", IsStatic = false}, M_NoFilter }, { new Puerts.MethodKey {Name = "ClearLayerMask", IsStatic = false}, M_ClearLayerMask }, { new Puerts.MethodKey {Name = "SetLayerMask", IsStatic = false}, M_SetLayerMask }, { new Puerts.MethodKey {Name = "ClearDepth", IsStatic = false}, M_ClearDepth }, { new Puerts.MethodKey {Name = "SetDepth", IsStatic = false}, M_SetDepth }, { new Puerts.MethodKey {Name = "ClearNormalAngle", IsStatic = false}, M_ClearNormalAngle }, { new Puerts.MethodKey {Name = "SetNormalAngle", IsStatic = false}, M_SetNormalAngle }, { new Puerts.MethodKey {Name = "IsFilteringTrigger", IsStatic = false}, M_IsFilteringTrigger }, { new Puerts.MethodKey {Name = "IsFilteringLayerMask", IsStatic = false}, M_IsFilteringLayerMask }, { new Puerts.MethodKey {Name = "IsFilteringDepth", IsStatic = false}, M_IsFilteringDepth }, { new Puerts.MethodKey {Name = "IsFilteringNormalAngle", IsStatic = false}, M_IsFilteringNormalAngle }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"isFiltering", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_isFiltering, Setter = null} }, {"useTriggers", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_useTriggers, Setter = S_useTriggers} }, {"useLayerMask", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_useLayerMask, Setter = S_useLayerMask} }, {"useDepth", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_useDepth, Setter = S_useDepth} }, {"useOutsideDepth", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_useOutsideDepth, Setter = S_useOutsideDepth} }, {"useNormalAngle", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_useNormalAngle, Setter = S_useNormalAngle} }, {"useOutsideNormalAngle", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_useOutsideNormalAngle, Setter = S_useOutsideNormalAngle} }, {"layerMask", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_layerMask, Setter = S_layerMask} }, {"minDepth", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_minDepth, Setter = S_minDepth} }, {"maxDepth", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_maxDepth, Setter = S_maxDepth} }, {"minNormalAngle", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_minNormalAngle, Setter = S_minNormalAngle} }, {"maxNormalAngle", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_maxNormalAngle, Setter = S_maxNormalAngle} }, {"NormalAngleUpperLimit", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_NormalAngleUpperLimit, Setter = null} }, } }; } } } <|start_filename|>Projects/GenerateDatas/convert_lua/test.TbTestExcelBean/2.lua<|end_filename|> return { x1 = 2, x2 = "zz", x3 = 2, x4 = 4.3, } <|start_filename|>Projects/java_json/src/gen/cfg/ai/UeTimeLimit.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.ai; import com.google.gson.JsonElement; import com.google.gson.JsonObject; public final class UeTimeLimit extends cfg.ai.Decorator { public UeTimeLimit(JsonObject __json__) { super(__json__); limitTime = __json__.get("limit_time").getAsFloat(); } public UeTimeLimit(int id, String node_name, cfg.ai.EFlowAbortMode flow_abort_mode, float limit_time ) { super(id, node_name, flow_abort_mode); this.limitTime = limit_time; } public static UeTimeLimit deserializeUeTimeLimit(JsonObject __json__) { return new UeTimeLimit(__json__); } public final float limitTime; public static final int __ID__ = 338469720; @Override public int getTypeId() { return __ID__; } @Override public void resolve(java.util.HashMap<String, Object> _tables) { super.resolve(_tables); } @Override public String toString() { return "{ " + "id:" + id + "," + "nodeName:" + nodeName + "," + "flowAbortMode:" + flowAbortMode + "," + "limitTime:" + limitTime + "," + "}"; } } <|start_filename|>Projects/java_json/src/corelib/bright/serialization/AbstractBean.java<|end_filename|> package bright.serialization; public abstract class AbstractBean implements ISerializable, ITypeId { } <|start_filename|>Projects/Csharp_CustomTemplate_EncryptMemory/Gen/test/MultiRowRecord.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using System; using Newtonsoft.Json; using Scripts; namespace cfg.test { [Serializable] public partial class MultiRowRecord : AConfig { public string name { get; set; } public System.Collections.Generic.List<test.MultiRowType1> one_rows { get; set; } public System.Collections.Generic.List<test.MultiRowType1> multi_rows1 { get; set; } public test.MultiRowType1[] multi_rows2 { get; set; } public System.Collections.Generic.Dictionary<int, test.MultiRowType2> multi_rows4 { get; set; } public System.Collections.Generic.List<test.MultiRowType3> multi_rows5 { get; set; } public System.Collections.Generic.Dictionary<int, test.MultiRowType2> multi_rows6 { get; set; } public System.Collections.Generic.Dictionary<int, int> multi_rows7 { get; set; } public override void EndInit() { foreach(var _e in one_rows) { _e.EndInit(); } foreach(var _e in multi_rows1) { _e.EndInit(); } foreach(var _e in multi_rows2) { _e.EndInit(); } foreach(var _e in multi_rows5) { _e.EndInit(); } } public override string ToString() => JsonConvert.SerializeObject(this); } } <|start_filename|>Projects/Csharp_CustomTemplate_EncryptMemory/Gen/test/TestDesc.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using System; using Newtonsoft.Json; using Scripts; namespace cfg.test { [Serializable] public partial class TestDesc : AConfig { /// <summary> /// 禁止 /// </summary> public string name { get; set; } /// <summary> /// 测试换行<br/>第2行<br/>第3层 /// </summary> [JsonProperty("a1")] private int _a1 { get; set; } [JsonIgnore] public EncryptInt a1 { get; private set; } = new(); /// <summary> /// 测试转义 &lt; &amp; % / # &gt; /// </summary> [JsonProperty("a2")] private int _a2 { get; set; } [JsonIgnore] public EncryptInt a2 { get; private set; } = new(); [JsonProperty] public test.H1 x1 { get; set; } /// <summary> /// 这是x2 /// </summary> public System.Collections.Generic.List<test.H2> x2 { get; set; } public test.H2[] x3 { get; set; } public override void EndInit() { a1 = _a1; a2 = _a2; x1.EndInit(); foreach(var _e in x2) { _e.EndInit(); } foreach(var _e in x3) { _e.EndInit(); } } public override string ToString() => JsonConvert.SerializeObject(this); } } <|start_filename|>Projects/DataTemplates/template_erlang2/test_tbtestdesc.erl<|end_filename|> %% test.TbTestDesc -module(test_tbtestdesc) -export([get/1,get_ids/0]) get(1) -> #{ id => 1, name => "xxx", a1 => 0, a2 => 0, x1 => bean, x2 => array, x3 => array }. get_ids() -> [1]. <|start_filename|>Projects/DataTemplates/template_erlang/tag_tbtesttag.erl<|end_filename|> %% tag.TbTestTag get(2001) -> #{id => 2001,value => "导出"}. get(2004) -> #{id => 2004,value => "any"}. get(2003) -> #{id => 2003,value => "test"}. get(100) -> #{id => 100,value => "导出"}. get(1) -> #{id => 1,value => "导出"}. get(2) -> #{id => 2,value => "导出"}. get(6) -> #{id => 6,value => "导出"}. get(7) -> #{id => 7,value => "导出"}. get(9) -> #{id => 9,value => "测试"}. get(10) -> #{id => 10,value => "测试"}. get(11) -> #{id => 11,value => "any"}. get(12) -> #{id => 12,value => "导出"}. get(13) -> #{id => 13,value => "导出"}. get(104) -> #{id => 104,value => "any"}. get(102) -> #{id => 102,value => "test"}. get(3001) -> #{id => 3001,value => "export"}. get(3004) -> #{id => 3004,value => "any"}. get(3003) -> #{id => 3003,value => "test"}. <|start_filename|>Projects/Lua_Unity_xlua_lua/Assets/Lua/Gen/TbClazz.lua<|end_filename|> return { ['int'] = { _name='NormalClazz',name='int',desc='primity type:int',parents={},methods={},is_abstract=false,fields={},}, } <|start_filename|>Projects/java_json/src/gen/cfg/test/TestRef.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.test; import com.google.gson.JsonElement; import com.google.gson.JsonObject; public final class TestRef { public TestRef(JsonObject __json__) { id = __json__.get("id").getAsInt(); x1 = __json__.get("x1").getAsInt(); x12 = __json__.get("x1_2").getAsInt(); x2 = __json__.get("x2").getAsInt(); { com.google.gson.JsonArray _json0_ = __json__.get("a1").getAsJsonArray(); int _n = _json0_.size(); a1 = new int[_n]; int _index=0; for(JsonElement __e : _json0_) { int __v; __v = __e.getAsInt(); a1[_index++] = __v; } } { com.google.gson.JsonArray _json0_ = __json__.get("a2").getAsJsonArray(); int _n = _json0_.size(); a2 = new int[_n]; int _index=0; for(JsonElement __e : _json0_) { int __v; __v = __e.getAsInt(); a2[_index++] = __v; } } { com.google.gson.JsonArray _json0_ = __json__.get("b1").getAsJsonArray(); b1 = new java.util.ArrayList<Integer>(_json0_.size()); for(JsonElement __e : _json0_) { int __v; __v = __e.getAsInt(); b1.add(__v); } } { com.google.gson.JsonArray _json0_ = __json__.get("b2").getAsJsonArray(); b2 = new java.util.ArrayList<Integer>(_json0_.size()); for(JsonElement __e : _json0_) { int __v; __v = __e.getAsInt(); b2.add(__v); } } { com.google.gson.JsonArray _json0_ = __json__.get("c1").getAsJsonArray(); c1 = new java.util.HashSet<Integer>(_json0_.size()); for(JsonElement __e : _json0_) { int __v; __v = __e.getAsInt(); c1.add(__v); } } { com.google.gson.JsonArray _json0_ = __json__.get("c2").getAsJsonArray(); c2 = new java.util.HashSet<Integer>(_json0_.size()); for(JsonElement __e : _json0_) { int __v; __v = __e.getAsInt(); c2.add(__v); } } { com.google.gson.JsonArray _json0_ = __json__.get("d1").getAsJsonArray(); d1 = new java.util.HashMap<Integer, Integer>(_json0_.size()); for(JsonElement __e : _json0_) { int __k; __k = __e.getAsJsonArray().get(0).getAsInt(); int __v; __v = __e.getAsJsonArray().get(1).getAsInt(); d1.put(__k, __v); } } { com.google.gson.JsonArray _json0_ = __json__.get("d2").getAsJsonArray(); d2 = new java.util.HashMap<Integer, Integer>(_json0_.size()); for(JsonElement __e : _json0_) { int __k; __k = __e.getAsJsonArray().get(0).getAsInt(); int __v; __v = __e.getAsJsonArray().get(1).getAsInt(); d2.put(__k, __v); } } e1 = __json__.get("e1").getAsInt(); e2 = __json__.get("e2").getAsLong(); e3 = __json__.get("e3").getAsString(); f1 = __json__.get("f1").getAsInt(); f2 = __json__.get("f2").getAsLong(); f3 = __json__.get("f3").getAsString(); } public TestRef(int id, int x1, int x1_2, int x2, int[] a1, int[] a2, java.util.ArrayList<Integer> b1, java.util.ArrayList<Integer> b2, java.util.HashSet<Integer> c1, java.util.HashSet<Integer> c2, java.util.HashMap<Integer, Integer> d1, java.util.HashMap<Integer, Integer> d2, int e1, long e2, String e3, int f1, long f2, String f3 ) { this.id = id; this.x1 = x1; this.x12 = x1_2; this.x2 = x2; this.a1 = a1; this.a2 = a2; this.b1 = b1; this.b2 = b2; this.c1 = c1; this.c2 = c2; this.d1 = d1; this.d2 = d2; this.e1 = e1; this.e2 = e2; this.e3 = e3; this.f1 = f1; this.f2 = f2; this.f3 = f3; } public static TestRef deserializeTestRef(JsonObject __json__) { return new TestRef(__json__); } public final int id; public final int x1; public cfg.test.TestBeRef x1_Ref; public final int x12; public final int x2; public cfg.test.TestBeRef x2_Ref; public final int[] a1; public final int[] a2; public final java.util.ArrayList<Integer> b1; public final java.util.ArrayList<Integer> b2; public final java.util.HashSet<Integer> c1; public final java.util.HashSet<Integer> c2; public final java.util.HashMap<Integer, Integer> d1; public final java.util.HashMap<Integer, Integer> d2; public final int e1; public final long e2; public final String e3; public final int f1; public final long f2; public final String f3; public void resolve(java.util.HashMap<String, Object> _tables) { this.x1_Ref = ((cfg.test.TbTestBeRef)_tables.get("test.TbTestBeRef")).get(x1); this.x2_Ref = ((cfg.test.TbTestBeRef)_tables.get("test.TbTestBeRef")).get(x2); } @Override public String toString() { return "{ " + "id:" + id + "," + "x1:" + x1 + "," + "x12:" + x12 + "," + "x2:" + x2 + "," + "a1:" + a1 + "," + "a2:" + a2 + "," + "b1:" + b1 + "," + "b2:" + b2 + "," + "c1:" + c1 + "," + "c2:" + c2 + "," + "d1:" + d1 + "," + "d2:" + d2 + "," + "e1:" + e1 + "," + "e2:" + e2 + "," + "e3:" + e3 + "," + "f1:" + f1 + "," + "f2:" + f2 + "," + "f3:" + f3 + "," + "}"; } } <|start_filename|>Projects/GenerateDatas/convert_lua/mail.TbGlobalMail/21.lua<|end_filename|> return { id = 21, title = "测试1", sender = "系统", content = "测试内容1", award = { 1, }, all_server = true, server_list = { }, platform = "1", channel = "1", min_max_level = { min = 1, max = 120, }, register_time = { date_time_range = { start_time = 2020-5-10 00:00:00, end_time = 2020-5-20 00:00:00, }, }, mail_time = { date_time_range = { start_time = 2020-5-10 00:00:00, end_time = 2020-5-20 00:00:00, }, }, } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_UI_StencilMaterial_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_UI_StencilMaterial_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.UI.StencilMaterial constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_Add(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Material>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = (UnityEngine.Rendering.StencilOp)argHelper2.GetInt32(false); var Arg3 = (UnityEngine.Rendering.CompareFunction)argHelper3.GetInt32(false); var Arg4 = (UnityEngine.Rendering.ColorWriteMask)argHelper4.GetInt32(false); var result = UnityEngine.UI.StencilMaterial.Add(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 7) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Material>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = (UnityEngine.Rendering.StencilOp)argHelper2.GetInt32(false); var Arg3 = (UnityEngine.Rendering.CompareFunction)argHelper3.GetInt32(false); var Arg4 = (UnityEngine.Rendering.ColorWriteMask)argHelper4.GetInt32(false); var Arg5 = argHelper5.GetInt32(false); var Arg6 = argHelper6.GetInt32(false); var result = UnityEngine.UI.StencilMaterial.Add(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to Add"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_Remove(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Material>(false); UnityEngine.UI.StencilMaterial.Remove(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_ClearAll(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { { UnityEngine.UI.StencilMaterial.ClearAll(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "Add", IsStatic = true}, F_Add }, { new Puerts.MethodKey {Name = "Remove", IsStatic = true}, F_Remove }, { new Puerts.MethodKey {Name = "ClearAll", IsStatic = true}, F_ClearAll }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { } }; } } } <|start_filename|>Projects/DataTemplates/template_erlang2/test_tbdefinefromexcel2.erl<|end_filename|> %% test.TbDefineFromExcel2 -module(test_tbdefinefromexcel2) -export([get/1,get_ids/0]) get(10000) -> #{ id => 10000, x1 => true, x5 => 10, x6 => 1.28, x8 => 3, x10 => "huang", x13 => 1, x14 => bean, v2 => {"1","2"}, t1 => 935460549, k1 => array, k8 => map, k9 => array }. get(10001) -> #{ id => 10001, x1 => true, x5 => 10, x6 => 1.28, x8 => 5, x10 => "huang", x13 => 1, x14 => bean, v2 => {"1","2"}, t1 => 935460549, k1 => array, k8 => map, k9 => array }. get(10002) -> #{ id => 10002, x1 => true, x5 => 13234234234, x6 => 1.28, x8 => 6, x10 => "huang", x13 => 1, x14 => bean, v2 => {"1","2"}, t1 => 1577808000, k1 => array, k8 => map, k9 => array }. get(10003) -> #{ id => 10003, x1 => true, x5 => 13234234234, x6 => 1.28, x8 => 3, x10 => "huang", x13 => 1, x14 => bean, v2 => {"1","2"}, t1 => 933732549, k1 => array, k8 => map, k9 => array }. get(10004) -> #{ id => 10004, x1 => true, x5 => 13234234234, x6 => 1.28, x8 => 4, x10 => "huang", x13 => 1, x14 => bean, v2 => {"1","2"}, t1 => 1577808000, k1 => array, k8 => map, k9 => array }. get(10005) -> #{ id => 10005, x1 => true, x5 => 13234234234, x6 => 1.28, x8 => 5, x10 => "huang", x13 => 1, x14 => bean, v2 => {"1","2"}, t1 => 935460549, k1 => array, k8 => map, k9 => array }. get(10006) -> #{ id => 10006, x1 => true, x5 => 10, x6 => 1.28, x8 => 6, x10 => "", x13 => 2, x14 => bean, v2 => {"1","2"}, t1 => 1577808000, k1 => array, k8 => map, k9 => array }. get(10007) -> #{ id => 10007, x1 => true, x5 => 10, x6 => 1.28, x8 => 4, x10 => "xxx", x13 => 2, x14 => bean, v2 => {"1","2"}, t1 => 935460549, k1 => array, k8 => map, k9 => array }. get(10008) -> #{ id => 10008, x1 => true, x5 => 10, x6 => 1.28, x8 => 3, x10 => "xxx", x13 => 2, x14 => bean, v2 => {"1","2"}, t1 => 935460549, k1 => array, k8 => map, k9 => array }. get_ids() -> [10000,10001,10002,10003,10004,10005,10006,10007,10008]. <|start_filename|>Projects/Go_json/gen/src/cfg/test.TestBeRef.go<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg import "errors" type TestTestBeRef struct { Id int32 Count int32 } const TypeId_TestTestBeRef = 1934403938 func (*TestTestBeRef) GetTypeId() int32 { return 1934403938 } func (_v *TestTestBeRef)Deserialize(_buf map[string]interface{}) (err error) { { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["id"].(float64); !_ok_ { err = errors.New("id error"); return }; _v.Id = int32(_tempNum_) } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["count"].(float64); !_ok_ { err = errors.New("count error"); return }; _v.Count = int32(_tempNum_) } return } func DeserializeTestTestBeRef(_buf map[string]interface{}) (*TestTestBeRef, error) { v := &TestTestBeRef{} if err := v.Deserialize(_buf); err == nil { return v, nil } else { return nil, err } } <|start_filename|>Projects/Go_json/gen/src/cfg/ai.EFlowAbortMode.go<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg const ( AiEFlowAbortMode_NONE = 0 AiEFlowAbortMode_LOWER_PRIORITY = 1 AiEFlowAbortMode_SELF = 2 AiEFlowAbortMode_BOTH = 3 ) <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_Input_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_Input_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.Input(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.Input), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetAxis(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetString(false); var result = UnityEngine.Input.GetAxis(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetAxisRaw(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetString(false); var result = UnityEngine.Input.GetAxisRaw(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetButton(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetString(false); var result = UnityEngine.Input.GetButton(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetButtonDown(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetString(false); var result = UnityEngine.Input.GetButtonDown(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetButtonUp(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetString(false); var result = UnityEngine.Input.GetButtonUp(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetMouseButton(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); var result = UnityEngine.Input.GetMouseButton(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetMouseButtonDown(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); var result = UnityEngine.Input.GetMouseButtonDown(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetMouseButtonUp(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); var result = UnityEngine.Input.GetMouseButtonUp(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_ResetInputAxes(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { { UnityEngine.Input.ResetInputAxes(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetJoystickNames(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { { var result = UnityEngine.Input.GetJoystickNames(); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetTouch(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); var result = UnityEngine.Input.GetTouch(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetAccelerationEvent(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); var result = UnityEngine.Input.GetAccelerationEvent(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetKey(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = (UnityEngine.KeyCode)argHelper0.GetInt32(false); var result = UnityEngine.Input.GetKey(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var result = UnityEngine.Input.GetKey(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetKey"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetKeyUp(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = (UnityEngine.KeyCode)argHelper0.GetInt32(false); var result = UnityEngine.Input.GetKeyUp(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var result = UnityEngine.Input.GetKeyUp(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetKeyUp"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetKeyDown(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = (UnityEngine.KeyCode)argHelper0.GetInt32(false); var result = UnityEngine.Input.GetKeyDown(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var result = UnityEngine.Input.GetKeyDown(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetKeyDown"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_simulateMouseWithTouches(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Input.simulateMouseWithTouches; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_simulateMouseWithTouches(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.Input.simulateMouseWithTouches = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_anyKey(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Input.anyKey; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_anyKeyDown(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Input.anyKeyDown; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_inputString(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Input.inputString; Puerts.PuertsDLL.ReturnString(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_mousePosition(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Input.mousePosition; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_mouseScrollDelta(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Input.mouseScrollDelta; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_imeCompositionMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Input.imeCompositionMode; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_imeCompositionMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.Input.imeCompositionMode = (UnityEngine.IMECompositionMode)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_compositionString(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Input.compositionString; Puerts.PuertsDLL.ReturnString(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_imeIsSelected(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Input.imeIsSelected; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_compositionCursorPos(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Input.compositionCursorPos; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_compositionCursorPos(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.Input.compositionCursorPos = argHelper.Get<UnityEngine.Vector2>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_mousePresent(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Input.mousePresent; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_touchCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Input.touchCount; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_touchPressureSupported(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Input.touchPressureSupported; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_stylusTouchSupported(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Input.stylusTouchSupported; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_touchSupported(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Input.touchSupported; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_multiTouchEnabled(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Input.multiTouchEnabled; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_multiTouchEnabled(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.Input.multiTouchEnabled = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_deviceOrientation(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Input.deviceOrientation; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_acceleration(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Input.acceleration; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_compensateSensors(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Input.compensateSensors; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_compensateSensors(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.Input.compensateSensors = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_accelerationEventCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Input.accelerationEventCount; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_backButtonLeavesApp(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Input.backButtonLeavesApp; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_backButtonLeavesApp(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.Input.backButtonLeavesApp = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_location(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Input.location; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_compass(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Input.compass; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_gyro(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Input.gyro; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_touches(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Input.touches; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_accelerationEvents(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Input.accelerationEvents; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "GetAxis", IsStatic = true}, F_GetAxis }, { new Puerts.MethodKey {Name = "GetAxisRaw", IsStatic = true}, F_GetAxisRaw }, { new Puerts.MethodKey {Name = "GetButton", IsStatic = true}, F_GetButton }, { new Puerts.MethodKey {Name = "GetButtonDown", IsStatic = true}, F_GetButtonDown }, { new Puerts.MethodKey {Name = "GetButtonUp", IsStatic = true}, F_GetButtonUp }, { new Puerts.MethodKey {Name = "GetMouseButton", IsStatic = true}, F_GetMouseButton }, { new Puerts.MethodKey {Name = "GetMouseButtonDown", IsStatic = true}, F_GetMouseButtonDown }, { new Puerts.MethodKey {Name = "GetMouseButtonUp", IsStatic = true}, F_GetMouseButtonUp }, { new Puerts.MethodKey {Name = "ResetInputAxes", IsStatic = true}, F_ResetInputAxes }, { new Puerts.MethodKey {Name = "GetJoystickNames", IsStatic = true}, F_GetJoystickNames }, { new Puerts.MethodKey {Name = "GetTouch", IsStatic = true}, F_GetTouch }, { new Puerts.MethodKey {Name = "GetAccelerationEvent", IsStatic = true}, F_GetAccelerationEvent }, { new Puerts.MethodKey {Name = "GetKey", IsStatic = true}, F_GetKey }, { new Puerts.MethodKey {Name = "GetKeyUp", IsStatic = true}, F_GetKeyUp }, { new Puerts.MethodKey {Name = "GetKeyDown", IsStatic = true}, F_GetKeyDown }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"simulateMouseWithTouches", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_simulateMouseWithTouches, Setter = S_simulateMouseWithTouches} }, {"anyKey", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_anyKey, Setter = null} }, {"anyKeyDown", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_anyKeyDown, Setter = null} }, {"inputString", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_inputString, Setter = null} }, {"mousePosition", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_mousePosition, Setter = null} }, {"mouseScrollDelta", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_mouseScrollDelta, Setter = null} }, {"imeCompositionMode", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_imeCompositionMode, Setter = S_imeCompositionMode} }, {"compositionString", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_compositionString, Setter = null} }, {"imeIsSelected", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_imeIsSelected, Setter = null} }, {"compositionCursorPos", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_compositionCursorPos, Setter = S_compositionCursorPos} }, {"mousePresent", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_mousePresent, Setter = null} }, {"touchCount", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_touchCount, Setter = null} }, {"touchPressureSupported", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_touchPressureSupported, Setter = null} }, {"stylusTouchSupported", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_stylusTouchSupported, Setter = null} }, {"touchSupported", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_touchSupported, Setter = null} }, {"multiTouchEnabled", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_multiTouchEnabled, Setter = S_multiTouchEnabled} }, {"deviceOrientation", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_deviceOrientation, Setter = null} }, {"acceleration", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_acceleration, Setter = null} }, {"compensateSensors", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_compensateSensors, Setter = S_compensateSensors} }, {"accelerationEventCount", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_accelerationEventCount, Setter = null} }, {"backButtonLeavesApp", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_backButtonLeavesApp, Setter = S_backButtonLeavesApp} }, {"location", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_location, Setter = null} }, {"compass", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_compass, Setter = null} }, {"gyro", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_gyro, Setter = null} }, {"touches", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_touches, Setter = null} }, {"accelerationEvents", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_accelerationEvents, Setter = null} }, } }; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Bin/TsScripts/output/Conf/GameConfig.js<|end_filename|> "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const Types_1 = require("Gen/Cfg/Types"); const csharp_1 = require("csharp"); class GameConfig { load(gameConfDir) { let tables = new Types_1.cfg.Tables(f => csharp_1.JsHelpers.LoadFromFile(gameConfDir, f)); console.log(tables); console.log("== load succ =="); } } exports.default = GameConfig; GameConfig.Ins = new GameConfig(); //# sourceMappingURL=GameConfig.js.map <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_UI_HorizontalOrVerticalLayoutGroup_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_UI_HorizontalOrVerticalLayoutGroup_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.UI.HorizontalOrVerticalLayoutGroup constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_spacing(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.HorizontalOrVerticalLayoutGroup; var result = obj.spacing; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_spacing(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.HorizontalOrVerticalLayoutGroup; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.spacing = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_childForceExpandWidth(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.HorizontalOrVerticalLayoutGroup; var result = obj.childForceExpandWidth; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_childForceExpandWidth(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.HorizontalOrVerticalLayoutGroup; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.childForceExpandWidth = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_childForceExpandHeight(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.HorizontalOrVerticalLayoutGroup; var result = obj.childForceExpandHeight; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_childForceExpandHeight(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.HorizontalOrVerticalLayoutGroup; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.childForceExpandHeight = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_childControlWidth(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.HorizontalOrVerticalLayoutGroup; var result = obj.childControlWidth; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_childControlWidth(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.HorizontalOrVerticalLayoutGroup; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.childControlWidth = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_childControlHeight(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.HorizontalOrVerticalLayoutGroup; var result = obj.childControlHeight; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_childControlHeight(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.HorizontalOrVerticalLayoutGroup; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.childControlHeight = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_childScaleWidth(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.HorizontalOrVerticalLayoutGroup; var result = obj.childScaleWidth; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_childScaleWidth(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.HorizontalOrVerticalLayoutGroup; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.childScaleWidth = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_childScaleHeight(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.HorizontalOrVerticalLayoutGroup; var result = obj.childScaleHeight; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_childScaleHeight(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.HorizontalOrVerticalLayoutGroup; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.childScaleHeight = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_reverseArrangement(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.HorizontalOrVerticalLayoutGroup; var result = obj.reverseArrangement; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_reverseArrangement(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.HorizontalOrVerticalLayoutGroup; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.reverseArrangement = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"spacing", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_spacing, Setter = S_spacing} }, {"childForceExpandWidth", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_childForceExpandWidth, Setter = S_childForceExpandWidth} }, {"childForceExpandHeight", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_childForceExpandHeight, Setter = S_childForceExpandHeight} }, {"childControlWidth", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_childControlWidth, Setter = S_childControlWidth} }, {"childControlHeight", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_childControlHeight, Setter = S_childControlHeight} }, {"childScaleWidth", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_childScaleWidth, Setter = S_childScaleWidth} }, {"childScaleHeight", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_childScaleHeight, Setter = S_childScaleHeight} }, {"reverseArrangement", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_reverseArrangement, Setter = S_reverseArrangement} }, } }; } } } <|start_filename|>Projects/Csharp_CustomTemplate_EncryptMemory/Assets/Scripts/JsonHelper.cs<|end_filename|> using System; using Newtonsoft.Json; using UnityEngine; namespace Scripts { public class JsonHelper { public static string ToJson(object message) { return JsonConvert.SerializeObject(message); } public static object FromJson(string json, Type type) { return JsonConvert.DeserializeObject(json, type); } public static T FromJson<T>(string json) { return JsonConvert.DeserializeObject<T>(json); } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_UI_ToggleGroup_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_UI_ToggleGroup_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.UI.ToggleGroup constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_NotifyToggleOn(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.ToggleGroup; if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.UI.Toggle), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.UI.Toggle>(false); var Arg1 = argHelper1.GetBoolean(false); obj.NotifyToggleOn(Arg0,Arg1); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.UI.Toggle), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.UI.Toggle>(false); obj.NotifyToggleOn(Arg0); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to NotifyToggleOn"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_UnregisterToggle(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.ToggleGroup; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.UI.Toggle>(false); obj.UnregisterToggle(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_RegisterToggle(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.ToggleGroup; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.UI.Toggle>(false); obj.RegisterToggle(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_EnsureValidState(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.ToggleGroup; { { obj.EnsureValidState(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_AnyTogglesOn(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.ToggleGroup; { { var result = obj.AnyTogglesOn(); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ActiveToggles(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.ToggleGroup; { { var result = obj.ActiveToggles(); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetFirstActiveToggle(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.ToggleGroup; { { var result = obj.GetFirstActiveToggle(); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetAllTogglesOff(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.ToggleGroup; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.GetBoolean(false); obj.SetAllTogglesOff(Arg0); return; } } if (paramLen == 0) { { obj.SetAllTogglesOff(); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SetAllTogglesOff"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_allowSwitchOff(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.ToggleGroup; var result = obj.allowSwitchOff; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_allowSwitchOff(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.ToggleGroup; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.allowSwitchOff = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "NotifyToggleOn", IsStatic = false}, M_NotifyToggleOn }, { new Puerts.MethodKey {Name = "UnregisterToggle", IsStatic = false}, M_UnregisterToggle }, { new Puerts.MethodKey {Name = "RegisterToggle", IsStatic = false}, M_RegisterToggle }, { new Puerts.MethodKey {Name = "EnsureValidState", IsStatic = false}, M_EnsureValidState }, { new Puerts.MethodKey {Name = "AnyTogglesOn", IsStatic = false}, M_AnyTogglesOn }, { new Puerts.MethodKey {Name = "ActiveToggles", IsStatic = false}, M_ActiveToggles }, { new Puerts.MethodKey {Name = "GetFirstActiveToggle", IsStatic = false}, M_GetFirstActiveToggle }, { new Puerts.MethodKey {Name = "SetAllTogglesOff", IsStatic = false}, M_SetAllTogglesOff }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"allowSwitchOff", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_allowSwitchOff, Setter = S_allowSwitchOff} }, } }; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_SkinnedMeshRenderer_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_SkinnedMeshRenderer_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.SkinnedMeshRenderer(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.SkinnedMeshRenderer), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetBlendShapeWeight(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SkinnedMeshRenderer; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); var result = obj.GetBlendShapeWeight(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetBlendShapeWeight(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SkinnedMeshRenderer; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetFloat(false); obj.SetBlendShapeWeight(Arg0,Arg1); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_BakeMesh(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SkinnedMeshRenderer; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh>(false); obj.BakeMesh(Arg0); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Mesh), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Mesh>(false); var Arg1 = argHelper1.GetBoolean(false); obj.BakeMesh(Arg0,Arg1); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to BakeMesh"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_quality(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SkinnedMeshRenderer; var result = obj.quality; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_quality(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SkinnedMeshRenderer; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.quality = (UnityEngine.SkinQuality)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_updateWhenOffscreen(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SkinnedMeshRenderer; var result = obj.updateWhenOffscreen; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_updateWhenOffscreen(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SkinnedMeshRenderer; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.updateWhenOffscreen = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_forceMatrixRecalculationPerRender(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SkinnedMeshRenderer; var result = obj.forceMatrixRecalculationPerRender; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_forceMatrixRecalculationPerRender(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SkinnedMeshRenderer; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.forceMatrixRecalculationPerRender = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_rootBone(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SkinnedMeshRenderer; var result = obj.rootBone; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_rootBone(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SkinnedMeshRenderer; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.rootBone = argHelper.Get<UnityEngine.Transform>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_bones(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SkinnedMeshRenderer; var result = obj.bones; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_bones(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SkinnedMeshRenderer; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.bones = argHelper.Get<UnityEngine.Transform[]>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_sharedMesh(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SkinnedMeshRenderer; var result = obj.sharedMesh; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_sharedMesh(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SkinnedMeshRenderer; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.sharedMesh = argHelper.Get<UnityEngine.Mesh>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_skinnedMotionVectors(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SkinnedMeshRenderer; var result = obj.skinnedMotionVectors; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_skinnedMotionVectors(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SkinnedMeshRenderer; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.skinnedMotionVectors = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_localBounds(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SkinnedMeshRenderer; var result = obj.localBounds; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_localBounds(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SkinnedMeshRenderer; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.localBounds = argHelper.Get<UnityEngine.Bounds>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "GetBlendShapeWeight", IsStatic = false}, M_GetBlendShapeWeight }, { new Puerts.MethodKey {Name = "SetBlendShapeWeight", IsStatic = false}, M_SetBlendShapeWeight }, { new Puerts.MethodKey {Name = "BakeMesh", IsStatic = false}, M_BakeMesh }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"quality", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_quality, Setter = S_quality} }, {"updateWhenOffscreen", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_updateWhenOffscreen, Setter = S_updateWhenOffscreen} }, {"forceMatrixRecalculationPerRender", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_forceMatrixRecalculationPerRender, Setter = S_forceMatrixRecalculationPerRender} }, {"rootBone", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_rootBone, Setter = S_rootBone} }, {"bones", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_bones, Setter = S_bones} }, {"sharedMesh", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_sharedMesh, Setter = S_sharedMesh} }, {"skinnedMotionVectors", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_skinnedMotionVectors, Setter = S_skinnedMotionVectors} }, {"localBounds", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_localBounds, Setter = S_localBounds} }, } }; } } } <|start_filename|>Projects/Java_bin/src/main/gen/cfg/test/TestString.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.test; import bright.serialization.*; public final class TestString { public TestString(ByteBuf _buf) { id = _buf.readInt(); s1 = _buf.readString(); cs1 = new cfg.test.CompactString(_buf); cs2 = new cfg.test.CompactString(_buf); } public TestString(int id, String s1, cfg.test.CompactString cs1, cfg.test.CompactString cs2 ) { this.id = id; this.s1 = s1; this.cs1 = cs1; this.cs2 = cs2; } public final int id; public final String s1; public final cfg.test.CompactString cs1; public final cfg.test.CompactString cs2; public void resolve(java.util.HashMap<String, Object> _tables) { if (cs1 != null) {cs1.resolve(_tables);} if (cs2 != null) {cs2.resolve(_tables);} } @Override public String toString() { return "{ " + "id:" + id + "," + "s1:" + s1 + "," + "cs1:" + cs1 + "," + "cs2:" + cs2 + "," + "}"; } } <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/bonus/WeightBonus.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.bonus { public sealed partial class WeightBonus : bonus.Bonus { public WeightBonus(ByteBuf _buf) : base(_buf) { {int n = System.Math.Min(_buf.ReadSize(), _buf.Size);Bonuses = new bonus.WeightBonusInfo[n];for(var i = 0 ; i < n ; i++) { bonus.WeightBonusInfo _e;_e = bonus.WeightBonusInfo.DeserializeWeightBonusInfo(_buf); Bonuses[i] = _e;}} } public WeightBonus(bonus.WeightBonusInfo[] bonuses ) : base() { this.Bonuses = bonuses; } public static WeightBonus DeserializeWeightBonus(ByteBuf _buf) { return new bonus.WeightBonus(_buf); } public readonly bonus.WeightBonusInfo[] Bonuses; public const int ID = -362807016; public override int GetTypeId() => ID; public override void Resolve(Dictionary<string, object> _tables) { base.Resolve(_tables); foreach(var _e in Bonuses) { _e?.Resolve(_tables); } OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); public override string ToString() { return "{ " + "Bonuses:" + Bright.Common.StringUtil.CollectionToString(Bonuses) + "," + "}"; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_CanvasRenderer_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_CanvasRenderer_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.CanvasRenderer(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.CanvasRenderer), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetColor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CanvasRenderer; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Color>(false); obj.SetColor(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetColor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CanvasRenderer; { { var result = obj.GetColor(); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_EnableRectClipping(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CanvasRenderer; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); obj.EnableRectClipping(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_DisableRectClipping(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CanvasRenderer; { { obj.DisableRectClipping(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetMaterial(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CanvasRenderer; if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Material>(false); var Arg1 = argHelper1.GetInt32(false); obj.SetMaterial(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Material>(false); var Arg1 = argHelper1.Get<UnityEngine.Texture>(false); obj.SetMaterial(Arg0,Arg1); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SetMaterial"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetMaterial(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CanvasRenderer; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var result = obj.GetMaterial(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 0) { { var result = obj.GetMaterial(); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetMaterial"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetPopMaterial(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CanvasRenderer; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<UnityEngine.Material>(false); var Arg1 = argHelper1.GetInt32(false); obj.SetPopMaterial(Arg0,Arg1); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetPopMaterial(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CanvasRenderer; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); var result = obj.GetPopMaterial(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetTexture(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CanvasRenderer; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Texture>(false); obj.SetTexture(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetAlphaTexture(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CanvasRenderer; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Texture>(false); obj.SetAlphaTexture(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetMesh(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CanvasRenderer; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Mesh>(false); obj.SetMesh(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Clear(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CanvasRenderer; { { obj.Clear(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetAlpha(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CanvasRenderer; { { var result = obj.GetAlpha(); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetAlpha(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CanvasRenderer; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetFloat(false); obj.SetAlpha(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetInheritedAlpha(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CanvasRenderer; { { var result = obj.GetInheritedAlpha(); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_SplitUIVertexStreams(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 8) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); var argHelper7 = new Puerts.ArgumentHelper((int)data, isolate, info, 7); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.UIVertex>), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Vector3>), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Color32>), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Vector4>), false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Vector4>), false, false) && argHelper5.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Vector3>), false, false) && argHelper6.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Vector4>), false, false) && argHelper7.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<int>), false, false)) { var Arg0 = argHelper0.Get<System.Collections.Generic.List<UnityEngine.UIVertex>>(false); var Arg1 = argHelper1.Get<System.Collections.Generic.List<UnityEngine.Vector3>>(false); var Arg2 = argHelper2.Get<System.Collections.Generic.List<UnityEngine.Color32>>(false); var Arg3 = argHelper3.Get<System.Collections.Generic.List<UnityEngine.Vector4>>(false); var Arg4 = argHelper4.Get<System.Collections.Generic.List<UnityEngine.Vector4>>(false); var Arg5 = argHelper5.Get<System.Collections.Generic.List<UnityEngine.Vector3>>(false); var Arg6 = argHelper6.Get<System.Collections.Generic.List<UnityEngine.Vector4>>(false); var Arg7 = argHelper7.Get<System.Collections.Generic.List<int>>(false); UnityEngine.CanvasRenderer.SplitUIVertexStreams(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7); return; } } if (paramLen == 10) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); var argHelper7 = new Puerts.ArgumentHelper((int)data, isolate, info, 7); var argHelper8 = new Puerts.ArgumentHelper((int)data, isolate, info, 8); var argHelper9 = new Puerts.ArgumentHelper((int)data, isolate, info, 9); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.UIVertex>), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Vector3>), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Color32>), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Vector4>), false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Vector4>), false, false) && argHelper5.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Vector4>), false, false) && argHelper6.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Vector4>), false, false) && argHelper7.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Vector3>), false, false) && argHelper8.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Vector4>), false, false) && argHelper9.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<int>), false, false)) { var Arg0 = argHelper0.Get<System.Collections.Generic.List<UnityEngine.UIVertex>>(false); var Arg1 = argHelper1.Get<System.Collections.Generic.List<UnityEngine.Vector3>>(false); var Arg2 = argHelper2.Get<System.Collections.Generic.List<UnityEngine.Color32>>(false); var Arg3 = argHelper3.Get<System.Collections.Generic.List<UnityEngine.Vector4>>(false); var Arg4 = argHelper4.Get<System.Collections.Generic.List<UnityEngine.Vector4>>(false); var Arg5 = argHelper5.Get<System.Collections.Generic.List<UnityEngine.Vector4>>(false); var Arg6 = argHelper6.Get<System.Collections.Generic.List<UnityEngine.Vector4>>(false); var Arg7 = argHelper7.Get<System.Collections.Generic.List<UnityEngine.Vector3>>(false); var Arg8 = argHelper8.Get<System.Collections.Generic.List<UnityEngine.Vector4>>(false); var Arg9 = argHelper9.Get<System.Collections.Generic.List<int>>(false); UnityEngine.CanvasRenderer.SplitUIVertexStreams(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7,Arg8,Arg9); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SplitUIVertexStreams"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_CreateUIVertexStream(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 8) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); var argHelper7 = new Puerts.ArgumentHelper((int)data, isolate, info, 7); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.UIVertex>), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Vector3>), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Color32>), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Vector4>), false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Vector4>), false, false) && argHelper5.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Vector3>), false, false) && argHelper6.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Vector4>), false, false) && argHelper7.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<int>), false, false)) { var Arg0 = argHelper0.Get<System.Collections.Generic.List<UnityEngine.UIVertex>>(false); var Arg1 = argHelper1.Get<System.Collections.Generic.List<UnityEngine.Vector3>>(false); var Arg2 = argHelper2.Get<System.Collections.Generic.List<UnityEngine.Color32>>(false); var Arg3 = argHelper3.Get<System.Collections.Generic.List<UnityEngine.Vector4>>(false); var Arg4 = argHelper4.Get<System.Collections.Generic.List<UnityEngine.Vector4>>(false); var Arg5 = argHelper5.Get<System.Collections.Generic.List<UnityEngine.Vector3>>(false); var Arg6 = argHelper6.Get<System.Collections.Generic.List<UnityEngine.Vector4>>(false); var Arg7 = argHelper7.Get<System.Collections.Generic.List<int>>(false); UnityEngine.CanvasRenderer.CreateUIVertexStream(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7); return; } } if (paramLen == 10) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); var argHelper7 = new Puerts.ArgumentHelper((int)data, isolate, info, 7); var argHelper8 = new Puerts.ArgumentHelper((int)data, isolate, info, 8); var argHelper9 = new Puerts.ArgumentHelper((int)data, isolate, info, 9); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.UIVertex>), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Vector3>), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Color32>), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Vector4>), false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Vector4>), false, false) && argHelper5.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Vector4>), false, false) && argHelper6.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Vector4>), false, false) && argHelper7.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Vector3>), false, false) && argHelper8.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Vector4>), false, false) && argHelper9.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<int>), false, false)) { var Arg0 = argHelper0.Get<System.Collections.Generic.List<UnityEngine.UIVertex>>(false); var Arg1 = argHelper1.Get<System.Collections.Generic.List<UnityEngine.Vector3>>(false); var Arg2 = argHelper2.Get<System.Collections.Generic.List<UnityEngine.Color32>>(false); var Arg3 = argHelper3.Get<System.Collections.Generic.List<UnityEngine.Vector4>>(false); var Arg4 = argHelper4.Get<System.Collections.Generic.List<UnityEngine.Vector4>>(false); var Arg5 = argHelper5.Get<System.Collections.Generic.List<UnityEngine.Vector4>>(false); var Arg6 = argHelper6.Get<System.Collections.Generic.List<UnityEngine.Vector4>>(false); var Arg7 = argHelper7.Get<System.Collections.Generic.List<UnityEngine.Vector3>>(false); var Arg8 = argHelper8.Get<System.Collections.Generic.List<UnityEngine.Vector4>>(false); var Arg9 = argHelper9.Get<System.Collections.Generic.List<int>>(false); UnityEngine.CanvasRenderer.CreateUIVertexStream(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7,Arg8,Arg9); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to CreateUIVertexStream"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_AddUIVertexStream(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 7) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.UIVertex>), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Vector3>), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Color32>), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Vector4>), false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Vector4>), false, false) && argHelper5.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Vector3>), false, false) && argHelper6.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Vector4>), false, false)) { var Arg0 = argHelper0.Get<System.Collections.Generic.List<UnityEngine.UIVertex>>(false); var Arg1 = argHelper1.Get<System.Collections.Generic.List<UnityEngine.Vector3>>(false); var Arg2 = argHelper2.Get<System.Collections.Generic.List<UnityEngine.Color32>>(false); var Arg3 = argHelper3.Get<System.Collections.Generic.List<UnityEngine.Vector4>>(false); var Arg4 = argHelper4.Get<System.Collections.Generic.List<UnityEngine.Vector4>>(false); var Arg5 = argHelper5.Get<System.Collections.Generic.List<UnityEngine.Vector3>>(false); var Arg6 = argHelper6.Get<System.Collections.Generic.List<UnityEngine.Vector4>>(false); UnityEngine.CanvasRenderer.AddUIVertexStream(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6); return; } } if (paramLen == 9) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); var argHelper7 = new Puerts.ArgumentHelper((int)data, isolate, info, 7); var argHelper8 = new Puerts.ArgumentHelper((int)data, isolate, info, 8); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.UIVertex>), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Vector3>), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Color32>), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Vector4>), false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Vector4>), false, false) && argHelper5.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Vector4>), false, false) && argHelper6.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Vector4>), false, false) && argHelper7.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Vector3>), false, false) && argHelper8.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Vector4>), false, false)) { var Arg0 = argHelper0.Get<System.Collections.Generic.List<UnityEngine.UIVertex>>(false); var Arg1 = argHelper1.Get<System.Collections.Generic.List<UnityEngine.Vector3>>(false); var Arg2 = argHelper2.Get<System.Collections.Generic.List<UnityEngine.Color32>>(false); var Arg3 = argHelper3.Get<System.Collections.Generic.List<UnityEngine.Vector4>>(false); var Arg4 = argHelper4.Get<System.Collections.Generic.List<UnityEngine.Vector4>>(false); var Arg5 = argHelper5.Get<System.Collections.Generic.List<UnityEngine.Vector4>>(false); var Arg6 = argHelper6.Get<System.Collections.Generic.List<UnityEngine.Vector4>>(false); var Arg7 = argHelper7.Get<System.Collections.Generic.List<UnityEngine.Vector3>>(false); var Arg8 = argHelper8.Get<System.Collections.Generic.List<UnityEngine.Vector4>>(false); UnityEngine.CanvasRenderer.AddUIVertexStream(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7,Arg8); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to AddUIVertexStream"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_hasPopInstruction(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CanvasRenderer; var result = obj.hasPopInstruction; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_hasPopInstruction(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CanvasRenderer; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.hasPopInstruction = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_materialCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CanvasRenderer; var result = obj.materialCount; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_materialCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CanvasRenderer; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.materialCount = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_popMaterialCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CanvasRenderer; var result = obj.popMaterialCount; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_popMaterialCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CanvasRenderer; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.popMaterialCount = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_absoluteDepth(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CanvasRenderer; var result = obj.absoluteDepth; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_hasMoved(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CanvasRenderer; var result = obj.hasMoved; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_cullTransparentMesh(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CanvasRenderer; var result = obj.cullTransparentMesh; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_cullTransparentMesh(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CanvasRenderer; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.cullTransparentMesh = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_hasRectClipping(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CanvasRenderer; var result = obj.hasRectClipping; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_relativeDepth(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CanvasRenderer; var result = obj.relativeDepth; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_cull(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CanvasRenderer; var result = obj.cull; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_cull(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CanvasRenderer; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.cull = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_clippingSoftness(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CanvasRenderer; var result = obj.clippingSoftness; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_clippingSoftness(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CanvasRenderer; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.clippingSoftness = argHelper.Get<UnityEngine.Vector2>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "SetColor", IsStatic = false}, M_SetColor }, { new Puerts.MethodKey {Name = "GetColor", IsStatic = false}, M_GetColor }, { new Puerts.MethodKey {Name = "EnableRectClipping", IsStatic = false}, M_EnableRectClipping }, { new Puerts.MethodKey {Name = "DisableRectClipping", IsStatic = false}, M_DisableRectClipping }, { new Puerts.MethodKey {Name = "SetMaterial", IsStatic = false}, M_SetMaterial }, { new Puerts.MethodKey {Name = "GetMaterial", IsStatic = false}, M_GetMaterial }, { new Puerts.MethodKey {Name = "SetPopMaterial", IsStatic = false}, M_SetPopMaterial }, { new Puerts.MethodKey {Name = "GetPopMaterial", IsStatic = false}, M_GetPopMaterial }, { new Puerts.MethodKey {Name = "SetTexture", IsStatic = false}, M_SetTexture }, { new Puerts.MethodKey {Name = "SetAlphaTexture", IsStatic = false}, M_SetAlphaTexture }, { new Puerts.MethodKey {Name = "SetMesh", IsStatic = false}, M_SetMesh }, { new Puerts.MethodKey {Name = "Clear", IsStatic = false}, M_Clear }, { new Puerts.MethodKey {Name = "GetAlpha", IsStatic = false}, M_GetAlpha }, { new Puerts.MethodKey {Name = "SetAlpha", IsStatic = false}, M_SetAlpha }, { new Puerts.MethodKey {Name = "GetInheritedAlpha", IsStatic = false}, M_GetInheritedAlpha }, { new Puerts.MethodKey {Name = "SplitUIVertexStreams", IsStatic = true}, F_SplitUIVertexStreams }, { new Puerts.MethodKey {Name = "CreateUIVertexStream", IsStatic = true}, F_CreateUIVertexStream }, { new Puerts.MethodKey {Name = "AddUIVertexStream", IsStatic = true}, F_AddUIVertexStream }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"hasPopInstruction", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_hasPopInstruction, Setter = S_hasPopInstruction} }, {"materialCount", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_materialCount, Setter = S_materialCount} }, {"popMaterialCount", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_popMaterialCount, Setter = S_popMaterialCount} }, {"absoluteDepth", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_absoluteDepth, Setter = null} }, {"hasMoved", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_hasMoved, Setter = null} }, {"cullTransparentMesh", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_cullTransparentMesh, Setter = S_cullTransparentMesh} }, {"hasRectClipping", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_hasRectClipping, Setter = null} }, {"relativeDepth", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_relativeDepth, Setter = null} }, {"cull", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_cull, Setter = S_cull} }, {"clippingSoftness", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_clippingSoftness, Setter = S_clippingSoftness} }, } }; } } } <|start_filename|>Projects/Csharp_CustomTemplate_EncryptMemory/Gen/role/LevelBonus.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using System; using Newtonsoft.Json; using Scripts; namespace cfg.role { [Serializable] public partial class LevelBonus : AConfig { public System.Collections.Generic.List<role.DistinctBonusInfos> distinct_bonus_infos { get; set; } public override void EndInit() { foreach(var _e in distinct_bonus_infos) { _e.EndInit(); } } public override string ToString() => JsonConvert.SerializeObject(this); } } <|start_filename|>ProtoProjects/go/src/bright/math/Vector4.go<|end_filename|> package math type Vector4 struct { X float32 Y float32 Z float32 W float32 } func NewVector4(x float32, y float32, z float32, w float32) Vector4 { return Vector4{X: x, Y: y, Z: z, W: w} } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_ShaderVariantCollection_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_ShaderVariantCollection_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.ShaderVariantCollection(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.ShaderVariantCollection), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Clear(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ShaderVariantCollection; { { obj.Clear(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_WarmUp(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ShaderVariantCollection; { { obj.WarmUp(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Add(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ShaderVariantCollection; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.ShaderVariantCollection.ShaderVariant>(false); var result = obj.Add(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Remove(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ShaderVariantCollection; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.ShaderVariantCollection.ShaderVariant>(false); var result = obj.Remove(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Contains(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ShaderVariantCollection; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.ShaderVariantCollection.ShaderVariant>(false); var result = obj.Contains(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_shaderCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ShaderVariantCollection; var result = obj.shaderCount; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_variantCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ShaderVariantCollection; var result = obj.variantCount; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_isWarmedUp(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ShaderVariantCollection; var result = obj.isWarmedUp; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "Clear", IsStatic = false}, M_Clear }, { new Puerts.MethodKey {Name = "WarmUp", IsStatic = false}, M_WarmUp }, { new Puerts.MethodKey {Name = "Add", IsStatic = false}, M_Add }, { new Puerts.MethodKey {Name = "Remove", IsStatic = false}, M_Remove }, { new Puerts.MethodKey {Name = "Contains", IsStatic = false}, M_Contains }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"shaderCount", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_shaderCount, Setter = null} }, {"variantCount", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_variantCount, Setter = null} }, {"isWarmedUp", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_isWarmedUp, Setter = null} }, } }; } } } <|start_filename|>Projects/Go_json/gen/src/cfg/condition.ClothesPropertyScoreGreaterThan.go<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg import "errors" type ConditionClothesPropertyScoreGreaterThan struct { Prop int32 Value int32 } const TypeId_ConditionClothesPropertyScoreGreaterThan = 696630835 func (*ConditionClothesPropertyScoreGreaterThan) GetTypeId() int32 { return 696630835 } func (_v *ConditionClothesPropertyScoreGreaterThan)Deserialize(_buf map[string]interface{}) (err error) { { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["prop"].(float64); !_ok_ { err = errors.New("prop error"); return }; _v.Prop = int32(_tempNum_) } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["value"].(float64); !_ok_ { err = errors.New("value error"); return }; _v.Value = int32(_tempNum_) } return } func DeserializeConditionClothesPropertyScoreGreaterThan(_buf map[string]interface{}) (*ConditionClothesPropertyScoreGreaterThan, error) { v := &ConditionClothesPropertyScoreGreaterThan{} if err := v.Deserialize(_buf); err == nil { return v, nil } else { return nil, err } } <|start_filename|>Projects/DataTemplates/template_lua2/bonus_tbdrop.lua<|end_filename|> -- bonus.TbDrop return { [1] = { id=1, desc="奖励一个物品", client_show_items= { }, bonus= { item_id=1021490001, }, }, [2] = { id=2, desc="随机掉落一个", client_show_items= { }, bonus= { item_id=1021490001, }, }, } <|start_filename|>Projects/Csharp_Unity_bin_use_UnityEngine_Vector/Assets/Gen/test/TestDesc.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.test { public sealed class TestDesc : Bright.Config.BeanBase { public TestDesc(ByteBuf _buf) { Id = _buf.ReadInt(); Name = _buf.ReadString(); A1 = _buf.ReadInt(); A2 = _buf.ReadInt(); X1 = test.H1.DeserializeH1(_buf); {int n = System.Math.Min(_buf.ReadSize(), _buf.Size);X2 = new System.Collections.Generic.List<test.H2>(n);for(var i = 0 ; i < n ; i++) { test.H2 _e; _e = test.H2.DeserializeH2(_buf); X2.Add(_e);}} {int n = System.Math.Min(_buf.ReadSize(), _buf.Size);X3 = new test.H2[n];for(var i = 0 ; i < n ; i++) { test.H2 _e;_e = test.H2.DeserializeH2(_buf); X3[i] = _e;}} } public static TestDesc DeserializeTestDesc(ByteBuf _buf) { return new test.TestDesc(_buf); } public int Id { get; private set; } /// <summary> /// 禁止 /// </summary> public string Name { get; private set; } /// <summary> /// 测试换行<br/>第2行<br/>第3层 /// </summary> public int A1 { get; private set; } /// <summary> /// 测试转义 &lt; &amp; % / # &gt; /// </summary> public int A2 { get; private set; } public test.H1 X1 { get; private set; } /// <summary> /// 这是x2 /// </summary> public System.Collections.Generic.List<test.H2> X2 { get; private set; } public test.H2[] X3 { get; private set; } public const int __ID__ = 339555391; public override int GetTypeId() => __ID__; public void Resolve(Dictionary<string, object> _tables) { X1?.Resolve(_tables); foreach(var _e in X2) { _e?.Resolve(_tables); } foreach(var _e in X3) { _e?.Resolve(_tables); } } public void TranslateText(System.Func<string, string, string> translator) { X1?.TranslateText(translator); foreach(var _e in X2) { _e?.TranslateText(translator); } foreach(var _e in X3) { _e?.TranslateText(translator); } } public override string ToString() { return "{ " + "Id:" + Id + "," + "Name:" + Name + "," + "A1:" + A1 + "," + "A2:" + A2 + "," + "X1:" + X1 + "," + "X2:" + Bright.Common.StringUtil.CollectionToString(X2) + "," + "X3:" + Bright.Common.StringUtil.CollectionToString(X3) + "," + "}"; } } } <|start_filename|>Projects/Csharp_DotNet5_json_ExportServer/Gen/test/MultiRowRecord.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; using System.Text.Json; namespace cfg.test { public sealed class MultiRowRecord : Bright.Config.BeanBase { public MultiRowRecord(JsonElement _json) { Id = _json.GetProperty("id").GetInt32(); Name = _json.GetProperty("name").GetString(); { var _json0 = _json.GetProperty("one_rows"); OneRows = new System.Collections.Generic.List<test.MultiRowType1>(_json0.GetArrayLength()); foreach(JsonElement __e in _json0.EnumerateArray()) { test.MultiRowType1 __v; __v = test.MultiRowType1.DeserializeMultiRowType1(__e); OneRows.Add(__v); } } { var _json0 = _json.GetProperty("multi_rows1"); MultiRows1 = new System.Collections.Generic.List<test.MultiRowType1>(_json0.GetArrayLength()); foreach(JsonElement __e in _json0.EnumerateArray()) { test.MultiRowType1 __v; __v = test.MultiRowType1.DeserializeMultiRowType1(__e); MultiRows1.Add(__v); } } { var _json0 = _json.GetProperty("multi_rows2"); int _n = _json0.GetArrayLength(); MultiRows2 = new test.MultiRowType1[_n]; int _index=0; foreach(JsonElement __e in _json0.EnumerateArray()) { test.MultiRowType1 __v; __v = test.MultiRowType1.DeserializeMultiRowType1(__e); MultiRows2[_index++] = __v; } } { var _json0 = _json.GetProperty("multi_rows4"); MultiRows4 = new System.Collections.Generic.Dictionary<int, test.MultiRowType2>(_json0.GetArrayLength()); foreach(JsonElement __e in _json0.EnumerateArray()) { int __k; __k = __e[0].GetInt32(); test.MultiRowType2 __v; __v = test.MultiRowType2.DeserializeMultiRowType2(__e[1]); MultiRows4.Add(__k, __v); } } { var _json0 = _json.GetProperty("multi_rows5"); MultiRows5 = new System.Collections.Generic.List<test.MultiRowType3>(_json0.GetArrayLength()); foreach(JsonElement __e in _json0.EnumerateArray()) { test.MultiRowType3 __v; __v = test.MultiRowType3.DeserializeMultiRowType3(__e); MultiRows5.Add(__v); } } { var _json0 = _json.GetProperty("multi_rows6"); MultiRows6 = new System.Collections.Generic.Dictionary<int, test.MultiRowType2>(_json0.GetArrayLength()); foreach(JsonElement __e in _json0.EnumerateArray()) { int __k; __k = __e[0].GetInt32(); test.MultiRowType2 __v; __v = test.MultiRowType2.DeserializeMultiRowType2(__e[1]); MultiRows6.Add(__k, __v); } } { var _json0 = _json.GetProperty("multi_rows7"); MultiRows7 = new System.Collections.Generic.Dictionary<int, int>(_json0.GetArrayLength()); foreach(JsonElement __e in _json0.EnumerateArray()) { int __k; __k = __e[0].GetInt32(); int __v; __v = __e[1].GetInt32(); MultiRows7.Add(__k, __v); } } } public MultiRowRecord(int id, string name, System.Collections.Generic.List<test.MultiRowType1> one_rows, System.Collections.Generic.List<test.MultiRowType1> multi_rows1, test.MultiRowType1[] multi_rows2, System.Collections.Generic.Dictionary<int, test.MultiRowType2> multi_rows4, System.Collections.Generic.List<test.MultiRowType3> multi_rows5, System.Collections.Generic.Dictionary<int, test.MultiRowType2> multi_rows6, System.Collections.Generic.Dictionary<int, int> multi_rows7 ) { this.Id = id; this.Name = name; this.OneRows = one_rows; this.MultiRows1 = multi_rows1; this.MultiRows2 = multi_rows2; this.MultiRows4 = multi_rows4; this.MultiRows5 = multi_rows5; this.MultiRows6 = multi_rows6; this.MultiRows7 = multi_rows7; } public static MultiRowRecord DeserializeMultiRowRecord(JsonElement _json) { return new test.MultiRowRecord(_json); } public int Id { get; private set; } public string Name { get; private set; } public System.Collections.Generic.List<test.MultiRowType1> OneRows { get; private set; } public System.Collections.Generic.List<test.MultiRowType1> MultiRows1 { get; private set; } public test.MultiRowType1[] MultiRows2 { get; private set; } public System.Collections.Generic.Dictionary<int, test.MultiRowType2> MultiRows4 { get; private set; } public System.Collections.Generic.List<test.MultiRowType3> MultiRows5 { get; private set; } public System.Collections.Generic.Dictionary<int, test.MultiRowType2> MultiRows6 { get; private set; } public System.Collections.Generic.Dictionary<int, int> MultiRows7 { get; private set; } public const int __ID__ = -501249394; public override int GetTypeId() => __ID__; public void Resolve(Dictionary<string, object> _tables) { foreach(var _e in OneRows) { _e?.Resolve(_tables); } foreach(var _e in MultiRows1) { _e?.Resolve(_tables); } foreach(var _e in MultiRows2) { _e?.Resolve(_tables); } foreach(var _e in MultiRows4.Values) { _e?.Resolve(_tables); } foreach(var _e in MultiRows5) { _e?.Resolve(_tables); } foreach(var _e in MultiRows6.Values) { _e?.Resolve(_tables); } } public void TranslateText(System.Func<string, string, string> translator) { foreach(var _e in OneRows) { _e?.TranslateText(translator); } foreach(var _e in MultiRows1) { _e?.TranslateText(translator); } foreach(var _e in MultiRows2) { _e?.TranslateText(translator); } foreach(var _e in MultiRows4.Values) { _e?.TranslateText(translator); } foreach(var _e in MultiRows5) { _e?.TranslateText(translator); } foreach(var _e in MultiRows6.Values) { _e?.TranslateText(translator); } } public override string ToString() { return "{ " + "Id:" + Id + "," + "Name:" + Name + "," + "OneRows:" + Bright.Common.StringUtil.CollectionToString(OneRows) + "," + "MultiRows1:" + Bright.Common.StringUtil.CollectionToString(MultiRows1) + "," + "MultiRows2:" + Bright.Common.StringUtil.CollectionToString(MultiRows2) + "," + "MultiRows4:" + Bright.Common.StringUtil.CollectionToString(MultiRows4) + "," + "MultiRows5:" + Bright.Common.StringUtil.CollectionToString(MultiRows5) + "," + "MultiRows6:" + Bright.Common.StringUtil.CollectionToString(MultiRows6) + "," + "MultiRows7:" + Bright.Common.StringUtil.CollectionToString(MultiRows7) + "," + "}"; } } } <|start_filename|>Projects/DataTemplates/template_erlang/test_tbtestexcelbean.erl<|end_filename|> %% test.TbTestExcelBean get(1) -> #{x1 => 1,x2 => "xx",x3 => 2,x4 => 2.5}. get(2) -> #{x1 => 2,x2 => "zz",x3 => 2,x4 => 4.3}. get(3) -> #{x1 => 3,x2 => "ww",x3 => 2,x4 => 5}. get(4) -> #{x1 => 4,x2 => "ee",x3 => 2,x4 => 6}. <|start_filename|>Projects/GenerateDatas/convert_lua/test.TbTestNull/21.lua<|end_filename|> return { id = 21, } <|start_filename|>Projects/Java_bin/src/main/gen/cfg/bonus/WeightBonusInfo.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.bonus; import bright.serialization.*; public final class WeightBonusInfo { public WeightBonusInfo(ByteBuf _buf) { bonus = cfg.bonus.Bonus.deserializeBonus(_buf); weight = _buf.readInt(); } public WeightBonusInfo(cfg.bonus.Bonus bonus, int weight ) { this.bonus = bonus; this.weight = weight; } public final cfg.bonus.Bonus bonus; public final int weight; public void resolve(java.util.HashMap<String, Object> _tables) { if (bonus != null) {bonus.resolve(_tables);} } @Override public String toString() { return "{ " + "bonus:" + bonus + "," + "weight:" + weight + "," + "}"; } } <|start_filename|>Projects/GenerateDatas/convert_lua/l10n.TbPatchDemo/18.lua<|end_filename|> return { id = 18, value = 8, } <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/ai/Selector.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.ai { public sealed partial class Selector : ai.ComposeNode { public Selector(ByteBuf _buf) : base(_buf) { {int n = System.Math.Min(_buf.ReadSize(), _buf.Size);Children = new System.Collections.Generic.List<ai.FlowNode>(n);for(var i = 0 ; i < n ; i++) { ai.FlowNode _e; _e = ai.FlowNode.DeserializeFlowNode(_buf); Children.Add(_e);}} } public Selector(int id, string node_name, System.Collections.Generic.List<ai.Decorator> decorators, System.Collections.Generic.List<ai.Service> services, System.Collections.Generic.List<ai.FlowNode> children ) : base(id,node_name,decorators,services) { this.Children = children; } public static Selector DeserializeSelector(ByteBuf _buf) { return new ai.Selector(_buf); } public readonly System.Collections.Generic.List<ai.FlowNode> Children; public const int ID = -1946981627; public override int GetTypeId() => ID; public override void Resolve(Dictionary<string, object> _tables) { base.Resolve(_tables); foreach(var _e in Children) { _e?.Resolve(_tables); } OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); public override string ToString() { return "{ " + "Id:" + Id + "," + "NodeName:" + NodeName + "," + "Decorators:" + Bright.Common.StringUtil.CollectionToString(Decorators) + "," + "Services:" + Bright.Common.StringUtil.CollectionToString(Services) + "," + "Children:" + Bright.Common.StringUtil.CollectionToString(Children) + "," + "}"; } } } <|start_filename|>Projects/GenerateDatas/convert_lua/tag.TbTestTag/2001.lua<|end_filename|> return { id = 2001, value = "导出", } <|start_filename|>Projects/Java_bin/src/main/gen/cfg/blueprint/ParamInfo.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.blueprint; import bright.serialization.*; public final class ParamInfo { public ParamInfo(ByteBuf _buf) { name = _buf.readString(); type = _buf.readString(); isRef = _buf.readBool(); } public ParamInfo(String name, String type, boolean is_ref ) { this.name = name; this.type = type; this.isRef = is_ref; } public final String name; public final String type; public final boolean isRef; public void resolve(java.util.HashMap<String, Object> _tables) { } @Override public String toString() { return "{ " + "name:" + name + "," + "type:" + type + "," + "isRef:" + isRef + "," + "}"; } } <|start_filename|>Projects/java_json/src/gen/cfg/condition/ClothesPropertyScoreGreaterThan.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.condition; import com.google.gson.JsonElement; import com.google.gson.JsonObject; public final class ClothesPropertyScoreGreaterThan extends cfg.condition.BoolRoleCondition { public ClothesPropertyScoreGreaterThan(JsonObject __json__) { super(__json__); prop = cfg.item.EClothesPropertyType.valueOf(__json__.get("prop").getAsInt()); value = __json__.get("value").getAsInt(); } public ClothesPropertyScoreGreaterThan(cfg.item.EClothesPropertyType prop, int value ) { super(); this.prop = prop; this.value = value; } public static ClothesPropertyScoreGreaterThan deserializeClothesPropertyScoreGreaterThan(JsonObject __json__) { return new ClothesPropertyScoreGreaterThan(__json__); } public final cfg.item.EClothesPropertyType prop; public final int value; public static final int __ID__ = 696630835; @Override public int getTypeId() { return __ID__; } @Override public void resolve(java.util.HashMap<String, Object> _tables) { super.resolve(_tables); } @Override public String toString() { return "{ " + "prop:" + prop + "," + "value:" + value + "," + "}"; } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_BoneWeight_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_BoneWeight_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.BoneWeight constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetHashCode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.BoneWeight)Puerts.Utils.GetSelf((int)data, self); { { var result = obj.GetHashCode(); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Equals(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.BoneWeight)Puerts.Utils.GetSelf((int)data, self); if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.Any, typeof(System.Object), false, false)) { var Arg0 = argHelper0.Get<System.Object>(false); var result = obj.Equals(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.BoneWeight), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.BoneWeight>(false); var result = obj.Equals(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to Equals"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_weight0(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.BoneWeight)Puerts.Utils.GetSelf((int)data, self); var result = obj.weight0; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_weight0(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.BoneWeight)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.weight0 = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_weight1(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.BoneWeight)Puerts.Utils.GetSelf((int)data, self); var result = obj.weight1; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_weight1(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.BoneWeight)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.weight1 = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_weight2(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.BoneWeight)Puerts.Utils.GetSelf((int)data, self); var result = obj.weight2; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_weight2(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.BoneWeight)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.weight2 = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_weight3(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.BoneWeight)Puerts.Utils.GetSelf((int)data, self); var result = obj.weight3; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_weight3(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.BoneWeight)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.weight3 = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_boneIndex0(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.BoneWeight)Puerts.Utils.GetSelf((int)data, self); var result = obj.boneIndex0; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_boneIndex0(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.BoneWeight)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.boneIndex0 = argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_boneIndex1(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.BoneWeight)Puerts.Utils.GetSelf((int)data, self); var result = obj.boneIndex1; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_boneIndex1(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.BoneWeight)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.boneIndex1 = argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_boneIndex2(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.BoneWeight)Puerts.Utils.GetSelf((int)data, self); var result = obj.boneIndex2; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_boneIndex2(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.BoneWeight)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.boneIndex2 = argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_boneIndex3(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.BoneWeight)Puerts.Utils.GetSelf((int)data, self); var result = obj.boneIndex3; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_boneIndex3(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.BoneWeight)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.boneIndex3 = argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void O_op_Equality(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var arg0 = argHelper0.Get<UnityEngine.BoneWeight>(false); var arg1 = argHelper1.Get<UnityEngine.BoneWeight>(false); var result = arg0 == arg1; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void O_op_Inequality(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var arg0 = argHelper0.Get<UnityEngine.BoneWeight>(false); var arg1 = argHelper1.Get<UnityEngine.BoneWeight>(false); var result = arg0 != arg1; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "GetHashCode", IsStatic = false}, M_GetHashCode }, { new Puerts.MethodKey {Name = "Equals", IsStatic = false}, M_Equals }, { new Puerts.MethodKey {Name = "op_Equality", IsStatic = true}, O_op_Equality}, { new Puerts.MethodKey {Name = "op_Inequality", IsStatic = true}, O_op_Inequality}, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"weight0", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_weight0, Setter = S_weight0} }, {"weight1", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_weight1, Setter = S_weight1} }, {"weight2", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_weight2, Setter = S_weight2} }, {"weight3", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_weight3, Setter = S_weight3} }, {"boneIndex0", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_boneIndex0, Setter = S_boneIndex0} }, {"boneIndex1", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_boneIndex1, Setter = S_boneIndex1} }, {"boneIndex2", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_boneIndex2, Setter = S_boneIndex2} }, {"boneIndex3", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_boneIndex3, Setter = S_boneIndex3} }, } }; } } } <|start_filename|>Projects/DataTemplates/template_lua2/mail_tbglobalmail.lua<|end_filename|> -- mail.TbGlobalMail return { [21] = { id=21, title="测试1", sender="系统", content="测试内容1", award= { 1, }, all_server=true, server_list= { }, platform="1", channel="1", min_max_level= { min=1, max=120, }, register_time= { date_time_range= { start_time=1589040000, end_time=1589904000, }, }, mail_time= { date_time_range= { start_time=1589040000, end_time=1589904000, }, }, }, [22] = { id=22, title="", sender="系统", content="测试内容2", award= { 1, }, all_server=false, server_list= { 1, }, platform="1", channel="1", min_max_level= { min=20, max=120, }, register_time= { date_time_range= { start_time=1588608000, }, }, mail_time= { date_time_range= { start_time=1589904000, end_time=1590336000, }, }, }, [23] = { id=23, title="", sender="系统", content="测试内容3", award= { 1, }, all_server=false, server_list= { 1, }, platform="1", channel="1", min_max_level= { min=50, max=60, }, register_time= { date_time_range= { end_time=1589644800, }, }, mail_time= { date_time_range= { }, }, }, [24] = { id=24, title="", sender="系统", content="测试内容3", award= { 1, }, all_server=false, server_list= { 1, }, platform="1", channel="1", min_max_level= { min=50, max=60, }, register_time= { date_time_range= { end_time=1589644800, }, }, mail_time= { date_time_range= { }, }, }, } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_Cache_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_Cache_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.Cache constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetHashCode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Cache)Puerts.Utils.GetSelf((int)data, self); { { var result = obj.GetHashCode(); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Equals(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Cache)Puerts.Utils.GetSelf((int)data, self); if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.Any, typeof(System.Object), false, false)) { var Arg0 = argHelper0.Get<System.Object>(false); var result = obj.Equals(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Cache), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Cache>(false); var result = obj.Equals(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to Equals"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ClearCache(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Cache)Puerts.Utils.GetSelf((int)data, self); if (paramLen == 0) { { var result = obj.ClearCache(); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var result = obj.ClearCache(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to ClearCache"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_valid(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Cache)Puerts.Utils.GetSelf((int)data, self); var result = obj.valid; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_ready(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Cache)Puerts.Utils.GetSelf((int)data, self); var result = obj.ready; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_readOnly(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Cache)Puerts.Utils.GetSelf((int)data, self); var result = obj.readOnly; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_path(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Cache)Puerts.Utils.GetSelf((int)data, self); var result = obj.path; Puerts.PuertsDLL.ReturnString(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_index(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Cache)Puerts.Utils.GetSelf((int)data, self); var result = obj.index; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_spaceFree(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Cache)Puerts.Utils.GetSelf((int)data, self); var result = obj.spaceFree; Puerts.PuertsDLL.ReturnBigInt(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_maximumAvailableStorageSpace(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Cache)Puerts.Utils.GetSelf((int)data, self); var result = obj.maximumAvailableStorageSpace; Puerts.PuertsDLL.ReturnBigInt(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_maximumAvailableStorageSpace(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Cache)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.maximumAvailableStorageSpace = argHelper.GetInt64(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_spaceOccupied(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Cache)Puerts.Utils.GetSelf((int)data, self); var result = obj.spaceOccupied; Puerts.PuertsDLL.ReturnBigInt(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_expirationDelay(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Cache)Puerts.Utils.GetSelf((int)data, self); var result = obj.expirationDelay; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_expirationDelay(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Cache)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.expirationDelay = argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void O_op_Equality(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var arg0 = argHelper0.Get<UnityEngine.Cache>(false); var arg1 = argHelper1.Get<UnityEngine.Cache>(false); var result = arg0 == arg1; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void O_op_Inequality(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var arg0 = argHelper0.Get<UnityEngine.Cache>(false); var arg1 = argHelper1.Get<UnityEngine.Cache>(false); var result = arg0 != arg1; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "GetHashCode", IsStatic = false}, M_GetHashCode }, { new Puerts.MethodKey {Name = "Equals", IsStatic = false}, M_Equals }, { new Puerts.MethodKey {Name = "ClearCache", IsStatic = false}, M_ClearCache }, { new Puerts.MethodKey {Name = "op_Equality", IsStatic = true}, O_op_Equality}, { new Puerts.MethodKey {Name = "op_Inequality", IsStatic = true}, O_op_Inequality}, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"valid", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_valid, Setter = null} }, {"ready", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_ready, Setter = null} }, {"readOnly", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_readOnly, Setter = null} }, {"path", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_path, Setter = null} }, {"index", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_index, Setter = null} }, {"spaceFree", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_spaceFree, Setter = null} }, {"maximumAvailableStorageSpace", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_maximumAvailableStorageSpace, Setter = S_maximumAvailableStorageSpace} }, {"spaceOccupied", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_spaceOccupied, Setter = null} }, {"expirationDelay", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_expirationDelay, Setter = S_expirationDelay} }, } }; } } } <|start_filename|>Projects/Csharp_CustomTemplate_EncryptMemory/Gen/test/Color.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using System; using Newtonsoft.Json; using Scripts; namespace cfg.test { [Serializable] public partial class Color : AConfig { [JsonProperty("r")] private float _r { get; set; } [JsonIgnore] public EncryptFloat r { get; private set; } = new(); [JsonProperty("g")] private float _g { get; set; } [JsonIgnore] public EncryptFloat g { get; private set; } = new(); [JsonProperty("b")] private float _b { get; set; } [JsonIgnore] public EncryptFloat b { get; private set; } = new(); [JsonProperty("a")] private float _a { get; set; } [JsonIgnore] public EncryptFloat a { get; private set; } = new(); public override void EndInit() { r = _r; g = _g; b = _b; a = _a; } public override string ToString() => JsonConvert.SerializeObject(this); } } <|start_filename|>Projects/Java_bin/src/main/gen/cfg/condition/TimeRange.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.condition; import bright.serialization.*; public final class TimeRange extends cfg.condition.Condition { public TimeRange(ByteBuf _buf) { super(_buf); dateTimeRange = new cfg.common.DateTimeRange(_buf); } public TimeRange(cfg.common.DateTimeRange date_time_range ) { super(); this.dateTimeRange = date_time_range; } public final cfg.common.DateTimeRange dateTimeRange; public static final int __ID__ = 1069033789; @Override public int getTypeId() { return __ID__; } @Override public void resolve(java.util.HashMap<String, Object> _tables) { super.resolve(_tables); if (dateTimeRange != null) {dateTimeRange.resolve(_tables);} } @Override public String toString() { return "{ " + "dateTimeRange:" + dateTimeRange + "," + "}"; } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_Touch_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_Touch_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.Touch constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_fingerId(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Touch)Puerts.Utils.GetSelf((int)data, self); var result = obj.fingerId; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_fingerId(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Touch)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.fingerId = argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_position(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Touch)Puerts.Utils.GetSelf((int)data, self); var result = obj.position; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_position(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Touch)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.position = argHelper.Get<UnityEngine.Vector2>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_rawPosition(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Touch)Puerts.Utils.GetSelf((int)data, self); var result = obj.rawPosition; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_rawPosition(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Touch)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.rawPosition = argHelper.Get<UnityEngine.Vector2>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_deltaPosition(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Touch)Puerts.Utils.GetSelf((int)data, self); var result = obj.deltaPosition; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_deltaPosition(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Touch)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.deltaPosition = argHelper.Get<UnityEngine.Vector2>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_deltaTime(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Touch)Puerts.Utils.GetSelf((int)data, self); var result = obj.deltaTime; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_deltaTime(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Touch)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.deltaTime = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_tapCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Touch)Puerts.Utils.GetSelf((int)data, self); var result = obj.tapCount; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_tapCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Touch)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.tapCount = argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_phase(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Touch)Puerts.Utils.GetSelf((int)data, self); var result = obj.phase; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_phase(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Touch)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.phase = (UnityEngine.TouchPhase)argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_pressure(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Touch)Puerts.Utils.GetSelf((int)data, self); var result = obj.pressure; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_pressure(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Touch)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.pressure = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_maximumPossiblePressure(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Touch)Puerts.Utils.GetSelf((int)data, self); var result = obj.maximumPossiblePressure; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_maximumPossiblePressure(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Touch)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.maximumPossiblePressure = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_type(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Touch)Puerts.Utils.GetSelf((int)data, self); var result = obj.type; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_type(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Touch)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.type = (UnityEngine.TouchType)argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_altitudeAngle(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Touch)Puerts.Utils.GetSelf((int)data, self); var result = obj.altitudeAngle; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_altitudeAngle(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Touch)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.altitudeAngle = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_azimuthAngle(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Touch)Puerts.Utils.GetSelf((int)data, self); var result = obj.azimuthAngle; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_azimuthAngle(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Touch)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.azimuthAngle = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_radius(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Touch)Puerts.Utils.GetSelf((int)data, self); var result = obj.radius; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_radius(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Touch)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.radius = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_radiusVariance(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Touch)Puerts.Utils.GetSelf((int)data, self); var result = obj.radiusVariance; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_radiusVariance(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Touch)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.radiusVariance = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"fingerId", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_fingerId, Setter = S_fingerId} }, {"position", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_position, Setter = S_position} }, {"rawPosition", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_rawPosition, Setter = S_rawPosition} }, {"deltaPosition", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_deltaPosition, Setter = S_deltaPosition} }, {"deltaTime", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_deltaTime, Setter = S_deltaTime} }, {"tapCount", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_tapCount, Setter = S_tapCount} }, {"phase", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_phase, Setter = S_phase} }, {"pressure", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_pressure, Setter = S_pressure} }, {"maximumPossiblePressure", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_maximumPossiblePressure, Setter = S_maximumPossiblePressure} }, {"type", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_type, Setter = S_type} }, {"altitudeAngle", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_altitudeAngle, Setter = S_altitudeAngle} }, {"azimuthAngle", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_azimuthAngle, Setter = S_azimuthAngle} }, {"radius", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_radius, Setter = S_radius} }, {"radiusVariance", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_radiusVariance, Setter = S_radiusVariance} }, } }; } } } <|start_filename|>Projects/DataTemplates/template_lua2/test_tbdemoprimitive.lua<|end_filename|> -- test.TbDemoPrimitive return { [3] = { x1=false, x2=1, x3=2, x4=3, x5=4, x6=5, x7=6, s1="hello", s2={key='/test/key1',text="测试本地化字符串1"}, v2={x=1,y=2}, v3={x=2,y=3,z=4}, v4={x=4,y=5,z=6,w=7}, t1=946742700, }, [4] = { x1=true, x2=1, x3=2, x4=4, x5=4, x6=5, x7=6, s1="world", s2={key='/test/key2',text="测试本地化字符串2"}, v2={x=2,y=3}, v3={x=2.2,y=2.3,z=3.4}, v4={x=4.5,y=5.6,z=6.7,w=8.8}, t1=946829099, }, [5] = { x1=true, x2=1, x3=2, x4=5, x5=4, x6=5, x7=6, s1="nihao", s2={key='/test/key3',text="测试本地化字符串3"}, v2={x=4,y=5}, v3={x=2.2,y=2.3,z=3.5}, v4={x=4.5,y=5.6,z=6.8,w=9.9}, t1=946915499, }, [6] = { x1=true, x2=1, x3=2, x4=6, x5=4, x6=5, x7=6, s1="shijie", s2={key='/test/key4',text="测试本地化字符串4"}, v2={x=6,y=7}, v3={x=2.2,y=2.3,z=3.6}, v4={x=4.5,y=5.6,z=6.9,w=123}, t1=947001899, }, } <|start_filename|>Projects/GenerateDatas/convert_lua/test.TbTestBeRef/1.lua<|end_filename|> return { id = 1, count = 10, } <|start_filename|>Projects/Java_bin/src/main/gen/cfg/condition/MultiRoleCondition.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.condition; import bright.serialization.*; public final class MultiRoleCondition extends cfg.condition.RoleCondition { public MultiRoleCondition(ByteBuf _buf) { super(_buf); {int n = Math.min(_buf.readSize(), _buf.size());conditions = new cfg.condition.RoleCondition[n];for(int i = 0 ; i < n ; i++) { cfg.condition.RoleCondition _e;_e = cfg.condition.RoleCondition.deserializeRoleCondition(_buf); conditions[i] = _e;}} } public MultiRoleCondition(cfg.condition.RoleCondition[] conditions ) { super(); this.conditions = conditions; } public final cfg.condition.RoleCondition[] conditions; public static final int __ID__ = 934079583; @Override public int getTypeId() { return __ID__; } @Override public void resolve(java.util.HashMap<String, Object> _tables) { super.resolve(_tables); for(cfg.condition.RoleCondition _e : conditions) { if (_e != null) _e.resolve(_tables); } } @Override public String toString() { return "{ " + "conditions:" + conditions + "," + "}"; } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_Vector3Int_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_Vector3Int_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var result = new UnityEngine.Vector3Int(Arg0,Arg1,Arg2); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.Vector3Int), result); } } if (paramLen == 0) { { var result = new UnityEngine.Vector3Int(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.Vector3Int), result); } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.Vector3Int constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Set(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Vector3Int)Puerts.Utils.GetSelf((int)data, self); { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); obj.Set(Arg0,Arg1,Arg2); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_Distance(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<UnityEngine.Vector3Int>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3Int>(false); var result = UnityEngine.Vector3Int.Distance(Arg0,Arg1); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_Min(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<UnityEngine.Vector3Int>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3Int>(false); var result = UnityEngine.Vector3Int.Min(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_Max(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<UnityEngine.Vector3Int>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3Int>(false); var result = UnityEngine.Vector3Int.Max(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_Scale(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<UnityEngine.Vector3Int>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3Int>(false); var result = UnityEngine.Vector3Int.Scale(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Scale(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Vector3Int)Puerts.Utils.GetSelf((int)data, self); { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Vector3Int>(false); obj.Scale(Arg0); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Clamp(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Vector3Int)Puerts.Utils.GetSelf((int)data, self); { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<UnityEngine.Vector3Int>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3Int>(false); obj.Clamp(Arg0,Arg1); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_FloorToInt(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var result = UnityEngine.Vector3Int.FloorToInt(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_CeilToInt(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var result = UnityEngine.Vector3Int.CeilToInt(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_RoundToInt(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var result = UnityEngine.Vector3Int.RoundToInt(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Equals(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Vector3Int)Puerts.Utils.GetSelf((int)data, self); if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.Any, typeof(System.Object), false, false)) { var Arg0 = argHelper0.Get<System.Object>(false); var result = obj.Equals(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3Int), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3Int>(false); var result = obj.Equals(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to Equals"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetHashCode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Vector3Int)Puerts.Utils.GetSelf((int)data, self); { { var result = obj.GetHashCode(); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ToString(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Vector3Int)Puerts.Utils.GetSelf((int)data, self); if (paramLen == 0) { { var result = obj.ToString(); Puerts.PuertsDLL.ReturnString(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var result = obj.ToString(Arg0); Puerts.PuertsDLL.ReturnString(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.IFormatProvider), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<System.IFormatProvider>(false); var result = obj.ToString(Arg0,Arg1); Puerts.PuertsDLL.ReturnString(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to ToString"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_x(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Vector3Int)Puerts.Utils.GetSelf((int)data, self); var result = obj.x; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_x(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Vector3Int)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.x = argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_y(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Vector3Int)Puerts.Utils.GetSelf((int)data, self); var result = obj.y; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_y(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Vector3Int)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.y = argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_z(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Vector3Int)Puerts.Utils.GetSelf((int)data, self); var result = obj.z; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_z(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Vector3Int)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.z = argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_magnitude(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Vector3Int)Puerts.Utils.GetSelf((int)data, self); var result = obj.magnitude; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_sqrMagnitude(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Vector3Int)Puerts.Utils.GetSelf((int)data, self); var result = obj.sqrMagnitude; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_zero(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Vector3Int.zero; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_one(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Vector3Int.one; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_up(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Vector3Int.up; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_down(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Vector3Int.down; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_left(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Vector3Int.left; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_right(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Vector3Int.right; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_forward(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Vector3Int.forward; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_back(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Vector3Int.back; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void GetItem(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Vector3Int)Puerts.Utils.GetSelf((int)data, self); var keyHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (keyHelper.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var key = keyHelper.GetInt32(false); var result = obj[key]; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void SetItem(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Vector3Int)Puerts.Utils.GetSelf((int)data, self); var keyHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var valueHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (keyHelper.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var key = keyHelper.GetInt32(false); obj[key] = valueHelper.GetInt32(false); return; } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void O_op_Addition(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var arg0 = argHelper0.Get<UnityEngine.Vector3Int>(false); var arg1 = argHelper1.Get<UnityEngine.Vector3Int>(false); var result = arg0 + arg1; Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void O_op_Subtraction(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var arg0 = argHelper0.Get<UnityEngine.Vector3Int>(false); var arg1 = argHelper1.Get<UnityEngine.Vector3Int>(false); var result = arg0 - arg1; Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void O_op_Multiply(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3Int), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3Int), false, false)) { var arg0 = argHelper0.Get<UnityEngine.Vector3Int>(false); var arg1 = argHelper1.Get<UnityEngine.Vector3Int>(false); var result = arg0 * arg1; Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3Int), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var arg0 = argHelper0.Get<UnityEngine.Vector3Int>(false); var arg1 = argHelper1.GetInt32(false); var result = arg0 * arg1; Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3Int), false, false)) { var arg0 = argHelper0.GetInt32(false); var arg1 = argHelper1.Get<UnityEngine.Vector3Int>(false); var result = arg0 * arg1; Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to op_Multiply"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void O_op_UnaryNegation(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var arg0 = argHelper0.Get<UnityEngine.Vector3Int>(false); var result = -arg0; Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void O_op_Division(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var arg0 = argHelper0.Get<UnityEngine.Vector3Int>(false); var arg1 = argHelper1.GetInt32(false); var result = arg0 / arg1; Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void O_op_Equality(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var arg0 = argHelper0.Get<UnityEngine.Vector3Int>(false); var arg1 = argHelper1.Get<UnityEngine.Vector3Int>(false); var result = arg0 == arg1; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void O_op_Inequality(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var arg0 = argHelper0.Get<UnityEngine.Vector3Int>(false); var arg1 = argHelper1.Get<UnityEngine.Vector3Int>(false); var result = arg0 != arg1; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "Set", IsStatic = false}, M_Set }, { new Puerts.MethodKey {Name = "Distance", IsStatic = true}, F_Distance }, { new Puerts.MethodKey {Name = "Min", IsStatic = true}, F_Min }, { new Puerts.MethodKey {Name = "Max", IsStatic = true}, F_Max }, { new Puerts.MethodKey {Name = "Scale", IsStatic = true}, F_Scale }, { new Puerts.MethodKey {Name = "Scale", IsStatic = false}, M_Scale }, { new Puerts.MethodKey {Name = "Clamp", IsStatic = false}, M_Clamp }, { new Puerts.MethodKey {Name = "FloorToInt", IsStatic = true}, F_FloorToInt }, { new Puerts.MethodKey {Name = "CeilToInt", IsStatic = true}, F_CeilToInt }, { new Puerts.MethodKey {Name = "RoundToInt", IsStatic = true}, F_RoundToInt }, { new Puerts.MethodKey {Name = "Equals", IsStatic = false}, M_Equals }, { new Puerts.MethodKey {Name = "GetHashCode", IsStatic = false}, M_GetHashCode }, { new Puerts.MethodKey {Name = "ToString", IsStatic = false}, M_ToString }, { new Puerts.MethodKey {Name = "get_Item", IsStatic = false}, GetItem }, { new Puerts.MethodKey {Name = "set_Item", IsStatic = false}, SetItem}, { new Puerts.MethodKey {Name = "op_Addition", IsStatic = true}, O_op_Addition}, { new Puerts.MethodKey {Name = "op_Subtraction", IsStatic = true}, O_op_Subtraction}, { new Puerts.MethodKey {Name = "op_Multiply", IsStatic = true}, O_op_Multiply}, { new Puerts.MethodKey {Name = "op_UnaryNegation", IsStatic = true}, O_op_UnaryNegation}, { new Puerts.MethodKey {Name = "op_Division", IsStatic = true}, O_op_Division}, { new Puerts.MethodKey {Name = "op_Equality", IsStatic = true}, O_op_Equality}, { new Puerts.MethodKey {Name = "op_Inequality", IsStatic = true}, O_op_Inequality}, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"x", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_x, Setter = S_x} }, {"y", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_y, Setter = S_y} }, {"z", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_z, Setter = S_z} }, {"magnitude", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_magnitude, Setter = null} }, {"sqrMagnitude", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_sqrMagnitude, Setter = null} }, {"zero", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_zero, Setter = null} }, {"one", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_one, Setter = null} }, {"up", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_up, Setter = null} }, {"down", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_down, Setter = null} }, {"left", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_left, Setter = null} }, {"right", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_right, Setter = null} }, {"forward", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_forward, Setter = null} }, {"back", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_back, Setter = null} }, } }; } } } <|start_filename|>Projects/GenerateDatas/convert_lua/mail.TbSystemMail/14.lua<|end_filename|> return { id = 14, title = "测试4", sender = "系统", content = "测试内容4", award = { 1, }, } <|start_filename|>Projects/GenerateDatas/convert_lua/tag.TbTestTag/2003.lua<|end_filename|> return { id = 2003, value = "test", } <|start_filename|>Projects/DataTemplates/template_lua/test_tbtestindex.lua<|end_filename|> return { [1] = {id=1,eles={{x1=1,},{x1=2,},{x1=3,},{x1=4,},{x1=5,},},}, [2] = {id=2,eles={{x1=1,},{x1=2,},{x1=3,},{x1=4,},{x1=5,},},}, [3] = {id=3,eles={{x1=1,},{x1=2,},{x1=3,},{x1=4,},{x1=5,},},}, [4] = {id=4,eles={{x1=1,},{x1=2,},{x1=3,},{x1=4,},{x1=5,},},}, } <|start_filename|>ProtoProjects/Csharp_Unity/Assets/Bright.Net/Codecs/IProtocolAllocator.cs<|end_filename|> namespace Bright.Net.Codecs { public interface IProtocolAllocator { Protocol Alloc(int typeId); void Free(Protocol proto); } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_Texture2DArray_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_Texture2DArray_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { if (paramLen == 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = (UnityEngine.Experimental.Rendering.DefaultFormat)argHelper3.GetInt32(false); var Arg4 = (UnityEngine.Experimental.Rendering.TextureCreationFlags)argHelper4.GetInt32(false); var result = new UnityEngine.Texture2DArray(Arg0,Arg1,Arg2,Arg3,Arg4); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.Texture2DArray), result); } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = (UnityEngine.Experimental.Rendering.GraphicsFormat)argHelper3.GetInt32(false); var Arg4 = (UnityEngine.Experimental.Rendering.TextureCreationFlags)argHelper4.GetInt32(false); var result = new UnityEngine.Texture2DArray(Arg0,Arg1,Arg2,Arg3,Arg4); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.Texture2DArray), result); } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = (UnityEngine.TextureFormat)argHelper3.GetInt32(false); var Arg4 = argHelper4.GetBoolean(false); var result = new UnityEngine.Texture2DArray(Arg0,Arg1,Arg2,Arg3,Arg4); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.Texture2DArray), result); } } if (paramLen == 6) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = (UnityEngine.Experimental.Rendering.GraphicsFormat)argHelper3.GetInt32(false); var Arg4 = (UnityEngine.Experimental.Rendering.TextureCreationFlags)argHelper4.GetInt32(false); var Arg5 = argHelper5.GetInt32(false); var result = new UnityEngine.Texture2DArray(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.Texture2DArray), result); } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = (UnityEngine.TextureFormat)argHelper3.GetInt32(false); var Arg4 = argHelper4.GetInt32(false); var Arg5 = argHelper5.GetBoolean(false); var result = new UnityEngine.Texture2DArray(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.Texture2DArray), result); } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = (UnityEngine.TextureFormat)argHelper3.GetInt32(false); var Arg4 = argHelper4.GetBoolean(false); var Arg5 = argHelper5.GetBoolean(false); var result = new UnityEngine.Texture2DArray(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.Texture2DArray), result); } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.Texture2DArray constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetPixels(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Texture2DArray; if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var result = obj.GetPixels(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var result = obj.GetPixels(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetPixels"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetPixels32(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Texture2DArray; if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var result = obj.GetPixels32(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var result = obj.GetPixels32(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetPixels32"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetPixels(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Texture2DArray; if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Color[]), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Color[]>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); obj.SetPixels(Arg0,Arg1,Arg2); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Color[]), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Color[]>(false); var Arg1 = argHelper1.GetInt32(false); obj.SetPixels(Arg0,Arg1); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SetPixels"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetPixels32(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Texture2DArray; if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Color32[]), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Color32[]>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); obj.SetPixels32(Arg0,Arg1,Arg2); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Color32[]), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Color32[]>(false); var Arg1 = argHelper1.GetInt32(false); obj.SetPixels32(Arg0,Arg1); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SetPixels32"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Apply(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Texture2DArray; if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.GetBoolean(false); var Arg1 = argHelper1.GetBoolean(false); obj.Apply(Arg0,Arg1); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.GetBoolean(false); obj.Apply(Arg0); return; } } if (paramLen == 0) { { obj.Apply(); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to Apply"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_allSlices(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Texture2DArray.allSlices; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_depth(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Texture2DArray; var result = obj.depth; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_format(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Texture2DArray; var result = obj.format; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_isReadable(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Texture2DArray; var result = obj.isReadable; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "GetPixels", IsStatic = false}, M_GetPixels }, { new Puerts.MethodKey {Name = "GetPixels32", IsStatic = false}, M_GetPixels32 }, { new Puerts.MethodKey {Name = "SetPixels", IsStatic = false}, M_SetPixels }, { new Puerts.MethodKey {Name = "SetPixels32", IsStatic = false}, M_SetPixels32 }, { new Puerts.MethodKey {Name = "Apply", IsStatic = false}, M_Apply }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"allSlices", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_allSlices, Setter = null} }, {"depth", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_depth, Setter = null} }, {"format", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_format, Setter = null} }, {"isReadable", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_isReadable, Setter = null} }, } }; } } } <|start_filename|>Projects/Csharp_DotNet5_json_ExportServer/Gen/role/LevelBonus.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; using System.Text.Json; namespace cfg.role { public sealed class LevelBonus : Bright.Config.BeanBase { public LevelBonus(JsonElement _json) { Id = _json.GetProperty("id").GetInt32(); { var _json0 = _json.GetProperty("distinct_bonus_infos"); DistinctBonusInfos = new System.Collections.Generic.List<role.DistinctBonusInfos>(_json0.GetArrayLength()); foreach(JsonElement __e in _json0.EnumerateArray()) { role.DistinctBonusInfos __v; __v = role.DistinctBonusInfos.DeserializeDistinctBonusInfos(__e); DistinctBonusInfos.Add(__v); } } } public LevelBonus(int id, System.Collections.Generic.List<role.DistinctBonusInfos> distinct_bonus_infos ) { this.Id = id; this.DistinctBonusInfos = distinct_bonus_infos; } public static LevelBonus DeserializeLevelBonus(JsonElement _json) { return new role.LevelBonus(_json); } public int Id { get; private set; } public System.Collections.Generic.List<role.DistinctBonusInfos> DistinctBonusInfos { get; private set; } public const int __ID__ = -572269677; public override int GetTypeId() => __ID__; public void Resolve(Dictionary<string, object> _tables) { foreach(var _e in DistinctBonusInfos) { _e?.Resolve(_tables); } } public void TranslateText(System.Func<string, string, string> translator) { foreach(var _e in DistinctBonusInfos) { _e?.TranslateText(translator); } } public override string ToString() { return "{ " + "Id:" + Id + "," + "DistinctBonusInfos:" + Bright.Common.StringUtil.CollectionToString(DistinctBonusInfos) + "," + "}"; } } } <|start_filename|>Projects/java_json/src/gen/cfg/common/GlobalConfig.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.common; import com.google.gson.JsonElement; import com.google.gson.JsonObject; public final class GlobalConfig { public GlobalConfig(JsonObject __json__) { bagCapacity = __json__.get("bag_capacity").getAsInt(); bagCapacitySpecial = __json__.get("bag_capacity_special").getAsInt(); bagTempExpendableCapacity = __json__.get("bag_temp_expendable_capacity").getAsInt(); bagTempToolCapacity = __json__.get("bag_temp_tool_capacity").getAsInt(); bagInitCapacity = __json__.get("bag_init_capacity").getAsInt(); quickBagCapacity = __json__.get("quick_bag_capacity").getAsInt(); clothBagCapacity = __json__.get("cloth_bag_capacity").getAsInt(); clothBagInitCapacity = __json__.get("cloth_bag_init_capacity").getAsInt(); clothBagCapacitySpecial = __json__.get("cloth_bag_capacity_special").getAsInt(); { if (__json__.has("bag_init_items_drop_id") && !__json__.get("bag_init_items_drop_id").isJsonNull()) { bagInitItemsDropId = __json__.get("bag_init_items_drop_id").getAsInt(); } else { bagInitItemsDropId = null; } } mailBoxCapacity = __json__.get("mail_box_capacity").getAsInt(); damageParamC = __json__.get("damage_param_c").getAsFloat(); damageParamE = __json__.get("damage_param_e").getAsFloat(); damageParamF = __json__.get("damage_param_f").getAsFloat(); damageParamD = __json__.get("damage_param_d").getAsFloat(); roleSpeed = __json__.get("role_speed").getAsFloat(); monsterSpeed = __json__.get("monster_speed").getAsFloat(); initEnergy = __json__.get("init_energy").getAsInt(); initViality = __json__.get("init_viality").getAsInt(); maxViality = __json__.get("max_viality").getAsInt(); perVialityRecoveryTime = __json__.get("per_viality_recovery_time").getAsInt(); } public GlobalConfig(int bag_capacity, int bag_capacity_special, int bag_temp_expendable_capacity, int bag_temp_tool_capacity, int bag_init_capacity, int quick_bag_capacity, int cloth_bag_capacity, int cloth_bag_init_capacity, int cloth_bag_capacity_special, Integer bag_init_items_drop_id, int mail_box_capacity, float damage_param_c, float damage_param_e, float damage_param_f, float damage_param_d, float role_speed, float monster_speed, int init_energy, int init_viality, int max_viality, int per_viality_recovery_time ) { this.bagCapacity = bag_capacity; this.bagCapacitySpecial = bag_capacity_special; this.bagTempExpendableCapacity = bag_temp_expendable_capacity; this.bagTempToolCapacity = bag_temp_tool_capacity; this.bagInitCapacity = bag_init_capacity; this.quickBagCapacity = quick_bag_capacity; this.clothBagCapacity = cloth_bag_capacity; this.clothBagInitCapacity = cloth_bag_init_capacity; this.clothBagCapacitySpecial = cloth_bag_capacity_special; this.bagInitItemsDropId = bag_init_items_drop_id; this.mailBoxCapacity = mail_box_capacity; this.damageParamC = damage_param_c; this.damageParamE = damage_param_e; this.damageParamF = damage_param_f; this.damageParamD = damage_param_d; this.roleSpeed = role_speed; this.monsterSpeed = monster_speed; this.initEnergy = init_energy; this.initViality = init_viality; this.maxViality = max_viality; this.perVialityRecoveryTime = per_viality_recovery_time; } public static GlobalConfig deserializeGlobalConfig(JsonObject __json__) { return new GlobalConfig(__json__); } /** * 背包容量 */ public final int bagCapacity; public final int bagCapacitySpecial; public final int bagTempExpendableCapacity; public final int bagTempToolCapacity; public final int bagInitCapacity; public final int quickBagCapacity; public final int clothBagCapacity; public final int clothBagInitCapacity; public final int clothBagCapacitySpecial; public final Integer bagInitItemsDropId; public cfg.bonus.DropInfo bagInitItemsDropId_Ref; public final int mailBoxCapacity; public final float damageParamC; public final float damageParamE; public final float damageParamF; public final float damageParamD; public final float roleSpeed; public final float monsterSpeed; public final int initEnergy; public final int initViality; public final int maxViality; public final int perVialityRecoveryTime; public void resolve(java.util.HashMap<String, Object> _tables) { this.bagInitItemsDropId_Ref = this.bagInitItemsDropId != null ? ((cfg.bonus.TbDrop)_tables.get("bonus.TbDrop")).get(bagInitItemsDropId) : null; } @Override public String toString() { return "{ " + "bagCapacity:" + bagCapacity + "," + "bagCapacitySpecial:" + bagCapacitySpecial + "," + "bagTempExpendableCapacity:" + bagTempExpendableCapacity + "," + "bagTempToolCapacity:" + bagTempToolCapacity + "," + "bagInitCapacity:" + bagInitCapacity + "," + "quickBagCapacity:" + quickBagCapacity + "," + "clothBagCapacity:" + clothBagCapacity + "," + "clothBagInitCapacity:" + clothBagInitCapacity + "," + "clothBagCapacitySpecial:" + clothBagCapacitySpecial + "," + "bagInitItemsDropId:" + bagInitItemsDropId + "," + "mailBoxCapacity:" + mailBoxCapacity + "," + "damageParamC:" + damageParamC + "," + "damageParamE:" + damageParamE + "," + "damageParamF:" + damageParamF + "," + "damageParamD:" + damageParamD + "," + "roleSpeed:" + roleSpeed + "," + "monsterSpeed:" + monsterSpeed + "," + "initEnergy:" + initEnergy + "," + "initViality:" + initViality + "," + "maxViality:" + maxViality + "," + "perVialityRecoveryTime:" + perVialityRecoveryTime + "," + "}"; } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_UI_LayoutRebuilder_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_UI_LayoutRebuilder_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.UI.LayoutRebuilder(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.UI.LayoutRebuilder), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_IsDestroyed(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.LayoutRebuilder; { { var result = obj.IsDestroyed(); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_ForceRebuildLayoutImmediate(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.RectTransform>(false); UnityEngine.UI.LayoutRebuilder.ForceRebuildLayoutImmediate(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Rebuild(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.LayoutRebuilder; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = (UnityEngine.UI.CanvasUpdate)argHelper0.GetInt32(false); obj.Rebuild(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_MarkLayoutForRebuild(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.RectTransform>(false); UnityEngine.UI.LayoutRebuilder.MarkLayoutForRebuild(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_LayoutComplete(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.LayoutRebuilder; { { obj.LayoutComplete(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GraphicUpdateComplete(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.LayoutRebuilder; { { obj.GraphicUpdateComplete(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetHashCode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.LayoutRebuilder; { { var result = obj.GetHashCode(); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Equals(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.LayoutRebuilder; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.Object>(false); var result = obj.Equals(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ToString(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.LayoutRebuilder; { { var result = obj.ToString(); Puerts.PuertsDLL.ReturnString(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_transform(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.LayoutRebuilder; var result = obj.transform; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "IsDestroyed", IsStatic = false}, M_IsDestroyed }, { new Puerts.MethodKey {Name = "ForceRebuildLayoutImmediate", IsStatic = true}, F_ForceRebuildLayoutImmediate }, { new Puerts.MethodKey {Name = "Rebuild", IsStatic = false}, M_Rebuild }, { new Puerts.MethodKey {Name = "MarkLayoutForRebuild", IsStatic = true}, F_MarkLayoutForRebuild }, { new Puerts.MethodKey {Name = "LayoutComplete", IsStatic = false}, M_LayoutComplete }, { new Puerts.MethodKey {Name = "GraphicUpdateComplete", IsStatic = false}, M_GraphicUpdateComplete }, { new Puerts.MethodKey {Name = "GetHashCode", IsStatic = false}, M_GetHashCode }, { new Puerts.MethodKey {Name = "Equals", IsStatic = false}, M_Equals }, { new Puerts.MethodKey {Name = "ToString", IsStatic = false}, M_ToString }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"transform", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_transform, Setter = null} }, } }; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_ScreenCapture_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_ScreenCapture_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.ScreenCapture constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_CaptureScreenshot(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); UnityEngine.ScreenCapture.CaptureScreenshot(Arg0); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.GetInt32(false); UnityEngine.ScreenCapture.CaptureScreenshot(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = (UnityEngine.ScreenCapture.StereoScreenCaptureMode)argHelper1.GetInt32(false); UnityEngine.ScreenCapture.CaptureScreenshot(Arg0,Arg1); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to CaptureScreenshot"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_CaptureScreenshotAsTexture(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 0) { { var result = UnityEngine.ScreenCapture.CaptureScreenshotAsTexture(); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var result = UnityEngine.ScreenCapture.CaptureScreenshotAsTexture(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = (UnityEngine.ScreenCapture.StereoScreenCaptureMode)argHelper0.GetInt32(false); var result = UnityEngine.ScreenCapture.CaptureScreenshotAsTexture(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to CaptureScreenshotAsTexture"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_CaptureScreenshotIntoRenderTexture(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.RenderTexture>(false); UnityEngine.ScreenCapture.CaptureScreenshotIntoRenderTexture(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "CaptureScreenshot", IsStatic = true}, F_CaptureScreenshot }, { new Puerts.MethodKey {Name = "CaptureScreenshotAsTexture", IsStatic = true}, F_CaptureScreenshotAsTexture }, { new Puerts.MethodKey {Name = "CaptureScreenshotIntoRenderTexture", IsStatic = true}, F_CaptureScreenshotIntoRenderTexture }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { } }; } } } <|start_filename|>Projects/Go_json/gen/src/cfg/blueprint.Field.go<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg import "errors" type BlueprintField struct { Name string Type string Desc string } const TypeId_BlueprintField = 1694158271 func (*BlueprintField) GetTypeId() int32 { return 1694158271 } func (_v *BlueprintField)Deserialize(_buf map[string]interface{}) (err error) { { var _ok_ bool; if _v.Name, _ok_ = _buf["name"].(string); !_ok_ { err = errors.New("name error"); return } } { var _ok_ bool; if _v.Type, _ok_ = _buf["type"].(string); !_ok_ { err = errors.New("type error"); return } } { var _ok_ bool; if _v.Desc, _ok_ = _buf["desc"].(string); !_ok_ { err = errors.New("desc error"); return } } return } func DeserializeBlueprintField(_buf map[string]interface{}) (*BlueprintField, error) { v := &BlueprintField{} if err := v.Deserialize(_buf); err == nil { return v, nil } else { return nil, err } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_CharacterInfo_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_CharacterInfo_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.CharacterInfo constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_advance(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.CharacterInfo)Puerts.Utils.GetSelf((int)data, self); var result = obj.advance; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_advance(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.CharacterInfo)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.advance = argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_glyphWidth(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.CharacterInfo)Puerts.Utils.GetSelf((int)data, self); var result = obj.glyphWidth; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_glyphWidth(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.CharacterInfo)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.glyphWidth = argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_glyphHeight(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.CharacterInfo)Puerts.Utils.GetSelf((int)data, self); var result = obj.glyphHeight; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_glyphHeight(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.CharacterInfo)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.glyphHeight = argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_bearing(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.CharacterInfo)Puerts.Utils.GetSelf((int)data, self); var result = obj.bearing; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_bearing(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.CharacterInfo)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.bearing = argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_minY(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.CharacterInfo)Puerts.Utils.GetSelf((int)data, self); var result = obj.minY; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_minY(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.CharacterInfo)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.minY = argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_maxY(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.CharacterInfo)Puerts.Utils.GetSelf((int)data, self); var result = obj.maxY; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_maxY(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.CharacterInfo)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.maxY = argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_minX(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.CharacterInfo)Puerts.Utils.GetSelf((int)data, self); var result = obj.minX; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_minX(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.CharacterInfo)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.minX = argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_maxX(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.CharacterInfo)Puerts.Utils.GetSelf((int)data, self); var result = obj.maxX; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_maxX(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.CharacterInfo)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.maxX = argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_uvBottomLeft(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.CharacterInfo)Puerts.Utils.GetSelf((int)data, self); var result = obj.uvBottomLeft; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_uvBottomLeft(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.CharacterInfo)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.uvBottomLeft = argHelper.Get<UnityEngine.Vector2>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_uvBottomRight(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.CharacterInfo)Puerts.Utils.GetSelf((int)data, self); var result = obj.uvBottomRight; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_uvBottomRight(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.CharacterInfo)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.uvBottomRight = argHelper.Get<UnityEngine.Vector2>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_uvTopRight(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.CharacterInfo)Puerts.Utils.GetSelf((int)data, self); var result = obj.uvTopRight; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_uvTopRight(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.CharacterInfo)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.uvTopRight = argHelper.Get<UnityEngine.Vector2>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_uvTopLeft(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.CharacterInfo)Puerts.Utils.GetSelf((int)data, self); var result = obj.uvTopLeft; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_uvTopLeft(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.CharacterInfo)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.uvTopLeft = argHelper.Get<UnityEngine.Vector2>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_index(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.CharacterInfo)Puerts.Utils.GetSelf((int)data, self); var result = obj.index; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_index(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.CharacterInfo)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.index = argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_size(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.CharacterInfo)Puerts.Utils.GetSelf((int)data, self); var result = obj.size; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_size(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.CharacterInfo)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.size = argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_style(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.CharacterInfo)Puerts.Utils.GetSelf((int)data, self); var result = obj.style; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_style(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.CharacterInfo)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.style = (UnityEngine.FontStyle)argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"advance", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_advance, Setter = S_advance} }, {"glyphWidth", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_glyphWidth, Setter = S_glyphWidth} }, {"glyphHeight", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_glyphHeight, Setter = S_glyphHeight} }, {"bearing", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_bearing, Setter = S_bearing} }, {"minY", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_minY, Setter = S_minY} }, {"maxY", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_maxY, Setter = S_maxY} }, {"minX", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_minX, Setter = S_minX} }, {"maxX", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_maxX, Setter = S_maxX} }, {"uvBottomLeft", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_uvBottomLeft, Setter = S_uvBottomLeft} }, {"uvBottomRight", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_uvBottomRight, Setter = S_uvBottomRight} }, {"uvTopRight", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_uvTopRight, Setter = S_uvTopRight} }, {"uvTopLeft", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_uvTopLeft, Setter = S_uvTopLeft} }, {"index", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_index, Setter = S_index} }, {"size", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_size, Setter = S_size} }, {"style", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_style, Setter = S_style} }, } }; } } } <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/item/EMajorType.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ namespace cfg.item { public enum EMajorType { /// <summary> /// 货币 /// </summary> CURRENCY = 1, /// <summary> /// 服装 /// </summary> CLOTH = 2, /// <summary> /// 任务 /// </summary> QUEST = 3, /// <summary> /// 消耗品 /// </summary> CONSUMABLES = 4, /// <summary> /// 宝箱 /// </summary> TREASURE_BOX = 5, /// <summary> /// 成就和称谓 /// </summary> ACHIEVEMENT_AND_TITLE = 6, /// <summary> /// 头像框 /// </summary> HEAD_FRAME = 7, /// <summary> /// 语音 /// </summary> VOICE = 8, /// <summary> /// 动作 /// </summary> ACTION = 9, /// <summary> /// 扩容道具 /// </summary> EXPANSION = 10, /// <summary> /// 制作材料 /// </summary> MATERIAL = 11, } } <|start_filename|>Projects/Go_json/gen/src/cfg/ai.GetOwnerPlayer.go<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg import "errors" type AiGetOwnerPlayer struct { Id int32 NodeName string PlayerActorKey string } const TypeId_AiGetOwnerPlayer = -999247644 func (*AiGetOwnerPlayer) GetTypeId() int32 { return -999247644 } func (_v *AiGetOwnerPlayer)Deserialize(_buf map[string]interface{}) (err error) { { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["id"].(float64); !_ok_ { err = errors.New("id error"); return }; _v.Id = int32(_tempNum_) } { var _ok_ bool; if _v.NodeName, _ok_ = _buf["node_name"].(string); !_ok_ { err = errors.New("node_name error"); return } } { var _ok_ bool; if _v.PlayerActorKey, _ok_ = _buf["player_actor_key"].(string); !_ok_ { err = errors.New("player_actor_key error"); return } } return } func DeserializeAiGetOwnerPlayer(_buf map[string]interface{}) (*AiGetOwnerPlayer, error) { v := &AiGetOwnerPlayer{} if err := v.Deserialize(_buf); err == nil { return v, nil } else { return nil, err } } <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/ai/MoveToTarget.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.ai { public sealed partial class MoveToTarget : ai.Task { public MoveToTarget(ByteBuf _buf) : base(_buf) { TargetActorKey = _buf.ReadString(); AcceptableRadius = _buf.ReadFloat(); } public MoveToTarget(int id, string node_name, System.Collections.Generic.List<ai.Decorator> decorators, System.Collections.Generic.List<ai.Service> services, bool ignore_restart_self, string target_actor_key, float acceptable_radius ) : base(id,node_name,decorators,services,ignore_restart_self) { this.TargetActorKey = target_actor_key; this.AcceptableRadius = acceptable_radius; } public static MoveToTarget DeserializeMoveToTarget(ByteBuf _buf) { return new ai.MoveToTarget(_buf); } public readonly string TargetActorKey; public readonly float AcceptableRadius; public const int ID = 514987779; public override int GetTypeId() => ID; public override void Resolve(Dictionary<string, object> _tables) { base.Resolve(_tables); OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); public override string ToString() { return "{ " + "Id:" + Id + "," + "NodeName:" + NodeName + "," + "Decorators:" + Bright.Common.StringUtil.CollectionToString(Decorators) + "," + "Services:" + Bright.Common.StringUtil.CollectionToString(Services) + "," + "IgnoreRestartSelf:" + IgnoreRestartSelf + "," + "TargetActorKey:" + TargetActorKey + "," + "AcceptableRadius:" + AcceptableRadius + "," + "}"; } } } <|start_filename|>Projects/GenerateDatas/convert_lua/role.TbRoleLevelExpAttr/92.lua<|end_filename|> return { level = 92, need_exp = 285000, clothes_attrs = { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, }, } <|start_filename|>Projects/Go_json/gen/src/cfg/ai.KeyData.go<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg import "errors" type AiKeyData struct { } const TypeId_AiKeyData = 1022478019 func (*AiKeyData) GetTypeId() int32 { return 1022478019 } func (_v *AiKeyData)Deserialize(_buf map[string]interface{}) (err error) { return } func DeserializeAiKeyData(_buf map[string]interface{}) (interface{}, error) { var id string var _ok_ bool if id, _ok_ = _buf["__type__"].(string) ; !_ok_ { return nil, errors.New("type id missing") } switch id { case "FloatKeyData": _v := &AiFloatKeyData{}; if err := _v.Deserialize(_buf); err != nil { return nil, errors.New("ai.FloatKeyData") } else { return _v, nil } case "IntKeyData": _v := &AiIntKeyData{}; if err := _v.Deserialize(_buf); err != nil { return nil, errors.New("ai.IntKeyData") } else { return _v, nil } case "StringKeyData": _v := &AiStringKeyData{}; if err := _v.Deserialize(_buf); err != nil { return nil, errors.New("ai.StringKeyData") } else { return _v, nil } case "BlackboardKeyData": _v := &AiBlackboardKeyData{}; if err := _v.Deserialize(_buf); err != nil { return nil, errors.New("ai.BlackboardKeyData") } else { return _v, nil } default: return nil, errors.New("unknown type id") } } <|start_filename|>DesignerConfigs/Datas/test/test_null_datas/22.lua<|end_filename|> return { id=22, x1 = 1, x2 = "B", x3 = {x1=3}, x4 = {__type__="DemoD2", x1=1, x2=2}, s1 = "asfs", s2 = {key="/asf/asfa", text="abcdef"}, } <|start_filename|>Projects/DataTemplates/template_erlang/test_tbtestmap.erl<|end_filename|> %% test.TbTestMap get(1) -> #{id => 1,x1 => #{1 => 2,3 => 4},x2 => #{1 => 2,3 => 4},x3 => #{"aaa" => 1,"bbb" => 2},x4 => #{1 => 1,2 => 20}}. <|start_filename|>Projects/GenerateDatas/convert_lua/test.TbDetectCsvEncoding/21.lua<|end_filename|> return { id = 21, name = "测试编码", } <|start_filename|>Projects/GenerateDatas/convert_lua/tag.TbTestTag/13.lua<|end_filename|> return { id = 13, value = "导出", } <|start_filename|>Projects/Go_json/gen/src/cfg/item.EClothersStarQualityType.go<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg const ( ItemEClothersStarQualityType_ONE = 1 ItemEClothersStarQualityType_TWO = 2 ItemEClothersStarQualityType_THREE = 3 ItemEClothersStarQualityType_FOUR = 4 ItemEClothersStarQualityType_FIVE = 5 ItemEClothersStarQualityType_SIX = 6 ItemEClothersStarQualityType_SEVEN = 7 ItemEClothersStarQualityType_EIGHT = 8 ItemEClothersStarQualityType_NINE = 9 ItemEClothersStarQualityType_TEN = 10 ) <|start_filename|>Projects/DataTemplates/template_erlang2/test_tbmultirowtitle.erl<|end_filename|> %% test.TbMultiRowTitle -module(test_tbmultirowtitle) -export([get/1,get_ids/0]) get(1) -> #{ id => 1, name => "xxx", x1 => bean, x2_0 => null, x2 => array, x3 => array, x4 => array }. get(11) -> #{ id => 11, name => "yyy", x1 => bean, x2_0 => bean, x2 => array, x3 => array, x4 => array }. get_ids() -> [1,11]. <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_GridLayout_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_GridLayout_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.GridLayout(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.GridLayout), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetBoundsLocal(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GridLayout; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3Int), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3Int>(false); var result = obj.GetBoundsLocal(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3>(false); var result = obj.GetBoundsLocal(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetBoundsLocal"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_CellToLocal(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GridLayout; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Vector3Int>(false); var result = obj.CellToLocal(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_LocalToCell(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GridLayout; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var result = obj.LocalToCell(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_CellToLocalInterpolated(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GridLayout; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var result = obj.CellToLocalInterpolated(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_LocalToCellInterpolated(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GridLayout; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var result = obj.LocalToCellInterpolated(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_CellToWorld(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GridLayout; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Vector3Int>(false); var result = obj.CellToWorld(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_WorldToCell(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GridLayout; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var result = obj.WorldToCell(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_LocalToWorld(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GridLayout; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var result = obj.LocalToWorld(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_WorldToLocal(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GridLayout; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var result = obj.WorldToLocal(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetLayoutCellCenter(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GridLayout; { { var result = obj.GetLayoutCellCenter(); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_cellSize(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GridLayout; var result = obj.cellSize; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_cellGap(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GridLayout; var result = obj.cellGap; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_cellLayout(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GridLayout; var result = obj.cellLayout; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_cellSwizzle(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GridLayout; var result = obj.cellSwizzle; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "GetBoundsLocal", IsStatic = false}, M_GetBoundsLocal }, { new Puerts.MethodKey {Name = "CellToLocal", IsStatic = false}, M_CellToLocal }, { new Puerts.MethodKey {Name = "LocalToCell", IsStatic = false}, M_LocalToCell }, { new Puerts.MethodKey {Name = "CellToLocalInterpolated", IsStatic = false}, M_CellToLocalInterpolated }, { new Puerts.MethodKey {Name = "LocalToCellInterpolated", IsStatic = false}, M_LocalToCellInterpolated }, { new Puerts.MethodKey {Name = "CellToWorld", IsStatic = false}, M_CellToWorld }, { new Puerts.MethodKey {Name = "WorldToCell", IsStatic = false}, M_WorldToCell }, { new Puerts.MethodKey {Name = "LocalToWorld", IsStatic = false}, M_LocalToWorld }, { new Puerts.MethodKey {Name = "WorldToLocal", IsStatic = false}, M_WorldToLocal }, { new Puerts.MethodKey {Name = "GetLayoutCellCenter", IsStatic = false}, M_GetLayoutCellCenter }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"cellSize", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_cellSize, Setter = null} }, {"cellGap", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_cellGap, Setter = null} }, {"cellLayout", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_cellLayout, Setter = null} }, {"cellSwizzle", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_cellSwizzle, Setter = null} }, } }; } } } <|start_filename|>Projects/Java_bin/src/main/gen/cfg/test/DemoDynamic.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.test; import bright.serialization.*; public abstract class DemoDynamic { public DemoDynamic(ByteBuf _buf) { x1 = _buf.readInt(); } public DemoDynamic(int x1 ) { this.x1 = x1; } public static DemoDynamic deserializeDemoDynamic(ByteBuf _buf) { switch (_buf.readInt()) { case cfg.test.DemoD2.__ID__: return new cfg.test.DemoD2(_buf); case cfg.test.DemoE1.__ID__: return new cfg.test.DemoE1(_buf); case cfg.test.DemoD5.__ID__: return new cfg.test.DemoD5(_buf); default: throw new SerializationException(); } } public final int x1; public abstract int getTypeId(); public void resolve(java.util.HashMap<String, Object> _tables) { } @Override public String toString() { return "{ " + "x1:" + x1 + "," + "}"; } } <|start_filename|>Projects/Csharp_Unity_bin_use_UnityEngine_Vector/Assets/Gen/cost/CostCurrencies.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.cost { public sealed class CostCurrencies : cost.Cost { public CostCurrencies(ByteBuf _buf) : base(_buf) { {int n = System.Math.Min(_buf.ReadSize(), _buf.Size);Currencies = new System.Collections.Generic.List<cost.CostCurrency>(n);for(var i = 0 ; i < n ; i++) { cost.CostCurrency _e; _e = cost.CostCurrency.DeserializeCostCurrency(_buf); Currencies.Add(_e);}} } public static CostCurrencies DeserializeCostCurrencies(ByteBuf _buf) { return new cost.CostCurrencies(_buf); } public System.Collections.Generic.List<cost.CostCurrency> Currencies { get; private set; } public const int __ID__ = 103084157; public override int GetTypeId() => __ID__; public override void Resolve(Dictionary<string, object> _tables) { base.Resolve(_tables); foreach(var _e in Currencies) { _e?.Resolve(_tables); } } public override void TranslateText(System.Func<string, string, string> translator) { base.TranslateText(translator); foreach(var _e in Currencies) { _e?.TranslateText(translator); } } public override string ToString() { return "{ " + "Currencies:" + Bright.Common.StringUtil.CollectionToString(Currencies) + "," + "}"; } } } <|start_filename|>Projects/Csharp_DotNet5_json/Gen/test/DemoGroup.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; using System.Text.Json; namespace cfg.test { public sealed class DemoGroup : Bright.Config.BeanBase { public DemoGroup(JsonElement _json) { Id = _json.GetProperty("id").GetInt32(); X1 = _json.GetProperty("x1").GetInt32(); X2 = _json.GetProperty("x2").GetInt32(); X3 = _json.GetProperty("x3").GetInt32(); X4 = _json.GetProperty("x4").GetInt32(); X5 = test.InnerGroup.DeserializeInnerGroup(_json.GetProperty("x5")); } public DemoGroup(int id, int x1, int x2, int x3, int x4, test.InnerGroup x5 ) { this.Id = id; this.X1 = x1; this.X2 = x2; this.X3 = x3; this.X4 = x4; this.X5 = x5; } public static DemoGroup DeserializeDemoGroup(JsonElement _json) { return new test.DemoGroup(_json); } public int Id { get; private set; } public int X1 { get; private set; } public int X2 { get; private set; } public int X3 { get; private set; } public int X4 { get; private set; } public test.InnerGroup X5 { get; private set; } public const int __ID__ = -379263008; public override int GetTypeId() => __ID__; public void Resolve(Dictionary<string, object> _tables) { X5?.Resolve(_tables); } public void TranslateText(System.Func<string, string, string> translator) { X5?.TranslateText(translator); } public override string ToString() { return "{ " + "Id:" + Id + "," + "X1:" + X1 + "," + "X2:" + X2 + "," + "X3:" + X3 + "," + "X4:" + X4 + "," + "X5:" + X5 + "," + "}"; } } } <|start_filename|>Projects/L10N/config_data/test_tbmultirowtitle.lua<|end_filename|> return { [1] = {id=1,name="xxx",x1={y2={z2=2,z3=3,},y3=4,},x2={{z2=1,z3=2,},{z2=3,z3=4,},},x3={{z2=1,z3=2,},{z2=3,z3=4,},},x4={{z2=12,z3=13,},{z2=22,z3=23,},{z2=32,z3=33,},},}, [11] = {id=11,name="yyy",x1={y2={z2=12,z3=13,},y3=14,},x2={{z2=11,z3=12,},{z2=13,z3=14,},},x3={{z2=11,z3=12,},{z2=13,z3=14,},},x4={{z2=112,z3=113,},{z2=122,z3=123,},{z2=132,z3=133,},},}, } <|start_filename|>Projects/Go_json/gen/src/cfg/tag.TestTag.go<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg import "errors" type TagTestTag struct { Id int32 Value string } const TypeId_TagTestTag = 1742933812 func (*TagTestTag) GetTypeId() int32 { return 1742933812 } func (_v *TagTestTag)Deserialize(_buf map[string]interface{}) (err error) { { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["id"].(float64); !_ok_ { err = errors.New("id error"); return }; _v.Id = int32(_tempNum_) } { var _ok_ bool; if _v.Value, _ok_ = _buf["value"].(string); !_ok_ { err = errors.New("value error"); return } } return } func DeserializeTagTestTag(_buf map[string]interface{}) (*TagTestTag, error) { v := &TagTestTag{} if err := v.Deserialize(_buf); err == nil { return v, nil } else { return nil, err } } <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/item/TreasureBox.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.item { public sealed partial class TreasureBox : item.ItemExtra { public TreasureBox(ByteBuf _buf) : base(_buf) { if(_buf.ReadBool()){ KeyItemId = _buf.ReadInt(); } else { KeyItemId = null; } OpenLevel = condition.MinLevel.DeserializeMinLevel(_buf); UseOnObtain = _buf.ReadBool(); {int n = System.Math.Min(_buf.ReadSize(), _buf.Size);DropIds = new System.Collections.Generic.List<int>(n);for(var i = 0 ; i < n ; i++) { int _e; _e = _buf.ReadInt(); DropIds.Add(_e);}} {int n = System.Math.Min(_buf.ReadSize(), _buf.Size);ChooseList = new System.Collections.Generic.List<item.ChooseOneBonus>(n);for(var i = 0 ; i < n ; i++) { item.ChooseOneBonus _e; _e = item.ChooseOneBonus.DeserializeChooseOneBonus(_buf); ChooseList.Add(_e);}} } public TreasureBox(int id, int? key_item_id, condition.MinLevel open_level, bool use_on_obtain, System.Collections.Generic.List<int> drop_ids, System.Collections.Generic.List<item.ChooseOneBonus> choose_list ) : base(id) { this.KeyItemId = key_item_id; this.OpenLevel = open_level; this.UseOnObtain = use_on_obtain; this.DropIds = drop_ids; this.ChooseList = choose_list; } public static TreasureBox DeserializeTreasureBox(ByteBuf _buf) { return new item.TreasureBox(_buf); } public readonly int? KeyItemId; public readonly condition.MinLevel OpenLevel; public readonly bool UseOnObtain; public readonly System.Collections.Generic.List<int> DropIds; public readonly System.Collections.Generic.List<item.ChooseOneBonus> ChooseList; public const int ID = 1494222369; public override int GetTypeId() => ID; public override void Resolve(Dictionary<string, object> _tables) { base.Resolve(_tables); OpenLevel?.Resolve(_tables); foreach(var _e in ChooseList) { _e?.Resolve(_tables); } OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); public override string ToString() { return "{ " + "Id:" + Id + "," + "KeyItemId:" + KeyItemId + "," + "OpenLevel:" + OpenLevel + "," + "UseOnObtain:" + UseOnObtain + "," + "DropIds:" + Bright.Common.StringUtil.CollectionToString(DropIds) + "," + "ChooseList:" + Bright.Common.StringUtil.CollectionToString(ChooseList) + "," + "}"; } } } <|start_filename|>Projects/GenerateDatas/convert_lua/tag.TbTestTag/2004.lua<|end_filename|> return { id = 2004, value = "any", } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_LocationService_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_LocationService_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.LocationService(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.LocationService), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Start(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LocationService; if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.GetFloat(false); obj.Start(Arg0,Arg1); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetFloat(false); obj.Start(Arg0); return; } } if (paramLen == 0) { { obj.Start(); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to Start"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Stop(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LocationService; { { obj.Stop(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_isEnabledByUser(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LocationService; var result = obj.isEnabledByUser; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_status(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LocationService; var result = obj.status; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_lastData(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LocationService; var result = obj.lastData; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "Start", IsStatic = false}, M_Start }, { new Puerts.MethodKey {Name = "Stop", IsStatic = false}, M_Stop }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"isEnabledByUser", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_isEnabledByUser, Setter = null} }, {"status", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_status, Setter = null} }, {"lastData", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_lastData, Setter = null} }, } }; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_WheelHit_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_WheelHit_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.WheelHit constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_collider(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.WheelHit)Puerts.Utils.GetSelf((int)data, self); var result = obj.collider; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_collider(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.WheelHit)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.collider = argHelper.Get<UnityEngine.Collider>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_point(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.WheelHit)Puerts.Utils.GetSelf((int)data, self); var result = obj.point; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_point(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.WheelHit)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.point = argHelper.Get<UnityEngine.Vector3>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_normal(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.WheelHit)Puerts.Utils.GetSelf((int)data, self); var result = obj.normal; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_normal(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.WheelHit)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.normal = argHelper.Get<UnityEngine.Vector3>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_forwardDir(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.WheelHit)Puerts.Utils.GetSelf((int)data, self); var result = obj.forwardDir; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_forwardDir(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.WheelHit)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.forwardDir = argHelper.Get<UnityEngine.Vector3>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_sidewaysDir(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.WheelHit)Puerts.Utils.GetSelf((int)data, self); var result = obj.sidewaysDir; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_sidewaysDir(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.WheelHit)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.sidewaysDir = argHelper.Get<UnityEngine.Vector3>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_force(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.WheelHit)Puerts.Utils.GetSelf((int)data, self); var result = obj.force; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_force(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.WheelHit)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.force = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_forwardSlip(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.WheelHit)Puerts.Utils.GetSelf((int)data, self); var result = obj.forwardSlip; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_forwardSlip(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.WheelHit)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.forwardSlip = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_sidewaysSlip(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.WheelHit)Puerts.Utils.GetSelf((int)data, self); var result = obj.sidewaysSlip; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_sidewaysSlip(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.WheelHit)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.sidewaysSlip = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"collider", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_collider, Setter = S_collider} }, {"point", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_point, Setter = S_point} }, {"normal", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_normal, Setter = S_normal} }, {"forwardDir", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_forwardDir, Setter = S_forwardDir} }, {"sidewaysDir", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_sidewaysDir, Setter = S_sidewaysDir} }, {"force", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_force, Setter = S_force} }, {"forwardSlip", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_forwardSlip, Setter = S_forwardSlip} }, {"sidewaysSlip", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_sidewaysSlip, Setter = S_sidewaysSlip} }, } }; } } } <|start_filename|>Projects/Csharp_CustomTemplate_EncryptMemory/Gen/test/DemoGroup.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using System; using Newtonsoft.Json; using Scripts; namespace cfg.test { [Serializable] public partial class DemoGroup : AConfig { [JsonProperty("x1")] private int _x1 { get; set; } [JsonIgnore] public EncryptInt x1 { get; private set; } = new(); [JsonProperty("x2")] private int _x2 { get; set; } [JsonIgnore] public EncryptInt x2 { get; private set; } = new(); [JsonProperty("x3")] private int _x3 { get; set; } [JsonIgnore] public EncryptInt x3 { get; private set; } = new(); [JsonProperty("x4")] private int _x4 { get; set; } [JsonIgnore] public EncryptInt x4 { get; private set; } = new(); [JsonProperty] public test.InnerGroup x5 { get; set; } public override void EndInit() { x1 = _x1; x2 = _x2; x3 = _x3; x4 = _x4; x5.EndInit(); } public override string ToString() => JsonConvert.SerializeObject(this); } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_ClusterSerialization_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_ClusterSerialization_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.ClusterSerialization constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_SaveTimeManagerState(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<Unity.Collections.NativeArray<byte>>(false); var result = UnityEngine.ClusterSerialization.SaveTimeManagerState(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_RestoreTimeManagerState(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<Unity.Collections.NativeArray<byte>>(false); var result = UnityEngine.ClusterSerialization.RestoreTimeManagerState(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_SaveInputManagerState(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<Unity.Collections.NativeArray<byte>>(false); var result = UnityEngine.ClusterSerialization.SaveInputManagerState(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_RestoreInputManagerState(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<Unity.Collections.NativeArray<byte>>(false); var result = UnityEngine.ClusterSerialization.RestoreInputManagerState(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_SaveClusterInputState(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<Unity.Collections.NativeArray<byte>>(false); var result = UnityEngine.ClusterSerialization.SaveClusterInputState(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_RestoreClusterInputState(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<Unity.Collections.NativeArray<byte>>(false); var result = UnityEngine.ClusterSerialization.RestoreClusterInputState(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "SaveTimeManagerState", IsStatic = true}, F_SaveTimeManagerState }, { new Puerts.MethodKey {Name = "RestoreTimeManagerState", IsStatic = true}, F_RestoreTimeManagerState }, { new Puerts.MethodKey {Name = "SaveInputManagerState", IsStatic = true}, F_SaveInputManagerState }, { new Puerts.MethodKey {Name = "RestoreInputManagerState", IsStatic = true}, F_RestoreInputManagerState }, { new Puerts.MethodKey {Name = "SaveClusterInputState", IsStatic = true}, F_SaveClusterInputState }, { new Puerts.MethodKey {Name = "RestoreClusterInputState", IsStatic = true}, F_RestoreClusterInputState }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { } }; } } } <|start_filename|>Projects/DataTemplates/template_lua2/mail_tbsystemmail.lua<|end_filename|> -- mail.TbSystemMail return { [11] = { id=11, title="测试1", sender="系统", content="测试内容1", award= { 1, }, }, [12] = { id=12, title="测试2", sender="系统", content="测试内容2", award= { 1, }, }, [13] = { id=13, title="测试3", sender="系统", content="测试内容3", award= { 1, }, }, [14] = { id=14, title="测试4", sender="系统", content="测试内容4", award= { 1, }, }, [15] = { id=15, title="测试5", sender="系统", content="测试内容5", award= { 1, }, }, } <|start_filename|>Projects/GenerateDatas/convert_lua/role.TbRoleLevelExpAttr/81.lua<|end_filename|> return { level = 81, need_exp = 230000, clothes_attrs = { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, }, } <|start_filename|>Projects/Go_json/gen/src/cfg/test.TbExcelFromJson.go<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg type TestTbExcelFromJson struct { _dataMap map[int32]*TestExcelFromJson _dataList []*TestExcelFromJson } func NewTestTbExcelFromJson(_buf []map[string]interface{}) (*TestTbExcelFromJson, error) { _dataList := make([]*TestExcelFromJson, 0, len(_buf)) dataMap := make(map[int32]*TestExcelFromJson) for _, _ele_ := range _buf { if _v, err2 := DeserializeTestExcelFromJson(_ele_); err2 != nil { return nil, err2 } else { _dataList = append(_dataList, _v) dataMap[_v.X4] = _v } } return &TestTbExcelFromJson{_dataList:_dataList, _dataMap:dataMap}, nil } func (table *TestTbExcelFromJson) GetDataMap() map[int32]*TestExcelFromJson { return table._dataMap } func (table *TestTbExcelFromJson) GetDataList() []*TestExcelFromJson { return table._dataList } func (table *TestTbExcelFromJson) Get(key int32) *TestExcelFromJson { return table._dataMap[key] } <|start_filename|>Projects/GenerateDatas/convert_lua/role.TbRoleLevelExpAttr/60.lua<|end_filename|> return { level = 60, need_exp = 125000, clothes_attrs = { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, }, } <|start_filename|>Projects/DataTemplates/template_json/mail_tbglobalmail.json<|end_filename|> { "21": {"id":21,"title":"测试1","sender":"系统","content":"测试内容1","award":[1],"all_server":true,"server_list":[],"platform":"1","channel":"1","min_max_level":{"min":1,"max":120},"register_time":{"date_time_range":{"start_time":1589040000,"end_time":1589904000}},"mail_time":{"date_time_range":{"start_time":1589040000,"end_time":1589904000}}} , "22": {"id":22,"title":"","sender":"系统","content":"测试内容2","award":[1],"all_server":false,"server_list":[1],"platform":"1","channel":"1","min_max_level":{"min":20,"max":120},"register_time":{"date_time_range":{"start_time":1588608000}},"mail_time":{"date_time_range":{"start_time":1589904000,"end_time":1590336000}}} , "23": {"id":23,"title":"","sender":"系统","content":"测试内容3","award":[1],"all_server":false,"server_list":[1],"platform":"1","channel":"1","min_max_level":{"min":50,"max":60},"register_time":{"date_time_range":{"end_time":1589644800}},"mail_time":{"date_time_range":{}}} , "24": {"id":24,"title":"","sender":"系统","content":"测试内容3","award":[1],"all_server":false,"server_list":[1],"platform":"1","channel":"1","min_max_level":{"min":50,"max":60},"register_time":{"date_time_range":{"end_time":1589644800}},"mail_time":{"date_time_range":{}}} } <|start_filename|>Projects/GenerateDatas/convert_lua/role.TbRoleLevelExpAttr/39.lua<|end_filename|> return { level = 39, need_exp = 28000, clothes_attrs = { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, }, } <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/test/CompactString.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.test { public sealed partial class CompactString : Bright.Config.BeanBase { public CompactString(ByteBuf _buf) { Id = _buf.ReadInt(); S2 = _buf.ReadString(); S3 = _buf.ReadString(); } public CompactString(int id, string s2, string s3 ) { this.Id = id; this.S2 = s2; this.S3 = s3; } public static CompactString DeserializeCompactString(ByteBuf _buf) { return new test.CompactString(_buf); } public readonly int Id; public readonly string S2; public readonly string S3; public const int ID = 1968089240; public override int GetTypeId() => ID; public void Resolve(Dictionary<string, object> _tables) { OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); public override string ToString() { return "{ " + "Id:" + Id + "," + "S2:" + S2 + "," + "S3:" + S3 + "," + "}"; } } } <|start_filename|>Projects/GenerateDatas/convert_lua/role.TbRoleLevelExpAttr/93.lua<|end_filename|> return { level = 93, need_exp = 290000, clothes_attrs = { 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, }, } <|start_filename|>Projects/DataTemplates/template_erlang/test_tbdefinefromexcelone.erl<|end_filename|> %% test.TbDefineFromExcelOne get() -> #{unlock_equip => 10,unlock_hero => 20,default_avatar => "Assets/Icon/DefaultAvatar.png",default_item => "Assets/Icon/DefaultAvatar.png"}. <|start_filename|>Projects/TypeScript_Unity_Puerts_Bin/Assets/Gen/UnityEngine_ParticleSystem_MainModule_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_ParticleSystem_MainModule_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.ParticleSystem.MainModule constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_emitterVelocity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MainModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.emitterVelocity; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_emitterVelocity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MainModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.emitterVelocity = argHelper.Get<UnityEngine.Vector3>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_duration(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MainModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.duration; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_duration(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MainModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.duration = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_loop(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MainModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.loop; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_loop(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MainModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.loop = argHelper.GetBoolean(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_prewarm(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MainModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.prewarm; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_prewarm(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MainModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.prewarm = argHelper.GetBoolean(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_startDelay(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MainModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.startDelay; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_startDelay(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MainModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.startDelay = argHelper.Get<UnityEngine.ParticleSystem.MinMaxCurve>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_startDelayMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MainModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.startDelayMultiplier; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_startDelayMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MainModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.startDelayMultiplier = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_startLifetime(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MainModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.startLifetime; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_startLifetime(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MainModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.startLifetime = argHelper.Get<UnityEngine.ParticleSystem.MinMaxCurve>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_startLifetimeMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MainModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.startLifetimeMultiplier; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_startLifetimeMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MainModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.startLifetimeMultiplier = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_startSpeed(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MainModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.startSpeed; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_startSpeed(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MainModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.startSpeed = argHelper.Get<UnityEngine.ParticleSystem.MinMaxCurve>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_startSpeedMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MainModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.startSpeedMultiplier; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_startSpeedMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MainModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.startSpeedMultiplier = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_startSize3D(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MainModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.startSize3D; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_startSize3D(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MainModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.startSize3D = argHelper.GetBoolean(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_startSize(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MainModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.startSize; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_startSize(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MainModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.startSize = argHelper.Get<UnityEngine.ParticleSystem.MinMaxCurve>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_startSizeMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MainModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.startSizeMultiplier; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_startSizeMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MainModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.startSizeMultiplier = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_startSizeX(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MainModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.startSizeX; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_startSizeX(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MainModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.startSizeX = argHelper.Get<UnityEngine.ParticleSystem.MinMaxCurve>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_startSizeXMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MainModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.startSizeXMultiplier; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_startSizeXMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MainModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.startSizeXMultiplier = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_startSizeY(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MainModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.startSizeY; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_startSizeY(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MainModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.startSizeY = argHelper.Get<UnityEngine.ParticleSystem.MinMaxCurve>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_startSizeYMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MainModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.startSizeYMultiplier; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_startSizeYMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MainModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.startSizeYMultiplier = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_startSizeZ(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MainModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.startSizeZ; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_startSizeZ(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MainModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.startSizeZ = argHelper.Get<UnityEngine.ParticleSystem.MinMaxCurve>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_startSizeZMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MainModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.startSizeZMultiplier; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_startSizeZMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MainModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.startSizeZMultiplier = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_startRotation3D(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MainModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.startRotation3D; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_startRotation3D(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MainModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.startRotation3D = argHelper.GetBoolean(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_startRotation(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MainModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.startRotation; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_startRotation(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MainModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.startRotation = argHelper.Get<UnityEngine.ParticleSystem.MinMaxCurve>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_startRotationMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MainModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.startRotationMultiplier; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_startRotationMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MainModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.startRotationMultiplier = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_startRotationX(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MainModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.startRotationX; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_startRotationX(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MainModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.startRotationX = argHelper.Get<UnityEngine.ParticleSystem.MinMaxCurve>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_startRotationXMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MainModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.startRotationXMultiplier; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_startRotationXMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MainModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.startRotationXMultiplier = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_startRotationY(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MainModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.startRotationY; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_startRotationY(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MainModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.startRotationY = argHelper.Get<UnityEngine.ParticleSystem.MinMaxCurve>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_startRotationYMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MainModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.startRotationYMultiplier; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_startRotationYMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MainModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.startRotationYMultiplier = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_startRotationZ(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MainModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.startRotationZ; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_startRotationZ(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MainModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.startRotationZ = argHelper.Get<UnityEngine.ParticleSystem.MinMaxCurve>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_startRotationZMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MainModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.startRotationZMultiplier; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_startRotationZMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MainModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.startRotationZMultiplier = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_flipRotation(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MainModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.flipRotation; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_flipRotation(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MainModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.flipRotation = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_startColor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MainModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.startColor; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_startColor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MainModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.startColor = argHelper.Get<UnityEngine.ParticleSystem.MinMaxGradient>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_gravityModifier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MainModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.gravityModifier; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_gravityModifier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MainModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.gravityModifier = argHelper.Get<UnityEngine.ParticleSystem.MinMaxCurve>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_gravityModifierMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MainModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.gravityModifierMultiplier; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_gravityModifierMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MainModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.gravityModifierMultiplier = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_simulationSpace(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MainModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.simulationSpace; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_simulationSpace(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MainModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.simulationSpace = (UnityEngine.ParticleSystemSimulationSpace)argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_customSimulationSpace(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MainModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.customSimulationSpace; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_customSimulationSpace(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MainModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.customSimulationSpace = argHelper.Get<UnityEngine.Transform>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_simulationSpeed(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MainModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.simulationSpeed; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_simulationSpeed(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MainModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.simulationSpeed = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_useUnscaledTime(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MainModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.useUnscaledTime; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_useUnscaledTime(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MainModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.useUnscaledTime = argHelper.GetBoolean(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_scalingMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MainModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.scalingMode; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_scalingMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MainModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.scalingMode = (UnityEngine.ParticleSystemScalingMode)argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_playOnAwake(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MainModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.playOnAwake; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_playOnAwake(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MainModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.playOnAwake = argHelper.GetBoolean(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_maxParticles(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MainModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.maxParticles; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_maxParticles(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MainModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.maxParticles = argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_emitterVelocityMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MainModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.emitterVelocityMode; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_emitterVelocityMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MainModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.emitterVelocityMode = (UnityEngine.ParticleSystemEmitterVelocityMode)argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_stopAction(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MainModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.stopAction; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_stopAction(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MainModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.stopAction = (UnityEngine.ParticleSystemStopAction)argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_ringBufferMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MainModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.ringBufferMode; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_ringBufferMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MainModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.ringBufferMode = (UnityEngine.ParticleSystemRingBufferMode)argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_ringBufferLoopRange(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MainModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.ringBufferLoopRange; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_ringBufferLoopRange(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MainModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.ringBufferLoopRange = argHelper.Get<UnityEngine.Vector2>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_cullingMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MainModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.cullingMode; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_cullingMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.MainModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.cullingMode = (UnityEngine.ParticleSystemCullingMode)argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"emitterVelocity", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_emitterVelocity, Setter = S_emitterVelocity} }, {"duration", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_duration, Setter = S_duration} }, {"loop", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_loop, Setter = S_loop} }, {"prewarm", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_prewarm, Setter = S_prewarm} }, {"startDelay", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_startDelay, Setter = S_startDelay} }, {"startDelayMultiplier", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_startDelayMultiplier, Setter = S_startDelayMultiplier} }, {"startLifetime", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_startLifetime, Setter = S_startLifetime} }, {"startLifetimeMultiplier", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_startLifetimeMultiplier, Setter = S_startLifetimeMultiplier} }, {"startSpeed", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_startSpeed, Setter = S_startSpeed} }, {"startSpeedMultiplier", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_startSpeedMultiplier, Setter = S_startSpeedMultiplier} }, {"startSize3D", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_startSize3D, Setter = S_startSize3D} }, {"startSize", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_startSize, Setter = S_startSize} }, {"startSizeMultiplier", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_startSizeMultiplier, Setter = S_startSizeMultiplier} }, {"startSizeX", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_startSizeX, Setter = S_startSizeX} }, {"startSizeXMultiplier", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_startSizeXMultiplier, Setter = S_startSizeXMultiplier} }, {"startSizeY", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_startSizeY, Setter = S_startSizeY} }, {"startSizeYMultiplier", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_startSizeYMultiplier, Setter = S_startSizeYMultiplier} }, {"startSizeZ", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_startSizeZ, Setter = S_startSizeZ} }, {"startSizeZMultiplier", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_startSizeZMultiplier, Setter = S_startSizeZMultiplier} }, {"startRotation3D", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_startRotation3D, Setter = S_startRotation3D} }, {"startRotation", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_startRotation, Setter = S_startRotation} }, {"startRotationMultiplier", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_startRotationMultiplier, Setter = S_startRotationMultiplier} }, {"startRotationX", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_startRotationX, Setter = S_startRotationX} }, {"startRotationXMultiplier", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_startRotationXMultiplier, Setter = S_startRotationXMultiplier} }, {"startRotationY", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_startRotationY, Setter = S_startRotationY} }, {"startRotationYMultiplier", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_startRotationYMultiplier, Setter = S_startRotationYMultiplier} }, {"startRotationZ", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_startRotationZ, Setter = S_startRotationZ} }, {"startRotationZMultiplier", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_startRotationZMultiplier, Setter = S_startRotationZMultiplier} }, {"flipRotation", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_flipRotation, Setter = S_flipRotation} }, {"startColor", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_startColor, Setter = S_startColor} }, {"gravityModifier", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_gravityModifier, Setter = S_gravityModifier} }, {"gravityModifierMultiplier", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_gravityModifierMultiplier, Setter = S_gravityModifierMultiplier} }, {"simulationSpace", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_simulationSpace, Setter = S_simulationSpace} }, {"customSimulationSpace", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_customSimulationSpace, Setter = S_customSimulationSpace} }, {"simulationSpeed", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_simulationSpeed, Setter = S_simulationSpeed} }, {"useUnscaledTime", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_useUnscaledTime, Setter = S_useUnscaledTime} }, {"scalingMode", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_scalingMode, Setter = S_scalingMode} }, {"playOnAwake", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_playOnAwake, Setter = S_playOnAwake} }, {"maxParticles", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_maxParticles, Setter = S_maxParticles} }, {"emitterVelocityMode", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_emitterVelocityMode, Setter = S_emitterVelocityMode} }, {"stopAction", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_stopAction, Setter = S_stopAction} }, {"ringBufferMode", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_ringBufferMode, Setter = S_ringBufferMode} }, {"ringBufferLoopRange", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_ringBufferLoopRange, Setter = S_ringBufferLoopRange} }, {"cullingMode", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_cullingMode, Setter = S_cullingMode} }, } }; } } } <|start_filename|>Projects/DataTemplates/template_lua2/test_tbtestexcelbean.lua<|end_filename|> -- test.TbTestExcelBean return { [1] = { x1=1, x2="xx", x3=2, x4=2.5, }, [2] = { x1=2, x2="zz", x3=2, x4=4.3, }, [3] = { x1=3, x2="ww", x3=2, x4=5, }, [4] = { x1=4, x2="ee", x3=2, x4=6, }, } <|start_filename|>Projects/GenerateDatas/convert_json/item.TbItemExtra/1040040002.json<|end_filename|> { "__type__": "InteractionItem", "id": 1040040002, "holding_static_mesh": "StaticMesh\u0027/Game/X6GameData/Art_assets/Props/Prop_test/Interactive/PenQuanHua/SM_Penquanhua.SM_Penquanhua\u0027", "holding_static_mesh_mat": "" } <|start_filename|>Projects/DataTemplates/template_lua2/test_tbtestglobal.lua<|end_filename|> -- test.TbTestGlobal return { unlock_equip=10, unlock_hero=20, }, <|start_filename|>Projects/java_json/src/gen/cfg/ai/Task.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.ai; import com.google.gson.JsonElement; import com.google.gson.JsonObject; public abstract class Task extends cfg.ai.FlowNode { public Task(JsonObject __json__) { super(__json__); ignoreRestartSelf = __json__.get("ignore_restart_self").getAsBoolean(); } public Task(int id, String node_name, java.util.ArrayList<cfg.ai.Decorator> decorators, java.util.ArrayList<cfg.ai.Service> services, boolean ignore_restart_self ) { super(id, node_name, decorators, services); this.ignoreRestartSelf = ignore_restart_self; } public static Task deserializeTask(JsonObject __json__) { switch (__json__.get("__type__").getAsString()) { case "UeWait": return new cfg.ai.UeWait(__json__); case "UeWaitBlackboardTime": return new cfg.ai.UeWaitBlackboardTime(__json__); case "MoveToTarget": return new cfg.ai.MoveToTarget(__json__); case "ChooseSkill": return new cfg.ai.ChooseSkill(__json__); case "MoveToRandomLocation": return new cfg.ai.MoveToRandomLocation(__json__); case "MoveToLocation": return new cfg.ai.MoveToLocation(__json__); case "DebugPrint": return new cfg.ai.DebugPrint(__json__); default: throw new bright.serialization.SerializationException(); } } public final boolean ignoreRestartSelf; @Override public void resolve(java.util.HashMap<String, Object> _tables) { super.resolve(_tables); } @Override public String toString() { return "{ " + "id:" + id + "," + "nodeName:" + nodeName + "," + "decorators:" + decorators + "," + "services:" + services + "," + "ignoreRestartSelf:" + ignoreRestartSelf + "," + "}"; } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_UI_Graphic_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_UI_Graphic_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.UI.Graphic constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetAllDirty(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Graphic; { { obj.SetAllDirty(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetLayoutDirty(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Graphic; { { obj.SetLayoutDirty(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetVerticesDirty(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Graphic; { { obj.SetVerticesDirty(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetMaterialDirty(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Graphic; { { obj.SetMaterialDirty(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_OnCullingChanged(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Graphic; { { obj.OnCullingChanged(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Rebuild(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Graphic; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = (UnityEngine.UI.CanvasUpdate)argHelper0.GetInt32(false); obj.Rebuild(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_LayoutComplete(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Graphic; { { obj.LayoutComplete(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GraphicUpdateComplete(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Graphic; { { obj.GraphicUpdateComplete(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetNativeSize(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Graphic; { { obj.SetNativeSize(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Raycast(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Graphic; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Camera>(false); var result = obj.Raycast(Arg0,Arg1); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_PixelAdjustPoint(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Graphic; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var result = obj.PixelAdjustPoint(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetPixelAdjustedRect(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Graphic; { { var result = obj.GetPixelAdjustedRect(); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_CrossFadeColor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Graphic; if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Color), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Color>(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.GetBoolean(false); var Arg3 = argHelper3.GetBoolean(false); obj.CrossFadeColor(Arg0,Arg1,Arg2,Arg3); return; } } if (paramLen == 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Color), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Color>(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.GetBoolean(false); var Arg3 = argHelper3.GetBoolean(false); var Arg4 = argHelper4.GetBoolean(false); obj.CrossFadeColor(Arg0,Arg1,Arg2,Arg3,Arg4); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to CrossFadeColor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_CrossFadeAlpha(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Graphic; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.GetBoolean(false); obj.CrossFadeAlpha(Arg0,Arg1,Arg2); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_RegisterDirtyLayoutCallback(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Graphic; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Events.UnityAction>(false); obj.RegisterDirtyLayoutCallback(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_UnregisterDirtyLayoutCallback(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Graphic; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Events.UnityAction>(false); obj.UnregisterDirtyLayoutCallback(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_RegisterDirtyVerticesCallback(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Graphic; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Events.UnityAction>(false); obj.RegisterDirtyVerticesCallback(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_UnregisterDirtyVerticesCallback(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Graphic; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Events.UnityAction>(false); obj.UnregisterDirtyVerticesCallback(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_RegisterDirtyMaterialCallback(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Graphic; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Events.UnityAction>(false); obj.RegisterDirtyMaterialCallback(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_UnregisterDirtyMaterialCallback(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Graphic; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Events.UnityAction>(false); obj.UnregisterDirtyMaterialCallback(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_defaultGraphicMaterial(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.UI.Graphic.defaultGraphicMaterial; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_color(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Graphic; var result = obj.color; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_color(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Graphic; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.color = argHelper.Get<UnityEngine.Color>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_raycastTarget(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Graphic; var result = obj.raycastTarget; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_raycastTarget(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Graphic; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.raycastTarget = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_raycastPadding(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Graphic; var result = obj.raycastPadding; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_raycastPadding(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Graphic; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.raycastPadding = argHelper.Get<UnityEngine.Vector4>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_depth(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Graphic; var result = obj.depth; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_rectTransform(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Graphic; var result = obj.rectTransform; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_canvas(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Graphic; var result = obj.canvas; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_canvasRenderer(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Graphic; var result = obj.canvasRenderer; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_defaultMaterial(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Graphic; var result = obj.defaultMaterial; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_material(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Graphic; var result = obj.material; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_material(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Graphic; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.material = argHelper.Get<UnityEngine.Material>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_materialForRendering(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Graphic; var result = obj.materialForRendering; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_mainTexture(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Graphic; var result = obj.mainTexture; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "SetAllDirty", IsStatic = false}, M_SetAllDirty }, { new Puerts.MethodKey {Name = "SetLayoutDirty", IsStatic = false}, M_SetLayoutDirty }, { new Puerts.MethodKey {Name = "SetVerticesDirty", IsStatic = false}, M_SetVerticesDirty }, { new Puerts.MethodKey {Name = "SetMaterialDirty", IsStatic = false}, M_SetMaterialDirty }, { new Puerts.MethodKey {Name = "OnCullingChanged", IsStatic = false}, M_OnCullingChanged }, { new Puerts.MethodKey {Name = "Rebuild", IsStatic = false}, M_Rebuild }, { new Puerts.MethodKey {Name = "LayoutComplete", IsStatic = false}, M_LayoutComplete }, { new Puerts.MethodKey {Name = "GraphicUpdateComplete", IsStatic = false}, M_GraphicUpdateComplete }, { new Puerts.MethodKey {Name = "SetNativeSize", IsStatic = false}, M_SetNativeSize }, { new Puerts.MethodKey {Name = "Raycast", IsStatic = false}, M_Raycast }, { new Puerts.MethodKey {Name = "PixelAdjustPoint", IsStatic = false}, M_PixelAdjustPoint }, { new Puerts.MethodKey {Name = "GetPixelAdjustedRect", IsStatic = false}, M_GetPixelAdjustedRect }, { new Puerts.MethodKey {Name = "CrossFadeColor", IsStatic = false}, M_CrossFadeColor }, { new Puerts.MethodKey {Name = "CrossFadeAlpha", IsStatic = false}, M_CrossFadeAlpha }, { new Puerts.MethodKey {Name = "RegisterDirtyLayoutCallback", IsStatic = false}, M_RegisterDirtyLayoutCallback }, { new Puerts.MethodKey {Name = "UnregisterDirtyLayoutCallback", IsStatic = false}, M_UnregisterDirtyLayoutCallback }, { new Puerts.MethodKey {Name = "RegisterDirtyVerticesCallback", IsStatic = false}, M_RegisterDirtyVerticesCallback }, { new Puerts.MethodKey {Name = "UnregisterDirtyVerticesCallback", IsStatic = false}, M_UnregisterDirtyVerticesCallback }, { new Puerts.MethodKey {Name = "RegisterDirtyMaterialCallback", IsStatic = false}, M_RegisterDirtyMaterialCallback }, { new Puerts.MethodKey {Name = "UnregisterDirtyMaterialCallback", IsStatic = false}, M_UnregisterDirtyMaterialCallback }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"defaultGraphicMaterial", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_defaultGraphicMaterial, Setter = null} }, {"color", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_color, Setter = S_color} }, {"raycastTarget", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_raycastTarget, Setter = S_raycastTarget} }, {"raycastPadding", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_raycastPadding, Setter = S_raycastPadding} }, {"depth", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_depth, Setter = null} }, {"rectTransform", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_rectTransform, Setter = null} }, {"canvas", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_canvas, Setter = null} }, {"canvasRenderer", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_canvasRenderer, Setter = null} }, {"defaultMaterial", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_defaultMaterial, Setter = null} }, {"material", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_material, Setter = S_material} }, {"materialForRendering", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_materialForRendering, Setter = null} }, {"mainTexture", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_mainTexture, Setter = null} }, } }; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_ParticleSystem_TrailModule_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_ParticleSystem_TrailModule_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.ParticleSystem.TrailModule constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_enabled(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.TrailModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.enabled; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_enabled(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.TrailModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.enabled = argHelper.GetBoolean(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_mode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.TrailModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.mode; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_mode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.TrailModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.mode = (UnityEngine.ParticleSystemTrailMode)argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_ratio(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.TrailModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.ratio; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_ratio(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.TrailModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.ratio = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_lifetime(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.TrailModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.lifetime; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_lifetime(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.TrailModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.lifetime = argHelper.Get<UnityEngine.ParticleSystem.MinMaxCurve>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_lifetimeMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.TrailModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.lifetimeMultiplier; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_lifetimeMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.TrailModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.lifetimeMultiplier = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_minVertexDistance(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.TrailModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.minVertexDistance; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_minVertexDistance(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.TrailModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.minVertexDistance = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_textureMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.TrailModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.textureMode; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_textureMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.TrailModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.textureMode = (UnityEngine.ParticleSystemTrailTextureMode)argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_worldSpace(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.TrailModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.worldSpace; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_worldSpace(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.TrailModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.worldSpace = argHelper.GetBoolean(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_dieWithParticles(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.TrailModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.dieWithParticles; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_dieWithParticles(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.TrailModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.dieWithParticles = argHelper.GetBoolean(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_sizeAffectsWidth(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.TrailModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.sizeAffectsWidth; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_sizeAffectsWidth(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.TrailModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.sizeAffectsWidth = argHelper.GetBoolean(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_sizeAffectsLifetime(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.TrailModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.sizeAffectsLifetime; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_sizeAffectsLifetime(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.TrailModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.sizeAffectsLifetime = argHelper.GetBoolean(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_inheritParticleColor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.TrailModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.inheritParticleColor; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_inheritParticleColor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.TrailModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.inheritParticleColor = argHelper.GetBoolean(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_colorOverLifetime(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.TrailModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.colorOverLifetime; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_colorOverLifetime(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.TrailModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.colorOverLifetime = argHelper.Get<UnityEngine.ParticleSystem.MinMaxGradient>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_widthOverTrail(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.TrailModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.widthOverTrail; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_widthOverTrail(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.TrailModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.widthOverTrail = argHelper.Get<UnityEngine.ParticleSystem.MinMaxCurve>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_widthOverTrailMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.TrailModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.widthOverTrailMultiplier; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_widthOverTrailMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.TrailModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.widthOverTrailMultiplier = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_colorOverTrail(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.TrailModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.colorOverTrail; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_colorOverTrail(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.TrailModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.colorOverTrail = argHelper.Get<UnityEngine.ParticleSystem.MinMaxGradient>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_generateLightingData(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.TrailModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.generateLightingData; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_generateLightingData(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.TrailModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.generateLightingData = argHelper.GetBoolean(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_ribbonCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.TrailModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.ribbonCount; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_ribbonCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.TrailModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.ribbonCount = argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_shadowBias(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.TrailModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.shadowBias; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_shadowBias(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.TrailModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.shadowBias = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_splitSubEmitterRibbons(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.TrailModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.splitSubEmitterRibbons; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_splitSubEmitterRibbons(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.TrailModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.splitSubEmitterRibbons = argHelper.GetBoolean(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_attachRibbonsToTransform(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.TrailModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.attachRibbonsToTransform; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_attachRibbonsToTransform(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.TrailModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.attachRibbonsToTransform = argHelper.GetBoolean(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"enabled", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_enabled, Setter = S_enabled} }, {"mode", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_mode, Setter = S_mode} }, {"ratio", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_ratio, Setter = S_ratio} }, {"lifetime", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_lifetime, Setter = S_lifetime} }, {"lifetimeMultiplier", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_lifetimeMultiplier, Setter = S_lifetimeMultiplier} }, {"minVertexDistance", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_minVertexDistance, Setter = S_minVertexDistance} }, {"textureMode", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_textureMode, Setter = S_textureMode} }, {"worldSpace", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_worldSpace, Setter = S_worldSpace} }, {"dieWithParticles", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_dieWithParticles, Setter = S_dieWithParticles} }, {"sizeAffectsWidth", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_sizeAffectsWidth, Setter = S_sizeAffectsWidth} }, {"sizeAffectsLifetime", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_sizeAffectsLifetime, Setter = S_sizeAffectsLifetime} }, {"inheritParticleColor", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_inheritParticleColor, Setter = S_inheritParticleColor} }, {"colorOverLifetime", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_colorOverLifetime, Setter = S_colorOverLifetime} }, {"widthOverTrail", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_widthOverTrail, Setter = S_widthOverTrail} }, {"widthOverTrailMultiplier", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_widthOverTrailMultiplier, Setter = S_widthOverTrailMultiplier} }, {"colorOverTrail", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_colorOverTrail, Setter = S_colorOverTrail} }, {"generateLightingData", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_generateLightingData, Setter = S_generateLightingData} }, {"ribbonCount", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_ribbonCount, Setter = S_ribbonCount} }, {"shadowBias", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_shadowBias, Setter = S_shadowBias} }, {"splitSubEmitterRibbons", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_splitSubEmitterRibbons, Setter = S_splitSubEmitterRibbons} }, {"attachRibbonsToTransform", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_attachRibbonsToTransform, Setter = S_attachRibbonsToTransform} }, } }; } } } <|start_filename|>Projects/GenerateDatas/convert_lua/role.TbRoleLevelExpAttr/43.lua<|end_filename|> return { level = 43, need_exp = 40000, clothes_attrs = { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, }, } <|start_filename|>Projects/DataTemplates/template_lua/test_tbtestglobal.lua<|end_filename|> return {unlock_equip=10,unlock_hero=20,} <|start_filename|>Projects/DataTemplates/template_lua2/error_tberrorinfo.lua<|end_filename|> -- error.TbErrorInfo return { ["EXAMPLE_FLASH"] = { code="EXAMPLE_FLASH", desc="这是一个例子飘窗", style= { }, }, ["EXAMPLE_MSGBOX"] = { code="EXAMPLE_MSGBOX", desc="例子弹框,消息决定行为", style= { btn_name="要重启了", operation=1, }, }, ["EXAMPLE_DLG_OK"] = { code="EXAMPLE_DLG_OK", desc="例子:单按钮提示,用户自己提供回调", style= { btn_name="联知道了", }, }, ["EXAMPLE_DLG_OK_CANCEL"] = { code="EXAMPLE_DLG_OK_CANCEL", desc="例子:双按钮提示,用户自己提供回调", style= { btn1_name="别", btn2_name="好", }, }, ["ROLE_CREATE_NAME_INVALID_CHAR"] = { code="ROLE_CREATE_NAME_INVALID_CHAR", desc="角色名字有非法字符", style= { }, }, ["ROLE_CREATE_NAME_EMPTY"] = { code="ROLE_CREATE_NAME_EMPTY", desc="名字为空", style= { }, }, ["ROLE_CREATE_NAME_EXCEED_MAX_LENGTH"] = { code="ROLE_CREATE_NAME_EXCEED_MAX_LENGTH", desc="名字太长", style= { }, }, ["ROLE_CREATE_ROLE_LIST_FULL"] = { code="ROLE_CREATE_ROLE_LIST_FULL", desc="角色列表已满", style= { }, }, ["ROLE_CREATE_INVALID_PROFESSION"] = { code="ROLE_CREATE_INVALID_PROFESSION", desc="非法职业", style= { }, }, ["PARAM_ILLEGAL"] = { code="PARAM_ILLEGAL", desc="参数非法", style= { }, }, ["BAG_IS_FULL"] = { code="BAG_IS_FULL", desc="背包已满", style= { }, }, ["ITEM_NOT_ENOUGH"] = { code="ITEM_NOT_ENOUGH", desc="道具不足", style= { }, }, ["ITEM_IN_BAG"] = { code="ITEM_IN_BAG", desc="道具已在背包中", style= { }, }, ["GENDER_NOT_MATCH"] = { code="GENDER_NOT_MATCH", desc="", style= { }, }, ["LEVEL_TOO_LOW"] = { code="LEVEL_TOO_LOW", desc="等级太低", style= { }, }, ["LEVEL_TOO_HIGH"] = { code="LEVEL_TOO_HIGH", desc="等级太高", style= { }, }, ["EXCEED_LIMIT"] = { code="EXCEED_LIMIT", desc="超过限制", style= { }, }, ["OVER_TIME"] = { code="OVER_TIME", desc="超时", style= { }, }, ["SKILL_NOT_IN_LIST"] = { code="SKILL_NOT_IN_LIST", desc="", style= { }, }, ["SKILL_NOT_COOLDOWN"] = { code="SKILL_NOT_COOLDOWN", desc="", style= { }, }, ["SKILL_TARGET_NOT_EXIST"] = { code="SKILL_TARGET_NOT_EXIST", desc="", style= { }, }, ["SKILL_ANOTHER_CASTING"] = { code="SKILL_ANOTHER_CASTING", desc="", style= { }, }, ["MAIL_TYPE_ERROR"] = { code="MAIL_TYPE_ERROR", desc="邮件类型错误", style= { }, }, ["MAIL_HAVE_DELETED"] = { code="MAIL_HAVE_DELETED", desc="邮件已删除", style= { }, }, ["MAIL_AWARD_HAVE_RECEIVED"] = { code="MAIL_AWARD_HAVE_RECEIVED", desc="邮件奖励已领取", style= { }, }, ["MAIL_OPERATE_TYPE_ERROR"] = { code="MAIL_OPERATE_TYPE_ERROR", desc="邮件操作类型错误", style= { }, }, ["MAIL_CONDITION_NOT_MEET"] = { code="MAIL_CONDITION_NOT_MEET", desc="邮件条件不满足", style= { }, }, ["MAIL_NO_AWARD"] = { code="MAIL_NO_AWARD", desc="邮件没有奖励", style= { }, }, ["MAIL_BOX_IS_FULL"] = { code="MAIL_BOX_IS_FULL", desc="邮箱已满", style= { }, }, ["NO_INTERACTION_COMPONENT"] = { code="NO_INTERACTION_COMPONENT", desc="在被拾取对象上,找不到交互组件!!", style= { }, }, ["BUTTON_TOO_MANY_CLICKS"] = { code="BUTTON_TOO_MANY_CLICKS", desc="点击次数太多了", style= { }, }, ["SKILL_ENEYGY_LACK"] = { code="SKILL_ENEYGY_LACK", desc="技能能量不足", style= { }, }, ["SKILL_IS_COOLINGDOWN"] = { code="SKILL_IS_COOLINGDOWN", desc="技能冷却中", style= { }, }, ["SKILL_NO_REACTION_OBJ"] = { code="SKILL_NO_REACTION_OBJ", desc="当前没有对技能生效的物体", style= { }, }, ["SKILL_NOT_UNLOCKED"] = { code="SKILL_NOT_UNLOCKED", desc="技能尚未解锁", style= { }, }, ["SKILL_IS_GROUP_COLLINGDOWN"] = { code="SKILL_IS_GROUP_COLLINGDOWN", desc="技能释放中", style= { }, }, ["CLOTH_CHANGE_TOO_FAST"] = { code="CLOTH_CHANGE_TOO_FAST", desc="暖暖正在换衣服中,请稍等", style= { }, }, ["CLOTH_CHANGE_NOT_ALLOW"] = { code="CLOTH_CHANGE_NOT_ALLOW", desc="当前状态不允许换装", style= { }, }, ["CLOTH_CHANGE_SAME"] = { code="CLOTH_CHANGE_SAME", desc="换的还是目前的套装", style= { }, }, ["HAS_BIND_SERVER"] = { code="HAS_BIND_SERVER", desc="已经绑定过该服务器", style= { btn_name="ok", operation=1, }, }, ["AUTH_FAIL"] = { code="AUTH_FAIL", desc="认证失败", style= { btn_name="ok", operation=1, }, }, ["NOT_BIND_SERVER"] = { code="NOT_BIND_SERVER", desc="没有绑定服务器", style= { btn_name="ok", operation=1, }, }, ["SERVER_ACCESS_FAIL"] = { code="SERVER_ACCESS_FAIL", desc="访问服务器失败", style= { btn_name="ok", operation=1, }, }, ["SERVER_NOT_EXISTS"] = { code="SERVER_NOT_EXISTS", desc="该服务器不存在", style= { btn_name="ok", operation=1, }, }, ["SUIT_NOT_UNLOCK"] = { code="SUIT_NOT_UNLOCK", desc="套装尚未解锁", style= { }, }, ["SUIT_COMPONENT_NOT_UNLOCK"] = { code="SUIT_COMPONENT_NOT_UNLOCK", desc="部件尚未解锁", style= { }, }, ["SUIT_STATE_ERROR"] = { code="SUIT_STATE_ERROR", desc="套装状态错误", style= { }, }, ["SUIT_COMPONENT_STATE_ERROR"] = { code="SUIT_COMPONENT_STATE_ERROR", desc="部件状态错误", style= { }, }, ["SUIT_COMPONENT_NO_NEED_LEARN"] = { code="SUIT_COMPONENT_NO_NEED_LEARN", desc="设计图纸对应的部件均已完成学习", style= { }, }, } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_AssetBundleRecompressOperation_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_AssetBundleRecompressOperation_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.AssetBundleRecompressOperation(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.AssetBundleRecompressOperation), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_humanReadableResult(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AssetBundleRecompressOperation; var result = obj.humanReadableResult; Puerts.PuertsDLL.ReturnString(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_inputPath(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AssetBundleRecompressOperation; var result = obj.inputPath; Puerts.PuertsDLL.ReturnString(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_outputPath(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AssetBundleRecompressOperation; var result = obj.outputPath; Puerts.PuertsDLL.ReturnString(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_result(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AssetBundleRecompressOperation; var result = obj.result; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_success(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AssetBundleRecompressOperation; var result = obj.success; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"humanReadableResult", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_humanReadableResult, Setter = null} }, {"inputPath", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_inputPath, Setter = null} }, {"outputPath", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_outputPath, Setter = null} }, {"result", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_result, Setter = null} }, {"success", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_success, Setter = null} }, } }; } } } <|start_filename|>ProtoProjects/go/src/main.go<|end_filename|> package main import "proto" func main() { v := &proto.TestAllType{} v.A1 = "abc" } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_CanvasGroup_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_CanvasGroup_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.CanvasGroup(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.CanvasGroup), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_IsRaycastLocationValid(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CanvasGroup; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Camera>(false); var result = obj.IsRaycastLocationValid(Arg0,Arg1); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_alpha(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CanvasGroup; var result = obj.alpha; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_alpha(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CanvasGroup; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.alpha = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_interactable(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CanvasGroup; var result = obj.interactable; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_interactable(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CanvasGroup; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.interactable = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_blocksRaycasts(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CanvasGroup; var result = obj.blocksRaycasts; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_blocksRaycasts(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CanvasGroup; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.blocksRaycasts = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_ignoreParentGroups(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CanvasGroup; var result = obj.ignoreParentGroups; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_ignoreParentGroups(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CanvasGroup; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.ignoreParentGroups = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "IsRaycastLocationValid", IsStatic = false}, M_IsRaycastLocationValid }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"alpha", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_alpha, Setter = S_alpha} }, {"interactable", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_interactable, Setter = S_interactable} }, {"blocksRaycasts", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_blocksRaycasts, Setter = S_blocksRaycasts} }, {"ignoreParentGroups", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_ignoreParentGroups, Setter = S_ignoreParentGroups} }, } }; } } } <|start_filename|>Projects/Go_json/gen/src/cfg/test.TbDefineFromExcel2.go<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg type TestTbDefineFromExcel2 struct { _dataMap map[int32]*TestDefineFromExcel2 _dataList []*TestDefineFromExcel2 } func NewTestTbDefineFromExcel2(_buf []map[string]interface{}) (*TestTbDefineFromExcel2, error) { _dataList := make([]*TestDefineFromExcel2, 0, len(_buf)) dataMap := make(map[int32]*TestDefineFromExcel2) for _, _ele_ := range _buf { if _v, err2 := DeserializeTestDefineFromExcel2(_ele_); err2 != nil { return nil, err2 } else { _dataList = append(_dataList, _v) dataMap[_v.Id] = _v } } return &TestTbDefineFromExcel2{_dataList:_dataList, _dataMap:dataMap}, nil } func (table *TestTbDefineFromExcel2) GetDataMap() map[int32]*TestDefineFromExcel2 { return table._dataMap } func (table *TestTbDefineFromExcel2) GetDataList() []*TestDefineFromExcel2 { return table._dataList } func (table *TestTbDefineFromExcel2) Get(key int32) *TestDefineFromExcel2 { return table._dataMap[key] } <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/test/TbTestJson2.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.test { public sealed partial class TbTestJson2 { private readonly Dictionary<int, test.TestJson2> _dataMap; private readonly List<test.TestJson2> _dataList; public TbTestJson2(ByteBuf _buf) { _dataMap = new Dictionary<int, test.TestJson2>(); _dataList = new List<test.TestJson2>(); for(int n = _buf.ReadSize() ; n > 0 ; --n) { test.TestJson2 _v; _v = test.TestJson2.DeserializeTestJson2(_buf); _dataList.Add(_v); _dataMap.Add(_v.Id, _v); } } public Dictionary<int, test.TestJson2> DataMap => _dataMap; public List<test.TestJson2> DataList => _dataList; public test.TestJson2 GetOrDefault(int key) => _dataMap.TryGetValue(key, out var v) ? v : null; public test.TestJson2 Get(int key) => _dataMap[key]; public test.TestJson2 this[int key] => _dataMap[key]; public void Resolve(Dictionary<string, object> _tables) { foreach(var v in _dataList) { v.Resolve(_tables); } OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); } } <|start_filename|>Projects/java_json/src/gen/cfg/condition/MinLevel.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.condition; import com.google.gson.JsonElement; import com.google.gson.JsonObject; public final class MinLevel extends cfg.condition.BoolRoleCondition { public MinLevel(JsonObject __json__) { super(__json__); level = __json__.get("level").getAsInt(); } public MinLevel(int level ) { super(); this.level = level; } public static MinLevel deserializeMinLevel(JsonObject __json__) { return new MinLevel(__json__); } public final int level; public static final int __ID__ = -1075273755; @Override public int getTypeId() { return __ID__; } @Override public void resolve(java.util.HashMap<String, Object> _tables) { super.resolve(_tables); } @Override public String toString() { return "{ " + "level:" + level + "," + "}"; } } <|start_filename|>Projects/Csharp_Unity_bin_use_UnityEngine_Vector/Assets/Gen/test/TestIndex.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.test { public sealed class TestIndex : Bright.Config.BeanBase { public TestIndex(ByteBuf _buf) { Id = _buf.ReadInt(); {int n = System.Math.Min(_buf.ReadSize(), _buf.Size);Eles = new System.Collections.Generic.List<test.DemoType1>(n);for(var i = 0 ; i < n ; i++) { test.DemoType1 _e; _e = test.DemoType1.DeserializeDemoType1(_buf); Eles.Add(_e);}} } public static TestIndex DeserializeTestIndex(ByteBuf _buf) { return new test.TestIndex(_buf); } public int Id { get; private set; } public System.Collections.Generic.List<test.DemoType1> Eles { get; private set; } public const int __ID__ = 1941154020; public override int GetTypeId() => __ID__; public void Resolve(Dictionary<string, object> _tables) { foreach(var _e in Eles) { _e?.Resolve(_tables); } } public void TranslateText(System.Func<string, string, string> translator) { foreach(var _e in Eles) { _e?.TranslateText(translator); } } public override string ToString() { return "{ " + "Id:" + Id + "," + "Eles:" + Bright.Common.StringUtil.CollectionToString(Eles) + "," + "}"; } } } <|start_filename|>Projects/DataTemplates/template_lua2/error_tbcodeinfo.lua<|end_filename|> -- error.TbCodeInfo return { [6] = { code=6, key="EXAMPLE_FLASH", }, [7] = { code=7, key="EXAMPLE_MSGBOX", }, [8] = { code=8, key="EXAMPLE_DLG_OK", }, [9] = { code=9, key="EXAMPLE_DLG_OK_CANCEL", }, [100] = { code=100, key="ROLE_CREATE_NAME_INVALID_CHAR", }, [101] = { code=101, key="ROLE_CREATE_NAME_EMPTY", }, [102] = { code=102, key="ROLE_CREATE_NAME_EXCEED_MAX_LENGTH", }, [103] = { code=103, key="ROLE_CREATE_ROLE_LIST_FULL", }, [104] = { code=104, key="ROLE_CREATE_INVALID_PROFESSION", }, [200] = { code=200, key="PARAM_ILLEGAL", }, [202] = { code=202, key="ITEM_CAN_NOT_USE", }, [204] = { code=204, key="BAG_IS_FULL", }, [205] = { code=205, key="ITEM_NOT_ENOUGH", }, [206] = { code=206, key="ITEM_IN_BAG", }, [300] = { code=300, key="GENDER_NOT_MATCH", }, [301] = { code=301, key="LEVEL_TOO_LOW", }, [302] = { code=302, key="LEVEL_TOO_HIGH", }, [303] = { code=303, key="EXCEED_LIMIT", }, [304] = { code=304, key="OVER_TIME", }, [400] = { code=400, key="SKILL_NOT_IN_LIST", }, [401] = { code=401, key="SKILL_NOT_COOLDOWN", }, [402] = { code=402, key="SKILL_TARGET_NOT_EXIST", }, [403] = { code=403, key="SKILL_ANOTHER_CASTING", }, [700] = { code=700, key="MAIL_TYPE_ERROR", }, [702] = { code=702, key="MAIL_HAVE_DELETED", }, [703] = { code=703, key="MAIL_AWARD_HAVE_RECEIVED", }, [704] = { code=704, key="MAIL_OPERATE_TYPE_ERROR", }, [705] = { code=705, key="MAIL_CONDITION_NOT_MEET", }, [707] = { code=707, key="MAIL_NO_AWARD", }, [708] = { code=708, key="MAIL_BOX_IS_FULL", }, [605] = { code=605, key="NO_INTERACTION_COMPONENT", }, [2] = { code=2, key="HAS_BIND_SERVER", }, [3] = { code=3, key="AUTH_FAIL", }, [4] = { code=4, key="NOT_BIND_SERVER", }, [5] = { code=5, key="SERVER_ACCESS_FAIL", }, [1] = { code=1, key="SERVER_NOT_EXISTS", }, [900] = { code=900, key="SUIT_NOT_UNLOCK", }, [901] = { code=901, key="SUIT_COMPONENT_NOT_UNLOCK", }, [902] = { code=902, key="SUIT_STATE_ERROR", }, [903] = { code=903, key="SUIT_COMPONENT_STATE_ERROR", }, [904] = { code=904, key="SUIT_COMPONENT_NO_NEED_LEARN", }, } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_BoneWeight1_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_BoneWeight1_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.BoneWeight1 constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Equals(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.BoneWeight1)Puerts.Utils.GetSelf((int)data, self); if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.Any, typeof(System.Object), false, false)) { var Arg0 = argHelper0.Get<System.Object>(false); var result = obj.Equals(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.BoneWeight1), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.BoneWeight1>(false); var result = obj.Equals(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to Equals"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetHashCode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.BoneWeight1)Puerts.Utils.GetSelf((int)data, self); { { var result = obj.GetHashCode(); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_weight(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.BoneWeight1)Puerts.Utils.GetSelf((int)data, self); var result = obj.weight; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_weight(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.BoneWeight1)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.weight = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_boneIndex(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.BoneWeight1)Puerts.Utils.GetSelf((int)data, self); var result = obj.boneIndex; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_boneIndex(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.BoneWeight1)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.boneIndex = argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void O_op_Equality(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var arg0 = argHelper0.Get<UnityEngine.BoneWeight1>(false); var arg1 = argHelper1.Get<UnityEngine.BoneWeight1>(false); var result = arg0 == arg1; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void O_op_Inequality(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var arg0 = argHelper0.Get<UnityEngine.BoneWeight1>(false); var arg1 = argHelper1.Get<UnityEngine.BoneWeight1>(false); var result = arg0 != arg1; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "Equals", IsStatic = false}, M_Equals }, { new Puerts.MethodKey {Name = "GetHashCode", IsStatic = false}, M_GetHashCode }, { new Puerts.MethodKey {Name = "op_Equality", IsStatic = true}, O_op_Equality}, { new Puerts.MethodKey {Name = "op_Inequality", IsStatic = true}, O_op_Inequality}, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"weight", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_weight, Setter = S_weight} }, {"boneIndex", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_boneIndex, Setter = S_boneIndex} }, } }; } } } <|start_filename|>Projects/DataTemplates/template_lua2/tag_tbtesttag.lua<|end_filename|> -- tag.TbTestTag return { [2001] = { id=2001, value="导出", }, [2004] = { id=2004, value="any", }, [2003] = { id=2003, value="test", }, [100] = { id=100, value="导出", }, [1] = { id=1, value="导出", }, [2] = { id=2, value="导出", }, [6] = { id=6, value="导出", }, [7] = { id=7, value="导出", }, [9] = { id=9, value="测试", }, [10] = { id=10, value="测试", }, [11] = { id=11, value="any", }, [12] = { id=12, value="导出", }, [13] = { id=13, value="导出", }, [104] = { id=104, value="any", }, [102] = { id=102, value="test", }, [3001] = { id=3001, value="export", }, [3004] = { id=3004, value="any", }, [3003] = { id=3003, value="test", }, } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_Time_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_Time_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.Time(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.Time), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_time(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Time.time; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_timeAsDouble(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Time.timeAsDouble; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_timeSinceLevelLoad(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Time.timeSinceLevelLoad; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_timeSinceLevelLoadAsDouble(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Time.timeSinceLevelLoadAsDouble; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_deltaTime(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Time.deltaTime; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_fixedTime(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Time.fixedTime; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_fixedTimeAsDouble(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Time.fixedTimeAsDouble; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_unscaledTime(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Time.unscaledTime; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_unscaledTimeAsDouble(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Time.unscaledTimeAsDouble; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_fixedUnscaledTime(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Time.fixedUnscaledTime; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_fixedUnscaledTimeAsDouble(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Time.fixedUnscaledTimeAsDouble; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_unscaledDeltaTime(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Time.unscaledDeltaTime; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_fixedUnscaledDeltaTime(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Time.fixedUnscaledDeltaTime; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_fixedDeltaTime(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Time.fixedDeltaTime; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_fixedDeltaTime(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.Time.fixedDeltaTime = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_maximumDeltaTime(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Time.maximumDeltaTime; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_maximumDeltaTime(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.Time.maximumDeltaTime = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_smoothDeltaTime(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Time.smoothDeltaTime; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_maximumParticleDeltaTime(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Time.maximumParticleDeltaTime; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_maximumParticleDeltaTime(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.Time.maximumParticleDeltaTime = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_timeScale(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Time.timeScale; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_timeScale(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.Time.timeScale = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_frameCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Time.frameCount; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_renderedFrameCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Time.renderedFrameCount; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_realtimeSinceStartup(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Time.realtimeSinceStartup; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_realtimeSinceStartupAsDouble(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Time.realtimeSinceStartupAsDouble; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_captureDeltaTime(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Time.captureDeltaTime; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_captureDeltaTime(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.Time.captureDeltaTime = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_captureFramerate(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Time.captureFramerate; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_captureFramerate(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.Time.captureFramerate = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_inFixedTimeStep(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Time.inFixedTimeStep; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"time", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_time, Setter = null} }, {"timeAsDouble", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_timeAsDouble, Setter = null} }, {"timeSinceLevelLoad", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_timeSinceLevelLoad, Setter = null} }, {"timeSinceLevelLoadAsDouble", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_timeSinceLevelLoadAsDouble, Setter = null} }, {"deltaTime", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_deltaTime, Setter = null} }, {"fixedTime", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_fixedTime, Setter = null} }, {"fixedTimeAsDouble", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_fixedTimeAsDouble, Setter = null} }, {"unscaledTime", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_unscaledTime, Setter = null} }, {"unscaledTimeAsDouble", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_unscaledTimeAsDouble, Setter = null} }, {"fixedUnscaledTime", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_fixedUnscaledTime, Setter = null} }, {"fixedUnscaledTimeAsDouble", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_fixedUnscaledTimeAsDouble, Setter = null} }, {"unscaledDeltaTime", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_unscaledDeltaTime, Setter = null} }, {"fixedUnscaledDeltaTime", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_fixedUnscaledDeltaTime, Setter = null} }, {"fixedDeltaTime", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_fixedDeltaTime, Setter = S_fixedDeltaTime} }, {"maximumDeltaTime", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_maximumDeltaTime, Setter = S_maximumDeltaTime} }, {"smoothDeltaTime", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_smoothDeltaTime, Setter = null} }, {"maximumParticleDeltaTime", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_maximumParticleDeltaTime, Setter = S_maximumParticleDeltaTime} }, {"timeScale", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_timeScale, Setter = S_timeScale} }, {"frameCount", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_frameCount, Setter = null} }, {"renderedFrameCount", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_renderedFrameCount, Setter = null} }, {"realtimeSinceStartup", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_realtimeSinceStartup, Setter = null} }, {"realtimeSinceStartupAsDouble", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_realtimeSinceStartupAsDouble, Setter = null} }, {"captureDeltaTime", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_captureDeltaTime, Setter = S_captureDeltaTime} }, {"captureFramerate", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_captureFramerate, Setter = S_captureFramerate} }, {"inFixedTimeStep", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_inFixedTimeStep, Setter = null} }, } }; } } } <|start_filename|>Projects/DataTemplates/template_lua/test_tbtestdesc.lua<|end_filename|> return { [1] = {id=1,name="xxx",a1=0,a2=0,x1={y2={z2=2,z3=3,},y3=4,},x2={{z2=1,z3=2,},{z2=3,z3=4,},},x3={{z2=1,z3=2,},{z2=3,z3=4,},},}, } <|start_filename|>Projects/Go_json/gen/src/cfg/error.ErrorStyle.go<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg import "errors" type ErrorErrorStyle struct { } const TypeId_ErrorErrorStyle = 129528911 func (*ErrorErrorStyle) GetTypeId() int32 { return 129528911 } func (_v *ErrorErrorStyle)Deserialize(_buf map[string]interface{}) (err error) { return } func DeserializeErrorErrorStyle(_buf map[string]interface{}) (interface{}, error) { var id string var _ok_ bool if id, _ok_ = _buf["__type__"].(string) ; !_ok_ { return nil, errors.New("type id missing") } switch id { case "ErrorStyleTip": _v := &ErrorErrorStyleTip{}; if err := _v.Deserialize(_buf); err != nil { return nil, errors.New("error.ErrorStyleTip") } else { return _v, nil } case "ErrorStyleMsgbox": _v := &ErrorErrorStyleMsgbox{}; if err := _v.Deserialize(_buf); err != nil { return nil, errors.New("error.ErrorStyleMsgbox") } else { return _v, nil } case "ErrorStyleDlgOk": _v := &ErrorErrorStyleDlgOk{}; if err := _v.Deserialize(_buf); err != nil { return nil, errors.New("error.ErrorStyleDlgOk") } else { return _v, nil } case "ErrorStyleDlgOkCancel": _v := &ErrorErrorStyleDlgOkCancel{}; if err := _v.Deserialize(_buf); err != nil { return nil, errors.New("error.ErrorStyleDlgOkCancel") } else { return _v, nil } default: return nil, errors.New("unknown type id") } } <|start_filename|>Projects/DataTemplates/template_json/ai_tbbehaviortree.json<|end_filename|> { "10002": {"id":10002,"name":"random move","desc":"demo behaviour tree haha","blackboard_id":"demo","root":{ "_name":"Sequence","id":1,"node_name":"test","decorators":[{ "_name":"UeLoop","id":3,"node_name":"","flow_abort_mode":2,"num_loops":0,"infinite_loop":true,"infinite_loop_timeout_time":-1}],"services":[],"children":[{ "_name":"UeWait","id":30,"node_name":"","decorators":[],"services":[],"ignore_restart_self":false,"wait_time":1,"random_deviation":0.5},{ "_name":"MoveToRandomLocation","id":75,"node_name":"","decorators":[],"services":[],"ignore_restart_self":false,"origin_position_key":"x5","radius":30}]}} } <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/test/DemoEnum.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ namespace cfg.test { public enum DemoEnum { /// <summary> /// aa /// </summary> A = 1, /// <summary> /// bb /// </summary> B = 2, /// <summary> /// cc /// </summary> C = 4, /// <summary> /// dd /// </summary> D = 5, } } <|start_filename|>Projects/java_json/src/gen/cfg/item/ItemExtra.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.item; import com.google.gson.JsonElement; import com.google.gson.JsonObject; public abstract class ItemExtra { public ItemExtra(JsonObject __json__) { id = __json__.get("id").getAsInt(); } public ItemExtra(int id ) { this.id = id; } public static ItemExtra deserializeItemExtra(JsonObject __json__) { switch (__json__.get("__type__").getAsString()) { case "TreasureBox": return new cfg.item.TreasureBox(__json__); case "InteractionItem": return new cfg.item.InteractionItem(__json__); case "Clothes": return new cfg.item.Clothes(__json__); case "DesignDrawing": return new cfg.item.DesignDrawing(__json__); case "Dymmy": return new cfg.item.Dymmy(__json__); default: throw new bright.serialization.SerializationException(); } } public final int id; public abstract int getTypeId(); public void resolve(java.util.HashMap<String, Object> _tables) { } @Override public String toString() { return "{ " + "id:" + id + "," + "}"; } } <|start_filename|>Projects/Java_bin/src/main/gen/cfg/ai/UeCooldown.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.ai; import bright.serialization.*; public final class UeCooldown extends cfg.ai.Decorator { public UeCooldown(ByteBuf _buf) { super(_buf); cooldownTime = _buf.readFloat(); } public UeCooldown(int id, String node_name, cfg.ai.EFlowAbortMode flow_abort_mode, float cooldown_time ) { super(id, node_name, flow_abort_mode); this.cooldownTime = cooldown_time; } public final float cooldownTime; public static final int __ID__ = -951439423; @Override public int getTypeId() { return __ID__; } @Override public void resolve(java.util.HashMap<String, Object> _tables) { super.resolve(_tables); } @Override public String toString() { return "{ " + "id:" + id + "," + "nodeName:" + nodeName + "," + "flowAbortMode:" + flowAbortMode + "," + "cooldownTime:" + cooldownTime + "," + "}"; } } <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/ai/BlackboardKey.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.ai { public sealed partial class BlackboardKey : Bright.Config.BeanBase { public BlackboardKey(ByteBuf _buf) { Name = _buf.ReadString(); Desc = _buf.ReadString(); IsStatic = _buf.ReadBool(); Type = (ai.EKeyType)_buf.ReadInt(); TypeClassName = _buf.ReadString(); } public BlackboardKey(string name, string desc, bool is_static, ai.EKeyType type, string type_class_name ) { this.Name = name; this.Desc = desc; this.IsStatic = is_static; this.Type = type; this.TypeClassName = type_class_name; } public static BlackboardKey DeserializeBlackboardKey(ByteBuf _buf) { return new ai.BlackboardKey(_buf); } public readonly string Name; public readonly string Desc; public readonly bool IsStatic; public readonly ai.EKeyType Type; public readonly string TypeClassName; public const int ID = -511559886; public override int GetTypeId() => ID; public void Resolve(Dictionary<string, object> _tables) { OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); public override string ToString() { return "{ " + "Name:" + Name + "," + "Desc:" + Desc + "," + "IsStatic:" + IsStatic + "," + "Type:" + Type + "," + "TypeClassName:" + TypeClassName + "," + "}"; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_CompositeCollider2D_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_CompositeCollider2D_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.CompositeCollider2D(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.CompositeCollider2D), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GenerateGeometry(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CompositeCollider2D; { { obj.GenerateGeometry(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetPathPointCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CompositeCollider2D; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); var result = obj.GetPathPointCount(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetPath(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CompositeCollider2D; if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2[]), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2[]>(false); var result = obj.GetPath(Arg0,Arg1); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Vector2>), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<System.Collections.Generic.List<UnityEngine.Vector2>>(false); var result = obj.GetPath(Arg0,Arg1); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetPath"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_geometryType(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CompositeCollider2D; var result = obj.geometryType; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_geometryType(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CompositeCollider2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.geometryType = (UnityEngine.CompositeCollider2D.GeometryType)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_generationType(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CompositeCollider2D; var result = obj.generationType; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_generationType(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CompositeCollider2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.generationType = (UnityEngine.CompositeCollider2D.GenerationType)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_vertexDistance(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CompositeCollider2D; var result = obj.vertexDistance; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_vertexDistance(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CompositeCollider2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.vertexDistance = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_edgeRadius(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CompositeCollider2D; var result = obj.edgeRadius; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_edgeRadius(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CompositeCollider2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.edgeRadius = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_offsetDistance(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CompositeCollider2D; var result = obj.offsetDistance; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_offsetDistance(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CompositeCollider2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.offsetDistance = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_pathCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CompositeCollider2D; var result = obj.pathCount; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_pointCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CompositeCollider2D; var result = obj.pointCount; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "GenerateGeometry", IsStatic = false}, M_GenerateGeometry }, { new Puerts.MethodKey {Name = "GetPathPointCount", IsStatic = false}, M_GetPathPointCount }, { new Puerts.MethodKey {Name = "GetPath", IsStatic = false}, M_GetPath }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"geometryType", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_geometryType, Setter = S_geometryType} }, {"generationType", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_generationType, Setter = S_generationType} }, {"vertexDistance", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_vertexDistance, Setter = S_vertexDistance} }, {"edgeRadius", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_edgeRadius, Setter = S_edgeRadius} }, {"offsetDistance", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_offsetDistance, Setter = S_offsetDistance} }, {"pathCount", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_pathCount, Setter = null} }, {"pointCount", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_pointCount, Setter = null} }, } }; } } } <|start_filename|>Projects/DataTemplates/template_erlang/test_tbtestglobal.erl<|end_filename|> %% test.TbTestGlobal get() -> #{unlock_equip => 10,unlock_hero => 20}. <|start_filename|>Projects/DataTemplates/template_erlang/test_tbdetectcsvencoding.erl<|end_filename|> %% test.TbDetectCsvEncoding get(21) -> #{id => 21,name => "测试编码"}. get(22) -> #{id => 22,name => "还果园国要"}. get(23) -> #{id => 23,name => "工枯加盟仍"}. get(11) -> #{id => 11,name => "测试编码"}. get(12) -> #{id => 12,name => "还果园国要"}. get(13) -> #{id => 13,name => "工枯加盟仍"}. get(31) -> #{id => 31,name => "测试编码"}. get(32) -> #{id => 32,name => "还果园国要"}. get(33) -> #{id => 33,name => "工枯加盟仍"}. get(1) -> #{id => 1,name => "测试编码"}. get(2) -> #{id => 2,name => "还果园国要"}. get(3) -> #{id => 3,name => "工枯加盟仍"}. <|start_filename|>ProtoProjects/go/gen/src/proto/test.TestRpcRes.go<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package proto import ( "bright/serialization" ) import "errors" type TestTestRpcRes struct { X int32 Y int32 } const TypeId_TestTestRpcRes = 0 func (*TestTestRpcRes) GetTypeId() int32 { return 0 } func (_v *TestTestRpcRes)Serialize(_buf *serialization.ByteBuf) { _buf.WriteInt(_v.X) _buf.WriteInt(_v.Y) } func (_v *TestTestRpcRes)Deserialize(_buf *serialization.ByteBuf) (err error) { { if _v.X, err = _buf.ReadInt(); err != nil { err = errors.New("_v.X error"); return } } { if _v.Y, err = _buf.ReadInt(); err != nil { err = errors.New("_v.Y error"); return } } return } func SerializeTestTestRpcRes(_v serialization.ISerializable, _buf *serialization.ByteBuf) { _v.Serialize(_buf) } func DeserializeTestTestRpcRes(_buf *serialization.ByteBuf) (*TestTestRpcRes, error) { v := &TestTestRpcRes{} if err := v.Deserialize(_buf); err == nil { return v, nil } else { return nil, err } } <|start_filename|>Projects/Lua_Unity_xlua_lua/Assets/Lua/Gen/TbCodeInfo.lua<|end_filename|> return { [6] = {code=6,key='EXAMPLE_FLASH',}, [7] = {code=7,key='EXAMPLE_MSGBOX',}, [8] = {code=8,key='EXAMPLE_DLG_OK',}, [9] = {code=9,key='EXAMPLE_DLG_OK_CANCEL',}, [100] = {code=100,key='ROLE_CREATE_NAME_INVALID_CHAR',}, [101] = {code=101,key='ROLE_CREATE_NAME_EMPTY',}, [102] = {code=102,key='ROLE_CREATE_NAME_EXCEED_MAX_LENGTH',}, [103] = {code=103,key='ROLE_CREATE_ROLE_LIST_FULL',}, [104] = {code=104,key='ROLE_CREATE_INVALID_PROFESSION',}, [200] = {code=200,key='PARAM_ILLEGAL',}, [202] = {code=202,key='ITEM_CAN_NOT_USE',}, [204] = {code=204,key='BAG_IS_FULL',}, [205] = {code=205,key='ITEM_NOT_ENOUGH',}, [206] = {code=206,key='ITEM_IN_BAG',}, [300] = {code=300,key='GENDER_NOT_MATCH',}, [301] = {code=301,key='LEVEL_TOO_LOW',}, [302] = {code=302,key='LEVEL_TOO_HIGH',}, [303] = {code=303,key='EXCEED_LIMIT',}, [304] = {code=304,key='OVER_TIME',}, [400] = {code=400,key='SKILL_NOT_IN_LIST',}, [401] = {code=401,key='SKILL_NOT_COOLDOWN',}, [402] = {code=402,key='SKILL_TARGET_NOT_EXIST',}, [403] = {code=403,key='SKILL_ANOTHER_CASTING',}, [700] = {code=700,key='MAIL_TYPE_ERROR',}, [702] = {code=702,key='MAIL_HAVE_DELETED',}, [703] = {code=703,key='MAIL_AWARD_HAVE_RECEIVED',}, [704] = {code=704,key='MAIL_OPERATE_TYPE_ERROR',}, [705] = {code=705,key='MAIL_CONDITION_NOT_MEET',}, [707] = {code=707,key='MAIL_NO_AWARD',}, [708] = {code=708,key='MAIL_BOX_IS_FULL',}, [605] = {code=605,key='NO_INTERACTION_COMPONENT',}, [2] = {code=2,key='HAS_BIND_SERVER',}, [3] = {code=3,key='AUTH_FAIL',}, [4] = {code=4,key='NOT_BIND_SERVER',}, [5] = {code=5,key='SERVER_ACCESS_FAIL',}, [1] = {code=1,key='SERVER_NOT_EXISTS',}, [900] = {code=900,key='SUIT_NOT_UNLOCK',}, [901] = {code=901,key='SUIT_COMPONENT_NOT_UNLOCK',}, [902] = {code=902,key='SUIT_STATE_ERROR',}, [903] = {code=903,key='SUIT_COMPONENT_STATE_ERROR',}, [904] = {code=904,key='SUIT_COMPONENT_NO_NEED_LEARN',}, } <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/limit/MultiDayLimit.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.limit { public sealed partial class MultiDayLimit : limit.LimitBase { public MultiDayLimit(ByteBuf _buf) : base(_buf) { Day = _buf.ReadInt(); Num = _buf.ReadInt(); } public MultiDayLimit(int day, int num ) : base() { this.Day = day; this.Num = num; } public static MultiDayLimit DeserializeMultiDayLimit(ByteBuf _buf) { return new limit.MultiDayLimit(_buf); } public readonly int Day; public readonly int Num; public const int ID = -1753629499; public override int GetTypeId() => ID; public override void Resolve(Dictionary<string, object> _tables) { base.Resolve(_tables); OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); public override string ToString() { return "{ " + "Day:" + Day + "," + "Num:" + Num + "," + "}"; } } } <|start_filename|>ProtoProjects/go/gen/src/proto/test.AllType.go<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package proto import ( "bright/serialization" ) import "errors" type TestAllType struct { X1 bool X2 byte X3 int16 X4 int16 X5 int32 X6 int32 X7 int64 X8 int64 A1 string A2 []byte A3 *TestSimple A4 interface{} B1 []int32 B2 []*TestSimple B3 []interface{} C1 []int32 C2 []*TestSimple C3 []interface{} D1 []int32 E1 map[int32]int32 E2 map[int32]*TestSimple E3 map[int32]interface{} F1 *int32 F2 *string F3 *TestSimple F4 interface{} } const TypeId_TestAllType = 0 func (*TestAllType) GetTypeId() int32 { return 0 } func (_v *TestAllType)Serialize(_buf *serialization.ByteBuf) { _buf.WriteBool(_v.X1) _buf.WriteByte(_v.X2) _buf.WriteShort(_v.X3) _buf.WriteFshort(_v.X4) _buf.WriteInt(_v.X5) _buf.WriteFint(_v.X6) _buf.WriteLong(_v.X7) _buf.WriteFlong(_v.X8) _buf.WriteString(_v.A1) _buf.WriteBytes(_v.A2) SerializeTestSimple(_v.A3, _buf) SerializeTestDyn(_v.A4, _buf) { _buf.WriteSize(len(_v.B1)); for _, _e_ := range(_v.B1) { _buf.WriteInt(_e_) } } { _buf.WriteSize(len(_v.B2)); for _, _e_ := range(_v.B2) { SerializeTestSimple(_e_, _buf) } } { _buf.WriteSize(len(_v.B3)); for _, _e_ := range(_v.B3) { SerializeTestDyn(_e_, _buf) } } { _buf.WriteSize(len(_v.C1)); for _, _e_ := range(_v.C1) { _buf.WriteInt(_e_) } } { _buf.WriteSize(len(_v.C2)); for _, _e_ := range(_v.C2) { SerializeTestSimple(_e_, _buf) } } { _buf.WriteSize(len(_v.C3)); for _, _e_ := range(_v.C3) { SerializeTestDyn(_e_, _buf) } } { _buf.WriteSize(len(_v.D1)); for _, _e_ := range(_v.D1) { _buf.WriteInt(_e_) } } {_buf.WriteSize(len(_v.E1)); for _k_, _v_ := range(_v.E1) { _buf.WriteInt(_k_); _buf.WriteInt(_v_) } } {_buf.WriteSize(len(_v.E2)); for _k_, _v_ := range(_v.E2) { _buf.WriteInt(_k_); SerializeTestSimple(_v_, _buf) } } {_buf.WriteSize(len(_v.E3)); for _k_, _v_ := range(_v.E3) { _buf.WriteInt(_k_); SerializeTestDyn(_v_, _buf) } } if _buf != nil { _buf.WriteBool(true); _buf.WriteInt(*_v.F1) } else { _buf.WriteBool(false) } if _buf != nil { _buf.WriteBool(true); _buf.WriteString(*_v.F2) } else { _buf.WriteBool(false) } if _buf != nil { _buf.WriteBool(true); SerializeTestSimple(_v.F3, _buf) } else { _buf.WriteBool(false) } if _buf != nil { _buf.WriteBool(true); SerializeTestDyn(_v.F4, _buf) } else { _buf.WriteBool(false) } } func (_v *TestAllType)Deserialize(_buf *serialization.ByteBuf) (err error) { { if _v.X1, err = _buf.ReadBool(); err != nil { err = errors.New("_v.X1 error"); err = errors.New("_v.X1 error"); return } } { if _v.X2, err = _buf.ReadByte(); err != nil { err = errors.New("_v.X2 error"); return } } { if _v.X3, err = _buf.ReadShort(); err != nil { err = errors.New("_v.X3 error"); return } } { if _v.X4, err = _buf.ReadFshort(); err != nil { err = errors.New("_v.X4 error"); return } } { if _v.X5, err = _buf.ReadInt(); err != nil { err = errors.New("_v.X5 error"); return } } { if _v.X6, err = _buf.ReadFint(); err != nil { err = errors.New("_v.X6 error"); return } } { if _v.X7, err = _buf.ReadLong(); err != nil { err = errors.New("_v.X7 error"); return } } { if _v.X8, err = _buf.ReadFlong(); err != nil { err = errors.New("_v.X8 error"); return } } { if _v.A1, err = _buf.ReadString(); err != nil { err = errors.New("_v.A1 error"); return } } { if _v.A2, err = _buf.ReadBytes(); err != nil { err = errors.New("_v.A2 error"); return } } { if _v.A3, err = DeserializeTestSimple(_buf); err != nil { err = errors.New("_v.A3 error"); return } } { if _v.A4, err = DeserializeTestDyn(_buf); err != nil { err = errors.New("_v.A4 error"); return } } {_v.B1 = make([]int32, 0); var _n_ int; if _n_, err = _buf.ReadSize(); err != nil { err = errors.New("_v.B1 error"); return}; for i := 0 ; i < _n_ ; i++ { var _e_ int32; { if _e_, err = _buf.ReadInt(); err != nil { err = errors.New("_e_ error"); return } }; _v.B1 = append(_v.B1, _e_) } } {_v.B2 = make([]*TestSimple, 0); var _n_ int; if _n_, err = _buf.ReadSize(); err != nil { err = errors.New("_v.B2 error"); return}; for i := 0 ; i < _n_ ; i++ { var _e_ *TestSimple; { if _e_, err = DeserializeTestSimple(_buf); err != nil { err = errors.New("_e_ error"); return } }; _v.B2 = append(_v.B2, _e_) } } {_v.B3 = make([]interface{}, 0); var _n_ int; if _n_, err = _buf.ReadSize(); err != nil { err = errors.New("_v.B3 error"); return}; for i := 0 ; i < _n_ ; i++ { var _e_ interface{}; { if _e_, err = DeserializeTestDyn(_buf); err != nil { err = errors.New("_e_ error"); return } }; _v.B3 = append(_v.B3, _e_) } } {_v.C1 = make([]int32, 0); var _n_ int; if _n_, err = _buf.ReadSize(); err != nil { err = errors.New("_v.C1 error"); return}; for i := 0 ; i < _n_ ; i++ { var _e_ int32; { if _e_, err = _buf.ReadInt(); err != nil { err = errors.New("_e_ error"); return } }; _v.C1 = append(_v.C1, _e_) } } {_v.C2 = make([]*TestSimple, 0); var _n_ int; if _n_, err = _buf.ReadSize(); err != nil { err = errors.New("_v.C2 error"); return}; for i := 0 ; i < _n_ ; i++ { var _e_ *TestSimple; { if _e_, err = DeserializeTestSimple(_buf); err != nil { err = errors.New("_e_ error"); return } }; _v.C2 = append(_v.C2, _e_) } } {_v.C3 = make([]interface{}, 0); var _n_ int; if _n_, err = _buf.ReadSize(); err != nil { err = errors.New("_v.C3 error"); return}; for i := 0 ; i < _n_ ; i++ { var _e_ interface{}; { if _e_, err = DeserializeTestDyn(_buf); err != nil { err = errors.New("_e_ error"); return } }; _v.C3 = append(_v.C3, _e_) } } {_v.D1 = make([]int32, 0); var _n_ int; if _n_, err = _buf.ReadSize(); err != nil { err = errors.New("_v.D1 error"); return}; for i := 0 ; i < _n_ ; i++ { var _e_ int32; { if _e_, err = _buf.ReadInt(); err != nil { err = errors.New("_e_ error"); return } }; _v.D1 = append(_v.D1, _e_) } } { _v.E1 = make(map[int32]int32); var _n_ int; if _n_, err = _buf.ReadSize(); err != nil { err = errors.New("_v.E1 error"); return}; for i := 0 ; i < _n_ ; i++ { var _key_ int32; { if _key_, err = _buf.ReadInt(); err != nil { err = errors.New("_key_ error"); return } }; var _value_ int32; { if _value_, err = _buf.ReadInt(); err != nil { err = errors.New("_value_ error"); return } }; _v.E1[_key_] = _value_} } { _v.E2 = make(map[int32]*TestSimple); var _n_ int; if _n_, err = _buf.ReadSize(); err != nil { err = errors.New("_v.E2 error"); return}; for i := 0 ; i < _n_ ; i++ { var _key_ int32; { if _key_, err = _buf.ReadInt(); err != nil { err = errors.New("_key_ error"); return } }; var _value_ *TestSimple; { if _value_, err = DeserializeTestSimple(_buf); err != nil { err = errors.New("_value_ error"); return } }; _v.E2[_key_] = _value_} } { _v.E3 = make(map[int32]interface{}); var _n_ int; if _n_, err = _buf.ReadSize(); err != nil { err = errors.New("_v.E3 error"); return}; for i := 0 ; i < _n_ ; i++ { var _key_ int32; { if _key_, err = _buf.ReadInt(); err != nil { err = errors.New("_key_ error"); return } }; var _value_ interface{}; { if _value_, err = DeserializeTestDyn(_buf); err != nil { err = errors.New("_value_ error"); return } }; _v.E3[_key_] = _value_} } { var __exists__ bool; if __exists__, err = _buf.ReadBool(); err != nil { return }; if __exists__ { var __x__ int32; { if __x__, err = _buf.ReadInt(); err != nil { err = errors.New("__x__ error"); return } }; _v.F1 = &__x__ }} { var __exists__ bool; if __exists__, err = _buf.ReadBool(); err != nil { return }; if __exists__ { var __x__ string; { if __x__, err = _buf.ReadString(); err != nil { err = errors.New("__x__ error"); return } }; _v.F2 = &__x__ }} { var __exists__ bool; if __exists__, err = _buf.ReadBool(); err != nil { return }; if __exists__ { var __x__ *TestSimple; { if __x__, err = DeserializeTestSimple(_buf); err != nil { err = errors.New("__x__ error"); return } }; _v.F3 = __x__ }} { var __exists__ bool; if __exists__, err = _buf.ReadBool(); err != nil { return }; if __exists__ { var __x__ interface{}; { if __x__, err = DeserializeTestDyn(_buf); err != nil { err = errors.New("__x__ error"); return } }; _v.F4 = __x__ }} return } func SerializeTestAllType(_v serialization.ISerializable, _buf *serialization.ByteBuf) { _v.Serialize(_buf) } func DeserializeTestAllType(_buf *serialization.ByteBuf) (*TestAllType, error) { v := &TestAllType{} if err := v.Deserialize(_buf); err == nil { return v, nil } else { return nil, err } } <|start_filename|>Projects/GenerateDatas/convert_lua/error.TbCodeInfo/900.lua<|end_filename|> return { code = 900, key = "SUIT_NOT_UNLOCK", } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_UI_Slider_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_UI_Slider_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.UI.Slider constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetValueWithoutNotify(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Slider; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetFloat(false); obj.SetValueWithoutNotify(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Rebuild(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Slider; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = (UnityEngine.UI.CanvasUpdate)argHelper0.GetInt32(false); obj.Rebuild(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_LayoutComplete(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Slider; { { obj.LayoutComplete(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GraphicUpdateComplete(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Slider; { { obj.GraphicUpdateComplete(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_OnPointerDown(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Slider; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.EventSystems.PointerEventData>(false); obj.OnPointerDown(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_OnDrag(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Slider; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.EventSystems.PointerEventData>(false); obj.OnDrag(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_OnMove(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Slider; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.EventSystems.AxisEventData>(false); obj.OnMove(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_FindSelectableOnLeft(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Slider; { { var result = obj.FindSelectableOnLeft(); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_FindSelectableOnRight(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Slider; { { var result = obj.FindSelectableOnRight(); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_FindSelectableOnUp(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Slider; { { var result = obj.FindSelectableOnUp(); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_FindSelectableOnDown(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Slider; { { var result = obj.FindSelectableOnDown(); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_OnInitializePotentialDrag(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Slider; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.EventSystems.PointerEventData>(false); obj.OnInitializePotentialDrag(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetDirection(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Slider; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = (UnityEngine.UI.Slider.Direction)argHelper0.GetInt32(false); var Arg1 = argHelper1.GetBoolean(false); obj.SetDirection(Arg0,Arg1); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_fillRect(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Slider; var result = obj.fillRect; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_fillRect(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Slider; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.fillRect = argHelper.Get<UnityEngine.RectTransform>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_handleRect(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Slider; var result = obj.handleRect; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_handleRect(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Slider; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.handleRect = argHelper.Get<UnityEngine.RectTransform>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_direction(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Slider; var result = obj.direction; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_direction(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Slider; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.direction = (UnityEngine.UI.Slider.Direction)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_minValue(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Slider; var result = obj.minValue; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_minValue(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Slider; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.minValue = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_maxValue(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Slider; var result = obj.maxValue; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_maxValue(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Slider; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.maxValue = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_wholeNumbers(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Slider; var result = obj.wholeNumbers; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_wholeNumbers(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Slider; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.wholeNumbers = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_value(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Slider; var result = obj.value; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_value(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Slider; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.value = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_normalizedValue(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Slider; var result = obj.normalizedValue; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_normalizedValue(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Slider; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.normalizedValue = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_onValueChanged(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Slider; var result = obj.onValueChanged; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_onValueChanged(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Slider; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.onValueChanged = argHelper.Get<UnityEngine.UI.Slider.SliderEvent>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "SetValueWithoutNotify", IsStatic = false}, M_SetValueWithoutNotify }, { new Puerts.MethodKey {Name = "Rebuild", IsStatic = false}, M_Rebuild }, { new Puerts.MethodKey {Name = "LayoutComplete", IsStatic = false}, M_LayoutComplete }, { new Puerts.MethodKey {Name = "GraphicUpdateComplete", IsStatic = false}, M_GraphicUpdateComplete }, { new Puerts.MethodKey {Name = "OnPointerDown", IsStatic = false}, M_OnPointerDown }, { new Puerts.MethodKey {Name = "OnDrag", IsStatic = false}, M_OnDrag }, { new Puerts.MethodKey {Name = "OnMove", IsStatic = false}, M_OnMove }, { new Puerts.MethodKey {Name = "FindSelectableOnLeft", IsStatic = false}, M_FindSelectableOnLeft }, { new Puerts.MethodKey {Name = "FindSelectableOnRight", IsStatic = false}, M_FindSelectableOnRight }, { new Puerts.MethodKey {Name = "FindSelectableOnUp", IsStatic = false}, M_FindSelectableOnUp }, { new Puerts.MethodKey {Name = "FindSelectableOnDown", IsStatic = false}, M_FindSelectableOnDown }, { new Puerts.MethodKey {Name = "OnInitializePotentialDrag", IsStatic = false}, M_OnInitializePotentialDrag }, { new Puerts.MethodKey {Name = "SetDirection", IsStatic = false}, M_SetDirection }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"fillRect", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_fillRect, Setter = S_fillRect} }, {"handleRect", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_handleRect, Setter = S_handleRect} }, {"direction", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_direction, Setter = S_direction} }, {"minValue", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_minValue, Setter = S_minValue} }, {"maxValue", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_maxValue, Setter = S_maxValue} }, {"wholeNumbers", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_wholeNumbers, Setter = S_wholeNumbers} }, {"value", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_value, Setter = S_value} }, {"normalizedValue", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_normalizedValue, Setter = S_normalizedValue} }, {"onValueChanged", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_onValueChanged, Setter = S_onValueChanged} }, } }; } } } <|start_filename|>Projects/DataTemplates/template_lua2/item_tbitemfunc.lua<|end_filename|> -- item.TbItemFunc return { [401] = { minor_type=401, func_type=0, method="使用", close_bag_ui=true, }, [1102] = { minor_type=1102, func_type=1, method="使用", close_bag_ui=false, }, } <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/item/ECurrencyType.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ namespace cfg.item { public enum ECurrencyType { /// <summary> /// 钻石 /// </summary> DIAMOND = 1, /// <summary> /// 金币 /// </summary> GOLD = 2, /// <summary> /// 银币 /// </summary> SILVER = 3, /// <summary> /// 经验 /// </summary> EXP = 4, /// <summary> /// 能量点 /// </summary> POWER_POINT = 5, } } <|start_filename|>Projects/Cpp_bin/Gen/gen_types.h<|end_filename|>  //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ #pragma once #include <functional> #include "bright/serialization/ByteBuf.h" #include "bright/CfgBean.hpp" using ByteBuf = ::bright::serialization::ByteBuf; namespace cfg { namespace ai { enum class EExecutor { CLIENT = 0, SERVER = 1, }; } namespace ai { enum class EKeyType { BOOL = 1, INT = 2, FLOAT = 3, STRING = 4, VECTOR = 5, ROTATOR = 6, NAME = 7, CLASS = 8, ENUM = 9, OBJECT = 10, }; } namespace ai { enum class EFlowAbortMode { NONE = 0, LOWER_PRIORITY = 1, SELF = 2, BOTH = 3, }; } namespace ai { enum class EFinishMode { IMMEDIATE = 0, DELAYED = 1, }; } namespace ai { enum class ENotifyObserverMode { ON_VALUE_CHANGE = 0, ON_RESULT_CHANGE = 1, }; } namespace ai { enum class EOperator { IS_EQUAL_TO = 0, IS_NOT_EQUAL_TO = 1, IS_LESS_THAN = 2, IS_LESS_THAN_OR_EQUAL_TO = 3, IS_GREAT_THAN = 4, IS_GREAT_THAN_OR_EQUAL_TO = 5, CONTAINS = 6, NOT_CONTAINS = 7, }; } namespace common { enum class EBoolOperator { AND = 0, OR = 1, }; } namespace error { enum class EOperation { /** * 登出 */ LOGOUT = 0, /** * 重启 */ RESTART = 1, }; } namespace error { enum class EErrorCode { OK = 0, SERVER_NOT_EXISTS = 1, HAS_BIND_SERVER = 2, AUTH_FAIL = 3, NOT_BIND_SERVER = 4, SERVER_ACCESS_FAIL = 5, EXAMPLE_FLASH = 6, EXAMPLE_MSGBOX = 7, EXAMPLE_DLG_OK = 8, EXAMPLE_DLG_OK_CANCEL = 9, ROLE_CREATE_NAME_INVALID_CHAR = 100, ROLE_CREATE_NAME_EMPTY = 101, ROLE_CREATE_NAME_EXCEED_MAX_LENGTH = 102, ROLE_CREATE_ROLE_LIST_FULL = 103, ROLE_CREATE_INVALID_PROFESSION = 104, ROLE_CREATE_INVALID_GENDER = 105, ROLE_NOT_OWNED_BY_USER = 106, ROLE_LEVEL_NOT_ARRIVE = 107, PARAM_ILLEGAL = 200, TEMP_BAG_NOT_EMPTY = 201, ITEM_CAN_NOT_USE = 202, CURRENCY_NOT_ENOUGH = 203, BAG_IS_FULL = 204, ITEM_NOT_ENOUGH = 205, ITEM_IN_BAG = 206, GENDER_NOT_MATCH = 300, LEVEL_TOO_LOW = 301, LEVEL_TOO_HIGH = 302, EXCEED_LIMIT = 303, OVER_TIME = 304, SERVER_ERROR = 305, SKILL_NOT_IN_LIST = 400, SKILL_NOT_COOLDOWN = 401, SKILL_TARGET_NOT_EXIST = 402, SKILL_ANOTHER_CASTING = 403, SKILL_OUT_OF_DISTANCE = 404, SKILL_TARGET_CAMP_NOT_MATCH = 405, SKILL_INVALID_DIRECTION = 406, SKILL_NOT_IN_SELECT_SHAPE = 407, SKILL_ENERGY_NOT_ENOUGH = 408, DIALOG_NODE_NOT_CHOOSEN = 500, DIALOG_NOT_FINISH = 501, DIALOG_HAS_FINISH = 502, QUEST_STAGE_NOT_FINISHED = 503, QUEST_NOT_DOING = 504, QUEST_STAGE_NOT_DOING = 505, QUEST_HAS_ACCEPTED = 506, MAP_OBJECT_NOT_EXIST = 600, INTERACTION_OBJECT_NOT_SUPPORT_OPERATION = 601, HAS_NOT_EQUIP = 602, HANDHELD_EQUIP_ID_NOT_MATCH = 603, NOT_AVAILABLE_SUIT_ID = 604, NO_INTERACTION_COMPONENT = 605, HAS_INTERACTED = 606, VIALITY_NOT_ENOUGH = 607, PLAYER_SESSION_NOT_EXIST = 608, PLAYER_SESSION_WORLD_PLAYER_NOT_INIT = 609, MAP_NOT_EXIST = 610, MAIL_TYPE_ERROR = 700, MAIL_NOT_EXITST = 701, MAIL_HAVE_DELETED = 702, MAIL_AWARD_HAVE_RECEIVED = 703, MAIL_OPERATE_TYPE_ERROR = 704, MAIL_CONDITION_NOT_MEET = 705, MAIL_STATE_ERROR = 706, MAIL_NO_AWARD = 707, MAIL_BOX_IS_FULL = 708, PROP_SCORE_NOT_BIGGER_THAN = 800, NOT_WEAR_CLOTHES = 801, NOT_WEAR_SUIT = 802, SUIT_NOT_UNLOCK = 900, SUIT_COMPONENT_NOT_UNLOCK = 901, SUIT_STATE_ERROR = 902, SUIT_COMPONENT_STATE_ERROR = 903, SUIT_COMPONENT_NO_NEED_LEARN = 904, STORE_NOT_ENABLED = 1000, SHELF_NOT_ENABLED = 1001, GOODS_NOT_ENABLED = 1002, GOODS_NOT_IN_CUR_REFRESH = 1003, RETRY = 1100, NOT_COOLDOWN = 1101, SELFIE_UNLOCK = 1200, SELFIE_ALREADY_UNLOCK = 1201, SELFIE_LACK_STARTS = 1202, SELFIE_HAD_REWARD = 1203, }; } namespace item { /** * 道具品质 */ enum class EItemQuality { /** * 白 */ WHITE = 0, /** * 绿 */ GREEN = 1, /** * 蓝 */ BLUE = 2, /** * 紫 */ PURPLE = 3, /** * 金 */ GOLDEN = 4, }; } namespace item { enum class ECurrencyType { /** * 钻石 */ DIAMOND = 1, /** * 金币 */ GOLD = 2, /** * 银币 */ SILVER = 3, /** * 经验 */ EXP = 4, /** * 能量点 */ POWER_POINT = 5, }; } namespace item { enum class EMajorType { /** * 货币 */ CURRENCY = 1, /** * 服装 */ CLOTH = 2, /** * 任务 */ QUEST = 3, /** * 消耗品 */ CONSUMABLES = 4, /** * 宝箱 */ TREASURE_BOX = 5, /** * 成就和称谓 */ ACHIEVEMENT_AND_TITLE = 6, /** * 头像框 */ HEAD_FRAME = 7, /** * 语音 */ VOICE = 8, /** * 动作 */ ACTION = 9, /** * 扩容道具 */ EXPANSION = 10, /** * 制作材料 */ MATERIAL = 11, }; } namespace item { enum class EMinorType { /** * 钻石 */ DIAMOND = 101, /** * 金币 */ GOLD = 102, /** * 银币 */ SILVER = 103, /** * 经验 */ EXP = 104, /** * 能量点 */ POWER_POINT = 105, /** * 发型 */ HAIR_STYLE = 210, /** * 外套 */ COAT = 220, /** * 上衣 */ UPPER_JACKET = 230, /** * 裤子 */ TROUSERS = 241, /** * 裙子 */ SKIRT = 242, /** * 袜子 */ SOCKS = 250, /** * 鞋子 */ SHOES = 260, /** * 发饰 */ HAIR_ACCESSORY = 271, /** * 帽子 */ HAT = 272, /** * 耳饰 */ EARRING = 273, /** * 颈饰 */ NECKLACE = 274, /** * 腕饰 */ BRACELET = 275, /** * 发箍 */ HAIR_CLASP = 276, /** * 手套 */ GLOVE = 277, /** * 手持物 */ HANDHELD_OBJECT = 278, /** * 特殊 */ SPECIAL = 279, /** * 底妆 */ BASE_COSMETIC = 281, /** * 眉妆 */ EYEBROW_COSMETIC = 282, /** * 睫毛 */ EYELASH = 283, /** * 美瞳 */ COSMETIC_CONTACT_LENSES = 284, /** * 唇妆 */ LIP_COSMETIC = 285, /** * 肤色 */ SKIN_COLOR = 286, /** * 连衣裙 */ ONE_PIECE_DRESS = 290, /** * 换装场景 */ SWITCH_CLOTHES_SCENE = 291, /** * 任务道具 */ QUEST = 301, /** * 投掷物 */ CAST = 401, /** * 刀剑 */ SWORD = 421, /** * 弓箭 */ BOW_ARROW = 422, /** * 法杖 */ WANDS = 423, /** * 特殊工具 */ SPECIAL_TOOL = 424, /** * 食物 */ FOOD = 403, /** * 宝箱 */ TREASURE_BOX = 501, /** * 钥匙 */ KEY = 502, /** * 多选一宝箱 */ MULTI_CHOOSE_TREASURE_BOX = 503, /** * 成就相关 */ ACHIEVEMENT = 601, /** * 称谓相关 */ TITLE = 602, /** * 头像框 */ AVATAR_FRAME = 701, /** * 语音 */ VOICE = 801, /** * 特殊待机动作 */ IDLE_POSE = 901, /** * 拍照动作 */ PHOTO_POSE = 902, /** * 背包 */ BAG = 1001, /** * 好友数量 */ FRIEND_CAPACITY = 1002, /** * 制作材料 */ CONSTRUCTION_MATERIAL = 1101, /** * 设计图纸 */ DESIGN_DRAWING = 1102, }; } namespace item { enum class EClothersStarQualityType { /** * 一星 */ ONE = 1, /** * 二星 */ TWO = 2, /** * 三星 */ THREE = 3, /** * 四星 */ FOUR = 4, /** * 五星 */ FIVE = 5, /** * 六星 */ SIX = 6, /** * 七星 */ SEVEN = 7, /** * 八星 */ EIGHT = 8, /** * 九星 */ NINE = 9, /** * 十星 */ TEN = 10, }; } namespace item { enum class EClothersTag { /** * 防晒 */ FANG_SHAI = 1, /** * 舞者 */ WU_ZHE = 2, }; } namespace item { enum class EUseType { /** * 手动 */ MANUAL = 0, /** * 自动 */ AUTO = 1, }; } namespace item { enum class EClothesHidePartType { /** * 胸部 */ CHEST = 0, /** * 手 */ HEAD = 1, /** * 脊柱上 */ SPINE_UPPER = 2, /** * 脊柱下 */ SPINE_LOWER = 3, /** * 臀部 */ HIP = 4, /** * 腿上 */ LEG_UPPER = 5, /** * 腿中 */ LEG_MIDDLE = 6, /** * 腿下 */ LEG_LOWER = 7, }; } namespace item { enum class EClothesPropertyType { /** * 简约 */ JIAN_YUE = 1, /** * 华丽 */ HUA_LI = 2, /** * 可爱 */ KE_AI = 3, /** * 成熟 */ CHENG_SHU = 4, /** * 活泼 */ HUO_PO = 5, /** * 优雅 */ YOU_YA = 6, /** * 清纯 */ QING_CHUN = 7, /** * 性感 */ XING_GAN = 8, /** * 清凉 */ QING_LIANG = 9, /** * 保暖 */ BAO_NUAN = 10, }; } namespace item { enum class EItemFunctionType { /** * 更换手持物 */ REPLACE_HANDHELD = 0, /** * 使用设计图纸 */ USE_DESIGN_DRAWING = 1, }; } namespace limit { enum class ENamespace { ITEM_DAILY_OBTAIN = 1, TREASURE_DAILY_USE = 2, STORE_GOODS_LIMIT_BUY = 3, }; } namespace mail { enum class EMailType { /** * 全局邮件 */ GLOBAL = 0, /** * 系统邮件 */ SYSTEM = 1, }; } namespace role { enum class EGenderType { /** * 男 */ MALE = 1, /** * 女 */ FEMALE = 2, }; } namespace role { enum class EProfession { TEST_PROFESSION = 1, }; } namespace test { enum class DemoEnum { /** * aa */ A = 1, /** * bb */ B = 2, /** * cc */ C = 4, /** * dd */ D = 5, }; } namespace test { enum class DemoFlag { A = 1, B = 2, D = A|B, }; } namespace test { enum class ETestUeType { /** * 白 */ WHITE = 0, BLACK = 1, }; } namespace test { enum class ETestEmptyEnum { }; } namespace test { enum class ETestEmptyEnum2 { SMALL_THAN_256 = 255, X_256 = 256, X_257 = 257, }; } namespace test { enum class AudioType { UNKNOWN = 0, ACC = 1, AIFF = 2, }; } namespace test { enum class ETestQuality { /** * 最高品质 */ A = 1, /** * 黑色的 */ B = 2, /** * 蓝色的 */ C = 3, /** * 最差品质 */ D = 4, }; } namespace test { enum class AccessFlag { WRITE = 1, READ = 2, TRUNCATE = 4, NEW = 8, READ_WRITE = WRITE|READ, }; } namespace ai { class Blackboard; } namespace ai { class BlackboardKey; } namespace ai { class BehaviorTree; } namespace ai { class Node; } namespace ai { class Service; } namespace ai { class UeSetDefaultFocus; } namespace ai { class ExecuteTimeStatistic; } namespace ai { class ChooseTarget; } namespace ai { class KeepFaceTarget; } namespace ai { class GetOwnerPlayer; } namespace ai { class UpdateDailyBehaviorProps; } namespace ai { class Decorator; } namespace ai { class UeLoop; } namespace ai { class UeCooldown; } namespace ai { class UeTimeLimit; } namespace ai { class UeBlackboard; } namespace ai { class KeyQueryOperator; } namespace ai { class IsSet; } namespace ai { class IsNotSet; } namespace ai { class BinaryOperator; } namespace ai { class KeyData; } namespace ai { class FloatKeyData; } namespace ai { class IntKeyData; } namespace ai { class StringKeyData; } namespace ai { class BlackboardKeyData; } namespace ai { class UeForceSuccess; } namespace ai { class IsAtLocation; } namespace ai { class DistanceLessThan; } namespace ai { class FlowNode; } namespace ai { class ComposeNode; } namespace ai { class Sequence; } namespace ai { class Selector; } namespace ai { class SimpleParallel; } namespace ai { class Task; } namespace ai { class UeWait; } namespace ai { class UeWaitBlackboardTime; } namespace ai { class MoveToTarget; } namespace ai { class ChooseSkill; } namespace ai { class MoveToRandomLocation; } namespace ai { class MoveToLocation; } namespace ai { class DebugPrint; } namespace blueprint { class Clazz; } namespace blueprint { class Method; } namespace blueprint { class ParamInfo; } namespace blueprint { class AbstraceMethod; } namespace blueprint { class ExternalMethod; } namespace blueprint { class BlueprintMethod; } namespace blueprint { class Interface; } namespace blueprint { class NormalClazz; } namespace blueprint { class Field; } namespace blueprint { class EnumClazz; } namespace blueprint { class EnumField; } namespace bonus { class DropInfo; } namespace bonus { class ShowItemInfo; } namespace bonus { class Bonus; } namespace bonus { class OneItem; } namespace bonus { class OneItems; } namespace bonus { class Item; } namespace bonus { class Items; } namespace bonus { class CoefficientItem; } namespace bonus { class WeightItems; } namespace bonus { class WeightItemInfo; } namespace bonus { class ProbabilityItems; } namespace bonus { class ProbabilityItemInfo; } namespace bonus { class MultiBonus; } namespace bonus { class ProbabilityBonus; } namespace bonus { class ProbabilityBonusInfo; } namespace bonus { class WeightBonus; } namespace bonus { class WeightBonusInfo; } namespace bonus { class DropBonus; } namespace common { class GlobalConfig; } namespace error { class ErrorInfo; } namespace error { class ErrorStyle; } namespace error { class ErrorStyleTip; } namespace error { class ErrorStyleMsgbox; } namespace error { class ErrorStyleDlgOk; } namespace error { class ErrorStyleDlgOkCancel; } namespace error { class CodeInfo; } namespace item { class Item; } namespace item { class ItemFunction; } namespace item { class ItemExtra; } namespace item { class TreasureBox; } namespace condition { class Condition; } namespace condition { class TimeRange; } namespace common { class DateTimeRange; } namespace condition { class RoleCondition; } namespace condition { class MultiRoleCondition; } namespace condition { class BoolRoleCondition; } namespace condition { class GenderLimit; } namespace condition { class MinLevel; } namespace condition { class MaxLevel; } namespace condition { class MinMaxLevel; } namespace condition { class ClothesPropertyScoreGreaterThan; } namespace condition { class ContainsItem; } namespace item { class ChooseOneBonus; } namespace item { class InteractionItem; } namespace item { class Clothes; } namespace item { class DesignDrawing; } namespace item { class Dymmy; } namespace cost { class Cost; } namespace cost { class CostCurrency; } namespace cost { class CostCurrencies; } namespace cost { class CostOneItem; } namespace cost { class CostItem; } namespace cost { class CostItems; } namespace l10n { class L10NDemo; } namespace l10n { class PatchDemo; } namespace mail { class SystemMail; } namespace mail { class GlobalMail; } namespace role { class LevelExpAttr; } namespace role { class LevelBonus; } namespace role { class DistinctBonusInfos; } namespace role { class BonusInfo; } namespace tag { class TestTag; } namespace test { class DemoType2; } namespace test { class DemoType1; } namespace test { class DemoDynamic; } namespace test { class DemoD2; } namespace test { class DemoD3; } namespace test { class DemoE1; } namespace test { class DemoD5; } namespace test { class DateTimeRange; } namespace test { class DemoE2; } namespace test { class DemoSingletonType; } namespace test { class NotIndexList; } namespace test { class MultiUnionIndexList; } namespace test { class MultiIndexList; } namespace test { class MultiRowRecord; } namespace test { class MultiRowType1; } namespace test { class MultiRowType2; } namespace test { class MultiRowType3; } namespace test { class MultiRowTitle; } namespace test { class H1; } namespace test { class H2; } namespace test { class TestNull; } namespace test { class DemoPrimitiveTypesTable; } namespace test { class TestString; } namespace test { class CompactString; } namespace test { class DemoGroup; } namespace test { class InnerGroup; } namespace test { class TestGlobal; } namespace test { class TestBeRef; } namespace test { class TestRef; } namespace test { class TestSize; } namespace test { class TestSet; } namespace test { class DetectEncoding; } namespace test { class DefineFromExcel; } namespace test { class DefineFromExcelOne; } namespace test { class TestIndex; } namespace test { class TestMap; } namespace test { class ExcelFromJson; } namespace test { class CompositeJsonTable1; } namespace test { class CompositeJsonTable2; } namespace test { class CompositeJsonTable3; } namespace test { class ExcelFromJsonMultiRow; } namespace test { class TestRow; } namespace test { class Test3; } namespace test { class TestSep; } namespace test { class SepBean1; } namespace test { class SepVector; } namespace test { class TestExternalType; } namespace test { class Color; } namespace test { class DefineFromExcel2; } namespace test { class TestExcelBean1; } namespace test { class TestDesc; } namespace ai { class Blackboard : public bright::CfgBean { public: static bool deserializeBlackboard(ByteBuf& _buf, ::bright::SharedPtr<Blackboard>& _out); Blackboard() { } Blackboard(::bright::String name, ::bright::String desc, ::bright::String parent_name, ::bright::Vector<::bright::SharedPtr<ai::BlackboardKey>> keys ) { this->name = name; this->desc = desc; this->parentName = parent_name; this->keys = keys; } virtual ~Blackboard() {} bool deserialize(ByteBuf& _buf); ::bright::String name; ::bright::String desc; ::bright::String parentName; ::bright::SharedPtr<ai::Blackboard> parentName_Ref; ::bright::Vector<::bright::SharedPtr<ai::BlackboardKey>> keys; static constexpr int __ID__ = 1576193005; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace ai { class BlackboardKey : public bright::CfgBean { public: static bool deserializeBlackboardKey(ByteBuf& _buf, ::bright::SharedPtr<BlackboardKey>& _out); BlackboardKey() { } BlackboardKey(::bright::String name, ::bright::String desc, bool is_static, ai::EKeyType type, ::bright::String type_class_name ) { this->name = name; this->desc = desc; this->isStatic = is_static; this->type = type; this->typeClassName = type_class_name; } virtual ~BlackboardKey() {} bool deserialize(ByteBuf& _buf); ::bright::String name; ::bright::String desc; bool isStatic; ai::EKeyType type; ::bright::String typeClassName; static constexpr int __ID__ = -511559886; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace ai { class BehaviorTree : public bright::CfgBean { public: static bool deserializeBehaviorTree(ByteBuf& _buf, ::bright::SharedPtr<BehaviorTree>& _out); BehaviorTree() { } BehaviorTree(::bright::int32 id, ::bright::String name, ::bright::String desc, ::bright::String blackboard_id, ::bright::SharedPtr<ai::ComposeNode> root ) { this->id = id; this->name = name; this->desc = desc; this->blackboardId = blackboard_id; this->root = root; } virtual ~BehaviorTree() {} bool deserialize(ByteBuf& _buf); ::bright::int32 id; ::bright::String name; ::bright::String desc; ::bright::String blackboardId; ::bright::SharedPtr<ai::Blackboard> blackboardId_Ref; ::bright::SharedPtr<ai::ComposeNode> root; static constexpr int __ID__ = 159552822; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace ai { class Node : public bright::CfgBean { public: static bool deserializeNode(ByteBuf& _buf, ::bright::SharedPtr<Node>& _out); Node() { } Node(::bright::int32 id, ::bright::String node_name ) { this->id = id; this->nodeName = node_name; } virtual ~Node() {} bool deserialize(ByteBuf& _buf); ::bright::int32 id; ::bright::String nodeName; virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace ai { class Service : public ai::Node { public: static bool deserializeService(ByteBuf& _buf, ::bright::SharedPtr<Service>& _out); Service() { } Service(::bright::int32 id, ::bright::String node_name ) : ai::Node(id, node_name) { } virtual ~Service() {} bool deserialize(ByteBuf& _buf); virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace ai { class UeSetDefaultFocus : public ai::Service { public: static bool deserializeUeSetDefaultFocus(ByteBuf& _buf, ::bright::SharedPtr<UeSetDefaultFocus>& _out); UeSetDefaultFocus() { } UeSetDefaultFocus(::bright::int32 id, ::bright::String node_name, ::bright::String keyboard_key ) : ai::Service(id, node_name) { this->keyboardKey = keyboard_key; } virtual ~UeSetDefaultFocus() {} bool deserialize(ByteBuf& _buf); ::bright::String keyboardKey; static constexpr int __ID__ = 1812449155; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace ai { class ExecuteTimeStatistic : public ai::Service { public: static bool deserializeExecuteTimeStatistic(ByteBuf& _buf, ::bright::SharedPtr<ExecuteTimeStatistic>& _out); ExecuteTimeStatistic() { } ExecuteTimeStatistic(::bright::int32 id, ::bright::String node_name ) : ai::Service(id, node_name) { } virtual ~ExecuteTimeStatistic() {} bool deserialize(ByteBuf& _buf); static constexpr int __ID__ = 990693812; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace ai { class ChooseTarget : public ai::Service { public: static bool deserializeChooseTarget(ByteBuf& _buf, ::bright::SharedPtr<ChooseTarget>& _out); ChooseTarget() { } ChooseTarget(::bright::int32 id, ::bright::String node_name, ::bright::String result_target_key ) : ai::Service(id, node_name) { this->resultTargetKey = result_target_key; } virtual ~ChooseTarget() {} bool deserialize(ByteBuf& _buf); ::bright::String resultTargetKey; static constexpr int __ID__ = 1601247918; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace ai { class KeepFaceTarget : public ai::Service { public: static bool deserializeKeepFaceTarget(ByteBuf& _buf, ::bright::SharedPtr<KeepFaceTarget>& _out); KeepFaceTarget() { } KeepFaceTarget(::bright::int32 id, ::bright::String node_name, ::bright::String target_actor_key ) : ai::Service(id, node_name) { this->targetActorKey = target_actor_key; } virtual ~KeepFaceTarget() {} bool deserialize(ByteBuf& _buf); ::bright::String targetActorKey; static constexpr int __ID__ = 1195270745; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace ai { class GetOwnerPlayer : public ai::Service { public: static bool deserializeGetOwnerPlayer(ByteBuf& _buf, ::bright::SharedPtr<GetOwnerPlayer>& _out); GetOwnerPlayer() { } GetOwnerPlayer(::bright::int32 id, ::bright::String node_name, ::bright::String player_actor_key ) : ai::Service(id, node_name) { this->playerActorKey = player_actor_key; } virtual ~GetOwnerPlayer() {} bool deserialize(ByteBuf& _buf); ::bright::String playerActorKey; static constexpr int __ID__ = -999247644; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace ai { class UpdateDailyBehaviorProps : public ai::Service { public: static bool deserializeUpdateDailyBehaviorProps(ByteBuf& _buf, ::bright::SharedPtr<UpdateDailyBehaviorProps>& _out); UpdateDailyBehaviorProps() { } UpdateDailyBehaviorProps(::bright::int32 id, ::bright::String node_name, ::bright::String satiety_key, ::bright::String energy_key, ::bright::String mood_key, ::bright::String satiety_lower_threshold_key, ::bright::String satiety_upper_threshold_key, ::bright::String energy_lower_threshold_key, ::bright::String energy_upper_threshold_key, ::bright::String mood_lower_threshold_key, ::bright::String mood_upper_threshold_key ) : ai::Service(id, node_name) { this->satietyKey = satiety_key; this->energyKey = energy_key; this->moodKey = mood_key; this->satietyLowerThresholdKey = satiety_lower_threshold_key; this->satietyUpperThresholdKey = satiety_upper_threshold_key; this->energyLowerThresholdKey = energy_lower_threshold_key; this->energyUpperThresholdKey = energy_upper_threshold_key; this->moodLowerThresholdKey = mood_lower_threshold_key; this->moodUpperThresholdKey = mood_upper_threshold_key; } virtual ~UpdateDailyBehaviorProps() {} bool deserialize(ByteBuf& _buf); ::bright::String satietyKey; ::bright::String energyKey; ::bright::String moodKey; ::bright::String satietyLowerThresholdKey; ::bright::String satietyUpperThresholdKey; ::bright::String energyLowerThresholdKey; ::bright::String energyUpperThresholdKey; ::bright::String moodLowerThresholdKey; ::bright::String moodUpperThresholdKey; static constexpr int __ID__ = -61887372; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace ai { class Decorator : public ai::Node { public: static bool deserializeDecorator(ByteBuf& _buf, ::bright::SharedPtr<Decorator>& _out); Decorator() { } Decorator(::bright::int32 id, ::bright::String node_name, ai::EFlowAbortMode flow_abort_mode ) : ai::Node(id, node_name) { this->flowAbortMode = flow_abort_mode; } virtual ~Decorator() {} bool deserialize(ByteBuf& _buf); ai::EFlowAbortMode flowAbortMode; virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace ai { class UeLoop : public ai::Decorator { public: static bool deserializeUeLoop(ByteBuf& _buf, ::bright::SharedPtr<UeLoop>& _out); UeLoop() { } UeLoop(::bright::int32 id, ::bright::String node_name, ai::EFlowAbortMode flow_abort_mode, ::bright::int32 num_loops, bool infinite_loop, ::bright::float32 infinite_loop_timeout_time ) : ai::Decorator(id, node_name, flow_abort_mode) { this->numLoops = num_loops; this->infiniteLoop = infinite_loop; this->infiniteLoopTimeoutTime = infinite_loop_timeout_time; } virtual ~UeLoop() {} bool deserialize(ByteBuf& _buf); ::bright::int32 numLoops; bool infiniteLoop; ::bright::float32 infiniteLoopTimeoutTime; static constexpr int __ID__ = -513308166; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace ai { class UeCooldown : public ai::Decorator { public: static bool deserializeUeCooldown(ByteBuf& _buf, ::bright::SharedPtr<UeCooldown>& _out); UeCooldown() { } UeCooldown(::bright::int32 id, ::bright::String node_name, ai::EFlowAbortMode flow_abort_mode, ::bright::float32 cooldown_time ) : ai::Decorator(id, node_name, flow_abort_mode) { this->cooldownTime = cooldown_time; } virtual ~UeCooldown() {} bool deserialize(ByteBuf& _buf); ::bright::float32 cooldownTime; static constexpr int __ID__ = -951439423; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace ai { class UeTimeLimit : public ai::Decorator { public: static bool deserializeUeTimeLimit(ByteBuf& _buf, ::bright::SharedPtr<UeTimeLimit>& _out); UeTimeLimit() { } UeTimeLimit(::bright::int32 id, ::bright::String node_name, ai::EFlowAbortMode flow_abort_mode, ::bright::float32 limit_time ) : ai::Decorator(id, node_name, flow_abort_mode) { this->limitTime = limit_time; } virtual ~UeTimeLimit() {} bool deserialize(ByteBuf& _buf); ::bright::float32 limitTime; static constexpr int __ID__ = 338469720; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace ai { class UeBlackboard : public ai::Decorator { public: static bool deserializeUeBlackboard(ByteBuf& _buf, ::bright::SharedPtr<UeBlackboard>& _out); UeBlackboard() { } UeBlackboard(::bright::int32 id, ::bright::String node_name, ai::EFlowAbortMode flow_abort_mode, ai::ENotifyObserverMode notify_observer, ::bright::String blackboard_key, ::bright::SharedPtr<ai::KeyQueryOperator> key_query ) : ai::Decorator(id, node_name, flow_abort_mode) { this->notifyObserver = notify_observer; this->blackboardKey = blackboard_key; this->keyQuery = key_query; } virtual ~UeBlackboard() {} bool deserialize(ByteBuf& _buf); ai::ENotifyObserverMode notifyObserver; ::bright::String blackboardKey; ::bright::SharedPtr<ai::KeyQueryOperator> keyQuery; static constexpr int __ID__ = -315297507; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace ai { class KeyQueryOperator : public bright::CfgBean { public: static bool deserializeKeyQueryOperator(ByteBuf& _buf, ::bright::SharedPtr<KeyQueryOperator>& _out); KeyQueryOperator() { } virtual ~KeyQueryOperator() {} bool deserialize(ByteBuf& _buf); virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace ai { class IsSet : public ai::KeyQueryOperator { public: static bool deserializeIsSet(ByteBuf& _buf, ::bright::SharedPtr<IsSet>& _out); IsSet() { } virtual ~IsSet() {} bool deserialize(ByteBuf& _buf); static constexpr int __ID__ = 1635350898; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace ai { class IsNotSet : public ai::KeyQueryOperator { public: static bool deserializeIsNotSet(ByteBuf& _buf, ::bright::SharedPtr<IsNotSet>& _out); IsNotSet() { } virtual ~IsNotSet() {} bool deserialize(ByteBuf& _buf); static constexpr int __ID__ = 790736255; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace ai { class BinaryOperator : public ai::KeyQueryOperator { public: static bool deserializeBinaryOperator(ByteBuf& _buf, ::bright::SharedPtr<BinaryOperator>& _out); BinaryOperator() { } BinaryOperator(ai::EOperator oper, ::bright::SharedPtr<ai::KeyData> data ) : ai::KeyQueryOperator() { this->oper = oper; this->data = data; } virtual ~BinaryOperator() {} bool deserialize(ByteBuf& _buf); ai::EOperator oper; ::bright::SharedPtr<ai::KeyData> data; static constexpr int __ID__ = -979891605; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace ai { class KeyData : public bright::CfgBean { public: static bool deserializeKeyData(ByteBuf& _buf, ::bright::SharedPtr<KeyData>& _out); KeyData() { } virtual ~KeyData() {} bool deserialize(ByteBuf& _buf); virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace ai { class FloatKeyData : public ai::KeyData { public: static bool deserializeFloatKeyData(ByteBuf& _buf, ::bright::SharedPtr<FloatKeyData>& _out); FloatKeyData() { } FloatKeyData(::bright::float32 value ) : ai::KeyData() { this->value = value; } virtual ~FloatKeyData() {} bool deserialize(ByteBuf& _buf); ::bright::float32 value; static constexpr int __ID__ = -719747885; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace ai { class IntKeyData : public ai::KeyData { public: static bool deserializeIntKeyData(ByteBuf& _buf, ::bright::SharedPtr<IntKeyData>& _out); IntKeyData() { } IntKeyData(::bright::int32 value ) : ai::KeyData() { this->value = value; } virtual ~IntKeyData() {} bool deserialize(ByteBuf& _buf); ::bright::int32 value; static constexpr int __ID__ = -342751904; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace ai { class StringKeyData : public ai::KeyData { public: static bool deserializeStringKeyData(ByteBuf& _buf, ::bright::SharedPtr<StringKeyData>& _out); StringKeyData() { } StringKeyData(::bright::String value ) : ai::KeyData() { this->value = value; } virtual ~StringKeyData() {} bool deserialize(ByteBuf& _buf); ::bright::String value; static constexpr int __ID__ = -307888654; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace ai { class BlackboardKeyData : public ai::KeyData { public: static bool deserializeBlackboardKeyData(ByteBuf& _buf, ::bright::SharedPtr<BlackboardKeyData>& _out); BlackboardKeyData() { } BlackboardKeyData(::bright::String value ) : ai::KeyData() { this->value = value; } virtual ~BlackboardKeyData() {} bool deserialize(ByteBuf& _buf); ::bright::String value; static constexpr int __ID__ = 1517269500; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace ai { class UeForceSuccess : public ai::Decorator { public: static bool deserializeUeForceSuccess(ByteBuf& _buf, ::bright::SharedPtr<UeForceSuccess>& _out); UeForceSuccess() { } UeForceSuccess(::bright::int32 id, ::bright::String node_name, ai::EFlowAbortMode flow_abort_mode ) : ai::Decorator(id, node_name, flow_abort_mode) { } virtual ~UeForceSuccess() {} bool deserialize(ByteBuf& _buf); static constexpr int __ID__ = 195054574; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace ai { class IsAtLocation : public ai::Decorator { public: static bool deserializeIsAtLocation(ByteBuf& _buf, ::bright::SharedPtr<IsAtLocation>& _out); IsAtLocation() { } IsAtLocation(::bright::int32 id, ::bright::String node_name, ai::EFlowAbortMode flow_abort_mode, ::bright::float32 acceptable_radius, ::bright::String keyboard_key, bool inverse_condition ) : ai::Decorator(id, node_name, flow_abort_mode) { this->acceptableRadius = acceptable_radius; this->keyboardKey = keyboard_key; this->inverseCondition = inverse_condition; } virtual ~IsAtLocation() {} bool deserialize(ByteBuf& _buf); ::bright::float32 acceptableRadius; ::bright::String keyboardKey; bool inverseCondition; static constexpr int __ID__ = 1255972344; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace ai { class DistanceLessThan : public ai::Decorator { public: static bool deserializeDistanceLessThan(ByteBuf& _buf, ::bright::SharedPtr<DistanceLessThan>& _out); DistanceLessThan() { } DistanceLessThan(::bright::int32 id, ::bright::String node_name, ai::EFlowAbortMode flow_abort_mode, ::bright::String actor1_key, ::bright::String actor2_key, ::bright::float32 distance, bool reverse_result ) : ai::Decorator(id, node_name, flow_abort_mode) { this->actor1Key = actor1_key; this->actor2Key = actor2_key; this->distance = distance; this->reverseResult = reverse_result; } virtual ~DistanceLessThan() {} bool deserialize(ByteBuf& _buf); ::bright::String actor1Key; ::bright::String actor2Key; ::bright::float32 distance; bool reverseResult; static constexpr int __ID__ = -1207170283; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace ai { class FlowNode : public ai::Node { public: static bool deserializeFlowNode(ByteBuf& _buf, ::bright::SharedPtr<FlowNode>& _out); FlowNode() { } FlowNode(::bright::int32 id, ::bright::String node_name, ::bright::Vector<::bright::SharedPtr<ai::Decorator>> decorators, ::bright::Vector<::bright::SharedPtr<ai::Service>> services ) : ai::Node(id, node_name) { this->decorators = decorators; this->services = services; } virtual ~FlowNode() {} bool deserialize(ByteBuf& _buf); ::bright::Vector<::bright::SharedPtr<ai::Decorator>> decorators; ::bright::Vector<::bright::SharedPtr<ai::Service>> services; virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace ai { class ComposeNode : public ai::FlowNode { public: static bool deserializeComposeNode(ByteBuf& _buf, ::bright::SharedPtr<ComposeNode>& _out); ComposeNode() { } ComposeNode(::bright::int32 id, ::bright::String node_name, ::bright::Vector<::bright::SharedPtr<ai::Decorator>> decorators, ::bright::Vector<::bright::SharedPtr<ai::Service>> services ) : ai::FlowNode(id, node_name, decorators, services) { } virtual ~ComposeNode() {} bool deserialize(ByteBuf& _buf); virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace ai { class Sequence : public ai::ComposeNode { public: static bool deserializeSequence(ByteBuf& _buf, ::bright::SharedPtr<Sequence>& _out); Sequence() { } Sequence(::bright::int32 id, ::bright::String node_name, ::bright::Vector<::bright::SharedPtr<ai::Decorator>> decorators, ::bright::Vector<::bright::SharedPtr<ai::Service>> services, ::bright::Vector<::bright::SharedPtr<ai::FlowNode>> children ) : ai::ComposeNode(id, node_name, decorators, services) { this->children = children; } virtual ~Sequence() {} bool deserialize(ByteBuf& _buf); ::bright::Vector<::bright::SharedPtr<ai::FlowNode>> children; static constexpr int __ID__ = -1789006105; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace ai { class Selector : public ai::ComposeNode { public: static bool deserializeSelector(ByteBuf& _buf, ::bright::SharedPtr<Selector>& _out); Selector() { } Selector(::bright::int32 id, ::bright::String node_name, ::bright::Vector<::bright::SharedPtr<ai::Decorator>> decorators, ::bright::Vector<::bright::SharedPtr<ai::Service>> services, ::bright::Vector<::bright::SharedPtr<ai::FlowNode>> children ) : ai::ComposeNode(id, node_name, decorators, services) { this->children = children; } virtual ~Selector() {} bool deserialize(ByteBuf& _buf); ::bright::Vector<::bright::SharedPtr<ai::FlowNode>> children; static constexpr int __ID__ = -1946981627; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace ai { class SimpleParallel : public ai::ComposeNode { public: static bool deserializeSimpleParallel(ByteBuf& _buf, ::bright::SharedPtr<SimpleParallel>& _out); SimpleParallel() { } SimpleParallel(::bright::int32 id, ::bright::String node_name, ::bright::Vector<::bright::SharedPtr<ai::Decorator>> decorators, ::bright::Vector<::bright::SharedPtr<ai::Service>> services, ai::EFinishMode finish_mode, ::bright::SharedPtr<ai::Task> main_task, ::bright::SharedPtr<ai::FlowNode> background_node ) : ai::ComposeNode(id, node_name, decorators, services) { this->finishMode = finish_mode; this->mainTask = main_task; this->backgroundNode = background_node; } virtual ~SimpleParallel() {} bool deserialize(ByteBuf& _buf); ai::EFinishMode finishMode; ::bright::SharedPtr<ai::Task> mainTask; ::bright::SharedPtr<ai::FlowNode> backgroundNode; static constexpr int __ID__ = -1952582529; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace ai { class Task : public ai::FlowNode { public: static bool deserializeTask(ByteBuf& _buf, ::bright::SharedPtr<Task>& _out); Task() { } Task(::bright::int32 id, ::bright::String node_name, ::bright::Vector<::bright::SharedPtr<ai::Decorator>> decorators, ::bright::Vector<::bright::SharedPtr<ai::Service>> services, bool ignore_restart_self ) : ai::FlowNode(id, node_name, decorators, services) { this->ignoreRestartSelf = ignore_restart_self; } virtual ~Task() {} bool deserialize(ByteBuf& _buf); bool ignoreRestartSelf; virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace ai { class UeWait : public ai::Task { public: static bool deserializeUeWait(ByteBuf& _buf, ::bright::SharedPtr<UeWait>& _out); UeWait() { } UeWait(::bright::int32 id, ::bright::String node_name, ::bright::Vector<::bright::SharedPtr<ai::Decorator>> decorators, ::bright::Vector<::bright::SharedPtr<ai::Service>> services, bool ignore_restart_self, ::bright::float32 wait_time, ::bright::float32 random_deviation ) : ai::Task(id, node_name, decorators, services, ignore_restart_self) { this->waitTime = wait_time; this->randomDeviation = random_deviation; } virtual ~UeWait() {} bool deserialize(ByteBuf& _buf); ::bright::float32 waitTime; ::bright::float32 randomDeviation; static constexpr int __ID__ = -512994101; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace ai { class UeWaitBlackboardTime : public ai::Task { public: static bool deserializeUeWaitBlackboardTime(ByteBuf& _buf, ::bright::SharedPtr<UeWaitBlackboardTime>& _out); UeWaitBlackboardTime() { } UeWaitBlackboardTime(::bright::int32 id, ::bright::String node_name, ::bright::Vector<::bright::SharedPtr<ai::Decorator>> decorators, ::bright::Vector<::bright::SharedPtr<ai::Service>> services, bool ignore_restart_self, ::bright::String blackboard_key ) : ai::Task(id, node_name, decorators, services, ignore_restart_self) { this->blackboardKey = blackboard_key; } virtual ~UeWaitBlackboardTime() {} bool deserialize(ByteBuf& _buf); ::bright::String blackboardKey; static constexpr int __ID__ = 1215378271; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace ai { class MoveToTarget : public ai::Task { public: static bool deserializeMoveToTarget(ByteBuf& _buf, ::bright::SharedPtr<MoveToTarget>& _out); MoveToTarget() { } MoveToTarget(::bright::int32 id, ::bright::String node_name, ::bright::Vector<::bright::SharedPtr<ai::Decorator>> decorators, ::bright::Vector<::bright::SharedPtr<ai::Service>> services, bool ignore_restart_self, ::bright::String target_actor_key, ::bright::float32 acceptable_radius ) : ai::Task(id, node_name, decorators, services, ignore_restart_self) { this->targetActorKey = target_actor_key; this->acceptableRadius = acceptable_radius; } virtual ~MoveToTarget() {} bool deserialize(ByteBuf& _buf); ::bright::String targetActorKey; ::bright::float32 acceptableRadius; static constexpr int __ID__ = 514987779; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace ai { class ChooseSkill : public ai::Task { public: static bool deserializeChooseSkill(ByteBuf& _buf, ::bright::SharedPtr<ChooseSkill>& _out); ChooseSkill() { } ChooseSkill(::bright::int32 id, ::bright::String node_name, ::bright::Vector<::bright::SharedPtr<ai::Decorator>> decorators, ::bright::Vector<::bright::SharedPtr<ai::Service>> services, bool ignore_restart_self, ::bright::String target_actor_key, ::bright::String result_skill_id_key ) : ai::Task(id, node_name, decorators, services, ignore_restart_self) { this->targetActorKey = target_actor_key; this->resultSkillIdKey = result_skill_id_key; } virtual ~ChooseSkill() {} bool deserialize(ByteBuf& _buf); ::bright::String targetActorKey; ::bright::String resultSkillIdKey; static constexpr int __ID__ = -918812268; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace ai { class MoveToRandomLocation : public ai::Task { public: static bool deserializeMoveToRandomLocation(ByteBuf& _buf, ::bright::SharedPtr<MoveToRandomLocation>& _out); MoveToRandomLocation() { } MoveToRandomLocation(::bright::int32 id, ::bright::String node_name, ::bright::Vector<::bright::SharedPtr<ai::Decorator>> decorators, ::bright::Vector<::bright::SharedPtr<ai::Service>> services, bool ignore_restart_self, ::bright::String origin_position_key, ::bright::float32 radius ) : ai::Task(id, node_name, decorators, services, ignore_restart_self) { this->originPositionKey = origin_position_key; this->radius = radius; } virtual ~MoveToRandomLocation() {} bool deserialize(ByteBuf& _buf); ::bright::String originPositionKey; ::bright::float32 radius; static constexpr int __ID__ = -2140042998; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace ai { class MoveToLocation : public ai::Task { public: static bool deserializeMoveToLocation(ByteBuf& _buf, ::bright::SharedPtr<MoveToLocation>& _out); MoveToLocation() { } MoveToLocation(::bright::int32 id, ::bright::String node_name, ::bright::Vector<::bright::SharedPtr<ai::Decorator>> decorators, ::bright::Vector<::bright::SharedPtr<ai::Service>> services, bool ignore_restart_self, ::bright::Vector3 location, ::bright::float32 acceptable_radius ) : ai::Task(id, node_name, decorators, services, ignore_restart_self) { this->location = location; this->acceptableRadius = acceptable_radius; } virtual ~MoveToLocation() {} bool deserialize(ByteBuf& _buf); ::bright::Vector3 location; ::bright::float32 acceptableRadius; static constexpr int __ID__ = -969953113; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace ai { class DebugPrint : public ai::Task { public: static bool deserializeDebugPrint(ByteBuf& _buf, ::bright::SharedPtr<DebugPrint>& _out); DebugPrint() { } DebugPrint(::bright::int32 id, ::bright::String node_name, ::bright::Vector<::bright::SharedPtr<ai::Decorator>> decorators, ::bright::Vector<::bright::SharedPtr<ai::Service>> services, bool ignore_restart_self, ::bright::String text ) : ai::Task(id, node_name, decorators, services, ignore_restart_self) { this->text = text; } virtual ~DebugPrint() {} bool deserialize(ByteBuf& _buf); ::bright::String text; static constexpr int __ID__ = 1357409728; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace blueprint { class Clazz : public bright::CfgBean { public: static bool deserializeClazz(ByteBuf& _buf, ::bright::SharedPtr<Clazz>& _out); Clazz() { } Clazz(::bright::String name, ::bright::String desc, ::bright::Vector<::bright::SharedPtr<blueprint::Clazz>> parents, ::bright::Vector<::bright::SharedPtr<blueprint::Method>> methods ) { this->name = name; this->desc = desc; this->parents = parents; this->methods = methods; } virtual ~Clazz() {} bool deserialize(ByteBuf& _buf); ::bright::String name; ::bright::String desc; ::bright::Vector<::bright::SharedPtr<blueprint::Clazz>> parents; ::bright::Vector<::bright::SharedPtr<blueprint::Method>> methods; virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace blueprint { class Method : public bright::CfgBean { public: static bool deserializeMethod(ByteBuf& _buf, ::bright::SharedPtr<Method>& _out); Method() { } Method(::bright::String name, ::bright::String desc, bool is_static, ::bright::String return_type, ::bright::Vector<::bright::SharedPtr<blueprint::ParamInfo>> parameters ) { this->name = name; this->desc = desc; this->isStatic = is_static; this->returnType = return_type; this->parameters = parameters; } virtual ~Method() {} bool deserialize(ByteBuf& _buf); ::bright::String name; ::bright::String desc; bool isStatic; ::bright::String returnType; ::bright::Vector<::bright::SharedPtr<blueprint::ParamInfo>> parameters; virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace blueprint { class ParamInfo : public bright::CfgBean { public: static bool deserializeParamInfo(ByteBuf& _buf, ::bright::SharedPtr<ParamInfo>& _out); ParamInfo() { } ParamInfo(::bright::String name, ::bright::String type, bool is_ref ) { this->name = name; this->type = type; this->isRef = is_ref; } virtual ~ParamInfo() {} bool deserialize(ByteBuf& _buf); ::bright::String name; ::bright::String type; bool isRef; static constexpr int __ID__ = -729799392; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace blueprint { class AbstraceMethod : public blueprint::Method { public: static bool deserializeAbstraceMethod(ByteBuf& _buf, ::bright::SharedPtr<AbstraceMethod>& _out); AbstraceMethod() { } AbstraceMethod(::bright::String name, ::bright::String desc, bool is_static, ::bright::String return_type, ::bright::Vector<::bright::SharedPtr<blueprint::ParamInfo>> parameters ) : blueprint::Method(name, desc, is_static, return_type, parameters) { } virtual ~AbstraceMethod() {} bool deserialize(ByteBuf& _buf); static constexpr int __ID__ = -392137809; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace blueprint { class ExternalMethod : public blueprint::Method { public: static bool deserializeExternalMethod(ByteBuf& _buf, ::bright::SharedPtr<ExternalMethod>& _out); ExternalMethod() { } ExternalMethod(::bright::String name, ::bright::String desc, bool is_static, ::bright::String return_type, ::bright::Vector<::bright::SharedPtr<blueprint::ParamInfo>> parameters ) : blueprint::Method(name, desc, is_static, return_type, parameters) { } virtual ~ExternalMethod() {} bool deserialize(ByteBuf& _buf); static constexpr int __ID__ = 1739079015; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace blueprint { class BlueprintMethod : public blueprint::Method { public: static bool deserializeBlueprintMethod(ByteBuf& _buf, ::bright::SharedPtr<BlueprintMethod>& _out); BlueprintMethod() { } BlueprintMethod(::bright::String name, ::bright::String desc, bool is_static, ::bright::String return_type, ::bright::Vector<::bright::SharedPtr<blueprint::ParamInfo>> parameters ) : blueprint::Method(name, desc, is_static, return_type, parameters) { } virtual ~BlueprintMethod() {} bool deserialize(ByteBuf& _buf); static constexpr int __ID__ = -696408103; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace blueprint { class Interface : public blueprint::Clazz { public: static bool deserializeInterface(ByteBuf& _buf, ::bright::SharedPtr<Interface>& _out); Interface() { } Interface(::bright::String name, ::bright::String desc, ::bright::Vector<::bright::SharedPtr<blueprint::Clazz>> parents, ::bright::Vector<::bright::SharedPtr<blueprint::Method>> methods ) : blueprint::Clazz(name, desc, parents, methods) { } virtual ~Interface() {} bool deserialize(ByteBuf& _buf); static constexpr int __ID__ = 2114170750; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace blueprint { class NormalClazz : public blueprint::Clazz { public: static bool deserializeNormalClazz(ByteBuf& _buf, ::bright::SharedPtr<NormalClazz>& _out); NormalClazz() { } NormalClazz(::bright::String name, ::bright::String desc, ::bright::Vector<::bright::SharedPtr<blueprint::Clazz>> parents, ::bright::Vector<::bright::SharedPtr<blueprint::Method>> methods, bool is_abstract, ::bright::Vector<::bright::SharedPtr<blueprint::Field>> fields ) : blueprint::Clazz(name, desc, parents, methods) { this->isAbstract = is_abstract; this->fields = fields; } virtual ~NormalClazz() {} bool deserialize(ByteBuf& _buf); bool isAbstract; ::bright::Vector<::bright::SharedPtr<blueprint::Field>> fields; static constexpr int __ID__ = -2073576778; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace blueprint { class Field : public bright::CfgBean { public: static bool deserializeField(ByteBuf& _buf, ::bright::SharedPtr<Field>& _out); Field() { } Field(::bright::String name, ::bright::String type, ::bright::String desc ) { this->name = name; this->type = type; this->desc = desc; } virtual ~Field() {} bool deserialize(ByteBuf& _buf); ::bright::String name; ::bright::String type; ::bright::String desc; static constexpr int __ID__ = 1694158271; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace blueprint { class EnumClazz : public blueprint::Clazz { public: static bool deserializeEnumClazz(ByteBuf& _buf, ::bright::SharedPtr<EnumClazz>& _out); EnumClazz() { } EnumClazz(::bright::String name, ::bright::String desc, ::bright::Vector<::bright::SharedPtr<blueprint::Clazz>> parents, ::bright::Vector<::bright::SharedPtr<blueprint::Method>> methods, ::bright::Vector<::bright::SharedPtr<blueprint::EnumField>> enums ) : blueprint::Clazz(name, desc, parents, methods) { this->enums = enums; } virtual ~EnumClazz() {} bool deserialize(ByteBuf& _buf); ::bright::Vector<::bright::SharedPtr<blueprint::EnumField>> enums; static constexpr int __ID__ = 1827364892; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace blueprint { class EnumField : public bright::CfgBean { public: static bool deserializeEnumField(ByteBuf& _buf, ::bright::SharedPtr<EnumField>& _out); EnumField() { } EnumField(::bright::String name, ::bright::int32 value ) { this->name = name; this->value = value; } virtual ~EnumField() {} bool deserialize(ByteBuf& _buf); ::bright::String name; ::bright::int32 value; static constexpr int __ID__ = 1830049470; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace bonus { class DropInfo : public bright::CfgBean { public: static bool deserializeDropInfo(ByteBuf& _buf, ::bright::SharedPtr<DropInfo>& _out); DropInfo() { } DropInfo(::bright::int32 id, ::bright::String desc, ::bright::Vector<::bright::SharedPtr<bonus::ShowItemInfo>> client_show_items, ::bright::SharedPtr<bonus::Bonus> bonus ) { this->id = id; this->desc = desc; this->clientShowItems = client_show_items; this->bonus = bonus; } virtual ~DropInfo() {} bool deserialize(ByteBuf& _buf); ::bright::int32 id; ::bright::String desc; ::bright::Vector<::bright::SharedPtr<bonus::ShowItemInfo>> clientShowItems; ::bright::SharedPtr<bonus::Bonus> bonus; static constexpr int __ID__ = -2014781108; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace bonus { class ShowItemInfo : public bright::CfgBean { public: static bool deserializeShowItemInfo(ByteBuf& _buf, ::bright::SharedPtr<ShowItemInfo>& _out); ShowItemInfo() { } ShowItemInfo(::bright::int32 item_id, ::bright::int64 item_num ) { this->itemId = item_id; this->itemNum = item_num; } virtual ~ShowItemInfo() {} bool deserialize(ByteBuf& _buf); ::bright::int32 itemId; ::bright::SharedPtr<item::Item> itemId_Ref; ::bright::int64 itemNum; static constexpr int __ID__ = -1496363507; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace bonus { class Bonus : public bright::CfgBean { public: static bool deserializeBonus(ByteBuf& _buf, ::bright::SharedPtr<Bonus>& _out); Bonus() { } virtual ~Bonus() {} bool deserialize(ByteBuf& _buf); virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace bonus { class OneItem : public bonus::Bonus { public: static bool deserializeOneItem(ByteBuf& _buf, ::bright::SharedPtr<OneItem>& _out); OneItem() { } OneItem(::bright::int32 item_id ) : bonus::Bonus() { this->itemId = item_id; } virtual ~OneItem() {} bool deserialize(ByteBuf& _buf); ::bright::int32 itemId; ::bright::SharedPtr<item::Item> itemId_Ref; static constexpr int __ID__ = -1649658966; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace bonus { class OneItems : public bonus::Bonus { public: static bool deserializeOneItems(ByteBuf& _buf, ::bright::SharedPtr<OneItems>& _out); OneItems() { } OneItems(::bright::Vector<::bright::int32> items ) : bonus::Bonus() { this->items = items; } virtual ~OneItems() {} bool deserialize(ByteBuf& _buf); ::bright::Vector<::bright::int32> items; static constexpr int __ID__ = 400179721; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace bonus { class Item : public bonus::Bonus { public: static bool deserializeItem(ByteBuf& _buf, ::bright::SharedPtr<Item>& _out); Item() { } Item(::bright::int32 item_id, ::bright::int32 amount ) : bonus::Bonus() { this->itemId = item_id; this->amount = amount; } virtual ~Item() {} bool deserialize(ByteBuf& _buf); ::bright::int32 itemId; ::bright::SharedPtr<item::Item> itemId_Ref; ::bright::int32 amount; static constexpr int __ID__ = 1689011106; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace bonus { class Items : public bonus::Bonus { public: static bool deserializeItems(ByteBuf& _buf, ::bright::SharedPtr<Items>& _out); Items() { } Items(::bright::Vector<::bright::SharedPtr<bonus::Item>> item_list ) : bonus::Bonus() { this->itemList = item_list; } virtual ~Items() {} bool deserialize(ByteBuf& _buf); ::bright::Vector<::bright::SharedPtr<bonus::Item>> itemList; static constexpr int __ID__ = 819736849; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace bonus { class CoefficientItem : public bonus::Bonus { public: static bool deserializeCoefficientItem(ByteBuf& _buf, ::bright::SharedPtr<CoefficientItem>& _out); CoefficientItem() { } CoefficientItem(::bright::int32 bonus_id, ::bright::SharedPtr<bonus::Items> bonus_list ) : bonus::Bonus() { this->bonusId = bonus_id; this->bonusList = bonus_list; } virtual ~CoefficientItem() {} bool deserialize(ByteBuf& _buf); ::bright::int32 bonusId; ::bright::SharedPtr<bonus::Items> bonusList; static constexpr int __ID__ = -229470727; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace bonus { class WeightItems : public bonus::Bonus { public: static bool deserializeWeightItems(ByteBuf& _buf, ::bright::SharedPtr<WeightItems>& _out); WeightItems() { } WeightItems(::bright::Vector<::bright::SharedPtr<bonus::WeightItemInfo>> item_list ) : bonus::Bonus() { this->itemList = item_list; } virtual ~WeightItems() {} bool deserialize(ByteBuf& _buf); ::bright::Vector<::bright::SharedPtr<bonus::WeightItemInfo>> itemList; static constexpr int __ID__ = -356202311; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace bonus { class WeightItemInfo : public bright::CfgBean { public: static bool deserializeWeightItemInfo(ByteBuf& _buf, ::bright::SharedPtr<WeightItemInfo>& _out); WeightItemInfo() { } WeightItemInfo(::bright::int32 item_id, ::bright::int32 num, ::bright::int32 weight ) { this->itemId = item_id; this->num = num; this->weight = weight; } virtual ~WeightItemInfo() {} bool deserialize(ByteBuf& _buf); ::bright::int32 itemId; ::bright::SharedPtr<item::Item> itemId_Ref; ::bright::int32 num; ::bright::int32 weight; static constexpr int __ID__ = 1239999176; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace bonus { class ProbabilityItems : public bonus::Bonus { public: static bool deserializeProbabilityItems(ByteBuf& _buf, ::bright::SharedPtr<ProbabilityItems>& _out); ProbabilityItems() { } ProbabilityItems(::bright::Vector<::bright::SharedPtr<bonus::ProbabilityItemInfo>> item_list ) : bonus::Bonus() { this->itemList = item_list; } virtual ~ProbabilityItems() {} bool deserialize(ByteBuf& _buf); ::bright::Vector<::bright::SharedPtr<bonus::ProbabilityItemInfo>> itemList; static constexpr int __ID__ = 366387866; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace bonus { class ProbabilityItemInfo : public bright::CfgBean { public: static bool deserializeProbabilityItemInfo(ByteBuf& _buf, ::bright::SharedPtr<ProbabilityItemInfo>& _out); ProbabilityItemInfo() { } ProbabilityItemInfo(::bright::int32 item_id, ::bright::int32 num, ::bright::float32 probability ) { this->itemId = item_id; this->num = num; this->probability = probability; } virtual ~ProbabilityItemInfo() {} bool deserialize(ByteBuf& _buf); ::bright::int32 itemId; ::bright::SharedPtr<item::Item> itemId_Ref; ::bright::int32 num; ::bright::float32 probability; static constexpr int __ID__ = 1547874631; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace bonus { class MultiBonus : public bonus::Bonus { public: static bool deserializeMultiBonus(ByteBuf& _buf, ::bright::SharedPtr<MultiBonus>& _out); MultiBonus() { } MultiBonus(::bright::Vector<::bright::SharedPtr<bonus::Bonus>> bonuses ) : bonus::Bonus() { this->bonuses = bonuses; } virtual ~MultiBonus() {} bool deserialize(ByteBuf& _buf); ::bright::Vector<::bright::SharedPtr<bonus::Bonus>> bonuses; static constexpr int __ID__ = 1421907893; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace bonus { class ProbabilityBonus : public bonus::Bonus { public: static bool deserializeProbabilityBonus(ByteBuf& _buf, ::bright::SharedPtr<ProbabilityBonus>& _out); ProbabilityBonus() { } ProbabilityBonus(::bright::Vector<::bright::SharedPtr<bonus::ProbabilityBonusInfo>> bonuses ) : bonus::Bonus() { this->bonuses = bonuses; } virtual ~ProbabilityBonus() {} bool deserialize(ByteBuf& _buf); ::bright::Vector<::bright::SharedPtr<bonus::ProbabilityBonusInfo>> bonuses; static constexpr int __ID__ = 359783161; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace bonus { class ProbabilityBonusInfo : public bright::CfgBean { public: static bool deserializeProbabilityBonusInfo(ByteBuf& _buf, ::bright::SharedPtr<ProbabilityBonusInfo>& _out); ProbabilityBonusInfo() { } ProbabilityBonusInfo(::bright::SharedPtr<bonus::Bonus> bonus, ::bright::float32 probability ) { this->bonus = bonus; this->probability = probability; } virtual ~ProbabilityBonusInfo() {} bool deserialize(ByteBuf& _buf); ::bright::SharedPtr<bonus::Bonus> bonus; ::bright::float32 probability; static constexpr int __ID__ = 46960455; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace bonus { class WeightBonus : public bonus::Bonus { public: static bool deserializeWeightBonus(ByteBuf& _buf, ::bright::SharedPtr<WeightBonus>& _out); WeightBonus() { } WeightBonus(::bright::Vector<::bright::SharedPtr<bonus::WeightBonusInfo>> bonuses ) : bonus::Bonus() { this->bonuses = bonuses; } virtual ~WeightBonus() {} bool deserialize(ByteBuf& _buf); ::bright::Vector<::bright::SharedPtr<bonus::WeightBonusInfo>> bonuses; static constexpr int __ID__ = -362807016; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace bonus { class WeightBonusInfo : public bright::CfgBean { public: static bool deserializeWeightBonusInfo(ByteBuf& _buf, ::bright::SharedPtr<WeightBonusInfo>& _out); WeightBonusInfo() { } WeightBonusInfo(::bright::SharedPtr<bonus::Bonus> bonus, ::bright::int32 weight ) { this->bonus = bonus; this->weight = weight; } virtual ~WeightBonusInfo() {} bool deserialize(ByteBuf& _buf); ::bright::SharedPtr<bonus::Bonus> bonus; ::bright::int32 weight; static constexpr int __ID__ = -907244058; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace bonus { class DropBonus : public bonus::Bonus { public: static bool deserializeDropBonus(ByteBuf& _buf, ::bright::SharedPtr<DropBonus>& _out); DropBonus() { } DropBonus(::bright::int32 id ) : bonus::Bonus() { this->id = id; } virtual ~DropBonus() {} bool deserialize(ByteBuf& _buf); ::bright::int32 id; ::bright::SharedPtr<bonus::DropInfo> id_Ref; static constexpr int __ID__ = 1959868225; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace common { class GlobalConfig : public bright::CfgBean { public: static bool deserializeGlobalConfig(ByteBuf& _buf, ::bright::SharedPtr<GlobalConfig>& _out); GlobalConfig() { } GlobalConfig(::bright::int32 bag_capacity, ::bright::int32 bag_capacity_special, ::bright::int32 bag_temp_expendable_capacity, ::bright::int32 bag_temp_tool_capacity, ::bright::int32 bag_init_capacity, ::bright::int32 quick_bag_capacity, ::bright::int32 cloth_bag_capacity, ::bright::int32 cloth_bag_init_capacity, ::bright::int32 cloth_bag_capacity_special, ::bright::SharedPtr<::bright::int32> bag_init_items_drop_id, ::bright::int32 mail_box_capacity, ::bright::float32 damage_param_c, ::bright::float32 damage_param_e, ::bright::float32 damage_param_f, ::bright::float32 damage_param_d, ::bright::float32 role_speed, ::bright::float32 monster_speed, ::bright::int32 init_energy, ::bright::int32 init_viality, ::bright::int32 max_viality, ::bright::int32 per_viality_recovery_time ) { this->bagCapacity = bag_capacity; this->bagCapacitySpecial = bag_capacity_special; this->bagTempExpendableCapacity = bag_temp_expendable_capacity; this->bagTempToolCapacity = bag_temp_tool_capacity; this->bagInitCapacity = bag_init_capacity; this->quickBagCapacity = quick_bag_capacity; this->clothBagCapacity = cloth_bag_capacity; this->clothBagInitCapacity = cloth_bag_init_capacity; this->clothBagCapacitySpecial = cloth_bag_capacity_special; this->bagInitItemsDropId = bag_init_items_drop_id; this->mailBoxCapacity = mail_box_capacity; this->damageParamC = damage_param_c; this->damageParamE = damage_param_e; this->damageParamF = damage_param_f; this->damageParamD = damage_param_d; this->roleSpeed = role_speed; this->monsterSpeed = monster_speed; this->initEnergy = init_energy; this->initViality = init_viality; this->maxViality = max_viality; this->perVialityRecoveryTime = per_viality_recovery_time; } virtual ~GlobalConfig() {} bool deserialize(ByteBuf& _buf); /** * 背包容量 */ ::bright::int32 bagCapacity; ::bright::int32 bagCapacitySpecial; ::bright::int32 bagTempExpendableCapacity; ::bright::int32 bagTempToolCapacity; ::bright::int32 bagInitCapacity; ::bright::int32 quickBagCapacity; ::bright::int32 clothBagCapacity; ::bright::int32 clothBagInitCapacity; ::bright::int32 clothBagCapacitySpecial; ::bright::SharedPtr<::bright::int32> bagInitItemsDropId; ::bright::SharedPtr<bonus::DropInfo> bagInitItemsDropId_Ref; ::bright::int32 mailBoxCapacity; ::bright::float32 damageParamC; ::bright::float32 damageParamE; ::bright::float32 damageParamF; ::bright::float32 damageParamD; ::bright::float32 roleSpeed; ::bright::float32 monsterSpeed; ::bright::int32 initEnergy; ::bright::int32 initViality; ::bright::int32 maxViality; ::bright::int32 perVialityRecoveryTime; static constexpr int __ID__ = -848234488; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace error { class ErrorInfo : public bright::CfgBean { public: static bool deserializeErrorInfo(ByteBuf& _buf, ::bright::SharedPtr<ErrorInfo>& _out); ErrorInfo() { } ErrorInfo(::bright::String code, ::bright::String desc, ::bright::SharedPtr<error::ErrorStyle> style ) { this->code = code; this->desc = desc; this->style = style; } virtual ~ErrorInfo() {} bool deserialize(ByteBuf& _buf); ::bright::String code; ::bright::String desc; ::bright::SharedPtr<error::ErrorStyle> style; static constexpr int __ID__ = 1389347408; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace error { class ErrorStyle : public bright::CfgBean { public: static bool deserializeErrorStyle(ByteBuf& _buf, ::bright::SharedPtr<ErrorStyle>& _out); ErrorStyle() { } virtual ~ErrorStyle() {} bool deserialize(ByteBuf& _buf); virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace error { class ErrorStyleTip : public error::ErrorStyle { public: static bool deserializeErrorStyleTip(ByteBuf& _buf, ::bright::SharedPtr<ErrorStyleTip>& _out); ErrorStyleTip() { } virtual ~ErrorStyleTip() {} bool deserialize(ByteBuf& _buf); static constexpr int __ID__ = 1915239884; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace error { class ErrorStyleMsgbox : public error::ErrorStyle { public: static bool deserializeErrorStyleMsgbox(ByteBuf& _buf, ::bright::SharedPtr<ErrorStyleMsgbox>& _out); ErrorStyleMsgbox() { } ErrorStyleMsgbox(::bright::String btn_name, error::EOperation operation ) : error::ErrorStyle() { this->btnName = btn_name; this->operation = operation; } virtual ~ErrorStyleMsgbox() {} bool deserialize(ByteBuf& _buf); ::bright::String btnName; error::EOperation operation; static constexpr int __ID__ = -1920482343; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace error { class ErrorStyleDlgOk : public error::ErrorStyle { public: static bool deserializeErrorStyleDlgOk(ByteBuf& _buf, ::bright::SharedPtr<ErrorStyleDlgOk>& _out); ErrorStyleDlgOk() { } ErrorStyleDlgOk(::bright::String btn_name ) : error::ErrorStyle() { this->btnName = btn_name; } virtual ~ErrorStyleDlgOk() {} bool deserialize(ByteBuf& _buf); ::bright::String btnName; static constexpr int __ID__ = -2010134516; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace error { class ErrorStyleDlgOkCancel : public error::ErrorStyle { public: static bool deserializeErrorStyleDlgOkCancel(ByteBuf& _buf, ::bright::SharedPtr<ErrorStyleDlgOkCancel>& _out); ErrorStyleDlgOkCancel() { } ErrorStyleDlgOkCancel(::bright::String btn1_name, ::bright::String btn2_name ) : error::ErrorStyle() { this->btn1Name = btn1_name; this->btn2Name = btn2_name; } virtual ~ErrorStyleDlgOkCancel() {} bool deserialize(ByteBuf& _buf); ::bright::String btn1Name; ::bright::String btn2Name; static constexpr int __ID__ = 971221414; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace error { class CodeInfo : public bright::CfgBean { public: static bool deserializeCodeInfo(ByteBuf& _buf, ::bright::SharedPtr<CodeInfo>& _out); CodeInfo() { } CodeInfo(error::EErrorCode code, ::bright::String key ) { this->code = code; this->key = key; } virtual ~CodeInfo() {} bool deserialize(ByteBuf& _buf); error::EErrorCode code; ::bright::String key; static constexpr int __ID__ = -1942481535; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace item { /** * 道具 */ class Item : public bright::CfgBean { public: static bool deserializeItem(ByteBuf& _buf, ::bright::SharedPtr<Item>& _out); Item() { } Item(::bright::int32 id, ::bright::String name, item::EMajorType major_type, item::EMinorType minor_type, ::bright::int32 max_pile_num, item::EItemQuality quality, ::bright::String icon, ::bright::String icon_backgroud, ::bright::String icon_mask, ::bright::String desc, ::bright::int32 show_order, ::bright::String quantifier, bool show_in_bag, ::bright::int32 min_show_level, bool batch_usable, ::bright::float32 progress_time_when_use, bool show_hint_when_use, bool droppable, ::bright::SharedPtr<::bright::int32> price, item::EUseType use_type, ::bright::SharedPtr<::bright::int32> level_up_id ) { this->id = id; this->name = name; this->majorType = major_type; this->minorType = minor_type; this->maxPileNum = max_pile_num; this->quality = quality; this->icon = icon; this->iconBackgroud = icon_backgroud; this->iconMask = icon_mask; this->desc = desc; this->showOrder = show_order; this->quantifier = quantifier; this->showInBag = show_in_bag; this->minShowLevel = min_show_level; this->batchUsable = batch_usable; this->progressTimeWhenUse = progress_time_when_use; this->showHintWhenUse = show_hint_when_use; this->droppable = droppable; this->price = price; this->useType = use_type; this->levelUpId = level_up_id; } virtual ~Item() {} bool deserialize(ByteBuf& _buf); /** * 道具id */ ::bright::int32 id; ::bright::String name; item::EMajorType majorType; item::EMinorType minorType; ::bright::int32 maxPileNum; item::EItemQuality quality; ::bright::String icon; ::bright::String iconBackgroud; ::bright::String iconMask; ::bright::String desc; ::bright::int32 showOrder; ::bright::String quantifier; bool showInBag; ::bright::int32 minShowLevel; bool batchUsable; ::bright::float32 progressTimeWhenUse; bool showHintWhenUse; bool droppable; ::bright::SharedPtr<::bright::int32> price; item::EUseType useType; ::bright::SharedPtr<::bright::int32> levelUpId; static constexpr int __ID__ = 2107285806; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace item { class ItemFunction : public bright::CfgBean { public: static bool deserializeItemFunction(ByteBuf& _buf, ::bright::SharedPtr<ItemFunction>& _out); ItemFunction() { } ItemFunction(item::EMinorType minor_type, item::EItemFunctionType func_type, ::bright::String method, bool close_bag_ui ) { this->minorType = minor_type; this->funcType = func_type; this->method = method; this->closeBagUi = close_bag_ui; } virtual ~ItemFunction() {} bool deserialize(ByteBuf& _buf); item::EMinorType minorType; item::EItemFunctionType funcType; ::bright::String method; bool closeBagUi; static constexpr int __ID__ = 1205824294; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace item { class ItemExtra : public bright::CfgBean { public: static bool deserializeItemExtra(ByteBuf& _buf, ::bright::SharedPtr<ItemExtra>& _out); ItemExtra() { } ItemExtra(::bright::int32 id ) { this->id = id; } virtual ~ItemExtra() {} bool deserialize(ByteBuf& _buf); ::bright::int32 id; virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace item { class TreasureBox : public item::ItemExtra { public: static bool deserializeTreasureBox(ByteBuf& _buf, ::bright::SharedPtr<TreasureBox>& _out); TreasureBox() { } TreasureBox(::bright::int32 id, ::bright::SharedPtr<::bright::int32> key_item_id, ::bright::SharedPtr<condition::MinLevel> open_level, bool use_on_obtain, ::bright::Vector<::bright::int32> drop_ids, ::bright::Vector<::bright::SharedPtr<item::ChooseOneBonus>> choose_list ) : item::ItemExtra(id) { this->keyItemId = key_item_id; this->openLevel = open_level; this->useOnObtain = use_on_obtain; this->dropIds = drop_ids; this->chooseList = choose_list; } virtual ~TreasureBox() {} bool deserialize(ByteBuf& _buf); ::bright::SharedPtr<::bright::int32> keyItemId; ::bright::SharedPtr<condition::MinLevel> openLevel; bool useOnObtain; ::bright::Vector<::bright::int32> dropIds; ::bright::Vector<::bright::SharedPtr<item::ChooseOneBonus>> chooseList; static constexpr int __ID__ = 1494222369; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace condition { class Condition : public bright::CfgBean { public: static bool deserializeCondition(ByteBuf& _buf, ::bright::SharedPtr<Condition>& _out); Condition() { } virtual ~Condition() {} bool deserialize(ByteBuf& _buf); virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace condition { class TimeRange : public condition::Condition { public: static bool deserializeTimeRange(ByteBuf& _buf, ::bright::SharedPtr<TimeRange>& _out); TimeRange() { } TimeRange(::bright::SharedPtr<common::DateTimeRange> date_time_range ) : condition::Condition() { this->dateTimeRange = date_time_range; } virtual ~TimeRange() {} bool deserialize(ByteBuf& _buf); ::bright::SharedPtr<common::DateTimeRange> dateTimeRange; static constexpr int __ID__ = 1069033789; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace common { class DateTimeRange : public bright::CfgBean { public: static bool deserializeDateTimeRange(ByteBuf& _buf, ::bright::SharedPtr<DateTimeRange>& _out); DateTimeRange() { } DateTimeRange(::bright::SharedPtr<::bright::datetime> start_time, ::bright::SharedPtr<::bright::datetime> end_time ) { this->startTime = start_time; this->endTime = end_time; } virtual ~DateTimeRange() {} bool deserialize(ByteBuf& _buf); ::bright::SharedPtr<::bright::datetime> startTime; ::bright::SharedPtr<::bright::datetime> endTime; static constexpr int __ID__ = 1642200959; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace condition { class RoleCondition : public condition::Condition { public: static bool deserializeRoleCondition(ByteBuf& _buf, ::bright::SharedPtr<RoleCondition>& _out); RoleCondition() { } virtual ~RoleCondition() {} bool deserialize(ByteBuf& _buf); virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace condition { class MultiRoleCondition : public condition::RoleCondition { public: static bool deserializeMultiRoleCondition(ByteBuf& _buf, ::bright::SharedPtr<MultiRoleCondition>& _out); MultiRoleCondition() { } MultiRoleCondition(::bright::Vector<::bright::SharedPtr<condition::RoleCondition>> conditions ) : condition::RoleCondition() { this->conditions = conditions; } virtual ~MultiRoleCondition() {} bool deserialize(ByteBuf& _buf); ::bright::Vector<::bright::SharedPtr<condition::RoleCondition>> conditions; static constexpr int __ID__ = 934079583; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace condition { class BoolRoleCondition : public condition::RoleCondition { public: static bool deserializeBoolRoleCondition(ByteBuf& _buf, ::bright::SharedPtr<BoolRoleCondition>& _out); BoolRoleCondition() { } virtual ~BoolRoleCondition() {} bool deserialize(ByteBuf& _buf); virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace condition { class GenderLimit : public condition::BoolRoleCondition { public: static bool deserializeGenderLimit(ByteBuf& _buf, ::bright::SharedPtr<GenderLimit>& _out); GenderLimit() { } GenderLimit(role::EGenderType gender ) : condition::BoolRoleCondition() { this->gender = gender; } virtual ~GenderLimit() {} bool deserialize(ByteBuf& _buf); role::EGenderType gender; static constexpr int __ID__ = 103675143; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace condition { class MinLevel : public condition::BoolRoleCondition { public: static bool deserializeMinLevel(ByteBuf& _buf, ::bright::SharedPtr<MinLevel>& _out); MinLevel() { } MinLevel(::bright::int32 level ) : condition::BoolRoleCondition() { this->level = level; } virtual ~MinLevel() {} bool deserialize(ByteBuf& _buf); ::bright::int32 level; static constexpr int __ID__ = -1075273755; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace condition { class MaxLevel : public condition::BoolRoleCondition { public: static bool deserializeMaxLevel(ByteBuf& _buf, ::bright::SharedPtr<MaxLevel>& _out); MaxLevel() { } MaxLevel(::bright::int32 level ) : condition::BoolRoleCondition() { this->level = level; } virtual ~MaxLevel() {} bool deserialize(ByteBuf& _buf); ::bright::int32 level; static constexpr int __ID__ = 700922899; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace condition { class MinMaxLevel : public condition::BoolRoleCondition { public: static bool deserializeMinMaxLevel(ByteBuf& _buf, ::bright::SharedPtr<MinMaxLevel>& _out); MinMaxLevel() { } MinMaxLevel(::bright::int32 min, ::bright::int32 max ) : condition::BoolRoleCondition() { this->min = min; this->max = max; } virtual ~MinMaxLevel() {} bool deserialize(ByteBuf& _buf); ::bright::int32 min; ::bright::int32 max; static constexpr int __ID__ = 907499647; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace condition { class ClothesPropertyScoreGreaterThan : public condition::BoolRoleCondition { public: static bool deserializeClothesPropertyScoreGreaterThan(ByteBuf& _buf, ::bright::SharedPtr<ClothesPropertyScoreGreaterThan>& _out); ClothesPropertyScoreGreaterThan() { } ClothesPropertyScoreGreaterThan(item::EClothesPropertyType prop, ::bright::int32 value ) : condition::BoolRoleCondition() { this->prop = prop; this->value = value; } virtual ~ClothesPropertyScoreGreaterThan() {} bool deserialize(ByteBuf& _buf); item::EClothesPropertyType prop; ::bright::int32 value; static constexpr int __ID__ = 696630835; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace condition { class ContainsItem : public condition::RoleCondition { public: static bool deserializeContainsItem(ByteBuf& _buf, ::bright::SharedPtr<ContainsItem>& _out); ContainsItem() { } ContainsItem(::bright::int32 item_id, ::bright::int32 num, bool reverse ) : condition::RoleCondition() { this->itemId = item_id; this->num = num; this->reverse = reverse; } virtual ~ContainsItem() {} bool deserialize(ByteBuf& _buf); ::bright::int32 itemId; ::bright::SharedPtr<item::Item> itemId_Ref; ::bright::int32 num; bool reverse; static constexpr int __ID__ = 1961145317; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace item { class ChooseOneBonus : public bright::CfgBean { public: static bool deserializeChooseOneBonus(ByteBuf& _buf, ::bright::SharedPtr<ChooseOneBonus>& _out); ChooseOneBonus() { } ChooseOneBonus(::bright::int32 drop_id, bool is_unique ) { this->dropId = drop_id; this->isUnique = is_unique; } virtual ~ChooseOneBonus() {} bool deserialize(ByteBuf& _buf); ::bright::int32 dropId; ::bright::SharedPtr<bonus::DropInfo> dropId_Ref; bool isUnique; static constexpr int __ID__ = 228058347; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace item { class InteractionItem : public item::ItemExtra { public: static bool deserializeInteractionItem(ByteBuf& _buf, ::bright::SharedPtr<InteractionItem>& _out); InteractionItem() { } InteractionItem(::bright::int32 id, ::bright::SharedPtr<::bright::int32> attack_num, ::bright::String holding_static_mesh, ::bright::String holding_static_mesh_mat ) : item::ItemExtra(id) { this->attackNum = attack_num; this->holdingStaticMesh = holding_static_mesh; this->holdingStaticMeshMat = holding_static_mesh_mat; } virtual ~InteractionItem() {} bool deserialize(ByteBuf& _buf); ::bright::SharedPtr<::bright::int32> attackNum; ::bright::String holdingStaticMesh; ::bright::String holdingStaticMeshMat; static constexpr int __ID__ = 640937802; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace item { class Clothes : public item::ItemExtra { public: static bool deserializeClothes(ByteBuf& _buf, ::bright::SharedPtr<Clothes>& _out); Clothes() { } Clothes(::bright::int32 id, ::bright::int32 attack, ::bright::int64 hp, ::bright::int32 energy_limit, ::bright::int32 energy_resume ) : item::ItemExtra(id) { this->attack = attack; this->hp = hp; this->energyLimit = energy_limit; this->energyResume = energy_resume; } virtual ~Clothes() {} bool deserialize(ByteBuf& _buf); ::bright::int32 attack; ::bright::int64 hp; ::bright::int32 energyLimit; ::bright::int32 energyResume; static constexpr int __ID__ = 1659907149; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace item { class DesignDrawing : public item::ItemExtra { public: static bool deserializeDesignDrawing(ByteBuf& _buf, ::bright::SharedPtr<DesignDrawing>& _out); DesignDrawing() { } DesignDrawing(::bright::int32 id, ::bright::Vector<::bright::int32> learn_component_id ) : item::ItemExtra(id) { this->learnComponentId = learn_component_id; } virtual ~DesignDrawing() {} bool deserialize(ByteBuf& _buf); ::bright::Vector<::bright::int32> learnComponentId; static constexpr int __ID__ = -1679179579; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace item { class Dymmy : public item::ItemExtra { public: static bool deserializeDymmy(ByteBuf& _buf, ::bright::SharedPtr<Dymmy>& _out); Dymmy() { } Dymmy(::bright::int32 id, ::bright::SharedPtr<cost::Cost> cost ) : item::ItemExtra(id) { this->cost = cost; } virtual ~Dymmy() {} bool deserialize(ByteBuf& _buf); ::bright::SharedPtr<cost::Cost> cost; static constexpr int __ID__ = 896889705; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace cost { class Cost : public bright::CfgBean { public: static bool deserializeCost(ByteBuf& _buf, ::bright::SharedPtr<Cost>& _out); Cost() { } virtual ~Cost() {} bool deserialize(ByteBuf& _buf); virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace cost { class CostCurrency : public cost::Cost { public: static bool deserializeCostCurrency(ByteBuf& _buf, ::bright::SharedPtr<CostCurrency>& _out); CostCurrency() { } CostCurrency(item::ECurrencyType type, ::bright::int32 num ) : cost::Cost() { this->type = type; this->num = num; } virtual ~CostCurrency() {} bool deserialize(ByteBuf& _buf); item::ECurrencyType type; ::bright::int32 num; static constexpr int __ID__ = 911838111; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace cost { class CostCurrencies : public cost::Cost { public: static bool deserializeCostCurrencies(ByteBuf& _buf, ::bright::SharedPtr<CostCurrencies>& _out); CostCurrencies() { } CostCurrencies(::bright::Vector<::bright::SharedPtr<cost::CostCurrency>> currencies ) : cost::Cost() { this->currencies = currencies; } virtual ~CostCurrencies() {} bool deserialize(ByteBuf& _buf); ::bright::Vector<::bright::SharedPtr<cost::CostCurrency>> currencies; static constexpr int __ID__ = 103084157; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace cost { class CostOneItem : public cost::Cost { public: static bool deserializeCostOneItem(ByteBuf& _buf, ::bright::SharedPtr<CostOneItem>& _out); CostOneItem() { } CostOneItem(::bright::int32 item_id ) : cost::Cost() { this->itemId = item_id; } virtual ~CostOneItem() {} bool deserialize(ByteBuf& _buf); ::bright::int32 itemId; ::bright::SharedPtr<item::Item> itemId_Ref; static constexpr int __ID__ = -1033587381; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace cost { class CostItem : public cost::Cost { public: static bool deserializeCostItem(ByteBuf& _buf, ::bright::SharedPtr<CostItem>& _out); CostItem() { } CostItem(::bright::int32 item_id, ::bright::int32 amount ) : cost::Cost() { this->itemId = item_id; this->amount = amount; } virtual ~CostItem() {} bool deserialize(ByteBuf& _buf); ::bright::int32 itemId; ::bright::SharedPtr<item::Item> itemId_Ref; ::bright::int32 amount; static constexpr int __ID__ = -1249440351; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace cost { class CostItems : public cost::Cost { public: static bool deserializeCostItems(ByteBuf& _buf, ::bright::SharedPtr<CostItems>& _out); CostItems() { } CostItems(::bright::Vector<::bright::SharedPtr<cost::CostItem>> item_list ) : cost::Cost() { this->itemList = item_list; } virtual ~CostItems() {} bool deserialize(ByteBuf& _buf); ::bright::Vector<::bright::SharedPtr<cost::CostItem>> itemList; static constexpr int __ID__ = -77945102; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace l10n { class L10NDemo : public bright::CfgBean { public: static bool deserializeL10NDemo(ByteBuf& _buf, ::bright::SharedPtr<L10NDemo>& _out); L10NDemo() { } L10NDemo(::bright::int32 id, ::bright::String text ) { this->id = id; this->text = text; } virtual ~L10NDemo() {} bool deserialize(ByteBuf& _buf); ::bright::int32 id; ::bright::String text; static constexpr int __ID__ = -331195887; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace l10n { class PatchDemo : public bright::CfgBean { public: static bool deserializePatchDemo(ByteBuf& _buf, ::bright::SharedPtr<PatchDemo>& _out); PatchDemo() { } PatchDemo(::bright::int32 id, ::bright::int32 value ) { this->id = id; this->value = value; } virtual ~PatchDemo() {} bool deserialize(ByteBuf& _buf); ::bright::int32 id; ::bright::int32 value; static constexpr int __ID__ = -1707294656; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace mail { class SystemMail : public bright::CfgBean { public: static bool deserializeSystemMail(ByteBuf& _buf, ::bright::SharedPtr<SystemMail>& _out); SystemMail() { } SystemMail(::bright::int32 id, ::bright::String title, ::bright::String sender, ::bright::String content, ::bright::Vector<::bright::int32> award ) { this->id = id; this->title = title; this->sender = sender; this->content = content; this->award = award; } virtual ~SystemMail() {} bool deserialize(ByteBuf& _buf); ::bright::int32 id; ::bright::String title; ::bright::String sender; ::bright::String content; ::bright::Vector<::bright::int32> award; static constexpr int __ID__ = 1214073149; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace mail { class GlobalMail : public bright::CfgBean { public: static bool deserializeGlobalMail(ByteBuf& _buf, ::bright::SharedPtr<GlobalMail>& _out); GlobalMail() { } GlobalMail(::bright::int32 id, ::bright::String title, ::bright::String sender, ::bright::String content, ::bright::Vector<::bright::int32> award, bool all_server, ::bright::Vector<::bright::int32> server_list, ::bright::String platform, ::bright::String channel, ::bright::SharedPtr<condition::MinMaxLevel> min_max_level, ::bright::SharedPtr<condition::TimeRange> register_time, ::bright::SharedPtr<condition::TimeRange> mail_time ) { this->id = id; this->title = title; this->sender = sender; this->content = content; this->award = award; this->allServer = all_server; this->serverList = server_list; this->platform = platform; this->channel = channel; this->minMaxLevel = min_max_level; this->registerTime = register_time; this->mailTime = mail_time; } virtual ~GlobalMail() {} bool deserialize(ByteBuf& _buf); ::bright::int32 id; ::bright::String title; ::bright::String sender; ::bright::String content; ::bright::Vector<::bright::int32> award; bool allServer; ::bright::Vector<::bright::int32> serverList; ::bright::String platform; ::bright::String channel; ::bright::SharedPtr<condition::MinMaxLevel> minMaxLevel; ::bright::SharedPtr<condition::TimeRange> registerTime; ::bright::SharedPtr<condition::TimeRange> mailTime; static constexpr int __ID__ = -287571791; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace role { class LevelExpAttr : public bright::CfgBean { public: static bool deserializeLevelExpAttr(ByteBuf& _buf, ::bright::SharedPtr<LevelExpAttr>& _out); LevelExpAttr() { } LevelExpAttr(::bright::int32 level, ::bright::int64 need_exp, ::bright::Vector<::bright::int32> clothes_attrs ) { this->level = level; this->needExp = need_exp; this->clothesAttrs = clothes_attrs; } virtual ~LevelExpAttr() {} bool deserialize(ByteBuf& _buf); ::bright::int32 level; ::bright::int64 needExp; ::bright::Vector<::bright::int32> clothesAttrs; static constexpr int __ID__ = -1569837022; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace role { class LevelBonus : public bright::CfgBean { public: static bool deserializeLevelBonus(ByteBuf& _buf, ::bright::SharedPtr<LevelBonus>& _out); LevelBonus() { } LevelBonus(::bright::int32 id, ::bright::Vector<::bright::SharedPtr<role::DistinctBonusInfos>> distinct_bonus_infos ) { this->id = id; this->distinctBonusInfos = distinct_bonus_infos; } virtual ~LevelBonus() {} bool deserialize(ByteBuf& _buf); ::bright::int32 id; ::bright::Vector<::bright::SharedPtr<role::DistinctBonusInfos>> distinctBonusInfos; static constexpr int __ID__ = -572269677; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace role { class DistinctBonusInfos : public bright::CfgBean { public: static bool deserializeDistinctBonusInfos(ByteBuf& _buf, ::bright::SharedPtr<DistinctBonusInfos>& _out); DistinctBonusInfos() { } DistinctBonusInfos(::bright::int32 effective_level, ::bright::Vector<::bright::SharedPtr<role::BonusInfo>> bonus_info ) { this->effectiveLevel = effective_level; this->bonusInfo = bonus_info; } virtual ~DistinctBonusInfos() {} bool deserialize(ByteBuf& _buf); ::bright::int32 effectiveLevel; ::bright::Vector<::bright::SharedPtr<role::BonusInfo>> bonusInfo; static constexpr int __ID__ = -854361766; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace role { class BonusInfo : public bright::CfgBean { public: static bool deserializeBonusInfo(ByteBuf& _buf, ::bright::SharedPtr<BonusInfo>& _out); BonusInfo() { } BonusInfo(item::ECurrencyType type, ::bright::float32 coefficient ) { this->type = type; this->coefficient = coefficient; } virtual ~BonusInfo() {} bool deserialize(ByteBuf& _buf); item::ECurrencyType type; ::bright::float32 coefficient; static constexpr int __ID__ = -1354421803; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace tag { class TestTag : public bright::CfgBean { public: static bool deserializeTestTag(ByteBuf& _buf, ::bright::SharedPtr<TestTag>& _out); TestTag() { } TestTag(::bright::int32 id, ::bright::String value ) { this->id = id; this->value = value; } virtual ~TestTag() {} bool deserialize(ByteBuf& _buf); ::bright::int32 id; ::bright::String value; static constexpr int __ID__ = 1742933812; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace test { class DemoType2 : public bright::CfgBean { public: static bool deserializeDemoType2(ByteBuf& _buf, ::bright::SharedPtr<DemoType2>& _out); DemoType2() { } DemoType2(::bright::int32 x4, bool x1, ::bright::byte x2, ::bright::int16 x3, ::bright::int64 x5, ::bright::float32 x6, ::bright::float64 x7, ::bright::int16 x8_0, ::bright::int32 x8, ::bright::int64 x9, ::bright::String x10, ::bright::SharedPtr<test::DemoType1> x12, test::DemoEnum x13, ::bright::SharedPtr<test::DemoDynamic> x14, ::bright::String s1, ::bright::Vector2 v2, ::bright::Vector3 v3, ::bright::Vector4 v4, ::bright::datetime t1, ::bright::Vector<::bright::int32> k1, ::bright::Vector<::bright::int32> k2, ::bright::HashSet<::bright::int32> k5, ::bright::HashMap<::bright::int32, ::bright::int32> k8, ::bright::Vector<::bright::SharedPtr<test::DemoE2>> k9, ::bright::Vector<::bright::SharedPtr<test::DemoDynamic>> k15 ) { this->x4 = x4; this->x1 = x1; this->x2 = x2; this->x3 = x3; this->x5 = x5; this->x6 = x6; this->x7 = x7; this->x80 = x8_0; this->x8 = x8; this->x9 = x9; this->x10 = x10; this->x12 = x12; this->x13 = x13; this->x14 = x14; this->s1 = s1; this->v2 = v2; this->v3 = v3; this->v4 = v4; this->t1 = t1; this->k1 = k1; this->k2 = k2; this->k5 = k5; this->k8 = k8; this->k9 = k9; this->k15 = k15; } virtual ~DemoType2() {} bool deserialize(ByteBuf& _buf); ::bright::int32 x4; bool x1; ::bright::byte x2; ::bright::int16 x3; ::bright::int64 x5; ::bright::float32 x6; ::bright::float64 x7; ::bright::int16 x80; ::bright::int32 x8; ::bright::int64 x9; ::bright::String x10; ::bright::SharedPtr<test::DemoType1> x12; test::DemoEnum x13; ::bright::SharedPtr<test::DemoDynamic> x14; ::bright::String s1; ::bright::Vector2 v2; ::bright::Vector3 v3; ::bright::Vector4 v4; ::bright::datetime t1; ::bright::Vector<::bright::int32> k1; ::bright::Vector<::bright::int32> k2; ::bright::HashSet<::bright::int32> k5; ::bright::HashMap<::bright::int32, ::bright::int32> k8; ::bright::Vector<::bright::SharedPtr<test::DemoE2>> k9; ::bright::Vector<::bright::SharedPtr<test::DemoDynamic>> k15; static constexpr int __ID__ = -367048295; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace test { class DemoType1 : public bright::CfgBean { public: static bool deserializeDemoType1(ByteBuf& _buf, ::bright::SharedPtr<DemoType1>& _out); DemoType1() { } DemoType1(::bright::int32 x1 ) { this->x1 = x1; } virtual ~DemoType1() {} bool deserialize(ByteBuf& _buf); ::bright::int32 x1; static constexpr int __ID__ = -367048296; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace test { class DemoDynamic : public bright::CfgBean { public: static bool deserializeDemoDynamic(ByteBuf& _buf, ::bright::SharedPtr<DemoDynamic>& _out); DemoDynamic() { } DemoDynamic(::bright::int32 x1 ) { this->x1 = x1; } virtual ~DemoDynamic() {} bool deserialize(ByteBuf& _buf); ::bright::int32 x1; virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace test { class DemoD2 : public test::DemoDynamic { public: static bool deserializeDemoD2(ByteBuf& _buf, ::bright::SharedPtr<DemoD2>& _out); DemoD2() { } DemoD2(::bright::int32 x1, ::bright::int32 x2 ) : test::DemoDynamic(x1) { this->x2 = x2; } virtual ~DemoD2() {} bool deserialize(ByteBuf& _buf); ::bright::int32 x2; static constexpr int __ID__ = -2138341747; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace test { class DemoD3 : public test::DemoDynamic { public: static bool deserializeDemoD3(ByteBuf& _buf, ::bright::SharedPtr<DemoD3>& _out); DemoD3() { } DemoD3(::bright::int32 x1, ::bright::int32 x3 ) : test::DemoDynamic(x1) { this->x3 = x3; } virtual ~DemoD3() {} bool deserialize(ByteBuf& _buf); ::bright::int32 x3; virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace test { class DemoE1 : public test::DemoD3 { public: static bool deserializeDemoE1(ByteBuf& _buf, ::bright::SharedPtr<DemoE1>& _out); DemoE1() { } DemoE1(::bright::int32 x1, ::bright::int32 x3, ::bright::int32 x4 ) : test::DemoD3(x1, x3) { this->x4 = x4; } virtual ~DemoE1() {} bool deserialize(ByteBuf& _buf); ::bright::int32 x4; static constexpr int __ID__ = -2138341717; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace test { class DemoD5 : public test::DemoDynamic { public: static bool deserializeDemoD5(ByteBuf& _buf, ::bright::SharedPtr<DemoD5>& _out); DemoD5() { } DemoD5(::bright::int32 x1, ::bright::SharedPtr<test::DateTimeRange> time ) : test::DemoDynamic(x1) { this->time = time; } virtual ~DemoD5() {} bool deserialize(ByteBuf& _buf); ::bright::SharedPtr<test::DateTimeRange> time; static constexpr int __ID__ = -2138341744; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace test { class DateTimeRange : public bright::CfgBean { public: static bool deserializeDateTimeRange(ByteBuf& _buf, ::bright::SharedPtr<DateTimeRange>& _out); DateTimeRange() { } DateTimeRange(::bright::datetime start_time, ::bright::datetime end_time ) { this->startTime = start_time; this->endTime = end_time; } virtual ~DateTimeRange() {} bool deserialize(ByteBuf& _buf); ::bright::datetime startTime; ::bright::datetime endTime; static constexpr int __ID__ = 495315430; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace test { class DemoE2 : public bright::CfgBean { public: static bool deserializeDemoE2(ByteBuf& _buf, ::bright::SharedPtr<DemoE2>& _out); DemoE2() { } DemoE2(::bright::SharedPtr<::bright::int32> y1, bool y2 ) { this->y1 = y1; this->y2 = y2; } virtual ~DemoE2() {} bool deserialize(ByteBuf& _buf); ::bright::SharedPtr<::bright::int32> y1; bool y2; static constexpr int __ID__ = -2138341716; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace test { class DemoSingletonType : public bright::CfgBean { public: static bool deserializeDemoSingletonType(ByteBuf& _buf, ::bright::SharedPtr<DemoSingletonType>& _out); DemoSingletonType() { } DemoSingletonType(::bright::int32 id, ::bright::String name, ::bright::SharedPtr<test::DemoDynamic> date ) { this->id = id; this->name = name; this->date = date; } virtual ~DemoSingletonType() {} bool deserialize(ByteBuf& _buf); ::bright::int32 id; ::bright::String name; ::bright::SharedPtr<test::DemoDynamic> date; static constexpr int __ID__ = 539196998; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace test { class NotIndexList : public bright::CfgBean { public: static bool deserializeNotIndexList(ByteBuf& _buf, ::bright::SharedPtr<NotIndexList>& _out); NotIndexList() { } NotIndexList(::bright::int32 x, ::bright::int32 y ) { this->x = x; this->y = y; } virtual ~NotIndexList() {} bool deserialize(ByteBuf& _buf); ::bright::int32 x; ::bright::int32 y; static constexpr int __ID__ = -50446599; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace test { class MultiUnionIndexList : public bright::CfgBean { public: static bool deserializeMultiUnionIndexList(ByteBuf& _buf, ::bright::SharedPtr<MultiUnionIndexList>& _out); MultiUnionIndexList() { } MultiUnionIndexList(::bright::int32 id1, ::bright::int64 id2, ::bright::String id3, ::bright::int32 num, ::bright::String desc ) { this->id1 = id1; this->id2 = id2; this->id3 = id3; this->num = num; this->desc = desc; } virtual ~MultiUnionIndexList() {} bool deserialize(ByteBuf& _buf); ::bright::int32 id1; ::bright::int64 id2; ::bright::String id3; ::bright::int32 num; ::bright::String desc; static constexpr int __ID__ = 1966847134; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace test { class MultiIndexList : public bright::CfgBean { public: static bool deserializeMultiIndexList(ByteBuf& _buf, ::bright::SharedPtr<MultiIndexList>& _out); MultiIndexList() { } MultiIndexList(::bright::int32 id1, ::bright::int64 id2, ::bright::String id3, ::bright::int32 num, ::bright::String desc ) { this->id1 = id1; this->id2 = id2; this->id3 = id3; this->num = num; this->desc = desc; } virtual ~MultiIndexList() {} bool deserialize(ByteBuf& _buf); ::bright::int32 id1; ::bright::int64 id2; ::bright::String id3; ::bright::int32 num; ::bright::String desc; static constexpr int __ID__ = 2016237651; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace test { class MultiRowRecord : public bright::CfgBean { public: static bool deserializeMultiRowRecord(ByteBuf& _buf, ::bright::SharedPtr<MultiRowRecord>& _out); MultiRowRecord() { } MultiRowRecord(::bright::int32 id, ::bright::String name, ::bright::Vector<::bright::SharedPtr<test::MultiRowType1>> one_rows, ::bright::Vector<::bright::SharedPtr<test::MultiRowType1>> multi_rows1, ::bright::Vector<::bright::SharedPtr<test::MultiRowType1>> multi_rows2, ::bright::HashMap<::bright::int32, ::bright::SharedPtr<test::MultiRowType2>> multi_rows4, ::bright::Vector<::bright::SharedPtr<test::MultiRowType3>> multi_rows5, ::bright::HashMap<::bright::int32, ::bright::SharedPtr<test::MultiRowType2>> multi_rows6, ::bright::HashMap<::bright::int32, ::bright::int32> multi_rows7 ) { this->id = id; this->name = name; this->oneRows = one_rows; this->multiRows1 = multi_rows1; this->multiRows2 = multi_rows2; this->multiRows4 = multi_rows4; this->multiRows5 = multi_rows5; this->multiRows6 = multi_rows6; this->multiRows7 = multi_rows7; } virtual ~MultiRowRecord() {} bool deserialize(ByteBuf& _buf); ::bright::int32 id; ::bright::String name; ::bright::Vector<::bright::SharedPtr<test::MultiRowType1>> oneRows; ::bright::Vector<::bright::SharedPtr<test::MultiRowType1>> multiRows1; ::bright::Vector<::bright::SharedPtr<test::MultiRowType1>> multiRows2; ::bright::HashMap<::bright::int32, ::bright::SharedPtr<test::MultiRowType2>> multiRows4; ::bright::Vector<::bright::SharedPtr<test::MultiRowType3>> multiRows5; ::bright::HashMap<::bright::int32, ::bright::SharedPtr<test::MultiRowType2>> multiRows6; ::bright::HashMap<::bright::int32, ::bright::int32> multiRows7; static constexpr int __ID__ = -501249394; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace test { class MultiRowType1 : public bright::CfgBean { public: static bool deserializeMultiRowType1(ByteBuf& _buf, ::bright::SharedPtr<MultiRowType1>& _out); MultiRowType1() { } MultiRowType1(::bright::int32 id, ::bright::int32 x ) { this->id = id; this->x = x; } virtual ~MultiRowType1() {} bool deserialize(ByteBuf& _buf); ::bright::int32 id; ::bright::int32 x; static constexpr int __ID__ = 540474970; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace test { class MultiRowType2 : public bright::CfgBean { public: static bool deserializeMultiRowType2(ByteBuf& _buf, ::bright::SharedPtr<MultiRowType2>& _out); MultiRowType2() { } MultiRowType2(::bright::int32 id, ::bright::int32 x, ::bright::float32 y ) { this->id = id; this->x = x; this->y = y; } virtual ~MultiRowType2() {} bool deserialize(ByteBuf& _buf); ::bright::int32 id; ::bright::int32 x; ::bright::float32 y; static constexpr int __ID__ = 540474971; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace test { class MultiRowType3 : public bright::CfgBean { public: static bool deserializeMultiRowType3(ByteBuf& _buf, ::bright::SharedPtr<MultiRowType3>& _out); MultiRowType3() { } MultiRowType3(::bright::int32 id, ::bright::Vector<::bright::SharedPtr<test::MultiRowType1>> items ) { this->id = id; this->items = items; } virtual ~MultiRowType3() {} bool deserialize(ByteBuf& _buf); ::bright::int32 id; ::bright::Vector<::bright::SharedPtr<test::MultiRowType1>> items; static constexpr int __ID__ = 540474972; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace test { class MultiRowTitle : public bright::CfgBean { public: static bool deserializeMultiRowTitle(ByteBuf& _buf, ::bright::SharedPtr<MultiRowTitle>& _out); MultiRowTitle() { } MultiRowTitle(::bright::int32 id, ::bright::String name, ::bright::SharedPtr<test::H1> x1, ::bright::SharedPtr<test::H2> x2_0, ::bright::Vector<::bright::SharedPtr<test::H2>> x2, ::bright::Vector<::bright::SharedPtr<test::H2>> x3, ::bright::Vector<::bright::SharedPtr<test::H2>> x4 ) { this->id = id; this->name = name; this->x1 = x1; this->x20 = x2_0; this->x2 = x2; this->x3 = x3; this->x4 = x4; } virtual ~MultiRowTitle() {} bool deserialize(ByteBuf& _buf); ::bright::int32 id; ::bright::String name; ::bright::SharedPtr<test::H1> x1; ::bright::SharedPtr<test::H2> x20; ::bright::Vector<::bright::SharedPtr<test::H2>> x2; ::bright::Vector<::bright::SharedPtr<test::H2>> x3; ::bright::Vector<::bright::SharedPtr<test::H2>> x4; static constexpr int __ID__ = 540002427; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace test { class H1 : public bright::CfgBean { public: static bool deserializeH1(ByteBuf& _buf, ::bright::SharedPtr<H1>& _out); H1() { } H1(::bright::SharedPtr<test::H2> y2, ::bright::int32 y3 ) { this->y2 = y2; this->y3 = y3; } virtual ~H1() {} bool deserialize(ByteBuf& _buf); ::bright::SharedPtr<test::H2> y2; ::bright::int32 y3; static constexpr int __ID__ = -1422503995; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace test { class H2 : public bright::CfgBean { public: static bool deserializeH2(ByteBuf& _buf, ::bright::SharedPtr<H2>& _out); H2() { } H2(::bright::int32 z2, ::bright::int32 z3 ) { this->z2 = z2; this->z3 = z3; } virtual ~H2() {} bool deserialize(ByteBuf& _buf); ::bright::int32 z2; ::bright::int32 z3; static constexpr int __ID__ = -1422503994; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace test { class TestNull : public bright::CfgBean { public: static bool deserializeTestNull(ByteBuf& _buf, ::bright::SharedPtr<TestNull>& _out); TestNull() { } TestNull(::bright::int32 id, ::bright::SharedPtr<::bright::int32> x1, ::bright::SharedPtr<test::DemoEnum> x2, ::bright::SharedPtr<test::DemoType1> x3, ::bright::SharedPtr<test::DemoDynamic> x4, ::bright::SharedPtr<::bright::String> s1, ::bright::SharedPtr<::bright::String> s2 ) { this->id = id; this->x1 = x1; this->x2 = x2; this->x3 = x3; this->x4 = x4; this->s1 = s1; this->s2 = s2; } virtual ~TestNull() {} bool deserialize(ByteBuf& _buf); ::bright::int32 id; ::bright::SharedPtr<::bright::int32> x1; ::bright::SharedPtr<test::DemoEnum> x2; ::bright::SharedPtr<test::DemoType1> x3; ::bright::SharedPtr<test::DemoDynamic> x4; ::bright::SharedPtr<::bright::String> s1; ::bright::SharedPtr<::bright::String> s2; static constexpr int __ID__ = 339868469; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace test { class DemoPrimitiveTypesTable : public bright::CfgBean { public: static bool deserializeDemoPrimitiveTypesTable(ByteBuf& _buf, ::bright::SharedPtr<DemoPrimitiveTypesTable>& _out); DemoPrimitiveTypesTable() { } DemoPrimitiveTypesTable(bool x1, ::bright::byte x2, ::bright::int16 x3, ::bright::int32 x4, ::bright::int64 x5, ::bright::float32 x6, ::bright::float64 x7, ::bright::String s1, ::bright::String s2, ::bright::Vector2 v2, ::bright::Vector3 v3, ::bright::Vector4 v4, ::bright::datetime t1 ) { this->x1 = x1; this->x2 = x2; this->x3 = x3; this->x4 = x4; this->x5 = x5; this->x6 = x6; this->x7 = x7; this->s1 = s1; this->s2 = s2; this->v2 = v2; this->v3 = v3; this->v4 = v4; this->t1 = t1; } virtual ~DemoPrimitiveTypesTable() {} bool deserialize(ByteBuf& _buf); bool x1; ::bright::byte x2; ::bright::int16 x3; ::bright::int32 x4; ::bright::int64 x5; ::bright::float32 x6; ::bright::float64 x7; ::bright::String s1; ::bright::String s2; ::bright::Vector2 v2; ::bright::Vector3 v3; ::bright::Vector4 v4; ::bright::datetime t1; static constexpr int __ID__ = -370934083; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace test { class TestString : public bright::CfgBean { public: static bool deserializeTestString(ByteBuf& _buf, ::bright::SharedPtr<TestString>& _out); TestString() { } TestString(::bright::int32 id, ::bright::String s1, ::bright::SharedPtr<test::CompactString> cs1, ::bright::SharedPtr<test::CompactString> cs2 ) { this->id = id; this->s1 = s1; this->cs1 = cs1; this->cs2 = cs2; } virtual ~TestString() {} bool deserialize(ByteBuf& _buf); ::bright::int32 id; ::bright::String s1; ::bright::SharedPtr<test::CompactString> cs1; ::bright::SharedPtr<test::CompactString> cs2; static constexpr int __ID__ = 338485823; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace test { class CompactString : public bright::CfgBean { public: static bool deserializeCompactString(ByteBuf& _buf, ::bright::SharedPtr<CompactString>& _out); CompactString() { } CompactString(::bright::int32 id, ::bright::String s2, ::bright::String s3 ) { this->id = id; this->s2 = s2; this->s3 = s3; } virtual ~CompactString() {} bool deserialize(ByteBuf& _buf); ::bright::int32 id; ::bright::String s2; ::bright::String s3; static constexpr int __ID__ = 1968089240; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace test { class DemoGroup : public bright::CfgBean { public: static bool deserializeDemoGroup(ByteBuf& _buf, ::bright::SharedPtr<DemoGroup>& _out); DemoGroup() { } DemoGroup(::bright::int32 id, ::bright::int32 x1, ::bright::int32 x2, ::bright::int32 x3, ::bright::int32 x4, ::bright::SharedPtr<test::InnerGroup> x5 ) { this->id = id; this->x1 = x1; this->x2 = x2; this->x3 = x3; this->x4 = x4; this->x5 = x5; } virtual ~DemoGroup() {} bool deserialize(ByteBuf& _buf); ::bright::int32 id; ::bright::int32 x1; ::bright::SharedPtr<test::DemoGroup> x1_Ref; ::bright::int32 x2; ::bright::SharedPtr<test::DemoGroup> x2_Ref; ::bright::int32 x3; ::bright::SharedPtr<test::DemoGroup> x3_Ref; ::bright::int32 x4; ::bright::SharedPtr<test::InnerGroup> x5; static constexpr int __ID__ = -379263008; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace test { class InnerGroup : public bright::CfgBean { public: static bool deserializeInnerGroup(ByteBuf& _buf, ::bright::SharedPtr<InnerGroup>& _out); InnerGroup() { } InnerGroup(::bright::int32 y1, ::bright::int32 y2, ::bright::int32 y3, ::bright::int32 y4 ) { this->y1 = y1; this->y2 = y2; this->y3 = y3; this->y4 = y4; } virtual ~InnerGroup() {} bool deserialize(ByteBuf& _buf); ::bright::int32 y1; ::bright::int32 y2; ::bright::int32 y3; ::bright::int32 y4; static constexpr int __ID__ = -587873083; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace test { class TestGlobal : public bright::CfgBean { public: static bool deserializeTestGlobal(ByteBuf& _buf, ::bright::SharedPtr<TestGlobal>& _out); TestGlobal() { } TestGlobal(::bright::int32 unlock_equip, ::bright::int32 unlock_hero ) { this->unlockEquip = unlock_equip; this->unlockHero = unlock_hero; } virtual ~TestGlobal() {} bool deserialize(ByteBuf& _buf); ::bright::int32 unlockEquip; ::bright::int32 unlockHero; static constexpr int __ID__ = -12548655; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace test { class TestBeRef : public bright::CfgBean { public: static bool deserializeTestBeRef(ByteBuf& _buf, ::bright::SharedPtr<TestBeRef>& _out); TestBeRef() { } TestBeRef(::bright::int32 id, ::bright::int32 count ) { this->id = id; this->count = count; } virtual ~TestBeRef() {} bool deserialize(ByteBuf& _buf); ::bright::int32 id; ::bright::int32 count; static constexpr int __ID__ = 1934403938; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace test { class TestRef : public bright::CfgBean { public: static bool deserializeTestRef(ByteBuf& _buf, ::bright::SharedPtr<TestRef>& _out); TestRef() { } TestRef(::bright::int32 id, ::bright::int32 x1, ::bright::int32 x1_2, ::bright::int32 x2, ::bright::int32 x3, ::bright::Vector<::bright::int32> a1, ::bright::Vector<::bright::int32> a2, ::bright::Vector<::bright::int32> b1, ::bright::Vector<::bright::int32> b2, ::bright::HashSet<::bright::int32> c1, ::bright::HashSet<::bright::int32> c2, ::bright::HashMap<::bright::int32, ::bright::int32> d1, ::bright::HashMap<::bright::int32, ::bright::int32> d2, ::bright::int32 e1, ::bright::int64 e2, ::bright::String e3, ::bright::int32 f1, ::bright::int64 f2, ::bright::String f3 ) { this->id = id; this->x1 = x1; this->x12 = x1_2; this->x2 = x2; this->x3 = x3; this->a1 = a1; this->a2 = a2; this->b1 = b1; this->b2 = b2; this->c1 = c1; this->c2 = c2; this->d1 = d1; this->d2 = d2; this->e1 = e1; this->e2 = e2; this->e3 = e3; this->f1 = f1; this->f2 = f2; this->f3 = f3; } virtual ~TestRef() {} bool deserialize(ByteBuf& _buf); ::bright::int32 id; ::bright::int32 x1; ::bright::SharedPtr<test::TestBeRef> x1_Ref; ::bright::int32 x12; ::bright::int32 x2; ::bright::SharedPtr<test::TestBeRef> x2_Ref; ::bright::int32 x3; ::bright::Vector<::bright::int32> a1; ::bright::Vector<::bright::int32> a2; ::bright::Vector<::bright::int32> b1; ::bright::Vector<::bright::int32> b2; ::bright::HashSet<::bright::int32> c1; ::bright::HashSet<::bright::int32> c2; ::bright::HashMap<::bright::int32, ::bright::int32> d1; ::bright::HashMap<::bright::int32, ::bright::int32> d2; ::bright::int32 e1; ::bright::int64 e2; ::bright::String e3; ::bright::int32 f1; ::bright::int64 f2; ::bright::String f3; static constexpr int __ID__ = -543222491; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace test { class TestSize : public bright::CfgBean { public: static bool deserializeTestSize(ByteBuf& _buf, ::bright::SharedPtr<TestSize>& _out); TestSize() { } TestSize(::bright::int32 id, ::bright::Vector<::bright::int32> x1, ::bright::Vector<::bright::int32> x2, ::bright::HashSet<::bright::int32> x3, ::bright::HashMap<::bright::int32, ::bright::int32> x4 ) { this->id = id; this->x1 = x1; this->x2 = x2; this->x3 = x3; this->x4 = x4; } virtual ~TestSize() {} bool deserialize(ByteBuf& _buf); ::bright::int32 id; ::bright::Vector<::bright::int32> x1; ::bright::Vector<::bright::int32> x2; ::bright::HashSet<::bright::int32> x3; ::bright::HashMap<::bright::int32, ::bright::int32> x4; static constexpr int __ID__ = 340006319; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace test { class TestSet : public bright::CfgBean { public: static bool deserializeTestSet(ByteBuf& _buf, ::bright::SharedPtr<TestSet>& _out); TestSet() { } TestSet(::bright::int32 id, ::bright::Vector<::bright::int32> x1, ::bright::Vector<::bright::int64> x2, ::bright::Vector<::bright::String> x3, ::bright::Vector<test::DemoEnum> x4 ) { this->id = id; this->x1 = x1; this->x2 = x2; this->x3 = x3; this->x4 = x4; } virtual ~TestSet() {} bool deserialize(ByteBuf& _buf); ::bright::int32 id; ::bright::Vector<::bright::int32> x1; ::bright::Vector<::bright::int64> x2; ::bright::Vector<::bright::String> x3; ::bright::Vector<test::DemoEnum> x4; static constexpr int __ID__ = -543221516; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace test { class DetectEncoding : public bright::CfgBean { public: static bool deserializeDetectEncoding(ByteBuf& _buf, ::bright::SharedPtr<DetectEncoding>& _out); DetectEncoding() { } DetectEncoding(::bright::int32 id, ::bright::String name ) { this->id = id; this->name = name; } virtual ~DetectEncoding() {} bool deserialize(ByteBuf& _buf); ::bright::int32 id; ::bright::String name; static constexpr int __ID__ = -1154609646; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace test { class DefineFromExcel : public bright::CfgBean { public: static bool deserializeDefineFromExcel(ByteBuf& _buf, ::bright::SharedPtr<DefineFromExcel>& _out); DefineFromExcel() { } DefineFromExcel(::bright::int32 id, bool x1, ::bright::int64 x5, ::bright::float32 x6, ::bright::int32 x8, ::bright::String x10, test::ETestQuality x13, ::bright::SharedPtr<test::DemoDynamic> x14, ::bright::Vector2 v2, ::bright::datetime t1, ::bright::Vector<::bright::int32> k1, ::bright::HashMap<::bright::int32, ::bright::int32> k8, ::bright::Vector<::bright::SharedPtr<test::DemoE2>> k9 ) { this->id = id; this->x1 = x1; this->x5 = x5; this->x6 = x6; this->x8 = x8; this->x10 = x10; this->x13 = x13; this->x14 = x14; this->v2 = v2; this->t1 = t1; this->k1 = k1; this->k8 = k8; this->k9 = k9; } virtual ~DefineFromExcel() {} bool deserialize(ByteBuf& _buf); /** * 这是id */ ::bright::int32 id; /** * 字段x1 */ bool x1; ::bright::int64 x5; ::bright::float32 x6; ::bright::int32 x8; ::bright::String x10; test::ETestQuality x13; ::bright::SharedPtr<test::DemoDynamic> x14; ::bright::Vector2 v2; ::bright::datetime t1; ::bright::Vector<::bright::int32> k1; ::bright::HashMap<::bright::int32, ::bright::int32> k8; ::bright::Vector<::bright::SharedPtr<test::DemoE2>> k9; static constexpr int __ID__ = 2100429878; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace test { class DefineFromExcelOne : public bright::CfgBean { public: static bool deserializeDefineFromExcelOne(ByteBuf& _buf, ::bright::SharedPtr<DefineFromExcelOne>& _out); DefineFromExcelOne() { } DefineFromExcelOne(::bright::int32 unlock_equip, ::bright::int32 unlock_hero, ::bright::String default_avatar, ::bright::String default_item ) { this->unlockEquip = unlock_equip; this->unlockHero = unlock_hero; this->defaultAvatar = default_avatar; this->defaultItem = default_item; } virtual ~DefineFromExcelOne() {} bool deserialize(ByteBuf& _buf); /** * 装备解锁等级 */ ::bright::int32 unlockEquip; /** * 英雄解锁等级 */ ::bright::int32 unlockHero; ::bright::String defaultAvatar; ::bright::String defaultItem; static constexpr int __ID__ = 528039504; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace test { class TestIndex : public bright::CfgBean { public: static bool deserializeTestIndex(ByteBuf& _buf, ::bright::SharedPtr<TestIndex>& _out); TestIndex() { } TestIndex(::bright::int32 id, ::bright::Vector<::bright::SharedPtr<test::DemoType1>> eles ) { this->id = id; this->eles = eles; } virtual ~TestIndex() {} bool deserialize(ByteBuf& _buf); ::bright::int32 id; ::bright::Vector<::bright::SharedPtr<test::DemoType1>> eles; static constexpr int __ID__ = 1941154020; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace test { class TestMap : public bright::CfgBean { public: static bool deserializeTestMap(ByteBuf& _buf, ::bright::SharedPtr<TestMap>& _out); TestMap() { } TestMap(::bright::int32 id, ::bright::HashMap<::bright::int32, ::bright::int32> x1, ::bright::HashMap<::bright::int64, ::bright::int32> x2, ::bright::HashMap<::bright::String, ::bright::int32> x3, ::bright::HashMap<test::DemoEnum, ::bright::int32> x4 ) { this->id = id; this->x1 = x1; this->x2 = x2; this->x3 = x3; this->x4 = x4; } virtual ~TestMap() {} bool deserialize(ByteBuf& _buf); ::bright::int32 id; ::bright::SharedPtr<test::TestIndex> id_Ref; ::bright::HashMap<::bright::int32, ::bright::int32> x1; ::bright::HashMap<::bright::int64, ::bright::int32> x2; ::bright::HashMap<::bright::String, ::bright::int32> x3; ::bright::HashMap<test::DemoEnum, ::bright::int32> x4; static constexpr int __ID__ = -543227410; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace test { class ExcelFromJson : public bright::CfgBean { public: static bool deserializeExcelFromJson(ByteBuf& _buf, ::bright::SharedPtr<ExcelFromJson>& _out); ExcelFromJson() { } ExcelFromJson(::bright::int32 x4, bool x1, ::bright::int64 x5, ::bright::float32 x6, ::bright::String s1, ::bright::String s2, ::bright::Vector2 v2, ::bright::Vector3 v3, ::bright::Vector4 v4, ::bright::datetime t1, ::bright::SharedPtr<test::DemoType1> x12, test::DemoEnum x13, ::bright::SharedPtr<test::DemoDynamic> x14, ::bright::Vector<::bright::int32> k1, ::bright::HashMap<::bright::int32, ::bright::int32> k8, ::bright::Vector<::bright::SharedPtr<test::DemoE2>> k9, ::bright::Vector<::bright::SharedPtr<test::DemoDynamic>> k15 ) { this->x4 = x4; this->x1 = x1; this->x5 = x5; this->x6 = x6; this->s1 = s1; this->s2 = s2; this->v2 = v2; this->v3 = v3; this->v4 = v4; this->t1 = t1; this->x12 = x12; this->x13 = x13; this->x14 = x14; this->k1 = k1; this->k8 = k8; this->k9 = k9; this->k15 = k15; } virtual ~ExcelFromJson() {} bool deserialize(ByteBuf& _buf); ::bright::int32 x4; bool x1; ::bright::int64 x5; ::bright::float32 x6; ::bright::String s1; ::bright::String s2; ::bright::Vector2 v2; ::bright::Vector3 v3; ::bright::Vector4 v4; ::bright::datetime t1; ::bright::SharedPtr<test::DemoType1> x12; test::DemoEnum x13; ::bright::SharedPtr<test::DemoDynamic> x14; ::bright::Vector<::bright::int32> k1; ::bright::HashMap<::bright::int32, ::bright::int32> k8; ::bright::Vector<::bright::SharedPtr<test::DemoE2>> k9; ::bright::Vector<::bright::SharedPtr<test::DemoDynamic>> k15; static constexpr int __ID__ = -1485706483; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace test { class CompositeJsonTable1 : public bright::CfgBean { public: static bool deserializeCompositeJsonTable1(ByteBuf& _buf, ::bright::SharedPtr<CompositeJsonTable1>& _out); CompositeJsonTable1() { } CompositeJsonTable1(::bright::int32 id, ::bright::String x ) { this->id = id; this->x = x; } virtual ~CompositeJsonTable1() {} bool deserialize(ByteBuf& _buf); ::bright::int32 id; ::bright::String x; static constexpr int __ID__ = 1566207894; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace test { class CompositeJsonTable2 : public bright::CfgBean { public: static bool deserializeCompositeJsonTable2(ByteBuf& _buf, ::bright::SharedPtr<CompositeJsonTable2>& _out); CompositeJsonTable2() { } CompositeJsonTable2(::bright::int32 id, ::bright::int32 y ) { this->id = id; this->y = y; } virtual ~CompositeJsonTable2() {} bool deserialize(ByteBuf& _buf); ::bright::int32 id; ::bright::int32 y; static constexpr int __ID__ = 1566207895; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace test { class CompositeJsonTable3 : public bright::CfgBean { public: static bool deserializeCompositeJsonTable3(ByteBuf& _buf, ::bright::SharedPtr<CompositeJsonTable3>& _out); CompositeJsonTable3() { } CompositeJsonTable3(::bright::int32 a, ::bright::int32 b ) { this->a = a; this->b = b; } virtual ~CompositeJsonTable3() {} bool deserialize(ByteBuf& _buf); ::bright::int32 a; ::bright::int32 b; static constexpr int __ID__ = 1566207896; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace test { class ExcelFromJsonMultiRow : public bright::CfgBean { public: static bool deserializeExcelFromJsonMultiRow(ByteBuf& _buf, ::bright::SharedPtr<ExcelFromJsonMultiRow>& _out); ExcelFromJsonMultiRow() { } ExcelFromJsonMultiRow(::bright::int32 id, ::bright::int32 x, ::bright::Vector<::bright::SharedPtr<test::TestRow>> items ) { this->id = id; this->x = x; this->items = items; } virtual ~ExcelFromJsonMultiRow() {} bool deserialize(ByteBuf& _buf); ::bright::int32 id; ::bright::int32 x; ::bright::Vector<::bright::SharedPtr<test::TestRow>> items; static constexpr int __ID__ = 715335694; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace test { class TestRow : public bright::CfgBean { public: static bool deserializeTestRow(ByteBuf& _buf, ::bright::SharedPtr<TestRow>& _out); TestRow() { } TestRow(::bright::int32 x, bool y, ::bright::String z, ::bright::SharedPtr<test::Test3> a, ::bright::Vector<::bright::int32> b ) { this->x = x; this->y = y; this->z = z; this->a = a; this->b = b; } virtual ~TestRow() {} bool deserialize(ByteBuf& _buf); ::bright::int32 x; bool y; ::bright::String z; ::bright::SharedPtr<test::Test3> a; ::bright::Vector<::bright::int32> b; static constexpr int __ID__ = -543222164; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace test { class Test3 : public bright::CfgBean { public: static bool deserializeTest3(ByteBuf& _buf, ::bright::SharedPtr<Test3>& _out); Test3() { } Test3(::bright::int32 x, ::bright::int32 y ) { this->x = x; this->y = y; } virtual ~Test3() {} bool deserialize(ByteBuf& _buf); ::bright::int32 x; ::bright::int32 y; static constexpr int __ID__ = 638540133; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace test { class TestSep : public bright::CfgBean { public: static bool deserializeTestSep(ByteBuf& _buf, ::bright::SharedPtr<TestSep>& _out); TestSep() { } TestSep(::bright::int32 id, ::bright::String x1, ::bright::SharedPtr<test::SepBean1> x2, ::bright::SharedPtr<test::SepVector> x3, ::bright::Vector<::bright::SharedPtr<test::SepVector>> x4, ::bright::Vector<::bright::SharedPtr<test::SepBean1>> x5, ::bright::Vector<::bright::SharedPtr<test::SepBean1>> x6 ) { this->id = id; this->x1 = x1; this->x2 = x2; this->x3 = x3; this->x4 = x4; this->x5 = x5; this->x6 = x6; } virtual ~TestSep() {} bool deserialize(ByteBuf& _buf); ::bright::int32 id; ::bright::String x1; ::bright::SharedPtr<test::SepBean1> x2; /** * SepVector已经定义了sep=,属性 */ ::bright::SharedPtr<test::SepVector> x3; /** * 用;来分割数据,然后顺序读入SepVector */ ::bright::Vector<::bright::SharedPtr<test::SepVector>> x4; /** * 用,分割数据,然后顺序读入 */ ::bright::Vector<::bright::SharedPtr<test::SepBean1>> x5; /** * 用;分割数据,然后再将每个数据用,分割,读入 */ ::bright::Vector<::bright::SharedPtr<test::SepBean1>> x6; static constexpr int __ID__ = -543221520; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace test { class SepBean1 : public bright::CfgBean { public: static bool deserializeSepBean1(ByteBuf& _buf, ::bright::SharedPtr<SepBean1>& _out); SepBean1() { } SepBean1(::bright::int32 a, ::bright::int32 b, ::bright::String c ) { this->a = a; this->b = b; this->c = c; } virtual ~SepBean1() {} bool deserialize(ByteBuf& _buf); ::bright::int32 a; ::bright::int32 b; ::bright::String c; static constexpr int __ID__ = -1534339393; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace test { class SepVector : public bright::CfgBean { public: static bool deserializeSepVector(ByteBuf& _buf, ::bright::SharedPtr<SepVector>& _out); SepVector() { } SepVector(::bright::int32 x, ::bright::int32 y, ::bright::int32 z ) { this->x = x; this->y = y; this->z = z; } virtual ~SepVector() {} bool deserialize(ByteBuf& _buf); ::bright::int32 x; ::bright::int32 y; ::bright::int32 z; static constexpr int __ID__ = 252769477; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace test { class TestExternalType : public bright::CfgBean { public: static bool deserializeTestExternalType(ByteBuf& _buf, ::bright::SharedPtr<TestExternalType>& _out); TestExternalType() { } TestExternalType(::bright::int32 id, test::AudioType audio_type, ::bright::SharedPtr<test::Color> color ) { this->id = id; this->audioType = audio_type; this->color = color; } virtual ~TestExternalType() {} bool deserialize(ByteBuf& _buf); ::bright::int32 id; test::AudioType audioType; ::bright::SharedPtr<test::Color> color; static constexpr int __ID__ = -990826157; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace test { class Color : public bright::CfgBean { public: static bool deserializeColor(ByteBuf& _buf, ::bright::SharedPtr<Color>& _out); Color() { } Color(::bright::float32 r, ::bright::float32 g, ::bright::float32 b, ::bright::float32 a ) { this->r = r; this->g = g; this->b = b; this->a = a; } virtual ~Color() {} bool deserialize(ByteBuf& _buf); ::bright::float32 r; ::bright::float32 g; ::bright::float32 b; ::bright::float32 a; static constexpr int __ID__ = 623131367; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace test { class DefineFromExcel2 : public bright::CfgBean { public: static bool deserializeDefineFromExcel2(ByteBuf& _buf, ::bright::SharedPtr<DefineFromExcel2>& _out); DefineFromExcel2() { } DefineFromExcel2(::bright::int32 id, bool x1, ::bright::int64 x5, ::bright::float32 x6, ::bright::int32 x8, ::bright::String x10, test::ETestQuality x13, ::bright::SharedPtr<test::DemoDynamic> x14, ::bright::Vector2 v2, ::bright::datetime t1, ::bright::Vector<::bright::int32> k1, ::bright::HashMap<::bright::int32, ::bright::int32> k8, ::bright::Vector<::bright::SharedPtr<test::DemoE2>> k9 ) { this->id = id; this->x1 = x1; this->x5 = x5; this->x6 = x6; this->x8 = x8; this->x10 = x10; this->x13 = x13; this->x14 = x14; this->v2 = v2; this->t1 = t1; this->k1 = k1; this->k8 = k8; this->k9 = k9; } virtual ~DefineFromExcel2() {} bool deserialize(ByteBuf& _buf); /** * 这是id */ ::bright::int32 id; /** * 字段x1 */ bool x1; ::bright::int64 x5; ::bright::float32 x6; ::bright::int32 x8; ::bright::String x10; test::ETestQuality x13; ::bright::SharedPtr<test::DemoDynamic> x14; ::bright::Vector2 v2; ::bright::datetime t1; ::bright::Vector<::bright::int32> k1; ::bright::HashMap<::bright::int32, ::bright::int32> k8; ::bright::Vector<::bright::SharedPtr<test::DemoE2>> k9; static constexpr int __ID__ = 688816828; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace test { /** * 这是个测试excel结构 */ class TestExcelBean1 : public bright::CfgBean { public: static bool deserializeTestExcelBean1(ByteBuf& _buf, ::bright::SharedPtr<TestExcelBean1>& _out); TestExcelBean1() { } TestExcelBean1(::bright::int32 x1, ::bright::String x2, ::bright::int32 x3, ::bright::float32 x4 ) { this->x1 = x1; this->x2 = x2; this->x3 = x3; this->x4 = x4; } virtual ~TestExcelBean1() {} bool deserialize(ByteBuf& _buf); /** * 最高品质 */ ::bright::int32 x1; /** * 黑色的 */ ::bright::String x2; /** * 蓝色的 */ ::bright::int32 x3; /** * 最差品质 */ ::bright::float32 x4; static constexpr int __ID__ = -1738345160; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace test { class TestDesc : public bright::CfgBean { public: static bool deserializeTestDesc(ByteBuf& _buf, ::bright::SharedPtr<TestDesc>& _out); TestDesc() { } TestDesc(::bright::int32 id, ::bright::String name, ::bright::int32 a1, ::bright::int32 a2, ::bright::SharedPtr<test::H1> x1, ::bright::Vector<::bright::SharedPtr<test::H2>> x2, ::bright::Vector<::bright::SharedPtr<test::H2>> x3 ) { this->id = id; this->name = name; this->a1 = a1; this->a2 = a2; this->x1 = x1; this->x2 = x2; this->x3 = x3; } virtual ~TestDesc() {} bool deserialize(ByteBuf& _buf); ::bright::int32 id; /** * 禁止 */ ::bright::String name; /** * 测试换行<br/>第2行<br/>第3层 */ ::bright::int32 a1; /** * 测试转义 &lt; &amp; % / # &gt; */ ::bright::int32 a2; ::bright::SharedPtr<test::H1> x1; /** * 这是x2 */ ::bright::Vector<::bright::SharedPtr<test::H2>> x2; ::bright::Vector<::bright::SharedPtr<test::H2>> x3; static constexpr int __ID__ = 339555391; int getTypeId() const { return __ID__; } virtual void resolve(::bright::HashMap<::bright::String, void*>& _tables); }; } namespace ai { class TbBlackboard { private: ::bright::HashMap<::bright::String, ::bright::SharedPtr<ai::Blackboard>> _dataMap; ::bright::Vector<::bright::SharedPtr<ai::Blackboard>> _dataList; public: bool load(ByteBuf& _buf) { int n; if (!_buf.readSize(n)) return false; for(; n > 0 ; --n) { ::bright::SharedPtr<ai::Blackboard> _v; if(!ai::Blackboard::deserializeBlackboard(_buf, _v)) return false; _dataList.push_back(_v); _dataMap[_v->name] = _v; } return true; } const ::bright::HashMap<::bright::String, ::bright::SharedPtr<ai::Blackboard>>& getDataMap() const { return _dataMap; } const ::bright::Vector<::bright::SharedPtr<ai::Blackboard>>& getDataList() const { return _dataList; } ai::Blackboard* getRaw(::bright::String key) { auto it = _dataMap.find(key); return it != _dataMap.end() ? it->second.get() : nullptr; } ::bright::SharedPtr<ai::Blackboard> get(::bright::String key) { auto it = _dataMap.find(key); return it != _dataMap.end() ? it->second : nullptr; } void resolve(::bright::HashMap<::bright::String, void*>& _tables) { for(auto v : _dataList) { v->resolve(_tables); } } }; } namespace ai { class TbBehaviorTree { private: ::bright::HashMap<::bright::int32, ::bright::SharedPtr<ai::BehaviorTree>> _dataMap; ::bright::Vector<::bright::SharedPtr<ai::BehaviorTree>> _dataList; public: bool load(ByteBuf& _buf) { int n; if (!_buf.readSize(n)) return false; for(; n > 0 ; --n) { ::bright::SharedPtr<ai::BehaviorTree> _v; if(!ai::BehaviorTree::deserializeBehaviorTree(_buf, _v)) return false; _dataList.push_back(_v); _dataMap[_v->id] = _v; } return true; } const ::bright::HashMap<::bright::int32, ::bright::SharedPtr<ai::BehaviorTree>>& getDataMap() const { return _dataMap; } const ::bright::Vector<::bright::SharedPtr<ai::BehaviorTree>>& getDataList() const { return _dataList; } ai::BehaviorTree* getRaw(::bright::int32 key) { auto it = _dataMap.find(key); return it != _dataMap.end() ? it->second.get() : nullptr; } ::bright::SharedPtr<ai::BehaviorTree> get(::bright::int32 key) { auto it = _dataMap.find(key); return it != _dataMap.end() ? it->second : nullptr; } void resolve(::bright::HashMap<::bright::String, void*>& _tables) { for(auto v : _dataList) { v->resolve(_tables); } } }; } namespace blueprint { class TbClazz { private: ::bright::HashMap<::bright::String, ::bright::SharedPtr<blueprint::Clazz>> _dataMap; ::bright::Vector<::bright::SharedPtr<blueprint::Clazz>> _dataList; public: bool load(ByteBuf& _buf) { int n; if (!_buf.readSize(n)) return false; for(; n > 0 ; --n) { ::bright::SharedPtr<blueprint::Clazz> _v; if(!blueprint::Clazz::deserializeClazz(_buf, _v)) return false; _dataList.push_back(_v); _dataMap[_v->name] = _v; } return true; } const ::bright::HashMap<::bright::String, ::bright::SharedPtr<blueprint::Clazz>>& getDataMap() const { return _dataMap; } const ::bright::Vector<::bright::SharedPtr<blueprint::Clazz>>& getDataList() const { return _dataList; } blueprint::Clazz* getRaw(::bright::String key) { auto it = _dataMap.find(key); return it != _dataMap.end() ? it->second.get() : nullptr; } ::bright::SharedPtr<blueprint::Clazz> get(::bright::String key) { auto it = _dataMap.find(key); return it != _dataMap.end() ? it->second : nullptr; } void resolve(::bright::HashMap<::bright::String, void*>& _tables) { for(auto v : _dataList) { v->resolve(_tables); } } }; } namespace bonus { class TbDrop { private: ::bright::HashMap<::bright::int32, ::bright::SharedPtr<bonus::DropInfo>> _dataMap; ::bright::Vector<::bright::SharedPtr<bonus::DropInfo>> _dataList; public: bool load(ByteBuf& _buf) { int n; if (!_buf.readSize(n)) return false; for(; n > 0 ; --n) { ::bright::SharedPtr<bonus::DropInfo> _v; if(!bonus::DropInfo::deserializeDropInfo(_buf, _v)) return false; _dataList.push_back(_v); _dataMap[_v->id] = _v; } return true; } const ::bright::HashMap<::bright::int32, ::bright::SharedPtr<bonus::DropInfo>>& getDataMap() const { return _dataMap; } const ::bright::Vector<::bright::SharedPtr<bonus::DropInfo>>& getDataList() const { return _dataList; } bonus::DropInfo* getRaw(::bright::int32 key) { auto it = _dataMap.find(key); return it != _dataMap.end() ? it->second.get() : nullptr; } ::bright::SharedPtr<bonus::DropInfo> get(::bright::int32 key) { auto it = _dataMap.find(key); return it != _dataMap.end() ? it->second : nullptr; } void resolve(::bright::HashMap<::bright::String, void*>& _tables) { for(auto v : _dataList) { v->resolve(_tables); } } }; } namespace common { class TbGlobalConfig { private: ::bright::SharedPtr<common::GlobalConfig> _data; public: ::bright::SharedPtr<common::GlobalConfig> data() const { return _data; } bool load(ByteBuf& _buf) { int n; if (!_buf.readSize(n)) return false; if (n != 1) return false; if(!common::GlobalConfig::deserializeGlobalConfig(_buf, _data)) return false; return true; } void resolve(::bright::HashMap<::bright::String, void*>& _tables) { _data->resolve(_tables); } /** * 背包容量 */ ::bright::int32& getBagCapacity() const { return _data->bagCapacity; } ::bright::int32& getBagCapacitySpecial() const { return _data->bagCapacitySpecial; } ::bright::int32& getBagTempExpendableCapacity() const { return _data->bagTempExpendableCapacity; } ::bright::int32& getBagTempToolCapacity() const { return _data->bagTempToolCapacity; } ::bright::int32& getBagInitCapacity() const { return _data->bagInitCapacity; } ::bright::int32& getQuickBagCapacity() const { return _data->quickBagCapacity; } ::bright::int32& getClothBagCapacity() const { return _data->clothBagCapacity; } ::bright::int32& getClothBagInitCapacity() const { return _data->clothBagInitCapacity; } ::bright::int32& getClothBagCapacitySpecial() const { return _data->clothBagCapacitySpecial; } ::bright::SharedPtr<::bright::int32>& getBagInitItemsDropId() const { return _data->bagInitItemsDropId; } ::bright::int32& getMailBoxCapacity() const { return _data->mailBoxCapacity; } ::bright::float32& getDamageParamC() const { return _data->damageParamC; } ::bright::float32& getDamageParamE() const { return _data->damageParamE; } ::bright::float32& getDamageParamF() const { return _data->damageParamF; } ::bright::float32& getDamageParamD() const { return _data->damageParamD; } ::bright::float32& getRoleSpeed() const { return _data->roleSpeed; } ::bright::float32& getMonsterSpeed() const { return _data->monsterSpeed; } ::bright::int32& getInitEnergy() const { return _data->initEnergy; } ::bright::int32& getInitViality() const { return _data->initViality; } ::bright::int32& getMaxViality() const { return _data->maxViality; } ::bright::int32& getPerVialityRecoveryTime() const { return _data->perVialityRecoveryTime; } }; } namespace error { class TbErrorInfo { private: ::bright::HashMap<::bright::String, ::bright::SharedPtr<error::ErrorInfo>> _dataMap; ::bright::Vector<::bright::SharedPtr<error::ErrorInfo>> _dataList; public: bool load(ByteBuf& _buf) { int n; if (!_buf.readSize(n)) return false; for(; n > 0 ; --n) { ::bright::SharedPtr<error::ErrorInfo> _v; if(!error::ErrorInfo::deserializeErrorInfo(_buf, _v)) return false; _dataList.push_back(_v); _dataMap[_v->code] = _v; } return true; } const ::bright::HashMap<::bright::String, ::bright::SharedPtr<error::ErrorInfo>>& getDataMap() const { return _dataMap; } const ::bright::Vector<::bright::SharedPtr<error::ErrorInfo>>& getDataList() const { return _dataList; } error::ErrorInfo* getRaw(::bright::String key) { auto it = _dataMap.find(key); return it != _dataMap.end() ? it->second.get() : nullptr; } ::bright::SharedPtr<error::ErrorInfo> get(::bright::String key) { auto it = _dataMap.find(key); return it != _dataMap.end() ? it->second : nullptr; } void resolve(::bright::HashMap<::bright::String, void*>& _tables) { for(auto v : _dataList) { v->resolve(_tables); } } }; } namespace error { class TbCodeInfo { private: ::bright::HashMap<error::EErrorCode, ::bright::SharedPtr<error::CodeInfo>> _dataMap; ::bright::Vector<::bright::SharedPtr<error::CodeInfo>> _dataList; public: bool load(ByteBuf& _buf) { int n; if (!_buf.readSize(n)) return false; for(; n > 0 ; --n) { ::bright::SharedPtr<error::CodeInfo> _v; if(!error::CodeInfo::deserializeCodeInfo(_buf, _v)) return false; _dataList.push_back(_v); _dataMap[_v->code] = _v; } return true; } const ::bright::HashMap<error::EErrorCode, ::bright::SharedPtr<error::CodeInfo>>& getDataMap() const { return _dataMap; } const ::bright::Vector<::bright::SharedPtr<error::CodeInfo>>& getDataList() const { return _dataList; } error::CodeInfo* getRaw(error::EErrorCode key) { auto it = _dataMap.find(key); return it != _dataMap.end() ? it->second.get() : nullptr; } ::bright::SharedPtr<error::CodeInfo> get(error::EErrorCode key) { auto it = _dataMap.find(key); return it != _dataMap.end() ? it->second : nullptr; } void resolve(::bright::HashMap<::bright::String, void*>& _tables) { for(auto v : _dataList) { v->resolve(_tables); } } }; } namespace item { /** * 道具表 */ class TbItem { private: ::bright::HashMap<::bright::int32, ::bright::SharedPtr<item::Item>> _dataMap; ::bright::Vector<::bright::SharedPtr<item::Item>> _dataList; public: bool load(ByteBuf& _buf) { int n; if (!_buf.readSize(n)) return false; for(; n > 0 ; --n) { ::bright::SharedPtr<item::Item> _v; if(!item::Item::deserializeItem(_buf, _v)) return false; _dataList.push_back(_v); _dataMap[_v->id] = _v; } return true; } const ::bright::HashMap<::bright::int32, ::bright::SharedPtr<item::Item>>& getDataMap() const { return _dataMap; } const ::bright::Vector<::bright::SharedPtr<item::Item>>& getDataList() const { return _dataList; } item::Item* getRaw(::bright::int32 key) { auto it = _dataMap.find(key); return it != _dataMap.end() ? it->second.get() : nullptr; } ::bright::SharedPtr<item::Item> get(::bright::int32 key) { auto it = _dataMap.find(key); return it != _dataMap.end() ? it->second : nullptr; } void resolve(::bright::HashMap<::bright::String, void*>& _tables) { for(auto v : _dataList) { v->resolve(_tables); } } }; } namespace item { class TbItemFunc { private: ::bright::HashMap<item::EMinorType, ::bright::SharedPtr<item::ItemFunction>> _dataMap; ::bright::Vector<::bright::SharedPtr<item::ItemFunction>> _dataList; public: bool load(ByteBuf& _buf) { int n; if (!_buf.readSize(n)) return false; for(; n > 0 ; --n) { ::bright::SharedPtr<item::ItemFunction> _v; if(!item::ItemFunction::deserializeItemFunction(_buf, _v)) return false; _dataList.push_back(_v); _dataMap[_v->minorType] = _v; } return true; } const ::bright::HashMap<item::EMinorType, ::bright::SharedPtr<item::ItemFunction>>& getDataMap() const { return _dataMap; } const ::bright::Vector<::bright::SharedPtr<item::ItemFunction>>& getDataList() const { return _dataList; } item::ItemFunction* getRaw(item::EMinorType key) { auto it = _dataMap.find(key); return it != _dataMap.end() ? it->second.get() : nullptr; } ::bright::SharedPtr<item::ItemFunction> get(item::EMinorType key) { auto it = _dataMap.find(key); return it != _dataMap.end() ? it->second : nullptr; } void resolve(::bright::HashMap<::bright::String, void*>& _tables) { for(auto v : _dataList) { v->resolve(_tables); } } }; } namespace item { class TbItemExtra { private: ::bright::HashMap<::bright::int32, ::bright::SharedPtr<item::ItemExtra>> _dataMap; ::bright::Vector<::bright::SharedPtr<item::ItemExtra>> _dataList; public: bool load(ByteBuf& _buf) { int n; if (!_buf.readSize(n)) return false; for(; n > 0 ; --n) { ::bright::SharedPtr<item::ItemExtra> _v; if(!item::ItemExtra::deserializeItemExtra(_buf, _v)) return false; _dataList.push_back(_v); _dataMap[_v->id] = _v; } return true; } const ::bright::HashMap<::bright::int32, ::bright::SharedPtr<item::ItemExtra>>& getDataMap() const { return _dataMap; } const ::bright::Vector<::bright::SharedPtr<item::ItemExtra>>& getDataList() const { return _dataList; } item::ItemExtra* getRaw(::bright::int32 key) { auto it = _dataMap.find(key); return it != _dataMap.end() ? it->second.get() : nullptr; } ::bright::SharedPtr<item::ItemExtra> get(::bright::int32 key) { auto it = _dataMap.find(key); return it != _dataMap.end() ? it->second : nullptr; } void resolve(::bright::HashMap<::bright::String, void*>& _tables) { for(auto v : _dataList) { v->resolve(_tables); } } }; } namespace l10n { class TbL10NDemo { private: ::bright::HashMap<::bright::int32, ::bright::SharedPtr<l10n::L10NDemo>> _dataMap; ::bright::Vector<::bright::SharedPtr<l10n::L10NDemo>> _dataList; public: bool load(ByteBuf& _buf) { int n; if (!_buf.readSize(n)) return false; for(; n > 0 ; --n) { ::bright::SharedPtr<l10n::L10NDemo> _v; if(!l10n::L10NDemo::deserializeL10NDemo(_buf, _v)) return false; _dataList.push_back(_v); _dataMap[_v->id] = _v; } return true; } const ::bright::HashMap<::bright::int32, ::bright::SharedPtr<l10n::L10NDemo>>& getDataMap() const { return _dataMap; } const ::bright::Vector<::bright::SharedPtr<l10n::L10NDemo>>& getDataList() const { return _dataList; } l10n::L10NDemo* getRaw(::bright::int32 key) { auto it = _dataMap.find(key); return it != _dataMap.end() ? it->second.get() : nullptr; } ::bright::SharedPtr<l10n::L10NDemo> get(::bright::int32 key) { auto it = _dataMap.find(key); return it != _dataMap.end() ? it->second : nullptr; } void resolve(::bright::HashMap<::bright::String, void*>& _tables) { for(auto v : _dataList) { v->resolve(_tables); } } }; } namespace l10n { class TbPatchDemo { private: ::bright::HashMap<::bright::int32, ::bright::SharedPtr<l10n::PatchDemo>> _dataMap; ::bright::Vector<::bright::SharedPtr<l10n::PatchDemo>> _dataList; public: bool load(ByteBuf& _buf) { int n; if (!_buf.readSize(n)) return false; for(; n > 0 ; --n) { ::bright::SharedPtr<l10n::PatchDemo> _v; if(!l10n::PatchDemo::deserializePatchDemo(_buf, _v)) return false; _dataList.push_back(_v); _dataMap[_v->id] = _v; } return true; } const ::bright::HashMap<::bright::int32, ::bright::SharedPtr<l10n::PatchDemo>>& getDataMap() const { return _dataMap; } const ::bright::Vector<::bright::SharedPtr<l10n::PatchDemo>>& getDataList() const { return _dataList; } l10n::PatchDemo* getRaw(::bright::int32 key) { auto it = _dataMap.find(key); return it != _dataMap.end() ? it->second.get() : nullptr; } ::bright::SharedPtr<l10n::PatchDemo> get(::bright::int32 key) { auto it = _dataMap.find(key); return it != _dataMap.end() ? it->second : nullptr; } void resolve(::bright::HashMap<::bright::String, void*>& _tables) { for(auto v : _dataList) { v->resolve(_tables); } } }; } namespace mail { class TbSystemMail { private: ::bright::HashMap<::bright::int32, ::bright::SharedPtr<mail::SystemMail>> _dataMap; ::bright::Vector<::bright::SharedPtr<mail::SystemMail>> _dataList; public: bool load(ByteBuf& _buf) { int n; if (!_buf.readSize(n)) return false; for(; n > 0 ; --n) { ::bright::SharedPtr<mail::SystemMail> _v; if(!mail::SystemMail::deserializeSystemMail(_buf, _v)) return false; _dataList.push_back(_v); _dataMap[_v->id] = _v; } return true; } const ::bright::HashMap<::bright::int32, ::bright::SharedPtr<mail::SystemMail>>& getDataMap() const { return _dataMap; } const ::bright::Vector<::bright::SharedPtr<mail::SystemMail>>& getDataList() const { return _dataList; } mail::SystemMail* getRaw(::bright::int32 key) { auto it = _dataMap.find(key); return it != _dataMap.end() ? it->second.get() : nullptr; } ::bright::SharedPtr<mail::SystemMail> get(::bright::int32 key) { auto it = _dataMap.find(key); return it != _dataMap.end() ? it->second : nullptr; } void resolve(::bright::HashMap<::bright::String, void*>& _tables) { for(auto v : _dataList) { v->resolve(_tables); } } }; } namespace mail { class TbGlobalMail { private: ::bright::HashMap<::bright::int32, ::bright::SharedPtr<mail::GlobalMail>> _dataMap; ::bright::Vector<::bright::SharedPtr<mail::GlobalMail>> _dataList; public: bool load(ByteBuf& _buf) { int n; if (!_buf.readSize(n)) return false; for(; n > 0 ; --n) { ::bright::SharedPtr<mail::GlobalMail> _v; if(!mail::GlobalMail::deserializeGlobalMail(_buf, _v)) return false; _dataList.push_back(_v); _dataMap[_v->id] = _v; } return true; } const ::bright::HashMap<::bright::int32, ::bright::SharedPtr<mail::GlobalMail>>& getDataMap() const { return _dataMap; } const ::bright::Vector<::bright::SharedPtr<mail::GlobalMail>>& getDataList() const { return _dataList; } mail::GlobalMail* getRaw(::bright::int32 key) { auto it = _dataMap.find(key); return it != _dataMap.end() ? it->second.get() : nullptr; } ::bright::SharedPtr<mail::GlobalMail> get(::bright::int32 key) { auto it = _dataMap.find(key); return it != _dataMap.end() ? it->second : nullptr; } void resolve(::bright::HashMap<::bright::String, void*>& _tables) { for(auto v : _dataList) { v->resolve(_tables); } } }; } namespace role { class TbRoleLevelExpAttr { private: ::bright::HashMap<::bright::int32, ::bright::SharedPtr<role::LevelExpAttr>> _dataMap; ::bright::Vector<::bright::SharedPtr<role::LevelExpAttr>> _dataList; public: bool load(ByteBuf& _buf) { int n; if (!_buf.readSize(n)) return false; for(; n > 0 ; --n) { ::bright::SharedPtr<role::LevelExpAttr> _v; if(!role::LevelExpAttr::deserializeLevelExpAttr(_buf, _v)) return false; _dataList.push_back(_v); _dataMap[_v->level] = _v; } return true; } const ::bright::HashMap<::bright::int32, ::bright::SharedPtr<role::LevelExpAttr>>& getDataMap() const { return _dataMap; } const ::bright::Vector<::bright::SharedPtr<role::LevelExpAttr>>& getDataList() const { return _dataList; } role::LevelExpAttr* getRaw(::bright::int32 key) { auto it = _dataMap.find(key); return it != _dataMap.end() ? it->second.get() : nullptr; } ::bright::SharedPtr<role::LevelExpAttr> get(::bright::int32 key) { auto it = _dataMap.find(key); return it != _dataMap.end() ? it->second : nullptr; } void resolve(::bright::HashMap<::bright::String, void*>& _tables) { for(auto v : _dataList) { v->resolve(_tables); } } }; } namespace role { class TbRoleLevelBonusCoefficient { private: ::bright::HashMap<::bright::int32, ::bright::SharedPtr<role::LevelBonus>> _dataMap; ::bright::Vector<::bright::SharedPtr<role::LevelBonus>> _dataList; public: bool load(ByteBuf& _buf) { int n; if (!_buf.readSize(n)) return false; for(; n > 0 ; --n) { ::bright::SharedPtr<role::LevelBonus> _v; if(!role::LevelBonus::deserializeLevelBonus(_buf, _v)) return false; _dataList.push_back(_v); _dataMap[_v->id] = _v; } return true; } const ::bright::HashMap<::bright::int32, ::bright::SharedPtr<role::LevelBonus>>& getDataMap() const { return _dataMap; } const ::bright::Vector<::bright::SharedPtr<role::LevelBonus>>& getDataList() const { return _dataList; } role::LevelBonus* getRaw(::bright::int32 key) { auto it = _dataMap.find(key); return it != _dataMap.end() ? it->second.get() : nullptr; } ::bright::SharedPtr<role::LevelBonus> get(::bright::int32 key) { auto it = _dataMap.find(key); return it != _dataMap.end() ? it->second : nullptr; } void resolve(::bright::HashMap<::bright::String, void*>& _tables) { for(auto v : _dataList) { v->resolve(_tables); } } }; } namespace tag { class TbTestTag { private: ::bright::HashMap<::bright::int32, ::bright::SharedPtr<tag::TestTag>> _dataMap; ::bright::Vector<::bright::SharedPtr<tag::TestTag>> _dataList; public: bool load(ByteBuf& _buf) { int n; if (!_buf.readSize(n)) return false; for(; n > 0 ; --n) { ::bright::SharedPtr<tag::TestTag> _v; if(!tag::TestTag::deserializeTestTag(_buf, _v)) return false; _dataList.push_back(_v); _dataMap[_v->id] = _v; } return true; } const ::bright::HashMap<::bright::int32, ::bright::SharedPtr<tag::TestTag>>& getDataMap() const { return _dataMap; } const ::bright::Vector<::bright::SharedPtr<tag::TestTag>>& getDataList() const { return _dataList; } tag::TestTag* getRaw(::bright::int32 key) { auto it = _dataMap.find(key); return it != _dataMap.end() ? it->second.get() : nullptr; } ::bright::SharedPtr<tag::TestTag> get(::bright::int32 key) { auto it = _dataMap.find(key); return it != _dataMap.end() ? it->second : nullptr; } void resolve(::bright::HashMap<::bright::String, void*>& _tables) { for(auto v : _dataList) { v->resolve(_tables); } } }; } namespace test { class TbFullTypes { private: ::bright::HashMap<::bright::int32, ::bright::SharedPtr<test::DemoType2>> _dataMap; ::bright::Vector<::bright::SharedPtr<test::DemoType2>> _dataList; public: bool load(ByteBuf& _buf) { int n; if (!_buf.readSize(n)) return false; for(; n > 0 ; --n) { ::bright::SharedPtr<test::DemoType2> _v; if(!test::DemoType2::deserializeDemoType2(_buf, _v)) return false; _dataList.push_back(_v); _dataMap[_v->x4] = _v; } return true; } const ::bright::HashMap<::bright::int32, ::bright::SharedPtr<test::DemoType2>>& getDataMap() const { return _dataMap; } const ::bright::Vector<::bright::SharedPtr<test::DemoType2>>& getDataList() const { return _dataList; } test::DemoType2* getRaw(::bright::int32 key) { auto it = _dataMap.find(key); return it != _dataMap.end() ? it->second.get() : nullptr; } ::bright::SharedPtr<test::DemoType2> get(::bright::int32 key) { auto it = _dataMap.find(key); return it != _dataMap.end() ? it->second : nullptr; } void resolve(::bright::HashMap<::bright::String, void*>& _tables) { for(auto v : _dataList) { v->resolve(_tables); } } }; } namespace test { class TbSingleton { private: ::bright::SharedPtr<test::DemoSingletonType> _data; public: ::bright::SharedPtr<test::DemoSingletonType> data() const { return _data; } bool load(ByteBuf& _buf) { int n; if (!_buf.readSize(n)) return false; if (n != 1) return false; if(!test::DemoSingletonType::deserializeDemoSingletonType(_buf, _data)) return false; return true; } void resolve(::bright::HashMap<::bright::String, void*>& _tables) { _data->resolve(_tables); } ::bright::int32& getId() const { return _data->id; } ::bright::String& getName() const { return _data->name; } ::bright::SharedPtr<test::DemoDynamic>& getDate() const { return _data->date; } }; } namespace test { class TbNotIndexList { private: ::bright::Vector<::bright::SharedPtr<test::NotIndexList>> _dataList; public: bool load(ByteBuf& _buf) { int n; if (!_buf.readSize(n)) return false; for(; n > 0 ; --n) { ::bright::SharedPtr<test::NotIndexList> _v; if(!test::NotIndexList::deserializeNotIndexList(_buf, _v)) return false; _dataList.push_back(_v); } return true; } const ::bright::Vector<::bright::SharedPtr<test::NotIndexList>>& getDataList() const { return _dataList; } test::NotIndexList* getRaw(size_t index) const { return _dataList[index].get(); } ::bright::SharedPtr<test::NotIndexList> get(size_t index) const { return _dataList[index]; } void resolve(::bright::HashMap<::bright::String, void*>& _tables) { for(auto v : _dataList) { v->resolve(_tables); } } }; } namespace test { class TbMultiUnionIndexList { private: ::bright::Vector<::bright::SharedPtr<test::MultiUnionIndexList>> _dataList; public: bool load(ByteBuf& _buf) { int n; if (!_buf.readSize(n)) return false; for(; n > 0 ; --n) { ::bright::SharedPtr<test::MultiUnionIndexList> _v; if(!test::MultiUnionIndexList::deserializeMultiUnionIndexList(_buf, _v)) return false; _dataList.push_back(_v); } return true; } const ::bright::Vector<::bright::SharedPtr<test::MultiUnionIndexList>>& getDataList() const { return _dataList; } test::MultiUnionIndexList* getRaw(size_t index) const { return _dataList[index].get(); } ::bright::SharedPtr<test::MultiUnionIndexList> get(size_t index) const { return _dataList[index]; } void resolve(::bright::HashMap<::bright::String, void*>& _tables) { for(auto v : _dataList) { v->resolve(_tables); } } }; } namespace test { class TbMultiIndexList { private: ::bright::Vector<::bright::SharedPtr<test::MultiIndexList>> _dataList; public: bool load(ByteBuf& _buf) { int n; if (!_buf.readSize(n)) return false; for(; n > 0 ; --n) { ::bright::SharedPtr<test::MultiIndexList> _v; if(!test::MultiIndexList::deserializeMultiIndexList(_buf, _v)) return false; _dataList.push_back(_v); } return true; } const ::bright::Vector<::bright::SharedPtr<test::MultiIndexList>>& getDataList() const { return _dataList; } test::MultiIndexList* getRaw(size_t index) const { return _dataList[index].get(); } ::bright::SharedPtr<test::MultiIndexList> get(size_t index) const { return _dataList[index]; } void resolve(::bright::HashMap<::bright::String, void*>& _tables) { for(auto v : _dataList) { v->resolve(_tables); } } }; } namespace test { class TbDataFromMisc { private: ::bright::HashMap<::bright::int32, ::bright::SharedPtr<test::DemoType2>> _dataMap; ::bright::Vector<::bright::SharedPtr<test::DemoType2>> _dataList; public: bool load(ByteBuf& _buf) { int n; if (!_buf.readSize(n)) return false; for(; n > 0 ; --n) { ::bright::SharedPtr<test::DemoType2> _v; if(!test::DemoType2::deserializeDemoType2(_buf, _v)) return false; _dataList.push_back(_v); _dataMap[_v->x4] = _v; } return true; } const ::bright::HashMap<::bright::int32, ::bright::SharedPtr<test::DemoType2>>& getDataMap() const { return _dataMap; } const ::bright::Vector<::bright::SharedPtr<test::DemoType2>>& getDataList() const { return _dataList; } test::DemoType2* getRaw(::bright::int32 key) { auto it = _dataMap.find(key); return it != _dataMap.end() ? it->second.get() : nullptr; } ::bright::SharedPtr<test::DemoType2> get(::bright::int32 key) { auto it = _dataMap.find(key); return it != _dataMap.end() ? it->second : nullptr; } void resolve(::bright::HashMap<::bright::String, void*>& _tables) { for(auto v : _dataList) { v->resolve(_tables); } } }; } namespace test { class TbMultiRowRecord { private: ::bright::HashMap<::bright::int32, ::bright::SharedPtr<test::MultiRowRecord>> _dataMap; ::bright::Vector<::bright::SharedPtr<test::MultiRowRecord>> _dataList; public: bool load(ByteBuf& _buf) { int n; if (!_buf.readSize(n)) return false; for(; n > 0 ; --n) { ::bright::SharedPtr<test::MultiRowRecord> _v; if(!test::MultiRowRecord::deserializeMultiRowRecord(_buf, _v)) return false; _dataList.push_back(_v); _dataMap[_v->id] = _v; } return true; } const ::bright::HashMap<::bright::int32, ::bright::SharedPtr<test::MultiRowRecord>>& getDataMap() const { return _dataMap; } const ::bright::Vector<::bright::SharedPtr<test::MultiRowRecord>>& getDataList() const { return _dataList; } test::MultiRowRecord* getRaw(::bright::int32 key) { auto it = _dataMap.find(key); return it != _dataMap.end() ? it->second.get() : nullptr; } ::bright::SharedPtr<test::MultiRowRecord> get(::bright::int32 key) { auto it = _dataMap.find(key); return it != _dataMap.end() ? it->second : nullptr; } void resolve(::bright::HashMap<::bright::String, void*>& _tables) { for(auto v : _dataList) { v->resolve(_tables); } } }; } namespace test { class TbMultiRowTitle { private: ::bright::HashMap<::bright::int32, ::bright::SharedPtr<test::MultiRowTitle>> _dataMap; ::bright::Vector<::bright::SharedPtr<test::MultiRowTitle>> _dataList; public: bool load(ByteBuf& _buf) { int n; if (!_buf.readSize(n)) return false; for(; n > 0 ; --n) { ::bright::SharedPtr<test::MultiRowTitle> _v; if(!test::MultiRowTitle::deserializeMultiRowTitle(_buf, _v)) return false; _dataList.push_back(_v); _dataMap[_v->id] = _v; } return true; } const ::bright::HashMap<::bright::int32, ::bright::SharedPtr<test::MultiRowTitle>>& getDataMap() const { return _dataMap; } const ::bright::Vector<::bright::SharedPtr<test::MultiRowTitle>>& getDataList() const { return _dataList; } test::MultiRowTitle* getRaw(::bright::int32 key) { auto it = _dataMap.find(key); return it != _dataMap.end() ? it->second.get() : nullptr; } ::bright::SharedPtr<test::MultiRowTitle> get(::bright::int32 key) { auto it = _dataMap.find(key); return it != _dataMap.end() ? it->second : nullptr; } void resolve(::bright::HashMap<::bright::String, void*>& _tables) { for(auto v : _dataList) { v->resolve(_tables); } } }; } namespace test { class TbTestNull { private: ::bright::HashMap<::bright::int32, ::bright::SharedPtr<test::TestNull>> _dataMap; ::bright::Vector<::bright::SharedPtr<test::TestNull>> _dataList; public: bool load(ByteBuf& _buf) { int n; if (!_buf.readSize(n)) return false; for(; n > 0 ; --n) { ::bright::SharedPtr<test::TestNull> _v; if(!test::TestNull::deserializeTestNull(_buf, _v)) return false; _dataList.push_back(_v); _dataMap[_v->id] = _v; } return true; } const ::bright::HashMap<::bright::int32, ::bright::SharedPtr<test::TestNull>>& getDataMap() const { return _dataMap; } const ::bright::Vector<::bright::SharedPtr<test::TestNull>>& getDataList() const { return _dataList; } test::TestNull* getRaw(::bright::int32 key) { auto it = _dataMap.find(key); return it != _dataMap.end() ? it->second.get() : nullptr; } ::bright::SharedPtr<test::TestNull> get(::bright::int32 key) { auto it = _dataMap.find(key); return it != _dataMap.end() ? it->second : nullptr; } void resolve(::bright::HashMap<::bright::String, void*>& _tables) { for(auto v : _dataList) { v->resolve(_tables); } } }; } namespace test { class TbDemoPrimitive { private: ::bright::HashMap<::bright::int32, ::bright::SharedPtr<test::DemoPrimitiveTypesTable>> _dataMap; ::bright::Vector<::bright::SharedPtr<test::DemoPrimitiveTypesTable>> _dataList; public: bool load(ByteBuf& _buf) { int n; if (!_buf.readSize(n)) return false; for(; n > 0 ; --n) { ::bright::SharedPtr<test::DemoPrimitiveTypesTable> _v; if(!test::DemoPrimitiveTypesTable::deserializeDemoPrimitiveTypesTable(_buf, _v)) return false; _dataList.push_back(_v); _dataMap[_v->x4] = _v; } return true; } const ::bright::HashMap<::bright::int32, ::bright::SharedPtr<test::DemoPrimitiveTypesTable>>& getDataMap() const { return _dataMap; } const ::bright::Vector<::bright::SharedPtr<test::DemoPrimitiveTypesTable>>& getDataList() const { return _dataList; } test::DemoPrimitiveTypesTable* getRaw(::bright::int32 key) { auto it = _dataMap.find(key); return it != _dataMap.end() ? it->second.get() : nullptr; } ::bright::SharedPtr<test::DemoPrimitiveTypesTable> get(::bright::int32 key) { auto it = _dataMap.find(key); return it != _dataMap.end() ? it->second : nullptr; } void resolve(::bright::HashMap<::bright::String, void*>& _tables) { for(auto v : _dataList) { v->resolve(_tables); } } }; } namespace test { class TbTestString { private: ::bright::HashMap<::bright::int32, ::bright::SharedPtr<test::TestString>> _dataMap; ::bright::Vector<::bright::SharedPtr<test::TestString>> _dataList; public: bool load(ByteBuf& _buf) { int n; if (!_buf.readSize(n)) return false; for(; n > 0 ; --n) { ::bright::SharedPtr<test::TestString> _v; if(!test::TestString::deserializeTestString(_buf, _v)) return false; _dataList.push_back(_v); _dataMap[_v->id] = _v; } return true; } const ::bright::HashMap<::bright::int32, ::bright::SharedPtr<test::TestString>>& getDataMap() const { return _dataMap; } const ::bright::Vector<::bright::SharedPtr<test::TestString>>& getDataList() const { return _dataList; } test::TestString* getRaw(::bright::int32 key) { auto it = _dataMap.find(key); return it != _dataMap.end() ? it->second.get() : nullptr; } ::bright::SharedPtr<test::TestString> get(::bright::int32 key) { auto it = _dataMap.find(key); return it != _dataMap.end() ? it->second : nullptr; } void resolve(::bright::HashMap<::bright::String, void*>& _tables) { for(auto v : _dataList) { v->resolve(_tables); } } }; } namespace test { class TbDemoGroup { private: ::bright::HashMap<::bright::int32, ::bright::SharedPtr<test::DemoGroup>> _dataMap; ::bright::Vector<::bright::SharedPtr<test::DemoGroup>> _dataList; public: bool load(ByteBuf& _buf) { int n; if (!_buf.readSize(n)) return false; for(; n > 0 ; --n) { ::bright::SharedPtr<test::DemoGroup> _v; if(!test::DemoGroup::deserializeDemoGroup(_buf, _v)) return false; _dataList.push_back(_v); _dataMap[_v->id] = _v; } return true; } const ::bright::HashMap<::bright::int32, ::bright::SharedPtr<test::DemoGroup>>& getDataMap() const { return _dataMap; } const ::bright::Vector<::bright::SharedPtr<test::DemoGroup>>& getDataList() const { return _dataList; } test::DemoGroup* getRaw(::bright::int32 key) { auto it = _dataMap.find(key); return it != _dataMap.end() ? it->second.get() : nullptr; } ::bright::SharedPtr<test::DemoGroup> get(::bright::int32 key) { auto it = _dataMap.find(key); return it != _dataMap.end() ? it->second : nullptr; } void resolve(::bright::HashMap<::bright::String, void*>& _tables) { for(auto v : _dataList) { v->resolve(_tables); } } }; } namespace test { class TbDemoGroup_C { private: ::bright::HashMap<::bright::int32, ::bright::SharedPtr<test::DemoGroup>> _dataMap; ::bright::Vector<::bright::SharedPtr<test::DemoGroup>> _dataList; public: bool load(ByteBuf& _buf) { int n; if (!_buf.readSize(n)) return false; for(; n > 0 ; --n) { ::bright::SharedPtr<test::DemoGroup> _v; if(!test::DemoGroup::deserializeDemoGroup(_buf, _v)) return false; _dataList.push_back(_v); _dataMap[_v->id] = _v; } return true; } const ::bright::HashMap<::bright::int32, ::bright::SharedPtr<test::DemoGroup>>& getDataMap() const { return _dataMap; } const ::bright::Vector<::bright::SharedPtr<test::DemoGroup>>& getDataList() const { return _dataList; } test::DemoGroup* getRaw(::bright::int32 key) { auto it = _dataMap.find(key); return it != _dataMap.end() ? it->second.get() : nullptr; } ::bright::SharedPtr<test::DemoGroup> get(::bright::int32 key) { auto it = _dataMap.find(key); return it != _dataMap.end() ? it->second : nullptr; } void resolve(::bright::HashMap<::bright::String, void*>& _tables) { for(auto v : _dataList) { v->resolve(_tables); } } }; } namespace test { class TbDemoGroup_S { private: ::bright::HashMap<::bright::int32, ::bright::SharedPtr<test::DemoGroup>> _dataMap; ::bright::Vector<::bright::SharedPtr<test::DemoGroup>> _dataList; public: bool load(ByteBuf& _buf) { int n; if (!_buf.readSize(n)) return false; for(; n > 0 ; --n) { ::bright::SharedPtr<test::DemoGroup> _v; if(!test::DemoGroup::deserializeDemoGroup(_buf, _v)) return false; _dataList.push_back(_v); _dataMap[_v->id] = _v; } return true; } const ::bright::HashMap<::bright::int32, ::bright::SharedPtr<test::DemoGroup>>& getDataMap() const { return _dataMap; } const ::bright::Vector<::bright::SharedPtr<test::DemoGroup>>& getDataList() const { return _dataList; } test::DemoGroup* getRaw(::bright::int32 key) { auto it = _dataMap.find(key); return it != _dataMap.end() ? it->second.get() : nullptr; } ::bright::SharedPtr<test::DemoGroup> get(::bright::int32 key) { auto it = _dataMap.find(key); return it != _dataMap.end() ? it->second : nullptr; } void resolve(::bright::HashMap<::bright::String, void*>& _tables) { for(auto v : _dataList) { v->resolve(_tables); } } }; } namespace test { class TbDemoGroup_E { private: ::bright::HashMap<::bright::int32, ::bright::SharedPtr<test::DemoGroup>> _dataMap; ::bright::Vector<::bright::SharedPtr<test::DemoGroup>> _dataList; public: bool load(ByteBuf& _buf) { int n; if (!_buf.readSize(n)) return false; for(; n > 0 ; --n) { ::bright::SharedPtr<test::DemoGroup> _v; if(!test::DemoGroup::deserializeDemoGroup(_buf, _v)) return false; _dataList.push_back(_v); _dataMap[_v->id] = _v; } return true; } const ::bright::HashMap<::bright::int32, ::bright::SharedPtr<test::DemoGroup>>& getDataMap() const { return _dataMap; } const ::bright::Vector<::bright::SharedPtr<test::DemoGroup>>& getDataList() const { return _dataList; } test::DemoGroup* getRaw(::bright::int32 key) { auto it = _dataMap.find(key); return it != _dataMap.end() ? it->second.get() : nullptr; } ::bright::SharedPtr<test::DemoGroup> get(::bright::int32 key) { auto it = _dataMap.find(key); return it != _dataMap.end() ? it->second : nullptr; } void resolve(::bright::HashMap<::bright::String, void*>& _tables) { for(auto v : _dataList) { v->resolve(_tables); } } }; } namespace test { class TbTestGlobal { private: ::bright::SharedPtr<test::TestGlobal> _data; public: ::bright::SharedPtr<test::TestGlobal> data() const { return _data; } bool load(ByteBuf& _buf) { int n; if (!_buf.readSize(n)) return false; if (n != 1) return false; if(!test::TestGlobal::deserializeTestGlobal(_buf, _data)) return false; return true; } void resolve(::bright::HashMap<::bright::String, void*>& _tables) { _data->resolve(_tables); } ::bright::int32& getUnlockEquip() const { return _data->unlockEquip; } ::bright::int32& getUnlockHero() const { return _data->unlockHero; } }; } namespace test { class TbTestBeRef { private: ::bright::HashMap<::bright::int32, ::bright::SharedPtr<test::TestBeRef>> _dataMap; ::bright::Vector<::bright::SharedPtr<test::TestBeRef>> _dataList; public: bool load(ByteBuf& _buf) { int n; if (!_buf.readSize(n)) return false; for(; n > 0 ; --n) { ::bright::SharedPtr<test::TestBeRef> _v; if(!test::TestBeRef::deserializeTestBeRef(_buf, _v)) return false; _dataList.push_back(_v); _dataMap[_v->id] = _v; } return true; } const ::bright::HashMap<::bright::int32, ::bright::SharedPtr<test::TestBeRef>>& getDataMap() const { return _dataMap; } const ::bright::Vector<::bright::SharedPtr<test::TestBeRef>>& getDataList() const { return _dataList; } test::TestBeRef* getRaw(::bright::int32 key) { auto it = _dataMap.find(key); return it != _dataMap.end() ? it->second.get() : nullptr; } ::bright::SharedPtr<test::TestBeRef> get(::bright::int32 key) { auto it = _dataMap.find(key); return it != _dataMap.end() ? it->second : nullptr; } void resolve(::bright::HashMap<::bright::String, void*>& _tables) { for(auto v : _dataList) { v->resolve(_tables); } } }; } namespace test { class TbTestBeRef2 { private: ::bright::HashMap<::bright::int32, ::bright::SharedPtr<test::TestBeRef>> _dataMap; ::bright::Vector<::bright::SharedPtr<test::TestBeRef>> _dataList; public: bool load(ByteBuf& _buf) { int n; if (!_buf.readSize(n)) return false; for(; n > 0 ; --n) { ::bright::SharedPtr<test::TestBeRef> _v; if(!test::TestBeRef::deserializeTestBeRef(_buf, _v)) return false; _dataList.push_back(_v); _dataMap[_v->id] = _v; } return true; } const ::bright::HashMap<::bright::int32, ::bright::SharedPtr<test::TestBeRef>>& getDataMap() const { return _dataMap; } const ::bright::Vector<::bright::SharedPtr<test::TestBeRef>>& getDataList() const { return _dataList; } test::TestBeRef* getRaw(::bright::int32 key) { auto it = _dataMap.find(key); return it != _dataMap.end() ? it->second.get() : nullptr; } ::bright::SharedPtr<test::TestBeRef> get(::bright::int32 key) { auto it = _dataMap.find(key); return it != _dataMap.end() ? it->second : nullptr; } void resolve(::bright::HashMap<::bright::String, void*>& _tables) { for(auto v : _dataList) { v->resolve(_tables); } } }; } namespace test { class TbTestRef { private: ::bright::HashMap<::bright::int32, ::bright::SharedPtr<test::TestRef>> _dataMap; ::bright::Vector<::bright::SharedPtr<test::TestRef>> _dataList; public: bool load(ByteBuf& _buf) { int n; if (!_buf.readSize(n)) return false; for(; n > 0 ; --n) { ::bright::SharedPtr<test::TestRef> _v; if(!test::TestRef::deserializeTestRef(_buf, _v)) return false; _dataList.push_back(_v); _dataMap[_v->id] = _v; } return true; } const ::bright::HashMap<::bright::int32, ::bright::SharedPtr<test::TestRef>>& getDataMap() const { return _dataMap; } const ::bright::Vector<::bright::SharedPtr<test::TestRef>>& getDataList() const { return _dataList; } test::TestRef* getRaw(::bright::int32 key) { auto it = _dataMap.find(key); return it != _dataMap.end() ? it->second.get() : nullptr; } ::bright::SharedPtr<test::TestRef> get(::bright::int32 key) { auto it = _dataMap.find(key); return it != _dataMap.end() ? it->second : nullptr; } void resolve(::bright::HashMap<::bright::String, void*>& _tables) { for(auto v : _dataList) { v->resolve(_tables); } } }; } namespace test { class TbTestSize { private: ::bright::HashMap<::bright::int32, ::bright::SharedPtr<test::TestSize>> _dataMap; ::bright::Vector<::bright::SharedPtr<test::TestSize>> _dataList; public: bool load(ByteBuf& _buf) { int n; if (!_buf.readSize(n)) return false; for(; n > 0 ; --n) { ::bright::SharedPtr<test::TestSize> _v; if(!test::TestSize::deserializeTestSize(_buf, _v)) return false; _dataList.push_back(_v); _dataMap[_v->id] = _v; } return true; } const ::bright::HashMap<::bright::int32, ::bright::SharedPtr<test::TestSize>>& getDataMap() const { return _dataMap; } const ::bright::Vector<::bright::SharedPtr<test::TestSize>>& getDataList() const { return _dataList; } test::TestSize* getRaw(::bright::int32 key) { auto it = _dataMap.find(key); return it != _dataMap.end() ? it->second.get() : nullptr; } ::bright::SharedPtr<test::TestSize> get(::bright::int32 key) { auto it = _dataMap.find(key); return it != _dataMap.end() ? it->second : nullptr; } void resolve(::bright::HashMap<::bright::String, void*>& _tables) { for(auto v : _dataList) { v->resolve(_tables); } } }; } namespace test { class TbTestSet { private: ::bright::HashMap<::bright::int32, ::bright::SharedPtr<test::TestSet>> _dataMap; ::bright::Vector<::bright::SharedPtr<test::TestSet>> _dataList; public: bool load(ByteBuf& _buf) { int n; if (!_buf.readSize(n)) return false; for(; n > 0 ; --n) { ::bright::SharedPtr<test::TestSet> _v; if(!test::TestSet::deserializeTestSet(_buf, _v)) return false; _dataList.push_back(_v); _dataMap[_v->id] = _v; } return true; } const ::bright::HashMap<::bright::int32, ::bright::SharedPtr<test::TestSet>>& getDataMap() const { return _dataMap; } const ::bright::Vector<::bright::SharedPtr<test::TestSet>>& getDataList() const { return _dataList; } test::TestSet* getRaw(::bright::int32 key) { auto it = _dataMap.find(key); return it != _dataMap.end() ? it->second.get() : nullptr; } ::bright::SharedPtr<test::TestSet> get(::bright::int32 key) { auto it = _dataMap.find(key); return it != _dataMap.end() ? it->second : nullptr; } void resolve(::bright::HashMap<::bright::String, void*>& _tables) { for(auto v : _dataList) { v->resolve(_tables); } } }; } namespace test { class TbDetectCsvEncoding { private: ::bright::HashMap<::bright::int32, ::bright::SharedPtr<test::DetectEncoding>> _dataMap; ::bright::Vector<::bright::SharedPtr<test::DetectEncoding>> _dataList; public: bool load(ByteBuf& _buf) { int n; if (!_buf.readSize(n)) return false; for(; n > 0 ; --n) { ::bright::SharedPtr<test::DetectEncoding> _v; if(!test::DetectEncoding::deserializeDetectEncoding(_buf, _v)) return false; _dataList.push_back(_v); _dataMap[_v->id] = _v; } return true; } const ::bright::HashMap<::bright::int32, ::bright::SharedPtr<test::DetectEncoding>>& getDataMap() const { return _dataMap; } const ::bright::Vector<::bright::SharedPtr<test::DetectEncoding>>& getDataList() const { return _dataList; } test::DetectEncoding* getRaw(::bright::int32 key) { auto it = _dataMap.find(key); return it != _dataMap.end() ? it->second.get() : nullptr; } ::bright::SharedPtr<test::DetectEncoding> get(::bright::int32 key) { auto it = _dataMap.find(key); return it != _dataMap.end() ? it->second : nullptr; } void resolve(::bright::HashMap<::bright::String, void*>& _tables) { for(auto v : _dataList) { v->resolve(_tables); } } }; } namespace test { class TbDefineFromExcel { private: ::bright::HashMap<::bright::int32, ::bright::SharedPtr<test::DefineFromExcel>> _dataMap; ::bright::Vector<::bright::SharedPtr<test::DefineFromExcel>> _dataList; public: bool load(ByteBuf& _buf) { int n; if (!_buf.readSize(n)) return false; for(; n > 0 ; --n) { ::bright::SharedPtr<test::DefineFromExcel> _v; if(!test::DefineFromExcel::deserializeDefineFromExcel(_buf, _v)) return false; _dataList.push_back(_v); _dataMap[_v->id] = _v; } return true; } const ::bright::HashMap<::bright::int32, ::bright::SharedPtr<test::DefineFromExcel>>& getDataMap() const { return _dataMap; } const ::bright::Vector<::bright::SharedPtr<test::DefineFromExcel>>& getDataList() const { return _dataList; } test::DefineFromExcel* getRaw(::bright::int32 key) { auto it = _dataMap.find(key); return it != _dataMap.end() ? it->second.get() : nullptr; } ::bright::SharedPtr<test::DefineFromExcel> get(::bright::int32 key) { auto it = _dataMap.find(key); return it != _dataMap.end() ? it->second : nullptr; } void resolve(::bright::HashMap<::bright::String, void*>& _tables) { for(auto v : _dataList) { v->resolve(_tables); } } }; } namespace test { class TbDefineFromExcelOne { private: ::bright::SharedPtr<test::DefineFromExcelOne> _data; public: ::bright::SharedPtr<test::DefineFromExcelOne> data() const { return _data; } bool load(ByteBuf& _buf) { int n; if (!_buf.readSize(n)) return false; if (n != 1) return false; if(!test::DefineFromExcelOne::deserializeDefineFromExcelOne(_buf, _data)) return false; return true; } void resolve(::bright::HashMap<::bright::String, void*>& _tables) { _data->resolve(_tables); } /** * 装备解锁等级 */ ::bright::int32& getUnlockEquip() const { return _data->unlockEquip; } /** * 英雄解锁等级 */ ::bright::int32& getUnlockHero() const { return _data->unlockHero; } ::bright::String& getDefaultAvatar() const { return _data->defaultAvatar; } ::bright::String& getDefaultItem() const { return _data->defaultItem; } }; } namespace test { class TbTestIndex { private: ::bright::HashMap<::bright::int32, ::bright::SharedPtr<test::TestIndex>> _dataMap; ::bright::Vector<::bright::SharedPtr<test::TestIndex>> _dataList; public: bool load(ByteBuf& _buf) { int n; if (!_buf.readSize(n)) return false; for(; n > 0 ; --n) { ::bright::SharedPtr<test::TestIndex> _v; if(!test::TestIndex::deserializeTestIndex(_buf, _v)) return false; _dataList.push_back(_v); _dataMap[_v->id] = _v; } return true; } const ::bright::HashMap<::bright::int32, ::bright::SharedPtr<test::TestIndex>>& getDataMap() const { return _dataMap; } const ::bright::Vector<::bright::SharedPtr<test::TestIndex>>& getDataList() const { return _dataList; } test::TestIndex* getRaw(::bright::int32 key) { auto it = _dataMap.find(key); return it != _dataMap.end() ? it->second.get() : nullptr; } ::bright::SharedPtr<test::TestIndex> get(::bright::int32 key) { auto it = _dataMap.find(key); return it != _dataMap.end() ? it->second : nullptr; } void resolve(::bright::HashMap<::bright::String, void*>& _tables) { for(auto v : _dataList) { v->resolve(_tables); } } }; } namespace test { class TbTestMap { private: ::bright::HashMap<::bright::int32, ::bright::SharedPtr<test::TestMap>> _dataMap; ::bright::Vector<::bright::SharedPtr<test::TestMap>> _dataList; public: bool load(ByteBuf& _buf) { int n; if (!_buf.readSize(n)) return false; for(; n > 0 ; --n) { ::bright::SharedPtr<test::TestMap> _v; if(!test::TestMap::deserializeTestMap(_buf, _v)) return false; _dataList.push_back(_v); _dataMap[_v->id] = _v; } return true; } const ::bright::HashMap<::bright::int32, ::bright::SharedPtr<test::TestMap>>& getDataMap() const { return _dataMap; } const ::bright::Vector<::bright::SharedPtr<test::TestMap>>& getDataList() const { return _dataList; } test::TestMap* getRaw(::bright::int32 key) { auto it = _dataMap.find(key); return it != _dataMap.end() ? it->second.get() : nullptr; } ::bright::SharedPtr<test::TestMap> get(::bright::int32 key) { auto it = _dataMap.find(key); return it != _dataMap.end() ? it->second : nullptr; } void resolve(::bright::HashMap<::bright::String, void*>& _tables) { for(auto v : _dataList) { v->resolve(_tables); } } }; } namespace test { class TbExcelFromJson { private: ::bright::HashMap<::bright::int32, ::bright::SharedPtr<test::ExcelFromJson>> _dataMap; ::bright::Vector<::bright::SharedPtr<test::ExcelFromJson>> _dataList; public: bool load(ByteBuf& _buf) { int n; if (!_buf.readSize(n)) return false; for(; n > 0 ; --n) { ::bright::SharedPtr<test::ExcelFromJson> _v; if(!test::ExcelFromJson::deserializeExcelFromJson(_buf, _v)) return false; _dataList.push_back(_v); _dataMap[_v->x4] = _v; } return true; } const ::bright::HashMap<::bright::int32, ::bright::SharedPtr<test::ExcelFromJson>>& getDataMap() const { return _dataMap; } const ::bright::Vector<::bright::SharedPtr<test::ExcelFromJson>>& getDataList() const { return _dataList; } test::ExcelFromJson* getRaw(::bright::int32 key) { auto it = _dataMap.find(key); return it != _dataMap.end() ? it->second.get() : nullptr; } ::bright::SharedPtr<test::ExcelFromJson> get(::bright::int32 key) { auto it = _dataMap.find(key); return it != _dataMap.end() ? it->second : nullptr; } void resolve(::bright::HashMap<::bright::String, void*>& _tables) { for(auto v : _dataList) { v->resolve(_tables); } } }; } namespace test { class TbCompositeJsonTable1 { private: ::bright::HashMap<::bright::int32, ::bright::SharedPtr<test::CompositeJsonTable1>> _dataMap; ::bright::Vector<::bright::SharedPtr<test::CompositeJsonTable1>> _dataList; public: bool load(ByteBuf& _buf) { int n; if (!_buf.readSize(n)) return false; for(; n > 0 ; --n) { ::bright::SharedPtr<test::CompositeJsonTable1> _v; if(!test::CompositeJsonTable1::deserializeCompositeJsonTable1(_buf, _v)) return false; _dataList.push_back(_v); _dataMap[_v->id] = _v; } return true; } const ::bright::HashMap<::bright::int32, ::bright::SharedPtr<test::CompositeJsonTable1>>& getDataMap() const { return _dataMap; } const ::bright::Vector<::bright::SharedPtr<test::CompositeJsonTable1>>& getDataList() const { return _dataList; } test::CompositeJsonTable1* getRaw(::bright::int32 key) { auto it = _dataMap.find(key); return it != _dataMap.end() ? it->second.get() : nullptr; } ::bright::SharedPtr<test::CompositeJsonTable1> get(::bright::int32 key) { auto it = _dataMap.find(key); return it != _dataMap.end() ? it->second : nullptr; } void resolve(::bright::HashMap<::bright::String, void*>& _tables) { for(auto v : _dataList) { v->resolve(_tables); } } }; } namespace test { class TbCompositeJsonTable2 { private: ::bright::HashMap<::bright::int32, ::bright::SharedPtr<test::CompositeJsonTable2>> _dataMap; ::bright::Vector<::bright::SharedPtr<test::CompositeJsonTable2>> _dataList; public: bool load(ByteBuf& _buf) { int n; if (!_buf.readSize(n)) return false; for(; n > 0 ; --n) { ::bright::SharedPtr<test::CompositeJsonTable2> _v; if(!test::CompositeJsonTable2::deserializeCompositeJsonTable2(_buf, _v)) return false; _dataList.push_back(_v); _dataMap[_v->id] = _v; } return true; } const ::bright::HashMap<::bright::int32, ::bright::SharedPtr<test::CompositeJsonTable2>>& getDataMap() const { return _dataMap; } const ::bright::Vector<::bright::SharedPtr<test::CompositeJsonTable2>>& getDataList() const { return _dataList; } test::CompositeJsonTable2* getRaw(::bright::int32 key) { auto it = _dataMap.find(key); return it != _dataMap.end() ? it->second.get() : nullptr; } ::bright::SharedPtr<test::CompositeJsonTable2> get(::bright::int32 key) { auto it = _dataMap.find(key); return it != _dataMap.end() ? it->second : nullptr; } void resolve(::bright::HashMap<::bright::String, void*>& _tables) { for(auto v : _dataList) { v->resolve(_tables); } } }; } namespace test { class TbCompositeJsonTable3 { private: ::bright::SharedPtr<test::CompositeJsonTable3> _data; public: ::bright::SharedPtr<test::CompositeJsonTable3> data() const { return _data; } bool load(ByteBuf& _buf) { int n; if (!_buf.readSize(n)) return false; if (n != 1) return false; if(!test::CompositeJsonTable3::deserializeCompositeJsonTable3(_buf, _data)) return false; return true; } void resolve(::bright::HashMap<::bright::String, void*>& _tables) { _data->resolve(_tables); } ::bright::int32& getA() const { return _data->a; } ::bright::int32& getB() const { return _data->b; } }; } namespace test { class TbExcelFromJsonMultiRow { private: ::bright::HashMap<::bright::int32, ::bright::SharedPtr<test::ExcelFromJsonMultiRow>> _dataMap; ::bright::Vector<::bright::SharedPtr<test::ExcelFromJsonMultiRow>> _dataList; public: bool load(ByteBuf& _buf) { int n; if (!_buf.readSize(n)) return false; for(; n > 0 ; --n) { ::bright::SharedPtr<test::ExcelFromJsonMultiRow> _v; if(!test::ExcelFromJsonMultiRow::deserializeExcelFromJsonMultiRow(_buf, _v)) return false; _dataList.push_back(_v); _dataMap[_v->id] = _v; } return true; } const ::bright::HashMap<::bright::int32, ::bright::SharedPtr<test::ExcelFromJsonMultiRow>>& getDataMap() const { return _dataMap; } const ::bright::Vector<::bright::SharedPtr<test::ExcelFromJsonMultiRow>>& getDataList() const { return _dataList; } test::ExcelFromJsonMultiRow* getRaw(::bright::int32 key) { auto it = _dataMap.find(key); return it != _dataMap.end() ? it->second.get() : nullptr; } ::bright::SharedPtr<test::ExcelFromJsonMultiRow> get(::bright::int32 key) { auto it = _dataMap.find(key); return it != _dataMap.end() ? it->second : nullptr; } void resolve(::bright::HashMap<::bright::String, void*>& _tables) { for(auto v : _dataList) { v->resolve(_tables); } } }; } namespace test { class TbTestSep { private: ::bright::HashMap<::bright::int32, ::bright::SharedPtr<test::TestSep>> _dataMap; ::bright::Vector<::bright::SharedPtr<test::TestSep>> _dataList; public: bool load(ByteBuf& _buf) { int n; if (!_buf.readSize(n)) return false; for(; n > 0 ; --n) { ::bright::SharedPtr<test::TestSep> _v; if(!test::TestSep::deserializeTestSep(_buf, _v)) return false; _dataList.push_back(_v); _dataMap[_v->id] = _v; } return true; } const ::bright::HashMap<::bright::int32, ::bright::SharedPtr<test::TestSep>>& getDataMap() const { return _dataMap; } const ::bright::Vector<::bright::SharedPtr<test::TestSep>>& getDataList() const { return _dataList; } test::TestSep* getRaw(::bright::int32 key) { auto it = _dataMap.find(key); return it != _dataMap.end() ? it->second.get() : nullptr; } ::bright::SharedPtr<test::TestSep> get(::bright::int32 key) { auto it = _dataMap.find(key); return it != _dataMap.end() ? it->second : nullptr; } void resolve(::bright::HashMap<::bright::String, void*>& _tables) { for(auto v : _dataList) { v->resolve(_tables); } } }; } namespace test { class TbTestExternalType { private: ::bright::HashMap<::bright::int32, ::bright::SharedPtr<test::TestExternalType>> _dataMap; ::bright::Vector<::bright::SharedPtr<test::TestExternalType>> _dataList; public: bool load(ByteBuf& _buf) { int n; if (!_buf.readSize(n)) return false; for(; n > 0 ; --n) { ::bright::SharedPtr<test::TestExternalType> _v; if(!test::TestExternalType::deserializeTestExternalType(_buf, _v)) return false; _dataList.push_back(_v); _dataMap[_v->id] = _v; } return true; } const ::bright::HashMap<::bright::int32, ::bright::SharedPtr<test::TestExternalType>>& getDataMap() const { return _dataMap; } const ::bright::Vector<::bright::SharedPtr<test::TestExternalType>>& getDataList() const { return _dataList; } test::TestExternalType* getRaw(::bright::int32 key) { auto it = _dataMap.find(key); return it != _dataMap.end() ? it->second.get() : nullptr; } ::bright::SharedPtr<test::TestExternalType> get(::bright::int32 key) { auto it = _dataMap.find(key); return it != _dataMap.end() ? it->second : nullptr; } void resolve(::bright::HashMap<::bright::String, void*>& _tables) { for(auto v : _dataList) { v->resolve(_tables); } } }; } namespace test { class TbDemoGroupDefineFromExcel { private: ::bright::HashMap<::bright::int32, ::bright::SharedPtr<test::DemoGroup>> _dataMap; ::bright::Vector<::bright::SharedPtr<test::DemoGroup>> _dataList; public: bool load(ByteBuf& _buf) { int n; if (!_buf.readSize(n)) return false; for(; n > 0 ; --n) { ::bright::SharedPtr<test::DemoGroup> _v; if(!test::DemoGroup::deserializeDemoGroup(_buf, _v)) return false; _dataList.push_back(_v); _dataMap[_v->id] = _v; } return true; } const ::bright::HashMap<::bright::int32, ::bright::SharedPtr<test::DemoGroup>>& getDataMap() const { return _dataMap; } const ::bright::Vector<::bright::SharedPtr<test::DemoGroup>>& getDataList() const { return _dataList; } test::DemoGroup* getRaw(::bright::int32 key) { auto it = _dataMap.find(key); return it != _dataMap.end() ? it->second.get() : nullptr; } ::bright::SharedPtr<test::DemoGroup> get(::bright::int32 key) { auto it = _dataMap.find(key); return it != _dataMap.end() ? it->second : nullptr; } void resolve(::bright::HashMap<::bright::String, void*>& _tables) { for(auto v : _dataList) { v->resolve(_tables); } } }; } namespace test { class TbDefineFromExcel2 { private: ::bright::HashMap<::bright::int32, ::bright::SharedPtr<test::DefineFromExcel2>> _dataMap; ::bright::Vector<::bright::SharedPtr<test::DefineFromExcel2>> _dataList; public: bool load(ByteBuf& _buf) { int n; if (!_buf.readSize(n)) return false; for(; n > 0 ; --n) { ::bright::SharedPtr<test::DefineFromExcel2> _v; if(!test::DefineFromExcel2::deserializeDefineFromExcel2(_buf, _v)) return false; _dataList.push_back(_v); _dataMap[_v->id] = _v; } return true; } const ::bright::HashMap<::bright::int32, ::bright::SharedPtr<test::DefineFromExcel2>>& getDataMap() const { return _dataMap; } const ::bright::Vector<::bright::SharedPtr<test::DefineFromExcel2>>& getDataList() const { return _dataList; } test::DefineFromExcel2* getRaw(::bright::int32 key) { auto it = _dataMap.find(key); return it != _dataMap.end() ? it->second.get() : nullptr; } ::bright::SharedPtr<test::DefineFromExcel2> get(::bright::int32 key) { auto it = _dataMap.find(key); return it != _dataMap.end() ? it->second : nullptr; } void resolve(::bright::HashMap<::bright::String, void*>& _tables) { for(auto v : _dataList) { v->resolve(_tables); } } }; } namespace test { class TbTestExcelBean { private: ::bright::HashMap<::bright::int32, ::bright::SharedPtr<test::TestExcelBean1>> _dataMap; ::bright::Vector<::bright::SharedPtr<test::TestExcelBean1>> _dataList; public: bool load(ByteBuf& _buf) { int n; if (!_buf.readSize(n)) return false; for(; n > 0 ; --n) { ::bright::SharedPtr<test::TestExcelBean1> _v; if(!test::TestExcelBean1::deserializeTestExcelBean1(_buf, _v)) return false; _dataList.push_back(_v); _dataMap[_v->x1] = _v; } return true; } const ::bright::HashMap<::bright::int32, ::bright::SharedPtr<test::TestExcelBean1>>& getDataMap() const { return _dataMap; } const ::bright::Vector<::bright::SharedPtr<test::TestExcelBean1>>& getDataList() const { return _dataList; } test::TestExcelBean1* getRaw(::bright::int32 key) { auto it = _dataMap.find(key); return it != _dataMap.end() ? it->second.get() : nullptr; } ::bright::SharedPtr<test::TestExcelBean1> get(::bright::int32 key) { auto it = _dataMap.find(key); return it != _dataMap.end() ? it->second : nullptr; } void resolve(::bright::HashMap<::bright::String, void*>& _tables) { for(auto v : _dataList) { v->resolve(_tables); } } }; } namespace test { class TbTestDesc { private: ::bright::HashMap<::bright::int32, ::bright::SharedPtr<test::TestDesc>> _dataMap; ::bright::Vector<::bright::SharedPtr<test::TestDesc>> _dataList; public: bool load(ByteBuf& _buf) { int n; if (!_buf.readSize(n)) return false; for(; n > 0 ; --n) { ::bright::SharedPtr<test::TestDesc> _v; if(!test::TestDesc::deserializeTestDesc(_buf, _v)) return false; _dataList.push_back(_v); _dataMap[_v->id] = _v; } return true; } const ::bright::HashMap<::bright::int32, ::bright::SharedPtr<test::TestDesc>>& getDataMap() const { return _dataMap; } const ::bright::Vector<::bright::SharedPtr<test::TestDesc>>& getDataList() const { return _dataList; } test::TestDesc* getRaw(::bright::int32 key) { auto it = _dataMap.find(key); return it != _dataMap.end() ? it->second.get() : nullptr; } ::bright::SharedPtr<test::TestDesc> get(::bright::int32 key) { auto it = _dataMap.find(key); return it != _dataMap.end() ? it->second : nullptr; } void resolve(::bright::HashMap<::bright::String, void*>& _tables) { for(auto v : _dataList) { v->resolve(_tables); } } }; } class Tables { public: ai::TbBlackboard TbBlackboard; ai::TbBehaviorTree TbBehaviorTree; blueprint::TbClazz TbClazz; bonus::TbDrop TbDrop; common::TbGlobalConfig TbGlobalConfig; error::TbErrorInfo TbErrorInfo; error::TbCodeInfo TbCodeInfo; /** * 道具表 */ item::TbItem TbItem; item::TbItemFunc TbItemFunc; item::TbItemExtra TbItemExtra; l10n::TbL10NDemo TbL10NDemo; l10n::TbPatchDemo TbPatchDemo; mail::TbSystemMail TbSystemMail; mail::TbGlobalMail TbGlobalMail; role::TbRoleLevelExpAttr TbRoleLevelExpAttr; role::TbRoleLevelBonusCoefficient TbRoleLevelBonusCoefficient; tag::TbTestTag TbTestTag; test::TbFullTypes TbFullTypes; test::TbSingleton TbSingleton; test::TbNotIndexList TbNotIndexList; test::TbMultiUnionIndexList TbMultiUnionIndexList; test::TbMultiIndexList TbMultiIndexList; test::TbDataFromMisc TbDataFromMisc; test::TbMultiRowRecord TbMultiRowRecord; test::TbMultiRowTitle TbMultiRowTitle; test::TbTestNull TbTestNull; test::TbDemoPrimitive TbDemoPrimitive; test::TbTestString TbTestString; test::TbDemoGroup TbDemoGroup; test::TbDemoGroup_C TbDemoGroup_C; test::TbDemoGroup_S TbDemoGroup_S; test::TbDemoGroup_E TbDemoGroup_E; test::TbTestGlobal TbTestGlobal; test::TbTestBeRef TbTestBeRef; test::TbTestBeRef2 TbTestBeRef2; test::TbTestRef TbTestRef; test::TbTestSize TbTestSize; test::TbTestSet TbTestSet; test::TbDetectCsvEncoding TbDetectCsvEncoding; test::TbDefineFromExcel TbDefineFromExcel; test::TbDefineFromExcelOne TbDefineFromExcelOne; test::TbTestIndex TbTestIndex; test::TbTestMap TbTestMap; test::TbExcelFromJson TbExcelFromJson; test::TbCompositeJsonTable1 TbCompositeJsonTable1; test::TbCompositeJsonTable2 TbCompositeJsonTable2; test::TbCompositeJsonTable3 TbCompositeJsonTable3; test::TbExcelFromJsonMultiRow TbExcelFromJsonMultiRow; test::TbTestSep TbTestSep; test::TbTestExternalType TbTestExternalType; test::TbDemoGroupDefineFromExcel TbDemoGroupDefineFromExcel; test::TbDefineFromExcel2 TbDefineFromExcel2; test::TbTestExcelBean TbTestExcelBean; test::TbTestDesc TbTestDesc; bool load(::bright::Loader<ByteBuf> loader) { ::bright::HashMap<::bright::String, void*> __tables__; ByteBuf buf; if (!loader(buf, "ai_tbblackboard")) return false; if (!TbBlackboard.load(buf)) return false; __tables__["ai.TbBlackboard"] = &TbBlackboard; if (!loader(buf, "ai_tbbehaviortree")) return false; if (!TbBehaviorTree.load(buf)) return false; __tables__["ai.TbBehaviorTree"] = &TbBehaviorTree; if (!loader(buf, "blueprint_tbclazz")) return false; if (!TbClazz.load(buf)) return false; __tables__["blueprint.TbClazz"] = &TbClazz; if (!loader(buf, "bonus_tbdrop")) return false; if (!TbDrop.load(buf)) return false; __tables__["bonus.TbDrop"] = &TbDrop; if (!loader(buf, "common_tbglobalconfig")) return false; if (!TbGlobalConfig.load(buf)) return false; __tables__["common.TbGlobalConfig"] = &TbGlobalConfig; if (!loader(buf, "error_tberrorinfo")) return false; if (!TbErrorInfo.load(buf)) return false; __tables__["error.TbErrorInfo"] = &TbErrorInfo; if (!loader(buf, "error_tbcodeinfo")) return false; if (!TbCodeInfo.load(buf)) return false; __tables__["error.TbCodeInfo"] = &TbCodeInfo; if (!loader(buf, "item_tbitem")) return false; if (!TbItem.load(buf)) return false; __tables__["item.TbItem"] = &TbItem; if (!loader(buf, "item_tbitemfunc")) return false; if (!TbItemFunc.load(buf)) return false; __tables__["item.TbItemFunc"] = &TbItemFunc; if (!loader(buf, "item_tbitemextra")) return false; if (!TbItemExtra.load(buf)) return false; __tables__["item.TbItemExtra"] = &TbItemExtra; if (!loader(buf, "l10n_tbl10ndemo")) return false; if (!TbL10NDemo.load(buf)) return false; __tables__["l10n.TbL10NDemo"] = &TbL10NDemo; if (!loader(buf, "l10n_tbpatchdemo")) return false; if (!TbPatchDemo.load(buf)) return false; __tables__["l10n.TbPatchDemo"] = &TbPatchDemo; if (!loader(buf, "mail_tbsystemmail")) return false; if (!TbSystemMail.load(buf)) return false; __tables__["mail.TbSystemMail"] = &TbSystemMail; if (!loader(buf, "mail_tbglobalmail")) return false; if (!TbGlobalMail.load(buf)) return false; __tables__["mail.TbGlobalMail"] = &TbGlobalMail; if (!loader(buf, "role_tbrolelevelexpattr")) return false; if (!TbRoleLevelExpAttr.load(buf)) return false; __tables__["role.TbRoleLevelExpAttr"] = &TbRoleLevelExpAttr; if (!loader(buf, "role_tbrolelevelbonuscoefficient")) return false; if (!TbRoleLevelBonusCoefficient.load(buf)) return false; __tables__["role.TbRoleLevelBonusCoefficient"] = &TbRoleLevelBonusCoefficient; if (!loader(buf, "tag_tbtesttag")) return false; if (!TbTestTag.load(buf)) return false; __tables__["tag.TbTestTag"] = &TbTestTag; if (!loader(buf, "test_tbfulltypes")) return false; if (!TbFullTypes.load(buf)) return false; __tables__["test.TbFullTypes"] = &TbFullTypes; if (!loader(buf, "test_tbsingleton")) return false; if (!TbSingleton.load(buf)) return false; __tables__["test.TbSingleton"] = &TbSingleton; if (!loader(buf, "test_tbnotindexlist")) return false; if (!TbNotIndexList.load(buf)) return false; __tables__["test.TbNotIndexList"] = &TbNotIndexList; if (!loader(buf, "test_tbmultiunionindexlist")) return false; if (!TbMultiUnionIndexList.load(buf)) return false; __tables__["test.TbMultiUnionIndexList"] = &TbMultiUnionIndexList; if (!loader(buf, "test_tbmultiindexlist")) return false; if (!TbMultiIndexList.load(buf)) return false; __tables__["test.TbMultiIndexList"] = &TbMultiIndexList; if (!loader(buf, "test_tbdatafrommisc")) return false; if (!TbDataFromMisc.load(buf)) return false; __tables__["test.TbDataFromMisc"] = &TbDataFromMisc; if (!loader(buf, "test_tbmultirowrecord")) return false; if (!TbMultiRowRecord.load(buf)) return false; __tables__["test.TbMultiRowRecord"] = &TbMultiRowRecord; if (!loader(buf, "test_tbmultirowtitle")) return false; if (!TbMultiRowTitle.load(buf)) return false; __tables__["test.TbMultiRowTitle"] = &TbMultiRowTitle; if (!loader(buf, "test_tbtestnull")) return false; if (!TbTestNull.load(buf)) return false; __tables__["test.TbTestNull"] = &TbTestNull; if (!loader(buf, "test_tbdemoprimitive")) return false; if (!TbDemoPrimitive.load(buf)) return false; __tables__["test.TbDemoPrimitive"] = &TbDemoPrimitive; if (!loader(buf, "test_tbteststring")) return false; if (!TbTestString.load(buf)) return false; __tables__["test.TbTestString"] = &TbTestString; if (!loader(buf, "test_tbdemogroup")) return false; if (!TbDemoGroup.load(buf)) return false; __tables__["test.TbDemoGroup"] = &TbDemoGroup; if (!loader(buf, "test_tbdemogroup_c")) return false; if (!TbDemoGroup_C.load(buf)) return false; __tables__["test.TbDemoGroup_C"] = &TbDemoGroup_C; if (!loader(buf, "test_tbdemogroup_s")) return false; if (!TbDemoGroup_S.load(buf)) return false; __tables__["test.TbDemoGroup_S"] = &TbDemoGroup_S; if (!loader(buf, "test_tbdemogroup_e")) return false; if (!TbDemoGroup_E.load(buf)) return false; __tables__["test.TbDemoGroup_E"] = &TbDemoGroup_E; if (!loader(buf, "test_tbtestglobal")) return false; if (!TbTestGlobal.load(buf)) return false; __tables__["test.TbTestGlobal"] = &TbTestGlobal; if (!loader(buf, "test_tbtestberef")) return false; if (!TbTestBeRef.load(buf)) return false; __tables__["test.TbTestBeRef"] = &TbTestBeRef; if (!loader(buf, "test_tbtestberef2")) return false; if (!TbTestBeRef2.load(buf)) return false; __tables__["test.TbTestBeRef2"] = &TbTestBeRef2; if (!loader(buf, "test_tbtestref")) return false; if (!TbTestRef.load(buf)) return false; __tables__["test.TbTestRef"] = &TbTestRef; if (!loader(buf, "test_tbtestsize")) return false; if (!TbTestSize.load(buf)) return false; __tables__["test.TbTestSize"] = &TbTestSize; if (!loader(buf, "test_tbtestset")) return false; if (!TbTestSet.load(buf)) return false; __tables__["test.TbTestSet"] = &TbTestSet; if (!loader(buf, "test_tbdetectcsvencoding")) return false; if (!TbDetectCsvEncoding.load(buf)) return false; __tables__["test.TbDetectCsvEncoding"] = &TbDetectCsvEncoding; if (!loader(buf, "test_tbdefinefromexcel")) return false; if (!TbDefineFromExcel.load(buf)) return false; __tables__["test.TbDefineFromExcel"] = &TbDefineFromExcel; if (!loader(buf, "test_tbdefinefromexcelone")) return false; if (!TbDefineFromExcelOne.load(buf)) return false; __tables__["test.TbDefineFromExcelOne"] = &TbDefineFromExcelOne; if (!loader(buf, "test_tbtestindex")) return false; if (!TbTestIndex.load(buf)) return false; __tables__["test.TbTestIndex"] = &TbTestIndex; if (!loader(buf, "test_tbtestmap")) return false; if (!TbTestMap.load(buf)) return false; __tables__["test.TbTestMap"] = &TbTestMap; if (!loader(buf, "test_tbexcelfromjson")) return false; if (!TbExcelFromJson.load(buf)) return false; __tables__["test.TbExcelFromJson"] = &TbExcelFromJson; if (!loader(buf, "test_tbcompositejsontable1")) return false; if (!TbCompositeJsonTable1.load(buf)) return false; __tables__["test.TbCompositeJsonTable1"] = &TbCompositeJsonTable1; if (!loader(buf, "test_tbcompositejsontable2")) return false; if (!TbCompositeJsonTable2.load(buf)) return false; __tables__["test.TbCompositeJsonTable2"] = &TbCompositeJsonTable2; if (!loader(buf, "test_tbcompositejsontable3")) return false; if (!TbCompositeJsonTable3.load(buf)) return false; __tables__["test.TbCompositeJsonTable3"] = &TbCompositeJsonTable3; if (!loader(buf, "test_tbexcelfromjsonmultirow")) return false; if (!TbExcelFromJsonMultiRow.load(buf)) return false; __tables__["test.TbExcelFromJsonMultiRow"] = &TbExcelFromJsonMultiRow; if (!loader(buf, "test_tbtestsep")) return false; if (!TbTestSep.load(buf)) return false; __tables__["test.TbTestSep"] = &TbTestSep; if (!loader(buf, "test_tbtestexternaltype")) return false; if (!TbTestExternalType.load(buf)) return false; __tables__["test.TbTestExternalType"] = &TbTestExternalType; if (!loader(buf, "test_tbdemogroupdefinefromexcel")) return false; if (!TbDemoGroupDefineFromExcel.load(buf)) return false; __tables__["test.TbDemoGroupDefineFromExcel"] = &TbDemoGroupDefineFromExcel; if (!loader(buf, "test_tbdefinefromexcel2")) return false; if (!TbDefineFromExcel2.load(buf)) return false; __tables__["test.TbDefineFromExcel2"] = &TbDefineFromExcel2; if (!loader(buf, "test_tbtestexcelbean")) return false; if (!TbTestExcelBean.load(buf)) return false; __tables__["test.TbTestExcelBean"] = &TbTestExcelBean; if (!loader(buf, "test_tbtestdesc")) return false; if (!TbTestDesc.load(buf)) return false; __tables__["test.TbTestDesc"] = &TbTestDesc; TbBlackboard.resolve(__tables__); TbBehaviorTree.resolve(__tables__); TbClazz.resolve(__tables__); TbDrop.resolve(__tables__); TbGlobalConfig.resolve(__tables__); TbErrorInfo.resolve(__tables__); TbCodeInfo.resolve(__tables__); TbItem.resolve(__tables__); TbItemFunc.resolve(__tables__); TbItemExtra.resolve(__tables__); TbL10NDemo.resolve(__tables__); TbPatchDemo.resolve(__tables__); TbSystemMail.resolve(__tables__); TbGlobalMail.resolve(__tables__); TbRoleLevelExpAttr.resolve(__tables__); TbRoleLevelBonusCoefficient.resolve(__tables__); TbTestTag.resolve(__tables__); TbFullTypes.resolve(__tables__); TbSingleton.resolve(__tables__); TbNotIndexList.resolve(__tables__); TbMultiUnionIndexList.resolve(__tables__); TbMultiIndexList.resolve(__tables__); TbDataFromMisc.resolve(__tables__); TbMultiRowRecord.resolve(__tables__); TbMultiRowTitle.resolve(__tables__); TbTestNull.resolve(__tables__); TbDemoPrimitive.resolve(__tables__); TbTestString.resolve(__tables__); TbDemoGroup.resolve(__tables__); TbDemoGroup_C.resolve(__tables__); TbDemoGroup_S.resolve(__tables__); TbDemoGroup_E.resolve(__tables__); TbTestGlobal.resolve(__tables__); TbTestBeRef.resolve(__tables__); TbTestBeRef2.resolve(__tables__); TbTestRef.resolve(__tables__); TbTestSize.resolve(__tables__); TbTestSet.resolve(__tables__); TbDetectCsvEncoding.resolve(__tables__); TbDefineFromExcel.resolve(__tables__); TbDefineFromExcelOne.resolve(__tables__); TbTestIndex.resolve(__tables__); TbTestMap.resolve(__tables__); TbExcelFromJson.resolve(__tables__); TbCompositeJsonTable1.resolve(__tables__); TbCompositeJsonTable2.resolve(__tables__); TbCompositeJsonTable3.resolve(__tables__); TbExcelFromJsonMultiRow.resolve(__tables__); TbTestSep.resolve(__tables__); TbTestExternalType.resolve(__tables__); TbDemoGroupDefineFromExcel.resolve(__tables__); TbDefineFromExcel2.resolve(__tables__); TbTestExcelBean.resolve(__tables__); TbTestDesc.resolve(__tables__); return true; } }; } <|start_filename|>Projects/Csharp_CustomTemplate_EncryptMemory/Gen/mail/GlobalMail.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using System; using Newtonsoft.Json; using Scripts; namespace cfg.mail { [Serializable] public partial class GlobalMail : AConfig { public string title { get; set; } public string sender { get; set; } public string content { get; set; } public System.Collections.Generic.List<int> award { get; set; } public bool all_server { get; set; } public System.Collections.Generic.List<int> server_list { get; set; } public string platform { get; set; } public string channel { get; set; } [JsonProperty] public condition.MinMaxLevel min_max_level { get; set; } [JsonProperty] public condition.TimeRange register_time { get; set; } [JsonProperty] public condition.TimeRange mail_time { get; set; } public override void EndInit() { min_max_level.EndInit(); register_time.EndInit(); mail_time.EndInit(); } public override string ToString() => JsonConvert.SerializeObject(this); } } <|start_filename|>Projects/Go_json/gen/src/cfg/role.BonusInfo.go<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg import "errors" type RoleBonusInfo struct { Type int32 Coefficient float32 } const TypeId_RoleBonusInfo = -1354421803 func (*RoleBonusInfo) GetTypeId() int32 { return -1354421803 } func (_v *RoleBonusInfo)Deserialize(_buf map[string]interface{}) (err error) { { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["type"].(float64); !_ok_ { err = errors.New("type error"); return }; _v.Type = int32(_tempNum_) } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["coefficient"].(float64); !_ok_ { err = errors.New("coefficient error"); return }; _v.Coefficient = float32(_tempNum_) } return } func DeserializeRoleBonusInfo(_buf map[string]interface{}) (*RoleBonusInfo, error) { v := &RoleBonusInfo{} if err := v.Deserialize(_buf); err == nil { return v, nil } else { return nil, err } } <|start_filename|>Projects/CfgValidator/AssertExtensions.cs<|end_filename|> using System; using Microsoft.VisualStudio.TestTools.UnitTesting; using CfgCheck; namespace CfgCheck { public static class AssertExtensions { } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_StackTraceUtility_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_StackTraceUtility_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.StackTraceUtility constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_ExtractStackTrace(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { { var result = UnityEngine.StackTraceUtility.ExtractStackTrace(); Puerts.PuertsDLL.ReturnString(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_ExtractStringFromException(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.Object>(false); var result = UnityEngine.StackTraceUtility.ExtractStringFromException(Arg0); Puerts.PuertsDLL.ReturnString(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "ExtractStackTrace", IsStatic = true}, F_ExtractStackTrace }, { new Puerts.MethodKey {Name = "ExtractStringFromException", IsStatic = true}, F_ExtractStringFromException }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { } }; } } } <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/role/DistinctBonusInfos.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.role { public sealed partial class DistinctBonusInfos : Bright.Config.BeanBase { public DistinctBonusInfos(ByteBuf _buf) { EffectiveLevel = _buf.ReadInt(); {int n = System.Math.Min(_buf.ReadSize(), _buf.Size);BonusInfo = new System.Collections.Generic.List<role.BonusInfo>(n);for(var i = 0 ; i < n ; i++) { role.BonusInfo _e; _e = role.BonusInfo.DeserializeBonusInfo(_buf); BonusInfo.Add(_e);}} } public DistinctBonusInfos(int effective_level, System.Collections.Generic.List<role.BonusInfo> bonus_info ) { this.EffectiveLevel = effective_level; this.BonusInfo = bonus_info; } public static DistinctBonusInfos DeserializeDistinctBonusInfos(ByteBuf _buf) { return new role.DistinctBonusInfos(_buf); } public readonly int EffectiveLevel; public readonly System.Collections.Generic.List<role.BonusInfo> BonusInfo; public const int ID = -854361766; public override int GetTypeId() => ID; public void Resolve(Dictionary<string, object> _tables) { foreach(var _e in BonusInfo) { _e?.Resolve(_tables); } OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); public override string ToString() { return "{ " + "EffectiveLevel:" + EffectiveLevel + "," + "BonusInfo:" + Bright.Common.StringUtil.CollectionToString(BonusInfo) + "," + "}"; } } } <|start_filename|>Projects/GenerateDatas/convert_lua/role.TbRoleLevelExpAttr/41.lua<|end_filename|> return { level = 41, need_exp = 34000, clothes_attrs = { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, }, } <|start_filename|>Projects/java_json/src/gen/cfg/condition/Condition.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.condition; import com.google.gson.JsonElement; import com.google.gson.JsonObject; public abstract class Condition { public Condition(JsonObject __json__) { } public Condition() { } public static Condition deserializeCondition(JsonObject __json__) { switch (__json__.get("__type__").getAsString()) { case "TimeRange": return new cfg.condition.TimeRange(__json__); case "MultiRoleCondition": return new cfg.condition.MultiRoleCondition(__json__); case "GenderLimit": return new cfg.condition.GenderLimit(__json__); case "MinLevel": return new cfg.condition.MinLevel(__json__); case "MaxLevel": return new cfg.condition.MaxLevel(__json__); case "MinMaxLevel": return new cfg.condition.MinMaxLevel(__json__); case "ClothesPropertyScoreGreaterThan": return new cfg.condition.ClothesPropertyScoreGreaterThan(__json__); case "ContainsItem": return new cfg.condition.ContainsItem(__json__); default: throw new bright.serialization.SerializationException(); } } public abstract int getTypeId(); public void resolve(java.util.HashMap<String, Object> _tables) { } @Override public String toString() { return "{ " + "}"; } } <|start_filename|>Projects/Csharp_Unity_bin_use_UnityEngine_Vector/Assets/Gen/bonus/WeightBonus.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.bonus { public sealed class WeightBonus : bonus.Bonus { public WeightBonus(ByteBuf _buf) : base(_buf) { {int n = System.Math.Min(_buf.ReadSize(), _buf.Size);Bonuses = new bonus.WeightBonusInfo[n];for(var i = 0 ; i < n ; i++) { bonus.WeightBonusInfo _e;_e = bonus.WeightBonusInfo.DeserializeWeightBonusInfo(_buf); Bonuses[i] = _e;}} } public static WeightBonus DeserializeWeightBonus(ByteBuf _buf) { return new bonus.WeightBonus(_buf); } public bonus.WeightBonusInfo[] Bonuses { get; private set; } public const int __ID__ = -362807016; public override int GetTypeId() => __ID__; public override void Resolve(Dictionary<string, object> _tables) { base.Resolve(_tables); foreach(var _e in Bonuses) { _e?.Resolve(_tables); } } public override void TranslateText(System.Func<string, string, string> translator) { base.TranslateText(translator); foreach(var _e in Bonuses) { _e?.TranslateText(translator); } } public override string ToString() { return "{ " + "Bonuses:" + Bright.Common.StringUtil.CollectionToString(Bonuses) + "," + "}"; } } } <|start_filename|>Projects/GenerateDatas/convert_lua/error.TbCodeInfo/902.lua<|end_filename|> return { code = 902, key = "SUIT_STATE_ERROR", } <|start_filename|>Projects/Csharp_Unity_bin_use_UnityEngine_Vector/Assets/Gen/ai/Node.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.ai { public abstract class Node : Bright.Config.BeanBase { public Node(ByteBuf _buf) { Id = _buf.ReadInt(); NodeName = _buf.ReadString(); } public static Node DeserializeNode(ByteBuf _buf) { switch (_buf.ReadInt()) { case ai.UeSetDefaultFocus.__ID__: return new ai.UeSetDefaultFocus(_buf); case ai.ExecuteTimeStatistic.__ID__: return new ai.ExecuteTimeStatistic(_buf); case ai.ChooseTarget.__ID__: return new ai.ChooseTarget(_buf); case ai.KeepFaceTarget.__ID__: return new ai.KeepFaceTarget(_buf); case ai.GetOwnerPlayer.__ID__: return new ai.GetOwnerPlayer(_buf); case ai.UpdateDailyBehaviorProps.__ID__: return new ai.UpdateDailyBehaviorProps(_buf); case ai.UeLoop.__ID__: return new ai.UeLoop(_buf); case ai.UeCooldown.__ID__: return new ai.UeCooldown(_buf); case ai.UeTimeLimit.__ID__: return new ai.UeTimeLimit(_buf); case ai.UeBlackboard.__ID__: return new ai.UeBlackboard(_buf); case ai.UeForceSuccess.__ID__: return new ai.UeForceSuccess(_buf); case ai.IsAtLocation.__ID__: return new ai.IsAtLocation(_buf); case ai.DistanceLessThan.__ID__: return new ai.DistanceLessThan(_buf); case ai.Sequence.__ID__: return new ai.Sequence(_buf); case ai.Selector.__ID__: return new ai.Selector(_buf); case ai.SimpleParallel.__ID__: return new ai.SimpleParallel(_buf); case ai.UeWait.__ID__: return new ai.UeWait(_buf); case ai.UeWaitBlackboardTime.__ID__: return new ai.UeWaitBlackboardTime(_buf); case ai.MoveToTarget.__ID__: return new ai.MoveToTarget(_buf); case ai.ChooseSkill.__ID__: return new ai.ChooseSkill(_buf); case ai.MoveToRandomLocation.__ID__: return new ai.MoveToRandomLocation(_buf); case ai.MoveToLocation.__ID__: return new ai.MoveToLocation(_buf); case ai.DebugPrint.__ID__: return new ai.DebugPrint(_buf); default: throw new SerializationException(); } } public int Id { get; private set; } public string NodeName { get; private set; } public virtual void Resolve(Dictionary<string, object> _tables) { } public virtual void TranslateText(System.Func<string, string, string> translator) { } public override string ToString() { return "{ " + "Id:" + Id + "," + "NodeName:" + NodeName + "," + "}"; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_Ray_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_Ray_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3>(false); var result = new UnityEngine.Ray(Arg0,Arg1); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.Ray), result); } } if (paramLen == 0) { { var result = new UnityEngine.Ray(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.Ray), result); } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.Ray constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetPoint(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Ray)Puerts.Utils.GetSelf((int)data, self); { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetFloat(false); var result = obj.GetPoint(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ToString(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Ray)Puerts.Utils.GetSelf((int)data, self); if (paramLen == 0) { { var result = obj.ToString(); Puerts.PuertsDLL.ReturnString(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var result = obj.ToString(Arg0); Puerts.PuertsDLL.ReturnString(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.IFormatProvider), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<System.IFormatProvider>(false); var result = obj.ToString(Arg0,Arg1); Puerts.PuertsDLL.ReturnString(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to ToString"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_origin(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Ray)Puerts.Utils.GetSelf((int)data, self); var result = obj.origin; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_origin(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Ray)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.origin = argHelper.Get<UnityEngine.Vector3>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_direction(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Ray)Puerts.Utils.GetSelf((int)data, self); var result = obj.direction; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_direction(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Ray)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.direction = argHelper.Get<UnityEngine.Vector3>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "GetPoint", IsStatic = false}, M_GetPoint }, { new Puerts.MethodKey {Name = "ToString", IsStatic = false}, M_ToString }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"origin", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_origin, Setter = S_origin} }, {"direction", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_direction, Setter = S_direction} }, } }; } } } <|start_filename|>Projects/Java_bin/src/main/gen/cfg/test/DateTimeRange.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.test; import bright.serialization.*; public final class DateTimeRange { public DateTimeRange(ByteBuf _buf) { startTime = _buf.readInt(); endTime = _buf.readInt(); } public DateTimeRange(int start_time, int end_time ) { this.startTime = start_time; this.endTime = end_time; } public final int startTime; public final int endTime; public void resolve(java.util.HashMap<String, Object> _tables) { } @Override public String toString() { return "{ " + "startTime:" + startTime + "," + "endTime:" + endTime + "," + "}"; } } <|start_filename|>Projects/java_json/src/gen/cfg/error/EOperation.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.error; public enum EOperation { /** * 登出 */ LOGOUT(0), /** * 重启 */ RESTART(1), ; private final int value; public int getValue() { return value; } EOperation(int value) { this.value = value; } public static EOperation valueOf(int value) { if (value == 0) return LOGOUT; if (value == 1) return RESTART; throw new IllegalArgumentException(""); } } <|start_filename|>Projects/GenerateDatas/convert_lua/role.TbRoleLevelExpAttr/27.lua<|end_filename|> return { level = 27, need_exp = 9500, clothes_attrs = { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, }, } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_SortingLayer_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_SortingLayer_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.SortingLayer constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetLayerValueFromID(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); var result = UnityEngine.SortingLayer.GetLayerValueFromID(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetLayerValueFromName(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetString(false); var result = UnityEngine.SortingLayer.GetLayerValueFromName(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_NameToID(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetString(false); var result = UnityEngine.SortingLayer.NameToID(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_IDToName(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); var result = UnityEngine.SortingLayer.IDToName(Arg0); Puerts.PuertsDLL.ReturnString(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_IsValid(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); var result = UnityEngine.SortingLayer.IsValid(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_id(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.SortingLayer)Puerts.Utils.GetSelf((int)data, self); var result = obj.id; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_name(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.SortingLayer)Puerts.Utils.GetSelf((int)data, self); var result = obj.name; Puerts.PuertsDLL.ReturnString(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_value(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.SortingLayer)Puerts.Utils.GetSelf((int)data, self); var result = obj.value; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_layers(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.SortingLayer.layers; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "GetLayerValueFromID", IsStatic = true}, F_GetLayerValueFromID }, { new Puerts.MethodKey {Name = "GetLayerValueFromName", IsStatic = true}, F_GetLayerValueFromName }, { new Puerts.MethodKey {Name = "NameToID", IsStatic = true}, F_NameToID }, { new Puerts.MethodKey {Name = "IDToName", IsStatic = true}, F_IDToName }, { new Puerts.MethodKey {Name = "IsValid", IsStatic = true}, F_IsValid }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"id", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_id, Setter = null} }, {"name", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_name, Setter = null} }, {"value", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_value, Setter = null} }, {"layers", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_layers, Setter = null} }, } }; } } } <|start_filename|>Projects/Csharp_CustomTemplate_ExternalCodeTemplate/Program.cs<|end_filename|> using Bright.Serialization; using System; using System.IO; using System.Text.Json; using System.Threading.Tasks; namespace Csharp_Server_DotNetCore { class Program { static async Task Main(string[] args) { var tables = new cfg.Tables(); await tables.LoadAsync(file => Task.Run(() => JsonDocument.Parse(System.IO.File.ReadAllBytes("../../../../GenerateDatas/json/" + file + ".json")).RootElement)); Console.WriteLine("== load succ =="); } } } <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/ai/UeCooldown.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.ai { public sealed partial class UeCooldown : ai.Decorator { public UeCooldown(ByteBuf _buf) : base(_buf) { CooldownTime = _buf.ReadFloat(); } public UeCooldown(int id, string node_name, ai.EFlowAbortMode flow_abort_mode, float cooldown_time ) : base(id,node_name,flow_abort_mode) { this.CooldownTime = cooldown_time; } public static UeCooldown DeserializeUeCooldown(ByteBuf _buf) { return new ai.UeCooldown(_buf); } public readonly float CooldownTime; public const int ID = -951439423; public override int GetTypeId() => ID; public override void Resolve(Dictionary<string, object> _tables) { base.Resolve(_tables); OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); public override string ToString() { return "{ " + "Id:" + Id + "," + "NodeName:" + NodeName + "," + "FlowAbortMode:" + FlowAbortMode + "," + "CooldownTime:" + CooldownTime + "," + "}"; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_UI_Navigation_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_UI_Navigation_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.UI.Navigation constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Equals(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.UI.Navigation)Puerts.Utils.GetSelf((int)data, self); { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.UI.Navigation>(false); var result = obj.Equals(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_mode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.UI.Navigation)Puerts.Utils.GetSelf((int)data, self); var result = obj.mode; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_mode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.UI.Navigation)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.mode = (UnityEngine.UI.Navigation.Mode)argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_wrapAround(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.UI.Navigation)Puerts.Utils.GetSelf((int)data, self); var result = obj.wrapAround; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_wrapAround(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.UI.Navigation)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.wrapAround = argHelper.GetBoolean(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_selectOnUp(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.UI.Navigation)Puerts.Utils.GetSelf((int)data, self); var result = obj.selectOnUp; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_selectOnUp(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.UI.Navigation)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.selectOnUp = argHelper.Get<UnityEngine.UI.Selectable>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_selectOnDown(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.UI.Navigation)Puerts.Utils.GetSelf((int)data, self); var result = obj.selectOnDown; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_selectOnDown(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.UI.Navigation)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.selectOnDown = argHelper.Get<UnityEngine.UI.Selectable>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_selectOnLeft(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.UI.Navigation)Puerts.Utils.GetSelf((int)data, self); var result = obj.selectOnLeft; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_selectOnLeft(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.UI.Navigation)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.selectOnLeft = argHelper.Get<UnityEngine.UI.Selectable>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_selectOnRight(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.UI.Navigation)Puerts.Utils.GetSelf((int)data, self); var result = obj.selectOnRight; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_selectOnRight(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.UI.Navigation)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.selectOnRight = argHelper.Get<UnityEngine.UI.Selectable>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_defaultNavigation(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.UI.Navigation.defaultNavigation; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "Equals", IsStatic = false}, M_Equals }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"mode", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_mode, Setter = S_mode} }, {"wrapAround", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_wrapAround, Setter = S_wrapAround} }, {"selectOnUp", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_selectOnUp, Setter = S_selectOnUp} }, {"selectOnDown", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_selectOnDown, Setter = S_selectOnDown} }, {"selectOnLeft", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_selectOnLeft, Setter = S_selectOnLeft} }, {"selectOnRight", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_selectOnRight, Setter = S_selectOnRight} }, {"defaultNavigation", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_defaultNavigation, Setter = null} }, } }; } } } <|start_filename|>Projects/Csharp_CustomTemplate_EncryptMemory/Gen/test/TestMap.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using System; using Newtonsoft.Json; using Scripts; namespace cfg.test { [Serializable] public partial class TestMap : AConfig { public System.Collections.Generic.Dictionary<int, int> x1 { get; set; } public System.Collections.Generic.Dictionary<long, int> x2 { get; set; } public System.Collections.Generic.Dictionary<string, int> x3 { get; set; } public System.Collections.Generic.Dictionary<test.DemoEnum, int> x4 { get; set; } public override void EndInit() { } public override string ToString() => JsonConvert.SerializeObject(this); } } <|start_filename|>Projects/Java_bin/src/main/gen/cfg/blueprint/ExternalMethod.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.blueprint; import bright.serialization.*; public final class ExternalMethod extends cfg.blueprint.Method { public ExternalMethod(ByteBuf _buf) { super(_buf); } public ExternalMethod(String name, String desc, boolean is_static, String return_type, java.util.ArrayList<cfg.blueprint.ParamInfo> parameters ) { super(name, desc, is_static, return_type, parameters); } public static final int __ID__ = 1739079015; @Override public int getTypeId() { return __ID__; } @Override public void resolve(java.util.HashMap<String, Object> _tables) { super.resolve(_tables); } @Override public String toString() { return "{ " + "name:" + name + "," + "desc:" + desc + "," + "isStatic:" + isStatic + "," + "returnType:" + returnType + "," + "parameters:" + parameters + "," + "}"; } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_Quaternion_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_Quaternion_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.GetFloat(false); var result = new UnityEngine.Quaternion(Arg0,Arg1,Arg2,Arg3); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.Quaternion), result); } } if (paramLen == 0) { { var result = new UnityEngine.Quaternion(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.Quaternion), result); } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.Quaternion constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_FromToRotation(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3>(false); var result = UnityEngine.Quaternion.FromToRotation(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_Inverse(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Quaternion>(false); var result = UnityEngine.Quaternion.Inverse(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_Slerp(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.Get<UnityEngine.Quaternion>(false); var Arg1 = argHelper1.Get<UnityEngine.Quaternion>(false); var Arg2 = argHelper2.GetFloat(false); var result = UnityEngine.Quaternion.Slerp(Arg0,Arg1,Arg2); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_SlerpUnclamped(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.Get<UnityEngine.Quaternion>(false); var Arg1 = argHelper1.Get<UnityEngine.Quaternion>(false); var Arg2 = argHelper2.GetFloat(false); var result = UnityEngine.Quaternion.SlerpUnclamped(Arg0,Arg1,Arg2); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_Lerp(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.Get<UnityEngine.Quaternion>(false); var Arg1 = argHelper1.Get<UnityEngine.Quaternion>(false); var Arg2 = argHelper2.GetFloat(false); var result = UnityEngine.Quaternion.Lerp(Arg0,Arg1,Arg2); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_LerpUnclamped(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.Get<UnityEngine.Quaternion>(false); var Arg1 = argHelper1.Get<UnityEngine.Quaternion>(false); var Arg2 = argHelper2.GetFloat(false); var result = UnityEngine.Quaternion.LerpUnclamped(Arg0,Arg1,Arg2); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_AngleAxis(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3>(false); var result = UnityEngine.Quaternion.AngleAxis(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_LookRotation(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3>(false); var result = UnityEngine.Quaternion.LookRotation(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var result = UnityEngine.Quaternion.LookRotation(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to LookRotation"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Set(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Quaternion)Puerts.Utils.GetSelf((int)data, self); { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.GetFloat(false); obj.Set(Arg0,Arg1,Arg2,Arg3); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_Dot(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<UnityEngine.Quaternion>(false); var Arg1 = argHelper1.Get<UnityEngine.Quaternion>(false); var result = UnityEngine.Quaternion.Dot(Arg0,Arg1); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetLookRotation(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Quaternion)Puerts.Utils.GetSelf((int)data, self); if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); obj.SetLookRotation(Arg0); Puerts.Utils.SetSelf((int)data, self, obj); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3>(false); obj.SetLookRotation(Arg0,Arg1); Puerts.Utils.SetSelf((int)data, self, obj); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SetLookRotation"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_Angle(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<UnityEngine.Quaternion>(false); var Arg1 = argHelper1.Get<UnityEngine.Quaternion>(false); var result = UnityEngine.Quaternion.Angle(Arg0,Arg1); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_Euler(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.GetFloat(false); var result = UnityEngine.Quaternion.Euler(Arg0,Arg1,Arg2); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var result = UnityEngine.Quaternion.Euler(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to Euler"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ToAngleAxis(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Quaternion)Puerts.Utils.GetSelf((int)data, self); { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.GetFloat(true); var Arg1 = argHelper1.Get<UnityEngine.Vector3>(true); obj.ToAngleAxis(out Arg0,out Arg1); argHelper0.SetByRefValue(Arg0); argHelper1.SetByRefValue(Arg1); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetFromToRotation(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Quaternion)Puerts.Utils.GetSelf((int)data, self); { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3>(false); obj.SetFromToRotation(Arg0,Arg1); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_RotateTowards(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.Get<UnityEngine.Quaternion>(false); var Arg1 = argHelper1.Get<UnityEngine.Quaternion>(false); var Arg2 = argHelper2.GetFloat(false); var result = UnityEngine.Quaternion.RotateTowards(Arg0,Arg1,Arg2); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_Normalize(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Quaternion>(false); var result = UnityEngine.Quaternion.Normalize(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Normalize(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Quaternion)Puerts.Utils.GetSelf((int)data, self); { { obj.Normalize(); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetHashCode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Quaternion)Puerts.Utils.GetSelf((int)data, self); { { var result = obj.GetHashCode(); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Equals(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Quaternion)Puerts.Utils.GetSelf((int)data, self); if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.Any, typeof(System.Object), false, false)) { var Arg0 = argHelper0.Get<System.Object>(false); var result = obj.Equals(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Quaternion), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Quaternion>(false); var result = obj.Equals(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to Equals"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ToString(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Quaternion)Puerts.Utils.GetSelf((int)data, self); if (paramLen == 0) { { var result = obj.ToString(); Puerts.PuertsDLL.ReturnString(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var result = obj.ToString(Arg0); Puerts.PuertsDLL.ReturnString(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.IFormatProvider), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<System.IFormatProvider>(false); var result = obj.ToString(Arg0,Arg1); Puerts.PuertsDLL.ReturnString(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to ToString"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_identity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Quaternion.identity; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_eulerAngles(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Quaternion)Puerts.Utils.GetSelf((int)data, self); var result = obj.eulerAngles; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_eulerAngles(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Quaternion)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.eulerAngles = argHelper.Get<UnityEngine.Vector3>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_normalized(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Quaternion)Puerts.Utils.GetSelf((int)data, self); var result = obj.normalized; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_x(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Quaternion)Puerts.Utils.GetSelf((int)data, self); var result = obj.x; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_x(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Quaternion)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.x = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_y(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Quaternion)Puerts.Utils.GetSelf((int)data, self); var result = obj.y; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_y(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Quaternion)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.y = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_z(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Quaternion)Puerts.Utils.GetSelf((int)data, self); var result = obj.z; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_z(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Quaternion)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.z = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_w(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Quaternion)Puerts.Utils.GetSelf((int)data, self); var result = obj.w; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_w(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Quaternion)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.w = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_kEpsilon(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Quaternion.kEpsilon; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void GetItem(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Quaternion)Puerts.Utils.GetSelf((int)data, self); var keyHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (keyHelper.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var key = keyHelper.GetInt32(false); var result = obj[key]; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void SetItem(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Quaternion)Puerts.Utils.GetSelf((int)data, self); var keyHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var valueHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (keyHelper.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var key = keyHelper.GetInt32(false); obj[key] = valueHelper.GetFloat(false); return; } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void O_op_Multiply(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Quaternion), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Quaternion), false, false)) { var arg0 = argHelper0.Get<UnityEngine.Quaternion>(false); var arg1 = argHelper1.Get<UnityEngine.Quaternion>(false); var result = arg0 * arg1; Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Quaternion), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false)) { var arg0 = argHelper0.Get<UnityEngine.Quaternion>(false); var arg1 = argHelper1.Get<UnityEngine.Vector3>(false); var result = arg0 * arg1; Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to op_Multiply"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void O_op_Equality(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var arg0 = argHelper0.Get<UnityEngine.Quaternion>(false); var arg1 = argHelper1.Get<UnityEngine.Quaternion>(false); var result = arg0 == arg1; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void O_op_Inequality(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var arg0 = argHelper0.Get<UnityEngine.Quaternion>(false); var arg1 = argHelper1.Get<UnityEngine.Quaternion>(false); var result = arg0 != arg1; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "FromToRotation", IsStatic = true}, F_FromToRotation }, { new Puerts.MethodKey {Name = "Inverse", IsStatic = true}, F_Inverse }, { new Puerts.MethodKey {Name = "Slerp", IsStatic = true}, F_Slerp }, { new Puerts.MethodKey {Name = "SlerpUnclamped", IsStatic = true}, F_SlerpUnclamped }, { new Puerts.MethodKey {Name = "Lerp", IsStatic = true}, F_Lerp }, { new Puerts.MethodKey {Name = "LerpUnclamped", IsStatic = true}, F_LerpUnclamped }, { new Puerts.MethodKey {Name = "AngleAxis", IsStatic = true}, F_AngleAxis }, { new Puerts.MethodKey {Name = "LookRotation", IsStatic = true}, F_LookRotation }, { new Puerts.MethodKey {Name = "Set", IsStatic = false}, M_Set }, { new Puerts.MethodKey {Name = "Dot", IsStatic = true}, F_Dot }, { new Puerts.MethodKey {Name = "SetLookRotation", IsStatic = false}, M_SetLookRotation }, { new Puerts.MethodKey {Name = "Angle", IsStatic = true}, F_Angle }, { new Puerts.MethodKey {Name = "Euler", IsStatic = true}, F_Euler }, { new Puerts.MethodKey {Name = "ToAngleAxis", IsStatic = false}, M_ToAngleAxis }, { new Puerts.MethodKey {Name = "SetFromToRotation", IsStatic = false}, M_SetFromToRotation }, { new Puerts.MethodKey {Name = "RotateTowards", IsStatic = true}, F_RotateTowards }, { new Puerts.MethodKey {Name = "Normalize", IsStatic = true}, F_Normalize }, { new Puerts.MethodKey {Name = "Normalize", IsStatic = false}, M_Normalize }, { new Puerts.MethodKey {Name = "GetHashCode", IsStatic = false}, M_GetHashCode }, { new Puerts.MethodKey {Name = "Equals", IsStatic = false}, M_Equals }, { new Puerts.MethodKey {Name = "ToString", IsStatic = false}, M_ToString }, { new Puerts.MethodKey {Name = "get_Item", IsStatic = false}, GetItem }, { new Puerts.MethodKey {Name = "set_Item", IsStatic = false}, SetItem}, { new Puerts.MethodKey {Name = "op_Multiply", IsStatic = true}, O_op_Multiply}, { new Puerts.MethodKey {Name = "op_Equality", IsStatic = true}, O_op_Equality}, { new Puerts.MethodKey {Name = "op_Inequality", IsStatic = true}, O_op_Inequality}, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"identity", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_identity, Setter = null} }, {"eulerAngles", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_eulerAngles, Setter = S_eulerAngles} }, {"normalized", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_normalized, Setter = null} }, {"x", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_x, Setter = S_x} }, {"y", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_y, Setter = S_y} }, {"z", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_z, Setter = S_z} }, {"w", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_w, Setter = S_w} }, {"kEpsilon", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_kEpsilon, Setter = null} }, } }; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_UI_Shadow_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_UI_Shadow_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.UI.Shadow constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ModifyMesh(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Shadow; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.UI.VertexHelper>(false); obj.ModifyMesh(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_effectColor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Shadow; var result = obj.effectColor; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_effectColor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Shadow; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.effectColor = argHelper.Get<UnityEngine.Color>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_effectDistance(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Shadow; var result = obj.effectDistance; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_effectDistance(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Shadow; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.effectDistance = argHelper.Get<UnityEngine.Vector2>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_useGraphicAlpha(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Shadow; var result = obj.useGraphicAlpha; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_useGraphicAlpha(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Shadow; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.useGraphicAlpha = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "ModifyMesh", IsStatic = false}, M_ModifyMesh }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"effectColor", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_effectColor, Setter = S_effectColor} }, {"effectDistance", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_effectDistance, Setter = S_effectDistance} }, {"useGraphicAlpha", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_useGraphicAlpha, Setter = S_useGraphicAlpha} }, } }; } } } <|start_filename|>Projects/CfgValidator/Gen/test/TestRef.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; using System.Text.Json; namespace cfg.test { public sealed class TestRef : Bright.Config.BeanBase { public TestRef(JsonElement _json) { Id = _json.GetProperty("id").GetInt32(); X1 = _json.GetProperty("x1").GetInt32(); X12 = _json.GetProperty("x1_2").GetInt32(); X2 = _json.GetProperty("x2").GetInt32(); { var _json0 = _json.GetProperty("a1"); int _n = _json0.GetArrayLength(); A1 = new int[_n]; int _index=0; foreach(JsonElement __e in _json0.EnumerateArray()) { int __v; __v = __e.GetInt32(); A1[_index++] = __v; } } { var _json0 = _json.GetProperty("a2"); int _n = _json0.GetArrayLength(); A2 = new int[_n]; int _index=0; foreach(JsonElement __e in _json0.EnumerateArray()) { int __v; __v = __e.GetInt32(); A2[_index++] = __v; } } { var _json0 = _json.GetProperty("b1"); B1 = new System.Collections.Generic.List<int>(_json0.GetArrayLength()); foreach(JsonElement __e in _json0.EnumerateArray()) { int __v; __v = __e.GetInt32(); B1.Add(__v); } } { var _json0 = _json.GetProperty("b2"); B2 = new System.Collections.Generic.List<int>(_json0.GetArrayLength()); foreach(JsonElement __e in _json0.EnumerateArray()) { int __v; __v = __e.GetInt32(); B2.Add(__v); } } { var _json0 = _json.GetProperty("c1"); C1 = new System.Collections.Generic.HashSet<int>(_json0.GetArrayLength()); foreach(JsonElement __e in _json0.EnumerateArray()) { int __v; __v = __e.GetInt32(); C1.Add(__v); } } { var _json0 = _json.GetProperty("c2"); C2 = new System.Collections.Generic.HashSet<int>(_json0.GetArrayLength()); foreach(JsonElement __e in _json0.EnumerateArray()) { int __v; __v = __e.GetInt32(); C2.Add(__v); } } { var _json0 = _json.GetProperty("d1"); D1 = new System.Collections.Generic.Dictionary<int, int>(_json0.GetArrayLength()); foreach(JsonElement __e in _json0.EnumerateArray()) { int __k; __k = __e[0].GetInt32(); int __v; __v = __e[1].GetInt32(); D1.Add(__k, __v); } } { var _json0 = _json.GetProperty("d2"); D2 = new System.Collections.Generic.Dictionary<int, int>(_json0.GetArrayLength()); foreach(JsonElement __e in _json0.EnumerateArray()) { int __k; __k = __e[0].GetInt32(); int __v; __v = __e[1].GetInt32(); D2.Add(__k, __v); } } } public TestRef(int id, int x1, int x1_2, int x2, int[] a1, int[] a2, System.Collections.Generic.List<int> b1, System.Collections.Generic.List<int> b2, System.Collections.Generic.HashSet<int> c1, System.Collections.Generic.HashSet<int> c2, System.Collections.Generic.Dictionary<int, int> d1, System.Collections.Generic.Dictionary<int, int> d2 ) { this.Id = id; this.X1 = x1; this.X12 = x1_2; this.X2 = x2; this.A1 = a1; this.A2 = a2; this.B1 = b1; this.B2 = b2; this.C1 = c1; this.C2 = c2; this.D1 = d1; this.D2 = d2; } public static TestRef DeserializeTestRef(JsonElement _json) { return new test.TestRef(_json); } public int Id { get; private set; } public int X1 { get; private set; } public test.TestBeRef X1_Ref { get; private set; } public int X12 { get; private set; } public int X2 { get; private set; } public test.TestBeRef X2_Ref { get; private set; } public int[] A1 { get; private set; } public int[] A2 { get; private set; } public System.Collections.Generic.List<int> B1 { get; private set; } public System.Collections.Generic.List<int> B2 { get; private set; } public System.Collections.Generic.HashSet<int> C1 { get; private set; } public System.Collections.Generic.HashSet<int> C2 { get; private set; } public System.Collections.Generic.Dictionary<int, int> D1 { get; private set; } public System.Collections.Generic.Dictionary<int, int> D2 { get; private set; } public const int __ID__ = -543222491; public override int GetTypeId() => __ID__; public void Resolve(Dictionary<string, object> _tables) { this.X1_Ref = (_tables["test.TbTestBeRef"] as test.TbTestBeRef).GetOrDefault(X1); this.X2_Ref = (_tables["test.TbTestBeRef"] as test.TbTestBeRef).GetOrDefault(X2); } public void TranslateText(System.Func<string, string, string> translator) { } public override string ToString() { return "{ " + "Id:" + Id + "," + "X1:" + X1 + "," + "X12:" + X12 + "," + "X2:" + X2 + "," + "A1:" + Bright.Common.StringUtil.CollectionToString(A1) + "," + "A2:" + Bright.Common.StringUtil.CollectionToString(A2) + "," + "B1:" + Bright.Common.StringUtil.CollectionToString(B1) + "," + "B2:" + Bright.Common.StringUtil.CollectionToString(B2) + "," + "C1:" + Bright.Common.StringUtil.CollectionToString(C1) + "," + "C2:" + Bright.Common.StringUtil.CollectionToString(C2) + "," + "D1:" + Bright.Common.StringUtil.CollectionToString(D1) + "," + "D2:" + Bright.Common.StringUtil.CollectionToString(D2) + "," + "}"; } } } <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/test/TestExcelBean1.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.test { /// <summary> /// 这是个测试excel结构 /// </summary> public sealed partial class TestExcelBean1 : Bright.Config.BeanBase { public TestExcelBean1(ByteBuf _buf) { X1 = _buf.ReadInt(); X2 = _buf.ReadString(); X3 = _buf.ReadInt(); X4 = _buf.ReadFloat(); } public TestExcelBean1(int x1, string x2, int x3, float x4 ) { this.X1 = x1; this.X2 = x2; this.X3 = x3; this.X4 = x4; } public static TestExcelBean1 DeserializeTestExcelBean1(ByteBuf _buf) { return new test.TestExcelBean1(_buf); } /// <summary> /// 最高品质 /// </summary> public readonly int X1; /// <summary> /// 黑色的 /// </summary> public readonly string X2; /// <summary> /// 蓝色的 /// </summary> public readonly int X3; /// <summary> /// 最差品质 /// </summary> public readonly float X4; public const int ID = -1738345160; public override int GetTypeId() => ID; public void Resolve(Dictionary<string, object> _tables) { OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); public override string ToString() { return "{ " + "X1:" + X1 + "," + "X2:" + X2 + "," + "X3:" + X3 + "," + "X4:" + X4 + "," + "}"; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_PolygonCollider2D_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_PolygonCollider2D_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.PolygonCollider2D(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.PolygonCollider2D), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetTotalPointCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.PolygonCollider2D; { { var result = obj.GetTotalPointCount(); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetPath(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.PolygonCollider2D; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var result = obj.GetPath(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Vector2>), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<System.Collections.Generic.List<UnityEngine.Vector2>>(false); var result = obj.GetPath(Arg0,Arg1); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetPath"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetPath(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.PolygonCollider2D; if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2[]), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2[]>(false); obj.SetPath(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Vector2>), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<System.Collections.Generic.List<UnityEngine.Vector2>>(false); obj.SetPath(Arg0,Arg1); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SetPath"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_CreatePrimitive(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.PolygonCollider2D; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); obj.CreatePrimitive(Arg0); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); obj.CreatePrimitive(Arg0,Arg1); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.Get<UnityEngine.Vector2>(false); obj.CreatePrimitive(Arg0,Arg1,Arg2); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to CreatePrimitive"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_autoTiling(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.PolygonCollider2D; var result = obj.autoTiling; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_autoTiling(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.PolygonCollider2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.autoTiling = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_points(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.PolygonCollider2D; var result = obj.points; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_points(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.PolygonCollider2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.points = argHelper.Get<UnityEngine.Vector2[]>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_pathCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.PolygonCollider2D; var result = obj.pathCount; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_pathCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.PolygonCollider2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.pathCount = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "GetTotalPointCount", IsStatic = false}, M_GetTotalPointCount }, { new Puerts.MethodKey {Name = "GetPath", IsStatic = false}, M_GetPath }, { new Puerts.MethodKey {Name = "SetPath", IsStatic = false}, M_SetPath }, { new Puerts.MethodKey {Name = "CreatePrimitive", IsStatic = false}, M_CreatePrimitive }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"autoTiling", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_autoTiling, Setter = S_autoTiling} }, {"points", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_points, Setter = S_points} }, {"pathCount", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_pathCount, Setter = S_pathCount} }, } }; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_WheelJoint2D_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_WheelJoint2D_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.WheelJoint2D(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.WheelJoint2D), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetMotorTorque(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.WheelJoint2D; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetFloat(false); var result = obj.GetMotorTorque(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_suspension(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.WheelJoint2D; var result = obj.suspension; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_suspension(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.WheelJoint2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.suspension = argHelper.Get<UnityEngine.JointSuspension2D>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_useMotor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.WheelJoint2D; var result = obj.useMotor; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_useMotor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.WheelJoint2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.useMotor = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_motor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.WheelJoint2D; var result = obj.motor; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_motor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.WheelJoint2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.motor = argHelper.Get<UnityEngine.JointMotor2D>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_jointTranslation(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.WheelJoint2D; var result = obj.jointTranslation; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_jointLinearSpeed(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.WheelJoint2D; var result = obj.jointLinearSpeed; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_jointSpeed(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.WheelJoint2D; var result = obj.jointSpeed; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_jointAngle(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.WheelJoint2D; var result = obj.jointAngle; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "GetMotorTorque", IsStatic = false}, M_GetMotorTorque }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"suspension", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_suspension, Setter = S_suspension} }, {"useMotor", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_useMotor, Setter = S_useMotor} }, {"motor", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_motor, Setter = S_motor} }, {"jointTranslation", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_jointTranslation, Setter = null} }, {"jointLinearSpeed", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_jointLinearSpeed, Setter = null} }, {"jointSpeed", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_jointSpeed, Setter = null} }, {"jointAngle", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_jointAngle, Setter = null} }, } }; } } } <|start_filename|>Projects/GenerateDatas/convert_lua/tag.TbTestTag/1.lua<|end_filename|> return { id = 1, value = "导出", } <|start_filename|>Projects/Cpp_bin/bright/math/Vector2.hpp<|end_filename|> #pragma once namespace bright { namespace math { struct Vector2 { float x; float y; Vector2() : x(0), y(0) {} Vector2(float x, float y) : x(x), y(y) {} }; } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_UILineInfo_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_UILineInfo_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.UILineInfo constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_startCharIdx(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.UILineInfo)Puerts.Utils.GetSelf((int)data, self); var result = obj.startCharIdx; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_startCharIdx(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.UILineInfo)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.startCharIdx = argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_height(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.UILineInfo)Puerts.Utils.GetSelf((int)data, self); var result = obj.height; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_height(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.UILineInfo)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.height = argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_topY(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.UILineInfo)Puerts.Utils.GetSelf((int)data, self); var result = obj.topY; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_topY(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.UILineInfo)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.topY = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_leading(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.UILineInfo)Puerts.Utils.GetSelf((int)data, self); var result = obj.leading; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_leading(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.UILineInfo)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.leading = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"startCharIdx", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_startCharIdx, Setter = S_startCharIdx} }, {"height", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_height, Setter = S_height} }, {"topY", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_topY, Setter = S_topY} }, {"leading", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_leading, Setter = S_leading} }, } }; } } } <|start_filename|>Projects/java_json/src/corelib/bright/serialization/ISerializable.java<|end_filename|> package bright.serialization; public interface ISerializable { void serialize(ByteBuf bs); void deserialize(ByteBuf bs); } <|start_filename|>Projects/DataTemplates/template_lua2/test_tbtestset.lua<|end_filename|> -- test.TbTestSet return { [1] = { id=1, x1= { 1, 2, 3, }, x2= { 2, 3, 4, }, x3= { "ab", "cd", }, x4= { 1, 2, }, }, [2] = { id=2, x1= { 1, 2, }, x2= { 2, 3, }, x3= { "ab", "cd", }, x4= { 1, }, }, } <|start_filename|>Projects/java_json/src/gen/cfg/ai/Sequence.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.ai; import com.google.gson.JsonElement; import com.google.gson.JsonObject; public final class Sequence extends cfg.ai.ComposeNode { public Sequence(JsonObject __json__) { super(__json__); { com.google.gson.JsonArray _json0_ = __json__.get("children").getAsJsonArray(); children = new java.util.ArrayList<cfg.ai.FlowNode>(_json0_.size()); for(JsonElement __e : _json0_) { cfg.ai.FlowNode __v; __v = cfg.ai.FlowNode.deserializeFlowNode(__e.getAsJsonObject()); children.add(__v); } } } public Sequence(int id, String node_name, java.util.ArrayList<cfg.ai.Decorator> decorators, java.util.ArrayList<cfg.ai.Service> services, java.util.ArrayList<cfg.ai.FlowNode> children ) { super(id, node_name, decorators, services); this.children = children; } public static Sequence deserializeSequence(JsonObject __json__) { return new Sequence(__json__); } public final java.util.ArrayList<cfg.ai.FlowNode> children; public static final int __ID__ = -1789006105; @Override public int getTypeId() { return __ID__; } @Override public void resolve(java.util.HashMap<String, Object> _tables) { super.resolve(_tables); for(cfg.ai.FlowNode _e : children) { if (_e != null) _e.resolve(_tables); } } @Override public String toString() { return "{ " + "id:" + id + "," + "nodeName:" + nodeName + "," + "decorators:" + decorators + "," + "services:" + services + "," + "children:" + children + "," + "}"; } } <|start_filename|>Projects/java_json/src/gen/cfg/ai/ComposeNode.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.ai; import com.google.gson.JsonElement; import com.google.gson.JsonObject; public abstract class ComposeNode extends cfg.ai.FlowNode { public ComposeNode(JsonObject __json__) { super(__json__); } public ComposeNode(int id, String node_name, java.util.ArrayList<cfg.ai.Decorator> decorators, java.util.ArrayList<cfg.ai.Service> services ) { super(id, node_name, decorators, services); } public static ComposeNode deserializeComposeNode(JsonObject __json__) { switch (__json__.get("__type__").getAsString()) { case "Sequence": return new cfg.ai.Sequence(__json__); case "Selector": return new cfg.ai.Selector(__json__); case "SimpleParallel": return new cfg.ai.SimpleParallel(__json__); default: throw new bright.serialization.SerializationException(); } } @Override public void resolve(java.util.HashMap<String, Object> _tables) { super.resolve(_tables); } @Override public String toString() { return "{ " + "id:" + id + "," + "nodeName:" + nodeName + "," + "decorators:" + decorators + "," + "services:" + services + "," + "}"; } } <|start_filename|>Projects/java_json/src/gen/cfg/test/ExcelFromJson.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.test; import com.google.gson.JsonElement; import com.google.gson.JsonObject; public final class ExcelFromJson { public ExcelFromJson(JsonObject __json__) { x4 = __json__.get("x4").getAsInt(); x1 = __json__.get("x1").getAsBoolean(); x5 = __json__.get("x5").getAsLong(); x6 = __json__.get("x6").getAsFloat(); s1 = __json__.get("s1").getAsString(); __json__.get("s2").getAsJsonObject().get("key").getAsString(); s2 = __json__.get("s2").getAsJsonObject().get("text").getAsString(); { com.google.gson.JsonObject _json0_ = __json__.get("v2").getAsJsonObject(); float __x; __x = _json0_.get("x").getAsFloat(); float __y; __y = _json0_.get("y").getAsFloat(); v2 = new bright.math.Vector2(__x, __y); } { com.google.gson.JsonObject _json0_ = __json__.get("v3").getAsJsonObject(); float __x; __x = _json0_.get("x").getAsFloat(); float __y; __y = _json0_.get("y").getAsFloat(); float __z; __z = _json0_.get("z").getAsFloat(); v3 = new bright.math.Vector3(__x, __y,__z); } { com.google.gson.JsonObject _json0_ = __json__.get("v4").getAsJsonObject(); float __x; __x = _json0_.get("x").getAsFloat(); float __y; __y = _json0_.get("y").getAsFloat(); float __z; __z = _json0_.get("z").getAsFloat(); float __w; __w = _json0_.get("w").getAsFloat(); v4 = new bright.math.Vector4(__x, __y, __z, __w); } t1 = __json__.get("t1").getAsInt(); x12 = new cfg.test.DemoType1(__json__.get("x12").getAsJsonObject()); x13 = cfg.test.DemoEnum.valueOf(__json__.get("x13").getAsInt()); x14 = cfg.test.DemoDynamic.deserializeDemoDynamic(__json__.get("x14").getAsJsonObject()); { com.google.gson.JsonArray _json0_ = __json__.get("k1").getAsJsonArray(); int _n = _json0_.size(); k1 = new int[_n]; int _index=0; for(JsonElement __e : _json0_) { int __v; __v = __e.getAsInt(); k1[_index++] = __v; } } { com.google.gson.JsonArray _json0_ = __json__.get("k8").getAsJsonArray(); k8 = new java.util.HashMap<Integer, Integer>(_json0_.size()); for(JsonElement __e : _json0_) { int __k; __k = __e.getAsJsonArray().get(0).getAsInt(); int __v; __v = __e.getAsJsonArray().get(1).getAsInt(); k8.put(__k, __v); } } { com.google.gson.JsonArray _json0_ = __json__.get("k9").getAsJsonArray(); k9 = new java.util.ArrayList<cfg.test.DemoE2>(_json0_.size()); for(JsonElement __e : _json0_) { cfg.test.DemoE2 __v; __v = new cfg.test.DemoE2(__e.getAsJsonObject()); k9.add(__v); } } { com.google.gson.JsonArray _json0_ = __json__.get("k15").getAsJsonArray(); int _n = _json0_.size(); k15 = new cfg.test.DemoDynamic[_n]; int _index=0; for(JsonElement __e : _json0_) { cfg.test.DemoDynamic __v; __v = cfg.test.DemoDynamic.deserializeDemoDynamic(__e.getAsJsonObject()); k15[_index++] = __v; } } } public ExcelFromJson(int x4, boolean x1, long x5, float x6, String s1, String s2, bright.math.Vector2 v2, bright.math.Vector3 v3, bright.math.Vector4 v4, int t1, cfg.test.DemoType1 x12, cfg.test.DemoEnum x13, cfg.test.DemoDynamic x14, int[] k1, java.util.HashMap<Integer, Integer> k8, java.util.ArrayList<cfg.test.DemoE2> k9, cfg.test.DemoDynamic[] k15 ) { this.x4 = x4; this.x1 = x1; this.x5 = x5; this.x6 = x6; this.s1 = s1; this.s2 = s2; this.v2 = v2; this.v3 = v3; this.v4 = v4; this.t1 = t1; this.x12 = x12; this.x13 = x13; this.x14 = x14; this.k1 = k1; this.k8 = k8; this.k9 = k9; this.k15 = k15; } public static ExcelFromJson deserializeExcelFromJson(JsonObject __json__) { return new ExcelFromJson(__json__); } public final int x4; public final boolean x1; public final long x5; public final float x6; public final String s1; public final String s2; public final bright.math.Vector2 v2; public final bright.math.Vector3 v3; public final bright.math.Vector4 v4; public final int t1; public final cfg.test.DemoType1 x12; public final cfg.test.DemoEnum x13; public final cfg.test.DemoDynamic x14; public final int[] k1; public final java.util.HashMap<Integer, Integer> k8; public final java.util.ArrayList<cfg.test.DemoE2> k9; public final cfg.test.DemoDynamic[] k15; public void resolve(java.util.HashMap<String, Object> _tables) { if (x12 != null) {x12.resolve(_tables);} if (x14 != null) {x14.resolve(_tables);} for(cfg.test.DemoE2 _e : k9) { if (_e != null) _e.resolve(_tables); } for(cfg.test.DemoDynamic _e : k15) { if (_e != null) _e.resolve(_tables); } } @Override public String toString() { return "{ " + "x4:" + x4 + "," + "x1:" + x1 + "," + "x5:" + x5 + "," + "x6:" + x6 + "," + "s1:" + s1 + "," + "s2:" + s2 + "," + "v2:" + v2 + "," + "v3:" + v3 + "," + "v4:" + v4 + "," + "t1:" + t1 + "," + "x12:" + x12 + "," + "x13:" + x13 + "," + "x14:" + x14 + "," + "k1:" + k1 + "," + "k8:" + k8 + "," + "k9:" + k9 + "," + "k15:" + k15 + "," + "}"; } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_ClothSphereColliderPair_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_ClothSphereColliderPair_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.SphereCollider), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.SphereCollider>(false); var result = new UnityEngine.ClothSphereColliderPair(Arg0); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.ClothSphereColliderPair), result); } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.SphereCollider), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.SphereCollider), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.SphereCollider>(false); var Arg1 = argHelper1.Get<UnityEngine.SphereCollider>(false); var result = new UnityEngine.ClothSphereColliderPair(Arg0,Arg1); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.ClothSphereColliderPair), result); } } if (paramLen == 0) { { var result = new UnityEngine.ClothSphereColliderPair(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.ClothSphereColliderPair), result); } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.ClothSphereColliderPair constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_first(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ClothSphereColliderPair)Puerts.Utils.GetSelf((int)data, self); var result = obj.first; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_first(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ClothSphereColliderPair)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.first = argHelper.Get<UnityEngine.SphereCollider>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_second(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ClothSphereColliderPair)Puerts.Utils.GetSelf((int)data, self); var result = obj.second; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_second(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ClothSphereColliderPair)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.second = argHelper.Get<UnityEngine.SphereCollider>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"first", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_first, Setter = S_first} }, {"second", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_second, Setter = S_second} }, } }; } } } <|start_filename|>Projects/Lua_Unity_xlua_lua/Assets/Lua/Data/role_tbrolelevelexpattr.lua<|end_filename|> return { [1] = {level=1,need_exp=0,clothes_attrs={0,0,0,0,0,0,0,0,0,0,},}, [2] = {level=2,need_exp=100,clothes_attrs={1,1,1,1,1,0,0,0,0,0,},}, [3] = {level=3,need_exp=200,clothes_attrs={0,0,0,0,0,1,1,1,1,1,},}, [4] = {level=4,need_exp=300,clothes_attrs={1,1,1,1,1,0,0,0,0,0,},}, [5] = {level=5,need_exp=400,clothes_attrs={0,0,0,0,0,1,1,1,1,1,},}, [6] = {level=6,need_exp=500,clothes_attrs={1,1,1,1,1,0,0,0,0,0,},}, [7] = {level=7,need_exp=700,clothes_attrs={0,0,0,0,0,1,1,1,1,1,},}, [8] = {level=8,need_exp=900,clothes_attrs={1,1,1,1,1,0,0,0,0,0,},}, [9] = {level=9,need_exp=1100,clothes_attrs={0,0,0,0,0,1,1,1,1,1,},}, [10] = {level=10,need_exp=1300,clothes_attrs={1,1,1,1,1,0,0,0,0,0,},}, [11] = {level=11,need_exp=1500,clothes_attrs={0,0,0,0,0,1,1,1,1,1,},}, [12] = {level=12,need_exp=2000,clothes_attrs={1,1,1,1,1,0,0,0,0,0,},}, [13] = {level=13,need_exp=2500,clothes_attrs={0,0,0,0,0,1,1,1,1,1,},}, [14] = {level=14,need_exp=3000,clothes_attrs={1,1,1,1,1,0,0,0,0,0,},}, [15] = {level=15,need_exp=3500,clothes_attrs={0,0,0,0,0,1,1,1,1,1,},}, [16] = {level=16,need_exp=4000,clothes_attrs={1,1,1,1,1,0,0,0,0,0,},}, [17] = {level=17,need_exp=4500,clothes_attrs={0,0,0,0,0,1,1,1,1,1,},}, [18] = {level=18,need_exp=5000,clothes_attrs={1,1,1,1,1,0,0,0,0,0,},}, [19] = {level=19,need_exp=5500,clothes_attrs={0,0,0,0,0,1,1,1,1,1,},}, [20] = {level=20,need_exp=6000,clothes_attrs={1,1,1,1,1,0,0,0,0,0,},}, [21] = {level=21,need_exp=6500,clothes_attrs={0,0,0,0,0,1,1,1,1,1,},}, [22] = {level=22,need_exp=7000,clothes_attrs={1,1,1,1,1,0,0,0,0,0,},}, [23] = {level=23,need_exp=7500,clothes_attrs={0,0,0,0,0,1,1,1,1,1,},}, [24] = {level=24,need_exp=8000,clothes_attrs={1,1,1,1,1,0,0,0,0,0,},}, [25] = {level=25,need_exp=8500,clothes_attrs={0,0,0,0,0,1,1,1,1,1,},}, [26] = {level=26,need_exp=9000,clothes_attrs={1,1,1,1,1,0,0,0,0,0,},}, [27] = {level=27,need_exp=9500,clothes_attrs={0,0,0,0,0,1,1,1,1,1,},}, [28] = {level=28,need_exp=10000,clothes_attrs={1,1,1,1,1,0,0,0,0,0,},}, [29] = {level=29,need_exp=11000,clothes_attrs={0,0,0,0,0,1,1,1,1,1,},}, [30] = {level=30,need_exp=12000,clothes_attrs={1,1,1,1,1,0,0,0,0,0,},}, [31] = {level=31,need_exp=13000,clothes_attrs={0,0,0,0,0,1,1,1,1,1,},}, [32] = {level=32,need_exp=14000,clothes_attrs={1,1,1,1,1,0,0,0,0,0,},}, [33] = {level=33,need_exp=15000,clothes_attrs={0,0,0,0,0,1,1,1,1,1,},}, [34] = {level=34,need_exp=17000,clothes_attrs={1,1,1,1,1,0,0,0,0,0,},}, [35] = {level=35,need_exp=19000,clothes_attrs={0,0,0,0,0,1,1,1,1,1,},}, [36] = {level=36,need_exp=21000,clothes_attrs={1,1,1,1,1,0,0,0,0,0,},}, [37] = {level=37,need_exp=23000,clothes_attrs={0,0,0,0,0,1,1,1,1,1,},}, [38] = {level=38,need_exp=25000,clothes_attrs={1,1,1,1,1,0,0,0,0,0,},}, [39] = {level=39,need_exp=28000,clothes_attrs={0,0,0,0,0,1,1,1,1,1,},}, [40] = {level=40,need_exp=31000,clothes_attrs={1,1,1,1,1,0,0,0,0,0,},}, [41] = {level=41,need_exp=34000,clothes_attrs={0,0,0,0,0,1,1,1,1,1,},}, [42] = {level=42,need_exp=37000,clothes_attrs={1,1,1,1,1,0,0,0,0,0,},}, [43] = {level=43,need_exp=40000,clothes_attrs={0,0,0,0,0,1,1,1,1,1,},}, [44] = {level=44,need_exp=45000,clothes_attrs={1,1,1,1,1,0,0,0,0,0,},}, [45] = {level=45,need_exp=50000,clothes_attrs={0,0,0,0,0,1,1,1,1,1,},}, [46] = {level=46,need_exp=55000,clothes_attrs={1,1,1,1,1,0,0,0,0,0,},}, [47] = {level=47,need_exp=60000,clothes_attrs={0,0,0,0,0,1,1,1,1,1,},}, [48] = {level=48,need_exp=65000,clothes_attrs={1,1,1,1,1,0,0,0,0,0,},}, [49] = {level=49,need_exp=70000,clothes_attrs={0,0,0,0,0,1,1,1,1,1,},}, [50] = {level=50,need_exp=75000,clothes_attrs={1,1,1,1,1,0,0,0,0,0,},}, [51] = {level=51,need_exp=80000,clothes_attrs={0,0,0,0,0,1,1,1,1,1,},}, [52] = {level=52,need_exp=85000,clothes_attrs={1,1,1,1,1,0,0,0,0,0,},}, [53] = {level=53,need_exp=90000,clothes_attrs={0,0,0,0,0,1,1,1,1,1,},}, [54] = {level=54,need_exp=95000,clothes_attrs={1,1,1,1,1,0,0,0,0,0,},}, [55] = {level=55,need_exp=100000,clothes_attrs={0,0,0,0,0,1,1,1,1,1,},}, [56] = {level=56,need_exp=105000,clothes_attrs={1,1,1,1,1,0,0,0,0,0,},}, [57] = {level=57,need_exp=110000,clothes_attrs={0,0,0,0,0,1,1,1,1,1,},}, [58] = {level=58,need_exp=115000,clothes_attrs={0,0,0,0,0,1,1,1,1,1,},}, [59] = {level=59,need_exp=120000,clothes_attrs={1,1,1,1,1,0,0,0,0,0,},}, [60] = {level=60,need_exp=125000,clothes_attrs={0,0,0,0,0,1,1,1,1,1,},}, [61] = {level=61,need_exp=130000,clothes_attrs={1,1,1,1,1,0,0,0,0,0,},}, [62] = {level=62,need_exp=135000,clothes_attrs={0,0,0,0,0,1,1,1,1,1,},}, [63] = {level=63,need_exp=140000,clothes_attrs={1,1,1,1,1,0,0,0,0,0,},}, [64] = {level=64,need_exp=145000,clothes_attrs={0,0,0,0,0,1,1,1,1,1,},}, [65] = {level=65,need_exp=150000,clothes_attrs={1,1,1,1,1,0,0,0,0,0,},}, [66] = {level=66,need_exp=155000,clothes_attrs={0,0,0,0,0,1,1,1,1,1,},}, [67] = {level=67,need_exp=160000,clothes_attrs={1,1,1,1,1,0,0,0,0,0,},}, [68] = {level=68,need_exp=165000,clothes_attrs={0,0,0,0,0,1,1,1,1,1,},}, [69] = {level=69,need_exp=170000,clothes_attrs={1,1,1,1,1,0,0,0,0,0,},}, [70] = {level=70,need_exp=175000,clothes_attrs={0,0,0,0,0,1,1,1,1,1,},}, [71] = {level=71,need_exp=180000,clothes_attrs={0,0,0,0,0,1,1,1,1,1,},}, [72] = {level=72,need_exp=185000,clothes_attrs={1,1,1,1,1,0,0,0,0,0,},}, [73] = {level=73,need_exp=190000,clothes_attrs={0,0,0,0,0,1,1,1,1,1,},}, [74] = {level=74,need_exp=195000,clothes_attrs={1,1,1,1,1,0,0,0,0,0,},}, [75] = {level=75,need_exp=200000,clothes_attrs={0,0,0,0,0,1,1,1,1,1,},}, [76] = {level=76,need_exp=205000,clothes_attrs={1,1,1,1,1,0,0,0,0,0,},}, [77] = {level=77,need_exp=210000,clothes_attrs={0,0,0,0,0,1,1,1,1,1,},}, [78] = {level=78,need_exp=215000,clothes_attrs={1,1,1,1,1,0,0,0,0,0,},}, [79] = {level=79,need_exp=220000,clothes_attrs={0,0,0,0,0,1,1,1,1,1,},}, [80] = {level=80,need_exp=225000,clothes_attrs={1,1,1,1,1,0,0,0,0,0,},}, [81] = {level=81,need_exp=230000,clothes_attrs={0,0,0,0,0,1,1,1,1,1,},}, [82] = {level=82,need_exp=235000,clothes_attrs={1,1,1,1,1,0,0,0,0,0,},}, [83] = {level=83,need_exp=240000,clothes_attrs={0,0,0,0,0,1,1,1,1,1,},}, [84] = {level=84,need_exp=245000,clothes_attrs={0,0,0,0,0,1,1,1,1,1,},}, [85] = {level=85,need_exp=250000,clothes_attrs={1,1,1,1,1,0,0,0,0,0,},}, [86] = {level=86,need_exp=255000,clothes_attrs={0,0,0,0,0,1,1,1,1,1,},}, [87] = {level=87,need_exp=260000,clothes_attrs={1,1,1,1,1,0,0,0,0,0,},}, [88] = {level=88,need_exp=265000,clothes_attrs={0,0,0,0,0,1,1,1,1,1,},}, [89] = {level=89,need_exp=270000,clothes_attrs={1,1,1,1,1,0,0,0,0,0,},}, [90] = {level=90,need_exp=275000,clothes_attrs={0,0,0,0,0,1,1,1,1,1,},}, [91] = {level=91,need_exp=280000,clothes_attrs={1,1,1,1,1,0,0,0,0,0,},}, [92] = {level=92,need_exp=285000,clothes_attrs={0,0,0,0,0,1,1,1,1,1,},}, [93] = {level=93,need_exp=290000,clothes_attrs={1,1,1,1,1,0,0,0,0,0,},}, [94] = {level=94,need_exp=295000,clothes_attrs={0,0,0,0,0,1,1,1,1,1,},}, [95] = {level=95,need_exp=300000,clothes_attrs={1,1,1,1,1,0,0,0,0,0,},}, [96] = {level=96,need_exp=305000,clothes_attrs={0,0,0,0,0,1,1,1,1,1,},}, [97] = {level=97,need_exp=310000,clothes_attrs={1,1,1,1,1,0,0,0,0,0,},}, [98] = {level=98,need_exp=315000,clothes_attrs={0,0,0,0,0,1,1,1,1,1,},}, [99] = {level=99,need_exp=320000,clothes_attrs={1,1,1,1,1,0,0,0,0,0,},}, [100] = {level=100,need_exp=325000,clothes_attrs={0,0,0,0,0,1,1,1,1,1,},}, } <|start_filename|>Projects/Cpp_bin/bright/serialization/ByteBuf.h<|end_filename|> #pragma once #include <cstring> #include <cmath> #include <algorithm> #include <vector> #include <string> #include <iostream> #include <fstream> #include "../CommonMacros.h" namespace bright { namespace serialization { class ByteBuf { private: static const int INIT_CAPACITY; // 默认空间 static const byte EMPTY_BYTES[1]; byte* data_; int beginPos_; int endPos_; int capacity_; public: ByteBuf() : data_((byte*)(EMPTY_BYTES)), beginPos_(0), endPos_(0), capacity_(0) { } ~ByteBuf() { deleteOldData(); } ByteBuf(int capacity) { init(new byte[capacity], capacity, 0, 0); } ByteBuf(byte* bytes, int capacity, int beginPos_, int endPos_) { this->capacity_ = capacity; this->data_ = bytes; this->beginPos_ = beginPos_; this->endPos_ = endPos_; } int getCapacity() const { return capacity_; } int size() const { return endPos_ - beginPos_; } int getReadIndex() const { return beginPos_; } int getWriteIndex() const { return endPos_; } byte* getDataUnsafe() const { return data_; } void replace(byte* bytes, int size) { deleteOldData(); this->capacity_ = size; this->data_ = bytes; this->beginPos_ = 0; this->endPos_ = size; } bool skipBytes() { int oldReadIndex = beginPos_; int n; if (!readSize(n) || !ensureRead(n)) { beginPos_ = oldReadIndex; return false; } beginPos_ += n; return true; } void addWriteIndexUnsafe(int add) { endPos_ += add; } void addReadIndexUnsafe(int add) { beginPos_ += add; } byte* copyRemainData(int& len) { int n = size(); len = n; if (n > 0) { byte* arr = new byte[n]; std::memcpy(arr, this->data_ + beginPos_, n); return arr; } else { return const_cast<byte*>(EMPTY_BYTES); } } void clear() { beginPos_ = endPos_ = 0; } void append(byte x) { reserveWrite(1); data_[endPos_++] = x; } // ================================== // 以下是序列化具体数据类型相关函数 // ================================== void writeBool(bool b) { reserveWrite(1); data_[endPos_++] = b; } bool readBool(bool& out) { if (!ensureRead(1)) return false;; out = bool(data_[beginPos_++]); return true; } void writeByte(byte x) { reserveWrite(1); data_[endPos_++] = x; } bool readByte(byte& out) { if (!ensureRead(1)) return false; out = data_[beginPos_++]; return true; } void writeShort(int16_t x) { if (x >= 0) { if (x < 0x80) { reserveWrite(1); data_[endPos_++] = (byte)x; return; } else if (x < 0x4000) { reserveWrite(2); data_[endPos_ + 1] = (byte)x; data_[endPos_] = (byte)((x >> 8) | 0x80); endPos_ += 2; return; } } reserveWrite(3); data_[endPos_] = byte{ 0xff }; data_[endPos_ + 2] = (byte)x; data_[endPos_ + 1] = (byte)(x >> 8); endPos_ += 3; } bool readShort(int16_t& out) { if (!ensureRead(1)) return false; int32_t h = (data_[beginPos_] & 0xff); if (h < 0x80) { beginPos_++; out = (int16_t)h; } else if (h < 0xc0) { if (!ensureRead(2)) return false; int32_t x = ((h & 0x3f) << 8) | (data_[beginPos_ + 1] & 0xff); beginPos_ += 2; out = (int16_t)x; } else if (h == 0xff) { if (!ensureRead(3)) return false; int32_t x = ((data_[beginPos_ + 1] & 0xff) << 8) | (data_[beginPos_ + 2] & 0xff); beginPos_ += 3; out = (int16_t)x; } else { return false; } return true; } void writeFshort(int16_t x) { reserveWrite(2); copy2(getWriteData(), (byte*)&x); endPos_ += 2; } bool readFshort(int16_t& out) { if (!ensureRead(2)) return false; copy2((byte*)&out, getReadData()); beginPos_ += 2; return true; } void writeInt(int32_t x) { writeUint((uint32_t)x); } bool readInt(int32_t& out) { return (int32_t)readUint(*(uint32_t*)&out); } void writeFint(int32_t x) { reserveWrite(4); copy4(getWriteData(), (byte*)&x); endPos_ += 4; } bool readFint(int32_t& out) { if (!ensureRead(4)) return false; copy4((byte*)&out, getReadData()); beginPos_ += 4; return true; } // marshal int // n -> (n << 1) ^ (n >> 31) // read // (x >>> 1) ^ ((x << 31) >> 31) // (x >>> 1) ^ -(n&1) void writeSint(int32_t x) { writeUint((x << 1) ^ (x >> 31)); } bool readSint(int32_t& out) { uint32_t x; if (readUint(x)) { out = ((int32_t)(x >> 1) ^ -((int32_t)x & 1)); return true; } else { return false; } } void writeUint(uint32_t x) { // 0 111 1111 if (x < 0x80) { reserveWrite(1); data_[endPos_++] = (byte)x; } else if (x < 0x4000) // 10 11 1111, - { reserveWrite(2); data_[endPos_ + 1] = (byte)x; data_[endPos_] = (byte)((x >> 8) | 0x80); endPos_ += 2; } else if (x < 0x200000) // 110 1 1111, -,- { reserveWrite(3); data_[endPos_ + 2] = (byte)x; data_[endPos_ + 1] = (byte)(x >> 8); data_[endPos_] = (byte)((x >> 16) | 0xc0); endPos_ += 3; } else if (x < 0x10000000) // 1110 1111,-,-,- { reserveWrite(4); data_[endPos_ + 3] = (byte)x; data_[endPos_ + 2] = (byte)(x >> 8); data_[endPos_ + 1] = (byte)(x >> 16); data_[endPos_] = (byte)((x >> 24) | 0xe0); endPos_ += 4; } else { reserveWrite(5); data_[endPos_] = 0xf0; data_[endPos_ + 4] = (byte)x; data_[endPos_ + 3] = (byte)(x >> 8); data_[endPos_ + 2] = (byte)(x >> 16); data_[endPos_ + 1] = (byte)(x >> 24); endPos_ += 5; } } bool readUint(uint32_t& out) { if (!ensureRead(1)) return false; uint32_t h = data_[beginPos_]; if (h < 0x80) { beginPos_++; out = h; } else if (h < 0xc0) { if (!ensureRead(2)) return false; uint32_t x = ((h & 0x3f) << 8) | data_[beginPos_ + 1]; beginPos_ += 2; out = x; } else if (h < 0xe0) { if (!ensureRead(3)) return false; uint32_t x = ((h & 0x1f) << 16) | ((uint32_t)data_[beginPos_ + 1] << 8) | data_[beginPos_ + 2]; beginPos_ += 3; out = x; } else if (h < 0xf0) { if (!ensureRead(4)) return false; uint32_t x = ((h & 0x0f) << 24) | ((uint32_t)data_[beginPos_ + 1] << 16) | ((uint32_t)data_[beginPos_ + 2] << 8) | data_[beginPos_ + 3]; beginPos_ += 4; out = x; } else { if (!ensureRead(5)) return false; uint32_t x = ((uint32_t)data_[beginPos_ + 1] << 24) | ((uint32_t)(data_[beginPos_ + 2] << 16)) | ((uint32_t)data_[beginPos_ + 3] << 8) | ((uint32_t)data_[beginPos_ + 4]); beginPos_ += 5; out = x; } return true; } void writeLong(int64_t x) { writeUlong((uint64_t)x); } bool readLong(int64_t& out) { return readUlong((uint64_t&)*(uint64_t*)&out); } // marshal long // n -> (n << 1) ^ (n >> 63) // read // (x >>> 1) ^((x << 63) >> 63) // (x >>> 1) ^ -(n&1L) void writeSlong(int64_t x) { writeUlong((x << 1) ^ (x >> 63)); } bool readSlong(int64_t& out) { uint64_t x; if (readUlong(x)) { out = ((int64_t)(x >> 1) ^ -((int64_t)x & 1)); return true; } else { return false; } } void writeFlong(int64_t x) { reserveWrite(8); copy8(getWriteData(), (byte*)&x); endPos_ += 8; } bool readFlong(int64_t& out) { if (!ensureRead(8)) return false; copy8((byte*)&out, getReadData()); beginPos_ += 8; return true; } void writeUlong(uint64_t x) { // 0 111 1111 if (x < 0x80) { reserveWrite(1); data_[endPos_++] = (byte)x; } else if (x < 0x4000) // 10 11 1111, - { reserveWrite(2); data_[endPos_ + 1] = (byte)x; data_[endPos_] = (byte)((x >> 8) | 0x80); endPos_ += 2; } else if (x < 0x200000) // 110 1 1111, -,- { reserveWrite(3); data_[endPos_ + 2] = (byte)x; data_[endPos_ + 1] = (byte)(x >> 8); data_[endPos_] = (byte)((x >> 16) | 0xc0); endPos_ += 3; } else if (x < 0x10000000) // 1110 1111,-,-,- { reserveWrite(4); data_[endPos_ + 3] = (byte)x; data_[endPos_ + 2] = (byte)(x >> 8); data_[endPos_ + 1] = (byte)(x >> 16); data_[endPos_] = (byte)((x >> 24) | 0xe0); endPos_ += 4; } else if (x < 0x800000000L) // 1111 0xxx,-,-,-,- { reserveWrite(5); data_[endPos_ + 4] = (byte)x; data_[endPos_ + 3] = (byte)(x >> 8); data_[endPos_ + 2] = (byte)(x >> 16); data_[endPos_ + 1] = (byte)(x >> 24); data_[endPos_] = (byte)((x >> 32) | 0xf0); endPos_ += 5; } else if (x < 0x40000000000L) // 1111 10xx, { reserveWrite(6); data_[endPos_ + 5] = (byte)x; data_[endPos_ + 4] = (byte)(x >> 8); data_[endPos_ + 3] = (byte)(x >> 16); data_[endPos_ + 2] = (byte)(x >> 24); data_[endPos_ + 1] = (byte)(x >> 32); data_[endPos_] = (byte)((x >> 40) | 0xf8); endPos_ += 6; } else if (x < 0x200000000000L) // 1111 110x, { reserveWrite(7); data_[endPos_ + 6] = (byte)x; data_[endPos_ + 5] = (byte)(x >> 8); data_[endPos_ + 4] = (byte)(x >> 16); data_[endPos_ + 3] = (byte)(x >> 24); data_[endPos_ + 2] = (byte)(x >> 32); data_[endPos_ + 1] = (byte)(x >> 40); data_[endPos_] = (byte)((x >> 48) | 0xfc); endPos_ += 7; } else if (x < 0x100000000000000L) // 1111 1110 { reserveWrite(8); data_[endPos_ + 7] = (byte)x; data_[endPos_ + 6] = (byte)(x >> 8); data_[endPos_ + 5] = (byte)(x >> 16); data_[endPos_ + 4] = (byte)(x >> 24); data_[endPos_ + 3] = (byte)(x >> 32); data_[endPos_ + 2] = (byte)(x >> 40); data_[endPos_ + 1] = (byte)(x >> 48); data_[endPos_] = 0xfe; endPos_ += 8; } else // 1111 1111 { reserveWrite(9); data_[endPos_] = 0xff; data_[endPos_ + 8] = (byte)x; data_[endPos_ + 7] = (byte)(x >> 8); data_[endPos_ + 6] = (byte)(x >> 16); data_[endPos_ + 5] = (byte)(x >> 24); data_[endPos_ + 4] = (byte)(x >> 32); data_[endPos_ + 3] = (byte)(x >> 40); data_[endPos_ + 2] = (byte)(x >> 48); data_[endPos_ + 1] = (byte)(x >> 56); endPos_ += 9; } } bool readUlong(uint64_t& out) { if (!ensureRead(1)) return false; uint32_t h = data_[beginPos_]; if (h < 0x80) { beginPos_++; out = h; } else if (h < 0xc0) { if (!ensureRead(2)) return false; uint32_t x = ((h & 0x3f) << 8) | data_[beginPos_ + 1]; beginPos_ += 2; out = x; } else if (h < 0xe0) { if (!ensureRead(3)) return false; uint32_t x = ((h & 0x1f) << 16) | ((uint32_t)data_[beginPos_ + 1] << 8) | data_[beginPos_ + 2]; beginPos_ += 3; out = x; } else if (h < 0xf0) { if (!ensureRead(4)) return false; uint32_t x = ((h & 0x0f) << 24) | ((uint32_t)data_[beginPos_ + 1] << 16) | ((uint32_t)data_[beginPos_ + 2] << 8) | data_[beginPos_ + 3]; beginPos_ += 4; out = x; } else if (h < 0xf8) { if (!ensureRead(5)) return false; uint32_t xl = ((uint32_t)data_[beginPos_ + 1] << 24) | ((uint32_t)(data_[beginPos_ + 2] << 16)) | ((uint32_t)data_[beginPos_ + 3] << 8) | (data_[beginPos_ + 4]); uint32_t xh = h & 0x07; beginPos_ += 5; out = ((uint64_t)xh << 32) | xl; } else if (h < 0xfc) { if (!ensureRead(6)) return false; uint32_t xl = ((uint32_t)data_[beginPos_ + 2] << 24) | ((uint32_t)(data_[beginPos_ + 3] << 16)) | ((uint32_t)data_[beginPos_ + 4] << 8) | (data_[beginPos_ + 5]); uint32_t xh = ((h & 0x03) << 8) | data_[beginPos_ + 1]; beginPos_ += 6; out = ((uint64_t)xh << 32) | xl; } else if (h < 0xfe) { if (!ensureRead(7)) return false; uint32_t xl = ((uint32_t)data_[beginPos_ + 3] << 24) | ((uint32_t)(data_[beginPos_ + 4] << 16)) | ((uint32_t)data_[beginPos_ + 5] << 8) | (data_[beginPos_ + 6]); uint32_t xh = ((h & 0x01) << 16) | ((uint32_t)data_[beginPos_ + 1] << 8) | data_[beginPos_ + 2]; beginPos_ += 7; out = ((uint64_t)xh << 32) | xl; } else if (h < 0xff) { if (!ensureRead(8)) return false; uint32_t xl = ((uint32_t)data_[beginPos_ + 4] << 24) | ((uint32_t)(data_[beginPos_ + 5] << 16)) | ((uint32_t)data_[beginPos_ + 6] << 8) | (data_[beginPos_ + 7]); uint32_t xh = /*((h & 0x01) << 24) |*/ ((uint32_t)data_[beginPos_ + 1] << 16) | ((uint32_t)data_[beginPos_ + 2] << 8) | data_[beginPos_ + 3]; beginPos_ += 8; out = ((uint64_t)xh << 32) | xl; } else { if (!ensureRead(9)) return false; uint32_t xl = ((uint32_t)data_[beginPos_ + 5] << 24) | ((uint32_t)(data_[beginPos_ + 6] << 16)) | ((uint32_t)data_[beginPos_ + 7] << 8) | (data_[beginPos_ + 8]); uint32_t xh = ((uint32_t)data_[beginPos_ + 1] << 24) | ((uint32_t)data_[beginPos_ + 2] << 16) | ((uint32_t)data_[beginPos_ + 3] << 8) | data_[beginPos_ + 4]; beginPos_ += 9; out = ((uint64_t)xh << 32) | xl; } return true; } void writeFloat(float x) { reserveWrite(4); byte* b = &data_[endPos_]; if ((int64_t)b % 4 == 0) { *(float*)b = x; } else { // TODO x是对齐的, 可以优化 copy4(b, (byte*)&x); } endPos_ += 4; } bool readFloat(float& out) { if (!ensureRead(4)) return false; float x; byte* b = &data_[beginPos_]; if ((int64_t)b % 4 == 0) { x = *(float*)b; } else { // TODO x是对齐的, 可以优化 copy4((byte*)&x, b); } beginPos_ += 4; out = x; return true; } void writeDouble(double x) { reserveWrite(8); byte* b = &data_[endPos_]; if ((int64_t)b % 8 == 0) { *(double*)b = x; } else { copy8(b, (byte*)&x); } endPos_ += 8; } bool readDouble(double& out) { if (!ensureRead(8)) return false; double x; byte* b = &data_[beginPos_]; if ((int64_t)b % 8 == 0) { x = *(double*)b; } else { // TODO x是对齐的, 可以优化 copy8((byte*)&x, b); } beginPos_ += 8; out = x; return true; } void writeVector2(bright::math::Vector2& v) { writeFloat(v.x); writeFloat(v.y); } bool readVector2(bright::math::Vector2& out) { return readFloat(out.x) && readFloat(out.y); } void writeVector3(bright::math::Vector3& v) { writeFloat(v.x); writeFloat(v.y); writeFloat(v.z); } bool readVector3(bright::math::Vector3& out) { return readFloat(out.x) && readFloat(out.y) && readFloat(out.z); } void writeVector4(bright::math::Vector4& v) { writeFloat(v.x); writeFloat(v.y); writeFloat(v.z); writeFloat(v.w); } bool readVector4(bright::math::Vector4& out) { return readFloat(out.x) && readFloat(out.y) && readFloat(out.z) && readFloat(out.w); } void writeString(const std::string& x) { int n = (int)x.length(); writeSize(n); if (n > 0) { reserveWrite(n); std::memcpy(data_ + endPos_, x.data(), n); endPos_ += n; } } bool readString(std::string& x) { int n; if (!readSize(n)) return false; if (!ensureRead(n)) return false; x.resize(n); if (n > 0) { std::memcpy((void*)x.data(), data_ + beginPos_, n); beginPos_ += n; } return true; } void writeBytes(Bytes* x) { int n = int(x->size()); writeSize(n); reserveWrite(n); std::memcpy(data_ + endPos_, x->data(), n); endPos_ += n; } bool readBytes(Bytes*& out) { int n; if (!readSize(n)) return false; if (n > 0) { if (!ensureRead(n)) return false; Bytes* x = new Bytes(n); std::memcpy(x->data(), this->getReadData(), n); beginPos_ += n; out = x; } else { out = new Bytes(0); } return true; } void writeBytes(const char* buff, int len) { int n = len; writeSize(n); reserveWrite(n); std::memcpy(data_ + endPos_, buff, n); endPos_ += n; } bool readBytesNotCopy(char*& buffer, int& len) { int n; if (!readSize(n) || !ensureRead(n)) return false; len = n; buffer = (char*)this->getReadData(); beginPos_ += n; return true; } void writeSize(int n) { writeUint(n); } bool readSize(int& out) { uint32_t re; if (readUint(re)) { out = re; return true; } else { return false; } } void appendBuffer(const char* buf, int len) { int n = len; reserveWrite(n); std::memcpy(data_ + endPos_, buf, n); endPos_ += n; } std::string toString() { std::string re; char hex[2]; for (int i = beginPos_; i < endPos_; i++) { if (i != beginPos_) { re.append("."); } hex[0] = toHex(data_[i] >> 4); hex[1] = toHex(data_[i] & 0xf); re.append(hex, 2); } return re;//std::move(re); } static ByteBuf* fromString(const std::string& value) { ByteBuf* re = new ByteBuf(); char* str = const_cast<char*>(value.c_str()); for (; *str; ) { if (*str == ',' || *str == '.') { ++str; } re->append(byte(std::strtoul(str, &str, 16))); } return re; } enum class UnmarshalError : int { OK, NOT_ENOUGH, EXCEED_SIZE, UNMARSHAL_ERR, }; UnmarshalError TryInplaceUnmarshalBuf(int maxSize, ByteBuf& body) { int oldReadIndex = beginPos_; int n; if (!readSize(n)) { this->beginPos_ = oldReadIndex; return UnmarshalError::NOT_ENOUGH; } if (n > maxSize) { this->beginPos_ = oldReadIndex; return UnmarshalError::EXCEED_SIZE; } if (size() < n) { this->beginPos_ = oldReadIndex; return UnmarshalError::NOT_ENOUGH; } body.data_ = data_; body.beginPos_ = beginPos_; beginPos_ += n; body.endPos_ = beginPos_; return UnmarshalError::OK; } static int calcNewCapacity(int initSize, int needSize) { for (int i = std::max(initSize * 2, INIT_CAPACITY); ; i <<= 1) { if (i >= needSize) return i; } } void compactBuffer() { int remainSize = (endPos_ -= beginPos_); std::memmove(data_, data_ + beginPos_, remainSize); beginPos_ = 0; } bool loadFromFile(const std::string& file) { clear(); std::ifstream infile(file, std::ios_base::binary); if (infile.fail()) return false; std::istreambuf_iterator<char> beginIt(infile); std::vector<char> arr(beginIt, std::istreambuf_iterator<char>()); appendBuffer(arr.data(), int(arr.size())); return true; } private: void init(byte* data, int capacity, int beginPos, int endPos) { this->data_ = data; this->capacity_ = capacity; this->beginPos_ = beginPos; this->endPos_ = endPos; } ByteBuf(const ByteBuf& o) = delete; ByteBuf& operator = (const ByteBuf& o) = delete; ByteBuf(ByteBuf&& o) = delete; void deleteOldData() { if (data_ != EMPTY_BYTES) { delete[] data_; data_ = nullptr; } } byte* getReadData() const { return data_ + beginPos_; } byte* getWriteData() const { return data_ + endPos_; } int notCompactWritable() { return capacity_ - endPos_; } void compactOrResize(int size) { int remainSize = (endPos_ -= beginPos_); int needCapacity = remainSize + size; if (needCapacity <= (int)capacity_) { std::memmove(data_, data_ + beginPos_, remainSize); beginPos_ = 0; } else { capacity_ = calcNewCapacity(capacity_, needCapacity); byte* newBytes = new byte[capacity_]; std::memmove(newBytes, data_ + beginPos_, remainSize); beginPos_ = 0; data_ = newBytes; } } inline void reserveWrite(int size) { if (endPos_ + size > (int)capacity_) { compactOrResize(size); } } inline bool ensureRead(int size) { return (beginPos_ + size <= endPos_); } static void copy8(byte* dst, byte* src) { dst[0] = src[0]; dst[1] = src[1]; dst[2] = src[2]; dst[3] = src[3]; dst[4] = src[4]; dst[5] = src[5]; dst[6] = src[6]; dst[7] = src[7]; } static void copy4(byte* dst, byte* src) { dst[0] = src[0]; dst[1] = src[1]; dst[2] = src[2]; dst[3] = src[3]; } static void copy2(byte* dst, byte* src) { dst[0] = src[0]; dst[1] = src[1]; } static char toHex(int num) { return num < 10 ? '0' + num : 'A' + num - 10; } }; } } <|start_filename|>Projects/DataTemplates/template_erlang/item_tbitemextra.erl<|end_filename|> %% item.TbItemExtra get(1022200001) -> #{name__ => "TreasureBox",id => 1022200001,key_item_id => 1022300001,open_level => #{level => 5},use_on_obtain => true,drop_ids => [1],choose_list => []}. get(1022300001) -> #{name__ => "TreasureBox",id => 1022300001,open_level => #{level => 5},use_on_obtain => true,drop_ids => [],choose_list => []}. get(1010010003) -> #{name__ => "TreasureBox",id => 1010010003,open_level => #{level => 6},use_on_obtain => true,drop_ids => [],choose_list => []}. get(1050010001) -> #{name__ => "TreasureBox",id => 1050010001,open_level => #{level => 1},use_on_obtain => false,drop_ids => [1],choose_list => []}. get(1040010001) -> #{name__ => "InteractionItem",id => 1040010001,holding_static_mesh => "",holding_static_mesh_mat => ""}. get(1040020001) -> #{name__ => "InteractionItem",id => 1040020001,holding_static_mesh => "StaticMesh'/Game/X6GameData/Prototype/PrototypeAssets/StaticMesh/SM_Apple.SM_Apple'",holding_static_mesh_mat => "MaterialInstanceConstant'/Game/X6GameData/Prototype/PrototypeAssets/Material/LD_Red.LD_Red'"}. get(1040040001) -> #{name__ => "InteractionItem",id => 1040040001,holding_static_mesh => "StaticMesh'/Game/X6GameData/Prototype/PrototypeAssets/StaticMesh/SM_Ball.SM_Ball'",holding_static_mesh_mat => "MaterialInstanceConstant'/Game/X6GameData/Prototype/PrototypeAssets/CustomizableGrid/Materials/Presets/M_Grid_preset_002.M_Grid_preset_002'"}. get(1040040002) -> #{name__ => "InteractionItem",id => 1040040002,holding_static_mesh => "StaticMesh'/Game/X6GameData/Art_assets/Props/Prop_test/Interactive/PenQuanHua/SM_Penquanhua.SM_Penquanhua'",holding_static_mesh_mat => ""}. get(1040040003) -> #{name__ => "InteractionItem",id => 1040040003,holding_static_mesh => "StaticMesh'/Game/X6GameData/Prototype/PrototypeAssets/StaticMesh/SM_Apple.SM_Apple'",holding_static_mesh_mat => "MaterialInstanceConstant'/Game/X6GameData/Art_assets/Props/Prop_test/Materials/Prop_Red_MI.Prop_Red_MI'"}. get(1040210001) -> #{name__ => "InteractionItem",id => 1040210001,attack_num => 3,holding_static_mesh => "",holding_static_mesh_mat => ""}. get(1040220001) -> #{name__ => "InteractionItem",id => 1040220001,holding_static_mesh => "",holding_static_mesh_mat => ""}. get(1040230001) -> #{name__ => "InteractionItem",id => 1040230001,holding_static_mesh => "",holding_static_mesh_mat => ""}. get(1040240001) -> #{name__ => "InteractionItem",id => 1040240001,holding_static_mesh => "",holding_static_mesh_mat => ""}. get(1040250001) -> #{name__ => "InteractionItem",id => 1040250001,holding_static_mesh => "",holding_static_mesh_mat => ""}. get(1040030001) -> #{name__ => "InteractionItem",id => 1040030001,holding_static_mesh => "",holding_static_mesh_mat => ""}. get(1020100001) -> #{name__ => "Clothes",id => 1020100001,attack => 100,hp => 1000,energy_limit => 5,energy_resume => 1}. get(1020200001) -> #{name__ => "Clothes",id => 1020200001,attack => 100,hp => 1000,energy_limit => 5,energy_resume => 1}. get(1020300001) -> #{name__ => "Clothes",id => 1020300001,attack => 100,hp => 1000,energy_limit => 5,energy_resume => 1}. get(1110010005) -> #{name__ => "DesignDrawing",id => 1110010005,learn_component_id => [1020400006]}. get(1110010006) -> #{name__ => "DesignDrawing",id => 1110010006,learn_component_id => [1020500003]}. get(1110020001) -> #{name__ => "DesignDrawing",id => 1110020001,learn_component_id => [1021009005]}. get(1110020002) -> #{name__ => "DesignDrawing",id => 1110020002,learn_component_id => [1022109005]}. get(1110020003) -> #{name__ => "DesignDrawing",id => 1110020003,learn_component_id => [1020409017]}. get(1110020004) -> #{name__ => "DesignDrawing",id => 1110020004,learn_component_id => [1021409017]}. get(1110020005) -> #{name__ => "DesignDrawing",id => 1110020005,learn_component_id => [1021300002]}. get(1110020009) -> #{name__ => "DesignDrawing",id => 1110020009,learn_component_id => [1020409024]}. get(1110020010) -> #{name__ => "DesignDrawing",id => 1110020010,learn_component_id => [1020509024]}. get(1110020011) -> #{name__ => "DesignDrawing",id => 1110020011,learn_component_id => [1020609024]}. get(1110020012) -> #{name__ => "DesignDrawing",id => 1110020012,learn_component_id => [1020809022]}. get(1110020013) -> #{name__ => "DesignDrawing",id => 1110020013,learn_component_id => [1020709024]}. get(1110020014) -> #{name__ => "DesignDrawing",id => 1110020014,learn_component_id => [1021009024]}. get(1110020015) -> #{name__ => "DesignDrawing",id => 1110020015,learn_component_id => [1021409024]}. get(1110020016) -> #{name__ => "DesignDrawing",id => 1110020016,learn_component_id => [1021309132]}. get(1110020017) -> #{name__ => "DesignDrawing",id => 1110020017,learn_component_id => [1020909132]}. get(1110020018) -> #{name__ => "DesignDrawing",id => 1110020018,learn_component_id => [1021500007]}. get(1110020080) -> #{name__ => "DesignDrawing",id => 1110020080,learn_component_id => [1021009132]}. <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_Snapping_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_Snapping_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.Snapping constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_Snap(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.GetFloat(false); var result = UnityEngine.Snapping.Snap(Arg0,Arg1); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var result = UnityEngine.Snapping.Snap(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3>(false); var result = UnityEngine.Snapping.Snap(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3>(false); var Arg2 = (UnityEngine.SnapAxis)argHelper2.GetByte(false); var result = UnityEngine.Snapping.Snap(Arg0,Arg1,Arg2); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to Snap"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "Snap", IsStatic = true}, F_Snap }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { } }; } } } <|start_filename|>Projects/DataTemplates/template_lua2/test_tbdatafrommisc.lua<|end_filename|> -- test.TbDataFromMisc return { [1] = { x4=1, x1=true, x2=3, x3=128, x5=11223344, x6=1.2, x7=1.23432, x8_0=12312, x8=112233, x9=223344, x10="hq", x12= { x1=10, }, x13=2, x14= { x1=1, x2=2, }, s1={key='/asfa',text="aabbcc"}, v2={x=1,y=2}, v3={x=1.1,y=2.2,z=3.4}, v4={x=10.1,y=11.2,z=12.3,w=13.4}, t1=-28800, k1= { 1, 2, }, k2= { 2, 3, }, k5= { 1, 6, }, k8= { [2] = 2, [4] = 10, }, k9= { { y1=1, y2=true, }, { y1=2, y2=false, }, }, k15= { { x1=1, x2=2, }, }, }, [11] = { x4=11, x1=true, x2=4, x3=128, x5=112233445566, x6=1.3, x7=1112232.43123, x8_0=123, x8=112233, x9=112334, x10="yf", x12= { x1=1, }, x13=4, x14= { x1=1, x2=2, }, s1={key='xml_key1',text="xml text"}, v2={x=1,y=2}, v3={x=1.2,y=2.3,z=3.4}, v4={x=1.2,y=2.2,z=3.2,w=4.3}, t1=-28800, k1= { 1, 2, }, k2= { 1, 2, }, k5= { 1, 2, }, k8= { [2] = 10, [3] = 30, }, k9= { { y1=1, y2=true, }, { y1=2, y2=false, }, }, k15= { { x1=1, x2=2, }, }, }, [2] = { x4=2, x1=true, x2=3, x3=128, x5=11223344, x6=1.2, x7=1.23432, x8_0=12312, x8=112233, x9=223344, x10="hq", x12= { x1=10, }, x13=2, x14= { x1=1, x2=2, }, s1={key='/asfa32',text="<KEY>"}, v2={x=1,y=2}, v3={x=1.1,y=2.2,z=3.4}, v4={x=10.1,y=11.2,z=12.3,w=13.4}, t1=-28800, k1= { 1, 2, }, k2= { 2, 3, }, k5= { 1, 6, }, k8= { [2] = 2, [4] = 10, }, k9= { { y1=1, y2=true, }, { y1=2, y2=false, }, }, k15= { { x1=1, x2=2, }, }, }, [12] = { x4=12, x1=true, x2=4, x3=128, x5=112233445566, x6=1.3, x7=1112232.43123, x8_0=123, x8=112233, x9=112334, x10="yf", x12= { x1=1, }, x13=4, x14= { x1=1, x2=2, }, s1={key='xml_key2',text="xml text222"}, v2={x=1,y=2}, v3={x=1.2,y=2.3,z=3.4}, v4={x=1.2,y=2.2,z=3.2,w=4.3}, t1=-28800, k1= { 1, 2, }, k2= { 1, 2, }, k5= { 1, 2, }, k8= { [2] = 10, [3] = 30, }, k9= { { y1=1, y2=true, }, { y1=2, y2=false, }, }, k15= { { x1=1, x2=2, }, }, }, [40] = { x4=40, x1=true, x2=3, x3=128, x5=11223344, x6=1.2, x7=1.23432, x8_0=12312, x8=112233, x9=223344, x10="hq", x12= { x1=10, }, x13=2, x14= { x1=1, x2=2, }, s1={key='/asfa32',text="aabbcc22"}, v2={x=1,y=2}, v3={x=1.1,y=2.2,z=3.4}, v4={x=10.1,y=11.2,z=12.3,w=13.4}, t1=-28800, k1= { 1, 2, }, k2= { 2, 3, }, k5= { 1, 6, }, k8= { [2] = 2, [4] = 10, }, k9= { { y1=1, y2=true, }, { y1=2, y2=false, }, }, k15= { { x1=1, x2=2, }, }, }, [22] = { x4=22, x1=false, x2=2, x3=128, x5=112233445566, x6=1.3, x7=1122, x8_0=13, x8=12, x9=123, x10="yf", x12= { x1=1, }, x13=5, x14= { x1=1, x2=3, }, s1={key='lua/key1',text="lua text "}, v2={x=1,y=2}, v3={x=0.1,y=0.2,z=0.3}, v4={x=1,y=2,z=3.5,w=4}, t1=-28800, k1= { 1, 2, }, k2= { 2, 3, }, k5= { 1, 3, }, k8= { [2] = 10, [3] = 12, }, k9= { { y1=1, y2=true, }, { y1=10, y2=false, }, }, k15= { { x1=1, x2=3, }, }, }, } <|start_filename|>Projects/Csharp_Unity_bin_use_UnityEngine_Vector/Assets/Gen/test/TbMultiUnionIndexList.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.test { public sealed class TbMultiUnionIndexList { private readonly List<test.MultiUnionIndexList> _dataList; public TbMultiUnionIndexList(ByteBuf _buf) { _dataList = new List<test.MultiUnionIndexList>(); for(int n = _buf.ReadSize() ; n > 0 ; --n) { test.MultiUnionIndexList _v; _v = test.MultiUnionIndexList.DeserializeMultiUnionIndexList(_buf); } } public List<test.MultiUnionIndexList> DataList => _dataList; public test.MultiUnionIndexList Get(int index) => _dataList[index]; public test.MultiUnionIndexList this[int index] => _dataList[index]; public void Resolve(Dictionary<string, object> _tables) { foreach(var v in _dataList) { v.Resolve(_tables); } } public void TranslateText(System.Func<string, string, string> translator) { foreach(var v in _dataList) { v.TranslateText(translator); } } } } <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/test/DemoE1.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.test { public sealed partial class DemoE1 : test.DemoD3 { public DemoE1(ByteBuf _buf) : base(_buf) { X4 = _buf.ReadInt(); } public DemoE1(int x1, int x3, int x4 ) : base(x1,x3) { this.X4 = x4; } public static DemoE1 DeserializeDemoE1(ByteBuf _buf) { return new test.DemoE1(_buf); } public readonly int X4; public const int ID = -2138341717; public override int GetTypeId() => ID; public override void Resolve(Dictionary<string, object> _tables) { base.Resolve(_tables); OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); public override string ToString() { return "{ " + "X1:" + X1 + "," + "X3:" + X3 + "," + "X4:" + X4 + "," + "}"; } } } <|start_filename|>Projects/GenerateDatas/convert_lua/role.TbRoleLevelExpAttr/70.lua<|end_filename|> return { level = 70, need_exp = 175000, clothes_attrs = { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, }, } <|start_filename|>Projects/DataTemplates/template_erlang2/item_tbitem.erl<|end_filename|> %% item.TbItem -module(item_tbitem) -export([get/1,get_ids/0]) get(1) -> #{ id => 1, name => "钻石", major_type => 1, minor_type => 101, max_pile_num => 9999999, quality => 0, icon => "/Game/UI/UIText/UI_TestIcon_3.UI_TestIcon_3", icon_backgroud => "", icon_mask => "", desc => "rmb兑换的主要货币", show_order => 1, quantifier => "个", show_in_bag => true, min_show_level => 5, batch_usable => true, progress_time_when_use => 1, show_hint_when_use => false, droppable => false, price => null, use_type => 0, level_up_id => null }. get(2) -> #{ id => 2, name => "金币", major_type => 1, minor_type => 102, max_pile_num => 9999999, quality => 0, icon => "/Game/UI/UIText/UI_TestIcon_1.UI_TestIcon_1", icon_backgroud => "", icon_mask => "", desc => "主要的高级流通代币", show_order => 2, quantifier => "个", show_in_bag => true, min_show_level => 5, batch_usable => true, progress_time_when_use => 1, show_hint_when_use => false, droppable => false, price => null, use_type => 0, level_up_id => null }. get(3) -> #{ id => 3, name => "银币", major_type => 1, minor_type => 103, max_pile_num => 9999999, quality => 0, icon => "/Game/UI/UIText/UI_TestIcon_2.UI_TestIcon_2", icon_backgroud => "", icon_mask => "", desc => "主要的流通代币", show_order => 3, quantifier => "个", show_in_bag => true, min_show_level => 5, batch_usable => true, progress_time_when_use => 1, show_hint_when_use => false, droppable => false, price => null, use_type => 0, level_up_id => null }. get(4) -> #{ id => 4, name => "经验", major_type => 1, minor_type => 104, max_pile_num => 9999999, quality => 0, icon => "/Game/UI/UIText/UI_TestIcon_1.UI_TestIcon_1", icon_backgroud => "", icon_mask => "", desc => "人物升级需要的经验", show_order => 4, quantifier => "点", show_in_bag => true, min_show_level => 5, batch_usable => true, progress_time_when_use => 1, show_hint_when_use => false, droppable => false, price => null, use_type => 0, level_up_id => null }. get(5) -> #{ id => 5, name => "能量点", major_type => 1, minor_type => 105, max_pile_num => 9999999, quality => 0, icon => "/Game/UI/UIText/UI_TestIcon_1.UI_TestIcon_1", icon_backgroud => "", icon_mask => "", desc => "人物变身需要的能量点", show_order => 5, quantifier => "点", show_in_bag => true, min_show_level => 5, batch_usable => true, progress_time_when_use => 1, show_hint_when_use => false, droppable => false, price => null, use_type => 0, level_up_id => null }. get(1020100001) -> #{ id => 1020100001, name => "初始发型", major_type => 2, minor_type => 210, max_pile_num => 1, quality => 0, icon => "/Game/UI/UIText/IocnResource/Frames/S0012H_png.S0012H_png", icon_backgroud => "", icon_mask => "", desc => "初始发型", show_order => 6, quantifier => "套", show_in_bag => true, min_show_level => 5, batch_usable => true, progress_time_when_use => 1, show_hint_when_use => false, droppable => false, price => null, use_type => 0, level_up_id => null }. get(1020200001) -> #{ id => 1020200001, name => "初始外套", major_type => 2, minor_type => 220, max_pile_num => 1, quality => 0, icon => "/Game/UI/UIText/IocnResource/Frames/S0006_2C_png.S0006_2C_png", icon_backgroud => "", icon_mask => "", desc => "初始外套", show_order => 7, quantifier => "件", show_in_bag => true, min_show_level => 5, batch_usable => true, progress_time_when_use => 1, show_hint_when_use => false, droppable => false, price => null, use_type => 0, level_up_id => null }. get(1020300001) -> #{ id => 1020300001, name => "初始上衣", major_type => 2, minor_type => 230, max_pile_num => 1, quality => 0, icon => "/Game/UI/UIText/IocnResource/Frames/S0090ABS_png.S0090ABS_png", icon_backgroud => "", icon_mask => "", desc => "初始上衣", show_order => 8, quantifier => "件", show_in_bag => true, min_show_level => 5, batch_usable => true, progress_time_when_use => 1, show_hint_when_use => false, droppable => false, price => null, use_type => 0, level_up_id => null }. get(1020400001) -> #{ id => 1020400001, name => "初始裤子", major_type => 2, minor_type => 242, max_pile_num => 1, quality => 0, icon => "/Game/UI/UIText/UI_TestIcon_1.UI_TestIcon_1", icon_backgroud => "", icon_mask => "", desc => "初始下装", show_order => 9, quantifier => "件", show_in_bag => true, min_show_level => 5, batch_usable => true, progress_time_when_use => 1, show_hint_when_use => false, droppable => false, price => null, use_type => 0, level_up_id => null }. get(1020500001) -> #{ id => 1020500001, name => "初始袜子", major_type => 2, minor_type => 250, max_pile_num => 1, quality => 0, icon => "/Game/UI/UIText/IocnResource/Frames/S0012S_png.S0012S_png", icon_backgroud => "", icon_mask => "", desc => "初始袜子", show_order => 10, quantifier => "双", show_in_bag => true, min_show_level => 5, batch_usable => true, progress_time_when_use => 1, show_hint_when_use => false, droppable => false, price => null, use_type => 0, level_up_id => null }. get(1020600001) -> #{ id => 1020600001, name => "初始鞋子", major_type => 2, minor_type => 260, max_pile_num => 1, quality => 0, icon => "/Game/UI/UIText/IocnResource/Frames/S0012BS_png.S0012BS_png", icon_backgroud => "", icon_mask => "", desc => "初始鞋子", show_order => 11, quantifier => "双", show_in_bag => true, min_show_level => 5, batch_usable => true, progress_time_when_use => 1, show_hint_when_use => false, droppable => false, price => null, use_type => 0, level_up_id => null }. get(1020700001) -> #{ id => 1020700001, name => "初始发饰", major_type => 2, minor_type => 271, max_pile_num => 1, quality => 0, icon => "/Game/UI/UIText/IocnResource/Frames/S0090_X1AHC_png.S0090_X1AHC_png", icon_backgroud => "", icon_mask => "", desc => "初始发饰", show_order => 12, quantifier => "套", show_in_bag => true, min_show_level => 5, batch_usable => true, progress_time_when_use => 1, show_hint_when_use => false, droppable => false, price => null, use_type => 0, level_up_id => null }. get(1022490000) -> #{ id => 1022490000, name => "测试数据-包子", major_type => 4, minor_type => 403, max_pile_num => 100, quality => 2, icon => "/Game/UI/UIText/UI_TestIcon_1.UI_TestIcon_1", icon_backgroud => "", icon_mask => "", desc => "包子", show_order => 29, quantifier => "个", show_in_bag => true, min_show_level => 5, batch_usable => true, progress_time_when_use => 1, show_hint_when_use => false, droppable => true, price => null, use_type => 1, level_up_id => null }. get(1022490001) -> #{ id => 1022490001, name => "测试数据-铲子", major_type => 4, minor_type => 424, max_pile_num => 1, quality => 3, icon => "/Game/UI/UIText/UI_TestIcon_1.UI_TestIcon_1", icon_backgroud => "", icon_mask => "", desc => "一把铲子", show_order => 30, quantifier => "把", show_in_bag => true, min_show_level => 5, batch_usable => true, progress_time_when_use => 1, show_hint_when_use => false, droppable => false, price => 100, use_type => 0, level_up_id => null }. get(1021490001) -> #{ id => 1021490001, name => "测试数据-不要动", major_type => 2, minor_type => 278, max_pile_num => 1, quality => 0, icon => "/Game/UI/UIText/IocnResource/Frames/S0090FE_01_png.S0090FE_01_png", icon_backgroud => "", icon_mask => "", desc => "初始手持物", show_order => 19, quantifier => "件", show_in_bag => true, min_show_level => 5, batch_usable => true, progress_time_when_use => 1, show_hint_when_use => false, droppable => false, price => null, use_type => 0, level_up_id => null }. get(1022490002) -> #{ id => 1022490002, name => "测试数据-不要动", major_type => 2, minor_type => 290, max_pile_num => 1, quality => 2, icon => "/Game/UI/UIText/IocnResource/Frames/S0090D_png.S0090D_png", icon_backgroud => "", icon_mask => "", desc => "初始套装", show_order => 26, quantifier => "个", show_in_bag => true, min_show_level => 5, batch_usable => true, progress_time_when_use => 1, show_hint_when_use => false, droppable => false, price => 8, use_type => 0, level_up_id => null }. get_ids() -> [1,2,3,4,5,1020100001,1020200001,1020300001,1020400001,1020500001,1020600001,1020700001,1022490000,1022490001,1021490001,1022490002]. <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_PlayerPrefs_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_PlayerPrefs_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.PlayerPrefs(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.PlayerPrefs), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_SetInt(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.GetInt32(false); UnityEngine.PlayerPrefs.SetInt(Arg0,Arg1); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetInt(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.GetInt32(false); var result = UnityEngine.PlayerPrefs.GetInt(Arg0,Arg1); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var result = UnityEngine.PlayerPrefs.GetInt(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetInt"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_SetFloat(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.GetFloat(false); UnityEngine.PlayerPrefs.SetFloat(Arg0,Arg1); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetFloat(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.GetFloat(false); var result = UnityEngine.PlayerPrefs.GetFloat(Arg0,Arg1); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var result = UnityEngine.PlayerPrefs.GetFloat(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetFloat"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_SetString(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.GetString(false); UnityEngine.PlayerPrefs.SetString(Arg0,Arg1); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetString(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.GetString(false); var result = UnityEngine.PlayerPrefs.GetString(Arg0,Arg1); Puerts.PuertsDLL.ReturnString(isolate, info, result); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var result = UnityEngine.PlayerPrefs.GetString(Arg0); Puerts.PuertsDLL.ReturnString(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetString"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_HasKey(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetString(false); var result = UnityEngine.PlayerPrefs.HasKey(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_DeleteKey(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetString(false); UnityEngine.PlayerPrefs.DeleteKey(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_DeleteAll(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { { UnityEngine.PlayerPrefs.DeleteAll(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_Save(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { { UnityEngine.PlayerPrefs.Save(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "SetInt", IsStatic = true}, F_SetInt }, { new Puerts.MethodKey {Name = "GetInt", IsStatic = true}, F_GetInt }, { new Puerts.MethodKey {Name = "SetFloat", IsStatic = true}, F_SetFloat }, { new Puerts.MethodKey {Name = "GetFloat", IsStatic = true}, F_GetFloat }, { new Puerts.MethodKey {Name = "SetString", IsStatic = true}, F_SetString }, { new Puerts.MethodKey {Name = "GetString", IsStatic = true}, F_GetString }, { new Puerts.MethodKey {Name = "HasKey", IsStatic = true}, F_HasKey }, { new Puerts.MethodKey {Name = "DeleteKey", IsStatic = true}, F_DeleteKey }, { new Puerts.MethodKey {Name = "DeleteAll", IsStatic = true}, F_DeleteAll }, { new Puerts.MethodKey {Name = "Save", IsStatic = true}, F_Save }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { } }; } } } <|start_filename|>Projects/DataTemplates/template_lua/test_tbtestset.lua<|end_filename|> return { [1] = {id=1,x1={1,2,3,},x2={2,3,4,},x3={"ab","cd",},x4={1,2,},}, [2] = {id=2,x1={1,2,},x2={2,3,},x3={"ab","cd",},x4={1,},}, } <|start_filename|>Projects/GenerateDatas/convert_lua/l10n.TbL10NDemo/13.lua<|end_filename|> return { id = 13, text = {key='/demo/3',text="测试3"}, } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_ImageConversion_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_ImageConversion_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.ImageConversion constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_EncodeToTGA(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Texture2D>(false); var result = UnityEngine.ImageConversion.EncodeToTGA(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_EncodeToPNG(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Texture2D>(false); var result = UnityEngine.ImageConversion.EncodeToPNG(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_EncodeToJPG(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture2D), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Texture2D>(false); var Arg1 = argHelper1.GetInt32(false); var result = UnityEngine.ImageConversion.EncodeToJPG(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture2D), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Texture2D>(false); var result = UnityEngine.ImageConversion.EncodeToJPG(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to EncodeToJPG"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_EncodeToEXR(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture2D), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Texture2D>(false); var Arg1 = (UnityEngine.Texture2D.EXRFlags)argHelper1.GetInt32(false); var result = UnityEngine.ImageConversion.EncodeToEXR(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture2D), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Texture2D>(false); var result = UnityEngine.ImageConversion.EncodeToEXR(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to EncodeToEXR"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_LoadImage(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture2D), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(byte[]), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Texture2D>(false); var Arg1 = argHelper1.Get<byte[]>(false); var Arg2 = argHelper2.GetBoolean(false); var result = UnityEngine.ImageConversion.LoadImage(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture2D), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(byte[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Texture2D>(false); var Arg1 = argHelper1.Get<byte[]>(false); var result = UnityEngine.ImageConversion.LoadImage(Arg0,Arg1); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to LoadImage"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_EncodeArrayToTGA(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Array), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<System.Array>(false); var Arg1 = (UnityEngine.Experimental.Rendering.GraphicsFormat)argHelper1.GetInt32(false); var Arg2 = argHelper2.GetUInt32(false); var Arg3 = argHelper3.GetUInt32(false); var Arg4 = argHelper4.GetUInt32(false); var result = UnityEngine.ImageConversion.EncodeArrayToTGA(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Array), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<System.Array>(false); var Arg1 = (UnityEngine.Experimental.Rendering.GraphicsFormat)argHelper1.GetInt32(false); var Arg2 = argHelper2.GetUInt32(false); var Arg3 = argHelper3.GetUInt32(false); var result = UnityEngine.ImageConversion.EncodeArrayToTGA(Arg0,Arg1,Arg2,Arg3); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to EncodeArrayToTGA"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_EncodeArrayToPNG(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Array), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<System.Array>(false); var Arg1 = (UnityEngine.Experimental.Rendering.GraphicsFormat)argHelper1.GetInt32(false); var Arg2 = argHelper2.GetUInt32(false); var Arg3 = argHelper3.GetUInt32(false); var Arg4 = argHelper4.GetUInt32(false); var result = UnityEngine.ImageConversion.EncodeArrayToPNG(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Array), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<System.Array>(false); var Arg1 = (UnityEngine.Experimental.Rendering.GraphicsFormat)argHelper1.GetInt32(false); var Arg2 = argHelper2.GetUInt32(false); var Arg3 = argHelper3.GetUInt32(false); var result = UnityEngine.ImageConversion.EncodeArrayToPNG(Arg0,Arg1,Arg2,Arg3); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to EncodeArrayToPNG"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_EncodeArrayToJPG(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 6) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Array), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<System.Array>(false); var Arg1 = (UnityEngine.Experimental.Rendering.GraphicsFormat)argHelper1.GetInt32(false); var Arg2 = argHelper2.GetUInt32(false); var Arg3 = argHelper3.GetUInt32(false); var Arg4 = argHelper4.GetUInt32(false); var Arg5 = argHelper5.GetInt32(false); var result = UnityEngine.ImageConversion.EncodeArrayToJPG(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Array), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<System.Array>(false); var Arg1 = (UnityEngine.Experimental.Rendering.GraphicsFormat)argHelper1.GetInt32(false); var Arg2 = argHelper2.GetUInt32(false); var Arg3 = argHelper3.GetUInt32(false); var Arg4 = argHelper4.GetUInt32(false); var result = UnityEngine.ImageConversion.EncodeArrayToJPG(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Array), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<System.Array>(false); var Arg1 = (UnityEngine.Experimental.Rendering.GraphicsFormat)argHelper1.GetInt32(false); var Arg2 = argHelper2.GetUInt32(false); var Arg3 = argHelper3.GetUInt32(false); var result = UnityEngine.ImageConversion.EncodeArrayToJPG(Arg0,Arg1,Arg2,Arg3); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to EncodeArrayToJPG"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_EncodeArrayToEXR(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 6) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Array), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<System.Array>(false); var Arg1 = (UnityEngine.Experimental.Rendering.GraphicsFormat)argHelper1.GetInt32(false); var Arg2 = argHelper2.GetUInt32(false); var Arg3 = argHelper3.GetUInt32(false); var Arg4 = argHelper4.GetUInt32(false); var Arg5 = (UnityEngine.Texture2D.EXRFlags)argHelper5.GetInt32(false); var result = UnityEngine.ImageConversion.EncodeArrayToEXR(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Array), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<System.Array>(false); var Arg1 = (UnityEngine.Experimental.Rendering.GraphicsFormat)argHelper1.GetInt32(false); var Arg2 = argHelper2.GetUInt32(false); var Arg3 = argHelper3.GetUInt32(false); var Arg4 = argHelper4.GetUInt32(false); var result = UnityEngine.ImageConversion.EncodeArrayToEXR(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Array), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<System.Array>(false); var Arg1 = (UnityEngine.Experimental.Rendering.GraphicsFormat)argHelper1.GetInt32(false); var Arg2 = argHelper2.GetUInt32(false); var Arg3 = argHelper3.GetUInt32(false); var result = UnityEngine.ImageConversion.EncodeArrayToEXR(Arg0,Arg1,Arg2,Arg3); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to EncodeArrayToEXR"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_EnableLegacyPngGammaRuntimeLoadBehavior(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.ImageConversion.EnableLegacyPngGammaRuntimeLoadBehavior; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_EnableLegacyPngGammaRuntimeLoadBehavior(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.ImageConversion.EnableLegacyPngGammaRuntimeLoadBehavior = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "EncodeToTGA", IsStatic = true}, F_EncodeToTGA }, { new Puerts.MethodKey {Name = "EncodeToPNG", IsStatic = true}, F_EncodeToPNG }, { new Puerts.MethodKey {Name = "EncodeToJPG", IsStatic = true}, F_EncodeToJPG }, { new Puerts.MethodKey {Name = "EncodeToEXR", IsStatic = true}, F_EncodeToEXR }, { new Puerts.MethodKey {Name = "LoadImage", IsStatic = true}, F_LoadImage }, { new Puerts.MethodKey {Name = "EncodeArrayToTGA", IsStatic = true}, F_EncodeArrayToTGA }, { new Puerts.MethodKey {Name = "EncodeArrayToPNG", IsStatic = true}, F_EncodeArrayToPNG }, { new Puerts.MethodKey {Name = "EncodeArrayToJPG", IsStatic = true}, F_EncodeArrayToJPG }, { new Puerts.MethodKey {Name = "EncodeArrayToEXR", IsStatic = true}, F_EncodeArrayToEXR }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"EnableLegacyPngGammaRuntimeLoadBehavior", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_EnableLegacyPngGammaRuntimeLoadBehavior, Setter = S_EnableLegacyPngGammaRuntimeLoadBehavior} }, } }; } } } <|start_filename|>Projects/Java_bin/src/main/gen/cfg/ai/Selector.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.ai; import bright.serialization.*; public final class Selector extends cfg.ai.ComposeNode { public Selector(ByteBuf _buf) { super(_buf); {int n = Math.min(_buf.readSize(), _buf.size());children = new java.util.ArrayList<cfg.ai.FlowNode>(n);for(int i = 0 ; i < n ; i++) { cfg.ai.FlowNode _e; _e = cfg.ai.FlowNode.deserializeFlowNode(_buf); children.add(_e);}} } public Selector(int id, String node_name, java.util.ArrayList<cfg.ai.Decorator> decorators, java.util.ArrayList<cfg.ai.Service> services, java.util.ArrayList<cfg.ai.FlowNode> children ) { super(id, node_name, decorators, services); this.children = children; } public final java.util.ArrayList<cfg.ai.FlowNode> children; public static final int __ID__ = -1946981627; @Override public int getTypeId() { return __ID__; } @Override public void resolve(java.util.HashMap<String, Object> _tables) { super.resolve(_tables); for(cfg.ai.FlowNode _e : children) { if (_e != null) _e.resolve(_tables); } } @Override public String toString() { return "{ " + "id:" + id + "," + "nodeName:" + nodeName + "," + "decorators:" + decorators + "," + "services:" + services + "," + "children:" + children + "," + "}"; } } <|start_filename|>Projects/DataTemplates/template_erlang/test_tbsingleton.erl<|end_filename|> %% test.TbSingleton get() -> #{id => 5,name => #{key=>"key_name",text=>"aabbcc"},date => #{name__ => "DemoD5",x1 => 1,time => #{start_time => 398966400,end_time => 936806400}}}. <|start_filename|>Projects/DataTemplates/template_lua/test_tbdefinefromexcelone.lua<|end_filename|> return {unlock_equip=10,unlock_hero=20,default_avatar="Assets/Icon/DefaultAvatar.png",default_item="Assets/Icon/DefaultAvatar.png",} <|start_filename|>Projects/Lua_Unity_xlua_lua/Assets/Lua/Data/test_tbcompositejsontable3.lua<|end_filename|> return {a=111,b=222,} <|start_filename|>Projects/DataTemplates/template_json/common_tbglobalconfig.json<|end_filename|> {"bag_capacity":500,"bag_capacity_special":50,"bag_temp_expendable_capacity":10,"bag_temp_tool_capacity":4,"bag_init_capacity":100,"quick_bag_capacity":4,"cloth_bag_capacity":1000,"cloth_bag_init_capacity":500,"cloth_bag_capacity_special":50,"bag_init_items_drop_id":1,"mail_box_capacity":100,"damage_param_c":1,"damage_param_e":0.75,"damage_param_f":10,"damage_param_d":0.8,"role_speed":5,"monster_speed":5,"init_energy":0,"init_viality":100,"max_viality":100,"per_viality_recovery_time":300} <|start_filename|>Projects/Java_bin/src/main/gen/cfg/bonus/ProbabilityBonus.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.bonus; import bright.serialization.*; public final class ProbabilityBonus extends cfg.bonus.Bonus { public ProbabilityBonus(ByteBuf _buf) { super(_buf); {int n = Math.min(_buf.readSize(), _buf.size());bonuses = new cfg.bonus.ProbabilityBonusInfo[n];for(int i = 0 ; i < n ; i++) { cfg.bonus.ProbabilityBonusInfo _e;_e = new cfg.bonus.ProbabilityBonusInfo(_buf); bonuses[i] = _e;}} } public ProbabilityBonus(cfg.bonus.ProbabilityBonusInfo[] bonuses ) { super(); this.bonuses = bonuses; } public final cfg.bonus.ProbabilityBonusInfo[] bonuses; public static final int __ID__ = 359783161; @Override public int getTypeId() { return __ID__; } @Override public void resolve(java.util.HashMap<String, Object> _tables) { super.resolve(_tables); for(cfg.bonus.ProbabilityBonusInfo _e : bonuses) { if (_e != null) _e.resolve(_tables); } } @Override public String toString() { return "{ " + "bonuses:" + bonuses + "," + "}"; } } <|start_filename|>Projects/GenerateDatas/convert_lua/test.TbDetectCsvEncoding/33.lua<|end_filename|> return { id = 33, name = "工枯加盟仍", } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_AssetBundle_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_AssetBundle_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.AssetBundle constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_UnloadAllAssetBundles(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetBoolean(false); UnityEngine.AssetBundle.UnloadAllAssetBundles(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetAllLoadedAssetBundles(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { { var result = UnityEngine.AssetBundle.GetAllLoadedAssetBundles(); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_LoadFromFileAsync(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var result = UnityEngine.AssetBundle.LoadFromFileAsync(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.GetUInt32(false); var result = UnityEngine.AssetBundle.LoadFromFileAsync(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.BigInt, null, false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.GetUInt32(false); var Arg2 = argHelper2.GetUInt64(false); var result = UnityEngine.AssetBundle.LoadFromFileAsync(Arg0,Arg1,Arg2); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to LoadFromFileAsync"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_LoadFromFile(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var result = UnityEngine.AssetBundle.LoadFromFile(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.GetUInt32(false); var result = UnityEngine.AssetBundle.LoadFromFile(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.BigInt, null, false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.GetUInt32(false); var Arg2 = argHelper2.GetUInt64(false); var result = UnityEngine.AssetBundle.LoadFromFile(Arg0,Arg1,Arg2); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to LoadFromFile"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_LoadFromMemoryAsync(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(byte[]), false, false)) { var Arg0 = argHelper0.Get<byte[]>(false); var result = UnityEngine.AssetBundle.LoadFromMemoryAsync(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(byte[]), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<byte[]>(false); var Arg1 = argHelper1.GetUInt32(false); var result = UnityEngine.AssetBundle.LoadFromMemoryAsync(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to LoadFromMemoryAsync"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_LoadFromMemory(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(byte[]), false, false)) { var Arg0 = argHelper0.Get<byte[]>(false); var result = UnityEngine.AssetBundle.LoadFromMemory(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(byte[]), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<byte[]>(false); var Arg1 = argHelper1.GetUInt32(false); var result = UnityEngine.AssetBundle.LoadFromMemory(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to LoadFromMemory"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_LoadFromStreamAsync(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.IO.Stream), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<System.IO.Stream>(false); var Arg1 = argHelper1.GetUInt32(false); var Arg2 = argHelper2.GetUInt32(false); var result = UnityEngine.AssetBundle.LoadFromStreamAsync(Arg0,Arg1,Arg2); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.IO.Stream), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<System.IO.Stream>(false); var Arg1 = argHelper1.GetUInt32(false); var result = UnityEngine.AssetBundle.LoadFromStreamAsync(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.IO.Stream), false, false)) { var Arg0 = argHelper0.Get<System.IO.Stream>(false); var result = UnityEngine.AssetBundle.LoadFromStreamAsync(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to LoadFromStreamAsync"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_LoadFromStream(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.IO.Stream), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<System.IO.Stream>(false); var Arg1 = argHelper1.GetUInt32(false); var Arg2 = argHelper2.GetUInt32(false); var result = UnityEngine.AssetBundle.LoadFromStream(Arg0,Arg1,Arg2); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.IO.Stream), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<System.IO.Stream>(false); var Arg1 = argHelper1.GetUInt32(false); var result = UnityEngine.AssetBundle.LoadFromStream(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.IO.Stream), false, false)) { var Arg0 = argHelper0.Get<System.IO.Stream>(false); var result = UnityEngine.AssetBundle.LoadFromStream(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to LoadFromStream"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Contains(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AssetBundle; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetString(false); var result = obj.Contains(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_LoadAsset(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AssetBundle; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var result = obj.LoadAsset(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Type), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<System.Type>(false); var result = obj.LoadAsset(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to LoadAsset"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_LoadAssetAsync(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AssetBundle; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var result = obj.LoadAssetAsync(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Type), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<System.Type>(false); var result = obj.LoadAssetAsync(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to LoadAssetAsync"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_LoadAssetWithSubAssets(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AssetBundle; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var result = obj.LoadAssetWithSubAssets(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Type), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<System.Type>(false); var result = obj.LoadAssetWithSubAssets(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to LoadAssetWithSubAssets"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_LoadAssetWithSubAssetsAsync(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AssetBundle; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var result = obj.LoadAssetWithSubAssetsAsync(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Type), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<System.Type>(false); var result = obj.LoadAssetWithSubAssetsAsync(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to LoadAssetWithSubAssetsAsync"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_LoadAllAssets(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AssetBundle; if (paramLen == 0) { { var result = obj.LoadAllAssets(); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Type), false, false)) { var Arg0 = argHelper0.Get<System.Type>(false); var result = obj.LoadAllAssets(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to LoadAllAssets"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_LoadAllAssetsAsync(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AssetBundle; if (paramLen == 0) { { var result = obj.LoadAllAssetsAsync(); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Type), false, false)) { var Arg0 = argHelper0.Get<System.Type>(false); var result = obj.LoadAllAssetsAsync(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to LoadAllAssetsAsync"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Unload(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AssetBundle; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetBoolean(false); obj.Unload(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetAllAssetNames(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AssetBundle; { { var result = obj.GetAllAssetNames(); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetAllScenePaths(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AssetBundle; { { var result = obj.GetAllScenePaths(); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_RecompressAssetBundleAsync(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.BuildCompression), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.GetString(false); var Arg2 = argHelper2.Get<UnityEngine.BuildCompression>(false); var Arg3 = argHelper3.GetUInt32(false); var Arg4 = (UnityEngine.ThreadPriority)argHelper4.GetInt32(false); var result = UnityEngine.AssetBundle.RecompressAssetBundleAsync(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.BuildCompression), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.GetString(false); var Arg2 = argHelper2.Get<UnityEngine.BuildCompression>(false); var Arg3 = argHelper3.GetUInt32(false); var result = UnityEngine.AssetBundle.RecompressAssetBundleAsync(Arg0,Arg1,Arg2,Arg3); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.BuildCompression), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.GetString(false); var Arg2 = argHelper2.Get<UnityEngine.BuildCompression>(false); var result = UnityEngine.AssetBundle.RecompressAssetBundleAsync(Arg0,Arg1,Arg2); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to RecompressAssetBundleAsync"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_isStreamedSceneAssetBundle(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AssetBundle; var result = obj.isStreamedSceneAssetBundle; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "UnloadAllAssetBundles", IsStatic = true}, F_UnloadAllAssetBundles }, { new Puerts.MethodKey {Name = "GetAllLoadedAssetBundles", IsStatic = true}, F_GetAllLoadedAssetBundles }, { new Puerts.MethodKey {Name = "LoadFromFileAsync", IsStatic = true}, F_LoadFromFileAsync }, { new Puerts.MethodKey {Name = "LoadFromFile", IsStatic = true}, F_LoadFromFile }, { new Puerts.MethodKey {Name = "LoadFromMemoryAsync", IsStatic = true}, F_LoadFromMemoryAsync }, { new Puerts.MethodKey {Name = "LoadFromMemory", IsStatic = true}, F_LoadFromMemory }, { new Puerts.MethodKey {Name = "LoadFromStreamAsync", IsStatic = true}, F_LoadFromStreamAsync }, { new Puerts.MethodKey {Name = "LoadFromStream", IsStatic = true}, F_LoadFromStream }, { new Puerts.MethodKey {Name = "Contains", IsStatic = false}, M_Contains }, { new Puerts.MethodKey {Name = "LoadAsset", IsStatic = false}, M_LoadAsset }, { new Puerts.MethodKey {Name = "LoadAssetAsync", IsStatic = false}, M_LoadAssetAsync }, { new Puerts.MethodKey {Name = "LoadAssetWithSubAssets", IsStatic = false}, M_LoadAssetWithSubAssets }, { new Puerts.MethodKey {Name = "LoadAssetWithSubAssetsAsync", IsStatic = false}, M_LoadAssetWithSubAssetsAsync }, { new Puerts.MethodKey {Name = "LoadAllAssets", IsStatic = false}, M_LoadAllAssets }, { new Puerts.MethodKey {Name = "LoadAllAssetsAsync", IsStatic = false}, M_LoadAllAssetsAsync }, { new Puerts.MethodKey {Name = "Unload", IsStatic = false}, M_Unload }, { new Puerts.MethodKey {Name = "GetAllAssetNames", IsStatic = false}, M_GetAllAssetNames }, { new Puerts.MethodKey {Name = "GetAllScenePaths", IsStatic = false}, M_GetAllScenePaths }, { new Puerts.MethodKey {Name = "RecompressAssetBundleAsync", IsStatic = true}, F_RecompressAssetBundleAsync }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"isStreamedSceneAssetBundle", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_isStreamedSceneAssetBundle, Setter = null} }, } }; } } } <|start_filename|>Projects/Go_json/gen/src/cfg/test.TbCompositeJsonTable3.go<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg import "errors" type TestTbCompositeJsonTable3 struct { _data *TestCompositeJsonTable3 } func NewTestTbCompositeJsonTable3(_buf []map[string]interface{}) (*TestTbCompositeJsonTable3, error) { if len(_buf) != 1 { return nil, errors.New(" size != 1 ") } else { if _v, err2 := DeserializeTestCompositeJsonTable3(_buf[0]); err2 != nil { return nil, err2 } else { return &TestTbCompositeJsonTable3{_data:_v}, nil } } } func (table *TestTbCompositeJsonTable3) Get() *TestCompositeJsonTable3 { return table._data } <|start_filename|>Projects/GenerateDatas/convert_lua/test.TbTestBeRef/5.lua<|end_filename|> return { id = 5, count = 10, } <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/item/EClothersStarQualityType.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ namespace cfg.item { public enum EClothersStarQualityType { /// <summary> /// 一星 /// </summary> ONE = 1, /// <summary> /// 二星 /// </summary> TWO = 2, /// <summary> /// 三星 /// </summary> THREE = 3, /// <summary> /// 四星 /// </summary> FOUR = 4, /// <summary> /// 五星 /// </summary> FIVE = 5, /// <summary> /// 六星 /// </summary> SIX = 6, /// <summary> /// 七星 /// </summary> SEVEN = 7, /// <summary> /// 八星 /// </summary> EIGHT = 8, /// <summary> /// 九星 /// </summary> NINE = 9, /// <summary> /// 十星 /// </summary> TEN = 10, } } <|start_filename|>Projects/Java_bin/src/main/gen/cfg/test/TbMultiIndexList.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.test; import bright.serialization.*; public final class TbMultiIndexList { private final java.util.ArrayList<cfg.test.MultiIndexList> _dataList; public TbMultiIndexList(ByteBuf _buf) { _dataList = new java.util.ArrayList<cfg.test.MultiIndexList>(); for(int n = _buf.readSize() ; n > 0 ; --n) { cfg.test.MultiIndexList _v; _v = new cfg.test.MultiIndexList(_buf); _dataList.add(_v); } } public java.util.ArrayList<cfg.test.MultiIndexList> getDataList() { return _dataList; } public cfg.test.MultiIndexList get(int index) { return _dataList.get(index); } public void resolve(java.util.HashMap<String, Object> _tables) { for(cfg.test.MultiIndexList v : _dataList) { v.resolve(_tables); } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_AvatarMask_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_AvatarMask_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.AvatarMask(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.AvatarMask), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetHumanoidBodyPartActive(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AvatarMask; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = (UnityEngine.AvatarMaskBodyPart)argHelper0.GetInt32(false); var result = obj.GetHumanoidBodyPartActive(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetHumanoidBodyPartActive(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AvatarMask; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = (UnityEngine.AvatarMaskBodyPart)argHelper0.GetInt32(false); var Arg1 = argHelper1.GetBoolean(false); obj.SetHumanoidBodyPartActive(Arg0,Arg1); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_AddTransformPath(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AvatarMask; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Transform), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Transform>(false); obj.AddTransformPath(Arg0); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Transform), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Transform>(false); var Arg1 = argHelper1.GetBoolean(false); obj.AddTransformPath(Arg0,Arg1); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to AddTransformPath"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_RemoveTransformPath(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AvatarMask; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Transform), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Transform>(false); obj.RemoveTransformPath(Arg0); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Transform), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Transform>(false); var Arg1 = argHelper1.GetBoolean(false); obj.RemoveTransformPath(Arg0,Arg1); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to RemoveTransformPath"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetTransformPath(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AvatarMask; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); var result = obj.GetTransformPath(Arg0); Puerts.PuertsDLL.ReturnString(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetTransformPath(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AvatarMask; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetString(false); obj.SetTransformPath(Arg0,Arg1); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetTransformActive(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AvatarMask; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); var result = obj.GetTransformActive(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetTransformActive(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AvatarMask; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetBoolean(false); obj.SetTransformActive(Arg0,Arg1); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_transformCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AvatarMask; var result = obj.transformCount; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_transformCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AvatarMask; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.transformCount = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "GetHumanoidBodyPartActive", IsStatic = false}, M_GetHumanoidBodyPartActive }, { new Puerts.MethodKey {Name = "SetHumanoidBodyPartActive", IsStatic = false}, M_SetHumanoidBodyPartActive }, { new Puerts.MethodKey {Name = "AddTransformPath", IsStatic = false}, M_AddTransformPath }, { new Puerts.MethodKey {Name = "RemoveTransformPath", IsStatic = false}, M_RemoveTransformPath }, { new Puerts.MethodKey {Name = "GetTransformPath", IsStatic = false}, M_GetTransformPath }, { new Puerts.MethodKey {Name = "SetTransformPath", IsStatic = false}, M_SetTransformPath }, { new Puerts.MethodKey {Name = "GetTransformActive", IsStatic = false}, M_GetTransformActive }, { new Puerts.MethodKey {Name = "SetTransformActive", IsStatic = false}, M_SetTransformActive }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"transformCount", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_transformCount, Setter = S_transformCount} }, } }; } } } <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/ai/Task.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.ai { public abstract partial class Task : ai.FlowNode { public Task(ByteBuf _buf) : base(_buf) { IgnoreRestartSelf = _buf.ReadBool(); } public Task(int id, string node_name, System.Collections.Generic.List<ai.Decorator> decorators, System.Collections.Generic.List<ai.Service> services, bool ignore_restart_self ) : base(id,node_name,decorators,services) { this.IgnoreRestartSelf = ignore_restart_self; } public static Task DeserializeTask(ByteBuf _buf) { switch (_buf.ReadInt()) { case ai.UeWait.ID: return new ai.UeWait(_buf); case ai.UeWaitBlackboardTime.ID: return new ai.UeWaitBlackboardTime(_buf); case ai.MoveToTarget.ID: return new ai.MoveToTarget(_buf); case ai.ChooseSkill.ID: return new ai.ChooseSkill(_buf); case ai.MoveToRandomLocation.ID: return new ai.MoveToRandomLocation(_buf); case ai.MoveToLocation.ID: return new ai.MoveToLocation(_buf); case ai.DebugPrint.ID: return new ai.DebugPrint(_buf); default: throw new SerializationException(); } } public readonly bool IgnoreRestartSelf; public override void Resolve(Dictionary<string, object> _tables) { base.Resolve(_tables); OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); public override string ToString() { return "{ " + "Id:" + Id + "," + "NodeName:" + NodeName + "," + "Decorators:" + Bright.Common.StringUtil.CollectionToString(Decorators) + "," + "Services:" + Bright.Common.StringUtil.CollectionToString(Services) + "," + "IgnoreRestartSelf:" + IgnoreRestartSelf + "," + "}"; } } } <|start_filename|>Projects/java_json/src/gen/cfg/ai/KeyData.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.ai; import com.google.gson.JsonElement; import com.google.gson.JsonObject; public abstract class KeyData { public KeyData(JsonObject __json__) { } public KeyData() { } public static KeyData deserializeKeyData(JsonObject __json__) { switch (__json__.get("__type__").getAsString()) { case "FloatKeyData": return new cfg.ai.FloatKeyData(__json__); case "IntKeyData": return new cfg.ai.IntKeyData(__json__); case "StringKeyData": return new cfg.ai.StringKeyData(__json__); case "BlackboardKeyData": return new cfg.ai.BlackboardKeyData(__json__); default: throw new bright.serialization.SerializationException(); } } public abstract int getTypeId(); public void resolve(java.util.HashMap<String, Object> _tables) { } @Override public String toString() { return "{ " + "}"; } } <|start_filename|>ProtoProjects/go/gen/src/proto/test.TestProto1.go<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package proto import ( "bright/serialization" ) import "errors" type TestTestProto1 struct { X int32 Y string } const TypeId_TestTestProto1 = 23983 func (*TestTestProto1) GetTypeId() int32 { return 23983 } func (_v *TestTestProto1)Serialize(_buf *serialization.ByteBuf) { _buf.WriteInt(_v.X) _buf.WriteString(_v.Y) } func (_v *TestTestProto1)Deserialize(_buf *serialization.ByteBuf) (err error) { { if _v.X, err = _buf.ReadInt(); err != nil { err = errors.New("_v.X error"); return } } { if _v.Y, err = _buf.ReadString(); err != nil { err = errors.New("_v.Y error"); return } } return } <|start_filename|>Projects/java_json/src/gen/cfg/blueprint/Interface.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.blueprint; import com.google.gson.JsonElement; import com.google.gson.JsonObject; public final class Interface extends cfg.blueprint.Clazz { public Interface(JsonObject __json__) { super(__json__); } public Interface(String name, String desc, java.util.ArrayList<cfg.blueprint.Clazz> parents, java.util.ArrayList<cfg.blueprint.Method> methods ) { super(name, desc, parents, methods); } public static Interface deserializeInterface(JsonObject __json__) { return new Interface(__json__); } public static final int __ID__ = 2114170750; @Override public int getTypeId() { return __ID__; } @Override public void resolve(java.util.HashMap<String, Object> _tables) { super.resolve(_tables); } @Override public String toString() { return "{ " + "name:" + name + "," + "desc:" + desc + "," + "parents:" + parents + "," + "methods:" + methods + "," + "}"; } } <|start_filename|>Projects/GenerateDatas/convert_lua/error.TbErrorInfo/EXAMPLE_DLG_OK.lua<|end_filename|> return { code = "EXAMPLE_DLG_OK", desc = "例子:单按钮提示,用户自己提供回调", style = { _name = 'ErrorStyleDlgOk', btn_name = "联知道了", }, } <|start_filename|>Projects/DataTemplates/template_erlang2/test_tbtestindex.erl<|end_filename|> %% test.TbTestIndex -module(test_tbtestindex) -export([get/1,get_ids/0]) get(1) -> #{ id => 1, eles => array }. get(2) -> #{ id => 2, eles => array }. get(3) -> #{ id => 3, eles => array }. get(4) -> #{ id => 4, eles => array }. get_ids() -> [1,2,3,4]. <|start_filename|>DesignerConfigs/Datas/ai/blackboards/demo_parent.lua<|end_filename|> return { name = "demo_parent", desc ="demo parent", parent_name = "", keys = { {name="v1",desc="v1 haha", is_static=false, type="BOOL", type_class_name=""}, }, } <|start_filename|>Projects/Go_json/gen/src/cfg/test.ETestQuality.go<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg const ( TestETestQuality_A = 1 TestETestQuality_B = 2 TestETestQuality_C = 3 TestETestQuality_D = 4 ) <|start_filename|>Projects/Csharp_CustomTemplate_EncryptMemory/Gen/item/InteractionItem.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using System; using Newtonsoft.Json; using Scripts; namespace cfg.item { [Serializable] public partial class InteractionItem : AConfig { [JsonProperty("attack_num")] private int? _attack_num { get; set; } [JsonIgnore] public EncryptInt attack_num { get; private set; } = new(); public string holding_static_mesh { get; set; } public string holding_static_mesh_mat { get; set; } public override void EndInit() { attack_num = _attack_num; } public override string ToString() => JsonConvert.SerializeObject(this); } } <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/role/LevelExpAttr.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.role { public sealed partial class LevelExpAttr : Bright.Config.BeanBase { public LevelExpAttr(ByteBuf _buf) { Level = _buf.ReadInt(); NeedExp = _buf.ReadLong(); {int n = System.Math.Min(_buf.ReadSize(), _buf.Size);ClothesAttrs = new System.Collections.Generic.List<int>(n);for(var i = 0 ; i < n ; i++) { int _e; _e = _buf.ReadInt(); ClothesAttrs.Add(_e);}} } public LevelExpAttr(int level, long need_exp, System.Collections.Generic.List<int> clothes_attrs ) { this.Level = level; this.NeedExp = need_exp; this.ClothesAttrs = clothes_attrs; } public static LevelExpAttr DeserializeLevelExpAttr(ByteBuf _buf) { return new role.LevelExpAttr(_buf); } public readonly int Level; public readonly long NeedExp; public readonly System.Collections.Generic.List<int> ClothesAttrs; public const int ID = -1569837022; public override int GetTypeId() => ID; public void Resolve(Dictionary<string, object> _tables) { OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); public override string ToString() { return "{ " + "Level:" + Level + "," + "NeedExp:" + NeedExp + "," + "ClothesAttrs:" + Bright.Common.StringUtil.CollectionToString(ClothesAttrs) + "," + "}"; } } } <|start_filename|>Projects/Java_bin/src/main/java/Main.java<|end_filename|> import bright.serialization.ByteBuf; import java.io.IOException; import java.nio.file.Paths; public class Main { public static void main(String[] args) throws IOException { cfg.Tables tables = new cfg.Tables(Main::createByteBufFromFile); System.out.println("== load succ =="); } private static ByteBuf createByteBufFromFile(String file) throws java.io.IOException { return new ByteBuf(java.nio.file.Files.readAllBytes(Paths.get("../GenerateDatas/bin", file + ".bytes"))); } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_AudioHighPassFilter_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_AudioHighPassFilter_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.AudioHighPassFilter(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.AudioHighPassFilter), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_cutoffFrequency(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AudioHighPassFilter; var result = obj.cutoffFrequency; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_cutoffFrequency(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AudioHighPassFilter; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.cutoffFrequency = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_highpassResonanceQ(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AudioHighPassFilter; var result = obj.highpassResonanceQ; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_highpassResonanceQ(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AudioHighPassFilter; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.highpassResonanceQ = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"cutoffFrequency", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_cutoffFrequency, Setter = S_cutoffFrequency} }, {"highpassResonanceQ", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_highpassResonanceQ, Setter = S_highpassResonanceQ} }, } }; } } } <|start_filename|>Projects/DataTemplates/template_erlang2/test_tbsingleton.erl<|end_filename|> %% test.TbSingleton -module(test_tbsingleton) -export([get/1,get_ids/0]) get() -> #{ id => 5, name => aabbcc, date => bean }; get_ids() -> []. <|start_filename|>Projects/java_json/src/gen/cfg/ai/StringKeyData.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.ai; import com.google.gson.JsonElement; import com.google.gson.JsonObject; public final class StringKeyData extends cfg.ai.KeyData { public StringKeyData(JsonObject __json__) { super(__json__); value = __json__.get("value").getAsString(); } public StringKeyData(String value ) { super(); this.value = value; } public static StringKeyData deserializeStringKeyData(JsonObject __json__) { return new StringKeyData(__json__); } public final String value; public static final int __ID__ = -307888654; @Override public int getTypeId() { return __ID__; } @Override public void resolve(java.util.HashMap<String, Object> _tables) { super.resolve(_tables); } @Override public String toString() { return "{ " + "value:" + value + "," + "}"; } } <|start_filename|>Projects/Java_bin/src/main/gen/cfg/role/LevelExpAttr.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.role; import bright.serialization.*; public final class LevelExpAttr { public LevelExpAttr(ByteBuf _buf) { level = _buf.readInt(); needExp = _buf.readLong(); {int n = Math.min(_buf.readSize(), _buf.size());clothesAttrs = new java.util.ArrayList<Integer>(n);for(int i = 0 ; i < n ; i++) { Integer _e; _e = _buf.readInt(); clothesAttrs.add(_e);}} } public LevelExpAttr(int level, long need_exp, java.util.ArrayList<Integer> clothes_attrs ) { this.level = level; this.needExp = need_exp; this.clothesAttrs = clothes_attrs; } public final int level; public final long needExp; public final java.util.ArrayList<Integer> clothesAttrs; public void resolve(java.util.HashMap<String, Object> _tables) { } @Override public String toString() { return "{ " + "level:" + level + "," + "needExp:" + needExp + "," + "clothesAttrs:" + clothesAttrs + "," + "}"; } } <|start_filename|>Projects/Csharp_CustomTemplate_EncryptMemory/Gen/ai/UeWait.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using System; using Newtonsoft.Json; using Scripts; namespace cfg.ai { [Serializable] public partial class UeWait : AConfig { [JsonProperty("wait_time")] private float _wait_time { get; set; } [JsonIgnore] public EncryptFloat wait_time { get; private set; } = new(); [JsonProperty("random_deviation")] private float _random_deviation { get; set; } [JsonIgnore] public EncryptFloat random_deviation { get; private set; } = new(); public override void EndInit() { wait_time = _wait_time; random_deviation = _random_deviation; } public override string ToString() => JsonConvert.SerializeObject(this); } } <|start_filename|>Projects/GenerateDatas/convert_lua/test.TbDetectCsvEncoding/3.lua<|end_filename|> return { id = 3, name = "工枯加盟仍", } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_HashUtilities_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_HashUtilities_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.HashUtilities constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_AppendHash(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<UnityEngine.Hash128>(true); var Arg1 = argHelper1.Get<UnityEngine.Hash128>(true); UnityEngine.HashUtilities.AppendHash(ref Arg0,ref Arg1); argHelper0.SetByRefValue(Arg0); argHelper1.SetByRefValue(Arg1); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_QuantisedMatrixHash(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<UnityEngine.Matrix4x4>(true); var Arg1 = argHelper1.Get<UnityEngine.Hash128>(true); UnityEngine.HashUtilities.QuantisedMatrixHash(ref Arg0,ref Arg1); argHelper0.SetByRefValue(Arg0); argHelper1.SetByRefValue(Arg1); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_QuantisedVectorHash(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(true); var Arg1 = argHelper1.Get<UnityEngine.Hash128>(true); UnityEngine.HashUtilities.QuantisedVectorHash(ref Arg0,ref Arg1); argHelper0.SetByRefValue(Arg0); argHelper1.SetByRefValue(Arg1); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_ComputeHash128(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<byte[]>(false); var Arg1 = argHelper1.Get<UnityEngine.Hash128>(true); UnityEngine.HashUtilities.ComputeHash128(Arg0,ref Arg1); argHelper1.SetByRefValue(Arg1); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "AppendHash", IsStatic = true}, F_AppendHash }, { new Puerts.MethodKey {Name = "QuantisedMatrixHash", IsStatic = true}, F_QuantisedMatrixHash }, { new Puerts.MethodKey {Name = "QuantisedVectorHash", IsStatic = true}, F_QuantisedVectorHash }, { new Puerts.MethodKey {Name = "ComputeHash128", IsStatic = true}, F_ComputeHash128 }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { } }; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/System_Collections_Generic_List_1_System_Int32__Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class System_Collections_Generic_List_1_System_Int32__Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { if (paramLen == 0) { { var result = new System.Collections.Generic.List<int>(); return Puerts.Utils.GetObjectPtr((int)data, typeof(System.Collections.Generic.List<int>), result); } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var result = new System.Collections.Generic.List<int>(Arg0); return Puerts.Utils.GetObjectPtr((int)data, typeof(System.Collections.Generic.List<int>), result); } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.IEnumerable<int>), false, false)) { var Arg0 = argHelper0.Get<System.Collections.Generic.IEnumerable<int>>(false); var result = new System.Collections.Generic.List<int>(Arg0); return Puerts.Utils.GetObjectPtr((int)data, typeof(System.Collections.Generic.List<int>), result); } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to System.Collections.Generic.List<int> constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Add(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Collections.Generic.List<int>; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); obj.Add(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_AddRange(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Collections.Generic.List<int>; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.Collections.Generic.IEnumerable<int>>(false); obj.AddRange(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_AsReadOnly(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Collections.Generic.List<int>; { { var result = obj.AsReadOnly(); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_BinarySearch(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Collections.Generic.List<int>; if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.IComparer<int>), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.Get<System.Collections.Generic.IComparer<int>>(false); var result = obj.BinarySearch(Arg0,Arg1,Arg2,Arg3); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var result = obj.BinarySearch(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.IComparer<int>), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<System.Collections.Generic.IComparer<int>>(false); var result = obj.BinarySearch(Arg0,Arg1); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to BinarySearch"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Clear(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Collections.Generic.List<int>; { { obj.Clear(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Contains(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Collections.Generic.List<int>; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); var result = obj.Contains(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_CopyTo(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Collections.Generic.List<int>; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(int[]), false, false)) { var Arg0 = argHelper0.Get<int[]>(false); obj.CopyTo(Arg0); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(int[]), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<int[]>(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetInt32(false); obj.CopyTo(Arg0,Arg1,Arg2,Arg3); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(int[]), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<int[]>(false); var Arg1 = argHelper1.GetInt32(false); obj.CopyTo(Arg0,Arg1); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to CopyTo"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Exists(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Collections.Generic.List<int>; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.Predicate<int>>(false); var result = obj.Exists(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Find(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Collections.Generic.List<int>; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.Predicate<int>>(false); var result = obj.Find(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_FindAll(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Collections.Generic.List<int>; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.Predicate<int>>(false); var result = obj.FindAll(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_FindIndex(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Collections.Generic.List<int>; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject | Puerts.JsValueType.Function, typeof(System.Predicate<int>), false, false)) { var Arg0 = argHelper0.Get<System.Predicate<int>>(false); var result = obj.FindIndex(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject | Puerts.JsValueType.Function, typeof(System.Predicate<int>), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<System.Predicate<int>>(false); var result = obj.FindIndex(Arg0,Arg1); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject | Puerts.JsValueType.Function, typeof(System.Predicate<int>), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.Get<System.Predicate<int>>(false); var result = obj.FindIndex(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to FindIndex"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_FindLast(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Collections.Generic.List<int>; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.Predicate<int>>(false); var result = obj.FindLast(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_FindLastIndex(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Collections.Generic.List<int>; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject | Puerts.JsValueType.Function, typeof(System.Predicate<int>), false, false)) { var Arg0 = argHelper0.Get<System.Predicate<int>>(false); var result = obj.FindLastIndex(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject | Puerts.JsValueType.Function, typeof(System.Predicate<int>), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<System.Predicate<int>>(false); var result = obj.FindLastIndex(Arg0,Arg1); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject | Puerts.JsValueType.Function, typeof(System.Predicate<int>), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.Get<System.Predicate<int>>(false); var result = obj.FindLastIndex(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to FindLastIndex"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ForEach(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Collections.Generic.List<int>; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.Action<int>>(false); obj.ForEach(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetEnumerator(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Collections.Generic.List<int>; { { var result = obj.GetEnumerator(); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetRange(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Collections.Generic.List<int>; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var result = obj.GetRange(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_IndexOf(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Collections.Generic.List<int>; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var result = obj.IndexOf(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var result = obj.IndexOf(Arg0,Arg1); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var result = obj.IndexOf(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to IndexOf"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Insert(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Collections.Generic.List<int>; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); obj.Insert(Arg0,Arg1); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_InsertRange(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Collections.Generic.List<int>; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<System.Collections.Generic.IEnumerable<int>>(false); obj.InsertRange(Arg0,Arg1); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_LastIndexOf(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Collections.Generic.List<int>; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var result = obj.LastIndexOf(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var result = obj.LastIndexOf(Arg0,Arg1); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var result = obj.LastIndexOf(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to LastIndexOf"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Remove(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Collections.Generic.List<int>; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); var result = obj.Remove(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_RemoveAll(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Collections.Generic.List<int>; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.Predicate<int>>(false); var result = obj.RemoveAll(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_RemoveAt(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Collections.Generic.List<int>; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); obj.RemoveAt(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_RemoveRange(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Collections.Generic.List<int>; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); obj.RemoveRange(Arg0,Arg1); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Reverse(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Collections.Generic.List<int>; if (paramLen == 0) { { obj.Reverse(); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); obj.Reverse(Arg0,Arg1); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to Reverse"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Sort(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Collections.Generic.List<int>; if (paramLen == 0) { { obj.Sort(); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.IComparer<int>), false, false)) { var Arg0 = argHelper0.Get<System.Collections.Generic.IComparer<int>>(false); obj.Sort(Arg0); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject | Puerts.JsValueType.Function, typeof(System.Comparison<int>), false, false)) { var Arg0 = argHelper0.Get<System.Comparison<int>>(false); obj.Sort(Arg0); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.IComparer<int>), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.Get<System.Collections.Generic.IComparer<int>>(false); obj.Sort(Arg0,Arg1,Arg2); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to Sort"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ToArray(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Collections.Generic.List<int>; { { var result = obj.ToArray(); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_TrimExcess(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Collections.Generic.List<int>; { { obj.TrimExcess(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_TrueForAll(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Collections.Generic.List<int>; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.Predicate<int>>(false); var result = obj.TrueForAll(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_Capacity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Collections.Generic.List<int>; var result = obj.Capacity; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_Capacity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Collections.Generic.List<int>; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.Capacity = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_Count(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Collections.Generic.List<int>; var result = obj.Count; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void GetItem(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Collections.Generic.List<int>; var keyHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (keyHelper.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var key = keyHelper.GetInt32(false); var result = obj[key]; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void SetItem(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Collections.Generic.List<int>; var keyHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var valueHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (keyHelper.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var key = keyHelper.GetInt32(false); obj[key] = valueHelper.GetInt32(false); return; } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "Add", IsStatic = false}, M_Add }, { new Puerts.MethodKey {Name = "AddRange", IsStatic = false}, M_AddRange }, { new Puerts.MethodKey {Name = "AsReadOnly", IsStatic = false}, M_AsReadOnly }, { new Puerts.MethodKey {Name = "BinarySearch", IsStatic = false}, M_BinarySearch }, { new Puerts.MethodKey {Name = "Clear", IsStatic = false}, M_Clear }, { new Puerts.MethodKey {Name = "Contains", IsStatic = false}, M_Contains }, { new Puerts.MethodKey {Name = "CopyTo", IsStatic = false}, M_CopyTo }, { new Puerts.MethodKey {Name = "Exists", IsStatic = false}, M_Exists }, { new Puerts.MethodKey {Name = "Find", IsStatic = false}, M_Find }, { new Puerts.MethodKey {Name = "FindAll", IsStatic = false}, M_FindAll }, { new Puerts.MethodKey {Name = "FindIndex", IsStatic = false}, M_FindIndex }, { new Puerts.MethodKey {Name = "FindLast", IsStatic = false}, M_FindLast }, { new Puerts.MethodKey {Name = "FindLastIndex", IsStatic = false}, M_FindLastIndex }, { new Puerts.MethodKey {Name = "ForEach", IsStatic = false}, M_ForEach }, { new Puerts.MethodKey {Name = "GetEnumerator", IsStatic = false}, M_GetEnumerator }, { new Puerts.MethodKey {Name = "GetRange", IsStatic = false}, M_GetRange }, { new Puerts.MethodKey {Name = "IndexOf", IsStatic = false}, M_IndexOf }, { new Puerts.MethodKey {Name = "Insert", IsStatic = false}, M_Insert }, { new Puerts.MethodKey {Name = "InsertRange", IsStatic = false}, M_InsertRange }, { new Puerts.MethodKey {Name = "LastIndexOf", IsStatic = false}, M_LastIndexOf }, { new Puerts.MethodKey {Name = "Remove", IsStatic = false}, M_Remove }, { new Puerts.MethodKey {Name = "RemoveAll", IsStatic = false}, M_RemoveAll }, { new Puerts.MethodKey {Name = "RemoveAt", IsStatic = false}, M_RemoveAt }, { new Puerts.MethodKey {Name = "RemoveRange", IsStatic = false}, M_RemoveRange }, { new Puerts.MethodKey {Name = "Reverse", IsStatic = false}, M_Reverse }, { new Puerts.MethodKey {Name = "Sort", IsStatic = false}, M_Sort }, { new Puerts.MethodKey {Name = "ToArray", IsStatic = false}, M_ToArray }, { new Puerts.MethodKey {Name = "TrimExcess", IsStatic = false}, M_TrimExcess }, { new Puerts.MethodKey {Name = "TrueForAll", IsStatic = false}, M_TrueForAll }, { new Puerts.MethodKey {Name = "get_Item", IsStatic = false}, GetItem }, { new Puerts.MethodKey {Name = "set_Item", IsStatic = false}, SetItem}, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"Capacity", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_Capacity, Setter = S_Capacity} }, {"Count", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_Count, Setter = null} }, } }; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_RenderSettings_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_RenderSettings_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.RenderSettings constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_fog(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.RenderSettings.fog; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_fog(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.RenderSettings.fog = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_fogStartDistance(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.RenderSettings.fogStartDistance; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_fogStartDistance(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.RenderSettings.fogStartDistance = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_fogEndDistance(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.RenderSettings.fogEndDistance; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_fogEndDistance(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.RenderSettings.fogEndDistance = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_fogMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.RenderSettings.fogMode; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_fogMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.RenderSettings.fogMode = (UnityEngine.FogMode)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_fogColor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.RenderSettings.fogColor; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_fogColor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.RenderSettings.fogColor = argHelper.Get<UnityEngine.Color>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_fogDensity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.RenderSettings.fogDensity; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_fogDensity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.RenderSettings.fogDensity = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_ambientMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.RenderSettings.ambientMode; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_ambientMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.RenderSettings.ambientMode = (UnityEngine.Rendering.AmbientMode)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_ambientSkyColor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.RenderSettings.ambientSkyColor; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_ambientSkyColor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.RenderSettings.ambientSkyColor = argHelper.Get<UnityEngine.Color>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_ambientEquatorColor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.RenderSettings.ambientEquatorColor; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_ambientEquatorColor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.RenderSettings.ambientEquatorColor = argHelper.Get<UnityEngine.Color>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_ambientGroundColor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.RenderSettings.ambientGroundColor; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_ambientGroundColor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.RenderSettings.ambientGroundColor = argHelper.Get<UnityEngine.Color>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_ambientIntensity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.RenderSettings.ambientIntensity; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_ambientIntensity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.RenderSettings.ambientIntensity = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_ambientLight(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.RenderSettings.ambientLight; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_ambientLight(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.RenderSettings.ambientLight = argHelper.Get<UnityEngine.Color>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_subtractiveShadowColor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.RenderSettings.subtractiveShadowColor; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_subtractiveShadowColor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.RenderSettings.subtractiveShadowColor = argHelper.Get<UnityEngine.Color>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_skybox(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.RenderSettings.skybox; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_skybox(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.RenderSettings.skybox = argHelper.Get<UnityEngine.Material>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_sun(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.RenderSettings.sun; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_sun(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.RenderSettings.sun = argHelper.Get<UnityEngine.Light>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_ambientProbe(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.RenderSettings.ambientProbe; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_ambientProbe(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.RenderSettings.ambientProbe = argHelper.Get<UnityEngine.Rendering.SphericalHarmonicsL2>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_customReflection(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.RenderSettings.customReflection; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_customReflection(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.RenderSettings.customReflection = argHelper.Get<UnityEngine.Cubemap>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_reflectionIntensity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.RenderSettings.reflectionIntensity; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_reflectionIntensity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.RenderSettings.reflectionIntensity = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_reflectionBounces(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.RenderSettings.reflectionBounces; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_reflectionBounces(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.RenderSettings.reflectionBounces = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_defaultReflectionMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.RenderSettings.defaultReflectionMode; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_defaultReflectionMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.RenderSettings.defaultReflectionMode = (UnityEngine.Rendering.DefaultReflectionMode)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_defaultReflectionResolution(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.RenderSettings.defaultReflectionResolution; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_defaultReflectionResolution(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.RenderSettings.defaultReflectionResolution = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_haloStrength(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.RenderSettings.haloStrength; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_haloStrength(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.RenderSettings.haloStrength = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_flareStrength(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.RenderSettings.flareStrength; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_flareStrength(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.RenderSettings.flareStrength = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_flareFadeSpeed(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.RenderSettings.flareFadeSpeed; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_flareFadeSpeed(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.RenderSettings.flareFadeSpeed = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"fog", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_fog, Setter = S_fog} }, {"fogStartDistance", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_fogStartDistance, Setter = S_fogStartDistance} }, {"fogEndDistance", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_fogEndDistance, Setter = S_fogEndDistance} }, {"fogMode", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_fogMode, Setter = S_fogMode} }, {"fogColor", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_fogColor, Setter = S_fogColor} }, {"fogDensity", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_fogDensity, Setter = S_fogDensity} }, {"ambientMode", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_ambientMode, Setter = S_ambientMode} }, {"ambientSkyColor", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_ambientSkyColor, Setter = S_ambientSkyColor} }, {"ambientEquatorColor", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_ambientEquatorColor, Setter = S_ambientEquatorColor} }, {"ambientGroundColor", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_ambientGroundColor, Setter = S_ambientGroundColor} }, {"ambientIntensity", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_ambientIntensity, Setter = S_ambientIntensity} }, {"ambientLight", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_ambientLight, Setter = S_ambientLight} }, {"subtractiveShadowColor", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_subtractiveShadowColor, Setter = S_subtractiveShadowColor} }, {"skybox", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_skybox, Setter = S_skybox} }, {"sun", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_sun, Setter = S_sun} }, {"ambientProbe", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_ambientProbe, Setter = S_ambientProbe} }, {"customReflection", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_customReflection, Setter = S_customReflection} }, {"reflectionIntensity", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_reflectionIntensity, Setter = S_reflectionIntensity} }, {"reflectionBounces", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_reflectionBounces, Setter = S_reflectionBounces} }, {"defaultReflectionMode", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_defaultReflectionMode, Setter = S_defaultReflectionMode} }, {"defaultReflectionResolution", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_defaultReflectionResolution, Setter = S_defaultReflectionResolution} }, {"haloStrength", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_haloStrength, Setter = S_haloStrength} }, {"flareStrength", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_flareStrength, Setter = S_flareStrength} }, {"flareFadeSpeed", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_flareFadeSpeed, Setter = S_flareFadeSpeed} }, } }; } } } <|start_filename|>Projects/DataTemplates/template_lua2/test_tbtestexternaltype.lua<|end_filename|> -- test.TbTestExternalType return { [1] = { id=1, audio_type=1, color= { r=0.2, g=0.2, b=0.4, a=1, }, }, [2] = { id=2, audio_type=2, color= { r=0.2, g=0.2, b=0.4, a=0.8, }, }, } <|start_filename|>Projects/DataTemplates/template_erlang2/bonus_tbdrop.erl<|end_filename|> %% bonus.TbDrop -module(bonus_tbdrop) -export([get/1,get_ids/0]) get(1) -> #{ id => 1, desc => "奖励一个物品", client_show_items => array, bonus => bean }. get(2) -> #{ id => 2, desc => "随机掉落一个", client_show_items => array, bonus => bean }. get_ids() -> [1,2]. <|start_filename|>Projects/Csharp_CustomTemplate_EncryptMemory/Gen/ai/DistanceLessThan.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using System; using Newtonsoft.Json; using Scripts; namespace cfg.ai { [Serializable] public partial class DistanceLessThan : AConfig { public string actor1_key { get; set; } public string actor2_key { get; set; } [JsonProperty("distance")] private float _distance { get; set; } [JsonIgnore] public EncryptFloat distance { get; private set; } = new(); public bool reverse_result { get; set; } public override void EndInit() { distance = _distance; } public override string ToString() => JsonConvert.SerializeObject(this); } } <|start_filename|>Projects/Java_bin/src/main/gen/cfg/cost/CostCurrencies.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.cost; import bright.serialization.*; public final class CostCurrencies extends cfg.cost.Cost { public CostCurrencies(ByteBuf _buf) { super(_buf); {int n = Math.min(_buf.readSize(), _buf.size());currencies = new java.util.ArrayList<cfg.cost.CostCurrency>(n);for(int i = 0 ; i < n ; i++) { cfg.cost.CostCurrency _e; _e = new cfg.cost.CostCurrency(_buf); currencies.add(_e);}} } public CostCurrencies(java.util.ArrayList<cfg.cost.CostCurrency> currencies ) { super(); this.currencies = currencies; } public final java.util.ArrayList<cfg.cost.CostCurrency> currencies; public static final int __ID__ = 103084157; @Override public int getTypeId() { return __ID__; } @Override public void resolve(java.util.HashMap<String, Object> _tables) { super.resolve(_tables); for(cfg.cost.CostCurrency _e : currencies) { if (_e != null) _e.resolve(_tables); } } @Override public String toString() { return "{ " + "currencies:" + currencies + "," + "}"; } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_AnimationClip_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_AnimationClip_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.AnimationClip(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.AnimationClip), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SampleAnimation(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnimationClip; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<UnityEngine.GameObject>(false); var Arg1 = argHelper1.GetFloat(false); obj.SampleAnimation(Arg0,Arg1); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetCurve(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnimationClip; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<System.Type>(false); var Arg2 = argHelper2.GetString(false); var Arg3 = argHelper3.Get<UnityEngine.AnimationCurve>(false); obj.SetCurve(Arg0,Arg1,Arg2,Arg3); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_EnsureQuaternionContinuity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnimationClip; { { obj.EnsureQuaternionContinuity(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ClearCurves(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnimationClip; { { obj.ClearCurves(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_AddEvent(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnimationClip; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.AnimationEvent>(false); obj.AddEvent(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_length(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnimationClip; var result = obj.length; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_frameRate(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnimationClip; var result = obj.frameRate; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_frameRate(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnimationClip; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.frameRate = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_wrapMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnimationClip; var result = obj.wrapMode; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_wrapMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnimationClip; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.wrapMode = (UnityEngine.WrapMode)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_localBounds(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnimationClip; var result = obj.localBounds; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_localBounds(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnimationClip; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.localBounds = argHelper.Get<UnityEngine.Bounds>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_legacy(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnimationClip; var result = obj.legacy; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_legacy(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnimationClip; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.legacy = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_humanMotion(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnimationClip; var result = obj.humanMotion; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_empty(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnimationClip; var result = obj.empty; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_hasGenericRootTransform(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnimationClip; var result = obj.hasGenericRootTransform; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_hasMotionFloatCurves(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnimationClip; var result = obj.hasMotionFloatCurves; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_hasMotionCurves(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnimationClip; var result = obj.hasMotionCurves; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_hasRootCurves(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnimationClip; var result = obj.hasRootCurves; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_events(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnimationClip; var result = obj.events; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_events(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnimationClip; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.events = argHelper.Get<UnityEngine.AnimationEvent[]>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "SampleAnimation", IsStatic = false}, M_SampleAnimation }, { new Puerts.MethodKey {Name = "SetCurve", IsStatic = false}, M_SetCurve }, { new Puerts.MethodKey {Name = "EnsureQuaternionContinuity", IsStatic = false}, M_EnsureQuaternionContinuity }, { new Puerts.MethodKey {Name = "ClearCurves", IsStatic = false}, M_ClearCurves }, { new Puerts.MethodKey {Name = "AddEvent", IsStatic = false}, M_AddEvent }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"length", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_length, Setter = null} }, {"frameRate", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_frameRate, Setter = S_frameRate} }, {"wrapMode", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_wrapMode, Setter = S_wrapMode} }, {"localBounds", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_localBounds, Setter = S_localBounds} }, {"legacy", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_legacy, Setter = S_legacy} }, {"humanMotion", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_humanMotion, Setter = null} }, {"empty", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_empty, Setter = null} }, {"hasGenericRootTransform", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_hasGenericRootTransform, Setter = null} }, {"hasMotionFloatCurves", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_hasMotionFloatCurves, Setter = null} }, {"hasMotionCurves", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_hasMotionCurves, Setter = null} }, {"hasRootCurves", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_hasRootCurves, Setter = null} }, {"events", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_events, Setter = S_events} }, } }; } } } <|start_filename|>Projects/GenerateDatas/convert_lua/role.TbRoleLevelExpAttr/16.lua<|end_filename|> return { level = 16, need_exp = 4000, clothes_attrs = { 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, }, } <|start_filename|>Projects/DataTemplates/template_erlang2/l10n_tbl10ndemo.erl<|end_filename|> %% l10n.TbL10NDemo -module(l10n_tbl10ndemo) -export([get/1,get_ids/0]) get(11) -> #{ id => 11, text => 测试1 }. get(12) -> #{ id => 12, text => 测试2 }. get(13) -> #{ id => 13, text => 测试3 }. get(14) -> #{ id => 14, text => }. get(15) -> #{ id => 15, text => 测试5 }. get(16) -> #{ id => 16, text => 测试6 }. get(17) -> #{ id => 17, text => 测试7 }. get(18) -> #{ id => 18, text => 测试8 }. get_ids() -> [11,12,13,14,15,16,17,18]. <|start_filename|>Projects/GenerateDatas/convert_lua/role.TbRoleLevelExpAttr/5.lua<|end_filename|> return { level = 5, need_exp = 400, clothes_attrs = { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, }, } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_Collider2D_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_Collider2D_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.Collider2D(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.Collider2D), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_CreateMesh(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Collider2D; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.GetBoolean(false); var Arg1 = argHelper1.GetBoolean(false); var result = obj.CreateMesh(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetShapeHash(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Collider2D; { { var result = obj.GetShapeHash(); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_IsTouching(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Collider2D; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Collider2D), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Collider2D>(false); var result = obj.IsTouching(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.ContactFilter2D>(false); var result = obj.IsTouching(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Collider2D), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Collider2D>(false); var Arg1 = argHelper1.Get<UnityEngine.ContactFilter2D>(false); var result = obj.IsTouching(Arg0,Arg1); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to IsTouching"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_IsTouchingLayers(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Collider2D; if (paramLen == 0) { { var result = obj.IsTouchingLayers(); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var result = obj.IsTouchingLayers(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to IsTouchingLayers"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_OverlapPoint(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Collider2D; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var result = obj.OverlapPoint(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Distance(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Collider2D; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Collider2D>(false); var result = obj.Distance(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_OverlapCollider(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Collider2D; if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Collider2D[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.ContactFilter2D>(false); var Arg1 = argHelper1.Get<UnityEngine.Collider2D[]>(false); var result = obj.OverlapCollider(Arg0,Arg1); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Collider2D>), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.ContactFilter2D>(false); var Arg1 = argHelper1.Get<System.Collections.Generic.List<UnityEngine.Collider2D>>(false); var result = obj.OverlapCollider(Arg0,Arg1); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to OverlapCollider"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetContacts(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Collider2D; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactPoint2D[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.ContactPoint2D[]>(false); var result = obj.GetContacts(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.ContactPoint2D>), false, false)) { var Arg0 = argHelper0.Get<System.Collections.Generic.List<UnityEngine.ContactPoint2D>>(false); var result = obj.GetContacts(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Collider2D[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Collider2D[]>(false); var result = obj.GetContacts(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Collider2D>), false, false)) { var Arg0 = argHelper0.Get<System.Collections.Generic.List<UnityEngine.Collider2D>>(false); var result = obj.GetContacts(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactPoint2D[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.ContactFilter2D>(false); var Arg1 = argHelper1.Get<UnityEngine.ContactPoint2D[]>(false); var result = obj.GetContacts(Arg0,Arg1); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.ContactPoint2D>), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.ContactFilter2D>(false); var Arg1 = argHelper1.Get<System.Collections.Generic.List<UnityEngine.ContactPoint2D>>(false); var result = obj.GetContacts(Arg0,Arg1); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Collider2D[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.ContactFilter2D>(false); var Arg1 = argHelper1.Get<UnityEngine.Collider2D[]>(false); var result = obj.GetContacts(Arg0,Arg1); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Collider2D>), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.ContactFilter2D>(false); var Arg1 = argHelper1.Get<System.Collections.Generic.List<UnityEngine.Collider2D>>(false); var result = obj.GetContacts(Arg0,Arg1); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetContacts"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Cast(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Collider2D; if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit2D[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.RaycastHit2D[]>(false); var result = obj.Cast(Arg0,Arg1); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit2D[]), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.RaycastHit2D[]>(false); var Arg2 = argHelper2.GetFloat(false); var result = obj.Cast(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit2D[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.ContactFilter2D>(false); var Arg2 = argHelper2.Get<UnityEngine.RaycastHit2D[]>(false); var result = obj.Cast(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.RaycastHit2D>), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.ContactFilter2D>(false); var Arg2 = argHelper2.Get<System.Collections.Generic.List<UnityEngine.RaycastHit2D>>(false); var result = obj.Cast(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit2D[]), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.RaycastHit2D[]>(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.GetBoolean(false); var result = obj.Cast(Arg0,Arg1,Arg2,Arg3); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit2D[]), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.ContactFilter2D>(false); var Arg2 = argHelper2.Get<UnityEngine.RaycastHit2D[]>(false); var Arg3 = argHelper3.GetFloat(false); var result = obj.Cast(Arg0,Arg1,Arg2,Arg3); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.RaycastHit2D>), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.ContactFilter2D>(false); var Arg2 = argHelper2.Get<System.Collections.Generic.List<UnityEngine.RaycastHit2D>>(false); var Arg3 = argHelper3.GetFloat(false); var result = obj.Cast(Arg0,Arg1,Arg2,Arg3); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit2D[]), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.ContactFilter2D>(false); var Arg2 = argHelper2.Get<UnityEngine.RaycastHit2D[]>(false); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.GetBoolean(false); var result = obj.Cast(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.RaycastHit2D>), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.ContactFilter2D>(false); var Arg2 = argHelper2.Get<System.Collections.Generic.List<UnityEngine.RaycastHit2D>>(false); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.GetBoolean(false); var result = obj.Cast(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to Cast"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Raycast(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Collider2D; if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit2D[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.RaycastHit2D[]>(false); var result = obj.Raycast(Arg0,Arg1); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit2D[]), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.RaycastHit2D[]>(false); var Arg2 = argHelper2.GetFloat(false); var result = obj.Raycast(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit2D[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.ContactFilter2D>(false); var Arg2 = argHelper2.Get<UnityEngine.RaycastHit2D[]>(false); var result = obj.Raycast(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.RaycastHit2D>), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.ContactFilter2D>(false); var Arg2 = argHelper2.Get<System.Collections.Generic.List<UnityEngine.RaycastHit2D>>(false); var result = obj.Raycast(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit2D[]), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.RaycastHit2D[]>(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.GetInt32(false); var result = obj.Raycast(Arg0,Arg1,Arg2,Arg3); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit2D[]), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.ContactFilter2D>(false); var Arg2 = argHelper2.Get<UnityEngine.RaycastHit2D[]>(false); var Arg3 = argHelper3.GetFloat(false); var result = obj.Raycast(Arg0,Arg1,Arg2,Arg3); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ContactFilter2D), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.RaycastHit2D>), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.ContactFilter2D>(false); var Arg2 = argHelper2.Get<System.Collections.Generic.List<UnityEngine.RaycastHit2D>>(false); var Arg3 = argHelper3.GetFloat(false); var result = obj.Raycast(Arg0,Arg1,Arg2,Arg3); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit2D[]), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.RaycastHit2D[]>(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.GetInt32(false); var Arg4 = argHelper4.GetFloat(false); var result = obj.Raycast(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 6) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit2D[]), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.RaycastHit2D[]>(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.GetInt32(false); var Arg4 = argHelper4.GetFloat(false); var Arg5 = argHelper5.GetFloat(false); var result = obj.Raycast(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to Raycast"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ClosestPoint(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Collider2D; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var result = obj.ClosestPoint(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_density(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Collider2D; var result = obj.density; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_density(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Collider2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.density = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_isTrigger(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Collider2D; var result = obj.isTrigger; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_isTrigger(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Collider2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.isTrigger = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_usedByEffector(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Collider2D; var result = obj.usedByEffector; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_usedByEffector(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Collider2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.usedByEffector = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_usedByComposite(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Collider2D; var result = obj.usedByComposite; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_usedByComposite(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Collider2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.usedByComposite = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_composite(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Collider2D; var result = obj.composite; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_offset(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Collider2D; var result = obj.offset; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_offset(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Collider2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.offset = argHelper.Get<UnityEngine.Vector2>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_attachedRigidbody(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Collider2D; var result = obj.attachedRigidbody; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_shapeCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Collider2D; var result = obj.shapeCount; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_bounds(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Collider2D; var result = obj.bounds; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_sharedMaterial(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Collider2D; var result = obj.sharedMaterial; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_sharedMaterial(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Collider2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.sharedMaterial = argHelper.Get<UnityEngine.PhysicsMaterial2D>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_friction(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Collider2D; var result = obj.friction; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_bounciness(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Collider2D; var result = obj.bounciness; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "CreateMesh", IsStatic = false}, M_CreateMesh }, { new Puerts.MethodKey {Name = "GetShapeHash", IsStatic = false}, M_GetShapeHash }, { new Puerts.MethodKey {Name = "IsTouching", IsStatic = false}, M_IsTouching }, { new Puerts.MethodKey {Name = "IsTouchingLayers", IsStatic = false}, M_IsTouchingLayers }, { new Puerts.MethodKey {Name = "OverlapPoint", IsStatic = false}, M_OverlapPoint }, { new Puerts.MethodKey {Name = "Distance", IsStatic = false}, M_Distance }, { new Puerts.MethodKey {Name = "OverlapCollider", IsStatic = false}, M_OverlapCollider }, { new Puerts.MethodKey {Name = "GetContacts", IsStatic = false}, M_GetContacts }, { new Puerts.MethodKey {Name = "Cast", IsStatic = false}, M_Cast }, { new Puerts.MethodKey {Name = "Raycast", IsStatic = false}, M_Raycast }, { new Puerts.MethodKey {Name = "ClosestPoint", IsStatic = false}, M_ClosestPoint }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"density", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_density, Setter = S_density} }, {"isTrigger", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_isTrigger, Setter = S_isTrigger} }, {"usedByEffector", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_usedByEffector, Setter = S_usedByEffector} }, {"usedByComposite", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_usedByComposite, Setter = S_usedByComposite} }, {"composite", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_composite, Setter = null} }, {"offset", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_offset, Setter = S_offset} }, {"attachedRigidbody", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_attachedRigidbody, Setter = null} }, {"shapeCount", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_shapeCount, Setter = null} }, {"bounds", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_bounds, Setter = null} }, {"sharedMaterial", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_sharedMaterial, Setter = S_sharedMaterial} }, {"friction", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_friction, Setter = null} }, {"bounciness", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_bounciness, Setter = null} }, } }; } } } <|start_filename|>Projects/GenerateDatas/convert_lua/l10n.TbL10NDemo/17.lua<|end_filename|> return { id = 17, text = {key='/demo/7',text="测试7"}, } <|start_filename|>Projects/Cpp_bin/bright/serialization/ByteBuf.cpp<|end_filename|> #include "bright/serialization/ByteBuf.h" namespace bright { namespace serialization { const int ByteBuf::INIT_CAPACITY = 16; const byte ByteBuf::EMPTY_BYTES[1] = { '\0' }; } } <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/common/GlobalConfig.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.common { public sealed partial class GlobalConfig : Bright.Config.BeanBase { public GlobalConfig(ByteBuf _buf) { BagCapacity = _buf.ReadInt(); BagCapacitySpecial = _buf.ReadInt(); BagTempExpendableCapacity = _buf.ReadInt(); BagTempToolCapacity = _buf.ReadInt(); BagInitCapacity = _buf.ReadInt(); QuickBagCapacity = _buf.ReadInt(); ClothBagCapacity = _buf.ReadInt(); ClothBagInitCapacity = _buf.ReadInt(); ClothBagCapacitySpecial = _buf.ReadInt(); if(_buf.ReadBool()){ BagInitItemsDropId = _buf.ReadInt(); } else { BagInitItemsDropId = null; } MailBoxCapacity = _buf.ReadInt(); DamageParamC = _buf.ReadFloat(); DamageParamE = _buf.ReadFloat(); DamageParamF = _buf.ReadFloat(); DamageParamD = _buf.ReadFloat(); RoleSpeed = _buf.ReadFloat(); MonsterSpeed = _buf.ReadFloat(); InitEnergy = _buf.ReadInt(); InitViality = _buf.ReadInt(); MaxViality = _buf.ReadInt(); PerVialityRecoveryTime = _buf.ReadInt(); } public GlobalConfig(int bag_capacity, int bag_capacity_special, int bag_temp_expendable_capacity, int bag_temp_tool_capacity, int bag_init_capacity, int quick_bag_capacity, int cloth_bag_capacity, int cloth_bag_init_capacity, int cloth_bag_capacity_special, int? bag_init_items_drop_id, int mail_box_capacity, float damage_param_c, float damage_param_e, float damage_param_f, float damage_param_d, float role_speed, float monster_speed, int init_energy, int init_viality, int max_viality, int per_viality_recovery_time ) { this.BagCapacity = bag_capacity; this.BagCapacitySpecial = bag_capacity_special; this.BagTempExpendableCapacity = bag_temp_expendable_capacity; this.BagTempToolCapacity = bag_temp_tool_capacity; this.BagInitCapacity = bag_init_capacity; this.QuickBagCapacity = quick_bag_capacity; this.ClothBagCapacity = cloth_bag_capacity; this.ClothBagInitCapacity = cloth_bag_init_capacity; this.ClothBagCapacitySpecial = cloth_bag_capacity_special; this.BagInitItemsDropId = bag_init_items_drop_id; this.MailBoxCapacity = mail_box_capacity; this.DamageParamC = damage_param_c; this.DamageParamE = damage_param_e; this.DamageParamF = damage_param_f; this.DamageParamD = damage_param_d; this.RoleSpeed = role_speed; this.MonsterSpeed = monster_speed; this.InitEnergy = init_energy; this.InitViality = init_viality; this.MaxViality = max_viality; this.PerVialityRecoveryTime = per_viality_recovery_time; } public static GlobalConfig DeserializeGlobalConfig(ByteBuf _buf) { return new common.GlobalConfig(_buf); } /// <summary> /// 背包容量 /// </summary> public readonly int BagCapacity; public readonly int BagCapacitySpecial; public readonly int BagTempExpendableCapacity; public readonly int BagTempToolCapacity; public readonly int BagInitCapacity; public readonly int QuickBagCapacity; public readonly int ClothBagCapacity; public readonly int ClothBagInitCapacity; public readonly int ClothBagCapacitySpecial; public readonly int? BagInitItemsDropId; public bonus.DropInfo BagInitItemsDropId_Ref; public readonly int MailBoxCapacity; public readonly float DamageParamC; public readonly float DamageParamE; public readonly float DamageParamF; public readonly float DamageParamD; public readonly float RoleSpeed; public readonly float MonsterSpeed; public readonly int InitEnergy; public readonly int InitViality; public readonly int MaxViality; public readonly int PerVialityRecoveryTime; public const int ID = -848234488; public override int GetTypeId() => ID; public void Resolve(Dictionary<string, object> _tables) { this.BagInitItemsDropId_Ref = this.BagInitItemsDropId != null ? (_tables["bonus.TbDrop"] as bonus.TbDrop).GetOrDefault(BagInitItemsDropId.Value) : null; OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); public override string ToString() { return "{ " + "BagCapacity:" + BagCapacity + "," + "BagCapacitySpecial:" + BagCapacitySpecial + "," + "BagTempExpendableCapacity:" + BagTempExpendableCapacity + "," + "BagTempToolCapacity:" + BagTempToolCapacity + "," + "BagInitCapacity:" + BagInitCapacity + "," + "QuickBagCapacity:" + QuickBagCapacity + "," + "ClothBagCapacity:" + ClothBagCapacity + "," + "ClothBagInitCapacity:" + ClothBagInitCapacity + "," + "ClothBagCapacitySpecial:" + ClothBagCapacitySpecial + "," + "BagInitItemsDropId:" + BagInitItemsDropId + "," + "MailBoxCapacity:" + MailBoxCapacity + "," + "DamageParamC:" + DamageParamC + "," + "DamageParamE:" + DamageParamE + "," + "DamageParamF:" + DamageParamF + "," + "DamageParamD:" + DamageParamD + "," + "RoleSpeed:" + RoleSpeed + "," + "MonsterSpeed:" + MonsterSpeed + "," + "InitEnergy:" + InitEnergy + "," + "InitViality:" + InitViality + "," + "MaxViality:" + MaxViality + "," + "PerVialityRecoveryTime:" + PerVialityRecoveryTime + "," + "}"; } } } <|start_filename|>Projects/Go_json/gen/src/cfg/test.NotIndexList.go<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg import "errors" type TestNotIndexList struct { X int32 Y int32 } const TypeId_TestNotIndexList = -50446599 func (*TestNotIndexList) GetTypeId() int32 { return -50446599 } func (_v *TestNotIndexList)Deserialize(_buf map[string]interface{}) (err error) { { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["x"].(float64); !_ok_ { err = errors.New("x error"); return }; _v.X = int32(_tempNum_) } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["y"].(float64); !_ok_ { err = errors.New("y error"); return }; _v.Y = int32(_tempNum_) } return } func DeserializeTestNotIndexList(_buf map[string]interface{}) (*TestNotIndexList, error) { v := &TestNotIndexList{} if err := v.Deserialize(_buf); err == nil { return v, nil } else { return nil, err } } <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/ai/ChooseTarget.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.ai { public sealed partial class ChooseTarget : ai.Service { public ChooseTarget(ByteBuf _buf) : base(_buf) { ResultTargetKey = _buf.ReadString(); } public ChooseTarget(int id, string node_name, string result_target_key ) : base(id,node_name) { this.ResultTargetKey = result_target_key; } public static ChooseTarget DeserializeChooseTarget(ByteBuf _buf) { return new ai.ChooseTarget(_buf); } public readonly string ResultTargetKey; public const int ID = 1601247918; public override int GetTypeId() => ID; public override void Resolve(Dictionary<string, object> _tables) { base.Resolve(_tables); OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); public override string ToString() { return "{ " + "Id:" + Id + "," + "NodeName:" + NodeName + "," + "ResultTargetKey:" + ResultTargetKey + "," + "}"; } } } <|start_filename|>Projects/Csharp_Unity_bin_ExternalTypes/Assets/ExternalTypeUtil.cs<|end_filename|> using System.Collections; using System.Collections.Generic; using UnityEngine; public class ExternalTypeUtil { public static UnityEngine.Color NewFromCfgColor(cfg.test.Color color) { return new Color(color.R, color.G, color.B, color.A); } } <|start_filename|>Projects/GenerateDatas/convert_lua/item.TbItemExtra/1110020009.lua<|end_filename|> return { _name = 'DesignDrawing', id = 1110020009, learn_component_id = { 1020409024, }, } <|start_filename|>Projects/TypeScript_Unity_Puerts_Bin/Assets/Gen/UnityEngine_MaterialPropertyBlock_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_MaterialPropertyBlock_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.MaterialPropertyBlock(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.MaterialPropertyBlock), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Clear(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.MaterialPropertyBlock; { { obj.Clear(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetInt(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.MaterialPropertyBlock; if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.GetInt32(false); obj.SetInt(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); obj.SetInt(Arg0,Arg1); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SetInt"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetFloat(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.MaterialPropertyBlock; if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.GetFloat(false); obj.SetFloat(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetFloat(false); obj.SetFloat(Arg0,Arg1); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SetFloat"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetInteger(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.MaterialPropertyBlock; if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.GetInt32(false); obj.SetInteger(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); obj.SetInteger(Arg0,Arg1); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SetInteger"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetVector(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.MaterialPropertyBlock; if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector4), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<UnityEngine.Vector4>(false); obj.SetVector(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector4), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.Vector4>(false); obj.SetVector(Arg0,Arg1); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SetVector"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetColor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.MaterialPropertyBlock; if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Color), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<UnityEngine.Color>(false); obj.SetColor(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Color), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.Color>(false); obj.SetColor(Arg0,Arg1); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SetColor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetMatrix(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.MaterialPropertyBlock; if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Matrix4x4), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<UnityEngine.Matrix4x4>(false); obj.SetMatrix(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Matrix4x4), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.Matrix4x4>(false); obj.SetMatrix(Arg0,Arg1); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SetMatrix"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetBuffer(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.MaterialPropertyBlock; if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.ComputeBuffer), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<UnityEngine.ComputeBuffer>(false); obj.SetBuffer(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.ComputeBuffer), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.ComputeBuffer>(false); obj.SetBuffer(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GraphicsBuffer), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<UnityEngine.GraphicsBuffer>(false); obj.SetBuffer(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GraphicsBuffer), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.GraphicsBuffer>(false); obj.SetBuffer(Arg0,Arg1); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SetBuffer"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetTexture(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.MaterialPropertyBlock; if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<UnityEngine.Texture>(false); obj.SetTexture(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.Texture>(false); obj.SetTexture(Arg0,Arg1); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RenderTexture), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<UnityEngine.RenderTexture>(false); var Arg2 = (UnityEngine.Rendering.RenderTextureSubElement)argHelper2.GetInt32(false); obj.SetTexture(Arg0,Arg1,Arg2); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RenderTexture), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.RenderTexture>(false); var Arg2 = (UnityEngine.Rendering.RenderTextureSubElement)argHelper2.GetInt32(false); obj.SetTexture(Arg0,Arg1,Arg2); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SetTexture"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetConstantBuffer(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.MaterialPropertyBlock; if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.ComputeBuffer), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<UnityEngine.ComputeBuffer>(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetInt32(false); obj.SetConstantBuffer(Arg0,Arg1,Arg2,Arg3); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.ComputeBuffer), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.ComputeBuffer>(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetInt32(false); obj.SetConstantBuffer(Arg0,Arg1,Arg2,Arg3); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GraphicsBuffer), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<UnityEngine.GraphicsBuffer>(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetInt32(false); obj.SetConstantBuffer(Arg0,Arg1,Arg2,Arg3); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GraphicsBuffer), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.GraphicsBuffer>(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetInt32(false); obj.SetConstantBuffer(Arg0,Arg1,Arg2,Arg3); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SetConstantBuffer"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetFloatArray(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.MaterialPropertyBlock; if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<float>), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<System.Collections.Generic.List<float>>(false); obj.SetFloatArray(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<float>), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<System.Collections.Generic.List<float>>(false); obj.SetFloatArray(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(float[]), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<float[]>(false); obj.SetFloatArray(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(float[]), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<float[]>(false); obj.SetFloatArray(Arg0,Arg1); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SetFloatArray"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetVectorArray(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.MaterialPropertyBlock; if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Vector4>), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<System.Collections.Generic.List<UnityEngine.Vector4>>(false); obj.SetVectorArray(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Vector4>), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<System.Collections.Generic.List<UnityEngine.Vector4>>(false); obj.SetVectorArray(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector4[]), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<UnityEngine.Vector4[]>(false); obj.SetVectorArray(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector4[]), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.Vector4[]>(false); obj.SetVectorArray(Arg0,Arg1); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SetVectorArray"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetMatrixArray(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.MaterialPropertyBlock; if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Matrix4x4>), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<System.Collections.Generic.List<UnityEngine.Matrix4x4>>(false); obj.SetMatrixArray(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Matrix4x4>), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<System.Collections.Generic.List<UnityEngine.Matrix4x4>>(false); obj.SetMatrixArray(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Matrix4x4[]), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<UnityEngine.Matrix4x4[]>(false); obj.SetMatrixArray(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Matrix4x4[]), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.Matrix4x4[]>(false); obj.SetMatrixArray(Arg0,Arg1); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SetMatrixArray"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_HasProperty(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.MaterialPropertyBlock; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var result = obj.HasProperty(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var result = obj.HasProperty(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to HasProperty"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_HasInt(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.MaterialPropertyBlock; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var result = obj.HasInt(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var result = obj.HasInt(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to HasInt"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_HasFloat(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.MaterialPropertyBlock; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var result = obj.HasFloat(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var result = obj.HasFloat(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to HasFloat"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_HasInteger(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.MaterialPropertyBlock; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var result = obj.HasInteger(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var result = obj.HasInteger(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to HasInteger"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_HasTexture(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.MaterialPropertyBlock; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var result = obj.HasTexture(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var result = obj.HasTexture(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to HasTexture"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_HasMatrix(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.MaterialPropertyBlock; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var result = obj.HasMatrix(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var result = obj.HasMatrix(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to HasMatrix"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_HasVector(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.MaterialPropertyBlock; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var result = obj.HasVector(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var result = obj.HasVector(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to HasVector"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_HasColor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.MaterialPropertyBlock; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var result = obj.HasColor(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var result = obj.HasColor(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to HasColor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_HasBuffer(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.MaterialPropertyBlock; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var result = obj.HasBuffer(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var result = obj.HasBuffer(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to HasBuffer"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_HasConstantBuffer(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.MaterialPropertyBlock; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var result = obj.HasConstantBuffer(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var result = obj.HasConstantBuffer(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to HasConstantBuffer"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetFloat(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.MaterialPropertyBlock; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var result = obj.GetFloat(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var result = obj.GetFloat(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetFloat"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetInt(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.MaterialPropertyBlock; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var result = obj.GetInt(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var result = obj.GetInt(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetInt"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetInteger(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.MaterialPropertyBlock; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var result = obj.GetInteger(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var result = obj.GetInteger(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetInteger"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetVector(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.MaterialPropertyBlock; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var result = obj.GetVector(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var result = obj.GetVector(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetVector"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetColor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.MaterialPropertyBlock; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var result = obj.GetColor(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var result = obj.GetColor(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetColor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetMatrix(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.MaterialPropertyBlock; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var result = obj.GetMatrix(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var result = obj.GetMatrix(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetMatrix"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetTexture(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.MaterialPropertyBlock; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var result = obj.GetTexture(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var result = obj.GetTexture(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetTexture"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetFloatArray(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.MaterialPropertyBlock; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var result = obj.GetFloatArray(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var result = obj.GetFloatArray(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<float>), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<System.Collections.Generic.List<float>>(false); obj.GetFloatArray(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<float>), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<System.Collections.Generic.List<float>>(false); obj.GetFloatArray(Arg0,Arg1); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetFloatArray"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetVectorArray(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.MaterialPropertyBlock; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var result = obj.GetVectorArray(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var result = obj.GetVectorArray(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Vector4>), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<System.Collections.Generic.List<UnityEngine.Vector4>>(false); obj.GetVectorArray(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Vector4>), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<System.Collections.Generic.List<UnityEngine.Vector4>>(false); obj.GetVectorArray(Arg0,Arg1); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetVectorArray"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetMatrixArray(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.MaterialPropertyBlock; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var result = obj.GetMatrixArray(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var result = obj.GetMatrixArray(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Matrix4x4>), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<System.Collections.Generic.List<UnityEngine.Matrix4x4>>(false); obj.GetMatrixArray(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Matrix4x4>), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<System.Collections.Generic.List<UnityEngine.Matrix4x4>>(false); obj.GetMatrixArray(Arg0,Arg1); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetMatrixArray"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_CopySHCoefficientArraysFrom(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.MaterialPropertyBlock; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Rendering.SphericalHarmonicsL2>), false, false)) { var Arg0 = argHelper0.Get<System.Collections.Generic.List<UnityEngine.Rendering.SphericalHarmonicsL2>>(false); obj.CopySHCoefficientArraysFrom(Arg0); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rendering.SphericalHarmonicsL2[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rendering.SphericalHarmonicsL2[]>(false); obj.CopySHCoefficientArraysFrom(Arg0); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Rendering.SphericalHarmonicsL2>), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<System.Collections.Generic.List<UnityEngine.Rendering.SphericalHarmonicsL2>>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetInt32(false); obj.CopySHCoefficientArraysFrom(Arg0,Arg1,Arg2,Arg3); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rendering.SphericalHarmonicsL2[]), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rendering.SphericalHarmonicsL2[]>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetInt32(false); obj.CopySHCoefficientArraysFrom(Arg0,Arg1,Arg2,Arg3); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to CopySHCoefficientArraysFrom"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_CopyProbeOcclusionArrayFrom(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.MaterialPropertyBlock; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Vector4>), false, false)) { var Arg0 = argHelper0.Get<System.Collections.Generic.List<UnityEngine.Vector4>>(false); obj.CopyProbeOcclusionArrayFrom(Arg0); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector4[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector4[]>(false); obj.CopyProbeOcclusionArrayFrom(Arg0); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Vector4>), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<System.Collections.Generic.List<UnityEngine.Vector4>>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetInt32(false); obj.CopyProbeOcclusionArrayFrom(Arg0,Arg1,Arg2,Arg3); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector4[]), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector4[]>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetInt32(false); obj.CopyProbeOcclusionArrayFrom(Arg0,Arg1,Arg2,Arg3); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to CopyProbeOcclusionArrayFrom"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_isEmpty(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.MaterialPropertyBlock; var result = obj.isEmpty; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "Clear", IsStatic = false}, M_Clear }, { new Puerts.MethodKey {Name = "SetInt", IsStatic = false}, M_SetInt }, { new Puerts.MethodKey {Name = "SetFloat", IsStatic = false}, M_SetFloat }, { new Puerts.MethodKey {Name = "SetInteger", IsStatic = false}, M_SetInteger }, { new Puerts.MethodKey {Name = "SetVector", IsStatic = false}, M_SetVector }, { new Puerts.MethodKey {Name = "SetColor", IsStatic = false}, M_SetColor }, { new Puerts.MethodKey {Name = "SetMatrix", IsStatic = false}, M_SetMatrix }, { new Puerts.MethodKey {Name = "SetBuffer", IsStatic = false}, M_SetBuffer }, { new Puerts.MethodKey {Name = "SetTexture", IsStatic = false}, M_SetTexture }, { new Puerts.MethodKey {Name = "SetConstantBuffer", IsStatic = false}, M_SetConstantBuffer }, { new Puerts.MethodKey {Name = "SetFloatArray", IsStatic = false}, M_SetFloatArray }, { new Puerts.MethodKey {Name = "SetVectorArray", IsStatic = false}, M_SetVectorArray }, { new Puerts.MethodKey {Name = "SetMatrixArray", IsStatic = false}, M_SetMatrixArray }, { new Puerts.MethodKey {Name = "HasProperty", IsStatic = false}, M_HasProperty }, { new Puerts.MethodKey {Name = "HasInt", IsStatic = false}, M_HasInt }, { new Puerts.MethodKey {Name = "HasFloat", IsStatic = false}, M_HasFloat }, { new Puerts.MethodKey {Name = "HasInteger", IsStatic = false}, M_HasInteger }, { new Puerts.MethodKey {Name = "HasTexture", IsStatic = false}, M_HasTexture }, { new Puerts.MethodKey {Name = "HasMatrix", IsStatic = false}, M_HasMatrix }, { new Puerts.MethodKey {Name = "HasVector", IsStatic = false}, M_HasVector }, { new Puerts.MethodKey {Name = "HasColor", IsStatic = false}, M_HasColor }, { new Puerts.MethodKey {Name = "HasBuffer", IsStatic = false}, M_HasBuffer }, { new Puerts.MethodKey {Name = "HasConstantBuffer", IsStatic = false}, M_HasConstantBuffer }, { new Puerts.MethodKey {Name = "GetFloat", IsStatic = false}, M_GetFloat }, { new Puerts.MethodKey {Name = "GetInt", IsStatic = false}, M_GetInt }, { new Puerts.MethodKey {Name = "GetInteger", IsStatic = false}, M_GetInteger }, { new Puerts.MethodKey {Name = "GetVector", IsStatic = false}, M_GetVector }, { new Puerts.MethodKey {Name = "GetColor", IsStatic = false}, M_GetColor }, { new Puerts.MethodKey {Name = "GetMatrix", IsStatic = false}, M_GetMatrix }, { new Puerts.MethodKey {Name = "GetTexture", IsStatic = false}, M_GetTexture }, { new Puerts.MethodKey {Name = "GetFloatArray", IsStatic = false}, M_GetFloatArray }, { new Puerts.MethodKey {Name = "GetVectorArray", IsStatic = false}, M_GetVectorArray }, { new Puerts.MethodKey {Name = "GetMatrixArray", IsStatic = false}, M_GetMatrixArray }, { new Puerts.MethodKey {Name = "CopySHCoefficientArraysFrom", IsStatic = false}, M_CopySHCoefficientArraysFrom }, { new Puerts.MethodKey {Name = "CopyProbeOcclusionArrayFrom", IsStatic = false}, M_CopyProbeOcclusionArrayFrom }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"isEmpty", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_isEmpty, Setter = null} }, } }; } } } <|start_filename|>Projects/Java_bin/src/main/gen/cfg/test/DemoPrimitiveTypesTable.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.test; import bright.serialization.*; public final class DemoPrimitiveTypesTable { public DemoPrimitiveTypesTable(ByteBuf _buf) { x1 = _buf.readBool(); x2 = _buf.readByte(); x3 = _buf.readShort(); x4 = _buf.readInt(); x5 = _buf.readLong(); x6 = _buf.readFloat(); x7 = _buf.readDouble(); s1 = _buf.readString(); _buf.readString(); s2 = _buf.readString(); v2 = _buf.readVector2(); v3 = _buf.readVector3(); v4 = _buf.readVector4(); t1 = _buf.readInt(); } public DemoPrimitiveTypesTable(boolean x1, byte x2, short x3, int x4, long x5, float x6, double x7, String s1, String s2, bright.math.Vector2 v2, bright.math.Vector3 v3, bright.math.Vector4 v4, int t1 ) { this.x1 = x1; this.x2 = x2; this.x3 = x3; this.x4 = x4; this.x5 = x5; this.x6 = x6; this.x7 = x7; this.s1 = s1; this.s2 = s2; this.v2 = v2; this.v3 = v3; this.v4 = v4; this.t1 = t1; } public final boolean x1; public final byte x2; public final short x3; public final int x4; public final long x5; public final float x6; public final double x7; public final String s1; public final String s2; public final bright.math.Vector2 v2; public final bright.math.Vector3 v3; public final bright.math.Vector4 v4; public final int t1; public void resolve(java.util.HashMap<String, Object> _tables) { } @Override public String toString() { return "{ " + "x1:" + x1 + "," + "x2:" + x2 + "," + "x3:" + x3 + "," + "x4:" + x4 + "," + "x5:" + x5 + "," + "x6:" + x6 + "," + "x7:" + x7 + "," + "s1:" + s1 + "," + "s2:" + s2 + "," + "v2:" + v2 + "," + "v3:" + v3 + "," + "v4:" + v4 + "," + "t1:" + t1 + "," + "}"; } } <|start_filename|>Projects/GenerateDatas/convert_lua/test.TbTestNull/20.lua<|end_filename|> return { id = 20, } <|start_filename|>Projects/GenerateDatas/convert_lua/role.TbRoleLevelExpAttr/91.lua<|end_filename|> return { level = 91, need_exp = 280000, clothes_attrs = { 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, }, } <|start_filename|>Projects/GenerateDatas/convert_lua/role.TbRoleLevelExpAttr/22.lua<|end_filename|> return { level = 22, need_exp = 7000, clothes_attrs = { 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, }, } <|start_filename|>Projects/Lua_Unity_tolua_lua/Assets/Source/Generate/UnityEngine_TimeWrap.cs<|end_filename|> //this source code was auto-generated by tolua#, do not modify it using System; using LuaInterface; public class UnityEngine_TimeWrap { public static void Register(LuaState L) { L.BeginStaticLibs("Time"); L.RegVar("time", get_time, null); L.RegVar("timeSinceLevelLoad", get_timeSinceLevelLoad, null); L.RegVar("deltaTime", get_deltaTime, null); L.RegVar("fixedTime", get_fixedTime, null); L.RegVar("unscaledTime", get_unscaledTime, null); L.RegVar("fixedUnscaledTime", get_fixedUnscaledTime, null); L.RegVar("unscaledDeltaTime", get_unscaledDeltaTime, null); L.RegVar("fixedUnscaledDeltaTime", get_fixedUnscaledDeltaTime, null); L.RegVar("fixedDeltaTime", get_fixedDeltaTime, set_fixedDeltaTime); L.RegVar("maximumDeltaTime", get_maximumDeltaTime, set_maximumDeltaTime); L.RegVar("smoothDeltaTime", get_smoothDeltaTime, null); L.RegVar("maximumParticleDeltaTime", get_maximumParticleDeltaTime, set_maximumParticleDeltaTime); L.RegVar("timeScale", get_timeScale, set_timeScale); L.RegVar("frameCount", get_frameCount, null); L.RegVar("renderedFrameCount", get_renderedFrameCount, null); L.RegVar("realtimeSinceStartup", get_realtimeSinceStartup, null); L.RegVar("captureDeltaTime", get_captureDeltaTime, set_captureDeltaTime); L.RegVar("captureFramerate", get_captureFramerate, set_captureFramerate); L.RegVar("inFixedTimeStep", get_inFixedTimeStep, null); L.EndStaticLibs(); } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int get_time(IntPtr L) { try { LuaDLL.lua_pushnumber(L, UnityEngine.Time.time); return 1; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int get_timeSinceLevelLoad(IntPtr L) { try { LuaDLL.lua_pushnumber(L, UnityEngine.Time.timeSinceLevelLoad); return 1; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int get_deltaTime(IntPtr L) { try { LuaDLL.lua_pushnumber(L, UnityEngine.Time.deltaTime); return 1; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int get_fixedTime(IntPtr L) { try { LuaDLL.lua_pushnumber(L, UnityEngine.Time.fixedTime); return 1; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int get_unscaledTime(IntPtr L) { try { LuaDLL.lua_pushnumber(L, UnityEngine.Time.unscaledTime); return 1; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int get_fixedUnscaledTime(IntPtr L) { try { LuaDLL.lua_pushnumber(L, UnityEngine.Time.fixedUnscaledTime); return 1; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int get_unscaledDeltaTime(IntPtr L) { try { LuaDLL.lua_pushnumber(L, UnityEngine.Time.unscaledDeltaTime); return 1; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int get_fixedUnscaledDeltaTime(IntPtr L) { try { LuaDLL.lua_pushnumber(L, UnityEngine.Time.fixedUnscaledDeltaTime); return 1; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int get_fixedDeltaTime(IntPtr L) { try { LuaDLL.lua_pushnumber(L, UnityEngine.Time.fixedDeltaTime); return 1; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int get_maximumDeltaTime(IntPtr L) { try { LuaDLL.lua_pushnumber(L, UnityEngine.Time.maximumDeltaTime); return 1; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int get_smoothDeltaTime(IntPtr L) { try { LuaDLL.lua_pushnumber(L, UnityEngine.Time.smoothDeltaTime); return 1; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int get_maximumParticleDeltaTime(IntPtr L) { try { LuaDLL.lua_pushnumber(L, UnityEngine.Time.maximumParticleDeltaTime); return 1; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int get_timeScale(IntPtr L) { try { LuaDLL.lua_pushnumber(L, UnityEngine.Time.timeScale); return 1; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int get_frameCount(IntPtr L) { try { LuaDLL.lua_pushinteger(L, UnityEngine.Time.frameCount); return 1; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int get_renderedFrameCount(IntPtr L) { try { LuaDLL.lua_pushinteger(L, UnityEngine.Time.renderedFrameCount); return 1; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int get_realtimeSinceStartup(IntPtr L) { try { LuaDLL.lua_pushnumber(L, UnityEngine.Time.realtimeSinceStartup); return 1; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int get_captureDeltaTime(IntPtr L) { try { LuaDLL.lua_pushnumber(L, UnityEngine.Time.captureDeltaTime); return 1; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int get_captureFramerate(IntPtr L) { try { LuaDLL.lua_pushinteger(L, UnityEngine.Time.captureFramerate); return 1; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int get_inFixedTimeStep(IntPtr L) { try { LuaDLL.lua_pushboolean(L, UnityEngine.Time.inFixedTimeStep); return 1; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int set_fixedDeltaTime(IntPtr L) { try { float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); UnityEngine.Time.fixedDeltaTime = arg0; return 0; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int set_maximumDeltaTime(IntPtr L) { try { float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); UnityEngine.Time.maximumDeltaTime = arg0; return 0; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int set_maximumParticleDeltaTime(IntPtr L) { try { float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); UnityEngine.Time.maximumParticleDeltaTime = arg0; return 0; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int set_timeScale(IntPtr L) { try { float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); UnityEngine.Time.timeScale = arg0; return 0; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int set_captureDeltaTime(IntPtr L) { try { float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); UnityEngine.Time.captureDeltaTime = arg0; return 0; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int set_captureFramerate(IntPtr L) { try { int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); UnityEngine.Time.captureFramerate = arg0; return 0; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } } <|start_filename|>Projects/Csharp_CustomTemplate_EncryptMemory/Gen/test/TestRow.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using System; using Newtonsoft.Json; using Scripts; namespace cfg.test { [Serializable] public partial class TestRow : AConfig { [JsonProperty("x")] private int _x { get; set; } [JsonIgnore] public EncryptInt x { get; private set; } = new(); public bool y { get; set; } public string z { get; set; } [JsonProperty] public test.Test3 a { get; set; } public System.Collections.Generic.List<int> b { get; set; } public override void EndInit() { x = _x; a.EndInit(); } public override string ToString() => JsonConvert.SerializeObject(this); } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_UI_CanvasUpdateRegistry_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_UI_CanvasUpdateRegistry_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.UI.CanvasUpdateRegistry constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_RegisterCanvasElementForLayoutRebuild(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.UI.ICanvasElement>(false); UnityEngine.UI.CanvasUpdateRegistry.RegisterCanvasElementForLayoutRebuild(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_TryRegisterCanvasElementForLayoutRebuild(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.UI.ICanvasElement>(false); var result = UnityEngine.UI.CanvasUpdateRegistry.TryRegisterCanvasElementForLayoutRebuild(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_RegisterCanvasElementForGraphicRebuild(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.UI.ICanvasElement>(false); UnityEngine.UI.CanvasUpdateRegistry.RegisterCanvasElementForGraphicRebuild(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_TryRegisterCanvasElementForGraphicRebuild(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.UI.ICanvasElement>(false); var result = UnityEngine.UI.CanvasUpdateRegistry.TryRegisterCanvasElementForGraphicRebuild(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_UnRegisterCanvasElementForRebuild(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.UI.ICanvasElement>(false); UnityEngine.UI.CanvasUpdateRegistry.UnRegisterCanvasElementForRebuild(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_IsRebuildingLayout(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { { var result = UnityEngine.UI.CanvasUpdateRegistry.IsRebuildingLayout(); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_IsRebuildingGraphics(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { { var result = UnityEngine.UI.CanvasUpdateRegistry.IsRebuildingGraphics(); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_instance(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.UI.CanvasUpdateRegistry.instance; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "RegisterCanvasElementForLayoutRebuild", IsStatic = true}, F_RegisterCanvasElementForLayoutRebuild }, { new Puerts.MethodKey {Name = "TryRegisterCanvasElementForLayoutRebuild", IsStatic = true}, F_TryRegisterCanvasElementForLayoutRebuild }, { new Puerts.MethodKey {Name = "RegisterCanvasElementForGraphicRebuild", IsStatic = true}, F_RegisterCanvasElementForGraphicRebuild }, { new Puerts.MethodKey {Name = "TryRegisterCanvasElementForGraphicRebuild", IsStatic = true}, F_TryRegisterCanvasElementForGraphicRebuild }, { new Puerts.MethodKey {Name = "UnRegisterCanvasElementForRebuild", IsStatic = true}, F_UnRegisterCanvasElementForRebuild }, { new Puerts.MethodKey {Name = "IsRebuildingLayout", IsStatic = true}, F_IsRebuildingLayout }, { new Puerts.MethodKey {Name = "IsRebuildingGraphics", IsStatic = true}, F_IsRebuildingGraphics }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"instance", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_instance, Setter = null} }, } }; } } } <|start_filename|>Projects/DataTemplates/template_lua2/item_tbitem.lua<|end_filename|> -- item.TbItem return { [1] = { id=1, name="钻石", major_type=1, minor_type=101, max_pile_num=9999999, quality=0, icon="/Game/UI/UIText/UI_TestIcon_3.UI_TestIcon_3", icon_backgroud="", icon_mask="", desc="rmb兑换的主要货币", show_order=1, quantifier="个", show_in_bag=true, min_show_level=5, batch_usable=true, progress_time_when_use=1, show_hint_when_use=false, droppable=false, use_type=0, }, [2] = { id=2, name="金币", major_type=1, minor_type=102, max_pile_num=9999999, quality=0, icon="/Game/UI/UIText/UI_TestIcon_1.UI_TestIcon_1", icon_backgroud="", icon_mask="", desc="主要的高级流通代币", show_order=2, quantifier="个", show_in_bag=true, min_show_level=5, batch_usable=true, progress_time_when_use=1, show_hint_when_use=false, droppable=false, use_type=0, }, [3] = { id=3, name="银币", major_type=1, minor_type=103, max_pile_num=9999999, quality=0, icon="/Game/UI/UIText/UI_TestIcon_2.UI_TestIcon_2", icon_backgroud="", icon_mask="", desc="主要的流通代币", show_order=3, quantifier="个", show_in_bag=true, min_show_level=5, batch_usable=true, progress_time_when_use=1, show_hint_when_use=false, droppable=false, use_type=0, }, [4] = { id=4, name="经验", major_type=1, minor_type=104, max_pile_num=9999999, quality=0, icon="/Game/UI/UIText/UI_TestIcon_1.UI_TestIcon_1", icon_backgroud="", icon_mask="", desc="人物升级需要的经验", show_order=4, quantifier="点", show_in_bag=true, min_show_level=5, batch_usable=true, progress_time_when_use=1, show_hint_when_use=false, droppable=false, use_type=0, }, [5] = { id=5, name="能量点", major_type=1, minor_type=105, max_pile_num=9999999, quality=0, icon="/Game/UI/UIText/UI_TestIcon_1.UI_TestIcon_1", icon_backgroud="", icon_mask="", desc="人物变身需要的能量点", show_order=5, quantifier="点", show_in_bag=true, min_show_level=5, batch_usable=true, progress_time_when_use=1, show_hint_when_use=false, droppable=false, use_type=0, }, [1020100001] = { id=1020100001, name="初始发型", major_type=2, minor_type=210, max_pile_num=1, quality=0, icon="/Game/UI/UIText/IocnResource/Frames/S0012H_png.S0012H_png", icon_backgroud="", icon_mask="", desc="初始发型", show_order=6, quantifier="套", show_in_bag=true, min_show_level=5, batch_usable=true, progress_time_when_use=1, show_hint_when_use=false, droppable=false, use_type=0, }, [1020200001] = { id=1020200001, name="初始外套", major_type=2, minor_type=220, max_pile_num=1, quality=0, icon="/Game/UI/UIText/IocnResource/Frames/S0006_2C_png.S0006_2C_png", icon_backgroud="", icon_mask="", desc="初始外套", show_order=7, quantifier="件", show_in_bag=true, min_show_level=5, batch_usable=true, progress_time_when_use=1, show_hint_when_use=false, droppable=false, use_type=0, }, [1020300001] = { id=1020300001, name="初始上衣", major_type=2, minor_type=230, max_pile_num=1, quality=0, icon="/Game/UI/UIText/IocnResource/Frames/S0090ABS_png.S0090ABS_png", icon_backgroud="", icon_mask="", desc="初始上衣", show_order=8, quantifier="件", show_in_bag=true, min_show_level=5, batch_usable=true, progress_time_when_use=1, show_hint_when_use=false, droppable=false, use_type=0, }, [1020400001] = { id=1020400001, name="初始裤子", major_type=2, minor_type=242, max_pile_num=1, quality=0, icon="/Game/UI/UIText/UI_TestIcon_1.UI_TestIcon_1", icon_backgroud="", icon_mask="", desc="初始下装", show_order=9, quantifier="件", show_in_bag=true, min_show_level=5, batch_usable=true, progress_time_when_use=1, show_hint_when_use=false, droppable=false, use_type=0, }, [1020500001] = { id=1020500001, name="初始袜子", major_type=2, minor_type=250, max_pile_num=1, quality=0, icon="/Game/UI/UIText/IocnResource/Frames/S0012S_png.S0012S_png", icon_backgroud="", icon_mask="", desc="初始袜子", show_order=10, quantifier="双", show_in_bag=true, min_show_level=5, batch_usable=true, progress_time_when_use=1, show_hint_when_use=false, droppable=false, use_type=0, }, [1020600001] = { id=1020600001, name="初始鞋子", major_type=2, minor_type=260, max_pile_num=1, quality=0, icon="/Game/UI/UIText/IocnResource/Frames/S0012BS_png.S0012BS_png", icon_backgroud="", icon_mask="", desc="初始鞋子", show_order=11, quantifier="双", show_in_bag=true, min_show_level=5, batch_usable=true, progress_time_when_use=1, show_hint_when_use=false, droppable=false, use_type=0, }, [1020700001] = { id=1020700001, name="初始发饰", major_type=2, minor_type=271, max_pile_num=1, quality=0, icon="/Game/UI/UIText/IocnResource/Frames/S0090_X1AHC_png.S0090_X1AHC_png", icon_backgroud="", icon_mask="", desc="初始发饰", show_order=12, quantifier="套", show_in_bag=true, min_show_level=5, batch_usable=true, progress_time_when_use=1, show_hint_when_use=false, droppable=false, use_type=0, }, [1022490000] = { id=1022490000, name="测试数据-包子", major_type=4, minor_type=403, max_pile_num=100, quality=2, icon="/Game/UI/UIText/UI_TestIcon_1.UI_TestIcon_1", icon_backgroud="", icon_mask="", desc="包子", show_order=29, quantifier="个", show_in_bag=true, min_show_level=5, batch_usable=true, progress_time_when_use=1, show_hint_when_use=false, droppable=true, use_type=1, }, [1022490001] = { id=1022490001, name="测试数据-铲子", major_type=4, minor_type=424, max_pile_num=1, quality=3, icon="/Game/UI/UIText/UI_TestIcon_1.UI_TestIcon_1", icon_backgroud="", icon_mask="", desc="一把铲子", show_order=30, quantifier="把", show_in_bag=true, min_show_level=5, batch_usable=true, progress_time_when_use=1, show_hint_when_use=false, droppable=false, price=100, use_type=0, }, [1021490001] = { id=1021490001, name="测试数据-不要动", major_type=2, minor_type=278, max_pile_num=1, quality=0, icon="/Game/UI/UIText/IocnResource/Frames/S0090FE_01_png.S0090FE_01_png", icon_backgroud="", icon_mask="", desc="初始手持物", show_order=19, quantifier="件", show_in_bag=true, min_show_level=5, batch_usable=true, progress_time_when_use=1, show_hint_when_use=false, droppable=false, use_type=0, }, [1022490002] = { id=1022490002, name="测试数据-不要动", major_type=2, minor_type=290, max_pile_num=1, quality=2, icon="/Game/UI/UIText/IocnResource/Frames/S0090D_png.S0090D_png", icon_backgroud="", icon_mask="", desc="初始套装", show_order=26, quantifier="个", show_in_bag=true, min_show_level=5, batch_usable=true, progress_time_when_use=1, show_hint_when_use=false, droppable=false, price=8, use_type=0, }, } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_Material_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_Material_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Shader), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Shader>(false); var result = new UnityEngine.Material(Arg0); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.Material), result); } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Material), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Material>(false); var result = new UnityEngine.Material(Arg0); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.Material), result); } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.Material constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_HasProperty(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Material; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var result = obj.HasProperty(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var result = obj.HasProperty(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to HasProperty"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_EnableKeyword(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Material; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetString(false); obj.EnableKeyword(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_DisableKeyword(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Material; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetString(false); obj.DisableKeyword(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_IsKeywordEnabled(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Material; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetString(false); var result = obj.IsKeywordEnabled(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetShaderPassEnabled(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Material; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.GetBoolean(false); obj.SetShaderPassEnabled(Arg0,Arg1); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetShaderPassEnabled(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Material; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetString(false); var result = obj.GetShaderPassEnabled(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetPassName(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Material; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); var result = obj.GetPassName(Arg0); Puerts.PuertsDLL.ReturnString(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_FindPass(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Material; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetString(false); var result = obj.FindPass(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetOverrideTag(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Material; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.GetString(false); obj.SetOverrideTag(Arg0,Arg1); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetTag(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Material; if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.GetBoolean(false); var Arg2 = argHelper2.GetString(false); var result = obj.GetTag(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnString(isolate, info, result); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.GetBoolean(false); var result = obj.GetTag(Arg0,Arg1); Puerts.PuertsDLL.ReturnString(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetTag"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Lerp(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Material; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.Get<UnityEngine.Material>(false); var Arg1 = argHelper1.Get<UnityEngine.Material>(false); var Arg2 = argHelper2.GetFloat(false); obj.Lerp(Arg0,Arg1,Arg2); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetPass(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Material; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); var result = obj.SetPass(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_CopyPropertiesFromMaterial(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Material; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Material>(false); obj.CopyPropertiesFromMaterial(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ComputeCRC(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Material; { { var result = obj.ComputeCRC(); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetTexturePropertyNames(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Material; if (paramLen == 0) { { var result = obj.GetTexturePropertyNames(); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<string>), false, false)) { var Arg0 = argHelper0.Get<System.Collections.Generic.List<string>>(false); obj.GetTexturePropertyNames(Arg0); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetTexturePropertyNames"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetTexturePropertyNameIDs(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Material; if (paramLen == 0) { { var result = obj.GetTexturePropertyNameIDs(); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<int>), false, false)) { var Arg0 = argHelper0.Get<System.Collections.Generic.List<int>>(false); obj.GetTexturePropertyNameIDs(Arg0); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetTexturePropertyNameIDs"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetFloat(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Material; if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.GetFloat(false); obj.SetFloat(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetFloat(false); obj.SetFloat(Arg0,Arg1); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SetFloat"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetInt(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Material; if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.GetInt32(false); obj.SetInt(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); obj.SetInt(Arg0,Arg1); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SetInt"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetColor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Material; if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Color), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<UnityEngine.Color>(false); obj.SetColor(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Color), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.Color>(false); obj.SetColor(Arg0,Arg1); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SetColor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetVector(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Material; if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector4), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<UnityEngine.Vector4>(false); obj.SetVector(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector4), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.Vector4>(false); obj.SetVector(Arg0,Arg1); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SetVector"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetMatrix(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Material; if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Matrix4x4), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<UnityEngine.Matrix4x4>(false); obj.SetMatrix(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Matrix4x4), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.Matrix4x4>(false); obj.SetMatrix(Arg0,Arg1); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SetMatrix"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetTexture(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Material; if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<UnityEngine.Texture>(false); obj.SetTexture(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.Texture>(false); obj.SetTexture(Arg0,Arg1); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RenderTexture), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<UnityEngine.RenderTexture>(false); var Arg2 = (UnityEngine.Rendering.RenderTextureSubElement)argHelper2.GetInt32(false); obj.SetTexture(Arg0,Arg1,Arg2); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RenderTexture), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.RenderTexture>(false); var Arg2 = (UnityEngine.Rendering.RenderTextureSubElement)argHelper2.GetInt32(false); obj.SetTexture(Arg0,Arg1,Arg2); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SetTexture"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetBuffer(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Material; if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.ComputeBuffer), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<UnityEngine.ComputeBuffer>(false); obj.SetBuffer(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.ComputeBuffer), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.ComputeBuffer>(false); obj.SetBuffer(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GraphicsBuffer), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<UnityEngine.GraphicsBuffer>(false); obj.SetBuffer(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GraphicsBuffer), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.GraphicsBuffer>(false); obj.SetBuffer(Arg0,Arg1); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SetBuffer"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetConstantBuffer(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Material; if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.ComputeBuffer), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<UnityEngine.ComputeBuffer>(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetInt32(false); obj.SetConstantBuffer(Arg0,Arg1,Arg2,Arg3); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.ComputeBuffer), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.ComputeBuffer>(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetInt32(false); obj.SetConstantBuffer(Arg0,Arg1,Arg2,Arg3); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GraphicsBuffer), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<UnityEngine.GraphicsBuffer>(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetInt32(false); obj.SetConstantBuffer(Arg0,Arg1,Arg2,Arg3); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GraphicsBuffer), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.GraphicsBuffer>(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetInt32(false); obj.SetConstantBuffer(Arg0,Arg1,Arg2,Arg3); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SetConstantBuffer"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetFloatArray(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Material; if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<float>), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<System.Collections.Generic.List<float>>(false); obj.SetFloatArray(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<float>), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<System.Collections.Generic.List<float>>(false); obj.SetFloatArray(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(float[]), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<float[]>(false); obj.SetFloatArray(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(float[]), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<float[]>(false); obj.SetFloatArray(Arg0,Arg1); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SetFloatArray"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetColorArray(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Material; if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Color>), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<System.Collections.Generic.List<UnityEngine.Color>>(false); obj.SetColorArray(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Color>), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<System.Collections.Generic.List<UnityEngine.Color>>(false); obj.SetColorArray(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Color[]), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<UnityEngine.Color[]>(false); obj.SetColorArray(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Color[]), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.Color[]>(false); obj.SetColorArray(Arg0,Arg1); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SetColorArray"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetVectorArray(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Material; if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Vector4>), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<System.Collections.Generic.List<UnityEngine.Vector4>>(false); obj.SetVectorArray(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Vector4>), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<System.Collections.Generic.List<UnityEngine.Vector4>>(false); obj.SetVectorArray(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector4[]), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<UnityEngine.Vector4[]>(false); obj.SetVectorArray(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector4[]), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.Vector4[]>(false); obj.SetVectorArray(Arg0,Arg1); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SetVectorArray"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetMatrixArray(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Material; if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Matrix4x4>), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<System.Collections.Generic.List<UnityEngine.Matrix4x4>>(false); obj.SetMatrixArray(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Matrix4x4>), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<System.Collections.Generic.List<UnityEngine.Matrix4x4>>(false); obj.SetMatrixArray(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Matrix4x4[]), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<UnityEngine.Matrix4x4[]>(false); obj.SetMatrixArray(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Matrix4x4[]), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.Matrix4x4[]>(false); obj.SetMatrixArray(Arg0,Arg1); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SetMatrixArray"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetFloat(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Material; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var result = obj.GetFloat(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var result = obj.GetFloat(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetFloat"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetInt(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Material; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var result = obj.GetInt(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var result = obj.GetInt(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetInt"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetColor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Material; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var result = obj.GetColor(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var result = obj.GetColor(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetColor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetVector(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Material; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var result = obj.GetVector(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var result = obj.GetVector(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetVector"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetMatrix(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Material; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var result = obj.GetMatrix(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var result = obj.GetMatrix(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetMatrix"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetTexture(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Material; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var result = obj.GetTexture(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var result = obj.GetTexture(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetTexture"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetFloatArray(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Material; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var result = obj.GetFloatArray(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var result = obj.GetFloatArray(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<float>), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<System.Collections.Generic.List<float>>(false); obj.GetFloatArray(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<float>), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<System.Collections.Generic.List<float>>(false); obj.GetFloatArray(Arg0,Arg1); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetFloatArray"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetColorArray(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Material; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var result = obj.GetColorArray(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var result = obj.GetColorArray(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Color>), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<System.Collections.Generic.List<UnityEngine.Color>>(false); obj.GetColorArray(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Color>), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<System.Collections.Generic.List<UnityEngine.Color>>(false); obj.GetColorArray(Arg0,Arg1); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetColorArray"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetVectorArray(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Material; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var result = obj.GetVectorArray(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var result = obj.GetVectorArray(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Vector4>), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<System.Collections.Generic.List<UnityEngine.Vector4>>(false); obj.GetVectorArray(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Vector4>), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<System.Collections.Generic.List<UnityEngine.Vector4>>(false); obj.GetVectorArray(Arg0,Arg1); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetVectorArray"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetMatrixArray(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Material; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var result = obj.GetMatrixArray(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var result = obj.GetMatrixArray(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Matrix4x4>), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<System.Collections.Generic.List<UnityEngine.Matrix4x4>>(false); obj.GetMatrixArray(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Matrix4x4>), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<System.Collections.Generic.List<UnityEngine.Matrix4x4>>(false); obj.GetMatrixArray(Arg0,Arg1); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetMatrixArray"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetTextureOffset(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Material; if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); obj.SetTextureOffset(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); obj.SetTextureOffset(Arg0,Arg1); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SetTextureOffset"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetTextureScale(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Material; if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); obj.SetTextureScale(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); obj.SetTextureScale(Arg0,Arg1); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SetTextureScale"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetTextureOffset(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Material; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var result = obj.GetTextureOffset(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var result = obj.GetTextureOffset(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetTextureOffset"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetTextureScale(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Material; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var result = obj.GetTextureScale(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var result = obj.GetTextureScale(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetTextureScale"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_shader(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Material; var result = obj.shader; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_shader(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Material; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.shader = argHelper.Get<UnityEngine.Shader>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_color(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Material; var result = obj.color; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_color(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Material; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.color = argHelper.Get<UnityEngine.Color>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_mainTexture(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Material; var result = obj.mainTexture; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_mainTexture(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Material; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.mainTexture = argHelper.Get<UnityEngine.Texture>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_mainTextureOffset(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Material; var result = obj.mainTextureOffset; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_mainTextureOffset(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Material; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.mainTextureOffset = argHelper.Get<UnityEngine.Vector2>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_mainTextureScale(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Material; var result = obj.mainTextureScale; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_mainTextureScale(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Material; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.mainTextureScale = argHelper.Get<UnityEngine.Vector2>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_renderQueue(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Material; var result = obj.renderQueue; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_renderQueue(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Material; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.renderQueue = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_globalIlluminationFlags(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Material; var result = obj.globalIlluminationFlags; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_globalIlluminationFlags(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Material; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.globalIlluminationFlags = (UnityEngine.MaterialGlobalIlluminationFlags)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_doubleSidedGI(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Material; var result = obj.doubleSidedGI; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_doubleSidedGI(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Material; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.doubleSidedGI = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_enableInstancing(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Material; var result = obj.enableInstancing; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_enableInstancing(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Material; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.enableInstancing = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_passCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Material; var result = obj.passCount; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_shaderKeywords(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Material; var result = obj.shaderKeywords; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_shaderKeywords(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Material; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.shaderKeywords = argHelper.Get<string[]>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "HasProperty", IsStatic = false}, M_HasProperty }, { new Puerts.MethodKey {Name = "EnableKeyword", IsStatic = false}, M_EnableKeyword }, { new Puerts.MethodKey {Name = "DisableKeyword", IsStatic = false}, M_DisableKeyword }, { new Puerts.MethodKey {Name = "IsKeywordEnabled", IsStatic = false}, M_IsKeywordEnabled }, { new Puerts.MethodKey {Name = "SetShaderPassEnabled", IsStatic = false}, M_SetShaderPassEnabled }, { new Puerts.MethodKey {Name = "GetShaderPassEnabled", IsStatic = false}, M_GetShaderPassEnabled }, { new Puerts.MethodKey {Name = "GetPassName", IsStatic = false}, M_GetPassName }, { new Puerts.MethodKey {Name = "FindPass", IsStatic = false}, M_FindPass }, { new Puerts.MethodKey {Name = "SetOverrideTag", IsStatic = false}, M_SetOverrideTag }, { new Puerts.MethodKey {Name = "GetTag", IsStatic = false}, M_GetTag }, { new Puerts.MethodKey {Name = "Lerp", IsStatic = false}, M_Lerp }, { new Puerts.MethodKey {Name = "SetPass", IsStatic = false}, M_SetPass }, { new Puerts.MethodKey {Name = "CopyPropertiesFromMaterial", IsStatic = false}, M_CopyPropertiesFromMaterial }, { new Puerts.MethodKey {Name = "ComputeCRC", IsStatic = false}, M_ComputeCRC }, { new Puerts.MethodKey {Name = "GetTexturePropertyNames", IsStatic = false}, M_GetTexturePropertyNames }, { new Puerts.MethodKey {Name = "GetTexturePropertyNameIDs", IsStatic = false}, M_GetTexturePropertyNameIDs }, { new Puerts.MethodKey {Name = "SetFloat", IsStatic = false}, M_SetFloat }, { new Puerts.MethodKey {Name = "SetInt", IsStatic = false}, M_SetInt }, { new Puerts.MethodKey {Name = "SetColor", IsStatic = false}, M_SetColor }, { new Puerts.MethodKey {Name = "SetVector", IsStatic = false}, M_SetVector }, { new Puerts.MethodKey {Name = "SetMatrix", IsStatic = false}, M_SetMatrix }, { new Puerts.MethodKey {Name = "SetTexture", IsStatic = false}, M_SetTexture }, { new Puerts.MethodKey {Name = "SetBuffer", IsStatic = false}, M_SetBuffer }, { new Puerts.MethodKey {Name = "SetConstantBuffer", IsStatic = false}, M_SetConstantBuffer }, { new Puerts.MethodKey {Name = "SetFloatArray", IsStatic = false}, M_SetFloatArray }, { new Puerts.MethodKey {Name = "SetColorArray", IsStatic = false}, M_SetColorArray }, { new Puerts.MethodKey {Name = "SetVectorArray", IsStatic = false}, M_SetVectorArray }, { new Puerts.MethodKey {Name = "SetMatrixArray", IsStatic = false}, M_SetMatrixArray }, { new Puerts.MethodKey {Name = "GetFloat", IsStatic = false}, M_GetFloat }, { new Puerts.MethodKey {Name = "GetInt", IsStatic = false}, M_GetInt }, { new Puerts.MethodKey {Name = "GetColor", IsStatic = false}, M_GetColor }, { new Puerts.MethodKey {Name = "GetVector", IsStatic = false}, M_GetVector }, { new Puerts.MethodKey {Name = "GetMatrix", IsStatic = false}, M_GetMatrix }, { new Puerts.MethodKey {Name = "GetTexture", IsStatic = false}, M_GetTexture }, { new Puerts.MethodKey {Name = "GetFloatArray", IsStatic = false}, M_GetFloatArray }, { new Puerts.MethodKey {Name = "GetColorArray", IsStatic = false}, M_GetColorArray }, { new Puerts.MethodKey {Name = "GetVectorArray", IsStatic = false}, M_GetVectorArray }, { new Puerts.MethodKey {Name = "GetMatrixArray", IsStatic = false}, M_GetMatrixArray }, { new Puerts.MethodKey {Name = "SetTextureOffset", IsStatic = false}, M_SetTextureOffset }, { new Puerts.MethodKey {Name = "SetTextureScale", IsStatic = false}, M_SetTextureScale }, { new Puerts.MethodKey {Name = "GetTextureOffset", IsStatic = false}, M_GetTextureOffset }, { new Puerts.MethodKey {Name = "GetTextureScale", IsStatic = false}, M_GetTextureScale }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"shader", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_shader, Setter = S_shader} }, {"color", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_color, Setter = S_color} }, {"mainTexture", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_mainTexture, Setter = S_mainTexture} }, {"mainTextureOffset", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_mainTextureOffset, Setter = S_mainTextureOffset} }, {"mainTextureScale", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_mainTextureScale, Setter = S_mainTextureScale} }, {"renderQueue", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_renderQueue, Setter = S_renderQueue} }, {"globalIlluminationFlags", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_globalIlluminationFlags, Setter = S_globalIlluminationFlags} }, {"doubleSidedGI", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_doubleSidedGI, Setter = S_doubleSidedGI} }, {"enableInstancing", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_enableInstancing, Setter = S_enableInstancing} }, {"passCount", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_passCount, Setter = null} }, {"shaderKeywords", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_shaderKeywords, Setter = S_shaderKeywords} }, } }; } } } <|start_filename|>Projects/DataTemplates/template_erlang/test_tbtestref.erl<|end_filename|> %% test.TbTestRef get(1) -> #{id => 1,x1 => 1,x1_2 => 1,x2 => 2,a1 => [1,2],a2 => [2,3],b1 => [3,4],b2 => [4,5],c1 => [5,6,7],c2 => [6,7],d1 => #{1 => 2,3 => 4},d2 => #{1 => 2,3 => 4},e1 => 1,e2 => 11,e3 => "ab5",f1 => 1,f2 => 11,f3 => "ab5"}. get(2) -> #{id => 2,x1 => 1,x1_2 => 1,x2 => 2,a1 => [1,3],a2 => [2,4],b1 => [3,5],b2 => [4,6],c1 => [5,6,8],c2 => [6,8],d1 => #{1 => 2,3 => 4},d2 => #{1 => 2,3 => 4},e1 => 1,e2 => 11,e3 => "ab5",f1 => 1,f2 => 11,f3 => "ab5"}. get(3) -> #{id => 3,x1 => 1,x1_2 => 1,x2 => 2,a1 => [1,4],a2 => [2,5],b1 => [3,6],b2 => [4,7],c1 => [5,6,9],c2 => [6,9],d1 => #{1 => 2,3 => 4},d2 => #{1 => 2,3 => 4},e1 => 1,e2 => 11,e3 => "ab5",f1 => 1,f2 => 11,f3 => "ab5"}. <|start_filename|>Projects/GenerateDatas/convert_lua/ai.TbBlackboard/attack_or_patrol.lua<|end_filename|> return { name = "attack_or_patrol", desc = "demo hahaha", parent_name = "", keys = { { name = "OriginPosition", desc = "", is_static = false, type = 5, type_class_name = "", }, { name = "TargetActor", desc = "x2 haha", is_static = false, type = 10, type_class_name = "", }, { name = "AcceptableRadius", desc = "x3 haha", is_static = false, type = 3, type_class_name = "", }, { name = "CurChooseSkillId", desc = "x4 haha", is_static = false, type = 2, type_class_name = "", }, }, } <|start_filename|>Projects/Java_bin/src/main/gen/cfg/test/TestSet.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.test; import bright.serialization.*; public final class TestSet { public TestSet(ByteBuf _buf) { id = _buf.readInt(); {int n = Math.min(_buf.readSize(), _buf.size());x1 = new java.util.ArrayList<Integer>(n);for(int i = 0 ; i < n ; i++) { Integer _e; _e = _buf.readInt(); x1.add(_e);}} {int n = Math.min(_buf.readSize(), _buf.size());x2 = new java.util.ArrayList<Long>(n);for(int i = 0 ; i < n ; i++) { Long _e; _e = _buf.readLong(); x2.add(_e);}} {int n = Math.min(_buf.readSize(), _buf.size());x3 = new java.util.ArrayList<String>(n);for(int i = 0 ; i < n ; i++) { String _e; _e = _buf.readString(); x3.add(_e);}} {int n = Math.min(_buf.readSize(), _buf.size());x4 = new java.util.ArrayList<cfg.test.DemoEnum>(n);for(int i = 0 ; i < n ; i++) { cfg.test.DemoEnum _e; _e = cfg.test.DemoEnum.valueOf(_buf.readInt()); x4.add(_e);}} } public TestSet(int id, java.util.ArrayList<Integer> x1, java.util.ArrayList<Long> x2, java.util.ArrayList<String> x3, java.util.ArrayList<cfg.test.DemoEnum> x4 ) { this.id = id; this.x1 = x1; this.x2 = x2; this.x3 = x3; this.x4 = x4; } public final int id; public final java.util.ArrayList<Integer> x1; public final java.util.ArrayList<Long> x2; public final java.util.ArrayList<String> x3; public final java.util.ArrayList<cfg.test.DemoEnum> x4; public void resolve(java.util.HashMap<String, Object> _tables) { } @Override public String toString() { return "{ " + "id:" + id + "," + "x1:" + x1 + "," + "x2:" + x2 + "," + "x3:" + x3 + "," + "x4:" + x4 + "," + "}"; } } <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/test/DemoE2.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.test { public sealed partial class DemoE2 : Bright.Config.BeanBase { public DemoE2(ByteBuf _buf) { if(_buf.ReadBool()){ Y1 = _buf.ReadInt(); } else { Y1 = null; } Y2 = _buf.ReadBool(); } public DemoE2(int? y1, bool y2 ) { this.Y1 = y1; this.Y2 = y2; } public static DemoE2 DeserializeDemoE2(ByteBuf _buf) { return new test.DemoE2(_buf); } public readonly int? Y1; public readonly bool Y2; public const int ID = -2138341716; public override int GetTypeId() => ID; public void Resolve(Dictionary<string, object> _tables) { OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); public override string ToString() { return "{ " + "Y1:" + Y1 + "," + "Y2:" + Y2 + "," + "}"; } } } <|start_filename|>Projects/Csharp_DotNet5_json_ExportServer/Gen/test/TestSep.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; using System.Text.Json; namespace cfg.test { public sealed class TestSep : Bright.Config.BeanBase { public TestSep(JsonElement _json) { Id = _json.GetProperty("id").GetInt32(); X1_l10n_key = _json.GetProperty("x1").GetProperty("key").GetString();X1 = _json.GetProperty("x1").GetProperty("text").GetString(); X2 = test.SepBean1.DeserializeSepBean1(_json.GetProperty("x2")); X3 = test.SepVector.DeserializeSepVector(_json.GetProperty("x3")); { var _json0 = _json.GetProperty("x4"); X4 = new System.Collections.Generic.List<test.SepVector>(_json0.GetArrayLength()); foreach(JsonElement __e in _json0.EnumerateArray()) { test.SepVector __v; __v = test.SepVector.DeserializeSepVector(__e); X4.Add(__v); } } { var _json0 = _json.GetProperty("x5"); X5 = new System.Collections.Generic.List<test.SepBean1>(_json0.GetArrayLength()); foreach(JsonElement __e in _json0.EnumerateArray()) { test.SepBean1 __v; __v = test.SepBean1.DeserializeSepBean1(__e); X5.Add(__v); } } { var _json0 = _json.GetProperty("x6"); X6 = new System.Collections.Generic.List<test.SepBean1>(_json0.GetArrayLength()); foreach(JsonElement __e in _json0.EnumerateArray()) { test.SepBean1 __v; __v = test.SepBean1.DeserializeSepBean1(__e); X6.Add(__v); } } } public TestSep(int id, string x1, test.SepBean1 x2, test.SepVector x3, System.Collections.Generic.List<test.SepVector> x4, System.Collections.Generic.List<test.SepBean1> x5, System.Collections.Generic.List<test.SepBean1> x6 ) { this.Id = id; this.X1 = x1; this.X2 = x2; this.X3 = x3; this.X4 = x4; this.X5 = x5; this.X6 = x6; } public static TestSep DeserializeTestSep(JsonElement _json) { return new test.TestSep(_json); } public int Id { get; private set; } public string X1 { get; private set; } public string X1_l10n_key { get; } public test.SepBean1 X2 { get; private set; } /// <summary> /// SepVector已经定义了sep=,属性 /// </summary> public test.SepVector X3 { get; private set; } /// <summary> /// 用;来分割数据,然后顺序读入SepVector /// </summary> public System.Collections.Generic.List<test.SepVector> X4 { get; private set; } /// <summary> /// 用,分割数据,然后顺序读入 /// </summary> public System.Collections.Generic.List<test.SepBean1> X5 { get; private set; } /// <summary> /// 用;分割数据,然后再将每个数据用,分割,读入 /// </summary> public System.Collections.Generic.List<test.SepBean1> X6 { get; private set; } public const int __ID__ = -543221520; public override int GetTypeId() => __ID__; public void Resolve(Dictionary<string, object> _tables) { X2?.Resolve(_tables); X3?.Resolve(_tables); foreach(var _e in X4) { _e?.Resolve(_tables); } foreach(var _e in X5) { _e?.Resolve(_tables); } foreach(var _e in X6) { _e?.Resolve(_tables); } } public void TranslateText(System.Func<string, string, string> translator) { X1 = translator(X1_l10n_key, X1); X2?.TranslateText(translator); X3?.TranslateText(translator); foreach(var _e in X4) { _e?.TranslateText(translator); } foreach(var _e in X5) { _e?.TranslateText(translator); } foreach(var _e in X6) { _e?.TranslateText(translator); } } public override string ToString() { return "{ " + "Id:" + Id + "," + "X1:" + X1 + "," + "X2:" + X2 + "," + "X3:" + X3 + "," + "X4:" + Bright.Common.StringUtil.CollectionToString(X4) + "," + "X5:" + Bright.Common.StringUtil.CollectionToString(X5) + "," + "X6:" + Bright.Common.StringUtil.CollectionToString(X6) + "," + "}"; } } } <|start_filename|>Projects/Java_bin/src/main/gen/cfg/test/TestMap.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.test; import bright.serialization.*; public final class TestMap { public TestMap(ByteBuf _buf) { id = _buf.readInt(); {int n = Math.min(_buf.readSize(), _buf.size());x1 = new java.util.HashMap<Integer, Integer>(n * 3 / 2);for(int i = 0 ; i < n ; i++) { Integer _k; _k = _buf.readInt(); Integer _v; _v = _buf.readInt(); x1.put(_k, _v);}} {int n = Math.min(_buf.readSize(), _buf.size());x2 = new java.util.HashMap<Long, Integer>(n * 3 / 2);for(int i = 0 ; i < n ; i++) { Long _k; _k = _buf.readLong(); Integer _v; _v = _buf.readInt(); x2.put(_k, _v);}} {int n = Math.min(_buf.readSize(), _buf.size());x3 = new java.util.HashMap<String, Integer>(n * 3 / 2);for(int i = 0 ; i < n ; i++) { String _k; _k = _buf.readString(); Integer _v; _v = _buf.readInt(); x3.put(_k, _v);}} {int n = Math.min(_buf.readSize(), _buf.size());x4 = new java.util.HashMap<cfg.test.DemoEnum, Integer>(n * 3 / 2);for(int i = 0 ; i < n ; i++) { cfg.test.DemoEnum _k; _k = cfg.test.DemoEnum.valueOf(_buf.readInt()); Integer _v; _v = _buf.readInt(); x4.put(_k, _v);}} } public TestMap(int id, java.util.HashMap<Integer, Integer> x1, java.util.HashMap<Long, Integer> x2, java.util.HashMap<String, Integer> x3, java.util.HashMap<cfg.test.DemoEnum, Integer> x4 ) { this.id = id; this.x1 = x1; this.x2 = x2; this.x3 = x3; this.x4 = x4; } public final int id; public cfg.test.TestIndex id_Ref; public final java.util.HashMap<Integer, Integer> x1; public final java.util.HashMap<Long, Integer> x2; public final java.util.HashMap<String, Integer> x3; public final java.util.HashMap<cfg.test.DemoEnum, Integer> x4; public void resolve(java.util.HashMap<String, Object> _tables) { this.id_Ref = ((cfg.test.TbTestIndex)_tables.get("test.TbTestIndex")).get(id); } @Override public String toString() { return "{ " + "id:" + id + "," + "x1:" + x1 + "," + "x2:" + x2 + "," + "x3:" + x3 + "," + "x4:" + x4 + "," + "}"; } } <|start_filename|>Projects/Csharp_CustomTemplate_EncryptMemory/Gen/common/GlobalConfig.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using System; using Newtonsoft.Json; using Scripts; namespace cfg.common { [Serializable] public partial class GlobalConfig : AConfig { /// <summary> /// 背包容量 /// </summary> [JsonProperty("bag_capacity")] private int _bag_capacity { get; set; } [JsonIgnore] public EncryptInt bag_capacity { get; private set; } = new(); [JsonProperty("bag_capacity_special")] private int _bag_capacity_special { get; set; } [JsonIgnore] public EncryptInt bag_capacity_special { get; private set; } = new(); [JsonProperty("bag_temp_expendable_capacity")] private int _bag_temp_expendable_capacity { get; set; } [JsonIgnore] public EncryptInt bag_temp_expendable_capacity { get; private set; } = new(); [JsonProperty("bag_temp_tool_capacity")] private int _bag_temp_tool_capacity { get; set; } [JsonIgnore] public EncryptInt bag_temp_tool_capacity { get; private set; } = new(); [JsonProperty("bag_init_capacity")] private int _bag_init_capacity { get; set; } [JsonIgnore] public EncryptInt bag_init_capacity { get; private set; } = new(); [JsonProperty("quick_bag_capacity")] private int _quick_bag_capacity { get; set; } [JsonIgnore] public EncryptInt quick_bag_capacity { get; private set; } = new(); [JsonProperty("cloth_bag_capacity")] private int _cloth_bag_capacity { get; set; } [JsonIgnore] public EncryptInt cloth_bag_capacity { get; private set; } = new(); [JsonProperty("cloth_bag_init_capacity")] private int _cloth_bag_init_capacity { get; set; } [JsonIgnore] public EncryptInt cloth_bag_init_capacity { get; private set; } = new(); [JsonProperty("cloth_bag_capacity_special")] private int _cloth_bag_capacity_special { get; set; } [JsonIgnore] public EncryptInt cloth_bag_capacity_special { get; private set; } = new(); [JsonProperty("bag_init_items_drop_id")] private int? _bag_init_items_drop_id { get; set; } [JsonIgnore] public EncryptInt bag_init_items_drop_id { get; private set; } = new(); [JsonProperty("mail_box_capacity")] private int _mail_box_capacity { get; set; } [JsonIgnore] public EncryptInt mail_box_capacity { get; private set; } = new(); [JsonProperty("damage_param_c")] private float _damage_param_c { get; set; } [JsonIgnore] public EncryptFloat damage_param_c { get; private set; } = new(); [JsonProperty("damage_param_e")] private float _damage_param_e { get; set; } [JsonIgnore] public EncryptFloat damage_param_e { get; private set; } = new(); [JsonProperty("damage_param_f")] private float _damage_param_f { get; set; } [JsonIgnore] public EncryptFloat damage_param_f { get; private set; } = new(); [JsonProperty("damage_param_d")] private float _damage_param_d { get; set; } [JsonIgnore] public EncryptFloat damage_param_d { get; private set; } = new(); [JsonProperty("role_speed")] private float _role_speed { get; set; } [JsonIgnore] public EncryptFloat role_speed { get; private set; } = new(); [JsonProperty("monster_speed")] private float _monster_speed { get; set; } [JsonIgnore] public EncryptFloat monster_speed { get; private set; } = new(); [JsonProperty("init_energy")] private int _init_energy { get; set; } [JsonIgnore] public EncryptInt init_energy { get; private set; } = new(); [JsonProperty("init_viality")] private int _init_viality { get; set; } [JsonIgnore] public EncryptInt init_viality { get; private set; } = new(); [JsonProperty("max_viality")] private int _max_viality { get; set; } [JsonIgnore] public EncryptInt max_viality { get; private set; } = new(); [JsonProperty("per_viality_recovery_time")] private int _per_viality_recovery_time { get; set; } [JsonIgnore] public EncryptInt per_viality_recovery_time { get; private set; } = new(); public override void EndInit() { bag_capacity = _bag_capacity; bag_capacity_special = _bag_capacity_special; bag_temp_expendable_capacity = _bag_temp_expendable_capacity; bag_temp_tool_capacity = _bag_temp_tool_capacity; bag_init_capacity = _bag_init_capacity; quick_bag_capacity = _quick_bag_capacity; cloth_bag_capacity = _cloth_bag_capacity; cloth_bag_init_capacity = _cloth_bag_init_capacity; cloth_bag_capacity_special = _cloth_bag_capacity_special; bag_init_items_drop_id = _bag_init_items_drop_id; mail_box_capacity = _mail_box_capacity; damage_param_c = _damage_param_c; damage_param_e = _damage_param_e; damage_param_f = _damage_param_f; damage_param_d = _damage_param_d; role_speed = _role_speed; monster_speed = _monster_speed; init_energy = _init_energy; init_viality = _init_viality; max_viality = _max_viality; per_viality_recovery_time = _per_viality_recovery_time; } public override string ToString() => JsonConvert.SerializeObject(this); } } <|start_filename|>Projects/DataTemplates/template_json2/common_tbglobalconfig.json<|end_filename|> { "bag_capacity": 500, "bag_capacity_special": 50, "bag_temp_expendable_capacity": 10, "bag_temp_tool_capacity": 4, "bag_init_capacity": 100, "quick_bag_capacity": 4, "cloth_bag_capacity": 1000, "cloth_bag_init_capacity": 500, "cloth_bag_capacity_special": 50, "bag_init_items_drop_id": 1, "mail_box_capacity": 100, "damage_param_c": 1, "damage_param_e": 0.75, "damage_param_f": 10, "damage_param_d": 0.8, "role_speed": 5, "monster_speed": 5, "init_energy": 0, "init_viality": 100, "max_viality": 100, "per_viality_recovery_time": 300 } <|start_filename|>Projects/GenerateDatas/convert_lua/bonus.TbDrop/1.lua<|end_filename|> return { id = 1, desc = "奖励一个物品", client_show_items = { }, bonus = { _name = 'OneItem', item_id = 1021490001, }, } <|start_filename|>Projects/GenerateDatas/convert_lua/role.TbRoleLevelExpAttr/66.lua<|end_filename|> return { level = 66, need_exp = 155000, clothes_attrs = { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, }, } <|start_filename|>Projects/Go_json/gen/src/cfg/test.DefineFromExcelOne.go<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg import "errors" type TestDefineFromExcelOne struct { UnlockEquip int32 UnlockHero int32 DefaultAvatar string DefaultItem string } const TypeId_TestDefineFromExcelOne = 528039504 func (*TestDefineFromExcelOne) GetTypeId() int32 { return 528039504 } func (_v *TestDefineFromExcelOne)Deserialize(_buf map[string]interface{}) (err error) { { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["unlock_equip"].(float64); !_ok_ { err = errors.New("unlock_equip error"); return }; _v.UnlockEquip = int32(_tempNum_) } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["unlock_hero"].(float64); !_ok_ { err = errors.New("unlock_hero error"); return }; _v.UnlockHero = int32(_tempNum_) } { var _ok_ bool; if _v.DefaultAvatar, _ok_ = _buf["default_avatar"].(string); !_ok_ { err = errors.New("default_avatar error"); return } } { var _ok_ bool; if _v.DefaultItem, _ok_ = _buf["default_item"].(string); !_ok_ { err = errors.New("default_item error"); return } } return } func DeserializeTestDefineFromExcelOne(_buf map[string]interface{}) (*TestDefineFromExcelOne, error) { v := &TestDefineFromExcelOne{} if err := v.Deserialize(_buf); err == nil { return v, nil } else { return nil, err } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_HDROutputSettings_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_HDROutputSettings_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.HDROutputSettings constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_RequestHDRModeChange(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.HDROutputSettings; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetBoolean(false); obj.RequestHDRModeChange(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_main(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.HDROutputSettings.main; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_active(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.HDROutputSettings; var result = obj.active; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_available(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.HDROutputSettings; var result = obj.available; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_automaticHDRTonemapping(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.HDROutputSettings; var result = obj.automaticHDRTonemapping; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_automaticHDRTonemapping(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.HDROutputSettings; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.automaticHDRTonemapping = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_displayColorGamut(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.HDROutputSettings; var result = obj.displayColorGamut; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_format(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.HDROutputSettings; var result = obj.format; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_graphicsFormat(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.HDROutputSettings; var result = obj.graphicsFormat; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_paperWhiteNits(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.HDROutputSettings; var result = obj.paperWhiteNits; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_paperWhiteNits(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.HDROutputSettings; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.paperWhiteNits = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_maxFullFrameToneMapLuminance(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.HDROutputSettings; var result = obj.maxFullFrameToneMapLuminance; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_maxToneMapLuminance(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.HDROutputSettings; var result = obj.maxToneMapLuminance; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_minToneMapLuminance(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.HDROutputSettings; var result = obj.minToneMapLuminance; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_HDRModeChangeRequested(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.HDROutputSettings; var result = obj.HDRModeChangeRequested; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_displays(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.HDROutputSettings.displays; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_displays(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.HDROutputSettings.displays = argHelper.Get<UnityEngine.HDROutputSettings[]>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "RequestHDRModeChange", IsStatic = false}, M_RequestHDRModeChange }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"main", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_main, Setter = null} }, {"active", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_active, Setter = null} }, {"available", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_available, Setter = null} }, {"automaticHDRTonemapping", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_automaticHDRTonemapping, Setter = S_automaticHDRTonemapping} }, {"displayColorGamut", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_displayColorGamut, Setter = null} }, {"format", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_format, Setter = null} }, {"graphicsFormat", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_graphicsFormat, Setter = null} }, {"paperWhiteNits", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_paperWhiteNits, Setter = S_paperWhiteNits} }, {"maxFullFrameToneMapLuminance", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_maxFullFrameToneMapLuminance, Setter = null} }, {"maxToneMapLuminance", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_maxToneMapLuminance, Setter = null} }, {"minToneMapLuminance", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_minToneMapLuminance, Setter = null} }, {"HDRModeChangeRequested", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_HDRModeChangeRequested, Setter = null} }, {"displays", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_displays, Setter = S_displays} }, } }; } } } <|start_filename|>Projects/Go_json/gen/src/cfg/test.DemoD3.go<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg import "errors" type TestDemoD3 struct { X1 int32 X3 int32 } const TypeId_TestDemoD3 = -2138341746 func (*TestDemoD3) GetTypeId() int32 { return -2138341746 } func (_v *TestDemoD3)Deserialize(_buf map[string]interface{}) (err error) { { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["x1"].(float64); !_ok_ { err = errors.New("x1 error"); return }; _v.X1 = int32(_tempNum_) } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["x3"].(float64); !_ok_ { err = errors.New("x3 error"); return }; _v.X3 = int32(_tempNum_) } return } func DeserializeTestDemoD3(_buf map[string]interface{}) (interface{}, error) { var id string var _ok_ bool if id, _ok_ = _buf["__type__"].(string) ; !_ok_ { return nil, errors.New("type id missing") } switch id { case "DemoE1": _v := &TestDemoE1{}; if err := _v.Deserialize(_buf); err != nil { return nil, errors.New("test.DemoE1") } else { return _v, nil } default: return nil, errors.New("unknown type id") } } <|start_filename|>Projects/DataTemplates/template_lua2/common_tbglobalconfig.lua<|end_filename|> -- common.TbGlobalConfig return { bag_capacity=500, bag_capacity_special=50, bag_temp_expendable_capacity=10, bag_temp_tool_capacity=4, bag_init_capacity=100, quick_bag_capacity=4, cloth_bag_capacity=1000, cloth_bag_init_capacity=500, cloth_bag_capacity_special=50, bag_init_items_drop_id=1, mail_box_capacity=100, damage_param_c=1, damage_param_e=0.75, damage_param_f=10, damage_param_d=0.8, role_speed=5, monster_speed=5, init_energy=0, init_viality=100, max_viality=100, per_viality_recovery_time=300, }, <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_TerrainExtensions_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_TerrainExtensions_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.TerrainExtensions constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_UpdateGIMaterials(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Terrain), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Terrain>(false); UnityEngine.TerrainExtensions.UpdateGIMaterials(Arg0); return; } } if (paramLen == 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Terrain), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Terrain>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetInt32(false); var Arg4 = argHelper4.GetInt32(false); UnityEngine.TerrainExtensions.UpdateGIMaterials(Arg0,Arg1,Arg2,Arg3,Arg4); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UpdateGIMaterials"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "UpdateGIMaterials", IsStatic = true}, F_UpdateGIMaterials }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { } }; } } } <|start_filename|>Projects/java_json/src/gen/cfg/test/ETestCurrency.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.test; public enum ETestCurrency { /** * 重要 */ DIAMOND(1), /** * 有用 */ GOLD(2), ; private final int value; public int getValue() { return value; } ETestCurrency(int value) { this.value = value; } public static ETestCurrency valueOf(int value) { if (value == 1) return DIAMOND; if (value == 2) return GOLD; throw new IllegalArgumentException(""); } } <|start_filename|>Projects/DataTemplates/template_erlang/l10n_tbl10ndemo.erl<|end_filename|> %% l10n.TbL10NDemo get(11) -> #{id => 11,text => #{key=>"/demo/1",text=>"测试1"}}. get(12) -> #{id => 12,text => #{key=>"/demo/2",text=>"测试2"}}. get(13) -> #{id => 13,text => #{key=>"/demo/3",text=>"测试3"}}. get(14) -> #{id => 14,text => #{key=>"",text=>""}}. get(15) -> #{id => 15,text => #{key=>"/demo/5",text=>"测试5"}}. get(16) -> #{id => 16,text => #{key=>"/demo/6",text=>"测试6"}}. get(17) -> #{id => 17,text => #{key=>"/demo/7",text=>"测试7"}}. get(18) -> #{id => 18,text => #{key=>"/demo/8",text=>"测试8"}}. <|start_filename|>ProtoProjects/go/gen/src/proto/test.Foo.go<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package proto import ( "bright/serialization" ) import "errors" type TestFoo struct { X int32 Y *TestAllType Z *TestSimple } const TypeId_TestFoo = 1234 func (*TestFoo) GetTypeId() int32 { return 1234 } func (_v *TestFoo)Serialize(_buf *serialization.ByteBuf) { _buf.WriteInt(_v.X) SerializeTestAllType(_v.Y, _buf) SerializeTestSimple(_v.Z, _buf) } func (_v *TestFoo)Deserialize(_buf *serialization.ByteBuf) (err error) { { if _v.X, err = _buf.ReadInt(); err != nil { err = errors.New("_v.X error"); return } } { if _v.Y, err = DeserializeTestAllType(_buf); err != nil { err = errors.New("_v.Y error"); return } } { if _v.Z, err = DeserializeTestSimple(_buf); err != nil { err = errors.New("_v.Z error"); return } } return } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_UI_ContentSizeFitter_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_UI_ContentSizeFitter_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.UI.ContentSizeFitter constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetLayoutHorizontal(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.ContentSizeFitter; { { obj.SetLayoutHorizontal(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetLayoutVertical(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.ContentSizeFitter; { { obj.SetLayoutVertical(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_horizontalFit(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.ContentSizeFitter; var result = obj.horizontalFit; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_horizontalFit(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.ContentSizeFitter; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.horizontalFit = (UnityEngine.UI.ContentSizeFitter.FitMode)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_verticalFit(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.ContentSizeFitter; var result = obj.verticalFit; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_verticalFit(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.ContentSizeFitter; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.verticalFit = (UnityEngine.UI.ContentSizeFitter.FitMode)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "SetLayoutHorizontal", IsStatic = false}, M_SetLayoutHorizontal }, { new Puerts.MethodKey {Name = "SetLayoutVertical", IsStatic = false}, M_SetLayoutVertical }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"horizontalFit", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_horizontalFit, Setter = S_horizontalFit} }, {"verticalFit", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_verticalFit, Setter = S_verticalFit} }, } }; } } } <|start_filename|>ProtoProjects/go/src/bright/serialization/marshal_test.go<|end_filename|> package serialization import ( math2 "bright/math" "bytes" "testing" ) func TestMarshal(t *testing.T) { buf := NewByteBuf(10) for i:= 0 ; i < 2 ; i++ { x := i != 0 buf.WriteBool(x) if v, err := buf.ReadBool(); err != nil || v != x { t.Fatalf("expect %v, get %v", x, v) } if buf.Size() != 0 { t.Fatalf("expect empty. but size:%v, x:%v", buf.Size(), x) } } for i := 0 ; i < 256 ; i = i * 3 / 2 + 1 { x := byte(i) buf.WriteByte(x) if v, err := buf.ReadByte(); err != nil || v != x { t.Fatalf("expect %v, get %v", x, v) } if buf.Size() != 0 { t.Fatalf("expect empty. but size:%v, x:%v", buf.Size(), x) } } for i := 0 ; i < 0x10000 ; i = i * 3 / 2 + 1 { x := int16(i) buf.WriteShort(x) if v, err := buf.ReadShort(); err != nil || v != x { t.Fatalf("expect %v, get %v", x, v) } if buf.Size() != 0 { t.Fatalf("expect empty. but size:%v, x:%v", buf.Size(), x) } } for i := 0 ; i < 0x10000 ; i = i * 3 / 2 + 1 { x := int16(i) buf.WriteFshort(x) if v, err := buf.ReadFshort(); err != nil || v != x { t.Fatalf("expect %v, get %v", x, v) } if buf.Size() != 0 { t.Fatalf("expect empty. but size:%v, x:%v", buf.Size(), x) } } for i := 0 ; i < 0x1000000000 ; i = i * 3 / 2 + 1 { x := int32(i) buf.WriteInt(x) if v, err := buf.ReadInt(); err != nil || v != x { t.Fatalf("expect %v, get %v", x, v) } if buf.Size() != 0 { t.Fatalf("expect empty. but size:%v, x:%v", buf.Size(), x) } } for i := 0 ; i < 0x1000000000 ; i = i * 3 / 2 + 1 { x := int32(i) buf.WriteFint(x) if v, err := buf.ReadFint(); err != nil || v != x { t.Fatalf("expect %v, get %v", x, v) } if buf.Size() != 0 { t.Fatalf("expect empty. but size:%v, x:%v", buf.Size(), x) } } for i := 0 ; i < 0x100000000 ; i = i * 3 / 2 + 1 { x := int(i) buf.WriteSize(x) if v, err := buf.ReadSize(); err != nil || v != x { t.Fatalf("expect %v, get %v", x, v) } if buf.Size() != 0 { t.Fatalf("expect empty. but size:%v, x:%v", buf.Size(), x) } } for i := 0 ; i < 0x100000000 ; i = i * 3 / 2 + 1 { x := int32(i) buf.WriteSint(x) if v, err := buf.ReadSint(); err != nil || v != x { t.Fatalf("expect %v, get %v", x, v) } if buf.Size() != 0 { t.Fatalf("expect empty. but size:%v, x:%v", buf.Size(), x) } } for i := 0 ; i < 0x1000000000000000 ; i = i * 3 / 2 + 1 { x := int64(i) buf.WriteLong(x) if v, err := buf.ReadLong(); err != nil || v != x { t.Fatalf("expect %v, get %v", x, v) } if buf.Size() != 0 { t.Fatalf("expect empty. but size:%v, x:%v", buf.Size(), x) } x = -x buf.WriteLong(x) if v, err := buf.ReadLong(); err != nil || v != x { t.Fatalf("expect %v, get %v", x, v) } if buf.Size() != 0 { t.Fatalf("expect empty. but size:%v, x:%v", buf.Size(), x) } } for i := 0 ; i < 0x100000000 ; i = i * 3 / 2 + 1 { x := float32(i) buf.WriteFloat(x) if v, err := buf.ReadFloat(); err != nil || v != x { t.Fatalf("expect %v, get %v", x, v) } if buf.Size() != 0 { t.Fatalf("expect empty. but size:%v, x:%v", buf.Size(), x) } } for i := 0 ; i < 0x100000000 ; i = i * 3 / 2 + 1 { x := float64(i) buf.WriteDouble(x) if v, err := buf.ReadDouble(); err != nil || v != x { t.Fatalf("expect %v, get %v", x, v) } if buf.Size() != 0 { t.Fatalf("expect empty. but size:%v, x:%v", buf.Size(), x) } } { x := "walon" buf.WriteString(x) if v, err := buf.ReadString(); err != nil || v != x { t.Fatalf("expect %v, get %v", x, v) } if buf.Size() != 0 { t.Fatalf("expect empty. but size:%v, x:%v", buf.Size(), x) } } { x := math2.Vector2{X:1,Y:2} buf.WriteVector2(x) if v, err := buf.ReadVector2(); err != nil || v != x { t.Fatalf("expect %v, get %v", x, v) } if buf.Size() != 0 { t.Fatalf("expect empty. but size:%v, x:%v", buf.Size(), x) } } { x := math2.Vector3{X:1,Y:2,Z:3} buf.WriteVector3(x) if v, err := buf.ReadVector3(); err != nil || v != x { t.Fatalf("expect %v, get %v", x, v) } if buf.Size() != 0 { t.Fatalf("expect empty. but size:%v, x:%v", buf.Size(), x) } } { x := math2.Vector4{X:1,Y:2,Z:3,W:4} buf.WriteVector4(x) if v, err := buf.ReadVector4(); err != nil || v != x { t.Fatalf("expect %v, get %v", x, v) } if buf.Size() != 0 { t.Fatalf("expect empty. but size:%v, x:%v", buf.Size(), x) } } { x := []byte{1,2,3} buf.WriteBytes(x) if v, err := buf.ReadBytes(); err != nil || !bytes.Equal(x, v) { t.Fatalf("expect %v, get %v", x, v) } if buf.Size() != 0 { t.Fatalf("expect empty. but size:%v, x:%v", buf.Size(), x) } } { x := []byte{1,2,3,4} buf.WriteBytesWithoutSize(x) if v, err := buf.ReadFint(); err != nil || v != 0x04030201 { t.Fatalf("expect %v, get %v", x, v) } if buf.Size() != 0 { t.Fatalf("expect empty. but size:%v, x:%v", buf.Size(), x) } } } <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/bonus/CoefficientItem.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.bonus { public sealed partial class CoefficientItem : bonus.Bonus { public CoefficientItem(ByteBuf _buf) : base(_buf) { BonusId = _buf.ReadInt(); BonusList = bonus.Items.DeserializeItems(_buf); } public CoefficientItem(int bonus_id, bonus.Items bonus_list ) : base() { this.BonusId = bonus_id; this.BonusList = bonus_list; } public static CoefficientItem DeserializeCoefficientItem(ByteBuf _buf) { return new bonus.CoefficientItem(_buf); } public readonly int BonusId; public readonly bonus.Items BonusList; public const int ID = -229470727; public override int GetTypeId() => ID; public override void Resolve(Dictionary<string, object> _tables) { base.Resolve(_tables); BonusList?.Resolve(_tables); OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); public override string ToString() { return "{ " + "BonusId:" + BonusId + "," + "BonusList:" + BonusList + "," + "}"; } } } <|start_filename|>ProtoProjects/go/src/bright/net/Protocol.go<|end_filename|> package net import "bright/serialization" type Protocol interface { GetTypeId() int32 Serialize(buf *serialization.ByteBuf) Deserialize(buf* serialization.ByteBuf) error } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_AnimatorControllerParameter_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_AnimatorControllerParameter_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.AnimatorControllerParameter(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.AnimatorControllerParameter), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Equals(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnimatorControllerParameter; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.Object>(false); var result = obj.Equals(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetHashCode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnimatorControllerParameter; { { var result = obj.GetHashCode(); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_nameHash(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnimatorControllerParameter; var result = obj.nameHash; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_type(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnimatorControllerParameter; var result = obj.type; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_type(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnimatorControllerParameter; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.type = (UnityEngine.AnimatorControllerParameterType)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_defaultFloat(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnimatorControllerParameter; var result = obj.defaultFloat; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_defaultFloat(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnimatorControllerParameter; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.defaultFloat = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_defaultInt(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnimatorControllerParameter; var result = obj.defaultInt; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_defaultInt(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnimatorControllerParameter; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.defaultInt = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_defaultBool(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnimatorControllerParameter; var result = obj.defaultBool; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_defaultBool(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnimatorControllerParameter; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.defaultBool = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "Equals", IsStatic = false}, M_Equals }, { new Puerts.MethodKey {Name = "GetHashCode", IsStatic = false}, M_GetHashCode }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"nameHash", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_nameHash, Setter = null} }, {"type", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_type, Setter = S_type} }, {"defaultFloat", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_defaultFloat, Setter = S_defaultFloat} }, {"defaultInt", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_defaultInt, Setter = S_defaultInt} }, {"defaultBool", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_defaultBool, Setter = S_defaultBool} }, } }; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_UI_GraphicRegistry_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_UI_GraphicRegistry_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.UI.GraphicRegistry constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_RegisterGraphicForCanvas(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<UnityEngine.Canvas>(false); var Arg1 = argHelper1.Get<UnityEngine.UI.Graphic>(false); UnityEngine.UI.GraphicRegistry.RegisterGraphicForCanvas(Arg0,Arg1); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_RegisterRaycastGraphicForCanvas(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<UnityEngine.Canvas>(false); var Arg1 = argHelper1.Get<UnityEngine.UI.Graphic>(false); UnityEngine.UI.GraphicRegistry.RegisterRaycastGraphicForCanvas(Arg0,Arg1); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_UnregisterGraphicForCanvas(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<UnityEngine.Canvas>(false); var Arg1 = argHelper1.Get<UnityEngine.UI.Graphic>(false); UnityEngine.UI.GraphicRegistry.UnregisterGraphicForCanvas(Arg0,Arg1); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_UnregisterRaycastGraphicForCanvas(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<UnityEngine.Canvas>(false); var Arg1 = argHelper1.Get<UnityEngine.UI.Graphic>(false); UnityEngine.UI.GraphicRegistry.UnregisterRaycastGraphicForCanvas(Arg0,Arg1); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetGraphicsForCanvas(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Canvas>(false); var result = UnityEngine.UI.GraphicRegistry.GetGraphicsForCanvas(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetRaycastableGraphicsForCanvas(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Canvas>(false); var result = UnityEngine.UI.GraphicRegistry.GetRaycastableGraphicsForCanvas(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_instance(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.UI.GraphicRegistry.instance; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "RegisterGraphicForCanvas", IsStatic = true}, F_RegisterGraphicForCanvas }, { new Puerts.MethodKey {Name = "RegisterRaycastGraphicForCanvas", IsStatic = true}, F_RegisterRaycastGraphicForCanvas }, { new Puerts.MethodKey {Name = "UnregisterGraphicForCanvas", IsStatic = true}, F_UnregisterGraphicForCanvas }, { new Puerts.MethodKey {Name = "UnregisterRaycastGraphicForCanvas", IsStatic = true}, F_UnregisterRaycastGraphicForCanvas }, { new Puerts.MethodKey {Name = "GetGraphicsForCanvas", IsStatic = true}, F_GetGraphicsForCanvas }, { new Puerts.MethodKey {Name = "GetRaycastableGraphicsForCanvas", IsStatic = true}, F_GetRaycastableGraphicsForCanvas }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"instance", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_instance, Setter = null} }, } }; } } } <|start_filename|>Projects/Lua_Unity_xlua_bin/Assets/Main.cs<|end_filename|> using System.Collections; using System.Collections.Generic; using UnityEngine; using XLua; public class Main : MonoBehaviour { // Start is called before the first frame update private LuaEnv _lua; public void Start() { _lua = new LuaEnv(); _lua.AddLoader(this.Loader); _lua.DoString("(require 'Main').Start()"); } public void Stop() { _lua.Dispose(); } private byte[] Loader(ref string luaModule) { return System.IO.File.ReadAllBytes(Application.dataPath + "/Lua/" + luaModule.Replace('.', '/') + ".lua"); } } <|start_filename|>Projects/GenerateDatas/convert_lua/error.TbCodeInfo/101.lua<|end_filename|> return { code = 101, key = "ROLE_CREATE_NAME_EMPTY", } <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/bonus/DropBonus.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.bonus { public sealed partial class DropBonus : bonus.Bonus { public DropBonus(ByteBuf _buf) : base(_buf) { Id = _buf.ReadInt(); } public DropBonus(int id ) : base() { this.Id = id; } public static DropBonus DeserializeDropBonus(ByteBuf _buf) { return new bonus.DropBonus(_buf); } public readonly int Id; public bonus.DropInfo Id_Ref; public const int ID = 1959868225; public override int GetTypeId() => ID; public override void Resolve(Dictionary<string, object> _tables) { base.Resolve(_tables); this.Id_Ref = (_tables["bonus.TbDrop"] as bonus.TbDrop).GetOrDefault(Id); OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); public override string ToString() { return "{ " + "Id:" + Id + "," + "}"; } } } <|start_filename|>Projects/Java_bin/src/main/gen/cfg/ai/SimpleParallel.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.ai; import bright.serialization.*; public final class SimpleParallel extends cfg.ai.ComposeNode { public SimpleParallel(ByteBuf _buf) { super(_buf); finishMode = cfg.ai.EFinishMode.valueOf(_buf.readInt()); mainTask = cfg.ai.Task.deserializeTask(_buf); backgroundNode = cfg.ai.FlowNode.deserializeFlowNode(_buf); } public SimpleParallel(int id, String node_name, java.util.ArrayList<cfg.ai.Decorator> decorators, java.util.ArrayList<cfg.ai.Service> services, cfg.ai.EFinishMode finish_mode, cfg.ai.Task main_task, cfg.ai.FlowNode background_node ) { super(id, node_name, decorators, services); this.finishMode = finish_mode; this.mainTask = main_task; this.backgroundNode = background_node; } public final cfg.ai.EFinishMode finishMode; public final cfg.ai.Task mainTask; public final cfg.ai.FlowNode backgroundNode; public static final int __ID__ = -1952582529; @Override public int getTypeId() { return __ID__; } @Override public void resolve(java.util.HashMap<String, Object> _tables) { super.resolve(_tables); if (mainTask != null) {mainTask.resolve(_tables);} if (backgroundNode != null) {backgroundNode.resolve(_tables);} } @Override public String toString() { return "{ " + "id:" + id + "," + "nodeName:" + nodeName + "," + "decorators:" + decorators + "," + "services:" + services + "," + "finishMode:" + finishMode + "," + "mainTask:" + mainTask + "," + "backgroundNode:" + backgroundNode + "," + "}"; } } <|start_filename|>Projects/Go_json/gen/src/cfg/cost.CostItem.go<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg import "errors" type CostCostItem struct { ItemId int32 Amount int32 } const TypeId_CostCostItem = -1249440351 func (*CostCostItem) GetTypeId() int32 { return -1249440351 } func (_v *CostCostItem)Deserialize(_buf map[string]interface{}) (err error) { { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["item_id"].(float64); !_ok_ { err = errors.New("item_id error"); return }; _v.ItemId = int32(_tempNum_) } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["amount"].(float64); !_ok_ { err = errors.New("amount error"); return }; _v.Amount = int32(_tempNum_) } return } func DeserializeCostCostItem(_buf map[string]interface{}) (*CostCostItem, error) { v := &CostCostItem{} if err := v.Deserialize(_buf); err == nil { return v, nil } else { return nil, err } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_LayerMask_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_LayerMask_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.LayerMask constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_LayerToName(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); var result = UnityEngine.LayerMask.LayerToName(Arg0); Puerts.PuertsDLL.ReturnString(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_NameToLayer(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetString(false); var result = UnityEngine.LayerMask.NameToLayer(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetMask(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetParams<string>(info, 0, paramLen); var result = UnityEngine.LayerMask.GetMask(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_value(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.LayerMask)Puerts.Utils.GetSelf((int)data, self); var result = obj.value; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_value(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.LayerMask)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.value = argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "LayerToName", IsStatic = true}, F_LayerToName }, { new Puerts.MethodKey {Name = "NameToLayer", IsStatic = true}, F_NameToLayer }, { new Puerts.MethodKey {Name = "GetMask", IsStatic = true}, F_GetMask }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"value", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_value, Setter = S_value} }, } }; } } } <|start_filename|>Projects/Csharp_CustomTemplate_EncryptMemory/Assets/Scripts/ConfigAttribute.cs<|end_filename|> using System; namespace Scripts { [AttributeUsage(AttributeTargets.Class)] public class ConfigAttribute : Attribute { } } <|start_filename|>Projects/Java_bin/src/main/gen/cfg/bonus/DropBonus.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.bonus; import bright.serialization.*; public final class DropBonus extends cfg.bonus.Bonus { public DropBonus(ByteBuf _buf) { super(_buf); id = _buf.readInt(); } public DropBonus(int id ) { super(); this.id = id; } public final int id; public cfg.bonus.DropInfo id_Ref; public static final int __ID__ = 1959868225; @Override public int getTypeId() { return __ID__; } @Override public void resolve(java.util.HashMap<String, Object> _tables) { super.resolve(_tables); this.id_Ref = ((cfg.bonus.TbDrop)_tables.get("bonus.TbDrop")).get(id); } @Override public String toString() { return "{ " + "id:" + id + "," + "}"; } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_Terrain_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_Terrain_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.Terrain(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.Terrain), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetClosestReflectionProbes(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Terrain; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.Collections.Generic.List<UnityEngine.Rendering.ReflectionProbeBlendInfo>>(false); obj.GetClosestReflectionProbes(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SampleHeight(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Terrain; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var result = obj.SampleHeight(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_AddTreeInstance(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Terrain; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.TreeInstance>(false); obj.AddTreeInstance(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetNeighbors(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Terrain; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); { var Arg0 = argHelper0.Get<UnityEngine.Terrain>(false); var Arg1 = argHelper1.Get<UnityEngine.Terrain>(false); var Arg2 = argHelper2.Get<UnityEngine.Terrain>(false); var Arg3 = argHelper3.Get<UnityEngine.Terrain>(false); obj.SetNeighbors(Arg0,Arg1,Arg2,Arg3); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetPosition(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Terrain; { { var result = obj.GetPosition(); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Flush(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Terrain; { { obj.Flush(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetSplatMaterialPropertyBlock(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Terrain; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.MaterialPropertyBlock>(false); obj.SetSplatMaterialPropertyBlock(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetSplatMaterialPropertyBlock(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Terrain; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.MaterialPropertyBlock>(false); obj.GetSplatMaterialPropertyBlock(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_SetConnectivityDirty(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { { UnityEngine.Terrain.SetConnectivityDirty(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_CreateTerrainGameObject(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.TerrainData>(false); var result = UnityEngine.Terrain.CreateTerrainGameObject(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_terrainData(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Terrain; var result = obj.terrainData; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_terrainData(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Terrain; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.terrainData = argHelper.Get<UnityEngine.TerrainData>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_treeDistance(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Terrain; var result = obj.treeDistance; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_treeDistance(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Terrain; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.treeDistance = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_treeBillboardDistance(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Terrain; var result = obj.treeBillboardDistance; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_treeBillboardDistance(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Terrain; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.treeBillboardDistance = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_treeCrossFadeLength(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Terrain; var result = obj.treeCrossFadeLength; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_treeCrossFadeLength(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Terrain; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.treeCrossFadeLength = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_treeMaximumFullLODCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Terrain; var result = obj.treeMaximumFullLODCount; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_treeMaximumFullLODCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Terrain; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.treeMaximumFullLODCount = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_detailObjectDistance(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Terrain; var result = obj.detailObjectDistance; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_detailObjectDistance(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Terrain; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.detailObjectDistance = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_detailObjectDensity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Terrain; var result = obj.detailObjectDensity; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_detailObjectDensity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Terrain; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.detailObjectDensity = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_heightmapPixelError(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Terrain; var result = obj.heightmapPixelError; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_heightmapPixelError(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Terrain; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.heightmapPixelError = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_heightmapMaximumLOD(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Terrain; var result = obj.heightmapMaximumLOD; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_heightmapMaximumLOD(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Terrain; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.heightmapMaximumLOD = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_basemapDistance(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Terrain; var result = obj.basemapDistance; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_basemapDistance(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Terrain; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.basemapDistance = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_lightmapIndex(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Terrain; var result = obj.lightmapIndex; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_lightmapIndex(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Terrain; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.lightmapIndex = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_realtimeLightmapIndex(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Terrain; var result = obj.realtimeLightmapIndex; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_realtimeLightmapIndex(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Terrain; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.realtimeLightmapIndex = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_lightmapScaleOffset(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Terrain; var result = obj.lightmapScaleOffset; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_lightmapScaleOffset(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Terrain; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.lightmapScaleOffset = argHelper.Get<UnityEngine.Vector4>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_realtimeLightmapScaleOffset(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Terrain; var result = obj.realtimeLightmapScaleOffset; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_realtimeLightmapScaleOffset(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Terrain; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.realtimeLightmapScaleOffset = argHelper.Get<UnityEngine.Vector4>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_freeUnusedRenderingResources(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Terrain; var result = obj.freeUnusedRenderingResources; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_freeUnusedRenderingResources(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Terrain; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.freeUnusedRenderingResources = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_shadowCastingMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Terrain; var result = obj.shadowCastingMode; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_shadowCastingMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Terrain; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.shadowCastingMode = (UnityEngine.Rendering.ShadowCastingMode)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_reflectionProbeUsage(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Terrain; var result = obj.reflectionProbeUsage; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_reflectionProbeUsage(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Terrain; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.reflectionProbeUsage = (UnityEngine.Rendering.ReflectionProbeUsage)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_materialTemplate(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Terrain; var result = obj.materialTemplate; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_materialTemplate(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Terrain; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.materialTemplate = argHelper.Get<UnityEngine.Material>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_drawHeightmap(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Terrain; var result = obj.drawHeightmap; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_drawHeightmap(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Terrain; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.drawHeightmap = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_allowAutoConnect(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Terrain; var result = obj.allowAutoConnect; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_allowAutoConnect(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Terrain; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.allowAutoConnect = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_groupingID(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Terrain; var result = obj.groupingID; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_groupingID(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Terrain; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.groupingID = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_drawInstanced(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Terrain; var result = obj.drawInstanced; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_drawInstanced(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Terrain; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.drawInstanced = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_normalmapTexture(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Terrain; var result = obj.normalmapTexture; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_drawTreesAndFoliage(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Terrain; var result = obj.drawTreesAndFoliage; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_drawTreesAndFoliage(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Terrain; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.drawTreesAndFoliage = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_patchBoundsMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Terrain; var result = obj.patchBoundsMultiplier; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_patchBoundsMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Terrain; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.patchBoundsMultiplier = argHelper.Get<UnityEngine.Vector3>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_treeLODBiasMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Terrain; var result = obj.treeLODBiasMultiplier; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_treeLODBiasMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Terrain; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.treeLODBiasMultiplier = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_collectDetailPatches(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Terrain; var result = obj.collectDetailPatches; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_collectDetailPatches(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Terrain; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.collectDetailPatches = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_editorRenderFlags(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Terrain; var result = obj.editorRenderFlags; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_editorRenderFlags(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Terrain; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.editorRenderFlags = (UnityEngine.TerrainRenderFlags)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_preserveTreePrototypeLayers(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Terrain; var result = obj.preserveTreePrototypeLayers; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_preserveTreePrototypeLayers(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Terrain; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.preserveTreePrototypeLayers = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_heightmapFormat(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Terrain.heightmapFormat; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_heightmapTextureFormat(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Terrain.heightmapTextureFormat; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_heightmapRenderTextureFormat(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Terrain.heightmapRenderTextureFormat; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_normalmapFormat(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Terrain.normalmapFormat; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_normalmapTextureFormat(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Terrain.normalmapTextureFormat; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_normalmapRenderTextureFormat(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Terrain.normalmapRenderTextureFormat; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_holesFormat(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Terrain.holesFormat; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_holesRenderTextureFormat(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Terrain.holesRenderTextureFormat; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_compressedHolesFormat(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Terrain.compressedHolesFormat; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_compressedHolesTextureFormat(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Terrain.compressedHolesTextureFormat; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_activeTerrain(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Terrain.activeTerrain; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_activeTerrains(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Terrain.activeTerrains; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_leftNeighbor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Terrain; var result = obj.leftNeighbor; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_rightNeighbor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Terrain; var result = obj.rightNeighbor; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_topNeighbor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Terrain; var result = obj.topNeighbor; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_bottomNeighbor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Terrain; var result = obj.bottomNeighbor; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_renderingLayerMask(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Terrain; var result = obj.renderingLayerMask; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_renderingLayerMask(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Terrain; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.renderingLayerMask = argHelper.GetUInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "GetClosestReflectionProbes", IsStatic = false}, M_GetClosestReflectionProbes }, { new Puerts.MethodKey {Name = "SampleHeight", IsStatic = false}, M_SampleHeight }, { new Puerts.MethodKey {Name = "AddTreeInstance", IsStatic = false}, M_AddTreeInstance }, { new Puerts.MethodKey {Name = "SetNeighbors", IsStatic = false}, M_SetNeighbors }, { new Puerts.MethodKey {Name = "GetPosition", IsStatic = false}, M_GetPosition }, { new Puerts.MethodKey {Name = "Flush", IsStatic = false}, M_Flush }, { new Puerts.MethodKey {Name = "SetSplatMaterialPropertyBlock", IsStatic = false}, M_SetSplatMaterialPropertyBlock }, { new Puerts.MethodKey {Name = "GetSplatMaterialPropertyBlock", IsStatic = false}, M_GetSplatMaterialPropertyBlock }, { new Puerts.MethodKey {Name = "SetConnectivityDirty", IsStatic = true}, F_SetConnectivityDirty }, { new Puerts.MethodKey {Name = "CreateTerrainGameObject", IsStatic = true}, F_CreateTerrainGameObject }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"terrainData", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_terrainData, Setter = S_terrainData} }, {"treeDistance", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_treeDistance, Setter = S_treeDistance} }, {"treeBillboardDistance", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_treeBillboardDistance, Setter = S_treeBillboardDistance} }, {"treeCrossFadeLength", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_treeCrossFadeLength, Setter = S_treeCrossFadeLength} }, {"treeMaximumFullLODCount", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_treeMaximumFullLODCount, Setter = S_treeMaximumFullLODCount} }, {"detailObjectDistance", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_detailObjectDistance, Setter = S_detailObjectDistance} }, {"detailObjectDensity", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_detailObjectDensity, Setter = S_detailObjectDensity} }, {"heightmapPixelError", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_heightmapPixelError, Setter = S_heightmapPixelError} }, {"heightmapMaximumLOD", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_heightmapMaximumLOD, Setter = S_heightmapMaximumLOD} }, {"basemapDistance", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_basemapDistance, Setter = S_basemapDistance} }, {"lightmapIndex", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_lightmapIndex, Setter = S_lightmapIndex} }, {"realtimeLightmapIndex", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_realtimeLightmapIndex, Setter = S_realtimeLightmapIndex} }, {"lightmapScaleOffset", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_lightmapScaleOffset, Setter = S_lightmapScaleOffset} }, {"realtimeLightmapScaleOffset", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_realtimeLightmapScaleOffset, Setter = S_realtimeLightmapScaleOffset} }, {"freeUnusedRenderingResources", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_freeUnusedRenderingResources, Setter = S_freeUnusedRenderingResources} }, {"shadowCastingMode", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_shadowCastingMode, Setter = S_shadowCastingMode} }, {"reflectionProbeUsage", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_reflectionProbeUsage, Setter = S_reflectionProbeUsage} }, {"materialTemplate", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_materialTemplate, Setter = S_materialTemplate} }, {"drawHeightmap", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_drawHeightmap, Setter = S_drawHeightmap} }, {"allowAutoConnect", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_allowAutoConnect, Setter = S_allowAutoConnect} }, {"groupingID", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_groupingID, Setter = S_groupingID} }, {"drawInstanced", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_drawInstanced, Setter = S_drawInstanced} }, {"normalmapTexture", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_normalmapTexture, Setter = null} }, {"drawTreesAndFoliage", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_drawTreesAndFoliage, Setter = S_drawTreesAndFoliage} }, {"patchBoundsMultiplier", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_patchBoundsMultiplier, Setter = S_patchBoundsMultiplier} }, {"treeLODBiasMultiplier", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_treeLODBiasMultiplier, Setter = S_treeLODBiasMultiplier} }, {"collectDetailPatches", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_collectDetailPatches, Setter = S_collectDetailPatches} }, {"editorRenderFlags", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_editorRenderFlags, Setter = S_editorRenderFlags} }, {"preserveTreePrototypeLayers", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_preserveTreePrototypeLayers, Setter = S_preserveTreePrototypeLayers} }, {"heightmapFormat", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_heightmapFormat, Setter = null} }, {"heightmapTextureFormat", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_heightmapTextureFormat, Setter = null} }, {"heightmapRenderTextureFormat", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_heightmapRenderTextureFormat, Setter = null} }, {"normalmapFormat", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_normalmapFormat, Setter = null} }, {"normalmapTextureFormat", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_normalmapTextureFormat, Setter = null} }, {"normalmapRenderTextureFormat", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_normalmapRenderTextureFormat, Setter = null} }, {"holesFormat", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_holesFormat, Setter = null} }, {"holesRenderTextureFormat", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_holesRenderTextureFormat, Setter = null} }, {"compressedHolesFormat", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_compressedHolesFormat, Setter = null} }, {"compressedHolesTextureFormat", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_compressedHolesTextureFormat, Setter = null} }, {"activeTerrain", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_activeTerrain, Setter = null} }, {"activeTerrains", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_activeTerrains, Setter = null} }, {"leftNeighbor", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_leftNeighbor, Setter = null} }, {"rightNeighbor", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_rightNeighbor, Setter = null} }, {"topNeighbor", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_topNeighbor, Setter = null} }, {"bottomNeighbor", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_bottomNeighbor, Setter = null} }, {"renderingLayerMask", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_renderingLayerMask, Setter = S_renderingLayerMask} }, } }; } } } <|start_filename|>Projects/Go_json/gen/src/cfg/test.DateTimeRange.go<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg import "errors" type TestDateTimeRange struct { StartTime int32 EndTime int32 } const TypeId_TestDateTimeRange = 495315430 func (*TestDateTimeRange) GetTypeId() int32 { return 495315430 } func (_v *TestDateTimeRange)Deserialize(_buf map[string]interface{}) (err error) { { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["start_time"].(float64); !_ok_ { err = errors.New("start_time error"); return }; _v.StartTime = int32(_tempNum_) } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["end_time"].(float64); !_ok_ { err = errors.New("end_time error"); return }; _v.EndTime = int32(_tempNum_) } return } func DeserializeTestDateTimeRange(_buf map[string]interface{}) (*TestDateTimeRange, error) { v := &TestDateTimeRange{} if err := v.Deserialize(_buf); err == nil { return v, nil } else { return nil, err } } <|start_filename|>Projects/DataTemplates/template_lua2/test_tbmultirowtitle.lua<|end_filename|> -- test.TbMultiRowTitle return { [1] = { id=1, name="xxx", x1= { y2= { z2=2, z3=3, }, y3=4, }, x2= { { z2=1, z3=2, }, { z2=3, z3=4, }, }, x3= { { z2=1, z3=2, }, { z2=3, z3=4, }, }, x4= { { z2=12, z3=13, }, { z2=22, z3=23, }, { z2=32, z3=33, }, }, }, [11] = { id=11, name="yyy", x1= { y2= { z2=12, z3=13, }, y3=14, }, x2_0= { z2=1, z3=2, }, x2= { { z2=11, z3=12, }, { z2=13, z3=14, }, }, x3= { { z2=11, z3=12, }, { z2=13, z3=14, }, }, x4= { { z2=112, z3=113, }, { z2=122, z3=123, }, { z2=132, z3=133, }, }, }, } <|start_filename|>Projects/DataTemplates/template_lua/test_tbtestsize.lua<|end_filename|> return { [1] = {id=1,x1={1,2,},x2={3,4,},x3={5,6,},x4={[1]=2,[3]=4,},}, } <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/blueprint/Interface.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.blueprint { public sealed partial class Interface : blueprint.Clazz { public Interface(ByteBuf _buf) : base(_buf) { } public Interface(string name, string desc, System.Collections.Generic.List<blueprint.Clazz> parents, System.Collections.Generic.List<blueprint.Method> methods ) : base(name,desc,parents,methods) { } public static Interface DeserializeInterface(ByteBuf _buf) { return new blueprint.Interface(_buf); } public const int ID = 2114170750; public override int GetTypeId() => ID; public override void Resolve(Dictionary<string, object> _tables) { base.Resolve(_tables); OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); public override string ToString() { return "{ " + "Name:" + Name + "," + "Desc:" + Desc + "," + "Parents:" + Bright.Common.StringUtil.CollectionToString(Parents) + "," + "Methods:" + Bright.Common.StringUtil.CollectionToString(Methods) + "," + "}"; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_GUISkin_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_GUISkin_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.GUISkin(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.GUISkin), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetStyle(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUISkin; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetString(false); var result = obj.GetStyle(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_FindStyle(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUISkin; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetString(false); var result = obj.FindStyle(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetEnumerator(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUISkin; { { var result = obj.GetEnumerator(); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_font(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUISkin; var result = obj.font; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_font(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUISkin; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.font = argHelper.Get<UnityEngine.Font>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_box(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUISkin; var result = obj.box; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_box(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUISkin; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.box = argHelper.Get<UnityEngine.GUIStyle>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_label(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUISkin; var result = obj.label; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_label(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUISkin; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.label = argHelper.Get<UnityEngine.GUIStyle>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_textField(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUISkin; var result = obj.textField; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_textField(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUISkin; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.textField = argHelper.Get<UnityEngine.GUIStyle>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_textArea(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUISkin; var result = obj.textArea; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_textArea(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUISkin; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.textArea = argHelper.Get<UnityEngine.GUIStyle>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_button(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUISkin; var result = obj.button; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_button(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUISkin; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.button = argHelper.Get<UnityEngine.GUIStyle>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_toggle(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUISkin; var result = obj.toggle; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_toggle(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUISkin; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.toggle = argHelper.Get<UnityEngine.GUIStyle>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_window(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUISkin; var result = obj.window; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_window(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUISkin; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.window = argHelper.Get<UnityEngine.GUIStyle>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_horizontalSlider(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUISkin; var result = obj.horizontalSlider; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_horizontalSlider(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUISkin; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.horizontalSlider = argHelper.Get<UnityEngine.GUIStyle>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_horizontalSliderThumb(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUISkin; var result = obj.horizontalSliderThumb; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_horizontalSliderThumb(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUISkin; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.horizontalSliderThumb = argHelper.Get<UnityEngine.GUIStyle>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_verticalSlider(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUISkin; var result = obj.verticalSlider; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_verticalSlider(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUISkin; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.verticalSlider = argHelper.Get<UnityEngine.GUIStyle>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_verticalSliderThumb(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUISkin; var result = obj.verticalSliderThumb; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_verticalSliderThumb(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUISkin; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.verticalSliderThumb = argHelper.Get<UnityEngine.GUIStyle>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_horizontalScrollbar(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUISkin; var result = obj.horizontalScrollbar; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_horizontalScrollbar(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUISkin; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.horizontalScrollbar = argHelper.Get<UnityEngine.GUIStyle>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_horizontalScrollbarThumb(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUISkin; var result = obj.horizontalScrollbarThumb; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_horizontalScrollbarThumb(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUISkin; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.horizontalScrollbarThumb = argHelper.Get<UnityEngine.GUIStyle>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_horizontalScrollbarLeftButton(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUISkin; var result = obj.horizontalScrollbarLeftButton; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_horizontalScrollbarLeftButton(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUISkin; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.horizontalScrollbarLeftButton = argHelper.Get<UnityEngine.GUIStyle>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_horizontalScrollbarRightButton(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUISkin; var result = obj.horizontalScrollbarRightButton; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_horizontalScrollbarRightButton(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUISkin; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.horizontalScrollbarRightButton = argHelper.Get<UnityEngine.GUIStyle>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_verticalScrollbar(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUISkin; var result = obj.verticalScrollbar; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_verticalScrollbar(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUISkin; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.verticalScrollbar = argHelper.Get<UnityEngine.GUIStyle>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_verticalScrollbarThumb(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUISkin; var result = obj.verticalScrollbarThumb; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_verticalScrollbarThumb(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUISkin; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.verticalScrollbarThumb = argHelper.Get<UnityEngine.GUIStyle>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_verticalScrollbarUpButton(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUISkin; var result = obj.verticalScrollbarUpButton; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_verticalScrollbarUpButton(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUISkin; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.verticalScrollbarUpButton = argHelper.Get<UnityEngine.GUIStyle>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_verticalScrollbarDownButton(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUISkin; var result = obj.verticalScrollbarDownButton; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_verticalScrollbarDownButton(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUISkin; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.verticalScrollbarDownButton = argHelper.Get<UnityEngine.GUIStyle>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_scrollView(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUISkin; var result = obj.scrollView; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_scrollView(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUISkin; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.scrollView = argHelper.Get<UnityEngine.GUIStyle>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_customStyles(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUISkin; var result = obj.customStyles; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_customStyles(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUISkin; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.customStyles = argHelper.Get<UnityEngine.GUIStyle[]>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_settings(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUISkin; var result = obj.settings; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "GetStyle", IsStatic = false}, M_GetStyle }, { new Puerts.MethodKey {Name = "FindStyle", IsStatic = false}, M_FindStyle }, { new Puerts.MethodKey {Name = "GetEnumerator", IsStatic = false}, M_GetEnumerator }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"font", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_font, Setter = S_font} }, {"box", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_box, Setter = S_box} }, {"label", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_label, Setter = S_label} }, {"textField", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_textField, Setter = S_textField} }, {"textArea", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_textArea, Setter = S_textArea} }, {"button", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_button, Setter = S_button} }, {"toggle", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_toggle, Setter = S_toggle} }, {"window", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_window, Setter = S_window} }, {"horizontalSlider", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_horizontalSlider, Setter = S_horizontalSlider} }, {"horizontalSliderThumb", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_horizontalSliderThumb, Setter = S_horizontalSliderThumb} }, {"verticalSlider", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_verticalSlider, Setter = S_verticalSlider} }, {"verticalSliderThumb", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_verticalSliderThumb, Setter = S_verticalSliderThumb} }, {"horizontalScrollbar", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_horizontalScrollbar, Setter = S_horizontalScrollbar} }, {"horizontalScrollbarThumb", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_horizontalScrollbarThumb, Setter = S_horizontalScrollbarThumb} }, {"horizontalScrollbarLeftButton", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_horizontalScrollbarLeftButton, Setter = S_horizontalScrollbarLeftButton} }, {"horizontalScrollbarRightButton", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_horizontalScrollbarRightButton, Setter = S_horizontalScrollbarRightButton} }, {"verticalScrollbar", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_verticalScrollbar, Setter = S_verticalScrollbar} }, {"verticalScrollbarThumb", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_verticalScrollbarThumb, Setter = S_verticalScrollbarThumb} }, {"verticalScrollbarUpButton", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_verticalScrollbarUpButton, Setter = S_verticalScrollbarUpButton} }, {"verticalScrollbarDownButton", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_verticalScrollbarDownButton, Setter = S_verticalScrollbarDownButton} }, {"scrollView", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_scrollView, Setter = S_scrollView} }, {"customStyles", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_customStyles, Setter = S_customStyles} }, {"settings", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_settings, Setter = null} }, } }; } } } <|start_filename|>Projects/Java_bin/src/main/gen/cfg/test/MultiIndexList.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.test; import bright.serialization.*; public final class MultiIndexList { public MultiIndexList(ByteBuf _buf) { id1 = _buf.readInt(); id2 = _buf.readLong(); id3 = _buf.readString(); num = _buf.readInt(); desc = _buf.readString(); } public MultiIndexList(int id1, long id2, String id3, int num, String desc ) { this.id1 = id1; this.id2 = id2; this.id3 = id3; this.num = num; this.desc = desc; } public final int id1; public final long id2; public final String id3; public final int num; public final String desc; public void resolve(java.util.HashMap<String, Object> _tables) { } @Override public String toString() { return "{ " + "id1:" + id1 + "," + "id2:" + id2 + "," + "id3:" + id3 + "," + "num:" + num + "," + "desc:" + desc + "," + "}"; } } <|start_filename|>ProtoProjects/Typescript_Unity_Puerts/TsScripts/package.json<|end_filename|> { "name": "tsscripts", "version": "1.0.0", "description": "ts project", "scripts": { "build": "tsc -p tsconfig.json", "postbuild": "node copyJsFile.js output ../Assets/StreamingAssets/JsScripts", "watch": "watch 'npm run build' src" }, "devDependencies": { "@types/dotenv": "^8.2.0", "fs-extra": "^10.0.0", "shelljs": "^0.8.4", "typescript": "^4.3.4" } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_Hash128_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_Hash128_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetUInt32(false); var Arg1 = argHelper1.GetUInt32(false); var Arg2 = argHelper2.GetUInt32(false); var Arg3 = argHelper3.GetUInt32(false); var result = new UnityEngine.Hash128(Arg0,Arg1,Arg2,Arg3); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.Hash128), result); } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.BigInt, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.BigInt, null, false, false)) { var Arg0 = argHelper0.GetUInt64(false); var Arg1 = argHelper1.GetUInt64(false); var result = new UnityEngine.Hash128(Arg0,Arg1); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.Hash128), result); } } if (paramLen == 0) { { var result = new UnityEngine.Hash128(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.Hash128), result); } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.Hash128 constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_CompareTo(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Hash128)Puerts.Utils.GetSelf((int)data, self); if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Hash128), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Hash128>(false); var result = obj.CompareTo(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Any, typeof(System.Object), false, false)) { var Arg0 = argHelper0.Get<System.Object>(false); var result = obj.CompareTo(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to CompareTo"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ToString(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Hash128)Puerts.Utils.GetSelf((int)data, self); { { var result = obj.ToString(); Puerts.PuertsDLL.ReturnString(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_Parse(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetString(false); var result = UnityEngine.Hash128.Parse(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_Compute(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var result = UnityEngine.Hash128.Compute(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var result = UnityEngine.Hash128.Compute(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetFloat(false); var result = UnityEngine.Hash128.Compute(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to Compute"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Append(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Hash128)Puerts.Utils.GetSelf((int)data, self); if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); obj.Append(Arg0); Puerts.Utils.SetSelf((int)data, self, obj); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); obj.Append(Arg0); Puerts.Utils.SetSelf((int)data, self, obj); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetFloat(false); obj.Append(Arg0); Puerts.Utils.SetSelf((int)data, self, obj); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to Append"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Equals(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Hash128)Puerts.Utils.GetSelf((int)data, self); if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.Any, typeof(System.Object), false, false)) { var Arg0 = argHelper0.Get<System.Object>(false); var result = obj.Equals(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Hash128), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Hash128>(false); var result = obj.Equals(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to Equals"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetHashCode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Hash128)Puerts.Utils.GetSelf((int)data, self); { { var result = obj.GetHashCode(); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_isValid(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Hash128)Puerts.Utils.GetSelf((int)data, self); var result = obj.isValid; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void O_op_Equality(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var arg0 = argHelper0.Get<UnityEngine.Hash128>(false); var arg1 = argHelper1.Get<UnityEngine.Hash128>(false); var result = arg0 == arg1; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void O_op_Inequality(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var arg0 = argHelper0.Get<UnityEngine.Hash128>(false); var arg1 = argHelper1.Get<UnityEngine.Hash128>(false); var result = arg0 != arg1; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void O_op_LessThan(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var arg0 = argHelper0.Get<UnityEngine.Hash128>(false); var arg1 = argHelper1.Get<UnityEngine.Hash128>(false); var result = arg0 < arg1; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void O_op_GreaterThan(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var arg0 = argHelper0.Get<UnityEngine.Hash128>(false); var arg1 = argHelper1.Get<UnityEngine.Hash128>(false); var result = arg0 > arg1; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "CompareTo", IsStatic = false}, M_CompareTo }, { new Puerts.MethodKey {Name = "ToString", IsStatic = false}, M_ToString }, { new Puerts.MethodKey {Name = "Parse", IsStatic = true}, F_Parse }, { new Puerts.MethodKey {Name = "Compute", IsStatic = true}, F_Compute }, { new Puerts.MethodKey {Name = "Append", IsStatic = false}, M_Append }, { new Puerts.MethodKey {Name = "Equals", IsStatic = false}, M_Equals }, { new Puerts.MethodKey {Name = "GetHashCode", IsStatic = false}, M_GetHashCode }, { new Puerts.MethodKey {Name = "op_Equality", IsStatic = true}, O_op_Equality}, { new Puerts.MethodKey {Name = "op_Inequality", IsStatic = true}, O_op_Inequality}, { new Puerts.MethodKey {Name = "op_LessThan", IsStatic = true}, O_op_LessThan}, { new Puerts.MethodKey {Name = "op_GreaterThan", IsStatic = true}, O_op_GreaterThan}, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"isValid", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_isValid, Setter = null} }, } }; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_TerrainLayer_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_TerrainLayer_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.TerrainLayer(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.TerrainLayer), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_diffuseTexture(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TerrainLayer; var result = obj.diffuseTexture; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_diffuseTexture(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TerrainLayer; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.diffuseTexture = argHelper.Get<UnityEngine.Texture2D>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_normalMapTexture(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TerrainLayer; var result = obj.normalMapTexture; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_normalMapTexture(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TerrainLayer; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.normalMapTexture = argHelper.Get<UnityEngine.Texture2D>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_maskMapTexture(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TerrainLayer; var result = obj.maskMapTexture; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_maskMapTexture(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TerrainLayer; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.maskMapTexture = argHelper.Get<UnityEngine.Texture2D>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_tileSize(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TerrainLayer; var result = obj.tileSize; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_tileSize(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TerrainLayer; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.tileSize = argHelper.Get<UnityEngine.Vector2>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_tileOffset(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TerrainLayer; var result = obj.tileOffset; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_tileOffset(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TerrainLayer; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.tileOffset = argHelper.Get<UnityEngine.Vector2>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_specular(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TerrainLayer; var result = obj.specular; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_specular(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TerrainLayer; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.specular = argHelper.Get<UnityEngine.Color>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_metallic(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TerrainLayer; var result = obj.metallic; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_metallic(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TerrainLayer; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.metallic = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_smoothness(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TerrainLayer; var result = obj.smoothness; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_smoothness(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TerrainLayer; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.smoothness = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_normalScale(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TerrainLayer; var result = obj.normalScale; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_normalScale(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TerrainLayer; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.normalScale = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_diffuseRemapMin(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TerrainLayer; var result = obj.diffuseRemapMin; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_diffuseRemapMin(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TerrainLayer; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.diffuseRemapMin = argHelper.Get<UnityEngine.Vector4>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_diffuseRemapMax(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TerrainLayer; var result = obj.diffuseRemapMax; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_diffuseRemapMax(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TerrainLayer; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.diffuseRemapMax = argHelper.Get<UnityEngine.Vector4>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_maskMapRemapMin(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TerrainLayer; var result = obj.maskMapRemapMin; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_maskMapRemapMin(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TerrainLayer; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.maskMapRemapMin = argHelper.Get<UnityEngine.Vector4>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_maskMapRemapMax(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TerrainLayer; var result = obj.maskMapRemapMax; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_maskMapRemapMax(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TerrainLayer; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.maskMapRemapMax = argHelper.Get<UnityEngine.Vector4>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"diffuseTexture", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_diffuseTexture, Setter = S_diffuseTexture} }, {"normalMapTexture", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_normalMapTexture, Setter = S_normalMapTexture} }, {"maskMapTexture", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_maskMapTexture, Setter = S_maskMapTexture} }, {"tileSize", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_tileSize, Setter = S_tileSize} }, {"tileOffset", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_tileOffset, Setter = S_tileOffset} }, {"specular", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_specular, Setter = S_specular} }, {"metallic", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_metallic, Setter = S_metallic} }, {"smoothness", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_smoothness, Setter = S_smoothness} }, {"normalScale", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_normalScale, Setter = S_normalScale} }, {"diffuseRemapMin", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_diffuseRemapMin, Setter = S_diffuseRemapMin} }, {"diffuseRemapMax", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_diffuseRemapMax, Setter = S_diffuseRemapMax} }, {"maskMapRemapMin", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_maskMapRemapMin, Setter = S_maskMapRemapMin} }, {"maskMapRemapMax", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_maskMapRemapMax, Setter = S_maskMapRemapMax} }, } }; } } } <|start_filename|>Projects/java_json/src/gen/cfg/test/DateTimeRange.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.test; import com.google.gson.JsonElement; import com.google.gson.JsonObject; public final class DateTimeRange { public DateTimeRange(JsonObject __json__) { startTime = __json__.get("start_time").getAsInt(); endTime = __json__.get("end_time").getAsInt(); } public DateTimeRange(int start_time, int end_time ) { this.startTime = start_time; this.endTime = end_time; } public static DateTimeRange deserializeDateTimeRange(JsonObject __json__) { return new DateTimeRange(__json__); } public final int startTime; public final int endTime; public void resolve(java.util.HashMap<String, Object> _tables) { } @Override public String toString() { return "{ " + "startTime:" + startTime + "," + "endTime:" + endTime + "," + "}"; } } <|start_filename|>Projects/Csharp_DotNet5_json_ExportServer/Gen/test/DemoE2.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; using System.Text.Json; namespace cfg.test { public sealed class DemoE2 : Bright.Config.BeanBase { public DemoE2(JsonElement _json) { { if (_json.TryGetProperty("y1", out var _j) && _j.ValueKind != JsonValueKind.Null) { Y1 = _j.GetInt32(); } else { Y1 = null; } } Y2 = _json.GetProperty("y2").GetBoolean(); } public DemoE2(int? y1, bool y2 ) { this.Y1 = y1; this.Y2 = y2; } public static DemoE2 DeserializeDemoE2(JsonElement _json) { return new test.DemoE2(_json); } public int? Y1 { get; private set; } public bool Y2 { get; private set; } public const int __ID__ = -2138341716; public override int GetTypeId() => __ID__; public void Resolve(Dictionary<string, object> _tables) { } public void TranslateText(System.Func<string, string, string> translator) { } public override string ToString() { return "{ " + "Y1:" + Y1 + "," + "Y2:" + Y2 + "," + "}"; } } } <|start_filename|>Projects/Csharp_CustomTemplate_EncryptMemory/Assets/Scripts/EncryptTypes.cs<|end_filename|> using System; namespace Scripts { public abstract class EncryptTypeBase<T, KVType, DType> where T : struct where KVType : struct where DType : EncryptTypeBase<T, KVType, DType>, new() { private static readonly int _arraySize = 3; private static KVType _key; private static bool _isInited; private KVType[] _values; private int _index; protected abstract KVType GetInitKey(int seed); protected abstract T DecodeValue(KVType value, KVType key); protected abstract KVType EncodeValue(T v, KVType key); public override bool Equals(object obj) => base.Equals(obj); public override int GetHashCode() => GetValue().GetHashCode(); public override string ToString() => GetValue().ToString(); public EncryptTypeBase() { _values = new KVType[_arraySize]; _index = 0; if(!_isInited) { Random rand = new Random(); int seed = rand.Next(1, int.MaxValue); _key = GetInitKey(seed); _isInited = true; } } public T GetValue() { T v = DecodeValue(_key, _values[_index]); return v; } public void SetValue(T v) { if(++_index == _arraySize) _index = 0; _values[_index] = EncodeValue(v, _key); } protected static DType Box(T v) { DType d = new DType(); d.SetValue(v); return d; } protected static T Unbox(DType d) { if(d.Equals(null)) return default(T); return d.GetValue(); } } public class EncryptByte : EncryptTypeBase<byte, byte, EncryptByte> { protected override byte GetInitKey(int rand) => (byte) rand; protected override byte DecodeValue(byte value, byte key) => (byte) (value ^ key); protected override byte EncodeValue(byte v, byte key) => (byte) (v ^ key); public static implicit operator EncryptByte(byte v) => Box(v); public static implicit operator byte(EncryptByte d) => Unbox(d); public int CompareTo(EncryptByte other) => GetValue().CompareTo(other.GetValue()); } public class EncryptSByte : EncryptTypeBase<sbyte, sbyte, EncryptSByte> { protected override sbyte GetInitKey(int rand) => (sbyte) rand; protected override sbyte DecodeValue(sbyte value, sbyte key) => (sbyte) (value ^ key); protected override sbyte EncodeValue(sbyte v, sbyte key) => (sbyte) (v ^ key); public static implicit operator EncryptSByte(sbyte v) => Box(v); public static implicit operator sbyte(EncryptSByte d) => Unbox(d); public int CompareTo(EncryptSByte other) => GetValue().CompareTo(other.GetValue()); } public class EncryptShort : EncryptTypeBase<short, short, EncryptShort> { protected override short GetInitKey(int rand) => (short) rand; protected override short DecodeValue(short value, short key) => (short) (value ^ key); protected override short EncodeValue(short v, short key) => (short) (v ^ key); public static implicit operator EncryptShort(short v) => Box(v); public static implicit operator short(EncryptShort d) => Unbox(d); public int CompareTo(EncryptShort other) => GetValue().CompareTo(other.GetValue()); } public class EncryptUShort : EncryptTypeBase<ushort, ushort, EncryptUShort> { protected override ushort GetInitKey(int rand) => (ushort) rand; protected override ushort DecodeValue(ushort value, ushort key) => (ushort) (value ^ key); protected override ushort EncodeValue(ushort v, ushort key) => (ushort) (v ^ key); public static implicit operator EncryptUShort(ushort v) => Box(v); public static implicit operator ushort(EncryptUShort d) => Unbox(d); public int CompareTo(EncryptUShort other) => GetValue().CompareTo(other.GetValue()); } public class EncryptInt : EncryptTypeBase<int, int, EncryptInt> { protected override int GetInitKey(int rand) => rand; protected override int DecodeValue(int value, int key) => value ^ key; protected override int EncodeValue(int v, int key) => v ^ key; public static implicit operator EncryptInt(int v) => Box(v); public static implicit operator int(EncryptInt d) => Unbox(d); public int CompareTo(EncryptInt other) => GetValue().CompareTo(other.GetValue()); } public class EncryptUInt : EncryptTypeBase<uint, uint, EncryptUInt> { protected override uint GetInitKey(int rand) => (uint) rand; protected override uint DecodeValue(uint value, uint key) => value ^ key; protected override uint EncodeValue(uint v, uint key) => v ^ key; public static implicit operator EncryptUInt(uint v) => Box(v); public static implicit operator uint(EncryptUInt d) => Unbox(d); public int CompareTo(EncryptUInt other) => GetValue().CompareTo(other.GetValue()); } public class EncryptLong : EncryptTypeBase<long, long, EncryptLong> { protected override long GetInitKey(int rand) => rand; protected override long DecodeValue(long value, long key) => value ^ key; protected override long EncodeValue(long v, long key) => v ^ key; public static implicit operator EncryptLong(long v) => Box(v); public static implicit operator long(EncryptLong d) => Unbox(d); public int CompareTo(EncryptLong other) => GetValue().CompareTo(other.GetValue()); } public class EncryptULong : EncryptTypeBase<ulong, ulong, EncryptULong> { protected override ulong GetInitKey(int rand) => (ulong) rand; protected override ulong DecodeValue(ulong value, ulong key) => value ^ key; protected override ulong EncodeValue(ulong v, ulong key) => v ^ key; public static implicit operator EncryptULong(ulong v) => Box(v); public static implicit operator ulong(EncryptULong d) => Unbox(d); public int CompareTo(EncryptULong other) => GetValue().CompareTo(other.GetValue()); } public class EncryptFloat : EncryptTypeBase<float, uint, EncryptFloat> { protected override uint GetInitKey(int rand) => (uint) rand; protected override float DecodeValue(uint value, uint key) { value ^= key; byte[] bytes = BitConverter.GetBytes(value); float v = BitConverter.ToSingle(bytes, 0); return v; } protected override uint EncodeValue(float v, uint key) { byte[] bytes = BitConverter.GetBytes(v); uint value = BitConverter.ToUInt32(bytes, 0); value ^= key; return value; } public static implicit operator EncryptFloat(float v) => Box(v); public static implicit operator float(EncryptFloat d) => Unbox(d); public int CompareTo(EncryptFloat other) => GetValue().CompareTo(other.GetValue()); } public class EncryptDouble : EncryptTypeBase<double, ulong, EncryptDouble> { protected override ulong GetInitKey(int rand) => (ulong) rand; protected override double DecodeValue(ulong value, ulong key) { value ^= key; byte[] bytes = BitConverter.GetBytes(value); double v = BitConverter.ToDouble(bytes, 0); return v; } protected override ulong EncodeValue(double v, ulong key) { byte[] bytes = BitConverter.GetBytes(v); ulong value = BitConverter.ToUInt64(bytes, 0); value ^= key; return value; } public static implicit operator EncryptDouble(double v) => Box(v); public static implicit operator double(EncryptDouble d) => Unbox(d); public int CompareTo(EncryptDouble other) => GetValue().CompareTo(other.GetValue()); } } <|start_filename|>Projects/Java_bin/src/main/gen/cfg/bonus/ProbabilityItems.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.bonus; import bright.serialization.*; public final class ProbabilityItems extends cfg.bonus.Bonus { public ProbabilityItems(ByteBuf _buf) { super(_buf); {int n = Math.min(_buf.readSize(), _buf.size());itemList = new cfg.bonus.ProbabilityItemInfo[n];for(int i = 0 ; i < n ; i++) { cfg.bonus.ProbabilityItemInfo _e;_e = new cfg.bonus.ProbabilityItemInfo(_buf); itemList[i] = _e;}} } public ProbabilityItems(cfg.bonus.ProbabilityItemInfo[] item_list ) { super(); this.itemList = item_list; } public final cfg.bonus.ProbabilityItemInfo[] itemList; public static final int __ID__ = 366387866; @Override public int getTypeId() { return __ID__; } @Override public void resolve(java.util.HashMap<String, Object> _tables) { super.resolve(_tables); for(cfg.bonus.ProbabilityItemInfo _e : itemList) { if (_e != null) _e.resolve(_tables); } } @Override public String toString() { return "{ " + "itemList:" + itemList + "," + "}"; } } <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/error/ErrorInfo.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.error { public sealed partial class ErrorInfo : Bright.Config.BeanBase { public ErrorInfo(ByteBuf _buf) { Code = _buf.ReadString(); Desc = _buf.ReadString(); Style = error.ErrorStyle.DeserializeErrorStyle(_buf); } public ErrorInfo(string code, string desc, error.ErrorStyle style ) { this.Code = code; this.Desc = desc; this.Style = style; } public static ErrorInfo DeserializeErrorInfo(ByteBuf _buf) { return new error.ErrorInfo(_buf); } public readonly string Code; public readonly string Desc; public readonly error.ErrorStyle Style; public const int ID = 1389347408; public override int GetTypeId() => ID; public void Resolve(Dictionary<string, object> _tables) { Style?.Resolve(_tables); OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); public override string ToString() { return "{ " + "Code:" + Code + "," + "Desc:" + Desc + "," + "Style:" + Style + "," + "}"; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_ParticleSystem_VelocityOverLifetimeModule_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_ParticleSystem_VelocityOverLifetimeModule_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.ParticleSystem.VelocityOverLifetimeModule constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_enabled(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.VelocityOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.enabled; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_enabled(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.VelocityOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.enabled = argHelper.GetBoolean(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_x(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.VelocityOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.x; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_x(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.VelocityOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.x = argHelper.Get<UnityEngine.ParticleSystem.MinMaxCurve>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_y(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.VelocityOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.y; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_y(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.VelocityOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.y = argHelper.Get<UnityEngine.ParticleSystem.MinMaxCurve>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_z(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.VelocityOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.z; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_z(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.VelocityOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.z = argHelper.Get<UnityEngine.ParticleSystem.MinMaxCurve>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_xMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.VelocityOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.xMultiplier; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_xMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.VelocityOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.xMultiplier = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_yMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.VelocityOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.yMultiplier; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_yMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.VelocityOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.yMultiplier = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_zMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.VelocityOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.zMultiplier; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_zMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.VelocityOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.zMultiplier = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_orbitalX(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.VelocityOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.orbitalX; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_orbitalX(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.VelocityOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.orbitalX = argHelper.Get<UnityEngine.ParticleSystem.MinMaxCurve>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_orbitalY(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.VelocityOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.orbitalY; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_orbitalY(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.VelocityOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.orbitalY = argHelper.Get<UnityEngine.ParticleSystem.MinMaxCurve>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_orbitalZ(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.VelocityOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.orbitalZ; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_orbitalZ(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.VelocityOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.orbitalZ = argHelper.Get<UnityEngine.ParticleSystem.MinMaxCurve>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_orbitalXMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.VelocityOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.orbitalXMultiplier; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_orbitalXMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.VelocityOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.orbitalXMultiplier = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_orbitalYMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.VelocityOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.orbitalYMultiplier; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_orbitalYMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.VelocityOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.orbitalYMultiplier = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_orbitalZMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.VelocityOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.orbitalZMultiplier; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_orbitalZMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.VelocityOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.orbitalZMultiplier = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_orbitalOffsetX(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.VelocityOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.orbitalOffsetX; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_orbitalOffsetX(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.VelocityOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.orbitalOffsetX = argHelper.Get<UnityEngine.ParticleSystem.MinMaxCurve>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_orbitalOffsetY(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.VelocityOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.orbitalOffsetY; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_orbitalOffsetY(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.VelocityOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.orbitalOffsetY = argHelper.Get<UnityEngine.ParticleSystem.MinMaxCurve>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_orbitalOffsetZ(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.VelocityOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.orbitalOffsetZ; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_orbitalOffsetZ(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.VelocityOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.orbitalOffsetZ = argHelper.Get<UnityEngine.ParticleSystem.MinMaxCurve>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_orbitalOffsetXMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.VelocityOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.orbitalOffsetXMultiplier; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_orbitalOffsetXMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.VelocityOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.orbitalOffsetXMultiplier = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_orbitalOffsetYMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.VelocityOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.orbitalOffsetYMultiplier; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_orbitalOffsetYMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.VelocityOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.orbitalOffsetYMultiplier = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_orbitalOffsetZMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.VelocityOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.orbitalOffsetZMultiplier; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_orbitalOffsetZMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.VelocityOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.orbitalOffsetZMultiplier = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_radial(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.VelocityOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.radial; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_radial(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.VelocityOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.radial = argHelper.Get<UnityEngine.ParticleSystem.MinMaxCurve>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_radialMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.VelocityOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.radialMultiplier; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_radialMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.VelocityOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.radialMultiplier = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_speedModifier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.VelocityOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.speedModifier; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_speedModifier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.VelocityOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.speedModifier = argHelper.Get<UnityEngine.ParticleSystem.MinMaxCurve>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_speedModifierMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.VelocityOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.speedModifierMultiplier; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_speedModifierMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.VelocityOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.speedModifierMultiplier = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_space(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.VelocityOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.space; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_space(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.VelocityOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.space = (UnityEngine.ParticleSystemSimulationSpace)argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"enabled", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_enabled, Setter = S_enabled} }, {"x", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_x, Setter = S_x} }, {"y", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_y, Setter = S_y} }, {"z", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_z, Setter = S_z} }, {"xMultiplier", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_xMultiplier, Setter = S_xMultiplier} }, {"yMultiplier", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_yMultiplier, Setter = S_yMultiplier} }, {"zMultiplier", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_zMultiplier, Setter = S_zMultiplier} }, {"orbitalX", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_orbitalX, Setter = S_orbitalX} }, {"orbitalY", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_orbitalY, Setter = S_orbitalY} }, {"orbitalZ", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_orbitalZ, Setter = S_orbitalZ} }, {"orbitalXMultiplier", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_orbitalXMultiplier, Setter = S_orbitalXMultiplier} }, {"orbitalYMultiplier", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_orbitalYMultiplier, Setter = S_orbitalYMultiplier} }, {"orbitalZMultiplier", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_orbitalZMultiplier, Setter = S_orbitalZMultiplier} }, {"orbitalOffsetX", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_orbitalOffsetX, Setter = S_orbitalOffsetX} }, {"orbitalOffsetY", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_orbitalOffsetY, Setter = S_orbitalOffsetY} }, {"orbitalOffsetZ", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_orbitalOffsetZ, Setter = S_orbitalOffsetZ} }, {"orbitalOffsetXMultiplier", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_orbitalOffsetXMultiplier, Setter = S_orbitalOffsetXMultiplier} }, {"orbitalOffsetYMultiplier", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_orbitalOffsetYMultiplier, Setter = S_orbitalOffsetYMultiplier} }, {"orbitalOffsetZMultiplier", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_orbitalOffsetZMultiplier, Setter = S_orbitalOffsetZMultiplier} }, {"radial", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_radial, Setter = S_radial} }, {"radialMultiplier", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_radialMultiplier, Setter = S_radialMultiplier} }, {"speedModifier", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_speedModifier, Setter = S_speedModifier} }, {"speedModifierMultiplier", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_speedModifierMultiplier, Setter = S_speedModifierMultiplier} }, {"space", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_space, Setter = S_space} }, } }; } } } <|start_filename|>Projects/Java_bin/src/main/gen/cfg/condition/Condition.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.condition; import bright.serialization.*; public abstract class Condition { public Condition(ByteBuf _buf) { } public Condition() { } public static Condition deserializeCondition(ByteBuf _buf) { switch (_buf.readInt()) { case cfg.condition.TimeRange.__ID__: return new cfg.condition.TimeRange(_buf); case cfg.condition.MultiRoleCondition.__ID__: return new cfg.condition.MultiRoleCondition(_buf); case cfg.condition.GenderLimit.__ID__: return new cfg.condition.GenderLimit(_buf); case cfg.condition.MinLevel.__ID__: return new cfg.condition.MinLevel(_buf); case cfg.condition.MaxLevel.__ID__: return new cfg.condition.MaxLevel(_buf); case cfg.condition.MinMaxLevel.__ID__: return new cfg.condition.MinMaxLevel(_buf); case cfg.condition.ClothesPropertyScoreGreaterThan.__ID__: return new cfg.condition.ClothesPropertyScoreGreaterThan(_buf); case cfg.condition.ContainsItem.__ID__: return new cfg.condition.ContainsItem(_buf); default: throw new SerializationException(); } } public abstract int getTypeId(); public void resolve(java.util.HashMap<String, Object> _tables) { } @Override public String toString() { return "{ " + "}"; } } <|start_filename|>Projects/Lua_Unity_xlua_lua/Assets/Lua/Gen/TbL10NDemo.lua<|end_filename|> return { [11] = {id=11,text='测试1',}, [12] = {id=12,text='测试2',}, [13] = {id=13,text='测试3',}, [14] = {id=14,text='测试4',}, [15] = {id=15,text='测试5',}, [16] = {id=16,text='测试6',}, [17] = {id=17,text='测试7',}, [18] = {id=18,text='测试8',}, } <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/item/ItemFunction.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.item { public sealed partial class ItemFunction : Bright.Config.BeanBase { public ItemFunction(ByteBuf _buf) { MinorType = (item.EMinorType)_buf.ReadInt(); FuncType = (item.EItemFunctionType)_buf.ReadInt(); Method = _buf.ReadString(); CloseBagUi = _buf.ReadBool(); } public ItemFunction(item.EMinorType minor_type, item.EItemFunctionType func_type, string method, bool close_bag_ui ) { this.MinorType = minor_type; this.FuncType = func_type; this.Method = method; this.CloseBagUi = close_bag_ui; } public static ItemFunction DeserializeItemFunction(ByteBuf _buf) { return new item.ItemFunction(_buf); } public readonly item.EMinorType MinorType; public readonly item.EItemFunctionType FuncType; public readonly string Method; public readonly bool CloseBagUi; public const int ID = 1205824294; public override int GetTypeId() => ID; public void Resolve(Dictionary<string, object> _tables) { OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); public override string ToString() { return "{ " + "MinorType:" + MinorType + "," + "FuncType:" + FuncType + "," + "Method:" + Method + "," + "CloseBagUi:" + CloseBagUi + "," + "}"; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_Mesh_MeshData_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_Mesh_MeshData_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.Mesh.MeshData constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_HasVertexAttribute(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Mesh.MeshData)Puerts.Utils.GetSelf((int)data, self); { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = (UnityEngine.Rendering.VertexAttribute)argHelper0.GetInt32(false); var result = obj.HasVertexAttribute(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetVertexAttributeDimension(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Mesh.MeshData)Puerts.Utils.GetSelf((int)data, self); { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = (UnityEngine.Rendering.VertexAttribute)argHelper0.GetInt32(false); var result = obj.GetVertexAttributeDimension(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetVertexAttributeFormat(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Mesh.MeshData)Puerts.Utils.GetSelf((int)data, self); { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = (UnityEngine.Rendering.VertexAttribute)argHelper0.GetInt32(false); var result = obj.GetVertexAttributeFormat(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetVertices(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Mesh.MeshData)Puerts.Utils.GetSelf((int)data, self); { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<Unity.Collections.NativeArray<UnityEngine.Vector3>>(false); obj.GetVertices(Arg0); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetNormals(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Mesh.MeshData)Puerts.Utils.GetSelf((int)data, self); { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<Unity.Collections.NativeArray<UnityEngine.Vector3>>(false); obj.GetNormals(Arg0); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetTangents(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Mesh.MeshData)Puerts.Utils.GetSelf((int)data, self); { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<Unity.Collections.NativeArray<UnityEngine.Vector4>>(false); obj.GetTangents(Arg0); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetColors(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Mesh.MeshData)Puerts.Utils.GetSelf((int)data, self); if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(Unity.Collections.NativeArray<UnityEngine.Color>), false, false)) { var Arg0 = argHelper0.Get<Unity.Collections.NativeArray<UnityEngine.Color>>(false); obj.GetColors(Arg0); Puerts.Utils.SetSelf((int)data, self, obj); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(Unity.Collections.NativeArray<UnityEngine.Color32>), false, false)) { var Arg0 = argHelper0.Get<Unity.Collections.NativeArray<UnityEngine.Color32>>(false); obj.GetColors(Arg0); Puerts.Utils.SetSelf((int)data, self, obj); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetColors"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetUVs(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Mesh.MeshData)Puerts.Utils.GetSelf((int)data, self); if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(Unity.Collections.NativeArray<UnityEngine.Vector2>), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<Unity.Collections.NativeArray<UnityEngine.Vector2>>(false); obj.GetUVs(Arg0,Arg1); Puerts.Utils.SetSelf((int)data, self, obj); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(Unity.Collections.NativeArray<UnityEngine.Vector3>), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<Unity.Collections.NativeArray<UnityEngine.Vector3>>(false); obj.GetUVs(Arg0,Arg1); Puerts.Utils.SetSelf((int)data, self, obj); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(Unity.Collections.NativeArray<UnityEngine.Vector4>), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<Unity.Collections.NativeArray<UnityEngine.Vector4>>(false); obj.GetUVs(Arg0,Arg1); Puerts.Utils.SetSelf((int)data, self, obj); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetUVs"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetVertexBufferParams(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Mesh.MeshData)Puerts.Utils.GetSelf((int)data, self); if (paramLen >= 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rendering.VertexAttributeDescriptor), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetParams<UnityEngine.Rendering.VertexAttributeDescriptor>(info, 1, paramLen); obj.SetVertexBufferParams(Arg0,Arg1); Puerts.Utils.SetSelf((int)data, self, obj); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(Unity.Collections.NativeArray<UnityEngine.Rendering.VertexAttributeDescriptor>), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<Unity.Collections.NativeArray<UnityEngine.Rendering.VertexAttributeDescriptor>>(false); obj.SetVertexBufferParams(Arg0,Arg1); Puerts.Utils.SetSelf((int)data, self, obj); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SetVertexBufferParams"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetIndexBufferParams(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Mesh.MeshData)Puerts.Utils.GetSelf((int)data, self); { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.GetInt32(false); var Arg1 = (UnityEngine.Rendering.IndexFormat)argHelper1.GetInt32(false); obj.SetIndexBufferParams(Arg0,Arg1); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetIndices(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Mesh.MeshData)Puerts.Utils.GetSelf((int)data, self); if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(Unity.Collections.NativeArray<ushort>), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.Get<Unity.Collections.NativeArray<ushort>>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetBoolean(false); obj.GetIndices(Arg0,Arg1,Arg2); Puerts.Utils.SetSelf((int)data, self, obj); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(Unity.Collections.NativeArray<int>), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.Get<Unity.Collections.NativeArray<int>>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetBoolean(false); obj.GetIndices(Arg0,Arg1,Arg2); Puerts.Utils.SetSelf((int)data, self, obj); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(Unity.Collections.NativeArray<ushort>), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<Unity.Collections.NativeArray<ushort>>(false); var Arg1 = argHelper1.GetInt32(false); obj.GetIndices(Arg0,Arg1); Puerts.Utils.SetSelf((int)data, self, obj); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(Unity.Collections.NativeArray<int>), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<Unity.Collections.NativeArray<int>>(false); var Arg1 = argHelper1.GetInt32(false); obj.GetIndices(Arg0,Arg1); Puerts.Utils.SetSelf((int)data, self, obj); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetIndices"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetSubMesh(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Mesh.MeshData)Puerts.Utils.GetSelf((int)data, self); { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); var result = obj.GetSubMesh(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetSubMesh(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Mesh.MeshData)Puerts.Utils.GetSelf((int)data, self); if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rendering.SubMeshDescriptor), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.Rendering.SubMeshDescriptor>(false); var Arg2 = (UnityEngine.Rendering.MeshUpdateFlags)argHelper2.GetInt32(false); obj.SetSubMesh(Arg0,Arg1,Arg2); Puerts.Utils.SetSelf((int)data, self, obj); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rendering.SubMeshDescriptor), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.Rendering.SubMeshDescriptor>(false); obj.SetSubMesh(Arg0,Arg1); Puerts.Utils.SetSelf((int)data, self, obj); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SetSubMesh"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_vertexCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Mesh.MeshData)Puerts.Utils.GetSelf((int)data, self); var result = obj.vertexCount; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_vertexBufferCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Mesh.MeshData)Puerts.Utils.GetSelf((int)data, self); var result = obj.vertexBufferCount; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_indexFormat(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Mesh.MeshData)Puerts.Utils.GetSelf((int)data, self); var result = obj.indexFormat; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_subMeshCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Mesh.MeshData)Puerts.Utils.GetSelf((int)data, self); var result = obj.subMeshCount; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_subMeshCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Mesh.MeshData)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.subMeshCount = argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "HasVertexAttribute", IsStatic = false}, M_HasVertexAttribute }, { new Puerts.MethodKey {Name = "GetVertexAttributeDimension", IsStatic = false}, M_GetVertexAttributeDimension }, { new Puerts.MethodKey {Name = "GetVertexAttributeFormat", IsStatic = false}, M_GetVertexAttributeFormat }, { new Puerts.MethodKey {Name = "GetVertices", IsStatic = false}, M_GetVertices }, { new Puerts.MethodKey {Name = "GetNormals", IsStatic = false}, M_GetNormals }, { new Puerts.MethodKey {Name = "GetTangents", IsStatic = false}, M_GetTangents }, { new Puerts.MethodKey {Name = "GetColors", IsStatic = false}, M_GetColors }, { new Puerts.MethodKey {Name = "GetUVs", IsStatic = false}, M_GetUVs }, { new Puerts.MethodKey {Name = "SetVertexBufferParams", IsStatic = false}, M_SetVertexBufferParams }, { new Puerts.MethodKey {Name = "SetIndexBufferParams", IsStatic = false}, M_SetIndexBufferParams }, { new Puerts.MethodKey {Name = "GetIndices", IsStatic = false}, M_GetIndices }, { new Puerts.MethodKey {Name = "GetSubMesh", IsStatic = false}, M_GetSubMesh }, { new Puerts.MethodKey {Name = "SetSubMesh", IsStatic = false}, M_SetSubMesh }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"vertexCount", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_vertexCount, Setter = null} }, {"vertexBufferCount", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_vertexBufferCount, Setter = null} }, {"indexFormat", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_indexFormat, Setter = null} }, {"subMeshCount", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_subMeshCount, Setter = S_subMeshCount} }, } }; } } } <|start_filename|>Projects/GenerateDatas/convert_lua/error.TbCodeInfo/1.lua<|end_filename|> return { code = 1, key = "SERVER_NOT_EXISTS", } <|start_filename|>Projects/GenerateDatas/convert_lua/error.TbCodeInfo/204.lua<|end_filename|> return { code = 204, key = "BAG_IS_FULL", } <|start_filename|>Projects/GenerateDatas/convert_lua/role.TbRoleLevelExpAttr/64.lua<|end_filename|> return { level = 64, need_exp = 145000, clothes_attrs = { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, }, } <|start_filename|>Projects/java_json/src/gen/cfg/bonus/OneItem.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.bonus; import com.google.gson.JsonElement; import com.google.gson.JsonObject; public final class OneItem extends cfg.bonus.Bonus { public OneItem(JsonObject __json__) { super(__json__); itemId = __json__.get("item_id").getAsInt(); } public OneItem(int item_id ) { super(); this.itemId = item_id; } public static OneItem deserializeOneItem(JsonObject __json__) { return new OneItem(__json__); } public final int itemId; public cfg.item.Item itemId_Ref; public static final int __ID__ = -1649658966; @Override public int getTypeId() { return __ID__; } @Override public void resolve(java.util.HashMap<String, Object> _tables) { super.resolve(_tables); this.itemId_Ref = ((cfg.item.TbItem)_tables.get("item.TbItem")).get(itemId); } @Override public String toString() { return "{ " + "itemId:" + itemId + "," + "}"; } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_ConstantForce_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_ConstantForce_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.ConstantForce(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.ConstantForce), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_force(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ConstantForce; var result = obj.force; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_force(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ConstantForce; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.force = argHelper.Get<UnityEngine.Vector3>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_relativeForce(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ConstantForce; var result = obj.relativeForce; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_relativeForce(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ConstantForce; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.relativeForce = argHelper.Get<UnityEngine.Vector3>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_torque(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ConstantForce; var result = obj.torque; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_torque(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ConstantForce; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.torque = argHelper.Get<UnityEngine.Vector3>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_relativeTorque(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ConstantForce; var result = obj.relativeTorque; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_relativeTorque(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ConstantForce; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.relativeTorque = argHelper.Get<UnityEngine.Vector3>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"force", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_force, Setter = S_force} }, {"relativeForce", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_relativeForce, Setter = S_relativeForce} }, {"torque", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_torque, Setter = S_torque} }, {"relativeTorque", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_relativeTorque, Setter = S_relativeTorque} }, } }; } } } <|start_filename|>Projects/DataTemplates/template_erlang2/test_tbdatafrommisc.erl<|end_filename|> %% test.TbDataFromMisc -module(test_tbdatafrommisc) -export([get/1,get_ids/0]) get(1) -> #{ x4 => 1, x1 => true, x2 => 3, x3 => 128, x5 => 11223344, x6 => 1.2, x7 => 1.23432, x8_0 => 12312, x8 => 112233, x9 => 223344, x10 => "hq", x12 => bean, x13 => 2, x14 => bean, s1 => aabbcc, v2 => {"1","2"}, v3 => {"1.1","2.2","3.4"}, v4 => {"10.1","11.2","12.3","13.4"}, t1 => -28800, k1 => array, k2 => array, k5 => array, k8 => map, k9 => array, k15 => array }. get(11) -> #{ x4 => 11, x1 => true, x2 => 4, x3 => 128, x5 => 112233445566, x6 => 1.3, x7 => 1112232.43123, x8_0 => 123, x8 => 112233, x9 => 112334, x10 => "yf", x12 => bean, x13 => 4, x14 => bean, s1 => xml text, v2 => {"1","2"}, v3 => {"1.2","2.3","3.4"}, v4 => {"1.2","2.2","3.2","4.3"}, t1 => -28800, k1 => array, k2 => array, k5 => array, k8 => map, k9 => array, k15 => array }. get(2) -> #{ x4 => 2, x1 => true, x2 => 3, x3 => 128, x5 => 11223344, x6 => 1.2, x7 => 1.23432, x8_0 => 12312, x8 => 112233, x9 => 223344, x10 => "hq", x12 => bean, x13 => 2, x14 => bean, s1 => aabbcc22, v2 => {"1","2"}, v3 => {"1.1","2.2","3.4"}, v4 => {"10.1","11.2","12.3","13.4"}, t1 => -28800, k1 => array, k2 => array, k5 => array, k8 => map, k9 => array, k15 => array }. get(12) -> #{ x4 => 12, x1 => true, x2 => 4, x3 => 128, x5 => 112233445566, x6 => 1.3, x7 => 1112232.43123, x8_0 => 123, x8 => 112233, x9 => 112334, x10 => "yf", x12 => bean, x13 => 4, x14 => bean, s1 => xml text222, v2 => {"1","2"}, v3 => {"1.2","2.3","3.4"}, v4 => {"1.2","2.2","3.2","4.3"}, t1 => -28800, k1 => array, k2 => array, k5 => array, k8 => map, k9 => array, k15 => array }. get(40) -> #{ x4 => 40, x1 => true, x2 => 3, x3 => 128, x5 => 11223344, x6 => 1.2, x7 => 1.23432, x8_0 => 12312, x8 => 112233, x9 => 223344, x10 => "hq", x12 => bean, x13 => 2, x14 => bean, s1 => aabbcc22, v2 => {"1","2"}, v3 => {"1.1","2.2","3.4"}, v4 => {"10.1","11.2","12.3","13.4"}, t1 => -28800, k1 => array, k2 => array, k5 => array, k8 => map, k9 => array, k15 => array }. get(22) -> #{ x4 => 22, x1 => false, x2 => 2, x3 => 128, x5 => 112233445566, x6 => 1.3, x7 => 1122, x8_0 => 13, x8 => 12, x9 => 123, x10 => "yf", x12 => bean, x13 => 5, x14 => bean, s1 => lua text , v2 => {"1","2"}, v3 => {"0.1","0.2","0.3"}, v4 => {"1","2","3.5","4"}, t1 => -28800, k1 => array, k2 => array, k5 => array, k8 => map, k9 => array, k15 => array }. get_ids() -> [1,11,2,12,40,22]. <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_HumanBone_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_HumanBone_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.HumanBone constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_boneName(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.HumanBone)Puerts.Utils.GetSelf((int)data, self); var result = obj.boneName; Puerts.PuertsDLL.ReturnString(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_boneName(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.HumanBone)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.boneName = argHelper.GetString(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_humanName(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.HumanBone)Puerts.Utils.GetSelf((int)data, self); var result = obj.humanName; Puerts.PuertsDLL.ReturnString(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_humanName(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.HumanBone)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.humanName = argHelper.GetString(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_limit(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.HumanBone)Puerts.Utils.GetSelf((int)data, self); var result = obj.limit; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_limit(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.HumanBone)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.limit = argHelper.Get<UnityEngine.HumanLimit>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"boneName", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_boneName, Setter = S_boneName} }, {"humanName", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_humanName, Setter = S_humanName} }, {"limit", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_limit, Setter = S_limit} }, } }; } } } <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/test/InnerGroup.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.test { public sealed partial class InnerGroup : Bright.Config.BeanBase { public InnerGroup(ByteBuf _buf) { Y1 = _buf.ReadInt(); Y2 = _buf.ReadInt(); Y3 = _buf.ReadInt(); Y4 = _buf.ReadInt(); } public InnerGroup(int y1, int y2, int y3, int y4 ) { this.Y1 = y1; this.Y2 = y2; this.Y3 = y3; this.Y4 = y4; } public static InnerGroup DeserializeInnerGroup(ByteBuf _buf) { return new test.InnerGroup(_buf); } public readonly int Y1; public readonly int Y2; public readonly int Y3; public readonly int Y4; public const int ID = -587873083; public override int GetTypeId() => ID; public void Resolve(Dictionary<string, object> _tables) { OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); public override string ToString() { return "{ " + "Y1:" + Y1 + "," + "Y2:" + Y2 + "," + "Y3:" + Y3 + "," + "Y4:" + Y4 + "," + "}"; } } } <|start_filename|>Projects/Java_bin/src/main/gen/cfg/ai/UeLoop.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.ai; import bright.serialization.*; public final class UeLoop extends cfg.ai.Decorator { public UeLoop(ByteBuf _buf) { super(_buf); numLoops = _buf.readInt(); infiniteLoop = _buf.readBool(); infiniteLoopTimeoutTime = _buf.readFloat(); } public UeLoop(int id, String node_name, cfg.ai.EFlowAbortMode flow_abort_mode, int num_loops, boolean infinite_loop, float infinite_loop_timeout_time ) { super(id, node_name, flow_abort_mode); this.numLoops = num_loops; this.infiniteLoop = infinite_loop; this.infiniteLoopTimeoutTime = infinite_loop_timeout_time; } public final int numLoops; public final boolean infiniteLoop; public final float infiniteLoopTimeoutTime; public static final int __ID__ = -513308166; @Override public int getTypeId() { return __ID__; } @Override public void resolve(java.util.HashMap<String, Object> _tables) { super.resolve(_tables); } @Override public String toString() { return "{ " + "id:" + id + "," + "nodeName:" + nodeName + "," + "flowAbortMode:" + flowAbortMode + "," + "numLoops:" + numLoops + "," + "infiniteLoop:" + infiniteLoop + "," + "infiniteLoopTimeoutTime:" + infiniteLoopTimeoutTime + "," + "}"; } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_JointDrive_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_JointDrive_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.JointDrive constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_positionSpring(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.JointDrive)Puerts.Utils.GetSelf((int)data, self); var result = obj.positionSpring; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_positionSpring(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.JointDrive)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.positionSpring = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_positionDamper(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.JointDrive)Puerts.Utils.GetSelf((int)data, self); var result = obj.positionDamper; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_positionDamper(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.JointDrive)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.positionDamper = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_maximumForce(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.JointDrive)Puerts.Utils.GetSelf((int)data, self); var result = obj.maximumForce; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_maximumForce(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.JointDrive)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.maximumForce = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"positionSpring", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_positionSpring, Setter = S_positionSpring} }, {"positionDamper", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_positionDamper, Setter = S_positionDamper} }, {"maximumForce", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_maximumForce, Setter = S_maximumForce} }, } }; } } } <|start_filename|>Projects/java_json/src/gen/cfg/blueprint/Field.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.blueprint; import com.google.gson.JsonElement; import com.google.gson.JsonObject; public final class Field { public Field(JsonObject __json__) { name = __json__.get("name").getAsString(); type = __json__.get("type").getAsString(); desc = __json__.get("desc").getAsString(); } public Field(String name, String type, String desc ) { this.name = name; this.type = type; this.desc = desc; } public static Field deserializeField(JsonObject __json__) { return new Field(__json__); } public final String name; public final String type; public final String desc; public void resolve(java.util.HashMap<String, Object> _tables) { } @Override public String toString() { return "{ " + "name:" + name + "," + "type:" + type + "," + "desc:" + desc + "," + "}"; } } <|start_filename|>Projects/Java_bin/src/main/gen/cfg/ai/KeyData.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.ai; import bright.serialization.*; public abstract class KeyData { public KeyData(ByteBuf _buf) { } public KeyData() { } public static KeyData deserializeKeyData(ByteBuf _buf) { switch (_buf.readInt()) { case cfg.ai.FloatKeyData.__ID__: return new cfg.ai.FloatKeyData(_buf); case cfg.ai.IntKeyData.__ID__: return new cfg.ai.IntKeyData(_buf); case cfg.ai.StringKeyData.__ID__: return new cfg.ai.StringKeyData(_buf); case cfg.ai.BlackboardKeyData.__ID__: return new cfg.ai.BlackboardKeyData(_buf); default: throw new SerializationException(); } } public abstract int getTypeId(); public void resolve(java.util.HashMap<String, Object> _tables) { } @Override public String toString() { return "{ " + "}"; } } <|start_filename|>Projects/java_json/src/gen/cfg/ai/DistanceLessThan.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.ai; import com.google.gson.JsonElement; import com.google.gson.JsonObject; public final class DistanceLessThan extends cfg.ai.Decorator { public DistanceLessThan(JsonObject __json__) { super(__json__); actor1Key = __json__.get("actor1_key").getAsString(); actor2Key = __json__.get("actor2_key").getAsString(); distance = __json__.get("distance").getAsFloat(); reverseResult = __json__.get("reverse_result").getAsBoolean(); } public DistanceLessThan(int id, String node_name, cfg.ai.EFlowAbortMode flow_abort_mode, String actor1_key, String actor2_key, float distance, boolean reverse_result ) { super(id, node_name, flow_abort_mode); this.actor1Key = actor1_key; this.actor2Key = actor2_key; this.distance = distance; this.reverseResult = reverse_result; } public static DistanceLessThan deserializeDistanceLessThan(JsonObject __json__) { return new DistanceLessThan(__json__); } public final String actor1Key; public final String actor2Key; public final float distance; public final boolean reverseResult; public static final int __ID__ = -1207170283; @Override public int getTypeId() { return __ID__; } @Override public void resolve(java.util.HashMap<String, Object> _tables) { super.resolve(_tables); } @Override public String toString() { return "{ " + "id:" + id + "," + "nodeName:" + nodeName + "," + "flowAbortMode:" + flowAbortMode + "," + "actor1Key:" + actor1Key + "," + "actor2Key:" + actor2Key + "," + "distance:" + distance + "," + "reverseResult:" + reverseResult + "," + "}"; } } <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/cost/CostItem.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.cost { public sealed partial class CostItem : cost.Cost { public CostItem(ByteBuf _buf) : base(_buf) { ItemId = _buf.ReadInt(); Amount = _buf.ReadInt(); } public CostItem(int item_id, int amount ) : base() { this.ItemId = item_id; this.Amount = amount; } public static CostItem DeserializeCostItem(ByteBuf _buf) { return new cost.CostItem(_buf); } public readonly int ItemId; public item.Item ItemId_Ref; public readonly int Amount; public const int ID = -1249440351; public override int GetTypeId() => ID; public override void Resolve(Dictionary<string, object> _tables) { base.Resolve(_tables); this.ItemId_Ref = (_tables["item.TbItem"] as item.TbItem).GetOrDefault(ItemId); OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); public override string ToString() { return "{ " + "ItemId:" + ItemId + "," + "Amount:" + Amount + "," + "}"; } } } <|start_filename|>Projects/GenerateDatas/convert_lua/test.TbTestExcelBean/4.lua<|end_filename|> return { x1 = 4, x2 = "ee", x3 = 2, x4 = 6, } <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/ai/BinaryOperator.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.ai { public sealed partial class BinaryOperator : ai.KeyQueryOperator { public BinaryOperator(ByteBuf _buf) : base(_buf) { Oper = (ai.EOperator)_buf.ReadInt(); Data = ai.KeyData.DeserializeKeyData(_buf); } public BinaryOperator(ai.EOperator oper, ai.KeyData data ) : base() { this.Oper = oper; this.Data = data; } public static BinaryOperator DeserializeBinaryOperator(ByteBuf _buf) { return new ai.BinaryOperator(_buf); } public readonly ai.EOperator Oper; public readonly ai.KeyData Data; public const int ID = -979891605; public override int GetTypeId() => ID; public override void Resolve(Dictionary<string, object> _tables) { base.Resolve(_tables); Data?.Resolve(_tables); OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); public override string ToString() { return "{ " + "Oper:" + Oper + "," + "Data:" + Data + "," + "}"; } } } <|start_filename|>Projects/GenerateDatas/convert_lua/error.TbCodeInfo/8.lua<|end_filename|> return { code = 8, key = "EXAMPLE_DLG_OK", } <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/condition/TimeRange.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.condition { public sealed partial class TimeRange : condition.Condition { public TimeRange(ByteBuf _buf) : base(_buf) { DateTimeRange = common.DateTimeRange.DeserializeDateTimeRange(_buf); } public TimeRange(common.DateTimeRange date_time_range ) : base() { this.DateTimeRange = date_time_range; } public static TimeRange DeserializeTimeRange(ByteBuf _buf) { return new condition.TimeRange(_buf); } public readonly common.DateTimeRange DateTimeRange; public const int ID = 1069033789; public override int GetTypeId() => ID; public override void Resolve(Dictionary<string, object> _tables) { base.Resolve(_tables); DateTimeRange?.Resolve(_tables); OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); public override string ToString() { return "{ " + "DateTimeRange:" + DateTimeRange + "," + "}"; } } } <|start_filename|>Projects/java_json/src/gen/cfg/test/CompositeJsonTable1.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.test; import com.google.gson.JsonElement; import com.google.gson.JsonObject; public final class CompositeJsonTable1 { public CompositeJsonTable1(JsonObject __json__) { id = __json__.get("id").getAsInt(); x = __json__.get("x").getAsString(); } public CompositeJsonTable1(int id, String x ) { this.id = id; this.x = x; } public static CompositeJsonTable1 deserializeCompositeJsonTable1(JsonObject __json__) { return new CompositeJsonTable1(__json__); } public final int id; public final String x; public void resolve(java.util.HashMap<String, Object> _tables) { } @Override public String toString() { return "{ " + "id:" + id + "," + "x:" + x + "," + "}"; } } <|start_filename|>Projects/Java_bin/src/main/gen/cfg/item/InteractionItem.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.item; import bright.serialization.*; public final class InteractionItem extends cfg.item.ItemExtra { public InteractionItem(ByteBuf _buf) { super(_buf); if(_buf.readBool()){ attackNum = _buf.readInt(); } else { attackNum = null; } holdingStaticMesh = _buf.readString(); holdingStaticMeshMat = _buf.readString(); } public InteractionItem(int id, Integer attack_num, String holding_static_mesh, String holding_static_mesh_mat ) { super(id); this.attackNum = attack_num; this.holdingStaticMesh = holding_static_mesh; this.holdingStaticMeshMat = holding_static_mesh_mat; } public final Integer attackNum; public final String holdingStaticMesh; public final String holdingStaticMeshMat; public static final int __ID__ = 640937802; @Override public int getTypeId() { return __ID__; } @Override public void resolve(java.util.HashMap<String, Object> _tables) { super.resolve(_tables); } @Override public String toString() { return "{ " + "id:" + id + "," + "attackNum:" + attackNum + "," + "holdingStaticMesh:" + holdingStaticMesh + "," + "holdingStaticMeshMat:" + holdingStaticMeshMat + "," + "}"; } } <|start_filename|>Projects/Java_bin/src/main/gen/cfg/ai/Task.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.ai; import bright.serialization.*; public abstract class Task extends cfg.ai.FlowNode { public Task(ByteBuf _buf) { super(_buf); ignoreRestartSelf = _buf.readBool(); } public Task(int id, String node_name, java.util.ArrayList<cfg.ai.Decorator> decorators, java.util.ArrayList<cfg.ai.Service> services, boolean ignore_restart_self ) { super(id, node_name, decorators, services); this.ignoreRestartSelf = ignore_restart_self; } public static Task deserializeTask(ByteBuf _buf) { switch (_buf.readInt()) { case cfg.ai.UeWait.__ID__: return new cfg.ai.UeWait(_buf); case cfg.ai.UeWaitBlackboardTime.__ID__: return new cfg.ai.UeWaitBlackboardTime(_buf); case cfg.ai.MoveToTarget.__ID__: return new cfg.ai.MoveToTarget(_buf); case cfg.ai.ChooseSkill.__ID__: return new cfg.ai.ChooseSkill(_buf); case cfg.ai.MoveToRandomLocation.__ID__: return new cfg.ai.MoveToRandomLocation(_buf); case cfg.ai.MoveToLocation.__ID__: return new cfg.ai.MoveToLocation(_buf); case cfg.ai.DebugPrint.__ID__: return new cfg.ai.DebugPrint(_buf); default: throw new SerializationException(); } } public final boolean ignoreRestartSelf; @Override public void resolve(java.util.HashMap<String, Object> _tables) { super.resolve(_tables); } @Override public String toString() { return "{ " + "id:" + id + "," + "nodeName:" + nodeName + "," + "decorators:" + decorators + "," + "services:" + services + "," + "ignoreRestartSelf:" + ignoreRestartSelf + "," + "}"; } } <|start_filename|>Projects/Java_bin/src/main/gen/cfg/tag/TestTag.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.tag; import bright.serialization.*; public final class TestTag { public TestTag(ByteBuf _buf) { id = _buf.readInt(); value = _buf.readString(); } public TestTag(int id, String value ) { this.id = id; this.value = value; } public final int id; public final String value; public void resolve(java.util.HashMap<String, Object> _tables) { } @Override public String toString() { return "{ " + "id:" + id + "," + "value:" + value + "," + "}"; } } <|start_filename|>Projects/Lua_Unity_tolua_lua/Assets/Source/Generate/Bright_Serialization_ByteBufWrap.cs<|end_filename|> //this source code was auto-generated by tolua#, do not modify it using System; using LuaInterface; public class Bright_Serialization_ByteBufWrap { public static void Register(LuaState L) { L.BeginClass(typeof(Bright.Serialization.ByteBuf), typeof(System.Object)); L.RegFunction("Wrap", Wrap); L.RegFunction("Replace", Replace); L.RegFunction("AddWriteIndex", AddWriteIndex); L.RegFunction("AddReadIndex", AddReadIndex); L.RegFunction("CopyData", CopyData); L.RegFunction("DiscardReadBytes", DiscardReadBytes); L.RegFunction("WriteBytesWithoutSize", WriteBytesWithoutSize); L.RegFunction("Clear", Clear); L.RegFunction("EnsureWrite", EnsureWrite); L.RegFunction("Append", Append); L.RegFunction("WriteBool", WriteBool); L.RegFunction("ReadBool", ReadBool); L.RegFunction("WriteByte", WriteByte); L.RegFunction("ReadByte", ReadByte); L.RegFunction("WriteShort", WriteShort); L.RegFunction("ReadShort", ReadShort); L.RegFunction("ReadFshort", ReadFshort); L.RegFunction("WriteFshort", WriteFshort); L.RegFunction("WriteInt", WriteInt); L.RegFunction("ReadInt", ReadInt); L.RegFunction("WriteUint", WriteUint); L.RegFunction("ReadUint", ReadUint); L.RegFunction("WriteUint_Unsafe", WriteUint_Unsafe); L.RegFunction("ReadUint_Unsafe", ReadUint_Unsafe); L.RegFunction("ReadFint", ReadFint); L.RegFunction("WriteFint", WriteFint); L.RegFunction("ReadFint_Safe", ReadFint_Safe); L.RegFunction("WriteFint_Safe", WriteFint_Safe); L.RegFunction("WriteLong", WriteLong); L.RegFunction("ReadLong", ReadLong); L.RegFunction("ReadUlong", ReadUlong); L.RegFunction("WriteFlong", WriteFlong); L.RegFunction("ReadFlong", ReadFlong); L.RegFunction("WriteFloat", WriteFloat); L.RegFunction("ReadFloat", ReadFloat); L.RegFunction("WriteDouble", WriteDouble); L.RegFunction("ReadDouble", ReadDouble); L.RegFunction("WriteSize", WriteSize); L.RegFunction("ReadSize", ReadSize); L.RegFunction("WriteSint", WriteSint); L.RegFunction("ReadSint", ReadSint); L.RegFunction("WriteSlong", WriteSlong); L.RegFunction("ReadSlong", ReadSlong); L.RegFunction("WriteString", WriteString); L.RegFunction("ReadString", ReadString); L.RegFunction("WriteBytes", WriteBytes); L.RegFunction("ReadBytes", ReadBytes); L.RegFunction("WriteComplex", WriteComplex); L.RegFunction("ReadComplex", ReadComplex); L.RegFunction("WriteVector2", WriteVector2); L.RegFunction("ReadVector2", ReadVector2); L.RegFunction("WriteVector3", WriteVector3); L.RegFunction("ReadVector3", ReadVector3); L.RegFunction("WriteVector4", WriteVector4); L.RegFunction("ReadVector4", ReadVector4); L.RegFunction("WriteQuaternion", WriteQuaternion); L.RegFunction("ReadQuaternion", ReadQuaternion); L.RegFunction("WriteMatrix4x4", WriteMatrix4x4); L.RegFunction("ReadMatrix4x4", ReadMatrix4x4); L.RegFunction("WriteByteBufWithSize", WriteByteBufWithSize); L.RegFunction("WriteByteBufWithoutSize", WriteByteBufWithoutSize); L.RegFunction("TryReadByte", TryReadByte); L.RegFunction("TryDeserializeInplaceByteBuf", TryDeserializeInplaceByteBuf); L.RegFunction("WriteRawTag", WriteRawTag); L.RegFunction("BeginWriteSegment", BeginWriteSegment); L.RegFunction("EndWriteSegment", EndWriteSegment); L.RegFunction("ReadSegment", ReadSegment); L.RegFunction("EnterSegment", EnterSegment); L.RegFunction("LeaveSegment", LeaveSegment); L.RegFunction("ToString", ToString); L.RegFunction("Equals", Equals); L.RegFunction("Clone", Clone); L.RegFunction("FromString", FromString); L.RegFunction("GetHashCode", GetHashCode); L.RegFunction("Release", Release); L.RegFunction("New", _CreateBright_Serialization_ByteBuf); L.RegFunction("__tostring", ToLua.op_ToString); L.RegVar("ReaderIndex", get_ReaderIndex, set_ReaderIndex); L.RegVar("WriterIndex", get_WriterIndex, set_WriterIndex); L.RegVar("Capacity", get_Capacity, null); L.RegVar("Size", get_Size, null); L.RegVar("Empty", get_Empty, null); L.RegVar("NotEmpty", get_NotEmpty, null); L.RegVar("Bytes", get_Bytes, null); L.RegVar("Remaining", get_Remaining, null); L.RegVar("NotCompactWritable", get_NotCompactWritable, null); L.RegVar("StringCacheFinder", get_StringCacheFinder, set_StringCacheFinder); L.EndClass(); } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _CreateBright_Serialization_ByteBuf(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); if (count == 0) { Bright.Serialization.ByteBuf obj = new Bright.Serialization.ByteBuf(); ToLua.PushSealed(L, obj); return 1; } else if (count == 1 && TypeChecker.CheckTypes<int>(L, 1)) { int arg0 = (int)LuaDLL.lua_tonumber(L, 1); Bright.Serialization.ByteBuf obj = new Bright.Serialization.ByteBuf(arg0); ToLua.PushSealed(L, obj); return 1; } else if (count == 1 && TypeChecker.CheckTypes<byte[]>(L, 1)) { byte[] arg0 = ToLua.CheckByteBuffer(L, 1); Bright.Serialization.ByteBuf obj = new Bright.Serialization.ByteBuf(arg0); ToLua.PushSealed(L, obj); return 1; } else if (count == 2) { int arg0 = (int)LuaDLL.luaL_checknumber(L, 1); System.Action<Bright.Serialization.ByteBuf> arg1 = (System.Action<Bright.Serialization.ByteBuf>)ToLua.CheckDelegate<System.Action<Bright.Serialization.ByteBuf>>(L, 2); Bright.Serialization.ByteBuf obj = new Bright.Serialization.ByteBuf(arg0, arg1); ToLua.PushSealed(L, obj); return 1; } else if (count == 3) { byte[] arg0 = ToLua.CheckByteBuffer(L, 1); int arg1 = (int)LuaDLL.luaL_checknumber(L, 2); int arg2 = (int)LuaDLL.luaL_checknumber(L, 3); Bright.Serialization.ByteBuf obj = new Bright.Serialization.ByteBuf(arg0, arg1, arg2); ToLua.PushSealed(L, obj); return 1; } else { return LuaDLL.luaL_throw(L, "invalid arguments to ctor method: Bright.Serialization.ByteBuf.New"); } } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int Wrap(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); byte[] arg0 = ToLua.CheckByteBuffer(L, 1); Bright.Serialization.ByteBuf o = Bright.Serialization.ByteBuf.Wrap(arg0); ToLua.PushSealed(L, o); return 1; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int Replace(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); if (count == 2) { Bright.Serialization.ByteBuf obj = (Bright.Serialization.ByteBuf)ToLua.CheckObject(L, 1, typeof(Bright.Serialization.ByteBuf)); byte[] arg0 = ToLua.CheckByteBuffer(L, 2); obj.Replace(arg0); return 0; } else if (count == 4) { Bright.Serialization.ByteBuf obj = (Bright.Serialization.ByteBuf)ToLua.CheckObject(L, 1, typeof(Bright.Serialization.ByteBuf)); byte[] arg0 = ToLua.CheckByteBuffer(L, 2); int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); int arg2 = (int)LuaDLL.luaL_checknumber(L, 4); obj.Replace(arg0, arg1, arg2); return 0; } else { return LuaDLL.luaL_throw(L, "invalid arguments to method: Bright.Serialization.ByteBuf.Replace"); } } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int AddWriteIndex(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); Bright.Serialization.ByteBuf obj = (Bright.Serialization.ByteBuf)ToLua.CheckObject(L, 1, typeof(Bright.Serialization.ByteBuf)); int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); obj.AddWriteIndex(arg0); return 0; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int AddReadIndex(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); Bright.Serialization.ByteBuf obj = (Bright.Serialization.ByteBuf)ToLua.CheckObject(L, 1, typeof(Bright.Serialization.ByteBuf)); int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); obj.AddReadIndex(arg0); return 0; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int CopyData(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); Bright.Serialization.ByteBuf obj = (Bright.Serialization.ByteBuf)ToLua.CheckObject(L, 1, typeof(Bright.Serialization.ByteBuf)); byte[] o = obj.CopyData(); ToLua.Push(L, o); return 1; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int DiscardReadBytes(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); Bright.Serialization.ByteBuf obj = (Bright.Serialization.ByteBuf)ToLua.CheckObject(L, 1, typeof(Bright.Serialization.ByteBuf)); obj.DiscardReadBytes(); return 0; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int WriteBytesWithoutSize(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); if (count == 2) { Bright.Serialization.ByteBuf obj = (Bright.Serialization.ByteBuf)ToLua.CheckObject(L, 1, typeof(Bright.Serialization.ByteBuf)); byte[] arg0 = ToLua.CheckByteBuffer(L, 2); obj.WriteBytesWithoutSize(arg0); return 0; } else if (count == 4) { Bright.Serialization.ByteBuf obj = (Bright.Serialization.ByteBuf)ToLua.CheckObject(L, 1, typeof(Bright.Serialization.ByteBuf)); byte[] arg0 = ToLua.CheckByteBuffer(L, 2); int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); int arg2 = (int)LuaDLL.luaL_checknumber(L, 4); obj.WriteBytesWithoutSize(arg0, arg1, arg2); return 0; } else { return LuaDLL.luaL_throw(L, "invalid arguments to method: Bright.Serialization.ByteBuf.WriteBytesWithoutSize"); } } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int Clear(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); Bright.Serialization.ByteBuf obj = (Bright.Serialization.ByteBuf)ToLua.CheckObject(L, 1, typeof(Bright.Serialization.ByteBuf)); obj.Clear(); return 0; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int EnsureWrite(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); Bright.Serialization.ByteBuf obj = (Bright.Serialization.ByteBuf)ToLua.CheckObject(L, 1, typeof(Bright.Serialization.ByteBuf)); int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); obj.EnsureWrite(arg0); return 0; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int Append(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); Bright.Serialization.ByteBuf obj = (Bright.Serialization.ByteBuf)ToLua.CheckObject(L, 1, typeof(Bright.Serialization.ByteBuf)); byte arg0 = (byte)LuaDLL.luaL_checknumber(L, 2); obj.Append(arg0); return 0; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int WriteBool(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); Bright.Serialization.ByteBuf obj = (Bright.Serialization.ByteBuf)ToLua.CheckObject(L, 1, typeof(Bright.Serialization.ByteBuf)); bool arg0 = LuaDLL.luaL_checkboolean(L, 2); obj.WriteBool(arg0); return 0; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int ReadBool(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); Bright.Serialization.ByteBuf obj = (Bright.Serialization.ByteBuf)ToLua.CheckObject(L, 1, typeof(Bright.Serialization.ByteBuf)); bool o = obj.ReadBool(); LuaDLL.lua_pushboolean(L, o); return 1; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int WriteByte(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); Bright.Serialization.ByteBuf obj = (Bright.Serialization.ByteBuf)ToLua.CheckObject(L, 1, typeof(Bright.Serialization.ByteBuf)); byte arg0 = (byte)LuaDLL.luaL_checknumber(L, 2); obj.WriteByte(arg0); return 0; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int ReadByte(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); Bright.Serialization.ByteBuf obj = (Bright.Serialization.ByteBuf)ToLua.CheckObject(L, 1, typeof(Bright.Serialization.ByteBuf)); byte o = obj.ReadByte(); LuaDLL.lua_pushnumber(L, o); return 1; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int WriteShort(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); Bright.Serialization.ByteBuf obj = (Bright.Serialization.ByteBuf)ToLua.CheckObject(L, 1, typeof(Bright.Serialization.ByteBuf)); short arg0 = (short)LuaDLL.luaL_checknumber(L, 2); obj.WriteShort(arg0); return 0; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int ReadShort(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); Bright.Serialization.ByteBuf obj = (Bright.Serialization.ByteBuf)ToLua.CheckObject(L, 1, typeof(Bright.Serialization.ByteBuf)); short o = obj.ReadShort(); LuaDLL.lua_pushnumber(L, o); return 1; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int ReadFshort(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); Bright.Serialization.ByteBuf obj = (Bright.Serialization.ByteBuf)ToLua.CheckObject(L, 1, typeof(Bright.Serialization.ByteBuf)); short o = obj.ReadFshort(); LuaDLL.lua_pushnumber(L, o); return 1; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int WriteFshort(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); Bright.Serialization.ByteBuf obj = (Bright.Serialization.ByteBuf)ToLua.CheckObject(L, 1, typeof(Bright.Serialization.ByteBuf)); short arg0 = (short)LuaDLL.luaL_checknumber(L, 2); obj.WriteFshort(arg0); return 0; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int WriteInt(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); Bright.Serialization.ByteBuf obj = (Bright.Serialization.ByteBuf)ToLua.CheckObject(L, 1, typeof(Bright.Serialization.ByteBuf)); int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); obj.WriteInt(arg0); return 0; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int ReadInt(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); Bright.Serialization.ByteBuf obj = (Bright.Serialization.ByteBuf)ToLua.CheckObject(L, 1, typeof(Bright.Serialization.ByteBuf)); int o = obj.ReadInt(); LuaDLL.lua_pushinteger(L, o); return 1; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int WriteUint(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); Bright.Serialization.ByteBuf obj = (Bright.Serialization.ByteBuf)ToLua.CheckObject(L, 1, typeof(Bright.Serialization.ByteBuf)); uint arg0 = (uint)LuaDLL.luaL_checknumber(L, 2); obj.WriteUint(arg0); return 0; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int ReadUint(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); Bright.Serialization.ByteBuf obj = (Bright.Serialization.ByteBuf)ToLua.CheckObject(L, 1, typeof(Bright.Serialization.ByteBuf)); uint o = obj.ReadUint(); LuaDLL.lua_pushnumber(L, o); return 1; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int WriteUint_Unsafe(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); Bright.Serialization.ByteBuf obj = (Bright.Serialization.ByteBuf)ToLua.CheckObject(L, 1, typeof(Bright.Serialization.ByteBuf)); uint arg0 = (uint)LuaDLL.luaL_checknumber(L, 2); obj.WriteUint_Unsafe(arg0); return 0; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int ReadUint_Unsafe(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); Bright.Serialization.ByteBuf obj = (Bright.Serialization.ByteBuf)ToLua.CheckObject(L, 1, typeof(Bright.Serialization.ByteBuf)); uint o = obj.ReadUint_Unsafe(); LuaDLL.lua_pushnumber(L, o); return 1; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int ReadFint(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); Bright.Serialization.ByteBuf obj = (Bright.Serialization.ByteBuf)ToLua.CheckObject(L, 1, typeof(Bright.Serialization.ByteBuf)); int o = obj.ReadFint(); LuaDLL.lua_pushinteger(L, o); return 1; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int WriteFint(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); Bright.Serialization.ByteBuf obj = (Bright.Serialization.ByteBuf)ToLua.CheckObject(L, 1, typeof(Bright.Serialization.ByteBuf)); int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); obj.WriteFint(arg0); return 0; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int ReadFint_Safe(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); Bright.Serialization.ByteBuf obj = (Bright.Serialization.ByteBuf)ToLua.CheckObject(L, 1, typeof(Bright.Serialization.ByteBuf)); int o = obj.ReadFint_Safe(); LuaDLL.lua_pushinteger(L, o); return 1; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int WriteFint_Safe(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); Bright.Serialization.ByteBuf obj = (Bright.Serialization.ByteBuf)ToLua.CheckObject(L, 1, typeof(Bright.Serialization.ByteBuf)); int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); obj.WriteFint_Safe(arg0); return 0; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int WriteLong(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); Bright.Serialization.ByteBuf obj = (Bright.Serialization.ByteBuf)ToLua.CheckObject(L, 1, typeof(Bright.Serialization.ByteBuf)); long arg0 = LuaDLL.tolua_checkint64(L, 2); obj.WriteLong(arg0); return 0; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int ReadLong(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); Bright.Serialization.ByteBuf obj = (Bright.Serialization.ByteBuf)ToLua.CheckObject(L, 1, typeof(Bright.Serialization.ByteBuf)); long o = obj.ReadLong(); LuaDLL.tolua_pushint64(L, o); return 1; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int ReadUlong(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); Bright.Serialization.ByteBuf obj = (Bright.Serialization.ByteBuf)ToLua.CheckObject(L, 1, typeof(Bright.Serialization.ByteBuf)); ulong o = obj.ReadUlong(); LuaDLL.tolua_pushuint64(L, o); return 1; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int WriteFlong(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); Bright.Serialization.ByteBuf obj = (Bright.Serialization.ByteBuf)ToLua.CheckObject(L, 1, typeof(Bright.Serialization.ByteBuf)); long arg0 = LuaDLL.tolua_checkint64(L, 2); obj.WriteFlong(arg0); return 0; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int ReadFlong(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); Bright.Serialization.ByteBuf obj = (Bright.Serialization.ByteBuf)ToLua.CheckObject(L, 1, typeof(Bright.Serialization.ByteBuf)); long o = obj.ReadFlong(); LuaDLL.tolua_pushint64(L, o); return 1; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int WriteFloat(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); Bright.Serialization.ByteBuf obj = (Bright.Serialization.ByteBuf)ToLua.CheckObject(L, 1, typeof(Bright.Serialization.ByteBuf)); float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); obj.WriteFloat(arg0); return 0; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int ReadFloat(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); Bright.Serialization.ByteBuf obj = (Bright.Serialization.ByteBuf)ToLua.CheckObject(L, 1, typeof(Bright.Serialization.ByteBuf)); float o = obj.ReadFloat(); LuaDLL.lua_pushnumber(L, o); return 1; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int WriteDouble(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); Bright.Serialization.ByteBuf obj = (Bright.Serialization.ByteBuf)ToLua.CheckObject(L, 1, typeof(Bright.Serialization.ByteBuf)); double arg0 = (double)LuaDLL.luaL_checknumber(L, 2); obj.WriteDouble(arg0); return 0; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int ReadDouble(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); Bright.Serialization.ByteBuf obj = (Bright.Serialization.ByteBuf)ToLua.CheckObject(L, 1, typeof(Bright.Serialization.ByteBuf)); double o = obj.ReadDouble(); LuaDLL.lua_pushnumber(L, o); return 1; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int WriteSize(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); Bright.Serialization.ByteBuf obj = (Bright.Serialization.ByteBuf)ToLua.CheckObject(L, 1, typeof(Bright.Serialization.ByteBuf)); int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); obj.WriteSize(arg0); return 0; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int ReadSize(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); Bright.Serialization.ByteBuf obj = (Bright.Serialization.ByteBuf)ToLua.CheckObject(L, 1, typeof(Bright.Serialization.ByteBuf)); int o = obj.ReadSize(); LuaDLL.lua_pushinteger(L, o); return 1; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int WriteSint(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); Bright.Serialization.ByteBuf obj = (Bright.Serialization.ByteBuf)ToLua.CheckObject(L, 1, typeof(Bright.Serialization.ByteBuf)); int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); obj.WriteSint(arg0); return 0; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int ReadSint(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); Bright.Serialization.ByteBuf obj = (Bright.Serialization.ByteBuf)ToLua.CheckObject(L, 1, typeof(Bright.Serialization.ByteBuf)); int o = obj.ReadSint(); LuaDLL.lua_pushinteger(L, o); return 1; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int WriteSlong(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); Bright.Serialization.ByteBuf obj = (Bright.Serialization.ByteBuf)ToLua.CheckObject(L, 1, typeof(Bright.Serialization.ByteBuf)); long arg0 = LuaDLL.tolua_checkint64(L, 2); obj.WriteSlong(arg0); return 0; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int ReadSlong(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); Bright.Serialization.ByteBuf obj = (Bright.Serialization.ByteBuf)ToLua.CheckObject(L, 1, typeof(Bright.Serialization.ByteBuf)); long o = obj.ReadSlong(); LuaDLL.tolua_pushint64(L, o); return 1; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int WriteString(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); Bright.Serialization.ByteBuf obj = (Bright.Serialization.ByteBuf)ToLua.CheckObject(L, 1, typeof(Bright.Serialization.ByteBuf)); string arg0 = ToLua.CheckString(L, 2); obj.WriteString(arg0); return 0; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int ReadString(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); Bright.Serialization.ByteBuf obj = (Bright.Serialization.ByteBuf)ToLua.CheckObject(L, 1, typeof(Bright.Serialization.ByteBuf)); string o = obj.ReadString(); LuaDLL.lua_pushstring(L, o); return 1; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int WriteBytes(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); Bright.Serialization.ByteBuf obj = (Bright.Serialization.ByteBuf)ToLua.CheckObject(L, 1, typeof(Bright.Serialization.ByteBuf)); byte[] arg0 = ToLua.CheckByteBuffer(L, 2); obj.WriteBytes(arg0); return 0; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int ReadBytes(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); Bright.Serialization.ByteBuf obj = (Bright.Serialization.ByteBuf)ToLua.CheckObject(L, 1, typeof(Bright.Serialization.ByteBuf)); byte[] o = obj.ReadBytes(); ToLua.Push(L, o); return 1; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int WriteComplex(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); Bright.Serialization.ByteBuf obj = (Bright.Serialization.ByteBuf)ToLua.CheckObject(L, 1, typeof(Bright.Serialization.ByteBuf)); System.Numerics.Complex arg0 = StackTraits<System.Numerics.Complex>.Check(L, 2); obj.WriteComplex(arg0); return 0; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int ReadComplex(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); Bright.Serialization.ByteBuf obj = (Bright.Serialization.ByteBuf)ToLua.CheckObject(L, 1, typeof(Bright.Serialization.ByteBuf)); System.Numerics.Complex o = obj.ReadComplex(); ToLua.PushValue(L, o); return 1; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int WriteVector2(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); Bright.Serialization.ByteBuf obj = (Bright.Serialization.ByteBuf)ToLua.CheckObject(L, 1, typeof(Bright.Serialization.ByteBuf)); System.Numerics.Vector2 arg0 = StackTraits<System.Numerics.Vector2>.Check(L, 2); obj.WriteVector2(arg0); return 0; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int ReadVector2(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); Bright.Serialization.ByteBuf obj = (Bright.Serialization.ByteBuf)ToLua.CheckObject(L, 1, typeof(Bright.Serialization.ByteBuf)); System.Numerics.Vector2 o = obj.ReadVector2(); ToLua.PushValue(L, o); return 1; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int WriteVector3(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); Bright.Serialization.ByteBuf obj = (Bright.Serialization.ByteBuf)ToLua.CheckObject(L, 1, typeof(Bright.Serialization.ByteBuf)); System.Numerics.Vector3 arg0 = StackTraits<System.Numerics.Vector3>.Check(L, 2); obj.WriteVector3(arg0); return 0; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int ReadVector3(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); Bright.Serialization.ByteBuf obj = (Bright.Serialization.ByteBuf)ToLua.CheckObject(L, 1, typeof(Bright.Serialization.ByteBuf)); System.Numerics.Vector3 o = obj.ReadVector3(); ToLua.PushValue(L, o); return 1; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int WriteVector4(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); Bright.Serialization.ByteBuf obj = (Bright.Serialization.ByteBuf)ToLua.CheckObject(L, 1, typeof(Bright.Serialization.ByteBuf)); System.Numerics.Vector4 arg0 = StackTraits<System.Numerics.Vector4>.Check(L, 2); obj.WriteVector4(arg0); return 0; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int ReadVector4(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); Bright.Serialization.ByteBuf obj = (Bright.Serialization.ByteBuf)ToLua.CheckObject(L, 1, typeof(Bright.Serialization.ByteBuf)); System.Numerics.Vector4 o = obj.ReadVector4(); ToLua.PushValue(L, o); return 1; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int WriteQuaternion(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); Bright.Serialization.ByteBuf obj = (Bright.Serialization.ByteBuf)ToLua.CheckObject(L, 1, typeof(Bright.Serialization.ByteBuf)); System.Numerics.Quaternion arg0 = StackTraits<System.Numerics.Quaternion>.Check(L, 2); obj.WriteQuaternion(arg0); return 0; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int ReadQuaternion(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); Bright.Serialization.ByteBuf obj = (Bright.Serialization.ByteBuf)ToLua.CheckObject(L, 1, typeof(Bright.Serialization.ByteBuf)); System.Numerics.Quaternion o = obj.ReadQuaternion(); ToLua.PushValue(L, o); return 1; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int WriteMatrix4x4(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); Bright.Serialization.ByteBuf obj = (Bright.Serialization.ByteBuf)ToLua.CheckObject(L, 1, typeof(Bright.Serialization.ByteBuf)); System.Numerics.Matrix4x4 arg0 = StackTraits<System.Numerics.Matrix4x4>.Check(L, 2); obj.WriteMatrix4x4(arg0); return 0; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int ReadMatrix4x4(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); Bright.Serialization.ByteBuf obj = (Bright.Serialization.ByteBuf)ToLua.CheckObject(L, 1, typeof(Bright.Serialization.ByteBuf)); System.Numerics.Matrix4x4 o = obj.ReadMatrix4x4(); ToLua.PushValue(L, o); return 1; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int WriteByteBufWithSize(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); Bright.Serialization.ByteBuf obj = (Bright.Serialization.ByteBuf)ToLua.CheckObject(L, 1, typeof(Bright.Serialization.ByteBuf)); Bright.Serialization.ByteBuf arg0 = (Bright.Serialization.ByteBuf)ToLua.CheckObject(L, 2, typeof(Bright.Serialization.ByteBuf)); obj.WriteByteBufWithSize(arg0); return 0; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int WriteByteBufWithoutSize(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); Bright.Serialization.ByteBuf obj = (Bright.Serialization.ByteBuf)ToLua.CheckObject(L, 1, typeof(Bright.Serialization.ByteBuf)); Bright.Serialization.ByteBuf arg0 = (Bright.Serialization.ByteBuf)ToLua.CheckObject(L, 2, typeof(Bright.Serialization.ByteBuf)); obj.WriteByteBufWithoutSize(arg0); return 0; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int TryReadByte(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); Bright.Serialization.ByteBuf obj = (Bright.Serialization.ByteBuf)ToLua.CheckObject(L, 1, typeof(Bright.Serialization.ByteBuf)); byte arg0; bool o = obj.TryReadByte(out arg0); LuaDLL.lua_pushboolean(L, o); LuaDLL.lua_pushnumber(L, arg0); return 2; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int TryDeserializeInplaceByteBuf(IntPtr L) { try { ToLua.CheckArgsCount(L, 3); Bright.Serialization.ByteBuf obj = (Bright.Serialization.ByteBuf)ToLua.CheckObject(L, 1, typeof(Bright.Serialization.ByteBuf)); int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); Bright.Serialization.ByteBuf arg1 = (Bright.Serialization.ByteBuf)ToLua.CheckObject(L, 3, typeof(Bright.Serialization.ByteBuf)); Bright.Serialization.EDeserializeError o = obj.TryDeserializeInplaceByteBuf(arg0, arg1); ToLua.Push(L, o); return 1; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int WriteRawTag(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); if (count == 2) { Bright.Serialization.ByteBuf obj = (Bright.Serialization.ByteBuf)ToLua.CheckObject(L, 1, typeof(Bright.Serialization.ByteBuf)); byte arg0 = (byte)LuaDLL.luaL_checknumber(L, 2); obj.WriteRawTag(arg0); return 0; } else if (count == 3) { Bright.Serialization.ByteBuf obj = (Bright.Serialization.ByteBuf)ToLua.CheckObject(L, 1, typeof(Bright.Serialization.ByteBuf)); byte arg0 = (byte)LuaDLL.luaL_checknumber(L, 2); byte arg1 = (byte)LuaDLL.luaL_checknumber(L, 3); obj.WriteRawTag(arg0, arg1); return 0; } else if (count == 4) { Bright.Serialization.ByteBuf obj = (Bright.Serialization.ByteBuf)ToLua.CheckObject(L, 1, typeof(Bright.Serialization.ByteBuf)); byte arg0 = (byte)LuaDLL.luaL_checknumber(L, 2); byte arg1 = (byte)LuaDLL.luaL_checknumber(L, 3); byte arg2 = (byte)LuaDLL.luaL_checknumber(L, 4); obj.WriteRawTag(arg0, arg1, arg2); return 0; } else { return LuaDLL.luaL_throw(L, "invalid arguments to method: Bright.Serialization.ByteBuf.WriteRawTag"); } } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int BeginWriteSegment(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); Bright.Serialization.ByteBuf obj = (Bright.Serialization.ByteBuf)ToLua.CheckObject(L, 1, typeof(Bright.Serialization.ByteBuf)); int arg0; obj.BeginWriteSegment(out arg0); LuaDLL.lua_pushinteger(L, arg0); return 1; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int EndWriteSegment(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); Bright.Serialization.ByteBuf obj = (Bright.Serialization.ByteBuf)ToLua.CheckObject(L, 1, typeof(Bright.Serialization.ByteBuf)); int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); obj.EndWriteSegment(arg0); return 0; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int ReadSegment(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); if (count == 2) { Bright.Serialization.ByteBuf obj = (Bright.Serialization.ByteBuf)ToLua.CheckObject(L, 1, typeof(Bright.Serialization.ByteBuf)); Bright.Serialization.ByteBuf arg0 = (Bright.Serialization.ByteBuf)ToLua.CheckObject(L, 2, typeof(Bright.Serialization.ByteBuf)); obj.ReadSegment(arg0); return 0; } else if (count == 3) { Bright.Serialization.ByteBuf obj = (Bright.Serialization.ByteBuf)ToLua.CheckObject(L, 1, typeof(Bright.Serialization.ByteBuf)); int arg0; int arg1; obj.ReadSegment(out arg0, out arg1); LuaDLL.lua_pushinteger(L, arg0); LuaDLL.lua_pushinteger(L, arg1); return 2; } else { return LuaDLL.luaL_throw(L, "invalid arguments to method: Bright.Serialization.ByteBuf.ReadSegment"); } } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int EnterSegment(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); Bright.Serialization.ByteBuf obj = (Bright.Serialization.ByteBuf)ToLua.CheckObject(L, 1, typeof(Bright.Serialization.ByteBuf)); Bright.Serialization.SegmentSaveState arg0; obj.EnterSegment(out arg0); ToLua.PushValue(L, arg0); return 1; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int LeaveSegment(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); Bright.Serialization.ByteBuf obj = (Bright.Serialization.ByteBuf)ToLua.CheckObject(L, 1, typeof(Bright.Serialization.ByteBuf)); Bright.Serialization.SegmentSaveState arg0 = StackTraits<Bright.Serialization.SegmentSaveState>.Check(L, 2); obj.LeaveSegment(arg0); return 0; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int ToString(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); Bright.Serialization.ByteBuf obj = (Bright.Serialization.ByteBuf)ToLua.CheckObject(L, 1, typeof(Bright.Serialization.ByteBuf)); string o = obj.ToString(); LuaDLL.lua_pushstring(L, o); return 1; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int Equals(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); if (count == 2 && TypeChecker.CheckTypes<Bright.Serialization.ByteBuf>(L, 2)) { Bright.Serialization.ByteBuf obj = (Bright.Serialization.ByteBuf)ToLua.CheckObject(L, 1, typeof(Bright.Serialization.ByteBuf)); Bright.Serialization.ByteBuf arg0 = (Bright.Serialization.ByteBuf)ToLua.ToObject(L, 2); bool o = obj != null ? obj.Equals(arg0) : arg0 == null; LuaDLL.lua_pushboolean(L, o); return 1; } else if (count == 2 && TypeChecker.CheckTypes<object>(L, 2)) { Bright.Serialization.ByteBuf obj = (Bright.Serialization.ByteBuf)ToLua.CheckObject(L, 1, typeof(Bright.Serialization.ByteBuf)); object arg0 = ToLua.ToVarObject(L, 2); bool o = obj != null ? obj.Equals(arg0) : arg0 == null; LuaDLL.lua_pushboolean(L, o); return 1; } else { return LuaDLL.luaL_throw(L, "invalid arguments to method: Bright.Serialization.ByteBuf.Equals"); } } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int Clone(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); Bright.Serialization.ByteBuf obj = (Bright.Serialization.ByteBuf)ToLua.CheckObject(L, 1, typeof(Bright.Serialization.ByteBuf)); object o = obj.Clone(); ToLua.Push(L, o); return 1; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int FromString(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); string arg0 = ToLua.CheckString(L, 1); Bright.Serialization.ByteBuf o = Bright.Serialization.ByteBuf.FromString(arg0); ToLua.PushSealed(L, o); return 1; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int GetHashCode(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); Bright.Serialization.ByteBuf obj = (Bright.Serialization.ByteBuf)ToLua.CheckObject(L, 1, typeof(Bright.Serialization.ByteBuf)); int o = obj.GetHashCode(); LuaDLL.lua_pushinteger(L, o); return 1; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int Release(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); Bright.Serialization.ByteBuf obj = (Bright.Serialization.ByteBuf)ToLua.CheckObject(L, 1, typeof(Bright.Serialization.ByteBuf)); obj.Release(); return 0; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int get_ReaderIndex(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); Bright.Serialization.ByteBuf obj = (Bright.Serialization.ByteBuf)o; int ret = obj.ReaderIndex; LuaDLL.lua_pushinteger(L, ret); return 1; } catch(Exception e) { return LuaDLL.toluaL_exception(L, e, o, "attempt to index ReaderIndex on a nil value"); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int get_WriterIndex(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); Bright.Serialization.ByteBuf obj = (Bright.Serialization.ByteBuf)o; int ret = obj.WriterIndex; LuaDLL.lua_pushinteger(L, ret); return 1; } catch(Exception e) { return LuaDLL.toluaL_exception(L, e, o, "attempt to index WriterIndex on a nil value"); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int get_Capacity(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); Bright.Serialization.ByteBuf obj = (Bright.Serialization.ByteBuf)o; int ret = obj.Capacity; LuaDLL.lua_pushinteger(L, ret); return 1; } catch(Exception e) { return LuaDLL.toluaL_exception(L, e, o, "attempt to index Capacity on a nil value"); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int get_Size(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); Bright.Serialization.ByteBuf obj = (Bright.Serialization.ByteBuf)o; int ret = obj.Size; LuaDLL.lua_pushinteger(L, ret); return 1; } catch(Exception e) { return LuaDLL.toluaL_exception(L, e, o, "attempt to index Size on a nil value"); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int get_Empty(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); Bright.Serialization.ByteBuf obj = (Bright.Serialization.ByteBuf)o; bool ret = obj.Empty; LuaDLL.lua_pushboolean(L, ret); return 1; } catch(Exception e) { return LuaDLL.toluaL_exception(L, e, o, "attempt to index Empty on a nil value"); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int get_NotEmpty(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); Bright.Serialization.ByteBuf obj = (Bright.Serialization.ByteBuf)o; bool ret = obj.NotEmpty; LuaDLL.lua_pushboolean(L, ret); return 1; } catch(Exception e) { return LuaDLL.toluaL_exception(L, e, o, "attempt to index NotEmpty on a nil value"); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int get_Bytes(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); Bright.Serialization.ByteBuf obj = (Bright.Serialization.ByteBuf)o; byte[] ret = obj.Bytes; ToLua.Push(L, ret); return 1; } catch(Exception e) { return LuaDLL.toluaL_exception(L, e, o, "attempt to index Bytes on a nil value"); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int get_Remaining(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); Bright.Serialization.ByteBuf obj = (Bright.Serialization.ByteBuf)o; int ret = obj.Remaining; LuaDLL.lua_pushinteger(L, ret); return 1; } catch(Exception e) { return LuaDLL.toluaL_exception(L, e, o, "attempt to index Remaining on a nil value"); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int get_NotCompactWritable(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); Bright.Serialization.ByteBuf obj = (Bright.Serialization.ByteBuf)o; int ret = obj.NotCompactWritable; LuaDLL.lua_pushinteger(L, ret); return 1; } catch(Exception e) { return LuaDLL.toluaL_exception(L, e, o, "attempt to index NotCompactWritable on a nil value"); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int get_StringCacheFinder(IntPtr L) { try { ToLua.Push(L, Bright.Serialization.ByteBuf.StringCacheFinder); return 1; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int set_ReaderIndex(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); Bright.Serialization.ByteBuf obj = (Bright.Serialization.ByteBuf)o; int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); obj.ReaderIndex = arg0; return 0; } catch(Exception e) { return LuaDLL.toluaL_exception(L, e, o, "attempt to index ReaderIndex on a nil value"); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int set_WriterIndex(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); Bright.Serialization.ByteBuf obj = (Bright.Serialization.ByteBuf)o; int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); obj.WriterIndex = arg0; return 0; } catch(Exception e) { return LuaDLL.toluaL_exception(L, e, o, "attempt to index WriterIndex on a nil value"); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int set_StringCacheFinder(IntPtr L) { try { System.Func<byte[],int,int,string> arg0 = (System.Func<byte[],int,int,string>)ToLua.CheckDelegate<System.Func<byte[],int,int,string>>(L, 2); Bright.Serialization.ByteBuf.StringCacheFinder = arg0; return 0; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } } <|start_filename|>Projects/Java_bin/src/main/gen/cfg/item/Clothes.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.item; import bright.serialization.*; public final class Clothes extends cfg.item.ItemExtra { public Clothes(ByteBuf _buf) { super(_buf); attack = _buf.readInt(); hp = _buf.readLong(); energyLimit = _buf.readInt(); energyResume = _buf.readInt(); } public Clothes(int id, int attack, long hp, int energy_limit, int energy_resume ) { super(id); this.attack = attack; this.hp = hp; this.energyLimit = energy_limit; this.energyResume = energy_resume; } public final int attack; public final long hp; public final int energyLimit; public final int energyResume; public static final int __ID__ = 1659907149; @Override public int getTypeId() { return __ID__; } @Override public void resolve(java.util.HashMap<String, Object> _tables) { super.resolve(_tables); } @Override public String toString() { return "{ " + "id:" + id + "," + "attack:" + attack + "," + "hp:" + hp + "," + "energyLimit:" + energyLimit + "," + "energyResume:" + energyResume + "," + "}"; } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_TextEditor_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_TextEditor_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.TextEditor(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.TextEditor), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_OnFocus(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextEditor; { { obj.OnFocus(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_OnLostFocus(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextEditor; { { obj.OnLostFocus(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_HandleKeyEvent(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextEditor; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Event>(false); var result = obj.HandleKeyEvent(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_DeleteLineBack(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextEditor; { { var result = obj.DeleteLineBack(); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_DeleteWordBack(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextEditor; { { var result = obj.DeleteWordBack(); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_DeleteWordForward(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextEditor; { { var result = obj.DeleteWordForward(); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Delete(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextEditor; { { var result = obj.Delete(); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_CanPaste(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextEditor; { { var result = obj.CanPaste(); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Backspace(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextEditor; { { var result = obj.Backspace(); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SelectAll(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextEditor; { { obj.SelectAll(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SelectNone(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextEditor; { { obj.SelectNone(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_DeleteSelection(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextEditor; { { var result = obj.DeleteSelection(); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ReplaceSelection(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextEditor; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetString(false); obj.ReplaceSelection(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Insert(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextEditor; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.Char>(false); obj.Insert(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_MoveSelectionToAltCursor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextEditor; { { obj.MoveSelectionToAltCursor(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_MoveRight(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextEditor; { { obj.MoveRight(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_MoveLeft(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextEditor; { { obj.MoveLeft(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_MoveUp(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextEditor; { { obj.MoveUp(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_MoveDown(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextEditor; { { obj.MoveDown(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_MoveLineStart(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextEditor; { { obj.MoveLineStart(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_MoveLineEnd(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextEditor; { { obj.MoveLineEnd(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_MoveGraphicalLineStart(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextEditor; { { obj.MoveGraphicalLineStart(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_MoveGraphicalLineEnd(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextEditor; { { obj.MoveGraphicalLineEnd(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_MoveTextStart(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextEditor; { { obj.MoveTextStart(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_MoveTextEnd(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextEditor; { { obj.MoveTextEnd(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_MoveParagraphForward(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextEditor; { { obj.MoveParagraphForward(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_MoveParagraphBackward(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextEditor; { { obj.MoveParagraphBackward(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_MoveCursorToPosition(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextEditor; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); obj.MoveCursorToPosition(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_MoveAltCursorToPosition(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextEditor; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); obj.MoveAltCursorToPosition(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_IsOverSelection(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextEditor; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var result = obj.IsOverSelection(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SelectToPosition(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextEditor; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); obj.SelectToPosition(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SelectLeft(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextEditor; { { obj.SelectLeft(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SelectRight(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextEditor; { { obj.SelectRight(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SelectUp(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextEditor; { { obj.SelectUp(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SelectDown(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextEditor; { { obj.SelectDown(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SelectTextEnd(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextEditor; { { obj.SelectTextEnd(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SelectTextStart(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextEditor; { { obj.SelectTextStart(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_MouseDragSelectsWholeWords(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextEditor; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetBoolean(false); obj.MouseDragSelectsWholeWords(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_DblClickSnap(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextEditor; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = (UnityEngine.TextEditor.DblClickSnapping)argHelper0.GetByte(false); obj.DblClickSnap(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_MoveWordRight(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextEditor; { { obj.MoveWordRight(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_MoveToStartOfNextWord(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextEditor; { { obj.MoveToStartOfNextWord(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_MoveToEndOfPreviousWord(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextEditor; { { obj.MoveToEndOfPreviousWord(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SelectToStartOfNextWord(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextEditor; { { obj.SelectToStartOfNextWord(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SelectToEndOfPreviousWord(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextEditor; { { obj.SelectToEndOfPreviousWord(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_FindStartOfNextWord(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextEditor; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); var result = obj.FindStartOfNextWord(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_MoveWordLeft(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextEditor; { { obj.MoveWordLeft(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SelectWordRight(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextEditor; { { obj.SelectWordRight(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SelectWordLeft(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextEditor; { { obj.SelectWordLeft(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ExpandSelectGraphicalLineStart(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextEditor; { { obj.ExpandSelectGraphicalLineStart(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ExpandSelectGraphicalLineEnd(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextEditor; { { obj.ExpandSelectGraphicalLineEnd(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SelectGraphicalLineStart(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextEditor; { { obj.SelectGraphicalLineStart(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SelectGraphicalLineEnd(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextEditor; { { obj.SelectGraphicalLineEnd(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SelectParagraphForward(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextEditor; { { obj.SelectParagraphForward(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SelectParagraphBackward(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextEditor; { { obj.SelectParagraphBackward(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SelectCurrentWord(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextEditor; { { obj.SelectCurrentWord(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SelectCurrentParagraph(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextEditor; { { obj.SelectCurrentParagraph(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_UpdateScrollOffsetIfNeeded(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextEditor; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Event>(false); obj.UpdateScrollOffsetIfNeeded(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_DrawCursor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextEditor; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetString(false); obj.DrawCursor(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SaveBackup(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextEditor; { { obj.SaveBackup(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Undo(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextEditor; { { obj.Undo(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Cut(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextEditor; { { var result = obj.Cut(); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Copy(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextEditor; { { obj.Copy(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Paste(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextEditor; { { var result = obj.Paste(); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_DetectFocusChange(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextEditor; { { obj.DetectFocusChange(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_text(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextEditor; var result = obj.text; Puerts.PuertsDLL.ReturnString(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_text(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextEditor; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.text = argHelper.GetString(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_position(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextEditor; var result = obj.position; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_position(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextEditor; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.position = argHelper.Get<UnityEngine.Rect>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_cursorIndex(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextEditor; var result = obj.cursorIndex; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_cursorIndex(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextEditor; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.cursorIndex = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_selectIndex(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextEditor; var result = obj.selectIndex; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_selectIndex(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextEditor; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.selectIndex = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_doubleClickSnapping(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextEditor; var result = obj.doubleClickSnapping; Puerts.PuertsDLL.ReturnNumber(isolate, info, (byte)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_doubleClickSnapping(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextEditor; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.doubleClickSnapping = (UnityEngine.TextEditor.DblClickSnapping)argHelper.GetByte(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_altCursorPosition(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextEditor; var result = obj.altCursorPosition; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_altCursorPosition(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextEditor; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.altCursorPosition = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_hasSelection(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextEditor; var result = obj.hasSelection; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_SelectedText(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextEditor; var result = obj.SelectedText; Puerts.PuertsDLL.ReturnString(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_keyboardOnScreen(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextEditor; var result = obj.keyboardOnScreen; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_keyboardOnScreen(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextEditor; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.keyboardOnScreen = argHelper.Get<UnityEngine.TouchScreenKeyboard>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_controlID(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextEditor; var result = obj.controlID; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_controlID(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextEditor; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.controlID = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_style(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextEditor; var result = obj.style; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_style(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextEditor; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.style = argHelper.Get<UnityEngine.GUIStyle>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_multiline(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextEditor; var result = obj.multiline; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_multiline(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextEditor; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.multiline = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_hasHorizontalCursorPos(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextEditor; var result = obj.hasHorizontalCursorPos; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_hasHorizontalCursorPos(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextEditor; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.hasHorizontalCursorPos = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_isPasswordField(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextEditor; var result = obj.isPasswordField; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_isPasswordField(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextEditor; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.isPasswordField = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_scrollOffset(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextEditor; var result = obj.scrollOffset; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_scrollOffset(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextEditor; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.scrollOffset = argHelper.Get<UnityEngine.Vector2>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_graphicalCursorPos(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextEditor; var result = obj.graphicalCursorPos; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_graphicalCursorPos(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextEditor; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.graphicalCursorPos = argHelper.Get<UnityEngine.Vector2>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_graphicalSelectCursorPos(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextEditor; var result = obj.graphicalSelectCursorPos; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_graphicalSelectCursorPos(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TextEditor; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.graphicalSelectCursorPos = argHelper.Get<UnityEngine.Vector2>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "OnFocus", IsStatic = false}, M_OnFocus }, { new Puerts.MethodKey {Name = "OnLostFocus", IsStatic = false}, M_OnLostFocus }, { new Puerts.MethodKey {Name = "HandleKeyEvent", IsStatic = false}, M_HandleKeyEvent }, { new Puerts.MethodKey {Name = "DeleteLineBack", IsStatic = false}, M_DeleteLineBack }, { new Puerts.MethodKey {Name = "DeleteWordBack", IsStatic = false}, M_DeleteWordBack }, { new Puerts.MethodKey {Name = "DeleteWordForward", IsStatic = false}, M_DeleteWordForward }, { new Puerts.MethodKey {Name = "Delete", IsStatic = false}, M_Delete }, { new Puerts.MethodKey {Name = "CanPaste", IsStatic = false}, M_CanPaste }, { new Puerts.MethodKey {Name = "Backspace", IsStatic = false}, M_Backspace }, { new Puerts.MethodKey {Name = "SelectAll", IsStatic = false}, M_SelectAll }, { new Puerts.MethodKey {Name = "SelectNone", IsStatic = false}, M_SelectNone }, { new Puerts.MethodKey {Name = "DeleteSelection", IsStatic = false}, M_DeleteSelection }, { new Puerts.MethodKey {Name = "ReplaceSelection", IsStatic = false}, M_ReplaceSelection }, { new Puerts.MethodKey {Name = "Insert", IsStatic = false}, M_Insert }, { new Puerts.MethodKey {Name = "MoveSelectionToAltCursor", IsStatic = false}, M_MoveSelectionToAltCursor }, { new Puerts.MethodKey {Name = "MoveRight", IsStatic = false}, M_MoveRight }, { new Puerts.MethodKey {Name = "MoveLeft", IsStatic = false}, M_MoveLeft }, { new Puerts.MethodKey {Name = "MoveUp", IsStatic = false}, M_MoveUp }, { new Puerts.MethodKey {Name = "MoveDown", IsStatic = false}, M_MoveDown }, { new Puerts.MethodKey {Name = "MoveLineStart", IsStatic = false}, M_MoveLineStart }, { new Puerts.MethodKey {Name = "MoveLineEnd", IsStatic = false}, M_MoveLineEnd }, { new Puerts.MethodKey {Name = "MoveGraphicalLineStart", IsStatic = false}, M_MoveGraphicalLineStart }, { new Puerts.MethodKey {Name = "MoveGraphicalLineEnd", IsStatic = false}, M_MoveGraphicalLineEnd }, { new Puerts.MethodKey {Name = "MoveTextStart", IsStatic = false}, M_MoveTextStart }, { new Puerts.MethodKey {Name = "MoveTextEnd", IsStatic = false}, M_MoveTextEnd }, { new Puerts.MethodKey {Name = "MoveParagraphForward", IsStatic = false}, M_MoveParagraphForward }, { new Puerts.MethodKey {Name = "MoveParagraphBackward", IsStatic = false}, M_MoveParagraphBackward }, { new Puerts.MethodKey {Name = "MoveCursorToPosition", IsStatic = false}, M_MoveCursorToPosition }, { new Puerts.MethodKey {Name = "MoveAltCursorToPosition", IsStatic = false}, M_MoveAltCursorToPosition }, { new Puerts.MethodKey {Name = "IsOverSelection", IsStatic = false}, M_IsOverSelection }, { new Puerts.MethodKey {Name = "SelectToPosition", IsStatic = false}, M_SelectToPosition }, { new Puerts.MethodKey {Name = "SelectLeft", IsStatic = false}, M_SelectLeft }, { new Puerts.MethodKey {Name = "SelectRight", IsStatic = false}, M_SelectRight }, { new Puerts.MethodKey {Name = "SelectUp", IsStatic = false}, M_SelectUp }, { new Puerts.MethodKey {Name = "SelectDown", IsStatic = false}, M_SelectDown }, { new Puerts.MethodKey {Name = "SelectTextEnd", IsStatic = false}, M_SelectTextEnd }, { new Puerts.MethodKey {Name = "SelectTextStart", IsStatic = false}, M_SelectTextStart }, { new Puerts.MethodKey {Name = "MouseDragSelectsWholeWords", IsStatic = false}, M_MouseDragSelectsWholeWords }, { new Puerts.MethodKey {Name = "DblClickSnap", IsStatic = false}, M_DblClickSnap }, { new Puerts.MethodKey {Name = "MoveWordRight", IsStatic = false}, M_MoveWordRight }, { new Puerts.MethodKey {Name = "MoveToStartOfNextWord", IsStatic = false}, M_MoveToStartOfNextWord }, { new Puerts.MethodKey {Name = "MoveToEndOfPreviousWord", IsStatic = false}, M_MoveToEndOfPreviousWord }, { new Puerts.MethodKey {Name = "SelectToStartOfNextWord", IsStatic = false}, M_SelectToStartOfNextWord }, { new Puerts.MethodKey {Name = "SelectToEndOfPreviousWord", IsStatic = false}, M_SelectToEndOfPreviousWord }, { new Puerts.MethodKey {Name = "FindStartOfNextWord", IsStatic = false}, M_FindStartOfNextWord }, { new Puerts.MethodKey {Name = "MoveWordLeft", IsStatic = false}, M_MoveWordLeft }, { new Puerts.MethodKey {Name = "SelectWordRight", IsStatic = false}, M_SelectWordRight }, { new Puerts.MethodKey {Name = "SelectWordLeft", IsStatic = false}, M_SelectWordLeft }, { new Puerts.MethodKey {Name = "ExpandSelectGraphicalLineStart", IsStatic = false}, M_ExpandSelectGraphicalLineStart }, { new Puerts.MethodKey {Name = "ExpandSelectGraphicalLineEnd", IsStatic = false}, M_ExpandSelectGraphicalLineEnd }, { new Puerts.MethodKey {Name = "SelectGraphicalLineStart", IsStatic = false}, M_SelectGraphicalLineStart }, { new Puerts.MethodKey {Name = "SelectGraphicalLineEnd", IsStatic = false}, M_SelectGraphicalLineEnd }, { new Puerts.MethodKey {Name = "SelectParagraphForward", IsStatic = false}, M_SelectParagraphForward }, { new Puerts.MethodKey {Name = "SelectParagraphBackward", IsStatic = false}, M_SelectParagraphBackward }, { new Puerts.MethodKey {Name = "SelectCurrentWord", IsStatic = false}, M_SelectCurrentWord }, { new Puerts.MethodKey {Name = "SelectCurrentParagraph", IsStatic = false}, M_SelectCurrentParagraph }, { new Puerts.MethodKey {Name = "UpdateScrollOffsetIfNeeded", IsStatic = false}, M_UpdateScrollOffsetIfNeeded }, { new Puerts.MethodKey {Name = "DrawCursor", IsStatic = false}, M_DrawCursor }, { new Puerts.MethodKey {Name = "SaveBackup", IsStatic = false}, M_SaveBackup }, { new Puerts.MethodKey {Name = "Undo", IsStatic = false}, M_Undo }, { new Puerts.MethodKey {Name = "Cut", IsStatic = false}, M_Cut }, { new Puerts.MethodKey {Name = "Copy", IsStatic = false}, M_Copy }, { new Puerts.MethodKey {Name = "Paste", IsStatic = false}, M_Paste }, { new Puerts.MethodKey {Name = "DetectFocusChange", IsStatic = false}, M_DetectFocusChange }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"text", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_text, Setter = S_text} }, {"position", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_position, Setter = S_position} }, {"cursorIndex", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_cursorIndex, Setter = S_cursorIndex} }, {"selectIndex", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_selectIndex, Setter = S_selectIndex} }, {"doubleClickSnapping", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_doubleClickSnapping, Setter = S_doubleClickSnapping} }, {"altCursorPosition", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_altCursorPosition, Setter = S_altCursorPosition} }, {"hasSelection", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_hasSelection, Setter = null} }, {"SelectedText", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_SelectedText, Setter = null} }, {"keyboardOnScreen", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_keyboardOnScreen, Setter = S_keyboardOnScreen} }, {"controlID", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_controlID, Setter = S_controlID} }, {"style", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_style, Setter = S_style} }, {"multiline", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_multiline, Setter = S_multiline} }, {"hasHorizontalCursorPos", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_hasHorizontalCursorPos, Setter = S_hasHorizontalCursorPos} }, {"isPasswordField", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_isPasswordField, Setter = S_isPasswordField} }, {"scrollOffset", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_scrollOffset, Setter = S_scrollOffset} }, {"graphicalCursorPos", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_graphicalCursorPos, Setter = S_graphicalCursorPos} }, {"graphicalSelectCursorPos", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_graphicalSelectCursorPos, Setter = S_graphicalSelectCursorPos} }, } }; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_ParticleSystem_LimitVelocityOverLifetimeModule_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_ParticleSystem_LimitVelocityOverLifetimeModule_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.ParticleSystem.LimitVelocityOverLifetimeModule constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_enabled(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.LimitVelocityOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.enabled; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_enabled(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.LimitVelocityOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.enabled = argHelper.GetBoolean(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_limitX(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.LimitVelocityOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.limitX; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_limitX(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.LimitVelocityOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.limitX = argHelper.Get<UnityEngine.ParticleSystem.MinMaxCurve>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_limitXMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.LimitVelocityOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.limitXMultiplier; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_limitXMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.LimitVelocityOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.limitXMultiplier = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_limitY(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.LimitVelocityOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.limitY; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_limitY(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.LimitVelocityOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.limitY = argHelper.Get<UnityEngine.ParticleSystem.MinMaxCurve>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_limitYMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.LimitVelocityOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.limitYMultiplier; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_limitYMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.LimitVelocityOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.limitYMultiplier = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_limitZ(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.LimitVelocityOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.limitZ; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_limitZ(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.LimitVelocityOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.limitZ = argHelper.Get<UnityEngine.ParticleSystem.MinMaxCurve>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_limitZMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.LimitVelocityOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.limitZMultiplier; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_limitZMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.LimitVelocityOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.limitZMultiplier = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_limit(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.LimitVelocityOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.limit; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_limit(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.LimitVelocityOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.limit = argHelper.Get<UnityEngine.ParticleSystem.MinMaxCurve>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_limitMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.LimitVelocityOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.limitMultiplier; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_limitMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.LimitVelocityOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.limitMultiplier = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_dampen(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.LimitVelocityOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.dampen; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_dampen(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.LimitVelocityOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.dampen = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_separateAxes(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.LimitVelocityOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.separateAxes; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_separateAxes(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.LimitVelocityOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.separateAxes = argHelper.GetBoolean(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_space(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.LimitVelocityOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.space; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_space(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.LimitVelocityOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.space = (UnityEngine.ParticleSystemSimulationSpace)argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_drag(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.LimitVelocityOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.drag; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_drag(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.LimitVelocityOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.drag = argHelper.Get<UnityEngine.ParticleSystem.MinMaxCurve>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_dragMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.LimitVelocityOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.dragMultiplier; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_dragMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.LimitVelocityOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.dragMultiplier = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_multiplyDragByParticleSize(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.LimitVelocityOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.multiplyDragByParticleSize; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_multiplyDragByParticleSize(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.LimitVelocityOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.multiplyDragByParticleSize = argHelper.GetBoolean(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_multiplyDragByParticleVelocity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.LimitVelocityOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.multiplyDragByParticleVelocity; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_multiplyDragByParticleVelocity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.LimitVelocityOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.multiplyDragByParticleVelocity = argHelper.GetBoolean(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"enabled", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_enabled, Setter = S_enabled} }, {"limitX", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_limitX, Setter = S_limitX} }, {"limitXMultiplier", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_limitXMultiplier, Setter = S_limitXMultiplier} }, {"limitY", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_limitY, Setter = S_limitY} }, {"limitYMultiplier", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_limitYMultiplier, Setter = S_limitYMultiplier} }, {"limitZ", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_limitZ, Setter = S_limitZ} }, {"limitZMultiplier", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_limitZMultiplier, Setter = S_limitZMultiplier} }, {"limit", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_limit, Setter = S_limit} }, {"limitMultiplier", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_limitMultiplier, Setter = S_limitMultiplier} }, {"dampen", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_dampen, Setter = S_dampen} }, {"separateAxes", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_separateAxes, Setter = S_separateAxes} }, {"space", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_space, Setter = S_space} }, {"drag", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_drag, Setter = S_drag} }, {"dragMultiplier", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_dragMultiplier, Setter = S_dragMultiplier} }, {"multiplyDragByParticleSize", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_multiplyDragByParticleSize, Setter = S_multiplyDragByParticleSize} }, {"multiplyDragByParticleVelocity", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_multiplyDragByParticleVelocity, Setter = S_multiplyDragByParticleVelocity} }, } }; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_DrivenRectTransformTracker_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_DrivenRectTransformTracker_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.DrivenRectTransformTracker constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Add(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.DrivenRectTransformTracker)Puerts.Utils.GetSelf((int)data, self); { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.Get<UnityEngine.Object>(false); var Arg1 = argHelper1.Get<UnityEngine.RectTransform>(false); var Arg2 = (UnityEngine.DrivenTransformProperties)argHelper2.GetInt32(false); obj.Add(Arg0,Arg1,Arg2); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Clear(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.DrivenRectTransformTracker)Puerts.Utils.GetSelf((int)data, self); { { obj.Clear(); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "Add", IsStatic = false}, M_Add }, { new Puerts.MethodKey {Name = "Clear", IsStatic = false}, M_Clear }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { } }; } } } <|start_filename|>Projects/Lua_Unity_xlua_lua/Assets/Lua/Gen/TbTestNull.lua<|end_filename|> return { [1] = {id=1,}, [2] = {id=2,x1=1,x2=1,x3={x1=3,},x4={ _name='DemoD2',x1=1,x2=2,},}, } <|start_filename|>Projects/GenerateDatas/convert_lua/item.TbItemExtra/1022200001.lua<|end_filename|> return { _name = 'TreasureBox', id = 1022200001, key_item_id = 1022300001, open_level = { level = 5, }, use_on_obtain = true, drop_ids = { 1, }, choose_list = { }, } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_Screen_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_Screen_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.Screen(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.Screen), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_SetResolution(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = (UnityEngine.FullScreenMode)argHelper2.GetInt32(false); var Arg3 = argHelper3.GetInt32(false); UnityEngine.Screen.SetResolution(Arg0,Arg1,Arg2,Arg3); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetBoolean(false); var Arg3 = argHelper3.GetInt32(false); UnityEngine.Screen.SetResolution(Arg0,Arg1,Arg2,Arg3); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = (UnityEngine.FullScreenMode)argHelper2.GetInt32(false); UnityEngine.Screen.SetResolution(Arg0,Arg1,Arg2); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetBoolean(false); UnityEngine.Screen.SetResolution(Arg0,Arg1,Arg2); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SetResolution"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_width(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Screen.width; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_height(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Screen.height; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_dpi(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Screen.dpi; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_currentResolution(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Screen.currentResolution; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_resolutions(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Screen.resolutions; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_fullScreen(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Screen.fullScreen; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_fullScreen(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.Screen.fullScreen = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_fullScreenMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Screen.fullScreenMode; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_fullScreenMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.Screen.fullScreenMode = (UnityEngine.FullScreenMode)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_safeArea(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Screen.safeArea; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_cutouts(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Screen.cutouts; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_autorotateToPortrait(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Screen.autorotateToPortrait; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_autorotateToPortrait(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.Screen.autorotateToPortrait = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_autorotateToPortraitUpsideDown(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Screen.autorotateToPortraitUpsideDown; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_autorotateToPortraitUpsideDown(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.Screen.autorotateToPortraitUpsideDown = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_autorotateToLandscapeLeft(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Screen.autorotateToLandscapeLeft; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_autorotateToLandscapeLeft(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.Screen.autorotateToLandscapeLeft = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_autorotateToLandscapeRight(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Screen.autorotateToLandscapeRight; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_autorotateToLandscapeRight(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.Screen.autorotateToLandscapeRight = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_orientation(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Screen.orientation; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_orientation(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.Screen.orientation = (UnityEngine.ScreenOrientation)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_sleepTimeout(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Screen.sleepTimeout; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_sleepTimeout(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.Screen.sleepTimeout = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_brightness(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Screen.brightness; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_brightness(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.Screen.brightness = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "SetResolution", IsStatic = true}, F_SetResolution }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"width", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_width, Setter = null} }, {"height", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_height, Setter = null} }, {"dpi", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_dpi, Setter = null} }, {"currentResolution", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_currentResolution, Setter = null} }, {"resolutions", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_resolutions, Setter = null} }, {"fullScreen", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_fullScreen, Setter = S_fullScreen} }, {"fullScreenMode", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_fullScreenMode, Setter = S_fullScreenMode} }, {"safeArea", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_safeArea, Setter = null} }, {"cutouts", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_cutouts, Setter = null} }, {"autorotateToPortrait", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_autorotateToPortrait, Setter = S_autorotateToPortrait} }, {"autorotateToPortraitUpsideDown", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_autorotateToPortraitUpsideDown, Setter = S_autorotateToPortraitUpsideDown} }, {"autorotateToLandscapeLeft", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_autorotateToLandscapeLeft, Setter = S_autorotateToLandscapeLeft} }, {"autorotateToLandscapeRight", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_autorotateToLandscapeRight, Setter = S_autorotateToLandscapeRight} }, {"orientation", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_orientation, Setter = S_orientation} }, {"sleepTimeout", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_sleepTimeout, Setter = S_sleepTimeout} }, {"brightness", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_brightness, Setter = S_brightness} }, } }; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_Texture3D_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_Texture3D_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { if (paramLen == 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = (UnityEngine.Experimental.Rendering.DefaultFormat)argHelper3.GetInt32(false); var Arg4 = (UnityEngine.Experimental.Rendering.TextureCreationFlags)argHelper4.GetInt32(false); var result = new UnityEngine.Texture3D(Arg0,Arg1,Arg2,Arg3,Arg4); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.Texture3D), result); } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = (UnityEngine.Experimental.Rendering.GraphicsFormat)argHelper3.GetInt32(false); var Arg4 = (UnityEngine.Experimental.Rendering.TextureCreationFlags)argHelper4.GetInt32(false); var result = new UnityEngine.Texture3D(Arg0,Arg1,Arg2,Arg3,Arg4); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.Texture3D), result); } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = (UnityEngine.TextureFormat)argHelper3.GetInt32(false); var Arg4 = argHelper4.GetInt32(false); var result = new UnityEngine.Texture3D(Arg0,Arg1,Arg2,Arg3,Arg4); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.Texture3D), result); } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = (UnityEngine.TextureFormat)argHelper3.GetInt32(false); var Arg4 = argHelper4.GetBoolean(false); var result = new UnityEngine.Texture3D(Arg0,Arg1,Arg2,Arg3,Arg4); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.Texture3D), result); } } if (paramLen == 6) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = (UnityEngine.Experimental.Rendering.GraphicsFormat)argHelper3.GetInt32(false); var Arg4 = (UnityEngine.Experimental.Rendering.TextureCreationFlags)argHelper4.GetInt32(false); var Arg5 = argHelper5.GetInt32(false); var result = new UnityEngine.Texture3D(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.Texture3D), result); } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.NativeObject, typeof(System.IntPtr), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = (UnityEngine.TextureFormat)argHelper3.GetInt32(false); var Arg4 = argHelper4.GetInt32(false); var Arg5 = argHelper5.Get<System.IntPtr>(false); var result = new UnityEngine.Texture3D(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.Texture3D), result); } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.NativeObject, typeof(System.IntPtr), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = (UnityEngine.TextureFormat)argHelper3.GetInt32(false); var Arg4 = argHelper4.GetBoolean(false); var Arg5 = argHelper5.Get<System.IntPtr>(false); var result = new UnityEngine.Texture3D(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.Texture3D), result); } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.Texture3D constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_UpdateExternalTexture(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Texture3D; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.IntPtr>(false); obj.UpdateExternalTexture(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetPixels(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Texture3D; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var result = obj.GetPixels(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 0) { { var result = obj.GetPixels(); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetPixels"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetPixels32(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Texture3D; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var result = obj.GetPixels32(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 0) { { var result = obj.GetPixels32(); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetPixels32"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetPixels(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Texture3D; if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Color[]), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Color[]>(false); var Arg1 = argHelper1.GetInt32(false); obj.SetPixels(Arg0,Arg1); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Color[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Color[]>(false); obj.SetPixels(Arg0); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SetPixels"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetPixels32(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Texture3D; if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Color32[]), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Color32[]>(false); var Arg1 = argHelper1.GetInt32(false); obj.SetPixels32(Arg0,Arg1); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Color32[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Color32[]>(false); obj.SetPixels32(Arg0); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SetPixels32"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_CreateExternalTexture(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = (UnityEngine.TextureFormat)argHelper3.GetInt32(false); var Arg4 = argHelper4.GetBoolean(false); var Arg5 = argHelper5.Get<System.IntPtr>(false); var result = UnityEngine.Texture3D.CreateExternalTexture(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Apply(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Texture3D; if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.GetBoolean(false); var Arg1 = argHelper1.GetBoolean(false); obj.Apply(Arg0,Arg1); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.GetBoolean(false); obj.Apply(Arg0); return; } } if (paramLen == 0) { { obj.Apply(); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to Apply"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetPixel(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Texture3D; if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Color), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.Get<UnityEngine.Color>(false); obj.SetPixel(Arg0,Arg1,Arg2,Arg3); return; } } if (paramLen == 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Color), false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.Get<UnityEngine.Color>(false); var Arg4 = argHelper4.GetInt32(false); obj.SetPixel(Arg0,Arg1,Arg2,Arg3,Arg4); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SetPixel"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetPixel(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Texture3D; if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var result = obj.GetPixel(Arg0,Arg1,Arg2); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetInt32(false); var result = obj.GetPixel(Arg0,Arg1,Arg2,Arg3); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetPixel"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetPixelBilinear(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Texture3D; if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.GetFloat(false); var result = obj.GetPixelBilinear(Arg0,Arg1,Arg2); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.GetInt32(false); var result = obj.GetPixelBilinear(Arg0,Arg1,Arg2,Arg3); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetPixelBilinear"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_depth(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Texture3D; var result = obj.depth; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_format(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Texture3D; var result = obj.format; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_isReadable(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Texture3D; var result = obj.isReadable; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "UpdateExternalTexture", IsStatic = false}, M_UpdateExternalTexture }, { new Puerts.MethodKey {Name = "GetPixels", IsStatic = false}, M_GetPixels }, { new Puerts.MethodKey {Name = "GetPixels32", IsStatic = false}, M_GetPixels32 }, { new Puerts.MethodKey {Name = "SetPixels", IsStatic = false}, M_SetPixels }, { new Puerts.MethodKey {Name = "SetPixels32", IsStatic = false}, M_SetPixels32 }, { new Puerts.MethodKey {Name = "CreateExternalTexture", IsStatic = true}, F_CreateExternalTexture }, { new Puerts.MethodKey {Name = "Apply", IsStatic = false}, M_Apply }, { new Puerts.MethodKey {Name = "SetPixel", IsStatic = false}, M_SetPixel }, { new Puerts.MethodKey {Name = "GetPixel", IsStatic = false}, M_GetPixel }, { new Puerts.MethodKey {Name = "GetPixelBilinear", IsStatic = false}, M_GetPixelBilinear }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"depth", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_depth, Setter = null} }, {"format", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_format, Setter = null} }, {"isReadable", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_isReadable, Setter = null} }, } }; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_UI_Toggle_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_UI_Toggle_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.UI.Toggle constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Rebuild(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Toggle; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = (UnityEngine.UI.CanvasUpdate)argHelper0.GetInt32(false); obj.Rebuild(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_LayoutComplete(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Toggle; { { obj.LayoutComplete(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GraphicUpdateComplete(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Toggle; { { obj.GraphicUpdateComplete(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetIsOnWithoutNotify(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Toggle; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetBoolean(false); obj.SetIsOnWithoutNotify(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_OnPointerClick(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Toggle; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.EventSystems.PointerEventData>(false); obj.OnPointerClick(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_OnSubmit(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Toggle; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.EventSystems.BaseEventData>(false); obj.OnSubmit(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_group(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Toggle; var result = obj.group; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_group(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Toggle; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.group = argHelper.Get<UnityEngine.UI.ToggleGroup>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_isOn(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Toggle; var result = obj.isOn; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_isOn(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Toggle; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.isOn = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_toggleTransition(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Toggle; var result = obj.toggleTransition; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_toggleTransition(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Toggle; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.toggleTransition = (UnityEngine.UI.Toggle.ToggleTransition)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_graphic(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Toggle; var result = obj.graphic; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_graphic(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Toggle; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.graphic = argHelper.Get<UnityEngine.UI.Graphic>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_onValueChanged(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Toggle; var result = obj.onValueChanged; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_onValueChanged(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Toggle; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.onValueChanged = argHelper.Get<UnityEngine.UI.Toggle.ToggleEvent>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "Rebuild", IsStatic = false}, M_Rebuild }, { new Puerts.MethodKey {Name = "LayoutComplete", IsStatic = false}, M_LayoutComplete }, { new Puerts.MethodKey {Name = "GraphicUpdateComplete", IsStatic = false}, M_GraphicUpdateComplete }, { new Puerts.MethodKey {Name = "SetIsOnWithoutNotify", IsStatic = false}, M_SetIsOnWithoutNotify }, { new Puerts.MethodKey {Name = "OnPointerClick", IsStatic = false}, M_OnPointerClick }, { new Puerts.MethodKey {Name = "OnSubmit", IsStatic = false}, M_OnSubmit }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"group", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_group, Setter = S_group} }, {"isOn", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_isOn, Setter = S_isOn} }, {"toggleTransition", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_toggleTransition, Setter = S_toggleTransition} }, {"graphic", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_graphic, Setter = S_graphic} }, {"onValueChanged", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_onValueChanged, Setter = S_onValueChanged} }, } }; } } } <|start_filename|>Projects/DataTemplates/template_json/role_tbrolelevelbonuscoefficient.json<|end_filename|> { "1001": {"id":1001,"distinct_bonus_infos":[{"effective_level":1,"bonus_info":[{"type":4,"coefficient":1},{"type":2,"coefficient":1}]},{"effective_level":10,"bonus_info":[{"type":4,"coefficient":1.5},{"type":2,"coefficient":2}]},{"effective_level":20,"bonus_info":[{"type":4,"coefficient":2},{"type":2,"coefficient":3}]},{"effective_level":30,"bonus_info":[{"type":4,"coefficient":2.5},{"type":2,"coefficient":4}]},{"effective_level":40,"bonus_info":[{"type":4,"coefficient":3},{"type":2,"coefficient":5}]},{"effective_level":50,"bonus_info":[{"type":4,"coefficient":3.5},{"type":2,"coefficient":6}]},{"effective_level":60,"bonus_info":[{"type":4,"coefficient":4},{"type":2,"coefficient":7}]}]} } <|start_filename|>run_luban_server.bat<|end_filename|> call Tools\Luban.ClientServer\Luban.Server.exe pause <|start_filename|>Projects/GenerateDatas/convert_lua/error.TbCodeInfo/304.lua<|end_filename|> return { code = 304, key = "OVER_TIME", } <|start_filename|>Projects/GenerateDatas/convert_lua/role.TbRoleLevelExpAttr/78.lua<|end_filename|> return { level = 78, need_exp = 215000, clothes_attrs = { 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, }, } <|start_filename|>ProtoProjects/go/src/bright/math/Vector2.go<|end_filename|> package math type Vector2 struct { X float32 Y float32 } func NewVector2(x float32, y float32) Vector2 { return Vector2{X: x, Y: y} } <|start_filename|>Projects/DataTemplates/template_erlang2/role_tbrolelevelexpattr.erl<|end_filename|> %% role.TbRoleLevelExpAttr -module(role_tbrolelevelexpattr) -export([get/1,get_ids/0]) get(1) -> #{ level => 1, need_exp => 0, clothes_attrs => array }. get(2) -> #{ level => 2, need_exp => 100, clothes_attrs => array }. get(3) -> #{ level => 3, need_exp => 200, clothes_attrs => array }. get(4) -> #{ level => 4, need_exp => 300, clothes_attrs => array }. get(5) -> #{ level => 5, need_exp => 400, clothes_attrs => array }. get(6) -> #{ level => 6, need_exp => 500, clothes_attrs => array }. get(7) -> #{ level => 7, need_exp => 700, clothes_attrs => array }. get(8) -> #{ level => 8, need_exp => 900, clothes_attrs => array }. get(9) -> #{ level => 9, need_exp => 1100, clothes_attrs => array }. get(10) -> #{ level => 10, need_exp => 1300, clothes_attrs => array }. get(11) -> #{ level => 11, need_exp => 1500, clothes_attrs => array }. get(12) -> #{ level => 12, need_exp => 2000, clothes_attrs => array }. get(13) -> #{ level => 13, need_exp => 2500, clothes_attrs => array }. get(14) -> #{ level => 14, need_exp => 3000, clothes_attrs => array }. get(15) -> #{ level => 15, need_exp => 3500, clothes_attrs => array }. get(16) -> #{ level => 16, need_exp => 4000, clothes_attrs => array }. get(17) -> #{ level => 17, need_exp => 4500, clothes_attrs => array }. get(18) -> #{ level => 18, need_exp => 5000, clothes_attrs => array }. get(19) -> #{ level => 19, need_exp => 5500, clothes_attrs => array }. get(20) -> #{ level => 20, need_exp => 6000, clothes_attrs => array }. get(21) -> #{ level => 21, need_exp => 6500, clothes_attrs => array }. get(22) -> #{ level => 22, need_exp => 7000, clothes_attrs => array }. get(23) -> #{ level => 23, need_exp => 7500, clothes_attrs => array }. get(24) -> #{ level => 24, need_exp => 8000, clothes_attrs => array }. get(25) -> #{ level => 25, need_exp => 8500, clothes_attrs => array }. get(26) -> #{ level => 26, need_exp => 9000, clothes_attrs => array }. get(27) -> #{ level => 27, need_exp => 9500, clothes_attrs => array }. get(28) -> #{ level => 28, need_exp => 10000, clothes_attrs => array }. get(29) -> #{ level => 29, need_exp => 11000, clothes_attrs => array }. get(30) -> #{ level => 30, need_exp => 12000, clothes_attrs => array }. get(31) -> #{ level => 31, need_exp => 13000, clothes_attrs => array }. get(32) -> #{ level => 32, need_exp => 14000, clothes_attrs => array }. get(33) -> #{ level => 33, need_exp => 15000, clothes_attrs => array }. get(34) -> #{ level => 34, need_exp => 17000, clothes_attrs => array }. get(35) -> #{ level => 35, need_exp => 19000, clothes_attrs => array }. get(36) -> #{ level => 36, need_exp => 21000, clothes_attrs => array }. get(37) -> #{ level => 37, need_exp => 23000, clothes_attrs => array }. get(38) -> #{ level => 38, need_exp => 25000, clothes_attrs => array }. get(39) -> #{ level => 39, need_exp => 28000, clothes_attrs => array }. get(40) -> #{ level => 40, need_exp => 31000, clothes_attrs => array }. get(41) -> #{ level => 41, need_exp => 34000, clothes_attrs => array }. get(42) -> #{ level => 42, need_exp => 37000, clothes_attrs => array }. get(43) -> #{ level => 43, need_exp => 40000, clothes_attrs => array }. get(44) -> #{ level => 44, need_exp => 45000, clothes_attrs => array }. get(45) -> #{ level => 45, need_exp => 50000, clothes_attrs => array }. get(46) -> #{ level => 46, need_exp => 55000, clothes_attrs => array }. get(47) -> #{ level => 47, need_exp => 60000, clothes_attrs => array }. get(48) -> #{ level => 48, need_exp => 65000, clothes_attrs => array }. get(49) -> #{ level => 49, need_exp => 70000, clothes_attrs => array }. get(50) -> #{ level => 50, need_exp => 75000, clothes_attrs => array }. get(51) -> #{ level => 51, need_exp => 80000, clothes_attrs => array }. get(52) -> #{ level => 52, need_exp => 85000, clothes_attrs => array }. get(53) -> #{ level => 53, need_exp => 90000, clothes_attrs => array }. get(54) -> #{ level => 54, need_exp => 95000, clothes_attrs => array }. get(55) -> #{ level => 55, need_exp => 100000, clothes_attrs => array }. get(56) -> #{ level => 56, need_exp => 105000, clothes_attrs => array }. get(57) -> #{ level => 57, need_exp => 110000, clothes_attrs => array }. get(58) -> #{ level => 58, need_exp => 115000, clothes_attrs => array }. get(59) -> #{ level => 59, need_exp => 120000, clothes_attrs => array }. get(60) -> #{ level => 60, need_exp => 125000, clothes_attrs => array }. get(61) -> #{ level => 61, need_exp => 130000, clothes_attrs => array }. get(62) -> #{ level => 62, need_exp => 135000, clothes_attrs => array }. get(63) -> #{ level => 63, need_exp => 140000, clothes_attrs => array }. get(64) -> #{ level => 64, need_exp => 145000, clothes_attrs => array }. get(65) -> #{ level => 65, need_exp => 150000, clothes_attrs => array }. get(66) -> #{ level => 66, need_exp => 155000, clothes_attrs => array }. get(67) -> #{ level => 67, need_exp => 160000, clothes_attrs => array }. get(68) -> #{ level => 68, need_exp => 165000, clothes_attrs => array }. get(69) -> #{ level => 69, need_exp => 170000, clothes_attrs => array }. get(70) -> #{ level => 70, need_exp => 175000, clothes_attrs => array }. get(71) -> #{ level => 71, need_exp => 180000, clothes_attrs => array }. get(72) -> #{ level => 72, need_exp => 185000, clothes_attrs => array }. get(73) -> #{ level => 73, need_exp => 190000, clothes_attrs => array }. get(74) -> #{ level => 74, need_exp => 195000, clothes_attrs => array }. get(75) -> #{ level => 75, need_exp => 200000, clothes_attrs => array }. get(76) -> #{ level => 76, need_exp => 205000, clothes_attrs => array }. get(77) -> #{ level => 77, need_exp => 210000, clothes_attrs => array }. get(78) -> #{ level => 78, need_exp => 215000, clothes_attrs => array }. get(79) -> #{ level => 79, need_exp => 220000, clothes_attrs => array }. get(80) -> #{ level => 80, need_exp => 225000, clothes_attrs => array }. get(81) -> #{ level => 81, need_exp => 230000, clothes_attrs => array }. get(82) -> #{ level => 82, need_exp => 235000, clothes_attrs => array }. get(83) -> #{ level => 83, need_exp => 240000, clothes_attrs => array }. get(84) -> #{ level => 84, need_exp => 245000, clothes_attrs => array }. get(85) -> #{ level => 85, need_exp => 250000, clothes_attrs => array }. get(86) -> #{ level => 86, need_exp => 255000, clothes_attrs => array }. get(87) -> #{ level => 87, need_exp => 260000, clothes_attrs => array }. get(88) -> #{ level => 88, need_exp => 265000, clothes_attrs => array }. get(89) -> #{ level => 89, need_exp => 270000, clothes_attrs => array }. get(90) -> #{ level => 90, need_exp => 275000, clothes_attrs => array }. get(91) -> #{ level => 91, need_exp => 280000, clothes_attrs => array }. get(92) -> #{ level => 92, need_exp => 285000, clothes_attrs => array }. get(93) -> #{ level => 93, need_exp => 290000, clothes_attrs => array }. get(94) -> #{ level => 94, need_exp => 295000, clothes_attrs => array }. get(95) -> #{ level => 95, need_exp => 300000, clothes_attrs => array }. get(96) -> #{ level => 96, need_exp => 305000, clothes_attrs => array }. get(97) -> #{ level => 97, need_exp => 310000, clothes_attrs => array }. get(98) -> #{ level => 98, need_exp => 315000, clothes_attrs => array }. get(99) -> #{ level => 99, need_exp => 320000, clothes_attrs => array }. get(100) -> #{ level => 100, need_exp => 325000, clothes_attrs => array }. get_ids() -> [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100]. <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_ParticleSystem_NoiseModule_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_ParticleSystem_NoiseModule_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.ParticleSystem.NoiseModule constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_enabled(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.NoiseModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.enabled; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_enabled(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.NoiseModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.enabled = argHelper.GetBoolean(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_separateAxes(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.NoiseModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.separateAxes; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_separateAxes(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.NoiseModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.separateAxes = argHelper.GetBoolean(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_strength(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.NoiseModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.strength; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_strength(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.NoiseModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.strength = argHelper.Get<UnityEngine.ParticleSystem.MinMaxCurve>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_strengthMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.NoiseModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.strengthMultiplier; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_strengthMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.NoiseModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.strengthMultiplier = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_strengthX(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.NoiseModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.strengthX; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_strengthX(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.NoiseModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.strengthX = argHelper.Get<UnityEngine.ParticleSystem.MinMaxCurve>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_strengthXMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.NoiseModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.strengthXMultiplier; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_strengthXMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.NoiseModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.strengthXMultiplier = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_strengthY(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.NoiseModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.strengthY; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_strengthY(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.NoiseModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.strengthY = argHelper.Get<UnityEngine.ParticleSystem.MinMaxCurve>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_strengthYMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.NoiseModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.strengthYMultiplier; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_strengthYMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.NoiseModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.strengthYMultiplier = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_strengthZ(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.NoiseModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.strengthZ; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_strengthZ(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.NoiseModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.strengthZ = argHelper.Get<UnityEngine.ParticleSystem.MinMaxCurve>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_strengthZMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.NoiseModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.strengthZMultiplier; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_strengthZMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.NoiseModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.strengthZMultiplier = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_frequency(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.NoiseModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.frequency; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_frequency(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.NoiseModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.frequency = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_damping(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.NoiseModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.damping; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_damping(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.NoiseModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.damping = argHelper.GetBoolean(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_octaveCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.NoiseModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.octaveCount; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_octaveCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.NoiseModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.octaveCount = argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_octaveMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.NoiseModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.octaveMultiplier; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_octaveMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.NoiseModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.octaveMultiplier = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_octaveScale(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.NoiseModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.octaveScale; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_octaveScale(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.NoiseModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.octaveScale = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_quality(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.NoiseModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.quality; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_quality(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.NoiseModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.quality = (UnityEngine.ParticleSystemNoiseQuality)argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_scrollSpeed(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.NoiseModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.scrollSpeed; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_scrollSpeed(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.NoiseModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.scrollSpeed = argHelper.Get<UnityEngine.ParticleSystem.MinMaxCurve>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_scrollSpeedMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.NoiseModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.scrollSpeedMultiplier; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_scrollSpeedMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.NoiseModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.scrollSpeedMultiplier = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_remapEnabled(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.NoiseModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.remapEnabled; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_remapEnabled(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.NoiseModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.remapEnabled = argHelper.GetBoolean(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_remap(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.NoiseModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.remap; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_remap(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.NoiseModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.remap = argHelper.Get<UnityEngine.ParticleSystem.MinMaxCurve>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_remapMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.NoiseModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.remapMultiplier; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_remapMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.NoiseModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.remapMultiplier = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_remapX(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.NoiseModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.remapX; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_remapX(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.NoiseModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.remapX = argHelper.Get<UnityEngine.ParticleSystem.MinMaxCurve>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_remapXMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.NoiseModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.remapXMultiplier; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_remapXMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.NoiseModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.remapXMultiplier = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_remapY(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.NoiseModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.remapY; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_remapY(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.NoiseModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.remapY = argHelper.Get<UnityEngine.ParticleSystem.MinMaxCurve>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_remapYMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.NoiseModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.remapYMultiplier; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_remapYMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.NoiseModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.remapYMultiplier = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_remapZ(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.NoiseModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.remapZ; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_remapZ(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.NoiseModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.remapZ = argHelper.Get<UnityEngine.ParticleSystem.MinMaxCurve>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_remapZMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.NoiseModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.remapZMultiplier; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_remapZMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.NoiseModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.remapZMultiplier = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_positionAmount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.NoiseModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.positionAmount; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_positionAmount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.NoiseModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.positionAmount = argHelper.Get<UnityEngine.ParticleSystem.MinMaxCurve>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_rotationAmount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.NoiseModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.rotationAmount; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_rotationAmount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.NoiseModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.rotationAmount = argHelper.Get<UnityEngine.ParticleSystem.MinMaxCurve>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_sizeAmount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.NoiseModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.sizeAmount; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_sizeAmount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.NoiseModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.sizeAmount = argHelper.Get<UnityEngine.ParticleSystem.MinMaxCurve>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"enabled", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_enabled, Setter = S_enabled} }, {"separateAxes", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_separateAxes, Setter = S_separateAxes} }, {"strength", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_strength, Setter = S_strength} }, {"strengthMultiplier", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_strengthMultiplier, Setter = S_strengthMultiplier} }, {"strengthX", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_strengthX, Setter = S_strengthX} }, {"strengthXMultiplier", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_strengthXMultiplier, Setter = S_strengthXMultiplier} }, {"strengthY", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_strengthY, Setter = S_strengthY} }, {"strengthYMultiplier", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_strengthYMultiplier, Setter = S_strengthYMultiplier} }, {"strengthZ", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_strengthZ, Setter = S_strengthZ} }, {"strengthZMultiplier", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_strengthZMultiplier, Setter = S_strengthZMultiplier} }, {"frequency", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_frequency, Setter = S_frequency} }, {"damping", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_damping, Setter = S_damping} }, {"octaveCount", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_octaveCount, Setter = S_octaveCount} }, {"octaveMultiplier", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_octaveMultiplier, Setter = S_octaveMultiplier} }, {"octaveScale", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_octaveScale, Setter = S_octaveScale} }, {"quality", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_quality, Setter = S_quality} }, {"scrollSpeed", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_scrollSpeed, Setter = S_scrollSpeed} }, {"scrollSpeedMultiplier", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_scrollSpeedMultiplier, Setter = S_scrollSpeedMultiplier} }, {"remapEnabled", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_remapEnabled, Setter = S_remapEnabled} }, {"remap", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_remap, Setter = S_remap} }, {"remapMultiplier", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_remapMultiplier, Setter = S_remapMultiplier} }, {"remapX", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_remapX, Setter = S_remapX} }, {"remapXMultiplier", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_remapXMultiplier, Setter = S_remapXMultiplier} }, {"remapY", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_remapY, Setter = S_remapY} }, {"remapYMultiplier", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_remapYMultiplier, Setter = S_remapYMultiplier} }, {"remapZ", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_remapZ, Setter = S_remapZ} }, {"remapZMultiplier", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_remapZMultiplier, Setter = S_remapZMultiplier} }, {"positionAmount", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_positionAmount, Setter = S_positionAmount} }, {"rotationAmount", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_rotationAmount, Setter = S_rotationAmount} }, {"sizeAmount", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_sizeAmount, Setter = S_sizeAmount} }, } }; } } } <|start_filename|>Projects/GenerateDatas/convert_lua/role.TbRoleLevelExpAttr/69.lua<|end_filename|> return { level = 69, need_exp = 170000, clothes_attrs = { 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, }, } <|start_filename|>Projects/Lua_Unity_xlua_bin/Assets/Lua/Main.lua<|end_filename|> local require = require local print = print local C = {} local require = require local assert = assert local pairs = pairs local print = print local tinsert = table.insert local tconcat = table.concat local function ttostring2(x, result) local t = type(x) if t == "table" then tinsert(result, "{") for k, v in pairs(x) do tinsert(result, tostring(k)) tinsert(result, "=") ttostring2(v, result) tinsert(result, ",") end tinsert(result, "}") elseif t == "string" then tinsert(result, x) else tinsert(result, tostring(x)) end end function ttostring(t) local out = {} ttostring2(t, out) return tconcat(out) end ByteBuf = CS.Bright.Serialization.ByteBuf local byteBufIns = ByteBuf() local byteBufFuns = { readBool = byteBufIns.ReadBool, writeBool = byteBufIns.WriteBool, readByte = byteBufIns.ReadByte, writeByte = byteBufIns.WriteByte, readShort = byteBufIns.ReadShort, writeShort = byteBufIns.WriteShort, readFshort = byteBufIns.ReadFshort, writeInt = byteBufIns.WriteInt, readInt = byteBufIns.ReadInt, writeFint = byteBufIns.WriteFint, readFint = byteBufIns.ReadFint, readLong = byteBufIns.ReadLong, writeLong = byteBufIns.WriteLong, readFlong = byteBufIns.ReadFlong, writeFlong = byteBufIns.WriteFlong, readFloat = byteBufIns.ReadFloat, writeFloat = byteBufIns.WriteFloat, readDouble = byteBufIns.ReadDouble, writeDouble = byteBufIns.WriteDouble, readSize = byteBufIns.ReadSize, writeSize = byteBufIns.WriteSize, readString = byteBufIns.ReadString, writeString = byteBufIns.WriteString, readBytes = byteBufIns.ReadBytes, writeBytes = byteBufIns.WriteBytes } function read_file_all_bytes(fileName) local file = io.open(fileName, "rb") local bytes = file:read("*a") file:close() return bytes end local enumDefs = {} local constDefs = {} local tables = {} ---@param configPath string ---@param configFileloader function function Load(typeDefs, configFileloader) local configPath = CS.UnityEngine.Application.dataPath .. "/../../GenerateDatas/bin/" enumDefs = typeDefs.enums constDefs = typeDefs.consts local buf = ByteBuf() local tableDefs = typeDefs.tables local beanDefs = typeDefs.beans for _, t in pairs(tableDefs) do --print("load table:", ttostring(t)) buf:Clear() buf:WriteBytesWithoutSize(read_file_all_bytes(configPath .. "/" .. t.file .. ".bytes")) local valueType = beanDefs[t.value_type] local mode = t.mode local tableDatas if mode == "map" then tableDatas = {} local index = t.index for i = 1, buf:ReadSize() do local v = valueType._deserialize(buf) tableDatas[v[index]] = v end elseif mode == "list" then tableDatas = {} for i = 1, buf:ReadSize() do local v = valueType._deserialize(buf) tinsert(tableDatas, v) end else assert(buf:ReadSize() == 1) tableDatas = valueType._deserialize(buf) end print(ttostring(tableDatas)) tables[t.name] = tableDatas end end ---@param typeName string ---@param key string function GetEnum(typeName, key) local def = enumDefs[typeName] return key and def[key] or def end ---@param typeName string ---@param field string function GetConst(typeName, field) local def = constDefs[typeName] return field and def[field] or constDefs end function GetData(tableName, key1, key2) local tableDatas = tables[tableName] if not key1 then return tableDatas end local value1 = tableDatas[key1] return key2 and value1[key2] or value1 end function C.Start() local cfgTypeDefs = require("Gen.Types").InitTypes(byteBufFuns) Load(cfgTypeDefs) end return C <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_GradientColorKey_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_GradientColorKey_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Color), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Color>(false); var Arg1 = argHelper1.GetFloat(false); var result = new UnityEngine.GradientColorKey(Arg0,Arg1); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.GradientColorKey), result); } } if (paramLen == 0) { { var result = new UnityEngine.GradientColorKey(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.GradientColorKey), result); } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.GradientColorKey constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_color(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.GradientColorKey)Puerts.Utils.GetSelf((int)data, self); var result = obj.color; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_color(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.GradientColorKey)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.color = argHelper.Get<UnityEngine.Color>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_time(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.GradientColorKey)Puerts.Utils.GetSelf((int)data, self); var result = obj.time; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_time(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.GradientColorKey)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.time = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"color", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_color, Setter = S_color} }, {"time", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_time, Setter = S_time} }, } }; } } } <|start_filename|>DesignerConfigs/Datas/test/test_null_datas/21.lua<|end_filename|> return { id=21, } <|start_filename|>Projects/L10N/config_data/test_tbnotindexlist.lua<|end_filename|> return { {x=1,y=2,}, {x=1,y=2,}, {x=2,y=3,}, {x=3,y=4,}, {x=2,y=3,}, } <|start_filename|>Projects/GenerateDatas/convert_lua/role.TbRoleLevelExpAttr/47.lua<|end_filename|> return { level = 47, need_exp = 60000, clothes_attrs = { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, }, } <|start_filename|>Projects/Java_bin/src/main/gen/cfg/test/TestBeRef.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.test; import bright.serialization.*; public final class TestBeRef { public TestBeRef(ByteBuf _buf) { id = _buf.readInt(); count = _buf.readInt(); } public TestBeRef(int id, int count ) { this.id = id; this.count = count; } public final int id; public final int count; public void resolve(java.util.HashMap<String, Object> _tables) { } @Override public String toString() { return "{ " + "id:" + id + "," + "count:" + count + "," + "}"; } } <|start_filename|>Projects/GenerateDatas/convert_json/error.TbErrorInfo/EXAMPLE_DLG_OK.json<|end_filename|> { "code": "EXAMPLE_DLG_OK", "desc": "例子:单按钮提示,用户自己提供回调", "style": { "__type__": "ErrorStyleDlgOk", "btn_name": "联知道了" } } <|start_filename|>Projects/GenerateDatas/convert_lua/error.TbCodeInfo/5.lua<|end_filename|> return { code = 5, key = "SERVER_ACCESS_FAIL", } <|start_filename|>Projects/DataTemplates/template_erlang2/error_tbcodeinfo.erl<|end_filename|> %% error.TbCodeInfo -module(error_tbcodeinfo) -export([get/1,get_ids/0]) get(6) -> #{ code => 6, key => "EXAMPLE_FLASH" }. get(7) -> #{ code => 7, key => "EXAMPLE_MSGBOX" }. get(8) -> #{ code => 8, key => "EXAMPLE_DLG_OK" }. get(9) -> #{ code => 9, key => "EXAMPLE_DLG_OK_CANCEL" }. get(100) -> #{ code => 100, key => "ROLE_CREATE_NAME_INVALID_CHAR" }. get(101) -> #{ code => 101, key => "ROLE_CREATE_NAME_EMPTY" }. get(102) -> #{ code => 102, key => "ROLE_CREATE_NAME_EXCEED_MAX_LENGTH" }. get(103) -> #{ code => 103, key => "ROLE_CREATE_ROLE_LIST_FULL" }. get(104) -> #{ code => 104, key => "ROLE_CREATE_INVALID_PROFESSION" }. get(200) -> #{ code => 200, key => "PARAM_ILLEGAL" }. get(202) -> #{ code => 202, key => "ITEM_CAN_NOT_USE" }. get(204) -> #{ code => 204, key => "BAG_IS_FULL" }. get(205) -> #{ code => 205, key => "ITEM_NOT_ENOUGH" }. get(206) -> #{ code => 206, key => "ITEM_IN_BAG" }. get(300) -> #{ code => 300, key => "GENDER_NOT_MATCH" }. get(301) -> #{ code => 301, key => "LEVEL_TOO_LOW" }. get(302) -> #{ code => 302, key => "LEVEL_TOO_HIGH" }. get(303) -> #{ code => 303, key => "EXCEED_LIMIT" }. get(304) -> #{ code => 304, key => "OVER_TIME" }. get(400) -> #{ code => 400, key => "SKILL_NOT_IN_LIST" }. get(401) -> #{ code => 401, key => "SKILL_NOT_COOLDOWN" }. get(402) -> #{ code => 402, key => "SKILL_TARGET_NOT_EXIST" }. get(403) -> #{ code => 403, key => "SKILL_ANOTHER_CASTING" }. get(700) -> #{ code => 700, key => "MAIL_TYPE_ERROR" }. get(702) -> #{ code => 702, key => "MAIL_HAVE_DELETED" }. get(703) -> #{ code => 703, key => "MAIL_AWARD_HAVE_RECEIVED" }. get(704) -> #{ code => 704, key => "MAIL_OPERATE_TYPE_ERROR" }. get(705) -> #{ code => 705, key => "MAIL_CONDITION_NOT_MEET" }. get(707) -> #{ code => 707, key => "MAIL_NO_AWARD" }. get(708) -> #{ code => 708, key => "MAIL_BOX_IS_FULL" }. get(605) -> #{ code => 605, key => "NO_INTERACTION_COMPONENT" }. get(2) -> #{ code => 2, key => "HAS_BIND_SERVER" }. get(3) -> #{ code => 3, key => "AUTH_FAIL" }. get(4) -> #{ code => 4, key => "NOT_BIND_SERVER" }. get(5) -> #{ code => 5, key => "SERVER_ACCESS_FAIL" }. get(1) -> #{ code => 1, key => "SERVER_NOT_EXISTS" }. get(900) -> #{ code => 900, key => "SUIT_NOT_UNLOCK" }. get(901) -> #{ code => 901, key => "SUIT_COMPONENT_NOT_UNLOCK" }. get(902) -> #{ code => 902, key => "SUIT_STATE_ERROR" }. get(903) -> #{ code => 903, key => "SUIT_COMPONENT_STATE_ERROR" }. get(904) -> #{ code => 904, key => "SUIT_COMPONENT_NO_NEED_LEARN" }. get_ids() -> [6,7,8,9,100,101,102,103,104,200,202,204,205,206,300,301,302,303,304,400,401,402,403,700,702,703,704,705,707,708,605,2,3,4,5,1,900,901,902,903,904]. <|start_filename|>Projects/DataTemplates/template_lua2/test_tbtestnull.lua<|end_filename|> -- test.TbTestNull return { [10] = { id=10, }, [11] = { id=11, }, [12] = { id=12, x1=1, x2=1, x3= { x1=1, }, x4= { x1=2, x2=3, }, s1="asf", s2={key='key1',text="abcdef"}, }, [20] = { id=20, }, [21] = { id=21, }, [22] = { id=22, x1=1, x2=2, x3= { x1=3, }, x4= { x1=1, x2=2, }, s1="asfs", s2={key='/asf/asfa',text="abcdef"}, }, [30] = { id=30, x1=1, x2=1, x3= { x1=1, }, x4= { x1=1, x2=22, }, s1="abcd", s2={key='asdfasew',text="hahaha"}, }, [31] = { id=31, }, [1] = { id=1, }, [2] = { id=2, x1=1, x2=1, x3= { x1=3, }, x4= { x1=1, x2=2, }, s1="asfasfasf", s2={key='/keyasf',text="asf"}, }, [3] = { id=3, s1="", s2={key='',text=""}, }, } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_SplatPrototype_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_SplatPrototype_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.SplatPrototype(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.SplatPrototype), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_texture(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SplatPrototype; var result = obj.texture; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_texture(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SplatPrototype; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.texture = argHelper.Get<UnityEngine.Texture2D>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_normalMap(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SplatPrototype; var result = obj.normalMap; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_normalMap(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SplatPrototype; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.normalMap = argHelper.Get<UnityEngine.Texture2D>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_tileSize(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SplatPrototype; var result = obj.tileSize; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_tileSize(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SplatPrototype; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.tileSize = argHelper.Get<UnityEngine.Vector2>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_tileOffset(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SplatPrototype; var result = obj.tileOffset; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_tileOffset(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SplatPrototype; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.tileOffset = argHelper.Get<UnityEngine.Vector2>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_specular(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SplatPrototype; var result = obj.specular; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_specular(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SplatPrototype; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.specular = argHelper.Get<UnityEngine.Color>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_metallic(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SplatPrototype; var result = obj.metallic; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_metallic(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SplatPrototype; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.metallic = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_smoothness(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SplatPrototype; var result = obj.smoothness; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_smoothness(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SplatPrototype; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.smoothness = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"texture", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_texture, Setter = S_texture} }, {"normalMap", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_normalMap, Setter = S_normalMap} }, {"tileSize", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_tileSize, Setter = S_tileSize} }, {"tileOffset", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_tileOffset, Setter = S_tileOffset} }, {"specular", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_specular, Setter = S_specular} }, {"metallic", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_metallic, Setter = S_metallic} }, {"smoothness", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_smoothness, Setter = S_smoothness} }, } }; } } } <|start_filename|>Projects/DataTemplates/template_lua2/test_tbdefinefromexcelone.lua<|end_filename|> -- test.TbDefineFromExcelOne return { unlock_equip=10, unlock_hero=20, default_avatar="Assets/Icon/DefaultAvatar.png", default_item="Assets/Icon/DefaultAvatar.png", }, <|start_filename|>Projects/Csharp_Unity_bin_use_UnityEngine_Vector/Assets/Main.cs<|end_filename|> using System.Collections; using System.Collections.Generic; using System.IO; using Bright.Serialization; using UnityEngine; public class Main : MonoBehaviour { // Start is called before the first frame update void Start() { var tables = new cfg.Tables(LoadByteBuf); UnityEngine.Debug.LogFormat("item[1].name:{0}", tables.TbItem[1].Name); Debug.LogFormat("bag init capacity:{0}", tables.TbGlobalConfig.BagInitCapacity); UnityEngine.Debug.Log("== load succ=="); } private static ByteBuf LoadByteBuf(string file) { return new ByteBuf(File.ReadAllBytes(Application.dataPath + "/../../GenerateDatas/bin/" + file + ".bytes")); } } <|start_filename|>Projects/DataTemplates/template_erlang2/test_tbtestref.erl<|end_filename|> %% test.TbTestRef -module(test_tbtestref) -export([get/1,get_ids/0]) get(1) -> #{ id => 1, x1 => 1, x1_2 => 1, x2 => 2, a1 => array, a2 => array, b1 => array, b2 => array, c1 => array, c2 => array, d1 => map, d2 => map, e1 => 1, e2 => 11, e3 => "ab5", f1 => 1, f2 => 11, f3 => "ab5" }. get(2) -> #{ id => 2, x1 => 1, x1_2 => 1, x2 => 2, a1 => array, a2 => array, b1 => array, b2 => array, c1 => array, c2 => array, d1 => map, d2 => map, e1 => 1, e2 => 11, e3 => "ab5", f1 => 1, f2 => 11, f3 => "ab5" }. get(3) -> #{ id => 3, x1 => 1, x1_2 => 1, x2 => 2, a1 => array, a2 => array, b1 => array, b2 => array, c1 => array, c2 => array, d1 => map, d2 => map, e1 => 1, e2 => 11, e3 => "ab5", f1 => 1, f2 => 11, f3 => "ab5" }. get_ids() -> [1,2,3]. <|start_filename|>Projects/DataTemplates/template_erlang2/test_tbcompositejsontable1.erl<|end_filename|> %% test.TbCompositeJsonTable1 -module(test_tbcompositejsontable1) -export([get/1,get_ids/0]) get(1) -> #{ id => 1, x => "aaa1" }. get(2) -> #{ id => 2, x => "xx2" }. get(11) -> #{ id => 11, x => "aaa11" }. get(12) -> #{ id => 12, x => "xx12" }. get_ids() -> [1,2,11,12]. <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/ai/DistanceLessThan.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.ai { public sealed partial class DistanceLessThan : ai.Decorator { public DistanceLessThan(ByteBuf _buf) : base(_buf) { Actor1Key = _buf.ReadString(); Actor2Key = _buf.ReadString(); Distance = _buf.ReadFloat(); ReverseResult = _buf.ReadBool(); } public DistanceLessThan(int id, string node_name, ai.EFlowAbortMode flow_abort_mode, string actor1_key, string actor2_key, float distance, bool reverse_result ) : base(id,node_name,flow_abort_mode) { this.Actor1Key = actor1_key; this.Actor2Key = actor2_key; this.Distance = distance; this.ReverseResult = reverse_result; } public static DistanceLessThan DeserializeDistanceLessThan(ByteBuf _buf) { return new ai.DistanceLessThan(_buf); } public readonly string Actor1Key; public readonly string Actor2Key; public readonly float Distance; public readonly bool ReverseResult; public const int ID = -1207170283; public override int GetTypeId() => ID; public override void Resolve(Dictionary<string, object> _tables) { base.Resolve(_tables); OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); public override string ToString() { return "{ " + "Id:" + Id + "," + "NodeName:" + NodeName + "," + "FlowAbortMode:" + FlowAbortMode + "," + "Actor1Key:" + Actor1Key + "," + "Actor2Key:" + Actor2Key + "," + "Distance:" + Distance + "," + "ReverseResult:" + ReverseResult + "," + "}"; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_Light_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_Light_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.Light(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.Light), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Reset(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Light; { { obj.Reset(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_AddCommandBuffer(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Light; if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rendering.CommandBuffer), false, false)) { var Arg0 = (UnityEngine.Rendering.LightEvent)argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.Rendering.CommandBuffer>(false); obj.AddCommandBuffer(Arg0,Arg1); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rendering.CommandBuffer), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = (UnityEngine.Rendering.LightEvent)argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.Rendering.CommandBuffer>(false); var Arg2 = (UnityEngine.Rendering.ShadowMapPass)argHelper2.GetInt32(false); obj.AddCommandBuffer(Arg0,Arg1,Arg2); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to AddCommandBuffer"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_AddCommandBufferAsync(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Light; if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rendering.CommandBuffer), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = (UnityEngine.Rendering.LightEvent)argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.Rendering.CommandBuffer>(false); var Arg2 = (UnityEngine.Rendering.ComputeQueueType)argHelper2.GetInt32(false); obj.AddCommandBufferAsync(Arg0,Arg1,Arg2); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rendering.CommandBuffer), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = (UnityEngine.Rendering.LightEvent)argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.Rendering.CommandBuffer>(false); var Arg2 = (UnityEngine.Rendering.ShadowMapPass)argHelper2.GetInt32(false); var Arg3 = (UnityEngine.Rendering.ComputeQueueType)argHelper3.GetInt32(false); obj.AddCommandBufferAsync(Arg0,Arg1,Arg2,Arg3); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to AddCommandBufferAsync"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_RemoveCommandBuffer(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Light; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = (UnityEngine.Rendering.LightEvent)argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.Rendering.CommandBuffer>(false); obj.RemoveCommandBuffer(Arg0,Arg1); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_RemoveCommandBuffers(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Light; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = (UnityEngine.Rendering.LightEvent)argHelper0.GetInt32(false); obj.RemoveCommandBuffers(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_RemoveAllCommandBuffers(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Light; { { obj.RemoveAllCommandBuffers(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetCommandBuffers(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Light; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = (UnityEngine.Rendering.LightEvent)argHelper0.GetInt32(false); var result = obj.GetCommandBuffers(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetLights(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = (UnityEngine.LightType)argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var result = UnityEngine.Light.GetLights(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_type(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Light; var result = obj.type; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_type(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Light; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.type = (UnityEngine.LightType)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_shape(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Light; var result = obj.shape; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_shape(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Light; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.shape = (UnityEngine.LightShape)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_spotAngle(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Light; var result = obj.spotAngle; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_spotAngle(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Light; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.spotAngle = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_innerSpotAngle(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Light; var result = obj.innerSpotAngle; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_innerSpotAngle(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Light; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.innerSpotAngle = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_color(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Light; var result = obj.color; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_color(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Light; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.color = argHelper.Get<UnityEngine.Color>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_colorTemperature(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Light; var result = obj.colorTemperature; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_colorTemperature(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Light; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.colorTemperature = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_useColorTemperature(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Light; var result = obj.useColorTemperature; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_useColorTemperature(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Light; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.useColorTemperature = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_intensity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Light; var result = obj.intensity; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_intensity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Light; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.intensity = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_bounceIntensity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Light; var result = obj.bounceIntensity; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_bounceIntensity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Light; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.bounceIntensity = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_useBoundingSphereOverride(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Light; var result = obj.useBoundingSphereOverride; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_useBoundingSphereOverride(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Light; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.useBoundingSphereOverride = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_boundingSphereOverride(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Light; var result = obj.boundingSphereOverride; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_boundingSphereOverride(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Light; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.boundingSphereOverride = argHelper.Get<UnityEngine.Vector4>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_useViewFrustumForShadowCasterCull(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Light; var result = obj.useViewFrustumForShadowCasterCull; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_useViewFrustumForShadowCasterCull(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Light; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.useViewFrustumForShadowCasterCull = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_shadowCustomResolution(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Light; var result = obj.shadowCustomResolution; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_shadowCustomResolution(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Light; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.shadowCustomResolution = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_shadowBias(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Light; var result = obj.shadowBias; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_shadowBias(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Light; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.shadowBias = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_shadowNormalBias(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Light; var result = obj.shadowNormalBias; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_shadowNormalBias(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Light; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.shadowNormalBias = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_shadowNearPlane(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Light; var result = obj.shadowNearPlane; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_shadowNearPlane(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Light; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.shadowNearPlane = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_useShadowMatrixOverride(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Light; var result = obj.useShadowMatrixOverride; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_useShadowMatrixOverride(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Light; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.useShadowMatrixOverride = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_shadowMatrixOverride(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Light; var result = obj.shadowMatrixOverride; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_shadowMatrixOverride(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Light; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.shadowMatrixOverride = argHelper.Get<UnityEngine.Matrix4x4>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_range(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Light; var result = obj.range; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_range(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Light; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.range = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_flare(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Light; var result = obj.flare; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_flare(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Light; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.flare = argHelper.Get<UnityEngine.Flare>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_bakingOutput(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Light; var result = obj.bakingOutput; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_bakingOutput(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Light; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.bakingOutput = argHelper.Get<UnityEngine.LightBakingOutput>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_cullingMask(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Light; var result = obj.cullingMask; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_cullingMask(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Light; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.cullingMask = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_renderingLayerMask(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Light; var result = obj.renderingLayerMask; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_renderingLayerMask(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Light; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.renderingLayerMask = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_lightShadowCasterMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Light; var result = obj.lightShadowCasterMode; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_lightShadowCasterMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Light; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.lightShadowCasterMode = (UnityEngine.LightShadowCasterMode)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_shadows(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Light; var result = obj.shadows; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_shadows(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Light; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.shadows = (UnityEngine.LightShadows)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_shadowStrength(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Light; var result = obj.shadowStrength; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_shadowStrength(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Light; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.shadowStrength = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_shadowResolution(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Light; var result = obj.shadowResolution; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_shadowResolution(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Light; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.shadowResolution = (UnityEngine.Rendering.LightShadowResolution)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_layerShadowCullDistances(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Light; var result = obj.layerShadowCullDistances; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_layerShadowCullDistances(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Light; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.layerShadowCullDistances = argHelper.Get<float[]>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_cookieSize(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Light; var result = obj.cookieSize; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_cookieSize(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Light; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.cookieSize = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_cookie(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Light; var result = obj.cookie; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_cookie(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Light; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.cookie = argHelper.Get<UnityEngine.Texture>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_renderMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Light; var result = obj.renderMode; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_renderMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Light; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.renderMode = (UnityEngine.LightRenderMode)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_commandBufferCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Light; var result = obj.commandBufferCount; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "Reset", IsStatic = false}, M_Reset }, { new Puerts.MethodKey {Name = "AddCommandBuffer", IsStatic = false}, M_AddCommandBuffer }, { new Puerts.MethodKey {Name = "AddCommandBufferAsync", IsStatic = false}, M_AddCommandBufferAsync }, { new Puerts.MethodKey {Name = "RemoveCommandBuffer", IsStatic = false}, M_RemoveCommandBuffer }, { new Puerts.MethodKey {Name = "RemoveCommandBuffers", IsStatic = false}, M_RemoveCommandBuffers }, { new Puerts.MethodKey {Name = "RemoveAllCommandBuffers", IsStatic = false}, M_RemoveAllCommandBuffers }, { new Puerts.MethodKey {Name = "GetCommandBuffers", IsStatic = false}, M_GetCommandBuffers }, { new Puerts.MethodKey {Name = "GetLights", IsStatic = true}, F_GetLights }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"type", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_type, Setter = S_type} }, {"shape", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_shape, Setter = S_shape} }, {"spotAngle", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_spotAngle, Setter = S_spotAngle} }, {"innerSpotAngle", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_innerSpotAngle, Setter = S_innerSpotAngle} }, {"color", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_color, Setter = S_color} }, {"colorTemperature", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_colorTemperature, Setter = S_colorTemperature} }, {"useColorTemperature", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_useColorTemperature, Setter = S_useColorTemperature} }, {"intensity", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_intensity, Setter = S_intensity} }, {"bounceIntensity", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_bounceIntensity, Setter = S_bounceIntensity} }, {"useBoundingSphereOverride", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_useBoundingSphereOverride, Setter = S_useBoundingSphereOverride} }, {"boundingSphereOverride", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_boundingSphereOverride, Setter = S_boundingSphereOverride} }, {"useViewFrustumForShadowCasterCull", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_useViewFrustumForShadowCasterCull, Setter = S_useViewFrustumForShadowCasterCull} }, {"shadowCustomResolution", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_shadowCustomResolution, Setter = S_shadowCustomResolution} }, {"shadowBias", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_shadowBias, Setter = S_shadowBias} }, {"shadowNormalBias", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_shadowNormalBias, Setter = S_shadowNormalBias} }, {"shadowNearPlane", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_shadowNearPlane, Setter = S_shadowNearPlane} }, {"useShadowMatrixOverride", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_useShadowMatrixOverride, Setter = S_useShadowMatrixOverride} }, {"shadowMatrixOverride", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_shadowMatrixOverride, Setter = S_shadowMatrixOverride} }, {"range", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_range, Setter = S_range} }, {"flare", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_flare, Setter = S_flare} }, {"bakingOutput", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_bakingOutput, Setter = S_bakingOutput} }, {"cullingMask", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_cullingMask, Setter = S_cullingMask} }, {"renderingLayerMask", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_renderingLayerMask, Setter = S_renderingLayerMask} }, {"lightShadowCasterMode", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_lightShadowCasterMode, Setter = S_lightShadowCasterMode} }, {"shadows", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_shadows, Setter = S_shadows} }, {"shadowStrength", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_shadowStrength, Setter = S_shadowStrength} }, {"shadowResolution", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_shadowResolution, Setter = S_shadowResolution} }, {"layerShadowCullDistances", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_layerShadowCullDistances, Setter = S_layerShadowCullDistances} }, {"cookieSize", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_cookieSize, Setter = S_cookieSize} }, {"cookie", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_cookie, Setter = S_cookie} }, {"renderMode", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_renderMode, Setter = S_renderMode} }, {"commandBufferCount", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_commandBufferCount, Setter = null} }, } }; } } } <|start_filename|>Projects/GenerateDatas/convert_lua/test.TbDetectCsvEncoding/23.lua<|end_filename|> return { id = 23, name = "工枯加盟仍", } <|start_filename|>Projects/GenerateDatas/convert_lua/test.TbDataFromMisc/40.lua<|end_filename|> return { x4 = 40, x1 = true, x2 = 3, x3 = 128, x5 = 11223344, x6 = 1.2, x7 = 1.23432, x8_0 = 12312, x8 = 112233, x9 = 223344, x10 = "hq", x12 = { x1 = 10, }, x13 = 2, x14 = { _name = 'DemoD2', x1 = 1, x2 = 2, }, s1 = {key='/asfa32',text="<KEY>"}, v2 = {x=1,y=2}, v3 = {x=1.1,y=2.2,z=3.4}, v4 = {x=10.1,y=11.2,z=12.3,w=13.4}, t1 = 1970-1-1 00:00:00, k1 = { 1, 2, }, k2 = { 2, 3, }, k5 = { 1, 6, }, k8 = { [2] = 2, [4] = 10, } , k9 = { { y1 = 1, y2 = true, }, { y1 = 2, y2 = false, }, }, k15 = { { _name = 'DemoD2', x1 = 1, x2 = 2, }, }, } <|start_filename|>Projects/GenerateDatas/convert_lua/role.TbRoleLevelExpAttr/28.lua<|end_filename|> return { level = 28, need_exp = 10000, clothes_attrs = { 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, }, } <|start_filename|>Projects/DataTemplates/template_lua2/test_tbdefinefromexcel2.lua<|end_filename|> -- test.TbDefineFromExcel2 return { [10000] = { id=10000, x1=true, x5=10, x6=1.28, x8=3, x10="huang", x13=1, x14= { x1=1, x2=2, }, v2={x=1,y=2}, t1=935460549, k1= { 1, 2, 3, }, k8= { [1] = 2, [3] = 4, }, k9= { { y1=1, y2=true, }, { y1=2, y2=false, }, }, }, [10001] = { id=10001, x1=true, x5=10, x6=1.28, x8=5, x10="huang", x13=1, x14= { x1=1, x2=2, }, v2={x=1,y=2}, t1=935460549, k1= { 1, 2, 3, }, k8= { [1] = 2, [3] = 4, }, k9= { { y1=1, y2=true, }, { y1=2, y2=false, }, }, }, [10002] = { id=10002, x1=true, x5=13234234234, x6=1.28, x8=6, x10="huang", x13=1, x14= { x1=1, x2=2, }, v2={x=1,y=2}, t1=1577808000, k1= { 1, 2, 3, }, k8= { [1] = 2, [3] = 4, }, k9= { { y1=1, y2=true, }, { y1=2, y2=false, }, }, }, [10003] = { id=10003, x1=true, x5=13234234234, x6=1.28, x8=3, x10="huang", x13=1, x14= { x1=1, x2=2, }, v2={x=1,y=2}, t1=933732549, k1= { 1, 2, 3, }, k8= { [1] = 2, [3] = 4, }, k9= { { y1=1, y2=true, }, { y1=2, y2=false, }, }, }, [10004] = { id=10004, x1=true, x5=13234234234, x6=1.28, x8=4, x10="huang", x13=1, x14= { x1=1, x2=2, }, v2={x=1,y=2}, t1=1577808000, k1= { 1, 2, 3, }, k8= { [1] = 2, [3] = 4, }, k9= { { y1=1, y2=true, }, { y1=2, y2=false, }, }, }, [10005] = { id=10005, x1=true, x5=13234234234, x6=1.28, x8=5, x10="huang", x13=1, x14= { x1=1, x2=2, }, v2={x=1,y=2}, t1=935460549, k1= { 1, 2, 3, }, k8= { [1] = 2, [3] = 4, }, k9= { { y1=1, y2=true, }, { y1=2, y2=false, }, }, }, [10006] = { id=10006, x1=true, x5=10, x6=1.28, x8=6, x10="", x13=2, x14= { x1=1, x2=2, }, v2={x=1,y=2}, t1=1577808000, k1= { 1, 2, 3, }, k8= { [1] = 2, [3] = 4, }, k9= { { y1=1, y2=true, }, { y1=2, y2=false, }, }, }, [10007] = { id=10007, x1=true, x5=10, x6=1.28, x8=4, x10="xxx", x13=2, x14= { x1=1, x2=2, }, v2={x=1,y=2}, t1=935460549, k1= { 1, 2, 3, }, k8= { [1] = 2, [3] = 4, }, k9= { { y1=1, y2=true, }, { y1=2, y2=false, }, }, }, [10008] = { id=10008, x1=true, x5=10, x6=1.28, x8=3, x10="xxx", x13=2, x14= { x1=1, x2=2, }, v2={x=1,y=2}, t1=935460549, k1= { 1, 2, 3, }, k8= { [1] = 2, [3] = 4, }, k9= { { y1=1, y2=true, }, { y1=2, y2=false, }, }, }, } <|start_filename|>Projects/DataTemplates/template_erlang/test_tbdemoprimitive.erl<|end_filename|> %% test.TbDemoPrimitive get(3) -> #{x1 => false,x2 => 1,x3 => 2,x4 => 3,x5 => 4,x6 => 5,x7 => 6,s1 => "hello",s2 => #{key=>"/test/key1",text=>"测试本地化字符串1"},v2 => #{x=>1,y=>2},v3 => #{x=>2,y=>3,z=>4},v4 => #{x=>4,y=>5,z=>6,w=>7},t1 => 946742700}. get(4) -> #{x1 => true,x2 => 1,x3 => 2,x4 => 4,x5 => 4,x6 => 5,x7 => 6,s1 => "world",s2 => #{key=>"/test/key2",text=>"测试本地化字符串2"},v2 => #{x=>2,y=>3},v3 => #{x=>2.2,y=>2.3,z=>3.4},v4 => #{x=>4.5,y=>5.6,z=>6.7,w=>8.8},t1 => 946829099}. get(5) -> #{x1 => true,x2 => 1,x3 => 2,x4 => 5,x5 => 4,x6 => 5,x7 => 6,s1 => "nihao",s2 => #{key=>"/test/key3",text=>"测试本地化字符串3"},v2 => #{x=>4,y=>5},v3 => #{x=>2.2,y=>2.3,z=>3.5},v4 => #{x=>4.5,y=>5.6,z=>6.8,w=>9.9},t1 => 946915499}. get(6) -> #{x1 => true,x2 => 1,x3 => 2,x4 => 6,x5 => 4,x6 => 5,x7 => 6,s1 => "shijie",s2 => #{key=>"/test/key4",text=>"测试本地化字符串4"},v2 => #{x=>6,y=>7},v3 => #{x=>2.2,y=>2.3,z=>3.6},v4 => #{x=>4.5,y=>5.6,z=>6.9,w=>123},t1 => 947001899}. <|start_filename|>Projects/CfgValidator/Gen/test/DefineFromExcel.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; using System.Text.Json; namespace cfg.test { public sealed class DefineFromExcel : Bright.Config.BeanBase { public DefineFromExcel(JsonElement _json) { Id = _json.GetProperty("id").GetInt32(); X1 = _json.GetProperty("x1").GetBoolean(); X5 = _json.GetProperty("x5").GetInt64(); X6 = _json.GetProperty("x6").GetSingle(); X8 = _json.GetProperty("x8").GetInt32(); X10 = _json.GetProperty("x10").GetString(); X13 = (test.ETestQuality)_json.GetProperty("x13").GetInt32(); X14 = test.DemoDynamic.DeserializeDemoDynamic(_json.GetProperty("x14")); { var _json0 = _json.GetProperty("v2"); float __x; __x = _json0.GetProperty("x").GetSingle(); float __y; __y = _json0.GetProperty("y").GetSingle(); V2 = new System.Numerics.Vector2(__x, __y); } T1 = _json.GetProperty("t1").GetInt32(); { var _json0 = _json.GetProperty("k1"); int _n = _json0.GetArrayLength(); K1 = new int[_n]; int _index=0; foreach(JsonElement __e in _json0.EnumerateArray()) { int __v; __v = __e.GetInt32(); K1[_index++] = __v; } } { var _json0 = _json.GetProperty("k8"); K8 = new System.Collections.Generic.Dictionary<int, int>(_json0.GetArrayLength()); foreach(JsonElement __e in _json0.EnumerateArray()) { int __k; __k = __e[0].GetInt32(); int __v; __v = __e[1].GetInt32(); K8.Add(__k, __v); } } { var _json0 = _json.GetProperty("k9"); K9 = new System.Collections.Generic.List<test.DemoE2>(_json0.GetArrayLength()); foreach(JsonElement __e in _json0.EnumerateArray()) { test.DemoE2 __v; __v = test.DemoE2.DeserializeDemoE2(__e); K9.Add(__v); } } } public DefineFromExcel(int id, bool x1, long x5, float x6, int x8, string x10, test.ETestQuality x13, test.DemoDynamic x14, System.Numerics.Vector2 v2, int t1, int[] k1, System.Collections.Generic.Dictionary<int, int> k8, System.Collections.Generic.List<test.DemoE2> k9 ) { this.Id = id; this.X1 = x1; this.X5 = x5; this.X6 = x6; this.X8 = x8; this.X10 = x10; this.X13 = x13; this.X14 = x14; this.V2 = v2; this.T1 = t1; this.K1 = k1; this.K8 = k8; this.K9 = k9; } public static DefineFromExcel DeserializeDefineFromExcel(JsonElement _json) { return new test.DefineFromExcel(_json); } /// <summary> /// 这是id /// </summary> public int Id { get; private set; } /// <summary> /// 字段x1 /// </summary> public bool X1 { get; private set; } public long X5 { get; private set; } public float X6 { get; private set; } public int X8 { get; private set; } public string X10 { get; private set; } public test.ETestQuality X13 { get; private set; } public test.DemoDynamic X14 { get; private set; } public System.Numerics.Vector2 V2 { get; private set; } public int T1 { get; private set; } public int[] K1 { get; private set; } public System.Collections.Generic.Dictionary<int, int> K8 { get; private set; } public System.Collections.Generic.List<test.DemoE2> K9 { get; private set; } public const int __ID__ = 2100429878; public override int GetTypeId() => __ID__; public void Resolve(Dictionary<string, object> _tables) { X14?.Resolve(_tables); foreach(var _e in K9) { _e?.Resolve(_tables); } } public void TranslateText(System.Func<string, string, string> translator) { X14?.TranslateText(translator); foreach(var _e in K9) { _e?.TranslateText(translator); } } public override string ToString() { return "{ " + "Id:" + Id + "," + "X1:" + X1 + "," + "X5:" + X5 + "," + "X6:" + X6 + "," + "X8:" + X8 + "," + "X10:" + X10 + "," + "X13:" + X13 + "," + "X14:" + X14 + "," + "V2:" + V2 + "," + "T1:" + T1 + "," + "K1:" + Bright.Common.StringUtil.CollectionToString(K1) + "," + "K8:" + Bright.Common.StringUtil.CollectionToString(K8) + "," + "K9:" + Bright.Common.StringUtil.CollectionToString(K9) + "," + "}"; } } } <|start_filename|>Projects/Java_bin/src/main/gen/cfg/test/TestExcelBean1.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.test; import bright.serialization.*; /** * 这是个测试excel结构 */ public final class TestExcelBean1 { public TestExcelBean1(ByteBuf _buf) { x1 = _buf.readInt(); x2 = _buf.readString(); x3 = _buf.readInt(); x4 = _buf.readFloat(); } public TestExcelBean1(int x1, String x2, int x3, float x4 ) { this.x1 = x1; this.x2 = x2; this.x3 = x3; this.x4 = x4; } /** * 最高品质 */ public final int x1; /** * 黑色的 */ public final String x2; /** * 蓝色的 */ public final int x3; /** * 最差品质 */ public final float x4; public void resolve(java.util.HashMap<String, Object> _tables) { } @Override public String toString() { return "{ " + "x1:" + x1 + "," + "x2:" + x2 + "," + "x3:" + x3 + "," + "x4:" + x4 + "," + "}"; } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_PointEffector2D_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_PointEffector2D_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.PointEffector2D(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.PointEffector2D), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_forceMagnitude(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.PointEffector2D; var result = obj.forceMagnitude; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_forceMagnitude(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.PointEffector2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.forceMagnitude = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_forceVariation(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.PointEffector2D; var result = obj.forceVariation; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_forceVariation(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.PointEffector2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.forceVariation = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_distanceScale(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.PointEffector2D; var result = obj.distanceScale; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_distanceScale(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.PointEffector2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.distanceScale = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_drag(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.PointEffector2D; var result = obj.drag; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_drag(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.PointEffector2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.drag = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_angularDrag(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.PointEffector2D; var result = obj.angularDrag; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_angularDrag(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.PointEffector2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.angularDrag = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_forceSource(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.PointEffector2D; var result = obj.forceSource; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_forceSource(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.PointEffector2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.forceSource = (UnityEngine.EffectorSelection2D)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_forceTarget(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.PointEffector2D; var result = obj.forceTarget; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_forceTarget(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.PointEffector2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.forceTarget = (UnityEngine.EffectorSelection2D)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_forceMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.PointEffector2D; var result = obj.forceMode; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_forceMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.PointEffector2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.forceMode = (UnityEngine.EffectorForceMode2D)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"forceMagnitude", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_forceMagnitude, Setter = S_forceMagnitude} }, {"forceVariation", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_forceVariation, Setter = S_forceVariation} }, {"distanceScale", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_distanceScale, Setter = S_distanceScale} }, {"drag", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_drag, Setter = S_drag} }, {"angularDrag", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_angularDrag, Setter = S_angularDrag} }, {"forceSource", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_forceSource, Setter = S_forceSource} }, {"forceTarget", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_forceTarget, Setter = S_forceTarget} }, {"forceMode", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_forceMode, Setter = S_forceMode} }, } }; } } } <|start_filename|>Projects/GenerateDatas/convert_lua/l10n.TbL10NDemo/14.lua<|end_filename|> return { id = 14, text = {key='',text=""}, } <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/test/DemoType1.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.test { public sealed partial class DemoType1 : Bright.Config.BeanBase { public DemoType1(ByteBuf _buf) { X1 = _buf.ReadInt(); } public DemoType1(int x1 ) { this.X1 = x1; } public static DemoType1 DeserializeDemoType1(ByteBuf _buf) { return new test.DemoType1(_buf); } public readonly int X1; public const int ID = -367048296; public override int GetTypeId() => ID; public void Resolve(Dictionary<string, object> _tables) { OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); public override string ToString() { return "{ " + "X1:" + X1 + "," + "}"; } } } <|start_filename|>Projects/Go_json/gen/src/cfg/item.TbItemFunc.go<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg type ItemTbItemFunc struct { _dataMap map[int32]*ItemItemFunction _dataList []*ItemItemFunction } func NewItemTbItemFunc(_buf []map[string]interface{}) (*ItemTbItemFunc, error) { _dataList := make([]*ItemItemFunction, 0, len(_buf)) dataMap := make(map[int32]*ItemItemFunction) for _, _ele_ := range _buf { if _v, err2 := DeserializeItemItemFunction(_ele_); err2 != nil { return nil, err2 } else { _dataList = append(_dataList, _v) dataMap[_v.MinorType] = _v } } return &ItemTbItemFunc{_dataList:_dataList, _dataMap:dataMap}, nil } func (table *ItemTbItemFunc) GetDataMap() map[int32]*ItemItemFunction { return table._dataMap } func (table *ItemTbItemFunc) GetDataList() []*ItemItemFunction { return table._dataList } func (table *ItemTbItemFunc) Get(key int32) *ItemItemFunction { return table._dataMap[key] } <|start_filename|>Projects/Java_bin/src/main/gen/cfg/l10n/L10NDemo.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.l10n; import bright.serialization.*; public final class L10NDemo { public L10NDemo(ByteBuf _buf) { id = _buf.readInt(); _buf.readString(); text = _buf.readString(); } public L10NDemo(int id, String text ) { this.id = id; this.text = text; } public final int id; public final String text; public void resolve(java.util.HashMap<String, Object> _tables) { } @Override public String toString() { return "{ " + "id:" + id + "," + "text:" + text + "," + "}"; } } <|start_filename|>Projects/Csharp_CustomTemplate_EncryptMemory/Gen/l10n/L10NDemo.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using System; using Newtonsoft.Json; using Scripts; namespace cfg.l10n { [Serializable] public partial class L10NDemo : AConfig { public string text { get; set; } public string Text_l10n_key { get; } public override void EndInit() { } public override string ToString() => JsonConvert.SerializeObject(this); } } <|start_filename|>Projects/GenerateDatas/convert_lua/item.TbItemFunc/1102.lua<|end_filename|> return { minor_type = 1102, func_type = 1, method = "使用", close_bag_ui = false, } <|start_filename|>ProtoProjects/Csharp_Unity/Assets/Bright.Net/Codecs/Protocol.cs<|end_filename|> using System; using Bright.Serialization; namespace Bright.Net.Codecs { public abstract class Protocol : ISerializable, ITypeId, ICloneable { public abstract object Clone(); public abstract int GetTypeId(); public abstract void Serialize(ByteBuf _buf); public abstract void Deserialize(ByteBuf _buf); public abstract void Reset(); } public delegate Protocol ProtocolCreator(); } <|start_filename|>Projects/Go_json/gen/src/cfg/test.TbDetectCsvEncoding.go<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg type TestTbDetectCsvEncoding struct { _dataMap map[int32]*TestDetectEncoding _dataList []*TestDetectEncoding } func NewTestTbDetectCsvEncoding(_buf []map[string]interface{}) (*TestTbDetectCsvEncoding, error) { _dataList := make([]*TestDetectEncoding, 0, len(_buf)) dataMap := make(map[int32]*TestDetectEncoding) for _, _ele_ := range _buf { if _v, err2 := DeserializeTestDetectEncoding(_ele_); err2 != nil { return nil, err2 } else { _dataList = append(_dataList, _v) dataMap[_v.Id] = _v } } return &TestTbDetectCsvEncoding{_dataList:_dataList, _dataMap:dataMap}, nil } func (table *TestTbDetectCsvEncoding) GetDataMap() map[int32]*TestDetectEncoding { return table._dataMap } func (table *TestTbDetectCsvEncoding) GetDataList() []*TestDetectEncoding { return table._dataList } func (table *TestTbDetectCsvEncoding) Get(key int32) *TestDetectEncoding { return table._dataMap[key] } <|start_filename|>Projects/Go_json/gen/src/cfg/bonus.OneItems.go<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg import "errors" type BonusOneItems struct { Items []int32 } const TypeId_BonusOneItems = 400179721 func (*BonusOneItems) GetTypeId() int32 { return 400179721 } func (_v *BonusOneItems)Deserialize(_buf map[string]interface{}) (err error) { { var _arr_ []interface{} var _ok_ bool if _arr_, _ok_ = _buf["items"].([]interface{}); !_ok_ { err = errors.New("items error"); return } _v.Items = make([]int32, 0, len(_arr_)) for _, _e_ := range _arr_ { var _list_v_ int32 { var _ok_ bool; var _x_ float64; if _x_, _ok_ = _e_.(float64); !_ok_ { err = errors.New("_list_v_ error"); return }; _list_v_ = int32(_x_) } _v.Items = append(_v.Items, _list_v_) } } return } func DeserializeBonusOneItems(_buf map[string]interface{}) (*BonusOneItems, error) { v := &BonusOneItems{} if err := v.Deserialize(_buf); err == nil { return v, nil } else { return nil, err } } <|start_filename|>Projects/Csharp_DotNet5_bin/Benchmark.cs<|end_filename|> using Bright.Serialization; using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Text; class CacheLoader { public string Dir { get; } private readonly Dictionary<string, byte[]> cache = new(); public CacheLoader(string dir) { Dir = dir; } public ByteBuf LoadOrFromCache(string name) { if (!cache.TryGetValue(name, out byte[] result)) { result = File.ReadAllBytes($"{Dir}/{name}.bin"); cache.Add(name, result); } return new ByteBuf(result); } } internal class Benchmark { public static void Run(string dir) { var loader = new CacheLoader(dir); var tables = new List<cfg.Tables>(); for (int k = 0; k < 10; k++) { var w = new Stopwatch(); w.Start(); for (int i = 0; i < 100; i++) { tables.Add(new cfg.Tables(loader.LoadOrFromCache)); } w.Stop(); Console.WriteLine("== cost {0} ms", w.ElapsedMilliseconds); } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_GridBrushBase_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_GridBrushBase_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.GridBrushBase constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Paint(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GridBrushBase; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.Get<UnityEngine.GridLayout>(false); var Arg1 = argHelper1.Get<UnityEngine.GameObject>(false); var Arg2 = argHelper2.Get<UnityEngine.Vector3Int>(false); obj.Paint(Arg0,Arg1,Arg2); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Erase(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GridBrushBase; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.Get<UnityEngine.GridLayout>(false); var Arg1 = argHelper1.Get<UnityEngine.GameObject>(false); var Arg2 = argHelper2.Get<UnityEngine.Vector3Int>(false); obj.Erase(Arg0,Arg1,Arg2); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_BoxFill(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GridBrushBase; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.Get<UnityEngine.GridLayout>(false); var Arg1 = argHelper1.Get<UnityEngine.GameObject>(false); var Arg2 = argHelper2.Get<UnityEngine.BoundsInt>(false); obj.BoxFill(Arg0,Arg1,Arg2); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_BoxErase(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GridBrushBase; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.Get<UnityEngine.GridLayout>(false); var Arg1 = argHelper1.Get<UnityEngine.GameObject>(false); var Arg2 = argHelper2.Get<UnityEngine.BoundsInt>(false); obj.BoxErase(Arg0,Arg1,Arg2); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Select(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GridBrushBase; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.Get<UnityEngine.GridLayout>(false); var Arg1 = argHelper1.Get<UnityEngine.GameObject>(false); var Arg2 = argHelper2.Get<UnityEngine.BoundsInt>(false); obj.Select(Arg0,Arg1,Arg2); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_FloodFill(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GridBrushBase; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.Get<UnityEngine.GridLayout>(false); var Arg1 = argHelper1.Get<UnityEngine.GameObject>(false); var Arg2 = argHelper2.Get<UnityEngine.Vector3Int>(false); obj.FloodFill(Arg0,Arg1,Arg2); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Rotate(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GridBrushBase; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = (UnityEngine.GridBrushBase.RotationDirection)argHelper0.GetInt32(false); var Arg1 = (UnityEngine.GridLayout.CellLayout)argHelper1.GetInt32(false); obj.Rotate(Arg0,Arg1); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Flip(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GridBrushBase; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = (UnityEngine.GridBrushBase.FlipAxis)argHelper0.GetInt32(false); var Arg1 = (UnityEngine.GridLayout.CellLayout)argHelper1.GetInt32(false); obj.Flip(Arg0,Arg1); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Pick(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GridBrushBase; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); { var Arg0 = argHelper0.Get<UnityEngine.GridLayout>(false); var Arg1 = argHelper1.Get<UnityEngine.GameObject>(false); var Arg2 = argHelper2.Get<UnityEngine.BoundsInt>(false); var Arg3 = argHelper3.Get<UnityEngine.Vector3Int>(false); obj.Pick(Arg0,Arg1,Arg2,Arg3); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Move(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GridBrushBase; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); { var Arg0 = argHelper0.Get<UnityEngine.GridLayout>(false); var Arg1 = argHelper1.Get<UnityEngine.GameObject>(false); var Arg2 = argHelper2.Get<UnityEngine.BoundsInt>(false); var Arg3 = argHelper3.Get<UnityEngine.BoundsInt>(false); obj.Move(Arg0,Arg1,Arg2,Arg3); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_MoveStart(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GridBrushBase; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.Get<UnityEngine.GridLayout>(false); var Arg1 = argHelper1.Get<UnityEngine.GameObject>(false); var Arg2 = argHelper2.Get<UnityEngine.BoundsInt>(false); obj.MoveStart(Arg0,Arg1,Arg2); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_MoveEnd(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GridBrushBase; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.Get<UnityEngine.GridLayout>(false); var Arg1 = argHelper1.Get<UnityEngine.GameObject>(false); var Arg2 = argHelper2.Get<UnityEngine.BoundsInt>(false); obj.MoveEnd(Arg0,Arg1,Arg2); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ChangeZPosition(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GridBrushBase; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); obj.ChangeZPosition(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ResetZPosition(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GridBrushBase; { { obj.ResetZPosition(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "Paint", IsStatic = false}, M_Paint }, { new Puerts.MethodKey {Name = "Erase", IsStatic = false}, M_Erase }, { new Puerts.MethodKey {Name = "BoxFill", IsStatic = false}, M_BoxFill }, { new Puerts.MethodKey {Name = "BoxErase", IsStatic = false}, M_BoxErase }, { new Puerts.MethodKey {Name = "Select", IsStatic = false}, M_Select }, { new Puerts.MethodKey {Name = "FloodFill", IsStatic = false}, M_FloodFill }, { new Puerts.MethodKey {Name = "Rotate", IsStatic = false}, M_Rotate }, { new Puerts.MethodKey {Name = "Flip", IsStatic = false}, M_Flip }, { new Puerts.MethodKey {Name = "Pick", IsStatic = false}, M_Pick }, { new Puerts.MethodKey {Name = "Move", IsStatic = false}, M_Move }, { new Puerts.MethodKey {Name = "MoveStart", IsStatic = false}, M_MoveStart }, { new Puerts.MethodKey {Name = "MoveEnd", IsStatic = false}, M_MoveEnd }, { new Puerts.MethodKey {Name = "ChangeZPosition", IsStatic = false}, M_ChangeZPosition }, { new Puerts.MethodKey {Name = "ResetZPosition", IsStatic = false}, M_ResetZPosition }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { } }; } } } <|start_filename|>ProtoProjects/Typescript_Unity_Puerts/Assets/Scripts/Libs/Bright.Core/Threading/AtomicLong.cs<|end_filename|> using System.Threading; namespace Bright.Threading { public class AtomicLong { private long _value; public AtomicLong(long initValue = 0) { _value = initValue; } public long IncrementAndGet() { return Interlocked.Add(ref _value, 1); } public long AddAndGet(long step) { return Interlocked.Add(ref _value, step); } public long GetAndAdd(long step) { return Interlocked.Add(ref _value, step); } public long Value { get => Interlocked.Read(ref _value); set => Interlocked.Exchange(ref this._value, value); } public override string ToString() { return _value.ToString(); } } } <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/ai/BlackboardKeyData.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.ai { public sealed partial class BlackboardKeyData : ai.KeyData { public BlackboardKeyData(ByteBuf _buf) : base(_buf) { Value = _buf.ReadString(); } public BlackboardKeyData(string value ) : base() { this.Value = value; } public static BlackboardKeyData DeserializeBlackboardKeyData(ByteBuf _buf) { return new ai.BlackboardKeyData(_buf); } public readonly string Value; public const int ID = 1517269500; public override int GetTypeId() => ID; public override void Resolve(Dictionary<string, object> _tables) { base.Resolve(_tables); OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); public override string ToString() { return "{ " + "Value:" + Value + "," + "}"; } } } <|start_filename|>Projects/Csharp_CustomTemplate_EncryptMemory/Assets/Scripts/ACategory.cs<|end_filename|> using System; using System.Collections.Generic; using System.Linq; using Cysharp.Threading.Tasks; using UnityEngine; using UnityEngine.AddressableAssets; namespace Scripts { [Config] public abstract class ACategory { public abstract Type GetConfigType { get; } public abstract AConfig GetOne(); public abstract AConfig[] GetAll(); public abstract AConfig TryGet(int id); public abstract UniTask BeginInit(); internal abstract void InternalEndInit(); public abstract void EndInit(); public abstract void TranslateText(Func<string, string, string> translator); } public abstract class ACategory<T> : ACategory where T : AConfig { protected Dictionary<int, T> dict; public override Type GetConfigType => typeof(T); public override AConfig GetOne() { return dict.Values.GetEnumerator().Current; } public override AConfig[] GetAll() { return dict.Values.ToArray(); } public override AConfig TryGet(int id) { dict.TryGetValue(id, out var config); return config; } public override async UniTask BeginInit() { var handle = Addressables.LoadAssetAsync<TextAsset>(typeof(T).Name); try { dict = new Dictionary<int, T>(); TextAsset text_asset = await handle; if(text_asset is null || string.IsNullOrEmpty(text_asset.text)) { return; } dict = JsonHelper.FromJson<Dictionary<int, T>>(text_asset.text); foreach(var pair in dict) { pair.Value.id = pair.Key; } } catch(Exception e) { throw e; } finally { Addressables.Release(handle); } } internal override void InternalEndInit() { foreach(var config in dict.Values) { config.EndInit(); } } public override void EndInit() { } public override void TranslateText(Func<string, string, string> translator) { } } } <|start_filename|>Projects/L10N/config_data/test_tbmultiunionindexlist.lua<|end_filename|> return { {id1=1,id2=1,id3="ab1",num=1,desc="desc1",}, {id1=1,id2=1,id3="ab2",num=2,desc="desc2",}, {id1=1,id2=5,id3="ab1",num=3,desc="desc3",}, {id1=4,id2=5,id3="ab1",num=4,desc="desc4",}, {id1=5,id2=9,id3="ab5",num=5,desc="desc5",}, {id1=6,id2=11,id3="ab6",num=6,desc="desc6",}, {id1=7,id2=13,id3="ab7",num=7,desc="desc7",}, {id1=8,id2=15,id3="ab8",num=8,desc="desc8",}, {id1=9,id2=17,id3="ab9",num=9,desc="desc9",}, {id1=10,id2=19,id3="ab10",num=10,desc="desc10",}, {id1=11,id2=21,id3="ab11",num=11,desc="desc11",}, } <|start_filename|>Projects/GenerateDatas/convert_lua/role.TbRoleLevelExpAttr/9.lua<|end_filename|> return { level = 9, need_exp = 1100, clothes_attrs = { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, }, } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_SleepTimeout_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_SleepTimeout_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.SleepTimeout(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.SleepTimeout), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_NeverSleep(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.SleepTimeout.NeverSleep; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_SystemSetting(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.SleepTimeout.SystemSetting; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"NeverSleep", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_NeverSleep, Setter = null} }, {"SystemSetting", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_SystemSetting, Setter = null} }, } }; } } } <|start_filename|>Projects/Java_bin/src/main/gen/cfg/bonus/ProbabilityBonusInfo.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.bonus; import bright.serialization.*; public final class ProbabilityBonusInfo { public ProbabilityBonusInfo(ByteBuf _buf) { bonus = cfg.bonus.Bonus.deserializeBonus(_buf); probability = _buf.readFloat(); } public ProbabilityBonusInfo(cfg.bonus.Bonus bonus, float probability ) { this.bonus = bonus; this.probability = probability; } public final cfg.bonus.Bonus bonus; public final float probability; public void resolve(java.util.HashMap<String, Object> _tables) { if (bonus != null) {bonus.resolve(_tables);} } @Override public String toString() { return "{ " + "bonus:" + bonus + "," + "probability:" + probability + "," + "}"; } } <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/limit/ENamespace.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ namespace cfg.limit { public enum ENamespace { ITEM_DAILY_OBTAIN = 1, TREASURE_DAILY_USE = 2, STORE_GOODS_LIMIT_BUY = 3, } } <|start_filename|>Projects/Go_json/gen/src/cfg/item.EMinorType.go<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg const ( ItemEMinorType_DIAMOND = 101 ItemEMinorType_GOLD = 102 ItemEMinorType_SILVER = 103 ItemEMinorType_EXP = 104 ItemEMinorType_POWER_POINT = 105 ItemEMinorType_HAIR_STYLE = 210 ItemEMinorType_COAT = 220 ItemEMinorType_UPPER_JACKET = 230 ItemEMinorType_TROUSERS = 241 ItemEMinorType_SKIRT = 242 ItemEMinorType_SOCKS = 250 ItemEMinorType_SHOES = 260 ItemEMinorType_HAIR_ACCESSORY = 271 ItemEMinorType_HAT = 272 ItemEMinorType_EARRING = 273 ItemEMinorType_NECKLACE = 274 ItemEMinorType_BRACELET = 275 ItemEMinorType_HAIR_CLASP = 276 ItemEMinorType_GLOVE = 277 ItemEMinorType_HANDHELD_OBJECT = 278 ItemEMinorType_SPECIAL = 279 ItemEMinorType_BASE_COSMETIC = 281 ItemEMinorType_EYEBROW_COSMETIC = 282 ItemEMinorType_EYELASH = 283 ItemEMinorType_COSMETIC_CONTACT_LENSES = 284 ItemEMinorType_LIP_COSMETIC = 285 ItemEMinorType_SKIN_COLOR = 286 ItemEMinorType_ONE_PIECE_DRESS = 290 ItemEMinorType_SWITCH_CLOTHES_SCENE = 291 ItemEMinorType_QUEST = 301 ItemEMinorType_CAST = 401 ItemEMinorType_SWORD = 421 ItemEMinorType_BOW_ARROW = 422 ItemEMinorType_WANDS = 423 ItemEMinorType_SPECIAL_TOOL = 424 ItemEMinorType_FOOD = 403 ItemEMinorType_TREASURE_BOX = 501 ItemEMinorType_KEY = 502 ItemEMinorType_MULTI_CHOOSE_TREASURE_BOX = 503 ItemEMinorType_ACHIEVEMENT = 601 ItemEMinorType_TITLE = 602 ItemEMinorType_AVATAR_FRAME = 701 ItemEMinorType_VOICE = 801 ItemEMinorType_IDLE_POSE = 901 ItemEMinorType_PHOTO_POSE = 902 ItemEMinorType_BAG = 1001 ItemEMinorType_FRIEND_CAPACITY = 1002 ItemEMinorType_CONSTRUCTION_MATERIAL = 1101 ItemEMinorType_DESIGN_DRAWING = 1102 ) <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_RectOffset_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_RectOffset_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { if (paramLen == 0) { { var result = new UnityEngine.RectOffset(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.RectOffset), result); } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetInt32(false); var result = new UnityEngine.RectOffset(Arg0,Arg1,Arg2,Arg3); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.RectOffset), result); } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.RectOffset constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ToString(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RectOffset; if (paramLen == 0) { { var result = obj.ToString(); Puerts.PuertsDLL.ReturnString(isolate, info, result); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var result = obj.ToString(Arg0); Puerts.PuertsDLL.ReturnString(isolate, info, result); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.IFormatProvider), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<System.IFormatProvider>(false); var result = obj.ToString(Arg0,Arg1); Puerts.PuertsDLL.ReturnString(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to ToString"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Add(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RectOffset; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var result = obj.Add(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Remove(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RectOffset; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var result = obj.Remove(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_left(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RectOffset; var result = obj.left; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_left(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RectOffset; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.left = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_right(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RectOffset; var result = obj.right; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_right(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RectOffset; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.right = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_top(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RectOffset; var result = obj.top; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_top(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RectOffset; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.top = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_bottom(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RectOffset; var result = obj.bottom; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_bottom(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RectOffset; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.bottom = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_horizontal(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RectOffset; var result = obj.horizontal; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_vertical(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RectOffset; var result = obj.vertical; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "ToString", IsStatic = false}, M_ToString }, { new Puerts.MethodKey {Name = "Add", IsStatic = false}, M_Add }, { new Puerts.MethodKey {Name = "Remove", IsStatic = false}, M_Remove }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"left", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_left, Setter = S_left} }, {"right", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_right, Setter = S_right} }, {"top", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_top, Setter = S_top} }, {"bottom", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_bottom, Setter = S_bottom} }, {"horizontal", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_horizontal, Setter = null} }, {"vertical", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_vertical, Setter = null} }, } }; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_CharacterJoint_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_CharacterJoint_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.CharacterJoint(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.CharacterJoint), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_swingAxis(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CharacterJoint; var result = obj.swingAxis; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_swingAxis(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CharacterJoint; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.swingAxis = argHelper.Get<UnityEngine.Vector3>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_twistLimitSpring(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CharacterJoint; var result = obj.twistLimitSpring; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_twistLimitSpring(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CharacterJoint; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.twistLimitSpring = argHelper.Get<UnityEngine.SoftJointLimitSpring>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_swingLimitSpring(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CharacterJoint; var result = obj.swingLimitSpring; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_swingLimitSpring(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CharacterJoint; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.swingLimitSpring = argHelper.Get<UnityEngine.SoftJointLimitSpring>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_lowTwistLimit(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CharacterJoint; var result = obj.lowTwistLimit; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_lowTwistLimit(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CharacterJoint; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.lowTwistLimit = argHelper.Get<UnityEngine.SoftJointLimit>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_highTwistLimit(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CharacterJoint; var result = obj.highTwistLimit; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_highTwistLimit(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CharacterJoint; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.highTwistLimit = argHelper.Get<UnityEngine.SoftJointLimit>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_swing1Limit(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CharacterJoint; var result = obj.swing1Limit; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_swing1Limit(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CharacterJoint; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.swing1Limit = argHelper.Get<UnityEngine.SoftJointLimit>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_swing2Limit(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CharacterJoint; var result = obj.swing2Limit; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_swing2Limit(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CharacterJoint; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.swing2Limit = argHelper.Get<UnityEngine.SoftJointLimit>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_enableProjection(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CharacterJoint; var result = obj.enableProjection; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_enableProjection(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CharacterJoint; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.enableProjection = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_projectionDistance(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CharacterJoint; var result = obj.projectionDistance; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_projectionDistance(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CharacterJoint; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.projectionDistance = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_projectionAngle(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CharacterJoint; var result = obj.projectionAngle; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_projectionAngle(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CharacterJoint; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.projectionAngle = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"swingAxis", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_swingAxis, Setter = S_swingAxis} }, {"twistLimitSpring", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_twistLimitSpring, Setter = S_twistLimitSpring} }, {"swingLimitSpring", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_swingLimitSpring, Setter = S_swingLimitSpring} }, {"lowTwistLimit", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_lowTwistLimit, Setter = S_lowTwistLimit} }, {"highTwistLimit", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_highTwistLimit, Setter = S_highTwistLimit} }, {"swing1Limit", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_swing1Limit, Setter = S_swing1Limit} }, {"swing2Limit", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_swing2Limit, Setter = S_swing2Limit} }, {"enableProjection", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_enableProjection, Setter = S_enableProjection} }, {"projectionDistance", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_projectionDistance, Setter = S_projectionDistance} }, {"projectionAngle", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_projectionAngle, Setter = S_projectionAngle} }, } }; } } } <|start_filename|>Projects/Csharp_DotNet5_json_ExportServer/Gen/blueprint/NormalClazz.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; using System.Text.Json; namespace cfg.blueprint { public sealed class NormalClazz : blueprint.Clazz { public NormalClazz(JsonElement _json) : base(_json) { IsAbstract = _json.GetProperty("is_abstract").GetBoolean(); { var _json0 = _json.GetProperty("fields"); Fields = new System.Collections.Generic.List<blueprint.Field>(_json0.GetArrayLength()); foreach(JsonElement __e in _json0.EnumerateArray()) { blueprint.Field __v; __v = blueprint.Field.DeserializeField(__e); Fields.Add(__v); } } } public NormalClazz(string name, string desc, System.Collections.Generic.List<blueprint.Clazz> parents, System.Collections.Generic.List<blueprint.Method> methods, bool is_abstract, System.Collections.Generic.List<blueprint.Field> fields ) : base(name,desc,parents,methods) { this.IsAbstract = is_abstract; this.Fields = fields; } public static NormalClazz DeserializeNormalClazz(JsonElement _json) { return new blueprint.NormalClazz(_json); } public bool IsAbstract { get; private set; } public System.Collections.Generic.List<blueprint.Field> Fields { get; private set; } public const int __ID__ = -2073576778; public override int GetTypeId() => __ID__; public override void Resolve(Dictionary<string, object> _tables) { base.Resolve(_tables); foreach(var _e in Fields) { _e?.Resolve(_tables); } } public override void TranslateText(System.Func<string, string, string> translator) { base.TranslateText(translator); foreach(var _e in Fields) { _e?.TranslateText(translator); } } public override string ToString() { return "{ " + "Name:" + Name + "," + "Desc:" + Desc + "," + "Parents:" + Bright.Common.StringUtil.CollectionToString(Parents) + "," + "Methods:" + Bright.Common.StringUtil.CollectionToString(Methods) + "," + "IsAbstract:" + IsAbstract + "," + "Fields:" + Bright.Common.StringUtil.CollectionToString(Fields) + "," + "}"; } } } <|start_filename|>Projects/DataTemplates/template_erlang2/test_tbtestmap.erl<|end_filename|> %% test.TbTestMap -module(test_tbtestmap) -export([get/1,get_ids/0]) get(1) -> #{ id => 1, x1 => map, x2 => map, x3 => map, x4 => map }. get_ids() -> [1]. <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_Gradient_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_Gradient_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.Gradient(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.Gradient), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Evaluate(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Gradient; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetFloat(false); var result = obj.Evaluate(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetKeys(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Gradient; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<UnityEngine.GradientColorKey[]>(false); var Arg1 = argHelper1.Get<UnityEngine.GradientAlphaKey[]>(false); obj.SetKeys(Arg0,Arg1); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Equals(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Gradient; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.Any, typeof(System.Object), false, false)) { var Arg0 = argHelper0.Get<System.Object>(false); var result = obj.Equals(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Gradient), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Gradient>(false); var result = obj.Equals(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to Equals"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetHashCode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Gradient; { { var result = obj.GetHashCode(); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_colorKeys(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Gradient; var result = obj.colorKeys; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_colorKeys(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Gradient; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.colorKeys = argHelper.Get<UnityEngine.GradientColorKey[]>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_alphaKeys(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Gradient; var result = obj.alphaKeys; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_alphaKeys(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Gradient; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.alphaKeys = argHelper.Get<UnityEngine.GradientAlphaKey[]>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_mode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Gradient; var result = obj.mode; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_mode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Gradient; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.mode = (UnityEngine.GradientMode)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "Evaluate", IsStatic = false}, M_Evaluate }, { new Puerts.MethodKey {Name = "SetKeys", IsStatic = false}, M_SetKeys }, { new Puerts.MethodKey {Name = "Equals", IsStatic = false}, M_Equals }, { new Puerts.MethodKey {Name = "GetHashCode", IsStatic = false}, M_GetHashCode }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"colorKeys", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_colorKeys, Setter = S_colorKeys} }, {"alphaKeys", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_alphaKeys, Setter = S_alphaKeys} }, {"mode", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_mode, Setter = S_mode} }, } }; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_jvalue_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_jvalue_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.jvalue constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_z(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.jvalue)Puerts.Utils.GetSelf((int)data, self); var result = obj.z; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_z(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.jvalue)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.z = argHelper.GetBoolean(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_b(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.jvalue)Puerts.Utils.GetSelf((int)data, self); var result = obj.b; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_b(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.jvalue)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.b = argHelper.GetSByte(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_c(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.jvalue)Puerts.Utils.GetSelf((int)data, self); var result = obj.c; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_c(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.jvalue)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.c = argHelper.Get<System.Char>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_s(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.jvalue)Puerts.Utils.GetSelf((int)data, self); var result = obj.s; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_s(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.jvalue)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.s = argHelper.GetInt16(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_i(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.jvalue)Puerts.Utils.GetSelf((int)data, self); var result = obj.i; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_i(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.jvalue)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.i = argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_j(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.jvalue)Puerts.Utils.GetSelf((int)data, self); var result = obj.j; Puerts.PuertsDLL.ReturnBigInt(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_j(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.jvalue)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.j = argHelper.GetInt64(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_f(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.jvalue)Puerts.Utils.GetSelf((int)data, self); var result = obj.f; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_f(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.jvalue)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.f = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_d(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.jvalue)Puerts.Utils.GetSelf((int)data, self); var result = obj.d; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_d(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.jvalue)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.d = argHelper.GetDouble(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_l(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.jvalue)Puerts.Utils.GetSelf((int)data, self); var result = obj.l; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_l(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.jvalue)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.l = argHelper.Get<System.IntPtr>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"z", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_z, Setter = S_z} }, {"b", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_b, Setter = S_b} }, {"c", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_c, Setter = S_c} }, {"s", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_s, Setter = S_s} }, {"i", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_i, Setter = S_i} }, {"j", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_j, Setter = S_j} }, {"f", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_f, Setter = S_f} }, {"d", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_d, Setter = S_d} }, {"l", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_l, Setter = S_l} }, } }; } } } <|start_filename|>Projects/Csharp_Unity_bin_use_UnityEngine_Vector/Assets/Gen/item/InteractionItem.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.item { public sealed class InteractionItem : item.ItemExtra { public InteractionItem(ByteBuf _buf) : base(_buf) { if(_buf.ReadBool()){ AttackNum = _buf.ReadInt(); } else { AttackNum = null; } HoldingStaticMesh = _buf.ReadString(); HoldingStaticMeshMat = _buf.ReadString(); } public static InteractionItem DeserializeInteractionItem(ByteBuf _buf) { return new item.InteractionItem(_buf); } public int? AttackNum { get; private set; } public string HoldingStaticMesh { get; private set; } public string HoldingStaticMeshMat { get; private set; } public const int __ID__ = 640937802; public override int GetTypeId() => __ID__; public override void Resolve(Dictionary<string, object> _tables) { base.Resolve(_tables); } public override void TranslateText(System.Func<string, string, string> translator) { base.TranslateText(translator); } public override string ToString() { return "{ " + "Id:" + Id + "," + "AttackNum:" + AttackNum + "," + "HoldingStaticMesh:" + HoldingStaticMesh + "," + "HoldingStaticMeshMat:" + HoldingStaticMeshMat + "," + "}"; } } } <|start_filename|>Projects/GenerateDatas/convert_lua/mail.TbSystemMail/12.lua<|end_filename|> return { id = 12, title = "测试2", sender = "系统", content = "测试内容2", award = { 1, }, } <|start_filename|>Projects/DataTemplates/template_erlang/bonus_tbdrop.erl<|end_filename|> %% bonus.TbDrop get(1) -> #{id => 1,desc => "奖励一个物品",client_show_items => [],bonus => #{name__ => "OneItem",item_id => 1021490001}}. get(2) -> #{id => 2,desc => "随机掉落一个",client_show_items => [],bonus => #{name__ => "OneItem",item_id => 1021490001}}. <|start_filename|>Projects/L10N/gen_with_text_localization_TW.bat<|end_filename|> set WORKSPACE=..\.. set GEN_CLIENT=%WORKSPACE%\Tools\Luban.Client\Luban.Client.exe set CONF_ROOT=%WORKSPACE%\DesignerConfigs %GEN_CLIENT% -h %LUBAN_SERVER_IP% -j cfg --^ -d %CONF_ROOT%\Defines\__root__.xml ^ --input_data_dir %CONF_ROOT%\Datas ^ --output_code_dir Gen ^ --output_data_dir config_data ^ --gen_types data_lua ^ -s all ^ --l10n:input_text_files l10n/cn/TextTable_CN.xlsx ^ --l10n:text_field_name text_tw ^ --l10n:output_not_translated_text_file NotLocalized_CN.txt pause <|start_filename|>Projects/Csharp_CustomTemplate_EncryptMemory/Gen/error/TbCodeInfo.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using System; using Scripts; namespace cfg.error { [Config] public partial class TbCodeInfo : ACategory<CodeInfo> { public override void TranslateText(Func<string, string, string> translator) { foreach(var v in dict.Values) { v.TranslateText(translator); } } } } <|start_filename|>Projects/Java_bin/src/main/gen/cfg/ai/BehaviorTree.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.ai; import bright.serialization.*; public final class BehaviorTree { public BehaviorTree(ByteBuf _buf) { id = _buf.readInt(); name = _buf.readString(); desc = _buf.readString(); blackboardId = _buf.readString(); root = cfg.ai.ComposeNode.deserializeComposeNode(_buf); } public BehaviorTree(int id, String name, String desc, String blackboard_id, cfg.ai.ComposeNode root ) { this.id = id; this.name = name; this.desc = desc; this.blackboardId = blackboard_id; this.root = root; } public final int id; public final String name; public final String desc; public final String blackboardId; public cfg.ai.Blackboard blackboardId_Ref; public final cfg.ai.ComposeNode root; public void resolve(java.util.HashMap<String, Object> _tables) { this.blackboardId_Ref = ((cfg.ai.TbBlackboard)_tables.get("ai.TbBlackboard")).get(blackboardId); if (root != null) {root.resolve(_tables);} } @Override public String toString() { return "{ " + "id:" + id + "," + "name:" + name + "," + "desc:" + desc + "," + "blackboardId:" + blackboardId + "," + "root:" + root + "," + "}"; } } <|start_filename|>Projects/GenerateDatas/convert_lua/error.TbCodeInfo/901.lua<|end_filename|> return { code = 901, key = "SUIT_COMPONENT_NOT_UNLOCK", } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_RequireComponent_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_RequireComponent_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Type), false, false)) { var Arg0 = argHelper0.Get<System.Type>(false); var result = new UnityEngine.RequireComponent(Arg0); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.RequireComponent), result); } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Type), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Type), false, false)) { var Arg0 = argHelper0.Get<System.Type>(false); var Arg1 = argHelper1.Get<System.Type>(false); var result = new UnityEngine.RequireComponent(Arg0,Arg1); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.RequireComponent), result); } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Type), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Type), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Type), false, false)) { var Arg0 = argHelper0.Get<System.Type>(false); var Arg1 = argHelper1.Get<System.Type>(false); var Arg2 = argHelper2.Get<System.Type>(false); var result = new UnityEngine.RequireComponent(Arg0,Arg1,Arg2); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.RequireComponent), result); } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.RequireComponent constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_m_Type0(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RequireComponent; var result = obj.m_Type0; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_m_Type0(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RequireComponent; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.m_Type0 = argHelper.Get<System.Type>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_m_Type1(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RequireComponent; var result = obj.m_Type1; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_m_Type1(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RequireComponent; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.m_Type1 = argHelper.Get<System.Type>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_m_Type2(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RequireComponent; var result = obj.m_Type2; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_m_Type2(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RequireComponent; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.m_Type2 = argHelper.Get<System.Type>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"m_Type0", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_m_Type0, Setter = S_m_Type0} }, {"m_Type1", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_m_Type1, Setter = S_m_Type1} }, {"m_Type2", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_m_Type2, Setter = S_m_Type2} }, } }; } } } <|start_filename|>Projects/Lua_Unity_tolua_lua/Assets/Core/ByteBuf.cs<|end_filename|> using System; using System.Diagnostics.CodeAnalysis; using System.Numerics; using System.Runtime.CompilerServices; using System.Text; namespace Bright.Serialization { public readonly struct SegmentSaveState { public SegmentSaveState(int readerIndex, int writerIndex) { ReaderIndex = readerIndex; WriterIndex = writerIndex; } public int ReaderIndex { get; } public int WriterIndex { get; } } public sealed class ByteBuf : ICloneable, IEquatable<ByteBuf> { public ByteBuf() { Bytes = Array.Empty<byte>(); ReaderIndex = WriterIndex = 0; } public ByteBuf(int capacity) { Bytes = capacity > 0 ? new byte[capacity] : Array.Empty<byte>(); ReaderIndex = 0; WriterIndex = 0; } public ByteBuf(byte[] bytes) { Bytes = bytes; ReaderIndex = 0; WriterIndex = Capacity; } public ByteBuf(byte[] bytes, int readIndex, int writeIndex) { Bytes = bytes; ReaderIndex = readIndex; WriterIndex = writeIndex; } public ByteBuf(int capacity, Action<ByteBuf> releaser) : this(capacity) { _releaser = releaser; } public static ByteBuf Wrap(byte[] bytes) { return new ByteBuf(bytes, 0, bytes.Length); } public void Replace(byte[] bytes) { Bytes = bytes; ReaderIndex = 0; WriterIndex = Capacity; } public void Replace(byte[] bytes, int beginPos, int endPos) { Bytes = bytes; ReaderIndex = beginPos; WriterIndex = endPos; } public int ReaderIndex { get; set; } public int WriterIndex { get; set; } private readonly Action<ByteBuf> _releaser; public int Capacity => Bytes.Length; public int Size { get { return WriterIndex - ReaderIndex; } } public bool Empty => WriterIndex <= ReaderIndex; public bool NotEmpty => WriterIndex > ReaderIndex; public void AddWriteIndex(int add) { WriterIndex += add; } public void AddReadIndex(int add) { ReaderIndex += add; } #pragma warning disable CA1819 // 属性不应返回数组 public byte[] Bytes { get; private set; } #pragma warning restore CA1819 // 属性不应返回数组 public byte[] CopyData() { var n = Remaining; if (n > 0) { var arr = new byte[n]; Buffer.BlockCopy(Bytes, ReaderIndex, arr, 0, n); return arr; } else { return Array.Empty<byte>(); } } public int Remaining { get { return WriterIndex - ReaderIndex; } } public void DiscardReadBytes() { WriterIndex -= ReaderIndex; Array.Copy(Bytes, ReaderIndex, Bytes, 0, WriterIndex); ReaderIndex = 0; } public int NotCompactWritable { get { return Capacity - WriterIndex; } } public void WriteBytesWithoutSize(byte[] bs) { WriteBytesWithoutSize(bs, 0, bs.Length); } public void WriteBytesWithoutSize(byte[] bs, int offset, int len) { EnsureWrite(len); Buffer.BlockCopy(bs, offset, Bytes, WriterIndex, len); WriterIndex += len; } public void Clear() { ReaderIndex = WriterIndex = 0; } private const int MIN_CAPACITY = 16; private static int PropSize(int initSize, int needSize) { for (int i = Math.Max(initSize, MIN_CAPACITY); ; i <<= 1) { if (i >= needSize) { return i; } } } private void EnsureWrite0(int size) { var needSize = WriterIndex + size - ReaderIndex; if (needSize < Capacity) { WriterIndex -= ReaderIndex; Array.Copy(Bytes, ReaderIndex, Bytes, 0, WriterIndex); ReaderIndex = 0; } else { int newCapacity = PropSize(Capacity, needSize); var newBytes = new byte[newCapacity]; WriterIndex -= ReaderIndex; Buffer.BlockCopy(Bytes, ReaderIndex, newBytes, 0, WriterIndex); ReaderIndex = 0; Bytes = newBytes; } } [MethodImpl(MethodImplOptions.AggressiveInlining)] public void EnsureWrite(int size) { if (WriterIndex + size > Capacity) { EnsureWrite0(size); } } [MethodImpl(MethodImplOptions.AggressiveInlining)] private void EnsureRead(int size) { if (ReaderIndex + size > WriterIndex) { throw new SerializationException(); } } [MethodImpl(MethodImplOptions.AggressiveInlining)] private bool CanRead(int size) { return (ReaderIndex + size <= WriterIndex); } public void Append(byte x) { EnsureWrite(1); Bytes[WriterIndex++] = x; } public void WriteBool(bool b) { EnsureWrite(1); Bytes[WriterIndex++] = (byte)(b ? 1 : 0); } public bool ReadBool() { EnsureRead(1); return Bytes[ReaderIndex++] != 0; } public void WriteByte(byte x) { EnsureWrite(1); Bytes[WriterIndex++] = x; } public byte ReadByte() { EnsureRead(1); return Bytes[ReaderIndex++]; } public void WriteShort(short x) { if (x >= 0) { if (x < 0x80) { EnsureWrite(1); Bytes[WriterIndex++] = (byte)x; return; } else if (x < 0x4000) { EnsureWrite(2); Bytes[WriterIndex + 1] = (byte)x; Bytes[WriterIndex] = (byte)((x >> 8) | 0x80); WriterIndex += 2; return; } } EnsureWrite(3); Bytes[WriterIndex] = 0xff; Bytes[WriterIndex + 2] = (byte)x; Bytes[WriterIndex + 1] = (byte)(x >> 8); WriterIndex += 3; } public short ReadShort() { EnsureRead(1); int h = Bytes[ReaderIndex]; if (h < 0x80) { ReaderIndex++; return (short)h; } else if (h < 0xc0) { EnsureRead(2); int x = ((h & 0x3f) << 8) | Bytes[ReaderIndex + 1]; ReaderIndex += 2; return (short)x; } else if ((h == 0xff)) { EnsureRead(3); int x = (Bytes[ReaderIndex + 1] << 8) | Bytes[ReaderIndex + 2]; ReaderIndex += 3; return (short)x; } else { throw new SerializationException(); } } public short ReadFshort() { EnsureRead(2); short x; #if CPU_SUPPORT_MEMORY_NOT_ALIGN unsafe { fixed (byte* b = &Bytes[ReaderIndex]) { x = *(short*)b; } } #else x = (short)((Bytes[ReaderIndex + 1] << 8) | Bytes[ReaderIndex]); #endif ReaderIndex += 2; return x; } public void WriteFshort(short x) { EnsureWrite(2); #if CPU_SUPPORT_MEMORY_NOT_ALIGN unsafe { fixed (byte* b = &Bytes[WriterIndex]) { *(short*)b = x; } } #else Bytes[WriterIndex] = (byte)x; Bytes[WriterIndex + 1] = (byte)(x >> 8); #endif WriterIndex += 2; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public void WriteInt(int x) { WriteUint((uint)x); } [MethodImpl(MethodImplOptions.AggressiveInlining)] public int ReadInt() { return (int)ReadUint(); } public void WriteUint(uint x) { // 如果有修改,记得也把 EndWriteSegment改了 // 0 111 1111 if (x < 0x80) { EnsureWrite(1); Bytes[WriterIndex++] = (byte)x; } else if (x < 0x4000) // 10 11 1111, - { EnsureWrite(2); Bytes[WriterIndex + 1] = (byte)x; Bytes[WriterIndex] = (byte)((x >> 8) | 0x80); WriterIndex += 2; } else if (x < 0x200000) // 110 1 1111, -,- { EnsureWrite(3); Bytes[WriterIndex + 2] = (byte)x; Bytes[WriterIndex + 1] = (byte)(x >> 8); Bytes[WriterIndex] = (byte)((x >> 16) | 0xc0); WriterIndex += 3; } else if (x < 0x10000000) // 1110 1111,-,-,- { EnsureWrite(4); Bytes[WriterIndex + 3] = (byte)x; Bytes[WriterIndex + 2] = (byte)(x >> 8); Bytes[WriterIndex + 1] = (byte)(x >> 16); Bytes[WriterIndex] = (byte)((x >> 24) | 0xe0); WriterIndex += 4; } else { EnsureWrite(5); Bytes[WriterIndex] = 0xf0; Bytes[WriterIndex + 4] = (byte)x; Bytes[WriterIndex + 3] = (byte)(x >> 8); Bytes[WriterIndex + 2] = (byte)(x >> 16); Bytes[WriterIndex + 1] = (byte)(x >> 24); WriterIndex += 5; } } public uint ReadUint() { /// /// 警告! 如有修改,记得调整 TryDeserializeInplaceOctets EnsureRead(1); uint h = Bytes[ReaderIndex]; if (h < 0x80) { ReaderIndex++; return h; } else if (h < 0xc0) { EnsureRead(2); uint x = ((h & 0x3f) << 8) | Bytes[ReaderIndex + 1]; ReaderIndex += 2; return x; } else if (h < 0xe0) { EnsureRead(3); uint x = ((h & 0x1f) << 16) | ((uint)Bytes[ReaderIndex + 1] << 8) | Bytes[ReaderIndex + 2]; ReaderIndex += 3; return x; } else if (h < 0xf0) { EnsureRead(4); uint x = ((h & 0x0f) << 24) | ((uint)Bytes[ReaderIndex + 1] << 16) | ((uint)Bytes[ReaderIndex + 2] << 8) | Bytes[ReaderIndex + 3]; ReaderIndex += 4; return x; } else { EnsureRead(5); uint x = ((uint)Bytes[ReaderIndex + 1] << 24) | ((uint)(Bytes[ReaderIndex + 2] << 16)) | ((uint)Bytes[ReaderIndex + 3] << 8) | Bytes[ReaderIndex + 4]; ReaderIndex += 5; return x; } } public unsafe void WriteUint_Unsafe(uint x) { // 0 111 1111 if (x < 0x80) { EnsureWrite(1); Bytes[WriterIndex++] = (byte)(x << 1); } else if (x < 0x4000)// 10 11 1111, - { EnsureWrite(2); fixed (byte* wb = &Bytes[WriterIndex]) { *(uint*)(wb) = (x << 2 | 0b01); } WriterIndex += 2; } else if (x < 0x200000) // 110 1 1111, -,- { EnsureWrite(3); fixed (byte* wb = &Bytes[WriterIndex]) { *(uint*)(wb) = (x << 3 | 0b011); } WriterIndex += 3; } else if (x < 0x10000000) // 1110 1111,-,-,- { EnsureWrite(4); fixed (byte* wb = &Bytes[WriterIndex]) { *(uint*)(wb) = (x << 4 | 0b0111); } WriterIndex += 4; } else { EnsureWrite(5); fixed (byte* wb = &Bytes[WriterIndex]) { *(uint*)(wb) = (x << 5 | 0b01111); } WriterIndex += 5; } } public unsafe uint ReadUint_Unsafe() { /// /// 警告! 如有修改,记得调整 TryDeserializeInplaceOctets EnsureRead(1); uint h = Bytes[ReaderIndex]; if ((h & 0b1) == 0b0) { ReaderIndex++; return (h >> 1); } else if ((h & 0b11) == 0b01) { EnsureRead(2); fixed (byte* rb = &Bytes[ReaderIndex]) { ReaderIndex += 2; return (*(uint*)rb) >> 2; } } else if ((h & 0b111) == 0b011) { EnsureRead(3); fixed (byte* rb = &Bytes[ReaderIndex]) { ReaderIndex += 3; return (*(uint*)rb) >> 3; } } else if ((h & 0b1111) == 0b0111) { EnsureRead(4); fixed (byte* rb = &Bytes[ReaderIndex]) { ReaderIndex += 4; return (*(uint*)rb) >> 4; } } else { EnsureRead(5); fixed (byte* rb = &Bytes[ReaderIndex]) { ReaderIndex += 5; return (*(uint*)rb) >> 5; } } } public int ReadFint() { EnsureRead(4); int x; #if CPU_SUPPORT_MEMORY_NOT_ALIGN unsafe { fixed (byte* b = &Bytes[ReaderIndex]) { x = *(int*)b; } } #else x = (Bytes[ReaderIndex + 3] << 24) | (Bytes[ReaderIndex + 2] << 16) | (Bytes[ReaderIndex + 1] << 8) | (Bytes[ReaderIndex]); #endif ReaderIndex += 4; return x; } public void WriteFint(int x) { EnsureWrite(4); #if CPU_SUPPORT_MEMORY_NOT_ALIGN unsafe { fixed (byte* b = &Bytes[WriterIndex]) { *(int*)b = x; } } #else Bytes[WriterIndex] = (byte)x; Bytes[WriterIndex + 1] = (byte)(x >> 8); Bytes[WriterIndex + 2] = (byte)(x >> 16); Bytes[WriterIndex + 3] = (byte)(x >> 24); #endif WriterIndex += 4; } public int ReadFint_Safe() { EnsureRead(4); int x; x = (Bytes[ReaderIndex + 3] << 24) | (Bytes[ReaderIndex + 2] << 16) | (Bytes[ReaderIndex + 1] << 8) | (Bytes[ReaderIndex]); ReaderIndex += 4; return x; } public void WriteFint_Safe(int x) { EnsureWrite(4); Bytes[WriterIndex] = (byte)x; Bytes[WriterIndex + 1] = (byte)(x >> 8); Bytes[WriterIndex + 2] = (byte)(x >> 16); Bytes[WriterIndex + 3] = (byte)(x >> 24); WriterIndex += 4; } public void WriteLong(long x) { WriteUlong((ulong)x); } public long ReadLong() { return (long)ReadUlong(); } private void WriteUlong(ulong x) { // 0 111 1111 if (x < 0x80) { EnsureWrite(1); Bytes[WriterIndex++] = (byte)x; } else if (x < 0x4000) // 10 11 1111, - { EnsureWrite(2); Bytes[WriterIndex + 1] = (byte)x; Bytes[WriterIndex] = (byte)((x >> 8) | 0x80); WriterIndex += 2; } else if (x < 0x200000) // 110 1 1111, -,- { EnsureWrite(3); Bytes[WriterIndex + 2] = (byte)x; Bytes[WriterIndex + 1] = (byte)(x >> 8); Bytes[WriterIndex] = (byte)((x >> 16) | 0xc0); WriterIndex += 3; } else if (x < 0x10000000) // 1110 1111,-,-,- { EnsureWrite(4); Bytes[WriterIndex + 3] = (byte)x; Bytes[WriterIndex + 2] = (byte)(x >> 8); Bytes[WriterIndex + 1] = (byte)(x >> 16); Bytes[WriterIndex] = (byte)((x >> 24) | 0xe0); WriterIndex += 4; } else if (x < 0x800000000L) // 1111 0xxx,-,-,-,- { EnsureWrite(5); Bytes[WriterIndex + 4] = (byte)x; Bytes[WriterIndex + 3] = (byte)(x >> 8); Bytes[WriterIndex + 2] = (byte)(x >> 16); Bytes[WriterIndex + 1] = (byte)(x >> 24); Bytes[WriterIndex] = (byte)((x >> 32) | 0xf0); WriterIndex += 5; } else if (x < 0x40000000000L) // 1111 10xx, { EnsureWrite(6); Bytes[WriterIndex + 5] = (byte)x; Bytes[WriterIndex + 4] = (byte)(x >> 8); Bytes[WriterIndex + 3] = (byte)(x >> 16); Bytes[WriterIndex + 2] = (byte)(x >> 24); Bytes[WriterIndex + 1] = (byte)(x >> 32); Bytes[WriterIndex] = (byte)((x >> 40) | 0xf8); WriterIndex += 6; } else if (x < 0x200000000000L) // 1111 110x, { EnsureWrite(7); Bytes[WriterIndex + 6] = (byte)x; Bytes[WriterIndex + 5] = (byte)(x >> 8); Bytes[WriterIndex + 4] = (byte)(x >> 16); Bytes[WriterIndex + 3] = (byte)(x >> 24); Bytes[WriterIndex + 2] = (byte)(x >> 32); Bytes[WriterIndex + 1] = (byte)(x >> 40); Bytes[WriterIndex] = (byte)((x >> 48) | 0xfc); WriterIndex += 7; } else if (x < 0x100000000000000L) // 1111 1110 { EnsureWrite(8); Bytes[WriterIndex + 7] = (byte)x; Bytes[WriterIndex + 6] = (byte)(x >> 8); Bytes[WriterIndex + 5] = (byte)(x >> 16); Bytes[WriterIndex + 4] = (byte)(x >> 24); Bytes[WriterIndex + 3] = (byte)(x >> 32); Bytes[WriterIndex + 2] = (byte)(x >> 40); Bytes[WriterIndex + 1] = (byte)(x >> 48); Bytes[WriterIndex] = 0xfe; WriterIndex += 8; } else // 1111 1111 { EnsureWrite(9); Bytes[WriterIndex] = 0xff; Bytes[WriterIndex + 8] = (byte)x; Bytes[WriterIndex + 7] = (byte)(x >> 8); Bytes[WriterIndex + 6] = (byte)(x >> 16); Bytes[WriterIndex + 5] = (byte)(x >> 24); Bytes[WriterIndex + 4] = (byte)(x >> 32); Bytes[WriterIndex + 3] = (byte)(x >> 40); Bytes[WriterIndex + 2] = (byte)(x >> 48); Bytes[WriterIndex + 1] = (byte)(x >> 56); WriterIndex += 9; } } public ulong ReadUlong() { EnsureRead(1); uint h = Bytes[ReaderIndex]; if (h < 0x80) { ReaderIndex++; return h; } else if (h < 0xc0) { EnsureRead(2); uint x = ((h & 0x3f) << 8) | Bytes[ReaderIndex + 1]; ReaderIndex += 2; return x; } else if (h < 0xe0) { EnsureRead(3); uint x = ((h & 0x1f) << 16) | ((uint)Bytes[ReaderIndex + 1] << 8) | Bytes[ReaderIndex + 2]; ReaderIndex += 3; return x; } else if (h < 0xf0) { EnsureRead(4); uint x = ((h & 0x0f) << 24) | ((uint)Bytes[ReaderIndex + 1] << 16) | ((uint)Bytes[ReaderIndex + 2] << 8) | Bytes[ReaderIndex + 3]; ReaderIndex += 4; return x; } else if (h < 0xf8) { EnsureRead(5); uint xl = ((uint)Bytes[ReaderIndex + 1] << 24) | ((uint)(Bytes[ReaderIndex + 2] << 16)) | ((uint)Bytes[ReaderIndex + 3] << 8) | (Bytes[ReaderIndex + 4]); uint xh = h & 0x07; ReaderIndex += 5; return ((ulong)xh << 32) | xl; } else if (h < 0xfc) { EnsureRead(6); uint xl = ((uint)Bytes[ReaderIndex + 2] << 24) | ((uint)(Bytes[ReaderIndex + 3] << 16)) | ((uint)Bytes[ReaderIndex + 4] << 8) | (Bytes[ReaderIndex + 5]); uint xh = ((h & 0x03) << 8) | Bytes[ReaderIndex + 1]; ReaderIndex += 6; return ((ulong)xh << 32) | xl; } else if (h < 0xfe) { EnsureRead(7); uint xl = ((uint)Bytes[ReaderIndex + 3] << 24) | ((uint)(Bytes[ReaderIndex + 4] << 16)) | ((uint)Bytes[ReaderIndex + 5] << 8) | (Bytes[ReaderIndex + 6]); uint xh = ((h & 0x01) << 16) | ((uint)Bytes[ReaderIndex + 1] << 8) | Bytes[ReaderIndex + 2]; ReaderIndex += 7; return ((ulong)xh << 32) | xl; } else if (h < 0xff) { EnsureRead(8); uint xl = ((uint)Bytes[ReaderIndex + 4] << 24) | ((uint)(Bytes[ReaderIndex + 5] << 16)) | ((uint)Bytes[ReaderIndex + 6] << 8) | (Bytes[ReaderIndex + 7]); uint xh = /*((h & 0x01) << 24) |*/ ((uint)Bytes[ReaderIndex + 1] << 16) | ((uint)Bytes[ReaderIndex + 2] << 8) | Bytes[ReaderIndex + 3]; ReaderIndex += 8; return ((ulong)xh << 32) | xl; } else { EnsureRead(9); uint xl = ((uint)Bytes[ReaderIndex + 5] << 24) | ((uint)(Bytes[ReaderIndex + 6] << 16)) | ((uint)Bytes[ReaderIndex + 7] << 8) | (Bytes[ReaderIndex + 8]); uint xh = ((uint)Bytes[ReaderIndex + 1] << 24) | ((uint)Bytes[ReaderIndex + 2] << 16) | ((uint)Bytes[ReaderIndex + 3] << 8) | Bytes[ReaderIndex + 4]; ReaderIndex += 9; return ((ulong)xh << 32) | xl; } } public void WriteFlong(long x) { EnsureWrite(8); #if CPU_SUPPORT_MEMORY_NOT_ALIGN unsafe { fixed (byte* b = &Bytes[WriterIndex]) { *(long*)b = x; } } #else Bytes[WriterIndex] = (byte)x; Bytes[WriterIndex + 1] = (byte)(x >> 8); Bytes[WriterIndex + 2] = (byte)(x >> 16); Bytes[WriterIndex + 3] = (byte)(x >> 24); Bytes[WriterIndex + 4] = (byte)(x >> 32); Bytes[WriterIndex + 5] = (byte)(x >> 40); Bytes[WriterIndex + 6] = (byte)(x >> 48); Bytes[WriterIndex + 7] = (byte)(x >> 56); #endif WriterIndex += 8; } public long ReadFlong() { EnsureRead(8); long x; #if CPU_SUPPORT_MEMORY_NOT_ALIGN unsafe { fixed (byte* b = &Bytes[ReaderIndex]) { x = *(long*)b; } } #else int xl = (Bytes[ReaderIndex + 3] << 24) | ((Bytes[ReaderIndex + 2] << 16)) | (Bytes[ReaderIndex + 1] << 8) | (Bytes[ReaderIndex]); int xh = (Bytes[ReaderIndex + 7] << 24) | (Bytes[ReaderIndex + 6] << 16) | (Bytes[ReaderIndex + 5] << 8) | Bytes[ReaderIndex + 4]; x = ((long)xh << 32) | (long)xl; #endif ReaderIndex += 8; return x; } private static unsafe void Copy8(byte* dst, byte* src) { dst[0] = src[0]; dst[1] = src[1]; dst[2] = src[2]; dst[3] = src[3]; dst[4] = src[4]; dst[5] = src[5]; dst[6] = src[6]; dst[7] = src[7]; } private static unsafe void Copy4(byte* dst, byte* src) { dst[0] = src[0]; dst[1] = src[1]; dst[2] = src[2]; dst[3] = src[3]; } //const bool isLittleEndian = true; public void WriteFloat(float x) { EnsureWrite(4); unsafe { fixed (byte* b = &Bytes[WriterIndex]) { #if !CPU_SUPPORT_MEMORY_NOT_ALIGN if ((long)b % 4 == 0) { *(float*)b = x; } else { Copy4(b, (byte*)&x); } #else *(float*)b = x; #endif } } //if (!BitConverter.IsLittleEndian) //{ // Array.Reverse(data, endPos, 4); //} WriterIndex += 4; } public float ReadFloat() { EnsureRead(4); //if (!BitConverter.IsLittleEndian) //{ // Array.Reverse(data, beginPos, 4); //} float x; unsafe { fixed (byte* b = &Bytes[ReaderIndex]) { #if !CPU_SUPPORT_MEMORY_NOT_ALIGN if ((long)b % 4 == 0) { x = *(float*)b; } else { *((int*)&x) = (b[0]) | (b[1] << 8) | (b[2] << 16) | (b[3] << 24); } #else x = *(float*)b; #endif } } ReaderIndex += 4; return x; } public void WriteDouble(double x) { EnsureWrite(8); unsafe { fixed (byte* b = &Bytes[WriterIndex]) { #if !CPU_SUPPORT_MEMORY_NOT_ALIGN if ((long)b % 8 == 0) { *(double*)b = x; } else { Copy8(b, (byte*)&x); } #else *(double*)b = x; #endif } //if (!BitConverter.IsLittleEndian) //{ // Array.Reverse(data, endPos, 8); //} } WriterIndex += 8; } public double ReadDouble() { EnsureRead(8); //if (!BitConverter.IsLittleEndian) //{ // Array.Reverse(data, beginPos, 8); //} double x; unsafe { fixed (byte* b = &Bytes[ReaderIndex]) { #if !CPU_SUPPORT_MEMORY_NOT_ALIGN if ((long)b % 8 == 0) { x = *(double*)b; } else { int low = (b[0]) | (b[1] << 8) | (b[2] << 16) | (b[3] << 24); int high = (b[4]) | (b[5] << 8) | (b[6] << 16) | (b[7] << 24); *((long*)&x) = ((long)high << 32) | (uint)low; } #else x = *(double*)b; #endif } } ReaderIndex += 8; return x; } public void WriteSize(int n) { WriteUint((uint)n); } public int ReadSize() { return (int)ReadUint(); } // marshal int // n -> (n << 1) ^ (n >> 31) // Read // (x >>> 1) ^ ((x << 31) >> 31) // (x >>> 1) ^ -(n&1) public void WriteSint(int x) { WriteUint(((uint)x << 1) ^ ((uint)x >> 31)); } public int ReadSint() { uint x = ReadUint(); return (int)((x >> 1) ^ ((x & 1) << 31)); } // marshal long // n -> (n << 1) ^ (n >> 63) // Read // (x >>> 1) ^((x << 63) >> 63) // (x >>> 1) ^ -(n&1L) public void WriteSlong(long x) { WriteUlong(((ulong)x << 1) ^ ((ulong)x >> 63)); } public long ReadSlong() { long x = ReadLong(); return ((long)((ulong)x >> 1) ^ ((x & 1) << 63)); } public void WriteString(string x) { var n = x != null ? Encoding.UTF8.GetByteCount(x) : 0; WriteSize(n); if (n > 0) { EnsureWrite(n); Encoding.UTF8.GetBytes(x, 0, x.Length, Bytes, WriterIndex); WriterIndex += n; } } // byte[], [start, end) public static Func<byte[], int, int, string> StringCacheFinder { get; set; } public string ReadString() { var n = ReadSize(); if (n > 0) { EnsureRead(n); string s; if (StringCacheFinder == null) { s = Encoding.UTF8.GetString(Bytes, ReaderIndex, n); } else { // 只缓存比较小的字符串 s = StringCacheFinder(Bytes, ReaderIndex, n); } ReaderIndex += n; return s; } else { return ""; } } public void WriteBytes(byte[] x) { var n = x != null ? x.Length : 0; WriteSize(n); if (n > 0) { EnsureWrite(n); x.CopyTo(Bytes, WriterIndex); WriterIndex += n; } } public byte[] ReadBytes() { var n = ReadSize(); if (n > 0) { EnsureRead(n); var x = new byte[n]; Buffer.BlockCopy(Bytes, ReaderIndex, x, 0, n); ReaderIndex += n; return x; } else { return Array.Empty<byte>(); } } // 以下是一些特殊类型 public void WriteComplex(Complex x) { WriteDouble(x.Real); WriteDouble(x.Imaginary); } public Complex ReadComplex() { var x = ReadDouble(); var y = ReadDouble(); return new Complex(x, y); } public void WriteVector2(Vector2 x) { WriteFloat(x.X); WriteFloat(x.Y); } public Vector2 ReadVector2() { float x = ReadFloat(); float y = ReadFloat(); return new Vector2(x, y); } public void WriteVector3(Vector3 x) { WriteFloat(x.X); WriteFloat(x.Y); WriteFloat(x.Z); } public Vector3 ReadVector3() { float x = ReadFloat(); float y = ReadFloat(); float z = ReadFloat(); return new Vector3(x, y, z); } public void WriteVector4(Vector4 x) { WriteFloat(x.X); WriteFloat(x.Y); WriteFloat(x.Z); WriteFloat(x.W); } public Vector4 ReadVector4() { float x = ReadFloat(); float y = ReadFloat(); float z = ReadFloat(); float w = ReadFloat(); return new Vector4(x, y, z, w); } public void WriteQuaternion(Quaternion x) { WriteFloat(x.X); WriteFloat(x.Y); WriteFloat(x.Z); WriteFloat(x.W); } public Quaternion ReadQuaternion() { float x = ReadFloat(); float y = ReadFloat(); float z = ReadFloat(); float w = ReadFloat(); return new Quaternion(x, y, z, w); } public void WriteMatrix4x4(Matrix4x4 x) { WriteFloat(x.M11); WriteFloat(x.M12); WriteFloat(x.M13); WriteFloat(x.M14); WriteFloat(x.M21); WriteFloat(x.M22); WriteFloat(x.M23); WriteFloat(x.M24); WriteFloat(x.M31); WriteFloat(x.M32); WriteFloat(x.M33); WriteFloat(x.M34); WriteFloat(x.M41); WriteFloat(x.M42); WriteFloat(x.M43); WriteFloat(x.M44); } public Matrix4x4 ReadMatrix4x4() { float m11 = ReadFloat(); float m12 = ReadFloat(); float m13 = ReadFloat(); float m14 = ReadFloat(); float m21 = ReadFloat(); float m22 = ReadFloat(); float m23 = ReadFloat(); float m24 = ReadFloat(); float m31 = ReadFloat(); float m32 = ReadFloat(); float m33 = ReadFloat(); float m34 = ReadFloat(); float m41 = ReadFloat(); float m42 = ReadFloat(); float m43 = ReadFloat(); float m44 = ReadFloat(); return new Matrix4x4(m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44); } internal void SkipBytes() { int n = ReadSize(); EnsureRead(n); ReaderIndex += n; } public void WriteByteBufWithSize(ByteBuf o) { int n = o.Size; if (n > 0) { WriteSize(n); WriteBytesWithoutSize(o.Bytes, o.ReaderIndex, n); } else { WriteByte(0); } } public void WriteByteBufWithoutSize(ByteBuf o) { int n = o.Size; if (n > 0) { WriteBytesWithoutSize(o.Bytes, o.ReaderIndex, n); } } public bool TryReadByte(out byte x) { if (CanRead(1)) { x = Bytes[ReaderIndex++]; return true; } else { x = 0; return false; } } public EDeserializeError TryDeserializeInplaceByteBuf(int maxSize, ByteBuf inplaceTempBody) { //if (!CanRead(1)) { return EDeserializeError.NOT_ENOUGH; } int oldReadIndex = ReaderIndex; bool commit = false; try { int n; int h = Bytes[ReaderIndex]; if (h < 0x80) { ReaderIndex++; n = h; } else if (h < 0xc0) { if (!CanRead(2)) { return EDeserializeError.NOT_ENOUGH; } n = ((h & 0x3f) << 8) | Bytes[ReaderIndex + 1]; ReaderIndex += 2; } else if (h < 0xe0) { if (!CanRead(3)) { return EDeserializeError.NOT_ENOUGH; } n = ((h & 0x1f) << 16) | (Bytes[ReaderIndex + 1] << 8) | Bytes[ReaderIndex + 2]; ReaderIndex += 3; } else if (h < 0xf0) { if (!CanRead(4)) { return EDeserializeError.NOT_ENOUGH; } n = ((h & 0x0f) << 24) | (Bytes[ReaderIndex + 1] << 16) | (Bytes[ReaderIndex + 2] << 8) | Bytes[ReaderIndex + 3]; ReaderIndex += 4; } else { return EDeserializeError.EXCEED_SIZE; } if (n > maxSize) { return EDeserializeError.EXCEED_SIZE; } if (Remaining < n) { return EDeserializeError.NOT_ENOUGH; } int inplaceReadIndex = ReaderIndex; ReaderIndex += n; inplaceTempBody.Replace(Bytes, inplaceReadIndex, ReaderIndex); commit = true; } finally { if (!commit) { ReaderIndex = oldReadIndex; } } return EDeserializeError.OK; } public void WriteRawTag(byte b1) { EnsureWrite(1); Bytes[WriterIndex++] = b1; } public void WriteRawTag(byte b1, byte b2) { EnsureWrite(2); Bytes[WriterIndex] = b1; Bytes[WriterIndex + 1] = b2; WriterIndex += 2; } public void WriteRawTag(byte b1, byte b2, byte b3) { EnsureWrite(3); Bytes[WriterIndex] = b1; Bytes[WriterIndex + 1] = b2; Bytes[WriterIndex + 2] = b3; WriterIndex += 3; } #region segment public void BeginWriteSegment(out int oldSize) { oldSize = Size; EnsureWrite(1); WriterIndex += 1; } public void EndWriteSegment(int oldSize) { int startPos = ReaderIndex + oldSize; int segmentSize = WriterIndex - startPos - 1; // 0 111 1111 if (segmentSize < 0x80) { Bytes[startPos] = (byte)segmentSize; } else if (segmentSize < 0x4000) // 10 11 1111, - { EnsureWrite(1); Bytes[WriterIndex] = Bytes[startPos + 1]; Bytes[startPos + 1] = (byte)segmentSize; Bytes[startPos] = (byte)((segmentSize >> 8) | 0x80); WriterIndex += 1; } else if (segmentSize < 0x200000) // 110 1 1111, -,- { EnsureWrite(2); Bytes[WriterIndex + 1] = Bytes[startPos + 2]; Bytes[startPos + 2] = (byte)segmentSize; Bytes[WriterIndex] = Bytes[startPos + 1]; Bytes[startPos + 1] = (byte)(segmentSize >> 8); Bytes[startPos] = (byte)((segmentSize >> 16) | 0xc0); WriterIndex += 2; } else if (segmentSize < 0x10000000) // 1110 1111,-,-,- { EnsureWrite(3); Bytes[WriterIndex + 2] = Bytes[startPos + 3]; Bytes[startPos + 3] = (byte)segmentSize; Bytes[WriterIndex + 1] = Bytes[startPos + 2]; Bytes[startPos + 2] = (byte)(segmentSize >> 8); Bytes[WriterIndex] = Bytes[startPos + 1]; Bytes[startPos + 1] = (byte)(segmentSize >> 16); Bytes[startPos] = (byte)((segmentSize >> 24) | 0xe0); WriterIndex += 3; } else { throw new SerializationException("exceed max segment size"); } } public void ReadSegment(out int startIndex, out int segmentSize) { EnsureRead(1); int h = Bytes[ReaderIndex++]; startIndex = ReaderIndex; if (h < 0x80) { segmentSize = h; ReaderIndex += segmentSize; } else if (h < 0xc0) { EnsureRead(1); segmentSize = ((h & 0x3f) << 8) | Bytes[ReaderIndex]; int endPos = ReaderIndex + segmentSize; Bytes[ReaderIndex] = Bytes[endPos]; ReaderIndex += segmentSize + 1; } else if (h < 0xe0) { EnsureRead(2); segmentSize = ((h & 0x1f) << 16) | ((int)Bytes[ReaderIndex] << 8) | Bytes[ReaderIndex + 1]; int endPos = ReaderIndex + segmentSize; Bytes[ReaderIndex] = Bytes[endPos]; Bytes[ReaderIndex + 1] = Bytes[endPos + 1]; ReaderIndex += segmentSize + 2; } else if (h < 0xf0) { EnsureRead(3); segmentSize = ((h & 0x0f) << 24) | ((int)Bytes[ReaderIndex] << 16) | ((int)Bytes[ReaderIndex + 1] << 8) | Bytes[ReaderIndex + 2]; int endPos = ReaderIndex + segmentSize; Bytes[ReaderIndex] = Bytes[endPos]; Bytes[ReaderIndex + 1] = Bytes[endPos + 1]; Bytes[ReaderIndex + 2] = Bytes[endPos + 2]; ReaderIndex += segmentSize + 3; } else { throw new SerializationException("exceed max size"); } if (ReaderIndex > WriterIndex) { throw new SerializationException("segment data not enough"); } } public void ReadSegment(ByteBuf buf) { ReadSegment(out int startPos, out var size); buf.Bytes = Bytes; buf.ReaderIndex = startPos; buf.WriterIndex = startPos + size; } public void EnterSegment(out SegmentSaveState saveState) { ReadSegment(out int startPos, out int size); saveState = new SegmentSaveState(ReaderIndex, WriterIndex); ReaderIndex = startPos; WriterIndex = startPos + size; } public void LeaveSegment(SegmentSaveState saveState) { ReaderIndex = saveState.ReaderIndex; WriterIndex = saveState.WriterIndex; } #endregion public override string ToString() { string[] datas = new string[WriterIndex - ReaderIndex]; for (var i = ReaderIndex; i < WriterIndex; i++) { datas[i - ReaderIndex] = Bytes[i].ToString("X2"); } return string.Join(".", datas); } public override bool Equals(object obj) { return (obj is ByteBuf other) && Equals(other); } public bool Equals(ByteBuf other) { if (other == null) { return false; } if (Size != other.Size) { return false; } for (int i = 0, n = Size; i < n; i++) { if (Bytes[ReaderIndex + i] != other.Bytes[other.ReaderIndex + i]) { return false; } } return true; } public object Clone() { return new ByteBuf(CopyData()); } public static ByteBuf FromString(string value) { var ss = value.Split(','); byte[] data = new byte[ss.Length]; for (int i = 0; i < data.Length; i++) { data[i] = byte.Parse(ss[i]); } return new ByteBuf(data); } public override int GetHashCode() { int hash = 17; for (int i = ReaderIndex; i < WriterIndex; i++) { hash = hash * 23 + Bytes[i]; } return hash; } public void Release() { _releaser?.Invoke(this); } } } <|start_filename|>Projects/DataTemplates/template_lua/test_tbtestmap.lua<|end_filename|> return { [1] = {id=1,x1={[1]=2,[3]=4,},x2={[1]=2,[3]=4,},x3={["aaa"]=1,["bbb"]=2,},x4={[1]=1,[2]=20,},}, } <|start_filename|>ProtoProjects/Typescript_Unity_Puerts/Assets/Scripts/Libs/Bright.Core/Common/NotNullInitialization.cs<|end_filename|> namespace Bright.Common { public class NotNullInitialization { } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_LightmapSettings_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_LightmapSettings_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.LightmapSettings constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_lightmaps(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.LightmapSettings.lightmaps; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_lightmaps(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.LightmapSettings.lightmaps = argHelper.Get<UnityEngine.LightmapData[]>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_lightmapsMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.LightmapSettings.lightmapsMode; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_lightmapsMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.LightmapSettings.lightmapsMode = (UnityEngine.LightmapsMode)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_lightProbes(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.LightmapSettings.lightProbes; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_lightProbes(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.LightmapSettings.lightProbes = argHelper.Get<UnityEngine.LightProbes>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"lightmaps", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_lightmaps, Setter = S_lightmaps} }, {"lightmapsMode", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_lightmapsMode, Setter = S_lightmapsMode} }, {"lightProbes", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_lightProbes, Setter = S_lightProbes} }, } }; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Bin/Assets/Gen/UnityEngine_ComputeShader_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_ComputeShader_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.ComputeShader constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_FindKernel(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ComputeShader; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetString(false); var result = obj.FindKernel(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_HasKernel(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ComputeShader; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetString(false); var result = obj.HasKernel(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetFloat(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ComputeShader; if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetFloat(false); obj.SetFloat(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.GetFloat(false); obj.SetFloat(Arg0,Arg1); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SetFloat"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetInt(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ComputeShader; if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); obj.SetInt(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.GetInt32(false); obj.SetInt(Arg0,Arg1); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SetInt"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetVector(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ComputeShader; if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector4), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.Vector4>(false); obj.SetVector(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector4), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<UnityEngine.Vector4>(false); obj.SetVector(Arg0,Arg1); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SetVector"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetMatrix(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ComputeShader; if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Matrix4x4), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.Matrix4x4>(false); obj.SetMatrix(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Matrix4x4), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<UnityEngine.Matrix4x4>(false); obj.SetMatrix(Arg0,Arg1); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SetMatrix"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetVectorArray(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ComputeShader; if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector4[]), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.Vector4[]>(false); obj.SetVectorArray(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector4[]), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<UnityEngine.Vector4[]>(false); obj.SetVectorArray(Arg0,Arg1); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SetVectorArray"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetMatrixArray(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ComputeShader; if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Matrix4x4[]), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.Matrix4x4[]>(false); obj.SetMatrixArray(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Matrix4x4[]), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<UnityEngine.Matrix4x4[]>(false); obj.SetMatrixArray(Arg0,Arg1); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SetMatrixArray"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetTexture(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ComputeShader; if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.Get<UnityEngine.Texture>(false); var Arg3 = argHelper3.GetInt32(false); obj.SetTexture(Arg0,Arg1,Arg2,Arg3); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetString(false); var Arg2 = argHelper2.Get<UnityEngine.Texture>(false); var Arg3 = argHelper3.GetInt32(false); obj.SetTexture(Arg0,Arg1,Arg2,Arg3); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.Get<UnityEngine.Texture>(false); obj.SetTexture(Arg0,Arg1,Arg2); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetString(false); var Arg2 = argHelper2.Get<UnityEngine.Texture>(false); obj.SetTexture(Arg0,Arg1,Arg2); return; } } if (paramLen == 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RenderTexture), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.Get<UnityEngine.RenderTexture>(false); var Arg3 = argHelper3.GetInt32(false); var Arg4 = (UnityEngine.Rendering.RenderTextureSubElement)argHelper4.GetInt32(false); obj.SetTexture(Arg0,Arg1,Arg2,Arg3,Arg4); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RenderTexture), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetString(false); var Arg2 = argHelper2.Get<UnityEngine.RenderTexture>(false); var Arg3 = argHelper3.GetInt32(false); var Arg4 = (UnityEngine.Rendering.RenderTextureSubElement)argHelper4.GetInt32(false); obj.SetTexture(Arg0,Arg1,Arg2,Arg3,Arg4); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SetTexture"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetTextureFromGlobal(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ComputeShader; if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); obj.SetTextureFromGlobal(Arg0,Arg1,Arg2); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetString(false); var Arg2 = argHelper2.GetString(false); obj.SetTextureFromGlobal(Arg0,Arg1,Arg2); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SetTextureFromGlobal"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetBuffer(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ComputeShader; if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.ComputeBuffer), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.Get<UnityEngine.ComputeBuffer>(false); obj.SetBuffer(Arg0,Arg1,Arg2); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GraphicsBuffer), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.Get<UnityEngine.GraphicsBuffer>(false); obj.SetBuffer(Arg0,Arg1,Arg2); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.ComputeBuffer), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetString(false); var Arg2 = argHelper2.Get<UnityEngine.ComputeBuffer>(false); obj.SetBuffer(Arg0,Arg1,Arg2); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GraphicsBuffer), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetString(false); var Arg2 = argHelper2.Get<UnityEngine.GraphicsBuffer>(false); obj.SetBuffer(Arg0,Arg1,Arg2); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SetBuffer"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetKernelThreadGroupSizes(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ComputeShader; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetUInt32(true); var Arg2 = argHelper2.GetUInt32(true); var Arg3 = argHelper3.GetUInt32(true); obj.GetKernelThreadGroupSizes(Arg0,out Arg1,out Arg2,out Arg3); argHelper1.SetByRefValue(Arg1); argHelper2.SetByRefValue(Arg2); argHelper3.SetByRefValue(Arg3); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Dispatch(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ComputeShader; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetInt32(false); obj.Dispatch(Arg0,Arg1,Arg2,Arg3); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_EnableKeyword(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ComputeShader; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetString(false); obj.EnableKeyword(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_DisableKeyword(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ComputeShader; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetString(false); obj.DisableKeyword(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_IsKeywordEnabled(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ComputeShader; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetString(false); var result = obj.IsKeywordEnabled(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_IsSupported(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ComputeShader; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); var result = obj.IsSupported(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetFloats(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ComputeShader; if (paramLen >= 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(float), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.GetParams<float>(info, 1, paramLen); obj.SetFloats(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(float), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetParams<float>(info, 1, paramLen); obj.SetFloats(Arg0,Arg1); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SetFloats"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetInts(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ComputeShader; if (paramLen >= 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(int), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.GetParams<int>(info, 1, paramLen); obj.SetInts(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(int), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetParams<int>(info, 1, paramLen); obj.SetInts(Arg0,Arg1); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SetInts"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetBool(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ComputeShader; if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.GetBoolean(false); obj.SetBool(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetBoolean(false); obj.SetBool(Arg0,Arg1); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SetBool"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetConstantBuffer(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ComputeShader; if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.ComputeBuffer), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.ComputeBuffer>(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetInt32(false); obj.SetConstantBuffer(Arg0,Arg1,Arg2,Arg3); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.ComputeBuffer), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<UnityEngine.ComputeBuffer>(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetInt32(false); obj.SetConstantBuffer(Arg0,Arg1,Arg2,Arg3); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GraphicsBuffer), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.GraphicsBuffer>(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetInt32(false); obj.SetConstantBuffer(Arg0,Arg1,Arg2,Arg3); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GraphicsBuffer), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<UnityEngine.GraphicsBuffer>(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetInt32(false); obj.SetConstantBuffer(Arg0,Arg1,Arg2,Arg3); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SetConstantBuffer"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_DispatchIndirect(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ComputeShader; if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.ComputeBuffer), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.ComputeBuffer>(false); var Arg2 = argHelper2.GetUInt32(false); obj.DispatchIndirect(Arg0,Arg1,Arg2); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GraphicsBuffer), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.GraphicsBuffer>(false); var Arg2 = argHelper2.GetUInt32(false); obj.DispatchIndirect(Arg0,Arg1,Arg2); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.ComputeBuffer), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.ComputeBuffer>(false); obj.DispatchIndirect(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GraphicsBuffer), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.GraphicsBuffer>(false); obj.DispatchIndirect(Arg0,Arg1); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to DispatchIndirect"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_shaderKeywords(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ComputeShader; var result = obj.shaderKeywords; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_shaderKeywords(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ComputeShader; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.shaderKeywords = argHelper.Get<string[]>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "FindKernel", IsStatic = false}, M_FindKernel }, { new Puerts.MethodKey {Name = "HasKernel", IsStatic = false}, M_HasKernel }, { new Puerts.MethodKey {Name = "SetFloat", IsStatic = false}, M_SetFloat }, { new Puerts.MethodKey {Name = "SetInt", IsStatic = false}, M_SetInt }, { new Puerts.MethodKey {Name = "SetVector", IsStatic = false}, M_SetVector }, { new Puerts.MethodKey {Name = "SetMatrix", IsStatic = false}, M_SetMatrix }, { new Puerts.MethodKey {Name = "SetVectorArray", IsStatic = false}, M_SetVectorArray }, { new Puerts.MethodKey {Name = "SetMatrixArray", IsStatic = false}, M_SetMatrixArray }, { new Puerts.MethodKey {Name = "SetTexture", IsStatic = false}, M_SetTexture }, { new Puerts.MethodKey {Name = "SetTextureFromGlobal", IsStatic = false}, M_SetTextureFromGlobal }, { new Puerts.MethodKey {Name = "SetBuffer", IsStatic = false}, M_SetBuffer }, { new Puerts.MethodKey {Name = "GetKernelThreadGroupSizes", IsStatic = false}, M_GetKernelThreadGroupSizes }, { new Puerts.MethodKey {Name = "Dispatch", IsStatic = false}, M_Dispatch }, { new Puerts.MethodKey {Name = "EnableKeyword", IsStatic = false}, M_EnableKeyword }, { new Puerts.MethodKey {Name = "DisableKeyword", IsStatic = false}, M_DisableKeyword }, { new Puerts.MethodKey {Name = "IsKeywordEnabled", IsStatic = false}, M_IsKeywordEnabled }, { new Puerts.MethodKey {Name = "IsSupported", IsStatic = false}, M_IsSupported }, { new Puerts.MethodKey {Name = "SetFloats", IsStatic = false}, M_SetFloats }, { new Puerts.MethodKey {Name = "SetInts", IsStatic = false}, M_SetInts }, { new Puerts.MethodKey {Name = "SetBool", IsStatic = false}, M_SetBool }, { new Puerts.MethodKey {Name = "SetConstantBuffer", IsStatic = false}, M_SetConstantBuffer }, { new Puerts.MethodKey {Name = "DispatchIndirect", IsStatic = false}, M_DispatchIndirect }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"shaderKeywords", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_shaderKeywords, Setter = S_shaderKeywords} }, } }; } } } <|start_filename|>Projects/GenerateDatas/convert_lua/role.TbRoleLevelExpAttr/50.lua<|end_filename|> return { level = 50, need_exp = 75000, clothes_attrs = { 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, }, } <|start_filename|>Projects/Csharp_CustomTemplate_EncryptMemory/Gen/role/BonusInfo.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using System; using Newtonsoft.Json; using Scripts; namespace cfg.role { [Serializable] public partial class BonusInfo : AConfig { public item.ECurrencyType type { get; set; } [JsonProperty("coefficient")] private float _coefficient { get; set; } [JsonIgnore] public EncryptFloat coefficient { get; private set; } = new(); public override void EndInit() { coefficient = _coefficient; } public override string ToString() => JsonConvert.SerializeObject(this); } } <|start_filename|>Projects/DataTemplates/template_erlang/mail_tbsystemmail.erl<|end_filename|> %% mail.TbSystemMail get(11) -> #{id => 11,title => "测试1",sender => "系统",content => "测试内容1",award => [1]}. get(12) -> #{id => 12,title => "测试2",sender => "系统",content => "测试内容2",award => [1]}. get(13) -> #{id => 13,title => "测试3",sender => "系统",content => "测试内容3",award => [1]}. get(14) -> #{id => 14,title => "测试4",sender => "系统",content => "测试内容4",award => [1]}. get(15) -> #{id => 15,title => "测试5",sender => "系统",content => "测试内容5",award => [1]}. <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/Puerts_JsEnv_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class Puerts_JsEnv_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { if (paramLen == 0) { { var result = new Puerts.JsEnv(); return Puerts.Utils.GetObjectPtr((int)data, typeof(Puerts.JsEnv), result); } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(Puerts.ILoader), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<Puerts.ILoader>(false); var Arg1 = argHelper1.GetInt32(false); var result = new Puerts.JsEnv(Arg0,Arg1); return Puerts.Utils.GetObjectPtr((int)data, typeof(Puerts.JsEnv), result); } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(Puerts.ILoader), false, false)) { var Arg0 = argHelper0.Get<Puerts.ILoader>(false); var result = new Puerts.JsEnv(Arg0); return Puerts.Utils.GetObjectPtr((int)data, typeof(Puerts.JsEnv), result); } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(Puerts.ILoader), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(System.IntPtr), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(System.IntPtr), false, false)) { var Arg0 = argHelper0.Get<Puerts.ILoader>(false); var Arg1 = argHelper1.Get<System.IntPtr>(false); var Arg2 = argHelper2.Get<System.IntPtr>(false); var result = new Puerts.JsEnv(Arg0,Arg1,Arg2); return Puerts.Utils.GetObjectPtr((int)data, typeof(Puerts.JsEnv), result); } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(Puerts.ILoader), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(System.IntPtr), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(System.IntPtr), false, false)) { var Arg0 = argHelper0.Get<Puerts.ILoader>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.Get<System.IntPtr>(false); var Arg3 = argHelper3.Get<System.IntPtr>(false); var result = new Puerts.JsEnv(Arg0,Arg1,Arg2,Arg3); return Puerts.Utils.GetObjectPtr((int)data, typeof(Puerts.JsEnv), result); } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to Puerts.JsEnv constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Eval(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as Puerts.JsEnv; if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.GetString(false); obj.Eval(Arg0,Arg1); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); obj.Eval(Arg0); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to Eval"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ClearModuleCache(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as Puerts.JsEnv; { { obj.ClearModuleCache(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_ClearAllModuleCaches(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { { Puerts.JsEnv.ClearAllModuleCaches(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_AddLazyStaticWrapLoader(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as Puerts.JsEnv; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<System.Type>(false); var Arg1 = argHelper1.Get<System.Func<Puerts.TypeRegisterInfo>>(false); obj.AddLazyStaticWrapLoader(Arg0,Arg1); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_RegisterGeneralGetSet(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as Puerts.JsEnv; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.Get<System.Type>(false); var Arg1 = argHelper1.Get<Puerts.GeneralGetter>(false); var Arg2 = argHelper2.Get<Puerts.GeneralSetter>(false); obj.RegisterGeneralGetSet(Arg0,Arg1,Arg2); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetTypeId(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as Puerts.JsEnv; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.Type>(false); var result = obj.GetTypeId(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_LowMemoryNotification(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as Puerts.JsEnv; { { obj.LowMemoryNotification(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Tick(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as Puerts.JsEnv; { { obj.Tick(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_WaitDebugger(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as Puerts.JsEnv; { { obj.WaitDebugger(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_WaitDebuggerAsync(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as Puerts.JsEnv; { { var result = obj.WaitDebuggerAsync(); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Dispose(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as Puerts.JsEnv; { { obj.Dispose(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_Index(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as Puerts.JsEnv; var result = obj.Index; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_jsEnvs(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = Puerts.JsEnv.jsEnvs; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_jsEnvs(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); Puerts.JsEnv.jsEnvs = argHelper.Get<System.Collections.Generic.List<Puerts.JsEnv>>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "Eval", IsStatic = false}, M_Eval }, { new Puerts.MethodKey {Name = "ClearModuleCache", IsStatic = false}, M_ClearModuleCache }, { new Puerts.MethodKey {Name = "ClearAllModuleCaches", IsStatic = true}, F_ClearAllModuleCaches }, { new Puerts.MethodKey {Name = "AddLazyStaticWrapLoader", IsStatic = false}, M_AddLazyStaticWrapLoader }, { new Puerts.MethodKey {Name = "RegisterGeneralGetSet", IsStatic = false}, M_RegisterGeneralGetSet }, { new Puerts.MethodKey {Name = "GetTypeId", IsStatic = false}, M_GetTypeId }, { new Puerts.MethodKey {Name = "LowMemoryNotification", IsStatic = false}, M_LowMemoryNotification }, { new Puerts.MethodKey {Name = "Tick", IsStatic = false}, M_Tick }, { new Puerts.MethodKey {Name = "WaitDebugger", IsStatic = false}, M_WaitDebugger }, { new Puerts.MethodKey {Name = "WaitDebuggerAsync", IsStatic = false}, M_WaitDebuggerAsync }, { new Puerts.MethodKey {Name = "Dispose", IsStatic = false}, M_Dispose }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"Index", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_Index, Setter = null} }, {"jsEnvs", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_jsEnvs, Setter = S_jsEnvs} }, } }; } } } <|start_filename|>Projects/java_json/src/gen/cfg/item/Clothes.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.item; import com.google.gson.JsonElement; import com.google.gson.JsonObject; public final class Clothes extends cfg.item.ItemExtra { public Clothes(JsonObject __json__) { super(__json__); attack = __json__.get("attack").getAsInt(); hp = __json__.get("hp").getAsLong(); energyLimit = __json__.get("energy_limit").getAsInt(); energyResume = __json__.get("energy_resume").getAsInt(); } public Clothes(int id, int attack, long hp, int energy_limit, int energy_resume ) { super(id); this.attack = attack; this.hp = hp; this.energyLimit = energy_limit; this.energyResume = energy_resume; } public static Clothes deserializeClothes(JsonObject __json__) { return new Clothes(__json__); } public final int attack; public final long hp; public final int energyLimit; public final int energyResume; public static final int __ID__ = 1659907149; @Override public int getTypeId() { return __ID__; } @Override public void resolve(java.util.HashMap<String, Object> _tables) { super.resolve(_tables); } @Override public String toString() { return "{ " + "id:" + id + "," + "attack:" + attack + "," + "hp:" + hp + "," + "energyLimit:" + energyLimit + "," + "energyResume:" + energyResume + "," + "}"; } } <|start_filename|>Projects/DataTemplates/template_lua2/blueprint_tbclazz.lua<|end_filename|> -- blueprint.TbClazz return { ["int"] = { name="int", desc="primity type:int", parents= { }, methods= { }, is_abstract=false, fields= { }, }, } <|start_filename|>Projects/GenerateDatas/convert_lua/test.TbDetectCsvEncoding/12.lua<|end_filename|> return { id = 12, name = "还果园国要", } <|start_filename|>Projects/DataTemplates/template_lua2/test_tbexcelfromjson.lua<|end_filename|> -- test.TbExcelFromJson return { [1] = { x4=1, x1=true, x5=100, x6=1.2, s1="hq", s2={key='/asfa',text="aabbcc"}, v2={x=1,y=2}, v3={x=1.1,y=2.2,z=3.4}, v4={x=10.1,y=11.2,z=12.3,w=13.4}, t1=631123200, x12= { x1=10, }, x13=1, x14= { x1=1, x2=2, }, k1= { 12, }, k8= { [2] = 2, [4] = 10, }, k9= { { y1=1, y2=true, }, { y1=2, y2=false, }, }, k15= { { x1=1, x2=2, }, { x1=2, x2=3, }, }, }, [2] = { x4=2, x1=true, x5=100, x6=1.2, s1="hq", s2={key='/asfa',text="aabbcc"}, v2={x=1,y=2}, v3={x=1.1,y=2.2,z=3.4}, v4={x=10.1,y=11.2,z=12.3,w=13.4}, t1=631123200, x12= { x1=10, }, x13=2, x14= { x1=1, x2=2, }, k1= { 12, }, k8= { [2] = 2, [4] = 10, }, k9= { { y1=1, y2=true, }, { y1=2, y2=false, }, }, k15= { { x1=1, x2=2, }, { x1=2, x2=3, }, }, }, [3] = { x4=3, x1=true, x5=100, x6=1.2, s1="hq", s2={key='/asfa',text="aabbcc"}, v2={x=1,y=2}, v3={x=1.1,y=2.2,z=3.4}, v4={x=10.1,y=11.2,z=12.3,w=13.4}, t1=631123200, x12= { x1=10, }, x13=4, x14= { x1=1, x2=2, }, k1= { 12, }, k8= { [2] = 2, [4] = 10, }, k9= { { y1=1, y2=true, }, { y1=2, y2=false, }, }, k15= { { x1=1, x2=2, }, { x1=2, x2=3, }, }, }, [6] = { x4=6, x1=false, x5=100, x6=1.2, s1="hq", s2={key='/asfa',text="aabbcc"}, v2={x=1,y=2}, v3={x=1.1,y=2.2,z=3.4}, v4={x=10.1,y=11.2,z=12.3,w=13.4}, t1=631123200, x12= { x1=10, }, x13=4, x14= { x1=1, x2=2, }, k1= { 12, }, k8= { [2] = 2, [4] = 10, }, k9= { { y1=1, y2=true, }, { y1=2, y2=false, }, }, k15= { { x1=1, x2=2, }, { x1=2, x2=3, }, }, }, [7] = { x4=7, x1=false, x5=100, x6=1.2, s1="hq", s2={key='/asfa',text="aabbcc"}, v2={x=1,y=3}, v3={x=1.1,y=2.2,z=3.5}, v4={x=10.1,y=11.2,z=12.3,w=13.5}, t1=631209600, x12= { x1=11, }, x13=4, x14= { x1=1, x2=3, }, k1= { 13, }, k8= { [2] = 2, [4] = 11, }, k9= { { y1=1, y2=true, }, { y1=3, y2=false, }, }, k15= { { x1=1, x2=2, }, { x1=2, x2=4, }, }, }, [8] = { x4=8, x1=false, x5=100, x6=1.2, s1="hq", s2={key='/asfa',text="aabbcc"}, v2={x=1,y=4}, v3={x=1.1,y=2.2,z=3.6}, v4={x=10.1,y=11.2,z=12.3,w=13.6}, t1=631296000, x12= { x1=12, }, x13=4, x14= { x1=1, x2=4, }, k1= { 14, }, k8= { [2] = 2, [4] = 12, }, k9= { { y1=1, y2=true, }, { y1=4, y2=false, }, }, k15= { { x1=1, x2=2, }, { x1=2, x2=5, }, }, }, } <|start_filename|>Projects/GenerateDatas/convert_lua/test.TbDetectCsvEncoding/2.lua<|end_filename|> return { id = 2, name = "还果园国要", } <|start_filename|>Projects/CfgValidator/ConfigSetUp.cs<|end_filename|> using System; using System.Collections.Generic; using System.IO; using System.Reflection; using System.Text; using Bright.Serialization; using Microsoft.VisualStudio.TestTools.UnitTesting; using CfgCheck; using System.Text.Json; namespace CfgCheck { [TestClass] public class ConfigSetUp { public static cfg.Tables Configs { get; set; } [AssemblyInitialize] public static void Initialize(TestContext testContext) { LoadConfig(); } public static void LoadConfig() { Configs = new cfg.Tables(LoadJson); } private static JsonElement LoadJson(string file) { var configDir = "../../../../../Projects/GenerateDatas/json"; return JsonDocument.Parse(File.ReadAllBytes(Path.Combine(configDir, file + ".json"))).RootElement; } [AssemblyCleanup] public static void CleanUp() { Close(); } public static void Init() { } public static void Close() { } } } <|start_filename|>Projects/GenerateDatas/convert_lua/test.TbTestString/1.lua<|end_filename|> return { id = 1, s1 = "asfas", cs1 = { id = 1, s2 = "asf", s3 = "aaa", }, cs2 = { id = 1, s2 = "asf", s3 = "aaa", }, } <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/test/TestNull.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.test { public sealed partial class TestNull : Bright.Config.BeanBase { public TestNull(ByteBuf _buf) { Id = _buf.ReadInt(); if(_buf.ReadBool()){ X1 = _buf.ReadInt(); } else { X1 = null; } if(_buf.ReadBool()){ X2 = (test.DemoEnum)_buf.ReadInt(); } else { X2 = null; } if(_buf.ReadBool()){ X3 = test.DemoType1.DeserializeDemoType1(_buf); } else { X3 = null; } if(_buf.ReadBool()){ X4 = test.DemoDynamic.DeserializeDemoDynamic(_buf); } else { X4 = null; } if(_buf.ReadBool()){ S1 = _buf.ReadString(); } else { S1 = null; } if(_buf.ReadBool()){ S2 = _buf.ReadString(); } else { S2 = null; } } public TestNull(int id, int? x1, test.DemoEnum? x2, test.DemoType1 x3, test.DemoDynamic x4, string s1, string s2 ) { this.Id = id; this.X1 = x1; this.X2 = x2; this.X3 = x3; this.X4 = x4; this.S1 = s1; this.S2 = s2; } public static TestNull DeserializeTestNull(ByteBuf _buf) { return new test.TestNull(_buf); } public readonly int Id; public readonly int? X1; public readonly test.DemoEnum? X2; public readonly test.DemoType1 X3; public readonly test.DemoDynamic X4; public readonly string S1; public readonly string S2; public const int ID = 339868469; public override int GetTypeId() => ID; public void Resolve(Dictionary<string, object> _tables) { X3?.Resolve(_tables); X4?.Resolve(_tables); OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); public override string ToString() { return "{ " + "Id:" + Id + "," + "X1:" + X1 + "," + "X2:" + X2 + "," + "X3:" + X3 + "," + "X4:" + X4 + "," + "S1:" + S1 + "," + "S2:" + S2 + "," + "}"; } } } <|start_filename|>Projects/GenerateDatas/convert_lua/test.TbDataFromMisc/22.lua<|end_filename|> return { x4 = 22, x1 = false, x2 = 2, x3 = 128, x5 = 112233445566, x6 = 1.3, x7 = 1122, x8_0 = 13, x8 = 12, x9 = 123, x10 = "yf", x12 = { x1 = 1, }, x13 = 5, x14 = { _name = 'DemoD2', x1 = 1, x2 = 3, }, s1 = {key='lua/key1',text="lua text "}, v2 = {x=1,y=2}, v3 = {x=0.1,y=0.2,z=0.3}, v4 = {x=1,y=2,z=3.5,w=4}, t1 = 1970-1-1 00:00:00, k1 = { 1, 2, }, k2 = { 2, 3, }, k5 = { 1, 3, }, k8 = { [2] = 10, [3] = 12, } , k9 = { { y1 = 1, y2 = true, }, { y1 = 10, y2 = false, }, }, k15 = { { _name = 'DemoD2', x1 = 1, x2 = 3, }, }, } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_CustomRenderTextureManager_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_CustomRenderTextureManager_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.CustomRenderTextureManager constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetAllCustomRenderTextures(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.Collections.Generic.List<UnityEngine.CustomRenderTexture>>(false); UnityEngine.CustomRenderTextureManager.GetAllCustomRenderTextures(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void A_textureLoaded(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.CustomRenderTextureManager.textureLoaded += argHelper.Get<System.Action<UnityEngine.CustomRenderTexture>>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void R_textureLoaded(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.CustomRenderTextureManager.textureLoaded -= argHelper.Get<System.Action<UnityEngine.CustomRenderTexture>>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void A_textureUnloaded(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.CustomRenderTextureManager.textureUnloaded += argHelper.Get<System.Action<UnityEngine.CustomRenderTexture>>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void R_textureUnloaded(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.CustomRenderTextureManager.textureUnloaded -= argHelper.Get<System.Action<UnityEngine.CustomRenderTexture>>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void A_updateTriggered(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.CustomRenderTextureManager.updateTriggered += argHelper.Get<System.Action<UnityEngine.CustomRenderTexture, int>>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void R_updateTriggered(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.CustomRenderTextureManager.updateTriggered -= argHelper.Get<System.Action<UnityEngine.CustomRenderTexture, int>>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void A_initializeTriggered(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.CustomRenderTextureManager.initializeTriggered += argHelper.Get<System.Action<UnityEngine.CustomRenderTexture>>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void R_initializeTriggered(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.CustomRenderTextureManager.initializeTriggered -= argHelper.Get<System.Action<UnityEngine.CustomRenderTexture>>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "GetAllCustomRenderTextures", IsStatic = true}, F_GetAllCustomRenderTextures }, { new Puerts.MethodKey {Name = "add_textureLoaded", IsStatic = true}, A_textureLoaded}, { new Puerts.MethodKey {Name = "remove_textureLoaded", IsStatic = true}, R_textureLoaded}, { new Puerts.MethodKey {Name = "add_textureUnloaded", IsStatic = true}, A_textureUnloaded}, { new Puerts.MethodKey {Name = "remove_textureUnloaded", IsStatic = true}, R_textureUnloaded}, { new Puerts.MethodKey {Name = "add_updateTriggered", IsStatic = true}, A_updateTriggered}, { new Puerts.MethodKey {Name = "remove_updateTriggered", IsStatic = true}, R_updateTriggered}, { new Puerts.MethodKey {Name = "add_initializeTriggered", IsStatic = true}, A_initializeTriggered}, { new Puerts.MethodKey {Name = "remove_initializeTriggered", IsStatic = true}, R_initializeTriggered}, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { } }; } } } <|start_filename|>Projects/GenerateDatas/convert_lua/role.TbRoleLevelExpAttr/25.lua<|end_filename|> return { level = 25, need_exp = 8500, clothes_attrs = { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, }, } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_MeshCollider_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_MeshCollider_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.MeshCollider(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.MeshCollider), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_sharedMesh(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.MeshCollider; var result = obj.sharedMesh; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_sharedMesh(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.MeshCollider; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.sharedMesh = argHelper.Get<UnityEngine.Mesh>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_convex(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.MeshCollider; var result = obj.convex; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_convex(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.MeshCollider; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.convex = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_cookingOptions(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.MeshCollider; var result = obj.cookingOptions; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_cookingOptions(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.MeshCollider; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.cookingOptions = (UnityEngine.MeshColliderCookingOptions)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"sharedMesh", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_sharedMesh, Setter = S_sharedMesh} }, {"convex", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_convex, Setter = S_convex} }, {"cookingOptions", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_cookingOptions, Setter = S_cookingOptions} }, } }; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Bin/Assets/Gen/UnityEngine_ArticulationBody_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_ArticulationBody_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.ArticulationBody(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.ArticulationBody), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_AddForce(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); obj.AddForce(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_AddRelativeForce(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); obj.AddRelativeForce(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_AddTorque(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); obj.AddTorque(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_AddRelativeTorque(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); obj.AddRelativeTorque(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_AddForceAtPosition(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3>(false); obj.AddForceAtPosition(Arg0,Arg1); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ResetCenterOfMass(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; { { obj.ResetCenterOfMass(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ResetInertiaTensor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; { { obj.ResetInertiaTensor(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Sleep(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; { { obj.Sleep(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_IsSleeping(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; { { var result = obj.IsSleeping(); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_WakeUp(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; { { obj.WakeUp(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_TeleportRoot(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = argHelper1.Get<UnityEngine.Quaternion>(false); obj.TeleportRoot(Arg0,Arg1); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetClosestPoint(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var result = obj.GetClosestPoint(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetRelativePointVelocity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var result = obj.GetRelativePointVelocity(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetPointVelocity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var result = obj.GetPointVelocity(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetDenseJacobian(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.ArticulationJacobian>(true); var result = obj.GetDenseJacobian(ref Arg0); argHelper0.SetByRefValue(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetJointPositions(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.Collections.Generic.List<float>>(false); var result = obj.GetJointPositions(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetJointPositions(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.Collections.Generic.List<float>>(false); obj.SetJointPositions(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetJointVelocities(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.Collections.Generic.List<float>>(false); var result = obj.GetJointVelocities(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetJointVelocities(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.Collections.Generic.List<float>>(false); obj.SetJointVelocities(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetJointAccelerations(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.Collections.Generic.List<float>>(false); var result = obj.GetJointAccelerations(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetJointAccelerations(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.Collections.Generic.List<float>>(false); obj.SetJointAccelerations(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetJointForces(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.Collections.Generic.List<float>>(false); var result = obj.GetJointForces(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetJointForces(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.Collections.Generic.List<float>>(false); obj.SetJointForces(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetDriveTargets(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.Collections.Generic.List<float>>(false); var result = obj.GetDriveTargets(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetDriveTargets(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.Collections.Generic.List<float>>(false); obj.SetDriveTargets(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetDriveTargetVelocities(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.Collections.Generic.List<float>>(false); var result = obj.GetDriveTargetVelocities(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetDriveTargetVelocities(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.Collections.Generic.List<float>>(false); obj.SetDriveTargetVelocities(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetDofStartIndices(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.Collections.Generic.List<int>>(false); var result = obj.GetDofStartIndices(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SnapAnchorToClosestContact(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; { { obj.SnapAnchorToClosestContact(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_jointType(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; var result = obj.jointType; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_jointType(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.jointType = (UnityEngine.ArticulationJointType)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_anchorPosition(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; var result = obj.anchorPosition; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_anchorPosition(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.anchorPosition = argHelper.Get<UnityEngine.Vector3>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_parentAnchorPosition(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; var result = obj.parentAnchorPosition; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_parentAnchorPosition(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.parentAnchorPosition = argHelper.Get<UnityEngine.Vector3>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_anchorRotation(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; var result = obj.anchorRotation; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_anchorRotation(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.anchorRotation = argHelper.Get<UnityEngine.Quaternion>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_parentAnchorRotation(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; var result = obj.parentAnchorRotation; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_parentAnchorRotation(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.parentAnchorRotation = argHelper.Get<UnityEngine.Quaternion>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_isRoot(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; var result = obj.isRoot; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_computeParentAnchor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; var result = obj.computeParentAnchor; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_computeParentAnchor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.computeParentAnchor = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_linearLockX(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; var result = obj.linearLockX; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_linearLockX(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.linearLockX = (UnityEngine.ArticulationDofLock)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_linearLockY(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; var result = obj.linearLockY; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_linearLockY(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.linearLockY = (UnityEngine.ArticulationDofLock)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_linearLockZ(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; var result = obj.linearLockZ; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_linearLockZ(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.linearLockZ = (UnityEngine.ArticulationDofLock)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_swingYLock(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; var result = obj.swingYLock; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_swingYLock(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.swingYLock = (UnityEngine.ArticulationDofLock)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_swingZLock(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; var result = obj.swingZLock; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_swingZLock(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.swingZLock = (UnityEngine.ArticulationDofLock)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_twistLock(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; var result = obj.twistLock; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_twistLock(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.twistLock = (UnityEngine.ArticulationDofLock)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_xDrive(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; var result = obj.xDrive; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_xDrive(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.xDrive = argHelper.Get<UnityEngine.ArticulationDrive>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_yDrive(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; var result = obj.yDrive; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_yDrive(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.yDrive = argHelper.Get<UnityEngine.ArticulationDrive>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_zDrive(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; var result = obj.zDrive; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_zDrive(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.zDrive = argHelper.Get<UnityEngine.ArticulationDrive>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_immovable(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; var result = obj.immovable; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_immovable(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.immovable = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_useGravity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; var result = obj.useGravity; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_useGravity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.useGravity = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_linearDamping(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; var result = obj.linearDamping; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_linearDamping(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.linearDamping = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_angularDamping(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; var result = obj.angularDamping; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_angularDamping(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.angularDamping = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_jointFriction(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; var result = obj.jointFriction; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_jointFriction(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.jointFriction = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_velocity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; var result = obj.velocity; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_velocity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.velocity = argHelper.Get<UnityEngine.Vector3>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_angularVelocity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; var result = obj.angularVelocity; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_angularVelocity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.angularVelocity = argHelper.Get<UnityEngine.Vector3>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_mass(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; var result = obj.mass; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_mass(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.mass = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_centerOfMass(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; var result = obj.centerOfMass; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_centerOfMass(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.centerOfMass = argHelper.Get<UnityEngine.Vector3>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_worldCenterOfMass(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; var result = obj.worldCenterOfMass; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_inertiaTensor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; var result = obj.inertiaTensor; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_inertiaTensor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.inertiaTensor = argHelper.Get<UnityEngine.Vector3>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_inertiaTensorRotation(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; var result = obj.inertiaTensorRotation; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_inertiaTensorRotation(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.inertiaTensorRotation = argHelper.Get<UnityEngine.Quaternion>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_sleepThreshold(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; var result = obj.sleepThreshold; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_sleepThreshold(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.sleepThreshold = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_solverIterations(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; var result = obj.solverIterations; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_solverIterations(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.solverIterations = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_solverVelocityIterations(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; var result = obj.solverVelocityIterations; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_solverVelocityIterations(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.solverVelocityIterations = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_maxAngularVelocity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; var result = obj.maxAngularVelocity; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_maxAngularVelocity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.maxAngularVelocity = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_maxLinearVelocity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; var result = obj.maxLinearVelocity; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_maxLinearVelocity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.maxLinearVelocity = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_maxJointVelocity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; var result = obj.maxJointVelocity; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_maxJointVelocity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.maxJointVelocity = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_maxDepenetrationVelocity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; var result = obj.maxDepenetrationVelocity; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_maxDepenetrationVelocity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.maxDepenetrationVelocity = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_jointPosition(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; var result = obj.jointPosition; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_jointPosition(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.jointPosition = argHelper.Get<UnityEngine.ArticulationReducedSpace>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_jointVelocity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; var result = obj.jointVelocity; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_jointVelocity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.jointVelocity = argHelper.Get<UnityEngine.ArticulationReducedSpace>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_jointAcceleration(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; var result = obj.jointAcceleration; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_jointAcceleration(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.jointAcceleration = argHelper.Get<UnityEngine.ArticulationReducedSpace>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_jointForce(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; var result = obj.jointForce; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_jointForce(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.jointForce = argHelper.Get<UnityEngine.ArticulationReducedSpace>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_dofCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; var result = obj.dofCount; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_index(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; var result = obj.index; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_collisionDetectionMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; var result = obj.collisionDetectionMode; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_collisionDetectionMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ArticulationBody; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.collisionDetectionMode = (UnityEngine.CollisionDetectionMode)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "AddForce", IsStatic = false}, M_AddForce }, { new Puerts.MethodKey {Name = "AddRelativeForce", IsStatic = false}, M_AddRelativeForce }, { new Puerts.MethodKey {Name = "AddTorque", IsStatic = false}, M_AddTorque }, { new Puerts.MethodKey {Name = "AddRelativeTorque", IsStatic = false}, M_AddRelativeTorque }, { new Puerts.MethodKey {Name = "AddForceAtPosition", IsStatic = false}, M_AddForceAtPosition }, { new Puerts.MethodKey {Name = "ResetCenterOfMass", IsStatic = false}, M_ResetCenterOfMass }, { new Puerts.MethodKey {Name = "ResetInertiaTensor", IsStatic = false}, M_ResetInertiaTensor }, { new Puerts.MethodKey {Name = "Sleep", IsStatic = false}, M_Sleep }, { new Puerts.MethodKey {Name = "IsSleeping", IsStatic = false}, M_IsSleeping }, { new Puerts.MethodKey {Name = "WakeUp", IsStatic = false}, M_WakeUp }, { new Puerts.MethodKey {Name = "TeleportRoot", IsStatic = false}, M_TeleportRoot }, { new Puerts.MethodKey {Name = "GetClosestPoint", IsStatic = false}, M_GetClosestPoint }, { new Puerts.MethodKey {Name = "GetRelativePointVelocity", IsStatic = false}, M_GetRelativePointVelocity }, { new Puerts.MethodKey {Name = "GetPointVelocity", IsStatic = false}, M_GetPointVelocity }, { new Puerts.MethodKey {Name = "GetDenseJacobian", IsStatic = false}, M_GetDenseJacobian }, { new Puerts.MethodKey {Name = "GetJointPositions", IsStatic = false}, M_GetJointPositions }, { new Puerts.MethodKey {Name = "SetJointPositions", IsStatic = false}, M_SetJointPositions }, { new Puerts.MethodKey {Name = "GetJointVelocities", IsStatic = false}, M_GetJointVelocities }, { new Puerts.MethodKey {Name = "SetJointVelocities", IsStatic = false}, M_SetJointVelocities }, { new Puerts.MethodKey {Name = "GetJointAccelerations", IsStatic = false}, M_GetJointAccelerations }, { new Puerts.MethodKey {Name = "SetJointAccelerations", IsStatic = false}, M_SetJointAccelerations }, { new Puerts.MethodKey {Name = "GetJointForces", IsStatic = false}, M_GetJointForces }, { new Puerts.MethodKey {Name = "SetJointForces", IsStatic = false}, M_SetJointForces }, { new Puerts.MethodKey {Name = "GetDriveTargets", IsStatic = false}, M_GetDriveTargets }, { new Puerts.MethodKey {Name = "SetDriveTargets", IsStatic = false}, M_SetDriveTargets }, { new Puerts.MethodKey {Name = "GetDriveTargetVelocities", IsStatic = false}, M_GetDriveTargetVelocities }, { new Puerts.MethodKey {Name = "SetDriveTargetVelocities", IsStatic = false}, M_SetDriveTargetVelocities }, { new Puerts.MethodKey {Name = "GetDofStartIndices", IsStatic = false}, M_GetDofStartIndices }, { new Puerts.MethodKey {Name = "SnapAnchorToClosestContact", IsStatic = false}, M_SnapAnchorToClosestContact }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"jointType", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_jointType, Setter = S_jointType} }, {"anchorPosition", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_anchorPosition, Setter = S_anchorPosition} }, {"parentAnchorPosition", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_parentAnchorPosition, Setter = S_parentAnchorPosition} }, {"anchorRotation", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_anchorRotation, Setter = S_anchorRotation} }, {"parentAnchorRotation", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_parentAnchorRotation, Setter = S_parentAnchorRotation} }, {"isRoot", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_isRoot, Setter = null} }, {"computeParentAnchor", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_computeParentAnchor, Setter = S_computeParentAnchor} }, {"linearLockX", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_linearLockX, Setter = S_linearLockX} }, {"linearLockY", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_linearLockY, Setter = S_linearLockY} }, {"linearLockZ", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_linearLockZ, Setter = S_linearLockZ} }, {"swingYLock", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_swingYLock, Setter = S_swingYLock} }, {"swingZLock", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_swingZLock, Setter = S_swingZLock} }, {"twistLock", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_twistLock, Setter = S_twistLock} }, {"xDrive", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_xDrive, Setter = S_xDrive} }, {"yDrive", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_yDrive, Setter = S_yDrive} }, {"zDrive", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_zDrive, Setter = S_zDrive} }, {"immovable", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_immovable, Setter = S_immovable} }, {"useGravity", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_useGravity, Setter = S_useGravity} }, {"linearDamping", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_linearDamping, Setter = S_linearDamping} }, {"angularDamping", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_angularDamping, Setter = S_angularDamping} }, {"jointFriction", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_jointFriction, Setter = S_jointFriction} }, {"velocity", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_velocity, Setter = S_velocity} }, {"angularVelocity", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_angularVelocity, Setter = S_angularVelocity} }, {"mass", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_mass, Setter = S_mass} }, {"centerOfMass", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_centerOfMass, Setter = S_centerOfMass} }, {"worldCenterOfMass", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_worldCenterOfMass, Setter = null} }, {"inertiaTensor", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_inertiaTensor, Setter = S_inertiaTensor} }, {"inertiaTensorRotation", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_inertiaTensorRotation, Setter = S_inertiaTensorRotation} }, {"sleepThreshold", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_sleepThreshold, Setter = S_sleepThreshold} }, {"solverIterations", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_solverIterations, Setter = S_solverIterations} }, {"solverVelocityIterations", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_solverVelocityIterations, Setter = S_solverVelocityIterations} }, {"maxAngularVelocity", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_maxAngularVelocity, Setter = S_maxAngularVelocity} }, {"maxLinearVelocity", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_maxLinearVelocity, Setter = S_maxLinearVelocity} }, {"maxJointVelocity", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_maxJointVelocity, Setter = S_maxJointVelocity} }, {"maxDepenetrationVelocity", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_maxDepenetrationVelocity, Setter = S_maxDepenetrationVelocity} }, {"jointPosition", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_jointPosition, Setter = S_jointPosition} }, {"jointVelocity", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_jointVelocity, Setter = S_jointVelocity} }, {"jointAcceleration", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_jointAcceleration, Setter = S_jointAcceleration} }, {"jointForce", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_jointForce, Setter = S_jointForce} }, {"dofCount", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_dofCount, Setter = null} }, {"index", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_index, Setter = null} }, {"collisionDetectionMode", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_collisionDetectionMode, Setter = S_collisionDetectionMode} }, } }; } } } <|start_filename|>Projects/Csharp_CustomTemplate_EncryptMemory/Gen/test/MultiRowTitle.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using System; using Newtonsoft.Json; using Scripts; namespace cfg.test { [Serializable] public partial class MultiRowTitle : AConfig { public string name { get; set; } [JsonProperty] public test.H1 x1 { get; set; } [JsonProperty] public test.H2 x2_0 { get; set; } public System.Collections.Generic.List<test.H2> x2 { get; set; } public test.H2[] x3 { get; set; } public test.H2[] x4 { get; set; } public override void EndInit() { x1.EndInit(); x2_0.EndInit(); foreach(var _e in x2) { _e.EndInit(); } foreach(var _e in x3) { _e.EndInit(); } foreach(var _e in x4) { _e.EndInit(); } } public override string ToString() => JsonConvert.SerializeObject(this); } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_TargetJoint2D_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_TargetJoint2D_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.TargetJoint2D(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.TargetJoint2D), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_anchor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TargetJoint2D; var result = obj.anchor; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_anchor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TargetJoint2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.anchor = argHelper.Get<UnityEngine.Vector2>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_target(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TargetJoint2D; var result = obj.target; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_target(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TargetJoint2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.target = argHelper.Get<UnityEngine.Vector2>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_autoConfigureTarget(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TargetJoint2D; var result = obj.autoConfigureTarget; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_autoConfigureTarget(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TargetJoint2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.autoConfigureTarget = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_maxForce(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TargetJoint2D; var result = obj.maxForce; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_maxForce(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TargetJoint2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.maxForce = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_dampingRatio(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TargetJoint2D; var result = obj.dampingRatio; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_dampingRatio(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TargetJoint2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.dampingRatio = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_frequency(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TargetJoint2D; var result = obj.frequency; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_frequency(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TargetJoint2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.frequency = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"anchor", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_anchor, Setter = S_anchor} }, {"target", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_target, Setter = S_target} }, {"autoConfigureTarget", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_autoConfigureTarget, Setter = S_autoConfigureTarget} }, {"maxForce", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_maxForce, Setter = S_maxForce} }, {"dampingRatio", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_dampingRatio, Setter = S_dampingRatio} }, {"frequency", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_frequency, Setter = S_frequency} }, } }; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_SurfaceEffector2D_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_SurfaceEffector2D_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.SurfaceEffector2D(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.SurfaceEffector2D), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_speed(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SurfaceEffector2D; var result = obj.speed; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_speed(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SurfaceEffector2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.speed = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_speedVariation(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SurfaceEffector2D; var result = obj.speedVariation; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_speedVariation(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SurfaceEffector2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.speedVariation = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_forceScale(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SurfaceEffector2D; var result = obj.forceScale; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_forceScale(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SurfaceEffector2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.forceScale = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_useContactForce(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SurfaceEffector2D; var result = obj.useContactForce; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_useContactForce(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SurfaceEffector2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.useContactForce = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_useFriction(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SurfaceEffector2D; var result = obj.useFriction; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_useFriction(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SurfaceEffector2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.useFriction = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_useBounce(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SurfaceEffector2D; var result = obj.useBounce; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_useBounce(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SurfaceEffector2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.useBounce = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"speed", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_speed, Setter = S_speed} }, {"speedVariation", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_speedVariation, Setter = S_speedVariation} }, {"forceScale", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_forceScale, Setter = S_forceScale} }, {"useContactForce", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_useContactForce, Setter = S_useContactForce} }, {"useFriction", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_useFriction, Setter = S_useFriction} }, {"useBounce", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_useBounce, Setter = S_useBounce} }, } }; } } } <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/blueprint/Method.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.blueprint { public abstract partial class Method : Bright.Config.BeanBase { public Method(ByteBuf _buf) { Name = _buf.ReadString(); Desc = _buf.ReadString(); IsStatic = _buf.ReadBool(); ReturnType = _buf.ReadString(); {int n = System.Math.Min(_buf.ReadSize(), _buf.Size);Parameters = new System.Collections.Generic.List<blueprint.ParamInfo>(n);for(var i = 0 ; i < n ; i++) { blueprint.ParamInfo _e; _e = blueprint.ParamInfo.DeserializeParamInfo(_buf); Parameters.Add(_e);}} } public Method(string name, string desc, bool is_static, string return_type, System.Collections.Generic.List<blueprint.ParamInfo> parameters ) { this.Name = name; this.Desc = desc; this.IsStatic = is_static; this.ReturnType = return_type; this.Parameters = parameters; } public static Method DeserializeMethod(ByteBuf _buf) { switch (_buf.ReadInt()) { case blueprint.AbstraceMethod.ID: return new blueprint.AbstraceMethod(_buf); case blueprint.ExternalMethod.ID: return new blueprint.ExternalMethod(_buf); case blueprint.BlueprintMethod.ID: return new blueprint.BlueprintMethod(_buf); default: throw new SerializationException(); } } public readonly string Name; public readonly string Desc; public readonly bool IsStatic; public readonly string ReturnType; public readonly System.Collections.Generic.List<blueprint.ParamInfo> Parameters; public virtual void Resolve(Dictionary<string, object> _tables) { foreach(var _e in Parameters) { _e?.Resolve(_tables); } OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); public override string ToString() { return "{ " + "Name:" + Name + "," + "Desc:" + Desc + "," + "IsStatic:" + IsStatic + "," + "ReturnType:" + ReturnType + "," + "Parameters:" + Bright.Common.StringUtil.CollectionToString(Parameters) + "," + "}"; } } } <|start_filename|>Projects/Csharp_CustomTemplate_EncryptMemory/gen_code_data.bat<|end_filename|> set WORKSPACE=..\.. set GEN_CLIENT=%WORKSPACE%\Tools\Luban.ClientServer\Luban.ClientServer.exe set CONF_ROOT=%WORKSPACE%\DesignerConfigs %GEN_CLIENT% --template_search_path CustomTemplate -j cfg --^ -d %CONF_ROOT%\Defines\__root__.xml ^ --input_data_dir %CONF_ROOT%\Datas ^ --output_code_dir Gen ^ --output_data_dir ..\GenerateDatas\json ^ --gen_types code_cs_json,data_json ^ -s all pause <|start_filename|>Projects/Java_bin/src/main/gen/cfg/ai/ComposeNode.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.ai; import bright.serialization.*; public abstract class ComposeNode extends cfg.ai.FlowNode { public ComposeNode(ByteBuf _buf) { super(_buf); } public ComposeNode(int id, String node_name, java.util.ArrayList<cfg.ai.Decorator> decorators, java.util.ArrayList<cfg.ai.Service> services ) { super(id, node_name, decorators, services); } public static ComposeNode deserializeComposeNode(ByteBuf _buf) { switch (_buf.readInt()) { case cfg.ai.Sequence.__ID__: return new cfg.ai.Sequence(_buf); case cfg.ai.Selector.__ID__: return new cfg.ai.Selector(_buf); case cfg.ai.SimpleParallel.__ID__: return new cfg.ai.SimpleParallel(_buf); default: throw new SerializationException(); } } @Override public void resolve(java.util.HashMap<String, Object> _tables) { super.resolve(_tables); } @Override public String toString() { return "{ " + "id:" + id + "," + "nodeName:" + nodeName + "," + "decorators:" + decorators + "," + "services:" + services + "," + "}"; } } <|start_filename|>Projects/Java_bin/src/main/gen/cfg/error/ErrorStyle.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.error; import bright.serialization.*; public abstract class ErrorStyle { public ErrorStyle(ByteBuf _buf) { } public ErrorStyle() { } public static ErrorStyle deserializeErrorStyle(ByteBuf _buf) { switch (_buf.readInt()) { case cfg.error.ErrorStyleTip.__ID__: return new cfg.error.ErrorStyleTip(_buf); case cfg.error.ErrorStyleMsgbox.__ID__: return new cfg.error.ErrorStyleMsgbox(_buf); case cfg.error.ErrorStyleDlgOk.__ID__: return new cfg.error.ErrorStyleDlgOk(_buf); case cfg.error.ErrorStyleDlgOkCancel.__ID__: return new cfg.error.ErrorStyleDlgOkCancel(_buf); default: throw new SerializationException(); } } public abstract int getTypeId(); public void resolve(java.util.HashMap<String, Object> _tables) { } @Override public String toString() { return "{ " + "}"; } } <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/bonus/ProbabilityBonusInfo.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.bonus { public sealed partial class ProbabilityBonusInfo : Bright.Config.BeanBase { public ProbabilityBonusInfo(ByteBuf _buf) { Bonus = bonus.Bonus.DeserializeBonus(_buf); Probability = _buf.ReadFloat(); } public ProbabilityBonusInfo(bonus.Bonus bonus, float probability ) { this.Bonus = bonus; this.Probability = probability; } public static ProbabilityBonusInfo DeserializeProbabilityBonusInfo(ByteBuf _buf) { return new bonus.ProbabilityBonusInfo(_buf); } public readonly bonus.Bonus Bonus; public readonly float Probability; public const int ID = 46960455; public override int GetTypeId() => ID; public void Resolve(Dictionary<string, object> _tables) { Bonus?.Resolve(_tables); OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); public override string ToString() { return "{ " + "Bonus:" + Bonus + "," + "Probability:" + Probability + "," + "}"; } } } <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/ai/UeWaitBlackboardTime.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.ai { public sealed partial class UeWaitBlackboardTime : ai.Task { public UeWaitBlackboardTime(ByteBuf _buf) : base(_buf) { BlackboardKey = _buf.ReadString(); } public UeWaitBlackboardTime(int id, string node_name, System.Collections.Generic.List<ai.Decorator> decorators, System.Collections.Generic.List<ai.Service> services, bool ignore_restart_self, string blackboard_key ) : base(id,node_name,decorators,services,ignore_restart_self) { this.BlackboardKey = blackboard_key; } public static UeWaitBlackboardTime DeserializeUeWaitBlackboardTime(ByteBuf _buf) { return new ai.UeWaitBlackboardTime(_buf); } public readonly string BlackboardKey; public const int ID = 1215378271; public override int GetTypeId() => ID; public override void Resolve(Dictionary<string, object> _tables) { base.Resolve(_tables); OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); public override string ToString() { return "{ " + "Id:" + Id + "," + "NodeName:" + NodeName + "," + "Decorators:" + Bright.Common.StringUtil.CollectionToString(Decorators) + "," + "Services:" + Bright.Common.StringUtil.CollectionToString(Services) + "," + "IgnoreRestartSelf:" + IgnoreRestartSelf + "," + "BlackboardKey:" + BlackboardKey + "," + "}"; } } } <|start_filename|>Projects/DataTemplates/template_lua2/test_tbcompositejsontable3.lua<|end_filename|> -- test.TbCompositeJsonTable3 return { a=111, b=222, }, <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/ai/UeBlackboard.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.ai { public sealed partial class UeBlackboard : ai.Decorator { public UeBlackboard(ByteBuf _buf) : base(_buf) { NotifyObserver = (ai.ENotifyObserverMode)_buf.ReadInt(); BlackboardKey = _buf.ReadString(); KeyQuery = ai.KeyQueryOperator.DeserializeKeyQueryOperator(_buf); } public UeBlackboard(int id, string node_name, ai.EFlowAbortMode flow_abort_mode, ai.ENotifyObserverMode notify_observer, string blackboard_key, ai.KeyQueryOperator key_query ) : base(id,node_name,flow_abort_mode) { this.NotifyObserver = notify_observer; this.BlackboardKey = blackboard_key; this.KeyQuery = key_query; } public static UeBlackboard DeserializeUeBlackboard(ByteBuf _buf) { return new ai.UeBlackboard(_buf); } public readonly ai.ENotifyObserverMode NotifyObserver; public readonly string BlackboardKey; public readonly ai.KeyQueryOperator KeyQuery; public const int ID = -315297507; public override int GetTypeId() => ID; public override void Resolve(Dictionary<string, object> _tables) { base.Resolve(_tables); KeyQuery?.Resolve(_tables); OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); public override string ToString() { return "{ " + "Id:" + Id + "," + "NodeName:" + NodeName + "," + "FlowAbortMode:" + FlowAbortMode + "," + "NotifyObserver:" + NotifyObserver + "," + "BlackboardKey:" + BlackboardKey + "," + "KeyQuery:" + KeyQuery + "," + "}"; } } } <|start_filename|>Projects/GenerateDatas/convert_lua/role.TbRoleLevelExpAttr/63.lua<|end_filename|> return { level = 63, need_exp = 140000, clothes_attrs = { 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, }, } <|start_filename|>Projects/Csharp_CustomTemplate_EncryptMemory/Gen/test/ExcelFromJson.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using System; using Newtonsoft.Json; using Scripts; namespace cfg.test { [Serializable] public partial class ExcelFromJson : AConfig { [JsonProperty("x4")] private int _x4 { get; set; } [JsonIgnore] public EncryptInt x4 { get; private set; } = new(); public bool x1 { get; set; } [JsonProperty("x5")] private long _x5 { get; set; } [JsonIgnore] public EncryptLong x5 { get; private set; } = new(); [JsonProperty("x6")] private float _x6 { get; set; } [JsonIgnore] public EncryptFloat x6 { get; private set; } = new(); public string s1 { get; set; } public string s2 { get; set; } public string S2_l10n_key { get; } public System.Numerics.Vector2 v2 { get; set; } public System.Numerics.Vector3 v3 { get; set; } public System.Numerics.Vector4 v4 { get; set; } public int t1 { get; set; } [JsonProperty] public test.DemoType1 x12 { get; set; } public test.DemoEnum x13 { get; set; } [JsonProperty] public test.DemoDynamic x14 { get; set; } public int[] k1 { get; set; } public System.Collections.Generic.Dictionary<int, int> k8 { get; set; } public System.Collections.Generic.List<test.DemoE2> k9 { get; set; } public test.DemoDynamic[] k15 { get; set; } public override void EndInit() { x4 = _x4; x5 = _x5; x6 = _x6; x12.EndInit(); x14.EndInit(); foreach(var _e in k9) { _e.EndInit(); } foreach(var _e in k15) { _e.EndInit(); } } public override string ToString() => JsonConvert.SerializeObject(this); } } <|start_filename|>Projects/GenerateDatas/convert_lua/test.TbTestBeRef/9.lua<|end_filename|> return { id = 9, count = 10, } <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/common/DateTimeRange.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.common { public sealed partial class DateTimeRange : Bright.Config.BeanBase { public DateTimeRange(ByteBuf _buf) { if(_buf.ReadBool()){ StartTime = _buf.ReadInt(); } else { StartTime = null; } if(_buf.ReadBool()){ EndTime = _buf.ReadInt(); } else { EndTime = null; } } public DateTimeRange(int? start_time, int? end_time ) { this.StartTime = start_time; this.EndTime = end_time; } public static DateTimeRange DeserializeDateTimeRange(ByteBuf _buf) { return new common.DateTimeRange(_buf); } public readonly int? StartTime; public readonly int? EndTime; public const int ID = 1642200959; public override int GetTypeId() => ID; public void Resolve(Dictionary<string, object> _tables) { OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); public override string ToString() { return "{ " + "StartTime:" + StartTime + "," + "EndTime:" + EndTime + "," + "}"; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_Motion_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_Motion_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.Motion constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_averageDuration(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Motion; var result = obj.averageDuration; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_averageAngularSpeed(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Motion; var result = obj.averageAngularSpeed; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_averageSpeed(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Motion; var result = obj.averageSpeed; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_apparentSpeed(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Motion; var result = obj.apparentSpeed; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_isLooping(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Motion; var result = obj.isLooping; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_legacy(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Motion; var result = obj.legacy; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_isHumanMotion(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Motion; var result = obj.isHumanMotion; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"averageDuration", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_averageDuration, Setter = null} }, {"averageAngularSpeed", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_averageAngularSpeed, Setter = null} }, {"averageSpeed", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_averageSpeed, Setter = null} }, {"apparentSpeed", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_apparentSpeed, Setter = null} }, {"isLooping", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_isLooping, Setter = null} }, {"legacy", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_legacy, Setter = null} }, {"isHumanMotion", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_isHumanMotion, Setter = null} }, } }; } } } <|start_filename|>Projects/GenerateDatas/convert_lua/role.TbRoleLevelExpAttr/84.lua<|end_filename|> return { level = 84, need_exp = 245000, clothes_attrs = { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, }, } <|start_filename|>Projects/Csharp_CustomTemplate_EncryptMemory/Gen/cost/CostCurrency.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using System; using Newtonsoft.Json; using Scripts; namespace cfg.cost { [Serializable] public partial class CostCurrency : AConfig { public item.ECurrencyType type { get; set; } [JsonProperty("num")] private int _num { get; set; } [JsonIgnore] public EncryptInt num { get; private set; } = new(); public override void EndInit() { num = _num; } public override string ToString() => JsonConvert.SerializeObject(this); } } <|start_filename|>Projects/GenerateDatas/convert_lua/role.TbRoleLevelExpAttr/11.lua<|end_filename|> return { level = 11, need_exp = 1500, clothes_attrs = { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, }, } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_TextGenerationSettings_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_TextGenerationSettings_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.TextGenerationSettings constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Equals(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.TextGenerationSettings)Puerts.Utils.GetSelf((int)data, self); { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.TextGenerationSettings>(false); var result = obj.Equals(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_font(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.TextGenerationSettings)Puerts.Utils.GetSelf((int)data, self); var result = obj.font; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_font(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.TextGenerationSettings)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.font = argHelper.Get<UnityEngine.Font>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_color(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.TextGenerationSettings)Puerts.Utils.GetSelf((int)data, self); var result = obj.color; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_color(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.TextGenerationSettings)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.color = argHelper.Get<UnityEngine.Color>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_fontSize(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.TextGenerationSettings)Puerts.Utils.GetSelf((int)data, self); var result = obj.fontSize; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_fontSize(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.TextGenerationSettings)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.fontSize = argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_lineSpacing(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.TextGenerationSettings)Puerts.Utils.GetSelf((int)data, self); var result = obj.lineSpacing; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_lineSpacing(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.TextGenerationSettings)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.lineSpacing = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_richText(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.TextGenerationSettings)Puerts.Utils.GetSelf((int)data, self); var result = obj.richText; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_richText(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.TextGenerationSettings)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.richText = argHelper.GetBoolean(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_scaleFactor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.TextGenerationSettings)Puerts.Utils.GetSelf((int)data, self); var result = obj.scaleFactor; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_scaleFactor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.TextGenerationSettings)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.scaleFactor = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_fontStyle(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.TextGenerationSettings)Puerts.Utils.GetSelf((int)data, self); var result = obj.fontStyle; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_fontStyle(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.TextGenerationSettings)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.fontStyle = (UnityEngine.FontStyle)argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_textAnchor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.TextGenerationSettings)Puerts.Utils.GetSelf((int)data, self); var result = obj.textAnchor; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_textAnchor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.TextGenerationSettings)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.textAnchor = (UnityEngine.TextAnchor)argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_alignByGeometry(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.TextGenerationSettings)Puerts.Utils.GetSelf((int)data, self); var result = obj.alignByGeometry; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_alignByGeometry(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.TextGenerationSettings)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.alignByGeometry = argHelper.GetBoolean(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_resizeTextForBestFit(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.TextGenerationSettings)Puerts.Utils.GetSelf((int)data, self); var result = obj.resizeTextForBestFit; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_resizeTextForBestFit(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.TextGenerationSettings)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.resizeTextForBestFit = argHelper.GetBoolean(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_resizeTextMinSize(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.TextGenerationSettings)Puerts.Utils.GetSelf((int)data, self); var result = obj.resizeTextMinSize; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_resizeTextMinSize(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.TextGenerationSettings)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.resizeTextMinSize = argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_resizeTextMaxSize(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.TextGenerationSettings)Puerts.Utils.GetSelf((int)data, self); var result = obj.resizeTextMaxSize; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_resizeTextMaxSize(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.TextGenerationSettings)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.resizeTextMaxSize = argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_updateBounds(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.TextGenerationSettings)Puerts.Utils.GetSelf((int)data, self); var result = obj.updateBounds; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_updateBounds(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.TextGenerationSettings)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.updateBounds = argHelper.GetBoolean(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_verticalOverflow(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.TextGenerationSettings)Puerts.Utils.GetSelf((int)data, self); var result = obj.verticalOverflow; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_verticalOverflow(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.TextGenerationSettings)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.verticalOverflow = (UnityEngine.VerticalWrapMode)argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_horizontalOverflow(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.TextGenerationSettings)Puerts.Utils.GetSelf((int)data, self); var result = obj.horizontalOverflow; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_horizontalOverflow(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.TextGenerationSettings)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.horizontalOverflow = (UnityEngine.HorizontalWrapMode)argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_generationExtents(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.TextGenerationSettings)Puerts.Utils.GetSelf((int)data, self); var result = obj.generationExtents; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_generationExtents(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.TextGenerationSettings)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.generationExtents = argHelper.Get<UnityEngine.Vector2>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_pivot(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.TextGenerationSettings)Puerts.Utils.GetSelf((int)data, self); var result = obj.pivot; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_pivot(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.TextGenerationSettings)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.pivot = argHelper.Get<UnityEngine.Vector2>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_generateOutOfBounds(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.TextGenerationSettings)Puerts.Utils.GetSelf((int)data, self); var result = obj.generateOutOfBounds; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_generateOutOfBounds(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.TextGenerationSettings)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.generateOutOfBounds = argHelper.GetBoolean(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "Equals", IsStatic = false}, M_Equals }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"font", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_font, Setter = S_font} }, {"color", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_color, Setter = S_color} }, {"fontSize", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_fontSize, Setter = S_fontSize} }, {"lineSpacing", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_lineSpacing, Setter = S_lineSpacing} }, {"richText", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_richText, Setter = S_richText} }, {"scaleFactor", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_scaleFactor, Setter = S_scaleFactor} }, {"fontStyle", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_fontStyle, Setter = S_fontStyle} }, {"textAnchor", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_textAnchor, Setter = S_textAnchor} }, {"alignByGeometry", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_alignByGeometry, Setter = S_alignByGeometry} }, {"resizeTextForBestFit", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_resizeTextForBestFit, Setter = S_resizeTextForBestFit} }, {"resizeTextMinSize", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_resizeTextMinSize, Setter = S_resizeTextMinSize} }, {"resizeTextMaxSize", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_resizeTextMaxSize, Setter = S_resizeTextMaxSize} }, {"updateBounds", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_updateBounds, Setter = S_updateBounds} }, {"verticalOverflow", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_verticalOverflow, Setter = S_verticalOverflow} }, {"horizontalOverflow", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_horizontalOverflow, Setter = S_horizontalOverflow} }, {"generationExtents", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_generationExtents, Setter = S_generationExtents} }, {"pivot", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_pivot, Setter = S_pivot} }, {"generateOutOfBounds", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_generateOutOfBounds, Setter = S_generateOutOfBounds} }, } }; } } } <|start_filename|>Projects/Csharp_CustomTemplate_EncryptMemory/Gen/ai/FlowNode.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using System; using Newtonsoft.Json; using Scripts; namespace cfg.ai { [Serializable] public partial class FlowNode : AConfig { public System.Collections.Generic.List<ai.Decorator> decorators { get; set; } public System.Collections.Generic.List<ai.Service> services { get; set; } public override void EndInit() { foreach(var _e in decorators) { _e.EndInit(); } foreach(var _e in services) { _e.EndInit(); } } public override string ToString() => JsonConvert.SerializeObject(this); } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_SubsystemDescriptor_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_SubsystemDescriptor_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.SubsystemDescriptor constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_id(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SubsystemDescriptor; var result = obj.id; Puerts.PuertsDLL.ReturnString(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_id(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SubsystemDescriptor; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.id = argHelper.GetString(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_subsystemImplementationType(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SubsystemDescriptor; var result = obj.subsystemImplementationType; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_subsystemImplementationType(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SubsystemDescriptor; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.subsystemImplementationType = argHelper.Get<System.Type>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"id", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_id, Setter = S_id} }, {"subsystemImplementationType", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_subsystemImplementationType, Setter = S_subsystemImplementationType} }, } }; } } } <|start_filename|>Projects/Lua_Unity_xlua_lua/Assets/Lua/Data/l10n_tbl10ndemo.lua<|end_filename|> return { [11] = {id=11,text={key='/demo/1',text="测试1"},}, [12] = {id=12,text={key='/demo/2',text="测试2"},}, [13] = {id=13,text={key='/demo/3',text="测试3"},}, [14] = {id=14,text={key='',text=""},}, [15] = {id=15,text={key='/demo/5',text="测试5"},}, [16] = {id=16,text={key='/demo/6',text="测试6"},}, [17] = {id=17,text={key='/demo/7',text="测试7"},}, [18] = {id=18,text={key='/demo/8',text="测试8"},}, } <|start_filename|>Projects/DataTemplates/template_erlang/test_tbcompositejsontable3.erl<|end_filename|> %% test.TbCompositeJsonTable3 get() -> #{a => 111,b => 222}. <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/test/H2.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.test { public sealed partial class H2 : Bright.Config.BeanBase { public H2(ByteBuf _buf) { Z2 = _buf.ReadInt(); Z3 = _buf.ReadInt(); } public H2(int z2, int z3 ) { this.Z2 = z2; this.Z3 = z3; } public static H2 DeserializeH2(ByteBuf _buf) { return new test.H2(_buf); } public readonly int Z2; public readonly int Z3; public const int ID = -1422503994; public override int GetTypeId() => ID; public void Resolve(Dictionary<string, object> _tables) { OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); public override string ToString() { return "{ " + "Z2:" + Z2 + "," + "Z3:" + Z3 + "," + "}"; } } } <|start_filename|>Projects/GenerateDatas/convert_lua/tag.TbTestTag/104.lua<|end_filename|> return { id = 104, value = "any", } <|start_filename|>Projects/Java_bin/src/main/gen/cfg/item/DesignDrawing.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.item; import bright.serialization.*; public final class DesignDrawing extends cfg.item.ItemExtra { public DesignDrawing(ByteBuf _buf) { super(_buf); {int n = Math.min(_buf.readSize(), _buf.size());learnComponentId = new java.util.ArrayList<Integer>(n);for(int i = 0 ; i < n ; i++) { Integer _e; _e = _buf.readInt(); learnComponentId.add(_e);}} } public DesignDrawing(int id, java.util.ArrayList<Integer> learn_component_id ) { super(id); this.learnComponentId = learn_component_id; } public final java.util.ArrayList<Integer> learnComponentId; public static final int __ID__ = -1679179579; @Override public int getTypeId() { return __ID__; } @Override public void resolve(java.util.HashMap<String, Object> _tables) { super.resolve(_tables); } @Override public String toString() { return "{ " + "id:" + id + "," + "learnComponentId:" + learnComponentId + "," + "}"; } } <|start_filename|>Projects/GenerateDatas/convert_lua/error.TbCodeInfo/2.lua<|end_filename|> return { code = 2, key = "HAS_BIND_SERVER", } <|start_filename|>Projects/Csharp_CustomTemplate_EncryptMemory/Gen/item/Clothes.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using System; using Newtonsoft.Json; using Scripts; namespace cfg.item { [Serializable] public partial class Clothes : AConfig { [JsonProperty("attack")] private int _attack { get; set; } [JsonIgnore] public EncryptInt attack { get; private set; } = new(); [JsonProperty("hp")] private long _hp { get; set; } [JsonIgnore] public EncryptLong hp { get; private set; } = new(); [JsonProperty("energy_limit")] private int _energy_limit { get; set; } [JsonIgnore] public EncryptInt energy_limit { get; private set; } = new(); [JsonProperty("energy_resume")] private int _energy_resume { get; set; } [JsonIgnore] public EncryptInt energy_resume { get; private set; } = new(); public override void EndInit() { attack = _attack; hp = _hp; energy_limit = _energy_limit; energy_resume = _energy_resume; } public override string ToString() => JsonConvert.SerializeObject(this); } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_UI_RawImage_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_UI_RawImage_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.UI.RawImage constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetNativeSize(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.RawImage; { { obj.SetNativeSize(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_mainTexture(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.RawImage; var result = obj.mainTexture; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_texture(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.RawImage; var result = obj.texture; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_texture(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.RawImage; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.texture = argHelper.Get<UnityEngine.Texture>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_uvRect(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.RawImage; var result = obj.uvRect; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_uvRect(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.RawImage; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.uvRect = argHelper.Get<UnityEngine.Rect>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "SetNativeSize", IsStatic = false}, M_SetNativeSize }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"mainTexture", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_mainTexture, Setter = null} }, {"texture", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_texture, Setter = S_texture} }, {"uvRect", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_uvRect, Setter = S_uvRect} }, } }; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_ContactPoint_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_ContactPoint_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.ContactPoint constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_point(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ContactPoint)Puerts.Utils.GetSelf((int)data, self); var result = obj.point; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_normal(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ContactPoint)Puerts.Utils.GetSelf((int)data, self); var result = obj.normal; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_thisCollider(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ContactPoint)Puerts.Utils.GetSelf((int)data, self); var result = obj.thisCollider; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_otherCollider(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ContactPoint)Puerts.Utils.GetSelf((int)data, self); var result = obj.otherCollider; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_separation(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ContactPoint)Puerts.Utils.GetSelf((int)data, self); var result = obj.separation; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"point", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_point, Setter = null} }, {"normal", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_normal, Setter = null} }, {"thisCollider", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_thisCollider, Setter = null} }, {"otherCollider", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_otherCollider, Setter = null} }, {"separation", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_separation, Setter = null} }, } }; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_Pose_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_Pose_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Quaternion), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = argHelper1.Get<UnityEngine.Quaternion>(false); var result = new UnityEngine.Pose(Arg0,Arg1); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.Pose), result); } } if (paramLen == 0) { { var result = new UnityEngine.Pose(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.Pose), result); } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.Pose constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ToString(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Pose)Puerts.Utils.GetSelf((int)data, self); if (paramLen == 0) { { var result = obj.ToString(); Puerts.PuertsDLL.ReturnString(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var result = obj.ToString(Arg0); Puerts.PuertsDLL.ReturnString(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to ToString"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetTransformedBy(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Pose)Puerts.Utils.GetSelf((int)data, self); if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Pose), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Pose>(false); var result = obj.GetTransformedBy(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Transform), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Transform>(false); var result = obj.GetTransformedBy(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetTransformedBy"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Equals(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Pose)Puerts.Utils.GetSelf((int)data, self); if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.Any, typeof(System.Object), false, false)) { var Arg0 = argHelper0.Get<System.Object>(false); var result = obj.Equals(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Pose), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Pose>(false); var result = obj.Equals(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to Equals"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetHashCode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Pose)Puerts.Utils.GetSelf((int)data, self); { { var result = obj.GetHashCode(); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_forward(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Pose)Puerts.Utils.GetSelf((int)data, self); var result = obj.forward; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_right(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Pose)Puerts.Utils.GetSelf((int)data, self); var result = obj.right; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_up(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Pose)Puerts.Utils.GetSelf((int)data, self); var result = obj.up; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_identity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Pose.identity; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_position(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Pose)Puerts.Utils.GetSelf((int)data, self); var result = obj.position; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_position(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Pose)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.position = argHelper.Get<UnityEngine.Vector3>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_rotation(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Pose)Puerts.Utils.GetSelf((int)data, self); var result = obj.rotation; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_rotation(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Pose)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.rotation = argHelper.Get<UnityEngine.Quaternion>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void O_op_Equality(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var arg0 = argHelper0.Get<UnityEngine.Pose>(false); var arg1 = argHelper1.Get<UnityEngine.Pose>(false); var result = arg0 == arg1; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void O_op_Inequality(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var arg0 = argHelper0.Get<UnityEngine.Pose>(false); var arg1 = argHelper1.Get<UnityEngine.Pose>(false); var result = arg0 != arg1; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "ToString", IsStatic = false}, M_ToString }, { new Puerts.MethodKey {Name = "GetTransformedBy", IsStatic = false}, M_GetTransformedBy }, { new Puerts.MethodKey {Name = "Equals", IsStatic = false}, M_Equals }, { new Puerts.MethodKey {Name = "GetHashCode", IsStatic = false}, M_GetHashCode }, { new Puerts.MethodKey {Name = "op_Equality", IsStatic = true}, O_op_Equality}, { new Puerts.MethodKey {Name = "op_Inequality", IsStatic = true}, O_op_Inequality}, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"forward", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_forward, Setter = null} }, {"right", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_right, Setter = null} }, {"up", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_up, Setter = null} }, {"identity", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_identity, Setter = null} }, {"position", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_position, Setter = S_position} }, {"rotation", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_rotation, Setter = S_rotation} }, } }; } } } <|start_filename|>Projects/Go_json/gen/src/cfg/bonus.ShowItemInfo.go<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg import "errors" type BonusShowItemInfo struct { ItemId int32 ItemNum int64 } const TypeId_BonusShowItemInfo = -1496363507 func (*BonusShowItemInfo) GetTypeId() int32 { return -1496363507 } func (_v *BonusShowItemInfo)Deserialize(_buf map[string]interface{}) (err error) { { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["item_id"].(float64); !_ok_ { err = errors.New("item_id error"); return }; _v.ItemId = int32(_tempNum_) } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["item_num"].(float64); !_ok_ { err = errors.New("item_num error"); return }; _v.ItemNum = int64(_tempNum_) } return } func DeserializeBonusShowItemInfo(_buf map[string]interface{}) (*BonusShowItemInfo, error) { v := &BonusShowItemInfo{} if err := v.Deserialize(_buf); err == nil { return v, nil } else { return nil, err } } <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/test/DemoPrimitiveTypesTable.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.test { public sealed partial class DemoPrimitiveTypesTable : Bright.Config.BeanBase { public DemoPrimitiveTypesTable(ByteBuf _buf) { X1 = _buf.ReadBool(); X2 = _buf.ReadByte(); X3 = _buf.ReadShort(); X4 = _buf.ReadInt(); X5 = _buf.ReadLong(); X6 = _buf.ReadFloat(); X7 = _buf.ReadDouble(); S1 = _buf.ReadString(); S2 = _buf.ReadString(); V2 = _buf.ReadVector2(); V3 = _buf.ReadVector3(); V4 = _buf.ReadVector4(); T1 = _buf.ReadInt(); } public DemoPrimitiveTypesTable(bool x1, byte x2, short x3, int x4, long x5, float x6, double x7, string s1, string s2, System.Numerics.Vector2 v2, System.Numerics.Vector3 v3, System.Numerics.Vector4 v4, int t1 ) { this.X1 = x1; this.X2 = x2; this.X3 = x3; this.X4 = x4; this.X5 = x5; this.X6 = x6; this.X7 = x7; this.S1 = s1; this.S2 = s2; this.V2 = v2; this.V3 = v3; this.V4 = v4; this.T1 = t1; } public static DemoPrimitiveTypesTable DeserializeDemoPrimitiveTypesTable(ByteBuf _buf) { return new test.DemoPrimitiveTypesTable(_buf); } public readonly bool X1; public readonly byte X2; public readonly short X3; public readonly int X4; public readonly long X5; public readonly float X6; public readonly double X7; public readonly string S1; public readonly string S2; public readonly System.Numerics.Vector2 V2; public readonly System.Numerics.Vector3 V3; public readonly System.Numerics.Vector4 V4; public readonly int T1; public const int ID = -370934083; public override int GetTypeId() => ID; public void Resolve(Dictionary<string, object> _tables) { OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); public override string ToString() { return "{ " + "X1:" + X1 + "," + "X2:" + X2 + "," + "X3:" + X3 + "," + "X4:" + X4 + "," + "X5:" + X5 + "," + "X6:" + X6 + "," + "X7:" + X7 + "," + "S1:" + S1 + "," + "S2:" + S2 + "," + "V2:" + V2 + "," + "V3:" + V3 + "," + "V4:" + V4 + "," + "T1:" + T1 + "," + "}"; } } } <|start_filename|>Projects/DataTemplates/template_lua/tag_tbtesttag.lua<|end_filename|> return { [2001] = {id=2001,value="导出",}, [2004] = {id=2004,value="any",}, [2003] = {id=2003,value="test",}, [100] = {id=100,value="导出",}, [1] = {id=1,value="导出",}, [2] = {id=2,value="导出",}, [6] = {id=6,value="导出",}, [7] = {id=7,value="导出",}, [9] = {id=9,value="测试",}, [10] = {id=10,value="测试",}, [11] = {id=11,value="any",}, [12] = {id=12,value="导出",}, [13] = {id=13,value="导出",}, [104] = {id=104,value="any",}, [102] = {id=102,value="test",}, [3001] = {id=3001,value="export",}, [3004] = {id=3004,value="any",}, [3003] = {id=3003,value="test",}, } <|start_filename|>Projects/DataTemplates/template_lua/test_tbcompositejsontable3.lua<|end_filename|> return {a=111,b=222,} <|start_filename|>ProtoProjects/Csharp_Unity/Assets/Bright.Net/Codecs/UnknownProtocolException.cs<|end_filename|> using System; using System.Runtime.Serialization; namespace Bright.Net.Codecs { public class UnknownProtocolException : Exception { public UnknownProtocolException() { } public UnknownProtocolException(string message) : base(message) { } public UnknownProtocolException(string message, Exception innerException) : base(message, innerException) { } protected UnknownProtocolException(SerializationInfo info, StreamingContext context) : base(info, context) { } } } <|start_filename|>Projects/CfgValidator/Modules/Mail.cs<|end_filename|> using System.Linq; using CfgCheck; using Microsoft.VisualStudio.TestTools.UnitTesting; namespace CfgCheck.Modules { [TestClass] public class Mail { [TestMethod] public void SystemMailAwardTest_NotEmpty() { var mailConfig = ConfigSetUp.Configs.TbSystemMail; // 接下来就可以对邮件配置表进行check操作啦 // 下面是检查奖励是否为空的demo示例 // 建议测试用例的命名规则 使用 MethodName_ExpectedBehavior这样的方式 var mailList = mailConfig.DataList; foreach (var mailItem in mailList) { Assert.IsNotNull(mailItem.Award); } } } } <|start_filename|>Projects/Go_json/gen/src/cfg/mail.TbSystemMail.go<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg type MailTbSystemMail struct { _dataMap map[int32]*MailSystemMail _dataList []*MailSystemMail } func NewMailTbSystemMail(_buf []map[string]interface{}) (*MailTbSystemMail, error) { _dataList := make([]*MailSystemMail, 0, len(_buf)) dataMap := make(map[int32]*MailSystemMail) for _, _ele_ := range _buf { if _v, err2 := DeserializeMailSystemMail(_ele_); err2 != nil { return nil, err2 } else { _dataList = append(_dataList, _v) dataMap[_v.Id] = _v } } return &MailTbSystemMail{_dataList:_dataList, _dataMap:dataMap}, nil } func (table *MailTbSystemMail) GetDataMap() map[int32]*MailSystemMail { return table._dataMap } func (table *MailTbSystemMail) GetDataList() []*MailSystemMail { return table._dataList } func (table *MailTbSystemMail) Get(key int32) *MailSystemMail { return table._dataMap[key] } <|start_filename|>Projects/Java_bin/src/main/gen/cfg/cost/Cost.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.cost; import bright.serialization.*; public abstract class Cost { public Cost(ByteBuf _buf) { } public Cost() { } public static Cost deserializeCost(ByteBuf _buf) { switch (_buf.readInt()) { case cfg.cost.CostCurrency.__ID__: return new cfg.cost.CostCurrency(_buf); case cfg.cost.CostCurrencies.__ID__: return new cfg.cost.CostCurrencies(_buf); case cfg.cost.CostOneItem.__ID__: return new cfg.cost.CostOneItem(_buf); case cfg.cost.CostItem.__ID__: return new cfg.cost.CostItem(_buf); case cfg.cost.CostItems.__ID__: return new cfg.cost.CostItems(_buf); default: throw new SerializationException(); } } public abstract int getTypeId(); public void resolve(java.util.HashMap<String, Object> _tables) { } @Override public String toString() { return "{ " + "}"; } } <|start_filename|>Projects/Go_json/gen/src/cfg/condition.GenderLimit.go<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg import "errors" type ConditionGenderLimit struct { Gender int32 } const TypeId_ConditionGenderLimit = 103675143 func (*ConditionGenderLimit) GetTypeId() int32 { return 103675143 } func (_v *ConditionGenderLimit)Deserialize(_buf map[string]interface{}) (err error) { { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["gender"].(float64); !_ok_ { err = errors.New("gender error"); return }; _v.Gender = int32(_tempNum_) } return } func DeserializeConditionGenderLimit(_buf map[string]interface{}) (*ConditionGenderLimit, error) { v := &ConditionGenderLimit{} if err := v.Deserialize(_buf); err == nil { return v, nil } else { return nil, err } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_Event_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_Event_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { if (paramLen == 0) { { var result = new UnityEngine.Event(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.Event), result); } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var result = new UnityEngine.Event(Arg0); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.Event), result); } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Event), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Event>(false); var result = new UnityEngine.Event(Arg0); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.Event), result); } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.Event constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetTypeForControl(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Event; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); var result = obj.GetTypeForControl(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_PopEvent(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Event>(false); var result = UnityEngine.Event.PopEvent(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetEventCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { { var result = UnityEngine.Event.GetEventCount(); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_KeyboardEvent(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetString(false); var result = UnityEngine.Event.KeyboardEvent(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetHashCode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Event; { { var result = obj.GetHashCode(); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Equals(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Event; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.Object>(false); var result = obj.Equals(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ToString(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Event; { { var result = obj.ToString(); Puerts.PuertsDLL.ReturnString(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Use(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Event; { { obj.Use(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_rawType(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Event; var result = obj.rawType; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_mousePosition(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Event; var result = obj.mousePosition; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_mousePosition(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Event; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.mousePosition = argHelper.Get<UnityEngine.Vector2>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_delta(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Event; var result = obj.delta; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_delta(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Event; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.delta = argHelper.Get<UnityEngine.Vector2>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_pointerType(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Event; var result = obj.pointerType; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_pointerType(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Event; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.pointerType = (UnityEngine.PointerType)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_button(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Event; var result = obj.button; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_button(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Event; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.button = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_modifiers(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Event; var result = obj.modifiers; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_modifiers(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Event; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.modifiers = (UnityEngine.EventModifiers)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_pressure(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Event; var result = obj.pressure; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_pressure(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Event; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.pressure = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_clickCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Event; var result = obj.clickCount; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_clickCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Event; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.clickCount = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_character(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Event; var result = obj.character; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_character(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Event; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.character = argHelper.Get<System.Char>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_keyCode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Event; var result = obj.keyCode; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_keyCode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Event; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.keyCode = (UnityEngine.KeyCode)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_displayIndex(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Event; var result = obj.displayIndex; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_displayIndex(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Event; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.displayIndex = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_type(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Event; var result = obj.type; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_type(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Event; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.type = (UnityEngine.EventType)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_commandName(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Event; var result = obj.commandName; Puerts.PuertsDLL.ReturnString(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_commandName(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Event; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.commandName = argHelper.GetString(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_shift(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Event; var result = obj.shift; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_shift(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Event; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.shift = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_control(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Event; var result = obj.control; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_control(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Event; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.control = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_alt(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Event; var result = obj.alt; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_alt(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Event; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.alt = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_command(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Event; var result = obj.command; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_command(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Event; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.command = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_capsLock(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Event; var result = obj.capsLock; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_capsLock(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Event; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.capsLock = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_numeric(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Event; var result = obj.numeric; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_numeric(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Event; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.numeric = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_functionKey(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Event; var result = obj.functionKey; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_current(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Event.current; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_current(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.Event.current = argHelper.Get<UnityEngine.Event>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_isKey(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Event; var result = obj.isKey; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_isMouse(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Event; var result = obj.isMouse; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_isScrollWheel(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Event; var result = obj.isScrollWheel; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "GetTypeForControl", IsStatic = false}, M_GetTypeForControl }, { new Puerts.MethodKey {Name = "PopEvent", IsStatic = true}, F_PopEvent }, { new Puerts.MethodKey {Name = "GetEventCount", IsStatic = true}, F_GetEventCount }, { new Puerts.MethodKey {Name = "KeyboardEvent", IsStatic = true}, F_KeyboardEvent }, { new Puerts.MethodKey {Name = "GetHashCode", IsStatic = false}, M_GetHashCode }, { new Puerts.MethodKey {Name = "Equals", IsStatic = false}, M_Equals }, { new Puerts.MethodKey {Name = "ToString", IsStatic = false}, M_ToString }, { new Puerts.MethodKey {Name = "Use", IsStatic = false}, M_Use }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"rawType", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_rawType, Setter = null} }, {"mousePosition", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_mousePosition, Setter = S_mousePosition} }, {"delta", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_delta, Setter = S_delta} }, {"pointerType", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_pointerType, Setter = S_pointerType} }, {"button", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_button, Setter = S_button} }, {"modifiers", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_modifiers, Setter = S_modifiers} }, {"pressure", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_pressure, Setter = S_pressure} }, {"clickCount", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_clickCount, Setter = S_clickCount} }, {"character", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_character, Setter = S_character} }, {"keyCode", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_keyCode, Setter = S_keyCode} }, {"displayIndex", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_displayIndex, Setter = S_displayIndex} }, {"type", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_type, Setter = S_type} }, {"commandName", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_commandName, Setter = S_commandName} }, {"shift", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_shift, Setter = S_shift} }, {"control", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_control, Setter = S_control} }, {"alt", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_alt, Setter = S_alt} }, {"command", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_command, Setter = S_command} }, {"capsLock", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_capsLock, Setter = S_capsLock} }, {"numeric", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_numeric, Setter = S_numeric} }, {"functionKey", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_functionKey, Setter = null} }, {"current", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_current, Setter = S_current} }, {"isKey", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_isKey, Setter = null} }, {"isMouse", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_isMouse, Setter = null} }, {"isScrollWheel", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_isScrollWheel, Setter = null} }, } }; } } } <|start_filename|>Projects/java_json/src/gen/cfg/test/DemoD3.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.test; import com.google.gson.JsonElement; import com.google.gson.JsonObject; public abstract class DemoD3 extends cfg.test.DemoDynamic { public DemoD3(JsonObject __json__) { super(__json__); x3 = __json__.get("x3").getAsInt(); } public DemoD3(int x1, int x3 ) { super(x1); this.x3 = x3; } public static DemoD3 deserializeDemoD3(JsonObject __json__) { switch (__json__.get("__type__").getAsString()) { case "DemoE1": return new cfg.test.DemoE1(__json__); default: throw new bright.serialization.SerializationException(); } } public final int x3; @Override public void resolve(java.util.HashMap<String, Object> _tables) { super.resolve(_tables); } @Override public String toString() { return "{ " + "x1:" + x1 + "," + "x3:" + x3 + "," + "}"; } } <|start_filename|>Projects/GenerateDatas/convert_lua/role.TbRoleLevelExpAttr/94.lua<|end_filename|> return { level = 94, need_exp = 295000, clothes_attrs = { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, }, } <|start_filename|>Projects/Go_json/gen/src/cfg/blueprint.ParamInfo.go<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg import "errors" type BlueprintParamInfo struct { Name string Type string IsRef bool } const TypeId_BlueprintParamInfo = -729799392 func (*BlueprintParamInfo) GetTypeId() int32 { return -729799392 } func (_v *BlueprintParamInfo)Deserialize(_buf map[string]interface{}) (err error) { { var _ok_ bool; if _v.Name, _ok_ = _buf["name"].(string); !_ok_ { err = errors.New("name error"); return } } { var _ok_ bool; if _v.Type, _ok_ = _buf["type"].(string); !_ok_ { err = errors.New("type error"); return } } { var _ok_ bool; if _v.IsRef, _ok_ = _buf["is_ref"].(bool); !_ok_ { err = errors.New("is_ref error"); return } } return } func DeserializeBlueprintParamInfo(_buf map[string]interface{}) (*BlueprintParamInfo, error) { v := &BlueprintParamInfo{} if err := v.Deserialize(_buf); err == nil { return v, nil } else { return nil, err } } <|start_filename|>ProtoProjects/go/gen/src/proto/test.Child32.go<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package proto import ( "bright/serialization" ) import "errors" type TestChild32 struct { A1 int32 A24 int32 B31 int32 B32 int32 } const TypeId_TestChild32 = 11 func (*TestChild32) GetTypeId() int32 { return 11 } func (_v *TestChild32)Serialize(_buf *serialization.ByteBuf) { _buf.WriteInt(_v.A1) _buf.WriteInt(_v.A24) _buf.WriteInt(_v.B31) _buf.WriteInt(_v.B32) } func (_v *TestChild32)Deserialize(_buf *serialization.ByteBuf) (err error) { { if _v.A1, err = _buf.ReadInt(); err != nil { err = errors.New("_v.A1 error"); return } } { if _v.A24, err = _buf.ReadInt(); err != nil { err = errors.New("_v.A24 error"); return } } { if _v.B31, err = _buf.ReadInt(); err != nil { err = errors.New("_v.B31 error"); return } } { if _v.B32, err = _buf.ReadInt(); err != nil { err = errors.New("_v.B32 error"); return } } return } func SerializeTestChild32(_v serialization.ISerializable, _buf *serialization.ByteBuf) { _v.Serialize(_buf) } func DeserializeTestChild32(_buf *serialization.ByteBuf) (*TestChild32, error) { v := &TestChild32{} if err := v.Deserialize(_buf); err == nil { return v, nil } else { return nil, err } } <|start_filename|>Projects/Java_bin/src/main/gen/cfg/item/Item.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.item; import bright.serialization.*; /** * 道具 */ public final class Item { public Item(ByteBuf _buf) { id = _buf.readInt(); name = _buf.readString(); majorType = cfg.item.EMajorType.valueOf(_buf.readInt()); minorType = cfg.item.EMinorType.valueOf(_buf.readInt()); maxPileNum = _buf.readInt(); quality = cfg.item.EItemQuality.valueOf(_buf.readInt()); icon = _buf.readString(); iconBackgroud = _buf.readString(); iconMask = _buf.readString(); desc = _buf.readString(); showOrder = _buf.readInt(); quantifier = _buf.readString(); showInBag = _buf.readBool(); minShowLevel = _buf.readInt(); batchUsable = _buf.readBool(); progressTimeWhenUse = _buf.readFloat(); showHintWhenUse = _buf.readBool(); droppable = _buf.readBool(); if(_buf.readBool()){ price = _buf.readInt(); } else { price = null; } useType = cfg.item.EUseType.valueOf(_buf.readInt()); if(_buf.readBool()){ levelUpId = _buf.readInt(); } else { levelUpId = null; } } public Item(int id, String name, cfg.item.EMajorType major_type, cfg.item.EMinorType minor_type, int max_pile_num, cfg.item.EItemQuality quality, String icon, String icon_backgroud, String icon_mask, String desc, int show_order, String quantifier, boolean show_in_bag, int min_show_level, boolean batch_usable, float progress_time_when_use, boolean show_hint_when_use, boolean droppable, Integer price, cfg.item.EUseType use_type, Integer level_up_id ) { this.id = id; this.name = name; this.majorType = major_type; this.minorType = minor_type; this.maxPileNum = max_pile_num; this.quality = quality; this.icon = icon; this.iconBackgroud = icon_backgroud; this.iconMask = icon_mask; this.desc = desc; this.showOrder = show_order; this.quantifier = quantifier; this.showInBag = show_in_bag; this.minShowLevel = min_show_level; this.batchUsable = batch_usable; this.progressTimeWhenUse = progress_time_when_use; this.showHintWhenUse = show_hint_when_use; this.droppable = droppable; this.price = price; this.useType = use_type; this.levelUpId = level_up_id; } /** * 道具id */ public final int id; public final String name; public final cfg.item.EMajorType majorType; public final cfg.item.EMinorType minorType; public final int maxPileNum; public final cfg.item.EItemQuality quality; public final String icon; public final String iconBackgroud; public final String iconMask; public final String desc; public final int showOrder; public final String quantifier; public final boolean showInBag; public final int minShowLevel; public final boolean batchUsable; public final float progressTimeWhenUse; public final boolean showHintWhenUse; public final boolean droppable; public final Integer price; public final cfg.item.EUseType useType; public final Integer levelUpId; public void resolve(java.util.HashMap<String, Object> _tables) { } @Override public String toString() { return "{ " + "id:" + id + "," + "name:" + name + "," + "majorType:" + majorType + "," + "minorType:" + minorType + "," + "maxPileNum:" + maxPileNum + "," + "quality:" + quality + "," + "icon:" + icon + "," + "iconBackgroud:" + iconBackgroud + "," + "iconMask:" + iconMask + "," + "desc:" + desc + "," + "showOrder:" + showOrder + "," + "quantifier:" + quantifier + "," + "showInBag:" + showInBag + "," + "minShowLevel:" + minShowLevel + "," + "batchUsable:" + batchUsable + "," + "progressTimeWhenUse:" + progressTimeWhenUse + "," + "showHintWhenUse:" + showHintWhenUse + "," + "droppable:" + droppable + "," + "price:" + price + "," + "useType:" + useType + "," + "levelUpId:" + levelUpId + "," + "}"; } } <|start_filename|>Projects/Go_json/gen/src/cfg/ai.BehaviorTree.go<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg import "errors" type AiBehaviorTree struct { Id int32 Name string Desc string BlackboardId string Root interface{} } const TypeId_AiBehaviorTree = 159552822 func (*AiBehaviorTree) GetTypeId() int32 { return 159552822 } func (_v *AiBehaviorTree)Deserialize(_buf map[string]interface{}) (err error) { { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["id"].(float64); !_ok_ { err = errors.New("id error"); return }; _v.Id = int32(_tempNum_) } { var _ok_ bool; if _v.Name, _ok_ = _buf["name"].(string); !_ok_ { err = errors.New("name error"); return } } { var _ok_ bool; if _v.Desc, _ok_ = _buf["desc"].(string); !_ok_ { err = errors.New("desc error"); return } } { var _ok_ bool; if _v.BlackboardId, _ok_ = _buf["blackboard_id"].(string); !_ok_ { err = errors.New("blackboard_id error"); return } } { var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _buf["root"].(map[string]interface{}); !_ok_ { err = errors.New("root error"); return }; if _v.Root, err = DeserializeAiComposeNode(_x_); err != nil { return } } return } func DeserializeAiBehaviorTree(_buf map[string]interface{}) (*AiBehaviorTree, error) { v := &AiBehaviorTree{} if err := v.Deserialize(_buf); err == nil { return v, nil } else { return nil, err } } <|start_filename|>Projects/Java_bin/src/main/gen/cfg/test/TbDefineFromExcelOne.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.test; import bright.serialization.*; public final class TbDefineFromExcelOne { private final cfg.test.DefineFromExcelOne _data; public final cfg.test.DefineFromExcelOne data() { return _data; } public TbDefineFromExcelOne(ByteBuf _buf) { int n = _buf.readSize(); if (n != 1) throw new SerializationException("table mode=one, but size != 1"); _data = new cfg.test.DefineFromExcelOne(_buf); } /** * 装备解锁等级 */ public int getUnlockEquip() { return _data.unlockEquip; } /** * 英雄解锁等级 */ public int getUnlockHero() { return _data.unlockHero; } public String getDefaultAvatar() { return _data.defaultAvatar; } public String getDefaultItem() { return _data.defaultItem; } public void resolve(java.util.HashMap<String, Object> _tables) { _data.resolve(_tables); } } <|start_filename|>Projects/DataTemplates/template_erlang2/test_tbnotindexlist.erl<|end_filename|> %% test.TbNotIndexList -module(test_tbnotindexlist) -export([get/1,get_ids/0]) get() -> #{ x => 1, y => 2 }; get_ids() -> []. <|start_filename|>Projects/Cpp_bin/bright/CfgBean.hpp<|end_filename|> #pragma once #include "serialization/ByteBuf.h" namespace bright { class CfgBean { public: virtual int getTypeId() const = 0; virtual bool deserialize(serialization::ByteBuf& buf) = 0; }; } <|start_filename|>Projects/Csharp_CustomTemplate_EncryptMemory/Gen/test/MultiUnionIndexList.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using System; using Newtonsoft.Json; using Scripts; namespace cfg.test { [Serializable] public partial class MultiUnionIndexList : AConfig { [JsonProperty("id1")] private int _id1 { get; set; } [JsonIgnore] public EncryptInt id1 { get; private set; } = new(); [JsonProperty("id2")] private long _id2 { get; set; } [JsonIgnore] public EncryptLong id2 { get; private set; } = new(); public string id3 { get; set; } [JsonProperty("num")] private int _num { get; set; } [JsonIgnore] public EncryptInt num { get; private set; } = new(); public string desc { get; set; } public override void EndInit() { id1 = _id1; id2 = _id2; num = _num; } public override string ToString() => JsonConvert.SerializeObject(this); } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/TsScripts/output/Conf/AppConfig.js<|end_filename|> "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const csharp_1 = require("csharp"); class AppConf { } exports.default = AppConf; AppConf.configPath = csharp_1.UnityEngine.Application.dataPath + "/../ConfigData"; //# sourceMappingURL=AppConfig.js.map <|start_filename|>ProtoProjects/Csharp_Unity/Assets/Gen/test/Child32.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; namespace proto.test { public sealed class Child32 : test.Child21 { public Child32() { } public Child32(Bright.Common.NotNullInitialization _) : base(_) { } public static void SerializeChild32(ByteBuf _buf, Child32 x) { x.Serialize(_buf); } public static Child32 DeserializeChild32(ByteBuf _buf) { var x = new test.Child32(); x.Deserialize(_buf); return x; } public int B31; public int B32; public const int __ID__ = 11; public override int GetTypeId() => __ID__; public override void Serialize(ByteBuf _buf) { _buf.WriteInt(A1); _buf.WriteInt(A24); _buf.WriteInt(B31); _buf.WriteInt(B32); } public override void Deserialize(ByteBuf _buf) { A1 = _buf.ReadInt(); A24 = _buf.ReadInt(); B31 = _buf.ReadInt(); B32 = _buf.ReadInt(); } public override string ToString() { return "test.Child32{ " + "A1:" + A1 + "," + "A24:" + A24 + "," + "B31:" + B31 + "," + "B32:" + B32 + "," + "}"; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_CombineInstance_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_CombineInstance_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.CombineInstance constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_mesh(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.CombineInstance)Puerts.Utils.GetSelf((int)data, self); var result = obj.mesh; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_mesh(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.CombineInstance)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.mesh = argHelper.Get<UnityEngine.Mesh>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_subMeshIndex(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.CombineInstance)Puerts.Utils.GetSelf((int)data, self); var result = obj.subMeshIndex; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_subMeshIndex(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.CombineInstance)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.subMeshIndex = argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_transform(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.CombineInstance)Puerts.Utils.GetSelf((int)data, self); var result = obj.transform; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_transform(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.CombineInstance)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.transform = argHelper.Get<UnityEngine.Matrix4x4>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_lightmapScaleOffset(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.CombineInstance)Puerts.Utils.GetSelf((int)data, self); var result = obj.lightmapScaleOffset; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_lightmapScaleOffset(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.CombineInstance)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.lightmapScaleOffset = argHelper.Get<UnityEngine.Vector4>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_realtimeLightmapScaleOffset(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.CombineInstance)Puerts.Utils.GetSelf((int)data, self); var result = obj.realtimeLightmapScaleOffset; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_realtimeLightmapScaleOffset(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.CombineInstance)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.realtimeLightmapScaleOffset = argHelper.Get<UnityEngine.Vector4>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"mesh", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_mesh, Setter = S_mesh} }, {"subMeshIndex", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_subMeshIndex, Setter = S_subMeshIndex} }, {"transform", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_transform, Setter = S_transform} }, {"lightmapScaleOffset", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_lightmapScaleOffset, Setter = S_lightmapScaleOffset} }, {"realtimeLightmapScaleOffset", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_realtimeLightmapScaleOffset, Setter = S_realtimeLightmapScaleOffset} }, } }; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_GUIContent_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_GUIContent_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { if (paramLen == 0) { { var result = new UnityEngine.GUIContent(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.GUIContent), result); } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var result = new UnityEngine.GUIContent(Arg0); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.GUIContent), result); } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Texture>(false); var result = new UnityEngine.GUIContent(Arg0); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.GUIContent), result); } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIContent), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.GUIContent>(false); var result = new UnityEngine.GUIContent(Arg0); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.GUIContent), result); } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<UnityEngine.Texture>(false); var result = new UnityEngine.GUIContent(Arg0,Arg1); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.GUIContent), result); } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.GetString(false); var result = new UnityEngine.GUIContent(Arg0,Arg1); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.GUIContent), result); } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Texture>(false); var Arg1 = argHelper1.GetString(false); var result = new UnityEngine.GUIContent(Arg0,Arg1); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.GUIContent), result); } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<UnityEngine.Texture>(false); var Arg2 = argHelper2.GetString(false); var result = new UnityEngine.GUIContent(Arg0,Arg1,Arg2); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.GUIContent), result); } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.GUIContent constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_text(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUIContent; var result = obj.text; Puerts.PuertsDLL.ReturnString(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_text(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUIContent; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.text = argHelper.GetString(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_image(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUIContent; var result = obj.image; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_image(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUIContent; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.image = argHelper.Get<UnityEngine.Texture>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_tooltip(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUIContent; var result = obj.tooltip; Puerts.PuertsDLL.ReturnString(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_tooltip(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUIContent; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.tooltip = argHelper.GetString(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_none(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.GUIContent.none; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_none(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.GUIContent.none = argHelper.Get<UnityEngine.GUIContent>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"text", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_text, Setter = S_text} }, {"image", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_image, Setter = S_image} }, {"tooltip", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_tooltip, Setter = S_tooltip} }, {"none", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_none, Setter = S_none} }, } }; } } } <|start_filename|>Projects/Csharp_CustomTemplate_EncryptMemory/Gen/ai/UpdateDailyBehaviorProps.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using System; using Newtonsoft.Json; using Scripts; namespace cfg.ai { [Serializable] public partial class UpdateDailyBehaviorProps : AConfig { public string satiety_key { get; set; } public string energy_key { get; set; } public string mood_key { get; set; } public string satiety_lower_threshold_key { get; set; } public string satiety_upper_threshold_key { get; set; } public string energy_lower_threshold_key { get; set; } public string energy_upper_threshold_key { get; set; } public string mood_lower_threshold_key { get; set; } public string mood_upper_threshold_key { get; set; } public override void EndInit() { } public override string ToString() => JsonConvert.SerializeObject(this); } } <|start_filename|>Projects/DataTemplates/template_erlang/test_tbcompositejsontable2.erl<|end_filename|> %% test.TbCompositeJsonTable2 get(1) -> #{id => 1,y => 100}. get(3) -> #{id => 3,y => 300}. <|start_filename|>Projects/GenerateDatas/convert_lua/role.TbRoleLevelExpAttr/24.lua<|end_filename|> return { level = 24, need_exp = 8000, clothes_attrs = { 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, }, } <|start_filename|>Projects/GenerateDatas/convert_lua/role.TbRoleLevelExpAttr/15.lua<|end_filename|> return { level = 15, need_exp = 3500, clothes_attrs = { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, }, } <|start_filename|>Projects/Go_json/gen/src/cfg/blueprint.Clazz.go<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg import "errors" type BlueprintClazz struct { Name string Desc string Parents []interface{} Methods []interface{} } const TypeId_BlueprintClazz = 1691473693 func (*BlueprintClazz) GetTypeId() int32 { return 1691473693 } func (_v *BlueprintClazz)Deserialize(_buf map[string]interface{}) (err error) { { var _ok_ bool; if _v.Name, _ok_ = _buf["name"].(string); !_ok_ { err = errors.New("name error"); return } } { var _ok_ bool; if _v.Desc, _ok_ = _buf["desc"].(string); !_ok_ { err = errors.New("desc error"); return } } { var _arr_ []interface{} var _ok_ bool if _arr_, _ok_ = _buf["parents"].([]interface{}); !_ok_ { err = errors.New("parents error"); return } _v.Parents = make([]interface{}, 0, len(_arr_)) for _, _e_ := range _arr_ { var _list_v_ interface{} { var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _e_.(map[string]interface{}); !_ok_ { err = errors.New("_list_v_ error"); return }; if _list_v_, err = DeserializeBlueprintClazz(_x_); err != nil { return } } _v.Parents = append(_v.Parents, _list_v_) } } { var _arr_ []interface{} var _ok_ bool if _arr_, _ok_ = _buf["methods"].([]interface{}); !_ok_ { err = errors.New("methods error"); return } _v.Methods = make([]interface{}, 0, len(_arr_)) for _, _e_ := range _arr_ { var _list_v_ interface{} { var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _e_.(map[string]interface{}); !_ok_ { err = errors.New("_list_v_ error"); return }; if _list_v_, err = DeserializeBlueprintMethod(_x_); err != nil { return } } _v.Methods = append(_v.Methods, _list_v_) } } return } func DeserializeBlueprintClazz(_buf map[string]interface{}) (interface{}, error) { var id string var _ok_ bool if id, _ok_ = _buf["__type__"].(string) ; !_ok_ { return nil, errors.New("type id missing") } switch id { case "Interface": _v := &BlueprintInterface{}; if err := _v.Deserialize(_buf); err != nil { return nil, errors.New("blueprint.Interface") } else { return _v, nil } case "NormalClazz": _v := &BlueprintNormalClazz{}; if err := _v.Deserialize(_buf); err != nil { return nil, errors.New("blueprint.NormalClazz") } else { return _v, nil } case "EnumClazz": _v := &BlueprintEnumClazz{}; if err := _v.Deserialize(_buf); err != nil { return nil, errors.New("blueprint.EnumClazz") } else { return _v, nil } default: return nil, errors.New("unknown type id") } } <|start_filename|>Projects/GenerateDatas/convert_lua/role.TbRoleLevelExpAttr/65.lua<|end_filename|> return { level = 65, need_exp = 150000, clothes_attrs = { 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, }, } <|start_filename|>Projects/Csharp_DotNet5_json_ExportServer/Gen/bonus/Items.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; using System.Text.Json; namespace cfg.bonus { public sealed class Items : bonus.Bonus { public Items(JsonElement _json) : base(_json) { { var _json0 = _json.GetProperty("item_list"); int _n = _json0.GetArrayLength(); ItemList = new bonus.Item[_n]; int _index=0; foreach(JsonElement __e in _json0.EnumerateArray()) { bonus.Item __v; __v = bonus.Item.DeserializeItem(__e); ItemList[_index++] = __v; } } } public Items(bonus.Item[] item_list ) : base() { this.ItemList = item_list; } public static Items DeserializeItems(JsonElement _json) { return new bonus.Items(_json); } public bonus.Item[] ItemList { get; private set; } public const int __ID__ = 819736849; public override int GetTypeId() => __ID__; public override void Resolve(Dictionary<string, object> _tables) { base.Resolve(_tables); foreach(var _e in ItemList) { _e?.Resolve(_tables); } } public override void TranslateText(System.Func<string, string, string> translator) { base.TranslateText(translator); foreach(var _e in ItemList) { _e?.TranslateText(translator); } } public override string ToString() { return "{ " + "ItemList:" + Bright.Common.StringUtil.CollectionToString(ItemList) + "," + "}"; } } } <|start_filename|>DesignerConfigs/Datas/ai/blackboards/attack_or_patrol.lua<|end_filename|> return { name = "attack_or_patrol", desc ="demo hahaha", parent_name = "", keys = { {name="OriginPosition",desc="", is_static=false, type="VECTOR", type_class_name=""}, {name="TargetActor",desc="x2 haha", is_static=false, type="OBJECT", type_class_name=""}, {name="AcceptableRadius",desc="x3 haha", is_static=false, type="FLOAT", type_class_name=""}, {name="CurChooseSkillId",desc="x4 haha", is_static=false, type="INT", type_class_name=""}, }, } <|start_filename|>Projects/java_json/src/gen/cfg/mail/SystemMail.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.mail; import com.google.gson.JsonElement; import com.google.gson.JsonObject; public final class SystemMail { public SystemMail(JsonObject __json__) { id = __json__.get("id").getAsInt(); title = __json__.get("title").getAsString(); sender = __json__.get("sender").getAsString(); content = __json__.get("content").getAsString(); { com.google.gson.JsonArray _json0_ = __json__.get("award").getAsJsonArray(); award = new java.util.ArrayList<Integer>(_json0_.size()); for(JsonElement __e : _json0_) { int __v; __v = __e.getAsInt(); award.add(__v); } } } public SystemMail(int id, String title, String sender, String content, java.util.ArrayList<Integer> award ) { this.id = id; this.title = title; this.sender = sender; this.content = content; this.award = award; } public static SystemMail deserializeSystemMail(JsonObject __json__) { return new SystemMail(__json__); } public final int id; public final String title; public final String sender; public final String content; public final java.util.ArrayList<Integer> award; public void resolve(java.util.HashMap<String, Object> _tables) { } @Override public String toString() { return "{ " + "id:" + id + "," + "title:" + title + "," + "sender:" + sender + "," + "content:" + content + "," + "award:" + award + "," + "}"; } } <|start_filename|>Projects/GenerateDatas/convert_lua/role.TbRoleLevelExpAttr/85.lua<|end_filename|> return { level = 85, need_exp = 250000, clothes_attrs = { 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, }, } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_ArticulationDrive_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_ArticulationDrive_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.ArticulationDrive constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_lowerLimit(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ArticulationDrive)Puerts.Utils.GetSelf((int)data, self); var result = obj.lowerLimit; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_lowerLimit(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ArticulationDrive)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.lowerLimit = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_upperLimit(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ArticulationDrive)Puerts.Utils.GetSelf((int)data, self); var result = obj.upperLimit; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_upperLimit(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ArticulationDrive)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.upperLimit = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_stiffness(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ArticulationDrive)Puerts.Utils.GetSelf((int)data, self); var result = obj.stiffness; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_stiffness(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ArticulationDrive)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.stiffness = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_damping(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ArticulationDrive)Puerts.Utils.GetSelf((int)data, self); var result = obj.damping; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_damping(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ArticulationDrive)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.damping = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_forceLimit(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ArticulationDrive)Puerts.Utils.GetSelf((int)data, self); var result = obj.forceLimit; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_forceLimit(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ArticulationDrive)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.forceLimit = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_target(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ArticulationDrive)Puerts.Utils.GetSelf((int)data, self); var result = obj.target; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_target(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ArticulationDrive)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.target = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_targetVelocity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ArticulationDrive)Puerts.Utils.GetSelf((int)data, self); var result = obj.targetVelocity; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_targetVelocity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ArticulationDrive)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.targetVelocity = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"lowerLimit", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_lowerLimit, Setter = S_lowerLimit} }, {"upperLimit", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_upperLimit, Setter = S_upperLimit} }, {"stiffness", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_stiffness, Setter = S_stiffness} }, {"damping", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_damping, Setter = S_damping} }, {"forceLimit", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_forceLimit, Setter = S_forceLimit} }, {"target", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_target, Setter = S_target} }, {"targetVelocity", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_targetVelocity, Setter = S_targetVelocity} }, } }; } } } <|start_filename|>Projects/Java_bin/src/main/gen/cfg/test/MultiRowType3.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.test; import bright.serialization.*; public final class MultiRowType3 { public MultiRowType3(ByteBuf _buf) { id = _buf.readInt(); {int n = Math.min(_buf.readSize(), _buf.size());items = new java.util.ArrayList<cfg.test.MultiRowType1>(n);for(int i = 0 ; i < n ; i++) { cfg.test.MultiRowType1 _e; _e = new cfg.test.MultiRowType1(_buf); items.add(_e);}} } public MultiRowType3(int id, java.util.ArrayList<cfg.test.MultiRowType1> items ) { this.id = id; this.items = items; } public final int id; public final java.util.ArrayList<cfg.test.MultiRowType1> items; public void resolve(java.util.HashMap<String, Object> _tables) { for(cfg.test.MultiRowType1 _e : items) { if (_e != null) _e.resolve(_tables); } } @Override public String toString() { return "{ " + "id:" + id + "," + "items:" + items + "," + "}"; } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_ParticleSystem_ExternalForcesModule_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_ParticleSystem_ExternalForcesModule_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.ParticleSystem.ExternalForcesModule constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_IsAffectedBy(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ExternalForcesModule)Puerts.Utils.GetSelf((int)data, self); { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.ParticleSystemForceField>(false); var result = obj.IsAffectedBy(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_AddInfluence(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ExternalForcesModule)Puerts.Utils.GetSelf((int)data, self); { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.ParticleSystemForceField>(false); obj.AddInfluence(Arg0); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_RemoveInfluence(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ExternalForcesModule)Puerts.Utils.GetSelf((int)data, self); if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); obj.RemoveInfluence(Arg0); Puerts.Utils.SetSelf((int)data, self, obj); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.ParticleSystemForceField), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.ParticleSystemForceField>(false); obj.RemoveInfluence(Arg0); Puerts.Utils.SetSelf((int)data, self, obj); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to RemoveInfluence"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_RemoveAllInfluences(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ExternalForcesModule)Puerts.Utils.GetSelf((int)data, self); { { obj.RemoveAllInfluences(); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetInfluence(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ExternalForcesModule)Puerts.Utils.GetSelf((int)data, self); { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.ParticleSystemForceField>(false); obj.SetInfluence(Arg0,Arg1); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetInfluence(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ExternalForcesModule)Puerts.Utils.GetSelf((int)data, self); { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); var result = obj.GetInfluence(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_enabled(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ExternalForcesModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.enabled; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_enabled(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ExternalForcesModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.enabled = argHelper.GetBoolean(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_multiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ExternalForcesModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.multiplier; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_multiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ExternalForcesModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.multiplier = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_multiplierCurve(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ExternalForcesModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.multiplierCurve; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_multiplierCurve(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ExternalForcesModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.multiplierCurve = argHelper.Get<UnityEngine.ParticleSystem.MinMaxCurve>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_influenceFilter(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ExternalForcesModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.influenceFilter; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_influenceFilter(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ExternalForcesModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.influenceFilter = (UnityEngine.ParticleSystemGameObjectFilter)argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_influenceMask(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ExternalForcesModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.influenceMask; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_influenceMask(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ExternalForcesModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.influenceMask = argHelper.Get<UnityEngine.LayerMask>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_influenceCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ExternalForcesModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.influenceCount; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "IsAffectedBy", IsStatic = false}, M_IsAffectedBy }, { new Puerts.MethodKey {Name = "AddInfluence", IsStatic = false}, M_AddInfluence }, { new Puerts.MethodKey {Name = "RemoveInfluence", IsStatic = false}, M_RemoveInfluence }, { new Puerts.MethodKey {Name = "RemoveAllInfluences", IsStatic = false}, M_RemoveAllInfluences }, { new Puerts.MethodKey {Name = "SetInfluence", IsStatic = false}, M_SetInfluence }, { new Puerts.MethodKey {Name = "GetInfluence", IsStatic = false}, M_GetInfluence }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"enabled", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_enabled, Setter = S_enabled} }, {"multiplier", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_multiplier, Setter = S_multiplier} }, {"multiplierCurve", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_multiplierCurve, Setter = S_multiplierCurve} }, {"influenceFilter", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_influenceFilter, Setter = S_influenceFilter} }, {"influenceMask", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_influenceMask, Setter = S_influenceMask} }, {"influenceCount", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_influenceCount, Setter = null} }, } }; } } } <|start_filename|>Projects/Java_bin/src/main/gen/cfg/test/DemoD5.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.test; import bright.serialization.*; public final class DemoD5 extends cfg.test.DemoDynamic { public DemoD5(ByteBuf _buf) { super(_buf); time = new cfg.test.DateTimeRange(_buf); } public DemoD5(int x1, cfg.test.DateTimeRange time ) { super(x1); this.time = time; } public final cfg.test.DateTimeRange time; public static final int __ID__ = -2138341744; @Override public int getTypeId() { return __ID__; } @Override public void resolve(java.util.HashMap<String, Object> _tables) { super.resolve(_tables); if (time != null) {time.resolve(_tables);} } @Override public String toString() { return "{ " + "x1:" + x1 + "," + "time:" + time + "," + "}"; } } <|start_filename|>Projects/DataTemplates/template_erlang2/test_tbdemoprimitive.erl<|end_filename|> %% test.TbDemoPrimitive -module(test_tbdemoprimitive) -export([get/1,get_ids/0]) get(3) -> #{ x1 => false, x2 => 1, x3 => 2, x4 => 3, x5 => 4, x6 => 5, x7 => 6, s1 => "hello", s2 => 测试本地化字符串1, v2 => {"1","2"}, v3 => {"2","3","4"}, v4 => {"4","5","6","7"}, t1 => 946742700 }. get(4) -> #{ x1 => true, x2 => 1, x3 => 2, x4 => 4, x5 => 4, x6 => 5, x7 => 6, s1 => "world", s2 => 测试本地化字符串2, v2 => {"2","3"}, v3 => {"2.2","2.3","3.4"}, v4 => {"4.5","5.6","6.7","8.8"}, t1 => 946829099 }. get(5) -> #{ x1 => true, x2 => 1, x3 => 2, x4 => 5, x5 => 4, x6 => 5, x7 => 6, s1 => "nihao", s2 => 测试本地化字符串3, v2 => {"4","5"}, v3 => {"2.2","2.3","3.5"}, v4 => {"4.5","5.6","6.8","9.9"}, t1 => 946915499 }. get(6) -> #{ x1 => true, x2 => 1, x3 => 2, x4 => 6, x5 => 4, x6 => 5, x7 => 6, s1 => "shijie", s2 => 测试本地化字符串4, v2 => {"6","7"}, v3 => {"2.2","2.3","3.6"}, v4 => {"4.5","5.6","6.9","123"}, t1 => 947001899 }. get_ids() -> [3,4,5,6]. <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/item/Clothes.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.item { public sealed partial class Clothes : item.ItemExtra { public Clothes(ByteBuf _buf) : base(_buf) { Attack = _buf.ReadInt(); Hp = _buf.ReadLong(); EnergyLimit = _buf.ReadInt(); EnergyResume = _buf.ReadInt(); } public Clothes(int id, int attack, long hp, int energy_limit, int energy_resume ) : base(id) { this.Attack = attack; this.Hp = hp; this.EnergyLimit = energy_limit; this.EnergyResume = energy_resume; } public static Clothes DeserializeClothes(ByteBuf _buf) { return new item.Clothes(_buf); } public readonly int Attack; public readonly long Hp; public readonly int EnergyLimit; public readonly int EnergyResume; public const int ID = 1659907149; public override int GetTypeId() => ID; public override void Resolve(Dictionary<string, object> _tables) { base.Resolve(_tables); OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); public override string ToString() { return "{ " + "Id:" + Id + "," + "Attack:" + Attack + "," + "Hp:" + Hp + "," + "EnergyLimit:" + EnergyLimit + "," + "EnergyResume:" + EnergyResume + "," + "}"; } } } <|start_filename|>set_local_luban_server_envs.bat<|end_filename|> setx LUBAN_SERVER_IP 127.0.0.1 pause <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_UI_IClippable_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_UI_IClippable_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.UI.IClippable constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_RecalculateClipping(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.IClippable; { { obj.RecalculateClipping(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Cull(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.IClippable; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.GetBoolean(false); obj.Cull(Arg0,Arg1); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetClipRect(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.IClippable; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.GetBoolean(false); obj.SetClipRect(Arg0,Arg1); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetClipSoftness(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.IClippable; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); obj.SetClipSoftness(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_gameObject(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.IClippable; var result = obj.gameObject; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_rectTransform(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.IClippable; var result = obj.rectTransform; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "RecalculateClipping", IsStatic = false}, M_RecalculateClipping }, { new Puerts.MethodKey {Name = "Cull", IsStatic = false}, M_Cull }, { new Puerts.MethodKey {Name = "SetClipRect", IsStatic = false}, M_SetClipRect }, { new Puerts.MethodKey {Name = "SetClipSoftness", IsStatic = false}, M_SetClipSoftness }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"gameObject", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_gameObject, Setter = null} }, {"rectTransform", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_rectTransform, Setter = null} }, } }; } } } <|start_filename|>Projects/GenerateDatas/convert_lua/mail.TbSystemMail/11.lua<|end_filename|> return { id = 11, title = "测试1", sender = "系统", content = "测试内容1", award = { 1, }, } <|start_filename|>Projects/Lua_Unity_tolua_lua/Assets/Lua/Main.lua<|end_filename|> function Main() local types = require "Gen.Types" local tbItem = require "Data.item_TbItem" print("== load succ ==") end <|start_filename|>Projects/GenerateDatas/convert_lua/test.TbTestNull/10.lua<|end_filename|> return { id = 10, } <|start_filename|>Projects/DataTemplates/template_erlang2/test_tbmultiindexlist.erl<|end_filename|> %% test.TbMultiIndexList -module(test_tbmultiindexlist) -export([get/1,get_ids/0]) get() -> #{ id1 => 1, id2 => 1, id3 => "ab1", num => 1, desc => "desc1" }; get_ids() -> []. <|start_filename|>Projects/Java_bin/src/main/gen/cfg/test/CompositeJsonTable3.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.test; import bright.serialization.*; public final class CompositeJsonTable3 { public CompositeJsonTable3(ByteBuf _buf) { a = _buf.readInt(); b = _buf.readInt(); } public CompositeJsonTable3(int a, int b ) { this.a = a; this.b = b; } public final int a; public final int b; public void resolve(java.util.HashMap<String, Object> _tables) { } @Override public String toString() { return "{ " + "a:" + a + "," + "b:" + b + "," + "}"; } } <|start_filename|>Projects/Go_json/gen/src/cfg/test.DemoE1.go<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg import "errors" type TestDemoE1 struct { X1 int32 X3 int32 X4 int32 } const TypeId_TestDemoE1 = -2138341717 func (*TestDemoE1) GetTypeId() int32 { return -2138341717 } func (_v *TestDemoE1)Deserialize(_buf map[string]interface{}) (err error) { { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["x1"].(float64); !_ok_ { err = errors.New("x1 error"); return }; _v.X1 = int32(_tempNum_) } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["x3"].(float64); !_ok_ { err = errors.New("x3 error"); return }; _v.X3 = int32(_tempNum_) } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["x4"].(float64); !_ok_ { err = errors.New("x4 error"); return }; _v.X4 = int32(_tempNum_) } return } func DeserializeTestDemoE1(_buf map[string]interface{}) (*TestDemoE1, error) { v := &TestDemoE1{} if err := v.Deserialize(_buf); err == nil { return v, nil } else { return nil, err } } <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/item/Item.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.item { /// <summary> /// 道具 /// </summary> public sealed partial class Item : Bright.Config.BeanBase { public Item(ByteBuf _buf) { Id = _buf.ReadInt(); Name = _buf.ReadString(); MajorType = (item.EMajorType)_buf.ReadInt(); MinorType = (item.EMinorType)_buf.ReadInt(); MaxPileNum = _buf.ReadInt(); Quality = (item.EItemQuality)_buf.ReadInt(); Icon = _buf.ReadString(); IconBackgroud = _buf.ReadString(); IconMask = _buf.ReadString(); Desc = _buf.ReadString(); ShowOrder = _buf.ReadInt(); Quantifier = _buf.ReadString(); ShowInBag = _buf.ReadBool(); MinShowLevel = _buf.ReadInt(); BatchUsable = _buf.ReadBool(); ProgressTimeWhenUse = _buf.ReadFloat(); ShowHintWhenUse = _buf.ReadBool(); Droppable = _buf.ReadBool(); if(_buf.ReadBool()){ Price = _buf.ReadInt(); } else { Price = null; } UseType = (item.EUseType)_buf.ReadInt(); if(_buf.ReadBool()){ LevelUpId = _buf.ReadInt(); } else { LevelUpId = null; } } public Item(int id, string name, item.EMajorType major_type, item.EMinorType minor_type, int max_pile_num, item.EItemQuality quality, string icon, string icon_backgroud, string icon_mask, string desc, int show_order, string quantifier, bool show_in_bag, int min_show_level, bool batch_usable, float progress_time_when_use, bool show_hint_when_use, bool droppable, int? price, item.EUseType use_type, int? level_up_id ) { this.Id = id; this.Name = name; this.MajorType = major_type; this.MinorType = minor_type; this.MaxPileNum = max_pile_num; this.Quality = quality; this.Icon = icon; this.IconBackgroud = icon_backgroud; this.IconMask = icon_mask; this.Desc = desc; this.ShowOrder = show_order; this.Quantifier = quantifier; this.ShowInBag = show_in_bag; this.MinShowLevel = min_show_level; this.BatchUsable = batch_usable; this.ProgressTimeWhenUse = progress_time_when_use; this.ShowHintWhenUse = show_hint_when_use; this.Droppable = droppable; this.Price = price; this.UseType = use_type; this.LevelUpId = level_up_id; } public static Item DeserializeItem(ByteBuf _buf) { return new item.Item(_buf); } /// <summary> /// 道具id /// </summary> public readonly int Id; public readonly string Name; public readonly item.EMajorType MajorType; public readonly item.EMinorType MinorType; public readonly int MaxPileNum; public readonly item.EItemQuality Quality; public readonly string Icon; public readonly string IconBackgroud; public readonly string IconMask; public readonly string Desc; public readonly int ShowOrder; public readonly string Quantifier; public readonly bool ShowInBag; public readonly int MinShowLevel; public readonly bool BatchUsable; public readonly float ProgressTimeWhenUse; public readonly bool ShowHintWhenUse; public readonly bool Droppable; public readonly int? Price; public readonly item.EUseType UseType; public readonly int? LevelUpId; public const int ID = 2107285806; public override int GetTypeId() => ID; public void Resolve(Dictionary<string, object> _tables) { OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); public override string ToString() { return "{ " + "Id:" + Id + "," + "Name:" + Name + "," + "MajorType:" + MajorType + "," + "MinorType:" + MinorType + "," + "MaxPileNum:" + MaxPileNum + "," + "Quality:" + Quality + "," + "Icon:" + Icon + "," + "IconBackgroud:" + IconBackgroud + "," + "IconMask:" + IconMask + "," + "Desc:" + Desc + "," + "ShowOrder:" + ShowOrder + "," + "Quantifier:" + Quantifier + "," + "ShowInBag:" + ShowInBag + "," + "MinShowLevel:" + MinShowLevel + "," + "BatchUsable:" + BatchUsable + "," + "ProgressTimeWhenUse:" + ProgressTimeWhenUse + "," + "ShowHintWhenUse:" + ShowHintWhenUse + "," + "Droppable:" + Droppable + "," + "Price:" + Price + "," + "UseType:" + UseType + "," + "LevelUpId:" + LevelUpId + "," + "}"; } } } <|start_filename|>Projects/Go_json/gen/src/cfg/error.ErrorStyleTip.go<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg type ErrorErrorStyleTip struct { } const TypeId_ErrorErrorStyleTip = 1915239884 func (*ErrorErrorStyleTip) GetTypeId() int32 { return 1915239884 } func (_v *ErrorErrorStyleTip)Deserialize(_buf map[string]interface{}) (err error) { return } func DeserializeErrorErrorStyleTip(_buf map[string]interface{}) (*ErrorErrorStyleTip, error) { v := &ErrorErrorStyleTip{} if err := v.Deserialize(_buf); err == nil { return v, nil } else { return nil, err } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Main.cs<|end_filename|> using Puerts; using System.Collections; using System.Collections.Generic; using UnityEngine; public class Main : MonoBehaviour { // Start is called before the first frame update void Start() { var env = new JsEnv(new JsLoader(UnityEngine.Application.dataPath + "/../TsScripts/output")); env.Eval("const Main = require('./Main');"); } // Update is called once per frame void Update() { } } <|start_filename|>Projects/Java_bin/src/main/gen/cfg/test/DemoGroup.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.test; import bright.serialization.*; public final class DemoGroup { public DemoGroup(ByteBuf _buf) { id = _buf.readInt(); x1 = _buf.readInt(); x2 = _buf.readInt(); x3 = _buf.readInt(); x4 = _buf.readInt(); x5 = new cfg.test.InnerGroup(_buf); } public DemoGroup(int id, int x1, int x2, int x3, int x4, cfg.test.InnerGroup x5 ) { this.id = id; this.x1 = x1; this.x2 = x2; this.x3 = x3; this.x4 = x4; this.x5 = x5; } public final int id; public final int x1; public final int x2; public final int x3; public final int x4; public final cfg.test.InnerGroup x5; public void resolve(java.util.HashMap<String, Object> _tables) { if (x5 != null) {x5.resolve(_tables);} } @Override public String toString() { return "{ " + "id:" + id + "," + "x1:" + x1 + "," + "x2:" + x2 + "," + "x3:" + x3 + "," + "x4:" + x4 + "," + "x5:" + x5 + "," + "}"; } } <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/limit/DailyLimitBase.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.limit { public abstract partial class DailyLimitBase : limit.LimitBase { public DailyLimitBase(ByteBuf _buf) : base(_buf) { } public DailyLimitBase() : base() { } public static DailyLimitBase DeserializeDailyLimitBase(ByteBuf _buf) { switch (_buf.ReadInt()) { case limit.DailyLimit.ID: return new limit.DailyLimit(_buf); default: throw new SerializationException(); } } public override void Resolve(Dictionary<string, object> _tables) { base.Resolve(_tables); OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); public override string ToString() { return "{ " + "}"; } } } <|start_filename|>Projects/DataTemplates/template_lua2/item_tbitemextra.lua<|end_filename|> -- item.TbItemExtra return { [1022200001] = { id=1022200001, key_item_id=1022300001, open_level= { level=5, }, use_on_obtain=true, drop_ids= { 1, }, choose_list= { }, }, [1022300001] = { id=1022300001, open_level= { level=5, }, use_on_obtain=true, drop_ids= { }, choose_list= { }, }, [1010010003] = { id=1010010003, open_level= { level=6, }, use_on_obtain=true, drop_ids= { }, choose_list= { }, }, [1050010001] = { id=1050010001, open_level= { level=1, }, use_on_obtain=false, drop_ids= { 1, }, choose_list= { }, }, [1040010001] = { id=1040010001, holding_static_mesh="", holding_static_mesh_mat="", }, [1040020001] = { id=1040020001, holding_static_mesh="StaticMesh'/Game/X6GameData/Prototype/PrototypeAssets/StaticMesh/SM_Apple.SM_Apple'", holding_static_mesh_mat="MaterialInstanceConstant'/Game/X6GameData/Prototype/PrototypeAssets/Material/LD_Red.LD_Red'", }, [1040040001] = { id=1040040001, holding_static_mesh="StaticMesh'/Game/X6GameData/Prototype/PrototypeAssets/StaticMesh/SM_Ball.SM_Ball'", holding_static_mesh_mat="MaterialInstanceConstant'/Game/X6GameData/Prototype/PrototypeAssets/CustomizableGrid/Materials/Presets/M_Grid_preset_002.M_Grid_preset_002'", }, [1040040002] = { id=1040040002, holding_static_mesh="StaticMesh'/Game/X6GameData/Art_assets/Props/Prop_test/Interactive/PenQuanHua/SM_Penquanhua.SM_Penquanhua'", holding_static_mesh_mat="", }, [1040040003] = { id=1040040003, holding_static_mesh="StaticMesh'/Game/X6GameData/Prototype/PrototypeAssets/StaticMesh/SM_Apple.SM_Apple'", holding_static_mesh_mat="MaterialInstanceConstant'/Game/X6GameData/Art_assets/Props/Prop_test/Materials/Prop_Red_MI.Prop_Red_MI'", }, [1040210001] = { id=1040210001, attack_num=3, holding_static_mesh="", holding_static_mesh_mat="", }, [1040220001] = { id=1040220001, holding_static_mesh="", holding_static_mesh_mat="", }, [1040230001] = { id=1040230001, holding_static_mesh="", holding_static_mesh_mat="", }, [1040240001] = { id=1040240001, holding_static_mesh="", holding_static_mesh_mat="", }, [1040250001] = { id=1040250001, holding_static_mesh="", holding_static_mesh_mat="", }, [1040030001] = { id=1040030001, holding_static_mesh="", holding_static_mesh_mat="", }, [1020100001] = { id=1020100001, attack=100, hp=1000, energy_limit=5, energy_resume=1, }, [1020200001] = { id=1020200001, attack=100, hp=1000, energy_limit=5, energy_resume=1, }, [1020300001] = { id=1020300001, attack=100, hp=1000, energy_limit=5, energy_resume=1, }, [1110010005] = { id=1110010005, learn_component_id= { 1020400006, }, }, [1110010006] = { id=1110010006, learn_component_id= { 1020500003, }, }, [1110020001] = { id=1110020001, learn_component_id= { 1021009005, }, }, [1110020002] = { id=1110020002, learn_component_id= { 1022109005, }, }, [1110020003] = { id=1110020003, learn_component_id= { 1020409017, }, }, [1110020004] = { id=1110020004, learn_component_id= { 1021409017, }, }, [1110020005] = { id=1110020005, learn_component_id= { 1021300002, }, }, [1110020009] = { id=1110020009, learn_component_id= { 1020409024, }, }, [1110020010] = { id=1110020010, learn_component_id= { 1020509024, }, }, [1110020011] = { id=1110020011, learn_component_id= { 1020609024, }, }, [1110020012] = { id=1110020012, learn_component_id= { 1020809022, }, }, [1110020013] = { id=1110020013, learn_component_id= { 1020709024, }, }, [1110020014] = { id=1110020014, learn_component_id= { 1021009024, }, }, [1110020015] = { id=1110020015, learn_component_id= { 1021409024, }, }, [1110020016] = { id=1110020016, learn_component_id= { 1021309132, }, }, [1110020017] = { id=1110020017, learn_component_id= { 1020909132, }, }, [1110020018] = { id=1110020018, learn_component_id= { 1021500007, }, }, [1110020080] = { id=1110020080, learn_component_id= { 1021009132, }, }, } <|start_filename|>Projects/Csharp_CustomTemplate_EncryptMemory/Gen/item/ChooseOneBonus.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using System; using Newtonsoft.Json; using Scripts; namespace cfg.item { [Serializable] public partial class ChooseOneBonus : AConfig { [JsonProperty("drop_id")] private int _drop_id { get; set; } [JsonIgnore] public EncryptInt drop_id { get; private set; } = new(); public bool is_unique { get; set; } public override void EndInit() { drop_id = _drop_id; } public override string ToString() => JsonConvert.SerializeObject(this); } } <|start_filename|>Projects/Go_json/gen/src/cfg/test.CompositeJsonTable3.go<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg import "errors" type TestCompositeJsonTable3 struct { A int32 B int32 } const TypeId_TestCompositeJsonTable3 = 1566207896 func (*TestCompositeJsonTable3) GetTypeId() int32 { return 1566207896 } func (_v *TestCompositeJsonTable3)Deserialize(_buf map[string]interface{}) (err error) { { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["a"].(float64); !_ok_ { err = errors.New("a error"); return }; _v.A = int32(_tempNum_) } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["b"].(float64); !_ok_ { err = errors.New("b error"); return }; _v.B = int32(_tempNum_) } return } func DeserializeTestCompositeJsonTable3(_buf map[string]interface{}) (*TestCompositeJsonTable3, error) { v := &TestCompositeJsonTable3{} if err := v.Deserialize(_buf); err == nil { return v, nil } else { return nil, err } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_GUIUtility_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_GUIUtility_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.GUIUtility(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.GUIUtility), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetControlID(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = (UnityEngine.FocusType)argHelper1.GetInt32(false); var Arg2 = argHelper2.Get<UnityEngine.Rect>(false); var result = UnityEngine.GUIUtility.GetControlID(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIContent), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.GUIContent>(false); var Arg1 = (UnityEngine.FocusType)argHelper1.GetInt32(false); var Arg2 = argHelper2.Get<UnityEngine.Rect>(false); var result = UnityEngine.GUIUtility.GetControlID(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = (UnityEngine.FocusType)argHelper0.GetInt32(false); var result = UnityEngine.GUIUtility.GetControlID(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIContent), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.GUIContent>(false); var Arg1 = (UnityEngine.FocusType)argHelper1.GetInt32(false); var result = UnityEngine.GUIUtility.GetControlID(Arg0,Arg1); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false)) { var Arg0 = (UnityEngine.FocusType)argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.Rect>(false); var result = UnityEngine.GUIUtility.GetControlID(Arg0,Arg1); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = (UnityEngine.FocusType)argHelper1.GetInt32(false); var result = UnityEngine.GUIUtility.GetControlID(Arg0,Arg1); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetControlID"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_AlignRectToDevice(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, true, true) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, true, true)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.GetInt32(true); var Arg2 = argHelper2.GetInt32(true); var result = UnityEngine.GUIUtility.AlignRectToDevice(Arg0,out Arg1,out Arg2); argHelper1.SetByRefValue(Arg1); argHelper2.SetByRefValue(Arg2); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var result = UnityEngine.GUIUtility.AlignRectToDevice(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to AlignRectToDevice"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetStateObject(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<System.Type>(false); var Arg1 = argHelper1.GetInt32(false); var result = UnityEngine.GUIUtility.GetStateObject(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_QueryStateObject(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<System.Type>(false); var Arg1 = argHelper1.GetInt32(false); var result = UnityEngine.GUIUtility.QueryStateObject(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_ExitGUI(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { { UnityEngine.GUIUtility.ExitGUI(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GUIToScreenPoint(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var result = UnityEngine.GUIUtility.GUIToScreenPoint(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GUIToScreenRect(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var result = UnityEngine.GUIUtility.GUIToScreenRect(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_ScreenToGUIPoint(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var result = UnityEngine.GUIUtility.ScreenToGUIPoint(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_ScreenToGUIRect(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var result = UnityEngine.GUIUtility.ScreenToGUIRect(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_RotateAroundPivot(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); UnityEngine.GUIUtility.RotateAroundPivot(Arg0,Arg1); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_ScaleAroundPivot(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); UnityEngine.GUIUtility.ScaleAroundPivot(Arg0,Arg1); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_hasModalWindow(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.GUIUtility.hasModalWindow; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_systemCopyBuffer(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.GUIUtility.systemCopyBuffer; Puerts.PuertsDLL.ReturnString(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_systemCopyBuffer(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.GUIUtility.systemCopyBuffer = argHelper.GetString(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_hotControl(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.GUIUtility.hotControl; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_hotControl(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.GUIUtility.hotControl = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_keyboardControl(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.GUIUtility.keyboardControl; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_keyboardControl(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.GUIUtility.keyboardControl = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "GetControlID", IsStatic = true}, F_GetControlID }, { new Puerts.MethodKey {Name = "AlignRectToDevice", IsStatic = true}, F_AlignRectToDevice }, { new Puerts.MethodKey {Name = "GetStateObject", IsStatic = true}, F_GetStateObject }, { new Puerts.MethodKey {Name = "QueryStateObject", IsStatic = true}, F_QueryStateObject }, { new Puerts.MethodKey {Name = "ExitGUI", IsStatic = true}, F_ExitGUI }, { new Puerts.MethodKey {Name = "GUIToScreenPoint", IsStatic = true}, F_GUIToScreenPoint }, { new Puerts.MethodKey {Name = "GUIToScreenRect", IsStatic = true}, F_GUIToScreenRect }, { new Puerts.MethodKey {Name = "ScreenToGUIPoint", IsStatic = true}, F_ScreenToGUIPoint }, { new Puerts.MethodKey {Name = "ScreenToGUIRect", IsStatic = true}, F_ScreenToGUIRect }, { new Puerts.MethodKey {Name = "RotateAroundPivot", IsStatic = true}, F_RotateAroundPivot }, { new Puerts.MethodKey {Name = "ScaleAroundPivot", IsStatic = true}, F_ScaleAroundPivot }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"hasModalWindow", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_hasModalWindow, Setter = null} }, {"systemCopyBuffer", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_systemCopyBuffer, Setter = S_systemCopyBuffer} }, {"hotControl", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_hotControl, Setter = S_hotControl} }, {"keyboardControl", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_keyboardControl, Setter = S_keyboardControl} }, } }; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_UI_CanvasScaler_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_UI_CanvasScaler_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.UI.CanvasScaler constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_uiScaleMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.CanvasScaler; var result = obj.uiScaleMode; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_uiScaleMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.CanvasScaler; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.uiScaleMode = (UnityEngine.UI.CanvasScaler.ScaleMode)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_referencePixelsPerUnit(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.CanvasScaler; var result = obj.referencePixelsPerUnit; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_referencePixelsPerUnit(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.CanvasScaler; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.referencePixelsPerUnit = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_scaleFactor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.CanvasScaler; var result = obj.scaleFactor; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_scaleFactor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.CanvasScaler; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.scaleFactor = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_referenceResolution(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.CanvasScaler; var result = obj.referenceResolution; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_referenceResolution(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.CanvasScaler; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.referenceResolution = argHelper.Get<UnityEngine.Vector2>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_screenMatchMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.CanvasScaler; var result = obj.screenMatchMode; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_screenMatchMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.CanvasScaler; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.screenMatchMode = (UnityEngine.UI.CanvasScaler.ScreenMatchMode)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_matchWidthOrHeight(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.CanvasScaler; var result = obj.matchWidthOrHeight; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_matchWidthOrHeight(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.CanvasScaler; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.matchWidthOrHeight = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_physicalUnit(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.CanvasScaler; var result = obj.physicalUnit; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_physicalUnit(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.CanvasScaler; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.physicalUnit = (UnityEngine.UI.CanvasScaler.Unit)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_fallbackScreenDPI(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.CanvasScaler; var result = obj.fallbackScreenDPI; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_fallbackScreenDPI(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.CanvasScaler; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.fallbackScreenDPI = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_defaultSpriteDPI(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.CanvasScaler; var result = obj.defaultSpriteDPI; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_defaultSpriteDPI(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.CanvasScaler; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.defaultSpriteDPI = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_dynamicPixelsPerUnit(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.CanvasScaler; var result = obj.dynamicPixelsPerUnit; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_dynamicPixelsPerUnit(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.CanvasScaler; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.dynamicPixelsPerUnit = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"uiScaleMode", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_uiScaleMode, Setter = S_uiScaleMode} }, {"referencePixelsPerUnit", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_referencePixelsPerUnit, Setter = S_referencePixelsPerUnit} }, {"scaleFactor", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_scaleFactor, Setter = S_scaleFactor} }, {"referenceResolution", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_referenceResolution, Setter = S_referenceResolution} }, {"screenMatchMode", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_screenMatchMode, Setter = S_screenMatchMode} }, {"matchWidthOrHeight", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_matchWidthOrHeight, Setter = S_matchWidthOrHeight} }, {"physicalUnit", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_physicalUnit, Setter = S_physicalUnit} }, {"fallbackScreenDPI", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_fallbackScreenDPI, Setter = S_fallbackScreenDPI} }, {"defaultSpriteDPI", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_defaultSpriteDPI, Setter = S_defaultSpriteDPI} }, {"dynamicPixelsPerUnit", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_dynamicPixelsPerUnit, Setter = S_dynamicPixelsPerUnit} }, } }; } } } <|start_filename|>DesignerConfigs/Datas/test/test_null_datas/20.lua<|end_filename|> return { id=20, x1 = nil, x2 = nil, x3 = nil, x4 = nil, s1 = nil, s2 = nil, } <|start_filename|>Projects/GenerateDatas/convert_lua/item.TbItemExtra/1040210001.lua<|end_filename|> return { _name = 'InteractionItem', id = 1040210001, attack_num = 3, holding_static_mesh = "", holding_static_mesh_mat = "", } <|start_filename|>Projects/java_json/src/gen/cfg/test/MultiRowType3.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.test; import com.google.gson.JsonElement; import com.google.gson.JsonObject; public final class MultiRowType3 { public MultiRowType3(JsonObject __json__) { id = __json__.get("id").getAsInt(); { com.google.gson.JsonArray _json0_ = __json__.get("items").getAsJsonArray(); items = new java.util.ArrayList<cfg.test.MultiRowType1>(_json0_.size()); for(JsonElement __e : _json0_) { cfg.test.MultiRowType1 __v; __v = new cfg.test.MultiRowType1(__e.getAsJsonObject()); items.add(__v); } } } public MultiRowType3(int id, java.util.ArrayList<cfg.test.MultiRowType1> items ) { this.id = id; this.items = items; } public static MultiRowType3 deserializeMultiRowType3(JsonObject __json__) { return new MultiRowType3(__json__); } public final int id; public final java.util.ArrayList<cfg.test.MultiRowType1> items; public void resolve(java.util.HashMap<String, Object> _tables) { for(cfg.test.MultiRowType1 _e : items) { if (_e != null) _e.resolve(_tables); } } @Override public String toString() { return "{ " + "id:" + id + "," + "items:" + items + "," + "}"; } } <|start_filename|>ProtoProjects/go/gen/src/proto/test.EnumType.go<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package proto const ( TestEnumType_A = 1 TestEnumType_B = 3 ) <|start_filename|>Projects/DataTemplates/template_erlang2/test_tbmultirowrecord.erl<|end_filename|> %% test.TbMultiRowRecord -module(test_tbmultirowrecord) -export([get/1,get_ids/0]) get(1) -> #{ id => 1, name => "xxx", one_rows => array, multi_rows1 => array, multi_rows2 => array, multi_rows4 => map, multi_rows5 => array, multi_rows6 => map, multi_rows7 => map }. get(2) -> #{ id => 2, name => "xxx", one_rows => array, multi_rows1 => array, multi_rows2 => array, multi_rows4 => map, multi_rows5 => array, multi_rows6 => map, multi_rows7 => map }. get(3) -> #{ id => 3, name => "ds", one_rows => array, multi_rows1 => array, multi_rows2 => array, multi_rows4 => map, multi_rows5 => array, multi_rows6 => map, multi_rows7 => map }. get_ids() -> [1,2,3]. <|start_filename|>Projects/Java_bin/src/main/gen/cfg/test/TestRef.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.test; import bright.serialization.*; public final class TestRef { public TestRef(ByteBuf _buf) { id = _buf.readInt(); x1 = _buf.readInt(); x12 = _buf.readInt(); x2 = _buf.readInt(); {int n = Math.min(_buf.readSize(), _buf.size());a1 = new int[n];for(int i = 0 ; i < n ; i++) { int _e;_e = _buf.readInt(); a1[i] = _e;}} {int n = Math.min(_buf.readSize(), _buf.size());a2 = new int[n];for(int i = 0 ; i < n ; i++) { int _e;_e = _buf.readInt(); a2[i] = _e;}} {int n = Math.min(_buf.readSize(), _buf.size());b1 = new java.util.ArrayList<Integer>(n);for(int i = 0 ; i < n ; i++) { Integer _e; _e = _buf.readInt(); b1.add(_e);}} {int n = Math.min(_buf.readSize(), _buf.size());b2 = new java.util.ArrayList<Integer>(n);for(int i = 0 ; i < n ; i++) { Integer _e; _e = _buf.readInt(); b2.add(_e);}} {int n = Math.min(_buf.readSize(), _buf.size());c1 = new java.util.HashSet<Integer>(n * 3 / 2);for(int i = 0 ; i < n ; i++) { Integer _e; _e = _buf.readInt(); c1.add(_e);}} {int n = Math.min(_buf.readSize(), _buf.size());c2 = new java.util.HashSet<Integer>(n * 3 / 2);for(int i = 0 ; i < n ; i++) { Integer _e; _e = _buf.readInt(); c2.add(_e);}} {int n = Math.min(_buf.readSize(), _buf.size());d1 = new java.util.HashMap<Integer, Integer>(n * 3 / 2);for(int i = 0 ; i < n ; i++) { Integer _k; _k = _buf.readInt(); Integer _v; _v = _buf.readInt(); d1.put(_k, _v);}} {int n = Math.min(_buf.readSize(), _buf.size());d2 = new java.util.HashMap<Integer, Integer>(n * 3 / 2);for(int i = 0 ; i < n ; i++) { Integer _k; _k = _buf.readInt(); Integer _v; _v = _buf.readInt(); d2.put(_k, _v);}} e1 = _buf.readInt(); e2 = _buf.readLong(); e3 = _buf.readString(); f1 = _buf.readInt(); f2 = _buf.readLong(); f3 = _buf.readString(); } public TestRef(int id, int x1, int x1_2, int x2, int[] a1, int[] a2, java.util.ArrayList<Integer> b1, java.util.ArrayList<Integer> b2, java.util.HashSet<Integer> c1, java.util.HashSet<Integer> c2, java.util.HashMap<Integer, Integer> d1, java.util.HashMap<Integer, Integer> d2, int e1, long e2, String e3, int f1, long f2, String f3 ) { this.id = id; this.x1 = x1; this.x12 = x1_2; this.x2 = x2; this.a1 = a1; this.a2 = a2; this.b1 = b1; this.b2 = b2; this.c1 = c1; this.c2 = c2; this.d1 = d1; this.d2 = d2; this.e1 = e1; this.e2 = e2; this.e3 = e3; this.f1 = f1; this.f2 = f2; this.f3 = f3; } public final int id; public final int x1; public cfg.test.TestBeRef x1_Ref; public final int x12; public final int x2; public cfg.test.TestBeRef x2_Ref; public final int[] a1; public final int[] a2; public final java.util.ArrayList<Integer> b1; public final java.util.ArrayList<Integer> b2; public final java.util.HashSet<Integer> c1; public final java.util.HashSet<Integer> c2; public final java.util.HashMap<Integer, Integer> d1; public final java.util.HashMap<Integer, Integer> d2; public final int e1; public final long e2; public final String e3; public final int f1; public final long f2; public final String f3; public void resolve(java.util.HashMap<String, Object> _tables) { this.x1_Ref = ((cfg.test.TbTestBeRef)_tables.get("test.TbTestBeRef")).get(x1); this.x2_Ref = ((cfg.test.TbTestBeRef)_tables.get("test.TbTestBeRef")).get(x2); } @Override public String toString() { return "{ " + "id:" + id + "," + "x1:" + x1 + "," + "x12:" + x12 + "," + "x2:" + x2 + "," + "a1:" + a1 + "," + "a2:" + a2 + "," + "b1:" + b1 + "," + "b2:" + b2 + "," + "c1:" + c1 + "," + "c2:" + c2 + "," + "d1:" + d1 + "," + "d2:" + d2 + "," + "e1:" + e1 + "," + "e2:" + e2 + "," + "e3:" + e3 + "," + "f1:" + f1 + "," + "f2:" + f2 + "," + "f3:" + f3 + "," + "}"; } } <|start_filename|>Projects/CfgValidator/Modules/Role.cs<|end_filename|> using cfg.item; using Microsoft.VisualStudio.TestTools.UnitTesting; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading; namespace CfgCheck.Modules { [TestClass] public class Role { [TestMethod] public void Check_LevelConsequence() { int curLevel = 0; foreach (var cfgLevel in ConfigSetUp.Configs.TbRoleLevelExpAttr.DataList) { ++curLevel; Assert.AreEqual(curLevel, cfgLevel.Level, "等级定义不连续"); } } [TestMethod] public void Check_DropBonusItem_ShouldAllBeContainedInLevelCoefficientBonus() { var CoefficientDropBonus = ConfigSetUp.Configs.TbDrop.DataList; foreach (var dropItem in CoefficientDropBonus) { var curBonus = dropItem.Bonus; if (curBonus is cfg.bonus.CoefficientItem c) { var bonusId = c.BonusId; var bonusList = c.BonusList; var dropTypeSet = bonusList.ItemList.Select(c => c.ItemId).Distinct(); var levelBonusCoefficientCfg = ConfigSetUp.Configs.TbRoleLevelBonusCoefficient.Get(bonusId).DistinctBonusInfos; var bonusTypeSet = levelBonusCoefficientCfg.SelectMany(c => c.BonusInfo).Select(c => (int)c.Type).Distinct(); foreach (var item in dropTypeSet) { Assert.IsTrue(bonusTypeSet.Contains(item), $"类型{ConfigSetUp.Configs.TbItem.Get(item).MinorType} 没有在等级系数表里配置 等级系数奖励编号: {bonusId}"); } } } } } } <|start_filename|>Projects/Lua_Unity_xlua_lua/Assets/Lua/Gen/TbItemFunc.lua<|end_filename|> return { [401] = {minor_type=401,func_type=0,method='使用',close_bag_ui=true,}, [1102] = {minor_type=1102,func_type=1,method='使用',close_bag_ui=false,}, } <|start_filename|>Projects/DataTemplates/template_json/blueprint_tbclazz.json<|end_filename|> { "int": { "_name":"NormalClazz","name":"int","desc":"primity type:int","parents":[],"methods":[],"is_abstract":false,"fields":[]} } <|start_filename|>Projects/GenerateDatas/convert_lua/item.TbItemExtra/1110020013.lua<|end_filename|> return { _name = 'DesignDrawing', id = 1110020013, learn_component_id = { 1020709024, }, } <|start_filename|>Projects/GenerateDatas/convert_lua/test.TbTestNull/3.lua<|end_filename|> return { id = 3, s1 = "", s2 = {key='',text=""}, } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_GUITargetAttribute_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_GUITargetAttribute_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { if (paramLen == 0) { { var result = new UnityEngine.GUITargetAttribute(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.GUITargetAttribute), result); } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var result = new UnityEngine.GUITargetAttribute(Arg0); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.GUITargetAttribute), result); } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var result = new UnityEngine.GUITargetAttribute(Arg0,Arg1); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.GUITargetAttribute), result); } } if (paramLen >= 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(int), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetParams<int>(info, 2, paramLen); var result = new UnityEngine.GUITargetAttribute(Arg0,Arg1,Arg2); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.GUITargetAttribute), result); } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.GUITargetAttribute constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { } }; } } } <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/item/InteractionItem.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.item { public sealed partial class InteractionItem : item.ItemExtra { public InteractionItem(ByteBuf _buf) : base(_buf) { if(_buf.ReadBool()){ AttackNum = _buf.ReadInt(); } else { AttackNum = null; } HoldingStaticMesh = _buf.ReadString(); HoldingStaticMeshMat = _buf.ReadString(); } public InteractionItem(int id, int? attack_num, string holding_static_mesh, string holding_static_mesh_mat ) : base(id) { this.AttackNum = attack_num; this.HoldingStaticMesh = holding_static_mesh; this.HoldingStaticMeshMat = holding_static_mesh_mat; } public static InteractionItem DeserializeInteractionItem(ByteBuf _buf) { return new item.InteractionItem(_buf); } public readonly int? AttackNum; public readonly string HoldingStaticMesh; public readonly string HoldingStaticMeshMat; public const int ID = 640937802; public override int GetTypeId() => ID; public override void Resolve(Dictionary<string, object> _tables) { base.Resolve(_tables); OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); public override string ToString() { return "{ " + "Id:" + Id + "," + "AttackNum:" + AttackNum + "," + "HoldingStaticMesh:" + HoldingStaticMesh + "," + "HoldingStaticMeshMat:" + HoldingStaticMeshMat + "," + "}"; } } } <|start_filename|>Projects/Csharp_CustomTemplate_EncryptMemory/Gen/mail/SystemMail.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using System; using Newtonsoft.Json; using Scripts; namespace cfg.mail { [Serializable] public partial class SystemMail : AConfig { public string title { get; set; } public string sender { get; set; } public string content { get; set; } public System.Collections.Generic.List<int> award { get; set; } public override void EndInit() { } public override string ToString() => JsonConvert.SerializeObject(this); } } <|start_filename|>Projects/java_json/src/gen/cfg/test/DemoPrimitiveTypesTable.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.test; import com.google.gson.JsonElement; import com.google.gson.JsonObject; public final class DemoPrimitiveTypesTable { public DemoPrimitiveTypesTable(JsonObject __json__) { x1 = __json__.get("x1").getAsBoolean(); x2 = __json__.get("x2").getAsByte(); x3 = __json__.get("x3").getAsShort(); x4 = __json__.get("x4").getAsInt(); x5 = __json__.get("x5").getAsLong(); x6 = __json__.get("x6").getAsFloat(); x7 = __json__.get("x7").getAsDouble(); s1 = __json__.get("s1").getAsString(); __json__.get("s2").getAsJsonObject().get("key").getAsString(); s2 = __json__.get("s2").getAsJsonObject().get("text").getAsString(); { com.google.gson.JsonObject _json0_ = __json__.get("v2").getAsJsonObject(); float __x; __x = _json0_.get("x").getAsFloat(); float __y; __y = _json0_.get("y").getAsFloat(); v2 = new bright.math.Vector2(__x, __y); } { com.google.gson.JsonObject _json0_ = __json__.get("v3").getAsJsonObject(); float __x; __x = _json0_.get("x").getAsFloat(); float __y; __y = _json0_.get("y").getAsFloat(); float __z; __z = _json0_.get("z").getAsFloat(); v3 = new bright.math.Vector3(__x, __y,__z); } { com.google.gson.JsonObject _json0_ = __json__.get("v4").getAsJsonObject(); float __x; __x = _json0_.get("x").getAsFloat(); float __y; __y = _json0_.get("y").getAsFloat(); float __z; __z = _json0_.get("z").getAsFloat(); float __w; __w = _json0_.get("w").getAsFloat(); v4 = new bright.math.Vector4(__x, __y, __z, __w); } t1 = __json__.get("t1").getAsInt(); } public DemoPrimitiveTypesTable(boolean x1, byte x2, short x3, int x4, long x5, float x6, double x7, String s1, String s2, bright.math.Vector2 v2, bright.math.Vector3 v3, bright.math.Vector4 v4, int t1 ) { this.x1 = x1; this.x2 = x2; this.x3 = x3; this.x4 = x4; this.x5 = x5; this.x6 = x6; this.x7 = x7; this.s1 = s1; this.s2 = s2; this.v2 = v2; this.v3 = v3; this.v4 = v4; this.t1 = t1; } public static DemoPrimitiveTypesTable deserializeDemoPrimitiveTypesTable(JsonObject __json__) { return new DemoPrimitiveTypesTable(__json__); } public final boolean x1; public final byte x2; public final short x3; public final int x4; public final long x5; public final float x6; public final double x7; public final String s1; public final String s2; public final bright.math.Vector2 v2; public final bright.math.Vector3 v3; public final bright.math.Vector4 v4; public final int t1; public void resolve(java.util.HashMap<String, Object> _tables) { } @Override public String toString() { return "{ " + "x1:" + x1 + "," + "x2:" + x2 + "," + "x3:" + x3 + "," + "x4:" + x4 + "," + "x5:" + x5 + "," + "x6:" + x6 + "," + "x7:" + x7 + "," + "s1:" + s1 + "," + "s2:" + s2 + "," + "v2:" + v2 + "," + "v3:" + v3 + "," + "v4:" + v4 + "," + "t1:" + t1 + "," + "}"; } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_UI_Dropdown_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_UI_Dropdown_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.UI.Dropdown constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetValueWithoutNotify(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Dropdown; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); obj.SetValueWithoutNotify(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_RefreshShownValue(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Dropdown; { { obj.RefreshShownValue(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_AddOptions(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Dropdown; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.UI.Dropdown.OptionData>), false, false)) { var Arg0 = argHelper0.Get<System.Collections.Generic.List<UnityEngine.UI.Dropdown.OptionData>>(false); obj.AddOptions(Arg0); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<string>), false, false)) { var Arg0 = argHelper0.Get<System.Collections.Generic.List<string>>(false); obj.AddOptions(Arg0); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Sprite>), false, false)) { var Arg0 = argHelper0.Get<System.Collections.Generic.List<UnityEngine.Sprite>>(false); obj.AddOptions(Arg0); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to AddOptions"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ClearOptions(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Dropdown; { { obj.ClearOptions(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_OnPointerClick(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Dropdown; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.EventSystems.PointerEventData>(false); obj.OnPointerClick(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_OnSubmit(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Dropdown; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.EventSystems.BaseEventData>(false); obj.OnSubmit(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_OnCancel(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Dropdown; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.EventSystems.BaseEventData>(false); obj.OnCancel(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Show(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Dropdown; { { obj.Show(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Hide(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Dropdown; { { obj.Hide(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_template(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Dropdown; var result = obj.template; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_template(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Dropdown; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.template = argHelper.Get<UnityEngine.RectTransform>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_captionText(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Dropdown; var result = obj.captionText; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_captionText(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Dropdown; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.captionText = argHelper.Get<UnityEngine.UI.Text>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_captionImage(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Dropdown; var result = obj.captionImage; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_captionImage(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Dropdown; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.captionImage = argHelper.Get<UnityEngine.UI.Image>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_itemText(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Dropdown; var result = obj.itemText; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_itemText(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Dropdown; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.itemText = argHelper.Get<UnityEngine.UI.Text>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_itemImage(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Dropdown; var result = obj.itemImage; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_itemImage(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Dropdown; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.itemImage = argHelper.Get<UnityEngine.UI.Image>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_options(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Dropdown; var result = obj.options; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_options(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Dropdown; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.options = argHelper.Get<System.Collections.Generic.List<UnityEngine.UI.Dropdown.OptionData>>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_onValueChanged(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Dropdown; var result = obj.onValueChanged; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_onValueChanged(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Dropdown; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.onValueChanged = argHelper.Get<UnityEngine.UI.Dropdown.DropdownEvent>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_alphaFadeSpeed(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Dropdown; var result = obj.alphaFadeSpeed; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_alphaFadeSpeed(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Dropdown; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.alphaFadeSpeed = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_value(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Dropdown; var result = obj.value; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_value(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Dropdown; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.value = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "SetValueWithoutNotify", IsStatic = false}, M_SetValueWithoutNotify }, { new Puerts.MethodKey {Name = "RefreshShownValue", IsStatic = false}, M_RefreshShownValue }, { new Puerts.MethodKey {Name = "AddOptions", IsStatic = false}, M_AddOptions }, { new Puerts.MethodKey {Name = "ClearOptions", IsStatic = false}, M_ClearOptions }, { new Puerts.MethodKey {Name = "OnPointerClick", IsStatic = false}, M_OnPointerClick }, { new Puerts.MethodKey {Name = "OnSubmit", IsStatic = false}, M_OnSubmit }, { new Puerts.MethodKey {Name = "OnCancel", IsStatic = false}, M_OnCancel }, { new Puerts.MethodKey {Name = "Show", IsStatic = false}, M_Show }, { new Puerts.MethodKey {Name = "Hide", IsStatic = false}, M_Hide }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"template", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_template, Setter = S_template} }, {"captionText", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_captionText, Setter = S_captionText} }, {"captionImage", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_captionImage, Setter = S_captionImage} }, {"itemText", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_itemText, Setter = S_itemText} }, {"itemImage", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_itemImage, Setter = S_itemImage} }, {"options", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_options, Setter = S_options} }, {"onValueChanged", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_onValueChanged, Setter = S_onValueChanged} }, {"alphaFadeSpeed", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_alphaFadeSpeed, Setter = S_alphaFadeSpeed} }, {"value", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_value, Setter = S_value} }, } }; } } } <|start_filename|>Projects/GenerateDatas/convert_lua/test.TbDetectCsvEncoding/11.lua<|end_filename|> return { id = 11, name = "测试编码", } <|start_filename|>Projects/Csharp_CustomTemplate_EncryptMemory/Gen/condition/MinMaxLevel.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using System; using Newtonsoft.Json; using Scripts; namespace cfg.condition { [Serializable] public partial class MinMaxLevel : AConfig { [JsonProperty("min")] private int _min { get; set; } [JsonIgnore] public EncryptInt min { get; private set; } = new(); [JsonProperty("max")] private int _max { get; set; } [JsonIgnore] public EncryptInt max { get; private set; } = new(); public override void EndInit() { min = _min; max = _max; } public override string ToString() => JsonConvert.SerializeObject(this); } } <|start_filename|>Projects/GenerateDatas/convert_lua/tag.TbTestTag/12.lua<|end_filename|> return { id = 12, value = "导出", } <|start_filename|>Projects/java_json/src/gen/cfg/test/TestIndex.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.test; import com.google.gson.JsonElement; import com.google.gson.JsonObject; public final class TestIndex { public TestIndex(JsonObject __json__) { id = __json__.get("id").getAsInt(); { com.google.gson.JsonArray _json0_ = __json__.get("eles").getAsJsonArray(); eles = new java.util.ArrayList<cfg.test.DemoType1>(_json0_.size()); for(JsonElement __e : _json0_) { cfg.test.DemoType1 __v; __v = new cfg.test.DemoType1(__e.getAsJsonObject()); eles.add(__v); } } } public TestIndex(int id, java.util.ArrayList<cfg.test.DemoType1> eles ) { this.id = id; this.eles = eles; } public static TestIndex deserializeTestIndex(JsonObject __json__) { return new TestIndex(__json__); } public final int id; public final java.util.ArrayList<cfg.test.DemoType1> eles; public void resolve(java.util.HashMap<String, Object> _tables) { for(cfg.test.DemoType1 _e : eles) { if (_e != null) _e.resolve(_tables); } } @Override public String toString() { return "{ " + "id:" + id + "," + "eles:" + eles + "," + "}"; } } <|start_filename|>Projects/java_json/src/gen/cfg/error/ErrorStyle.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.error; import com.google.gson.JsonElement; import com.google.gson.JsonObject; public abstract class ErrorStyle { public ErrorStyle(JsonObject __json__) { } public ErrorStyle() { } public static ErrorStyle deserializeErrorStyle(JsonObject __json__) { switch (__json__.get("__type__").getAsString()) { case "ErrorStyleTip": return new cfg.error.ErrorStyleTip(__json__); case "ErrorStyleMsgbox": return new cfg.error.ErrorStyleMsgbox(__json__); case "ErrorStyleDlgOk": return new cfg.error.ErrorStyleDlgOk(__json__); case "ErrorStyleDlgOkCancel": return new cfg.error.ErrorStyleDlgOkCancel(__json__); default: throw new bright.serialization.SerializationException(); } } public abstract int getTypeId(); public void resolve(java.util.HashMap<String, Object> _tables) { } @Override public String toString() { return "{ " + "}"; } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_DynamicGI_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_DynamicGI_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.DynamicGI(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.DynamicGI), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_SetEmissive(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<UnityEngine.Renderer>(false); var Arg1 = argHelper1.Get<UnityEngine.Color>(false); UnityEngine.DynamicGI.SetEmissive(Arg0,Arg1); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_SetEnvironmentData(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<float[]>(false); UnityEngine.DynamicGI.SetEnvironmentData(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_UpdateEnvironment(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { { UnityEngine.DynamicGI.UpdateEnvironment(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_indirectScale(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.DynamicGI.indirectScale; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_indirectScale(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.DynamicGI.indirectScale = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_updateThreshold(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.DynamicGI.updateThreshold; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_updateThreshold(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.DynamicGI.updateThreshold = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_materialUpdateTimeSlice(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.DynamicGI.materialUpdateTimeSlice; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_materialUpdateTimeSlice(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.DynamicGI.materialUpdateTimeSlice = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_synchronousMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.DynamicGI.synchronousMode; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_synchronousMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.DynamicGI.synchronousMode = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_isConverged(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.DynamicGI.isConverged; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "SetEmissive", IsStatic = true}, F_SetEmissive }, { new Puerts.MethodKey {Name = "SetEnvironmentData", IsStatic = true}, F_SetEnvironmentData }, { new Puerts.MethodKey {Name = "UpdateEnvironment", IsStatic = true}, F_UpdateEnvironment }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"indirectScale", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_indirectScale, Setter = S_indirectScale} }, {"updateThreshold", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_updateThreshold, Setter = S_updateThreshold} }, {"materialUpdateTimeSlice", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_materialUpdateTimeSlice, Setter = S_materialUpdateTimeSlice} }, {"synchronousMode", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_synchronousMode, Setter = S_synchronousMode} }, {"isConverged", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_isConverged, Setter = null} }, } }; } } } <|start_filename|>Projects/Go_json/gen/src/cfg/ai.Decorator.go<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg import "errors" type AiDecorator struct { Id int32 NodeName string FlowAbortMode int32 } const TypeId_AiDecorator = 2017109461 func (*AiDecorator) GetTypeId() int32 { return 2017109461 } func (_v *AiDecorator)Deserialize(_buf map[string]interface{}) (err error) { { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["id"].(float64); !_ok_ { err = errors.New("id error"); return }; _v.Id = int32(_tempNum_) } { var _ok_ bool; if _v.NodeName, _ok_ = _buf["node_name"].(string); !_ok_ { err = errors.New("node_name error"); return } } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["flow_abort_mode"].(float64); !_ok_ { err = errors.New("flow_abort_mode error"); return }; _v.FlowAbortMode = int32(_tempNum_) } return } func DeserializeAiDecorator(_buf map[string]interface{}) (interface{}, error) { var id string var _ok_ bool if id, _ok_ = _buf["__type__"].(string) ; !_ok_ { return nil, errors.New("type id missing") } switch id { case "UeLoop": _v := &AiUeLoop{}; if err := _v.Deserialize(_buf); err != nil { return nil, errors.New("ai.UeLoop") } else { return _v, nil } case "UeCooldown": _v := &AiUeCooldown{}; if err := _v.Deserialize(_buf); err != nil { return nil, errors.New("ai.UeCooldown") } else { return _v, nil } case "UeTimeLimit": _v := &AiUeTimeLimit{}; if err := _v.Deserialize(_buf); err != nil { return nil, errors.New("ai.UeTimeLimit") } else { return _v, nil } case "UeBlackboard": _v := &AiUeBlackboard{}; if err := _v.Deserialize(_buf); err != nil { return nil, errors.New("ai.UeBlackboard") } else { return _v, nil } case "UeForceSuccess": _v := &AiUeForceSuccess{}; if err := _v.Deserialize(_buf); err != nil { return nil, errors.New("ai.UeForceSuccess") } else { return _v, nil } case "IsAtLocation": _v := &AiIsAtLocation{}; if err := _v.Deserialize(_buf); err != nil { return nil, errors.New("ai.IsAtLocation") } else { return _v, nil } case "DistanceLessThan": _v := &AiDistanceLessThan{}; if err := _v.Deserialize(_buf); err != nil { return nil, errors.New("ai.DistanceLessThan") } else { return _v, nil } default: return nil, errors.New("unknown type id") } } <|start_filename|>Projects/GenerateDatas/convert_lua/test.TbSingleton/1.lua<|end_filename|> return { id = 5, name = {key='key_name',text="aabbcc"}, date = { _name = 'DemoD5', x1 = 1, time = { start_time = 1982-8-24 00:00:00, end_time = 1999-9-9 00:00:00, }, }, } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_Joint2D_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_Joint2D_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.Joint2D(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.Joint2D), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetReactionForce(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Joint2D; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetFloat(false); var result = obj.GetReactionForce(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetReactionTorque(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Joint2D; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetFloat(false); var result = obj.GetReactionTorque(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_attachedRigidbody(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Joint2D; var result = obj.attachedRigidbody; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_connectedBody(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Joint2D; var result = obj.connectedBody; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_connectedBody(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Joint2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.connectedBody = argHelper.Get<UnityEngine.Rigidbody2D>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_enableCollision(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Joint2D; var result = obj.enableCollision; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_enableCollision(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Joint2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.enableCollision = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_breakForce(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Joint2D; var result = obj.breakForce; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_breakForce(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Joint2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.breakForce = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_breakTorque(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Joint2D; var result = obj.breakTorque; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_breakTorque(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Joint2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.breakTorque = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_reactionForce(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Joint2D; var result = obj.reactionForce; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_reactionTorque(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Joint2D; var result = obj.reactionTorque; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "GetReactionForce", IsStatic = false}, M_GetReactionForce }, { new Puerts.MethodKey {Name = "GetReactionTorque", IsStatic = false}, M_GetReactionTorque }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"attachedRigidbody", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_attachedRigidbody, Setter = null} }, {"connectedBody", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_connectedBody, Setter = S_connectedBody} }, {"enableCollision", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_enableCollision, Setter = S_enableCollision} }, {"breakForce", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_breakForce, Setter = S_breakForce} }, {"breakTorque", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_breakTorque, Setter = S_breakTorque} }, {"reactionForce", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_reactionForce, Setter = null} }, {"reactionTorque", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_reactionTorque, Setter = null} }, } }; } } } <|start_filename|>Projects/DataTemplates/template_erlang2/test_tbdefinefromexcelone.erl<|end_filename|> %% test.TbDefineFromExcelOne -module(test_tbdefinefromexcelone) -export([get/1,get_ids/0]) get() -> #{ unlock_equip => 10, unlock_hero => 20, default_avatar => "Assets/Icon/DefaultAvatar.png", default_item => "Assets/Icon/DefaultAvatar.png" }; get_ids() -> []. <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_PhysicsScene_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_PhysicsScene_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.PhysicsScene constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ToString(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.PhysicsScene)Puerts.Utils.GetSelf((int)data, self); { { var result = obj.ToString(); Puerts.PuertsDLL.ReturnString(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetHashCode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.PhysicsScene)Puerts.Utils.GetSelf((int)data, self); { { var result = obj.GetHashCode(); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Equals(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.PhysicsScene)Puerts.Utils.GetSelf((int)data, self); if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.Any, typeof(System.Object), false, false)) { var Arg0 = argHelper0.Get<System.Object>(false); var result = obj.Equals(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.PhysicsScene), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.PhysicsScene>(false); var result = obj.Equals(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to Equals"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_IsValid(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.PhysicsScene)Puerts.Utils.GetSelf((int)data, self); { { var result = obj.IsValid(); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_IsEmpty(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.PhysicsScene)Puerts.Utils.GetSelf((int)data, self); { { var result = obj.IsEmpty(); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Simulate(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.PhysicsScene)Puerts.Utils.GetSelf((int)data, self); { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetFloat(false); obj.Simulate(Arg0); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Raycast(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.PhysicsScene)Puerts.Utils.GetSelf((int)data, self); if (paramLen == 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3>(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.GetInt32(false); var Arg4 = (UnityEngine.QueryTriggerInteraction)argHelper4.GetInt32(false); var result = obj.Raycast(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit), true, true) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3>(false); var Arg2 = argHelper2.Get<UnityEngine.RaycastHit>(true); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.GetInt32(false); var result = obj.Raycast(Arg0,Arg1,out Arg2,Arg3,Arg4); argHelper2.SetByRefValue(Arg2); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit[]), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3>(false); var Arg2 = argHelper2.Get<UnityEngine.RaycastHit[]>(false); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.GetInt32(false); var result = obj.Raycast(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3>(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.GetInt32(false); var result = obj.Raycast(Arg0,Arg1,Arg2,Arg3); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit), true, true) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3>(false); var Arg2 = argHelper2.Get<UnityEngine.RaycastHit>(true); var Arg3 = argHelper3.GetFloat(false); var result = obj.Raycast(Arg0,Arg1,out Arg2,Arg3); argHelper2.SetByRefValue(Arg2); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit[]), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3>(false); var Arg2 = argHelper2.Get<UnityEngine.RaycastHit[]>(false); var Arg3 = argHelper3.GetFloat(false); var result = obj.Raycast(Arg0,Arg1,Arg2,Arg3); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3>(false); var Arg2 = argHelper2.GetFloat(false); var result = obj.Raycast(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit), true, true)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3>(false); var Arg2 = argHelper2.Get<UnityEngine.RaycastHit>(true); var result = obj.Raycast(Arg0,Arg1,out Arg2); argHelper2.SetByRefValue(Arg2); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3>(false); var Arg2 = argHelper2.Get<UnityEngine.RaycastHit[]>(false); var result = obj.Raycast(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3>(false); var result = obj.Raycast(Arg0,Arg1); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } if (paramLen == 6) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit), true, true) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3>(false); var Arg2 = argHelper2.Get<UnityEngine.RaycastHit>(true); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.GetInt32(false); var Arg5 = (UnityEngine.QueryTriggerInteraction)argHelper5.GetInt32(false); var result = obj.Raycast(Arg0,Arg1,out Arg2,Arg3,Arg4,Arg5); argHelper2.SetByRefValue(Arg2); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit[]), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3>(false); var Arg2 = argHelper2.Get<UnityEngine.RaycastHit[]>(false); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.GetInt32(false); var Arg5 = (UnityEngine.QueryTriggerInteraction)argHelper5.GetInt32(false); var result = obj.Raycast(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to Raycast"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_CapsuleCast(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.PhysicsScene)Puerts.Utils.GetSelf((int)data, self); if (paramLen == 8) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); var argHelper7 = new Puerts.ArgumentHelper((int)data, isolate, info, 7); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper4.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit), true, true) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper7.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3>(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.Get<UnityEngine.Vector3>(false); var Arg4 = argHelper4.Get<UnityEngine.RaycastHit>(true); var Arg5 = argHelper5.GetFloat(false); var Arg6 = argHelper6.GetInt32(false); var Arg7 = (UnityEngine.QueryTriggerInteraction)argHelper7.GetInt32(false); var result = obj.CapsuleCast(Arg0,Arg1,Arg2,Arg3,out Arg4,Arg5,Arg6,Arg7); argHelper4.SetByRefValue(Arg4); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit[]), false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper7.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3>(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.Get<UnityEngine.Vector3>(false); var Arg4 = argHelper4.Get<UnityEngine.RaycastHit[]>(false); var Arg5 = argHelper5.GetFloat(false); var Arg6 = argHelper6.GetInt32(false); var Arg7 = (UnityEngine.QueryTriggerInteraction)argHelper7.GetInt32(false); var result = obj.CapsuleCast(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } if (paramLen == 7) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper4.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit), true, true) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3>(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.Get<UnityEngine.Vector3>(false); var Arg4 = argHelper4.Get<UnityEngine.RaycastHit>(true); var Arg5 = argHelper5.GetFloat(false); var Arg6 = argHelper6.GetInt32(false); var result = obj.CapsuleCast(Arg0,Arg1,Arg2,Arg3,out Arg4,Arg5,Arg6); argHelper4.SetByRefValue(Arg4); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit[]), false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3>(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.Get<UnityEngine.Vector3>(false); var Arg4 = argHelper4.Get<UnityEngine.RaycastHit[]>(false); var Arg5 = argHelper5.GetFloat(false); var Arg6 = argHelper6.GetInt32(false); var result = obj.CapsuleCast(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } if (paramLen == 6) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper4.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit), true, true) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3>(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.Get<UnityEngine.Vector3>(false); var Arg4 = argHelper4.Get<UnityEngine.RaycastHit>(true); var Arg5 = argHelper5.GetFloat(false); var result = obj.CapsuleCast(Arg0,Arg1,Arg2,Arg3,out Arg4,Arg5); argHelper4.SetByRefValue(Arg4); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit[]), false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3>(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.Get<UnityEngine.Vector3>(false); var Arg4 = argHelper4.Get<UnityEngine.RaycastHit[]>(false); var Arg5 = argHelper5.GetFloat(false); var result = obj.CapsuleCast(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } if (paramLen == 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper4.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit), true, true)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3>(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.Get<UnityEngine.Vector3>(false); var Arg4 = argHelper4.Get<UnityEngine.RaycastHit>(true); var result = obj.CapsuleCast(Arg0,Arg1,Arg2,Arg3,out Arg4); argHelper4.SetByRefValue(Arg4); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3>(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.Get<UnityEngine.Vector3>(false); var Arg4 = argHelper4.Get<UnityEngine.RaycastHit[]>(false); var result = obj.CapsuleCast(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to CapsuleCast"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_OverlapCapsule(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.PhysicsScene)Puerts.Utils.GetSelf((int)data, self); if (paramLen == 6) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Collider[]), false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3>(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.Get<UnityEngine.Collider[]>(false); var Arg4 = argHelper4.GetInt32(false); var Arg5 = (UnityEngine.QueryTriggerInteraction)argHelper5.GetInt32(false); var result = obj.OverlapCapsule(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } if (paramLen == 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Collider[]), false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3>(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.Get<UnityEngine.Collider[]>(false); var Arg4 = argHelper4.GetInt32(false); var result = obj.OverlapCapsule(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Collider[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3>(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.Get<UnityEngine.Collider[]>(false); var result = obj.OverlapCapsule(Arg0,Arg1,Arg2,Arg3); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to OverlapCapsule"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SphereCast(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.PhysicsScene)Puerts.Utils.GetSelf((int)data, self); if (paramLen == 7) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit), true, true) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.Get<UnityEngine.Vector3>(false); var Arg3 = argHelper3.Get<UnityEngine.RaycastHit>(true); var Arg4 = argHelper4.GetFloat(false); var Arg5 = argHelper5.GetInt32(false); var Arg6 = (UnityEngine.QueryTriggerInteraction)argHelper6.GetInt32(false); var result = obj.SphereCast(Arg0,Arg1,Arg2,out Arg3,Arg4,Arg5,Arg6); argHelper3.SetByRefValue(Arg3); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit[]), false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.Get<UnityEngine.Vector3>(false); var Arg3 = argHelper3.Get<UnityEngine.RaycastHit[]>(false); var Arg4 = argHelper4.GetFloat(false); var Arg5 = argHelper5.GetInt32(false); var Arg6 = (UnityEngine.QueryTriggerInteraction)argHelper6.GetInt32(false); var result = obj.SphereCast(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } if (paramLen == 6) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit), true, true) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.Get<UnityEngine.Vector3>(false); var Arg3 = argHelper3.Get<UnityEngine.RaycastHit>(true); var Arg4 = argHelper4.GetFloat(false); var Arg5 = argHelper5.GetInt32(false); var result = obj.SphereCast(Arg0,Arg1,Arg2,out Arg3,Arg4,Arg5); argHelper3.SetByRefValue(Arg3); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit[]), false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.Get<UnityEngine.Vector3>(false); var Arg3 = argHelper3.Get<UnityEngine.RaycastHit[]>(false); var Arg4 = argHelper4.GetFloat(false); var Arg5 = argHelper5.GetInt32(false); var result = obj.SphereCast(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } if (paramLen == 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit), true, true) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.Get<UnityEngine.Vector3>(false); var Arg3 = argHelper3.Get<UnityEngine.RaycastHit>(true); var Arg4 = argHelper4.GetFloat(false); var result = obj.SphereCast(Arg0,Arg1,Arg2,out Arg3,Arg4); argHelper3.SetByRefValue(Arg3); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit[]), false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.Get<UnityEngine.Vector3>(false); var Arg3 = argHelper3.Get<UnityEngine.RaycastHit[]>(false); var Arg4 = argHelper4.GetFloat(false); var result = obj.SphereCast(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit), true, true)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.Get<UnityEngine.Vector3>(false); var Arg3 = argHelper3.Get<UnityEngine.RaycastHit>(true); var result = obj.SphereCast(Arg0,Arg1,Arg2,out Arg3); argHelper3.SetByRefValue(Arg3); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.Get<UnityEngine.Vector3>(false); var Arg3 = argHelper3.Get<UnityEngine.RaycastHit[]>(false); var result = obj.SphereCast(Arg0,Arg1,Arg2,Arg3); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SphereCast"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_OverlapSphere(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.PhysicsScene)Puerts.Utils.GetSelf((int)data, self); { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.Get<UnityEngine.Collider[]>(false); var Arg3 = argHelper3.GetInt32(false); var Arg4 = (UnityEngine.QueryTriggerInteraction)argHelper4.GetInt32(false); var result = obj.OverlapSphere(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_BoxCast(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.PhysicsScene)Puerts.Utils.GetSelf((int)data, self); if (paramLen == 8) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); var argHelper7 = new Puerts.ArgumentHelper((int)data, isolate, info, 7); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit), true, true) && argHelper4.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Quaternion), false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper7.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3>(false); var Arg2 = argHelper2.Get<UnityEngine.Vector3>(false); var Arg3 = argHelper3.Get<UnityEngine.RaycastHit>(true); var Arg4 = argHelper4.Get<UnityEngine.Quaternion>(false); var Arg5 = argHelper5.GetFloat(false); var Arg6 = argHelper6.GetInt32(false); var Arg7 = (UnityEngine.QueryTriggerInteraction)argHelper7.GetInt32(false); var result = obj.BoxCast(Arg0,Arg1,Arg2,out Arg3,Arg4,Arg5,Arg6,Arg7); argHelper3.SetByRefValue(Arg3); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit[]), false, false) && argHelper4.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Quaternion), false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper7.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3>(false); var Arg2 = argHelper2.Get<UnityEngine.Vector3>(false); var Arg3 = argHelper3.Get<UnityEngine.RaycastHit[]>(false); var Arg4 = argHelper4.Get<UnityEngine.Quaternion>(false); var Arg5 = argHelper5.GetFloat(false); var Arg6 = argHelper6.GetInt32(false); var Arg7 = (UnityEngine.QueryTriggerInteraction)argHelper7.GetInt32(false); var result = obj.BoxCast(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } if (paramLen == 7) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit), true, true) && argHelper4.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Quaternion), false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3>(false); var Arg2 = argHelper2.Get<UnityEngine.Vector3>(false); var Arg3 = argHelper3.Get<UnityEngine.RaycastHit>(true); var Arg4 = argHelper4.Get<UnityEngine.Quaternion>(false); var Arg5 = argHelper5.GetFloat(false); var Arg6 = argHelper6.GetInt32(false); var result = obj.BoxCast(Arg0,Arg1,Arg2,out Arg3,Arg4,Arg5,Arg6); argHelper3.SetByRefValue(Arg3); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit[]), false, false) && argHelper4.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Quaternion), false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3>(false); var Arg2 = argHelper2.Get<UnityEngine.Vector3>(false); var Arg3 = argHelper3.Get<UnityEngine.RaycastHit[]>(false); var Arg4 = argHelper4.Get<UnityEngine.Quaternion>(false); var Arg5 = argHelper5.GetFloat(false); var Arg6 = argHelper6.GetInt32(false); var result = obj.BoxCast(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } if (paramLen == 6) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit), true, true) && argHelper4.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Quaternion), false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3>(false); var Arg2 = argHelper2.Get<UnityEngine.Vector3>(false); var Arg3 = argHelper3.Get<UnityEngine.RaycastHit>(true); var Arg4 = argHelper4.Get<UnityEngine.Quaternion>(false); var Arg5 = argHelper5.GetFloat(false); var result = obj.BoxCast(Arg0,Arg1,Arg2,out Arg3,Arg4,Arg5); argHelper3.SetByRefValue(Arg3); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit[]), false, false) && argHelper4.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Quaternion), false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3>(false); var Arg2 = argHelper2.Get<UnityEngine.Vector3>(false); var Arg3 = argHelper3.Get<UnityEngine.RaycastHit[]>(false); var Arg4 = argHelper4.Get<UnityEngine.Quaternion>(false); var Arg5 = argHelper5.GetFloat(false); var result = obj.BoxCast(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } if (paramLen == 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit), true, true) && argHelper4.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Quaternion), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3>(false); var Arg2 = argHelper2.Get<UnityEngine.Vector3>(false); var Arg3 = argHelper3.Get<UnityEngine.RaycastHit>(true); var Arg4 = argHelper4.Get<UnityEngine.Quaternion>(false); var result = obj.BoxCast(Arg0,Arg1,Arg2,out Arg3,Arg4); argHelper3.SetByRefValue(Arg3); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit[]), false, false) && argHelper4.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Quaternion), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3>(false); var Arg2 = argHelper2.Get<UnityEngine.Vector3>(false); var Arg3 = argHelper3.Get<UnityEngine.RaycastHit[]>(false); var Arg4 = argHelper4.Get<UnityEngine.Quaternion>(false); var result = obj.BoxCast(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit), true, true)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3>(false); var Arg2 = argHelper2.Get<UnityEngine.Vector3>(false); var Arg3 = argHelper3.Get<UnityEngine.RaycastHit>(true); var result = obj.BoxCast(Arg0,Arg1,Arg2,out Arg3); argHelper3.SetByRefValue(Arg3); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3>(false); var Arg2 = argHelper2.Get<UnityEngine.Vector3>(false); var Arg3 = argHelper3.Get<UnityEngine.RaycastHit[]>(false); var result = obj.BoxCast(Arg0,Arg1,Arg2,Arg3); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to BoxCast"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_OverlapBox(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.PhysicsScene)Puerts.Utils.GetSelf((int)data, self); if (paramLen == 6) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Collider[]), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Quaternion), false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3>(false); var Arg2 = argHelper2.Get<UnityEngine.Collider[]>(false); var Arg3 = argHelper3.Get<UnityEngine.Quaternion>(false); var Arg4 = argHelper4.GetInt32(false); var Arg5 = (UnityEngine.QueryTriggerInteraction)argHelper5.GetInt32(false); var result = obj.OverlapBox(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } if (paramLen == 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Collider[]), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Quaternion), false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3>(false); var Arg2 = argHelper2.Get<UnityEngine.Collider[]>(false); var Arg3 = argHelper3.Get<UnityEngine.Quaternion>(false); var Arg4 = argHelper4.GetInt32(false); var result = obj.OverlapBox(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Collider[]), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Quaternion), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3>(false); var Arg2 = argHelper2.Get<UnityEngine.Collider[]>(false); var Arg3 = argHelper3.Get<UnityEngine.Quaternion>(false); var result = obj.OverlapBox(Arg0,Arg1,Arg2,Arg3); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Collider[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3>(false); var Arg2 = argHelper2.Get<UnityEngine.Collider[]>(false); var result = obj.OverlapBox(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to OverlapBox"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void O_op_Equality(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var arg0 = argHelper0.Get<UnityEngine.PhysicsScene>(false); var arg1 = argHelper1.Get<UnityEngine.PhysicsScene>(false); var result = arg0 == arg1; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void O_op_Inequality(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var arg0 = argHelper0.Get<UnityEngine.PhysicsScene>(false); var arg1 = argHelper1.Get<UnityEngine.PhysicsScene>(false); var result = arg0 != arg1; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "ToString", IsStatic = false}, M_ToString }, { new Puerts.MethodKey {Name = "GetHashCode", IsStatic = false}, M_GetHashCode }, { new Puerts.MethodKey {Name = "Equals", IsStatic = false}, M_Equals }, { new Puerts.MethodKey {Name = "IsValid", IsStatic = false}, M_IsValid }, { new Puerts.MethodKey {Name = "IsEmpty", IsStatic = false}, M_IsEmpty }, { new Puerts.MethodKey {Name = "Simulate", IsStatic = false}, M_Simulate }, { new Puerts.MethodKey {Name = "Raycast", IsStatic = false}, M_Raycast }, { new Puerts.MethodKey {Name = "CapsuleCast", IsStatic = false}, M_CapsuleCast }, { new Puerts.MethodKey {Name = "OverlapCapsule", IsStatic = false}, M_OverlapCapsule }, { new Puerts.MethodKey {Name = "SphereCast", IsStatic = false}, M_SphereCast }, { new Puerts.MethodKey {Name = "OverlapSphere", IsStatic = false}, M_OverlapSphere }, { new Puerts.MethodKey {Name = "BoxCast", IsStatic = false}, M_BoxCast }, { new Puerts.MethodKey {Name = "OverlapBox", IsStatic = false}, M_OverlapBox }, { new Puerts.MethodKey {Name = "op_Equality", IsStatic = true}, O_op_Equality}, { new Puerts.MethodKey {Name = "op_Inequality", IsStatic = true}, O_op_Inequality}, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { } }; } } } <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/test/MultiRowTitle.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.test { public sealed partial class MultiRowTitle : Bright.Config.BeanBase { public MultiRowTitle(ByteBuf _buf) { Id = _buf.ReadInt(); Name = _buf.ReadString(); X1 = test.H1.DeserializeH1(_buf); {int n = System.Math.Min(_buf.ReadSize(), _buf.Size);X2 = new System.Collections.Generic.List<test.H2>(n);for(var i = 0 ; i < n ; i++) { test.H2 _e; _e = test.H2.DeserializeH2(_buf); X2.Add(_e);}} {int n = System.Math.Min(_buf.ReadSize(), _buf.Size);X3 = new test.H2[n];for(var i = 0 ; i < n ; i++) { test.H2 _e;_e = test.H2.DeserializeH2(_buf); X3[i] = _e;}} } public MultiRowTitle(int id, string name, test.H1 x1, System.Collections.Generic.List<test.H2> x2, test.H2[] x3 ) { this.Id = id; this.Name = name; this.X1 = x1; this.X2 = x2; this.X3 = x3; } public static MultiRowTitle DeserializeMultiRowTitle(ByteBuf _buf) { return new test.MultiRowTitle(_buf); } public readonly int Id; public readonly string Name; public readonly test.H1 X1; public readonly System.Collections.Generic.List<test.H2> X2; public readonly test.H2[] X3; public const int ID = 540002427; public override int GetTypeId() => ID; public void Resolve(Dictionary<string, object> _tables) { X1?.Resolve(_tables); foreach(var _e in X2) { _e?.Resolve(_tables); } foreach(var _e in X3) { _e?.Resolve(_tables); } OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); public override string ToString() { return "{ " + "Id:" + Id + "," + "Name:" + Name + "," + "X1:" + X1 + "," + "X2:" + Bright.Common.StringUtil.CollectionToString(X2) + "," + "X3:" + Bright.Common.StringUtil.CollectionToString(X3) + "," + "}"; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_TreePrototype_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_TreePrototype_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { if (paramLen == 0) { { var result = new UnityEngine.TreePrototype(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.TreePrototype), result); } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.TreePrototype), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.TreePrototype>(false); var result = new UnityEngine.TreePrototype(Arg0); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.TreePrototype), result); } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.TreePrototype constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Equals(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TreePrototype; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.Object>(false); var result = obj.Equals(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetHashCode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TreePrototype; { { var result = obj.GetHashCode(); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_prefab(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TreePrototype; var result = obj.prefab; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_prefab(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TreePrototype; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.prefab = argHelper.Get<UnityEngine.GameObject>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_bendFactor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TreePrototype; var result = obj.bendFactor; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_bendFactor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TreePrototype; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.bendFactor = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_navMeshLod(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TreePrototype; var result = obj.navMeshLod; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_navMeshLod(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TreePrototype; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.navMeshLod = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "Equals", IsStatic = false}, M_Equals }, { new Puerts.MethodKey {Name = "GetHashCode", IsStatic = false}, M_GetHashCode }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"prefab", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_prefab, Setter = S_prefab} }, {"bendFactor", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_bendFactor, Setter = S_bendFactor} }, {"navMeshLod", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_navMeshLod, Setter = S_navMeshLod} }, } }; } } } <|start_filename|>Projects/Csharp_CustomTemplate_EncryptMemory/Gen/test/TestNull.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using System; using Newtonsoft.Json; using Scripts; namespace cfg.test { [Serializable] public partial class TestNull : AConfig { [JsonProperty("x1")] private int? _x1 { get; set; } [JsonIgnore] public EncryptInt x1 { get; private set; } = new(); public test.DemoEnum? x2 { get; set; } [JsonProperty] public test.DemoType1 x3 { get; set; } [JsonProperty] public test.DemoDynamic x4 { get; set; } public string s1 { get; set; } public string s2 { get; set; } public string S2_l10n_key { get; } public override void EndInit() { x1 = _x1; x3.EndInit(); x4.EndInit(); } public override string ToString() => JsonConvert.SerializeObject(this); } } <|start_filename|>Projects/Csharp_CustomTemplate_EncryptMemory/Assets/Scripts/AConfig.cs<|end_filename|> using System; using Newtonsoft.Json; namespace Scripts { public class AConfig { [JsonProperty] public int id { get; internal set; } public virtual void TranslateText(Func<string, string, string> translator) { } public virtual void EndInit() { } } } <|start_filename|>Projects/Java_bin/src/main/gen/cfg/cost/CostCurrency.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.cost; import bright.serialization.*; public final class CostCurrency extends cfg.cost.Cost { public CostCurrency(ByteBuf _buf) { super(_buf); type = cfg.item.ECurrencyType.valueOf(_buf.readInt()); num = _buf.readInt(); } public CostCurrency(cfg.item.ECurrencyType type, int num ) { super(); this.type = type; this.num = num; } public final cfg.item.ECurrencyType type; public final int num; public static final int __ID__ = 911838111; @Override public int getTypeId() { return __ID__; } @Override public void resolve(java.util.HashMap<String, Object> _tables) { super.resolve(_tables); } @Override public String toString() { return "{ " + "type:" + type + "," + "num:" + num + "," + "}"; } } <|start_filename|>Projects/Cpp_Unreal_bin/Source/Cpp_Unreal/Cpp_Unreal.cpp<|end_filename|> // Copyright 1998-2019 Epic Games, Inc. All Rights Reserved. #include "Cpp_Unreal.h" #include "Modules/ModuleManager.h" #include "Misc/Paths.h" #include "Gen/gen_types.h" //#include "Gen/stub_0.cxx" IMPLEMENT_PRIMARY_GAME_MODULE(MainModule, Cpp_Unreal, "Cpp_Unreal"); void MainModule::StartupModule() { cfg::Tables tables; auto dir = FPaths::ProjectContentDir() + TEXT("/../../GenerateDatas/bin/"); if (tables.load([=](ByteBuf& buf, const std::string& str) { buf.clear(); return buf.loadFromFile(std::string(TCHAR_TO_UTF8(*dir)) + str + ".bytes"); })) { UE_LOG(LogTemp, Log, TEXT("LOAD SUCC")); } else { UE_LOG(LogTemp, Log, TEXT("load fail")); } } <|start_filename|>DesignerConfigs/Datas/ai/behaviortrees/random_move.lua<|end_filename|> return { id=10002, name="random move", desc="demo behaviour tree haha", executor="SERVER", blackboard_id="demo", root= { __type__ = "Sequence", id=1, node_name="test", desc="root", services= { }, decorators= { { __type__="UeLoop", id=3,node_name="",flow_abort_mode="SELF", num_loops=0,infinite_loop=true,infinite_loop_timeout_time=-1,}, }, children = { {__type__="UeWait", id=30,node_name="", ignore_restart_self=false,wait_time=1,random_deviation=0.5, services={},decorators={},}, {__type__="MoveToRandomLocation", id=75,node_name="", ignore_restart_self=false,origin_position_key="x5",radius=30, services={},decorators={}}, --{__type__="DebugPrint", id=76,node_name="", ignore_restart_self=false,text="======= bt debug print ===", services={},decorators={}}, }, }, } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_GUIStyle_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_GUIStyle_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { if (paramLen == 0) { { var result = new UnityEngine.GUIStyle(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.GUIStyle), result); } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.GUIStyle>(false); var result = new UnityEngine.GUIStyle(Arg0); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.GUIStyle), result); } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.GUIStyle constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Draw(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUIStyle; if (paramLen == 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.GetBoolean(false); var Arg2 = argHelper2.GetBoolean(false); var Arg3 = argHelper3.GetBoolean(false); var Arg4 = argHelper4.GetBoolean(false); obj.Draw(Arg0,Arg1,Arg2,Arg3,Arg4); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIContent), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.Get<UnityEngine.GUIContent>(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetBoolean(false); var Arg4 = argHelper4.GetBoolean(false); obj.Draw(Arg0,Arg1,Arg2,Arg3,Arg4); return; } } if (paramLen == 6) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.GetString(false); var Arg2 = argHelper2.GetBoolean(false); var Arg3 = argHelper3.GetBoolean(false); var Arg4 = argHelper4.GetBoolean(false); var Arg5 = argHelper5.GetBoolean(false); obj.Draw(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.Get<UnityEngine.Texture>(false); var Arg2 = argHelper2.GetBoolean(false); var Arg3 = argHelper3.GetBoolean(false); var Arg4 = argHelper4.GetBoolean(false); var Arg5 = argHelper5.GetBoolean(false); obj.Draw(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIContent), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.Get<UnityEngine.GUIContent>(false); var Arg2 = argHelper2.GetBoolean(false); var Arg3 = argHelper3.GetBoolean(false); var Arg4 = argHelper4.GetBoolean(false); var Arg5 = argHelper5.GetBoolean(false); obj.Draw(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIContent), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.Get<UnityEngine.GUIContent>(false); var Arg2 = argHelper2.GetInt32(false); obj.Draw(Arg0,Arg1,Arg2); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIContent), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.Get<UnityEngine.GUIContent>(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetBoolean(false); obj.Draw(Arg0,Arg1,Arg2,Arg3); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to Draw"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_DrawCursor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUIStyle; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.Get<UnityEngine.GUIContent>(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetInt32(false); obj.DrawCursor(Arg0,Arg1,Arg2,Arg3); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_DrawWithTextSelection(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUIStyle; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.Get<UnityEngine.GUIContent>(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetInt32(false); var Arg4 = argHelper4.GetInt32(false); obj.DrawWithTextSelection(Arg0,Arg1,Arg2,Arg3,Arg4); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetCursorPixelPosition(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUIStyle; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.Get<UnityEngine.GUIContent>(false); var Arg2 = argHelper2.GetInt32(false); var result = obj.GetCursorPixelPosition(Arg0,Arg1,Arg2); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetCursorStringIndex(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUIStyle; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.Get<UnityEngine.GUIContent>(false); var Arg2 = argHelper2.Get<UnityEngine.Vector2>(false); var result = obj.GetCursorStringIndex(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_CalcSize(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUIStyle; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.GUIContent>(false); var result = obj.CalcSize(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_CalcScreenSize(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUIStyle; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var result = obj.CalcScreenSize(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_CalcHeight(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUIStyle; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<UnityEngine.GUIContent>(false); var Arg1 = argHelper1.GetFloat(false); var result = obj.CalcHeight(Arg0,Arg1); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_CalcMinMaxWidth(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUIStyle; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.Get<UnityEngine.GUIContent>(false); var Arg1 = argHelper1.GetFloat(true); var Arg2 = argHelper2.GetFloat(true); obj.CalcMinMaxWidth(Arg0,out Arg1,out Arg2); argHelper1.SetByRefValue(Arg1); argHelper2.SetByRefValue(Arg2); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ToString(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUIStyle; { { var result = obj.ToString(); Puerts.PuertsDLL.ReturnString(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_font(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUIStyle; var result = obj.font; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_font(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUIStyle; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.font = argHelper.Get<UnityEngine.Font>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_imagePosition(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUIStyle; var result = obj.imagePosition; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_imagePosition(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUIStyle; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.imagePosition = (UnityEngine.ImagePosition)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_alignment(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUIStyle; var result = obj.alignment; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_alignment(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUIStyle; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.alignment = (UnityEngine.TextAnchor)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_wordWrap(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUIStyle; var result = obj.wordWrap; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_wordWrap(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUIStyle; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.wordWrap = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_clipping(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUIStyle; var result = obj.clipping; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_clipping(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUIStyle; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.clipping = (UnityEngine.TextClipping)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_contentOffset(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUIStyle; var result = obj.contentOffset; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_contentOffset(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUIStyle; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.contentOffset = argHelper.Get<UnityEngine.Vector2>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_fixedWidth(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUIStyle; var result = obj.fixedWidth; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_fixedWidth(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUIStyle; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.fixedWidth = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_fixedHeight(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUIStyle; var result = obj.fixedHeight; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_fixedHeight(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUIStyle; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.fixedHeight = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_stretchWidth(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUIStyle; var result = obj.stretchWidth; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_stretchWidth(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUIStyle; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.stretchWidth = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_stretchHeight(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUIStyle; var result = obj.stretchHeight; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_stretchHeight(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUIStyle; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.stretchHeight = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_fontSize(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUIStyle; var result = obj.fontSize; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_fontSize(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUIStyle; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.fontSize = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_fontStyle(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUIStyle; var result = obj.fontStyle; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_fontStyle(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUIStyle; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.fontStyle = (UnityEngine.FontStyle)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_richText(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUIStyle; var result = obj.richText; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_richText(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUIStyle; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.richText = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_name(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUIStyle; var result = obj.name; Puerts.PuertsDLL.ReturnString(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_name(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUIStyle; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.name = argHelper.GetString(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_normal(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUIStyle; var result = obj.normal; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_normal(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUIStyle; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.normal = argHelper.Get<UnityEngine.GUIStyleState>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_hover(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUIStyle; var result = obj.hover; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_hover(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUIStyle; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.hover = argHelper.Get<UnityEngine.GUIStyleState>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_active(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUIStyle; var result = obj.active; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_active(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUIStyle; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.active = argHelper.Get<UnityEngine.GUIStyleState>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_onNormal(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUIStyle; var result = obj.onNormal; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_onNormal(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUIStyle; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.onNormal = argHelper.Get<UnityEngine.GUIStyleState>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_onHover(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUIStyle; var result = obj.onHover; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_onHover(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUIStyle; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.onHover = argHelper.Get<UnityEngine.GUIStyleState>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_onActive(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUIStyle; var result = obj.onActive; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_onActive(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUIStyle; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.onActive = argHelper.Get<UnityEngine.GUIStyleState>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_focused(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUIStyle; var result = obj.focused; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_focused(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUIStyle; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.focused = argHelper.Get<UnityEngine.GUIStyleState>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_onFocused(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUIStyle; var result = obj.onFocused; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_onFocused(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUIStyle; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.onFocused = argHelper.Get<UnityEngine.GUIStyleState>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_border(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUIStyle; var result = obj.border; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_border(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUIStyle; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.border = argHelper.Get<UnityEngine.RectOffset>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_margin(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUIStyle; var result = obj.margin; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_margin(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUIStyle; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.margin = argHelper.Get<UnityEngine.RectOffset>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_padding(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUIStyle; var result = obj.padding; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_padding(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUIStyle; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.padding = argHelper.Get<UnityEngine.RectOffset>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_overflow(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUIStyle; var result = obj.overflow; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_overflow(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUIStyle; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.overflow = argHelper.Get<UnityEngine.RectOffset>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_lineHeight(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUIStyle; var result = obj.lineHeight; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_none(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.GUIStyle.none; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_isHeightDependantOnWidth(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUIStyle; var result = obj.isHeightDependantOnWidth; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "Draw", IsStatic = false}, M_Draw }, { new Puerts.MethodKey {Name = "DrawCursor", IsStatic = false}, M_DrawCursor }, { new Puerts.MethodKey {Name = "DrawWithTextSelection", IsStatic = false}, M_DrawWithTextSelection }, { new Puerts.MethodKey {Name = "GetCursorPixelPosition", IsStatic = false}, M_GetCursorPixelPosition }, { new Puerts.MethodKey {Name = "GetCursorStringIndex", IsStatic = false}, M_GetCursorStringIndex }, { new Puerts.MethodKey {Name = "CalcSize", IsStatic = false}, M_CalcSize }, { new Puerts.MethodKey {Name = "CalcScreenSize", IsStatic = false}, M_CalcScreenSize }, { new Puerts.MethodKey {Name = "CalcHeight", IsStatic = false}, M_CalcHeight }, { new Puerts.MethodKey {Name = "CalcMinMaxWidth", IsStatic = false}, M_CalcMinMaxWidth }, { new Puerts.MethodKey {Name = "ToString", IsStatic = false}, M_ToString }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"font", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_font, Setter = S_font} }, {"imagePosition", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_imagePosition, Setter = S_imagePosition} }, {"alignment", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_alignment, Setter = S_alignment} }, {"wordWrap", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_wordWrap, Setter = S_wordWrap} }, {"clipping", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_clipping, Setter = S_clipping} }, {"contentOffset", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_contentOffset, Setter = S_contentOffset} }, {"fixedWidth", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_fixedWidth, Setter = S_fixedWidth} }, {"fixedHeight", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_fixedHeight, Setter = S_fixedHeight} }, {"stretchWidth", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_stretchWidth, Setter = S_stretchWidth} }, {"stretchHeight", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_stretchHeight, Setter = S_stretchHeight} }, {"fontSize", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_fontSize, Setter = S_fontSize} }, {"fontStyle", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_fontStyle, Setter = S_fontStyle} }, {"richText", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_richText, Setter = S_richText} }, {"name", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_name, Setter = S_name} }, {"normal", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_normal, Setter = S_normal} }, {"hover", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_hover, Setter = S_hover} }, {"active", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_active, Setter = S_active} }, {"onNormal", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_onNormal, Setter = S_onNormal} }, {"onHover", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_onHover, Setter = S_onHover} }, {"onActive", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_onActive, Setter = S_onActive} }, {"focused", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_focused, Setter = S_focused} }, {"onFocused", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_onFocused, Setter = S_onFocused} }, {"border", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_border, Setter = S_border} }, {"margin", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_margin, Setter = S_margin} }, {"padding", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_padding, Setter = S_padding} }, {"overflow", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_overflow, Setter = S_overflow} }, {"lineHeight", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_lineHeight, Setter = null} }, {"none", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_none, Setter = null} }, {"isHeightDependantOnWidth", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_isHeightDependantOnWidth, Setter = null} }, } }; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_AudioConfiguration_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_AudioConfiguration_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.AudioConfiguration constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_speakerMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.AudioConfiguration)Puerts.Utils.GetSelf((int)data, self); var result = obj.speakerMode; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_speakerMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.AudioConfiguration)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.speakerMode = (UnityEngine.AudioSpeakerMode)argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_dspBufferSize(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.AudioConfiguration)Puerts.Utils.GetSelf((int)data, self); var result = obj.dspBufferSize; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_dspBufferSize(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.AudioConfiguration)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.dspBufferSize = argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_sampleRate(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.AudioConfiguration)Puerts.Utils.GetSelf((int)data, self); var result = obj.sampleRate; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_sampleRate(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.AudioConfiguration)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.sampleRate = argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_numRealVoices(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.AudioConfiguration)Puerts.Utils.GetSelf((int)data, self); var result = obj.numRealVoices; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_numRealVoices(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.AudioConfiguration)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.numRealVoices = argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_numVirtualVoices(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.AudioConfiguration)Puerts.Utils.GetSelf((int)data, self); var result = obj.numVirtualVoices; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_numVirtualVoices(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.AudioConfiguration)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.numVirtualVoices = argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"speakerMode", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_speakerMode, Setter = S_speakerMode} }, {"dspBufferSize", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_dspBufferSize, Setter = S_dspBufferSize} }, {"sampleRate", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_sampleRate, Setter = S_sampleRate} }, {"numRealVoices", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_numRealVoices, Setter = S_numRealVoices} }, {"numVirtualVoices", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_numVirtualVoices, Setter = S_numVirtualVoices} }, } }; } } } <|start_filename|>Projects/Csharp_Unity_bin_use_UnityEngine_Vector/Assets/Gen/condition/BoolRoleCondition.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.condition { public abstract class BoolRoleCondition : condition.RoleCondition { public BoolRoleCondition(ByteBuf _buf) : base(_buf) { } public static BoolRoleCondition DeserializeBoolRoleCondition(ByteBuf _buf) { switch (_buf.ReadInt()) { case condition.GenderLimit.__ID__: return new condition.GenderLimit(_buf); case condition.MinLevel.__ID__: return new condition.MinLevel(_buf); case condition.MaxLevel.__ID__: return new condition.MaxLevel(_buf); case condition.MinMaxLevel.__ID__: return new condition.MinMaxLevel(_buf); case condition.ClothesPropertyScoreGreaterThan.__ID__: return new condition.ClothesPropertyScoreGreaterThan(_buf); default: throw new SerializationException(); } } public override void Resolve(Dictionary<string, object> _tables) { base.Resolve(_tables); } public override void TranslateText(System.Func<string, string, string> translator) { base.TranslateText(translator); } public override string ToString() { return "{ " + "}"; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_CullingGroup_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_CullingGroup_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.CullingGroup(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.CullingGroup), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Dispose(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CullingGroup; { { obj.Dispose(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetBoundingSpheres(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CullingGroup; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.BoundingSphere[]>(false); obj.SetBoundingSpheres(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetBoundingSphereCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CullingGroup; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); obj.SetBoundingSphereCount(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_EraseSwapBack(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CullingGroup; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); obj.EraseSwapBack(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_QueryIndices(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CullingGroup; if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(int[]), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetBoolean(false); var Arg1 = argHelper1.Get<int[]>(false); var Arg2 = argHelper2.GetInt32(false); var result = obj.QueryIndices(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(int[]), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<int[]>(false); var Arg2 = argHelper2.GetInt32(false); var result = obj.QueryIndices(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(int[]), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetBoolean(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.Get<int[]>(false); var Arg3 = argHelper3.GetInt32(false); var result = obj.QueryIndices(Arg0,Arg1,Arg2,Arg3); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to QueryIndices"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_IsVisible(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CullingGroup; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); var result = obj.IsVisible(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetDistance(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CullingGroup; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); var result = obj.GetDistance(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetBoundingDistances(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CullingGroup; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<float[]>(false); obj.SetBoundingDistances(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetDistanceReferencePoint(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CullingGroup; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); obj.SetDistanceReferencePoint(Arg0); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Transform), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Transform>(false); obj.SetDistanceReferencePoint(Arg0); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SetDistanceReferencePoint"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_onStateChanged(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CullingGroup; var result = obj.onStateChanged; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_onStateChanged(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CullingGroup; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.onStateChanged = argHelper.Get<UnityEngine.CullingGroup.StateChanged>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_enabled(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CullingGroup; var result = obj.enabled; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_enabled(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CullingGroup; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.enabled = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_targetCamera(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CullingGroup; var result = obj.targetCamera; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_targetCamera(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CullingGroup; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.targetCamera = argHelper.Get<UnityEngine.Camera>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "Dispose", IsStatic = false}, M_Dispose }, { new Puerts.MethodKey {Name = "SetBoundingSpheres", IsStatic = false}, M_SetBoundingSpheres }, { new Puerts.MethodKey {Name = "SetBoundingSphereCount", IsStatic = false}, M_SetBoundingSphereCount }, { new Puerts.MethodKey {Name = "EraseSwapBack", IsStatic = false}, M_EraseSwapBack }, { new Puerts.MethodKey {Name = "QueryIndices", IsStatic = false}, M_QueryIndices }, { new Puerts.MethodKey {Name = "IsVisible", IsStatic = false}, M_IsVisible }, { new Puerts.MethodKey {Name = "GetDistance", IsStatic = false}, M_GetDistance }, { new Puerts.MethodKey {Name = "SetBoundingDistances", IsStatic = false}, M_SetBoundingDistances }, { new Puerts.MethodKey {Name = "SetDistanceReferencePoint", IsStatic = false}, M_SetDistanceReferencePoint }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"onStateChanged", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_onStateChanged, Setter = S_onStateChanged} }, {"enabled", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_enabled, Setter = S_enabled} }, {"targetCamera", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_targetCamera, Setter = S_targetCamera} }, } }; } } } <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/mail/SystemMail.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.mail { public sealed partial class SystemMail : Bright.Config.BeanBase { public SystemMail(ByteBuf _buf) { Id = _buf.ReadInt(); Title = _buf.ReadString(); Sender = _buf.ReadString(); Content = _buf.ReadString(); {int n = System.Math.Min(_buf.ReadSize(), _buf.Size);Award = new System.Collections.Generic.List<int>(n);for(var i = 0 ; i < n ; i++) { int _e; _e = _buf.ReadInt(); Award.Add(_e);}} } public SystemMail(int id, string title, string sender, string content, System.Collections.Generic.List<int> award ) { this.Id = id; this.Title = title; this.Sender = sender; this.Content = content; this.Award = award; } public static SystemMail DeserializeSystemMail(ByteBuf _buf) { return new mail.SystemMail(_buf); } public readonly int Id; public readonly string Title; public readonly string Sender; public readonly string Content; public readonly System.Collections.Generic.List<int> Award; public const int ID = 1214073149; public override int GetTypeId() => ID; public void Resolve(Dictionary<string, object> _tables) { OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); public override string ToString() { return "{ " + "Id:" + Id + "," + "Title:" + Title + "," + "Sender:" + Sender + "," + "Content:" + Content + "," + "Award:" + Bright.Common.StringUtil.CollectionToString(Award) + "," + "}"; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_Texture2D_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_Texture2D_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = (UnityEngine.Experimental.Rendering.DefaultFormat)argHelper2.GetInt32(false); var Arg3 = (UnityEngine.Experimental.Rendering.TextureCreationFlags)argHelper3.GetInt32(false); var result = new UnityEngine.Texture2D(Arg0,Arg1,Arg2,Arg3); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.Texture2D), result); } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = (UnityEngine.Experimental.Rendering.GraphicsFormat)argHelper2.GetInt32(false); var Arg3 = (UnityEngine.Experimental.Rendering.TextureCreationFlags)argHelper3.GetInt32(false); var result = new UnityEngine.Texture2D(Arg0,Arg1,Arg2,Arg3); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.Texture2D), result); } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = (UnityEngine.TextureFormat)argHelper2.GetInt32(false); var Arg3 = argHelper3.GetBoolean(false); var result = new UnityEngine.Texture2D(Arg0,Arg1,Arg2,Arg3); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.Texture2D), result); } } if (paramLen == 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = (UnityEngine.Experimental.Rendering.GraphicsFormat)argHelper2.GetInt32(false); var Arg3 = argHelper3.GetInt32(false); var Arg4 = (UnityEngine.Experimental.Rendering.TextureCreationFlags)argHelper4.GetInt32(false); var result = new UnityEngine.Texture2D(Arg0,Arg1,Arg2,Arg3,Arg4); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.Texture2D), result); } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = (UnityEngine.TextureFormat)argHelper2.GetInt32(false); var Arg3 = argHelper3.GetInt32(false); var Arg4 = argHelper4.GetBoolean(false); var result = new UnityEngine.Texture2D(Arg0,Arg1,Arg2,Arg3,Arg4); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.Texture2D), result); } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = (UnityEngine.TextureFormat)argHelper2.GetInt32(false); var Arg3 = argHelper3.GetBoolean(false); var Arg4 = argHelper4.GetBoolean(false); var result = new UnityEngine.Texture2D(Arg0,Arg1,Arg2,Arg3,Arg4); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.Texture2D), result); } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var result = new UnityEngine.Texture2D(Arg0,Arg1); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.Texture2D), result); } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.Texture2D constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Compress(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Texture2D; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetBoolean(false); obj.Compress(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ClearRequestedMipmapLevel(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Texture2D; { { obj.ClearRequestedMipmapLevel(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_IsRequestedMipmapLevelLoaded(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Texture2D; { { var result = obj.IsRequestedMipmapLevelLoaded(); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ClearMinimumMipmapLevel(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Texture2D; { { obj.ClearMinimumMipmapLevel(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_UpdateExternalTexture(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Texture2D; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.IntPtr>(false); obj.UpdateExternalTexture(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetRawTextureData(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Texture2D; { { var result = obj.GetRawTextureData(); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetPixels(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Texture2D; if (paramLen == 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetInt32(false); var Arg4 = argHelper4.GetInt32(false); var result = obj.GetPixels(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetInt32(false); var result = obj.GetPixels(Arg0,Arg1,Arg2,Arg3); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var result = obj.GetPixels(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 0) { { var result = obj.GetPixels(); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetPixels"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetPixels32(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Texture2D; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var result = obj.GetPixels32(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 0) { { var result = obj.GetPixels32(); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetPixels32"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_PackTextures(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Texture2D; if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture2D[]), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Texture2D[]>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetBoolean(false); var result = obj.PackTextures(Arg0,Arg1,Arg2,Arg3); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture2D[]), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Texture2D[]>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var result = obj.PackTextures(Arg0,Arg1,Arg2); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture2D[]), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Texture2D[]>(false); var Arg1 = argHelper1.GetInt32(false); var result = obj.PackTextures(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to PackTextures"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_CreateExternalTexture(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = (UnityEngine.TextureFormat)argHelper2.GetInt32(false); var Arg3 = argHelper3.GetBoolean(false); var Arg4 = argHelper4.GetBoolean(false); var Arg5 = argHelper5.Get<System.IntPtr>(false); var result = UnityEngine.Texture2D.CreateExternalTexture(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetPixel(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Texture2D; if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Color), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.Get<UnityEngine.Color>(false); obj.SetPixel(Arg0,Arg1,Arg2); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Color), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.Get<UnityEngine.Color>(false); var Arg3 = argHelper3.GetInt32(false); obj.SetPixel(Arg0,Arg1,Arg2,Arg3); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SetPixel"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetPixels(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Texture2D; if (paramLen == 6) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Color[]), false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetInt32(false); var Arg4 = argHelper4.Get<UnityEngine.Color[]>(false); var Arg5 = argHelper5.GetInt32(false); obj.SetPixels(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); return; } } if (paramLen == 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Color[]), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetInt32(false); var Arg4 = argHelper4.Get<UnityEngine.Color[]>(false); obj.SetPixels(Arg0,Arg1,Arg2,Arg3,Arg4); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Color[]), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Color[]>(false); var Arg1 = argHelper1.GetInt32(false); obj.SetPixels(Arg0,Arg1); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Color[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Color[]>(false); obj.SetPixels(Arg0); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SetPixels"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetPixel(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Texture2D; if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var result = obj.GetPixel(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var result = obj.GetPixel(Arg0,Arg1,Arg2); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetPixel"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetPixelBilinear(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Texture2D; if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.GetFloat(false); var result = obj.GetPixelBilinear(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.GetInt32(false); var result = obj.GetPixelBilinear(Arg0,Arg1,Arg2); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetPixelBilinear"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_LoadRawTextureData(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Texture2D; if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(System.IntPtr), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.GetInt32(false); obj.LoadRawTextureData(Arg0,Arg1); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(byte[]), false, false)) { var Arg0 = argHelper0.Get<byte[]>(false); obj.LoadRawTextureData(Arg0); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to LoadRawTextureData"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Apply(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Texture2D; if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.GetBoolean(false); var Arg1 = argHelper1.GetBoolean(false); obj.Apply(Arg0,Arg1); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.GetBoolean(false); obj.Apply(Arg0); return; } } if (paramLen == 0) { { obj.Apply(); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to Apply"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Resize(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Texture2D; if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var result = obj.Resize(Arg0,Arg1); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = (UnityEngine.TextureFormat)argHelper2.GetInt32(false); var Arg3 = argHelper3.GetBoolean(false); var result = obj.Resize(Arg0,Arg1,Arg2,Arg3); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = (UnityEngine.Experimental.Rendering.GraphicsFormat)argHelper2.GetInt32(false); var Arg3 = argHelper3.GetBoolean(false); var result = obj.Resize(Arg0,Arg1,Arg2,Arg3); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to Resize"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ReadPixels(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Texture2D; if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetBoolean(false); obj.ReadPixels(Arg0,Arg1,Arg2,Arg3); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); obj.ReadPixels(Arg0,Arg1,Arg2); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to ReadPixels"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GenerateAtlas(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); { var Arg0 = argHelper0.Get<UnityEngine.Vector2[]>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.Get<System.Collections.Generic.List<UnityEngine.Rect>>(false); var result = UnityEngine.Texture2D.GenerateAtlas(Arg0,Arg1,Arg2,Arg3); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetPixels32(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Texture2D; if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Color32[]), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Color32[]>(false); var Arg1 = argHelper1.GetInt32(false); obj.SetPixels32(Arg0,Arg1); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Color32[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Color32[]>(false); obj.SetPixels32(Arg0); return; } } if (paramLen == 6) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Color32[]), false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetInt32(false); var Arg4 = argHelper4.Get<UnityEngine.Color32[]>(false); var Arg5 = argHelper5.GetInt32(false); obj.SetPixels32(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); return; } } if (paramLen == 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Color32[]), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetInt32(false); var Arg4 = argHelper4.Get<UnityEngine.Color32[]>(false); obj.SetPixels32(Arg0,Arg1,Arg2,Arg3,Arg4); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SetPixels32"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_format(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Texture2D; var result = obj.format; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_whiteTexture(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Texture2D.whiteTexture; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_blackTexture(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Texture2D.blackTexture; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_redTexture(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Texture2D.redTexture; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_grayTexture(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Texture2D.grayTexture; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_linearGrayTexture(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Texture2D.linearGrayTexture; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_normalTexture(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Texture2D.normalTexture; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_isReadable(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Texture2D; var result = obj.isReadable; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_vtOnly(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Texture2D; var result = obj.vtOnly; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_streamingMipmaps(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Texture2D; var result = obj.streamingMipmaps; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_streamingMipmapsPriority(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Texture2D; var result = obj.streamingMipmapsPriority; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_requestedMipmapLevel(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Texture2D; var result = obj.requestedMipmapLevel; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_requestedMipmapLevel(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Texture2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.requestedMipmapLevel = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_minimumMipmapLevel(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Texture2D; var result = obj.minimumMipmapLevel; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_minimumMipmapLevel(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Texture2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.minimumMipmapLevel = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_calculatedMipmapLevel(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Texture2D; var result = obj.calculatedMipmapLevel; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_desiredMipmapLevel(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Texture2D; var result = obj.desiredMipmapLevel; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_loadingMipmapLevel(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Texture2D; var result = obj.loadingMipmapLevel; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_loadedMipmapLevel(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Texture2D; var result = obj.loadedMipmapLevel; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "Compress", IsStatic = false}, M_Compress }, { new Puerts.MethodKey {Name = "ClearRequestedMipmapLevel", IsStatic = false}, M_ClearRequestedMipmapLevel }, { new Puerts.MethodKey {Name = "IsRequestedMipmapLevelLoaded", IsStatic = false}, M_IsRequestedMipmapLevelLoaded }, { new Puerts.MethodKey {Name = "ClearMinimumMipmapLevel", IsStatic = false}, M_ClearMinimumMipmapLevel }, { new Puerts.MethodKey {Name = "UpdateExternalTexture", IsStatic = false}, M_UpdateExternalTexture }, { new Puerts.MethodKey {Name = "GetRawTextureData", IsStatic = false}, M_GetRawTextureData }, { new Puerts.MethodKey {Name = "GetPixels", IsStatic = false}, M_GetPixels }, { new Puerts.MethodKey {Name = "GetPixels32", IsStatic = false}, M_GetPixels32 }, { new Puerts.MethodKey {Name = "PackTextures", IsStatic = false}, M_PackTextures }, { new Puerts.MethodKey {Name = "CreateExternalTexture", IsStatic = true}, F_CreateExternalTexture }, { new Puerts.MethodKey {Name = "SetPixel", IsStatic = false}, M_SetPixel }, { new Puerts.MethodKey {Name = "SetPixels", IsStatic = false}, M_SetPixels }, { new Puerts.MethodKey {Name = "GetPixel", IsStatic = false}, M_GetPixel }, { new Puerts.MethodKey {Name = "GetPixelBilinear", IsStatic = false}, M_GetPixelBilinear }, { new Puerts.MethodKey {Name = "LoadRawTextureData", IsStatic = false}, M_LoadRawTextureData }, { new Puerts.MethodKey {Name = "Apply", IsStatic = false}, M_Apply }, { new Puerts.MethodKey {Name = "Resize", IsStatic = false}, M_Resize }, { new Puerts.MethodKey {Name = "ReadPixels", IsStatic = false}, M_ReadPixels }, { new Puerts.MethodKey {Name = "GenerateAtlas", IsStatic = true}, F_GenerateAtlas }, { new Puerts.MethodKey {Name = "SetPixels32", IsStatic = false}, M_SetPixels32 }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"format", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_format, Setter = null} }, {"whiteTexture", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_whiteTexture, Setter = null} }, {"blackTexture", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_blackTexture, Setter = null} }, {"redTexture", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_redTexture, Setter = null} }, {"grayTexture", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_grayTexture, Setter = null} }, {"linearGrayTexture", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_linearGrayTexture, Setter = null} }, {"normalTexture", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_normalTexture, Setter = null} }, {"isReadable", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_isReadable, Setter = null} }, {"vtOnly", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_vtOnly, Setter = null} }, {"streamingMipmaps", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_streamingMipmaps, Setter = null} }, {"streamingMipmapsPriority", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_streamingMipmapsPriority, Setter = null} }, {"requestedMipmapLevel", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_requestedMipmapLevel, Setter = S_requestedMipmapLevel} }, {"minimumMipmapLevel", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_minimumMipmapLevel, Setter = S_minimumMipmapLevel} }, {"calculatedMipmapLevel", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_calculatedMipmapLevel, Setter = null} }, {"desiredMipmapLevel", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_desiredMipmapLevel, Setter = null} }, {"loadingMipmapLevel", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_loadingMipmapLevel, Setter = null} }, {"loadedMipmapLevel", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_loadedMipmapLevel, Setter = null} }, } }; } } } <|start_filename|>Projects/GenerateDatas/convert_lua/role.TbRoleLevelExpAttr/59.lua<|end_filename|> return { level = 59, need_exp = 120000, clothes_attrs = { 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, }, } <|start_filename|>ProtoProjects/Csharp_Unity/Assets/Gen/test/TestRpcArg.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; namespace proto.test { public sealed class TestRpcArg : Bright.Serialization.BeanBase { public TestRpcArg() { } public TestRpcArg(Bright.Common.NotNullInitialization _) { Y = ""; } public static void SerializeTestRpcArg(ByteBuf _buf, TestRpcArg x) { x.Serialize(_buf); } public static TestRpcArg DeserializeTestRpcArg(ByteBuf _buf) { var x = new test.TestRpcArg(); x.Deserialize(_buf); return x; } public int X; public string Y; public const int __ID__ = 0; public override int GetTypeId() => __ID__; public override void Serialize(ByteBuf _buf) { _buf.WriteInt(X); _buf.WriteString(Y); } public override void Deserialize(ByteBuf _buf) { X = _buf.ReadInt(); Y = _buf.ReadString(); } public override string ToString() { return "test.TestRpcArg{ " + "X:" + X + "," + "Y:" + Y + "," + "}"; } } } <|start_filename|>Projects/DataTemplates/template_erlang2/tag_tbtesttag.erl<|end_filename|> %% tag.TbTestTag -module(tag_tbtesttag) -export([get/1,get_ids/0]) get(2001) -> #{ id => 2001, value => "导出" }. get(2004) -> #{ id => 2004, value => "any" }. get(2003) -> #{ id => 2003, value => "test" }. get(100) -> #{ id => 100, value => "导出" }. get(1) -> #{ id => 1, value => "导出" }. get(2) -> #{ id => 2, value => "导出" }. get(6) -> #{ id => 6, value => "导出" }. get(7) -> #{ id => 7, value => "导出" }. get(9) -> #{ id => 9, value => "测试" }. get(10) -> #{ id => 10, value => "测试" }. get(11) -> #{ id => 11, value => "any" }. get(12) -> #{ id => 12, value => "导出" }. get(13) -> #{ id => 13, value => "导出" }. get(104) -> #{ id => 104, value => "any" }. get(102) -> #{ id => 102, value => "test" }. get(3001) -> #{ id => 3001, value => "export" }. get(3004) -> #{ id => 3004, value => "any" }. get(3003) -> #{ id => 3003, value => "test" }. get_ids() -> [2001,2004,2003,100,1,2,6,7,9,10,11,12,13,104,102,3001,3004,3003]. <|start_filename|>Projects/GenerateDatas/convert_json/error.TbErrorInfo/EXAMPLE_MSGBOX.json<|end_filename|> { "code": "EXAMPLE_MSGBOX", "desc": "例子弹框,消息决定行为", "style": { "__type__": "ErrorStyleMsgbox", "btn_name": "要重启了", "operation": "重启" } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_GL_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_GL_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.GL(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.GL), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_Vertex3(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.GetFloat(false); UnityEngine.GL.Vertex3(Arg0,Arg1,Arg2); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_Vertex(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); UnityEngine.GL.Vertex(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_TexCoord3(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.GetFloat(false); UnityEngine.GL.TexCoord3(Arg0,Arg1,Arg2); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_TexCoord(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); UnityEngine.GL.TexCoord(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_TexCoord2(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.GetFloat(false); UnityEngine.GL.TexCoord2(Arg0,Arg1); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_MultiTexCoord3(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.GetFloat(false); UnityEngine.GL.MultiTexCoord3(Arg0,Arg1,Arg2,Arg3); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_MultiTexCoord(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3>(false); UnityEngine.GL.MultiTexCoord(Arg0,Arg1); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_MultiTexCoord2(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.GetFloat(false); UnityEngine.GL.MultiTexCoord2(Arg0,Arg1,Arg2); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_Color(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Color>(false); UnityEngine.GL.Color(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_Flush(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { { UnityEngine.GL.Flush(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_RenderTargetBarrier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { { UnityEngine.GL.RenderTargetBarrier(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_MultMatrix(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Matrix4x4>(false); UnityEngine.GL.MultMatrix(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_PushMatrix(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { { UnityEngine.GL.PushMatrix(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_PopMatrix(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { { UnityEngine.GL.PopMatrix(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_LoadIdentity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { { UnityEngine.GL.LoadIdentity(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_LoadOrtho(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { { UnityEngine.GL.LoadOrtho(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_LoadPixelMatrix(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 0) { { UnityEngine.GL.LoadPixelMatrix(); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.GetFloat(false); UnityEngine.GL.LoadPixelMatrix(Arg0,Arg1,Arg2,Arg3); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to LoadPixelMatrix"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_LoadProjectionMatrix(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Matrix4x4>(false); UnityEngine.GL.LoadProjectionMatrix(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_InvalidateState(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { { UnityEngine.GL.InvalidateState(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetGPUProjectionMatrix(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<UnityEngine.Matrix4x4>(false); var Arg1 = argHelper1.GetBoolean(false); var result = UnityEngine.GL.GetGPUProjectionMatrix(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_IssuePluginEvent(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<System.IntPtr>(false); var Arg1 = argHelper1.GetInt32(false); UnityEngine.GL.IssuePluginEvent(Arg0,Arg1); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_Begin(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); UnityEngine.GL.Begin(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_End(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { { UnityEngine.GL.End(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_Clear(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Color), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetBoolean(false); var Arg1 = argHelper1.GetBoolean(false); var Arg2 = argHelper2.Get<UnityEngine.Color>(false); var Arg3 = argHelper3.GetFloat(false); UnityEngine.GL.Clear(Arg0,Arg1,Arg2,Arg3); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Color), false, false)) { var Arg0 = argHelper0.GetBoolean(false); var Arg1 = argHelper1.GetBoolean(false); var Arg2 = argHelper2.Get<UnityEngine.Color>(false); UnityEngine.GL.Clear(Arg0,Arg1,Arg2); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to Clear"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_Viewport(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); UnityEngine.GL.Viewport(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_ClearWithSkybox(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.GetBoolean(false); var Arg1 = argHelper1.Get<UnityEngine.Camera>(false); UnityEngine.GL.ClearWithSkybox(Arg0,Arg1); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_wireframe(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.GL.wireframe; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_wireframe(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.GL.wireframe = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_sRGBWrite(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.GL.sRGBWrite; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_sRGBWrite(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.GL.sRGBWrite = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_invertCulling(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.GL.invertCulling; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_invertCulling(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.GL.invertCulling = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_modelview(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.GL.modelview; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_modelview(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.GL.modelview = argHelper.Get<UnityEngine.Matrix4x4>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_TRIANGLES(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.GL.TRIANGLES; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_TRIANGLE_STRIP(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.GL.TRIANGLE_STRIP; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_QUADS(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.GL.QUADS; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_LINES(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.GL.LINES; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_LINE_STRIP(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.GL.LINE_STRIP; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "Vertex3", IsStatic = true}, F_Vertex3 }, { new Puerts.MethodKey {Name = "Vertex", IsStatic = true}, F_Vertex }, { new Puerts.MethodKey {Name = "TexCoord3", IsStatic = true}, F_TexCoord3 }, { new Puerts.MethodKey {Name = "TexCoord", IsStatic = true}, F_TexCoord }, { new Puerts.MethodKey {Name = "TexCoord2", IsStatic = true}, F_TexCoord2 }, { new Puerts.MethodKey {Name = "MultiTexCoord3", IsStatic = true}, F_MultiTexCoord3 }, { new Puerts.MethodKey {Name = "MultiTexCoord", IsStatic = true}, F_MultiTexCoord }, { new Puerts.MethodKey {Name = "MultiTexCoord2", IsStatic = true}, F_MultiTexCoord2 }, { new Puerts.MethodKey {Name = "Color", IsStatic = true}, F_Color }, { new Puerts.MethodKey {Name = "Flush", IsStatic = true}, F_Flush }, { new Puerts.MethodKey {Name = "RenderTargetBarrier", IsStatic = true}, F_RenderTargetBarrier }, { new Puerts.MethodKey {Name = "MultMatrix", IsStatic = true}, F_MultMatrix }, { new Puerts.MethodKey {Name = "PushMatrix", IsStatic = true}, F_PushMatrix }, { new Puerts.MethodKey {Name = "PopMatrix", IsStatic = true}, F_PopMatrix }, { new Puerts.MethodKey {Name = "LoadIdentity", IsStatic = true}, F_LoadIdentity }, { new Puerts.MethodKey {Name = "LoadOrtho", IsStatic = true}, F_LoadOrtho }, { new Puerts.MethodKey {Name = "LoadPixelMatrix", IsStatic = true}, F_LoadPixelMatrix }, { new Puerts.MethodKey {Name = "LoadProjectionMatrix", IsStatic = true}, F_LoadProjectionMatrix }, { new Puerts.MethodKey {Name = "InvalidateState", IsStatic = true}, F_InvalidateState }, { new Puerts.MethodKey {Name = "GetGPUProjectionMatrix", IsStatic = true}, F_GetGPUProjectionMatrix }, { new Puerts.MethodKey {Name = "IssuePluginEvent", IsStatic = true}, F_IssuePluginEvent }, { new Puerts.MethodKey {Name = "Begin", IsStatic = true}, F_Begin }, { new Puerts.MethodKey {Name = "End", IsStatic = true}, F_End }, { new Puerts.MethodKey {Name = "Clear", IsStatic = true}, F_Clear }, { new Puerts.MethodKey {Name = "Viewport", IsStatic = true}, F_Viewport }, { new Puerts.MethodKey {Name = "ClearWithSkybox", IsStatic = true}, F_ClearWithSkybox }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"wireframe", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_wireframe, Setter = S_wireframe} }, {"sRGBWrite", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_sRGBWrite, Setter = S_sRGBWrite} }, {"invertCulling", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_invertCulling, Setter = S_invertCulling} }, {"modelview", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_modelview, Setter = S_modelview} }, {"TRIANGLES", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_TRIANGLES, Setter = null} }, {"TRIANGLE_STRIP", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_TRIANGLE_STRIP, Setter = null} }, {"QUADS", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_QUADS, Setter = null} }, {"LINES", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_LINES, Setter = null} }, {"LINE_STRIP", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_LINE_STRIP, Setter = null} }, } }; } } } <|start_filename|>Projects/GenerateDatas/convert_lua/mail.TbGlobalMail/23.lua<|end_filename|> return { id = 23, title = "", sender = "系统", content = "测试内容3", award = { 1, }, all_server = false, server_list = { 1, }, platform = "1", channel = "1", min_max_level = { min = 50, max = 60, }, register_time = { date_time_range = { end_time = 2020-5-17 00:00:00, }, }, mail_time = { date_time_range = { }, }, } <|start_filename|>Projects/Lua_Unity_xlua_lua/Assets/Lua/Data/test_tbtestref.lua<|end_filename|> return { [1] = {id=1,x1=1,x1_2=1,x2=2,a1={1,2,},a2={2,3,},b1={3,4,},b2={4,5,},c1={5,6,7,},c2={6,7,},d1={[1]=2,[3]=4,},d2={[1]=2,[3]=4,},}, } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_AnimationCurve_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_AnimationCurve_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { if (paramLen >= 0) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Keyframe), false, false)) { var Arg0 = argHelper0.GetParams<UnityEngine.Keyframe>(info, 0, paramLen); var result = new UnityEngine.AnimationCurve(Arg0); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.AnimationCurve), result); } } if (paramLen == 0) { { var result = new UnityEngine.AnimationCurve(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.AnimationCurve), result); } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.AnimationCurve constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Evaluate(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnimationCurve; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetFloat(false); var result = obj.Evaluate(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_AddKey(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnimationCurve; if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.GetFloat(false); var result = obj.AddKey(Arg0,Arg1); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Keyframe), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Keyframe>(false); var result = obj.AddKey(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to AddKey"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_MoveKey(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnimationCurve; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.Keyframe>(false); var result = obj.MoveKey(Arg0,Arg1); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_RemoveKey(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnimationCurve; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); obj.RemoveKey(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SmoothTangents(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnimationCurve; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetFloat(false); obj.SmoothTangents(Arg0,Arg1); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_Constant(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.GetFloat(false); var result = UnityEngine.AnimationCurve.Constant(Arg0,Arg1,Arg2); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_Linear(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.GetFloat(false); var result = UnityEngine.AnimationCurve.Linear(Arg0,Arg1,Arg2,Arg3); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_EaseInOut(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.GetFloat(false); var result = UnityEngine.AnimationCurve.EaseInOut(Arg0,Arg1,Arg2,Arg3); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Equals(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnimationCurve; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.Any, typeof(System.Object), false, false)) { var Arg0 = argHelper0.Get<System.Object>(false); var result = obj.Equals(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.AnimationCurve), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.AnimationCurve>(false); var result = obj.Equals(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to Equals"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetHashCode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnimationCurve; { { var result = obj.GetHashCode(); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_keys(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnimationCurve; var result = obj.keys; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_keys(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnimationCurve; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.keys = argHelper.Get<UnityEngine.Keyframe[]>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_length(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnimationCurve; var result = obj.length; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_preWrapMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnimationCurve; var result = obj.preWrapMode; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_preWrapMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnimationCurve; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.preWrapMode = (UnityEngine.WrapMode)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_postWrapMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnimationCurve; var result = obj.postWrapMode; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_postWrapMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnimationCurve; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.postWrapMode = (UnityEngine.WrapMode)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void GetItem(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnimationCurve; var keyHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (keyHelper.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var key = keyHelper.GetInt32(false); var result = obj[key]; Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "Evaluate", IsStatic = false}, M_Evaluate }, { new Puerts.MethodKey {Name = "AddKey", IsStatic = false}, M_AddKey }, { new Puerts.MethodKey {Name = "MoveKey", IsStatic = false}, M_MoveKey }, { new Puerts.MethodKey {Name = "RemoveKey", IsStatic = false}, M_RemoveKey }, { new Puerts.MethodKey {Name = "SmoothTangents", IsStatic = false}, M_SmoothTangents }, { new Puerts.MethodKey {Name = "Constant", IsStatic = true}, F_Constant }, { new Puerts.MethodKey {Name = "Linear", IsStatic = true}, F_Linear }, { new Puerts.MethodKey {Name = "EaseInOut", IsStatic = true}, F_EaseInOut }, { new Puerts.MethodKey {Name = "Equals", IsStatic = false}, M_Equals }, { new Puerts.MethodKey {Name = "GetHashCode", IsStatic = false}, M_GetHashCode }, { new Puerts.MethodKey {Name = "get_Item", IsStatic = false}, GetItem }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"keys", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_keys, Setter = S_keys} }, {"length", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_length, Setter = null} }, {"preWrapMode", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_preWrapMode, Setter = S_preWrapMode} }, {"postWrapMode", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_postWrapMode, Setter = S_postWrapMode} }, } }; } } } <|start_filename|>Projects/DataTemplates/template_erlang2/test_tbdetectcsvencoding.erl<|end_filename|> %% test.TbDetectCsvEncoding -module(test_tbdetectcsvencoding) -export([get/1,get_ids/0]) get(21) -> #{ id => 21, name => "测试编码" }. get(22) -> #{ id => 22, name => "还果园国要" }. get(23) -> #{ id => 23, name => "工枯加盟仍" }. get(11) -> #{ id => 11, name => "测试编码" }. get(12) -> #{ id => 12, name => "还果园国要" }. get(13) -> #{ id => 13, name => "工枯加盟仍" }. get(31) -> #{ id => 31, name => "测试编码" }. get(32) -> #{ id => 32, name => "还果园国要" }. get(33) -> #{ id => 33, name => "工枯加盟仍" }. get(1) -> #{ id => 1, name => "测试编码" }. get(2) -> #{ id => 2, name => "还果园国要" }. get(3) -> #{ id => 3, name => "工枯加盟仍" }. get_ids() -> [21,22,23,11,12,13,31,32,33,1,2,3]. <|start_filename|>Projects/Go_json/gen/src/cfg/role.EProfession.go<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg const ( RoleEProfession_TEST_PROFESSION = 1 ) <|start_filename|>Projects/GenerateDatas/convert_lua/test.TbTestBeRef/6.lua<|end_filename|> return { id = 6, count = 10, } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_RectTransformUtility_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_RectTransformUtility_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.RectTransformUtility constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_PixelAdjustPoint(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Transform>(false); var Arg2 = argHelper2.Get<UnityEngine.Canvas>(false); var result = UnityEngine.RectTransformUtility.PixelAdjustPoint(Arg0,Arg1,Arg2); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_PixelAdjustRect(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<UnityEngine.RectTransform>(false); var Arg1 = argHelper1.Get<UnityEngine.Canvas>(false); var result = UnityEngine.RectTransformUtility.PixelAdjustRect(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_RectangleContainsScreenPoint(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RectTransform), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.RectTransform>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var result = UnityEngine.RectTransformUtility.RectangleContainsScreenPoint(Arg0,Arg1); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RectTransform), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Camera), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.RectTransform>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.Get<UnityEngine.Camera>(false); var result = UnityEngine.RectTransformUtility.RectangleContainsScreenPoint(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RectTransform), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Camera), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector4), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.RectTransform>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.Get<UnityEngine.Camera>(false); var Arg3 = argHelper3.Get<UnityEngine.Vector4>(false); var result = UnityEngine.RectTransformUtility.RectangleContainsScreenPoint(Arg0,Arg1,Arg2,Arg3); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to RectangleContainsScreenPoint"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_ScreenPointToWorldPointInRectangle(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); { var Arg0 = argHelper0.Get<UnityEngine.RectTransform>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.Get<UnityEngine.Camera>(false); var Arg3 = argHelper3.Get<UnityEngine.Vector3>(true); var result = UnityEngine.RectTransformUtility.ScreenPointToWorldPointInRectangle(Arg0,Arg1,Arg2,out Arg3); argHelper3.SetByRefValue(Arg3); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_ScreenPointToLocalPointInRectangle(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); { var Arg0 = argHelper0.Get<UnityEngine.RectTransform>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = argHelper2.Get<UnityEngine.Camera>(false); var Arg3 = argHelper3.Get<UnityEngine.Vector2>(true); var result = UnityEngine.RectTransformUtility.ScreenPointToLocalPointInRectangle(Arg0,Arg1,Arg2,out Arg3); argHelper3.SetByRefValue(Arg3); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_ScreenPointToRay(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<UnityEngine.Camera>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var result = UnityEngine.RectTransformUtility.ScreenPointToRay(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_WorldToScreenPoint(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<UnityEngine.Camera>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3>(false); var result = UnityEngine.RectTransformUtility.WorldToScreenPoint(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_CalculateRelativeRectTransformBounds(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Transform), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Transform), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Transform>(false); var Arg1 = argHelper1.Get<UnityEngine.Transform>(false); var result = UnityEngine.RectTransformUtility.CalculateRelativeRectTransformBounds(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Transform), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Transform>(false); var result = UnityEngine.RectTransformUtility.CalculateRelativeRectTransformBounds(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to CalculateRelativeRectTransformBounds"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_FlipLayoutOnAxis(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); { var Arg0 = argHelper0.Get<UnityEngine.RectTransform>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetBoolean(false); var Arg3 = argHelper3.GetBoolean(false); UnityEngine.RectTransformUtility.FlipLayoutOnAxis(Arg0,Arg1,Arg2,Arg3); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_FlipLayoutAxes(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.Get<UnityEngine.RectTransform>(false); var Arg1 = argHelper1.GetBoolean(false); var Arg2 = argHelper2.GetBoolean(false); UnityEngine.RectTransformUtility.FlipLayoutAxes(Arg0,Arg1,Arg2); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "PixelAdjustPoint", IsStatic = true}, F_PixelAdjustPoint }, { new Puerts.MethodKey {Name = "PixelAdjustRect", IsStatic = true}, F_PixelAdjustRect }, { new Puerts.MethodKey {Name = "RectangleContainsScreenPoint", IsStatic = true}, F_RectangleContainsScreenPoint }, { new Puerts.MethodKey {Name = "ScreenPointToWorldPointInRectangle", IsStatic = true}, F_ScreenPointToWorldPointInRectangle }, { new Puerts.MethodKey {Name = "ScreenPointToLocalPointInRectangle", IsStatic = true}, F_ScreenPointToLocalPointInRectangle }, { new Puerts.MethodKey {Name = "ScreenPointToRay", IsStatic = true}, F_ScreenPointToRay }, { new Puerts.MethodKey {Name = "WorldToScreenPoint", IsStatic = true}, F_WorldToScreenPoint }, { new Puerts.MethodKey {Name = "CalculateRelativeRectTransformBounds", IsStatic = true}, F_CalculateRelativeRectTransformBounds }, { new Puerts.MethodKey {Name = "FlipLayoutOnAxis", IsStatic = true}, F_FlipLayoutOnAxis }, { new Puerts.MethodKey {Name = "FlipLayoutAxes", IsStatic = true}, F_FlipLayoutAxes }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { } }; } } } <|start_filename|>Projects/GenerateDatas/convert_lua/item.TbItemExtra/1040040001.lua<|end_filename|> return { _name = 'InteractionItem', id = 1040040001, holding_static_mesh = "StaticMesh'/Game/X6GameData/Prototype/PrototypeAssets/StaticMesh/SM_Ball.SM_Ball'", holding_static_mesh_mat = "MaterialInstanceConstant'/Game/X6GameData/Prototype/PrototypeAssets/CustomizableGrid/Materials/Presets/M_Grid_preset_002.M_Grid_preset_002'", } <|start_filename|>Projects/Lua_Unity_xlua_lua/Assets/Lua/Data/test_tbdemogroupdefinefromexcel.lua<|end_filename|> return { [1] = {id=1,x1=1,x2=2,x3=3,x4=4,x5={y1=10,y2=20,y3=30,y4=40,},}, [2] = {id=2,x1=1,x2=2,x3=3,x4=4,x5={y1=10,y2=20,y3=30,y4=40,},}, [3] = {id=3,x1=1,x2=2,x3=3,x4=4,x5={y1=10,y2=20,y3=30,y4=40,},}, [4] = {id=4,x1=1,x2=2,x3=3,x4=4,x5={y1=10,y2=20,y3=30,y4=40,},}, } <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/test/MultiRowRecord.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.test { public sealed partial class MultiRowRecord : Bright.Config.BeanBase { public MultiRowRecord(ByteBuf _buf) { Id = _buf.ReadInt(); Name = _buf.ReadString(); {int n = System.Math.Min(_buf.ReadSize(), _buf.Size);OneRows = new System.Collections.Generic.List<test.MultiRowType1>(n);for(var i = 0 ; i < n ; i++) { test.MultiRowType1 _e; _e = test.MultiRowType1.DeserializeMultiRowType1(_buf); OneRows.Add(_e);}} {int n = System.Math.Min(_buf.ReadSize(), _buf.Size);MultiRows1 = new System.Collections.Generic.List<test.MultiRowType1>(n);for(var i = 0 ; i < n ; i++) { test.MultiRowType1 _e; _e = test.MultiRowType1.DeserializeMultiRowType1(_buf); MultiRows1.Add(_e);}} {int n = System.Math.Min(_buf.ReadSize(), _buf.Size);MultiRows2 = new test.MultiRowType1[n];for(var i = 0 ; i < n ; i++) { test.MultiRowType1 _e;_e = test.MultiRowType1.DeserializeMultiRowType1(_buf); MultiRows2[i] = _e;}} {int n = System.Math.Min(_buf.ReadSize(), _buf.Size);MultiRows3 = new System.Collections.Generic.HashSet<test.MultiRowType2>(/*n * 3 / 2*/);for(var i = 0 ; i < n ; i++) { test.MultiRowType2 _e; _e = test.MultiRowType2.DeserializeMultiRowType2(_buf); MultiRows3.Add(_e);}} {int n = System.Math.Min(_buf.ReadSize(), _buf.Size);MultiRows4 = new System.Collections.Generic.Dictionary<int, test.MultiRowType2>(n * 3 / 2);for(var i = 0 ; i < n ; i++) { int _k; _k = _buf.ReadInt(); test.MultiRowType2 _v; _v = test.MultiRowType2.DeserializeMultiRowType2(_buf); MultiRows4.Add(_k, _v);}} {int n = System.Math.Min(_buf.ReadSize(), _buf.Size);MultiRows5 = new System.Collections.Generic.List<test.MultiRowType3>(n);for(var i = 0 ; i < n ; i++) { test.MultiRowType3 _e; _e = test.MultiRowType3.DeserializeMultiRowType3(_buf); MultiRows5.Add(_e);}} } public MultiRowRecord(int id, string name, System.Collections.Generic.List<test.MultiRowType1> one_rows, System.Collections.Generic.List<test.MultiRowType1> multi_rows1, test.MultiRowType1[] multi_rows2, System.Collections.Generic.HashSet<test.MultiRowType2> multi_rows3, System.Collections.Generic.Dictionary<int, test.MultiRowType2> multi_rows4, System.Collections.Generic.List<test.MultiRowType3> multi_rows5 ) { this.Id = id; this.Name = name; this.OneRows = one_rows; this.MultiRows1 = multi_rows1; this.MultiRows2 = multi_rows2; this.MultiRows3 = multi_rows3; this.MultiRows4 = multi_rows4; this.MultiRows5 = multi_rows5; } public static MultiRowRecord DeserializeMultiRowRecord(ByteBuf _buf) { return new test.MultiRowRecord(_buf); } public readonly int Id; public readonly string Name; public readonly System.Collections.Generic.List<test.MultiRowType1> OneRows; public readonly System.Collections.Generic.List<test.MultiRowType1> MultiRows1; public readonly test.MultiRowType1[] MultiRows2; public readonly System.Collections.Generic.HashSet<test.MultiRowType2> MultiRows3; public readonly System.Collections.Generic.Dictionary<int, test.MultiRowType2> MultiRows4; public readonly System.Collections.Generic.List<test.MultiRowType3> MultiRows5; public const int ID = -501249394; public override int GetTypeId() => ID; public void Resolve(Dictionary<string, object> _tables) { foreach(var _e in OneRows) { _e?.Resolve(_tables); } foreach(var _e in MultiRows1) { _e?.Resolve(_tables); } foreach(var _e in MultiRows2) { _e?.Resolve(_tables); } foreach(var _e in MultiRows4.Values) { _e?.Resolve(_tables); } foreach(var _e in MultiRows5) { _e?.Resolve(_tables); } OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); public override string ToString() { return "{ " + "Id:" + Id + "," + "Name:" + Name + "," + "OneRows:" + Bright.Common.StringUtil.CollectionToString(OneRows) + "," + "MultiRows1:" + Bright.Common.StringUtil.CollectionToString(MultiRows1) + "," + "MultiRows2:" + Bright.Common.StringUtil.CollectionToString(MultiRows2) + "," + "MultiRows3:" + Bright.Common.StringUtil.CollectionToString(MultiRows3) + "," + "MultiRows4:" + Bright.Common.StringUtil.CollectionToString(MultiRows4) + "," + "MultiRows5:" + Bright.Common.StringUtil.CollectionToString(MultiRows5) + "," + "}"; } } } <|start_filename|>Projects/DataTemplates/template_erlang/test_tbteststring.erl<|end_filename|> %% test.TbTestString get(1) -> #{id => 1,s1 => "asfas",cs1 => #{id => 1,s2 => "asf",s3 => "aaa"},cs2 => #{id => 1,s2 => "asf",s3 => "aaa"}}. get(2) -> #{id => 2,s1 => "adsf\"",cs1 => #{id => 2,s2 => "",s3 => "bbb"},cs2 => #{id => 2,s2 => "",s3 => "bbb"}}. get(3) -> #{id => 3,s1 => "升级到10级\"\"",cs1 => #{id => 3,s2 => "asdfas",s3 => ""},cs2 => #{id => 3,s2 => "asdfas",s3 => ""}}. get(4) -> #{id => 4,s1 => "asdfa",cs1 => #{id => 4,s2 => "",s3 => ""},cs2 => #{id => 4,s2 => "",s3 => ""}}. <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_Camera_RenderRequest_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_Camera_RenderRequest_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RenderTexture), false, false)) { var Arg0 = (UnityEngine.Camera.RenderRequestMode)argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.RenderTexture>(false); var result = new UnityEngine.Camera.RenderRequest(Arg0,Arg1); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.Camera.RenderRequest), result); } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RenderTexture), false, false)) { var Arg0 = (UnityEngine.Camera.RenderRequestMode)argHelper0.GetInt32(false); var Arg1 = (UnityEngine.Camera.RenderRequestOutputSpace)argHelper1.GetInt32(false); var Arg2 = argHelper2.Get<UnityEngine.RenderTexture>(false); var result = new UnityEngine.Camera.RenderRequest(Arg0,Arg1,Arg2); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.Camera.RenderRequest), result); } } if (paramLen == 0) { { var result = new UnityEngine.Camera.RenderRequest(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.Camera.RenderRequest), result); } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.Camera.RenderRequest constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_isValid(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Camera.RenderRequest)Puerts.Utils.GetSelf((int)data, self); var result = obj.isValid; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_mode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Camera.RenderRequest)Puerts.Utils.GetSelf((int)data, self); var result = obj.mode; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_result(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Camera.RenderRequest)Puerts.Utils.GetSelf((int)data, self); var result = obj.result; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_outputSpace(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Camera.RenderRequest)Puerts.Utils.GetSelf((int)data, self); var result = obj.outputSpace; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"isValid", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_isValid, Setter = null} }, {"mode", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_mode, Setter = null} }, {"result", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_result, Setter = null} }, {"outputSpace", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_outputSpace, Setter = null} }, } }; } } } <|start_filename|>Projects/GenerateDatas/convert_lua/tag.TbTestTag/3004.lua<|end_filename|> return { id = 3004, value = "any", } <|start_filename|>Projects/GenerateDatas/convert_lua/error.TbCodeInfo/904.lua<|end_filename|> return { code = 904, key = "SUIT_COMPONENT_NO_NEED_LEARN", } <|start_filename|>Projects/GenerateDatas/convert_lua/item.TbItemExtra/1110020014.lua<|end_filename|> return { _name = 'DesignDrawing', id = 1110020014, learn_component_id = { 1021009024, }, } <|start_filename|>Projects/Csharp_DotNet5_json_ExportServer/Program.cs<|end_filename|> using Bright.Serialization; using System; using System.IO; using System.Text.Json; namespace Csharp_Server_DotNetCore { class Program { static void Main(string[] args) { var tables = new cfg.Tables(LoadJson); Console.WriteLine("== load succ =="); } private static JsonElement LoadJson(string file) { return JsonDocument.Parse(System.IO.File.ReadAllBytes("../../../json_server/" + file + ".json")).RootElement; } } } <|start_filename|>Projects/Java_bin/src/main/gen/cfg/blueprint/Clazz.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.blueprint; import bright.serialization.*; public abstract class Clazz { public Clazz(ByteBuf _buf) { name = _buf.readString(); desc = _buf.readString(); {int n = Math.min(_buf.readSize(), _buf.size());parents = new java.util.ArrayList<cfg.blueprint.Clazz>(n);for(int i = 0 ; i < n ; i++) { cfg.blueprint.Clazz _e; _e = cfg.blueprint.Clazz.deserializeClazz(_buf); parents.add(_e);}} {int n = Math.min(_buf.readSize(), _buf.size());methods = new java.util.ArrayList<cfg.blueprint.Method>(n);for(int i = 0 ; i < n ; i++) { cfg.blueprint.Method _e; _e = cfg.blueprint.Method.deserializeMethod(_buf); methods.add(_e);}} } public Clazz(String name, String desc, java.util.ArrayList<cfg.blueprint.Clazz> parents, java.util.ArrayList<cfg.blueprint.Method> methods ) { this.name = name; this.desc = desc; this.parents = parents; this.methods = methods; } public static Clazz deserializeClazz(ByteBuf _buf) { switch (_buf.readInt()) { case cfg.blueprint.Interface.__ID__: return new cfg.blueprint.Interface(_buf); case cfg.blueprint.NormalClazz.__ID__: return new cfg.blueprint.NormalClazz(_buf); case cfg.blueprint.EnumClazz.__ID__: return new cfg.blueprint.EnumClazz(_buf); default: throw new SerializationException(); } } public final String name; public final String desc; public final java.util.ArrayList<cfg.blueprint.Clazz> parents; public final java.util.ArrayList<cfg.blueprint.Method> methods; public abstract int getTypeId(); public void resolve(java.util.HashMap<String, Object> _tables) { for(cfg.blueprint.Clazz _e : parents) { if (_e != null) _e.resolve(_tables); } for(cfg.blueprint.Method _e : methods) { if (_e != null) _e.resolve(_tables); } } @Override public String toString() { return "{ " + "name:" + name + "," + "desc:" + desc + "," + "parents:" + parents + "," + "methods:" + methods + "," + "}"; } } <|start_filename|>Projects/Java_bin/src/main/gen/cfg/ai/BlackboardKey.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.ai; import bright.serialization.*; public final class BlackboardKey { public BlackboardKey(ByteBuf _buf) { name = _buf.readString(); desc = _buf.readString(); isStatic = _buf.readBool(); type = cfg.ai.EKeyType.valueOf(_buf.readInt()); typeClassName = _buf.readString(); } public BlackboardKey(String name, String desc, boolean is_static, cfg.ai.EKeyType type, String type_class_name ) { this.name = name; this.desc = desc; this.isStatic = is_static; this.type = type; this.typeClassName = type_class_name; } public final String name; public final String desc; public final boolean isStatic; public final cfg.ai.EKeyType type; public final String typeClassName; public void resolve(java.util.HashMap<String, Object> _tables) { } @Override public String toString() { return "{ " + "name:" + name + "," + "desc:" + desc + "," + "isStatic:" + isStatic + "," + "type:" + type + "," + "typeClassName:" + typeClassName + "," + "}"; } } <|start_filename|>Projects/java_json/src/corelib/bright/math/Vector2.java<|end_filename|> package bright.math; public class Vector2 { public float x; public float y; public Vector2(float x, float y) { this.x = x; this.y = y; } } <|start_filename|>Projects/DataTemplates/template_erlang2/blueprint_tbclazz.erl<|end_filename|> %% blueprint.TbClazz -module(blueprint_tbclazz) -export([get/1,get_ids/0]) get("int") -> #{ name => "int", desc => "primity type:int", parents => array, methods => array, is_abstract => false, fields => array }. get_ids() -> [int]. <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_LocationInfo_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_LocationInfo_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.LocationInfo constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_latitude(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.LocationInfo)Puerts.Utils.GetSelf((int)data, self); var result = obj.latitude; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_longitude(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.LocationInfo)Puerts.Utils.GetSelf((int)data, self); var result = obj.longitude; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_altitude(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.LocationInfo)Puerts.Utils.GetSelf((int)data, self); var result = obj.altitude; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_horizontalAccuracy(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.LocationInfo)Puerts.Utils.GetSelf((int)data, self); var result = obj.horizontalAccuracy; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_verticalAccuracy(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.LocationInfo)Puerts.Utils.GetSelf((int)data, self); var result = obj.verticalAccuracy; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_timestamp(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.LocationInfo)Puerts.Utils.GetSelf((int)data, self); var result = obj.timestamp; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"latitude", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_latitude, Setter = null} }, {"longitude", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_longitude, Setter = null} }, {"altitude", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_altitude, Setter = null} }, {"horizontalAccuracy", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_horizontalAccuracy, Setter = null} }, {"verticalAccuracy", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_verticalAccuracy, Setter = null} }, {"timestamp", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_timestamp, Setter = null} }, } }; } } } <|start_filename|>Projects/GenerateDatas/convert_lua/role.TbRoleLevelExpAttr/56.lua<|end_filename|> return { level = 56, need_exp = 105000, clothes_attrs = { 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, }, } <|start_filename|>Projects/Java_bin/src/main/gen/cfg/condition/MinMaxLevel.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.condition; import bright.serialization.*; public final class MinMaxLevel extends cfg.condition.BoolRoleCondition { public MinMaxLevel(ByteBuf _buf) { super(_buf); min = _buf.readInt(); max = _buf.readInt(); } public MinMaxLevel(int min, int max ) { super(); this.min = min; this.max = max; } public final int min; public final int max; public static final int __ID__ = 907499647; @Override public int getTypeId() { return __ID__; } @Override public void resolve(java.util.HashMap<String, Object> _tables) { super.resolve(_tables); } @Override public String toString() { return "{ " + "min:" + min + "," + "max:" + max + "," + "}"; } } <|start_filename|>Projects/java_json/src/gen/cfg/blueprint/Clazz.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.blueprint; import com.google.gson.JsonElement; import com.google.gson.JsonObject; public abstract class Clazz { public Clazz(JsonObject __json__) { name = __json__.get("name").getAsString(); desc = __json__.get("desc").getAsString(); { com.google.gson.JsonArray _json0_ = __json__.get("parents").getAsJsonArray(); parents = new java.util.ArrayList<cfg.blueprint.Clazz>(_json0_.size()); for(JsonElement __e : _json0_) { cfg.blueprint.Clazz __v; __v = cfg.blueprint.Clazz.deserializeClazz(__e.getAsJsonObject()); parents.add(__v); } } { com.google.gson.JsonArray _json0_ = __json__.get("methods").getAsJsonArray(); methods = new java.util.ArrayList<cfg.blueprint.Method>(_json0_.size()); for(JsonElement __e : _json0_) { cfg.blueprint.Method __v; __v = cfg.blueprint.Method.deserializeMethod(__e.getAsJsonObject()); methods.add(__v); } } } public Clazz(String name, String desc, java.util.ArrayList<cfg.blueprint.Clazz> parents, java.util.ArrayList<cfg.blueprint.Method> methods ) { this.name = name; this.desc = desc; this.parents = parents; this.methods = methods; } public static Clazz deserializeClazz(JsonObject __json__) { switch (__json__.get("__type__").getAsString()) { case "Interface": return new cfg.blueprint.Interface(__json__); case "NormalClazz": return new cfg.blueprint.NormalClazz(__json__); case "EnumClazz": return new cfg.blueprint.EnumClazz(__json__); default: throw new bright.serialization.SerializationException(); } } public final String name; public final String desc; public final java.util.ArrayList<cfg.blueprint.Clazz> parents; public final java.util.ArrayList<cfg.blueprint.Method> methods; public abstract int getTypeId(); public void resolve(java.util.HashMap<String, Object> _tables) { for(cfg.blueprint.Clazz _e : parents) { if (_e != null) _e.resolve(_tables); } for(cfg.blueprint.Method _e : methods) { if (_e != null) _e.resolve(_tables); } } @Override public String toString() { return "{ " + "name:" + name + "," + "desc:" + desc + "," + "parents:" + parents + "," + "methods:" + methods + "," + "}"; } } <|start_filename|>Projects/Go_json/gen/src/cfg/test.TestNull.go<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg import "errors" type TestTestNull struct { Id int32 X1 *int32 X2 *int32 X3 *TestDemoType1 X4 interface{} S1 *string S2 *string } const TypeId_TestTestNull = 339868469 func (*TestTestNull) GetTypeId() int32 { return 339868469 } func (_v *TestTestNull)Deserialize(_buf map[string]interface{}) (err error) { { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["id"].(float64); !_ok_ { err = errors.New("id error"); return }; _v.Id = int32(_tempNum_) } { var _ok_ bool; var __json_x1__ interface{}; if __json_x1__, _ok_ = _buf["x1"]; !_ok_ || __json_x1__ == nil { return } else { var __x__ int32; { var _ok_ bool; var _x_ float64; if _x_, _ok_ = __json_x1__.(float64); !_ok_ { err = errors.New("__x__ error"); return }; __x__ = int32(_x_) }; _v.X1 = &__x__ }} { var _ok_ bool; var __json_x2__ interface{}; if __json_x2__, _ok_ = _buf["x2"]; !_ok_ || __json_x2__ == nil { return } else { var __x__ int32; { var _ok_ bool; var _x_ float64; if _x_, _ok_ = __json_x2__.(float64); !_ok_ { err = errors.New("__x__ error"); return }; __x__ = int32(_x_) }; _v.X2 = &__x__ }} { var _ok_ bool; var __json_x3__ interface{}; if __json_x3__, _ok_ = _buf["x3"]; !_ok_ || __json_x3__ == nil { return } else { var __x__ *TestDemoType1; { var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = __json_x3__.(map[string]interface{}); !_ok_ { err = errors.New("__x__ error"); return }; if __x__, err = DeserializeTestDemoType1(_x_); err != nil { return } }; _v.X3 = __x__ }} { var _ok_ bool; var __json_x4__ interface{}; if __json_x4__, _ok_ = _buf["x4"]; !_ok_ || __json_x4__ == nil { return } else { var __x__ interface{}; { var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = __json_x4__.(map[string]interface{}); !_ok_ { err = errors.New("__x__ error"); return }; if __x__, err = DeserializeTestDemoDynamic(_x_); err != nil { return } }; _v.X4 = __x__ }} { var _ok_ bool; var __json_s1__ interface{}; if __json_s1__, _ok_ = _buf["s1"]; !_ok_ || __json_s1__ == nil { return } else { var __x__ string; { if __x__, _ok_ = __json_s1__.(string); !_ok_ { err = errors.New("__x__ error"); return } }; _v.S1 = &__x__ }} { var _ok_ bool; var __json_s2__ interface{}; if __json_s2__, _ok_ = _buf["s2"]; !_ok_ || __json_s2__ == nil { return } else { var __x__ string; {var _ok_ bool; var __json_text__ map[string]interface{}; if __json_text__, _ok_ = __json_s2__.(map[string]interface{}) ; !_ok_ { err = errors.New("__x__ error"); return }; { if _, _ok_ = __json_text__["key"].(string); !_ok_ { err = errors.New("_ error"); return } }; { if __x__, _ok_ = __json_text__["text"].(string); !_ok_ { err = errors.New("__x__ error"); return } } }; _v.S2 = &__x__ }} return } func DeserializeTestTestNull(_buf map[string]interface{}) (*TestTestNull, error) { v := &TestTestNull{} if err := v.Deserialize(_buf); err == nil { return v, nil } else { return nil, err } } <|start_filename|>Projects/GenerateDatas/convert_lua/l10n.TbPatchDemo/15.lua<|end_filename|> return { id = 15, value = 5, } <|start_filename|>Projects/java_json/src/gen/cfg/ai/ChooseTarget.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.ai; import com.google.gson.JsonElement; import com.google.gson.JsonObject; public final class ChooseTarget extends cfg.ai.Service { public ChooseTarget(JsonObject __json__) { super(__json__); resultTargetKey = __json__.get("result_target_key").getAsString(); } public ChooseTarget(int id, String node_name, String result_target_key ) { super(id, node_name); this.resultTargetKey = result_target_key; } public static ChooseTarget deserializeChooseTarget(JsonObject __json__) { return new ChooseTarget(__json__); } public final String resultTargetKey; public static final int __ID__ = 1601247918; @Override public int getTypeId() { return __ID__; } @Override public void resolve(java.util.HashMap<String, Object> _tables) { super.resolve(_tables); } @Override public String toString() { return "{ " + "id:" + id + "," + "nodeName:" + nodeName + "," + "resultTargetKey:" + resultTargetKey + "," + "}"; } } <|start_filename|>Projects/Lua_Unity_xlua_lua/Assets/Lua/Data/test_tbcompositejsontable1.lua<|end_filename|> return { [1] = {id=1,x="aaa1",}, [2] = {id=2,x="xx2",}, [11] = {id=11,x="aaa11",}, [12] = {id=12,x="xx12",}, } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_Object_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_Object_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.Object(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.Object), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetInstanceID(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Object; { { var result = obj.GetInstanceID(); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetHashCode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Object; { { var result = obj.GetHashCode(); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Equals(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Object; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.Object>(false); var result = obj.Equals(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_Instantiate(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Object), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Quaternion), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Object>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3>(false); var Arg2 = argHelper2.Get<UnityEngine.Quaternion>(false); var result = UnityEngine.Object.Instantiate(Arg0,Arg1,Arg2); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Object), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Transform), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Object>(false); var Arg1 = argHelper1.Get<UnityEngine.Transform>(false); var Arg2 = argHelper2.GetBoolean(false); var result = UnityEngine.Object.Instantiate(Arg0,Arg1,Arg2); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Object), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Quaternion), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Object>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3>(false); var Arg2 = argHelper2.Get<UnityEngine.Quaternion>(false); var result = UnityEngine.Object.Instantiate(Arg0,Arg1,Arg2); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Object), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Transform), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Object>(false); var Arg1 = argHelper1.Get<UnityEngine.Transform>(false); var Arg2 = argHelper2.GetBoolean(false); var result = UnityEngine.Object.Instantiate(Arg0,Arg1,Arg2); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Object), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Quaternion), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Transform), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Object>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3>(false); var Arg2 = argHelper2.Get<UnityEngine.Quaternion>(false); var Arg3 = argHelper3.Get<UnityEngine.Transform>(false); var result = UnityEngine.Object.Instantiate(Arg0,Arg1,Arg2,Arg3); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Object), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Quaternion), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Transform), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Object>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3>(false); var Arg2 = argHelper2.Get<UnityEngine.Quaternion>(false); var Arg3 = argHelper3.Get<UnityEngine.Transform>(false); var result = UnityEngine.Object.Instantiate(Arg0,Arg1,Arg2,Arg3); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Object), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Object>(false); var result = UnityEngine.Object.Instantiate(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Object), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Object>(false); var result = UnityEngine.Object.Instantiate(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Object), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Transform), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Object>(false); var Arg1 = argHelper1.Get<UnityEngine.Transform>(false); var result = UnityEngine.Object.Instantiate(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Object), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Transform), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Object>(false); var Arg1 = argHelper1.Get<UnityEngine.Transform>(false); var result = UnityEngine.Object.Instantiate(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to Instantiate"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_Destroy(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Object), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Object>(false); var Arg1 = argHelper1.GetFloat(false); UnityEngine.Object.Destroy(Arg0,Arg1); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Object), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Object>(false); UnityEngine.Object.Destroy(Arg0); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to Destroy"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_DestroyImmediate(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Object), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Object>(false); var Arg1 = argHelper1.GetBoolean(false); UnityEngine.Object.DestroyImmediate(Arg0,Arg1); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Object), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Object>(false); UnityEngine.Object.DestroyImmediate(Arg0); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to DestroyImmediate"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_FindObjectsOfType(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Type), false, false)) { var Arg0 = argHelper0.Get<System.Type>(false); var result = UnityEngine.Object.FindObjectsOfType(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Type), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.Get<System.Type>(false); var Arg1 = argHelper1.GetBoolean(false); var result = UnityEngine.Object.FindObjectsOfType(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to FindObjectsOfType"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_DontDestroyOnLoad(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Object>(false); UnityEngine.Object.DontDestroyOnLoad(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_FindObjectOfType(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Type), false, false)) { var Arg0 = argHelper0.Get<System.Type>(false); var result = UnityEngine.Object.FindObjectOfType(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Type), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.Get<System.Type>(false); var Arg1 = argHelper1.GetBoolean(false); var result = UnityEngine.Object.FindObjectOfType(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to FindObjectOfType"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ToString(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Object; { { var result = obj.ToString(); Puerts.PuertsDLL.ReturnString(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_name(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Object; var result = obj.name; Puerts.PuertsDLL.ReturnString(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_name(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Object; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.name = argHelper.GetString(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_hideFlags(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Object; var result = obj.hideFlags; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_hideFlags(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Object; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.hideFlags = (UnityEngine.HideFlags)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void O_op_Equality(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var arg0 = argHelper0.Get<UnityEngine.Object>(false); var arg1 = argHelper1.Get<UnityEngine.Object>(false); var result = arg0 == arg1; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void O_op_Inequality(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var arg0 = argHelper0.Get<UnityEngine.Object>(false); var arg1 = argHelper1.Get<UnityEngine.Object>(false); var result = arg0 != arg1; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "GetInstanceID", IsStatic = false}, M_GetInstanceID }, { new Puerts.MethodKey {Name = "GetHashCode", IsStatic = false}, M_GetHashCode }, { new Puerts.MethodKey {Name = "Equals", IsStatic = false}, M_Equals }, { new Puerts.MethodKey {Name = "Instantiate", IsStatic = true}, F_Instantiate }, { new Puerts.MethodKey {Name = "Destroy", IsStatic = true}, F_Destroy }, { new Puerts.MethodKey {Name = "DestroyImmediate", IsStatic = true}, F_DestroyImmediate }, { new Puerts.MethodKey {Name = "FindObjectsOfType", IsStatic = true}, F_FindObjectsOfType }, { new Puerts.MethodKey {Name = "DontDestroyOnLoad", IsStatic = true}, F_DontDestroyOnLoad }, { new Puerts.MethodKey {Name = "FindObjectOfType", IsStatic = true}, F_FindObjectOfType }, { new Puerts.MethodKey {Name = "ToString", IsStatic = false}, M_ToString }, { new Puerts.MethodKey {Name = "op_Equality", IsStatic = true}, O_op_Equality}, { new Puerts.MethodKey {Name = "op_Inequality", IsStatic = true}, O_op_Inequality}, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"name", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_name, Setter = S_name} }, {"hideFlags", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_hideFlags, Setter = S_hideFlags} }, } }; } } } <|start_filename|>Projects/java_json/src/gen/cfg/role/LevelBonus.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.role; import com.google.gson.JsonElement; import com.google.gson.JsonObject; public final class LevelBonus { public LevelBonus(JsonObject __json__) { id = __json__.get("id").getAsInt(); { com.google.gson.JsonArray _json0_ = __json__.get("distinct_bonus_infos").getAsJsonArray(); distinctBonusInfos = new java.util.ArrayList<cfg.role.DistinctBonusInfos>(_json0_.size()); for(JsonElement __e : _json0_) { cfg.role.DistinctBonusInfos __v; __v = new cfg.role.DistinctBonusInfos(__e.getAsJsonObject()); distinctBonusInfos.add(__v); } } } public LevelBonus(int id, java.util.ArrayList<cfg.role.DistinctBonusInfos> distinct_bonus_infos ) { this.id = id; this.distinctBonusInfos = distinct_bonus_infos; } public static LevelBonus deserializeLevelBonus(JsonObject __json__) { return new LevelBonus(__json__); } public final int id; public final java.util.ArrayList<cfg.role.DistinctBonusInfos> distinctBonusInfos; public void resolve(java.util.HashMap<String, Object> _tables) { for(cfg.role.DistinctBonusInfos _e : distinctBonusInfos) { if (_e != null) _e.resolve(_tables); } } @Override public String toString() { return "{ " + "id:" + id + "," + "distinctBonusInfos:" + distinctBonusInfos + "," + "}"; } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_UI_Mask_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_UI_Mask_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.UI.Mask constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_MaskEnabled(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Mask; { { var result = obj.MaskEnabled(); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_IsRaycastLocationValid(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Mask; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Camera>(false); var result = obj.IsRaycastLocationValid(Arg0,Arg1); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetModifiedMaterial(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Mask; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Material>(false); var result = obj.GetModifiedMaterial(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_rectTransform(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Mask; var result = obj.rectTransform; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_showMaskGraphic(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Mask; var result = obj.showMaskGraphic; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_showMaskGraphic(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Mask; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.showMaskGraphic = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_graphic(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Mask; var result = obj.graphic; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "MaskEnabled", IsStatic = false}, M_MaskEnabled }, { new Puerts.MethodKey {Name = "IsRaycastLocationValid", IsStatic = false}, M_IsRaycastLocationValid }, { new Puerts.MethodKey {Name = "GetModifiedMaterial", IsStatic = false}, M_GetModifiedMaterial }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"rectTransform", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_rectTransform, Setter = null} }, {"showMaskGraphic", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_showMaskGraphic, Setter = S_showMaskGraphic} }, {"graphic", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_graphic, Setter = null} }, } }; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/Puerts_ILoader_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class Puerts_ILoader_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to Puerts.ILoader constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_FileExists(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as Puerts.ILoader; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetString(false); var result = obj.FileExists(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ReadFile(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as Puerts.ILoader; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.GetString(true); var result = obj.ReadFile(Arg0,out Arg1); argHelper1.SetByRefValue(Arg1); Puerts.PuertsDLL.ReturnString(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "FileExists", IsStatic = false}, M_FileExists }, { new Puerts.MethodKey {Name = "ReadFile", IsStatic = false}, M_ReadFile }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { } }; } } } <|start_filename|>ProtoProjects/go/gen/src/proto/test.Child2.go<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package proto import ( "bright/serialization" ) import "errors" type TestChild2 struct { A1 int32 A20 int32 } const TypeId_TestChild2 = 1 func (*TestChild2) GetTypeId() int32 { return 1 } func (_v *TestChild2)Serialize(_buf *serialization.ByteBuf) { _buf.WriteInt(_v.A1) _buf.WriteInt(_v.A20) } func (_v *TestChild2)Deserialize(_buf *serialization.ByteBuf) (err error) { { if _v.A1, err = _buf.ReadInt(); err != nil { err = errors.New("_v.A1 error"); return } } { if _v.A20, err = _buf.ReadInt(); err != nil { err = errors.New("_v.A20 error"); return } } return } func SerializeTestChild2(_v serialization.ISerializable, _buf *serialization.ByteBuf) { _v.Serialize(_buf) } func DeserializeTestChild2(_buf *serialization.ByteBuf) (*TestChild2, error) { v := &TestChild2{} if err := v.Deserialize(_buf); err == nil { return v, nil } else { return nil, err } } <|start_filename|>Projects/GenerateDatas/convert_lua/item.TbItemExtra/1040020001.lua<|end_filename|> return { _name = 'InteractionItem', id = 1040020001, holding_static_mesh = "StaticMesh'/Game/X6GameData/Prototype/PrototypeAssets/StaticMesh/SM_Apple.SM_Apple'", holding_static_mesh_mat = "MaterialInstanceConstant'/Game/X6GameData/Prototype/PrototypeAssets/Material/LD_Red.LD_Red'", } <|start_filename|>Projects/GenerateDatas/convert_lua/item.TbItemExtra/1110020004.lua<|end_filename|> return { _name = 'DesignDrawing', id = 1110020004, learn_component_id = { 1021409017, }, } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_RenderTextureDescriptor_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_RenderTextureDescriptor_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var result = new UnityEngine.RenderTextureDescriptor(Arg0,Arg1); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.RenderTextureDescriptor), result); } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = (UnityEngine.RenderTextureFormat)argHelper2.GetInt32(false); var result = new UnityEngine.RenderTextureDescriptor(Arg0,Arg1,Arg2); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.RenderTextureDescriptor), result); } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = (UnityEngine.RenderTextureFormat)argHelper2.GetInt32(false); var Arg3 = argHelper3.GetInt32(false); var result = new UnityEngine.RenderTextureDescriptor(Arg0,Arg1,Arg2,Arg3); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.RenderTextureDescriptor), result); } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = (UnityEngine.Experimental.Rendering.GraphicsFormat)argHelper2.GetInt32(false); var Arg3 = argHelper3.GetInt32(false); var result = new UnityEngine.RenderTextureDescriptor(Arg0,Arg1,Arg2,Arg3); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.RenderTextureDescriptor), result); } } if (paramLen == 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = (UnityEngine.RenderTextureFormat)argHelper2.GetInt32(false); var Arg3 = argHelper3.GetInt32(false); var Arg4 = argHelper4.GetInt32(false); var result = new UnityEngine.RenderTextureDescriptor(Arg0,Arg1,Arg2,Arg3,Arg4); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.RenderTextureDescriptor), result); } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = (UnityEngine.Experimental.Rendering.GraphicsFormat)argHelper2.GetInt32(false); var Arg3 = argHelper3.GetInt32(false); var Arg4 = argHelper4.GetInt32(false); var result = new UnityEngine.RenderTextureDescriptor(Arg0,Arg1,Arg2,Arg3,Arg4); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.RenderTextureDescriptor), result); } } if (paramLen == 0) { { var result = new UnityEngine.RenderTextureDescriptor(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.RenderTextureDescriptor), result); } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.RenderTextureDescriptor constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_width(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.RenderTextureDescriptor)Puerts.Utils.GetSelf((int)data, self); var result = obj.width; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_width(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.RenderTextureDescriptor)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.width = argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_height(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.RenderTextureDescriptor)Puerts.Utils.GetSelf((int)data, self); var result = obj.height; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_height(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.RenderTextureDescriptor)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.height = argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_msaaSamples(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.RenderTextureDescriptor)Puerts.Utils.GetSelf((int)data, self); var result = obj.msaaSamples; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_msaaSamples(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.RenderTextureDescriptor)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.msaaSamples = argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_volumeDepth(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.RenderTextureDescriptor)Puerts.Utils.GetSelf((int)data, self); var result = obj.volumeDepth; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_volumeDepth(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.RenderTextureDescriptor)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.volumeDepth = argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_mipCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.RenderTextureDescriptor)Puerts.Utils.GetSelf((int)data, self); var result = obj.mipCount; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_mipCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.RenderTextureDescriptor)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.mipCount = argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_graphicsFormat(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.RenderTextureDescriptor)Puerts.Utils.GetSelf((int)data, self); var result = obj.graphicsFormat; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_graphicsFormat(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.RenderTextureDescriptor)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.graphicsFormat = (UnityEngine.Experimental.Rendering.GraphicsFormat)argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_stencilFormat(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.RenderTextureDescriptor)Puerts.Utils.GetSelf((int)data, self); var result = obj.stencilFormat; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_stencilFormat(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.RenderTextureDescriptor)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.stencilFormat = (UnityEngine.Experimental.Rendering.GraphicsFormat)argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_colorFormat(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.RenderTextureDescriptor)Puerts.Utils.GetSelf((int)data, self); var result = obj.colorFormat; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_colorFormat(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.RenderTextureDescriptor)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.colorFormat = (UnityEngine.RenderTextureFormat)argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_sRGB(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.RenderTextureDescriptor)Puerts.Utils.GetSelf((int)data, self); var result = obj.sRGB; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_sRGB(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.RenderTextureDescriptor)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.sRGB = argHelper.GetBoolean(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_depthBufferBits(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.RenderTextureDescriptor)Puerts.Utils.GetSelf((int)data, self); var result = obj.depthBufferBits; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_depthBufferBits(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.RenderTextureDescriptor)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.depthBufferBits = argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_dimension(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.RenderTextureDescriptor)Puerts.Utils.GetSelf((int)data, self); var result = obj.dimension; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_dimension(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.RenderTextureDescriptor)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.dimension = (UnityEngine.Rendering.TextureDimension)argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_shadowSamplingMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.RenderTextureDescriptor)Puerts.Utils.GetSelf((int)data, self); var result = obj.shadowSamplingMode; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_shadowSamplingMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.RenderTextureDescriptor)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.shadowSamplingMode = (UnityEngine.Rendering.ShadowSamplingMode)argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_vrUsage(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.RenderTextureDescriptor)Puerts.Utils.GetSelf((int)data, self); var result = obj.vrUsage; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_vrUsage(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.RenderTextureDescriptor)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.vrUsage = (UnityEngine.VRTextureUsage)argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_flags(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.RenderTextureDescriptor)Puerts.Utils.GetSelf((int)data, self); var result = obj.flags; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_memoryless(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.RenderTextureDescriptor)Puerts.Utils.GetSelf((int)data, self); var result = obj.memoryless; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_memoryless(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.RenderTextureDescriptor)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.memoryless = (UnityEngine.RenderTextureMemoryless)argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_useMipMap(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.RenderTextureDescriptor)Puerts.Utils.GetSelf((int)data, self); var result = obj.useMipMap; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_useMipMap(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.RenderTextureDescriptor)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.useMipMap = argHelper.GetBoolean(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_autoGenerateMips(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.RenderTextureDescriptor)Puerts.Utils.GetSelf((int)data, self); var result = obj.autoGenerateMips; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_autoGenerateMips(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.RenderTextureDescriptor)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.autoGenerateMips = argHelper.GetBoolean(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_enableRandomWrite(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.RenderTextureDescriptor)Puerts.Utils.GetSelf((int)data, self); var result = obj.enableRandomWrite; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_enableRandomWrite(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.RenderTextureDescriptor)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.enableRandomWrite = argHelper.GetBoolean(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_bindMS(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.RenderTextureDescriptor)Puerts.Utils.GetSelf((int)data, self); var result = obj.bindMS; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_bindMS(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.RenderTextureDescriptor)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.bindMS = argHelper.GetBoolean(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_useDynamicScale(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.RenderTextureDescriptor)Puerts.Utils.GetSelf((int)data, self); var result = obj.useDynamicScale; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_useDynamicScale(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.RenderTextureDescriptor)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.useDynamicScale = argHelper.GetBoolean(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"width", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_width, Setter = S_width} }, {"height", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_height, Setter = S_height} }, {"msaaSamples", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_msaaSamples, Setter = S_msaaSamples} }, {"volumeDepth", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_volumeDepth, Setter = S_volumeDepth} }, {"mipCount", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_mipCount, Setter = S_mipCount} }, {"graphicsFormat", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_graphicsFormat, Setter = S_graphicsFormat} }, {"stencilFormat", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_stencilFormat, Setter = S_stencilFormat} }, {"colorFormat", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_colorFormat, Setter = S_colorFormat} }, {"sRGB", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_sRGB, Setter = S_sRGB} }, {"depthBufferBits", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_depthBufferBits, Setter = S_depthBufferBits} }, {"dimension", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_dimension, Setter = S_dimension} }, {"shadowSamplingMode", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_shadowSamplingMode, Setter = S_shadowSamplingMode} }, {"vrUsage", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_vrUsage, Setter = S_vrUsage} }, {"flags", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_flags, Setter = null} }, {"memoryless", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_memoryless, Setter = S_memoryless} }, {"useMipMap", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_useMipMap, Setter = S_useMipMap} }, {"autoGenerateMips", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_autoGenerateMips, Setter = S_autoGenerateMips} }, {"enableRandomWrite", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_enableRandomWrite, Setter = S_enableRandomWrite} }, {"bindMS", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_bindMS, Setter = S_bindMS} }, {"useDynamicScale", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_useDynamicScale, Setter = S_useDynamicScale} }, } }; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_CapsuleCollider_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_CapsuleCollider_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.CapsuleCollider(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.CapsuleCollider), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_center(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CapsuleCollider; var result = obj.center; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_center(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CapsuleCollider; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.center = argHelper.Get<UnityEngine.Vector3>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_radius(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CapsuleCollider; var result = obj.radius; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_radius(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CapsuleCollider; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.radius = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_height(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CapsuleCollider; var result = obj.height; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_height(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CapsuleCollider; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.height = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_direction(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CapsuleCollider; var result = obj.direction; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_direction(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CapsuleCollider; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.direction = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"center", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_center, Setter = S_center} }, {"radius", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_radius, Setter = S_radius} }, {"height", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_height, Setter = S_height} }, {"direction", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_direction, Setter = S_direction} }, } }; } } } <|start_filename|>Projects/DataTemplates/template_lua2/test_tbmultiindexlist.lua<|end_filename|> -- test.TbMultiIndexList return { id1=1, id2=1, id3="ab1", num=1, desc="desc1", }, <|start_filename|>Projects/Java_bin/src/main/gen/cfg/bonus/ShowItemInfo.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.bonus; import bright.serialization.*; public final class ShowItemInfo { public ShowItemInfo(ByteBuf _buf) { itemId = _buf.readInt(); itemNum = _buf.readLong(); } public ShowItemInfo(int item_id, long item_num ) { this.itemId = item_id; this.itemNum = item_num; } public final int itemId; public cfg.item.Item itemId_Ref; public final long itemNum; public void resolve(java.util.HashMap<String, Object> _tables) { this.itemId_Ref = ((cfg.item.TbItem)_tables.get("item.TbItem")).get(itemId); } @Override public String toString() { return "{ " + "itemId:" + itemId + "," + "itemNum:" + itemNum + "," + "}"; } } <|start_filename|>Projects/Go_json/gen/src/cfg/test.TbDemoPrimitive.go<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg type TestTbDemoPrimitive struct { _dataMap map[int32]*TestDemoPrimitiveTypesTable _dataList []*TestDemoPrimitiveTypesTable } func NewTestTbDemoPrimitive(_buf []map[string]interface{}) (*TestTbDemoPrimitive, error) { _dataList := make([]*TestDemoPrimitiveTypesTable, 0, len(_buf)) dataMap := make(map[int32]*TestDemoPrimitiveTypesTable) for _, _ele_ := range _buf { if _v, err2 := DeserializeTestDemoPrimitiveTypesTable(_ele_); err2 != nil { return nil, err2 } else { _dataList = append(_dataList, _v) dataMap[_v.X4] = _v } } return &TestTbDemoPrimitive{_dataList:_dataList, _dataMap:dataMap}, nil } func (table *TestTbDemoPrimitive) GetDataMap() map[int32]*TestDemoPrimitiveTypesTable { return table._dataMap } func (table *TestTbDemoPrimitive) GetDataList() []*TestDemoPrimitiveTypesTable { return table._dataList } func (table *TestTbDemoPrimitive) Get(key int32) *TestDemoPrimitiveTypesTable { return table._dataMap[key] } <|start_filename|>Projects/java_json/src/gen/cfg/ai/UpdateDailyBehaviorProps.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.ai; import com.google.gson.JsonElement; import com.google.gson.JsonObject; public final class UpdateDailyBehaviorProps extends cfg.ai.Service { public UpdateDailyBehaviorProps(JsonObject __json__) { super(__json__); satietyKey = __json__.get("satiety_key").getAsString(); energyKey = __json__.get("energy_key").getAsString(); moodKey = __json__.get("mood_key").getAsString(); satietyLowerThresholdKey = __json__.get("satiety_lower_threshold_key").getAsString(); satietyUpperThresholdKey = __json__.get("satiety_upper_threshold_key").getAsString(); energyLowerThresholdKey = __json__.get("energy_lower_threshold_key").getAsString(); energyUpperThresholdKey = __json__.get("energy_upper_threshold_key").getAsString(); moodLowerThresholdKey = __json__.get("mood_lower_threshold_key").getAsString(); moodUpperThresholdKey = __json__.get("mood_upper_threshold_key").getAsString(); } public UpdateDailyBehaviorProps(int id, String node_name, String satiety_key, String energy_key, String mood_key, String satiety_lower_threshold_key, String satiety_upper_threshold_key, String energy_lower_threshold_key, String energy_upper_threshold_key, String mood_lower_threshold_key, String mood_upper_threshold_key ) { super(id, node_name); this.satietyKey = satiety_key; this.energyKey = energy_key; this.moodKey = mood_key; this.satietyLowerThresholdKey = satiety_lower_threshold_key; this.satietyUpperThresholdKey = satiety_upper_threshold_key; this.energyLowerThresholdKey = energy_lower_threshold_key; this.energyUpperThresholdKey = energy_upper_threshold_key; this.moodLowerThresholdKey = mood_lower_threshold_key; this.moodUpperThresholdKey = mood_upper_threshold_key; } public static UpdateDailyBehaviorProps deserializeUpdateDailyBehaviorProps(JsonObject __json__) { return new UpdateDailyBehaviorProps(__json__); } public final String satietyKey; public final String energyKey; public final String moodKey; public final String satietyLowerThresholdKey; public final String satietyUpperThresholdKey; public final String energyLowerThresholdKey; public final String energyUpperThresholdKey; public final String moodLowerThresholdKey; public final String moodUpperThresholdKey; public static final int __ID__ = -61887372; @Override public int getTypeId() { return __ID__; } @Override public void resolve(java.util.HashMap<String, Object> _tables) { super.resolve(_tables); } @Override public String toString() { return "{ " + "id:" + id + "," + "nodeName:" + nodeName + "," + "satietyKey:" + satietyKey + "," + "energyKey:" + energyKey + "," + "moodKey:" + moodKey + "," + "satietyLowerThresholdKey:" + satietyLowerThresholdKey + "," + "satietyUpperThresholdKey:" + satietyUpperThresholdKey + "," + "energyLowerThresholdKey:" + energyLowerThresholdKey + "," + "energyUpperThresholdKey:" + energyUpperThresholdKey + "," + "moodLowerThresholdKey:" + moodLowerThresholdKey + "," + "moodUpperThresholdKey:" + moodUpperThresholdKey + "," + "}"; } } <|start_filename|>Projects/GenerateDatas/convert_lua/tag.TbTestTag/3001.lua<|end_filename|> return { id = 3001, value = "export", } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_LineUtility_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_LineUtility_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.LineUtility(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.LineUtility), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_Simplify(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Vector3>), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<int>), false, false)) { var Arg0 = argHelper0.Get<System.Collections.Generic.List<UnityEngine.Vector3>>(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.Get<System.Collections.Generic.List<int>>(false); UnityEngine.LineUtility.Simplify(Arg0,Arg1,Arg2); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Vector3>), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Vector3>), false, false)) { var Arg0 = argHelper0.Get<System.Collections.Generic.List<UnityEngine.Vector3>>(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.Get<System.Collections.Generic.List<UnityEngine.Vector3>>(false); UnityEngine.LineUtility.Simplify(Arg0,Arg1,Arg2); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Vector2>), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<int>), false, false)) { var Arg0 = argHelper0.Get<System.Collections.Generic.List<UnityEngine.Vector2>>(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.Get<System.Collections.Generic.List<int>>(false); UnityEngine.LineUtility.Simplify(Arg0,Arg1,Arg2); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Vector2>), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Vector2>), false, false)) { var Arg0 = argHelper0.Get<System.Collections.Generic.List<UnityEngine.Vector2>>(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.Get<System.Collections.Generic.List<UnityEngine.Vector2>>(false); UnityEngine.LineUtility.Simplify(Arg0,Arg1,Arg2); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to Simplify"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "Simplify", IsStatic = true}, F_Simplify }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { } }; } } } <|start_filename|>Projects/GenerateDatas/convert_lua/test.TbDetectCsvEncoding/31.lua<|end_filename|> return { id = 31, name = "测试编码", } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_WebCamTexture_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_WebCamTexture_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetInt32(false); var result = new UnityEngine.WebCamTexture(Arg0,Arg1,Arg2,Arg3); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.WebCamTexture), result); } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var result = new UnityEngine.WebCamTexture(Arg0,Arg1,Arg2); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.WebCamTexture), result); } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var result = new UnityEngine.WebCamTexture(Arg0,Arg1,Arg2); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.WebCamTexture), result); } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var result = new UnityEngine.WebCamTexture(Arg0); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.WebCamTexture), result); } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var result = new UnityEngine.WebCamTexture(Arg0,Arg1); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.WebCamTexture), result); } } if (paramLen == 0) { { var result = new UnityEngine.WebCamTexture(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.WebCamTexture), result); } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.WebCamTexture constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Play(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.WebCamTexture; { { obj.Play(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Pause(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.WebCamTexture; { { obj.Pause(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Stop(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.WebCamTexture; { { obj.Stop(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetPixel(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.WebCamTexture; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var result = obj.GetPixel(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetPixels(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.WebCamTexture; if (paramLen == 0) { { var result = obj.GetPixels(); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetInt32(false); var result = obj.GetPixels(Arg0,Arg1,Arg2,Arg3); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetPixels"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetPixels32(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.WebCamTexture; if (paramLen == 0) { { var result = obj.GetPixels32(); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Color32[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Color32[]>(false); var result = obj.GetPixels32(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetPixels32"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_devices(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.WebCamTexture.devices; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_isPlaying(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.WebCamTexture; var result = obj.isPlaying; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_deviceName(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.WebCamTexture; var result = obj.deviceName; Puerts.PuertsDLL.ReturnString(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_deviceName(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.WebCamTexture; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.deviceName = argHelper.GetString(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_requestedFPS(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.WebCamTexture; var result = obj.requestedFPS; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_requestedFPS(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.WebCamTexture; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.requestedFPS = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_requestedWidth(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.WebCamTexture; var result = obj.requestedWidth; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_requestedWidth(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.WebCamTexture; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.requestedWidth = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_requestedHeight(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.WebCamTexture; var result = obj.requestedHeight; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_requestedHeight(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.WebCamTexture; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.requestedHeight = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_videoRotationAngle(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.WebCamTexture; var result = obj.videoRotationAngle; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_videoVerticallyMirrored(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.WebCamTexture; var result = obj.videoVerticallyMirrored; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_didUpdateThisFrame(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.WebCamTexture; var result = obj.didUpdateThisFrame; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_autoFocusPoint(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.WebCamTexture; var result = obj.autoFocusPoint; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_autoFocusPoint(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.WebCamTexture; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.autoFocusPoint = argHelper.Get<System.Nullable<UnityEngine.Vector2>>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_isDepth(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.WebCamTexture; var result = obj.isDepth; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "Play", IsStatic = false}, M_Play }, { new Puerts.MethodKey {Name = "Pause", IsStatic = false}, M_Pause }, { new Puerts.MethodKey {Name = "Stop", IsStatic = false}, M_Stop }, { new Puerts.MethodKey {Name = "GetPixel", IsStatic = false}, M_GetPixel }, { new Puerts.MethodKey {Name = "GetPixels", IsStatic = false}, M_GetPixels }, { new Puerts.MethodKey {Name = "GetPixels32", IsStatic = false}, M_GetPixels32 }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"devices", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_devices, Setter = null} }, {"isPlaying", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_isPlaying, Setter = null} }, {"deviceName", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_deviceName, Setter = S_deviceName} }, {"requestedFPS", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_requestedFPS, Setter = S_requestedFPS} }, {"requestedWidth", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_requestedWidth, Setter = S_requestedWidth} }, {"requestedHeight", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_requestedHeight, Setter = S_requestedHeight} }, {"videoRotationAngle", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_videoRotationAngle, Setter = null} }, {"videoVerticallyMirrored", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_videoVerticallyMirrored, Setter = null} }, {"didUpdateThisFrame", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_didUpdateThisFrame, Setter = null} }, {"autoFocusPoint", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_autoFocusPoint, Setter = S_autoFocusPoint} }, {"isDepth", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_isDepth, Setter = null} }, } }; } } } <|start_filename|>Projects/Go_json/gen/src/cfg/test.ExcelFromJsonMultiRow.go<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg import "errors" type TestExcelFromJsonMultiRow struct { Id int32 X int32 Items []*TestTestRow } const TypeId_TestExcelFromJsonMultiRow = 715335694 func (*TestExcelFromJsonMultiRow) GetTypeId() int32 { return 715335694 } func (_v *TestExcelFromJsonMultiRow)Deserialize(_buf map[string]interface{}) (err error) { { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["id"].(float64); !_ok_ { err = errors.New("id error"); return }; _v.Id = int32(_tempNum_) } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["x"].(float64); !_ok_ { err = errors.New("x error"); return }; _v.X = int32(_tempNum_) } { var _arr_ []interface{} var _ok_ bool if _arr_, _ok_ = _buf["items"].([]interface{}); !_ok_ { err = errors.New("items error"); return } _v.Items = make([]*TestTestRow, 0, len(_arr_)) for _, _e_ := range _arr_ { var _list_v_ *TestTestRow { var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _e_.(map[string]interface{}); !_ok_ { err = errors.New("_list_v_ error"); return }; if _list_v_, err = DeserializeTestTestRow(_x_); err != nil { return } } _v.Items = append(_v.Items, _list_v_) } } return } func DeserializeTestExcelFromJsonMultiRow(_buf map[string]interface{}) (*TestExcelFromJsonMultiRow, error) { v := &TestExcelFromJsonMultiRow{} if err := v.Deserialize(_buf); err == nil { return v, nil } else { return nil, err } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_UI_SpriteState_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_UI_SpriteState_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.UI.SpriteState constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Equals(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.UI.SpriteState)Puerts.Utils.GetSelf((int)data, self); { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.UI.SpriteState>(false); var result = obj.Equals(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_highlightedSprite(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.UI.SpriteState)Puerts.Utils.GetSelf((int)data, self); var result = obj.highlightedSprite; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_highlightedSprite(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.UI.SpriteState)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.highlightedSprite = argHelper.Get<UnityEngine.Sprite>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_pressedSprite(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.UI.SpriteState)Puerts.Utils.GetSelf((int)data, self); var result = obj.pressedSprite; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_pressedSprite(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.UI.SpriteState)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.pressedSprite = argHelper.Get<UnityEngine.Sprite>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_selectedSprite(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.UI.SpriteState)Puerts.Utils.GetSelf((int)data, self); var result = obj.selectedSprite; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_selectedSprite(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.UI.SpriteState)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.selectedSprite = argHelper.Get<UnityEngine.Sprite>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_disabledSprite(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.UI.SpriteState)Puerts.Utils.GetSelf((int)data, self); var result = obj.disabledSprite; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_disabledSprite(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.UI.SpriteState)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.disabledSprite = argHelper.Get<UnityEngine.Sprite>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "Equals", IsStatic = false}, M_Equals }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"highlightedSprite", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_highlightedSprite, Setter = S_highlightedSprite} }, {"pressedSprite", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_pressedSprite, Setter = S_pressedSprite} }, {"selectedSprite", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_selectedSprite, Setter = S_selectedSprite} }, {"disabledSprite", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_disabledSprite, Setter = S_disabledSprite} }, } }; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_RemoteSettings_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_RemoteSettings_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.RemoteSettings constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_ForceUpdate(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { { UnityEngine.RemoteSettings.ForceUpdate(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_WasLastUpdatedFromServer(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { { var result = UnityEngine.RemoteSettings.WasLastUpdatedFromServer(); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetInt(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var result = UnityEngine.RemoteSettings.GetInt(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.GetInt32(false); var result = UnityEngine.RemoteSettings.GetInt(Arg0,Arg1); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetInt"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetLong(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var result = UnityEngine.RemoteSettings.GetLong(Arg0); Puerts.PuertsDLL.ReturnBigInt(isolate, info, result); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.BigInt, null, false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.GetInt64(false); var result = UnityEngine.RemoteSettings.GetLong(Arg0,Arg1); Puerts.PuertsDLL.ReturnBigInt(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetLong"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetFloat(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var result = UnityEngine.RemoteSettings.GetFloat(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.GetFloat(false); var result = UnityEngine.RemoteSettings.GetFloat(Arg0,Arg1); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetFloat"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetString(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var result = UnityEngine.RemoteSettings.GetString(Arg0); Puerts.PuertsDLL.ReturnString(isolate, info, result); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.GetString(false); var result = UnityEngine.RemoteSettings.GetString(Arg0,Arg1); Puerts.PuertsDLL.ReturnString(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetString"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetBool(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var result = UnityEngine.RemoteSettings.GetBool(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.GetBoolean(false); var result = UnityEngine.RemoteSettings.GetBool(Arg0,Arg1); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetBool"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_HasKey(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetString(false); var result = UnityEngine.RemoteSettings.HasKey(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { { var result = UnityEngine.RemoteSettings.GetCount(); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetKeys(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { { var result = UnityEngine.RemoteSettings.GetKeys(); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetObject(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Type), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.Get<System.Type>(false); var Arg1 = argHelper1.GetString(false); var result = UnityEngine.RemoteSettings.GetObject(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Any, typeof(System.Object), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<System.Object>(false); var result = UnityEngine.RemoteSettings.GetObject(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Type), false, false)) { var Arg0 = argHelper0.Get<System.Type>(false); var result = UnityEngine.RemoteSettings.GetObject(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetObject"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetDictionary(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var result = UnityEngine.RemoteSettings.GetDictionary(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 0) { { var result = UnityEngine.RemoteSettings.GetDictionary(); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetDictionary"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void A_Updated(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.RemoteSettings.Updated += argHelper.Get<UnityEngine.RemoteSettings.UpdatedEventHandler>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void R_Updated(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.RemoteSettings.Updated -= argHelper.Get<UnityEngine.RemoteSettings.UpdatedEventHandler>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void A_BeforeFetchFromServer(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.RemoteSettings.BeforeFetchFromServer += argHelper.Get<System.Action>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void R_BeforeFetchFromServer(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.RemoteSettings.BeforeFetchFromServer -= argHelper.Get<System.Action>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void A_Completed(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.RemoteSettings.Completed += argHelper.Get<System.Action<bool, bool, int>>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void R_Completed(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.RemoteSettings.Completed -= argHelper.Get<System.Action<bool, bool, int>>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "ForceUpdate", IsStatic = true}, F_ForceUpdate }, { new Puerts.MethodKey {Name = "WasLastUpdatedFromServer", IsStatic = true}, F_WasLastUpdatedFromServer }, { new Puerts.MethodKey {Name = "GetInt", IsStatic = true}, F_GetInt }, { new Puerts.MethodKey {Name = "GetLong", IsStatic = true}, F_GetLong }, { new Puerts.MethodKey {Name = "GetFloat", IsStatic = true}, F_GetFloat }, { new Puerts.MethodKey {Name = "GetString", IsStatic = true}, F_GetString }, { new Puerts.MethodKey {Name = "GetBool", IsStatic = true}, F_GetBool }, { new Puerts.MethodKey {Name = "HasKey", IsStatic = true}, F_HasKey }, { new Puerts.MethodKey {Name = "GetCount", IsStatic = true}, F_GetCount }, { new Puerts.MethodKey {Name = "GetKeys", IsStatic = true}, F_GetKeys }, { new Puerts.MethodKey {Name = "GetObject", IsStatic = true}, F_GetObject }, { new Puerts.MethodKey {Name = "GetDictionary", IsStatic = true}, F_GetDictionary }, { new Puerts.MethodKey {Name = "add_Updated", IsStatic = true}, A_Updated}, { new Puerts.MethodKey {Name = "remove_Updated", IsStatic = true}, R_Updated}, { new Puerts.MethodKey {Name = "add_BeforeFetchFromServer", IsStatic = true}, A_BeforeFetchFromServer}, { new Puerts.MethodKey {Name = "remove_BeforeFetchFromServer", IsStatic = true}, R_BeforeFetchFromServer}, { new Puerts.MethodKey {Name = "add_Completed", IsStatic = true}, A_Completed}, { new Puerts.MethodKey {Name = "remove_Completed", IsStatic = true}, R_Completed}, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { } }; } } } <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/condition/GenderLimit.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.condition { public sealed partial class GenderLimit : condition.BoolRoleCondition { public GenderLimit(ByteBuf _buf) : base(_buf) { Gender = (role.EGenderType)_buf.ReadInt(); } public GenderLimit(role.EGenderType gender ) : base() { this.Gender = gender; } public static GenderLimit DeserializeGenderLimit(ByteBuf _buf) { return new condition.GenderLimit(_buf); } public readonly role.EGenderType Gender; public const int ID = 103675143; public override int GetTypeId() => ID; public override void Resolve(Dictionary<string, object> _tables) { base.Resolve(_tables); OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); public override string ToString() { return "{ " + "Gender:" + Gender + "," + "}"; } } } <|start_filename|>Projects/Cpp_bin/sync_to_ue4_project.bat<|end_filename|> rd /s /q ..\Cpp_Unreal_bin\Source\Cpp_Unreal\Private\bright xcopy /S bright ..\Cpp_Unreal_bin\Source\Cpp_Unreal\Private\bright\ pause <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_ColorUtility_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_ColorUtility_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.ColorUtility(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.ColorUtility), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_TryParseHtmlString(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<UnityEngine.Color>(true); var result = UnityEngine.ColorUtility.TryParseHtmlString(Arg0,out Arg1); argHelper1.SetByRefValue(Arg1); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_ToHtmlStringRGB(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Color>(false); var result = UnityEngine.ColorUtility.ToHtmlStringRGB(Arg0); Puerts.PuertsDLL.ReturnString(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_ToHtmlStringRGBA(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Color>(false); var result = UnityEngine.ColorUtility.ToHtmlStringRGBA(Arg0); Puerts.PuertsDLL.ReturnString(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "TryParseHtmlString", IsStatic = true}, F_TryParseHtmlString }, { new Puerts.MethodKey {Name = "ToHtmlStringRGB", IsStatic = true}, F_ToHtmlStringRGB }, { new Puerts.MethodKey {Name = "ToHtmlStringRGBA", IsStatic = true}, F_ToHtmlStringRGBA }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { } }; } } } <|start_filename|>Projects/java_json/src/gen/cfg/cost/Cost.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.cost; import com.google.gson.JsonElement; import com.google.gson.JsonObject; public abstract class Cost { public Cost(JsonObject __json__) { } public Cost() { } public static Cost deserializeCost(JsonObject __json__) { switch (__json__.get("__type__").getAsString()) { case "CostCurrency": return new cfg.cost.CostCurrency(__json__); case "CostCurrencies": return new cfg.cost.CostCurrencies(__json__); case "CostOneItem": return new cfg.cost.CostOneItem(__json__); case "CostItem": return new cfg.cost.CostItem(__json__); case "CostItems": return new cfg.cost.CostItems(__json__); default: throw new bright.serialization.SerializationException(); } } public abstract int getTypeId(); public void resolve(java.util.HashMap<String, Object> _tables) { } @Override public String toString() { return "{ " + "}"; } } <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/test/DemoD5.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.test { public sealed partial class DemoD5 : test.DemoDynamic { public DemoD5(ByteBuf _buf) : base(_buf) { Time = test.DateTimeRange.DeserializeDateTimeRange(_buf); } public DemoD5(int x1, test.DateTimeRange time ) : base(x1) { this.Time = time; } public static DemoD5 DeserializeDemoD5(ByteBuf _buf) { return new test.DemoD5(_buf); } public readonly test.DateTimeRange Time; public const int ID = -2138341744; public override int GetTypeId() => ID; public override void Resolve(Dictionary<string, object> _tables) { base.Resolve(_tables); Time?.Resolve(_tables); OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); public override string ToString() { return "{ " + "X1:" + X1 + "," + "Time:" + Time + "," + "}"; } } } <|start_filename|>Projects/Csharp_Unity_ILRuntime_bin/HotFix_Project/InstanceClass.cs<|end_filename|> using System; using System.Collections.Generic; using System.IO; using Bright.Serialization; using UnityEngine; namespace HotFix_Project { public class InstanceClass { // static method public static void StaticFunTest() { var tables = new cfg.Tables(file => new ByteBuf(File.ReadAllBytes(Application.dataPath + "/../../GenerateDatas/bin/" + file + ".bytes"))); UnityEngine.Debug.Log("== load succ =="); } } } <|start_filename|>Projects/GenerateDatas/convert_lua/role.TbRoleLevelExpAttr/10.lua<|end_filename|> return { level = 10, need_exp = 1300, clothes_attrs = { 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, }, } <|start_filename|>Projects/Java_bin/src/main/gen/cfg/test/TestRow.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.test; import bright.serialization.*; public final class TestRow { public TestRow(ByteBuf _buf) { x = _buf.readInt(); y = _buf.readBool(); z = _buf.readString(); a = new cfg.test.Test3(_buf); {int n = Math.min(_buf.readSize(), _buf.size());b = new java.util.ArrayList<Integer>(n);for(int i = 0 ; i < n ; i++) { Integer _e; _e = _buf.readInt(); b.add(_e);}} } public TestRow(int x, boolean y, String z, cfg.test.Test3 a, java.util.ArrayList<Integer> b ) { this.x = x; this.y = y; this.z = z; this.a = a; this.b = b; } public final int x; public final boolean y; public final String z; public final cfg.test.Test3 a; public final java.util.ArrayList<Integer> b; public void resolve(java.util.HashMap<String, Object> _tables) { if (a != null) {a.resolve(_tables);} } @Override public String toString() { return "{ " + "x:" + x + "," + "y:" + y + "," + "z:" + z + "," + "a:" + a + "," + "b:" + b + "," + "}"; } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_Cursor_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_Cursor_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.Cursor(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.Cursor), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_SetCursor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.Get<UnityEngine.Texture2D>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector2>(false); var Arg2 = (UnityEngine.CursorMode)argHelper2.GetInt32(false); UnityEngine.Cursor.SetCursor(Arg0,Arg1,Arg2); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_visible(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Cursor.visible; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_visible(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.Cursor.visible = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_lockState(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Cursor.lockState; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_lockState(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.Cursor.lockState = (UnityEngine.CursorLockMode)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "SetCursor", IsStatic = true}, F_SetCursor }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"visible", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_visible, Setter = S_visible} }, {"lockState", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_lockState, Setter = S_lockState} }, } }; } } } <|start_filename|>Projects/DataTemplates/template_lua/test_tbdetectcsvencoding.lua<|end_filename|> return { [21] = {id=21,name="测试编码",}, [22] = {id=22,name="还果园国要",}, [23] = {id=23,name="工枯加盟仍",}, [11] = {id=11,name="测试编码",}, [12] = {id=12,name="还果园国要",}, [13] = {id=13,name="工枯加盟仍",}, [31] = {id=31,name="测试编码",}, [32] = {id=32,name="还果园国要",}, [33] = {id=33,name="工枯加盟仍",}, [1] = {id=1,name="测试编码",}, [2] = {id=2,name="还果园国要",}, [3] = {id=3,name="工枯加盟仍",}, } <|start_filename|>ProtoProjects/go/src/bright/serialization/ISerializable.go<|end_filename|> package serialization type ISerializable interface { GetTypeId() int32 Serialize(buf *ByteBuf) Deserialize(buf *ByteBuf) error } <|start_filename|>Projects/GenerateDatas/convert_lua/common.TbGlobalConfig/1.lua<|end_filename|> return { bag_capacity = 500, bag_capacity_special = 50, bag_temp_expendable_capacity = 10, bag_temp_tool_capacity = 4, bag_init_capacity = 100, quick_bag_capacity = 4, cloth_bag_capacity = 1000, cloth_bag_init_capacity = 500, cloth_bag_capacity_special = 50, bag_init_items_drop_id = 1, mail_box_capacity = 100, damage_param_c = 1, damage_param_e = 0.75, damage_param_f = 10, damage_param_d = 0.8, role_speed = 5, monster_speed = 5, init_energy = 0, init_viality = 100, max_viality = 100, per_viality_recovery_time = 300, } <|start_filename|>ProtoProjects/go/gen/src/proto/test.Child31.go<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package proto import ( "bright/serialization" ) import "errors" type TestChild31 struct { A1 int32 A24 int32 A31 int32 A32 int32 } const TypeId_TestChild31 = 10 func (*TestChild31) GetTypeId() int32 { return 10 } func (_v *TestChild31)Serialize(_buf *serialization.ByteBuf) { _buf.WriteInt(_v.A1) _buf.WriteInt(_v.A24) _buf.WriteInt(_v.A31) _buf.WriteInt(_v.A32) } func (_v *TestChild31)Deserialize(_buf *serialization.ByteBuf) (err error) { { if _v.A1, err = _buf.ReadInt(); err != nil { err = errors.New("_v.A1 error"); return } } { if _v.A24, err = _buf.ReadInt(); err != nil { err = errors.New("_v.A24 error"); return } } { if _v.A31, err = _buf.ReadInt(); err != nil { err = errors.New("_v.A31 error"); return } } { if _v.A32, err = _buf.ReadInt(); err != nil { err = errors.New("_v.A32 error"); return } } return } func SerializeTestChild31(_v serialization.ISerializable, _buf *serialization.ByteBuf) { _v.Serialize(_buf) } func DeserializeTestChild31(_buf *serialization.ByteBuf) (*TestChild31, error) { v := &TestChild31{} if err := v.Deserialize(_buf); err == nil { return v, nil } else { return nil, err } } <|start_filename|>Projects/Csharp_DotNet5_json_ExportServer/Gen/blueprint/Clazz.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; using System.Text.Json; namespace cfg.blueprint { public abstract class Clazz : Bright.Config.BeanBase { public Clazz(JsonElement _json) { Name = _json.GetProperty("name").GetString(); Desc = _json.GetProperty("desc").GetString(); { var _json0 = _json.GetProperty("parents"); Parents = new System.Collections.Generic.List<blueprint.Clazz>(_json0.GetArrayLength()); foreach(JsonElement __e in _json0.EnumerateArray()) { blueprint.Clazz __v; __v = blueprint.Clazz.DeserializeClazz(__e); Parents.Add(__v); } } { var _json0 = _json.GetProperty("methods"); Methods = new System.Collections.Generic.List<blueprint.Method>(_json0.GetArrayLength()); foreach(JsonElement __e in _json0.EnumerateArray()) { blueprint.Method __v; __v = blueprint.Method.DeserializeMethod(__e); Methods.Add(__v); } } } public Clazz(string name, string desc, System.Collections.Generic.List<blueprint.Clazz> parents, System.Collections.Generic.List<blueprint.Method> methods ) { this.Name = name; this.Desc = desc; this.Parents = parents; this.Methods = methods; } public static Clazz DeserializeClazz(JsonElement _json) { switch (_json.GetProperty("__type__").GetString()) { case "Interface": return new blueprint.Interface(_json); case "NormalClazz": return new blueprint.NormalClazz(_json); case "EnumClazz": return new blueprint.EnumClazz(_json); default: throw new SerializationException(); } } public string Name { get; private set; } public string Desc { get; private set; } public System.Collections.Generic.List<blueprint.Clazz> Parents { get; private set; } public System.Collections.Generic.List<blueprint.Method> Methods { get; private set; } public virtual void Resolve(Dictionary<string, object> _tables) { foreach(var _e in Parents) { _e?.Resolve(_tables); } foreach(var _e in Methods) { _e?.Resolve(_tables); } } public virtual void TranslateText(System.Func<string, string, string> translator) { foreach(var _e in Parents) { _e?.TranslateText(translator); } foreach(var _e in Methods) { _e?.TranslateText(translator); } } public override string ToString() { return "{ " + "Name:" + Name + "," + "Desc:" + Desc + "," + "Parents:" + Bright.Common.StringUtil.CollectionToString(Parents) + "," + "Methods:" + Bright.Common.StringUtil.CollectionToString(Methods) + "," + "}"; } } } <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/test/DetectEncoding.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.test { public sealed partial class DetectEncoding : Bright.Config.BeanBase { public DetectEncoding(ByteBuf _buf) { Id = _buf.ReadInt(); Name = _buf.ReadString(); } public DetectEncoding(int id, string name ) { this.Id = id; this.Name = name; } public static DetectEncoding DeserializeDetectEncoding(ByteBuf _buf) { return new test.DetectEncoding(_buf); } public readonly int Id; public readonly string Name; public const int ID = -1154609646; public override int GetTypeId() => ID; public void Resolve(Dictionary<string, object> _tables) { OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); public override string ToString() { return "{ " + "Id:" + Id + "," + "Name:" + Name + "," + "}"; } } } <|start_filename|>Projects/GenerateDatas/convert_lua/role.TbRoleLevelExpAttr/7.lua<|end_filename|> return { level = 7, need_exp = 700, clothes_attrs = { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, }, } <|start_filename|>Projects/java_json/src/gen/cfg/cost/CostCurrencies.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.cost; import com.google.gson.JsonElement; import com.google.gson.JsonObject; public final class CostCurrencies extends cfg.cost.Cost { public CostCurrencies(JsonObject __json__) { super(__json__); { com.google.gson.JsonArray _json0_ = __json__.get("currencies").getAsJsonArray(); currencies = new java.util.ArrayList<cfg.cost.CostCurrency>(_json0_.size()); for(JsonElement __e : _json0_) { cfg.cost.CostCurrency __v; __v = new cfg.cost.CostCurrency(__e.getAsJsonObject()); currencies.add(__v); } } } public CostCurrencies(java.util.ArrayList<cfg.cost.CostCurrency> currencies ) { super(); this.currencies = currencies; } public static CostCurrencies deserializeCostCurrencies(JsonObject __json__) { return new CostCurrencies(__json__); } public final java.util.ArrayList<cfg.cost.CostCurrency> currencies; public static final int __ID__ = 103084157; @Override public int getTypeId() { return __ID__; } @Override public void resolve(java.util.HashMap<String, Object> _tables) { super.resolve(_tables); for(cfg.cost.CostCurrency _e : currencies) { if (_e != null) _e.resolve(_tables); } } @Override public String toString() { return "{ " + "currencies:" + currencies + "," + "}"; } } <|start_filename|>Projects/DataTemplates/template_erlang2/mail_tbsystemmail.erl<|end_filename|> %% mail.TbSystemMail -module(mail_tbsystemmail) -export([get/1,get_ids/0]) get(11) -> #{ id => 11, title => "测试1", sender => "系统", content => "测试内容1", award => array }. get(12) -> #{ id => 12, title => "测试2", sender => "系统", content => "测试内容2", award => array }. get(13) -> #{ id => 13, title => "测试3", sender => "系统", content => "测试内容3", award => array }. get(14) -> #{ id => 14, title => "测试4", sender => "系统", content => "测试内容4", award => array }. get(15) -> #{ id => 15, title => "测试5", sender => "系统", content => "测试内容5", award => array }. get_ids() -> [11,12,13,14,15]. <|start_filename|>Projects/DataTemplates/template_erlang/test_tbtestsize.erl<|end_filename|> %% test.TbTestSize get(1) -> #{id => 1,x1 => [1,2],x2 => [3,4],x3 => [5,6],x4 => #{1 => 2,3 => 4}}. <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_Logger_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_Logger_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.ILogHandler>(false); var result = new UnityEngine.Logger(Arg0); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.Logger), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_IsLogTypeAllowed(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Logger; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = (UnityEngine.LogType)argHelper0.GetInt32(false); var result = obj.IsLogTypeAllowed(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Log(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Logger; if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Any, typeof(System.Object), false, false)) { var Arg0 = (UnityEngine.LogType)argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<System.Object>(false); obj.Log(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Any, typeof(System.Object), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<System.Object>(false); obj.Log(Arg0,Arg1); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Any, typeof(System.Object), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Object), false, false)) { var Arg0 = (UnityEngine.LogType)argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<System.Object>(false); var Arg2 = argHelper2.Get<UnityEngine.Object>(false); obj.Log(Arg0,Arg1,Arg2); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Any, typeof(System.Object), false, false)) { var Arg0 = (UnityEngine.LogType)argHelper0.GetInt32(false); var Arg1 = argHelper1.GetString(false); var Arg2 = argHelper2.Get<System.Object>(false); obj.Log(Arg0,Arg1,Arg2); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Any, typeof(System.Object), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Object), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<System.Object>(false); var Arg2 = argHelper2.Get<UnityEngine.Object>(false); obj.Log(Arg0,Arg1,Arg2); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Any, typeof(System.Object), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Object), false, false)) { var Arg0 = (UnityEngine.LogType)argHelper0.GetInt32(false); var Arg1 = argHelper1.GetString(false); var Arg2 = argHelper2.Get<System.Object>(false); var Arg3 = argHelper3.Get<UnityEngine.Object>(false); obj.Log(Arg0,Arg1,Arg2,Arg3); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.Any, typeof(System.Object), false, false)) { var Arg0 = argHelper0.Get<System.Object>(false); obj.Log(Arg0); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to Log"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_LogWarning(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Logger; if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Any, typeof(System.Object), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<System.Object>(false); obj.LogWarning(Arg0,Arg1); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Any, typeof(System.Object), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Object), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<System.Object>(false); var Arg2 = argHelper2.Get<UnityEngine.Object>(false); obj.LogWarning(Arg0,Arg1,Arg2); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to LogWarning"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_LogError(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Logger; if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Any, typeof(System.Object), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<System.Object>(false); obj.LogError(Arg0,Arg1); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Any, typeof(System.Object), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Object), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<System.Object>(false); var Arg2 = argHelper2.Get<UnityEngine.Object>(false); obj.LogError(Arg0,Arg1,Arg2); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to LogError"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_LogException(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Logger; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Exception), false, false)) { var Arg0 = argHelper0.Get<System.Exception>(false); obj.LogException(Arg0); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Exception), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Object), false, false)) { var Arg0 = argHelper0.Get<System.Exception>(false); var Arg1 = argHelper1.Get<UnityEngine.Object>(false); obj.LogException(Arg0,Arg1); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to LogException"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_LogFormat(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Logger; if (paramLen >= 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Object), false, false)) { var Arg0 = (UnityEngine.LogType)argHelper0.GetInt32(false); var Arg1 = argHelper1.GetString(false); var Arg2 = argHelper2.GetParams<System.Object>(info, 2, paramLen); obj.LogFormat(Arg0,Arg1,Arg2); return; } } if (paramLen >= 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Object), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Object), false, false)) { var Arg0 = (UnityEngine.LogType)argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.Object>(false); var Arg2 = argHelper2.GetString(false); var Arg3 = argHelper3.GetParams<System.Object>(info, 3, paramLen); obj.LogFormat(Arg0,Arg1,Arg2,Arg3); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to LogFormat"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_logHandler(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Logger; var result = obj.logHandler; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_logHandler(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Logger; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.logHandler = argHelper.Get<UnityEngine.ILogHandler>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_logEnabled(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Logger; var result = obj.logEnabled; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_logEnabled(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Logger; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.logEnabled = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_filterLogType(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Logger; var result = obj.filterLogType; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_filterLogType(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Logger; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.filterLogType = (UnityEngine.LogType)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "IsLogTypeAllowed", IsStatic = false}, M_IsLogTypeAllowed }, { new Puerts.MethodKey {Name = "Log", IsStatic = false}, M_Log }, { new Puerts.MethodKey {Name = "LogWarning", IsStatic = false}, M_LogWarning }, { new Puerts.MethodKey {Name = "LogError", IsStatic = false}, M_LogError }, { new Puerts.MethodKey {Name = "LogException", IsStatic = false}, M_LogException }, { new Puerts.MethodKey {Name = "LogFormat", IsStatic = false}, M_LogFormat }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"logHandler", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_logHandler, Setter = S_logHandler} }, {"logEnabled", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_logEnabled, Setter = S_logEnabled} }, {"filterLogType", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_filterLogType, Setter = S_filterLogType} }, } }; } } } <|start_filename|>Projects/java_json/src/gen/cfg/test/H1.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.test; import com.google.gson.JsonElement; import com.google.gson.JsonObject; public final class H1 { public H1(JsonObject __json__) { y2 = new cfg.test.H2(__json__.get("y2").getAsJsonObject()); y3 = __json__.get("y3").getAsInt(); } public H1(cfg.test.H2 y2, int y3 ) { this.y2 = y2; this.y3 = y3; } public static H1 deserializeH1(JsonObject __json__) { return new H1(__json__); } public final cfg.test.H2 y2; public final int y3; public void resolve(java.util.HashMap<String, Object> _tables) { if (y2 != null) {y2.resolve(_tables);} } @Override public String toString() { return "{ " + "y2:" + y2 + "," + "y3:" + y3 + "," + "}"; } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_UI_LayoutUtility_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_UI_LayoutUtility_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.UI.LayoutUtility constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetMinSize(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<UnityEngine.RectTransform>(false); var Arg1 = argHelper1.GetInt32(false); var result = UnityEngine.UI.LayoutUtility.GetMinSize(Arg0,Arg1); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetPreferredSize(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<UnityEngine.RectTransform>(false); var Arg1 = argHelper1.GetInt32(false); var result = UnityEngine.UI.LayoutUtility.GetPreferredSize(Arg0,Arg1); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetFlexibleSize(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<UnityEngine.RectTransform>(false); var Arg1 = argHelper1.GetInt32(false); var result = UnityEngine.UI.LayoutUtility.GetFlexibleSize(Arg0,Arg1); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetMinWidth(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.RectTransform>(false); var result = UnityEngine.UI.LayoutUtility.GetMinWidth(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetPreferredWidth(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.RectTransform>(false); var result = UnityEngine.UI.LayoutUtility.GetPreferredWidth(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetFlexibleWidth(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.RectTransform>(false); var result = UnityEngine.UI.LayoutUtility.GetFlexibleWidth(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetMinHeight(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.RectTransform>(false); var result = UnityEngine.UI.LayoutUtility.GetMinHeight(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetPreferredHeight(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.RectTransform>(false); var result = UnityEngine.UI.LayoutUtility.GetPreferredHeight(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetFlexibleHeight(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.RectTransform>(false); var result = UnityEngine.UI.LayoutUtility.GetFlexibleHeight(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetLayoutProperty(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RectTransform), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject | Puerts.JsValueType.Function, typeof(System.Func<UnityEngine.UI.ILayoutElement, float>), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.RectTransform>(false); var Arg1 = argHelper1.Get<System.Func<UnityEngine.UI.ILayoutElement, float>>(false); var Arg2 = argHelper2.GetFloat(false); var result = UnityEngine.UI.LayoutUtility.GetLayoutProperty(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RectTransform), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject | Puerts.JsValueType.Function, typeof(System.Func<UnityEngine.UI.ILayoutElement, float>), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.UI.ILayoutElement), true, true)) { var Arg0 = argHelper0.Get<UnityEngine.RectTransform>(false); var Arg1 = argHelper1.Get<System.Func<UnityEngine.UI.ILayoutElement, float>>(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.Get<UnityEngine.UI.ILayoutElement>(true); var result = UnityEngine.UI.LayoutUtility.GetLayoutProperty(Arg0,Arg1,Arg2,out Arg3); argHelper3.SetByRefValue(Arg3); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetLayoutProperty"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "GetMinSize", IsStatic = true}, F_GetMinSize }, { new Puerts.MethodKey {Name = "GetPreferredSize", IsStatic = true}, F_GetPreferredSize }, { new Puerts.MethodKey {Name = "GetFlexibleSize", IsStatic = true}, F_GetFlexibleSize }, { new Puerts.MethodKey {Name = "GetMinWidth", IsStatic = true}, F_GetMinWidth }, { new Puerts.MethodKey {Name = "GetPreferredWidth", IsStatic = true}, F_GetPreferredWidth }, { new Puerts.MethodKey {Name = "GetFlexibleWidth", IsStatic = true}, F_GetFlexibleWidth }, { new Puerts.MethodKey {Name = "GetMinHeight", IsStatic = true}, F_GetMinHeight }, { new Puerts.MethodKey {Name = "GetPreferredHeight", IsStatic = true}, F_GetPreferredHeight }, { new Puerts.MethodKey {Name = "GetFlexibleHeight", IsStatic = true}, F_GetFlexibleHeight }, { new Puerts.MethodKey {Name = "GetLayoutProperty", IsStatic = true}, F_GetLayoutProperty }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { } }; } } } <|start_filename|>Projects/Lua_Unity_xlua_lua/Assets/Lua/Gen/TbSingleton.lua<|end_filename|> return {id=5,name='aabbcc',date={ _name='DemoD5',x1=1,time={start_time=398966400,end_time=936806400,},},} <|start_filename|>Projects/DataTemplates/template_erlang/test_tbtestset.erl<|end_filename|> %% test.TbTestSet get(1) -> #{id => 1,x1 => [1,2,3],x2 => [2,3,4],x3 => ["ab","cd"],x4 => [1,2]}. get(2) -> #{id => 2,x1 => [1,2],x2 => [2,3],x3 => ["ab","cd"],x4 => [1]}. <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_RectTransform_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_RectTransform_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.RectTransform(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.RectTransform), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ForceUpdateRectTransforms(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RectTransform; { { obj.ForceUpdateRectTransforms(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetLocalCorners(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RectTransform; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Vector3[]>(false); obj.GetLocalCorners(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetWorldCorners(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RectTransform; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Vector3[]>(false); obj.GetWorldCorners(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetInsetAndSizeFromParentEdge(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RectTransform; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = (UnityEngine.RectTransform.Edge)argHelper0.GetInt32(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.GetFloat(false); obj.SetInsetAndSizeFromParentEdge(Arg0,Arg1,Arg2); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetSizeWithCurrentAnchors(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RectTransform; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = (UnityEngine.RectTransform.Axis)argHelper0.GetInt32(false); var Arg1 = argHelper1.GetFloat(false); obj.SetSizeWithCurrentAnchors(Arg0,Arg1); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_rect(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RectTransform; var result = obj.rect; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_anchorMin(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RectTransform; var result = obj.anchorMin; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_anchorMin(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RectTransform; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.anchorMin = argHelper.Get<UnityEngine.Vector2>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_anchorMax(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RectTransform; var result = obj.anchorMax; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_anchorMax(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RectTransform; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.anchorMax = argHelper.Get<UnityEngine.Vector2>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_anchoredPosition(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RectTransform; var result = obj.anchoredPosition; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_anchoredPosition(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RectTransform; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.anchoredPosition = argHelper.Get<UnityEngine.Vector2>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_sizeDelta(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RectTransform; var result = obj.sizeDelta; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_sizeDelta(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RectTransform; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.sizeDelta = argHelper.Get<UnityEngine.Vector2>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_pivot(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RectTransform; var result = obj.pivot; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_pivot(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RectTransform; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.pivot = argHelper.Get<UnityEngine.Vector2>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_anchoredPosition3D(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RectTransform; var result = obj.anchoredPosition3D; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_anchoredPosition3D(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RectTransform; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.anchoredPosition3D = argHelper.Get<UnityEngine.Vector3>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_offsetMin(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RectTransform; var result = obj.offsetMin; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_offsetMin(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RectTransform; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.offsetMin = argHelper.Get<UnityEngine.Vector2>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_offsetMax(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RectTransform; var result = obj.offsetMax; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_offsetMax(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RectTransform; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.offsetMax = argHelper.Get<UnityEngine.Vector2>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void A_reapplyDrivenProperties(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.RectTransform.reapplyDrivenProperties += argHelper.Get<UnityEngine.RectTransform.ReapplyDrivenProperties>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void R_reapplyDrivenProperties(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.RectTransform.reapplyDrivenProperties -= argHelper.Get<UnityEngine.RectTransform.ReapplyDrivenProperties>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "ForceUpdateRectTransforms", IsStatic = false}, M_ForceUpdateRectTransforms }, { new Puerts.MethodKey {Name = "GetLocalCorners", IsStatic = false}, M_GetLocalCorners }, { new Puerts.MethodKey {Name = "GetWorldCorners", IsStatic = false}, M_GetWorldCorners }, { new Puerts.MethodKey {Name = "SetInsetAndSizeFromParentEdge", IsStatic = false}, M_SetInsetAndSizeFromParentEdge }, { new Puerts.MethodKey {Name = "SetSizeWithCurrentAnchors", IsStatic = false}, M_SetSizeWithCurrentAnchors }, { new Puerts.MethodKey {Name = "add_reapplyDrivenProperties", IsStatic = true}, A_reapplyDrivenProperties}, { new Puerts.MethodKey {Name = "remove_reapplyDrivenProperties", IsStatic = true}, R_reapplyDrivenProperties}, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"rect", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_rect, Setter = null} }, {"anchorMin", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_anchorMin, Setter = S_anchorMin} }, {"anchorMax", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_anchorMax, Setter = S_anchorMax} }, {"anchoredPosition", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_anchoredPosition, Setter = S_anchoredPosition} }, {"sizeDelta", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_sizeDelta, Setter = S_sizeDelta} }, {"pivot", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_pivot, Setter = S_pivot} }, {"anchoredPosition3D", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_anchoredPosition3D, Setter = S_anchoredPosition3D} }, {"offsetMin", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_offsetMin, Setter = S_offsetMin} }, {"offsetMax", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_offsetMax, Setter = S_offsetMax} }, } }; } } } <|start_filename|>Projects/GenerateDatas/convert_lua/item.TbItemExtra/1110020002.lua<|end_filename|> return { _name = 'DesignDrawing', id = 1110020002, learn_component_id = { 1022109005, }, } <|start_filename|>Projects/java_json/src/corelib/bright/math/Vector4.java<|end_filename|> package bright.math; public class Vector4 { public float x; public float y; public float z; public float w; public Vector4(float x, float y, float z, float w) { this.x = x; this.y = y; this.z = z; this.w = w; } } <|start_filename|>Projects/DataTemplates/template_lua2/test_tbtestdesc.lua<|end_filename|> -- test.TbTestDesc return { [1] = { id=1, name="xxx", a1=0, a2=0, x1= { y2= { z2=2, z3=3, }, y3=4, }, x2= { { z2=1, z3=2, }, { z2=3, z3=4, }, }, x3= { { z2=1, z3=2, }, { z2=3, z3=4, }, }, }, } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_ParticleSystem_ShapeModule_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_ParticleSystem_ShapeModule_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.ParticleSystem.ShapeModule constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_enabled(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ShapeModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.enabled; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_enabled(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ShapeModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.enabled = argHelper.GetBoolean(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_shapeType(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ShapeModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.shapeType; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_shapeType(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ShapeModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.shapeType = (UnityEngine.ParticleSystemShapeType)argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_randomDirectionAmount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ShapeModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.randomDirectionAmount; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_randomDirectionAmount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ShapeModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.randomDirectionAmount = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_sphericalDirectionAmount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ShapeModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.sphericalDirectionAmount; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_sphericalDirectionAmount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ShapeModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.sphericalDirectionAmount = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_randomPositionAmount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ShapeModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.randomPositionAmount; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_randomPositionAmount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ShapeModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.randomPositionAmount = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_alignToDirection(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ShapeModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.alignToDirection; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_alignToDirection(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ShapeModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.alignToDirection = argHelper.GetBoolean(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_radius(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ShapeModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.radius; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_radius(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ShapeModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.radius = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_radiusMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ShapeModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.radiusMode; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_radiusMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ShapeModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.radiusMode = (UnityEngine.ParticleSystemShapeMultiModeValue)argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_radiusSpread(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ShapeModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.radiusSpread; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_radiusSpread(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ShapeModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.radiusSpread = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_radiusSpeed(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ShapeModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.radiusSpeed; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_radiusSpeed(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ShapeModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.radiusSpeed = argHelper.Get<UnityEngine.ParticleSystem.MinMaxCurve>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_radiusSpeedMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ShapeModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.radiusSpeedMultiplier; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_radiusSpeedMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ShapeModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.radiusSpeedMultiplier = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_radiusThickness(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ShapeModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.radiusThickness; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_radiusThickness(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ShapeModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.radiusThickness = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_angle(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ShapeModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.angle; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_angle(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ShapeModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.angle = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_length(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ShapeModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.length; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_length(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ShapeModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.length = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_boxThickness(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ShapeModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.boxThickness; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_boxThickness(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ShapeModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.boxThickness = argHelper.Get<UnityEngine.Vector3>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_meshShapeType(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ShapeModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.meshShapeType; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_meshShapeType(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ShapeModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.meshShapeType = (UnityEngine.ParticleSystemMeshShapeType)argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_mesh(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ShapeModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.mesh; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_mesh(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ShapeModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.mesh = argHelper.Get<UnityEngine.Mesh>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_meshRenderer(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ShapeModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.meshRenderer; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_meshRenderer(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ShapeModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.meshRenderer = argHelper.Get<UnityEngine.MeshRenderer>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_skinnedMeshRenderer(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ShapeModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.skinnedMeshRenderer; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_skinnedMeshRenderer(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ShapeModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.skinnedMeshRenderer = argHelper.Get<UnityEngine.SkinnedMeshRenderer>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_sprite(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ShapeModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.sprite; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_sprite(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ShapeModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.sprite = argHelper.Get<UnityEngine.Sprite>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_spriteRenderer(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ShapeModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.spriteRenderer; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_spriteRenderer(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ShapeModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.spriteRenderer = argHelper.Get<UnityEngine.SpriteRenderer>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_useMeshMaterialIndex(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ShapeModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.useMeshMaterialIndex; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_useMeshMaterialIndex(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ShapeModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.useMeshMaterialIndex = argHelper.GetBoolean(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_meshMaterialIndex(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ShapeModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.meshMaterialIndex; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_meshMaterialIndex(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ShapeModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.meshMaterialIndex = argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_useMeshColors(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ShapeModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.useMeshColors; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_useMeshColors(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ShapeModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.useMeshColors = argHelper.GetBoolean(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_normalOffset(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ShapeModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.normalOffset; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_normalOffset(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ShapeModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.normalOffset = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_meshSpawnMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ShapeModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.meshSpawnMode; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_meshSpawnMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ShapeModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.meshSpawnMode = (UnityEngine.ParticleSystemShapeMultiModeValue)argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_meshSpawnSpread(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ShapeModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.meshSpawnSpread; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_meshSpawnSpread(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ShapeModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.meshSpawnSpread = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_meshSpawnSpeed(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ShapeModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.meshSpawnSpeed; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_meshSpawnSpeed(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ShapeModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.meshSpawnSpeed = argHelper.Get<UnityEngine.ParticleSystem.MinMaxCurve>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_meshSpawnSpeedMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ShapeModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.meshSpawnSpeedMultiplier; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_meshSpawnSpeedMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ShapeModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.meshSpawnSpeedMultiplier = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_arc(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ShapeModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.arc; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_arc(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ShapeModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.arc = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_arcMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ShapeModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.arcMode; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_arcMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ShapeModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.arcMode = (UnityEngine.ParticleSystemShapeMultiModeValue)argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_arcSpread(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ShapeModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.arcSpread; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_arcSpread(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ShapeModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.arcSpread = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_arcSpeed(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ShapeModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.arcSpeed; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_arcSpeed(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ShapeModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.arcSpeed = argHelper.Get<UnityEngine.ParticleSystem.MinMaxCurve>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_arcSpeedMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ShapeModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.arcSpeedMultiplier; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_arcSpeedMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ShapeModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.arcSpeedMultiplier = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_donutRadius(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ShapeModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.donutRadius; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_donutRadius(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ShapeModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.donutRadius = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_position(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ShapeModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.position; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_position(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ShapeModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.position = argHelper.Get<UnityEngine.Vector3>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_rotation(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ShapeModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.rotation; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_rotation(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ShapeModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.rotation = argHelper.Get<UnityEngine.Vector3>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_scale(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ShapeModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.scale; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_scale(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ShapeModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.scale = argHelper.Get<UnityEngine.Vector3>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_texture(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ShapeModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.texture; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_texture(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ShapeModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.texture = argHelper.Get<UnityEngine.Texture2D>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_textureClipChannel(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ShapeModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.textureClipChannel; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_textureClipChannel(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ShapeModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.textureClipChannel = (UnityEngine.ParticleSystemShapeTextureChannel)argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_textureClipThreshold(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ShapeModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.textureClipThreshold; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_textureClipThreshold(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ShapeModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.textureClipThreshold = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_textureColorAffectsParticles(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ShapeModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.textureColorAffectsParticles; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_textureColorAffectsParticles(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ShapeModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.textureColorAffectsParticles = argHelper.GetBoolean(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_textureAlphaAffectsParticles(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ShapeModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.textureAlphaAffectsParticles; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_textureAlphaAffectsParticles(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ShapeModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.textureAlphaAffectsParticles = argHelper.GetBoolean(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_textureBilinearFiltering(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ShapeModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.textureBilinearFiltering; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_textureBilinearFiltering(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ShapeModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.textureBilinearFiltering = argHelper.GetBoolean(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_textureUVChannel(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ShapeModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.textureUVChannel; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_textureUVChannel(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ShapeModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.textureUVChannel = argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"enabled", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_enabled, Setter = S_enabled} }, {"shapeType", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_shapeType, Setter = S_shapeType} }, {"randomDirectionAmount", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_randomDirectionAmount, Setter = S_randomDirectionAmount} }, {"sphericalDirectionAmount", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_sphericalDirectionAmount, Setter = S_sphericalDirectionAmount} }, {"randomPositionAmount", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_randomPositionAmount, Setter = S_randomPositionAmount} }, {"alignToDirection", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_alignToDirection, Setter = S_alignToDirection} }, {"radius", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_radius, Setter = S_radius} }, {"radiusMode", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_radiusMode, Setter = S_radiusMode} }, {"radiusSpread", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_radiusSpread, Setter = S_radiusSpread} }, {"radiusSpeed", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_radiusSpeed, Setter = S_radiusSpeed} }, {"radiusSpeedMultiplier", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_radiusSpeedMultiplier, Setter = S_radiusSpeedMultiplier} }, {"radiusThickness", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_radiusThickness, Setter = S_radiusThickness} }, {"angle", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_angle, Setter = S_angle} }, {"length", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_length, Setter = S_length} }, {"boxThickness", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_boxThickness, Setter = S_boxThickness} }, {"meshShapeType", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_meshShapeType, Setter = S_meshShapeType} }, {"mesh", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_mesh, Setter = S_mesh} }, {"meshRenderer", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_meshRenderer, Setter = S_meshRenderer} }, {"skinnedMeshRenderer", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_skinnedMeshRenderer, Setter = S_skinnedMeshRenderer} }, {"sprite", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_sprite, Setter = S_sprite} }, {"spriteRenderer", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_spriteRenderer, Setter = S_spriteRenderer} }, {"useMeshMaterialIndex", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_useMeshMaterialIndex, Setter = S_useMeshMaterialIndex} }, {"meshMaterialIndex", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_meshMaterialIndex, Setter = S_meshMaterialIndex} }, {"useMeshColors", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_useMeshColors, Setter = S_useMeshColors} }, {"normalOffset", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_normalOffset, Setter = S_normalOffset} }, {"meshSpawnMode", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_meshSpawnMode, Setter = S_meshSpawnMode} }, {"meshSpawnSpread", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_meshSpawnSpread, Setter = S_meshSpawnSpread} }, {"meshSpawnSpeed", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_meshSpawnSpeed, Setter = S_meshSpawnSpeed} }, {"meshSpawnSpeedMultiplier", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_meshSpawnSpeedMultiplier, Setter = S_meshSpawnSpeedMultiplier} }, {"arc", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_arc, Setter = S_arc} }, {"arcMode", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_arcMode, Setter = S_arcMode} }, {"arcSpread", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_arcSpread, Setter = S_arcSpread} }, {"arcSpeed", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_arcSpeed, Setter = S_arcSpeed} }, {"arcSpeedMultiplier", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_arcSpeedMultiplier, Setter = S_arcSpeedMultiplier} }, {"donutRadius", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_donutRadius, Setter = S_donutRadius} }, {"position", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_position, Setter = S_position} }, {"rotation", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_rotation, Setter = S_rotation} }, {"scale", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_scale, Setter = S_scale} }, {"texture", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_texture, Setter = S_texture} }, {"textureClipChannel", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_textureClipChannel, Setter = S_textureClipChannel} }, {"textureClipThreshold", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_textureClipThreshold, Setter = S_textureClipThreshold} }, {"textureColorAffectsParticles", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_textureColorAffectsParticles, Setter = S_textureColorAffectsParticles} }, {"textureAlphaAffectsParticles", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_textureAlphaAffectsParticles, Setter = S_textureAlphaAffectsParticles} }, {"textureBilinearFiltering", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_textureBilinearFiltering, Setter = S_textureBilinearFiltering} }, {"textureUVChannel", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_textureUVChannel, Setter = S_textureUVChannel} }, } }; } } } <|start_filename|>Projects/Java_bin/src/main/gen/cfg/test/TbExcelFromJsonMultiRow.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.test; import bright.serialization.*; public final class TbExcelFromJsonMultiRow { private final java.util.HashMap<Integer, cfg.test.ExcelFromJsonMultiRow> _dataMap; private final java.util.ArrayList<cfg.test.ExcelFromJsonMultiRow> _dataList; public TbExcelFromJsonMultiRow(ByteBuf _buf) { _dataMap = new java.util.HashMap<Integer, cfg.test.ExcelFromJsonMultiRow>(); _dataList = new java.util.ArrayList<cfg.test.ExcelFromJsonMultiRow>(); for(int n = _buf.readSize() ; n > 0 ; --n) { cfg.test.ExcelFromJsonMultiRow _v; _v = new cfg.test.ExcelFromJsonMultiRow(_buf); _dataList.add(_v); _dataMap.put(_v.id, _v); } } public java.util.HashMap<Integer, cfg.test.ExcelFromJsonMultiRow> getDataMap() { return _dataMap; } public java.util.ArrayList<cfg.test.ExcelFromJsonMultiRow> getDataList() { return _dataList; } public cfg.test.ExcelFromJsonMultiRow get(int key) { return _dataMap.get(key); } public void resolve(java.util.HashMap<String, Object> _tables) { for(cfg.test.ExcelFromJsonMultiRow v : _dataList) { v.resolve(_tables); } } } <|start_filename|>Projects/Csharp_Unity_bin_use_UnityEngine_Vector/Assets/Gen/item/Item.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.item { /// <summary> /// 道具 /// </summary> public sealed class Item : Bright.Config.BeanBase { public Item(ByteBuf _buf) { Id = _buf.ReadInt(); Name = _buf.ReadString(); MajorType = (item.EMajorType)_buf.ReadInt(); MinorType = (item.EMinorType)_buf.ReadInt(); MaxPileNum = _buf.ReadInt(); Quality = (item.EItemQuality)_buf.ReadInt(); Icon = _buf.ReadString(); IconBackgroud = _buf.ReadString(); IconMask = _buf.ReadString(); Desc = _buf.ReadString(); ShowOrder = _buf.ReadInt(); Quantifier = _buf.ReadString(); ShowInBag = _buf.ReadBool(); MinShowLevel = _buf.ReadInt(); BatchUsable = _buf.ReadBool(); ProgressTimeWhenUse = _buf.ReadFloat(); ShowHintWhenUse = _buf.ReadBool(); Droppable = _buf.ReadBool(); if(_buf.ReadBool()){ Price = _buf.ReadInt(); } else { Price = null; } UseType = (item.EUseType)_buf.ReadInt(); if(_buf.ReadBool()){ LevelUpId = _buf.ReadInt(); } else { LevelUpId = null; } } public static Item DeserializeItem(ByteBuf _buf) { return new item.Item(_buf); } /// <summary> /// 道具id /// </summary> public int Id { get; private set; } public string Name { get; private set; } public item.EMajorType MajorType { get; private set; } public item.EMinorType MinorType { get; private set; } public int MaxPileNum { get; private set; } public item.EItemQuality Quality { get; private set; } public string Icon { get; private set; } public string IconBackgroud { get; private set; } public string IconMask { get; private set; } public string Desc { get; private set; } public int ShowOrder { get; private set; } public string Quantifier { get; private set; } public bool ShowInBag { get; private set; } public int MinShowLevel { get; private set; } public bool BatchUsable { get; private set; } public float ProgressTimeWhenUse { get; private set; } public bool ShowHintWhenUse { get; private set; } public bool Droppable { get; private set; } public int? Price { get; private set; } public item.EUseType UseType { get; private set; } public int? LevelUpId { get; private set; } public const int __ID__ = 2107285806; public override int GetTypeId() => __ID__; public void Resolve(Dictionary<string, object> _tables) { } public void TranslateText(System.Func<string, string, string> translator) { } public override string ToString() { return "{ " + "Id:" + Id + "," + "Name:" + Name + "," + "MajorType:" + MajorType + "," + "MinorType:" + MinorType + "," + "MaxPileNum:" + MaxPileNum + "," + "Quality:" + Quality + "," + "Icon:" + Icon + "," + "IconBackgroud:" + IconBackgroud + "," + "IconMask:" + IconMask + "," + "Desc:" + Desc + "," + "ShowOrder:" + ShowOrder + "," + "Quantifier:" + Quantifier + "," + "ShowInBag:" + ShowInBag + "," + "MinShowLevel:" + MinShowLevel + "," + "BatchUsable:" + BatchUsable + "," + "ProgressTimeWhenUse:" + ProgressTimeWhenUse + "," + "ShowHintWhenUse:" + ShowHintWhenUse + "," + "Droppable:" + Droppable + "," + "Price:" + Price + "," + "UseType:" + UseType + "," + "LevelUpId:" + LevelUpId + "," + "}"; } } } <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/bonus/DropInfo.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.bonus { public sealed partial class DropInfo : Bright.Config.BeanBase { public DropInfo(ByteBuf _buf) { Id = _buf.ReadInt(); Desc = _buf.ReadString(); {int n = System.Math.Min(_buf.ReadSize(), _buf.Size);ClientShowItems = new System.Collections.Generic.List<bonus.ShowItemInfo>(n);for(var i = 0 ; i < n ; i++) { bonus.ShowItemInfo _e; _e = bonus.ShowItemInfo.DeserializeShowItemInfo(_buf); ClientShowItems.Add(_e);}} Bonus = bonus.Bonus.DeserializeBonus(_buf); } public DropInfo(int id, string desc, System.Collections.Generic.List<bonus.ShowItemInfo> client_show_items, bonus.Bonus bonus ) { this.Id = id; this.Desc = desc; this.ClientShowItems = client_show_items; this.Bonus = bonus; } public static DropInfo DeserializeDropInfo(ByteBuf _buf) { return new bonus.DropInfo(_buf); } public readonly int Id; public readonly string Desc; public readonly System.Collections.Generic.List<bonus.ShowItemInfo> ClientShowItems; public readonly bonus.Bonus Bonus; public const int ID = -2014781108; public override int GetTypeId() => ID; public void Resolve(Dictionary<string, object> _tables) { foreach(var _e in ClientShowItems) { _e?.Resolve(_tables); } Bonus?.Resolve(_tables); OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); public override string ToString() { return "{ " + "Id:" + Id + "," + "Desc:" + Desc + "," + "ClientShowItems:" + Bright.Common.StringUtil.CollectionToString(ClientShowItems) + "," + "Bonus:" + Bonus + "," + "}"; } } } <|start_filename|>Projects/GenerateDatas/convert_lua/item.TbItemExtra/1040040003.lua<|end_filename|> return { _name = 'InteractionItem', id = 1040040003, holding_static_mesh = "StaticMesh'/Game/X6GameData/Prototype/PrototypeAssets/StaticMesh/SM_Apple.SM_Apple'", holding_static_mesh_mat = "MaterialInstanceConstant'/Game/X6GameData/Art_assets/Props/Prop_test/Materials/Prop_Red_MI.Prop_Red_MI'", } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_LightProbeProxyVolume_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_LightProbeProxyVolume_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.LightProbeProxyVolume(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.LightProbeProxyVolume), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Update(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightProbeProxyVolume; { { obj.Update(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_isFeatureSupported(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.LightProbeProxyVolume.isFeatureSupported; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_boundsGlobal(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightProbeProxyVolume; var result = obj.boundsGlobal; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_sizeCustom(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightProbeProxyVolume; var result = obj.sizeCustom; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_sizeCustom(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightProbeProxyVolume; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.sizeCustom = argHelper.Get<UnityEngine.Vector3>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_originCustom(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightProbeProxyVolume; var result = obj.originCustom; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_originCustom(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightProbeProxyVolume; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.originCustom = argHelper.Get<UnityEngine.Vector3>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_probeDensity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightProbeProxyVolume; var result = obj.probeDensity; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_probeDensity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightProbeProxyVolume; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.probeDensity = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_gridResolutionX(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightProbeProxyVolume; var result = obj.gridResolutionX; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_gridResolutionX(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightProbeProxyVolume; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.gridResolutionX = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_gridResolutionY(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightProbeProxyVolume; var result = obj.gridResolutionY; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_gridResolutionY(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightProbeProxyVolume; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.gridResolutionY = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_gridResolutionZ(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightProbeProxyVolume; var result = obj.gridResolutionZ; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_gridResolutionZ(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightProbeProxyVolume; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.gridResolutionZ = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_boundingBoxMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightProbeProxyVolume; var result = obj.boundingBoxMode; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_boundingBoxMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightProbeProxyVolume; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.boundingBoxMode = (UnityEngine.LightProbeProxyVolume.BoundingBoxMode)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_resolutionMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightProbeProxyVolume; var result = obj.resolutionMode; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_resolutionMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightProbeProxyVolume; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.resolutionMode = (UnityEngine.LightProbeProxyVolume.ResolutionMode)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_probePositionMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightProbeProxyVolume; var result = obj.probePositionMode; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_probePositionMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightProbeProxyVolume; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.probePositionMode = (UnityEngine.LightProbeProxyVolume.ProbePositionMode)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_refreshMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightProbeProxyVolume; var result = obj.refreshMode; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_refreshMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightProbeProxyVolume; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.refreshMode = (UnityEngine.LightProbeProxyVolume.RefreshMode)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_qualityMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightProbeProxyVolume; var result = obj.qualityMode; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_qualityMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightProbeProxyVolume; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.qualityMode = (UnityEngine.LightProbeProxyVolume.QualityMode)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_dataFormat(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightProbeProxyVolume; var result = obj.dataFormat; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_dataFormat(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LightProbeProxyVolume; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.dataFormat = (UnityEngine.LightProbeProxyVolume.DataFormat)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "Update", IsStatic = false}, M_Update }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"isFeatureSupported", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_isFeatureSupported, Setter = null} }, {"boundsGlobal", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_boundsGlobal, Setter = null} }, {"sizeCustom", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_sizeCustom, Setter = S_sizeCustom} }, {"originCustom", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_originCustom, Setter = S_originCustom} }, {"probeDensity", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_probeDensity, Setter = S_probeDensity} }, {"gridResolutionX", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_gridResolutionX, Setter = S_gridResolutionX} }, {"gridResolutionY", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_gridResolutionY, Setter = S_gridResolutionY} }, {"gridResolutionZ", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_gridResolutionZ, Setter = S_gridResolutionZ} }, {"boundingBoxMode", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_boundingBoxMode, Setter = S_boundingBoxMode} }, {"resolutionMode", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_resolutionMode, Setter = S_resolutionMode} }, {"probePositionMode", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_probePositionMode, Setter = S_probePositionMode} }, {"refreshMode", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_refreshMode, Setter = S_refreshMode} }, {"qualityMode", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_qualityMode, Setter = S_qualityMode} }, {"dataFormat", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_dataFormat, Setter = S_dataFormat} }, } }; } } } <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/cost/CostCurrency.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.cost { public sealed partial class CostCurrency : cost.Cost { public CostCurrency(ByteBuf _buf) : base(_buf) { Type = (item.ECurrencyType)_buf.ReadInt(); Num = _buf.ReadInt(); } public CostCurrency(item.ECurrencyType type, int num ) : base() { this.Type = type; this.Num = num; } public static CostCurrency DeserializeCostCurrency(ByteBuf _buf) { return new cost.CostCurrency(_buf); } public readonly item.ECurrencyType Type; public readonly int Num; public const int ID = 911838111; public override int GetTypeId() => ID; public override void Resolve(Dictionary<string, object> _tables) { base.Resolve(_tables); OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); public override string ToString() { return "{ " + "Type:" + Type + "," + "Num:" + Num + "," + "}"; } } } <|start_filename|>Projects/GenerateDatas/convert_lua/role.TbRoleLevelExpAttr/61.lua<|end_filename|> return { level = 61, need_exp = 130000, clothes_attrs = { 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, }, } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_AudioReverbFilter_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_AudioReverbFilter_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.AudioReverbFilter(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.AudioReverbFilter), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_reverbPreset(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AudioReverbFilter; var result = obj.reverbPreset; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_reverbPreset(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AudioReverbFilter; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.reverbPreset = (UnityEngine.AudioReverbPreset)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_dryLevel(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AudioReverbFilter; var result = obj.dryLevel; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_dryLevel(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AudioReverbFilter; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.dryLevel = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_room(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AudioReverbFilter; var result = obj.room; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_room(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AudioReverbFilter; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.room = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_roomHF(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AudioReverbFilter; var result = obj.roomHF; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_roomHF(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AudioReverbFilter; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.roomHF = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_decayTime(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AudioReverbFilter; var result = obj.decayTime; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_decayTime(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AudioReverbFilter; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.decayTime = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_decayHFRatio(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AudioReverbFilter; var result = obj.decayHFRatio; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_decayHFRatio(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AudioReverbFilter; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.decayHFRatio = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_reflectionsLevel(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AudioReverbFilter; var result = obj.reflectionsLevel; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_reflectionsLevel(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AudioReverbFilter; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.reflectionsLevel = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_reflectionsDelay(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AudioReverbFilter; var result = obj.reflectionsDelay; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_reflectionsDelay(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AudioReverbFilter; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.reflectionsDelay = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_reverbLevel(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AudioReverbFilter; var result = obj.reverbLevel; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_reverbLevel(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AudioReverbFilter; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.reverbLevel = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_reverbDelay(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AudioReverbFilter; var result = obj.reverbDelay; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_reverbDelay(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AudioReverbFilter; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.reverbDelay = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_diffusion(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AudioReverbFilter; var result = obj.diffusion; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_diffusion(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AudioReverbFilter; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.diffusion = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_density(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AudioReverbFilter; var result = obj.density; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_density(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AudioReverbFilter; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.density = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_hfReference(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AudioReverbFilter; var result = obj.hfReference; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_hfReference(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AudioReverbFilter; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.hfReference = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_roomLF(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AudioReverbFilter; var result = obj.roomLF; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_roomLF(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AudioReverbFilter; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.roomLF = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_lfReference(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AudioReverbFilter; var result = obj.lfReference; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_lfReference(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AudioReverbFilter; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.lfReference = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"reverbPreset", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_reverbPreset, Setter = S_reverbPreset} }, {"dryLevel", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_dryLevel, Setter = S_dryLevel} }, {"room", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_room, Setter = S_room} }, {"roomHF", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_roomHF, Setter = S_roomHF} }, {"decayTime", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_decayTime, Setter = S_decayTime} }, {"decayHFRatio", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_decayHFRatio, Setter = S_decayHFRatio} }, {"reflectionsLevel", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_reflectionsLevel, Setter = S_reflectionsLevel} }, {"reflectionsDelay", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_reflectionsDelay, Setter = S_reflectionsDelay} }, {"reverbLevel", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_reverbLevel, Setter = S_reverbLevel} }, {"reverbDelay", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_reverbDelay, Setter = S_reverbDelay} }, {"diffusion", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_diffusion, Setter = S_diffusion} }, {"density", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_density, Setter = S_density} }, {"hfReference", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_hfReference, Setter = S_hfReference} }, {"roomLF", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_roomLF, Setter = S_roomLF} }, {"lfReference", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_lfReference, Setter = S_lfReference} }, } }; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_AreaEffector2D_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_AreaEffector2D_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.AreaEffector2D(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.AreaEffector2D), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_forceAngle(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AreaEffector2D; var result = obj.forceAngle; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_forceAngle(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AreaEffector2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.forceAngle = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_useGlobalAngle(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AreaEffector2D; var result = obj.useGlobalAngle; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_useGlobalAngle(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AreaEffector2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.useGlobalAngle = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_forceMagnitude(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AreaEffector2D; var result = obj.forceMagnitude; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_forceMagnitude(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AreaEffector2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.forceMagnitude = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_forceVariation(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AreaEffector2D; var result = obj.forceVariation; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_forceVariation(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AreaEffector2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.forceVariation = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_drag(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AreaEffector2D; var result = obj.drag; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_drag(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AreaEffector2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.drag = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_angularDrag(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AreaEffector2D; var result = obj.angularDrag; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_angularDrag(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AreaEffector2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.angularDrag = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_forceTarget(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AreaEffector2D; var result = obj.forceTarget; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_forceTarget(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AreaEffector2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.forceTarget = (UnityEngine.EffectorSelection2D)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"forceAngle", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_forceAngle, Setter = S_forceAngle} }, {"useGlobalAngle", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_useGlobalAngle, Setter = S_useGlobalAngle} }, {"forceMagnitude", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_forceMagnitude, Setter = S_forceMagnitude} }, {"forceVariation", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_forceVariation, Setter = S_forceVariation} }, {"drag", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_drag, Setter = S_drag} }, {"angularDrag", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_angularDrag, Setter = S_angularDrag} }, {"forceTarget", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_forceTarget, Setter = S_forceTarget} }, } }; } } } <|start_filename|>Projects/DataTemplates/template_erlang/l10n_tbpatchdemo.erl<|end_filename|> %% l10n.TbPatchDemo get(11) -> #{id => 11,value => 1}. get(12) -> #{id => 12,value => 2}. get(13) -> #{id => 13,value => 3}. get(14) -> #{id => 14,value => 4}. get(15) -> #{id => 15,value => 5}. get(16) -> #{id => 16,value => 6}. get(17) -> #{id => 17,value => 7}. get(18) -> #{id => 18,value => 8}. <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/ai/BehaviorTree.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.ai { public sealed partial class BehaviorTree : Bright.Config.BeanBase { public BehaviorTree(ByteBuf _buf) { Id = _buf.ReadInt(); Name = _buf.ReadString(); Desc = _buf.ReadString(); BlackboardId = _buf.ReadString(); Root = ai.ComposeNode.DeserializeComposeNode(_buf); } public BehaviorTree(int id, string name, string desc, string blackboard_id, ai.ComposeNode root ) { this.Id = id; this.Name = name; this.Desc = desc; this.BlackboardId = blackboard_id; this.Root = root; } public static BehaviorTree DeserializeBehaviorTree(ByteBuf _buf) { return new ai.BehaviorTree(_buf); } public readonly int Id; public readonly string Name; public readonly string Desc; public readonly string BlackboardId; public ai.Blackboard BlackboardId_Ref; public readonly ai.ComposeNode Root; public const int ID = 159552822; public override int GetTypeId() => ID; public void Resolve(Dictionary<string, object> _tables) { this.BlackboardId_Ref = (_tables["ai.TbBlackboard"] as ai.TbBlackboard).GetOrDefault(BlackboardId); Root?.Resolve(_tables); OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); public override string ToString() { return "{ " + "Id:" + Id + "," + "Name:" + Name + "," + "Desc:" + Desc + "," + "BlackboardId:" + BlackboardId + "," + "Root:" + Root + "," + "}"; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_AudioChorusFilter_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_AudioChorusFilter_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.AudioChorusFilter(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.AudioChorusFilter), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_dryMix(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AudioChorusFilter; var result = obj.dryMix; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_dryMix(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AudioChorusFilter; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.dryMix = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_wetMix1(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AudioChorusFilter; var result = obj.wetMix1; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_wetMix1(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AudioChorusFilter; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.wetMix1 = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_wetMix2(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AudioChorusFilter; var result = obj.wetMix2; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_wetMix2(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AudioChorusFilter; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.wetMix2 = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_wetMix3(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AudioChorusFilter; var result = obj.wetMix3; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_wetMix3(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AudioChorusFilter; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.wetMix3 = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_delay(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AudioChorusFilter; var result = obj.delay; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_delay(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AudioChorusFilter; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.delay = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_rate(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AudioChorusFilter; var result = obj.rate; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_rate(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AudioChorusFilter; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.rate = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_depth(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AudioChorusFilter; var result = obj.depth; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_depth(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AudioChorusFilter; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.depth = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"dryMix", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_dryMix, Setter = S_dryMix} }, {"wetMix1", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_wetMix1, Setter = S_wetMix1} }, {"wetMix2", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_wetMix2, Setter = S_wetMix2} }, {"wetMix3", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_wetMix3, Setter = S_wetMix3} }, {"delay", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_delay, Setter = S_delay} }, {"rate", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_rate, Setter = S_rate} }, {"depth", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_depth, Setter = S_depth} }, } }; } } } <|start_filename|>Projects/DataTemplates/template_erlang/test_tbtestnull.erl<|end_filename|> %% test.TbTestNull get(10) -> #{id => 10}. get(11) -> #{id => 11}. get(12) -> #{id => 12,x1 => 1,x2 => 1,x3 => #{x1 => 1},x4 => #{name__ => "DemoD2",x1 => 2,x2 => 3},s1 => "asf",s2 => #{key=>"key1",text=>"abcdef"}}. get(20) -> #{id => 20}. get(21) -> #{id => 21}. get(22) -> #{id => 22,x1 => 1,x2 => 2,x3 => #{x1 => 3},x4 => #{name__ => "DemoD2",x1 => 1,x2 => 2},s1 => "asfs",s2 => #{key=>"/asf/asfa",text=>"abcdef"}}. get(30) -> #{id => 30,x1 => 1,x2 => 1,x3 => #{x1 => 1},x4 => #{name__ => "DemoD2",x1 => 1,x2 => 22},s1 => "abcd",s2 => #{key=>"asdfasew",text=>"hahaha"}}. get(31) -> #{id => 31}. get(1) -> #{id => 1}. get(2) -> #{id => 2,x1 => 1,x2 => 1,x3 => #{x1 => 3},x4 => #{name__ => "DemoD2",x1 => 1,x2 => 2},s1 => "asfasfasf",s2 => #{key=>"/keyasf",text=>"asf"}}. get(3) -> #{id => 3,s1 => "",s2 => #{key=>"",text=>""}}. <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/ai/GetOwnerPlayer.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.ai { public sealed partial class GetOwnerPlayer : ai.Service { public GetOwnerPlayer(ByteBuf _buf) : base(_buf) { PlayerActorKey = _buf.ReadString(); } public GetOwnerPlayer(int id, string node_name, string player_actor_key ) : base(id,node_name) { this.PlayerActorKey = player_actor_key; } public static GetOwnerPlayer DeserializeGetOwnerPlayer(ByteBuf _buf) { return new ai.GetOwnerPlayer(_buf); } public readonly string PlayerActorKey; public const int ID = -999247644; public override int GetTypeId() => ID; public override void Resolve(Dictionary<string, object> _tables) { base.Resolve(_tables); OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); public override string ToString() { return "{ " + "Id:" + Id + "," + "NodeName:" + NodeName + "," + "PlayerActorKey:" + PlayerActorKey + "," + "}"; } } } <|start_filename|>Projects/Lua_Unity_xlua_lua/Assets/Lua/Gen/TbSystemMail.lua<|end_filename|> return { [11] = {id=11,title='测试1',sender='系统',content='测试内容1',award={1,},}, [12] = {id=12,title='测试2',sender='系统',content='测试内容2',award={1,},}, [13] = {id=13,title='测试3',sender='系统',content='测试内容3',award={1,2,3,},}, [14] = {id=14,title='测试4',sender='系统',content='测试内容4',award={2,3,},}, [15] = {id=15,title='测试5',sender='系统',content='测试内容5',award={1,},}, } <|start_filename|>Projects/DataTemplates/template_erlang2/item_tbitemextra.erl<|end_filename|> %% item.TbItemExtra -module(item_tbitemextra) -export([get/1,get_ids/0]) get(1022200001) -> #{ id => 1022200001, key_item_id => 1022300001, open_level => bean, use_on_obtain => true, drop_ids => array, choose_list => array }. get(1022300001) -> #{ id => 1022300001, key_item_id => null, open_level => bean, use_on_obtain => true, drop_ids => array, choose_list => array }. get(1010010003) -> #{ id => 1010010003, key_item_id => null, open_level => bean, use_on_obtain => true, drop_ids => array, choose_list => array }. get(1050010001) -> #{ id => 1050010001, key_item_id => null, open_level => bean, use_on_obtain => false, drop_ids => array, choose_list => array }. get(1040010001) -> #{ id => 1040010001, attack_num => null, holding_static_mesh => "", holding_static_mesh_mat => "" }. get(1040020001) -> #{ id => 1040020001, attack_num => null, holding_static_mesh => "StaticMesh'/Game/X6GameData/Prototype/PrototypeAssets/StaticMesh/SM_Apple.SM_Apple'", holding_static_mesh_mat => "MaterialInstanceConstant'/Game/X6GameData/Prototype/PrototypeAssets/Material/LD_Red.LD_Red'" }. get(1040040001) -> #{ id => 1040040001, attack_num => null, holding_static_mesh => "StaticMesh'/Game/X6GameData/Prototype/PrototypeAssets/StaticMesh/SM_Ball.SM_Ball'", holding_static_mesh_mat => "MaterialInstanceConstant'/Game/X6GameData/Prototype/PrototypeAssets/CustomizableGrid/Materials/Presets/M_Grid_preset_002.M_Grid_preset_002'" }. get(1040040002) -> #{ id => 1040040002, attack_num => null, holding_static_mesh => "StaticMesh'/Game/X6GameData/Art_assets/Props/Prop_test/Interactive/PenQuanHua/SM_Penquanhua.SM_Penquanhua'", holding_static_mesh_mat => "" }. get(1040040003) -> #{ id => 1040040003, attack_num => null, holding_static_mesh => "StaticMesh'/Game/X6GameData/Prototype/PrototypeAssets/StaticMesh/SM_Apple.SM_Apple'", holding_static_mesh_mat => "MaterialInstanceConstant'/Game/X6GameData/Art_assets/Props/Prop_test/Materials/Prop_Red_MI.Prop_Red_MI'" }. get(1040210001) -> #{ id => 1040210001, attack_num => 3, holding_static_mesh => "", holding_static_mesh_mat => "" }. get(1040220001) -> #{ id => 1040220001, attack_num => null, holding_static_mesh => "", holding_static_mesh_mat => "" }. get(1040230001) -> #{ id => 1040230001, attack_num => null, holding_static_mesh => "", holding_static_mesh_mat => "" }. get(1040240001) -> #{ id => 1040240001, attack_num => null, holding_static_mesh => "", holding_static_mesh_mat => "" }. get(1040250001) -> #{ id => 1040250001, attack_num => null, holding_static_mesh => "", holding_static_mesh_mat => "" }. get(1040030001) -> #{ id => 1040030001, attack_num => null, holding_static_mesh => "", holding_static_mesh_mat => "" }. get(1020100001) -> #{ id => 1020100001, attack => 100, hp => 1000, energy_limit => 5, energy_resume => 1 }. get(1020200001) -> #{ id => 1020200001, attack => 100, hp => 1000, energy_limit => 5, energy_resume => 1 }. get(1020300001) -> #{ id => 1020300001, attack => 100, hp => 1000, energy_limit => 5, energy_resume => 1 }. get(1110010005) -> #{ id => 1110010005, learn_component_id => array }. get(1110010006) -> #{ id => 1110010006, learn_component_id => array }. get(1110020001) -> #{ id => 1110020001, learn_component_id => array }. get(1110020002) -> #{ id => 1110020002, learn_component_id => array }. get(1110020003) -> #{ id => 1110020003, learn_component_id => array }. get(1110020004) -> #{ id => 1110020004, learn_component_id => array }. get(1110020005) -> #{ id => 1110020005, learn_component_id => array }. get(1110020009) -> #{ id => 1110020009, learn_component_id => array }. get(1110020010) -> #{ id => 1110020010, learn_component_id => array }. get(1110020011) -> #{ id => 1110020011, learn_component_id => array }. get(1110020012) -> #{ id => 1110020012, learn_component_id => array }. get(1110020013) -> #{ id => 1110020013, learn_component_id => array }. get(1110020014) -> #{ id => 1110020014, learn_component_id => array }. get(1110020015) -> #{ id => 1110020015, learn_component_id => array }. get(1110020016) -> #{ id => 1110020016, learn_component_id => array }. get(1110020017) -> #{ id => 1110020017, learn_component_id => array }. get(1110020018) -> #{ id => 1110020018, learn_component_id => array }. get(1110020080) -> #{ id => 1110020080, learn_component_id => array }. get_ids() -> [1022200001,1022300001,1010010003,1050010001,1040010001,1040020001,1040040001,1040040002,1040040003,1040210001,1040220001,1040230001,1040240001,1040250001,1040030001,1020100001,1020200001,1020300001,1110010005,1110010006,1110020001,1110020002,1110020003,1110020004,1110020005,1110020009,1110020010,1110020011,1110020012,1110020013,1110020014,1110020015,1110020016,1110020017,1110020018,1110020080]. <|start_filename|>Projects/Java_bin/src/main/gen/cfg/item/TreasureBox.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.item; import bright.serialization.*; public final class TreasureBox extends cfg.item.ItemExtra { public TreasureBox(ByteBuf _buf) { super(_buf); if(_buf.readBool()){ keyItemId = _buf.readInt(); } else { keyItemId = null; } openLevel = new cfg.condition.MinLevel(_buf); useOnObtain = _buf.readBool(); {int n = Math.min(_buf.readSize(), _buf.size());dropIds = new java.util.ArrayList<Integer>(n);for(int i = 0 ; i < n ; i++) { Integer _e; _e = _buf.readInt(); dropIds.add(_e);}} {int n = Math.min(_buf.readSize(), _buf.size());chooseList = new java.util.ArrayList<cfg.item.ChooseOneBonus>(n);for(int i = 0 ; i < n ; i++) { cfg.item.ChooseOneBonus _e; _e = new cfg.item.ChooseOneBonus(_buf); chooseList.add(_e);}} } public TreasureBox(int id, Integer key_item_id, cfg.condition.MinLevel open_level, boolean use_on_obtain, java.util.ArrayList<Integer> drop_ids, java.util.ArrayList<cfg.item.ChooseOneBonus> choose_list ) { super(id); this.keyItemId = key_item_id; this.openLevel = open_level; this.useOnObtain = use_on_obtain; this.dropIds = drop_ids; this.chooseList = choose_list; } public final Integer keyItemId; public final cfg.condition.MinLevel openLevel; public final boolean useOnObtain; public final java.util.ArrayList<Integer> dropIds; public final java.util.ArrayList<cfg.item.ChooseOneBonus> chooseList; public static final int __ID__ = 1494222369; @Override public int getTypeId() { return __ID__; } @Override public void resolve(java.util.HashMap<String, Object> _tables) { super.resolve(_tables); if (openLevel != null) {openLevel.resolve(_tables);} for(cfg.item.ChooseOneBonus _e : chooseList) { if (_e != null) _e.resolve(_tables); } } @Override public String toString() { return "{ " + "id:" + id + "," + "keyItemId:" + keyItemId + "," + "openLevel:" + openLevel + "," + "useOnObtain:" + useOnObtain + "," + "dropIds:" + dropIds + "," + "chooseList:" + chooseList + "," + "}"; } } <|start_filename|>Projects/DataTemplates/template_lua/test_tbdemoprimitive.lua<|end_filename|> return { [3] = {x1=false,x2=1,x3=2,x4=3,x5=4,x6=5,x7=6,s1="hello",s2={key='/test/key1',text="测试本地化字符串1"},v2={x=1,y=2},v3={x=2,y=3,z=4},v4={x=4,y=5,z=6,w=7},t1=946742700,}, [4] = {x1=true,x2=1,x3=2,x4=4,x5=4,x6=5,x7=6,s1="world",s2={key='/test/key2',text="测试本地化字符串2"},v2={x=2,y=3},v3={x=2.2,y=2.3,z=3.4},v4={x=4.5,y=5.6,z=6.7,w=8.8},t1=946829099,}, [5] = {x1=true,x2=1,x3=2,x4=5,x5=4,x6=5,x7=6,s1="nihao",s2={key='/test/key3',text="测试本地化字符串3"},v2={x=4,y=5},v3={x=2.2,y=2.3,z=3.5},v4={x=4.5,y=5.6,z=6.8,w=9.9},t1=946915499,}, [6] = {x1=true,x2=1,x3=2,x4=6,x5=4,x6=5,x7=6,s1="shijie",s2={key='/test/key4',text="测试本地化字符串4"},v2={x=6,y=7},v3={x=2.2,y=2.3,z=3.6},v4={x=4.5,y=5.6,z=6.9,w=123},t1=947001899,}, } <|start_filename|>Projects/GenerateDatas/convert_lua/role.TbRoleLevelExpAttr/95.lua<|end_filename|> return { level = 95, need_exp = 300000, clothes_attrs = { 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, }, } <|start_filename|>Projects/TypeScript_NodeJs_Bin/package-lock.json<|end_filename|> { "name": "demo-js", "version": "0.0.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "demo-js", "version": "0.0.0", "dependencies": { "node": "^16.4.1", "nodejs": "^0.0.0" }, "devDependencies": { "@types/node": "^15.14.2", "typescript": "^3.9.7" } }, "node_modules/@types/node": { "version": "15.14.2", "resolved": "https://registry.npmjs.org/@types/node/-/node-15.14.2.tgz", "integrity": "sha512-dvMUE/m2LbXPwlvVuzCyslTEtQ2ZwuuFClDrOQ6mp2CenCg971719PTILZ4I6bTP27xfFFc+o7x2TkLuun/MPw==", "dev": true }, "node_modules/node": { "version": "16.4.1", "resolved": "https://registry.npmjs.org/node/-/node-16.4.1.tgz", "integrity": "sha512-0BATp6HUqEylW2PxnwRf9KQyeUq+yE45OdTam9sOvY7G4/BgIbMEOlOIavElOFm3lm1AKwt+Athr68h4h10P+Q==", "hasInstallScript": true, "dependencies": { "node-bin-setup": "^1.0.0" }, "bin": { "node": "bin/node.exe" }, "engines": { "npm": ">=5.0.0" } }, "node_modules/node-bin-setup": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/node-bin-setup/-/node-bin-setup-1.0.6.tgz", "integrity": "sha512-uPIxXNis1CRbv1DwqAxkgBk5NFV3s7cMN/Gf556jSw6jBvV7ca4F9lRL/8cALcZecRibeqU+5dFYqFFmzv5a0Q==" }, "node_modules/nodejs": { "version": "0.0.0", "resolved": "https://registry.npmjs.org/nodejs/-/nodejs-0.0.0.tgz", "integrity": "sha1-RyL6LhisTrc6Qq4W0B41hKErdTE=" }, "node_modules/typescript": { "version": "3.9.10", "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.10.tgz", "integrity": "<KEY> "dev": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" }, "engines": { "node": ">=4.2.0" } } }, "dependencies": { "@types/node": { "version": "15.14.2", "resolved": "https://registry.npmjs.org/@types/node/-/node-15.14.2.tgz", "integrity": "<KEY> "dev": true }, "node": { "version": "16.4.1", "resolved": "https://registry.npmjs.org/node/-/node-16.4.1.tgz", "integrity": "sha512-0BATp6HUqEylW2PxnwRf9KQyeUq+yE45OdTam9sOvY7G4/BgIbMEOlOIavElOFm3lm1AKwt+Athr68h4h10P+Q==", "requires": { "node-bin-setup": "^1.0.0" } }, "node-bin-setup": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/node-bin-setup/-/node-bin-setup-1.0.6.tgz", "integrity": "<KEY> }, "nodejs": { "version": "0.0.0", "resolved": "https://registry.npmjs.org/nodejs/-/nodejs-0.0.0.tgz", "integrity": "sha1-RyL6LhisTrc6Qq4W0B41hKErdTE=" }, "typescript": { "version": "3.9.10", "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.10.tgz", "integrity": "<KEY> "dev": true } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_ILogHandler_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_ILogHandler_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.ILogHandler constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_LogFormat(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ILogHandler; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); { var Arg0 = (UnityEngine.LogType)argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.Object>(false); var Arg2 = argHelper2.GetString(false); var Arg3 = argHelper3.GetParams<System.Object>(info, 3, paramLen); obj.LogFormat(Arg0,Arg1,Arg2,Arg3); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_LogException(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ILogHandler; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<System.Exception>(false); var Arg1 = argHelper1.Get<UnityEngine.Object>(false); obj.LogException(Arg0,Arg1); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "LogFormat", IsStatic = false}, M_LogFormat }, { new Puerts.MethodKey {Name = "LogException", IsStatic = false}, M_LogException }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { } }; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_Animation_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_Animation_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.Animation(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.Animation), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Stop(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Animation; if (paramLen == 0) { { obj.Stop(); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); obj.Stop(Arg0); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to Stop"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Rewind(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Animation; if (paramLen == 0) { { obj.Rewind(); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); obj.Rewind(Arg0); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to Rewind"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Sample(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Animation; { { obj.Sample(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_IsPlaying(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Animation; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetString(false); var result = obj.IsPlaying(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Play(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Animation; if (paramLen == 0) { { var result = obj.Play(); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = (UnityEngine.PlayMode)argHelper0.GetInt32(false); var result = obj.Play(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var result = obj.Play(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = (UnityEngine.PlayMode)argHelper1.GetInt32(false); var result = obj.Play(Arg0,Arg1); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to Play"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_CrossFade(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Animation; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); obj.CrossFade(Arg0); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.GetFloat(false); obj.CrossFade(Arg0,Arg1); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = (UnityEngine.PlayMode)argHelper2.GetInt32(false); obj.CrossFade(Arg0,Arg1,Arg2); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to CrossFade"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Blend(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Animation; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); obj.Blend(Arg0); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.GetFloat(false); obj.Blend(Arg0,Arg1); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.GetFloat(false); obj.Blend(Arg0,Arg1,Arg2); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to Blend"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_CrossFadeQueued(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Animation; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var result = obj.CrossFadeQueued(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.GetFloat(false); var result = obj.CrossFadeQueued(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = (UnityEngine.QueueMode)argHelper2.GetInt32(false); var result = obj.CrossFadeQueued(Arg0,Arg1,Arg2); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = (UnityEngine.QueueMode)argHelper2.GetInt32(false); var Arg3 = (UnityEngine.PlayMode)argHelper3.GetInt32(false); var result = obj.CrossFadeQueued(Arg0,Arg1,Arg2,Arg3); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to CrossFadeQueued"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_PlayQueued(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Animation; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var result = obj.PlayQueued(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = (UnityEngine.QueueMode)argHelper1.GetInt32(false); var result = obj.PlayQueued(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = (UnityEngine.QueueMode)argHelper1.GetInt32(false); var Arg2 = (UnityEngine.PlayMode)argHelper2.GetInt32(false); var result = obj.PlayQueued(Arg0,Arg1,Arg2); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to PlayQueued"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_AddClip(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Animation; if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.AnimationClip), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.AnimationClip>(false); var Arg1 = argHelper1.GetString(false); obj.AddClip(Arg0,Arg1); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.AnimationClip), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.AnimationClip>(false); var Arg1 = argHelper1.GetString(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetInt32(false); obj.AddClip(Arg0,Arg1,Arg2,Arg3); return; } } if (paramLen == 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.AnimationClip), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.AnimationClip>(false); var Arg1 = argHelper1.GetString(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetInt32(false); var Arg4 = argHelper4.GetBoolean(false); obj.AddClip(Arg0,Arg1,Arg2,Arg3,Arg4); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to AddClip"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_RemoveClip(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Animation; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.AnimationClip), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.AnimationClip>(false); obj.RemoveClip(Arg0); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); obj.RemoveClip(Arg0); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to RemoveClip"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetClipCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Animation; { { var result = obj.GetClipCount(); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SyncLayer(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Animation; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); obj.SyncLayer(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetEnumerator(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Animation; { { var result = obj.GetEnumerator(); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetClip(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Animation; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetString(false); var result = obj.GetClip(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_clip(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Animation; var result = obj.clip; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_clip(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Animation; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.clip = argHelper.Get<UnityEngine.AnimationClip>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_playAutomatically(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Animation; var result = obj.playAutomatically; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_playAutomatically(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Animation; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.playAutomatically = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_wrapMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Animation; var result = obj.wrapMode; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_wrapMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Animation; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.wrapMode = (UnityEngine.WrapMode)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_isPlaying(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Animation; var result = obj.isPlaying; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_animatePhysics(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Animation; var result = obj.animatePhysics; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_animatePhysics(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Animation; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.animatePhysics = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_cullingType(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Animation; var result = obj.cullingType; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_cullingType(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Animation; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.cullingType = (UnityEngine.AnimationCullingType)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_localBounds(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Animation; var result = obj.localBounds; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_localBounds(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Animation; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.localBounds = argHelper.Get<UnityEngine.Bounds>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void GetItem(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Animation; var keyHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (keyHelper.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var key = keyHelper.GetString(false); var result = obj[key]; Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "Stop", IsStatic = false}, M_Stop }, { new Puerts.MethodKey {Name = "Rewind", IsStatic = false}, M_Rewind }, { new Puerts.MethodKey {Name = "Sample", IsStatic = false}, M_Sample }, { new Puerts.MethodKey {Name = "IsPlaying", IsStatic = false}, M_IsPlaying }, { new Puerts.MethodKey {Name = "Play", IsStatic = false}, M_Play }, { new Puerts.MethodKey {Name = "CrossFade", IsStatic = false}, M_CrossFade }, { new Puerts.MethodKey {Name = "Blend", IsStatic = false}, M_Blend }, { new Puerts.MethodKey {Name = "CrossFadeQueued", IsStatic = false}, M_CrossFadeQueued }, { new Puerts.MethodKey {Name = "PlayQueued", IsStatic = false}, M_PlayQueued }, { new Puerts.MethodKey {Name = "AddClip", IsStatic = false}, M_AddClip }, { new Puerts.MethodKey {Name = "RemoveClip", IsStatic = false}, M_RemoveClip }, { new Puerts.MethodKey {Name = "GetClipCount", IsStatic = false}, M_GetClipCount }, { new Puerts.MethodKey {Name = "SyncLayer", IsStatic = false}, M_SyncLayer }, { new Puerts.MethodKey {Name = "GetEnumerator", IsStatic = false}, M_GetEnumerator }, { new Puerts.MethodKey {Name = "GetClip", IsStatic = false}, M_GetClip }, { new Puerts.MethodKey {Name = "get_Item", IsStatic = false}, GetItem }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"clip", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_clip, Setter = S_clip} }, {"playAutomatically", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_playAutomatically, Setter = S_playAutomatically} }, {"wrapMode", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_wrapMode, Setter = S_wrapMode} }, {"isPlaying", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_isPlaying, Setter = null} }, {"animatePhysics", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_animatePhysics, Setter = S_animatePhysics} }, {"cullingType", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_cullingType, Setter = S_cullingType} }, {"localBounds", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_localBounds, Setter = S_localBounds} }, } }; } } } <|start_filename|>Projects/DataTemplates/template_erlang/item_tbitemfunc.erl<|end_filename|> %% item.TbItemFunc get(401) -> #{minor_type => 401,func_type => 0,method => "使用",close_bag_ui => true}. get(1102) -> #{minor_type => 1102,func_type => 1,method => "使用",close_bag_ui => false}. <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_Resolution_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_Resolution_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.Resolution constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ToString(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Resolution)Puerts.Utils.GetSelf((int)data, self); { { var result = obj.ToString(); Puerts.PuertsDLL.ReturnString(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_width(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Resolution)Puerts.Utils.GetSelf((int)data, self); var result = obj.width; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_width(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Resolution)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.width = argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_height(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Resolution)Puerts.Utils.GetSelf((int)data, self); var result = obj.height; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_height(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Resolution)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.height = argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_refreshRate(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Resolution)Puerts.Utils.GetSelf((int)data, self); var result = obj.refreshRate; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_refreshRate(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Resolution)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.refreshRate = argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "ToString", IsStatic = false}, M_ToString }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"width", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_width, Setter = S_width} }, {"height", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_height, Setter = S_height} }, {"refreshRate", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_refreshRate, Setter = S_refreshRate} }, } }; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_Mathf_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_Mathf_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.Mathf constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_ClosestPowerOfTwo(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); var result = UnityEngine.Mathf.ClosestPowerOfTwo(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_IsPowerOfTwo(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); var result = UnityEngine.Mathf.IsPowerOfTwo(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_NextPowerOfTwo(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); var result = UnityEngine.Mathf.NextPowerOfTwo(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GammaToLinearSpace(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetFloat(false); var result = UnityEngine.Mathf.GammaToLinearSpace(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_LinearToGammaSpace(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetFloat(false); var result = UnityEngine.Mathf.LinearToGammaSpace(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_CorrelatedColorTemperatureToRGB(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetFloat(false); var result = UnityEngine.Mathf.CorrelatedColorTemperatureToRGB(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_FloatToHalf(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetFloat(false); var result = UnityEngine.Mathf.FloatToHalf(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_HalfToFloat(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetUInt16(false); var result = UnityEngine.Mathf.HalfToFloat(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_PerlinNoise(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.GetFloat(false); var result = UnityEngine.Mathf.PerlinNoise(Arg0,Arg1); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_Sin(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetFloat(false); var result = UnityEngine.Mathf.Sin(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_Cos(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetFloat(false); var result = UnityEngine.Mathf.Cos(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_Tan(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetFloat(false); var result = UnityEngine.Mathf.Tan(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_Asin(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetFloat(false); var result = UnityEngine.Mathf.Asin(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_Acos(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetFloat(false); var result = UnityEngine.Mathf.Acos(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_Atan(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetFloat(false); var result = UnityEngine.Mathf.Atan(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_Atan2(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.GetFloat(false); var result = UnityEngine.Mathf.Atan2(Arg0,Arg1); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_Sqrt(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetFloat(false); var result = UnityEngine.Mathf.Sqrt(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_Abs(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetFloat(false); var result = UnityEngine.Mathf.Abs(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var result = UnityEngine.Mathf.Abs(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to Abs"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_Min(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.GetFloat(false); var result = UnityEngine.Mathf.Min(Arg0,Arg1); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var result = UnityEngine.Mathf.Min(Arg0,Arg1); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen >= 0) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(float), false, false)) { var Arg0 = argHelper0.GetParams<float>(info, 0, paramLen); var result = UnityEngine.Mathf.Min(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(int), false, false)) { var Arg0 = argHelper0.GetParams<int>(info, 0, paramLen); var result = UnityEngine.Mathf.Min(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to Min"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_Max(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.GetFloat(false); var result = UnityEngine.Mathf.Max(Arg0,Arg1); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var result = UnityEngine.Mathf.Max(Arg0,Arg1); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen >= 0) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(float), false, false)) { var Arg0 = argHelper0.GetParams<float>(info, 0, paramLen); var result = UnityEngine.Mathf.Max(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(int), false, false)) { var Arg0 = argHelper0.GetParams<int>(info, 0, paramLen); var result = UnityEngine.Mathf.Max(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to Max"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_Pow(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.GetFloat(false); var result = UnityEngine.Mathf.Pow(Arg0,Arg1); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_Exp(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetFloat(false); var result = UnityEngine.Mathf.Exp(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_Log(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.GetFloat(false); var result = UnityEngine.Mathf.Log(Arg0,Arg1); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetFloat(false); var result = UnityEngine.Mathf.Log(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to Log"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_Log10(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetFloat(false); var result = UnityEngine.Mathf.Log10(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_Ceil(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetFloat(false); var result = UnityEngine.Mathf.Ceil(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_Floor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetFloat(false); var result = UnityEngine.Mathf.Floor(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_Round(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetFloat(false); var result = UnityEngine.Mathf.Round(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_CeilToInt(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetFloat(false); var result = UnityEngine.Mathf.CeilToInt(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_FloorToInt(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetFloat(false); var result = UnityEngine.Mathf.FloorToInt(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_RoundToInt(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetFloat(false); var result = UnityEngine.Mathf.RoundToInt(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_Sign(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetFloat(false); var result = UnityEngine.Mathf.Sign(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_Clamp(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.GetFloat(false); var result = UnityEngine.Mathf.Clamp(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var result = UnityEngine.Mathf.Clamp(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to Clamp"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_Clamp01(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetFloat(false); var result = UnityEngine.Mathf.Clamp01(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_Lerp(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.GetFloat(false); var result = UnityEngine.Mathf.Lerp(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_LerpUnclamped(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.GetFloat(false); var result = UnityEngine.Mathf.LerpUnclamped(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_LerpAngle(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.GetFloat(false); var result = UnityEngine.Mathf.LerpAngle(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_MoveTowards(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.GetFloat(false); var result = UnityEngine.Mathf.MoveTowards(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_MoveTowardsAngle(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.GetFloat(false); var result = UnityEngine.Mathf.MoveTowardsAngle(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_SmoothStep(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.GetFloat(false); var result = UnityEngine.Mathf.SmoothStep(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_Gamma(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.GetFloat(false); var result = UnityEngine.Mathf.Gamma(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_Approximately(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.GetFloat(false); var result = UnityEngine.Mathf.Approximately(Arg0,Arg1); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_SmoothDamp(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, true, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.GetFloat(true); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.GetFloat(false); var result = UnityEngine.Mathf.SmoothDamp(Arg0,Arg1,ref Arg2,Arg3,Arg4); argHelper2.SetByRefValue(Arg2); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, true, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.GetFloat(true); var Arg3 = argHelper3.GetFloat(false); var result = UnityEngine.Mathf.SmoothDamp(Arg0,Arg1,ref Arg2,Arg3); argHelper2.SetByRefValue(Arg2); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 6) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, true, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.GetFloat(true); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.GetFloat(false); var Arg5 = argHelper5.GetFloat(false); var result = UnityEngine.Mathf.SmoothDamp(Arg0,Arg1,ref Arg2,Arg3,Arg4,Arg5); argHelper2.SetByRefValue(Arg2); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SmoothDamp"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_SmoothDampAngle(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, true, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.GetFloat(true); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.GetFloat(false); var result = UnityEngine.Mathf.SmoothDampAngle(Arg0,Arg1,ref Arg2,Arg3,Arg4); argHelper2.SetByRefValue(Arg2); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, true, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.GetFloat(true); var Arg3 = argHelper3.GetFloat(false); var result = UnityEngine.Mathf.SmoothDampAngle(Arg0,Arg1,ref Arg2,Arg3); argHelper2.SetByRefValue(Arg2); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 6) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, true, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.GetFloat(true); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.GetFloat(false); var Arg5 = argHelper5.GetFloat(false); var result = UnityEngine.Mathf.SmoothDampAngle(Arg0,Arg1,ref Arg2,Arg3,Arg4,Arg5); argHelper2.SetByRefValue(Arg2); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SmoothDampAngle"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_Repeat(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.GetFloat(false); var result = UnityEngine.Mathf.Repeat(Arg0,Arg1); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_PingPong(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.GetFloat(false); var result = UnityEngine.Mathf.PingPong(Arg0,Arg1); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_InverseLerp(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.GetFloat(false); var result = UnityEngine.Mathf.InverseLerp(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_DeltaAngle(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.GetFloat(false); var result = UnityEngine.Mathf.DeltaAngle(Arg0,Arg1); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_PI(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Mathf.PI; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_Infinity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Mathf.Infinity; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_NegativeInfinity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Mathf.NegativeInfinity; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_Deg2Rad(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Mathf.Deg2Rad; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_Rad2Deg(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Mathf.Rad2Deg; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_Epsilon(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Mathf.Epsilon; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "ClosestPowerOfTwo", IsStatic = true}, F_ClosestPowerOfTwo }, { new Puerts.MethodKey {Name = "IsPowerOfTwo", IsStatic = true}, F_IsPowerOfTwo }, { new Puerts.MethodKey {Name = "NextPowerOfTwo", IsStatic = true}, F_NextPowerOfTwo }, { new Puerts.MethodKey {Name = "GammaToLinearSpace", IsStatic = true}, F_GammaToLinearSpace }, { new Puerts.MethodKey {Name = "LinearToGammaSpace", IsStatic = true}, F_LinearToGammaSpace }, { new Puerts.MethodKey {Name = "CorrelatedColorTemperatureToRGB", IsStatic = true}, F_CorrelatedColorTemperatureToRGB }, { new Puerts.MethodKey {Name = "FloatToHalf", IsStatic = true}, F_FloatToHalf }, { new Puerts.MethodKey {Name = "HalfToFloat", IsStatic = true}, F_HalfToFloat }, { new Puerts.MethodKey {Name = "PerlinNoise", IsStatic = true}, F_PerlinNoise }, { new Puerts.MethodKey {Name = "Sin", IsStatic = true}, F_Sin }, { new Puerts.MethodKey {Name = "Cos", IsStatic = true}, F_Cos }, { new Puerts.MethodKey {Name = "Tan", IsStatic = true}, F_Tan }, { new Puerts.MethodKey {Name = "Asin", IsStatic = true}, F_Asin }, { new Puerts.MethodKey {Name = "Acos", IsStatic = true}, F_Acos }, { new Puerts.MethodKey {Name = "Atan", IsStatic = true}, F_Atan }, { new Puerts.MethodKey {Name = "Atan2", IsStatic = true}, F_Atan2 }, { new Puerts.MethodKey {Name = "Sqrt", IsStatic = true}, F_Sqrt }, { new Puerts.MethodKey {Name = "Abs", IsStatic = true}, F_Abs }, { new Puerts.MethodKey {Name = "Min", IsStatic = true}, F_Min }, { new Puerts.MethodKey {Name = "Max", IsStatic = true}, F_Max }, { new Puerts.MethodKey {Name = "Pow", IsStatic = true}, F_Pow }, { new Puerts.MethodKey {Name = "Exp", IsStatic = true}, F_Exp }, { new Puerts.MethodKey {Name = "Log", IsStatic = true}, F_Log }, { new Puerts.MethodKey {Name = "Log10", IsStatic = true}, F_Log10 }, { new Puerts.MethodKey {Name = "Ceil", IsStatic = true}, F_Ceil }, { new Puerts.MethodKey {Name = "Floor", IsStatic = true}, F_Floor }, { new Puerts.MethodKey {Name = "Round", IsStatic = true}, F_Round }, { new Puerts.MethodKey {Name = "CeilToInt", IsStatic = true}, F_CeilToInt }, { new Puerts.MethodKey {Name = "FloorToInt", IsStatic = true}, F_FloorToInt }, { new Puerts.MethodKey {Name = "RoundToInt", IsStatic = true}, F_RoundToInt }, { new Puerts.MethodKey {Name = "Sign", IsStatic = true}, F_Sign }, { new Puerts.MethodKey {Name = "Clamp", IsStatic = true}, F_Clamp }, { new Puerts.MethodKey {Name = "Clamp01", IsStatic = true}, F_Clamp01 }, { new Puerts.MethodKey {Name = "Lerp", IsStatic = true}, F_Lerp }, { new Puerts.MethodKey {Name = "LerpUnclamped", IsStatic = true}, F_LerpUnclamped }, { new Puerts.MethodKey {Name = "LerpAngle", IsStatic = true}, F_LerpAngle }, { new Puerts.MethodKey {Name = "MoveTowards", IsStatic = true}, F_MoveTowards }, { new Puerts.MethodKey {Name = "MoveTowardsAngle", IsStatic = true}, F_MoveTowardsAngle }, { new Puerts.MethodKey {Name = "SmoothStep", IsStatic = true}, F_SmoothStep }, { new Puerts.MethodKey {Name = "Gamma", IsStatic = true}, F_Gamma }, { new Puerts.MethodKey {Name = "Approximately", IsStatic = true}, F_Approximately }, { new Puerts.MethodKey {Name = "SmoothDamp", IsStatic = true}, F_SmoothDamp }, { new Puerts.MethodKey {Name = "SmoothDampAngle", IsStatic = true}, F_SmoothDampAngle }, { new Puerts.MethodKey {Name = "Repeat", IsStatic = true}, F_Repeat }, { new Puerts.MethodKey {Name = "PingPong", IsStatic = true}, F_PingPong }, { new Puerts.MethodKey {Name = "InverseLerp", IsStatic = true}, F_InverseLerp }, { new Puerts.MethodKey {Name = "DeltaAngle", IsStatic = true}, F_DeltaAngle }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"PI", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_PI, Setter = null} }, {"Infinity", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_Infinity, Setter = null} }, {"NegativeInfinity", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_NegativeInfinity, Setter = null} }, {"Deg2Rad", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_Deg2Rad, Setter = null} }, {"Rad2Deg", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_Rad2Deg, Setter = null} }, {"Epsilon", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_Epsilon, Setter = null} }, } }; } } } <|start_filename|>Projects/DataTemplates/template_lua2/test_tbteststring.lua<|end_filename|> -- test.TbTestString return { [1] = { id=1, s1="asfas", cs1= { id=1, s2="asf", s3="aaa", }, cs2= { id=1, s2="asf", s3="aaa", }, }, [2] = { id=2, s1="adsf\"", cs1= { id=2, s2="", s3="bbb", }, cs2= { id=2, s2="", s3="bbb", }, }, [3] = { id=3, s1="升级到10级\"\"", cs1= { id=3, s2="asdfas", s3="", }, cs2= { id=3, s2="asdfas", s3="", }, }, [4] = { id=4, s1="asdfa", cs1= { id=4, s2="", s3="", }, cs2= { id=4, s2="", s3="", }, }, } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_IntegratedSubsystem_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_IntegratedSubsystem_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.IntegratedSubsystem(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.IntegratedSubsystem), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Start(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.IntegratedSubsystem; { { obj.Start(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Stop(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.IntegratedSubsystem; { { obj.Stop(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Destroy(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.IntegratedSubsystem; { { obj.Destroy(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_running(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.IntegratedSubsystem; var result = obj.running; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "Start", IsStatic = false}, M_Start }, { new Puerts.MethodKey {Name = "Stop", IsStatic = false}, M_Stop }, { new Puerts.MethodKey {Name = "Destroy", IsStatic = false}, M_Destroy }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"running", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_running, Setter = null} }, } }; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_ReflectionProbe_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_ReflectionProbe_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.ReflectionProbe(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.ReflectionProbe), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Reset(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ReflectionProbe; { { obj.Reset(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_RenderProbe(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ReflectionProbe; if (paramLen == 0) { { var result = obj.RenderProbe(); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RenderTexture), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.RenderTexture>(false); var result = obj.RenderProbe(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to RenderProbe"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_IsFinishedRendering(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ReflectionProbe; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); var result = obj.IsFinishedRendering(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_BlendCubemap(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); { var Arg0 = argHelper0.Get<UnityEngine.Texture>(false); var Arg1 = argHelper1.Get<UnityEngine.Texture>(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.Get<UnityEngine.RenderTexture>(false); var result = UnityEngine.ReflectionProbe.BlendCubemap(Arg0,Arg1,Arg2,Arg3); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_size(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ReflectionProbe; var result = obj.size; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_size(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ReflectionProbe; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.size = argHelper.Get<UnityEngine.Vector3>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_center(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ReflectionProbe; var result = obj.center; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_center(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ReflectionProbe; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.center = argHelper.Get<UnityEngine.Vector3>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_nearClipPlane(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ReflectionProbe; var result = obj.nearClipPlane; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_nearClipPlane(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ReflectionProbe; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.nearClipPlane = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_farClipPlane(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ReflectionProbe; var result = obj.farClipPlane; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_farClipPlane(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ReflectionProbe; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.farClipPlane = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_intensity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ReflectionProbe; var result = obj.intensity; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_intensity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ReflectionProbe; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.intensity = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_bounds(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ReflectionProbe; var result = obj.bounds; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_hdr(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ReflectionProbe; var result = obj.hdr; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_hdr(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ReflectionProbe; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.hdr = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_renderDynamicObjects(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ReflectionProbe; var result = obj.renderDynamicObjects; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_renderDynamicObjects(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ReflectionProbe; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.renderDynamicObjects = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_shadowDistance(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ReflectionProbe; var result = obj.shadowDistance; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_shadowDistance(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ReflectionProbe; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.shadowDistance = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_resolution(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ReflectionProbe; var result = obj.resolution; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_resolution(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ReflectionProbe; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.resolution = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_cullingMask(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ReflectionProbe; var result = obj.cullingMask; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_cullingMask(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ReflectionProbe; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.cullingMask = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_clearFlags(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ReflectionProbe; var result = obj.clearFlags; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_clearFlags(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ReflectionProbe; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.clearFlags = (UnityEngine.Rendering.ReflectionProbeClearFlags)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_backgroundColor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ReflectionProbe; var result = obj.backgroundColor; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_backgroundColor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ReflectionProbe; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.backgroundColor = argHelper.Get<UnityEngine.Color>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_blendDistance(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ReflectionProbe; var result = obj.blendDistance; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_blendDistance(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ReflectionProbe; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.blendDistance = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_boxProjection(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ReflectionProbe; var result = obj.boxProjection; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_boxProjection(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ReflectionProbe; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.boxProjection = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_mode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ReflectionProbe; var result = obj.mode; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_mode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ReflectionProbe; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.mode = (UnityEngine.Rendering.ReflectionProbeMode)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_importance(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ReflectionProbe; var result = obj.importance; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_importance(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ReflectionProbe; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.importance = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_refreshMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ReflectionProbe; var result = obj.refreshMode; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_refreshMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ReflectionProbe; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.refreshMode = (UnityEngine.Rendering.ReflectionProbeRefreshMode)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_timeSlicingMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ReflectionProbe; var result = obj.timeSlicingMode; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_timeSlicingMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ReflectionProbe; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.timeSlicingMode = (UnityEngine.Rendering.ReflectionProbeTimeSlicingMode)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_bakedTexture(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ReflectionProbe; var result = obj.bakedTexture; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_bakedTexture(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ReflectionProbe; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.bakedTexture = argHelper.Get<UnityEngine.Texture>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_customBakedTexture(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ReflectionProbe; var result = obj.customBakedTexture; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_customBakedTexture(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ReflectionProbe; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.customBakedTexture = argHelper.Get<UnityEngine.Texture>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_realtimeTexture(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ReflectionProbe; var result = obj.realtimeTexture; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_realtimeTexture(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ReflectionProbe; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.realtimeTexture = argHelper.Get<UnityEngine.RenderTexture>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_texture(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ReflectionProbe; var result = obj.texture; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_textureHDRDecodeValues(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ReflectionProbe; var result = obj.textureHDRDecodeValues; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_minBakedCubemapResolution(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.ReflectionProbe.minBakedCubemapResolution; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_maxBakedCubemapResolution(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.ReflectionProbe.maxBakedCubemapResolution; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_defaultTextureHDRDecodeValues(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.ReflectionProbe.defaultTextureHDRDecodeValues; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_defaultTexture(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.ReflectionProbe.defaultTexture; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void A_reflectionProbeChanged(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.ReflectionProbe.reflectionProbeChanged += argHelper.Get<System.Action<UnityEngine.ReflectionProbe, UnityEngine.ReflectionProbe.ReflectionProbeEvent>>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void R_reflectionProbeChanged(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.ReflectionProbe.reflectionProbeChanged -= argHelper.Get<System.Action<UnityEngine.ReflectionProbe, UnityEngine.ReflectionProbe.ReflectionProbeEvent>>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void A_defaultReflectionSet(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.ReflectionProbe.defaultReflectionSet += argHelper.Get<System.Action<UnityEngine.Cubemap>>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void R_defaultReflectionSet(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.ReflectionProbe.defaultReflectionSet -= argHelper.Get<System.Action<UnityEngine.Cubemap>>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "Reset", IsStatic = false}, M_Reset }, { new Puerts.MethodKey {Name = "RenderProbe", IsStatic = false}, M_RenderProbe }, { new Puerts.MethodKey {Name = "IsFinishedRendering", IsStatic = false}, M_IsFinishedRendering }, { new Puerts.MethodKey {Name = "BlendCubemap", IsStatic = true}, F_BlendCubemap }, { new Puerts.MethodKey {Name = "add_reflectionProbeChanged", IsStatic = true}, A_reflectionProbeChanged}, { new Puerts.MethodKey {Name = "remove_reflectionProbeChanged", IsStatic = true}, R_reflectionProbeChanged}, { new Puerts.MethodKey {Name = "add_defaultReflectionSet", IsStatic = true}, A_defaultReflectionSet}, { new Puerts.MethodKey {Name = "remove_defaultReflectionSet", IsStatic = true}, R_defaultReflectionSet}, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"size", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_size, Setter = S_size} }, {"center", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_center, Setter = S_center} }, {"nearClipPlane", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_nearClipPlane, Setter = S_nearClipPlane} }, {"farClipPlane", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_farClipPlane, Setter = S_farClipPlane} }, {"intensity", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_intensity, Setter = S_intensity} }, {"bounds", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_bounds, Setter = null} }, {"hdr", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_hdr, Setter = S_hdr} }, {"renderDynamicObjects", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_renderDynamicObjects, Setter = S_renderDynamicObjects} }, {"shadowDistance", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_shadowDistance, Setter = S_shadowDistance} }, {"resolution", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_resolution, Setter = S_resolution} }, {"cullingMask", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_cullingMask, Setter = S_cullingMask} }, {"clearFlags", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_clearFlags, Setter = S_clearFlags} }, {"backgroundColor", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_backgroundColor, Setter = S_backgroundColor} }, {"blendDistance", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_blendDistance, Setter = S_blendDistance} }, {"boxProjection", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_boxProjection, Setter = S_boxProjection} }, {"mode", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_mode, Setter = S_mode} }, {"importance", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_importance, Setter = S_importance} }, {"refreshMode", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_refreshMode, Setter = S_refreshMode} }, {"timeSlicingMode", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_timeSlicingMode, Setter = S_timeSlicingMode} }, {"bakedTexture", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_bakedTexture, Setter = S_bakedTexture} }, {"customBakedTexture", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_customBakedTexture, Setter = S_customBakedTexture} }, {"realtimeTexture", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_realtimeTexture, Setter = S_realtimeTexture} }, {"texture", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_texture, Setter = null} }, {"textureHDRDecodeValues", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_textureHDRDecodeValues, Setter = null} }, {"minBakedCubemapResolution", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_minBakedCubemapResolution, Setter = null} }, {"maxBakedCubemapResolution", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_maxBakedCubemapResolution, Setter = null} }, {"defaultTextureHDRDecodeValues", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_defaultTextureHDRDecodeValues, Setter = null} }, {"defaultTexture", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_defaultTexture, Setter = null} }, } }; } } } <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/cost/Cost.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.cost { public abstract partial class Cost : Bright.Config.BeanBase { public Cost(ByteBuf _buf) { } public Cost() { } public static Cost DeserializeCost(ByteBuf _buf) { switch (_buf.ReadInt()) { case cost.CostCurrency.ID: return new cost.CostCurrency(_buf); case cost.CostCurrencies.ID: return new cost.CostCurrencies(_buf); case cost.CostOneItem.ID: return new cost.CostOneItem(_buf); case cost.CostItem.ID: return new cost.CostItem(_buf); case cost.CostItems.ID: return new cost.CostItems(_buf); default: throw new SerializationException(); } } public virtual void Resolve(Dictionary<string, object> _tables) { OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); public override string ToString() { return "{ " + "}"; } } } <|start_filename|>Projects/DataTemplates/template_lua2/test_tbnotindexlist.lua<|end_filename|> -- test.TbNotIndexList return { x=1, y=2, }, <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/item/EClothesHidePartType.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ namespace cfg.item { public enum EClothesHidePartType { /// <summary> /// 胸部 /// </summary> CHEST = 0, /// <summary> /// 手 /// </summary> HEAD = 1, /// <summary> /// 脊柱上 /// </summary> SPINE_UPPER = 2, /// <summary> /// 脊柱下 /// </summary> SPINE_LOWER = 3, /// <summary> /// 臀部 /// </summary> HIP = 4, /// <summary> /// 腿上 /// </summary> LEG_UPPER = 5, /// <summary> /// 腿中 /// </summary> LEG_MIDDLE = 6, /// <summary> /// 腿下 /// </summary> LEG_LOWER = 7, } } <|start_filename|>Projects/GenerateDatas/convert_lua/test.TbDetectCsvEncoding/1.lua<|end_filename|> return { id = 1, name = "测试编码", } <|start_filename|>Projects/Java_bin/src/main/gen/cfg/test/TestIndex.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.test; import bright.serialization.*; public final class TestIndex { public TestIndex(ByteBuf _buf) { id = _buf.readInt(); {int n = Math.min(_buf.readSize(), _buf.size());eles = new java.util.ArrayList<cfg.test.DemoType1>(n);for(int i = 0 ; i < n ; i++) { cfg.test.DemoType1 _e; _e = new cfg.test.DemoType1(_buf); eles.add(_e);}} } public TestIndex(int id, java.util.ArrayList<cfg.test.DemoType1> eles ) { this.id = id; this.eles = eles; } public final int id; public final java.util.ArrayList<cfg.test.DemoType1> eles; public void resolve(java.util.HashMap<String, Object> _tables) { for(cfg.test.DemoType1 _e : eles) { if (_e != null) _e.resolve(_tables); } } @Override public String toString() { return "{ " + "id:" + id + "," + "eles:" + eles + "," + "}"; } } <|start_filename|>Projects/GenerateDatas/convert_lua/role.TbRoleLevelExpAttr/30.lua<|end_filename|> return { level = 30, need_exp = 12000, clothes_attrs = { 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, }, } <|start_filename|>Projects/GenerateDatas/json_exclude_tags/test_tbdefinefromexcelone.json<|end_filename|> [ { "unlock_equip": 10, "unlock_hero": 20, "default_avatar": "Assets/Icon/DefaultAvatar.png", "default_item": "Assets/Icon/DefaultAvatar.png" } ] <|start_filename|>Projects/GenerateDatas/convert_lua/test.TbTestString/3.lua<|end_filename|> return { id = 3, s1 = "升级到10级\"\"", cs1 = { id = 3, s2 = "asdfas", s3 = "", }, cs2 = { id = 3, s2 = "asdfas", s3 = "", }, } <|start_filename|>Projects/GenerateDatas/convert_lua/role.TbRoleLevelExpAttr/34.lua<|end_filename|> return { level = 34, need_exp = 17000, clothes_attrs = { 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, }, } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_ArticulationJacobian_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_ArticulationJacobian_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var result = new UnityEngine.ArticulationJacobian(Arg0,Arg1); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.ArticulationJacobian), result); } } if (paramLen == 0) { { var result = new UnityEngine.ArticulationJacobian(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.ArticulationJacobian), result); } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.ArticulationJacobian constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_rows(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ArticulationJacobian)Puerts.Utils.GetSelf((int)data, self); var result = obj.rows; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_rows(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ArticulationJacobian)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.rows = argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_columns(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ArticulationJacobian)Puerts.Utils.GetSelf((int)data, self); var result = obj.columns; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_columns(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ArticulationJacobian)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.columns = argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_elements(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ArticulationJacobian)Puerts.Utils.GetSelf((int)data, self); var result = obj.elements; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_elements(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ArticulationJacobian)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.elements = argHelper.Get<System.Collections.Generic.List<float>>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"rows", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_rows, Setter = S_rows} }, {"columns", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_columns, Setter = S_columns} }, {"elements", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_elements, Setter = S_elements} }, } }; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_ParticleSystem_TextureSheetAnimationModule_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_ParticleSystem_TextureSheetAnimationModule_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.ParticleSystem.TextureSheetAnimationModule constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_AddSprite(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.TextureSheetAnimationModule)Puerts.Utils.GetSelf((int)data, self); { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Sprite>(false); obj.AddSprite(Arg0); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_RemoveSprite(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.TextureSheetAnimationModule)Puerts.Utils.GetSelf((int)data, self); { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); obj.RemoveSprite(Arg0); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetSprite(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.TextureSheetAnimationModule)Puerts.Utils.GetSelf((int)data, self); { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.Sprite>(false); obj.SetSprite(Arg0,Arg1); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetSprite(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.TextureSheetAnimationModule)Puerts.Utils.GetSelf((int)data, self); { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); var result = obj.GetSprite(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_enabled(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.TextureSheetAnimationModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.enabled; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_enabled(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.TextureSheetAnimationModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.enabled = argHelper.GetBoolean(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_mode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.TextureSheetAnimationModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.mode; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_mode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.TextureSheetAnimationModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.mode = (UnityEngine.ParticleSystemAnimationMode)argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_timeMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.TextureSheetAnimationModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.timeMode; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_timeMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.TextureSheetAnimationModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.timeMode = (UnityEngine.ParticleSystemAnimationTimeMode)argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_fps(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.TextureSheetAnimationModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.fps; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_fps(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.TextureSheetAnimationModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.fps = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_numTilesX(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.TextureSheetAnimationModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.numTilesX; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_numTilesX(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.TextureSheetAnimationModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.numTilesX = argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_numTilesY(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.TextureSheetAnimationModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.numTilesY; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_numTilesY(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.TextureSheetAnimationModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.numTilesY = argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_animation(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.TextureSheetAnimationModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.animation; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_animation(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.TextureSheetAnimationModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.animation = (UnityEngine.ParticleSystemAnimationType)argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_rowMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.TextureSheetAnimationModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.rowMode; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_rowMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.TextureSheetAnimationModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.rowMode = (UnityEngine.ParticleSystemAnimationRowMode)argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_frameOverTime(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.TextureSheetAnimationModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.frameOverTime; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_frameOverTime(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.TextureSheetAnimationModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.frameOverTime = argHelper.Get<UnityEngine.ParticleSystem.MinMaxCurve>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_frameOverTimeMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.TextureSheetAnimationModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.frameOverTimeMultiplier; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_frameOverTimeMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.TextureSheetAnimationModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.frameOverTimeMultiplier = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_startFrame(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.TextureSheetAnimationModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.startFrame; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_startFrame(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.TextureSheetAnimationModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.startFrame = argHelper.Get<UnityEngine.ParticleSystem.MinMaxCurve>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_startFrameMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.TextureSheetAnimationModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.startFrameMultiplier; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_startFrameMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.TextureSheetAnimationModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.startFrameMultiplier = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_cycleCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.TextureSheetAnimationModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.cycleCount; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_cycleCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.TextureSheetAnimationModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.cycleCount = argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_rowIndex(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.TextureSheetAnimationModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.rowIndex; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_rowIndex(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.TextureSheetAnimationModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.rowIndex = argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_uvChannelMask(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.TextureSheetAnimationModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.uvChannelMask; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_uvChannelMask(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.TextureSheetAnimationModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.uvChannelMask = (UnityEngine.Rendering.UVChannelFlags)argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_spriteCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.TextureSheetAnimationModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.spriteCount; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_speedRange(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.TextureSheetAnimationModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.speedRange; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_speedRange(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.TextureSheetAnimationModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.speedRange = argHelper.Get<UnityEngine.Vector2>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "AddSprite", IsStatic = false}, M_AddSprite }, { new Puerts.MethodKey {Name = "RemoveSprite", IsStatic = false}, M_RemoveSprite }, { new Puerts.MethodKey {Name = "SetSprite", IsStatic = false}, M_SetSprite }, { new Puerts.MethodKey {Name = "GetSprite", IsStatic = false}, M_GetSprite }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"enabled", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_enabled, Setter = S_enabled} }, {"mode", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_mode, Setter = S_mode} }, {"timeMode", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_timeMode, Setter = S_timeMode} }, {"fps", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_fps, Setter = S_fps} }, {"numTilesX", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_numTilesX, Setter = S_numTilesX} }, {"numTilesY", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_numTilesY, Setter = S_numTilesY} }, {"animation", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_animation, Setter = S_animation} }, {"rowMode", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_rowMode, Setter = S_rowMode} }, {"frameOverTime", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_frameOverTime, Setter = S_frameOverTime} }, {"frameOverTimeMultiplier", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_frameOverTimeMultiplier, Setter = S_frameOverTimeMultiplier} }, {"startFrame", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_startFrame, Setter = S_startFrame} }, {"startFrameMultiplier", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_startFrameMultiplier, Setter = S_startFrameMultiplier} }, {"cycleCount", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_cycleCount, Setter = S_cycleCount} }, {"rowIndex", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_rowIndex, Setter = S_rowIndex} }, {"uvChannelMask", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_uvChannelMask, Setter = S_uvChannelMask} }, {"spriteCount", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_spriteCount, Setter = null} }, {"speedRange", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_speedRange, Setter = S_speedRange} }, } }; } } } <|start_filename|>ProtoProjects/Csharp_Unity/Assets/Gen/test/TestProto1.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; namespace proto.test { public sealed class TestProto1 : Bright.Net.Codecs.Protocol { public int X; public string Y; public TestProto1() { } public TestProto1(Bright.Common.NotNullInitialization _) { Y = ""; } public const int __ID__ = 23983; public override int GetTypeId() { return __ID__; } public override void Serialize(ByteBuf _buf) { _buf.WriteInt(X); _buf.WriteString(Y); } public override void Deserialize(ByteBuf _buf) { X = _buf.ReadInt(); Y = _buf.ReadString(); } public override void Reset() { throw new System.NotImplementedException(); } public override object Clone() { throw new System.NotImplementedException(); } public override string ToString() { return "test.TestProto1{ " + "X:" + X + "," + "Y:" + Y + "," + "}"; } } } <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/ai/Blackboard.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.ai { public sealed partial class Blackboard : Bright.Config.BeanBase { public Blackboard(ByteBuf _buf) { Name = _buf.ReadString(); Desc = _buf.ReadString(); ParentName = _buf.ReadString(); {int n = System.Math.Min(_buf.ReadSize(), _buf.Size);Keys = new System.Collections.Generic.List<ai.BlackboardKey>(n);for(var i = 0 ; i < n ; i++) { ai.BlackboardKey _e; _e = ai.BlackboardKey.DeserializeBlackboardKey(_buf); Keys.Add(_e);}} } public Blackboard(string name, string desc, string parent_name, System.Collections.Generic.List<ai.BlackboardKey> keys ) { this.Name = name; this.Desc = desc; this.ParentName = parent_name; this.Keys = keys; } public static Blackboard DeserializeBlackboard(ByteBuf _buf) { return new ai.Blackboard(_buf); } public readonly string Name; public readonly string Desc; public readonly string ParentName; public ai.Blackboard ParentName_Ref; public readonly System.Collections.Generic.List<ai.BlackboardKey> Keys; public const int ID = 1576193005; public override int GetTypeId() => ID; public void Resolve(Dictionary<string, object> _tables) { this.ParentName_Ref = (_tables["ai.TbBlackboard"] as ai.TbBlackboard).GetOrDefault(ParentName); foreach(var _e in Keys) { _e?.Resolve(_tables); } OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); public override string ToString() { return "{ " + "Name:" + Name + "," + "Desc:" + Desc + "," + "ParentName:" + ParentName + "," + "Keys:" + Bright.Common.StringUtil.CollectionToString(Keys) + "," + "}"; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_BuildCompression_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_BuildCompression_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.BuildCompression constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_compression(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.BuildCompression)Puerts.Utils.GetSelf((int)data, self); var result = obj.compression; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_level(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.BuildCompression)Puerts.Utils.GetSelf((int)data, self); var result = obj.level; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_blockSize(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.BuildCompression)Puerts.Utils.GetSelf((int)data, self); var result = obj.blockSize; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_Uncompressed(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.BuildCompression.Uncompressed; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_LZ4(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.BuildCompression.LZ4; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_LZMA(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.BuildCompression.LZMA; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_UncompressedRuntime(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.BuildCompression.UncompressedRuntime; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_LZ4Runtime(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.BuildCompression.LZ4Runtime; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"compression", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_compression, Setter = null} }, {"level", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_level, Setter = null} }, {"blockSize", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_blockSize, Setter = null} }, {"Uncompressed", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_Uncompressed, Setter = null} }, {"LZ4", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_LZ4, Setter = null} }, {"LZMA", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_LZMA, Setter = null} }, {"UncompressedRuntime", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_UncompressedRuntime, Setter = null} }, {"LZ4Runtime", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_LZ4Runtime, Setter = null} }, } }; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_TrackedReference_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_TrackedReference_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.TrackedReference constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Equals(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TrackedReference; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.Object>(false); var result = obj.Equals(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetHashCode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.TrackedReference; { { var result = obj.GetHashCode(); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void O_op_Equality(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var arg0 = argHelper0.Get<UnityEngine.TrackedReference>(false); var arg1 = argHelper1.Get<UnityEngine.TrackedReference>(false); var result = arg0 == arg1; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void O_op_Inequality(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var arg0 = argHelper0.Get<UnityEngine.TrackedReference>(false); var arg1 = argHelper1.Get<UnityEngine.TrackedReference>(false); var result = arg0 != arg1; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "Equals", IsStatic = false}, M_Equals }, { new Puerts.MethodKey {Name = "GetHashCode", IsStatic = false}, M_GetHashCode }, { new Puerts.MethodKey {Name = "op_Equality", IsStatic = true}, O_op_Equality}, { new Puerts.MethodKey {Name = "op_Inequality", IsStatic = true}, O_op_Inequality}, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { } }; } } } <|start_filename|>Projects/GenerateDatas/convert_lua/item.TbItemFunc/401.lua<|end_filename|> return { minor_type = 401, func_type = 0, method = "使用", close_bag_ui = true, } <|start_filename|>ProtoProjects/go/gen/src/proto/test.TestRpc2.go<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package proto import ( "bright/serialization" "errors" ) type TestTestRpc2 struct { SeqId int64 Arg *TestTestRpcArg Res *TestTestRpcRes } const TypeId_TestTestRpc2 = 2355 func (*TestTestRpc2) GetTypeId() int32 { return 2355 } func (_v *TestTestRpc2)Serialize(_buf *serialization.ByteBuf) { _buf.WriteLong(_v.SeqId) if _v.SeqId & 0x1 == 0 { SerializeTestTestRpcArg(_v.Arg, _buf) } else { SerializeTestTestRpcRes(_v.Res, _buf) } } func (_v *TestTestRpc2)Deserialize(_buf *serialization.ByteBuf) (err error) { if _v.SeqId, err = _buf.ReadLong() ; err != nil { return } if _v.SeqId & 0x1 == 0 { { if _v.Arg, err = DeserializeTestTestRpcArg(_buf); err != nil { err = errors.New("_v.Arg error"); return } } } else { { if _v.Res, err = DeserializeTestTestRpcRes(_buf); err != nil { err = errors.New("_v.Res error"); return } } } return } <|start_filename|>Projects/GenerateDatas/convert_lua/error.TbCodeInfo/7.lua<|end_filename|> return { code = 7, key = "EXAMPLE_MSGBOX", } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_UI_MaskUtilities_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_UI_MaskUtilities_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.UI.MaskUtilities(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.UI.MaskUtilities), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_Notify2DMaskStateChanged(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Component>(false); UnityEngine.UI.MaskUtilities.Notify2DMaskStateChanged(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_NotifyStencilStateChanged(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Component>(false); UnityEngine.UI.MaskUtilities.NotifyStencilStateChanged(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_FindRootSortOverrideCanvas(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Transform>(false); var result = UnityEngine.UI.MaskUtilities.FindRootSortOverrideCanvas(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetStencilDepth(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<UnityEngine.Transform>(false); var Arg1 = argHelper1.Get<UnityEngine.Transform>(false); var result = UnityEngine.UI.MaskUtilities.GetStencilDepth(Arg0,Arg1); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_IsDescendantOrSelf(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<UnityEngine.Transform>(false); var Arg1 = argHelper1.Get<UnityEngine.Transform>(false); var result = UnityEngine.UI.MaskUtilities.IsDescendantOrSelf(Arg0,Arg1); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetRectMaskForClippable(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.UI.IClippable>(false); var result = UnityEngine.UI.MaskUtilities.GetRectMaskForClippable(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetRectMasksForClip(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<UnityEngine.UI.RectMask2D>(false); var Arg1 = argHelper1.Get<System.Collections.Generic.List<UnityEngine.UI.RectMask2D>>(false); UnityEngine.UI.MaskUtilities.GetRectMasksForClip(Arg0,Arg1); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "Notify2DMaskStateChanged", IsStatic = true}, F_Notify2DMaskStateChanged }, { new Puerts.MethodKey {Name = "NotifyStencilStateChanged", IsStatic = true}, F_NotifyStencilStateChanged }, { new Puerts.MethodKey {Name = "FindRootSortOverrideCanvas", IsStatic = true}, F_FindRootSortOverrideCanvas }, { new Puerts.MethodKey {Name = "GetStencilDepth", IsStatic = true}, F_GetStencilDepth }, { new Puerts.MethodKey {Name = "IsDescendantOrSelf", IsStatic = true}, F_IsDescendantOrSelf }, { new Puerts.MethodKey {Name = "GetRectMaskForClippable", IsStatic = true}, F_GetRectMaskForClippable }, { new Puerts.MethodKey {Name = "GetRectMasksForClip", IsStatic = true}, F_GetRectMasksForClip }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { } }; } } } <|start_filename|>Projects/DataTemplates/template_erlang/role_tbrolelevelexpattr.erl<|end_filename|> %% role.TbRoleLevelExpAttr get(1) -> #{level => 1,need_exp => 0,clothes_attrs => [0,0,0,0,0,0,0,0,0,0]}. get(2) -> #{level => 2,need_exp => 100,clothes_attrs => [1,1,1,1,1,0,0,0,0,0]}. get(3) -> #{level => 3,need_exp => 200,clothes_attrs => [0,0,0,0,0,1,1,1,1,1]}. get(4) -> #{level => 4,need_exp => 300,clothes_attrs => [1,1,1,1,1,0,0,0,0,0]}. get(5) -> #{level => 5,need_exp => 400,clothes_attrs => [0,0,0,0,0,1,1,1,1,1]}. get(6) -> #{level => 6,need_exp => 500,clothes_attrs => [1,1,1,1,1,0,0,0,0,0]}. get(7) -> #{level => 7,need_exp => 700,clothes_attrs => [0,0,0,0,0,1,1,1,1,1]}. get(8) -> #{level => 8,need_exp => 900,clothes_attrs => [1,1,1,1,1,0,0,0,0,0]}. get(9) -> #{level => 9,need_exp => 1100,clothes_attrs => [0,0,0,0,0,1,1,1,1,1]}. get(10) -> #{level => 10,need_exp => 1300,clothes_attrs => [1,1,1,1,1,0,0,0,0,0]}. get(11) -> #{level => 11,need_exp => 1500,clothes_attrs => [0,0,0,0,0,1,1,1,1,1]}. get(12) -> #{level => 12,need_exp => 2000,clothes_attrs => [1,1,1,1,1,0,0,0,0,0]}. get(13) -> #{level => 13,need_exp => 2500,clothes_attrs => [0,0,0,0,0,1,1,1,1,1]}. get(14) -> #{level => 14,need_exp => 3000,clothes_attrs => [1,1,1,1,1,0,0,0,0,0]}. get(15) -> #{level => 15,need_exp => 3500,clothes_attrs => [0,0,0,0,0,1,1,1,1,1]}. get(16) -> #{level => 16,need_exp => 4000,clothes_attrs => [1,1,1,1,1,0,0,0,0,0]}. get(17) -> #{level => 17,need_exp => 4500,clothes_attrs => [0,0,0,0,0,1,1,1,1,1]}. get(18) -> #{level => 18,need_exp => 5000,clothes_attrs => [1,1,1,1,1,0,0,0,0,0]}. get(19) -> #{level => 19,need_exp => 5500,clothes_attrs => [0,0,0,0,0,1,1,1,1,1]}. get(20) -> #{level => 20,need_exp => 6000,clothes_attrs => [1,1,1,1,1,0,0,0,0,0]}. get(21) -> #{level => 21,need_exp => 6500,clothes_attrs => [0,0,0,0,0,1,1,1,1,1]}. get(22) -> #{level => 22,need_exp => 7000,clothes_attrs => [1,1,1,1,1,0,0,0,0,0]}. get(23) -> #{level => 23,need_exp => 7500,clothes_attrs => [0,0,0,0,0,1,1,1,1,1]}. get(24) -> #{level => 24,need_exp => 8000,clothes_attrs => [1,1,1,1,1,0,0,0,0,0]}. get(25) -> #{level => 25,need_exp => 8500,clothes_attrs => [0,0,0,0,0,1,1,1,1,1]}. get(26) -> #{level => 26,need_exp => 9000,clothes_attrs => [1,1,1,1,1,0,0,0,0,0]}. get(27) -> #{level => 27,need_exp => 9500,clothes_attrs => [0,0,0,0,0,1,1,1,1,1]}. get(28) -> #{level => 28,need_exp => 10000,clothes_attrs => [1,1,1,1,1,0,0,0,0,0]}. get(29) -> #{level => 29,need_exp => 11000,clothes_attrs => [0,0,0,0,0,1,1,1,1,1]}. get(30) -> #{level => 30,need_exp => 12000,clothes_attrs => [1,1,1,1,1,0,0,0,0,0]}. get(31) -> #{level => 31,need_exp => 13000,clothes_attrs => [0,0,0,0,0,1,1,1,1,1]}. get(32) -> #{level => 32,need_exp => 14000,clothes_attrs => [1,1,1,1,1,0,0,0,0,0]}. get(33) -> #{level => 33,need_exp => 15000,clothes_attrs => [0,0,0,0,0,1,1,1,1,1]}. get(34) -> #{level => 34,need_exp => 17000,clothes_attrs => [1,1,1,1,1,0,0,0,0,0]}. get(35) -> #{level => 35,need_exp => 19000,clothes_attrs => [0,0,0,0,0,1,1,1,1,1]}. get(36) -> #{level => 36,need_exp => 21000,clothes_attrs => [1,1,1,1,1,0,0,0,0,0]}. get(37) -> #{level => 37,need_exp => 23000,clothes_attrs => [0,0,0,0,0,1,1,1,1,1]}. get(38) -> #{level => 38,need_exp => 25000,clothes_attrs => [1,1,1,1,1,0,0,0,0,0]}. get(39) -> #{level => 39,need_exp => 28000,clothes_attrs => [0,0,0,0,0,1,1,1,1,1]}. get(40) -> #{level => 40,need_exp => 31000,clothes_attrs => [1,1,1,1,1,0,0,0,0,0]}. get(41) -> #{level => 41,need_exp => 34000,clothes_attrs => [0,0,0,0,0,1,1,1,1,1]}. get(42) -> #{level => 42,need_exp => 37000,clothes_attrs => [1,1,1,1,1,0,0,0,0,0]}. get(43) -> #{level => 43,need_exp => 40000,clothes_attrs => [0,0,0,0,0,1,1,1,1,1]}. get(44) -> #{level => 44,need_exp => 45000,clothes_attrs => [1,1,1,1,1,0,0,0,0,0]}. get(45) -> #{level => 45,need_exp => 50000,clothes_attrs => [0,0,0,0,0,1,1,1,1,1]}. get(46) -> #{level => 46,need_exp => 55000,clothes_attrs => [1,1,1,1,1,0,0,0,0,0]}. get(47) -> #{level => 47,need_exp => 60000,clothes_attrs => [0,0,0,0,0,1,1,1,1,1]}. get(48) -> #{level => 48,need_exp => 65000,clothes_attrs => [1,1,1,1,1,0,0,0,0,0]}. get(49) -> #{level => 49,need_exp => 70000,clothes_attrs => [0,0,0,0,0,1,1,1,1,1]}. get(50) -> #{level => 50,need_exp => 75000,clothes_attrs => [1,1,1,1,1,0,0,0,0,0]}. get(51) -> #{level => 51,need_exp => 80000,clothes_attrs => [0,0,0,0,0,1,1,1,1,1]}. get(52) -> #{level => 52,need_exp => 85000,clothes_attrs => [1,1,1,1,1,0,0,0,0,0]}. get(53) -> #{level => 53,need_exp => 90000,clothes_attrs => [0,0,0,0,0,1,1,1,1,1]}. get(54) -> #{level => 54,need_exp => 95000,clothes_attrs => [1,1,1,1,1,0,0,0,0,0]}. get(55) -> #{level => 55,need_exp => 100000,clothes_attrs => [0,0,0,0,0,1,1,1,1,1]}. get(56) -> #{level => 56,need_exp => 105000,clothes_attrs => [1,1,1,1,1,0,0,0,0,0]}. get(57) -> #{level => 57,need_exp => 110000,clothes_attrs => [0,0,0,0,0,1,1,1,1,1]}. get(58) -> #{level => 58,need_exp => 115000,clothes_attrs => [0,0,0,0,0,1,1,1,1,1]}. get(59) -> #{level => 59,need_exp => 120000,clothes_attrs => [1,1,1,1,1,0,0,0,0,0]}. get(60) -> #{level => 60,need_exp => 125000,clothes_attrs => [0,0,0,0,0,1,1,1,1,1]}. get(61) -> #{level => 61,need_exp => 130000,clothes_attrs => [1,1,1,1,1,0,0,0,0,0]}. get(62) -> #{level => 62,need_exp => 135000,clothes_attrs => [0,0,0,0,0,1,1,1,1,1]}. get(63) -> #{level => 63,need_exp => 140000,clothes_attrs => [1,1,1,1,1,0,0,0,0,0]}. get(64) -> #{level => 64,need_exp => 145000,clothes_attrs => [0,0,0,0,0,1,1,1,1,1]}. get(65) -> #{level => 65,need_exp => 150000,clothes_attrs => [1,1,1,1,1,0,0,0,0,0]}. get(66) -> #{level => 66,need_exp => 155000,clothes_attrs => [0,0,0,0,0,1,1,1,1,1]}. get(67) -> #{level => 67,need_exp => 160000,clothes_attrs => [1,1,1,1,1,0,0,0,0,0]}. get(68) -> #{level => 68,need_exp => 165000,clothes_attrs => [0,0,0,0,0,1,1,1,1,1]}. get(69) -> #{level => 69,need_exp => 170000,clothes_attrs => [1,1,1,1,1,0,0,0,0,0]}. get(70) -> #{level => 70,need_exp => 175000,clothes_attrs => [0,0,0,0,0,1,1,1,1,1]}. get(71) -> #{level => 71,need_exp => 180000,clothes_attrs => [0,0,0,0,0,1,1,1,1,1]}. get(72) -> #{level => 72,need_exp => 185000,clothes_attrs => [1,1,1,1,1,0,0,0,0,0]}. get(73) -> #{level => 73,need_exp => 190000,clothes_attrs => [0,0,0,0,0,1,1,1,1,1]}. get(74) -> #{level => 74,need_exp => 195000,clothes_attrs => [1,1,1,1,1,0,0,0,0,0]}. get(75) -> #{level => 75,need_exp => 200000,clothes_attrs => [0,0,0,0,0,1,1,1,1,1]}. get(76) -> #{level => 76,need_exp => 205000,clothes_attrs => [1,1,1,1,1,0,0,0,0,0]}. get(77) -> #{level => 77,need_exp => 210000,clothes_attrs => [0,0,0,0,0,1,1,1,1,1]}. get(78) -> #{level => 78,need_exp => 215000,clothes_attrs => [1,1,1,1,1,0,0,0,0,0]}. get(79) -> #{level => 79,need_exp => 220000,clothes_attrs => [0,0,0,0,0,1,1,1,1,1]}. get(80) -> #{level => 80,need_exp => 225000,clothes_attrs => [1,1,1,1,1,0,0,0,0,0]}. get(81) -> #{level => 81,need_exp => 230000,clothes_attrs => [0,0,0,0,0,1,1,1,1,1]}. get(82) -> #{level => 82,need_exp => 235000,clothes_attrs => [1,1,1,1,1,0,0,0,0,0]}. get(83) -> #{level => 83,need_exp => 240000,clothes_attrs => [0,0,0,0,0,1,1,1,1,1]}. get(84) -> #{level => 84,need_exp => 245000,clothes_attrs => [0,0,0,0,0,1,1,1,1,1]}. get(85) -> #{level => 85,need_exp => 250000,clothes_attrs => [1,1,1,1,1,0,0,0,0,0]}. get(86) -> #{level => 86,need_exp => 255000,clothes_attrs => [0,0,0,0,0,1,1,1,1,1]}. get(87) -> #{level => 87,need_exp => 260000,clothes_attrs => [1,1,1,1,1,0,0,0,0,0]}. get(88) -> #{level => 88,need_exp => 265000,clothes_attrs => [0,0,0,0,0,1,1,1,1,1]}. get(89) -> #{level => 89,need_exp => 270000,clothes_attrs => [1,1,1,1,1,0,0,0,0,0]}. get(90) -> #{level => 90,need_exp => 275000,clothes_attrs => [0,0,0,0,0,1,1,1,1,1]}. get(91) -> #{level => 91,need_exp => 280000,clothes_attrs => [1,1,1,1,1,0,0,0,0,0]}. get(92) -> #{level => 92,need_exp => 285000,clothes_attrs => [0,0,0,0,0,1,1,1,1,1]}. get(93) -> #{level => 93,need_exp => 290000,clothes_attrs => [1,1,1,1,1,0,0,0,0,0]}. get(94) -> #{level => 94,need_exp => 295000,clothes_attrs => [0,0,0,0,0,1,1,1,1,1]}. get(95) -> #{level => 95,need_exp => 300000,clothes_attrs => [1,1,1,1,1,0,0,0,0,0]}. get(96) -> #{level => 96,need_exp => 305000,clothes_attrs => [0,0,0,0,0,1,1,1,1,1]}. get(97) -> #{level => 97,need_exp => 310000,clothes_attrs => [1,1,1,1,1,0,0,0,0,0]}. get(98) -> #{level => 98,need_exp => 315000,clothes_attrs => [0,0,0,0,0,1,1,1,1,1]}. get(99) -> #{level => 99,need_exp => 320000,clothes_attrs => [1,1,1,1,1,0,0,0,0,0]}. get(100) -> #{level => 100,need_exp => 325000,clothes_attrs => [0,0,0,0,0,1,1,1,1,1]}. <|start_filename|>Projects/Csharp_DotNet5_json_ExportServer/Gen/ai/FlowNode.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; using System.Text.Json; namespace cfg.ai { public abstract class FlowNode : ai.Node { public FlowNode(JsonElement _json) : base(_json) { { var _json0 = _json.GetProperty("decorators"); Decorators = new System.Collections.Generic.List<ai.Decorator>(_json0.GetArrayLength()); foreach(JsonElement __e in _json0.EnumerateArray()) { ai.Decorator __v; __v = ai.Decorator.DeserializeDecorator(__e); Decorators.Add(__v); } } { var _json0 = _json.GetProperty("services"); Services = new System.Collections.Generic.List<ai.Service>(_json0.GetArrayLength()); foreach(JsonElement __e in _json0.EnumerateArray()) { ai.Service __v; __v = ai.Service.DeserializeService(__e); Services.Add(__v); } } } public FlowNode(int id, string node_name, System.Collections.Generic.List<ai.Decorator> decorators, System.Collections.Generic.List<ai.Service> services ) : base(id,node_name) { this.Decorators = decorators; this.Services = services; } public static FlowNode DeserializeFlowNode(JsonElement _json) { switch (_json.GetProperty("__type__").GetString()) { case "Sequence": return new ai.Sequence(_json); case "Selector": return new ai.Selector(_json); case "SimpleParallel": return new ai.SimpleParallel(_json); case "UeWait": return new ai.UeWait(_json); case "UeWaitBlackboardTime": return new ai.UeWaitBlackboardTime(_json); case "MoveToTarget": return new ai.MoveToTarget(_json); case "ChooseSkill": return new ai.ChooseSkill(_json); case "MoveToRandomLocation": return new ai.MoveToRandomLocation(_json); case "MoveToLocation": return new ai.MoveToLocation(_json); case "DebugPrint": return new ai.DebugPrint(_json); default: throw new SerializationException(); } } public System.Collections.Generic.List<ai.Decorator> Decorators { get; private set; } public System.Collections.Generic.List<ai.Service> Services { get; private set; } public override void Resolve(Dictionary<string, object> _tables) { base.Resolve(_tables); foreach(var _e in Decorators) { _e?.Resolve(_tables); } foreach(var _e in Services) { _e?.Resolve(_tables); } } public override void TranslateText(System.Func<string, string, string> translator) { base.TranslateText(translator); foreach(var _e in Decorators) { _e?.TranslateText(translator); } foreach(var _e in Services) { _e?.TranslateText(translator); } } public override string ToString() { return "{ " + "Id:" + Id + "," + "NodeName:" + NodeName + "," + "Decorators:" + Bright.Common.StringUtil.CollectionToString(Decorators) + "," + "Services:" + Bright.Common.StringUtil.CollectionToString(Services) + "," + "}"; } } } <|start_filename|>Projects/Java_bin/src/main/gen/cfg/item/ChooseOneBonus.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.item; import bright.serialization.*; public final class ChooseOneBonus { public ChooseOneBonus(ByteBuf _buf) { dropId = _buf.readInt(); isUnique = _buf.readBool(); } public ChooseOneBonus(int drop_id, boolean is_unique ) { this.dropId = drop_id; this.isUnique = is_unique; } public final int dropId; public cfg.bonus.DropInfo dropId_Ref; public final boolean isUnique; public void resolve(java.util.HashMap<String, Object> _tables) { this.dropId_Ref = ((cfg.bonus.TbDrop)_tables.get("bonus.TbDrop")).get(dropId); } @Override public String toString() { return "{ " + "dropId:" + dropId + "," + "isUnique:" + isUnique + "," + "}"; } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_SpriteRenderer_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_SpriteRenderer_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.SpriteRenderer(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.SpriteRenderer), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_sprite(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SpriteRenderer; var result = obj.sprite; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_sprite(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SpriteRenderer; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.sprite = argHelper.Get<UnityEngine.Sprite>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_drawMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SpriteRenderer; var result = obj.drawMode; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_drawMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SpriteRenderer; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.drawMode = (UnityEngine.SpriteDrawMode)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_size(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SpriteRenderer; var result = obj.size; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_size(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SpriteRenderer; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.size = argHelper.Get<UnityEngine.Vector2>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_adaptiveModeThreshold(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SpriteRenderer; var result = obj.adaptiveModeThreshold; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_adaptiveModeThreshold(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SpriteRenderer; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.adaptiveModeThreshold = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_tileMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SpriteRenderer; var result = obj.tileMode; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_tileMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SpriteRenderer; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.tileMode = (UnityEngine.SpriteTileMode)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_color(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SpriteRenderer; var result = obj.color; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_color(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SpriteRenderer; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.color = argHelper.Get<UnityEngine.Color>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_maskInteraction(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SpriteRenderer; var result = obj.maskInteraction; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_maskInteraction(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SpriteRenderer; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.maskInteraction = (UnityEngine.SpriteMaskInteraction)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_flipX(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SpriteRenderer; var result = obj.flipX; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_flipX(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SpriteRenderer; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.flipX = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_flipY(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SpriteRenderer; var result = obj.flipY; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_flipY(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SpriteRenderer; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.flipY = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_spriteSortPoint(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SpriteRenderer; var result = obj.spriteSortPoint; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_spriteSortPoint(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SpriteRenderer; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.spriteSortPoint = (UnityEngine.SpriteSortPoint)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"sprite", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_sprite, Setter = S_sprite} }, {"drawMode", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_drawMode, Setter = S_drawMode} }, {"size", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_size, Setter = S_size} }, {"adaptiveModeThreshold", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_adaptiveModeThreshold, Setter = S_adaptiveModeThreshold} }, {"tileMode", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_tileMode, Setter = S_tileMode} }, {"color", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_color, Setter = S_color} }, {"maskInteraction", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_maskInteraction, Setter = S_maskInteraction} }, {"flipX", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_flipX, Setter = S_flipX} }, {"flipY", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_flipY, Setter = S_flipY} }, {"spriteSortPoint", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_spriteSortPoint, Setter = S_spriteSortPoint} }, } }; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_ParticleSystem_Particle_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_ParticleSystem_Particle_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.ParticleSystem.Particle constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetCurrentSize(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.Particle)Puerts.Utils.GetSelf((int)data, self); { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.ParticleSystem>(false); var result = obj.GetCurrentSize(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetCurrentSize3D(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.Particle)Puerts.Utils.GetSelf((int)data, self); { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.ParticleSystem>(false); var result = obj.GetCurrentSize3D(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetCurrentColor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.Particle)Puerts.Utils.GetSelf((int)data, self); { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.ParticleSystem>(false); var result = obj.GetCurrentColor(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetMeshIndex(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.Particle)Puerts.Utils.GetSelf((int)data, self); { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); obj.SetMeshIndex(Arg0); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetMeshIndex(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.Particle)Puerts.Utils.GetSelf((int)data, self); { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.ParticleSystem>(false); var result = obj.GetMeshIndex(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_position(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.Particle)Puerts.Utils.GetSelf((int)data, self); var result = obj.position; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_position(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.Particle)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.position = argHelper.Get<UnityEngine.Vector3>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_velocity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.Particle)Puerts.Utils.GetSelf((int)data, self); var result = obj.velocity; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_velocity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.Particle)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.velocity = argHelper.Get<UnityEngine.Vector3>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_animatedVelocity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.Particle)Puerts.Utils.GetSelf((int)data, self); var result = obj.animatedVelocity; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_totalVelocity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.Particle)Puerts.Utils.GetSelf((int)data, self); var result = obj.totalVelocity; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_remainingLifetime(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.Particle)Puerts.Utils.GetSelf((int)data, self); var result = obj.remainingLifetime; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_remainingLifetime(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.Particle)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.remainingLifetime = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_startLifetime(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.Particle)Puerts.Utils.GetSelf((int)data, self); var result = obj.startLifetime; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_startLifetime(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.Particle)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.startLifetime = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_startColor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.Particle)Puerts.Utils.GetSelf((int)data, self); var result = obj.startColor; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_startColor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.Particle)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.startColor = argHelper.Get<UnityEngine.Color32>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_randomSeed(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.Particle)Puerts.Utils.GetSelf((int)data, self); var result = obj.randomSeed; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_randomSeed(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.Particle)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.randomSeed = argHelper.GetUInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_axisOfRotation(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.Particle)Puerts.Utils.GetSelf((int)data, self); var result = obj.axisOfRotation; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_axisOfRotation(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.Particle)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.axisOfRotation = argHelper.Get<UnityEngine.Vector3>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_startSize(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.Particle)Puerts.Utils.GetSelf((int)data, self); var result = obj.startSize; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_startSize(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.Particle)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.startSize = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_startSize3D(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.Particle)Puerts.Utils.GetSelf((int)data, self); var result = obj.startSize3D; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_startSize3D(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.Particle)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.startSize3D = argHelper.Get<UnityEngine.Vector3>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_rotation(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.Particle)Puerts.Utils.GetSelf((int)data, self); var result = obj.rotation; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_rotation(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.Particle)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.rotation = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_rotation3D(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.Particle)Puerts.Utils.GetSelf((int)data, self); var result = obj.rotation3D; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_rotation3D(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.Particle)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.rotation3D = argHelper.Get<UnityEngine.Vector3>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_angularVelocity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.Particle)Puerts.Utils.GetSelf((int)data, self); var result = obj.angularVelocity; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_angularVelocity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.Particle)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.angularVelocity = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_angularVelocity3D(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.Particle)Puerts.Utils.GetSelf((int)data, self); var result = obj.angularVelocity3D; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_angularVelocity3D(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.Particle)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.angularVelocity3D = argHelper.Get<UnityEngine.Vector3>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "GetCurrentSize", IsStatic = false}, M_GetCurrentSize }, { new Puerts.MethodKey {Name = "GetCurrentSize3D", IsStatic = false}, M_GetCurrentSize3D }, { new Puerts.MethodKey {Name = "GetCurrentColor", IsStatic = false}, M_GetCurrentColor }, { new Puerts.MethodKey {Name = "SetMeshIndex", IsStatic = false}, M_SetMeshIndex }, { new Puerts.MethodKey {Name = "GetMeshIndex", IsStatic = false}, M_GetMeshIndex }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"position", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_position, Setter = S_position} }, {"velocity", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_velocity, Setter = S_velocity} }, {"animatedVelocity", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_animatedVelocity, Setter = null} }, {"totalVelocity", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_totalVelocity, Setter = null} }, {"remainingLifetime", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_remainingLifetime, Setter = S_remainingLifetime} }, {"startLifetime", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_startLifetime, Setter = S_startLifetime} }, {"startColor", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_startColor, Setter = S_startColor} }, {"randomSeed", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_randomSeed, Setter = S_randomSeed} }, {"axisOfRotation", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_axisOfRotation, Setter = S_axisOfRotation} }, {"startSize", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_startSize, Setter = S_startSize} }, {"startSize3D", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_startSize3D, Setter = S_startSize3D} }, {"rotation", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_rotation, Setter = S_rotation} }, {"rotation3D", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_rotation3D, Setter = S_rotation3D} }, {"angularVelocity", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_angularVelocity, Setter = S_angularVelocity} }, {"angularVelocity3D", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_angularVelocity3D, Setter = S_angularVelocity3D} }, } }; } } } <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/ai/ChooseSkill.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.ai { public sealed partial class ChooseSkill : ai.Task { public ChooseSkill(ByteBuf _buf) : base(_buf) { TargetActorKey = _buf.ReadString(); ResultSkillIdKey = _buf.ReadString(); } public ChooseSkill(int id, string node_name, System.Collections.Generic.List<ai.Decorator> decorators, System.Collections.Generic.List<ai.Service> services, bool ignore_restart_self, string target_actor_key, string result_skill_id_key ) : base(id,node_name,decorators,services,ignore_restart_self) { this.TargetActorKey = target_actor_key; this.ResultSkillIdKey = result_skill_id_key; } public static ChooseSkill DeserializeChooseSkill(ByteBuf _buf) { return new ai.ChooseSkill(_buf); } public readonly string TargetActorKey; public readonly string ResultSkillIdKey; public const int ID = -918812268; public override int GetTypeId() => ID; public override void Resolve(Dictionary<string, object> _tables) { base.Resolve(_tables); OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); public override string ToString() { return "{ " + "Id:" + Id + "," + "NodeName:" + NodeName + "," + "Decorators:" + Bright.Common.StringUtil.CollectionToString(Decorators) + "," + "Services:" + Bright.Common.StringUtil.CollectionToString(Services) + "," + "IgnoreRestartSelf:" + IgnoreRestartSelf + "," + "TargetActorKey:" + TargetActorKey + "," + "ResultSkillIdKey:" + ResultSkillIdKey + "," + "}"; } } } <|start_filename|>Projects/java_json/src/gen/cfg/bonus/ProbabilityBonusInfo.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.bonus; import com.google.gson.JsonElement; import com.google.gson.JsonObject; public final class ProbabilityBonusInfo { public ProbabilityBonusInfo(JsonObject __json__) { bonus = cfg.bonus.Bonus.deserializeBonus(__json__.get("bonus").getAsJsonObject()); probability = __json__.get("probability").getAsFloat(); } public ProbabilityBonusInfo(cfg.bonus.Bonus bonus, float probability ) { this.bonus = bonus; this.probability = probability; } public static ProbabilityBonusInfo deserializeProbabilityBonusInfo(JsonObject __json__) { return new ProbabilityBonusInfo(__json__); } public final cfg.bonus.Bonus bonus; public final float probability; public void resolve(java.util.HashMap<String, Object> _tables) { if (bonus != null) {bonus.resolve(_tables);} } @Override public String toString() { return "{ " + "bonus:" + bonus + "," + "probability:" + probability + "," + "}"; } } <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/error/ErrorStyleDlgOk.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.error { public sealed partial class ErrorStyleDlgOk : error.ErrorStyle { public ErrorStyleDlgOk(ByteBuf _buf) : base(_buf) { BtnName = _buf.ReadString(); } public ErrorStyleDlgOk(string btn_name ) : base() { this.BtnName = btn_name; } public static ErrorStyleDlgOk DeserializeErrorStyleDlgOk(ByteBuf _buf) { return new error.ErrorStyleDlgOk(_buf); } public readonly string BtnName; public const int ID = -2010134516; public override int GetTypeId() => ID; public override void Resolve(Dictionary<string, object> _tables) { base.Resolve(_tables); OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); public override string ToString() { return "{ " + "BtnName:" + BtnName + "," + "}"; } } } <|start_filename|>Projects/GenerateDatas/convert_lua/test.TbTestExcelBean/3.lua<|end_filename|> return { x1 = 3, x2 = "ww", x3 = 2, x4 = 5, } <|start_filename|>Projects/Csharp_CustomTemplate_EncryptMemory/Gen/test/H2.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using System; using Newtonsoft.Json; using Scripts; namespace cfg.test { [Serializable] public partial class H2 : AConfig { [JsonProperty("z2")] private int _z2 { get; set; } [JsonIgnore] public EncryptInt z2 { get; private set; } = new(); [JsonProperty("z3")] private int _z3 { get; set; } [JsonIgnore] public EncryptInt z3 { get; private set; } = new(); public override void EndInit() { z2 = _z2; z3 = _z3; } public override string ToString() => JsonConvert.SerializeObject(this); } } <|start_filename|>Projects/GenerateDatas/convert_lua/role.TbRoleLevelExpAttr/77.lua<|end_filename|> return { level = 77, need_exp = 210000, clothes_attrs = { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, }, } <|start_filename|>Projects/GenerateDatas/convert_lua/error.TbCodeInfo/403.lua<|end_filename|> return { code = 403, key = "SKILL_ANOTHER_CASTING", } <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/ai/IsAtLocation.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.ai { public sealed partial class IsAtLocation : ai.Decorator { public IsAtLocation(ByteBuf _buf) : base(_buf) { AcceptableRadius = _buf.ReadFloat(); KeyboardKey = _buf.ReadString(); InverseCondition = _buf.ReadBool(); } public IsAtLocation(int id, string node_name, ai.EFlowAbortMode flow_abort_mode, float acceptable_radius, string keyboard_key, bool inverse_condition ) : base(id,node_name,flow_abort_mode) { this.AcceptableRadius = acceptable_radius; this.KeyboardKey = keyboard_key; this.InverseCondition = inverse_condition; } public static IsAtLocation DeserializeIsAtLocation(ByteBuf _buf) { return new ai.IsAtLocation(_buf); } public readonly float AcceptableRadius; public readonly string KeyboardKey; public readonly bool InverseCondition; public const int ID = 1255972344; public override int GetTypeId() => ID; public override void Resolve(Dictionary<string, object> _tables) { base.Resolve(_tables); OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); public override string ToString() { return "{ " + "Id:" + Id + "," + "NodeName:" + NodeName + "," + "FlowAbortMode:" + FlowAbortMode + "," + "AcceptableRadius:" + AcceptableRadius + "," + "KeyboardKey:" + KeyboardKey + "," + "InverseCondition:" + InverseCondition + "," + "}"; } } } <|start_filename|>ProtoProjects/Lua/Gen/Types.lua<|end_filename|> --[[------------------------------------------------------------------------------ -- <auto-generated> -- This code was generated by a tool. -- Changes to this file may cause incorrect behavior and will be lost if -- the code is regenerated. -- </auto-generated> --]]------------------------------------------------------------------------------ local setmetatable = setmetatable local pairs = pairs local ipairs = ipairs local tinsert = table.insert local function SimpleClass() local class = {} class.__index = class class.New = function(...) local ctor = class.ctor local o = ctor and ctor(...) or {} setmetatable(o, class) return o end return class end local function get_map_size(m) local n = 0 for _ in pairs(m) do n = n + 1 end return n end local enums = { } local function InitTypes(methods) local readBool = methods.readBool local writeBool = methods.writeBool local readByte = methods.readByte local writeByte = methods.writeByte local readShort = methods.readShort local writeShort = methods.writeShort local readFshort = methods.readFshort local writeInt = methods.writeInt local readInt = methods.readInt local writeFint = methods.writeFint local readFint = methods.readFint local readLong = methods.readLong local writeLong = methods.writeLong local readFlong = methods.readFlong local writeFlong = methods.writeFlong local readFloat = methods.readFloat local writeFloat = methods.writeFloat local readDouble = methods.readDouble local writeDouble = methods.writeDouble local readSize = methods.readSize local writeSize = methods.writeSize local readString = methods.readString local writeString = methods.writeString local readBytes = methods.readBytes local writeBytes = methods.writeBytes local function readVector2(bs) return { x = readFloat(bs), y = readFloat(bs) } end local function writeVector2(bs, v) writeFloat(bs, v.x) writeFloat(bs, v.y) end local function readVector3(bs) return { x = readFloat(bs), y = readFloat(bs), z = readFloat(bs) } end local function writeVector3(bs, v) writeFloat(bs, v.x) writeFloat(bs, v.y) writeFloat(bs, v.z) end local function readVector4(bs) return { x = readFloat(bs), y = readFloat(bs), z = readFloat(bs), w = readFloat(bs) } end local function writeVector4(bs, v) writeFloat(bs, v.x) writeFloat(bs, v.y) writeFloat(bs, v.z) writeFloat(bs, v.w) end local function writeList(bs, list, keyFun) writeSize(bs, #list) for _, v in pairs(list) do keyFun(bs, v) end end local function readList(bs, keyFun) local list = {} local v for i = 1, readSize(bs) do tinsert(list, keyFun(bs)) end return list end local writeArray = writeList local readArray = readList local function writeSet(bs, set, keyFun) writeSize(bs, #set) for _, v in ipairs(set) do keyFun(bs, v) end end local function readSet(bs, keyFun) local set = {} local v for i = 1, readSize(bs) do tinsert(set, keyFun(bs)) end return set end local function writeMap(bs, map, keyFun, valueFun) writeSize(bs, get_map_size(map)) for k, v in pairs(map) do keyFun(bs, k) valueFun(bs, v) end end local function readMap(bs, keyFun, valueFun) local map = {} for i = 1, readSize(bs) do local k = keyFun(bs) local v = valueFun(bs) map[k] = v end return map end local function readNullableBool(bs) if readBool(bs) then return readBool(bs) end end local default_vector2 = {x=0,y=0} local default_vector3 = {x=0,y=0,z=0} local default_vector4 = {x=0,y=0,z=0,w=0} local beans = {} do ---@class test.Simple ---@field public x int ---@field public y int local class = SimpleClass() class._id = 0 class._name = 'test.Simple' local id2name = { } class._serialize = function(bs, self) writeInt(bs, self.x or 0) writeInt(bs, self.y or 0) end class._deserialize = function(bs) local o = { x = readInt(bs), y = readInt(bs), } setmetatable(o, class) return o end beans[class._name] = class end do ---@class test.Dyn ---@field public a1 int local class = SimpleClass() class._id = 0 class._name = 'test.Dyn' local id2name = { [1] = 'test.Child2', [10] = 'test.Child31', [11] = 'test.Child32', } class._serialize = function(bs, self) writeInt(bs, 0) beans[self._name]._serialize(bs, self) end class._deserialize = function(bs) local id = readInt(bs) return beans[id2name[id]]._deserialize(bs) end beans[class._name] = class end do ---@class test.Child2 :test.Dyn ---@field public a20 int local class = SimpleClass() class._id = 1 class._name = 'test.Child2' local id2name = { } class._serialize = function(bs, self) writeInt(bs, self.a1 or 0) writeInt(bs, self.a20 or 0) end class._deserialize = function(bs) local o = { a1 = readInt(bs), a20 = readInt(bs), } setmetatable(o, class) return o end beans[class._name] = class end do ---@class test.Child21 :test.Dyn ---@field public a24 int local class = SimpleClass() class._id = 0 class._name = 'test.Child21' local id2name = { [10] = 'test.Child31', [11] = 'test.Child32', } class._serialize = function(bs, self) writeInt(bs, 0) beans[self._name]._serialize(bs, self) end class._deserialize = function(bs) local id = readInt(bs) return beans[id2name[id]]._deserialize(bs) end beans[class._name] = class end do ---@class test.Child31 :test.Child21 ---@field public a31 int ---@field public a32 int local class = SimpleClass() class._id = 10 class._name = 'test.Child31' local id2name = { } class._serialize = function(bs, self) writeInt(bs, self.a1 or 0) writeInt(bs, self.a24 or 0) writeInt(bs, self.a31 or 0) writeInt(bs, self.a32 or 0) end class._deserialize = function(bs) local o = { a1 = readInt(bs), a24 = readInt(bs), a31 = readInt(bs), a32 = readInt(bs), } setmetatable(o, class) return o end beans[class._name] = class end do ---@class test.Child32 :test.Child21 ---@field public b31 int ---@field public b32 int local class = SimpleClass() class._id = 11 class._name = 'test.Child32' local id2name = { } class._serialize = function(bs, self) writeInt(bs, self.a1 or 0) writeInt(bs, self.a24 or 0) writeInt(bs, self.b31 or 0) writeInt(bs, self.b32 or 0) end class._deserialize = function(bs) local o = { a1 = readInt(bs), a24 = readInt(bs), b31 = readInt(bs), b32 = readInt(bs), } setmetatable(o, class) return o end beans[class._name] = class end do ---@class test.AllType ---@field public x1 bool ---@field public x2 byte ---@field public x3 short ---@field public x4 short ---@field public x5 int ---@field public x6 int ---@field public x7 long ---@field public x8 long ---@field public a1 string ---@field public a2 string ---@field public b1 int[] ---@field public b2 test.Simple[] ---@field public b3 test.Dyn[] ---@field public c1 int[] ---@field public c2 test.Simple[] ---@field public c3 test.Dyn[] ---@field public d1 int[] ---@field public e1 table<int,int> ---@field public e2 table<int,test.Simple> ---@field public e3 table<int,test.Dyn> local class = SimpleClass() class._id = 0 class._name = 'test.AllType' local id2name = { } class._serialize = function(bs, self) writeBool(bs, self.x1 == true) writeByte(bs, self.x2 or 0) writeShort(bs, self.x3 or 0) writeFshort(bs, self.x4 or 0) writeInt(bs, self.x5 or 0) writeFint(bs, self.x6 or 0) writeLong(bs, self.x7 or 0) writeFlong(bs, self.x8 or 0) writeString(bs, self.a1 or "") writeBytes(bs, self.a2 or "") writeArray(bs, self.b1 or {}, writeInt) writeArray(bs, self.b2 or {}, beans['test.Simple']._serialize) writeArray(bs, self.b3 or {}, beans['test.Dyn']._serialize) writeList(bs, self.c1 or {}, writeInt) writeList(bs, self.c2 or {}, beans['test.Simple']._serialize) writeList(bs, self.c3 or {}, beans['test.Dyn']._serialize) writeBool(bs, self.d1 or {}, writeInt) writeBool(bs, self.e1 or {}, writeInt, writeInt) writeBool(bs, self.e2 or {}, writeInt, beans['test.Simple']._serialize) writeBool(bs, self.e3 or {}, writeInt, beans['test.Dyn']._serialize) end class._deserialize = function(bs) local o = { x1 = readBool(bs), x2 = readByte(bs), x3 = readShort(bs), x4 = readFshort(bs), x5 = readInt(bs), x6 = readFint(bs), x7 = readLong(bs), x8 = readFlong(bs), a1 = readString(bs), a2 = readBytes(bs), b1 = readArray(bs, readInt), b2 = readArray(bs, beans['test.Simple']._deserialize), b3 = readArray(bs, beans['test.Dyn']._deserialize), c1 = readList(bs, readInt), c2 = readList(bs, beans['test.Simple']._deserialize), c3 = readList(bs, beans['test.Dyn']._deserialize), d1 = readSet(bs, readInt), e1 = readMap(bs, readInt, readInt), e2 = readMap(bs, readInt, beans['test.Simple']._deserialize), e3 = readMap(bs, readInt, beans['test.Dyn']._deserialize), } setmetatable(o, class) return o end beans[class._name] = class end do ---@class test.TestRpcArg ---@field public x int ---@field public y string local class = SimpleClass() class._id = 0 class._name = 'test.TestRpcArg' local id2name = { } class._serialize = function(bs, self) writeInt(bs, self.x or 0) writeString(bs, self.y or "") end class._deserialize = function(bs) local o = { x = readInt(bs), y = readString(bs), } setmetatable(o, class) return o end beans[class._name] = class end do ---@class test.TestRpcRes ---@field public x int ---@field public y int local class = SimpleClass() class._id = 0 class._name = 'test.TestRpcRes' local id2name = { } class._serialize = function(bs, self) writeInt(bs, self.x or 0) writeInt(bs, self.y or 0) end class._deserialize = function(bs) local o = { x = readInt(bs), y = readInt(bs), } setmetatable(o, class) return o end beans[class._name] = class end local protos = { } do ---@class test.TestProto1 ---@field public x int ---@field public y string local class = SimpleClass() class._id = 23983 class._name = 'test.TestProto1' class._serialize = function(bs, self) writeInt(bs, self.x or 0) writeString(bs, self.y or "") end class._deserialize = function(bs) local o = { x = readInt(bs), y = readString(bs), } setmetatable(o, class) return o end protos[class._id] = class protos[class._name] = class end do ---@class test.Foo ---@field public x int ---@field public y test.AllType ---@field public z test.Simple local class = SimpleClass() class._id = 1234 class._name = 'test.Foo' class._serialize = function(bs, self) writeInt(bs, self.x or 0) beans['test.AllType']._serialize(bs, self.y or {}) beans['test.Simple']._serialize(bs, self.z or {}) end class._deserialize = function(bs) local o = { x = readInt(bs), y = beans['test.AllType']._deserialize(bs), z = beans['test.Simple']._deserialize(bs), } setmetatable(o, class) return o end protos[class._id] = class protos[class._name] = class end return { enums = enums, beans = beans, protos = protos } end return { InitTypes = InitTypes} <|start_filename|>Projects/Csharp_CustomTemplate_EncryptMemory/Gen/role/LevelExpAttr.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using System; using Newtonsoft.Json; using Scripts; namespace cfg.role { [Serializable] public partial class LevelExpAttr : AConfig { [JsonProperty("level")] private int _level { get; set; } [JsonIgnore] public EncryptInt level { get; private set; } = new(); [JsonProperty("need_exp")] private long _need_exp { get; set; } [JsonIgnore] public EncryptLong need_exp { get; private set; } = new(); public System.Collections.Generic.List<int> clothes_attrs { get; set; } public override void EndInit() { level = _level; need_exp = _need_exp; } public override string ToString() => JsonConvert.SerializeObject(this); } } <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/item/ItemExtra.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.item { public abstract partial class ItemExtra : Bright.Config.BeanBase { public ItemExtra(ByteBuf _buf) { Id = _buf.ReadInt(); } public ItemExtra(int id ) { this.Id = id; } public static ItemExtra DeserializeItemExtra(ByteBuf _buf) { switch (_buf.ReadInt()) { case item.TreasureBox.ID: return new item.TreasureBox(_buf); case item.InteractionItem.ID: return new item.InteractionItem(_buf); case item.Clothes.ID: return new item.Clothes(_buf); case item.DesignDrawing.ID: return new item.DesignDrawing(_buf); case item.Dymmy.ID: return new item.Dymmy(_buf); default: throw new SerializationException(); } } public readonly int Id; public virtual void Resolve(Dictionary<string, object> _tables) { OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); public override string ToString() { return "{ " + "Id:" + Id + "," + "}"; } } } <|start_filename|>Projects/CfgValidator/Modules/Misc.cs<|end_filename|> using cfg.item; using Microsoft.VisualStudio.TestTools.UnitTesting; using System; using System.Collections.Generic; using System.Text; namespace CfgCheck.Modules { [TestClass] public class Misc { [TestMethod] public void Check_TreasureBoxConfig() { foreach (var itemConfig in ConfigSetUp.Configs.TbItem.DataList) { var itemId = itemConfig.Id; if (itemConfig.MajorType == EMajorType.TREASURE_BOX) { var boxConfig = (TreasureBox)ConfigSetUp.Configs.TbItemExtra.Get(itemId); if (itemConfig.MinorType == EMinorType.TREASURE_BOX) { Assert.AreNotEqual(0, boxConfig.DropIds.Count, $"宝箱掉落列表不能为空. itemId:{itemId}"); } if (itemConfig.MinorType == EMinorType.MULTI_CHOOSE_TREASURE_BOX) { Assert.AreNotEqual(0, boxConfig.ChooseList.Count, $"多选宝箱 选择列表不能为空. itemId:{itemId}"); foreach (var chooseConfig in boxConfig.ChooseList) { cfg.bonus.DropInfo dropConfig = ConfigSetUp.Configs.TbDrop.Get(chooseConfig.DropId); Assert.IsTrue(dropConfig.Bonus is cfg.bonus.Item, $"多选宝箱:{itemId} 中的 掉落id:{chooseConfig.DropId} 对应的bonus必须为 Item 类型"); } } } } } } } <|start_filename|>Projects/GenerateDatas/convert_lua/role.TbRoleLevelExpAttr/75.lua<|end_filename|> return { level = 75, need_exp = 200000, clothes_attrs = { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, }, } <|start_filename|>Projects/DataTemplates/template_lua2/role_tbrolelevelexpattr.lua<|end_filename|> -- role.TbRoleLevelExpAttr return { [1] = { level=1, need_exp=0, clothes_attrs= { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, }, [2] = { level=2, need_exp=100, clothes_attrs= { 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, }, }, [3] = { level=3, need_exp=200, clothes_attrs= { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, }, }, [4] = { level=4, need_exp=300, clothes_attrs= { 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, }, }, [5] = { level=5, need_exp=400, clothes_attrs= { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, }, }, [6] = { level=6, need_exp=500, clothes_attrs= { 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, }, }, [7] = { level=7, need_exp=700, clothes_attrs= { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, }, }, [8] = { level=8, need_exp=900, clothes_attrs= { 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, }, }, [9] = { level=9, need_exp=1100, clothes_attrs= { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, }, }, [10] = { level=10, need_exp=1300, clothes_attrs= { 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, }, }, [11] = { level=11, need_exp=1500, clothes_attrs= { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, }, }, [12] = { level=12, need_exp=2000, clothes_attrs= { 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, }, }, [13] = { level=13, need_exp=2500, clothes_attrs= { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, }, }, [14] = { level=14, need_exp=3000, clothes_attrs= { 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, }, }, [15] = { level=15, need_exp=3500, clothes_attrs= { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, }, }, [16] = { level=16, need_exp=4000, clothes_attrs= { 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, }, }, [17] = { level=17, need_exp=4500, clothes_attrs= { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, }, }, [18] = { level=18, need_exp=5000, clothes_attrs= { 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, }, }, [19] = { level=19, need_exp=5500, clothes_attrs= { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, }, }, [20] = { level=20, need_exp=6000, clothes_attrs= { 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, }, }, [21] = { level=21, need_exp=6500, clothes_attrs= { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, }, }, [22] = { level=22, need_exp=7000, clothes_attrs= { 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, }, }, [23] = { level=23, need_exp=7500, clothes_attrs= { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, }, }, [24] = { level=24, need_exp=8000, clothes_attrs= { 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, }, }, [25] = { level=25, need_exp=8500, clothes_attrs= { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, }, }, [26] = { level=26, need_exp=9000, clothes_attrs= { 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, }, }, [27] = { level=27, need_exp=9500, clothes_attrs= { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, }, }, [28] = { level=28, need_exp=10000, clothes_attrs= { 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, }, }, [29] = { level=29, need_exp=11000, clothes_attrs= { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, }, }, [30] = { level=30, need_exp=12000, clothes_attrs= { 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, }, }, [31] = { level=31, need_exp=13000, clothes_attrs= { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, }, }, [32] = { level=32, need_exp=14000, clothes_attrs= { 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, }, }, [33] = { level=33, need_exp=15000, clothes_attrs= { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, }, }, [34] = { level=34, need_exp=17000, clothes_attrs= { 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, }, }, [35] = { level=35, need_exp=19000, clothes_attrs= { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, }, }, [36] = { level=36, need_exp=21000, clothes_attrs= { 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, }, }, [37] = { level=37, need_exp=23000, clothes_attrs= { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, }, }, [38] = { level=38, need_exp=25000, clothes_attrs= { 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, }, }, [39] = { level=39, need_exp=28000, clothes_attrs= { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, }, }, [40] = { level=40, need_exp=31000, clothes_attrs= { 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, }, }, [41] = { level=41, need_exp=34000, clothes_attrs= { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, }, }, [42] = { level=42, need_exp=37000, clothes_attrs= { 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, }, }, [43] = { level=43, need_exp=40000, clothes_attrs= { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, }, }, [44] = { level=44, need_exp=45000, clothes_attrs= { 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, }, }, [45] = { level=45, need_exp=50000, clothes_attrs= { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, }, }, [46] = { level=46, need_exp=55000, clothes_attrs= { 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, }, }, [47] = { level=47, need_exp=60000, clothes_attrs= { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, }, }, [48] = { level=48, need_exp=65000, clothes_attrs= { 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, }, }, [49] = { level=49, need_exp=70000, clothes_attrs= { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, }, }, [50] = { level=50, need_exp=75000, clothes_attrs= { 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, }, }, [51] = { level=51, need_exp=80000, clothes_attrs= { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, }, }, [52] = { level=52, need_exp=85000, clothes_attrs= { 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, }, }, [53] = { level=53, need_exp=90000, clothes_attrs= { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, }, }, [54] = { level=54, need_exp=95000, clothes_attrs= { 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, }, }, [55] = { level=55, need_exp=100000, clothes_attrs= { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, }, }, [56] = { level=56, need_exp=105000, clothes_attrs= { 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, }, }, [57] = { level=57, need_exp=110000, clothes_attrs= { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, }, }, [58] = { level=58, need_exp=115000, clothes_attrs= { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, }, }, [59] = { level=59, need_exp=120000, clothes_attrs= { 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, }, }, [60] = { level=60, need_exp=125000, clothes_attrs= { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, }, }, [61] = { level=61, need_exp=130000, clothes_attrs= { 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, }, }, [62] = { level=62, need_exp=135000, clothes_attrs= { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, }, }, [63] = { level=63, need_exp=140000, clothes_attrs= { 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, }, }, [64] = { level=64, need_exp=145000, clothes_attrs= { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, }, }, [65] = { level=65, need_exp=150000, clothes_attrs= { 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, }, }, [66] = { level=66, need_exp=155000, clothes_attrs= { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, }, }, [67] = { level=67, need_exp=160000, clothes_attrs= { 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, }, }, [68] = { level=68, need_exp=165000, clothes_attrs= { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, }, }, [69] = { level=69, need_exp=170000, clothes_attrs= { 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, }, }, [70] = { level=70, need_exp=175000, clothes_attrs= { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, }, }, [71] = { level=71, need_exp=180000, clothes_attrs= { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, }, }, [72] = { level=72, need_exp=185000, clothes_attrs= { 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, }, }, [73] = { level=73, need_exp=190000, clothes_attrs= { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, }, }, [74] = { level=74, need_exp=195000, clothes_attrs= { 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, }, }, [75] = { level=75, need_exp=200000, clothes_attrs= { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, }, }, [76] = { level=76, need_exp=205000, clothes_attrs= { 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, }, }, [77] = { level=77, need_exp=210000, clothes_attrs= { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, }, }, [78] = { level=78, need_exp=215000, clothes_attrs= { 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, }, }, [79] = { level=79, need_exp=220000, clothes_attrs= { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, }, }, [80] = { level=80, need_exp=225000, clothes_attrs= { 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, }, }, [81] = { level=81, need_exp=230000, clothes_attrs= { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, }, }, [82] = { level=82, need_exp=235000, clothes_attrs= { 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, }, }, [83] = { level=83, need_exp=240000, clothes_attrs= { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, }, }, [84] = { level=84, need_exp=245000, clothes_attrs= { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, }, }, [85] = { level=85, need_exp=250000, clothes_attrs= { 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, }, }, [86] = { level=86, need_exp=255000, clothes_attrs= { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, }, }, [87] = { level=87, need_exp=260000, clothes_attrs= { 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, }, }, [88] = { level=88, need_exp=265000, clothes_attrs= { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, }, }, [89] = { level=89, need_exp=270000, clothes_attrs= { 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, }, }, [90] = { level=90, need_exp=275000, clothes_attrs= { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, }, }, [91] = { level=91, need_exp=280000, clothes_attrs= { 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, }, }, [92] = { level=92, need_exp=285000, clothes_attrs= { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, }, }, [93] = { level=93, need_exp=290000, clothes_attrs= { 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, }, }, [94] = { level=94, need_exp=295000, clothes_attrs= { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, }, }, [95] = { level=95, need_exp=300000, clothes_attrs= { 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, }, }, [96] = { level=96, need_exp=305000, clothes_attrs= { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, }, }, [97] = { level=97, need_exp=310000, clothes_attrs= { 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, }, }, [98] = { level=98, need_exp=315000, clothes_attrs= { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, }, }, [99] = { level=99, need_exp=320000, clothes_attrs= { 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, }, }, [100] = { level=100, need_exp=325000, clothes_attrs= { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, }, }, } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_HumanPose_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_HumanPose_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.HumanPose constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_bodyPosition(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.HumanPose)Puerts.Utils.GetSelf((int)data, self); var result = obj.bodyPosition; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_bodyPosition(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.HumanPose)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.bodyPosition = argHelper.Get<UnityEngine.Vector3>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_bodyRotation(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.HumanPose)Puerts.Utils.GetSelf((int)data, self); var result = obj.bodyRotation; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_bodyRotation(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.HumanPose)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.bodyRotation = argHelper.Get<UnityEngine.Quaternion>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_muscles(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.HumanPose)Puerts.Utils.GetSelf((int)data, self); var result = obj.muscles; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_muscles(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.HumanPose)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.muscles = argHelper.Get<float[]>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"bodyPosition", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_bodyPosition, Setter = S_bodyPosition} }, {"bodyRotation", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_bodyRotation, Setter = S_bodyRotation} }, {"muscles", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_muscles, Setter = S_muscles} }, } }; } } } <|start_filename|>Projects/Go_json/gen/src/cfg/ai.UpdateDailyBehaviorProps.go<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg import "errors" type AiUpdateDailyBehaviorProps struct { Id int32 NodeName string SatietyKey string EnergyKey string MoodKey string SatietyLowerThresholdKey string SatietyUpperThresholdKey string EnergyLowerThresholdKey string EnergyUpperThresholdKey string MoodLowerThresholdKey string MoodUpperThresholdKey string } const TypeId_AiUpdateDailyBehaviorProps = -61887372 func (*AiUpdateDailyBehaviorProps) GetTypeId() int32 { return -61887372 } func (_v *AiUpdateDailyBehaviorProps)Deserialize(_buf map[string]interface{}) (err error) { { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["id"].(float64); !_ok_ { err = errors.New("id error"); return }; _v.Id = int32(_tempNum_) } { var _ok_ bool; if _v.NodeName, _ok_ = _buf["node_name"].(string); !_ok_ { err = errors.New("node_name error"); return } } { var _ok_ bool; if _v.SatietyKey, _ok_ = _buf["satiety_key"].(string); !_ok_ { err = errors.New("satiety_key error"); return } } { var _ok_ bool; if _v.EnergyKey, _ok_ = _buf["energy_key"].(string); !_ok_ { err = errors.New("energy_key error"); return } } { var _ok_ bool; if _v.MoodKey, _ok_ = _buf["mood_key"].(string); !_ok_ { err = errors.New("mood_key error"); return } } { var _ok_ bool; if _v.SatietyLowerThresholdKey, _ok_ = _buf["satiety_lower_threshold_key"].(string); !_ok_ { err = errors.New("satiety_lower_threshold_key error"); return } } { var _ok_ bool; if _v.SatietyUpperThresholdKey, _ok_ = _buf["satiety_upper_threshold_key"].(string); !_ok_ { err = errors.New("satiety_upper_threshold_key error"); return } } { var _ok_ bool; if _v.EnergyLowerThresholdKey, _ok_ = _buf["energy_lower_threshold_key"].(string); !_ok_ { err = errors.New("energy_lower_threshold_key error"); return } } { var _ok_ bool; if _v.EnergyUpperThresholdKey, _ok_ = _buf["energy_upper_threshold_key"].(string); !_ok_ { err = errors.New("energy_upper_threshold_key error"); return } } { var _ok_ bool; if _v.MoodLowerThresholdKey, _ok_ = _buf["mood_lower_threshold_key"].(string); !_ok_ { err = errors.New("mood_lower_threshold_key error"); return } } { var _ok_ bool; if _v.MoodUpperThresholdKey, _ok_ = _buf["mood_upper_threshold_key"].(string); !_ok_ { err = errors.New("mood_upper_threshold_key error"); return } } return } func DeserializeAiUpdateDailyBehaviorProps(_buf map[string]interface{}) (*AiUpdateDailyBehaviorProps, error) { v := &AiUpdateDailyBehaviorProps{} if err := v.Deserialize(_buf); err == nil { return v, nil } else { return nil, err } } <|start_filename|>Projects/Csharp_DotNet5_json_ExportServer/Gen/ai/BinaryOperator.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; using System.Text.Json; namespace cfg.ai { public sealed class BinaryOperator : ai.KeyQueryOperator { public BinaryOperator(JsonElement _json) : base(_json) { Oper = (ai.EOperator)_json.GetProperty("oper").GetInt32(); Data = ai.KeyData.DeserializeKeyData(_json.GetProperty("data")); } public BinaryOperator(ai.EOperator oper, ai.KeyData data ) : base() { this.Oper = oper; this.Data = data; } public static BinaryOperator DeserializeBinaryOperator(JsonElement _json) { return new ai.BinaryOperator(_json); } public ai.EOperator Oper { get; private set; } public ai.KeyData Data { get; private set; } public const int __ID__ = -979891605; public override int GetTypeId() => __ID__; public override void Resolve(Dictionary<string, object> _tables) { base.Resolve(_tables); Data?.Resolve(_tables); } public override void TranslateText(System.Func<string, string, string> translator) { base.TranslateText(translator); Data?.TranslateText(translator); } public override string ToString() { return "{ " + "Oper:" + Oper + "," + "Data:" + Data + "," + "}"; } } } <|start_filename|>Projects/GenerateDatas/convert_lua/tag.TbTestTag/102.lua<|end_filename|> return { id = 102, value = "test", } <|start_filename|>Projects/GenerateDatas/convert_lua/l10n.TbL10NDemo/15.lua<|end_filename|> return { id = 15, text = {key='/demo/5',text="测试5"}, } <|start_filename|>Projects/java_json/src/gen/cfg/common/EBoolOperator.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.common; public enum EBoolOperator { AND(0), OR(1), ; private final int value; public int getValue() { return value; } EBoolOperator(int value) { this.value = value; } public static EBoolOperator valueOf(int value) { if (value == 0) return AND; if (value == 1) return OR; throw new IllegalArgumentException(""); } } <|start_filename|>Projects/L10N/config_data/l10n_tbpatchdemo.lua<|end_filename|> return { [11] = {id=11,value=1001,}, [12] = {id=12,value=1002,}, [13] = {id=13,value=3,}, [14] = {id=14,value=4,}, [15] = {id=15,value=5,}, [16] = {id=16,value=6,}, [17] = {id=17,value=7,}, [18] = {id=18,value=8,}, [20] = {id=20,value=20,}, [21] = {id=21,value=21,}, [30] = {id=30,value=300,}, [31] = {id=31,value=310,}, } <|start_filename|>Projects/GenerateDatas/convert_lua/error.TbCodeInfo/202.lua<|end_filename|> return { code = 202, key = "ITEM_CAN_NOT_USE", } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_Bounds_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_Bounds_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3>(false); var result = new UnityEngine.Bounds(Arg0,Arg1); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.Bounds), result); } } if (paramLen == 0) { { var result = new UnityEngine.Bounds(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.Bounds), result); } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.Bounds constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetHashCode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Bounds)Puerts.Utils.GetSelf((int)data, self); { { var result = obj.GetHashCode(); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Equals(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Bounds)Puerts.Utils.GetSelf((int)data, self); if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.Any, typeof(System.Object), false, false)) { var Arg0 = argHelper0.Get<System.Object>(false); var result = obj.Equals(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Bounds), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Bounds>(false); var result = obj.Equals(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to Equals"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetMinMax(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Bounds)Puerts.Utils.GetSelf((int)data, self); { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3>(false); obj.SetMinMax(Arg0,Arg1); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Encapsulate(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Bounds)Puerts.Utils.GetSelf((int)data, self); if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); obj.Encapsulate(Arg0); Puerts.Utils.SetSelf((int)data, self, obj); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Bounds), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Bounds>(false); obj.Encapsulate(Arg0); Puerts.Utils.SetSelf((int)data, self, obj); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to Encapsulate"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Expand(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Bounds)Puerts.Utils.GetSelf((int)data, self); if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetFloat(false); obj.Expand(Arg0); Puerts.Utils.SetSelf((int)data, self, obj); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); obj.Expand(Arg0); Puerts.Utils.SetSelf((int)data, self, obj); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to Expand"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Intersects(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Bounds)Puerts.Utils.GetSelf((int)data, self); { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Bounds>(false); var result = obj.Intersects(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_IntersectRay(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Bounds)Puerts.Utils.GetSelf((int)data, self); if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Ray), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Ray>(false); var result = obj.IntersectRay(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Ray), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, true, true)) { var Arg0 = argHelper0.Get<UnityEngine.Ray>(false); var Arg1 = argHelper1.GetFloat(true); var result = obj.IntersectRay(Arg0,out Arg1); argHelper1.SetByRefValue(Arg1); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to IntersectRay"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ToString(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Bounds)Puerts.Utils.GetSelf((int)data, self); if (paramLen == 0) { { var result = obj.ToString(); Puerts.PuertsDLL.ReturnString(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var result = obj.ToString(Arg0); Puerts.PuertsDLL.ReturnString(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.IFormatProvider), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<System.IFormatProvider>(false); var result = obj.ToString(Arg0,Arg1); Puerts.PuertsDLL.ReturnString(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to ToString"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Contains(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Bounds)Puerts.Utils.GetSelf((int)data, self); { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var result = obj.Contains(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SqrDistance(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Bounds)Puerts.Utils.GetSelf((int)data, self); { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var result = obj.SqrDistance(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ClosestPoint(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Bounds)Puerts.Utils.GetSelf((int)data, self); { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var result = obj.ClosestPoint(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_center(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Bounds)Puerts.Utils.GetSelf((int)data, self); var result = obj.center; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_center(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Bounds)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.center = argHelper.Get<UnityEngine.Vector3>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_size(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Bounds)Puerts.Utils.GetSelf((int)data, self); var result = obj.size; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_size(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Bounds)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.size = argHelper.Get<UnityEngine.Vector3>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_extents(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Bounds)Puerts.Utils.GetSelf((int)data, self); var result = obj.extents; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_extents(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Bounds)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.extents = argHelper.Get<UnityEngine.Vector3>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_min(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Bounds)Puerts.Utils.GetSelf((int)data, self); var result = obj.min; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_min(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Bounds)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.min = argHelper.Get<UnityEngine.Vector3>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_max(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Bounds)Puerts.Utils.GetSelf((int)data, self); var result = obj.max; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_max(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Bounds)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.max = argHelper.Get<UnityEngine.Vector3>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void O_op_Equality(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var arg0 = argHelper0.Get<UnityEngine.Bounds>(false); var arg1 = argHelper1.Get<UnityEngine.Bounds>(false); var result = arg0 == arg1; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void O_op_Inequality(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var arg0 = argHelper0.Get<UnityEngine.Bounds>(false); var arg1 = argHelper1.Get<UnityEngine.Bounds>(false); var result = arg0 != arg1; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "GetHashCode", IsStatic = false}, M_GetHashCode }, { new Puerts.MethodKey {Name = "Equals", IsStatic = false}, M_Equals }, { new Puerts.MethodKey {Name = "SetMinMax", IsStatic = false}, M_SetMinMax }, { new Puerts.MethodKey {Name = "Encapsulate", IsStatic = false}, M_Encapsulate }, { new Puerts.MethodKey {Name = "Expand", IsStatic = false}, M_Expand }, { new Puerts.MethodKey {Name = "Intersects", IsStatic = false}, M_Intersects }, { new Puerts.MethodKey {Name = "IntersectRay", IsStatic = false}, M_IntersectRay }, { new Puerts.MethodKey {Name = "ToString", IsStatic = false}, M_ToString }, { new Puerts.MethodKey {Name = "Contains", IsStatic = false}, M_Contains }, { new Puerts.MethodKey {Name = "SqrDistance", IsStatic = false}, M_SqrDistance }, { new Puerts.MethodKey {Name = "ClosestPoint", IsStatic = false}, M_ClosestPoint }, { new Puerts.MethodKey {Name = "op_Equality", IsStatic = true}, O_op_Equality}, { new Puerts.MethodKey {Name = "op_Inequality", IsStatic = true}, O_op_Inequality}, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"center", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_center, Setter = S_center} }, {"size", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_size, Setter = S_size} }, {"extents", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_extents, Setter = S_extents} }, {"min", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_min, Setter = S_min} }, {"max", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_max, Setter = S_max} }, } }; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_Cubemap_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_Cubemap_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = (UnityEngine.Experimental.Rendering.DefaultFormat)argHelper1.GetInt32(false); var Arg2 = (UnityEngine.Experimental.Rendering.TextureCreationFlags)argHelper2.GetInt32(false); var result = new UnityEngine.Cubemap(Arg0,Arg1,Arg2); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.Cubemap), result); } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = (UnityEngine.Experimental.Rendering.GraphicsFormat)argHelper1.GetInt32(false); var Arg2 = (UnityEngine.Experimental.Rendering.TextureCreationFlags)argHelper2.GetInt32(false); var result = new UnityEngine.Cubemap(Arg0,Arg1,Arg2); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.Cubemap), result); } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = (UnityEngine.TextureFormat)argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var result = new UnityEngine.Cubemap(Arg0,Arg1,Arg2); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.Cubemap), result); } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = (UnityEngine.TextureFormat)argHelper1.GetInt32(false); var Arg2 = argHelper2.GetBoolean(false); var result = new UnityEngine.Cubemap(Arg0,Arg1,Arg2); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.Cubemap), result); } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = (UnityEngine.Experimental.Rendering.GraphicsFormat)argHelper1.GetInt32(false); var Arg2 = (UnityEngine.Experimental.Rendering.TextureCreationFlags)argHelper2.GetInt32(false); var Arg3 = argHelper3.GetInt32(false); var result = new UnityEngine.Cubemap(Arg0,Arg1,Arg2,Arg3); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.Cubemap), result); } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.Cubemap constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_UpdateExternalTexture(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Cubemap; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.IntPtr>(false); obj.UpdateExternalTexture(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SmoothEdges(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Cubemap; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); obj.SmoothEdges(Arg0); return; } } if (paramLen == 0) { { obj.SmoothEdges(); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SmoothEdges"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetPixels(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Cubemap; if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = (UnityEngine.CubemapFace)argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var result = obj.GetPixels(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = (UnityEngine.CubemapFace)argHelper0.GetInt32(false); var result = obj.GetPixels(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetPixels"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetPixels(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Cubemap; if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Color[]), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Color[]>(false); var Arg1 = (UnityEngine.CubemapFace)argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); obj.SetPixels(Arg0,Arg1,Arg2); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Color[]), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Color[]>(false); var Arg1 = (UnityEngine.CubemapFace)argHelper1.GetInt32(false); obj.SetPixels(Arg0,Arg1); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SetPixels"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ClearRequestedMipmapLevel(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Cubemap; { { obj.ClearRequestedMipmapLevel(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_IsRequestedMipmapLevelLoaded(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Cubemap; { { var result = obj.IsRequestedMipmapLevelLoaded(); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_CreateExternalTexture(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); { var Arg0 = argHelper0.GetInt32(false); var Arg1 = (UnityEngine.TextureFormat)argHelper1.GetInt32(false); var Arg2 = argHelper2.GetBoolean(false); var Arg3 = argHelper3.Get<System.IntPtr>(false); var result = UnityEngine.Cubemap.CreateExternalTexture(Arg0,Arg1,Arg2,Arg3); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetPixel(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Cubemap; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); { var Arg0 = (UnityEngine.CubemapFace)argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.Get<UnityEngine.Color>(false); obj.SetPixel(Arg0,Arg1,Arg2,Arg3); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetPixel(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Cubemap; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = (UnityEngine.CubemapFace)argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var result = obj.GetPixel(Arg0,Arg1,Arg2); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Apply(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Cubemap; if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.GetBoolean(false); var Arg1 = argHelper1.GetBoolean(false); obj.Apply(Arg0,Arg1); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.GetBoolean(false); obj.Apply(Arg0); return; } } if (paramLen == 0) { { obj.Apply(); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to Apply"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_format(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Cubemap; var result = obj.format; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_isReadable(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Cubemap; var result = obj.isReadable; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_streamingMipmaps(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Cubemap; var result = obj.streamingMipmaps; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_streamingMipmapsPriority(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Cubemap; var result = obj.streamingMipmapsPriority; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_requestedMipmapLevel(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Cubemap; var result = obj.requestedMipmapLevel; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_requestedMipmapLevel(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Cubemap; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.requestedMipmapLevel = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_desiredMipmapLevel(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Cubemap; var result = obj.desiredMipmapLevel; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_loadingMipmapLevel(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Cubemap; var result = obj.loadingMipmapLevel; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_loadedMipmapLevel(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Cubemap; var result = obj.loadedMipmapLevel; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "UpdateExternalTexture", IsStatic = false}, M_UpdateExternalTexture }, { new Puerts.MethodKey {Name = "SmoothEdges", IsStatic = false}, M_SmoothEdges }, { new Puerts.MethodKey {Name = "GetPixels", IsStatic = false}, M_GetPixels }, { new Puerts.MethodKey {Name = "SetPixels", IsStatic = false}, M_SetPixels }, { new Puerts.MethodKey {Name = "ClearRequestedMipmapLevel", IsStatic = false}, M_ClearRequestedMipmapLevel }, { new Puerts.MethodKey {Name = "IsRequestedMipmapLevelLoaded", IsStatic = false}, M_IsRequestedMipmapLevelLoaded }, { new Puerts.MethodKey {Name = "CreateExternalTexture", IsStatic = true}, F_CreateExternalTexture }, { new Puerts.MethodKey {Name = "SetPixel", IsStatic = false}, M_SetPixel }, { new Puerts.MethodKey {Name = "GetPixel", IsStatic = false}, M_GetPixel }, { new Puerts.MethodKey {Name = "Apply", IsStatic = false}, M_Apply }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"format", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_format, Setter = null} }, {"isReadable", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_isReadable, Setter = null} }, {"streamingMipmaps", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_streamingMipmaps, Setter = null} }, {"streamingMipmapsPriority", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_streamingMipmapsPriority, Setter = null} }, {"requestedMipmapLevel", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_requestedMipmapLevel, Setter = S_requestedMipmapLevel} }, {"desiredMipmapLevel", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_desiredMipmapLevel, Setter = null} }, {"loadingMipmapLevel", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_loadingMipmapLevel, Setter = null} }, {"loadedMipmapLevel", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_loadedMipmapLevel, Setter = null} }, } }; } } } <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/ai/Node.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.ai { public abstract partial class Node : Bright.Config.BeanBase { public Node(ByteBuf _buf) { Id = _buf.ReadInt(); NodeName = _buf.ReadString(); } public Node(int id, string node_name ) { this.Id = id; this.NodeName = node_name; } public static Node DeserializeNode(ByteBuf _buf) { switch (_buf.ReadInt()) { case ai.UeSetDefaultFocus.ID: return new ai.UeSetDefaultFocus(_buf); case ai.ExecuteTimeStatistic.ID: return new ai.ExecuteTimeStatistic(_buf); case ai.ChooseTarget.ID: return new ai.ChooseTarget(_buf); case ai.KeepFaceTarget.ID: return new ai.KeepFaceTarget(_buf); case ai.GetOwnerPlayer.ID: return new ai.GetOwnerPlayer(_buf); case ai.UpdateDailyBehaviorProps.ID: return new ai.UpdateDailyBehaviorProps(_buf); case ai.UeLoop.ID: return new ai.UeLoop(_buf); case ai.UeCooldown.ID: return new ai.UeCooldown(_buf); case ai.UeTimeLimit.ID: return new ai.UeTimeLimit(_buf); case ai.UeBlackboard.ID: return new ai.UeBlackboard(_buf); case ai.UeForceSuccess.ID: return new ai.UeForceSuccess(_buf); case ai.IsAtLocation.ID: return new ai.IsAtLocation(_buf); case ai.DistanceLessThan.ID: return new ai.DistanceLessThan(_buf); case ai.Sequence.ID: return new ai.Sequence(_buf); case ai.Selector.ID: return new ai.Selector(_buf); case ai.SimpleParallel.ID: return new ai.SimpleParallel(_buf); case ai.UeWait.ID: return new ai.UeWait(_buf); case ai.UeWaitBlackboardTime.ID: return new ai.UeWaitBlackboardTime(_buf); case ai.MoveToTarget.ID: return new ai.MoveToTarget(_buf); case ai.ChooseSkill.ID: return new ai.ChooseSkill(_buf); case ai.MoveToRandomLocation.ID: return new ai.MoveToRandomLocation(_buf); case ai.MoveToLocation.ID: return new ai.MoveToLocation(_buf); case ai.DebugPrint.ID: return new ai.DebugPrint(_buf); default: throw new SerializationException(); } } public readonly int Id; public readonly string NodeName; public virtual void Resolve(Dictionary<string, object> _tables) { OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); public override string ToString() { return "{ " + "Id:" + Id + "," + "NodeName:" + NodeName + "," + "}"; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_GraphicsBuffer_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_GraphicsBuffer_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = (UnityEngine.GraphicsBuffer.Target)argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var result = new UnityEngine.GraphicsBuffer(Arg0,Arg1,Arg2); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.GraphicsBuffer), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Dispose(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GraphicsBuffer; { { obj.Dispose(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Release(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GraphicsBuffer; { { obj.Release(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_IsValid(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GraphicsBuffer; { { var result = obj.IsValid(); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetData(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GraphicsBuffer; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Array), false, false)) { var Arg0 = argHelper0.Get<System.Array>(false); obj.SetData(Arg0); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Array), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<System.Array>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetInt32(false); obj.SetData(Arg0,Arg1,Arg2,Arg3); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SetData"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetData(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GraphicsBuffer; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Array), false, false)) { var Arg0 = argHelper0.Get<System.Array>(false); obj.GetData(Arg0); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Array), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<System.Array>(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetInt32(false); obj.GetData(Arg0,Arg1,Arg2,Arg3); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetData"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetNativeBufferPtr(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GraphicsBuffer; { { var result = obj.GetNativeBufferPtr(); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetCounterValue(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GraphicsBuffer; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetUInt32(false); obj.SetCounterValue(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_CopyCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.ComputeBuffer), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.ComputeBuffer), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.ComputeBuffer>(false); var Arg1 = argHelper1.Get<UnityEngine.ComputeBuffer>(false); var Arg2 = argHelper2.GetInt32(false); UnityEngine.GraphicsBuffer.CopyCount(Arg0,Arg1,Arg2); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GraphicsBuffer), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.ComputeBuffer), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.GraphicsBuffer>(false); var Arg1 = argHelper1.Get<UnityEngine.ComputeBuffer>(false); var Arg2 = argHelper2.GetInt32(false); UnityEngine.GraphicsBuffer.CopyCount(Arg0,Arg1,Arg2); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.ComputeBuffer), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GraphicsBuffer), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.ComputeBuffer>(false); var Arg1 = argHelper1.Get<UnityEngine.GraphicsBuffer>(false); var Arg2 = argHelper2.GetInt32(false); UnityEngine.GraphicsBuffer.CopyCount(Arg0,Arg1,Arg2); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GraphicsBuffer), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GraphicsBuffer), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.GraphicsBuffer>(false); var Arg1 = argHelper1.Get<UnityEngine.GraphicsBuffer>(false); var Arg2 = argHelper2.GetInt32(false); UnityEngine.GraphicsBuffer.CopyCount(Arg0,Arg1,Arg2); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to CopyCount"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_count(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GraphicsBuffer; var result = obj.count; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_stride(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GraphicsBuffer; var result = obj.stride; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "Dispose", IsStatic = false}, M_Dispose }, { new Puerts.MethodKey {Name = "Release", IsStatic = false}, M_Release }, { new Puerts.MethodKey {Name = "IsValid", IsStatic = false}, M_IsValid }, { new Puerts.MethodKey {Name = "SetData", IsStatic = false}, M_SetData }, { new Puerts.MethodKey {Name = "GetData", IsStatic = false}, M_GetData }, { new Puerts.MethodKey {Name = "GetNativeBufferPtr", IsStatic = false}, M_GetNativeBufferPtr }, { new Puerts.MethodKey {Name = "SetCounterValue", IsStatic = false}, M_SetCounterValue }, { new Puerts.MethodKey {Name = "CopyCount", IsStatic = true}, F_CopyCount }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"count", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_count, Setter = null} }, {"stride", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_stride, Setter = null} }, } }; } } } <|start_filename|>Projects/GenerateDatas/convert_lua/role.TbRoleLevelExpAttr/13.lua<|end_filename|> return { level = 13, need_exp = 2500, clothes_attrs = { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, }, } <|start_filename|>Projects/GenerateDatas/convert_lua/role.TbRoleLevelExpAttr/45.lua<|end_filename|> return { level = 45, need_exp = 50000, clothes_attrs = { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, }, } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_GUIStyleState_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_GUIStyleState_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.GUIStyleState(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.GUIStyleState), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_background(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUIStyleState; var result = obj.background; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_background(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUIStyleState; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.background = argHelper.Get<UnityEngine.Texture2D>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_textColor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUIStyleState; var result = obj.textColor; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_textColor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUIStyleState; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.textColor = argHelper.Get<UnityEngine.Color>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"background", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_background, Setter = S_background} }, {"textColor", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_textColor, Setter = S_textColor} }, } }; } } } <|start_filename|>Projects/Lua_Unity_xlua_lua/Assets/Lua/Data/test_tbcompositejsontable2.lua<|end_filename|> return { [1] = {id=1,y=100,}, [3] = {id=3,y=300,}, } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_AnimatorOverrideController_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_AnimatorOverrideController_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { if (paramLen == 0) { { var result = new UnityEngine.AnimatorOverrideController(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.AnimatorOverrideController), result); } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RuntimeAnimatorController), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.RuntimeAnimatorController>(false); var result = new UnityEngine.AnimatorOverrideController(Arg0); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.AnimatorOverrideController), result); } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.AnimatorOverrideController constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetOverrides(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnimatorOverrideController; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.Collections.Generic.List<System.Collections.Generic.KeyValuePair<UnityEngine.AnimationClip, UnityEngine.AnimationClip>>>(false); obj.GetOverrides(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ApplyOverrides(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnimatorOverrideController; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.Collections.Generic.IList<System.Collections.Generic.KeyValuePair<UnityEngine.AnimationClip, UnityEngine.AnimationClip>>>(false); obj.ApplyOverrides(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_runtimeAnimatorController(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnimatorOverrideController; var result = obj.runtimeAnimatorController; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_runtimeAnimatorController(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnimatorOverrideController; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.runtimeAnimatorController = argHelper.Get<UnityEngine.RuntimeAnimatorController>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_overridesCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnimatorOverrideController; var result = obj.overridesCount; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void GetItem(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnimatorOverrideController; var keyHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (keyHelper.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var key = keyHelper.GetString(false); var result = obj[key]; Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } if (keyHelper.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.AnimationClip), false, false)) { var key = keyHelper.Get<UnityEngine.AnimationClip>(false); var result = obj[key]; Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void SetItem(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AnimatorOverrideController; var keyHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var valueHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (keyHelper.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var key = keyHelper.GetString(false); obj[key] = valueHelper.Get<UnityEngine.AnimationClip>(false); return; } if (keyHelper.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.AnimationClip), false, false)) { var key = keyHelper.Get<UnityEngine.AnimationClip>(false); obj[key] = valueHelper.Get<UnityEngine.AnimationClip>(false); return; } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "GetOverrides", IsStatic = false}, M_GetOverrides }, { new Puerts.MethodKey {Name = "ApplyOverrides", IsStatic = false}, M_ApplyOverrides }, { new Puerts.MethodKey {Name = "get_Item", IsStatic = false}, GetItem }, { new Puerts.MethodKey {Name = "set_Item", IsStatic = false}, SetItem}, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"runtimeAnimatorController", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_runtimeAnimatorController, Setter = S_runtimeAnimatorController} }, {"overridesCount", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_overridesCount, Setter = null} }, } }; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_ParticleSystem_ColorOverLifetimeModule_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_ParticleSystem_ColorOverLifetimeModule_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.ParticleSystem.ColorOverLifetimeModule constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_enabled(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ColorOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.enabled; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_enabled(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ColorOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.enabled = argHelper.GetBoolean(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_color(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ColorOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.color; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_color(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.ColorOverLifetimeModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.color = argHelper.Get<UnityEngine.ParticleSystem.MinMaxGradient>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"enabled", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_enabled, Setter = S_enabled} }, {"color", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_color, Setter = S_color} }, } }; } } } <|start_filename|>Projects/DataTemplates/template_erlang2/test_tbtestnull.erl<|end_filename|> %% test.TbTestNull -module(test_tbtestnull) -export([get/1,get_ids/0]) get(10) -> #{ id => 10, x1 => null, x2 => null, x3 => null, x4 => null, s1 => null, s2 => null }. get(11) -> #{ id => 11, x1 => null, x2 => null, x3 => null, x4 => null, s1 => null, s2 => null }. get(12) -> #{ id => 12, x1 => 1, x2 => 1, x3 => bean, x4 => bean, s1 => "asf", s2 => abcdef }. get(20) -> #{ id => 20, x1 => null, x2 => null, x3 => null, x4 => null, s1 => null, s2 => null }. get(21) -> #{ id => 21, x1 => null, x2 => null, x3 => null, x4 => null, s1 => null, s2 => null }. get(22) -> #{ id => 22, x1 => 1, x2 => 2, x3 => bean, x4 => bean, s1 => "asfs", s2 => abcdef }. get(30) -> #{ id => 30, x1 => 1, x2 => 1, x3 => bean, x4 => bean, s1 => "abcd", s2 => hahaha }. get(31) -> #{ id => 31, x1 => null, x2 => null, x3 => null, x4 => null, s1 => null, s2 => null }. get(1) -> #{ id => 1, x1 => null, x2 => null, x3 => null, x4 => null, s1 => null, s2 => null }. get(2) -> #{ id => 2, x1 => 1, x2 => 1, x3 => bean, x4 => bean, s1 => "asfasfasf", s2 => asf }. get(3) -> #{ id => 3, x1 => null, x2 => null, x3 => null, x4 => null, s1 => "", s2 => }. get_ids() -> [10,11,12,20,21,22,30,31,1,2,3]. <|start_filename|>Projects/GenerateDatas/convert_lua/item.TbItemExtra/1110020080.lua<|end_filename|> return { _name = 'DesignDrawing', id = 1110020080, learn_component_id = { 1021009132, }, } <|start_filename|>Projects/Java_bin/src/main/gen/cfg/blueprint/NormalClazz.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.blueprint; import bright.serialization.*; public final class NormalClazz extends cfg.blueprint.Clazz { public NormalClazz(ByteBuf _buf) { super(_buf); isAbstract = _buf.readBool(); {int n = Math.min(_buf.readSize(), _buf.size());fields = new java.util.ArrayList<cfg.blueprint.Field>(n);for(int i = 0 ; i < n ; i++) { cfg.blueprint.Field _e; _e = new cfg.blueprint.Field(_buf); fields.add(_e);}} } public NormalClazz(String name, String desc, java.util.ArrayList<cfg.blueprint.Clazz> parents, java.util.ArrayList<cfg.blueprint.Method> methods, boolean is_abstract, java.util.ArrayList<cfg.blueprint.Field> fields ) { super(name, desc, parents, methods); this.isAbstract = is_abstract; this.fields = fields; } public final boolean isAbstract; public final java.util.ArrayList<cfg.blueprint.Field> fields; public static final int __ID__ = -2073576778; @Override public int getTypeId() { return __ID__; } @Override public void resolve(java.util.HashMap<String, Object> _tables) { super.resolve(_tables); for(cfg.blueprint.Field _e : fields) { if (_e != null) _e.resolve(_tables); } } @Override public String toString() { return "{ " + "name:" + name + "," + "desc:" + desc + "," + "parents:" + parents + "," + "methods:" + methods + "," + "isAbstract:" + isAbstract + "," + "fields:" + fields + "," + "}"; } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_Rigidbody_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_Rigidbody_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.Rigidbody(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.Rigidbody), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetDensity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetFloat(false); obj.SetDensity(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_MovePosition(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); obj.MovePosition(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_MoveRotation(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Quaternion>(false); obj.MoveRotation(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Sleep(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody; { { obj.Sleep(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_IsSleeping(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody; { { var result = obj.IsSleeping(); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_WakeUp(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody; { { obj.WakeUp(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ResetCenterOfMass(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody; { { obj.ResetCenterOfMass(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ResetInertiaTensor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody; { { obj.ResetInertiaTensor(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetRelativePointVelocity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var result = obj.GetRelativePointVelocity(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetPointVelocity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var result = obj.GetPointVelocity(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_AddForce(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody; if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = (UnityEngine.ForceMode)argHelper1.GetInt32(false); obj.AddForce(Arg0,Arg1); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); obj.AddForce(Arg0); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = (UnityEngine.ForceMode)argHelper3.GetInt32(false); obj.AddForce(Arg0,Arg1,Arg2,Arg3); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.GetFloat(false); obj.AddForce(Arg0,Arg1,Arg2); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to AddForce"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_AddRelativeForce(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody; if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = (UnityEngine.ForceMode)argHelper1.GetInt32(false); obj.AddRelativeForce(Arg0,Arg1); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); obj.AddRelativeForce(Arg0); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = (UnityEngine.ForceMode)argHelper3.GetInt32(false); obj.AddRelativeForce(Arg0,Arg1,Arg2,Arg3); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.GetFloat(false); obj.AddRelativeForce(Arg0,Arg1,Arg2); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to AddRelativeForce"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_AddTorque(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody; if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = (UnityEngine.ForceMode)argHelper1.GetInt32(false); obj.AddTorque(Arg0,Arg1); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); obj.AddTorque(Arg0); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = (UnityEngine.ForceMode)argHelper3.GetInt32(false); obj.AddTorque(Arg0,Arg1,Arg2,Arg3); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.GetFloat(false); obj.AddTorque(Arg0,Arg1,Arg2); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to AddTorque"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_AddRelativeTorque(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody; if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = (UnityEngine.ForceMode)argHelper1.GetInt32(false); obj.AddRelativeTorque(Arg0,Arg1); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); obj.AddRelativeTorque(Arg0); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = (UnityEngine.ForceMode)argHelper3.GetInt32(false); obj.AddRelativeTorque(Arg0,Arg1,Arg2,Arg3); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.GetFloat(false); obj.AddRelativeTorque(Arg0,Arg1,Arg2); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to AddRelativeTorque"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_AddForceAtPosition(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody; if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3>(false); var Arg2 = (UnityEngine.ForceMode)argHelper2.GetInt32(false); obj.AddForceAtPosition(Arg0,Arg1,Arg2); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3>(false); obj.AddForceAtPosition(Arg0,Arg1); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to AddForceAtPosition"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_AddExplosionForce(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody; if (paramLen == 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3>(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.GetFloat(false); var Arg4 = (UnityEngine.ForceMode)argHelper4.GetInt32(false); obj.AddExplosionForce(Arg0,Arg1,Arg2,Arg3,Arg4); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3>(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.GetFloat(false); obj.AddExplosionForce(Arg0,Arg1,Arg2,Arg3); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3>(false); var Arg2 = argHelper2.GetFloat(false); obj.AddExplosionForce(Arg0,Arg1,Arg2); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to AddExplosionForce"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ClosestPointOnBounds(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var result = obj.ClosestPointOnBounds(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SweepTest(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody; if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit), true, true) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = argHelper1.Get<UnityEngine.RaycastHit>(true); var Arg2 = argHelper2.GetFloat(false); var Arg3 = (UnityEngine.QueryTriggerInteraction)argHelper3.GetInt32(false); var result = obj.SweepTest(Arg0,out Arg1,Arg2,Arg3); argHelper1.SetByRefValue(Arg1); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit), true, true) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = argHelper1.Get<UnityEngine.RaycastHit>(true); var Arg2 = argHelper2.GetFloat(false); var result = obj.SweepTest(Arg0,out Arg1,Arg2); argHelper1.SetByRefValue(Arg1); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.RaycastHit), true, true)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = argHelper1.Get<UnityEngine.RaycastHit>(true); var result = obj.SweepTest(Arg0,out Arg1); argHelper1.SetByRefValue(Arg1); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SweepTest"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SweepTestAll(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody; if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = (UnityEngine.QueryTriggerInteraction)argHelper2.GetInt32(false); var result = obj.SweepTestAll(Arg0,Arg1,Arg2); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = argHelper1.GetFloat(false); var result = obj.SweepTestAll(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var result = obj.SweepTestAll(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SweepTestAll"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_velocity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody; var result = obj.velocity; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_velocity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.velocity = argHelper.Get<UnityEngine.Vector3>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_angularVelocity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody; var result = obj.angularVelocity; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_angularVelocity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.angularVelocity = argHelper.Get<UnityEngine.Vector3>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_drag(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody; var result = obj.drag; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_drag(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.drag = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_angularDrag(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody; var result = obj.angularDrag; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_angularDrag(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.angularDrag = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_mass(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody; var result = obj.mass; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_mass(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.mass = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_useGravity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody; var result = obj.useGravity; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_useGravity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.useGravity = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_maxDepenetrationVelocity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody; var result = obj.maxDepenetrationVelocity; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_maxDepenetrationVelocity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.maxDepenetrationVelocity = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_isKinematic(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody; var result = obj.isKinematic; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_isKinematic(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.isKinematic = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_freezeRotation(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody; var result = obj.freezeRotation; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_freezeRotation(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.freezeRotation = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_constraints(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody; var result = obj.constraints; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_constraints(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.constraints = (UnityEngine.RigidbodyConstraints)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_collisionDetectionMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody; var result = obj.collisionDetectionMode; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_collisionDetectionMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.collisionDetectionMode = (UnityEngine.CollisionDetectionMode)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_centerOfMass(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody; var result = obj.centerOfMass; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_centerOfMass(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.centerOfMass = argHelper.Get<UnityEngine.Vector3>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_worldCenterOfMass(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody; var result = obj.worldCenterOfMass; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_inertiaTensorRotation(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody; var result = obj.inertiaTensorRotation; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_inertiaTensorRotation(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.inertiaTensorRotation = argHelper.Get<UnityEngine.Quaternion>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_inertiaTensor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody; var result = obj.inertiaTensor; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_inertiaTensor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.inertiaTensor = argHelper.Get<UnityEngine.Vector3>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_detectCollisions(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody; var result = obj.detectCollisions; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_detectCollisions(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.detectCollisions = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_position(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody; var result = obj.position; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_position(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.position = argHelper.Get<UnityEngine.Vector3>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_rotation(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody; var result = obj.rotation; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_rotation(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.rotation = argHelper.Get<UnityEngine.Quaternion>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_interpolation(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody; var result = obj.interpolation; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_interpolation(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.interpolation = (UnityEngine.RigidbodyInterpolation)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_solverIterations(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody; var result = obj.solverIterations; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_solverIterations(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.solverIterations = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_sleepThreshold(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody; var result = obj.sleepThreshold; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_sleepThreshold(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.sleepThreshold = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_maxAngularVelocity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody; var result = obj.maxAngularVelocity; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_maxAngularVelocity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.maxAngularVelocity = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_solverVelocityIterations(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody; var result = obj.solverVelocityIterations; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_solverVelocityIterations(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Rigidbody; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.solverVelocityIterations = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "SetDensity", IsStatic = false}, M_SetDensity }, { new Puerts.MethodKey {Name = "MovePosition", IsStatic = false}, M_MovePosition }, { new Puerts.MethodKey {Name = "MoveRotation", IsStatic = false}, M_MoveRotation }, { new Puerts.MethodKey {Name = "Sleep", IsStatic = false}, M_Sleep }, { new Puerts.MethodKey {Name = "IsSleeping", IsStatic = false}, M_IsSleeping }, { new Puerts.MethodKey {Name = "WakeUp", IsStatic = false}, M_WakeUp }, { new Puerts.MethodKey {Name = "ResetCenterOfMass", IsStatic = false}, M_ResetCenterOfMass }, { new Puerts.MethodKey {Name = "ResetInertiaTensor", IsStatic = false}, M_ResetInertiaTensor }, { new Puerts.MethodKey {Name = "GetRelativePointVelocity", IsStatic = false}, M_GetRelativePointVelocity }, { new Puerts.MethodKey {Name = "GetPointVelocity", IsStatic = false}, M_GetPointVelocity }, { new Puerts.MethodKey {Name = "AddForce", IsStatic = false}, M_AddForce }, { new Puerts.MethodKey {Name = "AddRelativeForce", IsStatic = false}, M_AddRelativeForce }, { new Puerts.MethodKey {Name = "AddTorque", IsStatic = false}, M_AddTorque }, { new Puerts.MethodKey {Name = "AddRelativeTorque", IsStatic = false}, M_AddRelativeTorque }, { new Puerts.MethodKey {Name = "AddForceAtPosition", IsStatic = false}, M_AddForceAtPosition }, { new Puerts.MethodKey {Name = "AddExplosionForce", IsStatic = false}, M_AddExplosionForce }, { new Puerts.MethodKey {Name = "ClosestPointOnBounds", IsStatic = false}, M_ClosestPointOnBounds }, { new Puerts.MethodKey {Name = "SweepTest", IsStatic = false}, M_SweepTest }, { new Puerts.MethodKey {Name = "SweepTestAll", IsStatic = false}, M_SweepTestAll }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"velocity", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_velocity, Setter = S_velocity} }, {"angularVelocity", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_angularVelocity, Setter = S_angularVelocity} }, {"drag", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_drag, Setter = S_drag} }, {"angularDrag", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_angularDrag, Setter = S_angularDrag} }, {"mass", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_mass, Setter = S_mass} }, {"useGravity", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_useGravity, Setter = S_useGravity} }, {"maxDepenetrationVelocity", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_maxDepenetrationVelocity, Setter = S_maxDepenetrationVelocity} }, {"isKinematic", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_isKinematic, Setter = S_isKinematic} }, {"freezeRotation", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_freezeRotation, Setter = S_freezeRotation} }, {"constraints", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_constraints, Setter = S_constraints} }, {"collisionDetectionMode", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_collisionDetectionMode, Setter = S_collisionDetectionMode} }, {"centerOfMass", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_centerOfMass, Setter = S_centerOfMass} }, {"worldCenterOfMass", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_worldCenterOfMass, Setter = null} }, {"inertiaTensorRotation", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_inertiaTensorRotation, Setter = S_inertiaTensorRotation} }, {"inertiaTensor", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_inertiaTensor, Setter = S_inertiaTensor} }, {"detectCollisions", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_detectCollisions, Setter = S_detectCollisions} }, {"position", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_position, Setter = S_position} }, {"rotation", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_rotation, Setter = S_rotation} }, {"interpolation", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_interpolation, Setter = S_interpolation} }, {"solverIterations", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_solverIterations, Setter = S_solverIterations} }, {"sleepThreshold", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_sleepThreshold, Setter = S_sleepThreshold} }, {"maxAngularVelocity", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_maxAngularVelocity, Setter = S_maxAngularVelocity} }, {"solverVelocityIterations", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_solverVelocityIterations, Setter = S_solverVelocityIterations} }, } }; } } } <|start_filename|>Projects/GenerateDatas/convert_lua/mail.TbSystemMail/15.lua<|end_filename|> return { id = 15, title = "测试5", sender = "系统", content = "测试内容5", award = { 1, }, } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_AudioSettings_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_AudioSettings_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.AudioSettings(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.AudioSettings), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetDSPBufferSize(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.GetInt32(true); var Arg1 = argHelper1.GetInt32(true); UnityEngine.AudioSettings.GetDSPBufferSize(out Arg0,out Arg1); argHelper0.SetByRefValue(Arg0); argHelper1.SetByRefValue(Arg1); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetSpatializerPluginName(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { { var result = UnityEngine.AudioSettings.GetSpatializerPluginName(); Puerts.PuertsDLL.ReturnString(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetConfiguration(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { { var result = UnityEngine.AudioSettings.GetConfiguration(); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_Reset(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.AudioConfiguration>(false); var result = UnityEngine.AudioSettings.Reset(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_driverCapabilities(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.AudioSettings.driverCapabilities; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_speakerMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.AudioSettings.speakerMode; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_speakerMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.AudioSettings.speakerMode = (UnityEngine.AudioSpeakerMode)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_dspTime(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.AudioSettings.dspTime; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_outputSampleRate(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.AudioSettings.outputSampleRate; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_outputSampleRate(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.AudioSettings.outputSampleRate = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void A_OnAudioConfigurationChanged(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.AudioSettings.OnAudioConfigurationChanged += argHelper.Get<UnityEngine.AudioSettings.AudioConfigurationChangeHandler>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void R_OnAudioConfigurationChanged(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.AudioSettings.OnAudioConfigurationChanged -= argHelper.Get<UnityEngine.AudioSettings.AudioConfigurationChangeHandler>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "GetDSPBufferSize", IsStatic = true}, F_GetDSPBufferSize }, { new Puerts.MethodKey {Name = "GetSpatializerPluginName", IsStatic = true}, F_GetSpatializerPluginName }, { new Puerts.MethodKey {Name = "GetConfiguration", IsStatic = true}, F_GetConfiguration }, { new Puerts.MethodKey {Name = "Reset", IsStatic = true}, F_Reset }, { new Puerts.MethodKey {Name = "add_OnAudioConfigurationChanged", IsStatic = true}, A_OnAudioConfigurationChanged}, { new Puerts.MethodKey {Name = "remove_OnAudioConfigurationChanged", IsStatic = true}, R_OnAudioConfigurationChanged}, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"driverCapabilities", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_driverCapabilities, Setter = null} }, {"speakerMode", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_speakerMode, Setter = S_speakerMode} }, {"dspTime", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_dspTime, Setter = null} }, {"outputSampleRate", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_outputSampleRate, Setter = S_outputSampleRate} }, } }; } } } <|start_filename|>Projects/Lua_Unity_xlua_lua/Assets/Lua/Gen/TbTestTag.lua<|end_filename|> return { [2001] = {id=2001,value='导出',}, [2004] = {id=2004,value='导出',}, [2003] = {id=2003,value='导出',}, [100] = {id=100,value='导出',}, [1] = {id=1,value='导出',}, [2] = {id=2,value='导出',}, [9] = {id=9,value='测试',}, [10] = {id=10,value='测试',}, [11] = {id=11,value='测试',}, [12] = {id=12,value='导出',}, [13] = {id=13,value='导出',}, [104] = {id=104,value='导出',}, [102] = {id=102,value='测试',}, [3001] = {id=3001,value='export',}, [3004] = {id=3004,value='其他',}, [3003] = {id=3003,value='测试',}, } <|start_filename|>Projects/GenerateDatas/convert_lua/error.TbCodeInfo/9.lua<|end_filename|> return { code = 9, key = "EXAMPLE_DLG_OK_CANCEL", } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_ParticleSystem_Burst_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_ParticleSystem_Burst_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.GetInt16(false); var result = new UnityEngine.ParticleSystem.Burst(Arg0,Arg1); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.ParticleSystem.Burst), result); } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ParticleSystem.MinMaxCurve), false, false)) { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.Get<UnityEngine.ParticleSystem.MinMaxCurve>(false); var result = new UnityEngine.ParticleSystem.Burst(Arg0,Arg1); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.ParticleSystem.Burst), result); } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.GetInt16(false); var Arg2 = argHelper2.GetInt16(false); var result = new UnityEngine.ParticleSystem.Burst(Arg0,Arg1,Arg2); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.ParticleSystem.Burst), result); } } if (paramLen == 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.GetInt16(false); var Arg2 = argHelper2.GetInt16(false); var Arg3 = argHelper3.GetInt32(false); var Arg4 = argHelper4.GetFloat(false); var result = new UnityEngine.ParticleSystem.Burst(Arg0,Arg1,Arg2,Arg3,Arg4); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.ParticleSystem.Burst), result); } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.ParticleSystem.MinMaxCurve), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.Get<UnityEngine.ParticleSystem.MinMaxCurve>(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetFloat(false); var result = new UnityEngine.ParticleSystem.Burst(Arg0,Arg1,Arg2,Arg3); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.ParticleSystem.Burst), result); } } if (paramLen == 0) { { var result = new UnityEngine.ParticleSystem.Burst(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.ParticleSystem.Burst), result); } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.ParticleSystem.Burst constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_time(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.Burst)Puerts.Utils.GetSelf((int)data, self); var result = obj.time; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_time(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.Burst)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.time = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_count(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.Burst)Puerts.Utils.GetSelf((int)data, self); var result = obj.count; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_count(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.Burst)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.count = argHelper.Get<UnityEngine.ParticleSystem.MinMaxCurve>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_minCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.Burst)Puerts.Utils.GetSelf((int)data, self); var result = obj.minCount; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_minCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.Burst)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.minCount = argHelper.GetInt16(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_maxCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.Burst)Puerts.Utils.GetSelf((int)data, self); var result = obj.maxCount; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_maxCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.Burst)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.maxCount = argHelper.GetInt16(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_cycleCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.Burst)Puerts.Utils.GetSelf((int)data, self); var result = obj.cycleCount; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_cycleCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.Burst)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.cycleCount = argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_repeatInterval(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.Burst)Puerts.Utils.GetSelf((int)data, self); var result = obj.repeatInterval; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_repeatInterval(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.Burst)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.repeatInterval = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_probability(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.Burst)Puerts.Utils.GetSelf((int)data, self); var result = obj.probability; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_probability(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.Burst)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.probability = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"time", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_time, Setter = S_time} }, {"count", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_count, Setter = S_count} }, {"minCount", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_minCount, Setter = S_minCount} }, {"maxCount", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_maxCount, Setter = S_maxCount} }, {"cycleCount", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_cycleCount, Setter = S_cycleCount} }, {"repeatInterval", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_repeatInterval, Setter = S_repeatInterval} }, {"probability", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_probability, Setter = S_probability} }, } }; } } } <|start_filename|>Projects/GenerateDatas/convert_lua/role.TbRoleLevelExpAttr/57.lua<|end_filename|> return { level = 57, need_exp = 110000, clothes_attrs = { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, }, } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Js/JsLoader.cs<|end_filename|> using Puerts; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; using UnityEngine; class JsLoader : ILoader { private readonly string _root; public JsLoader(string root) { _root = root; } public bool FileExists(string filepath) { if (filepath.StartsWith("puerts/")) { return UnityEngine.Resources.Load<TextAsset>(filepath) != null; } else { return File.Exists(Path.Combine(_root, filepath)); } } public string ReadFile(string filepath, out string debugpath) { if (filepath.StartsWith("puerts/")) { debugpath = filepath; return UnityEngine.Resources.Load<TextAsset>(filepath).text; } else { var fullPath = Path.Combine(_root, filepath); debugpath = fullPath; return File.ReadAllText(fullPath, System.Text.Encoding.UTF8); } } } <|start_filename|>Projects/Csharp_DotNet5_json_ExportServer/Gen/item/Dymmy.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; using System.Text.Json; namespace cfg.item { public sealed class Dymmy : item.ItemExtra { public Dymmy(JsonElement _json) : base(_json) { Cost = cost.Cost.DeserializeCost(_json.GetProperty("cost")); } public Dymmy(int id, cost.Cost cost ) : base(id) { this.Cost = cost; } public static Dymmy DeserializeDymmy(JsonElement _json) { return new item.Dymmy(_json); } public cost.Cost Cost { get; private set; } public const int __ID__ = 896889705; public override int GetTypeId() => __ID__; public override void Resolve(Dictionary<string, object> _tables) { base.Resolve(_tables); Cost?.Resolve(_tables); } public override void TranslateText(System.Func<string, string, string> translator) { base.TranslateText(translator); Cost?.TranslateText(translator); } public override string ToString() { return "{ " + "Id:" + Id + "," + "Cost:" + Cost + "," + "}"; } } } <|start_filename|>Projects/GenerateDatas/convert_lua/test.TbDemoPrimitive/6.lua<|end_filename|> return { x1 = true, x2 = 1, x3 = 2, x4 = 6, x5 = 4, x6 = 5, x7 = 6, s1 = "shijie", s2 = {key='/test/key4',text="测试本地化字符串4"}, v2 = {x=6,y=7}, v3 = {x=2.2,y=2.3,z=3.6}, v4 = {x=4.5,y=5.6,z=6.9,w=123}, t1 = 2000-1-5 00:04:59, } <|start_filename|>Projects/GenerateDatas/convert_lua/item.TbItemExtra/1110020003.lua<|end_filename|> return { _name = 'DesignDrawing', id = 1110020003, learn_component_id = { 1020409017, }, } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_CachedAssetBundle_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_CachedAssetBundle_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Hash128), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<UnityEngine.Hash128>(false); var result = new UnityEngine.CachedAssetBundle(Arg0,Arg1); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.CachedAssetBundle), result); } } if (paramLen == 0) { { var result = new UnityEngine.CachedAssetBundle(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.CachedAssetBundle), result); } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.CachedAssetBundle constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_name(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.CachedAssetBundle)Puerts.Utils.GetSelf((int)data, self); var result = obj.name; Puerts.PuertsDLL.ReturnString(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_name(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.CachedAssetBundle)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.name = argHelper.GetString(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_hash(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.CachedAssetBundle)Puerts.Utils.GetSelf((int)data, self); var result = obj.hash; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_hash(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.CachedAssetBundle)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.hash = argHelper.Get<UnityEngine.Hash128>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"name", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_name, Setter = S_name} }, {"hash", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_hash, Setter = S_hash} }, } }; } } } <|start_filename|>ProtoProjects/Csharp_Unity/Assets/Gen/test/Child31.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; namespace proto.test { public sealed class Child31 : test.Child21 { public Child31() { } public Child31(Bright.Common.NotNullInitialization _) : base(_) { } public static void SerializeChild31(ByteBuf _buf, Child31 x) { x.Serialize(_buf); } public static Child31 DeserializeChild31(ByteBuf _buf) { var x = new test.Child31(); x.Deserialize(_buf); return x; } public int A31; public int A32; public const int __ID__ = 10; public override int GetTypeId() => __ID__; public override void Serialize(ByteBuf _buf) { _buf.WriteInt(A1); _buf.WriteInt(A24); _buf.WriteInt(A31); _buf.WriteInt(A32); } public override void Deserialize(ByteBuf _buf) { A1 = _buf.ReadInt(); A24 = _buf.ReadInt(); A31 = _buf.ReadInt(); A32 = _buf.ReadInt(); } public override string ToString() { return "test.Child31{ " + "A1:" + A1 + "," + "A24:" + A24 + "," + "A31:" + A31 + "," + "A32:" + A32 + "," + "}"; } } } <|start_filename|>Projects/Csharp_CustomTemplate_EncryptMemory/Gen/test/DefineFromExcelOne.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using System; using Newtonsoft.Json; using Scripts; namespace cfg.test { [Serializable] public partial class DefineFromExcelOne : AConfig { /// <summary> /// 装备解锁等级 /// </summary> [JsonProperty("unlock_equip")] private int _unlock_equip { get; set; } [JsonIgnore] public EncryptInt unlock_equip { get; private set; } = new(); /// <summary> /// 英雄解锁等级 /// </summary> [JsonProperty("unlock_hero")] private int _unlock_hero { get; set; } [JsonIgnore] public EncryptInt unlock_hero { get; private set; } = new(); public string default_avatar { get; set; } public string default_item { get; set; } public override void EndInit() { unlock_equip = _unlock_equip; unlock_hero = _unlock_hero; } public override string ToString() => JsonConvert.SerializeObject(this); } } <|start_filename|>Projects/DataTemplates/template_erlang2/item_tbitemfunc.erl<|end_filename|> %% item.TbItemFunc -module(item_tbitemfunc) -export([get/1,get_ids/0]) get(401) -> #{ minor_type => 401, func_type => 0, method => "使用", close_bag_ui => true }. get(1102) -> #{ minor_type => 1102, func_type => 1, method => "使用", close_bag_ui => false }. get_ids() -> [401,1102]. <|start_filename|>Projects/DataTemplates/template_erlang/test_tbmultirowtitle.erl<|end_filename|> %% test.TbMultiRowTitle get(1) -> #{id => 1,name => "xxx",x1 => #{y2 => #{z2 => 2,z3 => 3},y3 => 4},x2 => [#{z2 => 1,z3 => 2},#{z2 => 3,z3 => 4}],x3 => [#{z2 => 1,z3 => 2},#{z2 => 3,z3 => 4}],x4 => [#{z2 => 12,z3 => 13},#{z2 => 22,z3 => 23},#{z2 => 32,z3 => 33}]}. get(11) -> #{id => 11,name => "yyy",x1 => #{y2 => #{z2 => 12,z3 => 13},y3 => 14},x2_0 => #{z2 => 1,z3 => 2},x2 => [#{z2 => 11,z3 => 12},#{z2 => 13,z3 => 14}],x3 => [#{z2 => 11,z3 => 12},#{z2 => 13,z3 => 14}],x4 => [#{z2 => 112,z3 => 113},#{z2 => 122,z3 => 123},#{z2 => 132,z3 => 133}]}. <|start_filename|>Projects/GenerateDatas/convert_lua/error.TbCodeInfo/605.lua<|end_filename|> return { code = 605, key = "NO_INTERACTION_COMPONENT", } <|start_filename|>Projects/Java_bin/src/main/gen/cfg/test/DemoD2.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.test; import bright.serialization.*; public final class DemoD2 extends cfg.test.DemoDynamic { public DemoD2(ByteBuf _buf) { super(_buf); x2 = _buf.readInt(); } public DemoD2(int x1, int x2 ) { super(x1); this.x2 = x2; } public final int x2; public static final int __ID__ = -2138341747; @Override public int getTypeId() { return __ID__; } @Override public void resolve(java.util.HashMap<String, Object> _tables) { super.resolve(_tables); } @Override public String toString() { return "{ " + "x1:" + x1 + "," + "x2:" + x2 + "," + "}"; } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_ParticleSystem_SubEmittersModule_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_ParticleSystem_SubEmittersModule_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.ParticleSystem.SubEmittersModule constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_AddSubEmitter(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.SubEmittersModule)Puerts.Utils.GetSelf((int)data, self); if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.ParticleSystem), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.ParticleSystem>(false); var Arg1 = (UnityEngine.ParticleSystemSubEmitterType)argHelper1.GetInt32(false); var Arg2 = (UnityEngine.ParticleSystemSubEmitterProperties)argHelper2.GetInt32(false); var Arg3 = argHelper3.GetFloat(false); obj.AddSubEmitter(Arg0,Arg1,Arg2,Arg3); Puerts.Utils.SetSelf((int)data, self, obj); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.ParticleSystem), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.ParticleSystem>(false); var Arg1 = (UnityEngine.ParticleSystemSubEmitterType)argHelper1.GetInt32(false); var Arg2 = (UnityEngine.ParticleSystemSubEmitterProperties)argHelper2.GetInt32(false); obj.AddSubEmitter(Arg0,Arg1,Arg2); Puerts.Utils.SetSelf((int)data, self, obj); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to AddSubEmitter"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_RemoveSubEmitter(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.SubEmittersModule)Puerts.Utils.GetSelf((int)data, self); if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); obj.RemoveSubEmitter(Arg0); Puerts.Utils.SetSelf((int)data, self, obj); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.ParticleSystem), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.ParticleSystem>(false); obj.RemoveSubEmitter(Arg0); Puerts.Utils.SetSelf((int)data, self, obj); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to RemoveSubEmitter"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetSubEmitterSystem(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.SubEmittersModule)Puerts.Utils.GetSelf((int)data, self); { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.ParticleSystem>(false); obj.SetSubEmitterSystem(Arg0,Arg1); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetSubEmitterType(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.SubEmittersModule)Puerts.Utils.GetSelf((int)data, self); { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.GetInt32(false); var Arg1 = (UnityEngine.ParticleSystemSubEmitterType)argHelper1.GetInt32(false); obj.SetSubEmitterType(Arg0,Arg1); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetSubEmitterProperties(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.SubEmittersModule)Puerts.Utils.GetSelf((int)data, self); { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.GetInt32(false); var Arg1 = (UnityEngine.ParticleSystemSubEmitterProperties)argHelper1.GetInt32(false); obj.SetSubEmitterProperties(Arg0,Arg1); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetSubEmitterEmitProbability(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.SubEmittersModule)Puerts.Utils.GetSelf((int)data, self); { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetFloat(false); obj.SetSubEmitterEmitProbability(Arg0,Arg1); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetSubEmitterSystem(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.SubEmittersModule)Puerts.Utils.GetSelf((int)data, self); { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); var result = obj.GetSubEmitterSystem(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetSubEmitterType(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.SubEmittersModule)Puerts.Utils.GetSelf((int)data, self); { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); var result = obj.GetSubEmitterType(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetSubEmitterProperties(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.SubEmittersModule)Puerts.Utils.GetSelf((int)data, self); { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); var result = obj.GetSubEmitterProperties(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetSubEmitterEmitProbability(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.SubEmittersModule)Puerts.Utils.GetSelf((int)data, self); { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); var result = obj.GetSubEmitterEmitProbability(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_enabled(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.SubEmittersModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.enabled; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_enabled(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.SubEmittersModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.enabled = argHelper.GetBoolean(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_subEmittersCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.SubEmittersModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.subEmittersCount; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "AddSubEmitter", IsStatic = false}, M_AddSubEmitter }, { new Puerts.MethodKey {Name = "RemoveSubEmitter", IsStatic = false}, M_RemoveSubEmitter }, { new Puerts.MethodKey {Name = "SetSubEmitterSystem", IsStatic = false}, M_SetSubEmitterSystem }, { new Puerts.MethodKey {Name = "SetSubEmitterType", IsStatic = false}, M_SetSubEmitterType }, { new Puerts.MethodKey {Name = "SetSubEmitterProperties", IsStatic = false}, M_SetSubEmitterProperties }, { new Puerts.MethodKey {Name = "SetSubEmitterEmitProbability", IsStatic = false}, M_SetSubEmitterEmitProbability }, { new Puerts.MethodKey {Name = "GetSubEmitterSystem", IsStatic = false}, M_GetSubEmitterSystem }, { new Puerts.MethodKey {Name = "GetSubEmitterType", IsStatic = false}, M_GetSubEmitterType }, { new Puerts.MethodKey {Name = "GetSubEmitterProperties", IsStatic = false}, M_GetSubEmitterProperties }, { new Puerts.MethodKey {Name = "GetSubEmitterEmitProbability", IsStatic = false}, M_GetSubEmitterEmitProbability }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"enabled", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_enabled, Setter = S_enabled} }, {"subEmittersCount", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_subEmittersCount, Setter = null} }, } }; } } } <|start_filename|>Projects/java_json/src/gen/cfg/error/EErrorCode.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.error; public enum EErrorCode { OK(0), SERVER_NOT_EXISTS(1), HAS_BIND_SERVER(2), AUTH_FAIL(3), NOT_BIND_SERVER(4), SERVER_ACCESS_FAIL(5), EXAMPLE_FLASH(6), EXAMPLE_MSGBOX(7), EXAMPLE_DLG_OK(8), EXAMPLE_DLG_OK_CANCEL(9), ROLE_CREATE_NAME_INVALID_CHAR(100), ROLE_CREATE_NAME_EMPTY(101), ROLE_CREATE_NAME_EXCEED_MAX_LENGTH(102), ROLE_CREATE_ROLE_LIST_FULL(103), ROLE_CREATE_INVALID_PROFESSION(104), ROLE_CREATE_INVALID_GENDER(105), ROLE_NOT_OWNED_BY_USER(106), ROLE_LEVEL_NOT_ARRIVE(107), PARAM_ILLEGAL(200), TEMP_BAG_NOT_EMPTY(201), ITEM_CAN_NOT_USE(202), CURRENCY_NOT_ENOUGH(203), BAG_IS_FULL(204), ITEM_NOT_ENOUGH(205), ITEM_IN_BAG(206), GENDER_NOT_MATCH(300), LEVEL_TOO_LOW(301), LEVEL_TOO_HIGH(302), EXCEED_LIMIT(303), OVER_TIME(304), SERVER_ERROR(305), SKILL_NOT_IN_LIST(400), SKILL_NOT_COOLDOWN(401), SKILL_TARGET_NOT_EXIST(402), SKILL_ANOTHER_CASTING(403), SKILL_OUT_OF_DISTANCE(404), SKILL_TARGET_CAMP_NOT_MATCH(405), SKILL_INVALID_DIRECTION(406), SKILL_NOT_IN_SELECT_SHAPE(407), SKILL_ENERGY_NOT_ENOUGH(408), DIALOG_NODE_NOT_CHOOSEN(500), DIALOG_NOT_FINISH(501), DIALOG_HAS_FINISH(502), QUEST_STAGE_NOT_FINISHED(503), QUEST_NOT_DOING(504), QUEST_STAGE_NOT_DOING(505), QUEST_HAS_ACCEPTED(506), MAP_OBJECT_NOT_EXIST(600), INTERACTION_OBJECT_NOT_SUPPORT_OPERATION(601), HAS_NOT_EQUIP(602), HANDHELD_EQUIP_ID_NOT_MATCH(603), NOT_AVAILABLE_SUIT_ID(604), NO_INTERACTION_COMPONENT(605), HAS_INTERACTED(606), VIALITY_NOT_ENOUGH(607), PLAYER_SESSION_NOT_EXIST(608), PLAYER_SESSION_WORLD_PLAYER_NOT_INIT(609), MAP_NOT_EXIST(610), MAIL_TYPE_ERROR(700), MAIL_NOT_EXITST(701), MAIL_HAVE_DELETED(702), MAIL_AWARD_HAVE_RECEIVED(703), MAIL_OPERATE_TYPE_ERROR(704), MAIL_CONDITION_NOT_MEET(705), MAIL_STATE_ERROR(706), MAIL_NO_AWARD(707), MAIL_BOX_IS_FULL(708), PROP_SCORE_NOT_BIGGER_THAN(800), NOT_WEAR_CLOTHES(801), NOT_WEAR_SUIT(802), SUIT_NOT_UNLOCK(900), SUIT_COMPONENT_NOT_UNLOCK(901), SUIT_STATE_ERROR(902), SUIT_COMPONENT_STATE_ERROR(903), SUIT_COMPONENT_NO_NEED_LEARN(904), STORE_NOT_ENABLED(1000), SHELF_NOT_ENABLED(1001), GOODS_NOT_ENABLED(1002), GOODS_NOT_IN_CUR_REFRESH(1003), RETRY(1100), NOT_COOLDOWN(1101), SELFIE_UNLOCK(1200), SELFIE_ALREADY_UNLOCK(1201), SELFIE_LACK_STARTS(1202), SELFIE_HAD_REWARD(1203), ; private final int value; public int getValue() { return value; } EErrorCode(int value) { this.value = value; } public static EErrorCode valueOf(int value) { if (value == 0) return OK; if (value == 1) return SERVER_NOT_EXISTS; if (value == 2) return HAS_BIND_SERVER; if (value == 3) return AUTH_FAIL; if (value == 4) return NOT_BIND_SERVER; if (value == 5) return SERVER_ACCESS_FAIL; if (value == 6) return EXAMPLE_FLASH; if (value == 7) return EXAMPLE_MSGBOX; if (value == 8) return EXAMPLE_DLG_OK; if (value == 9) return EXAMPLE_DLG_OK_CANCEL; if (value == 100) return ROLE_CREATE_NAME_INVALID_CHAR; if (value == 101) return ROLE_CREATE_NAME_EMPTY; if (value == 102) return ROLE_CREATE_NAME_EXCEED_MAX_LENGTH; if (value == 103) return ROLE_CREATE_ROLE_LIST_FULL; if (value == 104) return ROLE_CREATE_INVALID_PROFESSION; if (value == 105) return ROLE_CREATE_INVALID_GENDER; if (value == 106) return ROLE_NOT_OWNED_BY_USER; if (value == 107) return ROLE_LEVEL_NOT_ARRIVE; if (value == 200) return PARAM_ILLEGAL; if (value == 201) return TEMP_BAG_NOT_EMPTY; if (value == 202) return ITEM_CAN_NOT_USE; if (value == 203) return CURRENCY_NOT_ENOUGH; if (value == 204) return BAG_IS_FULL; if (value == 205) return ITEM_NOT_ENOUGH; if (value == 206) return ITEM_IN_BAG; if (value == 300) return GENDER_NOT_MATCH; if (value == 301) return LEVEL_TOO_LOW; if (value == 302) return LEVEL_TOO_HIGH; if (value == 303) return EXCEED_LIMIT; if (value == 304) return OVER_TIME; if (value == 305) return SERVER_ERROR; if (value == 400) return SKILL_NOT_IN_LIST; if (value == 401) return SKILL_NOT_COOLDOWN; if (value == 402) return SKILL_TARGET_NOT_EXIST; if (value == 403) return SKILL_ANOTHER_CASTING; if (value == 404) return SKILL_OUT_OF_DISTANCE; if (value == 405) return SKILL_TARGET_CAMP_NOT_MATCH; if (value == 406) return SKILL_INVALID_DIRECTION; if (value == 407) return SKILL_NOT_IN_SELECT_SHAPE; if (value == 408) return SKILL_ENERGY_NOT_ENOUGH; if (value == 500) return DIALOG_NODE_NOT_CHOOSEN; if (value == 501) return DIALOG_NOT_FINISH; if (value == 502) return DIALOG_HAS_FINISH; if (value == 503) return QUEST_STAGE_NOT_FINISHED; if (value == 504) return QUEST_NOT_DOING; if (value == 505) return QUEST_STAGE_NOT_DOING; if (value == 506) return QUEST_HAS_ACCEPTED; if (value == 600) return MAP_OBJECT_NOT_EXIST; if (value == 601) return INTERACTION_OBJECT_NOT_SUPPORT_OPERATION; if (value == 602) return HAS_NOT_EQUIP; if (value == 603) return HANDHELD_EQUIP_ID_NOT_MATCH; if (value == 604) return NOT_AVAILABLE_SUIT_ID; if (value == 605) return NO_INTERACTION_COMPONENT; if (value == 606) return HAS_INTERACTED; if (value == 607) return VIALITY_NOT_ENOUGH; if (value == 608) return PLAYER_SESSION_NOT_EXIST; if (value == 609) return PLAYER_SESSION_WORLD_PLAYER_NOT_INIT; if (value == 610) return MAP_NOT_EXIST; if (value == 700) return MAIL_TYPE_ERROR; if (value == 701) return MAIL_NOT_EXITST; if (value == 702) return MAIL_HAVE_DELETED; if (value == 703) return MAIL_AWARD_HAVE_RECEIVED; if (value == 704) return MAIL_OPERATE_TYPE_ERROR; if (value == 705) return MAIL_CONDITION_NOT_MEET; if (value == 706) return MAIL_STATE_ERROR; if (value == 707) return MAIL_NO_AWARD; if (value == 708) return MAIL_BOX_IS_FULL; if (value == 800) return PROP_SCORE_NOT_BIGGER_THAN; if (value == 801) return NOT_WEAR_CLOTHES; if (value == 802) return NOT_WEAR_SUIT; if (value == 900) return SUIT_NOT_UNLOCK; if (value == 901) return SUIT_COMPONENT_NOT_UNLOCK; if (value == 902) return SUIT_STATE_ERROR; if (value == 903) return SUIT_COMPONENT_STATE_ERROR; if (value == 904) return SUIT_COMPONENT_NO_NEED_LEARN; if (value == 1000) return STORE_NOT_ENABLED; if (value == 1001) return SHELF_NOT_ENABLED; if (value == 1002) return GOODS_NOT_ENABLED; if (value == 1003) return GOODS_NOT_IN_CUR_REFRESH; if (value == 1100) return RETRY; if (value == 1101) return NOT_COOLDOWN; if (value == 1200) return SELFIE_UNLOCK; if (value == 1201) return SELFIE_ALREADY_UNLOCK; if (value == 1202) return SELFIE_LACK_STARTS; if (value == 1203) return SELFIE_HAD_REWARD; throw new IllegalArgumentException(""); } } <|start_filename|>Projects/GenerateDatas/convert_lua/role.TbRoleLevelExpAttr/19.lua<|end_filename|> return { level = 19, need_exp = 5500, clothes_attrs = { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, }, } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_RenderTexture_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_RenderTexture_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.RenderTextureDescriptor), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.RenderTextureDescriptor>(false); var result = new UnityEngine.RenderTexture(Arg0); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.RenderTexture), result); } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RenderTexture), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.RenderTexture>(false); var result = new UnityEngine.RenderTexture(Arg0); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.RenderTexture), result); } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = (UnityEngine.Experimental.Rendering.DefaultFormat)argHelper3.GetInt32(false); var result = new UnityEngine.RenderTexture(Arg0,Arg1,Arg2,Arg3); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.RenderTexture), result); } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = (UnityEngine.Experimental.Rendering.GraphicsFormat)argHelper3.GetInt32(false); var result = new UnityEngine.RenderTexture(Arg0,Arg1,Arg2,Arg3); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.RenderTexture), result); } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = (UnityEngine.RenderTextureFormat)argHelper3.GetInt32(false); var result = new UnityEngine.RenderTexture(Arg0,Arg1,Arg2,Arg3); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.RenderTexture), result); } } if (paramLen == 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = (UnityEngine.Experimental.Rendering.GraphicsFormat)argHelper3.GetInt32(false); var Arg4 = argHelper4.GetInt32(false); var result = new UnityEngine.RenderTexture(Arg0,Arg1,Arg2,Arg3,Arg4); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.RenderTexture), result); } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = (UnityEngine.RenderTextureFormat)argHelper3.GetInt32(false); var Arg4 = (UnityEngine.RenderTextureReadWrite)argHelper4.GetInt32(false); var result = new UnityEngine.RenderTexture(Arg0,Arg1,Arg2,Arg3,Arg4); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.RenderTexture), result); } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = (UnityEngine.RenderTextureFormat)argHelper3.GetInt32(false); var Arg4 = argHelper4.GetInt32(false); var result = new UnityEngine.RenderTexture(Arg0,Arg1,Arg2,Arg3,Arg4); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.RenderTexture), result); } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var result = new UnityEngine.RenderTexture(Arg0,Arg1,Arg2); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.RenderTexture), result); } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.RenderTexture constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetNativeDepthBufferPtr(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RenderTexture; { { var result = obj.GetNativeDepthBufferPtr(); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_DiscardContents(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RenderTexture; if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.GetBoolean(false); var Arg1 = argHelper1.GetBoolean(false); obj.DiscardContents(Arg0,Arg1); return; } } if (paramLen == 0) { { obj.DiscardContents(); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to DiscardContents"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_MarkRestoreExpected(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RenderTexture; { { obj.MarkRestoreExpected(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ResolveAntiAliasedSurface(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RenderTexture; if (paramLen == 0) { { obj.ResolveAntiAliasedSurface(); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RenderTexture), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.RenderTexture>(false); obj.ResolveAntiAliasedSurface(Arg0); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to ResolveAntiAliasedSurface"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetGlobalShaderProperty(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RenderTexture; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetString(false); obj.SetGlobalShaderProperty(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Create(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RenderTexture; { { var result = obj.Create(); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Release(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RenderTexture; { { obj.Release(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_IsCreated(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RenderTexture; { { var result = obj.IsCreated(); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GenerateMips(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RenderTexture; { { obj.GenerateMips(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ConvertToEquirect(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RenderTexture; if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RenderTexture), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.RenderTexture>(false); var Arg1 = (UnityEngine.Camera.MonoOrStereoscopicEye)argHelper1.GetInt32(false); obj.ConvertToEquirect(Arg0,Arg1); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RenderTexture), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.RenderTexture>(false); obj.ConvertToEquirect(Arg0); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to ConvertToEquirect"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_SupportsStencil(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.RenderTexture>(false); var result = UnityEngine.RenderTexture.SupportsStencil(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_ReleaseTemporary(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.RenderTexture>(false); UnityEngine.RenderTexture.ReleaseTemporary(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetTemporary(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.RenderTextureDescriptor), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.RenderTextureDescriptor>(false); var result = UnityEngine.RenderTexture.GetTemporary(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 8) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); var argHelper7 = new Puerts.ArgumentHelper((int)data, isolate, info, 7); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper7.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = (UnityEngine.Experimental.Rendering.GraphicsFormat)argHelper3.GetInt32(false); var Arg4 = argHelper4.GetInt32(false); var Arg5 = (UnityEngine.RenderTextureMemoryless)argHelper5.GetInt32(false); var Arg6 = (UnityEngine.VRTextureUsage)argHelper6.GetInt32(false); var Arg7 = argHelper7.GetBoolean(false); var result = UnityEngine.RenderTexture.GetTemporary(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper7.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = (UnityEngine.RenderTextureFormat)argHelper3.GetInt32(false); var Arg4 = (UnityEngine.RenderTextureReadWrite)argHelper4.GetInt32(false); var Arg5 = argHelper5.GetInt32(false); var Arg6 = (UnityEngine.RenderTextureMemoryless)argHelper6.GetInt32(false); var Arg7 = (UnityEngine.VRTextureUsage)argHelper7.GetInt32(false); var result = UnityEngine.RenderTexture.GetTemporary(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 7) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = (UnityEngine.Experimental.Rendering.GraphicsFormat)argHelper3.GetInt32(false); var Arg4 = argHelper4.GetInt32(false); var Arg5 = (UnityEngine.RenderTextureMemoryless)argHelper5.GetInt32(false); var Arg6 = (UnityEngine.VRTextureUsage)argHelper6.GetInt32(false); var result = UnityEngine.RenderTexture.GetTemporary(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = (UnityEngine.RenderTextureFormat)argHelper3.GetInt32(false); var Arg4 = (UnityEngine.RenderTextureReadWrite)argHelper4.GetInt32(false); var Arg5 = argHelper5.GetInt32(false); var Arg6 = (UnityEngine.RenderTextureMemoryless)argHelper6.GetInt32(false); var result = UnityEngine.RenderTexture.GetTemporary(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 6) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = (UnityEngine.Experimental.Rendering.GraphicsFormat)argHelper3.GetInt32(false); var Arg4 = argHelper4.GetInt32(false); var Arg5 = (UnityEngine.RenderTextureMemoryless)argHelper5.GetInt32(false); var result = UnityEngine.RenderTexture.GetTemporary(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = (UnityEngine.RenderTextureFormat)argHelper3.GetInt32(false); var Arg4 = (UnityEngine.RenderTextureReadWrite)argHelper4.GetInt32(false); var Arg5 = argHelper5.GetInt32(false); var result = UnityEngine.RenderTexture.GetTemporary(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = (UnityEngine.Experimental.Rendering.GraphicsFormat)argHelper3.GetInt32(false); var Arg4 = argHelper4.GetInt32(false); var result = UnityEngine.RenderTexture.GetTemporary(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = (UnityEngine.RenderTextureFormat)argHelper3.GetInt32(false); var Arg4 = (UnityEngine.RenderTextureReadWrite)argHelper4.GetInt32(false); var result = UnityEngine.RenderTexture.GetTemporary(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = (UnityEngine.Experimental.Rendering.GraphicsFormat)argHelper3.GetInt32(false); var result = UnityEngine.RenderTexture.GetTemporary(Arg0,Arg1,Arg2,Arg3); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = (UnityEngine.RenderTextureFormat)argHelper3.GetInt32(false); var result = UnityEngine.RenderTexture.GetTemporary(Arg0,Arg1,Arg2,Arg3); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 9) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); var argHelper7 = new Puerts.ArgumentHelper((int)data, isolate, info, 7); var argHelper8 = new Puerts.ArgumentHelper((int)data, isolate, info, 8); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper6.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper7.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper8.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = (UnityEngine.RenderTextureFormat)argHelper3.GetInt32(false); var Arg4 = (UnityEngine.RenderTextureReadWrite)argHelper4.GetInt32(false); var Arg5 = argHelper5.GetInt32(false); var Arg6 = (UnityEngine.RenderTextureMemoryless)argHelper6.GetInt32(false); var Arg7 = (UnityEngine.VRTextureUsage)argHelper7.GetInt32(false); var Arg8 = argHelper8.GetBoolean(false); var result = UnityEngine.RenderTexture.GetTemporary(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7,Arg8); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var result = UnityEngine.RenderTexture.GetTemporary(Arg0,Arg1,Arg2); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var result = UnityEngine.RenderTexture.GetTemporary(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetTemporary"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_width(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RenderTexture; var result = obj.width; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_width(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RenderTexture; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.width = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_height(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RenderTexture; var result = obj.height; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_height(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RenderTexture; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.height = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_dimension(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RenderTexture; var result = obj.dimension; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_dimension(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RenderTexture; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.dimension = (UnityEngine.Rendering.TextureDimension)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_graphicsFormat(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RenderTexture; var result = obj.graphicsFormat; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_graphicsFormat(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RenderTexture; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.graphicsFormat = (UnityEngine.Experimental.Rendering.GraphicsFormat)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_useMipMap(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RenderTexture; var result = obj.useMipMap; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_useMipMap(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RenderTexture; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.useMipMap = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_sRGB(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RenderTexture; var result = obj.sRGB; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_vrUsage(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RenderTexture; var result = obj.vrUsage; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_vrUsage(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RenderTexture; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.vrUsage = (UnityEngine.VRTextureUsage)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_memorylessMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RenderTexture; var result = obj.memorylessMode; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_memorylessMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RenderTexture; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.memorylessMode = (UnityEngine.RenderTextureMemoryless)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_format(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RenderTexture; var result = obj.format; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_format(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RenderTexture; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.format = (UnityEngine.RenderTextureFormat)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_stencilFormat(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RenderTexture; var result = obj.stencilFormat; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_stencilFormat(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RenderTexture; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.stencilFormat = (UnityEngine.Experimental.Rendering.GraphicsFormat)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_autoGenerateMips(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RenderTexture; var result = obj.autoGenerateMips; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_autoGenerateMips(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RenderTexture; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.autoGenerateMips = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_volumeDepth(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RenderTexture; var result = obj.volumeDepth; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_volumeDepth(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RenderTexture; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.volumeDepth = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_antiAliasing(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RenderTexture; var result = obj.antiAliasing; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_antiAliasing(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RenderTexture; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.antiAliasing = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_bindTextureMS(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RenderTexture; var result = obj.bindTextureMS; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_bindTextureMS(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RenderTexture; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.bindTextureMS = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_enableRandomWrite(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RenderTexture; var result = obj.enableRandomWrite; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_enableRandomWrite(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RenderTexture; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.enableRandomWrite = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_useDynamicScale(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RenderTexture; var result = obj.useDynamicScale; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_useDynamicScale(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RenderTexture; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.useDynamicScale = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_isPowerOfTwo(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RenderTexture; var result = obj.isPowerOfTwo; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_isPowerOfTwo(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RenderTexture; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.isPowerOfTwo = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_active(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.RenderTexture.active; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_active(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.RenderTexture.active = argHelper.Get<UnityEngine.RenderTexture>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_colorBuffer(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RenderTexture; var result = obj.colorBuffer; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_depthBuffer(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RenderTexture; var result = obj.depthBuffer; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_depth(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RenderTexture; var result = obj.depth; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_depth(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RenderTexture; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.depth = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_descriptor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RenderTexture; var result = obj.descriptor; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_descriptor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.RenderTexture; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.descriptor = argHelper.Get<UnityEngine.RenderTextureDescriptor>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "GetNativeDepthBufferPtr", IsStatic = false}, M_GetNativeDepthBufferPtr }, { new Puerts.MethodKey {Name = "DiscardContents", IsStatic = false}, M_DiscardContents }, { new Puerts.MethodKey {Name = "MarkRestoreExpected", IsStatic = false}, M_MarkRestoreExpected }, { new Puerts.MethodKey {Name = "ResolveAntiAliasedSurface", IsStatic = false}, M_ResolveAntiAliasedSurface }, { new Puerts.MethodKey {Name = "SetGlobalShaderProperty", IsStatic = false}, M_SetGlobalShaderProperty }, { new Puerts.MethodKey {Name = "Create", IsStatic = false}, M_Create }, { new Puerts.MethodKey {Name = "Release", IsStatic = false}, M_Release }, { new Puerts.MethodKey {Name = "IsCreated", IsStatic = false}, M_IsCreated }, { new Puerts.MethodKey {Name = "GenerateMips", IsStatic = false}, M_GenerateMips }, { new Puerts.MethodKey {Name = "ConvertToEquirect", IsStatic = false}, M_ConvertToEquirect }, { new Puerts.MethodKey {Name = "SupportsStencil", IsStatic = true}, F_SupportsStencil }, { new Puerts.MethodKey {Name = "ReleaseTemporary", IsStatic = true}, F_ReleaseTemporary }, { new Puerts.MethodKey {Name = "GetTemporary", IsStatic = true}, F_GetTemporary }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"width", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_width, Setter = S_width} }, {"height", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_height, Setter = S_height} }, {"dimension", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_dimension, Setter = S_dimension} }, {"graphicsFormat", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_graphicsFormat, Setter = S_graphicsFormat} }, {"useMipMap", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_useMipMap, Setter = S_useMipMap} }, {"sRGB", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_sRGB, Setter = null} }, {"vrUsage", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_vrUsage, Setter = S_vrUsage} }, {"memorylessMode", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_memorylessMode, Setter = S_memorylessMode} }, {"format", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_format, Setter = S_format} }, {"stencilFormat", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_stencilFormat, Setter = S_stencilFormat} }, {"autoGenerateMips", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_autoGenerateMips, Setter = S_autoGenerateMips} }, {"volumeDepth", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_volumeDepth, Setter = S_volumeDepth} }, {"antiAliasing", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_antiAliasing, Setter = S_antiAliasing} }, {"bindTextureMS", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_bindTextureMS, Setter = S_bindTextureMS} }, {"enableRandomWrite", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_enableRandomWrite, Setter = S_enableRandomWrite} }, {"useDynamicScale", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_useDynamicScale, Setter = S_useDynamicScale} }, {"isPowerOfTwo", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_isPowerOfTwo, Setter = S_isPowerOfTwo} }, {"active", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_active, Setter = S_active} }, {"colorBuffer", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_colorBuffer, Setter = null} }, {"depthBuffer", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_depthBuffer, Setter = null} }, {"depth", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_depth, Setter = S_depth} }, {"descriptor", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_descriptor, Setter = S_descriptor} }, } }; } } } <|start_filename|>Projects/Java_bin/src/main/gen/cfg/test/DemoE2.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.test; import bright.serialization.*; public final class DemoE2 { public DemoE2(ByteBuf _buf) { if(_buf.readBool()){ y1 = _buf.readInt(); } else { y1 = null; } y2 = _buf.readBool(); } public DemoE2(Integer y1, boolean y2 ) { this.y1 = y1; this.y2 = y2; } public final Integer y1; public final boolean y2; public void resolve(java.util.HashMap<String, Object> _tables) { } @Override public String toString() { return "{ " + "y1:" + y1 + "," + "y2:" + y2 + "," + "}"; } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_CustomRenderTexture_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_CustomRenderTexture_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = (UnityEngine.RenderTextureFormat)argHelper2.GetInt32(false); var Arg3 = (UnityEngine.RenderTextureReadWrite)argHelper3.GetInt32(false); var result = new UnityEngine.CustomRenderTexture(Arg0,Arg1,Arg2,Arg3); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.CustomRenderTexture), result); } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = (UnityEngine.RenderTextureFormat)argHelper2.GetInt32(false); var result = new UnityEngine.CustomRenderTexture(Arg0,Arg1,Arg2); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.CustomRenderTexture), result); } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = (UnityEngine.Experimental.Rendering.DefaultFormat)argHelper2.GetInt32(false); var result = new UnityEngine.CustomRenderTexture(Arg0,Arg1,Arg2); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.CustomRenderTexture), result); } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = (UnityEngine.Experimental.Rendering.GraphicsFormat)argHelper2.GetInt32(false); var result = new UnityEngine.CustomRenderTexture(Arg0,Arg1,Arg2); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.CustomRenderTexture), result); } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var result = new UnityEngine.CustomRenderTexture(Arg0,Arg1); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.CustomRenderTexture), result); } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.CustomRenderTexture constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Update(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CustomRenderTexture; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); obj.Update(Arg0); return; } } if (paramLen == 0) { { obj.Update(); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to Update"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Initialize(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CustomRenderTexture; { { obj.Initialize(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ClearUpdateZones(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CustomRenderTexture; { { obj.ClearUpdateZones(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetUpdateZones(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CustomRenderTexture; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.Collections.Generic.List<UnityEngine.CustomRenderTextureUpdateZone>>(false); obj.GetUpdateZones(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetDoubleBufferRenderTexture(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CustomRenderTexture; { { var result = obj.GetDoubleBufferRenderTexture(); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_EnsureDoubleBufferConsistency(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CustomRenderTexture; { { obj.EnsureDoubleBufferConsistency(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetUpdateZones(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CustomRenderTexture; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.CustomRenderTextureUpdateZone[]>(false); obj.SetUpdateZones(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_material(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CustomRenderTexture; var result = obj.material; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_material(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CustomRenderTexture; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.material = argHelper.Get<UnityEngine.Material>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_initializationMaterial(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CustomRenderTexture; var result = obj.initializationMaterial; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_initializationMaterial(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CustomRenderTexture; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.initializationMaterial = argHelper.Get<UnityEngine.Material>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_initializationTexture(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CustomRenderTexture; var result = obj.initializationTexture; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_initializationTexture(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CustomRenderTexture; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.initializationTexture = argHelper.Get<UnityEngine.Texture>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_initializationSource(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CustomRenderTexture; var result = obj.initializationSource; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_initializationSource(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CustomRenderTexture; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.initializationSource = (UnityEngine.CustomRenderTextureInitializationSource)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_initializationColor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CustomRenderTexture; var result = obj.initializationColor; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_initializationColor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CustomRenderTexture; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.initializationColor = argHelper.Get<UnityEngine.Color>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_updateMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CustomRenderTexture; var result = obj.updateMode; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_updateMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CustomRenderTexture; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.updateMode = (UnityEngine.CustomRenderTextureUpdateMode)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_initializationMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CustomRenderTexture; var result = obj.initializationMode; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_initializationMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CustomRenderTexture; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.initializationMode = (UnityEngine.CustomRenderTextureUpdateMode)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_updateZoneSpace(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CustomRenderTexture; var result = obj.updateZoneSpace; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_updateZoneSpace(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CustomRenderTexture; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.updateZoneSpace = (UnityEngine.CustomRenderTextureUpdateZoneSpace)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_shaderPass(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CustomRenderTexture; var result = obj.shaderPass; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_shaderPass(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CustomRenderTexture; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.shaderPass = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_cubemapFaceMask(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CustomRenderTexture; var result = obj.cubemapFaceMask; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_cubemapFaceMask(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CustomRenderTexture; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.cubemapFaceMask = argHelper.GetUInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_doubleBuffered(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CustomRenderTexture; var result = obj.doubleBuffered; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_doubleBuffered(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CustomRenderTexture; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.doubleBuffered = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_wrapUpdateZones(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CustomRenderTexture; var result = obj.wrapUpdateZones; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_wrapUpdateZones(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CustomRenderTexture; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.wrapUpdateZones = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_updatePeriod(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CustomRenderTexture; var result = obj.updatePeriod; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_updatePeriod(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.CustomRenderTexture; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.updatePeriod = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "Update", IsStatic = false}, M_Update }, { new Puerts.MethodKey {Name = "Initialize", IsStatic = false}, M_Initialize }, { new Puerts.MethodKey {Name = "ClearUpdateZones", IsStatic = false}, M_ClearUpdateZones }, { new Puerts.MethodKey {Name = "GetUpdateZones", IsStatic = false}, M_GetUpdateZones }, { new Puerts.MethodKey {Name = "GetDoubleBufferRenderTexture", IsStatic = false}, M_GetDoubleBufferRenderTexture }, { new Puerts.MethodKey {Name = "EnsureDoubleBufferConsistency", IsStatic = false}, M_EnsureDoubleBufferConsistency }, { new Puerts.MethodKey {Name = "SetUpdateZones", IsStatic = false}, M_SetUpdateZones }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"material", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_material, Setter = S_material} }, {"initializationMaterial", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_initializationMaterial, Setter = S_initializationMaterial} }, {"initializationTexture", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_initializationTexture, Setter = S_initializationTexture} }, {"initializationSource", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_initializationSource, Setter = S_initializationSource} }, {"initializationColor", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_initializationColor, Setter = S_initializationColor} }, {"updateMode", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_updateMode, Setter = S_updateMode} }, {"initializationMode", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_initializationMode, Setter = S_initializationMode} }, {"updateZoneSpace", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_updateZoneSpace, Setter = S_updateZoneSpace} }, {"shaderPass", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_shaderPass, Setter = S_shaderPass} }, {"cubemapFaceMask", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_cubemapFaceMask, Setter = S_cubemapFaceMask} }, {"doubleBuffered", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_doubleBuffered, Setter = S_doubleBuffered} }, {"wrapUpdateZones", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_wrapUpdateZones, Setter = S_wrapUpdateZones} }, {"updatePeriod", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_updatePeriod, Setter = S_updatePeriod} }, } }; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_Plane_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_Plane_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3>(false); var result = new UnityEngine.Plane(Arg0,Arg1); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.Plane), result); } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = argHelper1.GetFloat(false); var result = new UnityEngine.Plane(Arg0,Arg1); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.Plane), result); } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3>(false); var Arg2 = argHelper2.Get<UnityEngine.Vector3>(false); var result = new UnityEngine.Plane(Arg0,Arg1,Arg2); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.Plane), result); } } if (paramLen == 0) { { var result = new UnityEngine.Plane(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.Plane), result); } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.Plane constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetNormalAndPosition(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Plane)Puerts.Utils.GetSelf((int)data, self); { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3>(false); obj.SetNormalAndPosition(Arg0,Arg1); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Set3Points(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Plane)Puerts.Utils.GetSelf((int)data, self); { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3>(false); var Arg2 = argHelper2.Get<UnityEngine.Vector3>(false); obj.Set3Points(Arg0,Arg1,Arg2); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Flip(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Plane)Puerts.Utils.GetSelf((int)data, self); { { obj.Flip(); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Translate(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Plane)Puerts.Utils.GetSelf((int)data, self); { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); obj.Translate(Arg0); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_Translate(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<UnityEngine.Plane>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3>(false); var result = UnityEngine.Plane.Translate(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ClosestPointOnPlane(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Plane)Puerts.Utils.GetSelf((int)data, self); { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var result = obj.ClosestPointOnPlane(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetDistanceToPoint(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Plane)Puerts.Utils.GetSelf((int)data, self); { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var result = obj.GetDistanceToPoint(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetSide(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Plane)Puerts.Utils.GetSelf((int)data, self); { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var result = obj.GetSide(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SameSide(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Plane)Puerts.Utils.GetSelf((int)data, self); { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3>(false); var result = obj.SameSide(Arg0,Arg1); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Raycast(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Plane)Puerts.Utils.GetSelf((int)data, self); { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<UnityEngine.Ray>(false); var Arg1 = argHelper1.GetFloat(true); var result = obj.Raycast(Arg0,out Arg1); argHelper1.SetByRefValue(Arg1); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ToString(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Plane)Puerts.Utils.GetSelf((int)data, self); if (paramLen == 0) { { var result = obj.ToString(); Puerts.PuertsDLL.ReturnString(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var result = obj.ToString(Arg0); Puerts.PuertsDLL.ReturnString(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.IFormatProvider), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<System.IFormatProvider>(false); var result = obj.ToString(Arg0,Arg1); Puerts.PuertsDLL.ReturnString(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to ToString"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_normal(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Plane)Puerts.Utils.GetSelf((int)data, self); var result = obj.normal; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_normal(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Plane)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.normal = argHelper.Get<UnityEngine.Vector3>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_distance(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Plane)Puerts.Utils.GetSelf((int)data, self); var result = obj.distance; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_distance(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Plane)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.distance = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_flipped(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Plane)Puerts.Utils.GetSelf((int)data, self); var result = obj.flipped; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "SetNormalAndPosition", IsStatic = false}, M_SetNormalAndPosition }, { new Puerts.MethodKey {Name = "Set3Points", IsStatic = false}, M_Set3Points }, { new Puerts.MethodKey {Name = "Flip", IsStatic = false}, M_Flip }, { new Puerts.MethodKey {Name = "Translate", IsStatic = false}, M_Translate }, { new Puerts.MethodKey {Name = "Translate", IsStatic = true}, F_Translate }, { new Puerts.MethodKey {Name = "ClosestPointOnPlane", IsStatic = false}, M_ClosestPointOnPlane }, { new Puerts.MethodKey {Name = "GetDistanceToPoint", IsStatic = false}, M_GetDistanceToPoint }, { new Puerts.MethodKey {Name = "GetSide", IsStatic = false}, M_GetSide }, { new Puerts.MethodKey {Name = "SameSide", IsStatic = false}, M_SameSide }, { new Puerts.MethodKey {Name = "Raycast", IsStatic = false}, M_Raycast }, { new Puerts.MethodKey {Name = "ToString", IsStatic = false}, M_ToString }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"normal", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_normal, Setter = S_normal} }, {"distance", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_distance, Setter = S_distance} }, {"flipped", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_flipped, Setter = null} }, } }; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_UI_Scrollbar_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_UI_Scrollbar_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.UI.Scrollbar constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetValueWithoutNotify(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Scrollbar; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetFloat(false); obj.SetValueWithoutNotify(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Rebuild(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Scrollbar; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = (UnityEngine.UI.CanvasUpdate)argHelper0.GetInt32(false); obj.Rebuild(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_LayoutComplete(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Scrollbar; { { obj.LayoutComplete(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GraphicUpdateComplete(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Scrollbar; { { obj.GraphicUpdateComplete(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_OnBeginDrag(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Scrollbar; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.EventSystems.PointerEventData>(false); obj.OnBeginDrag(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_OnDrag(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Scrollbar; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.EventSystems.PointerEventData>(false); obj.OnDrag(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_OnPointerDown(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Scrollbar; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.EventSystems.PointerEventData>(false); obj.OnPointerDown(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_OnPointerUp(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Scrollbar; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.EventSystems.PointerEventData>(false); obj.OnPointerUp(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_OnMove(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Scrollbar; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.EventSystems.AxisEventData>(false); obj.OnMove(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_FindSelectableOnLeft(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Scrollbar; { { var result = obj.FindSelectableOnLeft(); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_FindSelectableOnRight(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Scrollbar; { { var result = obj.FindSelectableOnRight(); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_FindSelectableOnUp(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Scrollbar; { { var result = obj.FindSelectableOnUp(); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_FindSelectableOnDown(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Scrollbar; { { var result = obj.FindSelectableOnDown(); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_OnInitializePotentialDrag(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Scrollbar; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.EventSystems.PointerEventData>(false); obj.OnInitializePotentialDrag(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetDirection(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Scrollbar; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = (UnityEngine.UI.Scrollbar.Direction)argHelper0.GetInt32(false); var Arg1 = argHelper1.GetBoolean(false); obj.SetDirection(Arg0,Arg1); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_handleRect(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Scrollbar; var result = obj.handleRect; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_handleRect(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Scrollbar; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.handleRect = argHelper.Get<UnityEngine.RectTransform>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_direction(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Scrollbar; var result = obj.direction; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_direction(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Scrollbar; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.direction = (UnityEngine.UI.Scrollbar.Direction)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_value(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Scrollbar; var result = obj.value; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_value(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Scrollbar; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.value = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_size(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Scrollbar; var result = obj.size; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_size(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Scrollbar; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.size = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_numberOfSteps(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Scrollbar; var result = obj.numberOfSteps; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_numberOfSteps(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Scrollbar; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.numberOfSteps = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_onValueChanged(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Scrollbar; var result = obj.onValueChanged; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_onValueChanged(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.Scrollbar; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.onValueChanged = argHelper.Get<UnityEngine.UI.Scrollbar.ScrollEvent>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "SetValueWithoutNotify", IsStatic = false}, M_SetValueWithoutNotify }, { new Puerts.MethodKey {Name = "Rebuild", IsStatic = false}, M_Rebuild }, { new Puerts.MethodKey {Name = "LayoutComplete", IsStatic = false}, M_LayoutComplete }, { new Puerts.MethodKey {Name = "GraphicUpdateComplete", IsStatic = false}, M_GraphicUpdateComplete }, { new Puerts.MethodKey {Name = "OnBeginDrag", IsStatic = false}, M_OnBeginDrag }, { new Puerts.MethodKey {Name = "OnDrag", IsStatic = false}, M_OnDrag }, { new Puerts.MethodKey {Name = "OnPointerDown", IsStatic = false}, M_OnPointerDown }, { new Puerts.MethodKey {Name = "OnPointerUp", IsStatic = false}, M_OnPointerUp }, { new Puerts.MethodKey {Name = "OnMove", IsStatic = false}, M_OnMove }, { new Puerts.MethodKey {Name = "FindSelectableOnLeft", IsStatic = false}, M_FindSelectableOnLeft }, { new Puerts.MethodKey {Name = "FindSelectableOnRight", IsStatic = false}, M_FindSelectableOnRight }, { new Puerts.MethodKey {Name = "FindSelectableOnUp", IsStatic = false}, M_FindSelectableOnUp }, { new Puerts.MethodKey {Name = "FindSelectableOnDown", IsStatic = false}, M_FindSelectableOnDown }, { new Puerts.MethodKey {Name = "OnInitializePotentialDrag", IsStatic = false}, M_OnInitializePotentialDrag }, { new Puerts.MethodKey {Name = "SetDirection", IsStatic = false}, M_SetDirection }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"handleRect", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_handleRect, Setter = S_handleRect} }, {"direction", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_direction, Setter = S_direction} }, {"value", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_value, Setter = S_value} }, {"size", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_size, Setter = S_size} }, {"numberOfSteps", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_numberOfSteps, Setter = S_numberOfSteps} }, {"onValueChanged", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_onValueChanged, Setter = S_onValueChanged} }, } }; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_LODGroup_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_LODGroup_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.LODGroup(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.LODGroup), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_RecalculateBounds(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LODGroup; { { obj.RecalculateBounds(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetLODs(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LODGroup; { { var result = obj.GetLODs(); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetLODs(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LODGroup; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.LOD[]>(false); obj.SetLODs(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ForceLOD(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LODGroup; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); obj.ForceLOD(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_localReferencePoint(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LODGroup; var result = obj.localReferencePoint; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_localReferencePoint(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LODGroup; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.localReferencePoint = argHelper.Get<UnityEngine.Vector3>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_size(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LODGroup; var result = obj.size; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_size(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LODGroup; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.size = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_lodCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LODGroup; var result = obj.lodCount; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_fadeMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LODGroup; var result = obj.fadeMode; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_fadeMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LODGroup; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.fadeMode = (UnityEngine.LODFadeMode)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_animateCrossFading(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LODGroup; var result = obj.animateCrossFading; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_animateCrossFading(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LODGroup; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.animateCrossFading = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_enabled(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LODGroup; var result = obj.enabled; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_enabled(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.LODGroup; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.enabled = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_crossFadeAnimationDuration(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.LODGroup.crossFadeAnimationDuration; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_crossFadeAnimationDuration(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.LODGroup.crossFadeAnimationDuration = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "RecalculateBounds", IsStatic = false}, M_RecalculateBounds }, { new Puerts.MethodKey {Name = "GetLODs", IsStatic = false}, M_GetLODs }, { new Puerts.MethodKey {Name = "SetLODs", IsStatic = false}, M_SetLODs }, { new Puerts.MethodKey {Name = "ForceLOD", IsStatic = false}, M_ForceLOD }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"localReferencePoint", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_localReferencePoint, Setter = S_localReferencePoint} }, {"size", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_size, Setter = S_size} }, {"lodCount", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_lodCount, Setter = null} }, {"fadeMode", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_fadeMode, Setter = S_fadeMode} }, {"animateCrossFading", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_animateCrossFading, Setter = S_animateCrossFading} }, {"enabled", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_enabled, Setter = S_enabled} }, {"crossFadeAnimationDuration", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_crossFadeAnimationDuration, Setter = S_crossFadeAnimationDuration} }, } }; } } } <|start_filename|>Projects/GenerateDatas/convert_lua/error.TbCodeInfo/708.lua<|end_filename|> return { code = 708, key = "MAIL_BOX_IS_FULL", } <|start_filename|>Projects/Csharp_Unity_json/Assets/LubanLib/BeanBase.cs<|end_filename|> using Bright.Serialization; namespace Bright.Config { public abstract class BeanBase : ITypeId { public abstract int GetTypeId(); } } <|start_filename|>Projects/GenerateDatas/convert_lua/tag.TbTestTag/11.lua<|end_filename|> return { id = 11, value = "any", } <|start_filename|>Projects/Go_json/gen/src/cfg/bonus.DropInfo.go<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg import "errors" type BonusDropInfo struct { Id int32 Desc string ClientShowItems []*BonusShowItemInfo Bonus interface{} } const TypeId_BonusDropInfo = -2014781108 func (*BonusDropInfo) GetTypeId() int32 { return -2014781108 } func (_v *BonusDropInfo)Deserialize(_buf map[string]interface{}) (err error) { { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["id"].(float64); !_ok_ { err = errors.New("id error"); return }; _v.Id = int32(_tempNum_) } { var _ok_ bool; if _v.Desc, _ok_ = _buf["desc"].(string); !_ok_ { err = errors.New("desc error"); return } } { var _arr_ []interface{} var _ok_ bool if _arr_, _ok_ = _buf["client_show_items"].([]interface{}); !_ok_ { err = errors.New("client_show_items error"); return } _v.ClientShowItems = make([]*BonusShowItemInfo, 0, len(_arr_)) for _, _e_ := range _arr_ { var _list_v_ *BonusShowItemInfo { var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _e_.(map[string]interface{}); !_ok_ { err = errors.New("_list_v_ error"); return }; if _list_v_, err = DeserializeBonusShowItemInfo(_x_); err != nil { return } } _v.ClientShowItems = append(_v.ClientShowItems, _list_v_) } } { var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _buf["bonus"].(map[string]interface{}); !_ok_ { err = errors.New("bonus error"); return }; if _v.Bonus, err = DeserializeBonusBonus(_x_); err != nil { return } } return } func DeserializeBonusDropInfo(_buf map[string]interface{}) (*BonusDropInfo, error) { v := &BonusDropInfo{} if err := v.Deserialize(_buf); err == nil { return v, nil } else { return nil, err } } <|start_filename|>Projects/Java_bin/src/main/gen/cfg/blueprint/Method.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.blueprint; import bright.serialization.*; public abstract class Method { public Method(ByteBuf _buf) { name = _buf.readString(); desc = _buf.readString(); isStatic = _buf.readBool(); returnType = _buf.readString(); {int n = Math.min(_buf.readSize(), _buf.size());parameters = new java.util.ArrayList<cfg.blueprint.ParamInfo>(n);for(int i = 0 ; i < n ; i++) { cfg.blueprint.ParamInfo _e; _e = new cfg.blueprint.ParamInfo(_buf); parameters.add(_e);}} } public Method(String name, String desc, boolean is_static, String return_type, java.util.ArrayList<cfg.blueprint.ParamInfo> parameters ) { this.name = name; this.desc = desc; this.isStatic = is_static; this.returnType = return_type; this.parameters = parameters; } public static Method deserializeMethod(ByteBuf _buf) { switch (_buf.readInt()) { case cfg.blueprint.AbstraceMethod.__ID__: return new cfg.blueprint.AbstraceMethod(_buf); case cfg.blueprint.ExternalMethod.__ID__: return new cfg.blueprint.ExternalMethod(_buf); case cfg.blueprint.BlueprintMethod.__ID__: return new cfg.blueprint.BlueprintMethod(_buf); default: throw new SerializationException(); } } public final String name; public final String desc; public final boolean isStatic; public final String returnType; public final java.util.ArrayList<cfg.blueprint.ParamInfo> parameters; public abstract int getTypeId(); public void resolve(java.util.HashMap<String, Object> _tables) { for(cfg.blueprint.ParamInfo _e : parameters) { if (_e != null) _e.resolve(_tables); } } @Override public String toString() { return "{ " + "name:" + name + "," + "desc:" + desc + "," + "isStatic:" + isStatic + "," + "returnType:" + returnType + "," + "parameters:" + parameters + "," + "}"; } } <|start_filename|>ProtoProjects/go/src/bright/math/Vector3.go<|end_filename|> package math type Vector3 struct { X float32 Y float32 Z float32 } func NewVector3(x float32, y float32, z float32) Vector3 { return Vector3{X: x, Y: y, Z: z} } <|start_filename|>Projects/Java_bin/src/main/gen/cfg/role/DistinctBonusInfos.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.role; import bright.serialization.*; public final class DistinctBonusInfos { public DistinctBonusInfos(ByteBuf _buf) { effectiveLevel = _buf.readInt(); {int n = Math.min(_buf.readSize(), _buf.size());bonusInfo = new java.util.ArrayList<cfg.role.BonusInfo>(n);for(int i = 0 ; i < n ; i++) { cfg.role.BonusInfo _e; _e = new cfg.role.BonusInfo(_buf); bonusInfo.add(_e);}} } public DistinctBonusInfos(int effective_level, java.util.ArrayList<cfg.role.BonusInfo> bonus_info ) { this.effectiveLevel = effective_level; this.bonusInfo = bonus_info; } public final int effectiveLevel; public final java.util.ArrayList<cfg.role.BonusInfo> bonusInfo; public void resolve(java.util.HashMap<String, Object> _tables) { for(cfg.role.BonusInfo _e : bonusInfo) { if (_e != null) _e.resolve(_tables); } } @Override public String toString() { return "{ " + "effectiveLevel:" + effectiveLevel + "," + "bonusInfo:" + bonusInfo + "," + "}"; } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_Compass_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_Compass_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.Compass(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.Compass), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_magneticHeading(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Compass; var result = obj.magneticHeading; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_trueHeading(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Compass; var result = obj.trueHeading; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_headingAccuracy(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Compass; var result = obj.headingAccuracy; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_rawVector(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Compass; var result = obj.rawVector; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_timestamp(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Compass; var result = obj.timestamp; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_enabled(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Compass; var result = obj.enabled; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_enabled(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Compass; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.enabled = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"magneticHeading", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_magneticHeading, Setter = null} }, {"trueHeading", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_trueHeading, Setter = null} }, {"headingAccuracy", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_headingAccuracy, Setter = null} }, {"rawVector", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_rawVector, Setter = null} }, {"timestamp", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_timestamp, Setter = null} }, {"enabled", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_enabled, Setter = S_enabled} }, } }; } } } <|start_filename|>Projects/DataTemplates/template_erlang/test_tbtestberef.erl<|end_filename|> %% test.TbTestBeRef get(1) -> #{id => 1,count => 10}. get(2) -> #{id => 2,count => 10}. get(3) -> #{id => 3,count => 10}. get(4) -> #{id => 4,count => 10}. get(5) -> #{id => 5,count => 10}. get(6) -> #{id => 6,count => 10}. get(7) -> #{id => 7,count => 10}. get(8) -> #{id => 8,count => 10}. get(9) -> #{id => 9,count => 10}. get(10) -> #{id => 10,count => 10}. <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/item/DesignDrawing.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.item { public sealed partial class DesignDrawing : item.ItemExtra { public DesignDrawing(ByteBuf _buf) : base(_buf) { {int n = System.Math.Min(_buf.ReadSize(), _buf.Size);LearnComponentId = new System.Collections.Generic.List<int>(n);for(var i = 0 ; i < n ; i++) { int _e; _e = _buf.ReadInt(); LearnComponentId.Add(_e);}} } public DesignDrawing(int id, System.Collections.Generic.List<int> learn_component_id ) : base(id) { this.LearnComponentId = learn_component_id; } public static DesignDrawing DeserializeDesignDrawing(ByteBuf _buf) { return new item.DesignDrawing(_buf); } public readonly System.Collections.Generic.List<int> LearnComponentId; public const int ID = -1679179579; public override int GetTypeId() => ID; public override void Resolve(Dictionary<string, object> _tables) { base.Resolve(_tables); OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); public override string ToString() { return "{ " + "Id:" + Id + "," + "LearnComponentId:" + Bright.Common.StringUtil.CollectionToString(LearnComponentId) + "," + "}"; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_SliderJoint2D_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_SliderJoint2D_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.SliderJoint2D(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.SliderJoint2D), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetMotorForce(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SliderJoint2D; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetFloat(false); var result = obj.GetMotorForce(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_autoConfigureAngle(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SliderJoint2D; var result = obj.autoConfigureAngle; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_autoConfigureAngle(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SliderJoint2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.autoConfigureAngle = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_angle(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SliderJoint2D; var result = obj.angle; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_angle(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SliderJoint2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.angle = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_useMotor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SliderJoint2D; var result = obj.useMotor; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_useMotor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SliderJoint2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.useMotor = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_useLimits(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SliderJoint2D; var result = obj.useLimits; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_useLimits(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SliderJoint2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.useLimits = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_motor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SliderJoint2D; var result = obj.motor; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_motor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SliderJoint2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.motor = argHelper.Get<UnityEngine.JointMotor2D>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_limits(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SliderJoint2D; var result = obj.limits; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_limits(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SliderJoint2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.limits = argHelper.Get<UnityEngine.JointTranslationLimits2D>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_limitState(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SliderJoint2D; var result = obj.limitState; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_referenceAngle(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SliderJoint2D; var result = obj.referenceAngle; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_jointTranslation(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SliderJoint2D; var result = obj.jointTranslation; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_jointSpeed(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.SliderJoint2D; var result = obj.jointSpeed; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "GetMotorForce", IsStatic = false}, M_GetMotorForce }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"autoConfigureAngle", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_autoConfigureAngle, Setter = S_autoConfigureAngle} }, {"angle", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_angle, Setter = S_angle} }, {"useMotor", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_useMotor, Setter = S_useMotor} }, {"useLimits", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_useLimits, Setter = S_useLimits} }, {"motor", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_motor, Setter = S_motor} }, {"limits", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_limits, Setter = S_limits} }, {"limitState", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_limitState, Setter = null} }, {"referenceAngle", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_referenceAngle, Setter = null} }, {"jointTranslation", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_jointTranslation, Setter = null} }, {"jointSpeed", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_jointSpeed, Setter = null} }, } }; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_ControllerColliderHit_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_ControllerColliderHit_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.ControllerColliderHit(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.ControllerColliderHit), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_controller(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ControllerColliderHit; var result = obj.controller; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_collider(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ControllerColliderHit; var result = obj.collider; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_rigidbody(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ControllerColliderHit; var result = obj.rigidbody; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_gameObject(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ControllerColliderHit; var result = obj.gameObject; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_transform(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ControllerColliderHit; var result = obj.transform; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_point(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ControllerColliderHit; var result = obj.point; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_normal(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ControllerColliderHit; var result = obj.normal; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_moveDirection(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ControllerColliderHit; var result = obj.moveDirection; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_moveLength(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.ControllerColliderHit; var result = obj.moveLength; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"controller", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_controller, Setter = null} }, {"collider", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_collider, Setter = null} }, {"rigidbody", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_rigidbody, Setter = null} }, {"gameObject", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_gameObject, Setter = null} }, {"transform", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_transform, Setter = null} }, {"point", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_point, Setter = null} }, {"normal", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_normal, Setter = null} }, {"moveDirection", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_moveDirection, Setter = null} }, {"moveLength", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_moveLength, Setter = null} }, } }; } } } <|start_filename|>Projects/Go_json/gen/src/cfg/ai.UeSetDefaultFocus.go<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg import "errors" type AiUeSetDefaultFocus struct { Id int32 NodeName string KeyboardKey string } const TypeId_AiUeSetDefaultFocus = 1812449155 func (*AiUeSetDefaultFocus) GetTypeId() int32 { return 1812449155 } func (_v *AiUeSetDefaultFocus)Deserialize(_buf map[string]interface{}) (err error) { { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["id"].(float64); !_ok_ { err = errors.New("id error"); return }; _v.Id = int32(_tempNum_) } { var _ok_ bool; if _v.NodeName, _ok_ = _buf["node_name"].(string); !_ok_ { err = errors.New("node_name error"); return } } { var _ok_ bool; if _v.KeyboardKey, _ok_ = _buf["keyboard_key"].(string); !_ok_ { err = errors.New("keyboard_key error"); return } } return } func DeserializeAiUeSetDefaultFocus(_buf map[string]interface{}) (*AiUeSetDefaultFocus, error) { v := &AiUeSetDefaultFocus{} if err := v.Deserialize(_buf); err == nil { return v, nil } else { return nil, err } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_GUISettings_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_GUISettings_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.GUISettings(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.GUISettings), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_doubleClickSelectsWord(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUISettings; var result = obj.doubleClickSelectsWord; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_doubleClickSelectsWord(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUISettings; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.doubleClickSelectsWord = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_tripleClickSelectsLine(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUISettings; var result = obj.tripleClickSelectsLine; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_tripleClickSelectsLine(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUISettings; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.tripleClickSelectsLine = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_cursorColor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUISettings; var result = obj.cursorColor; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_cursorColor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUISettings; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.cursorColor = argHelper.Get<UnityEngine.Color>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_cursorFlashSpeed(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUISettings; var result = obj.cursorFlashSpeed; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_cursorFlashSpeed(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUISettings; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.cursorFlashSpeed = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_selectionColor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUISettings; var result = obj.selectionColor; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_selectionColor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.GUISettings; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.selectionColor = argHelper.Get<UnityEngine.Color>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"doubleClickSelectsWord", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_doubleClickSelectsWord, Setter = S_doubleClickSelectsWord} }, {"tripleClickSelectsLine", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_tripleClickSelectsLine, Setter = S_tripleClickSelectsLine} }, {"cursorColor", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_cursorColor, Setter = S_cursorColor} }, {"cursorFlashSpeed", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_cursorFlashSpeed, Setter = S_cursorFlashSpeed} }, {"selectionColor", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_selectionColor, Setter = S_selectionColor} }, } }; } } } <|start_filename|>Projects/Java_bin/src/main/gen/cfg/test/TestNull.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.test; import bright.serialization.*; public final class TestNull { public TestNull(ByteBuf _buf) { id = _buf.readInt(); if(_buf.readBool()){ x1 = _buf.readInt(); } else { x1 = null; } if(_buf.readBool()){ x2 = cfg.test.DemoEnum.valueOf(_buf.readInt()); } else { x2 = null; } if(_buf.readBool()){ x3 = new cfg.test.DemoType1(_buf); } else { x3 = null; } if(_buf.readBool()){ x4 = cfg.test.DemoDynamic.deserializeDemoDynamic(_buf); } else { x4 = null; } if(_buf.readBool()){ s1 = _buf.readString(); } else { s1 = null; } if(_buf.readBool()){ _buf.readString(); s2 = _buf.readString(); } else { s2 = null; } } public TestNull(int id, Integer x1, cfg.test.DemoEnum x2, cfg.test.DemoType1 x3, cfg.test.DemoDynamic x4, String s1, String s2 ) { this.id = id; this.x1 = x1; this.x2 = x2; this.x3 = x3; this.x4 = x4; this.s1 = s1; this.s2 = s2; } public final int id; public final Integer x1; public final cfg.test.DemoEnum x2; public final cfg.test.DemoType1 x3; public final cfg.test.DemoDynamic x4; public final String s1; public final String s2; public void resolve(java.util.HashMap<String, Object> _tables) { if (x3 != null) {x3.resolve(_tables);} if (x4 != null) {x4.resolve(_tables);} } @Override public String toString() { return "{ " + "id:" + id + "," + "x1:" + x1 + "," + "x2:" + x2 + "," + "x3:" + x3 + "," + "x4:" + x4 + "," + "s1:" + s1 + "," + "s2:" + s2 + "," + "}"; } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_Renderer_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_Renderer_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.Renderer(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.Renderer), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_HasPropertyBlock(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Renderer; { { var result = obj.HasPropertyBlock(); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetPropertyBlock(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Renderer; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.MaterialPropertyBlock), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.MaterialPropertyBlock>(false); obj.SetPropertyBlock(Arg0); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.MaterialPropertyBlock), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.MaterialPropertyBlock>(false); var Arg1 = argHelper1.GetInt32(false); obj.SetPropertyBlock(Arg0,Arg1); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SetPropertyBlock"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetPropertyBlock(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Renderer; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.MaterialPropertyBlock), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.MaterialPropertyBlock>(false); obj.GetPropertyBlock(Arg0); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.MaterialPropertyBlock), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.MaterialPropertyBlock>(false); var Arg1 = argHelper1.GetInt32(false); obj.GetPropertyBlock(Arg0,Arg1); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetPropertyBlock"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetMaterials(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Renderer; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.Collections.Generic.List<UnityEngine.Material>>(false); obj.GetMaterials(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetSharedMaterials(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Renderer; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.Collections.Generic.List<UnityEngine.Material>>(false); obj.GetSharedMaterials(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetClosestReflectionProbes(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Renderer; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.Collections.Generic.List<UnityEngine.Rendering.ReflectionProbeBlendInfo>>(false); obj.GetClosestReflectionProbes(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_bounds(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Renderer; var result = obj.bounds; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_enabled(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Renderer; var result = obj.enabled; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_enabled(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Renderer; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.enabled = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_isVisible(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Renderer; var result = obj.isVisible; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_shadowCastingMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Renderer; var result = obj.shadowCastingMode; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_shadowCastingMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Renderer; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.shadowCastingMode = (UnityEngine.Rendering.ShadowCastingMode)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_receiveShadows(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Renderer; var result = obj.receiveShadows; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_receiveShadows(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Renderer; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.receiveShadows = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_forceRenderingOff(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Renderer; var result = obj.forceRenderingOff; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_forceRenderingOff(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Renderer; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.forceRenderingOff = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_motionVectorGenerationMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Renderer; var result = obj.motionVectorGenerationMode; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_motionVectorGenerationMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Renderer; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.motionVectorGenerationMode = (UnityEngine.MotionVectorGenerationMode)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_lightProbeUsage(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Renderer; var result = obj.lightProbeUsage; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_lightProbeUsage(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Renderer; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.lightProbeUsage = (UnityEngine.Rendering.LightProbeUsage)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_reflectionProbeUsage(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Renderer; var result = obj.reflectionProbeUsage; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_reflectionProbeUsage(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Renderer; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.reflectionProbeUsage = (UnityEngine.Rendering.ReflectionProbeUsage)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_renderingLayerMask(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Renderer; var result = obj.renderingLayerMask; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_renderingLayerMask(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Renderer; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.renderingLayerMask = argHelper.GetUInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_rendererPriority(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Renderer; var result = obj.rendererPriority; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_rendererPriority(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Renderer; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.rendererPriority = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_rayTracingMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Renderer; var result = obj.rayTracingMode; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_rayTracingMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Renderer; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.rayTracingMode = (UnityEngine.Experimental.Rendering.RayTracingMode)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_sortingLayerName(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Renderer; var result = obj.sortingLayerName; Puerts.PuertsDLL.ReturnString(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_sortingLayerName(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Renderer; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.sortingLayerName = argHelper.GetString(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_sortingLayerID(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Renderer; var result = obj.sortingLayerID; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_sortingLayerID(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Renderer; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.sortingLayerID = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_sortingOrder(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Renderer; var result = obj.sortingOrder; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_sortingOrder(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Renderer; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.sortingOrder = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_allowOcclusionWhenDynamic(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Renderer; var result = obj.allowOcclusionWhenDynamic; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_allowOcclusionWhenDynamic(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Renderer; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.allowOcclusionWhenDynamic = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_isPartOfStaticBatch(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Renderer; var result = obj.isPartOfStaticBatch; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_worldToLocalMatrix(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Renderer; var result = obj.worldToLocalMatrix; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_localToWorldMatrix(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Renderer; var result = obj.localToWorldMatrix; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_lightProbeProxyVolumeOverride(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Renderer; var result = obj.lightProbeProxyVolumeOverride; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_lightProbeProxyVolumeOverride(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Renderer; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.lightProbeProxyVolumeOverride = argHelper.Get<UnityEngine.GameObject>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_probeAnchor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Renderer; var result = obj.probeAnchor; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_probeAnchor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Renderer; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.probeAnchor = argHelper.Get<UnityEngine.Transform>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_lightmapIndex(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Renderer; var result = obj.lightmapIndex; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_lightmapIndex(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Renderer; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.lightmapIndex = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_realtimeLightmapIndex(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Renderer; var result = obj.realtimeLightmapIndex; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_realtimeLightmapIndex(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Renderer; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.realtimeLightmapIndex = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_lightmapScaleOffset(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Renderer; var result = obj.lightmapScaleOffset; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_lightmapScaleOffset(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Renderer; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.lightmapScaleOffset = argHelper.Get<UnityEngine.Vector4>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_realtimeLightmapScaleOffset(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Renderer; var result = obj.realtimeLightmapScaleOffset; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_realtimeLightmapScaleOffset(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Renderer; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.realtimeLightmapScaleOffset = argHelper.Get<UnityEngine.Vector4>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_materials(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Renderer; var result = obj.materials; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_materials(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Renderer; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.materials = argHelper.Get<UnityEngine.Material[]>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_material(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Renderer; var result = obj.material; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_material(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Renderer; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.material = argHelper.Get<UnityEngine.Material>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_sharedMaterial(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Renderer; var result = obj.sharedMaterial; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_sharedMaterial(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Renderer; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.sharedMaterial = argHelper.Get<UnityEngine.Material>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_sharedMaterials(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Renderer; var result = obj.sharedMaterials; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_sharedMaterials(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Renderer; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.sharedMaterials = argHelper.Get<UnityEngine.Material[]>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "HasPropertyBlock", IsStatic = false}, M_HasPropertyBlock }, { new Puerts.MethodKey {Name = "SetPropertyBlock", IsStatic = false}, M_SetPropertyBlock }, { new Puerts.MethodKey {Name = "GetPropertyBlock", IsStatic = false}, M_GetPropertyBlock }, { new Puerts.MethodKey {Name = "GetMaterials", IsStatic = false}, M_GetMaterials }, { new Puerts.MethodKey {Name = "GetSharedMaterials", IsStatic = false}, M_GetSharedMaterials }, { new Puerts.MethodKey {Name = "GetClosestReflectionProbes", IsStatic = false}, M_GetClosestReflectionProbes }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"bounds", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_bounds, Setter = null} }, {"enabled", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_enabled, Setter = S_enabled} }, {"isVisible", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_isVisible, Setter = null} }, {"shadowCastingMode", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_shadowCastingMode, Setter = S_shadowCastingMode} }, {"receiveShadows", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_receiveShadows, Setter = S_receiveShadows} }, {"forceRenderingOff", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_forceRenderingOff, Setter = S_forceRenderingOff} }, {"motionVectorGenerationMode", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_motionVectorGenerationMode, Setter = S_motionVectorGenerationMode} }, {"lightProbeUsage", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_lightProbeUsage, Setter = S_lightProbeUsage} }, {"reflectionProbeUsage", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_reflectionProbeUsage, Setter = S_reflectionProbeUsage} }, {"renderingLayerMask", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_renderingLayerMask, Setter = S_renderingLayerMask} }, {"rendererPriority", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_rendererPriority, Setter = S_rendererPriority} }, {"rayTracingMode", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_rayTracingMode, Setter = S_rayTracingMode} }, {"sortingLayerName", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_sortingLayerName, Setter = S_sortingLayerName} }, {"sortingLayerID", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_sortingLayerID, Setter = S_sortingLayerID} }, {"sortingOrder", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_sortingOrder, Setter = S_sortingOrder} }, {"allowOcclusionWhenDynamic", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_allowOcclusionWhenDynamic, Setter = S_allowOcclusionWhenDynamic} }, {"isPartOfStaticBatch", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_isPartOfStaticBatch, Setter = null} }, {"worldToLocalMatrix", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_worldToLocalMatrix, Setter = null} }, {"localToWorldMatrix", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_localToWorldMatrix, Setter = null} }, {"lightProbeProxyVolumeOverride", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_lightProbeProxyVolumeOverride, Setter = S_lightProbeProxyVolumeOverride} }, {"probeAnchor", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_probeAnchor, Setter = S_probeAnchor} }, {"lightmapIndex", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_lightmapIndex, Setter = S_lightmapIndex} }, {"realtimeLightmapIndex", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_realtimeLightmapIndex, Setter = S_realtimeLightmapIndex} }, {"lightmapScaleOffset", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_lightmapScaleOffset, Setter = S_lightmapScaleOffset} }, {"realtimeLightmapScaleOffset", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_realtimeLightmapScaleOffset, Setter = S_realtimeLightmapScaleOffset} }, {"materials", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_materials, Setter = S_materials} }, {"material", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_material, Setter = S_material} }, {"sharedMaterial", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_sharedMaterial, Setter = S_sharedMaterial} }, {"sharedMaterials", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_sharedMaterials, Setter = S_sharedMaterials} }, } }; } } } <|start_filename|>Projects/Go_json/gen/src/cfg/ai.Node.go<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg import "errors" type AiNode struct { Id int32 NodeName string } const TypeId_AiNode = -1055479768 func (*AiNode) GetTypeId() int32 { return -1055479768 } func (_v *AiNode)Deserialize(_buf map[string]interface{}) (err error) { { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["id"].(float64); !_ok_ { err = errors.New("id error"); return }; _v.Id = int32(_tempNum_) } { var _ok_ bool; if _v.NodeName, _ok_ = _buf["node_name"].(string); !_ok_ { err = errors.New("node_name error"); return } } return } func DeserializeAiNode(_buf map[string]interface{}) (interface{}, error) { var id string var _ok_ bool if id, _ok_ = _buf["__type__"].(string) ; !_ok_ { return nil, errors.New("type id missing") } switch id { case "UeSetDefaultFocus": _v := &AiUeSetDefaultFocus{}; if err := _v.Deserialize(_buf); err != nil { return nil, errors.New("ai.UeSetDefaultFocus") } else { return _v, nil } case "ExecuteTimeStatistic": _v := &AiExecuteTimeStatistic{}; if err := _v.Deserialize(_buf); err != nil { return nil, errors.New("ai.ExecuteTimeStatistic") } else { return _v, nil } case "ChooseTarget": _v := &AiChooseTarget{}; if err := _v.Deserialize(_buf); err != nil { return nil, errors.New("ai.ChooseTarget") } else { return _v, nil } case "KeepFaceTarget": _v := &AiKeepFaceTarget{}; if err := _v.Deserialize(_buf); err != nil { return nil, errors.New("ai.KeepFaceTarget") } else { return _v, nil } case "GetOwnerPlayer": _v := &AiGetOwnerPlayer{}; if err := _v.Deserialize(_buf); err != nil { return nil, errors.New("ai.GetOwnerPlayer") } else { return _v, nil } case "UpdateDailyBehaviorProps": _v := &AiUpdateDailyBehaviorProps{}; if err := _v.Deserialize(_buf); err != nil { return nil, errors.New("ai.UpdateDailyBehaviorProps") } else { return _v, nil } case "UeLoop": _v := &AiUeLoop{}; if err := _v.Deserialize(_buf); err != nil { return nil, errors.New("ai.UeLoop") } else { return _v, nil } case "UeCooldown": _v := &AiUeCooldown{}; if err := _v.Deserialize(_buf); err != nil { return nil, errors.New("ai.UeCooldown") } else { return _v, nil } case "UeTimeLimit": _v := &AiUeTimeLimit{}; if err := _v.Deserialize(_buf); err != nil { return nil, errors.New("ai.UeTimeLimit") } else { return _v, nil } case "UeBlackboard": _v := &AiUeBlackboard{}; if err := _v.Deserialize(_buf); err != nil { return nil, errors.New("ai.UeBlackboard") } else { return _v, nil } case "UeForceSuccess": _v := &AiUeForceSuccess{}; if err := _v.Deserialize(_buf); err != nil { return nil, errors.New("ai.UeForceSuccess") } else { return _v, nil } case "IsAtLocation": _v := &AiIsAtLocation{}; if err := _v.Deserialize(_buf); err != nil { return nil, errors.New("ai.IsAtLocation") } else { return _v, nil } case "DistanceLessThan": _v := &AiDistanceLessThan{}; if err := _v.Deserialize(_buf); err != nil { return nil, errors.New("ai.DistanceLessThan") } else { return _v, nil } case "Sequence": _v := &AiSequence{}; if err := _v.Deserialize(_buf); err != nil { return nil, errors.New("ai.Sequence") } else { return _v, nil } case "Selector": _v := &AiSelector{}; if err := _v.Deserialize(_buf); err != nil { return nil, errors.New("ai.Selector") } else { return _v, nil } case "SimpleParallel": _v := &AiSimpleParallel{}; if err := _v.Deserialize(_buf); err != nil { return nil, errors.New("ai.SimpleParallel") } else { return _v, nil } case "UeWait": _v := &AiUeWait{}; if err := _v.Deserialize(_buf); err != nil { return nil, errors.New("ai.UeWait") } else { return _v, nil } case "UeWaitBlackboardTime": _v := &AiUeWaitBlackboardTime{}; if err := _v.Deserialize(_buf); err != nil { return nil, errors.New("ai.UeWaitBlackboardTime") } else { return _v, nil } case "MoveToTarget": _v := &AiMoveToTarget{}; if err := _v.Deserialize(_buf); err != nil { return nil, errors.New("ai.MoveToTarget") } else { return _v, nil } case "ChooseSkill": _v := &AiChooseSkill{}; if err := _v.Deserialize(_buf); err != nil { return nil, errors.New("ai.ChooseSkill") } else { return _v, nil } case "MoveToRandomLocation": _v := &AiMoveToRandomLocation{}; if err := _v.Deserialize(_buf); err != nil { return nil, errors.New("ai.MoveToRandomLocation") } else { return _v, nil } case "MoveToLocation": _v := &AiMoveToLocation{}; if err := _v.Deserialize(_buf); err != nil { return nil, errors.New("ai.MoveToLocation") } else { return _v, nil } case "DebugPrint": _v := &AiDebugPrint{}; if err := _v.Deserialize(_buf); err != nil { return nil, errors.New("ai.DebugPrint") } else { return _v, nil } default: return nil, errors.New("unknown type id") } } <|start_filename|>Projects/Java_bin/src/main/gen/cfg/blueprint/EnumField.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.blueprint; import bright.serialization.*; public final class EnumField { public EnumField(ByteBuf _buf) { name = _buf.readString(); value = _buf.readInt(); } public EnumField(String name, int value ) { this.name = name; this.value = value; } public final String name; public final int value; public void resolve(java.util.HashMap<String, Object> _tables) { } @Override public String toString() { return "{ " + "name:" + name + "," + "value:" + value + "," + "}"; } } <|start_filename|>Projects/GenerateDatas/convert_lua/test.TbDemoPrimitive/5.lua<|end_filename|> return { x1 = true, x2 = 1, x3 = 2, x4 = 5, x5 = 4, x6 = 5, x7 = 6, s1 = "nihao", s2 = {key='/test/key3',text="测试本地化字符串3"}, v2 = {x=4,y=5}, v3 = {x=2.2,y=2.3,z=3.5}, v4 = {x=4.5,y=5.6,z=6.8,w=9.9}, t1 = 2000-1-4 00:04:59, } <|start_filename|>Projects/Csharp_CustomTemplate_EncryptMemory/Gen/test/TestRef.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using System; using Newtonsoft.Json; using Scripts; namespace cfg.test { [Serializable] public partial class TestRef : AConfig { [JsonProperty("x1")] private int _x1 { get; set; } [JsonIgnore] public EncryptInt x1 { get; private set; } = new(); [JsonProperty("x1_2")] private int _x1_2 { get; set; } [JsonIgnore] public EncryptInt x1_2 { get; private set; } = new(); [JsonProperty("x2")] private int _x2 { get; set; } [JsonIgnore] public EncryptInt x2 { get; private set; } = new(); public int[] a1 { get; set; } public int[] a2 { get; set; } public System.Collections.Generic.List<int> b1 { get; set; } public System.Collections.Generic.List<int> b2 { get; set; } public System.Collections.Generic.HashSet<int> c1 { get; set; } public System.Collections.Generic.HashSet<int> c2 { get; set; } public System.Collections.Generic.Dictionary<int, int> d1 { get; set; } public System.Collections.Generic.Dictionary<int, int> d2 { get; set; } [JsonProperty("e1")] private int _e1 { get; set; } [JsonIgnore] public EncryptInt e1 { get; private set; } = new(); [JsonProperty("e2")] private long _e2 { get; set; } [JsonIgnore] public EncryptLong e2 { get; private set; } = new(); public string e3 { get; set; } [JsonProperty("f1")] private int _f1 { get; set; } [JsonIgnore] public EncryptInt f1 { get; private set; } = new(); [JsonProperty("f2")] private long _f2 { get; set; } [JsonIgnore] public EncryptLong f2 { get; private set; } = new(); public string f3 { get; set; } public override void EndInit() { x1 = _x1; x1_2 = _x1_2; x2 = _x2; e1 = _e1; e2 = _e2; f1 = _f1; f2 = _f2; } public override string ToString() => JsonConvert.SerializeObject(this); } } <|start_filename|>Projects/Csharp_CustomTemplate_EncryptMemory/Gen/test/TestString.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using System; using Newtonsoft.Json; using Scripts; namespace cfg.test { [Serializable] public partial class TestString : AConfig { public string s1 { get; set; } [JsonProperty] public test.CompactString cs1 { get; set; } [JsonProperty] public test.CompactString cs2 { get; set; } public override void EndInit() { cs1.EndInit(); cs2.EndInit(); } public override string ToString() => JsonConvert.SerializeObject(this); } } <|start_filename|>Projects/Go_json/gen/src/cfg/role.LevelExpAttr.go<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg import "errors" type RoleLevelExpAttr struct { Level int32 NeedExp int64 ClothesAttrs []int32 } const TypeId_RoleLevelExpAttr = -1569837022 func (*RoleLevelExpAttr) GetTypeId() int32 { return -1569837022 } func (_v *RoleLevelExpAttr)Deserialize(_buf map[string]interface{}) (err error) { { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["level"].(float64); !_ok_ { err = errors.New("level error"); return }; _v.Level = int32(_tempNum_) } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["need_exp"].(float64); !_ok_ { err = errors.New("need_exp error"); return }; _v.NeedExp = int64(_tempNum_) } { var _arr_ []interface{} var _ok_ bool if _arr_, _ok_ = _buf["clothes_attrs"].([]interface{}); !_ok_ { err = errors.New("clothes_attrs error"); return } _v.ClothesAttrs = make([]int32, 0, len(_arr_)) for _, _e_ := range _arr_ { var _list_v_ int32 { var _ok_ bool; var _x_ float64; if _x_, _ok_ = _e_.(float64); !_ok_ { err = errors.New("_list_v_ error"); return }; _list_v_ = int32(_x_) } _v.ClothesAttrs = append(_v.ClothesAttrs, _list_v_) } } return } func DeserializeRoleLevelExpAttr(_buf map[string]interface{}) (*RoleLevelExpAttr, error) { v := &RoleLevelExpAttr{} if err := v.Deserialize(_buf); err == nil { return v, nil } else { return nil, err } } <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/bonus/WeightBonusInfo.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.bonus { public sealed partial class WeightBonusInfo : Bright.Config.BeanBase { public WeightBonusInfo(ByteBuf _buf) { Bonus = bonus.Bonus.DeserializeBonus(_buf); Weight = _buf.ReadInt(); } public WeightBonusInfo(bonus.Bonus bonus, int weight ) { this.Bonus = bonus; this.Weight = weight; } public static WeightBonusInfo DeserializeWeightBonusInfo(ByteBuf _buf) { return new bonus.WeightBonusInfo(_buf); } public readonly bonus.Bonus Bonus; public readonly int Weight; public const int ID = -907244058; public override int GetTypeId() => ID; public void Resolve(Dictionary<string, object> _tables) { Bonus?.Resolve(_tables); OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); public override string ToString() { return "{ " + "Bonus:" + Bonus + "," + "Weight:" + Weight + "," + "}"; } } } <|start_filename|>Projects/Java_bin/src/main/gen/cfg/mail/GlobalMail.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.mail; import bright.serialization.*; public final class GlobalMail { public GlobalMail(ByteBuf _buf) { id = _buf.readInt(); title = _buf.readString(); sender = _buf.readString(); content = _buf.readString(); {int n = Math.min(_buf.readSize(), _buf.size());award = new java.util.ArrayList<Integer>(n);for(int i = 0 ; i < n ; i++) { Integer _e; _e = _buf.readInt(); award.add(_e);}} allServer = _buf.readBool(); {int n = Math.min(_buf.readSize(), _buf.size());serverList = new java.util.ArrayList<Integer>(n);for(int i = 0 ; i < n ; i++) { Integer _e; _e = _buf.readInt(); serverList.add(_e);}} platform = _buf.readString(); channel = _buf.readString(); minMaxLevel = new cfg.condition.MinMaxLevel(_buf); registerTime = new cfg.condition.TimeRange(_buf); mailTime = new cfg.condition.TimeRange(_buf); } public GlobalMail(int id, String title, String sender, String content, java.util.ArrayList<Integer> award, boolean all_server, java.util.ArrayList<Integer> server_list, String platform, String channel, cfg.condition.MinMaxLevel min_max_level, cfg.condition.TimeRange register_time, cfg.condition.TimeRange mail_time ) { this.id = id; this.title = title; this.sender = sender; this.content = content; this.award = award; this.allServer = all_server; this.serverList = server_list; this.platform = platform; this.channel = channel; this.minMaxLevel = min_max_level; this.registerTime = register_time; this.mailTime = mail_time; } public final int id; public final String title; public final String sender; public final String content; public final java.util.ArrayList<Integer> award; public final boolean allServer; public final java.util.ArrayList<Integer> serverList; public final String platform; public final String channel; public final cfg.condition.MinMaxLevel minMaxLevel; public final cfg.condition.TimeRange registerTime; public final cfg.condition.TimeRange mailTime; public void resolve(java.util.HashMap<String, Object> _tables) { if (minMaxLevel != null) {minMaxLevel.resolve(_tables);} if (registerTime != null) {registerTime.resolve(_tables);} if (mailTime != null) {mailTime.resolve(_tables);} } @Override public String toString() { return "{ " + "id:" + id + "," + "title:" + title + "," + "sender:" + sender + "," + "content:" + content + "," + "award:" + award + "," + "allServer:" + allServer + "," + "serverList:" + serverList + "," + "platform:" + platform + "," + "channel:" + channel + "," + "minMaxLevel:" + minMaxLevel + "," + "registerTime:" + registerTime + "," + "mailTime:" + mailTime + "," + "}"; } } <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/blueprint/EnumClazz.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.blueprint { public sealed partial class EnumClazz : blueprint.Clazz { public EnumClazz(ByteBuf _buf) : base(_buf) { {int n = System.Math.Min(_buf.ReadSize(), _buf.Size);Enums = new System.Collections.Generic.List<blueprint.EnumField>(n);for(var i = 0 ; i < n ; i++) { blueprint.EnumField _e; _e = blueprint.EnumField.DeserializeEnumField(_buf); Enums.Add(_e);}} } public EnumClazz(string name, string desc, System.Collections.Generic.List<blueprint.Clazz> parents, System.Collections.Generic.List<blueprint.Method> methods, System.Collections.Generic.List<blueprint.EnumField> enums ) : base(name,desc,parents,methods) { this.Enums = enums; } public static EnumClazz DeserializeEnumClazz(ByteBuf _buf) { return new blueprint.EnumClazz(_buf); } public readonly System.Collections.Generic.List<blueprint.EnumField> Enums; public const int ID = 1827364892; public override int GetTypeId() => ID; public override void Resolve(Dictionary<string, object> _tables) { base.Resolve(_tables); foreach(var _e in Enums) { _e?.Resolve(_tables); } OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); public override string ToString() { return "{ " + "Name:" + Name + "," + "Desc:" + Desc + "," + "Parents:" + Bright.Common.StringUtil.CollectionToString(Parents) + "," + "Methods:" + Bright.Common.StringUtil.CollectionToString(Methods) + "," + "Enums:" + Bright.Common.StringUtil.CollectionToString(Enums) + "," + "}"; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Bin/Assets/Gen/UnityEngine_Shader_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_Shader_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.Shader constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_Find(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetString(false); var result = UnityEngine.Shader.Find(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_EnableKeyword(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetString(false); UnityEngine.Shader.EnableKeyword(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_DisableKeyword(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetString(false); UnityEngine.Shader.DisableKeyword(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_IsKeywordEnabled(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetString(false); var result = UnityEngine.Shader.IsKeywordEnabled(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_WarmupAllShaders(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { { UnityEngine.Shader.WarmupAllShaders(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_PropertyToID(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetString(false); var result = UnityEngine.Shader.PropertyToID(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetDependency(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Shader; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetString(false); var result = obj.GetDependency(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_FindPassTagValue(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Shader; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.Rendering.ShaderTagId>(false); var result = obj.FindPassTagValue(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_SetGlobalInt(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.GetInt32(false); UnityEngine.Shader.SetGlobalInt(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); UnityEngine.Shader.SetGlobalInt(Arg0,Arg1); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SetGlobalInt"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_SetGlobalFloat(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.GetFloat(false); UnityEngine.Shader.SetGlobalFloat(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetFloat(false); UnityEngine.Shader.SetGlobalFloat(Arg0,Arg1); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SetGlobalFloat"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_SetGlobalInteger(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.GetInt32(false); UnityEngine.Shader.SetGlobalInteger(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); UnityEngine.Shader.SetGlobalInteger(Arg0,Arg1); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SetGlobalInteger"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_SetGlobalVector(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector4), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<UnityEngine.Vector4>(false); UnityEngine.Shader.SetGlobalVector(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector4), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.Vector4>(false); UnityEngine.Shader.SetGlobalVector(Arg0,Arg1); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SetGlobalVector"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_SetGlobalColor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Color), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<UnityEngine.Color>(false); UnityEngine.Shader.SetGlobalColor(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Color), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.Color>(false); UnityEngine.Shader.SetGlobalColor(Arg0,Arg1); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SetGlobalColor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_SetGlobalMatrix(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Matrix4x4), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<UnityEngine.Matrix4x4>(false); UnityEngine.Shader.SetGlobalMatrix(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Matrix4x4), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.Matrix4x4>(false); UnityEngine.Shader.SetGlobalMatrix(Arg0,Arg1); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SetGlobalMatrix"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_SetGlobalTexture(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<UnityEngine.Texture>(false); UnityEngine.Shader.SetGlobalTexture(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.Texture>(false); UnityEngine.Shader.SetGlobalTexture(Arg0,Arg1); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RenderTexture), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<UnityEngine.RenderTexture>(false); var Arg2 = (UnityEngine.Rendering.RenderTextureSubElement)argHelper2.GetInt32(false); UnityEngine.Shader.SetGlobalTexture(Arg0,Arg1,Arg2); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.RenderTexture), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.RenderTexture>(false); var Arg2 = (UnityEngine.Rendering.RenderTextureSubElement)argHelper2.GetInt32(false); UnityEngine.Shader.SetGlobalTexture(Arg0,Arg1,Arg2); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SetGlobalTexture"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_SetGlobalBuffer(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.ComputeBuffer), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<UnityEngine.ComputeBuffer>(false); UnityEngine.Shader.SetGlobalBuffer(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.ComputeBuffer), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.ComputeBuffer>(false); UnityEngine.Shader.SetGlobalBuffer(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GraphicsBuffer), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<UnityEngine.GraphicsBuffer>(false); UnityEngine.Shader.SetGlobalBuffer(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GraphicsBuffer), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.GraphicsBuffer>(false); UnityEngine.Shader.SetGlobalBuffer(Arg0,Arg1); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SetGlobalBuffer"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_SetGlobalConstantBuffer(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.ComputeBuffer), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<UnityEngine.ComputeBuffer>(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetInt32(false); UnityEngine.Shader.SetGlobalConstantBuffer(Arg0,Arg1,Arg2,Arg3); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.ComputeBuffer), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.ComputeBuffer>(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetInt32(false); UnityEngine.Shader.SetGlobalConstantBuffer(Arg0,Arg1,Arg2,Arg3); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GraphicsBuffer), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<UnityEngine.GraphicsBuffer>(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetInt32(false); UnityEngine.Shader.SetGlobalConstantBuffer(Arg0,Arg1,Arg2,Arg3); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GraphicsBuffer), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.GraphicsBuffer>(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetInt32(false); UnityEngine.Shader.SetGlobalConstantBuffer(Arg0,Arg1,Arg2,Arg3); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SetGlobalConstantBuffer"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_SetGlobalFloatArray(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<float>), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<System.Collections.Generic.List<float>>(false); UnityEngine.Shader.SetGlobalFloatArray(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<float>), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<System.Collections.Generic.List<float>>(false); UnityEngine.Shader.SetGlobalFloatArray(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(float[]), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<float[]>(false); UnityEngine.Shader.SetGlobalFloatArray(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(float[]), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<float[]>(false); UnityEngine.Shader.SetGlobalFloatArray(Arg0,Arg1); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SetGlobalFloatArray"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_SetGlobalVectorArray(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Vector4>), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<System.Collections.Generic.List<UnityEngine.Vector4>>(false); UnityEngine.Shader.SetGlobalVectorArray(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Vector4>), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<System.Collections.Generic.List<UnityEngine.Vector4>>(false); UnityEngine.Shader.SetGlobalVectorArray(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector4[]), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<UnityEngine.Vector4[]>(false); UnityEngine.Shader.SetGlobalVectorArray(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector4[]), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.Vector4[]>(false); UnityEngine.Shader.SetGlobalVectorArray(Arg0,Arg1); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SetGlobalVectorArray"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_SetGlobalMatrixArray(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Matrix4x4>), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<System.Collections.Generic.List<UnityEngine.Matrix4x4>>(false); UnityEngine.Shader.SetGlobalMatrixArray(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Matrix4x4>), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<System.Collections.Generic.List<UnityEngine.Matrix4x4>>(false); UnityEngine.Shader.SetGlobalMatrixArray(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Matrix4x4[]), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<UnityEngine.Matrix4x4[]>(false); UnityEngine.Shader.SetGlobalMatrixArray(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Matrix4x4[]), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.Matrix4x4[]>(false); UnityEngine.Shader.SetGlobalMatrixArray(Arg0,Arg1); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SetGlobalMatrixArray"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetGlobalInt(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var result = UnityEngine.Shader.GetGlobalInt(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var result = UnityEngine.Shader.GetGlobalInt(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetGlobalInt"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetGlobalFloat(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var result = UnityEngine.Shader.GetGlobalFloat(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var result = UnityEngine.Shader.GetGlobalFloat(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetGlobalFloat"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetGlobalInteger(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var result = UnityEngine.Shader.GetGlobalInteger(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var result = UnityEngine.Shader.GetGlobalInteger(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetGlobalInteger"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetGlobalVector(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var result = UnityEngine.Shader.GetGlobalVector(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var result = UnityEngine.Shader.GetGlobalVector(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetGlobalVector"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetGlobalColor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var result = UnityEngine.Shader.GetGlobalColor(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var result = UnityEngine.Shader.GetGlobalColor(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetGlobalColor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetGlobalMatrix(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var result = UnityEngine.Shader.GetGlobalMatrix(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var result = UnityEngine.Shader.GetGlobalMatrix(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetGlobalMatrix"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetGlobalTexture(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var result = UnityEngine.Shader.GetGlobalTexture(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var result = UnityEngine.Shader.GetGlobalTexture(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetGlobalTexture"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetGlobalFloatArray(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var result = UnityEngine.Shader.GetGlobalFloatArray(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var result = UnityEngine.Shader.GetGlobalFloatArray(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<float>), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<System.Collections.Generic.List<float>>(false); UnityEngine.Shader.GetGlobalFloatArray(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<float>), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<System.Collections.Generic.List<float>>(false); UnityEngine.Shader.GetGlobalFloatArray(Arg0,Arg1); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetGlobalFloatArray"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetGlobalVectorArray(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var result = UnityEngine.Shader.GetGlobalVectorArray(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var result = UnityEngine.Shader.GetGlobalVectorArray(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Vector4>), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<System.Collections.Generic.List<UnityEngine.Vector4>>(false); UnityEngine.Shader.GetGlobalVectorArray(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Vector4>), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<System.Collections.Generic.List<UnityEngine.Vector4>>(false); UnityEngine.Shader.GetGlobalVectorArray(Arg0,Arg1); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetGlobalVectorArray"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetGlobalMatrixArray(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var result = UnityEngine.Shader.GetGlobalMatrixArray(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var result = UnityEngine.Shader.GetGlobalMatrixArray(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Matrix4x4>), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<System.Collections.Generic.List<UnityEngine.Matrix4x4>>(false); UnityEngine.Shader.GetGlobalMatrixArray(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Collections.Generic.List<UnityEngine.Matrix4x4>), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<System.Collections.Generic.List<UnityEngine.Matrix4x4>>(false); UnityEngine.Shader.GetGlobalMatrixArray(Arg0,Arg1); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetGlobalMatrixArray"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetPropertyCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Shader; { { var result = obj.GetPropertyCount(); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_FindPropertyIndex(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Shader; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetString(false); var result = obj.FindPropertyIndex(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetPropertyName(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Shader; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); var result = obj.GetPropertyName(Arg0); Puerts.PuertsDLL.ReturnString(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetPropertyNameId(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Shader; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); var result = obj.GetPropertyNameId(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetPropertyType(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Shader; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); var result = obj.GetPropertyType(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetPropertyDescription(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Shader; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); var result = obj.GetPropertyDescription(Arg0); Puerts.PuertsDLL.ReturnString(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetPropertyFlags(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Shader; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); var result = obj.GetPropertyFlags(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetPropertyAttributes(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Shader; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); var result = obj.GetPropertyAttributes(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetPropertyDefaultFloatValue(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Shader; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); var result = obj.GetPropertyDefaultFloatValue(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetPropertyDefaultVectorValue(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Shader; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); var result = obj.GetPropertyDefaultVectorValue(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetPropertyRangeLimits(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Shader; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); var result = obj.GetPropertyRangeLimits(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetPropertyTextureDimension(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Shader; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); var result = obj.GetPropertyTextureDimension(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetPropertyTextureDefaultName(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Shader; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); var result = obj.GetPropertyTextureDefaultName(Arg0); Puerts.PuertsDLL.ReturnString(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_FindTextureStack(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Shader; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetString(true); var Arg2 = argHelper2.GetInt32(true); var result = obj.FindTextureStack(Arg0,out Arg1,out Arg2); argHelper1.SetByRefValue(Arg1); argHelper2.SetByRefValue(Arg2); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_maximumLOD(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Shader; var result = obj.maximumLOD; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_maximumLOD(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Shader; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.maximumLOD = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_globalMaximumLOD(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Shader.globalMaximumLOD; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_globalMaximumLOD(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.Shader.globalMaximumLOD = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_isSupported(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Shader; var result = obj.isSupported; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_globalRenderPipeline(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Shader.globalRenderPipeline; Puerts.PuertsDLL.ReturnString(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_globalRenderPipeline(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.Shader.globalRenderPipeline = argHelper.GetString(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_renderQueue(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Shader; var result = obj.renderQueue; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_passCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Shader; var result = obj.passCount; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "Find", IsStatic = true}, F_Find }, { new Puerts.MethodKey {Name = "EnableKeyword", IsStatic = true}, F_EnableKeyword }, { new Puerts.MethodKey {Name = "DisableKeyword", IsStatic = true}, F_DisableKeyword }, { new Puerts.MethodKey {Name = "IsKeywordEnabled", IsStatic = true}, F_IsKeywordEnabled }, { new Puerts.MethodKey {Name = "WarmupAllShaders", IsStatic = true}, F_WarmupAllShaders }, { new Puerts.MethodKey {Name = "PropertyToID", IsStatic = true}, F_PropertyToID }, { new Puerts.MethodKey {Name = "GetDependency", IsStatic = false}, M_GetDependency }, { new Puerts.MethodKey {Name = "FindPassTagValue", IsStatic = false}, M_FindPassTagValue }, { new Puerts.MethodKey {Name = "SetGlobalInt", IsStatic = true}, F_SetGlobalInt }, { new Puerts.MethodKey {Name = "SetGlobalFloat", IsStatic = true}, F_SetGlobalFloat }, { new Puerts.MethodKey {Name = "SetGlobalInteger", IsStatic = true}, F_SetGlobalInteger }, { new Puerts.MethodKey {Name = "SetGlobalVector", IsStatic = true}, F_SetGlobalVector }, { new Puerts.MethodKey {Name = "SetGlobalColor", IsStatic = true}, F_SetGlobalColor }, { new Puerts.MethodKey {Name = "SetGlobalMatrix", IsStatic = true}, F_SetGlobalMatrix }, { new Puerts.MethodKey {Name = "SetGlobalTexture", IsStatic = true}, F_SetGlobalTexture }, { new Puerts.MethodKey {Name = "SetGlobalBuffer", IsStatic = true}, F_SetGlobalBuffer }, { new Puerts.MethodKey {Name = "SetGlobalConstantBuffer", IsStatic = true}, F_SetGlobalConstantBuffer }, { new Puerts.MethodKey {Name = "SetGlobalFloatArray", IsStatic = true}, F_SetGlobalFloatArray }, { new Puerts.MethodKey {Name = "SetGlobalVectorArray", IsStatic = true}, F_SetGlobalVectorArray }, { new Puerts.MethodKey {Name = "SetGlobalMatrixArray", IsStatic = true}, F_SetGlobalMatrixArray }, { new Puerts.MethodKey {Name = "GetGlobalInt", IsStatic = true}, F_GetGlobalInt }, { new Puerts.MethodKey {Name = "GetGlobalFloat", IsStatic = true}, F_GetGlobalFloat }, { new Puerts.MethodKey {Name = "GetGlobalInteger", IsStatic = true}, F_GetGlobalInteger }, { new Puerts.MethodKey {Name = "GetGlobalVector", IsStatic = true}, F_GetGlobalVector }, { new Puerts.MethodKey {Name = "GetGlobalColor", IsStatic = true}, F_GetGlobalColor }, { new Puerts.MethodKey {Name = "GetGlobalMatrix", IsStatic = true}, F_GetGlobalMatrix }, { new Puerts.MethodKey {Name = "GetGlobalTexture", IsStatic = true}, F_GetGlobalTexture }, { new Puerts.MethodKey {Name = "GetGlobalFloatArray", IsStatic = true}, F_GetGlobalFloatArray }, { new Puerts.MethodKey {Name = "GetGlobalVectorArray", IsStatic = true}, F_GetGlobalVectorArray }, { new Puerts.MethodKey {Name = "GetGlobalMatrixArray", IsStatic = true}, F_GetGlobalMatrixArray }, { new Puerts.MethodKey {Name = "GetPropertyCount", IsStatic = false}, M_GetPropertyCount }, { new Puerts.MethodKey {Name = "FindPropertyIndex", IsStatic = false}, M_FindPropertyIndex }, { new Puerts.MethodKey {Name = "GetPropertyName", IsStatic = false}, M_GetPropertyName }, { new Puerts.MethodKey {Name = "GetPropertyNameId", IsStatic = false}, M_GetPropertyNameId }, { new Puerts.MethodKey {Name = "GetPropertyType", IsStatic = false}, M_GetPropertyType }, { new Puerts.MethodKey {Name = "GetPropertyDescription", IsStatic = false}, M_GetPropertyDescription }, { new Puerts.MethodKey {Name = "GetPropertyFlags", IsStatic = false}, M_GetPropertyFlags }, { new Puerts.MethodKey {Name = "GetPropertyAttributes", IsStatic = false}, M_GetPropertyAttributes }, { new Puerts.MethodKey {Name = "GetPropertyDefaultFloatValue", IsStatic = false}, M_GetPropertyDefaultFloatValue }, { new Puerts.MethodKey {Name = "GetPropertyDefaultVectorValue", IsStatic = false}, M_GetPropertyDefaultVectorValue }, { new Puerts.MethodKey {Name = "GetPropertyRangeLimits", IsStatic = false}, M_GetPropertyRangeLimits }, { new Puerts.MethodKey {Name = "GetPropertyTextureDimension", IsStatic = false}, M_GetPropertyTextureDimension }, { new Puerts.MethodKey {Name = "GetPropertyTextureDefaultName", IsStatic = false}, M_GetPropertyTextureDefaultName }, { new Puerts.MethodKey {Name = "FindTextureStack", IsStatic = false}, M_FindTextureStack }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"maximumLOD", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_maximumLOD, Setter = S_maximumLOD} }, {"globalMaximumLOD", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_globalMaximumLOD, Setter = S_globalMaximumLOD} }, {"isSupported", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_isSupported, Setter = null} }, {"globalRenderPipeline", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_globalRenderPipeline, Setter = S_globalRenderPipeline} }, {"renderQueue", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_renderQueue, Setter = null} }, {"passCount", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_passCount, Setter = null} }, } }; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_AudioEchoFilter_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_AudioEchoFilter_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.AudioEchoFilter(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.AudioEchoFilter), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_delay(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AudioEchoFilter; var result = obj.delay; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_delay(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AudioEchoFilter; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.delay = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_decayRatio(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AudioEchoFilter; var result = obj.decayRatio; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_decayRatio(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AudioEchoFilter; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.decayRatio = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_dryMix(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AudioEchoFilter; var result = obj.dryMix; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_dryMix(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AudioEchoFilter; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.dryMix = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_wetMix(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AudioEchoFilter; var result = obj.wetMix; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_wetMix(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AudioEchoFilter; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.wetMix = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"delay", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_delay, Setter = S_delay} }, {"decayRatio", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_decayRatio, Setter = S_decayRatio} }, {"dryMix", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_dryMix, Setter = S_dryMix} }, {"wetMix", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_wetMix, Setter = S_wetMix} }, } }; } } } <|start_filename|>Projects/Java_bin/src/main/gen/cfg/test/DefineFromExcel2.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.test; import bright.serialization.*; public final class DefineFromExcel2 { public DefineFromExcel2(ByteBuf _buf) { id = _buf.readInt(); x1 = _buf.readBool(); x5 = _buf.readLong(); x6 = _buf.readFloat(); x8 = _buf.readInt(); x10 = _buf.readString(); x13 = cfg.test.ETestQuality.valueOf(_buf.readInt()); x14 = cfg.test.DemoDynamic.deserializeDemoDynamic(_buf); v2 = _buf.readVector2(); t1 = _buf.readInt(); {int n = Math.min(_buf.readSize(), _buf.size());k1 = new int[n];for(int i = 0 ; i < n ; i++) { int _e;_e = _buf.readInt(); k1[i] = _e;}} {int n = Math.min(_buf.readSize(), _buf.size());k8 = new java.util.HashMap<Integer, Integer>(n * 3 / 2);for(int i = 0 ; i < n ; i++) { Integer _k; _k = _buf.readInt(); Integer _v; _v = _buf.readInt(); k8.put(_k, _v);}} {int n = Math.min(_buf.readSize(), _buf.size());k9 = new java.util.ArrayList<cfg.test.DemoE2>(n);for(int i = 0 ; i < n ; i++) { cfg.test.DemoE2 _e; _e = new cfg.test.DemoE2(_buf); k9.add(_e);}} } public DefineFromExcel2(int id, boolean x1, long x5, float x6, int x8, String x10, cfg.test.ETestQuality x13, cfg.test.DemoDynamic x14, bright.math.Vector2 v2, int t1, int[] k1, java.util.HashMap<Integer, Integer> k8, java.util.ArrayList<cfg.test.DemoE2> k9 ) { this.id = id; this.x1 = x1; this.x5 = x5; this.x6 = x6; this.x8 = x8; this.x10 = x10; this.x13 = x13; this.x14 = x14; this.v2 = v2; this.t1 = t1; this.k1 = k1; this.k8 = k8; this.k9 = k9; } /** * 这是id */ public final int id; /** * 字段x1 */ public final boolean x1; public final long x5; public final float x6; public final int x8; public final String x10; public final cfg.test.ETestQuality x13; public final cfg.test.DemoDynamic x14; public final bright.math.Vector2 v2; public final int t1; public final int[] k1; public final java.util.HashMap<Integer, Integer> k8; public final java.util.ArrayList<cfg.test.DemoE2> k9; public void resolve(java.util.HashMap<String, Object> _tables) { if (x14 != null) {x14.resolve(_tables);} for(cfg.test.DemoE2 _e : k9) { if (_e != null) _e.resolve(_tables); } } @Override public String toString() { return "{ " + "id:" + id + "," + "x1:" + x1 + "," + "x5:" + x5 + "," + "x6:" + x6 + "," + "x8:" + x8 + "," + "x10:" + x10 + "," + "x13:" + x13 + "," + "x14:" + x14 + "," + "v2:" + v2 + "," + "t1:" + t1 + "," + "k1:" + k1 + "," + "k8:" + k8 + "," + "k9:" + k9 + "," + "}"; } } <|start_filename|>Projects/Java_bin/src/main/gen/cfg/condition/RoleCondition.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.condition; import bright.serialization.*; public abstract class RoleCondition extends cfg.condition.Condition { public RoleCondition(ByteBuf _buf) { super(_buf); } public RoleCondition() { super(); } public static RoleCondition deserializeRoleCondition(ByteBuf _buf) { switch (_buf.readInt()) { case cfg.condition.MultiRoleCondition.__ID__: return new cfg.condition.MultiRoleCondition(_buf); case cfg.condition.GenderLimit.__ID__: return new cfg.condition.GenderLimit(_buf); case cfg.condition.MinLevel.__ID__: return new cfg.condition.MinLevel(_buf); case cfg.condition.MaxLevel.__ID__: return new cfg.condition.MaxLevel(_buf); case cfg.condition.MinMaxLevel.__ID__: return new cfg.condition.MinMaxLevel(_buf); case cfg.condition.ClothesPropertyScoreGreaterThan.__ID__: return new cfg.condition.ClothesPropertyScoreGreaterThan(_buf); case cfg.condition.ContainsItem.__ID__: return new cfg.condition.ContainsItem(_buf); default: throw new SerializationException(); } } @Override public void resolve(java.util.HashMap<String, Object> _tables) { super.resolve(_tables); } @Override public String toString() { return "{ " + "}"; } } <|start_filename|>Projects/GenerateDatas/convert_lua/test.TbTestNull/1.lua<|end_filename|> return { id = 1, } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_UnityEventQueueSystem_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_UnityEventQueueSystem_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.UnityEventQueueSystem(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.UnityEventQueueSystem), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GenerateEventIdForPayload(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetString(false); var result = UnityEngine.UnityEventQueueSystem.GenerateEventIdForPayload(Arg0); Puerts.PuertsDLL.ReturnString(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetGlobalEventQueue(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { { var result = UnityEngine.UnityEventQueueSystem.GetGlobalEventQueue(); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "GenerateEventIdForPayload", IsStatic = true}, F_GenerateEventIdForPayload }, { new Puerts.MethodKey {Name = "GetGlobalEventQueue", IsStatic = true}, F_GetGlobalEventQueue }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { } }; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_UI_ScrollRect_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_UI_ScrollRect_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.UI.ScrollRect constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Rebuild(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.ScrollRect; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = (UnityEngine.UI.CanvasUpdate)argHelper0.GetInt32(false); obj.Rebuild(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_LayoutComplete(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.ScrollRect; { { obj.LayoutComplete(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GraphicUpdateComplete(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.ScrollRect; { { obj.GraphicUpdateComplete(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_IsActive(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.ScrollRect; { { var result = obj.IsActive(); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_StopMovement(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.ScrollRect; { { obj.StopMovement(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_OnScroll(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.ScrollRect; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.EventSystems.PointerEventData>(false); obj.OnScroll(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_OnInitializePotentialDrag(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.ScrollRect; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.EventSystems.PointerEventData>(false); obj.OnInitializePotentialDrag(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_OnBeginDrag(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.ScrollRect; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.EventSystems.PointerEventData>(false); obj.OnBeginDrag(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_OnEndDrag(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.ScrollRect; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.EventSystems.PointerEventData>(false); obj.OnEndDrag(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_OnDrag(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.ScrollRect; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.EventSystems.PointerEventData>(false); obj.OnDrag(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_CalculateLayoutInputHorizontal(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.ScrollRect; { { obj.CalculateLayoutInputHorizontal(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_CalculateLayoutInputVertical(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.ScrollRect; { { obj.CalculateLayoutInputVertical(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetLayoutHorizontal(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.ScrollRect; { { obj.SetLayoutHorizontal(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetLayoutVertical(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.ScrollRect; { { obj.SetLayoutVertical(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_content(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.ScrollRect; var result = obj.content; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_content(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.ScrollRect; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.content = argHelper.Get<UnityEngine.RectTransform>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_horizontal(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.ScrollRect; var result = obj.horizontal; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_horizontal(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.ScrollRect; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.horizontal = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_vertical(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.ScrollRect; var result = obj.vertical; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_vertical(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.ScrollRect; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.vertical = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_movementType(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.ScrollRect; var result = obj.movementType; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_movementType(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.ScrollRect; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.movementType = (UnityEngine.UI.ScrollRect.MovementType)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_elasticity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.ScrollRect; var result = obj.elasticity; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_elasticity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.ScrollRect; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.elasticity = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_inertia(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.ScrollRect; var result = obj.inertia; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_inertia(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.ScrollRect; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.inertia = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_decelerationRate(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.ScrollRect; var result = obj.decelerationRate; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_decelerationRate(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.ScrollRect; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.decelerationRate = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_scrollSensitivity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.ScrollRect; var result = obj.scrollSensitivity; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_scrollSensitivity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.ScrollRect; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.scrollSensitivity = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_viewport(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.ScrollRect; var result = obj.viewport; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_viewport(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.ScrollRect; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.viewport = argHelper.Get<UnityEngine.RectTransform>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_horizontalScrollbar(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.ScrollRect; var result = obj.horizontalScrollbar; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_horizontalScrollbar(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.ScrollRect; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.horizontalScrollbar = argHelper.Get<UnityEngine.UI.Scrollbar>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_verticalScrollbar(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.ScrollRect; var result = obj.verticalScrollbar; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_verticalScrollbar(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.ScrollRect; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.verticalScrollbar = argHelper.Get<UnityEngine.UI.Scrollbar>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_horizontalScrollbarVisibility(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.ScrollRect; var result = obj.horizontalScrollbarVisibility; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_horizontalScrollbarVisibility(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.ScrollRect; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.horizontalScrollbarVisibility = (UnityEngine.UI.ScrollRect.ScrollbarVisibility)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_verticalScrollbarVisibility(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.ScrollRect; var result = obj.verticalScrollbarVisibility; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_verticalScrollbarVisibility(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.ScrollRect; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.verticalScrollbarVisibility = (UnityEngine.UI.ScrollRect.ScrollbarVisibility)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_horizontalScrollbarSpacing(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.ScrollRect; var result = obj.horizontalScrollbarSpacing; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_horizontalScrollbarSpacing(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.ScrollRect; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.horizontalScrollbarSpacing = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_verticalScrollbarSpacing(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.ScrollRect; var result = obj.verticalScrollbarSpacing; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_verticalScrollbarSpacing(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.ScrollRect; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.verticalScrollbarSpacing = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_onValueChanged(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.ScrollRect; var result = obj.onValueChanged; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_onValueChanged(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.ScrollRect; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.onValueChanged = argHelper.Get<UnityEngine.UI.ScrollRect.ScrollRectEvent>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_velocity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.ScrollRect; var result = obj.velocity; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_velocity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.ScrollRect; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.velocity = argHelper.Get<UnityEngine.Vector2>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_normalizedPosition(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.ScrollRect; var result = obj.normalizedPosition; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_normalizedPosition(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.ScrollRect; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.normalizedPosition = argHelper.Get<UnityEngine.Vector2>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_horizontalNormalizedPosition(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.ScrollRect; var result = obj.horizontalNormalizedPosition; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_horizontalNormalizedPosition(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.ScrollRect; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.horizontalNormalizedPosition = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_verticalNormalizedPosition(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.ScrollRect; var result = obj.verticalNormalizedPosition; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_verticalNormalizedPosition(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.ScrollRect; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.verticalNormalizedPosition = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_minWidth(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.ScrollRect; var result = obj.minWidth; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_preferredWidth(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.ScrollRect; var result = obj.preferredWidth; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_flexibleWidth(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.ScrollRect; var result = obj.flexibleWidth; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_minHeight(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.ScrollRect; var result = obj.minHeight; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_preferredHeight(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.ScrollRect; var result = obj.preferredHeight; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_flexibleHeight(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.ScrollRect; var result = obj.flexibleHeight; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_layoutPriority(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.ScrollRect; var result = obj.layoutPriority; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "Rebuild", IsStatic = false}, M_Rebuild }, { new Puerts.MethodKey {Name = "LayoutComplete", IsStatic = false}, M_LayoutComplete }, { new Puerts.MethodKey {Name = "GraphicUpdateComplete", IsStatic = false}, M_GraphicUpdateComplete }, { new Puerts.MethodKey {Name = "IsActive", IsStatic = false}, M_IsActive }, { new Puerts.MethodKey {Name = "StopMovement", IsStatic = false}, M_StopMovement }, { new Puerts.MethodKey {Name = "OnScroll", IsStatic = false}, M_OnScroll }, { new Puerts.MethodKey {Name = "OnInitializePotentialDrag", IsStatic = false}, M_OnInitializePotentialDrag }, { new Puerts.MethodKey {Name = "OnBeginDrag", IsStatic = false}, M_OnBeginDrag }, { new Puerts.MethodKey {Name = "OnEndDrag", IsStatic = false}, M_OnEndDrag }, { new Puerts.MethodKey {Name = "OnDrag", IsStatic = false}, M_OnDrag }, { new Puerts.MethodKey {Name = "CalculateLayoutInputHorizontal", IsStatic = false}, M_CalculateLayoutInputHorizontal }, { new Puerts.MethodKey {Name = "CalculateLayoutInputVertical", IsStatic = false}, M_CalculateLayoutInputVertical }, { new Puerts.MethodKey {Name = "SetLayoutHorizontal", IsStatic = false}, M_SetLayoutHorizontal }, { new Puerts.MethodKey {Name = "SetLayoutVertical", IsStatic = false}, M_SetLayoutVertical }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"content", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_content, Setter = S_content} }, {"horizontal", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_horizontal, Setter = S_horizontal} }, {"vertical", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_vertical, Setter = S_vertical} }, {"movementType", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_movementType, Setter = S_movementType} }, {"elasticity", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_elasticity, Setter = S_elasticity} }, {"inertia", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_inertia, Setter = S_inertia} }, {"decelerationRate", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_decelerationRate, Setter = S_decelerationRate} }, {"scrollSensitivity", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_scrollSensitivity, Setter = S_scrollSensitivity} }, {"viewport", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_viewport, Setter = S_viewport} }, {"horizontalScrollbar", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_horizontalScrollbar, Setter = S_horizontalScrollbar} }, {"verticalScrollbar", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_verticalScrollbar, Setter = S_verticalScrollbar} }, {"horizontalScrollbarVisibility", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_horizontalScrollbarVisibility, Setter = S_horizontalScrollbarVisibility} }, {"verticalScrollbarVisibility", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_verticalScrollbarVisibility, Setter = S_verticalScrollbarVisibility} }, {"horizontalScrollbarSpacing", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_horizontalScrollbarSpacing, Setter = S_horizontalScrollbarSpacing} }, {"verticalScrollbarSpacing", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_verticalScrollbarSpacing, Setter = S_verticalScrollbarSpacing} }, {"onValueChanged", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_onValueChanged, Setter = S_onValueChanged} }, {"velocity", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_velocity, Setter = S_velocity} }, {"normalizedPosition", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_normalizedPosition, Setter = S_normalizedPosition} }, {"horizontalNormalizedPosition", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_horizontalNormalizedPosition, Setter = S_horizontalNormalizedPosition} }, {"verticalNormalizedPosition", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_verticalNormalizedPosition, Setter = S_verticalNormalizedPosition} }, {"minWidth", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_minWidth, Setter = null} }, {"preferredWidth", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_preferredWidth, Setter = null} }, {"flexibleWidth", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_flexibleWidth, Setter = null} }, {"minHeight", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_minHeight, Setter = null} }, {"preferredHeight", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_preferredHeight, Setter = null} }, {"flexibleHeight", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_flexibleHeight, Setter = null} }, {"layoutPriority", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_layoutPriority, Setter = null} }, } }; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_Display_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_Display_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.Display constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Activate(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Display; if (paramLen == 0) { { obj.Activate(); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); obj.Activate(Arg0,Arg1,Arg2); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to Activate"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetParams(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Display; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetInt32(false); obj.SetParams(Arg0,Arg1,Arg2,Arg3); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetRenderingResolution(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Display; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); obj.SetRenderingResolution(Arg0,Arg1); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_RelativeMouseAt(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var result = UnityEngine.Display.RelativeMouseAt(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_renderingWidth(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Display; var result = obj.renderingWidth; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_renderingHeight(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Display; var result = obj.renderingHeight; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_systemWidth(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Display; var result = obj.systemWidth; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_systemHeight(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Display; var result = obj.systemHeight; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_colorBuffer(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Display; var result = obj.colorBuffer; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_depthBuffer(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Display; var result = obj.depthBuffer; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_active(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Display; var result = obj.active; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_requiresBlitToBackbuffer(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Display; var result = obj.requiresBlitToBackbuffer; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_requiresSrgbBlitToBackbuffer(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Display; var result = obj.requiresSrgbBlitToBackbuffer; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_main(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Display.main; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_displays(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Display.displays; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_displays(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.Display.displays = argHelper.Get<UnityEngine.Display[]>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void A_onDisplaysUpdated(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.Display.onDisplaysUpdated += argHelper.Get<UnityEngine.Display.DisplaysUpdatedDelegate>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void R_onDisplaysUpdated(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.Display.onDisplaysUpdated -= argHelper.Get<UnityEngine.Display.DisplaysUpdatedDelegate>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "Activate", IsStatic = false}, M_Activate }, { new Puerts.MethodKey {Name = "SetParams", IsStatic = false}, M_SetParams }, { new Puerts.MethodKey {Name = "SetRenderingResolution", IsStatic = false}, M_SetRenderingResolution }, { new Puerts.MethodKey {Name = "RelativeMouseAt", IsStatic = true}, F_RelativeMouseAt }, { new Puerts.MethodKey {Name = "add_onDisplaysUpdated", IsStatic = true}, A_onDisplaysUpdated}, { new Puerts.MethodKey {Name = "remove_onDisplaysUpdated", IsStatic = true}, R_onDisplaysUpdated}, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"renderingWidth", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_renderingWidth, Setter = null} }, {"renderingHeight", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_renderingHeight, Setter = null} }, {"systemWidth", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_systemWidth, Setter = null} }, {"systemHeight", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_systemHeight, Setter = null} }, {"colorBuffer", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_colorBuffer, Setter = null} }, {"depthBuffer", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_depthBuffer, Setter = null} }, {"active", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_active, Setter = null} }, {"requiresBlitToBackbuffer", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_requiresBlitToBackbuffer, Setter = null} }, {"requiresSrgbBlitToBackbuffer", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_requiresSrgbBlitToBackbuffer, Setter = null} }, {"main", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_main, Setter = null} }, {"displays", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_displays, Setter = S_displays} }, } }; } } } <|start_filename|>Projects/GenerateDatas/convert_lua/role.TbRoleLevelExpAttr/82.lua<|end_filename|> return { level = 82, need_exp = 235000, clothes_attrs = { 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, }, } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_Camera_GateFitParameters_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_Camera_GateFitParameters_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = (UnityEngine.Camera.GateFitMode)argHelper0.GetInt32(false); var Arg1 = argHelper1.GetFloat(false); var result = new UnityEngine.Camera.GateFitParameters(Arg0,Arg1); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.Camera.GateFitParameters), result); } } if (paramLen == 0) { { var result = new UnityEngine.Camera.GateFitParameters(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.Camera.GateFitParameters), result); } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.Camera.GateFitParameters constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_mode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Camera.GateFitParameters)Puerts.Utils.GetSelf((int)data, self); var result = obj.mode; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_mode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Camera.GateFitParameters)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.mode = (UnityEngine.Camera.GateFitMode)argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_aspect(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Camera.GateFitParameters)Puerts.Utils.GetSelf((int)data, self); var result = obj.aspect; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_aspect(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.Camera.GateFitParameters)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.aspect = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"mode", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_mode, Setter = S_mode} }, {"aspect", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_aspect, Setter = S_aspect} }, } }; } } } <|start_filename|>Projects/Java_bin/src/main/gen/cfg/role/BonusInfo.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.role; import bright.serialization.*; public final class BonusInfo { public BonusInfo(ByteBuf _buf) { type = cfg.item.ECurrencyType.valueOf(_buf.readInt()); coefficient = _buf.readFloat(); } public BonusInfo(cfg.item.ECurrencyType type, float coefficient ) { this.type = type; this.coefficient = coefficient; } public final cfg.item.ECurrencyType type; public final float coefficient; public void resolve(java.util.HashMap<String, Object> _tables) { } @Override public String toString() { return "{ " + "type:" + type + "," + "coefficient:" + coefficient + "," + "}"; } } <|start_filename|>Projects/GenerateDatas/convert_lua/l10n.TbPatchDemo/14.lua<|end_filename|> return { id = 14, value = 4, } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_WheelCollider_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_WheelCollider_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.WheelCollider(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.WheelCollider), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ResetSprungMasses(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.WheelCollider; { { obj.ResetSprungMasses(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ConfigureVehicleSubsteps(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.WheelCollider; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetInt32(false); obj.ConfigureVehicleSubsteps(Arg0,Arg1,Arg2); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetWorldPose(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.WheelCollider; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(true); var Arg1 = argHelper1.Get<UnityEngine.Quaternion>(true); obj.GetWorldPose(out Arg0,out Arg1); argHelper0.SetByRefValue(Arg0); argHelper1.SetByRefValue(Arg1); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetGroundHit(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.WheelCollider; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.WheelHit>(true); var result = obj.GetGroundHit(out Arg0); argHelper0.SetByRefValue(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_center(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.WheelCollider; var result = obj.center; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_center(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.WheelCollider; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.center = argHelper.Get<UnityEngine.Vector3>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_radius(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.WheelCollider; var result = obj.radius; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_radius(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.WheelCollider; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.radius = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_suspensionDistance(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.WheelCollider; var result = obj.suspensionDistance; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_suspensionDistance(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.WheelCollider; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.suspensionDistance = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_suspensionSpring(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.WheelCollider; var result = obj.suspensionSpring; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_suspensionSpring(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.WheelCollider; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.suspensionSpring = argHelper.Get<UnityEngine.JointSpring>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_suspensionExpansionLimited(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.WheelCollider; var result = obj.suspensionExpansionLimited; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_suspensionExpansionLimited(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.WheelCollider; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.suspensionExpansionLimited = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_forceAppPointDistance(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.WheelCollider; var result = obj.forceAppPointDistance; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_forceAppPointDistance(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.WheelCollider; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.forceAppPointDistance = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_mass(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.WheelCollider; var result = obj.mass; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_mass(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.WheelCollider; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.mass = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_wheelDampingRate(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.WheelCollider; var result = obj.wheelDampingRate; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_wheelDampingRate(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.WheelCollider; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.wheelDampingRate = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_forwardFriction(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.WheelCollider; var result = obj.forwardFriction; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_forwardFriction(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.WheelCollider; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.forwardFriction = argHelper.Get<UnityEngine.WheelFrictionCurve>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_sidewaysFriction(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.WheelCollider; var result = obj.sidewaysFriction; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_sidewaysFriction(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.WheelCollider; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.sidewaysFriction = argHelper.Get<UnityEngine.WheelFrictionCurve>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_motorTorque(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.WheelCollider; var result = obj.motorTorque; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_motorTorque(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.WheelCollider; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.motorTorque = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_brakeTorque(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.WheelCollider; var result = obj.brakeTorque; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_brakeTorque(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.WheelCollider; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.brakeTorque = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_steerAngle(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.WheelCollider; var result = obj.steerAngle; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_steerAngle(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.WheelCollider; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.steerAngle = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_isGrounded(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.WheelCollider; var result = obj.isGrounded; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_rpm(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.WheelCollider; var result = obj.rpm; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_sprungMass(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.WheelCollider; var result = obj.sprungMass; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_sprungMass(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.WheelCollider; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.sprungMass = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "ResetSprungMasses", IsStatic = false}, M_ResetSprungMasses }, { new Puerts.MethodKey {Name = "ConfigureVehicleSubsteps", IsStatic = false}, M_ConfigureVehicleSubsteps }, { new Puerts.MethodKey {Name = "GetWorldPose", IsStatic = false}, M_GetWorldPose }, { new Puerts.MethodKey {Name = "GetGroundHit", IsStatic = false}, M_GetGroundHit }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"center", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_center, Setter = S_center} }, {"radius", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_radius, Setter = S_radius} }, {"suspensionDistance", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_suspensionDistance, Setter = S_suspensionDistance} }, {"suspensionSpring", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_suspensionSpring, Setter = S_suspensionSpring} }, {"suspensionExpansionLimited", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_suspensionExpansionLimited, Setter = S_suspensionExpansionLimited} }, {"forceAppPointDistance", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_forceAppPointDistance, Setter = S_forceAppPointDistance} }, {"mass", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_mass, Setter = S_mass} }, {"wheelDampingRate", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_wheelDampingRate, Setter = S_wheelDampingRate} }, {"forwardFriction", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_forwardFriction, Setter = S_forwardFriction} }, {"sidewaysFriction", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_sidewaysFriction, Setter = S_sidewaysFriction} }, {"motorTorque", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_motorTorque, Setter = S_motorTorque} }, {"brakeTorque", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_brakeTorque, Setter = S_brakeTorque} }, {"steerAngle", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_steerAngle, Setter = S_steerAngle} }, {"isGrounded", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_isGrounded, Setter = null} }, {"rpm", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_rpm, Setter = null} }, {"sprungMass", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_sprungMass, Setter = S_sprungMass} }, } }; } } } <|start_filename|>Projects/GenerateDatas/convert_lua/role.TbRoleLevelExpAttr/44.lua<|end_filename|> return { level = 44, need_exp = 45000, clothes_attrs = { 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, }, } <|start_filename|>DesignerConfigs/Datas/ai/blackboards/demo_child.lua<|end_filename|> return { name = "demo", desc ="demo hahaha", parent_name = "demo_parent", keys = { {name="x1",desc="x1 haha", is_static=false, type="BOOL", type_class_name=""}, {name="x2",desc="x2 haha", is_static=false, type="INT", type_class_name=""}, {name="x3",desc="x3 haha", is_static=false, type="FLOAT", type_class_name=""}, {name="x4",desc="x4 haha", is_static=false, type="STRING", type_class_name=""}, {name="x5",desc="x5 haha", is_static=false, type="VECTOR", type_class_name=""}, {name="x6",desc="x6 haha", is_static=false, type="ROTATOR", type_class_name=""}, {name="x7",desc="x7 haha", is_static=false, type="NAME", type_class_name=""}, {name="x8",desc="x8 haha", is_static=false, type="CLASS", type_class_name=""}, {name="x9",desc="x9 haha", is_static=false, type="ENUM", type_class_name="ABC"}, {name="x10",desc="x10 haha", is_static=false, type="OBJECT", type_class_name="OBJECT"}, }, } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_AssetBundleManifest_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_AssetBundleManifest_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.AssetBundleManifest constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetAllAssetBundles(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AssetBundleManifest; { { var result = obj.GetAllAssetBundles(); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetAllAssetBundlesWithVariant(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AssetBundleManifest; { { var result = obj.GetAllAssetBundlesWithVariant(); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetAssetBundleHash(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AssetBundleManifest; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetString(false); var result = obj.GetAssetBundleHash(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetDirectDependencies(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AssetBundleManifest; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetString(false); var result = obj.GetDirectDependencies(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetAllDependencies(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AssetBundleManifest; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetString(false); var result = obj.GetAllDependencies(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "GetAllAssetBundles", IsStatic = false}, M_GetAllAssetBundles }, { new Puerts.MethodKey {Name = "GetAllAssetBundlesWithVariant", IsStatic = false}, M_GetAllAssetBundlesWithVariant }, { new Puerts.MethodKey {Name = "GetAssetBundleHash", IsStatic = false}, M_GetAssetBundleHash }, { new Puerts.MethodKey {Name = "GetDirectDependencies", IsStatic = false}, M_GetDirectDependencies }, { new Puerts.MethodKey {Name = "GetAllDependencies", IsStatic = false}, M_GetAllDependencies }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { } }; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_UI_GraphicRaycaster_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_UI_GraphicRaycaster_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.UI.GraphicRaycaster constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Raycast(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.GraphicRaycaster; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<UnityEngine.EventSystems.PointerEventData>(false); var Arg1 = argHelper1.Get<System.Collections.Generic.List<UnityEngine.EventSystems.RaycastResult>>(false); obj.Raycast(Arg0,Arg1); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_sortOrderPriority(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.GraphicRaycaster; var result = obj.sortOrderPriority; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_renderOrderPriority(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.GraphicRaycaster; var result = obj.renderOrderPriority; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_ignoreReversedGraphics(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.GraphicRaycaster; var result = obj.ignoreReversedGraphics; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_ignoreReversedGraphics(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.GraphicRaycaster; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.ignoreReversedGraphics = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_blockingObjects(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.GraphicRaycaster; var result = obj.blockingObjects; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_blockingObjects(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.GraphicRaycaster; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.blockingObjects = (UnityEngine.UI.GraphicRaycaster.BlockingObjects)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_blockingMask(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.GraphicRaycaster; var result = obj.blockingMask; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_blockingMask(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.GraphicRaycaster; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.blockingMask = argHelper.Get<UnityEngine.LayerMask>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_eventCamera(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.GraphicRaycaster; var result = obj.eventCamera; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "Raycast", IsStatic = false}, M_Raycast }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"sortOrderPriority", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_sortOrderPriority, Setter = null} }, {"renderOrderPriority", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_renderOrderPriority, Setter = null} }, {"ignoreReversedGraphics", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_ignoreReversedGraphics, Setter = S_ignoreReversedGraphics} }, {"blockingObjects", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_blockingObjects, Setter = S_blockingObjects} }, {"blockingMask", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_blockingMask, Setter = S_blockingMask} }, {"eventCamera", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_eventCamera, Setter = null} }, } }; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_JsonUtility_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_JsonUtility_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.JsonUtility constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_ToJson(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.Any, typeof(System.Object), false, false)) { var Arg0 = argHelper0.Get<System.Object>(false); var result = UnityEngine.JsonUtility.ToJson(Arg0); Puerts.PuertsDLL.ReturnString(isolate, info, result); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.Any, typeof(System.Object), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.Get<System.Object>(false); var Arg1 = argHelper1.GetBoolean(false); var result = UnityEngine.JsonUtility.ToJson(Arg0,Arg1); Puerts.PuertsDLL.ReturnString(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to ToJson"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_FromJson(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<System.Type>(false); var result = UnityEngine.JsonUtility.FromJson(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_FromJsonOverwrite(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<System.Object>(false); UnityEngine.JsonUtility.FromJsonOverwrite(Arg0,Arg1); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "ToJson", IsStatic = true}, F_ToJson }, { new Puerts.MethodKey {Name = "FromJson", IsStatic = true}, F_FromJson }, { new Puerts.MethodKey {Name = "FromJsonOverwrite", IsStatic = true}, F_FromJsonOverwrite }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { } }; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_Social_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_Social_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.Social constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_LoadUsers(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<string[]>(false); var Arg1 = argHelper1.Get<System.Action<UnityEngine.SocialPlatforms.IUserProfile[]>>(false); UnityEngine.Social.LoadUsers(Arg0,Arg1); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_ReportProgress(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.GetDouble(false); var Arg2 = argHelper2.Get<System.Action<bool>>(false); UnityEngine.Social.ReportProgress(Arg0,Arg1,Arg2); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_LoadAchievementDescriptions(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.Action<UnityEngine.SocialPlatforms.IAchievementDescription[]>>(false); UnityEngine.Social.LoadAchievementDescriptions(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_LoadAchievements(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.Action<UnityEngine.SocialPlatforms.IAchievement[]>>(false); UnityEngine.Social.LoadAchievements(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_ReportScore(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.GetInt64(false); var Arg1 = argHelper1.GetString(false); var Arg2 = argHelper2.Get<System.Action<bool>>(false); UnityEngine.Social.ReportScore(Arg0,Arg1,Arg2); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_LoadScores(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<System.Action<UnityEngine.SocialPlatforms.IScore[]>>(false); UnityEngine.Social.LoadScores(Arg0,Arg1); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_CreateLeaderboard(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { { var result = UnityEngine.Social.CreateLeaderboard(); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_CreateAchievement(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { { var result = UnityEngine.Social.CreateAchievement(); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_ShowAchievementsUI(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { { UnityEngine.Social.ShowAchievementsUI(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_ShowLeaderboardUI(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { { UnityEngine.Social.ShowLeaderboardUI(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_Active(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Social.Active; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_Active(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.Social.Active = argHelper.Get<UnityEngine.SocialPlatforms.ISocialPlatform>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_localUser(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.Social.localUser; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "LoadUsers", IsStatic = true}, F_LoadUsers }, { new Puerts.MethodKey {Name = "ReportProgress", IsStatic = true}, F_ReportProgress }, { new Puerts.MethodKey {Name = "LoadAchievementDescriptions", IsStatic = true}, F_LoadAchievementDescriptions }, { new Puerts.MethodKey {Name = "LoadAchievements", IsStatic = true}, F_LoadAchievements }, { new Puerts.MethodKey {Name = "ReportScore", IsStatic = true}, F_ReportScore }, { new Puerts.MethodKey {Name = "LoadScores", IsStatic = true}, F_LoadScores }, { new Puerts.MethodKey {Name = "CreateLeaderboard", IsStatic = true}, F_CreateLeaderboard }, { new Puerts.MethodKey {Name = "CreateAchievement", IsStatic = true}, F_CreateAchievement }, { new Puerts.MethodKey {Name = "ShowAchievementsUI", IsStatic = true}, F_ShowAchievementsUI }, { new Puerts.MethodKey {Name = "ShowLeaderboardUI", IsStatic = true}, F_ShowLeaderboardUI }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"Active", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_Active, Setter = S_Active} }, {"localUser", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_localUser, Setter = null} }, } }; } } } <|start_filename|>Projects/DataTemplates/template_erlang/error_tbcodeinfo.erl<|end_filename|> %% error.TbCodeInfo get(6) -> #{code => 6,key => "EXAMPLE_FLASH"}. get(7) -> #{code => 7,key => "EXAMPLE_MSGBOX"}. get(8) -> #{code => 8,key => "EXAMPLE_DLG_OK"}. get(9) -> #{code => 9,key => "EXAMPLE_DLG_OK_CANCEL"}. get(100) -> #{code => 100,key => "ROLE_CREATE_NAME_INVALID_CHAR"}. get(101) -> #{code => 101,key => "ROLE_CREATE_NAME_EMPTY"}. get(102) -> #{code => 102,key => "ROLE_CREATE_NAME_EXCEED_MAX_LENGTH"}. get(103) -> #{code => 103,key => "ROLE_CREATE_ROLE_LIST_FULL"}. get(104) -> #{code => 104,key => "ROLE_CREATE_INVALID_PROFESSION"}. get(200) -> #{code => 200,key => "PARAM_ILLEGAL"}. get(202) -> #{code => 202,key => "ITEM_CAN_NOT_USE"}. get(204) -> #{code => 204,key => "BAG_IS_FULL"}. get(205) -> #{code => 205,key => "ITEM_NOT_ENOUGH"}. get(206) -> #{code => 206,key => "ITEM_IN_BAG"}. get(300) -> #{code => 300,key => "GENDER_NOT_MATCH"}. get(301) -> #{code => 301,key => "LEVEL_TOO_LOW"}. get(302) -> #{code => 302,key => "LEVEL_TOO_HIGH"}. get(303) -> #{code => 303,key => "EXCEED_LIMIT"}. get(304) -> #{code => 304,key => "OVER_TIME"}. get(400) -> #{code => 400,key => "SKILL_NOT_IN_LIST"}. get(401) -> #{code => 401,key => "SKILL_NOT_COOLDOWN"}. get(402) -> #{code => 402,key => "SKILL_TARGET_NOT_EXIST"}. get(403) -> #{code => 403,key => "SKILL_ANOTHER_CASTING"}. get(700) -> #{code => 700,key => "MAIL_TYPE_ERROR"}. get(702) -> #{code => 702,key => "MAIL_HAVE_DELETED"}. get(703) -> #{code => 703,key => "MAIL_AWARD_HAVE_RECEIVED"}. get(704) -> #{code => 704,key => "MAIL_OPERATE_TYPE_ERROR"}. get(705) -> #{code => 705,key => "MAIL_CONDITION_NOT_MEET"}. get(707) -> #{code => 707,key => "MAIL_NO_AWARD"}. get(708) -> #{code => 708,key => "MAIL_BOX_IS_FULL"}. get(605) -> #{code => 605,key => "NO_INTERACTION_COMPONENT"}. get(2) -> #{code => 2,key => "HAS_BIND_SERVER"}. get(3) -> #{code => 3,key => "AUTH_FAIL"}. get(4) -> #{code => 4,key => "NOT_BIND_SERVER"}. get(5) -> #{code => 5,key => "SERVER_ACCESS_FAIL"}. get(1) -> #{code => 1,key => "SERVER_NOT_EXISTS"}. get(900) -> #{code => 900,key => "SUIT_NOT_UNLOCK"}. get(901) -> #{code => 901,key => "SUIT_COMPONENT_NOT_UNLOCK"}. get(902) -> #{code => 902,key => "SUIT_STATE_ERROR"}. get(903) -> #{code => 903,key => "SUIT_COMPONENT_STATE_ERROR"}. get(904) -> #{code => 904,key => "SUIT_COMPONENT_NO_NEED_LEARN"}. <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_JointLimits_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_JointLimits_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.JointLimits constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_min(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.JointLimits)Puerts.Utils.GetSelf((int)data, self); var result = obj.min; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_min(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.JointLimits)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.min = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_max(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.JointLimits)Puerts.Utils.GetSelf((int)data, self); var result = obj.max; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_max(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.JointLimits)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.max = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_bounciness(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.JointLimits)Puerts.Utils.GetSelf((int)data, self); var result = obj.bounciness; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_bounciness(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.JointLimits)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.bounciness = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_bounceMinVelocity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.JointLimits)Puerts.Utils.GetSelf((int)data, self); var result = obj.bounceMinVelocity; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_bounceMinVelocity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.JointLimits)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.bounceMinVelocity = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_contactDistance(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.JointLimits)Puerts.Utils.GetSelf((int)data, self); var result = obj.contactDistance; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_contactDistance(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.JointLimits)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.contactDistance = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"min", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_min, Setter = S_min} }, {"max", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_max, Setter = S_max} }, {"bounciness", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_bounciness, Setter = S_bounciness} }, {"bounceMinVelocity", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_bounceMinVelocity, Setter = S_bounceMinVelocity} }, {"contactDistance", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_contactDistance, Setter = S_contactDistance} }, } }; } } } <|start_filename|>Projects/java_json/src/gen/cfg/cost/CostItems.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.cost; import com.google.gson.JsonElement; import com.google.gson.JsonObject; public final class CostItems extends cfg.cost.Cost { public CostItems(JsonObject __json__) { super(__json__); { com.google.gson.JsonArray _json0_ = __json__.get("item_list").getAsJsonArray(); int _n = _json0_.size(); itemList = new cfg.cost.CostItem[_n]; int _index=0; for(JsonElement __e : _json0_) { cfg.cost.CostItem __v; __v = new cfg.cost.CostItem(__e.getAsJsonObject()); itemList[_index++] = __v; } } } public CostItems(cfg.cost.CostItem[] item_list ) { super(); this.itemList = item_list; } public static CostItems deserializeCostItems(JsonObject __json__) { return new CostItems(__json__); } public final cfg.cost.CostItem[] itemList; public static final int __ID__ = -77945102; @Override public int getTypeId() { return __ID__; } @Override public void resolve(java.util.HashMap<String, Object> _tables) { super.resolve(_tables); for(cfg.cost.CostItem _e : itemList) { if (_e != null) _e.resolve(_tables); } } @Override public String toString() { return "{ " + "itemList:" + itemList + "," + "}"; } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_AudioLowPassFilter_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_AudioLowPassFilter_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.AudioLowPassFilter(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.AudioLowPassFilter), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_customCutoffCurve(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AudioLowPassFilter; var result = obj.customCutoffCurve; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_customCutoffCurve(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AudioLowPassFilter; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.customCutoffCurve = argHelper.Get<UnityEngine.AnimationCurve>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_cutoffFrequency(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AudioLowPassFilter; var result = obj.cutoffFrequency; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_cutoffFrequency(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AudioLowPassFilter; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.cutoffFrequency = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_lowpassResonanceQ(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AudioLowPassFilter; var result = obj.lowpassResonanceQ; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_lowpassResonanceQ(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.AudioLowPassFilter; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.lowpassResonanceQ = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"customCutoffCurve", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_customCutoffCurve, Setter = S_customCutoffCurve} }, {"cutoffFrequency", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_cutoffFrequency, Setter = S_cutoffFrequency} }, {"lowpassResonanceQ", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_lowpassResonanceQ, Setter = S_lowpassResonanceQ} }, } }; } } } <|start_filename|>Projects/DataTemplates/template_lua2/test_tbmultirowrecord.lua<|end_filename|> -- test.TbMultiRowRecord return { [1] = { id=1, name="xxx", one_rows= { { id=1, x=2, }, }, multi_rows1= { { id=1, x=2, }, }, multi_rows2= { { id=1, x=2, }, }, multi_rows4= { [1] = { id=1, x=2, y=3, }, }, multi_rows5= { { id=1, items= { { id=100, x=1, }, }, }, }, multi_rows6= { }, multi_rows7= { [1] = 10, [2] = 10, [3] = 30, [4] = 40, }, }, [2] = { id=2, name="xxx", one_rows= { { id=2, x=4, }, }, multi_rows1= { { id=2, x=4, }, { id=2, x=4, }, { id=2, x=4, }, { id=2, x=4, }, { id=2, x=4, }, { id=2, x=4, }, }, multi_rows2= { { id=3, x=4, }, { id=3, x=4, }, }, multi_rows4= { [2] = { id=4, x=5, y=4, }, }, multi_rows5= { { id=2, items= { { id=100, x=1, }, { id=200, x=2, }, }, }, { id=3, items= { { id=300, x=3, }, }, }, { id=4, items= { { id=400, x=4, }, { id=500, x=5, }, { id=600, x=6, }, }, }, }, multi_rows6= { [2] = { id=2, x=2, y=2, }, [22] = { id=22, x=22, y=22, }, [222] = { id=3, x=3, y=3, }, [2222] = { id=4, x=4, y=4, }, }, multi_rows7= { [1] = 100, [2] = 200, }, }, [3] = { id=3, name="ds", one_rows= { { id=1, x=2, }, }, multi_rows1= { { id=1, x=2, }, { id=2, x=4, }, }, multi_rows2= { { id=3, x=4, }, { id=3, x=4, }, }, multi_rows4= { [1] = { id=1, x=2, y=3, }, [2] = { id=4, x=5, y=4, }, [3] = { id=4, x=5, y=4, }, }, multi_rows5= { { id=5, items= { { id=100, x=1, }, { id=200, x=2, }, { id=300, x=3, }, { id=400, x=4, }, }, }, }, multi_rows6= { [1] = { id=2, x=3, y=4, }, [10] = { id=20, x=3, y=40, }, [100] = { id=200, x=4, y=400, }, [1000] = { id=2000, x=5, y=4000, }, }, multi_rows7= { [1] = 1, [2] = 2, [4] = 4, }, }, } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_HumanTrait_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_HumanTrait_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.HumanTrait(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.HumanTrait), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_MuscleFromBone(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetInt32(false); var result = UnityEngine.HumanTrait.MuscleFromBone(Arg0,Arg1); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_BoneFromMuscle(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); var result = UnityEngine.HumanTrait.BoneFromMuscle(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_RequiredBone(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); var result = UnityEngine.HumanTrait.RequiredBone(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetMuscleDefaultMin(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); var result = UnityEngine.HumanTrait.GetMuscleDefaultMin(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetMuscleDefaultMax(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); var result = UnityEngine.HumanTrait.GetMuscleDefaultMax(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetBoneDefaultHierarchyMass(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); var result = UnityEngine.HumanTrait.GetBoneDefaultHierarchyMass(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetParentBone(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); var result = UnityEngine.HumanTrait.GetParentBone(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_MuscleCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.HumanTrait.MuscleCount; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_MuscleName(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.HumanTrait.MuscleName; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_BoneCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.HumanTrait.BoneCount; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_BoneName(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.HumanTrait.BoneName; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_RequiredBoneCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.HumanTrait.RequiredBoneCount; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "MuscleFromBone", IsStatic = true}, F_MuscleFromBone }, { new Puerts.MethodKey {Name = "BoneFromMuscle", IsStatic = true}, F_BoneFromMuscle }, { new Puerts.MethodKey {Name = "RequiredBone", IsStatic = true}, F_RequiredBone }, { new Puerts.MethodKey {Name = "GetMuscleDefaultMin", IsStatic = true}, F_GetMuscleDefaultMin }, { new Puerts.MethodKey {Name = "GetMuscleDefaultMax", IsStatic = true}, F_GetMuscleDefaultMax }, { new Puerts.MethodKey {Name = "GetBoneDefaultHierarchyMass", IsStatic = true}, F_GetBoneDefaultHierarchyMass }, { new Puerts.MethodKey {Name = "GetParentBone", IsStatic = true}, F_GetParentBone }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"MuscleCount", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_MuscleCount, Setter = null} }, {"MuscleName", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_MuscleName, Setter = null} }, {"BoneCount", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_BoneCount, Setter = null} }, {"BoneName", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_BoneName, Setter = null} }, {"RequiredBoneCount", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_RequiredBoneCount, Setter = null} }, } }; } } } <|start_filename|>Projects/java_json/src/gen/cfg/test/TestExcelBean1.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.test; import com.google.gson.JsonElement; import com.google.gson.JsonObject; /** * 这是个测试excel结构 */ public final class TestExcelBean1 { public TestExcelBean1(JsonObject __json__) { x1 = __json__.get("x1").getAsInt(); x2 = __json__.get("x2").getAsString(); x3 = __json__.get("x3").getAsInt(); x4 = __json__.get("x4").getAsFloat(); } public TestExcelBean1(int x1, String x2, int x3, float x4 ) { this.x1 = x1; this.x2 = x2; this.x3 = x3; this.x4 = x4; } public static TestExcelBean1 deserializeTestExcelBean1(JsonObject __json__) { return new TestExcelBean1(__json__); } /** * 最高品质 */ public final int x1; /** * 黑色的 */ public final String x2; /** * 蓝色的 */ public final int x3; /** * 最差品质 */ public final float x4; public void resolve(java.util.HashMap<String, Object> _tables) { } @Override public String toString() { return "{ " + "x1:" + x1 + "," + "x2:" + x2 + "," + "x3:" + x3 + "," + "x4:" + x4 + "," + "}"; } } <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/limit/DailyLimit.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.limit { public sealed partial class DailyLimit : limit.DailyLimitBase { public DailyLimit(ByteBuf _buf) : base(_buf) { Num = _buf.ReadInt(); } public DailyLimit(int num ) : base() { this.Num = num; } public static DailyLimit DeserializeDailyLimit(ByteBuf _buf) { return new limit.DailyLimit(_buf); } public readonly int Num; public const int ID = 303235413; public override int GetTypeId() => ID; public override void Resolve(Dictionary<string, object> _tables) { base.Resolve(_tables); OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); public override string ToString() { return "{ " + "Num:" + Num + "," + "}"; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_Cloth_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_Cloth_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.Cloth(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.Cloth), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ClearTransformMotion(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Cloth; { { obj.ClearTransformMotion(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetSelfAndInterCollisionIndices(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Cloth; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.Collections.Generic.List<uint>>(false); obj.GetSelfAndInterCollisionIndices(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetSelfAndInterCollisionIndices(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Cloth; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.Collections.Generic.List<uint>>(false); obj.SetSelfAndInterCollisionIndices(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetVirtualParticleIndices(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Cloth; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.Collections.Generic.List<uint>>(false); obj.GetVirtualParticleIndices(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetVirtualParticleIndices(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Cloth; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.Collections.Generic.List<uint>>(false); obj.SetVirtualParticleIndices(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetVirtualParticleWeights(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Cloth; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.Collections.Generic.List<UnityEngine.Vector3>>(false); obj.GetVirtualParticleWeights(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetVirtualParticleWeights(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Cloth; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.Collections.Generic.List<UnityEngine.Vector3>>(false); obj.SetVirtualParticleWeights(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetEnabledFading(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Cloth; if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetBoolean(false); var Arg1 = argHelper1.GetFloat(false); obj.SetEnabledFading(Arg0,Arg1); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.GetBoolean(false); obj.SetEnabledFading(Arg0); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SetEnabledFading"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_vertices(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Cloth; var result = obj.vertices; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_normals(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Cloth; var result = obj.normals; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_coefficients(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Cloth; var result = obj.coefficients; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_coefficients(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Cloth; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.coefficients = argHelper.Get<UnityEngine.ClothSkinningCoefficient[]>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_capsuleColliders(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Cloth; var result = obj.capsuleColliders; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_capsuleColliders(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Cloth; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.capsuleColliders = argHelper.Get<UnityEngine.CapsuleCollider[]>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_sphereColliders(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Cloth; var result = obj.sphereColliders; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_sphereColliders(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Cloth; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.sphereColliders = argHelper.Get<UnityEngine.ClothSphereColliderPair[]>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_sleepThreshold(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Cloth; var result = obj.sleepThreshold; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_sleepThreshold(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Cloth; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.sleepThreshold = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_bendingStiffness(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Cloth; var result = obj.bendingStiffness; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_bendingStiffness(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Cloth; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.bendingStiffness = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_stretchingStiffness(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Cloth; var result = obj.stretchingStiffness; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_stretchingStiffness(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Cloth; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.stretchingStiffness = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_damping(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Cloth; var result = obj.damping; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_damping(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Cloth; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.damping = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_externalAcceleration(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Cloth; var result = obj.externalAcceleration; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_externalAcceleration(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Cloth; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.externalAcceleration = argHelper.Get<UnityEngine.Vector3>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_randomAcceleration(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Cloth; var result = obj.randomAcceleration; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_randomAcceleration(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Cloth; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.randomAcceleration = argHelper.Get<UnityEngine.Vector3>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_useGravity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Cloth; var result = obj.useGravity; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_useGravity(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Cloth; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.useGravity = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_enabled(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Cloth; var result = obj.enabled; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_enabled(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Cloth; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.enabled = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_friction(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Cloth; var result = obj.friction; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_friction(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Cloth; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.friction = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_collisionMassScale(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Cloth; var result = obj.collisionMassScale; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_collisionMassScale(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Cloth; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.collisionMassScale = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_enableContinuousCollision(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Cloth; var result = obj.enableContinuousCollision; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_enableContinuousCollision(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Cloth; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.enableContinuousCollision = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_useVirtualParticles(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Cloth; var result = obj.useVirtualParticles; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_useVirtualParticles(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Cloth; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.useVirtualParticles = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_worldVelocityScale(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Cloth; var result = obj.worldVelocityScale; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_worldVelocityScale(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Cloth; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.worldVelocityScale = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_worldAccelerationScale(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Cloth; var result = obj.worldAccelerationScale; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_worldAccelerationScale(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Cloth; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.worldAccelerationScale = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_clothSolverFrequency(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Cloth; var result = obj.clothSolverFrequency; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_clothSolverFrequency(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Cloth; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.clothSolverFrequency = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_useTethers(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Cloth; var result = obj.useTethers; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_useTethers(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Cloth; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.useTethers = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_stiffnessFrequency(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Cloth; var result = obj.stiffnessFrequency; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_stiffnessFrequency(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Cloth; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.stiffnessFrequency = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_selfCollisionDistance(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Cloth; var result = obj.selfCollisionDistance; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_selfCollisionDistance(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Cloth; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.selfCollisionDistance = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_selfCollisionStiffness(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Cloth; var result = obj.selfCollisionStiffness; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_selfCollisionStiffness(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.Cloth; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.selfCollisionStiffness = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "ClearTransformMotion", IsStatic = false}, M_ClearTransformMotion }, { new Puerts.MethodKey {Name = "GetSelfAndInterCollisionIndices", IsStatic = false}, M_GetSelfAndInterCollisionIndices }, { new Puerts.MethodKey {Name = "SetSelfAndInterCollisionIndices", IsStatic = false}, M_SetSelfAndInterCollisionIndices }, { new Puerts.MethodKey {Name = "GetVirtualParticleIndices", IsStatic = false}, M_GetVirtualParticleIndices }, { new Puerts.MethodKey {Name = "SetVirtualParticleIndices", IsStatic = false}, M_SetVirtualParticleIndices }, { new Puerts.MethodKey {Name = "GetVirtualParticleWeights", IsStatic = false}, M_GetVirtualParticleWeights }, { new Puerts.MethodKey {Name = "SetVirtualParticleWeights", IsStatic = false}, M_SetVirtualParticleWeights }, { new Puerts.MethodKey {Name = "SetEnabledFading", IsStatic = false}, M_SetEnabledFading }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"vertices", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_vertices, Setter = null} }, {"normals", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_normals, Setter = null} }, {"coefficients", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_coefficients, Setter = S_coefficients} }, {"capsuleColliders", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_capsuleColliders, Setter = S_capsuleColliders} }, {"sphereColliders", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_sphereColliders, Setter = S_sphereColliders} }, {"sleepThreshold", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_sleepThreshold, Setter = S_sleepThreshold} }, {"bendingStiffness", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_bendingStiffness, Setter = S_bendingStiffness} }, {"stretchingStiffness", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_stretchingStiffness, Setter = S_stretchingStiffness} }, {"damping", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_damping, Setter = S_damping} }, {"externalAcceleration", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_externalAcceleration, Setter = S_externalAcceleration} }, {"randomAcceleration", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_randomAcceleration, Setter = S_randomAcceleration} }, {"useGravity", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_useGravity, Setter = S_useGravity} }, {"enabled", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_enabled, Setter = S_enabled} }, {"friction", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_friction, Setter = S_friction} }, {"collisionMassScale", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_collisionMassScale, Setter = S_collisionMassScale} }, {"enableContinuousCollision", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_enableContinuousCollision, Setter = S_enableContinuousCollision} }, {"useVirtualParticles", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_useVirtualParticles, Setter = S_useVirtualParticles} }, {"worldVelocityScale", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_worldVelocityScale, Setter = S_worldVelocityScale} }, {"worldAccelerationScale", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_worldAccelerationScale, Setter = S_worldAccelerationScale} }, {"clothSolverFrequency", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_clothSolverFrequency, Setter = S_clothSolverFrequency} }, {"useTethers", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_useTethers, Setter = S_useTethers} }, {"stiffnessFrequency", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_stiffnessFrequency, Setter = S_stiffnessFrequency} }, {"selfCollisionDistance", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_selfCollisionDistance, Setter = S_selfCollisionDistance} }, {"selfCollisionStiffness", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_selfCollisionStiffness, Setter = S_selfCollisionStiffness} }, } }; } } } <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/test/H1.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.test { public sealed partial class H1 : Bright.Config.BeanBase { public H1(ByteBuf _buf) { Y2 = test.H2.DeserializeH2(_buf); Y3 = _buf.ReadInt(); } public H1(test.H2 y2, int y3 ) { this.Y2 = y2; this.Y3 = y3; } public static H1 DeserializeH1(ByteBuf _buf) { return new test.H1(_buf); } public readonly test.H2 Y2; public readonly int Y3; public const int ID = -1422503995; public override int GetTypeId() => ID; public void Resolve(Dictionary<string, object> _tables) { Y2?.Resolve(_tables); OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); public override string ToString() { return "{ " + "Y2:" + Y2 + "," + "Y3:" + Y3 + "," + "}"; } } } <|start_filename|>Projects/DataTemplates/template_erlang2/test_tbcompositejsontable3.erl<|end_filename|> %% test.TbCompositeJsonTable3 -module(test_tbcompositejsontable3) -export([get/1,get_ids/0]) get() -> #{ a => 111, b => 222 }; get_ids() -> []. <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_GUILayout_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_GUILayout_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { { { var result = new UnityEngine.GUILayout(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.GUILayout), result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_Label(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen >= 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUILayoutOption), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Texture>(false); var Arg1 = argHelper1.GetParams<UnityEngine.GUILayoutOption>(info, 1, paramLen); UnityEngine.GUILayout.Label(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUILayoutOption), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.GetParams<UnityEngine.GUILayoutOption>(info, 1, paramLen); UnityEngine.GUILayout.Label(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIContent), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUILayoutOption), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.GUIContent>(false); var Arg1 = argHelper1.GetParams<UnityEngine.GUILayoutOption>(info, 1, paramLen); UnityEngine.GUILayout.Label(Arg0,Arg1); return; } } if (paramLen >= 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUILayoutOption), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Texture>(false); var Arg1 = argHelper1.Get<UnityEngine.GUIStyle>(false); var Arg2 = argHelper2.GetParams<UnityEngine.GUILayoutOption>(info, 2, paramLen); UnityEngine.GUILayout.Label(Arg0,Arg1,Arg2); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUILayoutOption), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<UnityEngine.GUIStyle>(false); var Arg2 = argHelper2.GetParams<UnityEngine.GUILayoutOption>(info, 2, paramLen); UnityEngine.GUILayout.Label(Arg0,Arg1,Arg2); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIContent), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUILayoutOption), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.GUIContent>(false); var Arg1 = argHelper1.Get<UnityEngine.GUIStyle>(false); var Arg2 = argHelper2.GetParams<UnityEngine.GUILayoutOption>(info, 2, paramLen); UnityEngine.GUILayout.Label(Arg0,Arg1,Arg2); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to Label"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_Box(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen >= 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUILayoutOption), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Texture>(false); var Arg1 = argHelper1.GetParams<UnityEngine.GUILayoutOption>(info, 1, paramLen); UnityEngine.GUILayout.Box(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUILayoutOption), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.GetParams<UnityEngine.GUILayoutOption>(info, 1, paramLen); UnityEngine.GUILayout.Box(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIContent), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUILayoutOption), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.GUIContent>(false); var Arg1 = argHelper1.GetParams<UnityEngine.GUILayoutOption>(info, 1, paramLen); UnityEngine.GUILayout.Box(Arg0,Arg1); return; } } if (paramLen >= 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUILayoutOption), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Texture>(false); var Arg1 = argHelper1.Get<UnityEngine.GUIStyle>(false); var Arg2 = argHelper2.GetParams<UnityEngine.GUILayoutOption>(info, 2, paramLen); UnityEngine.GUILayout.Box(Arg0,Arg1,Arg2); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUILayoutOption), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<UnityEngine.GUIStyle>(false); var Arg2 = argHelper2.GetParams<UnityEngine.GUILayoutOption>(info, 2, paramLen); UnityEngine.GUILayout.Box(Arg0,Arg1,Arg2); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIContent), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUILayoutOption), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.GUIContent>(false); var Arg1 = argHelper1.Get<UnityEngine.GUIStyle>(false); var Arg2 = argHelper2.GetParams<UnityEngine.GUILayoutOption>(info, 2, paramLen); UnityEngine.GUILayout.Box(Arg0,Arg1,Arg2); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to Box"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_Button(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen >= 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUILayoutOption), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Texture>(false); var Arg1 = argHelper1.GetParams<UnityEngine.GUILayoutOption>(info, 1, paramLen); var result = UnityEngine.GUILayout.Button(Arg0,Arg1); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUILayoutOption), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.GetParams<UnityEngine.GUILayoutOption>(info, 1, paramLen); var result = UnityEngine.GUILayout.Button(Arg0,Arg1); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIContent), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUILayoutOption), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.GUIContent>(false); var Arg1 = argHelper1.GetParams<UnityEngine.GUILayoutOption>(info, 1, paramLen); var result = UnityEngine.GUILayout.Button(Arg0,Arg1); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } } if (paramLen >= 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUILayoutOption), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Texture>(false); var Arg1 = argHelper1.Get<UnityEngine.GUIStyle>(false); var Arg2 = argHelper2.GetParams<UnityEngine.GUILayoutOption>(info, 2, paramLen); var result = UnityEngine.GUILayout.Button(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUILayoutOption), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<UnityEngine.GUIStyle>(false); var Arg2 = argHelper2.GetParams<UnityEngine.GUILayoutOption>(info, 2, paramLen); var result = UnityEngine.GUILayout.Button(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIContent), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUILayoutOption), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.GUIContent>(false); var Arg1 = argHelper1.Get<UnityEngine.GUIStyle>(false); var Arg2 = argHelper2.GetParams<UnityEngine.GUILayoutOption>(info, 2, paramLen); var result = UnityEngine.GUILayout.Button(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to Button"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_RepeatButton(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen >= 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUILayoutOption), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Texture>(false); var Arg1 = argHelper1.GetParams<UnityEngine.GUILayoutOption>(info, 1, paramLen); var result = UnityEngine.GUILayout.RepeatButton(Arg0,Arg1); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUILayoutOption), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.GetParams<UnityEngine.GUILayoutOption>(info, 1, paramLen); var result = UnityEngine.GUILayout.RepeatButton(Arg0,Arg1); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIContent), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUILayoutOption), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.GUIContent>(false); var Arg1 = argHelper1.GetParams<UnityEngine.GUILayoutOption>(info, 1, paramLen); var result = UnityEngine.GUILayout.RepeatButton(Arg0,Arg1); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } } if (paramLen >= 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUILayoutOption), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Texture>(false); var Arg1 = argHelper1.Get<UnityEngine.GUIStyle>(false); var Arg2 = argHelper2.GetParams<UnityEngine.GUILayoutOption>(info, 2, paramLen); var result = UnityEngine.GUILayout.RepeatButton(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUILayoutOption), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<UnityEngine.GUIStyle>(false); var Arg2 = argHelper2.GetParams<UnityEngine.GUILayoutOption>(info, 2, paramLen); var result = UnityEngine.GUILayout.RepeatButton(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIContent), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUILayoutOption), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.GUIContent>(false); var Arg1 = argHelper1.Get<UnityEngine.GUIStyle>(false); var Arg2 = argHelper2.GetParams<UnityEngine.GUILayoutOption>(info, 2, paramLen); var result = UnityEngine.GUILayout.RepeatButton(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to RepeatButton"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_TextField(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen >= 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUILayoutOption), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.GetParams<UnityEngine.GUILayoutOption>(info, 1, paramLen); var result = UnityEngine.GUILayout.TextField(Arg0,Arg1); Puerts.PuertsDLL.ReturnString(isolate, info, result); return; } } if (paramLen >= 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUILayoutOption), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetParams<UnityEngine.GUILayoutOption>(info, 2, paramLen); var result = UnityEngine.GUILayout.TextField(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnString(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUILayoutOption), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<UnityEngine.GUIStyle>(false); var Arg2 = argHelper2.GetParams<UnityEngine.GUILayoutOption>(info, 2, paramLen); var result = UnityEngine.GUILayout.TextField(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnString(isolate, info, result); return; } } if (paramLen >= 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUILayoutOption), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.Get<UnityEngine.GUIStyle>(false); var Arg3 = argHelper3.GetParams<UnityEngine.GUILayoutOption>(info, 3, paramLen); var result = UnityEngine.GUILayout.TextField(Arg0,Arg1,Arg2,Arg3); Puerts.PuertsDLL.ReturnString(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to TextField"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_PasswordField(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen >= 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUILayoutOption), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<System.Char>(false); var Arg2 = argHelper2.GetParams<UnityEngine.GUILayoutOption>(info, 2, paramLen); var result = UnityEngine.GUILayout.PasswordField(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnString(isolate, info, result); return; } } if (paramLen >= 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUILayoutOption), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<System.Char>(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetParams<UnityEngine.GUILayoutOption>(info, 3, paramLen); var result = UnityEngine.GUILayout.PasswordField(Arg0,Arg1,Arg2,Arg3); Puerts.PuertsDLL.ReturnString(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUILayoutOption), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<System.Char>(false); var Arg2 = argHelper2.Get<UnityEngine.GUIStyle>(false); var Arg3 = argHelper3.GetParams<UnityEngine.GUILayoutOption>(info, 3, paramLen); var result = UnityEngine.GUILayout.PasswordField(Arg0,Arg1,Arg2,Arg3); Puerts.PuertsDLL.ReturnString(isolate, info, result); return; } } if (paramLen >= 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUILayoutOption), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<System.Char>(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.Get<UnityEngine.GUIStyle>(false); var Arg4 = argHelper4.GetParams<UnityEngine.GUILayoutOption>(info, 4, paramLen); var result = UnityEngine.GUILayout.PasswordField(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.PuertsDLL.ReturnString(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to PasswordField"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_TextArea(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen >= 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUILayoutOption), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.GetParams<UnityEngine.GUILayoutOption>(info, 1, paramLen); var result = UnityEngine.GUILayout.TextArea(Arg0,Arg1); Puerts.PuertsDLL.ReturnString(isolate, info, result); return; } } if (paramLen >= 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUILayoutOption), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetParams<UnityEngine.GUILayoutOption>(info, 2, paramLen); var result = UnityEngine.GUILayout.TextArea(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnString(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUILayoutOption), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<UnityEngine.GUIStyle>(false); var Arg2 = argHelper2.GetParams<UnityEngine.GUILayoutOption>(info, 2, paramLen); var result = UnityEngine.GUILayout.TextArea(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnString(isolate, info, result); return; } } if (paramLen >= 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUILayoutOption), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.Get<UnityEngine.GUIStyle>(false); var Arg3 = argHelper3.GetParams<UnityEngine.GUILayoutOption>(info, 3, paramLen); var result = UnityEngine.GUILayout.TextArea(Arg0,Arg1,Arg2,Arg3); Puerts.PuertsDLL.ReturnString(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to TextArea"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_Toggle(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen >= 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUILayoutOption), false, false)) { var Arg0 = argHelper0.GetBoolean(false); var Arg1 = argHelper1.Get<UnityEngine.Texture>(false); var Arg2 = argHelper2.GetParams<UnityEngine.GUILayoutOption>(info, 2, paramLen); var result = UnityEngine.GUILayout.Toggle(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUILayoutOption), false, false)) { var Arg0 = argHelper0.GetBoolean(false); var Arg1 = argHelper1.GetString(false); var Arg2 = argHelper2.GetParams<UnityEngine.GUILayoutOption>(info, 2, paramLen); var result = UnityEngine.GUILayout.Toggle(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIContent), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUILayoutOption), false, false)) { var Arg0 = argHelper0.GetBoolean(false); var Arg1 = argHelper1.Get<UnityEngine.GUIContent>(false); var Arg2 = argHelper2.GetParams<UnityEngine.GUILayoutOption>(info, 2, paramLen); var result = UnityEngine.GUILayout.Toggle(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } } if (paramLen >= 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUILayoutOption), false, false)) { var Arg0 = argHelper0.GetBoolean(false); var Arg1 = argHelper1.Get<UnityEngine.Texture>(false); var Arg2 = argHelper2.Get<UnityEngine.GUIStyle>(false); var Arg3 = argHelper3.GetParams<UnityEngine.GUILayoutOption>(info, 3, paramLen); var result = UnityEngine.GUILayout.Toggle(Arg0,Arg1,Arg2,Arg3); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUILayoutOption), false, false)) { var Arg0 = argHelper0.GetBoolean(false); var Arg1 = argHelper1.GetString(false); var Arg2 = argHelper2.Get<UnityEngine.GUIStyle>(false); var Arg3 = argHelper3.GetParams<UnityEngine.GUILayoutOption>(info, 3, paramLen); var result = UnityEngine.GUILayout.Toggle(Arg0,Arg1,Arg2,Arg3); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIContent), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUILayoutOption), false, false)) { var Arg0 = argHelper0.GetBoolean(false); var Arg1 = argHelper1.Get<UnityEngine.GUIContent>(false); var Arg2 = argHelper2.Get<UnityEngine.GUIStyle>(false); var Arg3 = argHelper3.GetParams<UnityEngine.GUILayoutOption>(info, 3, paramLen); var result = UnityEngine.GUILayout.Toggle(Arg0,Arg1,Arg2,Arg3); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to Toggle"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_Toolbar(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen >= 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(string[]), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUILayoutOption), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<string[]>(false); var Arg2 = argHelper2.GetParams<UnityEngine.GUILayoutOption>(info, 2, paramLen); var result = UnityEngine.GUILayout.Toolbar(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture[]), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUILayoutOption), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.Texture[]>(false); var Arg2 = argHelper2.GetParams<UnityEngine.GUILayoutOption>(info, 2, paramLen); var result = UnityEngine.GUILayout.Toolbar(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIContent[]), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUILayoutOption), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.GUIContent[]>(false); var Arg2 = argHelper2.GetParams<UnityEngine.GUILayoutOption>(info, 2, paramLen); var result = UnityEngine.GUILayout.Toolbar(Arg0,Arg1,Arg2); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen >= 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(string[]), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUILayoutOption), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<string[]>(false); var Arg2 = argHelper2.Get<UnityEngine.GUIStyle>(false); var Arg3 = argHelper3.GetParams<UnityEngine.GUILayoutOption>(info, 3, paramLen); var result = UnityEngine.GUILayout.Toolbar(Arg0,Arg1,Arg2,Arg3); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture[]), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUILayoutOption), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.Texture[]>(false); var Arg2 = argHelper2.Get<UnityEngine.GUIStyle>(false); var Arg3 = argHelper3.GetParams<UnityEngine.GUILayoutOption>(info, 3, paramLen); var result = UnityEngine.GUILayout.Toolbar(Arg0,Arg1,Arg2,Arg3); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIContent[]), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUILayoutOption), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.GUIContent[]>(false); var Arg2 = argHelper2.Get<UnityEngine.GUIStyle>(false); var Arg3 = argHelper3.GetParams<UnityEngine.GUILayoutOption>(info, 3, paramLen); var result = UnityEngine.GUILayout.Toolbar(Arg0,Arg1,Arg2,Arg3); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen >= 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(string[]), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUILayoutOption), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<string[]>(false); var Arg2 = argHelper2.Get<UnityEngine.GUIStyle>(false); var Arg3 = (UnityEngine.GUI.ToolbarButtonSize)argHelper3.GetInt32(false); var Arg4 = argHelper4.GetParams<UnityEngine.GUILayoutOption>(info, 4, paramLen); var result = UnityEngine.GUILayout.Toolbar(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture[]), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUILayoutOption), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.Texture[]>(false); var Arg2 = argHelper2.Get<UnityEngine.GUIStyle>(false); var Arg3 = (UnityEngine.GUI.ToolbarButtonSize)argHelper3.GetInt32(false); var Arg4 = argHelper4.GetParams<UnityEngine.GUILayoutOption>(info, 4, paramLen); var result = UnityEngine.GUILayout.Toolbar(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIContent[]), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUILayoutOption), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.GUIContent[]>(false); var Arg2 = argHelper2.Get<UnityEngine.GUIStyle>(false); var Arg3 = (UnityEngine.GUI.ToolbarButtonSize)argHelper3.GetInt32(false); var Arg4 = argHelper4.GetParams<UnityEngine.GUILayoutOption>(info, 4, paramLen); var result = UnityEngine.GUILayout.Toolbar(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIContent[]), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(bool[]), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUILayoutOption), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.GUIContent[]>(false); var Arg2 = argHelper2.Get<bool[]>(false); var Arg3 = argHelper3.Get<UnityEngine.GUIStyle>(false); var Arg4 = argHelper4.GetParams<UnityEngine.GUILayoutOption>(info, 4, paramLen); var result = UnityEngine.GUILayout.Toolbar(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen >= 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIContent[]), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(bool[]), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUILayoutOption), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.GUIContent[]>(false); var Arg2 = argHelper2.Get<bool[]>(false); var Arg3 = argHelper3.Get<UnityEngine.GUIStyle>(false); var Arg4 = (UnityEngine.GUI.ToolbarButtonSize)argHelper4.GetInt32(false); var Arg5 = argHelper5.GetParams<UnityEngine.GUILayoutOption>(info, 5, paramLen); var result = UnityEngine.GUILayout.Toolbar(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to Toolbar"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_SelectionGrid(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen >= 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(string[]), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUILayoutOption), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<string[]>(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetParams<UnityEngine.GUILayoutOption>(info, 3, paramLen); var result = UnityEngine.GUILayout.SelectionGrid(Arg0,Arg1,Arg2,Arg3); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture[]), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUILayoutOption), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.Texture[]>(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetParams<UnityEngine.GUILayoutOption>(info, 3, paramLen); var result = UnityEngine.GUILayout.SelectionGrid(Arg0,Arg1,Arg2,Arg3); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIContent[]), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUILayoutOption), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.GUIContent[]>(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.GetParams<UnityEngine.GUILayoutOption>(info, 3, paramLen); var result = UnityEngine.GUILayout.SelectionGrid(Arg0,Arg1,Arg2,Arg3); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen >= 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(string[]), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUILayoutOption), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<string[]>(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.Get<UnityEngine.GUIStyle>(false); var Arg4 = argHelper4.GetParams<UnityEngine.GUILayoutOption>(info, 4, paramLen); var result = UnityEngine.GUILayout.SelectionGrid(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture[]), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUILayoutOption), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.Texture[]>(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.Get<UnityEngine.GUIStyle>(false); var Arg4 = argHelper4.GetParams<UnityEngine.GUILayoutOption>(info, 4, paramLen); var result = UnityEngine.GUILayout.SelectionGrid(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIContent[]), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUILayoutOption), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.GUIContent[]>(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.Get<UnityEngine.GUIStyle>(false); var Arg4 = argHelper4.GetParams<UnityEngine.GUILayoutOption>(info, 4, paramLen); var result = UnityEngine.GUILayout.SelectionGrid(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SelectionGrid"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_HorizontalSlider(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen >= 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUILayoutOption), false, false)) { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.GetParams<UnityEngine.GUILayoutOption>(info, 3, paramLen); var result = UnityEngine.GUILayout.HorizontalSlider(Arg0,Arg1,Arg2,Arg3); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen >= 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false) && argHelper5.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUILayoutOption), false, false)) { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.Get<UnityEngine.GUIStyle>(false); var Arg4 = argHelper4.Get<UnityEngine.GUIStyle>(false); var Arg5 = argHelper5.GetParams<UnityEngine.GUILayoutOption>(info, 5, paramLen); var result = UnityEngine.GUILayout.HorizontalSlider(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to HorizontalSlider"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_VerticalSlider(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen >= 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUILayoutOption), false, false)) { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.GetParams<UnityEngine.GUILayoutOption>(info, 3, paramLen); var result = UnityEngine.GUILayout.VerticalSlider(Arg0,Arg1,Arg2,Arg3); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen >= 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false) && argHelper5.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUILayoutOption), false, false)) { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.Get<UnityEngine.GUIStyle>(false); var Arg4 = argHelper4.Get<UnityEngine.GUIStyle>(false); var Arg5 = argHelper5.GetParams<UnityEngine.GUILayoutOption>(info, 5, paramLen); var result = UnityEngine.GUILayout.VerticalSlider(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to VerticalSlider"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_HorizontalScrollbar(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen >= 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUILayoutOption), false, false)) { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.GetParams<UnityEngine.GUILayoutOption>(info, 4, paramLen); var result = UnityEngine.GUILayout.HorizontalScrollbar(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen >= 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false) && argHelper5.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUILayoutOption), false, false)) { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.Get<UnityEngine.GUIStyle>(false); var Arg5 = argHelper5.GetParams<UnityEngine.GUILayoutOption>(info, 5, paramLen); var result = UnityEngine.GUILayout.HorizontalScrollbar(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to HorizontalScrollbar"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_VerticalScrollbar(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen >= 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUILayoutOption), false, false)) { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.GetParams<UnityEngine.GUILayoutOption>(info, 4, paramLen); var result = UnityEngine.GUILayout.VerticalScrollbar(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } if (paramLen >= 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false) && argHelper5.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUILayoutOption), false, false)) { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.GetFloat(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.GetFloat(false); var Arg4 = argHelper4.Get<UnityEngine.GUIStyle>(false); var Arg5 = argHelper5.GetParams<UnityEngine.GUILayoutOption>(info, 5, paramLen); var result = UnityEngine.GUILayout.VerticalScrollbar(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to VerticalScrollbar"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_Space(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetFloat(false); UnityEngine.GUILayout.Space(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_FlexibleSpace(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { { UnityEngine.GUILayout.FlexibleSpace(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_BeginHorizontal(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen >= 0) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUILayoutOption), false, false)) { var Arg0 = argHelper0.GetParams<UnityEngine.GUILayoutOption>(info, 0, paramLen); UnityEngine.GUILayout.BeginHorizontal(Arg0); return; } } if (paramLen >= 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUILayoutOption), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.GUIStyle>(false); var Arg1 = argHelper1.GetParams<UnityEngine.GUILayoutOption>(info, 1, paramLen); UnityEngine.GUILayout.BeginHorizontal(Arg0,Arg1); return; } } if (paramLen >= 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUILayoutOption), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<UnityEngine.GUIStyle>(false); var Arg2 = argHelper2.GetParams<UnityEngine.GUILayoutOption>(info, 2, paramLen); UnityEngine.GUILayout.BeginHorizontal(Arg0,Arg1,Arg2); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUILayoutOption), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Texture>(false); var Arg1 = argHelper1.Get<UnityEngine.GUIStyle>(false); var Arg2 = argHelper2.GetParams<UnityEngine.GUILayoutOption>(info, 2, paramLen); UnityEngine.GUILayout.BeginHorizontal(Arg0,Arg1,Arg2); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIContent), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUILayoutOption), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.GUIContent>(false); var Arg1 = argHelper1.Get<UnityEngine.GUIStyle>(false); var Arg2 = argHelper2.GetParams<UnityEngine.GUILayoutOption>(info, 2, paramLen); UnityEngine.GUILayout.BeginHorizontal(Arg0,Arg1,Arg2); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to BeginHorizontal"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_EndHorizontal(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { { UnityEngine.GUILayout.EndHorizontal(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_BeginVertical(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen >= 0) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUILayoutOption), false, false)) { var Arg0 = argHelper0.GetParams<UnityEngine.GUILayoutOption>(info, 0, paramLen); UnityEngine.GUILayout.BeginVertical(Arg0); return; } } if (paramLen >= 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUILayoutOption), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.GUIStyle>(false); var Arg1 = argHelper1.GetParams<UnityEngine.GUILayoutOption>(info, 1, paramLen); UnityEngine.GUILayout.BeginVertical(Arg0,Arg1); return; } } if (paramLen >= 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUILayoutOption), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<UnityEngine.GUIStyle>(false); var Arg2 = argHelper2.GetParams<UnityEngine.GUILayoutOption>(info, 2, paramLen); UnityEngine.GUILayout.BeginVertical(Arg0,Arg1,Arg2); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUILayoutOption), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Texture>(false); var Arg1 = argHelper1.Get<UnityEngine.GUIStyle>(false); var Arg2 = argHelper2.GetParams<UnityEngine.GUILayoutOption>(info, 2, paramLen); UnityEngine.GUILayout.BeginVertical(Arg0,Arg1,Arg2); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIContent), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUILayoutOption), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.GUIContent>(false); var Arg1 = argHelper1.Get<UnityEngine.GUIStyle>(false); var Arg2 = argHelper2.GetParams<UnityEngine.GUILayoutOption>(info, 2, paramLen); UnityEngine.GUILayout.BeginVertical(Arg0,Arg1,Arg2); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to BeginVertical"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_EndVertical(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { { UnityEngine.GUILayout.EndVertical(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_BeginArea(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); UnityEngine.GUILayout.BeginArea(Arg0); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.GetString(false); UnityEngine.GUILayout.BeginArea(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.Get<UnityEngine.Texture>(false); UnityEngine.GUILayout.BeginArea(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIContent), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.Get<UnityEngine.GUIContent>(false); UnityEngine.GUILayout.BeginArea(Arg0,Arg1); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.Get<UnityEngine.GUIStyle>(false); UnityEngine.GUILayout.BeginArea(Arg0,Arg1); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.GetString(false); var Arg2 = argHelper2.Get<UnityEngine.GUIStyle>(false); UnityEngine.GUILayout.BeginArea(Arg0,Arg1,Arg2); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.Get<UnityEngine.Texture>(false); var Arg2 = argHelper2.Get<UnityEngine.GUIStyle>(false); UnityEngine.GUILayout.BeginArea(Arg0,Arg1,Arg2); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIContent), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Rect>(false); var Arg1 = argHelper1.Get<UnityEngine.GUIContent>(false); var Arg2 = argHelper2.Get<UnityEngine.GUIStyle>(false); UnityEngine.GUILayout.BeginArea(Arg0,Arg1,Arg2); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to BeginArea"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_EndArea(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { { UnityEngine.GUILayout.EndArea(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_BeginScrollView(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen >= 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUILayoutOption), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.GetParams<UnityEngine.GUILayoutOption>(info, 1, paramLen); var result = UnityEngine.GUILayout.BeginScrollView(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen >= 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUILayoutOption), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.GetBoolean(false); var Arg2 = argHelper2.GetBoolean(false); var Arg3 = argHelper3.GetParams<UnityEngine.GUILayoutOption>(info, 3, paramLen); var result = UnityEngine.GUILayout.BeginScrollView(Arg0,Arg1,Arg2,Arg3); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUILayoutOption), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.GUIStyle>(false); var Arg2 = argHelper2.Get<UnityEngine.GUIStyle>(false); var Arg3 = argHelper3.GetParams<UnityEngine.GUILayoutOption>(info, 3, paramLen); var result = UnityEngine.GUILayout.BeginScrollView(Arg0,Arg1,Arg2,Arg3); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.GUIStyle>(false); var result = UnityEngine.GUILayout.BeginScrollView(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen >= 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUILayoutOption), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.GUIStyle>(false); var Arg2 = argHelper2.GetParams<UnityEngine.GUILayoutOption>(info, 2, paramLen); var result = UnityEngine.GUILayout.BeginScrollView(Arg0,Arg1,Arg2); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen >= 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false) && argHelper5.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUILayoutOption), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.GetBoolean(false); var Arg2 = argHelper2.GetBoolean(false); var Arg3 = argHelper3.Get<UnityEngine.GUIStyle>(false); var Arg4 = argHelper4.Get<UnityEngine.GUIStyle>(false); var Arg5 = argHelper5.GetParams<UnityEngine.GUILayoutOption>(info, 5, paramLen); var result = UnityEngine.GUILayout.BeginScrollView(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen >= 6) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector2), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false) && argHelper5.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false) && argHelper6.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUILayoutOption), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.GetBoolean(false); var Arg2 = argHelper2.GetBoolean(false); var Arg3 = argHelper3.Get<UnityEngine.GUIStyle>(false); var Arg4 = argHelper4.Get<UnityEngine.GUIStyle>(false); var Arg5 = argHelper5.Get<UnityEngine.GUIStyle>(false); var Arg6 = argHelper6.GetParams<UnityEngine.GUILayoutOption>(info, 6, paramLen); var result = UnityEngine.GUILayout.BeginScrollView(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to BeginScrollView"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_EndScrollView(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { { UnityEngine.GUILayout.EndScrollView(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_Window(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen >= 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject | Puerts.JsValueType.Function, typeof(UnityEngine.GUI.WindowFunction), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUILayoutOption), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.Rect>(false); var Arg2 = argHelper2.Get<UnityEngine.GUI.WindowFunction>(false); var Arg3 = argHelper3.GetString(false); var Arg4 = argHelper4.GetParams<UnityEngine.GUILayoutOption>(info, 4, paramLen); var result = UnityEngine.GUILayout.Window(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject | Puerts.JsValueType.Function, typeof(UnityEngine.GUI.WindowFunction), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture), false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUILayoutOption), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.Rect>(false); var Arg2 = argHelper2.Get<UnityEngine.GUI.WindowFunction>(false); var Arg3 = argHelper3.Get<UnityEngine.Texture>(false); var Arg4 = argHelper4.GetParams<UnityEngine.GUILayoutOption>(info, 4, paramLen); var result = UnityEngine.GUILayout.Window(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject | Puerts.JsValueType.Function, typeof(UnityEngine.GUI.WindowFunction), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIContent), false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUILayoutOption), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.Rect>(false); var Arg2 = argHelper2.Get<UnityEngine.GUI.WindowFunction>(false); var Arg3 = argHelper3.Get<UnityEngine.GUIContent>(false); var Arg4 = argHelper4.GetParams<UnityEngine.GUILayoutOption>(info, 4, paramLen); var result = UnityEngine.GUILayout.Window(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen >= 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject | Puerts.JsValueType.Function, typeof(UnityEngine.GUI.WindowFunction), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false) && argHelper5.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUILayoutOption), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.Rect>(false); var Arg2 = argHelper2.Get<UnityEngine.GUI.WindowFunction>(false); var Arg3 = argHelper3.GetString(false); var Arg4 = argHelper4.Get<UnityEngine.GUIStyle>(false); var Arg5 = argHelper5.GetParams<UnityEngine.GUILayoutOption>(info, 5, paramLen); var result = UnityEngine.GUILayout.Window(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject | Puerts.JsValueType.Function, typeof(UnityEngine.GUI.WindowFunction), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.Texture), false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false) && argHelper5.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUILayoutOption), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.Rect>(false); var Arg2 = argHelper2.Get<UnityEngine.GUI.WindowFunction>(false); var Arg3 = argHelper3.Get<UnityEngine.Texture>(false); var Arg4 = argHelper4.Get<UnityEngine.GUIStyle>(false); var Arg5 = argHelper5.GetParams<UnityEngine.GUILayoutOption>(info, 5, paramLen); var result = UnityEngine.GUILayout.Window(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Rect), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject | Puerts.JsValueType.Function, typeof(UnityEngine.GUI.WindowFunction), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIContent), false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUIStyle), false, false) && argHelper5.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.GUILayoutOption), false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.Rect>(false); var Arg2 = argHelper2.Get<UnityEngine.GUI.WindowFunction>(false); var Arg3 = argHelper3.Get<UnityEngine.GUIContent>(false); var Arg4 = argHelper4.Get<UnityEngine.GUIStyle>(false); var Arg5 = argHelper5.GetParams<UnityEngine.GUILayoutOption>(info, 5, paramLen); var result = UnityEngine.GUILayout.Window(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to Window"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_Width(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetFloat(false); var result = UnityEngine.GUILayout.Width(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_MinWidth(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetFloat(false); var result = UnityEngine.GUILayout.MinWidth(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_MaxWidth(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetFloat(false); var result = UnityEngine.GUILayout.MaxWidth(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_Height(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetFloat(false); var result = UnityEngine.GUILayout.Height(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_MinHeight(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetFloat(false); var result = UnityEngine.GUILayout.MinHeight(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_MaxHeight(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetFloat(false); var result = UnityEngine.GUILayout.MaxHeight(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_ExpandWidth(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetBoolean(false); var result = UnityEngine.GUILayout.ExpandWidth(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_ExpandHeight(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetBoolean(false); var result = UnityEngine.GUILayout.ExpandHeight(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "Label", IsStatic = true}, F_Label }, { new Puerts.MethodKey {Name = "Box", IsStatic = true}, F_Box }, { new Puerts.MethodKey {Name = "Button", IsStatic = true}, F_Button }, { new Puerts.MethodKey {Name = "RepeatButton", IsStatic = true}, F_RepeatButton }, { new Puerts.MethodKey {Name = "TextField", IsStatic = true}, F_TextField }, { new Puerts.MethodKey {Name = "PasswordField", IsStatic = true}, F_PasswordField }, { new Puerts.MethodKey {Name = "TextArea", IsStatic = true}, F_TextArea }, { new Puerts.MethodKey {Name = "Toggle", IsStatic = true}, F_Toggle }, { new Puerts.MethodKey {Name = "Toolbar", IsStatic = true}, F_Toolbar }, { new Puerts.MethodKey {Name = "SelectionGrid", IsStatic = true}, F_SelectionGrid }, { new Puerts.MethodKey {Name = "HorizontalSlider", IsStatic = true}, F_HorizontalSlider }, { new Puerts.MethodKey {Name = "VerticalSlider", IsStatic = true}, F_VerticalSlider }, { new Puerts.MethodKey {Name = "HorizontalScrollbar", IsStatic = true}, F_HorizontalScrollbar }, { new Puerts.MethodKey {Name = "VerticalScrollbar", IsStatic = true}, F_VerticalScrollbar }, { new Puerts.MethodKey {Name = "Space", IsStatic = true}, F_Space }, { new Puerts.MethodKey {Name = "FlexibleSpace", IsStatic = true}, F_FlexibleSpace }, { new Puerts.MethodKey {Name = "BeginHorizontal", IsStatic = true}, F_BeginHorizontal }, { new Puerts.MethodKey {Name = "EndHorizontal", IsStatic = true}, F_EndHorizontal }, { new Puerts.MethodKey {Name = "BeginVertical", IsStatic = true}, F_BeginVertical }, { new Puerts.MethodKey {Name = "EndVertical", IsStatic = true}, F_EndVertical }, { new Puerts.MethodKey {Name = "BeginArea", IsStatic = true}, F_BeginArea }, { new Puerts.MethodKey {Name = "EndArea", IsStatic = true}, F_EndArea }, { new Puerts.MethodKey {Name = "BeginScrollView", IsStatic = true}, F_BeginScrollView }, { new Puerts.MethodKey {Name = "EndScrollView", IsStatic = true}, F_EndScrollView }, { new Puerts.MethodKey {Name = "Window", IsStatic = true}, F_Window }, { new Puerts.MethodKey {Name = "Width", IsStatic = true}, F_Width }, { new Puerts.MethodKey {Name = "MinWidth", IsStatic = true}, F_MinWidth }, { new Puerts.MethodKey {Name = "MaxWidth", IsStatic = true}, F_MaxWidth }, { new Puerts.MethodKey {Name = "Height", IsStatic = true}, F_Height }, { new Puerts.MethodKey {Name = "MinHeight", IsStatic = true}, F_MinHeight }, { new Puerts.MethodKey {Name = "MaxHeight", IsStatic = true}, F_MaxHeight }, { new Puerts.MethodKey {Name = "ExpandWidth", IsStatic = true}, F_ExpandWidth }, { new Puerts.MethodKey {Name = "ExpandHeight", IsStatic = true}, F_ExpandHeight }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { } }; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_AudioSettings_Mobile_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_AudioSettings_Mobile_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.AudioSettings.Mobile constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_StartAudioOutput(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { { UnityEngine.AudioSettings.Mobile.StartAudioOutput(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_StopAudioOutput(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { { UnityEngine.AudioSettings.Mobile.StopAudioOutput(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_muteState(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.AudioSettings.Mobile.muteState; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_stopAudioOutputOnMute(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.AudioSettings.Mobile.stopAudioOutputOnMute; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_stopAudioOutputOnMute(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.AudioSettings.Mobile.stopAudioOutputOnMute = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_audioOutputStarted(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.AudioSettings.Mobile.audioOutputStarted; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void A_OnMuteStateChanged(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.AudioSettings.Mobile.OnMuteStateChanged += argHelper.Get<System.Action<bool>>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void R_OnMuteStateChanged(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.AudioSettings.Mobile.OnMuteStateChanged -= argHelper.Get<System.Action<bool>>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "StartAudioOutput", IsStatic = true}, F_StartAudioOutput }, { new Puerts.MethodKey {Name = "StopAudioOutput", IsStatic = true}, F_StopAudioOutput }, { new Puerts.MethodKey {Name = "add_OnMuteStateChanged", IsStatic = true}, A_OnMuteStateChanged}, { new Puerts.MethodKey {Name = "remove_OnMuteStateChanged", IsStatic = true}, R_OnMuteStateChanged}, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"muteState", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_muteState, Setter = null} }, {"stopAudioOutputOnMute", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_stopAudioOutputOnMute, Setter = S_stopAudioOutputOnMute} }, {"audioOutputStarted", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_audioOutputStarted, Setter = null} }, } }; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Bin/Assets/Gen/UnityEngine_QualitySettings_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_QualitySettings_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.QualitySettings constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_IncreaseLevel(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.GetBoolean(false); UnityEngine.QualitySettings.IncreaseLevel(Arg0); return; } } if (paramLen == 0) { { UnityEngine.QualitySettings.IncreaseLevel(); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to IncreaseLevel"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_DecreaseLevel(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.GetBoolean(false); UnityEngine.QualitySettings.DecreaseLevel(Arg0); return; } } if (paramLen == 0) { { UnityEngine.QualitySettings.DecreaseLevel(); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to DecreaseLevel"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_SetQualityLevel(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); UnityEngine.QualitySettings.SetQualityLevel(Arg0); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.GetBoolean(false); UnityEngine.QualitySettings.SetQualityLevel(Arg0,Arg1); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SetQualityLevel"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_SetLODSettings(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.GetInt32(false); var Arg2 = argHelper2.GetBoolean(false); UnityEngine.QualitySettings.SetLODSettings(Arg0,Arg1,Arg2); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetFloat(false); var Arg1 = argHelper1.GetInt32(false); UnityEngine.QualitySettings.SetLODSettings(Arg0,Arg1); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SetLODSettings"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetRenderPipelineAssetAt(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); var result = UnityEngine.QualitySettings.GetRenderPipelineAssetAt(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetQualityLevel(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { { var result = UnityEngine.QualitySettings.GetQualityLevel(); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_pixelLightCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.QualitySettings.pixelLightCount; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_pixelLightCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.QualitySettings.pixelLightCount = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_shadows(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.QualitySettings.shadows; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_shadows(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.QualitySettings.shadows = (UnityEngine.ShadowQuality)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_shadowProjection(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.QualitySettings.shadowProjection; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_shadowProjection(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.QualitySettings.shadowProjection = (UnityEngine.ShadowProjection)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_shadowCascades(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.QualitySettings.shadowCascades; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_shadowCascades(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.QualitySettings.shadowCascades = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_shadowDistance(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.QualitySettings.shadowDistance; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_shadowDistance(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.QualitySettings.shadowDistance = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_shadowResolution(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.QualitySettings.shadowResolution; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_shadowResolution(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.QualitySettings.shadowResolution = (UnityEngine.ShadowResolution)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_shadowmaskMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.QualitySettings.shadowmaskMode; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_shadowmaskMode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.QualitySettings.shadowmaskMode = (UnityEngine.ShadowmaskMode)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_shadowNearPlaneOffset(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.QualitySettings.shadowNearPlaneOffset; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_shadowNearPlaneOffset(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.QualitySettings.shadowNearPlaneOffset = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_shadowCascade2Split(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.QualitySettings.shadowCascade2Split; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_shadowCascade2Split(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.QualitySettings.shadowCascade2Split = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_shadowCascade4Split(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.QualitySettings.shadowCascade4Split; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_shadowCascade4Split(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.QualitySettings.shadowCascade4Split = argHelper.Get<UnityEngine.Vector3>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_lodBias(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.QualitySettings.lodBias; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_lodBias(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.QualitySettings.lodBias = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_anisotropicFiltering(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.QualitySettings.anisotropicFiltering; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_anisotropicFiltering(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.QualitySettings.anisotropicFiltering = (UnityEngine.AnisotropicFiltering)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_masterTextureLimit(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.QualitySettings.masterTextureLimit; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_masterTextureLimit(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.QualitySettings.masterTextureLimit = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_maximumLODLevel(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.QualitySettings.maximumLODLevel; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_maximumLODLevel(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.QualitySettings.maximumLODLevel = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_particleRaycastBudget(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.QualitySettings.particleRaycastBudget; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_particleRaycastBudget(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.QualitySettings.particleRaycastBudget = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_softParticles(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.QualitySettings.softParticles; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_softParticles(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.QualitySettings.softParticles = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_softVegetation(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.QualitySettings.softVegetation; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_softVegetation(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.QualitySettings.softVegetation = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_vSyncCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.QualitySettings.vSyncCount; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_vSyncCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.QualitySettings.vSyncCount = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_antiAliasing(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.QualitySettings.antiAliasing; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_antiAliasing(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.QualitySettings.antiAliasing = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_asyncUploadTimeSlice(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.QualitySettings.asyncUploadTimeSlice; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_asyncUploadTimeSlice(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.QualitySettings.asyncUploadTimeSlice = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_asyncUploadBufferSize(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.QualitySettings.asyncUploadBufferSize; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_asyncUploadBufferSize(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.QualitySettings.asyncUploadBufferSize = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_asyncUploadPersistentBuffer(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.QualitySettings.asyncUploadPersistentBuffer; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_asyncUploadPersistentBuffer(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.QualitySettings.asyncUploadPersistentBuffer = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_realtimeReflectionProbes(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.QualitySettings.realtimeReflectionProbes; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_realtimeReflectionProbes(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.QualitySettings.realtimeReflectionProbes = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_billboardsFaceCameraPosition(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.QualitySettings.billboardsFaceCameraPosition; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_billboardsFaceCameraPosition(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.QualitySettings.billboardsFaceCameraPosition = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_resolutionScalingFixedDPIFactor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.QualitySettings.resolutionScalingFixedDPIFactor; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_resolutionScalingFixedDPIFactor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.QualitySettings.resolutionScalingFixedDPIFactor = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_renderPipeline(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.QualitySettings.renderPipeline; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_renderPipeline(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.QualitySettings.renderPipeline = argHelper.Get<UnityEngine.Rendering.RenderPipelineAsset>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_skinWeights(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.QualitySettings.skinWeights; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_skinWeights(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.QualitySettings.skinWeights = (UnityEngine.SkinWeights)argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_streamingMipmapsActive(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.QualitySettings.streamingMipmapsActive; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_streamingMipmapsActive(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.QualitySettings.streamingMipmapsActive = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_streamingMipmapsMemoryBudget(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.QualitySettings.streamingMipmapsMemoryBudget; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_streamingMipmapsMemoryBudget(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.QualitySettings.streamingMipmapsMemoryBudget = argHelper.GetFloat(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_streamingMipmapsMaxLevelReduction(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.QualitySettings.streamingMipmapsMaxLevelReduction; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_streamingMipmapsMaxLevelReduction(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.QualitySettings.streamingMipmapsMaxLevelReduction = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_streamingMipmapsAddAllCameras(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.QualitySettings.streamingMipmapsAddAllCameras; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_streamingMipmapsAddAllCameras(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.QualitySettings.streamingMipmapsAddAllCameras = argHelper.GetBoolean(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_streamingMipmapsMaxFileIORequests(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.QualitySettings.streamingMipmapsMaxFileIORequests; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_streamingMipmapsMaxFileIORequests(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.QualitySettings.streamingMipmapsMaxFileIORequests = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_maxQueuedFrames(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.QualitySettings.maxQueuedFrames; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_maxQueuedFrames(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); UnityEngine.QualitySettings.maxQueuedFrames = argHelper.GetInt32(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_names(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.QualitySettings.names; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_desiredColorSpace(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.QualitySettings.desiredColorSpace; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_activeColorSpace(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = UnityEngine.QualitySettings.activeColorSpace; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "IncreaseLevel", IsStatic = true}, F_IncreaseLevel }, { new Puerts.MethodKey {Name = "DecreaseLevel", IsStatic = true}, F_DecreaseLevel }, { new Puerts.MethodKey {Name = "SetQualityLevel", IsStatic = true}, F_SetQualityLevel }, { new Puerts.MethodKey {Name = "SetLODSettings", IsStatic = true}, F_SetLODSettings }, { new Puerts.MethodKey {Name = "GetRenderPipelineAssetAt", IsStatic = true}, F_GetRenderPipelineAssetAt }, { new Puerts.MethodKey {Name = "GetQualityLevel", IsStatic = true}, F_GetQualityLevel }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"pixelLightCount", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_pixelLightCount, Setter = S_pixelLightCount} }, {"shadows", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_shadows, Setter = S_shadows} }, {"shadowProjection", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_shadowProjection, Setter = S_shadowProjection} }, {"shadowCascades", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_shadowCascades, Setter = S_shadowCascades} }, {"shadowDistance", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_shadowDistance, Setter = S_shadowDistance} }, {"shadowResolution", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_shadowResolution, Setter = S_shadowResolution} }, {"shadowmaskMode", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_shadowmaskMode, Setter = S_shadowmaskMode} }, {"shadowNearPlaneOffset", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_shadowNearPlaneOffset, Setter = S_shadowNearPlaneOffset} }, {"shadowCascade2Split", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_shadowCascade2Split, Setter = S_shadowCascade2Split} }, {"shadowCascade4Split", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_shadowCascade4Split, Setter = S_shadowCascade4Split} }, {"lodBias", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_lodBias, Setter = S_lodBias} }, {"anisotropicFiltering", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_anisotropicFiltering, Setter = S_anisotropicFiltering} }, {"masterTextureLimit", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_masterTextureLimit, Setter = S_masterTextureLimit} }, {"maximumLODLevel", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_maximumLODLevel, Setter = S_maximumLODLevel} }, {"particleRaycastBudget", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_particleRaycastBudget, Setter = S_particleRaycastBudget} }, {"softParticles", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_softParticles, Setter = S_softParticles} }, {"softVegetation", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_softVegetation, Setter = S_softVegetation} }, {"vSyncCount", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_vSyncCount, Setter = S_vSyncCount} }, {"antiAliasing", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_antiAliasing, Setter = S_antiAliasing} }, {"asyncUploadTimeSlice", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_asyncUploadTimeSlice, Setter = S_asyncUploadTimeSlice} }, {"asyncUploadBufferSize", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_asyncUploadBufferSize, Setter = S_asyncUploadBufferSize} }, {"asyncUploadPersistentBuffer", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_asyncUploadPersistentBuffer, Setter = S_asyncUploadPersistentBuffer} }, {"realtimeReflectionProbes", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_realtimeReflectionProbes, Setter = S_realtimeReflectionProbes} }, {"billboardsFaceCameraPosition", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_billboardsFaceCameraPosition, Setter = S_billboardsFaceCameraPosition} }, {"resolutionScalingFixedDPIFactor", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_resolutionScalingFixedDPIFactor, Setter = S_resolutionScalingFixedDPIFactor} }, {"renderPipeline", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_renderPipeline, Setter = S_renderPipeline} }, {"skinWeights", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_skinWeights, Setter = S_skinWeights} }, {"streamingMipmapsActive", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_streamingMipmapsActive, Setter = S_streamingMipmapsActive} }, {"streamingMipmapsMemoryBudget", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_streamingMipmapsMemoryBudget, Setter = S_streamingMipmapsMemoryBudget} }, {"streamingMipmapsMaxLevelReduction", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_streamingMipmapsMaxLevelReduction, Setter = S_streamingMipmapsMaxLevelReduction} }, {"streamingMipmapsAddAllCameras", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_streamingMipmapsAddAllCameras, Setter = S_streamingMipmapsAddAllCameras} }, {"streamingMipmapsMaxFileIORequests", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_streamingMipmapsMaxFileIORequests, Setter = S_streamingMipmapsMaxFileIORequests} }, {"maxQueuedFrames", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_maxQueuedFrames, Setter = S_maxQueuedFrames} }, {"names", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_names, Setter = null} }, {"desiredColorSpace", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_desiredColorSpace, Setter = null} }, {"activeColorSpace", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_activeColorSpace, Setter = null} }, } }; } } } <|start_filename|>Projects/GenerateDatas/convert_lua/role.TbRoleLevelExpAttr/23.lua<|end_filename|> return { level = 23, need_exp = 7500, clothes_attrs = { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, }, } <|start_filename|>Projects/java_json/src/gen/cfg/bonus/DropInfo.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.bonus; import com.google.gson.JsonElement; import com.google.gson.JsonObject; public final class DropInfo { public DropInfo(JsonObject __json__) { id = __json__.get("id").getAsInt(); desc = __json__.get("desc").getAsString(); { com.google.gson.JsonArray _json0_ = __json__.get("client_show_items").getAsJsonArray(); clientShowItems = new java.util.ArrayList<cfg.bonus.ShowItemInfo>(_json0_.size()); for(JsonElement __e : _json0_) { cfg.bonus.ShowItemInfo __v; __v = new cfg.bonus.ShowItemInfo(__e.getAsJsonObject()); clientShowItems.add(__v); } } bonus = cfg.bonus.Bonus.deserializeBonus(__json__.get("bonus").getAsJsonObject()); } public DropInfo(int id, String desc, java.util.ArrayList<cfg.bonus.ShowItemInfo> client_show_items, cfg.bonus.Bonus bonus ) { this.id = id; this.desc = desc; this.clientShowItems = client_show_items; this.bonus = bonus; } public static DropInfo deserializeDropInfo(JsonObject __json__) { return new DropInfo(__json__); } public final int id; public final String desc; public final java.util.ArrayList<cfg.bonus.ShowItemInfo> clientShowItems; public final cfg.bonus.Bonus bonus; public void resolve(java.util.HashMap<String, Object> _tables) { for(cfg.bonus.ShowItemInfo _e : clientShowItems) { if (_e != null) _e.resolve(_tables); } if (bonus != null) {bonus.resolve(_tables);} } @Override public String toString() { return "{ " + "id:" + id + "," + "desc:" + desc + "," + "clientShowItems:" + clientShowItems + "," + "bonus:" + bonus + "," + "}"; } } <|start_filename|>Projects/Go_json/gen/src/cfg/test.TestSet.go<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg import "errors" type TestTestSet struct { Id int32 X1 []int32 X2 []int64 X3 []string X4 []int32 } const TypeId_TestTestSet = -543221516 func (*TestTestSet) GetTypeId() int32 { return -543221516 } func (_v *TestTestSet)Deserialize(_buf map[string]interface{}) (err error) { { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["id"].(float64); !_ok_ { err = errors.New("id error"); return }; _v.Id = int32(_tempNum_) } { var _arr_ []interface{} var _ok_ bool if _arr_, _ok_ = _buf["x1"].([]interface{}); !_ok_ { err = errors.New("x1 error"); return } _v.X1 = make([]int32, 0, len(_arr_)) for _, _e_ := range _arr_ { var _list_v_ int32 { var _ok_ bool; var _x_ float64; if _x_, _ok_ = _e_.(float64); !_ok_ { err = errors.New("_list_v_ error"); return }; _list_v_ = int32(_x_) } _v.X1 = append(_v.X1, _list_v_) } } { var _arr_ []interface{} var _ok_ bool if _arr_, _ok_ = _buf["x2"].([]interface{}); !_ok_ { err = errors.New("x2 error"); return } _v.X2 = make([]int64, 0, len(_arr_)) for _, _e_ := range _arr_ { var _list_v_ int64 { var _ok_ bool; var _x_ float64; if _x_, _ok_ = _e_.(float64); !_ok_ { err = errors.New("_list_v_ error"); return }; _list_v_ = int64(_x_) } _v.X2 = append(_v.X2, _list_v_) } } { var _arr_ []interface{} var _ok_ bool if _arr_, _ok_ = _buf["x3"].([]interface{}); !_ok_ { err = errors.New("x3 error"); return } _v.X3 = make([]string, 0, len(_arr_)) for _, _e_ := range _arr_ { var _list_v_ string { if _list_v_, _ok_ = _e_.(string); !_ok_ { err = errors.New("_list_v_ error"); return } } _v.X3 = append(_v.X3, _list_v_) } } { var _arr_ []interface{} var _ok_ bool if _arr_, _ok_ = _buf["x4"].([]interface{}); !_ok_ { err = errors.New("x4 error"); return } _v.X4 = make([]int32, 0, len(_arr_)) for _, _e_ := range _arr_ { var _list_v_ int32 { var _ok_ bool; var _x_ float64; if _x_, _ok_ = _e_.(float64); !_ok_ { err = errors.New("_list_v_ error"); return }; _list_v_ = int32(_x_) } _v.X4 = append(_v.X4, _list_v_) } } return } func DeserializeTestTestSet(_buf map[string]interface{}) (*TestTestSet, error) { v := &TestTestSet{} if err := v.Deserialize(_buf); err == nil { return v, nil } else { return nil, err } } <|start_filename|>Projects/DataTemplates/template_lua2/l10n_tbl10ndemo.lua<|end_filename|> -- l10n.TbL10NDemo return { [11] = { id=11, text={key='/demo/1',text="测试1"}, }, [12] = { id=12, text={key='/demo/2',text="测试2"}, }, [13] = { id=13, text={key='/demo/3',text="测试3"}, }, [14] = { id=14, text={key='',text=""}, }, [15] = { id=15, text={key='/demo/5',text="测试5"}, }, [16] = { id=16, text={key='/demo/6',text="测试6"}, }, [17] = { id=17, text={key='/demo/7',text="测试7"}, }, [18] = { id=18, text={key='/demo/8',text="测试8"}, }, } <|start_filename|>Projects/GenerateDatas/convert_lua/error.TbCodeInfo/703.lua<|end_filename|> return { code = 703, key = "MAIL_AWARD_HAVE_RECEIVED", } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_UI_RectMask2D_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_UI_RectMask2D_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.UI.RectMask2D constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_IsRaycastLocationValid(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.RectMask2D; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<UnityEngine.Vector2>(false); var Arg1 = argHelper1.Get<UnityEngine.Camera>(false); var result = obj.IsRaycastLocationValid(Arg0,Arg1); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_PerformClipping(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.RectMask2D; { { obj.PerformClipping(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_UpdateClipSoftness(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.RectMask2D; { { obj.UpdateClipSoftness(); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_AddClippable(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.RectMask2D; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.UI.IClippable>(false); obj.AddClippable(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_RemoveClippable(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.RectMask2D; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.UI.IClippable>(false); obj.RemoveClippable(Arg0); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_padding(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.RectMask2D; var result = obj.padding; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_padding(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.RectMask2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.padding = argHelper.Get<UnityEngine.Vector4>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_softness(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.RectMask2D; var result = obj.softness; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_softness(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.RectMask2D; var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.softness = argHelper.Get<UnityEngine.Vector2Int>(false); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_canvasRect(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.RectMask2D; var result = obj.canvasRect; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_rectTransform(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as UnityEngine.UI.RectMask2D; var result = obj.rectTransform; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "IsRaycastLocationValid", IsStatic = false}, M_IsRaycastLocationValid }, { new Puerts.MethodKey {Name = "PerformClipping", IsStatic = false}, M_PerformClipping }, { new Puerts.MethodKey {Name = "UpdateClipSoftness", IsStatic = false}, M_UpdateClipSoftness }, { new Puerts.MethodKey {Name = "AddClippable", IsStatic = false}, M_AddClippable }, { new Puerts.MethodKey {Name = "RemoveClippable", IsStatic = false}, M_RemoveClippable }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"padding", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_padding, Setter = S_padding} }, {"softness", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_softness, Setter = S_softness} }, {"canvasRect", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_canvasRect, Setter = null} }, {"rectTransform", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_rectTransform, Setter = null} }, } }; } } } <|start_filename|>Projects/Csharp_ET_bin/Unity/Assets/Model/Generate/Luban_Config/error/ErrorStyleMsgbox.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; namespace cfg.error { public sealed partial class ErrorStyleMsgbox : error.ErrorStyle { public ErrorStyleMsgbox(ByteBuf _buf) : base(_buf) { BtnName = _buf.ReadString(); Operation = (error.EOperation)_buf.ReadInt(); } public ErrorStyleMsgbox(string btn_name, error.EOperation operation ) : base() { this.BtnName = btn_name; this.Operation = operation; } public static ErrorStyleMsgbox DeserializeErrorStyleMsgbox(ByteBuf _buf) { return new error.ErrorStyleMsgbox(_buf); } public readonly string BtnName; public readonly error.EOperation Operation; public const int ID = -1920482343; public override int GetTypeId() => ID; public override void Resolve(Dictionary<string, object> _tables) { base.Resolve(_tables); OnResolveFinish(_tables); } partial void OnResolveFinish(Dictionary<string, object> _tables); public override string ToString() { return "{ " + "BtnName:" + BtnName + "," + "Operation:" + Operation + "," + "}"; } } } <|start_filename|>Projects/GenerateDatas/convert_lua/role.TbRoleLevelExpAttr/40.lua<|end_filename|> return { level = 40, need_exp = 31000, clothes_attrs = { 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, }, } <|start_filename|>Projects/Java_bin/src/main/gen/cfg/item/ItemExtra.java<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ package cfg.item; import bright.serialization.*; public abstract class ItemExtra { public ItemExtra(ByteBuf _buf) { id = _buf.readInt(); } public ItemExtra(int id ) { this.id = id; } public static ItemExtra deserializeItemExtra(ByteBuf _buf) { switch (_buf.readInt()) { case cfg.item.TreasureBox.__ID__: return new cfg.item.TreasureBox(_buf); case cfg.item.InteractionItem.__ID__: return new cfg.item.InteractionItem(_buf); case cfg.item.Clothes.__ID__: return new cfg.item.Clothes(_buf); case cfg.item.DesignDrawing.__ID__: return new cfg.item.DesignDrawing(_buf); case cfg.item.Dymmy.__ID__: return new cfg.item.Dymmy(_buf); default: throw new SerializationException(); } } public final int id; public abstract int getTypeId(); public void resolve(java.util.HashMap<String, Object> _tables) { } @Override public String toString() { return "{ " + "id:" + id + "," + "}"; } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_ParticleSystem_EmissionModule_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_ParticleSystem_EmissionModule_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.ParticleSystem.EmissionModule constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetBursts(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.EmissionModule)Puerts.Utils.GetSelf((int)data, self); if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.ParticleSystem.Burst[]), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.ParticleSystem.Burst[]>(false); obj.SetBursts(Arg0); Puerts.Utils.SetSelf((int)data, self, obj); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(UnityEngine.ParticleSystem.Burst[]), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.ParticleSystem.Burst[]>(false); var Arg1 = argHelper1.GetInt32(false); obj.SetBursts(Arg0,Arg1); Puerts.Utils.SetSelf((int)data, self, obj); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to SetBursts"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetBursts(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.EmissionModule)Puerts.Utils.GetSelf((int)data, self); { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<UnityEngine.ParticleSystem.Burst[]>(false); var result = obj.GetBursts(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_SetBurst(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.EmissionModule)Puerts.Utils.GetSelf((int)data, self); { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<UnityEngine.ParticleSystem.Burst>(false); obj.SetBurst(Arg0,Arg1); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetBurst(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.EmissionModule)Puerts.Utils.GetSelf((int)data, self); { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetInt32(false); var result = obj.GetBurst(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); Puerts.Utils.SetSelf((int)data, self, obj); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_enabled(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.EmissionModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.enabled; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_enabled(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.EmissionModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.enabled = argHelper.GetBoolean(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_rateOverTime(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.EmissionModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.rateOverTime; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_rateOverTime(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.EmissionModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.rateOverTime = argHelper.Get<UnityEngine.ParticleSystem.MinMaxCurve>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_rateOverTimeMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.EmissionModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.rateOverTimeMultiplier; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_rateOverTimeMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.EmissionModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.rateOverTimeMultiplier = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_rateOverDistance(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.EmissionModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.rateOverDistance; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_rateOverDistance(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.EmissionModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.rateOverDistance = argHelper.Get<UnityEngine.ParticleSystem.MinMaxCurve>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_rateOverDistanceMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.EmissionModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.rateOverDistanceMultiplier; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_rateOverDistanceMultiplier(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.EmissionModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.rateOverDistanceMultiplier = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_burstCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.EmissionModule)Puerts.Utils.GetSelf((int)data, self); var result = obj.burstCount; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_burstCount(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.ParticleSystem.EmissionModule)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.burstCount = argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "SetBursts", IsStatic = false}, M_SetBursts }, { new Puerts.MethodKey {Name = "GetBursts", IsStatic = false}, M_GetBursts }, { new Puerts.MethodKey {Name = "SetBurst", IsStatic = false}, M_SetBurst }, { new Puerts.MethodKey {Name = "GetBurst", IsStatic = false}, M_GetBurst }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"enabled", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_enabled, Setter = S_enabled} }, {"rateOverTime", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_rateOverTime, Setter = S_rateOverTime} }, {"rateOverTimeMultiplier", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_rateOverTimeMultiplier, Setter = S_rateOverTimeMultiplier} }, {"rateOverDistance", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_rateOverDistance, Setter = S_rateOverDistance} }, {"rateOverDistanceMultiplier", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_rateOverDistanceMultiplier, Setter = S_rateOverDistanceMultiplier} }, {"burstCount", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_burstCount, Setter = S_burstCount} }, } }; } } } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/System_Type_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class System_Type_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to System.Type constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetType(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject | Puerts.JsValueType.Function, typeof(System.Func<System.Reflection.AssemblyName, System.Reflection.Assembly>), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject | Puerts.JsValueType.Function, typeof(System.Func<System.Reflection.Assembly, string, bool, System.Type>), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<System.Func<System.Reflection.AssemblyName, System.Reflection.Assembly>>(false); var Arg2 = argHelper2.Get<System.Func<System.Reflection.Assembly, string, bool, System.Type>>(false); var result = System.Type.GetType(Arg0,Arg1,Arg2); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.GetBoolean(false); var Arg2 = argHelper2.GetBoolean(false); var result = System.Type.GetType(Arg0,Arg1,Arg2); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject | Puerts.JsValueType.Function, typeof(System.Func<System.Reflection.AssemblyName, System.Reflection.Assembly>), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject | Puerts.JsValueType.Function, typeof(System.Func<System.Reflection.Assembly, string, bool, System.Type>), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<System.Func<System.Reflection.AssemblyName, System.Reflection.Assembly>>(false); var Arg2 = argHelper2.Get<System.Func<System.Reflection.Assembly, string, bool, System.Type>>(false); var Arg3 = argHelper3.GetBoolean(false); var result = System.Type.GetType(Arg0,Arg1,Arg2,Arg3); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject | Puerts.JsValueType.Function, typeof(System.Func<System.Reflection.AssemblyName, System.Reflection.Assembly>), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject | Puerts.JsValueType.Function, typeof(System.Func<System.Reflection.Assembly, string, bool, System.Type>), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Boolean, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<System.Func<System.Reflection.AssemblyName, System.Reflection.Assembly>>(false); var Arg2 = argHelper2.Get<System.Func<System.Reflection.Assembly, string, bool, System.Type>>(false); var Arg3 = argHelper3.GetBoolean(false); var Arg4 = argHelper4.GetBoolean(false); var result = System.Type.GetType(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var result = System.Type.GetType(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.GetBoolean(false); var result = System.Type.GetType(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetType"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_MakePointerType(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; { { var result = obj.MakePointerType(); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_MakeByRefType(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; { { var result = obj.MakeByRefType(); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_MakeArrayType(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; if (paramLen == 0) { { var result = obj.MakeArrayType(); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetInt32(false); var result = obj.MakeArrayType(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to MakeArrayType"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetTypeFromProgID(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var result = System.Type.GetTypeFromProgID(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.GetBoolean(false); var result = System.Type.GetTypeFromProgID(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.GetString(false); var result = System.Type.GetTypeFromProgID(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.GetString(false); var Arg2 = argHelper2.GetBoolean(false); var result = System.Type.GetTypeFromProgID(Arg0,Arg1,Arg2); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetTypeFromProgID"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetTypeFromCLSID(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(System.Guid), false, false)) { var Arg0 = argHelper0.Get<System.Guid>(false); var result = System.Type.GetTypeFromCLSID(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(System.Guid), false, false) && argHelper1.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.Get<System.Guid>(false); var Arg1 = argHelper1.GetBoolean(false); var result = System.Type.GetTypeFromCLSID(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(System.Guid), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.Get<System.Guid>(false); var Arg1 = argHelper1.GetString(false); var result = System.Type.GetTypeFromCLSID(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(System.Guid), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.Get<System.Guid>(false); var Arg1 = argHelper1.GetString(false); var Arg2 = argHelper2.GetBoolean(false); var result = System.Type.GetTypeFromCLSID(Arg0,Arg1,Arg2); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetTypeFromCLSID"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetTypeCode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.Type>(false); var result = System.Type.GetTypeCode(Arg0); Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_InvokeMember(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; if (paramLen == 8) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); var argHelper6 = new Puerts.ArgumentHelper((int)data, isolate, info, 6); var argHelper7 = new Puerts.ArgumentHelper((int)data, isolate, info, 7); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Reflection.Binder), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Any, typeof(System.Object), false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Object[]), false, false) && argHelper5.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Reflection.ParameterModifier[]), false, false) && argHelper6.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Globalization.CultureInfo), false, false) && argHelper7.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(string[]), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = (System.Reflection.BindingFlags)argHelper1.GetInt32(false); var Arg2 = argHelper2.Get<System.Reflection.Binder>(false); var Arg3 = argHelper3.Get<System.Object>(false); var Arg4 = argHelper4.Get<System.Object[]>(false); var Arg5 = argHelper5.Get<System.Reflection.ParameterModifier[]>(false); var Arg6 = argHelper6.Get<System.Globalization.CultureInfo>(false); var Arg7 = argHelper7.Get<string[]>(false); var result = obj.InvokeMember(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 6) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Reflection.Binder), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Any, typeof(System.Object), false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Object[]), false, false) && argHelper5.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Globalization.CultureInfo), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = (System.Reflection.BindingFlags)argHelper1.GetInt32(false); var Arg2 = argHelper2.Get<System.Reflection.Binder>(false); var Arg3 = argHelper3.Get<System.Object>(false); var Arg4 = argHelper4.Get<System.Object[]>(false); var Arg5 = argHelper5.Get<System.Globalization.CultureInfo>(false); var result = obj.InvokeMember(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Reflection.Binder), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Any, typeof(System.Object), false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Object[]), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = (System.Reflection.BindingFlags)argHelper1.GetInt32(false); var Arg2 = argHelper2.Get<System.Reflection.Binder>(false); var Arg3 = argHelper3.Get<System.Object>(false); var Arg4 = argHelper4.Get<System.Object[]>(false); var result = obj.InvokeMember(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to InvokeMember"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetTypeHandle(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.Object>(false); var result = System.Type.GetTypeHandle(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetArrayRank(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; { { var result = obj.GetArrayRank(); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetConstructor(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; if (paramLen == 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Reflection.Binder), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Type[]), false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Reflection.ParameterModifier[]), false, false)) { var Arg0 = (System.Reflection.BindingFlags)argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<System.Reflection.Binder>(false); var Arg2 = (System.Reflection.CallingConventions)argHelper2.GetInt32(false); var Arg3 = argHelper3.Get<System.Type[]>(false); var Arg4 = argHelper4.Get<System.Reflection.ParameterModifier[]>(false); var result = obj.GetConstructor(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Reflection.Binder), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Type[]), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Reflection.ParameterModifier[]), false, false)) { var Arg0 = (System.Reflection.BindingFlags)argHelper0.GetInt32(false); var Arg1 = argHelper1.Get<System.Reflection.Binder>(false); var Arg2 = argHelper2.Get<System.Type[]>(false); var Arg3 = argHelper3.Get<System.Reflection.ParameterModifier[]>(false); var result = obj.GetConstructor(Arg0,Arg1,Arg2,Arg3); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Type[]), false, false)) { var Arg0 = argHelper0.Get<System.Type[]>(false); var result = obj.GetConstructor(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetConstructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetConstructors(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; if (paramLen == 0) { { var result = obj.GetConstructors(); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = (System.Reflection.BindingFlags)argHelper0.GetInt32(false); var result = obj.GetConstructors(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetConstructors"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetMethod(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; if (paramLen == 6) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Reflection.Binder), false, false) && argHelper3.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Type[]), false, false) && argHelper5.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Reflection.ParameterModifier[]), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = (System.Reflection.BindingFlags)argHelper1.GetInt32(false); var Arg2 = argHelper2.Get<System.Reflection.Binder>(false); var Arg3 = (System.Reflection.CallingConventions)argHelper3.GetInt32(false); var Arg4 = argHelper4.Get<System.Type[]>(false); var Arg5 = argHelper5.Get<System.Reflection.ParameterModifier[]>(false); var result = obj.GetMethod(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Reflection.Binder), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Type[]), false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Reflection.ParameterModifier[]), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = (System.Reflection.BindingFlags)argHelper1.GetInt32(false); var Arg2 = argHelper2.Get<System.Reflection.Binder>(false); var Arg3 = argHelper3.Get<System.Type[]>(false); var Arg4 = argHelper4.Get<System.Reflection.ParameterModifier[]>(false); var result = obj.GetMethod(Arg0,Arg1,Arg2,Arg3,Arg4); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Type[]), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Reflection.ParameterModifier[]), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<System.Type[]>(false); var Arg2 = argHelper2.Get<System.Reflection.ParameterModifier[]>(false); var result = obj.GetMethod(Arg0,Arg1,Arg2); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Type[]), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<System.Type[]>(false); var result = obj.GetMethod(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = (System.Reflection.BindingFlags)argHelper1.GetInt32(false); var result = obj.GetMethod(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var result = obj.GetMethod(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetMethod"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetMethods(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; if (paramLen == 0) { { var result = obj.GetMethods(); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = (System.Reflection.BindingFlags)argHelper0.GetInt32(false); var result = obj.GetMethods(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetMethods"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetField(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = (System.Reflection.BindingFlags)argHelper1.GetInt32(false); var result = obj.GetField(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var result = obj.GetField(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetField"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetFields(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; if (paramLen == 0) { { var result = obj.GetFields(); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = (System.Reflection.BindingFlags)argHelper0.GetInt32(false); var result = obj.GetFields(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetFields"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetInterface(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var result = obj.GetInterface(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Boolean, null, false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.GetBoolean(false); var result = obj.GetInterface(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetInterface"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetInterfaces(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; { { var result = obj.GetInterfaces(); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_FindInterfaces(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var Arg0 = argHelper0.Get<System.Reflection.TypeFilter>(false); var Arg1 = argHelper1.Get<System.Object>(false); var result = obj.FindInterfaces(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetEvent(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var result = obj.GetEvent(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = (System.Reflection.BindingFlags)argHelper1.GetInt32(false); var result = obj.GetEvent(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetEvent"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetEvents(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; if (paramLen == 0) { { var result = obj.GetEvents(); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = (System.Reflection.BindingFlags)argHelper0.GetInt32(false); var result = obj.GetEvents(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetEvents"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetProperty(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; if (paramLen == 6) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Reflection.Binder), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Type), false, false) && argHelper4.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Type[]), false, false) && argHelper5.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Reflection.ParameterModifier[]), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = (System.Reflection.BindingFlags)argHelper1.GetInt32(false); var Arg2 = argHelper2.Get<System.Reflection.Binder>(false); var Arg3 = argHelper3.Get<System.Type>(false); var Arg4 = argHelper4.Get<System.Type[]>(false); var Arg5 = argHelper5.Get<System.Reflection.ParameterModifier[]>(false); var result = obj.GetProperty(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Type), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Type[]), false, false) && argHelper3.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Reflection.ParameterModifier[]), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<System.Type>(false); var Arg2 = argHelper2.Get<System.Type[]>(false); var Arg3 = argHelper3.Get<System.Reflection.ParameterModifier[]>(false); var result = obj.GetProperty(Arg0,Arg1,Arg2,Arg3); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = (System.Reflection.BindingFlags)argHelper1.GetInt32(false); var result = obj.GetProperty(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Type[]), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<System.Type[]>(false); var result = obj.GetProperty(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Type), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<System.Type>(false); var result = obj.GetProperty(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Type), false, false) && argHelper2.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Type[]), false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.Get<System.Type>(false); var Arg2 = argHelper2.Get<System.Type[]>(false); var result = obj.GetProperty(Arg0,Arg1,Arg2); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var result = obj.GetProperty(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetProperty"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetProperties(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = (System.Reflection.BindingFlags)argHelper0.GetInt32(false); var result = obj.GetProperties(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 0) { { var result = obj.GetProperties(); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetProperties"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetNestedTypes(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; if (paramLen == 0) { { var result = obj.GetNestedTypes(); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = (System.Reflection.BindingFlags)argHelper0.GetInt32(false); var result = obj.GetNestedTypes(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetNestedTypes"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetNestedType(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var result = obj.GetNestedType(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = (System.Reflection.BindingFlags)argHelper1.GetInt32(false); var result = obj.GetNestedType(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetNestedType"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetMember(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false)) { var Arg0 = argHelper0.GetString(false); var result = obj.GetMember(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 2) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = (System.Reflection.BindingFlags)argHelper1.GetInt32(false); var result = obj.GetMember(Arg0,Arg1); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.String, null, false, false) && argHelper1.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.GetString(false); var Arg1 = (System.Reflection.MemberTypes)argHelper1.GetInt32(false); var Arg2 = (System.Reflection.BindingFlags)argHelper2.GetInt32(false); var result = obj.GetMember(Arg0,Arg1,Arg2); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetMember"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetMembers(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; if (paramLen == 0) { { var result = obj.GetMembers(); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = (System.Reflection.BindingFlags)argHelper0.GetInt32(false); var result = obj.GetMembers(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to GetMembers"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetDefaultMembers(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; { { var result = obj.GetDefaultMembers(); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_FindMembers(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); { var Arg0 = (System.Reflection.MemberTypes)argHelper0.GetInt32(false); var Arg1 = (System.Reflection.BindingFlags)argHelper1.GetInt32(false); var Arg2 = argHelper2.Get<System.Reflection.MemberFilter>(false); var Arg3 = argHelper3.Get<System.Object>(false); var result = obj.FindMembers(Arg0,Arg1,Arg2,Arg3); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetGenericParameterConstraints(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; { { var result = obj.GetGenericParameterConstraints(); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_MakeGenericType(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.GetParams<System.Type>(info, 0, paramLen); var result = obj.MakeGenericType(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetElementType(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; { { var result = obj.GetElementType(); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetGenericArguments(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; { { var result = obj.GetGenericArguments(); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetGenericTypeDefinition(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; { { var result = obj.GetGenericTypeDefinition(); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetEnumNames(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; { { var result = obj.GetEnumNames(); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetEnumValues(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; { { var result = obj.GetEnumValues(); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetEnumUnderlyingType(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; { { var result = obj.GetEnumUnderlyingType(); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_IsEnumDefined(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.Object>(false); var result = obj.IsEnumDefined(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetEnumName(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.Object>(false); var result = obj.GetEnumName(Arg0); Puerts.PuertsDLL.ReturnString(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_IsSubclassOf(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.Type>(false); var result = obj.IsSubclassOf(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_IsInstanceOfType(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.Object>(false); var result = obj.IsInstanceOfType(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_IsAssignableFrom(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.Type>(false); var result = obj.IsAssignableFrom(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_IsEquivalentTo(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.Type>(false); var result = obj.IsEquivalentTo(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_ToString(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; { { var result = obj.ToString(); Puerts.PuertsDLL.ReturnString(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetTypeArray(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.Object[]>(false); var result = System.Type.GetTypeArray(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_Equals(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; if (paramLen == 1) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); if (argHelper0.IsMatch(Puerts.JsValueType.Any, typeof(System.Object), false, false)) { var Arg0 = argHelper0.Get<System.Object>(false); var result = obj.Equals(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } if (argHelper0.IsMatch(Puerts.JsValueType.NullOrUndefined | Puerts.JsValueType.NativeObject, typeof(System.Type), false, false)) { var Arg0 = argHelper0.Get<System.Type>(false); var result = obj.Equals(Arg0); Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to Equals"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetHashCode(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; { { var result = obj.GetHashCode(); Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetInterfaceMap(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.Type>(false); var result = obj.GetInterfaceMap(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void M_GetType(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; { { var result = obj.GetType(); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_ReflectionOnlyGetType(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); { var Arg0 = argHelper0.GetString(false); var Arg1 = argHelper1.GetBoolean(false); var Arg2 = argHelper2.GetBoolean(false); var result = System.Type.ReflectionOnlyGetType(Arg0,Arg1,Arg2); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_GetTypeFromHandle(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); { var Arg0 = argHelper0.Get<System.RuntimeTypeHandle>(false); var result = System.Type.GetTypeFromHandle(Arg0); Puerts.ResultHelper.Set((int)data, isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_MemberType(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; var result = obj.MemberType; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_DeclaringType(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; var result = obj.DeclaringType; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_DeclaringMethod(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; var result = obj.DeclaringMethod; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_ReflectedType(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; var result = obj.ReflectedType; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_StructLayoutAttribute(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; var result = obj.StructLayoutAttribute; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_GUID(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; var result = obj.GUID; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_DefaultBinder(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = System.Type.DefaultBinder; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_Module(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; var result = obj.Module; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_Assembly(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; var result = obj.Assembly; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_TypeHandle(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; var result = obj.TypeHandle; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_FullName(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; var result = obj.FullName; Puerts.PuertsDLL.ReturnString(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_Namespace(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; var result = obj.Namespace; Puerts.PuertsDLL.ReturnString(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_AssemblyQualifiedName(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; var result = obj.AssemblyQualifiedName; Puerts.PuertsDLL.ReturnString(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_BaseType(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; var result = obj.BaseType; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_TypeInitializer(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; var result = obj.TypeInitializer; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_IsNested(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; var result = obj.IsNested; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_Attributes(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; var result = obj.Attributes; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_GenericParameterAttributes(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; var result = obj.GenericParameterAttributes; Puerts.PuertsDLL.ReturnNumber(isolate, info, (int)result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_IsVisible(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; var result = obj.IsVisible; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_IsNotPublic(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; var result = obj.IsNotPublic; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_IsPublic(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; var result = obj.IsPublic; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_IsNestedPublic(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; var result = obj.IsNestedPublic; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_IsNestedPrivate(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; var result = obj.IsNestedPrivate; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_IsNestedFamily(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; var result = obj.IsNestedFamily; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_IsNestedAssembly(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; var result = obj.IsNestedAssembly; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_IsNestedFamANDAssem(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; var result = obj.IsNestedFamANDAssem; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_IsNestedFamORAssem(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; var result = obj.IsNestedFamORAssem; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_IsAutoLayout(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; var result = obj.IsAutoLayout; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_IsLayoutSequential(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; var result = obj.IsLayoutSequential; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_IsExplicitLayout(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; var result = obj.IsExplicitLayout; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_IsClass(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; var result = obj.IsClass; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_IsInterface(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; var result = obj.IsInterface; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_IsValueType(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; var result = obj.IsValueType; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_IsAbstract(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; var result = obj.IsAbstract; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_IsSealed(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; var result = obj.IsSealed; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_IsEnum(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; var result = obj.IsEnum; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_IsSpecialName(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; var result = obj.IsSpecialName; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_IsImport(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; var result = obj.IsImport; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_IsSerializable(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; var result = obj.IsSerializable; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_IsAnsiClass(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; var result = obj.IsAnsiClass; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_IsUnicodeClass(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; var result = obj.IsUnicodeClass; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_IsAutoClass(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; var result = obj.IsAutoClass; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_IsArray(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; var result = obj.IsArray; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_IsGenericType(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; var result = obj.IsGenericType; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_IsGenericTypeDefinition(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; var result = obj.IsGenericTypeDefinition; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_IsConstructedGenericType(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; var result = obj.IsConstructedGenericType; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_IsGenericParameter(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; var result = obj.IsGenericParameter; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_GenericParameterPosition(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; var result = obj.GenericParameterPosition; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_ContainsGenericParameters(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; var result = obj.ContainsGenericParameters; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_IsByRef(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; var result = obj.IsByRef; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_IsPointer(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; var result = obj.IsPointer; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_IsPrimitive(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; var result = obj.IsPrimitive; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_IsCOMObject(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; var result = obj.IsCOMObject; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_HasElementType(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; var result = obj.HasElementType; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_IsContextful(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; var result = obj.IsContextful; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_IsMarshalByRef(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; var result = obj.IsMarshalByRef; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_GenericTypeArguments(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; var result = obj.GenericTypeArguments; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_IsSecurityCritical(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; var result = obj.IsSecurityCritical; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_IsSecuritySafeCritical(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; var result = obj.IsSecuritySafeCritical; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_IsSecurityTransparent(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; var result = obj.IsSecurityTransparent; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_UnderlyingSystemType(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = Puerts.Utils.GetSelf((int)data, self) as System.Type; var result = obj.UnderlyingSystemType; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_FilterAttribute(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = System.Type.FilterAttribute; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_FilterName(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = System.Type.FilterName; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_FilterNameIgnoreCase(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = System.Type.FilterNameIgnoreCase; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_Missing(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = System.Type.Missing; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_Delimiter(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = System.Type.Delimiter; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_EmptyTypes(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var result = System.Type.EmptyTypes; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void O_op_Equality(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var arg0 = argHelper0.Get<System.Type>(false); var arg1 = argHelper1.Get<System.Type>(false); var result = arg0 == arg1; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void O_op_Inequality(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); { var arg0 = argHelper0.Get<System.Type>(false); var arg1 = argHelper1.Get<System.Type>(false); var result = arg0 != arg1; Puerts.PuertsDLL.ReturnBoolean(isolate, info, result); } } } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "GetType", IsStatic = true}, F_GetType }, { new Puerts.MethodKey {Name = "MakePointerType", IsStatic = false}, M_MakePointerType }, { new Puerts.MethodKey {Name = "MakeByRefType", IsStatic = false}, M_MakeByRefType }, { new Puerts.MethodKey {Name = "MakeArrayType", IsStatic = false}, M_MakeArrayType }, { new Puerts.MethodKey {Name = "GetTypeFromProgID", IsStatic = true}, F_GetTypeFromProgID }, { new Puerts.MethodKey {Name = "GetTypeFromCLSID", IsStatic = true}, F_GetTypeFromCLSID }, { new Puerts.MethodKey {Name = "GetTypeCode", IsStatic = true}, F_GetTypeCode }, { new Puerts.MethodKey {Name = "InvokeMember", IsStatic = false}, M_InvokeMember }, { new Puerts.MethodKey {Name = "GetTypeHandle", IsStatic = true}, F_GetTypeHandle }, { new Puerts.MethodKey {Name = "GetArrayRank", IsStatic = false}, M_GetArrayRank }, { new Puerts.MethodKey {Name = "GetConstructor", IsStatic = false}, M_GetConstructor }, { new Puerts.MethodKey {Name = "GetConstructors", IsStatic = false}, M_GetConstructors }, { new Puerts.MethodKey {Name = "GetMethod", IsStatic = false}, M_GetMethod }, { new Puerts.MethodKey {Name = "GetMethods", IsStatic = false}, M_GetMethods }, { new Puerts.MethodKey {Name = "GetField", IsStatic = false}, M_GetField }, { new Puerts.MethodKey {Name = "GetFields", IsStatic = false}, M_GetFields }, { new Puerts.MethodKey {Name = "GetInterface", IsStatic = false}, M_GetInterface }, { new Puerts.MethodKey {Name = "GetInterfaces", IsStatic = false}, M_GetInterfaces }, { new Puerts.MethodKey {Name = "FindInterfaces", IsStatic = false}, M_FindInterfaces }, { new Puerts.MethodKey {Name = "GetEvent", IsStatic = false}, M_GetEvent }, { new Puerts.MethodKey {Name = "GetEvents", IsStatic = false}, M_GetEvents }, { new Puerts.MethodKey {Name = "GetProperty", IsStatic = false}, M_GetProperty }, { new Puerts.MethodKey {Name = "GetProperties", IsStatic = false}, M_GetProperties }, { new Puerts.MethodKey {Name = "GetNestedTypes", IsStatic = false}, M_GetNestedTypes }, { new Puerts.MethodKey {Name = "GetNestedType", IsStatic = false}, M_GetNestedType }, { new Puerts.MethodKey {Name = "GetMember", IsStatic = false}, M_GetMember }, { new Puerts.MethodKey {Name = "GetMembers", IsStatic = false}, M_GetMembers }, { new Puerts.MethodKey {Name = "GetDefaultMembers", IsStatic = false}, M_GetDefaultMembers }, { new Puerts.MethodKey {Name = "FindMembers", IsStatic = false}, M_FindMembers }, { new Puerts.MethodKey {Name = "GetGenericParameterConstraints", IsStatic = false}, M_GetGenericParameterConstraints }, { new Puerts.MethodKey {Name = "MakeGenericType", IsStatic = false}, M_MakeGenericType }, { new Puerts.MethodKey {Name = "GetElementType", IsStatic = false}, M_GetElementType }, { new Puerts.MethodKey {Name = "GetGenericArguments", IsStatic = false}, M_GetGenericArguments }, { new Puerts.MethodKey {Name = "GetGenericTypeDefinition", IsStatic = false}, M_GetGenericTypeDefinition }, { new Puerts.MethodKey {Name = "GetEnumNames", IsStatic = false}, M_GetEnumNames }, { new Puerts.MethodKey {Name = "GetEnumValues", IsStatic = false}, M_GetEnumValues }, { new Puerts.MethodKey {Name = "GetEnumUnderlyingType", IsStatic = false}, M_GetEnumUnderlyingType }, { new Puerts.MethodKey {Name = "IsEnumDefined", IsStatic = false}, M_IsEnumDefined }, { new Puerts.MethodKey {Name = "GetEnumName", IsStatic = false}, M_GetEnumName }, { new Puerts.MethodKey {Name = "IsSubclassOf", IsStatic = false}, M_IsSubclassOf }, { new Puerts.MethodKey {Name = "IsInstanceOfType", IsStatic = false}, M_IsInstanceOfType }, { new Puerts.MethodKey {Name = "IsAssignableFrom", IsStatic = false}, M_IsAssignableFrom }, { new Puerts.MethodKey {Name = "IsEquivalentTo", IsStatic = false}, M_IsEquivalentTo }, { new Puerts.MethodKey {Name = "ToString", IsStatic = false}, M_ToString }, { new Puerts.MethodKey {Name = "GetTypeArray", IsStatic = true}, F_GetTypeArray }, { new Puerts.MethodKey {Name = "Equals", IsStatic = false}, M_Equals }, { new Puerts.MethodKey {Name = "GetHashCode", IsStatic = false}, M_GetHashCode }, { new Puerts.MethodKey {Name = "GetInterfaceMap", IsStatic = false}, M_GetInterfaceMap }, { new Puerts.MethodKey {Name = "GetType", IsStatic = false}, M_GetType }, { new Puerts.MethodKey {Name = "ReflectionOnlyGetType", IsStatic = true}, F_ReflectionOnlyGetType }, { new Puerts.MethodKey {Name = "GetTypeFromHandle", IsStatic = true}, F_GetTypeFromHandle }, { new Puerts.MethodKey {Name = "op_Equality", IsStatic = true}, O_op_Equality}, { new Puerts.MethodKey {Name = "op_Inequality", IsStatic = true}, O_op_Inequality}, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"MemberType", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_MemberType, Setter = null} }, {"DeclaringType", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_DeclaringType, Setter = null} }, {"DeclaringMethod", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_DeclaringMethod, Setter = null} }, {"ReflectedType", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_ReflectedType, Setter = null} }, {"StructLayoutAttribute", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_StructLayoutAttribute, Setter = null} }, {"GUID", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_GUID, Setter = null} }, {"DefaultBinder", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_DefaultBinder, Setter = null} }, {"Module", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_Module, Setter = null} }, {"Assembly", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_Assembly, Setter = null} }, {"TypeHandle", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_TypeHandle, Setter = null} }, {"FullName", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_FullName, Setter = null} }, {"Namespace", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_Namespace, Setter = null} }, {"AssemblyQualifiedName", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_AssemblyQualifiedName, Setter = null} }, {"BaseType", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_BaseType, Setter = null} }, {"TypeInitializer", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_TypeInitializer, Setter = null} }, {"IsNested", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_IsNested, Setter = null} }, {"Attributes", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_Attributes, Setter = null} }, {"GenericParameterAttributes", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_GenericParameterAttributes, Setter = null} }, {"IsVisible", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_IsVisible, Setter = null} }, {"IsNotPublic", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_IsNotPublic, Setter = null} }, {"IsPublic", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_IsPublic, Setter = null} }, {"IsNestedPublic", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_IsNestedPublic, Setter = null} }, {"IsNestedPrivate", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_IsNestedPrivate, Setter = null} }, {"IsNestedFamily", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_IsNestedFamily, Setter = null} }, {"IsNestedAssembly", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_IsNestedAssembly, Setter = null} }, {"IsNestedFamANDAssem", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_IsNestedFamANDAssem, Setter = null} }, {"IsNestedFamORAssem", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_IsNestedFamORAssem, Setter = null} }, {"IsAutoLayout", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_IsAutoLayout, Setter = null} }, {"IsLayoutSequential", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_IsLayoutSequential, Setter = null} }, {"IsExplicitLayout", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_IsExplicitLayout, Setter = null} }, {"IsClass", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_IsClass, Setter = null} }, {"IsInterface", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_IsInterface, Setter = null} }, {"IsValueType", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_IsValueType, Setter = null} }, {"IsAbstract", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_IsAbstract, Setter = null} }, {"IsSealed", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_IsSealed, Setter = null} }, {"IsEnum", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_IsEnum, Setter = null} }, {"IsSpecialName", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_IsSpecialName, Setter = null} }, {"IsImport", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_IsImport, Setter = null} }, {"IsSerializable", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_IsSerializable, Setter = null} }, {"IsAnsiClass", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_IsAnsiClass, Setter = null} }, {"IsUnicodeClass", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_IsUnicodeClass, Setter = null} }, {"IsAutoClass", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_IsAutoClass, Setter = null} }, {"IsArray", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_IsArray, Setter = null} }, {"IsGenericType", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_IsGenericType, Setter = null} }, {"IsGenericTypeDefinition", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_IsGenericTypeDefinition, Setter = null} }, {"IsConstructedGenericType", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_IsConstructedGenericType, Setter = null} }, {"IsGenericParameter", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_IsGenericParameter, Setter = null} }, {"GenericParameterPosition", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_GenericParameterPosition, Setter = null} }, {"ContainsGenericParameters", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_ContainsGenericParameters, Setter = null} }, {"IsByRef", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_IsByRef, Setter = null} }, {"IsPointer", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_IsPointer, Setter = null} }, {"IsPrimitive", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_IsPrimitive, Setter = null} }, {"IsCOMObject", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_IsCOMObject, Setter = null} }, {"HasElementType", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_HasElementType, Setter = null} }, {"IsContextful", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_IsContextful, Setter = null} }, {"IsMarshalByRef", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_IsMarshalByRef, Setter = null} }, {"GenericTypeArguments", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_GenericTypeArguments, Setter = null} }, {"IsSecurityCritical", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_IsSecurityCritical, Setter = null} }, {"IsSecuritySafeCritical", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_IsSecuritySafeCritical, Setter = null} }, {"IsSecurityTransparent", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_IsSecurityTransparent, Setter = null} }, {"UnderlyingSystemType", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_UnderlyingSystemType, Setter = null} }, {"FilterAttribute", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_FilterAttribute, Setter = null} }, {"FilterName", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_FilterName, Setter = null} }, {"FilterNameIgnoreCase", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_FilterNameIgnoreCase, Setter = null} }, {"Missing", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_Missing, Setter = null} }, {"Delimiter", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_Delimiter, Setter = null} }, {"EmptyTypes", new Puerts.PropertyRegisterInfo(){ IsStatic = true, Getter = G_EmptyTypes, Setter = null} }, } }; } } } <|start_filename|>Projects/GenerateDatas/convert_lua/role.TbRoleLevelExpAttr/80.lua<|end_filename|> return { level = 80, need_exp = 225000, clothes_attrs = { 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, }, } <|start_filename|>Projects/TypeScript_Unity_Puerts_Json/Assets/Gen/UnityEngine_CapsulecastCommand_Wrap.cs<|end_filename|> using System; namespace PuertsStaticWrap { public static class UnityEngine_CapsulecastCommand_Wrap { [Puerts.MonoPInvokeCallback(typeof(Puerts.V8ConstructorCallback))] private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data) { try { if (paramLen == 6) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); var argHelper5 = new Puerts.ArgumentHelper((int)data, isolate, info, 5); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper5.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3>(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.Get<UnityEngine.Vector3>(false); var Arg4 = argHelper4.GetFloat(false); var Arg5 = argHelper5.GetInt32(false); var result = new UnityEngine.CapsulecastCommand(Arg0,Arg1,Arg2,Arg3,Arg4,Arg5); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.CapsulecastCommand), result); } } if (paramLen == 5) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); var argHelper4 = new Puerts.ArgumentHelper((int)data, isolate, info, 4); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper4.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3>(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.Get<UnityEngine.Vector3>(false); var Arg4 = argHelper4.GetFloat(false); var result = new UnityEngine.CapsulecastCommand(Arg0,Arg1,Arg2,Arg3,Arg4); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.CapsulecastCommand), result); } } if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(UnityEngine.Vector3), false, false)) { var Arg0 = argHelper0.Get<UnityEngine.Vector3>(false); var Arg1 = argHelper1.Get<UnityEngine.Vector3>(false); var Arg2 = argHelper2.GetFloat(false); var Arg3 = argHelper3.Get<UnityEngine.Vector3>(false); var result = new UnityEngine.CapsulecastCommand(Arg0,Arg1,Arg2,Arg3); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.CapsulecastCommand), result); } } if (paramLen == 0) { { var result = new UnityEngine.CapsulecastCommand(); return Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.CapsulecastCommand), result); } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to UnityEngine.CapsulecastCommand constructor"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } return IntPtr.Zero; } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void F_ScheduleBatch(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { if (paramLen == 4) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); var argHelper3 = new Puerts.ArgumentHelper((int)data, isolate, info, 3); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(Unity.Collections.NativeArray<UnityEngine.CapsulecastCommand>), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(Unity.Collections.NativeArray<UnityEngine.RaycastHit>), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false) && argHelper3.IsMatch(Puerts.JsValueType.NativeObject, typeof(Unity.Jobs.JobHandle), false, false)) { var Arg0 = argHelper0.Get<Unity.Collections.NativeArray<UnityEngine.CapsulecastCommand>>(false); var Arg1 = argHelper1.Get<Unity.Collections.NativeArray<UnityEngine.RaycastHit>>(false); var Arg2 = argHelper2.GetInt32(false); var Arg3 = argHelper3.Get<Unity.Jobs.JobHandle>(false); var result = UnityEngine.CapsulecastCommand.ScheduleBatch(Arg0,Arg1,Arg2,Arg3); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } if (paramLen == 3) { var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0); var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1); var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2); if (argHelper0.IsMatch(Puerts.JsValueType.NativeObject, typeof(Unity.Collections.NativeArray<UnityEngine.CapsulecastCommand>), false, false) && argHelper1.IsMatch(Puerts.JsValueType.NativeObject, typeof(Unity.Collections.NativeArray<UnityEngine.RaycastHit>), false, false) && argHelper2.IsMatch(Puerts.JsValueType.Number, null, false, false)) { var Arg0 = argHelper0.Get<Unity.Collections.NativeArray<UnityEngine.CapsulecastCommand>>(false); var Arg1 = argHelper1.Get<Unity.Collections.NativeArray<UnityEngine.RaycastHit>>(false); var Arg2 = argHelper2.GetInt32(false); var result = UnityEngine.CapsulecastCommand.ScheduleBatch(Arg0,Arg1,Arg2); Puerts.ResultHelper.Set((int)data, isolate, info, result); return; } } Puerts.PuertsDLL.ThrowException(isolate, "invalid arguments to ScheduleBatch"); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_point1(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.CapsulecastCommand)Puerts.Utils.GetSelf((int)data, self); var result = obj.point1; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_point1(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.CapsulecastCommand)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.point1 = argHelper.Get<UnityEngine.Vector3>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_point2(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.CapsulecastCommand)Puerts.Utils.GetSelf((int)data, self); var result = obj.point2; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_point2(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.CapsulecastCommand)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.point2 = argHelper.Get<UnityEngine.Vector3>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_radius(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.CapsulecastCommand)Puerts.Utils.GetSelf((int)data, self); var result = obj.radius; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_radius(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.CapsulecastCommand)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.radius = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_direction(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.CapsulecastCommand)Puerts.Utils.GetSelf((int)data, self); var result = obj.direction; Puerts.ResultHelper.Set((int)data, isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_direction(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.CapsulecastCommand)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.direction = argHelper.Get<UnityEngine.Vector3>(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_distance(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.CapsulecastCommand)Puerts.Utils.GetSelf((int)data, self); var result = obj.distance; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_distance(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.CapsulecastCommand)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.distance = argHelper.GetFloat(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void G_layerMask(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.CapsulecastCommand)Puerts.Utils.GetSelf((int)data, self); var result = obj.layerMask; Puerts.PuertsDLL.ReturnNumber(isolate, info, result); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))] private static void S_layerMask(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data) { try { var obj = (UnityEngine.CapsulecastCommand)Puerts.Utils.GetSelf((int)data, self); var argHelper = new Puerts.ArgumentHelper((int)data, isolate, info, 0); obj.layerMask = argHelper.GetInt32(false); Puerts.Utils.SetSelf((int)data, self, obj); } catch (Exception e) { Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace); } } public static Puerts.TypeRegisterInfo GetRegisterInfo() { return new Puerts.TypeRegisterInfo() { BlittableCopy = false, Constructor = Constructor, Methods = new System.Collections.Generic.Dictionary<Puerts.MethodKey, Puerts.V8FunctionCallback>() { { new Puerts.MethodKey {Name = "ScheduleBatch", IsStatic = true}, F_ScheduleBatch }, }, Properties = new System.Collections.Generic.Dictionary<string, Puerts.PropertyRegisterInfo>() { {"point1", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_point1, Setter = S_point1} }, {"point2", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_point2, Setter = S_point2} }, {"radius", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_radius, Setter = S_radius} }, {"direction", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_direction, Setter = S_direction} }, {"distance", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_distance, Setter = S_distance} }, {"layerMask", new Puerts.PropertyRegisterInfo(){ IsStatic = false, Getter = G_layerMask, Setter = S_layerMask} }, } }; } } }
fanlanweiy/luban_examples
<|start_filename|>app/src/main/java/com/eure/citrus/ui/adapter/GroupListAdapter.java<|end_filename|> package com.eure.citrus.ui.adapter; import com.eure.citrus.R; import com.eure.citrus.helper.GroupHelper; import com.eure.citrus.listener.OnRecyclerItemClickListener; import com.eure.citrus.model.entity.Group; import android.support.v7.widget.AppCompatTextView; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import butterknife.Bind; import butterknife.ButterKnife; import io.realm.RealmResults; /** * Created by katsuyagoto on 15/06/19. */ public class GroupListAdapter extends RecyclerView.Adapter<GroupListAdapter.ViewHolder> { private RealmResults<Group> mGroups; private static OnRecyclerItemClickListener sOnRecyclerItemClickListener; public GroupListAdapter(RealmResults<Group> groups, OnRecyclerItemClickListener onRecyclerItemClickListener) { super(); mGroups = groups; sOnRecyclerItemClickListener = onRecyclerItemClickListener; } @Override public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_group_list, parent, false); return new ViewHolder(v); } @Override public void onBindViewHolder(ViewHolder holder, int position) { Group group = mGroups.get(position); holder.groupNameText.setText(group.getName()); holder.groupDescriptionText.setText(group.getDescription()); if (group.isDefaultGroup()) { GroupHelper.setupDefaultGroupImage(group.getName(), holder.groupImageView); } } public Group getItem(int position) { return mGroups.get(position); } @Override public int getItemCount() { return mGroups.size(); } public void release() { sOnRecyclerItemClickListener = null; } static class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener { @Bind(R.id.group_image) ImageView groupImageView; @Bind(R.id.group_name) AppCompatTextView groupNameText; @Bind(R.id.group_description) AppCompatTextView groupDescriptionText; public ViewHolder(final View v) { super(v); v.setOnClickListener(this); ButterKnife.bind(this, v); } @Override public void onClick(View view) { int position = this.getAdapterPosition(); if (position != RecyclerView.NO_POSITION) { sOnRecyclerItemClickListener.onClickRecyclerItem(view, position); } } } } <|start_filename|>app/src/main/java/com/eure/citrus/ui/GroupPopularListFragment.java<|end_filename|> package com.eure.citrus.ui; import com.eure.citrus.R; import com.eure.citrus.Utils; import com.eure.citrus.helper.GroupHelper; import com.eure.citrus.listener.OnRecyclerItemClickListener; import com.eure.citrus.model.entity.Group; import com.eure.citrus.model.repository.GroupRepository; import com.eure.citrus.ui.adapter.GroupListAdapter; import com.eure.citrus.ui.widget.DividerItemDecoration; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v7.widget.DefaultItemAnimator; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import butterknife.ButterKnife; import io.realm.Realm; import io.realm.RealmResults; import static butterknife.ButterKnife.findById; /** * Created by katsuyagoto on 15/06/19. */ public class GroupPopularListFragment extends Fragment implements OnRecyclerItemClickListener { public GroupPopularListFragment() { } public static GroupPopularListFragment newInstance() { return new GroupPopularListFragment(); } private GroupListAdapter mGroupListAdapter; // Realm instance for the UI thread private Realm mUIThreadRealm; @Override public void onAttach(Context context) { super.onAttach(context); mUIThreadRealm = Realm.getDefaultInstance(); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_group_list, container, false); ButterKnife.bind(this, view); return view; } @Override public void onViewCreated(final View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); String categoryName = GroupHelper.CATEGORY_POPULAR; RealmResults<Group> groups = GroupRepository.findAllByCategoryName(mUIThreadRealm, categoryName); mGroupListAdapter = new GroupListAdapter(groups, this); RecyclerView recyclerView = findById(view, R.id.group_list_recycler_view); recyclerView.addItemDecoration( new DividerItemDecoration(Utils.getDrawableResource(getActivity(), R.drawable.line))); final LinearLayoutManager layoutManager = new LinearLayoutManager(getActivity()); layoutManager.setOrientation(LinearLayoutManager.VERTICAL); recyclerView.setLayoutManager(layoutManager); recyclerView.setHasFixedSize(true); recyclerView.setItemAnimator(new DefaultItemAnimator()); recyclerView.setAdapter(mGroupListAdapter); } @Override public void onClickRecyclerItem(View v, int position) { Group group = mGroupListAdapter.getItem(position); Intent intent = GroupDetailActivity.createIntent(getActivity(), group.getName()); startActivity(intent); } @Override public void onDestroyView() { super.onDestroyView(); ButterKnife.unbind(this); } @Override public void onDestroy() { super.onDestroy(); mGroupListAdapter.release(); mUIThreadRealm.close(); } } <|start_filename|>app/src/main/java/com/eure/citrus/ui/HomeFragment.java<|end_filename|> package com.eure.citrus.ui; import com.eure.citrus.R; import com.eure.citrus.Utils; import com.eure.citrus.listener.OnClickMainFABListener; import com.eure.citrus.listener.OnMakeSnackbar; import com.eure.citrus.listener.OnSwipeableRecyclerViewTouchListener; import com.eure.citrus.model.entity.Task; import com.eure.citrus.model.repository.TaskRepository; import com.eure.citrus.ui.adapter.HomeTaskListAdapter; import com.eure.citrus.ui.widget.DividerItemDecoration; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.support.design.widget.Snackbar; import android.support.v4.app.Fragment; import android.support.v7.widget.AppCompatTextView; import android.support.v7.widget.DefaultItemAnimator; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import butterknife.Bind; import butterknife.ButterKnife; import io.realm.Realm; import io.realm.RealmResults; import static butterknife.ButterKnife.findById; /** * Created by katsuyagoto on 15/06/18. */ public class HomeFragment extends Fragment implements OnClickMainFABListener { private static final int REQUEST_CREATE_TASK_ACTIVITY = 1000; public HomeFragment() { } public static HomeFragment newInstance() { return new HomeFragment(); } @Bind(R.id.home_task_count) AppCompatTextView mHomeTaskCountTextView; private HomeTaskListAdapter mHomeTaskListAdapter; // Realm instance for the UI thread private Realm mUIThreadRealm; private OnMakeSnackbar mOnMakeSnackbar; @Override public void onAttach(Context context) { super.onAttach(context); if (context instanceof OnMakeSnackbar) { mOnMakeSnackbar = (OnMakeSnackbar) context; } mUIThreadRealm = Realm.getDefaultInstance(); } @Override public void onDetach() { mOnMakeSnackbar = null; super.onDetach(); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_home, container, false); ButterKnife.bind(this, view); return view; } @Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); final RealmResults<Task> uncompletedTasks = TaskRepository .findAllByCompleted(mUIThreadRealm, false); mHomeTaskCountTextView.setText(String.valueOf(uncompletedTasks.size())); mHomeTaskListAdapter = new HomeTaskListAdapter(uncompletedTasks); RecyclerView recyclerView = findById(view, R.id.home_recycle_view); recyclerView.addItemDecoration( new DividerItemDecoration(Utils.getDrawableResource(getActivity(), R.drawable.line))); final LinearLayoutManager layoutManager = new LinearLayoutManager(getActivity()); layoutManager.setOrientation(LinearLayoutManager.VERTICAL); recyclerView.setLayoutManager(layoutManager); recyclerView.setHasFixedSize(true); recyclerView.setItemAnimator(new DefaultItemAnimator()); recyclerView.setAdapter(mHomeTaskListAdapter); OnSwipeableRecyclerViewTouchListener swipeTouchListener = new OnSwipeableRecyclerViewTouchListener(recyclerView, new OnSwipeableRecyclerViewTouchListener.SwipeListener() { @Override public boolean canSwipe(int position) { return true; } @Override public void onDismissedBySwipeLeft(RecyclerView recyclerView, int[] reverseSortedPositions) { onDismissedBySwipe(reverseSortedPositions, uncompletedTasks); } @Override public void onDismissedBySwipeRight(RecyclerView recyclerView, int[] reverseSortedPositions) { onDismissedBySwipe(reverseSortedPositions, uncompletedTasks); } }); recyclerView.addOnItemTouchListener(swipeTouchListener); AppCompatTextView homeDayOfWeekTextView = findById(view, R.id.home_dayOfWeek); homeDayOfWeekTextView.setText(Utils.getDayOfWeekString()); AppCompatTextView homeDateTextView = findById(view, R.id.home_date); homeDateTextView.setText(Utils.getDateString().toUpperCase()); } private void onDismissedBySwipe(int[] reverseSortedPositions, RealmResults<Task> uncompletedTasks) { for (final int position : reverseSortedPositions) { final Task task = uncompletedTasks.get(position); TaskRepository.updateByCompleted(mUIThreadRealm, task, true); mHomeTaskListAdapter.notifyItemRemoved(position); showSnackbarWhenDismiss(getString(R.string.complete_task, task.getName()), new View.OnClickListener() { @Override public void onClick(View view) { TaskRepository .updateByCompleted(mUIThreadRealm, task, false); mHomeTaskListAdapter.notifyItemInserted(position); updateHomeTaskListAdapter(); } }); } updateHomeTaskListAdapter(); } private void showSnackbarWhenDismiss(String text, View.OnClickListener listener) { if (mOnMakeSnackbar != null) { Snackbar snackbar = mOnMakeSnackbar.onMakeSnackbar(text, Snackbar.LENGTH_SHORT); snackbar.setAction(R.string.undo, listener); snackbar.show(); } } @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); switch (requestCode) { case REQUEST_CREATE_TASK_ACTIVITY: if (resultCode == Activity.RESULT_OK) { final RealmResults<Task> uncompletedTasks = TaskRepository .findAllByCompleted(mUIThreadRealm, false); mHomeTaskListAdapter.setData(uncompletedTasks); updateHomeTaskListAdapter(); } break; } } /** * Should call this method after HomeTaskListAdapter's data are changed. */ private void updateHomeTaskListAdapter() { mHomeTaskListAdapter.notifyDataSetChanged(); mHomeTaskCountTextView.setText(String.valueOf(mHomeTaskListAdapter.getItemCount())); } @Override public void onClickMainFAB() { Intent intent = new Intent(getActivity(), CreateNewTaskActivity.class); startActivityForResult(intent, REQUEST_CREATE_TASK_ACTIVITY); } @Override public void onDestroyView() { super.onDestroyView(); ButterKnife.unbind(this); } @Override public void onDestroy() { super.onDestroy(); mUIThreadRealm.close(); } }
eure/citrus
<|start_filename|>test/gerrit.test.js<|end_filename|> "use strict"; var helpers = require("./helpers"); var sandboxEach = helpers.sandboxEach; var _ = require("lodash"); var Q = require("bluebird"); var fs = require("fs-extra"); var git = require("../lib/git"); var gerrit = require("../lib/gerrit"); var prompter = require("../lib/prompter"); var gerrit_ssh = require("../lib/gerrit-ssh"); describe("gerrit", function() { var requirementTestDef = { "inRepo": function(fn) { it("should reject if not in a git repository", function() { git.inRepo.returns(false); return expect(fn()).to.be.rejectedWith(gerrit.GerritError); }); }, "cleanIndex": function(fn) { it("should reject if the index is not clean", function() { git.isIndexClean.returns(false); return expect(fn()).to.be.rejectedWith(gerrit.GerritError); }); } }; var testRequirements = function(requirements, fn) { requirements.forEach(function(req) { requirementTestDef[req](fn); }); }; sandboxEach(function(sandbox) { sandbox.stub(git, "inRepo").returns(true); sandbox.stub(git, "isIndexClean").returns(true); }); describe("GerritError", function() { it("should be an Error", function() { expect(gerrit.GerritError).to.inheritsfrom(Error); }); it("should set a message", function() { var err = new gerrit.GerritError("message"); expect(err.message).to.equal("message"); }); it("should format a message-array", function() { var err = new gerrit.GerritError(["message %s", "foo"]); expect(err.message).to.equal("message foo"); }); }); describe("parseRemote()", function() { testRequirements(["inRepo"], gerrit.parseRemote); it("should return the parsed remote url", sinon.test(function() { this.stub(git, "config"); var urls = { "<EMAIL>:foo/bar.git": { host: "example.com", port: null, user: "user", project: "foo/bar" }, "example.com:foo/bar.git": { host: "example.com", port: null, user: null, project: "foo/bar" }, "ssh://<EMAIL>@<EMAIL>:1234/foo/bar.git": { host: "example.com", port: "1234", user: "user", project: "foo/bar" }, "ssh://example.com/foo/bar.git": { host: "example.com", port: null, user: null, project: "foo/bar" } }; return Q.map(Object.keys(urls), function(url, index) { var remote = "remote_" + index; var expectedObj = _.defaults({}, urls[url], { name: remote }); git.config.withArgs("remote." + remote + ".url").returns(url); return expect(gerrit.parseRemote(remote), url).to.eventually.deep.equal(expectedObj); }); })); it("should use the remote 'origin' is none provided", sinon.test(function() { this.stub(git, "config").returns("ssh://user@example.com/foo/bar.git"); return gerrit.parseRemote() .then(function() { expect(git.config).to.have.been.calledWith("remote.origin.url"); }); })); it("should reject if the provided remote does not exits", sinon.test(function() { this.stub(git, "config").returns(null); var promise = gerrit.parseRemote("remote"); return expect(promise).to.have.been.rejectedWith(gerrit.GerritError); })); }); describe("allConfigs()", function() { it("should return the config for all remote config", sinon.test(function() { this.stub(git, "config").returns({ "gerrit.one.host": null, "gerrit.two.host": null, "gerrit.three.host": null }); this.stub(gerrit, "config", function(name) { return name + "_config"; }); return expect(gerrit.allConfigs()).to.eventually.deep.equal({ "one": "one_config", "two": "two_config", "three": "three_config" }); })); }); describe("configExists()", function() { it("should return true if the config exists", sinon.test(function() { this.stub(git, "config").returns({"foo": null}); return expect(gerrit.configExists("foo")).to.eventually.equal(true); })); it("should return false if the config does not exits", sinon.test(function() { this.stub(git, "config").returns({}); return expect(gerrit.configExists("foo")).to.eventually.equal(false); })); }); describe("config()", function() { it("should reject if the config does not exist and values are not given", sinon.test(function() { this.stub(git, "config").returns({}); return expect(gerrit.config("foo")).to.be.rejectedWith(gerrit.GerritError); })); it("should return the config for the given name", sinon.test(function() { this.stub(git, "config").returns({ "gerrit.foo.un": "one", "gerrit.foo.deux": "two", "gerrit.foo.trois": "three" }); return expect(gerrit.config("foo")).to.eventually.deep.equal({ "name": "foo", "un": "one", "deux": "two", "trois": "three" }); })); it("should set the config with values if provided", sinon.test(function() { this.stub(git, "config").returns({}); var values = { "un": "one", "deux": "two", "trois": "three" }; return gerrit.config("foo", values).then(function(config) { expect(config).to.deep.equal({ "name": "foo", "un": "one", "deux": "two", "trois": "three" }); expect(git.config).to.have .been.calledWith("gerrit.foo.un", "one", {global: true}) .and.calledWith("gerrit.foo.deux", "two", {global: true}) .and.calledWith("gerrit.foo.trois", "three", {global: true}); }); })); it("should override values if they previously exist", sinon.test(function() { this.stub(git, "config").returns({ "gerrit.foo.un": "one", "gerrit.foo.deux": "two", "gerrit.foo.trois": "three" }); var values = { "deux": "zwei", "quatre": "vier" }; return gerrit.config("foo", values).then(function(config) { expect(config).to.deep.equal({ "name": "foo", "un": "one", "deux": "zwei", "trois": "three", "quatre": "vier" }); expect(git.config).to.have .been.calledWith("gerrit.foo.deux", "zwei", {global: true}) .and.calledWith("gerrit.foo.quatre", "vier", {global: true}); }); })); }); describe("projects()", function() { it("should return a list of projects", sinon.test(function() { this.stub(gerrit, "config").resolves({foo: "bar"}); this.stub(gerrit_ssh, "run").resolves("foo\nbar\nxyzzy"); return expect(gerrit.projects("project")).to.eventually.deep.equal(["foo", "bar", "xyzzy"]); })); }); describe("clone()", function() { sandboxEach(function(sandbox) { sandbox.stub(gerrit, "config").resolves({ user: "user", host: "host", port: "1234" }); sandbox.stub(fs, "existsSync").returns(false); }); it("should throw if the destination exists", sinon.test(function() { fs.existsSync.returns(true); return expect(gerrit.clone()).to.be.rejectedWith(gerrit.GerritError); })); it("should clone the project into the destination folder", sinon.test(function() { this.stub(git, "show").resolves(null); this.stub(process, "chdir", _.noop); this.stub(git, "config", _.noop); this.stub(gerrit, "installHook").resolves(null); return gerrit.clone("gerrit", "project", "destination", true).then(function() { expect(git.show).to.have.been.calledWith("clone", "--progress", "ssh://user@host:1234/project.git", "destination"); expect(process.chdir).to.have.been.calledWith("destination"); expect(git.config).to.have.been.calledWith("remote.origin.gerrit", "gerrit"); expect(gerrit.installHook).to.have.been.calledWith("origin"); }); })); it("should use the project name as the destination folder if none provided", sinon.test(function() { this.stub(git, "show").resolves(null); this.stub(process, "chdir", _.noop); this.stub(git, "config", _.noop); this.stub(gerrit, "installHook").resolves(null); return gerrit.clone("gerrit", "project", null, true).then(function() { expect(git.show).to.have.been.calledWith("clone", "--progress", "ssh://user@host:1234/project.git", "project"); expect(process.chdir).to.have.been.calledWith("project"); expect(git.config).to.have.been.calledWith("remote.origin.gerrit", "gerrit"); expect(gerrit.installHook).to.have.been.calledWith("origin"); }); })); }); describe("addRemote()", function() { testRequirements(["inRepo"], gerrit.addRemote); it("should add the remote", sinon.test(function() { this.stub(gerrit, "config").resolves({ user: "user", host: "host", port: "1234" }); this.stub(git, "exec").returns(null); return gerrit.addRemote("remote", "config", "project", false) .then(function() { expect(git.exec).to.have.been.calledWith("remote", "add", "remote", "ssh://user@host:1234/project.git"); }); })); it("should install the hook if asked", sinon.test(function() { this.stub(gerrit, "config").resolves({ user: "user", host: "host", port: "1234" }); this.stub(git, "exec").returns(null); this.stub(gerrit, "installHook").resolves(null); return gerrit.addRemote("remote", "config", "project", true) .then(function() { expect(gerrit.installHook).to.have.been.calledWith("remote"); }); })); }); describe("installHook()", function() { testRequirements(["inRepo"], gerrit.installHook); it("should install the commit-msg hook", sinon.test(function() { this.stub(gerrit, "parseRemote").resolves({foo: "bar"}); this.stub(git, "dir").returns("the/git/dir"); this.stub(fs, "mkdirpSync", _.noop); this.stub(gerrit_ssh, "scp").resolves(null); return gerrit.installHook("remote") .then(function() { expect(gerrit.parseRemote).to.have.been.calledWith("remote"); expect(fs.mkdirpSync).to.have.been.calledWith("the/git/dir/hooks"); expect(gerrit_ssh.scp).to.have.been.calledWith("hooks/commit-msg", "the/git/dir/hooks", {foo: "bar"}); }); })); }); describe("ssh()", function() { testRequirements(["inRepo"], gerrit.ssh); it("should run the provided command", sinon.test(function() { this.stub(gerrit, "parseRemote").resolves({foo: "bar"}); this.stub(gerrit_ssh, "run").resolves(null); return gerrit.ssh("command", "remote") .then(function() { expect(gerrit_ssh.run).to.have.been.calledWith("command", {foo: "bar"}); }); })); }); describe("ssh_query()", function() { testRequirements(["inRepo"], gerrit.ssh); it("should run the provided query", sinon.test(function() { this.stub(gerrit, "parseRemote").resolves({foo: "bar"}); this.stub(gerrit_ssh, "query").resolves(null); return gerrit.ssh_query("query", "remote") .then(function() { expect(gerrit_ssh.query).to.have.been.calledWith("query", {foo: "bar"}); }); })); }); describe("patches()", function() { testRequirements(["inRepo"], gerrit.ssh); it("should query for patches", sinon.test(function() { this.stub(gerrit, "parseRemote").resolves({project: "project"}); this.stub(gerrit_ssh, "query").resolves(null); return gerrit.patches({query: "query"}, "remote") .then(function() { expect(gerrit_ssh.query).to.have.been.calledWith({ status: "open", project: "project", query: "query" }); }); })); }); describe("assign()", function() { testRequirements(["inRepo"], gerrit.ssh); it("should assign reviewers to the patch list", sinon.test(function() { var revList = ["revOne", "revTwo"]; var reviewers = ["reviewer-one", "@squad", "reviewer-two"]; var reviewersExpanded = ["reviewer-one", "squad-one", "squad-two", "reviewer-two"]; this.stub(gerrit.squad, "get").returns(["squad-one", "squad-two"]); this.stub(gerrit, "parseRemote").resolves({foo: "bar"}); var callIndex = 0; this.stub(gerrit_ssh, "run", function() { callIndex++; if (callIndex % 4 === 0) { return Q.reject("error"); } return Q.resolve(); }); return gerrit.assign(revList, reviewers, "remote") .then(function(result) { expect(gerrit.squad.get).to.have.been.calledWith("squad"); revList.forEach(function(hash) { reviewersExpanded.forEach(function(reviewer) { expect(gerrit_ssh.run).to.have.been.calledWith(["set-reviewers --add '%s' -- %s", reviewer, hash], {foo: "bar"}); }); }); expect(result).to.deep.equal([ [ {success: true, reviewer: "reviewer-one"}, {success: true, reviewer: "squad-one"}, {success: true, reviewer: "squad-two"}, {success: false, reviewer: "reviewer-two", error: "error"} ],[ {success: true, reviewer: "reviewer-one"}, {success: true, reviewer: "squad-one"}, {success: true, reviewer: "squad-two"}, {success: false, reviewer: "reviewer-two", error: "error"} ] ]); }); })); }); describe("up()", function() { testRequirements(["inRepo"], gerrit.up); sandboxEach(function(sandbox) { sandbox.stub(git.branch, "hasUpstream").returns(true); sandbox.stub(git.branch, "isRemote").returns(true); sandbox.stub(git.branch, "upstream").returns("upstream/branch"); sandbox.stub(git.branch, "parsedRemote").returns({branch: "p-branch", remote: "p-remote"}); sandbox.stub(git.branch, "name").returns("topic"); sandbox.stub(git, "config").returns(""); sandbox.stub(gerrit, "parseRemote").returns({name: "remote-name"}); sandbox.stub(git, "show").resolves(); }); it("should reject if the topic does not have an upstream", sinon.test(function() { git.branch.hasUpstream.returns(false); return expect(gerrit.up()).to.be.rejectedWith(gerrit.GerritError); })); it("should reject if the upstream branch is not remote", sinon.test(function() { git.branch.isRemote.returns(false); return expect(gerrit.up()).to.be.rejectedWith(gerrit.GerritError); })); it("should push the current patch", sinon.test(function() { return gerrit.up() .then(function() { expect(git.show).to.have.been.calledWith("push", "remote-name", "HEAD:refs/for/p-branch/topic"); }); })); it("should draft the current patch if specified", sinon.test(function() { return gerrit.up(null, null, true) .then(function() { expect(git.show).to.have.been.calledWith("push", "remote-name", "HEAD:refs/drafts/p-branch/topic"); }); })); }); describe("checkout()", function() { testRequirements(["inRepo", "cleanIndex"], gerrit.checkout); sandboxEach(function(sandbox) { sandbox.stub(gerrit, "parseRemote").returns({name: "remote-name"}); sandbox.stub(gerrit_ssh.query, "number").returns([]); sandbox.stub(gerrit_ssh.query, "topic").returns([{topic: "topic", number: "1234", branch: "branch"}]); sandbox.stub(git, "exec").returns(null); sandbox.stub(git, "checkout", _.noop); sandbox.stub(git.branch, "exists").returns(false); sandbox.stub(git.branch, "create", _.noop); sandbox.stub(git.branch, "setUpstream", _.noop); sandbox.stub(git.branch, "remove", _.noop); }); it("should checkout the topic", sinon.test(function() { return gerrit.checkout("topic", 1, false, "remote") .then(function() { expect(git.exec).to.have.been.calledWith("fetch", "remote-name", "refs/changes/34/1234/1"); expect(git.checkout).to.have.been.calledWith("FETCH_HEAD"); expect(git.branch.create).to.have.been.calledWith("topic", "FETCH_HEAD"); expect(git.checkout).to.have.been.calledWith("topic"); expect(git.branch.setUpstream).to.have.been.calledWith("topic", "remote-name/branch"); }); })); it("should checkout the patch number", sinon.test(function() { gerrit_ssh.query.number.returns([{topic: "topic", number: "4321", branch: "branch"}]); gerrit_ssh.query.topic.returns([]); return gerrit.checkout("4321", 1, false, "remote") .then(function() { expect(git.exec).to.have.been.calledWith("fetch", "remote-name", "refs/changes/21/4321/1"); expect(git.checkout).to.have.been.calledWith("FETCH_HEAD"); expect(git.branch.create).to.have.been.calledWith("topic", "FETCH_HEAD"); expect(git.checkout).to.have.been.calledWith("topic"); expect(git.branch.setUpstream).to.have.been.calledWith("topic", "remote-name/branch"); }); })); describe("with existing branch ", function() { it("should prompt and overwrite branch if answer is yes", sinon.test(function() { git.branch.exists .onFirstCall().returns(true) .onSecondCall().returns(false); this.stub(prompter, "confirm").resolves(true); return gerrit.checkout("topic", 1, false, "remote") .then(function() { expect(git.branch.remove).to.have.been.calledWith("topic"); expect(git.branch.create).to.have.been.calledWith("topic", "FETCH_HEAD"); expect(git.checkout).to.have.been.calledWith("topic"); }); })); it("should prompt and not overwrite branch if answer is no", sinon.test(function() { git.branch.exists .onFirstCall().returns(true) .onSecondCall().returns(true); this.stub(prompter, "confirm").resolves(false); return gerrit.checkout("topic", 1, false, "remote") .then(function() { expect(git.branch.remove).to.not.have.been.calledWith("topic"); expect(git.branch.create).to.not.have.been.calledWith("topic", "FETCH_HEAD"); expect(git.checkout).to.not.have.been.calledWith("topic"); }); })); it("should not prompt and should overwrite when forced", sinon.test(function() { git.branch.exists .onFirstCall().returns(true) .onSecondCall().returns(false); this.stub(prompter, "confirm", _.noop); return gerrit.checkout("topic", 1, true, "remote") .then(function() { expect(prompter.confirm).to.not.have.been.called; expect(git.branch.remove).to.have.been.calledWith("topic"); expect(git.branch.create).to.have.been.calledWith("topic", "FETCH_HEAD"); expect(git.checkout).to.have.been.calledWith("topic"); }); })); it("should never overwrite if topic name is master", sinon.test(function() { git.branch.exists .onFirstCall().returns(true) .onSecondCall().returns(true); gerrit_ssh.query.topic.returns([{topic: "master", number: "1234", branch: "branch"}]); this.stub(prompter, "confirm", _.noop); return gerrit.checkout("master", 1, false, "remote") .then(function() { expect(prompter.confirm).to.not.have.been.called; expect(git.branch.remove).to.not.have.been.called; expect(git.branch.create).to.not.have.been.called; }); })); }); it("should fetch the latest patch set if none provided", sinon.test(function() { git.exec.withArgs("ls-remote").returns("refs/changes/34/1234/1\nrefs/changes/34/1234/2\nrefs/changes/34/1234/3"); return gerrit.checkout("topic", null, false, "remote") .then(function() { expect(git.exec).to.have .been.calledWith("ls-remote", "remote-name", "refs/changes/34/1234/*") .and.calledWith("fetch", "remote-name", "refs/changes/34/1234/3"); }); })); it("should reject if the target is not found", sinon.test(function() { gerrit_ssh.query.number.returns([]); gerrit_ssh.query.topic.returns([]); return expect(gerrit.checkout("topic", 1, false, "remote")).to.be.rejectedWith(gerrit.GerritError); })); it("should prompt the user if the target is both a patch number and topic name", sinon.test(function() { gerrit_ssh.query.number.returns([{topic: "1234", number: "5678", branch: "branch"}]); gerrit_ssh.query.topic.returns([{topic: "topic", number: "1234", branch: "branch"}]); this.stub(prompter, "choose").resolves("topic"); return gerrit.checkout("1234", 1, false, "remote") .then(function() { expect(prompter.choose).to.have.been.called; }); })); }); describe("review()", function() { testRequirements(["inRepo"], gerrit.review); sandboxEach(function(sandbox) { sandbox.stub(gerrit, "parseRemote").returns({name: "remote-name", project: "project"}); }); it("should send the review", sinon.test(function() { this.stub(gerrit_ssh, "run", _.noop); return gerrit.review("1234", "-1", "+2", "message", "submit", "remote") .then(function() { expect(gerrit_ssh.run).to.have.been.calledWith(["review", "--project 'project'", "--submit", "--verified '-1'", "--code-review '+2'", "--message 'message'", "1234"].join(" "), {name: "remote-name", project: "project"}); }); })); }); describe("undraft()", function() { testRequirements(["inRepo"], gerrit.undraft); sandboxEach(function(sandbox) { sandbox.stub(gerrit, "parseRemote").returns({name: "remote-name", project: "project"}); }); it("should undraft the patch", sinon.test(function() { this.stub(gerrit_ssh, "run", _.noop); return gerrit.undraft("hash", "remote") .then(function() { expect(gerrit_ssh.run).to.have.been.calledWith("review --publish --project 'project' hash", {name: "remote-name", project: "project"}); }); })); }); describe("topic()", function() { sandboxEach(function(sandbox) { sandbox.stub(git, "checkout", _.noop); sandbox.stub(git.branch, "create", _.noop); sandbox.stub(git.branch, "setUpstream", _.noop); }); it("should create a topic branch and set its upstream", sinon.test(function() { gerrit.topic("topic", "upstream"); expect(git.branch.create).to.have.been.calledWith("topic", "HEAD"); expect(git.checkout).to.have.been.calledWith("topic"); expect(git.branch.setUpstream).to.have.been.calledWith("HEAD", "upstream"); })); it("should use the current upstream if none given", sinon.test(function() { this.stub(git.branch, "upstream").returns("upstream"); gerrit.topic("topic"); expect(git.branch.create).to.have.been.calledWith("topic", "HEAD"); expect(git.checkout).to.have.been.calledWith("topic"); expect(git.branch.setUpstream).to.have.been.calledWith("HEAD", "upstream"); })); }); describe("mergedTopics()", function() { it("should return fullly merged topics", sinon.test(function() { this.stub(git.branch, "list").returns([ "master", "upstream", "no-upstream", "diff-upstream", "empty", "not-submitted", "submitted" ]); this.stub(git.branch, "hasUpstream", function(branch) { return branch !== "no-upstream"; }); this.stub(git.branch, "upstream", function(branch) { return branch === "diff-upstream" ? "origin/QQ" : "origin/upstream"; }); this.stub(git, "revList", function(branch) { return branch === "empty" ? [] : [branch+"1", branch+"2"]; }); this.stub(git, "hashFor", function(val) { if (val !== "empty") { sinon.assert.fail("hasFor should only be called for empty"); } return val + "1"; }); this.stub(git, "getChangeId", function(commit) { return commit + "I"; }); this.stub(git, "exec", function(a, b, changeId) { return changeId === "not-submitted1I" ? "" : changeId + "R"; }); expect(gerrit.mergedTopics("origin/upstream")).to.deep.equal(["empty", "submitted"]); })); }); describe("squad", function() { describe("get()", function() { it("should return the squad", sinon.test(function() { this.stub(git, "config").withArgs("gerrit-squad.name.reviewer", {local: true, all: true}).returns(["foo", "bar"]); expect(gerrit.squad.get("name")).to.deep.equal(["foo", "bar"]); })); }); describe("getAll()", function() { it("should return all squads", sinon.test(function() { this.stub(git.config, "subsections").returns(["one", "two"]); this.stub(gerrit.squad, "get", function(squad) { return [squad + "-foo", squad + "-bar"]; }); expect(gerrit.squad.getAll()).to.deep.equal({ "one": ["one-foo", "one-bar"], "two": ["two-foo", "two-bar"] }); })); }); describe("set()", function() { it("should set the squad to the reviewers", sinon.test(function() { this.stub(git.config, "set", _.noop); gerrit.squad.set("squad", ["foo", "bar"]); expect(git.config.set).to.have.been.calledWith("gerrit-squad.squad.reviewer", ["foo", "bar"]); })); }); describe("add()", function() { it("should add reviewers to the squad", sinon.test(function() { this.stub(git.config, "add", _.noop); gerrit.squad.add("squad", ["foo", "bar"]); expect(git.config.add).to.have.been.calledWith("gerrit-squad.squad.reviewer", ["foo", "bar"], {unique: true}); })); }); describe("remove()", function() { it("should remove reviewers from the squad", sinon.test(function() { this.stub(git.config, "unsetMatching", _.noop); gerrit.squad.remove("squad", ["foo", "bar"]); expect(git.config.unsetMatching).to.have.been.calledWith("gerrit-squad.squad.reviewer", ["foo", "bar"]); })); }); describe("delete()", function() { it("should delete the squad", sinon.test(function() { this.stub(git.config, "removeSection", _.noop); gerrit.squad.delete("squad"); expect(git.config.removeSection).to.have.been.calledWith("gerrit-squad.squad"); })); }); describe("rename()", function() { it("should rename the squad", sinon.test(function() { this.stub(git.config, "renameSection", _.noop); gerrit.squad.rename("squad", "newsquad"); expect(git.config.renameSection).to.have.been.calledWith("gerrit-squad.squad", "gerrit-squad.newsquad"); })); }); describe("exists()", function() { it("should return whether the squad exists", sinon.test(function() { this.stub(git.config, "sectionExists", _.noop); gerrit.squad.exists("squad"); expect(git.config.sectionExists).to.have.been.calledWith("gerrit-squad.squad"); })); }); }); }); <|start_filename|>test/git.test.js<|end_filename|> "use strict"; var helpers = require("./helpers"); var sandboxEach = helpers.sandboxEach; var _ = require("lodash"); var fs = require("fs"); var spawn = require("cross-spawn"); var mock_spawn = require("mock-spawn"); var git = require("../lib/git"); describe("git", function() { describe("GitError", function() { it("should be an Error", function() { expect(git.GitError).to.inheritsfrom(Error); }); it("should accept code, command, output and error parameter", function() { var err = new git.GitError(12, "command", "output", "error"); expect(err.code).to.equal(12); expect(err.command).to.equal("command"); expect(err.output).to.equal("output"); expect(err.error).to.equal("error"); }); }); describe("exec()", function() { sandboxEach(function(sandbox) { sandbox.stub(spawn, "sync").returns({status: 0, stdout: "output\n", stderr: "error\n"}); }); it("should execute the command", sinon.test(function() { var output = git.exec("command"); expect(spawn.sync).to.have.been.calledWith("git", ["command"]); // without trailing newline expect(output).to.equal("output"); })); it("should format command as arguments", sinon.test(function() { git.exec("command", "one"); git.exec("command", ["two", "two"]); git.exec(["command", "three"]); git.exec(["command", ["four", "four"]]); expect(spawn.sync).to.have.been.calledWith("git", ["command", "one"]); expect(spawn.sync).to.have.been.calledWith("git", ["command", "two", "two"]); expect(spawn.sync).to.have.been.calledWith("git", ["command", "three"]); expect(spawn.sync).to.have.been.calledWith("git", ["command", "four", "four"]); })); it("should throw an error if the command fails", sinon.test(function() { spawn.sync.returns({ status: 1, stdout: "stdout\n", stderr: "stderr\n" }); expect(_.partial(git.exec, "command")).to.throw(git.GitError); })); }); describe("execSuccess()", function() { it("should return true if the command succeeds", sinon.test(function() { this.stub(git, "run").returns({status: 0}); expect(git.execSuccess("command")).to.be.true; })); it("should return false if the command fails", sinon.test(function() { this.stub(git, "run").returns({status: 1}); expect(git.execSuccess("command")).to.be.false; })); }); describe("show()", function() { var spawn; sandboxEach(function(sandbox) { spawn = mock_spawn(); sandbox.stub(spawn, "spawn", spawn); }); it("should show the runing command"); }); describe("inRepo()", function() { it("should return whether the current directory is a repositoru", sinon.test(function() { this.stub(git, "execSuccess").withArgs("rev-parse", "--git-dir").returns(true); expect(git.inRepo()).to.be.true; })); }); describe("dir()", function() { it("should return the git repository directory", sinon.test(function() { this.stub(git, "exec").withArgs("rev-parse", "--git-dir").returns("/path/to/dir"); expect(git.dir()).to.equal("/path/to/dir"); })); }); describe("isDetachedHead()", function() { sandboxEach(function(sandbox) { sandbox.stub(git, "dir").returns("/path/to/dir"); sandbox.stub(fs, "lstatSync").returns({ isSymbolicLink: _.constant(false) }); }); it("should return false if HEAD is a symbolic link", sinon.test(function() { fs.lstatSync.returns({ isSymbolicLink: _.constant(true) }); expect(git.isDetachedHead()).to.be.false; })); it("should return false if HEAD is a reference", sinon.test(function() { this.stub(fs, "readFileSync").returns("ref: refs/heads/master"); expect(git.isDetachedHead()).to.be.false; })); it("should return true if HEAD is not a reference", sinon.test(function() { this.stub(fs, "readFileSync").returns("abc123hash"); expect(git.isDetachedHead()).to.be.true; })); }); describe("isIndexClean()", function() { it("should return whether the index is clean", sinon.test(function() { this.stub(git, "execSuccess").withArgs("diff-index", "--no-ext-diff", "--quiet", "--exit-code", "HEAD").returns(true); expect(git.isIndexClean()).to.be.true; })); }); describe("hashFor", function() { it("should return the hash for the provided reference", sinon.test(function() { this.stub(git, "exec").withArgs("rev-list", "--max-count=1", "ref").returns("hash"); expect(git.hashFor("ref")).to.equal("hash"); })); }); describe("revList", function() { it("should return a list of revisions", sinon.test(function() { this.stub(git, "exec").withArgs("rev-list", "target", "^excludeTarget").returns("one\ntwo\nthree"); expect(git.revList("target", "excludeTarget")).to.deep.equal(["one", "two", "three"]); })); }); describe("describeHash", function() { it("should return a decription of the hash", sinon.test(function() { this.stub(git, "exec").withArgs("show", "--no-patch", "--format=%h %s", "hash").returns("description"); expect(git.describeHash("hash")).to.be.equal("description"); })); }); describe("commitInfo", function() { it("should return commit info", sinon.test(function() { this.stub(git, "exec").withArgs("show", "--no-patch", "--format=format", "hash").returns("info"); expect(git.commitInfo("hash", "format")).to.be.equal("info"); })); }); describe("getChangeId", function() { it("should return the commit's ChangeId", sinon.test(function() { this.stub(git, "exec").withArgs("show", "--no-patch", "--format=%b", "hash").returns("blah blah\nChange-Id: Iabc123\nblah blah"); expect(git.getChangeId("hash")).to.equal("Iabc123"); })); }); describe("config", function() { describe("config()", function() { sandboxEach(function(sandbox) { sandbox.stub(git.config, "get", _.noop); sandbox.stub(git.config, "set", _.noop); }); it("should get the values if ('key')", sinon.test(function() { git.config("key"); expect(git.config.get).to.have.been.calledWith("key"); })); it("should get the values if ('key', {options})", sinon.test(function() { git.config("key", {option: "option"}); expect(git.config.get).to.have.been.calledWith("key", {option: "option"}); })); it("should set the values if ('key', 'value')", sinon.test(function() { git.config("key", "value"); expect(git.config.set).to.have.been.calledWith("key", "value"); })); it("should set the values if ('key', 'value', {options})", sinon.test(function() { git.config("key", "value", {option: "option"}); expect(git.config.set).to.have.been.calledWith("key", "value", {option: "option"}); })); it("should set the values if ('key', [value])", sinon.test(function() { git.config("key", ["value"]); expect(git.config.set).to.have.been.calledWith("key", ["value"]); })); it("should set the values if ('key', [value], {options})", sinon.test(function() { git.config("key", ["value"], {option: "option"}); expect(git.config.set).to.have.been.calledWith("key", ["value"], {option: "option"}); })); }); describe("get()", function() { it("should get the config", sinon.test(function() { this.stub(git, "exec").withArgs("config", [], "key").returns("value"); expect(git.config.get("key")).to.equals("value"); })); it("should get the local config if local option is set", sinon.test(function() { this.stub(git, "exec").withArgs("config", ["--local"], "key").returns("value"); expect(git.config.get("key", {local: true})).to.equal("value"); })); it("should get the global config if options is set", sinon.test(function() { this.stub(git, "exec").withArgs("config", ["--global"], "key").returns("value"); expect(git.config.get("key", {global: true})).to.equal("value"); })); it("should get all config values if the all option is set", sinon.test(function() { this.stub(git, "exec").withArgs("config", ["--get-all"], "key").returns("one\ntwo\nthree"); expect(git.config.get("key", {all: true})).to.deep.equal(["one", "two", "three"]); })); it("should get matching config values if the regex flag is set", sinon.test(function() { this.stub(git, "exec").withArgs("config", ["--get-regexp"], "key").returns("k-one v-one\nk-two v-two\nk-two v-three"); expect(git.config.get("key", {regex: true})).to.deep.equal({ "k-one": ["v-one"], "k-two": ["v-two", "v-three"] }); })); it("should return null if there are no config values", sinon.test(function() { this.stub(git, "exec").withArgs("config", [], "key").throws("error"); expect(git.config.get("key")).to.be.null; })); it("should return an empty array if there are no config values and the all flag is set", sinon.test(function() { this.stub(git, "exec").withArgs("config", ["--get-all"], "key").throws("error"); expect(git.config.get("key", {all: true})).to.deep.equal([]); })); it("should return an empty array if there are no config values and the regex flag is set", sinon.test(function() { this.stub(git, "exec").withArgs("config", ["--get-regexp"], "key").throws("error"); expect(git.config.get("key", {regex: true})).to.deep.equal([]); })); }); describe("set()", function() { sandboxEach(function(sandbox) { sandbox.stub(git, "exec", _.noop); sandbox.stub(git.config, "unset", _.noop); }); it("should set the value", sinon.test(function() { git.config.set("key", "value"); expect(git.config.unset).to.have.been.calledWith("key"); expect(git.exec).to.have.been.calledWith("config", ["--add"], "key", "value"); })); it("should set multiple values", sinon.test(function() { git.config.set("key", ["one", "two"]); expect(git.config.unset).to.have.been.calledWith("key"); expect(git.exec).to.have .been.calledWith("config", ["--add"], "key", "one") .and.calledWith("config", ["--add"], "key", "two"); })); it("should set the local config if the local option is set", sinon.test(function() { git.config.set("key", "value", {local: true}); expect(git.config.unset).to.have.been.calledWith("key", sinon.match({local: true})); expect(git.exec).to.have.been.calledWith("config", ["--local", "--add"], "key", "value"); })); it("should set the global config if the global option is set", sinon.test(function() { git.config.set("key", "value", {global: true}); expect(git.config.unset).to.have.been.calledWith("key", sinon.match({global: true})); expect(git.exec).to.have.been.calledWith("config", ["--global", "--add"], "key", "value"); })); it("should add a config if the add option is set", sinon.test(function() { git.config.set("key", "value", {add: true}); expect(git.config.unset).to.have.not.been.called; expect(git.exec).to.have.been.calledWith("config", ["--add"], "key", "value"); })); it("should set unique values if the unique option is set", sinon.test(function() { this.stub(git.config, "get").withArgs("key", sinon.match({all: true})).returns(["b", "c"]); var values = git.config.set("key", ["a", "b", "c", "d"], {add: true, unique: true}); expect(git.config.unset).to.have.not.been.called; expect(git.exec).to.have .been.calledWith("config", ["--add"], "key", "a") .and.calledWith("config", ["--add"], "key", "d") .and.not.calledWith("config", ["--add"], "key", "b") .and.not.calledWith("config", ["--add"], "key", "c"); expect(values).to.deep.equal(["a", "d"]); })); }); describe("add()", function() { it("should add the value to the config", sinon.test(function() { this.stub(git.config, "set", _.noop); git.config.add("key", "value"); expect(git.config.set).to.have.been.calledWith("key", "value", {add: true}); })); }); describe("unset()", function() { it("should unset the config", sinon.test(function() { this.stub(git, "exec", _.noop); git.config.unset("key"); expect(git.exec).to.have.been.calledWith("config", "--unset-all", [], "key"); })); }); describe("unsetMatching()", function() { it("should unset matching values", sinon.test(function() { this.stub(git.config, "get").withArgs("key", sinon.match({all: true})).returns(["a", "b", "c", "d"]); this.stub(git, "exec", _.noop); var values = git.config.unsetMatching("key", ["b", "c", "q"]); expect(git.exec).to.have .been.calledWith("config", "--unset", [], "key", "^b$") .and.calledWith("config", "--unset", [], "key", "^c$") .and.not.calledWith("config", "--unset", [], "key", "^a$") .and.not.calledWith("config", "--unset", [], "key", "^d$") .and.not.calledWith("config", "--unset", [], "key", "^q$"); expect(values).to.deep.equal(["b", "c"]); })); }); describe("subsections()", function() { it("should return a list of config subsections fr the provided section", sinon.test(function() { this.stub(git, "config").withArgs("^section\\.", {regex: true}).returns({ "section.one.foo": ["a", "b"], "section.two.foo": ["c"], "section.three.foo": ["d"] }); expect(git.config.subsections("section")).to.deep.equal(["one", "two", "three"]); })); }); describe("removeSection()", function() { it("should remove the section", sinon.test(function() { this.stub(git, "exec", _.noop); git.config.removeSection("section"); expect(git.exec).to.have.been.calledWith("config", "--remove-section", [], "section"); })); }); describe("renameSection()", function() { it("should rename the section", sinon.test(function() { this.stub(git, "exec", _.noop); git.config.renameSection("section", "newsection"); expect(git.exec).to.have.been.calledWith("config", "--rename-section", [], "section", "newsection"); })); }); describe("sectionExists()", function() { it("should return whether the section exists", sinon.test(function() { this.stub(git.config, "get").withArgs("^section\\.").returns(["a"]); expect(git.config.sectionExists("section")).to.be.true; })); }); }); describe("branch", function() { describe("name", function() { it("should return the reference's branch name", sinon.test(function() { this.stub(git, "exec").withArgs("symbolic-ref", "--quiet", "--short", "ref").returns("branch"); expect(git.branch.name("ref")).to.equal("branch"); })); it("should return the HEAD's branch name if no reference is provided", sinon.test(function() { this.stub(git, "exec").withArgs("symbolic-ref", "--quiet", "--short", "HEAD").returns("branch"); expect(git.branch.name()).to.equal("branch"); })); }); describe("exists", function() { it("should return whether the branch exists", sinon.test(function() { this.stub(git, "execSuccess").withArgs("show-ref", "--verify", "--quiet", "refs/heads/branch").returns(true); expect(git.branch.exists("branch")).to.be.true; })); }); describe("remove", function() { it("should remove the named branch", sinon.test(function() { this.stub(git, "exec", _.noop); git.branch.remove("branch"); expect(git.exec).to.have.been.calledWith("branch", "-D", "branch"); })); }); describe("create", function() { it("should create the branch", sinon.test(function() { this.stub(git, "exec", _.noop); git.branch.create("branch", "start"); expect(git.exec).to.have.been.calledWith("branch", [], "branch", "start"); })); it("should create the branch starting at HEAD if no starting point provided", sinon.test(function() { this.stub(git, "exec", _.noop); git.branch.create("branch"); expect(git.exec).to.have.been.calledWith("branch", [], "branch", "HEAD"); })); it("should force create the branch if the paramter is set", sinon.test(function() { this.stub(git, "exec", _.noop); git.branch.create("branch", "start", true); expect(git.exec).to.have.been.calledWith("branch", ["--force"], "branch", "start"); })); }); describe("hasUpsteam", function() { it("should return whether the branch has an upstream", sinon.test(function() { this.stub(git, "execSuccess").withArgs("rev-parse", "--verify", "branch@{u}").returns(true); expect(git.branch.hasUpstream("branch")).to.be.true; })); }); describe("setUpstream", function() { it("should set the upstream", sinon.test(function() { this.stub(git, "exec", _.noop); git.branch.setUpstream("branch", "upstream"); expect(git.exec).to.have.been.calledWith("branch", "--set-upstream-to", "upstream", "branch"); })); }); describe("upstream", function() { it("should return the upstream", sinon.test(function() { this.stub(git, "exec").withArgs("rev-parse", "--symbolic-full-name", "--abbrev-ref", "branch@{u}").returns("upstream"); expect(git.branch.upstream("branch")).to.equal("upstream"); })); }); describe("isRemote", function() { it("should return whether the branch is remote", sinon.test(function() { this.stub(git, "execSuccess").withArgs("rev-parse", "--verify", "refs/remotes/branch").returns(true); expect(git.branch.isRemote("branch")).to.be.true; })); }); describe("parsedRemote", function() { it("should return the parsed remote branch", sinon.test(function() { expect(git.branch.parsedRemote("upstream/branch")).to.deep.equal({remote: "upstream", branch: "branch"}); })); }); describe("list", function() { it("shoud return the list of branches", sinon.test(function() { this.stub(git, "exec").withArgs("for-each-ref", "--format=%(refname:short)", "refs/heads/").returns("A\nB\nC"); expect(git.branch.list()).to.deep.equal(["A", "B", "C"]); })); }); }); }); <|start_filename|>test/cli.test.js<|end_filename|> "use strict"; var helpers = require("./helpers"); var sandboxEach = helpers.sandboxEach; var _ = require("lodash"); var Q = require("bluebird"); var moment = require("moment"); var proxyquire = require("proxyquire"); var git = require("../lib/git"); var gerrit = require("../lib/gerrit"); var prompter = require("../lib/prompter"); var gerrit_ssh = require("../lib/gerrit-ssh"); var openSpy = sinon.spy(); var cli = proxyquire("../lib/cli", { open: openSpy }); describe("cli", function() { var sandbox; var logSpy = helpers.setupLogSpy(); var requirementTestDef = { "inRepo": function(fn) { it("should throw if not in a git repository", sinon.test(function() { git.inRepo.returns(false); expect(fn).to.throw(cli.CliError, "This command requires the working directory to be in a repository."); })); }, "upstream": function(fn) { it("should throw if branch doesn't have an upstream", sinon.test(function() { git.branch.hasUpstream.returns(false); expect(fn).to.throw(cli.CliError, "Topic branch requires an upstream."); })); }, "remoteUpstream": function(fn) { it("should throw if branch doesn't have an upstream", sinon.test(function() { git.branch.hasUpstream.returns(false); expect(fn).to.throw(cli.CliError, "Topic branch requires an upstream."); })); it("should throw if branch's upstream is not remote", sinon.test(function() { git.branch.hasUpstream.returns(true); git.branch.isRemote.returns(false); expect(fn).to.throw(cli.CliError, "Topic's upstream is not a remote branch."); })); }, "cleanIndex": function(fn) { it("should throw if index is dirty", sinon.test(function() { git.isIndexClean.returns(false); expect(fn).to.throw(cli.CliError, "There are uncommitted changes."); })); }, "squadExists": function(fn) { it("should throw if the squad doesn't exist", sinon.test(function() { gerrit.squad.exists.returns(false); expect(_.partial(fn, "name")).to.throw(cli.CliError, "Squad \"name\" does not exist."); })); }, "configExists": function(fn) { it("should throw if the config doesn't exits", sinon.test(function() { gerrit.configExists.resolves(false); return expect(fn()).to.be.rejectedWith(cli.CliError); })); } }; var testRequirements = function(requirements, fn) { requirements.forEach(function(req) { requirementTestDef[req](fn); }); }; beforeEach(function() { sandbox = sinon.sandbox.create(); sandbox.stub(git, "inRepo").returns(true); sandbox.stub(git.branch, "hasUpstream").returns(true); sandbox.stub(git, "isIndexClean").returns(true); sandbox.stub(gerrit.squad, "exists").returns(true); sandbox.stub(git.branch, "upstream").returns("upstream"); sandbox.stub(git.branch, "isRemote").returns(true); sandbox.stub(gerrit, "configExists").resolves(true); openSpy.reset(); }); afterEach(function() { sandbox.restore(); }); describe("CliError", function() { it("should be an Error", function() { expect(cli.CliError).to.inheritsfrom(Error); }); it("should set a message", function() { var err = new cli.CliError("foobar"); expect(err.message).to.equal("foobar"); }); it("should format a message-array", function() { var err = new cli.CliError(["foo %s", "bar"]); expect(err.message).to.equal("foo bar"); }); }); describe("config()", function() { it("should display named config", sinon.test(function() { this.stub(gerrit, "config").resolves({ name: "foo", host: "host", user: "user", port: 1234 }); return cli.config("foo", {}) .then(function() { expect(gerrit.configExists).to.have.been.calledWith("foo"); expect(logSpy.info.output).to.equal([ "name = foo", "host = host", "user = user", "port = 1234", "" ].join("\n")); }); })); it("should display default config if none named", sinon.test(function() { this.stub(gerrit, "config").resolves({ name: "foo", host: "host", user: "user", port: 1234 }); return cli.config(null, {}) .then(function() { expect(gerrit.configExists).to.have.been.calledWith("default"); }); })); it("should display all configs", sinon.test(function() { this.stub(gerrit, "allConfigs").resolves({ foo: { name: "foo", host: "foo_host", user: "foo_user", port: 1234 }, bar: { name: "bar", host: "bar_host", user: "bar_user", port: 5678 } }); return cli.config(null, {all: true}) .then(function() { expect(logSpy.info.output).to.equal([ "name = foo", "host = foo_host", "user = foo_user", "port = 1234", "", "name = bar", "host = bar_host", "user = bar_user", "port = 5678", "" ].join("\n")); }); })); it("should prompt if creating a new config", sinon.test(function() { gerrit.configExists.resolves(false); this.stub(prompter, "prompt").resolves({ host: "host", user: "user", port: 1234 }); this.stub(gerrit, "config"); return cli.config("newconf", {}) .then(function() { expect(prompter.prompt).to.have.been.calledWithMatch(sinon.match(function(val) { if (!_.isUndefined(val[0].default)) { return false; } if (val[1].default !== "29418") { return false; } if (!_.isUndefined(val[2].default)) { return false; } return true; })); expect(gerrit.config).to.have.been.calledWith("newconf", { host: "host", user: "user", port: 1234 }); }); })); it("should prompt to edit an existing config", sinon.test(function() { this.stub(gerrit, "config").resolves({ name: "foo", host: "host", user: "user", port: 1234 }); this.stub(prompter, "prompt").resolves({ host: "new_host", user: "new_user", port: 5678 }); return cli.config("foo", {edit: true}) .then(function() { expect(prompter.prompt).to.have.been.calledWithMatch(sinon.match(function(val) { if (val[0].default !== "host") { return false; } if (val[1].default !== 1234) { return false; } if (val[2].default !== "user") { return false; } return true; })); expect(gerrit.config).to.have.been.calledWith("foo", { host: "new_host", user: "new_user", port: 5678 }); }); })); }); describe("projects()", function() { testRequirements(["configExists"], cli.projects.bind(cli, {})); it("should use 'default' as the config name if none specified", sinon.test(function() { this.stub(gerrit, "projects").resolves(["foo"]); return cli.projects({}) .then(function() { expect(gerrit.configExists).to.have.been.calledWith("default"); expect(gerrit.projects).to.have.been.calledWith("default"); }); })); it("should output a list of projects", sinon.test(function() { var configName = "config"; var projects = ["foo", "bar", "xyzzy"]; this.stub(gerrit, "projects").resolves(projects); return cli.projects({config: configName}) .then(function() { expect(gerrit.configExists).to.have.been.calledWith(configName); expect(gerrit.projects).to.have.been.calledWith(configName); expect(logSpy.info.output).to.equal(projects.join("\n")); }); })); }); describe("clone()", function() { testRequirements(["configExists"], cli.clone.bind(cli, null, null, {})); it("should use 'default' as the config name if none specified", sinon.test(function() { this.stub(gerrit, "clone").resolves(null); return cli.clone("project", "destination", {}) .then(function() { expect(gerrit.configExists).to.have.been.calledWith("default"); expect(gerrit.clone).to.have.been.calledWith("default", "project", "destination"); }); })); it("should clone", sinon.test(function() { this.stub(gerrit, "clone").resolves(null); return cli.clone("project", "destination", {config: "config"}) .then(function() { expect(gerrit.configExists).to.have.been.calledWith("config"); expect(gerrit.clone).to.have.been.calledWith("config", "project", "destination"); }); })); it("should prompt for information if none given", sinon.test(function() { var fs = require("fs"); var projects = ["foo", "bar" ,"xyzzy"]; var projectName = projects[0]; var destinationName = "destination"; var configName = "config"; this.stub(gerrit, "projects").resolves(projects); this.stub(gerrit, "clone").resolves(null); this.stub(fs, "existsSync").returns(false); this.stub(prompter, "autocomplete").resolves(projectName); this.stub(prompter, "input").resolves(destinationName); return cli.clone(null, null, {config: configName}) .then(function() { expect(gerrit.projects).to.have.been.calledWith(configName); expect(prompter.autocomplete).to.have.been.calledWith("Clone which project?", projects); expect(prompter.input).to.have.been.calledWith("Clone to which folder?", projectName); expect(fs.existsSync).to.have.been.calledWith(destinationName); expect(gerrit.clone).to.have.been.calledWith(configName, projectName, destinationName); }); })); }); describe("addRemote()", function() { testRequirements(["inRepo", "configExists"], cli.addRemote.bind(cli, null, null, {})); it("should add the remote", sinon.test(function() { this.stub(gerrit, "addRemote").returns(null); return cli.addRemote("remote", "project", {config: "config", installHook: false}) .then(function() { expect(gerrit.addRemote).to.have.been.calledWith("remote", "config", "project", false); }); })); it("should prompt if a project was not provided", sinon.test(function() { this.stub(gerrit, "addRemote").returns(null); this.stub(gerrit, "projects").resolves(["projectA", "projectB"]); this.stub(prompter, "autocomplete").resolves("projectB"); return cli.addRemote("remote", null, {config: "config", installHook: true}) .then(function() { expect(gerrit.addRemote).to.have.been.calledWith("remote", "config", "projectB", true); }); })); }); describe("installHook()", function() { testRequirements(["inRepo"], cli.installHook); it("should install the hook", sinon.test(function() { this.stub(gerrit, "installHook").resolves(null); return cli.installHook({remote: "remote"}) .then(function() { expect(gerrit.installHook).to.have.been.calledWith("remote"); }); })); }); describe("tokens", function() { var patchList = helpers.fixture.loadJson("patches"); var patchObj = patchList[0]; var expectedResult = { "c": [ "1.comments2.reviewer.username (" + cli._dynamicTimeFormat(moment.unix(patchObj.comments[1].timestamp)) + ")\n 1.comments2.msg1\n 1.comments2.msg2", "1.comments1.reviewer.username (" + cli._dynamicTimeFormat(moment.unix(patchObj.comments[0].timestamp)) + ")\n 1.comments1.msg" ].join("\n\n"), "O": "1.owner.name <1.owner.email>", "on": "1.owner.name", "oe": "1.owner.email", "ou": "1.owner.username", "dc": cli._dynamicTimeFormat(moment.unix(patchObj.createdOn)), "du": cli._dynamicTimeFormat(moment.unix(patchObj.lastUpdated)), "s": "1.subject", "e": 2, "r": [ " 1.ps1.approvals.name-1 -1 -1 ", " 1.ps1.approvals.name0 0 0 ", " 1.ps1.approvals.name+1 +1 +1 " ].join("\n"), "R": "-1 / -1", "f": [ " 1.ps1.files1.type 1.ps1.files1 +123 -456 ", " 1.ps1.files2.type 1.ps1.files2 +789 -0 " ].join("\n"), "m": "1.commitMessage" }; _.forEach(cli.patches.tokens, function(definition, key) { it("should contain valid format map definition for: " + definition[0], function() { expect(key).to.have.length.within(1,2); expect(definition[0]).to.be.a("string"); expect(definition[1]).to.be.a("boolean"); expect(typeof definition[2]).to.be.oneOf(["string", "function"]); if (typeof definition[2] === "function") { var defFunction = definition[2]; expect(expectedResult).to.have.property(key); expect(defFunction(patchObj, {})).to.be.equal(expectedResult[key]); // extra tests switch(key) { case "c": expect(defFunction({comments: ""})).to.be.equal("<none>"); break; case "s": var genString = function(len) { return _.fill(Array(len), "Q").join(""); }; expect(defFunction({subject: genString(90)}, {table: true})).to.be.equal(genString(80) + "..."); break; case "r": expect(defFunction({patchSets: [{}]})).to.be.equal("<none>"); break; case "R": expect(defFunction({patchSets: [{}]})).to.be.equal(" 0 / 0"); break; } } }); }); }); describe("patches()", function() { var patchList = helpers.fixture.loadJson("patches"); var testFormat = "%n foo %t %% %b"; testRequirements(["inRepo"], cli.patches); describe("--oneline", function() { it("should display patches in a one-line per patch format", sinon.test(function() { this.stub(gerrit, "patches").resolves(patchList); return cli.patches({oneline: true, format: testFormat, opts: _.constant({})}) .then(function() { expect(logSpy.info.output).to.equal([ "1.number foo 1.topic % 1.branch", "2.number foo 2.topic % 2.branch" ].join("\n")); }); })); }); describe("--table", function() { it("should display patches in a table format", sinon.test(function() { this.stub(gerrit, "patches").resolves(patchList); return cli.patches({table: true, format: testFormat, opts: _.constant({})}) .then(function() { expect(logSpy.info.output).to.equal([ " Number Topic Branch ", " 1.number 1.topic 1.branch ", " 2.number 2.topic 2.branch " ].join("\n")); }); })); }); describe("--vertical", function() { it("should display patches in a vertical table format", sinon.test(function() { this.stub(gerrit, "patches").resolves(patchList); return cli.patches({vertical: true, format: testFormat, opts: _.constant({})}) .then(function() { expect(logSpy.info.output).to.equal([ " Number: 1.number ", " Topic: 1.topic ", " Branch: 1.branch ", "", " Number: 2.number ", " Topic: 2.topic ", " Branch: 2.branch ", "" ].join("\n")); }); })); }); var testQueryList = [[ { author: "author"}, { owner: "author" } ], [ { assigned: true }, { reviewer: "self" } ], [ { mine: true }, { owner: "self" } ], [ { reviewed: true }, { is: ["reviewed"] } ], [ { watched: true }, { is: ["watched"] } ], [ { starred: true }, { is: ["starred"] } ], [ { drafts: true }, { is: ["drafts"] } ], [ { number: "number" }, { change: "number" } ], [ { owner: "owner" }, { owner: "owner" } ], [ { reviewer: "reviewer" }, { reviewer: "reviewer" } ], [ { branch: "branch" }, { branch: "branch" } ], [ { topic: "topic" }, { topic: "topic" } ], [ { message: "message" }, { message: "message" } ], [ { age: "age" }, { age: "age" } ], // not [ { notAuthor: "notAuthor"}, { not: { owner: "notAuthor" } } ], [ { notAssigned: true }, { not: { reviewer: "self" } } ], [ { notMine: true }, { not: { owner: "self" } } ], [ { notReviewed: true }, { not: { is: ["reviewed"] } } ], [ { notWatched: true }, { not: { is: ["watched"] } } ], [ { notStarred: true }, { not: { is: ["starred"] } } ], [ { notDrafts: true }, { not: { is: ["drafts"] } } ], [ { notNumber: "notNumber" }, { not: { change: "notNumber" } } ], [ { notOwner: "notOwner" }, { not: { owner: "notOwner" } } ], [ { notReviewer: "notReviewer" }, { not: { reviewer: "notReviewer" } } ], [ { notBranch: "notBranch" }, { not: { branch: "notBranch" } } ], [ { notTopic: "notTopic" }, { not: { topic: "notTopic" } } ], [ { notMessage: "notMessage" }, { not: { message: "notMessage" } } ], [ { notAge: "notAge" }, { not: { age: "notAge" } } ], // misc [ { reviewed: true, starred: true }, { is: ["reviewed", "starred"] } ], [ { owner: "owner", notBranch: "notBranch" }, { owner: "owner", not: { branch: "notBranch" } } ]]; it("should process query parameters", sinon.test(function() { var sinonStub = this.stub; return Q.each(testQueryList, function(testQuery) { sinonStub(gerrit, "patches").resolves(patchList); return cli.patches({opts: _.constant(testQuery[0])}) .then(function() { expect(gerrit.patches).to.have.been.calledWith(testQuery[1]); }) .finally(function() { gerrit.patches.restore(); }); }); })); }); describe("status()", function() { testRequirements(["inRepo"], cli.status); it("should display patch information for provided patch number", sinon.test(function() { this.stub(cli, "patches").resolves(null); return cli.status("1234", {option: _.noop}) .then(function() { expect(cli.patches).to.have.been.calledWithMatch({number: "1234"}); }); })); it("should display patch information for provided topic", sinon.test(function() { this.stub(cli, "patches").resolves(null); return cli.status("abcd", {option: _.noop}) .then(function() { expect(cli.patches).to.have.been.calledWithMatch({topic: "abcd"}); }); })); it("should default to current branch name if noething provided", sinon.test(function() { this.stub(cli, "patches").resolves(null); this.stub(git.branch, "name").returns("gitbranch"); return cli.status(null, {option: _.noop}) .then(function() { expect(cli.patches).to.have.been.calledWithMatch({topic: "gitbranch"}); }); })); }); describe("assign()", function() { testRequirements(["inRepo"], cli.assign); it("should assign reviewers and display results", sinon.test(function() { var revList = ["a"]; var reviewersArray = ["r1", "r2", "r3"]; this.stub(git, "config").returns([]); this.stub(git.config, "add"); this.stub(git, "isDetachedHead").returns(false); this.stub(git, "revList").returns(revList); this.stub(git, "describeHash").returns("hash.description"); this.stub(gerrit, "assign").resolves([ Q.resolve([ {success: true, reviewer: reviewersArray[0]}, {success: false, reviewer: reviewersArray[1], error: "some error"}, {success: true, reviewer: reviewersArray[2]} ]) ]); return cli.assign(reviewersArray, {remote: "remote"}) .then(function() { expect(gerrit.assign).to.have.been.calledWith(revList, reviewersArray, "remote"); expect(logSpy.info.output).to.equal("hash.description\nAssigned reviewer r1\nAssigned reviewer r3"); expect(logSpy.warn.output).to.equal("Could not assign reviewer r2\nsome error"); }); })); it("should reject if multiple patches found and intractive is not set", sinon.test(function() { var revList = ["a", "b"]; var reviewersArray = ["r1", "r2", "r3"]; this.stub(git, "config").returns([]); this.stub(git, "isDetachedHead").returns(false); this.stub(git, "revList").returns(revList); var promise = cli.assign(reviewersArray, {interactive: false}); return expect(promise).to.be.rejectedWith(cli.CliError); })); it("should prompt to select patches if multiple found and interactive is set", sinon.test(function() { var revList = ["a", "b", "c"]; var selectedRevList = ["a", "c"]; var reviewersArray = ["r1"]; this.stub(git, "config").returns([]); this.stub(git.config, "add"); this.stub(git, "isDetachedHead").returns(false); this.stub(git, "revList").returns(revList); this.stub(prompter, "select").resolves(selectedRevList); this.stub(git, "describeHash", _.identity); this.stub(gerrit, "assign").resolves([ Q.resolve([ {success: true, reviewer: reviewersArray[0]} ]), Q.resolve([ {success: true, reviewer: reviewersArray[0]} ]) ]); return cli.assign(reviewersArray, {interactive: true, remote: "remote"}) .then(function() { expect(gerrit.assign).to.have.been.calledWith(selectedRevList, reviewersArray, "remote"); expect(logSpy.info.output).to.equal([ "a", "Assigned reviewer r1", "", "c", "Assigned reviewer r1" ].join("\n")); }); })); it("should save reviewers if assignment successful", sinon.test(function() { var revList = ["a"]; var reviewersArray = ["r1", "r2", "r3"]; this.stub(git, "config").returns([]); this.stub(git.config, "add"); this.stub(git, "isDetachedHead").returns(false); this.stub(git, "revList").returns(revList); this.stub(git, "describeHash").returns("hash.description"); this.stub(gerrit, "assign").resolves([ Q.resolve([ {success: true, reviewer: reviewersArray[0]}, {success: false, reviewer: reviewersArray[1]}, {success: true, reviewer: reviewersArray[2]} ]) ]); return cli.assign(reviewersArray, {remote: "remote"}) .then(function() { expect(git.config.add).to.have.been .calledWith("gerrit.reviewers", "r1") .calledWith("gerrit.reviewers", "r3") .not.calledWith("gerrit.reviewers", "r2"); }); })); }); describe("ssh()", function() { testRequirements(["inRepo"], cli.ssh); it("should run the ssh command and log the output", sinon.test(function() { var command = "command"; var output = "somekind of output"; this.stub(gerrit, "ssh").resolves(output); return cli.ssh(command, {remote: "remote"}) .then(function() { expect(gerrit.ssh).to.have.been.calledWith(command, "remote"); expect(logSpy.info.output).to.equal(output); }); })); }); describe("up()", function() { testRequirements(["inRepo", "remoteUpstream"], cli.up); sandboxEach(function(sandbox) { sandbox.stub(gerrit, "up").resolves(null); sandbox.stub(git, "isDetachedHead").returns(false); sandbox.stub(git, "revList").returns(["a"]); sandbox.stub(git, "getChangeId").returns("Iabc123"); sandbox.stub(gerrit, "parseRemote").resolves({foo: "bar"}); sandbox.stub(gerrit_ssh, "query").resolves([]); sandbox.stub(git, "hashFor").returns("hash"); }); it("should push the patch", sinon.test(function() { return cli.up({remote: "remote", branch: "branch", draft: false, assign: []}) .then(function() { expect(gerrit.up).to.have.been.calledWith("remote", "branch", false); }); })); describe("if the last patch set is the same as the current commit", function() { it("should throw if the last patch set is not a draft", sinon.test(function() { var patch_result = [{ patchSets: [{ revision: "bogus" }, { revision: "hash", isDraft: false }] }]; gerrit_ssh.query.resolves(patch_result); expect(cli.up({remote: "remote", branch: "branch", draft: false, assign: []})) .to.be.rejectedWith(cli.CliError); })); it("should throw if trying to push a draft", sinon.test(function() { var patch_result = [{ patchSets: [{ revision: "bogus" }, { revision: "hash", isDraft: true }] }]; gerrit_ssh.query.resolves(patch_result); expect(cli.up({remote: "remote", branch: "branch", draft: true, assign: []})) .to.be.rejectedWith(cli.CliError); })); describe("otherwise should prompt to undraft", function() { it("should undraft if answer yes", sinon.test(function() { var patch_result = [{ patchSets: [{ revision: "bogus" }, { revision: "hash", isDraft: true }] }]; gerrit_ssh.query.resolves(patch_result); this.stub(prompter, "confirm").resolves(true); this.stub(gerrit, "undraft").resolves(null); return cli.up({remote: "remote", branch: "branch", draft: false, assign: []}) .then(function() { expect(gerrit.undraft).to.have.been.calledWith("hash", "remote"); expect(gerrit.up).to.not.have.been.called; }); })); it("should not do anything if answer no", sinon.test(function() { var patch_result = [{ patchSets: [{ revision: "bogus" }, { revision: "hash", isDraft: true }] }]; gerrit_ssh.query.resolves(patch_result); this.stub(prompter, "confirm").resolves(false); this.stub(gerrit, "undraft").resolves(null); return cli.up({remote: "remote", branch: "branch", draft: false, assign: []}) .then(function() { expect(gerrit.undraft).to.not.have.been.called; expect(gerrit.up).to.not.have.been.called; }); })); }); }); it("should prompt to push the commit as a draft if the last patch set was a draft", sinon.test(function() { var patch_result = [{ patchSets: [{ revision: "bogus" }, { revision: "notHash", isDraft: true }] }]; gerrit_ssh.query.resolves(patch_result); this.stub(prompter, "confirm").resolves(true); return cli.up({remote: "remote", branch: "branch", draft: false, assign: []}) .then(function() { expect(prompter.confirm).to.have.been.called; expect(gerrit.up).to.have.been.calledWith("remote", "branch", true); }); })); it("should assign reviewers and post comments", sinon.test(function() { this.stub(cli, "comment").resolves(null); this.stub(cli, "assign").resolves(null); return cli.up({remote: "remote", branch: "branch", draft: false, assign: ["joe", "shmoe"], comment: "comment"}) .then(function() { expect(cli.comment).to.have.been.calledWith("comment", sinon.match({all: true})); expect(cli.assign).to.have.been.calledWith(["joe", "shmoe"], sinon.match({all: true})); }); })); it("should prompt to assign or comment on all patches if multiple found", sinon.test(function() { this.stub(cli, "comment").resolves(null); this.stub(cli, "assign").resolves(null); git.revList.returns(["a", "b", "c"]); this.stub(prompter, "confirm").resolves(true); return cli.up({remote: "remote", branch: "branch", draft: false, assign: [], comment: "comment"}) .then(function() { expect(prompter.confirm).to.have.been.called; expect(cli.comment).to.have.been.calledWith("comment", sinon.match({all: true})); }); })); it("should prompt for interactive patch choice if multiple found and denied assigning or commenting all", sinon.test(function() { this.stub(cli, "comment").resolves(null); this.stub(cli, "assign").resolves(null); git.revList.returns(["a", "b", "c"]); this.stub(prompter, "confirm").resolves(false); return cli.up({remote: "remote", branch: "branch", draft: false, assign: [], comment: "comment"}) .then(function() { expect(prompter.confirm).to.have.been.called; expect(cli.comment).to.have.been.calledWith("comment", sinon.match({interactive: true})); }); })); }); describe("checkout", function() { testRequirements(["inRepo", "cleanIndex"], cli.checkout); it("should checkout the patch", sinon.test(function() { this.stub(gerrit, "checkout").resolves(null); return cli.checkout("target", "patch_set", {remote: "remote"}) .then(function() { expect(gerrit.checkout).to.have.been.calledWith("target", "patch_set", false, "remote"); }); })); }); describe("recheckout", function() { testRequirements(["inRepo", "cleanIndex"], cli.recheckout); it("should re-checkout the patch", sinon.test(function() { this.stub(gerrit, "checkout").resolves(null); this.stub(git, "getChangeId").returns("123abc"); return cli.recheckout({remote: "remote"}) .then(function() { expect(git.getChangeId).to.have.been.calledWith("HEAD"); expect(gerrit.checkout).to.have.been.calledWith("123abc", null, true, "remote"); }); })); }); var _review_args = { review: { cli: ["1", "2", "message"], gerrit: ["1", "2", "message", null], answer: { verified_score: "1", code_review_score: "2", message: "message" } }, submit: { cli: ["message"], gerrit: ["1", "2", "message", "submit"], answer: { message: "message" } }, abandon: { cli: ["message"], gerrit: [null, null, "message", "abandon"], answer: { message: "message" } }, comment: { cli: ["message"], gerrit: [null, null, "message", null], answer: { message: "message" } } }; ["review", "submit", "abandon", "comment"].forEach(function(command) { var review_args = _review_args[command]; describe(command + "()", function() { testRequirements(["inRepo"], cli[command]); describe("single patch", function() { it("should " + command + " the patch", sinon.test(function() { var revlist = ["A"]; this.stub(git, "isDetachedHead").returns(false); this.stub(git, "revList").returns(revlist); this.stub(gerrit, "review").resolves([]); this.spy(prompter, "confirm"); return cli[command].apply(null, review_args.cli.concat({remote: "remote"})) .then(function() { expect(prompter.confirm).to.not.have.been.called; var ee = expect(gerrit.review); ee.to.have.been.calledWith.apply(ee, ["A"].concat(review_args.gerrit, "remote")); }); })); it("should prompt for score and message if none provided"); }); describe("multiple patches", function() { it("should throw an error if the all or interactive options are not set", sinon.test(function() { var revlist = ["A", "B", "C"]; this.stub(git, "isDetachedHead").returns(false); this.stub(git, "revList").returns(revlist); var fn = function() { cli[command].apply(null, review_args.cli.concat({})); }; return expect(fn).to.throw(cli.CliError); })); it("should prompt whether to " + command + " if interactive option is set", sinon.test(function() { var revlist = ["A", "B", "C"]; this.stub(git, "isDetachedHead").returns(false); this.stub(git, "revList").returns(revlist); this.stub(git, "describeHash", _.identity); this.stub(prompter, "confirm") .onFirstCall().resolves(true) .onSecondCall().resolves(false) .onThirdCall().resolves(true); this.stub(prompter, "prompt", function() { return Q.resolve(_.clone(review_args.answer)); }); this.stub(gerrit, "review").resolves([]); return cli[command].apply(null, review_args.cli.concat({interactive: true, remote: "remote"})) .then(function() { // reverse order var exFirst = expect(gerrit.review.firstCall); var exSecond = expect(gerrit.review.secondCall); var exNot = expect(gerrit.review); exFirst.to.have.been.calledWith.apply(exFirst, ["C"].concat(review_args.gerrit, "remote")); exSecond.to.have.been.calledWith.apply(exSecond, ["A"].concat(review_args.gerrit, "remote")); exNot.to.not.have.been.calledWith.apply(exNot, ["B"].concat(review_args.gerrit, "remote")); }); })); it("should " + command + " if all option is set", sinon.test(function() { var revlist = ["A", "B", "C"]; this.stub(git, "isDetachedHead").returns(false); this.stub(git, "revList").returns(revlist); this.stub(gerrit, "review").resolves([]); return cli[command].apply(null, review_args.cli.concat({all: true, remote: "remote"})) .then(function() { // reverse order var exFirst = expect(gerrit.review.firstCall); var exSecond = expect(gerrit.review.secondCall); var exThird = expect(gerrit.review.thirdCall); exFirst.to.have.been.calledWith.apply(exFirst, ["C"].concat(review_args.gerrit, "remote")); exSecond.to.have.been.calledWith.apply(exSecond, ["B"].concat(review_args.gerrit, "remote")); exThird.to.have.been.calledWith.apply(exThird, ["A"].concat(review_args.gerrit, "remote")); }); })); }); }); }); describe("ninja()", function() { testRequirements(["inRepo", "remoteUpstream"], cli.ninja); it("should push and submit", sinon.test(function() { this.stub(git, "isDetachedHead").returns(false); this.stub(git, "revList").returns(["A"]); this.stub(gerrit, "parseRemote").resolves({foo: "bar"}); this.stub(git, "getChangeId").returns("abc123"); this.stub(gerrit_ssh, "query").resolves([]); this.stub(gerrit, "up").resolves(null); this.stub(cli, "submit").resolves(null); var options = {remote: "remote", branch: "branch"}; var expectedOptions = _.extend({}, options, {all: true}); return cli.ninja(options) .then(function() { expect(gerrit.up).to.have.been.calledWith("remote", "branch", false); expect(cli.submit).to.have.been.calledWith(null, expectedOptions); }); })); it("should confirm with user if multiple patches detected", sinon.test(function() { this.stub(git, "isDetachedHead").returns(false); this.stub(git, "revList").returns(["A", "B", "C"]); this.stub(gerrit, "parseRemote").resolves({foo: "bar"}); this.stub(git, "getChangeId").returns("abc123"); this.stub(gerrit_ssh, "query").resolves([]); this.stub(gerrit, "up").resolves(null); this.stub(cli, "submit").resolves(null); this.stub(prompter, "confirm").resolves(true); var options = {remote: "remote", branch: "branch"}; var expectedOptions = _.extend({}, options, {all: true}); return cli.ninja(options) .then(function() { expect(prompter.confirm).to.have.been.called; expect(gerrit.up).to.have.been.calledWith("remote", "branch", false); expect(cli.submit).to.have.been.calledWith(null, expectedOptions); }); })); }); describe("web()", function() { testRequirements(["inRepo"], cli.web); // how to stub out `open`? (proxyquire) it("should open the url for the current patch in a browser", sinon.test(function() { this.stub(git, "hashFor").returns("hash"); this.stub(gerrit, "ssh_query").resolves([{url: "url"}]); return cli.web({remote: "remote"}) .then(function() { expect(openSpy).to.have.been.calledWith("url"); }); })); }); describe("topic()", function() { testRequirements(["inRepo"], cli.topic); it("should create a topic branch", sinon.test(function() { this.stub(gerrit, "topic").returns("result"); this.stub(git.branch, "exists").returns(false); cli.topic("name", "upstream", {force: false}); expect(gerrit.topic).to.have.been.calledWith("name", "upstream", false); expect(logSpy.info.output).to.equal("result"); })); it("should use the current branch's upstream if none provided", sinon.test(function() { this.stub(gerrit, "topic").returns("result"); this.stub(git.branch, "exists").returns(false); cli.topic("name", null, {force: false}); expect(gerrit.topic).to.have.been.calledWith("name", "upstream", false); expect(logSpy.info.output).to.equal("result"); })); it("should throw if an upstream is not provided and the current branch does not have an upstream", sinon.test(function() { git.branch.hasUpstream.returns(false); this.stub(git.branch, "exists").returns(false); expect(_.partial(cli.topic, "name", null, {})).to.throw(cli.CliError); })); it("should throw if the upstream is not a remote branch", sinon.test(function() { git.branch.isRemote.returns(false); this.stub(git.branch, "exists").returns(false); expect(_.partial(cli.topic, "name", "upstream", {})).to.throw(cli.CliError); })); it("should throw if the branch already exists", sinon.test(function() { this.stub(git.branch, "exists").returns(true); expect(_.partial(cli.topic, "name", "upstream", {force: false})).to.throw(cli.CliError); })); it("should force create the branch if flag is specifiec", sinon.test(function() { this.stub(gerrit, "topic").returns("result"); this.stub(git.branch, "exists").returns(true); cli.topic("name", "upstream", {force: true}); expect(gerrit.topic).to.have.been.calledWith("name", "upstream", true); })); }); describe("clean()", function() { testRequirements(["inRepo"], cli.clean); sandboxEach(function(sandbox) { git.branch.upstream.returns("origin/upstream"); sandbox.stub(gerrit, "mergedTopics").returns(["AA", "BB"]); sandbox.stub(prompter, "confirm").resolves(true); sandbox.stub(git, "show"); }); it("should do nothing if there's nothing to clean", sinon.test(function() { gerrit.mergedTopics.returns([]); cli.clean({}); expect(git.show).to.not.have.been.called; })); it("should remove merged topics", sinon.test(function() { return cli.clean({}) .then(function() { expect(git.show).to.have.been.calledWith(["branch", "-D", "--", "AA", "BB"]); }); })); }); describe("squad", function() { describe("list()", function() { testRequirements(["squadExists"], cli.squad.list); it("should list the squad members for the squad", sinon.test(function() { this.stub(gerrit.squad, "get").returns(["A", "B", "C"]); cli.squad.list("name"); expect(logSpy.info.output).to.equal("A, B, C"); })); it("should list all squads and their memebers if no squad name provdided", sinon.test(function() { this.stub(gerrit.squad, "getAll").returns({ first: ["A", "B"], second: ["C", "D"] }); cli.squad.list(); expect(logSpy.info.output).to.equal("first: A, B\nsecond: C, D"); })); }); describe("set()", function() { it("should set the squad to the provided reviewers", sinon.test(function() { this.stub(gerrit.squad, "set"); cli.squad.set("name", ["A", "B"]); expect(gerrit.squad.set).to.have.been.calledWith("name", ["A", "B"]); expect(logSpy.info.output).to.equal("Reviewer(s) \"A, B\" set to squad \"name\"."); })); }); describe("add()", function() { it("should add the provided reviewers to the squad", sinon.test(function() { this.stub(gerrit.squad, "add"); cli.squad.add("name", ["A", "B"]); expect(gerrit.squad.add).to.have.been.calledWith("name", ["A", "B"]); expect(logSpy.info.output).to.equal("Reviewer(s) \"A, B\" added to squad \"name\"."); })); }); describe("remove()", function() { testRequirements(["squadExists"], cli.squad.remove); it("should remove the provided reviewers from the squad", sinon.test(function() { this.stub(gerrit.squad, "remove").returns(["A", "B"]); cli.squad.remove("name", ["A", "B"]); expect(logSpy.info.output).to.equal("Reviewer(s) \"A, B\" removed from squad \"name\"."); })); it("should warn if the prodied reviewer is not part of the squad", sinon.test(function() { this.stub(gerrit.squad, "remove").returns(["A", "B"]); cli.squad.remove("name", ["A", "B", "C", "D"]); expect(logSpy.warn.output).to.equal("Reviewer(s) \"C, D\" do not exist in squad \"name\"."); expect(logSpy.info.output).to.equal("Reviewer(s) \"A, B\" removed from squad \"name\"."); })); }); describe("delete()", function() { testRequirements(["squadExists"], cli.squad.delete); it("should delete the named squad", sinon.test(function() { this.stub(gerrit.squad, "delete"); cli.squad.delete("name"); expect(logSpy.info.output).to.equal("Squad \"name\" deleted."); })); }); describe("rename()", function() { testRequirements(["squadExists"], cli.squad.rename); it("should rename the squad", sinon.test(function() { this.stub(gerrit.squad, "rename"); cli.squad.rename("name", "newname"); expect(logSpy.info.output).to.equal("Squad \"name\" renamed to \"newname\"."); })); }); }); }); <|start_filename|>lib/logger.js<|end_filename|> "use strict"; var util = require("util"); var EventEmitter = require("events"); var _ = require("lodash"); var LEVELS = ["info", "error", "warn", "verbose", "debug"]; var Logger = function() { EventEmitter.call(this); }; util.inherits(Logger, EventEmitter); Logger.prototype.LEVELS = LEVELS; Logger.prototype.log = function(level, message, context) { if (util.isArray(message)) { message = util.format.apply(null, message); } this.emit(level, message, context); }; Logger.prototype.newline = function(count) { var newlines = new Array(count || 1).join("\n"); this.log("info", newlines); }; LEVELS.forEach(function(level) { Logger.prototype[level] = function(message, context) { var args = _.toArray(arguments); args.unshift(level); this.log.apply(this, args); }; }); module.exports = new Logger(); <|start_filename|>lib/gerrit-ssh.js<|end_filename|> "use strict"; var _ = require("lodash"); var Q = require("bluebird"); var util = require("util"); var spawn = require("cross-spawn"); var logger = require("./logger"); var gerrit_ssh = {}; gerrit_ssh.run = function(command, config) { if (Array.isArray(command)) { command = util.format.apply(null, command); } var host = util.format("%s@%s", config.user, config.host); var sshArgs = [host]; if (config.port) { sshArgs.push("-p", config.port); } logger.debug("gerrit_ssh.run: " + command); sshArgs.push( "--", "gerrit " + command ); return promisifiedSpawn("ssh", sshArgs); }; gerrit_ssh.query = function(query, config) { var queryString = ""; if (_.isArray(query)) { queryString = util.format.apply(null, query); } else if (_.isPlainObject(query)) { var queryObj = _.cloneDeep(query); var queryNotObj = queryObj.not || {}; delete queryObj.not; queryString = [] .concat( _.reduce(queryObj, reduceFunction(false), []) ) .concat( _.reduce(queryNotObj, reduceFunction(true), []) ) .join(" "); } else { queryString = "" + query; } queryString = util.format("query '%s' --format json --patch-sets --files --all-approvals --comments --commit-message --submit-records", queryString); return gerrit_ssh.run(queryString, config).then(function(result) { return result.split("\n").slice(0, -1).map(JSON.parse); }); function reduceFunction(not) { return function (result, val, key) { if (!_.isArray(val)) { val = [val]; } val.forEach(function(v) { var str = ""; if (not) { str += "-"; } str += key + ":" + v; result.push(str); }); return result; }; } }; gerrit_ssh.query.number = function(number, config) { return gerrit_ssh.query(["change:%s project:%s limit:1", number, config.project], config); }; gerrit_ssh.query.topic = function(topic, config) { return gerrit_ssh.query(["project:%s topic:%s limit:1", config.project, topic], config); }; gerrit_ssh.scp = function(src, dest, config) { var hostsource = util.format("%s@%s:'%s'", config.user, config.host, src); var scpArgs = ["-p"]; if (config.port) { scpArgs.push("-P", config.port); } scpArgs.push(hostsource, dest); return promisifiedSpawn("scp", scpArgs); }; // TODO replace with https://www.npmjs.com/package/spawn-please function promisifiedSpawn(command, args) { var bufStdOut = []; var bufStdErr = []; return new Q(function(resolve, reject) { var child = spawn.spawn(command, args); // child.stdout.pipe(process.stdout); // child.stderr.pipe(process.stderr); child.stdout.on("data", [].push.bind(bufStdOut)); child.stderr.on("data", [].push.bind(bufStdErr)); child.on("error", reject); child.on("close", resolve); }) .then(function(code) { if (code !== 0) { var errOutput = Buffer.concat(bufStdErr).toString().trimRight(); return Q.reject(errOutput); } return Buffer.concat(bufStdOut).toString().trimRight(); }); } module.exports = gerrit_ssh; <|start_filename|>lib/prompter.js<|end_filename|> "use strict"; var Q = require("bluebird"); var util = require("util"); var inquirer = require("inquirer"); var inquirerAutocomplete = require("inquirer-autocomplete-prompt"); // injects into String.prototype..... require("string_score"); inquirer.registerPrompt("autocomplete", inquirerAutocomplete); var prompter = {}; prompter.confirm = function(text, defaultValue) { if (Array.isArray(text)) { text = util.format.apply(null, text); } return prompter.prompt({ type: "confirm", message: text, name: "answer", default: defaultValue }).then(function(answer) { return answer.answer; }); }; prompter.choose = function(text, list) { if (Array.isArray(text)) { text = util.format.apply(null, text); } return prompter.prompt({ type: "list", message: text, choices: list, name: "answer" }).then(function(answer) { return answer.answer; }); }; prompter.autocomplete = function(text, list) { if (Array.isArray(text)) { text = util.format.apply(null, text); } return prompter.prompt({ type: "autocomplete", message: text, name: "answer", source: function(answer, input) { if (input === null || input === "") { return Q.resolve(list); } return Q.resolve(list.filter(function(item) { return item.score(input) > 0; })); } }).then(function(answer) { return answer.answer; }); }; prompter.select = function(text, list) { if (Array.isArray(text)) { text = util.format.apply(null, text); } return prompter.prompt({ type: "checkbox", message: text, choices: list, name: "answer" }).then(function(answer) { return answer.answer; }); }; prompter.input = function(text, defaultValue) { return prompter.prompt({ type: "input", message: text, name: "answer", default: defaultValue }).then(function(answer) { return answer.answer; }); }; prompter.prompt = function(questions) { return Q.resolve(inquirer.prompt(questions)); }; prompter.untilValid = function(ask, validate) { return new Q(function loop(resolve, reject) { ask().then(function(answer) { if (!validate(answer)) { return loop(resolve, reject); } resolve(answer); }); }); }; module.exports = prompter; <|start_filename|>test/helpers.js<|end_filename|> "use strict"; var spawn = require("cross-spawn"); var Q = require("bluebird"); var fs = require("fs"); var path = require("path"); var chai = require("chai"); var sinon = require("sinon"); var sinonChai = require("sinon-chai"); var chaiAsPromised = require("chai-as-promised"); var sinonAsPromised = require("sinon-as-promised"); var chalk = require("chalk"); var logger = require("../lib/logger"); chalk.enabled = false; sinonAsPromised(Q); chai.use(sinonChai); chai.use(chaiAsPromised); global.sinon = sinon; global.expect = chai.expect; spawn.spawn = function(command, args) { throw new Error("OH NOES SPAWN.SPAWN: " + command + " " + JSON.stringify(args)); }; spawn.sync = function(command, args) { throw new Error("OH NOES SPAWN.SYNC: " + command + " " + JSON.stringify(args)); }; chai.use(function(_chai, utils) { utils.addMethod(_chai.Assertion.prototype, "inheritsfrom", function(construct) { var obj = this._obj; this.assert( obj.prototype instanceof construct, "Nope, doesn't inherit.", "Yup, does inherit" ); }); }); var origSinonTest = sinon.test; sinon.test = function(callback) { return origSinonTest(function(done) { var result = callback.call(this); if (result && typeof result === "object" && typeof result.then === "function") { result.then(function() { done(); }, done); } else { done(); } }); }; var helpers = {}; helpers.fixture = (function() { var fixtureCache = {}; var fixtureBasePath = "test/fixtures"; return { load: function(name) { var fixturePath = path.join(fixtureBasePath, name); if (fixtureCache[fixturePath]) { return fixtureCache[fixturePath]; } var contents = fs.readFileSync(fixturePath, {encoding: "utf8"}); fixtureCache[fixturePath] = contents; return contents; }, loadJson: function(name) { return JSON.parse(helpers.fixture.load(name + ".json")); } }; }()); helpers.setupLogSpy = function() { var logSpy = {}; beforeEach(function() { logger.LEVELS.forEach(function(level) { var spy = sinon.spy(function(line) { if (logSpy[level].output !== "") { logSpy[level].output += "\n"; } logSpy[level].output += helpers.stripColors(line); }); logger.on(level, spy); logSpy[level] = { spy: spy, output: "" }; }); }); afterEach(function() { logger.LEVELS.forEach(function(level) { logger.removeListener(level, logSpy[level].spy); delete logSpy[level]; }); }); return logSpy; }; helpers.sandboxEach = function(fn) { var sandbox; beforeEach(function() { sandbox = sinon.sandbox.create(); fn(sandbox); }); afterEach(function() { sandbox.restore(); }); }; // https://github.com/Marak/colors.js/blob/master/lib/colors.js helpers.stripColors = function(str) { return ("" + str).replace(/\x1B\[\d+m/g, ""); }; module.exports = helpers; <|start_filename|>test/gerrit-ssh.test.js<|end_filename|> "use strict"; var helpers = require("./helpers"); var sandboxEach = helpers.sandboxEach; var util = require("util"); var cross_spawn = require("cross-spawn"); var mock_spawn = require("mock-spawn"); var gerrit_ssh = require("../lib/gerrit-ssh"); describe("gerrit_ssh", function() { var spawn; var config = { user: "user", host: "host", port: "1234", project: "project" }; sandboxEach(function(sandbox) { spawn = mock_spawn(); spawn.setDefault(spawn.simple(0, "out\n")); sandbox.stub(cross_spawn, "spawn", spawn); }); describe("run()", function() { it("should run", sinon.test(function() { return gerrit_ssh.run("cmd", config) .then(function(stdout) { var firstCall = spawn.calls[0]; expect(firstCall.command).to.equal("ssh"); expect(firstCall.args).to.deep.equal(["user@host", "-p", "1234", "--", "gerrit cmd"]); expect(stdout).to.equal("out"); }); })); }); describe("scp()", function() { it("should scp", sinon.test(function() { return gerrit_ssh.scp("source", "destination", config) .then(function() { var firstCall = spawn.calls[0]; expect(firstCall.command).to.equal("scp"); expect(firstCall.args).to.deep.equal(["-p", "-P", "1234", "user@host:'source'", "destination"]); }); })); }); describe("query", function() { var queryCommand = function(query) { return util.format("query '%s' --format json --patch-sets --files --all-approvals --comments --commit-message --submit-records", query); }; describe("query()", function() { var data = [ {foo: "bar"}, {tro: "lol"} ]; var dataString = data.map(JSON.stringify).join("\n") + "\n"; sandboxEach(function(sandbox) { sandbox.stub(gerrit_ssh, "run").resolves(dataString); }); it("should run a string query", sinon.test(function() { return gerrit_ssh.query("foobar", config) .then(function(result) { expect(gerrit_ssh.run).to.have.been.calledWith(queryCommand("foobar")); expect(result).to.deep.equal(data); }); })); it("should run an array query", sinon.test(function() { return gerrit_ssh.query(["foo %s", "bar"], config) .then(function(result) { expect(gerrit_ssh.run).to.have.been.calledWith(queryCommand("foo bar")); expect(result).to.deep.equal(data); }); })); it("should run an object query", sinon.test(function() { var query = { one: "two", three: ["four", "five"], not: { six: "seven", eight: ["nine", "ten"] } }; return gerrit_ssh.query(query, config) .then(function(result) { expect(gerrit_ssh.run).to.have.been.calledWith(queryCommand("one:two three:four three:five -six:seven -eight:nine -eight:ten")); expect(result).to.deep.equal(data); }); })); }); describe("number()", function() { it("should query for the number", sinon.test(function() { this.stub(gerrit_ssh, "query").resolves(); return gerrit_ssh.query.number(1234, config) .then(function() { expect(gerrit_ssh.query).to.have.been.calledWith(["change:%s project:%s limit:1", 1234, "project"], config); }); })); }); describe("topic()", function() { it("should query for the topic", sinon.test(function() { this.stub(gerrit_ssh, "query").resolves(); return gerrit_ssh.query.topic("foobar", config) .then(function() { expect(gerrit_ssh.query).to.have.been.calledWith(["project:%s topic:%s limit:1", "project", "foobar"], config); }); })); }); }); }); <|start_filename|>lib/helpers.js<|end_filename|> "use strict"; var _ = require("lodash"); var util = require("util"); var helpers = {}; helpers.makeError = function(name, constructor) { var err = function(msg, code) { Error.call(this); Error.captureStackTrace(this, err); if (constructor) { constructor.apply(this, _.toArray(arguments)); } else { this.setCode(code); this.setMessage(msg); } }; // inherits must be before setting prototype propoerties for node < 5 // https://stackoverflow.com/a/35320874/1333402 util.inherits(err, Error); err.prototype.name = name; err.prototype.setCode = function(code) { this.code = code; }; err.prototype.setMessage = function(msg) { this.message = util.format.apply(null, _.castArray(msg)); }; return err; }; helpers.indent = function(num, string) { var spaces = new Array(num + 1).join(" "); return spaces + string.replace(/\n/g, "\n" + spaces); }; module.exports = helpers;
codyi96/gerrit-cli
<|start_filename|>vue.config.js<|end_filename|> const CopyPlugin = require('copy-webpack-plugin') const { CycloneDxWebpackPlugin } = require('@cyclonedx/webpack-plugin'); module.exports = { lintOnSave: false, runtimeCompiler: true, // Relative paths cannot be supported. Research by @nscur0 - https://owasp.slack.com/archives/CTC03GX9S/p1608400149085400 publicPath: "/", devServer: { proxy: { "/api": { target: "http://localhost:8080" } } }, configureWebpack: { plugins: [ new CopyPlugin([ { from: "node_modules/axios/dist/axios.min.js", to: "static/js", force: true }, { from: "node_modules/oidc-client/dist/oidc-client.min.js", to: "static/js", force: true } ]), new CycloneDxWebpackPlugin({ context: '../', outputLocation: '../' }) ] } }; <|start_filename|>src/shared/toggle-classes.js<|end_filename|> export default function toggleClasses (toggleClass, classList, force) { const level = classList.indexOf(toggleClass); const removeClassList = classList.slice(0, level); removeClassList.map((className) => document.body.classList.remove(className)); document.body.classList.toggle(toggleClass, force); } <|start_filename|>src/plugins/table.js<|end_filename|> import 'bootstrap-table/dist/bootstrap-table.min.css' import './jquery.js' import Vue from 'vue' import 'bootstrap' import 'bootstrap-table/dist/bootstrap-table.js' import BootstrapTable from 'bootstrap-table/dist/bootstrap-table-vue.esm.js' Vue.component('BootstrapTable', BootstrapTable); <|start_filename|>src/mixins/permissionsMixin.js<|end_filename|> import * as permissions from "../shared/permissions"; export default { data() { return { PERMISSIONS: { BOM_UPLOAD: permissions.BOM_UPLOAD, VIEW_PORTFOLIO: permissions.VIEW_PORTFOLIO, PORTFOLIO_MANAGEMENT: permissions.PORTFOLIO_MANAGEMENT, ACCESS_MANAGEMENT: permissions.ACCESS_MANAGEMENT, VULNERABILITY_ANALYSIS: permissions.VULNERABILITY_ANALYSIS, POLICY_VIOLATION_ANALYSIS: permissions.POLICY_VIOLATION_ANALYSIS, SYSTEM_CONFIGURATION: permissions.SYSTEM_CONFIGURATION, POLICY_MANAGEMENT: permissions.POLICY_MANAGEMENT } } }, computed: { decodedToken () { return permissions.decodeToken(permissions.getToken()); } }, methods: { isPermitted (permission) { return permissions.hasPermission(permission, this.decodedToken); }, isNotPermitted (permission) { return !permissions.hasPermission(permission, this.decodedToken); }, } }; <|start_filename|>src/directives/VuePermission.js<|end_filename|> /* * Permissions Vue Directive */ import Vue from 'vue' import {hasPermission, decodeToken, getToken} from '../shared/permissions' Vue.directive('permission', function(el, binding) { let decodedToken = decodeToken(getToken()); if (Array.isArray(binding.value)) { let permitted = false; if (binding.arg === "and") { // This is the AND case. If a user has ALL of the specified permissions, permitted will be true permitted = true; binding.value.forEach(function (b) { if(! hasPermission(b, decodedToken)) { permitted = false; } }); } else if (binding.arg === "or") { // This is the OR case. If a user has one or more of the specified permissions, permitted will be true binding.value.forEach(function (b) { if(hasPermission(b, decodedToken)) { permitted = true; } }); } if (!permitted) { el.style.display = "none"; } } else { if (! hasPermission(binding.value, decodedToken)) { el.style.display = "none"; } } }); <|start_filename|>docker/Dockerfile<|end_filename|> FROM nginxinc/nginx-unprivileged:stable-alpine # jq is required for entrypoint script USER root RUN apk --no-cache add jq COPY ./docker/etc/nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf COPY --chown=101:101 ./dist /app # Applying these changes allows the container to run via the OpenShift default SCC "Restricted" whereby arbitrary an UID and GID=0 are assigned RUN chgrp -R 0 /etc/nginx && \ chmod -R g=u /etc/nginx && \ chgrp -R 0 /app && \ chmod -R g=u /app # Specify the user to run as (in numeric format for compatibility with Kubernetes/OpenShift's SCC) # Inherited from parent image # See https://github.com/nginxinc/docker-nginx-unprivileged/blob/main/stable/alpine/Dockerfile#L139 USER 101 # Set default settings that may get overridden to empty values by # the entrypoint script, if not explicitly provided by the user ENV OIDC_SCOPE "openid profile email" # Setup entrypoint WORKDIR /app COPY ./docker/docker-entrypoint.sh /docker-entrypoint.d/30-oidc-configuration.sh <|start_filename|>src/views/administration/mixins/configPropertyMixin.js<|end_filename|> import Vue from 'vue' import axios from "axios"; import common from "../../../shared/common"; export default { data () { return { configUrl: `${this.$api.BASE_URL}/${this.$api.URL_CONFIG_PROPERTY}/`, labelIcon: { dataOn: '\u2713', dataOff: '\u2715' }, } }, methods: { updateConfigProperties: function(configProperties) { let props = []; for (let i=0; i<configProperties.length; i++) { let prop = configProperties[i]; prop.propertyValue = common.trimToNull(prop.propertyValue); props.push(prop); } let url = `${this.$api.BASE_URL}/${this.$api.URL_CONFIG_PROPERTY}/aggregate`; this.axios.post(url, props).then((response) => { this.$toastr.s(this.$t('admin.configuration_saved')); }).catch((error) => { this.$toastr.w(this.$t('condition.unsuccessful_action')); }); }, /* updateConfigProperties: function(configProperties) { let promises = []; for (let i=0; i<configProperties.length; i++) { let prop = configProperties[i]; let url = `${this.$api.BASE_URL}/${this.$api.URL_CONFIG_PROPERTY}/`; promises.push( this.axios.post(url, { groupName: prop.groupName, propertyName: prop.propertyName, propertyValue: prop.propertyValue } )); } this.axios.all(promises) .then((response) => { this.$toastr.s(this.$t('condition.successful')); }).catch((error) => { this.$toastr.w(this.$t('condition.unsuccessful_action')); }); }, */ updateConfigProperty: function(groupName, propertyName, propertyValue) { propertyValue = common.trimToNull(propertyValue); let url = `${this.$api.BASE_URL}/${this.$api.URL_CONFIG_PROPERTY}/`; this.axios.post(url, { groupName: groupName, propertyName: propertyName, propertyValue: propertyValue }).then((response) => { this.$toastr.s(this.$t('admin.configuration_saved')); }).catch((error) => { this.$toastr.w(this.$t('condition.unsuccessful_action')); }); } } } <|start_filename|>src/plugins/jquery.js<|end_filename|> import jQuery from 'jquery' window.jQuery = jQuery; <|start_filename|>src/shared/utils.js<|end_filename|> export function random (min, max) { return Math.floor(Math.random() * (max - min + 1) + min); } /** * Randomize array element order in-place. * Using Durstenfeld shuffle algorithm. */ export const shuffleArray = (array) => { for (let i = array.length - 1; i > 0; i--) { let j = Math.floor(Math.random() * (i + 1)); let temp = array[i]; array[i] = array[j]; array[j] = temp; } return array; }; /** * Provides a function to extract a param from the querystring. */ export function getUrlVar(name) { return (new URLSearchParams(window.location.search)).get(name); } /** * retrieves the redirect to url from query param but only if it save for redirection * @param {Router} router * @returns {string} redirect to url if it save for redirection */ export function getRedirectUrl(router) { return router.currentRoute.query.redirect && isUrlSaveForRedirect(router.currentRoute.query.redirect) ? router.currentRoute.query.redirect : undefined; } // An array of acceptable root context paths defined in the UI. const acceptableRootContextPaths = [ '/dashboard', '/projects', '/components', '/services', '/vulnerabilities', '/licenses', '/policy', '/admin', '/project', '/component', '/vulnerability', '/license', '/login', '/change-password' ]; /** * checks if the given url is save for redirecting. * @param {string} redirectUrl the url to check. * @returns {Boolean} */ export function isUrlSaveForRedirect(redirectUrl) { const contextRoot = getContextPath(); try { const resultingUrl = new URL(redirectUrl, window.location.origin); return resultingUrl.origin === window.location.origin // catches redirectUrls like //foo.bar && /^https?:$/.test(resultingUrl.protocol) // catches file and blob protocol because for "blob:https://mozilla.org" origin will be returned as "https://mozilla.org". && acceptableRootContextPaths.map(r => contextRoot + r).some(p => redirectUrl.startsWith(p)); } catch(invalidUrl) { return false; } } /** * Returns the context from which the webapp is running. */ export function getContextPath() { if (acceptableRootContextPaths.some(p => window.location.pathname.startsWith(p))) { // App is deployed in the root context. Return an empty string. return ""; } else { // App is deployed in a non-root context. Return the context. return window.location.pathname.substring(0, window.location.pathname.indexOf("/",2)); } } <|start_filename|>src/validation/index.js<|end_filename|> import { extend, configure } from 'vee-validate' import { required, confirmed } from 'vee-validate/dist/rules' import i18n from '../i18n' // Get rule localization based on the rule name configure({ defaultMessage: (_, values) => i18n.t(`validation.${values._rule_}`, values) }); extend('required', required); extend('confirmed', confirmed); <|start_filename|>src/mixins/globalVarsMixin.js<|end_filename|> import Vue from 'vue' import axios from "axios"; export default { data () { return { dtrack: Object } }, created() { if (this.$dtrack) { this.dtrack = this.$dtrack; } else { axios.get(`${Vue.prototype.$api.BASE_URL}/${Vue.prototype.$api.URL_ABOUT}`) .then((result) => { this.dtrack = result.data; } ); } } } <|start_filename|>update-embedded-version.js<|end_filename|> const fs = require("fs"); const filePath = "./package.json"; const versionPath = "./src/version.json"; const { v4: uuidv4 } = require('uuid'); const packageJson = JSON.parse(fs.readFileSync(filePath).toString()); const version = { version: packageJson.version, uuid: uuidv4(), timestamp: new Date().toISOString() }; fs.writeFileSync(versionPath, JSON.stringify(version, null, 2));
zythosec/frontend
<|start_filename|>docs/src/components/getStartedSection/GetStartedSection.js<|end_filename|> import React from 'react'; import styles from './GetStartedSection.module.css'; import Link from '@docusaurus/Link'; const GetStartedSection = () => { return ( <section className={styles.wrapper}> <div className={styles.title}> Get started </div> <div className={styles.description}> Check out the full documentation for Stickyheader.js and start using it in your projects. </div> <div className={styles.buttons}> <Link className={styles.heroButton} to="docs/introduction/getting-started" > <span className={styles.heroButtonText}> GET STARTED </span> </Link> </div> </section> ); }; export default GetStartedSection; <|start_filename|>example/src/constants/colors.js<|end_filename|> export default { blue: 'blue', black: 'black', primaryGreen: '#1ca75d', secondaryGreen: 'rgb(61,179,106)', darkMint: 'rgb(72,189,126)', white: 'white', shadowColor: 'rgb(35,35,35)', transparent: 'transparent', purplishBlue: 'rgb(78, 15, 255)', purpleishBlue: 'rgb(89,80,249)', paleGrey: 'rgb(246,245,248)', greyishBrown: 'rgb(71,71,71)', coralPink: 'rgb(255,94,107)', jade: 'rgb(29,167,93)', }; <|start_filename|>jest.config.js<|end_filename|> module.exports = { preset: 'react-native', modulePathIgnorePatterns: ['<rootDir>/example/', '<rootDir>/lib/'], setupFilesAfterEnv: ['./jest/setupTests.js'], }; <|start_filename|>docs/src/components/homePageHeader/HomePageHeader.js<|end_filename|> import React from 'react'; import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; import clsx from 'clsx'; import styles from './HomePageHeader.module.css' import Link from '@docusaurus/Link'; import useBaseUrl from '@docusaurus/useBaseUrl'; const HomePageHeader = () => { const {siteConfig} = useDocusaurusContext(); return ( <header className={clsx('hero', styles.heroBanner)}> <div className={styles.heroImage}> <video autoPlay={true} muted={true} loop={true} > <source src={useBaseUrl('/parallax-video.mp4')} type="video/mp4" /> Your browser does not support HTML video. </video> </div> <div className={styles.rightContent}> <div className={styles.logo}/> <h1 className={styles.heroTitle}>{siteConfig.title}</h1> <p className={styles.heroDescriptionText}>{siteConfig.tagline}</p> <div className={styles.buttons}> <Link className={styles.heroButton} to="docs/introduction/getting-started" > <span className={styles.heroButtonText}> GET STARTED </span> </Link> </div> </div> </header> ); }; export default HomePageHeader; <|start_filename|>docs/src/components/sectionItem/SectionItem.module.css<|end_filename|> .backgroundOdd { background-color: var(--ifm-color-background); } .backgroundEven { background-color: var(--ifm-color-background-lighter); } .sectionTitle { font-size: 36px; line-height: 42px; color: var(--ifm-color-text) } .sectionDescription { font-size: 24px; line-height: 28px; max-width: 450px; color: var(--ifm-color-text-lighter); } .content { height: 100%; display: flex; flex-direction: column; justify-content: center; } .container { padding: 200px 0; } @media screen and (max-width: 966px) { .contentWrapper { order: 1 } .content { align-items: center; } .row { display: flex; flex-direction: column; } .sectionTitle { font-size: 24px; line-height: 42px; } .sectionDescription { font-size: 16px; text-align: center; margin-bottom:30px; padding: 0 25px; } .container { padding: 70px 0; } .imageWrapper { display: flex; justify-content: center; align-items: center; order: 0; } .image { width: 220px; padding-bottom: 50px; } .smallerImage { width: 130px; padding-bottom: 50px; } } <|start_filename|>example/src/navigation/AppNavigator.js<|end_filename|> import React from 'react'; import { NavigationContainer } from '@react-navigation/native'; import { createStackNavigator } from '@react-navigation/stack'; import { HomeScreen, CardScreen } from '../screens'; import YodaScreen from '../screens/additionalExamples/YodaScreen'; import AppStoreHeader from '../screens/additionalExamples/SimsScreen'; const Stack = createStackNavigator(); const AppNavigator = () => ( <NavigationContainer> <Stack.Navigator headerMode="none"> <Stack.Screen name="Home" component={HomeScreen} /> <Stack.Screen name="Card" component={CardScreen} /> <Stack.Screen name="AppStore" component={AppStoreHeader} /> <Stack.Screen name="Yoda" component={YodaScreen} /> </Stack.Navigator> </NavigationContainer> ); export default AppNavigator; <|start_filename|>docs/src/css/custom.css<|end_filename|> /** * Any CSS included here will be global. The classic template * bundles Infima by default. Infima is a CSS framework designed to * work well for content-centric websites. */ @font-face { font-family: 'avertastd-regular'; src: url('../../static/fonts/avertastd-regular-webfont.woff2') format('woff2'), url('../../static/fonts/avertastd-regular-webfont.woff') format('woff'); font-weight: normal; font-style: normal; } /* You can override the default Infima variables here. */ :root { --ifm-color-primary: #00D563; --ifm-color-primary-dark: rgb(33, 175, 144); --ifm-color-primary-darker: rgb(31, 165, 136); --ifm-color-primary-darkest: rgb(26, 136, 112); --ifm-color-primary-light: rgb(70, 203, 174); --ifm-color-primary-lighter: rgb(102, 212, 189); --ifm-color-primary-lightest: rgb(146, 224, 208); --ifm-color-text: black; --ifm-color-white: white; --ifm-color-text-lighter: #999; --ifm-color-background: white; --ifm-color-background-lighter: #FAFAFA; --ifm-code-font-size: 95%; --ifm-font-family-base: "avertastd-regular", sans-serif; --ifm-font-n-netguru: url('../../static/img/N-Netguru.png'); --ifm-footer-background-color: #232323; --ifm-background-color-footer: #232323; --ifm-footer-title-color: white; --ifm-footer-link-color: white; } :root[data-theme='dark'] { --ifm-color-text: white; --ifm-color-white: white; --ifm-color-text-lighter: #D6D6D6; --ifm-color-background: #232323; --ifm-color-background-lighter: #474747; --ifm-font-n-netguru: url('../../static/img/N-Netguru-white.png'); --ifm-footer-background-color: #232323; --ifm-footer-title-color: white; --ifm-footer-link-color: white; } .footer__copyright { color: white; margin-bottom: 20px; } .footer__logo { padding-top: 50px; padding-bottom: 50px; } @media (max-width: 996px) { .footer .container { position: relative; padding-left: 25px; } .footer .margin-bottom--sm { position: absolute !important; right: 32px; top: -60px; } .footer__logo { width: 35px; height: 35px; } } .docusaurus-highlight-code-line { background-color: rgba(0, 0, 0, 0.1); display: block; margin: 0 calc(-1 * var(--ifm-pre-padding)); padding: 0 var(--ifm-pre-padding); } html[data-theme='dark'] .docusaurus-highlight-code-line { background-color: #232323; } <|start_filename|>docs/src/components/homePageHeader/HomePageHeader.module.css<|end_filename|> /** * CSS files with the .module.css suffix will be treated as CSS modules * and scoped locally. */ video { width: 100%; height: auto; } .heroBanner { padding: 4rem 0; position: relative; overflow: hidden; } .rightContent { height: 500px; display: flex; flex-direction: column; justify-content: space-between; align-items: flex-start; padding-left: 100px; } .heroImage { margin-left: 70px; } .heroButton { border: 1px solid var(--ifm-color-primary); color: var(--ifm-color-primary); box-sizing: border-box; border-radius: 4px; display: flex; flex-direction: row; justify-content: center; align-items: center; padding: 8px 16px; } .heroButton:hover { text-decoration: none; color: var(--ifm-color-white); background-color: var(--ifm-color-primary); } .heroButtonText { font-weight: bold; font-size: 18px; line-height: 21px; letter-spacing: 0.1em; text-transform: uppercase; padding: 5px 30px; } .heroDescriptionText { font-size: 24px; line-height: 28px; max-width: 800px; color: var(--ifm-color-text-lighter); } .logo { background-image: var(--ifm-font-n-netguru); width: 150px; height: 100px; background-repeat: no-repeat; } .heroTitle { letter-spacing: 2px; font-size: 64px; line-height: 75px; max-width: 900px; color: var(--ifm-color-text); text-align: left; } .buttons { display: flex; align-items: center; justify-content: center; } @media screen and (max-width: 966px) { .heroBanner { padding: 1rem; display: flex; flex-direction: column; } .heroTitle { font-size: 24px; line-height: 30px; margin-top: -35px; } .heroDescriptionText { font-size: 16px; line-height: 20px; } .heroImage { margin-left: 0; } .rightContent { margin-top: 20px; height: 100%; padding-left: 0; justify-content: flex-start; } .buttons { display: block; width: 100%; padding-bottom: 25px; } } <|start_filename|>docs/src/pages/index.js<|end_filename|> import React from 'react'; import Layout from '@theme/Layout'; import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; import SectionItem from '../components/sectionItem/SectionItem'; import HomePageHeader from '../components/homePageHeader/HomePageHeader'; import GetStartedSection from '../components/getStartedSection/GetStartedSection'; import {SECTIONS_DATA} from '../data/sections'; const Home = () => { const {siteConfig} = useDocusaurusContext(); return ( <Layout title={`Hello from ${siteConfig.title}`} description="Description will go into a meta tag in <head />" > <HomePageHeader /> {SECTIONS_DATA.map((data, index) => { return <SectionItem key={data.id} index={index} title={data.title} description={data.description} imageName={data.imageName} /> }) } <GetStartedSection /> </Layout> ); } export default Home; <|start_filename|>docs/src/data/sections.js<|end_filename|> export const SECTIONS_DATA = [ { id: 1, title: 'Easy to use', description: 'Three predefined components included and the possibility to create a fully custom header.', imageName: 'bubbles' }, { id: 2, title: 'Type safe', description: 'Written in TypeScript and therefore compatibile with projects created in JavaScript and TypeScript.', imageName: 'office-98' }, { id: 3, title: 'Simple and lightweight', description: 'The code is simple, has minimum dependencies and doesn’t include any native code.', imageName: 'elements' } ]; <|start_filename|>.eslintrc.js<|end_filename|> module.exports = { root: true, extends: ['@react-native-community', 'prettier'], rules: { 'padding-line-between-statements': [ 'error', { blankLine: 'always', prev: 'class', next: '*' }, { blankLine: 'always', prev: '*', next: 'class' }, { blankLine: 'always', prev: ['const', 'let', 'var'], next: '*' }, { blankLine: 'any', prev: ['const', 'let', 'var'], next: ['const', 'let', 'var'] }, ], 'no-alert': 'error', 'lines-between-class-members': 'error', 'no-var': 'error', 'no-multiple-empty-lines': 'error', 'prefer-const': 'error', 'no-debugger': 'error', 'no-console': ['error', { allow: ['warn', 'error'] }], 'react-native/no-unused-styles': 2, 'react-native/split-platform-components': 2, 'react-native/no-inline-styles': 2, 'react-native/no-color-literals': 2, 'no-unused-vars': 'error', 'newline-before-return': 'error', 'prettier/prettier': [ 'error', { printWidth: 100, quoteProps: 'consistent', singleQuote: true, tabWidth: 2, trailingComma: 'es5', useTabs: false, }, ], }, }; <|start_filename|>docs/src/components/sectionItem/SectionItem.js<|end_filename|> import React from 'react'; import clsx from 'clsx'; import useBaseUrl from '@docusaurus/useBaseUrl'; import styles from './SectionItem.module.css'; const SectionItem = ({index, title, description, imageName}) => { const isOdd = index % 2 === 0 const renderImage = () => { return ( <div className={clsx("col col--6", styles.imageWrapper)}> <img className={index !== 2 ? styles.image : styles.smallerImage} src={useBaseUrl(`/img/${imageName}.png`)} alt={imageName} /> </div> ) } const renderContent = () => { return ( <div className={clsx("col col--6", styles.contentWrapper)}> <div className={styles.content}> <h3 className={styles.sectionTitle}> {title} </h3> <div className={styles.sectionDescription}> {description} </div> </div> </div> ) } return ( <section className={ isOdd ? styles.backgroundOdd : styles.backgroundEven }> <div className={clsx('container', styles.container)}> {isOdd ? <div className={clsx("row", styles.row)}> {renderContent()} {renderImage()} </div> : <div className={clsx("row", styles.row)}> {renderImage()} {renderContent()} </div>} </div> </section> ); }; export default SectionItem; <|start_filename|>docs/src/components/getStartedSection/GetStartedSection.module.css<|end_filename|> .wrapper { background-color: var(--ifm-color-primary); height: 380px; display: flex; flex-direction: column; justify-content: space-around; align-items: center; padding: 50px 0px; } .title { font-size: 36px; font-weight: bold; line-height: 42px; color: white; } .description { color: var(--ifm-color-white); font-size: 24px; line-height: 28px; width: 700px; text-align: center; } .buttons { display: flex; align-items: center; justify-content: center; } .heroButton { border: 1px solid var(--ifm-color-white);; color: white; box-sizing: border-box; border-radius: 4px; display: flex; flex-direction: row; justify-content: center; align-items: center; padding: 8px 16px; } .heroButton:hover { text-decoration: none; color: var(--ifm-color-primary); color: var(--ifm-color-primary); background-color: white; } .heroButtonText { font-weight: bold; font-size: 18px; line-height: 21px; letter-spacing: 0.1em; text-transform: uppercase; padding: 5px 30px; } @media screen and (max-width: 966px) { .title { font-size: 24px; } .description { font-size: 16px; width: 350px; } .buttons { display: block; width: 100%; padding: 30px 25px; } }
chareefdev/sticky-parallax-header
<|start_filename|>src/directives/module/focus.js<|end_filename|> export default { inserted(el, binding) { if (binding.value) { el.focus(); } else { el.blur(); } }, componentUpdated(el, binding) { if (binding.modifiers.lazy) { if (Boolean(binding.value) === Boolean(binding.oldValue)) { return; } } if (binding.value) { el.focus(); } else { el.blur(); } }, }; <|start_filename|>tailwind.config.js<|end_filename|> /* eslint-disable @typescript-eslint/no-var-requires */ const spaceoneTailwindConfig = require('@spaceone/design-system/tailwind.config'); module.exports = { theme: spaceoneTailwindConfig.theme, variants: spaceoneTailwindConfig.variants, plugins: spaceoneTailwindConfig.plugins, }; <|start_filename|>Dockerfile<|end_filename|> FROM node:16 ENV PORT 80 ENV BUILD_PATH /tmp/spaceone/build ENV ROOT_PATH /var/www ENV LOG_PATH /var/log/spaceone ENV NGINX_CONF_PATH /etc/nginx/conf.d EXPOSE ${PORT} WORKDIR ${BUILD_PATH} RUN mkdir -p ${BUILD_PATH} \ && apt-get update && apt-get install -y nginx \ && rm -f /etc/nginx/sites-enabled/default \ && mkdir -p ${BUILD_PATH} && mkdir -p ${LOG_PATH}/nginx COPY pkg/nginx.conf ${NGINX_CONF_PATH}/spaceone_console.conf COPY public ${BUILD_PATH}/public COPY package.json package-lock.json *.js ${BUILD_PATH}/ RUN npm install COPY tsconfig.json ${BUILD_PATH}/ COPY vue.config.js ${BUILD_PATH}/ ENV NODE_ENV production COPY src ${BUILD_PATH}/src RUN npm run build \ && cp -ar ${BUILD_PATH}/dist/* ${ROOT_PATH}/ \ && rm -rf ${BUILD_PATH} ENTRYPOINT ["nginx", "-g", "daemon off;"] <|start_filename|>public/page-initializer.js<|end_filename|> const httpRequest = new XMLHttpRequest(); const getTitle = () => { if (httpRequest.readyState === XMLHttpRequest.DONE) { if (httpRequest.status === 200) { document.title = httpRequest.responseText; } else { console.error('Failed to get title.txt'); } } }; httpRequest.onreadystatechange = getTitle; httpRequest.open('GET', 'title.txt'); httpRequest.send(); <|start_filename|>stylelint.config.js<|end_filename|> module.exports = { extends: ['stylelint-config-standard'], rules: { 'selector-pseudo-element-no-unknown': [true, { ignorePseudoElements: ['v-deep'] }], indentation: [4, { baseIndentLevel: 0 }], 'declaration-empty-line-before': null, 'at-rule-no-unknown': [true, { ignoreAtRules: ['define-mixin', 'mixin', 'at', 'screen', 'tailwind'] }], 'rule-empty-line-before': null, 'selector-list-comma-newline-after': null, 'function-calc-no-invalid': null, 'no-descending-specificity': null, 'property-no-unknown': [true, { ignoreProperties: [/\$(.+?)/] }], }, }; <|start_filename|>public/site-loader.css<|end_filename|> @keyframes fadeInOpacity { 0% { opacity: 0; } 100% { opacity: 1; } } #site-loader-wrapper { position: fixed; display: flex; flex-direction: column; height: 100vh; width: 100vw; justify-content: center; align-items: center; } #site-loader { width: 15rem; height: 15rem; opacity: 1; animation-name: fadeInOpacity; animation-iteration-count: 1; animation-timing-function: ease-in; animation-duration: 1s; } #site-loader-text { /* color: gray500 */ color: #858895; font-size: 0.938rem; letter-spacing: -0.01em; font-weight: 500; margin-top: -1.5rem; font-family: Roboto, sans-serif; } <|start_filename|>.lintstagedrc.js<|end_filename|> module.exports = { "**/*.{ts,tsx,js,vue}": ["eslint --fix"], "src/**/*.{css,vue,pcss,scss}": ["stylelint --fix"] } <|start_filename|>public/service-worker.js<|end_filename|> // eslint-disable-next-line no-restricted-globals self.addEventListener('install', (event) => { console.debug('install worker', event); });
minseolee/console
<|start_filename|>src/ServerScriptService/GravityController/Client/PlayerScriptsLoader/FakeUserSettings.lua<|end_filename|> local FFLAG_OVERRIDES = { ["UserRemoveTheCameraApi"] = false } local FakeUserSettings = {} function FakeUserSettings:IsUserFeatureEnabled(name) if FFLAG_OVERRIDES[name] ~= nil then return FFLAG_OVERRIDES[name] end return UserSettings():IsUserFeatureEnabled(name) end function FakeUserSettings:SafeIsUserFeatureEnabled(name) local success, result = pcall(function() return self:IsUserFeatureEnabled(name) end) return success and result end function FakeUserSettings:GetService(name) return UserSettings():GetService(name) end local function FakeUserSettingsFunc() return FakeUserSettings end return FakeUserSettingsFunc <|start_filename|>src/ServerScriptService/GravityController/Client/PlayerScriptsLoader/CameraInjector.lua<|end_filename|> -- Injects into the CameraModule to override for public API access -- EgoMoose local FakeUserSettingsFunc = require(script.Parent:WaitForChild("FakeUserSettings")) -- Camera Injection local PlayerModule = script.Parent.Parent:WaitForChild("PlayerModule") local CameraModule = PlayerModule:WaitForChild("CameraModule") local TransparencyController = require(CameraModule:WaitForChild("TransparencyController")) local result = nil local copy = TransparencyController.Enable local bind = Instance.new("BindableEvent") TransparencyController.Enable = function(self, ...) copy(self, ...) local env = getfenv(3) env.UserSettings = FakeUserSettingsFunc local f = setfenv(3, env) TransparencyController.Enable = copy result = f() bind.Event:Wait() -- infinite wait so no more connections can be made end coroutine.wrap(function() require(CameraModule) end)() -- Place children under injection for _, child in pairs(CameraModule:GetChildren()) do child.Parent = script end CameraModule.Name = "_CameraModule" script.Name = "CameraModule" script.Parent = PlayerModule -- return result <|start_filename|>src/ServerScriptService/GravityController/Client/Animate/Controller.lua<|end_filename|> local animate = script.Parent local humanoid = animate.Parent:WaitForChild("Humanoid") local loaded = animate:WaitForChild("Loaded") require(animate:WaitForChild("VerifyAnims"))(humanoid, animate) local output if humanoid.RigType == Enum.HumanoidRigType.R6 then output = require(animate:WaitForChild("R6")) else output = require(animate:WaitForChild("R15")) end loaded.Value = true return output <|start_filename|>src/StarterPack/GravityControl/tool.client.lua<|end_filename|> local Players = game:GetService("Players") local RunService = game:GetService("RunService") local ReplicatedStorage = game:GetService("ReplicatedStorage") local tool = script.Parent local GravityControllerClass = require(ReplicatedStorage:WaitForChild("GravityController")) local params = RaycastParams.new() params.FilterDescendantsInstances = {} params.FilterType = Enum.RaycastFilterType.Blacklist local gravityController = nil local function getGravityUp(self, oldGravity) local result = workspace:Raycast(self.HRP.Position, -5*oldGravity, params) if result and result.Instance.CanCollide and not result.Instance.Parent:FindFirstChild("Humanoid") then return result.Normal end return oldGravity end tool.Equipped:Connect(function() gravityController = GravityControllerClass.new(Players.LocalPlayer) gravityController.GetGravityUp = getGravityUp gravityController.Maid:Mark(RunService.Heartbeat:Connect(function(dt) local height = gravityController:GetFallHeight() if height < -50 then gravityController:ResetGravity(Vector3.new(0, 1, 0)) end end)) params.FilterDescendantsInstances = {gravityController.Character} end) tool.Unequipped:Connect(function() if gravityController then gravityController:Destroy() end end) <|start_filename|>src/ServerScriptService/GravityController/GravityController/CharacterModules/Camera.lua<|end_filename|> -- Class local CameraClass = {} CameraClass.__index = CameraClass CameraClass.ClassName = "Camera" -- Public Constructors function CameraClass.new(controller) local self = setmetatable({}, CameraClass) local player = controller.Player local playerModule = require(player.PlayerScripts:WaitForChild("PlayerModule")) self.Controller = controller self.CameraModule = playerModule:GetCameras() init(self) return self end -- Private methods function init(self) --self.CameraModule:SetTransitionRate(1) function self.CameraModule.GetUpVector(this, upVector) return self.Controller._gravityUp end end -- Public Methods function CameraClass:Destroy() function self.CameraModule.GetUpVector(this, upVector) return Vector3.new(0, 1, 0) end end -- return CameraClass <|start_filename|>src/ServerScriptService/GravityController/Client/Animate/VerifyAnims.lua<|end_filename|> local LENGTH = string.len("Animation") local DESC_ANIM_PROPS = { ["ClimbAnimation"] = true, ["FallAnimation"] = true, ["IdleAnimation"] = true, ["JumpAnimation"] = true, ["RunAnimation"] = true, ["SwimAnimation"] = true, ["WalkAnimation"] = true, } return function(humanoid, animate) local desc = humanoid:GetAppliedDescription() if humanoid.RigType == Enum.HumanoidRigType.R6 then return end for prop, _ in pairs(DESC_ANIM_PROPS) do if desc[prop] > 0 then local lookFor = prop:sub(1, #prop - LENGTH):lower() animate:WaitForChild(lookFor) end end end <|start_filename|>src/ServerScriptService/GravityController/GravityController/Collider.lua<|end_filename|> local Maid = require(script.Parent.Utility.Maid) local params = RaycastParams.new() params.FilterType = Enum.RaycastFilterType.Whitelist local params2 = RaycastParams.new() params2.FilterType = Enum.RaycastFilterType.Blacklist -- CONSTANTS local CUSTOM_PHYSICAL = PhysicalProperties.new (0.7, 0, 0, 1, 100) -- Class local ColliderClass = {} ColliderClass.__index = ColliderClass ColliderClass.ClassName = "Collider" -- Public Constructors function ColliderClass.new(controller) local self = setmetatable({}, ColliderClass) self.Model = Instance.new("Model") local sphere, vForce, floor, floor2, gryo = create(self, controller) self._maid = Maid.new() self.Controller = controller self.Sphere = sphere self.VForce = vForce self.FloorDetector = floor self.JumpDetector = floor2 self.Gyro = gryo init(self) return self end -- Private Methods local function getHipHeight(controller) if controller.Humanoid.RigType == Enum.HumanoidRigType.R15 then return controller.Humanoid.HipHeight + 0.05 end return 2 end local function getAttachement(controller) if controller.Humanoid.RigType == Enum.HumanoidRigType.R15 then return controller.HRP:WaitForChild("RootRigAttachment") end return controller.HRP:WaitForChild("RootAttachment") end function create(self, controller) local hipHeight = getHipHeight(controller) local attach = getAttachement(controller) local sphere = Instance.new("Part") sphere.Name = "Sphere" sphere.Massless = true sphere.Size = Vector3.new(2, 2, 2) sphere.Shape = Enum.PartType.Ball sphere.Transparency = 1 sphere.CustomPhysicalProperties = CUSTOM_PHYSICAL local floor = Instance.new("Part") floor.Name = "FloorDectector" floor.CanCollide = false floor.Massless = true floor.Size = Vector3.new(2, 1, 1) floor.Transparency = 1 local floor2 = Instance.new("Part") floor2.Name = "JumpDectector" floor2.CanCollide = false floor2.Massless = true floor2.Size = Vector3.new(2, 0.2, 1) floor2.Transparency = 1 local weld = Instance.new("Weld") weld.C0 = CFrame.new(0, -hipHeight, 0.1) weld.Part0 = controller.HRP weld.Part1 = sphere weld.Parent = sphere local weld = Instance.new("Weld") weld.C0 = CFrame.new(0, -hipHeight - 1.5, 0) weld.Part0 = controller.HRP weld.Part1 = floor weld.Parent = floor local weld = Instance.new("Weld") weld.C0 = CFrame.new(0, -hipHeight - 1.1, 0) weld.Part0 = controller.HRP weld.Part1 = floor2 weld.Parent = floor2 local vForce = Instance.new("VectorForce") vForce.Force = Vector3.new(0, 0, 0) vForce.ApplyAtCenterOfMass = true vForce.RelativeTo = Enum.ActuatorRelativeTo.World vForce.Attachment0 = attach vForce.Parent = controller.HRP local gyro = Instance.new("BodyGyro") gyro.P = 25000 gyro.MaxTorque = Vector3.new(100000, 100000, 100000) gyro.CFrame = controller.HRP.CFrame gyro.Parent = controller.HRP floor.Touched:Connect(function() end) floor2.Touched:Connect(function() end) sphere.Parent = self.Model floor.Parent = self.Model floor2.Parent = self.Model return sphere, vForce, floor, floor2, gyro end function init(self) self._maid:Mark(self.Model) self._maid:Mark(self.VForce) self._maid:Mark(self.FloorDetector) self._maid:Mark(self.Gyro) self.Model.Name = "Collider" self.Model.Parent = self.Controller.Character end -- Public Methods function ColliderClass:Update(force, cframe) self.VForce.Force = force self.Gyro.CFrame = cframe end function ColliderClass:IsGrounded(isJumpCheck) local parts = (isJumpCheck and self.JumpDetector or self.FloorDetector):GetTouchingParts() for _, part in pairs(parts) do if not part:IsDescendantOf(self.Controller.Character) and part.CanCollide then return true end end end function ColliderClass:GetStandingPart() params2.FilterDescendantsInstances = {self.Controller.Character} local gravityUp = self.Controller._gravityUp local result = workspace:Raycast(self.Sphere.Position, -1.1*gravityUp, params2) return result and result.Instance end function ColliderClass:Destroy() self._maid:Sweep() end -- return ColliderClass <|start_filename|>src/ServerScriptService/GravityController/Client/PlayerScriptsLoader/init.client.lua<|end_filename|> --[[ PlayerScriptsLoader - This script requires and instantiates the PlayerModule singleton 2018 PlayerScripts Update - AllYourBlox 2020 CameraModule Public Access Override & modifications - EgoMoose --]] local MIN_Y = math.rad(-80) local MAX_Y = math.rad(80) local ZERO3 = Vector3.new(0, 0, 0) local PlayerModule = script.Parent:WaitForChild("PlayerModule") local CameraInjector = script:WaitForChild("CameraInjector") require(CameraInjector) -- Control Modifications local Control = require(PlayerModule:WaitForChild("ControlModule")) local TouchJump = require(PlayerModule.ControlModule:WaitForChild("TouchJump")) function Control:IsJumping() if self.activeController then return self.activeController:GetIsJumping() or (self.touchJumpController and self.touchJumpController:GetIsJumping()) end return false end local oldEnabled = TouchJump.UpdateEnabled function TouchJump:UpdateEnabled() self.jumpStateEnabled = true oldEnabled(self) end -- Camera Modifications local CameraModule = PlayerModule:WaitForChild("CameraModule") local UserSettings = require(script:WaitForChild("FakeUserSettings")) local UserGameSettings = UserSettings():GetService("UserGameSettings") local FFlagUserCameraToggle = UserSettings():SafeIsUserFeatureEnabled("UserCameraToggle") local FFlagUserCameraInputRefactor = UserSettings():SafeIsUserFeatureEnabled("UserCameraInputRefactor3") -- Camera variables local transitionRate = 0.15 local upVector = Vector3.new(0, 1, 0) local upCFrame = CFrame.new() local spinPart = workspace.Terrain local prevSpinPart = spinPart local prevSpinCFrame = spinPart.CFrame local twistCFrame = CFrame.new() -- Camera Utilities local Utils = require(CameraModule:WaitForChild("CameraUtils")) function Utils.GetAngleBetweenXZVectors(v1, v2) v1 = upCFrame:VectorToObjectSpace(v1) v2 = upCFrame:VectorToObjectSpace(v2) return math.atan2(v2.X*v1.Z-v2.Z*v1.X, v2.X*v1.X+v2.Z*v1.Z) end -- Popper Camera local Poppercam = require(CameraModule:WaitForChild("Poppercam")) local ZoomController = require(CameraModule:WaitForChild("ZoomController")) function Poppercam:Update(renderDt, desiredCameraCFrame, desiredCameraFocus, cameraController) local rotatedFocus = desiredCameraFocus * (desiredCameraCFrame - desiredCameraCFrame.p) local extrapolation = self.focusExtrapolator:Step(renderDt, rotatedFocus) local zoom = ZoomController.Update(renderDt, rotatedFocus, extrapolation) return rotatedFocus*CFrame.new(0, 0, zoom), desiredCameraFocus end -- Base Camera local BaseCamera = require(CameraModule:WaitForChild("BaseCamera")) function BaseCamera:CalculateNewLookCFrameFromArg(suppliedLookVector, rotateInput) local currLookVector = suppliedLookVector or self:GetCameraLookVector() currLookVector = upCFrame:VectorToObjectSpace(currLookVector) local currPitchAngle = math.asin(currLookVector.y) local yTheta = math.clamp(rotateInput.y, -MAX_Y + currPitchAngle, -MIN_Y + currPitchAngle) local constrainedRotateInput = Vector2.new(rotateInput.x, yTheta) local startCFrame = CFrame.new(ZERO3, currLookVector) local newLookCFrame = CFrame.Angles(0, -constrainedRotateInput.x, 0) * startCFrame * CFrame.Angles(-constrainedRotateInput.y,0,0) return newLookCFrame end function BaseCamera:CalculateNewLookCFrame(suppliedLookVector) return self:CalculateNewLookCFrameFromArg(suppliedLookVector, self.rotateInput) end local defaultUpdateMouseBehavior = BaseCamera.UpdateMouseBehavior function BaseCamera:UpdateMouseBehavior() defaultUpdateMouseBehavior(self) if UserGameSettings.RotationType == Enum.RotationType.CameraRelative then UserGameSettings.RotationType = Enum.RotationType.MovementRelative end end -- Vehicle Camera local VehicleCamera = require(CameraModule:WaitForChild("VehicleCamera")) local VehicleCameraCore = require(CameraModule.VehicleCamera:WaitForChild("VehicleCameraCore")) local setTransform = VehicleCameraCore.setTransform function VehicleCameraCore:setTransform(transform) transform = upCFrame:ToObjectSpace(transform - transform.p) + transform.p return setTransform(self, transform) end -- Camera Module local function getRotationBetween(u, v, axis) local dot, uxv = u:Dot(v), u:Cross(v) if dot < -0.99999 then return CFrame.fromAxisAngle(axis, math.pi) end return CFrame.new(0, 0, 0, uxv.x, uxv.y, uxv.z, 1 + dot) end local function twistAngle(cf, direction) local axis, theta = cf:ToAxisAngle() local w, v = math.cos(theta/2), math.sin(theta/2)*axis local proj = v:Dot(direction)*direction local twist = CFrame.new(0, 0, 0, proj.x, proj.y, proj.z, w) local nAxis, nTheta = twist:ToAxisAngle() return math.sign(v:Dot(direction))*nTheta end local function calculateUpCFrame(self) local newUpVector = self:GetUpVector(upVector) local axis = workspace.CurrentCamera.CFrame.RightVector local sphericalArc = getRotationBetween(upVector, newUpVector, axis) local transitionCF = CFrame.new():Lerp(sphericalArc, transitionRate) upVector = transitionCF * upVector upCFrame = transitionCF * upCFrame end local function calculateSpinCFrame(self) local theta = 0 if spinPart == prevSpinPart then local rotation = spinPart.CFrame - spinPart.CFrame.p local prevRotation = prevSpinCFrame - prevSpinCFrame.p local spinAxis = rotation:VectorToObjectSpace(upVector) theta = twistAngle(prevRotation:ToObjectSpace(rotation), spinAxis) end twistCFrame = CFrame.fromEulerAnglesYXZ(0, theta, 0) prevSpinPart = spinPart prevSpinCFrame = spinPart.CFrame end local Camera = require(CameraModule) local CameraInput = require(CameraModule:WaitForChild("CameraInput")) function Camera:GetUpVector(oldUpVector) return oldUpVector end function Camera:SetSpinPart(part) spinPart = part end function Camera:SetTransitionRate(rate) transitionRate = rate end function Camera:GetTransitionRate() return transitionRate end function Camera:Update(dt) if self.activeCameraController then if FFlagUserCameraToggle then self.activeCameraController:UpdateMouseBehavior() end local newCameraCFrame, newCameraFocus = self.activeCameraController:Update(dt) newCameraFocus = CFrame.new(newCameraFocus.p) -- vehicle camera fix self.activeCameraController:ApplyVRTransform() calculateUpCFrame(self) calculateSpinCFrame(self) local lockOffset = Vector3.new(0, 0, 0) if self.activeMouseLockController and self.activeMouseLockController:GetIsMouseLocked() then lockOffset = self.activeMouseLockController:GetMouseLockOffset() end local offset = newCameraFocus:ToObjectSpace(newCameraCFrame) local camRotation = upCFrame * twistCFrame * offset newCameraFocus = newCameraFocus - newCameraCFrame:VectorToWorldSpace(lockOffset) + camRotation:VectorToWorldSpace(lockOffset) newCameraCFrame = newCameraFocus * camRotation if self.activeCameraController.lastCameraTransform then self.activeCameraController.lastCameraTransform = newCameraCFrame self.activeCameraController.lastCameraFocus = newCameraFocus end if self.activeOcclusionModule then newCameraCFrame, newCameraFocus = self.activeOcclusionModule:Update(dt, newCameraCFrame, newCameraFocus) end workspace.CurrentCamera.CFrame = newCameraCFrame workspace.CurrentCamera.Focus = newCameraFocus if self.activeTransparencyController then self.activeTransparencyController:Update() end if FFlagUserCameraInputRefactor and CameraInput.getInputEnabled() then CameraInput.resetInputForFrameEnd() end end end function Camera:IsFirstPerson() if self.activeCameraController then return self.activeCameraController.inFirstPerson end return false end function Camera:IsMouseLocked() if self.activeCameraController then return self.activeCameraController:GetIsMouseLocked() end return false end function Camera:IsToggleMode() if self.activeCameraController then return self.activeCameraController.isCameraToggle end return false end function Camera:IsCamRelative() return self:IsMouseLocked() or self:IsFirstPerson() --return self:IsToggleMode(), self:IsMouseLocked(), self:IsFirstPerson() end -- require(PlayerModule) <|start_filename|>src/ServerScriptService/GravityController/Client/Animate/init.client.lua<|end_filename|> require(script:WaitForChild("Controller")) <|start_filename|>src/ServerScriptService/GravityController/GravityController/StateTracker.lua<|end_filename|> local Maid = require(script.Parent.Utility.Maid) local Signal = require(script.Parent.Utility.Signal) -- CONSTANTS local SPEED = { [Enum.HumanoidStateType.Running] = true, } local IN_AIR = { [Enum.HumanoidStateType.Jumping] = true, [Enum.HumanoidStateType.Freefall] = true } local REMAP = { ["onFreefall"] = "onFreeFall", } -- Class local StateTrackerClass = {} StateTrackerClass.__index = StateTrackerClass StateTrackerClass.ClassName = "StateTracker" -- Public Constructors function StateTrackerClass.new(controller) local self = setmetatable({}, StateTrackerClass) self._maid = Maid.new() self.Controller = controller self.State = Enum.HumanoidStateType.Running self.Speed = 0 self.Jumped = false self.JumpTick = os.clock() self.Animation = require(controller.Character:WaitForChild("Animate"):WaitForChild("Controller")) self.Changed = Signal.new() init(self) return self end -- Private Methods function init(self) self._maid:Mark(self.Changed) self._maid:Mark(self.Changed:Connect(function(state, speed) local name = "on" .. state.Name local func = self.Animation[REMAP[name] or name] func(speed) end)) end -- Public Methods function StateTrackerClass:Update(gravityUp, isGrounded, isInputMoving) local cVelocity = self.Controller.HRP.Velocity local gVelocity = cVelocity:Dot(gravityUp) local oldState = self.State local oldSpeed = self.Speed local newState = nil local newSpeed = cVelocity.Magnitude if not isGrounded then if gVelocity > 0 then if self.Jumped then newState = Enum.HumanoidStateType.Jumping else newState = Enum.HumanoidStateType.Freefall end else if self.Jumped then self.Jumped = false end newState = Enum.HumanoidStateType.Freefall end else if self.Jumped and os.clock() - self.JumpTick > 0.1 then self.Jumped = false end newSpeed = (cVelocity - gVelocity*gravityUp).Magnitude newState = Enum.HumanoidStateType.Running end newSpeed = isInputMoving and newSpeed or 0 if oldState ~= newState or (SPEED[newState] and math.abs(newSpeed - oldSpeed) > 0.1) then self.State = newState self.Speed = newSpeed self.Changed:Fire(newState, newSpeed) end end function StateTrackerClass:RequestJump() self.Jumped = true self.JumpTick = os.clock() end function StateTrackerClass:Destroy() self._maid:Sweep() end return StateTrackerClass
hughanderson4/Rbx-Gravity-Controller
<|start_filename|>loader/so_util.h<|end_filename|> #ifndef __SO_UTIL_H__ #define __SO_UTIL_H__ #include "elf.h" #define ALIGN_MEM(x, align) (((x) + ((align) - 1)) & ~((align) - 1)) typedef struct { SceUID text_blockid, data_blockid; uintptr_t text_base, data_base; size_t text_size, data_size; Elf32_Ehdr *ehdr; Elf32_Phdr *phdr; Elf32_Shdr *shdr; Elf32_Dyn *dynamic; Elf32_Sym *dynsym; Elf32_Rel *reldyn; Elf32_Rel *relplt; int (** init_array)(void); uint32_t *hash; int num_dynamic; int num_dynsym; int num_reldyn; int num_relplt; int num_init_array; char *soname; char *shstr; char *dynstr; } so_module; typedef struct { char *symbol; uintptr_t func; } DynLibFunction; void hook_thumb(uintptr_t addr, uintptr_t dst); void hook_arm(uintptr_t addr, uintptr_t dst); void so_flush_caches(so_module *mod); int so_load(so_module *mod, const char *filename); int so_relocate(so_module *mod); int so_resolve(so_module *mod, DynLibFunction *funcs, int num_funcs, int taint_missing_imports); void so_initialize(so_module *mod); uintptr_t so_symbol(so_module *mod, const char *symbol); #endif
adjutantt/gtasa_vita
<|start_filename|>functions/snippets/main.go<|end_filename|> // Copyright 2020 The CUE Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package main import ( "fmt" "io" "net/http" ) const userAgent = "cuelang.org/play/ playground snippet fetcher" func handle(w http.ResponseWriter, r *http.Request) { cors(w) f := func(format string, args ...interface{}) { fmt.Fprintf(w, format, args...) } client := &http.Client{} if r.Method == "POST" { // Share url := fmt.Sprintf("https://play.golang.org/share") req, err := http.NewRequest("POST", url, nil) if err != nil { w.WriteHeader(http.StatusInternalServerError) f("Failed to create onwards GET URL: %v", err) return } req.Header.Add("User-Agent", userAgent) req.Body = r.Body resp, err := client.Do(req) if err != nil { w.WriteHeader(http.StatusInternalServerError) f("Failed in onward request: %v", err) return } io.Copy(w, resp.Body) } else { // Retrieve via the parameter id url := fmt.Sprintf("https://play.golang.org/p/%v.go", r.FormValue("id")) req, err := http.NewRequest("GET", url, nil) if err != nil { w.WriteHeader(http.StatusInternalServerError) f("Failed to create onwards GET URL: %v", err) return } req.Header.Add("User-Agent", userAgent) resp, err := client.Do(req) if err != nil { w.WriteHeader(http.StatusInternalServerError) f("Failed in onward request: %v", err) return } io.Copy(w, resp.Body) } } func main() { http.HandleFunc("/.netlify/functions/snippets", handle) serve() } <|start_filename|>internal/genversion/main.go<|end_filename|> // Copyright 2019 CUE Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // genversion generates a TypeScript module that contains an exported string // constant that is the version of the cuelang.org/go module in use. package main import ( "bytes" "fmt" "io/ioutil" "log" "os/exec" "strings" // imported for side effect of module being available in cache _ "cuelang.org/go/pkg" ) func main() { log.SetFlags(log.Lshortfile) // Generate new tour files var cueDir bytes.Buffer cmd := exec.Command("go", "list", "-m", "-f={{.Version}}", "cuelang.org/go") cmd.Stdout = &cueDir if err := cmd.Run(); err != nil { log.Fatal(fmt.Errorf("failed to run %v; %w", strings.Join(cmd.Args, " "), err)) } out := fmt.Sprintf("export const CUEVersion = \"%v\";\n", strings.TrimSpace(cueDir.String())) if err := ioutil.WriteFile("gen_cuelang_org_go_version.ts", []byte(out), 0666); err != nil { log.Fatal(fmt.Errorf("failed to write generated version file: %v", err)) } } <|start_filename|>src/index.css<|end_filename|> /* * Copyright 2020 CUE Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ html { box-sizing: border-box; } *, *:before, *:after { box-sizing: inherit; } .grid-container { display: grid; grid-template-areas: "header header" "left right"; grid-gap: 10px; background-color: #2196f3; grid-template-rows: auto 1fr; grid-template-columns: 1fr 1fr; padding: 0px; height: 100vh; } .grid-container > div { background-color: rgba(255, 255, 255, 0.8); } body { overflow: hidden; margin: 0px; padding: 0px; } textarea.codeinput { width: 100%; height: 100%; font-family: Menlo, Courier\New, monospace; font-size: 11pt; } pre.ast { margin: 0px; padding: 0px; overflow: auto; } pre.asterror { color: darkred; } .header { grid-area: header; display: grid; grid-template-areas: "title controls gap"; grid-gap: 40px; grid-template-columns: auto auto 1fr; align-items: center; text-align: left; padding: 0px 10px; } .left { grid-area: left; } .right { grid-area: right; } .title { font-size: 22px; grid-area: title; } .share { grid-area: share; } .gap { grid-area: gap; text-align: right; font-size: 12px; } .controls { grid-area: controls; display: grid; grid-gap: 10px; grid-template-columns: auto auto auto auto auto; grid-template-rows: 1fr; align-items: center; } <|start_filename|>webpack.config.js<|end_filename|> const path = require('path'); const HtmlWebpackPlugin = require('html-webpack-plugin'); let distRoot = __dirname; if (process.env.NETLIFY == "true") { if (process.env.CUELANG_ORG_DIST == "") { console.log("Unable to read CUELANG_ORG_DIST environment variable"); process.exit(1); } distRoot = process.env.CUELANG_ORG_DIST; } let distDir = path.join(distRoot, '_public', 'play'); module.exports = { entry: './src/index.tsx', resolve: { extensions: ['.ts', '.tsx', '.js'] }, output: { path: distDir, filename: 'bundle.min.js' }, // So that we don't get reminded how large the compiled // Go output is. performance: { hints: false }, module: { rules: [ { test: /\.tsx?$/, loader: 'ts-loader' }, { test: /\.(s*)css$/, use:['style-loader','css-loader', 'sass-loader'] }, { test: /\.wasm$/, loader: 'file-loader', type: 'javascript/auto', options: { name: '[name].[ext]' } }, ] }, plugins: [ new HtmlWebpackPlugin({ template: './src/index.html' }) ] } <|start_filename|>impl_test.go<|end_filename|> // Copyright 2020 The CUE Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package main import ( "fmt" "testing" ) var testTable = []struct { In input Fn function Out output InVal string OutVal string Err string }{ {inputCUE, functionExport, outputCUE, "", "\n", ""}, {inputCUE, functionExport, outputCUE, "a: b: 5\na: c: 4", "a: {\n\tb: 5\n\tc: 4\n}\n", ""}, {inputCUE, functionExport, outputJSON, "test: 5", "{\n \"test\": 5\n}\n", ""}, } func TestHandleCUECompile(t *testing.T) { for _, tv := range testTable { desc := fmt.Sprintf("handleCUECompile(%q, %q, %q, %q)", tv.In, tv.Fn, tv.Out, tv.InVal) out, err := handleCUECompile(tv.In, tv.Fn, tv.Out, tv.InVal) if tv.Err != "" { if err != nil { if err.Error() != tv.Err { t.Fatalf("%v: expected error string %q; got %q", desc, tv.Err, err) } } else { t.Fatalf("%v: expected error, did not see one. Output was %q", desc, out) } } else { if err != nil { t.Fatalf("%v: got unexpected error: %v", desc, err) } else if out != tv.OutVal { t.Fatalf("%v: expected output %q: got %q", desc, tv.OutVal, out) } } } } <|start_filename|>tsfmt.json<|end_filename|> { "baseIndentSize": 0, "convertTabsToSpaces": false, "indentSize": 4, "indentStyle": 2, "insertSpaceAfterCommaDelimiter": true, "insertSpaceAfterConstructor": false, "insertSpaceAfterFunctionKeywordForAnonymousFunctions": false, "insertSpaceAfterKeywordsInControlFlowStatements": true, "insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces": false, "insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces": true, "insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets": false, "insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis": false, "insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces": false, "insertSpaceAfterSemicolonInForStatements": true, "insertSpaceAfterTypeAssertion": false, "insertSpaceBeforeAndAfterBinaryOperators": true, "insertSpaceBeforeFunctionParenthesis": false, "insertSpaceBeforeTypeAnnotation": true, "newLineCharacter": "\n", "placeOpenBraceOnNewLineForControlBlocks": false, "placeOpenBraceOnNewLineForFunctions": false, "tabSize": 4 } <|start_filename|>main.go<|end_filename|> // Copyright 2020 CUE Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. //go:build js && wasm // +build js,wasm package main import ( "fmt" "syscall/js" ) // TODO: for some reason recompiling the main.wasm file does not trigger // webpack to hot reload. We get "nothing hot updated" func main() { api := js.Global().Get("WasmAPI") api.Set("CUECompile", js.FuncOf(cueCompile)) api.Call("FireOnChange") select {} } func cueCompile(this js.Value, args []js.Value) interface{} { // args[0] is the input type // args[1] is the function // args[2] is the output type // args[3] is the actual input value const expArgs = 4 if len(args) != expArgs { panic(fmt.Errorf("cueCompile: expected %v args, got %v", expArgs, len(args))) } for i := 0; i < expArgs; i++ { if t := args[i].Type(); t != js.TypeString { panic(fmt.Errorf("cueCompile: expected arg %v to be of type syscall/js.TypeString, got %v", i, t)) } } in := input(args[0].String()) fn := function(args[1].String()) out := output(args[2].String()) inVal := args[3].String() val, err := handleCUECompile(in, fn, out, inVal) var errStr string if err != nil { errStr = err.Error() } return map[string]interface{}{ "value": val, "error": errStr, } } <|start_filename|>impl.go<|end_filename|> // Copyright 2020 The CUE Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package main import ( "bytes" "fmt" "strings" "cuelang.org/go/cue" "cuelang.org/go/cue/ast" "cuelang.org/go/cue/errors" "cuelang.org/go/cue/format" "cuelang.org/go/cue/load" "cuelang.org/go/cue/token" "github.com/cue-sh/playground/internal/cuelang_org_go_internal/encoding" "github.com/cue-sh/playground/internal/cuelang_org_go_internal/filetypes" ) type function string const ( functionExport function = "export" functionDef function = "def" ) type input string const ( inputCUE input = "cue" inputJSON input = "json" inputYaml input = "yaml" ) type output string const ( outputCUE output = output(inputCUE) outputJSON output = output(inputJSON) outputYaml output = output(inputYaml) ) func handleCUECompile(in input, fn function, out output, inputVal string) (string, error) { // TODO implement more functions switch fn { case functionExport, functionDef: default: return "", fmt.Errorf("function %q is not implemented", fn) } switch in { case inputCUE, inputJSON, inputYaml: default: return "", fmt.Errorf("unknown input type: %v", in) } loadCfg := &load.Config{ Stdin: strings.NewReader(inputVal), Dir: "/", ModuleRoot: "/", Overlay: map[string]load.Source{ "/cue.mod/module.cue": load.FromString(`module: "example.com"`), }, } builds := load.Instances([]string{string(in) + ":", "-"}, loadCfg) if err := builds[0].Err; err != nil { return "", fmt.Errorf("failed to load: %v", err) } insts := cue.Build(builds) inst := insts[0] if err := inst.Err; err != nil { return "", fmt.Errorf("failed to build: %v", err) } v := insts[0].Value() switch out { case outputCUE, outputJSON, outputYaml: default: return "", fmt.Errorf("unknown ouput type: %v", out) } f, err := filetypes.ParseFile(string(out)+":-", filetypes.Export) if err != nil { var buf bytes.Buffer errors.Print(&buf, err, nil) panic(fmt.Errorf("failed to parse file from %v: %s", string(out)+":-", buf.Bytes())) } var outBuf bytes.Buffer encConf := &encoding.Config{ Out: &outBuf, } e, err := encoding.NewEncoder(f, encConf) if err != nil { return "", fmt.Errorf("failed to build encoder: %v", err) } syn := []cue.Option{ cue.Docs(true), cue.Attributes(true), cue.Optional(true), cue.Definitions(true), } var opts []format.Option switch out { case outputCUE: if fn != functionDef { syn = append(syn, cue.Concrete(true)) } opts = append(opts, format.TabIndent(true)) case outputJSON, outputYaml: opts = append(opts, format.TabIndent(false), format.UseSpaces(2), ) } encConf.Format = opts synF := getSyntax(v, syn) if err := e.EncodeFile(synF); err != nil { return "", fmt.Errorf("failed to encode: %v", err) } return outBuf.String(), nil } // getSyntax is copied from cmd/cue/cmd/eval.go func getSyntax(v cue.Value, opts []cue.Option) *ast.File { n := v.Syntax(opts...) switch x := n.(type) { case *ast.File: return x case *ast.StructLit: return &ast.File{Decls: x.Elts} case ast.Expr: ast.SetRelPos(x, token.NoSpace) return &ast.File{Decls: []ast.Decl{&ast.EmbedDecl{Expr: x}}} default: panic("unreachable") } }
cue-sh/playground
<|start_filename|>PasscodeLock/PasscodeLock.h<|end_filename|> // // PasscodeLock.h // PasscodeLock // // Created by <NAME> on 8/28/15. // Copyright © 2015 <NAME>. All rights reserved. // #import <UIKit/UIKit.h> //! Project version number for PasscodeLock. FOUNDATION_EXPORT double PasscodeLockVersionNumber; //! Project version string for PasscodeLock. FOUNDATION_EXPORT const unsigned char PasscodeLockVersionString[]; // In this header, you should import all the public headers of your framework using statements like #import <PasscodeLock/PublicHeader.h>
whyinzoo/SwiftPasscodeLock
<|start_filename|>migrations/2_deploy_testing_token.js<|end_filename|> var TestingToken = artifacts.require("./TestingToken.sol"); module.exports = function (deployer, network, accounts) { const operator = accounts[0]; (async () => { await deployer.deploy(TestingToken, {"from": operator}); let testingToken = await TestingToken.deployed(); })(); }; <|start_filename|>scripts/doxity/pages/docs/SafeMath.json<|end_filename|> {"title":"SafeMath\r","fileName":"/contracts/math/SafeMath.sol","name":"SafeMath","abi":[],"bin":"604c602c600b82828239805160001a60731460008114601c57601e565bfe5b5030600052607381538281f30073000000000000000000000000000000000000000030146080604052600080fd00a165627a7a7230582010f833ed4c11ff2c554a3061941291a803638344072dbe94c07b24170650c7330029","opcodes":"PUSH1 0x4C PUSH1 0x2C PUSH1 0xB DUP3 DUP3 DUP3 CODECOPY DUP1 MLOAD PUSH1 0x0 BYTE PUSH1 0x73 EQ PUSH1 0x0 DUP2 EQ PUSH1 0x1C JUMPI PUSH1 0x1E JUMP JUMPDEST INVALID JUMPDEST POP ADDRESS PUSH1 0x0 MSTORE PUSH1 0x73 DUP2 MSTORE8 DUP3 DUP2 RETURN STOP PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x0 DUP1 REVERT STOP LOG1 PUSH6 0x627A7A723058 KECCAK256 LT 0xf8 CALLER 0xed 0x4c GT SELFDESTRUCT 0x2c SSTORE 0x4a ADDRESS PUSH2 0x9412 SWAP2 0xa8 SUB PUSH4 0x8344072D 0xbe SWAP5 0xc0 PUSH28 0x24170650C73300290000000000000000000000000000000000000000 ","source":"pragma solidity ^0.4.23;\r\n\r\n\r\n/**\r\n * @title SafeMath\r\n * @dev Math operations with safety checks that throw on error\r\n */\r\nlibrary SafeMath {\r\n\tfunction mul(uint256 a, uint256 b) internal pure returns (uint256) {\r\n\t\tif (a == 0) {\r\n\t\t\treturn 0;\r\n\t\t}\r\n\t\tuint256 c = a * b;\r\n\t\tassert(c / a == b);\r\n\t\treturn c;\r\n\t}\r\n\r\n\tfunction div(uint256 a, uint256 b) internal pure returns (uint256) {\r\n\t\t// assert(b > 0); // Solidity automatically throws when dividing by 0\r\n\t\tuint256 c = a / b;\r\n\t\t// assert(a == b * c + a % b); // There is no case in which this doesn't hold\r\n\t\treturn c;\r\n\t}\r\n\r\n\tfunction sub(uint256 a, uint256 b) internal pure returns (uint256) {\r\n\t\tassert(b <= a);\r\n\t\treturn a - b;\r\n\t}\r\n\r\n\tfunction add(uint256 a, uint256 b) internal pure returns (uint256) {\r\n\t\tuint256 c = a + b;\r\n\t\tassert(c >= a);\r\n\t\treturn c;\r\n\t}\r\n}\r\n","abiDocs":[]} <|start_filename|>test/TestingTokenTest/TestingTokenTest.js<|end_filename|> // const TestingToken = artifacts.require('./TestingToken.sol'); // const Overdraft = artifacts.require('./OverdraftTest.sol'); // const web3 = global.web3; // // const tbn = v => web3.toBigNumber(v); // const fbn = v => v.toString(); // const tw = v => web3.toBigNumber(v).mul(1e18); // const fw = v => web3._extend.utils.fromWei(v).toString(); // // const gasPrice = tw("3e-7"); // // contract('TestingToken', (accounts) => { // // let tt; // let ADMIN = accounts[0]; // // beforeEach(async () => { // tt = await TestingToken.new({from: ADMIN}); // overdraft = await Overdraft.new(); // }); // // describe("common check", () => { // // it("allow to init token", async () => { // await tt.init(tbn(0x12), tw(100), {from: ADMIN}); // assert((await tt.balanceOf(tbn(0x12), ADMIN)).eq(tw(100))); // assert((await tt.totalSupply(tbn(0x12))).eq(tw(100))); // }); // // it("allow to transfer token to other account", async () => { // await tt.init(tbn(0x12), tw(100), {from: ADMIN}); // assert((await tt.balanceOf(tbn(0x12), ADMIN)).eq(tw(100))); // assert((await tt.totalSupply(tbn(0x12))).eq(tw(100))); // await tt.transfer(tbn(0x12), accounts[8], tw(12), {from: ADMIN}); // assert((await tt.balanceOf(tbn(0x12), accounts[8])).eq(tw(12))); // assert((await tt.balanceOf(tbn(0x12), ADMIN)).eq(tw(88))); // }); // // it("allow to apporove token to other account", async () => { // await tt.init(tbn(0x12), tw(100), {from: ADMIN}); // assert((await tt.balanceOf(tbn(0x12), ADMIN)).eq(tw(100))); // assert((await tt.totalSupply(tbn(0x12))).eq(tw(100))); // await tt.approve(tbn(0x12), accounts[8], tw(19), {from: ADMIN}); // assert((await tt.allowance(tbn(0x12), ADMIN, accounts[8])).eq(tw(19))); // }); // // it("allow to decrease approval of other account", async () => { // await tt.init(tbn(0x12), tw(100), {from: ADMIN}); // assert((await tt.balanceOf(tbn(0x12), ADMIN)).eq(tw(100))); // assert((await tt.totalSupply(tbn(0x12))).eq(tw(100))); // await tt.approve(tbn(0x12), accounts[8], tw(19), {from: ADMIN}); // assert((await tt.allowance(tbn(0x12), ADMIN, accounts[8])).eq(tw(19))); // await tt.decreaseApproval(tbn(0x12), accounts[8], tw(1), {from: ADMIN}); // assert((await tt.allowance(tbn(0x12), ADMIN, accounts[8])).eq(tw(18))); // }); // // it("allow to increase approval of other account", async () => { // await tt.init(tbn(0x12), tw(100), {from: ADMIN}); // assert((await tt.balanceOf(tbn(0x12), ADMIN)).eq(tw(100))); // assert((await tt.totalSupply(tbn(0x12))).eq(tw(100))); // await tt.approve(tbn(0x12), accounts[8], tw(19), {from: ADMIN}); // assert((await tt.allowance(tbn(0x12), ADMIN, accounts[8])).eq(tw(19))); // await tt.increaseApproval(tbn(0x12), accounts[8], tw(1), {from: ADMIN}); // assert((await tt.allowance(tbn(0x12), ADMIN, accounts[8])).eq(tw(20))); // }); // // it("allow to transferFrom of other account", async () => { // await tt.init(tbn(0x12), tw(100), {from: ADMIN}); // assert((await tt.balanceOf(tbn(0x12), ADMIN)).eq(tw(100))); // assert((await tt.totalSupply(tbn(0x12))).eq(tw(100))); // await tt.approve(tbn(0x12), accounts[8], tw(19), {from: ADMIN}); // await tt.transferFrom(tbn(0x12), ADMIN, accounts[7], tw(19), {from: accounts[8]}); // assert((await tt.allowance(tbn(0x12), ADMIN, accounts[8])).eq(tw(0))); // assert((await tt.balanceOf(tbn(0x12), accounts[7])).eq(tw(19))); // }); // // it("allow to decrease approval of other account and transferFrom later", async () => { // await tt.init(tbn(0x12), tw(100), {from: ADMIN}); // assert((await tt.balanceOf(tbn(0x12), ADMIN)).eq(tw(100))); // assert((await tt.totalSupply(tbn(0x12))).eq(tw(100))); // await tt.approve(tbn(0x12), accounts[8], tw(19), {from: ADMIN}); // assert((await tt.allowance(tbn(0x12), ADMIN, accounts[8])).eq(tw(19))); // await tt.decreaseApproval(tbn(0x12), accounts[8], tw(1), {from: ADMIN}); // assert((await tt.allowance(tbn(0x12), ADMIN, accounts[8])).eq(tw(18))); // await tt.transferFrom(tbn(0x12), ADMIN, accounts[7], tw(18), {from: accounts[8]}); // assert((await tt.allowance(tbn(0x12), ADMIN, accounts[8])).eq(tw(0))); // assert((await tt.balanceOf(tbn(0x12), accounts[7])).eq(tw(18))); // }); // // it("allow to increase approval of other account and transferFrom later", async () => { // await tt.init(tbn(0x12), tw(100), {from: ADMIN}); // assert((await tt.balanceOf(tbn(0x12), ADMIN)).eq(tw(100))); // assert((await tt.totalSupply(tbn(0x12))).eq(tw(100))); // await tt.approve(tbn(0x12), accounts[8], tw(19), {from: ADMIN}); // assert((await tt.allowance(tbn(0x12), ADMIN, accounts[8])).eq(tw(19))); // await tt.increaseApproval(tbn(0x12), accounts[8], tw(1), {from: ADMIN}); // assert((await tt.allowance(tbn(0x12), ADMIN, accounts[8])).eq(tw(20))); // await tt.transferFrom(tbn(0x12), ADMIN, accounts[7], tw(20), {from: accounts[8]}); // assert((await tt.allowance(tbn(0x12), ADMIN, accounts[8])).eq(tw(0))); // assert((await tt.balanceOf(tbn(0x12), accounts[7])).eq(tw(20))); // }); // }); // // describe("negative check", () => { // // it("should not allow to init tokens with existing ID", async () => { // await tt.init(tbn(0x12), tw(100), {from: ADMIN}); // assert((await tt.balanceOf(tbn(0x12), ADMIN)).eq(tw(100))); // assert((await tt.totalSupply(tbn(0x12))).eq(tw(100))); // try { // await tt.init(tbn(0x12), tw(100), {from: accounts[9]}); // } // catch (e) { // // } // assert((await tt.balanceOf(tbn(0x12), ADMIN)).eq(tw(100))); // assert((await tt.totalSupply(tbn(0x12))).eq(tw(100))); // assert((await tt.balanceOf(tbn(0x12), accounts[9])).eq(tw(0))); // }); // // it("should not allow to transfer tokens as ADMIN if not ADMIN", async () => { // await tt.init(tbn(0x12), tw(100), {from: ADMIN}); // assert((await tt.balanceOf(tbn(0x12), ADMIN)).eq(tw(100))); // assert((await tt.totalSupply(tbn(0x12))).eq(tw(100))); // try { // await tt.transfer(tbn(0x12), accounts[8], tw(12), {from: accounts[5]}); // } // catch (e) { // // } // assert((await tt.balanceOf(tbn(0x12), accounts[8])).eq(tw(0))); // assert((await tt.balanceOf(tbn(0x12), ADMIN)).eq(tw(100))); // }); // // it("should not allow to approve / decreaseApproval / increaseApproval if not ADMIN", async () => { // await tt.init(tbn(0x12), tw(100), {from: ADMIN}); // assert((await tt.balanceOf(tbn(0x12), ADMIN)).eq(tw(100))); // assert((await tt.totalSupply(tbn(0x12))).eq(tw(100))); // try { // await tt.approve(tbn(0x12), accounts[8], tw(19), {from: accounts[4]}); // } // catch (e) { // // } // assert((await tt.allowance(tbn(0x12), ADMIN, accounts[8])).eq(tw(0))); // // try { // await tt.increaseApproval(tbn(0x12), accounts[8], tw(1), {from: accounts[4]}); // } // catch (e) { // // } // assert((await tt.allowance(tbn(0x12), ADMIN, accounts[8])).eq(tw(0))); // // try { // await tt.decreaseApproval(tbn(0x12), accounts[8], tw(1), {from: accounts[4]}); // } // catch (e) { // // } // assert((await tt.allowance(tbn(0x12), ADMIN, accounts[8])).eq(tw(0))); // // }); // // it("should not allow to tranferFrom if not spender", async () => { // await tt.init(tbn(0x12), tw(100), {from: ADMIN}); // assert((await tt.balanceOf(tbn(0x12), ADMIN)).eq(tw(100))); // assert((await tt.totalSupply(tbn(0x12))).eq(tw(100))); // await tt.approve(tbn(0x12), accounts[8], tw(19), {from: ADMIN}); // // try { // await tt.transferFrom(tbn(0x12), accounts[3], accounts[7], tw(18), {from: accounts[8]}); // } // catch (e) { // // } // // try { // await tt.transferFrom(tbn(0x12), ADMIN, accounts[7], tw(18), {from: accounts[4]}); // } // catch (e) { // // } // assert((await tt.allowance(tbn(0x12), ADMIN, accounts[8])).eq(tw(19))); // assert((await tt.balanceOf(tbn(0x12), accounts[7])).eq(tw(0))); // }); // }); // // describe("dividends check", () => { // // it("should allow to accept dividends", async () => { // await tt.init(tbn(0x12), tw(100), {from: ADMIN}); // assert((await tt.balanceOf(tbn(0x12), ADMIN)).eq(tw(100))); // assert((await tt.totalSupply(tbn(0x12))).eq(tw(100))); // for (let i = 1; i < 8; i++) { // await tt.acceptDividends(tbn(0x12), {from: accounts[i], value: tw(2)}); // } // // let dividends = await tt.dividendsRightsOf(tbn(0x12), ADMIN); // assert(dividends.eq(tw(14))); // assert((await web3.eth.getBalance(tt.address)).eq(tw(14))); // }); // // it("should allow to release dividends after investing", async () => { // await tt.init(tbn(0x12), tw(100), {from: ADMIN}); // assert((await tt.balanceOf(tbn(0x12), ADMIN)).eq(tw(100))); // assert((await tt.totalSupply(tbn(0x12))).eq(tw(100))); // for (let i = 1; i < 8; i++) { // await tt.acceptDividends(tbn(0x12), {from: accounts[i], value: tw(2)}); // } // let dividends = await tt.dividendsRightsOf(tbn(0x12), ADMIN); // assert(dividends.eq(tw(14))); // assert((await web3.eth.getBalance(tt.address)).eq(tw(14))); // await tt.transfer(tbn(0x12), accounts[3], tw(50)); // await tt.acceptDividends(tbn(0x12), {from: accounts[9], value: tw(10)}); // assert((await tt.dividendsRightsOf(tbn(0x12), accounts[3])).eq(tw(5))); // assert((await tt.dividendsRightsOf(tbn(0x12), ADMIN)).eq(tw(19))); // assert((await web3.eth.getBalance(tt.address)).eq(tw(24))) // }); // // it("should allow to approve," + // "than invest, than increase approval, than invest and release all", async () => { // let balanceBefore = await web3.eth.getBalance(accounts[5]); // await tt.init(tbn(0x12), tw(100), {from: ADMIN}); // assert((await tt.balanceOf(tbn(0x12), ADMIN)).eq(tw(100))); // assert((await tt.totalSupply(tbn(0x12))).eq(tw(100))); // await tt.approve(tbn(0x12), accounts[4], tw(50), {from: ADMIN}); // await tt.transferFrom(tbn(0x12), ADMIN, accounts[5], tw(50), {from: accounts[4]}); // for (let i = 1; i < 5; i++) { // await tt.acceptDividends(tbn(0x12), {from: accounts[i], value: tw(2)}); // } // for (let i = 6; i < 8; i++) { // await tt.acceptDividends(tbn(0x12), {from: accounts[i], value: tw(2)}); // } // let dividendsFirst = await tt.dividendsRightsOf(tbn(0x12), accounts[5]); // assert(dividendsFirst.eq(tw(6))); // await tt.increaseApproval(tbn(0x12), accounts[4], tw(25), {from: ADMIN}); // await tt.transferFrom(tbn(0x12), ADMIN, accounts[5], tw(25), {from: accounts[4]}); // await tt.acceptDividends(tbn(0x12), {from: accounts[9], value: tw(20)}); // let dividendsSecond = await tt.dividendsRightsOf(tbn(0x12), accounts[5]); // assert(dividendsSecond.eq(tw(21))); // let instance = await tt.releaseDividendsRights(tbn(0x12), tw(21), {from: accounts[5], gasPrice: gasPrice}); // let fee = instance.receipt.gasUsed * gasPrice; // let balanceNow = await web3.eth.getBalance(accounts[5]); // assert((balanceBefore.plus(tw(21))).eq(balanceNow.plus(fee))); // }); // // it("should allow to release by force", async () => { // let balanceBefore = await web3.eth.getBalance(accounts[5]); // await tt.init(tbn(0x12), tw(100), {from: ADMIN}); // assert((await tt.balanceOf(tbn(0x12), ADMIN)).eq(tw(100))); // assert((await tt.totalSupply(tbn(0x12))).eq(tw(100))); // await tt.transfer(tbn(0x12), accounts[5], tw(50)); // await tt.acceptDividends(tbn(0x12), {from: accounts[3], value: tw(4)}); // let dividends = await tt.dividendsRightsOf(tbn(0x12), accounts[5]); // assert(dividends.eq(tw(2))); // await tt.releaseDividendsRightsForce(tbn(0x12), accounts[5], dividends, {from: ADMIN}); // let balanceNow = await web3.eth.getBalance(accounts[5]); // assert((balanceBefore.plus(dividends)).eq(balanceNow)); // }); // // it("just all in one", async () => { // // let tokens = { // token0: tbn(0x0), // token1: tbn(0x1), // token2: tbn(0x2), // token3: tbn(0x3), // token4: tbn(0x4) // }; // // let incorrectSums = { // sum0: tw(0), // sum1: tbn(2 ** 256), // sum2: tbn(-1), // sum3: tw(10000000), // sum4: tw(-2 * 256) // }; // // let sumsToCheck = { // sumd0: tw(1), // sumd1: tw(2) // }; // // let fees = []; // let balanceBefore = await web3.eth.getBalance(accounts[2]); // for (let i in tokens) { // await tt.init(tokens[i], tw(100), {from: ADMIN}); // await tt.transfer(tokens[i], accounts[2], tw(50), {from: ADMIN}); // await tt.acceptDividends(tokens[i], {from: accounts[6], value: tw(2)}); // let d = await tt.dividendsRightsOf(tokens[i], accounts[2]); // let ins = await tt.releaseDividendsRights(tokens[i], d, {from: accounts[2], gasPrice: gasPrice}); // fees.push(ins.receipt.gasUsed * gasPrice); // } // ; // let balanceNow = await web3.eth.getBalance(accounts[2]); // let fee = 0; // for (let j = 0; j < 5; j++) { // fee += fees[j]; // } // ; // for (let j = 0; j < 5; j++) { // assert((balanceBefore.plus(tw(5)).eq(balanceNow.plus(fee)))); // } // ; // }); // }); // // describe("dividends overdraft tests", () => { // // it("should not allow to accept dividends with overdraft", async () => { // await tt.init(tbn(0x1), tw(1000), {from: ADMIN}); // let ovedraftSum = await overdraft.max_value_test(); // try { // await tt.acceptDividends(ovedraftSum, {from: ADMIN, value: tw(2)}); // } // catch (e) { // // } // assert((await tt.totalSupply(ovedraftSum)).eq(tbn(0))); // try { // await tt.acceptDividends(tbn(0x2), {from: ADMIN, value: ovedraftSum}); // } // catch (e) { // // } // assert((await tt.totalSupply(tbn(0x2))).eq(tbn(0))); // }); // // it("should not allow to tranfer with overdraft", async () => { // await tt.init(tbn(0x1), tw(1000), {from: ADMIN}); // let ovedraftSum = await overdraft.max_value_test(); // try { // await tt.transfer(tbn(0x1), accounts[4], ovedraftSum, {from: ADMIN}); // } // catch (e) { // // } // assert((await tt.balanceOf(tbn(0x1), accounts[4])).eq(tbn(0))); // }); // // it("should not allow to tranferFrom with overdraft", async () => { // await tt.init(tbn(0x1), tw(1000), {from: ADMIN}); // await tt.approve(tbn(0x1), accounts[4], tw(10), {from: ADMIN}); // let ovedraftSum = await overdraft.max_value_test(); // try { // await tt.transferFrom(tbn(0x12), ADMIN, accounts[5], ovedraftSum, {from: accounts[4]}); // } // catch (e) { // // } // assert((await tt.balanceOf(tbn(0x1), accounts[5])).eq(tw(0))); // }); // // it("should not allow to release with overdraft", async () => { // await tt.init(tbn(0x1), tw(1000), {from: ADMIN}); // await tt.transfer(tbn(0x1), accounts[5], tw(1000)); // assert((await tt.balanceOf(tbn(0x1), accounts[5])).eq(tw(1000))); // let ovedraftSum = await overdraft.max_value_test(); // for (let i = 6; i < 8; i++) { // await tt.acceptDividends(tbn(0x1), {from: accounts[i], value: tw(2)}); // } // assert((await web3.eth.getBalance(tt.address)).eq(tw(4))); // assert((await tt.dividendsRightsOf(tbn(0x1), accounts[5])).eq(tw(4))); // try { // await tt.releaseDividendsRights(tbn(0x1), ovedraftSum, {from: accounts[5]}); // } // catch (e) { // // } // assert((await web3.eth.getBalance(tt.address)).eq(tw(4))); // assert((await tt.dividendsRightsOf(tbn(0x1), accounts[5])).eq(tw(4))); // }); // // it("should not allow to releaseByForce with overdraft", async () => { // await tt.init(tbn(0x1), tw(1000), {from: ADMIN}); // await tt.transfer(tbn(0x1), accounts[5], tw(1000)); // assert((await tt.balanceOf(tbn(0x1), accounts[5])).eq(tw(1000))); // let ovedraftSum = await overdraft.max_value_test(); // for (let i = 6; i < 8; i++) { // await tt.acceptDividends(tbn(0x1), {from: accounts[i], value: tw(2)}); // } // assert((await web3.eth.getBalance(tt.address)).eq(tw(4))); // assert((await tt.dividendsRightsOf(tbn(0x1), accounts[5])).eq(tw(4))); // // try { // await tt.releaseDividendsRightsForce(tbn(0x1), accounts[5], ovedraftSum, {from: ADMIN}); // } // catch (e) { // // } // assert((await web3.eth.getBalance(tt.address)).eq(tw(4))); // assert((await tt.dividendsRightsOf(tbn(0x1), accounts[5])).eq(tw(4))); // }); // // }); // }); <|start_filename|>truffle.js<|end_filename|> const ethUtil = require("ethereumjs-util"); const env = process.env; // don't load .env file in prod if (env.NODE_ENV !== 'production') { require('dotenv').load(); } module.exports = { // See <http://truffleframework.com/docs/advanced/configuration> // to customize your Truffle configuration! networks: { development: { host: "127.0.0.1", port: 8545, network_id: "*", // Match any network id, gas: 4600000 }, ganache: { host: '127.0.0.1', port:8545, network_id: 5777, gas: 6721975 }, kovan: { host: 'localhost', port: 8545, network_id: 42, gas: 4700000, gasPrice: 20000000000 }, rinkeby: { provider: function() { let WalletProvider = require("truffle-wallet-provider"); let wallet = require('ethereumjs-wallet').fromPrivateKey(Buffer.from(env.ETH_KEY, 'hex')); return new WalletProvider(wallet, "https://rinkeby.infura.io/" + env.INFURA_TOKEN) }, network_id: 4 }, mainnet: { provider: function() { let WalletProvider = require("truffle-wallet-provider"); let wallet = require('ethereumjs-wallet').fromPrivateKey(Buffer.from(env.ETH_KEY, 'hex')); return new WalletProvider(wallet, "http://192.168.3.11:8555/") }, network_id: 1 }, rinkeby_localhost: { host: "localhost", // Connect to geth on the specified port: 8545, network_id: 4, gas: 4612388, gasPrice: 20000000000, from: "0xf17f52151EbEF6C7334FAD080c5704D77216b732" }, geth_dev: { host: "localhost", // Connect to geth on the specified port: 8545, network_id: 5777, gas: 4700000, gasPrice: 20000000000 }, bankexTestNetwork: { host: '172.16.17.32', port: 8535, network_id: 488412, gasPrice: 180000000000, from: "0xf17f52151EbEF6C7334FAD080c5704D77216b732" }, solc: { optimizer: { enabled: true, runs: 200 } }, migrations_directory: './migrations' } };
BANKEX/multi-token
<|start_filename|>include/luaodbc.h<|end_filename|> #ifdef _MSC_VER # pragma once #endif #ifndef _LUAODBC_H_25621A6F_D9AD_47EB_85DB_06AD52493CD7_ #define _LUAODBC_H_25621A6F_D9AD_47EB_85DB_06AD52493CD7_ #ifdef __cplusplus extern "C" { #endif #ifndef LODBC_EXPORT # if defined(_WIN32) # ifdef LUAODBC_EXPORTS # define LODBC_EXPORT __declspec(dllexport) extern # else # define LODBC_EXPORT __declspec(dllimport) extern # endif # else # define LODBC_EXPORT extern # endif #endif #define LODBC_VERSION_MAJOR 0 #define LODBC_VERSION_MINOR 3 #define LODBC_VERSION_PATCH 2 #define LODBC_VERSION_COMMENT "dev" LODBC_EXPORT const char *LODBC_ENV; LODBC_EXPORT const char *LODBC_CNN; LODBC_EXPORT const char *LODBC_STMT; #ifndef LODBC_USE_NULL_AS_NIL LODBC_EXPORT const int *LODBC_NULL; #endif LODBC_EXPORT void lodbc_version(int *major, int *minor, int *patch); LODBC_EXPORT unsigned int lodbc_odbcver(); LODBC_EXPORT int luaopen_lodbc (lua_State *L); LODBC_EXPORT int lodbc_environment(lua_State *L, SQLHENV henv, unsigned char own); LODBC_EXPORT int lodbc_connection(lua_State *L, SQLHDBC hdbc, unsigned char own); LODBC_EXPORT int lodbc_statement(lua_State *L, SQLHSTMT hstmt, unsigned char own); #ifdef __cplusplus } #endif #endif
helloj/lua-odbc
<|start_filename|>public/style.css<|end_filename|> body{ padding-top:80px; word-wrap:break-word; color: green; } img{ height: 200px; } main, header{ text-align: center; } .messages{ overflow-y: scroll; overflow-x: hidden; height: 230px; } .well{ overflow: hidden; height:230px; } #username{ font-weight: bold; } ul{ list-style: none; }
ehcodes/personal-auth
<|start_filename|>lib/enums/get_message_type_enum.dart<|end_filename|> /// 获得消息类型枚举 enum GetMessageTypeEnum { // 云端更老的消息 GetCloudOlderMsg, // 云端更新的消息 GetCloudNewerMsg, // 本地更老的消息 GetLocalOlderMsg, // 本地更新的消息 GetLocalNewerMsg, } /// 枚举工具 class GetMessageTypeTool { /// 根据Int类型值获得枚举 /// [index] Int常量 /// [Return] 枚举对象 static GetMessageTypeEnum getByInt(int index) => GetMessageTypeEnum.values[index - 1]; /// 将枚举转换为整型 static int toInt(GetMessageTypeEnum level) => level.index + 1; } <|start_filename|>android/src/main/java/top/huic/tencent_im_plugin/message/entity/SoundMessageEntity.java<|end_filename|> package top.huic.tencent_im_plugin.message.entity; import com.tencent.imsdk.v2.V2TIMSoundElem; import top.huic.tencent_im_plugin.enums.MessageNodeType; /** * 语音消息实体 * * @author 蒋具宏 */ public class SoundMessageEntity extends AbstractMessageEntity { /** * 语音ID */ private String uuid; /** * 路径 */ private String path; /** * 时长 */ private Integer duration; /** * 数据大小 */ private Integer dataSize; public SoundMessageEntity() { super(MessageNodeType.Sound); } public SoundMessageEntity(V2TIMSoundElem elem) { super(MessageNodeType.Sound); this.setPath(elem.getPath()); this.setDuration(elem.getDuration()); this.setDataSize(elem.getDataSize()); this.setUuid(elem.getUUID()); } public String getPath() { return path; } public void setPath(String path) { this.path = path; } public Integer getDuration() { return duration; } public void setDuration(Integer duration) { this.duration = duration; } public Integer getDataSize() { return dataSize; } public void setDataSize(Integer dataSize) { this.dataSize = dataSize; } public String getUuid() { return uuid; } public void setUuid(String uuid) { this.uuid = uuid; } } <|start_filename|>android/src/main/java/top/huic/tencent_im_plugin/message/GroupTipsMessageNode.java<|end_filename|> package top.huic.tencent_im_plugin.message; import com.tencent.imsdk.v2.V2TIMGroupTipsElem; import top.huic.tencent_im_plugin.message.entity.GroupTipsMessageEntity; /** * 群提示消息节点 */ public class GroupTipsMessageNode extends AbstractMessageNode<V2TIMGroupTipsElem, GroupTipsMessageEntity> { @Override public String getNote(V2TIMGroupTipsElem elem) { return "[群提示]"; } @Override public GroupTipsMessageEntity analysis(V2TIMGroupTipsElem elem) { return new GroupTipsMessageEntity(elem); } @Override public Class<GroupTipsMessageEntity> getEntityClass() { return GroupTipsMessageEntity.class; } } <|start_filename|>lib/entity/conversation_result_entity.dart<|end_filename|> import 'dart:convert'; import 'package:tencent_im_plugin/entity/conversation_entity.dart'; import 'package:tencent_im_plugin/list_util.dart'; /// 会话结果实体 class ConversationResultEntity { /// 下一次分页拉取的游标 late int nextSeq; /// 会话列表是否已经拉取完毕 late bool finished; /// 会话列表 late List<ConversationEntity> conversationList; ConversationResultEntity.fromJson(data) { Map<String, dynamic> json = data is Map ? data.cast<String, dynamic>() : jsonDecode(data); if (json['nextSeq'] != null) nextSeq = json['nextSeq']; if (json['finished'] != null) finished = json['finished']; if (json['conversationList'] != null) conversationList = ListUtil.generateOBJList<ConversationEntity>( json["conversationList"]); } } <|start_filename|>lib/enums/group_application_handler_status_enum.dart<|end_filename|> /// 群申请处理状态枚举 enum GroupApplicationHandlerStatusEnum { /// 未处理 Unhandled, /// 其他人处理 ByOther, /// 自己已处理 BySelf, } class GroupApplicationHandlerStatusTool { /// 根据Int类型值获得枚举 /// [index] Int常量 /// [Return] 枚举对象 static GroupApplicationHandlerStatusEnum getByInt(int index) => GroupApplicationHandlerStatusEnum.values[index]; /// 将枚举转换为整型 static int toInt(GroupApplicationHandlerStatusEnum level) => level.index; } <|start_filename|>lib/enums/group_tips_type_enum.dart<|end_filename|> /// 群组事件通知类型 enum GroupTipsTypeEnum { /// 非法 Invalid, /// 主动入群(memberList 加入群组,非 Work 群有效) Join, /// 被邀请入群(opMember 邀请 memberList 入群,Work 群有效) Invite, /// 退出群组 Quit, /// 踢出群 (opMember 把 memberList 踢出群组) Kicked, /// 设置管理员 (opMember 把 memberList 设置为管理员) Admin, /// 取消管理员 (opMember 取消 memberList 管理员身份) CancelAdmin, /// 群资料变更 (opMember 修改群资料:groupName & introduction & notification & faceUrl & owner & custom) GroupInfoChange, /// 群成员资料变更 (opMember 修改群成员资料:muteTime) MemberInfoChange, } /// 枚举工具 class GroupTipsTypeTool { /// 根据Int类型值获得枚举 /// [index] Int常量 /// [Return] 枚举对象 static GroupTipsTypeEnum getByInt(int index) => GroupTipsTypeEnum.values[index]; /// 将枚举转换为整型 static int toInt(GroupTipsTypeEnum data) => data.index; } <|start_filename|>lib/entity/group_receive_join_application_entity.dart<|end_filename|> import 'dart:convert'; import 'package:tencent_im_plugin/entity/group_member_entity.dart'; /// 群加入申请实体 class GroupReceiveJoinApplicationEntity { /// 群ID late String groupID; /// 群成员 GroupMemberEntity? member; /// 操作原因 String? opReason; GroupReceiveJoinApplicationEntity.fromJson(data) { Map<String, dynamic> json = data is Map ? data.cast<String, dynamic>() : jsonDecode(data); if (json['groupID'] != null) groupID = json['groupID']; if (json['opReason'] != null) opReason = json['opReason']; if (json["member"] != null) member = GroupMemberEntity.fromJson(json['member']); } } <|start_filename|>lib/entity/group_receive_rest_entity.dart<|end_filename|> import 'dart:convert'; /// 群接收到REST自定义信息通知实体 class GroupReceiveRESTEntity { /// 群ID late String groupID; /// 自定义数据 String? customData; GroupReceiveRESTEntity.fromJson(data) { Map<String, dynamic> json = data is Map ? data.cast<String, dynamic>() : jsonDecode(data); if (json['groupID'] != null) groupID = json['groupID']; if (json['customData'] != null) customData = json['customData']; } } <|start_filename|>lib/entity/group_at_info_entity.dart<|end_filename|> import 'dart:convert'; import 'package:tencent_im_plugin/enums/group_at_type_enum.dart'; /// 群@信息实体 class GroupAtInfoEntity { /// Seq序列号 int? seq; /// @类型 GroupAtTypeEnum? atType; GroupAtInfoEntity.fromJson(data) { Map<String, dynamic> json = data is Map ? data.cast<String, dynamic>() : jsonDecode(data); if (json['seq'] != null) seq = json["seq"]; if (json['atType'] != null) atType = GroupAtTypeTool.getByInt(json["atType"]); } } <|start_filename|>lib/entity/group_changed_entity.dart<|end_filename|> import 'dart:convert'; import 'package:tencent_im_plugin/enums/group_info_changed_type_enum.dart'; import 'package:tencent_im_plugin/list_util.dart'; /// 群改变通知实体 class GroupChangedEntity { /// 群ID late String groupID; /// 群改变信息实体 late List<GroupChangedInfoEntity> changInfo; GroupChangedEntity.fromJson(data) { Map<String, dynamic> json = data is Map ? data.cast<String, dynamic>() : jsonDecode(data); if (json['groupID'] != null) groupID = json['groupID']; if (json["changInfo"] != null) changInfo = ListUtil.generateOBJList<GroupChangedInfoEntity>(json['changInfo']); } } /// 群改变实体 class GroupChangedInfoEntity { /// 类型 late GroupInfoChangedTypeEnum type; /// Key String? key; /// Value String? value; GroupChangedInfoEntity.fromJson(data) { Map<String, dynamic> json = data is Map ? data.cast<String, dynamic>() : jsonDecode(data); if (json['type'] != null) type = GroupInfoChangedTypeTool.getByInt(json['type']); if (json['key'] != null) key = json['key']; if (json['value'] != null) value = json['value']; } } <|start_filename|>android/src/main/java/top/huic/tencent_im_plugin/message/entity/GroupTipsMessageEntity.java<|end_filename|> package top.huic.tencent_im_plugin.message.entity; import com.tencent.imsdk.v2.V2TIMGroupChangeInfo; import com.tencent.imsdk.v2.V2TIMGroupMemberChangeInfo; import com.tencent.imsdk.v2.V2TIMGroupMemberInfo; import com.tencent.imsdk.v2.V2TIMGroupTipsElem; import java.util.List; import top.huic.tencent_im_plugin.enums.MessageNodeType; /** * 群提示消息实体 * * @author 蒋具宏 */ public class GroupTipsMessageEntity extends AbstractMessageEntity { /** * 群ID */ private String groupID; /** * 群事件通知类型 */ private int type; /** * 操作用户 */ private V2TIMGroupMemberInfo opMember; /** * 被操作人列表 */ private List<V2TIMGroupMemberInfo> memberList; /** * 群资料变更信息列表,仅当tipsType值为V2TIMGroupTipsElem#V2TIM_GROUP_TIPS_TYPE_GROUP_INFO_CHANGE时有效 */ private List<V2TIMGroupChangeInfo> groupChangeInfoList ; /** * 获取群成员变更信息列表,仅当tipsType值为V2TIMGroupTipsElem#V2TIM_GROUP_TIPS_TYPE_MEMBER_INFO_CHANGE时有效 */ private List<V2TIMGroupMemberChangeInfo> memberChangeInfoList; /** * 当前群成员数,仅当tipsType值为V2TIMGroupTipsElem#V2TIM_GROUP_TIPS_TYPE_JOIN, V2TIMGroupTipsElem#V2TIM_GROUP_TIPS_TYPE_QUIT, V2TIMGroupTipsElem#V2TIM_GROUP_TIPS_TYPE_KICKED的时候有效 */ private int memberCount; public GroupTipsMessageEntity() { super(MessageNodeType.GroupTips); } public GroupTipsMessageEntity(V2TIMGroupTipsElem elem){ super(MessageNodeType.GroupTips); this.groupID = elem.getGroupID(); this.type = elem.getType(); this.opMember = elem.getOpMember(); this.memberList = elem.getMemberList(); this.groupChangeInfoList = elem.getGroupChangeInfoList(); this.memberChangeInfoList = elem.getMemberChangeInfoList(); this.memberCount = elem.getMemberCount(); } public String getGroupID() { return groupID; } public void setGroupID(String groupID) { this.groupID = groupID; } public int getType() { return type; } public void setType(int type) { this.type = type; } public V2TIMGroupMemberInfo getOpMember() { return opMember; } public void setOpMember(V2TIMGroupMemberInfo opMember) { this.opMember = opMember; } public List<V2TIMGroupMemberInfo> getMemberList() { return memberList; } public void setMemberList(List<V2TIMGroupMemberInfo> memberList) { this.memberList = memberList; } public List<V2TIMGroupChangeInfo> getGroupChangeInfoList() { return groupChangeInfoList; } public void setGroupChangeInfoList(List<V2TIMGroupChangeInfo> groupChangeInfoList) { this.groupChangeInfoList = groupChangeInfoList; } public List<V2TIMGroupMemberChangeInfo> getMemberChangeInfoList() { return memberChangeInfoList; } public void setMemberChangeInfoList(List<V2TIMGroupMemberChangeInfo> memberChangeInfoList) { this.memberChangeInfoList = memberChangeInfoList; } public int getMemberCount() { return memberCount; } public void setMemberCount(int memberCount) { this.memberCount = memberCount; } } <|start_filename|>lib/enums/friend_relation_type_enum.dart<|end_filename|> /// 好友关系枚举 enum FriendRelationTypeEnum { // 不是好友 None, // 在我的好友列表 MyFriendList, // 我在对方好友列表 OtherFriendList, // 互为好友 BothWay, } /// 枚举工具 class FriendRelationTypeTool { /// 根据Int类型值获得枚举 /// [index] Int常量 /// [Return] 枚举对象 static FriendRelationTypeEnum getByInt(int index) => FriendRelationTypeEnum.values[index]; /// 将枚举转换为整型 static int toInt(FriendRelationTypeEnum level) => level.index; } <|start_filename|>example/lib/utils/GenerateTestUserSig.dart<|end_filename|> library generate_test_im_usersig; import 'dart:convert'; import 'dart:io'; import 'package:crypto/crypto.dart'; import 'package:flutter/material.dart'; ///生成腾讯云即时通信测试用userSig /// class GenerateTestUserSig { GenerateTestUserSig({@required this.sdkappid, @required this.key}); int sdkappid; String key; ///生成UserSig String genSig({ @required String identifier, @required int expire, List<int> userBuf, }) { int currTime = _getCurrentTime(); String sig = ''; Map<String, dynamic> sigDoc = new Map<String, dynamic>(); sigDoc.addAll({ "TLS.ver": "2.0", "TLS.identifier": identifier, "TLS.sdkappid": this.sdkappid, "TLS.expire": expire, "TLS.time": currTime, }); sig = _hmacsha256( identifier: identifier, currTime: currTime, expire: expire, ); sigDoc['TLS.sig'] = sig; String jsonStr = json.encode(sigDoc); List<int> compress = zlib.encode(utf8.encode(jsonStr)); return _escape(content: base64.encode(compress)); } int _getCurrentTime() { return (new DateTime.now().millisecondsSinceEpoch / 1000).floor(); } String _hmacsha256({ @required String identifier, @required int currTime, @required int expire, }) { int sdkappid = this.sdkappid; String contentToBeSigned = "TLS.identifier:$identifier\nTLS.sdkappid:$sdkappid\nTLS.time:$currTime\nTLS.expire:$expire\n"; Hmac hmacSha256 = new Hmac(sha256, utf8.encode(this.key)); Digest hmacSha256Digest = hmacSha256.convert(utf8.encode(contentToBeSigned)); return base64.encode(hmacSha256Digest.bytes); } String _escape({ @required String content, }) { return content .replaceAll('\+', '*') .replaceAll('\/', '-') .replaceAll('=', '_'); } } <|start_filename|>lib/entity/download_progress_entity.dart<|end_filename|> import 'dart:convert'; import 'package:tencent_im_plugin/enums/download_type_enum.dart'; /// 下载进度实体 class DownloadProgressEntity { /// 消息ID late String msgId; /// 当前下载大小 late int currentSize; /// 总大小 late int totalSize; /// 下载类型 late DownloadTypeEnum type; DownloadProgressEntity.fromJson(data) { Map<String, dynamic> json = data is Map ? data.cast<String, dynamic>() : jsonDecode(data); if (json['msgId'] != null) msgId = json["msgId"]; if (json['currentSize'] != null) currentSize = json["currentSize"]; if (json['totalSize'] != null) totalSize = json["totalSize"]; if (json['type'] != null) type = DownloadTypeTool.getByInt(json["type"]); } } <|start_filename|>lib/entity/group_application_entity.dart<|end_filename|> import 'dart:convert'; import 'package:tencent_im_plugin/enums/group_application_handler_result_enum.dart'; import 'package:tencent_im_plugin/enums/group_application_handler_status_enum.dart'; import 'package:tencent_im_plugin/enums/group_application_type_enum.dart'; /// 群申请实体 class GroupApplicationEntity { /// 群ID late String groupID; /// 获取请求者 ID,请求加群:请求者,邀请加群:邀请人 late String fromUser; /// 用户昵称 String? fromUserNickName; /// 用户头像 String? fromUserFaceUrl; /// 获取处理者 ID, 请求加群:0,邀请加群:被邀请人 String? toUser; /// 获取群未决添加的时间,单位:秒 late int addTime; /// 获取请求者添加的附加信息 String? requestMsg; /// 获取处理者添加的附加信息,只有处理状态不为V2TIMGroupApplication#V2TIM_GROUP_APPLICATION_HANDLE_STATUS_UNHANDLED的时候有效 String? handledMsg; /// 获取群未决请求类型 late GroupApplicationTypeEnum type; /// 获取群未决处理状态 GroupApplicationHandlerStatusEnum? handleStatus; /// 获取群未决处理操作类型,只有处理状态不为V2TIMGroupApplication#V2TIM_GROUP_APPLICATION_HANDLE_STATUS_UNHANDLED的时候有效 GroupApplicationHandlerResultEnum? handleResult; GroupApplicationEntity.fromJson(data) { Map<String, dynamic> json = data is Map ? data.cast<String, dynamic>() : jsonDecode(data); if (json['groupID'] != null) groupID = json['groupID']; if (json['fromUser'] != null) fromUser = json['fromUser']; if (json['fromUserNickName'] != null) fromUserNickName = json['fromUserNickName']; if (json['fromUserFaceUrl'] != null) fromUserFaceUrl = json['fromUserFaceUrl']; if (json['toUser'] != null) toUser = json['toUser']; if (json['addTime'] != null) addTime = json['addTime']; if (json['requestMsg'] != null) requestMsg = json['requestMsg']; if (json['handledMsg'] != null) handledMsg = json['handledMsg']; if (json['type'] != null) type = GroupApplicationTypeTool.getByInt(json['type']); if (json['handleStatus'] != null) handleStatus = GroupApplicationHandlerStatusTool.getByInt(json['handleStatus']); if (json['handleResult'] != null) handleResult = GroupApplicationHandlerResultTool.getByInt(json['handleResult']); } } <|start_filename|>lib/entity/group_application_processed_entity.dart<|end_filename|> import 'dart:convert'; import 'package:tencent_im_plugin/entity/group_member_entity.dart'; /// 群申请处理 class GroupApplicationProcessedEntity { /// 群ID late String groupID; /// 操作用户 GroupMemberEntity? opUser; /// 操作原因 String? opReason; /// 是否同意加入 bool? isAgreeJoin; GroupApplicationProcessedEntity.fromJson(data) { Map<String, dynamic> json = data is Map ? data.cast<String, dynamic>() : jsonDecode(data); if (json['groupID'] != null) groupID = json['groupID']; if (json['opReason'] != null) opReason = json['opReason']; if (json['isAgreeJoin'] != null) isAgreeJoin = json['isAgreeJoin']; if (json["opUser"] != null) opUser = GroupMemberEntity.fromJson(json['opUser']); } } <|start_filename|>android/src/main/java/top/huic/tencent_im_plugin/listener/CustomFriendshipListener.java<|end_filename|> package top.huic.tencent_im_plugin.listener; import com.tencent.imsdk.v2.V2TIMFriendApplication; import com.tencent.imsdk.v2.V2TIMFriendInfo; import com.tencent.imsdk.v2.V2TIMFriendshipListener; import java.util.List; import top.huic.tencent_im_plugin.TencentImPlugin; import top.huic.tencent_im_plugin.enums.ListenerTypeEnum; /** * 自定义关系链监听器 */ public class CustomFriendshipListener extends V2TIMFriendshipListener { /** * 好友申请新增通知,两种情况会收到这个回调: * <p> * 自己申请加别人好友 * 别人申请加自己好友 */ @Override public void onFriendApplicationListAdded(List<V2TIMFriendApplication> applicationList) { super.onFriendApplicationListAdded(applicationList); TencentImPlugin.invokeListener(ListenerTypeEnum.FriendApplicationListAdded, applicationList); } /** * 好友申请删除通知,四种情况会收到这个回调 * <p> * 调用 deleteFriendApplication 主动删除好友申请 * 调用 refuseFriendApplication 拒绝好友申请 * 调用 acceptFriendApplication 同意好友申请且同意类型为 V2TIM_FRIEND_ACCEPT_AGREE 时 * 申请加别人好友被拒绝 */ @Override public void onFriendApplicationListDeleted(List<String> userIDList) { super.onFriendApplicationListDeleted(userIDList); TencentImPlugin.invokeListener(ListenerTypeEnum.FriendApplicationListDeleted, userIDList); } /** * 好友申请已读通知,如果调用 setFriendApplicationRead 设置好友申请列表已读,会收到这个回调(主要用于多端同步) */ @Override public void onFriendApplicationListRead() { super.onFriendApplicationListRead(); TencentImPlugin.invokeListener(ListenerTypeEnum.FriendApplicationListRead, null); } /** * 好友新增通知 */ @Override public void onFriendListAdded(List<V2TIMFriendInfo> users) { super.onFriendListAdded(users); TencentImPlugin.invokeListener(ListenerTypeEnum.FriendListAdded, users); } /** * 好友删除通知,,两种情况会收到这个回调: * <p> * 自己删除好友(单向和双向删除都会收到回调) * 好友把自己删除(双向删除会收到) */ @Override public void onFriendListDeleted(List<String> userList) { super.onFriendListDeleted(userList); TencentImPlugin.invokeListener(ListenerTypeEnum.FriendListDeleted, userList); } /** * 黑名单新增通知 */ @Override public void onBlackListAdd(List<V2TIMFriendInfo> infoList) { super.onBlackListAdd(infoList); TencentImPlugin.invokeListener(ListenerTypeEnum.BlackListAdd, infoList); } /** * 黑名单删除通知 */ @Override public void onBlackListDeleted(List<String> userList) { super.onBlackListDeleted(userList); TencentImPlugin.invokeListener(ListenerTypeEnum.BlackListDeleted, userList); } /** * 好友资料更新通知 */ @Override public void onFriendInfoChanged(List<V2TIMFriendInfo> infoList) { super.onFriendInfoChanged(infoList); TencentImPlugin.invokeListener(ListenerTypeEnum.FriendInfoChanged, infoList); } } <|start_filename|>lib/message_node/location_message_node.dart<|end_filename|> import 'package:tencent_im_plugin/enums/message_elem_type_enum.dart'; import 'package:tencent_im_plugin/message_node/message_node.dart'; /// 位置节点 class LocationMessageNode extends MessageNode { /// 位置描述 late String desc; /// 经度 late double longitude; /// 纬度 late double latitude; LocationMessageNode({ required this.desc, required this.longitude, required this.latitude, }) : super(MessageElemTypeEnum.Location); LocationMessageNode.fromJson(Map<String, dynamic> json) : super(MessageElemTypeEnum.Location) { if (json['desc'] != null) desc = json['desc']; if (json['longitude'] != null) longitude = json['longitude']; if (json['latitude'] != null) latitude = json['latitude']; } @override Map<String, dynamic> toJson() { final Map<String, dynamic> data = super.toJson(); data["desc"] = this.desc; data["longitude"] = this.longitude; data["latitude"] = this.latitude; return data; } } <|start_filename|>lib/message_node/face_message_node.dart<|end_filename|> import 'package:tencent_im_plugin/enums/message_elem_type_enum.dart'; import 'package:tencent_im_plugin/message_node/message_node.dart'; /// 表情消息节点 class FaceMessageNode extends MessageNode { /// 索引 late int index; /// 数据 late String data; FaceMessageNode({ required this.index, required this.data, }) : super(MessageElemTypeEnum.Face); FaceMessageNode.fromJson(Map<String, dynamic> json) : super(MessageElemTypeEnum.Face) { if (json['index'] != null) this.index = json["index"]; if (json['data'] != null) this.data = json["data"]; } @override Map<String, dynamic> toJson() { final Map<String, dynamic> data = super.toJson(); data["index"] = this.index; data["data"] = this.data; return data; } } <|start_filename|>android/src/main/java/top/huic/tencent_im_plugin/enums/ListenerTypeEnum.java<|end_filename|> package top.huic.tencent_im_plugin.enums; /** * 监听器类型枚举 */ public enum ListenerTypeEnum { /** * 新消息通知 */ NewMessage, /** * C2C已读回执 */ C2CReadReceipt, /** * 消息撤回 */ MessageRevoked, /** * 同步服务开始 */ SyncServerStart, /** * 同步服务完成 */ SyncServerFinish, /** * 同步服务失败 */ SyncServerFailed, /** * 新会话 */ NewConversation, /** * 会话刷新 */ ConversationChanged, /** * 好友申请新增通知 */ FriendApplicationListAdded, /** * 好友申请删除通知 */ FriendApplicationListDeleted, /** * 好友申请已读通知 */ FriendApplicationListRead, /** * 好友新增通知 */ FriendListAdded, /** * 好友删除通知 */ FriendListDeleted, /** * 黑名单新增通知 */ BlackListAdd, /** * 黑名单删除通知 */ BlackListDeleted, /** * 好友资料更新通知 */ FriendInfoChanged, /** * 有用户加入群 */ MemberEnter, /** * 有用户离开群 */ MemberLeave, /** * 有用户被拉入群 */ MemberInvited, /** * 有用户被踢出群 */ MemberKicked, /** * 群成员信息被修改 */ MemberInfoChanged, /** * 创建群 */ GroupCreated, /** * 群被解散 */ GroupDismissed, /** * 群被回收 */ GroupRecycled, /** * 群信息被修改 */ GroupInfoChanged, /** * 有新的加群申请 */ ReceiveJoinApplication, /** * 加群信息已被管理员处理 */ ApplicationProcessed, /** * 指定管理员身份 */ GrantAdministrator, /** * 取消管理员身份 */ RevokeAdministrator, /** * 主动退出群组 */ QuitFromGroup, /** * 收到 RESTAPI 下发的自定义系统消息 */ ReceiveRESTCustomData, /** * 收到群属性更新的回调 */ GroupAttributeChanged, /** * 正在连接到腾讯云服务器 */ Connecting, /** * 网络连接成功 */ ConnectSuccess, /** * 网络连接失败 */ ConnectFailed, /** * 踢下线 */ KickedOffline, /** * 当前用户的资料发生了更新 */ SelfInfoUpdated, /** * 用户登录的 userSig 过期(用户需要重新获取 userSig 后登录) */ UserSigExpired, /** * 收到信令邀请 */ ReceiveNewInvitation, /** * 信令被邀请者接受邀请 */ InviteeAccepted, /** * 信令被邀请者拒绝邀请 */ InviteeRejected, /** * 信令邀请被取消 */ InvitationCancelled, /** * 信令邀请超时 */ InvitationTimeout, /** * 下载进度 */ DownloadProgress, /** * 消息发送成功 */ MessageSendSucc, /** * 消息发送失败 */ MessageSendFail, /** * 消息发送进度更新 */ MessageSendProgress, } <|start_filename|>lib/message_node/image_message_node.dart<|end_filename|> import 'dart:convert'; import 'package:tencent_im_plugin/enums/image_type_enum.dart'; import 'package:tencent_im_plugin/enums/message_elem_type_enum.dart'; import 'package:tencent_im_plugin/message_node/message_node.dart'; /// 图片消息节点 class ImageMessageNode extends MessageNode { /// 图片路径 String? path; /// 图片列表,根据类型分开 Map<ImageTypeEnum, ImageEntity>? _imageData; ImageMessageNode({ required this.path, }) : super(MessageElemTypeEnum.Image); ImageMessageNode.fromJson(Map<String, dynamic> json) : super(MessageElemTypeEnum.Image) { if (json['path'] != null) path = json['path']; if (json['imageData'] != null) { _imageData = Map(); (json['imageData'] as List).forEach((v) { ImageEntity imageEntity = ImageEntity.fromJson(v); _imageData![imageEntity.type!] = imageEntity; }); } } /// 获得图片列表 Map<ImageTypeEnum, ImageEntity>? get imageData => _imageData; @override Map<String, dynamic> toJson() { final Map<String, dynamic> data = super.toJson(); data["path"] = this.path; return data; } } /// 图片实体 class ImageEntity { /// 大小 int? size; /// 宽度 int? width; /// 类型 ImageTypeEnum? type; /// uuid String? uuid; /// url String? url; /// 高度 int? height; ImageEntity({ this.size, this.width, this.type, this.uuid, this.url, this.height, }); ImageEntity.fromJson(data) { Map<String, dynamic> json = data is Map ? data.cast<String, dynamic>() : jsonDecode(data); if (json['size'] != null) size = json['size']; if (json['width'] != null) width = json['width']; if (json['type'] != null) type = ImageTypeTool.getByInt(json["type"]); if (json['uUID'] != null) uuid = json['uUID']; if (json['url'] != null) url = json['url']; if (json['height'] != null) height = json['height']; } } <|start_filename|>android/src/main/java/top/huic/tencent_im_plugin/listener/CustomConversationListener.java<|end_filename|> package top.huic.tencent_im_plugin.listener; import com.tencent.imsdk.v2.V2TIMConversation; import com.tencent.imsdk.v2.V2TIMConversationListener; import java.util.ArrayList; import java.util.List; import top.huic.tencent_im_plugin.TencentImPlugin; import top.huic.tencent_im_plugin.entity.CustomConversationEntity; import top.huic.tencent_im_plugin.enums.ListenerTypeEnum; /** * 自定义会话监听 */ public class CustomConversationListener extends V2TIMConversationListener { /** * 同步服务开始 */ @Override public void onSyncServerStart() { super.onSyncServerStart(); TencentImPlugin.invokeListener(ListenerTypeEnum.SyncServerStart, null); } /** * 同步服务完成 */ @Override public void onSyncServerFinish() { super.onSyncServerFinish(); TencentImPlugin.invokeListener(ListenerTypeEnum.SyncServerFinish, null); } /** * 同步服务失败 */ @Override public void onSyncServerFailed() { super.onSyncServerFailed(); TencentImPlugin.invokeListener(ListenerTypeEnum.SyncServerFailed, null); } /** * 新会话 */ @Override public void onNewConversation(List<V2TIMConversation> conversationList) { super.onNewConversation(conversationList); List<CustomConversationEntity> data = new ArrayList<>(conversationList.size()); for (V2TIMConversation v2TIMConversation : conversationList) { data.add(new CustomConversationEntity(v2TIMConversation)); } TencentImPlugin.invokeListener(ListenerTypeEnum.NewConversation, data); } /** * 会话刷新 */ @Override public void onConversationChanged(List<V2TIMConversation> conversationList) { super.onConversationChanged(conversationList); List<CustomConversationEntity> data = new ArrayList<>(conversationList.size()); for (V2TIMConversation v2TIMConversation : conversationList) { data.add(new CustomConversationEntity(v2TIMConversation)); } TencentImPlugin.invokeListener(ListenerTypeEnum.ConversationChanged, data); } } <|start_filename|>lib/entity/friend_info_result_entity.dart<|end_filename|> import 'dart:convert'; import 'package:tencent_im_plugin/entity/friend_info_entity.dart'; import 'package:tencent_im_plugin/enums/friend_relation_type_enum.dart'; /// 好友信息结果实体 class FriendInfoResultEntity { /// 结果码 late int resultCode; /// 结果信息` String? resultInfo; /// 好友类型 FriendRelationTypeEnum? relation; /// 好友信息 FriendInfoEntity? friendInfo; FriendInfoResultEntity.fromJson(data) { Map<String, dynamic> json = data is Map ? data.cast<String, dynamic>() : jsonDecode(data); if (json['resultCode'] != null) resultCode = json['resultCode']; if (json['resultInfo'] != null) resultInfo = json['resultInfo']; if (json['relation'] != null) relation = FriendRelationTypeTool.getByInt(json['relation']); if (json['friendInfo'] != null) friendInfo = FriendInfoEntity.fromJson(json['friendInfo']); } } <|start_filename|>lib/entity/message_send_fail_entity.dart<|end_filename|> import 'dart:convert'; /// 消息发送失败实体 class MessageSendFailEntity { /// 消息ID late String msgId; /// 错误码 late int code; /// 错误描述 String? desc; MessageSendFailEntity.fromJson(data) { Map<String, dynamic> json = data is Map ? data.cast<String, dynamic>() : jsonDecode(data); if (json['msgId'] != null) msgId = json["msgId"]; if (json['code'] != null) code = json["code"]; if (json['desc'] != null) desc = json["desc"]; } } <|start_filename|>lib/enums/download_type_enum.dart<|end_filename|> /// 下载类型枚举 enum DownloadTypeEnum { /// 语音 Sound, /// 视频 Video, /// 视频缩略图 VideoThumbnail, /// 文件对象 File, } class DownloadTypeTool { /// 根据Int类型值获得枚举 /// [index] Int常量 /// [Return] 枚举对象 static DownloadTypeEnum getByInt(int index) => DownloadTypeEnum.values[index]; /// 将枚举转换为整型 static int toInt(DownloadTypeEnum level) => level.index; } <|start_filename|>lib/entity/group_info_result_entity.dart<|end_filename|> import 'dart:convert'; import 'package:tencent_im_plugin/entity/group_info_entity.dart'; /// 群信息结果实体 class GroupInfoResultEntity { /// 返回码,0代表成功,非零代表失败 late int resultCode; /// 返回消息描述 String? resultMessage; /// 群信息 GroupInfoEntity? groupInfo; GroupInfoResultEntity.fromJson(data) { Map<String, dynamic> json = data is Map ? data.cast<String, dynamic>() : jsonDecode(data); if (json['resultCode'] != null) resultCode = json['resultCode']; if (json['resultMessage'] != null) resultMessage = json['resultMessage']; if (json['groupInfo'] != null) groupInfo = GroupInfoEntity.fromJson(json['groupInfo']); } } <|start_filename|>lib/message_node/sound_message_node.dart<|end_filename|> import 'package:tencent_im_plugin/enums/message_elem_type_enum.dart'; import 'package:tencent_im_plugin/message_node/message_node.dart'; /// 语音消息节点 class SoundMessageNode extends MessageNode { /// 语音ID String? _uuid; /// 路径 String? path; /// 时长 late int duration; /// 数据大小 int? _dataSize; SoundMessageNode({ required this.path, required this.duration, }) : super(MessageElemTypeEnum.Sound); SoundMessageNode.fromJson(Map<String, dynamic> json) : super(MessageElemTypeEnum.Sound) { if (json['uuid'] != null) _uuid = json['uuid']; if (json['path'] != null) path = json['path']; if (json['duration'] != null) duration = json['duration']; if (json['dataSize'] != null) _dataSize = json['dataSize']; } /// 获得语音ID String? get uuid => _uuid; /// 获得数据大小 int? get dataSize => _dataSize; @override Map<String, dynamic> toJson() { final Map<String, dynamic> data = super.toJson(); data["path"] = this.path; data["duration"] = this.duration; return data; } } <|start_filename|>lib/entity/group_member_changed_entity.dart<|end_filename|> import 'dart:convert'; import 'package:tencent_im_plugin/list_util.dart'; /// 群成员改变通知实体 class GroupMemberChangedEntity { /// 群ID late String groupID; /// 群成员列表 late List<GroupMemberChangedInfoEntity> changInfo; GroupMemberChangedEntity.fromJson(data) { Map<String, dynamic> json = data is Map ? data.cast<String, dynamic>() : jsonDecode(data); if (json['groupID'] != null) groupID = json['groupID']; if (json["changInfo"] != null) changInfo = ListUtil.generateOBJList<GroupMemberChangedInfoEntity>( json['changInfo']); } } /// 群成员改变信息实体 class GroupMemberChangedInfoEntity { /// 用户ID late String userID; /// 禁言时长 late int muteTime; GroupMemberChangedInfoEntity.fromJson(data) { Map<String, dynamic> json = data is Map ? data.cast<String, dynamic>() : jsonDecode(data); if (json['userID'] != null) userID = json['userID']; if (json['muteTime'] != null) muteTime = json['muteTime']; } } <|start_filename|>android/src/main/java/top/huic/tencent_im_plugin/entity/FindGroupApplicationEntity.java<|end_filename|> package top.huic.tencent_im_plugin.entity; /** * 查找群申请实体 */ public class FindGroupApplicationEntity { /** * 来自用户 */ String fromUser; /** * 群ID */ String groupID; public String getFromUser() { return fromUser; } public void setFromUser(String fromUser) { this.fromUser = fromUser; } public String getGroupID() { return groupID; } public void setGroupID(String groupID) { this.groupID = groupID; } } <|start_filename|>lib/enums/login_status_enum.dart<|end_filename|> /// 登录状态枚举 enum LoginStatusEnum { // 已登录 Logined, // 登录中 Logining, // 未登录 Logout, } class LoginStatusTool { /// 根据Int类型值获得枚举 /// [index] Int常量 /// [Return] 枚举对象 static LoginStatusEnum getByInt(int index) => LoginStatusEnum.values[index - 1]; } <|start_filename|>android/src/main/java/top/huic/tencent_im_plugin/entity/FindFriendApplicationEntity.java<|end_filename|> package top.huic.tencent_im_plugin.entity; /** * 查找好友申请实体 */ public class FindFriendApplicationEntity { /** * 用户ID */ String userID; /** * 类型 */ int type; public String getUserID() { return userID; } public void setUserID(String userID) { this.userID = userID; } public int getType() { return type; } public void setType(int type) { this.type = type; } } <|start_filename|>lib/entity/group_administrator_op_entity.dart<|end_filename|> import 'dart:convert'; import 'package:tencent_im_plugin/entity/group_member_entity.dart'; import 'package:tencent_im_plugin/list_util.dart'; /// 群管理员操作通知实体 class GroupAdministratorOpEntity { /// 群ID late String groupID; /// 群成员列表 List<GroupMemberEntity>? changInfo; /// 操作用户 GroupMemberEntity? opUser; GroupAdministratorOpEntity.fromJson(data) { Map<String, dynamic> json = data is Map ? data.cast<String, dynamic>() : jsonDecode(data); if (json['groupID'] != null) groupID = json['groupID']; if (json["changInfo"] != null) changInfo = ListUtil.generateOBJList<GroupMemberEntity>(json['changInfo']); if (json["opUser"] != null) opUser = GroupMemberEntity.fromJson(json["opUser"]); } } <|start_filename|>lib/listener/tencent_im_plugin_listener.dart<|end_filename|> import 'dart:convert'; import 'package:flutter/services.dart'; import 'package:logger/logger.dart'; import 'package:tencent_im_plugin/entity/conversation_entity.dart'; import 'package:tencent_im_plugin/entity/download_progress_entity.dart'; import 'package:tencent_im_plugin/entity/error_entity.dart'; import 'package:tencent_im_plugin/entity/friend_application_entity.dart'; import 'package:tencent_im_plugin/entity/friend_info_entity.dart'; import 'package:tencent_im_plugin/entity/group_administrator_op_entity.dart'; import 'package:tencent_im_plugin/entity/group_application_processed_entity.dart'; import 'package:tencent_im_plugin/entity/group_attribute_changed_entity.dart'; import 'package:tencent_im_plugin/entity/group_changed_entity.dart'; import 'package:tencent_im_plugin/entity/group_dismissed_or_recycled_entity.dart'; import 'package:tencent_im_plugin/entity/group_member_changed_entity.dart'; import 'package:tencent_im_plugin/entity/group_member_enter_entity.dart'; import 'package:tencent_im_plugin/entity/group_member_invited_or_kicked_entity.dart'; import 'package:tencent_im_plugin/entity/group_member_leave_entity.dart'; import 'package:tencent_im_plugin/entity/group_receive_join_application_entity.dart'; import 'package:tencent_im_plugin/entity/group_receive_rest_entity.dart'; import 'package:tencent_im_plugin/entity/message_entity.dart'; import 'package:tencent_im_plugin/entity/message_receipt_entity.dart'; import 'package:tencent_im_plugin/entity/message_send_fail_entity.dart'; import 'package:tencent_im_plugin/entity/message_send_progress_entity.dart'; import 'package:tencent_im_plugin/entity/signaling_common_entity.dart'; import 'package:tencent_im_plugin/entity/user_entity.dart'; import 'package:tencent_im_plugin/enums/tencent_im_listener_type_enum.dart'; import 'package:tencent_im_plugin/list_util.dart'; import 'package:tencent_im_plugin/utils/enum_util.dart'; /// 监听器对象 class TencentImPluginListener { /// 日志对象 static Logger _logger = Logger(); /// 监听器列表 static Set<TencentImListenerValue> listeners = Set(); TencentImPluginListener(MethodChannel channel) { // 绑定监听器 channel.setMethodCallHandler((methodCall) async { // 解析参数 Map<String, dynamic> arguments = jsonDecode(methodCall.arguments); switch (methodCall.method) { case 'onListener': // 获得原始类型和参数 TencentImListenerTypeEnum type = EnumUtil.nameOf( TencentImListenerTypeEnum.values, arguments['type'])!; var originalParams = arguments['params']; // 封装回调类型和参数 var params = originalParams; try { switch (type) { case TencentImListenerTypeEnum.NewMessage: params = MessageEntity.fromJson(originalParams); break; case TencentImListenerTypeEnum.C2CReadReceipt: params = ListUtil.generateOBJList<MessageReceiptEntity>( originalParams); break; case TencentImListenerTypeEnum.MessageRevoked: params = originalParams; break; case TencentImListenerTypeEnum.SyncServerStart: break; case TencentImListenerTypeEnum.SyncServerFinish: break; case TencentImListenerTypeEnum.SyncServerFailed: break; case TencentImListenerTypeEnum.NewConversation: params = ListUtil.generateOBJList<ConversationEntity>( originalParams); break; case TencentImListenerTypeEnum.ConversationChanged: params = ListUtil.generateOBJList<ConversationEntity>( originalParams); break; case TencentImListenerTypeEnum.FriendApplicationListAdded: params = ListUtil.generateOBJList<FriendApplicationEntity>( originalParams); break; case TencentImListenerTypeEnum.FriendApplicationListDeleted: break; case TencentImListenerTypeEnum.FriendApplicationListRead: break; case TencentImListenerTypeEnum.FriendListAdded: params = ListUtil.generateOBJList<FriendInfoEntity>(originalParams); break; case TencentImListenerTypeEnum.FriendListDeleted: break; case TencentImListenerTypeEnum.BlackListAdd: params = ListUtil.generateOBJList<FriendInfoEntity>(originalParams); break; case TencentImListenerTypeEnum.BlackListDeleted: break; case TencentImListenerTypeEnum.FriendInfoChanged: params = ListUtil.generateOBJList<FriendInfoEntity>(originalParams); break; case TencentImListenerTypeEnum.MemberEnter: params = GroupMemberEnterEntity.fromJson(originalParams); break; case TencentImListenerTypeEnum.MemberLeave: params = GroupMemberLeaveEntity.fromJson(originalParams); break; case TencentImListenerTypeEnum.MemberInvited: params = GroupMemberInvitedOrKickedEntity.fromJson(originalParams); break; case TencentImListenerTypeEnum.MemberKicked: params = GroupMemberInvitedOrKickedEntity.fromJson(originalParams); break; case TencentImListenerTypeEnum.MemberInfoChanged: params = GroupMemberChangedEntity.fromJson(originalParams); break; case TencentImListenerTypeEnum.GroupCreated: break; case TencentImListenerTypeEnum.GroupDismissed: params = GroupDismissedOrRecycledEntity.fromJson(originalParams); break; case TencentImListenerTypeEnum.GroupRecycled: params = GroupDismissedOrRecycledEntity.fromJson(originalParams); break; case TencentImListenerTypeEnum.GroupInfoChanged: params = GroupChangedEntity.fromJson(originalParams); break; case TencentImListenerTypeEnum.ReceiveJoinApplication: params = GroupReceiveJoinApplicationEntity.fromJson(originalParams); break; case TencentImListenerTypeEnum.ApplicationProcessed: params = GroupApplicationProcessedEntity.fromJson(originalParams); break; case TencentImListenerTypeEnum.GrantAdministrator: params = GroupAdministratorOpEntity.fromJson(originalParams); break; case TencentImListenerTypeEnum.RevokeAdministrator: params = GroupAdministratorOpEntity.fromJson(originalParams); break; case TencentImListenerTypeEnum.QuitFromGroup: break; case TencentImListenerTypeEnum.ReceiveRESTCustomData: params = GroupReceiveRESTEntity.fromJson(originalParams); break; case TencentImListenerTypeEnum.GroupAttributeChanged: params = GroupAttributeChangedEntity.fromJson(originalParams); break; case TencentImListenerTypeEnum.Connecting: break; case TencentImListenerTypeEnum.ConnectSuccess: break; case TencentImListenerTypeEnum.ConnectFailed: params = ErrorEntity.fromJson(originalParams); break; case TencentImListenerTypeEnum.KickedOffline: break; case TencentImListenerTypeEnum.SelfInfoUpdated: params = UserEntity.fromJson(originalParams); break; case TencentImListenerTypeEnum.UserSigExpired: break; case TencentImListenerTypeEnum.ReceiveNewInvitation: params = SignalingCommonEntity.fromJson(originalParams); break; case TencentImListenerTypeEnum.InviteeAccepted: params = SignalingCommonEntity.fromJson(originalParams); break; case TencentImListenerTypeEnum.InviteeRejected: params = SignalingCommonEntity.fromJson(originalParams); break; case TencentImListenerTypeEnum.InvitationCancelled: params = SignalingCommonEntity.fromJson(originalParams); break; case TencentImListenerTypeEnum.InvitationTimeout: params = SignalingCommonEntity.fromJson(originalParams); break; case TencentImListenerTypeEnum.DownloadProgress: params = DownloadProgressEntity.fromJson(originalParams); break; case TencentImListenerTypeEnum.MessageSendSucc: params = MessageEntity.fromJson(originalParams); break; case TencentImListenerTypeEnum.MessageSendFail: params = MessageSendFailEntity.fromJson(originalParams); break; case TencentImListenerTypeEnum.MessageSendProgress: params = MessageSendProgressEntity.fromJson(originalParams); break; } } catch (err) { _logger.e(err, "$type 监听器错误:$err,请联系开发者进行处理!Github Issues: https://github.com/JiangJuHong/FlutterTencentImPlugin/issues"); } // 回调触发 for (var item in listeners) { item(type, params); } break; default: throw MissingPluginException(); } }); } /// 添加消息监听 void addListener(TencentImListenerValue func) { listeners.add(func); } /// 移除消息监听 void removeListener(TencentImListenerValue func) { listeners.remove(func); } } /// 监听器值模型 typedef TencentImListenerValue<P> = void Function( TencentImListenerTypeEnum type, P? params); <|start_filename|>lib/entity/error_entity.dart<|end_filename|> import 'dart:convert'; /// 错误实体 class ErrorEntity { /// 错误码 late int code; /// 错误描述 String? error; ErrorEntity.fromJson(data) { Map<String, dynamic> json = data is Map ? data.cast<String, dynamic>() : jsonDecode(data); if (json['code'] != null) code = json['code']; if (json['error'] != null) error = json['error']; } } <|start_filename|>lib/message_node/video_message_node.dart<|end_filename|> import 'package:tencent_im_plugin/enums/message_elem_type_enum.dart'; import 'package:tencent_im_plugin/message_node/message_node.dart'; /// 适配消息节点 class VideoMessageNode extends MessageNode { /// 视频路径 String? videoPath; /// 视频UUID String? _videoUuid; /// 视频大小 int? _videoSize; /// 时长 late int duration; /// 缩略图路径 String? snapshotPath; /// 缩略图UUID String? _snapshotUuid; /// 缩略图大小 int? _snapshotSize; /// 缩略图宽度 int? _snapshotWidth; /// 缩略图高度 int? _snapshotHeight; VideoMessageNode({ required this.videoPath, required this.duration, required this.snapshotPath, }) : super(MessageElemTypeEnum.Video); VideoMessageNode.fromJson(Map<String, dynamic> json) : super(MessageElemTypeEnum.Video) { if (json['videoPath'] != null) videoPath = json["videoPath"]; if (json['videoUuid'] != null) _videoUuid = json["videoUuid"]; if (json['videoSize'] != null) _videoSize = json["videoSize"]; if (json['duration'] != null) duration = json["duration"]; if (json['snapshotPath'] != null) snapshotPath = json["snapshotPath"]; if (json['snapshotUuid'] != null) _snapshotUuid = json["snapshotUuid"]; if (json['snapshotSize'] != null) _snapshotSize = json["snapshotSize"]; if (json['snapshotWidth'] != null) _snapshotWidth = json["snapshotWidth"]; if (json['snapshotHeight'] != null) _snapshotHeight = json["snapshotHeight"]; } /// 获得视频UUID String? get videoUuid => _videoUuid; /// 获得视频大小 int? get videoSize => _videoSize; /// 获得缩略图UUID String? get snapshotUuid => _snapshotUuid; /// 获得缩略图大小 int? get snapshotSize => _snapshotSize; /// 获得缩略图宽度 int? get snapshotWidth => _snapshotWidth; /// 获得缩略图高度 int? get snapshotHeight => _snapshotHeight; @override Map<String, dynamic> toJson() { final Map<String, dynamic> data = super.toJson(); data["videoPath"] = this.videoPath; data["duration"] = this.duration; data["snapshotPath"] = this.snapshotPath; return data; } } <|start_filename|>android/src/main/java/top/huic/tencent_im_plugin/entity/CustomFriendAddApplication.java<|end_filename|> package top.huic.tencent_im_plugin.entity; import com.tencent.imsdk.v2.V2TIMFriendAddApplication; /** * 自定义好友添加申请实体 */ public class CustomFriendAddApplication extends V2TIMFriendAddApplication { public CustomFriendAddApplication() { super(null); } public CustomFriendAddApplication(String userID) { super(userID); } } <|start_filename|>lib/entity/friend_check_result_entity.dart<|end_filename|> import 'dart:convert'; import 'package:tencent_im_plugin/enums/friend_relation_type_enum.dart'; /// 好友检测结果实体 class FriendCheckResultEntity { /// 好友 id late String userID; /// 返回结果码 late int resultCode; /// 返回结果描述 String? resultInfo; /// 好友结果类型 FriendRelationTypeEnum? resultType; FriendCheckResultEntity.fromJson(data) { Map<String, dynamic> json = data is Map ? data.cast<String, dynamic>() : jsonDecode(data); if (json['userID'] != null) userID = json['userID']; if (json['resultCode'] != null) resultCode = json['resultCode']; if (json['resultInfo'] != null) resultInfo = json['resultInfo']; if (json['resultType'] != null) resultType = FriendRelationTypeTool.getByInt(json['resultType']); } } <|start_filename|>lib/utils/enum_util.dart<|end_filename|> /// 枚举工具类 class EnumUtil { /// 获得枚举的名称(不包含前缀) static String getEnumName(enumObj) { var es = enumObj.toString().split("."); return es[es.length - 1]; } /// 根据名字获得枚举 static T? nameOf<T>(List<T> array, String name) { for (var item in array) { if (EnumUtil.getEnumName(item) == name) { return item; } } return null; } } <|start_filename|>lib/entity/friend_group_entity.dart<|end_filename|> import 'dart:convert'; /// 好友分组实体 class FriendGroupEntity { /// 组名 late String name; /// 好友数量 late int friendCount; /// 好友ID列表 late List<String> friendIDList; FriendGroupEntity.fromJson(data) { Map<String, dynamic> json = data is Map ? data.cast<String, dynamic>() : jsonDecode(data); if (json['name'] != null) name = json['name']; if (json['friendCount'] != null) friendCount = json['friendCount']; if (json['friendIDList'] != null) friendIDList = json['friendIDList']?.cast<String>(); } } <|start_filename|>example/lib/page/login.dart<|end_filename|> import 'package:flutter/widgets.dart'; import 'package:flutter/material.dart'; import 'package:tencent_im_plugin/tencent_im_plugin.dart'; import 'package:tencent_im_plugin_example/utils/GenerateTestUserSig.dart'; /// 登录页面 class Login extends StatefulWidget { @override _LoginState createState() => _LoginState(); } class _LoginState extends State<Login> { TextEditingController _controller = TextEditingController(); /// 用户名 String _userName = "dev"; @override void initState() { super.initState(); _controller.text = _userName; } /// 登录按钮点击事件 _onLogin() async { String sign = GenerateTestUserSig( sdkappid: 1400294314, key: "<KEY>", ).genSig(identifier: _userName, expire: 1 * 60 * 1000); await TencentImPlugin.login( userID: _userName, userSig: sign, ); Navigator.pushNamedAndRemoveUntil( context, "/main", (Route<dynamic> route) => false); } @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text("登录页面"), ), body: Padding( padding: const EdgeInsets.all(8.0), child: Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ TextField( decoration: InputDecoration(hintText: "请输入用户名"), textAlign: TextAlign.center, onChanged: (value) => this.setState(() => _userName = value), controller: _controller, ), Container(height: 20), OutlinedButton( onPressed: _userName.trim() == '' ? null : _onLogin, child: Text("立即登录"), ), ], ), ), ), ); } } <|start_filename|>android/src/main/java/top/huic/tencent_im_plugin/message/VideoMessageNode.java<|end_filename|> package top.huic.tencent_im_plugin.message; import com.tencent.imsdk.v2.V2TIMManager; import com.tencent.imsdk.v2.V2TIMMessage; import com.tencent.imsdk.v2.V2TIMVideoElem; import top.huic.tencent_im_plugin.message.entity.VideoMessageEntity; /** * 视频消息节点 */ public class VideoMessageNode extends AbstractMessageNode<V2TIMVideoElem, VideoMessageEntity> { @Override public V2TIMMessage getV2TIMMessage(VideoMessageEntity entity) { String suffix = null; if (entity.getVideoPath().contains(".")) { String[] ss = entity.getVideoPath().split("\\."); suffix = ss[ss.length - 1]; } return V2TIMManager.getMessageManager().createVideoMessage(entity.getVideoPath(), suffix, entity.getDuration(), entity.getSnapshotPath()); } @Override public String getNote(V2TIMVideoElem elem) { return "[视频]"; } @Override public VideoMessageEntity analysis(V2TIMVideoElem elem) { return new VideoMessageEntity(elem); } @Override public Class<VideoMessageEntity> getEntityClass() { return VideoMessageEntity.class; } } <|start_filename|>android/src/main/java/top/huic/tencent_im_plugin/util/BeanUtils.java<|end_filename|> package top.huic.tencent_im_plugin.util; import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.util.Arrays; import java.util.HashMap; import java.util.Map; /** * Bean工具类 */ public class BeanUtils { /** * 复制属性 * * @param source 源对象 * @param target 目标对象 * @param ignoreProperties 忽略的参数列表 */ public static void copyProperties(Object source, Object target, String... ignoreProperties) { Class<?> sourceClass = source.getClass(); Class<?> targetClass = target.getClass(); // 填充目标方法列表 Map<String, Method> targetMethodMap = new HashMap<>(); for (Method method : targetClass.getDeclaredMethods()) { targetMethodMap.put(method.getName(), method); } try { for (Method method : sourceClass.getDeclaredMethods()) { String name = method.getName(); // 验证是否是属性方法(get / is) if (method.getReturnType() != Void.class || method.getParameterTypes().length >= 1 || !(name.startsWith("get") || name.startsWith("is"))) { // 获得方法后缀名(不包含 get is 前缀的内容) String methodSuffixName = name.replaceFirst(name.startsWith("get") ? "get" : "is", ""); if (methodSuffixName.length() == 0) { continue; } // 获得真实属性名 String fieldName = methodSuffixName.substring(0, 1).toLowerCase() + methodSuffixName.substring(1); // 如果是忽略的属性 if (ignoreProperties != null && Arrays.asList(ignoreProperties).contains(fieldName)) { continue; } // 如果不存在设置方法 String setMethodName = "set" + methodSuffixName; if (!targetMethodMap.containsKey(setMethodName)) { continue; } // 方法校验(非普通set参数(1个参数)) 或 不是公开方法,则不进行赋值确认 Method targetMethod = targetMethodMap.get(setMethodName); if (targetMethod.getParameterTypes().length != 1 || targetMethod.getModifiers() != Modifier.PUBLIC) { continue; } // 获得值,如果为null则忽略 Object resultValue = method.invoke(source); if (resultValue == null) { continue; } // 赋值 targetMethod.invoke(target, resultValue); } } } catch (Exception e) { throw new RuntimeException(e); } } } <|start_filename|>lib/enums/group_tips_group_info_type.dart<|end_filename|> /// 群资料变更消息类型 enum GroupTipsGroupInfoType { /// 非法值 Invalid, /// 修改群名称 ModifyName, /// 修改群简介 ModifyIntroduction, /// 修改群公告 ModifyNotification, /// 修改群头像URL ModifyFaceUrl, /// 修改群主 ModifyOwner, /// 修改群自定义字段 ModifyCustom, } <|start_filename|>android/src/main/java/top/huic/tencent_im_plugin/message/AbstractMessageNode.java<|end_filename|> package top.huic.tencent_im_plugin.message; import com.tencent.imsdk.v2.V2TIMMessage; import top.huic.tencent_im_plugin.message.entity.AbstractMessageEntity; /** * 消息节点接口 * * @param <N> 节点类型,对应腾讯云 TIMElem */ public abstract class AbstractMessageNode<N, E extends AbstractMessageEntity> { /** * 获得发送的消息体 * * @param entity 消息实体 * @return 结果 */ public V2TIMMessage getV2TIMMessage(E entity) { throw new RuntimeException("This node does not support sending"); } /** * 根据消息节点获得描述 * * @param elem 节点 */ public abstract String getNote(N elem); /** * 将节点解析为实体对象 * * @param elem 节点 * @return 实体对象 */ public abstract E analysis(N elem); /** * 获得实体类型 * * @return 类型 */ public abstract Class<E> getEntityClass(); } <|start_filename|>lib/entity/friend_operation_result_entity.dart<|end_filename|> import 'dart:convert'; /// 好友操作结果实体 class FriendOperationResultEntity { /// 用户ID late String userID; /// 返回码 late int resultCode; /// 返回信息 String? resultInfo; FriendOperationResultEntity.fromJson(data) { Map<String, dynamic> json = data is Map ? data.cast<String, dynamic>() : jsonDecode(data); if (json['userID'] != null) userID = json['userID']; if (json['resultCode'] != null) resultCode = json['resultCode']; if (json['resultInfo'] != null) resultInfo = json['resultInfo']; } } <|start_filename|>lib/enums/user_gender_enum.dart<|end_filename|> /// 用户性别枚举 enum UserGenderEnum { // 未知 Unknown, // 男 Male, // 女 Female, } class UserGenderTool { /// 根据Int类型值获得枚举 /// [index] Int常量 /// [Return] 枚举对象 static UserGenderEnum getByInt(int index) => UserGenderEnum.values[index]; /// 将枚举转换为整型 static int toInt(UserGenderEnum level) => level.index; } <|start_filename|>lib/entity/message_receipt_entity.dart<|end_filename|> import 'dart:convert'; /// 消息回执实体 class MessageReceiptEntity { /// 用户ID late String userID; /// 时间 int? timestamp; MessageReceiptEntity.fromJson(data) { Map<String, dynamic> json = data is Map ? data.cast<String, dynamic>() : jsonDecode(data); if (json['userID'] != null) userID = json["userID"]; if (json['timestamp'] != null) timestamp = json["timestamp"]; } } <|start_filename|>android/src/main/java/top/huic/tencent_im_plugin/message/FaceMessageNode.java<|end_filename|> package top.huic.tencent_im_plugin.message; import com.tencent.imsdk.v2.V2TIMFaceElem; import com.tencent.imsdk.v2.V2TIMManager; import com.tencent.imsdk.v2.V2TIMMessage; import top.huic.tencent_im_plugin.message.entity.FaceMessageEntity; /** * 表情消息节点 */ public class FaceMessageNode extends AbstractMessageNode<V2TIMFaceElem, FaceMessageEntity> { @Override public V2TIMMessage getV2TIMMessage(FaceMessageEntity entity) { return V2TIMManager.getMessageManager().createFaceMessage(entity.getIndex(), entity.getData().getBytes()); } @Override public String getNote(V2TIMFaceElem elem) { return "[表情]"; } @Override public FaceMessageEntity analysis(V2TIMFaceElem elem) { return new FaceMessageEntity(elem); } @Override public Class<FaceMessageEntity> getEntityClass() { return FaceMessageEntity.class; } } <|start_filename|>lib/entity/group_member_leave_entity.dart<|end_filename|> import 'dart:convert'; import 'package:tencent_im_plugin/entity/group_member_entity.dart'; /// 群成员离开通知实体 class GroupMemberLeaveEntity { /// 群ID late String groupID; /// 群成员信息 late GroupMemberEntity member; GroupMemberLeaveEntity.fromJson(data) { Map<String, dynamic> json = data is Map ? data.cast<String, dynamic>() : jsonDecode(data); if (json['groupID'] != null) groupID = json['groupID']; if (json["member"] != null) member = GroupMemberEntity.fromJson(json["member"]); } } <|start_filename|>lib/enums/group_member_filter_enum.dart<|end_filename|> /// 群成员过滤枚举 enum GroupMemberFilterEnum { /// 所有类型 All, /// 群主 Owner, /// 群管理员 Admin, /// 普通群成员 Common, } class GroupMemberFilterTool { /// 根据Int类型值获得枚举 /// [index] Int常量 /// [Return] 枚举对象 static GroupMemberFilterEnum getByInt(int index) { switch (index) { case 0: return GroupMemberFilterEnum.All; case 1: return GroupMemberFilterEnum.Owner; case 2: return GroupMemberFilterEnum.Admin; case 4: return GroupMemberFilterEnum.Common; } throw ArgumentError("参数异常"); } /// 将枚举转换为整型 static int toInt(GroupMemberFilterEnum role) { switch (role) { case GroupMemberFilterEnum.All: return 0; case GroupMemberFilterEnum.Owner: return 1; case GroupMemberFilterEnum.Admin: return 2; case GroupMemberFilterEnum.Common: return 4; } } } <|start_filename|>lib/enums/user_allow_type_enum.dart<|end_filename|> /// 用户验证方式枚举 enum UserAllowTypeEnum { // 允许任何人 AllowAny, // 需要确认 NeedConfirm, // 拒绝任何人 DenyAny, } class UserAllowTypeTool { /// 根据Int类型值获得枚举 /// [index] Int常量 /// [Return] 枚举对象 static UserAllowTypeEnum getByInt(int index) => UserAllowTypeEnum.values[index]; /// 将枚举转换为整型 static int toInt(UserAllowTypeEnum level) => level.index; } <|start_filename|>lib/entity/message_entity.dart<|end_filename|> import 'dart:convert'; import 'package:tencent_im_plugin/entity/offline_push_info_entity.dart'; import 'package:tencent_im_plugin/enums/message_elem_type_enum.dart'; import 'package:tencent_im_plugin/enums/message_priority_enum.dart'; import 'package:tencent_im_plugin/enums/message_status_enum.dart'; import 'package:tencent_im_plugin/message_node/message_node.dart'; /// 消息实体 class MessageEntity { /// 消息 ID late String msgID; /// 消息时间戳 int? timestamp; /// 消息发送者 userID String? sender; /// 消息发送者昵称 String? nickName; /// 好友备注。如果没有拉取过好友信息或者不是好友,返回 null String? friendRemark; /// 发送者头像 url String? faceUrl; /// 群组消息,nameCard 为发送者的群名片 String? nameCard; /// 群组消息,groupID 为接收消息的群组 ID,否则为 null String? groupID; /// 单聊消息,userID 为会话用户 ID,否则为 null。 假设自己和 userA 聊天,无论是自己发给 userA 的消息还是 userA 发给自己的消息,这里的 userID 均为 userA String? userID; /// 消息发送状态 MessageStatusEnum? status; /// 消息类型 MessageElemTypeEnum? elemType; /// 消息自定义数据(本地保存,不会发送到对端,程序卸载重装后失效) String? localCustomData; /// 消息自定义数据(本地保存,不会发送到对端,程序卸载重装后失效) int? localCustomInt; /// 消息发送者是否是自己 bool? self; /// 消息自己是否已读 bool? read; /// 消息对方是否已读(只有 C2C 消息有效) bool? peerRead; /// 消息优先级 MessagePriorityEnum? priority; /// 消息的离线推送信息 OfflinePushInfoEntity? offlinePushInfo; /// 群@用户列表 List<String>? groupAtUserList; /// 消息的序列号 /// 群聊中的消息序列号云端生成,在群里是严格递增且唯一的。 单聊中的序列号是本地生成,不能保证严格递增且唯一。 int? seq; /// 描述信息,描述当前消息,可直接用于显示 String? note; /// 消息节点信息 MessageNode? node; /// 消息随机码 int? random; MessageEntity({ required this.msgID, this.timestamp, this.sender, this.nickName, this.friendRemark, this.faceUrl, this.nameCard, this.groupID, this.userID, required this.status, this.elemType, this.localCustomData, this.localCustomInt, this.self: true, this.read: true, this.peerRead: false, this.priority, this.offlinePushInfo, this.groupAtUserList, this.seq, this.note, this.node, this.random, }); MessageEntity.fromJson(data) { Map<String, dynamic> json = data is Map ? data.cast<String, dynamic>() : jsonDecode(data); if (json['msgID'] != null) msgID = json["msgID"]; if (json['timestamp'] != null) timestamp = json["timestamp"]; if (json['sender'] != null) sender = json["sender"]; if (json['nickName'] != null) nickName = json["nickName"]; if (json['friendRemark'] != null) friendRemark = json["friendRemark"]; if (json['faceUrl'] != null) faceUrl = json["faceUrl"]; if (json['nameCard'] != null) nameCard = json["nameCard"]; if (json['groupID'] != null) groupID = json["groupID"]; if (json['userID'] != null) userID = json["userID"]; if (json["status"] != null) status = MessageStatusTool.getByInt(json["status"]); if (json["elemType"] != null) elemType = MessageElemTypeTool.getByInt(json["elemType"]); if (json['localCustomData'] != null) localCustomData = json["localCustomData"]; if (json['localCustomInt'] != null) localCustomInt = json["localCustomInt"]; if (json["self"] != null) self = json["self"]; if (json["read"] != null) read = json["read"]; if (json["peerRead"] != null) peerRead = json["peerRead"]; if (json["priority"] != null) priority = MessagePriorityTool.getByInt(json["priority"]); if (json["offlinePushInfo"] != null) offlinePushInfo = OfflinePushInfoEntity.fromJson(json["offlinePushInfo"]); if (json['groupAtUserList'] != null) groupAtUserList = json["groupAtUserList"]?.cast<String>(); if (json['seq'] != null) seq = json["seq"]; if (json['note'] != null) note = json["note"]; if (json['node'] != null) node = MessageElemTypeTool.getMessageNodeByMessageNodeType( elemType!, json["node"]); if (json['random'] != null) random = json["random"]; } Map<String, dynamic> toJson() { final Map<String, dynamic> data = new Map<String, dynamic>(); data['msgID'] = this.msgID; if (this.timestamp != null) data['timestamp'] = this.timestamp; if (this.sender != null) data['sender'] = this.sender; if (this.nickName != null) data['nickName'] = this.nickName; if (this.friendRemark != null) data['friendRemark'] = this.friendRemark; if (this.faceUrl != null) data['faceUrl'] = this.faceUrl; if (this.nameCard != null) data['nameCard'] = this.nameCard; if (this.groupID != null) data['groupID'] = this.groupID; if (this.userID != null) data['userID'] = this.userID; if (this.status != null) data['status'] = MessageStatusTool.toInt(this.status!); if (this.elemType != null) data['elemType'] = MessageElemTypeTool.toInt(this.elemType!); if (this.localCustomData != null) data['localCustomData'] = this.localCustomData; if (this.localCustomInt != null) data['localCustomInt'] = this.localCustomInt; if (this.self != null) data['self'] = this.self; if (this.read != null) data['read'] = this.read; if (this.peerRead != null) data['peerRead'] = this.peerRead; if (this.priority != null) data['priority'] = MessagePriorityTool.toInt(this.priority!); if (this.offlinePushInfo != null) data['offlinePushInfo'] = this.offlinePushInfo!.toJson(); if (this.groupAtUserList != null) data['groupAtUserList'] = this.groupAtUserList; if (this.seq != null) data['seq'] = this.seq; if (this.note != null) data['note'] = this.note; if (this.random != null) data['random'] = this.random; return data; } @override bool operator ==(Object other) => identical(this, other) || other is MessageEntity && runtimeType == other.runtimeType && msgID == other.msgID; @override int get hashCode => msgID.hashCode; } <|start_filename|>lib/enums/friend_application_type_enum.dart<|end_filename|> /// 好友申请类型枚举 enum FriendApplicationTypeEnum { // 别人发给我的加好友请求 ComeIn, // 我发给别人的加好友请求 SendOut, // 别人发给我的和我发给别人的加好友请求。仅在拉取时有效。 Both, } /// 枚举工具 class FriendApplicationTypeTool { /// 根据Int类型值获得枚举 /// [index] Int常量 /// [Return] 枚举对象 static FriendApplicationTypeEnum getByInt(int index) => FriendApplicationTypeEnum.values[index - 1]; /// 将枚举转换为整型 static int toInt(FriendApplicationTypeEnum level) => level.index + 1; } <|start_filename|>android/src/main/java/top/huic/tencent_im_plugin/message/entity/TextMessageEntity.java<|end_filename|> package top.huic.tencent_im_plugin.message.entity; import com.tencent.imsdk.v2.V2TIMTextElem; import java.util.List; import top.huic.tencent_im_plugin.enums.MessageNodeType; /** * 文本消息实体 * * @author 蒋具宏 */ public class TextMessageEntity extends AbstractMessageEntity { /** * 消息内容 */ private String content; /** * \@的用户列表 */ private List<String> atUserList; /** * 是否@所有人 */ private Boolean atAll; public TextMessageEntity() { super(MessageNodeType.Text); } public TextMessageEntity(V2TIMTextElem elem) { super(MessageNodeType.Text); this.content = elem.getText(); } public String getContent() { return content; } public void setContent(String content) { this.content = content; } public List<String> getAtUserList() { return atUserList; } public void setAtUserList(List<String> atUserList) { this.atUserList = atUserList; } public Boolean getAtAll() { return atAll; } public void setAtAll(Boolean atAll) { this.atAll = atAll; } } <|start_filename|>lib/entity/friend_add_application_entity.dart<|end_filename|> import 'package:tencent_im_plugin/enums/friend_type_enum.dart'; /// 好友添加申请实体 class FriendAddApplicationEntity { /// 用户ID String userID; /// 好友备注 String? friendRemark; /// 申请描述 String? addWording; /// 添加来源 String? addSource; /// 添加类型 FriendTypeEnum addType; FriendAddApplicationEntity({ required this.userID, this.friendRemark, this.addWording, this.addSource, required this.addType, }); Map<String, dynamic> toJson() { final Map<String, dynamic> data = new Map<String, dynamic>(); data['userID'] = this.userID; if (this.friendRemark != null) data['friendRemark'] = this.friendRemark; if (this.addWording != null) data['addWording'] = this.addWording; if (this.addSource != null) data['addSource'] = this.addSource; data['addType'] = FriendTypeTool.toInt(this.addType); return data; } } <|start_filename|>lib/entity/friend_application_entity.dart<|end_filename|> import 'dart:convert'; import 'package:tencent_im_plugin/enums/friend_application_type_enum.dart'; /// 好友申请实体 class FriendApplicationEntity { /// 用户ID late String userID; /// 用户昵称 String? nickname; /// 用户头像 String? faceUrl; /// 申请时间 late int addTime; /// 申请来源 String? addSource; /// 申请描述 String? addWording; /// 类型 late FriendApplicationTypeEnum type; FriendApplicationEntity.fromJson(data) { Map<String, dynamic> json = data is Map ? data.cast<String, dynamic>() : jsonDecode(data); if (json['userID'] != null) userID = json['userID']; if (json['nickname'] != null) nickname = json['nickname']; if (json['faceUrl'] != null) faceUrl = json['faceUrl']; if (json['addTime'] != null) addTime = json['addTime']; if (json['addSource'] != null) addSource = json['addSource']; if (json['addWording'] != null) addWording = json['addWording']; if (json['type'] != null) type = FriendApplicationTypeTool.getByInt(json['type']); } } <|start_filename|>lib/entity/group_attribute_changed_entity.dart<|end_filename|> import 'dart:convert'; /// 群属性更新实体 class GroupAttributeChangedEntity { /// 群ID late String groupID; /// 属性对象 late Map<String, String> attributes; GroupAttributeChangedEntity.fromJson(data) { Map<String, dynamic> json = data is Map ? data.cast<String, dynamic>() : jsonDecode(data); if (json['groupID'] != null) groupID = json['groupID']; if (json['attributes'] != null) attributes = (json["attributes"] as Map).cast<String, String>(); } } <|start_filename|>lib/entity/group_member_invited_or_kicked_entity.dart<|end_filename|> import 'dart:convert'; import 'package:tencent_im_plugin/entity/group_member_entity.dart'; import 'package:tencent_im_plugin/list_util.dart'; /// 群成员邀请或踢出通知实体 class GroupMemberInvitedOrKickedEntity { /// 群ID late String groupID; /// 群成员列表信息 List<GroupMemberEntity>? memberList; /// 操作用户 GroupMemberEntity? opUser; GroupMemberInvitedOrKickedEntity.fromJson(data) { Map<String, dynamic> json = data is Map ? data.cast<String, dynamic>() : jsonDecode(data); if (json['groupID'] != null) groupID = json['groupID']; if (json["memberList"] != null) memberList = ListUtil.generateOBJList<GroupMemberEntity>(json['memberList']); if (json["opUser"] != null) opUser = GroupMemberEntity.fromJson(json["opUser"]); } }
MrLaibin/FlutterTencentImPlugin
<|start_filename|>native_objects/lang_swig.lua<|end_filename|> -- Copyright (c) 2010 by <NAME> <<EMAIL>> -- -- Permission is hereby granted, free of charge, to any person obtaining a copy -- of this software and associated documentation files (the "Software"), to deal -- in the Software without restriction, including without limitation the rights -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -- copies of the Software, and to permit persons to whom the Software is -- furnished to do so, subject to the following conditions: -- -- The above copyright notice and this permission notice shall be included in -- all copies or substantial portions of the Software. -- -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -- THE SOFTWARE. -- -- C to Lua Base types -- basetype "bool" "boolean" basetype "char" "integer" basetype "unsigned char" "integer" basetype "short" "integer" basetype "unsigned short" "integer" basetype "int" "integer" basetype "unsigned int" "integer" basetype "long" "integer" basetype "unsigned long" "integer" -- stdint types. basetype "int8_t" "integer" basetype "int16_t" "integer" basetype "int32_t" "integer" basetype "int64_t" "integer" basetype "uint8_t" "integer" basetype "uint16_t" "integer" basetype "uint32_t" "integer" basetype "uint64_t" "integer" basetype "float" "number" basetype "double" "number" basetype "char *" "string" basetype "void *" "lightuserdata" basetype "void" "nil" local lua_base_types = { ['nil'] = { push = 'lua_pushnil' }, ['number'] = { to = 'lua_tonumber', check = 'luaL_checknumber', push = 'lua_pushnumber' }, ['integer'] = { to = 'lua_tointeger', check = 'luaL_checkinteger', push = 'lua_pushinteger' }, ['string'] = { to = 'lua_tostring', check = 'luaL_checkstring', push = 'lua_pushstring' }, ['boolean'] = { to = 'lua_toboolean', check = 'lua_toboolean', push = 'lua_pushboolean' }, ['lightuserdata'] = { to = 'lua_touserdata', check = 'lua_touserdata', push = 'lua_pushlightuserdata' }, } <|start_filename|>examples/Makefile<|end_filename|> #CFLAGS=-O3 -march=native CFLAGS=-g -O2 -march=native all: gd.so bench.so gd.nobj.c: gd*.nobj.lua lua ../native_objects.lua -outpath ./ -gen lua gd.nobj.lua gd.so: gd.nobj.c gcc $(CFLAGS) -fPIC -shared -lgd -o $@ gd.nobj.c bench.nobj.c: bench.nobj.lua bench/*.nobj.lua lua ../native_objects.lua -outpath ./ -gen lua bench.nobj.lua bench.so: bench.nobj.c gcc $(CFLAGS) -fPIC -shared -o $@ bench.nobj.c clean: rm -f *.nobj.c *.so test.png .PHONY: all clean <|start_filename|>project_template/cmake/LuaNativeObjects.cmake<|end_filename|> # # Lua Native Objects # set(LUA_NATIVE_OBJECTS_PATH ${CMAKE_SOURCE_DIR}/../LuaNativeObjects CACHE PATH "Directory to LuaNativeObjects bindings generator.") set(USE_PRE_GENERATED_BINDINGS TRUE CACHE BOOL "Set this to FALSE to re-generate bindings using LuaNativeObjects") set(GENERATE_LUADOCS TRUE CACHE BOOL "Set this to FALSE to avoid generation of docs using LuaDoc") macro(GenLuaNativeObjects _src_files_var) set(_new_src_files) foreach(_src_file ${${_src_files_var}}) if(_src_file MATCHES ".nobj.lua") string(REGEX REPLACE ".nobj.lua" ".nobj.c" _src_file_out ${_src_file}) string(REGEX REPLACE ".nobj.lua" ".nobj.ffi.lua" _ffi_file_out ${_src_file}) add_custom_command(OUTPUT ${_src_file_out} ${_ffi_file_out} COMMAND lua ${LUA_NATIVE_OBJECTS_PATH}/native_objects.lua -outpath ${CMAKE_CURRENT_BINARY_DIR} -gen lua ${_src_file} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} DEPENDS ${_src_file} ) set_source_files_properties(${_src_file_out} PROPERTIES GENERATED TRUE) set_source_files_properties(${_ffi_file_out} PROPERTIES GENERATED TRUE) if (${GENERATE_LUADOCS}) string(REGEX REPLACE ".nobj.lua" "" _doc_base ${_src_file}) string(REGEX REPLACE ".nobj.lua" ".luadoc" _doc_file_out ${_src_file}) add_custom_target(${_doc_file_out} ALL COMMAND lua ${LUA_NATIVE_OBJECTS_PATH}/native_objects.lua -outpath docs -gen luadoc ${_src_file} COMMAND luadoc -nofiles -d docs docs WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} DEPENDS ${_src_file} ) endif() set_source_files_properties(${_doc_file_out} PROPERTIES GENERATED TRUE) set(_new_src_files ${_new_src_files} ${_src_file_out}) else(_src_file MATCHES ".nobj.lua") set(_new_src_files ${_new_src_files} ${_src_file}) endif(_src_file MATCHES ".nobj.lua") endforeach(_src_file) set(${_src_files_var} ${_new_src_files}) endmacro(GenLuaNativeObjects _src_files_var) <|start_filename|>native_objects/gen_luadoc.lua<|end_filename|> -- Copyright (c) 2012 by <NAME> <<EMAIL>> -- -- Permission is hereby granted, free of charge, to any person obtaining a copy -- of this software and associated documentation files (the "Software"), to deal -- in the Software without restriction, including without limitation the rights -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -- copies of the Software, and to permit persons to whom the Software is -- furnished to do so, subject to the following conditions: -- -- The above copyright notice and this permission notice shall be included in -- all copies or substantial portions of the Software. -- -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -- THE SOFTWARE. local tconcat = table.concat -- re-map meta-methods. local lua_meta_methods = { __str__ = '__tostring', __eq__ = '__eq', delete = '__gc', -- Lua metamethods __add = '__add', __sub = '__sub', __mul = '__mul', __div = '__div', __mod = '__mod', __pow = '__pow', __unm = '__unm', __len = '__len', __concat = '__concat', __eq = '__eq', __lt = '__lt', __le = '__le', __gc = '__gc', __tostring = '__tostring', __index = '__index', __newindex = '__newindex', } local function ctype_to_name(ctype) if ctype.lang_type == 'userdata' then elseif ctype.lang_type == 'function' then return "Lua function" else return ctype.lang_type or ctype.name end return ctype.name end function get_type_link(rec) if rec._rec_type == 'object' then return '<a href="' .. rec.name .. '.html">' .. rec.name ..'</a>' else return '<code>' .. ctype_to_name(rec) .. '</code>' end end print"============ Lua Documentation =================" local parsed = process_records{ _modules_out = {}, -- record handlers c_module = function(self, rec, parent) local module_c_name = rec.name:gsub('(%.)','_') rec:add_var('module_c_name', module_c_name) rec:add_var('module_name', rec.name) rec:add_var('object_name', rec.name) rec.objects = {} self._cur_module = rec self._modules_out[rec.name] = rec rec:write_part("doc_header", { '--- Module ${object_name}.\n', '--\n', }) end, c_module_end = function(self, rec, parent) self._cur_module = nil rec:write_part("doc_footer", { 'module("${object_name}")\n\n', }) local parts = { "doc_header", "doc_src", "doc_footer", "doc_funcs" } rec:vars_parts(parts) rec:write_part("doc_out", rec:dump_parts(parts)) end, error_code = function(self, rec, parent) rec:add_var('object_name', rec.name) end, error_code_end = function(self, rec, parent) end, object = function(self, rec, parent) self._cur_module.objects[rec.name] = rec rec:add_var('object_name', rec.name) parent:write_part("doc_footer", { '-- <br />Class ', get_type_link(rec),'\n', }) rec:write_part("doc_header", { '--- Class "${object_name}".\n', '--\n', }) rec:write_part("doc_subclasses", { '-- <br />\n', }) end, object_end = function(self, rec, parent) rec:write_part("doc_footer", { 'module("${object_name}")\n\n', }) -- copy generated luadocs to parent local parts = { "doc_header", "doc_src", "doc_footer", "doc_funcs" } rec:vars_parts(parts) rec:write_part("doc_out", rec:dump_parts(parts)) -- copy methods to sub-classes local subs = rec.subs if subs then local methods = rec:dump_parts("doc_for_subs") for i=1,#subs do local sub = subs[i] sub.base_methods = (sub.base_methods or '') .. methods end end end, doc = function(self, rec, parent) parent:write_part("doc_src", { '-- ',rec.text:gsub("\n","\n-- "),'\n', }) end, callback_state = function(self, rec, parent) end, callback_state_end = function(self, rec, parent) end, include = function(self, rec, parent) end, define = function(self, rec, parent) end, extends = function(self, rec, parent) assert(not parent.is_package, "A Package can't extend anything: package=" .. parent.name) local base = rec.base if base == nil then return end parent:write_part("doc_footer", { '-- Extends ', get_type_link(base),'<br />\n', }) base:write_part("doc_subclasses", { '-- Subclass ', get_type_link(parent),'<br />\n', }) -- add methods/fields/constants from base object for name,val in pairs(base.name_map) do -- make sure sub-class has not override name. if parent.name_map[name] == nil or parent.name_map[name] == val then parent.name_map[name] = val if val._is_method and not val.is_constructor then parent.functions[name] = val elseif val._rec_type == 'field' then parent.fields[name] = val elseif val._rec_type == 'const' then parent.constants[name] = val end end end end, extends_end = function(self, rec, parent) end, callback_func = function(self, rec, parent) rec.wrapped_type = parent.c_type rec.wrapped_type_rec = parent.c_type_rec -- start callback function. rec:write_part("doc_src", { '--- callback: ', rec.name, '\n', '--\n', '-- @name ', rec.name, '\n', }) rec:write_part("doc_func", { 'function ', rec.name, '(' }) end, callback_func_end = function(self, rec, parent) -- end luddoc for function rec:write_part("doc_func", { ')\nend\n' }) -- map in/out variables in c source. local parts = {"doc_header", "doc_src", "doc_footer", "doc_func"} rec:vars_parts(parts) parent:write_part('doc_funcs', { rec:dump_parts(parts), "\n\n" }) end, dyn_caster = function(self, rec, parent) end, dyn_caster_end = function(self, rec, parent) end, c_function = function(self, rec, parent) if rec._is_hidden then return end rec:add_var('object_name', parent.name) local name = rec.name if rec._is_meta_method and not rec.is_destructor then name = lua_meta_methods[name] end rec:add_var('func_name', name) local desc = '' local prefix = '' if rec._is_method then if rec.is_constructor then desc = "Create a new ${object_name} object." prefix = "${object_name}." elseif rec.is_destructor then desc = "Destroy this object (will be called by Garbage Collector)." prefix = "${object_name}:" elseif rec._is_meta_method then desc = "object meta method." prefix = "${object_name}_mt:" else desc = "object method." prefix = "${object_name}:" end else desc = "module function." prefix = "${object_name}." end -- generate luadoc stub function rec:write_part("doc_src", { '--- ', desc, '\n', '--\n', }) rec:write_part("doc_func", { '-- @name ', prefix, '${func_name}\n', 'function ', prefix, name, '(' }) end, c_function_end = function(self, rec, parent) if rec._is_hidden then return end local params = {} for i=1,#rec do local var = rec[i] local rtype = var._rec_type local name = var.name if rtype == 'var_in' then if not var.is_this and name ~= 'L' then params[#params + 1] = var.name end end end params = tconcat(params, ', ') -- end luddoc for function rec:write_part("doc_func", { params, ')\nend' }) local parts = {"doc_header", "doc_src", "doc_footer", "doc_func"} rec:vars_parts(parts) if rec._is_method and not rec.is_constructor then parent:write_part("doc_for_subs", {rec:dump_parts(parts), "\n\n"}) end parent:write_part("doc_funcs", {rec:dump_parts(parts), "\n\n"}) end, c_source = function(self, rec, parent) end, var_in = function(self, rec, parent) -- no need to add code for 'lua_State *' parameters. if rec.c_type == 'lua_State *' and rec.name == 'L' then return end if rec.is_this then return end local desc = '' if rec.desc then desc = rec.desc .. '. ' end if rec.c_type == '<any>' then desc = desc .. "Multiple types accepted." else desc = desc .."Must be of type " .. get_type_link(rec.c_type_rec) .. "." end parent:write_part("doc_footer", {'-- @param ', rec.name, ' ', desc, '\n'}) end, var_out = function(self, rec, parent) if rec.is_length_ref or rec.is_temp then return end -- push Lua value onto the stack. local error_code = parent._has_error_code local var_type = get_type_link(rec.c_type_rec) if error_code == rec then if rec._rec_idx == 1 then parent:write_part("doc_footer", { '-- @return <code>true</code> if no error.\n', '-- @return Error string.\n', }) else parent:write_part("doc_footer", { '-- @return Error string.\n', }) end elseif rec.no_nil_on_error ~= true and error_code then parent:write_part("doc_footer", { '-- @return ', var_type, ' or <code>nil</code> on error.\n', }) elseif rec.is_error_on_null then parent:write_part("doc_footer", { '-- @return ', var_type, ' or <code>nil</code> on error.\n', '-- @return Error string.\n', }) else parent:write_part("doc_footer", { '-- @return ', var_type, '.\n', }) end end, cb_in = function(self, rec, parent) parent:write_part("doc_footer", {'-- @param ', rec.name, '\n'}) end, cb_out = function(self, rec, parent) parent:write_part("doc_footer", {'-- @return ', rec.name, '\n'}) end, } local lfs = require"lfs" local src_file local function src_write(...) src_file:write(...) end local function dump_module(mod, path) path = path or '' lfs.mkdir(get_outpath(path)) src_file = open_outfile(path .. mod.name .. '.luadoc') -- write header src_write[[ -- -- Warning: AUTOGENERATED DOCS. -- ]] src_write( mod:dump_parts({ "doc_out", }), (mod.base_methods or '') ) end local function dump_modules(modules, path) path = path or '' for name,mod in pairs(modules) do dump_module(mod, path) local objects = mod.objects if objects then dump_modules(objects, path .. mod.name .. '/') end end end dump_modules(parsed._modules_out) print("Finished generating luadoc stubs") <|start_filename|>examples/bench/method_call.nobj.lua<|end_filename|> object "method_call" { c_source[[ typedef struct method_call method_call; #define DEFAULT_PTR ((method_call *)0xDEADBEEF) method_call *method_call_create() { return DEFAULT_PTR; } void method_call_destroy(method_call *call) { assert(call == DEFAULT_PTR); } int method_call_null(method_call *call) { return 0; } ]], -- create object constructor { c_call "method_call *" "method_call_create" {}, }, -- destroy object destructor "close" { c_method_call "void" "method_call_destroy" {}, }, method "simple" { c_source[[ if(${this} != DEFAULT_PTR) { luaL_error(L, "INVALID PTR: %p != %p", ${this}, DEFAULT_PTR); } ]], ffi_source[[ if(${this} == nil) then error(string.format("INVALID PTR: %p == nil", ${this})); end ]], }, method "null" { c_method_call "int" "method_call_null" {}, }, } <|start_filename|>project_template/src/object.nobj.lua<|end_filename|> -- -- This is an example object from GD example binding -- object "gdImage" { -- Use `ffi_cdef` records to pass extra C type info to FFI. ffi_cdef[[ typedef struct gdImageStruct gdImage; ]], -- The first constructor can be called as: gd.gdImage(x,y) or gd.gdImage.new(x,y) -- The default name for a constructor is 'new' constructor { c_call "gdImage *" "gdImageCreate" { "int", "sx", "int", "sy" } }, -- Other constructors can be called by there name: gd.gdImage.newTrueColor(x,y) constructor "newTrueColor" { c_call "gdImage *" "gdImageCreateTrueColor" { "int", "sx", "int", "sy" } }, -- A named destructor allows freeing of the object before it gets GC'ed. destructor "close" { c_method_call "void" "gdImageDestroy" {} }, method "color_allocate" { -- bindings for simple methods/functions can be generated with `c_method_call` or `c_call` -- records, which will generate both Lua API & FFI based bindings for the function. c_method_call "int" "gdImageColorAllocate" { "int", "r", "int", "g", "int", "b" } }, method "line" { c_method_call "void" "gdImageLine" { "int", "x1", "int", "y1", "int", "x2", "int", "y2", "int", "colour" } }, -- The next method need extra FFI types & function information. ffi_cdef[[ /* dummy typedef for "FILE" */ typedef struct FILE FILE; FILE *fopen(const char *path, const char *mode); int fclose(FILE *fp); void gdImagePng(gdImage *im, FILE *out); ]], -- This method is more complex and can't be generated with a simple `c_method_call` record. method "toPNG" { -- Use `var_in`/`var_out` records to define parameters & return values. var_in { "const char *", "name" }, -- Use `c_source` records to provide the C code for this method. c_source [[ FILE *pngout = fopen( ${name}, "wb"); gdImagePng(${this}, pngout); fclose(pngout); ]], -- if you want this method to have FFI-based bindings you will need to use a `ffi_source` record ffi_source [[ local pngout = ffi.C.fopen(${name}, "wb") C.gdImagePng(${this}, pngout) ffi.C.fclose(pngout) ]] }, } <|start_filename|>record.lua<|end_filename|> -- Copyright (c) 2010 by <NAME> <<EMAIL>> -- -- Permission is hereby granted, free of charge, to any person obtaining a copy -- of this software and associated documentation files (the "Software"), to deal -- in the Software without restriction, including without limitation the rights -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -- copies of the Software, and to permit persons to whom the Software is -- furnished to do so, subject to the following conditions: -- -- The above copyright notice and this permission notice shall be included in -- all copies or substantial portions of the Software. -- -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -- THE SOFTWARE. local tinsert,tremove=table.insert,table.remove local tappend=function(dst,src) for _,v in pairs(src) do dst[#dst+1] = v end end -- records that are not contained in other records local root_records={} local record_type_groups={} local clear_funcs={} local global_scope={} function clear_all_records() root_records={} record_type_groups={} -- run clear functions for i=1,#clear_funcs do local func = clear_funcs[i] func() end global_scope={} end function reg_clear_func(func) clear_funcs[#clear_funcs + 1] = func end -- get a named record with rec_type function get_named_record(rec_type, name) local recs = record_type_groups[rec_type] if recs ~= nil then return recs[name] end end local function group_add_record(rec, rec_type) -- add this record to the list of records with the same type. local type_group = record_type_groups[rec_type] if type_group == nil then type_group = {} record_type_groups[rec_type] = type_group end type_group[#type_group+1] = rec if name ~= nil then type_group[name] = rec end end local variable_format="%s_idx%d" function set_variable_format(format) variable_format = format end function format_variable(name, idx) return variable_format:format(name, idx) end -- Meta-table used by all records. local ignore_record={_rec_type = "ignore"} local rec_meta rec_meta={ clear = function(self) self._vars = {} self._data_parts = {} self._rec_counts = {} end, -- -- add data output functions to record. -- -- replace variables in "part" vars_part = function(self, part) local tmpl = self:dump_parts({part}) tmpl = tmpl:gsub("%${(.-)}", self._vars) self._data_parts[part] = {tmpl} return tmpl end, -- replace variables in "parts" vars_parts = function(self, parts) local out={} parts = self:parts(parts) -- apply variables to all "parts". for i=1,#parts do local part = parts[i] local d = self:vars_part(part) out[#out+1] = d end return out end, -- append data to "part" write_part = function(self, part, data) if type(data) ~= "table" then if data == nil then return end data = { tostring(data) } end local out=self._data_parts[part] if out == nil then out = {} self._data_parts[part] = out end -- append data. tappend(out, data) end, parts = function(self, parts) -- make sure "parts" is a table. if parts == nil then parts = {} for part in pairs(self._data_parts) do parts[#parts+1] = part end elseif type(parts) ~= "table" then parts = { parts } end return parts end, dump_parts = function(self, parts, sep) local out={} parts = self:parts(parts) -- return all parts listed in "parts". local data = self._data_parts for i=1,#parts do local part = parts[i] local d_part=data[part] if d_part then tappend(out, d_part) end if sep ~= nil then out[#out+1] = sep end end return table.concat(out) end, -- copy parts from "src" record. copy_parts = function(self, src, parts) parts = src:parts(parts) for i=1,#parts do local part = parts[i] self:write_part(part, src:dump_parts(part)) end end, -- -- functions for counting sub-records -- get_sub_record_count = function(self, _rec_type) local count = self._rec_counts[_rec_type] if count == nil then count = 0 end return count end, count_sub_record = function(self, rec) local count = self:get_sub_record_count(rec._rec_type) count = count + 1 self._rec_counts[rec._rec_type] = count rec._rec_idx = count end, -- -- functions for adding named variables -- add_var = function(self, key, value) self._vars[key] = value end, add_rec_var = function(self, rec, name, vname, idx) local name = name or rec.name local idx = idx or rec._rec_idx self._vars[name] = vname or format_variable(name, idx) self._vars[name .. "::idx"] = idx end, -- -- sub-records management functions -- make_sub_record = function(self, parent) local root_idx -- find record in roots list for idx=1,#root_records do if root_records[idx] == self then root_idx = idx break end end -- remove it from the roots list if root_idx ~= nil and root_records[root_idx] == self then tremove(root_records, root_idx) end rawset(self, "_parent", parent) end, insert_record = function(self, rec, pos) rec:make_sub_record(self) if pos ~= nil then tinsert(self, pos, rec) else self[#self+1] = rec end end, add_record = function(self, rec) self:insert_record(rec) end, find_record = function(self, rec) for i=1,#self do local sub = self[i] if sub == rec then return i end end end, replace_record = function(self, old_rec, new_rec) for i=1,#self do local sub = self[i] if sub == old_rec then self[i] = new_rec return i end end end, remove_record = function(self, rec) for i=1,#self do local sub = self[i] if sub == rec then rawset(self, i, ignore_record) -- have to insert an empty table in it's place. rawset(sub, "_parent", nil) return end end end, -- -- delete a record and all it's sub-records -- delete_record = function(self) -- remove from parent. if self._parent ~= nil then self._parent:remove_record(self) end -- delete sub-records for i=1,#self do local sub = self[i] if is_record(sub) and sub._parent == self then self[i] = nil sub:delete_record() rawset(sub, "_parent", nil) end end -- ignore this record and it sub-records self._rec_type = "ignore" end, -- -- Copy record and all it's sub-records. -- copy_record = function(self) local copy = {} -- copy values from current record. for k,v in pairs(self) do copy[k] = v end rawset(copy, "_parent", nil) -- unlink from old parent -- copy sub-records for i=1,#copy do local sub = copy[i] if is_record(sub) then local sub_copy = sub:copy_record() rawset(copy, i, sub_copy) rawset(sub_copy, "_parent", copy) end end setmetatable(copy, rec_meta) group_add_record(copy, copy._rec_type) return copy end, -- -- Symbol resolver -- add_symbol = function(self, name, obj, scope) -- default scope 'local' if scope == nil then scope = "local" end -- if scope is global then skip local maps. if scope == 'global' then global_scope[name] = obj return end -- add symbol to local map self._symbol_map[name] = obj -- if scope is doesn't equal our scope if scope ~= self.scope and self._parent ~= nil then self._parent:add_symbol(name, obj, scope) end end, get_symbol = function(self, name) -- check our mappings local obj = self._symbol_map[name] -- check parent if we don't have a mapping for the symbol if obj == nil and self._parent ~= nil then obj = self._parent:get_symbol(name) end -- next check the imports for the symbol if obj == nil then local imports = self._imports for i=1,#imports do local import = imports[i] obj = import:get_symbol(name) if obj ~= nil then break end end end -- next check the globals for the symbol if obj == nil then obj = global_scope[name] end return obj end, -- import symbols from a "file" record add_import = function(self, import_rec) local imports = self._imports -- if already imported then skip if imports[import_rec] then return end imports[import_rec] = true -- append to head of imports list so that the last import overrides symbols -- from the previous imports table.insert(imports, 1, import_rec) end, } rec_meta.__index = rec_meta function is_record(rec) -- use a metatable to identify records return (getmetatable(rec) == rec_meta and rec._rec_type ~= nil) end setmetatable(ignore_record, rec_meta) local function remove_child_records_from_roots(rec, seen) -- make sure we don't get in a reference loop. if seen == nil then seen = {} end if seen[rec] then return end seen[rec] = true -- remove from root list. for i=1,#rec do local val = rec[i] if is_record(val) then val:make_sub_record(rec) end end end local function end_record(rec) if type(rec) ~= 'function' then return rec end local rc, result = pcall(rec, nil) if not rc then print("Error processing new record: " .. result) return rec end return end_record(result) end function make_record(rec, rec_type, name, scope) if rec == nil then rec = {} end if type(rec) ~= "table" then rec = { rec } end -- set record's name. if name == nil then name = rec_type end rec.name = name -- record's symbol scope rec.scope = scope rec._symbol_map = {} rec._imports = {} -- make "rec" into a record. rec._rec_type = rec_type setmetatable(rec, rec_meta) -- complete partial child records. for i=1,#rec do local val = rec[i] if type(val) == 'function' then val = end_record(val) rec[i] = val end end -- remove this record's child records from the root list. remove_child_records_from_roots(rec) -- add this record to the root list. root_records[#root_records + 1] = rec group_add_record(rec, rec_type) return rec end -- -- Record parser -- local function record_parser(callbacks, name) name = name or "parse" local function call_meth(self, rec_type, post, rec, parent) local func = self[rec_type .. post] if func == nil then func = self["unknown" .. post] if func == nil then return end end return func(self, rec, parent) end local seen={} callbacks = setmetatable(callbacks, { __call = function(self, rec, parent) -- make sure it is a valid record. if not is_record(rec) or seen[rec] or rec._rec_type == "ignore" then return end if parent then parent:count_sub_record(rec) -- count sub-records. end -- keep track of records we have already processed seen[rec] = true local rec_type = rec._rec_type -- clear record's data output & sub-record counts. rec:clear() -- start record. call_meth(self, rec_type, "", rec, parent) -- transverse into sub-records for _,v in ipairs(rec) do self(v, rec) end -- end record call_meth(self, rec_type, "_end", rec, parent) -- update "last_type" self.last_type = rec_type end }) return callbacks end function process_records(parser) record_parser(parser) -- process each root record for i=1,#root_records do parser(root_records[i]) end return parser end local stages = {} function reg_stage_parser(stage, parser) local parsers = stages[stage] if parsers == nil then -- new stage add it to the end of the stage list. stages[#stages + 1] = stage parsers = {} stages[stage] = parsers end parsers[#parsers + 1] = parser end -- setup default stages local default_stages = { "symbol_map", "imports" } -- run all parser stages. function run_stage_parsers() for i=1,#stages do local stage = stages[i] local parsers = stages[stage] for x=1,#parsers do process_records(parsers[x]) end end end function move_recs(dst, src, idx) -- move records from "rec" to it's parent for i=1,#src do local rec = src[i] if is_record(rec) and rec._rec_type ~= "ignore" then src:remove_record(rec) -- remove from src if idx then dst:insert_record(rec, idx) -- insert into dst idx = idx + 1 else dst:add_record(rec) -- add to dst end end end -- now delete this empty container record src:delete_record() end -- -- Record functions -- Used to create new records. -- function make_generic_rec_func(rec_type, no_name) if _G[rec_type] ~= nil then error("global already exists with that name: " .. rec_type) end if not no_name then _G[rec_type] = function(name) return function(rec) rec = make_record(rec, rec_type, name) return rec end end else _G[rec_type] = function(rec) rec = make_record(rec, rec_type, rec_type) return rec end end end local path_char = package.config:sub(1,1) local path_match = '(.*)' .. path_char local path_stack = {''} function subfile_path(filename) local level = #path_stack local cur_path = path_stack[level] or '' return cur_path .. filename end function subfiles(files) local level = #path_stack local cur_path = path_stack[level] local rc level = level + 1 -- use a new roots list to catch records from subfiles local prev_roots = root_records root_records={} -- process subfiles for i=1,#files do local file = files[i] -- add current path to file file = cur_path .. file -- seperate file's path from the filename. local file_path = file:match(path_match) or '' if #file_path > 0 then file_path = file_path .. path_char end -- push the file's path onto the path_stack only if it is different. if cur_path ~= file_path then path_stack[level] = file_path end -- check file path print("Parsing records from file: " .. file) rc = {dofile(file)} -- pop path if cur_path ~= file_path then path_stack[level] = nil end end -- move sub-records into new array local rec={} for i=1,#root_records do rec[i] = root_records[i] end -- switch back to previous roots list root_records = prev_roots -- make this into a record holding the sub-records from each of the sub-files rec = make_record(rec, "subfiles") if #rc > 0 then return rec, rc end return rec end -- process some container records reg_stage_parser("containers", { subfiles = function(self, rec, parent) local idx = parent:find_record(rec) move_recs(parent, rec, idx) end, }) local subfolders={} function subfolder(folder) return function(...) local files=select(1, ...) if type(files) ~= 'table' then files = {...} end -- push subfolder subfolders[#subfolders+1] = folder -- build full path folder = table.concat(subfolders, "/") .. "/" for i=1,#files do files[i] = folder .. files[i] end -- use subfile record. local rec = subfiles(files) -- pop subfolder subfolders[#subfolders] = nil return rec end end function import(name) rec = make_record({}, "import", name) return rec end -- resolve imports reg_stage_parser("imports", { import = function(self, rec, parent) end, }) <|start_filename|>native_objects/gen_simple.lua<|end_filename|> -- Copyright (c) 2010 by <NAME> <<EMAIL>> -- -- Permission is hereby granted, free of charge, to any person obtaining a copy -- of this software and associated documentation files (the "Software"), to deal -- in the Software without restriction, including without limitation the rights -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -- copies of the Software, and to permit persons to whom the Software is -- furnished to do so, subject to the following conditions: -- -- The above copyright notice and this permission notice shall be included in -- all copies or substantial portions of the Software. -- -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -- THE SOFTWARE. -- -- dump info -- --[[ print"============ Dump types =================" for k,v in pairs(types) do local lang_type = v.lang_type if lang_type == nil then lang_type = 'userdata' end print(v.c_type .. '\t(' .. k .. ')' .. '\tlua: ' .. lang_type) end ]] print"============ Dump objects =================" local function find_ret(rec) for i=1,#rec do local v = rec[i] if is_record(v) and v._rec_type == 'var_out' then return v; end end return { c_type = "void" } end process_records{ object = function(self, rec, parent) print("object " .. rec.name .. "{") --print(dump(rec)) end, property = function(self, rec, parent) print(rec.c_type .. " " .. rec.name .. "; /* is='" .. rec.is .. "', isa='" .. rec.isa .. "' */") end, include = function(self, rec, parent) print('#include "' .. rec.file .. '"') end, option = function(self, rec, parent) print("/* option: " .. rec.name .. " */") end, object_end = function(self, rec, parent) print("}\n") end, c_function = function(self, rec, parent) local ret = find_ret(rec) io.write(ret.c_type .. " " .. rec.name .. "(") end, c_function_end = function(self, rec, parent) print(")") end, var_in = function(self, rec, parent) if parent._first_var ~= nil then io.write(', ') else parent._first_var = true end io.write(rec.c_type .. " " .. rec.name) end, } <|start_filename|>examples/bench/wrapped_callback.nobj.lua<|end_filename|> -- -- C code for TestObj object -- c_source "typedefs" [[ typedef struct TestObj TestObj; typedef int (*TestObjFunc)(TestObj *obj, int idx); struct TestObj { uint32_t some_state; TestObjFunc func; }; void testobj_init(TestObj *obj, TestObjFunc func) { obj->some_state = 0xDEADBEEF; obj->func = func; } void testobj_destroy(TestObj *obj) { assert(obj->some_state == 0xDEADBEEF); } int testobj_run(TestObj *obj, int run) { int rc = 0; int i; for(i = 0; i < run; i++) { rc = obj->func(obj, i); if(rc < 0) break; } return rc; } ]] -- define a C callback function type: callback_type "TestObjFunc" "int" { "TestObj *", "%this", "int", "idx" } -- callback_type "<callback typedef name>" "<callback return type>" { -- -- call back function parameters. -- "<param type>", "%<param name>", -- the '%' marks which parameter holds the wrapped object. -- "<param type>", "<param name>", -- } object "TestObj" { -- create object constructor { -- Create an object wrapper for the "TestObj" which will hold a reference to the -- lua_State & Lua callback function. callback { "TestObjFunc", "func", "this", -- C code to run if Lua callback function throws an error. c_source[[${ret} = -1;]], ffi_source[[${ret} = -1;]], }, -- callback { "<callback typedef name>", "<callback parameter name>", "<parameter to wrap>", -- -- c_source/ffi_source/c_call/etc... for error handling. -- }, c_call "void" "testobj_init" { "TestObj *", "this", "TestObjFunc", "func" }, }, -- destroy object destructor "close" { c_method_call "void" "testobj_destroy" {}, }, method "run" { c_method_call "int" "testobj_run" { "int", "num" }, }, } <|start_filename|>examples/run_bench.lua<|end_filename|> local bench = require"bench" local zmq = require"zmq" local N = tonumber(arg[1] or 10000000) local function run_bench(action_name, N, func) local timer = zmq.stopwatch_start() func() local elapsed = timer:stop() if elapsed == 0 then elapsed = 1 end local throughput = N / (elapsed / 1000000) print(string.format("finished in %i sec, %i millisec and %i microsec, %i '%s'/s", (elapsed / 1000000), (elapsed / 1000) % 1000, (elapsed % 1000), throughput, action_name )) end -- -- Run benchmarks of method calls. -- local test = bench.method_call() run_bench('C API method calls', N, function() for i=1,N do test:simple() end end) run_bench('null method calls', N, function() for i=1,N do test:null() end end) -- -- Run benchmarks of C callbacks. -- local function callback(idx) return 0 end local test = bench.TestObj(callback) run_bench('wrapped state C callback', N, function() test:run(N) end) -- -- Run benchmarks of no wrap state C callbacks. -- local function callback(idx) return 0 end local test = bench.NoWrapTestObj() test:register(callback) run_bench('no wrap state C callback', N, function() test:run(N) end) <|start_filename|>native_objects.lua<|end_filename|> -- Copyright (c) 2012 by <NAME> <<EMAIL>> -- -- Permission is hereby granted, free of charge, to any person obtaining a copy -- of this software and associated documentation files (the "Software"), to deal -- in the Software without restriction, including without limitation the rights -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -- copies of the Software, and to permit persons to whom the Software is -- furnished to do so, subject to the following conditions: -- -- The above copyright notice and this permission notice shall be included in -- all copies or substantial portions of the Software. -- -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -- THE SOFTWARE. -- add path of native_objects.lua to package.path local native_objects_path=(arg[0]):gsub("native_objects.lua", "?.lua;") package.path = package.path .. ";" .. native_objects_path require("record") local tconcat=table.concat local tremove=table.remove local assert=assert local error=error local type=type local io=io local print=print local pairs=pairs local dofile=dofile local tostring=tostring local require=require -- -- Switch language we are generating bindings for. -- gen_lang="lua" -- gen_module module local gen_module="dump" -- global mapping of c_types to records. local c_types={} local function reset() clear_all_records() c_types={} end -- -- C-Type functions -- local function strip_c_type(c_type) -- strip const from c_type c_type = c_type:gsub("^%s*const%s*","") -- strip spaces from c_type c_type = c_type:gsub("%s*","") return c_type end function new_c_type(c_type, rec) c_type = strip_c_type(c_type) local old = c_types[c_type] if old and old ~= rec then print("WARNING changing c_type:", c_type, "from:", old, "to:", rec) end c_types[c_type] = rec end local function real_c_type_resolver(self) local c_type = self._c_type local _type = c_types[c_type] -- if type unknown see if it is a pointer. if _type == nil and c_type ~= "void*" and c_type:find("*",1,true) ~= nil then -- map it to a generic pointer. print("WARNING maping un-resolved pointer type '" .. c_type .."' to 'void *'") return resolve_c_type("void*") end if _type == nil then print("Unkown type: " .. c_type) return _type end rawset(self, "_type", _type) _type._in_use = true return _type end local resolve_meta = { __index = function(self, key) local _type = rawget(self, "_type") -- check for cached type. if _type == nil then -- try to resolve c_type dynamically _type = real_c_type_resolver(self) end if _type then return _type[key] else print("type not resolved yet: " .. self._c_type) end return nil end, __newindex = function(self, key, value) local _type = rawget(self, "_type") -- check for cached type. if _type == nil then -- try to resolve c_type dynamically _type = real_c_type_resolver(self) end if _type then _type[key] = value else print("type not resolved yet: " .. self._c_type) end end, __len = function(self) local _type = rawget(self, "_type") -- check for cached type. if _type == nil then -- try to resolve c_type dynamically _type = real_c_type_resolver(self) end if _type then return #_type else error("type not resolved yet: " .. self._c_type) end end, __eq = function(op1, op2) return op1._c_type == op2._c_type end, } local cache_resolvers={} function resolve_c_type(c_type) local c_type = strip_c_type(c_type) local resolver = cache_resolvers[c_type] if resolver == nil then resolver = {_c_type = c_type} setmetatable(resolver, resolve_meta) cache_resolvers[c_type] = resolver end return resolver end local function is_resolver(val) return (getmetatable(val) == resolve_meta) end function resolve_rec(rec) if rec.c_type ~= nil and rec.c_type_rec == nil then rec.c_type_rec = resolve_c_type(rec.c_type) end end reg_stage_parser("resolve_types", { unknown = function(self, rec, parent) -- find all c_type resolvers. for key,val in pairs(rec) do -- force all types to be resolved. if is_resolver(val) then rec[key] = real_c_type_resolver(val) end end end, }) -- -- Record functions -- Used to create new records. -- local function ctype(name, rec, rec_type) rec = make_record(rec, rec_type) -- record's c_type rec.name = name rec.c_type = name rec._is_c_type = true -- map the c_type to this record new_c_type(name, rec) return rec end function basetype(name) return function (lang_type) return function (default) -- make it an basetype record. local rec = ctype(name,{},"basetype") -- lang type rec.lang_type = lang_type -- default value rec.default = default return rec end end end function doc(text) return make_record({ text = text }, 'doc') end function error_code(name) return function (c_type) return function (rec) -- make error_code record ctype(name,rec,"error_code") rec.c_type = c_type -- mark this type as an error code. rec._is_error_code = true end end end function object(name) return function (rec) -- make it an object record. local userdata_type = rec.userdata_type or 'generic' rec.userdata_type = userdata_type rec.has_obj_flags = true if userdata_type == 'generic' or userdata_type == 'embed' or userdata_type == 'simple ptr' then ctype(name .. " *", rec,"object") rec.is_ptr = true rec.name = name -- map the c_type to this record new_c_type(name, rec) if userdata_type == 'embed' or userdata_type == 'simple ptr' then rec.no_weak_ref = true rec.has_obj_flags = false end else rec.no_weak_ref = true if userdata_type == 'simple' or userdata_type == 'simple ptr' then rec.has_obj_flags = false end ctype(name, rec, "object") end -- check object type flags. if rec.no_weak_ref == nil then rec.no_weak_ref = false end -- check if this type generates errors on NULLs if rec.error_on_null then -- create 'is_error_check' code rec.is_error_check = function(rec) return "(NULL == ${" .. rec.name .. "})" end rec.ffi_is_error_check = function(rec) return "(nil == ${" .. rec.name .. "})" end end return rec end end function import_object(mod) return function (name) return function (rec) rec = rec or {} local userdata_type = rec.userdata_type or 'generic' rec.userdata_type = userdata_type if userdata_type == 'generic' or userdata_type == 'embed' or userdata_type == 'simple ptr' then ctype(name .. " *", rec,"import_object") rec.is_ptr = true rec.name = name -- map the c_type to this record new_c_type(name, rec) else ctype(name, rec, "import_object") end -- external module name. rec.mod_name = mod return rec end end end function interface(name) return function (rec) local rec = ctype(name, rec,"interface") rec.name = name rec.is_interface = true return rec end end function interface_method(return_type) return function (name) return function (params) local rec = make_record({}, "interface_method") rec.is_interface_method = true -- function type name. rec.name = name -- parse return c_type. rec.ret = return_type or "void" -- parse params if params == nil then params = {} end rec.params = params return rec end end end function implements(name) return function (rec) local rec = make_record(rec, "implements") rec.is_implements = true -- interface name rec.name = name rec.interface_rec = resolve_c_type(rec.name) return rec end end function implement_method(name) return function (rec) local rec = make_record(rec, "implement_method") rec.name = name return rec end end function submodule(name) return function (rec) rec = object(name)(rec) rec.register_as_submodule = true return rec end end function package(name) if type(name) == 'table' then local rec = name rec = object('_MOD_GLOBAL_')(rec) rec.is_package = true rec.is_mod_global = true return rec end return function (rec) rec = object(name)(rec) rec.is_package = true return rec end end function meta_object(name) return function (rec) rec = object(name)(rec) rec.is_package = true rec.is_meta = true return rec end end function extends(name) return function (rec) rec = make_record(rec, "extends") -- base object name rec.name = name -- check for cast_type if rec.cast_type == nil then rec.cast_offset = 0 rec.cast_type = 'direct' end return rec end end function dyn_caster(rec) rec = make_record(rec, "dyn_caster") return rec end function option(name) return function (rec) rec = make_record(rec, "option") -- option name. rec.name = name return rec end end function field(c_type) return function (name) return function (rec) local access = rec and rec[1] or nil rec = make_record(rec, "field") -- field's c_type rec.c_type = c_type -- field's name rec.name = name -- access permissions if type(access) == 'string' then access = access:lower() -- check for write access if access == 'rw' then rec.is_writable = true elseif access == 'ro' then rec.is_writable = false else rec.is_writable = false end elseif rec.is_writable == nil then rec.is_writable = false end return rec end end end function const(name) return function (rec) local value = rec[1] rec = make_record(rec, "const") -- field's name rec.name = name -- field's value rec.value = value return rec end end function const_def(name) return function (rec) local value = rec[1] rec = make_record(rec, "const") -- this is a constant definition. rec.is_define = true -- default to 'number' type. rec.vtype = rec.vtype or 'number' -- field's name rec.name = name -- field's value rec.value = value return rec end end function constants(values) local rec = make_record({}, "constants") rec.values = values return rec end function export_definitions(values) if type(values) == 'string' then local name = values return function(values) return package(name)({ map_constants_bidirectional = true, export_definitions(values) }) end end local rec = make_record({}, "export_definitions") rec.values = values return rec end function include(file) local rec = {} rec = make_record(rec, "include") rec.is_system = false rec.file = file return rec end function sys_include(file) local rec = {} rec = make_record(rec, "include") rec.is_system = true rec.file = file return rec end function c_function(name) return function (rec) rec = make_record(rec, "c_function") -- function name. rec.name = name -- function type (normal function or object method) rec.f_type = "function" -- variable lookup rec.get_var = function(self, name) for i=1,#self do local var = self[i] if is_record(var) and var.name == name then return var end end return nil end return rec end end local meta_methods = { __str__ = true, __eq__ = true, -- Lua metamethods __add = true, __sub = true, __mul = true, __div = true, __mod = true, __pow = true, __unm = true, __len = true, __concat = true, __eq = true, __lt = true, __le = true, __gc = true, __tostring = true, __index = true, __newindex = true, } function method(name) return function (rec) -- handle the same way as normal functions rec = c_function(name)(rec) -- mark this function as a method. rec._is_method = true -- if the method is a destructor, then also make it a meta method -- to be used for garbagecollection if rec.is_destructor then rec._is_meta_method = true end rec.f_type = "method" -- check if method is a meta-method. rec._is_meta_method = meta_methods[rec.name] return rec end end function constructor(name) return function (rec) if type(name) == 'table' then rec = name; name = 'new' end -- handle the same way as normal method rec = method(name)(rec) -- mark this method as the constructor rec.is_constructor = true return rec end end function destructor(name) return function (rec) if type(name) == 'table' then rec = name rec._is_hidden = true name = 'delete' end -- handle the same way as normal method rec = method(name)(rec) -- mark this method as the destructor rec.is_destructor = true -- also register it as a metamethod for garbagecollection. rec._is_meta_method = true return rec end end function method_new(rec) return constructor(rec) end function method_delete(rec) return destructor(rec) end function define(name) return function(value) local rec = make_record({}, "define") rec.name = name rec.value = value return rec end end function c_source(part) return function(src) if src == nil then src = part part = nil end local rec = make_record({}, "c_source") rec.part = part or "src" rec.src = src return rec end end local function strip_variable_tokens(val, tokens) local prefix, val, postfix = val:match("^([!@&*(?#]*)([%w_ *]*)([@?)<>]*[0-9]*)") return prefix .. (tokens or '') .. postfix, val end function clean_variable_type_name(vtype,vname) local tokens tokens, vtype = strip_variable_tokens(vtype) tokens, vname = strip_variable_tokens(vname) return vtype, vname end local function parse_variable_name(var) -- no parsing needed for '<any>' if var.c_type == '<any>' then return end -- strip tokens from variable name & c_type local tokens, name, c_type tokens, name = strip_variable_tokens(var.name) tokens, c_type = strip_variable_tokens(var.c_type, tokens) -- set variable name to stripped name var.name = name var.c_type = c_type -- parse prefix & postfix tokens local n=1 local len = #tokens while n <= len do local tok = tokens:sub(n,n) n = n + 1 if tok == '*' then assert(var.wrap == nil, "Variable already has a access wrapper.") var.wrap = '*' elseif tok == '&' then assert(var.wrap == nil, "Variable already has a access wrapper.") var.wrap = '&' elseif tok == '#' then var.is_length_ref = true var.length = var.name .. '_len' -- default name for length variable. elseif tok == '?' then var.is_optional = true -- eat the rest of the tokens as the default value. if n <= len then var.default = tokens:sub(n) end break elseif tok == '!' then var.own = true elseif tok == '@' then var.is_ref_field = true error("`@ref_name` not yet supported.") elseif tok == '<' or tok == '>' then local idx = tokens:match('([0-9]*)', n) assert(idx, "Variable already has a stack order 'idx'") var.idx = tonumber(idx) if tok == '>' then -- force this variable to an output type. var._rec_type = 'var_out' else assert(var._rec_type == 'var_in', "Can't make an output variable into an input variable.") end -- skip index value. if idx then n = n + #idx end elseif tok == '(' or tok == ')' then var._rec_type = 'var_out' var.is_temp = true end end -- do some validation. if var.own then assert(var._rec_type == 'var_out', "Only output variables can be marked as 'owned'.") end end function var_out(rec) rec = make_record(rec, "var_out") -- out variable's c_type rec.c_type = tremove(rec, 1) -- out variable's name rec.name = tremove(rec, 1) -- parse tags from name. parse_variable_name(rec) -- check if variable has/needs a length variable. if rec.length or (rec.need_buffer and rec.has_length == nil) then rec.has_length = true end if rec.has_length then rec.length = rec.length or (rec.name .. '_len') end resolve_rec(rec) return rec end function var_in(rec) rec = make_record(rec, "var_in") -- in variable's c_type rec.c_type = tremove(rec, 1) -- in variable's name rec.name = tremove(rec, 1) -- parse tags from name. parse_variable_name(rec) resolve_rec(rec) return rec end function tmp_var(rec) rec = var_out(rec) rec.is_temp = true return rec end -- A reference to another var_in/var_out variable. -- This is used by `c_call` records. function var_ref(var) local rec = {} -- copy details from var_* record for k,v in pairs(var) do rec[k] = v end -- make variable reference. rec = make_record(rec, "var_ref") -- in variable's c_type rec.c_type = var.c_type -- in variable's name rec.name = var.name resolve_rec(rec) return rec end function c_call(return_type) return function (cfunc) return function (params) local rec = make_record({}, "c_call") -- parse return c_type. rec.ret = return_type or "void" -- parse c function to call. rec.cfunc = cfunc -- parse params rec.params = params if rec.params == nil then rec.params = {} end return rec end end end function c_macro_call(ret) return function (cfunc) return function (params) local rec = c_call(ret)(cfunc)(params) rec.ffi_need_wrapper = "c_wrap" rec.is_macro_call = true return rec end end end function c_inline_call(ret) return function (cfunc) return function (params) local rec = c_call(ret)(cfunc)(params) rec.ffi_need_wrapper = "c_wrap" rec.is_inline_call = true return rec end end end function c_export_call(ret) return function (cfunc) return function (params) local rec = c_call(ret)(cfunc)(params) rec.ffi_need_wrapper = "c_export" rec.is_export_call = true return rec end end end function c_method_call(ret) return function (cfunc) return function (params) local rec = c_call(ret)(cfunc)(params) rec.is_method_call = true return rec end end end function c_export_method_call(ret) return function (cfunc) return function (params) local rec = c_method_call(ret)(cfunc)(params) rec.ffi_need_wrapper = "c_export" rec.is_export_call = true return rec end end end function c_macro_method_call(ret) return function (cfunc) return function (params) local rec = c_method_call(ret)(cfunc)(params) rec.ffi_need_wrapper = "c_wrap" rec.is_macro_call = true return rec end end end function callback_type(name) return function (return_type) return function (params) local rec = make_record({}, "callback_type") rec.is_callback = true -- function type name. rec.name = name -- c_type for callback. rec.c_type = name -- parse return c_type. rec.ret = return_type or "void" -- parse params if params == nil then params = {} end rec.params = params -- add new types new_c_type(rec.c_type, rec) return rec end end end function callback(c_type) if type(c_type) == 'table' then local rec = var_in(c_type) rec.is_callback = true rec.is_ref = true rec.ref_field = rec.name -- other variable that will be wrapped to hold callback state information. rec.state_var = tremove(rec, 1) if rec.state_var == 'this' then rec.wrap_state = true rec.owner = 'this' end return rec end return function (name) return function (state_var) return callback({c_type, name, state_var}) end end end function callback_state(base_type, wrap_state) -- cleanup base_type base_type = base_type:gsub("[ *]","") -- create name for new state type local name = base_type .. "_cb_state" -- make it an callback_state record. local rec = make_record({}, "callback_state") -- the wrapper type rec.wrap_type = name -- base_type we are wrapping. rec.base_type = base_type rec.wrap_state = wrap_state -- c_type we are wrapping. (pointer to base_type) rec.c_type = name .. " *" -- resolve base_type rec.base_type_rec = resolve_c_type(rec.base_type) -- add new types new_c_type(rec.c_type, rec) return rec end function callback_func(c_type) return function (name) local rec = make_record({}, "callback_func") rec.is_ref = true rec.ref_field = name -- c_type for callback. rec.c_type = c_type -- callback variable's name rec.name = name -- callback function name. rec.c_func_name = c_type .. "_" .. name .. "_cb" resolve_rec(rec) return rec end end function cb_out(rec) rec = make_record(rec, "cb_out") -- out variable's c_type rec.c_type = tremove(rec, 1) -- out variable's name rec.name = tremove(rec, 1) resolve_rec(rec) return rec end function cb_in(rec) rec = make_record(rec, "cb_in") -- in variable's c_type rec.c_type = tremove(rec, 1) -- in variable's name local name = tremove(rec, 1) -- check if this is a wrapped object parameter. if name:sub(1,1) == '%' then rec.is_wrapped_obj = true; name = name:sub(2) end rec.name = name resolve_rec(rec) return rec end function c_module(name) return function (rec) rec = make_record(rec, "c_module") -- c_module name. rec.name = name return rec end end function lang(name) return function (rec) rec.name = name rec = make_record(rec, "lang") -- only keep records for current language. if rec.name ~= gen_lang then -- delete this record and it sub-records rec:delete_record() end return rec end end function ffi(rec) return make_record(rec, "ffi") end function ffi_files(rec) for i=1,#rec do rec[i] = subfile_path(rec[i]) end return make_record(rec, "ffi_files") end function ffi_source(part) return function(src) if src == nil then src = part part = nil end local rec = make_record({}, "ffi_source") rec.part = part or "ffi_src" rec.src = src return rec end end function ffi_typedef(cdef) return ffi_source("ffi_typedef")(cdef) end function ffi_cdef(cdef) return ffi_source("ffi_cdef")(cdef) end function ffi_load(name) if type(name) == 'table' then local default_lib = name[1] or name.default local src = { 'local os_lib_table = {\n' } local off = #src for k,v in pairs(name) do if type(k) == 'string' and type(v) == 'string' then off = off + 1; src[off] = '\t["' off = off + 1; src[off] = k off = off + 1; src[off] = '"] = "' off = off + 1; src[off] = v off = off + 1; src[off] = '",\n' end end off = off + 1; src[off] = '}\n' off = off + 1; src[off] = 'C = ffi_load(os_lib_table[ffi.os]' if type(default_lib) == 'string' then off = off + 1; src[off] = ' or "' off = off + 1; src[off] = default_lib off = off + 1; src[off] = '"' end if name.global then off = off + 1; src[off] = ', true' end off = off + 1; src[off] = ')\n' return ffi_source("ffi_src")(tconcat(src)) end return function (global) if global == nil then global = false end global = tostring(global) local src = 'C = ffi_load("' .. name .. '",' .. global .. ')\n' return ffi_source("ffi_src")(src) end end function ffi_export(c_type) return function (name) local rec = make_record({}, "ffi_export") -- parse c_type. rec.c_type = c_type -- parse name of symbol to export rec.name = name return rec end end function ffi_export_function(return_type) return function (name) return function (params) local rec = make_record({}, "ffi_export_function") -- parse return c_type. rec.ret = return_type or "void" -- parse c function to call. rec.name = name -- parse params rec.params = params if rec.params == nil then rec.params = {} end return rec end end end -- -- End records functions -- local module_file = nil local outpath = "" local outfiles = {} function get_outfile_name(ext) local filename = module_file .. ext return outpath .. filename end function open_outfile(filename, ext) local filename = (filename or module_file) .. (ext or '') local file = outfiles[filename] if file == nil then file = assert(io.open(outpath .. filename, "w+")) outfiles[filename] = file end return file end function get_outpath(path) return (outpath or './') .. (path or '') end function close_outfiles() for name,file in pairs(outfiles) do io.close(file) outfiles[name] = nil end end require("native_objects.stages") local function process_module_file(file) -- clear root_records & c_types reset() -- -- load language module -- require("native_objects.lang_" .. gen_lang) -- -- load basic interfaces -- require("native_objects.interfaces") module_file = file:gsub("(.lua)$","") print("module_file", module_file) print("Parsing records from file: " .. file) dofile(file) -- -- run stage parsers -- run_stage_parsers() -- -- load gen. module -- print"============ generate api bindings =================" if gen_module ~= "null" then require("native_objects.gen_" .. gen_module) end close_outfiles() end -- -- parse command line options/files -- local len=#arg local i=1 while i <= len do local a=arg[i] local eat = 0 i = i + 1 if a:sub(1,1) ~= "-" then process_module_file(a) else if a == "-gen" then gen_module = arg[i] eat = 1 elseif a == "-outpath" then outpath = arg[i] if outpath:sub(-1,-1) ~= "/" then outpath = outpath .. "/" end eat = 1 elseif a == "-lang" then gen_lang = arg[i] eat = 1 else print("Unkown option: " .. a) end end i = i + eat end <|start_filename|>native_objects/interfaces.lua<|end_filename|> -- Copyright (c) 2012 by <NAME> <<EMAIL>> -- -- Permission is hereby granted, free of charge, to any person obtaining a copy -- of this software and associated documentation files (the "Software"), to deal -- in the Software without restriction, including without limitation the rights -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -- copies of the Software, and to permit persons to whom the Software is -- furnished to do so, subject to the following conditions: -- -- The above copyright notice and this permission notice shall be included in -- all copies or substantial portions of the Software. -- -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -- THE SOFTWARE. -- Immutable Buffer interface interface "Buffer" { interface_method "const uint8_t *" "const_data" {}, interface_method "size_t" "get_size" {}, } -- Mutable Buffer interface interface "MutableBuffer" { interface_method "uint8_t *" "data" {}, interface_method "size_t" "get_size" {}, } -- object type for file descriptors interface "FD" { interface_method "int" "get_fd" {}, -- 0 = file, 1 = socket, -1 = other/unknown interface_method "int" "get_type" {}, } -- -- -- Stage parser to handle interface records. -- -- local tconcat = table.concat reg_stage_parser("containers",{ interface = function(self, rec, parent) rec:add_var("interface_name", rec.name) -- check if the interface was defined outside any other record. if not parent then rec.is_global = true end rec.methods = {} rec.method_idx = 0 rec:write_part("interface", { "typedef struct ${interface_name}_if {\n", }) end, interface_end = function(self, rec, parent) local parts = { "interface", "defines"} rec:write_part("interface", { "} ${interface_name}IF;\n", }) rec:write_part("defines", [[ /* a per-module unique pointer for fast lookup of an interface's implementation table. */ static char obj_interface_${interface_name}IF[] = "${interface_name}IF"; #define ${interface_name}IF_VAR(var_name) \ ${interface_name}IF *var_name ## _if; \ void *var_name; #define ${interface_name}IF_LUA_OPTIONAL(L, _index, var_name) \ var_name = obj_implement_luaoptional(L, _index, (void **)&(var_name ## _if), \ obj_interface_${interface_name}IF) #define ${interface_name}IF_LUA_CHECK(L, _index, var_name) \ var_name = obj_implement_luacheck(L, _index, (void **)&(var_name ## _if), \ obj_interface_${interface_name}IF) ]]) rec:write_part("ffi_obj_type", { [[ local obj_type_${interface_name}_check = obj_get_interface_check("${interface_name}IF", "Expected object with ${interface_name} interface") ]]}) rec:vars_parts(parts) rec:add_record(c_source("typedefs")( rec:dump_parts(parts) )) -- -- FFI code -- rec:add_record(ffi_source("ffi_pre_cdef")({ 'ffi_safe_cdef("', rec.name, 'IF", [[\n', rec:dump_parts("interface"), ']])\n', })) local ffi_parts = { "ffi_obj_type" } rec:vars_parts(ffi_parts) for i=1,#ffi_parts do local part = ffi_parts[i] rec:add_record(ffi_source(part)( rec:dump_parts(part) )) end end, interface_method = function(self, rec, parent) assert(parent.is_interface, "Can't have interface_method record in a non-interface parent.") assert(not parent.methods[rec.name], "Duplicate interface method.") parent.methods[rec.name] = rec -- record order of interface methods. local idx = parent.method_idx + 1 parent.method_idx = idx rec.idx = idx local psrc = { "(void *this_v" } -- method parameters local params = rec.params local names = { } for i=1,#params,2 do local c_type = params[i] local name = params[i + 1] psrc[#psrc + 1] = ", " psrc[#psrc + 1] = c_type psrc[#psrc + 1] = " " psrc[#psrc + 1] = name names[#names + 1] = name end psrc[#psrc + 1] = ")" psrc = tconcat(psrc) if #names > 0 then names = ", " .. tconcat(names, ", ") else names = "" end -- add method to interface structure. parent:write_part("interface", { " ", rec.ret, " (* const ", rec.name, ")", psrc, ";\n" }) -- create function decl for method. rec.func_name = "${object_name}_${interface_name}_" .. rec.name rec.func_decl = rec.ret .. " " .. rec.func_name .. psrc rec.param_names = names end, implements = function(self, rec, parent) local interface = rec.interface_rec rec:add_var("interface_name", rec.name) rec.c_type = parent.c_type rec.is_ptr = parent.is_ptr rec.if_methods = interface.methods rec.methods = {} rec:write_part("src", [[ /** * ${object_name} implements ${interface_name} interface */ ]]) rec:write_part("ffi_src", [[ -- ${object_name} implements ${interface_name} interface do local impl_meths = obj_register_interface("${interface_name}IF", "${object_name}") ]]) end, implements_end = function(self, rec, parent) local interface = rec.interface_rec local max_idx = interface.method_idx local define = { "\nstatic const ${interface_name}IF ${object_name}_${interface_name} = {\n", } local methods = rec.methods for idx=1,max_idx do local meth = methods[idx] if idx == 1 then define[#define + 1] = " " else define[#define + 1] = ",\n " end if meth then define[#define + 1] = "${object_name}_${interface_name}_" .. meth.name else define[#define + 1] = "NULL" end end define[#define + 1] = "\n};\n" rec:write_part("src", define) rec:write_part("ffi_src", { 'end\n', }) rec:write_part("regs", [[ { "${interface_name}IF", &(${object_name}_${interface_name}) }, ]]) local parts = { "src", "ffi_src", "regs" } rec:vars_parts(parts) parent:add_record(c_source("implements")( rec:dump_parts("src") )) parent:add_record(c_source("implement_regs")( rec:dump_parts("regs") )) parent:add_record(ffi_source("ffi_src")( rec:dump_parts("ffi_src") )) end, implement_method = function(self, rec, parent) local name = rec.name rec:add_var("this", "this_p") assert(parent.is_implements, "Can't have implement_method record in a non-implements parent.") local if_method = parent.if_methods[name] assert(if_method, "Interface doesn't contain this method.") local if_idx = if_method.idx assert(not parent.methods[if_idx], "Duplicate implement method.") parent.methods[if_idx] = rec -- generate code for method rec:write_part("src", { "/** \n", " * ${interface_name} interface method ", rec.name, "\n", " */\n", "static ", if_method.func_decl, " {\n", }) if parent.is_ptr then rec:write_part("src", { " ", parent.c_type, " ${this} = this_v;\n", }) else rec:write_part("src", { " ", parent.c_type, " ${this} = *((", parent.c_type ," *)this_v);\n", }) end if not rec.c_function then rec:write_part("ffi_src", { "-- ${interface_name} interface method ", rec.name, "\n", "function impl_meths.", rec.name, "(${this}", if_method.param_names, ")\n", }) if rec.constant then -- generate code to return ${this} rec:write_part("src", { " return ", rec.constant,";\n", }) rec:write_part("ffi_src", { " return ", rec.constant,"\n", }) elseif rec.return_this then -- generate code to return ${this} rec:write_part("src", { " return ${this};\n", }) rec:write_part("ffi_src", { " return ${this}\n", }) elseif rec.get_field then -- generate code to return a field from ${this} rec:write_part("src", { " return ${this}->", rec.get_field, ";\n", }) rec:write_part("ffi_src", { " return ${this}.", rec.get_field, "\n", }) end else -- wrap a C function that has the same parameters and return type. rec:write_part("src", { " return ", rec.c_function, "(${this}", if_method.param_names, ");\n", }) rec:write_part("ffi_src", { "-- ${interface_name} interface method ", rec.name, "\n", "impl_meths.", rec.name, " = C.", rec.c_function, "\n", }) end end, implement_method_end = function(self, rec, parent) rec:write_part("src", { "}\n", }) if not rec.c_function then rec:write_part("ffi_src", { "end\n", }) end local parts = { "src", "ffi_src" } rec:vars_parts(parts) parent:copy_parts(rec, parts) end, c_source = function(self, rec, parent) parent:write_part(rec.part, rec.src) end, ffi_source = function(self, rec, parent) parent:write_part(rec.part, rec.src) end, }) <|start_filename|>native_objects/lang_lua.lua<|end_filename|> -- Copyright (c) 2010 by <NAME> <<EMAIL>> -- -- Permission is hereby granted, free of charge, to any person obtaining a copy -- of this software and associated documentation files (the "Software"), to deal -- in the Software without restriction, including without limitation the rights -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -- copies of the Software, and to permit persons to whom the Software is -- furnished to do so, subject to the following conditions: -- -- The above copyright notice and this permission notice shall be included in -- all copies or substantial portions of the Software. -- -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -- THE SOFTWARE. -- -- C to Lua Base types -- basetype "bool" "boolean" "0" basetype "char" "integer" "0" basetype "unsigned char" "integer" "0" basetype "short" "integer" "0" basetype "unsigned short" "integer" "0" basetype "int" "integer" "0" basetype "unsigned" "integer" "0" basetype "unsigned int" "integer" "0" basetype "long" "integer" "0" basetype "unsigned long" "integer" "0" -- stdint types. basetype "int8_t" "integer" "0" basetype "int16_t" "integer" "0" basetype "int32_t" "integer" "0" basetype "int64_t" "integer" "0" basetype "uint8_t" "integer" "0" basetype "uint16_t" "integer" "0" basetype "uint32_t" "integer" "0" basetype "uint64_t" "integer" "0" basetype "size_t" "integer" "0" basetype "ssize_t" "integer" "0" basetype "off_t" "integer" "0" basetype "time_t" "integer" "0" basetype "float" "number" "0.0" basetype "double" "number" "0.0" basetype "char *" "string" "NULL" basetype "unsigned char *" "string" "NULL" basetype "void *" "lightuserdata" "NULL" basetype "uint8_t *" "lightuserdata" "NULL" basetype "lua_State *" "thread" "NULL" basetype "void" "nil" "NULL" basetype "<any>" "nil" "NULL" basetype "<table>" "table" "NULL" -- -- to/check/push/delete methods -- print"============ create Lua to/check/push/delete methods =================" local lua_base_types = { ['nil'] = { push = 'lua_pushnil' }, ['number'] = { to = 'lua_tonumber', opt = 'luaL_optnumber', check = 'luaL_checknumber', push = 'lua_pushnumber' }, ['integer'] = { to = 'lua_tointeger', opt = 'luaL_optinteger', check = 'luaL_checkinteger', push = 'lua_pushinteger' }, ['string'] = { to = 'lua_tolstring', opt = 'luaL_optlstring', check = 'luaL_checklstring', push = 'lua_pushstring', push_len = 'lua_pushlstring' }, ['boolean'] = { to = 'lua_toboolean', check = 'lua_toboolean', push = 'lua_pushboolean' }, ['thread'] = { to = 'lua_tothread', check = 'lua_tothread', push = 'lua_pushthread' }, ['lightuserdata'] = { to = 'lua_touserdata', check = 'lua_touserdata', push = 'lua_pushlightuserdata' }, } reg_stage_parser("lang_type_process", { basetype = function(self, rec, parent) local l_type = lua_base_types[rec.lang_type] if l_type == nil then return end rec._ffi_push = function(self, var, flags, unwrap) local wrap = var.ffi_wrap if wrap then return wrap .. '(${' .. var.name .. '})' .. (unwrap or '') else return '${' .. var.name .. '}' .. (unwrap or '') end end if rec.lang_type == 'string' then local cast = '' if rec.c_type ~= 'const char *' and rec.c_type ~= 'char *' then cast = '(' .. rec.c_type .. ')' end rec._to = function(self, var) return '${' .. var.name .. '} = ' .. cast .. l_type.to .. '(L,${' .. var.name .. '::idx},&(${' .. var.length .. '}));\n' end rec._define = function(self, var) return 'size_t ${' .. var.name .. '_len};\n' .. ' ' .. var.c_type .. ' ${' .. var.name .. '};\n' end rec._check = function(self, var) return '${' .. var.name .. '} = ' .. cast .. l_type.check .. '(L,${' .. var.name .. '::idx},&(${' .. var.name .. '_len}));\n' end rec._opt = function(self, var, default) if default then default = '"' .. default .. '"' else default = 'NULL' end return '${' .. var.name .. '} = ' .. cast .. l_type.opt .. '(L,${' .. var.name .. '::idx},' .. default .. ',&(${' .. var.name .. '_len}));\n' end rec._push = function(self, var) if var.has_length then return ' if(${' .. var.name .. '} == NULL) lua_pushnil(L);' .. ' else ' .. l_type.push_len .. '(L, ${' .. var.name .. '},' .. '${' .. var.length .. '});\n' end return ' ' .. l_type.push .. '(L, ${' .. var.name .. '});\n' end rec._ffi_define = function(self, var) return '' end rec._ffi_push = function(self, var) local pre = '${' .. var.name .. '} ~= nil and ffi_string(${' .. var.name .. '}' if var.has_length then return pre .. ',${' .. var.length .. '}) or nil' end return pre .. ') or nil' end rec._ffi_check = function(self, var) return 'local ${' .. var.name .. '_len} = #${' .. var.name .. '}\n' end rec._ffi_opt = function(self, var, default) if default then default = (' or %q'):format(tostring(default)) else default = '' end return '${' .. var.name .. '} = tostring(${' .. var.name .. '})' .. default .. '\n' .. ' local ${' .. var.name .. '_len} = ${' .. var.name .. '} and #${' .. var.name .. '} or 0\n' end else rec._to = function(self, var) return '${' .. var.name .. '} = ' .. l_type.to .. '(L,${' .. var.name .. '::idx});\n' end rec._define = function(self, var) return var.c_type .. ' ${' .. var.name .. '};\n' end rec._check = function(self, var) return '${' .. var.name .. '} = ' .. l_type.check .. '(L,${' .. var.name .. '::idx});\n' end rec._opt = function(self, var, default) default = default or '0' if l_type.opt then return '${' .. var.name .. '} = ' .. l_type.opt .. '(L,${' .. var.name .. '::idx},' .. default .. ');\n' end return '${' .. var.name .. '} = ' .. l_type.to .. '(L,${' .. var.name .. '::idx});\n' end rec._push = function(self, var) return ' ' .. l_type.push .. '(L, ${' .. var.name .. '});\n' end rec._ffi_define = function(self, var) return '' end rec._ffi_check = function(self, var) return '\n' end rec._ffi_opt = function(self, var, default) default = tostring(default or '0') return '${' .. var.name .. '} = ${' .. var.name .. '} or ' .. default .. '\n' end end end, error_code = function(self, rec, parent) local func_name = 'error_code__' .. rec.name .. '__push' rec.func_name = func_name -- create _push_error & _push function rec._push = function(self, var) return ' ' .. func_name ..'(L, ${' .. var.name .. '});\n' end rec._push_error = rec._push rec._ffi_push = function(self, var, flags, unwrap) return func_name ..'(${' .. var.name .. '})' .. (unwrap or '') end rec._ffi_push_error = rec._ffi_push end, import_object = function(self, rec, parent) rec.lang_type = 'userdata' local type_name = 'obj_type_' .. rec.name rec._obj_type_name = type_name -- create _check/_delete/_push functions rec._define = function(self, var) return var.c_type .. ' ${'..var.name..'};\n' end rec._check = function(self, var) return '${'..var.name..'} = '..type_name..'_check(L,${'..var.name..'::idx});\n' end rec._opt = function(self, var) return '${'..var.name..'} = '..type_name..'_optional(L,${'..var.name..'::idx});\n' end rec._delete = function(self, var, flags) error("Can't delete an imported type.") end rec._to = rec._check rec._push = function(self, var, flags) error("Can't push an imported type.") end rec._ffi_define = function(self, var) return '' end rec._ffi_check = function(self, var) local name = '${' .. var.name .. '}' return name .. ' = '..type_name..'_check('..name..')\n' end rec._ffi_opt = function(self, var) local name = '${' .. var.name .. '}' return name .. ' = '..name..' and '..type_name..'_check('..name..') or nil\n' end rec._ffi_delete = function(self, var, has_flags) error("Can't delete an imported type.") end rec._ffi_push = function(self, var, flags, unwrap) error("Can't push an imported type.") end end, object = function(self, rec, parent) rec.lang_type = 'userdata' local type_name = 'obj_type_' .. rec.name rec._obj_type_name = type_name -- create _check/_delete/_push functions rec._define = function(self, var) return var.c_type .. ' ${'..var.name..'};\n' end rec._check = function(self, var) return '${'..var.name..'} = '..type_name..'_check(L,${'..var.name..'::idx});\n' end rec._opt = function(self, var) return '${'..var.name..'} = '..type_name..'_optional(L,${'..var.name..'::idx});\n' end rec._delete = function(self, var, flags) if not flags then return '${'..var.name..'} = '..type_name..'_delete(L,${'..var.name..'::idx});\n' end return '${'..var.name..'} = '..type_name..'_delete(L,${'..var.name..'::idx},'..flags..');\n' end rec._to = rec._check rec._push = function(self, var, flags) if flags == false then return ' '..type_name..'_push(L, ${'..var.name..'});\n' end if flags == nil then flags = '0' end return ' '..type_name..'_push(L, ${'..var.name..'}, ' .. flags .. ');\n' end rec._ffi_define = function(self, var) return '' end rec._ffi_check = function(self, var) if not rec.subs then -- no sub-classes return rec._ffi_check_fast(self, var) end -- has sub-classes do extra casting if needed. if var.is_this then return 'local ${' .. var.name .. '} = '..type_name..'_check(self)\n' end local name = '${' .. var.name .. '}' return name .. ' = '..type_name..'_check('..name..')\n' end rec._ffi_opt = function(self, var) if var.is_this then return 'local ${' .. var.name .. '} = '..type_name..'_check(self)\n' end local name = '${' .. var.name .. '}' return name .. ' = '..name..' and '..type_name..'_check('..name..') or nil\n' end rec._ffi_delete = function(self, var, has_flags) if not has_flags then return 'local ${'..var.name..'} = '..type_name..'_delete(self)\n' end return 'local ${'..var.name..'},${'..var.name..'_flags} = '..type_name..'_delete(self)\n' end rec._ffi_push = function(self, var, flags, unwrap) if flags == false then return type_name..'_push(${'..var.name..'})' .. (unwrap or '') end if flags == nil then flags = '0' end return type_name..'_push(${'..var.name..'}, ' .. flags .. ')' .. (unwrap or '') end if rec.error_on_null then rec._push_error = function(self, var) return ' lua_pushstring(L, ' .. rec.error_on_null .. ');\n' end rec._ffi_push_error = function(self, var) return rec.error_on_null end end end, interface = function(self, rec, parent) rec.lang_type = 'userdata' local if_name = rec.name -- create _check/_delete/_push functions rec._define = function(self, var) return if_name..'IF_VAR(${'..var.name..'});\n' end rec._check = function(self, var) return if_name..'IF_LUA_CHECK(L,${'..var.name..'::idx}, ${'..var.name..'});\n' end rec._opt = function(self, var) return if_name..'IF_LUA_OPTIONAL(L,${'..var.name..'::idx}, ${'..var.name..'});\n' end rec._delete = function(self, var, flags) error("Can't delete an interface object.") end rec._to = rec._check rec._push = function(self, var, flags) error("Can't push an interface object.") end rec._ffi_define = function(self, var) return 'local ${' .. var.name .. '}_if' end rec._ffi_check = function(self, var) local name = '${' .. var.name .. '}' return name .. '_if = '..name..'.NOBJ_get_'..if_name..'IF' ..' or obj_type_'..if_name..'_check('..name..')\n' end rec._ffi_opt = function(self, var) local name = '${' .. var.name .. '}' return name .. '_if = '..name..' and ('..name..'.NOBJ_get_'..if_name..'IF' ..' or obj_type_'..if_name..'_check('..name..')) or nil\n' end rec._ffi_delete = function(self, var, has_flags) error("Can't delete an interface object.") end rec._ffi_push = function(self, var, flags, unwrap) error("Can't push an interface object.") end end, callback_func = function(self, rec, parent) rec.lang_type = 'function' -- create _check/_delete/_push functions rec._check = function(self, var) return 'lua_checktype_ref(L, ${' .. var.name .. '::idx}, LUA_TFUNCTION);\n' end rec._delete = nil rec._to = rec._check rec._push = function(self, var) return 'lua_rawgeti(L, LUA_REGISTRYINDEX, ' .. var .. ');\n' end end, }) <|start_filename|>native_objects/gen_lua_ffi.lua<|end_filename|> -- Copyright (c) 2010 by <NAME> <<EMAIL>> -- -- Permission is hereby granted, free of charge, to any person obtaining a copy -- of this software and associated documentation files (the "Software"), to deal -- in the Software without restriction, including without limitation the rights -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -- copies of the Software, and to permit persons to whom the Software is -- furnished to do so, subject to the following conditions: -- -- The above copyright notice and this permission notice shall be included in -- all copies or substantial portions of the Software. -- -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -- THE SOFTWARE. -- -- build LuaJIT FFI bindings -- local ffi_helper_types = [[ #if LUAJIT_FFI typedef int (*ffi_export_func_t)(void); typedef struct ffi_export_symbol { const char *name; union { void *data; ffi_export_func_t func; } sym; } ffi_export_symbol; #endif ]] local objHelperFunc = [[ #if LUAJIT_FFI /* nobj_ffi_support_enabled_hint should be set to 1 when FFI support is enabled in at-least one * instance of a LuaJIT state. It should never be set back to 0. */ static int nobj_ffi_support_enabled_hint = 0; static const char nobj_ffi_support_key[] = "LuaNativeObject_FFI_SUPPORT"; static const char nobj_check_ffi_support_code[] = "local stat, ffi=pcall(require,\"ffi\")\n" /* try loading LuaJIT`s FFI module. */ "if not stat then return false end\n" "return true\n"; static int nobj_check_ffi_support(lua_State *L) { int rc; int err; /* check if ffi test has already been done. */ lua_pushstring(L, nobj_ffi_support_key); lua_rawget(L, LUA_REGISTRYINDEX); if(!lua_isnil(L, -1)) { rc = lua_toboolean(L, -1); lua_pop(L, 1); /* use results of previous check. */ goto finished; } lua_pop(L, 1); /* pop nil. */ err = luaL_loadbuffer(L, nobj_check_ffi_support_code, sizeof(nobj_check_ffi_support_code) - 1, nobj_ffi_support_key); if(0 == err) { err = lua_pcall(L, 0, 1, 0); } if(err) { const char *msg = "<err not a string>"; if(lua_isstring(L, -1)) { msg = lua_tostring(L, -1); } printf("Error when checking for FFI-support: %s\n", msg); lua_pop(L, 1); /* pop error message. */ return 0; } /* check results of test. */ rc = lua_toboolean(L, -1); lua_pop(L, 1); /* pop results. */ /* cache results. */ lua_pushstring(L, nobj_ffi_support_key); lua_pushboolean(L, rc); lua_rawset(L, LUA_REGISTRYINDEX); finished: /* turn-on hint that there is FFI code enabled. */ if(rc) { nobj_ffi_support_enabled_hint = 1; } return rc; } typedef struct { const char **ffi_init_code; int offset; } nobj_reader_state; static const char *nobj_lua_Reader(lua_State *L, void *data, size_t *size) { nobj_reader_state *state = (nobj_reader_state *)data; const char *ptr; (void)L; ptr = state->ffi_init_code[state->offset]; if(ptr != NULL) { *size = strlen(ptr); state->offset++; } else { *size = 0; } return ptr; } static int nobj_try_loading_ffi(lua_State *L, const char *ffi_mod_name, const char *ffi_init_code[], const ffi_export_symbol *ffi_exports, int priv_table) { nobj_reader_state state = { ffi_init_code, 0 }; int err; /* export symbols to priv_table. */ while(ffi_exports->name != NULL) { lua_pushstring(L, ffi_exports->name); lua_pushlightuserdata(L, ffi_exports->sym.data); lua_settable(L, priv_table); ffi_exports++; } err = lua_load_no_mode(L, nobj_lua_Reader, &state, ffi_mod_name); if(0 == err) { lua_pushvalue(L, -2); /* dup C module's table. */ lua_pushvalue(L, priv_table); /* move priv_table to top of stack. */ lua_remove(L, priv_table); lua_pushvalue(L, LUA_REGISTRYINDEX); err = lua_pcall(L, 3, 0, 0); } if(err) { const char *msg = "<err not a string>"; if(lua_isstring(L, -1)) { msg = lua_tostring(L, -1); } printf("Failed to install FFI-based bindings: %s\n", msg); lua_pop(L, 1); /* pop error message. */ } return err; } #endif ]] local module_init_src = [[ #if LUAJIT_FFI if(nobj_check_ffi_support(L)) { nobj_try_loading_ffi(L, "${module_c_name}.nobj.ffi.lua", ${module_c_name}_ffi_lua_code, ${module_c_name}_ffi_export, priv_table); } #endif ]] local submodule_init_src = [[ #if ${module_c_name}_${object_name}_LUAJIT_FFI if(nobj_check_ffi_support(L)) { nobj_try_loading_ffi(L, "${module_c_name}_${object_name}", ${module_c_name}_${object_name}_ffi_lua_code, ${module_c_name}_${object_name}_ffi_export, priv_table); } #endif ]] -- -- FFI templates -- local ffi_helper_code = [===[ local ffi=require"ffi" local function ffi_safe_load(name, global) local stat, C = pcall(ffi.load, name, global) if not stat then return nil, C end if global then return ffi.C end return C end local function ffi_load(name, global) return assert(ffi_safe_load(name, global)) end local ffi_string = ffi.string local f_cast = ffi.cast local pcall = pcall local error = error local type = type local tonumber = tonumber local tostring = tostring local sformat = require"string".format local rawset = rawset local setmetatable = setmetatable local package = (require"package") or {} local p_config = package.config local p_cpath = package.cpath local ffi_load_cmodule -- try to detect luvit. if p_config == nil and p_cpath == nil then ffi_load_cmodule = function(name, global) for path,module in pairs(package.loaded) do if module == name then local C, err = ffi_safe_load(path, global) -- return opened library if C then return C end end end error("Failed to find: " .. name) end else ffi_load_cmodule = function(name, global) local dir_sep = p_config:sub(1,1) local path_sep = p_config:sub(3,3) local path_mark = p_config:sub(5,5) local path_match = "([^" .. path_sep .. "]*)" .. path_sep -- convert dotted name to directory path. name = name:gsub('%.', dir_sep) -- try each path in search path. for path in p_cpath:gmatch(path_match) do local fname = path:gsub(path_mark, name) local C, err = ffi_safe_load(fname, global) -- return opened library if C then return C end end error("Failed to find: " .. name) end end local _M, _priv, reg_table = ... local REG_OBJECTS_AS_GLOBALS = false local C = ffi.C local OBJ_UDATA_FLAG_OWN = 1 local function ffi_safe_cdef(block_name, cdefs) local fake_type = "struct sentinel_" .. block_name .. "_ty" local stat, size = pcall(ffi.sizeof, fake_type) if stat and size > 0 then -- already loaded this cdef block return end cdefs = fake_type .. "{ int a; int b; int c; };" .. cdefs return ffi.cdef(cdefs) end ffi_safe_cdef("LuaNativeObjects", [[ typedef struct obj_type obj_type; typedef void (*base_caster_t)(void **obj); typedef void (*dyn_caster_t)(void **obj, obj_type **type); struct obj_type { dyn_caster_t dcaster; /**< caster to support casting to sub-objects. */ int32_t id; /**< type's id. */ uint32_t flags; /**< type's flags (weak refs) */ const char *name; /**< type's object name. */ }; typedef struct obj_base { int32_t id; base_caster_t bcaster; } obj_base; typedef struct obj_udata { void *obj; uint32_t flags; /**< lua_own:1bit */ } obj_udata; int memcmp(const void *s1, const void *s2, size_t n); ]]) local nobj_callback_states = {} local nobj_weak_objects = setmetatable({}, {__mode = "v"}) local nobj_obj_flags = {} local function obj_ptr_to_id(ptr) return tonumber(f_cast('uintptr_t', ptr)) end local function obj_to_id(ptr) return tonumber(f_cast('uintptr_t', f_cast('void *', ptr))) end local function register_default_constructor(_pub, obj_name, constructor) local obj_pub = _pub[obj_name] if type(obj_pub) == 'table' then -- copy table since it might have a locked metatable local new_pub = {} for k,v in pairs(obj_pub) do new_pub[k] = v end setmetatable(new_pub, { __call = function(t,...) return constructor(...) end, __metatable = false, }) obj_pub = new_pub else obj_pub = constructor end _pub[obj_name] = obj_pub _M[obj_name] = obj_pub if REG_OBJECTS_AS_GLOBALS then _G[obj_name] = obj_pub end end ]===] -- templates for typed *_check/*_delete/*_push functions local ffi_obj_type_check_delete_push = { ['simple'] = [[ local obj_type_${object_name}_check local obj_type_${object_name}_delete local obj_type_${object_name}_push do ffi_safe_cdef("${object_name}_simple_wrapper", [=[ struct ${object_name}_t { const ${object_name} _wrapped_val; }; typedef struct ${object_name}_t ${object_name}_t; ]=]) local obj_mt, obj_type, obj_ctype = obj_register_ctype("${object_name}", "${object_name}_t") function obj_type_${object_name}_check(obj) return obj._wrapped_val end function obj_type_${object_name}_delete(obj) local id = obj_to_id(obj) local valid = nobj_obj_flags[id] if not valid then return nil end local val = obj._wrapped_val nobj_obj_flags[id] = nil return val end function obj_type_${object_name}_push(val) local obj = obj_ctype(val) local id = obj_to_id(obj) nobj_obj_flags[id] = true return obj end function obj_mt:__tostring() return sformat("${object_name}: %d", tonumber(self._wrapped_val)) end function obj_mt.__eq(val1, val2) if not ffi.istype(obj_ctype, val2) then return false end return (val1._wrapped_val == val2._wrapped_val) end -- type checking function for C API. local function c_check(obj) if ffi.istype(obj_ctype, obj) then return obj._wrapped_val end return nil end _priv[obj_type] = c_check -- push function for C API. reg_table[obj_type] = function(ptr) return obj_type_${object_name}_push(ffi.cast("${object_name} *", ptr)[0]) end -- export check functions for use in other modules. obj_mt.c_check = c_check obj_mt.ffi_check = obj_type_${object_name}_check end ]], ['simple ptr'] = [[ local obj_type_${object_name}_check local obj_type_${object_name}_delete local obj_type_${object_name}_push do local obj_mt, obj_type, obj_ctype = obj_register_ctype("${object_name}", "${object_name} *") function obj_type_${object_name}_check(ptr) return ptr end function obj_type_${object_name}_delete(ptr) local id = obj_ptr_to_id(ptr) local flags = nobj_obj_flags[id] if not flags then return ptr end ffi.gc(ptr, nil) nobj_obj_flags[id] = nil return ptr end if obj_mt.__gc then -- has __gc metamethod function obj_type_${object_name}_push(ptr) local id = obj_ptr_to_id(ptr) nobj_obj_flags[id] = true return ffi.gc(ptr, obj_mt.__gc) end else -- no __gc metamethod function obj_type_${object_name}_push(ptr) return ptr end end function obj_mt:__tostring() return sformat("${object_name}: %p", self) end -- type checking function for C API. local function c_check(ptr) if ffi.istype(obj_ctype, ptr) then return ptr end return nil end _priv[obj_type] = c_check -- push function for C API. reg_table[obj_type] = function(ptr) return obj_type_${object_name}_push(ffi.cast(obj_ctype, ptr)[0]) end -- export check functions for use in other modules. obj_mt.c_check = c_check obj_mt.ffi_check = obj_type_${object_name}_check end ]], ['embed'] = [[ local obj_type_${object_name}_check local obj_type_${object_name}_delete local obj_type_${object_name}_push do local obj_mt, obj_type, obj_ctype = obj_register_ctype("${object_name}", "${object_name}") local ${object_name}_sizeof = ffi.sizeof"${object_name}" function obj_type_${object_name}_check(obj) return obj end function obj_type_${object_name}_delete(obj) return obj end function obj_type_${object_name}_push(obj) return obj end function obj_mt:__tostring() return sformat("${object_name}: %p", self) end function obj_mt.__eq(val1, val2) if not ffi.istype(obj_ctype, val2) then return false end assert(ffi.istype(obj_ctype, val1), "expected ${object_name}") return (C.memcmp(val1, val2, ${object_name}_sizeof) == 0) end -- type checking function for C API. local function c_check(obj) if ffi.istype(obj_ctype, obj) then return obj end return nil end _priv[obj_type] = c_check -- push function for C API. reg_table[obj_type] = function(ptr) local obj = obj_ctype() ffi.copy(obj, ptr, ${object_name}_sizeof); return obj end -- export check functions for use in other modules. obj_mt.c_check = c_check obj_mt.ffi_check = obj_type_${object_name}_check end ]], ['object id'] = [[ local obj_type_${object_name}_check local obj_type_${object_name}_delete local obj_type_${object_name}_push do ffi_safe_cdef("${object_name}_simple_wrapper", [=[ struct ${object_name}_t { const ${object_name} _wrapped_val; }; typedef struct ${object_name}_t ${object_name}_t; ]=]) local obj_mt, obj_type, obj_ctype = obj_register_ctype("${object_name}", "${object_name}_t") function obj_type_${object_name}_check(obj) -- if obj is nil or is the correct type, then just return it. if not obj or ffi.istype(obj_ctype, obj) then return obj._wrapped_val end -- check if it is a compatible type. local ctype = tostring(ffi.typeof(obj)) local bcaster = _obj_subs.${object_name}[ctype] if bcaster then return bcaster(obj._wrapped_val) end return error("Expected '${object_name}'", 2) end function obj_type_${object_name}_delete(obj) local id = obj_to_id(obj) local flags = nobj_obj_flags[id] local val = obj._wrapped_val if not flags then return nil, 0 end nobj_obj_flags[id] = nil return val, flags end function obj_type_${object_name}_push(val, flags) local obj = obj_ctype(val) local id = obj_to_id(obj) nobj_obj_flags[id] = flags return obj end function obj_mt:__tostring() local val = self._wrapped_val return sformat("${object_name}: %d, flags=%d", tonumber(val), nobj_obj_flags[obj_to_id(val)] or 0) end function obj_mt.__eq(val1, val2) if not ffi.istype(obj_ctype, val2) then return false end return (val1._wrapped_val == val2._wrapped_val) end -- type checking function for C API. _priv[obj_type] = obj_type_${object_name}_check -- push function for C API. reg_table[obj_type] = function(ptr, flags) return obj_type_${object_name}_push(ffi.cast('uintptr_t',ptr), flags) end -- export check functions for use in other modules. obj_mt.c_check = obj_type_${object_name}_check obj_mt.ffi_check = obj_type_${object_name}_check end ]], ['generic'] = [[ local obj_type_${object_name}_check local obj_type_${object_name}_delete local obj_type_${object_name}_push do local obj_mt, obj_type, obj_ctype = obj_register_ctype("${object_name}", "${object_name} *") function obj_type_${object_name}_check(ptr) -- if ptr is nil or is the correct type, then just return it. if not ptr or ffi.istype(obj_ctype, ptr) then return ptr end -- check if it is a compatible type. local ctype = tostring(ffi.typeof(ptr)) local bcaster = _obj_subs.${object_name}[ctype] if bcaster then return bcaster(ptr) end return error("Expected '${object_name} *'", 2) end function obj_type_${object_name}_delete(ptr) local id = obj_ptr_to_id(ptr) local flags = nobj_obj_flags[id] if not flags then return nil, 0 end ffi.gc(ptr, nil) nobj_obj_flags[id] = nil return ptr, flags end function obj_type_${object_name}_push(ptr, flags) ${dyn_caster} if flags ~= 0 then local id = obj_ptr_to_id(ptr) nobj_obj_flags[id] = flags ffi.gc(ptr, obj_mt.__gc) end return ptr end function obj_mt:__tostring() return sformat("${object_name}: %p, flags=%d", self, nobj_obj_flags[obj_ptr_to_id(self)] or 0) end -- type checking function for C API. _priv[obj_type] = obj_type_${object_name}_check -- push function for C API. reg_table[obj_type] = function(ptr, flags) return obj_type_${object_name}_push(ffi.cast(obj_ctype,ptr), flags) end -- export check functions for use in other modules. obj_mt.c_check = obj_type_${object_name}_check obj_mt.ffi_check = obj_type_${object_name}_check end ]], ['generic_weak'] = [[ local obj_type_${object_name}_check local obj_type_${object_name}_delete local obj_type_${object_name}_push do local obj_mt, obj_type, obj_ctype = obj_register_ctype("${object_name}", "${object_name} *") function obj_type_${object_name}_check(ptr) -- if ptr is nil or is the correct type, then just return it. if not ptr or ffi.istype(obj_ctype, ptr) then return ptr end -- check if it is a compatible type. local ctype = tostring(ffi.typeof(ptr)) local bcaster = _obj_subs.${object_name}[ctype] if bcaster then return bcaster(ptr) end return error("Expected '${object_name} *'", 2) end function obj_type_${object_name}_delete(ptr) local id = obj_ptr_to_id(ptr) local flags = nobj_obj_flags[id] if not flags then return nil, 0 end ffi.gc(ptr, nil) nobj_obj_flags[id] = nil return ptr, flags end function obj_type_${object_name}_push(ptr, flags) local id = obj_ptr_to_id(ptr) -- check weak refs if nobj_obj_flags[id] then return nobj_weak_objects[id] end ${dyn_caster} if flags ~= 0 then nobj_obj_flags[id] = flags ffi.gc(ptr, obj_mt.__gc) end nobj_weak_objects[id] = ptr return ptr end function obj_mt:__tostring() return sformat("${object_name}: %p, flags=%d", self, nobj_obj_flags[obj_ptr_to_id(self)] or 0) end -- type checking function for C API. _priv[obj_type] = obj_type_${object_name}_check -- push function for C API. reg_table[obj_type] = function(ptr, flags) return obj_type_${object_name}_push(ffi.cast(obj_ctype,ptr), flags) end -- export check functions for use in other modules. obj_mt.c_check = obj_type_${object_name}_check obj_mt.ffi_check = obj_type_${object_name}_check end ]], } local ffi_obj_metatype = { ['simple'] = "${object_name}_t", ['simple ptr'] = "${object_name}_t", ['embed'] = "${object_name}", ['object id'] = "${object_name}_t", ['generic'] = nil, ['generic_weak'] = "${object_name}", } local function get_var_name(var) local name = 'self' if not var.is_this then name = '${' .. var.name .. '}' end return name end local function unwrap_value(self, var) local name = get_var_name(var) return name .. ' = ' .. name .. '._wrapped_val\n' end local function no_wrapper(self, var) return '\n' end local ffi_obj_type_check = { ['simple'] = unwrap_value, ['simple ptr'] = no_wrapper, ['embed'] = no_wrapper, ['object id'] = unwrap_value, ['generic'] = no_wrapper, ['generic_weak'] = no_wrapper, } -- module template local ffi_module_template = [==[ local _obj_interfaces_ffi = {} local _pub = {} local _meth = {} local _push = {} local _obj_subs = {} for obj_name,mt in pairs(_priv) do if type(mt) == 'table' then _obj_subs[obj_name] = {} if mt.__index then _meth[obj_name] = mt.__index end end end for obj_name,pub in pairs(_M) do _pub[obj_name] = pub end -- -- CData Metatable access -- local _ctypes = {} local _type_names = {} local _get_mt_key = {} local _ctype_meta_map = {} local f_typeof = ffi.typeof local function get_cdata_type_id(cdata) return tonumber(f_typeof(cdata)) end local function get_cdata_mt(cdata) return _ctype_meta_map[tonumber(f_typeof(cdata))] end local function obj_register_ctype(name, ctype) local obj_mt = _priv[name] local obj_type = obj_mt['.type'] local obj_ctype = ffi.typeof(ctype) local obj_type_id = tonumber(obj_ctype) _ctypes[name] = obj_ctype _type_names[name] = tostring(obj_ctype) _ctype_meta_map[obj_type_id] = obj_mt _ctype_meta_map[obj_mt] = obj_type_id return obj_mt, obj_type, obj_ctype end -- -- Interfaces helper code. -- local _obj_interfaces_key = "obj_interfaces<1.0>_table_key" local _obj_interfaces_ud = reg_table[_obj_interfaces_key] local _obj_interfaces_key_ffi = _obj_interfaces_key .. <KEY>" _obj_interfaces_ffi = reg_table[_obj_interfaces_key_ffi] if not _obj_interfaces_ffi then -- create missing interfaces table for FFI bindings. _obj_interfaces_ffi = {} reg_table[_obj_interfaces_key_ffi] = _obj_interfaces_ffi end local function obj_get_userdata_interface(if_name, expected_err) local impls_ud = _obj_interfaces_ud[if_name] if not impls_ud then impls_ud = {} _obj_interfaces_ud[if_name] = impls_ud end -- create cdata check function to be used by non-ffi bindings. if not impls_ud.cdata then function impls_ud.cdata(obj) return assert(impls_ud[get_cdata_mt(obj)], expected_err) end end return impls_ud end local function obj_get_interface_check(if_name, expected_err) local impls_ffi = _obj_interfaces_ffi[if_name] if not impls_ffi then local if_type = ffi.typeof(if_name .. " *") local impls_ud = obj_get_userdata_interface(if_name, expected_err) -- create table for FFI-based interface implementations. impls_ffi = setmetatable({}, { __index = function(impls_ffi, mt) local impl = impls_ud[mt] if impl then -- cast to cdata impl = if_type(impl) rawset(impls_ffi, mt, impl) end return impl end}) _obj_interfaces_ffi[if_name] = impls_ffi -- create check function for this interface. function impls_ffi.check(obj) local impl if type(obj) == 'cdata' then impl = impls_ffi[get_cdata_type_id(obj)] else impl = impls_ud.userdata(impls_ffi, obj) end return assert(impl, expected_err) end end return impls_ffi.check end local function obj_register_interface(if_name, obj_name) -- loopkup cdata id local obj_mt = _priv[obj_name] local obj_type_id = _ctype_meta_map[obj_mt] local impl_meths = {} local ffi_impls = _obj_interfaces_ffi[if_name] ffi_impls[obj_type_id] = impl_meths _meth[obj_name]['NOBJ_get_' .. if_name] = impl_meths return impl_meths end ]==] local ffi_submodule_template = ffi_module_template -- re-map meta-methods. local lua_meta_methods = { __str__ = '__tostring', __eq__ = '__eq', delete = '__gc', -- Lua metamethods __add = '__add', __sub = '__sub', __mul = '__mul', __div = '__div', __mod = '__mod', __pow = '__pow', __unm = '__unm', __len = '__len', __concat = '__concat', __eq = '__eq', __lt = '__lt', __le = '__le', __gc = '__gc', __tostring = '__tostring', __index = '__index', __newindex = '__newindex', } local MAX_C_LITERAL = (16 * 1024) local function dump_lua_code_to_c_str(code, name) -- make Lua code C-safe code = code:gsub('[\n"\\%z]', { ['\n'] = "\\n\"\n\"", ['\r'] = "\\r", ['"'] = [[\"]], ['\\'] = [[\\]], ['\0'] = [[\0]], }) local tcode = {'\nstatic const char *', name, '[] = { "', } -- find all cut positions. local last_pos = 1 local next_boundry = last_pos + MAX_C_LITERAL local cuts = {} -- list of positions to cut the code at. for pos in code:gmatch("()\n") do -- find end position of all lines. -- check if current line will cross a cut boundry. if pos > next_boundry then -- cut code at end of last line. cuts[#cuts + 1] = last_pos next_boundry = pos + MAX_C_LITERAL end -- track end of last line. last_pos = pos end cuts[#cuts + 1] = last_pos -- split Lua code into multiple pieces if it is too long. last_pos = 1 for i=1,#cuts do local pos = cuts[i] local piece = code:sub(last_pos, pos-1) last_pos = pos if(i > 1) then -- cut last piece. tcode[#tcode + 1] = ", /* ----- CUT ----- */" end tcode[#tcode + 1] = piece end tcode[#tcode + 1] = ', NULL };' return tcode end local function gen_if_defs_code(rec) if rec.ffi_if_defs then return end -- generate if code for if_defs. local if_defs = rec.if_defs local endif = 'end\n' if if_defs then if_defs = "if (" .. rec.obj_table .. rec.ffi_reg_name .. ') then\n' else if_defs = '' endif = '' end rec.ffi_if_defs = if_defs rec.ffi_endif = endif end local function reg_object_function(self, func, object) local ffi_table = '_meth' local name = func.name local reg_list -- check if this is object free/destructure method if func.is_destructor then if func._is_hidden then -- don't register '__gc' metamethods as a public object method. return '_priv.${object_name}.', '_priv', '__gc' end elseif func.is_constructor then ffi_table = '_pub' elseif func._is_meta_method then ffi_table = '_priv' -- use Lua's __* metamethod names name = lua_meta_methods[func.name] elseif func._is_method then ffi_table = '_meth' else ffi_table = '_pub' end local obj_table = ffi_table .. '.${object_name}.' if object._rec_type == 'c_module' then obj_table = '_M.' end return obj_table, ffi_table, name end local function add_source(rec, part, src, pos) return rec:insert_record(c_source(part)(src), 1) end print"============ Lua bindings =================" -- do some pre-processing of objects. process_records{ object = function(self, rec, parent) if rec.is_package then return end local ud_type = rec.userdata_type if not rec.no_weak_ref then ud_type = ud_type .. '_weak' end rec.ud_type = ud_type -- create _ffi_check_fast function rec._ffi_check_fast = ffi_obj_type_check[ud_type] end, } local parsed = process_records{ _interfaces_out = {}, _modules_out = {}, _includes = {}, -- record handlers c_module = function(self, rec, parent) local module_c_name = rec.name:gsub('(%.)','_') rec:add_var('module_c_name', module_c_name) rec:add_var('module_name', rec.name) rec:add_var('object_name', rec.name) self._cur_module = rec self._modules_out[rec.name] = rec add_source(rec, "typedefs", ffi_helper_types, 1) -- hide_meta_info? if rec.hide_meta_info == nil then rec.hide_meta_info = true end -- luajit_ffi? rec:insert_record(define("LUAJIT_FFI")(rec.luajit_ffi and 1 or 0), 1) -- use_globals? rec:write_part("ffi_obj_type", {'REG_OBJECTS_AS_GLOBALS = ',(rec.use_globals and 'true' or 'false'),'\n'}) -- luajit_ffi_load_cmodule? if rec.luajit_ffi_load_cmodule then local global = 'false' if rec.luajit_ffi_load_cmodule == 'global' then global = 'true' end rec:write_part("ffi_typedef", {[[ local Cmod = ffi_load_cmodule("${module_c_name}", ]], global ,[[) local C = Cmod ]]}) end -- where we want the module function registered. rec.functions_regs = 'function_regs' rec.methods_regs = 'function_regs' -- symbols to export to FFI rec:write_part("ffi_export", { '#if LUAJIT_FFI\n', 'static const ffi_export_symbol ${module_c_name}_ffi_export[] = {\n'}) -- start two ffi.cdef code blocks (one for typedefs and one for function prototypes). rec:write_part("ffi_typedef", { 'ffi.cdef[[\n' }) rec:write_part("ffi_cdef", { 'ffi.cdef[[\n' }) -- add module's FFI template rec:write_part("ffi_obj_type", { ffi_module_template, '\n' }) end, c_module_end = function(self, rec, parent) self._cur_module = nil -- import global interfaces. local interface_parts = { "ffi_pre_cdef", "ffi_obj_type" } for _,interface in pairs(self._interfaces_out) do rec:copy_parts(interface, interface_parts) end -- end list of FFI symbols rec:write_part("ffi_export", { ' {NULL, { NULL } }\n', '};\n', '#endif\n\n' }) add_source(rec, "luaopen_defs", rec:dump_parts{ "ffi_export" }, 1) -- end ffi.cdef code blocks rec:write_part("ffi_typedef", { '\n]]\n\n' }) rec:write_part("ffi_cdef", { '\n]]\n\n' }) -- add module init code for FFI support local part = "module_init_src" rec:write_part(part, module_init_src) rec:vars_part(part) add_source(rec, part, rec:dump_parts(part)) -- FFI helper C code. add_source(rec, "helper_funcs", objHelperFunc) -- encode luajit ffi code if rec.luajit_ffi then local ffi_code = ffi_helper_code .. rec:dump_parts{ "ffi_pre_cdef", "ffi_typedef", "ffi_cdef", "ffi_obj_type", "ffi_import", "ffi_src", "ffi_metas_regs", "ffi_extends" } rec:write_part("ffi_code_lua", ffi_code) rec:write_part("ffi_code", dump_lua_code_to_c_str(ffi_code, '${module_c_name}_ffi_lua_code')) rec:vars_parts({"ffi_code", "ffi_code_lua"}) add_source(rec, "extra_code", rec:dump_parts("ffi_code")) end end, error_code = function(self, rec, parent) rec:add_var('object_name', rec.name) rec:write_part("ffi_typedef", { 'typedef ', rec.c_type, ' ', rec.name, ';\n\n', }) if rec.no_error_string then return end -- add variable for error string rec:write_part("ffi_src", { 'local function ',rec.func_name,'(err)\n', ' local err_str\n' }) end, error_code_end = function(self, rec, parent) -- return error string. rec:write_part("ffi_src", [[ return err_str end ]]) -- don't generate FFI bindings if self._cur_module.ffi_manual_bindings then return end -- copy generated FFI bindings to parent local ffi_parts = { "ffi_pre_cdef", "ffi_typedef", "ffi_cdef", "ffi_src" } if rec.no_error_string then -- remove ffi_src ffi_parts[#ffi_parts] = nil end rec:vars_parts(ffi_parts) parent:copy_parts(rec, ffi_parts) end, interface_end = function(self, rec, parent) if rec.is_global then self._interfaces_out[rec.name] = rec return end end, object = function(self, rec, parent) rec:add_var('object_name', rec.name) -- make luaL_reg arrays for this object if not rec.is_package then -- where we want the module function registered. rec.methods_regs = 'methods_regs' -- FFI typedef local ffi_type = rec.ffi_type or 'struct ${object_name}' rec:write_part("ffi_typedef", { 'typedef ', ffi_type, ' ${object_name};\n', }) elseif rec.is_meta then -- where we want the module function registered. rec.methods_regs = 'methods_regs' end rec.functions_regs = 'pub_funcs_regs' -- FFI code rec:write_part("ffi_src", {'\n-- Start "${object_name}" FFI interface\n'}) -- Sub-module FFI code if rec.register_as_submodule then -- luajit_ffi? rec:write_part("defines", {'#define ${module_c_name}_${object_name}_LUAJIT_FFI ',(rec.luajit_ffi and 1 or 0),'\n'}) -- symbols to export to FFI rec:write_part("ffi_export", {'\nstatic const ffi_export_symbol ${module_c_name}_${object_name}_ffi_export[] = {\n'}) -- start two ffi.cdef code blocks (one for typedefs and one for function prototypes). rec:write_part("ffi_typedef", { 'ffi.cdef[[\n' }) rec:write_part("ffi_cdef", { 'ffi.cdef[[\n' }) -- add module's FFI template rec:write_part("ffi_obj_type", { ffi_submodule_template, '\n' }) end end, object_end = function(self, rec, parent) -- check for dyn_caster if rec.has_dyn_caster then local flags = '' if rec.has_obj_flags then flags = ', flags' end rec:add_var('dyn_caster', [[ local cast_obj = ]] .. rec.has_dyn_caster.dyn_caster_name .. [[(ptr]] .. flags .. [[) if cast_obj then return cast_obj end ]]) else rec:add_var('dyn_caster', "") end -- register metatable for FFI cdata type. if not rec.is_package then -- create FFI check/delete/push functions rec:write_part("ffi_obj_type", { rec.ffi_custom_delete_push or ffi_obj_type_check_delete_push[rec.ud_type], '\n' }) local c_metatype = ffi_obj_metatype[rec.ud_type] if c_metatype then rec:write_part("ffi_src",{ '_push.${object_name} = obj_type_${object_name}_push\n', 'ffi.metatype("',c_metatype,'", _priv.${object_name})\n', }) end end -- end object's FFI source rec:write_part("ffi_src", {'-- End "${object_name}" FFI interface\n\n'}) if rec.register_as_submodule then if not (self._cur_module.luajit_ffi and rec.luajit_ffi) then return end -- Sub-module FFI code -- end list of FFI symbols rec:write_part("ffi_export", { ' {NULL, { NULL } }\n', '};\n\n' }) -- end ffi.cdef code blocks rec:write_part("ffi_typedef", { '\n]]\n\n' }) rec:write_part("ffi_cdef", { '\n]]\n\n' }) local ffi_code = ffi_helper_code .. rec:dump_parts{ "ffi_pre_cdef", "ffi_typedef", "ffi_cdef", "ffi_obj_type", "ffi_import", "ffi_src", "ffi_metas_regs", "ffi_extends" } rec:write_part("ffi_code_lua", ffi_code) rec:write_part("ffi_code", dump_lua_code_to_c_str(ffi_code, '${module_c_name}_${object_name}_ffi_lua_code')) -- copy ffi_code to partent rec:vars_parts{ "ffi_code", "ffi_export" } parent:copy_parts(rec, { "ffi_code" }) add_source(rec, "luaopen_defs", rec:dump_parts{ "ffi_export" }, 1) -- add module init code for FFI support local part = "module_init_src" rec:write_part(part, submodule_init_src) rec:vars_part(part) add_source(rec, part, rec:dump_parts(part)) else -- apply variables to FFI parts local ffi_parts = { "ffi_obj_type", "ffi_export" } rec:vars_parts(ffi_parts) -- copy parts to parent parent:copy_parts(rec, ffi_parts) -- don't generate FFI bindings if self._cur_module.ffi_manual_bindings then return end -- copy generated FFI bindings to parent local ffi_parts = { "ffi_pre_cdef", "ffi_typedef", "ffi_cdef", "ffi_import", "ffi_src", "ffi_metas_regs", "ffi_extends" } rec:vars_parts(ffi_parts) parent:copy_parts(rec, ffi_parts) end end, import_object_end = function(self, rec, parent) rec:add_var('object_name', rec.name) -- create FFI check functions rec:write_part("ffi_obj_type", [[ local function obj_type_${object_name}_check(obj) -- try to import FFI check function from external module. local mt = reg_table['${object_name}'] if mt then local ffi_check = mt.ffi_check if ffi_check then obj_type_${object_name}_check = ffi_check return ffi_check(obj) end end return error("Expected '${object_name}'", 2) end ]]) -- copy parts to parent local ffi_parts = { "ffi_obj_type" } rec:vars_parts(ffi_parts) parent:copy_parts(rec, ffi_parts) end, callback_state = function(self, rec, parent) rec:add_var('wrap_type', rec.wrap_type) rec:add_var('base_type', rec.base_type) -- generate allocate function for base type. if rec.wrap_state then rec:write_part("extra_code", [[ /* object allocation function for FFI bindings. */ ${base_type} *nobj_ffi_${base_type}_new() { ${base_type} *obj; obj_type_new(${base_type}, obj); return obj; } void nobj_ffi_${base_type}_free(${base_type} *obj) { obj_type_free(${base_type}, obj); } ]]) rec:write_part("ffi_cdef", "${base_type} *nobj_ffi_${base_type}_new();\n") rec:write_part("ffi_cdef", "void nobj_ffi_${base_type}_free(${base_type} *obj);\n") end end, callback_state_end = function(self, rec, parent) -- apply variables to parts local parts = {"ffi_cdef", "ffi_src", "extra_code"} rec:vars_parts(parts) add_source(rec, "extra_code", rec:dump_parts("extra_code")) -- copy parts to parent parent:copy_parts(rec, parts) end, include = function(self, rec, parent) end, define = function(self, rec, parent) end, extends = function(self, rec, parent) assert(not parent.is_package, "A Package can't extend anything: package=" .. parent.name) local base = rec.base local base_cast = 'NULL' if base == nil then return end -- add methods/fields/constants from base object parent:write_part("ffi_src", {'-- Clear out methods from base class, to allow ffi-based methods from base class\n'}) parent:write_part("ffi_extends", {'-- Copy ffi methods from base class to sub class.\n'}) for name,val in pairs(base.name_map) do -- make sure sub-class has not override name. if parent.name_map[name] == nil then parent.name_map[name] = val if val._is_method and not val.is_constructor then gen_if_defs_code(val) -- register base class's method with sub class local obj_table, ffi_table, name = reg_object_function(self, val, parent) -- write ffi code to remove registered base class method. parent:write_part("ffi_src", {obj_table, name, ' = nil\n'}) -- write ffi code to copy method from base class. parent:write_part("ffi_extends", {val.ffi_if_defs, obj_table,name,' = ', ffi_table,'.',base.name,'.',name,'\n', val.ffi_endif}) end end end -- base_caster: helper functions. local function base_caster_name(class_name, base_name) return 'base_cast_' .. class_name .. '_to_' .. base_name end local function create_base_caster(class, base, cast_type) local base_cast = base_caster_name(class.name, base.name) local caster_def = base.c_type .. ' nobj_ffi_' .. base_cast .. '(' .. class.c_type .. ' obj)' if cast_type == 'direct' then rec:write_part('ffi_src', { '\n', '-- add sub-class to base classes list of subs\n', '_obj_subs.', base.name, '[_type_names.${object_name}] = function(obj)\n', ' return ffi.cast(_ctypes.', base.name,',obj)\n', 'end\n\n', }) return base_cast end -- add base_cast decl. parent:write_part('ffi_cdef', {' ', caster_def, ';\n'}) -- start base_cast function. if class.is_ptr then rec:write_part('src', { caster_def, ' {\n', ' void *ptr = (void *)obj;\n', ' ', base_cast, '(&ptr);\n', ' return (',base.c_type,')ptr;\n', '}\n\n', }) else rec:write_part('src', { caster_def, ' {\n', ' void *ptr = (void *)(uintptr_t)obj;\n', ' ', base_cast, '(&ptr);\n', ' return (',base.c_type,')(uintptr_t)ptr;\n', '}\n\n', }) end -- add sub-classes to base class list of subs. parent:write_part("ffi_extends", {'-- add sub-class to base classes list of subs\n', '_obj_subs.', base.name, '[_type_names.${object_name}] = C.nobj_ffi_',base_cast,'\n', }) end -- add casters for all base-class's ancestors for name,extend in pairs(base.extends) do create_base_caster(parent, extend.base, extend.cast_type) end -- create caster to base type. create_base_caster(parent, base, rec.cast_type) end, extends_end = function(self, rec, parent) -- map in/out variables in c source. local parts = {"src", "ffi_src"} rec:vars_parts(parts) -- append ffi wrapper function for base caster functions. add_source(parent, "extra_code", rec:dump_parts("src")) -- copy parts to parent parent:copy_parts(rec, "ffi_src") end, callback_func = function(self, rec, parent) rec.wrapped_type = parent.c_type rec.wrapped_type_rec = parent.c_type_rec -- add callback typedef rec:write_part('ffi_cdef', {rec.c_func_typedef, '\n'}) -- start callback function. rec:write_part("ffi_cb_head", {'-- callback: ', rec.name, '\n', 'local ', rec.c_func_name, ' = ffi.cast("',rec.c_type,'",function (', rec.param_vars, ')\n', }) -- add lua reference to wrapper object. parent:write_part('wrapper_callbacks', {' int ', rec.ref_field, ';\n'}) end, callback_func_end = function(self, rec, parent) local wrapped = rec.wrapped_var local wrapped_type = wrapped.c_type_rec local wrap_type = parent.wrap_type .. ' *' rec:write_part("ffi_cb_head", {' local wrap = nobj_callback_states[obj_ptr_to_id(${', wrapped.name ,'})]\n', }) -- generate code for return value from lua function. local ret_out = rec.ret_out local func_rc = '' if ret_out then func_rc = 'ret' rec:write_part("ffi_post", {' return ret\n'}) end -- call lua callback function. local cb_params = rec:dump_parts("ffi_cb_params") cb_params = cb_params:gsub(", $","") rec:write_part("ffi_pre_src", { ' local status, ret = pcall(wrap.' .. rec.ref_field,', ', cb_params,')\n', ' if not status then\n', ' print("CALLBACK Error:", ret)\n', }) rec:write_part("ffi_post_src", { ' return ', func_rc ,'\n', ' end\n', }) rec:write_part("ffi_post", {'end)\n\n'}) -- map in/out variables in c source. local parts = {"ffi_cb_head", "ffi_pre_src", "ffi_src", "ffi_post_src", "ffi_post"} rec:vars_parts(parts) rec:vars_parts('ffi_cdef') parent:write_part('ffi_src', rec:dump_parts(parts)) parent:write_part('ffi_cdef', rec:dump_parts('ffi_cdef')) end, dyn_caster = function(self, rec, parent) local vtab = rec.ffi_value_table or '' if vtab ~= '' then vtab = '_pub.' .. vtab .. '.' end rec.dyn_caster_name = 'dyn_caster_' .. parent.name -- generate lookup table for switch based caster. if rec.caster_type == 'switch' then local lookup_table = { "local dyn_caster_${object_name}_lookup = {\n" } local selector = '' if rec.value_field then selector = 'obj.' .. rec.value_field elseif rec.value_function then selector = "C." .. rec.value_function .. '(obj)' else error("Missing switch value for dynamic caster.") end rec:write_part('src', { ' local sub_type = dyn_caster_${object_name}_lookup[', selector, ']\n', ' local type_push = _push[sub_type or 0]\n', ' if type_push then return type_push(ffi.cast(_ctypes[sub_type],obj), flags) end\n', ' return nil\n', }) -- add cases for each sub-object type. for val,sub in pairs(rec.value_map) do lookup_table[#lookup_table + 1] = '[' .. vtab .. val .. '] = "' .. sub.name .. '",\n' end lookup_table[#lookup_table + 1] = '}\n\n' parent:write_part("ffi_obj_type", lookup_table) end end, dyn_caster_end = function(self, rec, parent) -- append custom dyn caster code parent:write_part("ffi_obj_type", {"local function dyn_caster_${object_name}(obj, flags)\n", rec:dump_parts{ "src" }, "end\n\n" }) end, c_function = function(self, rec, parent) rec:add_var('object_name', parent.name) rec:add_var('function_name', rec.name) if rec.is_destructor then rec.__gc = true -- mark as '__gc' method -- check if this is the first destructor. if not parent.has_default_destructor then parent.has_default_destructor = rc rec.is__default_destructor = true end end -- register method/function with object. local obj_table, ffi_table, name = reg_object_function(self, rec, parent) rec.obj_table = obj_table rec.ffi_table = ffi_table rec.ffi_reg_name = name -- generate if code for if_defs. gen_if_defs_code(rec) -- generate FFI function rec:write_part("ffi_pre", {'-- method: ', name, '\n', rec.ffi_if_defs, 'function ',obj_table, name, '(',rec.ffi_params,')\n'}) end, c_function_end = function(self, rec, parent) -- don't generate FFI bindings if self._cur_module.ffi_manual_bindings then return end -- is there callback state if rec.callback_state then local wrap_obj = rec.callback_state if rec.is_destructor then rec:write_part("ffi_pre", {' local id = obj_ptr_to_id(${this})\n'}) rec:write_part("ffi_post", {' nobj_callback_states[id] = nil\n'}) if wrap_obj.wrap_state then rec:write_part("ffi_post", { ' C.nobj_ffi_',wrap_obj.base_type,'_free(${this})\n', }) end else if wrap_obj.wrap_state and rec.is_constructor then rec:write_part("ffi_pre", {' ${this} = C.nobj_ffi_',wrap_obj.base_type,'_new()\n'}) end rec:write_part("ffi_pre", [[ local id = obj_ptr_to_id(${this}) local wrap = nobj_callback_states[id] if not wrap then wrap = {} nobj_callback_states[id] = wrap end ]]) local state_var = rec.state_var if state_var then rec:write_part("ffi_pre", {' ${',state_var.name,'} = ${this}\n'}) end end end -- check if function has FFI support local ffi_src = rec:dump_parts("ffi_src") if rec.no_ffi or #ffi_src == 0 then return end -- generate if code for if_defs. local endif = '\n' if rec.if_defs then endif = 'end\n\n' end -- end Lua code for FFI function local ffi_parts = {"ffi_temps", "ffi_pre", "ffi_src", "ffi_post"} local ffi_return = rec:dump_parts("ffi_return") -- trim last ', ' from list of return values. ffi_return = ffi_return:gsub(", $","") rec:write_part("ffi_post", {' return ', ffi_return,'\n', 'end\n', rec.ffi_endif}) -- check if this is the default constructor. if rec.is_default_constructor then rec:write_part("ffi_post", {'register_default_constructor(_pub,"${object_name}",', rec.obj_table, rec.ffi_reg_name ,')\n'}) end if rec.is__default_destructor and not rec._is_hidden and not self._cur_module.disable__gc and not parent.disable__gc then rec:write_part('ffi_post', {'_priv.${object_name}.__gc = ', rec.obj_table, rec.name, '\n'}) end rec:vars_parts(ffi_parts) -- append FFI-based function to parent's FFI source local ffi_cdef = { "ffi_cdef" } rec:vars_parts(ffi_cdef) parent:write_part("ffi_cdef", rec:dump_parts(ffi_cdef)) local temps = rec:dump_parts("ffi_temps") if #temps > 0 then parent:write_part("ffi_src", {"do\n", rec:dump_parts(ffi_parts), "end\n\n"}) else parent:write_part("ffi_src", {rec:dump_parts(ffi_parts), "\n"}) end end, c_source = function(self, rec, parent) end, ffi_export = function(self, rec, parent) parent:write_part("ffi_export", {'{ "', rec.name, '", { ', rec.name, ' } },\n'}) end, ffi_source = function(self, rec, parent) parent:write_part(rec.part, rec.src) parent:write_part(rec.part, "\n") end, var_in = function(self, rec, parent) -- no need to add code for 'lua_State *' parameters. if rec.c_type == 'lua_State *' and rec.name == 'L' then return end -- register variable for code gen (i.e. so ${var_name} is replaced with true variable name). parent:add_rec_var(rec, rec.name, rec.is_this and 'self') -- don't generate code for '<any>' type parameters if rec.c_type == '<any>' then return end local var_type = rec.c_type_rec if rec.is_this and parent.__gc then if var_type.has_obj_flags then -- add flags ${var_name_flags} variable parent:add_rec_var(rec, rec.name .. '_flags') -- for garbage collect method, check the ownership flag before freeing 'this' object. parent:write_part("ffi_pre", { ' ', var_type:_ffi_delete(rec, true), ' if not ${',rec.name,'} then return end\n', }) else -- for garbage collect method, check the ownership flag before freeing 'this' object. parent:write_part("ffi_pre", { ' ', var_type:_ffi_delete(rec, false), ' if not ${',rec.name,'} then return end\n', }) end elseif var_type._rec_type ~= 'callback_func' then if var_type.lang_type == 'string' then -- add length ${var_name_len} variable parent:add_rec_var(rec, rec.name .. '_len') end -- check lua value matches type. local ffi_get if rec.is_optional then ffi_get = var_type:_ffi_opt(rec, rec.default) else ffi_get = var_type:_ffi_check(rec) end parent:write_part("ffi_pre", {' ', ffi_get }) end -- is a lua reference. if var_type.is_ref then parent:write_part("ffi_src", {' wrap.', var_type.ref_field, ' = ${',rec.name,'}\n', ' ${',rec.name,'} = ', rec.cb_func.c_func_name, '\n', }) end end, var_out = function(self, rec, parent) if rec.is_length_ref then return end local flags = false local var_type = rec.c_type_rec if var_type.has_obj_flags then if (rec.is_this or rec.own) then -- add flags ${var_name_flags} variable parent:add_rec_var(rec, rec.name .. '_flags') flags = '${' .. rec.name .. '_flags}' parent:write_part("ffi_pre",{ ' local ',flags,' = OBJ_UDATA_FLAG_OWN\n' }) else flags = "0" end end -- register variable for code gen (i.e. so ${var_name} is replaced with true variable name). parent:add_rec_var(rec, rec.name, rec.is_this and 'self') -- don't generate code for '<any>' type parameters if rec.c_type == '<any>' then if not rec.is_this then parent:write_part("ffi_pre", {' local ${', rec.name, '}\n'}) end parent:write_part("ffi_return", { "${", rec.name, "}, " }) return end local var_type = rec.c_type_rec local init = '' if var_type.lang_type == 'string' and (rec.has_length or rec.need_buffer) then -- find length variable. local has_len_var = parent.var_map[rec.length] if not has_len_var then -- need to create length variable. parent:add_rec_var(rec, rec.length) end local buf_len = rec.need_buffer if buf_len then local max = buf_len - 1 if has_len_var then -- has length parameter, make sure length is lower then the buffer size. parent:write_part("ffi_pre",{ ' if ${', rec.length, '} > ',max,' then ${', rec.length, '} = ', max, ' end\n', }) else parent:write_part("ffi_pre",{ ' local ${', rec.length, '} = ', max, ';\n', }) end local temp_name = "${function_name}_" .. rec.name .. "_tmp" parent:write_part("ffi_temps",{ ' local ', temp_name, ' = ffi.new("char[',buf_len,']")\n', }) init = ' = ' .. temp_name elseif not has_len_var then -- need to create length variable. parent:write_part("ffi_pre",{ ' local ${', rec.length, '} = 0\n' }) end end -- if the variable's type has a default value, then initialize the variable. local default = var_type.default if default and default ~= 'NULL' then init = ' = ' .. tostring(default) elseif var_type.userdata_type == 'embed' then init = ' = ffi.new("' .. var_type.name .. '")' end -- add C variable to hold value to be pushed. if rec.wrap == '&' then -- don't initialize wrapped variables. init = '' end if not rec.has_in then parent:write_part("ffi_pre", {' local ${', rec.name, '}',init,'\n'}) end -- if this is a temp. variable, then we are done. if rec.is_temp then return end -- push Lua value onto the stack. local error_code = parent._has_error_code if error_code == rec then local err_type = error_code.c_type_rec if err_type.no_error_string then if rec._rec_idx == 1 then parent:write_part("ffi_post", { ' -- check for error.\n', ' if ',err_type.ffi_is_error_check(error_code),' then\n', ' return nil\n', ' end\n', }) end elseif rec._rec_idx == 1 then -- if error_code is the first var_out, then push 'true' to signal no error. -- On error push 'false' and the error message. if err_type.ffi_is_error_check then parent:write_part("ffi_post", { ' -- check for error.\n', ' if ',err_type.ffi_is_error_check(error_code),' then\n', ' return nil, ', var_type:_ffi_push(rec, flags), '\n', ' end\n', }) parent:write_part("ffi_return", { "true, " }) end end elseif rec.no_nil_on_error ~= true and error_code then local err_type = error_code.c_type_rec -- return nil for this out variable, if there was an error. if err_type.ffi_is_error_check then if err_type.no_error_string then parent:write_part("ffi_post", { ' if ',err_type.ffi_is_error_check(error_code),' then\n', ' return nil\n', ' end\n', }) else parent:write_part("ffi_post", { ' if ',err_type.ffi_is_error_check(error_code),' then\n', ' return nil,', err_type:_ffi_push(error_code), '\n', ' end\n', }) end end parent:write_part("ffi_return", { var_type:_ffi_push(rec, flags), ", " }) elseif rec.is_error_on_null then -- if a function return NULL, then there was an error. parent:write_part("ffi_post", { ' if ',var_type.ffi_is_error_check(rec),' then\n', ' return nil, ', var_type:_ffi_push_error(rec), '\n', ' end\n', }) parent:write_part("ffi_return", { var_type:_ffi_push(rec, flags), ", " }) else parent:write_part("ffi_return", { var_type:_ffi_push(rec, flags), ", " }) end end, cb_in = function(self, rec, parent) parent:add_rec_var(rec) local var_type = rec.c_type_rec if not rec.is_wrapped_obj then parent:write_part("ffi_cb_params", { var_type:_ffi_push(rec), ', ' }) else -- this is the wrapped object parameter. parent.wrapped_var = rec end end, cb_out = function(self, rec, parent) parent:add_rec_var(rec, 'ret', 'ret') local var_type = rec.c_type_rec parent:write_part("ffi_post", {' ', var_type:_ffi_opt(rec) }) end, } local src_file=open_outfile(nil, '.ffi.lua') local function src_write(...) src_file:write(...) end for name,mod in pairs(parsed._modules_out) do src_write( mod:dump_parts({ "ffi_code_lua",}) ) end print("Finished generating LuaJIT FFI bindings") <|start_filename|>examples/test_gd.lua<|end_filename|> local gd = require"gd" local x = 200 local y = 200 local img = gd.gdImage(x,y) local white = img:color_allocate(0xff, 0xff, 0xff) local blue = img:color_allocate(0, 0, 0xff) local red = img:color_allocate(0xff, 0, 0) -- draw lines for i=1,100000 do img:line(0, 0, y, x, blue) img:line(0, y, y, 0, red) end -- write image img:toPNG('test.png') <|start_filename|>native_objects/stages.lua<|end_filename|> -- Copyright (c) 2012 by <NAME> <<EMAIL>> -- -- Permission is hereby granted, free of charge, to any person obtaining a copy -- of this software and associated documentation files (the "Software"), to deal -- in the Software without restriction, including without limitation the rights -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -- copies of the Software, and to permit persons to whom the Software is -- furnished to do so, subject to the following conditions: -- -- The above copyright notice and this permission notice shall be included in -- all copies or substantial portions of the Software. -- -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -- THE SOFTWARE. local tconcat=table.concat local tinsert=table.insert local assert=assert local error=error local type=type local io=io local pairs=pairs -- -- process some container records -- reg_stage_parser("containers",{ lang = function(self, rec, parent) -- only keep records for current language. if rec.name == gen_lang then -- keep records by moving them up to the parent move_recs(parent, rec) else -- delete this record and it sub-records rec:delete_record() end end, object = function(self, rec, parent) -- re-map c_types new_c_type(rec.name, rec) new_c_type(rec.c_type, rec) end, ffi_files = function(self, rec, parent) for i=1,#rec do local file = assert(io.open(rec[i], "r")) parent:add_record(ffi_source(rec.part)(file:read("*a"))) file:close() end end, constants = function(self, rec, parent) for key,value in pairs(rec.values) do parent:add_record(const(key)({ value })) end rec._rec_type = nil end, export_definitions = function(self, rec, parent) local values = rec.values -- export list of definitions as-is (i.e. no renaming). for i=1,#values do local name = values[i] parent:add_record(const_def(name)({ name })) values[i] = nil end -- export renamed definitions. for key, value in pairs(values) do parent:add_record(const_def(key)({ value })) end rec._rec_type = nil end, error_code = function(self, rec, parent) new_c_type(rec.name, rec) end, unknown = function(self, rec, parent) -- re-map c_types if rec._is_c_type ~= nil then new_c_type(rec.c_type, rec) end end, }) -- register place-holder reg_stage_parser("resolve_types") -- -- convert fields into get/set methods. -- reg_stage_parser("fields",{ field = function(self, rec, parent) local name = rec.name local c_type = rec.c_type parent:add_record(method(name) { var_out{c_type , "field"}, c_source 'src' {"\t${field} = ${this}->", name,";\n" }, }) if rec.is_writable then parent:add_record(method("set_" .. name) { var_in{c_type , "field"}, c_source 'src' {"\t${this}->", name," = ${field};\n" }, }) end end, }) -- -- add 'this' variable to method records. -- reg_stage_parser("this_variable",{ c_function = function(self, rec, parent) if rec._is_method and not rec.override_this then local var if parent.is_meta then var = var_in{ "<any>", "this", is_this = true } elseif rec.is_constructor then var = var_out{ parent.c_type, "this", is_this = true } -- make the first constructor the default. if not parent.default_constructor then parent.default_constructor = rec rec.is_default_constructor = true end else var = var_in{ parent.c_type, "this", is_this = true } end rec:insert_record(var, 1) end end, }) -- -- create callback_func & callback_state records. -- reg_stage_parser("callback",{ var_in = function(self, rec, parent) -- is variable a callback type? if not rec.is_callback then return end -- get grand-parent container local container = parent._parent -- create callback_state instance. local cb_state if rec.owner == 'this' then local wrap_type = container.c_type cb_state = callback_state(wrap_type, rec.wrap_state) -- wrap 'this' object. container.callback_state = cb_state parent.callback_state = cb_state parent.state_owner = rec.owner if rec.state_var ~= 'this' then local state_var = tmp_var{ "void *", rec.state_var } parent.state_var = state_var parent:insert_record(state_var, 1) end else assert("un-supported callback owner type: " .. rec.owner) end container:insert_record(cb_state, 1) -- create callback_func instance. local cb_func = callback_func(rec.c_type)(rec.name) -- move sub-records from 'var_in' callback record into 'callback_func' local cb=rec for i=1,#cb do local rec = cb[i] if is_record(rec) and rec._rec_type ~= "ignore" then cb:remove_record(rec) -- remove from 'var_in' cb_func:add_record(rec) -- add to 'callback_func' end end cb_state:add_record(cb_func) rec.cb_func = cb_func rec.c_type_rec = cb_func end, }) -- -- process extends/dyn_caster records -- reg_stage_parser("dyn_caster",{ _obj_cnt = 0, object = function(self, rec, parent) rec._obj_id = self._obj_cnt self._obj_cnt = self._obj_cnt + 1 end, import_object = function(self, rec, parent) rec._obj_id = self._obj_cnt self._obj_cnt = self._obj_cnt + 1 end, extends = function(self, rec, parent) -- find base-object record. local base = resolve_c_type(rec.name) rec.base = base -- add this object to base. local subs = base.subs if subs == nil then subs = {} base.subs = subs end subs[#subs+1] = parent end, dyn_caster = function(self, rec, parent) parent.has_dyn_caster = rec if rec.caster_type == 'switch' then for k,v in pairs(rec.value_map) do rec.value_map[k] = resolve_c_type(v) end end end, unknown = function(self, rec, parent) resolve_rec(rec) end, }) -- -- Create FFI-wrappers for inline/macro calls -- local ffi_wrappers = {} reg_stage_parser("ffi_wrappers",{ c_call = function(self, rec, parent) if not rec.ffi_need_wrapper then -- normal C call don't need wrapper. return end -- find parent 'object' record. local object = parent while object._rec_type ~= 'object' and object._rec_type ~= 'c_module' do object = object._parent assert(object, "Can't find parent 'object' record of 'c_call'") end local ret_type = rec.ret local ret = ret_type -- convert return type into "var_out" if it's not a "void" type. if ret ~= "void" then if type(ret) ~= 'string' then ret_type = ret[1] end ret = " return " else ret_type = "void" ret = " " end -- build C call statement. local call = {} local cfunc_name = rec.cfunc call[#call+1] = ret call[#call+1] = cfunc_name -- process parameters. local params = {} local list = rec.params params[#params+1] = "(" call[#call+1] = "(" if rec.is_method_call then call[#call+1] = 'this' params[#params+1] = object.c_type .. ' ' params[#params+1] = 'this' if #list > 0 then params[#params+1] = ", " call[#call+1] = ", " end end for i=1,#list,2 do local c_type,name = clean_variable_type_name(list[i], list[i+1]) if i > 1 then params[#params+1] = ", " call[#call+1] = ", " end -- append parameter name call[#call+1] = name -- append parameter type & name to cdef params[#params+1] = c_type .. ' ' params[#params+1] = name end params[#params+1] = ")" call[#call+1] = ");\n" -- convert 'params' to string. params = tconcat(params) call = tconcat(call) -- get prefix local export_prefix = "" if rec.ffi_need_wrapper == 'c_wrap' then export_prefix = "ffi_wrapper_" end rec.ffi_export_prefix = export_prefix -- check for re-definitions or duplicates. local cdef = ret_type .. " " .. export_prefix .. cfunc_name .. params local old_cdef = ffi_wrappers[cfunc_name] if old_cdef == cdef then return -- duplicate, don't need to create a new wrapper. elseif old_cdef then error("Re-definition of FFI wrapper cdef: " .. cdef) end ffi_wrappers[cfunc_name] = cdef -- create wrapper function if rec.ffi_need_wrapper == 'c_wrap' then object:add_record(c_source("src")({ "\n/* FFI wrapper for inline/macro call */\n", "LUA_NOBJ_API ", cdef, " {\n", call, "}\n", })) end object:add_record(ffi_export_function(ret_type)(export_prefix .. rec.cfunc)(params)) end, }) -- -- do some pre-processing of records. -- local ffi_cdefs = {} reg_stage_parser("pre-process",{ c_module = function(self, rec, parent) rec.functions = {} rec.constants = {} rec.fields = {} rec.name_map = {} end, object = function(self, rec, parent) rec.functions = {} rec.constants = {} rec.fields = {} rec.name_map = {} rec.extends = {} end, callback_state = function(self, rec, parent) rec.callbacks = {} end, extends = function(self, rec, parent) -- add base-class to parent's base list. parent.extends[rec.name] = rec end, field = function(self, rec, parent) -- add to name map to reserve the name. assert(parent.name_map[rec.name] == nil) --parent.name_map[rec.name] = rec -- add field to parent's fields list. parent.fields[rec.name] = rec end, const = function(self, rec, parent) -- add to name map to reserve the name. assert(parent.name_map[rec.name] == nil) parent.name_map[rec.name] = rec -- add constant to parent's constants list. parent.constants[rec.name] = rec end, c_function = function(self, rec, parent) local c_name = parent.name .. '__' .. rec.name if rec._is_method then assert(not parent.is_package or parent.is_meta, "Package's can't have methods: package=" .. parent.name .. ", method=" .. rec.name) c_name = c_name .. '__meth' else c_name = c_name .. '__func' end rec.c_name = c_name -- add to name map to reserve the name. assert(parent.name_map[rec.name] == nil, "duplicate functions " .. rec.name .. " in " .. parent.name) parent.name_map[rec.name] = rec -- add function to parent's function list. parent.functions[rec.name] = rec -- prepare wrapped new/delete methods if rec._is_method and parent.callback_state then if rec.is_destructor then rec.callback_state = parent.callback_state end end -- map names to in/out variables rec.var_map = {} function rec:add_variable(var, name) name = name or var.name local old_var = self.var_map[name] if old_var and old_var ~= var then -- allow input variable to share name with an output variable. assert(var.ctype == old_var.ctype, "duplicate variable " .. name .. " in " .. self.name) -- If they are the same type. local v_in,v_out if var._rec_type == 'var_in' then assert(old_var._rec_type == 'var_out', "duplicate input variable " .. name .. " in " .. self.name) v_in = var v_out = old_var elseif var._rec_type == 'var_out' then assert(old_var._rec_type == 'var_in', "duplicate output variable " .. name .. " in " .. self.name) v_in = old_var v_out = var end -- link in & out variables. v_in.has_out = v_out v_out.has_in = v_in -- store input variable in var_map var = v_in end -- add this variable to parent self.var_map[name] = var end end, callback_func = function(self, rec, parent) local func_type = rec.c_type_rec -- add callback to parent's callback list. parent.callbacks[rec.ref_field] = rec local src={"static "} local typedef={"typedef "} -- convert return type into "cb_out" if it's not a "void" type. local ret = func_type.ret if ret ~= "void" then rec.ret_out = cb_out{ ret, "ret" } rec:insert_record(rec.ret_out, 1) end src[#src+1] = ret .. " " typedef[#typedef+1] = ret .. " " -- append c function to call. rec.c_func_name = parent.base_type .. "_".. rec.ref_field .. "_cb" src[#src+1] = rec.c_func_name .. "(" typedef[#typedef+1] = "(*" .. rec.c_type .. ")(" -- convert params to "cb_in" records. local params = func_type.params local vars = {} local idx=1 for i=1,#params,2 do local c_type = params[i] local name = params[i + 1] if i > 1 then src[#src+1] = ", " typedef[#typedef+1] = ", " end -- add cb_in to this rec. local v_in = cb_in{ c_type, name} rec:insert_record(v_in, idx) idx = idx + 1 src[#src+1] = c_type .. " ${" .. v_in.name .. "}" typedef[#typedef+1] = c_type .. " " .. v_in.name vars[#vars+1] = "${" .. v_in.name .. "}" end src[#src+1] = ")" typedef[#typedef+1] = ");" -- save callback func decl. rec.c_func_decl = tconcat(src) rec.c_func_typedef = tconcat(typedef) rec.param_vars = tconcat(vars, ', ') -- map names to in/out variables rec.var_map = {} function rec:add_variable(var, name) name = name or var.name local old_var = self.var_map[name] assert(old_var == nil or old_var == var, "duplicate variable " .. name .. " in " .. self.name) -- add this variable to parent self.var_map[name] = var end end, var_in = function(self, rec, parent) parent:add_variable(rec) end, var_out = function(self, rec, parent) if not rec.is_length_ref then parent:add_variable(rec) end end, cb_in = function(self, rec, parent) parent:add_variable(rec) end, cb_out = function(self, rec, parent) if not rec.is_length_ref then parent:add_variable(rec) end end, c_call = function(self, rec, parent) local src={} local ffi_cdef={} local ffi_pre={} local ffi_src={} local ffi_post={} local ret_type = rec.ret local ret = ret_type -- convert return type into "var_out" if it's not a "void" type. if ret ~= "void" then local is_this = false -- check if return value is for the "this" value in a constructor. if parent.is_constructor then local this_var = parent.var_map.this if this_var and ret == this_var.c_type then ret_type = this_var.c_type is_this = true end end if is_this then ret = " ${this} = " else local rc if type(ret) == 'string' then rc = var_out{ ret, "rc_" .. rec.cfunc, is_unnamed = true } else rc = var_out(ret) end ret_type = rc.c_type if rc.is_length_ref then -- look for related 'var_out'. local rc_val = parent.var_map[rc.name] if rc_val then rc_val.has_length = true rc_val.length = rc.length else -- related 'var_out' not processed yet. -- add place-holder parent.var_map[rc.name] = rc end ret = " ${" .. rc.length .. "} = " else ret = " ${" .. rc.name .. "} = " -- look for related length reference. local rc_len = parent.var_map[rc.name] if rc_len and rc_len.is_length_ref then -- we have a length. rc.has_length = true rc.length = rc_len.length -- remove length var place-holder parent.var_map[rc.name] = nil end -- register var_out variable. parent:add_variable(rc) end -- add var_out record to parent parent:add_record(rc) -- check for dereference. if rc.wrap == '*' then ret = ret .. '*' end end else ret = " " end src[#src+1] = ret ffi_cdef[#ffi_cdef+1] = ret_type .. " " ffi_src[#ffi_src+1] = ret -- append c function to call. local func_start = rec.cfunc .. "(" src[#src+1] = func_start ffi_cdef[#ffi_cdef+1] = func_start if rec.ffi_need_wrapper then ffi_src[#ffi_src+1] = "Cmod." .. rec.ffi_export_prefix else ffi_src[#ffi_src+1] = "C." end ffi_src[#ffi_src+1] = func_start -- convert params to "var_in" records. local params = {} local list = rec.params -- check if this `c_call` is a method call if rec.is_method_call then -- then add `this` parameter to call. local this = parent.var_map.this assert(this, "Missing `this` variable for method_call: " .. rec.cfunc) this = var_ref(this) parent:add_record(this) params[1] = this end for i=1,#list,2 do local c_type = list[i] local name = list[i+1] local param = var_in{ c_type, name} name = param.name -- check if this is a new input variable. if not parent.var_map[name] then -- add param as a variable. parent:add_variable(param) else -- variable exists, turn this input variable into a reference. local ref = var_ref(param) -- invalidate old `var_in` record param._rec_type = nil param = ref end -- add param rec to parent. parent:add_record(param) params[#params + 1] = param end -- append all input variables to "c_source" for i=1,#params do local var = params[i] if i > 1 then src[#src+1] = ", " ffi_cdef[#ffi_cdef+1] = ", " ffi_src[#ffi_src+1] = ", " end local name = var.name if var.is_length_ref then name = "${" .. var.length .. "}" else name = "${" .. name .. "}" end -- append parameter to c source call if var.wrap then src[#src+1] = var.wrap .. "(" src[#src+1] = name .. ")" else src[#src+1] = name end if var.wrap == '&' then -- need a tmp variable to dereference parameter. local var_name = var.name if var.is_length_ref then var_name = var.length end local temp_name = "${function_name}_" .. var_name .. "_tmp" parent:add_record(ffi_source("ffi_temps")( {' local ', temp_name, ' = ffi.new("',var.c_type,'[1]")\n'})) if var.has_in or var._rec_type == 'var_in' then ffi_pre[#ffi_pre+1] = ' ' .. temp_name .. '[0] = ' .. name .. '\n' end ffi_post[#ffi_post+1] = '\n ' .. name .. ' = ' .. temp_name .. '[0]' name = temp_name end -- append parameter to ffi source call ffi_src[#ffi_src+1] = name -- append parameter type & name to ffi cdef record ffi_cdef[#ffi_cdef+1] = var.c_type if var.wrap == '&' then ffi_cdef[#ffi_cdef+1] = '*' end end src[#src+1] = ");" ffi_cdef[#ffi_cdef+1] = ");\n" ffi_src[#ffi_src+1] = ")" -- replace `c_call` with `c_source` record local idx = parent:find_record(rec) idx = idx + 1 parent:insert_record(c_source("src")(src), idx) -- convert to string. ffi_cdef = tconcat(ffi_cdef) -- add pre/post ffi code. if #ffi_pre > 0 then tinsert(ffi_src, 1, tconcat(ffi_pre)) end if #ffi_post > 0 then ffi_src[#ffi_src+1] = tconcat(ffi_post) end -- check for ffi cdefs re-definitions local cfunc = rec.cfunc local cdef = ffi_cdefs[cfunc] if cdef and cdef ~= ffi_cdef then local old_name = cfunc local i = 0 -- search for next "free" alias name. repeat i = i + 1 cfunc = old_name .. i cdef = ffi_cdefs[cfunc] -- search until "free" alias name, or same definition. until not cdef or cdef == ffi_cdef -- update ffi src with new alias name. ffi_src = tconcat(ffi_src) ffi_src = ffi_src:gsub(old_name .. '%(', cfunc .. '(') -- create a cdef "asm" alias. if not cdef then ffi_cdef = ffi_cdef:gsub(old_name, cfunc) ffi_cdef = ffi_cdef:gsub("%);\n$", [[) asm("]] .. old_name .. [[");]]) end end ffi_cdefs[cfunc] = ffi_cdef -- insert FFI source record. if not cdef then -- function not defined yet. parent:insert_record(ffi_source("ffi_cdef")(ffi_cdef), idx) end idx = idx + 1 parent:insert_record(ffi_source("ffi_src")(ffi_src), idx) end, ffi_export = function(self, rec, parent) local ffi_src={} -- load exported symbol ffi_src[#ffi_src+1] = 'local ' ffi_src[#ffi_src+1] = rec.name ffi_src[#ffi_src+1] = ' = ffi.new("' ffi_src[#ffi_src+1] = rec.c_type ffi_src[#ffi_src+1] = ' *", _priv["' ffi_src[#ffi_src+1] = rec.name ffi_src[#ffi_src+1] = '"])\n' -- insert FFI source record. local idx = parent:find_record(rec) parent:insert_record(ffi_source("ffi_import")(ffi_src), idx) end, }) -- -- sort var_in/var_out records. -- local function sort_vars(var1, var2) return (var1.idx < var2.idx) end reg_stage_parser("variables",{ c_function = function(self, rec, parent) local inputs = {} local in_count = 0 local outputs = {} local out_count = 0 local misc = {} local max_idx = #rec -- seperate sub-records for i=1,max_idx do local var = rec[i] local var_type = var._rec_type local sort = true local list if var_type == 'var_in' then list = inputs in_count = in_count + 1 elseif var_type == 'var_out' then list = outputs out_count = out_count + 1 else list = misc sort = false end if sort then local idx = var.idx if idx then -- force index of this variable. local old_var = list[idx] -- variable has a fixed list[idx] = var -- move old variable to next open slot var = old_var end -- place variable in next nil slot. if var then for i=1,max_idx do if not list[i] then -- done, found empty slot list[i] = var var = nil break end end end assert(var == nil, "Failed to find empty slot for variable.") else list[#list + 1] = var end end -- make sure there are no gaps between input/output variables. assert(#inputs == in_count, "Gaps between input variables, check your usage of `<idx` for function: " .. rec.name) assert(#outputs == out_count, "Gaps between output variables, check your usage of `>idx` for function: " .. rec.name) -- put sorted sub-records back into the `c_function` record. local idx=0 for i=1,in_count do idx = idx + 1 rec[idx] = inputs[i] end for i=1,out_count do idx = idx + 1 rec[idx] = outputs[i] end for i=1,#misc do idx = idx + 1 rec[idx] = misc[i] end -- generate list of input parameter names for FFI functions. local ffi_params = {} for i=1,in_count do local name = inputs[i].name if name ~= 'this' then ffi_params[i] = '${' .. inputs[i].name .. '}' else ffi_params[i] = 'self' end end rec.ffi_params = tconcat(ffi_params, ', ') end, }) -- register place-holder reg_stage_parser("lang_type_process") -- -- mark functions which have an error_code var_out. -- reg_stage_parser("error_code",{ var_out = function(self, rec, parent) local var_type = rec.c_type_rec if var_type._is_error_code then assert(parent._has_error_code == nil, "A function/method can only have one var_out with type error_code.") -- mark the function as having an error code. parent._has_error_code = rec elseif var_type.error_on_null then -- if this variable is null then push a nil and error message. rec.is_error_on_null = true end end, }) -- register place-holder reg_stage_parser("pre_gen") <|start_filename|>native_objects/gen_dump.lua<|end_filename|> -- Copyright (c) 2010 by <NAME> <<EMAIL>> -- -- Permission is hereby granted, free of charge, to any person obtaining a copy -- of this software and associated documentation files (the "Software"), to deal -- in the Software without restriction, including without limitation the rights -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -- copies of the Software, and to permit persons to whom the Software is -- furnished to do so, subject to the following conditions: -- -- The above copyright notice and this permission notice shall be included in -- all copies or substantial portions of the Software. -- -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -- THE SOFTWARE. -- -- dump records -- print"============ Dump records =================" local depth=0 function write(...) io.write((" "):rep(depth)) io.write(...) end process_records{ unknown = function(self, rec, parent) write(rec._rec_type .. " {\n") depth = depth + 1 -- dump rec info for k,v in pairs(rec) do if k == '_rec_type' then elseif k == 'c_type_rec' then write(k,' = ', tostring(v._rec_type), ' = {\n') depth = depth + 1 write('name = "', tostring(v.name), '"\n') write('c_type = "', tostring(v.c_type), '"\n') write('lang_type = "', tostring(v.lang_type), '"\n') depth = depth - 1 write('}\n') elseif is_record(v) then elseif type(v) == 'function' then elseif type(v) == 'table' then else write(tostring(k),' = "', tostring(v), '"\n') end end end, unknown_end = function(self, rec, parent) depth = depth - 1 write("}\n") end, c_source = function(self, rec, parent) local src = rec.src if type(src) == 'table' then src = table.concat(src) end write('c_source = "', src, '"\n') end, c_source_end = function(self, rec, parent) end, } <|start_filename|>project_template/__mod_name__.nobj.lua<|end_filename|> c_module "__mod_name__" { -- enable FFI bindings support. luajit_ffi = true, -- load __MOD_NAME__ shared library. ffi_load"__mod_name__", include "__mod_name__.h", subfiles { "src/object.nobj.lua", }, } <|start_filename|>examples/gd.nobj.lua<|end_filename|> -- define the 'gd' module c_module "gd" { -- when set to true all objects will be registered as a global for easy access. use_globals = true, -- enable FFI bindings support. luajit_ffi = true, -- load GD shared library. ffi_load"gd", -- include library's header file include "gd.h", -- here we include the bindings file for each object into this module. subfiles { "gdImage.nobj.lua" } } <|start_filename|>examples/bench/no_wrap_callback.nobj.lua<|end_filename|> -- -- C code for NoWrapTestObj object -- c_source "typedefs" [[ typedef struct NoWrapTestObj NoWrapTestObj; typedef int (*NoWrapTestObjFunc)(NoWrapTestObj *obj, int idx, void *data); struct NoWrapTestObj { uint32_t some_state; NoWrapTestObjFunc func; void *func_data; }; NoWrapTestObj *nowrap_testobj_new() { NoWrapTestObj *obj = calloc(1, sizeof(NoWrapTestObj)); obj->some_state = 0xDEADBEEF; return obj; } void nowrap_testobj_destroy(NoWrapTestObj *obj) { assert(obj->some_state == 0xDEADBEEF); free(obj); } int nowrap_testobj_register(NoWrapTestObj *obj, NoWrapTestObjFunc func, void *func_data) { obj->func = func; obj->func_data = func_data; return 0; } int nowrap_testobj_run(NoWrapTestObj *obj, int run) { int rc = 0; int i; for(i = 0; i < run; i++) { rc = obj->func(obj, i, obj->func_data); if(rc < 0) break; } return rc; } ]] -- define a C callback function type: callback_type "NoWrapTestObjFunc" "int" { "NoWrapTestObj *", "this", "int", "idx", "void *", "%data" } -- callback_type "<callback typedef name>" "<callback return type>" { -- -- call back function parameters. -- "<param type>", "%<param name>", -- the '%' marks which parameter holds the wrapped object. -- "<param type>", "<param name>", -- } object "NoWrapTestObj" { -- create object constructor { c_call "NoWrapTestObj *" "nowrap_testobj_new" {}, }, -- destroy object destructor "close" { c_method_call "void" "nowrap_testobj_destroy" {}, }, method "register" { -- Create an object wrapper for the "NoWrapTestObj" which will hold a reference to the -- lua_State & Lua callback function. callback { "NoWrapTestObjFunc", "func", "func_data", owner = "this", -- C code to run if Lua callback function throws an error. c_source[[${ret} = -1;]], ffi_source[[${ret} = -1;]], }, -- callback { "<callback typedef name>", "<callback parameter name>", "<parameter to wrap>", -- -- c_source/ffi_source/c_call/etc... for error handling. -- }, c_method_call "int" "nowrap_testobj_register" { "NoWrapTestObjFunc", "func", "void *", "func_data" }, }, method "run" { c_method_call "int" "nowrap_testobj_run" { "int", "num" }, }, }
LoEE/LuaNativeObjects
<|start_filename|>scripts/build.js<|end_filename|> const vfs = require('vinyl-fs'); const babel = require('gulp-babel'); vfs.src('src/tasks/**/*.js') .pipe(babel()) .pipe(vfs.dest('./tasks'));
spalger/grunt-run
<|start_filename|>NdisCapPacket.cpp<|end_filename|> /* The BSD 3-Clause License Copyright (c) 2016 Egtra All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of {{ project }} nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "stdafx.h" #include <iphlpapi.h> #include <evntrace.h> #include <evntcons.h> #include "EtwCommon.h" #pragma comment(lib, "iphlpapi.lib") using namespace std::literals; class ComInitializer { public: ComInitializer() : m_hr(CoInitializeEx(nullptr, COINIT_MULTITHREADED | COINIT_DISABLE_OLE1DDE)) { assert(IsInitialized()); } bool IsInitialized() const { return SUCCEEDED(m_hr) || m_hr == RPC_E_CHANGED_MODE; } ~ComInitializer() { if (m_hr == S_OK) { CoUninitialize(); } } private: const HRESULT m_hr; ComInitializer(const ComInitializer&) = delete; ComInitializer& operator=(const ComInitializer&) = delete; }; PCHAR PacketGetVersion() { static char version[] = "NdisCapPacket 0.1"; return version; } PCHAR PacketGetDriverVersion() { static char driverVersion[] = "NdisCap"; return driverVersion; } BOOLEAN PacketSetMinToCopy(LPADAPTER AdapterObject, int nbytes) { //assert(false); return TRUE; } BOOLEAN PacketSetNumWrites(LPADAPTER AdapterObject, int nwrites) { assert(false); return FALSE; } BOOLEAN PacketSetMode(LPADAPTER AdapterObject, int mode) { assert(false); return TRUE; } BOOLEAN PacketSetReadTimeout(LPADAPTER AdapterObject, int timeout) { //assert(false); return TRUE; } BOOLEAN PacketSetBpf(LPADAPTER AdapterObject, bpf_program *fp) { //assert(false); return TRUE; } BOOLEAN PacketSetLoopbackBehavior(LPADAPTER AdapterObject, UINT LoopbackBehavior) { assert(false); return TRUE; } INT PacketSetSnapLen(LPADAPTER AdapterObject, int snaplen) { assert(false); return 0; } BOOLEAN PacketGetStats(_In_ LPADAPTER AdapterObject, _Out_ bpf_stat* s) { if (s == nullptr) { SetLastError(ERROR_INVALID_PARAMETER); return FALSE; } *s = {}; return TRUE; } BOOLEAN PacketGetStatsEx(LPADAPTER AdapterObject, bpf_stat *s) { assert(false); return FALSE; } BOOLEAN PacketSetBuff(LPADAPTER AdapterObject, int dim) { //assert(false); return TRUE; } BOOLEAN PacketGetNetType(_In_ LPADAPTER AdapterObject, _Out_ NetType* type) { type->LinkType = 0; // NdisMedium802_3 type->LinkSpeed = 100 * 1000 * 1000; return TRUE; } LPADAPTER PacketOpenAdapter(_In_ PCHAR AdapterName) { if (AdapterName == nullptr) { SetLastError(ERROR_INVALID_PARAMETER); return nullptr; } if (std::strlen(AdapterName) + 1 > sizeof EventTraceData::Name) { SetLastError(ERROR_INVALID_PARAMETER); return nullptr; } try { auto data = std::make_unique<EventTraceData>(); strcpy_s(data->Name, AdapterName); if (!data->ConsumerThread.joinable()) { ComInitializer comInit; auto resultStartCapture = StartCapture(); if (std::get<0>(resultStartCapture) != ERROR_SUCCESS) { SetLastError(std::get<0>(resultStartCapture)); return nullptr; } data->TraceHandleController = std::get<1>(resultStartCapture); EVENT_TRACE_LOGFILE etl{}; #if 1 etl.LoggerName = const_cast<PWSTR>(SessionName); etl.ProcessTraceMode = PROCESS_TRACE_MODE_EVENT_RECORD | PROCESS_TRACE_MODE_REAL_TIME; #else etl.LogFileName = LR"(T:\a.etl)"; etl.ProcessTraceMode = PROCESS_TRACE_MODE_EVENT_RECORD; #endif etl.EventRecordCallback = EventRecordCallback; etl.Context = data.get(); auto hTrace = OpenTrace(&etl); // See “Return Value” section: https://msdn.microsoft.com/en-us/library/windows/desktop/aa364089(v=vs.85).aspx #ifdef _WIN64 ATLENSURE_RETURN_VAL(hTrace != 0xFFFFFFFFFFFFFFFF, nullptr); #else ATLENSURE_RETURN_VAL(hTrace != 0x00000000FFFFFFFF, nullptr); #endif data->TraceHandleConsumer = hTrace; data->ConsumerThread = std::thread([hTrace]() mutable { ProcessTrace(&hTrace, 1, nullptr, nullptr); }); } return data.release(); } catch (const std::system_error& e) { if (e.code().category() == std::system_category()) { SetLastError(static_cast<DWORD>(e.code().value())); } else { SetLastError(E_FAIL); } } catch (const std::bad_alloc&) { SetLastError(ERROR_OUTOFMEMORY); } catch (...) { SetLastError(E_FAIL); } return nullptr; } BOOLEAN PacketSendPacket(LPADAPTER AdapterObject, LPPACKET pPacket, BOOLEAN Sync) { assert(false); return FALSE; } INT PacketSendPackets(LPADAPTER AdapterObject, PVOID PacketBuff, ULONG Size, BOOLEAN Sync) { assert(false); return FALSE; } LPPACKET PacketAllocatePacket() { return new(std::nothrow) PACKET{}; } VOID PacketInitPacket(_Inout_ LPPACKET lpPacket, _In_ PVOID Buffer, _In_ UINT Length) { lpPacket->Buffer = Buffer; lpPacket->Length = Length; lpPacket->ulBytesReceived = 0; lpPacket->bIoComplete = FALSE; } VOID PacketFreePacket(_In_opt_ LPPACKET lpPacket) { delete lpPacket; } BOOLEAN PacketReceivePacket(_In_ LPADAPTER AdapterObject, _In_ LPPACKET lpPacket, _In_ BOOLEAN Sync) { if (AdapterObject == nullptr || lpPacket == nullptr) { return FALSE; } auto data = static_cast<EventTraceData*>(AdapterObject); std::vector<std::uint8_t> packet; while (!data->Packet.try_pop(packet)) { lpPacket->ulBytesReceived = 0; return TRUE; } auto p = static_cast<std::uint8_t*>(lpPacket->Buffer); auto header = reinterpret_cast<bpf_hdr*>(p); header->bh_tstamp.tv_sec = time(nullptr); header->bh_tstamp.tv_usec = 0; header->bh_caplen = packet.size(); header->bh_datalen = packet.size(); header->bh_hdrlen = sizeof(bpf_hdr); memcpy(p + sizeof(bpf_hdr), packet.data(), packet.size()); lpPacket->ulBytesReceived = packet.size(); return TRUE; } BOOLEAN PacketSetHwFilter(LPADAPTER AdapterObject, ULONG Filter) { //assert(false); return TRUE; } BOOLEAN PacketGetAdapterNames(_Out_opt_ PSTR pStr, _Inout_ PULONG BufferSize) { if (BufferSize == nullptr) { SetLastError(ERROR_INVALID_PARAMETER); return FALSE; } static constexpr char data[] = "NdisCapPacket\0\0NdisCapPacket\0"; if (pStr == nullptr || *BufferSize < sizeof data) { SetLastError(ERROR_INSUFFICIENT_BUFFER); *BufferSize = sizeof data; return FALSE; } memcpy(pStr, data, sizeof data); *BufferSize = sizeof data; return TRUE; } BOOLEAN PacketGetNetInfoEx(_In_ PCHAR AdapterName, _Out_ npf_if_addr* buffer, _Inout_ PLONG NEntries) { if (AdapterName == nullptr || buffer == nullptr || NEntries == nullptr) { return FALSE; } constexpr DWORD Flags = GAA_FLAG_SKIP_ANYCAST | GAA_FLAG_SKIP_MULTICAST | GAA_FLAG_SKIP_DNS_SERVER | GAA_FLAG_SKIP_FRIENDLY_NAME; ULONG addressesBufferSize; auto resultSize = GetAdaptersAddresses(AF_UNSPEC, Flags, nullptr, nullptr, &addressesBufferSize); if (resultSize != ERROR_BUFFER_OVERFLOW) { return FALSE; } std::unique_ptr<std::uint8_t[]> addressesBuffer(new(std::nothrow) std::uint8_t[addressesBufferSize]); if (addressesBuffer == nullptr) { return FALSE; } auto addresses = reinterpret_cast<IP_ADAPTER_ADDRESSES*>(addressesBuffer.get()); auto resultAddress = GetAdaptersAddresses(AF_UNSPEC, Flags, nullptr, addresses, &addressesBufferSize); if (resultAddress != ERROR_SUCCESS) { return FALSE; } ULONG n = *NEntries; ULONG i = 0; for (; i < n && addresses != nullptr; ++i, addresses = addresses->Next) { auto a = addresses->FirstUnicastAddress; memcpy(&buffer[i].IPAddress, a->Address.lpSockaddr, a->Address.iSockaddrLength); buffer[i].SubnetMask = {}; buffer[i].Broadcast = {}; } *NEntries = i; return TRUE; } BOOLEAN PacketRequest(LPADAPTER AdapterObject, BOOLEAN Set, PPACKET_OID_DATA OidData) { assert(false); return FALSE; } HANDLE PacketGetReadEvent(LPADAPTER AdapterObject) { assert(false); return nullptr; } BOOLEAN PacketSetDumpName(LPADAPTER AdapterObject, void *name, int len) { assert(false); return FALSE; } BOOLEAN PacketSetDumpLimits(LPADAPTER AdapterObject, UINT maxfilesize, UINT maxnpacks) { assert(false); return FALSE; } BOOLEAN PacketIsDumpEnded(LPADAPTER AdapterObject, BOOLEAN sync) { assert(false); return FALSE; } BOOL PacketStopDriver() { assert(false); return TRUE; } void PacketCloseAdapter(_In_ LPADAPTER lpAdapter) { if (lpAdapter == nullptr) { return; } auto data = static_cast<EventTraceData*>(lpAdapter); ComInitializer comInit; StopCapture(data->TraceHandleController); data->ConsumerThread.join(); CloseTrace(data->TraceHandleConsumer); delete data; } BOOLEAN PacketStartOem(PCHAR errorString, UINT errorStringLength) { assert(false); return FALSE; } BOOLEAN PacketStartOemEx(PCHAR errorString, UINT errorStringLength, ULONG flags) { assert(false); return FALSE; } PAirpcapHandle PacketGetAirPcapHandle(LPADAPTER AdapterObject) { assert(false); return nullptr; } <|start_filename|>EtwController.cpp<|end_filename|> /* The BSD 3-Clause License Copyright (c) 2016 Egtra All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of {{ project }} nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "stdafx.h" #include <initguid.h> #include <winevt.h> #include <netcfgx.h> #include <evntrace.h> #include <wrl/client.h> #include "EtwCommon.h" #pragma comment(lib, "wevtapi.lib") using namespace std::literals; struct ServiceHandleDeleter { typedef SC_HANDLE pointer; void operator()(_In_opt_ SC_HANDLE hsc) const noexcept { if (hsc != nullptr) { CloseServiceHandle(hsc); } } }; using service_handle = std::unique_ptr<SC_HANDLE, ServiceHandleDeleter>; struct HKeyDeleter { typedef HKEY pointer; void operator()(_In_opt_ HKEY hk) const noexcept { if (hk != nullptr) { RegCloseKey(hk); } } }; using hkey = std::unique_ptr<HKEY, HKeyDeleter>; union EventTracePropertiesWithBuffer { // buffer size: EVENT_TRACE_PROPERTIES + logFileName + sessionName char buffer[sizeof(EVENT_TRACE_PROPERTIES) + (1024 + 1024) * sizeof(WCHAR)]; EVENT_TRACE_PROPERTIES etp; }; // {2ED6006E-4729-4609-B423-3EE7BCD678EF} static constexpr GUID GUID_Microsoft_Windows_NDIS_PacketCapture = { 0x2ED6006E, 0x4729, 0x4609,{ 0xB4, 0x23, 0x3E, 0xE7, 0xBC, 0xD6, 0x78, 0xEF } }; static DWORD StartNdisCapService() { service_handle hscm(OpenSCManager(nullptr, nullptr, SC_MANAGER_CONNECT)); ATLENSURE_RETURN_VAL(hscm != nullptr, GetLastError()); service_handle hsc(OpenService(hscm.get(), L"ndiscap", SERVICE_START)); ATLENSURE_RETURN_VAL(hsc != nullptr, GetLastError()); return StartService(hsc.get(), 0, nullptr); } static DWORD SetNdisCapParameters(bool enable) { ATL::CRegKey key; auto lstatusCreate = key.Create( HKEY_LOCAL_MACHINE, LR"(System\CurrentControlSet\Services\NdisCap\Parameters)"); ATLENSURE_RETURN_VAL(lstatusCreate == ERROR_SUCCESS, lstatusCreate); DWORD refCount; auto lstatusQuery = key.QueryDWORDValue(L"RefCount", refCount); ATLENSURE_RETURN_VAL(lstatusQuery == ERROR_SUCCESS, lstatusQuery); if (enable) { ++refCount; auto lstatusSetRefCount = key.SetDWORDValue(L"RefCount", refCount); ATLENSURE_RETURN_VAL(lstatusSetRefCount == ERROR_SUCCESS, lstatusSetRefCount); } else { if (refCount > 0) { --refCount; auto lstatusSetRefCount = key.SetDWORDValue(L"RefCount", refCount); ATLENSURE_RETURN_VAL(lstatusSetRefCount == ERROR_SUCCESS, lstatusSetRefCount); } } if (enable) { auto lstatusSetCaptureMode = key.SetDWORDValue(L"CaptureMode", 0); ATLENSURE_RETURN_VAL(lstatusSetCaptureMode == ERROR_SUCCESS, lstatusSetCaptureMode); } return ERROR_SUCCESS; } static DWORD EnableCapture(bool enable) { Microsoft::WRL::ComPtr<INetCfg> nc; auto hrCreate = CoCreateInstance(CLSID_CNetCfg, nullptr, CLSCTX_SERVER, IID_PPV_ARGS(&nc)); ATLENSURE_RETURN_HR(SUCCEEDED(hrCreate), hrCreate); Microsoft::WRL::ComPtr<INetCfgLock> lock; auto hrQueryL = nc.As(&lock); ATLENSURE_RETURN_HR(SUCCEEDED(hrQueryL), hrQueryL); auto hrLock = lock->AcquireWriteLock(5000, L"NdisCapPacket", nullptr); ATLENSURE_RETURN_HR(SUCCEEDED(hrLock), hrLock); auto hrInit = nc->Initialize(nullptr); ATLENSURE_RETURN_HR(SUCCEEDED(hrInit), hrInit); Microsoft::WRL::ComPtr<INetCfgComponent> ndisCap; auto hrFind = nc->FindComponent(L"ms_ndiscap", &ndisCap); ATLENSURE_RETURN_HR(SUCCEEDED(hrFind), hrFind); Microsoft::WRL::ComPtr<INetCfgComponentBindings> bindings; auto hrQueryB = ndisCap.As(&bindings); ATLENSURE_RETURN_HR(SUCCEEDED(hrQueryB), hrQueryB); Microsoft::WRL::ComPtr<IEnumNetCfgBindingPath> enumBindingPath; auto hrEnum = bindings->EnumBindingPaths(EBP_BELOW, &enumBindingPath); ATLENSURE_RETURN_HR(SUCCEEDED(hrEnum), hrEnum); for (;;) { ATL::CComPtr<INetCfgBindingPath> bindingPath; ULONG fetched; auto hrNext = enumBindingPath->Next(1, &bindingPath, &fetched); ATLENSURE_RETURN_HR(SUCCEEDED(hrNext), hrNext); if (hrNext != S_OK) { break; } auto hrEnable = bindingPath->Enable(static_cast<BOOL>(enable)); ATLENSURE_RETURN_HR(SUCCEEDED(hrEnable), hrEnable); } auto hrApply = nc->Apply(); ATLENSURE_RETURN_HR(SUCCEEDED(hrApply), hrApply); ATL::CRegKey session; auto lstatusCreate = session.Create( HKEY_CURRENT_USER, LR"(System\CurrentControlSet\Control\NetTrace\Session)", nullptr, REG_OPTION_NON_VOLATILE, KEY_SET_VALUE); ATLENSURE_RETURN_VAL(lstatusCreate == ERROR_SUCCESS, lstatusCreate); auto lstatusSet = session.SetDWORDValue(L"CaptureEnabled", 1u); ATLENSURE_RETURN_VAL(lstatusSet == ERROR_SUCCESS, lstatusSet); auto hrReleaseLock = lock->ReleaseWriteLock(); ATLENSURE_RETURN_HR(SUCCEEDED(hrReleaseLock), hrReleaseLock); auto hrUninit = nc->Uninitialize(); ATLENSURE_RETURN_HR(SUCCEEDED(hrUninit), hrUninit); return S_OK; } static std::pair<DWORD, TRACEHANDLE> StartTrace() { TRACEHANDLE th; EventTracePropertiesWithBuffer buffer{}; buffer.etp.Wnode.BufferSize = sizeof buffer; buffer.etp.Wnode.ClientContext = 2; // Query perfomance counter buffer.etp.Wnode.Flags = WNODE_FLAG_TRACED_GUID; buffer.etp.BufferSize = 128; buffer.etp.MaximumBuffers = 128; buffer.etp.MaximumFileSize = 250; buffer.etp.LogFileMode = EVENT_TRACE_REAL_TIME_MODE; buffer.etp.LoggerNameOffset = sizeof buffer.etp; auto resultStartTrace = StartTrace(&th, SessionName, &buffer.etp); if (resultStartTrace == ERROR_ALREADY_EXISTS) { auto resultControlTrace = ControlTrace(0, SessionName, &buffer.etp, EVENT_TRACE_CONTROL_STOP); ATLENSURE_RETURN_VAL(resultControlTrace == ERROR_SUCCESS, std::make_pair(resultControlTrace, TRACEHANDLE())); resultStartTrace = StartTrace(&th, SessionName, &buffer.etp); } ATLENSURE_RETURN_VAL(resultStartTrace == ERROR_SUCCESS, std::make_pair(resultStartTrace, TRACEHANDLE())); ENABLE_TRACE_PARAMETERS params{}; params.Version = ENABLE_TRACE_PARAMETERS_VERSION; auto resultEnableTrace = EnableTraceEx2(th, &GUID_Microsoft_Windows_NDIS_PacketCapture, EVENT_CONTROL_CODE_ENABLE_PROVIDER, TRACE_LEVEL_INFORMATION, 0, 0, 0, &params); ATLENSURE_RETURN_VAL(resultEnableTrace == ERROR_SUCCESS, std::make_pair(resultEnableTrace, TRACEHANDLE())); return{ ERROR_SUCCESS, th }; } std::pair<DWORD, TRACEHANDLE> StartCapture() { for (;;) { auto resultService = StartNdisCapService(); if (resultService == ERROR_SUCCESS) { break; } else if (resultService == ERROR_INVALID_FUNCTION) { Sleep(50); continue; } return{ resultService, TRACEHANDLE() }; } auto resultParameters = SetNdisCapParameters(true); ATLENSURE_RETURN_VAL(resultParameters == ERROR_SUCCESS, std::make_pair(resultParameters, TRACEHANDLE())); auto resultCapture = EnableCapture(true); ATLENSURE_RETURN_VAL(resultCapture == ERROR_SUCCESS, std::make_pair(resultCapture, TRACEHANDLE())); return StartTrace(); } void StopCapture(_In_ TRACEHANDLE th) { EventTracePropertiesWithBuffer buffer{}; buffer.etp.Wnode.BufferSize = sizeof buffer; buffer.etp.LoggerNameOffset = sizeof buffer.etp; buffer.etp.LogFileNameOffset = sizeof buffer.etp + 1024 * sizeof (WCHAR); ControlTrace(th, nullptr, &buffer.etp, EVENT_TRACE_CONTROL_STOP); EnableCapture(false); SetNdisCapParameters(false); } <|start_filename|>EtwConsumer.cpp<|end_filename|> /* The BSD 3-Clause License Copyright (c) 2016 Egtra All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of {{ project }} nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "stdafx.h" #include <numeric> #include <sstream> #include <unordered_map> #include <evntrace.h> #include <evntcons.h> #include <tdh.h> #include "EtwCommon.h" #pragma comment(lib, "tdh.lib") struct __declspec(uuid("{83ed54f0-4d48-4e45-b16e-726ffd1fa4af}")) Microsoft_Windows_Networking_Correlation; struct __declspec(uuid("{2ed6006e-4729-4609-b423-3ee7bcd678ef}")) Microsoft_Windows_NDIS_PacketCapture; /* per->EventDescriptor.Keyword 0x80000601'40000001 PacketStart 0x80000601'80000001 PacketEnd 0x00000001'00000000 SendPath 0x00000200'00000000 PiiPresent 0x00000400'00000000 Packet */ constexpr ULONGLONG KeywordPacketStart = 0x00000000'40000000; constexpr ULONGLONG KeywordPacketEnd = 0x00000000'80000000; struct GuidHash { std::size_t operator()(const GUID& x) const noexcept { union { std::size_t buffer[sizeof(GUID) / sizeof(std::size_t)]; GUID guid; }; static_assert(sizeof buffer == sizeof(GUID), "Unknown arch"); guid = x; return std::accumulate(std::begin(buffer), std::end(buffer), std::size_t(), [](auto x, auto y) { return x ^ y; }); } }; void CALLBACK EventRecordCallback(_In_ EVENT_RECORD* per) { auto data = static_cast<EventTraceData*>(per->UserContext); static std::unordered_map<GUID, std::vector<BYTE>, GuidHash> fragment; if (false) { std::wostringstream s; WCHAR tmp[39]; if (per->EventHeader.ProviderId == __uuidof(Microsoft_Windows_Networking_Correlation)) { s << "C"; } else if (per->EventHeader.ProviderId == __uuidof(Microsoft_Windows_NDIS_PacketCapture)) { s << "P"; } else { StringFromGUID2(per->EventHeader.ProviderId, tmp, ARRAYSIZE(tmp)); s << tmp; } StringFromGUID2(per->EventHeader.ActivityId, tmp, ARRAYSIZE(tmp)); s << ", Activity ID: " << tmp; for (int i = 0; i < per->ExtendedDataCount; ++i) { const auto& e = per->ExtendedData[i]; if (e.ExtType == EVENT_HEADER_EXT_TYPE_RELATED_ACTIVITYID) { const auto& r = *(const EVENT_EXTENDED_ITEM_RELATED_ACTIVITYID*)(e.DataPtr); StringFromGUID2(r.RelatedActivityId, tmp, ARRAYSIZE(tmp)); s << ", RelatedActivityId: " << tmp; } else { s << ", ExtType: " << e.ExtType; } } if (per->UserDataLength <= 26 || *((BYTE*)per->UserData + 24) != 0x08 || *((BYTE*)per->UserData + 25) != 0x00) { if (per->EventHeader.ProviderId == __uuidof(Microsoft_Windows_NDIS_PacketCapture)) { s << " !"; } } if (per->EventHeader.ProviderId != __uuidof(Microsoft_Windows_Networking_Correlation)) { ULONG bufferSize = 0; auto statusSize = TdhGetEventInformation(per, 0, nullptr, nullptr, &bufferSize); if (statusSize != ERROR_INSUFFICIENT_BUFFER) { return; } auto buffer = std::make_unique<std::uint8_t[]>(bufferSize); auto info = reinterpret_cast<TRACE_EVENT_INFO*>(buffer.get()); auto status = TdhGetEventInformation(per, 0, nullptr, info, &bufferSize); if (status != ERROR_SUCCESS) { return; } for (ULONG i = 0; i < info->TopLevelPropertyCount; i++) { const auto& propertyInfo = info->EventPropertyInfoArray[i]; auto name = reinterpret_cast<PCWSTR>(buffer.get() + propertyInfo.NameOffset); if (std::wcscmp(name, L"FragmentSize") != 0) { continue; } PROPERTY_DATA_DESCRIPTOR desc{ reinterpret_cast<uintptr_t>(name), ULONG_MAX, }; ULONG propertyBufferSize; auto statusPropSize = TdhGetPropertySize(per, 0, nullptr, 1, &desc, &propertyBufferSize); if (statusPropSize != ERROR_SUCCESS) { continue; } auto propertyBuffer = std::make_unique<std::uint8_t[]>(propertyBufferSize); auto statusProp = TdhGetProperty(per, 0, nullptr, 1, &desc, propertyBufferSize, propertyBuffer.get()); if (statusProp != ERROR_SUCCESS) { continue; } if ((propertyInfo.Flags & PropertyStruct) != 0) { continue; } if (propertyInfo.nonStructType.InType != TDH_INTYPE_UINT32) { continue; } s << L", Fragment size: " << *reinterpret_cast<UINT32*>(propertyBuffer.get()); } } s << "\r\n"; OutputDebugStringW(s.str().c_str()); } if (per->EventHeader.ProviderId != __uuidof(Microsoft_Windows_NDIS_PacketCapture)) { return; } ULONG bufferSize = 0; auto statusSize = TdhGetEventInformation(per, 0, nullptr, nullptr, &bufferSize); if (statusSize != ERROR_INSUFFICIENT_BUFFER) { return; } auto buffer = std::make_unique<std::uint8_t[]>(bufferSize); auto info = reinterpret_cast<TRACE_EVENT_INFO*>(buffer.get()); auto status = TdhGetEventInformation(per, 0, nullptr, info, &bufferSize); if (status != ERROR_SUCCESS) { return; } for (ULONG i = 0; i < info->TopLevelPropertyCount; i++) { const auto& propertyInfo = info->EventPropertyInfoArray[i]; auto name = reinterpret_cast<PCWSTR>(buffer.get() + propertyInfo.NameOffset); if (std::wcscmp(name, L"Fragment") != 0) { continue; } PROPERTY_DATA_DESCRIPTOR desc{ reinterpret_cast<uintptr_t>(name), ULONG_MAX, }; ULONG propertyBufferSize; auto statusPropSize = TdhGetPropertySize(per, 0, nullptr, 1, &desc, &propertyBufferSize); if (statusPropSize != ERROR_SUCCESS) { continue; } auto propertyBuffer = std::make_unique<std::uint8_t[]>(propertyBufferSize); auto statusProp = TdhGetProperty(per, 0, nullptr, 1, &desc, propertyBufferSize, propertyBuffer.get()); if (statusProp != ERROR_SUCCESS) { continue; } if ((propertyInfo.Flags & PropertyStruct) != 0) { continue; } if (propertyInfo.nonStructType.InType != TDH_INTYPE_BINARY) { continue; } std::wostringstream s; WCHAR tmp[39]; StringFromGUID2(per->EventHeader.ActivityId, tmp, ARRAYSIZE(tmp)); s << tmp << ' ' << std::hex << per->EventHeader.Flags; auto it = fragment.find(per->EventHeader.ActivityId); if (it == fragment.end()) { if ((per->EventHeader.EventDescriptor.Keyword & KeywordPacketEnd) != 0) { data->Packet.push(std::vector<std::uint8_t>(propertyBuffer.get(), propertyBuffer.get() + propertyBufferSize)); } else { fragment.emplace( per->EventHeader.ActivityId, std::vector<std::uint8_t>(propertyBuffer.get(), propertyBuffer.get() + propertyBufferSize)); } } else { it->second.insert( it->second.end(), propertyBuffer.get(), propertyBuffer.get() + propertyBufferSize); if ((per->EventHeader.EventDescriptor.Keyword & KeywordPacketEnd) != 0) { data->Packet.push(std::move(it->second)); fragment.erase(it); } } } } <|start_filename|>EtwCommon.h<|end_filename|> /* The BSD 3-Clause License Copyright (c) 2016 Egtra All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of {{ project }} nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #pragma once #include "stdafx.h" static constexpr const wchar_t* SessionName = L"NdisCapPacket"; struct EventTraceData : ADAPTER { EventTraceData() : ADAPTER{} { } TRACEHANDLE TraceHandleController; TRACEHANDLE TraceHandleConsumer; std::thread ConsumerThread; concurrency::concurrent_queue<std::vector<std::uint8_t>> Packet; }; std::pair<DWORD, TRACEHANDLE> StartCapture(); void StopCapture(_In_ TRACEHANDLE th); void CALLBACK EventRecordCallback(_In_ EVENT_RECORD* per); <|start_filename|>stdafx.h<|end_filename|> /* The BSD 3-Clause License Copyright (c) 2016 Egtra All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of {{ project }} nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #pragma once #include "targetver.h" #include <cassert> #include <cstdint> #include <memory> #include <new> #include <string> #include <thread> #include <vector> #include <system_error> #include <concurrent_queue.h> #define WIN32_LEAN_AND_MEAN #include <windows.h> #include <winsock2.h> #include <ole2.h> #define PTSTR PSTR #include "packet32.h" #undef PTSTR #define _ATL_NO_AUTOMATIC_NAMESPACE #include <atlbase.h>
egtra/ndiscap-packet
<|start_filename|>bot.js<|end_filename|> const Telegraf = require('telegraf') const mongo = require('mongodb').MongoClient const axios = require('axios') const fs = require('fs') const data = require('./data') const countries = require('./countries') const session = require('telegraf/session') const Stage = require('telegraf/stage') const Scene = require('telegraf/scenes/base') const { leave } = Stage const stage = new Stage() const bot = new Telegraf(data.token) const scanQR = new Scene('scanQR') stage.register(scanQR) const generate = new Scene('generate') stage.register(generate) const scanBarcode = new Scene('scanBarcode') stage.register(scanBarcode) mongo.connect(data.mongoLink, {useNewUrlParser: true}, (err, client) => { if (err) { sendError(err) } db = client.db('oneqrbot') bot.startPolling() }) bot.use(session()) bot.use(stage.middleware()) bot.start((ctx) => { starter(ctx) }) bot.hears('🔍 Scan QR Code', (ctx) => { ctx.scene.enter('scanQR') }) bot.hears('🖊 Generate QR Code', (ctx) => { ctx.scene.enter('generate') }) bot.hears('🔍 Scan Barcode', (ctx) => { ctx.scene.enter('scanBarcode') }) bot.hears('📁 Source code', (ctx) => { ctx.reply( 'You can see code of this bot on GitHub. Thanks for stars!', { reply_markup: { inline_keyboard: [[{text: '🔗 GitHub', url: 'https://github.com/Khuzha/oneqrbot'}]] } } ) }) scanBarcode.enter((ctx) => { ctx.reply( 'I`m ready. Send a picture!', { reply_markup: { keyboard: [['⬅️ Back']], resize_keyboard: true } } ) }) scanBarcode.leave((ctx) => starter(ctx)) scanBarcode.on('photo', async (ctx) => { ctx.replyWithChatAction('typing') const imageData = await bot.telegram.getFile(ctx.message.photo[ctx.message.photo.length - 1].file_id) const writer = fs.createWriteStream(data.imagesFolder + imageData.file_path.substr(7)) axios({ method: 'get', url: `https://api.telegram.org/file/bot${data.token}/${imageData.file_path}`, responseType: 'stream' }) .then(async (response) => { await response.data.pipe(writer) axios({ method: 'get', url: `https://zxing.org/w/decode?u=https://khuzha.tk/barcodes/${imageData.file_path.substr(7)}` }) .then((barcodeData) => { const html = barcodeData.data.toString() const start = html.indexOf('<td>Parsed Result</td>') + 31 const end = html.indexOf('</pre></td></tr></table>') ctx.reply(`Your code is ${html.substring(start, end)}. Soon I'll say you the country of origin of products. Wait please! function is in development still.`) }) .catch((err) => { if (err.response.data.includes('No barcode was found in this image')) { return ctx.reply('No data found on this photo. Please try again.') } console.log(2, err) sendError(`error when sending zxing: ${err}`, ctx) }) }) .catch((err) => { console.log(1, err) ctx.reply('No data found on this photo. Please try again.') sendError(err, ctx) }) }) scanBarcode.hears('⬅️ Back', (ctx) => {ctx.scene.leave('scanBarcode')}) scanBarcode.leave((ctx) => starter(ctx)) scanQR.enter((ctx) => { ctx.reply( 'I`m ready. Send a picture!', { reply_markup: { keyboard: [['⬅️ Back']], resize_keyboard: true } } ) }) scanQR.on('photo', async (ctx) => { ctx.replyWithChatAction('typing') const imageData = await bot.telegram.getFile(ctx.message.photo[ctx.message.photo.length - 1].file_id) axios({ url: `https://api.qrserver.com/v1/read-qr-code/?fileurl=https://api.telegram.org/file/bot${data.token}/${imageData.file_path}`, method: 'GET' }) .then(async (response) => { if (response.data[0].symbol[0].error === null) { await ctx.reply('Scanned data:') await ctx.reply(response.data[0].symbol[0].data) } else { await ctx.reply('No data found on this picture.') } ctx.reply('You can send me other pictures or tap "⬅️ Back"') updateStat('scanning') updateUser(ctx, true) }) .catch((err) => { ctx.reply('No data found on this picture.') sendError(err, ctx) }) }) scanQR.hears('⬅️ Back', (ctx) => { starter(ctx) ctx.scene.leave('scanQR') }) generate.enter((ctx) => { ctx.reply( 'I`m ready. Send me text!', { reply_markup: { keyboard: [['⬅️ Back']], resize_keyboard: true } } ) }) generate.hears('⬅️ Back', (ctx) => { starter(ctx) ctx.scene.leave('generate') }) generate.on('text', async (ctx) => { if (ctx.message.text.length > 900) { return ctx.reply('Your text is too long. Please send text that contains not more than 900 symbols.') } ctx.replyWithChatAction('upload_photo') axios.get(`http://api.qrserver.com/v1/create-qr-code/?data=${encodeURI(ctx.message.text)}&size=300x300`) .then(async (response) => { await ctx.replyWithPhoto(`http://api.qrserver.com/v1/create-qr-code/?data=${encodeURI(ctx.message.text)}&size=300x300`, { caption: 'Generated via @OneQRBot' }) ctx.reply('You can send me another text or tap "⬅️ Back"') updateStat('generating') updateUser(ctx, true) }) .catch(async (err) => { console.log(err) await ctx.reply('Data you sent isn`t valid. Please check that and try again.') ctx.reply('You can send me another text or tap "⬅️ Back"') sendError(`Generating error by message ${ctx.message.text}: \n\n ${err.toString()}`, ctx) }) }) bot.hears('📈 Statistic', async (ctx) => { ctx.replyWithChatAction('typing') const allUsers = (await db.collection('allUsers').find({}).toArray()).length const activeUsers = (await db.collection('allUsers').find({status: 'active'}).toArray()).length const blockedUsers = (await db.collection('allUsers').find({status: 'blocked'}).toArray()).length const scanned = await db.collection('statistic').find({genAct: 'scanning'}).toArray() const generated = await db.collection('statistic').find({genAct: 'generating'}).toArray() const button = (await db.collection('statistic').find({genAct: 'button'}).toArray())[0].count let todayScans = +(await db.collection('statistic').find({action: 'scanning'}).toArray())[0][makeDate()] let todayGens = +(await db.collection('statistic').find({action: 'generating'}).toArray())[0][makeDate()] !todayScans ? todayScans = 0 : false !todayGens ? todayGens = 0 : false let scansPercent = Math.round((scanned[0].count / (scanned[0].count + generated[0].count)) * 100) let gensPercent = Math.round((generated[0].count / (scanned[0].count + generated[0].count)) * 100) let todayScansPercent = Math.round((todayScans / (todayScans + todayGens)) * 100) let todayGensPercent = Math.round((todayGens / (todayScans + todayGens)) * 100) !scansPercent ? scansPercent = 0 : false !gensPercent ? gensPercent = 0 : false !todayScansPercent ? todayScansPercent = 0 : false !todayGensPercent ? todayGensPercent = 0 : false ctx.reply( `👥 <strong>Total users: ${allUsers}</strong>` + `\n🤴 Active users: ${activeUsers} - ${Math.round((activeUsers / allUsers) * 100)}%` + `\n🧛‍♂️ Blocked users: ${blockedUsers} - ${Math.round((blockedUsers / allUsers) * 100)}%` + `\n\n🕹 <strong>All actions: ${scanned[0].count + generated[0].count}</strong>` + `\n📽 Scanned: ${scanned[0].count} times - ${scansPercent}%` + `\n📤 Generated: ${generated[0].count} times - ${gensPercent}%` + `\n\n📅 <strong>Actions today: ${todayScans + todayGens} - ${Math.round((todayScans + todayGens) / (scanned[0].count + generated[0].count) * 100)}% of all</strong>` + `\n📽 Scanned today: ${todayScans} times - ${todayScansPercent}%` + `\n📤 Generated today: ${todayGens} times - ${todayGensPercent}%` + `\n\n⭕️ This button was pressed ${button} times`, {parse_mode: 'html'} ) updateStat('button') }) bot.command('users', async (ctx) => { let allUsers = await db.collection('allUsers').find({}).toArray() let activeUsers = 0 let blockedUsers = 0 for (let key of allUsers) { await bot.telegram.sendChatAction(key.userId, 'typing') .then((res) => { activeUsers++ }) .catch((err) => { blockedUsers++ updateUser(ctx, false) }) } ctx.reply( `⭕️ Total users: ${allUsers.length} ` + `\n✅ Active users: ${activeUsers} - ${Math.round((activeUsers / allUsers.length) * 100)}%` + `\n❌ Blocked users: ${blockedUsers} - ${Math.round((blockedUsers / allUsers.length) * 100)}%` ) }) bot.on('message', async (ctx) => { ctx.scene.leave('scanQR') ctx.scene.leave('generator') starter(ctx) }) function starter (ctx) { ctx.reply( 'Hi! What do you want to do?', { reply_markup: { keyboard: [['🔍 Scan QR Code'], ['🖊 Generate QR Code'], ['🔍 Scan Barcode'], ['📈 Statistic', '📁 Source code']], resize_keyboard: true } } ) updateUser(ctx, true) } function updateUser (ctx, active) { let jetzt = active ? 'active' : 'blocked' db.collection('allUsers').updateOne({userId: ctx.from.id}, {$set: {status: jetzt}}, {upsert: true, new: true}) } function updateStat (action) { if (action == 'button') { return db.collection('statistic').updateOne({genAct: action}, {$inc: {count: 1}}, {new: true, upsert: true}) } db.collection('statistic').updateOne({action: action}, {$inc: {[makeDate()]: 1}}, {new: true, upsert: true}) db.collection('statistic').updateOne({genAct: action}, {$inc: {count: 1}}, {new: true, upsert: true}) } function makeDate () { const today = new Date() const yyyy = today.getFullYear() let mm = today.getMonth() + 1 let dd = today.getDate() dd < 10 ? dd = '0' + dd : false mm < 10 ? mm = '0' + mm : false return `${mm}/${dd}/${yyyy}` } function sendError (err, ctx) { if (err.toString().includes('message is not modified')) { return } bot.telegram.sendMessage(data.dev, `Ошибка у [${ctx.from.first_name}](tg://user?id=${ctx.from.id}) \n\nОшибка: ${err}`, { parse_mode: 'markdown' }) } <|start_filename|>data.js<|end_filename|> module.exports = { token: 'token', // token from @BotFather mongoLink: 'link', // mongo-link from cloud.mongodb.com dev: 123456789, // developer`s id for sending him/her errors }
lab-sandbox/oneqrbot
<|start_filename|>background.js<|end_filename|> // Determine if the browser chrome is dark const isDarkTheme = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches; const CONTEXT_MENU_ID = 'dc82bba0-dfd0-484d-9782-c8a27c521121'; const MUTE_TAB_STR = 'Mute Tab'; const UNMUTE_TAB_STR = 'Unmute Tab'; const MUTED_BADGE_STR = ' M '; const BADGE_BACKGROUND = '#212121'; const EXTENSION_ICONS = Object.freeze({ muted: { '16': `images/16_m${isDarkTheme ? '_white' : ''}.png`, '48': `images/48_m${isDarkTheme ? '_white' : ''}.png`, '128': `images/128_m${isDarkTheme ? '_white' : ''}.png`, }, unmuted: { '16': `images/16_u${isDarkTheme ? '_white' : ''}.png`, '48': `images/48_u${isDarkTheme ? '_white' : ''}.png`, '128': `images/128_u${isDarkTheme ? '_white' : ''}.png`, }, }); const MUTED_ICONS = EXTENSION_ICONS.muted; const UNMUTED_ICONS = EXTENSION_ICONS.unmuted; // Listen for tab switches and update the browserAction icon according to audible state chrome.tabs.onActivated.addListener(function ({ tabId }) { chrome.tabs.get(tabId, function (tab) { if (tab.mutedInfo.muted) { return; } setIconFromAudible(tab.audible, tab.id); }); }); // Listen for tab updates and update the icon to reflect the new state of the tab chrome.tabs.onUpdated.addListener(function (tabId, changeInfo, tab) { // Keep the muted icon in sync if the tab was reloaded if ('status' in changeInfo) { return updateUIState(tab, tab.mutedInfo.muted); } // If we're currently muted or about to be muted, then exit early if ((tab.mutedInfo.muted && !('mutedInfo' in changeInfo)) || ('mutedInfo' in changeInfo && changeInfo.mutedInfo.muted)) { return; } // Otherwise, check audible state and update icon accordingly. if ('audible' in changeInfo) { setIconFromAudible(changeInfo.audible, tabId); } }); // Only create listeners if not already set up to prevent error if (!chrome.contextMenus.onClicked.hasListeners()) { // Create context menu on all available menus chrome.contextMenus.create({ id: CONTEXT_MENU_ID, type: 'normal', title: MUTE_TAB_STR, contexts: ['all'] // Chrome doesn't allow us to add a custom context menu item to the actual tab. }); // Modify the mute state when interacting with the context menu option chrome.contextMenus.onClicked.addListener(function (info, tab) { if (info.menuItemId === CONTEXT_MENU_ID) { updateMuteState(tab); } }); } // Browser frame icon chrome.browserAction.setBadgeBackgroundColor({ color: BADGE_BACKGROUND }); chrome.browserAction.onClicked.addListener(function (tab) { updateMuteState(tab); }); // Flip the muted state of the tab function updateMuteState(tab) { let current_state = tab.mutedInfo.muted; let should_mute = !current_state; chrome.tabs.update(tab.id, { muted: should_mute }); updateUIState(tab, should_mute); } // Update the UI to reflect the current muted state function updateUIState(tab, should_mute) { let tabId = tab.id; let title = MUTE_TAB_STR; if (should_mute) { title = UNMUTE_TAB_STR; chrome.browserAction.setBadgeText({ text: MUTED_BADGE_STR, tabId }); chrome.browserAction.setIcon({ path: MUTED_ICONS, tabId }); } else { chrome.browserAction.setBadgeText({ text: '', tabId }); setIconFromAudible(tab.audible, tabId); } chrome.contextMenus.update(CONTEXT_MENU_ID, { title }); } // Update icon based on audible state function setIconFromAudible(is_audible, tabId) { let path = is_audible ? UNMUTED_ICONS : MUTED_ICONS; chrome.browserAction.setIcon({ path, tabId }); } <|start_filename|>build.js<|end_filename|> const JSZip = require('node-zip'); const fs = require('fs'); const FILES = [ 'manifest.json', 'background.js', 'images/16_u.png', 'images/48_u.png', 'images/128_u.png', 'images/16_m.png', 'images/48_m.png', 'images/128_m.png', 'images/16_u_white.png', 'images/48_u_white.png', 'images/128_u_white.png', 'images/16_m_white.png', 'images/48_m_white.png', 'images/128_m_white.png' ]; function run() { try { console.log('🔥 starting build...'); if (!fs.existsSync('build')) { fs.mkdirSync('build'); } const zip = new JSZip(); for (const file of FILES) { zip.file(file, fs.readFileSync(file)); } const data = zip.generate({ type: 'nodebuffer' }); fs.writeFileSync('build/chrome-tab-mute.zip', data); console.log('🚀 build finished'); } catch (error) { console.error(error.message); } } run();
trmcnvn/chrome-tab-mute
<|start_filename|>scpp_models/src/rocketQuat.cpp<|end_filename|> #include "common.hpp" #include "rocketQuat.hpp" namespace scpp::models { void RocketQuat::systemFlowMap(const state_vector_ad_t &x, const input_vector_ad_t &u, const param_vector_ad_t &par, state_vector_ad_t &f) { using T = scalar_ad_t; auto alpha_m = par(0); auto g_I = par.segment<3>(1); auto J_B_inv = par.segment<3>(4).asDiagonal().inverse(); auto r_T_B = par.segment<3>(7); // = 10 parameters // state variables auto m = x(0); auto v = x.segment<3>(4); auto q = x.segment<4>(7); auto w = x.segment<3>(11); auto thrust = u.head<3>(); auto torque = Eigen::Matrix<T, 3, 1>(T(0.), T(0.), u(3)); auto R_I_B = Eigen::Quaternion<T>(q(0), q(1), q(2), q(3)) .toRotationMatrix(); f(0) = -alpha_m * thrust.norm(); f.segment<3>(1) << v; f.segment<3>(4) << 1. / m * R_I_B * thrust + g_I; f.segment<4>(7) << T(0.5) * omegaMatrix<T>(w) * q; f.segment<3>(11) << J_B_inv * (r_T_B.cross(thrust) + torque) - w.cross(w); } void RocketQuat::getInitializedTrajectory(trajectory_data_t &td) { for (size_t k = 0; k < td.n_X(); k++) { const double alpha1 = double(td.n_X() - k) / td.n_X(); const double alpha2 = double(k) / td.n_X(); // mass, position and linear velocity td.X.at(k)(0) = alpha1 * p.x_init(0) + alpha2 * p.x_final(0); td.X.at(k).segment(1, 6) = alpha1 * p.x_init.segment(1, 6) + alpha2 * p.x_final.segment(1, 6); // do SLERP for quaternion auto q0_ = p.x_init.segment<4>(7); auto q1_ = p.x_final.segment<4>(7); Eigen::Quaterniond q0(q0_(0), q0_(1), q0_(2), q0_(3)); Eigen::Quaterniond q1(q1_(0), q1_(1), q1_(2), q1_(3)); Eigen::Quaterniond qs = q0.slerp(alpha2, q1); td.X.at(k).segment<4>(7) << qs.w(), qs.vec(); // angular velocity td.X.at(k).segment<3>(11) = alpha1 * p.x_init.segment<3>(11) + alpha2 * p.x_final.segment<3>(11); } for (auto &u : td.U) { u << 0., 0., (p.T_max - p.T_min) / 2., 0.; } td.t = p.final_time; } void RocketQuat::addApplicationConstraints(std::shared_ptr<cvx::OptimizationProblem> socp, state_vector_v_t &, input_vector_v_t &U0) { cvx::MatrixX v_X, v_U; socp->getVariable("X", v_X); socp->getVariable("U", v_U); // Initial state socp->addConstraint(cvx::equalTo(v_X.col(0), cvx::dynpar(p.x_init))); // Final State // mass and roll are free for (size_t i : {1, 2, 3, 4, 5, 6, 8, 9, 11, 12, 13}) { socp->addConstraint(cvx::equalTo(v_X(i, v_X.cols() - 1), cvx::dynpar(p.x_final(i)))); } // State Constraints: // Mass socp->addConstraint(cvx::greaterThan(v_X.row(0), cvx::dynpar(p.x_final(0)))); // Glide Slope socp->addConstraint(cvx::lessThan(v_X.block(1, 0, 2, v_X.cols()).colwise().norm(), cvx::dynpar(p_dyn.gs_const) * v_X.block(3, 0, 1, v_X.cols()))); // Max Tilt Angle socp->addConstraint(cvx::lessThan(v_X.block(8, 0, 2, v_X.cols()).colwise().norm(), cvx::dynpar(p_dyn.tilt_const))); // Max Rotation Velocity socp->addConstraint(cvx::lessThan(v_X.block(11, 0, 3, v_X.cols()).colwise().norm(), cvx::dynpar(p.w_B_max))); // Control Constraints: // Final Input socp->addConstraint(cvx::equalTo(v_U.col(v_U.cols() - 1)(0), 0.)); socp->addConstraint(cvx::equalTo(v_U.col(v_U.cols() - 1)(1), 0.)); socp->addConstraint(cvx::equalTo(v_U.col(v_U.cols() - 1)(3), 0.)); if (p.exact_minimum_thrust) { p_dyn.U0_ptr = &U0; p_dyn.thrust_const.resize(3, U0.size()); // Linearized Minimum Thrust socp->addConstraint(cvx::greaterThan(cvx::dynpar(p_dyn.thrust_const).cwiseProduct(v_U.topRows(3)).colwise().sum(), cvx::dynpar(p.T_min))); } else { // Simplified Minimum Thrust socp->addConstraint(cvx::greaterThan(v_U.row(2), cvx::dynpar(p.T_min))); } // Maximum Thrust socp->addConstraint(cvx::lessThan(v_U.topRows(3).colwise().norm(), cvx::dynpar(p.T_max))); // Maximum Gimbal Angle socp->addConstraint(cvx::lessThan(v_U.topRows(2).colwise().norm(), cvx::dynpar(p_dyn.gimbal_const) * v_U.row(2))); if (p.enable_roll_control) { socp->addConstraint(cvx::box(-cvx::dynpar(p.t_max), v_U.row(3), cvx::dynpar(p.t_max))); } else { socp->addConstraint(cvx::equalTo(v_X.row(13), 0.)); socp->addConstraint(cvx::equalTo(v_U.row(3), 0.)); } } void RocketQuat::nondimensionalize() { p.nondimensionalize(); } void RocketQuat::redimensionalize() { p.redimensionalize(); } void RocketQuat::updateProblemParameters() { p_dyn.gimbal_const = std::tan(p.gimbal_max); p_dyn.gs_const = std::tan(p.gamma_gs); p_dyn.tilt_const = std::sqrt((1. - std::cos(p.theta_max)) / 2.); for (size_t k = 0; k < size_t(p_dyn.thrust_const.cols()); k++) { p_dyn.thrust_const.col(k) = p_dyn.U0_ptr->at(k).head<3>().normalized(); } } void RocketQuat::getNewModelParameters(param_vector_t &param) { param << p.alpha_m, p.g_I, p.J_B, p.r_T_B; updateProblemParameters(); } void RocketQuat::nondimensionalizeTrajectory(trajectory_data_t &td) { for (auto &x : td.X) { x(0) /= p.m_scale; x.segment<6>(1) /= p.r_scale; } for (auto &u : td.U) { u.head<3>() /= p.m_scale * p.r_scale; u(3) /= p.m_scale * p.r_scale * p.r_scale; } } void RocketQuat::redimensionalizeTrajectory(trajectory_data_t &td) { for (auto &x : td.X) { x(0) *= p.m_scale; x.segment<6>(1) *= p.r_scale; } for (auto &u : td.U) { u.head<3>() *= p.m_scale * p.r_scale; u(3) *= p.m_scale * p.r_scale * p.r_scale; } } void RocketQuat::Parameters::randomizeInitialState() { // std::mt19937 eng(time(nullptr)); // auto dist = std::uniform_real_distribution<double>(-1., 1.); // // mass // x_init(0) *= 1.; // // position // x_init(1) *= dist(eng); // x_init(2) *= dist(eng); // x_init(3) *= 1.; // // velocity // x_init(4) *= dist(eng); // x_init(5) *= dist(eng); // x_init(6) *= 1. + 0.2 * dist(eng); // // orientation // double rx = dist(eng) * rpy_init.x(); // double ry = dist(eng) * rpy_init.y(); // double rz = rpy_init.z(); // Eigen::Vector3d euler(rx, ry, rz); // x_init.segment(7, 3) << quaternionToVector(eulerToQuaternionXYZ(euler)); } void RocketQuat::loadParameters() { p.loadFromFile(getParameterFolder() + "/model.info"); } void RocketQuat::Parameters::loadFromFile(const std::string &path) { ParameterServer param(path); bool random_initial_state; double I_sp; double m_init, m_dry; Eigen::Vector3d r_init, v_init, rpy_init, w_init; Eigen::Vector3d r_final, v_final, rpy_final, w_final; param.loadMatrix("g_I", g_I); param.loadMatrix("J_B", J_B); param.loadMatrix("r_T_B", r_T_B); param.loadScalar("m_init", m_init); param.loadMatrix("r_init", r_init); param.loadMatrix("v_init", v_init); param.loadMatrix("rpy_init", rpy_init); param.loadMatrix("w_init", w_init); param.loadMatrix("w_final", w_final); param.loadScalar("m_dry", m_dry); param.loadMatrix("r_final", r_final); param.loadMatrix("v_final", v_final); param.loadMatrix("rpy_final", rpy_final); param.loadScalar("T_min", T_min); param.loadScalar("T_max", T_max); param.loadScalar("t_max", t_max); param.loadScalar("I_sp", I_sp); param.loadScalar("gimbal_max", gimbal_max); param.loadScalar("theta_max", theta_max); param.loadScalar("gamma_gs", gamma_gs); param.loadScalar("w_B_max", w_B_max); param.loadScalar("random_initial_state", random_initial_state); param.loadScalar("final_time", final_time); param.loadScalar("exact_minimum_thrust", exact_minimum_thrust); param.loadScalar("enable_roll_control", enable_roll_control); deg2rad(gimbal_max); deg2rad(theta_max); deg2rad(gamma_gs); deg2rad(w_B_max); deg2rad(rpy_init); deg2rad(rpy_final); deg2rad(w_init); deg2rad(w_final); alpha_m = 1. / (I_sp * fabs(g_I(2))); const auto q_init = eulerToQuaternionXYZ(rpy_init); const auto q_final = eulerToQuaternionXYZ(rpy_final); x_init << m_init, r_init, v_init, q_init.w(), q_init.vec(), w_init; if (random_initial_state) { randomizeInitialState(); } x_final << m_dry, r_final, v_final, q_final.w(), q_final.vec(), w_final; } void RocketQuat::Parameters::nondimensionalize() { m_scale = x_init(0); r_scale = x_init.segment(1, 3).norm(); alpha_m *= r_scale; r_T_B /= r_scale; g_I /= r_scale; J_B /= m_scale * r_scale * r_scale; x_init(0) /= m_scale; x_init.segment(1, 3) /= r_scale; x_init.segment(4, 3) /= r_scale; x_final(0) /= m_scale; x_final.segment(1, 3) /= r_scale; x_final.segment(4, 3) /= r_scale; T_min /= m_scale * r_scale; T_max /= m_scale * r_scale; t_max /= m_scale * r_scale * r_scale; } void RocketQuat::Parameters::redimensionalize() { alpha_m /= r_scale; r_T_B *= r_scale; g_I *= r_scale; J_B *= m_scale * r_scale * r_scale; x_init(0) *= m_scale; x_init.segment(1, 3) *= r_scale; x_init.segment(4, 3) *= r_scale; x_final(0) *= m_scale; x_final.segment(1, 3) *= r_scale; x_final.segment(4, 3) *= r_scale; T_min *= m_scale * r_scale; T_max *= m_scale * r_scale; t_max *= m_scale * r_scale * r_scale; } } // namespace scpp::models <|start_filename|>scpp_models/include/rocketQuatDefinitions.hpp<|end_filename|> #pragma once namespace scpp::models { enum dimensions { STATE_DIM = 14, INPUT_DIM = 4, PARAM_DIM = 10 }; } <|start_filename|>scpp/src/sc_dynamic.cpp<|end_filename|> #include "sc_dynamic.hpp" trajectory_data_t sc_dynamic(std::shared_ptr<Model> model) { scpp::SCAlgorithm solver(model); solver.initialize(); trajectory_data_t td; solver.solve(); solver.getSolution(td); return td; } <|start_filename|>scpp_core/src/LQRTracker.cpp<|end_filename|> #include "LQRTracker.hpp" namespace scpp { LQRTracker::LQRTracker(Model::ptr_t model, const trajectory_data_t &td) : model(model), td(td) { loadParameters(); gains.resize(td.n_X()); for (size_t k = 0; k < td.n_X(); k++) { Model::state_matrix_t A; Model::control_matrix_t B; if (not td.interpolatedInput() and k == td.n_X() - 2) { model->computeJacobians(td.X.at(k), td.U.at(k - 1), A, B); } else { model->computeJacobians(td.X.at(k), td.U.at(k), A, B); } ComputeLQR(Q, R, A, B, gains.at(k)); } } void LQRTracker::loadParameters() { ParameterServer param(model->getParameterFolder() + "/LQR.info"); Model::state_vector_t q; Model::input_vector_t r; param.loadMatrix("state_weights", q); param.loadMatrix("input_weights", r); Q = q.asDiagonal(); R = r.asDiagonal(); } void LQRTracker::getInput(double t, const Model::state_vector_t &x, Model::input_vector_t &u) const { t = std::clamp(t, 0., td.t); const Model::state_vector_t x_target = td.approxStateAtTime(t); const Model::input_vector_t u_target = td.inputAtTime(t); const Model::feedback_matrix_t K = interpolateGains(t); u = -K * (x - x_target) + u_target; } Model::feedback_matrix_t LQRTracker::interpolateGains(double t) const { t = std::clamp(t, 0., td.t); const double dt = td.t / (td.n_X() - 1); double interpolate_value = std::fmod(t, dt) / dt; const size_t i = t / dt; const Model::feedback_matrix_t K0 = gains.at(i); const Model::feedback_matrix_t K1 = td.interpolatedInput() ? gains.at(std::min(gains.size() - 1, i + 1)) : gains.at(i); return K0 + interpolate_value * (K1 - K0); } } // namespace scpp <|start_filename|>scpp_core/include/SCProblem.hpp<|end_filename|> #pragma once #include "activeModel.hpp" namespace scpp { std::shared_ptr<cvx::OptimizationProblem> buildSCProblem( double &weight_time, double &weight_trust_region_time, double &weight_trust_region_trajectory, double &weight_virtual_control, trajectory_data_t &td, discretization_data_t &dd); } <|start_filename|>scpp_models/include/rocketQuat.hpp<|end_filename|> #pragma once #include <string> #include <random> #include "systemModel.hpp" #include "parameterServer.hpp" #include "common.hpp" #include "rocketQuatDefinitions.hpp" namespace scpp::models { /** * @brief A 3D rocket landing model. * */ class RocketQuat : public SystemModel<RocketQuat, STATE_DIM, INPUT_DIM, PARAM_DIM> { public: RocketQuat() = default; inline static const std::string modelName = "RocketQuat"; void systemFlowMap( const state_vector_ad_t &x, const input_vector_ad_t &u, const param_vector_ad_t &par, state_vector_ad_t &f) override; void getInitializedTrajectory(trajectory_data_t &td) override; void addApplicationConstraints(std::shared_ptr<cvx::OptimizationProblem> socp, state_vector_v_t &X0, input_vector_v_t &U0) override; void nondimensionalize() override; void redimensionalize() override; void nondimensionalizeTrajectory(trajectory_data_t &td) override; void redimensionalizeTrajectory(trajectory_data_t &td) override; void getNewModelParameters(param_vector_t &param) override; void loadParameters(); struct Parameters { bool exact_minimum_thrust; bool enable_roll_control; Eigen::Vector3d g_I; Eigen::Vector3d J_B; Eigen::Vector3d r_T_B; double alpha_m; double T_min; double T_max; double t_max; double gimbal_max; double theta_max; double gamma_gs; double w_B_max; state_vector_t x_init; state_vector_t x_final; double final_time; double m_scale, r_scale; void randomizeInitialState(); void loadFromFile(const std::string &path); void nondimensionalize(); void redimensionalize(); void nondimensionalizeTrajectory(state_vector_v_t &X, input_vector_v_t &U) const; void redimensionalizeTrajectory(state_vector_v_t &X, input_vector_v_t &U) const; } p; struct DynamicParameters { double tilt_const; double gs_const; double gimbal_const; Eigen::MatrixXd thrust_const; input_vector_v_t *U0_ptr; } p_dyn; private: void updateProblemParameters(); }; } // namespace scpp::models <|start_filename|>scpp/src/LQR_sim.cpp<|end_filename|> #include <experimental/filesystem> #include "LQRAlgorithm.hpp" #include "simulation.hpp" #include "timing.hpp" #include "commonFunctions.hpp" namespace fs = std::experimental::filesystem; fs::path getOutputPath() { return fs::path("..") / "output" / Model::getModelName(); } int main() { auto model = std::make_shared<Model>(); model->loadParameters(); model->initializeModel(); scpp::LQRAlgorithm solver(model); const double sim_time = 5.; const double write_steps = 30; solver.initialize(); Model::state_vector_v_t X; Model::input_vector_v_t U; Model::state_vector_v_t X_sim; Model::input_vector_v_t U_sim; std::vector<double> t_sim; Model::input_vector_t u; Model::state_vector_t x = model->p.x_init; solver.setFinalState(model->p.x_final); double t = 0.; size_t sim_step = 0; const double time_step = 0.010; const double run_timer = tic(); while (t < sim_time) { fmt::print("{:=^{}}\n", fmt::format("<SIMULATION STEP {}>", sim_step), 60); solver.setInitialState(x); // solve with current state solver.solve(); // get the calculated input solver.getSolution(u); u.z() = std::max(model->p.T_min, u.z()); // constrain input const double c = std::tan(model->p.gimbal_max) * u.z(); if (u.head<2>().norm() > c) { u.head<2>() = c * u.head<2>().normalized(); } if (u.norm() > model->p.T_max) { u = model->p.T_max * u.normalized(); } // move time forward scpp::simulate(model, time_step, u, u, x); t += time_step; X_sim.push_back(x); U_sim.push_back(u); t_sim.push_back(t); sim_step++; if ((x - model->p.x_final).norm() < 0.02) { break; } } fmt::print("\n"); fmt::print("{:=^{}}\n", fmt::format("<SIMULATION FINISHED>"), 60); fmt::print("{:<{}}{:.2f}s\n", "Runtime:", 50, 0.001 * toc(run_timer)); fmt::print("{:<{}}{:.2f}s\n", "Simulated time:", 50, t); const double freq = double(sim_step) / t; fmt::print("{:<{}}{:.2f}Hz\n", "Average frequency:", 50, freq); fmt::print("\n"); // write solution to files double write_timer = tic(); fs::path outputPath = getOutputPath() / "LQR" / scpp::getTimeString() / "0"; if (not fs::exists(outputPath) and not fs::create_directories(outputPath)) { throw std::runtime_error("Could not create output directory!"); } const Eigen::IOFormat CSVFormat(Eigen::StreamPrecision, Eigen::DontAlignCols, ", ", "\n"); X_sim = scpp::reduce_vector(X_sim, write_steps); U_sim = scpp::reduce_vector(U_sim, write_steps); t_sim = scpp::reduce_vector(t_sim, write_steps); { std::ofstream f(outputPath / "X.txt"); for (auto &state : X_sim) { f << state.transpose().format(CSVFormat) << "\n"; } } { std::ofstream f(outputPath / "U.txt"); for (auto &input : U_sim) { f << input.transpose().format(CSVFormat) << "\n"; } } { std::ofstream f(outputPath / "t.txt"); for (auto &time : t_sim) { f << time << "\n"; } } fmt::print("{:<{}}{:.2f}ms\n", "Time, solution files:", 50, toc(write_timer)); } <|start_filename|>scpp_core/src/simulation.cpp<|end_filename|> #include <simulation.hpp> #include <boost/numeric/odeint.hpp> #include "eigenIntegration.hpp" namespace scpp { class ODE { public: ODE(Model::ptr_t model, double dt, const Model::input_vector_t &u0, const Model::input_vector_t &u1); void operator()(const Model::state_vector_t &f, Model::state_vector_t &dfdt, const double t); private: Model::ptr_t model; Model::input_vector_t u0, u1; double dt; }; ODE::ODE(Model::ptr_t model, double dt, const Model::input_vector_t &u0, const Model::input_vector_t &u1) : model(model), u0(u0), u1(u1), dt(dt) {} void ODE::operator()(const Model::state_vector_t &f, Model::state_vector_t &dfdt, const double t) { Model::input_vector_t u = u0 + t / dt * (u1 - u0); model->computef(f, u, dfdt); } void simulate(Model::ptr_t model, double dt, const Model::input_vector_t &u0, const Model::input_vector_t &u1, Model::state_vector_t &x) { using namespace boost::numeric::odeint; runge_kutta_fehlberg78<Model::state_vector_t, double, Model::state_vector_t, double, vector_space_algebra> stepper; ODE ode(model, dt, u0, u1); integrate_adaptive(stepper, ode, x, 0., dt, dt / 20.); } } // namespace scpp <|start_filename|>scpp_core/include/SCvxProblem.hpp<|end_filename|> #pragma once #include "activeModel.hpp" namespace scpp { std::shared_ptr<cvx::OptimizationProblem> buildSCvxProblem( double &trust_region, double &weight_virtual_control, trajectory_data_t &td, discretization_data_t &dd); } <|start_filename|>scpp_core/include/SCAlgorithm.hpp<|end_filename|> #pragma once #include "SCProblem.hpp" #include "parameterServer.hpp" namespace scpp { class SCAlgorithm { public: /** * @brief Construct a new SC solver. * * @param model The system model. */ explicit SCAlgorithm(Model::ptr_t model); /** * @brief Initializes the algorithm. Has to be called before solving the problem. * */ void initialize(); /** * @brief Solves the system. * * @param warm_start Whether to reuse the last computed trajectory. */ void solve(bool warm_start = false); /** * @brief Get the solution variables object. * * @param X The state trajectory. * @param U The input trajectory. * @param t The final time. */ void getSolution(trajectory_data_t &trajectory) const; /** * @brief Get the solution from each iteration * */ void getAllSolutions(std::vector<trajectory_data_t> &all_trajectories); private: /** * @brief Reads the solution variables X, U and sigma. * */ void readSolution(); /** * @brief Loads the parameters from the configuration file. * */ void loadParameters(); /** * @brief Performs a Successive Convexification iteration. * * @return true If converged. * @return false If not converged. */ bool iterate(); /** * @brief Calculates defects in the linearized trajectory. * */ std::vector<bool> calculateDefects(); size_t K; Model::ptr_t model; bool free_final_time; bool interpolate_input; bool nondimensionalize; double weight_time; double weight_trust_region_time; double weight_trust_region_trajectory; double weight_virtual_control; double nu_tol; double delta_tol; size_t max_iterations; discretization_data_t dd; trajectory_data_t td; std::vector<trajectory_data_t> all_td; std::shared_ptr<cvx::OptimizationProblem> socp; std::unique_ptr<cvx::ecos::ECOSSolver> solver; }; } // namespace scpp <|start_filename|>scpp_core/utils/src/timing.cpp<|end_filename|> #include "timing.hpp" using namespace std::chrono; double tic() { const duration<double, std::milli> s = system_clock::now().time_since_epoch(); return s.count(); } double toc(double start) { return tic() - start; } <|start_filename|>scpp_core/src/SCProblem.cpp<|end_filename|> #include "SCProblem.hpp" namespace scpp { std::shared_ptr<cvx::OptimizationProblem> buildSCProblem( double &weight_time, double &weight_trust_region_time, double &weight_trust_region_trajectory, double &weight_virtual_control, trajectory_data_t &td, discretization_data_t &dd) { const size_t K = td.n_X(); auto socp = std::make_shared<cvx::OptimizationProblem>(); cvx::MatrixX v_X = socp->addVariable("X", Model::state_dim, td.n_X()); // states cvx::MatrixX v_U = socp->addVariable("U", Model::input_dim, td.n_U()); // inputs cvx::MatrixX v_nu = socp->addVariable("nu", Model::state_dim, td.n_X() - 1); // virtual control cvx::MatrixX v_nu_bound = socp->addVariable("nu_bound", Model::state_dim, td.n_X() - 1); // virtual control cvx::Scalar v_norm1_nu = socp->addVariable("norm1_nu"); // virtual control norm upper bound cvx::VectorX v_delta = socp->addVariable("delta", K); // change of the stacked [ x(k), u(k) ] vector cvx::Scalar v_sigma; cvx::Scalar v_delta_sigma; if (dd.variableTime()) { v_sigma = socp->addVariable("sigma"); v_delta_sigma = socp->addVariable("delta_sigma"); // squared change of sigma // minimize total time socp->addCostTerm(cvx::dynpar(weight_time) * v_sigma); // Total time must not be negative socp->addConstraint(cvx::greaterThan(v_sigma, 0.001)); } for (size_t k = 0; k < K - 1; k++) { /** * Build linearized model equality constraint * x(k+1) == A x(k) + B u(k) + C u(k+1) + Sigma sigma + z + nu * */ cvx::VectorX lhs = cvx::dynpar(dd.A.at(k)) * v_X.col(k) + cvx::dynpar(dd.B.at(k)) * v_U.col(k) + cvx::dynpar(dd.z.at(k)) + v_nu.col(k); if (dd.interpolatedInput()) { lhs += cvx::dynpar(dd.C.at(k)) * v_U.col(k + 1); } if (dd.variableTime()) { lhs += cvx::dynpar(dd.s.at(k)) * v_sigma; } socp->addConstraint(cvx::equalTo(lhs, v_X.col(k + 1))); } /** * Build virtual control norm * * minimize (weight_virtual_control * norm1_nu) * s.t. sum(nu_bound) <= norm1_nu * -nu_bound <= nu <= nu_bound * */ { socp->addConstraint(cvx::box(-v_nu_bound, v_nu, v_nu_bound)); // sum(nu_bound) <= norm1_nu socp->addConstraint(cvx::lessThan(v_nu_bound.sum(), v_norm1_nu)); // Minimize the virtual control socp->addCostTerm(cvx::dynpar(weight_virtual_control) * v_norm1_nu); } if (dd.variableTime()) { /** * Build sigma trust region * (sigma - sigma0) * (sigma - sigma0) <= delta_sigma * is equivalent to * norm2( * 0.5 - 0.5 * delta_sigma * sigma0 - sigma * ) * <= 0.5 + 0.5 * delta_sigma; */ { cvx::VectorX norm2_terms(2); norm2_terms << cvx::par(0.5) + cvx::par(-0.5) * v_delta_sigma, -cvx::dynpar(td.t) + v_sigma; socp->addConstraint(cvx::lessThan(norm2_terms.norm(), cvx::par(0.5) + cvx::par(0.5) * v_delta_sigma)); // Minimize delta_sigma socp->addCostTerm(cvx::dynpar(weight_trust_region_time) * v_delta_sigma); } } for (size_t k = 0; k < K; k++) { /** * Build state and input trust-region: * * norm2( * (x - x0) * (u - u0) * ) * <= delta; * */ cvx::VectorX norm2_terms(v_X.rows()); norm2_terms << cvx::dynpar(td.X.at(k)) - v_X.col(k); if (dd.interpolatedInput() or (not dd.interpolatedInput() and k < K - 1)) { norm2_terms.conservativeResize(v_X.rows() + v_U.rows()); norm2_terms.tail(v_U.rows()) = cvx::dynpar(td.U.at(k)) - v_U.col(k); } socp->addConstraint(cvx::lessThan(norm2_terms.norm(), v_delta(k))); } /** * Minimize combined state/input trust region over all K: * */ { // Minimize trust region cost socp->addCostTerm(cvx::dynpar(weight_trust_region_trajectory) * v_delta.sum()); } return socp; } } // namespace scpp <|start_filename|>scpp_core/include/systemDynamics.hpp<|end_filename|> #pragma once #define CODEGEN true #if CODEGEN #include <cppad/cg.hpp> #else #include <cppad/cppad.hpp> #endif namespace scpp { template <size_t STATE_DIM, size_t INPUT_DIM, size_t PARAM_DIM> class SystemDynamics { public: using state_vector_t = Eigen::Matrix<double, STATE_DIM, 1>; using state_matrix_t = Eigen::Matrix<double, STATE_DIM, STATE_DIM>; using input_vector_t = Eigen::Matrix<double, INPUT_DIM, 1>; using input_matrix_t = Eigen::Matrix<double, INPUT_DIM, INPUT_DIM>; using control_matrix_t = Eigen::Matrix<double, STATE_DIM, INPUT_DIM>; using feedback_matrix_t = Eigen::Matrix<double, INPUT_DIM, STATE_DIM>; using param_vector_t = Eigen::Matrix<double, PARAM_DIM, 1>; using dynamic_vector_t = Eigen::Matrix<double, Eigen::Dynamic, 1>; using dynamic_matrix_t = Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic>; using dynamic_vector_map_t = Eigen::Map<dynamic_vector_t>; using state_vector_v_t = std::vector<state_vector_t>; using input_vector_v_t = std::vector<input_vector_t>; using state_matrix_v_t = std::vector<state_matrix_t>; using control_matrix_v_t = std::vector<control_matrix_t>; #if CODEGEN using scalar_t = CppAD::cg::CG<double>; #else using scalar_t = double; #endif using scalar_ad_t = CppAD::AD<scalar_t>; using state_vector_ad_t = Eigen::Matrix<scalar_ad_t, STATE_DIM, 1>; using state_matrix_ad_t = Eigen::Matrix<scalar_ad_t, STATE_DIM, STATE_DIM>; using input_vector_ad_t = Eigen::Matrix<scalar_ad_t, INPUT_DIM, 1>; using control_matrix_ad_t = Eigen::Matrix<scalar_ad_t, STATE_DIM, INPUT_DIM>; using dynamic_vector_ad_t = Eigen::Matrix<scalar_ad_t, Eigen::Dynamic, 1>; using domain_vector_ad_t = Eigen::Matrix<scalar_ad_t, STATE_DIM + INPUT_DIM, 1>; using param_vector_ad_t = Eigen::Matrix<scalar_ad_t, PARAM_DIM, 1>; /** * @brief Initialize the model by compiling the dynamics functions * */ void initializeModel(); /** * @brief Update model parameters. * * @param param */ void updateModelParameters(param_vector_t param); /** * @brief The state derivative function. Has to be implemented by the derived class. All types have to be scalar_ad_t. * * @param x * @param u * @param f */ virtual void systemFlowMap( const state_vector_ad_t &x, const input_vector_ad_t &u, const param_vector_ad_t &par, state_vector_ad_t &f) = 0; /** * @brief Compute the state derivative f(x,u) * * @param x * @param u * @param f */ void computef(const state_vector_t &x, const input_vector_t &u, state_vector_t &f); /** * @brief Compute the state and control Jacobians A(x,u) and B(x,u) * * @param x * @param u * @param A * @param B */ void computeJacobians(const state_vector_t &x, const input_vector_t &u, state_matrix_t &A, control_matrix_t &B); private: CppAD::ADFun<scalar_t> f_; #if CODEGEN std::unique_ptr<CppAD::cg::DynamicLib<double>> dynamicLib; std::unique_ptr<CppAD::cg::GenericModel<double>> model; param_vector_t current_parameters; #endif bool initialized = false; bool parameters_set = false; }; template <size_t STATE_DIM, size_t INPUT_DIM, size_t PARAM_DIM> void SystemDynamics<STATE_DIM, INPUT_DIM, PARAM_DIM>::initializeModel() { if (initialized) { return; } #if CODEGEN dynamic_vector_ad_t x(STATE_DIM + INPUT_DIM + PARAM_DIM); x.setRandom(); CppAD::Independent(x, 0, false); const state_vector_ad_t &state = x.segment<STATE_DIM>(0); const input_vector_ad_t &input = x.segment<INPUT_DIM>(STATE_DIM); const param_vector_ad_t &param = x.segment<PARAM_DIM>(STATE_DIM + INPUT_DIM); state_vector_ad_t dx; systemFlowMap(state, input, param, dx); f_ = CppAD::ADFun<scalar_t>(x, dynamic_vector_ad_t(dx)); f_.optimize(); CppAD::cg::ModelCSourceGen<double> cgen(f_, "model"); cgen.setCreateForwardZero(true); cgen.setCreateJacobian(true); CppAD::cg::ModelLibraryCSourceGen<double> libcgen(cgen); // compile source code CppAD::cg::DynamicModelLibraryProcessor<double> p(libcgen); CppAD::cg::GccCompiler<double> compiler; compiler.addCompileFlag("-O3"); dynamicLib = p.createDynamicLibrary(compiler); model = dynamicLib->model("model"); #else CppAD::thread_alloc::hold_memory(true); dynamic_vector_ad_t x(STATE_DIM + INPUT_DIM); dynamic_vector_ad_t param(PARAM_DIM); x.setOnes(); param.setOnes(); // start recording CppAD::Independent(x, 0, false, param); const state_vector_ad_t &state = x.head<STATE_DIM>(); const input_vector_ad_t &input = x.tail<INPUT_DIM>(); state_vector_ad_t dx; systemFlowMap(state, input, param, dx); // store operation sequence in x' = f(x) and stop recording f_ = CppAD::ADFun<scalar_t>(x, dynamic_vector_ad_t(dx)); f_.optimize(); #endif initialized = true; } template <size_t STATE_DIM, size_t INPUT_DIM, size_t PARAM_DIM> void SystemDynamics<STATE_DIM, INPUT_DIM, PARAM_DIM>::updateModelParameters(param_vector_t param) { #if CODEGEN current_parameters = param; #else f_.new_dynamic(dynamic_vector_t(param)); #endif parameters_set = true; } template <size_t STATE_DIM, size_t INPUT_DIM, size_t PARAM_DIM> void SystemDynamics<STATE_DIM, INPUT_DIM, PARAM_DIM>::computef(const state_vector_t &x, const input_vector_t &u, state_vector_t &f) { assert(initialized and parameters_set); #if CODEGEN dynamic_vector_t input(STATE_DIM + INPUT_DIM + PARAM_DIM); input << x, u, current_parameters; CppAD::cg::ArrayView<const double> input_view(input.data(), input.size()); CppAD::cg::ArrayView<double> f_view(f.data(), f.size()); model->ForwardZero(input_view, f_view); #else dynamic_vector_t input(STATE_DIM + INPUT_DIM); input << x, u; dynamic_vector_map_t f_map(f.data(), STATE_DIM); f_map << f_.Forward(0, input); #endif } template <size_t STATE_DIM, size_t INPUT_DIM, size_t PARAM_DIM> void SystemDynamics<STATE_DIM, INPUT_DIM, PARAM_DIM>::computeJacobians(const state_vector_t &x, const input_vector_t &u, state_matrix_t &A, control_matrix_t &B) { assert(initialized and parameters_set); #if CODEGEN dynamic_vector_t input(STATE_DIM + INPUT_DIM + PARAM_DIM); input << x, u, current_parameters; using full_jacobian_t = Eigen::Matrix<double, STATE_DIM, STATE_DIM + INPUT_DIM + PARAM_DIM, Eigen::RowMajor>; full_jacobian_t J; CppAD::cg::ArrayView<const double> input_view(input.data(), input.size()); CppAD::cg::ArrayView<double> J_view(J.data(), J.size()); model->Jacobian(input_view, J_view); #else dynamic_vector_t input(STATE_DIM + INPUT_DIM); input << x, u; Eigen::Matrix<double, STATE_DIM, STATE_DIM + INPUT_DIM, Eigen::RowMajor> J; dynamic_vector_map_t J_map(J.data(), J.size()); J_map << f_.Jacobian(input); #endif A = J.template block<STATE_DIM, STATE_DIM>(0, 0); B = J.template block<STATE_DIM, INPUT_DIM>(0, STATE_DIM); } } // namespace scpp <|start_filename|>scpp_models/include/common.hpp<|end_filename|> #pragma once #include <Eigen/Dense> namespace scpp::models { template <typename T> void deg2rad(T &deg) { deg *= M_PI / 180.; } template <typename T> void rad2deg(T &rad) { rad *= 180. / M_PI; } template <typename T> Eigen::Matrix<T, 4, 1> quaternionToVector(const Eigen::Quaternion<T> &q) { Eigen::Matrix<T, 4, 1> q_vec; q_vec << q.w(), q.vec(); return q_vec; } // sequence x-y'-z'' is XYZ = Z''Y'X template <typename T> Eigen::Quaternion<T> eulerToQuaternionXYZ(const Eigen::Matrix<T, 3, 1> &eta) { Eigen::Quaternion<T> q; q = Eigen::AngleAxis<T>(eta.x(), Eigen::Matrix<T, 3, 1>::UnitX()) * Eigen::AngleAxis<T>(eta.y(), Eigen::Matrix<T, 3, 1>::UnitY()) * Eigen::AngleAxis<T>(eta.z(), Eigen::Matrix<T, 3, 1>::UnitZ()); return q; } template <typename T> Eigen::Matrix<T, 3, 3> eulerRotationMatrixXY(const Eigen::Matrix<T, 2, 1> &eta) { const T phi = eta.x(); const T theta = eta.y(); Eigen::Matrix<T, 3, 3> M; M.row(0) << cos(theta), T(0.), sin(theta); M.row(1) << sin(theta) * sin(phi), cos(phi), -sin(phi) * cos(theta); M.row(2) << -sin(theta) * cos(phi), sin(phi), cos(phi) * cos(theta); return M; } // sequence x-y-z is ZYX template <typename T> Eigen::Quaternion<T> eulerToQuaternionZYX(const Eigen::Matrix<T, 3, 1> &eta) { Eigen::Quaternion<T> q; q = Eigen::AngleAxis<T>(eta.z(), Eigen::Matrix<T, 3, 1>::UnitZ()) * Eigen::AngleAxis<T>(eta.y(), Eigen::Matrix<T, 3, 1>::UnitY()) * Eigen::AngleAxis<T>(eta.x(), Eigen::Matrix<T, 3, 1>::UnitX()); return q; } template <typename T> Eigen::Matrix<T, 3, 1> quaternionToEulerXYZ(const Eigen::Quaternion<T> &q) { const Eigen::Matrix<T, 3, 3> R = q.toRotationMatrix(); const T phi = atan2(-R(1, 2), R(2, 2)); const T theta = asin(R(0, 2)); const T psi = atan2(-R(0, 1), R(0, 0)); return Eigen::Matrix<T, 3, 1>(phi, theta, psi); } template <typename T> Eigen::Matrix<T, 3, 1> quaternionToEulerZYX(const Eigen::Quaternion<T> &q) { const Eigen::Matrix<T, 3, 3> R = q.toRotationMatrix(); const T phi = atan2(R(1, 0), R(0, 0)); const T theta = asin(-R(2, 0)); const T psi = atan2(R(2, 1), R(2, 2)); return Eigen::Matrix<T, 3, 1>(psi, theta, phi); } template <typename T> Eigen::Quaternion<T> vectorToQuaternion(const Eigen::Matrix<T, 3, 1> &v) { return Eigen::Quaternion<T>(std::sqrt(1. - v.squaredNorm()), v.x(), v.y(), v.z()); } template <typename T> Eigen::Quaternion<T> vectorToQuaternion(const Eigen::Matrix<T, 4, 1> &v) { return Eigen::Quaternion<T>(v(3), v(0), v(1), v(2)); } template <typename T> Eigen::Matrix<T, 3, 3> rotationJacobianXYZ(const Eigen::Matrix<T, 3, 1> &eta) { // const T phi = eta.x(); const T theta = eta.y(); const T psi = eta.z(); Eigen::Matrix<T, 3, 3> M; M.row(0) << cos(psi), -sin(psi), T(0.); M.row(1) << cos(theta) * sin(psi), cos(theta) * cos(psi), T(0.); M.row(2) << -sin(theta) * cos(psi), sin(theta) * sin(psi), cos(theta); return M / cos(theta); } template <typename T> Eigen::Matrix<T, 2, 2> rotationJacobianXY(const Eigen::Matrix<T, 2, 1> &eta) { const T theta = eta.y(); Eigen::Matrix<T, 2, 2> M; M.row(0) << cos(theta), sin(theta); M.row(1) << -sin(theta), cos(theta); return M; } template <typename T> Eigen::Matrix<T, 4, 4> omegaMatrix(const Eigen::Matrix<T, 3, 1> &w) { Eigen::Matrix<T, 4, 4> omega; omega << T(0.), -w(0), -w(1), -w(2), w(0), T(0.), w(2), -w(1), w(1), -w(2), T(0.), w(0), w(2), w(1), -w(0), T(0.); return omega; } template <typename T> Eigen::Matrix<T, 3, 3> omegaMatrixReduced(const Eigen::Matrix<T, 3, 1> &q) { Eigen::Matrix<T, 3, 3> omega; const T qw = sqrt(1. - q.squaredNorm()); omega << qw, -q(2), q(1), q(2), qw, -q(0), -q(1), q(0), qw; return omega; } } // namespace scpp::models <|start_filename|>lib/external/eigenIntegration.hpp<|end_filename|> #ifndef BOOST_NUMERIC_ODEINT_EXTERNAL_EIGEN_EIGEN_ALGEBRA_HPP_INCLUDED #define BOOST_NUMERIC_ODEINT_EXTERNAL_EIGEN_EIGEN_ALGEBRA_HPP_INCLUDED #include <Eigen/Dense> #include <boost/numeric/odeint/algebra/vector_space_algebra.hpp> #include <boost/version.hpp> // Necessary routines for Eigen matrices to work with vector_space_algebra // from odeint // (that is, it lets odeint treat the Eigen matrices correctly, knowing // how to add, multiply, compute the norm, etc) #if (EIGEN_VERSION_AT_LEAST(3, 3, 0) && BOOST_VERSION < 107100) namespace Eigen { namespace internal { template <typename Scalar> struct scalar_add_op { // FIXME default copy constructors seems bugged with std::complex<> EIGEN_DEVICE_FUNC inline scalar_add_op(const scalar_add_op &other) : m_other(other.m_other) {} EIGEN_DEVICE_FUNC inline scalar_add_op(const Scalar &other) : m_other(other) {} EIGEN_DEVICE_FUNC inline Scalar operator()(const Scalar &a) const { return a + m_other; } template <typename Packet> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Packet packetOp(const Packet &a) const { return internal::padd(a, pset1<Packet>(m_other)); } const Scalar m_other; }; template <typename Scalar> struct functor_traits<scalar_add_op<Scalar>> { enum { Cost = NumTraits<Scalar>::AddCost, PacketAccess = packet_traits<Scalar>::HasAdd }; }; } // namespace internal template <typename D> inline const typename Eigen::CwiseUnaryOp< typename Eigen::internal::scalar_add_op< typename Eigen::internal::traits<D>::Scalar>, const D> operator+(const typename Eigen::MatrixBase<D> &m, const typename Eigen::internal::traits<D>::Scalar &s) { return Eigen::CwiseUnaryOp< typename Eigen::internal::scalar_add_op< typename Eigen::internal::traits<D>::Scalar>, const D>(m.derived(), Eigen::internal::scalar_add_op< typename Eigen::internal::traits<D>::Scalar>(s)); } template <typename D> inline const typename Eigen::CwiseUnaryOp< typename Eigen::internal::scalar_add_op< typename Eigen::internal::traits<D>::Scalar>, const D> operator+(const typename Eigen::internal::traits<D>::Scalar &s, const typename Eigen::MatrixBase<D> &m) { return Eigen::CwiseUnaryOp< typename Eigen::internal::scalar_add_op< typename Eigen::internal::traits<D>::Scalar>, const D>(m.derived(), Eigen::internal::scalar_add_op< typename Eigen::internal::traits<D>::Scalar>(s)); } template <typename D1, typename D2> inline const typename Eigen::CwiseBinaryOp< typename Eigen::internal::scalar_quotient_op< typename Eigen::internal::traits<D1>::Scalar>, const D1, const D2> operator/(const Eigen::MatrixBase<D1> &x1, const Eigen::MatrixBase<D2> &x2) { return x1.cwiseQuotient(x2); } template <typename D> inline const typename Eigen::CwiseUnaryOp< typename Eigen::internal::scalar_abs_op< typename Eigen::internal::traits<D>::Scalar>, const D> abs(const Eigen::MatrixBase<D> &m) { return m.cwiseAbs(); } } // namespace Eigen namespace boost { namespace numeric { namespace odeint { template <int S1, int S2, int O, int M1, int M2> struct vector_space_norm_inf<Eigen::Matrix<double, S1, S2, O, M1, M2>> { EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef double result_type; result_type operator()(const Eigen::Matrix<double, S1, S2, O, M1, M2> &m) const { return m.template lpNorm<Eigen::Infinity>(); } }; } // namespace odeint } // namespace numeric } // namespace boost #endif #endif <|start_filename|>scpp_core/include/discretizationData.hpp<|end_filename|> #pragma once #include <cstddef> namespace scpp { template<class Model> struct DiscretizationData { typename Model::state_matrix_v_t A; typename Model::control_matrix_v_t B; typename Model::control_matrix_v_t C; typename Model::state_vector_v_t s; typename Model::state_vector_v_t z; void initialize(size_t K, bool interpolate_input, bool free_final_time); bool interpolatedInput() const; bool variableTime() const; size_t n_X() const; size_t n_U() const; }; template<class Model> void DiscretizationData<Model>::initialize(size_t K, bool interpolate_input, bool free_final_time) { A.resize(K - 1); B.resize(K - 1); if (interpolate_input) { C.resize(K - 1); } else { C.clear(); } if (free_final_time) { s.resize(K - 1); } else { s.clear(); } z.resize(K - 1); } template<class Model> bool DiscretizationData<Model>::interpolatedInput() const { return not C.empty(); } template<class Model> bool DiscretizationData<Model>::variableTime() const { return not s.empty(); } template<class Model> size_t DiscretizationData<Model>::n_X() const { return A.size(); } template<class Model> size_t DiscretizationData<Model>::n_U() const { return B.size(); } } // namespace scpp <|start_filename|>scpp_core/include/discretizationImplementation.hpp<|end_filename|> #pragma once #include <boost/numeric/odeint.hpp> #include "eigenIntegration.hpp" #include "activeModel.hpp" namespace scpp::discretization { template <bool INTERPOLATE_INPUT, bool VARIABLE_TIME> class ODE { private: Model::input_vector_t u_t0, u_t1; double time; double dt; Model::ptr_t model; public: using ode_matrix_t = typename Eigen::Matrix<double, Model::state_dim, 1 + Model::state_dim + Model::input_dim + INTERPOLATE_INPUT * Model::input_dim + VARIABLE_TIME + 1>; ODE(const Model::input_vector_t &u_t0, const Model::input_vector_t &u_t1, const double &time, double dt, Model::ptr_t model) : u_t0(u_t0), u_t1(u_t1), time(time), dt(dt), model(model) {} void operator()(const ode_matrix_t &V, ode_matrix_t &dVdt, const double t); }; template <bool INTERPOLATE_INPUT, bool VARIABLE_TIME> void ODE<INTERPOLATE_INPUT, VARIABLE_TIME>::operator()(const ode_matrix_t &V, ode_matrix_t &dVdt, const double t) { const Model::state_vector_t x = V.col(0); Model::input_vector_t u; if constexpr (INTERPOLATE_INPUT) { u = u_t0 + t / dt * (u_t1 - u_t0); } else { u = u_t0; } Model::state_vector_t f; Model::state_matrix_t A; Model::control_matrix_t B; model->computef(x, u, f); model->computeJacobians(x, u, A, B); if constexpr (VARIABLE_TIME) { A *= time; B *= time; } const Model::state_matrix_t Phi_A_xi = V.template block<Model::state_dim, Model::state_dim>(0, 1); const Model::state_matrix_t Phi_A_xi_inverse = Phi_A_xi.inverse(); size_t cols = 0; // state if constexpr (VARIABLE_TIME) { dVdt.template block<Model::state_dim, 1>(0, cols) = time * f; } else { dVdt.template block<Model::state_dim, 1>(0, cols) = f; } cols += 1; // A dVdt.template block<Model::state_dim, Model::state_dim>(0, cols).noalias() = A * Phi_A_xi; cols += Model::state_dim; if constexpr (INTERPOLATE_INPUT) { // B const double alpha = (dt - t) / dt; dVdt.template block<Model::state_dim, Model::input_dim>(0, cols).noalias() = Phi_A_xi_inverse * B * alpha; cols += Model::input_dim; // C const double beta = t / dt; dVdt.template block<Model::state_dim, Model::input_dim>(0, cols).noalias() = Phi_A_xi_inverse * B * beta; cols += Model::input_dim; } else { // B dVdt.template block<Model::state_dim, Model::input_dim>(0, cols).noalias() = Phi_A_xi_inverse * B; cols += Model::input_dim; } if constexpr (VARIABLE_TIME) { // s dVdt.template block<Model::state_dim, 1>(0, cols).noalias() = Phi_A_xi_inverse * f; cols += 1; // z dVdt.template block<Model::state_dim, 1>(0, cols).noalias() = Phi_A_xi_inverse * (-A * x - B * u); cols += 1; } else { // z dVdt.template block<Model::state_dim, 1>(0, cols).noalias() = Phi_A_xi_inverse * (f - A * x - B * u); cols += 1; } assert(cols == ode_matrix_t::ColsAtCompileTime); } template <bool INTERPOLATE_INPUT, bool VARIABLE_TIME> void multipleShootingImplementation( Model::ptr_t model, trajectory_data_t &td, discretization_data_t &dd) { const size_t K = td.n_X(); using ODEFun = ODE<INTERPOLATE_INPUT, VARIABLE_TIME>; using ode_matrix_t = typename ODEFun::ode_matrix_t; double dt = 1. / double(K - 1); if constexpr (not VARIABLE_TIME) { dt *= td.t; } using namespace boost::numeric::odeint; runge_kutta_fehlberg78<ode_matrix_t, double, ode_matrix_t, double, vector_space_algebra> stepper; for (size_t k = 0; k < K - 1; k++) { ode_matrix_t V; V.col(0) = td.X.at(k); V.template block<Model::state_dim, Model::state_dim>(0, 1).setIdentity(); V.template rightCols<ode_matrix_t::ColsAtCompileTime - 1 - Model::state_dim>().setZero(); const Model::input_vector_t u0 = td.U[k]; const Model::input_vector_t u1 = INTERPOLATE_INPUT ? td.U[k + 1] : u0; ODEFun odeMultipleShooting(u0, u1, td.t, dt, model); integrate_adaptive(stepper, odeMultipleShooting, V, 0., dt, dt / 5.); size_t cols = 1; dd.A[k] = V.template block<Model::state_dim, Model::state_dim>(0, cols); cols += Model::state_dim; dd.B[k].noalias() = dd.A[k] * V.template block<Model::state_dim, Model::input_dim>(0, cols); cols += Model::input_dim; if constexpr (INTERPOLATE_INPUT) { dd.C[k].noalias() = dd.A[k] * V.template block<Model::state_dim, Model::input_dim>(0, cols); cols += Model::input_dim; } if constexpr (VARIABLE_TIME) { dd.s[k].noalias() = dd.A[k] * V.template block<Model::state_dim, 1>(0, cols); cols += 1; } dd.z[k].noalias() = dd.A[k] * V.template block<Model::state_dim, 1>(0, cols); cols += 1; assert(cols == ode_matrix_t::ColsAtCompileTime); } } } // namespace scpp::discretization <|start_filename|>scpp/include/commonFunctions.hpp<|end_filename|> #pragma once #include "activeModel.hpp" namespace scpp { Model::input_vector_t interpolatedInput(const Model::input_vector_v_t &U, double t, double total_time, bool first_order_hold); double expMovingAverage(double previousAverage, double period, double newValue); std::vector<Eigen::Vector3d> getAccelerationRotatingFrame(const trajectory_data_t &td, const Eigen::Vector3d offset = Eigen::Vector3d::Zero(), const double g = 0.); std::string getTimeString(); template <typename T> std::vector<T> reduce_vector(const std::vector<T> &v, size_t steps) { const size_t size = v.size(); std::vector<T> new_vector; for (size_t i = 0; i < steps; i++) { const size_t index = size_t(size / steps * i); new_vector.push_back(v.at(index)); } return new_vector; } } // namespace scpp <|start_filename|>scpp_models/src/rocket2d.cpp<|end_filename|> #include "rocket2d.hpp" #include "common.hpp" namespace scpp::models { void Rocket2d::systemFlowMap(const state_vector_ad_t &x, const input_vector_ad_t &u, const param_vector_ad_t &par, state_vector_ad_t &f) { using T = scalar_ad_t; auto m = par(0); auto J_B = par(1); auto g_I = par.segment<2>(2); auto r_T_B = par.segment<2>(4); // = 6 parameters // state variables // x, y, vx, vy, eta, omega Eigen::Matrix<T, 2, 1> v = x.segment<2>(2); T eta = x(4); T w = x(5); // input variables T angle = u(0); T magnitude = u(1); Eigen::Matrix<T, 2, 1> T_B = Eigen::Rotation2D<T>(angle) * Eigen::Matrix<T, 2, 1>(0., magnitude); Eigen::Rotation2D<T> R_I_B(eta); f.segment<2>(0) << v; f.segment<2>(2) << 1. / m * (R_I_B * T_B) + g_I; f(4) = w; f(5) = 1. / J_B * (r_T_B.x() * T_B.y() - r_T_B.y() * T_B.x()); } void Rocket2d::getOperatingPoint(state_vector_t &x, input_vector_t &u) { x.setZero(); u << 0, -p.g_I * p.m; } void Rocket2d::addApplicationConstraints(std::shared_ptr<cvx::OptimizationProblem> socp, state_vector_v_t &, input_vector_v_t &) { cvx::MatrixX v_X, v_U; socp->getVariable("X", v_X); socp->getVariable("U", v_U); if (p.constrain_initial_final) { // Initial and final state socp->addConstraint(cvx::equalTo(cvx::dynpar(p.x_init), v_X.col(0))); socp->addConstraint(cvx::equalTo(cvx::dynpar(p.x_final), v_X.rightCols(1))); socp->addConstraint(cvx::equalTo(v_U(0, v_U.cols() - 1), 0.)); } // State Constraints: // Glideslope socp->addConstraint(cvx::lessThan(v_X.row(0).colwise().norm(), cvx::dynpar(p.tan_gamma_gs) * v_X.row(1))); // // Max Tilt Angle socp->addConstraint(cvx::box(-cvx::dynpar(p.theta_max), v_X.row(4), cvx::dynpar(p.theta_max))); // Max Rotation Velocity socp->addConstraint(cvx::box(-cvx::dynpar(p.w_B_max), v_X.row(5), cvx::dynpar(p.w_B_max))); // Control Constraints: // Gimbal Range socp->addConstraint(cvx::box(-cvx::dynpar(p.gimbal_max), v_U.row(0), cvx::dynpar(p.gimbal_max))); // Thrust Range socp->addConstraint(cvx::box(cvx::dynpar(p.T_min), v_U.row(1), cvx::dynpar(p.T_max))); } void Rocket2d::nondimensionalize() { p.nondimensionalize(); } void Rocket2d::redimensionalize() { p.redimensionalize(); } void Rocket2d::nondimensionalizeTrajectory(trajectory_data_t &td) { for (auto &x : td.X) { x.head(4) /= p.r_scale; } for (auto &u : td.U) { u(1) /= p.m_scale * p.r_scale; } } void Rocket2d::redimensionalizeTrajectory(trajectory_data_t &td) { for (auto &x : td.X) { x.head(4) *= p.r_scale; } for (auto &u : td.U) { u(1) *= p.m_scale * p.r_scale; } } void Rocket2d::getInitializedTrajectory(trajectory_data_t &td) { for (size_t k = 0; k < td.n_X(); k++) { const double alpha1 = double(td.n_X() - k) / td.n_X(); const double alpha2 = double(k) / td.n_X(); td.X.at(k) = alpha1 * p.x_init + alpha2 * p.x_final; } for (auto &u : td.U) { u << 0, (p.T_max + p.T_min) / 2; } td.t = p.final_time; } void Rocket2d::loadParameters() { p.loadFromFile(getParameterFolder() + "/model.info"); } void Rocket2d::getNewModelParameters(param_vector_t &par) { par << p.m, p.J_B, p.g_I, p.r_T_B; p.tan_gamma_gs = std::tan(p.gamma_gs); } void Rocket2d::Parameters::loadFromFile(const std::string &path) { ParameterServer param(path); param.loadMatrix("g_I", g_I); param.loadScalar("J_B", J_B); param.loadMatrix("r_T_B", r_T_B); Eigen::Vector2d r_init, v_init; Eigen::Vector2d r_final, v_final; double w_init, w_final; param.loadMatrix("r_init", r_init); param.loadMatrix("v_init", v_init); param.loadScalar("eta_init", eta_init); param.loadScalar("w_init", w_init); param.loadMatrix("r_final", r_final); param.loadMatrix("v_final", v_final); param.loadScalar("eta_final", eta_final); param.loadScalar("w_final", w_final); param.loadScalar("final_time", final_time); param.loadScalar("m", m); param.loadScalar("T_min", T_min); param.loadScalar("T_max", T_max); param.loadScalar("gamma_gs", gamma_gs); param.loadScalar("gimbal_max", gimbal_max); param.loadScalar("theta_max", theta_max); param.loadScalar("w_B_max", w_B_max); param.loadScalar("constrain_initial_final", constrain_initial_final); param.loadScalar("add_slack_variables", add_slack_variables); deg2rad(gimbal_max); deg2rad(theta_max); deg2rad(gamma_gs); deg2rad(w_B_max); deg2rad(w_init); deg2rad(w_final); deg2rad(eta_init); deg2rad(eta_final); x_init << r_init, v_init, eta_init, w_init; x_final << r_final, v_final, eta_final, w_final; } void Rocket2d::Parameters::nondimensionalize() { r_scale = x_init.head(2).norm(); m_scale = m; m /= m_scale; r_T_B /= r_scale; g_I /= r_scale; J_B /= m_scale * r_scale * r_scale; x_init.segment<2>(0) /= r_scale; x_init.segment<2>(2) /= r_scale; x_final.segment<2>(0) /= r_scale; x_final.segment<2>(2) /= r_scale; T_min /= m_scale * r_scale; T_max /= m_scale * r_scale; } void Rocket2d::Parameters::redimensionalize() { m *= m_scale; r_T_B *= r_scale; g_I *= r_scale; J_B *= m_scale * r_scale * r_scale; x_init.segment<2>(0) *= r_scale; x_init.segment<2>(2) *= r_scale; x_final.segment<2>(0) *= r_scale; x_final.segment<2>(2) *= r_scale; T_min *= m_scale * r_scale; T_max *= m_scale * r_scale; } } // namespace scpp::models <|start_filename|>scpp_core/include/LQR.hpp<|end_filename|> #pragma once #include "activeModel.hpp" bool ComputeLQR(const Model::state_matrix_t &Q, const Model::input_matrix_t &R, const Model::state_matrix_t &A, const Model::control_matrix_t &B, Model::feedback_matrix_t &K); <|start_filename|>scpp/src/SC_tracking.cpp<|end_filename|> #include <experimental/filesystem> #include "SCAlgorithm.hpp" #include "LQRTracker.hpp" #include "timing.hpp" #include "simulation.hpp" #include "commonFunctions.hpp" namespace fs = std::experimental::filesystem; fs::path getOutputPath() { return fs::path("..") / "output" / Model::getModelName(); } /** * @brief Computes a single SC trajectory and tracks it via LQR. * */ int main() { auto model = std::make_shared<Model>(); model->loadParameters(); scpp::SCAlgorithm solver(model); solver.initialize(); trajectory_data_t td; solver.solve(); solver.getSolution(td); // calculate LQR gains fmt::print("\n"); const double gains_timer = tic(); scpp::LQRTracker tracker(model, td); fmt::print("{:<{}}{:.2f}ms\n", "Time, LQR gains:", 50, 1 * toc(gains_timer)); const double timestep = 0.01; // start simulation const double run_timer = tic(); Model::state_vector_v_t X_sim; Model::input_vector_v_t U_sim; std::vector<double> t_sim; const double t_max = td.t; const double write_steps = 30; Model::state_vector_t x = model->p.x_init; const size_t initial_error = (x - model->p.x_final).norm(); double t = 0.; size_t sim_step = 0; while (t < t_max) { // get the calculated input Model::input_vector_t u; tracker.getInput(t, x, u); // move solve_time forward scpp::simulate(model, timestep, u, u, x); t += timestep; X_sim.push_back(x); U_sim.push_back(u); t_sim.push_back(t); sim_step++; if (x.hasNaN()) { throw std::runtime_error("State has NaN."); } } const size_t final_error = (x - model->p.x_final).norm(); fmt::print("\n"); fmt::print("Simulating trajectory.\n"); fmt::print("Finished after {} steps.\n", sim_step + 1); fmt::print("Final error: {:.4f}%.\n", 100. * final_error / initial_error); fmt::print("{:<{}}{:.2f}ms\n", "Time, simulation:", 50, toc(run_timer)); fmt::print("{:<{}}{:.2f}s\n", "Simulated time:", 50, t); fmt::print("\n"); // write solution to files double write_timer = tic(); fs::path outputPath = getOutputPath() / "SC_tracking" / scpp::getTimeString() / "0"; if (not fs::exists(outputPath) and not fs::create_directories(outputPath)) { throw std::runtime_error("Could not create output directory!"); } const Eigen::IOFormat CSVFormat(Eigen::StreamPrecision, Eigen::DontAlignCols, ", ", "\n"); X_sim = scpp::reduce_vector(X_sim, write_steps); U_sim = scpp::reduce_vector(U_sim, write_steps); t_sim = scpp::reduce_vector(t_sim, write_steps); { std::ofstream f(outputPath / "X.txt"); for (auto &state : X_sim) { f << state.transpose().format(CSVFormat) << "\n"; } } { std::ofstream f(outputPath / "U.txt"); for (auto &input : U_sim) { f << input.transpose().format(CSVFormat) << "\n"; } } { std::ofstream f(outputPath / "t.txt"); for (auto &time : t_sim) { f << time << "\n"; } } fmt::print("{:<{}}{:.2f}ms\n", "Time, solution files:", 50, toc(write_timer)); } <|start_filename|>scpp_core/utils/include/timing.hpp<|end_filename|> #pragma once #include <chrono> double tic(); double toc(double start); <|start_filename|>scpp/src/SC_sim.cpp<|end_filename|> #include <experimental/filesystem> #include "SCAlgorithm.hpp" #include "simulation.hpp" #include "timing.hpp" #include "commonFunctions.hpp" using fmt::format; using fmt::print; namespace fs = std::experimental::filesystem; fs::path getOutputPath() { return fs::path("..") / "output" / Model::getModelName(); } /** * @brief Simulates a trajectory with the SC controller. * * */ int main() { auto model = std::make_shared<Model>(); model->loadParameters(); scpp::SCAlgorithm solver(model); solver.initialize(); const double time_step = 0.05; const size_t max_steps = 100; trajectory_data_t td; Model::state_vector_v_t X_sim; Model::input_vector_v_t U_sim; Model::state_vector_t &x = model->p.x_init; double timer_run = tic(); size_t sim_step = 0; while (sim_step < max_steps) { print("\n{:*^{}}\n\n", format("<SIMULATION STEP {}>", sim_step), 60); const bool warm_start = sim_step > 0; solver.solve(warm_start); solver.getSolution(td); const Model::input_vector_t u0 = td.U.at(0); const bool first_order_hold = td.interpolatedInput(); const Model::input_vector_t u1 = scpp::interpolatedInput(td.U, time_step, td.t, first_order_hold); scpp::simulate(model, time_step, u0, u1, x); X_sim.push_back(x); U_sim.push_back(u0); bool reached_end = (x - model->p.x_final).norm() < 0.02 or td.t < 0.25; if (reached_end) { break; } sim_step++; } print("\n"); print("{:<{}}{:.2f}ms\n", fmt::format("Time, {} steps:", sim_step), 50, toc(timer_run)); const double freq = double(sim_step) / (0.001 * toc(timer_run)); print("{:<{}}{:.2f}Hz\n", "Average frequency:", 50, freq); print("\n"); // write solution to files double timer = tic(); fs::path outputPath = getOutputPath() / "SC_sim" / scpp::getTimeString() / std::to_string(0); if (not fs::exists(outputPath) and not fs::create_directories(outputPath)) { throw std::runtime_error("Could not create output directory!"); } const Eigen::IOFormat CSVFormat(Eigen::StreamPrecision, Eigen::DontAlignCols, ", ", "\n"); { std::ofstream f(outputPath / "X.txt"); for (auto &state : X_sim) { f << state.transpose().format(CSVFormat) << "\n"; } } { std::ofstream f(outputPath / "U.txt"); for (auto &input : U_sim) { f << input.transpose().format(CSVFormat) << "\n"; } } { std::ofstream f(outputPath / "t.txt"); f << sim_step * time_step; } print("{:<{}}{:.2f}ms\n", "Time, solution files:", 50, toc(timer)); } <|start_filename|>scpp/src/commonFunctions.cpp<|end_filename|> #include "commonFunctions.hpp" namespace scpp { Model::input_vector_t interpolatedInput(const Model::input_vector_v_t &U, double t, double total_time, bool first_order_hold) { const size_t K = U.size(); const double time_step = total_time / (K - 1); const size_t i = std::min(size_t(t / time_step), K - 2); const Model::input_vector_t u0 = U.at(i); const Model::input_vector_t u1 = first_order_hold ? U.at(i + 1) : u0; const double t_intermediate = std::fmod(t, time_step) / time_step; const Model::input_vector_t u = u0 + (u1 - u0) * t_intermediate; return u; } double expMovingAverage(double previousAverage, double period, double newValue) { const double factor = 2. / (period + 1.); const double result = (newValue - previousAverage) * factor + previousAverage; return result; } std::vector<Eigen::Vector3d> getAccelerationRotatingFrame(const trajectory_data_t &td, const Eigen::Vector3d offset, const double g) { Model::state_vector_v_t X = td.X; X.push_back(X.back()); // calculate accelerations std::vector<Eigen::Vector3d> acc_passenger_b; const double dt = td.t / (X.size() - 1); for (size_t k = 0; k < X.size() - 1; k++) { const Eigen::Vector3d r_p_b = offset; const Eigen::Vector3d v0 = X.at(k).segment<3>(4); const Eigen::Vector3d v1 = X.at(k + 1).segment<3>(4); // Eigen::Quaterniond q0; // q0.w() = X.at(k)(7); // q0.vec() << X.at(k).segment<3>(8); // q0.normalize(); // Eigen::Quaterniond q1; // q1.w() = X.at(k + 1)(7); // q1.vec() << X.at(k + 1).segment<3>(8); // q1.normalize(); // const Eigen::Quaterniond q = q0.slerp(0.5, q1); const Eigen::Vector3d w0 = X.at(k).segment<3>(11); const Eigen::Vector3d w1 = X.at(k + 1).segment<3>(11); const Eigen::Vector3d w_b = (w1 - w0) / 2; const Eigen::Vector3d dw_b = (w1 - w0) / dt; const Eigen::Vector3d dv_i = (v1 - v0) / dt; const Eigen::Vector3d a_coriolis(0., 0., 0.); // r_p_b is constant const Eigen::Vector3d a_centrifugal = -w_b.cross(w_b.cross(r_p_b)); const Eigen::Vector3d a_euler = -dw_b.cross(r_p_b); const Eigen::Vector3d a_imp = dv_i + Eigen::Vector3d(0., 0., g); acc_passenger_b.push_back(a_imp + a_centrifugal + a_coriolis + a_euler); } return acc_passenger_b; } std::string getTimeString(){ using sc = std::chrono::system_clock ; std::time_t t = sc::to_time_t(sc::now()); char buf[20]; std::strftime(buf, 20, "%Y_%m_%d_%H_%M_%S", std::localtime(&t)); return std::string(buf); } } // namespace scpp <|start_filename|>scpp_core/src/LQRAlgorithm.cpp<|end_filename|> #include "LQRAlgorithm.hpp" namespace scpp { LQRAlgorithm::LQRAlgorithm(Model::ptr_t model) : model(model) { loadParameters(); } void LQRAlgorithm::initialize() { // print("[LQR] Starting controller for model '{}'.\n", Model::getModelName()); assert(state_weights_set and input_weights_set); model->updateModelParameters(); model->getOperatingPoint(x_eq, u_eq); model->computeJacobians(x_eq, u_eq, A, B); ComputeLQR(Q, R, A, B, K); initialized = true; // print("[LQR] Controller started.\n"); } void LQRAlgorithm::solve() { assert(initialized); const Model::state_vector_t state_error = x_init - x_final; u = -K * state_error + u_eq; } void LQRAlgorithm::setInitialState(const Model::state_vector_t &x) { x_init = x; } void LQRAlgorithm::setFinalState(const Model::state_vector_t &x) { x_final = x; } void LQRAlgorithm::setStateWeights(const Model::state_vector_t &weights) { Q.setZero(); Q.diagonal() = weights; state_weights_set = true; } void LQRAlgorithm::setInputWeights(const Model::input_vector_t &weights) { R.setZero(); R.diagonal() = weights; input_weights_set = true; } void LQRAlgorithm::getSolution(Model::input_vector_t &u) { assert(this->u); u = this->u.value(); } void LQRAlgorithm::loadParameters() { ParameterServer param(model->getParameterFolder() + "/LQR.info"); Model::state_vector_t q; Model::input_vector_t r; param.loadMatrix("state_weights", q); param.loadMatrix("input_weights", r); setStateWeights(q); setInputWeights(r); } } // namespace scpp <|start_filename|>scpp_core/include/simulation.hpp<|end_filename|> #pragma once #include "activeModel.hpp" namespace scpp { void simulate(Model::ptr_t model, double dt, const Model::input_vector_t &u0, const Model::input_vector_t &u1, Model::state_vector_t &x); } // namespace scpp <|start_filename|>scpp_core/include/MPCProblem.hpp<|end_filename|> #pragma once #include "activeModel.hpp" namespace scpp { std::shared_ptr<cvx::OptimizationProblem> buildMPCProblem( Model::state_vector_v_t &X, Model::input_vector_v_t &U, Model::state_vector_t &x_init, Model::state_vector_t &x_final, Model::state_vector_t &state_weights_intermediate, Model::state_vector_t &state_weights_terminal, Model::input_vector_t &input_weights, Model::state_matrix_t &A, Model::control_matrix_t &B, Model::state_vector_t &z, bool constant_dynamics = false, bool intermediate_cost_active = true); } <|start_filename|>scpp_core/include/LQRAlgorithm.hpp<|end_filename|> #pragma once #include "LQR.hpp" #include "parameterServer.hpp" namespace scpp { class LQRAlgorithm { public: /** * @brief Construct a new LQR solver. * * @param model The system model. */ explicit LQRAlgorithm(Model::ptr_t model); /** * @brief Initializes the algorithm. Has to be called before solving the problem. * */ void initialize(); /** * @brief Sets a new initial state. * */ void setInitialState(const Model::state_vector_t &x); /** * @brief Sets a new desired state to track. * */ void setFinalState(const Model::state_vector_t &x); /** * @brief Set the state weights * * @param weights */ void setStateWeights(const Model::state_vector_t &weights); /** * @brief Set the input weights * * @param weights */ void setInputWeights(const Model::input_vector_t &weights); /** * @brief Solves the system. * */ void solve(); /** * @brief Get the solution variables object. * * @param X The state trajectory. * @param U The input trajectory. */ void getSolution(Model::input_vector_t &u); private: /** * @brief Loads the parameters from the configuration file. * */ void loadParameters(); Model::feedback_matrix_t K; Model::ptr_t model; Model::state_vector_t x_eq; Model::input_vector_t u_eq; Model::state_matrix_t A; Model::control_matrix_t B; Model::state_matrix_t Q; Model::input_matrix_t R; std::optional<Model::input_vector_t> u; Model::state_vector_t state_weights; Model::input_vector_t input_weights; Model::state_vector_t x_init; Model::state_vector_t x_final; bool state_weights_set = false; bool input_weights_set = false; bool initialized = false; }; } // namespace scpp <|start_filename|>scpp/include/sc_dynamic.hpp<|end_filename|> #pragma once #include "SCAlgorithm.hpp" #include "commonFunctions.hpp" trajectory_data_t sc_dynamic(std::shared_ptr<Model> model); <|start_filename|>scpp_core/src/MPCProblem.cpp<|end_filename|> #include "MPCProblem.hpp" namespace scpp { std::shared_ptr<cvx::OptimizationProblem> buildMPCProblem( Model::state_vector_v_t &X, Model::input_vector_v_t &U, Model::state_vector_t &x_init, Model::state_vector_t &x_final, Model::state_vector_t &state_weights_intermediate, Model::state_vector_t &state_weights_terminal, Model::input_vector_t &input_weights, Model::state_matrix_t &A, Model::control_matrix_t &B, Model::state_vector_t &z, bool constant_dynamics, bool intermediate_cost_active) { auto socp = std::make_shared<cvx::OptimizationProblem>(); cvx::MatrixX v_X = socp->addVariable("X", Model::state_dim, X.size()); // states cvx::MatrixX v_U = socp->addVariable("U", Model::input_dim, U.size()); // inputs cvx::Scalar v_error_cost = socp->addVariable("error_cost"); // error minimization term cvx::Scalar v_input_cost = socp->addVariable("input_cost"); // input minimization term // Initial state for (size_t i = 0; i < Model::state_dim; i++) { socp->addConstraint(cvx::equalTo(v_X.col(0), cvx::dynpar(x_init))); } for (size_t k = 0; k < X.size() - 1; k++) { /** * Build linearized model equality constraint * x(k+1) == A x(k) + B u(k) + z * */ cvx::VectorX lhs; if (constant_dynamics) { lhs = cvx::par(A) * v_X.col(k) + cvx::par(B) * v_U.col(k) + cvx::par(z); } else { lhs = cvx::dynpar(A) * v_X.col(k) + cvx::dynpar(B) * v_U.col(k) + cvx::dynpar(z); } socp->addConstraint(cvx::equalTo(lhs, v_X.col(k + 1))); } /** * Build error cost * */ cvx::VectorX error_norm2_args(1 * v_X.rows()); if (intermediate_cost_active) { error_norm2_args.resize((X.size() - 1) * v_X.rows()); for (size_t k = 1; k < X.size() - 1; k++) { error_norm2_args.segment((k - 1) * v_X.cols(), v_X.cols()) = cvx::dynpar(state_weights_intermediate).cwiseProduct(-cvx::dynpar(x_final) + v_X.col(k)); } } error_norm2_args.tail(v_X.rows()) = cvx::dynpar(state_weights_terminal).cwiseProduct(-cvx::dynpar(x_final) + v_X.col(v_X.cols() - 1)); socp->addConstraint(cvx::lessThan(error_norm2_args.norm(), v_error_cost)); socp->addCostTerm(v_error_cost); /** * Build input cost * */ cvx::VectorX input_norm2_args(U.size() * v_U.rows()); for (size_t k = 0; k < U.size(); k++) { input_norm2_args.segment(k * v_U.rows(), v_U.rows()) = cvx::dynpar(input_weights).cwiseProduct(v_U.col(k)); } socp->addConstraint(cvx::lessThan(input_norm2_args.norm(), v_input_cost)); socp->addCostTerm(v_input_cost); return socp; } } // namespace scpp <|start_filename|>scpp_core/include/trajectoryData.hpp<|end_filename|> #pragma once #include <cstddef> namespace scpp { template <class Model> struct TrajectoryData { typename Model::state_vector_v_t X; typename Model::input_vector_v_t U; double t; void initialize(size_t K, bool interpolate_input); bool interpolatedInput() const; typename Model::input_vector_t inputAtTime(double t) const; typename Model::state_vector_t approxStateAtTime(double t) const; size_t n_X() const; size_t n_U() const; }; template <class Model> void TrajectoryData<Model>::initialize(size_t K, bool interpolate_input) { X.resize(K); U.resize(interpolate_input ? K : K - 1); t = 0.; } template <class Model> bool TrajectoryData<Model>::interpolatedInput() const { return U.size() == X.size(); } template <class Model> typename Model::input_vector_t TrajectoryData<Model>::inputAtTime(double t) const { t = std::clamp(t, 0., this->t); if (t == this->t) { return U.back(); } const double dt = this->t / (n_X() - 1); double interpolate_value = std::fmod(t, dt) / dt; const size_t i = t / dt; const typename Model::input_vector_t u0 = U.at(i); const typename Model::input_vector_t u1 = interpolatedInput() ? U.at(i + 1) : U.at(i); return u0 + interpolate_value * (u1 - u0); } template <class Model> typename Model::state_vector_t TrajectoryData<Model>::approxStateAtTime(double t) const { t = std::clamp(t, 0., this->t); if (t == this->t) { return X.back(); } const double dt = this->t / (n_X() - 1); double interpolate_value = std::fmod(t, dt) / dt; const size_t i = t / dt; const typename Model::state_vector_t x0 = X.at(i); const typename Model::state_vector_t x1 = X.at(i + 1); return x0 + interpolate_value * (x1 - x0); } template <class Model> size_t TrajectoryData<Model>::n_X() const { return X.size(); } template <class Model> size_t TrajectoryData<Model>::n_U() const { return U.size(); } } // namespace scpp <|start_filename|>scpp_core/include/systemModel.hpp<|end_filename|> #pragma once #include <Eigen/Dense> #include "epigraph.hpp" #include "systemDynamics.hpp" #include "trajectoryData.hpp" #include "discretizationData.hpp" namespace scpp { template <typename DERIVED, size_t STATE_DIM, size_t INPUT_DIM, size_t PARAM_DIM> class SystemModel : public SystemDynamics<STATE_DIM, INPUT_DIM, PARAM_DIM> { public: using BASE = SystemDynamics<STATE_DIM, INPUT_DIM, PARAM_DIM>; using trajectory_data_t = TrajectoryData<BASE>; using discretization_data_t = DiscretizationData<BASE>; using ptr_t = std::shared_ptr<DERIVED>; using typename BASE::control_matrix_t; using typename BASE::control_matrix_v_t; using typename BASE::dynamic_matrix_t; using typename BASE::dynamic_vector_map_t; using typename BASE::dynamic_vector_t; using typename BASE::input_vector_t; using typename BASE::input_vector_v_t; using typename BASE::param_vector_t; using typename BASE::state_matrix_t; using typename BASE::state_matrix_v_t; using typename BASE::state_vector_t; using typename BASE::state_vector_v_t; using typename BASE::control_matrix_ad_t; using typename BASE::domain_vector_ad_t; using typename BASE::dynamic_vector_ad_t; using typename BASE::input_vector_ad_t; using typename BASE::param_vector_ad_t; using typename BASE::state_matrix_ad_t; using typename BASE::state_vector_ad_t; enum : size_t { state_dim = STATE_DIM, input_dim = INPUT_DIM, param_dim = PARAM_DIM, }; /** * @brief Construct a new System Model object * */ SystemModel(){}; virtual ~SystemModel(){}; /** * @brief Function to initialize the trajectory of a derived model. Has to be implemented by the derived class. Only required for SC models, * */ virtual void getInitializedTrajectory(trajectory_data_t &) { throw std::runtime_error("getInitializedTrajectory: This function has to be implemented by the derived class."); }; /** * @brief Function to add constraints of a model. Has to be implemented by the derived class. * * @param socp The SOCP. * @param X Last state trajectory. * @param U Last input trajectory. */ virtual void addApplicationConstraints(std::shared_ptr<cvx::OptimizationProblem>, state_vector_v_t &, input_vector_v_t &){}; /** * @brief Gets the new parameters in the system flow map. * */ virtual void getNewModelParameters(param_vector_t &){}; /** * @brief Updates the parameters in the system flow map. * */ void updateModelParameters() { param_vector_t model_params; getNewModelParameters(model_params); BASE::updateModelParameters(model_params); }; /** * @brief Function to remove mass and length dimensions from all function parameters. * */ virtual void nondimensionalize() { throw std::runtime_error("nondimensionalize: This function has to be implemented by the derived class."); }; /** * @brief Function to add mass and length dimensions to all function parameters. * */ virtual void redimensionalize() { throw std::runtime_error("redimensionalize: This function has to be implemented by the derived class."); }; /** * @brief Get the operating point of the system. Usually an equilibrium point for linearization. * */ virtual void getOperatingPoint(state_vector_t &, input_vector_t &) { throw std::runtime_error("getOperatingPoint: This function has to be implemented by the derived class."); }; /** * @brief Function to remove mass and length dimensions from state and input trajectory. * */ virtual void nondimensionalizeTrajectory(trajectory_data_t &) { throw std::runtime_error("nondimensionalizeTrajectory: This function has to be implemented by the derived class."); }; /** * @brief Function to add mass and length dimensions to state and input trajectory. * */ virtual void redimensionalizeTrajectory(trajectory_data_t &) { throw std::runtime_error("redimensionalizeTrajectory: This function has to be implemented by the derived class."); }; static const std::string getModelName() { return DERIVED::modelName; }; void setParameterFolder(const std::string &path) { param_folder_path = path; }; const std::string getParameterFolder() const { return param_folder_path + getModelName(); }; private: std::string param_folder_path = "../scpp_models/config/"; }; } // namespace scpp <|start_filename|>scpp_core/src/SCvxProblem.cpp<|end_filename|> #include "SCvxProblem.hpp" namespace scpp { std::shared_ptr<cvx::OptimizationProblem> buildSCvxProblem( double &trust_region, double &weight_virtual_control, trajectory_data_t &td, discretization_data_t &dd) { auto socp = std::make_shared<cvx::OptimizationProblem>(); cvx::MatrixX v_X = socp->addVariable("X", Model::state_dim, td.n_X()); // states cvx::MatrixX v_U = socp->addVariable("U", Model::input_dim, td.n_U()); // inputs cvx::MatrixX v_nu = socp->addVariable("nu", Model::state_dim, td.n_X() - 1); // virtual control cvx::MatrixX v_nu_bound = socp->addVariable("nu_bound", Model::state_dim, td.n_X() - 1); // virtual control lower/upper bound cvx::Scalar v_norm1_nu = socp->addVariable("norm1_nu"); // virtual control norm for (size_t k = 0; k < td.n_X() - 1; k++) { /** * Build linearized model equality constraint * x(k+1) == A x(k) + B u(k) + C u(k+1) + z + nu * */ cvx::VectorX lhs = cvx::dynpar(dd.A.at(k)) * v_X.col(k) + cvx::dynpar(dd.B.at(k)) * v_U.col(k) + cvx::dynpar(dd.z.at(k)) + v_nu.col(k); if (td.interpolatedInput()) { lhs += cvx::dynpar(dd.C.at(k)) * v_U.col(k + 1); } socp->addConstraint(cvx::equalTo(lhs, v_X.col(k + 1))); } /** * Build virtual control norm * * minimize (weight_virtual_control * norm1_nu) * s.t. sum(nu_bound) <= norm1_nu * -nu_bound <= nu <= nu_bound * */ { socp->addConstraint(cvx::box(-v_nu_bound, v_nu, v_nu_bound)); // sum(nu_bound) <= norm1_nu socp->addConstraint(cvx::lessThan(v_nu_bound.sum(), v_norm1_nu)); // Minimize the virtual control socp->addCostTerm(cvx::dynpar(weight_virtual_control) * v_norm1_nu); } for (size_t k = 0; k < td.n_U(); k++) { /** * Build input trust region: * norm2(u - u0) <= trust_region * */ cvx::VectorX norm2_args = cvx::dynpar(td.U.at(k)) + -v_U.col(k); socp->addConstraint(cvx::lessThan(norm2_args.norm(), cvx::dynpar(trust_region))); } return socp; } } // namespace scpp <|start_filename|>scpp_core/src/discretization.cpp<|end_filename|> #include "discretization.hpp" #include "discretizationImplementation.hpp" #include <eigen3/unsupported/Eigen/src/MatrixFunctions/MatrixExponential.h> namespace scpp::discretization { void exactLinearDiscretization(Model::ptr_t model, double ts, const Model::state_vector_t &x_eq, const Model::input_vector_t &u_eq, Model::state_matrix_t &A, Model::control_matrix_t &B, Model::state_vector_t &z) { Model::state_matrix_t A_c; Model::control_matrix_t B_c; Model::state_vector_t f; model->computeJacobians(x_eq, u_eq, A_c, B_c); model->computef(x_eq, u_eq, f); Eigen::MatrixXd E; E.resize(Model::state_dim + Model::input_dim, Model::state_dim + Model::input_dim); E.setZero(); E.topLeftCorner<Model::state_dim, Model::state_dim>() = A_c; E.topRightCorner<Model::state_dim, Model::input_dim>() = B_c; Eigen::MatrixXd expE = (E * ts).exp(); A = expE.topLeftCorner<Model::state_dim, Model::state_dim>(); B = expE.topRightCorner<Model::state_dim, Model::input_dim>(); E.resize(Model::state_dim + 1, Model::state_dim + 1); E.setZero(); E.topLeftCorner<Model::state_dim, Model::state_dim>() = A_c; E.topRightCorner<Model::state_dim, 1>() = f - A_c * x_eq - B_c * u_eq; expE = (E * ts).exp(); z = expE.topRightCorner<Model::state_dim, 1>(); } void multipleShooting( Model::ptr_t model, trajectory_data_t &td, discretization_data_t &dd) { if (not dd.interpolatedInput() and not dd.variableTime()) multipleShootingImplementation<false, false>(model, td, dd); if (not dd.interpolatedInput() and dd.variableTime()) multipleShootingImplementation<false, true>(model, td, dd); if (dd.interpolatedInput() and not dd.variableTime()) multipleShootingImplementation<true, false>(model, td, dd); if (dd.interpolatedInput() and dd.variableTime()) multipleShootingImplementation<true, true>(model, td, dd); } } // namespace scpp::discretization <|start_filename|>scpp_core/src/LQR.cpp<|end_filename|> #include "LQR.hpp" constexpr size_t STATE_DIM = Model::state_dim; using schur_matrix_t = Eigen::Matrix<double, 2 * STATE_DIM, 2 * STATE_DIM>; using factor_matrix_t = Eigen::Matrix<double, 2 * STATE_DIM, STATE_DIM>; bool solveSchurIterative(const schur_matrix_t &M, Model::state_matrix_t &P, double epsilon, size_t maxIterations) { bool converged = false; schur_matrix_t Mlocal = M; size_t iterations = 0; while (not converged) { if (iterations > maxIterations) return false; const schur_matrix_t Mdiff = Mlocal - Mlocal.inverse(); const schur_matrix_t Mnew = Mlocal - 0.5 * Mdiff; converged = Mnew.isApprox(Mlocal, epsilon); Mlocal = Mnew; iterations++; } /* break down M and extract M11 M12 M21 M22 */ const Model::state_matrix_t M11(Mlocal.topLeftCorner<STATE_DIM, STATE_DIM>()); const Model::state_matrix_t M12(Mlocal.topRightCorner<STATE_DIM, STATE_DIM>()); const Model::state_matrix_t M21(Mlocal.bottomLeftCorner<STATE_DIM, STATE_DIM>()); const Model::state_matrix_t M22(Mlocal.bottomRightCorner<STATE_DIM, STATE_DIM>()); /* find M and N using the elements of M */ factor_matrix_t U; factor_matrix_t V; U.topRows<STATE_DIM>() = M12; U.bottomRows<STATE_DIM>() = M22 + Model::state_matrix_t::Identity(); V.topRows<STATE_DIM>() = M11 + Model::state_matrix_t::Identity(); V.bottomRows<STATE_DIM>() = M21; /* Solve for S from the equation MS=N */ Eigen::FullPivLU<factor_matrix_t> FullPivLU_; FullPivLU_.compute(U); P = FullPivLU_.solve(-V); return true; } bool careSolve(const Model::state_matrix_t &Q, const Model::input_matrix_t &R, const Model::state_matrix_t &A, const Model::control_matrix_t &B, Model::state_matrix_t &P, Model::input_matrix_t &R_inverse) { if ((R - Model::input_matrix_t::Identity().cwiseProduct(R)).any()) { R_inverse = R.inverse(); } else { R_inverse.setZero(); R_inverse.diagonal() = R.diagonal().cwiseInverse(); } schur_matrix_t M; M << A, -B * R_inverse * B.transpose(), -Q, -A.transpose(); return solveSchurIterative(M, P, 1e-8, 100); } bool ComputeLQR(const Model::state_matrix_t &Q, const Model::input_matrix_t &R, const Model::state_matrix_t &A, const Model::control_matrix_t &B, Model::feedback_matrix_t &K) { { using ctrl_matrix_t = Eigen::Matrix<double, Model::state_dim, Model::state_dim * Model::input_dim>; ctrl_matrix_t C; C.block<Model::state_dim, Model::input_dim>(0, 0) = B; for (size_t i = 1; i < Model::state_dim; i++) { C.block<Model::state_dim, Model::input_dim>(0, i * Model::input_dim).noalias() = A * C.block<Model::state_dim, Model::input_dim>(0, (i - 1) * Model::input_dim); } // check if system is controllable assert(Eigen::FullPivLU<ctrl_matrix_t>(C).rank() == Model::state_dim); } Model::input_matrix_t R_inverse; Model::state_matrix_t P; bool success = careSolve(Q, R, A, B, P, R_inverse); K = (R_inverse * (B.transpose() * P)); assert(not K.hasNaN()); return success; } <|start_filename|>scpp_core/include/LQRTracker.hpp<|end_filename|> #pragma once #include "LQR.hpp" #include "parameterServer.hpp" namespace scpp { class LQRTracker { private: std::vector<Model::feedback_matrix_t> gains; Model::state_matrix_t Q; Model::input_matrix_t R; Model::ptr_t model; trajectory_data_t td; void loadParameters(); Model::feedback_matrix_t interpolateGains(double t) const; public: LQRTracker(Model::ptr_t model, const trajectory_data_t &td); void getInput(double t, const Model::state_vector_t &x, Model::input_vector_t &u) const; }; } // namespace scpp <|start_filename|>scpp_core/include/discretization.hpp<|end_filename|> #pragma once #include "activeModel.hpp" namespace scpp::discretization { void exactLinearDiscretization(Model::ptr_t model, double ts, const Model::state_vector_t &x_eq, const Model::input_vector_t &u_eq, Model::state_matrix_t &A, Model::control_matrix_t &B, Model::state_vector_t &z); void multipleShooting( Model::ptr_t model, trajectory_data_t &td, discretization_data_t &dd); } // namespace scpp::discretization
Zentrik/SCpp
<|start_filename|>src/guiUtil.java<|end_filename|> import java.awt.*; /** * @Auther: kracer * @Date: 2021-11-11 - 11 - 11 - 14:58 * @version: 1.0 */ public class guiUtil { private static Dimension screenSize; public guiUtil() { } public static int getWidth() { screenSize = Toolkit.getDefaultToolkit().getScreenSize(); // 获取屏幕尺寸对象 return screenSize.width; } public static int getHeight() { screenSize = Toolkit.getDefaultToolkit().getScreenSize(); return screenSize.height; } } <|start_filename|>src/whoami.java<|end_filename|> import javax.swing.*; import javax.swing.GroupLayout.Alignment; import javax.swing.LayoutStyle.ComponentPlacement; import javax.swing.border.EmptyBorder; import javax.swing.border.EtchedBorder; import java.awt.*; /** * @Auther: kracer * @Date: 2021-11-11 - 11 - 11 - 14:54 * @version: 1.0 */ public class whoami extends JDialog { private final JPanel contentPanel = new JPanel(); public whoami() { this.setTitle("whoami"); this.setBounds((guiUtil.getWidth() - 455) / 2, (guiUtil.getHeight() - 430) / 2, 455, 430); this.getContentPane().setLayout(new BorderLayout()); this.contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); this.getContentPane().add(this.contentPanel, "Center"); this.contentPanel.setLayout((LayoutManager)null); JPanel panel = new JPanel(); panel.setBorder(new EtchedBorder(1, (Color)null, (Color)null)); panel.setBounds(22, 10, 400, 364); this.contentPanel.add(panel); JLabel lblNewLabel = new JLabel("关于"); lblNewLabel.setForeground(Color.RED); lblNewLabel.setHorizontalAlignment(0); lblNewLabel.setFont(new Font("微软雅黑", 1, 16)); JTextPane textPane = new JTextPane(); textPane.setFont(new Font("微软雅黑", 0, 15)); textPane.setEditable(false); textPane.setText("出于网上社工工具的使用繁琐,界面不友好,生成的字典不符合国人设密习惯的出发点,设计开发了此工具。\r\n\n" + "工具开发过程总结了几款软件的生成机制,加上自己对国人设密码的规律总结," + "做出了这款方便渗透爆破的工具。\r\n\n" + "当前为开发的第一个版本,后续优化的工具放在网址\r\nhttps://github.com/kracer127/bearSG\r\n\n" + "好的建议大家不吝赐教,唯一QQ:0x91b8bb99。"); GroupLayout gl_panel = new GroupLayout(panel); gl_panel.setHorizontalGroup(gl_panel.createParallelGroup(Alignment.LEADING).addGroup(gl_panel.createSequentialGroup().addGroup(gl_panel.createParallelGroup(Alignment.LEADING).addGroup(gl_panel.createSequentialGroup().addGap(150).addComponent(lblNewLabel, -2, 80, -2)).addGroup(gl_panel.createSequentialGroup().addGap(5).addContainerGap().addComponent(textPane, -1, 936, -1))).addContainerGap(23, 39767))); gl_panel.setVerticalGroup(gl_panel.createParallelGroup(Alignment.LEADING).addGroup(gl_panel.createSequentialGroup().addContainerGap().addComponent(lblNewLabel, -2, 29, -2).addPreferredGap(ComponentPlacement.UNRELATED).addComponent(textPane, -1, 774, -1).addContainerGap(27, 42767))); panel.setLayout(gl_panel); } } <|start_filename|>src/toUse.java<|end_filename|> import javax.swing.*; import javax.swing.GroupLayout.Alignment; import javax.swing.LayoutStyle.ComponentPlacement; import javax.swing.border.EmptyBorder; import javax.swing.border.EtchedBorder; import java.awt.*; /** * @Auther: kracer * @Date: 2021-11-11 - 11 - 11 - 17:21 * @version: 1.0 */ public class toUse extends JDialog { private final JPanel contentPanel = new JPanel(); public toUse() { this.setTitle("How to use?"); this.setBounds((guiUtil.getWidth() - 455) / 2, (guiUtil.getHeight() - 400) / 2, 455, 430); this.getContentPane().setLayout(new BorderLayout()); this.contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); this.getContentPane().add(this.contentPanel, "Center"); this.contentPanel.setLayout((LayoutManager)null); JPanel panel = new JPanel(); panel.setBorder(new EtchedBorder(1, (Color)null, (Color)null)); panel.setBounds(5, 5, 430, 390); this.contentPanel.add(panel); JLabel lblNewLabel = new JLabel("输入格式示例"); lblNewLabel.setForeground(Color.RED); lblNewLabel.setHorizontalAlignment(0); lblNewLabel.setFont(new Font("微软雅黑", 0, 16)); JTextPane textPane = new JTextPane(); textPane.setFont(new Font("微软雅黑", 0, 13)); textPane.setEditable(false); textPane.setText("姓名:<NAME> 或者 ma yun\r\n\n" + "生日:0327 身份证后六位:271212\r\n\n" + "出生年份:1996 当前年份:2021\r\n\n" + "手机号:13500000000\r\n\n" + "网站的域名:baidu.com或者shitu.baidu.com\r\n\n" + "喜好的数字:520,1314,12345\r\n\n" + "喜好的符号:?,@,&\r\n\n" + "喜欢的人或物:zhouxingchi\r\n\n" + "注意空格和使用英文符号下的逗号!!!"); GroupLayout gl_panel = new GroupLayout(panel); gl_panel.setHorizontalGroup(gl_panel.createParallelGroup(Alignment.LEADING).addGroup(gl_panel.createSequentialGroup().addGroup(gl_panel.createParallelGroup(Alignment.LEADING).addGroup(gl_panel.createSequentialGroup().addGap(152).addComponent(lblNewLabel, -2, 102, -2)).addGroup(gl_panel.createSequentialGroup().addGap(12).addContainerGap().addComponent(textPane, -1, 1236, -1))).addContainerGap(23, 39767))); gl_panel.setVerticalGroup(gl_panel.createParallelGroup(Alignment.LEADING).addGroup(gl_panel.createSequentialGroup().addContainerGap().addComponent(lblNewLabel, -2, 29, -2).addPreferredGap(ComponentPlacement.UNRELATED).addComponent(textPane, -2, 1234, -2).addContainerGap(27, 39767))); panel.setLayout(gl_panel); } } <|start_filename|>src/resultMessage.java<|end_filename|> import javax.swing.*; import javax.swing.GroupLayout.Alignment; import javax.swing.border.EmptyBorder; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.File; /** * @Auther: kracer * @Date: 2021-11-11 - 11 - 11 - 15:06 * @version: 1.0 */ public class resultMessage extends JDialog { private final JPanel contentPanel = new JPanel(); public resultMessage() { this.setTitle("提示"); this.setBounds((guiUtil.getWidth() - 181) / 2, (guiUtil.getHeight() - 167) / 2, 181, 167); this.getContentPane().setLayout(new BorderLayout()); this.contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); this.getContentPane().add(this.contentPanel, "Center"); JLabel label = new JLabel(""); label.setFont(new Font("微软雅黑", 0, 13)); label.setHorizontalAlignment(0); File f = new File(getUserInput.fileOutPath); if (f.exists()) { label.setText("社工字典生成成功!"); } else { label.setText("社工字典生成失败!"); } JButton button = new JButton("确认"); button.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { dispose(); // 关闭当前窗口 } }); button.setFont(new Font("微软雅黑", 0, 12)); GroupLayout gl_contentPanel = new GroupLayout(this.contentPanel); gl_contentPanel.setHorizontalGroup(gl_contentPanel.createParallelGroup(Alignment.LEADING).addGroup(Alignment.TRAILING, gl_contentPanel.createSequentialGroup().addContainerGap(28, 32767).addComponent(label, -2, 159, -2).addGap(28)).addGroup(gl_contentPanel.createSequentialGroup().addGap(60).addComponent(button).addContainerGap(52, 32767))); gl_contentPanel.setVerticalGroup(gl_contentPanel.createParallelGroup(Alignment.TRAILING).addGroup(gl_contentPanel.createSequentialGroup().addGap(29).addComponent(label, -1, 28, 32767).addGap(27).addComponent(button).addGap(21))); this.contentPanel.setLayout(gl_contentPanel); } } <|start_filename|>src/processFile.java<|end_filename|> import java.io.BufferedReader; import java.io.File; import java.io.FileOutputStream; import java.nio.charset.Charset; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.ArrayList; import java.util.List; /** * @Auther: kracer * @Date: 2021-11-11 - 11 - 11 - 14:44 * @version: 1.0 */ public class processFile { public static List<String> read(String pathStr) { System.out.println(pathStr); Charset charset = Charset.forName("utf-8"); //设置字典文件编码方式为utf-8 Path path = Paths.get(pathStr); List<String> lines = new ArrayList<String>(); try (BufferedReader br = Files.newBufferedReader(path, charset);) { String line = ""; while ((line = br.readLine()) != null) { lines.add(line); //逐行读取密码并添加到List } return lines; //返回载有字典密码的List } catch (Exception e) { Charset charset1 = Charset.forName("gbk"); //设置字典文件编码方式为gbk, 后续优化 } return null; } public static void writeTxt(String txtPath, List<String> lines) { FileOutputStream fileOutputStream = null; File file = new File(txtPath); try { if (file.exists()) { //判断文件是否存在,如果不存在就新建一个txt file.createNewFile(); } fileOutputStream = new FileOutputStream(file); for (String i : lines) { String inputStr = i+"\n"; fileOutputStream.write(inputStr.getBytes()); } fileOutputStream.flush(); fileOutputStream.close(); } catch (Exception e) { e.printStackTrace(); } } }
Sec-Fork/bearSG
<|start_filename|>src/org/jgroups/conf/PropertyConverters.java<|end_filename|> package org.jgroups.conf; import org.jgroups.stack.Configurator; import org.jgroups.stack.IpAddress; import org.jgroups.stack.Protocol; import org.jgroups.util.StackType; import org.jgroups.util.Util; import java.lang.reflect.Field; import java.net.*; import java.util.ArrayList; import java.util.Collection; import java.util.Enumeration; import java.util.List; /** * Groups a set of standard PropertyConverter(s) supplied by JGroups. * * <p> * Third parties can provide their own converters if such need arises by implementing * {@link PropertyConverter} interface and by specifying that converter as converter on a specific * Property annotation of a field or a method instance. * @author <NAME> */ public final class PropertyConverters { private PropertyConverters() { throw new InstantiationError("Must not instantiate this class"); } public static class NetworkInterfaceList implements PropertyConverter { public Object convert(Object obj, Class<?> propertyFieldType, String propertyName, String propertyValue, boolean check_scope, StackType ip_version) throws Exception { return Util.parseInterfaceList(propertyValue); } public String toString(Object value) { List<NetworkInterface> list=(List<NetworkInterface>)value; return Util.print(list); } } public static class InitialHosts implements PropertyConverter { public Object convert(Object obj, Class<?> propertyFieldType, String propertyName, String prop_val, boolean check_scope, StackType ip_version) throws Exception { if(prop_val == null) return null; int port_range=getPortRange((Protocol)obj); return Util.parseCommaDelimitedHosts(prop_val, port_range); } public String toString(Object value) { if(value instanceof Collection) { StringBuilder sb=new StringBuilder(); Collection<IpAddress> list=(Collection<IpAddress>)value; boolean first=true; for(IpAddress addr : list) { if(first) first=false; else sb.append(","); sb.append(addr.getIpAddress().getHostAddress()).append("[").append(addr.getPort()).append("]"); } return sb.toString(); } else return value.getClass().getName(); } private static int getPortRange(Protocol protocol) throws Exception { Field f=Util.getField(protocol.getClass(), "port_range"); return (Integer)Util.getField(f, protocol); } } public static class InitialHosts2 implements PropertyConverter { public Object convert(Object obj, Class<?> propertyFieldType, String propertyName, String prop_val, boolean check_scope, StackType ip_version) throws Exception { // port range is 0 return Util.parseCommaDelimitedHosts2(prop_val, 0); } public String toString(Object value) { if(value instanceof Collection) { StringBuilder sb=new StringBuilder(); Collection<InetSocketAddress> list=(Collection<InetSocketAddress>)value; boolean first=true; for(InetSocketAddress addr : list) { if(first) first=false; else sb.append(","); sb.append(addr.getAddress().getHostAddress()).append("[").append(addr.getPort()).append("]"); } return sb.toString(); } else return value.getClass().getName(); } } public static class BindInterface implements PropertyConverter { public Object convert(Object obj, Class<?> propertyFieldType, String propertyName, String propertyValue, boolean check_scope, StackType ip_version) throws Exception { // get the existing bind address - possibly null InetAddress old_bind_addr=Configurator.getValueFromProtocol((Protocol)obj, "bind_addr"); // apply a bind interface constraint InetAddress new_bind_addr=Util.validateBindAddressFromInterface(old_bind_addr, propertyValue, ip_version); if(new_bind_addr != null) setBindAddress((Protocol)obj, new_bind_addr); // if no bind_interface specified, set it to the empty string to avoid exception from @Property processing return propertyValue != null? propertyValue : ""; } private static void setBindAddress(Protocol protocol, InetAddress bind_addr) throws Exception { Field f=Util.getField(protocol.getClass(), "bind_addr"); Util.setField(f, protocol, bind_addr); } // return a String version of the converted value public String toString(Object value) { return (String)value; } } public static class Default implements PropertyConverter { public Object convert(Object obj, Class<?> propertyFieldType, String propertyName, String propertyValue, boolean check_scope, StackType ip_version) throws Exception { if(propertyValue == null) throw new NullPointerException("Property value cannot be null"); if(Boolean.TYPE.equals(propertyFieldType)) return Boolean.parseBoolean(propertyValue); if(Integer.TYPE.equals(propertyFieldType)) return Util.readBytesInteger(propertyValue); if(Long.TYPE.equals(propertyFieldType)) return Util.readBytesLong(propertyValue); if(Byte.TYPE.equals(propertyFieldType)) return Byte.parseByte(propertyValue); if(Double.TYPE.equals(propertyFieldType)) return Util.readBytesDouble(propertyValue); if(Short.TYPE.equals(propertyFieldType)) return Short.parseShort(propertyValue); if(Float.TYPE.equals(propertyFieldType)) return Float.parseFloat(propertyValue); if(InetAddress.class.equals(propertyFieldType)) { InetAddress retval=null; if(propertyValue.contains(",")) { List<String> addrs=Util.parseCommaDelimitedStrings(propertyValue); for(String addr : addrs) { try { retval=Util.getAddress(addr, ip_version); if(retval != null) break; } catch(Throwable ignored) { } } if(retval == null) throw new IllegalArgumentException(String.format("failed parsing attribute %s with value %s", propertyName, propertyValue)); } else retval=Util.getAddress(propertyValue, ip_version); if(check_scope && retval instanceof Inet6Address && retval.isLinkLocalAddress()) { // check scope Inet6Address addr=(Inet6Address)retval; int scope=addr.getScopeId(); if(scope == 0) { // fix scope Inet6Address ret=getScopedInetAddress(addr); if(ret != null) retval=ret; } } return retval; } return propertyValue; } protected static Inet6Address getScopedInetAddress(Inet6Address addr) { if(addr == null) return null; Enumeration<NetworkInterface> en; List<InetAddress> retval=new ArrayList<>(); try { en=NetworkInterface.getNetworkInterfaces(); while(en.hasMoreElements()) { NetworkInterface intf=en.nextElement(); Enumeration<InetAddress> addrs=intf.getInetAddresses(); while(addrs.hasMoreElements()) { InetAddress address=addrs.nextElement(); if(address.isLinkLocalAddress() && address instanceof Inet6Address && address.equals(addr) && ((Inet6Address)address).getScopeId() != 0) { retval.add(address); } } } if(retval.size() == 1) { return (Inet6Address)retval.get(0); } else return null; } catch(SocketException e) { return null; } } public String toString(Object value) { if(value instanceof InetAddress) return ((InetAddress)value).getHostAddress(); return value != null? value.toString() : null; } } }
leonchen83/JGroups
<|start_filename|>html_test.go<|end_filename|> package parsec import "fmt" import "bytes" import "testing" import "net/http" import "io/ioutil" func TestHTMLValue(t *testing.T) { data, err := ioutil.ReadFile("testdata/simple.html") if err != nil { t.Error(err) } data = bytes.Trim(data, " \t\r\n") ast := NewAST("html", 100) y := makehtmly(ast) s := NewScanner(data).TrackLineno() root, _ := ast.Parsewith(y, s) ref := `<html><body><h1>My First Heading</h1><p>My first paragraph.</p></body></html>` if out := string(root.GetValue()); out != ref { t.Errorf("expected %q", ref) t.Errorf("got %q", out) } // To generate the dot-graph for input html. //graph := ast.Dotstring("simplehtml") //fmt.Println(graph) // To gather all TEXT values. //ch := make(chan Queryable, 100) //ast.Query("TEXT", ch) //for node := range ch { // fmt.Println(node.GetValue()) //} // To gather all terminal values. ch := make(chan Queryable, 100) ast.Query(".term", ch) for node := range ch { fmt.Printf("%s", node.GetValue()) } fmt.Println() } func TestExample(t *testing.T) { ast := NewAST("html", 100) y := makehtmly(ast) resp, err := http.Get("https://example.com/") if err != nil { t.Error(err) } defer resp.Body.Close() data, err := ioutil.ReadAll(resp.Body) if err != nil { t.Error(err) } fmt.Println(string(data)) s := NewScanner(data).TrackLineno() ast.Parsewith(y, s) ch := make(chan Queryable, 100) go ast.Query("attrunquoted,attrsingleq,attrdoubleq", ch) for node := range ch { cs := node.GetChildren() if cs[0].GetValue() != "href" { continue } if len(cs) == 3 { fmt.Println(cs[2].GetValue()) } else { fmt.Println(cs[3].GetValue()) } } fmt.Println() } func makehtmly(ast *AST) Parser { var tag Parser // terminal parsers. tagobrk := Atom("<", "OT") tagcbrk := Atom(">", "CT") tagcend := Atom("/>", "CT") tagcopen := Atom("</", "CT") equal := Atom(`=`, "EQ") single := Atom("'", "SQUOTE") double := Atom(`"`, "DQUOTE") tagname := Token(`[a-zA-Z0-9]+`, "TAGNAME") attrname := Token(`[a-zA-Z0-9_-]+`, "ATTRNAME") attrval1 := Token(`[^\s"'=<>`+"`]+", "ATTRVAL1") attrval2 := Token(`[^']*`, "ATTRVAL2") attrval3 := Token(`[^"]*`, "ATTRVAL3") entity := Token(`&#?[a-bA-Z0-9]+;`, "ENTITY") text := Token(`[^<]+`, "TEXT") doctype := Token(`<!doctype[^>]+>`, "DOCTYPE") // non-terminals attrunquoted := ast.And( "attrunquoted", nil, attrname, equal, attrval1, ) attrsingleq := ast.And( "attrsingleq", nil, attrname, equal, single, attrval2, single, ) attrdoubleq := ast.And( "attrdoubleq", nil, attrname, equal, double, attrval3, double, ) attr := ast.OrdChoice( "attribute", nil, attrsingleq, attrdoubleq, attrunquoted, attrname, ) attrs := ast.Kleene("attributes", nil, attr, nil) tagopen := ast.And("tagopen", nil, tagobrk, tagname, attrs, tagcbrk) tagclose := ast.And("tagclose", nil, tagcopen, tagname, tagcbrk) content := ast.OrdChoice("content", nil, entity, text, &tag) contents := ast.Maybe( "maybecontents", nil, ast.Kleene("contents", nil, content, nil), ) tagempty := ast.And("tagempty", nil, tagobrk, tagname, attrs, tagcend) tagproper := ast.And("tagproper", nil, tagopen, contents, tagclose) tag = ast.OrdChoice("tag", nil, doctype, tagempty, tagproper) return ast.Kleene("html", nil, tag, nil) } func debugfn(name string, s Scanner, node Queryable) Queryable { attrs := node.GetChildren()[2] fmt.Printf("%T %v\n", attrs, attrs) return node } <|start_filename|>tokeniser.go<|end_filename|> // Copyright (c) 2013 Goparsec AUTHORS. All rights reserved. // Use of this source code is governed by LICENSE file. /* This file provides a basic set of token parsers that can be used to parse a single token or used to create higher order parsers using the combinator functions. Unless specified, these parsers can be used with AST combinators and return a Terminal node. */ package parsec import "strings" import "strconv" import "unicode" import "unicode/utf8" import "unicode/utf16" // String parse double quoted string in input text, this parser // returns string type as ParsecNode, hence incompatible with // AST combinators. Skip leading whitespace. func String() Parser { return func(s Scanner) (ParsecNode, Scanner) { s.SkipWS() scanner := s.(*SimpleScanner) if !scanner.Endof() && scanner.buf[scanner.cursor] == '"' { str, readn := scanString(scanner.buf[scanner.cursor:]) if str == nil || len(str) == 0 { return nil, scanner } scanner.cursor += readn return string(str), scanner } return nil, scanner } } // Char return parser function to match a single character // in the input stream. Skip leading whitespace. func Char() Parser { return Token(`'.'`, "CHAR") } // Float return parser function to match a float literal // in the input stream. Skip leading whitespace. func Float() Parser { return Token(`[+-]?([0-9]+\.[0-9]*|\.[0-9]+)`, "FLOAT") } // Hex return parser function to match a hexadecimal // literal in the input stream. Skip leading whitespace. func Hex() Parser { return Token(`0[xX][0-9a-fA-F]+`, "HEX") } // Oct return parser function to match an octal number // literal in the input stream. Skip leading whitespace. func Oct() Parser { return Token(`0[0-7]+`, "OCT") } // Int return parser function to match an integer literal // in the input stream. Skip leading whitespace. func Int() Parser { return Token(`-?[0-9]+`, "INT") } // Ident return parser function to match an identifier token // in the input stream, an identifier is matched with the // following pattern: `^[A-Za-z][0-9a-zA-Z_]*`. // Skip leading whitespace. func Ident() Parser { return Token(`[A-Za-z][0-9a-zA-Z_]*`, "IDENT") } // Token takes a regular-expression pattern and return a parser that // will match input stream with supplied pattern. Skip leading whitespace. // `name` will be used as the Terminal's name. func Token(pattern string, name string) Parser { if pattern[0] != '^' { pattern = "^" + pattern } return func(s Scanner) (ParsecNode, Scanner) { news := s.Clone() news.SkipWS() cursor := news.GetCursor() if tok, _ := news.Match(pattern); tok != nil { return NewTerminal(name, string(tok), cursor), news } return nil, s } } // TokenExact same as Token() but pattern will be matched // without skipping leading whitespace. `name` will be used as // the terminal's name. func TokenExact(pattern string, name string) Parser { return func(s Scanner) (ParsecNode, Scanner) { news := s.Clone() cursor := news.GetCursor() if tok, _ := news.Match("^" + pattern); tok != nil { return NewTerminal(name, string(tok), cursor), news } return nil, s } } // Atom is similar to Token, takes a string to match with input // byte-by-byte. Internally uses the MatchString() API from Scanner. // Skip leading whitespace. For example: // scanner := NewScanner([]byte("cosmos")) // Atom("cos", "ATOM")(scanner) // will match func Atom(match string, name string) Parser { return func(s Scanner) (ParsecNode, Scanner) { news := s.Clone() news.SkipWS() cursor := news.GetCursor() if ok, _ := news.MatchString(match); ok { return NewTerminal(name, match, cursor), news } return nil, s } } // AtomExact is similar to Atom(), but string will be matched without // skipping leading whitespace. func AtomExact(match string, name string) Parser { return func(s Scanner) (ParsecNode, Scanner) { news := s.Clone() cursor := news.GetCursor() if ok, _ := news.MatchString(match); ok { return NewTerminal(name, match, cursor), news } return nil, s } } // OrdTokens to parse a single token based on one of the // specified `patterns`. Skip leading whitespaces. func OrdTokens(patterns []string, names []string) Parser { var group string groups := make([]string, 0, len(patterns)) for i, pattern := range patterns { if names[i] == "" { group = "^(" + pattern + ")" } else { group = "^(?P<" + names[i] + ">" + pattern + ")" } groups = append(groups, group) } ordPattern := strings.Join(groups, "|") return func(s Scanner) (ParsecNode, Scanner) { news := s.Clone() news.SkipWS() cursor := news.GetCursor() if captures, _ := news.SubmatchAll(ordPattern); captures != nil { for name, tok := range captures { return NewTerminal(name, string(tok), cursor), news } } return nil, s } } // End is a parser function to detect end of scanner output, return // boolean as ParseNode, hence incompatible with AST{}. Instead, use // AST:End method. func End() Parser { return func(s Scanner) (ParsecNode, Scanner) { if s.Endof() { return true, s } return nil, s } } // NoEnd is a parser function to detect not-an-end of // scanner output, return boolean as ParsecNode, hence // incompatible with AST{}. func NoEnd() Parser { return func(s Scanner) (ParsecNode, Scanner) { if !s.Endof() { return true, s } return nil, s } } var escapeCode = [256]byte{ // TODO: size can be optimized '"': '"', '\\': '\\', '/': '/', '\'': '\'', 'b': '\b', 'f': '\f', 'n': '\n', 'r': '\r', 't': '\t', } func scanString(txt []byte) (tok []byte, readn int) { if len(txt) < 2 { return nil, 0 } e := 1 for txt[e] != '"' { c := txt[e] if c == '\\' || c == '"' || c < ' ' { break } if c < utf8.RuneSelf { e++ continue } r, size := utf8.DecodeRune(txt[e:]) if r == utf8.RuneError && size == 1 { return nil, 0 } e += size } if txt[e] == '"' { // done we have nothing to unquote return txt[:e+1], e + 1 } out := make([]byte, len(txt)+2*utf8.UTFMax) oute := copy(out, txt[:e]) // copy so far loop: for e < len(txt) { switch c := txt[e]; { case c == '"': out[oute] = c e++ break loop case c == '\\': if txt[e+1] == 'u' { r := getu4(txt[e:]) if r < 0 { // invalid return nil, 0 } e += 6 if utf16.IsSurrogate(r) { nextr := getu4(txt[e:]) dec := utf16.DecodeRune(r, nextr) if dec != unicode.ReplacementChar { // A valid pair consume oute += utf8.EncodeRune(out[oute:], dec) e += 6 break loop } // Invalid surrogate; fall back to replacement rune. r = unicode.ReplacementChar } oute += utf8.EncodeRune(out[oute:], r) } else { // escaped with " \ / ' b f n r t out[oute] = escapeCode[txt[e+1]] e += 2 oute++ } case c < ' ': // control character is invalid return nil, 0 case c < utf8.RuneSelf: // ASCII out[oute] = c oute++ e++ default: // coerce to well-formed UTF-8 r, size := utf8.DecodeRune(txt[e:]) e += size oute += utf8.EncodeRune(out[oute:], r) } } if out[oute] == '"' { return out[:oute+1], e } return nil, 0 } // getu4 decodes \uXXXX from the beginning of s, returning the hex value, // or it returns -1. func getu4(s []byte) rune { if len(s) < 6 || s[0] != '\\' || s[1] != 'u' { return -1 } r, err := strconv.ParseUint(string(s[2:6]), 16, 64) if err != nil { return -1 } return rune(r) } <|start_filename|>selector.go<|end_filename|> package parsec import "fmt" import "strings" import "regexp" import "strconv" // attributes on selector non-terminal: // `op`, `name`, `attrkey`, `attrop`, `attrval`, `colonspec`, `colonarg` func parseselector(ast *AST) Parser { star := AtomExact(`*`, "STAR") nodename := TokenExact(`(?i)[a-z][a-z0-9_-]*`, "NAME") shorthand := TokenExact(`(?i)[\.#][a-z][a-z0-9_-]*`, "SHORTH") selop := TokenExact(`[\s>\+~]+`, "OP") comma := TokenExact(`,[ ]*`, "COMMA") selector := ast.And("selector", makeselector1, ast.Maybe("maybestar", nil, star), ast.Maybe("maybenodename", nil, nodename), ast.Maybe("maybeshorthand", nil, shorthand), ast.Maybe("maybeattribute", nil, yattr(ast)), ast.Maybe("maybecolonsel", nil, ycolon(ast)), ) selector2 := ast.And("selector2", makeselector2, selop, selector) selectors2 := ast.Kleene("selectors2", nil, selector2) yone := ast.And("selectors", func(_ string, s Scanner, q Queryable) Queryable { children := q.GetChildren() qs := []Queryable{children[0]} qs = append(qs, children[1].GetChildren()...) nt := NewNonTerminal("selectors") nt.Children = qs return nt }, selector, selectors2, ) yor := ast.Kleene("orselectors", nil, yone, comma) return yor } func yattr(ast *AST) Parser { opensqr := AtomExact(`[`, "OPENSQR") closesqr := AtomExact(`]`, "CLOSESQR") attrname := TokenExact(`(?i)[a-z][a-z0-9_-]*`, "ATTRNAME") separator := TokenExact(`=|~=|\^=|\$=|\*=`, "ATTRSEP") attrval1 := TokenExact(`"[^"]*"`, "VAL1") attrval2 := TokenExact(`'[^']*'`, "VAL2") attrval3 := TokenExact(`[^\s\]]+`, "VAL3") attrchoice := ast.OrdChoice("attrchoice", func(_ string, s Scanner, q Queryable) Queryable { var value string switch t := q.(*Terminal); t.Name { case "VAL1": value = t.Value[1 : len(t.Value)-1] case "VAL2": value = t.Value[1 : len(t.Value)-1] case "VAL3": value = t.Value } return NewTerminal("attrchoice", value, s.GetCursor()) }, attrval1, attrval2, attrval3, ) attrval := ast.And("attrval", nil, separator, attrchoice) attribute := ast.And("attribute", nil, opensqr, attrname, ast.Maybe("attrval", nil, attrval), closesqr, ) return attribute } func ycolon(ast *AST) Parser { openparan := AtomExact(`(`, "OPENPARAN") closeparan := AtomExact(`)`, "CLOSEPARAN") colon := AtomExact(`:`, "COLON") arg := ast.And("arg", func(_ string, s Scanner, n Queryable) Queryable { t := n.GetChildren()[1].(*Terminal) t.Value = "(" + t.Value + ")" return t }, openparan, Int(), closeparan, ) colonEmpty := AtomExact(`empty`, "empty") colonFirstChild := AtomExact(`first-child`, "first-child") colonFirstType := AtomExact(`first-of-type`, "first-of-type") colonLastChild := AtomExact(`last-child`, "last-child") colonLastType := AtomExact(`last-of-type`, "last-of-type") colonNthChild := ast.And(`nth-child`, func(_ string, s Scanner, n Queryable) Queryable { n.SetAttribute("arg", n.GetChildren()[1].GetValue()) return n }, AtomExact(`nth-child`, "CNC"), arg, ) colonNthType := ast.And(`nth-of-type`, func(_ string, s Scanner, n Queryable) Queryable { n.SetAttribute("arg", n.GetChildren()[1].GetValue()) return n }, AtomExact(`nth-of-type`, "CNOT"), arg, ) colonNthLastChild := ast.And(`nth-last-child`, func(_ string, s Scanner, n Queryable) Queryable { n.SetAttribute("arg", n.GetChildren()[1].GetValue()) return n }, AtomExact(`nth-last-child`, "CNLC"), arg, ) colonNthLastType := ast.And(`nth-last-of-type`, func(_ string, s Scanner, n Queryable) Queryable { n.SetAttribute("arg", n.GetChildren()[1].GetValue()) return n }, AtomExact(`nth-last-of-type`, "CNLOT"), arg, ) colonOnlyType := AtomExact(`only-of-type`, "only-of-type") colonOnlyChild := AtomExact(`only-child`, "only-child") colonname := ast.OrdChoice("colonname", nil, colonEmpty, colonFirstChild, colonFirstType, colonLastChild, colonLastType, colonNthChild, colonNthType, colonNthLastChild, colonNthLastType, colonOnlyType, colonOnlyChild, ) return ast.And("selectcolon", nil, colon, colonname) } func makeselector2(name string, s Scanner, nt Queryable) Queryable { cs := nt.GetChildren() cs[1].SetAttribute("op", strings.Trim(cs[0].GetValue(), " ")) return cs[1] } func makeselector1(name string, s Scanner, nt Queryable) Queryable { cs := nt.GetChildren() nt, ok := makeselector1Star(nt, cs[0]) // maybestar if ok == false { nt, _ = makeselector1Name(nt, cs[1]) // maybenodename } nt, _ = makeselector1Shand(nt, cs[2]) // maybeshorthand nt, _ = makeselector1Attr(nt, cs[3]) // maybeattribute nt, _ = makeselector1Colon(nt, cs[4]) // maybecolonsel return nt } func makeselector1Star(nt, starq Queryable) (Queryable, bool) { if _, ok := starq.(MaybeNone); ok == true { return nt, false } nt.SetAttribute("name", starq.GetValue()) return nt, true } func makeselector1Name(nt, nameq Queryable) (Queryable, bool) { if _, ok := nameq.(MaybeNone); ok == true { return nt, false } nt.SetAttribute("name", nameq.GetValue()) return nt, true } func makeselector1Shand(nt, shq Queryable) (Queryable, bool) { if _, ok := shq.(MaybeNone); ok == true { return nt, false } value := shq.GetValue() switch value[0] { case '.': nt.SetAttribute("attrkey", "class") case '#': nt.SetAttribute("attrkey", "id") } nt.SetAttribute("attrop", "=").SetAttribute("attrval", value[1:]) return nt, true } func makeselector1Attr(nt, attrq Queryable) (Queryable, bool) { if _, ok := attrq.(MaybeNone); ok == true { return nt, false } cs := attrq.GetChildren() nt.SetAttribute("attrkey", cs[1].GetValue()) if valcs := cs[2].GetChildren(); len(valcs) > 0 { nt.SetAttribute("attrop", valcs[0].GetValue()) nt.SetAttribute("attrval", valcs[1].GetValue()) } return nt, true } func makeselector1Colon(nt, colonq Queryable) (Queryable, bool) { if _, ok := colonq.(MaybeNone); ok == true { return nt, false } colonq = colonq.GetChildren()[1] nt.SetAttribute("colonspec", colonq.GetName()) attrvals := colonq.GetAttribute("arg") if len(attrvals) > 0 { nt.SetAttribute("colonarg", attrvals[0]) } return nt, true } //---- walk the tree func astwalk( parent Queryable, idx int, node Queryable, qs []Queryable, ch chan Queryable) { var descendok bool q, remqs := qs[0], qs[1:] matchok := applyselector(parent, idx, node, q) if qcombinator(q) == "child" && matchok == false { return // cannot descend } else if matchok == false { remqs = qs } else if len(remqs) == 0 { // and matchok == true remqs = qs ch <- node } else { // matchok `and` remqs > 0 idx, remqs, descendok = applysiblings(parent, idx, node, remqs, ch) if descendok == false { return } } if parent != nil { node = parent.GetChildren()[idx] } for idx, child := range node.GetChildren() { astwalk(node, idx, child, remqs, ch) } } func applysiblings( parent Queryable, idx int, node Queryable, qs []Queryable, ch chan Queryable) (int, []Queryable, bool) { if parent == nil { // node must be root return idx, qs, true } q, typ, children := qs[0], qcombinator(qs[0]), parent.GetChildren() nchild, dosibling := len(children), (typ == "next") || (typ == "after") if dosibling == false { return idx, qs, true } else if idx >= (nchild - 1) { // there should be atleast one more sibling return idx, qs, false } if typ == "next" { matchok := applyselector(parent, idx+1, children[idx+1], q) remqs, node := qs[1:], children[idx+1] if matchok && len(remqs) == 0 { ch <- children[idx+1] return idx, qs, false } else if matchok { return applysiblings(parent, idx+1, node, remqs, ch) } return idx, qs, false } // typ == "after" for idx = idx + 1; idx < nchild; idx++ { matchok := applyselector(parent, idx, children[idx], q) remqs, node := qs[1:], children[idx] if matchok && len(remqs) == 0 { ch <- children[idx] return idx, qs, false } else if matchok { return applysiblings(parent, idx, node, remqs, ch) } } return idx, qs, false } func applyselector(parent Queryable, idx int, node, q Queryable) bool { ns := q.GetAttribute("name") if len(ns) > 0 { if filterbyname(node, ns[0]) == false { return false } } key, op, match := getselectorattr(q) if filterbyattr(node, key, op, match) == false { return false } colonspec, colonarg := getcolon(q) if filterbycolon(parent, idx, node, colonspec, colonarg) == false { return false } return true } func qcombinator(sel Queryable) string { ops := sel.GetAttribute("op") if len(ops) == 0 { return "" } switch op := ops[0]; op { case "+": return "next" case "~": return "after" case ">": return "child" } return "descend" } func getselectorattr(q Queryable) (key, op, match string) { if keys := q.GetAttribute("attrkey"); len(keys) > 0 { key = keys[0] } if ops := q.GetAttribute("attrop"); len(ops) > 0 { op = ops[0] } if matches := q.GetAttribute("attrval"); len(matches) > 0 { match = matches[0] } return } func getcolon(q Queryable) (colonspec, colonarg string) { if colonspecs := q.GetAttribute("colonspec"); len(colonspecs) > 0 { colonspec = colonspecs[0] } if colonargs := q.GetAttribute("colonarg"); len(colonargs) > 0 { colonarg = colonargs[0] } return } func filterbyname(node Queryable, name string) bool { if name == "*" { return true } else if strings.ToLower(node.GetName()) != strings.ToLower(name) { return false } return true } func filterbyattr(node Queryable, key, op, match string) bool { doop := func(op string, val, match string) bool { switch op { case "=": if val == match { return true } case "~=": return strings.Contains(val, match) case "^=": return strings.HasPrefix(val, match) case "$=": return strings.HasSuffix(val, match) case "*=": ok, err := regexp.Match(match, []byte(val)) if err != nil { fmsg := "error matching %v,%v: %v" panic(fmt.Errorf(fmsg, match, val, err)) } return ok } return false } if key == "" { return true } else if nodeval := node.GetValue(); key == "value" && op == "" { return nodeval != "" } else if key == "value" { return doop(op, nodeval, match) } vals := node.GetAttribute(key) if vals == nil { return false } else if vals != nil && op == "" { return true } for _, val := range vals { if doop(op, val, match) { return true } } return false } func filterbycolon( parent Queryable, idx int, node Queryable, colonspec, colonarg string) bool { if colonspec == "" { return true } carg, _ := strconv.Atoi(strings.Trim(colonarg, "()")) switch colonspec { case "empty": if len(node.GetChildren()) == 0 { return true } case "first-child": if idx == 0 { return true } case "first-of-type": if parent == nil { return true } name, children := node.GetName(), parent.GetChildren() for i := 0; i < len(children) && i < idx; i++ { if name == children[i].GetName() { return false } } return true case "last-child": if parent == nil || idx == len(parent.GetChildren())-1 { return true } case "last-of-type": if parent == nil { return true } name, children := node.GetName(), parent.GetChildren() for i := idx + 1; i >= 0 && i < len(children); i++ { if name == children[i].GetName() { return false } } return true case "nth-child": if parent == nil || carg == idx { return true } case "nth-of-type": if parent == nil { return true } n, name, children := -1, node.GetName(), parent.GetChildren() for i := 0; i < len(children) && i <= idx; i++ { if name == children[i].GetName() { n++ } } if n == carg { return true } case "nth-last-child": if parent == nil || len(parent.GetChildren())-1 == idx { return true } case "nth-last-of-type": if parent == nil { return true } n, name, children := -1, node.GetName(), parent.GetChildren() for i := len(children) - 1; i >= 0 && i >= idx; i-- { if name == children[i].GetName() { n++ } } if n == carg { return true } case "only-of-type": if parent == nil { return true } n, name := 0, node.GetName() for _, child := range parent.GetChildren() { if child.GetName() == name { n++ } } if n == 1 { return true } case "only-child": if parent == nil || len(parent.GetChildren()) == 1 { return true } } return false } <|start_filename|>Makefile<|end_filename|> SUBDIRS := json expr build: go build ./... @for dir in $(SUBDIRS); do \ echo $$dir "..."; \ $(MAKE) -C $$dir build; \ done test: go test -v -race -timeout 4000s -test.run=. -test.bench=. -test.benchmem=true ./... @for dir in $(SUBDIRS); do \ echo $$dir "..."; \ $(MAKE) -C $$dir test; \ done coverage: go test -coverprofile=coverage.out go tool cover -html=coverage.out rm -rf coverage.out vet: go vet ./... lint: golint ./... .PHONY: build $(SUBDIRS) <|start_filename|>nonterminal.go<|end_filename|> package parsec // NonTerminal will be used by AST methods to construct intermediate nodes. // Note that user supplied ASTNodify callback can construct a different // type of intermediate node that confirms to Queryable interface. type NonTerminal struct { Name string // contains terminal's token type Children []Queryable // list of children to this node. Attributes map[string][]string } // NewNonTerminal create and return a new NonTerminal instance. func NewNonTerminal(name string) *NonTerminal { nt := &NonTerminal{ Name: name, Children: make([]Queryable, 0), Attributes: make(map[string][]string), } nt.SetAttribute("class", "nonterm") return nt } // GetName implement Queryable interface. func (nt *NonTerminal) GetName() string { return nt.Name } // IsTerminal implement Queryable interface. func (nt *NonTerminal) IsTerminal() bool { return false } // GetValue implement Queryable interface. func (nt *NonTerminal) GetValue() string { value := "" for _, c := range nt.Children { value += c.GetValue() } return value } // GetChildren implement Queryable interface. func (nt *NonTerminal) GetChildren() []Queryable { return nt.Children } // GetPosition implement Queryable interface. func (nt *NonTerminal) GetPosition() int { if nodes := nt.GetChildren(); len(nodes) > 0 { return nodes[0].GetPosition() } return 0 } // SetAttribute implement Queryable interface. func (nt *NonTerminal) SetAttribute(attrname, value string) Queryable { if nt.Attributes == nil { nt.Attributes = make(map[string][]string) } values, ok := nt.Attributes[attrname] if ok == false { values = []string{} } values = append(values, value) nt.Attributes[attrname] = values return nt } // GetAttribute implement Queryable interface. func (nt *NonTerminal) GetAttribute(attrname string) []string { if nt.Attributes == nil { return nil } else if values, ok := nt.Attributes[attrname]; ok { return values } return nil } // GetAttributes implement Queryable interface. func (nt *NonTerminal) GetAttributes() map[string][]string { return nt.Attributes } <|start_filename|>example_test.go<|end_filename|> package parsec import "fmt" import "strconv" func ExampleAST_And() { // parse a configuration line from ini file. text := []byte(`loglevel = info`) ast := NewAST("example", 100) y := ast.And("configline", nil, Ident(), Atom("=", "EQUAL"), Ident()) root, _ := ast.Parsewith(y, NewScanner(text)) nodes := root.GetChildren() fmt.Println(nodes[0].GetName(), nodes[0].GetValue()) fmt.Println(nodes[1].GetName(), nodes[1].GetValue()) fmt.Println(nodes[2].GetName(), nodes[2].GetValue()) // Output: // IDENT loglevel // EQUAL = // IDENT info } func ExampleAST_OrdChoice() { // parse a boolean value text := []byte(`true`) ast := NewAST("example", 100) y := ast.OrdChoice("bool", nil, Atom("true", "TRUE"), Atom("false", "FALSE")) root, _ := ast.Parsewith(y, NewScanner(text)) fmt.Println(root.GetName(), root.GetValue()) // Output: // TRUE true } func ExampleAST_Many() { // parse comma separated values text := []byte(`10,30,50 wont parse this`) ast := NewAST("example", 100) y := ast.Many("many", nil, Int(), Atom(",", "COMMA")) root, _ := ast.Parsewith(y, NewScanner(text)) nodes := root.GetChildren() fmt.Println(nodes[0].GetName(), nodes[0].GetValue()) fmt.Println(nodes[1].GetName(), nodes[1].GetValue()) fmt.Println(nodes[2].GetName(), nodes[2].GetValue()) // Output: // INT 10 // INT 30 // INT 50 } func ExampleAST_ManyUntil() { // make sure to parse the entire text text := []byte("10,30,50") ast := NewAST("example", 100) y := ast.ManyUntil("values", nil, Int(), Atom(",", "COMMA"), ast.End("eof")) root, _ := ast.Parsewith(y, NewScanner(text)) nodes := root.GetChildren() fmt.Println(nodes[0].GetName(), nodes[0].GetValue()) fmt.Println(nodes[1].GetName(), nodes[1].GetValue()) fmt.Println(nodes[2].GetName(), nodes[2].GetValue()) // Output: // INT 10 // INT 30 // INT 50 } func ExampleAST_Maybe() { // parse an optional token ast := NewAST("example", 100) equal := Atom("=", "EQUAL") maybeand := ast.Maybe("maybeand", nil, Atom("&", "AND")) y := ast.And("assignment", nil, Ident(), equal, maybeand, Ident()) text := []byte("a = &b") root, _ := ast.Parsewith(y, NewScanner(text)) nodes := root.GetChildren() fmt.Println(nodes[0].GetName(), nodes[0].GetValue()) fmt.Println(nodes[1].GetName(), nodes[1].GetValue()) fmt.Println(nodes[2].GetName(), nodes[2].GetValue()) fmt.Println(nodes[3].GetName(), nodes[3].GetValue()) text = []byte("a = b") ast = ast.Reset() root, _ = ast.Parsewith(y, NewScanner(text)) nodes = root.GetChildren() fmt.Println(nodes[0].GetName(), nodes[0].GetValue()) fmt.Println(nodes[1].GetName(), nodes[1].GetValue()) fmt.Println(nodes[2].GetName()) fmt.Println(nodes[3].GetName(), nodes[3].GetValue()) // Output: // IDENT a // EQUAL = // AND & // IDENT b // IDENT a // EQUAL = // missing // IDENT b } func ExampleASTNodify() { text := []byte("10 * 20") ast := NewAST("example", 100) y := ast.And( "multiply", func(name string, s Scanner, node Queryable) Queryable { cs := node.GetChildren() x, _ := strconv.Atoi(cs[0].(*Terminal).GetValue()) y, _ := strconv.Atoi(cs[2].(*Terminal).GetValue()) return &Terminal{Value: fmt.Sprintf("%v", x*y)} }, Int(), Token(`\*`, "MULT"), Int(), ) node, _ := ast.Parsewith(y, NewScanner(text)) fmt.Println(node.GetValue()) // Output: // 200 } func ExampleAnd() { // parse a configuration line from ini file. text := []byte(`loglevel = info`) y := And(nil, Ident(), Atom("=", "EQUAL"), Ident()) root, _ := y(NewScanner(text)) nodes := root.([]ParsecNode) t := nodes[0].(*Terminal) fmt.Println(t.GetName(), t.GetValue()) t = nodes[1].(*Terminal) fmt.Println(t.GetName(), t.GetValue()) t = nodes[2].(*Terminal) fmt.Println(t.GetName(), t.GetValue()) // Output: // IDENT loglevel // EQUAL = // IDENT info } func ExampleOrdChoice() { // parse a boolean value text := []byte(`true`) y := OrdChoice(nil, Atom("true", "TRUE"), Atom("false", "FALSE")) root, _ := y(NewScanner(text)) nodes := root.([]ParsecNode) t := nodes[0].(*Terminal) fmt.Println(t.GetName(), t.GetValue()) // Output: // TRUE true } func ExampleMany() { // parse comma separated values text := []byte(`10,30,50 wont parse this`) y := Many(nil, Int(), Atom(",", "COMMA")) root, _ := y(NewScanner(text)) nodes := root.([]ParsecNode) t := nodes[0].(*Terminal) fmt.Println(t.GetName(), t.GetValue()) t = nodes[1].(*Terminal) fmt.Println(t.GetName(), t.GetValue()) t = nodes[2].(*Terminal) fmt.Println(t.GetName(), t.GetValue()) // Output: // INT 10 // INT 30 // INT 50 } func ExampleManyUntil() { // make sure to parse the entire text text := []byte("10,20,50") y := ManyUntil(nil, Int(), Atom(",", "COMMA"), End()) root, _ := y(NewScanner(text)) nodes := root.([]ParsecNode) t := nodes[0].(*Terminal) fmt.Println(t.GetName(), t.GetValue()) t = nodes[1].(*Terminal) fmt.Println(t.GetName(), t.GetValue()) t = nodes[2].(*Terminal) fmt.Println(t.GetName(), t.GetValue()) // Output: // INT 10 // INT 20 // INT 50 } func ExampleMaybe() { // parse an optional token equal := Atom("=", "EQUAL") maybeand := Maybe(nil, Atom("&", "AND")) y := And(nil, Ident(), equal, maybeand, Ident()) text := []byte("a = &b") root, _ := y(NewScanner(text)) nodes := root.([]ParsecNode) t := nodes[0].(*Terminal) fmt.Println(t.GetName(), t.GetValue()) t = nodes[1].(*Terminal) fmt.Println(t.GetName(), t.GetValue()) t = nodes[2].([]ParsecNode)[0].(*Terminal) fmt.Println(t.GetName(), t.GetValue()) t = nodes[3].(*Terminal) fmt.Println(t.GetName(), t.GetValue()) text = []byte("a = b") root, _ = y(NewScanner(text)) nodes = root.([]ParsecNode) t = nodes[0].(*Terminal) fmt.Println(t.GetName(), t.GetValue()) t = nodes[1].(*Terminal) fmt.Println(t.GetName(), t.GetValue()) fmt.Println(nodes[2]) t = nodes[3].(*Terminal) fmt.Println(t.GetName(), t.GetValue()) // Output: // IDENT a // EQUAL = // AND & // IDENT b // IDENT a // EQUAL = // missing // IDENT b } func ExampleNodify() { text := []byte("10 * 20") s := NewScanner(text) y := And( func(nodes []ParsecNode) ParsecNode { x, _ := strconv.Atoi(nodes[0].(*Terminal).GetValue()) y, _ := strconv.Atoi(nodes[2].(*Terminal).GetValue()) return x * y // this is retuned as node further down. }, Int(), Token(`\*`, "MULT"), Int(), ) node, _ := y(s) fmt.Println(node) // Output: // 200 } <|start_filename|>terminal.go<|end_filename|> package parsec // Terminal type can be used to construct a terminal ParsecNode. // It implements Queryable interface, hence can be used with // AST object. type Terminal struct { Name string // contains terminal's token type Value string // value of the terminal Position int // Offset into the text stream where token was identified Attributes map[string][]string } // NewTerminal create a new Terminal instance. Supply the name of the // terminal, its matching text from i/p stream as value. And its position // within the i/p stream. func NewTerminal(name, value string, position int) *Terminal { t := &Terminal{ Name: name, Value: value, Position: position, Attributes: make(map[string][]string), } t.SetAttribute("class", "term") return t } // GetName implement Queryable interface. func (t *Terminal) GetName() string { return t.Name } // IsTerminal implement Queryable interface. func (t *Terminal) IsTerminal() bool { return true } // GetValue implement Queryable interface. func (t *Terminal) GetValue() string { return t.Value } // GetChildren implement Queryable interface. func (t *Terminal) GetChildren() []Queryable { return nil } // GetPosition implement Queryable interface. func (t *Terminal) GetPosition() int { return t.Position } // SetAttribute implement Queryable interface. func (t *Terminal) SetAttribute(attrname, value string) Queryable { if t.Attributes == nil { t.Attributes = make(map[string][]string) } values, ok := t.Attributes[attrname] if ok == false { values = []string{} } values = append(values, value) t.Attributes[attrname] = values return t } // GetAttribute implement Queryable interface. func (t *Terminal) GetAttribute(attrname string) []string { if t.Attributes == nil { return nil } else if values, ok := t.Attributes[attrname]; ok { return values } return nil } // GetAttributes implement Queryable interface. func (t *Terminal) GetAttributes() map[string][]string { return t.Attributes } // MaybeNone is a placeholder type, similar to Terminal type, used by // Maybe combinator if parser does not match the input text. type MaybeNone string //---- implement Queryable interface // GetName implement Queryable interface. func (mn MaybeNone) GetName() string { return string(mn) } // IsTerminal implement Queryable interface. func (mn MaybeNone) IsTerminal() bool { return true } // GetValue implement Queryable interface. func (mn MaybeNone) GetValue() string { return "" } // GetChildren implement Queryable interface. func (mn MaybeNone) GetChildren() []Queryable { return nil } // GetPosition implement Queryable interface. func (mn MaybeNone) GetPosition() int { return -1 } // SetAttribute implement Queryable interface. func (mn MaybeNone) SetAttribute(attrname, value string) Queryable { return mn } // GetAttribute implement Queryable interface. func (mn MaybeNone) GetAttribute(attrname string) []string { return nil } // GetAttributes implement Queryable interface. func (mn MaybeNone) GetAttributes() map[string][]string { return nil } <|start_filename|>nonterminal_test.go<|end_filename|> package parsec import "reflect" import "testing" func TestNonTerminal(t *testing.T) { nt := &NonTerminal{Name: "NONTERM", Children: make([]Queryable, 0)} if nt.GetName() != "NONTERM" { t.Errorf("expected %q, got %q", "NONTERM", nt.GetName()) } else if nt.IsTerminal() == true { t.Errorf("expected false") } else if nt.GetValue() != "" { t.Errorf("expected %q, got %q", "", nt.GetValue()) } else if cs := nt.GetChildren(); len(cs) != 0 { t.Errorf("expected len %v, got %v", 0, len(cs)) } else if nt.GetPosition() != 0 { t.Errorf("expected %v, got %v", 0, nt.GetPosition()) } mn := MaybeNone("missing") nt.Children = append(nt.Children, mn) if cs := nt.GetChildren(); cs[0] != mn { t.Errorf("expected %v, got %v", mn, cs[0]) } else if nt.GetPosition() != -1 { t.Errorf("expected %v, got %v", -1, nt.GetPosition()) } // check attribute methods. nt.SetAttribute("name", "one").SetAttribute("name", "two") nt.SetAttribute("key", "one") ref1 := []string{"one", "two"} ref2 := map[string][]string{ "name": {"one", "two"}, "key": {"one"}, } if x := nt.GetAttribute("name"); reflect.DeepEqual(x, ref1) == false { t.Errorf("expected %v, got %v", ref1, x) } else if x := nt.GetAttributes(); reflect.DeepEqual(x, ref2) == false { t.Errorf("expected %v, got %v", ref2, x) } } <|start_filename|>json/json_test.go<|end_filename|> // Copyright (c) 2013 Goparsec AUTHORS. All rights reserved. // Use of this source code is governed by LICENSE file. package json import "encoding/json" import "io/ioutil" import "fmt" import "reflect" import "testing" import "github.com/prataprc/goparsec" var _ = fmt.Sprintf("dummy print") var jsonText = []byte(`{ "inelegant":27.53096820876087, "horridness":true, "iridodesis":[79.1253026404128,null,"hello world", false, 10], "arrogantness":null, "unagrarian":false }`) var jsonVal = map[string]interface{}{ "inelegant": 27.53096820876087, "horridness": True("true"), "iridodesis": []parsec.ParsecNode{ 79.1253026404128, Null("null"), "hello world", False("false"), 10}, "arrogantness": Null("null"), "unagrarian": False("false"), } func TestJson(t *testing.T) { var largeVal []interface{} var mediumVal []interface{} var smallMap map[string]interface{} largeText, err := ioutil.ReadFile("./../testdata/large.json") if err != nil { t.Fatal(err) } json.Unmarshal(largeText, &largeVal) mediumText, err := ioutil.ReadFile("./../testdata/medium.json") if err != nil { t.Fatal(err) } json.Unmarshal(mediumText, &mediumVal) smallText := jsonText json.Unmarshal(smallText, &smallMap) var refs = [][2]interface{}{ {[]byte(`-10000`), Num("-10000")}, {[]byte(`-10.11231`), Num("-10.11231")}, {[]byte(`"hello world"`), String("hello world")}, {[]byte(`true`), True("true")}, {[]byte(`false`), False("false")}, {[]byte(`null`), Null("null")}, {[]byte(`[79.1253026404128,null,"hello world", false, 10]`), []parsec.ParsecNode{ Num("79.1253026404128"), Null("null"), String("hello world"), False("false"), Num("10")}, }, } for _, x := range refs { s := NewJSONScanner(x[0].([]byte)) if v, _ := Y(s); !reflect.DeepEqual(v, x[1]) { t.Fatalf("Mismatch `%v`: %v vs %v", string(x[0].([]byte)), x[1], v) } } s := NewJSONScanner(smallText) if v, _ := Y(s); !reflect.DeepEqual(nativeValue(v), smallMap) { t.Fatalf("Mismatch `%v`: %v vs %v", string(smallText), smallMap, v) } s = NewJSONScanner(mediumText) if v, _ := Y(s); !reflect.DeepEqual(nativeValue(v), mediumVal) { t.Fatalf("Mismatch `%v`: %v vs %v", string(mediumText), mediumVal, v) } s = NewJSONScanner(largeText) if v, _ := Y(s); !reflect.DeepEqual(nativeValue(v), largeVal) { t.Fatalf("Mismatch `%v`: %v vs %v", string(largeText), largeVal, v) } } func BenchmarkJSONInt(b *testing.B) { text := []byte(`10000`) for i := 0; i < b.N; i++ { Y(NewJSONScanner(text)) } b.SetBytes(int64(len(text))) } func BenchmarkJSONFloat(b *testing.B) { text := []byte(`-10.11231`) for i := 0; i < b.N; i++ { Y(NewJSONScanner(text)) } b.SetBytes(int64(len(text))) } func BenchmarkJSONString(b *testing.B) { text := []byte(`"hello world"`) for i := 0; i < b.N; i++ { Y(NewJSONScanner(text)) } b.SetBytes(int64(len(text))) } func BenchmarkJSONBool(b *testing.B) { text := []byte(`true`) for i := 0; i < b.N; i++ { Y(NewJSONScanner(text)) } b.SetBytes(int64(len(text))) } func BenchmarkJSONNull(b *testing.B) { text := []byte(`null`) for i := 0; i < b.N; i++ { Y(NewJSONScanner(text)) } b.SetBytes(int64(len(text))) } func BenchmarkJSONArray(b *testing.B) { text := []byte(`[79.1253026404128,null,"hello world", false, 10]`) for i := 0; i < b.N; i++ { Y(NewJSONScanner(text)) } b.SetBytes(int64(len(text))) } func BenchmarkJSONMap(b *testing.B) { for i := 0; i < b.N; i++ { Y(NewJSONScanner(jsonText)) } b.SetBytes(int64(len(jsonText))) } func BenchmarkJSONMedium(b *testing.B) { text, _ := ioutil.ReadFile("./../testdata/medium.json") for i := 0; i < b.N; i++ { Y(NewJSONScanner(text)) } b.SetBytes(int64(len(text))) } func BenchmarkJSONLarge(b *testing.B) { text, _ := ioutil.ReadFile("./../testdata/large.json") for i := 0; i < b.N; i++ { Y(NewJSONScanner(text)) } b.SetBytes(int64(len(text))) } func BenchmarkEncJSONInt(b *testing.B) { var val interface{} text := []byte(`10000`) for i := 0; i < b.N; i++ { json.Unmarshal(text, &val) } b.SetBytes(int64(len(text))) } func BenchmarkEncJSONFloat(b *testing.B) { var val interface{} text := []byte(`-10.11231`) for i := 0; i < b.N; i++ { json.Unmarshal(text, &val) } b.SetBytes(int64(len(text))) } func BenchmarkEncJSONString(b *testing.B) { var val interface{} text := []byte(`"hello world"`) for i := 0; i < b.N; i++ { json.Unmarshal(text, &val) } b.SetBytes(int64(len(text))) } func BenchmarkEncJSONBool(b *testing.B) { var val interface{} text := []byte(`true`) for i := 0; i < b.N; i++ { json.Unmarshal(text, &val) } b.SetBytes(int64(len(text))) } func BenchmarkEncJSONNull(b *testing.B) { var val interface{} text := []byte(`null`) for i := 0; i < b.N; i++ { json.Unmarshal(text, &val) } b.SetBytes(int64(len(text))) } func BenchmarkEncJSONArray(b *testing.B) { var val []interface{} text := []byte(`[79.1253026404128,null,"hello world", false, 10]`) for i := 0; i < b.N; i++ { json.Unmarshal(text, &val) } b.SetBytes(int64(len(text))) } func BenchmarkEncJSONMap(b *testing.B) { var val map[string]interface{} for i := 0; i < b.N; i++ { json.Unmarshal(jsonText, &val) } b.SetBytes(int64(len(jsonText))) } func BenchmarkEncJSONMedium(b *testing.B) { var val []interface{} text, _ := ioutil.ReadFile("./../testdata/medium.json") for i := 0; i < b.N; i++ { json.Unmarshal(text, &val) } b.SetBytes(int64(len(text))) } func BenchmarkEncJSONLarge(b *testing.B) { var val []interface{} text, _ := ioutil.ReadFile("./../testdata/large.json") for i := 0; i < b.N; i++ { json.Unmarshal(text, &val) } b.SetBytes(int64(len(text))) } <|start_filename|>doc.go<|end_filename|> /* Package parsec provides a library of parser-combinators. The basic idea behind parsec module is that, it allows programmers to compose basic set of terminal parsers, a.k.a tokenizers and compose them together as a tree of parsers, using combinators like: And, OrdChoice, Kleene, Many, Maybe. To begin with there are four basic Types that needs to be kept in mind while creating and composing parsers, Types Scanner, an interface type that encapsulates the input text. A built in scanner called SimpleScanner is supplied along with this package. Developers can also implement their own scanner types. Following example create a new instance of SimpleScanner, using an input text: var exprText = []byte(`4 + 123 + 23 + 67 +89 + 87 *78`) s := parsec.NewScanner(exprText) Nodify, callback function is supplied while combining parser functions. If the underlying parsing logic matches with i/p text, then callback will be dispatched with list of matching ParsecNode. Value returned by callback function will further be used as ParsecNode item in higher-level list of ParsecNodes. Parser, simple parsers are functions that matches i/p text for specific patterns. Simple parsers can be combined using one of the supplied combinators to construct a higher level parser. A parser function takes a Scanner object and applies the underlying parsing logic, if underlying logic succeeds Nodify callback is dispatched and a ParsecNode and a new Scanner object (with its cursor moved forward) is returned. If parser fails to match, it shall return the input scanner object as it is, along with nil ParsecNode. ParsecNode, an interface type encapsulates one or more tokens from i/p text, as terminal node or non-terminal node. Combinators If input text is going to be a single token like `10` or `true` or `"some string"`, then all we need is a single Parser function that can tokenize the i/p text into a terminal node. But our applications are seldom that simple. Almost all the time we need to parse the i/p text for more than one tokens and most of the time we need to compose them into a tree of terminal and non-terminal nodes. This is where combinators are useful. Package provides a set of combinators to help combine terminal parsers into higher level parsers. They are, * And, to combine a sequence of terminals and non-terminal parsers. * OrdChoice, to choose between specified list of parsers. * Kleene, to repeat the parser zero or more times. * Many, to repeat the parser one or more times. * ManyUntil, to repeat the parser until a specified end matcher. * Maybe, to apply the parser once or none. All the above mentioned combinators accept one or more parser function as arguments, either by value or by reference. The reason for allowing parser argument by reference is to be able to define recursive parsing logic, like parsing nested arrays: var Y Parser var value Parser // circular rats var opensqrt = Atom("[", "OPENSQRT") var closesqrt = Atom("]", "CLOSESQRT") var values = Kleene(nil, &value, Atom(",", "COMMA")) var array = And(nil, opensqrt, values, closeSqrt) func init() { value = parsec.OrdChoice(nil, Int(), Bool(), String(), array) Y = parsec.OrdChoice(nil, value) } Terminal parsers Parsers for standard set of tokens are supplied along with this package. Most of these parsers return Terminal type as ParseNode. * Char, match a single character skipping leading whitespace. * Float, match a float literal skipping leading whitespace. * Hex, match a hexadecimal literal skipping leading whitespace. * Int, match a decimal number literal skipping leading whitespace. * Oct, match a octal number literal skipping leading whitespace. * String, match a string literal skipping leading whitespace. * Ident, match a identifier token skipping leading whitespace. * Atom, match a single atom skipping leading whitespace. * AtomExact, match a single atom without skipping leading whitespace. * Token, match a single token skipping leading whitespace. * TokenExact, match a single token without skipping leading whitespace. * OrdToken, match a single token with specified list of alternatives. * End, match end of text. * NoEnd, match not an end of text. All of the terminal parsers, except End and NoEnd return Terminal type as ParsecNode. While End and NoEnd return a boolean type as ParsecNode. AST and Queryable This is an experimental feature to use CSS like selectors for quering an Abstract Syntax Tree (AST). Types, APIs and methods associated with AST and Queryable are unstable, and are expected to change in future. While Scanner, Parser, ParsecNode types are re-used in AST and Queryable, combinator functions are re-implemented as AST methods. Similarly type ASTNodify is to be used instead of Nodify type. Otherwise all the parsec techniques mentioned above are equally applicable on AST. Additionally, following points are worth noting while using AST, * Combinator methods supplied via AST can be named. * All combinators from AST object will create and return NonTerminal as the Queryable type. * ASTNodify function can interpret its Queryable argument and return a different type implementing Queryable interface. */ package parsec <|start_filename|>expr/nodify.go<|end_filename|> // Copyright (c) 2013 Goparsec AUTHORS. All rights reserved. // Use of this source code is governed by LICENSE file. package expr import "github.com/prataprc/goparsec" func one2one(ns []parsec.ParsecNode) parsec.ParsecNode { if ns == nil || len(ns) == 0 { return nil } return ns[0] } func many2many(ns []parsec.ParsecNode) parsec.ParsecNode { if ns == nil || len(ns) == 0 { return nil } return ns } <|start_filename|>expr/expr_test.go<|end_filename|> // Copyright (c) 2013 Goparsec AUTHORS. All rights reserved. // Use of this source code is governed by LICENSE file. package expr import "testing" import "github.com/prataprc/goparsec" var exprText = `4 + 123 + 23 + 67 +89 + 87 *78 /67-98- 199` func TestExpr(t *testing.T) { s := parsec.NewScanner([]byte(exprText)) v, _ := Y(s) if v.(int) != 110 { t.Fatalf("Mismatch value %v\n", v) } } func BenchmarkExpr1Op(b *testing.B) { text := []byte(`19 + 10`) for i := 0; i < b.N; i++ { Y(parsec.NewScanner(text)) } b.SetBytes(int64(len(text))) } func BenchmarkExpr2Op(b *testing.B) { text := []byte(`19+10*20`) for i := 0; i < b.N; i++ { Y(parsec.NewScanner(text)) } b.SetBytes(int64(len(text))) } func BenchmarkExpr3Op(b *testing.B) { text := []byte(`19 + 10 * 20/9`) for i := 0; i < b.N; i++ { Y(parsec.NewScanner(text)) } b.SetBytes(int64(len(text))) } func BenchmarkExpr(b *testing.B) { for i := 0; i < b.N; i++ { Y(parsec.NewScanner([]byte(exprText))) } b.SetBytes(int64(len(exprText))) } <|start_filename|>parsec.go<|end_filename|> // Copyright (c) 2013 Goparsec AUTHORS. All rights reserved. // Use of this source code is governed by LICENSE file. package parsec import "fmt" // ParsecNode for parsers return input text as parsed nodes. type ParsecNode interface{} // Parser function parses input text encapsulated by Scanner, higher // order parsers are constructed using combinators. type Parser func(Scanner) (ParsecNode, Scanner) // Nodify callback function to construct custom ParsecNode. Even when // combinators like And, OrdChoice, Many etc.. can match input string, // it is still possible to fail them via nodify callback function, by // returning nil. This very useful in cases when, // * lookahead matching is required. // * an exceptional cases for regex pattern. // // Note that some combinators like KLEENE shall not interpret the return // value from Nodify callback. type Nodify func([]ParsecNode) ParsecNode // And combinator accepts a list of `Parser`, or reference to a // parser, that must match the input string, atleast until the // last Parser argument. Return a parser function that can further be // used to construct higher-level parsers. // // If all parser matches, a list of ParsecNode, where each // ParsecNode is constructed by matching parser, will be passed // as argument to Nodify callback. Even if one of the input // parser function fails, And will fail without consuming the input. func And(callb Nodify, parsers ...interface{}) Parser { return func(s Scanner) (ParsecNode, Scanner) { var ns = make([]ParsecNode, 0, len(parsers)) var n ParsecNode news := s.Clone() for _, parser := range parsers { n, news = doParse(parser, news) if n == nil { return nil, s } ns = append(ns, n) } if node := docallback(callb, ns); node != nil { return node, news } return nil, s } } // OrdChoice combinator accepts a list of `Parser`, or // reference to a parser, where atleast one of the parser // must match the input string. Return a parser function // that can further be used to construct higher level parsers. // // The first matching parser function's output is passed // as argument to Nodify callback, that is []ParsecNode argument // will just have one element in it. If none of the parsers // match the input, then OrdChoice will fail without consuming // any input. func OrdChoice(callb Nodify, parsers ...interface{}) Parser { return func(s Scanner) (ParsecNode, Scanner) { for _, parser := range parsers { if n, news := doParse(parser, s.Clone()); n != nil { if node := docallback(callb, []ParsecNode{n}); node != nil { return node, news } } } return nil, s } } // Kleene combinator accepts two parsers, or reference to // parsers, namely opScan and sepScan, where opScan parser // will be used to match input string and contruct ParsecNode, // and sepScan parser will be used to match input string // and ignore the matched string. If sepScan parser is not // supplied, then opScan parser will be applied on the input // until it fails. // // The process of matching opScan parser and sepScan parser // will continue in a loop until either one of them fails on // the input stream. // // For every successful match of opScan, the returned // ParsecNode from matching parser will be accumulated and // passed as argument to Nodify callback. If there is not a // single match for opScan, then []ParsecNode of ZERO length // will be passed as argument to Nodify callback. Kleene // combinator will never fail. func Kleene(callb Nodify, parsers ...interface{}) Parser { var opScan, sepScan interface{} switch l := len(parsers); l { case 1: opScan = parsers[0] case 2: opScan, sepScan = parsers[0], parsers[1] default: panic(fmt.Errorf("kleene parser doesn't accept %v parsers", l)) } return func(s Scanner) (ParsecNode, Scanner) { var n ParsecNode ns := make([]ParsecNode, 0) news := s.Clone() for { if n, news = doParse(opScan, news); n == nil { break } ns = append(ns, n) if sepScan != nil { if n, news = doParse(sepScan, news); n == nil { break } } } return docallback(callb, ns), news } } // Many combinator accepts two parsers, or reference to // parsers, namely opScan and sepScan, where opScan parser // will be used to match input string and contruct ParsecNode, // and sepScan parser will be used to match input string and // ignore the matched string. If sepScan parser is not // supplied, then opScan parser will be applied on the input // until it fails. // // The process of matching opScan parser and sepScan parser // will continue in a loop until either one of them fails on // the input stream. // // The difference between `Many` combinator and `Kleene` // combinator is that there shall atleast be one match of opScan. // // For every successful match of opScan, the returned // ParsecNode from matching parser will be accumulated and // passed as argument to Nodify callback. If there is not a // single match for opScan, then Many will fail without // consuming the input. func Many(callb Nodify, parsers ...interface{}) Parser { var opScan, sepScan interface{} switch l := len(parsers); l { case 1: opScan = parsers[0] case 2: opScan, sepScan = parsers[0], parsers[1] default: panic(fmt.Errorf("many parser doesn't accept %v parsers", l)) } return func(s Scanner) (ParsecNode, Scanner) { var n ParsecNode ns := make([]ParsecNode, 0) news := s.Clone() for { if n, news = doParse(opScan, news); n == nil { break } ns = append(ns, n) if sepScan != nil { if n, news = doParse(sepScan, news); n == nil { break } } } if len(ns) > 0 { if node := docallback(callb, ns); node != nil { return node, news } } return nil, s } } // ManyUntil combinator accepts three parsers, or references to // parsers, namely opScan, sepScan and untilScan, where opScan parser // will be used to match input string and contruct ParsecNode, // and sepScan parser will be used to match input string and // ignore the matched string. If sepScan parser is not // supplied, then opScan parser will be applied on the input // until it fails. // // The process of matching opScan parser and sepScan parser // will continue in a loop until either one of them fails on // the input stream or untilScan matches. // // For every successful match of opScan, the returned // ParsecNode from matching parser will be accumulated and // passed as argument to Nodify callback. If there is not a // single match for opScan, then ManyUntil will fail without // consuming the input. func ManyUntil(callb Nodify, parsers ...interface{}) Parser { var opScan, sepScan, untilScan interface{} switch l := len(parsers); l { case 2: opScan, untilScan = parsers[0], parsers[1] case 3: opScan, sepScan, untilScan = parsers[0], parsers[1], parsers[2] default: panic(fmt.Errorf("ManyUntil parser doesn't accept %v parsers", l)) } return func(s Scanner) (ParsecNode, Scanner) { var n ParsecNode var e ParsecNode ns := make([]ParsecNode, 0) news := s.Clone() for { if e, _ = doParse(untilScan, news.Clone()); e != nil { break } if n, news = doParse(opScan, news); n == nil { break } ns = append(ns, n) if sepScan != nil { if n, news = doParse(sepScan, news); n == nil { break } } } if len(ns) > 0 { if node := docallback(callb, ns); node != nil { return node, news } } return nil, s } } // Maybe combinator accepts a single parser, or reference to // a parser, and tries to match the input stream with it. If // parser fails to match the input, returns MaybeNone. func Maybe(callb Nodify, parser interface{}) Parser { return func(s Scanner) (ParsecNode, Scanner) { n, news := doParse(parser, s.Clone()) if n == nil { return MaybeNone("missing"), s } if node := docallback(callb, []ParsecNode{n}); node != nil { return node, news } return MaybeNone("missing"), s } } //---------------- // Local functions //---------------- func doParse(parser interface{}, s Scanner) (ParsecNode, Scanner) { switch p := parser.(type) { case Parser: return p(s) case *Parser: return (*p)(s) default: panic(fmt.Errorf("type of parser `%T` not supported", parser)) } } func docallback(callb Nodify, ns []ParsecNode) ParsecNode { if callb != nil { return callb(ns) } return ns } <|start_filename|>examples/one.go<|end_filename|> package main import "fmt" import "github.com/prataprc/goparsec" var input = `[a,[aa,[aaa],ab,ac],b,c,[ca,cb,cc,[cca]]]` func main() { var array parsec.Parser ast := parsec.NewAST("one", 100) id := parsec.And( func(ns []parsec.ParsecNode) parsec.ParsecNode { t := ns[0].(*parsec.Terminal) t.Value = `"` + t.Value + `"` return t }, parsec.Token(`[a-z]+`, "ID"), ) opensqr := parsec.Atom(`[`, "OPENSQR") closesqr := parsec.Atom(`]`, "CLOSESQR") comma := ast.Maybe("comma", nil, parsec.Atom(`,`, "COMMA")) item := ast.OrdChoice("item", nil, id, &array) itemsep := ast.And("itemsep", nil, item, comma) items := ast.Kleene("items", nil, itemsep, nil) array = ast.And("array", nil, opensqr, items, closesqr) s := parsec.NewScanner([]byte(input)) node, _ := ast.Parsewith(array, s) fmt.Println(node.GetValue()) } <|start_filename|>expr/expr.go<|end_filename|> // Copyright (c) 2013 Goparsec AUTHORS. All rights reserved. // Use of this source code is governed by LICENSE file. // Package provide a parser to parse basic arithmetic expression based on the // following rule. // // expr -> sum // prod -> value (mulop value)* // mulop -> "*" // | "/" // sum -> prod (addop prod)* // addop -> "+" // | "-" // value -> num // | "(" expr ")" package expr import "strconv" import "fmt" import "github.com/prataprc/goparsec" var _ = fmt.Sprintf("dummp print") // Y is root Parser, usually called as `s` in CFG theory. var Y parsec.Parser var prod, sum, value parsec.Parser // circular rats // Terminal rats var openparan = parsec.Token(`\(`, "OPENPARAN") var closeparan = parsec.Token(`\)`, "CLOSEPARAN") var addop = parsec.Token(`\+`, "ADD") var subop = parsec.Token(`-`, "SUB") var multop = parsec.Token(`\*`, "MULT") var divop = parsec.Token(`/`, "DIV") // NonTerminal rats // addop -> "+" | "-" var sumOp = parsec.OrdChoice(one2one, addop, subop) // mulop -> "*" | "/" var prodOp = parsec.OrdChoice(one2one, multop, divop) // value -> "(" expr ")" var groupExpr = parsec.And(exprNode, openparan, &sum, closeparan) // (addop prod)* var prodK = parsec.Kleene(nil, parsec.And(many2many, sumOp, &prod), nil) // (mulop value)* var valueK = parsec.Kleene(nil, parsec.And(many2many, prodOp, &value), nil) func init() { // Circular rats come to life // sum -> prod (addop prod)* sum = parsec.And(sumNode, &prod, prodK) // prod-> value (mulop value)* prod = parsec.And(prodNode, &value, valueK) // value -> num | "(" expr ")" value = parsec.OrdChoice(exprValueNode, intWS(), groupExpr) // expr -> sum Y = parsec.OrdChoice(one2one, sum) } func intWS() parsec.Parser { return func(s parsec.Scanner) (parsec.ParsecNode, parsec.Scanner) { _, s = s.SkipAny(`^[ \n\t]+`) p := parsec.Int() return p(s) } } //---------- // Nodifiers //---------- func sumNode(ns []parsec.ParsecNode) parsec.ParsecNode { if len(ns) > 0 { val := ns[0].(int) for _, x := range ns[1].([]parsec.ParsecNode) { y := x.([]parsec.ParsecNode) n := y[1].(int) switch y[0].(*parsec.Terminal).Name { case "ADD": val += n case "SUB": val -= n } } return val } return nil } func prodNode(ns []parsec.ParsecNode) parsec.ParsecNode { if len(ns) > 0 { val := ns[0].(int) for _, x := range ns[1].([]parsec.ParsecNode) { y := x.([]parsec.ParsecNode) n := y[1].(int) switch y[0].(*parsec.Terminal).Name { case "MULT": val *= n case "DIV": val /= n } } return val } return nil } func exprNode(ns []parsec.ParsecNode) parsec.ParsecNode { if len(ns) == 0 { return nil } return ns[1] } func exprValueNode(ns []parsec.ParsecNode) parsec.ParsecNode { if len(ns) == 0 { return nil } else if term, ok := ns[0].(*parsec.Terminal); ok { val, _ := strconv.Atoi(term.Value) return val } return ns[0] } <|start_filename|>ast_test.go<|end_filename|> package parsec import "fmt" import "bytes" import "testing" import "io/ioutil" var _ = fmt.Sprintf("dummy") func TestASTReset(t *testing.T) { ast := NewAST("testand", 100) y := ast.And("and", nil, Atom("hello", "TERM")) s := NewScanner([]byte("hello")) node, _ := ast.Parsewith(y, s) if x, y := ast.root.GetValue(), node.GetValue(); x != y { t.Errorf("expected %v, got %v", x, y) } if len(ast.ntpool) != 0 { t.Errorf("expected 0") } else if cap(ast.ntpool) != 100 { t.Errorf("expected 100") } ast = ast.Reset() if len(ast.ntpool) != 1 { t.Errorf("expected 1") } else if cap(ast.ntpool) != 100 { t.Errorf("expected 100") } } func TestASTAnd(t *testing.T) { ast := NewAST("testand", 100) y := ast.And("and", nil, Atom("hello", "TERM")) s := NewScanner([]byte("hello")) node, s := ast.Parsewith(y, s) if node.GetValue() != "hello" { t.Errorf("expected %v, got %v", "hello", node.GetValue()) } else if s.Endof() == false { t.Errorf("expected true") } ast.Reset() // negative case s = NewScanner([]byte("he")) node, ss := ast.Parsewith(y, s) if node != nil { t.Errorf("expected nil") } x := ss.(*SimpleScanner) if rem := string(x.buf[x.cursor:]); rem != "he" { t.Errorf("expected %v, got %v", "he", rem) } ast.Reset() // nil callback y = ast.And("and", func(_ string, _ Scanner, _ Queryable) Queryable { return nil }, Atom("hello", "TERM"), ) s = NewScanner([]byte("hello")) node, ss = ast.Parsewith(y, s) if node != nil { t.Errorf("expected nil") } x = ss.(*SimpleScanner) if rem := string(x.buf[x.cursor:]); rem != "hello" { t.Errorf("expected %v, got %v", "he", rem) } ast.Reset() // return new object y = ast.And("and", func(_ string, _ Scanner, _ Queryable) Queryable { return MaybeNone("missing") }, Atom("hello", "TERM"), ) s = NewScanner([]byte("hello")) node, ss = ast.Parsewith(y, s) if node.(MaybeNone) != "missing" { t.Errorf("expected missing") } else if ss.Endof() == false { t.Errorf("expected Endof") } if len(ast.ntpool) != 1 { t.Errorf("expected 1") } ast.Reset() } func TestASTOrdChoice(t *testing.T) { ast := NewAST("testor", 100) y := ast.OrdChoice("or", nil, Atom("hello", "TERM"), Atom("world", "ATOM")) s := NewScanner([]byte("world")) node, s := ast.Parsewith(y, s) if node.GetValue() != "world" { t.Errorf("expected %v, got %v", "world", node.GetValue()) } else if s.Endof() == false { t.Errorf("expected true") } ast.Reset() // negative case s = NewScanner([]byte("he")) node, ss := ast.Parsewith(y, s) if node != nil { t.Errorf("expected nil") } x := ss.(*SimpleScanner) if rem := string(x.buf[x.cursor:]); rem != "he" { t.Errorf("expected %v, got %v", "he", rem) } ast.Reset() // nil callback y = ast.OrdChoice("or", func(_ string, _ Scanner, _ Queryable) Queryable { return nil }, Atom("hello", "TERM"), Atom("world", "TERM"), ) s = NewScanner([]byte("world")) node, ss = ast.Parsewith(y, s) if node != nil { t.Errorf("expected nil") } x = ss.(*SimpleScanner) if rem := string(x.buf[x.cursor:]); rem != "world" { t.Errorf("expected %v, got %v", "he", rem) } ast.Reset() } func TestASTKleene(t *testing.T) { // without separator ast := NewAST("testkleene", 100) y := ast.Kleene("kleene", nil, Atom("hello", "ONE")) s := NewScanner([]byte("hellohello")) q, ss := ast.Parsewith(y, s) if len(q.GetChildren()) != 2 { t.Errorf("unexpected %v", len(q.GetChildren())) } else if q.GetValue() != "hellohello" { t.Errorf("unexpected %v", q.GetValue()) } else if ss.Endof() == false { t.Errorf("expected true") } ast.Reset() // empty case s = NewScanner([]byte("world")) q, ss = ast.Parsewith(y, s) if len(q.GetChildren()) != 0 { t.Errorf("unexpected %v", len(q.GetChildren())) } else if q.GetValue() != "" { t.Errorf("unexpected %v", q.GetValue()) } x := ss.(*SimpleScanner) if str := string(x.buf[x.cursor:]); str != "world" { t.Errorf("unexpected %v", str) } else if ss.Endof() == true { t.Errorf("expected false") } // with separator y = ast.Kleene("kleene", nil, Atom("hello", "ONE"), Atom(",", "COMMA")) s = NewScanner([]byte("hello,hello")) q, ss = ast.Parsewith(y, s) if len(q.GetChildren()) != 2 { t.Errorf("unexpected %v", len(q.GetChildren())) } else if q.GetValue() != "hellohello" { t.Errorf("unexpected %v", q.GetValue()) } else if ss.Endof() == false { t.Errorf("expected true") } ast.Reset() // panic case func() { defer func() { if r := recover(); r == nil { t.Errorf("expected panic") } }() Kleene(nil, Atom("hello", "W"), Atom(",", "COMMA"), Atom(",", "COMMA")) }() } func TestASTStrEOF(t *testing.T) { word := Token(`"[a-z]+"`, "W") ast := NewAST("teststreof", 100) y := ast.Many( "many", func(_ string, _ Scanner, ns Queryable) Queryable { return ns }, word, ) input := `"alpha" "beta" "gamma"` ref := `"alpha""beta""gamma"` s := NewScanner([]byte(input)) node, _ := ast.Parsewith(y, s) if node.GetValue() != ref { t.Errorf("expected %v, got %v", ref, node.GetValue()) } } func TestASTMany(t *testing.T) { w := Token("\\w+", "W") // without separator ast := NewAST("testmany", 100) y := ast.Many("many", nil, w) s, ref := NewScanner([]byte("one two stop")), "onetwostop" node, ss := ast.Parsewith(y, s) if node == nil { t.Errorf("Many() didn't match %q", ss) } else if node.GetValue() != ref { t.Errorf("Many() unexpected: %v", node.GetValue()) } ast.Reset() // with separator y = ast.Many("many", nil, w, Atom(",", "COMMA")) s = NewScanner([]byte("one,two")) node, ss = ast.Parsewith(y, s) if node == nil { t.Errorf("Many() didn't match %q", ss) } else if node.GetValue() != "onetwo" { t.Errorf("Many() unexpected : %q", node.GetValue()) } // Return nil y = ast.Many( "many", func(_ string, _ Scanner, _ Queryable) Queryable { return nil }, w, Atom(",", "COMMA"), ) s = NewScanner([]byte("one,two")) node, ss = ast.Parsewith(y, s) if node != nil { t.Errorf("Many() didn't match %q", ss) } x := ss.(*SimpleScanner) if str := string(x.buf[x.cursor:]); str != "one,two" { t.Errorf("expected %q, got %q", "one,two", str) } // panic case func() { defer func() { if r := recover(); r == nil { t.Errorf("expected panic") } }() ast.Many("many", nil, w, Atom(",", "COMMA"), Atom(",", "COMMA")) }() } func TestASTManyUntil(t *testing.T) { w := Token("\\w+", "W") // Return nil ast := NewAST("testmanyuntil", 100) y := ast.ManyUntil( "manyuntil", func(_ string, _ Scanner, _ Queryable) Queryable { return nil }, w, Atom(",", "COMMA"), ) s := NewScanner([]byte("one,two")) node, ss := ast.Parsewith(y, s) if node != nil { t.Errorf("ManyUntil() expected nil") } x := ss.(*SimpleScanner) if str := string(x.buf[x.cursor:]); str != "one,two" { t.Errorf("expected %q, got %q", "one,two", str) } // panic case func() { defer func() { if r := recover(); r == nil { t.Errorf("expected panic") } }() ast.ManyUntil("manyuntil", nil, w) }() func() { defer func() { if r := recover(); r == nil { t.Errorf("expected panic") } }() ast.ManyUntil( "manyuntil", nil, w, Atom(",", "COMMA"), Atom(",", "COMMA"), Atom(",", "COMMA"), ) }() } func TestASTManyUntilNoStop(t *testing.T) { w, u := Token("\\w+", "W"), Token("stop", "S") ast := NewAST("nostop", 100) y := ast.ManyUntil("manyuntil", nil, w, u) s := NewScanner([]byte("one two three")) node, ss := ast.Parsewith(y, s) if node == nil { t.Errorf("ManyUntil() didn't match : %q", ss) } else if node.GetValue() != "onetwothree" { t.Errorf("ManyUntil() unexpected : %q", node.GetValue()) } } func TestASTManyUntilStop(t *testing.T) { w, u := Token("\\w+", "W"), Token("stop", "S") ast := NewAST("stop", 100) y := ast.ManyUntil("manyuntil", nil, w, u) s := NewScanner([]byte("one two stop")) node, ss := ast.Parsewith(y, s) if node == nil { t.Errorf("ManyUntil() didn't match %q", ss) } else if node.GetValue() != "onetwo" { t.Errorf("ManyUntil() unexpected : %q", node.GetValue()) } } func TestASTManyUntilNoStopSep(t *testing.T) { w, u, z := Token("\\w+", "W"), Token("stop", "S"), Token("z", "Z") ast := NewAST("nostopsep", 100) y := ast.ManyUntil("manyuntil", nil, w, z, u) s := NewScanner([]byte("one z two z three")) node, ss := ast.Parsewith(y, s) if node == nil { t.Errorf("ManyUntil() didn't match %q", ss) } else if node.GetValue() != "onetwothree" { t.Errorf("ManyUntil() unexpected : %q", node.GetValue()) } } func TestASTManyUntilStopSep(t *testing.T) { w, u, z := Token("\\w+", "W"), Token("stop", "S"), Token("z", "Z") ast := NewAST("stopsep", 100) y := ast.ManyUntil("manyuntil", nil, w, z, u) s := NewScanner([]byte("one z two z stop")) node, ss := ast.Parsewith(y, s) if node == nil { t.Errorf("ManyUntil() didn't match %q", ss) } else if node.GetValue() != "onetwo" { t.Errorf("ManyUntil() didn't stop %q", node.GetValue()) } } func TestASTForwardReference(t *testing.T) { var ycomma Parser w := Token(`[a-z]+`, "W") ast := NewAST("testforward", 100) y := ast.Kleene("kleene", nil, ast.Maybe("maybe", nil, w), &ycomma) ycomma = Atom(",", "COMMA") s := NewScanner([]byte("one,two,,three")) node, _ := ast.Parsewith(y, s) if node.GetValue() != "onetwothree" { t.Errorf("unexpected: %v", node.GetValue()) } else if _, ok := node.GetChildren()[2].(MaybeNone); ok == false { t.Errorf("expected MaybeNone") } ast.Reset() // nil return y = ast.Maybe( "maybe", func(_ string, _ Scanner, _ Queryable) Queryable { return nil }, w, ) s = NewScanner([]byte("one")) node, _ = ast.Parsewith(y, s) if node != MaybeNone("missing") { t.Errorf("expected %v, got %v", node, MaybeNone("missing")) } } func TestGetValue(t *testing.T) { data, err := ioutil.ReadFile("testdata/simple.html") if err != nil { t.Error(err) } data = bytes.Trim(data, " \t\r\n") ast := NewAST("html", 100) y := makeexacthtmly(ast) s := NewScanner(data).TrackLineno() node, _ := ast.Parsewith(y, s) if node.GetValue() != string(data) { t.Errorf("expected %q", string(data)) t.Errorf("got %q", node.GetValue()) } } func TestPrettyprint(t *testing.T) { data, err := ioutil.ReadFile("testdata/simple.html") if err != nil { t.Error(err) } data = bytes.Trim(data, " \t\r\n") ref, err := ioutil.ReadFile("testdata/simple.out") if err != nil { t.Error(err) } ast := NewAST("html", 100) y := makeexacthtmly(ast) s := NewScanner(data).TrackLineno() ast.Parsewith(y, s) buf := bytes.NewBuffer(make([]byte, 0, 1024)) ast.prettyprint(buf, "", ast.root) out := string(buf.Bytes()) if string(ref) != out { t.Errorf("expected %v", ref) t.Errorf("got %v", out) } } func TestDotstring(t *testing.T) { data, err := ioutil.ReadFile("testdata/simple.html") if err != nil { t.Error(err) } data = bytes.Trim(data, " \t\r\n") ref, err := ioutil.ReadFile("testdata/simple.dot") if err != nil { t.Error(err) } ref = bytes.Trim(ref, " \t\r\n") ast := NewAST("html", 100) y := makeexacthtmly(ast) s := NewScanner(data).TrackLineno() ast.Parsewith(y, s) dotout := ast.dottext("testhtml") if string(ref) != dotout { t.Errorf("expected %v", string(ref)) t.Errorf("got %v", dotout) } } func makeexacthtmly(ast *AST) Parser { var tag Parser opentag := AtomExact("<", "OT") closetag := AtomExact(">", "CT") equal := AtomExact("=", "EQUAL") slash := TokenExact("/[ \t]*", "SLASH") tagname := TokenExact("[a-z][a-zA-Z0-9]*", "TAG") attrkey := TokenExact("[a-z][a-zA-Z0-9]*", "ATTRK") text := TokenExact("[^<>]+", "TEXT") ws := TokenExact("[ \t]+", "WS") element := ast.OrdChoice("element", nil, text, &tag) elements := ast.Kleene("elements", nil, element) attr := ast.And("attribute", nil, attrkey, equal, String()) attrws := ast.And("attrws", nil, attr, ast.Maybe("ws", nil, ws)) attrs := ast.Kleene("attributes", nil, attrws) tstart := ast.And("tagstart", nil, opentag, tagname, attrs, closetag) tend := ast.And("tagend", nil, opentag, slash, tagname, closetag) tag = ast.And("tag", nil, tstart, elements, tend) return tag } <|start_filename|>parsec_test.go<|end_filename|> package parsec import "fmt" import "reflect" import "testing" var _ = fmt.Sprintf("dummy") func TestAnd(t *testing.T) { y := And(func(ns []ParsecNode) ParsecNode { return nil }, Atom("hello", "TERM")) s := NewScanner([]byte("hello")) node, s := y(s) if node != nil { t.Errorf("expected nil") } ss := s.(*SimpleScanner) if str := string(ss.buf[ss.cursor:]); str != "hello" { t.Errorf("expected %q, got %q", "hello", str) } } func TestOrdChoice(t *testing.T) { y := OrdChoice(func(ns []ParsecNode) ParsecNode { return nil }, Atom("hello", "TERM")) s := NewScanner([]byte("hello")) node, s := y(s) if node != nil { t.Errorf("expected nil") } ss := s.(*SimpleScanner) if str := string(ss.buf[ss.cursor:]); str != "hello" { t.Errorf("expected %q, got %q", "hello", str) } } func TestStrEOF(t *testing.T) { word := String() Y := Many( func(ns []ParsecNode) ParsecNode { return ns }, word) input := `"alpha" "beta" "gamma"` s := NewScanner([]byte(input)) root, _ := Y(s) nodes := root.([]ParsecNode) ref := []ParsecNode{"\"alpha\"", "\"beta\"", "\"gamma\""} if !reflect.DeepEqual(nodes, ref) { t.Fatal(nodes) } } func TestMany(t *testing.T) { w := Token("\\w+", "W") y := Many(nil, w) s := NewScanner([]byte("one two stop")) node, e := y(s) if node == nil { t.Errorf("Many() didn't match %q", e) } else if len(node.([]ParsecNode)) != 3 { t.Errorf("Many() didn't match all words %q", node) } w = Token("\\w+", "W") y = Many(nil, w, Atom(",", "COMMA")) s = NewScanner([]byte("one,two")) node, e = y(s) if node == nil { t.Errorf("Many() didn't match %q", e) } else if len(node.([]ParsecNode)) != 2 { t.Errorf("Many() didn't match all words %q", node) } // Return nil w = Token("\\w+", "W") y = Many( func(_ []ParsecNode) ParsecNode { return nil }, w, Atom(",", "COMMA"), ) s = NewScanner([]byte("one,two")) node, s = y(s) if node != nil { t.Errorf("Many() didn't match %q", e) } ss := s.(*SimpleScanner) if str := string(ss.buf[ss.cursor:]); str != "one,two" { t.Errorf("expected %q, got %q", "one,two", str) } // panic case func() { defer func() { if r := recover(); r == nil { t.Errorf("expected panic") } }() Many(nil, Token("\\w+", "W"), Atom(",", "COMMA"), Atom(",", "COMMA")) }() } func TestManyUntil(t *testing.T) { // Return nil w := Token("\\w+", "W") y := ManyUntil( func(_ []ParsecNode) ParsecNode { return nil }, w, Atom(",", "COMMA"), ) s := NewScanner([]byte("one,two")) node, s := y(s) if node != nil { t.Errorf("ManyUntil() expected nil") } ss := s.(*SimpleScanner) if str := string(ss.buf[ss.cursor:]); str != "one,two" { t.Errorf("expected %q, got %q", "one,two", str) } // panic case func() { defer func() { if r := recover(); r == nil { t.Errorf("expected panic") } }() ManyUntil(nil, Token("\\w+", "W")) }() func() { defer func() { if r := recover(); r == nil { t.Errorf("expected panic") } }() ManyUntil( nil, Token("\\w+", "W"), Atom(",", "COMMA"), Atom(",", "COMMA"), Atom(",", "COMMA"), ) }() } func TestManyUntilNoStop(t *testing.T) { w := Token("\\w+", "W") u := Token("stop", "S") m := ManyUntil(nil, w, u) s := NewScanner([]byte("one two three")) v, e := m(s) if v == nil { t.Errorf("ManyUntil() didn't match %q", e) } else if len(v.([]ParsecNode)) != 3 { t.Errorf("ManyUntil() didn't match all words %q", v) } } func TestManyUntilStop(t *testing.T) { w := Token("\\w+", "W") u := Token("stop", "S") m := ManyUntil(nil, w, u) s := NewScanner([]byte("one two stop")) v, e := m(s) if v == nil { t.Errorf("ManyUntil() didn't match %q", e) } else if len(v.([]ParsecNode)) != 2 { t.Errorf("ManyUntil() didn't stop %q", v) } } func TestManyUntilNoStopSep(t *testing.T) { w := Token("\\w+", "W") u := Token("stop", "S") z := Token("z", "Z") m := ManyUntil(nil, w, z, u) s := NewScanner([]byte("one z two z three")) v, e := m(s) if v == nil { t.Errorf("ManyUntil() didn't match %q", e) } else if len(v.([]ParsecNode)) != 3 { t.Errorf("ManyUntil() didn't match all words %q", v) } } func TestManyUntilStopSep(t *testing.T) { w := Token("\\w+", "W") u := Token("stop", "S") z := Token("z", "Z") m := ManyUntil(nil, w, z, u) s := NewScanner([]byte("one z two z stop")) v, e := m(s) if v == nil { t.Errorf("ManyUntil() didn't match %q", e) } else if len(v.([]ParsecNode)) != 2 { t.Errorf("ManyUntil() didn't stop %q", v) } } func TestKleene(t *testing.T) { y := Kleene(nil, Token("\\w+", "W")) s := NewScanner([]byte("one two stop")) node, e := y(s) if node == nil { t.Errorf("Kleene() didn't match %q", e) } else if len(node.([]ParsecNode)) != 3 { t.Errorf("Kleene() didn't match all words %q", node) } y = Kleene(nil, Token("\\w+", "W"), Atom(",", "COMMA")) s = NewScanner([]byte("one,two")) node, _ = y(s) if node == nil { t.Errorf("Kleene() didn't match %q", e) } else if len(node.([]ParsecNode)) != 2 { t.Errorf("Kleene() didn't match all words %q", node) } // panic case func() { defer func() { if r := recover(); r == nil { t.Errorf("expected panic") } }() Kleene(nil, Token("\\w+", "W"), Atom(",", "COMMA"), Atom(",", "COMMA")) }() } func TestForwardReference(t *testing.T) { var ycomma Parser y := Kleene(nil, Maybe(nil, Token("\\w+", "WORD")), &ycomma) ycomma = Atom(",", "COMMA") s := NewScanner([]byte("one,two,,three")) node, _ := y(s) nodes := node.([]ParsecNode) if len(nodes) != 4 { t.Errorf("expected length to be 4") } else if _, ok := nodes[2].(MaybeNone); ok == false { t.Errorf("expected MaybeNone") } // nil return y = Maybe( func(_ []ParsecNode) ParsecNode { return nil }, Token("\\w+", "WORD"), ) s = NewScanner([]byte("one")) node, _ = y(s) if node != MaybeNone("missing") { t.Errorf("expected %v, got %v", node, MaybeNone("missing")) } } func allTokens(ns []ParsecNode) ParsecNode { return ns } <|start_filename|>scanner_test.go<|end_filename|> // Copyright (c) 2013 Goparsec AUTHORS. All rights reserved. // Use of this source code is governed by LICENSE file. package parsec import "bytes" import "reflect" import "strings" import "testing" import "fmt" var _ = fmt.Sprintf("dummy print") func TestClone(t *testing.T) { text := []byte(`example text`) s := NewScanner(text) if !reflect.DeepEqual(s, s.Clone()) { t.Fatal("Clone() method does not work as intended") } } func TestMatch(t *testing.T) { text := []byte(`example text`) ref := `exampl` s := NewScanner(text) m, s := s.Match(`^ex.*l`) if string(m) != ref { t.Fatalf("mismatch expected %s, got %s", ref, string(m)) } expcur := 6 if s.GetCursor() != expcur { t.Fatalf("expected cursor position %v, got %v", expcur, s.GetCursor()) } } func TestSubmatchAll(t *testing.T) { text := []byte(`alphabetaexample text`) s := NewScanner(text) pattern := `^(?P<X>alpha)|(?P<Y>beta)(?P<Z>example) text` m, s := s.SubmatchAll(pattern) if len(m) != 1 { t.Fatalf("match failed in len %v\n", m) } else if str := string(m["X"]); str != "alpha" { t.Fatalf("expected %q got %q\n", "alpha", str) } m, s = s.SubmatchAll(pattern) if len(m) != 2 { t.Fatalf("match failed in len %v\n", m) } else if str := string(m["Y"]); str != "beta" { t.Fatalf("expected %q got %q\n", "beta", str) } else if str := string(m["Z"]); str != "example" { t.Fatalf("expected %q got %q\n", "example", str) } } func TestMatchString(t *testing.T) { text := `myString0` s := NewScanner([]byte(text)) ok1, s := s.MatchString("my") ok2, s := s.MatchString("String0") if !ok1 || !ok2 { t.Fatalf("did not match correctly") } if !s.Endof() { t.Fatalf("expect end of text") } //Not matching case text2 := `myString` s = NewScanner([]byte(text2)) ok3, s := s.MatchString("myString0") if ok3 { t.Fatalf("shouldn't have matched") } if s.Endof() { t.Fatalf("did not expect end of text") } } func TestSkipWS(t *testing.T) { text := []byte(` `) ref := ` ` s := NewScanner(text) m, s := s.SkipWS() if string(m) != ref { t.Fatalf("mismatch expected %q, got %q", ref, string(m)) } expcur := 8 if s.GetCursor() != expcur { t.Fatalf("expected cursor position %v, got %v", expcur, s.GetCursor()) } } func TestSkipAny(t *testing.T) { text := `B B BA` s := NewScanner([]byte(text)) _, s = s.SkipAny(`[ \n\tB]+`) aRef := []byte("A") a, snew := s.Match("A") if a[0] != aRef[0] { t.Fatalf("expected character A after skipping whitespaces and B") } if !snew.Endof() { t.Fatalf("input text should have been completely skipped or matched") } } func TestEndof(t *testing.T) { text := []byte(` text`) s := NewScanner(text) _, s = s.SkipAny(`^[ ]+`) if s.Endof() { t.Fatalf("did not expect end of text") } _, s = s.SkipAny(`^[tex]+`) if !s.Endof() { t.Fatalf("expect end of text") } } func TestResetcursor(t *testing.T) { text := []byte(` text`) s := NewScanner(text) if s.Endof() == true { t.Errorf("expected Endof false") } _, s = s.SkipAny(`^[ tex]+`) if s.Endof() == false { t.Errorf("expect Endof true") } s.(*SimpleScanner).resetcursor() if s.Endof() == true { t.Errorf("expected Endof false") } } func TestSetWSPattern(t *testing.T) { text := []byte(`// comment`) ref := `// comment` s := NewScanner(text) s.(*SimpleScanner).SetWSPattern(`^//.*`) m, s := s.SkipWS() if string(m) != ref { t.Fatalf("mismatch expected %q, got %q", ref, string(m)) } expcur := 10 if s.GetCursor() != expcur { t.Fatalf("expected cursor position %v, got %v", expcur, s.GetCursor()) } } func TestSkipWSUnicode(t *testing.T) { text := "\t\n\v\f\r \u0085\u00A0hello" s := NewScanner([]byte(text)).(*SimpleScanner).TrackLineno() out, ss := s.(*SimpleScanner).SkipWSUnicode() if ss.Endof() == true { t.Errorf("expected false") } if bytes.Compare(out, []byte(text[:10])) != 0 { t.Errorf("expected %v, got %v", []byte(text), out) } // full match text = "\t\n\v\f\r \u0085\u00A0" s = NewScanner([]byte(text)).(*SimpleScanner) out, ss = s.(*SimpleScanner).SkipWSUnicode() if ss.Endof() == false { t.Errorf("expected true") } if bytes.Compare(out, []byte(text)) != 0 { t.Errorf("expected %v, got %v", []byte(text), out) } } func TestTrackLineno(t *testing.T) { text := []byte("hello \n \t \nworld \n\"say\" cheese.") y := OrdChoice( func(nodes []ParsecNode) ParsecNode { return nodes[0] }, Token(`\w+`, "WORD"), Atom(`"say"`, "STR"), ) scanner := NewScanner(text).TrackLineno() node, scanner := y(scanner) if v := node.(*Terminal).Value; v != "hello" { t.Errorf("expected %q, got %q", "hello", v) } else if scanner.Lineno() != 1 { t.Errorf("expected %v, got %v", 1, scanner.Lineno()) } else if cursor := scanner.GetCursor(); cursor != 5 { t.Errorf("expected %v, got %v", 5, cursor) } node, scanner = y(scanner) if v := node.(*Terminal).Value; v != "world" { t.Errorf("expected %q, got %q", "world", v) } else if scanner.Lineno() != 3 { t.Errorf("expected %v, got %v", 1, scanner.Lineno()) } else if cursor := scanner.GetCursor(); cursor != 17 { t.Errorf("expected %v, got %v", 17, cursor) } node, scanner = y(scanner) if v := node.(*Terminal).Value; v != `"say"` { t.Errorf("expected %q, got %q", "say", v) } else if scanner.Lineno() != 4 { t.Errorf("expected %v, got %v", 1, scanner.Lineno()) } else if cursor := scanner.GetCursor(); cursor != 24 { t.Errorf("expected %v, got %v", 24, cursor) } node, scanner = y(scanner) if v := node.(*Terminal).Value; v != "cheese" { t.Errorf("expected %q, got %q", "cheese", v) } else if scanner.Lineno() != 4 { t.Errorf("expected %v, got %v", 1, scanner.Lineno()) } else if cursor := scanner.GetCursor(); cursor != 31 { t.Errorf("expected %v, got %v", 31, cursor) } } func TestUnicode(t *testing.T) { text := "号分隔值, 逗号分隔值" ytok := TokenExact(`[^,]+`, "FIELD") y := Many(nil, ytok, Atom(",", "COMMA")) s := NewScanner([]byte(text)) node, _ := y(s) nodes := node.([]ParsecNode) n1, n2 := nodes[0].(*Terminal), nodes[1].(*Terminal) parts := strings.Split(text, ",") if parts[0] != string(n1.Value) { t.Errorf("expected %s, got %s", parts[0], n1.Value) } else if parts[1] != string(n2.Value) { t.Errorf("expected %s, got %s", parts[1], n2.Value) } } func BenchmarkSScanClone(b *testing.B) { text := []byte("hello world") s := NewScanner(text) for i := 0; i < b.N; i++ { s.Clone() } } func BenchmarkMatch(b *testing.B) { s := NewScanner([]byte(`hello world`)) for i := 0; i < b.N; i++ { s.(*SimpleScanner).resetcursor() s.Match(`hello world`) } } func BenchmarkMatchString(b *testing.B) { s := NewScanner([]byte(`hello world`)) for i := 0; i < b.N; i++ { s.(*SimpleScanner).resetcursor() s.MatchString(`hello world`) } } func BenchmarkSScanSkipWS(b *testing.B) { text := []byte(" hello world") s := NewScanner(text) for i := 0; i < b.N; i++ { s.SkipWS() s.(*SimpleScanner).resetcursor() } } func BenchmarkSScanSkipAny(b *testing.B) { text := []byte(" hello world") s := NewScanner(text) for i := 0; i < b.N; i++ { s.SkipAny(`^[ hel]+`) s.(*SimpleScanner).resetcursor() } } <|start_filename|>tokeniser_test.go<|end_filename|> package parsec import "testing" import "fmt" var _ = fmt.Sprintf("dummy") func TestTerminalString(t *testing.T) { // double quote s := NewScanner([]byte(`"hello \"world"`)) node, s := String()(s) tokstr := node.(string) if s.Endof() == false { t.Errorf("expected end of text") } else if ref := `"hello "world"`; tokstr != ref { t.Errorf("expected %q, got %q", ref, tokstr) } // double quote with white spaces around s = NewScanner([]byte(` "hello world" `)) node, s = String()(s) tokstr = node.(string) if s.Endof() == true { t.Errorf("did not expected end of text") } else if ref := `"hello world"`; tokstr != ref { t.Errorf("expected %v, got %q", ref, tokstr) } // negative cases s = NewScanner([]byte(` `)) node, s = String()(s) if node != nil { t.Errorf("unexpected terminal %q", tokstr) } s = NewScanner([]byte(`a"`)) node, _ = String()(s) if node != nil { t.Errorf("unexpected terminal %q", tokstr) } // empty string s = NewScanner([]byte(``)) node, s = String()(s) if node != nil { t.Errorf("expected nil") } // unicode encoded string s = NewScanner([]byte("\"\\u849c\\u8089\"")) node, s = String()(s) if node.(string) != "\"蒜肉\"" { t.Errorf("expected %q, got %v", "蒜肉", node.(string)) } // for code coverage s = NewScanner([]byte("\"")) node, s = String()(s) if node != nil { t.Errorf("expected nil") } txt := "\"細繩,索\"" s = NewScanner([]byte(txt)) node, s = String()(s) if node.(string) != txt { t.Errorf("expected %v, got %v", txt, node.(string)) } // malformed string func() { defer func() { if r := recover(); r == nil { t.Errorf("expected panic") } }() s = NewScanner([]byte(`"hello`)) String()(s) }() } func TestTerminalChar(t *testing.T) { s := NewScanner([]byte(`'a'`)) node, _ := Char()(s) terminal := node.(*Terminal) if terminal.Value != `'a'` { t.Errorf("expected %v, got %v", `a`, terminal.Value) } // white-space s = NewScanner([]byte(`'a`)) node, _ = Char()(s) if node != nil { t.Errorf("unexpected terminal node") } // negative case s = NewScanner([]byte(``)) node, _ = Char()(s) if node != nil { t.Errorf("unexpected terminal, %v", node) } } func TestTerminalFloat(t *testing.T) { s := NewScanner([]byte(` 10.`)) node, _ := Float()(s) terminal := node.(*Terminal) if terminal.Value != `10.` { t.Errorf("expected %v, got %v", `10.`, terminal.Value) } else if terminal.Name != "FLOAT" { t.Errorf("expected %v, got %v", "FLOAT", terminal.Name) } else if terminal.Position != 1 { t.Errorf("expected %v, got %v", 1, terminal.Position) } // with decimal s = NewScanner([]byte(`+10.10`)) node, _ = Float()(s) terminal = node.(*Terminal) if terminal.Value != `+10.10` { t.Errorf("expected %v, got %v", `10.0`, terminal.Value) } // small-decimal s = NewScanner([]byte(`-.10`)) node, _ = Float()(s) terminal = node.(*Terminal) if terminal.Value != `-.10` { t.Errorf("expected %v, got %v", `-.10`, terminal.Value) } // not float s = NewScanner([]byte(`hello`)) node, _ = Float()(s) if node != nil { t.Errorf("unexpected float") } // not float s = NewScanner([]byte(`.`)) node, _ = Float()(s) if node != nil { t.Errorf("unexpected float") } // not float s = NewScanner([]byte(`-100.0 100.0`)) nodes := []ParsecNode{} node, s = Float()(s) for node != nil { nodes = append(nodes, node) node, s = Float()(s) } if len(nodes) != 2 { t.Errorf("expected 1 node, got %v", nodes) } } func TestTerminalHex(t *testing.T) { s := NewScanner([]byte(`0x10ab`)) node, _ := Hex()(s) terminal := node.(*Terminal) if terminal.Value != `0x10ab` { t.Errorf("expected %v, got %v", `0x10ab`, terminal.Value) } else if terminal.Name != "HEX" { t.Errorf("expected %v, got %v", "HEX", terminal.Name) } // with caps s = NewScanner([]byte(`0x10AB`)) node, _ = Hex()(s) terminal = node.(*Terminal) if terminal.Value != `0x10AB` { t.Errorf("expected %v, got %v", `0x10AB`, terminal.Value) } } func TestTerminalOct(t *testing.T) { s := NewScanner([]byte(`007`)) node, _ := Oct()(s) terminal := node.(*Terminal) if terminal.Value != `007` { t.Errorf("expected %v, got %v", `007`, terminal.Value) } else if terminal.Name != "OCT" { t.Errorf("expected %v, got %v", "OCT", terminal.Name) } // with caps s = NewScanner([]byte(`08`)) node, _ = Oct()(s) if node != nil { t.Errorf("expected nil, got %v", node) } } func TestTerminalInt(t *testing.T) { s := NewScanner([]byte(`1239`)) node, _ := Int()(s) terminal := node.(*Terminal) if terminal.Value != `1239` { t.Errorf("expected %v, got %v", `1239`, terminal.Value) } else if terminal.Name != "INT" { t.Errorf("expected %v, got %v", "INT", terminal.Name) } } func TestTerminalIdent(t *testing.T) { s := NewScanner([]byte(`identifier`)) node, _ := Ident()(s) terminal := node.(*Terminal) if terminal.Value != `identifier` { t.Errorf("expected %v, got %v", `identifier`, terminal.Value) } else if terminal.Name != "IDENT" { t.Errorf("expected %v, got %v", "IDENT", terminal.Name) } } func TestTerminalOrdTokens(t *testing.T) { Y := OrdTokens([]string{`\+`, `-`}, []string{"PLUS", "MINUS"}) s := NewScanner([]byte(` +-`)) node, s := Y(s) terminal := node.(*Terminal) if terminal.Value != `+` { t.Errorf("expected %v, got %v", `+`, terminal.Value) } else if terminal.Name != "PLUS" { t.Errorf("expected %v, got %v", "PLUS", terminal.Name) } else if terminal.Position != 1 { t.Errorf("expected %v, got %v", 1, terminal.Position) } node, s = Y(s) terminal = node.(*Terminal) if s.Endof() == false { t.Errorf("expected end of scanner") } else if terminal.Value != `-` { t.Errorf("expected %v, got %v", `-`, terminal.Value) } else if terminal.Name != "MINUS" { t.Errorf("expected %v, got %v", "MINUS", terminal.Name) } else if terminal.Position != 2 { t.Errorf("expected %v, got %v", 2, terminal.Position) } } func TestEnd(t *testing.T) { p := And(nil, Token("test", "T"), End()) s := NewScanner([]byte("test")) v, e := p(s) if v == nil { t.Errorf("End() didn't match %q", e) } } func TestNotEnd(t *testing.T) { p := And(nil, Token("test", "T"), End()) s := NewScanner([]byte("testing")) v, _ := p(s) if v != nil { t.Errorf("End() shouldn't have matched %q", v) } } func TestNoEnd(t *testing.T) { p := And(nil, Token("test", "T"), NoEnd()) s := NewScanner([]byte("testing")) v, e := p(s) if v == nil { t.Errorf("NoEnd() didn't match %q", e) } } func TestNotNoEnd(t *testing.T) { p := And(nil, Token("test", "T"), NoEnd()) s := NewScanner([]byte("test")) v, _ := p(s) if v != nil { t.Errorf("NoEnd() shouldn't have matched %q", v) } } func TestAtom(t *testing.T) { assertpostive := func(node ParsecNode, scanner *SimpleScanner) { if node == nil { t.Errorf("expected node") } else if tm := node.(*Terminal); tm.Name != "ATOM" { t.Errorf("expected %q, got %q", "ATOM", tm.Name) } else if tm.Value != "cos" { t.Errorf("expected %q, got %q", "cos", tm.Value) } else if x, y := string(scanner.buf[scanner.cursor:]), "mos"; x != y { t.Errorf("expected %q, got %q", y, x) } } // positive match scanner := NewScanner([]byte("cosmos")).(*SimpleScanner) node, sc := Atom("cos", "ATOM")(scanner) scanner = sc.(*SimpleScanner) assertpostive(node, scanner) // positive match with leading whitespace scanner = NewScanner([]byte(" cosmos")).(*SimpleScanner) node, sc = Atom("cos", "ATOM")(scanner) scanner = sc.(*SimpleScanner) assertpostive(node, scanner) // negative match input := "hello, cosmos" scanner = NewScanner([]byte(input)).(*SimpleScanner) node, sc = Atom("cos", "ATOM")(scanner) scanner = sc.(*SimpleScanner) if node != nil { t.Errorf("expected nil") } else if s := string(scanner.buf[scanner.cursor:]); s != input { t.Errorf("expected %q, got %q", input, s) } } func TestAtomExact(t *testing.T) { assertpostive := func(node ParsecNode, scanner *SimpleScanner) { if node == nil { t.Errorf("expected node") } else if tm := node.(*Terminal); tm.Name != "ATOM" { t.Errorf("expected %q, got %q", "ATOM", tm.Name) } else if tm.Value != "cos" { t.Errorf("expected %q, got %q", "cos", tm.Value) } else if x, y := string(scanner.buf[scanner.cursor:]), "mos"; x != y { t.Errorf("expected %q, got %q", y, x) } } // positive match scanner := NewScanner([]byte("cosmos")).(*SimpleScanner) node, sc := AtomExact("cos", "ATOM")(scanner) scanner = sc.(*SimpleScanner) assertpostive(node, scanner) // match with leading whitespace (negative) input := " cosmos" scanner = NewScanner([]byte(input)).(*SimpleScanner) node, sc = AtomExact("cos", "ATOM")(scanner) scanner = sc.(*SimpleScanner) if node != nil { t.Errorf("expected nil") } else if s := string(scanner.buf[scanner.cursor:]); s != input { t.Errorf("expected %q, got %q", input, s) } } func TestTokenExact(t *testing.T) { // positive match scanner := NewScanner([]byte("cosmos")) node, _ := TokenExact("[cosm]+", "TOK")(scanner) if tm := node.(*Terminal); tm.Name != "TOK" { t.Errorf("expected %q, got %q", "TOK", tm.Name) } else if tm.Value != "cosmos" { t.Errorf("expected %q, got %q", "cos", tm.Value) } // negative match scanner = NewScanner([]byte(" cosmos")) node, _ = TokenExact("[cosm]+", "TOK")(scanner) if node != nil { t.Errorf("expected nil") } } func BenchmarkTerminalString(b *testing.B) { Y := String() s := NewScanner([]byte(` "hello"`)) for i := 0; i < b.N; i++ { Y(s) } } func BenchmarkTerminalChar(b *testing.B) { Y := Char() s := NewScanner([]byte(` 'h'`)) for i := 0; i < b.N; i++ { Y(s) } } func BenchmarkTerminalFloat(b *testing.B) { Y := Float() s := NewScanner([]byte(` 10.10`)) for i := 0; i < b.N; i++ { Y(s) } } func BenchmarkTerminalHex(b *testing.B) { Y := Hex() s := NewScanner([]byte(` 0x1231abcd`)) for i := 0; i < b.N; i++ { Y(s) } } func BenchmarkTerminalOct(b *testing.B) { Y := Oct() s := NewScanner([]byte(` 0x1231abcd`)) for i := 0; i < b.N; i++ { Y(s) } } func BenchmarkTerminalInt(b *testing.B) { Y := Int() s := NewScanner([]byte(` 1231`)) for i := 0; i < b.N; i++ { Y(s) } } func BenchmarkTerminalIdent(b *testing.B) { Y := Ident() s := NewScanner([]byte(` true`)) for i := 0; i < b.N; i++ { Y(s) } } func BenchmarkTToken(b *testing.B) { Y := Token(" sometoken", "TOKEN") s := NewScanner([]byte(` sometoken`)) for i := 0; i < b.N; i++ { Y(s) } } func BenchmarkTTokenExact(b *testing.B) { Y := Token("sometoken", "TOKEN") s := NewScanner([]byte(` sometoken`)) for i := 0; i < b.N; i++ { Y(s) } } func BenchmarkTAtom(b *testing.B) { Y := Atom(" sometoken", "TOKEN") s := NewScanner([]byte(` sometoken`)) for i := 0; i < b.N; i++ { Y(s) } } func BenchmarkTAtomExact(b *testing.B) { Y := AtomExact("sometoken", "TOKEN") s := NewScanner([]byte(` sometoken`)) for i := 0; i < b.N; i++ { Y(s) } } func BenchmarkTerminalOrdTokens(b *testing.B) { Y := OrdTokens([]string{`\+`, `-`}, []string{"PLUS", "MINUS"}) s := NewScanner([]byte(` +-`)) for i := 0; i < b.N; i++ { Y(s) } } <|start_filename|>selector_test.go<|end_filename|> package parsec import "os" import "fmt" import "bytes" import "strings" import "testing" import "compress/gzip" import "io/ioutil" import "path/filepath" // TODO: interesting selectors // tagstart *[class=term] func TestParseselectorBasic(t *testing.T) { // create and reuse. selast := NewAST("selectors", 100) sely := parseselector(selast) // test parsing `*` ref := "*" qsel, _ := selast.Parsewith(sely, NewScanner([]byte(ref))) cs := qsel.GetChildren() if len(cs) != 1 { t.Errorf("unexpected %v", len(cs)) } else if cs = cs[0].GetChildren(); len(cs) != 1 { t.Errorf("unexpected %v", len(cs)) } validateselterm(t, cs[0].GetChildren()[0] /*star*/, "STAR", "*") if v := qsel.GetValue(); v != ref { t.Errorf("expected %q, got %q", ref, v) } // test parsing `.term` selast.Reset() ref = ".term" qsel, _ = selast.Parsewith(sely, NewScanner([]byte(ref))) cs = qsel.GetChildren() if len(cs) != 1 { t.Errorf("unexpected %v", len(cs)) } else if cs = cs[0].GetChildren(); len(cs) != 1 { t.Errorf("unexpected %v", len(cs)) } validateselterm(t, cs[0].GetChildren()[2] /*shorth*/, "SHORTH", ".term") if v := qsel.GetValue(); v != ref { t.Errorf("expected %q, got %q", ref, v) } // test parsing `#uniqueid` selast.Reset() ref = "#uniqueid" qsel, _ = selast.Parsewith(sely, NewScanner([]byte(ref))) cs = qsel.GetChildren() if len(cs) != 1 { t.Errorf("unexpected %v", len(cs)) } else if cs = cs[0].GetChildren(); len(cs) != 1 { t.Errorf("unexpected %v", len(cs)) } validateselterm(t, cs[0].GetChildren()[2] /*shorth*/, "SHORTH", "#uniqueid") if v := qsel.GetValue(); v != ref { t.Errorf("expected %q, got %q", ref, v) } // test parsing `tagstart` node-name selast.Reset() ref = "tagstart" qsel, _ = selast.Parsewith(sely, NewScanner([]byte(ref))) cs = qsel.GetChildren() if len(cs) != 1 { t.Errorf("unexpected %v", len(cs)) } else if cs = cs[0].GetChildren(); len(cs) != 1 { t.Errorf("unexpected %v", len(cs)) } validateselterm(t, cs[0].GetChildren()[1] /*shorth*/, "NAME", "tagstart") if v := qsel.GetValue(); v != ref { t.Errorf("expected %q, got %q", ref, v) } // test parsing `[attribute]` selast.Reset() ref = "[class]" qsel, _ = selast.Parsewith(sely, NewScanner([]byte(ref))) cs = qsel.GetChildren() if len(cs) != 1 { t.Errorf("unexpected %v", len(cs)) } else if cs = cs[0].GetChildren(); len(cs) != 1 { t.Errorf("unexpected %v", len(cs)) } attrq := cs[0].GetChildren()[3] validateselterm(t, attrq.GetChildren()[0], "OPENSQR", "[") validateselterm(t, attrq.GetChildren()[1], "ATTRNAME", "class") validateselterm(t, attrq.GetChildren()[3], "CLOSESQR", "]") if v := qsel.GetValue(); v != ref { t.Errorf("expected %q, got %q", ref, v) } // test parsing `[attribute=value]` selast.Reset() ref = "[class=term]" qsel, _ = selast.Parsewith(sely, NewScanner([]byte(ref))) cs = qsel.GetChildren() if len(cs) != 1 { t.Errorf("unexpected %v", len(cs)) } else if cs = cs[0].GetChildren(); len(cs) != 1 { t.Errorf("unexpected %v", len(cs)) } attrq = cs[0].GetChildren()[3] validateselterm(t, attrq.GetChildren()[0], "OPENSQR", "[") validateselterm(t, attrq.GetChildren()[1], "ATTRNAME", "class") validateselterm(t, attrq.GetChildren()[3], "CLOSESQR", "]") valq := attrq.GetChildren()[2] validateselterm(t, valq.GetChildren()[0], "ATTRSEP", "=") validateselterm(t, valq.GetChildren()[1], "attrchoice", "term") if v := qsel.GetValue(); v != ref { t.Errorf("expected %q, got %q", ref, v) } // test parsing `[attribute~=value]` selast.Reset() ref = "[class~=on]" // containing er qsel, _ = selast.Parsewith(sely, NewScanner([]byte(ref))) cs = qsel.GetChildren() if len(cs) != 1 { t.Errorf("unexpected %v", len(cs)) } else if cs = cs[0].GetChildren(); len(cs) != 1 { t.Errorf("unexpected %v", len(cs)) } attrq = cs[0].GetChildren()[3] validateselterm(t, attrq.GetChildren()[0], "OPENSQR", "[") validateselterm(t, attrq.GetChildren()[1], "ATTRNAME", "class") validateselterm(t, attrq.GetChildren()[3], "CLOSESQR", "]") valq = attrq.GetChildren()[2] validateselterm(t, valq.GetChildren()[0], "ATTRSEP", "~=") validateselterm(t, valq.GetChildren()[1], "attrchoice", "on") if v := qsel.GetValue(); v != ref { t.Errorf("expected %q, got %q", ref, v) } // test parsing `[attribute^=value]` selast.Reset() ref = "[class^=ter]" qsel, _ = selast.Parsewith(sely, NewScanner([]byte(ref))) cs = qsel.GetChildren() if len(cs) != 1 { t.Errorf("unexpected %v", len(cs)) } else if cs = cs[0].GetChildren(); len(cs) != 1 { t.Errorf("unexpected %v", len(cs)) } attrq = cs[0].GetChildren()[3] validateselterm(t, attrq.GetChildren()[0], "OPENSQR", "[") validateselterm(t, attrq.GetChildren()[1], "ATTRNAME", "class") validateselterm(t, attrq.GetChildren()[3], "CLOSESQR", "]") valq = attrq.GetChildren()[2] validateselterm(t, valq.GetChildren()[0], "ATTRSEP", "^=") validateselterm(t, valq.GetChildren()[1], "attrchoice", "ter") if v := qsel.GetValue(); v != ref { t.Errorf("expected %q, got %q", ref, v) } // test parsing `[attribute$=value]` selast.Reset() ref = "[class$=term]" qsel, _ = selast.Parsewith(sely, NewScanner([]byte(ref))) cs = qsel.GetChildren() if len(cs) != 1 { t.Errorf("unexpected %v", len(cs)) } else if cs = cs[0].GetChildren(); len(cs) != 1 { t.Errorf("unexpected %v", len(cs)) } attrq = cs[0].GetChildren()[3] validateselterm(t, attrq.GetChildren()[0], "OPENSQR", "[") validateselterm(t, attrq.GetChildren()[1], "ATTRNAME", "class") validateselterm(t, attrq.GetChildren()[3], "CLOSESQR", "]") valq = attrq.GetChildren()[2] validateselterm(t, valq.GetChildren()[0], "ATTRSEP", "$=") validateselterm(t, valq.GetChildren()[1], "attrchoice", "term") if v := qsel.GetValue(); v != ref { t.Errorf("expected %q, got %q", ref, v) } // test parsing `[attribute*=value]` selast.Reset() ref = "[class*=non]" qsel, _ = selast.Parsewith(sely, NewScanner([]byte(ref))) cs = qsel.GetChildren() if len(cs) != 1 { t.Errorf("unexpected %v", len(cs)) } else if cs = cs[0].GetChildren(); len(cs) != 1 { t.Errorf("unexpected %v", len(cs)) } attrq = cs[0].GetChildren()[3] validateselterm(t, attrq.GetChildren()[0], "OPENSQR", "[") validateselterm(t, attrq.GetChildren()[1], "ATTRNAME", "class") validateselterm(t, attrq.GetChildren()[3], "CLOSESQR", "]") valq = attrq.GetChildren()[2] validateselterm(t, valq.GetChildren()[0], "ATTRSEP", "*=") validateselterm(t, valq.GetChildren()[1], "attrchoice", "non") if v := qsel.GetValue(); v != ref { t.Errorf("expected %q, got %q", ref, v) } // test parsing `:empty` selast.Reset() ref = ":empty" qsel, _ = selast.Parsewith(sely, NewScanner([]byte(ref))) cs = qsel.GetChildren() if len(cs) != 1 { t.Errorf("unexpected %v", len(cs)) } else if cs = cs[0].GetChildren(); len(cs) != 1 { t.Errorf("unexpected %v", len(cs)) } attrq = cs[0].GetChildren()[4] validateselterm(t, attrq.GetChildren()[0], "COLON", ":") validateselterm(t, attrq.GetChildren()[1], "empty", "empty") if v := qsel.GetValue(); v != ref { t.Errorf("expected %q, got %q", ref, v) } // test parsing `:first-child` selast.Reset() ref = ":first-child" qsel, _ = selast.Parsewith(sely, NewScanner([]byte(ref))) cs = qsel.GetChildren() if len(cs) != 1 { t.Errorf("unexpected %v", len(cs)) } else if cs = cs[0].GetChildren(); len(cs) != 1 { t.Errorf("unexpected %v", len(cs)) } attrq = cs[0].GetChildren()[4] validateselterm(t, attrq.GetChildren()[0], "COLON", ":") validateselterm(t, attrq.GetChildren()[1], "first-child", "first-child") if v := qsel.GetValue(); v != ref { t.Errorf("expected %q, got %q", ref, v) } // test parsing `:first-of-type` selast.Reset() ref = ":first-of-type" qsel, _ = selast.Parsewith(sely, NewScanner([]byte(ref))) cs = qsel.GetChildren() if len(cs) != 1 { t.Errorf("unexpected %v", len(cs)) } else if cs = cs[0].GetChildren(); len(cs) != 1 { t.Errorf("unexpected %v", len(cs)) } attrq = cs[0].GetChildren()[4] validateselterm(t, attrq.GetChildren()[0], "COLON", ":") validateselterm(t, attrq.GetChildren()[1], "first-of-type", "first-of-type") if v := qsel.GetValue(); v != ref { t.Errorf("expected %q, got %q", ref, v) } // test parsing `:last-child` selast.Reset() ref = ":last-child" qsel, _ = selast.Parsewith(sely, NewScanner([]byte(ref))) cs = qsel.GetChildren() if len(cs) != 1 { t.Errorf("unexpected %v", len(cs)) } else if cs = cs[0].GetChildren(); len(cs) != 1 { t.Errorf("unexpected %v", len(cs)) } attrq = cs[0].GetChildren()[4] validateselterm(t, attrq.GetChildren()[0], "COLON", ":") validateselterm(t, attrq.GetChildren()[1], "last-child", "last-child") if v := qsel.GetValue(); v != ref { t.Errorf("expected %q, got %q", ref, v) } // test parsing `:last-of-type` selast.Reset() ref = ":last-of-type" qsel, _ = selast.Parsewith(sely, NewScanner([]byte(ref))) cs = qsel.GetChildren() if len(cs) != 1 { t.Errorf("unexpected %v", len(cs)) } else if cs = cs[0].GetChildren(); len(cs) != 1 { t.Errorf("unexpected %v", len(cs)) } attrq = cs[0].GetChildren()[4] validateselterm(t, attrq.GetChildren()[0], "COLON", ":") validateselterm(t, attrq.GetChildren()[1], "last-of-type", "last-of-type") if v := qsel.GetValue(); v != ref { t.Errorf("expected %q, got %q", ref, v) } // test parsing `:nth-child(n)` selast.Reset() ref = ":nth-child(0)" qsel, _ = selast.Parsewith(sely, NewScanner([]byte(ref))) cs = qsel.GetChildren() if len(cs) != 1 { t.Errorf("unexpected %v", len(cs)) } else if cs = cs[0].GetChildren(); len(cs) != 1 { t.Errorf("unexpected %v", len(cs)) } attrq = cs[0].GetChildren()[4] validateselterm(t, attrq.GetChildren()[0], "COLON", ":") argq := attrq.GetChildren()[1] validateselterm(t, argq.GetChildren()[0], "CNC", "nth-child") validateselterm(t, argq.GetChildren()[1], "INT", "(0)") if v := qsel.GetValue(); v != ref { t.Errorf("expected %q, got %q", ref, v) } // test parsing `:nth-last-child(n)` selast.Reset() ref = ":nth-last-child(0)" qsel, _ = selast.Parsewith(sely, NewScanner([]byte(ref))) cs = qsel.GetChildren() if len(cs) != 1 { t.Errorf("unexpected %v", len(cs)) } else if cs = cs[0].GetChildren(); len(cs) != 1 { t.Errorf("unexpected %v", len(cs)) } attrq = cs[0].GetChildren()[4] validateselterm(t, attrq.GetChildren()[0], "COLON", ":") argq = attrq.GetChildren()[1] validateselterm(t, argq.GetChildren()[0], "CNLC", "nth-last-child") validateselterm(t, argq.GetChildren()[1], "INT", "(0)") if v := qsel.GetValue(); v != ref { t.Errorf("expected %q, got %q", ref, v) } // test parsing `:nth-last-of-type(n)` selast.Reset() ref = ":nth-last-of-type(0)" qsel, _ = selast.Parsewith(sely, NewScanner([]byte(ref))) cs = qsel.GetChildren() if len(cs) != 1 { t.Errorf("unexpected %v", len(cs)) } else if cs = cs[0].GetChildren(); len(cs) != 1 { t.Errorf("unexpected %v", len(cs)) } attrq = cs[0].GetChildren()[4] validateselterm(t, attrq.GetChildren()[0], "COLON", ":") argq = attrq.GetChildren()[1] validateselterm(t, argq.GetChildren()[0], "CNLOT", "nth-last-of-type") validateselterm(t, argq.GetChildren()[1], "INT", "(0)") if v := qsel.GetValue(); v != ref { t.Errorf("expected %q, got %q", ref, v) } // test parsing `:nth-of-type(n)` selast.Reset() ref = ":nth-of-type(0)" qsel, _ = selast.Parsewith(sely, NewScanner([]byte(ref))) cs = qsel.GetChildren() if len(cs) != 1 { t.Errorf("unexpected %v", len(cs)) } else if cs = cs[0].GetChildren(); len(cs) != 1 { t.Errorf("unexpected %v", len(cs)) } attrq = cs[0].GetChildren()[4] validateselterm(t, attrq.GetChildren()[0], "COLON", ":") argq = attrq.GetChildren()[1] validateselterm(t, argq.GetChildren()[0], "CNOT", "nth-of-type") validateselterm(t, argq.GetChildren()[1], "INT", "(0)") if v := qsel.GetValue(); v != ref { t.Errorf("expected %q, got %q", ref, v) } // test parsing `:only-of-type` selast.Reset() ref = ":only-of-type" qsel, _ = selast.Parsewith(sely, NewScanner([]byte(ref))) cs = qsel.GetChildren() if len(cs) != 1 { t.Errorf("unexpected %v", len(cs)) } else if cs = cs[0].GetChildren(); len(cs) != 1 { t.Errorf("unexpected %v", len(cs)) } attrq = cs[0].GetChildren()[4] validateselterm(t, attrq.GetChildren()[0], "COLON", ":") validateselterm(t, attrq.GetChildren()[1], "only-of-type", "only-of-type") if v := qsel.GetValue(); v != ref { t.Errorf("expected %q, got %q", ref, v) } // test parsing `:only-child` selast.Reset() ref = ":only-child" qsel, _ = selast.Parsewith(sely, NewScanner([]byte(ref))) cs = qsel.GetChildren() if len(cs) != 1 { t.Errorf("unexpected %v", len(cs)) } else if cs = cs[0].GetChildren(); len(cs) != 1 { t.Errorf("unexpected %v", len(cs)) } attrq = cs[0].GetChildren()[4] validateselterm(t, attrq.GetChildren()[0], "COLON", ":") validateselterm(t, attrq.GetChildren()[1], "only-child", "only-child") if v := qsel.GetValue(); v != ref { t.Errorf("expected %q, got %q", ref, v) } //buf := bytes.NewBuffer(nil) //selast.prettyprint(buf, "", qsel) //fmt.Println(string(buf.Bytes())) } func TestParseselector(t *testing.T) { updateref := false selast := NewAST("selector", 100) sely := parseselector(selast) valrefs := map[int]string{ 22: "[class=term]", 23: "[class=term]", 24: "tagstarttagendtext", 25: "tagstarttext", 26: "tagstarttext", 27: "oanglebrkttagname", 28: "tagnamecanglebrkt", } for i := 1; i < 29; i++ { inpfile := filepath.Join( "testdata", "selectors", fmt.Sprintf("selector%v.txt", i)) ppfile := filepath.Join( "testdata", "selectors", fmt.Sprintf("selector%v.pprint", i)) inp := bytes.Trim(testdataFile(inpfile), "\r\n") qsel, _ := selast.Parsewith(sely, NewScanner(inp)) buf := bytes.NewBuffer(nil) selast.prettyprint(buf, "", qsel) out := buf.Bytes() if updateref { ioutil.WriteFile(ppfile, out, 0660) } ref := testdataFile(ppfile) if bytes.Compare(out, ref) != 0 { t.Errorf("expected %s", string(ref)) t.Errorf("got %s", string(out)) } valref, ok := valrefs[i] if ok == false { valref = string(inp) } if qsel.GetValue() != valref { t.Errorf("expected %v, got %v", valref, qsel.GetValue()) } } } func TestGetSelectorattr(t *testing.T) { // create and reuse. selast := NewAST("selectors", 100) sely := parseselector(selast) // test parsing `*` ref := "[class=term]" qsel, _ := selast.Parsewith(sely, NewScanner([]byte(ref))) q := qsel.GetChildren()[0].GetChildren()[0] key, op, match := getselectorattr(q) if key != "class" { t.Errorf("unexpected %v", key) } else if op != "=" { t.Errorf("unexpected %v", op) } else if match != "term" { t.Errorf("unexpected %v", match) } } func TestGetSelectorcolon(t *testing.T) { selast := NewAST("selectors", 100) sely := parseselector(selast) ref := ":nth-child(0)" qsel, _ := selast.Parsewith(sely, NewScanner([]byte(ref))) q := qsel.GetChildren()[0].GetChildren()[0] colonspec, colonarg := getcolon(q) if colonspec != "nth-child" { t.Errorf("unexpected %v", colonspec) } else if colonarg != "(0)" { t.Errorf("unexpected %v", colonarg) } } func TestFilterbyname(t *testing.T) { html := []byte("<a></a>") htmlast := NewAST("html", 100) htmlroot, _ := htmlast.Parsewith(makeexacthtmly(htmlast), NewScanner(html)) node := htmlroot.GetChildren()[0].GetChildren()[0] if filterbyname(node, "OT") == false { t.Errorf("expected true") } else if filterbyname(node, "ot") == false { t.Errorf("expected true") } else if filterbyname(node, "xyz") == true { t.Errorf("exected false") } } func TestFilterbyattr(t *testing.T) { html := []byte("<a></a>") htmlast := NewAST("html", 100) htmlroot, _ := htmlast.Parsewith(makeexacthtmly(htmlast), NewScanner(html)) term := htmlroot.GetChildren()[0].GetChildren()[0] if filterbyattr(term, "", "", "") == false { t.Errorf("expected true") } else if filterbyattr(term, "value", "", "") == false { t.Errorf("expected true") } else if filterbyattr(term, "value", "=", "<") == false { t.Errorf("expected true") } else if filterbyattr(term, "value", "=", ">") == true { t.Errorf("expected false") } else if filterbyattr(term, "missattr", "", "") == true { t.Errorf("expected false") } else if filterbyattr(term, "class", "", "") == false { t.Errorf("expected true") } else if filterbyattr(term, "class", "=", "term") == false { t.Errorf("expected true") } else if filterbyattr(term, "class", "~=", "er") == false { t.Errorf("expected true") } else if filterbyattr(term, "class", "^=", "te") == false { t.Errorf("expected true") } else if filterbyattr(term, "class", "$=", "rm") == false { t.Errorf("expected true") } else if filterbyattr(term, "class", "*=", "[term]{4}") == false { t.Errorf("expected true") } else if filterbyattr(term, "class", "==", "[term]{4}") == true { t.Errorf("expected false") } } func TestFilterbycolon(t *testing.T) { html := []byte("<a><b></b><em></em></a>") htmlast := NewAST("html", 100) htmlroot, _ := htmlast.Parsewith(makeexacthtmly(htmlast), NewScanner(html)) nttagstart := htmlroot.GetChildren()[0] ntelements := htmlroot.GetChildren()[1] termot := nttagstart.GetChildren()[0] termtaga := nttagstart.GetChildren()[1] if len(ntelements.GetChildren()) != 2 { t.Errorf("unexpected %v", len(ntelements.GetChildren())) } if filterbycolon(nttagstart, 0, termot, "empty", "") == false { t.Errorf("expected true") } else if filterbycolon(htmlroot, 0, nttagstart, "empty", "") == true { t.Errorf("expected false") } else if filterbycolon(nttagstart, 0, termot, "first-child", "") == false { t.Errorf("expected true") } else if filterbycolon(nttagstart, 1, termtaga, "first-child", "") == true { t.Errorf("expected false") } nttag1 := ntelements.GetChildren()[0] nttag2 := ntelements.GetChildren()[1] if filterbycolon(nil, 0, htmlroot, "first-of-type", "") == false { t.Errorf("expected true") } if filterbycolon(ntelements, 0, nttag1, "first-of-type", "") == false { t.Errorf("expected true") } if filterbycolon(ntelements, 1, nttag2, "first-of-type", "") == true { t.Errorf("expected false") } if filterbycolon(nil, 0, htmlroot, "last-child", "") == false { t.Errorf("expected true") } if filterbycolon(ntelements, 0, nttag1, "last-child", "") == true { t.Errorf("expected false") } if filterbycolon(ntelements, 1, nttag2, "last-child", "") == false { t.Errorf("expected true") } if filterbycolon(nil, 0, htmlroot, "last-of-type", "") == false { t.Errorf("expected true") } if filterbycolon(ntelements, 0, nttag1, "last-of-type", "") == true { t.Errorf("expected false") } if filterbycolon(ntelements, 1, nttag2, "last-of-type", "") == false { t.Errorf("expected true") } if filterbycolon(nil, 0, htmlroot, "nth-child", "(0)") == false { t.Errorf("expected true") } if filterbycolon(ntelements, 0, nttag1, "nth-child", "(0)") == false { t.Errorf("expected true") } if filterbycolon(ntelements, 1, nttag2, "nth-child", "(0)") == true { t.Errorf("expected false") } if filterbycolon(nil, 0, htmlroot, "nth-of-type", "(0)") == false { t.Errorf("expected true") } if filterbycolon(ntelements, 0, nttag1, "nth-of-type", "(0)") == false { t.Errorf("expected true") } if filterbycolon(ntelements, 1, nttag2, "nth-of-type", "(0)") == true { t.Errorf("expected false") } if filterbycolon(nil, 0, htmlroot, "nth-last-child", "(0)") == false { t.Errorf("expected true") } if filterbycolon(ntelements, 0, nttag1, "nth-last-child", "(0)") == true { t.Errorf("expected false") } if filterbycolon(ntelements, 1, nttag2, "nth-last-child", "(0)") == false { t.Errorf("expected true") } if filterbycolon(nil, 0, htmlroot, "nth-last-of-type", "(0)") == false { t.Errorf("expected true") } if filterbycolon(ntelements, 0, nttag1, "nth-last-of-type", "(0)") == true { t.Errorf("expected false") } if filterbycolon(ntelements, 1, nttag2, "nth-last-of-type", "(0)") == false { t.Errorf("expected true") } if filterbycolon(nil, 0, htmlroot, "only-of-type", "") == false { t.Errorf("expected true") } if filterbycolon(nttagstart, 0, termot, "only-of-type", "") == false { t.Errorf("expected true") } if filterbycolon(ntelements, 0, nttag1, "only-of-type", "") == true { t.Errorf("expected false") } if filterbycolon(nil, 0, htmlroot, "only-child", "") == false { t.Errorf("expected true") } if filterbycolon(nttagstart, 0, termot, "only-child", "") == true { t.Errorf("expected false") } } func TestAstwalk1(t *testing.T) { html := []byte("<a></a>") htmlast := NewAST("html", 100) htmlast.Parsewith(makeexacthtmly(htmlast), NewScanner(html)) // test with "*" ch := make(chan Queryable, 1000) htmlast.Query("*", ch) items := []Queryable{} for item := range ch { items = append(items, item) } if len(items) != 12 { t.Errorf("unexpected %v", len(items)) } refs := []string{ "tag <a></a>", "tagstart <a>", "OT <", "TAG a", "attributes", "CT >", "elements", "tagend </a>", "OT <", "SLASH /", "TAG a", "CT >", } for i, item := range items { out := fmt.Sprintln(item.GetName(), item.GetValue()) out = strings.TrimRight(out, " \n\r") if out != refs[i] { t.Errorf("expected %q, got %q", refs[i], out) } } } func TestAstwalk2(t *testing.T) { html := []byte("<a></a>") htmlast := NewAST("html", 100) htmlast.Parsewith(makeexacthtmly(htmlast), NewScanner(html)) // test with "tag OT" ch := make(chan Queryable, 1000) htmlast.Query("tag OT", ch) items := []Queryable{} for item := range ch { items = append(items, item) } if len(items) != 2 { t.Errorf("unexpected %v", len(items)) } refs := []string{"OT <", "OT <"} for i, item := range items { out := fmt.Sprintln(item.GetName(), item.GetValue()) out = strings.TrimRight(out, " \n\r") if out != refs[i] { t.Errorf("expected %q, got %q", refs[i], out) } } } func TestAstwalk3(t *testing.T) { html := []byte("<a></a>") htmlast := NewAST("html", 100) htmlast.Parsewith(makeexacthtmly(htmlast), NewScanner(html)) // test with "tagstart > CT" ch := make(chan Queryable, 1000) htmlast.Query("tagstart > CT", ch) items := []Queryable{} for item := range ch { items = append(items, item) } if len(items) != 1 { t.Errorf("unexpected %v", len(items)) } refs := []string{"CT >"} for i, item := range items { out := fmt.Sprintln(item.GetName(), item.GetValue()) out = strings.TrimRight(out, " \n\r") if out != refs[i] { t.Errorf("expected %q, got %q", refs[i], out) } } } func TestAstwalk4(t *testing.T) { html := []byte("<a></a>") htmlast := NewAST("html", 100) htmlast.Parsewith(makeexacthtmly(htmlast), NewScanner(html)) // test with "OT + TAG" ch := make(chan Queryable, 1000) htmlast.Query("OT + TAG", ch) items := []Queryable{} for item := range ch { items = append(items, item) } if len(items) != 1 { t.Errorf("unexpected %v", len(items)) } refs := []string{"TAG a"} for i, item := range items { out := fmt.Sprintln(item.GetName(), item.GetValue()) out = strings.TrimRight(out, " \n\r") if out != refs[i] { t.Errorf("expected %q, got %q", refs[i], out) } } } func TestAstwalk5(t *testing.T) { html := []byte("<a></a>") htmlast := NewAST("html", 100) htmlast.Parsewith(makeexacthtmly(htmlast), NewScanner(html)) // test with "OT ~ TAG" ch := make(chan Queryable, 1000) htmlast.Query("OT ~ TAG", ch) items := []Queryable{} for item := range ch { items = append(items, item) } if len(items) != 2 { t.Errorf("unexpected %v", len(items)) } refs := []string{"TAG a", "TAG a"} for i, item := range items { out := fmt.Sprintln(item.GetName(), item.GetValue()) out = strings.TrimRight(out, " \n\r") if out != refs[i] { t.Errorf("expected %q, got %q", refs[i], out) } } } func TestAstwalk6(t *testing.T) { html := []byte("<a></a>") htmlast := NewAST("html", 100) htmlast.Parsewith(makeexacthtmly(htmlast), NewScanner(html)) // test with "tagstart ~ tagend TAG" ch := make(chan Queryable, 1000) htmlast.Query("tagstart ~ tagend TAG", ch) items := []Queryable{} for item := range ch { items = append(items, item) } if len(items) != 1 { t.Errorf("unexpected %v", len(items)) } refs := []string{"TAG a"} for i, item := range items { out := fmt.Sprintln(item.GetName(), item.GetValue()) out = strings.TrimRight(out, " \n\r") if out != refs[i] { t.Errorf("expected %q, got %q", refs[i], out) } } } func TestAstwalk7(t *testing.T) { html := []byte("<a></a>") htmlast := NewAST("html", 100) htmlast.Parsewith(makeexacthtmly(htmlast), NewScanner(html)) // test with complexpatterns ch := make(chan Queryable, 1000) htmlast.Query("tagstart + elements + tagend TAG + CT", ch) items := []Queryable{} for item := range ch { items = append(items, item) } if len(items) != 1 { t.Errorf("unexpected %v", len(items)) } refs := []string{"CT >", "CT >"} for i, item := range items { out := fmt.Sprintln(item.GetName(), item.GetValue()) out = strings.TrimRight(out, " \n\r") if out != refs[i] { t.Errorf("expected %q, got %q", refs[i], out) } } } func TestAstwalk8(t *testing.T) { html := []byte("<a></a>") htmlast := NewAST("html", 100) htmlast.Parsewith(makeexacthtmly(htmlast), NewScanner(html)) // test case-insensitive ch := make(chan Queryable, 1000) htmlast.Query("tag", ch) items := []Queryable{} for item := range ch { items = append(items, item) } if len(items) != 3 { t.Errorf("unexpected %v", len(items)) } refs := []string{"tag <a></a>", "TAG a", "TAG a"} for i, item := range items { out := fmt.Sprintln(item.GetName(), item.GetValue()) out = strings.TrimRight(out, " \n\r") if out != refs[i] { t.Errorf("expected %q, got %q", refs[i], out) } } } func TestAstwalk9(t *testing.T) { html := []byte("<a></a>") htmlast := NewAST("html", 100) htmlast.Parsewith(makeexacthtmly(htmlast), NewScanner(html)) // test attributes ch := make(chan Queryable, 1000) htmlast.Query("tag[class=term]", ch) items := []Queryable{} for item := range ch { items = append(items, item) } if len(items) != 2 { t.Errorf("unexpected %v", len(items)) } refs := []string{"TAG a", "TAG a"} for i, item := range items { out := fmt.Sprintln(item.GetName(), item.GetValue()) out = strings.TrimRight(out, " \n\r") if out != refs[i] { t.Errorf("expected %q, got %q", refs[i], out) } } } func TestAstwalk10(t *testing.T) { html := []byte("<a></a>") htmlast := NewAST("html", 100) htmlast.Parsewith(makeexacthtmly(htmlast), NewScanner(html)) // test colon names ch := make(chan Queryable, 1000) htmlast.Query("tag > tagstart:first-child", ch) items := []Queryable{} for item := range ch { items = append(items, item) } if len(items) != 1 { t.Errorf("unexpected %v", len(items)) } refs := []string{"tagstart <a>"} for i, item := range items { out := fmt.Sprintln(item.GetName(), item.GetValue()) out = strings.TrimRight(out, " \n\r") if out != refs[i] { t.Errorf("expected %q, got %q", refs[i], out) } } } func TestAstwalk11(t *testing.T) { html := []byte("<a></a>") htmlast := NewAST("html", 100) htmlast.Parsewith(makeexacthtmly(htmlast), NewScanner(html)) // test with "tag[class=term]:nth-child(1)" ch := make(chan Queryable, 1000) htmlast.Query("tag[class=term]:nth-child(1)", ch) items := []Queryable{} for item := range ch { items = append(items, item) } if len(items) != 1 { t.Errorf("unexpected %v", len(items)) } } func TestAstwalkNeg(t *testing.T) { html := []byte("<a></a>") htmlast := NewAST("html", 100) htmlast.Parsewith(makeexacthtmly(htmlast), NewScanner(html)) // test with "tagend ~ tagstart" ch := make(chan Queryable, 1000) htmlast.Query("tagend ~ tagstart", ch) items := []Queryable{} for item := range ch { items = append(items, item) } if len(items) != 0 { t.Errorf("unexpected %v", len(items)) } // test with "tagstart ~ nothing" ch = make(chan Queryable, 1000) htmlast.Query("tagstart ~ nothing", ch) items = []Queryable{} for item := range ch { items = append(items, item) } if len(items) != 0 { t.Errorf("unexpected %v", len(items)) } // test with "tag[class=term]:last-child" ch = make(chan Queryable, 1000) htmlast.Query("tag[class=term]:last-child", ch) items = []Queryable{} for item := range ch { items = append(items, item) } if len(items) != 0 { t.Errorf("unexpected %v", len(items)) } } func validateselterm(t *testing.T, term Queryable, name, value string) { n, ist, v := term.GetName(), term.IsTerminal(), term.GetValue() if n != name { t.Errorf("expected %v, got %v", name, n) panic("") } else if ist != true { t.Errorf("expected %v, got %v", true, ist) panic("") } else if value != v { t.Errorf("expected %v, got %v", value, v) panic("") } } func testdataFile(filename string) []byte { f, err := os.Open(filename) if err != nil { panic(err) } defer f.Close() var data []byte if strings.HasSuffix(filename, ".gz") { gz, err := gzip.NewReader(f) if err != nil { panic(err) } data, err = ioutil.ReadAll(gz) if err != nil { panic(err) } } else { data, err = ioutil.ReadAll(f) if err != nil { panic(err) } } return data } func makehtmlyForSelector(ast *AST) Parser { var tag Parser opentag := AtomExact("<", "OT") closetag := AtomExact(">", "CT") equal := AtomExact("=", "EQUAL") slash := TokenExact("/[ \t]*", "SLASH") tagname := TokenExact("[a-z][a-zA-Z0-9]*", "TAG") attrkey := TokenExact("[a-z][a-zA-Z0-9]*", "ATTRK") text := TokenExact("[^<>]+", "TEXT") ws := TokenExact("[ \t]+", "WS") element := ast.OrdChoice("element", nil, text, &tag) elements := ast.Kleene("elements", nil, element) attr := ast.And("attribute", nil, attrkey, equal, String()) attrws := ast.And("attrws", nil, attr, ast.Maybe("ws", nil, ws)) attrs := ast.Kleene("attributes", nil, attrws) tstart := ast.And("tagstart", nil, opentag, tagname, attrs, closetag) tend := ast.And("tagend", nil, opentag, slash, tagname, closetag) tag = ast.And("tag", nil, tstart, elements, tend) return tag } <|start_filename|>terminal_test.go<|end_filename|> package parsec import "reflect" import "testing" func TestTerminal(t *testing.T) { term := &Terminal{Name: "TERM", Value: "xyz", Position: 2} if term.GetName() != "TERM" { t.Errorf("expected %q, got %q", "TERM", term.GetName()) } else if term.IsTerminal() == false { t.Errorf("expected true") } else if term.GetValue() != "xyz" { t.Errorf("expected %q, got %q", "xyz", term.GetValue()) } else if term.GetChildren() != nil { t.Errorf("expected nil") } else if term.GetPosition() != 2 { t.Errorf("expected %v, got %v", 2, term.GetPosition()) } // check attribute methods. term.SetAttribute("name", "one").SetAttribute("name", "two") term.SetAttribute("key", "one") ref1 := []string{"one", "two"} ref2 := map[string][]string{ "name": {"one", "two"}, "key": {"one"}, } if x := term.GetAttribute("name"); reflect.DeepEqual(x, ref1) == false { t.Errorf("expected %v, got %v", ref1, x) } else if x := term.GetAttributes(); reflect.DeepEqual(x, ref2) == false { t.Errorf("expected %v, got %v", ref2, x) } } func TestMaybeNone(t *testing.T) { mn := MaybeNone("missing") if string(mn) != mn.GetName() { t.Errorf("expected %q, got %q", string(mn), mn.GetName()) } else if mn.IsTerminal() == false { t.Errorf("expected true") } else if mn.GetValue() != "" { t.Errorf("expected %q, got %q", "", mn.GetValue()) } else if mn.GetChildren() != nil { t.Errorf("expected nil") } else if mn.GetPosition() != -1 { t.Errorf("expected %v, got %v", -1, mn.GetPosition()) } // check attribute methods. mn.SetAttribute("name", "one").SetAttribute("name", "two") mn.SetAttribute("key", "one") if x := mn.GetAttribute("name"); x != nil { t.Errorf("unexpected %v", x) } else if x := mn.GetAttributes(); x != nil { t.Errorf("unexpected %v", x) } }
vlthr/goparsec
<|start_filename|>probable_autoclick.js<|end_filename|> (() => { const COOKIES_MODAL_MIN_HEIGHT = 100.0; const buildSelector = (element) => { let currentElement = element; let selectors = []; while (currentElement) { let id; // Selector rule should not start with number if (currentElement.id.trim() && !currentElement.id.trim().match('^\\d')) { id = `#${ currentElement.id.trim() }`; } let selector = id || currentElement.tagName.toLowerCase(); const classes = [ ...currentElement.classList ]; if (classes.length) { selector = `${ selector }.${ classes.join('.') }`; } selectors.unshift(selector); if (currentElement === document.body || currentElement.parentElement && currentElement.parentElement === document.body) { break; } currentElement = currentElement.parentElement; } return selectors; }; const clickElement = (el, selector, tryCount) => { el.click(); // If element still exists maybe it did not work correctly, try again setTimeout(() => document.querySelector(selector) && tryCount < 3 && clickElement(el, selector, tryCount + 1), 250); }; const hasFormAncestor = (element) => { let parent = element.parentElement; let hasForm = false; while(parent) { hasForm = parent instanceof HTMLFormElement if (hasForm) { break; } parent = parent.parentElement; } return hasForm }; const isPossibleAcceptCookies = (element) => { // We don't want to autoclick elements inside forms if (hasFormAncestor(element)) { return null; } // If anchor element, check that is does not have an href that navigates out of the page if (element instanceof HTMLAnchorElement && element.href && !element.href.startsWith('#')) { const href = element.href.replace(document.location.href, ''); if (!href.startsWith('#')) { return null; } } const mustHaveWords = [ 'ok', 'accept', 'yes', 'continue', 'agree', 'allow', 'aceito', 'aceitar', 'sim', 'continuar', 'concordo', 'permitir', 'prosseguir', 'akzeptieren', 'ja', 'weiter', 'zustimmen', 'erlauben', '好的', '接受', '是的', '继续', '同意', '允许', ]; // Since we don't know the order of the element we are testing in the modal // Let's look for the ones with positive words const innerText = element.innerText.toLocaleLowerCase(); if (!mustHaveWords.some((word) => innerText.match(`\\b${ word }\\b`))) { return null; } const highestParent = () => { let parent = element.parentElement; if (parent === document.body) { return null; } while (parent) { if (!parent.parentElement || parent.parentElement === document.body || parent.parentElement.clientHeight === 0) { break; } parent = parent.parentElement; } return parent; }; const parent = highestParent(); const parentInnerText = parent.innerText.toLocaleLowerCase(); const foundCookies = parentInnerText.includes('cookie') || parentInnerText.includes('cookies'); const hasEnoughSize = parent.clientHeight >= COOKIES_MODAL_MIN_HEIGHT; return foundCookies && hasEnoughSize ? element : null; }; const run = () => { const checkElementsIn = (element) => { try { const elements = Array.from(element.querySelectorAll('button, a')); for (let element of elements) { if (isPossibleAcceptCookies(element)) { return element; } } } catch {} }; const buildRuleAndClick = (element) => { if (!element) { return; } const selector = buildSelector(element).join(' > '); clickElement(element, selector, 0); }; const possibleElement = checkElementsIn(document.body); if (possibleElement) { buildRuleAndClick(possibleElement); } else { const observer = new MutationObserver((mutationsList) => { const findPossibleCookie = () => { for(const mutation of mutationsList) { if (mutation.type === 'childList') { const nodes = Array.from(mutation.addedNodes); for (const node of nodes) { const isTarget = node instanceof HTMLButtonElement || node instanceof HTMLAnchorElement; if (isTarget && isPossibleAcceptCookies(node)) { return node; } else if (node.nodeType == Node.ELEMENT_NODE) { const possibleElement = checkElementsIn(node); if (possibleElement) { return possibleElement; } } } } } } const element = findPossibleCookie(); if (element) { buildRuleAndClick(element); observer.disconnect(); } }); observer.observe(document, { childList: true, subtree: true }); setTimeout(() => observer.disconnect(), 10 * 1000); } }; run(); })();
radiochild577/scripts
<|start_filename|>buildcc/lib/target/mock/target/recheck_states.cpp<|end_filename|> #include "target/target.h" #include "expect_target.h" #include "CppUTestExt/MockSupport.h" namespace buildcc::base { static constexpr const char *const SOURCE_REMOVED_FUNCTION = "Target::SourceRemoved"; static constexpr const char *const SOURCE_ADDED_FUNCTION = "Target::SourceAdded"; static constexpr const char *const SOURCE_UPDATED_FUNCTION = "Target::SourceUpdated"; static constexpr const char *const PATH_REMOVED_FUNCTION = "Target::PathRemoved"; static constexpr const char *const PATH_ADDED_FUNCTION = "Target::PathAdded"; static constexpr const char *const PATH_UPDATED_FUNCTION = "Target::PathUpdated"; static constexpr const char *const DIR_CHANGED_FUNCTION = "Target::DirChanged"; static constexpr const char *const FLAG_CHANGED_FUNCTION = "Target::FlagChanged"; static constexpr const char *const EXTERNAL_LIB_CHANGED_FUNCTION = "Target::ExternalLibChanged"; // Source rechecks void Target::SourceRemoved() { mock().actualCall(SOURCE_REMOVED_FUNCTION).onObject(this); } void Target::SourceAdded() { mock().actualCall(SOURCE_ADDED_FUNCTION).onObject(this); } void Target::SourceUpdated() { mock().actualCall(SOURCE_UPDATED_FUNCTION).onObject(this); } // Path rechecks void Target::PathRemoved() { mock().actualCall(PATH_REMOVED_FUNCTION).onObject(this); } void Target::PathAdded() { mock().actualCall(PATH_ADDED_FUNCTION).onObject(this); } void Target::PathUpdated() { mock().actualCall(PATH_UPDATED_FUNCTION).onObject(this); } void Target::DirChanged() { mock().actualCall(DIR_CHANGED_FUNCTION).onObject(this); } void Target::FlagChanged() { mock().actualCall(FLAG_CHANGED_FUNCTION).onObject(this); } void Target::ExternalLibChanged() { mock().actualCall(EXTERNAL_LIB_CHANGED_FUNCTION).onObject(this); } namespace m { void TargetExpect_SourceRemoved(unsigned int calls, Target *target) { mock().expectNCalls(calls, SOURCE_REMOVED_FUNCTION).onObject(target); } void TargetExpect_SourceAdded(unsigned int calls, Target *target) { mock().expectNCalls(calls, SOURCE_ADDED_FUNCTION).onObject(target); } void TargetExpect_SourceUpdated(unsigned int calls, Target *target) { mock().expectNCalls(calls, SOURCE_UPDATED_FUNCTION).onObject(target); } void TargetExpect_PathRemoved(unsigned int calls, Target *target) { mock().expectNCalls(calls, PATH_REMOVED_FUNCTION).onObject(target); } void TargetExpect_PathAdded(unsigned int calls, Target *target) { mock().expectNCalls(calls, PATH_ADDED_FUNCTION).onObject(target); } void TargetExpect_PathUpdated(unsigned int calls, Target *target) { mock().expectNCalls(calls, PATH_UPDATED_FUNCTION).onObject(target); } void TargetExpect_DirChanged(unsigned int calls, Target *target) { mock().expectNCalls(calls, DIR_CHANGED_FUNCTION).onObject(target); } void TargetExpect_FlagChanged(unsigned int calls, Target *target) { mock().expectNCalls(calls, FLAG_CHANGED_FUNCTION).onObject(target); } void TargetExpect_ExternalLibChanged(unsigned int calls, Target *target) { mock().expectNCalls(calls, EXTERNAL_LIB_CHANGED_FUNCTION).onObject(target); } } // namespace m } // namespace buildcc::base <|start_filename|>cmake/tool/clangtidy.cmake<|end_filename|> macro(m_clangtidy) if (${CLANGTIDY}) message("Setting ClangTidy: ON -> ${ARGV0}") set(CMAKE_CXX_CLANG_TIDY clang-tidy -checks=-*,readability-*,portability-*,performance-* --format-style=file) else() message("Setting ClangTidy: OFF -> ${ARGV0}") endif() endmacro() <|start_filename|>example/msvc/StaticLib/src/random.cpp<|end_filename|> #include "random.h" #include <iostream> #include <windows.h> void random_func() { std::cout << __FUNCTION__ << std::endl; } <|start_filename|>example/msvc/DynamicLib/include/random.h<|end_filename|> #pragma once __declspec(dllexport) void random_func(); <|start_filename|>cmake/flags/test_flags.cmake<|end_filename|> set(TEST_COMPILE_FLAGS -g -Og -fprofile-arcs -ftest-coverage -fno-omit-frame-pointer -fno-optimize-sibling-calls -fno-inline -fprofile-abs-path ) set(TEST_LINK_FLAGS -g -Og -fprofile-arcs -ftest-coverage -fprofile-abs-path ) <|start_filename|>buildcc/lib/target/mock/generator/recheck_states.cpp<|end_filename|> #include "target/generator.h" #include "expect_generator.h" #include "CppUTestExt/MockSupport.h" namespace buildcc::base { static constexpr const char *const INPUT_REMOVED_FUNCTION = "Generator::InputRemoved"; static constexpr const char *const INPUT_ADDED_FUNCTION = "Generator::InputAdded"; static constexpr const char *const INPUT_UPDATED_FUNCTION = "Generator::InputUpdated"; static constexpr const char *const OUTPUT_CHANGED_FUNCTION = "Generator::OutputChanged"; static constexpr const char *const COMMAND_CHANGED_FUNCTION = "Generator::CommandChanged"; void Generator::InputRemoved() { mock().actualCall(INPUT_REMOVED_FUNCTION).onObject(this); } void Generator::InputAdded() { mock().actualCall(INPUT_ADDED_FUNCTION).onObject(this); } void Generator::InputUpdated() { mock().actualCall(INPUT_UPDATED_FUNCTION).onObject(this); } void Generator::OutputChanged() { mock().actualCall(OUTPUT_CHANGED_FUNCTION).onObject(this); } void Generator::CommandChanged() { mock().actualCall(COMMAND_CHANGED_FUNCTION).onObject(this); } namespace m { void GeneratorExpect_InputRemoved(unsigned int calls, Generator *generator) { mock().expectNCalls(calls, INPUT_REMOVED_FUNCTION).onObject(generator); } void GeneratorExpect_InputAdded(unsigned int calls, Generator *generator) { mock().expectNCalls(calls, INPUT_ADDED_FUNCTION).onObject(generator); } void GeneratorExpect_InputUpdated(unsigned int calls, Generator *generator) { mock().expectNCalls(calls, INPUT_UPDATED_FUNCTION).onObject(generator); } void GeneratorExpect_OutputChanged(unsigned int calls, Generator *generator) { mock().expectNCalls(calls, OUTPUT_CHANGED_FUNCTION).onObject(generator); } void GeneratorExpect_CommandChanged(unsigned int calls, Generator *generator) { mock().expectNCalls(calls, COMMAND_CHANGED_FUNCTION).onObject(generator); } } // namespace m } // namespace buildcc::base <|start_filename|>cmake/target/spdlog.cmake<|end_filename|> # set(SPDLOG_BUILD_SHARED ON CACHE BOOL "Spdlog built as dynamic library") set(SPDLOG_INSTALL ON CACHE BOOL "Spdlog install") set(SPDLOG_FMT_EXTERNAL OFF CACHE BOOL "Spdlog FMT external lib") set(SPDLOG_FMT_EXTERNAL_HO ON CACHE BOOL "Spdlog FMT header only external lib") set(SPDLOG_ENABLE_PCH ${BUILDCC_PRECOMPILE_HEADERS} CACHE BOOL "Spdlog PCH") add_subdirectory(third_party/spdlog) # TODO, Remove spdlog library generation and install target # set_target_properties(spdlog PROPERTIES EXCLUDE_FROM_ALL ON) <|start_filename|>example/hybrid/foolib/src/foo.cpp<|end_filename|> #include "foo.h" #include <iostream> EXPORT void vFoo() { std::cout << __FUNCTION__ << std::endl; } EXPORT int iFoo() { std::cout << __FUNCTION__ << std::endl; return 11; } EXPORT float fFoo(int integer) { std::cout << __FUNCTION__ << std::endl; return (integer * 1.1); } <|start_filename|>buildcc/lib/env/mock/logging.cpp<|end_filename|> #include "env/logging.h" // Stubs namespace buildcc::env { // Called by user only void set_log_pattern(std::string_view pattern) { (void)pattern; } void set_log_level(LogLevel level) { (void)level; } // Called by user and program // Not needed to be mocked void log(LogLevel level, std::string_view tag, std::string_view message) { (void)level; (void)message; (void)tag; } void log_trace(std::string_view tag, std::string_view message) { (void)message; (void)tag; } void log_debug(std::string_view tag, std::string_view message) { (void)message; (void)tag; } void log_info(std::string_view tag, std::string_view message) { (void)message; (void)tag; } void log_warning(std::string_view tag, std::string_view message) { (void)message; (void)tag; } void log_critical(std::string_view tag, std::string_view message) { (void)message; (void)tag; } } // namespace buildcc::env <|start_filename|>buildcc/lib/target/test/target/data/foo_main.cpp<|end_filename|> #include <iostream> #include "foo.h" int main() { std::cout << "hello world\r\n"; vFoo(); return 0; } <|start_filename|>example/hybrid/foolib/src/foo.h<|end_filename|> #pragma once #ifdef _WIN32 #include <windows.h> #define EXPORT __declspec(dllexport) #else #define EXPORT #endif EXPORT void vFoo(); EXPORT int iFoo(); EXPORT float fFoo(int integer); <|start_filename|>cmake/coverage/gcovr.cmake<|end_filename|> find_program(gcovr_program NAMES "gcovr" ) if(${gcovr_program} STREQUAL "gcovr_program-NOTFOUND") message("GCOVR not found, removing 'gcovr_coverage' target") else() message("GCOVR at ${gcovr_program}") set(GCOVR_REMOVE_OPTIONS --exclude "(.+/)?flatbuffers(.+/)?" --exclude "(.+/)?spdlog(.+/)?" --exclude "(.+/)?fmt(.+/)?" --exclude "(.+/)?taskflow(.+/)?" --exclude "(.+/)?CLI11(.+/)?" --exclude "(.+/)?CppUTest(.+/)?" --exclude "(.+/)?CppUTestExt(.+/)?" --exclude "(.+/)?mock(.+/)?" --exclude "(.+/)?generated(.+/)?" --exclude "(.+/)?test(.+/)?" ) # TODO, Update file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/gcovr_coverage) set(GCOVR_VERBOSE -v -s) set(GCOVR_UNNECESSARY_ARCS --exclude-unreachable-branches --exclude-throw-branches ) set(GCOVR_SEARCH_PATHS ${CMAKE_CURRENT_BINARY_DIR} ) add_custom_target(gcovr_coverage COMMAND cmake --build ${CMAKE_BINARY_DIR} COMMAND cmake --build ${CMAKE_BINARY_DIR} --target test COMMAND ${gcovr_program} -r ${CMAKE_CURRENT_SOURCE_DIR} --html-details ${CMAKE_BINARY_DIR}/gcovr_coverage/gcovr.html ${GCOVR_VERBOSE} ${GCOVR_UNNECESSARY_ARCS} ${GCOVR_REMOVE_OPTIONS} -j 12 ${GCOVR_SEARCH_PATHS} VERBATIM USES_TERMINAL ) endif() <|start_filename|>cmake/target/cli11.cmake<|end_filename|> add_subdirectory(third_party/CLI11) file(GLOB CLI_INCLUDE_HEADERS "${CLI11_SOURCE_DIR}/include/CLI/*.hpp") if (${BUILDCC_INSTALL}) install(TARGETS CLI11 DESTINATION lib EXPORT CLI11Config) install(FILES ${CLI_INCLUDE_HEADERS} DESTINATION "include/CLI") install(EXPORT CLI11Config DESTINATION "lib/cmake/CLI11") endif() <|start_filename|>cmake/tool/cppcheck.cmake<|end_filename|> if(${BUILDCC_CPPCHECK}) file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/cppcheck_output) set(CPPCHECK_ENABLE --enable=all) set(CPPCHECK_PATH_SUPPRESS --suppress=*:*test/* --suppress=*:*mock/* ) set(CPPCHECK_TAG_SUPPRESS --suppress=missingInclude --suppress=unusedFunction --suppress=unmatchedSuppression ) set(CPPCHECK_ADDITIONAL_OPTIONS --std=c++17 -q --error-exitcode=1 --cppcheck-build-dir=${CMAKE_CURRENT_BINARY_DIR}/cppcheck_output ) set(CPPCHECK_CHECK_DIR ${CMAKE_CURRENT_SOURCE_DIR}/buildcc ) add_custom_target(cppcheck_static_analysis COMMAND cppcheck ${CPPCHECK_ENABLE} ${CPPCHECK_PATH_SUPPRESS} ${CPPCHECK_TAG_SUPPRESS} ${CPPCHECK_ADDITIONAL_OPTIONS} ${CPPCHECK_CHECK_DIR} COMMENT "Cppcheck Static Analysis" VERBATIM USES_TERMINAL ) endif() <|start_filename|>cmake/target/fmt.cmake<|end_filename|> set(FMT_INSTALL ON CACHE BOOL "Fmt install") add_subdirectory(third_party/fmt) # TODO, Remove fmt library generation and install target # set_target_properties(fmt PROPERTIES EXCLUDE_FROM_ALL ON) <|start_filename|>buildcc/lib/target/test/target/data/foo/foo.cpp<|end_filename|> #include "foo.h" #include <iostream> void vFoo() { std::cout << __FUNCTION__ << std::endl; } <|start_filename|>cmake/target/taskflow.cmake<|end_filename|> set(TF_BUILD_TESTS OFF CACHE BOOL "TF Tests") set(TF_BUILD_EXAMPLES OFF CACHE BOOL "TF Examples") add_subdirectory(third_party/taskflow) <|start_filename|>buildcc/plugins/test/test_buildcc_find.cpp<|end_filename|> #include "plugins/buildcc_find.h" // NOTE, Make sure all these includes are AFTER the system and header includes #include "CppUTest/CommandLineTestRunner.h" #include "CppUTest/MemoryLeakDetectorNewMacros.h" #include "CppUTest/TestHarness.h" #include "CppUTest/Utest.h" // clang-format off TEST_GROUP(PluginsTestGroup) { }; // clang-format on TEST(PluginsTestGroup, BuildccFind_Search) { buildcc::plugin::BuildccFind findcmake( "cmake", buildcc::plugin::BuildccFind::Type::HostExecutable, {"PATH"}); bool found = findcmake.Search(); CHECK_TRUE(found); const std::vector<fs::path> &matches = findcmake.GetPathMatches(); CHECK_TRUE(!matches.empty()); } TEST(PluginsTestGroup, BuildccFind_BadEnv) { buildcc::plugin::BuildccFind findrandomenv( "cmake", buildcc::plugin::BuildccFind::Type::HostExecutable, {"FIND_RANDOM_ENV"}); bool found = findrandomenv.Search(); CHECK_FALSE(found); const std::vector<fs::path> &matches = findrandomenv.GetPathMatches(); CHECK_TRUE(matches.empty()); } TEST(PluginsTestGroup, BuildccFind_WrongExecutable) { buildcc::plugin::BuildccFind findrandomexecutable( "random_cmake_executable", buildcc::plugin::BuildccFind::Type::HostExecutable, {"FIND_RANDOM_ENV"}); bool found = findrandomexecutable.Search(); CHECK_FALSE(found); const std::vector<fs::path> &matches = findrandomexecutable.GetPathMatches(); CHECK_TRUE(matches.empty()); } TEST(PluginsTestGroup, BuildccFind_SearchUnimplemented) { { buildcc::plugin::BuildccFind findunimplemented( "random_library", buildcc::plugin::BuildccFind::Type::BuildccLibrary); bool found = findunimplemented.Search(); CHECK_FALSE(found); const std::vector<fs::path> &matches = findunimplemented.GetPathMatches(); CHECK_TRUE(matches.empty()); } { buildcc::plugin::BuildccFind findunimplemented( "random_library", buildcc::plugin::BuildccFind::Type::BuildccPlugin); bool found = findunimplemented.Search(); CHECK_FALSE(found); const std::vector<fs::path> &matches = findunimplemented.GetPathMatches(); CHECK_TRUE(matches.empty()); } } int main(int ac, char **av) { return CommandLineTestRunner::RunAllTests(ac, av); } <|start_filename|>example/hybrid/pch/files/pch/pch_cpp.h<|end_filename|> #ifndef PCH_CPP_H_ #define PCH_CPP_H_ #include <iostream> #include <math.h> #include "random.h" #endif <|start_filename|>example/hybrid/pch/files/pch/pch_c.h<|end_filename|> #ifndef PCH_C_H_ #define PCH_C_H_ #include <math.h> #include <stdio.h> #endif <|start_filename|>cmake/flags/build_flags.cmake<|end_filename|> if(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU") set(BUILD_COMPILE_FLAGS -Wall -Wextra) set(BUILD_LINK_FLAGS ) # TODO, Add other compiler flags here endif() <|start_filename|>cmake/target/flatbuffers.cmake<|end_filename|> # TODO, Update FLATBUFFERS option to conditionally compile FLATC # Set flatbuffer specific options here set(FLATBUFFERS_BUILD_CPP17 ON CACHE BOOL "Flatbuffers C++17 support") set(FLATBUFFERS_BUILD_TESTS OFF CACHE BOOL "Flatbuffers build tests") set(FLATBUFFERS_BUILD_FLATC ${BUILDCC_FLATBUFFERS_FLATC} CACHE BOOL "Flatbuffers build flatc") set(FLATBUFFERS_BUILD_FLATHASH OFF CACHE BOOL "Flatbuffers build flathash") set(FLATBUFFERS_BUILD_FLATLIB OFF CACHE BOOL "Flatbuffers build flatlib") set(FLATBUFFERS_LIBCXX_WITH_CLANG OFF CACHE BOOL "Flatbuffers LIBCXX") set(FLATBUFFERS_INSTALL ON CACHE BOOL "Enable the installation of targets.") set(FLATBUFFERS_ENABLE_PCH ${BUILDCC_PRECOMPILE_HEADERS} CACHE BOOL "Flatbuffers PCH") add_subdirectory(third_party/flatbuffers) set(FBS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/third_party/flatbuffers/include/flatbuffers") set(FBS_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/third_party/flatbuffers/include") file(GLOB FLATBUFFERS_INCLUDE_HEADERS "${FBS_DIR}/*.h") if(${BUILDCC_PRECOMPILE_HEADERS}) list(APPEND FLATBUFFERS_INCLUDE_HEADERS ${FBS_DIR}/pch/pch.h) endif() add_library(flatbuffers_header_only INTERFACE ${FLATBUFFERS_INCLUDE_HEADERS} ) target_include_directories(flatbuffers_header_only INTERFACE $<BUILD_INTERFACE:${FBS_INCLUDE_DIR}> $<INSTALL_INTERFACE:include> ) if (${BUILDCC_INSTALL}) install(TARGETS flatbuffers_header_only DESTINATION lib EXPORT flatbuffers_header_onlyConfig) install(DIRECTORY ${FBS_INCLUDE_DIR} DESTINATION "include") install(EXPORT flatbuffers_header_onlyConfig DESTINATION "lib/cmake/flatbuffers_header_only") endif() <|start_filename|>example/hybrid/foolib/main.cpp<|end_filename|> #include <iostream> #include "foo.h" int main() { vFoo(); std::cout << iFoo() << std::endl; std::cout << fFoo(11) << std::endl; return 0; } <|start_filename|>example/hybrid/pch/files/src/random.cpp<|end_filename|> #include "pch_cpp.h" void random_print() { std::cout << __FUNCTION__ << std::endl; } <|start_filename|>example/msvc/StaticLib/include/random.h<|end_filename|> #pragma once void random_func(); <|start_filename|>buildcc/lib/env/mock/assert_fatal.cpp<|end_filename|> #include "env/assert_fatal.h" #include <exception> namespace buildcc::env { [[noreturn]] void assert_handle_fatal() { throw std::exception(); } } // namespace buildcc::env <|start_filename|>buildcc/lib/target/test/target/data/include_header.cpp<|end_filename|> #include "include_header.h" <|start_filename|>example/gcc/Simple/Simple.exe.json<|end_filename|> { "name": "Simple.exe", "relative_path": "D:/Repositories/build_in_cpp/example/Simple", "toolchain": { "name": "gcc", "c_compiler": "gcc", "cpp_compiler": "g++" }, "source_files": [ { "filename": "D:/Repositories/build_in_cpp/example/Simple\\main.cpp", "last_write_timestamp": 132580300330166413 } ] } <|start_filename|>example/hybrid/simple/files/include/random.h<|end_filename|> #pragma once void random_print(); <|start_filename|>buildcc/lib/target/cmake/target_install.cmake<|end_filename|> if (${BUILDCC_INSTALL}) if(${BUILDCC_BUILD_AS_INTERFACE}) install(TARGETS target DESTINATION lib EXPORT targetConfig) install(EXPORT targetConfig DESTINATION "${BUILDCC_INSTALL_LIB_PREFIX}/target") endif() install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/ DESTINATION "${BUILDCC_INSTALL_HEADER_PREFIX}") endif() <|start_filename|>example/hybrid/custom_target/src/foo.h<|end_filename|> #pragma once void vFoo(); int iFoo(); float fFoo(int integer); <|start_filename|>buildcc/lib/args/mock/parse.cpp<|end_filename|> #include "args/args.h" #include "env/assert_fatal.h" namespace buildcc { void Args::Parse(int argc, const char *const *argv) { try { app_.parse(argc, argv); } catch (const CLI::ParseError &e) { env::assert_fatal<false>(e.what()); } } } // namespace buildcc <|start_filename|>example/msvc/StaticLib/src/main.cpp<|end_filename|> #include <iostream> #include "random.h" int main() { std::cout << "Hello World from test" << std::endl; random_func(); return 0; } <|start_filename|>cmake/target/tpl.cmake<|end_filename|> add_subdirectory(third_party/tiny-process-library) if (${BUILDCC_INSTALL}) install(TARGETS tiny-process-library EXPORT tiny-process-library-config ARCHIVE DESTINATION lib LIBRARY DESTINATION lib RUNTIME DESTINATION bin) install(EXPORT tiny-process-library-config FILE tiny-process-library-config.cmake NAMESPACE tiny-process-library:: DESTINATION lib/cmake/tiny-process-library ) install(FILES third_party/tiny-process-library/process.hpp DESTINATION include) endif() <|start_filename|>cmake/target/cpputest.cmake<|end_filename|> set(C++11 ON CACHE BOOL "CppUTests C++11 support") set(CPPUTEST_FLAGS OFF CACHE BOOL "CppUTests Flags off") set(WERROR ON CACHE BOOL "CppUTests all errors") set(LONGLONG ON CACHE BOOL "CppUTests Long Long support") set(TESTS OFF CACHE BOOL "CppUTests tests off") set(TESTS_BUILD_DISCOVER OFF CACHE BOOL "CppUTests Tests discover") set(VERBOSE_CONFIG OFF CACHE BOOL "Config print to screen") add_subdirectory(third_party/cpputest) <|start_filename|>example/hybrid/simple/files/src/random.cpp<|end_filename|> #include "random.h" #include <iostream> void random_print() { std::cout << __FUNCTION__ << std::endl; } <|start_filename|>buildcc/lib/target/test/target/data/foo/foo.h<|end_filename|> #pragma once void vFoo();
d-winsor/build_in_cpp
<|start_filename|>assets/plugins/tui/code-snippet/domEvent/on.js<|end_filename|> /** * @fileoverview Bind DOM events * @author NHN FE Development Lab <<EMAIL>> */ 'use strict'; var isString = require('../type/isString'); var forEach = require('../collection/forEach'); var safeEvent = require('./_safeEvent'); /** * Bind DOM events. * @param {HTMLElement} element - element to bind events * @param {(string|object)} types - Space splitted events names or eventName:handler object * @param {(function|object)} handler - handler function or context for handler method * @param {object} [context] context - context for handler method. * @memberof module:domEvent * @example * var div = document.querySelector('div'); * * // Bind one event to an element. * on(div, 'click', toggle); * * // Bind multiple events with a same handler to multiple elements at once. * // Use event names splitted by a space. * on(div, 'mouseenter mouseleave', changeColor); * * // Bind multiple events with different handlers to an element at once. * // Use an object which of key is an event name and value is a handler function. * on(div, { * keydown: highlight, * keyup: dehighlight * }); * * // Set a context for handler method. * var name = 'global'; * var repository = {name: 'CodeSnippet'}; * on(div, 'drag', function() { * console.log(this.name); * }, repository); * // Result when you drag a div: "CodeSnippet" */ function on(element, types, handler, context) { if (isString(types)) { forEach(types.split(/\s+/g), function(type) { bindEvent(element, type, handler, context); }); return; } forEach(types, function(func, type) { bindEvent(element, type, func, handler); }); } /** * Bind DOM events * @param {HTMLElement} element - element to bind events * @param {string} type - events name * @param {function} handler - handler function or context for handler method * @param {object} [context] context - context for handler method. * @private */ function bindEvent(element, type, handler, context) { /** * Event handler * @param {Event} e - event object */ function eventHandler(e) { handler.call(context || element, e || window.event); } if ('addEventListener' in element) { element.addEventListener(type, eventHandler); } else if ('attachEvent' in element) { element.attachEvent('on' + type, eventHandler); } memorizeHandler(element, type, handler, eventHandler); } /** * Memorize DOM event handler for unbinding. * @param {HTMLElement} element - element to bind events * @param {string} type - events name * @param {function} handler - handler function that user passed at on() use * @param {function} wrappedHandler - handler function that wrapped by domevent for implementing some features * @private */ function memorizeHandler(element, type, handler, wrappedHandler) { var events = safeEvent(element, type); var existInEvents = false; forEach(events, function(obj) { if (obj.handler === handler) { existInEvents = true; return false; } return true; }); if (!existInEvents) { events.push({ handler: handler, wrappedHandler: wrappedHandler }); } } module.exports = on; <|start_filename|>assets/plugins/tui/code-snippet/index.js<|end_filename|> /** * TOAST UI Code Snippet * @author NHN FE Development Lab <<EMAIL>> */ 'use strict'; require('./ajax'); require('./array/inArray'); require('./array/range'); require('./array/zip'); require('./browser/browser'); require('./collection/forEach'); require('./collection/forEachArray'); require('./collection/forEachOwnProperties'); require('./collection/pluck'); require('./collection/toArray'); require('./customEvents/customEvents'); require('./defineClass/defineClass'); require('./domEvent/getMouseButton'); require('./domEvent/getMousePosition'); require('./domEvent/getTarget'); require('./domEvent/off'); require('./domEvent/on'); require('./domEvent/once'); require('./domEvent/preventDefault'); require('./domEvent/stopPropagation'); require('./domUtil/addClass'); require('./domUtil/closest'); require('./domUtil/css'); require('./domUtil/disableTextSelection'); require('./domUtil/enableTextSelection'); require('./domUtil/getClass'); require('./domUtil/getData'); require('./domUtil/hasClass'); require('./domUtil/matches'); require('./domUtil/removeClass'); require('./domUtil/removeData'); require('./domUtil/removeElement'); require('./domUtil/setData'); require('./domUtil/template'); require('./domUtil/toggleClass'); require('./enum/enum'); require('./formatDate/formatDate'); require('./inheritance/createObject'); require('./inheritance/inherit'); require('./object/extend'); require('./object/pick'); require('./request/imagePing'); require('./request/sendHostname'); require('./string/decodeHTMLEntity'); require('./string/encodeHTMLEntity'); require('./tricks/debounce'); require('./tricks/throttle'); require('./type/isArguments'); require('./type/isArray'); require('./type/isArraySafe'); require('./type/isBoolean'); require('./type/isBooleanSafe'); require('./type/isDate'); require('./type/isDateSafe'); require('./type/isEmpty'); require('./type/isExisty'); require('./type/isFalsy'); require('./type/isFunction'); require('./type/isFunctionSafe'); require('./type/isHTMLNode'); require('./type/isHTMLTag'); require('./type/isNotEmpty'); require('./type/isNull'); require('./type/isNumber'); require('./type/isNumberSafe'); require('./type/isObject'); require('./type/isString'); require('./type/isStringSafe'); require('./type/isTruthy'); require('./type/isUndefined'); <|start_filename|>assets/plugins/tui/code-snippet/test/template.spec.js<|end_filename|> 'use strict'; var template = require('../domUtil/template'); describe('{{expression}}', function() { it('should bind expressions with the context.', function() { var source = '<div class="{{className}}"><p>{{content}}</p></div>'; var context = { className: 'container', content: 'Hello, world!' }; expect(template(source, context)).toBe('<div class="container"><p>Hello, world!</p></div>'); source = '<span>{{ content }}</span>'; expect(template(source, context)).toBe('<span>Hello, world!</span>'); source = '<h3>{{title}}</h3>'; expect(template(source, context)).toBe('<h3></h3>'); }); it('should bind with number if value is a number.', function() { expect(template('<p>{{ 3 }}</p>', {})).toBe('<p>3</p>'); expect(template('<p>{{123.4567}}</p>', {})).toBe('<p>123.4567</p>'); expect(template('<p>{{-1}}</p>', {})).toBe('<p>-1</p>'); expect(template('<p>{{-0}}</p>', {})).toBe('<p>0</p>'); expect(template('<p>{{-123.4567}}</p>', {})).toBe('<p>-123.4567</p>'); }); it('should access the value with brackets if value is an object or array.', function() { expect(template('<p>{{ arr[2] }}</p>', {arr: [0, 1, 2]})).toBe('<p>2</p>'); expect(template('<p>{{obj["key"]}}</p>', {obj: {key: 'value'}})).toBe('<p>value</p>'); expect(template('<p>{{obj[name]}}</p>', { obj: {key: 'value'}, name: 'key' })).toBe('<p>value</p>'); expect(template('{{each nums}}{{nums[@index]}}{{/each}}', {nums: [1, 2, 3]})).toBe('123'); }); it('should access the value with dots if value is an object.', function() { expect(template('<p>{{obj.key}}</p>', {obj: {key: 'value'}})).toBe('<p>value</p>'); }); it('should bind with boolean if value is "true" or "false".', function() { expect(template('<p>{{ false }}</p>', {})).toBe('<p>false</p>'); expect(template('<p>{{true}}</p>', {})).toBe('<p>true</p>'); }); it('should bind with string if value is string with quotes.', function() { var context = { sayHello: function(name) { return 'Hello, ' + name; } }; expect(template('<p>{{ sayHello "CodeSnippet" }}</p>', context)).toBe('<p>Hello, CodeSnippet</p>'); expect(template('<p>{{sayHello \'world\'}}</p>', context)).toBe('<p>Hello, world</p>'); }); }); describe('{{helper arg1 arg2}}', function() { it('should execute a custom helper function with arguments.', function() { var source = '<div class="{{getClassNamesByStatus disabled prefix}}"></div><div class="{{getClassNamesByStatus enabled}}"></div>'; var context = { disabled: true, enabled: false, prefix: 'item-', getClassNamesByStatus: function(disabled, prefix) { return disabled ? prefix + 'disabled' : ''; } }; expect(template(source, context)).toBe('<div class="item-disabled"></div><div class=""></div>'); source = '<p>{{getZero}}</p>'; context = { getZero: function() { return '0'; } }; expect(template(source, context)).toBe('<p>0</p>'); }); it('should bind with the first expression if passed helper is not a function.', function() { var source = '<h1>{{notFunction notArg1 notArg2}}</h1>'; var context = { notFunction: 'it is not a function', notArg1: 'it is not an argument1' }; expect(template(source, context)).toBe('<h1>it is not a function</h1>'); source = '<h2>{{notFunction notArg1 notArg2}}</h2>'; context = {}; expect(template(source, context)).toBe('<h2></h2>'); }); }); describe('block helper', function() { it('should throw an error when endblock is missing.', function() { expect(function() { return template('{{if 1}}', {}); }).toThrowError('if needs {{/if}} expression.'); expect(function() { return template('{{each arr}}', {}); }).toThrowError('each needs {{/each}} expression.'); expect(function() { return template('{{with 1 as one}}', {}); }).toThrowError('with needs {{/with}} expression.'); }); }); describe('{{if ...}} {{elseif ...}} {{else}} ... {{/if}}', function() { it('should use if expression as a helper function.', function() { var source = '<div>{{if content}}<p>{{content}}</p>{{/if}}</div>'; expect(template(source, {content: 'Hello, world!'})).toBe('<div><p>Hello, world!</p></div>'); expect(template(source, {content: ''})).toBe('<div></div>'); expect(template(source, {})).toBe('<div></div>'); source = '{{if content}}<p>Hello, world!</p>{{/if}}'; expect(template(source, {content: true})).toBe('<p>Hello, world!</p>'); expect(template(source, {})).toBe(''); source = '{{if equals two 2}}<p>Hello, world!</p>{{/if}}'; expect(template(source, { two: 2, equals: function(a, b) { return a === b; } })).toBe('<p>Hello, world!</p>'); }); it('should use elseif, else expression.', function() { var source = '<p>{{if equals n 1}}one{{else}}other{{/if}}</p>'; var context = { equals: function(a, b) { return a === b; } }; context.n = 0; expect(template(source, context)).toBe('<p>other</p>'); context.n = 1; expect(template(source, context)).toBe('<p>one</p>'); source = '<p>{{if equals n 1}}{{n}} is one{{ elseif equals n 2 }}{{n}} is two{{else}}{{n}} is other{{/if}}</p>'; context.n = 1; expect(template(source, context)).toBe('<p>1 is one</p>'); context.n = 4; expect(template(source, context)).toBe('<p>4 is other</p>'); context.n = 2; expect(template(source, context)).toBe('<p>2 is two</p>'); }); it('should use each expression in the if expression.', function() { var source = '<p>{{if isNumber arr[0]}}Number: {{each arr}}{{@this}}{{/each}}{{elseif isString arr[0]}}String: {{each arr}}{{@this}}{{/each}}{{else}}Nothing{{/if}}</p>'; var context = { isNumber: function(n) { return typeof n === 'number'; }, isString: function(c) { return typeof c === 'string'; } }; context.arr = [1, 2, 3]; expect(template(source, context)).toBe('<p>Number: 123</p>'); context.arr = ['a', 'b', 'c']; expect(template(source, context)).toBe('<p>String: abc</p>'); context.arr = []; expect(template(source, context)).toBe('<p>Nothing</p>'); }); it('should use if expressions in the if expression.', function() { var source = '{{if true}}It is {{if false}}False{{else}}True{{/if}}{{/if}}'; var context = {}; expect(template(source, context)).toBe('It is True'); source = 'It is {{if smaller n 5}}smaller than 5 and {{if equals n 2 }}same as 2 {{else}}not same as 2 and {{if equals n 3}}same as 3 {{/if}}{{/if}}{{else}}bigger than 5 and {{if equals n 5}}same as 5 {{else}}not same as 5 {{/if}}{{/if}}'; context = { smaller: function(a, b) { return a < b; }, equals: function(a, b) { return a === b; }, n: 3 }; expect(template(source, context)).toBe('It is smaller than 5 and not same as 2 and same as 3 '); }); }); describe('{{each ...}} @this @index @key {{/each}}', function() { it('should use each expression as a helper function.', function() { var source = '{{each alphabets}}<p>{{content}}</p>{{/each}}'; expect(template(source, { alphabets: ['A', 'B', 'C'], content: 'Paragraph' })).toBe('<p>Paragraph</p><p>Paragraph</p><p>Paragraph</p>'); source = '{{each alphabets}}<p>{{@index}}</p>{{/each}}'; expect(template(source, { alphabets: ['A', 'B', 'C'] })).toBe('<p>0</p><p>1</p><p>2</p>'); source = '{{each alphabets}}<p>{{@this}}</p>{{/each}}'; expect(template(source, { alphabets: ['A', 'B', 'C'] })).toBe('<p>A</p><p>B</p><p>C</p>'); source = '{{each alphabets}}<p>{{@key}}: {{@this}}</p>{{/each}}'; expect(template(source, { alphabets: { 'A': '1st', 'B': '2nd', 'C': '3rd' } })).toBe('<p>A: 1st</p><p>B: 2nd</p><p>C: 3rd</p>'); source = '{{each getPositiveNumbersSmallerThanFive 3}}<p>{{@this}}</p>{{/each}}'; expect(template(source, { getPositiveNumbersSmallerThanFive: function(n) { return [1, 2, 3, 4, 5].slice(0, n); } })).toBe('<p>1</p><p>2</p><p>3</p>'); }); it('should use if expression in the each expression.', function() { var source = '{{each numbers}}<p>{{@this}}{{if equals @this 2}} is even{{elseif equals @this 0}} is zero{{else}} is odd{{/if}}</p>{{/each}}'; expect(template(source, { numbers: [1, 2, 0], equals: function(a, b) { return parseInt(a, 10) === parseInt(b, 10); } })).toBe('<p>1 is odd</p><p>2 is even</p><p>0 is zero</p>'); }); it('should use each expressions in the each expression.', function() { var source = '{{each first}}{{each second}}{{@this}}{{/each}}{{/each}}'; var context = { first: [1, 2, 3], second: [4, 5, 6] }; expect(template(source, context)).toBe('456456456'); source = '{{each doubleArr}}{{each @this}}{{@this}}{{/each}}{{/each}}'; context = { doubleArr: [[1, 2, 3], [4, 5, 6]] }; expect(template(source, context)).toBe('123456'); }); }); describe('{{with ... as ...}} ... {{/with}}', function() { it('should be make an alias.', function() { var source = '{{with content as c}}<p>{{c}}</p>{{/with}}'; expect(template(source, { content: 'Hello, world!' })).toBe('<p>Hello, world!</p>'); source = '{{with getNumberInEnglish 1 as n}}<p>{{n}}</p>{{/with}}'; expect(template(source, { getNumberInEnglish: function(num) { switch (num) { case 1: return 'one'; default: return 'bigger than one'; } } })).toBe('<p>one</p>'); }); }); <|start_filename|>assets/plugins/tui/code-snippet/tuidoc.config.json<|end_filename|> { "header": { "logo": { "src": "https://uicdn.toast.com/toastui/img/logo-white.png" }, "title": { "text": "Code Snippet", "linkUrl": "https://github.com/nhn/tui.code-snippet" } }, "footer": [ { "title": "NHN", "linkUrl": "https://github.com/nhn" }, { "title": "FE Development Lab", "linkUrl": "https://ui.toast.com/" } ], "main": { "filePath": "README.md" }, "api": { "filePath": ["ajax", "array", "browser", "collection", "customEvents", "defineClass", "domEvent", "domUtil", "enum", "formatDate", "inheritance", "object", "request", "string", "tricks", "type"], "permalink": true }, "examples": false, "pathPrefix": "tui.code-snippet" } <|start_filename|>assets/plugins/tui/code-snippet/webpack.config.js<|end_filename|> /** * Configs file for bundling * @author NHN FE Development Lab <<EMAIL>> */ 'use strict'; var path = require('path'); var pkg = require('./package.json'); var webpack = require('webpack'); var TerserPlugin = require('terser-webpack-plugin'); function getOptimization(isMinified) { if (isMinified) { return { minimizer: [ new TerserPlugin({ cache: true, parallel: true, sourceMap: false, extractComments: false }) ] }; } return { minimize: false }; } module.exports = function(_, argv) { var isMinified = !!argv.minify; var FILENAME = pkg.name + (isMinified ? '.min.js' : '.js'); var BANNER = [ 'TOAST UI Code Snippet', '@version ' + pkg.version, '@author ' + pkg.author, '@license ' + pkg.license ].join('\n'); return { mode: 'production', entry: './index.js', output: { library: ['tui', 'util'], libraryTarget: 'umd', path: path.resolve(__dirname, 'dist'), publicPath: 'dist', filename: FILENAME }, module: { rules: [ { test: /\.m?js$/, exclude: /node_modules/, loader: 'eslint-loader', options: { failOnError: true }, enforce: 'pre' } ] }, plugins: [ new webpack.BannerPlugin(BANNER) ], optimization: getOptimization(isMinified) }; }; <|start_filename|>assets/plugins/tui/code-snippet/test/type.spec.js<|end_filename|> /* eslint-disable no-undef-init */ /* eslint-disable no-undefined */ /* eslint-disable no-new-wrappers */ /* eslint-disable no-new-func */ /* eslint-disable no-new-object */ 'use strict'; var isExisty = require('../type/isExisty'); var isUndefined = require('../type/isUndefined'); var isNull = require('../type/isNull'); var isTruthy = require('../type/isTruthy'); var isFalsy = require('../type/isFalsy'); var isArguments = require('../type/isArguments'); var isArray = require('../type/isArray'); var isObject = require('../type/isObject'); var isFunction = require('../type/isFunction'); var isNumber = require('../type/isNumber'); var isString = require('../type/isString'); var isBoolean = require('../type/isBoolean'); var isArraySafe = require('../type/isArraySafe'); var isFunctionSafe = require('../type/isFunctionSafe'); var isNumberSafe = require('../type/isNumberSafe'); var isStringSafe = require('../type/isStringSafe'); var isBooleanSafe = require('../type/isBooleanSafe'); var isHTMLNode = require('../type/isHTMLNode'); var isHTMLTag = require('../type/isHTMLTag'); var isEmpty = require('../type/isEmpty'); var isNotEmpty = require('../type/isNotEmpty'); var isDate = require('../type/isDate'); var isDateSafe = require('../type/isDateSafe'); describe('type', function() { it('isExisty()', function() { var o1 = null, o2 = 3, o3 = 0, o4 = {}, o5 = false, o6 = isNaN, o7, o8 = ''; expect(isExisty(o1)).toBe(false); expect(isExisty(o2)).toBe(true); expect(isExisty(o3)).toBe(true); expect(isExisty(o4.test)).toBe(false); expect(isExisty(o5)).toBe(true); expect(isExisty(o6)).toBe(true); expect(isExisty(o7)).toBe(false); expect(isExisty(o8)).toBe(true); }); it('isUndefined()', function() { var o1 = 0, o2 = false, o3 = '', o4 = null, o5; expect(isUndefined(o1)).toBe(false); expect(isUndefined(o2)).toBe(false); expect(isUndefined(o3)).toBe(false); expect(isUndefined(o4)).toBe(false); expect(isUndefined(o5)).toBe(true); }); it('isNull()', function() { var o1 = 0, o2 = false, o3 = '', o4 = null, o5; expect(isNull(o1)).toBe(false); expect(isNull(o2)).toBe(false); expect(isNull(o3)).toBe(false); expect(isNull(o4)).toBe(true); expect(isNull(o5)).toBe(false); }); it('isTruthy()', function() { var o1 = 0, o2 = false, o3 = '', o4 = null, o5; expect(isTruthy(o1)).toBe(true); expect(isTruthy(o2)).toBe(false); expect(isTruthy(o3)).toBe(true); expect(isTruthy(o4)).toBe(false); expect(isTruthy(o5)).toBe(false); }); it('isFalsy()', function() { var o1 = 0, o2 = false, o3 = '', o4 = null, o5; expect(isFalsy(o1)).toBe(false); expect(isFalsy(o2)).toBe(true); expect(isFalsy(o3)).toBe(false); expect(isFalsy(o4)).toBe(true); expect(isFalsy(o5)).toBe(true); }); it('isArguments()', function() { var o1 = arguments, o2 = []; expect(isArguments(o1)).toBe(true); expect(isArguments(o2)).toBe(false); }); it('isArray()', function() { var o1 = new Array(3), o2 = [], o3 = 'array', o4 = 3, o5 = function() {}, o6 = new Object(), o7 = {}; expect(isArray(o1)).toBe(true); expect(isArray(o2)).toBe(true); expect(isArray(o3)).toBe(false); expect(isArray(o4)).toBe(false); expect(isArray(o5)).toBe(false); expect(isArray(o6)).toBe(false); expect(isArray(o7)).toBe(false); }); it('isObject()', function() { var o1 = new Object(), o2 = {}, o3 = {test: {}}, o4 = 'a', O5 = function() {}, o6 = new O5(), o7 = /xyz/g, o8 = new Date(), o9 = new Function('x', 'y', 'return x + y'); expect(isObject(o1)).toBe(true); expect(isObject(o2)).toBe(true); expect(isObject(o3.test)).toBe(true); expect(isObject(o4)).toBe(false); expect(isObject(O5)).toBe(true); expect(isObject(o6)).toBe(true); expect(isObject(o7)).toBe(true); expect(isObject(o8)).toBe(true); expect(isObject(o9)).toBe(true); }); it('isFunction()', function() { var o1 = function() {}, o2 = {}, o3 = '', o4 = [], o5 = 1, o6 = true, o7 = /xyz/g, o8 = new Function(), o9 = function o9() {}; expect(isFunction(o1)).toBe(true); expect(isFunction(o2)).toBe(false); expect(isFunction(o3)).toBe(false); expect(isFunction(o4)).toBe(false); expect(isFunction(o5)).toBe(false); expect(isFunction(o6)).toBe(false); expect(isFunction(o7)).toBe(false); expect(isFunction(o8)).toBe(true); expect(isFunction(o9)).toBe(true); }); it('isNumber()', function() { var o1 = 1, o2 = new Number(2), o3 = {test: 1}, o4 = [], o5 = 'string', o6 = true, o7 = /xyz/g, o8 = 4 + 5, o9 = parseFloat('12.5'), o10 = 0x15, o11 = parseInt('00101', 2); expect(isNumber(o1)).toBe(true); expect(isNumber(o2)).toBe(true); expect(isNumber(o3.test)).toBe(true); expect(isNumber(o3)).toBe(false); expect(isNumber(o4)).toBe(false); expect(isNumber(o5)).toBe(false); expect(isNumber(o6)).toBe(false); expect(isNumber(o7)).toBe(false); expect(isNumber(o8)).toBe(true); expect(isNumber(o9)).toBe(true); expect(isNumber(o10)).toBe(true); expect(isNumber(o11)).toBe(true); }); it('isString()', function() { var o1 = {}, o2 = new String('a'), o3 = 'string', o4 = [], o5 = '', o6 = true, o7 = /xyz/g; expect(isString(o1)).toBe(false); expect(isString(o2)).toBe(true); expect(isString(o3)).toBe(true); expect(isString(o4)).toBe(false); expect(isString(o5)).toBe(true); expect(isString(o6)).toBe(false); expect(isString(o7)).toBe(false); }); it('isBoolean()', function() { var o1 = {}, o2 = new Boolean('true'), o3 = 1, o4 = true, o5 = false, o6 = undefined, o7 = null; expect(isBoolean(o1)).toBe(false); expect(isBoolean(o2)).toBe(true); expect(isBoolean(o3)).toBe(false); expect(isBoolean(o4)).toBe(true); expect(isBoolean(o5)).toBe(true); expect(isBoolean(o6)).toBe(false); expect(isBoolean(o7)).toBe(false); }); it('isArraySafe()', function() { var o1 = new Array(3), o2 = [], o3 = 'array', o4 = 3, o5 = function() {}, o6 = new Object(), o7 = {}; expect(isArraySafe(o1)).toBe(true); expect(isArraySafe(o2)).toBe(true); expect(isArraySafe(o3)).toBe(false); expect(isArraySafe(o4)).toBe(false); expect(isArraySafe(o5)).toBe(false); expect(isArraySafe(o6)).toBe(false); expect(isArraySafe(o7)).toBe(false); }); it('isFunctionSafe()', function() { var o1 = function() {}, o2 = {}, o3 = '', o4 = [], o5 = 1, o6 = true, o7 = /xyz/g, o8 = new Function(), o9 = function o9() {}; expect(isFunctionSafe(o1)).toBe(true); expect(isFunctionSafe(o2)).toBe(false); expect(isFunctionSafe(o3)).toBe(false); expect(isFunctionSafe(o4)).toBe(false); expect(isFunctionSafe(o5)).toBe(false); expect(isFunctionSafe(o6)).toBe(false); expect(isFunctionSafe(o7)).toBe(false); expect(isFunctionSafe(o8)).toBe(true); expect(isFunctionSafe(o9)).toBe(true); }); it('isNumberSafe()', function() { var o1 = 1, o2 = new Number(2), o3 = {test: 1}, o4 = [], o5 = 'string', o6 = true, o7 = /xyz/g, o8 = 4 + 5, o9 = parseFloat('12.5'), o10 = 0x15, o11 = parseInt('00101', 2); expect(isNumberSafe(o1)).toBe(true); expect(isNumberSafe(o2)).toBe(true); expect(isNumberSafe(o3.test)).toBe(true); expect(isNumberSafe(o3)).toBe(false); expect(isNumberSafe(o4)).toBe(false); expect(isNumberSafe(o5)).toBe(false); expect(isNumberSafe(o6)).toBe(false); expect(isNumberSafe(o7)).toBe(false); expect(isNumberSafe(o8)).toBe(true); expect(isNumberSafe(o9)).toBe(true); expect(isNumberSafe(o10)).toBe(true); expect(isNumberSafe(o11)).toBe(true); }); it('isStringSafe()', function() { var o1 = {}, o2 = new String('a'), o3 = 'string', o4 = [], o5 = '', o6 = true, o7 = /xyz/g; expect(isStringSafe(o1)).toBe(false); expect(isStringSafe(o2)).toBe(true); expect(isStringSafe(o3)).toBe(true); expect(isStringSafe(o4)).toBe(false); expect(isStringSafe(o5)).toBe(true); expect(isStringSafe(o6)).toBe(false); expect(isStringSafe(o7)).toBe(false); }); it('isBooleanSafe()', function() { var o1 = {}, o2 = new Boolean('true'), o3 = 1, o4 = true, o5 = false, o6 = undefined, o7 = null; expect(isBooleanSafe(o1)).toBe(false); expect(isBooleanSafe(o2)).toBe(true); expect(isBooleanSafe(o3)).toBe(false); expect(isBooleanSafe(o4)).toBe(true); expect(isBooleanSafe(o5)).toBe(true); expect(isBooleanSafe(o6)).toBe(false); expect(isBooleanSafe(o7)).toBe(false); }); it('isHTMLNode() DOM인지 확인', function() { var text = document.createTextNode('Hello World'), el1 = document.createElement('H1'), el2 = document.createElement('A'), el3 = document.createElement('SPAN'), el4 = document.createElement('P'), el5 = document.createElement('PRE'), el6 = document.createElement('DIV'), el7 = document.createElement('INPUT'), myObj = 3, testObj = {}; expect(isHTMLNode(el1)).toBe(true); expect(isHTMLNode(el2)).toBe(true); expect(isHTMLNode(el3)).toBe(true); expect(isHTMLNode(el4)).toBe(true); expect(isHTMLNode(el5)).toBe(true); expect(isHTMLNode(el6)).toBe(true); expect(isHTMLNode(el7)).toBe(true); expect(isHTMLNode(text)).toBe(true); expect(isHTMLNode(myObj)).toBe(false); expect(isHTMLNode(testObj)).toBe(false); }); it('isHTMLTag() HTML element 인지 확인', function() { var text = document.createTextNode('Hello World'), el1 = document.createElement('H1'), el2 = document.createElement('A'), el3 = document.createElement('SPAN'), el4 = document.createElement('P'), el5 = document.createElement('PRE'), el6 = document.createElement('DIV'), el7 = document.createElement('INPUT'), myObj = 3, testObj = {}; expect(isHTMLTag(el1)).toBe(true); expect(isHTMLTag(el2)).toBe(true); expect(isHTMLTag(el3)).toBe(true); expect(isHTMLTag(el4)).toBe(true); expect(isHTMLTag(el5)).toBe(true); expect(isHTMLTag(el6)).toBe(true); expect(isHTMLTag(el7)).toBe(true); expect(isHTMLTag(text)).toBe(false); expect(isHTMLTag(myObj)).toBe(false); expect(isHTMLTag(testObj)).toBe(false); }); it('isEmpty()', function() { var o1 = {}, o2 = {test: 1}, o3 = new Object(), o4 = [], o5 = new Array(), o6 = [1, 3], o7 = function() {}, o8, o9 = undefined, o10 = null, o11; (function() { o8 = arguments; })(2, 4); (function() { o11 = arguments; })(); expect(isEmpty(o1)).toBe(true); expect(isEmpty(o2)).toBe(false); expect(isEmpty(o3)).toBe(true); expect(isEmpty(o4)).toBe(true); expect(isEmpty(o5)).toBe(true); expect(isEmpty(o6)).toBe(false); expect(isEmpty(o7)).toBe(true); expect(isEmpty(o8)).toBe(false); expect(isEmpty(o9)).toBe(true); expect(isEmpty(o10)).toBe(true); expect(isEmpty(o11)).toBe(true); }); it('isNotEmpty()', function() { var o1 = {}, o2 = {test: 1}, o3 = new Object(), o4 = [], o5 = new Array(), o6 = [1, 3], o7 = function() {}, o8, o9 = undefined, o10 = null, o11; (function() { o8 = arguments; })(2, 4); (function() { o11 = arguments; })(); expect(isNotEmpty(o1)).toBe(false); expect(isNotEmpty(o2)).toBe(true); expect(isNotEmpty(o3)).toBe(false); expect(isNotEmpty(o4)).toBe(false); expect(isNotEmpty(o5)).toBe(false); expect(isNotEmpty(o6)).toBe(true); expect(isNotEmpty(o7)).toBe(false); expect(isNotEmpty(o8)).toBe(true); expect(isNotEmpty(o9)).toBe(false); expect(isNotEmpty(o10)).toBe(false); expect(isNotEmpty(o11)).toBe(false); }); it('isDate()', function() { var o1 = 20190830, o2 = '2019-08-30', o3 = new Date(), o4 = new Date(2019, 8, 30), o5 = {}; expect(isDate(o1)).toBe(false); expect(isDate(o2)).toBe(false); expect(isDate(o3)).toBe(true); expect(isDate(o4)).toBe(true); expect(isDate(o5)).toBe(false); }); it('isDateSafe()', function() { var o1 = 20190830, o2 = '2019-08-30', o3 = new Date(), o4 = new Date(2019, 8, 30), o5 = {}; expect(isDateSafe(o1)).toBe(false); expect(isDateSafe(o2)).toBe(false); expect(isDateSafe(o3)).toBe(true); expect(isDateSafe(o4)).toBe(true); expect(isDateSafe(o5)).toBe(false); }); }); <|start_filename|>assets/plugins/tui/code-snippet/array/inArray.js<|end_filename|> /* eslint-disable complexity */ /** * @fileoverview Returns the first index at which a given element can be found in the array. * @author NHN FE Development Lab <<EMAIL>> */ 'use strict'; var isArray = require('../type/isArray'); /** * @module array */ /** * Returns the first index at which a given element can be found in the array * from start index(default 0), or -1 if it is not present. * It compares searchElement to elements of the Array using strict equality * (the same method used by the ===, or triple-equals, operator). * @param {*} searchElement Element to locate in the array * @param {Array} array Array that will be traversed. * @param {number} startIndex Start index in array for searching (default 0) * @returns {number} the First index at which a given element, or -1 if it is not present * @memberof module:array * @example * var inArray = require('tui-code-snippet/array/inArray'); // node, commonjs * * var arr = ['one', 'two', 'three', 'four']; * var idx1 = inArray('one', arr, 3); // -1 * var idx2 = inArray('one', arr); // 0 */ function inArray(searchElement, array, startIndex) { var i; var length; startIndex = startIndex || 0; if (!isArray(array)) { return -1; } if (Array.prototype.indexOf) { return Array.prototype.indexOf.call(array, searchElement, startIndex); } length = array.length; for (i = startIndex; startIndex >= 0 && i < length; i += 1) { if (array[i] === searchElement) { return i; } } return -1; } module.exports = inArray; <|start_filename|>assets/plugins/tui/code-snippet/array/range.js<|end_filename|> /** * @fileoverview Generate an integer Array containing an arithmetic progression. * @author NHN FE Development Lab <<EMAIL>> */ 'use strict'; var isUndefined = require('../type/isUndefined'); /** * Generate an integer Array containing an arithmetic progression. * @param {number} start - start index * @param {number} stop - stop index * @param {number} step - next visit index = current index + step * @returns {Array} * @memberof module:array * @example * var range = require('tui-code-snippet/array/range'); // node, commonjs * * range(5); // [0, 1, 2, 3, 4] * range(1, 5); // [1,2,3,4] * range(2, 10, 2); // [2,4,6,8] * range(10, 2, -2); // [10,8,6,4] */ function range(start, stop, step) { var arr = []; var flag; if (isUndefined(stop)) { stop = start || 0; start = 0; } step = step || 1; flag = step < 0 ? -1 : 1; stop *= flag; for (; start * flag < stop; start += step) { arr.push(start); } return arr; } module.exports = range;
fahmiansori/perwalian
<|start_filename|>apps/dcos_dns/src/dcos_dns_router.erl<|end_filename|> -module(dcos_dns_router). -author("sdhillon"). -include("dcos_dns.hrl"). -include_lib("kernel/include/logger.hrl"). -include_lib("dns/include/dns_terms.hrl"). -include_lib("dns/include/dns_records.hrl"). %% API -export([upstreams_from_questions/1]). %% @doc Resolvers based on a set of "questions" -spec(upstreams_from_questions(dns:questions()) -> {[upstream()] | internal, binary()} | {rename, binary(), binary()}). upstreams_from_questions([#dns_query{name=Name}]) -> Labels = dcos_dns_app:parse_upstream_name(Name), find_upstream(Labels); upstreams_from_questions(Questions) -> AllUpstreams = [upstreams_from_questions([Q]) || Q <- Questions], case lists:usort(AllUpstreams) of [Upstream] -> Upstream; _Upstreams -> ?LOG_WARNING( "DNS queries with mixed-upstream questions are not supported, " "the query will be resolved through internal DNS server: ~p", [Questions]), lists:foreach(fun (Zone) -> prometheus_counter:inc( dns, forwarder_failures_total, [Zone], 1) end, [Z || {U, Z} <- AllUpstreams, U =/= internal]), {internal, <<".">>} end. -spec(validate_upstream(upstream()) -> upstream()). validate_upstream({{_, _, _, _}, Port} = Upstream) when is_integer(Port) -> Upstream. %% @private -spec(default_resolvers() -> [upstream()]). default_resolvers() -> Defaults = [{{8, 8, 8, 8}, 53}, {{4, 2, 2, 1}, 53}, {{8, 8, 8, 8}, 53}, {{4, 2, 2, 1}, 53}, {{8, 8, 8, 8}, 53}], Resolvers = application:get_env(?APP, upstream_resolvers, Defaults), lists:map(fun validate_upstream/1, Resolvers). %% @private -spec(find_upstream(Labels :: [binary()]) -> {[upstream()] | internal, binary()} | {rename, binary(), binary()}). find_upstream([<<"directory">>, <<"thisdcos">>, <<"dclb">> |_]) -> {rename, <<"dclb.thisdcos.directory.">>, <<"l4lb.thisdcos.directory.">>}; find_upstream([<<"global">>, <<"thisdcos">>, <<"dclb">> |_]) -> {rename, <<"dclb.thisdcos.global.">>, <<"l4lb.thisdcos.directory.">>}; find_upstream([<<"global">>, <<"thisdcos">>, Label |_]) -> From = <<Label/binary, ".thisdcos.global.">>, To = <<Label/binary, ".thisdcos.directory.">>, {rename, From, To}; find_upstream([<<"directory">>, <<"dcos">>, Id, Label |_] = Labels) -> case cluster_crypto_id() of Id -> From = <<Label/binary, ".", Id/binary, ".dcos.directory.">>, To = <<Label/binary, ".thisdcos.directory.">>, {rename, From, To}; _CryptoId -> maybe_find_custom_upstream(Labels) end; find_upstream([<<"mesos">>|_]) -> {dcos_dns_config:mesos_resolvers(), <<"mesos.">>}; find_upstream([<<"localhost">>|_]) -> {internal, <<"localhost.">>}; find_upstream([<<"zk">>|_]) -> {internal, <<"zk.">>}; find_upstream([<<"spartan">>|_]) -> {internal, <<"spartan.">>}; find_upstream([<<"directory">>, <<"thisdcos">>, Label |_]) -> {internal, <<Label/binary, ".thisdcos.directory.">>}; find_upstream(Labels) -> maybe_find_custom_upstream(Labels). -spec(maybe_find_custom_upstream([binary()]) -> {[upstream()], binary()}). maybe_find_custom_upstream(Labels) -> case find_custom_upstream(Labels) of {[], _ZoneLabels} -> {default_resolvers(), <<".">>}; {Resolvers, ZoneLabels} -> ReverseZoneLabels = lists:reverse([<<>> | ZoneLabels]), Zone = dcos_net_utils:join(ReverseZoneLabels, <<".">>), {Resolvers, Zone} end. -spec(find_custom_upstream(Labels :: [binary()]) -> {[upstream()] | internal, [binary()]}). find_custom_upstream(QueryLabels) -> ForwardZones = dcos_dns_config:forward_zones(), UpstreamFilter = upstream_filter_fun(QueryLabels), maps:fold(UpstreamFilter, {[], []}, ForwardZones). -spec(upstream_filter_fun([dns:labels()]) -> fun(([dns:labels()], upstream(), [upstream()]) -> {[upstream()] | internal, [binary()]})). upstream_filter_fun(QueryLabels) -> fun(ZoneLabels, Upstream, Acc) -> case lists:prefix(ZoneLabels, QueryLabels) of true -> {Upstream, ZoneLabels}; false -> Acc end end. -spec(cluster_crypto_id() -> binary() | false). cluster_crypto_id() -> case dcos_dns_key_mgr:keys() of false -> false; #{public_key := PublicKey} -> zbase32:encode(PublicKey) end. <|start_filename|>apps/dcos_l4lb/test/dcos_l4lb_ipset_SUITE.erl<|end_filename|> -module(dcos_l4lb_ipset_SUITE). -export([ all/0, init_per_testcase/2, end_per_testcase/2, test_huge/1 ]). -include_lib("eunit/include/eunit.hrl"). all() -> [test_huge]. init_per_testcase(TestCase, Config) -> Uid = list_to_integer(string:strip(os:cmd("id -u"), right, $\n)), init_per_testcase(Uid, TestCase, Config). init_per_testcase(0, _TestCase, Config) -> Config; init_per_testcase(_, _, _) -> {skip, "Not running as root"}. end_per_testcase(_, _Config) -> dcos_l4lb_ipset_mgr:cleanup(). test_huge(_Config) -> % NOTE: it's not a performance test, ipset netlink protocol split a big % hash into several netlink messages. The test checks that the ipset % manager can handle this case. % Generating 32768 entries. Range = lists:seq(1, 8), IPs = [{A, B, C, D} || A <- Range, B <- Range, C <- Range, D <- Range], Entries = [{tcp, IP, Port} || IP <- IPs, Port <- Range], % Starting the ipset manager. {ok, Pid} = dcos_l4lb_ipset_mgr:start_link(), % Adding entries. ok = add_entries(Pid, Entries), ?assertEqual( lists:sort(Entries), lists:sort(get_entries(Pid))), % Removing entries. ok = remove_entries(Pid, Entries), ?assertEqual([], get_entries(Pid)), % Stopping the ipset manager. unlink(Pid), exit(Pid, kill). %%%=================================================================== %%% Call functions %%%=================================================================== % NOTE: On slow CI nodes, it can take a bit longer than default 5 seconds to % add, remove, or get ipset entries. So for test purposes, here are functions % that don't have timeouts. The functions don't require prometheus running. get_entries(Pid) -> gen_server:call(Pid, get_entries, infinity). add_entries(Pid, Entries) -> gen_server:call(Pid, {add_entries, Entries}, infinity). remove_entries(Pid, Entries) -> gen_server:call(Pid, {remove_entries, Entries}, infinity). <|start_filename|>apps/dcos_net/src/dcos_net_app.erl<|end_filename|> %%%------------------------------------------------------------------- %% @doc navstar public API %% @end %%%------------------------------------------------------------------- -module(dcos_net_app). -behaviour(application). -include_lib("kernel/include/logger.hrl"). -define(MASTERS_KEY, {masters, riak_dt_orswot}). %% Application callbacks -export([ start/2, stop/1, config_dir/0, load_config_files/1, dist_port/0, is_master/0 ]). %%==================================================================== %% API %%==================================================================== start(_StartType, _StartArgs) -> load_config_files(), load_plugins(), dcos_net_sup:start_link(). stop(_State) -> ok. %%==================================================================== %% Internal functions %%==================================================================== -spec(is_master() -> boolean()). is_master() -> application:get_env(dcos_net, is_master, false). load_config_files() -> load_config_files(undefined). -spec load_config_files(App :: atom()) -> ok. load_config_files(App) -> ConfigDir = config_dir(), case file:list_dir(ConfigDir) of {ok, []} -> ?LOG_INFO("Found an empty config directory: ~p", [ConfigDir]); {error, enoent} -> ?LOG_INFO("Couldn't find config directory: ~p", [ConfigDir]); {ok, Filenames} -> lists:foreach(fun (Filename) -> AbsFilename = filename:absname(Filename, ConfigDir), load_config_file(App, AbsFilename) end, Filenames) end. load_config_file(App, Filename) -> case file:consult(Filename) of {ok, []} -> ?LOG_INFO("Found an empty config file: ~p~n", [Filename]); {error, eacces} -> ?LOG_INFO("Couldn't load config: ~p", [Filename]); {ok, Result} -> load_config(App, Result), ?LOG_INFO("Loaded config: ~p", [Filename]) end. load_config(App, [Result]) -> lists:foreach(fun (AppOptions) -> load_app_config(App, AppOptions) end, Result). load_app_config(undefined, {App, Options}) -> load_app_config(App, {App, Options}); load_app_config(App, {App, Options}) -> lists:foreach(fun ({OptionKey, OptionValue}) -> application:set_env(App, OptionKey, OptionValue) end, Options); load_app_config(_App, _AppOptions) -> ok. %%==================================================================== %% dist_port %%==================================================================== -spec(dist_port() -> {ok, inet:port_number()} | {error, atom()}). dist_port() -> ConfigDir = config_dir(), try case erl_prim_loader:list_dir(ConfigDir) of {ok, Filenames} -> dist_port(Filenames, ConfigDir); error -> {error, list_dir} end catch _:Err -> {error, Err} end. -spec(dist_port([file:filename()], file:filename()) -> {ok, inet:port_number()} | {error, atom()}). dist_port([], _Dir) -> {error, not_found}; dist_port([Filename|Filenames], Dir) -> AbsFilename = filename:absname(Filename, Dir), case consult(AbsFilename) of {ok, Data} -> case find(dcos_net, dist_port, Data) of {ok, Port} -> {ok, Port}; false -> dist_port(Filenames, Dir) end; {error, _Error} -> dist_port(Filenames, Dir) end. -spec(consult(file:filename()) -> {ok, term()} | {error, term()}). consult(Filename) -> case prim_file:read_file(Filename) of {ok, Data} -> String = binary_to_list(Data), case erl_scan:string(String) of {ok, Tokens, _Line} -> erl_parse:parse_term(Tokens); {error, Error, _Line} -> {error, Error} end; {error, Error} -> {error, Error} end. -spec(find(App, Key, Data) -> {ok, Value} | false when Data :: [{atom(), [{atom(), term()}]} | file:filename()], App :: atom(), Key :: atom(), Value :: term()). find(App, Key, Data) -> case lists:keyfind(App, 1, Data) of {App, Config} -> case lists:keyfind(Key, 1, Config) of {Key, Value} -> {ok, Value}; false -> false end; false -> false end. %%==================================================================== %% config dir %%==================================================================== -define(TOKEN_DOT, [{dot, erl_anno:new(1)}]). -define(DEFAULT_CONFIG_DIR, "/opt/mesosphere/etc/dcos-net.config.d"). -type config_dir_r() :: {ok, file:filename()} | undefined. -spec(config_dir() -> file:filename()). config_dir() -> config_dir([ fun config_dir_env/0, fun config_dir_arg/0, fun config_dir_sys/0 ]). -spec(config_dir([fun (() -> config_dir_r())]) -> file:filename()). config_dir([]) -> ?DEFAULT_CONFIG_DIR; config_dir([Fun|Funs]) -> case Fun() of {ok, ConfigDir} -> ConfigDir; undefined -> config_dir(Funs) end. -spec(config_dir_env() -> config_dir_r()). config_dir_env() -> application:get_env(dcos_net, config_dir). -spec(config_dir_arg() -> config_dir_r()). config_dir_arg() -> case init:get_argument(dcos_net) of {ok, Args} -> Args0 = lists:map(fun list_to_tuple/1, Args), case lists:keyfind("config_dir", 1, Args0) of {"config_dir", Value} -> {ok, Tokens, _} = erl_scan:string(Value), {ok, _} = erl_parse:parse_term(Tokens ++ ?TOKEN_DOT); false -> undefined end; error -> undefined end. -spec(config_dir_sys() -> config_dir_r()). config_dir_sys() -> case init:get_argument(config) of error -> undefined; {ok, [SysConfig|_]} -> get_env(SysConfig, dcos_net, config_dir) end. -spec(get_env(SysConfig, App, Key) -> {ok, Value} | undefined when SysConfig :: file:filename() | any(), App :: atom(), Key :: atom(), Value :: atom()). get_env(SysConfig, App, Key) -> case consult(SysConfig) of {ok, Data} -> case find(App, Key, Data) of {ok, ConfigDir} -> {ok, ConfigDir}; false -> Filename = lists:last(Data), get_env(Filename, App, Key) end; {error, _Error} -> undefined end. %%==================================================================== %% Plugins %%==================================================================== load_plugins() -> Plugins = application:get_env(dcos_net, plugins, []), lists:foreach(fun load_plugin/1, Plugins). load_plugin({App, AppPath}) -> case code:add_pathz(AppPath) of true -> load_modules(App, AppPath), case application:ensure_all_started(App, permanent) of {error, Error} -> ?LOG_ERROR("Plugin ~p: ~p", [App, Error]); {ok, _Apps} -> ok end; {error, bad_directory} -> ?LOG_ERROR("Plugin ~p: bad_directory", [App]) end. load_modules(App, AppPath) -> AppFile = filename:join(AppPath, [App, ".app"]), {ok, [{application, App, AppData}]} = file:consult(AppFile), {modules, Modules} = lists:keyfind(modules, 1, AppData), lists:foreach(fun code:load_file/1, Modules). <|start_filename|>apps/dcos_l4lb/src/dcos_l4lb_config.erl<|end_filename|> %%%------------------------------------------------------------------- %%% @author sdhillon, <NAME> %%% @copyright (C) 2015, Mesosphere %%% @doc %%% %%% @end %%% Created : 08. Dec 2015 8:58 PM %%%------------------------------------------------------------------- -module(dcos_l4lb_config). -author("sdhillon"). -author("<NAME>"). %% API -export([ agent_poll_interval/0, agent_poll_max_interval/0, networking/0, agent_polling_enabled/0, min_named_ip/0, max_named_ip/0, ipv6_enabled/0, min_named_ip6/0, max_named_ip6/0, ipset_enabled/0, dcos_l4lb_iface/0, metrics_interval_seconds/0, metrics_splay_seconds/0, cni_dir/0 ]). metrics_interval_seconds() -> application:get_env(dcos_l4lb, metrics_interval_seconds, 20). metrics_splay_seconds() -> application:get_env(dcos_l4lb, metrics_interval_seconds, 2). dcos_l4lb_iface() -> application:get_env(dcos_l4lb, iface, "minuteman"). agent_poll_interval() -> application:get_env(dcos_l4lb, agent_poll_interval, 2000). agent_poll_max_interval() -> application:get_env(dcos_l4lb, agent_poll_max_interval, 60000). networking() -> application:get_env(dcos_l4lb, enable_networking, true). agent_polling_enabled() -> application:get_env(dcos_l4lb, agent_polling_enabled, true). cni_dir() -> application:get_env(dcos_l4lb, cni_dir, "/var/run/dcos/cni/l4lb"). -spec(min_named_ip() -> inet:ip4_address()). min_named_ip() -> application:get_env(dcos_l4lb, min_named_ip, {11, 0, 0, 0}). -spec(max_named_ip() -> inet:ip4_address()). -ifndef(TEST). max_named_ip() -> application:get_env(dcos_l4lb, max_named_ip, {11, 255, 255, 254}). -else. max_named_ip() -> application:get_env(dcos_l4lb, max_named_ip, {11, 0, 0, 254}). -endif. ipv6_enabled() -> application:get_env(dcos_l4lb, enable_ipv6, true). min_named_ip6() -> application:get_env(dcos_l4lb, min_named_ip6, {16#fd01, 16#c, 16#0, 16#0, 16#0, 16#0, 16#0, 16#0}). max_named_ip6() -> application:get_env(dcos_l4lb, max_named_ip6, {16#fd01, 16#c, 16#0, 16#0, 16#ffff, 16#ffff, 16#ffff, 16#ffff}). ipset_enabled() -> application:get_env(dcos_l4lb, ipset_enabled, true). <|start_filename|>apps/dcos_dns/src/zbase32.erl<|end_filename|> %%% @author <NAME> <<EMAIL>> [http://jkemp.net/] %%% @doc Implementation of z-base-32 in Erlang. %%% @reference See <a href="http://zooko.com/repos/z-base-32/base32/DESIGN">Z-Base-32</a>. Find the code <a href="http://github.com/frumioj/erl-base">here</a>. %%% @since 26 August 2009 %%% %%% @copyright 2009 <NAME>, All rights reserved. Open source, BSD License %%% @version 1.1 %%% %%% %%% Copyright (c) 2009 <NAME> %%% All rights reserved. %%% %%% Redistribution and use in source and binary forms, with or without %%% modification, are permitted provided that the following conditions %%% are met: %%% 1. Redistributions of source code must retain the above copyright %%% notice, this list of conditions and the following disclaimer. %%% 2. Redistributions in binary form must reproduce the above copyright %%% notice, this list of conditions and the following disclaimer in the %%% documentation and/or other materials provided with the distribution. %%% 3. Neither the name of the copyright holder nor the names of contributors %%% may be used to endorse or promote products derived from this software %%% without specific prior written permission. %%% %%% THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTOR(S) ``AS IS'' AND %%% ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE %%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE %%% ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTOR(S) BE LIABLE %%% FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL %%% DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS %%% OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) %%% HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT %%% LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY %%% OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF %%% SUCH DAMAGE. %%% -module(zbase32). -export([encode/1, decode/1, encode_to_string/1, decode_to_string/1]). %%------------------------------------------------------------------------- %% The following type is a subtype of string() for return values %% of (some) functions of this module. %%------------------------------------------------------------------------- -type ascii_string() :: [1..255]. %%------------------------------------------------------------------------- %% encode_to_string(ASCII) -> Base32String %% ASCII - string() | binary() %% Base32String - string() %% %% Description: Encodes a plain ASCII string (or binary) into base32. %%------------------------------------------------------------------------- -spec encode_to_string(string() | binary()) -> ascii_string(). encode_to_string(Bin) when is_binary(Bin) -> encode_to_string(binary_to_list(Bin)); encode_to_string(List) when is_list(List) -> encode_l(List). %%------------------------------------------------------------------------- %% encode(ASCII) -> Base32 %% ASCII - string() | binary() %% Base32 - binary() %% %% Description: Encodes a plain ASCII string (or binary) into base32. %%------------------------------------------------------------------------- -spec encode(string() | binary()) -> binary(). encode(Bin) when is_binary(Bin) -> encode_binary(Bin); encode(List) when is_list(List) -> list_to_binary(encode_l(List)). -spec encode_l(string()) -> ascii_string(). encode_l([]) -> []; encode_l([A]) -> [b32e(A bsr 3), b32e((A band 7) bsl 2)]; encode_l([A, B]) -> [b32e(A bsr 3), b32e(((A band 7) bsl 2) bor ((B band 192) bsr 6)), b32e((B band 62) bsr 1), b32e((B band 1) bsl 4)]; encode_l([A, B, C]) -> [b32e(A bsr 3), b32e(((A band 7) bsl 2) bor ((B band 192) bsr 6)), b32e((B band 62) bsr 1), b32e(((B band 1) bsl 4) bor (C bsr 4)), b32e((C band 15) bsl 1)]; encode_l([A, B, C, D]) -> [b32e(A bsr 3), b32e(((A band 7) bsl 2) bor ((B band 192) bsr 6)), b32e((B band 62) bsr 1), b32e(((B band 1) bsl 4) bor (C bsr 4)), b32e(((C band 15) bsl 1) bor (D band 128)), b32e((D band 124) bsr 2), b32e((D band 3) bsl 3)]; encode_l([A, B, C, D, E]) -> [b32e(A bsr 3), b32e(((A band 7) bsl 2) bor ((B band 192) bsr 6)), b32e((B band 62) bsr 1), b32e(((B band 1) bsl 4) bor (C bsr 4)), b32e(((C band 15) bsl 1) bor (D band 128)), b32e((D band 124) bsr 2), b32e(((D band 3) bsl 3) bor (E bsr 5)), b32e(E band 31)]; encode_l([A, B, C, D, E | Ls]) -> BB = (A bsl 32) bor (B bsl 24) bor (C bsl 16) bor (D bsl 8) bor E, [b32e(BB bsr 35), b32e((BB bsr 30) band 31), b32e((BB bsr 25) band 31), b32e((BB bsr 20) band 31), b32e((BB bsr 15) band 31), b32e((BB bsr 10) band 31), b32e((BB bsr 5) band 31), b32e(BB band 31) | encode_l(Ls)]. %% @TODO: support non-byte lengths (ie. 10 bits)? encode_binary(Bin) -> Split = 5 * (byte_size(Bin) div 5), <<Main0:Split/binary, Rest/binary>> = Bin, Main = <<<<(b32e(E)):8>> || <<E:5>> <= Main0>>, case Rest of <<A:5, B:5, C:5, D:5, E:5, F:5, G:2>> -> <<Main/binary, (b32e(A)):8, (b32e(B)):8, (b32e(C)):8, (b32e(D)):8, (b32e(E)):8, (b32e(F)):8, (b32e( G bsl 3)):8>>; <<A:5, B:5, C:5, D:5, E:4>> -> <<Main/binary, (b32e(A)):8, (b32e(B)):8, (b32e(C)):8, (b32e(D)):8, (b32e(E bsl 1)):8>>; <<A:5, B:5, C:5, D:1>> -> <<Main/binary, (b32e(A)):8, (b32e(B)):8, (b32e(C)):8, (b32e(D bsl 4)):8>>; <<A:5, B:3>> -> <<Main/binary, (b32e(A)):8, (b32e(B bsl 2)):8>>; <<>> -> Main end. -spec decode(string() | binary()) -> binary(). decode(Bin) when is_binary(Bin) -> list_to_binary(decode_l(binary_to_list(Bin))); decode(List) when is_list(List) -> list_to_binary(decode_l(List)). -spec decode_to_string(string() | binary()) -> string(). decode_to_string(Bin) when is_binary(Bin) -> decode_l(binary_to_list(Bin)); decode_to_string(List) when is_list(List) -> decode_l(List). %% One-based decode map. -define(DECODE_MAP, {bad, bad, bad, bad, bad, bad, bad, bad, ws, ws, bad, bad, ws, bad, bad, %1-15 bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, %16-31 ws, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, 63, %32-47 bad, bad, bad, 25, 26, 27, 30, 29, 7, 31, bad, bad, bad, bad, bad, bad, %48-63 bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, %64-79 bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, 24, 1, 12, 3, 8, 5, 6, 28, 21, 9, 10, 18, 11, 2, 16, %96-111 13, 14, 4, 22, 17, 19, bad, 20, 15, 0, 23, bad, bad, bad, bad, bad, %112-127 bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad, bad}). %% @TODO: support other lengths of encoded strings (for different %% sub-byte binary lengths) decode_l([A, B]) -> [((b32d(A) bsl 3) bor (b32d(B) bsr 2))]; decode_l([A, B, C, D]) -> [(b32d(A) bsl 3) bor (b32d(B) bsr 2), ((b32d(B) band 3) bsl 6) bor (b32d(C) bsl 1) bor (b32d(D) bsr 4)]; decode_l([A, B, C, D, E]) -> [(b32d(A) bsl 3) bor (b32d(B) bsr 2), ((b32d(B) band 3) bsl 6) bor (b32d(C) bsl 1) bor (b32d(D) bsr 4), ((b32d(D) band 15) bsl 4) bor (b32d(E) bsr 1)]; decode_l([A, B, C, D, E, F, G]) -> [(b32d(A) bsl 3) bor (b32d(B) bsr 2), ((b32d(B) band 3) bsl 6) bor (b32d(C) bsl 1) bor (b32d(D) bsr 4), ((b32d(D) band 15) bsl 4) bor (b32d(E) bsr 1), ((b32d(E) band 1) bsl 7) bor (b32d(F) bsl 2) bor (b32d(G) bsr 3)]; decode_l([A, B, C, D, E, F, G, H]) -> [(b32d(A) bsl 3) bor (b32d(B) bsr 2), ((b32d(B) band 3) bsl 6) bor (b32d(C) bsl 1) bor (b32d(D) bsr 4), ((b32d(D) band 15) bsl 4) bor (b32d(E) bsr 1), ((b32d(E) band 1) bsl 7) bor (b32d(F) bsl 2) bor (b32d(G) bsr 3), ((b32d(G) band 7) bsl 5) bor b32d(H)]; decode_l([A, B, C, D, E, F, G, H | List]) -> [decode_l([A, B, C, D, E, F, G, H]) ++ decode_l(List)]. %% accessors b32e(X) -> element(X + 1, {$y, $b, $n, $d, $r, $f, $g, $8, $e, $j, $k, $m, $c, $p, $q, $x, $o, $t, $l, $u, $w, $i, $s, $z, $a, $3, $4, $5, $h, $7, $6, $9}). b32d(X) -> b32d_ok(element(X, ?DECODE_MAP)). b32d_ok(I) when is_integer(I) -> I. <|start_filename|>apps/dcos_overlay/test/dcos_overlay_start_SUITE.erl<|end_filename|> -module(dcos_overlay_start_SUITE). -include_lib("common_test/include/ct.hrl"). %% common_test callbacks -export([ all/0, init_per_testcase/2, end_per_testcase/2 ]). %% tests -export([ dcos_overlay_start/1 ]). -define(DEFAULT_CONFIG_DIR, "/opt/mesosphere/etc/dcos-net.config.d"). init_per_testcase(TestCase, Config) -> Uid = list_to_integer(string:strip(os:cmd("id -u"), right, $\n)), init_per_testcase(Uid, TestCase, Config). init_per_testcase(0, _TestCase, Config) -> meck:new(file, [unstick, passthrough]), meck:expect(file, list_dir, fun (?DEFAULT_CONFIG_DIR) -> meck:passthrough([?config(data_dir, Config)]); (Dir) -> meck:passthrough([Dir]) end), meck:expect(file, consult, fun (?DEFAULT_CONFIG_DIR ++ File) -> meck:passthrough([?config(data_dir, Config) ++ File]); (File) -> meck:passthrough([File]) end), meck:new(dcos_overlay_sup, [passthrough]), meck:expect(dcos_overlay_sup, init, fun (_) -> {ok, {#{}, []}} end), Config; init_per_testcase(_, _, _) -> {skip, "Not running as root"}. end_per_testcase(_TestCase, _Config) -> ok = meck:unload(dcos_overlay_sup), ok = meck:unload(file). all() -> [dcos_overlay_start]. dcos_overlay_start(_Config) -> navstar_start(dcos_overlay, baz, overlay). navstar_start(App, Env, Value) -> undefined = application:get_env(App, common, undefined), undefined = application:get_env(App, Env, undefined), {ok, _} = application:ensure_all_started(App), Value = application:get_env(App, Env, undefined), navstar = application:get_env(App, common, undefined), ok = application:stop(App). <|start_filename|>apps/dcos_net/src/dcos_net_logger_h.erl<|end_filename|> -module(dcos_net_logger_h). -export([add_handler/0]). %% Logger callbacks -export([log/2, adding_handler/1, removing_handler/1, changing_config/3, filter_config/1]). add_handler() -> prometheus_counter:new([ {name, erlang_vm_logger_events_total}, {help, "Logger events count"}, {labels, [level]} ]), logger:add_handler(?MODULE, ?MODULE, #{level => notice}). %%%=================================================================== %%% Logger callbacks %%%=================================================================== adding_handler(Config) -> {ok, Config}. changing_config(_SetOrUpdate, _OldConfig, NewConfig) -> {ok, NewConfig}. removing_handler(_Config) -> ok. log(#{level := Level}, _Config) -> safe_inc(erlang_vm_logger_events_total, [Level], 1). filter_config(Config) -> Config. %%%=================================================================== %%% Internal functions %%%=================================================================== safe_inc(Name, LabelValues, Value) -> try prometheus_counter:inc(Name, LabelValues, Value) catch error:_Error -> ok end. <|start_filename|>apps/dcos_dns/src/dcos_dns_app.erl<|end_filename|> -module(dcos_dns_app). -behaviour(application). -export([start/2, stop/1]). %% Application -export([ wait_for_reqid/2, parse_ipv4_address/1, parse_ipv4_address_with_port/2, parse_upstream_name/1 ]). -include("dcos_dns.hrl"). -include_lib("dns/include/dns_terms.hrl"). -include_lib("dns/include/dns_records.hrl"). -define(TCP_LISTENER_NAME, dcos_dns_tcp_listener). %%==================================================================== %% Application Behavior %%==================================================================== start(_StartType, _StartArgs) -> dcos_net_app:load_config_files(dcos_dns), maybe_load_json_config(), %% Maybe load the relevant DCOS configuration maybe_start_dcos_dns(application:get_env(dcos_dns, enable_dns, true)). maybe_start_dcos_dns(false) -> dcos_dns_sup:start_link(false); maybe_start_dcos_dns(true) -> Ret = dcos_dns_sup:start_link(true), maybe_start_tcp_listener(), Ret. stop(_State) -> ranch:stop_listener(?TCP_LISTENER_NAME), ok. %%==================================================================== %% General API %%==================================================================== %% @doc Wait for a response. wait_for_reqid(ReqID, Timeout) -> receive {ReqID, ok} -> ok; {ReqID, ok, Val} -> {ok, Val} after Timeout -> {error, timeout} end. %% @doc Parse an IPv4 Address -spec(parse_ipv4_address(binary()|list()) -> inet:ip4_address()). parse_ipv4_address(Value) when is_binary(Value) -> parse_ipv4_address(binary_to_list(Value)); parse_ipv4_address(Value) -> {ok, IP} = inet:parse_ipv4_address(Value), IP. %% @doc Parse an IPv4 Address with an optionally specified port. %% The default port will be substituted in if not given. -spec(parse_ipv4_address_with_port(binary()|list(), inet:port_number()) -> upstream()). parse_ipv4_address_with_port(Value, DefaultPort) -> case re:split(Value, ":") of [IP, Port] -> {parse_ipv4_address(IP), parse_port(Port)}; [IP] -> {parse_ipv4_address(IP), DefaultPort} end. %% @doc Same as parse_ipv4_address_with_port(Value, 53). -spec(parse_ipv4_address_with_port(binary()|list()) -> upstream()). parse_ipv4_address_with_port(Value) -> parse_ipv4_address_with_port(Value, 53). -spec(parse_upstream_name(dns:dname()) -> [dns:label()]). parse_upstream_name(Name) when is_binary(Name) -> LowerName = dns:dname_to_lower(Name), Labels = dns:dname_to_labels(LowerName), lists:reverse(Labels). %%==================================================================== %% Internal functions %%==================================================================== -spec parse_port(binary()|list()) -> inet:port_number(). parse_port(Port) when is_binary(Port) -> binary_to_integer(Port); parse_port(Port) when is_list(Port) -> list_to_integer(Port). -spec(maybe_start_tcp_listener() -> ok). maybe_start_tcp_listener() -> case dcos_dns_config:tcp_enabled() of true -> IPs = dcos_dns_config:bind_ips(), lists:foreach(fun start_tcp_listener/1, IPs); false -> ok end. -spec(start_tcp_listener(inet:ip4_address()) -> supervisor:startchild_ret()). start_tcp_listener(IP) -> Port = dcos_dns_config:tcp_port(), Acceptors = 100, SendTimeout = application:get_env(dcos_dns, send_timeout, 3000), Options = [dcos_dns:family(IP), {ip, IP}, {port, Port}, {send_timeout, SendTimeout}], {ok, _} = ranch:start_listener({?TCP_LISTENER_NAME, IP}, Acceptors, ranch_tcp, Options, dcos_dns_tcp_handler, []). % Sample configuration: % { % "upstream_resolvers": ["169.254.169.253"], % "udp_port": 53, % "tcp_port": 53, % "forward_zones": { % "a.contoso.com" : ["1.1.1.1:53", "192.168.127.12"], % "b.contoso.com" : ["192.168.127.12", "192.168.3.11:53"] % } % } maybe_load_json_config() -> case file:read_file("/opt/mesosphere/etc/dcos-dns.json") of {ok, FileBin} -> load_json_config(FileBin); _ -> ok end. load_json_config(FileBin) -> ConfigMap = jsx:decode(FileBin, [return_maps]), ConfigTuples = maps:to_list(ConfigMap), lists:foreach(fun process_config_tuple/1, ConfigTuples). process_config_tuple({<<"upstream_resolvers">>, UpstreamResolvers}) -> UpstreamIPsAndPorts = lists:map(fun parse_ipv4_address_with_port/1, UpstreamResolvers), application:set_env(?APP, upstream_resolvers, UpstreamIPsAndPorts); process_config_tuple({<<"forward_zones">>, Zones}) -> Zones0 = maps:fold(fun parse_upstream/3, maps:new(), Zones), application:set_env(?APP, forward_zones, Zones0); process_config_tuple({<<"bind_ips">>, IPs0}) -> IPs1 = lists:map(fun parse_ipv4_address/1, IPs0), application:set_env(?APP, bind_ips, IPs1); process_config_tuple({<<"bind_ip_blacklist">>, IPs0}) -> IPs1 = lists:map(fun parse_ipv4_address/1, IPs0), application:set_env(?APP, bind_ip_blacklist, IPs1); process_config_tuple({Key, Value}) when is_binary(Value) -> application:set_env(?APP, binary_to_atom(Key, utf8), binary_to_list(Value)); process_config_tuple({Key, Value}) -> application:set_env(?APP, binary_to_atom(Key, utf8), Value). -spec parse_upstream(ZoneName :: binary(), Upstreams :: [binary()], Acc) -> Acc when Acc :: #{[dns:label()] => [upstream()]}. parse_upstream(ZoneName, Upstreams, Acc) -> Labels = parse_upstream_name(ZoneName), Upstreams0 = lists:map(fun parse_ipv4_address_with_port/1, Upstreams), Acc#{Labels => Upstreams0}. %%==================================================================== %% Unit Tests %%==================================================================== -ifdef(TEST). -include_lib("eunit/include/eunit.hrl"). parse_ipv4_addres_with_port_test() -> %% With explicit port ?assertEqual( {{127, 0, 0, 1}, 9000}, parse_ipv4_address_with_port("127.0.0.1:9000", 42)), %% Fallback to default ?assertEqual( {{8, 8, 8, 8}, 12345}, parse_ipv4_address_with_port("8.8.8.8", 12345)), %% Default port ?assertEqual( {{1, 1, 1, 1}, 53}, parse_ipv4_address_with_port("1.1.1.1")). parse_ipv4_address_test() -> ?assertEqual( {127, 0, 0, 1}, parse_ipv4_address(<<"127.0.0.1">>)), ?assertEqual( [{127, 0, 0, 1}, {2, 2, 2, 2}], lists:map(fun parse_ipv4_address/1, [<<"127.0.0.1">>, <<"2.2.2.2">>])). -endif. <|start_filename|>apps/dcos_l4lb/include/dcos_l4lb_lashup.hrl<|end_filename|> -define(NODEMETADATA_KEY, [minuteman, nodemetadata, ip]). -define(LWW_REG(Value), {Value, riak_dt_lwwreg}). <|start_filename|>apps/dcos_dns/src/dcos_dns_config_loader_server.erl<|end_filename|> %%%------------------------------------------------------------------- %%% @author sdhillon %%% @copyright (C) 2016, <COMPANY> %%% @doc %%% %%% @end %%% Created : 15. Mar 2016 1:37 PM %%%------------------------------------------------------------------- -module(dcos_dns_config_loader_server). -author("sdhillon"). -behaviour(gen_server). %% gen_server callbacks -export([init/1, handle_call/3, handle_cast/2, handle_info/2, terminate/2, code_change/3]). %% API -export([start_link/0, start_link/1]). -include_lib("kernel/include/logger.hrl"). -include("dcos_dns.hrl"). -define(REFRESH_INTERVAL_NORMAL, 120000). -define(REFRESH_INTERVAL_FAIL, 5000). -define(REFRESH_MESSAGE, refresh). -define(MESOS_DNS_PORT, 61053). %% State record. -record(state, {}). %%%=================================================================== %%% API %%%=================================================================== %% @doc Same as start_link([]). -spec start_link() -> {ok, pid()} | ignore | {error, term()}. start_link() -> start_link([]). %% @doc Start and link to calling process. -spec start_link(list())-> {ok, pid()} | ignore | {error, term()}. start_link(Opts) -> gen_server:start_link({local, ?MODULE}, ?MODULE, Opts, []). %%%=================================================================== %%% gen_server callbacks %%%=================================================================== init([]) -> timer:send_after(0, ?REFRESH_MESSAGE), {ok, #state{}}. handle_call(Msg, _From, State) -> ?LOG_WARNING("Unhandled messages: ~p", [Msg]), {reply, ok, State}. handle_cast(Msg, State) -> ?LOG_WARNING("Unhandled messages: ~p", [Msg]), {noreply, State}. handle_info(?REFRESH_MESSAGE, State) -> NormalRefreshInterval = application:get_env(?APP, masters_refresh_interval_normal, ?REFRESH_INTERVAL_NORMAL), FailRefreshInterval = application:get_env(?APP, masters_refresh_interval_fail, ?REFRESH_INTERVAL_FAIL), case maybe_load_masters() of ok -> {ok, _} = timer:send_after(NormalRefreshInterval, ?REFRESH_MESSAGE); error -> {ok, _} = timer:send_after(FailRefreshInterval, ?REFRESH_MESSAGE) end, {noreply, State, hibernate}; handle_info(Msg, State) -> ?LOG_WARNING("Unhandled messages: ~p", [Msg]), {noreply, State}. terminate(_Reason, _State) -> ok. code_change(_OldVsn, State, _Extra) -> {ok, State}. %%%=================================================================== %%% Internal functions %%%=================================================================== %%%% Algorithm copied from gen_resolv maybe_load_masters() -> case get_masters() of {ok, Masters} -> ok = dcos_dns_config:mesos_resolvers(Masters); {error, _} -> error end. -spec(get_masters() -> {error, Reason :: term()} | {ok, [upstream()]}). get_masters() -> case os:getenv("MASTER_SOURCE") of "exhibitor_uri" -> get_masters_exhibitor_uri(); "exhibitor" -> get_masters_exhibitor(); "master_list" -> get_masters_file(); Source -> ?LOG_WARNING("Unable to load masters (dcos_dns) from source: ~p", [Source]), {error, bad_source} end. get_masters_file() -> FileName = os:getenv("MASTER_LIST_FILE", "/opt/mesosphere/etc/master_list"), {ok, FileBin} = file:read_file(FileName), MastersBinIPs = jsx:decode(FileBin, [return_maps]), IPAddresses = lists:map(fun dcos_dns_app:parse_ipv4_address/1, MastersBinIPs), {ok, [{IPAddress, ?MESOS_DNS_PORT} || IPAddress <- IPAddresses]}. get_masters_exhibitor_uri() -> ExhibitorURI = os:getenv("EXHIBITOR_URI"), get_masters_exhibitor(ExhibitorURI). get_masters_exhibitor() -> ExhibitorAddress = os:getenv("EXHIBITOR_ADDRESS"), URI = lists:flatten(io_lib:format("http://~s:8181/exhibitor/v1/cluster/status", [ExhibitorAddress])), get_masters_exhibitor(URI). get_masters_exhibitor(URI) -> Options = [ {timeout, dcos_dns_config:exhibitor_timeout()}, {connect_timeout, dcos_dns_config:exhibitor_timeout()} ], case httpc:request(get, {URI, []}, Options, [{body_format, binary}]) of {ok, {{_, 200, _}, _, Body}} -> ExhibitorStatuses = jsx:decode(Body, [return_maps]), ExhibitorHostnames = [Hostname || #{<<"hostname">> := Hostname} <- ExhibitorStatuses], IPAddresses = lists:map(fun dcos_dns_app:parse_ipv4_address/1, ExhibitorHostnames), {ok, [{IPAddress, ?MESOS_DNS_PORT} || IPAddress <- IPAddresses]}; Error -> ?LOG_WARNING("Failed to retrieve information from exhibitor to configure dcos_dns: ~p", [Error]), {error, unavailable} end. <|start_filename|>apps/dcos_dns/src/dcos_dns_tcp_handler.erl<|end_filename|> -module(dcos_dns_tcp_handler). -behaviour(ranch_protocol). -export([ init/5, start_link/4 ]). -define(TIMEOUT, 10000). start_link(Ref, Socket, Transport, Opts) -> Args = [self(), Ref, Socket, Transport, Opts], proc_lib:start_link(?MODULE, init, Args). -spec(init(pid(), ranch:ref(), init:socket(), module(), ranch_tcp:opts()) -> ok). init(Parent, Ref, Socket, Transport, Opts) -> erlang:link(Socket), ok = inet:setopts(Socket, [{packet, 2}, {send_timeout, ?TIMEOUT}]), proc_lib:init_ack(Parent, {ok, self()}), ok = ranch:accept_ack(Ref), loop(Socket, Transport, Opts). -spec(loop(init:socket(), module(), ranch_tcp:opts()) -> ok). loop(Socket, Transport, Opts) -> case Transport:recv(Socket, 0, ?TIMEOUT) of {ok, Request} -> case dcos_dns_handler:resolve(tcp, Request, ?TIMEOUT) of {ok, Response} -> ok = Transport:send(Socket, Response), loop(Socket, Transport, Opts); {error, Error} -> exit(Error) end; {error, closed} -> ok; {error, Error} -> Transport:close(Socket), exit(Error) end. <|start_filename|>apps/dcos_overlay/src/dcos_overlay_configure.erl<|end_filename|> -module(dcos_overlay_configure). -export([ start_link/1, stop/1, apply_config/2, configure_overlay/2 ]). -include_lib("kernel/include/logger.hrl"). -type subnet() :: dcos_overlay_lashup_kv_listener:subnet(). -type config() :: dcos_overlay_lashup_kv_listener:config(). -spec(start_link(config()) -> pid()). start_link(Config) -> Pid = self(), proc_lib:spawn_link(?MODULE, apply_config, [Pid, Config]). -spec(stop(pid()) -> ok). stop(Pid) -> unlink(Pid), exit(Pid, kill), ok. -spec(apply_config(pid(), config()) -> ok | {error, term()}). apply_config(Pid, Config) -> case apply_config(Config) of ok -> Pid ! {dcos_overlay_configure, applied_config, Config}, ok; {error, Error} -> Pid ! {dcos_overlay_configure, failed, Error, Config}, {error, Error} end. -spec(apply_config(config()) -> ok | {error, term()}). apply_config(Config) -> case dcos_overlay_netlink:start_link() of {ok, Netlink} -> try maybe_configure(Netlink, Config) of ok -> ok; {error, Error} -> ?LOG_ERROR( "Failed to apply overlay config ~p due to ~p", [Config, Error]), {error, Error} catch Class:Error:StackTrace -> ?LOG_ERROR( "Failed to apply overlay config ~p due to ~p", [Config, {Class, Error, StackTrace}]), {error, {Class, Error}} after dcos_overlay_netlink:stop(Netlink) end; {error, Error} -> ?LOG_ERROR( "Failed to apply overlay config ~p due to ~p", [Config, Error]), {error, Error} end. -spec(maybe_configure(pid(), config()) -> ok | {error, term()}). maybe_configure(Netlink, Config) -> lists:foldl( fun (Overlay, ok) -> case maybe_configure_overlay(Netlink, Config, Overlay) of ok -> ok; {error, Error} -> ?LOG_ERROR( "Failed to configure overlay ~p due to ~p", [Overlay, Error]), {error, Error} end; (_, {error, Error}) -> {error, Error} end, ok, dcos_overlay_poller:overlays()). -spec(maybe_configure_overlay(pid(), config(), jiffy:json_term()) -> ok | {error, term()}). maybe_configure_overlay(Pid, Config, #{<<"info">> := OverlayInfo} = Overlay) -> Subnet = maps:get(<<"subnet">>, OverlayInfo, undefined), #{<<"backend">> := #{<<"vxlan">> := VxLan}} = Overlay, #{<<"vtep_name">> := VTEPName} = VxLan, case maybe_configure_overlay(Pid, VTEPName, Config, Subnet) of ok -> case application:get_env(dcos_overlay, enable_ipv6, true) of true -> Subnet6 = maps:get(<<"subnet6">>, OverlayInfo, undefined), maybe_configure_overlay(Pid, VTEPName, Config, Subnet6); false -> ok end; {error, Error} -> {error, Error} end. -spec(maybe_configure_overlay(pid(), binary(), config(), undefined) -> ok | {error, term()}). maybe_configure_overlay(_Pid, _VTEPName, _Config, undefined) -> ok; maybe_configure_overlay(Pid, VTEPName, Config, Subnet) -> ParsedSubnet = parse_subnet(Subnet), case maps:find(ParsedSubnet, Config) of {ok, OverlayConfig} -> maybe_configure_overlay_entries(Pid, VTEPName, OverlayConfig); error -> ok end. maybe_configure_overlay_entries(_Pid, _VTEPName, [] = _OverlayConfig) -> ok; maybe_configure_overlay_entries(Pid, VTEPName, OverlayConfig0) -> [{VTEPIPPrefix, Data} | OverlayConfig] = OverlayConfig0, case maybe_configure_overlay_entry(Pid, VTEPName, VTEPIPPrefix, Data) of ok -> maybe_configure_overlay_entries(Pid, VTEPName, OverlayConfig); {error, Error} -> ?LOG_ERROR( "Failed to configure overlay for VTEP IP " "prefix: ~p; data: ~p; due to ~p", [VTEPIPPrefix, Data, Error]), {error, Error} end. -spec(maybe_configure_overlay_entry(pid(), binary(), subnet(), map()) -> ok | {error, term()}). maybe_configure_overlay_entry(Pid, VTEPName, VTEPIPPrefix, Data) -> LocalIP = dcos_overlay_poller:ip(), case maps:get(agent_ip, Data) of LocalIP -> ok; _AgentIP -> configure_overlay_entry(Pid, VTEPName, VTEPIPPrefix, Data) end. -spec(configure_overlay_entry(pid(), binary(), subnet(), map()) -> ok | {error, term()}). configure_overlay_entry(Pid, VTEPName, {VTEPIP, _PrefixLen}, Data) -> #{mac := MAC, agent_ip := AgentIP, subnet := {SubnetIP, SubnetPrefixLen}} = Data, VTEPNameStr = binary_to_list(VTEPName), Args = [AgentIP, VTEPNameStr, VTEPIP, MAC, SubnetIP, SubnetPrefixLen], ?MODULE:configure_overlay(Pid, Args). -spec(configure_overlay(pid(), [term()]) -> ok | {error, term()}). configure_overlay(Pid, Args) -> [AgentIP, VTEPNameStr, VTEPIP, MAC, SubnetIP, SubnetPrefixLen] = Args, MACTuple = list_to_tuple(MAC), Family = dcos_l4lb_app:family(SubnetIP), configure_overlay_ipneigh_replace( Pid, Family, AgentIP, VTEPNameStr, VTEPIP, MAC, SubnetIP, SubnetPrefixLen, MACTuple). configure_overlay_ipneigh_replace(Pid, Family, AgentIP, VTEPNameStr, VTEPIP, MAC, SubnetIP, SubnetPrefixLen, MACTuple) -> case dcos_overlay_netlink:ipneigh_replace( Pid, Family, VTEPIP, MACTuple, VTEPNameStr) of {ok, _} -> configure_overlay_subnet_iproute_replace( Pid, Family, AgentIP, VTEPNameStr, VTEPIP, SubnetIP, SubnetPrefixLen, MACTuple); {error, Error} -> ?LOG_ERROR( "Failed to create or replace a neighbor table entry for " "family: ~p; VTEP IP: ~p; MAC: ~p, VTEP name: ~s due to ~p", [Family, VTEPIP, MAC, VTEPNameStr, Error]), {error, Error} end. configure_overlay_subnet_iproute_replace(Pid, Family, AgentIP, VTEPNameStr, VTEPIP, SubnetIP, SubnetPrefixLen, MACTuple) -> case dcos_overlay_netlink:iproute_replace( Pid, Family, SubnetIP, SubnetPrefixLen, VTEPIP, main) of {ok, _} -> case Family of inet -> configure_overlay_bridge_fdb_replace( Pid, Family, AgentIP, VTEPNameStr, VTEPIP, MACTuple); _Family -> ok end; {error, Error} -> ?LOG_ERROR( "Failed to create or replace a network route for " "family: ~p; subnet IP: ~p/~p; VTEP IP: ~p due to ~p", [Family, SubnetIP, SubnetPrefixLen, VTEPIP, Error]), {error, Error} end. configure_overlay_bridge_fdb_replace( Pid, Family, AgentIP, VTEPNameStr, VTEPIP, MACTuple) -> case dcos_overlay_netlink:bridge_fdb_replace( Pid, AgentIP, MACTuple, VTEPNameStr) of {ok, _} -> configure_overlay_agent_iproute_replace(Pid, Family, AgentIP, VTEPIP); {error, Error} -> ?LOG_ERROR( "Failed to create or replace a neighbor table entry for " "agent IP: ~p; MAC: ~p, VTEP name: ~s due to ~p", [AgentIP, MACTuple, VTEPNameStr, Error]), {error, Error} end. configure_overlay_agent_iproute_replace(Pid, Family, AgentIP, VTEPIP) -> case dcos_overlay_netlink:iproute_replace( Pid, Family, AgentIP, 32, VTEPIP, 42) of {ok, _} -> ok; {error, Error} -> ?LOG_ERROR( "Failed to create or replace a network route for " "family: ~p; agent IP: ~p; VTEP IP: ~p due to ~p", [Family, AgentIP, VTEPIP, Error]), {error, Error} end. -spec(parse_subnet(binary()) -> subnet()). parse_subnet(Subnet) -> [IPBin, PrefixLenBin] = binary:split(Subnet, <<"/">>), {ok, IP} = inet:parse_address(binary_to_list(IPBin)), PrefixLen = erlang:binary_to_integer(PrefixLenBin), true = is_integer(PrefixLen), true = 0 =< PrefixLen andalso PrefixLen =< 128, {IP, PrefixLen}. <|start_filename|>apps/dcos_l4lb/src/dcos_l4lb_mgr.erl<|end_filename|> -module(dcos_l4lb_mgr). -behaviour(gen_server). -include_lib("kernel/include/logger.hrl"). -include_lib("stdlib/include/ms_transform.hrl"). -include("dcos_l4lb_lashup.hrl"). -include("dcos_l4lb.hrl"). -ifdef(TEST). -include_lib("eunit/include/eunit.hrl"). -endif. %% API -export([ push_vips/1, push_netns/2, local_port_mappings/1, init_metrics/0 ]). -export([start_link/0]). %% gen_server callbacks -export([init/1, handle_continue/2, handle_call/3, handle_cast/2, handle_info/2]). -record(state, { % pids and refs ipvs_mgr :: pid(), route_mgr :: pid(), ipset_mgr :: pid(), netns_mgr :: pid(), route_ref :: reference(), nodes_ref :: reference(), recon_ref :: reference(), % data tree = #{} :: lashup_gm_route:tree(), nodes = #{} :: #{inet:ip4_address() => node()}, namespaces = [host] :: [namespace()], % vips vips = [] :: [{key(), [backend()]}], prev_vips = [] :: [{key(), [backend()]}] }). -type state() :: #state{}. -type key() :: dcos_l4lb_mesos_poller:key(). -type backend() :: dcos_l4lb_mesos_poller:backend(). -type ipportweight() :: {{inet:ip_address(), inet:port_number()}, dcos_l4lb_mesos_poller:backend_weight()}. -type namespace() :: term(). -define(GM_EVENTS(R, T), {lashup_gm_route_events, #{ref := R, tree := T}}). -spec(push_vips(VIPs :: [{Key, [Backend]}]) -> ok when Key :: dcos_l4lb_mesos_poller:key(), Backend :: dcos_l4lb_mesos_poller:backend()). push_vips(VIPs) -> Begin = erlang:monotonic_time(), try gen_server:call(?MODULE, {vips, VIPs}) catch exit:{noproc, _MFA} -> ok after End = erlang:monotonic_time(), update_summary(vips_duration_seconds, End - Begin) end. -spec(push_netns(EventType, [netns()]) -> ok when EventType :: add_netns | remove_netns | reconcile_netns). push_netns(EventType, EventContent) -> gen_server:cast(?MODULE, {netns, {self(), EventType, EventContent}}). -spec(start_link() -> {ok, Pid :: pid()} | ignore | {error, Reason :: term()}). start_link() -> init_local_port_mappings(), gen_server:start_link({local, ?MODULE}, ?MODULE, [], []). %%%=================================================================== %%% gen_server callbacks %%%=================================================================== init([]) -> {ok, {}, {continue, {}}}. handle_continue({}, {}) -> {noreply, handle_init()}. handle_call({vips, VIPs}, _From, State) -> {reply, ok, handle_vips(VIPs, State)}; handle_call(_Request, _From, State) -> {noreply, State}. handle_cast({netns, Event}, State) -> {noreply, handle_netns_event(Event, State)}; handle_cast(_Request, State) -> {noreply, State}. handle_info(?GM_EVENTS(_R, _T)=Event, State) -> {noreply, handle_gm_event(Event, State)}; handle_info({lashup_kv_event, Ref, Key}, State) -> {noreply, handle_kv_event(Ref, Key, State)}; handle_info({timeout, _Ref, reconcile}, State) -> State0 = handle_reconcile(State), State1 = handle_gc(State0), {noreply, State1, hibernate}; handle_info(_Info, State) -> {noreply, State}. %%%=================================================================== %%% Events functions %%%=================================================================== -define(SKIP(Pattern, Value, Init), (fun Skip(X) -> % Skip message if there is yet another such message in % the message queue. It should improve the convergence. receive Pattern -> Skip(Value) after 0 -> X end end)(Init)). -spec(handle_init() -> state()). handle_init() -> {ok, IPVSMgr} = dcos_l4lb_ipvs_mgr:start_link(), {ok, RouteMgr} = dcos_l4lb_route_mgr:start_link(), {ok, IPSetMgr} = dcos_l4lb_ipset_mgr:start_link(), {ok, NetNSMgr} = dcos_l4lb_netns_watcher:start_link(), MatchSpec = ets:fun2ms(fun ({?NODEMETADATA_KEY}) -> true end), {ok, NodesRef} = lashup_kv:subscribe(MatchSpec), {ok, RouteRef} = lashup_gm_route_events:subscribe(), ReconRef = start_reconcile_timer(), #state{ipvs_mgr=IPVSMgr, route_mgr=RouteMgr, ipset_mgr=IPSetMgr, netns_mgr=NetNSMgr, route_ref=RouteRef, nodes_ref=NodesRef, recon_ref=ReconRef}. -spec(handle_gm_event(?GM_EVENTS(Ref, Tree), state()) -> state() when Ref :: reference(), Tree :: lashup_gm_route:tree()). handle_gm_event(?GM_EVENTS(Ref, Tree), #state{route_ref=Ref}=State) -> Tree0 = ?SKIP(?GM_EVENTS(Ref, T), T, Tree), State#state{tree=Tree0}; handle_gm_event(_Event, State) -> State. -spec(handle_kv_event(Ref, Key, state()) -> state() when Ref :: reference(), Key :: term()). handle_kv_event(Ref, Key, #state{nodes_ref=Ref}=State) -> ok = lashup_kv:flush(Ref, Key), Value = lashup_kv:value(Key), Nodes = [{IP, Node} || {?LWW_REG(IP), Node} <- Value], State#state{nodes=maps:from_list(Nodes)}; handle_kv_event(_Ref, _Key, State) -> State. -spec(handle_netns_event({pid(), EventType, [netns()]}, state()) -> state() when EventType :: add_netns | remove_netns | reconcile_netns). handle_netns_event({Pid, remove_netns, EventContent}, #state{netns_mgr=Pid}=State) -> handle_netns_event(remove_netns, EventContent, State); handle_netns_event({Pid, EventType, EventContent}, #state{netns_mgr=Pid}=State) -> State0 = handle_netns_event(EventType, EventContent, State), handle_reconcile(State0); handle_netns_event(_Event, State) -> State. -spec(handle_reconcile(state()) -> state()). handle_reconcile(#state{vips=VIPs, recon_ref=Ref}=State) -> erlang:cancel_timer(Ref), Begin = erlang:monotonic_time(), try handle_reconcile(VIPs, State) of State0 -> Ref0 = start_reconcile_timer(), State0#state{recon_ref=Ref0} after End = erlang:monotonic_time(), update_summary(vips_duration_seconds, End - Begin) end. -spec(start_reconcile_timer() -> reference()). start_reconcile_timer() -> Timeout = application:get_env(dcos_l4lb, reconcile_timeout, 30000), erlang:start_timer(Timeout, self(), reconcile). %%%=================================================================== %%% Internal functions %%%=================================================================== -spec(handle_reconcile([{key(), [backend()]}], state()) -> state()). handle_reconcile(VIPs, #state{tree=Tree, nodes=Nodes, namespaces=Namespaces, route_mgr=RouteMgr, ipset_mgr=IPSetMgr, prev_vips=PrevVIPs}=State) -> % If everything is ok this function is silent and changes nothing. VIPs0 = vips_port_mappings(VIPs), VIPs1 = healthy_vips(VIPs0, Nodes, Tree), Routes = get_vip_routes(VIPs), Diffs = lists:map(fun (Namespace) -> NamespaceBin = namespace2bin(Namespace), LogPrefix = <<"netns: ", NamespaceBin/binary, "; ">>, PrevRoutes = get_routes(RouteMgr, Namespace), DiffRoutes = dcos_net_utils:complement(Routes, PrevRoutes), DiffVIPs = diff(prepare_vips(PrevVIPs), prepare_vips(VIPs1)), {Namespace, LogPrefix, DiffRoutes, DiffVIPs} end, Namespaces), Keys = get_vip_keys(VIPs1), PrevKeys = get_ipset_entries(IPSetMgr), DiffKeys = dcos_net_utils:complement(Keys, PrevKeys), State0 = handle_reconcile_apply(Diffs, DiffKeys, State), State0#state{prev_vips=VIPs1}. -spec(handle_reconcile_apply([Diff], diff_keys(), state()) -> state() when Diff :: {namespace(), binary(), diff_vips(), diff_routes()}). handle_reconcile_apply( Diffs, {KeysToAdd, KeysToDel}, #state{route_mgr=RouteMgr, ipvs_mgr=IPVSMgr, ipset_mgr=IPSetMgr}=State) -> lists:foreach(fun ({Namespace, LogPrefix, {_, RoutesToDel}, _DiffVIPs}) -> ok = remove_routes(RouteMgr, RoutesToDel, Namespace), ok = log_routes_diff(LogPrefix, {[], RoutesToDel}), update_counter(reconciled_routes_total, length(RoutesToDel)) end, Diffs), add_ipset_entries(IPSetMgr, KeysToAdd), log_ipset_diff({KeysToAdd, []}), update_counter(reconciled_ipset_entries_total, length(KeysToAdd)), lists:foreach(fun ({Namespace, LogPrefix, _DiffRoutes, DiffVIPs}) -> ok = apply_vips_diff(IPVSMgr, Namespace, DiffVIPs), ok = log_vips_diff(LogPrefix, DiffVIPs), update_counter(reconciled_ipvs_rules_total, vip_diff_size(DiffVIPs)) end, Diffs), remove_ipset_entries(IPSetMgr, KeysToDel), log_ipset_diff({[], KeysToDel}), update_counter(reconciled_ipset_entries_total, length(KeysToDel)), lists:foreach(fun ({Namespace, LogPrefix, {RoutesToAdd, _}, _DiffVIPs}) -> ok = add_routes(RouteMgr, RoutesToAdd, Namespace), ok = log_routes_diff(LogPrefix, {RoutesToAdd, []}), update_counter(reconciled_routes_total, length(RoutesToAdd)) end, Diffs), State. -spec(handle_vips([{key(), [backend()]}], state()) -> state()). handle_vips(VIPs, #state{tree=Tree, nodes=Nodes, prev_vips=PrevVIPs}=State) -> VIPs0 = vips_port_mappings(VIPs), VIPs1 = healthy_vips(VIPs0, Nodes, Tree), DiffVIPs = diff(prepare_vips(PrevVIPs), prepare_vips(VIPs1)), Routes = get_vip_routes(VIPs1), PrevRoutes = get_vip_routes(PrevVIPs), DiffRoutes = dcos_net_utils:complement(Routes, PrevRoutes), Keys = get_vip_keys(VIPs1), PrevKeys = get_vip_keys(PrevVIPs), DiffKeys = dcos_net_utils:complement(Keys, PrevKeys), State0 = handle_vips_apply(DiffVIPs, DiffRoutes, DiffKeys, State), update_gauge(vips, length(VIPs)), State0#state{vips=VIPs, prev_vips=VIPs1}. -spec(handle_vips_apply(DiffVIPs, DiffRoutes, DiffKeys, State) -> State when DiffVIPs :: diff_vips(), DiffRoutes :: diff_routes(), DiffKeys :: diff_keys(), State :: state()). handle_vips_apply( DiffVIPs, {RoutesToAdd, RoutesToDel}, {KeysToAdd, KeysToDel}, #state{namespaces=Namespaces, route_mgr=RouteMgr, ipvs_mgr=IPVSMgr, ipset_mgr=IPSetMgr}=State) -> lists:foreach(fun (Namespace) -> ok = remove_routes(RouteMgr, RoutesToDel, Namespace) end, Namespaces), ok = log_routes_diff({[], RoutesToDel}), add_ipset_entries(IPSetMgr, KeysToAdd), log_ipset_diff({KeysToAdd, []}), lists:foreach(fun (Namespace) -> ok = apply_vips_diff(IPVSMgr, Namespace, DiffVIPs) end, Namespaces), ok = log_vips_diff(DiffVIPs), remove_ipset_entries(IPSetMgr, KeysToDel), log_ipset_diff({[], KeysToDel}), lists:foreach(fun (Namespace) -> ok = add_routes(RouteMgr, RoutesToAdd, Namespace) end, Namespaces), ok = log_routes_diff({RoutesToAdd, []}), State. %%%=================================================================== %%% Routes functions %%%=================================================================== -type diff_routes() :: {[inet:ip_address()], [inet:ip_address()]}. -spec(get_routes(pid(), namespace()) -> [inet:ip_address()]). get_routes(RouteMgr, Namespace) -> dcos_l4lb_route_mgr:get_routes(RouteMgr, Namespace). -spec(get_vip_routes(VIPs :: [{key(), [backend()]}]) -> [inet:ip_address()]). get_vip_routes(VIPs) -> lists:usort([IP || {{_Proto, IP, _Port}, _Backends} <- VIPs]). -spec(add_routes(pid(), [inet:ip_address()], namespace()) -> ok). add_routes(RouteMgr, Routes, Namespace) -> dcos_l4lb_route_mgr:add_routes(RouteMgr, Routes, Namespace). -spec(remove_routes(pid(), [inet:ip_address()], namespace()) -> ok). remove_routes(RouteMgr, Routes, Namespace) -> dcos_l4lb_route_mgr:remove_routes(RouteMgr, Routes, Namespace). %%%=================================================================== %%% IPSet functions %%%=================================================================== -type diff_keys() :: {[key()], [key()]}. -spec(get_vip_keys(VIPs :: [{key(), [backend()]}]) -> [key()]). get_vip_keys(VIPs) -> [ VIPKey || {VIPKey, _Backends} <- VIPs]. -spec(get_ipset_entries(pid()) -> [key()]). get_ipset_entries(IPSetMgr) -> dcos_l4lb_ipset_mgr:get_entries(IPSetMgr). -spec(add_ipset_entries(pid(), [key()]) -> ok). add_ipset_entries(IPSetMgr, KeysToAdd) -> dcos_l4lb_ipset_mgr:add_entries(IPSetMgr, KeysToAdd). -spec(remove_ipset_entries(pid(), [key()]) -> ok). remove_ipset_entries(IPSetMgr, KeysToDel) -> dcos_l4lb_ipset_mgr:remove_entries(IPSetMgr, KeysToDel). %%%=================================================================== %%% IPVS functions %%%=================================================================== -spec(prepare_vips([{key(), [backend()]}]) -> [{key(), [ipportweight()]}]). prepare_vips(VIPs) -> lists:map(fun ({VIP, BEs}) -> {VIP, [{{BackendIP, BackendPort}, BackendWeight} || {_AgentIP, {BackendIP, BackendPort, BackendWeight}} <- BEs]} end, VIPs). %%%=================================================================== %%% IPVS Apply functions %%%=================================================================== -type diff_vips() :: {ToAdd :: [{key(), [ipportweight()]}], ToDel :: [{key(), [ipportweight()]}], ToMod :: [{key(), [ipportweight()], [ipportweight()]}]}. -spec(apply_vips_diff(pid(), namespace(), diff_vips()) -> ok). apply_vips_diff(IPVSMgr, Namespace, {ToAdd, ToDel, ToMod}) -> lists:foreach(fun (VIP) -> vip_del(IPVSMgr, Namespace, VIP) end, ToDel), lists:foreach(fun (VIP) -> vip_add(IPVSMgr, Namespace, VIP) end, ToAdd), lists:foreach(fun (VIP) -> vip_mod(IPVSMgr, Namespace, VIP) end, ToMod). -spec(vip_add(pid(), namespace(), {key(), [ipportweight()]}) -> ok). vip_add(IPVSMgr, Namespace, {{Protocol, IP, Port}, BEs}) -> dcos_l4lb_ipvs_mgr:add_service(IPVSMgr, IP, Port, Protocol, Namespace), lists:foreach(fun ({{BEIP, BEPort}, BEWeight}) -> dcos_l4lb_ipvs_mgr:add_dest( IPVSMgr, IP, Port, BEIP, BEPort, Protocol, Namespace, BEWeight) end, BEs). -spec(vip_del(pid(), namespace(), {key(), [ipportweight()]}) -> ok). vip_del(IPVSMgr, Namespace, {{Protocol, IP, Port}, _BEs}) -> dcos_l4lb_ipvs_mgr:remove_service(IPVSMgr, IP, Port, Protocol, Namespace). -spec(vip_mod(pid(), namespace(), {key(), [ipportweight()], [ipportweight()]}) -> ok). vip_mod(IPVSMgr, Namespace, {{Protocol, IP, Port}, ToAdd, ToDel}) -> {ToMod, ToAdd0, ToDel0} = vip_extract_mod(ToAdd, ToDel), lists:foreach(fun ({{BEIP, BEPort}, BEWeight}) -> dcos_l4lb_ipvs_mgr:mod_dest( IPVSMgr, IP, Port, BEIP, BEPort, Protocol, Namespace, BEWeight) end, ToMod), lists:foreach(fun ({{BEIP, BEPort}, BEWeight}) -> dcos_l4lb_ipvs_mgr:add_dest( IPVSMgr, IP, Port, BEIP, BEPort, Protocol, Namespace, BEWeight) end, ToAdd0), lists:foreach(fun ({{BEIP, BEPort}, _BEWeight}) -> dcos_l4lb_ipvs_mgr:remove_dest( IPVSMgr, IP, Port, BEIP, BEPort, Protocol, Namespace) end, ToDel0). -spec(vip_extract_mod([ipportweight()], [ipportweight()]) -> {[ipportweight()], [ipportweight()], [ipportweight()]}). vip_extract_mod(ToAdd, ToDel) -> ToMod = [ {K, V} || {K, V} <- ToAdd, lists:keymember(K, 1, ToDel) ], {ToMod, [ {K, V} || {K, V} <- ToAdd, not(lists:keymember(K, 1, ToMod)) ], [ {K, V} || {K, V} <- ToDel, not(lists:keymember(K, 1, ToMod)) ]}. -spec(vip_diff_size(diff_vips()) -> non_neg_integer()). vip_diff_size({ToAdd, ToDel, ToMod}) -> ToAddSize = lists:sum([length(V) || {_K, V} <- ToAdd]), ToDelSize = lists:sum([length(V) || {_K, V} <- ToDel]), ToModSize = lists:sum([length(A) + length(B) || {_K, A, B} <- ToMod]), ToAddSize + ToDelSize + ToModSize. %%%=================================================================== %%% Diff functions %%%=================================================================== %% @doc Return {A\B, B\A, [{Key, Va\Vb, Vb\Va}]} -spec(diff([{A, B}], [{A, B}]) -> {[{A, B}], [{A, B}], [{A, B, B}]} when A :: term(), B :: term()). diff(ListA, ListB) -> diff(lists:sort(ListA), lists:sort(ListB), [], [], []). -spec(diff([{A, B}], [{A, B}], [{A, B}], [{A, B}], [{A, B, B}]) -> {[{A, B}], [{A, B}], [{A, B, B}]} when A :: term(), B :: term()). diff([{Key, Va}|ListA], [{Key, Vb}|ListB], Acc, Bcc, Mcc) -> case dcos_net_utils:complement(Vb, Va) of {[], []} -> diff(ListA, ListB, Acc, Bcc, Mcc); {Ma, Mb} -> diff(ListA, ListB, Acc, Bcc, [{Key, Ma, Mb}|Mcc]) end; diff([A|_]=ListA, [B|ListB], Acc, Bcc, Mcc) when A > B -> diff(ListA, ListB, [B|Acc], Bcc, Mcc); diff([A|ListA], [B|_]=ListB, Acc, Bcc, Mcc) when A < B -> diff(ListA, ListB, Acc, [A|Bcc], Mcc); diff([], ListB, Acc, Bcc, Mcc) -> {ListB ++ Acc, Bcc, Mcc}; diff(ListA, [], Acc, Bcc, Mcc) -> {Acc, ListA ++ Bcc, Mcc}. %%%=================================================================== %%% Reachability functions %%%=================================================================== -spec(healthy_vips(VIPs, Nodes, Tree) -> VIPs when VIPs :: [{key(), [backend()]}], Nodes :: #{inet:ip4_address() => node()}, Tree :: lashup_gm_route:tree()). healthy_vips(VIPs, Nodes, Tree) when map_size(Tree) =:= 0; map_size(Nodes) =:= 0 -> VIPs; healthy_vips(VIPs, Nodes, Tree) -> Agents = agents(VIPs, Nodes, Tree), Result = lists:map(fun ({VIP, BEs}) -> {Healthy, BEs0} = healthy_backends(BEs, Agents), {{VIP, BEs0}, {length(BEs), Healthy}} end, VIPs), {VIPs0, Stat} = lists:unzip(Result), % Stat :: [{AllBackends, HealthyBackends}] update_gauge(backends, lists:sum([B || {B, _H} <- Stat])), update_gauge(unreachable_backends, lists:sum([B - H || {B, H} <- Stat])), update_gauge(unreachable_vips, length([B || {B, 0} <- Stat, B =/= 0])), VIPs0. -spec(agents(VIPs, Nodes, Tree) -> #{inet:ip4_address() => boolean()} when VIPs :: [{key(), [backend()]}], Nodes :: #{inet:ip4_address() => node()}, Tree :: lashup_gm_route:tree()). agents(VIPs, Nodes, Tree) -> AgentIPs = lists:flatmap(fun ({_VIP, BEs}) -> [AgentIP || {AgentIP, _BE} <- BEs] end, VIPs), AgentIPs0 = lists:usort(AgentIPs), Result = [{IP, is_reachable(IP, Nodes, Tree)} || IP <- AgentIPs0], Unreachable = [IP || {IP, false} <- Result], [ ?LOG_WARNING( "L4LB unreachable agent nodes, size: ~p, ~p", [length(Unreachable), Unreachable]) || Unreachable =/= [] ], update_gauge(unreachable_nodes, length(Unreachable)), maps:from_list(Result). -spec(healthy_backends([backend()], Agents) -> {non_neg_integer(), [backend()]} when Agents :: #{inet:ip4_address() => boolean()}). healthy_backends(BEs, Agents) -> case [BE || BE={IP, _BE} <- BEs, maps:get(IP, Agents)] of [] -> {0, BEs}; BEs0 -> {length(BEs0), BEs0} end. -spec(is_reachable(inet:ip4_address(), Nodes, Tree) -> boolean() when Nodes :: #{inet:ip4_address() => node()}, Tree :: lashup_gm_route:tree()). is_reachable(AgentIP, Nodes, Tree) -> case maps:find(AgentIP, Nodes) of {ok, Node} -> Distance = lashup_gm_route:distance(Node, Tree), Distance =/= infinity; error -> false end. %%%=================================================================== %%% Logging functions %%%=================================================================== -spec(namespace2bin(term()) -> binary()). namespace2bin(host) -> <<"host">>; namespace2bin(Namespace) -> String = try io_lib:format("~s", [Namespace]) catch error:badarg -> io_lib:format("~p", [Namespace]) end, iolist_to_binary(String). -spec(log_vips_diff(diff_vips()) -> ok). log_vips_diff(Diff) -> log_vips_diff(<<>>, Diff). -spec(log_vips_diff(binary(), diff_vips()) -> ok). log_vips_diff(Prefix, {ToAdd, ToDel, ToMod}) -> lists:foreach(fun ({{Proto, VIP, Port}, Backends}) -> ?LOG_NOTICE( "~sVIP service was added: ~p://~s:~p, Backends: ~p", [Prefix, Proto, inet:ntoa(VIP), Port, Backends]) end, ToAdd), lists:foreach(fun ({{Proto, VIP, Port}, _BEs}) -> ?LOG_NOTICE( "~sVIP service was deleted: ~p://~s:~p", [Prefix, Proto, inet:ntoa(VIP), Port]) end, ToDel), lists:foreach(fun ({{Proto, VIP, Port}, Added, Removed}) -> ?LOG_NOTICE( "~sVIP service was modified: ~p://~s:~p, Backends: +~p -~p", [Prefix, Proto, inet:ntoa(VIP), Port, Added, Removed]) end, ToMod). -spec(log_routes_diff(diff_routes()) -> ok). log_routes_diff(Diff) -> log_routes_diff(<<>>, Diff). -spec(log_routes_diff(binary(), diff_routes()) -> ok). log_routes_diff(Prefix, {ToAdd, ToDel}) -> [ ?LOG_NOTICE( "~sVIP routes were added, routes: ~p, IPs: ~p", [Prefix, length(ToAdd), ToAdd]) || ToAdd =/= [] ], [ ?LOG_NOTICE( "~sVIP routes were removed, routes: ~p, IPs: ~p", [Prefix, length(ToDel), ToDel]) || ToDel =/= [] ], ok. -spec(log_ipset_diff(diff_keys()) -> ok). log_ipset_diff({ToAdd, ToDel}) -> IPSetEnabled = dcos_l4lb_config:ipset_enabled(), [ ?LOG_NOTICE( "VIPs were added to ipset: ~p", [ToAdd]) || ToAdd =/= [], IPSetEnabled ], [ ?LOG_NOTICE( "VIPs were removed from ipset: ~p", [ToDel]) || ToDel =/= [], IPSetEnabled ], ok. -spec(log_netns_diff(Namespaces, Namespaces) -> ok when Namespaces :: term()). log_netns_diff(Namespaces, Namespaces) -> ok; log_netns_diff(Namespaces, _PrevNamespaces) -> <<", ", Str/binary>> = << <<", ", (namespace2bin(Namespace))/binary>> || Namespace <- Namespaces>>, ?LOG_NOTICE("L4LB network namespaces: ~s", [Str]). %%%=================================================================== %%% Network Namespace functions %%%=================================================================== -spec(handle_netns_event(EventType, [netns()], state()) -> state() when EventType :: add_netns | remove_netns | reconcile_netns). handle_netns_event(remove_netns, ToDel, #state{ipvs_mgr=IPVSMgr, route_mgr=RouteMgr, namespaces=Prev}=State) -> Namespaces = dcos_l4lb_route_mgr:remove_netns(RouteMgr, ToDel), Namespaces = dcos_l4lb_ipvs_mgr:remove_netns(IPVSMgr, ToDel), Result = ordsets:subtract(Prev, ordsets:from_list(Namespaces)), log_netns_diff(Result, Prev), update_gauge(netns, ordsets:size(Result)), State#state{namespaces=Result}; handle_netns_event(add_netns, ToAdd, #state{ipvs_mgr=IPVSMgr, route_mgr=RouteMgr, namespaces=Prev}=State) -> Namespaces = dcos_l4lb_route_mgr:add_netns(RouteMgr, ToAdd), Namespaces = dcos_l4lb_ipvs_mgr:add_netns(IPVSMgr, ToAdd), Result = ordsets:union(ordsets:from_list(Namespaces), Prev), log_netns_diff(Result, Prev), update_gauge(netns, ordsets:size(Result)), State#state{namespaces=Result}; handle_netns_event(reconcile_netns, Namespaces, State) -> handle_netns_event(add_netns, Namespaces, State). %%%=================================================================== %%% Local Port Mappings functions %%%=================================================================== -spec(vips_port_mappings(VIPs) -> VIPs when VIPs :: [{key(), [backend()]}]). vips_port_mappings(VIPs) -> PMs = local_port_mappings(), AgentIP = dcos_net_dist:nodeip(), % Remove port mappings for local backends. lists:map(fun ({{Protocol, VIP, VIPPort}, BEs}) -> BEs0 = bes_port_mappings(PMs, Protocol, AgentIP, BEs), {{Protocol, VIP, VIPPort}, BEs0} end, VIPs). be_port_mapping(PMs, Protocol, AgentIP, BEAgentIP, BE) -> case BE of {BEIP, BEPort, Weight} -> Weight = Weight; {BEIP, BEPort} -> Weight = 1 end, case BEIP of AgentIP -> case maps:find({Protocol, BEPort}, PMs) of {ok, {IP, Port}} -> {BEAgentIP, {IP, Port, Weight}}; error -> {BEAgentIP, {BEIP, BEPort, Weight}} end; _ -> {BEAgentIP, {BEIP, BEPort, Weight}} end. -spec(bes_port_mappings(PMs, tcp | udp, AgentIP, [backend()]) -> [backend()] when PMs :: #{Host => Container}, AgentIP :: inet:ip4_address(), Host :: {tcp | udp, inet:port_number()}, Container :: {inet:ip_address(), inet:port_number()}). bes_port_mappings(PMs, Protocol, AgentIP, BEs) -> lists:map( fun ({BEAgentIP, BE}) -> be_port_mapping(PMs, Protocol, AgentIP, BEAgentIP, BE) end, BEs). %%%=================================================================== %%% GC funtions %%%=================================================================== -spec(handle_gc(state()) -> state()). handle_gc(#state{ipvs_mgr=IPVSMgr, route_mgr=RouteMgr, ipset_mgr=IPSetMgr, netns_mgr=NetNSMgr}=State) -> true = erlang:garbage_collect(IPVSMgr), true = erlang:garbage_collect(RouteMgr), true = erlang:garbage_collect(IPSetMgr), true = erlang:garbage_collect(NetNSMgr), State. %%%=================================================================== %%% Local Port Mappings API functions %%%=================================================================== -spec(init_local_port_mappings() -> local_port_mappings). init_local_port_mappings() -> try ets:new(local_port_mappings, [public, named_table]) catch error:badarg -> local_port_mappings end. -spec(local_port_mappings([{Host, Container}] | #{Host => Container}) -> true when Host :: {tcp | udp, inet:port_number()}, Container :: {inet:ip_address(), inet:port_number()}). local_port_mappings(PortMappings) when is_list(PortMappings) -> PortMappings0 = maps:from_list(PortMappings), local_port_mappings(PortMappings0); local_port_mappings(PortMappings) -> try true = ets:insert(local_port_mappings, {pm, PortMappings}) catch error:badarg -> true end. -spec(local_port_mappings() -> #{Host => Container} when Host :: {tcp | udp, inet:port_number()}, Container :: {inet:ip_address(), inet:port_number()}). local_port_mappings() -> try ets:lookup(local_port_mappings, pm) of [{pm, PortMappings}] -> PortMappings; [] -> #{} catch error:badarg -> #{} end. %%%=================================================================== %%% Metrics functions %%%=================================================================== -spec(update_counter(atom(), non_neg_integer()) -> ok). update_counter(Name, Value) -> prometheus_counter:inc(l4lb, Name, [], Value). -spec(update_gauge(atom(), non_neg_integer()) -> ok). update_gauge(Name, Value) -> prometheus_gauge:set(l4lb, Name, [], Value). -spec(update_summary(atom(), non_neg_integer()) -> ok). update_summary(Name, Value) -> prometheus_summary:observe(l4lb, Name, [], Value). -spec(init_metrics() -> ok). init_metrics() -> ok = dcos_l4lb_ipvs_mgr:init_metrics(), ok = dcos_l4lb_route_mgr:init_metrics(), ok = dcos_l4lb_ipset_mgr:init_metrics(), init_vips_metrics(), init_reconciled_metrics(), init_unreachable_metrics(). -spec(init_vips_metrics() -> ok). init_vips_metrics() -> prometheus_gauge:new([ {registry, l4lb}, {name, vips}, {help, "The number of VIP labels."}]), prometheus_gauge:new([ {registry, l4lb}, {name, backends}, {help, "The number of VIP backends."}]), prometheus_gauge:new([ {registry, l4lb}, {name, netns}, {help, "The number of L4LB network namespaces."}]), prometheus_summary:new([ {registry, l4lb}, {name, vips_duration_seconds}, {help, "The time spent processing VIPs configuration."}]). -spec(init_reconciled_metrics() -> ok). init_reconciled_metrics() -> prometheus_counter:new([ {registry, l4lb}, {name, reconciled_routes_total}, {help, "Total number of reconciled routes."}]), prometheus_counter:new([ {registry, l4lb}, {name, reconciled_ipvs_rules_total}, {help, "Total number of reconciled IPVS rules."}]), prometheus_counter:new([ {registry, l4lb}, {name, reconciled_ipset_entries_total}, {help, "Total number of reconciled IPSet entries."}]). -spec(init_unreachable_metrics() -> ok). init_unreachable_metrics() -> prometheus_gauge:new([ {registry, l4lb}, {name, unreachable_backends}, {help, "The number of unreachable VIP backends."}]), prometheus_gauge:new([ {registry, l4lb}, {name, unreachable_vips}, {help, "The number of unreachable VIPs."}]), prometheus_gauge:new([ {registry, l4lb}, {name, unreachable_nodes}, {help, "The number of unreachable nodes."}]). %%%=================================================================== %%% Test functions %%%=================================================================== -ifdef(TEST). -define(BE4, {{1, 2, 3, 4}, 80, 1}). -define(BE4OLD, {{1, 2, 3, 5}, 80}). be_port_mapping_test() -> PMs = #{{tcp, 8080} => {{1, 2, 3, 5}, 80}, {udp, 8181} => {{1, 0, 0, 0, 0, 0, 0, 2}, 80}}, AgentIP = {2, 3, 4, 5}, ?assertEqual( {{2, 3, 4, 5}, {{1, 2, 3, 4}, 80, 1}}, be_port_mapping(PMs, tcp, AgentIP, AgentIP, ?BE4)), ?assertEqual( {{2, 3, 4, 5}, {{1, 2, 3, 5}, 80, 1}}, be_port_mapping(PMs, tcp, AgentIP, AgentIP, ?BE4OLD)). diff_simple_test() -> ?assertEqual( {[], [], []}, diff([], [])), ?assertEqual( {[], [], [{a, [4], [1]}]}, diff([{a, [1, 2, 3]}], [{a, [2, 3, 4]}])), ?assertEqual( {[], [{b, [1, 2, 3]}], []}, diff([{b, [1, 2, 3]}], [])), ?assertEqual( {[{b, [1, 2, 3]}], [], []}, diff([], [{b, [1, 2, 3]}])), ?assertEqual( {[], [], []}, diff([{a, [1, 2, 3]}], [{a, [1, 2, 3]}])), ?assertEqual( {[{b, []}], [{c, []}, {a, []}], []}, diff([{a, []}, {c, []}], [{b, []}])), ?assertEqual( {[], [], []}, diff([{key, [x, y]}], [{key, [y, x]}])). diff_backends_test() -> Key = {<KEY>}, 80}, ?assertEqual( {[], [], [{Key, [ {{10, 0, 1, 107}, 15671}], []} ]}, diff([{Key, [ {{10, 0, 3, 98}, 8895}, {{10, 0, 1, 107}, 16319}, {{10, 0, 1, 107}, 3892} ] }], [{Key, [ {{10, 0, 3, 98}, 8895}, {{10, 0, 1, 107}, 16319}, {{10, 0, 1, 107}, 15671}, {{10, 0, 1, 107}, 3892} ]}]) ), ?assertEqual( {[], [], [{Key, [ {{10, 0, 3, 98}, 12930}, {{10, 0, 1, 107}, 18818} ], []}]}, diff([{Key, [ {{10, 0, 3, 98}, 23520}, {{10, 0, 3, 98}, 1132} ]}], [{Key, [ {{10, 0, 3, 98}, 23520}, {{10, 0, 3, 98}, 12930}, {{10, 0, 3, 98}, 1132}, {{10, 0, 1, 107}, 18818} ]}]) ). diff_services_test() -> ?assertEqual( {[{{tcp, {1, 1, 1, 3}, 80}, [{{10, 0, 0, 3}, 1000}]}], [], []}, diff([ {{tcp, {1, 1, 1, 1}, 80}, [{{10, 0, 0, 1}, 1000}]}, {{tcp, {1, 1, 1, 2}, 80}, [{{10, 0, 0, 2}, 1000}]}, {{tcp, {1, 1, 1, 4}, 80}, [{{10, 0, 0, 4}, 1000}]}, {{tcp, {1, 1, 1, 5}, 80}, [{{10, 0, 0, 5}, 1000}]} ], [ {{tcp, {1, 1, 1, 1}, 80}, [{{10, 0, 0, 1}, 1000}]}, {{tcp, {1, 1, 1, 2}, 80}, [{{10, 0, 0, 2}, 1000}]}, {{tcp, {1, 1, 1, 3}, 80}, [{{10, 0, 0, 3}, 1000}]}, {{tcp, {1, 1, 1, 4}, 80}, [{{10, 0, 0, 4}, 1000}]}, {{tcp, {1, 1, 1, 5}, 80}, [{{10, 0, 0, 5}, 1000}]} ]) ). -endif. <|start_filename|>apps/dcos_l4lb/src/dcos_l4lb_network_sup.erl<|end_filename|> -module(dcos_l4lb_network_sup). -behaviour(supervisor). -export([start_link/0, init/1]). -define(CHILD(Module), #{id => Module, start => {Module, start_link, []}}). start_link() -> supervisor:start_link({local, ?MODULE}, ?MODULE, []). init([]) -> dcos_l4lb_mgr:init_metrics(), {ok, {#{strategy => rest_for_one, intensity => 10000, period => 1}, [?CHILD(dcos_l4lb_mgr) || dcos_l4lb_config:networking()] ++ [?CHILD(dcos_l4lb_lashup_vip_listener)] }}. <|start_filename|>apps/dcos_rest/src/dcos_rest_nodes_handler.erl<|end_filename|> -module(dcos_rest_nodes_handler). -export([ init/2, rest_init/2, allowed_methods/2, content_types_provided/2, get_metadata/2 ]). init(Req, Opts) -> {cowboy_rest, Req, Opts}. rest_init(Req, Opts) -> {ok, Req, Opts}. allowed_methods(Req, State) -> {[<<"GET">>], Req, State}. content_types_provided(Req, State) -> {[ {{<<"application">>, <<"json">>, []}, get_metadata} ], Req, State}. get_metadata(Req, State) -> #{force := Opts} = cowboy_req:match_qs( [{force, fun (_, _) -> {ok, [force_refresh]} end, []}], Req), Data = dcos_net_node:get_metadata(Opts), Result = maps:fold(fun(K, V, Acc) -> [get_node(K, V) | Acc] end, [], Data), {jiffy:encode(Result), Req, State}. %%%=================================================================== %%% Internal functions %%%=================================================================== -spec(get_node(inet:ip4_address(), dcos_net_node:metadata()) -> jiffy:json_object()). get_node(PrivateIP, Metadata) -> #{public_ips := PublicIPs, hostname := Hostname, updated := Updated} = Metadata, #{private_ip => ntoa(PrivateIP), public_ips => [ntoa(IP) || IP <- PublicIPs], hostname => Hostname, updated => iso8601(Updated)}. -spec(iso8601(non_neg_integer()) -> binary()). iso8601(Timestamp) -> Opts = [{unit, millisecond}, {offset, "Z"}], DateTime = calendar:system_time_to_rfc3339(Timestamp, Opts), list_to_binary(DateTime). -spec(ntoa(inet:ip_address()) -> binary()). ntoa(IP) -> iolist_to_binary(inet:ntoa(IP)). <|start_filename|>apps/dcos_net/src/dcos_net_epmd.erl<|end_filename|> -module(dcos_net_epmd). -export([ register_node/3, address_please/3, port_please/2, names/1 ]). -define(DIST_PROTO_VSN, 5). -spec(names(Host) -> {ok, [{Name, Port}]} | {error, Reason} when Host :: atom() | string() | inet:ip_address(), Name :: string(), Port :: non_neg_integer(), Reason :: address | file:posix()). names(_Hostname) -> {ok, [{"dcos-net", port()}, {"navstar", port()}]}. -spec(register_node(Name, Port, Driver) -> {ok, Creation} | {error, Reason} when Name :: string(), Port :: non_neg_integer(), Driver :: atom(), Creation :: 1 .. 3, Reason :: address | file:posix()). register_node(_Name, _Port, _Driver) -> {ok, 1}. -spec(address_please(Name, Address, Family) -> {ok, IP} | term() when Name :: string(), Address :: string(), Family :: atom(), IP :: inet:ip_address()). address_please(_Name, Address, _Family) -> inet:parse_ipv4_address(Address). -spec(port_please(Name, Ip) -> {port, TcpPort, Version} | term() when Name :: string(), Ip :: inet:ip_address(), TcpPort :: inet:port_number(), Version :: 1 .. 5). port_please("navstar", _Ip) -> {port, port(), ?DIST_PROTO_VSN}; port_please("dcos-net", _Ip) -> {port, port(), ?DIST_PROTO_VSN}; port_please(_None, _Ip) -> noport. -spec(port() -> inet:port_number()). port() -> {ok, Port} = dcos_net_app:dist_port(), Port. <|start_filename|>apps/dcos_l4lb/test/dcos_l4lb_netlink_SUITE.erl<|end_filename|> -module(dcos_l4lb_netlink_SUITE). -include_lib("gen_netlink/include/netlink.hrl"). -include("dcos_l4lb.hrl"). -include_lib("common_test/include/ct.hrl"). -export([ all/0, init_per_suite/1, end_per_suite/1, init_per_testcase/2, end_per_testcase/2, enc_generic/1, getfamily/1, test_ipvs_mgr/1, test_route_mgr/1 ]). all() -> [enc_generic, getfamily, test_ipvs_mgr, test_route_mgr]. init_per_suite(Config) -> ok = application:start(prometheus), Config. end_per_suite(Config) -> ok = application:stop(prometheus), Config. init_per_testcase(enc_generic, Config) -> Config; init_per_testcase(TestCase, Config) -> Uid = list_to_integer(string:strip(os:cmd("id -u"), right, $\n)), init_per_testcase(Uid, TestCase, Config). init_per_testcase(0, TestCase, Config) when TestCase == getfamily; TestCase == test_ipvs_mgr -> case file:read_file_info("/sys/module/ip_vs") of {ok, _} -> Config; _ -> {skip, "Either not running on Linux, or ip_vs module not loaded"} end; init_per_testcase(0, _TestCase, Config) -> Config; init_per_testcase(_, _, _) -> {skip, "Not running as root"}. end_per_testcase(_, _Config) -> os:cmd("ip link del minuteman"). enc_generic(_Config) -> Pid = 0, Seq = 0, Flags = [ack, request], Payload = #getfamily{request = [{family_name, "IPVS"}]}, Msg = {netlink, ctrl, Flags, Seq, Pid, Payload}, Out = netlink_codec:nl_enc(generic, Msg), Out = <<32, 0, 0, 0, 16, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 1, 0, 0, 9, 0, 2, 0, 73, 80, 86, 83, 0, 0, 0, 0>>. getfamily(_Config) -> {ok, Pid} = gen_netlink_client:start_link(), {ok, _Family} = gen_netlink_client:get_family(Pid, "IPVS"). test_ipvs_mgr(_Config) -> %% Reset IPVS State ok = dcos_l4lb_ipvs_mgr:init_metrics(), {ok, Pid} = dcos_l4lb_ipvs_mgr:start_link(), "" = os:cmd("ipvsadm -C"), [] = dcos_l4lb_ipvs_mgr:get_services(Pid, host), false = has_vip({4, 4, 4, 4}, 80), ok = dcos_l4lb_ipvs_mgr:add_service(Pid, {4, 4, 4, 4}, 80, tcp, host), true = has_vip({4, 4, 4, 4}, 80). has_vip(IP, Port) -> Data = os:cmd("ipvsadm-save -n"), VIPEntry0 = io_lib:format("-A -t ~s:~B", [inet:ntoa(IP), Port]), VIPEntry1 = lists:flatten(VIPEntry0), 0 =/= string:str(Data, VIPEntry1). %has_backend(_VIP = {VIPIP, VIPPort}, _BE = {BEIP, BEPort}) -> % Data = os:cmd("ipvsadm-save -n"), % BEEntry0 = io_lib:format("-A -t ~s:~B -r ~s:~B", [inet:ntoa(VIPIP), VIPPort, inet:ntoa(BEIP), BEPort]), % BEEntry1 = lists:flatten(BEEntry0), % 0 =/= string:str(Data, BEEntry1). routes() -> Data = os:cmd("ip route show table local"), Lines = string:tokens(Data, "\n"), Routes = lists:map(fun string:strip/1, Lines), ct:pal("got routes ~p", [Routes]), lists:map(fun remove_dup_spaces/1, Routes). remove_dup_spaces(Str) -> string:join(string:tokens(Str, " "), " "). get_routes(Pid) -> ordsets:to_list(dcos_l4lb_route_mgr:get_routes(Pid, host)). test_route_mgr(_Config) -> os:cmd("ip link add minuteman type dummy"), ok = dcos_l4lb_route_mgr:init_metrics(), {ok, Pid} = dcos_l4lb_route_mgr:start_link(), [] = get_routes(Pid), dcos_l4lb_route_mgr:add_routes(Pid, [{1, 2, 3, 4}], host), R = "local 1.2.3.4 dev minuteman scope host", true = lists:member(R, routes()), [{1, 2, 3, 4}] = get_routes(Pid), dcos_l4lb_route_mgr:remove_routes(Pid, [{1, 2, 3, 4}], host), false = lists:member(R, routes()), [] = get_routes(Pid). <|start_filename|>apps/dcos_net/src/dcos_net_utils.erl<|end_filename|> -module(dcos_net_utils). -export([ complement/2, system/1, system/2, join/2 ]). %%%=================================================================== %%% Complement functions %%%=================================================================== %% @doc Return {A\B, B\A} -spec(complement([A], [B]) -> {[A], [B]} when A :: term(), B :: term()). complement(ListA, ListB) -> complement( lists:sort(ListA), lists:sort(ListB), [], [], 0). -spec(complement([A], [B], [A], [B], R) -> {[A], [B]} when A :: term(), B :: term(), R :: non_neg_integer()). complement(ListA, ListB, Acc, Bcc, R) when R > 10000 -> % NOTE: VM doesn't increment reductions in the complement function. % Sysmon shows that on huge lists it regurarly blocks schedulers. % We have to increment recuctions manually to force a context switch. erlang:bump_reductions(1000), complement(ListA, ListB, Acc, Bcc, 0); complement([], ListB, Acc, Bcc, _R) -> {Acc, ListB ++ Bcc}; complement(ListA, [], Acc, Bcc, _R) -> {ListA ++ Acc, Bcc}; complement(List, List, Acc, Bcc, _R) -> {Acc, Bcc}; complement([A|ListA], [A|ListB], Acc, Bcc, R) -> complement(ListA, ListB, Acc, Bcc, R + 1); complement([A|_]=ListA, [B|ListB], Acc, Bcc, R) when A > B -> complement(ListA, ListB, Acc, [B|Bcc], R + 1); complement([A|ListA], [B|_]=ListB, Acc, Bcc, R) when A < B -> complement(ListA, ListB, [A|Acc], Bcc, R + 1). %%%=================================================================== %%% System functions %%%=================================================================== -spec(system([binary()]) -> {ok, binary()} | {error, atom() | {exit_status, non_neg_integer()}}). system(Command) -> system(Command, 5000). -spec(system([binary()], non_neg_integer()) -> {ok, binary()} | {error, atom() | {exit_status, non_neg_integer()}}). system([Command|Args], Timeout) -> Opts = [exit_status, binary, {args, Args}], EndTime = erlang:monotonic_time(millisecond) + Timeout, try erlang:open_port({spawn_executable, Command}, Opts) of Port -> system_loop(Port, EndTime, <<>>) catch error:Error -> {error, Error} end. -spec(system_loop(port(), integer(), binary()) -> {ok, binary()} | {error, atom() | {exit_status, non_neg_integer()}}). system_loop(Port, EndTime, Acc) -> Timeout = EndTime - erlang:monotonic_time(millisecond), receive {Port, {data, Data}} -> system_loop(Port, EndTime, <<Acc/binary, Data/binary>>); {Port, {exit_status, 0}} -> {ok, Acc}; {Port, {exit_status, ExitCode}} -> {error, {exit_status, ExitCode}} after Timeout -> erlang:port_close(Port), {error, timeout} end. %%%=================================================================== %%% Binary functions %%%=================================================================== -spec(join([binary()], binary()) -> binary()). join([], _Sep) -> <<>>; join(List, Sep) -> SepSize = size(Sep), <<Sep:SepSize/binary, Result/binary>> = << <<Sep/binary, X/binary>> || X <- List >>, Result. <|start_filename|>apps/dcos_dns/src/dcos_dns_handler.erl<|end_filename|> -module(dcos_dns_handler). -include("dcos_dns.hrl"). -include_lib("kernel/include/logger.hrl"). -include_lib("dns/include/dns_records.hrl"). -define(TIMEOUT, 5000). %% API -export([ start/3, resolve/3, init_metrics/0 ]). %% Private functions -export([start_link/4, init/5, worker/4]). -export_type([reply_fun/0, protocol/0]). -type reply_fun() :: fun ((binary()) -> ok | {error, term()}) | {fun ((...) -> ok | {error, term()}), [term()]} | skip. -type protocol() :: udp | tcp. -spec(start(protocol(), binary(), reply_fun()) -> {ok, pid()} | {error, term()}). start(Protocol, Request, Fun) -> Begin = erlang:monotonic_time(), Args = [Begin, Protocol, Request, Fun], case sidejob_supervisor:start_child(dcos_dns_handler_sj, ?MODULE, start_link, Args) of {error, Error} -> ?LOG_ERROR("Unexpected error: ~p", [Error]), {error, Error}; {ok, Pid} -> {ok, Pid} end. -spec(resolve(protocol(), binary(), timeout()) -> {ok, binary()} | {error, atom()}). resolve(Protocol, Request, Timeout) -> Ref = make_ref(), Fun = {fun resolve_reply_fun/3, [self(), Ref]}, case dcos_dns_handler:start(Protocol, Request, Fun) of {ok, Pid} -> MonRef = erlang:monitor(process, Pid), receive {reply, Ref, Response} -> erlang:demonitor(MonRef, [flush]), {ok, Response}; {'DOWN', MonRef, process, _Pid, Reason} -> {error, Reason} after Timeout -> {error, timeout} end; {error, Error} -> {error, Error} end. %%%=================================================================== %%% Internal functions %%%=================================================================== -spec(start_link(Begin, protocol(), Request, reply_fun()) -> {ok, pid()} when Begin :: integer(), Request :: binary()). start_link(Begin, Protocol, Request, Fun) -> Args = [Begin, self(), Protocol, Request, Fun], proc_lib:start_link(?MODULE, init, Args). -spec(init(Begin, pid(), protocol(), Request, reply_fun()) -> ok when Begin :: integer(), Request :: binary()). init(Begin, Parent, Protocol, Request, Fun) -> proc_lib:init_ack(Parent, {ok, self()}), DNSMessage = #dns_message{} = dns:decode_message(Request), Questions = DNSMessage#dns_message.questions, case dcos_dns_router:upstreams_from_questions(Questions) of {[], Zone} -> Response = failed_msg(Protocol, DNSMessage), ok = reply(Begin, Fun, Response, Zone), prometheus_counter:inc(dns, forwarder_failures_total, [Zone], 1); {internal, Zone} -> ResponseMsg = internal_resolve(DNSMessage), Response = encode_message(Protocol, ResponseMsg), ok = reply(Begin, Fun, Response, Zone); {rename, From, To} -> DNSMessage0 = rename(DNSMessage, From, To), ResponseMsg = internal_resolve(DNSMessage0), ResponseMsg0 = rename(ResponseMsg, To, From), Response = encode_message(Protocol, ResponseMsg0), ok = reply(Begin, Fun, Response, To); {Upstreams, Zone} -> FailMsg = failed_msg(Protocol, DNSMessage), Upstreams0 = take_upstreams(Upstreams), resolve(Begin, Protocol, Upstreams0, Request, Fun, FailMsg, Zone) end. -spec(reply(integer(), reply_fun(), binary(), binary()) -> ok | {error, term()}). reply(_Begin, skip, _Response, _Zone) -> ok; reply(Begin, {Fun, Args}, Response, Zone) -> try apply(Fun, Args ++ [Response]) after prometheus_histogram:observe( dns, forwarder_requests_duration_seconds, [Zone], erlang:monotonic_time() - Begin) end; reply(Begin, Fun, Response, Zone) -> reply(Begin, {Fun, []}, Response, Zone). -spec(resolve_reply_fun(pid(), reference(), binary()) -> ok). resolve_reply_fun(Pid, Ref, Response) -> Pid ! {reply, Ref, Response}, ok. %%%=================================================================== %%% Resolvers %%%=================================================================== -define(LOCALHOST, {127, 0, 0, 1}). -spec(internal_resolve(dns:message()) -> dns:message()). internal_resolve(DNSMessage) -> Response = erldns_handler:do_handle(DNSMessage, ?LOCALHOST), randomize(Response). -spec(resolve(Begin, Protocol, Upstreams, Request, Fun, FailMsg, Zone) -> ok when Begin :: integer(), Protocol :: protocol(), Upstreams :: [upstream()], Request :: binary(), Fun :: reply_fun(), FailMsg :: binary(), Zone :: binary()). resolve(Begin, Protocol, Upstreams, Request, Fun, FailMsg, Zone) -> Workers = lists:map(fun (Upstream) -> Args = [Protocol, self(), Upstream, Request], Pid = proc_lib:spawn(?MODULE, worker, Args), MonRef = erlang:monitor(process, Pid), {Pid, MonRef} end, Upstreams), resolve_loop(Begin, Workers, Fun, FailMsg, Zone). -spec(resolve_loop(Begin, Workers, Fun, FailMsg, Zone) -> ok when Begin :: integer(), Workers :: [{pid(), reference()}], Fun :: reply_fun(), FailMsg :: binary(), Zone :: binary()). resolve_loop(_Begin, [], skip, _FailMsg, _Zone) -> ok; resolve_loop(Begin, [], Fun, FailMsg, Zone) -> prometheus_counter:inc(dns, forwarder_failures_total, [Zone], 1), ok = reply(Begin, Fun, FailMsg, Zone); resolve_loop(Begin, Workers, Fun, FailMsg, Zone) -> receive {reply, Pid, Response} -> {value, {Pid, MonRef}, Workers0} = lists:keytake(Pid, 1, Workers), _ = reply(Begin, Fun, Response, Zone), erlang:demonitor(MonRef, [flush]), resolve_loop(Begin, Workers0, skip, FailMsg, Zone); {'DOWN', MonRef, process, Pid, _Reason} -> {value, {Pid, MonRef}, Workers0} = lists:keytake(Pid, 1, Workers), resolve_loop(Begin, Workers0, Fun, FailMsg, Zone) after 2 * ?TIMEOUT -> lists:foreach(fun ({Pid, MonRef}) -> erlang:demonitor(MonRef, [flush]), Pid ! {timeout, self()} end, Workers), resolve_loop(Begin, [], Fun, FailMsg, Zone) end. %%%=================================================================== %%% Workers %%%=================================================================== -spec(worker(protocol(), pid(), upstream(), binary()) -> ok). worker(Protocol, Pid, Upstream, Request) -> Begin = erlang:monotonic_time(), UpstreamAddress = upstream_to_binary(Upstream), try worker_resolve(Protocol, Begin, Pid, Upstream, Request) of {ok, Response} -> Pid ! {reply, self(), Response}; {error, Reason} -> ?LOG_WARNING( "DNS worker [~p] ~s failed with ~p", [Protocol, UpstreamAddress, Reason]), prometheus_counter:inc( dns, worker_failures_total, [Protocol, UpstreamAddress, Reason], 1) after prometheus_histogram:observe( dns, worker_requests_duration_seconds, [Protocol, UpstreamAddress], erlang:monotonic_time() - Begin) end. -spec(worker_resolve(protocol(), integer(), pid(), upstream(), binary()) -> {ok, binary()} | {error, atom()}). worker_resolve(udp, Begin, Pid, Upstream, Request) -> udp_worker_resolve(Begin, Pid, Upstream, Request); worker_resolve(tcp, Begin, Pid, Upstream, Request) -> tcp_worker_resolve(Begin, Pid, Upstream, Request). -spec(udp_worker_resolve(integer(), pid(), upstream(), binary()) -> {ok, binary()} | {error, atom()}). udp_worker_resolve(Begin, Pid, {IP, Port}, Request) -> Opts = [{reuseaddr, true}, {active, once}, binary], case gen_udp:open(0, Opts) of {ok, Socket} -> try gen_udp:send(Socket, IP, Port, Request) of ok -> wait_for_response(Begin, Pid, Socket); {error, Reason} -> {error, Reason} after gen_udp:close(Socket) end; {error, Reason} -> {error, Reason} end. -spec(tcp_worker_resolve(integer(), pid(), upstream(), binary()) -> {ok, binary()} | {error, atom()}). tcp_worker_resolve(Begin, Pid, {IP, Port}, Request) -> Opts = [{active, once}, binary, {packet, 2}, {send_timeout, ?TIMEOUT}], case gen_tcp:connect(IP, Port, Opts, ?TIMEOUT) of {ok, Socket} -> try gen_tcp:send(Socket, Request) of ok -> wait_for_response(Begin, Pid, Socket); {error, Reason} -> {error, Reason} after gen_tcp:close(Socket) end; {error, Reason} -> {error, Reason} end. -spec(wait_for_response(integer(), pid(), Socket) -> {ok, binary()} | {error, atom()} when Socket :: gen_udp:socket() | gen_tcp:socket()). wait_for_response(Begin, Pid, Socket) -> Diff = erlang:monotonic_time() - Begin, Timeout = ?TIMEOUT - erlang:convert_time_unit(Diff, native, millisecond), MonRef = erlang:monitor(process, Pid), try receive {'DOWN', MonRef, process, _Pid, _Reason} -> {error, down}; {udp, Socket, _IP, _Port, Response} -> {ok, Response}; {tcp, Socket, Response} -> {ok, Response}; {tcp_closed, Socket} -> {error, tcp_closed}; {tcp_error, Socket, _Reason} -> {error, tcp_error}; {timeout, Pid} -> {error, timeout} after Timeout -> {error, timeout} end after _ = erlang:demonitor(MonRef, [flush]) end. %%%=================================================================== %%% Upstreams functions %%%=================================================================== -spec(take_upstreams([upstream()]) -> [upstream()]). take_upstreams(Upstreams) when length(Upstreams) < 3 -> Upstreams; take_upstreams(Upstreams) -> Buckets = upstream_buckets(Upstreams), case lists:unzip(Buckets) of {_N, [[_, _ | _] = Bucket | _Buckets]} -> choose(2, Bucket); {_N, [[Upstream], Bucket | _Buckets]} -> [Upstream | choose(1, Bucket)] end. -spec(upstream_failures() -> orddict:orddict(upstream(), pos_integer())). upstream_failures() -> AllFailures = prometheus_counter:values(dns, worker_failures_total), Failures = [{Address, Count} || {Labels, Count} <- AllFailures, {"upstream_address", Address} <- Labels], lists:foldl(fun ({Address, Count}, Acc) -> orddict:update_counter(Address, Count, Acc) end, orddict:new(), Failures). -spec(upstream_buckets([upstream()]) -> orddict:orddict(non_neg_integer(), [upstream()])). upstream_buckets(Upstreams) -> Failures = upstream_failures(), lists:foldl(fun (Upstream, Acc) -> Address = upstream_to_binary(Upstream), Count = case orddict:find(Address, Failures) of {ok, N} -> N; error -> 0 end, orddict:append_list(Count, [Upstream], Acc) end, orddict:new(), Upstreams). -spec(choose(N :: pos_integer(), [T]) -> [T] when T :: any()). choose(1, [Element]) -> [Element]; choose(N, List) -> % Shuffle list and take N first elements List0 = [{rand:uniform(), X} || X <- List], List1 = lists:sort(List0), List2 = [X || {_, X} <- List1], lists:sublist(List2, N). -spec(upstream_to_binary(upstream()) -> binary()). upstream_to_binary({Ip, Port}) -> IpBin = list_to_binary(inet:ntoa(Ip)), PortBin = integer_to_binary(Port), <<IpBin/binary, ":", PortBin/binary>>. %%%=================================================================== %%% Rename functions %%%=================================================================== -define(RENAME_FIELDS, #{ ?DNS_TYPE_CNAME => [#dns_rrdata_cname.dname], ?DNS_TYPE_NS => [#dns_rrdata_ns.dname], ?DNS_TYPE_SOA => [#dns_rrdata_soa.mname, #dns_rrdata_soa.rname], ?DNS_TYPE_SRV => [#dns_rrdata_srv.target] }). -spec(rename(term(), From :: binary(), To :: binary()) -> term()). rename(DNSMessage, From, To) when is_record(DNSMessage, dns_message) -> #dns_message{ questions = Questions, answers = Answers, authority = Authority, additional = Additional } = DNSMessage, DNSMessage#dns_message{ questions = rename(Questions, From, To), answers = rename(Answers, From, To), authority = rename(Authority, From, To), additional = rename(Additional, From, To) }; rename(#dns_query{name = Name} = Query, From, To) -> Query#dns_query{name = rename(Name, From, To)}; rename(#dns_rr{name = Name, type = Type, data = Data} = RR, From, To) -> Data0 = lists:foldl(fun (N, Acc) -> Value = element(N, Acc), Value0 = rename(Value, From, To), setelement(N, Acc, Value0) end, Data, maps:get(Type, ?RENAME_FIELDS, [])), RR#dns_rr{name = rename(Name, From, To), data = Data0}; rename(List, From, To) when is_list(List) -> [ rename(L, From, To) || L <- List ]; rename(Bin, From, To) when is_binary(Bin) -> replace(Bin, From, To); rename(Term, _From, _To) -> Term. -spec(replace(Bin | [Bin], From :: Bin, To :: Bin) -> Bin | [Bin] when Bin :: binary()). replace(Bin, From, To) when is_binary(Bin)-> case split(Bin) of [<<>> | List] -> List0 = [<<>> | replace(List, From, To)], join(List0); List -> List0 = replace(List, From, To), join(List0) end; replace(List, From, To) when is_list(List)-> [<<>> | FromL] = split(From), [<<>> | ToL] = split(To), try lists:split(length(FromL), List) of {Head, Tail} -> case [ cowboy_bstr:to_lower(H) || H <- Head ] of FromL -> ToL ++ Tail; _Head -> List end catch error:badarg -> List end. -spec(split(binary()) -> [binary()]). split(Bin) -> List = binary:split(Bin, <<".">>, [global]), lists:reverse(List). -spec(join([binary()]) -> binary()). join(List) -> List0 = lists:reverse(List), dcos_net_utils:join(List0, <<".">>). %%%=================================================================== %%% DNS functions %%%=================================================================== -spec failed_msg(protocol(), dns:message()) -> binary(). failed_msg(Protocol, DNSMessage) -> Reply = DNSMessage#dns_message{ rc = ?DNS_RCODE_SERVFAIL }, encode_message(Protocol, Reply). -spec encode_message(protocol(), dns:message()) -> binary(). encode_message(Protocol, DNSMessage) -> Opts = encode_message_opts(Protocol, DNSMessage), case erldns_encoder:encode_message(DNSMessage, Opts) of {false, EncodedMessage} -> EncodedMessage; {true, EncodedMessage, #dns_message{}} -> EncodedMessage; {false, EncodedMessage, _TsigMac} -> EncodedMessage; {true, EncodedMessage, _TsigMac, _Message} -> EncodedMessage end. -spec encode_message_opts(protocol(), dns:message()) -> [dns:encode_message_opt()]. encode_message_opts(tcp, _DNSMessage) -> []; encode_message_opts(udp, DNSMessage) -> [{max_size, max_payload_size(DNSMessage)}]. -define(MAX_PACKET_SIZE, 512). %% Determine the max payload size by looking for additional %% options passed by the client. -spec max_payload_size(dns:message()) -> pos_integer(). max_payload_size( #dns_message{additional = [#dns_optrr{udp_payload_size = PayloadSize} |_Additional]}) when is_integer(PayloadSize) -> PayloadSize; max_payload_size(_DNSMessage) -> ?MAX_PACKET_SIZE. -spec(randomize(dns:message()) -> dns:message()). randomize(#dns_message{answers=Answers}=DNSMessage) -> % NOTE: The order of CNAME records does matter. {CNameRRs, RRs} = lists:splitwith( fun (#dns_rr{type = Type}) -> Type =:= ?DNS_TYPE_CNAME end, Answers), Policy = dcos_dns_config:loadbalance(), RRs0 = randomize(Policy, DNSMessage, RRs), DNSMessage#dns_message{answers=CNameRRs ++ RRs0}. -spec(randomize(atom(), dns:message(), [dns:rr()]) -> [dns:rr()]). randomize(_Policy, _DNSMessage, []) -> []; randomize(_Policy, _DNSMessage, [RR]) -> [RR]; randomize(round_robin, #dns_message{id=MsgId}, RRs) -> RotBy = MsgId rem length(RRs), {Head, Tail} = lists:split(RotBy, RRs), Tail ++ Head; randomize(random, _DNSMessage, RRs) -> List = [ {RR, rand:uniform()} || RR <- RRs ], [RR || {RR, _R} <- lists:keysort(2, List)]; randomize(_Policy, _DNSMessage, RRs) -> RRs. %%%=================================================================== %%% Metrics functions %%%=================================================================== -spec(init_metrics() -> ok). init_metrics() -> prometheus_counter:new([ {registry, dns}, {name, forwarder_failures_total}, {labels, [zone]}, {help, "Total number of DNS request failures."}]), prometheus_histogram:new([ {registry, dns}, {name, forwarder_requests_duration_seconds}, {labels, [zone]}, {duration_unit, seconds}, {buckets, [0.001, 0.005, 0.010, 0.050, 0.100, 0.500, 1.000, 5.000]}, {help, "The time spent processing DNS requests."}]), prometheus_counter:new([ {registry, dns}, {name, worker_failures_total}, {labels, [protocol, upstream_address, reason]}, {help, "Total number of worker failures processing DNS requests."}]), prometheus_histogram:new([ {registry, dns}, {name, worker_requests_duration_seconds}, {labels, [protocol, upstream_address]}, {duration_unit, seconds}, {buckets, [0.001, 0.005, 0.010, 0.050, 0.100, 0.500, 1.000, 5.000]}, {help, "The time a worker spent processing DNS requests."}]). <|start_filename|>apps/dcos_l4lb/test/dcos_l4lb_mesos_poller_SUITE.erl<|end_filename|> -module(dcos_l4lb_mesos_poller_SUITE). -include_lib("eunit/include/eunit.hrl"). -include_lib("common_test/include/ct.hrl"). -include("dcos_l4lb.hrl"). -export([ all/0, init_per_suite/1, end_per_suite/1, init_per_testcase/2, end_per_testcase/2 ]). -export([ test_lashup/1, test_mesos_portmapping/1, test_app_restart/1, test_task_killing/1, test_task_unhealthy/1 ]). %% root tests all() -> [ test_lashup, test_mesos_portmapping, test_app_restart, test_task_killing, test_task_unhealthy ]. init_per_suite(Config) -> Config. end_per_suite(Config) -> Config. init_per_testcase(_, Config) -> meck:new(dcos_net_dist, [no_link, passthrough]), meck:expect(dcos_net_dist, nodeip, fun () -> node_ip() end), meck:new(dcos_net_mesos_listener, [no_link, passthrough]), meck:new(dcos_l4lb_mgr, [no_link, passthrough]), meck:expect(dcos_l4lb_mgr, local_port_mappings, fun (_) -> ok end), meck:expect(dcos_l4lb_mgr, push_vips, fun (_) -> ok end), Config. end_per_testcase(_, _Config) -> [ begin ok = application:stop(App), ok = application:unload(App) end || {App, _, _} <- application:which_applications(), not lists:member(App, [stdlib, kernel]) ], os:cmd("rm -rf Mnesia.*"), meck:unload(dcos_l4lb_mgr), meck:unload(dcos_net_mesos_listener), meck:unload(dcos_net_dist), dcos_l4lb_ipset_mgr:cleanup(), ok. node_ip() -> {10, 0, 0, 243}. ensure_l4lb_started() -> {ok, _} = application:ensure_all_started(dcos_l4lb), meck:wait(dcos_net_mesos_listener, poll, '_', 5000), meck:wait(dcos_l4lb_mgr, local_port_mappings, '_', 100), timer:sleep(100). meck_mesos_poll_no_tasks() -> {ok, #{}}. meck_mesos_poll_app_task() -> {ok, #{ <<"app.6e53a5c1-1f27-11e6-bc04-4e40412869d8">> => #{ name => <<"app">>, runtime => mesos, framework => <<"marathon">>, agent_ip => node_ip(), task_ip => [{9, 0, 1, 29}], ports => [ #{name => <<"http">>, protocol => tcp, host_port => 12049, port => 80, vip => [<<"merp:5000">>]} ], state => running } }}. meck_mesos_poll_app_task_killing() -> {ok, #{ <<"app.22a97c91-8a25-43ed-8195-e20938687ec3">> => #{ name => <<"app">>, runtime => mesos, framework => <<"marathon">>, agent_ip => node_ip(), task_ip => [{9, 0, 1, 29}], ports => [ #{name => <<"http">>, protocol => tcp, host_port => 12049, port => 80, vip => [<<"merp:5000">>]} ], state => killing } }}. meck_mesos_poll_app_task_unhealthy() -> {ok, #{ <<"app.6e53a5c1-1f27-11e6-bc04-4e40412869d8">> => #{ name => <<"app">>, runtime => mesos, framework => <<"marathon">>, agent_ip => node_ip(), task_ip => [{9, 0, 1, 29}], ports => [ #{name => <<"http">>, protocol => tcp, host_port => 12050, port => 80, vip => [<<"merp:5000">>]} ], state => running, healthy => false } }}. meck_mesos_poll_app_task_after_restart() -> {ok, #{ <<"app.b35733e8-8336-4d21-ae60-f3bc4384a93a">> => #{ name => <<"app">>, runtime => mesos, framework => <<"marathon">>, agent_ip => node_ip(), task_ip => [{9, 0, 1, 30}], ports => [ #{name => <<"http">>, protocol => tcp, host_port => 23176, port => 80, vip => [<<"merp:5000">>]} ], state => running } }}. test_lashup(_Config) -> meck:expect(dcos_net_mesos_listener, poll, fun meck_mesos_poll_app_task/0), ensure_l4lb_started(), Actual = lashup_kv:value(?VIPS_KEY2), ?assertMatch( [{_, [{{10, 0, 0, 243}, {{10, 0, 0, 243}, 12049, 1}}]}], Actual). test_mesos_portmapping(_Config) -> meck:expect(dcos_net_mesos_listener, poll, fun meck_mesos_poll_app_task/0), ensure_l4lb_started(), Actual = meck:capture(first, dcos_l4lb_mgr, local_port_mappings, '_', 1), ?assertMatch( [{{tcp, 12049}, {{9, 0, 1, 29}, 80}}], Actual). test_app_restart(_Config) -> meck:expect(dcos_net_mesos_listener, poll, fun meck_mesos_poll_app_task/0), ensure_l4lb_started(), {ActualPortMappings, ActualVIPs} = retrieve_data(), ?assertMatch([{{tcp, 12049}, {{9, 0, 1, 29}, 80}}], ActualPortMappings), ?assertMatch([{_, [{{10, 0, 0, 243}, {{10, 0, 0, 243}, 12049, 1}}]}], ActualVIPs), meck:expect(dcos_net_mesos_listener, poll, fun meck_mesos_poll_no_tasks/0), {ActualPortMappings2, ActualVIPs2} = retrieve_data(), ?assertMatch([], ActualPortMappings2), ?assertMatch([], ActualVIPs2), meck:expect(dcos_net_mesos_listener, poll, fun meck_mesos_poll_app_task_after_restart/0), {ActualPortMappings3, ActualVIPs3} = retrieve_data(), ?assertMatch([{{tcp, 23176}, {{9, 0, 1, 30}, 80}}], ActualPortMappings3), ?assertMatch([{_, [{{10, 0, 0, 243}, {{10, 0, 0, 243}, 23176, 1}}]}], ActualVIPs3). test_task_killing(_Config) -> meck:expect(dcos_net_mesos_listener, poll, fun meck_mesos_poll_app_task_killing/0), ensure_l4lb_started(), Actual = lashup_kv:value(?VIPS_KEY2), ?assertMatch( [{_, [{{10, 0, 0, 243}, {{10, 0, 0, 243}, 12049, 0}}]}], Actual). test_task_unhealthy(_Config) -> meck:expect(dcos_net_mesos_listener, poll, fun meck_mesos_poll_app_task_unhealthy/0), ensure_l4lb_started(), Actual = lashup_kv:value(?VIPS_KEY2), ?assertMatch( [{_, [{{10, 0, 0, 243}, {{10, 0, 0, 243}, 12050, 0}}]}], Actual). retrieve_data() -> meck:reset(dcos_net_mesos_listener), meck:wait(dcos_net_mesos_listener, poll, '_', 5000), meck:wait(dcos_l4lb_mgr, local_port_mappings, '_', 100), timer:sleep(100), PortMappings = meck:capture( last, dcos_l4lb_mgr, local_port_mappings, '_', 1), VIPs = lashup_kv:value(?VIPS_KEY2), {PortMappings, VIPs}. <|start_filename|>apps/dcos_l4lb/test/dcos_l4lb_restart_SUITE.erl<|end_filename|> -module(dcos_l4lb_restart_SUITE). -include_lib("common_test/include/ct.hrl"). -export([ all/0, init_per_suite/1, end_per_suite/1, test_restart/1 ]). all() -> [test_restart]. init_per_suite(Config) -> os:cmd("ip link del minuteman"), os:cmd("ip link add minuteman type dummy"), Config. end_per_suite(Config) -> os:cmd("ip link del minuteman"), dcos_l4lb_ipset_mgr:cleanup(), [ begin ok = application:stop(App), ok = application:unload(App) end || {App, _, _} <- application:which_applications(), not lists:member(App, [stdlib, kernel]) ], os:cmd("rm -rf Mnesia.*"), Config. test_restart(Config) -> PrivateDir = ?config(priv_dir, Config), lists:foreach(fun (_) -> application:load(dcos_l4lb), application:set_env(dcos_l4lb, agent_dets_basedir, PrivateDir), application:set_env(dcos_l4lb, enable_networking, enable_networking()), {ok, Apps} = application:ensure_all_started(dcos_l4lb), [ ok = application:stop(App) || App <- lists:reverse(Apps) ], [ ok = application:unload(App) || App <- lists:reverse(Apps) ] end, lists:seq(1, 3)). enable_networking() -> os:cmd("id -u") =:= "0\n" andalso os:cmd("modprobe ip_vs") =:= "". <|start_filename|>apps/dcos_dns/src/dcos_dns_sup.erl<|end_filename|> -module(dcos_dns_sup). -behaviour(supervisor). -export([start_link/1, init/1]). -include_lib("kernel/include/logger.hrl"). -define(CHILD(Module), #{id => Module, start => {Module, start_link, []}}). -define(CHILD(Module, Custom), maps:merge(?CHILD(Module), Custom)). start_link(Enabled) -> supervisor:start_link({local, ?MODULE}, ?MODULE, [Enabled]). init([false]) -> {ok, {#{}, []}}; init([true]) -> %% Configure metrics. dcos_dns_handler:init_metrics(), dcos_dns:init_metrics(), %% Setup ready.spartan zone / record ok = dcos_dns_zone_setup(), ok = localhost_zone_setup(), ok = custom_zones_setup(), %% Systemd Sup intentionally goes last Children = [ ?CHILD(dcos_dns_zk_record_server), ?CHILD(dcos_dns_config_loader_server), ?CHILD(dcos_dns_key_mgr, #{restart => transient}), ?CHILD(dcos_dns_listener) ], Children1 = maybe_add_udp_servers(Children), IsMaster = dcos_net_app:is_master(), MChildren = [?CHILD(dcos_dns_mesos_dns) || IsMaster] ++ [?CHILD(dcos_dns_mesos) || IsMaster], sidejob:new_resource( dcos_dns_handler_sj, sidejob_supervisor, dcos_dns_config:handler_limit()), %% The top level sup should never die. {ok, {#{intensity => 10000, period => 1}, MChildren ++ Children1 }}. %%==================================================================== %% Internal functions %%==================================================================== %% @private maybe_add_udp_servers(Children) -> case dcos_dns_config:udp_enabled() of true -> udp_servers() ++ Children; false -> Children end. udp_servers() -> Addresses = dcos_dns_config:bind_ips(), lists:map(fun udp_server/1, Addresses). udp_server(Address) -> #{ id => {dcos_dns_udp_server, Address}, start => {dcos_dns_udp_server, start_link, [Address]} }. localhost_zone_setup() -> dcos_dns:push_zone( <<"localhost">>, [dcos_dns:dns_record(<<"localhost">>, {127, 0, 0, 1})]). dcos_dns_zone_setup() -> dcos_dns:push_zone( <<"spartan">>, [ dcos_dns:dns_record(<<"ready.spartan">>, {127, 0, 0, 1}), dcos_dns:dns_record(<<"ns.spartan">>, {198, 51, 100, 1}) ]). custom_zones_setup() -> Zones = application:get_env(dcos_dns, zones, #{}), maps:fold(fun (ZoneName, Zone, ok) -> ZoneName0 = to_binary(ZoneName), true = validate_zone_name(ZoneName0), Records = lists:map(fun (R) -> record(ZoneName0, R) end, Zone), dcos_dns:push_zone(ZoneName0, Records) end, ok, Zones). -spec validate_zone_name(ZoneName :: binary()) -> boolean(). validate_zone_name(ZoneName) -> case dcos_dns_app:parse_upstream_name(ZoneName) of [<<"directory">>, <<"thisdcos">>, <<"l4lb">> | _Labels] -> false; [<<"directory">>, <<"thisdcos">>, <<"mesos">> | _Labels] -> false; [<<"directory">>, <<"thisdcos">>, <<"dcos">> | _Labels] -> false; [<<"directory">>, <<"thisdcos">>, _Zone | _Labels] -> true; _Labels -> false end. -spec record(ZoneName :: binary(), Record :: maps:map()) -> dns:rr(). record(ZoneName, #{type := cname, name := CName, value := DName}) -> CName0 = list_to_binary(mesos_state:label(CName)), CName1 = <<CName0/binary, ".", ZoneName/binary>>, dcos_dns:cname_record(CName1, to_binary(DName)); record(_ZoneName, Record) -> ?LOG_ERROR("Unexpected format: ~p", [Record]), init:stop(1), error(stop). -spec to_binary(term()) -> binary(). to_binary(Bin) when is_binary(Bin) -> Bin; to_binary(List) when is_list(List) -> list_to_binary(List). <|start_filename|>apps/dcos_dns/src/dcos_dns.erl<|end_filename|> -module(dcos_dns). -include_lib("kernel/include/logger.hrl"). -include("dcos_dns.hrl"). -include_lib("dns/include/dns_records.hrl"). -include_lib("erldns/include/erldns.hrl"). %% API -export([ family/1, resolve/1, resolve/2, resolve/3, get_leader_addr/0, init_metrics/0 ]). %% DNS Zone functions -export([ ns_record/1, soa_record/1, dns_record/2, dns_records/2, srv_record/2, cname_record/2, push_zone/2, push_prepared_zone/2 ]). -spec family(inet:ip_address()) -> inet | inet6. family(IP) when size(IP) == 4 -> inet; family(IP) when size(IP) == 8 -> inet6. -spec(get_leader_addr() -> {ok, inet:ip_address()} | {error, term()}). get_leader_addr() -> case resolve(<<"leader.mesos">>, inet) of {ok, [IP]} -> {ok, IP}; {ok, _IPs} -> {error, not_found}; {error, Error} -> {error, Error} end. -spec(resolve(binary()) -> {ok, [inet:ip_address()]} | {error, term()}). resolve(DNSName) -> resolve(DNSName, inet). -spec(resolve(binary(), inet | inet6) -> {ok, [inet:ip_address()]} | {error, term()}). resolve(DNSName, Family) -> resolve(DNSName, Family, 5000). -spec(resolve(binary(), inet | inet6, timeout()) -> {ok, [inet:ip_address()]} | {error, term()}). resolve(DNSName, Family, Timeout) -> DNSNameStr = binary_to_list(DNSName), ParseFun = case Family of inet -> fun inet:parse_ipv4_address/1; inet6 -> fun inet:parse_ipv6_address/1 end, case ParseFun(DNSNameStr) of {ok, IP} -> {ok, [IP]}; {error, einval} -> imp_resolve(DNSName, Family, Timeout) end. -spec(imp_resolve(binary(), inet | inet6, timeout()) -> {ok, [inet:ip_address()]} | {error, term()}). imp_resolve(<<"localhost">>, inet, _Timeout) -> {ok, [{127, 0, 0, 1}]}; imp_resolve(DNSName, Family, Timeout) -> Type = case Family of inet -> ?DNS_TYPE_A; inet6 -> ?DNS_TYPE_AAAA end, Query = #dns_query{name = DNSName, type = Type}, Message = #dns_message{rd = true, qc = 1, questions = [Query]}, Request = dns:encode_message(Message), case dcos_dns_handler:resolve(udp, Request, Timeout) of {ok, Response} -> try dns:decode_message(Response) of #dns_message{answers = RRs} -> DataRRs = [D || #dns_rr{data = D} <- RRs], {ok, [IP || #dns_rrdata_a{ip = IP} <- DataRRs] ++ [IP || #dns_rrdata_aaaa{ip = IP} <- DataRRs]} catch Class:Error -> {error, {Class, Error}} end; {error, Error} -> {error, Error} end. %%%=================================================================== %%% DNS Zone functions %%%=================================================================== -spec(soa_record(dns:dname()) -> dns:dns_rr()). soa_record(Name) -> #dns_rr{ name = Name, type = ?DNS_TYPE_SOA, ttl = 5, data = #dns_rrdata_soa{ mname = <<"ns.spartan">>, %% Nameserver rname = <<"support.mesosphere.com">>, serial = 1, refresh = 60, retry = 180, expire = 86400, minimum = 1 } }. -spec(ns_record(dns:dname()) -> dns:dns_rr()). ns_record(Name) -> #dns_rr{ name = Name, type = ?DNS_TYPE_NS, ttl = 3600, data = #dns_rrdata_ns{ dname = <<"ns.spartan">> } }. -spec(dns_records(dns:dname(), [inet:ip_address()]) -> [dns:dns_rr()]). dns_records(DName, IPs) -> [dns_record(DName, IP) || IP <- IPs]. -spec(dns_record(dns:dname(), inet:ip_address()) -> dns:dns_rr()). dns_record(DName, IP) -> {Type, Data} = case dcos_dns:family(IP) of inet -> {?DNS_TYPE_A, #dns_rrdata_a{ip = IP}}; inet6 -> {?DNS_TYPE_AAAA, #dns_rrdata_aaaa{ip = IP}} end, #dns_rr{name = DName, type = Type, ttl = ?DCOS_DNS_TTL, data = Data}. -spec(srv_record(dns:dname(), {dns:dname(), inet:port_number()}) -> dns:rr()). srv_record(DName, {Host, Port}) -> #dns_rr{ name = DName, type = ?DNS_TYPE_SRV, ttl = ?DCOS_DNS_TTL, data = #dns_rrdata_srv{ target = Host, port = Port, weight = 1, priority = 1 } }. -spec(cname_record(dns:dname(), dns:dname()) -> dns:dns_rr()). cname_record(CName, Name) -> #dns_rr{ name = CName, type = ?DNS_TYPE_CNAME, ttl = 5, data = #dns_rrdata_cname{dname=Name} }. -spec(push_zone(dns:dname(), Records) -> ok | {error, Reason :: term()} when Records :: [dns:dns_rr()] | #{dns:dname() => [dns:dns_rr()]}). push_zone(ZoneName, Records) -> Begin = erlang:monotonic_time(), Records0 = [ns_record(ZoneName), soa_record(ZoneName) | Records], RecordsByName = build_named_index(Records0), try erldns_zone_cache:get_zone_with_records(ZoneName) of {ok, #zone{records_by_name=RecordsByName}} -> ok; _Other -> Zone = build_zone(ZoneName, RecordsByName), push_prepared_zone(Begin, ZoneName, Zone) catch error:Error -> ?LOG_ERROR( "Failed to push DNS Zone \"~s\": ~p", [ZoneName, Error]), {error, Error} end. -spec(push_prepared_zone(dns:dname(), Records) -> ok | {error, term()} when Records :: [dns:dns_rr()] | #{dns:dname() => [dns:dns_rr()]}). push_prepared_zone(ZoneName, Records) -> Begin = erlang:monotonic_time(), Zone = build_zone(ZoneName, Records), push_prepared_zone(Begin, ZoneName, Zone). %%%=================================================================== %%% Internal functions %%%=================================================================== -spec(push_prepared_zone(Begin, dns:dname(), Zone) -> ok | {error, term()} when Begin :: integer(), Zone :: erldns:zone()). push_prepared_zone(Begin, ZoneName, Zone) -> try ok = erldns_storage:insert(zones, {ZoneName, Zone}), ZoneName0 = <<ZoneName/binary, ".">>, Duration = erlang:monotonic_time() - Begin, DurationMs = erlang:convert_time_unit(Duration, native, millisecond), #zone{record_count = RecordCount} = Zone, ?LOG_NOTICE( "DNS Zone ~s was updated (~p records, duration: ~pms)", [ZoneName0, RecordCount, DurationMs]), prometheus_summary:observe( dns, zone_push_duration_seconds, [ZoneName0], Duration), prometheus_gauge:set( dns, zone_records, [ZoneName0], RecordCount) catch error:Error -> ?LOG_ERROR( "Failed to push DNS Zone \"~s\": ~p", [ZoneName, Error]), {error, Error} end. -spec(build_zone(dns:dname(), Records) -> erldns:zone() when Records :: [dns:dns_rr()] | #{dns:dname() => [dns:dns_rr()]}). build_zone(ZoneName, Records) -> Time = erlang:system_time(second), Version = calendar:system_time_to_rfc3339(Time), RecordsByName = build_named_index(Records), RecordCounts = lists:map(fun length/1, maps:values(RecordsByName)), Authorities = lists:filter( erldns_records:match_type(?DNS_TYPE_SOA), maps:get(ZoneName, RecordsByName)), #zone{ name = ZoneName, version = list_to_binary(Version), record_count = lists:sum(RecordCounts), authority = Authorities, records_by_name = RecordsByName, keysets = [] }. -spec(build_named_index([dns:rr()] | RecordsByName) -> RecordsByName when RecordsByName :: #{dns:dname() => [dns:rr()]}). build_named_index(RecordsByName) when is_map(RecordsByName) -> RecordsByName; build_named_index(Records) -> lists:foldl(fun (#dns_rr{name = Name} = RR, Acc) -> RRs = maps:get(Name, Acc, []), Acc#{Name => [RR | RRs]} end, #{}, Records). %%%=================================================================== %%% Metrics functions %%%=================================================================== -spec(init_metrics() -> ok). init_metrics() -> prometheus_gauge:new([ {registry, dns}, {name, zone_records}, {labels, [zone]}, {help, "The number of records in DNS Zone."}]), prometheus_summary:new([ {registry, dns}, {name, zone_push_duration_seconds}, {labels, [zone]}, {duration_unit, seconds}, {help, "The time spent pushing DNS Zone to the zone cache."}]). <|start_filename|>apps/dcos_net/src/dcos_net_sup.erl<|end_filename|> -module(dcos_net_sup). -behaviour(supervisor). -export([start_link/0, init/1]). -define(CHILD(Module), #{id => Module, start => {Module, start_link, []}}). start_link() -> supervisor:start_link({local, ?MODULE}, ?MODULE, []). init([]) -> dcos_net_mesos:init_metrics(), dcos_net_mesos_listener:init_metrics(), dcos_net_logger_h:add_handler(), dcos_net_vm_metrics_collector:init(), dcos_net_sysmon:init_metrics(), IsMaster = dcos_net_app:is_master(), MChildren = [?CHILD(dcos_net_mesos_listener) || IsMaster], {ok, {#{intensity => 10000, period => 1}, [ ?CHILD(dcos_net_masters), ?CHILD(dcos_net_killer), ?CHILD(dcos_net_node), ?CHILD(dcos_net_sysmon) | MChildren ]}}. <|start_filename|>apps/dcos_net/src/dcos_net_sysmon.erl<|end_filename|> -module(dcos_net_sysmon). -behavior(gen_server). -export([ start_link/0, init_metrics/0 ]). %% gen_server callbacks -export([init/1, handle_call/3, handle_cast/2, handle_info/2]). -include_lib("kernel/include/logger.hrl"). -record(state, {}). -spec(start_link() -> {ok, Pid :: pid()} | ignore | {error, Reason :: term()}). start_link() -> gen_server:start_link({local, ?MODULE}, ?MODULE, [], []). %%%=================================================================== %%% gen_server callbacks %%%=================================================================== init([]) -> erlang:system_monitor(self(), [ busy_port, busy_dist_port, {long_gc, application:get_env(dcos_net, long_gc, 10)}, {long_schedule, application:get_env(dcos_net, long_schedule, 10)} ]), {ok, #state{}}. handle_call(_Request, _From, State) -> {reply, ok, State}. handle_cast(_Request, State) -> {noreply, State}. handle_info({monitor, Pid, long_gc, Info}, State) -> {timeout, Timeout} = lists:keyfind(timeout, 1, Info), [ ?LOG_WARNING("sysmon long_gc: ~p, process: ~p", [Info, info(Pid)]) || Timeout > application:get_env(dcos_net, long_gc_threshold, 100) ], prometheus_histogram:observe(erlang_vm_sysmon_long_gc_seconds, Timeout), {noreply, State}; handle_info({monitor, Obj, long_schedule, Info}, State) -> {timeout, Timeout} = lists:keyfind(timeout, 1, Info), [ ?LOG_WARNING("sysmon long_schedule: ~p, process: ~p", [Info, info(Obj)]) || Timeout > application:get_env(dcos_net, long_schedule_threshold, 100) ], prometheus_histogram:observe( erlang_vm_sysmon_long_schedule_seconds, Timeout), {noreply, State}; handle_info({monitor, Pid, busy_port, Port}, State) -> ?LOG_WARNING( "sysmon busy_port: ~p, process: ~p", [info(Port), info(Pid)]), prometheus_counter:inc(erlang_vm_sysmon_busy_port_total, 1), {noreply, State}; handle_info({monitor, Pid, busy_dist_port, Port}, State) -> ?LOG_WARNING( "sysmon busy_dist_port: ~p, process: ~p", [info(Port), info(Pid)]), prometheus_counter:inc(erlang_vm_sysmon_busy_dist_port_total, 1), {noreply, State}; handle_info(_Info, State) -> {noreply, State}. %%%=================================================================== %%% Internal functions %%%=================================================================== info(Pid) when is_pid(Pid) -> recon:info(Pid); info(Port) when is_port(Port) -> recon:port_info(Port). %%%=================================================================== %%% Metrics functions %%%=================================================================== -spec(init_metrics() -> ok). init_metrics() -> prometheus_histogram:new([ {name, erlang_vm_sysmon_long_gc_seconds}, {duration_unit, seconds}, {buckets, [0.01, 0.025, 0.05, 0.1, 0.5, 1.0, 5.0]}, {help, "Erlang VM system monitor for long garbage collection calls."} ]), prometheus_histogram:new([ {name, erlang_vm_sysmon_long_schedule_seconds}, {duration_unit, seconds}, {buckets, [0.01, 0.025, 0.05, 0.1, 0.5, 1.0, 5.0]}, {help, "Erlang VM system monitor for long uninterrupted execution."} ]), prometheus_counter:new([ {name, erlang_vm_sysmon_busy_port_total}, {help, "Erlang VM system monitor for busy port events."} ]), prometheus_counter:new([ {name, erlang_vm_sysmon_busy_dist_port_total}, {help, "Erlang VM system monitor for busy dist port events."} ]). <|start_filename|>apps/dcos_dns/test/dcos_dns_handler_SUITE.erl<|end_filename|> -module(dcos_dns_handler_SUITE). -include_lib("dns/include/dns.hrl"). -include_lib("eunit/include/eunit.hrl"). -include_lib("common_test/include/ct.hrl"). -export([ init_per_suite/1, end_per_suite/1, all/0, groups/0 ]). -export([ udp_ready/1, tcp_ready/1, keep_tcp_ready/1, udp_basic_upstream/1, tcp_basic_upstream/1, multi_upstreams/1, mixed_upstreams/1, no_upstream/1, broken_upstreams/1, add_thisnode/1, tcp_fallback/1, overload/1, registry/1, cnames/1, rr_loadbalance/1, random_loadbalance/1, none_loadbalance/1, cnames_loadbalance/1, l4lb_rename/1, dcos_rename/1 ]). init_per_suite(Config) -> {ok, Apps} = application:ensure_all_started(dcos_dns), {ok, _} = lashup_kv:request_op([navstar, key], {update, [ {update, {public_key, riak_dt_lwwreg}, {assign, <<"foobar">>}}, {update, {secret_key, riak_dt_lwwreg}, {assign, <<"barqux">>}} ]}), [{apps, Apps} | Config]. end_per_suite(Config) -> lists:foreach(fun (App) -> ok = application:stop(App), ok = application:unload(App) end, ?config(apps, Config)). all() -> [ {group, ready}, {group, upstream}, {group, thisnode}, {group, dcos}, {group, component}, {group, loadbalance}, {group, rename} ]. groups() -> [ {ready, [], [udp_ready, tcp_ready, keep_tcp_ready]}, {upstream, [], [ udp_basic_upstream, tcp_basic_upstream, multi_upstreams, mixed_upstreams, no_upstream, broken_upstreams ]}, {thisnode, [], [add_thisnode]}, {dcos, [], [tcp_fallback, overload]}, {component, [], [registry, cnames]}, {loadbalance, [], [ rr_loadbalance, random_loadbalance, none_loadbalance, cnames_loadbalance ]}, {rename, [], [l4lb_rename, dcos_rename]} ]. %%%=================================================================== %%% Ready tests %%%=================================================================== ready(_Config, Opts) -> {ok, Msg} = resolve("ready.spartan", in, a, Opts), [RR] = inet_dns:msg(Msg, anlist), ?assertEqual({127, 0, 0, 1}, inet_dns:rr(RR, data)). udp_ready(Config) -> ready(Config, []). tcp_ready(Config) -> ready(Config, [nousevc]). keep_tcp_ready(_Config) -> Timeout = 1000, {IP, Port} = nameserver(), Opts = [{active, true}, binary, {packet, 2}, {send_timeout, Timeout}], {ok, Sock} = gen_tcp:connect(IP, Port, Opts), ok = keep_tcp_ready_loop(Sock, 3, Timeout), gen_tcp:close(Sock). keep_tcp_ready_loop(_Sock, 0, _Timeout) -> ok; keep_tcp_ready_loop(Sock, N, Timeout) -> Request = dns:encode_message( #dns_message{ qc = 1, questions = [#dns_query{ name = <<"ready.spartan">>, class = ?DNS_CLASS_IN, type = ?DNS_TYPE_A }] }), ok = gen_tcp:send(Sock, Request), receive {tcp, Sock, Data} -> ?assertMatch( #dns_message{answers = [#dns_rr{}]}, dns:decode_message(Data)) after Timeout -> exit(Timeout) end, keep_tcp_ready_loop(Sock, N - 1, Timeout). %%%=================================================================== %%% Upstream tests %%%=================================================================== basic_upstream(_Config, Opts) -> ok = application:set_env(dcos_dns, upstream_resolvers, [ {{1, 1, 1, 1}, 53}, {{1, 0, 0, 1}, 53} ]), {ok, Msg} = resolve("dcos.io", in, a, Opts), RRs = inet_dns:msg(Msg, anlist), ?assertNotEqual([], RRs). udp_basic_upstream(Config) -> basic_upstream(Config, []). tcp_basic_upstream(Config) -> basic_upstream(Config, [nousevc]). multi_upstreams(_Config) -> ok = application:set_env(dcos_dns, upstream_resolvers, [ {{1, 1, 1, 1}, 53}, {{1, 0, 0, 1}, 53}, {{8, 4, 4, 8}, 53}, {{8, 8, 8, 8}, 53} ]), upstream_resolve("dcos.io"). mixed_upstreams(_Config) -> ok = application:set_env(dcos_dns, upstream_resolvers, [ {{1, 1, 1, 1}, 53}, {{1, 0, 0, 1}, 53}, {{127, 0, 0, 1}, 65535} ]), upstream_resolve("dcos.io"). no_upstream(_Config) -> ok = application:set_env(dcos_dns, upstream_resolvers, []), ?assertEqual( {ok, [<<";; Warning: query response not set">>]}, dig(["dcos.io"])). broken_upstreams(_Config) -> ok = application:set_env(dcos_dns, upstream_resolvers, [ {{127, 0, 0, 1}, 65535}, {{127, 0, 0, 2}, 65535} ]), ?assertEqual( {ok, [<<";; Warning: query response not set">>]}, dig(["dcos.io"])). upstream_resolve(Name) -> lists:foreach(fun (_) -> {ok, Msg} = resolve(Name, in, a, []), RRs = inet_dns:msg(Msg, anlist), ?assertNotEqual([], RRs) end, lists:seq(1, 8)). %%%=================================================================== %%% Thisnode functions %%%=================================================================== add_thisnode(_Config) -> Name = <<"thisnode.thisdcos.directory">>, Addr = {127, 0, 0, 1}, ok = dcos_dns:push_zone(Name, []), {ok, Msg0} = resolve(Name, in, a, []), ?assertEqual([], inet_dns:msg(Msg0, anlist)), ok = dcos_dns:push_zone(Name, [ dcos_dns:dns_record(Name, Addr) ]), {ok, Msg} = resolve(Name, in, a, []), [RR] = inet_dns:msg(Msg, anlist), ?assertEqual(Addr, inet_dns:rr(RR, data)). %%%=================================================================== %%% DC/OS functions %%%=================================================================== tcp_fallback(_Config) -> ZoneName = <<"dcos.thisdcos.directory">>, AppName = <<"app.autoip.", ZoneName/binary>>, IPs = [{127, 0, 0, X} || X <- lists:seq(1, 128)], ok = dcos_dns:push_zone(ZoneName, dcos_dns:dns_records(AppName, IPs)), {ok, Output} = dig([AppName]), ?assertEqual(length(IPs), length(Output)). overload(_Config) -> ZoneName = <<"dcos.thisdcos.directory">>, AppName = <<"app.autoip.", ZoneName/binary>>, IPs = [{127, 0, 0, X} || X <- lists:seq(1, 255)], ok = dcos_dns:push_zone(ZoneName, dcos_dns:dns_records(AppName, IPs)), Parent = self(), Queries = 4 * dcos_dns_handler_sj:limit(), lists:foreach(fun (Seq) -> proc_lib:spawn_link(fun () -> overload_worker(Seq, Parent, AppName) end) end, lists:seq(1, Queries)), Results = [ receive {Seq, R} -> R end || Seq <- lists:seq(1, Queries) ], ?assertEqual([ok, overload], lists:usort(Results)). overload_worker(Seq, Parent, AppName) -> Query = #dns_query{ name = AppName, class = ?DNS_CLASS_IN, type = ?DNS_TYPE_A }, Msg = #dns_message{qc = 1, questions = [Query]}, Request = dns:encode_message(Msg), ReplyFun = fun (_Bin) -> Parent ! {Seq, ok}, timer:sleep(1000) end, case dcos_dns_handler:start(tcp, Request, ReplyFun) of {ok, _Pid} -> ok; {error, Error} -> Parent ! {Seq, Error} end. %%%=================================================================== %%% Component functions %%%=================================================================== registry(_Config) -> IPs = [{127, 0, 0, X} || X <- lists:seq(1, 5)], MesosRRs = dcos_dns:dns_records(<<"master.mesos.thisdcos.directory">>, IPs), ok = dcos_dns:push_zone(<<"mesos.thisdcos.directory">>, MesosRRs), ok = dcos_dns:push_zone(<<"component.thisdcos.directory">>, [ dcos_dns:cname_record( <<"registry.component.thisdcos.directory">>, <<"master.mesos.thisdcos.directory">>) ]), {ok, Msg} = resolve("registry.component.thisdcos.directory", in, a, []), [CNameRR | RRs] = inet_dns:msg(Msg, anlist), ?assertMatch(#{ type := cname, domain := "registry.component.thisdcos.directory", data := "master.mesos.thisdcos.directory" }, maps:from_list(inet_dns:rr(CNameRR))), ?assertEqual(IPs, lists:sort([inet_dns:rr(RR, data) || RR <- RRs])). cnames(_Config) -> cnames_init_test_zone(), {ok, Msg} = resolve("foo.test.thisdcos.directory", in, a, []), % NOTE: CNAME records must appear before A/AAAA records, % the order of CNAME records does also matter. RRs = inet_dns:msg(Msg, anlist), ?assertMatch([ #{ type := cname, domain := "foo.test.thisdcos.directory", data := "bar.test.thisdcos.directory" }, #{ type := cname, domain := "bar.test.thisdcos.directory", data := "baz.test.thisdcos.directory" }, #{ type := cname, domain := "baz.test.thisdcos.directory", data := "qux.test.thisdcos.directory" } | _ ], [maps:from_list(inet_dns:rr(RR)) || RR <- RRs]), ?assertEqual(8, length(RRs)). cnames_init_test_zone() -> ok = dcos_dns:push_zone(<<"test.thisdcos.directory">>, [ dcos_dns:cname_record( <<"foo.test.thisdcos.directory">>, <<"bar.test.thisdcos.directory">>), dcos_dns:cname_record( <<"bar.test.thisdcos.directory">>, <<"baz.test.thisdcos.directory">>), dcos_dns:cname_record( <<"baz.test.thisdcos.directory">>, <<"qux.test.thisdcos.directory">>) | dcos_dns:dns_records( <<"qux.test.thisdcos.directory">>, [{127, 0, 0, X} || X <- lists:seq(1, 5)]) ]). %%%=================================================================== %%% Load Balance functions %%%=================================================================== rr_loadbalance(Config) -> ok = application:set_env(dcos_dns, loadbalance, round_robin), Results = loadbalance(Config), ?assert(length(lists:usort(Results)) > length(hd(Results)) / 2), ?assertMatch([_], lists:usort([lists:sort(R) || R <- Results])). random_loadbalance(Config) -> ok = application:set_env(dcos_dns, loadbalance, random), Results = loadbalance(Config), ?assert(length(lists:usort(Results)) > length(Results) / 2), ?assertMatch([_], lists:usort([lists:sort(R) || R <- Results])). none_loadbalance(Config) -> ok = application:set_env(dcos_dns, loadbalance, disabled), Results = loadbalance(Config), ?assertMatch([_], lists:usort(Results)). loadbalance(_Config) -> ZoneName = <<"mesos.thisdcos.directory">>, AppName = <<"app.autoip.", ZoneName/binary>>, IPs = [{127, 0, 0, X} || X <- lists:seq(1, 16)], ok = dcos_dns:push_zone(ZoneName, dcos_dns:dns_records(AppName, IPs)), lists:map(fun (_) -> {ok, Msg} = resolve(AppName, in, a, []), [ inet_dns:rr(RR, data) || RR <- inet_dns:msg(Msg, anlist) ] end, lists:seq(1, 128)). cnames_loadbalance(Config) -> ok = application:set_env(dcos_dns, loadbalance, round_robin), cnames(Config), ok = application:set_env(dcos_dns, loadbalance, random), cnames(Config), ok = application:set_env(dcos_dns, loadbalance, disabled), cnames(Config). %%%=================================================================== %%% Rename functions %%%=================================================================== l4lb_rename(_Config) -> Name = <<"app.marathon">>, Addr = {127, 0, 0, 1}, Zones = [ <<"l4lb.thisdcos.directory">>, <<"l4lb.thisdcos.global">>, <<"dclb.thisdcos.directory">>, <<"dclb.thisdcos.global">> ], Zone = hd(Zones), ok = dcos_dns:push_zone(Zone, []), lists:foreach(fun (Z) -> FQDN = binary_to_list(<<Name/binary, $., Z/binary>>), {error, {nxdomain, _Msg}} = resolve(FQDN, in, a, []) end, Zones), ok = dcos_dns:push_zone(Zone, [ dcos_dns:dns_record(<<Name/binary, $., Zone/binary>>, Addr) ]), lists:foreach(fun (Z) -> FQDN = binary_to_list(<<Name/binary, $., Z/binary>>), {ok, Msg} = resolve(FQDN, in, a, []), [RR] = inet_dns:msg(Msg, anlist), ?assertEqual(FQDN, inet_dns:rr(RR, domain)), ?assertEqual(Addr, inet_dns:rr(RR, data)) end, Zones). dcos_rename(_Config) -> ZoneName = <<"dcos.thisdcos.directory">>, AppName = <<"app.autoip.", ZoneName/binary>>, IPs = [{127, 0, 0, X} || X <- lists:seq(1, 5)], ok = dcos_dns:push_zone(ZoneName, dcos_dns:dns_records(AppName, IPs)), {ok, Msg} = resolve(AppName, in, a, []), ?assertEqual(5, length(inet_dns:msg(Msg, anlist))), RRs = [inet_dns:rr(RR, domain) || RR <- inet_dns:msg(Msg, anlist)], ?assertEqual([binary_to_list(AppName)], lists:usort(RRs)), #{public_key := Pk} = dcos_dns_key_mgr:keys(), CryptoId = zbase32:encode(Pk), ReName = <<"app.autoip.dcos.", CryptoId/binary, ".dcos.directory">>, {ok, ReMsg} = resolve(ReName, in, a, []), ?assertEqual(5, length(inet_dns:msg(ReMsg, anlist))), ReRRs = [inet_dns:rr(RR, domain) || RR <- inet_dns:msg(ReMsg, anlist)], ?assertEqual([binary_to_list(ReName)], lists:usort(ReRRs)). %%%=================================================================== %%% Internal functions %%%=================================================================== dig(Args) -> {IP, Port} = nameserver(), PortStr = integer_to_list(Port), Command = ["/usr/bin/dig", "-p", PortStr, "@" ++ inet:ntoa(IP), "+short"], case dcos_net_utils:system(Command ++ Args, 30000) of {ok, Output} -> Lines = binary:split(Output, <<"\n">>, [global]), {ok, [ L || L <- Lines, L =/= <<>> ]}; {error, {exit_status, 1}} -> {error, usage_error}; {error, {exit_status, 8}} -> {error, batch_file}; {error, {exit_status, 9}} -> {error, no_reply}; {error, {exit_status, 10}} -> {error, internal}; {error, Error} -> {error, Error} end. nameserver() -> {ok, Port} = application:get_env(dcos_dns, udp_port), {ok, Port} = application:get_env(dcos_dns, tcp_port), {{127, 0, 0, 1}, Port}. resolve(Name, Class, Type, Opts) when is_binary(Name) -> resolve(binary_to_list(Name), Class, Type, Opts); resolve(Name, Class, Type, Opts) -> Opts0 = [{nameservers, [nameserver()]} | Opts], inet_res:resolve(Name, Class, Type, Opts0). <|start_filename|>apps/dcos_dns/src/dcos_dns_udp_server.erl<|end_filename|> -module(dcos_dns_udp_server). -behaviour(gen_server). %% API -export([start_link/1]). %% gen_server callbacks -export([init/1, handle_call/3, handle_cast/2, handle_info/2]). -include("dcos_dns.hrl"). -record(state, { socket :: gen_udp:socket(), gc_ref :: undefined | reference() }). -type state() :: #state{}. -spec(start_link(LocalIP :: inet:ip4_address()) -> {ok, Pid :: pid()} | ignore | {error, Reason :: term()}). start_link(LocalIP) -> gen_server:start_link(?MODULE, [LocalIP], []). %%%=================================================================== %%% gen_server callbacks %%%=================================================================== init([LocalIP]) -> Port = dcos_dns_config:udp_port(), RecBuf = application:get_env(dcos_dns, udp_recbuf, 1024 * 1024), {ok, Socket} = gen_udp:open(Port, [ {reuseaddr, true}, {active, true}, binary, {ip, LocalIP}, {recbuf, RecBuf} ]), link(Socket), {ok, #state{socket = Socket}}. handle_call(_Request, _From, State) -> {reply, ok, State}. handle_cast(_Request, State) -> {noreply, State}. handle_info({udp, Socket, FromIP, FromPort, Data}, State = #state{socket = Socket}) -> Fun = {fun gen_udp:send/4, [Socket, FromIP, FromPort]}, _ = dcos_dns_handler:start(udp, Data, Fun), {noreply, start_gc_timer(State)}; handle_info({timeout, GCRef, gc}, #state{gc_ref=GCRef}=State) -> {noreply, State#state{gc_ref=undefined}, hibernate}; handle_info(_Info, State) -> {noreply, State}. %%%=================================================================== %%% Internal functions %%%=================================================================== -spec(start_gc_timer(state()) -> state()). start_gc_timer(#state{gc_ref = undefined} = State) -> Timeout = application:get_env(dcos_net, gc_timeout, 15000), TRef = erlang:start_timer(Timeout, self(), gc), State#state{gc_ref = TRef}; start_gc_timer(State) -> State. <|start_filename|>apps/dcos_l4lb/src/dcos_l4lb_netns_watcher.erl<|end_filename|> %%%------------------------------------------------------------------- %%% @author dgoel %%% @copyright (C) 2016, <COMPANY> %%% @doc %%% %%% @end %%% Created : 17. April 2017 2:35 PM %%%------------------------------------------------------------------- -module(dcos_l4lb_netns_watcher). -author("dgoel"). -behaviour(gen_statem). -include_lib("kernel/include/logger.hrl"). -include_lib("inotify/include/inotify.hrl"). -include("dcos_l4lb.hrl"). %% API -export([start_link/0]). %% gen_statem callbacks -export([init/1, callback_mode/0]). %% State callbacks -export([uninitialized/3, reconcile/3, watch/3]). %% inotify_evt callbacks -export([inotify_event/3]). -define(SERVER, ?MODULE). -define(RECONCILE_TIMEOUT, 5000). %% 5 secs -record(data, {cni_dir :: undefined | string(), watchRef :: undefined | reference()}). -type mask() :: ?ALL. -type msg() :: ?inotify_msg(Mask :: [mask()], Cookie :: non_neg_integer(), OptionalName :: string()). -spec(start_link() -> {ok, Pid :: pid()} | ignore | {error, Reason :: term()}). start_link() -> gen_statem:start_link({local, ?SERVER}, ?MODULE, [], []). %%%=================================================================== %%% gen_statem callbacks %%%=================================================================== init([]) -> CniDir = dcos_l4lb_config:cni_dir(), StateData = #data{cni_dir = CniDir}, {ok, uninitialized, StateData, {next_event, timeout, CniDir}}. callback_mode() -> state_functions. %%-------------------------------------------------------------------- %% State transition uninitialized -> reconcile -> maintain %%-------------------------------------------------------------------- uninitialized(timeout, CniDir, StateData0 = #data{cni_dir = CniDir}) -> case filelib:is_dir(CniDir) of true -> Ref = setup_watch(CniDir), StateData1 = StateData0#data{watchRef = Ref}, {next_state, reconcile, StateData1, {next_event, internal, CniDir}}; false -> {keep_state_and_data, {timeout, 5000, CniDir}} end. reconcile(internal, CniDir, StateData = #data{cni_dir = CniDir}) -> Namespaces = read_files(CniDir), send_event(reconcile_netns, Namespaces), {next_state, watch, StateData}; reconcile(_, _, _) -> {keep_state_and_data, postpone}. watch(cast, {[?CLOSE_WRITE], FileName, Ref}, #data{cni_dir = CniDir, watchRef = Ref}) -> {true, Netns} = read_file(FileName, CniDir), send_event(add_netns, [Netns]), keep_state_and_data; watch(cast, {[?DELETE], FileName, Ref}, #data{watchRef = Ref}) -> send_event(remove_netns, [#netns{id = FileName}]), keep_state_and_data; watch(EventType, EventContent, _) -> ?LOG_WARNING("Unknown event ~p with ~p", [EventType, EventContent]), keep_state_and_data. %%%=================================================================== %%% inotify callback %%%=================================================================== -spec(inotify_event(Arg :: term(), EventRef :: reference, Event :: msg()) -> ok). inotify_event(_Pid, _Ref, ?inotify_msg(_Masks, _Cookie, [$.|_])) -> ok; inotify_event(Pid, Ref, ?inotify_msg(Masks, _Cookie, FileName)) -> gen_statem:cast(Pid, {Masks, FileName, Ref}). %%%==================================================================== %%% private api %%%==================================================================== setup_watch(CniDir) -> Ref = inotify:watch(CniDir, [?CLOSE_WRITE, ?DELETE]), ok = inotify:add_handler(Ref, ?MODULE, self()), Ref. send_event(_, []) -> ok; send_event(EventType, EventContent) -> dcos_l4lb_mgr:push_netns(EventType, EventContent). read_files(CniDir) -> case file:list_dir(CniDir) of {ok, FileNames} -> lists:filtermap(fun(FileName) -> read_file(FileName, CniDir) end, FileNames); {error, Reason} -> ?LOG_INFO("Couldn't read cni dir ~p due to ~p", [CniDir, Reason]), [] end. read_file(FileName, CniDir) -> AbsFileName = filename:join(CniDir, FileName), case file:read_file(AbsFileName) of {ok, Namespace} -> {true, #netns{id = FileName, ns = Namespace}}; {error, Reason} -> ?LOG_WARNING("Couldn't read ~p, due to ~p", [AbsFileName, Reason]), false end. <|start_filename|>apps/dcos_net/test/dcos_net_utils_tests.erl<|end_filename|> -module(dcos_net_utils_tests). -include_lib("eunit/include/eunit.hrl"). complement_test() -> {A, B} = dcos_net_utils:complement( [a, 0, b, 1, c, 2], [e, 0, d, 1, f, 2]), ?assertEqual( {[a, b, c], [d, e, f]}, {lists:sort(A), lists:sort(B)}). system_test() -> case dcos_net_utils:system([<<"/bin/pwd">>]) of {error, enoent} -> ok; {ok, Pwd} -> {ok, Cwd} = file:get_cwd(), ?assertEqual(iolist_to_binary([Cwd, "\n"]), Pwd) end. system_timeout_test() -> case dcos_net_utils:system([<<"/bin/dd">>], 100) of {error, enoent} -> ok; {error, timeout} -> ok end. join_empty_bin_test_() -> [ ?_assertEqual( <<>>, dcos_net_utils:join([], <<"no">>)), ?_assertEqual( <<>>, dcos_net_utils:join([], <<>>)), ?_assertEqual( <<>>, dcos_net_utils:join([<<>>], <<>>)), ?_assertEqual( <<"a">>, dcos_net_utils:join([<<"a">>], <<>>)), ?_assertEqual( <<"ab">>, dcos_net_utils:join([<<"a">>, <<"b">>], <<>>)), ?_assertEqual( <<"yes">>, dcos_net_utils:join([<<>>, <<>>], <<"yes">>)) ]. join_basic_test_() -> [ ?_assertEqual( <<"foo">>, dcos_net_utils:join([<<"foo">>], <<".">>)), ?_assertEqual( <<"foo.bar">>, dcos_net_utils:join([<<"foo">>, <<"bar">>], <<".">>)), ?_assertEqual( <<"foo...bar">>, dcos_net_utils:join([<<"foo">>, <<"bar">>], <<"...">>)), ?_assertEqual( <<"foo。bar">>, dcos_net_utils:join([<<"foo">>, <<"bar">>], <<"。">>)), ?_assertEqual( <<"foo.bar.">>, dcos_net_utils:join([<<"foo">>, <<"bar">>, <<>>], <<".">>)) ]. <|start_filename|>apps/dcos_overlay/src/dcos_overlay_netlink.erl<|end_filename|> %%%------------------------------------------------------------------- %% @doc navstar public API %% @end %%%------------------------------------------------------------------- -module(dcos_overlay_netlink). %% Application callbacks -export([ start_link/0, stop/1, init_metrics/0, ipneigh_replace/5, iproute_replace/6, bridge_fdb_replace/4, iplink_show/2, iplink_add/6, iplink_set/3, iprule_show/2, iprule_add/5, make_iprule/4, match_iprules/2, is_iprule_present/2, iplink_delete/2, ipaddr_replace/5, if_nametoindex/1]). -include_lib("gen_netlink/include/netlink.hrl"). start_link() -> gen_netlink_client:start_link(?NETLINK_ROUTE). stop(Pid) -> unlink(Pid), exit(Pid, kill). %% eg. ipneigh_replace(Pid, inet, {44,128,0,1}, %% {16#70,16#b3,16#d5,16#80,16#00,16#03}, "vtep1024"). ipneigh_replace(Pid, Family, Dst, Lladdr, Ifname) -> Attr = [{dst, Dst}, {lladdr, Lladdr}], case if_nametoindex(Ifname) of {ok, Ifindex} -> Neigh = { _Family = Family, _Ifindex = Ifindex, _State = ?NUD_PERMANENT, _Flags = 0, _NdmType = 0, Attr}, netlink_request(Pid, newneigh, [create, replace], Neigh); {error, Error} -> {error, Error} end. %% eg. iproute_replace(Pid, inet, {192,168,65,91}, 32, {44,128,0,1}, 42). iproute_replace(Pid, Family, Dst, DstPrefixLen, Src, Table) -> Attr = [{dst, Dst}, {gateway, Src}], Route = { _Family = Family, _DstPrefixLen = DstPrefixLen, _SrcPrefixLen = 0, _Tos = 0, _Table = Table, _Protocol = boot, _Scope = universe, _Type = unicast, _Flags = [], Attr}, netlink_request(Pid, newroute, [create, replace], Route). %% eg. bridge_fdb_replace(Pid, {192,168,65,91}, %% {16#70,16#b3,16#d5,16#80,16#00,16#03}, "vtep1024"). bridge_fdb_replace(Pid, Dst, Lladdr, Ifname) -> Attr = [{dst, Dst}, {lladdr, Lladdr}], State = ?NUD_PERMANENT bor ?NUD_NOARP, case if_nametoindex(Ifname) of {ok, Ifindex} -> Neigh = { _Family = bridge, _Ifindex = Ifindex, _State = State, _Flags = 2, %% NTF_SELF _NdmType = 0, Attr}, netlink_request(Pid, newneigh, [create, replace], Neigh); {error, Error} -> {error, Error} end. %% eg. iplink_show(Pid, "vtep1024") -> %% [{rtnetlink, newlink, [], 3, 31030, %% {unspec, arphrd_ether, 8, %% [lower_up, multicast, running, broadcast, up], %% [], [{ifname, "vtep1024"}, ...]}}] iplink_show(Pid, Ifname) -> Attr = [{ifname, Ifname}, {ext_mask, 1}], Link = {packet, arphrd_netrom, 0, [], [], Attr}, netlink_request(Pid, getlink, [], Link). %% eg. iplink_delete(Pid, "vtep1024") -> %% {ok,[]} iplink_delete(Pid, Ifname) -> Attr = [{ifname, Ifname}, {ext_mask, 1}], Link = {packet, arphrd_netrom, 0, [], [], Attr}, netlink_request(Pid, dellink, [], Link). %% iplink_add(Pid, "vtep1024", "vxlan", 1024, 64000) iplink_add(Pid, Ifname, Kind, Id, DstPort, Attr) -> Vxlan = [ {id, Id}, {ttl, 0}, {tos, 0}, {learning, 1}, {proxy, 0}, {rsc, 0}, {l2miss, 0}, {l3miss, 0}, {udp_csum, 0}, {udp_zero_csum6_tx, 0}, {udp_zero_csum6_rx, 0}, {remcsum_tx, 0}, {remcsum_rx, 0}, {port, DstPort}], LinkInfo = [{kind, Kind}, {data, Vxlan}], Attr0 = [{ifname, Ifname}, {linkinfo, LinkInfo}] ++ Attr, Link = { _Family = inet, _Type = arphrd_netrom, _Ifindex = 0, _Flags = [], _Change = [], Attr0}, netlink_request(Pid, newlink, [create, excl], Link). %% iplink_set(Pid, {16#70,16#b3,16#d5,16#80,16#00,16#01}, "vtep1024"). iplink_set(Pid, Lladdr, Ifname) -> Attr = [{address, Lladdr}], case if_nametoindex(Ifname) of {ok, Ifindex} -> Link = { _Family = inet, _Type = arphrd_netrom, _Ifindex = Ifindex, _Flags = [1], _Change = [1], Attr}, netlink_request(Pid, newlink, [], Link); {error, Error} -> {error, Error} end. %% iprule_show(Pid) -> %% [...., {rtnetlink,newrule,[multi],6,31030, %% {inet, 0,8,0,42,unspec,universe,unicast,[], %% [{table,42},{priority,32765},{src,{9,0,0,0}}]}}, ....] iprule_show(Pid, Family) -> Attr = [{29, <<1:32/native-integer>>}], %% [{ext_mask, 1}] Rule = {Family, 0, 0, 0, 0, 0, 0, 0, [], Attr}, netlink_request(Pid, getrule, [root, match], Rule). %% iprule_add(Pid, inet, {9,0,0,0}, 8, 42). iprule_add(Pid, Family, Src, SrcPrefixLen, Table) -> Attr = [{src, Src}], Rule = { _Family = Family, _DstPrefixLen = 0, _SrcPrefixLen = SrcPrefixLen, _Tos = 0, _Table = Table, _Protocol = boot, _Scope = universe, _Type = unicast, _Flags = [], Attr}, netlink_request(Pid, newrule, [create, excl], Rule). make_iprule(Family, Src, SrcPrefixLen, Table) -> {Family, 0, SrcPrefixLen, 0, Table, unspec, universe, unicast, [], [{src, Src}]}. is_iprule_present([], _) -> false; is_iprule_present([{rtnetlink, newrule, _, _, _, ParsedRule}|Rules], Rule) -> case match_iprules(Rule, ParsedRule) of matched -> true; not_matched -> is_iprule_present(Rules, Rule) end. match_iprules( {Family, 0, SrcPrefixLen, 0, Table, unspec, universe, unicast, [], [{src, Src}]}, {Family, 0, SrcPrefixLen, 0, Table, unspec, universe, unicast, [], Prop}) -> case proplists:get_value(src, Prop) of Src -> matched; _ -> not_matched end; match_iprules(_, _) -> not_matched. %% ipaddr_add(Pid, inet, {44,128,0,1}, 32, "vtep1024"). ipaddr_replace(Pid, Family, IP, PrefixLen, Ifname) -> Attr = [{local, IP}, {address, IP}], case if_nametoindex(Ifname) of {ok, Ifindex} -> Msg = { _Family = Family, _PrefixLen = PrefixLen, _Flags = 0, _Scope = 0, _Ifindex = Ifindex, Attr}, netlink_request(Pid, newaddr, [create, replace], Msg); {error, Error} -> {error, Error} end. netlink_request(Pid, Type, Flags, Msg) -> case gen_netlink_client:rtnl_request(Pid, Type, Flags, Msg) of {error, Code, Message} -> prometheus_counter:inc(overlay, netlink_errors_total, [], 1), %% just to make error handling in callers a bit more uniform {error, {Code, Message}}; Result -> Result end. if_nametoindex(Ifname) -> case gen_netlink_client:if_nametoindex(Ifname) of {error, Error} -> prometheus_counter:inc(overlay, netlink_errors_total, [], 1), {error, Error}; Result -> Result end. %%%=================================================================== %%% Metrics functions %%%=================================================================== -spec(init_metrics() -> ok). init_metrics() -> prometheus_counter:new([ {registry, overlay}, {name, netlink_errors_total}, {help, "Total number of netlink errors."}]). <|start_filename|>apps/dcos_rest/src/dcos_rest_metrics_handler.erl<|end_filename|> -module(dcos_rest_metrics_handler). -export([ init/2, rest_init/2, allowed_methods/2, content_types_provided/2, metrics/2 ]). init(Req, Opts) -> {cowboy_rest, Req, Opts}. rest_init(Req, Opts) -> {ok, Req, Opts}. allowed_methods(Req, State) -> {[<<"GET">>], Req, State}. content_types_provided(Req, State) -> {[ {{<<"text">>, <<"plain">>, '*'}, metrics} ], Req, State}. metrics(Req, State) -> RegistryBin = cowboy_req:binding(registry, Req, <<"default">>), case prometheus_registry:exists(RegistryBin) of false -> Req0 = cowboy_req:reply(404, #{}, <<"Unknown Registry">>, Req), {stop, Req0, State}; Registry -> CT = prometheus_text_format:content_type(), Req0 = cowboy_req:set_resp_header(<<"content-type">>, CT, Req), Data = prometheus_text_format:format(Registry), {Data, Req0, State} end. <|start_filename|>apps/dcos_net/src/dcos_net_dist.erl<|end_filename|> -module(dcos_net_dist). -export([ hostname/0, nodeip/0, ssl_dist_opts/0 ]). % dist callbacks -export([ listen/1, select/1, accept/1, accept_connection/5, setup/5, close/1, childspecs/0, is_node_name/1 ]). -spec(hostname() -> binary()). hostname() -> [_Name, Hostname] = binary:split(atom_to_binary(node(), latin1), <<"@">>), Hostname. -ifdef(TEST). -define(NOIP, {0, 0, 0, 0}). -else. -define(NOIP, error(noip)). -endif. -spec(nodeip() -> inet:ip4_address()). nodeip() -> Hostname = hostname(), Hostname0 = binary_to_list(Hostname), case inet:parse_ipv4strict_address(Hostname0) of {ok, IP} -> IP; {error, _} -> ?NOIP end. -spec(ssl_dist_opts() -> [{server | client, ssl:ssl_option()}] | false). ssl_dist_opts() -> case init:get_argument(ssl_dist_optfile) of {ok, [[SSLDistOptFile]]} -> ssl_dist_opts(SSLDistOptFile); error -> false end. %%==================================================================== %% Dist functions %%==================================================================== listen(Name) -> set_dist_port(Name), M = dist_module(), M:listen(Name). select(Node) -> M = dist_module(), M:select(Node). accept(Listen) -> M = dist_module(), M:accept(Listen). accept_connection(AcceptPid, Socket, MyNode, Allowed, SetupTime) -> M = dist_module(), M:accept_connection(AcceptPid, Socket, MyNode, Allowed, SetupTime). setup(Node, Type, MyNode, LongOrShortNames, SetupTime) -> M = dist_module(), M:setup(Node, Type, MyNode, LongOrShortNames, SetupTime). close(Listen) -> M = dist_module(), M:close(Listen). childspecs() -> M = dist_module(), M:childspecs(). is_node_name(Node) -> M = dist_module(), M:is_node_name(Node). %%==================================================================== %% Internal functions %%==================================================================== set_dist_port(navstar) -> {ok, Port} = dcos_net_app:dist_port(), ok = application:set_env(kernel, inet_dist_listen_min, Port), ok = application:set_env(kernel, inet_dist_listen_max, Port); set_dist_port(_Name) -> ok. dist_module() -> case init:get_argument(ssl_dist_optfile) of {ok, [_SSLDistOptFiles]} -> inet_tls_dist; error -> inet_tcp_dist end. ssl_dist_opts(SSLDistOptFile) -> try ets:tab2list(ssl_dist_opts) catch error:badarg -> ssl_dist_sup:consult(SSLDistOptFile) end. <|start_filename|>apps/dcos_dns/src/dcos_dns_mesos.erl<|end_filename|> -module(dcos_dns_mesos). -behavior(gen_server). -include("dcos_dns.hrl"). -include_lib("kernel/include/logger.hrl"). -include_lib("dns/include/dns.hrl"). %% API -export([ start_link/0, push_zone/2 ]). %% gen_server callbacks -export([init/1, handle_call/3, handle_cast/2, handle_info/2, handle_continue/2]). -type task() :: dcos_net_mesos_listener:task(). -type task_id() :: dcos_net_mesos_listener:task_id(). -record(state, { ref = undefined :: undefined | reference(), tasks = #{} :: #{task_id() => [dns:dns_rr()]}, records = #{} :: #{dns:dns_rr() => pos_integer()}, records_by_name = #{} :: #{dns:dname() => [dns:dns_rr()]}, masters_ref = undefined :: undefined | reference(), masters = [] :: [dns:dns_rr()], push_zone_ref = undefined :: reference() | undefined, push_zone_rev = 0 :: non_neg_integer() }). -type state() :: #state{}. -spec(start_link() -> {ok, Pid :: pid()} | ignore | {error, Reason :: term()}). start_link() -> gen_server:start_link({local, ?MODULE}, ?MODULE, [], []). %%%=================================================================== %%% gen_server callbacks %%%=================================================================== init([]) -> {ok, #state{}, {continue, init}}. handle_call(Request, _From, State) -> ?LOG_WARNING("Unexpected request: ~p", [Request]), {reply, ok, State}. handle_cast(Request, State) -> ?LOG_WARNING("Unexpected request: ~p", [Request]), {noreply, State}. handle_info({{tasks, MTasks}, Ref}, #state{ref = Ref} = State0) -> ok = dcos_net_mesos_listener:next(Ref), {noreply, handle_tasks(MTasks, State0)}; handle_info({{task_updated, TaskId, Task}, Ref}, #state{ref = Ref} = State) -> ok = dcos_net_mesos_listener:next(Ref), {noreply, handle_task_updated(TaskId, Task, State)}; handle_info({eos, Ref}, #state{ref = Ref} = State) -> ok = dcos_net_mesos_listener:next(Ref), {noreply, reset_state(State)}; handle_info({'DOWN', Ref, process, _Pid, Info}, #state{ref = Ref} = State) -> {stop, Info, State}; handle_info({timeout, _Ref, init}, #state{ref = undefined} = State) -> {noreply, State, {continue, init}}; handle_info({timeout, Ref, masters}, #state{masters_ref = Ref} = State) -> {noreply, handle_masters(State)}; handle_info({timeout, Ref, {push_zone, Rev}}, #state{push_zone_ref = Ref} = State) -> {noreply, handle_push_zone(Rev, State), hibernate}; handle_info(Info, State) -> ?LOG_WARNING("Unexpected info: ~p", [Info]), {noreply, State}. handle_continue(init, State) -> case dcos_net_mesos_listener:subscribe() of {ok, Ref} -> {noreply, State#state{ref = Ref}}; {error, timeout} -> exit(timeout); {error, subscribed} -> exit(subscribed); {error, _Error} -> timer:sleep(100), {noreply, State, {continue, init}} end; handle_continue(Request, State) -> ?LOG_WARNING("Unexpected request: ~p", [Request]), {noreply, State}. %%%=================================================================== %%% Internal functions %%%=================================================================== -spec(reset_state(state()) -> state()). reset_state(#state{ref = Ref, masters_ref = MastersRef, push_zone_ref = PushZoneRef}) -> case MastersRef of undefined -> ok; _ -> erlang:cancel_timer(MastersRef) end, case PushZoneRef of undefined-> ok; _ -> erlang:cancel_timer(PushZoneRef) end, #state{ref = Ref}. %%%=================================================================== %%% Tasks functions %%%=================================================================== -spec(handle_tasks(#{task_id => task()}, state()) -> state()). handle_tasks(MTasks, State) -> MRef = start_masters_timer(), {Tasks, Records, RecordsByName} = task_records(MTasks), ok = push_zone(?DCOS_DOMAIN, RecordsByName), ?LOG_NOTICE("DC/OS DNS Sync: ~p records", [maps:size(Records)]), State#state{tasks = Tasks, records = Records, records_by_name = RecordsByName, masters_ref = MRef}. -spec(handle_task_updated(task_id(), task(), state()) -> state()). handle_task_updated(TaskId, Task, #state{ tasks = Tasks, records = Records, records_by_name = RecordsByName} = State) -> {Tasks0, Records0, RecordsByName0, Updated} = task_updated(TaskId, Task, Tasks, Records, RecordsByName), maybe_handle_push_zone(Updated, State#state{ tasks = Tasks0, records = Records0, records_by_name = RecordsByName0}). -spec(task_updated(task_id(), task(), Tasks, Records, RecordsByName) -> {Tasks, Records, RecordsByName, Updated} when Tasks :: #{task_id() => [dns:dns_rr()]}, Records :: #{dns:dns_rr() => pos_integer()}, RecordsByName :: #{dns:dns_rr() => pos_integer()}, Updated :: boolean()). task_updated(TaskId, Task, Tasks, Records, RecordsByName) -> TaskState = maps:get(state, Task), case {is_running(TaskState), maps:is_key(TaskId, Tasks)} of {Same, Same} -> {Tasks, Records, RecordsByName, false}; {false, true} -> {TaskRRs, Tasks0} = maps:take(TaskId, Tasks), Records0 = update_records(TaskRRs, -1, Records), % Remove records if there is no another task with such records TaskRRs0 = [RR || RR <- TaskRRs, not maps:is_key(RR, Records0)], {Removed, RecordsByName0} = remove_from_index(TaskRRs0, RecordsByName), {Tasks0, Records0, RecordsByName0, Removed}; {true, false} -> TaskRRs = task_records(TaskId, Task), Tasks0 = maps:put(TaskId, TaskRRs, Tasks), Records0 = update_records(TaskRRs, 1, Records), % Add only new records that are not in `Records` before TaskRRs0 = [RR || RR <- TaskRRs, not maps:is_key(RR, Records)], {Added, RecordsByName0} = add_to_index(TaskRRs0, RecordsByName), {Tasks0, Records0, RecordsByName0, Added} end. -type task_records_ret() :: { #{task_id() => [dns:dns_rr()]}, #{dns:dns_rr() => pos_integer()}, #{dns:dname() => [dns:dns_rr()]} }. -spec(task_records(#{task_id() => task()}) -> task_records_ret()). task_records(Tasks) -> InitRecords = #{ dcos_dns:ns_record(?DCOS_DOMAIN) => 1, dcos_dns:soa_record(?DCOS_DOMAIN) => 1, leader_record(?DCOS_DOMAIN) => 1 }, {_Added, InitRecordsByName} = add_to_index(maps:keys(InitRecords), #{}), maps:fold( fun task_records_fold/3, {#{}, InitRecords, InitRecordsByName}, Tasks). -spec(task_records_fold(task_id(), task(), Acc) -> Acc when Acc :: task_records_ret()). task_records_fold( TaskId, #{state := TaskState} = Task, {Tasks, Records, RecordsByName}) -> case is_running(TaskState) of true -> TaskRRs = task_records(TaskId, Task), Tasks0 = maps:put(TaskId, TaskRRs, Tasks), Records0 = update_records(TaskRRs, 1, Records), TaskRRs0 = [RR || RR <- TaskRRs, not maps:is_key(RR, Records)], {_Added, RecordsByName0} = add_to_index(TaskRRs0, RecordsByName), {Tasks0, Records0, RecordsByName0}; false -> {Tasks, Records, RecordsByName} end. -spec(task_records(task_id(), task()) -> dns:dns_rr()). task_records(TaskId, Task) -> lists:flatten([ task_agentip(TaskId, Task), task_containerip(TaskId, Task), task_autoip(TaskId, Task) ]). -spec(task_agentip(task_id(), task()) -> [dns:dns_rr()]). task_agentip(_TaskId, #{name := Name, framework := Fwrk, agent_ip := AgentIP}) -> DName = format_name([Name, Fwrk, <<"agentip">>], ?DCOS_DOMAIN), dcos_dns:dns_records(DName, [AgentIP]); task_agentip(TaskId, Task) -> ?LOG_WARNING("Unexpected task ~p with ~p", [TaskId, Task]), []. -spec(task_containerip(task_id(), task()) -> [dns:dns_rr()]). task_containerip(_TaskId, #{name := Name, framework := Fwrk, task_ip := TaskIPs}) -> DName = format_name([Name, Fwrk, <<"containerip">>], ?DCOS_DOMAIN), dcos_dns:dns_records(DName, TaskIPs); task_containerip(_TaskId, _Task) -> []. -spec(task_autoip(task_id(), task()) -> [dns:dns_rr()]). task_autoip(_TaskId, #{name := Name, framework := Fwrk, agent_ip := AgentIP, task_ip := TaskIPs} = Task) -> %% if task.port_mappings then agent_ip else task_ip DName = format_name([Name, Fwrk, <<"autoip">>], ?DCOS_DOMAIN), Ports = maps:get(ports, Task, []), dcos_dns:dns_records(DName, case lists:any(fun is_port_mapping/1, Ports) of true -> [AgentIP]; false -> TaskIPs end ); task_autoip(_TaskId, #{name := Name, framework := Fwrk, agent_ip := AgentIP}) -> DName = format_name([Name, Fwrk, <<"autoip">>], ?DCOS_DOMAIN), dcos_dns:dns_records(DName, [AgentIP]); task_autoip(TaskId, Task) -> ?LOG_WARNING("Unexpected task ~p with ~p", [TaskId, Task]), []. -spec(is_running(dcos_net_mesos_listener:task_state()) -> boolean()). is_running(running) -> true; is_running(_TaskState) -> false. -spec(is_port_mapping(dcos_net_mesos_listener:task_port()) -> boolean()). is_port_mapping(#{host_port := _HPort}) -> true; is_port_mapping(_Port) -> false. -spec(update_records([dns:dns_rr()], integer(), RRs) -> RRs when RRs :: #{dns:dns_rr() => pos_integer()}). update_records(Records, Incr, RRs) when is_list(Records) -> lists:foldl(fun (Record, Acc) -> update_record(Record, Incr, Acc) end, RRs, Records). -spec(update_record(dns:dns_rr(), integer(), RRs) -> RRs when RRs :: #{dns:dns_rr() => pos_integer()}). update_record(Record, Incr, RRs) -> case maps:get(Record, RRs, 0) + Incr of 0 -> maps:remove(Record, RRs); N -> RRs#{Record => N} end. -spec(add_to_index(RRs, RecordsByName) -> {boolean(), RecordsByName} when RRs :: [dns:dns_rr()], RecordsByName :: #{dns:dname() => RRs}). add_to_index([], RecordsByName) -> {false, RecordsByName}; add_to_index(RRs, RecordsByName) -> lists:foldl(fun (#dns_rr{name = Name} = RR, {_Up, Acc}) -> {true, Acc#{Name => [RR | maps:get(Name, Acc, [])]}} end, {false, RecordsByName}, RRs). -spec(remove_from_index(RRs, RecordsByName) -> {boolean(), RecordsByName} when RRs :: [dns:dns_rr()], RecordsByName :: #{dns:dname() => RRs}). remove_from_index([], RecordsByName) -> {false, RecordsByName}; remove_from_index(RRs, RecordsByName) -> lists:foldl(fun (#dns_rr{name = Name} = RR, {Removed, Acc}) -> RRs0 = maps:get(Name, Acc), Acc0 = Acc#{Name => lists:delete(RR, RRs0)}, {Removed orelse lists:member(RR, RRs0), Acc0} end, {false, RecordsByName}, RRs). %%%=================================================================== %%% Masters functions %%%=================================================================== -spec(handle_masters(state()) -> state()). handle_masters(#state{ masters = MRRs, records_by_name = RecordsByName} = State) -> ZoneName = ?DCOS_DOMAIN, MRRs0 = master_records(ZoneName), {NewRRs, OldRRs} = dcos_net_utils:complement(MRRs0, MRRs), lists:foreach(fun (#dns_rr{data = #dns_rrdata_a{ip = IP}}) -> ?LOG_NOTICE("DNS records: master ~p was added", [IP]) end, NewRRs), lists:foreach(fun (#dns_rr{data = #dns_rrdata_a{ip = IP}}) -> ?LOG_NOTICE("DNS records: master ~p was removed", [IP]) end, OldRRs), {Added, RecordsByName0} = add_to_index(NewRRs, RecordsByName), {Removed, RecordsByName1} = remove_from_index(OldRRs, RecordsByName0), State0 = State#state{ masters = MRRs0, masters_ref = start_masters_timer(), records_by_name = RecordsByName1}, maybe_handle_push_zone(Added orelse Removed, State0). -spec(master_records(dns:dname()) -> [dns:dns_rr()]). master_records(ZoneName) -> Masters = [IP || {IP, _} <- dcos_dns_config:mesos_resolvers()], dcos_dns:dns_records(<<"master.", ZoneName/binary>>, Masters). -spec(leader_record(dns:dname()) -> dns:dns_rr()). leader_record(ZoneName) -> % dcos-net connects only to local mesos, % operator API works only on a leader mesos, % so this node is the leader node IP = dcos_net_dist:nodeip(), dcos_dns:dns_record(<<"leader.", ZoneName/binary>>, IP). -spec(start_masters_timer() -> reference()). start_masters_timer() -> Timeout = application:get_env(dcos_dns, masters_timeout, 5000), erlang:start_timer(Timeout, self(), masters). %%%=================================================================== %%% DNS functions %%%=================================================================== -spec(format_name([binary()], binary()) -> binary()). format_name(ListOfNames, Postfix) -> ListOfNames1 = lists:map(fun mesos_state:label/1, ListOfNames), ListOfNames2 = lists:map(fun list_to_binary/1, ListOfNames1), Prefix = dcos_net_utils:join(ListOfNames2, <<".">>), <<Prefix/binary, ".", Postfix/binary>>. %%%=================================================================== %%% Lashup functions %%%=================================================================== -spec(push_zone(dns:dname(), #{dns:dname() => [dns:dns_rr()]}) -> ok). push_zone(ZoneName, RecordsByName) when is_map(RecordsByName) -> Op = {assign, RecordsByName, erlang:system_time(millisecond)}, {ok, _Info} = lashup_kv:request_op( ?LASHUP_LWW_KEY(ZoneName), {update, [{update, ?RECORDS_LWW_FIELD, Op}]}), ok. -spec(maybe_handle_push_zone(boolean(), state()) -> state()). maybe_handle_push_zone(false, State) -> State; maybe_handle_push_zone(true, State) -> handle_push_zone(State). -spec(handle_push_zone(non_neg_integer(), state()) -> state()). handle_push_zone(RevA, #state{push_zone_rev = RevB} = State) -> maybe_handle_push_zone(RevA < RevB, State#state{push_zone_ref=undefined}). -spec(handle_push_zone(state()) -> state()). handle_push_zone(#state{push_zone_ref = undefined, push_zone_rev = Rev, records_by_name = RecordsByName} = State) -> % NOTE: push data to lashup 1 time per second ok = push_zone(?DCOS_DOMAIN, RecordsByName), Rev0 = Rev + 1, Ref0 = start_push_zone_timer(Rev0), State#state{push_zone_ref = Ref0, push_zone_rev = Rev0}; handle_push_zone(#state{push_zone_rev = Rev} = State) -> State#state{push_zone_rev = Rev + 1}. -spec(start_push_zone_timer(Rev :: non_neg_integer()) -> reference()). start_push_zone_timer(Rev) -> Timeout = application:get_env(dcos_dns, push_zone_timeout, 1000), erlang:start_timer(Timeout, self(), {push_zone, Rev}). <|start_filename|>apps/dcos_l4lb/test/dcos_l4lb_lashup_vip_listener_SUITE.erl<|end_filename|> -module(dcos_l4lb_lashup_vip_listener_SUITE). -include_lib("common_test/include/ct.hrl"). -include_lib("dns/include/dns.hrl"). -include("dcos_l4lb.hrl"). -export([ name2ip/1, all/0, init_per_suite/1, end_per_suite/1, init_per_testcase/2, end_per_testcase/2, lookup_vips/1 ]). name2ip(DName) -> name2ip(?DNS_TYPE_A, DName). name2ip(DType, DName) -> case resolve(DType, <<DName/binary, ".l4lb.thisdcos.directory">>) of [#dns_rr{data=#dns_rrdata_a{ip = IP}}] -> IP; [#dns_rr{data=#dns_rrdata_aaaa{ip = IP}}] -> IP; [] -> false end. all() -> [lookup_vips]. init_per_suite(Config) -> Config. end_per_suite(Config) -> Config. init_per_testcase(_, Config) -> {ok, _} = application:ensure_all_started(dcos_l4lb), Config. end_per_testcase(_, _Config) -> [ begin ok = application:stop(App), ok = application:unload(App) end || {App, _, _} <- application:which_applications(), not lists:member(App, [stdlib, kernel]) ], os:cmd("rm -rf Mnesia.*"), dcos_l4lb_ipset_mgr:cleanup(), ok. -define(LKEY(K), {{tcp, K, 80}, riak_dt_orswot}). -define(LKEY(L, F), ?LKEY({name, {L, F}})). -define(BE4, {{1, 2, 3, 4}, {{1, 2, 3, 4}, 80, 1}}). -define(BE4OLD, {{1, 2, 3, 5}, {{1, 2, 3, 5}, 80}}). -define(BE6, {{1, 2, 3, 4}, {{1, 0, 0, 0, 0, 0, 0, 1}, 80, 1}}). lookup_vips(_Config) -> lashup_kv:request_op(?VIPS_KEY2, {update, [ {update, ?LKEY({1, 2, 3, 4}), {add, ?BE4}}, {update, ?LKEY({1, 2, 3, 5}), {add, ?BE4OLD}}, {update, ?LKEY(<<"/foo">>, <<"bar">>), {add, ?BE4}}, {update, ?LKEY(<<"/baz">>, <<"qux">>), {add, ?BE4}}, {update, ?LKEY(<<"/qux">>, <<"ipv6">>), {add, ?BE6}} ]}), timer:sleep(100), {11, 0, 0, 37} = name2ip(<<"foo.bar">>), {11, 0, 0, 39} = IP4 = name2ip(<<"baz.qux">>), {16#fd01, 16#c, 0, 0, 16#6d6d, 16#9c64, 16#fd19, 16#f251} = IP6 = name2ip(?DNS_TYPE_AAAA, <<"qux.ipv6">>), lashup_kv:request_op(?VIPS_KEY2, {update, [ {update, ?LKEY(<<"/foo">>, <<"bar">>), {remove, ?BE4}} ]}), timer:sleep(100), false = name2ip(<<"foo.bar">>), IP4 = name2ip(<<"baz.qux">>), IP6 = name2ip(?DNS_TYPE_AAAA, <<"qux.ipv6">>), lashup_kv:request_op(?VIPS_KEY2, {update, [ {update, ?LKEY({1, 2, 3, 4}), {remove, ?BE4}}, {update, ?LKEY({1, 2, 3, 5}), {remove, ?BE4OLD}}, {update, ?LKEY(<<"/baz">>, <<"qux">>), {remove, ?BE4}}, {update, ?LKEY(<<"/qux">>, <<"ipv6">>), {remove, ?BE6}} ]}), timer:sleep(100), false = name2ip(<<"foo.bar">>), false = name2ip(<<"baz.qux">>), false = name2ip(?DNS_TYPE_AAAA, <<"qux.ipv6">>). -define(LOCALHOST, {127, 0, 0, 1}). resolve(DType, DName) -> DNSQueries = [#dns_query{name=DName, type=DType}], DNSMessage = #dns_message{ rd=true, qc=length(DNSQueries), questions=DNSQueries }, #dns_message{answers=DNSAnswers} = erldns_handler:do_handle(DNSMessage, ?LOCALHOST), DNSAnswers. <|start_filename|>apps/dcos_overlay/src/dcos_overlay_lashup_kv_listener.erl<|end_filename|> -module(dcos_overlay_lashup_kv_listener). -behaviour(gen_server). -include_lib("kernel/include/logger.hrl"). -include_lib("stdlib/include/ms_transform.hrl"). -export([start_link/0, init_metrics/0]). %% gen_server callbacks -export([init/1, handle_continue/2, handle_call/3, handle_cast/2, handle_info/2]). -export_type([subnet/0, config/0]). -define(KEY(Subnet), [navstar, overlay, Subnet]). -type subnet() :: {inet:ip_address(), 0..32}. -type overlay_config() :: { VTEPIPPrefix :: subnet(), #{ agent_ip => inet:ip_address(), mac => list(0..16#FF), subnet => subnet() } }. -type config() :: #{ OverlaySubnet :: subnet() => OverlayConfig :: overlay_config() }. -record(state, { ref :: reference(), config = #{} :: config(), reconcile_ref :: reference() }). -spec(start_link() -> {ok, Pid :: pid()} | ignore | {error, Reason :: term()}). start_link() -> gen_server:start_link({local, ?MODULE}, ?MODULE, [], []). %%%=================================================================== %%% gen_server callbacks %%%=================================================================== init([]) -> {ok, {}, {continue, {}}}. handle_continue({}, {}) -> ok = wait_for_vtep(), MatchSpec = ets:fun2ms(fun({?KEY('_')}) -> true end), {ok, Ref} = lashup_kv:subscribe(MatchSpec), RRef = start_reconcile_timer(), {noreply, #state{ref=Ref, reconcile_ref=RRef}}. handle_call(_Request, _From, State) -> {noreply, State}. handle_cast(_Request, State) -> {noreply, State}. handle_info({lashup_kv_event, Ref, Key}, #state{ref = Ref, config = Config} = State) -> ok = lashup_kv:flush(Ref, Key), Value = lashup_kv:value(Key), {Subnet, Delta, Config0} = update_config(Key, Value, Config), ok = apply_configuration(#{Subnet => Delta}), {noreply, State#state{config = Config0}}; handle_info({timeout, RRef0, reconcile}, #state{config = Config, reconcile_ref = RRef0} = State) -> ok = apply_configuration(Config), RRef = start_reconcile_timer(), {noreply, State#state{reconcile_ref = RRef}, hibernate}; handle_info(_Info, State) -> {noreply, State}. %%%=================================================================== %%% Internal functions %%%=================================================================== -define(WAIT_TIMEOUT, 5000). -spec(wait_for_vtep() -> ok). wait_for_vtep() -> % listener must wait until vtep is configured. % dcos_overlay_poller polls local mesos agent module and % configures vtep interfaces. try dcos_overlay_poller:overlays() of [] -> timer:sleep(?WAIT_TIMEOUT), wait_for_vtep(); _Overlays -> ok catch _Class:_Error -> wait_for_vtep() end. -spec(start_reconcile_timer() -> reference()). start_reconcile_timer() -> Timeout = application:get_env(dcos_overlay, reconcile_timeout, timer:minutes(5)), erlang:start_timer(Timeout, self(), reconcile). -spec(update_config(Key :: term(), Value :: [term()], config()) -> {subnet(), Delta :: [{subnet(), map()}], config()}). update_config(?KEY(Subnet), Value, Config) -> OldValue = maps:get(Subnet, Config, []), NewValue = [{IP, maps:from_list( [{K, V} || {{K, riak_dt_lwwreg}, V} <- L])} || {{IP, riak_dt_map}, L} <- Value], {Delta, _} = dcos_net_utils:complement(NewValue, OldValue), lists:foreach( fun ({VTEP, Data}) -> Info = maps:map( fun (_K, V) -> to_str(V) end, Data#{vtep => VTEP}), ?LOG_NOTICE( "Overlay configuration was gossiped, subnet: ~s data: ~p", [to_str(Subnet), Info]) end, Delta), {Subnet, Delta, Config#{Subnet => NewValue}}. -spec(apply_configuration(config()) -> ok). apply_configuration(Config) -> Begin = erlang:monotonic_time(), Pid = dcos_overlay_configure:start_link(Config), Response = wait_for_response(Config), prometheus_summary:observe( overlay, update_processing_duration_seconds, [], erlang:monotonic_time() - Begin), case Response of ok -> ok; {error, Error} -> prometheus_counter:inc( overlay, update_failures_total, [], 1), ?LOG_ERROR( "Failed to apply overlay config: ~p due to ~p", [Config, Error]), exit(Error); timeout -> prometheus_counter:inc( overlay, update_failures_total, [], 1), ?LOG_ERROR( "dcos_overlay_configure got stuck applying ~p", [Config]), exit(Pid, kill), exit(overlay_configuration_timeout) end. -spec(wait_for_response(config()) -> ok | timeout | {error, term()}). wait_for_response(Config) -> Timeout = application:get_env(dcos_overlay, apply_timeout, timer:minutes(5)), receive {dcos_overlay_configure, applied_config, Config} -> ok; {dcos_overlay_configure, failed, Error, Config} -> {error, Error} after Timeout -> timeout end. -spec(to_str(term()) -> string()). to_str({IP, Prefix}) -> lists:concat([inet:ntoa(IP), "/", Prefix]); to_str(Mac) when length(Mac) =:= 6 -> List = [[integer_to_list(A div 16, 16), integer_to_list(A rem 16, 16)] || A <- Mac], lists:flatten(string:join(List, ":")); to_str(IP) -> inet:ntoa(IP). %%%=================================================================== %%% Metrics functions %%%=================================================================== -spec(init_metrics() -> ok). init_metrics() -> prometheus_summary:new([ {registry, overlay}, {name, update_processing_duration_seconds}, {duration_unit, seconds}, {help, "The time spent processing overlay updates."}]), prometheus_counter:new([ {registry, overlay}, {name, update_failures_total}, {help, "Total number of overlay update failures."}]). <|start_filename|>apps/dcos_dns/test/dcos_dns_mesos_tests.erl<|end_filename|> -module(dcos_dns_mesos_tests). -include_lib("eunit/include/eunit.hrl"). -include_lib("dns/include/dns.hrl"). -include_lib("erldns/include/erldns.hrl"). -include("dcos_dns.hrl"). % Lashup mocks -export([value/1, request_op/2]). -define( REPEAT(Attempts, Delay, Expr), lists:foldl( fun (A, false) -> try (Expr), true catch _:_ when A < Attempts -> timer:sleep(Delay), false end; (_A, true) -> true end, false, lists:seq(1, Attempts))). %%%=================================================================== %%% Tests %%%=================================================================== basic_test_() -> {setup, fun basic_setup/0, fun cleanup/1, [ {"None on Host", fun none_on_host/0}, {"None on User", fun none_on_dcos/0}, {"UCR on Host", fun ucr_on_host/0}, {"UCR on Bridge", fun ucr_on_bridge/0}, {"UCR on User", fun ucr_on_dcos/0}, {"Docker on Host", fun docker_on_host/0}, {"Docker on Bridge", fun docker_on_bridge/0}, {"Docker on User", fun docker_on_dcos/0}, {"Docker on IPv6", fun docker_on_ipv6/0}, {"Pod on Host", fun pod_on_host/0}, {"Pod on Bridge", fun pod_on_bridge/0}, {"Pod on User", fun pod_on_dcos/0} ]}. updates_test_() -> {setup, fun basic_setup/0, fun cleanup/1, [ {"Add task", fun add_task/0}, {"Remove task", fun remove_task/0} ]}. hello_overlay_test_() -> {setup, fun hello_overlay_setup/0, fun cleanup/1, [ {"hello-world", fun hello_overlay_world/0}, {"hello-overlay-0-server", fun hello_overlay_server/0}, {"hello-overlay-vip-0-server", fun hello_overlay_vip/0}, {"hello-host-vip-0-server", fun hello_overlay_host_vip/0} ]}. pod_tasks_test_() -> {setup, fun pod_tasks_setup/0, fun cleanup/1, [ {"pod-tasks", fun pod_tasks/0} ]}. -define(LOCALHOST, {127, 0, 0, 1}). resolve(DName) -> resolve(?DNS_TYPE_A, DName). resolve(DType, DName) -> DNSQueries = [#dns_query{name=DName, type=DType}], DNSMessage = #dns_message{ rd=true, qc=length(DNSQueries), questions=DNSQueries }, #dns_message{answers=DNSAnswers} = erldns_handler:do_handle(DNSMessage, ?LOCALHOST), DNSAnswers. %%%=================================================================== %%% Basic Tests %%%=================================================================== -define(DNAME(AppName, Type), ?DNAME(AppName, "marathon", Type)). -define(DNAME(AppName, Framework, Type), <<AppName, ".", Framework, ".", Type, ".dcos.thisdcos.directory">>). none_on_host() -> ?assertMatch( [#dns_rr{data=#dns_rrdata_a{ip = {172, 17, 0, 4}}}], resolve(?DNAME("none-on-host", "agentip"))), ?assertMatch( [#dns_rr{data=#dns_rrdata_a{ip = {172, 17, 0, 4}}}], resolve(?DNAME("none-on-host", "autoip"))), ?assertMatch( [#dns_rr{data=#dns_rrdata_a{ip = {172, 17, 0, 4}}}], resolve(?DNAME("none-on-host", "containerip"))). none_on_dcos() -> ?assertMatch( [#dns_rr{data=#dns_rrdata_a{ip = {172, 17, 0, 4}}}], resolve(?DNAME("none-on-dcos", "agentip"))), ?assertMatch( [#dns_rr{data=#dns_rrdata_a{ip = {9, 0, 2, 5}}}], resolve(?DNAME("none-on-dcos", "autoip"))), ?assertMatch( [#dns_rr{data=#dns_rrdata_a{ip = {9, 0, 2, 5}}}], resolve(?DNAME("none-on-dcos", "containerip"))). ucr_on_host() -> ?assertMatch( [#dns_rr{data=#dns_rrdata_a{ip = {172, 17, 0, 3}}}], resolve(?DNAME("ucr-on-host", "agentip"))), ?assertMatch( [#dns_rr{data=#dns_rrdata_a{ip = {172, 17, 0, 3}}}], resolve(?DNAME("ucr-on-host", "autoip"))), ?assertMatch( [#dns_rr{data=#dns_rrdata_a{ip = {172, 17, 0, 3}}}], resolve(?DNAME("ucr-on-host", "containerip"))). ucr_on_bridge() -> ?assertMatch( [#dns_rr{data=#dns_rrdata_a{ip = {172, 17, 0, 3}}}], resolve(?DNAME("ucr-on-bridge", "agentip"))), ?assertMatch( [#dns_rr{data=#dns_rrdata_a{ip = {172, 17, 0, 3}}}], resolve(?DNAME("ucr-on-bridge", "autoip"))), ?assertMatch( [#dns_rr{data=#dns_rrdata_a{ip = {172, 31, 254, 3}}}], resolve(?DNAME("ucr-on-bridge", "containerip"))). ucr_on_dcos() -> ?assertMatch( [#dns_rr{data=#dns_rrdata_a{ip = {172, 17, 0, 3}}}], resolve(?DNAME("ucr-on-dcos", "agentip"))), ?assertMatch( [#dns_rr{data=#dns_rrdata_a{ip = {9, 0, 1, 6}}}], resolve(?DNAME("ucr-on-dcos", "autoip"))), ?assertMatch( [#dns_rr{data=#dns_rrdata_a{ip = {9, 0, 1, 6}}}], resolve(?DNAME("ucr-on-dcos", "containerip"))). docker_on_host() -> ?assertMatch( [#dns_rr{data=#dns_rrdata_a{ip = {172, 17, 0, 4}}}], resolve(?DNAME("docker-on-host", "agentip"))), ?assertMatch( [#dns_rr{data=#dns_rrdata_a{ip = {172, 17, 0, 4}}}], resolve(?DNAME("docker-on-host", "autoip"))), ?assertMatch( [#dns_rr{data=#dns_rrdata_a{ip = {172, 17, 0, 4}}}], resolve(?DNAME("docker-on-host", "containerip"))). docker_on_bridge() -> ?assertMatch( [#dns_rr{data=#dns_rrdata_a{ip = {172, 17, 0, 4}}}], resolve(?DNAME("docker-on-bridge", "agentip"))), ?assertMatch( [#dns_rr{data=#dns_rrdata_a{ip = {172, 17, 0, 4}}}], resolve(?DNAME("docker-on-bridge", "autoip"))), ?assertMatch( [#dns_rr{data=#dns_rrdata_a{ip = {172, 18, 0, 2}}}], resolve(?DNAME("docker-on-bridge", "containerip"))). docker_on_dcos() -> ?assertMatch( [#dns_rr{data=#dns_rrdata_a{ip = {172, 17, 0, 4}}}], resolve(?DNAME("docker-on-dcos", "agentip"))), ?assertMatch( [#dns_rr{data=#dns_rrdata_a{ip = {9, 0, 2, 130}}}], resolve(?DNAME("docker-on-dcos", "autoip"))), ?assertMatch( [#dns_rr{data=#dns_rrdata_a{ip = {9, 0, 2, 130}}}], resolve(?DNAME("docker-on-dcos", "containerip"))). docker_on_ipv6() -> {ok, IPv6} = inet:parse_ipv6_address("fd01:b::2:8000:0:2"), ?assertMatch( [#dns_rr{data=#dns_rrdata_a{ip = {172, 17, 0, 4}}}], resolve(?DNAME("docker-on-ipv6", "agentip"))), ?assertMatch( [#dns_rr{data=#dns_rrdata_aaaa{ip = IPv6}}], resolve(?DNS_TYPE_AAAA, ?DNAME("docker-on-ipv6", "autoip"))), ?assertMatch( [#dns_rr{data=#dns_rrdata_aaaa{ip = IPv6}}], resolve(?DNS_TYPE_AAAA, ?DNAME("docker-on-ipv6", "containerip"))). pod_on_host() -> ?assertMatch( [#dns_rr{data=#dns_rrdata_a{ip = {172, 17, 0, 4}}}], resolve(?DNAME("pod-on-host", "agentip"))), ?assertMatch( [#dns_rr{data=#dns_rrdata_a{ip = {172, 17, 0, 4}}}], resolve(?DNAME("pod-on-host", "autoip"))), ?assertMatch( [#dns_rr{data=#dns_rrdata_a{ip = {172, 17, 0, 4}}}], resolve(?DNAME("pod-on-host", "containerip"))). pod_on_bridge() -> ?assertMatch( [#dns_rr{data=#dns_rrdata_a{ip = {172, 17, 0, 3}}}], resolve(?DNAME("pod-on-bridge", "agentip"))), ?assertMatch( [#dns_rr{data=#dns_rrdata_a{ip = {172, 17, 0, 3}}}], resolve(?DNAME("pod-on-bridge", "autoip"))), ?assertMatch( [#dns_rr{data=#dns_rrdata_a{ip = {172, 31, 254, 4}}}], resolve(?DNAME("pod-on-bridge", "containerip"))). pod_on_dcos() -> ?assertMatch( [#dns_rr{data=#dns_rrdata_a{ip = {172, 17, 0, 3}}}], resolve(?DNAME("pod-on-dcos", "agentip"))), ?assertMatch( [#dns_rr{data=#dns_rrdata_a{ip = {9, 0, 1, 3}}}], resolve(?DNAME("pod-on-dcos", "autoip"))), ?assertMatch( [#dns_rr{data=#dns_rrdata_a{ip = {9, 0, 1, 3}}}], resolve(?DNAME("pod-on-dcos", "containerip"))). %%%=================================================================== %%% Updates Tests %%%=================================================================== add_task() -> State = recon:get_state(dcos_dns_mesos), Ref = element(2, State), TaskId = <<"ucr-on-dcos.4014ba90-28b2-11e8-ab5a-70b3d5800002">>, Task = #{ name => <<"ucr-on-dcos">>, framework => <<"marathon">>, agent_ip => {172, 17, 0, 4}, task_ip => [{9, 0, 2, 3}], ports => [ #{name => <<"default">>, protocol => tcp, port => 0} ], state => {running, true} }, dcos_dns_mesos ! {task_updated, Ref, TaskId, Task}, ?REPEAT(20, 100, begin ?assertMatch( [#dns_rr{data=#dns_rrdata_a{ip = {172, 17, 0, 4}}}], resolve(?DNAME("docker-on-dcos", "agentip"))), ?assertMatch( [#dns_rr{data=#dns_rrdata_a{ip = {9, 0, 2, 130}}}], resolve(?DNAME("docker-on-dcos", "autoip"))), ?assertMatch( [#dns_rr{data=#dns_rrdata_a{ip = {9, 0, 2, 130}}}], resolve(?DNAME("docker-on-dcos", "containerip"))) end). remove_task() -> State = recon:get_state(dcos_dns_mesos), Ref = element(2, State), TaskId = <<"ucr-on-dcos.4014ba90-28b2-11e8-ab5a-70b3d5800002">>, Task = #{ name => <<"ucr-on-dcos">>, framework => <<"marathon">>, agent_ip => {172, 17, 0, 4}, task_ip => [{172, 18, 0, 5}], ports => [ #{name => <<"default">>, protocol => tcp, port => 0} ], state => false }, dcos_dns_mesos ! {task_updated, Ref, TaskId, Task}, timer:sleep(1100), % 1 second buffer + delay ?assertMatch( [#dns_rr{data=#dns_rrdata_a{ip = {172, 17, 0, 4}}}], resolve(?DNAME("docker-on-dcos", "agentip"))), ?assertMatch( [#dns_rr{data=#dns_rrdata_a{ip = {9, 0, 2, 130}}}], resolve(?DNAME("docker-on-dcos", "autoip"))), ?assertMatch( [#dns_rr{data=#dns_rrdata_a{ip = {9, 0, 2, 130}}}], resolve(?DNAME("docker-on-dcos", "containerip"))). %%%=================================================================== %%% Overlay Tests %%%=================================================================== hello_overlay_world() -> ?assertMatch( [#dns_rr{data=#dns_rrdata_a{ip = {10, 0, 0, 49}}}], resolve(?DNAME("hello-world", "agentip"))), ?assertMatch( [#dns_rr{data=#dns_rrdata_a{ip = {10, 0, 0, 49}}}], resolve(?DNAME("hello-world", "autoip"))), ?assertMatch( [#dns_rr{data=#dns_rrdata_a{ip = {10, 0, 0, 49}}}], resolve(?DNAME("hello-world", "containerip"))). hello_overlay_server() -> ?assertMatch( [#dns_rr{data=#dns_rrdata_a{ip = {10, 0, 0, 49}}}], resolve(?DNAME("hello-overlay-0-server", "hello-world", "agentip"))), ?assertMatch( [#dns_rr{data=#dns_rrdata_a{ip = {9, 0, 2, 2}}}], resolve(?DNAME("hello-overlay-0-server", "hello-world", "autoip"))), ?assertMatch( [#dns_rr{data=#dns_rrdata_a{ip = {9, 0, 2, 2}}}], resolve(?DNAME("hello-overlay-0-server", "hello-world", "containerip"))). hello_overlay_vip() -> ?assertMatch( [#dns_rr{data=#dns_rrdata_a{ip = {10, 0, 0, 49}}}], resolve(?DNAME("hello-overlay-vip-0-server", "hello-world", "agentip"))), ?assertMatch( [#dns_rr{data=#dns_rrdata_a{ip = {9, 0, 2, 3}}}], resolve(?DNAME("hello-overlay-vip-0-server", "hello-world", "autoip"))), ?assertMatch( [#dns_rr{data=#dns_rrdata_a{ip = {9, 0, 2, 3}}}], resolve(?DNAME("hello-overlay-vip-0-server", "hello-world", "containerip"))). hello_overlay_host_vip() -> ?assertMatch( [#dns_rr{data=#dns_rrdata_a{ip = {10, 0, 0, 49}}}], resolve(?DNAME("hello-host-vip-0-server", "hello-world", "agentip"))), ?assertMatch( [#dns_rr{data=#dns_rrdata_a{ip = {10, 0, 0, 49}}}], resolve(?DNAME("hello-host-vip-0-server", "hello-world", "autoip"))), ?assertMatch( [#dns_rr{data=#dns_rrdata_a{ip = {10, 0, 0, 49}}}], resolve(?DNAME("hello-host-vip-0-server", "hello-world", "containerip"))). %%%=================================================================== %%% Pod Tasks Tests %%%=================================================================== pod_tasks() -> ?assertMatch( [#dns_rr{data=#dns_rrdata_a{ip = {172, 17, 0, 3}}}], resolve(?DNAME("app", "agentip"))), ?assertMatch( [#dns_rr{data=#dns_rrdata_a{ip = {9, 0, 0, 2}}}], resolve(?DNAME("app", "autoip"))), ?assertMatch( [#dns_rr{data=#dns_rrdata_a{ip = {9, 0, 0, 2}}}], resolve(?DNAME("app", "containerip"))). %%%=================================================================== %%% Setup & cleanup %%%=================================================================== basic_setup() -> setup(basic_setup). hello_overlay_setup() -> setup(hello_overlay_setup). pod_tasks_setup() -> setup(pod_tasks_setup). setup(SetupFun) -> meck:new(lashup_kv), meck:expect(lashup_kv, value, fun value/1), meck:expect(lashup_kv, request_op, fun request_op/2), DefaultHandlerMounted = lists:member(default, logger:get_handler_ids()), case DefaultHandlerMounted of true -> ok = logger:remove_handler(default); _ -> ok end, {ok, Apps} = ensure_all_started(erldns), Tasks = dcos_net_mesos_listener_tests:SetupFun(), {ok, Pid} = dcos_dns_mesos:start_link(), true = lists:any(fun (_) -> timer:sleep(100), recon:get_state(dcos_dns_mesos) =/= [] end, lists:seq(1, 20)), {Tasks, Pid, Apps}. cleanup({Tasks, Pid, Apps}) -> unlink(Pid), exit(Pid, kill), meck:unload(lashup_kv), lists:foreach(fun application:stop/1, Apps), lists:foreach(fun application:unload/1, Apps), dcos_net_mesos_listener_tests:cleanup(Tasks). ensure_all_started(erldns) -> ok = application:load(erldns), {ok, Cwd} = file:get_cwd(), SysConfigFile = filename:join(Cwd, "config/ct.sys.config"), {ok, [SysConfig]} = file:consult(SysConfigFile), lists:foreach(fun ({App, Config}) -> lists:foreach(fun ({K, V}) -> application:set_env(App, K, V) end, Config) end, SysConfig), application:ensure_all_started(erldns). %%%=================================================================== %%% Lashup mocks %%%=================================================================== value(?LASHUP_LWW_KEY(ZoneName)) -> case erldns_zone_cache:get_zone_with_records(ZoneName) of {ok, #zone{records_by_name = RecordsByName}} -> Records = lists:append(maps:values(RecordsByName)), [{?RECORDS_LWW_FIELD, Records}]; {error, zone_not_found} -> [{?RECORDS_LWW_FIELD, []}] end. request_op(LKey = ?LASHUP_LWW_KEY(ZoneName), {update, Updates}) -> [{update, ?RECORDS_LWW_FIELD, Op}] = Updates, {assign, Records, _Timestamp} = Op, _Result = dcos_dns:push_prepared_zone(ZoneName, Records), {ok, value(LKey)}. <|start_filename|>apps/dcos_rest/src/dcos_rest_key_handler.erl<|end_filename|> %%%------------------------------------------------------------------- %%% @author sdhillon %%% @copyright (C) 2016, <COMPANY> %%% @doc %%% %%% @end %%% Created : 06. Jun 2016 6:05 PM %%%------------------------------------------------------------------- -module(dcos_rest_key_handler). -author("sdhillon"). -export([ init/2, content_types_provided/2, allowed_methods/2, to_json/2 ]). init(Req, Opts) -> {cowboy_rest, Req, Opts}. content_types_provided(Req, State) -> {[ {{<<"application">>, <<"json">>, []}, to_json} ], Req, State}. allowed_methods(Req, State) -> {[<<"GET">>], Req, State}. to_json(Req, State) -> case dcos_dns_key_mgr:keys() of #{public_key := PublicKey, secret_key := SecretKey} -> Data = #{zbase32_public_key => zbase32:encode(PublicKey), zbase32_secret_key => zbase32:encode(SecretKey)}, {jsx:encode(Data), Req, State}; false -> Body = <<"Cluster keys not found in Lashup">>, Req0 = cowboy_req:reply(404, #{}, Body, Req), {stop, Req0, State} end. <|start_filename|>apps/dcos_net/test/dns-hostname.json<|end_filename|> {"type":"GET_STATE","get_state":{"get_tasks":{"launched_tasks":[{"name":"test","task_id":{"value":"test.f12cc459-cb38-11e8-a264-2e431fa5cff2"},"framework_id":{"value":"d0a07cf9-7424-426b-b138-2be9d07b8e62-0001"},"agent_id":{"value":"d0a07cf9-7424-426b-b138-2be9d07b8e62-S4"},"state":"TASK_RUNNING","resources":[{"name":"cpus","type":"SCALAR","scalar":{"value":0.1},"allocation_info":{"role":"slave_public"}},{"name":"mem","type":"SCALAR","scalar":{"value":128},"allocation_info":{"role":"slave_public"}}],"statuses":[{"task_id":{"value":"test.f12cc459-cb38-11e8-a264-2e431fa5cff2"},"state":"TASK_STARTING","source":"SOURCE_EXECUTOR","agent_id":{"value":"d0a07cf9-7424-426b-b138-2be9d07b8e62-S4"},"executor_id":{"value":"test.f12cc459-cb38-11e8-a264-2e431fa5cff2"},"timestamp":1539030609.195301,"uuid":"km+dQKFTR42AC/UqeNA1jw==","container_status":{"container_id":{"value":"30bab618-50a1-4e14-9a9d-e8fe52ba4fc2"},"network_infos":[{"ip_addresses":[{"protocol":"IPv4","ip_address":"127.0.0.1"}]}]}},{"task_id":{"value":"test.f12cc459-cb38-11e8-a264-2e431fa5cff2"},"state":"TASK_RUNNING","source":"SOURCE_EXECUTOR","agent_id":{"value":"d0a07cf9-7424-426b-b138-2be9d07b8e62-S4"},"executor_id":{"value":"test.f12cc459-cb38-11e8-a264-2e431fa5cff2"},"timestamp":1539030609.995616,"uuid":"7cXig9VMRQ6YpbaD9KMDXg==","container_status":{"container_id":{"value":"30bab618-50a1-4e14-9a9d-e8fe52ba4fc2"},"network_infos":[{"ip_addresses":[{"protocol":"IPv4","ip_address":"127.0.0.1"}]}]}}],"status_update_state":"TASK_RUNNING","status_update_uuid":"7cXig9VMRQ6YpbaD9KMDXg==","discovery":{"visibility":"FRAMEWORK","name":"test","ports":{}},"container":{"type":"DOCKER","docker":{"image":"library/ubuntu","network":"HOST","privileged":false,"parameters":[{"key":"label","value":"MESOS_TASK_ID=test.f12cc459-cb38-11e8-a264-2e431fa5cff2"}],"force_pull_image":false}}}],"completed_tasks":[]},"get_executors":{"executors":[{"executor_info":{"executor_id":{"value":"test.f12cc459-cb38-11e8-a264-2e431fa5cff2"},"framework_id":{"value":"d0a07cf9-7424-426b-b138-2be9d07b8e62-0001"},"command":{"environment":{"variables":[{"name":"MARATHON_APP_VERSION","type":"VALUE","value":"2018-10-08T20:30:05.894Z"},{"name":"HOST","type":"VALUE","value":"localhost"},{"name":"MARATHON_APP_RESOURCE_CPUS","type":"VALUE","value":"0.1"},{"name":"MARATHON_APP_RESOURCE_GPUS","type":"VALUE","value":"0"},{"name":"MARATHON_APP_DOCKER_IMAGE","type":"VALUE","value":"library/ubuntu"},{"name":"MESOS_TASK_ID","type":"VALUE","value":"test.f12cc459-cb38-11e8-a264-2e431fa5cff2"},{"name":"MARATHON_APP_RESOURCE_MEM","type":"VALUE","value":"128.0"},{"name":"MARATHON_APP_RESOURCE_DISK","type":"VALUE","value":"0.0"},{"name":"MARATHON_APP_LABELS","type":"VALUE","value":""},{"name":"MARATHON_APP_ID","type":"VALUE","value":"/test"}]},"shell":false,"value":"/opt/mesosphere/packages/mesos--0ea3d8f2968796ab362056a15b84a374c7fa4409/libexec/mesos/mesos-executor","arguments":["mesos-executor","--launcher_dir=/opt/mesosphere/active/mesos/libexec/mesos"]},"container":{"type":"DOCKER","docker":{"image":"library/ubuntu","network":"HOST","privileged":false,"parameters":[{"key":"label","value":"MESOS_TASK_ID=test.f12cc459-cb38-11e8-a264-2e431fa5cff2"}],"force_pull_image":false}},"resources":[{"name":"cpus","type":"SCALAR","scalar":{"value":0.1},"allocation_info":{"role":"slave_public"}},{"name":"mem","type":"SCALAR","scalar":{"value":32},"allocation_info":{"role":"slave_public"}}],"name":"Command Executor (Task: test.f12cc459-cb38-11e8-a264-2e431fa5cff2) (Command: sh -c 'while true; ...')","source":"test.f12cc459-cb38-11e8-a264-2e431fa5cff2","discovery":{"visibility":"FRAMEWORK","name":"test","ports":{}}}}],"completed_executors":[]},"get_frameworks":{"frameworks":[{"framework_info":{"user":"root","name":"marathon","id":{"value":"d0a07cf9-7424-426b-b138-2be9d07b8e62-0001"},"failover_timeout":604800,"checkpoint":true,"role":"slave_public","hostname":"10.60.23.91","principal":"dcos_marathon","webui_url":"http://10.60.23.91:8080","capabilities":[{"type":"TASK_KILLING_STATE"},{"type":"GPU_RESOURCES"},{"type":"PARTITION_AWARE"},{"type":"REGION_AWARE"}]}}]},"get_agents":{"agents":[{"agent_info":{"hostname":"localhost","port":5051,"resources":[{"name":"ports","type":"RANGES","ranges":{"range":[{"begin":1025,"end":2180},{"begin":2182,"end":3887},{"begin":3889,"end":5049},{"begin":5052,"end":8079},{"begin":8082,"end":8180},{"begin":8182,"end":32000}]}},{"name":"disk","type":"SCALAR","scalar":{"value":13397.0}},{"name":"cpus","type":"SCALAR","scalar":{"value":4.0}},{"name":"mem","type":"SCALAR","scalar":{"value":14555.0}}],"id":{"value":"d0a07cf9-7424-426b-b138-2be9d07b8e62-S4"},"domain":{"fault_domain":{"region":{"name":"aws/us-east-1"},"zone":{"name":"aws/us-east-1d"}}}}}]}}} <|start_filename|>apps/dcos_dns/include/dcos_dns.hrl<|end_filename|> -define(APP, dcos_dns). -define(TLD, "zk"). -define(ERLDNS_HANDLER, dcos_dns_erldns_handler). -define(COUNTER, counter). -define(HISTOGRAM, histogram). -define(SPIRAL, spiral). -type upstream() :: {inet:ip4_address(), inet:port_number()}. -define(LASHUP_LWW_KEY(ZoneName), [dns, zones, ZoneName]). -define(RECORDS_LWW_FIELD, {records, riak_dt_lwwreg}). -define(DCOS_DIRECTORY(Prefix), <<Prefix, ".thisdcos.directory">>). -define(DCOS_DOMAIN, ?DCOS_DIRECTORY("dcos")). -define(MESOS_DOMAIN, ?DCOS_DIRECTORY("mesos")). -define(DCOS_DNS_TTL, 5). %% 30 seconds -define(DEFAULT_TIMEOUT, 30000). -define(DEFAULT_CONNECT_TIMEOUT, 30000). -define(EXHIBITOR_TIMEOUT, 30000). <|start_filename|>apps/dcos_l4lb/src/dcos_l4lb_metrics.erl<|end_filename|> %%%------------------------------------------------------------------- %%% @author <NAME> %%% @copyright (C) 2016, Mesosphere %%% @doc %%% %%% @end %%% Created : 24. Oct 2016 11:42 AM %%%------------------------------------------------------------------- -module(dcos_l4lb_metrics). -author("<NAME>"). -include_lib("telemetry/include/telemetry.hrl"). -include_lib("ip_vs_conn/include/ip_vs_conn.hrl"). -export([start_link/0]). -export([init/1, handle_call/3, handle_cast/2, handle_info/2, terminate/2, code_change/3]). -define(SERVER, ?MODULE). -type ip_vs_conn() :: #ip_vs_conn{}. -type backend_conns() :: #{inet:ip_address() => [ip_vs_conn()]}. -type tcp_metrics() :: []. %% netlink record -record(state, { conns = maps:new() :: conn_map(), backend_conns = maps:new() :: backend_conns() }). -spec(start_link() -> {ok, Pid :: pid()} | ignore | {error, Reason :: term()}). start_link() -> gen_server:start_link({local, ?SERVER}, ?MODULE, [], []). init([]) -> process_flag(trap_exit, true), erlang:send_after(splay_ms(), self(), push_metrics), {ok, #state{}}. handle_call(_Request, _From, State) -> {reply, ok, State}. handle_cast(_Request, State) -> {noreply, State}. handle_info(push_metrics, State = #state{}) -> ok = ip_vs_conn_monitor:get_connections(update_connections), erlang:send_after(splay_ms(), self(), push_metrics), {noreply, State}; handle_info({update_metrics, Metrics}, State = #state{}) -> update_metrics(State#state.backend_conns, Metrics), {noreply, State}; handle_info({update_connections, Conns}, State = #state{}) -> {NewConns, NewBackends} = update_connections(State#state.conns, Conns), erlang:send_after(1, self(), start_update_metrics), {noreply, State#state{conns = NewConns, backend_conns = NewBackends}}; handle_info(start_update_metrics, State) -> ok = tcp_metrics_monitor:get_metrics(update_metrics), {noreply, State}; handle_info(_Info, State) -> {noreply, State}. terminate(_Reason, _State = #state{}) -> ok. code_change(_OldVsn, State, _Extra) -> {ok, State}. %% TODO: borrowed from dcos_l4lb, should probably be a util somewhere -spec(splay_ms() -> integer()). splay_ms() -> MsPerMinute = dcos_l4lb_config:metrics_interval_seconds() * 1000, NextMinute = -1 * erlang:monotonic_time(milli_seconds) rem MsPerMinute, SplayMS = dcos_l4lb_config:metrics_splay_seconds() * 1000, FlooredSplayMS = max(1, SplayMS), Splay = rand:uniform(FlooredSplayMS), NextMinute + Splay. %% implementation -spec(update_connections(conn_map(), conn_map()) -> {conn_map(), backend_conns()}). update_connections(OldConns, Conns) -> Splay = dcos_l4lb_config:metrics_splay_seconds(), Interval = dcos_l4lb_config:metrics_interval_seconds(), PollDelay = (Splay + Interval), OnlyNewConns = new_connections(PollDelay, OldConns, Conns), Parsed = lists:map(fun ip_vs_conn:parse/1, maps:to_list(OnlyNewConns)), lists:foreach(fun (C) -> record_connection(C) end, Parsed), NewBackends = dst_ip_map(Parsed), OpenedOrDead = opened_or_dead(PollDelay, Conns), {OpenedOrDead, NewBackends}. -spec(update_metrics(conn_map(), tcp_metrics()) -> [{ip_vs_conn(), integer(), integer()}]). update_metrics(Backends, Metrics) -> P99s = get_p99s(Backends, Metrics), lists:flatmap(fun apply_p99/1, P99s). dst_ip_map(Parsed) -> lists:foldl(fun vip_addr_map/2, #{}, Parsed). vip_addr_map(C = #ip_vs_conn{dst_ip = IP}, Z) -> vip_addr_map(C, Z, maps:get(int_to_ip(IP), Z, undefined)). vip_addr_map(C = #ip_vs_conn{dst_ip = IP}, Z, undefined) -> maps:put(int_to_ip(IP), [C], Z); vip_addr_map(C = #ip_vs_conn{dst_ip = IP}, Z, Ls) -> maps:put(int_to_ip(IP), [C | Ls], Z). new_connections(PD, Conns, AllConns) -> maps:filter(fun(K, V) -> new_connection(PD, Conns, {K, V}) end, AllConns). %% only process new connections, or half opened connections that are about to expire new_connection(PD, Conns, {K, V}) -> not(maps:is_key(K, Conns)) and (is_opened({K, V}) or is_dead(PD, {K, V})). %% only dead if its half opened and about to expire is_dead(PD, {K, V=#ip_vs_conn_status{tcp_state = syn_recv}}) -> Conn = ip_vs_conn:parse({K, V}), PD > Conn#ip_vs_conn.expires; is_dead(PD, {K, V=#ip_vs_conn_status{tcp_state = syn_sent}}) -> Conn = ip_vs_conn:parse({K, V}), PD > Conn#ip_vs_conn.expires; is_dead(_PD, _KV) -> false. %% only opened if its not half opened is_opened({_K, #ip_vs_conn_status{tcp_state = syn_recv}}) -> false; is_opened({_K, #ip_vs_conn_status{tcp_state = syn_sent}}) -> false; is_opened(_KV) -> true. -spec(opened_or_dead(integer(), conn_map()) -> conn_map()). opened_or_dead(PD, Conns) -> maps:filter(fun(K, V) -> is_opened({K, V}) or is_dead(PD, {K, V}) end, Conns). -spec(record_connection(ip_vs_conn())-> ok). record_connection(Conn = #ip_vs_conn{tcp_state = syn_recv}) -> conn_failed(Conn); record_connection(Conn = #ip_vs_conn{tcp_state = syn_sent}) -> conn_failed(Conn); record_connection(Conn) -> conn_success(Conn). -spec(conn_failed(ip_vs_conn()) -> ok). conn_failed(#ip_vs_conn{dst_ip = IP, dst_port = Port, to_ip = VIP, to_port = VIPPort}) -> Tags = named_tags(IP, Port, VIP, VIPPort), AggTags = [[hostname], [hostname, backend]], telemetry:counter(mm_connect_failures, Tags, AggTags, 1). -spec(conn_success(ip_vs_conn()) -> ok). conn_success(#ip_vs_conn{dst_ip = IP, dst_port = Port, to_ip = VIP, to_port = VIPPort}) -> Tags = named_tags(IP, Port, VIP, VIPPort), AggTags = [[hostname], [hostname, backend]], telemetry:counter(mm_connect_successes, Tags, AggTags, 1). get_p99s(Conns, Metrics) -> lists:flatmap(fun (M) -> get_p99_updates(Conns, M) end, Metrics). get_p99_updates(Conns, {netlink, tcp_metrics, _, _, _, {get, _, _, Attrs}}) -> match_metrics(Conns, proplists:get_value(d_addr, Attrs), proplists:get_value(vals, Attrs)). match_metrics(_, undefined, _) -> []; match_metrics(_, _, undefined) -> []; match_metrics(Conns, Addr, Vals) -> match_conn(maps:get(Addr, Conns, undefined), proplists:get_value(rtt_us, Vals), proplists:get_value(rtt_var_us, Vals)). match_conn(undefined, _, _) -> []; match_conn(_, undefined, _) -> []; match_conn(_, _, undefined) -> []; match_conn(Conns, RttUs, RttVarUs) -> [{Conns, RttUs, RttVarUs}]. apply_p99({Conns, RttUs, RttVarUs}) -> lists:flatmap(fun(C) -> apply_p99(C, RttUs, RttVarUs) end, Conns). apply_p99(C = #ip_vs_conn{dst_ip = IP, dst_port = Port, to_ip = VIP, to_port = VIPPort}, RttUs, RttVarUs) -> P99 = erlang:round(1000*(RttUs + math:sqrt(RttVarUs)*3)), Tags = named_tags(IP, Port, VIP, VIPPort), AggTags = [[hostname], [hostname, backend]], telemetry:histogram(mm_connect_latency, Tags, AggTags, P99), [{C, RttUs, RttVarUs}]. -spec(named_tags(IIP :: integer(), Port :: inet:port_numbrer(), IVIP :: integer(), VIPPort :: inet:port_numbrer()) -> map:map()). named_tags(IIP, Port, IVIP, VIPPort) -> IP = int_to_ip(IIP), VIP = int_to_ip(IVIP), Result = #{vip => fmt_ip_port(VIP, VIPPort), backend => fmt_ip_port(IP, Port)}, case dcos_l4lb_lashup_vip_listener:ip2name(VIP) of false -> Result; VIPName -> Result#{name => VIPName} end. int_to_ip(IntIP) -> <<A, B, C, D>> = <<IntIP:32/integer>>, {A, B, C, D}. -spec(fmt_ip_port(IP :: inet:ip4_address(), Port :: inet:port_number()) -> binary()). fmt_ip_port(IP, Port) -> IPString = inet_parse:ntoa(IP), List = io_lib:format("~s_~p", [IPString, Port]), list_to_binary(List). -ifdef(TEST). -include_lib("eunit/include/eunit.hrl"). new_conn_test_() -> Conn = <<"TCP 0A004FB6 F26D 0A004FB6 1F90 0A004FB6 1F91 ">>, ConnStatus = #ip_vs_conn_status{conn_state = <<"50 ">>, tcp_state = established}, [?_assertEqual(#{Conn => ConnStatus}, new_connections(100, #{}, #{Conn => ConnStatus})), ?_assertEqual(#{Conn => ConnStatus}, new_connections(0, #{}, #{Conn => ConnStatus})), ?_assertEqual(#{}, new_connections(100, #{Conn => ConnStatus}, #{Conn => ConnStatus})), ?_assertEqual(#{}, new_connections(0, #{Conn => ConnStatus}, #{Conn => ConnStatus}))]. new_conn1_test_() -> Conn = <<"TCP 0A004FB6 F26D 0A004FB6 1F90 0A004FB6 1F91 ">>, ConnStatus1 = #ip_vs_conn_status{conn_state = <<"50 ">>, tcp_state = syn_recv}, ConnStatus2 = #ip_vs_conn_status{conn_state = <<"50 ">>, tcp_state = syn_sent}, [?_assertEqual(true, is_dead(100, {Conn, ConnStatus1})), ?_assertEqual(false, is_dead(0, {Conn, ConnStatus1})), ?_assertEqual(false, is_opened({Conn, ConnStatus1})), ?_assertEqual(#{Conn => ConnStatus1}, new_connections(100, #{}, #{Conn => ConnStatus1})), ?_assertEqual(#{Conn => ConnStatus2}, new_connections(100, #{}, #{Conn => ConnStatus2})), ?_assertEqual(#{}, new_connections(25, #{}, #{Conn => ConnStatus2})), ?_assertEqual(#{}, new_connections(25, #{Conn => ConnStatus2}, #{Conn => ConnStatus2})), ?_assertEqual(#{}, new_connections(100, #{Conn => ConnStatus2}, #{Conn => ConnStatus2})) ]. get_p99s_test_() -> DAddr = {54, 192, 147, 29}, Attrs = [{d_addr, DAddr}, {s_addr, {10, 0, 79, 182}}, {age_ms, 806101408}, {vals, [{rtt_us, 47313}, {rtt_ms, 47}, {rtt_var_us, 23656}, {rtt_var_ms, 23}, {cwnd, 10}]}], Metrics = [{netlink, tcp_metrics, [multi], 18, 31595, {get, 1, 0, Attrs}}], IP = 16#36c0931d, Conn = {ip_vs_conn, tcp, established, 167792566, 47808, 167792566, 8080, IP, 8081, 59}, Conn2 = {ip_vs_conn, tcp, established, 167792567, 47808, 167792566, 8080, IP, 8081, 59}, DAddr = int_to_ip(IP), ConnMap = #{DAddr => [Conn]}, ConnMap2 = #{DAddr => [Conn, Conn2]}, [?_assertEqual(DAddr, int_to_ip(IP)), ?_assertEqual([{[Conn], 47313, 23656}], get_p99s(ConnMap, Metrics)), ?_assertEqual([{[Conn, Conn2], 47313, 23656}], get_p99s(ConnMap2, Metrics))]. process_p99s_test_() -> DAddr = {54, 192, 147, 29}, Attrs = [{d_addr, DAddr}, {s_addr, {10, 0, 79, 182}}, {age_ms, 806101408}, {vals, [{rtt_us, 47313}, {rtt_ms, 47}, {rtt_var_us, 23656}, {rtt_var_ms, 23}, {cwnd, 10}]}], Metrics = [{netlink, tcp_metrics, [multi], 18, 31595, {get, 1, 0, Attrs}}], IP = 16#36c0931d, Conn = {ip_vs_conn, tcp, established, 167792566, 47808, 167792566, 8080, IP, 8081, 59}, Conn2 = {ip_vs_conn, tcp, established, 167792567, 47808, 167792566, 8080, IP, 8081, 59}, ConnMap = #{DAddr => [Conn]}, ConnMap2 = #{DAddr => [Conn, Conn2]}, [?_assertEqual(DAddr, int_to_ip(IP)), ?_assertEqual([{Conn, 47313, 23656}], update_metrics(ConnMap, Metrics)), ?_assertEqual([{Conn, 47313, 23656}, {Conn2, 47313, 23656}], update_metrics(ConnMap2, Metrics)), ?_assertEqual([], update_metrics(#{}, Metrics)) ]. process_p99s_1_test_() -> DAddr = {54, 192, 147, 29}, Attrs = [{d_addr, DAddr}, {s_addr, {10, 0, 79, 182}}, {age_ms, 806101408}, {vals, [{rtt_us, 47313}, {rtt_ms, 47}, {rtt_var_ms, 23}, {cwnd, 10}]}], Metrics = [{netlink, tcp_metrics, [multi], 18, 31595, {get, 1, 0, Attrs}}], IP = 16#36c0931d, Conn = {ip_vs_conn, tcp, established, 167792566, 47808, 167792566, 8080, IP, 8081, 59}, Conn2 = {ip_vs_conn, tcp, established, 167792567, 47808, 167792566, 8080, IP, 8081, 59}, ConnMap = #{DAddr => [Conn]}, ConnMap2 = #{DAddr => [Conn, Conn2]}, [?_assertEqual(DAddr, int_to_ip(IP)), ?_assertEqual([], update_metrics(ConnMap, Metrics)), ?_assertEqual([], update_metrics(ConnMap2, Metrics)) ]. process_p99s_2_test_() -> DAddr = {54, 192, 147, 29}, Attrs = [{d_addr, DAddr}, {s_addr, {10, 0, 79, 182}}, {age_ms, 806101408}, {vals, [{rtt_var_us, 23656}, {rtt_ms, 47}, {rtt_var_ms, 23}, {cwnd, 10}]}], Metrics = [{netlink, tcp_metrics, [multi], 18, 31595, {get, 1, 0, Attrs}}], IP = 16#36c0931d, Conn = {ip_vs_conn, tcp, established, 167792566, 47808, 167792566, 8080, IP, 8081, 59}, Conn2 = {ip_vs_conn, tcp, established, 167792567, 47808, 167792566, 8080, IP, 8081, 59}, ConnMap = #{DAddr => [Conn]}, ConnMap2 = #{DAddr => [Conn, Conn2]}, [?_assertEqual(DAddr, int_to_ip(IP)), ?_assertEqual([], update_metrics(ConnMap, Metrics)), ?_assertEqual([], update_metrics(ConnMap2, Metrics)) ]. process_p99s_3_test_() -> DAddr = {54, 192, 147, 29}, Attrs = [{s_addr, {10, 0, 79, 182}}, {age_ms, 806101408}, {vals, [{rtt_var_us, 23656}, {rtt_ms, 47}, {rtt_var_ms, 23}, {cwnd, 10}]}], Metrics = [{netlink, tcp_metrics, [multi], 18, 31595, {get, 1, 0, Attrs}}], IP = 16#36c0931d, Conn = {ip_vs_conn, tcp, established, 167792566, 47808, 167792566, 8080, IP, 8081, 59}, Conn2 = {ip_vs_conn, tcp, established, 167792567, 47808, 167792566, 8080, IP, 8081, 59}, ConnMap = #{DAddr => [Conn]}, ConnMap2 = #{DAddr => [Conn, Conn2]}, [?_assertEqual(DAddr, int_to_ip(IP)), ?_assertEqual([], update_metrics(ConnMap, Metrics)), ?_assertEqual([], update_metrics(ConnMap2, Metrics)) ]. process_p99s_4_test_() -> DAddr = {54, 192, 147, 29}, Attrs = [{d_addr, DAddr}, {s_addr, {10, 0, 79, 182}}, {age_ms, 806101408}], Metrics = [{netlink, tcp_metrics, [multi], 18, 31595, {get, 1, 0, Attrs}}], IP = 16#36c0931d, Conn = {ip_vs_conn, tcp, established, 167792566, 47808, 167792566, 8080, IP, 8081, 59}, Conn2 = {ip_vs_conn, tcp, established, 167792567, 47808, 167792566, 8080, IP, 8081, 59}, ConnMap = #{DAddr => [Conn]}, ConnMap2 = #{DAddr => [Conn, Conn2]}, [?_assertEqual(DAddr, int_to_ip(IP)), ?_assertEqual([], update_metrics(ConnMap, Metrics)), ?_assertEqual([], update_metrics(ConnMap2, Metrics)) ]. process_dst_ip_map_test_() -> DAddr = {54, 192, 147, 29}, IP = 16#36c0931d, Conn = {ip_vs_conn, tcp, established, 167792566, 47808, 167792566, 8080, IP, 8081, 59}, Conn2 = {ip_vs_conn, tcp, established, 167792567, 47808, 167792566, 8080, IP, 8081, 59}, ConnMap = #{DAddr => [Conn]}, ConnMap2 = #{DAddr => [Conn2, Conn]}, [?_assertEqual(DAddr, int_to_ip(IP)), ?_assertEqual(ConnMap, dst_ip_map([Conn])), ?_assertEqual(ConnMap2, dst_ip_map([Conn, Conn2])) ]. record_failed_test_() -> Conn1 = {ip_vs_conn, tcp, syn_sent, 167792566, 47808, 167792566, 8080, 167792566, 8081, 59}, Conn2 = {ip_vs_conn, tcp, syn_recv, 167792567, 47808, 167792566, 8080, 167792566, 8081, 59}, [?_assertEqual(ok, record_connection(Conn1)), ?_assertEqual(ok, record_connection(Conn2))]. -endif. <|start_filename|>apps/dcos_net/src/dcos_net_killer.erl<|end_filename|> %%% @doc Kills stuck processes -module(dcos_net_killer). -behaviour(gen_server). %% API -export([start_link/0]). %% gen_server callbacks -export([init/1, handle_call/3, handle_cast/2, handle_info/2]). -include_lib("kernel/include/logger.hrl"). -record(state, { ref :: reference(), reductions :: #{pid() => non_neg_integer()} }). -spec(start_link() -> {ok, Pid :: pid()} | ignore | {error, Reason :: term()}). start_link() -> gen_server:start_link({local, ?MODULE}, ?MODULE, [], []). %%%=================================================================== %%% gen_server callbacks %%%=================================================================== init([]) -> Ref = erlang:start_timer(0, self(), kill), {ok, #state{ref=Ref, reductions=#{}}}. handle_call(_Request, _From, State) -> {reply, ok, State}. handle_cast(_Request, State) -> {noreply, State}. handle_info({timeout, Ref, kill}, #state{ref=Ref, reductions=Prev}=State) -> Rs = reductions(), StuckProcesses = maps:fold(fun (Pid, R, Acc) -> case maps:find(Pid, Prev) of {ok, R} -> [Pid|Acc]; _Other -> Acc end end, [], Rs), lists:foreach(fun maybe_kill/1, StuckProcesses), Timeout = application:get_env(dcos_net, killer_timeout, timer:minutes(5)), Ref0 = erlang:start_timer(Timeout, self(), kill), {noreply, State#state{ref=Ref0, reductions=Rs}, hibernate}; handle_info(_Info, State) -> {noreply, State}. %%%=================================================================== %%% Internal functions %%%=================================================================== -spec(reductions() -> #{pid() => non_neg_integer()}). reductions() -> lists:foldl(fun (Pid, Acc) -> case erlang:process_info(Pid, reductions) of {reductions, R} -> Acc#{Pid => R}; undefined -> Acc end end, #{}, erlang:processes()). -spec(maybe_kill(pid()) -> true | no_return()). maybe_kill(Pid) -> case erlang:process_info(Pid, current_function) of {current_function, MFA} -> maybe_kill(Pid, MFA); undefined -> true end. -spec(maybe_kill(pid(), mfa()) -> true | no_return()). maybe_kill(Pid, MFA) -> case stuck_fun(MFA) of true -> kill(Pid, MFA); false -> true end. -spec(kill(pid(), mfa()) -> true | no_return()). kill(Pid, MFA) -> ?LOG_ALERT("~p got stuck: ~p", [Pid, MFA]), case application:get_env(dcos_net, killer, disabled) of disabled -> true; enabled -> exit(Pid, kill); {enabled, abort} -> erlang:halt(abort) end. -spec(stuck_fun(mfa()) -> boolean()). stuck_fun({erlang, hibernate, 3}) -> false; stuck_fun({erts_code_purger, wait_for_request, 0}) -> false; stuck_fun({gen_event, fetch_msg, 6}) -> false; stuck_fun({prim_inet, accept0, _}) -> false; stuck_fun({prim_inet, recv0, 2}) -> false; stuck_fun({timer, sleep, 1}) -> false; stuck_fun({group, _F, _A}) -> false; stuck_fun({global, _F, _A}) -> false; stuck_fun({prim_eval, _F, _A}) -> false; stuck_fun({io, _F, _A}) -> false; stuck_fun({shell, _F, _A}) -> false; stuck_fun({recon_trace, _F, _A}) -> false; stuck_fun({_M, F, _A}) -> Fun = atom_to_binary(F, latin1), binary:match(Fun, <<"loop">>) =:= nomatch. <|start_filename|>apps/dcos_net/src/dcos_net_vm_metrics_collector.erl<|end_filename|> -module(dcos_net_vm_metrics_collector). -behaviour(prometheus_collector). -export([ init/0, deregister_cleanup/1, collect_mf/2 ]). -spec(init() -> true). init() -> ets:new(?MODULE, [public, named_table]), true. -spec(deregister_cleanup(term()) -> ok). deregister_cleanup(_) -> ok. -spec(collect_mf(_Registry, Callback) -> ok when _Registry :: prometheus_registry:registry(), Callback :: prometheus_collector:callback()). collect_mf(_Registry, Callback) -> lists:foreach(fun ({Name, Help, Type, Metrics}) -> MF = prometheus_model_helpers:create_mf(Name, Help, Type, Metrics), Callback(MF) end, metrics()). %%%=================================================================== %%% Internal functions %%%=================================================================== -spec(metrics() -> [{Name, Help, Type, Metrics}] when Name :: atom(), Help :: string(), Type :: atom(), Metrics :: term()). metrics() -> [{erlang_vm_scheduler_utilization, "Erlang VM Scheduler utilization.", gauge, utilization()}]. -spec(utilization() -> [{Labels, Util}] when Labels :: [{string(), term()}], Util :: non_neg_integer()). utilization() -> _ = erlang:system_flag(scheduler_wall_time, true), SWT = erlang:statistics(scheduler_wall_time_all), PrevSWT = case ets:lookup(?MODULE, scheduler_wall_time) of [{scheduler_wall_time, Prev}] -> Prev; [] -> [{I, 0, 0} || {I, _, _} <- SWT] end, true = ets:insert(?MODULE, {scheduler_wall_time, SWT}), [ {scheduler_labels(Id), min(max(0, U), 1)} || {Id, U} <- recon_lib:scheduler_usage_diff(PrevSWT, SWT) ]. -spec(scheduler_labels(pos_integer()) -> [{string(), term()}]). scheduler_labels(Id) -> Schedulers = erlang:system_info(schedulers), DirtyCPUs = erlang:system_info(dirty_cpu_schedulers), case Id of Id when Id =< Schedulers -> [{"id", Id}, {"type", "scheduler"}]; Id when Id =< Schedulers + DirtyCPUs -> [{"id", Id}, {"type", "dirty_cpu"}]; Id -> [{"id", Id}, {"type", "dirty_io"}] end. <|start_filename|>Dockerfile<|end_filename|> FROM erlang:22.0 RUN apt-get update && apt-get install -y \ dnsutils ipvsadm \ && rm -rf /var/lib/apt/lists/* \ && git clone --branch stable https://github.com/jedisct1/libsodium.git \ && git -C libsodium checkout b732443c442239c2e0184820e9b23cca0de0828c \ && ( cd libsodium && ./autogen.sh && ./configure ) \ && make -C libsodium -j$(getconf _NPROCESSORS_ONLN) install \ && rm -r libsodium CMD ["bash"] <|start_filename|>apps/dcos_dns/src/dcos_dns_mesos_dns.erl<|end_filename|> -module(dcos_dns_mesos_dns). -behavior(gen_server). -include("dcos_dns.hrl"). -include_lib("kernel/include/logger.hrl"). -ifdef(TEST). -include_lib("eunit/include/eunit.hrl"). -endif. -define(MESOS_DNS_URI, "http://127.0.0.1:8123/v1/axfr"). %% API -export([ start_link/0 ]). %% gen_server callbacks -export([init/1, handle_call/3, handle_cast/2, handle_info/2]). -record(state, { ref :: reference(), hash = <<>> :: binary() }). -type state() :: #state{}. -spec(start_link() -> {ok, Pid :: pid()} | ignore | {error, Reason :: term()}). start_link() -> gen_server:start_link({local, ?MODULE}, ?MODULE, [], []). %%%=================================================================== %%% gen_server callbacks %%%=================================================================== init([]) -> TRef = start_poll_timer(0), {ok, #state{ref=TRef}}. handle_call(_Request, _From, State) -> {reply, ok, State}. handle_cast(_Request, State) -> {noreply, State}. handle_info({timeout, Ref, mesos_dns_poll}, #state{ref=Ref}=State) -> State0 = handle_poll(State), TRef = start_poll_timer(), {noreply, State0#state{ref=TRef}, hibernate}; handle_info(_Info, State) -> {noreply, State}. %%%=================================================================== %%% Internal functions %%%=================================================================== -spec(start_poll_timer() -> reference()). start_poll_timer() -> Timeout = application:get_env(dcos_dns, mesos_dns_timeout, 30000), start_poll_timer(Timeout). -spec(start_poll_timer(timeout()) -> reference()). start_poll_timer(Timeout) -> erlang:start_timer(Timeout, self(), mesos_dns_poll). -spec(handle_poll(state()) -> state()). handle_poll(State) -> IsLeader = dcos_net_mesos_listener:is_leader(), handle_poll(IsLeader, State). -spec(handle_poll(IsLeader :: boolean(), state()) -> state()). handle_poll(false, State) -> State; handle_poll(true, State) -> Request = {?MESOS_DNS_URI, []}, Options = dcos_net_mesos:http_options(), {ok, Ref} = httpc:request(get, Request, Options, [{sync, false}]), Timeout = application:get_env(dcos_dns, mesos_dns_timeout, 30000), receive {http, {Ref, {error, Error}}} -> ?LOG_WARNING("Failed to connect to mesos-dns: ~p", [Error]), State; {http, {Ref, {{_HTTPVersion, 200, _StatusStr}, _Headers, Body}}} -> try get_records(Body) of Records -> maybe_push_zone(Records, State) catch Class:Error:ST -> ?LOG_WARNING( "Failed to process mesos-dns data [~p] ~p ~p", [Class, Error, ST]), State end; {http, {Ref, {{_HTTPVersion, Status, _StatusStr}, _Headers, Body}}} -> ?LOG_WARNING( "Failed to get data from mesos-dns [~p] ~s", [Status, Body]), State after Timeout -> ok = httpc:cancel_request(Ref), ?LOG_WARNING("mesos-dns connection timeout"), State end. %%%=================================================================== %%% Handle data %%%=================================================================== -spec(get_records(binary()) -> #{dns:dname() => [dns:dns_rr()]}). get_records(Body) -> Data = jiffy:decode(Body, [return_maps]), Domain = maps:get(<<"Domain">>, Data, <<"mesos">>), Records = maps:get(<<"Records">>, Data, #{}), RecordsByName = #{ ?MESOS_DOMAIN => [ dcos_dns:soa_record(?MESOS_DOMAIN), dcos_dns:ns_record(?MESOS_DOMAIN) ] }, List = [ {<<"As">>, fun parse_ip/2, fun dcos_dns:dns_record/2}, {<<"AAAAs">>, fun parse_ip/2, fun dcos_dns:dns_record/2}, {<<"SRVs">>, fun parse_srv/2, fun dcos_dns:srv_record/2} ], lists:foldl(fun ({Field, ParseFun, RecordFun}, Acc) -> add_records(Domain, Records, Field, ParseFun, RecordFun, Acc) end, RecordsByName, List). -spec(add_records(Domain, Records, Field, ParseFun, RecordFun, Acc) -> Acc when Domain :: dns:dname(), Records :: jiffy:json_term(), Field :: binary(), Acc :: #{dns:dname() => [dns:dns_rr()]}, ParseFun :: fun((binary(), dns:dname()) -> term()), RecordFun :: fun((dns:dname(), term()) -> dns:dns_rr())). add_records(Domain, Records, Field, ParseFun, RecordFun, Acc0) -> Data = maps:get(Field, Records, #{}), maps:fold(fun (DName, List, Acc) -> DName0 = dname(DName, Domain), List0 = [ParseFun(L, Domain) || L <- List], RRs = [RecordFun(DName0, L) || L <- lists:sort(List0)], mappend_list(DName0, RRs, Acc) end, Acc0, Data). -spec(mappend_list(Key :: A, List :: [B], Map) -> Map when Map :: #{A => [B]}, A :: term(), B :: term()). mappend_list(Key, List, Map) -> case maps:find(Key, Map) of {ok, Value} -> Map#{Key => List ++ Value}; error -> Map#{Key => List} end. -spec(dname(dns:dname(), dns:dname()) -> dns:dname()). dname(DName, DomainName) -> DName0 = binary:part(DName, 0, size(DName) - size(DomainName) - 1), <<DName0/binary, ?MESOS_DOMAIN/binary>>. -spec(parse_ip(binary(), dns:dname()) -> inet:ip_address()). parse_ip(IPBin, _Domain) -> IPStr = binary_to_list(IPBin), {ok, IP} = inet:parse_strict_address(IPStr), IP. -spec(parse_srv(binary(), dns:dname()) -> {dns:dname(), inet:port_number()}). parse_srv(HostPort, Domain) -> [Host, Port] = binary:split(HostPort, <<":">>), {dname(Host, Domain), binary_to_integer(Port)}. -spec(maybe_push_zone(#{dns:dname() => [dns:dns_rr()]}, state()) -> state()). maybe_push_zone(Records, #state{hash=Hash}=State) -> case crypto:hash(sha, term_to_binary(Records)) of Hash -> State; Hash0 -> push_zone(Records, State#state{hash=Hash0}) end. -spec(push_zone(#{dns:dname() => [dns:dns_rr()]}, state()) -> state()). push_zone(RecordsByName, State) -> Counts = lists:map(fun length/1, maps:values(RecordsByName)), ok = dcos_dns_mesos:push_zone(?MESOS_DOMAIN, RecordsByName), ?LOG_NOTICE("Mesos DNS Sync: ~p records", [lists:sum(Counts)]), State. <|start_filename|>apps/dcos_l4lb/src/dcos_l4lb_sup.erl<|end_filename|> -module(dcos_l4lb_sup). -behaviour(supervisor). -export([start_link/1, init/1]). -define(CHILD(Module), #{id => Module, start => {Module, start_link, []}}). -define(CHILD(Module, Custom), maps:merge(?CHILD(Module), Custom)). start_link([Enabled]) -> supervisor:start_link({local, ?MODULE}, ?MODULE, [Enabled]). init([false]) -> {ok, {#{}, []}}; init([true]) -> dcos_l4lb_mesos_poller:init_metrics(), {ok, {#{intensity => 10000, period => 1}, [ ?CHILD(dcos_l4lb_network_sup, #{type => supervisor}), ?CHILD(dcos_l4lb_mesos_poller), ?CHILD(dcos_l4lb_metrics), ?CHILD(dcos_l4lb_lashup_publish) ]}}. <|start_filename|>apps/dcos_l4lb/src/dcos_l4lb_route_mgr.erl<|end_filename|> %%%------------------------------------------------------------------- %%% @author sdhillon %%% @copyright (C) 2016, <COMPANY> %%% @doc %%% %%% @end %%% Created : 02. Nov 2016 9:36 AM %%%------------------------------------------------------------------- -module(dcos_l4lb_route_mgr). -author("sdhillon"). -behaviour(gen_server). %% API -export([start_link/0, get_routes/2, add_routes/3, remove_routes/3, add_netns/2, remove_netns/2, init_metrics/0]). %% gen_server callbacks -export([init/1, handle_call/3, handle_cast/2, handle_info/2]). -include_lib("kernel/include/logger.hrl"). -include_lib("gen_netlink/include/netlink.hrl"). -include("dcos_l4lb.hrl"). -define(LOCAL_TABLE, 255). %% local table -define(MAIN_TABLE, 254). %% main table -define(MINUTEMAN_IFACE, "minuteman"). -define(LO_IFACE, "lo"). -record(state, { netns :: map() }). -record(params, { pid :: pid(), iface :: non_neg_integer(), lo_iface :: non_neg_integer() | undefined }). %%%=================================================================== %%% API %%%=================================================================== get_routes(Pid, Namespace) -> call(Pid, {get_routes, Namespace}). add_routes(Pid, Routes, Namespace) -> call(Pid, {add_routes, Routes, Namespace}). remove_routes(Pid, Routes, Namespace) -> call(Pid, {remove_routes, Routes, Namespace}). add_netns(Pid, UpdateValue) -> call(Pid, {add_netns, UpdateValue}). remove_netns(Pid, UpdateValue) -> call(Pid, {remove_netns, UpdateValue}). %%-------------------------------------------------------------------- %% @doc %% Starts the server %% %% @end %%-------------------------------------------------------------------- -spec(start_link() -> {ok, Pid :: pid()} | ignore | {error, Reason :: term()}). start_link() -> gen_server:start_link(?MODULE, [], []). %%%=================================================================== %%% gen_server callbacks %%%=================================================================== init([]) -> {ok, Pid} = gen_netlink_client:start_link(?NETLINK_ROUTE), {ok, Iface} = gen_netlink_client:if_nametoindex(?MINUTEMAN_IFACE), {ok, LoIface} = gen_netlink_client:if_nametoindex(?LO_IFACE), Params = #params{pid = Pid, iface = Iface, lo_iface = LoIface}, {ok, #state{netns = #{host => Params}}}. handle_call({get_routes, Namespace}, _From, State) -> Routes = handle_get_routes(Namespace, State), {reply, Routes, State}; handle_call({add_routes, Routes, Namespace}, _From, State) -> ?LOG_INFO("Namespace: ~p, Adding Routes: ~p", [Namespace, Routes]), update_routes(Routes, newroute, Namespace, State), {reply, ok, State}; handle_call({remove_routes, Routes, Namespace}, _From, State) -> ?LOG_INFO("Namespace: ~p, Removing Routes: ~p", [Namespace, Routes]), update_routes(Routes, delroute, Namespace, State), {reply, ok, State}; handle_call({add_netns, UpdateValue}, _From, State0) -> {Reply, State1} = handle_add_netns(UpdateValue, State0), {reply, Reply, State1}; handle_call({remove_netns, UpdateValue}, _From, State0) -> {Reply, State1} = handle_remove_netns(UpdateValue, State0), {reply, Reply, State1}; handle_call(_Request, _From, State) -> {reply, ok, State}. handle_cast(_Request, State) -> {noreply, State}. handle_info(_Info, State) -> {noreply, State}. %%%=================================================================== %%% Internal functions %%%=================================================================== handle_get_routes(Namespace, #state{netns = NetnsMap}) -> V4_Routes = handle_get_route2(inet, ?LOCAL_TABLE, maps:get(Namespace, NetnsMap)), %% For v6, we add routes both in local and main table. However, the routes %% in local table are on loopback interface. Hence, we do a route lookup on main %% table to filter them based on minuteman interface V6_Routes = handle_get_route2(inet6, ?MAIN_TABLE, maps:get(Namespace, NetnsMap)), ordsets:union(V4_Routes, V6_Routes). handle_get_route2(Family, Table, #params{pid = Pid, iface = Iface}) -> Req = [{table, Table}, {oif, Iface}], {ok, Raw} = gen_netlink_client:rtnl_request(Pid, getroute, [match, root], {Family, 0, 0, 0, 0, 0, 0, 0, [], Req}), Routes = [route_msg_dst(Msg) || #rtnetlink{msg = Msg} <- Raw, dcos_l4lb_app:prefix_len(Family) == element(2, Msg), Iface == route_msg_oif(Msg), Table == route_msg_table(Msg)], ?LOG_INFO("Get routes ~p ~p", [Iface, Routes]), ordsets:from_list(Routes). %% see netlink.hrl for the element position route_msg_oif(Msg) -> proplists:get_value(oif, element(10, Msg)). route_msg_dst(Msg) -> proplists:get_value(dst, element(10, Msg)). route_msg_table(Msg) -> proplists:get_value(table, element(10, Msg)). update_routes(Routes, Action, Namespace, #state{netns = NetnsMap}) -> ?LOG_INFO("~p ~p ~p", [Action, Namespace, Routes]), Params = maps:get(Namespace, NetnsMap), lists:foreach(fun(Route) -> perform_action(Route, Action, Namespace, Params) end, Routes). perform_action(Dst, Action, Namespace, Params = #params{pid = Pid}) -> Flags = rt_flags(Action), Routes = make_routes(Dst, Namespace, Params), %% v6 has two routes lists:foreach(fun(Route) -> perform_action2(Pid, Action, Flags, Route) end, Routes). perform_action2(Pid, Action, Flags, Route) -> Result = gen_netlink_client:rtnl_request(Pid, Action, Flags, Route), case {Action, Result} of {_, {ok, _}} -> ok; {delroute, {_, 16#FD, []}} -> ok; %% route doesn't exists {_, {_, Error, []}} -> ?LOG_ERROR("Encountered error while ~p ~p ~p", [Action, Route, Error]) end. make_routes(Dst, Namespace, #params{iface = Iface, lo_iface = LoIface}) -> Family = dcos_l4lb_app:family(Dst), Attr = {Dst, Family, Namespace}, case Family of inet -> [make_route(Attr, Iface, ?LOCAL_TABLE)]; inet6 -> [make_route(Attr, LoIface, ?LOCAL_TABLE), %% order is important make_route(Attr, Iface, ?MAIN_TABLE)] end. make_route({Dst, Family, Namespace}, Iface, Table) -> PrefixLen = dcos_l4lb_app:prefix_len(Family), Msg = [{table, Table}, {dst, Dst}, {oif, Iface}], { Family, _PrefixLen = PrefixLen, _SrcPrefixLen = 0, _Tos = 0, _Table = Table, _Protocol = boot, _Scope = rt_scope(Namespace), _Type = rt_type(Namespace, Table), _Flags = [], Msg }. handle_add_netns(Netnslist, State = #state{netns = NetnsMap0}) -> NetnsMap1 = lists:foldl(fun maybe_add_netns/2, maps:new(), Netnslist), NetnsMap2 = maps:merge(NetnsMap1, NetnsMap0), {maps:keys(NetnsMap1), State#state{netns = NetnsMap2}}. handle_remove_netns(Netnslist, State = #state{netns = NetnsMap0}) -> NetnsMap1 = lists:foldl(fun maybe_remove_netns/2, NetnsMap0, Netnslist), RemovedNs = lists:subtract(maps:keys(NetnsMap0), maps:keys(NetnsMap1)), {RemovedNs, State#state{netns = NetnsMap1}}. maybe_add_netns(Netns = #netns{id = Id}, NetnsMap) -> maybe_add_netns(maps:is_key(Id, NetnsMap), Netns, NetnsMap). maybe_add_netns(true, _, NetnsMap) -> NetnsMap; maybe_add_netns(false, #netns{id = Id, ns = Namespace}, NetnsMap) -> NsStr = binary_to_list(Namespace), case gen_netlink_client:start_link(netns, ?NETLINK_ROUTE, NsStr) of {ok, Pid} -> {ok, Iface} = gen_netlink_client:if_nametoindex(?MINUTEMAN_IFACE, NsStr), Params = #params{pid = Pid, iface = Iface}, maps:put(Id, Params, NetnsMap); {error, Reason} -> ?LOG_ERROR("Couldn't create route netlink client for ~p due to ~p", [Id, Reason]), NetnsMap end. maybe_remove_netns(Netns = #netns{id = Id}, NetnsMap) -> maybe_remove_netns(maps:is_key(Id, NetnsMap), Netns, NetnsMap). maybe_remove_netns(true, #netns{id = Id}, NetnsMap) -> #params{pid = Pid} = maps:get(Id, NetnsMap), erlang:unlink(Pid), gen_netlink_client:stop(Pid), maps:remove(Id, NetnsMap); maybe_remove_netns(false, _, NetnsMap) -> NetnsMap. rt_scope(host) -> host; rt_scope(_) -> link. rt_type(host, ?LOCAL_TABLE) -> local; rt_type(_, _) -> unicast. rt_flags(newroute) -> [create, replace]; rt_flags(delroute) -> []. %%%=================================================================== %%% Metrics functions %%%=================================================================== -spec(call(pid(), term()) -> term()). call(Pid, Request) -> prometheus_summary:observe_duration( l4lb, routes_duration_seconds, [], fun () -> gen_server:call(Pid, Request) end). -spec(init_metrics() -> ok). init_metrics() -> prometheus_summary:new([ {registry, l4lb}, {name, routes_duration_seconds}, {help, "The time spent processing routes configuration."}]). <|start_filename|>apps/dcos_overlay/src/dcos_overlay_poller.erl<|end_filename|> %%%------------------------------------------------------------------- %%% @author sdhillon %%% @doc %%% %%% @end %%% Created : 27. May 2016 9:27 PM %%%------------------------------------------------------------------- -module(dcos_overlay_poller). -author("sdhillon"). -behaviour(gen_server). %% API -export([start_link/0, ip/0, overlays/0, init_metrics/0]). %% gen_server callbacks -export([init/1, handle_call/3, handle_cast/2, handle_info/2, handle_continue/2, terminate/2, code_change/3]). -ifdef(TEST). -include_lib("eunit/include/eunit.hrl"). -endif. -define(SERVER, ?MODULE). -define(MIN_POLL_PERIOD, 30000). %% 30 secs -define(MAX_POLL_PERIOD, 120000). %% 120 secs -define(VXLAN_UDP_PORT, 64000). -include_lib("kernel/include/logger.hrl"). -include_lib("stdlib/include/ms_transform.hrl"). -include_lib("gen_netlink/include/netlink.hrl"). -define(TABLE, 42). -record(state, { known_overlays = ordsets:new(), ip = undefined :: undefined | inet:ip4_address(), backoff :: non_neg_integer(), timer_ref = make_ref() :: reference(), netlink :: undefined | pid() }). %%%=================================================================== %%% API %%%=================================================================== ip() -> gen_server:call(?SERVER, ip). overlays() -> gen_server:call(?SERVER, overlays). %% @doc Starts the server -spec(start_link() -> {ok, Pid :: pid()} | ignore | {error, Reason :: term()}). start_link() -> gen_server:start_link({local, ?SERVER}, ?MODULE, [], []). %%%=================================================================== %%% gen_server callbacks %%%=================================================================== init([]) -> {ok, [], {continue, init}}. handle_call(ip, _From, State = #state{ip = IP}) -> {reply, IP, State}; handle_call(overlays, _From, State = #state{known_overlays = KnownOverlays}) -> {reply, KnownOverlays, State}; handle_call(Request, _From, State) -> ?LOG_WARNING("Unexpected request: ~p", [Request]), {reply, ok, State}. handle_cast(Request, State) -> ?LOG_WARNING("Unexpected request: ~p", [Request]), {noreply, State}. handle_info({timeout, TimerRef, poll}, #state{timer_ref = TimerRef} = State) -> {noreply, State, {continue, poll}}; handle_info(Info, State) -> ?LOG_WARNING("Unexpected info: ~p", [Info]), {noreply, State}. handle_continue(init, []) -> State = handle_init(), {noreply, State, {continue, poll}}; handle_continue(poll, State0) -> State = handle_poll(State0), {noreply, State, hibernate}. terminate(_Reason, _State) -> ok. code_change(_OldVsn, State, _Extra) -> {ok, State}. %%%=================================================================== %%% Internal functions %%%=================================================================== handle_init() -> {ok, Pid} = gen_netlink_client:start_link(?NETLINK_ROUTE), #state{backoff = ?MIN_POLL_PERIOD, netlink = Pid}. handle_poll(#state{netlink = Pid, known_overlays = Overlays, backoff = Backoff0} = State) -> case poll() of {error, _Error} -> TimerRef = backoff_fire(Backoff0), Backoff = backoff_reset(), State#state{backoff = Backoff, timer_ref = TimerRef}; {ok, AgentInfo} -> case parse_response(Pid, Overlays, AgentInfo) of {ok, NewOverlays, AgentIP} -> TimerRef = backoff_fire(Backoff0), Backoff = backoff_bump(Backoff0), State#state{ip = AgentIP, backoff = Backoff, known_overlays = NewOverlays, timer_ref = TimerRef}; {error, Error} -> ?LOG_ERROR( "Failed to parse overlay response due to ~p", [Error]), exit(Error) end end. backoff_reset() -> ?MIN_POLL_PERIOD. backoff_bump(Backoff) -> min(?MAX_POLL_PERIOD, 2 * Backoff). backoff_fire(Backoff) -> erlang:start_timer(Backoff, self(), poll). poll() -> Begin = erlang:monotonic_time(), try dcos_net_mesos:poll("/overlay-agent/overlay") of {error, Error} -> prometheus_counter:inc(overlay, poll_errors_total, [], 1), ?LOG_WARNING("Overlay Poller could not poll: ~p", [Error]), {error, Error}; {ok, Data} -> {ok, Data} after prometheus_summary:observe(overlay, poll_duration_seconds, [], erlang:monotonic_time() - Begin) end. parse_response(Pid, KnownOverlays, AgentInfo) -> AgentIP0 = maps:get(<<"ip">>, AgentInfo), AgentIP = process_ip(AgentIP0), Overlays = maps:get(<<"overlays">>, AgentInfo, []), NewOverlays = Overlays -- KnownOverlays, Results = [add_overlay(Pid, Overlay, AgentIP) || Overlay <- NewOverlays], {Successes, Failures} = lists:partition(fun (ok) -> true; (_) -> false end, Results), prometheus_gauge:set(overlay, networks_configured, [], length(Successes) + length(KnownOverlays)), case Failures of [] -> {ok, NewOverlays ++ KnownOverlays, AgentIP}; [Error | _Rest] -> prometheus_counter:inc( overlay, network_configuration_failures_total, [], length(Failures)), Error end. process_ip(IPBin0) -> [IPBin1|_MaybePort] = binary:split(IPBin0, <<":">>), IPStr = binary_to_list(IPBin1), {ok, IP} = inet:parse_ipv4_address(IPStr), IP. add_overlay(Pid, Overlay = #{<<"backend">> := #{<<"vxlan">> := VxLan}, <<"state">> := #{<<"status">> := <<"STATUS_OK">>}}, AgentIP) -> ?LOG_NOTICE("Configuring new overlay network, ~p", [VxLan]), case config_overlay(Pid, Overlay) of ok -> case maybe_add_overlay_to_lashup(Overlay, AgentIP) of ok -> ok; {error, Error} -> ?LOG_ERROR( "Failed to add overlay ~p to Lashup due to ~p", [Overlay, Error]), {error, Error} end; {error, Error} -> ?LOG_ERROR( "Failed to configure overlay ~p due to ~p", [Overlay, Error]), {error, Error} end; add_overlay(_Pid, Overlay, _AgentIP) -> ?LOG_WARNING("Bad overlay network was skipped, ~p", [Overlay]), ok. config_overlay(Pid, Overlay) -> case maybe_create_vtep(Pid, Overlay) of ok -> case maybe_add_ip_rule(Pid, Overlay) of ok -> ok; {error, Error} -> ?LOG_ERROR( "Failed to add IP rule for overlay ~p due to ~p", [Overlay, Error]), {error, Error} end; {error, Error} -> ?LOG_ERROR( "Failed to create VTEP link for overlay ~p due to ~p", [Overlay, Error]), {error, Error} end. mget(Key, Map) -> maps:get(Key, Map, undefined). maybe_create_vtep(Pid, #{<<"backend">> := Backend}) -> #{<<"vxlan">> := VXLan} = Backend, case maybe_create_vtep_link(Pid, VXLan) of ok -> case create_vtep_addr(Pid, VXLan) of ok -> ok; {error, Error} -> ?LOG_ERROR( "Failed to create VTEP address for ~p due to ~p", [VXLan, Error]), {error, Error} end; {error, Error} -> ?LOG_ERROR( "Failed to create VTEP link for ~p due to ~p", [VXLan, Error]), {error, Error} end. maybe_create_vtep_link(Pid, VXLan) -> #{<<"vtep_name">> := VTEPName} = VXLan, VTEPNameStr = binary_to_list(VTEPName), case check_vtep_link(Pid, VXLan) of {ok, false} -> ?LOG_INFO( "Overlay VTEP link will be created, ~s", [VTEPNameStr]), create_vtep_link(Pid, VXLan); {ok, {true, true}} -> ?LOG_INFO( "Overlay VTEP link is up-to-date, ~s", [VTEPNameStr]), ok; {ok, {true, false}} -> ?LOG_INFO( "Overlay VTEP link is not up-to-date, and will be " "recreated, ~s", [VTEPNameStr]), recreate_vtep_link(Pid, VXLan, VTEPNameStr); {error, Error} -> ?LOG_ERROR( "Failed to check VTEP link ~s due to ~p", [VTEPNameStr, Error]), {error, Error} end. check_vtep_link(Pid, VXLan) -> #{<<"vtep_name">> := VTEPName} = VXLan, VTEPNameStr = binary_to_list(VTEPName), case dcos_overlay_netlink:iplink_show(Pid, VTEPNameStr) of {ok, [#rtnetlink{type=newlink, msg=Msg}]} -> {unspec, arphrd_ether, _, _, _, LinkInfo} = Msg, Match = match_vtep_link(VXLan, LinkInfo), {ok, {true, Match}}; {error, {enodev, _ErrorMsg}} -> ?LOG_INFO("Overlay VTEP link does not exist, ~s", [VTEPName]), {ok, false}; {error, Error} -> {error, Error} end. match_vtep_link(VXLan, Link) -> #{<<"vni">> := VNI, <<"vtep_mac">> := VTEPMAC} = VXLan, Expected = [{address, binary:list_to_bin(parse_vtep_mac(VTEPMAC))}, {linkinfo, [{kind, "vxlan"}, {data, [{id, VNI}, {port, ?VXLAN_UDP_PORT}]}]}], VTEPMTU = mget(<<"vtep_mtu">>, VXLan), Expected2 = Expected ++ [{mtu, VTEPMTU} || is_integer(VTEPMTU)], match(Expected2, Link). match(Expected, List) when is_list(Expected) -> lists:all(fun (KV) -> match(KV, List) end, Expected); match({K, V}, List) -> case lists:keyfind(K, 1, List) of false -> false; {K, V} -> true; {K, V0} -> match(V, V0) end; match(_Attr, _List) -> false. create_vtep_link(Pid, VXLan) -> #{<<"vni">> := VNI, <<"vtep_mac">> := VTEPMAC, <<"vtep_name">> := VTEPName} = VXLan, VTEPMTU = mget(<<"vtep_mtu">>, VXLan), VTEPNameStr = binary_to_list(VTEPName), ParsedVTEPMAC = list_to_tuple(parse_vtep_mac(VTEPMAC)), VTEPAttr = [{mtu, VTEPMTU} || is_integer(VTEPMTU)], case dcos_overlay_netlink:iplink_add( Pid, VTEPNameStr, "vxlan", VNI, ?VXLAN_UDP_PORT, VTEPAttr) of {ok, _} -> case dcos_overlay_netlink:iplink_set( Pid, ParsedVTEPMAC, VTEPNameStr) of {ok, _} -> Info = #{vni => VNI, mac => VTEPMAC, attr => VTEPAttr}, ?LOG_NOTICE( "Overlay VTEP link was configured, ~s => ~p", [VTEPName, Info]), ok; {error, Error} -> ?LOG_ERROR( "Failed to set VTEP link for MAC: ~p; VTEP: ~s " "due to ~p", [ParsedVTEPMAC, VTEPNameStr, Error]), {error, Error} end; {error, Error} -> ?LOG_ERROR( "Failed to add VTEP link for VTEP: ~s; VNI: ~p due to ~p", [VTEPNameStr, VNI, Error]), {error, Error} end. recreate_vtep_link(Pid, VXLan, VTEPNameStr) -> case dcos_overlay_netlink:iplink_delete(Pid, VTEPNameStr) of {ok, _} -> ?LOG_NOTICE("Overlay VTEP link was removed, ~s", [VTEPNameStr]), create_vtep_link(Pid, VXLan); {error, {enodev, _ErrorMsg}} -> ?LOG_NOTICE("Overlay VTEP link did not exist, ~s", [VTEPNameStr]), create_vtep_link(Pid, VXLan); {error, Error} -> ?LOG_ERROR( "Failed to detete VTEP link ~s due to ~p", [VTEPNameStr, Error]), {error, Error} end. create_vtep_addr(Pid, VXLan) -> #{<<"vtep_ip">> := VTEPIP, <<"vtep_name">> := VTEPName} = VXLan, VTEPIP6 = mget(<<"vtep_ip6">>, VXLan), VTEPNameStr = binary_to_list(VTEPName), {ParsedVTEPIP, PrefixLen} = parse_subnet(VTEPIP), case dcos_overlay_netlink:ipaddr_replace( Pid, inet, ParsedVTEPIP, PrefixLen, VTEPNameStr) of {ok, _} -> ?LOG_NOTICE("Overlay VTEP address was configured, ~s => ~p", [VTEPName, VTEPIP]), maybe_create_vtep_addr6(Pid, VTEPName, VTEPNameStr, VTEPIP6); {error, Error} -> ?LOG_ERROR( "Failed to replace address ~p for VTEP ~s due to ~p", [VTEPIP, VTEPNameStr, Error]), {error, Error} end. maybe_create_vtep_addr6(Pid, VTEPName, VTEPNameStr, VTEPIP6) -> case {application:get_env(dcos_overlay, enable_ipv6, true), VTEPIP6} of {_, undefined} -> ok; {false, _} -> ?LOG_NOTICE("Overlay network is disabled [ipv6], ~s => ~p", [VTEPName, VTEPIP6]), ok; _ -> ensure_vtep_addr6_created(Pid, VTEPName, VTEPNameStr, VTEPIP6) end. ensure_vtep_addr6_created(Pid, VTEPName, VTEPNameStr, VTEPIP6) -> case try_enable_ipv6(VTEPName) of ok -> {ParsedVTEPIP6, PrefixLen6} = parse_subnet(VTEPIP6), case dcos_overlay_netlink:ipaddr_replace( Pid, inet6, ParsedVTEPIP6, PrefixLen6, VTEPNameStr) of {ok, _} -> ?LOG_NOTICE( "Overlay VTEP address was configured [ipv6], ~s => ~p", [VTEPNameStr, VTEPIP6]), ok; {error, Error} -> ?LOG_ERROR( "Failed to replace address ~p for VTEP ~s due to ~p", [VTEPIP6, VTEPNameStr, Error]), {error, Error} end; {error, Error} -> {error, Error} end. try_enable_ipv6(IfName) -> Opt = <<"net.ipv6.conf.", IfName/binary, ".disable_ipv6=0">>, case dcos_net_utils:system([<<"/sbin/sysctl">>, <<"-w">>, Opt]) of {ok, _} -> ok; {error, Error} -> ?LOG_ERROR( "Couldn't enable IPv6 on ~s interface due to ~p", [IfName, Error]), {error, Error} end. maybe_add_ip_rule( Pid, #{<<"info">> := #{<<"subnet">> := Subnet}, <<"backend">> := #{<<"vxlan">> := #{<<"vtep_name">> := VTEPName}}}) -> case dcos_overlay_netlink:iprule_show(Pid, inet) of {ok, Rules} -> ensure_ip_rule_exists(Pid, Rules, Subnet, VTEPName); {error, Error} -> ?LOG_ERROR("Failed to get IP rules due to ~p", [Error]), {error, Error} end; maybe_add_ip_rule(_Pid, _Overlay) -> ok. ensure_ip_rule_exists(Pid, Rules, Subnet, VTEPName) -> {ParsedSubnetIP, PrefixLen} = parse_subnet(Subnet), Rule = dcos_overlay_netlink:make_iprule( inet, ParsedSubnetIP, PrefixLen, ?TABLE), case dcos_overlay_netlink:is_iprule_present(Rules, Rule) of false -> case dcos_overlay_netlink:iprule_add( Pid, inet, ParsedSubnetIP, PrefixLen, ?TABLE) of {ok, _} -> ?LOG_NOTICE( "Overlay routing policy was added, ~s => ~p", [VTEPName, #{overlaySubnet => Subnet}]), ok; {error, Error} -> ?LOG_ERROR( "Failed to add IP rule for subnet ~p and VTEP ~p " "due to ~p", [Subnet, VTEPName, Error]), {error, Error} end; true -> ok end. maybe_add_overlay_to_lashup(Overlay, AgentIP) -> #{<<"info">> := OverlayInfo} = Overlay, #{<<"backend">> := #{<<"vxlan">> := VXLan}} = Overlay, AgentSubnet = mget(<<"subnet">>, Overlay), AgentSubnet6 = mget(<<"subnet6">>, Overlay), OverlaySubnet = mget(<<"subnet">>, OverlayInfo), OverlaySubnet6 = mget(<<"subnet6">>, OverlayInfo), VTEPIPStr = mget(<<"vtep_ip">>, VXLan), VTEPIP6Str = mget(<<"vtep_ip6">>, VXLan), VTEPMac = mget(<<"vtep_mac">>, VXLan), VTEPName = mget(<<"vtep_name">>, VXLan), case maybe_add_overlay_to_lashup(VTEPName, VTEPIPStr, VTEPMac, AgentSubnet, OverlaySubnet, AgentIP) of ok -> case maybe_add_overlay_to_lashup(VTEPName, VTEPIP6Str, VTEPMac, AgentSubnet6, OverlaySubnet6, AgentIP) of ok -> ok; {error, Error} -> ?LOG_ERROR( "Failed to add IPv6 overlay ~p to Lashup due to ~p", [Overlay, Error]), {error, Error} end; {error, Error} -> ?LOG_ERROR( "Failed to add IP overlay ~p to Lashup due to ~p", [Overlay, Error]), {error, Error} end. maybe_add_overlay_to_lashup( _VTEPName, _VTEPIPStr, _VTEPMac, _AgentSubnet, undefined, _AgentIP) -> ok; maybe_add_overlay_to_lashup( _VTEPName, undefined, _VTEPMac, _AgentSubnet, _OverlaySubnet, _AgentIP) -> ok; maybe_add_overlay_to_lashup( VTEPName, VTEPIPStr, VTEPMac, AgentSubnet, OverlaySubnet, AgentIP) -> ParsedSubnet = parse_subnet(OverlaySubnet), Key = [navstar, overlay, ParsedSubnet], LashupValue = lashup_kv:value(Key), case check_subnet(VTEPIPStr, VTEPMac, AgentSubnet, AgentIP, LashupValue) of ok -> ok; Updates -> case lashup_kv:request_op(Key, {update, [Updates]}) of {ok, _} -> Info = #{ip => VTEPIPStr, mac => VTEPMac, agentSubnet => AgentSubnet, overlaySubnet => OverlaySubnet}, ?LOG_NOTICE("Overlay network was added, ~s => ~p", [VTEPName, Info]), ok; {error, Error} -> ?LOG_ERROR( "Failed to update data in Lashup for ~s due to ~p", [VTEPName, Error]), {error, Error} end end. -type prefix_len() :: 0..32 | 0..128. -spec(parse_subnet(Subnet :: binary()) -> {inet:ip_address(), prefix_len()}). parse_subnet(Subnet) -> [IPBin, PrefixLenBin] = binary:split(Subnet, <<"/">>), {ok, IP} = inet:parse_address(binary_to_list(IPBin)), PrefixLen = erlang:binary_to_integer(PrefixLenBin), true = is_integer(PrefixLen), true = 0 =< PrefixLen andalso PrefixLen =< 128, {IP, PrefixLen}. check_subnet(VTEPIPStr, VTEPMac, AgentSubnet, AgentIP, LashupValue) -> ParsedSubnet = parse_subnet(AgentSubnet), ParsedVTEPMac = parse_vtep_mac(VTEPMac), ParsedVTEPIP = parse_subnet(VTEPIPStr), Changed = overlay_changed( ParsedVTEPIP, ParsedVTEPMac, AgentIP, ParsedSubnet, LashupValue), case Changed of true -> update_overlay_op( ParsedVTEPIP, ParsedVTEPMac, AgentIP, ParsedSubnet); false -> ok end. parse_vtep_mac(MAC) -> MACComponents = binary:split(MAC, <<":">>, [global]), lists:map( fun (Component) -> binary_to_integer(Component, 16) end, MACComponents). overlay_changed(VTEPIP, VTEPMac, AgentIP, Subnet, LashupValue) -> case lists:keyfind({VTEPIP, riak_dt_map}, 1, LashupValue) of {{VTEPIP, riak_dt_map}, Value} -> ExpectedValue = [ {{agent_ip, riak_dt_lwwreg}, AgentIP}, {{mac, riak_dt_lwwreg}, VTEPMac}, {{subnet, riak_dt_lwwreg}, Subnet} ], case lists:sort(Value) of ExpectedValue -> false; _ -> true end; false -> true end. update_overlay_op(VTEPIP, VTEPMac, AgentIP, Subnet) -> Now = erlang:system_time(nano_seconds), {update, {VTEPIP, riak_dt_map}, {update, [ {update, {mac, riak_dt_lwwreg}, {assign, VTEPMac, Now}}, {update, {agent_ip, riak_dt_lwwreg}, {assign, AgentIP, Now}}, {update, {subnet, riak_dt_lwwreg}, {assign, Subnet, Now}} ] } }. %%%=================================================================== %%% Metrics functions %%%=================================================================== -spec(init_metrics() -> ok). init_metrics() -> prometheus_summary:new([ {registry, overlay}, {name, poll_duration_seconds}, {duration_unit, seconds}, {help, "The time spent polling local Mesos overlays."}]), prometheus_counter:new([ {registry, overlay}, {name, poll_errors_total}, {help, "Total number of errors while polling local Mesos overlays."}]), prometheus_gauge:new([ {registry, overlay}, {name, networks_configured}, {help, "The number of overlay networks configured."}]), prometheus_counter:new([ {registry, overlay}, {name, network_configuration_failures_total}, {help, "Total number of failures while configuring overlay networks."}]). -ifdef(TEST). match_vtep_link_test() -> VNI = 1024, VTEPIP = <<"192.168.127.12/20">>, VTEPMAC = <<"70:b3:d5:80:00:01">>, VTEPMAC2 = <<"70:b3:d5:80:00:02">>, VTEPNAME = <<"vtep1024">>, VTEPDataFilename = "apps/dcos_overlay/testdata/vtep_link.data", {ok, [RtnetLinkInfo]} = file:consult(VTEPDataFilename), [#rtnetlink{type=newlink, msg=Msg}] = RtnetLinkInfo, {unspec, arphrd_ether, _, _, _, LinkInfo} = Msg, VXLan = #{ <<"vni">> => VNI, <<"vtep_ip">> => VTEPIP, <<"vtep_mac">> => VTEPMAC, <<"vtep_name">> => VTEPNAME }, ?assertEqual(true, match_vtep_link(VXLan, LinkInfo)), VXLan2 = VXLan#{<<"vtep_mac">> := VTEPMAC2}, ?assertEqual(false, match_vtep_link(VXLan2, LinkInfo)). overlay_changed_test() -> VTEPIP = {{44, 128, 0, 1}, 20}, VTEPMac = [112, 179, 213, 128, 0, 1], AgentIP = {172, 17, 0, 2}, Subnet = {{9, 0, 0, 0}, 24}, LashupValue = [], ?assert(overlay_changed(VTEPIP, VTEPMac, AgentIP, Subnet, LashupValue)), LashupValue2 = [ {{{{44, 128, 0, 1}, 20}, riak_dt_map}, [{{subnet, riak_dt_lwwreg}, {{9, 0, 0, 0}, 24}}, {{mac, riak_dt_lwwreg}, [112, 179, 213, 128, 0, 1]}, {{agent_ip, riak_dt_lwwreg}, {172, 17, 0, 2}}]} ], ?assertNot(overlay_changed(VTEPIP, VTEPMac, AgentIP, Subnet, LashupValue2)), LashupValue3 = [ {{{{44, 128, 0, 1}, 20}, riak_dt_map}, [{{subnet, riak_dt_lwwreg}, {{9, 0, 1, 0}, 24}}, {{mac, riak_dt_lwwreg}, [112, 179, 213, 128, 0, 1]}, {{agent_ip, riak_dt_lwwreg}, {172, 17, 0, 2}}]} ], ?assert(overlay_changed(VTEPIP, VTEPMac, AgentIP, Subnet, LashupValue3)), LashupValue4 = [ {{{{44, 128, 0, 1}, 20}, riak_dt_map}, [{{subnet, riak_dt_lwwreg}, {{9, 0, 0, 0}, 24}}, {{mac, riak_dt_lwwreg}, [112, 179, 213, 128, 0, 2]}, {{agent_ip, riak_dt_lwwreg}, {172, 17, 0, 2}}]} ], ?assert(overlay_changed(VTEPIP, VTEPMac, AgentIP, Subnet, LashupValue4)), LashupValue5 = [ {{{{44, 128, 0, 1}, 20}, riak_dt_map}, [{{subnet, riak_dt_lwwreg}, {{9, 0, 0, 0}, 24}}, {{mac, riak_dt_lwwreg}, [112, 179, 213, 128, 0, 1]}, {{agent_ip, riak_dt_lwwreg}, {172, 17, 0, 3}}]} ], ?assert(overlay_changed(VTEPIP, VTEPMac, AgentIP, Subnet, LashupValue5)), LashupValue6 = [ {{{{44, 128, 0, 2}, 20}, riak_dt_map}, [{{subnet, riak_dt_lwwreg}, {{9, 0, 0, 0}, 24}}, {{mac, riak_dt_lwwreg}, [112, 179, 213, 128, 0, 1]}, {{agent_ip, riak_dt_lwwreg}, {172, 17, 0, 2}}]} ], ?assert(overlay_changed(VTEPIP, VTEPMac, AgentIP, Subnet, LashupValue6)). -endif. <|start_filename|>apps/dcos_rest/src/dcos_rest_lashup_handler.erl<|end_filename|> %%%------------------------------------------------------------------- %%% @author sdhillon %%% @copyright (C) 2016, <COMPANY> %%% @doc %%% %%% @end %%% Created : 24. May 2016 9:34 PM %%%------------------------------------------------------------------- -module(dcos_rest_lashup_handler). -author("sdhillon"). %% API -export([ init/2, content_types_provided/2, allowed_methods/2, content_types_accepted/2, to_json/2, perform_op/2 ]). init(Req, Opts) -> {cowboy_rest, Req, Opts}. content_types_provided(Req, State) -> {[ {{<<"application">>, <<"json">>, []}, to_json} ], Req, State}. allowed_methods(Req, State) -> {[<<"GET">>, <<"POST">>], Req, State}. content_types_accepted(Req, State) -> {[ {{<<"text">>, <<"plain">>, []}, perform_op} ], Req, State}. perform_op(Req, State) -> Key = key(Req), case cowboy_req:header(<<"clock">>, Req, <<>>) of <<>> -> {{false, <<"Missing clock">>}, Req, State}; Clock -> Clock0 = binary_to_term(base64:decode(Clock)), {ok, Body, Req0} = cowboy_req:read_body(Req), Body0 = binary_to_list(Body), {ok, Scanned, _} = erl_scan:string(Body0), {ok, Parsed} = erl_parse:parse_exprs(Scanned), {value, Update, _Bindings} = erl_eval:exprs(Parsed, erl_eval:new_bindings()), perform_op(Key, Update, Clock0, Req0, State) end. perform_op(Key, Update, Clock, Req, State) -> case lashup_kv:request_op(Key, Clock, Update) of {ok, Value} -> Value0 = lists:map(fun encode_key/1, Value), {jsx:encode(Value0), Req, State}; {error, concurrency} -> {{false, <<"Concurrent update">>}, Req, State} end. to_json(Req, State) -> Key = key(Req), fetch_key(Key, Req, State). fetch_key(Key, Req, State) -> {Value, Clock} = lashup_kv:value2(Key), Value0 = lists:map(fun encode_key/1, Value), ClockBin = base64:encode(term_to_binary(Clock)), Req0 = cowboy_req:set_resp_header(<<"clock">>, ClockBin, Req), {jsx:encode(Value0), Req0, State}. key(Req) -> KeyHandler = cowboy_req:header(<<"key-handler">>, Req), KeyData = cowboy_req:path_info(Req), key(KeyData, KeyHandler). key([], _) -> erlang:throw(invalid_key); key(KeyData, _) -> lists:map(fun(X) -> binary_to_atom(X, utf8) end, KeyData). encode_key({{Name, Type = riak_dt_lwwreg}, Value}) -> #{value := Key} = encode_key(Name), {Key, [{type, Type}, {value, encode_key(Value)}]}; encode_key({{Name, Type = riak_dt_orswot}, Value}) -> #{value := Key} = encode_key(Name), {Key, [{type, Type}, {value, lists:map(fun encode_key/1, Value)}]}; encode_key(Value) when is_atom(Value) -> #{type => atom, value => Value}; encode_key(Value) when is_binary(Value) -> #{type => binary, value => Value}; encode_key(Value) when is_list(Value) -> #{type => string, value => list_to_binary(lists:flatten(Value))}; %% Probably an IP address? encode_key(IP = {A, B, C, D}) when is_integer(A) andalso is_integer(B) andalso is_integer(C) andalso is_integer(D) andalso A >= 0 andalso B >= 0 andalso C >= 0 andalso D >= 0 andalso A =< 255 andalso B =< 255 andalso C =< 255 andalso D =< 255 -> #{ type => ipaddress_tuple, value => list_to_binary(lists:flatten(inet:ntoa(IP))) }; encode_key(Value) when is_tuple(Value) -> #{ type => tuple, value => list_to_binary(lists:flatten(io_lib:format("~p", [Value]))) }; encode_key(Value) when is_tuple(Value) -> #{ type => unknown, value => list_to_binary(lists:flatten(io_lib:format("~p", [Value]))) }. <|start_filename|>apps/dcos_rest/src/dcos_rest_sup.erl<|end_filename|> -module(dcos_rest_sup). -behaviour(supervisor). -export([start_link/1, init/1]). start_link(Enabled) -> supervisor:start_link({local, ?MODULE}, ?MODULE, [Enabled]). init([false]) -> {ok, {#{}, []}}; init([true]) -> setup_cowboy(), {ok, {#{}, []}}. setup_cowboy() -> Dispatch = cowboy_router:compile([ {'_', [ {"/lashup/kv/[...]", dcos_rest_lashup_handler, []}, {"/lashup/key", dcos_rest_key_handler, []}, {"/v1/vips", dcos_rest_vips_handler, []}, {"/v1/nodes", dcos_rest_nodes_handler, []}, {"/v1/version", dcos_rest_dns_handler, [version]}, {"/v1/config", dcos_rest_dns_handler, [config]}, {"/v1/hosts/:host", dcos_rest_dns_handler, [hosts]}, {"/v1/services/:service", dcos_rest_dns_handler, [services]}, {"/v1/enumerate", dcos_rest_dns_handler, [enumerate]}, {"/v1/records", dcos_rest_dns_handler, [records]}, {"/v1/metrics/[:registry]", dcos_rest_metrics_handler, []} ]} ]), {ok, Ip} = application:get_env(dcos_rest, ip), {ok, Port} = application:get_env(dcos_rest, port), {ok, _} = cowboy:start_clear( http, [{ip, Ip}, {port, Port}], #{ env => #{dispatch => Dispatch} }). <|start_filename|>apps/dcos_net/test/dcos_net_node_SUITE.erl<|end_filename|> -module(dcos_net_node_SUITE). -export([ all/0, init_per_suite/1, end_per_suite/1, init_per_testcase/2, end_per_testcase/2, get_metadata/1 ]). all() -> [get_metadata]. init_per_suite(Config) -> Config. end_per_suite(Config) -> Config. init_per_testcase(_, Config) -> {ok, _} = application:ensure_all_started(mnesia), {ok, _} = application:ensure_all_started(lashup), {ok, Pid} = dcos_net_node:start_link(), ok = wait_ready(Pid), Config. end_per_testcase(_, _Config) -> Pid = whereis(dcos_net_node), unlink(Pid), exit(Pid, kill), [ begin ok = application:stop(App), ok = application:unload(App) end || {App, _, _} <- application:which_applications(), not lists:member(App, [stdlib, kernel]) ], os:cmd("rm -rf Mnesia.*"), ok. wait_ready(Pid) -> timer:sleep(100), case erlang:process_info(Pid, current_stacktrace) of {current_stacktrace, [{gen_server, loop, _, _} | _ST]} -> ok; {current_stacktrace, []} -> ok; {current_stacktrace, _ST} -> wait_ready(Pid) end. get_metadata(_Config) -> Dump = dcos_net_node:get_metadata(), #{{0, 0, 0, 0} := #{updated := A}} = Dump, ForceDump = dcos_net_node:get_metadata([force_refresh]), #{{0, 0, 0, 0} := #{updated := B}} = ForceDump, A < B. <|start_filename|>apps/dcos_dns/src/dcos_dns_config.erl<|end_filename|> %%%------------------------------------------------------------------- %%% @author sdhillon %%% @copyright (C) 2016, <COMPANY> %%% @doc %%% %%% @end %%% Created : 01. Apr 2016 5:02 PM %%%------------------------------------------------------------------- -module(dcos_dns_config). -author("<NAME> <<EMAIL>>"). -include_lib("kernel/include/logger.hrl"). -include("dcos_dns.hrl"). %% API -export([ exhibitor_timeout/0, udp_enabled/0, udp_port/0, tcp_enabled/0, tcp_port/0, bind_interface/0, bind_ips/0, forward_zones/0, handler_limit/0, mesos_resolvers/0, mesos_resolvers/1, loadbalance/0 ]). exhibitor_timeout() -> application:get_env(?APP, exhibitor_timeout, ?EXHIBITOR_TIMEOUT). udp_enabled() -> application:get_env(?APP, udp_server_enabled, true). tcp_enabled() -> application:get_env(?APP, tcp_server_enabled, true). tcp_port() -> application:get_env(?APP, tcp_port, 5454). udp_port() -> application:get_env(?APP, udp_port, 5454). handler_limit() -> application:get_env(?APP, handler_limit, 1024). -spec(forward_zones() -> #{[dns:label()] => [{string(), integer()}]}). forward_zones() -> application:get_env(?APP, forward_zones, maps:new()). bind_interface() -> application:get_env(?APP, bind_interface, undefined). -spec(bind_ips() -> [inet:ip_address()]). bind_ips() -> IPs0 = case application:get_env(?APP, bind_ips, []) of [] -> DefaultIps = get_ips(), application:set_env(?APP, bind_ips, DefaultIps), DefaultIps; V -> V end, ?LOG_DEBUG("found ips: ~p", [IPs0]), BlacklistedIPs = application:get_env(?APP, bind_ip_blacklist, []), ?LOG_DEBUG("blacklist ips: ~p", [BlacklistedIPs]), IPs1 = [ IP || IP <- IPs0, not lists:member(IP, BlacklistedIPs) ], IPs2 = lists:usort(IPs1), ?LOG_DEBUG("final ips: ~p", [IPs2]), IPs2. -spec(get_ips() -> [inet:ip_address()]). get_ips() -> IFs0 = get_ip_interfaces(), IPs = case bind_interface() of undefined -> [Addr || {_IfName, Addr} <- IFs0]; ConfigInterfaceName -> IFs1 = lists:filter(fun({IfName, _Addr}) -> string:equal(IfName, ConfigInterfaceName) end, IFs0), [Addr || {_IfName, Addr} <- IFs1] end, lists:usort(IPs). %% @doc Gets all the IPs for the machine -spec(get_ip_interfaces() -> [{InterfaceName :: string(), inet:ip_address()}]). get_ip_interfaces() -> {ok, Iflist} = inet:getifaddrs(), lists:foldl(fun fold_over_if/2, [], Iflist). fold_over_if({IfName, IfOpts}, Acc) -> IfAddresses = [{IfName, Address} || {addr, Address} <- IfOpts, not is_link_local(Address)], ordsets:union(ordsets:from_list(IfAddresses), Acc). -spec is_link_local(inet:ip_address()) -> boolean(). is_link_local({16#fe80, _, _, _, _, _, _, _}) -> true; is_link_local(_IpAddress) -> false. -spec(mesos_resolvers() -> [upstream()]). mesos_resolvers() -> application:get_env(?APP, mesos_resolvers, []). -spec(mesos_resolvers([upstream()]) -> ok). mesos_resolvers(Upstreams) -> application:set_env(?APP, mesos_resolvers, Upstreams). -spec(loadbalance() -> atom()). loadbalance() -> application:get_env(?APP, loadbalance, round_robin). <|start_filename|>apps/dcos_l4lb/src/dcos_l4lb_app.erl<|end_filename|> -module(dcos_l4lb_app). -behaviour(application). %% Application callbacks -export([start/2, stop/1, family/1, prefix_len/1]). %% =================================================================== %% Application callbacks %% =================================================================== start(_StartType, _StartArgs) -> dcos_net_app:load_config_files(dcos_l4lb), dcos_l4lb_sup:start_link([application:get_env(dcos_l4lb, enable_lb, true)]). stop(_State) -> ok. family(IP) when size(IP) == 4 -> inet; family(IP) when size(IP) == 8 -> inet6. prefix_len(inet) -> 32; prefix_len(inet6) -> 128.
Klarrio/dcos-net
<|start_filename|>include/tinyrpc/rpc_error_code.hpp<|end_filename|> // // Copyright (C) 2019 Jack. // // Author: jack // Email: jack.wgm at gmail dot com // #pragma once #include "boost/system/system_error.hpp" #include "boost/system/error_code.hpp" namespace tinyrpc { ////////////////////////////////////////////////////////////////////////// namespace detail { class error_category_impl; } template<class error_category> const boost::system::error_category& error_category_single() { static error_category error_category_instance; return reinterpret_cast<const boost::system::error_category&>(error_category_instance); } inline const boost::system::error_category& error_category() { return error_category_single<detail::error_category_impl>(); } namespace errc { enum errc_t { parse_rpc_service_ptl_failed = 1, unknow_protocol_descriptor = 2, parse_payload_failed = 3, session_out_of_range = 4, invalid_session = 5, }; inline boost::system::error_code make_error_code(errc_t e) { return boost::system::error_code(static_cast<int>(e), tinyrpc::error_category()); } } } namespace boost { namespace system { template <> struct is_error_code_enum<tinyrpc::errc::errc_t> { static const bool value = true; }; } // namespace system } // namespace boost namespace tinyrpc { namespace detail { class error_category_impl : public boost::system::error_category { virtual const char* name() const noexcept { return "TinyRPC"; } virtual std::string message(int e) const { switch (e) { case errc::parse_rpc_service_ptl_failed: return "Parse protobuf rpc_service_ptl failed"; case errc::unknow_protocol_descriptor: return "Unknow protocol descriptor"; case errc::parse_payload_failed: return "Parse protobuf payload failed"; case errc::session_out_of_range: return "Session out of range"; case errc::invalid_session: return "Invalid session"; default: return "Unknown TinyRPC error"; } } }; } }
omegacoleman/tinyrpc
<|start_filename|>test/api/DslSinkApiTest.cpp<|end_filename|> /* The MIT License Copyright (c) 2019-2021, Prominence AI, Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in- all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "catch.hpp" #include "Dsl.h" #include "DslApi.h" SCENARIO( "The Components container is updated correctly on new Fake Sink", "[sink-api]" ) { GIVEN( "An empty list of Components" ) { std::wstring sinkName = L"fake-sink"; REQUIRE( dsl_component_list_size() == 0 ); WHEN( "A new Fake Sink is created" ) { REQUIRE( dsl_sink_fake_new(sinkName.c_str()) == DSL_RESULT_SUCCESS ); THEN( "The list size is updated correctly" ) { REQUIRE( dsl_component_list_size() == 1 ); boolean sync(false), async(true); REQUIRE( dsl_sink_sync_settings_get(sinkName.c_str(), &sync, &async) == DSL_RESULT_SUCCESS ); REQUIRE( sync == true ); REQUIRE( async == false ); REQUIRE( dsl_component_delete_all() == DSL_RESULT_SUCCESS ); } } } } SCENARIO( "The Components container is updated correctly on Fink Sink delete", "[sink-api]" ) { GIVEN( "A Fake Sink Component" ) { std::wstring sinkName = L"fake-sink"; REQUIRE( dsl_component_list_size() == 0 ); REQUIRE( dsl_sink_fake_new(sinkName.c_str()) == DSL_RESULT_SUCCESS ); WHEN( "A new Fake Sink is deleted" ) { REQUIRE( dsl_component_delete(sinkName.c_str()) == DSL_RESULT_SUCCESS ); THEN( "The list size updated correctly" ) { REQUIRE( dsl_component_list_size() == 0 ); } } } } SCENARIO( "A Fake Sink can update it Sync/Async attributes", "[sink-api]" ) { GIVEN( "An empty list of Components" ) { std::wstring sinkName = L"fake-sink"; REQUIRE( dsl_sink_fake_new(sinkName.c_str()) == DSL_RESULT_SUCCESS ); WHEN( "A the Fake Sink's attributes are updated from the default" ) { boolean newSync(false), newAsync(true); REQUIRE( dsl_sink_sync_settings_set(sinkName.c_str(), newSync, newAsync) == DSL_RESULT_SUCCESS ); THEN( "The list size is updated correctly" ) { REQUIRE( dsl_component_list_size() == 1 ); boolean retSync(true), retAsync(false); REQUIRE( dsl_sink_sync_settings_get(sinkName.c_str(), &retSync, &retAsync) == DSL_RESULT_SUCCESS ); REQUIRE( retSync == newSync ); REQUIRE( retAsync == newAsync ); REQUIRE( dsl_component_delete_all() == DSL_RESULT_SUCCESS ); } } } } SCENARIO( "The Components container is updated correctly on new Overlay Sink", "[sink-api]" ) { GIVEN( "An empty list of Components" ) { // Get the Device properties cudaDeviceProp deviceProp; cudaGetDeviceProperties(&deviceProp, 0); if (deviceProp.integrated) { std::wstring overlaySinkName = L"overlay-sink"; uint displayId(0); uint depth(0); uint offsetX(0); uint offsetY(0); uint sinkW(1280); uint sinkH(720); REQUIRE( dsl_component_list_size() == 0 ); WHEN( "A new Overlay Sink is created" ) { REQUIRE( dsl_sink_overlay_new(overlaySinkName.c_str(), displayId, depth, offsetX, offsetY, sinkW, sinkH) == DSL_RESULT_SUCCESS ); THEN( "The list size is updated correctly" ) { REQUIRE( dsl_component_list_size() == 1 ); } } REQUIRE( dsl_component_delete_all() == DSL_RESULT_SUCCESS ); } } } SCENARIO( "The Components container is updated correctly on Overlay Sink delete", "[sink-api]" ) { GIVEN( "An Overlay Sink Component" ) { // Get the Device properties cudaDeviceProp deviceProp; cudaGetDeviceProperties(&deviceProp, 0); if (deviceProp.integrated) { std::wstring overlaySinkName = L"overlay-sink"; uint displayId(0); uint depth(0); uint offsetX(0); uint offsetY(0); uint sinkW(0); uint sinkH(0); REQUIRE( dsl_component_list_size() == 0 ); REQUIRE( dsl_sink_overlay_new(overlaySinkName.c_str(), displayId, depth, offsetX, offsetY, sinkW, sinkH) == DSL_RESULT_SUCCESS ); WHEN( "A new Overlay Sink is deleted" ) { REQUIRE( dsl_component_delete(overlaySinkName.c_str()) == DSL_RESULT_SUCCESS ); THEN( "The list size updated correctly" ) { REQUIRE( dsl_component_list_size() == 0 ); } } } } } SCENARIO( "A Overlay Sink can update its Sync/Async attributes", "[sink-api]" ) { GIVEN( "An empty list of Components" ) { // Get the Device properties cudaDeviceProp deviceProp; cudaGetDeviceProperties(&deviceProp, 0); if (deviceProp.integrated) { std::wstring overlaySinkName = L"overlay-sink"; uint displayId(0); uint depth(0); uint offsetX(0); uint offsetY(0); uint sinkW(0); uint sinkH(0); REQUIRE( dsl_component_list_size() == 0 ); REQUIRE( dsl_sink_overlay_new(overlaySinkName.c_str(), displayId, depth, offsetX, offsetY, sinkW, sinkH) == DSL_RESULT_SUCCESS ); WHEN( "A the Window Sink's attributes are updated from the default" ) { boolean newSync(false), newAsync(true); REQUIRE( dsl_sink_sync_settings_set(overlaySinkName.c_str(), newSync, newAsync) == DSL_RESULT_SUCCESS ); THEN( "The list size is updated correctly" ) { REQUIRE( dsl_component_list_size() == 1 ); boolean retSync(true), retAsync(false); REQUIRE( dsl_sink_sync_settings_get(overlaySinkName.c_str(), &retSync, &retAsync) == DSL_RESULT_SUCCESS ); REQUIRE( retSync == newSync ); REQUIRE( retAsync == newAsync ); REQUIRE( dsl_component_delete_all() == DSL_RESULT_SUCCESS ); } } } } } SCENARIO( "A Overlay Sink's Offsets can be updated", "[sink-api]" ) { GIVEN( "A new Overlay Sink in memory" ) { // Get the Device properties cudaDeviceProp deviceProp; cudaGetDeviceProperties(&deviceProp, 0); if (deviceProp.integrated) { std::wstring sinkName = L"overlay-sink"; uint displayId(0); uint depth(0); uint offsetX(0); uint offsetY(0); uint sinkW(0); uint sinkH(0); uint preOffsetX(100), preOffsetY(100); uint retOffsetX(0), retOffsetY(0); REQUIRE( dsl_sink_overlay_new(sinkName.c_str(), displayId, depth, offsetX, offsetY, sinkW, sinkH) == DSL_RESULT_SUCCESS ); WHEN( "The Window Sink's Offsets are Set" ) { REQUIRE( dsl_sink_render_offsets_set(sinkName.c_str(), preOffsetX, preOffsetY) == DSL_RESULT_SUCCESS); THEN( "The correct values are returned on Get" ) { dsl_sink_render_offsets_get(sinkName.c_str(), &retOffsetX, &retOffsetY); REQUIRE( preOffsetX == retOffsetX); REQUIRE( preOffsetY == retOffsetY); REQUIRE( dsl_component_delete_all() == DSL_RESULT_SUCCESS ); } } } } } SCENARIO( "A Overlay Sink's Dimensions can be updated", "[sink-api]" ) { GIVEN( "A new Overlay Sink in memory" ) { // Get the Device properties cudaDeviceProp deviceProp; cudaGetDeviceProperties(&deviceProp, 0); if (deviceProp.integrated) { std::wstring sinkName = L"overlay-sink"; uint displayId(0); uint depth(0); uint offsetX(0); uint offsetY(0); uint sinkW(0); uint sinkH(0); uint preSinkW(1280), preSinkH(720); uint retSinkW(0), retSinkH(0); REQUIRE( dsl_sink_overlay_new(sinkName.c_str(), displayId, depth, offsetX, offsetY, sinkW, sinkH) == DSL_RESULT_SUCCESS ); WHEN( "The Overlay Sink's Dimensions are Set" ) { REQUIRE( dsl_sink_render_dimensions_set(sinkName.c_str(), preSinkW, preSinkH) == DSL_RESULT_SUCCESS); THEN( "The correct values are returned on Get" ) { dsl_sink_render_dimensions_get(sinkName.c_str(), &retSinkW, &retSinkH); REQUIRE( preSinkW == retSinkW); REQUIRE( preSinkH == retSinkH); REQUIRE( dsl_component_delete_all() == DSL_RESULT_SUCCESS ); } } } } } SCENARIO( "An Overlay Sink can be Reset", "[sink-api]" ) { GIVEN( "Attributes for a new Overlay Sink" ) { // Get the Device properties cudaDeviceProp deviceProp; cudaGetDeviceProperties(&deviceProp, 0); if (deviceProp.integrated) { std::wstring overlaySinkName = L"overlay-sink"; uint displayId(0); uint depth(0); uint offsetX(0); uint offsetY(0); uint sinkW(0); uint sinkH(0); WHEN( "The Overlay Sink is created" ) { REQUIRE( dsl_sink_overlay_new(overlaySinkName.c_str(), displayId, depth, offsetX, offsetY, sinkW, sinkH) == DSL_RESULT_SUCCESS ); THEN( "The Overlay Sink can be reset after creation" ) { REQUIRE( dsl_sink_render_reset(overlaySinkName.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_component_delete_all() == DSL_RESULT_SUCCESS ); } } } } } SCENARIO( "An Overlay Sink in use can't be deleted", "[sink-api]" ) { GIVEN( "A new Overlay Sink and new pPipeline" ) { // Get the Device properties cudaDeviceProp deviceProp; cudaGetDeviceProperties(&deviceProp, 0); if (deviceProp.integrated) { std::wstring pipelineName = L"test-pipeline"; std::wstring overlaySinkName = L"overlay-sink"; uint displayId(0); uint depth(0); uint offsetX(0); uint offsetY(0); uint sinkW(1280); uint sinkH(720); REQUIRE( dsl_sink_overlay_new(overlaySinkName.c_str(), displayId, depth, offsetX, offsetY, sinkW, sinkH) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_component_list_size() == 1 ); REQUIRE( dsl_pipeline_new(pipelineName.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pipeline_list_size() == 1 ); WHEN( "The Overlay Sink is added to the Pipeline" ) { REQUIRE( dsl_pipeline_component_add(pipelineName.c_str(), overlaySinkName.c_str()) == DSL_RESULT_SUCCESS ); THEN( "The Overlay Sink can't be deleted" ) { REQUIRE( dsl_component_delete(overlaySinkName.c_str()) == DSL_RESULT_COMPONENT_IN_USE ); REQUIRE( dsl_pipeline_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_component_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pipeline_list_size() == 0 ); REQUIRE( dsl_component_list_size() == 0 ); } } } } } SCENARIO( "An Overlay Sink, once removed from a Pipeline, can be deleted", "[sink-api]" ) { GIVEN( "A new Sink owned by a new pPipeline" ) { // Get the Device properties cudaDeviceProp deviceProp; cudaGetDeviceProperties(&deviceProp, 0); if (deviceProp.integrated) { std::wstring pipelineName = L"test-pipeline"; std::wstring overlaySinkName = L"overlay-sink"; uint displayId(0); uint depth(0); uint offsetX(0); uint offsetY(0); uint sinkW(1280); uint sinkH(720); REQUIRE( dsl_sink_overlay_new(overlaySinkName.c_str(), displayId, depth, offsetX, offsetY, sinkW, sinkH) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pipeline_new(pipelineName.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pipeline_component_add(pipelineName.c_str(), overlaySinkName.c_str()) == DSL_RESULT_SUCCESS ); WHEN( "The Overlay Sink is removed the Pipeline" ) { REQUIRE( dsl_pipeline_component_remove(pipelineName.c_str(), overlaySinkName.c_str()) == DSL_RESULT_SUCCESS ); THEN( "The Overlay Sink can be deleted" ) { REQUIRE( dsl_component_delete(overlaySinkName.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pipeline_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pipeline_list_size() == 0 ); REQUIRE( dsl_component_list_size() == 0 ); } } } } } SCENARIO( "An Overlay Sink in use can't be added to a second Pipeline", "[sink-api]" ) { GIVEN( "A new Overlay Sink and two new Pipelines" ) { // Get the Device properties cudaDeviceProp deviceProp; cudaGetDeviceProperties(&deviceProp, 0); if (deviceProp.integrated) { std::wstring pipelineName1(L"test-pipeline-1"); std::wstring pipelineName2(L"test-pipeline-2"); std::wstring overlaySinkName = L"overlay-sink"; uint displayId(0); uint depth(0); uint offsetX(0); uint offsetY(0); uint sinkW(1280); uint sinkH(720); REQUIRE( dsl_sink_overlay_new(overlaySinkName.c_str(), displayId, depth, offsetX, offsetY, sinkW, sinkH) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pipeline_new(pipelineName1.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pipeline_new(pipelineName2.c_str()) == DSL_RESULT_SUCCESS ); WHEN( "The Overlay Sink is added to the first Pipeline" ) { REQUIRE( dsl_pipeline_component_add(pipelineName1.c_str(), overlaySinkName.c_str()) == DSL_RESULT_SUCCESS ); THEN( "The Overlay Sink can't be added to the second Pipeline" ) { REQUIRE( dsl_pipeline_component_add(pipelineName2.c_str(), overlaySinkName.c_str()) == DSL_RESULT_COMPONENT_IN_USE ); REQUIRE( dsl_pipeline_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_component_delete_all() == DSL_RESULT_SUCCESS ); } } } } } SCENARIO( "The Components container is updated correctly on new Window Sink", "[sink-api]" ) { GIVEN( "An empty list of Components" ) { std::wstring windowSinkName(L"window-sink"); uint offsetX(0); uint offsetY(0); uint sinkW(1280); uint sinkH(720); REQUIRE( dsl_component_list_size() == 0 ); WHEN( "A new Window Sink is created" ) { REQUIRE( dsl_sink_window_new(windowSinkName.c_str(), offsetX, offsetY, sinkW, sinkH) == DSL_RESULT_SUCCESS ); THEN( "The list size is updated correctly" ) { REQUIRE( dsl_component_list_size() == 1 ); } } REQUIRE( dsl_component_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_component_list_size() == 0 ); } } SCENARIO( "The Components container is updated correctly on Window Sink delete", "[sink-api]" ) { GIVEN( "An Window Sink Component" ) { std::wstring windowSinkName = L"window-sink"; uint offsetX(0); uint offsetY(0); uint sinkW(0); uint sinkH(0); REQUIRE( dsl_component_list_size() == 0 ); REQUIRE( dsl_sink_window_new(windowSinkName.c_str(), offsetX, offsetY, sinkW, sinkH) == DSL_RESULT_SUCCESS ); WHEN( "A new Window Sink is deleted" ) { REQUIRE( dsl_component_delete(windowSinkName.c_str()) == DSL_RESULT_SUCCESS ); THEN( "The list size updated correctly" ) { REQUIRE( dsl_component_list_size() == 0 ); } } } } SCENARIO( "A Window Sink can update its Sync/Async attributes", "[sink-api]" ) { GIVEN( "An empty list of Components" ) { std::wstring windowSinkName = L"window-sink"; uint offsetX(0); uint offsetY(0); uint sinkW(0); uint sinkH(0); REQUIRE( dsl_component_list_size() == 0 ); REQUIRE( dsl_sink_window_new(windowSinkName.c_str(), offsetX, offsetY, sinkW, sinkH) == DSL_RESULT_SUCCESS ); WHEN( "A the Window Sink's attributes are updated from the default" ) { boolean newSync(false), newAsync(true); REQUIRE( dsl_sink_sync_settings_set(windowSinkName.c_str(), newSync, newAsync) == DSL_RESULT_SUCCESS ); THEN( "The list size is updated correctly" ) { REQUIRE( dsl_component_list_size() == 1 ); boolean retSync(true), retAsync(false); REQUIRE( dsl_sink_sync_settings_get(windowSinkName.c_str(), &retSync, &retAsync) == DSL_RESULT_SUCCESS ); REQUIRE( retSync == newSync ); REQUIRE( retAsync == newAsync ); REQUIRE( dsl_component_delete_all() == DSL_RESULT_SUCCESS ); } } } } SCENARIO( "A Window Sink can update its force-aspect-ratio setting", "[sink-api]" ) { GIVEN( "A new window sink" ) { std::wstring windowSinkName = L"window-sink"; uint offsetX(0); uint offsetY(0); uint sinkW(0); uint sinkH(0); boolean force(1); REQUIRE( dsl_component_list_size() == 0 ); REQUIRE( dsl_sink_window_new(windowSinkName.c_str(), offsetX, offsetY, sinkW, sinkH) == DSL_RESULT_SUCCESS ); WHEN( "A Window Sink's force-aspect-ratio is set" ) { REQUIRE( dsl_sink_window_force_aspect_ratio_set(windowSinkName.c_str(), force) == DSL_RESULT_SUCCESS ); THEN( "The list size is updated correctly" ) { REQUIRE( dsl_component_list_size() == 1 ); boolean retForce(false); REQUIRE( dsl_sink_window_force_aspect_ratio_get(windowSinkName.c_str(), &retForce) == DSL_RESULT_SUCCESS ); REQUIRE( retForce == force ); REQUIRE( dsl_component_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_component_list_size() == 0 ); } } } } SCENARIO( "A Window Sink can be Reset", "[sink-api]" ) { GIVEN( "Given attributes for a new window sink" ) { std::wstring windowSinkName = L"window-sink"; uint offsetX(0); uint offsetY(0); uint sinkW(0); uint sinkH(0); boolean force(1); WHEN( "The Window Sink is created" ) { REQUIRE( dsl_sink_window_new(windowSinkName.c_str(), offsetX, offsetY, sinkW, sinkH) == DSL_RESULT_SUCCESS ); THEN( "The Window Sink can be reset after creation" ) { REQUIRE( dsl_sink_render_reset(windowSinkName.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_component_delete_all() == DSL_RESULT_SUCCESS ); } } } } SCENARIO( "A Window Sink in use can't be deleted", "[sink-api]" ) { GIVEN( "A new Window Sink and new Pipeline" ) { std::wstring pipelineName = L"test-pipeline"; std::wstring windowSinkName = L"window-sink"; uint offsetX(0); uint offsetY(0); uint sinkW(1280); uint sinkH(720); REQUIRE( dsl_sink_window_new(windowSinkName.c_str(), offsetX, offsetY, sinkW, sinkH) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_component_list_size() == 1 ); REQUIRE( dsl_pipeline_new(pipelineName.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pipeline_list_size() == 1 ); WHEN( "The Window Sink is added to the Pipeline" ) { REQUIRE( dsl_pipeline_component_add(pipelineName.c_str(), windowSinkName.c_str()) == DSL_RESULT_SUCCESS ); THEN( "The Window Sink can't be deleted" ) { REQUIRE( dsl_component_delete(windowSinkName.c_str()) == DSL_RESULT_COMPONENT_IN_USE ); REQUIRE( dsl_pipeline_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_component_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pipeline_list_size() == 0 ); REQUIRE( dsl_component_list_size() == 0 ); } } } } SCENARIO( "A Window Sink, once removed from a Pipeline, can be deleted", "[sink-api]" ) { GIVEN( "A new Sink owned by a new pPipeline" ) { std::wstring pipelineName = L"test-pipeline"; std::wstring windowSinkName = L"window-sink"; uint offsetX(0); uint offsetY(0); uint sinkW(1280); uint sinkH(720); REQUIRE( dsl_sink_window_new(windowSinkName.c_str(), offsetX, offsetY, sinkW, sinkH) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pipeline_new(pipelineName.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pipeline_component_add(pipelineName.c_str(), windowSinkName.c_str()) == DSL_RESULT_SUCCESS ); WHEN( "The Window Sink is removed the Pipeline" ) { REQUIRE( dsl_pipeline_component_remove(pipelineName.c_str(), windowSinkName.c_str()) == DSL_RESULT_SUCCESS ); THEN( "The Window Sink can be deleted" ) { REQUIRE( dsl_component_delete(windowSinkName.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pipeline_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pipeline_list_size() == 0 ); REQUIRE( dsl_component_list_size() == 0 ); } } } } SCENARIO( "A Window Sink in use can't be added to a second Pipeline", "[sink-api]" ) { GIVEN( "A new Window Sink and two new pPipelines" ) { std::wstring pipelineName1(L"test-pipeline-1"); std::wstring pipelineName2(L"test-pipeline-2"); std::wstring windowSinkName = L"window-sink"; uint offsetX(0); uint offsetY(0); uint sinkW(1280); uint sinkH(720); REQUIRE( dsl_sink_window_new(windowSinkName.c_str(), offsetX, offsetY, sinkW, sinkH) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pipeline_new(pipelineName1.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pipeline_new(pipelineName2.c_str()) == DSL_RESULT_SUCCESS ); WHEN( "The Window Sink is added to the first Pipeline" ) { REQUIRE( dsl_pipeline_component_add(pipelineName1.c_str(), windowSinkName.c_str()) == DSL_RESULT_SUCCESS ); THEN( "The Window Sink can't be added to the second Pipeline" ) { REQUIRE( dsl_pipeline_component_add(pipelineName2.c_str(), windowSinkName.c_str()) == DSL_RESULT_COMPONENT_IN_USE ); REQUIRE( dsl_pipeline_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_component_delete_all() == DSL_RESULT_SUCCESS ); } } } } SCENARIO( "A Window Sink's Offsets can be updated", "[sink-api]" ) { GIVEN( "A new Render Sink in memory" ) { std::wstring sinkName = L"window-sink"; uint sinkW(1280); uint sinkH(720); uint offsetX(0), offsetY(0); uint preOffsetX(100), preOffsetY(100); uint retOffsetX(0), retOffsetY(0); REQUIRE( dsl_sink_window_new(sinkName.c_str(), offsetX, offsetY, sinkW, sinkH) == DSL_RESULT_SUCCESS ); WHEN( "The Window Sink's Offsets are Set" ) { REQUIRE( dsl_sink_render_offsets_set(sinkName.c_str(), preOffsetX, preOffsetY) == DSL_RESULT_SUCCESS); THEN( "The correct values are returned on Get" ) { dsl_sink_render_offsets_get(sinkName.c_str(), &retOffsetX, &retOffsetY); REQUIRE( preOffsetX == retOffsetX); REQUIRE( preOffsetY == retOffsetY); REQUIRE( dsl_component_delete_all() == DSL_RESULT_SUCCESS ); } } } } SCENARIO( "A Window Sink's Dimensions can be updated", "[sink-api]" ) { GIVEN( "A new Window Sink in memory" ) { std::wstring sinkName = L"window-sink"; uint offsetX(100), offsetY(100); uint sinkW(1920), sinkH(1080); uint preSinkW(1280), preSinkH(720); uint retSinkW(0), retSinkH(0); REQUIRE( dsl_sink_window_new(sinkName.c_str(), offsetX, offsetY, sinkW, sinkH) == DSL_RESULT_SUCCESS ); WHEN( "The Window Sink's Dimensions are Set" ) { REQUIRE( dsl_sink_render_dimensions_set(sinkName.c_str(), preSinkW, preSinkH) == DSL_RESULT_SUCCESS); THEN( "The correct values are returned on Get" ) { dsl_sink_render_dimensions_get(sinkName.c_str(), &retSinkW, &retSinkH); REQUIRE( preSinkW == retSinkW); REQUIRE( preSinkH == retSinkH); REQUIRE( dsl_component_delete_all() == DSL_RESULT_SUCCESS ); } } } } SCENARIO( "The Components container is updated correctly on new File Sink", "[sink-api]" ) { GIVEN( "An empty list of Components" ) { std::wstring fileSinkName(L"file-sink"); std::wstring filePath(L"./output.mp4"); uint codec(DSL_CODEC_H265); uint container(DSL_CONTAINER_MP4); uint bitrate(2000000); uint interval(0); REQUIRE( dsl_component_list_size() == 0 ); WHEN( "A new File Sink is created" ) { REQUIRE( dsl_sink_file_new(fileSinkName.c_str(), filePath.c_str(), codec, container, bitrate, interval) == DSL_RESULT_SUCCESS ); THEN( "The list size is updated correctly" ) { uint retCodec(0), retContainer(0); REQUIRE( dsl_sink_encode_video_formats_get(fileSinkName.c_str(), &retCodec, &retContainer) == DSL_RESULT_SUCCESS ); REQUIRE( retCodec == codec ); REQUIRE( retContainer == container ); REQUIRE( dsl_component_list_size() == 1 ); } } REQUIRE( dsl_component_delete_all() == DSL_RESULT_SUCCESS ); } } SCENARIO( "The Components container is updated correctly on File Sink delete", "[sink-api]" ) { GIVEN( "An File Sink Component" ) { std::wstring fileSinkName(L"file-sink"); std::wstring filePath(L"./output.mp4"); uint codec(DSL_CODEC_H265); uint container(DSL_CONTAINER_MP4); uint bitrate(2000000); uint interval(0); REQUIRE( dsl_component_list_size() == 0 ); REQUIRE( dsl_sink_file_new(fileSinkName.c_str(), filePath.c_str(), codec, container, bitrate, interval) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_component_list_size() == 1 ); WHEN( "A new File Sink is deleted" ) { REQUIRE( dsl_component_delete(fileSinkName.c_str()) == DSL_RESULT_SUCCESS ); THEN( "The list size updated correctly" ) { REQUIRE( dsl_component_list_size() == 0 ); } } } } SCENARIO( "Creating a new File Sink with an invalid Codec will fail", "[sink-api]" ) { GIVEN( "Attributes for a new File Sink" ) { std::wstring fileSinkName(L"file-sink"); std::wstring filePath(L"./output.mp4"); uint codec(DSL_CODEC_MPEG4 + 1); uint container(DSL_CONTAINER_MP4); uint bitrate(2000000); uint interval(0); REQUIRE( dsl_component_list_size() == 0 ); WHEN( "When creating a new File Sink with an invalid Codec" ) { REQUIRE( dsl_sink_file_new(fileSinkName.c_str(), filePath.c_str(), codec, container, bitrate, interval) == DSL_RESULT_SINK_CODEC_VALUE_INVALID ); THEN( "The list size is left unchanged" ) { REQUIRE( dsl_component_list_size() == 0 ); } } } } SCENARIO( "Creating a new File Sink with an invalid Container will fail", "[sink-api]" ) { GIVEN( "Attributes for a new File Sink" ) { std::wstring fileSinkName(L"file-sink"); std::wstring filePath(L"./output.mp4"); uint codec(DSL_CODEC_MPEG4); uint container(DSL_CONTAINER_MKV + 1); uint bitrate(2000000); uint interval(0); REQUIRE( dsl_component_list_size() == 0 ); WHEN( "When creating a new File Sink with an invalid Container" ) { REQUIRE( dsl_sink_file_new(fileSinkName.c_str(), filePath.c_str(), codec, container, bitrate, interval) == DSL_RESULT_SINK_CONTAINER_VALUE_INVALID ); THEN( "The list size is left unchanged" ) { REQUIRE( dsl_component_list_size() == 0 ); } } } } SCENARIO( "A File Sink's Encoder settings can be updated", "[sink-api]" ) { GIVEN( "A new File Sink" ) { std::wstring fileSinkName(L"file-sink"); std::wstring filePath(L"./output.mp4"); uint codec(DSL_CODEC_H265); uint container(DSL_CONTAINER_MP4); uint initBitrate(2000000); uint initInterval(0); REQUIRE( dsl_sink_file_new(fileSinkName.c_str(), filePath.c_str(), codec, container, initBitrate, initInterval) == DSL_RESULT_SUCCESS ); uint currBitrate(0); uint currInterval(0); REQUIRE( dsl_sink_encode_settings_get(fileSinkName.c_str(), &currBitrate, &currInterval) == DSL_RESULT_SUCCESS); REQUIRE( currBitrate == initBitrate ); REQUIRE( currInterval == initInterval ); WHEN( "The FileSinkBintr's Encoder settings are Set" ) { uint newBitrate(2500000); uint newInterval(10); REQUIRE( dsl_sink_encode_settings_set(fileSinkName.c_str(), newBitrate, newInterval) == DSL_RESULT_SUCCESS); THEN( "The FileSinkBintr's new Encoder settings are returned on Get") { REQUIRE( dsl_sink_encode_settings_get(fileSinkName.c_str(), &currBitrate, &currInterval) == DSL_RESULT_SUCCESS); REQUIRE( currBitrate == newBitrate ); REQUIRE( currInterval == newInterval ); REQUIRE( dsl_component_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_component_list_size() == 0 ); } } } } SCENARIO( "An invalid File Sink is caught on Encoder settings Get and Set", "[sink-api]" ) { GIVEN( "A new Fake Sink as incorrect Sink Type" ) { std::wstring fakeSinkName(L"fake-sink"); uint currBitrate(0); uint currInterval(0); uint newBitrate(2500000); uint newInterval(10); WHEN( "The File Sink Get-Set API called with a Fake sink" ) { REQUIRE( dsl_sink_fake_new(fakeSinkName.c_str()) == DSL_RESULT_SUCCESS); THEN( "The File Sink encoder settings APIs fail correctly") { REQUIRE( dsl_sink_encode_settings_get(fakeSinkName.c_str(), &currBitrate, &currInterval) == DSL_RESULT_SINK_COMPONENT_IS_NOT_ENCODE_SINK); REQUIRE( dsl_sink_encode_settings_set(fakeSinkName.c_str(), newBitrate, newInterval) == DSL_RESULT_SINK_COMPONENT_IS_NOT_ENCODE_SINK); REQUIRE( dsl_component_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_component_list_size() == 0 ); } } } } SCENARIO( "The Components container is updated correctly on new Record Sink", "[sink-api]" ) { GIVEN( "An empty list of Components" ) { std::wstring recordSinkName(L"record-sink"); std::wstring outdir(L"./"); uint container(DSL_CONTAINER_MP4); uint codec(DSL_CODEC_H264); uint bitrate(2000000); uint interval(0); dsl_record_client_listener_cb client_listener; REQUIRE( dsl_component_list_size() == 0 ); WHEN( "A new Record Sink is created" ) { REQUIRE( dsl_sink_record_new(recordSinkName.c_str(), outdir.c_str(), codec, container, bitrate, interval, client_listener) == DSL_RESULT_SUCCESS ); THEN( "The list size is updated correctly" ) { uint ret_cache_size(0); uint ret_width(0), ret_height(0); REQUIRE( dsl_sink_record_cache_size_get(recordSinkName.c_str(), &ret_cache_size) == DSL_RESULT_SUCCESS ); REQUIRE( ret_cache_size == DSL_DEFAULT_VIDEO_RECORD_CACHE_IN_SEC ); REQUIRE( dsl_sink_record_dimensions_get(recordSinkName.c_str(), &ret_width, &ret_height) == DSL_RESULT_SUCCESS ); REQUIRE( ret_width == 0 ); REQUIRE( ret_height == 0 ); REQUIRE( dsl_component_list_size() == 1 ); } } REQUIRE( dsl_component_delete_all() == DSL_RESULT_SUCCESS ); } } SCENARIO( "The Components container is updated correctly on Record Sink delete", "[sink-api]" ) { GIVEN( "A Record Sink Component" ) { std::wstring recordSinkName(L"record-sink"); std::wstring outdir(L"./"); uint container(DSL_CONTAINER_MP4); uint codec(DSL_CODEC_H264); uint bitrate(2000000); uint interval(0); dsl_record_client_listener_cb client_listener; REQUIRE( dsl_component_list_size() == 0 ); REQUIRE( dsl_sink_record_new(recordSinkName.c_str(), outdir.c_str(), codec, container, bitrate, interval, client_listener) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_component_list_size() == 1 ); WHEN( "A new Record Sink is deleted" ) { REQUIRE( dsl_component_delete(recordSinkName.c_str()) == DSL_RESULT_SUCCESS ); THEN( "The list size updated correctly" ) { REQUIRE( dsl_component_list_size() == 0 ); } } } } SCENARIO( "A Player can be added to and removed from a Record Sink", "[sink-api]" ) { GIVEN( "A new Record Sink and Video Player" ) { std::wstring recordSinkName(L"record-sink"); std::wstring outdir(L"./"); uint container(DSL_CONTAINER_MP4); uint codec(DSL_CODEC_H264); uint bitrate(2000000); uint interval(0); dsl_record_client_listener_cb client_listener; REQUIRE( dsl_sink_record_new(recordSinkName.c_str(), outdir.c_str(), codec, container, bitrate, interval, client_listener) == DSL_RESULT_SUCCESS ); std::wstring player_name(L"player"); std::wstring file_path = L"./test/streams/sample_1080p_h264.mp4"; REQUIRE( dsl_player_render_video_new(player_name.c_str(),file_path.c_str(), DSL_RENDER_TYPE_OVERLAY, 10, 10, 75, 0) == DSL_RESULT_SUCCESS ); WHEN( "A capture-complete-listner is added" ) { REQUIRE( dsl_sink_record_video_player_add(recordSinkName.c_str(), player_name.c_str()) == DSL_RESULT_SUCCESS ); // ensure the same listener twice fails REQUIRE( dsl_sink_record_video_player_add(recordSinkName.c_str(), player_name.c_str()) == DSL_RESULT_SINK_PLAYER_ADD_FAILED ); THEN( "The same listner can be remove" ) { REQUIRE( dsl_sink_record_video_player_remove(recordSinkName.c_str(), player_name.c_str()) == DSL_RESULT_SUCCESS ); // calling a second time must fail REQUIRE( dsl_sink_record_video_player_remove(recordSinkName.c_str(), player_name.c_str()) == DSL_RESULT_SINK_PLAYER_REMOVE_FAILED ); REQUIRE( dsl_component_delete(recordSinkName.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_player_delete(player_name.c_str()) == DSL_RESULT_SUCCESS ); } } } } SCENARIO( "A Mailer can be added to and removed from a Record Sink", "[sink-api]" ) { GIVEN( "A new Record Sink and Mailer" ) { std::wstring recordSinkName(L"record-sink"); std::wstring outdir(L"./"); uint container(DSL_CONTAINER_MP4); uint codec(DSL_CODEC_H264); uint bitrate(2000000); uint interval(0); dsl_record_client_listener_cb client_listener; REQUIRE( dsl_sink_record_new(recordSinkName.c_str(), outdir.c_str(), codec, container, bitrate, interval, client_listener) == DSL_RESULT_SUCCESS ); std::wstring mailer_name(L"mailer"); std::wstring subject(L"Subject line"); REQUIRE( dsl_mailer_new(mailer_name.c_str()) == DSL_RESULT_SUCCESS ); WHEN( "A Mailer is added" ) { REQUIRE( dsl_sink_record_mailer_add(recordSinkName.c_str(), mailer_name.c_str(), subject.c_str()) == DSL_RESULT_SUCCESS ); // ensure the same Mailer twice fails REQUIRE( dsl_sink_record_mailer_add(recordSinkName.c_str(), mailer_name.c_str(), subject.c_str()) == DSL_RESULT_SINK_MAILER_ADD_FAILED ); THEN( "The Mailer can be removed" ) { REQUIRE( dsl_sink_record_mailer_remove(recordSinkName.c_str(), mailer_name.c_str()) == DSL_RESULT_SUCCESS ); // calling a second time must fail REQUIRE( dsl_sink_record_mailer_remove(recordSinkName.c_str(), mailer_name.c_str()) == DSL_RESULT_SINK_MAILER_REMOVE_FAILED ); REQUIRE( dsl_component_delete(recordSinkName.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_component_list_size() == 0 ); REQUIRE( dsl_mailer_delete(mailer_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_mailer_list_size() == 0 ); } } } } SCENARIO( "The Components container is updated correctly on new DSL_CODEC_H264 RTSP Sink", "[sink-api]" ) { GIVEN( "An empty list of Components" ) { std::wstring rtspSinkName(L"rtsp-sink"); std::wstring host(L"172.16.58.3"); uint udpPort(5400); uint rtspPort(8554); uint codec(DSL_CODEC_H264); uint bitrate(4000000); uint interval(0); REQUIRE( dsl_component_list_size() == 0 ); WHEN( "A new RTSP Sink is created" ) { REQUIRE( dsl_sink_rtsp_new(rtspSinkName.c_str(), host.c_str(), udpPort, rtspPort, codec, bitrate, interval) == DSL_RESULT_SUCCESS ); THEN( "The list size is updated correctly" ) { uint retUdpPort(0), retRtspPort(0), retCodec(0); dsl_sink_rtsp_server_settings_get(rtspSinkName.c_str(), &retUdpPort, &retRtspPort, &retCodec); REQUIRE( retUdpPort == udpPort ); REQUIRE( retRtspPort == rtspPort ); REQUIRE( retCodec == codec ); REQUIRE( dsl_component_list_size() == 1 ); } } REQUIRE( dsl_component_delete_all() == DSL_RESULT_SUCCESS ); } } SCENARIO( "The Components container is updated correctly on DSL_CODEC_H264 RTSP Sink delete", "[sink-api]" ) { GIVEN( "An RTSP Sink Component" ) { std::wstring rtspSinkName(L"rtsp-sink"); std::wstring host(L"172.16.58.3"); uint udpPort(5400); uint rtspPort(8554); uint codec(DSL_CODEC_H264); uint bitrate(4000000); uint interval(0); REQUIRE( dsl_component_list_size() == 0 ); REQUIRE( dsl_sink_rtsp_new(rtspSinkName.c_str(), host.c_str(), udpPort, rtspPort, codec, bitrate, interval) == DSL_RESULT_SUCCESS ); WHEN( "A new RTSP Sink is deleted" ) { REQUIRE( dsl_component_delete(rtspSinkName.c_str()) == DSL_RESULT_SUCCESS ); THEN( "The list size updated correctly" ) { REQUIRE( dsl_component_list_size() == 0 ); } } } } SCENARIO( "The Components container is updated correctly on new DSL_CODEC_H265 RTSP Sink", "[sink-api]" ) { GIVEN( "An empty list of Components" ) { std::wstring rtspSinkName(L"rtsp-sink"); std::wstring host(L"172.16.58.3"); uint udpPort(5400); uint rtspPort(8554); uint codec(DSL_CODEC_H265); uint bitrate(4000000); uint interval(0); REQUIRE( dsl_component_list_size() == 0 ); WHEN( "A new RTSP Sink is created" ) { REQUIRE( dsl_sink_rtsp_new(rtspSinkName.c_str(), host.c_str(), udpPort, rtspPort, codec, bitrate, interval) == DSL_RESULT_SUCCESS ); THEN( "The list size is updated correctly" ) { uint retUdpPort(0), retRtspPort(0), retCodec(0); dsl_sink_rtsp_server_settings_get(rtspSinkName.c_str(), &retUdpPort, &retRtspPort, &retCodec); REQUIRE( retUdpPort == udpPort ); REQUIRE( retRtspPort == rtspPort ); REQUIRE( retCodec == codec ); REQUIRE( dsl_component_list_size() == 1 ); } } REQUIRE( dsl_component_delete_all() == DSL_RESULT_SUCCESS ); } } SCENARIO( "The Components container is updated correctly on DSL_CODEC_H265 RTSP Sink delete", "[sink-api]" ) { GIVEN( "An RTSP Sink Component" ) { std::wstring rtspSinkName(L"rtsp-sink"); std::wstring host(L"172.16.58.3"); uint udpPort(5400); uint rtspPort(8554); uint codec(DSL_CODEC_H265); uint bitrate(4000000); uint interval(0); REQUIRE( dsl_component_list_size() == 0 ); REQUIRE( dsl_sink_rtsp_new(rtspSinkName.c_str(), host.c_str(), udpPort, rtspPort, codec, bitrate, interval) == DSL_RESULT_SUCCESS ); WHEN( "A new RTSP Sink is deleted" ) { REQUIRE( dsl_component_delete(rtspSinkName.c_str()) == DSL_RESULT_SUCCESS ); THEN( "The list size updated correctly" ) { REQUIRE( dsl_component_list_size() == 0 ); } } } } SCENARIO( "An RTSP Sink's Encoder settings can be updated", "[sink-api]" ) { GIVEN( "A new RTSP Sink" ) { std::wstring rtspSinkName(L"rtsp-sink"); std::wstring host(L"172.16.58.3"); uint udpPort(5400); uint rtspPort(8554); uint codec(DSL_CODEC_H265); uint initBitrate(4000000); uint initInterval(0); REQUIRE( dsl_sink_rtsp_new(rtspSinkName.c_str(), host.c_str(), udpPort, rtspPort, codec, initBitrate, initInterval) == DSL_RESULT_SUCCESS ); uint currBitrate(0); uint currInterval(0); REQUIRE( dsl_sink_rtsp_encoder_settings_get(rtspSinkName.c_str(), &currBitrate, &currInterval) == DSL_RESULT_SUCCESS); REQUIRE( currBitrate == initBitrate ); REQUIRE( currInterval == initInterval ); WHEN( "The RTSP Sink's Encoder settings are Set" ) { uint newBitrate(2500000); uint newInterval(10); REQUIRE( dsl_sink_rtsp_encoder_settings_set(rtspSinkName.c_str(), newBitrate, newInterval) == DSL_RESULT_SUCCESS); THEN( "The RTSP Sink's new Encoder settings are returned on Get") { REQUIRE( dsl_sink_rtsp_encoder_settings_get(rtspSinkName.c_str(), &currBitrate, &currInterval) == DSL_RESULT_SUCCESS); REQUIRE( currBitrate == newBitrate ); REQUIRE( currInterval == newInterval ); REQUIRE( dsl_component_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_component_list_size() == 0 ); } } } } SCENARIO( "An invalid RTSP Sink is caught on Encoder settings Get and Set", "[sink-api]" ) { GIVEN( "A new Fake Sink as incorrect Sink Type" ) { std::wstring fakeSinkName(L"fake-sink"); uint currBitrate(0); uint currInterval(0); uint newBitrate(2500000); uint newInterval(10); WHEN( "The RTSP Sink Get-Set API called with a Fake sink" ) { REQUIRE( dsl_sink_fake_new(fakeSinkName.c_str()) == DSL_RESULT_SUCCESS); THEN( "The RTSP Sink encoder settings APIs fail correctly") { REQUIRE( dsl_sink_rtsp_encoder_settings_get(fakeSinkName.c_str(), &currBitrate, &currInterval) == DSL_RESULT_COMPONENT_NOT_THE_CORRECT_TYPE); REQUIRE( dsl_sink_rtsp_encoder_settings_set(fakeSinkName.c_str(), newBitrate, newInterval) == DSL_RESULT_COMPONENT_NOT_THE_CORRECT_TYPE); REQUIRE( dsl_component_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_component_list_size() == 0 ); } } } } SCENARIO( "A Client is able to update the Sink in-use max", "[sink-api]" ) { GIVEN( "An empty list of Components" ) { REQUIRE( dsl_component_list_size() == 0 ); REQUIRE( dsl_sink_num_in_use_max_get() == DSL_DEFAULT_SINK_IN_USE_MAX ); REQUIRE( dsl_sink_num_in_use_get() == 0 ); WHEN( "The in-use-max is updated by the client" ) { uint new_max = 128; REQUIRE( dsl_sink_num_in_use_max_set(new_max) == true ); THEN( "The new in-use-max will be returned to the client on get" ) { REQUIRE( dsl_sink_num_in_use_max_get() == new_max ); } } } } SCENARIO( "A Sink added to a Pipeline updates the in-use number", "[sink-api]" ) { GIVEN( "A new Sink and new Pipeline" ) { std::wstring pipelineName = L"test-pipeline"; std::wstring windowSinkName = L"window-sink"; uint offsetX(0); uint offsetY(0); uint sinkW(1280); uint sinkH(720); REQUIRE( dsl_sink_window_new(windowSinkName.c_str(), offsetX, offsetY, sinkW, sinkH) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pipeline_new(pipelineName.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_sink_num_in_use_get() == 0 ); WHEN( "The Window Sink is added to the Pipeline" ) { REQUIRE( dsl_pipeline_component_add(pipelineName.c_str(), windowSinkName.c_str()) == DSL_RESULT_SUCCESS ); THEN( "The correct in-use number is returned to the client" ) { REQUIRE( dsl_sink_num_in_use_get() == 1 ); REQUIRE( dsl_pipeline_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_component_delete_all() == DSL_RESULT_SUCCESS ); } } } } SCENARIO( "A Sink removed from a Pipeline updates the in-use number", "[sink-api]" ) { GIVEN( "A new Pipeline with a Sink" ) { std::wstring pipelineName = L"test-pipeline"; std::wstring windowSinkName = L"window-sink"; uint offsetX(0); uint offsetY(0); uint sinkW(1280); uint sinkH(720); REQUIRE( dsl_sink_window_new(windowSinkName.c_str(), offsetX, offsetY, sinkW, sinkH) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pipeline_new(pipelineName.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pipeline_component_add(pipelineName.c_str(), windowSinkName.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_sink_num_in_use_get() == 1 ); WHEN( "The Source is removed from, the Pipeline" ) { REQUIRE( dsl_pipeline_component_remove(pipelineName.c_str(), windowSinkName.c_str()) == DSL_RESULT_SUCCESS ); THEN( "The correct in-use number is returned to the client" ) { REQUIRE( dsl_sink_num_in_use_get() == 0 ); REQUIRE( dsl_pipeline_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_component_delete_all() == DSL_RESULT_SUCCESS ); } } } } SCENARIO( "Adding multiple Sinks to multiple Pipelines updates the in-use number", "[sink-api]" ) { GIVEN( "Two new Sinks and two new Pipeline" ) { std::wstring sinkName1 = L"window-sink1"; std::wstring pipelineName1 = L"test-pipeline1"; std::wstring sinkName2 = L"window-sink2"; std::wstring pipelineName2 = L"test-pipeline2"; uint offsetX(0); uint offsetY(0); uint sinkW(1280); uint sinkH(720); REQUIRE( dsl_sink_window_new(sinkName1.c_str(), offsetX, offsetY, sinkW, sinkH) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pipeline_new(pipelineName1.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_sink_window_new(sinkName2.c_str(), offsetX, offsetY, sinkW, sinkH) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pipeline_new(pipelineName2.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_sink_num_in_use_get() == 0 ); WHEN( "Each Sink is added to a different Pipeline" ) { REQUIRE( dsl_pipeline_component_add(pipelineName1.c_str(), sinkName1.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pipeline_component_add(pipelineName2.c_str(), sinkName2.c_str()) == DSL_RESULT_SUCCESS ); THEN( "The correct in-use number is returned to the client" ) { REQUIRE( dsl_sink_num_in_use_get() == 2 ); REQUIRE( dsl_pipeline_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_source_num_in_use_get() == 0 ); REQUIRE( dsl_component_delete_all() == DSL_RESULT_SUCCESS ); } } } } SCENARIO( "Adding greater than max Sinks to all Pipelines fails", "[sink-api]" ) { std::wstring sinkName1 = L"fake-sink1"; std::wstring pipelineName1 = L"test-pipeline1"; std::wstring sinkName2 = L"fake-sink2"; std::wstring pipelineName2 = L"test-pipeline2"; std::wstring sinkName3 = L"fake-sink3"; std::wstring pipelineName3 = L"test-pipeline3"; GIVEN( "Two new Sources and two new Pipeline" ) { REQUIRE( dsl_sink_fake_new(sinkName1.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pipeline_new(pipelineName1.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_sink_fake_new(sinkName2.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pipeline_new(pipelineName2.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_sink_fake_new(sinkName3.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pipeline_new(pipelineName3.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_sink_num_in_use_get() == 0 ); // Reduce the max to less than 3 REQUIRE( dsl_sink_num_in_use_max_set(2) == true ); WHEN( "The max number of sinks are added to Pipelines" ) { REQUIRE( dsl_pipeline_component_add(pipelineName1.c_str(), sinkName1.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pipeline_component_add(pipelineName2.c_str(), sinkName2.c_str()) == DSL_RESULT_SUCCESS ); THEN( "Adding an additional Source to a Pipeline will fail" ) { REQUIRE( dsl_pipeline_component_add(pipelineName3.c_str(), sinkName3.c_str()) == DSL_RESULT_PIPELINE_SINK_MAX_IN_USE_REACHED ); REQUIRE( dsl_pipeline_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_component_delete_all() == DSL_RESULT_SUCCESS ); // restore the default for other scenarios REQUIRE( dsl_sink_num_in_use_max_set(DSL_DEFAULT_SINK_IN_USE_MAX) == true ); REQUIRE( dsl_sink_num_in_use_get() == 0 ); } } } } SCENARIO( "The Sink API checks for NULL input parameters", "[sink-api]" ) { GIVEN( "An empty list of Components" ) { std::wstring sinkName(L"test-sink"); std::wstring otherName(L"other"); uint cache_size(0), width(0), height(0), codec(0), container(0), bitrate(0), interval(0), udpPort(0), rtspPort(0); boolean is_on(0), reset_done(0), sync(0), async(0); std::wstring mailerName(L"mailer"); REQUIRE( dsl_component_list_size() == 0 ); WHEN( "When NULL pointers are used as input" ) { THEN( "The API returns DSL_RESULT_INVALID_INPUT_PARAM in all cases" ) { REQUIRE( dsl_sink_fake_new(NULL) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_sink_overlay_new(NULL, 0, 0, 0, 0, 0, 0 ) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_sink_window_new(NULL, 0, 0, 0, 0 ) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_sink_window_force_aspect_ratio_get(NULL, 0) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_sink_window_force_aspect_ratio_get(sinkName.c_str(), 0) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_sink_window_force_aspect_ratio_set(NULL, 0) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_sink_render_reset(NULL) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_sink_file_new(NULL, NULL, 0, 0, 0, 0 ) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_sink_file_new(sinkName.c_str(), NULL, 0, 0, 0, 0 ) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_sink_record_new(NULL, NULL, 0, 0, 0, 0, NULL ) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_sink_record_new(sinkName.c_str(), NULL, 0, 0, 0, 0, NULL ) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_sink_record_session_start(NULL, 0, 0, NULL) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_sink_record_session_stop(NULL) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_sink_record_cache_size_get(NULL, &cache_size) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_sink_record_cache_size_set(NULL, cache_size) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_sink_record_dimensions_get(NULL, &width, &height) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_sink_record_dimensions_set(NULL, width, height) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_sink_record_is_on_get(NULL, &is_on) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_sink_record_reset_done_get(NULL, &reset_done) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_sink_record_video_player_add(NULL, NULL) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_sink_record_video_player_add(sinkName.c_str(), NULL) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_sink_record_video_player_remove(NULL, NULL) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_sink_record_video_player_remove(sinkName.c_str(), NULL) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_sink_record_mailer_add(NULL, NULL, NULL) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_sink_record_mailer_add(sinkName.c_str(), NULL, NULL) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_sink_record_mailer_add(sinkName.c_str(), mailerName.c_str(), NULL) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_sink_record_mailer_remove(NULL, NULL) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_sink_record_mailer_remove(sinkName.c_str(), NULL) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_sink_encode_video_formats_get(NULL, &codec, &container) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_sink_encode_settings_get(NULL, &bitrate, &interval) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_sink_encode_settings_set(NULL, bitrate, interval) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_sink_rtsp_new(NULL, NULL, 0, 0, 0, 0, 0 ) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_sink_rtsp_new(sinkName.c_str(), NULL, 0, 0, 0, 0, 0 ) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_sink_rtsp_encoder_settings_get(NULL, &bitrate, &interval ) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_sink_rtsp_encoder_settings_set(NULL, bitrate, interval ) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_sink_rtsp_encoder_settings_get(NULL, &bitrate, &interval ) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_sink_rtsp_server_settings_get(NULL, &udpPort, &rtspPort, &codec ) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_sink_pph_add(NULL, NULL ) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_sink_pph_add(sinkName.c_str(), NULL ) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_sink_sync_settings_get(NULL, &sync, &async ) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_sink_sync_settings_set(NULL, sync, async ) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_component_list_size() == 0 ); } } } } <|start_filename|>src/DslOdeAction.h<|end_filename|> /* The MIT License Copyright (c) 2019-2021, Prominence AI, Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in- all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef _DSL_ODE_ACTION_H #define _DSL_ODE_ACTION_H #include "Dsl.h" #include "DslApi.h" #include "DslBase.h" #include "DslSurfaceTransform.h" #include "DslDisplayTypes.h" #include "DslPlayerBintr.h" #include "DslMailer.h" namespace DSL { /** * @brief Constants for indexing "pObjectMeta->misc_obj_info" * Triggers add specific metric data for child Actions to act on. */ #define DSL_OBJECT_INFO_PRIMARY_METRIC 0 #define DSL_OBJECT_INFO_PERSISTENCE 1 /** * @brief Constants for indexing "pFrameMeta->misc_frame_info" * Triggers add specific metric data for child Actions to act on. */ #define DSL_FRAME_INFO_OCCURRENCES 0 /** * @brief convenience macros for shared pointer abstraction */ #define DSL_ODE_ACTION_PTR std::shared_ptr<OdeAction> #define DSL_ODE_ACTION_CUSTOM_PTR std::shared_ptr<CustomOdeAction> #define DSL_ODE_ACTION_CUSTOM_NEW(name, clientHandler, clientData) \ std::shared_ptr<CustomOdeAction>(new CustomOdeAction(name, \ clientHandler, clientData)) #define DSL_ODE_ACTION_CATPURE_PTR std::shared_ptr<CaptureOdeAction> #define DSL_ODE_ACTION_CAPTURE_FRAME_PTR std::shared_ptr<CaptureFrameOdeAction> #define DSL_ODE_ACTION_CAPTURE_FRAME_NEW(name, outdir, annotate) \ std::shared_ptr<CaptureFrameOdeAction>(new CaptureFrameOdeAction( \ name, outdir, annotate)) #define DSL_ODE_ACTION_CAPTURE_OBJECT_PTR std::shared_ptr<CaptureObjectOdeAction> #define DSL_ODE_ACTION_CAPTURE_OBJECT_NEW(name, outdir) \ std::shared_ptr<CaptureObjectOdeAction>(new CaptureObjectOdeAction( \ name, outdir)) #define DSL_ODE_ACTION_CUSTOMIZE_LABEL_PTR std::shared_ptr<CustomizeLabelOdeAction> #define DSL_ODE_ACTION_CUSTOMIZE_LABEL_NEW(name, contentTypes) \ std::shared_ptr<CustomizeLabelOdeAction>(new CustomizeLabelOdeAction( \ name, contentTypes)) #define DSL_ODE_ACTION_DISPLAY_PTR std::shared_ptr<DisplayOdeAction> #define DSL_ODE_ACTION_DISPLAY_NEW(name, \ formatString, offsetX, offsetY, pFont, hasBgColor, pBgColor) \ std::shared_ptr<DisplayOdeAction>(new DisplayOdeAction(name, \ formatString, offsetX, offsetY, pFont, hasBgColor, pBgColor)) #define DSL_ODE_ACTION_DISPLAY_META_ADD_PTR std::shared_ptr<AddDisplayMetaOdeAction> #define DSL_ODE_ACTION_DISPLAY_META_ADD_NEW(name, displayType) \ std::shared_ptr<AddDisplayMetaOdeAction>(new AddDisplayMetaOdeAction( \ name, displayType)) #define DSL_ODE_ACTION_DISABLE_HANDLER_PTR std::shared_ptr<DisableHandlerOdeAction> #define DSL_ODE_ACTION_DISABLE_HANDLER_NEW(name, handler) \ std::shared_ptr<DisableHandlerOdeAction>(new DisableHandlerOdeAction( \ name, handler)) #define DSL_ODE_ACTION_EMAIL_PTR std::shared_ptr<EmailOdeAction> #define DSL_ODE_ACTION_EMAIL_NEW(name, pMailer, subject) \ std::shared_ptr<EmailOdeAction>(new EmailOdeAction(name, pMailer, subject)) #define DSL_ODE_ACTION_FILL_AREA_PTR std::shared_ptr<FillAreaOdeAction> #define DSL_ODE_ACTION_FILL_AREA_NEW(name, area, pColor) \ std::shared_ptr<FillAreaOdeAction>(new FillAreaOdeAction(name, area, pColor)) #define DSL_ODE_ACTION_FILL_FRAME_PTR std::shared_ptr<FillFrameOdeAction> #define DSL_ODE_ACTION_FILL_FRAME_NEW(name, pColor) \ std::shared_ptr<FillFrameOdeAction>(new FillFrameOdeAction(name, pColor)) #define DSL_ODE_ACTION_FILL_SURROUNDINGS_PTR std::shared_ptr<FillSurroundingsOdeAction> #define DSL_ODE_ACTION_FILL_SURROUNDINGS_NEW(name, pColor) \ std::shared_ptr<FillSurroundingsOdeAction>(new FillSurroundingsOdeAction(name, pColor)) #define DSL_ODE_ACTION_FORMAT_BBOX_PTR std::shared_ptr<FormatBBoxOdeAction> #define DSL_ODE_ACTION_FORMAT_BBOX_NEW(name, \ borderWidth, pBorderColor, hasBgColor, pBgColor) \ std::shared_ptr<FormatBBoxOdeAction>(new FormatBBoxOdeAction(name, \ borderWidth, pBorderColor, hasBgColor, pBgColor)) #define DSL_ODE_ACTION_FORMAT_LABEL_PTR std::shared_ptr<FormatLabelOdeAction> #define DSL_ODE_ACTION_FORMAT_LABEL_NEW(name, pFont, hasBgColor, pBgColor) \ std::shared_ptr<FormatLabelOdeAction>(new FormatLabelOdeAction(name, \ pFont, hasBgColor, pBgColor)) #define DSL_ODE_ACTION_LOG_PTR std::shared_ptr<LogOdeAction> #define DSL_ODE_ACTION_LOG_NEW(name) \ std::shared_ptr<LogOdeAction>(new LogOdeAction(name)) #define DSL_ODE_ACTION_PAUSE_PTR std::shared_ptr<PauseOdeAction> #define DSL_ODE_ACTION_PAUSE_NEW(name, pipeline) \ std::shared_ptr<PauseOdeAction>(new PauseOdeAction(name, pipeline)) #define DSL_ODE_ACTION_PRINT_PTR std::shared_ptr<PrintOdeAction> #define DSL_ODE_ACTION_PRINT_NEW(name, forceFlush) \ std::shared_ptr<PrintOdeAction>(new PrintOdeAction(name, forceFlush)) #define DSL_ODE_ACTION_FILE_PTR std::shared_ptr<FileOdeAction> #define DSL_ODE_ACTION_FILE_NEW(name, filePath, mode, format, forceFlush) \ std::shared_ptr<FileOdeAction>(new FileOdeAction(name, \ filePath, mode, format, forceFlush)) #define DSL_ODE_ACTION_REDACT_PTR std::shared_ptr<RedactOdeAction> #define DSL_ODE_ACTION_REDACT_NEW(name) \ std::shared_ptr<RedactOdeAction>(new RedactOdeAction(name)) #define DSL_ODE_ACTION_SINK_ADD_PTR std::shared_ptr<AddSinkOdeAction> #define DSL_ODE_ACTION_SINK_ADD_NEW(name, pipeline, sink) \ std::shared_ptr<AddSinkOdeAction>(new AddSinkOdeAction(name, pipeline, sink)) #define DSL_ODE_ACTION_SINK_REMOVE_PTR std::shared_ptr<RemoveSinkOdeAction> #define DSL_ODE_ACTION_SINK_REMOVE_NEW(name, pipeline, sink) \ std::shared_ptr<RemoveSinkOdeAction>(new RemoveSinkOdeAction(name, pipeline, sink)) #define DSL_ODE_ACTION_SOURCE_ADD_PTR std::shared_ptr<AddSourceOdeAction> #define DSL_ODE_ACTION_SOURCE_ADD_NEW(name, pipeline, source) \ std::shared_ptr<AddSourceOdeAction>(new AddSourceOdeAction(name, pipeline, source)) #define DSL_ODE_ACTION_SOURCE_REMOVE_PTR std::shared_ptr<RemoveSourceOdeAction> #define DSL_ODE_ACTION_SOURCE_REMOVE_NEW(name, pipeline, source) \ std::shared_ptr<RemoveSourceOdeAction>(new RemoveSourceOdeAction(name, pipeline, source)) #define DSL_ODE_ACTION_TRIGGER_DISABLE_PTR std::shared_ptr<DisableTriggerOdeAction> #define DSL_ODE_ACTION_TRIGGER_DISABLE_NEW(name, trigger) \ std::shared_ptr<DisableTriggerOdeAction>(new DisableTriggerOdeAction(name, trigger)) #define DSL_ODE_ACTION_TRIGGER_ENABLE_PTR std::shared_ptr<EnableTriggerOdeAction> #define DSL_ODE_ACTION_TRIGGER_ENABLE_NEW(name, trigger) \ std::shared_ptr<EnableTriggerOdeAction>(new EnableTriggerOdeAction(name, trigger)) #define DSL_ODE_ACTION_TRIGGER_RESET_PTR std::shared_ptr<ResetTriggerOdeAction> #define DSL_ODE_ACTION_TRIGGER_RESET_NEW(name, trigger) \ std::shared_ptr<ResetTriggerOdeAction>(new ResetTriggerOdeAction(name, trigger)) #define DSL_ODE_ACTION_ACTION_DISABLE_PTR std::shared_ptr<DisableActionOdeAction> #define DSL_ODE_ACTION_ACTION_DISABLE_NEW(name, trigger) \ std::shared_ptr<DisableActionOdeAction>(new DisableActionOdeAction(name, trigger)) #define DSL_ODE_ACTION_ACTION_ENABLE_PTR std::shared_ptr<EnableActionOdeAction> #define DSL_ODE_ACTION_ACTION_ENABLE_NEW(name, trigger) \ std::shared_ptr<EnableActionOdeAction>(new EnableActionOdeAction(name, trigger)) #define DSL_ODE_ACTION_AREA_ADD_PTR std::shared_ptr<AddAreaOdeAction> #define DSL_ODE_ACTION_AREA_ADD_NEW(name, trigger, area) \ std::shared_ptr<AddAreaOdeAction>(new AddAreaOdeAction(name, trigger, area)) #define DSL_ODE_ACTION_AREA_REMOVE_PTR std::shared_ptr<RemoveAreaOdeAction> #define DSL_ODE_ACTION_AREA_REMOVE_NEW(name, trigger, area) \ std::shared_ptr<RemoveAreaOdeAction>(new RemoveAreaOdeAction(name, trigger, area)) #define DSL_ODE_ACTION_SINK_RECORD_START_PTR std::shared_ptr<RecordSinkStartOdeAction> #define DSL_ODE_ACTION_SINK_RECORD_START_NEW(name, pRecordSink, start, duration, clientData) \ std::shared_ptr<RecordSinkStartOdeAction>(new RecordSinkStartOdeAction(name, \ pRecordSink, start, duration, clientData)) #define DSL_ODE_ACTION_SINK_RECORD_STOP_PTR std::shared_ptr<RecordSinkStopOdeAction> #define DSL_ODE_ACTION_SINK_RECORD_STOP_NEW(name, pRecordSink) \ std::shared_ptr<RecordSinkStopOdeAction>(new RecordSinkStopOdeAction(name, pRecordSink)) #define DSL_ODE_ACTION_TAP_RECORD_START_PTR std::shared_ptr<RecordTapStartOdeAction> #define DSL_ODE_ACTION_TAP_RECORD_START_NEW(name, pRecordTap, start, duration, clientData) \ std::shared_ptr<RecordTapStartOdeAction>(new RecordTapStartOdeAction(name, \ pRecordTap, start, duration, clientData)) #define DSL_ODE_ACTION_TAP_RECORD_STOP_PTR std::shared_ptr<RecordTapStopOdeAction> #define DSL_ODE_ACTION_TAP_RECORD_STOP_NEW(name, pRecordTap) \ std::shared_ptr<RecordTapStopOdeAction>(new RecordTapStopOdeAction(name, pRecordTap)) #define DSL_ODE_ACTION_TILER_SHOW_SOURCE_PTR std::shared_ptr<TilerShowSourceOdeAction> #define DSL_ODE_ACTION_TILER_SHOW_SOURCE_NEW(name, tiler, timeout, hasPrecedence) \ std::shared_ptr<TilerShowSourceOdeAction>(new TilerShowSourceOdeAction(name, \ tiler, timeout, hasPrecedence)) // ******************************************************************** class OdeAction : public Base { public: /** * @brief ctor for the ODE virtual base class * @param[in] name unique name for the ODE Action */ OdeAction(const char* name); ~OdeAction(); /** * @brief Gets the current Enabled setting, default = true * @return the current Enabled setting */ bool GetEnabled(); /** * @brief Sets the Enabled setting for ODE Action * @param[in] the new value to use */ void SetEnabled(bool enabled); /** * @brief Virtual function to handle the occurrence of an ODE by taking * a specific Action as implemented by the derived class * @param[in] pBuffer pointer to the batched stream buffer that triggered the event * @param[in] pOdeTrigger shared pointer to ODE Trigger that triggered the event * @param[in] pFrameMeta pointer to the Frame Meta data that triggered the event * @param[in] pObjectMeta pointer to Object Meta if Object detection event, * NULL if Frame level absence, total, min, max, etc. events. */ virtual void HandleOccurrence(DSL_BASE_PTR pOdeTrigger, GstBuffer* pBuffer, NvDsDisplayMeta* pDisplayMeta, NvDsFrameMeta* pFrameMeta, NvDsObjectMeta* pObjectMeta) = 0; protected: /** * @brief enabled flag. */ bool m_enabled; std::string Ntp2Str(uint64_t ntp); /** * @brief Mutex to ensure mutual exlusion for propery get/sets */ GMutex m_propertyMutex; }; // ******************************************************************** /** * @class FormatBBoxOdeAction * @brief Format Bounding Box ODE Action class */ class FormatBBoxOdeAction : public OdeAction { public: /** * @brief ctor for the Format BBox ODE Action class * @param[in] name unique name for the ODE Action * @param[in] borderWidth line width for the bounding box rectangle * @param[in] pBorderColor shared pointer to an RGBA Color for the border * @param[in] hasBgColor true to fill the background with an RGBA color * @param[in] pBgColor shared pointer to an RGBA fill color to use if * hasBgColor = true */ FormatBBoxOdeAction(const char* name, uint borderWidth, DSL_RGBA_COLOR_PTR pBorderColor, bool hasBgColor, DSL_RGBA_COLOR_PTR pBgColor); /** * @brief dtor for the ODE Format BBox Action class */ ~FormatBBoxOdeAction(); /** * @brief Handles the ODE occurrence by calling the client handler * @param[in] pBuffer pointer to the batched stream buffer that triggered the event * @param[in] pOdeTrigger shared pointer to ODE Trigger that triggered the event * @param[in] pFrameMeta pointer to the Frame Meta data that triggered the event * @param[in] pObjectMeta pointer to Object Meta if Object detection event, * NULL if Frame level absence, total, min, max, etc. events. */ void HandleOccurrence(DSL_BASE_PTR pOdeTrigger, GstBuffer* pBuffer, NvDsDisplayMeta* pDisplayMeta, NvDsFrameMeta* pFrameMeta, NvDsObjectMeta* pObjectMeta); private: /** * @brief line width to use for the rectengle */ uint m_borderWidth; /** * @brief Color used to Fill the object */ DSL_RGBA_COLOR_PTR m_pBorderColor; /** * @brief true if the object's bounding box is to be filled with color, * false otherwise. */ bool m_hasBgColor; /** * @brief Background color used to Fill the object's bounding box */ DSL_RGBA_COLOR_PTR m_pBgColor; }; // ******************************************************************** /** * @class CustomOdeAction * @brief Custom ODE Action class */ class CustomOdeAction : public OdeAction { public: /** * @brief ctor for the Custom ODE Action class * @param[in] name unique name for the ODE Action * @param[in] clientHandler client callback function to call on ODE * @param[in] clientData opaque pointer to client data t return on callback */ CustomOdeAction(const char* name, dsl_ode_handle_occurrence_cb clientHandler, void* clientData); /** * @brief dtor for the ODE Custom Action class */ ~CustomOdeAction(); /** * @brief Handles the ODE occurrence by calling the client handler * @param[in] pBuffer pointer to the batched stream buffer that triggered the event * @param[in] pOdeTrigger shared pointer to ODE Trigger that triggered the event * @param[in] pFrameMeta pointer to the Frame Meta data that triggered the event * @param[in] pObjectMeta pointer to Object Meta if Object detection event, * NULL if Frame level absence, total, min, max, etc. events. */ void HandleOccurrence(DSL_BASE_PTR pOdeTrigger, GstBuffer* pBuffer, NvDsDisplayMeta* pDisplayMeta, NvDsFrameMeta* pFrameMeta, NvDsObjectMeta* pObjectMeta); private: /** * @brief Client Callback function to call on ODE occurrence */ dsl_ode_handle_occurrence_cb m_clientHandler; /** * @brief pointer to client's data returned on callback */ void* m_clientData; }; // ******************************************************************** /** * @class CaptureOdeAction * @brief ODE Capture Action class */ class CaptureOdeAction : public OdeAction { public: /** * @brief ctor for the Capture ODE Action class * @param[in] name unique name for the ODE Action * @param[in] captureType DSL_CAPTURE_TYPE_OBJECT or DSL_CAPTURE_TYPE_FRAME * @param[in] outdir output directory to write captured image files */ CaptureOdeAction(const char* name, uint captureType, const char* outdir, bool annotate); /** * @brief dtor for the Capture ODE Action class */ ~CaptureOdeAction(); cv::Mat& AnnotateObject(NvDsObjectMeta* pObjectMeta, cv::Mat& bgr_frame); /** * @brief Handles the ODE occurrence by capturing a frame or object image to file * @param[in] pOdeTrigger shared pointer to ODE Type that triggered the event * @param[in] pBuffer pointer to the batched stream buffer that triggered the event * @param[in] pFrameMeta pointer to the Frame Meta data that triggered the event * @param[in] pObjectMeta pointer to Object Meta if Object detection event, * NULL if Frame level absence, total, min, max, etc. events. */ void HandleOccurrence(DSL_BASE_PTR pOdeTrigger, GstBuffer* pBuffer, NvDsDisplayMeta* pDisplayMeta, NvDsFrameMeta* pFrameMeta, NvDsObjectMeta* pObjectMeta); /** * @brief adds a callback to be notified on Image Capture complete callback * @param[in] listener pointer to the client's function to call on capture complete * @param[in] userdata opaque pointer to client data passed into the listener function. * @return true on successfull add, false otherwise */ bool AddCaptureCompleteListener(dsl_capture_complete_listener_cb listener, void* userdata); /** * @brief removes a previously added Image Capture Complete callback * @param[in] listener pointer to the client's function to remove * @return true on successfull remove, false otherwise */ bool RemoveCaptureCompleteListener(dsl_capture_complete_listener_cb listener); /** * @brief adds an Image Player, Render or RTSP type, to this CaptureAction * @param pPlayer shared pointer to an Image Player to add * @return true on successfull add, false otherwise */ bool AddImagePlayer(DSL_PLAYER_BINTR_PTR pPlayer); /** * @brief removes an Image Player, Render or RTSP type, from this CaptureAction * @param pPlayer shared pointer to an Image Player to remove * @return true on successfull remove, false otherwise */ bool RemoveImagePlayer(DSL_PLAYER_BINTR_PTR pPlayer); /** * @brief adds a SMTP Mailer to this CaptureAction * @param[in] pMailer shared pointer to a Mailer to add * @param[in] subject subject line to use for all email * @param[in] attach boolean flag to optionally attach the image file * @return true on successfull add, false otherwise */ bool AddMailer(DSL_MAILER_PTR pMailer, const char* subject, bool attach); /** * @brief removes a SMPT Mailer to this CaptureAction * @param[in] pMailer shared pointer to an Mailer to remove * @return true on successfull remove, false otherwise */ bool RemoveMailer(DSL_MAILER_PTR pMailer); /** * @brief removes all child Mailers, Players, and Listeners from this parent Object */ void RemoveAllChildren(); /** * @brief Queues capture info and starts the Listener notification timer * @param info shared pointer to cv::MAT containing the captured image */ void QueueCapturedImage(std::shared_ptr<cv::Mat> pImageMat); /** * @brief implements a timer callback to complete the capture process * by saving the image to file, notifying all client listeners, and * sending email all in the main loop context. * @return false always to self remove timer once clients have been notified. * Timer/tread will be restarted on next Image Capture */ int CompleteCapture(); protected: /** * @brief static, unique capture id shared by all Capture actions */ static uint64_t s_captureId; /** * @brief either DSL_CAPTURE_TYPE_OBJECT or DSL_CAPTURE_TYPE_FRAME */ uint m_captureType; /** * @brief relative or absolute path to output directory */ std::string m_outdir; /** * @brief annotates the image with bbox and label DSL_CAPTURE_TYPE_FRAME only */ bool m_annotate; /** * @brief mutux to guard the Capture info read/write access. */ GMutex m_captureCompleteMutex; /** * @brief gnome timer Id for the capture complete callback */ uint m_captureCompleteTimerId; /** * @brief map of all currently registered capture-complete-listeners * callback functions mapped with thier user provided data */ std::map<dsl_capture_complete_listener_cb, void*> m_captureCompleteListeners; /** * @brief map of all Image Players to play captured images. */ std::map<std::string, DSL_PLAYER_BINTR_PTR> m_imagePlayers; /** * @brief map of all Mailers to send email. */ std::map<std::string, std::shared_ptr<MailerSpecs>> m_mailers; /** * @brief a queue of captured Images to save to file and notify clients */ std::queue<std::shared_ptr<cv::Mat>> m_imageMats; }; /** * @brief Timer callback handler to complete the capture process * by notifying all listeners and sending email with all mailers. * @param[in] pSource shared pointer to Capture Action to invoke. * @return int true to continue, 0 to self remove */ static int CompleteCaptureHandler(gpointer pAction); // ******************************************************************** /** * @class CaptureFrameOdeAction * @brief ODE Capture Frame Action class */ class CaptureFrameOdeAction : public CaptureOdeAction { public: /** * @brief ctor for the Capture Frame ODE Action class * @param[in] name unique name for the ODE Action * @param[in] outdir output directory to write captured image files * @param[in] annotate adds bbox and label to one or all objects in the frame. * One object in the case of valid pObjectMeta on call to HandleOccurrence */ CaptureFrameOdeAction(const char* name, const char* outdir, bool annotate) : CaptureOdeAction(name, DSL_CAPTURE_TYPE_FRAME, outdir, annotate) {}; }; /** * @class CaptureObjectOdeAction * @brief ODE Capture Object Action class */ class CaptureObjectOdeAction : public CaptureOdeAction { public: /** * @brief ctor for the Capture Frame ODE Action class * @param[in] name unique name for the ODE Action * @param[in] outdir output directory to write captured image files */ CaptureObjectOdeAction(const char* name, const char* outdir) : CaptureOdeAction(name, DSL_CAPTURE_TYPE_OBJECT, outdir, false) {}; }; // ******************************************************************** /** * @class CustomizeLabelOdeAction * @brief Customize Object Labels ODE Action class */ class CustomizeLabelOdeAction : public OdeAction { public: /** * @brief ctor for the Customize Label ODE Action class * @param[in] name unique name for the ODE Action * @param[in] contentTypes NULL terminated list of * DSL_OBJECT_LABEL_<type> values for specific content */ CustomizeLabelOdeAction(const char* name, const std::vector<uint>& contentTypes); /** * @brief dtor for the Customize Label ODE Action class */ ~CustomizeLabelOdeAction(); /** * @brief gets the content types in use by this Customize Label Action * @return vector of DSL_OBJECT_LABEL_<type> values */ const std::vector<uint> Get(); /** * @brief sets the content types for this Customize Label Action to use * @param[in] contentTypes new vector of DSL_OBJECT_LABEL_<type> values to use */ void Set(const std::vector<uint>& contentTypes); /** * @brief Handles the ODE occurrence by customizing the Object's label * @param[in] pOdeTrigger shared pointer to ODE Trigger that triggered the event * @param[in] pBuffer pointer to the batched stream buffer that triggered the event * @param[in] pFrameMeta pointer to the Frame Meta data that triggered the event * @param[in] pObjectMeta pointer to Object Meta if Object detection event, * NULL if Frame level absence, total, min, max, etc. events. */ void HandleOccurrence(DSL_BASE_PTR pOdeTrigger, GstBuffer* pBuffer, NvDsDisplayMeta* pDisplayMeta, NvDsFrameMeta* pFrameMeta, NvDsObjectMeta* pObjectMeta); private: /** * @brief Content types for label customization */ std::vector <uint> m_contentTypes; }; // ******************************************************************** /** * @class DisplayOdeAction * @brief ODE Display Ode Action class */ class DisplayOdeAction : public OdeAction { public: /** * @brief ctor for the Display ODE Action class * @param[in] name unique name for the ODE Action * @param[in] formatString string with format tokens for display * @param[in] offsetX horizontal X-offset for the ODE occurrence * data to display * @param[in] offsetX vertical Y-offset for the ODE occurrence data to display * on ODE class Id if set true * @param[in] pFont shared pointer to an RGBA Font to use for display * @param[in] hasBgColor true to fill the background with an RGBA color * @param[in] pBgColor shared pointer to an RGBA fill color to use if * hasBgColor = true */ DisplayOdeAction(const char* name, const char* formatString, uint offsetX, uint offsetY, DSL_RGBA_FONT_PTR pFont, bool hasBgColor, DSL_RGBA_COLOR_PTR pBgColor); /** * @brief dtor for the Display ODE Action class */ ~DisplayOdeAction(); /** * @brief Handles the ODE occurrence by adding display info * using OSD text overlay * @param[in] pOdeTrigger shared pointer to ODE Trigger that triggered the event * @param[in] pBuffer pointer to the batched stream buffer that triggered the event * @param[in] pFrameMeta pointer to the Frame Meta data that triggered the event * @param[in] pObjectMeta pointer to Object Meta if Object detection event, * NULL if Frame level absence, total, min, max, etc. events. */ void HandleOccurrence(DSL_BASE_PTR pOdeTrigger, GstBuffer* pBuffer, NvDsDisplayMeta* pDisplayMeta, NvDsFrameMeta* pFrameMeta, NvDsObjectMeta* pObjectMeta); private: /** * @brief client defined display string with format tokens */ std::string m_formatString; /** * @brief Horizontal X-offset for the ODE occurrence data to display */ uint m_offsetX; /** * @brief Vertical Y-offset for the ODE occurrence data to display */ uint m_offsetY; /** * @brief Font type to use for the displayed occurrence data. */ DSL_RGBA_FONT_PTR m_pFont; /** * true if the Display text has a background color, false otherwise. */ bool m_hasBgColor; /** * @brief the background color to use for the display text if hasBgColor. */ DSL_RGBA_COLOR_PTR m_pBgColor; }; // ******************************************************************** /** * @class DisableHandlerOdeAction * @brief ODE Disable Handelr ODE Action class */ class DisableHandlerOdeAction : public OdeAction { public: /** * @brief ctor for the Display ODE Action class * @param[in] name unique name for the ODE Action * @param[in] handler unique name for the ODE Handler to disable */ DisableHandlerOdeAction(const char* name, const char* handler); /** * @brief dtor for the Display ODE Action class */ ~DisableHandlerOdeAction(); /** * @brief Handles the ODE occurrence by disabling a named ODE Handler * using OSD text overlay * @param[in] pOdeTrigger shared pointer to ODE Trigger that triggered the event * @param[in] pBuffer pointer to the batched stream buffer that triggered the event * @param[in] pFrameMeta pointer to the Frame Meta data that triggered the event * @param[in] pObjectMeta pointer to Object Meta if Object detection event, * NULL if Frame level absence, total, min, max, etc. events. */ void HandleOccurrence(DSL_BASE_PTR pOdeTrigger, GstBuffer* pBuffer, NvDsDisplayMeta* pDisplayMeta, NvDsFrameMeta* pFrameMeta, NvDsObjectMeta* pObjectMeta); private: /** * @brief Unique name of the ODE handler to disable */ std::string m_handler; }; // ******************************************************************** /** * @class EmailOdeAction * @brief Email ODE Action class */ class EmailOdeAction : public OdeAction { public: /** * @brief ctor for the ODE Fill Action class * @param[in] name unique name for the ODE Action * @param[in] pMailer shared pointer * @param[in] subject line to use in all emails */ EmailOdeAction(const char* name, DSL_BASE_PTR pMailer, const char* subject); /** * @brief dtor for the ODE Display Action class */ ~EmailOdeAction(); /** * @brief Handles the ODE occurrence by queuing and Email with SMTP API * @param[in] pOdeTrigger shared pointer to ODE Trigger that triggered the event * @param[in] pBuffer pointer to the batched stream buffer that triggered the event * @param[in] pFrameMeta pointer to the Frame Meta data that triggered the event * @param[in] pObjectMeta pointer to Object Meta if Object detection event, * NULL if Frame level absence, total, min, max, etc. events. */ void HandleOccurrence(DSL_BASE_PTR pOdeTrigger, GstBuffer* pBuffer, NvDsDisplayMeta* pDisplayMeta, NvDsFrameMeta* pFrameMeta, NvDsObjectMeta* pObjectMeta); private: /** * @bried shared pointer to Mailer object in use by this Action */ DSL_BASE_PTR m_pMailer; /** * @brief Subject line used for all email messages sent by this action */ std::string m_subject; }; // ******************************************************************** /** * @class LogOdeAction * @brief Log Ode Action class */ class LogOdeAction : public OdeAction { public: /** * @brief ctor for the Log ODE Action class * @param[in] name unique name for the ODE Action */ LogOdeAction(const char* name); /** * @brief dtor for the Log ODE Action class */ ~LogOdeAction(); /** * @brief Handles the ODE occurrence by adding/calling LOG_INFO * with the ODE occurrence data data * @param[in] pOdeTrigger shared pointer to ODE Trigger that triggered the event * @param[in] pBuffer pointer to the batched stream buffer that triggered the event * @param[in] pFrameMeta pointer to the Frame Meta data that triggered the event * @param[in] pObjectMeta pointer to Object Meta if Object detection event, * NULL if Frame level absence, total, min, max, etc. events. */ void HandleOccurrence(DSL_BASE_PTR pOdeTrigger, GstBuffer* pBuffer, NvDsDisplayMeta* pDisplayMeta, NvDsFrameMeta* pFrameMeta, NvDsObjectMeta* pObjectMeta); private: }; // ******************************************************************** /** * @class FillFrameOdeAction * @brief Fill ODE Action class */ class FillFrameOdeAction : public OdeAction { public: /** * @brief ctor for the ODE Fill Action class * @param[in] name unique name for the ODE Action * @param[in] pColor shared pointer to an RGBA Color to fill the Frame */ FillFrameOdeAction(const char* name, DSL_RGBA_COLOR_PTR pColor); /** * @brief dtor for the ODE Display Action class */ ~FillFrameOdeAction(); /** * @brief Handles the ODE occurrence by adding a rectangle to Fill the Frame * with a set of RGBA color values * @param[in] pOdeTrigger shared pointer to ODE Trigger that triggered the event * @param[in] pBuffer pointer to the batched stream buffer that triggered the event * @param[in] pFrameMeta pointer to the Frame Meta data that triggered the event * @param[in] pObjectMeta pointer to Object Meta if Object detection event, * NULL if Frame level absence, total, min, max, etc. events. */ void HandleOccurrence(DSL_BASE_PTR pOdeTrigger, GstBuffer* pBuffer, NvDsDisplayMeta* pDisplayMeta, NvDsFrameMeta* pFrameMeta, NvDsObjectMeta* pObjectMeta); private: /** * @brief Background color used to Fill the object */ DSL_RGBA_COLOR_PTR m_pColor; }; // ******************************************************************** /** * @class FillSurroundingOdeAction * @brief Fill Surroundings ODE Action class */ class FillSurroundingsOdeAction : public OdeAction { public: /** * @brief ctor for the ODE Fill Surroundings Action class * @param[in] name unique name for the ODE Action * @param[in] pColor shared pointer to an RGBA Color to fill the Object */ FillSurroundingsOdeAction(const char* name, DSL_RGBA_COLOR_PTR pColor); /** * @brief dtor for the ODE Display Action class */ ~FillSurroundingsOdeAction(); /** * @brief Handles the ODE occurrence by Filling the object's surrounding * using four adjacent rectangles. * @param[in] pOdeTrigger shared pointer to ODE Trigger that triggered the event * @param[in] pBuffer pointer to the batched stream buffer that triggered the event * @param[in] pFrameMeta pointer to the Frame Meta data that triggered the event * @param[in] pObjectMeta pointer to Object Meta if Object detection event, * NULL if Frame level absence, total, min, max, etc. events. */ void HandleOccurrence(DSL_BASE_PTR pOdeTrigger, GstBuffer* pBuffer, NvDsDisplayMeta* pDisplayMeta, NvDsFrameMeta* pFrameMeta, NvDsObjectMeta* pObjectMeta); private: /** * @brief Background color used to Fill everything but the object */ DSL_RGBA_COLOR_PTR m_pColor; }; // ******************************************************************** /** * @class AddDisplayMetaOdeAction * @brief Add Display Meta ODE Action class */ class AddDisplayMetaOdeAction : public OdeAction { public: /** * @brief ctor for the AddDisplayMeta ODE Action class * @param[in] name unique name for the ODE Action * @param[in] shared pointer to the */ AddDisplayMetaOdeAction(const char* name, DSL_DISPLAY_TYPE_PTR pDisplayType); /** * @brief dtor for the AddDisplayMeta ODE Action class */ ~AddDisplayMetaOdeAction(); /** * @brief adds an additional Display Type for adding metadata */ void AddDisplayType(DSL_DISPLAY_TYPE_PTR pDisplayType); /** * @brief Handles the ODE by overlaying the pFrameMeta with the named Display Type * @param[in] pOdeTrigger shared pointer to ODE Trigger that triggered the event * @param[in] pBuffer pointer to the batched stream buffer that triggered the event * @param[in] pFrameMeta pointer to the Frame Meta data that triggered the event * @param[in] pObjectMeta pointer to Object Meta if Object detection event, * NULL if Frame level absence, total, min, max, etc. events. */ void HandleOccurrence(DSL_BASE_PTR pOdeTrigger, GstBuffer* pBuffer, NvDsDisplayMeta* pDisplayMeta, NvDsFrameMeta* pFrameMeta, NvDsObjectMeta* pObjectMeta); private: std::vector<DSL_DISPLAY_TYPE_PTR> m_pDisplayTypes; }; // ******************************************************************** /** * @class FormatLabelOdeAction * @brief Format Object Label ODE Action class */ class FormatLabelOdeAction : public OdeAction { public: /** * @brief ctor for the Format Label ODE Action class * @param[in] name unique name for the ODE Action * @param[in] pFont shared pointer to an RGBA Font for the object's label * @param[in] hasBgColor true to fill the label background with an RGBA color * @param[in] pBgColor shared pointer to an RGBA color to use if * hasBgColor = true */ FormatLabelOdeAction(const char* name, DSL_RGBA_FONT_PTR pFont, bool hasBgColor, DSL_RGBA_COLOR_PTR pBgColor); /** * @brief dtor for the ODE Format Label Action class */ ~FormatLabelOdeAction(); /** * @brief Handles the ODE occurrence by calling the client handler * @param[in] pBuffer pointer to the batched stream buffer that triggered the event * @param[in] pOdeTrigger shared pointer to ODE Trigger that triggered the event * @param[in] pFrameMeta pointer to the Frame Meta data that triggered the event * @param[in] pObjectMeta pointer to Object Meta if Object detection event, * NULL if Frame level absence, total, min, max, etc. events. */ void HandleOccurrence(DSL_BASE_PTR pOdeTrigger, GstBuffer* pBuffer, NvDsDisplayMeta* pDisplayMeta, NvDsFrameMeta* pFrameMeta, NvDsObjectMeta* pObjectMeta); private: /** * @brief Font to use for the object's label */ DSL_RGBA_FONT_PTR m_pFont; /** * @brief true if the object's label is to have a background color, * false otherwise. */ bool m_hasBgColor; /** * @brief Background color used for the object's label */ DSL_RGBA_COLOR_PTR m_pBgColor; }; // ******************************************************************** /** * @class PauseOdeAction * @brief Pause ODE Action class */ class PauseOdeAction : public OdeAction { public: /** * @brief ctor for the Pause ODE Action class * @param[in] name unique name for the ODE Action * @param[in] pipeline unique name of the pipeline to pause on ODE occurrence */ PauseOdeAction(const char* name, const char* pipeline); /** * @brief dtor for the Pause ODE Action class */ ~PauseOdeAction(); /** * @brief Handles the ODE occurrence by pausing a named Pipeline * @param[in] pOdeTrigger shared pointer to ODE Trigger that triggered the event * @param[in] pBuffer pointer to the batched stream buffer that triggered the event * @param[in] pFrameMeta pointer to the Frame Meta data that triggered the event * @param[in] pObjectMeta pointer to Object Meta if Object detection event, * NULL if Frame level absence, total, min, max, etc. events. */ void HandleOccurrence(DSL_BASE_PTR pOdeTrigger, GstBuffer* pBuffer, NvDsDisplayMeta* pDisplayMeta, NvDsFrameMeta* pFrameMeta, NvDsObjectMeta* pObjectMeta); private: std::string m_pipeline; }; // ******************************************************************** /** * @class PrintOdeAction * @brief Print ODE Action class */ class PrintOdeAction : public OdeAction { public: /** * @brief ctor for the ODE Print Action class * @param[in] name unique name for the ODE Action */ PrintOdeAction(const char* name, bool forceFlush); /** * @brief dtor for the Print ODE Action class */ ~PrintOdeAction(); /** * @brief Handles the ODE occurrence by printing the * the occurrence data to the console * @param[in] pOdeTrigger shared pointer to ODE Trigger that triggered the event * @param[in] pBuffer pointer to the batched stream buffer that triggered the event * @param[in] pFrameMeta pointer to the Frame Meta data that triggered the event * @param[in] pObjectMeta pointer to Object Meta if Object detection event, * NULL if Frame level absence, total, min, max, etc. events. */ void HandleOccurrence(DSL_BASE_PTR pOdeTrigger, GstBuffer* pBuffer, NvDsDisplayMeta* pDisplayMeta, NvDsFrameMeta* pFrameMeta, NvDsObjectMeta* pObjectMeta); /** * @brief Flushes the stdout buffer. ** To be called by the idle thread only **. * @return false to unschedule always - single flush operation. */ bool Flush(); private: /** * @brief flag to enable/disable forced stream buffer flushing */ bool m_forceFlush; /** * @brief gnome thread id for the background thread to flush */ uint m_flushThreadFunctionId; /** * @brief mutex to protect mutual access to m_flushThreadFunctionId */ GMutex m_ostreamMutex; }; /** * @brief Idle Thread Function to flush the stdout buffer * @param pAction pointer to the File Action to call flush * @return false to unschedule always */ static gboolean PrintActionFlush(gpointer pAction); // ******************************************************************** /** * @class PrintOdeAction * @brief Print ODE Action class */ class FileOdeAction : public OdeAction { public: /** * @brief ctor for the ODE Print Action class * @param[in] name unique name for the ODE Action */ FileOdeAction(const char* name, const char* filePath, uint mode, uint format, bool forceflush); /** * @brief dtor for the Print ODE Action class */ ~FileOdeAction(); /** * @brief Handles the ODE occurrence by printing the * the occurrence data to the console * @param[in] pOdeTrigger shared pointer to ODE Trigger that triggered the event * @param[in] pBuffer pointer to the batched stream buffer that triggered the event * @param[in] pFrameMeta pointer to the Frame Meta data that triggered the event * @param[in] pObjectMeta pointer to Object Meta if Object detection event, * NULL if Frame level absence, total, min, max, etc. events. */ void HandleOccurrence(DSL_BASE_PTR pOdeTrigger, GstBuffer* pBuffer, NvDsDisplayMeta* pDisplayMeta, NvDsFrameMeta* pFrameMeta, NvDsObjectMeta* pObjectMeta); /** * @brief Flushes the ostream buffer. ** To be called by the idle thread only **. * @return false to unschedule always - single flush operation. */ bool Flush(); private: /** * @brief relative or absolute path to the file to write to */ std::string m_filePath; /** * @brief specifies the file open mode, DSL_WRITE_MODE_APPEND or * DSL_WRITE_MODE_OVERWRITE */ uint m_mode; /** * @brief specifies which data format to use, DSL_EVENT_FILE_FORMAT_TEXT or * DSL_EVENT_FILE_FORMAT_CSV */ uint m_format; /** * @brief output stream for all file writes */ std::fstream m_ostream; /** * @brief flag to enable/disable forced stream buffer flushing */ bool m_forceFlush; /** * @brief gnome thread id for the background thread to flush */ uint m_flushThreadFunctionId; /** * @brief mutex to protect mutual access to comms data */ GMutex m_ostreamMutex; }; /** * @brief Idle Thread Function to flush the ostream buffer * @param pAction pointer to the File Action to call flush * @return false to unschedule always */ static gboolean FileActionFlush(gpointer pAction); // ******************************************************************** /** * @class RedactOdeAction * @brief Redact ODE Action class */ class RedactOdeAction : public OdeAction { public: /** * @brief ctor for the ODE Redact Action class * @param[in] name unique name for the ODE Action */ RedactOdeAction(const char* name); /** * @brief dtor for the ODE Display Action class */ ~RedactOdeAction(); /** * @brief Handles the ODE occurrence by redacting the object * with the boox coordinates in the ODE occurrence data * @param[in] pOdeTrigger shared pointer to ODE Trigger that triggered the event * @param[in] pBuffer pointer to the batched stream buffer that triggered the event * @param[in] pFrameMeta pointer to the Frame Meta data that triggered the event * @param[in] pObjectMeta pointer to Object Meta if Object detection event, * NULL if Frame level absence, total, min, max, etc. events. */ void HandleOccurrence(DSL_BASE_PTR pOdeTrigger, GstBuffer* pBuffer, NvDsDisplayMeta* pDisplayMeta, NvDsFrameMeta* pFrameMeta, NvDsObjectMeta* pObjectMeta); private: }; // ******************************************************************** /** * @class AddSinkOdeAction * @brief Add Sink ODE Action class */ class AddSinkOdeAction : public OdeAction { public: /** * @brief ctor for the Add Sink ODE Action class * @param[in] name unique name for the ODE Action * @param[in] pipeline unique name of the Pipeline to add the Sink to * @param[in] sink unique name of the Sink to add to the Pipeline */ AddSinkOdeAction(const char* name, const char* pipeline, const char* sink); /** * @brief dtor for the Add Sink ODE Action class */ ~AddSinkOdeAction(); /** * @brief Handles the ODE occurrence by adding a named Sink to a named Pipeline * @param[in] pBuffer pointer to the batched stream buffer that triggered the event * @param[in] pOdeTrigger shared pointer to ODE Trigger that triggered the event * @param[in] pFrameMeta pointer to the Frame Meta data that triggered the event * @param[in] pObjectMeta pointer to Object Meta if Object detection event, * NULL if Frame level absence, total, min, max, etc. events. */ void HandleOccurrence(DSL_BASE_PTR pOdeTrigger, GstBuffer* pBuffer, NvDsDisplayMeta* pDisplayMeta, NvDsFrameMeta* pFrameMeta, NvDsObjectMeta* pObjectMeta); private: /** * @brief Pipeline to add the Sink to on ODE occurrence */ std::string m_pipeline; /** * @brief Sink to add to the Pipeline on ODE occurrence */ std::string m_sink; }; // ******************************************************************** /** * @class RemoveSinkOdeAction * @brief Remove Sink ODE Action class */ class RemoveSinkOdeAction : public OdeAction { public: /** * @brief ctor for the Remove Sink ODE Action class * @param[in] name unique name for the ODE Action * @param[in] pipeline unique name of the Pipeline to add the Sink to * @param[in] sink unique name of the Sink to add to the Pipeline */ RemoveSinkOdeAction(const char* name, const char* pipeline, const char* sink); /** * @brief dtor for the Remove Sink ODE Action class */ ~RemoveSinkOdeAction(); /** * @brief Handles the ODE occurrence by removing a named Sink from a named Pipeline * @param[in] pBuffer pointer to the batched stream buffer that triggered the event * @param[in] pOdeTrigger shared pointer to ODE Trigger that triggered the event * @param[in] pFrameMeta pointer to the Frame Meta data that triggered the event * @param[in] pObjectMeta pointer to Object Meta if Object detection event, * NULL if Frame level absence, total, min, max, etc. events. */ void HandleOccurrence(DSL_BASE_PTR pOdeTrigger, GstBuffer* pBuffer, NvDsDisplayMeta* pDisplayMeta, NvDsFrameMeta* pFrameMeta, NvDsObjectMeta* pObjectMeta); private: /** * @brief Pipeline to remove the Sink from on ODE occurrence */ std::string m_pipeline; /** * @brief Sink to from the Pipeline on ODE occurrence */ std::string m_sink; }; // ******************************************************************** /** * @class AddSourceOdeAction * @brief Add Source ODE Action class */ class AddSourceOdeAction : public OdeAction { public: /** * @brief ctor for the Add Source ODE Action class * @param[in] name unique name for the ODE Action * @param[in] pipeline unique name of the Pipeline to add the Source to * @param[in] source unique name of the Source to add to the Pipeline */ AddSourceOdeAction(const char* name, const char* pipeline, const char* source); /** * @brief dtor for the Add Source ODE Action class */ ~AddSourceOdeAction(); /** * @brief Handles the ODE occurrence by adding a named Source to a named Pipeline * @param[in] pBuffer pointer to the batched stream buffer that triggered the event * @param[in] pOdeTrigger shared pointer to ODE Trigger that triggered the event * @param[in] pFrameMeta pointer to the Frame Meta data that triggered the event * @param[in] pObjectMeta pointer to Object Meta if Object detection event, * NULL if Frame level absence, total, min, max, etc. events. */ void HandleOccurrence(DSL_BASE_PTR pOdeTrigger, GstBuffer* pBuffer, NvDsDisplayMeta* pDisplayMeta, NvDsFrameMeta* pFrameMeta, NvDsObjectMeta* pObjectMeta); private: /** * @brief Pipeline to add the Source to on ODE occurrence */ std::string m_pipeline; /** * @brief Source to add to the Pipeline on ODE occurrence */ std::string m_source; }; // ******************************************************************** /** * @class RemoveSourceOdeAction * @brief Remove Source ODE Action class */ class RemoveSourceOdeAction : public OdeAction { public: /** * @brief ctor for the Remove Source ODE Action class * @param[in] name unique name for the ODE Action * @param[in] pipeline unique name of the Pipeline to add the Sink to * @param[in] souce unique name of the Sink to add to the Pipeline */ RemoveSourceOdeAction(const char* name, const char* pipeline, const char* source); /** * @brief dtor for the Remove Source ODE Action class */ ~RemoveSourceOdeAction(); /** * @brief Handles the ODE occurrence by removing a named Soure from a named Pipeline * @param[in] pBuffer pointer to the batched stream buffer that triggered the event * @param[in] pOdeTrigger shared pointer to ODE Trigger that triggered the event * @param[in] pFrameMeta pointer to the Frame Meta data that triggered the event * @param[in] pObjectMeta pointer to Object Meta if Object detection event, * NULL if Frame level absence, total, min, max, etc. events. */ void HandleOccurrence(DSL_BASE_PTR pOdeTrigger, GstBuffer* pBuffer, NvDsDisplayMeta* pDisplayMeta, NvDsFrameMeta* pFrameMeta, NvDsObjectMeta* pObjectMeta); private: /** * @brief Pipeline to remove the source from on ODE occurrence */ std::string m_pipeline; /** * @brief Source to remove from the Pipeline on ODE occurrence */ std::string m_source; }; // ******************************************************************** /** * @class DisableTriggerOdeAction * @brief Disable Trigger ODE Action class */ class DisableTriggerOdeAction : public OdeAction { public: /** * @brief ctor for the Disable Trigger ODE Action class * @param[in] name unique name for the ODE Action * @param[in] trigger ODE Trigger to disable on ODE occurrence */ DisableTriggerOdeAction(const char* name, const char* trigger); /** * @brief dtor for the Disable Trigger ODE Action class */ ~DisableTriggerOdeAction(); /** * @brief Handles the ODE occurrence by disabling a named ODE Trigger * @param[in] pBuffer pointer to the batched stream buffer that triggered the event * @param[in] pOdeTrigger shared pointer to ODE Trigger that triggered the event * @param[in] pFrameMeta pointer to the Frame Meta data that triggered the event * @param[in] pObjectMeta pointer to Object Meta if Object detection event, * NULL if Frame level absence, total, min, max, etc. events. */ void HandleOccurrence(DSL_BASE_PTR pBaseTrigger, GstBuffer* pBuffer, NvDsDisplayMeta* pDisplayMeta, NvDsFrameMeta* pFrameMeta, NvDsObjectMeta* pObjectMeta); private: /** * @brief ODE Trigger to disable on ODE occurrence */ std::string m_trigger; }; // ******************************************************************** /** * @class EnableTriggerOdeAction * @brief Enable Trigger ODE Action class */ class EnableTriggerOdeAction : public OdeAction { public: /** * @brief ctor for the Enable Trigger ODE Action class * @param[in] name unique name for the ODE Action * @param[in] trigger ODE Trigger to disable on ODE occurrence */ EnableTriggerOdeAction(const char* name, const char* trigger); /** * @brief dtor for the Enable Trigger ODE Action class */ ~EnableTriggerOdeAction(); /** * @brief Handles the ODE occurrence by enabling a named ODE Trigger * @param[in] pBuffer pointer to the batched stream buffer that triggered the event * @param[in] pOdeTrigger shared pointer to ODE Trigger that triggered the event * @param[in] pFrameMeta pointer to the Frame Meta data that triggered the event * @param[in] pObjectMeta pointer to Object Meta if Object detection event, * NULL if Frame level absence, total, min, max, etc. events. */ void HandleOccurrence(DSL_BASE_PTR pOdeTrigger, GstBuffer* pBuffer, NvDsDisplayMeta* pDisplayMeta, NvDsFrameMeta* pFrameMeta, NvDsObjectMeta* pObjectMeta); private: /** * @brief ODE Trigger to enable on ODE occurrence */ std::string m_trigger; }; // ******************************************************************** /** * @class ResetTriggerOdeAction * @brief Reset Trigger ODE Action class */ class ResetTriggerOdeAction : public OdeAction { public: /** * @brief ctor for the Reset Trigger ODE Action class * @param[in] name unique name for the ODE Action * @param[in] trigger ODE Trigger to Rest on ODE occurrence */ ResetTriggerOdeAction(const char* name, const char* trigger); /** * @brief dtor for the Reset Trigger ODE Action class */ ~ResetTriggerOdeAction(); /** * @brief Handles the ODE occurrence by reseting a named ODE Trigger * @param[in] pBuffer pointer to the batched stream buffer that triggered the event * @param[in] pOdeTrigger shared pointer to ODE Trigger that triggered the event * @param[in] pFrameMeta pointer to the Frame Meta data that triggered the event * @param[in] pObjectMeta pointer to Object Meta if Object detection event, * NULL if Frame level absence, total, min, max, etc. events. */ void HandleOccurrence(DSL_BASE_PTR pBaseTrigger, GstBuffer* pBuffer, NvDsDisplayMeta* pDisplayMeta, NvDsFrameMeta* pFrameMeta, NvDsObjectMeta* pObjectMeta); private: /** * @brief ODE Trigger to reset on ODE occurrence */ std::string m_trigger; }; // ******************************************************************** /** * @class DisableActionOdeAction * @brief Disable Action ODE Action class */ class DisableActionOdeAction : public OdeAction { public: /** * @brief ctor for the Disable Action ODE Action class * @param[in] name unique name for the ODE Action * @param[in] trigger ODE Trigger to disable on ODE occurrence */ DisableActionOdeAction(const char* name, const char* action); /** * @brief dtor for the Disable Action ODE Action class */ ~DisableActionOdeAction(); /** * @brief Handles the ODE occurrence by disabling a named ODE Action * @param[in] pBuffer pointer to the batched stream buffer that triggered the event * @param[in] pOdeTrigger shared pointer to ODE Trigger that triggered the event * @param[in] pFrameMeta pointer to the Frame Meta data that triggered the event * @param[in] pObjectMeta pointer to Object Meta if Object detection event, * NULL if Frame level absence, total, min, max, etc. events. */ void HandleOccurrence(DSL_BASE_PTR pOdeTrigger, GstBuffer* pBuffer, NvDsDisplayMeta* pDisplayMeta, NvDsFrameMeta* pFrameMeta, NvDsObjectMeta* pObjectMeta); private: /** * @brief ODE Action to disable on ODE occurrence */ std::string m_action; }; // ******************************************************************** /** * @class EnableActionOdeAction * @brief Enable Action ODE Action class */ class EnableActionOdeAction : public OdeAction { public: /** * @brief ctor for the Enable Action ODE Action class * @param[in] name unique name for the ODE Action * @param[in] action ODE Action to enabled on ODE occurrence */ EnableActionOdeAction(const char* name, const char* action); /** * @brief dtor for the Enable Action ODE class */ ~EnableActionOdeAction(); /** * @brief Handles the ODE occurrence by enabling a named ODE Trigger * @param[in] pBuffer pointer to the batched stream buffer that triggered the event * @param[in] pOdeTrigger shared pointer to ODE Trigger that triggered the event * @param[in] pFrameMeta pointer to the Frame Meta data that triggered the event * @param[in] pObjectMeta pointer to Object Meta if Object detection event, * NULL if Frame level absence, total, min, max, etc. events. */ void HandleOccurrence(DSL_BASE_PTR pOdeTrigger, GstBuffer* pBuffer, NvDsDisplayMeta* pDisplayMeta, NvDsFrameMeta* pFrameMeta, NvDsObjectMeta* pObjectMeta); private: /** * @brief ODE Action to enable on ODE occurrence */ std::string m_action; }; // ******************************************************************** /** * @class AddAreaOdeAction * @brief Add Area ODE Action class */ class AddAreaOdeAction : public OdeAction { public: /** * @brief ctor for the Add Area ODE Action class * @param[in] name unique name for the Add Area ODE Action * @param[in] trigger ODE Trigger to add the ODE Area to * @param[in] action ODE Area to add on ODE occurrence */ AddAreaOdeAction(const char* name, const char* trigger, const char* area); /** * @brief dtor for the Add Area ODE Action class */ ~AddAreaOdeAction(); /** * @brief Handles the ODE occurrence by adding an ODE Area to an ODE Trigger * @param[in] pBuffer pointer to the batched stream buffer that triggered the event * @param[in] pOdeTrigger shared pointer to ODE Trigger that triggered the event * @param[in] pFrameMeta pointer to the Frame Meta data that triggered the event * @param[in] pObjectMeta pointer to Object Meta if Object detection event, * NULL if Frame level absence, total, min, max, etc. events. */ void HandleOccurrence(DSL_BASE_PTR pOdeTrigger, GstBuffer* pBuffer, NvDsDisplayMeta* pDisplayMeta, NvDsFrameMeta* pFrameMeta, NvDsObjectMeta* pObjectMeta); private: /** * @brief ODE Trigger to add the ODE Area to */ std::string m_trigger; /** * @brief ODE Area to add to the ODE Trigger on ODE occurrence */ std::string m_area; }; // ******************************************************************** /** * @class RemoveAreaOdeAction * @brief Remove Area ODE Action class */ class RemoveAreaOdeAction : public OdeAction { public: /** * @brief ctor for the Remove Area ODE Action class * @param[in] name unique name for the ODE Action * @param[in] trigger ODE Trigger to add the ODE Area to * @param[in] action ODE Area to add on ODE occurrence */ RemoveAreaOdeAction(const char* name, const char* trigger, const char* area); /** * @brief dtor for the Remove Area ODE Action class */ ~RemoveAreaOdeAction(); /** * @brief Handles the ODE occurrence by removing an ODE Area from an ODE Trigger * @param[in] pBuffer pointer to the batched stream buffer that triggered the event * @param[in] pOdeTrigger shared pointer to ODE Trigger that triggered the event * @param[in] pFrameMeta pointer to the Frame Meta data that triggered the event * @param[in] pObjectMeta pointer to Object Meta if Object detection event, * NULL if Frame level absence, total, min, max, etc. events. */ void HandleOccurrence(DSL_BASE_PTR pOdeTrigger, GstBuffer* pBuffer, NvDsDisplayMeta* pDisplayMeta, NvDsFrameMeta* pFrameMeta, NvDsObjectMeta* pObjectMeta); private: /** * @brief ODE Trigger to remove the ODE Action from */ std::string m_trigger; /** * @brief ODE Area to remove from the ODE Trigger on ODE occurrence */ std::string m_area; }; // ******************************************************************** /** * @class RecordSinkStartOdeAction * @brief Start Record Sink ODE Action class */ class RecordSinkStartOdeAction : public OdeAction { public: /** * @brief ctor for the Start Record Sink ODE Action class * @param[in] name unique name for the ODE Action * @param[in] pRecordSink shared pointer to Record Sink to Start on ODE * @param[in] start time before current time in secs * @param[in] duration for recording unless stopped before completion */ RecordSinkStartOdeAction(const char* name, DSL_BASE_PTR pRecordSink, uint start, uint duration, void* clientData); /** * @brief dtor for the Start Record ODE Action class */ ~RecordSinkStartOdeAction(); /** * @brief Handles the ODE occurrence by Starting a Video Recording Session * @param[in] pBuffer pointer to the batched stream buffer that triggered the event * @param[in] pOdeTrigger shared pointer to ODE Trigger that triggered the event * @param[in] pFrameMeta pointer to the Frame Meta data that triggered the event * @param[in] pObjectMeta pointer to Object Meta if Object detection event, * NULL if Frame level absence, total, min, max, etc. events. */ void HandleOccurrence(DSL_BASE_PTR pOdeTrigger, GstBuffer* pBuffer, NvDsDisplayMeta* pDisplayMeta, NvDsFrameMeta* pFrameMeta, NvDsObjectMeta* pObjectMeta); private: /** * @brief Record Sink to start the recording session */ DSL_BASE_PTR m_pRecordSink; /** * @brief Start time before current time in seconds */ uint m_start; /** * @brief Duration for recording in seconds */ uint m_duration; /** * @brief client Data for client listening for recording session complete/stopped */ void* m_clientData; }; // ******************************************************************** /** * @class RecordSinkStopOdeAction * @brief Stop Record Sink ODE Action class */ class RecordSinkStopOdeAction : public OdeAction { public: /** * @brief ctor for the Stop Record Sink ODE Action class * @param[in] name unique name for the ODE Action * @param[in] pRecordSink shared pointer to a Record Sink to Stop on ODE * @param[in] duration for recording unless stopped before completion */ RecordSinkStopOdeAction(const char* name, DSL_BASE_PTR pRecordSink); /** * @brief dtor for the Stop Record ODE Action class */ ~RecordSinkStopOdeAction(); /** * @brief Handles the ODE occurrence by Stoping a Video Recording Session * @param[in] pBuffer pointer to the batched stream buffer that triggered the event * @param[in] pOdeTrigger shared pointer to ODE Trigger that triggered the event * @param[in] pFrameMeta pointer to the Frame Meta data that triggered the event * @param[in] pObjectMeta pointer to Object Meta if Object detection event, * NULL if Frame level absence, total, min, max, etc. events. */ void HandleOccurrence(DSL_BASE_PTR pOdeTrigger, GstBuffer* pBuffer, NvDsDisplayMeta* pDisplayMeta, NvDsFrameMeta* pFrameMeta, NvDsObjectMeta* pObjectMeta); private: /** * @brief Record Sink to start the recording session */ DSL_BASE_PTR m_pRecordSink; }; // ******************************************************************** /** * @class RecordTapOdeAction * @brief Start Record Tap ODE Action class */ class RecordTapStartOdeAction : public OdeAction { public: /** * @brief ctor for the Start Record Tap ODE Action class * @param[in] name unique name for the ODE Action * @param[in] pRecordTap shared pointer to a Record Tap to Start on ODE * @param[in] start time before current time in seconds * @param[in] duration for recording unless stopped before completion */ RecordTapStartOdeAction(const char* name, DSL_BASE_PTR pRecordTap, uint start, uint duration, void* clientData); /** * @brief dtor for the Start Record ODE Action class */ ~RecordTapStartOdeAction(); /** * @brief Handles the ODE occurrence by Starting a Video Recording Session * @param[in] pBuffer pointer to the batched stream buffer that triggered the event * @param[in] pOdeTrigger shared pointer to ODE Trigger that triggered the event * @param[in] pFrameMeta pointer to the Frame Meta data that triggered the event * @param[in] pObjectMeta pointer to Object Meta if Object detection event, * NULL if Frame level absence, total, min, max, etc. events. */ void HandleOccurrence(DSL_BASE_PTR pOdeTrigger, GstBuffer* pBuffer, NvDsDisplayMeta* pDisplayMeta, NvDsFrameMeta* pFrameMeta, NvDsObjectMeta* pObjectMeta); private: /** * @brief Record Tap to start the recording session */ DSL_BASE_PTR m_pRecordTap; /** * @brief Start time before current time in seconds */ uint m_start; /** * @brief Duration for recording in seconds */ uint m_duration; /** * @brief client Data for client listening for recording session complete/stopped */ void* m_clientData; }; // ******************************************************************** /** * @class RecordTapOdeAction * @brief Stop Record Tap ODE Action class */ class RecordTapStopOdeAction : public OdeAction { public: /** * @brief ctor for the Stop Record Tap ODE Action class * @param[in] name unique name for the ODE Action * @param[in] pRecordSink shared pointer to Record Sink to Stop on ODE * @param[in] start time before current time in secs * @param[in] duration for recording unless stopped before completion */ RecordTapStopOdeAction(const char* name, DSL_BASE_PTR pRecordTap); /** * @brief dtor for the Stop Record ODE Action class */ ~RecordTapStopOdeAction(); /** * @brief Handles the ODE occurrence by Stoping a Video Recording Session * @param[in] pBuffer pointer to the batched stream buffer that triggered the event * @param[in] pOdeTrigger shared pointer to ODE Trigger that triggered the event * @param[in] pFrameMeta pointer to the Frame Meta data that triggered the event * @param[in] pObjectMeta pointer to Object Meta if Object detection event, * NULL if Frame level absence, total, min, max, etc. events. */ void HandleOccurrence(DSL_BASE_PTR pOdeTrigger, GstBuffer* pBuffer, NvDsDisplayMeta* pDisplayMeta, NvDsFrameMeta* pFrameMeta, NvDsObjectMeta* pObjectMeta); private: /** * @brief Record Tap to start the recording session */ DSL_BASE_PTR m_pRecordTap; }; // ******************************************************************** /** * @class TilerShowSourceOdeAction * @brief Tiler Show Source ODE Action class */ class TilerShowSourceOdeAction : public OdeAction { public: /** * @brief ctor for the Tiler Show Source ODE Action class * @param[in] name unique name for the ODE Action * @param[in] tiler name of the tiler to call on to show source on ODE occurrence * @param[in] timeout show source timeout to pass to the Tiler, in units of seconds */ TilerShowSourceOdeAction(const char* name, const char* tiler, uint timeout, bool hasPrecedence); /** * @brief dtor for the Enable Action ODE class */ ~TilerShowSourceOdeAction(); /** * @brief Handles the ODE occurrence by calling a named tiler to show the source for the frame * @param[in] pBuffer pointer to the batched stream buffer that triggered the event * @param[in] pOdeTrigger shared pointer to ODE Trigger that triggered the event * @param[in] pFrameMeta pointer to the Frame Meta data that triggered the event * @param[in] pObjectMeta pointer to Object Meta if Object detection event, * NULL if Frame level absence, total, min, max, etc. events. */ void HandleOccurrence(DSL_BASE_PTR pOdeTrigger, GstBuffer* pBuffer, NvDsDisplayMeta* pDisplayMeta, NvDsFrameMeta* pFrameMeta, NvDsObjectMeta* pObjectMeta); private: /** * @brief Tiler to call to show source on ODE occurrence */ std::string m_tiler; /** * @brief show source timeout to pass to the Tiler in units of seconds */ uint m_timeout; /** * @brief if true, the show source action will take precedence over a currently shown single source */ bool m_hasPrecedence; }; } #endif // _DSL_ODE_ACTION_H <|start_filename|>examples/cpp/player_play_all_mp4_files_found.cpp<|end_filename|> #include <iostream> #include <experimental/filesystem> #include <sstream> #include <fstream> #include <dirent.h> #include <regex> #include "DslApi.h" // set path to your video files std::string dir_path = "/root/Videos"; // Find all files in the given path that have the given extension std::vector<std::string> FindAllFiles(std::string path, std::string type){ DIR *dir; struct dirent *ent; std::vector<std::string> FileList; if ((dir = opendir (path.c_str())) != NULL) { //Examine all files in this directory while ((ent = readdir (dir)) != NULL) { std::string filename = std::string(ent->d_name); bool dotFound = false; int extNdx = -1; int leng = 0; if(filename.size()>3){ for(int i = (int)filename.size() - 1; i>0; --i){ if(filename[i] == '.'){ extNdx = i + 1; dotFound = true; break; } leng++; } } if(dotFound) { std::string ext = filename.substr(extNdx,leng); if(ext == type){ //store this file if it's correct type FileList.push_back(filename); } } } closedir (dir); } else { //Couldn't open dir std::cerr << "Could not open directory: " << path << "\n"; } return FileList; } // ## // # Function to be called on Player termination event // ## void player_termination_event_listener(void* client_data) { std::cout << "player termination event" << std::endl; dsl_main_loop_quit(); } // ## // # Function to be called on XWindow KeyRelease event // ## void xwindow_key_event_handler(const wchar_t* in_key, void* client_data) { std::wstring wkey(in_key); std::string key(wkey.begin(), wkey.end()); std::cout << "key released = " << key << std::endl; key = std::toupper(key[0]); if(key == "P"){ dsl_player_pause(L"player"); } else if (key == "R"){ dsl_player_play(L"player"); } else if (key == "N"){ dsl_player_render_next(L"player"); } else if (key == "Q"){ dsl_main_loop_quit(); } } int main(int argc, char** argv) { DslReturnType retval; std::vector<std::string> mp4files = FindAllFiles(dir_path, "mp4"); for(auto& file:mp4files){ file = dir_path + "/" + file; } while(true) { for(auto& file:mp4files){ std::wstring wfile(file.begin(), file.end()); // # create the Player on first file found if (!dsl_player_exists(L"player")){ // # New Video Render Player to play all the MP4 files found retval = dsl_player_render_video_new(L"player", wfile.c_str(), DSL_RENDER_TYPE_WINDOW, 0, 0, 50, false); if (retval != DSL_RESULT_SUCCESS) break; } else { retval = dsl_player_render_file_path_queue(L"player", wfile.c_str()); } } // # Add the Termination listener callback to the Player retval = dsl_player_termination_event_listener_add(L"player", player_termination_event_listener, nullptr); if (retval != DSL_RESULT_SUCCESS) break; retval = dsl_player_xwindow_key_event_handler_add(L"player", xwindow_key_event_handler, nullptr); if (retval != DSL_RESULT_SUCCESS) break; // # Play the Player until end-of-stream (EOS) retval = dsl_player_play(L"player"); if (retval != DSL_RESULT_SUCCESS) break; dsl_main_loop_run(); retval = DSL_RESULT_SUCCESS; break; } // # Print out the final result std::cout << dsl_return_value_to_string(retval) << std::endl; // # Cleanup all DSL/GST resources dsl_delete_all(); std::cout<<"Goodbye!"<<std::endl; return 0; } <|start_filename|>test/api/DslPipelineSourcesApiTest.cpp<|end_filename|> /* The MIT License Copyright (c) 2019-2021, Prominence AI, Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in- all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "catch.hpp" #include "Dsl.h" #include "DslApi.h" #define TIME_TO_SLEEP_FOR std::chrono::milliseconds(400) // --------------------------------------------------------------------------- // Shared Test Inputs static const std::wstring sourceName1(L"test-uri-source-1"); static const std::wstring sourceName2(L"test-uri-source-2"); static const std::wstring sourceName3(L"test-uri-source-3"); static const std::wstring sourceName4(L"test-uri-source-4"); static const std::wstring uri(L"./test/streams/sample_1080p_h264.mp4"); static const uint cudadecMemType(DSL_CUDADEC_MEMTYPE_DEVICE); static const uint intrDecode(false); static const uint dropFrameInterval(0); static const std::wstring tilerName(L"tiler"); static const uint width(1280); static const uint height(720); static const std::wstring windowSinkName(L"window-sink"); static const uint offsetX(0); static const uint offsetY(0); static const uint sinkW(1280); static const uint sinkH(720); static const std::wstring pipelineName(L"test-pipeline"); SCENARIO( "A new Pipeline with four URI Sources can Play", "[PipelineSources]" ) { GIVEN( "A Pipeline with four sources and minimal components" ) { REQUIRE( dsl_component_list_size() == 0 ); REQUIRE( dsl_source_uri_new(sourceName1.c_str(), uri.c_str(), cudadecMemType, intrDecode, false, dropFrameInterval) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_source_uri_new(sourceName2.c_str(), uri.c_str(), cudadecMemType, intrDecode, false, dropFrameInterval) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_source_uri_new(sourceName3.c_str(), uri.c_str(), cudadecMemType, intrDecode, false, dropFrameInterval) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_source_uri_new(sourceName4.c_str(), uri.c_str(), cudadecMemType, intrDecode, false, dropFrameInterval) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_tiler_new(tilerName.c_str(), width, height) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_sink_window_new(windowSinkName.c_str(), offsetX, offsetY, sinkW, sinkH) == DSL_RESULT_SUCCESS ); const wchar_t* components[] = {L"test-uri-source-1", L"test-uri-source-2", L"test-uri-source-3", L"test-uri-source-4", L"tiler", L"window-sink", NULL}; WHEN( "When the Pipeline is Assembled and Played" ) { REQUIRE( dsl_pipeline_new(pipelineName.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pipeline_component_add_many(pipelineName.c_str(), components) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pipeline_play(pipelineName.c_str()) == DSL_RESULT_SUCCESS ); std::this_thread::sleep_for(TIME_TO_SLEEP_FOR); THEN( "The Pipeline can be Stopped and Disassembled" ) { REQUIRE( dsl_pipeline_stop(pipelineName.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pipeline_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_component_delete_all() == DSL_RESULT_SUCCESS ); } } } } SCENARIO( "A new Pipeline with four URI Sources can Pause and Play", "[PipelineSources]" ) { GIVEN( "A Pipeline with four sources and minimal components" ) { std::wstring pipelineName = L"test-pipeline"; REQUIRE( dsl_component_list_size() == 0 ); REQUIRE( dsl_source_uri_new(sourceName1.c_str(), uri.c_str(), cudadecMemType, intrDecode, false, dropFrameInterval) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_source_uri_new(sourceName2.c_str(), uri.c_str(), cudadecMemType, intrDecode, false, dropFrameInterval) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_source_uri_new(sourceName3.c_str(), uri.c_str(), cudadecMemType, intrDecode, false, dropFrameInterval) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_source_uri_new(sourceName4.c_str(), uri.c_str(), cudadecMemType, intrDecode, false, dropFrameInterval) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_tiler_new(tilerName.c_str(), width, height) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_sink_window_new(windowSinkName.c_str(), offsetX, offsetY, sinkW, sinkH) == DSL_RESULT_SUCCESS ); const wchar_t* components[] = {L"test-uri-source-1", L"test-uri-source-2", L"test-uri-source-3", L"test-uri-source-4", L"tiler", L"window-sink", NULL}; WHEN( "When the Pipeline is Played and then Paused" ) { REQUIRE( dsl_pipeline_new(pipelineName.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pipeline_component_add_many(pipelineName.c_str(), components) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pipeline_play(pipelineName.c_str()) == DSL_RESULT_SUCCESS ); std::this_thread::sleep_for(TIME_TO_SLEEP_FOR); REQUIRE( dsl_pipeline_pause(pipelineName.c_str()) == DSL_RESULT_SUCCESS ); std::this_thread::sleep_for(TIME_TO_SLEEP_FOR); THEN( "The Pipeline can be Played, Stopped, and Disassembled" ) { REQUIRE( dsl_pipeline_play(pipelineName.c_str()) == DSL_RESULT_SUCCESS ); std::this_thread::sleep_for(TIME_TO_SLEEP_FOR); REQUIRE( dsl_pipeline_stop(pipelineName.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pipeline_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_component_delete_all() == DSL_RESULT_SUCCESS ); } } } } SCENARIO( "A new Pipeline with four URI Sources can Stop and Play", "[PipelineSources]" ) { GIVEN( "A Pipeline with four sources and minimal components" ) { REQUIRE( dsl_component_list_size() == 0 ); REQUIRE( dsl_source_uri_new(sourceName1.c_str(), uri.c_str(), cudadecMemType, intrDecode, false, dropFrameInterval) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_source_uri_new(sourceName2.c_str(), uri.c_str(), cudadecMemType, intrDecode, false, dropFrameInterval) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_source_uri_new(sourceName3.c_str(), uri.c_str(), cudadecMemType, intrDecode, false, dropFrameInterval) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_source_uri_new(sourceName4.c_str(), uri.c_str(), cudadecMemType, intrDecode, false, dropFrameInterval) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_tiler_new(tilerName.c_str(), width, height) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_sink_window_new(windowSinkName.c_str(), offsetX, offsetY, sinkW, sinkH) == DSL_RESULT_SUCCESS ); const wchar_t* components[] = {L"test-uri-source-1", L"test-uri-source-2", L"test-uri-source-3", L"test-uri-source-4", L"tiler", L"window-sink", NULL}; WHEN( "When the Pipeline is Played and then Paused" ) { REQUIRE( dsl_pipeline_new(pipelineName.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pipeline_component_add_many(pipelineName.c_str(), components) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pipeline_play(pipelineName.c_str()) == DSL_RESULT_SUCCESS ); std::this_thread::sleep_for(TIME_TO_SLEEP_FOR); REQUIRE( dsl_pipeline_stop(pipelineName.c_str()) == DSL_RESULT_SUCCESS ); std::this_thread::sleep_for(TIME_TO_SLEEP_FOR); THEN( "The Pipeline can be Played, Stopped, and Disassembled" ) { REQUIRE( dsl_pipeline_play(pipelineName.c_str()) == DSL_RESULT_SUCCESS ); std::this_thread::sleep_for(TIME_TO_SLEEP_FOR); REQUIRE( dsl_pipeline_stop(pipelineName.c_str()) == DSL_RESULT_SUCCESS ); std::this_thread::sleep_for(TIME_TO_SLEEP_FOR); REQUIRE( dsl_pipeline_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_component_delete_all() == DSL_RESULT_SUCCESS ); } } } } SCENARIO( "A single Source of a multi-source Pipeline can Pause and Resume", "[PipelineSources]" ) { GIVEN( "A Pipeline with four sources and minimal components" ) { REQUIRE( dsl_component_list_size() == 0 ); REQUIRE( dsl_source_uri_new(sourceName1.c_str(), uri.c_str(), cudadecMemType, intrDecode, false, dropFrameInterval) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_source_uri_new(sourceName2.c_str(), uri.c_str(), cudadecMemType, intrDecode, false, dropFrameInterval) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_source_uri_new(sourceName3.c_str(), uri.c_str(), cudadecMemType, intrDecode, false, dropFrameInterval) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_source_uri_new(sourceName4.c_str(), uri.c_str(), cudadecMemType, intrDecode, false, dropFrameInterval) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_tiler_new(tilerName.c_str(), width, height) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_sink_window_new(windowSinkName.c_str(), offsetX, offsetY, sinkW, sinkH) == DSL_RESULT_SUCCESS ); const wchar_t* components[] = {L"test-uri-source-1", L"test-uri-source-2", L"test-uri-source-3", L"test-uri-source-4", L"tiler", L"window-sink", NULL}; WHEN( "When the Pipeline is Assembled and Played" ) { REQUIRE( dsl_pipeline_new(pipelineName.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pipeline_component_add_many(pipelineName.c_str(), components) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pipeline_play(pipelineName.c_str()) == DSL_RESULT_SUCCESS ); std::this_thread::sleep_for(TIME_TO_SLEEP_FOR); THEN( "A single Source can be Paused and Resumed" ) { REQUIRE( dsl_source_pause(sourceName1.c_str()) == DSL_RESULT_SUCCESS ); std::this_thread::sleep_for(TIME_TO_SLEEP_FOR); REQUIRE( dsl_source_resume(sourceName1.c_str()) == DSL_RESULT_SUCCESS ); std::this_thread::sleep_for(TIME_TO_SLEEP_FOR); REQUIRE( dsl_source_pause(sourceName2.c_str()) == DSL_RESULT_SUCCESS ); std::this_thread::sleep_for(TIME_TO_SLEEP_FOR); REQUIRE( dsl_source_resume(sourceName2.c_str()) == DSL_RESULT_SUCCESS ); std::this_thread::sleep_for(TIME_TO_SLEEP_FOR); REQUIRE( dsl_source_pause(sourceName3.c_str()) == DSL_RESULT_SUCCESS ); std::this_thread::sleep_for(TIME_TO_SLEEP_FOR); REQUIRE( dsl_source_resume(sourceName3.c_str()) == DSL_RESULT_SUCCESS ); std::this_thread::sleep_for(TIME_TO_SLEEP_FOR); REQUIRE( dsl_source_pause(sourceName4.c_str()) == DSL_RESULT_SUCCESS ); std::this_thread::sleep_for(TIME_TO_SLEEP_FOR); REQUIRE( dsl_source_resume(sourceName4.c_str()) == DSL_RESULT_SUCCESS ); std::this_thread::sleep_for(TIME_TO_SLEEP_FOR); REQUIRE( dsl_pipeline_stop(pipelineName.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pipeline_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_component_delete_all() == DSL_RESULT_SUCCESS ); } } } } <|start_filename|>test/api/DslOdeBehaviorTest.cpp<|end_filename|> /* The MIT License Copyright (c) 2019-2021, Prominence AI, Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in- all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "catch.hpp" #include "Dsl.h" #include "DslApi.h" // --------------------------------------------------------------------------- // Shared Test Inputs static const std::wstring source_name(L"uri-source"); static const std::wstring uri(L"./test/streams/sample_1080p_h264.mp4"); static const uint cudadec_mem_type(DSL_CUDADEC_MEMTYPE_DEVICE); static const uint intr_decode(false); static const uint drop_frame_interval(0); static const std::wstring primary_gie_name(L"primary-gie"); static const std::wstring infer_config_file(L"./test/configs/config_infer_primary_nano.txt"); static const std::wstring model_engine_file(L"./test/models/Primary_Detector_Nano/resnet10.caffemodel_b8_gpu0_fp16.engine"); static const std::wstring tracker_name(L"ktl-tracker"); static const uint tracker_width(480); static const uint tracker_height(272); static const std::wstring tiler_name(L"tiler"); static const uint width(1280); static const uint height(720); static const std::wstring osd_name(L"osd"); static const boolean text_enabled(true); static const boolean clock_enabled(false); static const std::wstring ode_pph_name(L"ode-handler"); static const std::wstring window_sink_name(L"window-sink"); static const uint offsetX(100); static const uint offsetY(140); static const uint sinkW(1280); static const uint sinkH(720); static const std::wstring pipeline_name(L"test-pipeline"); static const std::wstring ode_trigger_name(L"occurrence"); static const uint class_id(0); static const uint limit_10(10); static const std::wstring ode_action_name(L"print"); static const std::wstring vehicle_occurrence_name(L"vehicle-occurence"); static const std::wstring first_vehicle_occurrence_name(L"first-vehicle-occurrence"); static const std::wstring vehicle_summation_name(L"vehicle-summation"); static const std::wstring vehicle_accumulation_name(L"vehicle-accumulation"); static const uint vehicle_class_id(0); static const std::wstring bicycle_occurrence_name(L"Bicycle"); static const std::wstring first_bycle_occurrence_name(L"first-bicycle-occurrence"); static const std::wstring bicycle_summation_name(L"bicycle-summation"); static const std::wstring bicycle_accumulation_name(L"bicycle-accumulation"); static const uint bicycle_class_id(1); static const std::wstring person_occurrence_name(L"person-occurrence"); static const std::wstring first_person_occurrence_name(L"first-person-occurrence"); static const std::wstring person_summation_name(L"person-summation"); static const std::wstring person_accumulation_name(L"person-accumulation"); static const uint person_class_id(2); static const std::wstring roadsign_occurrence_name(L"roadsign-occurrence"); static const std::wstring first_roadsign_occurrence_name(L"first-roadsign-occurrence"); static const std::wstring roadsign_summation_name(L"roadsign-summation"); static const std::wstring roadsign_accumulation_name(L"roadsign-accumulation"); static const uint roadsign_class_id(3); std::wstring vehicle_string(L"Vehicle count: %6"); std::wstring bycle_string(L"Bycle count: %6"); std::wstring person_string(L"Person count: %6"); std::wstring roadsign_string(L"Roadsign count: %6"); std::wstring vehicle_display_action(L"vehicle-display-action"); std::wstring bycle_display_action(L"bycle-display-action"); std::wstring person_display_action(L"person-display-action"); std::wstring roadsign_display_action(L"roadsign-display-action"); static const std::wstring light_red(L"light-red"); static const std::wstring full_white(L"full-white"); static const std::wstring light_white(L"light-white"); static const std::wstring full_black(L"full-black"); static const std::wstring font(L"arial"); static const std::wstring font_name(L"arial-14"); static const uint size(14); #define TIME_TO_SLEEP_FOR std::chrono::milliseconds(2000) // --------------------------------------------------------------------------- SCENARIO( "A new Pipeline with an ODE Handler without any child ODE Triggers can play", "[ode-behavior]" ) { GIVEN( "A Pipeline, URI source, KTL Tracker, Primary GIE, Tiled Display, ODE Hander, and Overlay Sink" ) { REQUIRE( dsl_component_list_size() == 0 ); REQUIRE( dsl_source_uri_new(source_name.c_str(), uri.c_str(), cudadec_mem_type, false, intr_decode, drop_frame_interval) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_infer_gie_primary_new(primary_gie_name.c_str(), infer_config_file.c_str(), model_engine_file.c_str(), 0) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_tracker_ktl_new(tracker_name.c_str(), tracker_width, tracker_height) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_tiler_new(tiler_name.c_str(), width, height) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pph_ode_new(ode_pph_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_tiler_pph_add(tiler_name.c_str(), ode_pph_name.c_str(), DSL_PAD_SRC) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_sink_window_new(window_sink_name.c_str(), offsetX, offsetY, sinkW, sinkH) == DSL_RESULT_SUCCESS ); const wchar_t* components[] = {L"uri-source", L"primary-gie", L"ktl-tracker", L"tiler", L"window-sink", NULL}; WHEN( "When the Pipeline is Assembled" ) { REQUIRE( dsl_pipeline_new(pipeline_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pipeline_component_add_many(pipeline_name.c_str(), components) == DSL_RESULT_SUCCESS ); THEN( "Pipeline is Able to LinkAll and Play" ) { REQUIRE( dsl_pipeline_play(pipeline_name.c_str()) == DSL_RESULT_SUCCESS ); std::this_thread::sleep_for(TIME_TO_SLEEP_FOR); REQUIRE( dsl_pipeline_stop(pipeline_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pipeline_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pipeline_list_size() == 0 ); REQUIRE( dsl_component_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_component_list_size() == 0 ); REQUIRE( dsl_pph_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pph_list_size() == 0 ); REQUIRE( dsl_ode_trigger_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_list_size() == 0 ); REQUIRE( dsl_ode_action_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_list_size() == 0 ); } } } } SCENARIO( "A new Pipeline with an ODE Handler, Occurrence ODE Trigger, and Print ODE Action can play", "[ode-behavior]" ) { GIVEN( "A Pipeline, ODE Handler, Occurrence ODE Trigger, and Print ODE Action" ) { REQUIRE( dsl_component_list_size() == 0 ); REQUIRE( dsl_source_uri_new(source_name.c_str(), uri.c_str(), cudadec_mem_type, false, intr_decode, drop_frame_interval) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_infer_gie_primary_new(primary_gie_name.c_str(), infer_config_file.c_str(), model_engine_file.c_str(), 0) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_tracker_ktl_new(tracker_name.c_str(), tracker_width, tracker_height) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_tiler_new(tiler_name.c_str(), width, height) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pph_ode_new(ode_pph_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_tiler_pph_add(tiler_name.c_str(), ode_pph_name.c_str(), DSL_PAD_SRC) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_occurrence_new(ode_trigger_name.c_str(), NULL, class_id, limit_10) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_print_new(ode_action_name.c_str(), false) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_action_add(ode_trigger_name.c_str(), ode_action_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pph_ode_trigger_add(ode_pph_name.c_str(), ode_trigger_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_sink_window_new(window_sink_name.c_str(), offsetX, offsetY, sinkW, sinkH) == DSL_RESULT_SUCCESS ); const wchar_t* components[] = {L"uri-source", L"primary-gie", L"ktl-tracker", L"tiler", L"window-sink", NULL}; WHEN( "When the Pipeline is Assembled" ) { REQUIRE( dsl_pipeline_new(pipeline_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pipeline_component_add_many(pipeline_name.c_str(), components) == DSL_RESULT_SUCCESS ); THEN( "Pipeline is Able to LinkAll and Play" ) { REQUIRE( dsl_pipeline_play(pipeline_name.c_str()) == DSL_RESULT_SUCCESS ); std::this_thread::sleep_for(TIME_TO_SLEEP_FOR); REQUIRE( dsl_pipeline_stop(pipeline_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pipeline_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pipeline_list_size() == 0 ); REQUIRE( dsl_component_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_component_list_size() == 0 ); REQUIRE( dsl_pph_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pph_list_size() == 0 ); REQUIRE( dsl_ode_trigger_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_list_size() == 0 ); REQUIRE( dsl_ode_action_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_list_size() == 0 ); } } } } SCENARIO( "A new Pipeline with an ODE Handler, Two Occurrence ODE Triggers, each with Redact ODE Actions can play", "[ode-behavior]" ) { GIVEN( "A Pipeline, ODE Handler, Occurrence ODE Trigger, and Print ODE Action" ) { std::wstring odeRedactActionName(L"redact"); REQUIRE( dsl_component_list_size() == 0 ); REQUIRE( dsl_source_uri_new(source_name.c_str(), uri.c_str(), cudadec_mem_type, false, intr_decode, drop_frame_interval) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_infer_gie_primary_new(primary_gie_name.c_str(), infer_config_file.c_str(), model_engine_file.c_str(), 0) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_tracker_ktl_new(tracker_name.c_str(), tracker_width, tracker_height) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_tiler_new(tiler_name.c_str(), width, height) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pph_ode_new(ode_pph_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_tiler_pph_add(tiler_name.c_str(), ode_pph_name.c_str(), DSL_PAD_SRC) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_occurrence_new(vehicle_occurrence_name.c_str(), NULL, vehicle_class_id, DSL_ODE_TRIGGER_LIMIT_NONE) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_occurrence_new(person_occurrence_name.c_str(), NULL, person_class_id, DSL_ODE_TRIGGER_LIMIT_NONE) == DSL_RESULT_SUCCESS ); // shared redaction action REQUIRE( dsl_ode_action_redact_new(odeRedactActionName.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_action_add(vehicle_occurrence_name.c_str(), odeRedactActionName.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_action_add(person_occurrence_name.c_str(), odeRedactActionName.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pph_ode_trigger_add(ode_pph_name.c_str(), vehicle_occurrence_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pph_ode_trigger_add(ode_pph_name.c_str(), person_occurrence_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_osd_new(osd_name.c_str(), text_enabled, clock_enabled) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_sink_window_new(window_sink_name.c_str(), offsetX, offsetY, sinkW, sinkH) == DSL_RESULT_SUCCESS ); const wchar_t* components[] = {L"uri-source", L"primary-gie", L"ktl-tracker", L"tiler", L"osd", L"window-sink", NULL}; WHEN( "When the Pipeline is Assembled" ) { REQUIRE( dsl_pipeline_new(pipeline_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pipeline_component_add_many(pipeline_name.c_str(), components) == DSL_RESULT_SUCCESS ); THEN( "The Pipeline is Able to LinkAll and Play" ) { REQUIRE( dsl_pipeline_play(pipeline_name.c_str()) == DSL_RESULT_SUCCESS ); std::this_thread::sleep_for(TIME_TO_SLEEP_FOR); REQUIRE( dsl_pipeline_stop(pipeline_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pipeline_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pipeline_list_size() == 0 ); REQUIRE( dsl_component_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_component_list_size() == 0 ); REQUIRE( dsl_pph_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pph_list_size() == 0 ); REQUIRE( dsl_ode_trigger_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_list_size() == 0 ); REQUIRE( dsl_ode_action_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_list_size() == 0 ); } } } } SCENARIO( "A new Pipeline with an ODE Handler, Two Occurrence ODE Triggers sharing a Capture ODE Action can play", "[ode-behavior]" ) { GIVEN( "A Pipeline, ODE Handler, Occurrence ODE Trigger, and Capture ODE Action" ) { std::wstring captureActionName(L"capture-action"); std::wstring outdir(L"./"); REQUIRE( dsl_component_list_size() == 0 ); REQUIRE( dsl_source_uri_new(source_name.c_str(), uri.c_str(), cudadec_mem_type, false, intr_decode, drop_frame_interval) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_infer_gie_primary_new(primary_gie_name.c_str(), infer_config_file.c_str(), model_engine_file.c_str(), 0) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_tracker_ktl_new(tracker_name.c_str(), tracker_width, tracker_height) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_tiler_new(tiler_name.c_str(), width, height) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pph_ode_new(ode_pph_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_tiler_pph_add(tiler_name.c_str(), ode_pph_name.c_str(), DSL_PAD_SRC) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_occurrence_new(first_vehicle_occurrence_name.c_str(), NULL, vehicle_class_id, DSL_ODE_TRIGGER_LIMIT_ONE) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_occurrence_new(first_person_occurrence_name.c_str(), NULL, person_class_id, DSL_ODE_TRIGGER_LIMIT_ONE) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_capture_object_new(captureActionName.c_str(), outdir.c_str()) == DSL_RESULT_SUCCESS ); // Add the same capture Action to both ODE Triggers REQUIRE( dsl_ode_trigger_action_add(first_vehicle_occurrence_name.c_str(), captureActionName.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_action_add(first_person_occurrence_name.c_str(), captureActionName.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pph_ode_trigger_add(ode_pph_name.c_str(), first_vehicle_occurrence_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pph_ode_trigger_add(ode_pph_name.c_str(), first_person_occurrence_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_sink_window_new(window_sink_name.c_str(), offsetX, offsetY, sinkW, sinkH) == DSL_RESULT_SUCCESS ); const wchar_t* components[] = {L"uri-source", L"primary-gie", L"ktl-tracker", L"tiler", L"window-sink", NULL}; WHEN( "When the Pipeline is Assembled" ) { REQUIRE( dsl_pipeline_new(pipeline_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pipeline_component_add_many(pipeline_name.c_str(), components) == DSL_RESULT_SUCCESS ); THEN( "Pipeline is Able to LinkAll and Play" ) { REQUIRE( dsl_pipeline_play(pipeline_name.c_str()) == DSL_RESULT_SUCCESS ); std::this_thread::sleep_for(TIME_TO_SLEEP_FOR); REQUIRE( dsl_pipeline_stop(pipeline_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pipeline_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pipeline_list_size() == 0 ); REQUIRE( dsl_component_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_component_list_size() == 0 ); REQUIRE( dsl_pph_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pph_list_size() == 0 ); REQUIRE( dsl_ode_trigger_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_list_size() == 0 ); REQUIRE( dsl_ode_action_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_list_size() == 0 ); } } } } SCENARIO( "A new Pipeline with an ODE Handler, an Occurrence ODE Trigger, with a Pause Pipeline ODE Action can play", "[ode-behavior]" ) { GIVEN( "A Pipeline, ODE Handler, Occurrence ODE Trigger, and Capture ODE Action" ) { std::wstring pauseActionName(L"pause-action"); REQUIRE( dsl_component_list_size() == 0 ); REQUIRE( dsl_source_uri_new(source_name.c_str(), uri.c_str(), cudadec_mem_type, false, intr_decode, drop_frame_interval) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_infer_gie_primary_new(primary_gie_name.c_str(), infer_config_file.c_str(), model_engine_file.c_str(), 0) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_tracker_ktl_new(tracker_name.c_str(), tracker_width, tracker_height) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_tiler_new(tiler_name.c_str(), width, height) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pph_ode_new(ode_pph_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_tiler_pph_add(tiler_name.c_str(), ode_pph_name.c_str(), DSL_PAD_SRC) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_occurrence_new(first_person_occurrence_name.c_str(), NULL, person_class_id, DSL_ODE_TRIGGER_LIMIT_ONE) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_pause_new(pauseActionName.c_str(), pipeline_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_action_add(first_person_occurrence_name.c_str(), pauseActionName.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pph_ode_trigger_add(ode_pph_name.c_str(), first_person_occurrence_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_sink_window_new(window_sink_name.c_str(), offsetX, offsetY, sinkW, sinkH) == DSL_RESULT_SUCCESS ); const wchar_t* components[] = {L"uri-source", L"primary-gie", L"ktl-tracker", L"tiler", L"window-sink", NULL}; WHEN( "When the Pipeline is Assembled" ) { REQUIRE( dsl_pipeline_new(pipeline_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pipeline_component_add_many(pipeline_name.c_str(), components) == DSL_RESULT_SUCCESS ); THEN( "Pipeline is Able to LinkAll and Play" ) { REQUIRE( dsl_pipeline_play(pipeline_name.c_str()) == DSL_RESULT_SUCCESS ); std::this_thread::sleep_for(TIME_TO_SLEEP_FOR); REQUIRE( dsl_pipeline_stop(pipeline_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pipeline_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pipeline_list_size() == 0 ); REQUIRE( dsl_component_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_component_list_size() == 0 ); REQUIRE( dsl_pph_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pph_list_size() == 0 ); REQUIRE( dsl_ode_trigger_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_list_size() == 0 ); REQUIRE( dsl_ode_action_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_list_size() == 0 ); } } } } SCENARIO( "A new Pipeline with an ODE Handler, Four Occurrence ODE Triggers, each with ODE Display Actions can play", "[ode-behavior]" ) { GIVEN( "A Pipeline, ODE Handler, Occurrence ODE Trigger, and Display ODE Actions" ) { uint textOffsetX(10); uint textOffsetY(20); REQUIRE( dsl_display_type_rgba_color_new(full_black.c_str(), 0.0, 0.0, 0.0, 1.0) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_display_type_rgba_font_new(font_name.c_str(), font.c_str(), size, full_black.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_component_list_size() == 0 ); REQUIRE( dsl_source_uri_new(source_name.c_str(), uri.c_str(), cudadec_mem_type, false, intr_decode, drop_frame_interval) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_infer_gie_primary_new(primary_gie_name.c_str(), infer_config_file.c_str(), model_engine_file.c_str(), 0) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_tracker_ktl_new(tracker_name.c_str(), tracker_width, tracker_height) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_tiler_new(tiler_name.c_str(), width, height) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pph_ode_new(ode_pph_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_tiler_pph_add(tiler_name.c_str(), ode_pph_name.c_str(), DSL_PAD_SRC) == DSL_RESULT_SUCCESS ); // Display actions, one per class. REQUIRE( dsl_ode_action_display_new(vehicle_display_action.c_str(), vehicle_string.c_str(), textOffsetX, textOffsetY, font_name.c_str(), false, full_black.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_display_new(bycle_display_action.c_str(), bycle_string.c_str(), textOffsetX, textOffsetY+20, font_name.c_str(), false, full_black.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_display_new(person_display_action.c_str(), person_string.c_str(), textOffsetX, textOffsetY+40, font_name.c_str(), false, full_black.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_display_new(roadsign_display_action.c_str(), roadsign_string.c_str(), textOffsetX, textOffsetY+60, font_name.c_str(), false, full_black.c_str()) == DSL_RESULT_SUCCESS ); // Create all Summation triggers and add their repsective Display Action REQUIRE( dsl_ode_trigger_summation_new(vehicle_summation_name.c_str(), NULL, vehicle_class_id, DSL_ODE_TRIGGER_LIMIT_NONE) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_action_add(vehicle_summation_name.c_str(), vehicle_display_action.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_summation_new(bicycle_summation_name.c_str(), NULL, bicycle_class_id, DSL_ODE_TRIGGER_LIMIT_NONE) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_action_add(bicycle_summation_name.c_str(), bycle_display_action.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_summation_new(person_summation_name.c_str(), NULL, person_class_id, DSL_ODE_TRIGGER_LIMIT_NONE) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_action_add(person_summation_name.c_str(), person_display_action.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_summation_new(roadsign_summation_name.c_str(), NULL, roadsign_class_id, DSL_ODE_TRIGGER_LIMIT_NONE) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_action_add(roadsign_summation_name.c_str(), roadsign_display_action.c_str()) == DSL_RESULT_SUCCESS ); const wchar_t* odeTypes[] = {L"vehicle-summation", L"bicycle-summation", L"person-summation", L"roadsign-summation", NULL}; REQUIRE( dsl_pph_ode_trigger_add_many(ode_pph_name.c_str(), odeTypes) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_osd_new(osd_name.c_str(), text_enabled, clock_enabled) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_sink_window_new(window_sink_name.c_str(), offsetX, offsetY, sinkW, sinkH) == DSL_RESULT_SUCCESS ); const wchar_t* components[] = {L"uri-source", L"primary-gie", L"ktl-tracker", L"tiler", L"osd", L"window-sink", NULL}; WHEN( "When the Pipeline is Assembled" ) { REQUIRE( dsl_pipeline_new(pipeline_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pipeline_component_add_many(pipeline_name.c_str(), components) == DSL_RESULT_SUCCESS ); THEN( "Pipeline is Able to LinkAll and Play" ) { REQUIRE( dsl_pipeline_play(pipeline_name.c_str()) == DSL_RESULT_SUCCESS ); std::this_thread::sleep_for(TIME_TO_SLEEP_FOR); REQUIRE( dsl_pipeline_stop(pipeline_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pipeline_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pipeline_list_size() == 0 ); REQUIRE( dsl_component_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_component_list_size() == 0 ); REQUIRE( dsl_pph_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pph_list_size() == 0 ); REQUIRE( dsl_ode_trigger_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_list_size() == 0 ); REQUIRE( dsl_ode_action_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_list_size() == 0 ); REQUIRE( dsl_display_type_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_display_type_list_size() == 0 ); } } } } SCENARIO( "A new Pipeline with an ODE Handler, Four ODE Accumulation Triggers with ODE Display ActionS can play", "[ode-behavior]" ) { GIVEN( "A Pipeline, ODE Handler, Four Aggreation ODE Triggers each with a Display ODE Actions" ) { std::wstring displayActionName(L"display-action"); uint textOffsetX(10); uint textOffsetY(20); REQUIRE( dsl_display_type_rgba_color_new(full_black.c_str(), 0.0, 0.0, 0.0, 1.0) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_display_type_rgba_font_new(font_name.c_str(), font.c_str(), size, full_black.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_component_list_size() == 0 ); REQUIRE( dsl_source_uri_new(source_name.c_str(), uri.c_str(), cudadec_mem_type, false, intr_decode, drop_frame_interval) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_infer_gie_primary_new(primary_gie_name.c_str(), infer_config_file.c_str(), model_engine_file.c_str(), 0) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_tracker_ktl_new(tracker_name.c_str(), tracker_width, tracker_height) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_tiler_new(tiler_name.c_str(), width, height) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pph_ode_new(ode_pph_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_tiler_pph_add(tiler_name.c_str(), ode_pph_name.c_str(), DSL_PAD_SRC) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_display_new(vehicle_display_action.c_str(), vehicle_string.c_str(), textOffsetX, textOffsetY, font_name.c_str(), false, full_black.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_display_new(bycle_display_action.c_str(), bycle_string.c_str(), textOffsetX, textOffsetY+20, font_name.c_str(), false, full_black.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_display_new(person_display_action.c_str(), person_string.c_str(), textOffsetX, textOffsetY+40, font_name.c_str(), false, full_black.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_display_new(roadsign_display_action.c_str(), roadsign_string.c_str(), textOffsetX, textOffsetY+60, font_name.c_str(), false, full_black.c_str()) == DSL_RESULT_SUCCESS ); // Create all occurrences REQUIRE( dsl_ode_trigger_accumulation_new(vehicle_accumulation_name.c_str(), NULL, vehicle_class_id, DSL_ODE_TRIGGER_LIMIT_NONE) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_action_add(vehicle_accumulation_name.c_str(), vehicle_display_action.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_accumulation_new(bicycle_accumulation_name.c_str(), NULL, bicycle_class_id, DSL_ODE_TRIGGER_LIMIT_NONE) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_action_add(bicycle_accumulation_name.c_str(), bycle_display_action.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_accumulation_new(person_accumulation_name.c_str(), NULL, person_class_id, DSL_ODE_TRIGGER_LIMIT_NONE) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_action_add(person_accumulation_name.c_str(), person_display_action.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_accumulation_new(roadsign_accumulation_name.c_str(), NULL, roadsign_class_id, DSL_ODE_TRIGGER_LIMIT_NONE) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_action_add(roadsign_accumulation_name.c_str(), roadsign_display_action.c_str()) == DSL_RESULT_SUCCESS ); const wchar_t* odeTypes[] = {L"vehicle-accumulation", L"bicycle-accumulation", L"person-accumulation", L"roadsign-accumulation", NULL}; REQUIRE( dsl_pph_ode_trigger_add_many(ode_pph_name.c_str(), odeTypes) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_osd_new(osd_name.c_str(), text_enabled, clock_enabled) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_sink_window_new(window_sink_name.c_str(), offsetX, offsetY, sinkW, sinkH) == DSL_RESULT_SUCCESS ); const wchar_t* components[] = {L"uri-source", L"primary-gie", L"ktl-tracker", L"tiler", L"osd", L"window-sink", NULL}; WHEN( "When the Pipeline is Assembled" ) { REQUIRE( dsl_pipeline_new(pipeline_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pipeline_component_add_many(pipeline_name.c_str(), components) == DSL_RESULT_SUCCESS ); THEN( "Pipeline is Able to LinkAll and Play" ) { REQUIRE( dsl_pipeline_play(pipeline_name.c_str()) == DSL_RESULT_SUCCESS ); std::this_thread::sleep_for(TIME_TO_SLEEP_FOR); REQUIRE( dsl_pipeline_stop(pipeline_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pipeline_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pipeline_list_size() == 0 ); REQUIRE( dsl_component_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_component_list_size() == 0 ); REQUIRE( dsl_pph_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pph_list_size() == 0 ); REQUIRE( dsl_ode_trigger_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_list_size() == 0 ); REQUIRE( dsl_ode_action_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_list_size() == 0 ); REQUIRE( dsl_display_type_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_display_type_list_size() == 0 ); } } } } SCENARIO( "A new Pipeline with an ODE Handler, Four Summation ODE Triggers with shared ODE Inclusion Area", "[ode-behavior]" ) { GIVEN( "A Pipeline, ODE Handler, Four Summation ODE Triggers, and Display ODE Action" ) { std::wstring displayActionName(L"display-action"); uint textOffsetX(10); uint textOffsetY(20); std::wstring printActionName(L"print-action"); std::wstring fillActionName(L"fill-action"); REQUIRE( dsl_display_type_rgba_color_new(light_red.c_str(), 0.2, 0.0, 0.0, 0.5) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_display_type_rgba_color_new(full_white.c_str(), 1.0, 1.0, 1.0, 1.0) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_display_type_rgba_color_new(light_white.c_str(), 1.0, 1.0, 1.0, 0.25) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_display_type_rgba_color_new(full_black.c_str(), 1.0, 1.0, 1.0, 1.0) == DSL_RESULT_SUCCESS ); std::wstring font(L"arial"); std::wstring font_name(L"arial-14"); uint size(14); std::wstring areaName(L"area"); std::wstring polygonName(L"polygon"); uint border_width(3); dsl_coordinate coordinates[4] = {{365,600},{980,620},{1000, 770},{180,750}}; uint num_coordinates(4); std::wstring ode_pph_name(L"ode-handler"); REQUIRE( dsl_display_type_rgba_font_new(font_name.c_str(), font.c_str(), size, full_white.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_component_list_size() == 0 ); REQUIRE( dsl_source_uri_new(source_name.c_str(), uri.c_str(), cudadec_mem_type, false, intr_decode, drop_frame_interval) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_infer_gie_primary_new(primary_gie_name.c_str(), infer_config_file.c_str(), model_engine_file.c_str(), 0) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_tracker_ktl_new(tracker_name.c_str(), tracker_width, tracker_height) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pph_ode_new(ode_pph_name.c_str()) == DSL_RESULT_SUCCESS ); // Set Area critera, and The fill action for ODE occurrence caused by overlap REQUIRE( dsl_ode_trigger_occurrence_new(person_occurrence_name.c_str(), NULL, person_class_id, DSL_ODE_TRIGGER_LIMIT_NONE) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_format_bbox_new(fillActionName.c_str(), 0, NULL, true, light_red.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_action_add(person_occurrence_name.c_str(), fillActionName.c_str()) == DSL_RESULT_SUCCESS ); // Create a new ODE Area for criteria REQUIRE( dsl_display_type_rgba_polygon_new(polygonName.c_str(), coordinates, num_coordinates, border_width, light_white.c_str())== DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_area_inclusion_new(areaName.c_str(), polygonName.c_str(), true, DSL_BBOX_POINT_ANY) == DSL_RESULT_SUCCESS ); // Display actions, one per class. REQUIRE( dsl_ode_action_display_new(vehicle_display_action.c_str(), vehicle_string.c_str(), textOffsetX, textOffsetY, font_name.c_str(), false, full_black.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_display_new(bycle_display_action.c_str(), bycle_string.c_str(), textOffsetX, textOffsetY+20, font_name.c_str(), false, full_black.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_display_new(person_display_action.c_str(), person_string.c_str(), textOffsetX, textOffsetY+40, font_name.c_str(), false, full_black.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_display_new(roadsign_display_action.c_str(), roadsign_string.c_str(), textOffsetX, textOffsetY+60, font_name.c_str(), false, full_black.c_str()) == DSL_RESULT_SUCCESS ); // Create all Summation triggers and add their repsective Display Actions // and the shared plygon area REQUIRE( dsl_ode_trigger_summation_new(vehicle_summation_name.c_str(), NULL, vehicle_class_id, DSL_ODE_TRIGGER_LIMIT_NONE) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_action_add(vehicle_summation_name.c_str(), vehicle_display_action.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_area_add(vehicle_summation_name.c_str(), areaName.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_summation_new(bicycle_summation_name.c_str(), NULL, bicycle_class_id, DSL_ODE_TRIGGER_LIMIT_NONE) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_action_add(bicycle_summation_name.c_str(), bycle_display_action.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_area_add(bicycle_summation_name.c_str(), areaName.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_summation_new(person_summation_name.c_str(), NULL, person_class_id, DSL_ODE_TRIGGER_LIMIT_NONE) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_action_add(person_summation_name.c_str(), person_display_action.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_area_add(person_summation_name.c_str(), areaName.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_summation_new(roadsign_summation_name.c_str(), NULL, roadsign_class_id, DSL_ODE_TRIGGER_LIMIT_NONE) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_action_add(roadsign_summation_name.c_str(), roadsign_display_action.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_area_add(roadsign_summation_name.c_str(), areaName.c_str()) == DSL_RESULT_SUCCESS ); const wchar_t* odeTypes[] = {L"vehicle-summation", L"bicycle-summation", L"person-summation", L"roadsign-summation", NULL}; REQUIRE( dsl_pph_ode_trigger_add_many(ode_pph_name.c_str(), odeTypes) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_osd_new(osd_name.c_str(), text_enabled, clock_enabled) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_osd_pph_add(osd_name.c_str(), ode_pph_name.c_str(), DSL_PAD_SINK) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_sink_window_new(window_sink_name.c_str(), offsetX, offsetY, sinkW, sinkH) == DSL_RESULT_SUCCESS ); const wchar_t* components[] = {L"uri-source", L"primary-gie", L"ktl-tracker", L"osd", L"window-sink", NULL}; WHEN( "When the Pipeline is Assembled" ) { REQUIRE( dsl_pipeline_new(pipeline_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pipeline_component_add_many(pipeline_name.c_str(), components) == DSL_RESULT_SUCCESS ); THEN( "Pipeline is Able to LinkAll and Play" ) { REQUIRE( dsl_pipeline_play(pipeline_name.c_str()) == DSL_RESULT_SUCCESS ); std::this_thread::sleep_for(TIME_TO_SLEEP_FOR); REQUIRE( dsl_pipeline_stop(pipeline_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pipeline_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pipeline_list_size() == 0 ); REQUIRE( dsl_component_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_component_list_size() == 0 ); REQUIRE( dsl_pph_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pph_list_size() == 0 ); REQUIRE( dsl_ode_trigger_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_list_size() == 0 ); REQUIRE( dsl_ode_action_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_list_size() == 0 ); REQUIRE( dsl_ode_area_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_area_list_size() == 0 ); REQUIRE( dsl_display_type_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_display_type_list_size() == 0 ); } } } } SCENARIO( "A new Pipeline with an ODE Handler, Occurrence ODE Trigger, Start Record ODE Action can play", "[ode-behavior]" ) { GIVEN( "A Pipeline, ODE Handler, Four Summation ODE Triggers, and Display ODE Action" ) { std::wstring recordSinkName(L"record-sink"); std::wstring outdir(L"./"); uint codec(DSL_CODEC_H265); uint bitrate(2000000); uint interval(0); uint container(DSL_CONTAINER_MKV); std::wstring recordActionName(L"start-record-action"); std::wstring printActionName(L"print-action"); std::wstring ode_pph_name(L"ode-handler"); REQUIRE( dsl_component_list_size() == 0 ); REQUIRE( dsl_source_uri_new(source_name.c_str(), uri.c_str(), cudadec_mem_type, false, intr_decode, drop_frame_interval) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_infer_gie_primary_new(primary_gie_name.c_str(), infer_config_file.c_str(), model_engine_file.c_str(), 0) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_tracker_ktl_new(tracker_name.c_str(), tracker_width, tracker_height) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_tiler_new(tiler_name.c_str(), width, height) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_osd_new(osd_name.c_str(), text_enabled, clock_enabled) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_sink_window_new(window_sink_name.c_str(), offsetX, offsetY, sinkW, sinkH) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_sink_record_new(recordSinkName.c_str(), outdir.c_str(), codec, container, bitrate, interval, NULL) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_print_new(printActionName.c_str(), false) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_sink_record_start_new(recordActionName.c_str(), recordSinkName.c_str(), 2, 5, NULL) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pph_ode_new(ode_pph_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_tiler_pph_add(tiler_name.c_str(), ode_pph_name.c_str(), DSL_PAD_SRC) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_occurrence_new(bicycle_occurrence_name.c_str(), NULL, bicycle_class_id, DSL_ODE_TRIGGER_LIMIT_ONE) == DSL_RESULT_SUCCESS ); const wchar_t* actions[] = {L"start-record-action", L"print-action", NULL}; REQUIRE( dsl_ode_trigger_action_add_many(bicycle_occurrence_name.c_str(), actions) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pph_ode_trigger_add(ode_pph_name.c_str(), bicycle_occurrence_name.c_str()) == DSL_RESULT_SUCCESS ); const wchar_t* components[] = {L"uri-source", L"primary-gie", L"ktl-tracker", L"tiler", L"osd", L"window-sink", L"record-sink", NULL}; WHEN( "When the Pipeline is Assembled" ) { REQUIRE( dsl_pipeline_new(pipeline_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pipeline_component_add_many(pipeline_name.c_str(), components) == DSL_RESULT_SUCCESS ); THEN( "Pipeline is Able to LinkAll and Play" ) { REQUIRE( dsl_pipeline_play(pipeline_name.c_str()) == DSL_RESULT_SUCCESS ); std::this_thread::sleep_for(TIME_TO_SLEEP_FOR); REQUIRE( dsl_pipeline_stop(pipeline_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pipeline_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pipeline_list_size() == 0 ); REQUIRE( dsl_component_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_component_list_size() == 0 ); REQUIRE( dsl_pph_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pph_list_size() == 0 ); REQUIRE( dsl_ode_trigger_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_list_size() == 0 ); REQUIRE( dsl_ode_action_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_list_size() == 0 ); REQUIRE( dsl_ode_area_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_area_list_size() == 0 ); REQUIRE( dsl_display_type_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_display_type_list_size() == 0 ); } } } } SCENARIO( "A new Pipeline with an Occurrence ODE Trigger using an ODE Line Area can play", "[ode-behavior]" ) { GIVEN( "A Pipeline, ODE Handler, Occurrence ODE Trigger, Line ODE Area, and Fill ODE Action" ) { std::wstring odeFillActionName(L"fill-action"); std::wstring ode_pph_name(L"ode-handler"); std::wstring lineName(L"line"); uint x1(300), y1(600), x2(600), y2(620); uint line_width(5); std::wstring colorName(L"opaque-white"); double red(1.0), green(1.0), blue(1.0), alpha(1.0); std::wstring areaName = L"line-area"; REQUIRE( dsl_component_list_size() == 0 ); REQUIRE( dsl_source_uri_new(source_name.c_str(), uri.c_str(), cudadec_mem_type, false, intr_decode, drop_frame_interval) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_infer_gie_primary_new(primary_gie_name.c_str(), infer_config_file.c_str(), model_engine_file.c_str(), 0) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_tracker_ktl_new(tracker_name.c_str(), tracker_width, tracker_height) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_tiler_new(tiler_name.c_str(), width, height) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pph_ode_new(ode_pph_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_tiler_pph_add(tiler_name.c_str(), ode_pph_name.c_str(), DSL_PAD_SINK) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_display_type_rgba_color_new(colorName.c_str(), red, green, blue, alpha) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_display_type_rgba_line_new(lineName.c_str(), x1, y1, x2, y2, line_width, colorName.c_str())== DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_area_line_new(areaName.c_str(), lineName.c_str(), true, DSL_BBOX_EDGE_BOTTOM) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_occurrence_new(person_occurrence_name.c_str(), NULL, person_class_id, DSL_ODE_TRIGGER_LIMIT_NONE) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_area_add(person_occurrence_name.c_str(), areaName.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_format_bbox_new(odeFillActionName.c_str(), 0, NULL, true, colorName.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_action_add(person_occurrence_name.c_str(), odeFillActionName.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pph_ode_trigger_add(ode_pph_name.c_str(), person_occurrence_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_osd_new(osd_name.c_str(), text_enabled, clock_enabled) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_sink_window_new(window_sink_name.c_str(), offsetX, offsetY, sinkW, sinkH) == DSL_RESULT_SUCCESS ); const wchar_t* components[] = {L"uri-source", L"primary-gie", L"ktl-tracker", L"tiler", L"osd", L"window-sink", NULL}; WHEN( "When the Pipeline is Assembled" ) { REQUIRE( dsl_pipeline_new(pipeline_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pipeline_component_add_many(pipeline_name.c_str(), components) == DSL_RESULT_SUCCESS ); THEN( "The Pipeline is Able to LinkAll and Play" ) { REQUIRE( dsl_pipeline_play(pipeline_name.c_str()) == DSL_RESULT_SUCCESS ); std::this_thread::sleep_for(TIME_TO_SLEEP_FOR); REQUIRE( dsl_pipeline_stop(pipeline_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pipeline_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pipeline_list_size() == 0 ); REQUIRE( dsl_component_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_component_list_size() == 0 ); REQUIRE( dsl_pph_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pph_list_size() == 0 ); REQUIRE( dsl_ode_trigger_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_list_size() == 0 ); REQUIRE( dsl_ode_action_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_list_size() == 0 ); REQUIRE( dsl_display_type_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_display_type_list_size() == 0 ); } } } } SCENARIO( "A new Pipeline with an Occurrence ODE Trigger using an ODE Inclussion Area can play", "[ode-behavior]" ) { GIVEN( "A Pipeline, ODE Handler, Occurrence ODE Trigger, Inclusion ODE Area, and Fill ODE Action" ) { std::wstring odeFillActionName(L"fill-action"); std::wstring polygonName(L"polygon"); uint border_width(3); dsl_coordinate coordinates[4] = {{365,600},{580,620},{600, 770},{180,750}}; uint num_coordinates(4); std::wstring opaqueWhite(L"opaque-white"); double red(1.0), green(1.0), blue(1.0), alpha(1.0); std::wstring areaName = L"inclusion-area"; REQUIRE( dsl_component_list_size() == 0 ); REQUIRE( dsl_source_uri_new(source_name.c_str(), uri.c_str(), cudadec_mem_type, false, intr_decode, drop_frame_interval) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_infer_gie_primary_new(primary_gie_name.c_str(), infer_config_file.c_str(), model_engine_file.c_str(), 0) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_tracker_ktl_new(tracker_name.c_str(), tracker_width, tracker_height) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_tiler_new(tiler_name.c_str(), width, height) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pph_ode_new(ode_pph_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_tiler_pph_add(tiler_name.c_str(), ode_pph_name.c_str(), DSL_PAD_SINK) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_display_type_rgba_color_new(opaqueWhite.c_str(), red, green, blue, alpha) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_display_type_rgba_polygon_new(polygonName.c_str(), coordinates, num_coordinates, border_width, opaqueWhite.c_str())== DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_area_inclusion_new(areaName.c_str(), polygonName.c_str(), true, DSL_BBOX_POINT_SOUTH) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_occurrence_new(person_occurrence_name.c_str(), NULL, person_class_id, DSL_ODE_TRIGGER_LIMIT_NONE) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_area_add(person_occurrence_name.c_str(), areaName.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_format_bbox_new(odeFillActionName.c_str(), 0, NULL, true, opaqueWhite.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_action_add(person_occurrence_name.c_str(), odeFillActionName.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pph_ode_trigger_add(ode_pph_name.c_str(), person_occurrence_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_osd_new(osd_name.c_str(), text_enabled, clock_enabled) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_sink_window_new(window_sink_name.c_str(), offsetX, offsetY, sinkW, sinkH) == DSL_RESULT_SUCCESS ); const wchar_t* components[] = {L"uri-source", L"primary-gie", L"ktl-tracker", L"tiler", L"osd", L"window-sink", NULL}; WHEN( "When the Pipeline is Assembled" ) { REQUIRE( dsl_pipeline_new(pipeline_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pipeline_component_add_many(pipeline_name.c_str(), components) == DSL_RESULT_SUCCESS ); THEN( "The Pipeline is Able to LinkAll and Play" ) { REQUIRE( dsl_pipeline_play(pipeline_name.c_str()) == DSL_RESULT_SUCCESS ); std::this_thread::sleep_for(TIME_TO_SLEEP_FOR); REQUIRE( dsl_pipeline_stop(pipeline_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pipeline_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pipeline_list_size() == 0 ); REQUIRE( dsl_component_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_component_list_size() == 0 ); REQUIRE( dsl_pph_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pph_list_size() == 0 ); REQUIRE( dsl_ode_trigger_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_list_size() == 0 ); REQUIRE( dsl_ode_action_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_list_size() == 0 ); REQUIRE( dsl_ode_area_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_area_list_size() == 0 ); REQUIRE( dsl_display_type_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_display_type_list_size() == 0 ); } } } } SCENARIO( "A new Pipeline with an Occurrence ODE Trigger using an ODE Exclusion Area can play", "[ode-behavior]" ) { GIVEN( "A Pipeline, ODE Handler, Occurrence ODE Trigger, Inclusion ODE Area, and Fill ODE Action" ) { std::wstring odeFillActionName(L"fill-action"); std::wstring polygonName(L"polygon"); uint border_width(3); dsl_coordinate coordinates[4] = {{365,600},{580,620},{600, 770},{180,750}}; uint num_coordinates(4); std::wstring opaqueWhite(L"opaque-white"); double red(1.0), green(1.0), blue(1.0), alpha(1.0); std::wstring areaName = L"exclusion-area"; REQUIRE( dsl_component_list_size() == 0 ); REQUIRE( dsl_source_uri_new(source_name.c_str(), uri.c_str(), cudadec_mem_type, false, intr_decode, drop_frame_interval) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_infer_gie_primary_new(primary_gie_name.c_str(), infer_config_file.c_str(), model_engine_file.c_str(), 0) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_tracker_ktl_new(tracker_name.c_str(), tracker_width, tracker_height) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_tiler_new(tiler_name.c_str(), width, height) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pph_ode_new(ode_pph_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_tiler_pph_add(tiler_name.c_str(), ode_pph_name.c_str(), DSL_PAD_SINK) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_display_type_rgba_color_new(opaqueWhite.c_str(), red, green, blue, alpha) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_display_type_rgba_polygon_new(polygonName.c_str(), coordinates, num_coordinates, border_width, opaqueWhite.c_str())== DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_area_exclusion_new(areaName.c_str(), polygonName.c_str(), true, DSL_BBOX_POINT_SOUTH) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_occurrence_new(person_occurrence_name.c_str(), NULL, person_class_id, DSL_ODE_TRIGGER_LIMIT_NONE) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_area_add(person_occurrence_name.c_str(), areaName.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_format_bbox_new(odeFillActionName.c_str(), 0, NULL, true, opaqueWhite.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_action_add(person_occurrence_name.c_str(), odeFillActionName.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pph_ode_trigger_add(ode_pph_name.c_str(), person_occurrence_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_osd_new(osd_name.c_str(), text_enabled, clock_enabled) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_sink_window_new(window_sink_name.c_str(), offsetX, offsetY, sinkW, sinkH) == DSL_RESULT_SUCCESS ); const wchar_t* components[] = {L"uri-source", L"primary-gie", L"ktl-tracker", L"tiler", L"osd", L"window-sink", NULL}; WHEN( "When the Pipeline is Assembled" ) { REQUIRE( dsl_pipeline_new(pipeline_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pipeline_component_add_many(pipeline_name.c_str(), components) == DSL_RESULT_SUCCESS ); THEN( "The Pipeline is Able to LinkAll and Play" ) { REQUIRE( dsl_pipeline_play(pipeline_name.c_str()) == DSL_RESULT_SUCCESS ); std::this_thread::sleep_for(TIME_TO_SLEEP_FOR); REQUIRE( dsl_pipeline_stop(pipeline_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pipeline_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pipeline_list_size() == 0 ); REQUIRE( dsl_component_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_component_list_size() == 0 ); REQUIRE( dsl_pph_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pph_list_size() == 0 ); REQUIRE( dsl_ode_trigger_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_list_size() == 0 ); REQUIRE( dsl_ode_action_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_list_size() == 0 ); REQUIRE( dsl_ode_area_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_area_list_size() == 0 ); REQUIRE( dsl_display_type_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_display_type_list_size() == 0 ); } } } } SCENARIO( "A new Pipeline with an ODE Handler, Occurrence ODE Trigger, and Format BBox ODE Action can play", "[ode-behavior]" ) { GIVEN( "A Pipeline, ODE Handler, Occurrence ODE Trigger, and Format BBox ODE Action" ) { std::wstring ode_action_name(L"format-bbox-action"); uint border_width(8); std::wstring border_color_name(L"my-border-color"); std::wstring bg_color_name(L"my-bg-color"); boolean has_bg_color(true); REQUIRE( dsl_display_type_rgba_color_new(border_color_name.c_str(), 0.12, 0.34, 0.56, 0.78) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_display_type_rgba_color_new(bg_color_name.c_str(), 0.78, 0.56, 0.34, 0.43) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_source_uri_new(source_name.c_str(), uri.c_str(), cudadec_mem_type, false, intr_decode, drop_frame_interval) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_infer_gie_primary_new(primary_gie_name.c_str(), infer_config_file.c_str(), model_engine_file.c_str(), 0) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_tracker_ktl_new(tracker_name.c_str(), tracker_width, tracker_height) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_tiler_new(tiler_name.c_str(), width, height) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pph_ode_new(ode_pph_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_tiler_pph_add(tiler_name.c_str(), ode_pph_name.c_str(), DSL_PAD_SRC) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_occurrence_new(ode_trigger_name.c_str(), NULL, class_id, DSL_ODE_TRIGGER_LIMIT_NONE) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_format_bbox_new(ode_action_name.c_str(), border_width, border_color_name.c_str(), has_bg_color, bg_color_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_action_add(ode_trigger_name.c_str(), ode_action_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pph_ode_trigger_add(ode_pph_name.c_str(), ode_trigger_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_osd_new(osd_name.c_str(), text_enabled, clock_enabled) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_sink_window_new(window_sink_name.c_str(), offsetX, offsetY, sinkW, sinkH) == DSL_RESULT_SUCCESS ); const wchar_t* components[] = {L"uri-source", L"primary-gie", L"ktl-tracker", L"tiler", L"osd", L"window-sink", NULL}; WHEN( "When the Pipeline is Assembled" ) { REQUIRE( dsl_pipeline_new(pipeline_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pipeline_component_add_many(pipeline_name.c_str(), components) == DSL_RESULT_SUCCESS ); THEN( "Pipeline is Able to LinkAll and Play" ) { REQUIRE( dsl_pipeline_play(pipeline_name.c_str()) == DSL_RESULT_SUCCESS ); std::this_thread::sleep_for(TIME_TO_SLEEP_FOR); REQUIRE( dsl_pipeline_stop(pipeline_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pipeline_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pipeline_list_size() == 0 ); REQUIRE( dsl_component_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_component_list_size() == 0 ); REQUIRE( dsl_pph_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pph_list_size() == 0 ); REQUIRE( dsl_ode_trigger_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_list_size() == 0 ); REQUIRE( dsl_ode_action_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_list_size() == 0 ); } } } } SCENARIO( "A new Pipeline with an ODE Handler, Occurrence ODE Trigger, and Format Label Action can play", "[ode-behavior]" ) { GIVEN( "A Pipeline, ODE Handler, Occurrence ODE Trigger, and Format Label Action" ) { std::wstring ode_action_name(L"format-label-action"); std::wstring font_name(L"font-name"); std::wstring font(L"arial"); uint size(14); std::wstring font_color_name(L"font-color"); std::wstring font_bg_color_name(L"font-bg-color"); double redFont(0.0), greenFont(0.0), blueFont(0.0), alphaFont(1.0); double redBgColor(0.12), greenBgColor(0.34), blueBgColor(0.56), alphaBgColor(0.78); boolean has_bg_color(true); REQUIRE( dsl_display_type_rgba_color_new(font_color_name.c_str(), redFont, greenFont, blueFont, alphaFont) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_display_type_rgba_color_new(font_bg_color_name.c_str(), redBgColor, greenBgColor, blueBgColor, alphaBgColor) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_display_type_rgba_font_new(font_name.c_str(), font.c_str(), size, font_color_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_format_label_new(ode_action_name.c_str(), font_name.c_str(), has_bg_color, font_bg_color_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_source_uri_new(source_name.c_str(), uri.c_str(), cudadec_mem_type, false, intr_decode, drop_frame_interval) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_infer_gie_primary_new(primary_gie_name.c_str(), infer_config_file.c_str(), model_engine_file.c_str(), 0) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_tracker_ktl_new(tracker_name.c_str(), tracker_width, tracker_height) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_tiler_new(tiler_name.c_str(), width, height) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pph_ode_new(ode_pph_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_tiler_pph_add(tiler_name.c_str(), ode_pph_name.c_str(), DSL_PAD_SRC) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_occurrence_new(ode_trigger_name.c_str(), NULL, class_id, DSL_ODE_TRIGGER_LIMIT_NONE) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_action_add(ode_trigger_name.c_str(), ode_action_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pph_ode_trigger_add(ode_pph_name.c_str(), ode_trigger_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_osd_new(osd_name.c_str(), text_enabled, clock_enabled) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_sink_window_new(window_sink_name.c_str(), offsetX, offsetY, sinkW, sinkH) == DSL_RESULT_SUCCESS ); const wchar_t* components[] = {L"uri-source", L"primary-gie", L"ktl-tracker", L"tiler", L"osd", L"window-sink", NULL}; WHEN( "When the Pipeline is Assembled" ) { REQUIRE( dsl_pipeline_new(pipeline_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pipeline_component_add_many(pipeline_name.c_str(), components) == DSL_RESULT_SUCCESS ); THEN( "Pipeline is Able to LinkAll and Play" ) { REQUIRE( dsl_pipeline_play(pipeline_name.c_str()) == DSL_RESULT_SUCCESS ); std::this_thread::sleep_for(TIME_TO_SLEEP_FOR); REQUIRE( dsl_pipeline_stop(pipeline_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pipeline_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pipeline_list_size() == 0 ); REQUIRE( dsl_component_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_component_list_size() == 0 ); REQUIRE( dsl_pph_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pph_list_size() == 0 ); REQUIRE( dsl_ode_trigger_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_list_size() == 0 ); REQUIRE( dsl_ode_action_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_list_size() == 0 ); } } } } SCENARIO( "A new Pipeline with an ODE Handler, Occurrence ODE Trigger, and Customize Label Action can play", "[ode-behavior]" ) { GIVEN( "A Pipeline, ODE Handler, Occurrence ODE Trigger, and Costomize Label Action" ) { std::wstring ode_action_name(L"customize-label-action"); uint label_types[] = {DSL_METRIC_OBJECT_LOCATION, DSL_METRIC_OBJECT_DIMENSIONS, DSL_METRIC_OBJECT_CONFIDENCE, DSL_METRIC_OBJECT_PERSISTENCE}; uint size(4); REQUIRE( dsl_ode_action_customize_label_new(ode_action_name.c_str(), label_types, size) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_source_uri_new(source_name.c_str(), uri.c_str(), cudadec_mem_type, false, intr_decode, drop_frame_interval) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_infer_gie_primary_new(primary_gie_name.c_str(), infer_config_file.c_str(), model_engine_file.c_str(), 0) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_tracker_ktl_new(tracker_name.c_str(), tracker_width, tracker_height) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_tiler_new(tiler_name.c_str(), width, height) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pph_ode_new(ode_pph_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_tiler_pph_add(tiler_name.c_str(), ode_pph_name.c_str(), DSL_PAD_SRC) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_occurrence_new(ode_trigger_name.c_str(), NULL, class_id, DSL_ODE_TRIGGER_LIMIT_NONE) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_action_add(ode_trigger_name.c_str(), ode_action_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pph_ode_trigger_add(ode_pph_name.c_str(), ode_trigger_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_osd_new(osd_name.c_str(), text_enabled, clock_enabled) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_sink_window_new(window_sink_name.c_str(), offsetX, offsetY, sinkW, sinkH) == DSL_RESULT_SUCCESS ); const wchar_t* components[] = {L"uri-source", L"primary-gie", L"ktl-tracker", L"tiler", L"osd", L"window-sink", NULL}; WHEN( "When the Pipeline is Assembled" ) { REQUIRE( dsl_pipeline_new(pipeline_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pipeline_component_add_many(pipeline_name.c_str(), components) == DSL_RESULT_SUCCESS ); THEN( "Pipeline is Able to LinkAll and Play" ) { REQUIRE( dsl_pipeline_play(pipeline_name.c_str()) == DSL_RESULT_SUCCESS ); std::this_thread::sleep_for(TIME_TO_SLEEP_FOR); REQUIRE( dsl_pipeline_stop(pipeline_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pipeline_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pipeline_list_size() == 0 ); REQUIRE( dsl_component_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_component_list_size() == 0 ); REQUIRE( dsl_pph_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_pph_list_size() == 0 ); REQUIRE( dsl_ode_trigger_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_list_size() == 0 ); REQUIRE( dsl_ode_action_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_list_size() == 0 ); } } } } <|start_filename|>src/DslServicesPlayer.cpp<|end_filename|> /* The MIT License Copyright (c) 2021, Prominence AI, Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in- all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "Dsl.h" #include "DslApi.h" #include "DslServices.h" #include "DslServicesValidate.h" #include "DslPlayerBintr.h" namespace DSL { DslReturnType Services::PlayerNew(const char* name, const char* source, const char* sink) { LOG_FUNC(); LOCK_MUTEX_FOR_CURRENT_SCOPE(&m_servicesMutex); try { DSL_RETURN_IF_COMPONENT_NAME_NOT_FOUND(m_components, source); DSL_RETURN_IF_COMPONENT_IS_NOT_SOURCE(m_components, source); DSL_RETURN_IF_COMPONENT_NAME_NOT_FOUND(m_components, sink); DSL_RETURN_IF_COMPONENT_IS_NOT_SINK(m_components, sink); if (m_players.find(name) != m_players.end()) { LOG_ERROR("Player name '" << name << "' is not unique"); return DSL_RESULT_PLAYER_NAME_NOT_UNIQUE; } DSL_SOURCE_PTR pSourceBintr = std::dynamic_pointer_cast<SourceBintr>(m_components[source]); DSL_SINK_PTR pSinkBintr = std::dynamic_pointer_cast<SinkBintr>(m_components[sink]); m_players[name] = std::shared_ptr<PlayerBintr>(new PlayerBintr(name, pSourceBintr, pSinkBintr)); LOG_INFO("New Player '" << name << "' created successfully"); return DSL_RESULT_SUCCESS; } catch(...) { LOG_ERROR("New Player '" << name << "' threw exception on create"); return DSL_RESULT_PLAYER_THREW_EXCEPTION; } } DslReturnType Services::PlayerRenderVideoNew(const char* name, const char* filePath, uint renderType, uint offsetX, uint offsetY, uint zoom, boolean repeatEnabled) { LOG_FUNC(); LOCK_MUTEX_FOR_CURRENT_SCOPE(&m_servicesMutex); try { if (renderType == DSL_RENDER_TYPE_OVERLAY) { // Get the Device properties cudaDeviceProp deviceProp; cudaGetDeviceProperties(&deviceProp, 0); if (!deviceProp.integrated) { LOG_ERROR("Overlay Sink is not supported on dGPU x86_64 builds"); return DSL_RESULT_SINK_OVERLAY_NOT_SUPPORTED; } } if (m_players.find(name) != m_players.end()) { LOG_ERROR("Player name '" << name << "' is not unique"); return DSL_RESULT_PLAYER_NAME_NOT_UNIQUE; } std::string pathString(filePath); if (pathString.size()) { std::ifstream streamUriFile(filePath); if (!streamUriFile.good()) { LOG_ERROR("File Source'" << filePath << "' Not found"); return DSL_RESULT_SOURCE_FILE_NOT_FOUND; } } m_players[name] = std::shared_ptr<VideoRenderPlayerBintr>(new VideoRenderPlayerBintr(name, filePath, renderType, offsetX, offsetY, zoom, repeatEnabled)); LOG_INFO("New Render File Player '" << name << "' created successfully"); return DSL_RESULT_SUCCESS; } catch(...) { LOG_ERROR("New Render File Player '" << name << "' threw exception on create"); return DSL_RESULT_PLAYER_THREW_EXCEPTION; } } DslReturnType Services::PlayerRenderImageNew(const char* name, const char* filePath, uint renderType, uint offsetX, uint offsetY, uint zoom, uint timeout) { LOG_FUNC(); LOCK_MUTEX_FOR_CURRENT_SCOPE(&m_servicesMutex); try { if (m_players.find(name) != m_players.end()) { LOG_ERROR("Player name '" << name << "' is not unique"); return DSL_RESULT_PLAYER_NAME_NOT_UNIQUE; } std::string pathString(filePath); if (pathString.size()) { std::ifstream streamUriFile(filePath); if (!streamUriFile.good()) { LOG_ERROR("File Source'" << filePath << "' Not found"); return DSL_RESULT_SOURCE_FILE_NOT_FOUND; } } m_players[name] = std::shared_ptr<ImageRenderPlayerBintr>(new ImageRenderPlayerBintr(name, filePath, renderType, offsetX, offsetY, zoom, timeout)); LOG_INFO("New Render Image Player '" << name << "' created successfully"); } catch(...) { LOG_ERROR("New Render Image Player '" << name << "' threw exception on create"); return DSL_RESULT_PLAYER_THREW_EXCEPTION; } } DslReturnType Services::PlayerRenderFilePathGet(const char* name, const char** filePath) { LOG_FUNC(); LOCK_MUTEX_FOR_CURRENT_SCOPE(&m_servicesMutex); try { DSL_RETURN_IF_PLAYER_NAME_NOT_FOUND(m_players, name); DSL_RETURN_IF_PLAYER_IS_NOT_RENDER_PLAYER(m_players, name); DSL_PLAYER_RENDER_BINTR_PTR pRenderPlayer = std::dynamic_pointer_cast<RenderPlayerBintr>(m_players[name]); *filePath = pRenderPlayer->GetFilePath(); LOG_INFO("Render Player '" << name << "' returned File Path = '" << *filePath << "' successfully"); return DSL_RESULT_SUCCESS; } catch(...) { LOG_ERROR("Render Player '" << name << "' threw exception getting File Path"); return DSL_RESULT_PLAYER_THREW_EXCEPTION; } } DslReturnType Services::PlayerRenderFilePathSet(const char* name, const char* filePath) { LOG_FUNC(); LOCK_MUTEX_FOR_CURRENT_SCOPE(&m_servicesMutex); try { DSL_RETURN_IF_PLAYER_NAME_NOT_FOUND(m_players, name); DSL_RETURN_IF_PLAYER_IS_NOT_RENDER_PLAYER(m_players, name); DSL_PLAYER_RENDER_BINTR_PTR pRenderPlayer = std::dynamic_pointer_cast<RenderPlayerBintr>(m_players[name]); if (!pRenderPlayer->SetFilePath(filePath)) { LOG_ERROR("Failed to Set File Path '" << filePath << "' for Render Player '" << name << "'"); return DSL_RESULT_PLAYER_SET_FAILED; } LOG_INFO("Render Player '" << name << "' set File Path = '" << filePath << "' successfully"); return DSL_RESULT_SUCCESS; } catch(...) { LOG_ERROR("Render Player '" << name << "' threw exception setting File Path"); return DSL_RESULT_PLAYER_THREW_EXCEPTION; } } DslReturnType Services::PlayerRenderFilePathQueue(const char* name, const char* filePath) { LOG_FUNC(); LOCK_MUTEX_FOR_CURRENT_SCOPE(&m_servicesMutex); try { DSL_RETURN_IF_PLAYER_NAME_NOT_FOUND(m_players, name); DSL_RETURN_IF_PLAYER_IS_NOT_RENDER_PLAYER(m_players, name); DSL_PLAYER_RENDER_BINTR_PTR pRenderPlayer = std::dynamic_pointer_cast<RenderPlayerBintr>(m_players[name]); if (!pRenderPlayer->QueueFilePath(filePath)) { LOG_ERROR("Failed to Queue File Path '" << filePath << "' for Render Player '" << name << "'"); return DSL_RESULT_PLAYER_SET_FAILED; } LOG_INFO("Render Player '" << name << "' queued File Path = '" << filePath << "' successfully"); return DSL_RESULT_SUCCESS; } catch(...) { LOG_ERROR("Render Player '" << name << "' threw exception queuing File Path"); return DSL_RESULT_PLAYER_THREW_EXCEPTION; } } DslReturnType Services::PlayerRenderOffsetsGet(const char* name, uint* offsetX, uint* offsetY) { LOG_FUNC(); LOCK_MUTEX_FOR_CURRENT_SCOPE(&m_servicesMutex); try { DSL_RETURN_IF_PLAYER_NAME_NOT_FOUND(m_players, name); DSL_RETURN_IF_PLAYER_IS_NOT_RENDER_PLAYER(m_players, name); DSL_PLAYER_RENDER_BINTR_PTR pRenderPlayer = std::dynamic_pointer_cast<RenderPlayerBintr>(m_players[name]); pRenderPlayer->GetOffsets(offsetX, offsetY); LOG_INFO("Render Player '" << name << "' returned Offset X = " << *offsetX << " and Offset Y = " << *offsetY << "' successfully"); return DSL_RESULT_SUCCESS; } catch(...) { LOG_ERROR("Render Player '" << name << "' threw an exception getting offsets"); return DSL_RESULT_PLAYER_THREW_EXCEPTION; } } DslReturnType Services::PlayerRenderOffsetsSet(const char* name, uint offsetX, uint offsetY) { LOG_FUNC(); LOCK_MUTEX_FOR_CURRENT_SCOPE(&m_servicesMutex); try { DSL_RETURN_IF_PLAYER_NAME_NOT_FOUND(m_players, name); DSL_RETURN_IF_PLAYER_IS_NOT_RENDER_PLAYER(m_players, name); DSL_PLAYER_RENDER_BINTR_PTR pRenderPlayer = std::dynamic_pointer_cast<RenderPlayerBintr>(m_players[name]); if (!pRenderPlayer->SetOffsets(offsetX, offsetY)) { LOG_ERROR("Render Player '" << name << "' failed to set offsets"); return DSL_RESULT_PLAYER_SET_FAILED; } LOG_INFO("Render Sink '" << name << "' set Offset X = " << offsetX << " and Offset Y = " << offsetY << "' successfully"); return DSL_RESULT_SUCCESS; } catch(...) { LOG_ERROR("OSD '" << name << "' threw an exception setting Clock offsets"); return DSL_RESULT_PLAYER_THREW_EXCEPTION; } } DslReturnType Services::PlayerRenderZoomGet(const char* name, uint* zoom) { LOG_FUNC(); LOCK_MUTEX_FOR_CURRENT_SCOPE(&m_servicesMutex); try { DSL_RETURN_IF_PLAYER_NAME_NOT_FOUND(m_players, name); DSL_RETURN_IF_PLAYER_IS_NOT_RENDER_PLAYER(m_players, name); DSL_PLAYER_RENDER_BINTR_PTR pRenderPlayer = std::dynamic_pointer_cast<RenderPlayerBintr>(m_players[name]); *zoom = pRenderPlayer->GetZoom(); LOG_INFO("Render Player '" << name << "' returned Zoom = " << *zoom << "' successfully"); return DSL_RESULT_SUCCESS; } catch(...) { LOG_ERROR("Render Player '" << name << "' threw exception getting Zoom"); return DSL_RESULT_PLAYER_THREW_EXCEPTION; } } DslReturnType Services::PlayerRenderZoomSet(const char* name, uint zoom) { LOG_FUNC(); LOCK_MUTEX_FOR_CURRENT_SCOPE(&m_servicesMutex); try { DSL_RETURN_IF_PLAYER_NAME_NOT_FOUND(m_players, name); DSL_RETURN_IF_PLAYER_IS_NOT_RENDER_PLAYER(m_players, name); DSL_PLAYER_RENDER_BINTR_PTR pRenderPlayer = std::dynamic_pointer_cast<RenderPlayerBintr>(m_players[name]); if (!pRenderPlayer->SetZoom(zoom)) { LOG_ERROR("Failed to Set Zooom '" << zoom << "' for Render Player '" << name << "'"); return DSL_RESULT_PLAYER_SET_FAILED; } LOG_INFO("Render Player '" << name << "' set Zoom = " << zoom << "' successfully"); return DSL_RESULT_SUCCESS; } catch(...) { LOG_ERROR("Render Player '" << name << "' threw exception setting Zoom"); return DSL_RESULT_PLAYER_THREW_EXCEPTION; } } DslReturnType Services::PlayerRenderReset(const char* name) { LOG_FUNC(); LOCK_MUTEX_FOR_CURRENT_SCOPE(&m_servicesMutex); try { DSL_RETURN_IF_PLAYER_NAME_NOT_FOUND(m_players, name); DSL_RETURN_IF_PLAYER_IS_NOT_RENDER_PLAYER(m_players, name); DSL_PLAYER_RENDER_BINTR_PTR pRenderPlayer = std::dynamic_pointer_cast<RenderPlayerBintr>(m_players[name]); if (!pRenderPlayer->Reset()) { LOG_ERROR("Failed to Reset Render Player '" << name << "'"); return DSL_RESULT_PLAYER_SET_FAILED; } LOG_INFO("Render Player '" << name << "' Reset successfully"); return DSL_RESULT_SUCCESS; } catch(...) { LOG_ERROR("Render Player '" << name << "' threw exception on Reset"); return DSL_RESULT_PLAYER_THREW_EXCEPTION; } } DslReturnType Services::PlayerRenderImageTimeoutGet(const char* name, uint* timeout) { LOG_FUNC(); LOCK_MUTEX_FOR_CURRENT_SCOPE(&m_servicesMutex); try { DSL_RETURN_IF_PLAYER_NAME_NOT_FOUND(m_players, name); DSL_RETURN_IF_COMPONENT_IS_NOT_CORRECT_TYPE(m_players, name, ImageRenderPlayerBintr); DSL_PLAYER_RENDER_IMAGE_BINTR_PTR pImageRenderPlayer = std::dynamic_pointer_cast<ImageRenderPlayerBintr>(m_players[name]); *timeout = pImageRenderPlayer->GetTimeout(); LOG_INFO("Image Render Player '" << name << "' returned Timeout = " << *timeout << "' successfully"); return DSL_RESULT_SUCCESS; } catch(...) { LOG_ERROR("Image Render Player '" << name << "' threw exception getting Timeout"); return DSL_RESULT_PLAYER_THREW_EXCEPTION; } } DslReturnType Services::PlayerRenderImageTimeoutSet(const char* name, uint timeout) { LOG_FUNC(); LOCK_MUTEX_FOR_CURRENT_SCOPE(&m_servicesMutex); try { DSL_RETURN_IF_PLAYER_NAME_NOT_FOUND(m_players, name); DSL_RETURN_IF_COMPONENT_IS_NOT_CORRECT_TYPE(m_players, name, ImageRenderPlayerBintr); DSL_PLAYER_RENDER_IMAGE_BINTR_PTR pImageRenderPlayer = std::dynamic_pointer_cast<ImageRenderPlayerBintr>(m_players[name]); if (!pImageRenderPlayer->SetTimeout(timeout)) { LOG_ERROR("Failed to Set Timeout to '" << timeout << "s' for Image Render Player '" << name << "'"); return DSL_RESULT_PLAYER_SET_FAILED; } LOG_INFO("Image Render Player '" << name << "' set Timeout = " << timeout << "' successfully"); return DSL_RESULT_SUCCESS; } catch(...) { LOG_ERROR("Image Render Player '" << name << "' threw exception setting Timeout"); return DSL_RESULT_PLAYER_THREW_EXCEPTION; } } DslReturnType Services::PlayerRenderVideoRepeatEnabledGet(const char* name, boolean* repeatEnabled) { LOG_FUNC(); LOCK_MUTEX_FOR_CURRENT_SCOPE(&m_servicesMutex); try { DSL_RETURN_IF_PLAYER_NAME_NOT_FOUND(m_players, name); DSL_RETURN_IF_COMPONENT_IS_NOT_CORRECT_TYPE(m_players, name, VideoRenderPlayerBintr); DSL_PLAYER_RENDER_VIDEO_BINTR_PTR pVideoRenderPlayer = std::dynamic_pointer_cast<VideoRenderPlayerBintr>(m_players[name]); *repeatEnabled = pVideoRenderPlayer->GetRepeatEnabled(); LOG_INFO("Video Render Player '" << name << "' returned Repeat Enabled = " << *repeatEnabled << "' successfully"); return DSL_RESULT_SUCCESS; } catch(...) { LOG_ERROR("Image Render Player '" << name << "' threw exception getting Timeout"); return DSL_RESULT_PLAYER_THREW_EXCEPTION; } } DslReturnType Services::PlayerRenderVideoRepeatEnabledSet(const char* name, boolean repeatEnabled) { LOG_FUNC(); LOCK_MUTEX_FOR_CURRENT_SCOPE(&m_servicesMutex); try { DSL_RETURN_IF_PLAYER_NAME_NOT_FOUND(m_players, name); DSL_RETURN_IF_COMPONENT_IS_NOT_CORRECT_TYPE(m_players, name, VideoRenderPlayerBintr); DSL_PLAYER_RENDER_VIDEO_BINTR_PTR pVideoRenderPlayer = std::dynamic_pointer_cast<VideoRenderPlayerBintr>(m_players[name]); if (!pVideoRenderPlayer->SetRepeatEnabled(repeatEnabled)) { LOG_ERROR("Failed to Set Repeat Enabled to '" << repeatEnabled << "' for Video Render Player '" << name << "'"); return DSL_RESULT_PLAYER_SET_FAILED; } LOG_INFO("Video Render Player '" << name << "' set Repeat Enabled = " << repeatEnabled << "' successfully"); return DSL_RESULT_SUCCESS; } catch(...) { LOG_ERROR("Video Render Player '" << name << "' threw exception setting Repeat Enabled"); return DSL_RESULT_PLAYER_THREW_EXCEPTION; } } DslReturnType Services::PlayerTerminationEventListenerAdd(const char* name, dsl_player_termination_event_listener_cb listener, void* clientData) { LOG_FUNC(); LOCK_MUTEX_FOR_CURRENT_SCOPE(&m_servicesMutex); DSL_RETURN_IF_PLAYER_NAME_NOT_FOUND(m_players, name); try { if (!m_players[name]->AddTerminationEventListener(listener, clientData)) { LOG_ERROR("Player '" << name << "' failed to add Termination Event Listener"); return DSL_RESULT_PLAYER_CALLBACK_ADD_FAILED; } LOG_INFO("Player '" << name << "' added Termination Event Listener successfully"); return DSL_RESULT_SUCCESS; } catch(...) { LOG_ERROR("Player '" << name << "' threw an exception adding Termination Event Listner"); return DSL_RESULT_PLAYER_THREW_EXCEPTION; } } DslReturnType Services::PlayerTerminationEventListenerRemove(const char* name, dsl_player_termination_event_listener_cb listener) { LOG_FUNC(); LOCK_MUTEX_FOR_CURRENT_SCOPE(&m_servicesMutex); try { DSL_RETURN_IF_PLAYER_NAME_NOT_FOUND(m_players, name); if (!m_players[name]->RemoveTerminationEventListener(listener)) { LOG_ERROR("Player '" << name << "' failed to remove Termination Event Listener"); return DSL_RESULT_PLAYER_CALLBACK_REMOVE_FAILED; } LOG_INFO("Player '" << name << "' removed Termination Event Listener successfully"); return DSL_RESULT_SUCCESS; } catch(...) { LOG_ERROR("Player '" << name << "' threw an exception adding Termination Event Listner"); return DSL_RESULT_PLAYER_THREW_EXCEPTION; } } DslReturnType Services::PlayerXWindowHandleGet(const char* name, uint64_t* xwindow) { LOG_FUNC(); LOCK_MUTEX_FOR_CURRENT_SCOPE(&m_servicesMutex); try { DSL_RETURN_IF_PLAYER_NAME_NOT_FOUND(m_players, name); *xwindow = m_players[name]->GetXWindow(); LOG_INFO("Player '" << name << "' returned X Window Handle successfully"); return DSL_RESULT_SUCCESS; } catch(...) { LOG_ERROR("Player '" << name << "' threw an exception getting XWindow handle"); return DSL_RESULT_PLAYER_THREW_EXCEPTION; } } DslReturnType Services::PlayerXWindowHandleSet(const char* name, uint64_t xwindow) { LOG_FUNC(); LOCK_MUTEX_FOR_CURRENT_SCOPE(&m_servicesMutex); try { DSL_RETURN_IF_PLAYER_NAME_NOT_FOUND(m_players, name); if (!m_players[name]->SetXWindow(xwindow)) { LOG_ERROR("Failure setting XWindow handle for Player '" << name << "'"); return DSL_RESULT_PLAYER_XWINDOW_SET_FAILED; } LOG_INFO("Player '" << name << "' set X Window Handle successfully"); return DSL_RESULT_SUCCESS; } catch(...) { LOG_ERROR("Player '" << name << "' threw an exception setting XWindow handle"); return DSL_RESULT_PLAYER_THREW_EXCEPTION; } } DslReturnType Services::PlayerXWindowKeyEventHandlerAdd(const char* name, dsl_xwindow_key_event_handler_cb handler, void* clientData) { LOG_FUNC(); LOCK_MUTEX_FOR_CURRENT_SCOPE(&m_servicesMutex); try { DSL_RETURN_IF_PLAYER_NAME_NOT_FOUND(m_players, name); if (!m_players[name]->AddXWindowKeyEventHandler(handler, clientData)) { LOG_ERROR("Player '" << name << "' failed to add XWindow Key Event Handler"); return DSL_RESULT_PLAYER_CALLBACK_ADD_FAILED; } LOG_INFO("Player '" << name << "' added X Window Key Event Handler successfully"); return DSL_RESULT_SUCCESS; } catch(...) { LOG_ERROR("Player '" << name << "' threw an exception adding XWindow Key Event Handler"); return DSL_RESULT_PLAYER_THREW_EXCEPTION; } } DslReturnType Services::PlayerXWindowKeyEventHandlerRemove(const char* name, dsl_xwindow_key_event_handler_cb handler) { LOG_FUNC(); LOCK_MUTEX_FOR_CURRENT_SCOPE(&m_servicesMutex); try { DSL_RETURN_IF_PLAYER_NAME_NOT_FOUND(m_players, name); if (!m_players[name]->RemoveXWindowKeyEventHandler(handler)) { LOG_ERROR("Player '" << name << "' failed to remove XWindow Key Event Handler"); return DSL_RESULT_PLAYER_CALLBACK_REMOVE_FAILED; } LOG_INFO("Player '" << name << "' removed X Window Key Event Handler successfully"); return DSL_RESULT_SUCCESS; } catch(...) { LOG_ERROR("Player '" << name << "' threw an exception removing XWindow Key Event Handler"); return DSL_RESULT_PLAYER_THREW_EXCEPTION; } } DslReturnType Services::PlayerPlay(const char* name) { LOG_FUNC(); LOCK_MUTEX_FOR_CURRENT_SCOPE(&m_servicesMutex); try { DSL_RETURN_IF_PLAYER_NAME_NOT_FOUND(m_players, name); if (!m_players[name]->Play()) { return DSL_RESULT_PLAYER_FAILED_TO_PLAY; } LOG_INFO("Player '" << name << "' transitioned to a state of PLAYING successfully"); return DSL_RESULT_SUCCESS; } catch(...) { LOG_ERROR("Player '" << name << "' threw an exception on Play"); return DSL_RESULT_PLAYER_THREW_EXCEPTION; } } DslReturnType Services::PlayerPause(const char* name) { LOG_FUNC(); LOCK_MUTEX_FOR_CURRENT_SCOPE(&m_servicesMutex); try { DSL_RETURN_IF_PLAYER_NAME_NOT_FOUND(m_players, name); if (!m_players[name]->Pause()) { return DSL_RESULT_PLAYER_FAILED_TO_PAUSE; } LOG_INFO("Player '" << name << "' transitioned to a state of PAUSED successfully"); return DSL_RESULT_SUCCESS; } catch(...) { LOG_ERROR("Player '" << name << "' threw an exception on Pause"); return DSL_RESULT_PLAYER_THREW_EXCEPTION; } } DslReturnType Services::PlayerStop(const char* name) { LOG_FUNC(); LOCK_MUTEX_FOR_CURRENT_SCOPE(&m_servicesMutex); DSL_RETURN_IF_PLAYER_NAME_NOT_FOUND(m_players, name); if (!m_players[name]->Stop()) { return DSL_RESULT_PLAYER_FAILED_TO_STOP; } LOG_INFO("Player '" << name << "' transitioned to a state of READY successfully"); return DSL_RESULT_SUCCESS; } DslReturnType Services::PlayerRenderNext(const char* name) { LOG_FUNC(); try { DSL_RETURN_IF_PLAYER_NAME_NOT_FOUND(m_players, name); DSL_RETURN_IF_PLAYER_IS_NOT_RENDER_PLAYER(m_players, name); DSL_PLAYER_RENDER_BINTR_PTR pRenderPlayer = std::dynamic_pointer_cast<RenderPlayerBintr>(m_players[name]); if (!pRenderPlayer->Next()) { LOG_ERROR("Player '" << name << "' failed to Play Next"); return DSL_RESULT_PLAYER_RENDER_FAILED_TO_PLAY_NEXT; } LOG_INFO("Render Player '" << name << "' was able to Render next file path successfully"); return DSL_RESULT_SUCCESS; } catch(...) { LOG_ERROR("Player '" << name << "' threw an exception on Play Next"); return DSL_RESULT_PLAYER_THREW_EXCEPTION; } } DslReturnType Services::PlayerStateGet(const char* name, uint* state) { LOG_FUNC(); LOCK_MUTEX_FOR_CURRENT_SCOPE(&m_servicesMutex); try { DSL_RETURN_IF_PLAYER_NAME_NOT_FOUND(m_players, name); DSL_RETURN_IF_PLAYER_IS_NOT_RENDER_PLAYER(m_players, name); GstState gstState; m_players[name]->GetState(gstState, 0); *state = (uint)gstState; LOG_INFO("Player '" << name << "' returned a current state of '" << StateValueToString(*state) << "' successfully"); return DSL_RESULT_SUCCESS; } catch(...) { LOG_ERROR("Player '" << name << "' threw an exception getting state"); return DSL_RESULT_PLAYER_THREW_EXCEPTION; } } boolean Services::PlayerExists(const char* name) { LOG_FUNC(); LOCK_MUTEX_FOR_CURRENT_SCOPE(&m_servicesMutex); try { return (boolean)(m_players.find(name) != m_players.end()); } catch(...) { LOG_ERROR("Player '" << name << "' threw an exception on check for Exists"); return false; } } DslReturnType Services::PlayerDelete(const char* name) { LOG_FUNC(); LOCK_MUTEX_FOR_CURRENT_SCOPE(&m_servicesMutex); try { DSL_RETURN_IF_PLAYER_NAME_NOT_FOUND(m_players, name); m_players.erase(name); LOG_INFO("Player '" << name << "' deleted successfully"); return DSL_RESULT_SUCCESS; } catch(...) { LOG_ERROR("Player '" << name << "' threw an exception on Delete"); return DSL_RESULT_PLAYER_THREW_EXCEPTION; } } DslReturnType Services::PlayerDeleteAll(bool checkInUse) { LOG_FUNC(); LOCK_MUTEX_FOR_CURRENT_SCOPE(&m_servicesMutex); try { if (m_players.empty()) { return DSL_RESULT_SUCCESS; } for (auto &imap: m_players) { // In the case of DSL Delete all - we don't check for in-use // as their can be a circular type ownership/relation that will // cause it to fail... i.e. players can own record sinks which // can own players, and so on... if (checkInUse and imap.second.use_count() > 1) { LOG_ERROR("Can't delete Player '" << imap.second->GetName() << "' as it is currently in use"); return DSL_RESULT_PLAYER_IN_USE; } imap.second->RemoveAllChildren(); imap.second = nullptr; } m_players.clear(); LOG_INFO("All Players deleted successfully"); return DSL_RESULT_SUCCESS; } catch(...) { LOG_ERROR("DSL threw an exception on PlayerDeleteAll"); return DSL_RESULT_PLAYER_THREW_EXCEPTION; } } uint Services::PlayerListSize() { LOG_FUNC(); LOCK_MUTEX_FOR_CURRENT_SCOPE(&m_servicesMutex); return m_players.size(); } } <|start_filename|>src/DslServicesOdeTrigger.cpp<|end_filename|> /* The MIT License Copyright (c) 2021, Prominence AI, Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in- all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "Dsl.h" #include "DslApi.h" #include "DslServices.h" #include "DslServicesValidate.h" #include "DslOdeArea.h" namespace DSL { DslReturnType Services::OdeTriggerAlwaysNew(const char* name, const char* source, uint when) { LOG_FUNC(); LOCK_MUTEX_FOR_CURRENT_SCOPE(&m_servicesMutex); try { // ensure event name uniqueness if (m_odeTriggers.find(name) != m_odeTriggers.end()) { LOG_ERROR("ODE Trigger name '" << name << "' is not unique"); return DSL_RESULT_ODE_TRIGGER_NAME_NOT_UNIQUE; } if (when > DSL_ODE_POST_OCCURRENCE_CHECK) { LOG_ERROR("Invalid 'when' parameter for ODE Trigger name '" << name << "'"); return DSL_RESULT_ODE_TRIGGER_PARAMETER_INVALID; } m_odeTriggers[name] = DSL_ODE_TRIGGER_ALWAYS_NEW(name, source, when); LOG_INFO("New Always ODE Trigger '" << name << "' created successfully"); return DSL_RESULT_SUCCESS; } catch(...) { LOG_ERROR("New Always ODE Trigger '" << name << "' threw exception on create"); return DSL_RESULT_ODE_TRIGGER_THREW_EXCEPTION; } } DslReturnType Services::OdeTriggerOccurrenceNew(const char* name, const char* source, uint classId, uint limit) { LOG_FUNC(); LOCK_MUTEX_FOR_CURRENT_SCOPE(&m_servicesMutex); try { // ensure event name uniqueness if (m_odeTriggers.find(name) != m_odeTriggers.end()) { LOG_ERROR("ODE Trigger name '" << name << "' is not unique"); return DSL_RESULT_ODE_TRIGGER_NAME_NOT_UNIQUE; } m_odeTriggers[name] = DSL_ODE_TRIGGER_OCCURRENCE_NEW(name, source, classId, limit); LOG_INFO("New Occurrence ODE Trigger '" << name << "' created successfully"); return DSL_RESULT_SUCCESS; } catch(...) { LOG_ERROR("New Occurrence ODE Trigger '" << name << "' threw exception on create"); return DSL_RESULT_ODE_TRIGGER_THREW_EXCEPTION; } } DslReturnType Services::OdeTriggerAbsenceNew(const char* name, const char* source, uint classId, uint limit) { LOG_FUNC(); LOCK_MUTEX_FOR_CURRENT_SCOPE(&m_servicesMutex); try { // ensure event name uniqueness if (m_odeTriggers.find(name) != m_odeTriggers.end()) { LOG_ERROR("ODE Trigger name '" << name << "' is not unique"); return DSL_RESULT_ODE_TRIGGER_NAME_NOT_UNIQUE; } m_odeTriggers[name] = DSL_ODE_TRIGGER_ABSENCE_NEW(name, source, classId, limit); LOG_INFO("New Absence ODE Trigger '" << name << "' created successfully"); return DSL_RESULT_SUCCESS; } catch(...) { LOG_ERROR("New Absence ODE Trigger '" << name << "' threw exception on create"); return DSL_RESULT_ODE_TRIGGER_THREW_EXCEPTION; } } DslReturnType Services::OdeTriggerAccumulationNew(const char* name, const char* source, uint classId, uint limit) { LOG_FUNC(); LOCK_MUTEX_FOR_CURRENT_SCOPE(&m_servicesMutex); try { // ensure event name uniqueness if (m_odeTriggers.find(name) != m_odeTriggers.end()) { LOG_ERROR("ODE Trigger name '" << name << "' is not unique"); return DSL_RESULT_ODE_TRIGGER_NAME_NOT_UNIQUE; } m_odeTriggers[name] = DSL_ODE_TRIGGER_ACCUMULATION_NEW(name, source, classId, limit); LOG_INFO("New Accumulation ODE Trigger '" << name << "' created successfully"); return DSL_RESULT_SUCCESS; } catch(...) { LOG_ERROR("New Accumulation ODE Trigger '" << name << "' threw exception on create"); return DSL_RESULT_ODE_TRIGGER_THREW_EXCEPTION; } } DslReturnType Services::OdeTriggerInstanceNew(const char* name, const char* source, uint classId, uint limit) { LOG_FUNC(); LOCK_MUTEX_FOR_CURRENT_SCOPE(&m_servicesMutex); try { // ensure event name uniqueness if (m_odeTriggers.find(name) != m_odeTriggers.end()) { LOG_ERROR("ODE Trigger name '" << name << "' is not unique"); return DSL_RESULT_ODE_TRIGGER_NAME_NOT_UNIQUE; } m_odeTriggers[name] = DSL_ODE_TRIGGER_INSTANCE_NEW(name, source, classId, limit); LOG_INFO("New Instance ODE Trigger '" << name << "' created successfully"); return DSL_RESULT_SUCCESS; } catch(...) { LOG_ERROR("New Instance ODE Trigger '" << name << "' threw exception on create"); return DSL_RESULT_ODE_TRIGGER_THREW_EXCEPTION; } } DslReturnType Services::OdeTriggerIntersectionNew(const char* name, const char* source, uint classIdA, uint classIdB, uint limit) { LOG_FUNC(); LOCK_MUTEX_FOR_CURRENT_SCOPE(&m_servicesMutex); try { // ensure event name uniqueness if (m_odeTriggers.find(name) != m_odeTriggers.end()) { LOG_ERROR("ODE Trigger name '" << name << "' is not unique"); return DSL_RESULT_ODE_TRIGGER_NAME_NOT_UNIQUE; } m_odeTriggers[name] = DSL_ODE_TRIGGER_INTERSECTION_NEW(name, source, classIdA, classIdB, limit); LOG_INFO("New Intersection ODE Trigger '" << name << "' created successfully"); return DSL_RESULT_SUCCESS; } catch(...) { LOG_ERROR("New Intersection ODE Trigger '" << name << "' threw exception on create"); return DSL_RESULT_ODE_TRIGGER_THREW_EXCEPTION; } } DslReturnType Services::OdeTriggerSummationNew(const char* name, const char* source, uint classId, uint limit) { LOG_FUNC(); LOCK_MUTEX_FOR_CURRENT_SCOPE(&m_servicesMutex); try { // ensure event name uniqueness if (m_odeTriggers.find(name) != m_odeTriggers.end()) { LOG_ERROR("ODE Trigger name '" << name << "' is not unique"); return DSL_RESULT_ODE_TRIGGER_NAME_NOT_UNIQUE; } m_odeTriggers[name] = DSL_ODE_TRIGGER_SUMMATION_NEW(name, source, classId, limit); LOG_INFO("New Summation ODE Trigger '" << name << "' created successfully"); return DSL_RESULT_SUCCESS; } catch(...) { LOG_ERROR("New Summation ODE Trigger '" << name << "' threw exception on create"); return DSL_RESULT_ODE_TRIGGER_THREW_EXCEPTION; } } DslReturnType Services::OdeTriggerCustomNew(const char* name, const char* source, uint classId, uint limit, dsl_ode_check_for_occurrence_cb client_checker, dsl_ode_post_process_frame_cb client_post_processor, void* client_data) { LOG_FUNC(); LOCK_MUTEX_FOR_CURRENT_SCOPE(&m_servicesMutex); try { // ensure event name uniqueness if (m_odeTriggers.find(name) != m_odeTriggers.end()) { LOG_ERROR("ODE Trigger name '" << name << "' is not unique"); return DSL_RESULT_ODE_TRIGGER_CLIENT_CALLBACK_INVALID; } if (!client_checker) { LOG_ERROR("ODE Trigger name '" << name << "' is not unique"); return DSL_RESULT_ODE_TRIGGER_CLIENT_CALLBACK_INVALID; } m_odeTriggers[name] = DSL_ODE_TRIGGER_CUSTOM_NEW(name, source, classId, limit, client_checker, client_post_processor, client_data); LOG_INFO("New Custom ODE Trigger '" << name << "' created successfully"); return DSL_RESULT_SUCCESS; } catch(...) { LOG_ERROR("New Custon ODE Trigger '" << name << "' threw exception on create"); return DSL_RESULT_ODE_TRIGGER_THREW_EXCEPTION; } } DslReturnType Services::OdeTriggerPersistenceNew(const char* name, const char* source, uint classId, uint limit, uint minimum, uint maximum) { LOG_FUNC(); LOCK_MUTEX_FOR_CURRENT_SCOPE(&m_servicesMutex); try { // ensure event name uniqueness if (m_odeTriggers.find(name) != m_odeTriggers.end()) { LOG_ERROR("ODE Trigger name '" << name << "' is not unique"); return DSL_RESULT_ODE_TRIGGER_NAME_NOT_UNIQUE; } // check for no maximum maximum = (maximum == 0) ? UINT32_MAX : maximum; m_odeTriggers[name] = DSL_ODE_TRIGGER_PERSISTENCE_NEW(name, source, classId, limit, minimum, maximum); LOG_INFO("New Persistence ODE Trigger '" << name << "' created successfully"); return DSL_RESULT_SUCCESS; } catch(...) { LOG_ERROR("New Persistence ODE Trigger '" << name << "' threw exception on create"); return DSL_RESULT_ODE_TRIGGER_THREW_EXCEPTION; } } DslReturnType Services::OdeTriggerPersistenceRangeGet(const char* name, uint* minimum, uint* maximum) { LOG_FUNC(); LOCK_MUTEX_FOR_CURRENT_SCOPE(&m_servicesMutex); try { DSL_RETURN_IF_ODE_TRIGGER_NAME_NOT_FOUND(m_odeTriggers, name); DSL_RETURN_IF_COMPONENT_IS_NOT_CORRECT_TYPE(m_odeTriggers, name, PersistenceOdeTrigger); DSL_ODE_TRIGGER_PERSISTENCE_PTR pOdeTrigger = std::dynamic_pointer_cast<PersistenceOdeTrigger>(m_odeTriggers[name]); pOdeTrigger->GetRange(minimum, maximum); // check for no maximum *maximum = (*maximum == UINT32_MAX) ? 0 : *maximum; return DSL_RESULT_SUCCESS; } catch(...) { LOG_ERROR("ODE Persistence Trigger '" << name << "' threw exception getting range"); return DSL_RESULT_ODE_TRIGGER_THREW_EXCEPTION; } } DslReturnType Services::OdeTriggerPersistenceRangeSet(const char* name, uint minimum, uint maximum) { LOG_FUNC(); LOCK_MUTEX_FOR_CURRENT_SCOPE(&m_servicesMutex); try { DSL_RETURN_IF_ODE_TRIGGER_NAME_NOT_FOUND(m_odeTriggers, name); DSL_RETURN_IF_COMPONENT_IS_NOT_CORRECT_TYPE(m_odeTriggers, name, PersistenceOdeTrigger); DSL_ODE_TRIGGER_PERSISTENCE_PTR pOdeTrigger = std::dynamic_pointer_cast<PersistenceOdeTrigger>(m_odeTriggers[name]); // check for no maximum maximum = (maximum == 0) ? UINT32_MAX : maximum; pOdeTrigger->SetRange(minimum, maximum); LOG_INFO("ODE Persistence Trigger '" << name << "' set new range from mimimum " << minimum << " to maximum " << maximum << " successfully"); return DSL_RESULT_SUCCESS; } catch(...) { LOG_ERROR("ODE Persistence Trigger '" << name << "' threw exception setting range"); return DSL_RESULT_ODE_TRIGGER_THREW_EXCEPTION; } } DslReturnType Services::OdeTriggerCountNew(const char* name, const char* source, uint classId, uint limit, uint minimum, uint maximum) { LOG_FUNC(); LOCK_MUTEX_FOR_CURRENT_SCOPE(&m_servicesMutex); try { // ensure event name uniqueness if (m_odeTriggers.find(name) != m_odeTriggers.end()) { LOG_ERROR("ODE Trigger name '" << name << "' is not unique"); return DSL_RESULT_ODE_TRIGGER_NAME_NOT_UNIQUE; } // check for no maximum maximum = (maximum == 0) ? UINT32_MAX : maximum; m_odeTriggers[name] = DSL_ODE_TRIGGER_COUNT_NEW(name, source, classId, limit, minimum, maximum); LOG_INFO("New Count ODE Trigger '" << name << "' created successfully"); return DSL_RESULT_SUCCESS; } catch(...) { LOG_ERROR("New Count ODE Trigger '" << name << "' threw exception on create"); return DSL_RESULT_ODE_TRIGGER_THREW_EXCEPTION; } } DslReturnType Services::OdeTriggerCountRangeGet(const char* name, uint* minimum, uint* maximum) { LOG_FUNC(); LOCK_MUTEX_FOR_CURRENT_SCOPE(&m_servicesMutex); try { DSL_RETURN_IF_ODE_TRIGGER_NAME_NOT_FOUND(m_odeTriggers, name); DSL_RETURN_IF_COMPONENT_IS_NOT_CORRECT_TYPE(m_odeTriggers, name, CountOdeTrigger); DSL_ODE_TRIGGER_COUNT_PTR pOdeTrigger = std::dynamic_pointer_cast<CountOdeTrigger>(m_odeTriggers[name]); pOdeTrigger->GetRange(minimum, maximum); // check for no maximum *maximum = (*maximum == UINT32_MAX) ? 0 : *maximum; LOG_INFO("ODE Count Trigger '" << name << "' returned range from mimimum " << *minimum << " to maximum " << *maximum << " successfully"); return DSL_RESULT_SUCCESS; } catch(...) { LOG_ERROR("ODE Count Trigger '" << name << "' threw exception getting range"); return DSL_RESULT_ODE_TRIGGER_THREW_EXCEPTION; } } DslReturnType Services::OdeTriggerCountRangeSet(const char* name, uint minimum, uint maximum) { LOG_FUNC(); LOCK_MUTEX_FOR_CURRENT_SCOPE(&m_servicesMutex); try { DSL_RETURN_IF_ODE_TRIGGER_NAME_NOT_FOUND(m_odeTriggers, name); DSL_RETURN_IF_COMPONENT_IS_NOT_CORRECT_TYPE(m_odeTriggers, name, CountOdeTrigger); DSL_ODE_TRIGGER_COUNT_PTR pOdeTrigger = std::dynamic_pointer_cast<CountOdeTrigger>(m_odeTriggers[name]); // check for no maximum maximum = (maximum == 0) ? UINT32_MAX : maximum; pOdeTrigger->SetRange(minimum, maximum); LOG_INFO("ODE Count Trigger '" << name << "' set new range from mimimum " << minimum << " to maximum " << maximum << " successfully"); return DSL_RESULT_SUCCESS; } catch(...) { LOG_ERROR("ODE Count Trigger '" << name << "' threw exception setting range"); return DSL_RESULT_ODE_TRIGGER_THREW_EXCEPTION; } } DslReturnType Services::OdeTriggerDistanceNew(const char* name, const char* source, uint classIdA, uint classIdB, uint limit, uint minimum, uint maximum, uint testPoint, uint testMethod) { LOG_FUNC(); LOCK_MUTEX_FOR_CURRENT_SCOPE(&m_servicesMutex); try { // ensure event name uniqueness if (m_odeTriggers.find(name) != m_odeTriggers.end()) { LOG_ERROR("ODE Trigger name '" << name << "' is not unique"); return DSL_RESULT_ODE_TRIGGER_NAME_NOT_UNIQUE; } // check for no maximum maximum = (maximum == 0) ? UINT32_MAX : maximum; m_odeTriggers[name] = DSL_ODE_TRIGGER_DISTANCE_NEW(name, source, classIdA, classIdB, limit, minimum, maximum, testPoint, testMethod); LOG_INFO("New Distance ODE Trigger '" << name << "' created successfully"); return DSL_RESULT_SUCCESS; } catch(...) { LOG_ERROR("New Distance ODE Trigger '" << name << "' threw exception on create"); return DSL_RESULT_ODE_TRIGGER_THREW_EXCEPTION; } } DslReturnType Services::OdeTriggerDistanceRangeGet(const char* name, uint* minimum, uint* maximum) { LOG_FUNC(); LOCK_MUTEX_FOR_CURRENT_SCOPE(&m_servicesMutex); try { DSL_RETURN_IF_ODE_TRIGGER_NAME_NOT_FOUND(m_odeTriggers, name); DSL_RETURN_IF_COMPONENT_IS_NOT_CORRECT_TYPE(m_odeTriggers, name, DistanceOdeTrigger); DSL_ODE_TRIGGER_DISTANCE_PTR pOdeTrigger = std::dynamic_pointer_cast<DistanceOdeTrigger>(m_odeTriggers[name]); pOdeTrigger->GetRange(minimum, maximum); // check for no maximum *maximum = (*maximum == UINT32_MAX) ? 0 : *maximum; LOG_INFO("ODE Distance Trigger '" << name << "' returned range from mimimum " << *minimum << " to maximum " << *maximum << " successfully"); return DSL_RESULT_SUCCESS; } catch(...) { LOG_ERROR("ODE Distance Trigger '" << name << "' threw exception getting range"); return DSL_RESULT_ODE_TRIGGER_THREW_EXCEPTION; } } DslReturnType Services::OdeTriggerDistanceRangeSet(const char* name, uint minimum, uint maximum) { LOG_FUNC(); LOCK_MUTEX_FOR_CURRENT_SCOPE(&m_servicesMutex); try { DSL_RETURN_IF_ODE_TRIGGER_NAME_NOT_FOUND(m_odeTriggers, name); DSL_RETURN_IF_COMPONENT_IS_NOT_CORRECT_TYPE(m_odeTriggers, name, DistanceOdeTrigger); DSL_ODE_TRIGGER_DISTANCE_PTR pOdeTrigger = std::dynamic_pointer_cast<DistanceOdeTrigger>(m_odeTriggers[name]); // check for no maximum maximum = (maximum == 0) ? UINT32_MAX : maximum; pOdeTrigger->SetRange(minimum, maximum); LOG_INFO("ODE Distance Trigger '" << name << "' set new range from mimimum " << minimum << " to maximum " << maximum << " successfully"); return DSL_RESULT_SUCCESS; } catch(...) { LOG_ERROR("ODE Distance Trigger '" << name << "' threw exception setting range"); return DSL_RESULT_ODE_TRIGGER_THREW_EXCEPTION; } } DslReturnType Services::OdeTriggerDistanceTestParamsGet(const char* name, uint* testPoint, uint* testMethod) { LOG_FUNC(); LOCK_MUTEX_FOR_CURRENT_SCOPE(&m_servicesMutex); try { DSL_RETURN_IF_ODE_TRIGGER_NAME_NOT_FOUND(m_odeTriggers, name); DSL_RETURN_IF_COMPONENT_IS_NOT_CORRECT_TYPE(m_odeTriggers, name, DistanceOdeTrigger); DSL_ODE_TRIGGER_DISTANCE_PTR pOdeTrigger = std::dynamic_pointer_cast<DistanceOdeTrigger>(m_odeTriggers[name]); pOdeTrigger->GetTestParams(testPoint, testMethod); LOG_INFO("ODE Distance Trigger '" << name << "' returned Test Parameters Test-Point = " << *testPoint << " and Test-Method = " << *testMethod << " successfully"); return DSL_RESULT_SUCCESS; } catch(...) { LOG_ERROR("ODE Distance Trigger '" << name << "' threw exception getting test parameters"); return DSL_RESULT_ODE_TRIGGER_THREW_EXCEPTION; } } DslReturnType Services::OdeTriggerDistanceTestParamsSet(const char* name, uint testPoint, uint testMethod) { LOG_FUNC(); LOCK_MUTEX_FOR_CURRENT_SCOPE(&m_servicesMutex); try { DSL_RETURN_IF_ODE_TRIGGER_NAME_NOT_FOUND(m_odeTriggers, name); DSL_RETURN_IF_COMPONENT_IS_NOT_CORRECT_TYPE(m_odeTriggers, name, DistanceOdeTrigger); DSL_ODE_TRIGGER_DISTANCE_PTR pOdeTrigger = std::dynamic_pointer_cast<DistanceOdeTrigger>(m_odeTriggers[name]); pOdeTrigger->SetTestParams(testPoint, testMethod); LOG_INFO("ODE Distance Trigger '" << name << "' set new Test Parameters Test-Point " << testPoint << " and Test-Method " << testMethod << " successfully"); return DSL_RESULT_SUCCESS; } catch(...) { LOG_ERROR("ODE Distance Trigger '" << name << "' threw exception setting test parameters"); return DSL_RESULT_ODE_TRIGGER_THREW_EXCEPTION; } } DslReturnType Services::OdeTriggerSmallestNew(const char* name, const char* source, uint classId, uint limit) { LOG_FUNC(); LOCK_MUTEX_FOR_CURRENT_SCOPE(&m_servicesMutex); try { // ensure event name uniqueness if (m_odeTriggers.find(name) != m_odeTriggers.end()) { LOG_ERROR("ODE Trigger name '" << name << "' is not unique"); return DSL_RESULT_ODE_TRIGGER_NAME_NOT_UNIQUE; } m_odeTriggers[name] = DSL_ODE_TRIGGER_SMALLEST_NEW(name, source, classId, limit); LOG_INFO("New Smallest ODE Trigger '" << name << "' created successfully"); return DSL_RESULT_SUCCESS; } catch(...) { LOG_ERROR("New Smallest ODE Trigger '" << name << "' threw exception on create"); return DSL_RESULT_ODE_TRIGGER_THREW_EXCEPTION; } } DslReturnType Services::OdeTriggerLargestNew(const char* name, const char* source, uint classId, uint limit) { LOG_FUNC(); LOCK_MUTEX_FOR_CURRENT_SCOPE(&m_servicesMutex); try { // ensure event name uniqueness if (m_odeTriggers.find(name) != m_odeTriggers.end()) { LOG_ERROR("ODE Trigger name '" << name << "' is not unique"); return DSL_RESULT_ODE_TRIGGER_NAME_NOT_UNIQUE; } m_odeTriggers[name] = DSL_ODE_TRIGGER_LARGEST_NEW(name, source, classId, limit); LOG_INFO("New Largest ODE Trigger '" << name << "' created successfully"); return DSL_RESULT_SUCCESS; } catch(...) { LOG_ERROR("New Largest ODE Trigger '" << name << "' threw exception on create"); return DSL_RESULT_ODE_TRIGGER_THREW_EXCEPTION; } } DslReturnType Services::OdeTriggerLatestNew(const char* name, const char* source, uint classId, uint limit) { LOG_FUNC(); LOCK_MUTEX_FOR_CURRENT_SCOPE(&m_servicesMutex); try { // ensure event name uniqueness if (m_odeTriggers.find(name) != m_odeTriggers.end()) { LOG_ERROR("ODE Trigger name '" << name << "' is not unique"); return DSL_RESULT_ODE_TRIGGER_NAME_NOT_UNIQUE; } m_odeTriggers[name] = DSL_ODE_TRIGGER_LATEST_NEW(name, source, classId, limit); LOG_INFO("New Latest ODE Trigger '" << name << "' created successfully"); return DSL_RESULT_SUCCESS; } catch(...) { LOG_ERROR("New Latest ODE Trigger '" << name << "' threw exception on create"); return DSL_RESULT_ODE_TRIGGER_THREW_EXCEPTION; } } DslReturnType Services::OdeTriggerEarliestNew(const char* name, const char* source, uint classId, uint limit) { LOG_FUNC(); LOCK_MUTEX_FOR_CURRENT_SCOPE(&m_servicesMutex); try { // ensure event name uniqueness if (m_odeTriggers.find(name) != m_odeTriggers.end()) { LOG_ERROR("ODE Trigger name '" << name << "' is not unique"); return DSL_RESULT_ODE_TRIGGER_NAME_NOT_UNIQUE; } m_odeTriggers[name] = DSL_ODE_TRIGGER_EARLIEST_NEW(name, source, classId, limit); LOG_INFO("New Earliest ODE Trigger '" << name << "' created successfully"); return DSL_RESULT_SUCCESS; } catch(...) { LOG_ERROR("New Earliest ODE Trigger '" << name << "' threw exception on create"); return DSL_RESULT_ODE_TRIGGER_THREW_EXCEPTION; } } DslReturnType Services::OdeTriggerNewHighNew(const char* name, const char* source, uint classId, uint limit, uint preset) { LOG_FUNC(); LOCK_MUTEX_FOR_CURRENT_SCOPE(&m_servicesMutex); try { // ensure event name uniqueness if (m_odeTriggers.find(name) != m_odeTriggers.end()) { LOG_ERROR("ODE Trigger name '" << name << "' is not unique"); return DSL_RESULT_ODE_TRIGGER_NAME_NOT_UNIQUE; } m_odeTriggers[name] = DSL_ODE_TRIGGER_NEW_HIGH_NEW(name, source, classId, limit, preset); LOG_INFO("New New-High ODE Trigger '" << name << "' created successfully"); return DSL_RESULT_SUCCESS; } catch(...) { LOG_ERROR("New New-High ODE Trigger '" << name << "' threw exception on create"); return DSL_RESULT_ODE_TRIGGER_THREW_EXCEPTION; } } DslReturnType Services::OdeTriggerNewLowNew(const char* name, const char* source, uint classId, uint limit, uint preset) { LOG_FUNC(); LOCK_MUTEX_FOR_CURRENT_SCOPE(&m_servicesMutex); try { // ensure event name uniqueness if (m_odeTriggers.find(name) != m_odeTriggers.end()) { LOG_ERROR("ODE Trigger name '" << name << "' is not unique"); return DSL_RESULT_ODE_TRIGGER_NAME_NOT_UNIQUE; } m_odeTriggers[name] = DSL_ODE_TRIGGER_NEW_LOW_NEW(name, source, classId, limit, preset); LOG_INFO("New New-Low ODE Trigger '" << name << "' created successfully"); return DSL_RESULT_SUCCESS; } catch(...) { LOG_ERROR("New New-Low ODE Trigger '" << name << "' threw exception on create"); return DSL_RESULT_ODE_TRIGGER_THREW_EXCEPTION; } } DslReturnType Services::OdeTriggerReset(const char* name) { LOG_FUNC(); LOCK_MUTEX_FOR_CURRENT_SCOPE(&m_servicesMutex); try { DSL_RETURN_IF_ODE_TRIGGER_NAME_NOT_FOUND(m_odeTriggers, name); DSL_ODE_TRIGGER_PTR pOdeTrigger = std::dynamic_pointer_cast<OdeTrigger>(m_odeTriggers[name]); pOdeTrigger->Reset(); LOG_INFO("ODE Trigger '" << name << "' Reset successfully"); return DSL_RESULT_SUCCESS; } catch(...) { LOG_ERROR("ODE Trigger '" << name << "' threw exception getting Enabled setting"); return DSL_RESULT_ODE_TRIGGER_THREW_EXCEPTION; } } DslReturnType Services::OdeTriggerResetTimeoutGet(const char* name, uint* timeout) { LOG_FUNC(); LOCK_MUTEX_FOR_CURRENT_SCOPE(&m_servicesMutex); try { DSL_RETURN_IF_ODE_TRIGGER_NAME_NOT_FOUND(m_odeTriggers, name); DSL_ODE_TRIGGER_PTR pOdeTrigger = std::dynamic_pointer_cast<OdeTrigger>(m_odeTriggers[name]); *timeout = pOdeTrigger->GetResetTimeout(); LOG_INFO("Trigger '" << name << "' returned Timeout = " << *timeout << " successfully"); return DSL_RESULT_SUCCESS; } catch(...) { LOG_ERROR("ODE Trigger '" << name << "' threw exception getting Reset Timer"); return DSL_RESULT_ODE_TRIGGER_THREW_EXCEPTION; } } DslReturnType Services::OdeTriggerResetTimeoutSet(const char* name, uint timeout) { LOG_FUNC(); LOCK_MUTEX_FOR_CURRENT_SCOPE(&m_servicesMutex); try { DSL_RETURN_IF_ODE_TRIGGER_NAME_NOT_FOUND(m_odeTriggers, name); DSL_ODE_TRIGGER_PTR pOdeTrigger = std::dynamic_pointer_cast<OdeTrigger>(m_odeTriggers[name]); pOdeTrigger->SetResetTimeout(timeout); LOG_INFO("Trigger '" << name << "' set Timeout = " << timeout << " successfully"); return DSL_RESULT_SUCCESS; } catch(...) { LOG_ERROR("ODE Trigger '" << name << "' threw exception setting Reset Timer"); return DSL_RESULT_ODE_TRIGGER_THREW_EXCEPTION; } } DslReturnType Services::OdeTriggerEnabledGet(const char* name, boolean* enabled) { LOG_FUNC(); LOCK_MUTEX_FOR_CURRENT_SCOPE(&m_servicesMutex); try { DSL_RETURN_IF_ODE_TRIGGER_NAME_NOT_FOUND(m_odeTriggers, name); DSL_ODE_TRIGGER_PTR pOdeTrigger = std::dynamic_pointer_cast<OdeTrigger>(m_odeTriggers[name]); *enabled = pOdeTrigger->GetEnabled(); return DSL_RESULT_SUCCESS; } catch(...) { LOG_ERROR("ODE Trigger '" << name << "' threw exception getting Enabled setting"); return DSL_RESULT_ODE_TRIGGER_THREW_EXCEPTION; } } DslReturnType Services::OdeTriggerEnabledSet(const char* name, boolean enabled) { LOG_FUNC(); LOCK_MUTEX_FOR_CURRENT_SCOPE(&m_servicesMutex); try { DSL_RETURN_IF_ODE_TRIGGER_NAME_NOT_FOUND(m_odeTriggers, name); DSL_ODE_TRIGGER_PTR pOdeTrigger = std::dynamic_pointer_cast<OdeTrigger>(m_odeTriggers[name]); pOdeTrigger->SetEnabled(enabled); LOG_INFO("Trigger '" << name << "' returned Enabled = " << enabled << " successfully"); return DSL_RESULT_SUCCESS; } catch(...) { LOG_ERROR("ODE Trigger '" << name << "' threw exception setting Enabled"); return DSL_RESULT_ODE_TRIGGER_THREW_EXCEPTION; } } DslReturnType Services::OdeTriggerSourceGet(const char* name, const char** source) { LOG_FUNC(); LOCK_MUTEX_FOR_CURRENT_SCOPE(&m_servicesMutex); try { DSL_RETURN_IF_ODE_TRIGGER_NAME_NOT_FOUND(m_odeTriggers, name); DSL_ODE_TRIGGER_PTR pOdeTrigger = std::dynamic_pointer_cast<OdeTrigger>(m_odeTriggers[name]); *source = pOdeTrigger->GetSource(); LOG_INFO("Trigger '" << name << "' returned Source = " << *source << " successfully"); return DSL_RESULT_SUCCESS; } catch(...) { LOG_ERROR("ODE Trigger '" << name << "' threw exception getting source id"); return DSL_RESULT_ODE_TRIGGER_THREW_EXCEPTION; } } DslReturnType Services::OdeTriggerSourceSet(const char* name, const char* source) { LOG_FUNC(); LOCK_MUTEX_FOR_CURRENT_SCOPE(&m_servicesMutex); try { DSL_RETURN_IF_ODE_TRIGGER_NAME_NOT_FOUND(m_odeTriggers, name); DSL_ODE_TRIGGER_PTR pOdeTrigger = std::dynamic_pointer_cast<OdeTrigger>(m_odeTriggers[name]); pOdeTrigger->SetSource(source); LOG_INFO("Trigger '" << name << "' set Source = " << source << " successfully"); return DSL_RESULT_SUCCESS; } catch(...) { LOG_ERROR("ODE Trigger '" << name << "' threw exception getting class id"); return DSL_RESULT_ODE_TRIGGER_THREW_EXCEPTION; } } DslReturnType Services::OdeTriggerClassIdGet(const char* name, uint* classId) { LOG_FUNC(); LOCK_MUTEX_FOR_CURRENT_SCOPE(&m_servicesMutex); try { DSL_RETURN_IF_ODE_TRIGGER_NAME_NOT_FOUND(m_odeTriggers, name); DSL_ODE_TRIGGER_PTR pOdeTrigger = std::dynamic_pointer_cast<OdeTrigger>(m_odeTriggers[name]); *classId = pOdeTrigger->GetClassId(); LOG_INFO("Trigger '" << name << "' returned Class Id = " << *classId << " successfully"); return DSL_RESULT_SUCCESS; } catch(...) { LOG_ERROR("ODE Trigger '" << name << "' threw exception getting class id"); return DSL_RESULT_ODE_TRIGGER_THREW_EXCEPTION; } } DslReturnType Services::OdeTriggerClassIdSet(const char* name, uint classId) { LOG_FUNC(); LOCK_MUTEX_FOR_CURRENT_SCOPE(&m_servicesMutex); try { DSL_RETURN_IF_ODE_TRIGGER_NAME_NOT_FOUND(m_odeTriggers, name); DSL_ODE_TRIGGER_PTR pOdeTrigger = std::dynamic_pointer_cast<OdeTrigger>(m_odeTriggers[name]); pOdeTrigger->SetClassId(classId); LOG_INFO("Trigger '" << name << "' set Class Id = " << classId << " successfully"); return DSL_RESULT_SUCCESS; } catch(...) { LOG_ERROR("ODE Trigger '" << name << "' threw exception getting class id"); return DSL_RESULT_ODE_TRIGGER_THREW_EXCEPTION; } } DslReturnType Services::OdeTriggerClassIdABGet(const char* name, uint* classIdA, uint* classIdB) { LOG_FUNC(); LOCK_MUTEX_FOR_CURRENT_SCOPE(&m_servicesMutex); try { DSL_RETURN_IF_ODE_TRIGGER_NAME_NOT_FOUND(m_odeTriggers, name); DSL_RETURN_IF_ODE_TRIGGER_IS_NOT_AB_TYPE(m_odeTriggers, name); DSL_ODE_TRIGGER_AB_PTR pOdeTrigger = std::dynamic_pointer_cast<ABOdeTrigger>(m_odeTriggers[name]); pOdeTrigger->GetClassIdAB(classIdA, classIdB); LOG_INFO("AB Trigger '" << name << "' returned Class Id A = " << *classIdA << " and Class Id B = " << *classIdB << " successfully"); return DSL_RESULT_SUCCESS; } catch(...) { LOG_ERROR("ODE Trigger '" << name << "' threw exception getting class id"); return DSL_RESULT_ODE_TRIGGER_THREW_EXCEPTION; } } DslReturnType Services::OdeTriggerClassIdABSet(const char* name, uint classIdA, uint classIdB) { LOG_FUNC(); LOCK_MUTEX_FOR_CURRENT_SCOPE(&m_servicesMutex); try { DSL_RETURN_IF_ODE_TRIGGER_NAME_NOT_FOUND(m_odeTriggers, name); DSL_RETURN_IF_ODE_TRIGGER_IS_NOT_AB_TYPE(m_odeTriggers, name); DSL_ODE_TRIGGER_AB_PTR pOdeTrigger = std::dynamic_pointer_cast<ABOdeTrigger>(m_odeTriggers[name]); pOdeTrigger->SetClassIdAB(classIdA, classIdB); LOG_INFO("AB Trigger '" << name << "' set Class Id A = " << classIdA << " and Class Id B = " << classIdB << " successfully"); return DSL_RESULT_SUCCESS; } catch(...) { LOG_ERROR("ODE Trigger '" << name << "' threw exception getting class id"); return DSL_RESULT_ODE_TRIGGER_THREW_EXCEPTION; } } DslReturnType Services::OdeTriggerLimitGet(const char* name, uint* limit) { LOG_FUNC(); LOCK_MUTEX_FOR_CURRENT_SCOPE(&m_servicesMutex); try { DSL_RETURN_IF_ODE_TRIGGER_NAME_NOT_FOUND(m_odeTriggers, name); DSL_ODE_TRIGGER_PTR pOdeTrigger = std::dynamic_pointer_cast<OdeTrigger>(m_odeTriggers[name]); *limit = pOdeTrigger->GetLimit(); LOG_INFO("Trigger '" << name << "' returned Limit = " << *limit << " successfully"); return DSL_RESULT_SUCCESS; } catch(...) { LOG_ERROR("ODE Trigger '" << name << "' threw exception getting limit"); return DSL_RESULT_ODE_TRIGGER_THREW_EXCEPTION; } } DslReturnType Services::OdeTriggerLimitSet(const char* name, uint limit) { LOG_FUNC(); LOCK_MUTEX_FOR_CURRENT_SCOPE(&m_servicesMutex); try { DSL_RETURN_IF_ODE_TRIGGER_NAME_NOT_FOUND(m_odeTriggers, name); DSL_ODE_TRIGGER_PTR pOdeTrigger = std::dynamic_pointer_cast<OdeTrigger>(m_odeTriggers[name]); pOdeTrigger->SetLimit(limit); LOG_INFO("Trigger '" << name << "' set Limit = " << limit << " successfully"); return DSL_RESULT_SUCCESS; } catch(...) { LOG_ERROR("ODE Trigger '" << name << "' threw exception getting limit"); return DSL_RESULT_ODE_TRIGGER_THREW_EXCEPTION; } } DslReturnType Services::OdeTriggerConfidenceMinGet(const char* name, float* minConfidence) { LOG_FUNC(); LOCK_MUTEX_FOR_CURRENT_SCOPE(&m_servicesMutex); try { DSL_RETURN_IF_ODE_TRIGGER_NAME_NOT_FOUND(m_odeTriggers, name); DSL_ODE_TRIGGER_PTR pOdeTrigger = std::dynamic_pointer_cast<OdeTrigger>(m_odeTriggers[name]); *minConfidence = pOdeTrigger->GetMinConfidence(); LOG_INFO("Trigger '" << name << "' returned Min Confidence = " << *minConfidence << " successfully"); return DSL_RESULT_SUCCESS; } catch(...) { LOG_ERROR("ODE Trigger '" << name << "' threw exception getting minimum confidence"); return DSL_RESULT_ODE_TRIGGER_THREW_EXCEPTION; } } DslReturnType Services::OdeTriggerConfidenceMinSet(const char* name, float minConfidence) { LOG_FUNC(); LOCK_MUTEX_FOR_CURRENT_SCOPE(&m_servicesMutex); try { DSL_RETURN_IF_ODE_TRIGGER_NAME_NOT_FOUND(m_odeTriggers, name); DSL_ODE_TRIGGER_PTR pOdeTrigger = std::dynamic_pointer_cast<OdeTrigger>(m_odeTriggers[name]); pOdeTrigger->SetMinConfidence(minConfidence); LOG_INFO("Trigger '" << name << "' set Min Confidence = " << minConfidence << " successfully"); return DSL_RESULT_SUCCESS; } catch(...) { LOG_ERROR("ODE Trigger '" << name << "' threw exception getting minimum confidence"); return DSL_RESULT_ODE_TRIGGER_THREW_EXCEPTION; } } DslReturnType Services::OdeTriggerDimensionsMinGet(const char* name, float* minWidth, float* minHeight) { LOG_FUNC(); LOCK_MUTEX_FOR_CURRENT_SCOPE(&m_servicesMutex); try { DSL_RETURN_IF_ODE_TRIGGER_NAME_NOT_FOUND(m_odeTriggers, name); DSL_ODE_TRIGGER_PTR pOdeTrigger = std::dynamic_pointer_cast<OdeTrigger>(m_odeTriggers[name]); pOdeTrigger->GetMinDimensions(minWidth, minHeight); LOG_INFO("Trigger '" << name << "' returned Minimum Width = " << *minWidth << " and Minimum Height = " << *minHeight << " successfully"); return DSL_RESULT_SUCCESS; } catch(...) { LOG_ERROR("ODE Trigger '" << name << "' threw exception getting minimum dimensions"); return DSL_RESULT_ODE_TRIGGER_THREW_EXCEPTION; } } DslReturnType Services::OdeTriggerDimensionsMinSet(const char* name, float minWidth, float minHeight) { LOG_FUNC(); LOCK_MUTEX_FOR_CURRENT_SCOPE(&m_servicesMutex); try { DSL_RETURN_IF_ODE_TRIGGER_NAME_NOT_FOUND(m_odeTriggers, name); DSL_ODE_TRIGGER_PTR pOdeTrigger = std::dynamic_pointer_cast<OdeTrigger>(m_odeTriggers[name]); // TODO: validate the min values for in-range pOdeTrigger->SetMinDimensions(minWidth, minHeight); LOG_INFO("Trigger '" << name << "' returned Minimum Width = " << minWidth << " and Minimum Height = " << minHeight << " successfully"); return DSL_RESULT_SUCCESS; } catch(...) { LOG_ERROR("ODE Trigger '" << name << "' threw exception setting minimum dimensions"); return DSL_RESULT_ODE_TRIGGER_THREW_EXCEPTION; } } DslReturnType Services::OdeTriggerDimensionsMaxGet(const char* name, float* maxWidth, float* maxHeight) { LOG_FUNC(); LOCK_MUTEX_FOR_CURRENT_SCOPE(&m_servicesMutex); try { DSL_RETURN_IF_ODE_TRIGGER_NAME_NOT_FOUND(m_odeTriggers, name); DSL_ODE_TRIGGER_PTR pOdeTrigger = std::dynamic_pointer_cast<OdeTrigger>(m_odeTriggers[name]); pOdeTrigger->GetMaxDimensions(maxWidth, maxHeight); LOG_INFO("Trigger'" << name << "' returned Maximim Width = " << *maxWidth << " and Minimum Height = " << *maxHeight << " successfully"); return DSL_RESULT_SUCCESS; } catch(...) { LOG_ERROR("ODE Trigger '" << name << "' threw exception getting maximum dimensions"); return DSL_RESULT_ODE_TRIGGER_THREW_EXCEPTION; } } DslReturnType Services::OdeTriggerDimensionsMaxSet(const char* name, float maxWidth, float maxHeight) { LOG_FUNC(); LOCK_MUTEX_FOR_CURRENT_SCOPE(&m_servicesMutex); try { DSL_RETURN_IF_ODE_TRIGGER_NAME_NOT_FOUND(m_odeTriggers, name); DSL_ODE_TRIGGER_PTR pOdeTrigger = std::dynamic_pointer_cast<OdeTrigger>(m_odeTriggers[name]); // TODO: validate the max values for in-range pOdeTrigger->SetMaxDimensions(maxWidth, maxHeight); LOG_INFO("Trigger '" << name << "' set Maximim Width = " << maxWidth << " and Minimum Height = " << maxHeight << " successfully"); return DSL_RESULT_SUCCESS; } catch(...) { LOG_ERROR("ODE Trigger '" << name << "' threw exception setting maximum dimensions"); return DSL_RESULT_ODE_TRIGGER_THREW_EXCEPTION; } } DslReturnType Services::OdeTriggerFrameCountMinGet(const char* name, uint* min_count_n, uint* min_count_d) { LOG_FUNC(); LOCK_MUTEX_FOR_CURRENT_SCOPE(&m_servicesMutex); try { DSL_RETURN_IF_ODE_TRIGGER_NAME_NOT_FOUND(m_odeTriggers, name); DSL_ODE_TRIGGER_PTR pOdeTrigger = std::dynamic_pointer_cast<OdeTrigger>(m_odeTriggers[name]); pOdeTrigger->GetMinFrameCount(min_count_n, min_count_d); return DSL_RESULT_SUCCESS; } catch(...) { LOG_ERROR("ODE Trigger '" << name << "' threw exception getting minimum frame count"); return DSL_RESULT_ODE_TRIGGER_THREW_EXCEPTION; } } DslReturnType Services:: OdeTriggerFrameCountMinSet(const char* name, uint min_count_n, uint min_count_d) { LOG_FUNC(); LOCK_MUTEX_FOR_CURRENT_SCOPE(&m_servicesMutex); try { DSL_RETURN_IF_ODE_TRIGGER_NAME_NOT_FOUND(m_odeTriggers, name); DSL_ODE_TRIGGER_PTR pOdeTrigger = std::dynamic_pointer_cast<OdeTrigger>(m_odeTriggers[name]); // TODO: validate the min values for in-range pOdeTrigger->SetMinFrameCount(min_count_n, min_count_d); return DSL_RESULT_SUCCESS; } catch(...) { LOG_ERROR("ODE Trigger '" << name << "' threw exception getting minimum frame count"); return DSL_RESULT_ODE_TRIGGER_THREW_EXCEPTION; } } DslReturnType Services::OdeTriggerInferDoneOnlyGet(const char* name, boolean* inferDoneOnly) { LOG_FUNC(); LOCK_MUTEX_FOR_CURRENT_SCOPE(&m_servicesMutex); try { DSL_RETURN_IF_ODE_TRIGGER_NAME_NOT_FOUND(m_odeTriggers, name); DSL_ODE_TRIGGER_PTR pOdeTrigger = std::dynamic_pointer_cast<OdeTrigger>(m_odeTriggers[name]); *inferDoneOnly = pOdeTrigger->GetInferDoneOnlySetting(); LOG_INFO("Trigger '" << name << "' set Inference Done Only = " << inferDoneOnly << " successfully"); return DSL_RESULT_SUCCESS; } catch(...) { LOG_ERROR("ODE Trigger '" << name << "' threw exception getting Inference Done Only"); return DSL_RESULT_ODE_TRIGGER_THREW_EXCEPTION; } } DslReturnType Services::OdeTriggerInferDoneOnlySet(const char* name, boolean inferDoneOnly) { LOG_FUNC(); LOCK_MUTEX_FOR_CURRENT_SCOPE(&m_servicesMutex); try { DSL_RETURN_IF_ODE_TRIGGER_NAME_NOT_FOUND(m_odeTriggers, name); DSL_ODE_TRIGGER_PTR pOdeTrigger = std::dynamic_pointer_cast<OdeTrigger>(m_odeTriggers[name]); pOdeTrigger->SetInferDoneOnlySetting(inferDoneOnly); LOG_INFO("Trigger '" << name << "' set Inference Done Only = " << inferDoneOnly << " successfully"); return DSL_RESULT_SUCCESS; } catch(...) { LOG_ERROR("ODE Trigger '" << name << "' threw exception getting Inference Done Only"); return DSL_RESULT_ODE_TRIGGER_THREW_EXCEPTION; } } DslReturnType Services::OdeTriggerIntervalGet(const char* name, uint* interval) { LOG_FUNC(); LOCK_MUTEX_FOR_CURRENT_SCOPE(&m_servicesMutex); try { DSL_RETURN_IF_ODE_TRIGGER_NAME_NOT_FOUND(m_odeTriggers, name); DSL_ODE_TRIGGER_PTR pOdeTrigger = std::dynamic_pointer_cast<OdeTrigger>(m_odeTriggers[name]); *interval = pOdeTrigger->GetInterval(); LOG_INFO("Trigger '" << name << "' returned Interval = " << *interval << " successfully"); return DSL_RESULT_SUCCESS; } catch(...) { LOG_ERROR("ODE Trigger '" << name << "' threw exception getting Interval"); return DSL_RESULT_ODE_TRIGGER_THREW_EXCEPTION; } } DslReturnType Services::OdeTriggerIntervalSet(const char* name, uint interval) { LOG_FUNC(); LOCK_MUTEX_FOR_CURRENT_SCOPE(&m_servicesMutex); try { DSL_RETURN_IF_ODE_TRIGGER_NAME_NOT_FOUND(m_odeTriggers, name); DSL_ODE_TRIGGER_PTR pOdeTrigger = std::dynamic_pointer_cast<OdeTrigger>(m_odeTriggers[name]); pOdeTrigger->SetInterval(interval); LOG_INFO("Trigger '" << name << "' set Interval = " << interval << " successfully"); return DSL_RESULT_SUCCESS; } catch(...) { LOG_ERROR("ODE Trigger '" << name << "' threw exception setting Interval"); return DSL_RESULT_ODE_TRIGGER_THREW_EXCEPTION; } } DslReturnType Services::OdeTriggerActionAdd(const char* name, const char* action) { LOG_FUNC(); LOCK_MUTEX_FOR_CURRENT_SCOPE(&m_servicesMutex); try { DSL_RETURN_IF_ODE_TRIGGER_NAME_NOT_FOUND(m_odeTriggers, name); DSL_RETURN_IF_ODE_ACTION_NAME_NOT_FOUND(m_odeActions, action); // Note: Actions can be added when in use, i.e. shared between // multiple ODE Triggers if (!m_odeTriggers[name]->AddAction(m_odeActions[action])) { LOG_ERROR("ODE Trigger '" << name << "' failed to add ODE Action '" << action << "'"); return DSL_RESULT_ODE_TRIGGER_ACTION_ADD_FAILED; } LOG_INFO("ODE Action '" << action << "' was added to ODE Trigger '" << name << "' successfully"); return DSL_RESULT_SUCCESS; } catch(...) { LOG_ERROR("ODE Trigger '" << name << "' threw exception adding ODE Action '" << action << "'"); return DSL_RESULT_ODE_TRIGGER_THREW_EXCEPTION; } } DslReturnType Services::OdeTriggerActionRemove(const char* name, const char* action) { LOG_FUNC(); LOCK_MUTEX_FOR_CURRENT_SCOPE(&m_servicesMutex); try { DSL_RETURN_IF_ODE_TRIGGER_NAME_NOT_FOUND(m_odeTriggers, name); DSL_RETURN_IF_ODE_ACTION_NAME_NOT_FOUND(m_odeActions, action); if (!m_odeActions[action]->IsParent(m_odeTriggers[name])) { LOG_ERROR("ODE Action'" << action << "' is not in use by ODE Trigger '" << name << "'"); return DSL_RESULT_ODE_TRIGGER_ACTION_NOT_IN_USE; } if (!m_odeTriggers[name]->RemoveAction(m_odeActions[action])) { LOG_ERROR("ODE Trigger '" << name << "' failed to remove ODE Action '" << action << "'"); return DSL_RESULT_ODE_TRIGGER_ACTION_REMOVE_FAILED; } LOG_INFO("ODE Action '" << action << "' was removed from ODE Trigger '" << name << "' successfully"); return DSL_RESULT_SUCCESS; } catch(...) { LOG_ERROR("ODE Trigger '" << name << "' threw exception remove ODE Action '" << action << "'"); return DSL_RESULT_ODE_TRIGGER_THREW_EXCEPTION; } } DslReturnType Services::OdeTriggerActionRemoveAll(const char* name) { LOG_FUNC(); LOCK_MUTEX_FOR_CURRENT_SCOPE(&m_servicesMutex); try { DSL_RETURN_IF_ODE_TRIGGER_NAME_NOT_FOUND(m_odeTriggers, name); m_odeTriggers[name]->RemoveAllActions(); LOG_INFO("All Events Actions removed from ODE Trigger '" << name << "' successfully"); return DSL_RESULT_SUCCESS; } catch(...) { LOG_ERROR("ODE Trigger '" << name << "' threw an exception removing All Events Actions"); return DSL_RESULT_ODE_TRIGGER_THREW_EXCEPTION; } } DslReturnType Services::OdeTriggerAreaAdd(const char* name, const char* area) { LOG_FUNC(); LOCK_MUTEX_FOR_CURRENT_SCOPE(&m_servicesMutex); try { DSL_RETURN_IF_ODE_TRIGGER_NAME_NOT_FOUND(m_odeTriggers, name); DSL_RETURN_IF_ODE_AREA_NAME_NOT_FOUND(m_odeAreas, area); // Note: Areas can be added when in use, i.e. shared between // multiple ODE Triggers if (!m_odeTriggers[name]->AddArea(m_odeAreas[area])) { LOG_ERROR("ODE Trigger '" << name << "' failed to add ODE Area '" << area << "'"); return DSL_RESULT_ODE_TRIGGER_AREA_ADD_FAILED; } LOG_INFO("ODE Area '" << area << "' was added to ODE Trigger '" << name << "' successfully"); return DSL_RESULT_SUCCESS; } catch(...) { LOG_ERROR("ODE Trigger '" << name << "' threw exception adding ODE Area '" << area << "'"); return DSL_RESULT_ODE_TRIGGER_THREW_EXCEPTION; } } DslReturnType Services::OdeTriggerAreaRemove(const char* name, const char* area) { LOG_FUNC(); LOCK_MUTEX_FOR_CURRENT_SCOPE(&m_servicesMutex); try { DSL_RETURN_IF_ODE_TRIGGER_NAME_NOT_FOUND(m_odeTriggers, name); DSL_RETURN_IF_ODE_AREA_NAME_NOT_FOUND(m_odeAreas, area); if (!m_odeAreas[area]->IsParent(m_odeTriggers[name])) { LOG_ERROR("ODE Area'" << area << "' is not in use by ODE Trigger '" << name << "'"); return DSL_RESULT_ODE_TRIGGER_AREA_NOT_IN_USE; } if (!m_odeTriggers[name]->RemoveArea(m_odeAreas[area])) { LOG_ERROR("ODE Trigger '" << name << "' failed to remove ODE Area '" << area << "'"); return DSL_RESULT_ODE_TRIGGER_AREA_REMOVE_FAILED; } LOG_INFO("ODE Area '" << area << "' was removed from ODE Trigger '" << name << "' successfully"); return DSL_RESULT_SUCCESS; } catch(...) { LOG_ERROR("ODE Trigger '" << name << "' threw exception remove ODE Area '" << area << "'"); return DSL_RESULT_ODE_TRIGGER_THREW_EXCEPTION; } } DslReturnType Services::OdeTriggerAreaRemoveAll(const char* name) { LOG_FUNC(); LOCK_MUTEX_FOR_CURRENT_SCOPE(&m_servicesMutex); try { DSL_RETURN_IF_ODE_TRIGGER_NAME_NOT_FOUND(m_odeTriggers, name); m_odeTriggers[name]->RemoveAllAreas(); LOG_INFO("All Events Areas removed from ODE Trigger '" << name << "' successfully"); return DSL_RESULT_SUCCESS; } catch(...) { LOG_ERROR("ODE Trigger '" << name << "' threw an exception removing All ODE Areas"); return DSL_RESULT_ODE_TRIGGER_THREW_EXCEPTION; } } DslReturnType Services::OdeTriggerDelete(const char* name) { LOG_FUNC(); LOCK_MUTEX_FOR_CURRENT_SCOPE(&m_servicesMutex); try { DSL_RETURN_IF_ODE_TRIGGER_NAME_NOT_FOUND(m_odeTriggers, name); if (m_odeTriggers[name]->IsInUse()) { LOG_INFO("ODE Trigger '" << name << "' is in use"); return DSL_RESULT_ODE_TRIGGER_IN_USE; } m_odeTriggers.erase(name); LOG_INFO("ODE Trigger '" << name << "' deleted successfully"); return DSL_RESULT_SUCCESS; } catch(...) { LOG_ERROR("ODE Trigger '" << name << "' threw an exception on deletion"); return DSL_RESULT_ODE_TRIGGER_THREW_EXCEPTION; } } DslReturnType Services::OdeTriggerDeleteAll() { LOG_FUNC(); LOCK_MUTEX_FOR_CURRENT_SCOPE(&m_servicesMutex); try { if (m_odeTriggers.empty()) { return DSL_RESULT_SUCCESS; } for (auto const& imap: m_odeTriggers) { // In the case of Delete all if (imap.second->IsInUse()) { LOG_ERROR("ODE Trigger '" << imap.second->GetName() << "' is currently in use"); return DSL_RESULT_ODE_TRIGGER_IN_USE; } } m_odeTriggers.clear(); LOG_INFO("All ODE Triggers deleted successfully"); return DSL_RESULT_SUCCESS; } catch(...) { LOG_ERROR("ODE Trigger threw an exception on delete all"); return DSL_RESULT_ODE_TRIGGER_THREW_EXCEPTION; } } uint Services::OdeTriggerListSize() { LOG_FUNC(); LOCK_MUTEX_FOR_CURRENT_SCOPE(&m_servicesMutex); return m_odeTriggers.size(); } } <|start_filename|>src/DslSinkBintr.cpp<|end_filename|> /* The MIT License Copyright (c) 2019-2021, Prominence AI, Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in- all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "Dsl.h" #include "DslSinkBintr.h" #include "DslBranchBintr.h" namespace DSL { SinkBintr::SinkBintr(const char* name, bool sync, bool async) : Bintr(name) , m_sync(sync) , m_async(async) , m_cudaDeviceProp{0} { LOG_FUNC(); // Get the Device properties cudaGetDeviceProperties(&m_cudaDeviceProp, m_gpuId); m_pQueue = DSL_ELEMENT_NEW(NVDS_ELEM_QUEUE, "sink-bin-queue"); AddChild(m_pQueue); m_pQueue->AddGhostPadToParent("sink"); } SinkBintr::~SinkBintr() { LOG_FUNC(); } bool SinkBintr::AddToParent(DSL_BASE_PTR pParentBintr) { LOG_FUNC(); // add 'this' Sink to the Parent Pipeline return std::dynamic_pointer_cast<BranchBintr>(pParentBintr)-> AddSinkBintr(shared_from_this()); } bool SinkBintr::IsParent(DSL_BASE_PTR pParentBintr) { LOG_FUNC(); // check if 'this' Sink is child of Parent Pipeline return std::dynamic_pointer_cast<BranchBintr>(pParentBintr)-> IsSinkBintrChild(std::dynamic_pointer_cast<SinkBintr>(shared_from_this())); } bool SinkBintr::RemoveFromParent(DSL_BASE_PTR pParentBintr) { LOG_FUNC(); if (!IsParent(pParentBintr)) { LOG_ERROR("Sink '" << GetName() << "' is not a child of Pipeline '" << pParentBintr->GetName() << "'"); return false; } // remove 'this' Sink from the Parent Pipeline return std::dynamic_pointer_cast<BranchBintr>(pParentBintr)-> RemoveSinkBintr(std::dynamic_pointer_cast<SinkBintr>(shared_from_this())); } void SinkBintr::GetSyncSettings(bool* sync, bool* async) { LOG_FUNC(); *sync = m_sync; *async = m_async; } //------------------------------------------------------------------------- FakeSinkBintr::FakeSinkBintr(const char* name) : SinkBintr(name, true, false) , m_qos(false) { LOG_FUNC(); m_pFakeSink = DSL_ELEMENT_NEW(NVDS_ELEM_SINK_FAKESINK, "sink-bin-fake"); m_pFakeSink->SetAttribute("enable-last-sample", false); m_pFakeSink->SetAttribute("max-lateness", -1); m_pFakeSink->SetAttribute("sync", m_sync); m_pFakeSink->SetAttribute("async", m_async); m_pFakeSink->SetAttribute("qos", m_qos); AddChild(m_pFakeSink); } FakeSinkBintr::~FakeSinkBintr() { LOG_FUNC(); if (IsLinked()) { UnlinkAll(); } } bool FakeSinkBintr::LinkAll() { LOG_FUNC(); if (m_isLinked) { LOG_ERROR("FakeSinkBintr '" << GetName() << "' is already linked"); return false; } if (!m_pQueue->LinkToSink(m_pFakeSink)) { return false; } m_isLinked = true; return true; } void FakeSinkBintr::UnlinkAll() { LOG_FUNC(); if (!m_isLinked) { LOG_ERROR("FakeSinkBintr '" << GetName() << "' is not linked"); return; } m_pQueue->UnlinkFromSink(); m_isLinked = false; } bool FakeSinkBintr::SetSyncSettings(bool sync, bool async) { LOG_FUNC(); if (IsLinked()) { LOG_ERROR("Unable to set Sync/Async Settings for OverlaySinkBintr '" << GetName() << "' as it's currently linked"); return false; } m_sync = sync; m_async = async; m_pFakeSink->SetAttribute("sync", m_sync); m_pFakeSink->SetAttribute("async", m_async); return true; } //------------------------------------------------------------------------- RenderSinkBintr::RenderSinkBintr(const char* name, uint offsetX, uint offsetY, uint width, uint height, bool sync, bool async) : SinkBintr(name, sync, async) , m_offsetX(offsetX) , m_offsetY(offsetY) , m_width(width) , m_height(height) { LOG_FUNC(); }; RenderSinkBintr::~RenderSinkBintr() { LOG_FUNC(); }; void RenderSinkBintr::GetOffsets(uint* offsetX, uint* offsetY) { LOG_FUNC(); *offsetX = m_offsetX; *offsetY = m_offsetY; } void RenderSinkBintr::GetDimensions(uint* width, uint* height) { LOG_FUNC(); *width = m_width; *height = m_height; } std::list<uint> OverlaySinkBintr::s_uniqueIds; //------------------------------------------------------------------------- OverlaySinkBintr::OverlaySinkBintr(const char* name, uint displayId, uint depth, uint offsetX, uint offsetY, uint width, uint height) : RenderSinkBintr(name, offsetX, offsetY, width, height, true, false) // sync, async , m_qos(FALSE) , m_displayId(displayId) , m_depth(depth) , m_uniqueId(1) { LOG_FUNC(); if (!m_cudaDeviceProp.integrated) { LOG_ERROR("Overlay Sink is only supported on the aarch64 Platform'"); throw; } // Reset to create if (!Reset()) { LOG_ERROR("Failed to create Overlay element for SinkBintr '" << GetName() << "'"); throw; } } bool OverlaySinkBintr::Reset() { LOG_FUNC(); if (m_isLinked) { LOG_ERROR("OverlaySinkBintr '" << GetName() << "' is currently linked and cannot be reset"); return false; } // If first time call - from the constructor if (m_pOverlay == nullptr) { // Find the first available unique Id while(std::find(s_uniqueIds.begin(), s_uniqueIds.end(), m_uniqueId) != s_uniqueIds.end()) { m_uniqueId++; } s_uniqueIds.push_back(m_uniqueId); } // Else, this is an actual reset/recreate else { // Remove the existing element from the objects bin gst_element_set_state(m_pOverlay->GetGstElement(), GST_STATE_NULL); RemoveChild(m_pOverlay); } m_pOverlay = DSL_ELEMENT_NEW(NVDS_ELEM_SINK_OVERLAY, "sink-bin-overlay"); m_pOverlay->SetAttribute("overlay", m_uniqueId); m_pOverlay->SetAttribute("display-id", m_displayId); m_pOverlay->SetAttribute("max-lateness", -1); m_pOverlay->SetAttribute("sync", m_sync); m_pOverlay->SetAttribute("async", m_async); m_pOverlay->SetAttribute("qos", m_qos); m_pOverlay->SetAttribute("overlay-x", m_offsetX); m_pOverlay->SetAttribute("overlay-y", m_offsetY); m_pOverlay->SetAttribute("overlay-w", m_width); m_pOverlay->SetAttribute("overlay-h", m_height); AddChild(m_pOverlay); return true; } OverlaySinkBintr::~OverlaySinkBintr() { LOG_FUNC(); s_uniqueIds.remove(m_uniqueId); } bool OverlaySinkBintr::LinkAll() { LOG_FUNC(); if (m_isLinked) { LOG_ERROR("OverlaySinkBintr '" << GetName() << "' is already linked"); return false; } if (!m_pQueue->LinkToSink(m_pOverlay)) { return false; } m_isLinked = true; return true; } void OverlaySinkBintr::UnlinkAll() { LOG_FUNC(); if (!m_isLinked) { LOG_ERROR("OverlaySinkBintr '" << GetName() << "' is not linked"); return; } m_pQueue->UnlinkFromSink(); m_isLinked = false; } int OverlaySinkBintr::GetDisplayId() { LOG_FUNC(); return m_displayId; } bool OverlaySinkBintr::SetDisplayId(int id) { LOG_FUNC(); if (IsInUse()) { LOG_ERROR("Unable to set DisplayId for OverlaySinkBintr '" << GetName() << "' as it's currently in use"); return false; } m_displayId = id; m_pOverlay->SetAttribute("display-id", m_displayId); return true; } bool OverlaySinkBintr::SetOffsets(uint offsetX, uint offsetY) { LOG_FUNC(); m_offsetX = offsetX; m_offsetY = offsetY; m_pOverlay->SetAttribute("overlay-x", m_offsetX); m_pOverlay->SetAttribute("overlay-y", m_offsetY); return true; } bool OverlaySinkBintr::SetDimensions(uint width, uint height) { LOG_FUNC(); m_width = width; m_height = height; m_pOverlay->SetAttribute("overlay-w", m_width); m_pOverlay->SetAttribute("overlay-h", m_height); return true; } bool OverlaySinkBintr::SetSyncSettings(bool sync, bool async) { LOG_FUNC(); if (IsLinked()) { LOG_ERROR("Unable to set Sync/Async Settings for OverlaySinkBintr '" << GetName() << "' as it's currently linked"); return false; } m_sync = sync; m_async = async; m_pOverlay->SetAttribute("sync", m_sync); m_pOverlay->SetAttribute("async", m_async); return true; } //------------------------------------------------------------------------- WindowSinkBintr::WindowSinkBintr(const char* name, guint offsetX, guint offsetY, guint width, guint height) : RenderSinkBintr(name, offsetX, offsetY, width, height, true, false) , m_qos(false) , m_forceAspectRatio(false) { LOG_FUNC(); // x86_64 if (!m_cudaDeviceProp.integrated) { m_pTransform = DSL_ELEMENT_NEW(NVDS_ELEM_VIDEO_CONV, "sink-bin-transform"); m_pCapsFilter = DSL_ELEMENT_NEW(NVDS_ELEM_CAPS_FILTER, "sink-bin-caps-filter"); GstCaps * pCaps = gst_caps_new_empty_simple("video/x-raw"); if (!pCaps) { LOG_ERROR("Failed to create new Simple Capabilities for '" << name << "'"); throw; } GstCapsFeatures *feature = NULL; feature = gst_caps_features_new("memory:NVMM", NULL); gst_caps_set_features(pCaps, 0, feature); m_pCapsFilter->SetAttribute("caps", pCaps); gst_caps_unref(pCaps); m_pTransform->SetAttribute("gpu-id", m_gpuId); m_pTransform->SetAttribute("nvbuf-memory-type", m_nvbufMemoryType); AddChild(m_pCapsFilter); } // aarch_64 else { m_pTransform = DSL_ELEMENT_NEW(NVDS_ELEM_EGLTRANSFORM, "sink-bin-transform"); } // Reset to create m_pEglGles if (!Reset()) { LOG_ERROR("Failed to create Window element for SinkBintr '" << GetName() << "'"); throw; } AddChild(m_pTransform); } bool WindowSinkBintr::Reset() { LOG_FUNC(); if (m_isLinked) { LOG_ERROR("WindowSinkBintr '" << GetName() << "' is currently linked and cannot be reset"); return false; } // If not a first time call from the constructor if (m_pEglGles != nullptr) { // Remove the existing element from the objects bin gst_element_set_state(m_pEglGles->GetGstElement(), GST_STATE_NULL); RemoveChild(m_pEglGles); } m_pEglGles = DSL_ELEMENT_NEW(NVDS_ELEM_SINK_EGL, "sink-bin-eglgles"); m_pEglGles->SetAttribute("window-x", m_offsetX); m_pEglGles->SetAttribute("window-y", m_offsetY); m_pEglGles->SetAttribute("window-width", m_width); m_pEglGles->SetAttribute("window-height", m_height); m_pEglGles->SetAttribute("enable-last-sample", false); m_pEglGles->SetAttribute("force-aspect-ratio", m_forceAspectRatio); m_pEglGles->SetAttribute("max-lateness", -1); m_pEglGles->SetAttribute("sync", m_sync); m_pEglGles->SetAttribute("async", m_async); m_pEglGles->SetAttribute("qos", m_qos); AddChild(m_pEglGles); return true; } WindowSinkBintr::~WindowSinkBintr() { LOG_FUNC(); if (IsLinked()) { UnlinkAll(); } } bool WindowSinkBintr::LinkAll() { LOG_FUNC(); if (m_isLinked) { LOG_ERROR("WindowSinkBintr '" << GetName() << "' is already linked"); return false; } // x86_64 if (!m_cudaDeviceProp.integrated) { if (!m_pQueue->LinkToSink(m_pTransform) or !m_pTransform->LinkToSink(m_pCapsFilter) or !m_pCapsFilter->LinkToSink(m_pEglGles)) { return false; } } else // aarch_64 { if (!m_pQueue->LinkToSink(m_pTransform) or !m_pTransform->LinkToSink(m_pEglGles)) { return false; } } m_isLinked = true; return true; } void WindowSinkBintr::UnlinkAll() { LOG_FUNC(); if (!m_isLinked) { LOG_ERROR("WindowSinkBintr '" << GetName() << "' is not linked"); return; } m_pQueue->UnlinkFromSink(); m_pTransform->UnlinkFromSink(); // x86_64 if (!m_cudaDeviceProp.integrated) { m_pCapsFilter->UnlinkFromSink(); } m_isLinked = false; //Reset(); } bool WindowSinkBintr::SetOffsets(uint offsetX, uint offsetY) { LOG_FUNC(); m_offsetX = offsetX; m_offsetY = offsetY; m_pEglGles->SetAttribute("window-x", m_offsetX); m_pEglGles->SetAttribute("window-y", m_offsetY); return true; } bool WindowSinkBintr::SetDimensions(uint width, uint height) { LOG_FUNC(); m_width = width; m_height = height; m_pEglGles->SetAttribute("window-width", m_width); m_pEglGles->SetAttribute("window-height", m_height); return true; } bool WindowSinkBintr::SetSyncSettings(bool sync, bool async) { LOG_FUNC(); if (IsLinked()) { LOG_ERROR("Unable to set Sync/Async Settings for WindowSinkBintr '" << GetName() << "' as it's currently linked"); return false; } m_sync = sync; m_async = async; m_pEglGles->SetAttribute("sync", m_sync); m_pEglGles->SetAttribute("async", m_async); return true; } bool WindowSinkBintr::GetForceAspectRatio() { LOG_FUNC(); return m_forceAspectRatio; } bool WindowSinkBintr::SetForceAspectRatio(bool force) { LOG_FUNC(); if (IsLinked()) { LOG_ERROR("Unable to set 'force-aspce-ration' for WindowSinkBintr '" << GetName() << "' as it's currently linked"); return false; } m_forceAspectRatio = force; m_pEglGles->SetAttribute("force-aspect-ratio", m_forceAspectRatio); return true; } //------------------------------------------------------------------------- EncodeSinkBintr::EncodeSinkBintr(const char* name, uint codec, uint container, uint bitRate, uint interval) : SinkBintr(name, true, false) , m_codec(codec) , m_bitRate(bitRate) , m_interval(interval) , m_container(container) { LOG_FUNC(); m_pTransform = DSL_ELEMENT_NEW(NVDS_ELEM_VIDEO_CONV, "encode-sink-bin-transform"); m_pCapsFilter = DSL_ELEMENT_NEW(NVDS_ELEM_CAPS_FILTER, "encode-sink-bin-caps-filter"); m_pTransform->SetAttribute("gpu-id", m_gpuId); GstCaps* pCaps(NULL); switch (codec) { case DSL_CODEC_H264 : m_pEncoder = DSL_ELEMENT_NEW(NVDS_ELEM_ENC_H264_HW, "encode-sink-bin-encoder"); m_pEncoder->SetAttribute("bitrate", m_bitRate); m_pEncoder->SetAttribute("iframeinterval", m_interval); // aarch_64 if (m_cudaDeviceProp.integrated) { m_pEncoder->SetAttribute("bufapi-version", true); } m_pParser = DSL_ELEMENT_NEW("h264parse", "encode-sink-bin-parser"); pCaps = gst_caps_from_string("video/x-raw(memory:NVMM), format=I420"); break; case DSL_CODEC_H265 : m_pEncoder = DSL_ELEMENT_NEW(NVDS_ELEM_ENC_H265_HW, "encode-sink-bin-encoder"); m_pEncoder->SetAttribute("bitrate", m_bitRate); m_pEncoder->SetAttribute("iframeinterval", m_interval); // aarch_64 if (m_cudaDeviceProp.integrated) { m_pEncoder->SetAttribute("bufapi-version", true); } m_pParser = DSL_ELEMENT_NEW("h265parse", "encode-sink-bin-parser"); pCaps = gst_caps_from_string("video/x-raw(memory:NVMM), format=I420"); break; case DSL_CODEC_MPEG4 : m_pEncoder = DSL_ELEMENT_NEW(NVDS_ELEM_ENC_MPEG4, "encode-sink-bin-encoder"); m_pParser = DSL_ELEMENT_NEW("mpeg4videoparse", "encode-sink-bin-parser"); pCaps = gst_caps_from_string("video/x-raw, format=I420"); break; default: LOG_ERROR("Invalid codec = '" << codec << "' for new Sink '" << name << "'"); throw; } m_pCapsFilter->SetAttribute("caps", pCaps); gst_caps_unref(pCaps); AddChild(m_pTransform); AddChild(m_pCapsFilter); AddChild(m_pEncoder); AddChild(m_pParser); } void EncodeSinkBintr::GetVideoFormats(uint* codec, uint* container) { LOG_FUNC(); *codec = m_codec; *container = m_container; } void EncodeSinkBintr::GetEncoderSettings(uint* bitRate, uint* interval) { LOG_FUNC(); *bitRate = m_bitRate; *interval = m_interval; } bool EncodeSinkBintr::SetEncoderSettings(uint bitRate, uint interval) { LOG_FUNC(); if (IsInUse()) { LOG_ERROR("Unable to set Encoder Settings for FileSinkBintr '" << GetName() << "' as it's currently in use"); return false; } m_bitRate = bitRate; m_interval = interval; if (m_codec == DSL_CODEC_H264 or m_codec == DSL_CODEC_H265) { m_pEncoder->SetAttribute("bitrate", m_bitRate); m_pEncoder->SetAttribute("iframeinterval", m_interval); } return true; } bool EncodeSinkBintr::SetGpuId(uint gpuId) { LOG_FUNC(); if (IsInUse()) { LOG_ERROR("Unable to set GPU ID for FileSinkBintr '" << GetName() << "' as it's currently in use"); return false; } m_gpuId = gpuId; LOG_DEBUG("Setting GPU ID to '" << gpuId << "' for FileSinkBintr '" << GetName() << "'"); m_pTransform->SetAttribute("gpu-id", m_gpuId); return true; } //------------------------------------------------------------------------- FileSinkBintr::FileSinkBintr(const char* name, const char* filepath, uint codec, uint container, uint bitRate, uint interval) : EncodeSinkBintr(name, codec, container, bitRate, interval) { LOG_FUNC(); m_pFileSink = DSL_ELEMENT_NEW(NVDS_ELEM_SINK_FILE, "file-sink-bin"); m_pFileSink->SetAttribute("location", filepath); m_pFileSink->SetAttribute("sync", m_sync); m_pFileSink->SetAttribute("async", m_async); switch (container) { case DSL_CONTAINER_MP4 : m_pContainer = DSL_ELEMENT_NEW(NVDS_ELEM_MUX_MP4, "encode-sink-bin-container"); break; case DSL_CONTAINER_MKV : m_pContainer = DSL_ELEMENT_NEW(NVDS_ELEM_MKV, "encode-sink-bin-container"); break; default: LOG_ERROR("Invalid container = '" << container << "' for new Sink '" << name << "'"); throw; } AddChild(m_pContainer); AddChild(m_pFileSink); } FileSinkBintr::~FileSinkBintr() { LOG_FUNC(); if (IsLinked()) { UnlinkAll(); } } bool FileSinkBintr::LinkAll() { LOG_FUNC(); if (m_isLinked) { LOG_ERROR("FileSinkBintr '" << GetName() << "' is already linked"); return false; } if (!m_pQueue->LinkToSink(m_pTransform) or !m_pTransform->LinkToSink(m_pCapsFilter) or !m_pCapsFilter->LinkToSink(m_pEncoder) or !m_pEncoder->LinkToSink(m_pParser) or !m_pParser->LinkToSink(m_pContainer) or !m_pContainer->LinkToSink(m_pFileSink)) { return false; } m_isLinked = true; return true; } void FileSinkBintr::UnlinkAll() { LOG_FUNC(); if (!m_isLinked) { LOG_ERROR("FileSinkBintr '" << GetName() << "' is not linked"); return; } m_pContainer->UnlinkFromSink(); m_pParser->UnlinkFromSink(); m_pEncoder->UnlinkFromSink(); m_pCapsFilter->UnlinkFromSink(); m_pTransform->UnlinkFromSink(); m_pQueue->UnlinkFromSink(); m_isLinked = false; } bool FileSinkBintr::SetSyncSettings(bool sync, bool async) { LOG_FUNC(); if (IsLinked()) { LOG_ERROR("Unable to set Sync/Async Settings for FileSinkBintr '" << GetName() << "' as it's currently linked"); return false; } m_sync = sync; m_async = async; m_pFileSink->SetAttribute("sync", m_sync); m_pFileSink->SetAttribute("async", m_async); return true; } //------------------------------------------------------------------------- RecordSinkBintr::RecordSinkBintr(const char* name, const char* outdir, uint codec, uint container, uint bitRate, uint interval, dsl_record_client_listener_cb clientListener) : EncodeSinkBintr(name, codec, container, bitRate, interval) , RecordMgr(name, outdir, container, clientListener) { LOG_FUNC(); } RecordSinkBintr::~RecordSinkBintr() { LOG_FUNC(); if (IsLinked()) { UnlinkAll(); } } bool RecordSinkBintr::LinkAll() { LOG_FUNC(); if (m_isLinked) { LOG_ERROR("RecordSinkBintr '" << GetName() << "' is already linked"); return false; } CreateContext(); m_pRecordBin = DSL_NODETR_NEW("record-bin"); m_pRecordBin->SetGstObject(GST_OBJECT(m_pContext->recordbin)); AddChild(m_pRecordBin); if (!m_pQueue->LinkToSink(m_pTransform) or !m_pTransform->LinkToSink(m_pCapsFilter) or !m_pCapsFilter->LinkToSink(m_pEncoder) or !m_pEncoder->LinkToSink(m_pParser)) { return false; } GstPad* srcPad = gst_element_get_static_pad(m_pParser->GetGstElement(), "src"); GstPad* sinkPad = gst_element_get_static_pad(m_pRecordBin->GetGstElement(), "sink"); if (gst_pad_link(srcPad, sinkPad) != GST_PAD_LINK_OK) { LOG_ERROR("Failed to link parser to record-bin new RecordSinkBintr '" << GetName() << "'"); return false; } m_isLinked = true; return true; } void RecordSinkBintr::UnlinkAll() { LOG_FUNC(); if (!m_isLinked) { LOG_ERROR("RecordSinkBintr '" << GetName() << "' is not linked"); return; } GstPad* srcPad = gst_element_get_static_pad(m_pParser->GetGstElement(), "src"); GstPad* sinkPad = gst_element_get_static_pad(m_pRecordBin->GetGstElement(), "sink"); gst_pad_unlink(srcPad, sinkPad); m_pEncoder->UnlinkFromSink(); m_pCapsFilter->UnlinkFromSink(); m_pTransform->UnlinkFromSink(); m_pQueue->UnlinkFromSink(); RemoveChild(m_pRecordBin); m_pRecordBin = nullptr; DestroyContext(); m_isLinked = false; } bool RecordSinkBintr::SetSyncSettings(bool sync, bool async) { LOG_FUNC(); if (IsLinked()) { LOG_ERROR("Unable to set Sync/Async Settings for FileSinkBintr '" << GetName() << "' as it's currently linked"); return false; } m_sync = sync; m_async = async; // TODO set sync/async for file element owned by context?? return true; } //****************************************************************************************** RtspSinkBintr::RtspSinkBintr(const char* name, const char* host, uint udpPort, uint rtspPort, uint codec, uint bitRate, uint interval) : SinkBintr(name, false, false) , m_host(host) , m_udpPort(udpPort) , m_rtspPort(rtspPort) , m_codec(codec) , m_bitRate(bitRate) , m_interval(interval) , m_pServer(NULL) , m_pFactory(NULL) { LOG_FUNC(); m_pUdpSink = DSL_ELEMENT_NEW("udpsink", "rtsp-sink-bin"); m_pTransform = DSL_ELEMENT_NEW(NVDS_ELEM_VIDEO_CONV, "rtsp-sink-bin-transform"); m_pCapsFilter = DSL_ELEMENT_NEW(NVDS_ELEM_CAPS_FILTER, "rtsp-sink-bin-caps-filter"); m_pUdpSink->SetAttribute("host", m_host.c_str()); m_pUdpSink->SetAttribute("port", m_udpPort); m_pUdpSink->SetAttribute("sync", m_sync); m_pUdpSink->SetAttribute("async", m_async); GstCaps* pCaps = gst_caps_from_string("video/x-raw(memory:NVMM), format=I420"); m_pCapsFilter->SetAttribute("caps", pCaps); gst_caps_unref(pCaps); std::string codecString; switch (codec) { case DSL_CODEC_H264 : m_pEncoder = DSL_ELEMENT_NEW(NVDS_ELEM_ENC_H264_HW, "rtsp-sink-bin-h264-encoder"); m_pParser = DSL_ELEMENT_NEW("h264parse", "rtsp-sink-bin-h264-parser"); m_pPayloader = DSL_ELEMENT_NEW("rtph264pay", "rtsp-sink-bin-h264-payloader"); codecString.assign("H264"); break; case DSL_CODEC_H265 : m_pEncoder = DSL_ELEMENT_NEW(NVDS_ELEM_ENC_H265_HW, "rtsp-sink-bin-h265-encoder"); m_pParser = DSL_ELEMENT_NEW("h265parse", "rtsp-sink-bin-h265-parser"); m_pPayloader = DSL_ELEMENT_NEW("rtph265pay", "rtsp-sink-bin-h265-payloader"); codecString.assign("H265"); break; default: LOG_ERROR("Invalid codec = '" << codec << "' for new Sink '" << name << "'"); throw; } m_pEncoder->SetAttribute("bitrate", m_bitRate); m_pEncoder->SetAttribute("iframeinterval", m_interval); // aarch_64 if (m_cudaDeviceProp.integrated) { m_pEncoder->SetAttribute("preset-level", true); m_pEncoder->SetAttribute("insert-sps-pps", true); m_pEncoder->SetAttribute("bufapi-version", true); } else // x86_64 { m_pEncoder->SetAttribute("gpu-id", m_gpuId); } // Setup the GST RTSP Server m_pServer = gst_rtsp_server_new(); g_object_set(m_pServer, "service", std::to_string(m_rtspPort).c_str(), NULL); std::string udpSrc = "(udpsrc name=pay0 port=" + std::to_string(m_udpPort) + " caps=\"application/x-rtp, media=video, clock-rate=90000, encoding-name=" + codecString + ", payload=96 \")"; // Create a nw RTSP Media Factory and set the launch settings // to the UDP source defined above m_pFactory = gst_rtsp_media_factory_new(); gst_rtsp_media_factory_set_launch(m_pFactory, udpSrc.c_str()); LOG_INFO("UDP Src for RtspSinkBintr '" << GetName() << "' = " << udpSrc); // Get a handle to the Mount-Points object from the new RTSP Server GstRTSPMountPoints* pMounts = gst_rtsp_server_get_mount_points(m_pServer); // Attach the RTSP Media Factory to the mount-point-path in the mounts object. std::string uniquePath = "/" + GetName(); gst_rtsp_mount_points_add_factory(pMounts, uniquePath.c_str(), m_pFactory); g_object_unref(pMounts); AddChild(m_pUdpSink); AddChild(m_pTransform); AddChild(m_pCapsFilter); AddChild(m_pEncoder); AddChild(m_pParser); AddChild(m_pPayloader); } RtspSinkBintr::~RtspSinkBintr() { LOG_FUNC(); if (IsLinked()) { UnlinkAll(); } } bool RtspSinkBintr::LinkAll() { LOG_FUNC(); if (m_isLinked) { LOG_ERROR("RtspSinkBintr '" << GetName() << "' is already linked"); return false; } if (!m_pQueue->LinkToSink(m_pTransform) or !m_pTransform->LinkToSink(m_pCapsFilter) or !m_pCapsFilter->LinkToSink(m_pEncoder) or !m_pEncoder->LinkToSink(m_pParser) or !m_pParser->LinkToSink(m_pPayloader) or !m_pPayloader->LinkToSink(m_pUdpSink)) { return false; } // Attach the server to the Main loop context. Server will accept // connections the once main loop has been started m_pServerSrcId = gst_rtsp_server_attach(m_pServer, NULL); m_isLinked = true; return true; } void RtspSinkBintr::UnlinkAll() { LOG_FUNC(); if (!m_isLinked) { LOG_ERROR("RtspSinkBintr '" << GetName() << "' is not linked"); return; } if (m_pServerSrcId) { // Remove (destroy) the source from the Main loop context g_source_remove(m_pServerSrcId); m_pServerSrcId = 0; } m_pPayloader->UnlinkFromSink(); m_pParser->UnlinkFromSink(); m_pEncoder->UnlinkFromSink(); m_pCapsFilter->UnlinkFromSink(); m_pTransform->UnlinkFromSink(); m_pQueue->UnlinkFromSink(); m_isLinked = false; } void RtspSinkBintr::GetServerSettings(uint* udpPort, uint* rtspPort, uint* codec) { LOG_FUNC(); *udpPort = m_udpPort; *rtspPort = m_rtspPort; *codec = m_codec; } void RtspSinkBintr::GetEncoderSettings(uint* bitRate, uint* interval) { LOG_FUNC(); *bitRate = m_bitRate; *interval = m_interval; } bool RtspSinkBintr::SetEncoderSettings(uint bitRate, uint interval) { LOG_FUNC(); if (IsLinked()) { LOG_ERROR("Unable to set Encoder Settings for FileSinkBintr '" << GetName() << "' as it's currently linked"); return false; } m_bitRate = bitRate; m_interval = interval; if (m_codec == DSL_CODEC_H264 or m_codec == DSL_CODEC_H265) { m_pEncoder->SetAttribute("bitrate", m_bitRate); m_pEncoder->SetAttribute("iframeinterval", m_interval); } return true; } bool RtspSinkBintr::SetSyncSettings(bool sync, bool async) { LOG_FUNC(); if (IsLinked()) { LOG_ERROR("Unable to set Sync/Async Settings for FileSinkBintr '" << GetName() << "' as it's currently linked"); return false; } m_sync = sync; m_async = async; m_pUdpSink->SetAttribute("sync", m_sync); m_pUdpSink->SetAttribute("async", m_async); return true; } } <|start_filename|>Makefile<|end_filename|> ################################################################################ # # The MIT License # # Copyright (c) 2019-2021, Prominence AI, Inc. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in- # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. # ################################################################################ APP:= dsl-test-app CXX = g++ TARGET_DEVICE = $(shell gcc -dumpmachine | cut -f1 -d -) CXX_VERSION:=c++17 DSL_VERSION:='L"v0.20.alpha"' NVDS_VERSION:=5.1 GS_VERSION:=1.0 GLIB_VERSION:=2.0 GSTREAMER_VERSION:=1.0 CUDA_VERSION:=10.2 SRC_INSTALL_DIR?=/opt/nvidia/deepstream/deepstream-$(NVDS_VERSION)/sources INC_INSTALL_DIR?=/opt/nvidia/deepstream/deepstream-$(NVDS_VERSION)/sources/includes LIB_INSTALL_DIR?=/opt/nvidia/deepstream/deepstream-$(NVDS_VERSION)/lib SRCS+= $(wildcard ./src/*.cpp) SRCS+= $(wildcard ./test/*.cpp) SRCS+= $(wildcard ./test/api/*.cpp) SRCS+= $(wildcard ./test/unit/*.cpp) INCS:= $(wildcard ./src/*.h) INCS+= $(wildcard ./test/*.hpp) TEST_OBJS+= $(wildcard ./test/api/*.o) TEST_OBJS+= $(wildcard ./test/unit/*.o) PKGS:= gstreamer-$(GSTREAMER_VERSION) \ gstreamer-video-$(GSTREAMER_VERSION) \ gstreamer-rtsp-server-$(GSTREAMER_VERSION) \ x11 \ opencv4 OBJS:= $(SRCS:.c=.o) OBJS:= $(OBJS:.cpp=.o) CFLAGS+= -I$(INC_INSTALL_DIR) \ -std=$(CXX_VERSION) \ -I$(SRC_INSTALL_DIR)/apps/apps-common/includes \ -I/opt/include \ -I/usr/include \ -I/usr/include/gstreamer-$(GS_VERSION) \ -I/usr/include/glib-$(GLIB_VERSION) \ -I/usr/include/glib-$(GLIB_VERSION)/glib \ -I/usr/lib/$(TARGET_DEVICE)-linux-gnu/glib-$(GLIB_VERSION)/include \ -I/usr/local/cuda-$(CUDA_VERSION)/targets/$(TARGET_DEVICE)-linux/include \ -I./src \ -I./test \ -I./test/api \ -DDSL_VERSION=$(DSL_VERSION) \ -DDS_VERSION_MINOR=0 \ -DDS_VERSION_MAJOR=4 \ -DDSL_LOGGER_IMP='"DslLogGst.h"'\ -DNVDS_DCF_LIB='"$(LIB_INSTALL_DIR)/libnvds_nvdcf.so"' \ -DNVDS_KLT_LIB='"$(LIB_INSTALL_DIR)/libnvds_mot_klt.so"' \ -DNVDS_IOU_LIB='"$(LIB_INSTALL_DIR)/libnvds_mot_iou.so"' \ -fPIC CFLAGS += `geos-config --cflags` LIBS+= -L$(LIB_INSTALL_DIR) \ -laprutil-1 \ -lapr-1 \ -lX11 \ -L/usr/lib/$(TARGET_DEVICE)-linux-gnu \ -lgeos_c \ -lcurl \ -lnvdsgst_meta \ -lnvds_meta \ -lnvdsgst_helper \ -lnvds_utils \ -lnvbufsurface \ -lnvbufsurftransform \ -lnvdsgst_smartrecord \ -lglib-$(GLIB_VERSION) \ -lgstreamer-$(GSTREAMER_VERSION) \ -Lgstreamer-video-$(GSTREAMER_VERSION) \ -Lgstreamer-rtsp-server-$(GSTREAMER_VERSION) \ -L/usr/local/cuda-$(CUDA_VERSION)/lib64/ -lcudart \ -Wl,-rpath,$(LIB_INSTALL_DIR) CFLAGS+= `pkg-config --cflags $(PKGS)` LIBS+= `pkg-config --libs $(PKGS)` all: $(APP) debug: CFLAGS += -DDEBUG -g debug: $(APP) PCH_INC=./src/Dsl.h PCH_OUT=./src/Dsl.h.gch $(PCH_OUT): $(PCH_INC) Makefile $(CXX) -c -o $@ $(CFLAGS) $< %.o: %.cpp $(PCH_OUT) $(INCS) Makefile $(CXX) -c -o $@ $(CFLAGS) $< $(APP): $(OBJS) Makefile @echo $(SRCS) $(CXX) -o $(APP) $(OBJS) $(LIBS) lib: ar rcs dsl-lib.a $(OBJS) ar dv dsl-lib.a DslCatch.o $(TEST_OBJS) $(CXX) -shared $(OBJS) -o dsl-lib.so $(LIBS) cp dsl-lib.so examples/python/ so_lib: $(CXX) -shared $(OBJS) -o dsl-lib.so $(LIBS) cp dsl-lib.so examples/python/ clean: rm -rf $(OBJS) $(APP) dsl-lib.a dsl-lib.so $(PCH_OUT) <|start_filename|>src/DslServices.cpp<|end_filename|> /* The MIT License Copyright (c) 2019-2021, Prominence AI, Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in- all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "Dsl.h" #include "DslApi.h" #include "DslOdeTrigger.h" #include "DslServices.h" #include "DslServicesValidate.h" #include "DslSegVisualBintr.h" #include "DslPadProbeHandler.h" #include "DslTilerBintr.h" #include "DslOsdBintr.h" #include "DslSinkBintr.h" // TODO move these defines to DSL utility file #define INIT_MEMORY(m) memset(&m, 0, sizeof(m)); #define INIT_STRUCT(type, name) struct type name; INIT_MEMORY(name) /** * Function to handle program interrupt signal. * It installs default handler after handling the interrupt. */ static void PrgItrSigIsr(int signum) { dsl_main_loop_quit(); } /** * Function to install custom handler for program interrupt signal. */ static void PrgItrSigIsrInstall(void) { INIT_STRUCT(sigaction, sa); sa.sa_handler = PrgItrSigIsr; sigaction(SIGINT, &sa, NULL); } /** * Function to uninstall custom handler for program interrupt signal. */ static void PrgItrSigIsrUninstall(void) { INIT_STRUCT(sigaction, sa); sa.sa_handler = SIG_DFL; sigaction(SIGINT, &sa, NULL); } void dsl_main_loop_run() { PrgItrSigIsrInstall(); g_main_loop_run(DSL::Services::GetServices()->GetMainLoopHandle()); } void dsl_main_loop_quit() { PrgItrSigIsrUninstall(); g_main_loop_quit(DSL::Services::GetServices()->GetMainLoopHandle()); } const wchar_t* dsl_return_value_to_string(uint result) { return DSL::Services::GetServices()->ReturnValueToString(result); } const wchar_t* dsl_state_value_to_string(uint state) { return DSL::Services::GetServices()->StateValueToString(state); } const wchar_t* dsl_version_get() { return DSL_VERSION; } void geosNoticeHandler(const char *fmt, ...) { // TODO } void geosErrorHandler(const char *fmt, ...) { // TODO } // Single GST debug catagory initialization GST_DEBUG_CATEGORY(GST_CAT_DSL); GQuark _dsmeta_quark; namespace DSL { // Initialize the Services's single instance pointer Services* Services::m_pInstance = NULL; Services* Services::GetServices() { // one time initialization of the single instance pointer if (!m_pInstance) { boolean doGstDeinit(false); // Initialize the single debug category used by the lib GST_DEBUG_CATEGORY_INIT(GST_CAT_DSL, "DSL", 0, "DeepStream Services"); // If gst has not been initialized by the client software if (!gst_is_initialized()) { int argc = 0; char** argv = NULL; // initialize the GStreamer library gst_init(&argc, &argv); doGstDeinit = true; // One-time init of Curl with no addition features CURLcode result = curl_global_init(CURL_GLOBAL_NOTHING); if (result != CURLE_OK) { LOG_ERROR("curl_global_init failed: " << curl_easy_strerror(result)); throw; } curl_version_info_data* info = curl_version_info(CURLVERSION_NOW); LOG_INFO("Libcurl Initialized Successfully"); LOG_INFO("Version: " << info->version); LOG_INFO("Host: " << info->host); LOG_INFO("Features: " << info->features); LOG_INFO("SSL Version: " << info->ssl_version); LOG_INFO("Libz Version: " << info->libz_version); LOG_INFO("Protocols: " << info->protocols); } // Safe to start logging LOG_INFO("Services Initialization"); _dsmeta_quark = g_quark_from_static_string (NVDS_META_STRING); // Single instantiation for the lib's lifetime m_pInstance = new Services(doGstDeinit); // initialization of GEOS initGEOS(geosNoticeHandler, geosErrorHandler); // Initialize private containers m_pInstance->InitToStringMaps(); // Create the default Display types m_pInstance->DisplayTypeCreateIntrinsicTypes(); } return m_pInstance; } Services::Services(bool doGstDeinit) : m_doGstDeinit(doGstDeinit) , m_pMainLoop(g_main_loop_new(NULL, FALSE)) , m_sourceNumInUseMax(DSL_DEFAULT_SOURCE_IN_USE_MAX) , m_sinkNumInUseMax(DSL_DEFAULT_SINK_IN_USE_MAX) { LOG_FUNC(); g_mutex_init(&m_servicesMutex); } Services::~Services() { LOG_FUNC(); { LOCK_MUTEX_FOR_CURRENT_SCOPE(&m_servicesMutex); // Cleanup GEOS finishGEOS(); // Cleanup Lib cURL curl_global_cleanup(); // If this Services object called gst_init(), and not the client. if (m_doGstDeinit) { gst_deinit(); } if (m_pMainLoop) { g_main_loop_unref(m_pMainLoop); } } g_mutex_clear(&m_servicesMutex); } void Services::DeleteAll() { LOG_FUNC(); // DO NOT lock mutex - will be done by each service PipelineDeleteAll(); PlayerDeleteAll(false); ComponentDeleteAll(); PphDeleteAll(); OdeTriggerDeleteAll(); OdeAreaDeleteAll(); OdeActionDeleteAll(); DisplayTypeDeleteAll(); MailerDeleteAll(); } DslReturnType Services::StdOutRedirect(const char* filepath) { LOG_FUNC(); LOCK_MUTEX_FOR_CURRENT_SCOPE(&m_servicesMutex); try { if (m_stdOutRedirectFile.is_open()) { LOG_ERROR("stdout is currently/already in a redirected state"); return DSL_RESULT_FAILURE; } // backup the default m_stdOutRdBufBackup = std::cout.rdbuf(); // open the redirect file and the rdbuf m_stdOutRedirectFile.open(filepath, std::ios::out); std::streambuf* redirectFileRdBuf = m_stdOutRedirectFile.rdbuf(); // assign the file's rdbuf to the stdout's std::cout.rdbuf(redirectFileRdBuf); return DSL_RESULT_SUCCESS; } catch(...) { LOG_ERROR("DSL threw an exception redirecting stdout"); return DSL_RESULT_THREW_EXCEPTION; } } void Services::StdOutRestore() { LOCK_MUTEX_FOR_CURRENT_SCOPE(&m_servicesMutex); try { if (!m_stdOutRedirectFile.is_open()) { LOG_ERROR("stdout is not currently in a redirected state"); return; } // restore the stdout to the initial backupt std::cout.rdbuf(m_stdOutRdBufBackup); // close the redirct file m_stdOutRedirectFile.close(); } catch(...) { LOG_ERROR("DSL threw an exception close stdout redirect file"); } } // ------------------------------------------------------------------------------ const wchar_t* Services::ReturnValueToString(uint result) { LOG_FUNC(); if (m_returnValueToString.find(result) == m_returnValueToString.end()) { LOG_ERROR("Invalid result = " << result << " unable to convert to string"); return m_returnValueToString[DSL_RESULT_INVALID_RESULT_CODE].c_str(); } std::string cstrResult(m_returnValueToString[result].begin(), m_returnValueToString[result].end()); LOG_INFO("Result = " << result << " = " << cstrResult); return m_returnValueToString[result].c_str(); } const wchar_t* Services::StateValueToString(uint state) { LOG_FUNC(); if (m_stateValueToString.find(state) == m_stateValueToString.end()) { state = DSL_STATE_UNKNOWN; } std::string cstrState(m_stateValueToString[state].begin(), m_stateValueToString[state].end()); LOG_INFO("State = " << state << " = " << cstrState); return m_stateValueToString[state].c_str(); } void Services::InitToStringMaps() { LOG_FUNC(); m_mapParserTypes[DSL_SOURCE_CODEC_PARSER_H264] = "h264parse"; m_mapParserTypes[DSL_SOURCE_CODEC_PARSER_H265] = "h265parse"; m_stateValueToString[DSL_STATE_NULL] = L"DSL_STATE_NULL"; m_stateValueToString[DSL_STATE_READY] = L"DSL_STATE_READY"; m_stateValueToString[DSL_STATE_PAUSED] = L"DSL_STATE_PAUSED"; m_stateValueToString[DSL_STATE_PLAYING] = L"DSL_STATE_PLAYING"; m_stateValueToString[DSL_STATE_CHANGE_ASYNC] = L"DSL_STATE_CHANGE_ASYNC"; m_stateValueToString[DSL_STATE_UNKNOWN] = L"DSL_STATE_UNKNOWN"; m_returnValueToString[DSL_RESULT_SUCCESS] = L"DSL_RESULT_SUCCESS"; m_returnValueToString[DSL_RESULT_FAILURE] = L"DSL_RESULT_FAILURE"; m_returnValueToString[DSL_RESULT_INVALID_INPUT_PARAM] = L"DSL_RESULT_INVALID_INPUT_PARAM"; m_returnValueToString[DSL_RESULT_THREW_EXCEPTION] = L"DSL_RESULT_THREW_EXCEPTION"; m_returnValueToString[DSL_RESULT_COMPONENT_NAME_NOT_UNIQUE] = L"DSL_RESULT_COMPONENT_NAME_NOT_UNIQUE"; m_returnValueToString[DSL_RESULT_COMPONENT_NAME_NOT_FOUND] = L"DSL_RESULT_COMPONENT_NAME_NOT_FOUND"; m_returnValueToString[DSL_RESULT_COMPONENT_NAME_BAD_FORMAT] = L"DSL_RESULT_COMPONENT_NAME_BAD_FORMAT"; m_returnValueToString[DSL_RESULT_COMPONENT_THREW_EXCEPTION] = L"DSL_RESULT_COMPONENT_THREW_EXCEPTION"; m_returnValueToString[DSL_RESULT_COMPONENT_IN_USE] = L"DSL_RESULT_COMPONENT_IN_USE"; m_returnValueToString[DSL_RESULT_COMPONENT_NOT_USED_BY_PIPELINE] = L"DSL_RESULT_COMPONENT_NOT_USED_BY_PIPELINE"; m_returnValueToString[DSL_RESULT_COMPONENT_NOT_USED_BY_BRANCH] = L"DSL_RESULT_COMPONENT_NOT_USED_BY_BRANCH"; m_returnValueToString[DSL_RESULT_COMPONENT_NOT_THE_CORRECT_TYPE] = L"DSL_RESULT_COMPONENT_NOT_THE_CORRECT_TYPE"; m_returnValueToString[DSL_RESULT_COMPONENT_SET_GPUID_FAILED] = L"DSL_RESULT_COMPONENT_SET_GPUID_FAILED"; m_returnValueToString[DSL_RESULT_SOURCE_NAME_NOT_UNIQUE] = L"DSL_RESULT_SOURCE_NAME_NOT_UNIQUE"; m_returnValueToString[DSL_RESULT_SOURCE_NAME_NOT_FOUND] = L"DSL_RESULT_SOURCE_NAME_NOT_FOUND"; m_returnValueToString[DSL_RESULT_SOURCE_NAME_BAD_FORMAT] = L"DSL_RESULT_SOURCE_NAME_BAD_FORMAT"; m_returnValueToString[DSL_RESULT_SOURCE_THREW_EXCEPTION] = L"DSL_RESULT_SOURCE_THREW_EXCEPTION"; m_returnValueToString[DSL_RESULT_SOURCE_FILE_NOT_FOUND] = L"DSL_RESULT_SOURCE_FILE_NOT_FOUND"; m_returnValueToString[DSL_RESULT_SOURCE_NOT_IN_USE] = L"DSL_RESULT_SOURCE_NOT_IN_USE"; m_returnValueToString[DSL_RESULT_SOURCE_NOT_IN_PLAY] = L"DSL_RESULT_SOURCE_NOT_IN_PLAY"; m_returnValueToString[DSL_RESULT_SOURCE_NOT_IN_PAUSE] = L"DSL_RESULT_SOURCE_NOT_IN_PAUSE"; m_returnValueToString[DSL_RESULT_SOURCE_FAILED_TO_CHANGE_STATE] = L"DSL_RESULT_SOURCE_FAILED_TO_CHANGE_STATE"; m_returnValueToString[DSL_RESULT_SOURCE_CODEC_PARSER_INVALID] = L"DSL_RESULT_SOURCE_CODEC_PARSER_INVALID"; m_returnValueToString[DSL_RESULT_SOURCE_DEWARPER_ADD_FAILED] = L"DSL_RESULT_SOURCE_DEWARPER_ADD_FAILED"; m_returnValueToString[DSL_RESULT_SOURCE_DEWARPER_REMOVE_FAILED] = L"DSL_RESULT_SOURCE_DEWARPER_REMOVE_FAILED"; m_returnValueToString[DSL_RESULT_SOURCE_TAP_ADD_FAILED] = L"DSL_RESULT_SOURCE_TAP_ADD_FAILED"; m_returnValueToString[DSL_RESULT_SOURCE_TAP_REMOVE_FAILED] = L"DSL_RESULT_SOURCE_TAP_REMOVE_FAILED"; m_returnValueToString[DSL_RESULT_SOURCE_COMPONENT_IS_NOT_SOURCE] = L"DSL_RESULT_SOURCE_COMPONENT_IS_NOT_SOURCE"; m_returnValueToString[DSL_RESULT_SOURCE_CALLBACK_ADD_FAILED] = L"DSL_RESULT_SOURCE_CALLBACK_ADD_FAILED"; m_returnValueToString[DSL_RESULT_SOURCE_CALLBACK_REMOVE_FAILED] = L"DSL_RESULT_SOURCE_CALLBACK_REMOVE_FAILED"; m_returnValueToString[DSL_RESULT_SOURCE_SET_FAILED] = L"DSL_RESULT_SOURCE_SET_FAILED"; m_returnValueToString[DSL_RESULT_DEWARPER_NAME_NOT_UNIQUE] = L"DSL_RESULT_DEWARPER_NAME_NOT_UNIQUE"; m_returnValueToString[DSL_RESULT_DEWARPER_NAME_NOT_FOUND] = L"DSL_RESULT_DEWARPER_NAME_NOT_FOUND"; m_returnValueToString[DSL_RESULT_DEWARPER_NAME_BAD_FORMAT] = L"DSL_RESULT_DEWARPER_NAME_BAD_FORMAT"; m_returnValueToString[DSL_RESULT_DEWARPER_THREW_EXCEPTION] = L"DSL_RESULT_DEWARPER_THREW_EXCEPTION"; m_returnValueToString[DSL_RESULT_DEWARPER_CONFIG_FILE_NOT_FOUND] = L"DSL_RESULT_DEWARPER_CONFIG_FILE_NOT_FOUND"; m_returnValueToString[DSL_RESULT_TRACKER_NAME_NOT_UNIQUE] = L"DSL_RESULT_TRACKER_NAME_NOT_UNIQUE"; m_returnValueToString[DSL_RESULT_TRACKER_NAME_NOT_FOUND] = L"DSL_RESULT_TRACKER_NAME_NOT_FOUND"; m_returnValueToString[DSL_RESULT_TRACKER_NAME_BAD_FORMAT] = L"DSL_RESULT_TRACKER_NAME_BAD_FORMAT"; m_returnValueToString[DSL_RESULT_TRACKER_THREW_EXCEPTION] = L"DSL_RESULT_TRACKER_THREW_EXCEPTION"; m_returnValueToString[DSL_RESULT_TRACKER_CONFIG_FILE_NOT_FOUND] = L"DSL_RESULT_TRACKER_CONFIG_FILE_NOT_FOUND"; m_returnValueToString[DSL_RESULT_TRACKER_IS_IN_USE] = L"DSL_RESULT_TRACKER_IS_IN_USE"; m_returnValueToString[DSL_RESULT_TRACKER_SET_FAILED] = L"DSL_RESULT_TRACKER_SET_FAILED"; m_returnValueToString[DSL_RESULT_TRACKER_HANDLER_ADD_FAILED] = L"DSL_RESULT_TRACKER_HANDLER_ADD_FAILED"; m_returnValueToString[DSL_RESULT_TRACKER_HANDLER_REMOVE_FAILED] = L"DSL_RESULT_TRACKER_HANDLER_REMOVE_FAILED"; m_returnValueToString[DSL_RESULT_TRACKER_PAD_TYPE_INVALID] = L"DSL_RESULT_TRACKER_PAD_TYPE_INVALID"; m_returnValueToString[DSL_RESULT_TRACKER_COMPONENT_IS_NOT_TRACKER] = L"DSL_RESULT_TRACKER_COMPONENT_IS_NOT_TRACKER"; m_returnValueToString[DSL_RESULT_PPH_NAME_NOT_UNIQUE] = L"DSL_RESULT_PPH_NAME_NOT_UNIQUE"; m_returnValueToString[DSL_RESULT_PPH_NAME_NOT_FOUND] = L"DSL_RESULT_PPH_NAME_NOT_FOUND"; m_returnValueToString[DSL_RESULT_PPH_NAME_BAD_FORMAT] = L"DSL_RESULT_PPH_NAME_BAD_FORMAT"; m_returnValueToString[DSL_RESULT_PPH_THREW_EXCEPTION] = L"DSL_RESULT_PPH_THREW_EXCEPTION"; m_returnValueToString[DSL_RESULT_PPH_IS_IN_USE] = L"DSL_RESULT_PPH_IS_IN_USE"; m_returnValueToString[DSL_RESULT_PPH_SET_FAILED] = L"DSL_RESULT_PPH_SET_FAILED"; m_returnValueToString[DSL_RESULT_PPH_ODE_TRIGGER_ADD_FAILED] = L"DSL_RESULT_PPH_ODE_TRIGGER_ADD_FAILED"; m_returnValueToString[DSL_RESULT_PPH_ODE_TRIGGER_REMOVE_FAILED] = L"DSL_RESULT_PPH_ODE_TRIGGER_REMOVE_FAILED"; m_returnValueToString[DSL_RESULT_PPH_ODE_TRIGGER_NOT_IN_USE] = L"DSL_RESULT_PPH_ODE_TRIGGER_NOT_IN_USE"; m_returnValueToString[DSL_RESULT_PPH_METER_INVALID_INTERVAL] = L"DSL_RESULT_PPH_METER_INVALID_INTERVAL"; m_returnValueToString[DSL_RESULT_ODE_TRIGGER_NAME_NOT_UNIQUE] = L"DSL_RESULT_ODE_TRIGGER_NAME_NOT_UNIQUE"; m_returnValueToString[DSL_RESULT_ODE_TRIGGER_NAME_NOT_FOUND] = L"DSL_RESULT_ODE_TRIGGER_NAME_NOT_FOUND"; m_returnValueToString[DSL_RESULT_ODE_TRIGGER_THREW_EXCEPTION] = L"DSL_RESULT_ODE_TRIGGER_THREW_EXCEPTION"; m_returnValueToString[DSL_RESULT_ODE_TRIGGER_IN_USE] = L"DSL_RESULT_ODE_TRIGGER_IN_USE"; m_returnValueToString[DSL_RESULT_ODE_TRIGGER_SET_FAILED] = L"DSL_RESULT_ODE_TRIGGER_SET_FAILED"; m_returnValueToString[DSL_RESULT_ODE_TRIGGER_IS_NOT_ODE_TRIGGER] = L"DSL_RESULT_ODE_TRIGGER_IS_NOT_ODE_TRIGGER"; m_returnValueToString[DSL_RESULT_ODE_TRIGGER_ACTION_ADD_FAILED] = L"DSL_RESULT_ODE_TRIGGER_ACTION_ADD_FAILED"; m_returnValueToString[DSL_RESULT_ODE_TRIGGER_ACTION_REMOVE_FAILED] = L"DSL_RESULT_ODE_TRIGGER_ACTION_REMOVE_FAILED"; m_returnValueToString[DSL_RESULT_ODE_TRIGGER_ACTION_NOT_IN_USE] = L"DSL_RESULT_ODE_TRIGGER_ACTION_NOT_IN_USE"; m_returnValueToString[DSL_RESULT_ODE_TRIGGER_AREA_ADD_FAILED] = L"DSL_RESULT_ODE_TRIGGER_AREA_ADD_FAILED"; m_returnValueToString[DSL_RESULT_ODE_TRIGGER_AREA_REMOVE_FAILED] = L"DSL_RESULT_ODE_TRIGGER_AREA_REMOVE_FAILED"; m_returnValueToString[DSL_RESULT_ODE_TRIGGER_AREA_NOT_IN_USE] = L"DSL_RESULT_ODE_TRIGGER_AREA_NOT_IN_USE"; m_returnValueToString[DSL_RESULT_ODE_TRIGGER_CLIENT_CALLBACK_INVALID] = L"DSL_RESULT_ODE_TRIGGER_CLIENT_CALLBACK_INVALID"; m_returnValueToString[DSL_RESULT_ODE_TRIGGER_PARAMETER_INVALID] = L"DSL_RESULT_ODE_TRIGGER_PARAMETER_INVALID"; m_returnValueToString[DSL_RESULT_ODE_TRIGGER_IS_NOT_AB_TYPE] = L"DSL_RESULT_ODE_TRIGGER_IS_NOT_AB_TYPE"; m_returnValueToString[DSL_RESULT_ODE_ACTION_NAME_NOT_UNIQUE] = L"DSL_RESULT_ODE_ACTION_NAME_NOT_UNIQUE"; m_returnValueToString[DSL_RESULT_ODE_ACTION_NAME_NOT_FOUND] = L"DSL_RESULT_ODE_ACTION_NAME_NOT_FOUND"; m_returnValueToString[DSL_RESULT_ODE_ACTION_THREW_EXCEPTION] = L"DSL_RESULT_ODE_ACTION_THREW_EXCEPTION"; m_returnValueToString[DSL_RESULT_ODE_ACTION_IN_USE] = L"DSL_RESULT_ODE_ACTION_IN_USE"; m_returnValueToString[DSL_RESULT_ODE_ACTION_SET_FAILED] = L"DSL_RESULT_ODE_ACTION_SET_FAILED"; m_returnValueToString[DSL_RESULT_ODE_ACTION_IS_NOT_ACTION] = L"DSL_RESULT_ODE_ACTION_IS_NOT_ACTION"; m_returnValueToString[DSL_RESULT_ODE_ACTION_FILE_PATH_NOT_FOUND] = L"DSL_RESULT_ODE_ACTION_FILE_PATH_NOT_FOUND"; m_returnValueToString[DSL_RESULT_ODE_ACTION_CAPTURE_TYPE_INVALID] = L"DSL_RESULT_ODE_ACTION_CAPTURE_TYPE_INVALID"; m_returnValueToString[DSL_RESULT_ODE_ACTION_PLAYER_ADD_FAILED] = L"DSL_RESULT_ODE_ACTION_PLAYER_ADD_FAILED"; m_returnValueToString[DSL_RESULT_ODE_ACTION_PLAYER_REMOVE_FAILED] = L"DSL_RESULT_ODE_ACTION_PLAYER_REMOVE_FAILED"; m_returnValueToString[DSL_RESULT_ODE_ACTION_MAILER_ADD_FAILED] = L"DSL_RESULT_ODE_ACTION_MAILER_ADD_FAILED"; m_returnValueToString[DSL_RESULT_ODE_ACTION_MAILER_REMOVE_FAILED] = L"DSL_RESULT_ODE_ACTION_MAILER_REMOVE_FAILED"; m_returnValueToString[DSL_RESULT_ODE_ACTION_NOT_THE_CORRECT_TYPE] = L"DSL_RESULT_ODE_ACTION_NOT_THE_CORRECT_TYPE"; m_returnValueToString[DSL_RESULT_ODE_ACTION_CALLBACK_ADD_FAILED] = L"DSL_RESULT_ODE_ACTION_CALLBACK_ADD_FAILED"; m_returnValueToString[DSL_RESULT_ODE_ACTION_PARAMETER_INVALID] = L"DSL_RESULT_ODE_ACTION_PARAMETER_INVALID"; m_returnValueToString[DSL_RESULT_ODE_ACTION_CALLBACK_REMOVE_FAILED] = L"DSL_RESULT_ODE_ACTION_CALLBACK_REMOVE_FAILED"; m_returnValueToString[DSL_RESULT_ODE_AREA_NAME_NOT_UNIQUE] = L"DSL_RESULT_ODE_AREA_NAME_NOT_UNIQUE"; m_returnValueToString[DSL_RESULT_ODE_AREA_NAME_NOT_FOUND] = L"DSL_RESULT_ODE_AREA_NAME_NOT_FOUND"; m_returnValueToString[DSL_RESULT_ODE_AREA_THREW_EXCEPTION] = L"DSL_RESULT_ODE_AREA_THREW_EXCEPTION"; m_returnValueToString[DSL_RESULT_ODE_AREA_PARAMETER_INVALID] = L"DSL_RESULT_ODE_AREA_PARAMETER_INVALID"; m_returnValueToString[DSL_RESULT_ODE_AREA_SET_FAILED] = L"DSL_RESULT_ODE_AREA_SET_FAILED"; m_returnValueToString[DSL_RESULT_SINK_NAME_NOT_UNIQUE] = L"DSL_RESULT_SINK_NAME_NOT_UNIQUE"; m_returnValueToString[DSL_RESULT_SINK_NAME_NOT_FOUND] = L"DSL_RESULT_SINK_NAME_NOT_FOUND"; m_returnValueToString[DSL_RESULT_SINK_NAME_BAD_FORMAT] = L"DSL_RESULT_SINK_NAME_BAD_FORMAT"; m_returnValueToString[DSL_RESULT_SINK_THREW_EXCEPTION] = L"DSL_RESULT_SINK_THREW_EXCEPTION"; m_returnValueToString[DSL_RESULT_SINK_FILE_PATH_NOT_FOUND] = L"DSL_RESULT_SINK_FILE_PATH_NOT_FOUND"; m_returnValueToString[DSL_RESULT_SINK_IS_IN_USE] = L"DSL_RESULT_SINK_IS_IN_USE"; m_returnValueToString[DSL_RESULT_SINK_SET_FAILED] = L"DSL_RESULT_SINK_SET_FAILED"; m_returnValueToString[DSL_RESULT_SINK_CODEC_VALUE_INVALID] = L"DSL_RESULT_SINK_CODEC_VALUE_INVALID"; m_returnValueToString[DSL_RESULT_SINK_CONTAINER_VALUE_INVALID] = L"DSL_RESULT_SINK_CONTAINER_VALUE_INVALID"; m_returnValueToString[DSL_RESULT_SINK_COMPONENT_IS_NOT_SINK] = L"DSL_RESULT_SINK_COMPONENT_IS_NOT_SINK"; m_returnValueToString[DSL_RESULT_SINK_COMPONENT_IS_NOT_ENCODE_SINK] = L"DSL_RESULT_SINK_COMPONENT_IS_NOT_ENCODE_SINK"; m_returnValueToString[DSL_RESULT_SINK_COMPONENT_IS_NOT_RENDER_SINK] = L"DSL_RESULT_SINK_COMPONENT_IS_NOT_RENDER_SINK"; m_returnValueToString[DSL_RESULT_SINK_OBJECT_CAPTURE_CLASS_ADD_FAILED] = L"DSL_RESULT_SINK_OBJECT_CAPTURE_CLASS_ADD_FAILED"; m_returnValueToString[DSL_RESULT_SINK_OBJECT_CAPTURE_CLASS_REMOVE_FAILED] = L"DSL_RESULT_SINK_OBJECT_CAPTURE_CLASS_REMOVE_FAILED"; m_returnValueToString[DSL_RESULT_SINK_HANDLER_ADD_FAILED] = L"DSL_RESULT_SINK_HANDLER_ADD_FAILED"; m_returnValueToString[DSL_RESULT_SINK_HANDLER_REMOVE_FAILED] = L"DSL_RESULT_SINK_HANDLER_REMOVE_FAILED"; m_returnValueToString[DSL_RESULT_SINK_PLAYER_ADD_FAILED] = L"DSL_RESULT_SINK_PLAYER_ADD_FAILED"; m_returnValueToString[DSL_RESULT_SINK_PLAYER_REMOVE_FAILED] = L"DSL_RESULT_SINK_PLAYER_REMOVE_FAILED"; m_returnValueToString[DSL_RESULT_SINK_MAILER_ADD_FAILED] = L"DSL_RESULT_SINK_MAILER_ADD_FAILED"; m_returnValueToString[DSL_RESULT_SINK_MAILER_REMOVE_FAILED] = L"DSL_RESULT_SINK_MAILER_REMOVE_FAILED"; m_returnValueToString[DSL_RESULT_SINK_OVERLAY_NOT_SUPPORTED] = L"DSL_RESULT_SINK_OVERLAY_NOT_SUPPORTED"; m_returnValueToString[DSL_RESULT_OSD_NAME_NOT_UNIQUE] = L"DSL_RESULT_OSD_NAME_NOT_UNIQUE"; m_returnValueToString[DSL_RESULT_OSD_NAME_NOT_FOUND] = L"DSL_RESULT_OSD_NAME_NOT_FOUND"; m_returnValueToString[DSL_RESULT_OSD_NAME_BAD_FORMAT] = L"DSL_RESULT_OSD_NAME_BAD_FORMAT"; m_returnValueToString[DSL_RESULT_OSD_THREW_EXCEPTION] = L"DSL_RESULT_OSD_THREW_EXCEPTION"; m_returnValueToString[DSL_RESULT_OSD_MAX_DIMENSIONS_INVALID] = L"DSL_RESULT_OSD_MAX_DIMENSIONS_INVALID"; m_returnValueToString[DSL_RESULT_OSD_IS_IN_USE] = L"DSL_RESULT_OSD_IS_IN_USE"; m_returnValueToString[DSL_RESULT_OSD_SET_FAILED] = L"DSL_RESULT_OSD_SET_FAILED"; m_returnValueToString[DSL_RESULT_OSD_HANDLER_ADD_FAILED] = L"DSL_RESULT_OSD_HANDLER_ADD_FAILED"; m_returnValueToString[DSL_RESULT_OSD_HANDLER_REMOVE_FAILED] = L"DSL_RESULT_OSD_HANDLER_REMOVE_FAILED"; m_returnValueToString[DSL_RESULT_OSD_PAD_TYPE_INVALID] = L"DSL_RESULT_OSD_PAD_TYPE_INVALID"; m_returnValueToString[DSL_RESULT_OSD_COMPONENT_IS_NOT_OSD] = L"DSL_RESULT_OSD_COMPONENT_IS_NOT_OSD"; m_returnValueToString[DSL_RESULT_OSD_COLOR_PARAM_INVALID] = L"DSL_RESULT_OSD_COLOR_PARAM_INVALID"; m_returnValueToString[DSL_RESULT_INFER_NAME_NOT_UNIQUE] = L"DSL_RESULT_INFER_NAME_NOT_UNIQUE"; m_returnValueToString[DSL_RESULT_INFER_NAME_NOT_FOUND] = L"DSL_RESULT_INFER_NAME_NOT_FOUND"; m_returnValueToString[DSL_RESULT_INFER_NAME_BAD_FORMAT] = L"DSL_RESULT_INFER_NAME_BAD_FORMAT"; m_returnValueToString[DSL_RESULT_INFER_CONFIG_FILE_NOT_FOUND] = L"DSL_RESULT_INFER_CONFIG_FILE_NOT_FOUND"; m_returnValueToString[DSL_RESULT_INFER_MODEL_FILE_NOT_FOUND] = L"DSL_RESULT_INFER_MODEL_FILE_NOT_FOUND"; m_returnValueToString[DSL_RESULT_INFER_THREW_EXCEPTION] = L"DSL_RESULT_INFER_THREW_EXCEPTION"; m_returnValueToString[DSL_RESULT_INFER_IS_IN_USE] = L"DSL_RESULT_INFER_IS_IN_USE"; m_returnValueToString[DSL_RESULT_INFER_SET_FAILED] = L"DSL_RESULT_INFER_SET_FAILED"; m_returnValueToString[DSL_RESULT_INFER_HANDLER_ADD_FAILED] = L"DSL_RESULT_INFER_HANDLER_ADD_FAILED"; m_returnValueToString[DSL_RESULT_INFER_HANDLER_REMOVE_FAILED] = L"DSL_RESULT_INFER_HANDLER_REMOVE_FAILED"; m_returnValueToString[DSL_RESULT_INFER_PAD_TYPE_INVALID] = L"DSL_RESULT_INFER_PAD_TYPE_INVALID"; m_returnValueToString[DSL_RESULT_INFER_COMPONENT_IS_NOT_INFER] = L"DSL_RESULT_INFER_COMPONENT_IS_NOT_INFER"; m_returnValueToString[DSL_RESULT_INFER_OUTPUT_DIR_DOES_NOT_EXIST] = L"DSL_RESULT_INFER_OUTPUT_DIR_DOES_NOT_EXIST"; m_returnValueToString[DSL_RESULT_SEGVISUAL_NAME_NOT_UNIQUE] = L"DSL_RESULT_SEGVISUAL_NAME_NOT_UNIQUE"; m_returnValueToString[DSL_RESULT_SEGVISUAL_NAME_NOT_FOUND] = L"DSL_RESULT_SEGVISUAL_NAME_NOT_FOUND"; m_returnValueToString[DSL_RESULT_SEGVISUAL_THREW_EXCEPTION] = L"DSL_RESULT_SEGVISUAL_THREW_EXCEPTION"; m_returnValueToString[DSL_RESULT_SEGVISUAL_IN_USE] = L"DSL_RESULT_SEGVISUAL_IN_USE"; m_returnValueToString[DSL_RESULT_SEGVISUAL_SET_FAILED] = L"DSL_RESULT_SEGVISUAL_SET_FAILED"; m_returnValueToString[DSL_RESULT_SEGVISUAL_PARAMETER_INVALID] = L"DSL_RESULT_SEGVISUAL_PARAMETER_INVALID"; m_returnValueToString[DSL_RESULT_SEGVISUAL_HANDLER_ADD_FAILED] = L"DSL_RESULT_SEGVISUAL_HANDLER_ADD_FAILED"; m_returnValueToString[DSL_RESULT_SEGVISUAL_HANDLER_REMOVE_FAILED] = L"DSL_RESULT_SEGVISUAL_HANDLER_REMOVE_FAILED"; m_returnValueToString[DSL_RESULT_TEE_NAME_NOT_UNIQUE] = L"DSL_RESULT_TEE_NAME_NOT_UNIQUE"; m_returnValueToString[DSL_RESULT_TEE_NAME_NOT_FOUND] = L"DSL_RESULT_TEE_NAME_NOT_FOUND"; m_returnValueToString[DSL_RESULT_TEE_NAME_BAD_FORMAT] = L"DSL_RESULT_TEE_NAME_BAD_FORMAT"; m_returnValueToString[DSL_RESULT_TEE_THREW_EXCEPTION] = L"DSL_RESULT_TEE_THREW_EXCEPTION"; m_returnValueToString[DSL_RESULT_TEE_BRANCH_IS_NOT_CHILD] = L"DSL_RESULT_TEE_BRANCH_IS_NOT_CHILD"; m_returnValueToString[DSL_RESULT_TEE_BRANCH_IS_NOT_BRANCH] = L"DSL_RESULT_TEE_BRANCH_IS_NOT_BRANCH"; m_returnValueToString[DSL_RESULT_TEE_BRANCH_ADD_FAILED] = L"DSL_RESULT_TEE_BRANCH_ADD_FAILED"; m_returnValueToString[DSL_RESULT_TEE_BRANCH_REMOVE_FAILED] = L"DSL_RESULT_TEE_BRANCH_REMOVE_FAILED"; m_returnValueToString[DSL_RESULT_TEE_HANDLER_ADD_FAILED] = L"DSL_RESULT_TEE_HANDLER_ADD_FAILED"; m_returnValueToString[DSL_RESULT_TEE_HANDLER_REMOVE_FAILED] = L"DSL_RESULT_TEE_HANDLER_REMOVE_FAILED"; m_returnValueToString[DSL_RESULT_TEE_COMPONENT_IS_NOT_TEE] = L"DSL_RESULT_TEE_COMPONENT_IS_NOT_TEE"; m_returnValueToString[DSL_RESULT_TILER_NAME_NOT_UNIQUE] = L"DSL_RESULT_TILER_NAME_NOT_UNIQUE"; m_returnValueToString[DSL_RESULT_TILER_NAME_NOT_FOUND] = L"DSL_RESULT_TILER_NAME_NOT_FOUND"; m_returnValueToString[DSL_RESULT_TILER_NAME_BAD_FORMAT] = L"DSL_RESULT_TILER_NAME_BAD_FORMAT"; m_returnValueToString[DSL_RESULT_TILER_THREW_EXCEPTION] = L"DSL_RESULT_TILER_THREW_EXCEPTION"; m_returnValueToString[DSL_RESULT_TILER_IS_IN_USE] = L"DSL_RESULT_TILER_IS_IN_USE"; m_returnValueToString[DSL_RESULT_TILER_SET_FAILED] = L"DSL_RESULT_TILER_SET_FAILED"; m_returnValueToString[DSL_RESULT_TILER_HANDLER_ADD_FAILED] = L"DSL_RESULT_TILER_HANDLER_ADD_FAILED"; m_returnValueToString[DSL_RESULT_TILER_HANDLER_REMOVE_FAILED] = L"DSL_RESULT_TILER_HANDLER_REMOVE_FAILED"; m_returnValueToString[DSL_RESULT_TILER_PAD_TYPE_INVALID] = L"DSL_RESULT_TILER_PAD_TYPE_INVALID"; m_returnValueToString[DSL_RESULT_TILER_COMPONENT_IS_NOT_TILER] = L"DSL_RESULT_TILER_COMPONENT_IS_NOT_TILER"; m_returnValueToString[DSL_RESULT_BRANCH_RESULT] = L"DSL_RESULT_BRANCH_RESULT"; m_returnValueToString[DSL_RESULT_BRANCH_NAME_NOT_UNIQUE] = L"DSL_RESULT_BRANCH_NAME_NOT_UNIQUE"; m_returnValueToString[DSL_RESULT_BRANCH_NAME_NOT_FOUND] = L"DSL_RESULT_BRANCH_NAME_NOT_FOUND"; m_returnValueToString[DSL_RESULT_BRANCH_NAME_BAD_FORMAT] = L"DSL_RESULT_BRANCH_NAME_BAD_FORMAT"; m_returnValueToString[DSL_RESULT_BRANCH_THREW_EXCEPTION] = L"DSL_RESULT_BRANCH_THREW_EXCEPTION"; m_returnValueToString[DSL_RESULT_BRANCH_COMPONENT_ADD_FAILED] = L"DSL_RESULT_BRANCH_COMPONENT_ADD_FAILED"; m_returnValueToString[DSL_RESULT_BRANCH_COMPONENT_REMOVE_FAILED] = L"DSL_RESULT_BRANCH_COMPONENT_REMOVE_FAILED"; m_returnValueToString[DSL_RESULT_BRANCH_SOURCE_NOT_ALLOWED] = L"DSL_RESULT_BRANCH_SOURCE_NOT_ALLOWED"; m_returnValueToString[DSL_RESULT_BRANCH_SINK_MAX_IN_USE_REACHED] = L"DSL_RESULT_BRANCH_SINK_MAX_IN_USE_REACHED"; m_returnValueToString[DSL_RESULT_PIPELINE_RESULT] = L"DSL_RESULT_PIPELINE_RESULT"; m_returnValueToString[DSL_RESULT_PIPELINE_NAME_NOT_UNIQUE] = L"DSL_RESULT_PIPELINE_NAME_NOT_UNIQUE"; m_returnValueToString[DSL_RESULT_PIPELINE_NAME_NOT_FOUND] = L"DSL_RESULT_PIPELINE_NAME_NOT_FOUND"; m_returnValueToString[DSL_RESULT_PIPELINE_NAME_BAD_FORMAT] = L"DSL_RESULT_PIPELINE_NAME_BAD_FORMAT"; m_returnValueToString[DSL_RESULT_PIPELINE_STATE_PAUSED] = L"DSL_RESULT_PIPELINE_STATE_PAUSED"; m_returnValueToString[DSL_RESULT_PIPELINE_STATE_RUNNING] = L"DSL_RESULT_PIPELINE_STATE_RUNNING"; m_returnValueToString[DSL_RESULT_PIPELINE_THREW_EXCEPTION] = L"DSL_RESULT_PIPELINE_THREW_EXCEPTION"; m_returnValueToString[DSL_RESULT_PIPELINE_COMPONENT_ADD_FAILED] = L"DSL_RESULT_PIPELINE_COMPONENT_ADD_FAILED"; m_returnValueToString[DSL_RESULT_PIPELINE_COMPONENT_REMOVE_FAILED] = L"DSL_RESULT_PIPELINE_COMPONENT_REMOVE_FAILED"; m_returnValueToString[DSL_RESULT_PIPELINE_STREAMMUX_GET_FAILED] = L"DSL_RESULT_PIPELINE_STREAMMUX_GET_FAILED"; m_returnValueToString[DSL_RESULT_PIPELINE_STREAMMUX_SET_FAILED] = L"DSL_RESULT_PIPELINE_STREAMMUX_SET_FAILED"; m_returnValueToString[DSL_RESULT_PIPELINE_XWINDOW_GET_FAILED] = L"DSL_RESULT_PIPELINE_XWINDOW_GET_FAILED"; m_returnValueToString[DSL_RESULT_PIPELINE_XWINDOW_SET_FAILED] = L"DSL_RESULT_PIPELINE_XWINDOW_SET_FAILED"; m_returnValueToString[DSL_RESULT_PIPELINE_CALLBACK_ADD_FAILED] = L"DSL_RESULT_PIPELINE_CALLBACK_ADD_FAILED"; m_returnValueToString[DSL_RESULT_PIPELINE_CALLBACK_REMOVE_FAILED] = L"DSL_RESULT_PIPELINE_CALLBACK_REMOVE_FAILED"; m_returnValueToString[DSL_RESULT_PIPELINE_FAILED_TO_PLAY] = L"DSL_RESULT_PIPELINE_FAILED_TO_PLAY"; m_returnValueToString[DSL_RESULT_PIPELINE_FAILED_TO_PAUSE] = L"DSL_RESULT_PIPELINE_FAILED_TO_PAUSE"; m_returnValueToString[DSL_RESULT_PIPELINE_FAILED_TO_STOP] = L"DSL_RESULT_PIPELINE_FAILED_TO_STOP"; m_returnValueToString[DSL_RESULT_PIPELINE_SOURCE_MAX_IN_USE_REACHED] = L"DSL_RESULT_PIPELINE_SOURCE_MAX_IN_USE_REACHED"; m_returnValueToString[DSL_RESULT_PIPELINE_SINK_MAX_IN_USE_REACHED] = L"DSL_RESULT_PIPELINE_SINK_MAX_IN_USE_REACHED"; m_returnValueToString[DSL_RESULT_DISPLAY_TYPE_THREW_EXCEPTION] = L"DSL_RESULT_DISPLAY_TYPE_THREW_EXCEPTION"; m_returnValueToString[DSL_RESULT_DISPLAY_TYPE_IN_USE] = L"DSL_RESULT_DISPLAY_TYPE_IN_USE"; m_returnValueToString[DSL_RESULT_DISPLAY_TYPE_NAME_NOT_UNIQUE] = L"DSL_RESULT_DISPLAY_TYPE_NAME_NOT_UNIQUE"; m_returnValueToString[DSL_RESULT_DISPLAY_TYPE_NAME_NOT_FOUND] = L"DSL_RESULT_DISPLAY_TYPE_NAME_NOT_FOUND"; m_returnValueToString[DSL_RESULT_DISPLAY_TYPE_NOT_THE_CORRECT_TYPE] = L"DSL_RESULT_DISPLAY_TYPE_NOT_THE_CORRECT_TYPE"; m_returnValueToString[DSL_RESULT_DISPLAY_TYPE_IS_BASE_TYPE] = L"DSL_RESULT_DISPLAY_TYPE_IS_BASE_TYPE"; m_returnValueToString[DSL_RESULT_DISPLAY_RGBA_COLOR_NAME_NOT_UNIQUE] = L"DSL_RESULT_DISPLAY_RGBA_COLOR_NAME_NOT_UNIQUE"; m_returnValueToString[DSL_RESULT_DISPLAY_RGBA_FONT_NAME_NOT_UNIQUE] = L"DSL_RESULT_DISPLAY_RGBA_FONT_NAME_NOT_UNIQUE"; m_returnValueToString[DSL_RESULT_DISPLAY_RGBA_TEXT_NAME_NOT_UNIQUE] = L"DSL_RESULT_DISPLAY_RGBA_TEXT_NAME_NOT_UNIQUE"; m_returnValueToString[DSL_RESULT_DISPLAY_RGBA_LINE_NAME_NOT_UNIQUE] = L"DSL_RESULT_DISPLAY_RGBA_LINE_NAME_NOT_UNIQUE"; m_returnValueToString[DSL_RESULT_DISPLAY_RGBA_ARROW_NAME_NOT_UNIQUE] = L"DSL_RESULT_DISPLAY_RGBA_ARROW_NAME_NOT_UNIQUE"; m_returnValueToString[DSL_RESULT_DISPLAY_RGBA_ARROW_HEAD_INVALID] = L"DSL_RESULT_DISPLAY_RGBA_ARROW_HEAD_INVALID"; m_returnValueToString[DSL_RESULT_DISPLAY_RGBA_RECTANGLE_NAME_NOT_UNIQUE] = L"DSL_RESULT_DISPLAY_RGBA_RECTANGLE_NAME_NOT_UNIQUE"; m_returnValueToString[DSL_RESULT_DISPLAY_RGBA_POLYGON_NAME_NOT_UNIQUE] = L"DSL_RESULT_DISPLAY_RGBA_POLYGON_NAME_NOT_UNIQUE"; m_returnValueToString[DSL_RESULT_DISPLAY_RGBA_CIRCLE_NAME_NOT_UNIQUE] = L"DSL_RESULT_DISPLAY_RGBA_CIRCLE_NAME_NOT_UNIQUE"; m_returnValueToString[DSL_RESULT_DISPLAY_SOURCE_NUMBER_NAME_NOT_UNIQUE] = L"DSL_RESULT_DISPLAY_SOURCE_NUMBER_NAME_NOT_UNIQUE"; m_returnValueToString[DSL_RESULT_DISPLAY_SOURCE_NAME_NAME_NOT_UNIQUE] = L"DSL_RESULT_DISPLAY_SOURCE_NAME_NAME_NOT_UNIQUE"; m_returnValueToString[DSL_RESULT_DISPLAY_SOURCE_DIMENSIONS_NAME_NOT_UNIQUE] = L"DSL_RESULT_DISPLAY_SOURCE_DIMENSIONS_NAME_NOT_UNIQUE"; m_returnValueToString[DSL_RESULT_DISPLAY_SOURCE_FRAMERATE_NAME_NOT_UNIQUE] = L"DSL_RESULT_DISPLAY_SOURCE_NUMBER_NAME_NOT_UNIQUE"; m_returnValueToString[DSL_RESULT_DISPLAY_PARAMETER_INVALID] = L"DSL_RESULT_DISPLAY_PARAMETER_INVALID"; m_returnValueToString[DSL_RESULT_TAP_NAME_NOT_UNIQUE] = L"DSL_RESULT_TAP_NAME_NOT_UNIQUE"; m_returnValueToString[DSL_RESULT_TAP_NAME_NOT_FOUND] = L"DSL_RESULT_TAP_NAME_NOT_FOUND"; m_returnValueToString[DSL_RESULT_TAP_THREW_EXCEPTION] = L"DSL_RESULT_TAP_THREW_EXCEPTION"; m_returnValueToString[DSL_RESULT_TAP_IN_USE] = L"DSL_RESULT_TAP_IN_USE"; m_returnValueToString[DSL_RESULT_TAP_SET_FAILED] = L"DSL_RESULT_TAP_SET_FAILED"; m_returnValueToString[DSL_RESULT_TAP_FILE_PATH_NOT_FOUND] = L"DSL_RESULT_TAP_FILE_PATH_NOT_FOUND"; m_returnValueToString[DSL_RESULT_TAP_CONTAINER_VALUE_INVALID] = L"DSL_RESULT_TAP_CONTAINER_VALUE_INVALID"; m_returnValueToString[DSL_RESULT_TAP_PLAYER_ADD_FAILED] = L"DSL_RESULT_TAP_PLAYER_ADD_FAILED"; m_returnValueToString[DSL_RESULT_TAP_PLAYER_REMOVE_FAILED] = L"DSL_RESULT_TAP_PLAYER_REMOVE_FAILED"; m_returnValueToString[DSL_RESULT_TAP_MAILER_ADD_FAILED] = L"DSL_RESULT_TAP_MAILER_ADD_FAILED"; m_returnValueToString[DSL_RESULT_TAP_MAILER_REMOVE_FAILED] = L"DSL_RESULT_TAP_MAILER_REMOVE_FAILED"; m_returnValueToString[DSL_RESULT_PLAYER_RESULT] = L"DSL_RESULT_PLAYER_RESULT"; m_returnValueToString[DSL_RESULT_PLAYER_NAME_NOT_UNIQUE] = L"DSL_RESULT_PLAYER_NAME_NOT_UNIQUE"; m_returnValueToString[DSL_RESULT_PLAYER_NAME_NOT_FOUND] = L"DSL_RESULT_PLAYER_NAME_NOT_FOUND"; m_returnValueToString[DSL_RESULT_PLAYER_NAME_BAD_FORMAT] = L"DSL_RESULT_PLAYER_NAME_BAD_FORMAT"; m_returnValueToString[DSL_RESULT_PLAYER_IS_NOT_RENDER_PLAYER] = L"DSL_RESULT_PLAYER_IS_NOT_RENDER_PLAYER"; m_returnValueToString[DSL_RESULT_PLAYER_IS_NOT_IMAGE_PLAYER] = L"DSL_RESULT_PLAYER_IS_NOT_IMAGE_PLAYER"; m_returnValueToString[DSL_RESULT_PLAYER_IS_NOT_VIDEO_PLAYER] = L"DSL_RESULT_PLAYER_IS_NOT_VIDEO_PLAYER"; m_returnValueToString[DSL_RESULT_PLAYER_THREW_EXCEPTION] = L"DSL_RESULT_PLAYER_THREW_EXCEPTION"; m_returnValueToString[DSL_RESULT_PLAYER_XWINDOW_GET_FAILED] = L"DSL_RESULT_PLAYER_XWINDOW_GET_FAILED"; m_returnValueToString[DSL_RESULT_PLAYER_XWINDOW_SET_FAILED] = L"DSL_RESULT_PLAYER_XWINDOW_SET_FAILED"; m_returnValueToString[DSL_RESULT_PLAYER_CALLBACK_ADD_FAILED] = L"DSL_RESULT_PLAYER_CALLBACK_ADD_FAILED"; m_returnValueToString[DSL_RESULT_PLAYER_CALLBACK_REMOVE_FAILED] = L"DSL_RESULT_PLAYER_CALLBACK_REMOVE_FAILED"; m_returnValueToString[DSL_RESULT_PLAYER_FAILED_TO_PLAY] = L"DSL_RESULT_PLAYER_FAILED_TO_PLAY"; m_returnValueToString[DSL_RESULT_PLAYER_FAILED_TO_PAUSE] = L"DSL_RESULT_PLAYER_FAILED_TO_PAUSE"; m_returnValueToString[DSL_RESULT_PLAYER_FAILED_TO_STOP] = L"DSL_RESULT_PLAYER_FAILED_TO_STOP"; m_returnValueToString[DSL_RESULT_PLAYER_RENDER_FAILED_TO_PLAY_NEXT] = L"DSL_RESULT_PLAYER_RENDER_FAILED_TO_PLAY_NEXT"; m_returnValueToString[DSL_RESULT_PLAYER_SET_FAILED] = L"DSL_RESULT_PLAYER_SET_FAILED"; m_returnValueToString[DSL_RESULT_MAILER_NAME_NOT_UNIQUE] = L"DSL_RESULT_MAILER_NAME_NOT_UNIQUE"; m_returnValueToString[DSL_RESULT_MAILER_NAME_NOT_FOUND] = L"DSL_RESULT_MAILER_NAME_NOT_FOUND"; m_returnValueToString[DSL_RESULT_MAILER_THREW_EXCEPTION] = L"DSL_RESULT_MAILER_THREW_EXCEPTION"; m_returnValueToString[DSL_RESULT_MAILER_IN_USE] = L"DSL_RESULT_MAILER_IN_USE"; m_returnValueToString[DSL_RESULT_MAILER_SET_FAILED] = L"DSL_RESULT_MAILER_SET_FAILED"; m_returnValueToString[DSL_RESULT_MAILER_PARAMETER_INVALID] = L"DSL_RESULT_MAILER_PARAMETER_INVALID"; m_returnValueToString[DSL_RESULT_INVALID_RESULT_CODE] = L"Invalid DSL Result CODE"; } } // namespace <|start_filename|>examples/cpp/1file_ptis_ktl_osd_window.cpp<|end_filename|> #include <iostream> #include <opencv2/core/mat.hpp> #include <opencv2/highgui/highgui.hpp> #include <opencv2/imgproc/imgproc.hpp> #include <gtkmm.h> #include <gst/gst.h> #include "DslApi.h" // # File path for the single File Source static const std::wstring file_path(L"/opt/nvidia/deepstream/deepstream-6.0/samples/streams/sample_qHD.mp4"); // # Filespecs for the Primary Triton Inference Server (PTIS) static const std::wstring primary_infer_config_file = L"/opt/nvidia/deepstream/deepstream-6.0/samples/configs/deepstream-app-trtis/config_infer_plan_engine_primary.txt"; // File name for .dot file output static const std::wstring dot_file = L"state-playing"; // # Window Sink Dimensions int sink_width = 1280; int sink_height = 720; // ## // # Function to be called on XWindow KeyRelease event // ## void xwindow_key_event_handler(const wchar_t* in_key, void* client_data) { std::wstring wkey(in_key); std::string key(wkey.begin(), wkey.end()); std::cout << "key released = " << key << std::endl; key = std::toupper(key[0]); if(key == "P"){ dsl_pipeline_pause(L"pipeline"); } else if (key == "R"){ dsl_pipeline_play(L"pipeline"); } else if (key == "Q"){ dsl_main_loop_quit(); } } // ## // # Function to be called on XWindow Delete event // ## void xwindow_delete_event_handler(void* client_data) { std::cout<<"delete window event"<<std::endl; dsl_main_loop_quit(); } // # Function to be called on End-of-Stream (EOS) event void eos_event_listener(void* client_data) { std::cout<<"Pipeline EOS event"<<std::endl; dsl_main_loop_quit(); } // Function to convert state enum to state string std::string get_state_name(int state) { // Must match GST_STATE enum values // DSL_STATE_NULL 1 // DSL_STATE_READY 2 // DSL_STATE_PAUSED 3 // DSL_STATE_PLAYING 4 // DSL_STATE_CHANGE_ASYNC 5 // DSL_STATE_UNKNOWN UINT32_MAX std::string state_str = "UNKNOWN"; switch(state) { case DSL_STATE_NULL: state_str = "NULL"; break; case DSL_STATE_READY: state_str = "READY"; break; case DSL_STATE_PAUSED: state_str = "PAUSED"; break; case DSL_STATE_PLAYING: state_str = "PLAYING"; break; case DSL_STATE_CHANGE_ASYNC: state_str = "CHANGE_ASYNC"; break; case DSL_STATE_UNKNOWN: state_str = "UNKNOWN"; break; } return state_str; } // ## // # Function to be called on every change of Pipeline state // ## void state_change_listener(uint old_state, uint new_state, void* client_data) { std::cout<<"previous state = " << get_state_name(old_state) << ", new state = " << get_state_name(new_state) << std::endl; if(new_state == DSL_STATE_PLAYING){ dsl_pipeline_dump_to_dot(L"pipeline",L"state-playing"); } } int main(int argc, char** argv) { DslReturnType retval; // # Since we're not using args, we can Let DSL initialize GST on first call while(true) { // # New File Source using the file path specified above, repeat diabled. retval = dsl_source_file_new(L"uri-source", file_path.c_str(), false); if (retval != DSL_RESULT_SUCCESS) break; // # New Primary TIS using the filespec specified above, with interval = 0 retval = dsl_infer_tis_primary_new(L"primary-tis", primary_infer_config_file.c_str(), 0); if (retval != DSL_RESULT_SUCCESS) break; // # New KTL Tracker, setting output width and height of tracked objects retval = dsl_tracker_ktl_new(L"ktl-tracker", 480, 272); if (retval != DSL_RESULT_SUCCESS) break; // # New OSD with clock and text enabled... using default values. retval = dsl_osd_new(L"on-screen-display", true, true); if (retval != DSL_RESULT_SUCCESS) break; // # New Window Sink, 0 x/y offsets and dimensions retval = dsl_sink_window_new(L"window-sink", 0, 0, sink_width, sink_height); if (retval != DSL_RESULT_SUCCESS) break; // # Add all the components to a new pipeline const wchar_t* components[] = { L"uri-source",L"primary-tis",L"ktl-tracker",L"on-screen-display",L"window-sind",nullptr}; retval = dsl_pipeline_new_component_add_many(L"pipeline", components); if (retval != DSL_RESULT_SUCCESS) break; // # Add the XWindow event handler functions defined above retval = dsl_pipeline_xwindow_key_event_handler_add(L"pipeline", xwindow_key_event_handler, nullptr); if (retval != DSL_RESULT_SUCCESS) break; retval = dsl_pipeline_xwindow_delete_event_handler_add(L"pipeline", xwindow_delete_event_handler, nullptr); if (retval != DSL_RESULT_SUCCESS) break; // # Add the listener callback functions defined above retval = dsl_pipeline_state_change_listener_add(L"pipeline", state_change_listener, nullptr); if (retval != DSL_RESULT_SUCCESS) break; retval = dsl_pipeline_eos_listener_add(L"pipeline", eos_event_listener, nullptr); if (retval != DSL_RESULT_SUCCESS) break; // # Play the pipeline retval = dsl_pipeline_play(L"pipeline"); if (retval != DSL_RESULT_SUCCESS) break; // # Join with main loop until released - blocking call dsl_main_loop_run(); retval = DSL_RESULT_SUCCESS; break; } // # Print out the final result std::cout << dsl_return_value_to_string(retval) << std::endl; dsl_pipeline_delete_all(); dsl_component_delete_all(); std::cout<<"Goodbye!"<<std::endl; return 0; } <|start_filename|>test/api/DslOdeActionApiTest.cpp<|end_filename|> /* The MIT License Copyright (c) 2019-2021, Prominence AI, Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in- all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "catch.hpp" #include "Dsl.h" #include "DslApi.h" SCENARIO( "The ODE Actions container is updated correctly on multiple new ODE Action", "[ode-action-api]" ) { GIVEN( "An empty list of Events" ) { std::wstring action_name1(L"log-action-1"); std::wstring action_name2(L"log-action-2"); std::wstring action_name3(L"log-action-3"); REQUIRE( dsl_ode_action_list_size() == 0 ); WHEN( "Several new Actions are created" ) { REQUIRE( dsl_ode_action_log_new(action_name1.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_log_new(action_name2.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_log_new(action_name3.c_str()) == DSL_RESULT_SUCCESS ); THEN( "The list size and events are updated correctly" ) { REQUIRE( dsl_ode_action_list_size() == 3 ); REQUIRE( dsl_ode_action_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_list_size() == 0 ); } } } } SCENARIO( "The ODE Actions container is updated correctly on Delete ODE Action", "[ode-action-api]" ) { GIVEN( "A list of several ODE Actions" ) { std::wstring action_name1(L"action-1"); std::wstring action_name2(L"action-2"); std::wstring action_name3(L"action-3"); boolean display(true); REQUIRE( dsl_ode_action_list_size() == 0 ); REQUIRE( dsl_ode_action_log_new(action_name1.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_log_new(action_name2.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_log_new(action_name3.c_str()) == DSL_RESULT_SUCCESS ); WHEN( "A single Action is deleted" ) { REQUIRE( dsl_ode_action_delete(action_name1.c_str()) == DSL_RESULT_SUCCESS ); THEN( "The list size and events are updated correctly" ) { REQUIRE( dsl_ode_action_list_size() == 2 ); REQUIRE( dsl_ode_action_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_list_size() == 0 ); } } WHEN( "Multiple Actions are deleted" ) { const wchar_t* actions[] = {L"action-2", L"action-3", NULL}; REQUIRE( dsl_ode_action_delete_many(actions) == DSL_RESULT_SUCCESS ); THEN( "The list size and events are updated correctly" ) { REQUIRE( dsl_ode_action_list_size() == 1 ); REQUIRE( dsl_ode_action_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_list_size() == 0 ); } } } } SCENARIO( "A new Format Bounding Box ODE Action can be created and deleted", "[ode-action-api]" ) { GIVEN( "Attributes for a new Format Bounding Box ODE Action" ) { std::wstring action_name(L"format-bbox-action"); uint border_width(5); std::wstring border_color_name(L"my-border-color"); std::wstring bg_color_name(L"my-bg-color"); double red(0.12), green(0.34), blue(0.56), alpha(0.78); boolean has_bg_color(true); REQUIRE( dsl_display_type_rgba_color_new(border_color_name.c_str(), red, green, blue, alpha) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_display_type_rgba_color_new(bg_color_name.c_str(), red, green, blue, alpha) == DSL_RESULT_SUCCESS ); WHEN( "A new Format Bounding Box Action is created" ) { REQUIRE( dsl_ode_action_format_bbox_new(action_name.c_str(), border_width, border_color_name.c_str(), has_bg_color, bg_color_name.c_str()) == DSL_RESULT_SUCCESS ); // second attempt must fail REQUIRE( dsl_ode_action_format_bbox_new(action_name.c_str(), border_width, border_color_name.c_str(), has_bg_color, bg_color_name.c_str()) == DSL_RESULT_ODE_ACTION_NAME_NOT_UNIQUE ); THEN( "The Format Bounding Box Action can be deleted" ) { REQUIRE( dsl_ode_action_delete(action_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_list_size() == 0 ); // second attempt must fail REQUIRE( dsl_ode_action_delete(action_name.c_str()) == DSL_RESULT_ODE_ACTION_NAME_NOT_FOUND ); REQUIRE( dsl_display_type_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_display_type_list_size() == 0 ); } } } } SCENARIO( "A new Format Bounding Box ODE Action with no Border or Background Color can be created", "[ode-action-api]" ) { GIVEN( "Attributes for a new Format Bounding Box ODE Action" ) { std::wstring action_name(L"format-bbox-action"); WHEN( "Using using input parameters border_width = 0 and has_bg_color = false" ) { uint border_width(0); boolean has_bg_color(false); THEN( "The Format Bounding Box Action can be created" ) { REQUIRE( dsl_ode_action_format_bbox_new(action_name.c_str(), border_width, NULL, has_bg_color, NULL) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_delete(action_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_list_size() == 0 ); REQUIRE( dsl_display_type_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_display_type_list_size() == 0 ); } } } } SCENARIO( "A new Format Bounding Box ODE Action verifies its input parameters correctly", "[ode-action-api]" ) { GIVEN( "Attributes for a new Format Bounding Box ODE Action" ) { std::wstring action_name(L"format-bbox-action"); std::wstring border_color_name(L"my-border-color"); std::wstring bg_color_name(L"my-bg-color"); double red(0.12), green(0.34), blue(0.56), alpha(0.78); uint border_width(5); boolean has_bg_color(true); REQUIRE( dsl_display_type_rgba_color_new(border_color_name.c_str(), red, green, blue, alpha) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_display_type_rgba_color_new(bg_color_name.c_str(), red, green, blue, alpha) == DSL_RESULT_SUCCESS ); WHEN( "Using input parameters border_width > 0 and a border_coler = NULL" ) { THEN( "The Format Bounding Box Action will fail to create" ) { REQUIRE( dsl_ode_action_format_bbox_new(action_name.c_str(), border_width, NULL, has_bg_color, bg_color_name.c_str()) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_action_list_size() == 0 ); REQUIRE( dsl_display_type_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_display_type_list_size() == 0 ); } } WHEN( "Using input parameters has_bg_color = true and a bg_coler = NULL" ) { uint border_width(0); THEN( "The Format Bounding Box Action will fail to create" ) { REQUIRE( dsl_ode_action_format_bbox_new(action_name.c_str(), border_width, NULL, has_bg_color, NULL) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_action_list_size() == 0 ); REQUIRE( dsl_display_type_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_display_type_list_size() == 0 ); } } } } SCENARIO( "A new Format Object Label ODE Action can be created and deleted", "[ode-action-api]" ) { GIVEN( "Attributes for a new Format Object Label ODE Action" ) { std::wstring action_name(L"format-label-action"); std::wstring font_name(L"font-name"); std::wstring font(L"arial"); uint size(14); std::wstring font_color_name(L"font-color"); std::wstring font_bg_color_name(L"font-bg-color"); double redFont(0.0), greenFont(0.0), blueFont(0.0), alphaFont(1.0); double redBgColor(0.12), greenBgColor(0.34), blueBgColor(0.56), alphaBgColor(0.78); boolean has_bg_color(true); REQUIRE( dsl_display_type_rgba_color_new(font_color_name.c_str(), redFont, greenFont, blueFont, alphaFont) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_display_type_rgba_color_new(font_bg_color_name.c_str(), redBgColor, greenBgColor, blueBgColor, alphaBgColor) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_display_type_rgba_font_new(font_name.c_str(), font.c_str(), size, font_color_name.c_str()) == DSL_RESULT_SUCCESS ); WHEN( "A new Format Bounding Box Action is created" ) { REQUIRE( dsl_ode_action_format_label_new(action_name.c_str(), font_name.c_str(), has_bg_color, font_bg_color_name.c_str()) == DSL_RESULT_SUCCESS ); // second attempt must fail REQUIRE( dsl_ode_action_format_label_new(action_name.c_str(), font_name.c_str(), has_bg_color, font_bg_color_name.c_str()) == DSL_RESULT_ODE_ACTION_NAME_NOT_UNIQUE ); THEN( "The Format Bounding Box Action can be deleted" ) { REQUIRE( dsl_ode_action_delete(action_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_list_size() == 0 ); // second attempt must fail REQUIRE( dsl_ode_action_delete(action_name.c_str()) == DSL_RESULT_ODE_ACTION_NAME_NOT_FOUND ); REQUIRE( dsl_display_type_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_display_type_list_size() == 0 ); } } } } SCENARIO( "A new Format Object Label ODE Action checks its input parameters correctly", "[ode-action-api]" ) { GIVEN( "Attributes for a new Format Object Label ODE Action" ) { std::wstring action_name(L"format-label-action"); std::wstring font_name(L"font-name"); std::wstring font(L"arial"); uint size(14); std::wstring font_color_name(L"font-color"); std::wstring font_bg_color_name(L"font-bg-color"); double redFont(0.0), greenFont(0.0), blueFont(0.0), alphaFont(1.0); double redBgColor(0.12), greenBgColor(0.34), blueBgColor(0.56), alphaBgColor(0.78); REQUIRE( dsl_display_type_rgba_color_new(font_color_name.c_str(), redFont, greenFont, blueFont, alphaFont) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_display_type_rgba_color_new(font_bg_color_name.c_str(), redBgColor, greenBgColor, blueBgColor, alphaBgColor) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_display_type_rgba_font_new(font_name.c_str(), font.c_str(), size, font_color_name.c_str()) == DSL_RESULT_SUCCESS ); WHEN( "A new Format ObjectLabel Action is created with NO Font" ) { REQUIRE( dsl_ode_action_format_label_new(action_name.c_str(), NULL, true, font_bg_color_name.c_str()) == DSL_RESULT_SUCCESS ); THEN( "The Format Bounding Box Action can be deleted" ) { REQUIRE( dsl_ode_action_delete(action_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_list_size() == 0 ); // second attempt must fail REQUIRE( dsl_ode_action_delete(action_name.c_str()) == DSL_RESULT_ODE_ACTION_NAME_NOT_FOUND ); REQUIRE( dsl_display_type_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_display_type_list_size() == 0 ); } } WHEN( "A new Format Bounding Box Action is created with NO Background Color" ) { REQUIRE( dsl_ode_action_format_label_new(action_name.c_str(), font_name.c_str(), false, NULL) == DSL_RESULT_SUCCESS ); THEN( "The Format Bounding Box Action can be deleted" ) { REQUIRE( dsl_ode_action_delete(action_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_list_size() == 0 ); // second attempt must fail REQUIRE( dsl_ode_action_delete(action_name.c_str()) == DSL_RESULT_ODE_ACTION_NAME_NOT_FOUND ); REQUIRE( dsl_display_type_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_display_type_list_size() == 0 ); } } } } SCENARIO( "A new Custom ODE Action can be created and deleted", "[ode-action-api]" ) { GIVEN( "Attributes for a new Custom ODE Action" ) { std::wstring action_name(L"custom-action"); dsl_ode_handle_occurrence_cb client_handler; WHEN( "A new Custom ODE Action is created" ) { REQUIRE( dsl_ode_action_custom_new(action_name.c_str(), client_handler, NULL) == DSL_RESULT_SUCCESS ); THEN( "The Action can be deleted" ) { REQUIRE( dsl_ode_action_delete(action_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_list_size() == 0 ); } } WHEN( "A new Custom ODE Action is created" ) { REQUIRE( dsl_ode_action_custom_new(action_name.c_str(), client_handler, NULL) == DSL_RESULT_SUCCESS ); THEN( "A second custom of the same names fails to create" ) { REQUIRE( dsl_ode_action_custom_new(action_name.c_str(), client_handler, NULL) == DSL_RESULT_ODE_ACTION_NAME_NOT_UNIQUE ); REQUIRE( dsl_ode_action_delete(action_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_list_size() == 0 ); } } } } SCENARIO( "A new Frame Capture ODE Action can be created and deleted", "[ode-action-api]" ) { GIVEN( "Attributes for a new Frame Capture ODE Action" ) { std::wstring action_name(L"capture-action"); std::wstring outdir(L"./"); boolean annotate(true); WHEN( "A new Frame Capture Action is created" ) { REQUIRE( dsl_ode_action_capture_frame_new(action_name.c_str(), outdir.c_str(), annotate) == DSL_RESULT_SUCCESS ); THEN( "The Frame Capture Action can be deleted" ) { REQUIRE( dsl_ode_action_delete(action_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_list_size() == 0 ); } } WHEN( "A new Frame Capture Action is created" ) { REQUIRE( dsl_ode_action_capture_frame_new(action_name.c_str(), outdir.c_str(), annotate) == DSL_RESULT_SUCCESS ); THEN( "A second Frame Capture Action of the same names fails to create" ) { REQUIRE( dsl_ode_action_capture_frame_new(action_name.c_str(), outdir.c_str(), annotate) == DSL_RESULT_ODE_ACTION_NAME_NOT_UNIQUE ); REQUIRE( dsl_ode_action_delete(action_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_list_size() == 0 ); } } WHEN( "An invalid Output Directory is specified" ) { std::wstring invalidOutDir(L"/invalid/output/directory"); THEN( "A new Frame Capture Action fails to create" ) { REQUIRE( dsl_ode_action_capture_frame_new(action_name.c_str(), invalidOutDir.c_str(), annotate) == DSL_RESULT_ODE_ACTION_FILE_PATH_NOT_FOUND ); REQUIRE( dsl_ode_action_list_size() == 0 ); } } } } SCENARIO( "A new Object Capture ODE Action can be created and deleted", "[ode-action-api]" ) { GIVEN( "Attributes for a new Object Capture ODE Action" ) { std::wstring action_name(L"capture-action"); std::wstring outdir(L"./"); WHEN( "A new Object Capture Action is created" ) { REQUIRE( dsl_ode_action_capture_object_new(action_name.c_str(), outdir.c_str()) == DSL_RESULT_SUCCESS ); THEN( "The Object Capture Action can be deleted" ) { REQUIRE( dsl_ode_action_delete(action_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_list_size() == 0 ); } } WHEN( "A new Object Capture Action is created" ) { REQUIRE( dsl_ode_action_capture_object_new(action_name.c_str(), outdir.c_str()) == DSL_RESULT_SUCCESS ); THEN( "A second Object Capture Action of the same names fails to create" ) { REQUIRE( dsl_ode_action_capture_object_new(action_name.c_str(), outdir.c_str()) == DSL_RESULT_ODE_ACTION_NAME_NOT_UNIQUE ); REQUIRE( dsl_ode_action_delete(action_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_list_size() == 0 ); } } WHEN( "An invalid Output Directory is specified" ) { std::wstring invalidOutDir(L"/invalid/output/directory"); THEN( "A new Object Capture Action fails to create" ) { REQUIRE( dsl_ode_action_capture_object_new(action_name.c_str(), invalidOutDir.c_str()) == DSL_RESULT_ODE_ACTION_FILE_PATH_NOT_FOUND ); REQUIRE( dsl_ode_action_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_list_size() == 0 ); } } } } static void capture_complete_cb(dsl_capture_info* pInfo, void* user_data) { } SCENARIO( "A Capture Complete Listener can be added and removed", "[ode-action-api]" ) { GIVEN( "A new Capture Action and client listener callback" ) { std::wstring action_name(L"capture-action"); std::wstring outdir(L"./"); REQUIRE( dsl_ode_action_capture_object_new(action_name.c_str(), outdir.c_str()) == DSL_RESULT_SUCCESS ); WHEN( "A capture-complete-listner is added" ) { REQUIRE( dsl_ode_action_capture_complete_listener_add(action_name.c_str(), capture_complete_cb, NULL) == DSL_RESULT_SUCCESS ); // ensure the same listener twice fails REQUIRE( dsl_ode_action_capture_complete_listener_add(action_name.c_str(), capture_complete_cb, NULL) == DSL_RESULT_ODE_ACTION_CALLBACK_ADD_FAILED ); THEN( "The same listner can be remove" ) { REQUIRE( dsl_ode_action_capture_complete_listener_remove(action_name.c_str(), capture_complete_cb) == DSL_RESULT_SUCCESS ); // calling a second time must fail REQUIRE( dsl_ode_action_capture_complete_listener_remove(action_name.c_str(), capture_complete_cb) == DSL_RESULT_ODE_ACTION_CALLBACK_REMOVE_FAILED ); REQUIRE( dsl_ode_action_delete(action_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_list_size() == 0 ); } } } } SCENARIO( "A Player can be added and removed from a Capture Action", "[ode-action-api]" ) { GIVEN( "A new Capture Action and Image Player" ) { std::wstring action_name(L"capture-action"); std::wstring outdir(L"./"); std::wstring player_name(L"player"); std::wstring file_path(L"./test/streams/first-person-occurrence-438.jpeg"); REQUIRE( dsl_ode_action_capture_object_new(action_name.c_str(), outdir.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_player_render_image_new(player_name.c_str(),file_path.c_str(), DSL_RENDER_TYPE_OVERLAY, 10, 10, 75, 0) == DSL_RESULT_SUCCESS ); WHEN( "A Player is added" ) { REQUIRE( dsl_ode_action_capture_image_player_add(action_name.c_str(), player_name.c_str()) == DSL_RESULT_SUCCESS ); // ensure the same listener twice fails REQUIRE( dsl_ode_action_capture_image_player_add(action_name.c_str(), player_name.c_str()) == DSL_RESULT_ODE_ACTION_PLAYER_ADD_FAILED ); THEN( "The same Player can be removed" ) { REQUIRE( dsl_ode_action_capture_image_player_remove(action_name.c_str(), player_name.c_str()) == DSL_RESULT_SUCCESS ); // calling a second time must fail REQUIRE( dsl_ode_action_capture_image_player_remove(action_name.c_str(), player_name.c_str()) == DSL_RESULT_ODE_ACTION_PLAYER_REMOVE_FAILED ); REQUIRE( dsl_ode_action_delete(action_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_list_size() == 0 ); REQUIRE( dsl_player_delete(player_name.c_str()) == DSL_RESULT_SUCCESS ); } } } } SCENARIO( "A Mailer can be added and removed from a Capture Action", "[ode-action-api]" ) { GIVEN( "A new Capture Action and Mailer" ) { std::wstring action_name(L"capture-action"); std::wstring outdir(L"./"); std::wstring mailer_name(L"mailer"); std::wstring subject(L"Subject line"); REQUIRE( dsl_ode_action_capture_object_new(action_name.c_str(), outdir.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_mailer_new(mailer_name.c_str()) == DSL_RESULT_SUCCESS ); WHEN( "A capture-complete-listner is added" ) { REQUIRE( dsl_ode_action_capture_mailer_add(action_name.c_str(), mailer_name.c_str(), subject.c_str(), false) == DSL_RESULT_SUCCESS ); // ensure the same listener twice fails REQUIRE( dsl_ode_action_capture_mailer_add(action_name.c_str(), mailer_name.c_str(), subject.c_str(), false) == DSL_RESULT_ODE_ACTION_MAILER_ADD_FAILED ); THEN( "The same listner can be removed" ) { REQUIRE( dsl_ode_action_capture_mailer_remove(action_name.c_str(), mailer_name.c_str()) == DSL_RESULT_SUCCESS ); // calling a second time must fail REQUIRE( dsl_ode_action_capture_mailer_remove(action_name.c_str(), mailer_name.c_str()) == DSL_RESULT_ODE_ACTION_MAILER_REMOVE_FAILED ); REQUIRE( dsl_ode_action_delete(action_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_list_size() == 0 ); REQUIRE( dsl_mailer_delete(mailer_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_mailer_list_size() == 0 ); } } } } SCENARIO( "A new Customize Label ODE Action can be created and deleted", "[ode-action-api]" ) { GIVEN( "Attributes for a new Display ODE Action" ) { std::wstring action_name(L"customize-label-action"); uint label_types[] = {DSL_METRIC_OBJECT_LOCATION, DSL_METRIC_OBJECT_DIMENSIONS, DSL_METRIC_OBJECT_CONFIDENCE, DSL_METRIC_OBJECT_PERSISTENCE}; uint size(4); WHEN( "A new Customize Label is created" ) { REQUIRE( dsl_ode_action_customize_label_new(action_name.c_str(), label_types, size) == DSL_RESULT_SUCCESS ); // second attempt must fail REQUIRE( dsl_ode_action_customize_label_new(action_name.c_str(), label_types, size) == DSL_RESULT_ODE_ACTION_NAME_NOT_UNIQUE ); THEN( "The Customize Label can be deleted" ) { REQUIRE( dsl_ode_action_delete(action_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_list_size() == 0 ); // second attempt must fail REQUIRE( dsl_ode_action_delete(action_name.c_str()) == DSL_RESULT_ODE_ACTION_NAME_NOT_FOUND ); } } } } SCENARIO( "Parameters for a new Customize Label ODE Action are checked on construction", "[ode-action-api]" ) { GIVEN( "Attributes for a new Customize Label ODE Action" ) { std::wstring action_name(L"customize-label-action"); uint label_types[] = {DSL_METRIC_OBJECT_LOCATION, DSL_METRIC_OBJECT_DIMENSIONS, DSL_METRIC_OBJECT_CONFIDENCE, DSL_METRIC_OBJECT_PERSISTENCE}; WHEN( "The size parameter is out of range" ) { uint size(5); THEN( "The Customize Label Action fails to create" ) { REQUIRE( dsl_ode_action_customize_label_new(action_name.c_str(), label_types, size) == DSL_RESULT_ODE_ACTION_PARAMETER_INVALID ); REQUIRE( dsl_ode_action_list_size() == 0 ); } } } } SCENARIO( "A new Customize Label ODE Action can be updated", "[ode-action-api]" ) { GIVEN( "Attributes for a new Display ODE Action" ) { std::wstring action_name(L"customize-label-action"); uint label_types[] = {DSL_METRIC_OBJECT_LOCATION, DSL_METRIC_OBJECT_DIMENSIONS, DSL_METRIC_OBJECT_CONFIDENCE, DSL_METRIC_OBJECT_PERSISTENCE}; uint size(4); REQUIRE( dsl_ode_action_customize_label_new(action_name.c_str(), label_types, size) == DSL_RESULT_SUCCESS ); WHEN( "A Customize Label is updated" ) { uint ret_label_types[DSL_METRIC_OBJECT_PERSISTENCE+1] = {0}; uint in_out_size(DSL_METRIC_OBJECT_PERSISTENCE+1); // test initial condition first REQUIRE( dsl_ode_action_customize_label_get(action_name.c_str(), ret_label_types, &in_out_size) == DSL_RESULT_SUCCESS ); REQUIRE( in_out_size == size ); REQUIRE( label_types[0] == ret_label_types[0] ); REQUIRE( label_types[1] == ret_label_types[1] ); REQUIRE( label_types[2] == ret_label_types[2] ); REQUIRE( label_types[3] == ret_label_types[3] ); uint new_label_types[] = {DSL_METRIC_OBJECT_CLASS}; size = 1; REQUIRE( dsl_ode_action_customize_label_set(action_name.c_str(), new_label_types, size) == DSL_RESULT_SUCCESS ); THEN( "The correct values are returned on get" ) { REQUIRE( dsl_ode_action_customize_label_get(action_name.c_str(), ret_label_types, &in_out_size) == DSL_RESULT_SUCCESS ); REQUIRE( in_out_size == size ); REQUIRE( new_label_types[0] == ret_label_types[0] ); REQUIRE( dsl_ode_action_delete(action_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_list_size() == 0 ); } } } } SCENARIO( "A Customize Label ODE Action checks its parameters correctly", "[ode-action-api]" ) { GIVEN( "Attributes for a new Display ODE Action" ) { std::wstring action_name(L"customize-label-action"); uint label_types[] = {DSL_METRIC_OBJECT_LOCATION, DSL_METRIC_OBJECT_DIMENSIONS, DSL_METRIC_OBJECT_CONFIDENCE, DSL_METRIC_OBJECT_PERSISTENCE}; uint size(4); REQUIRE( dsl_ode_action_customize_label_new(action_name.c_str(), label_types, size) == DSL_RESULT_SUCCESS ); WHEN( "When insufficient memory is passed in on Get" ) { uint ret_label_types[2] = {0}; uint in_out_size(2); THEN( "The Get call fails correctly" ) { REQUIRE( dsl_ode_action_customize_label_get(action_name.c_str(), ret_label_types, &in_out_size) == DSL_RESULT_ODE_ACTION_PARAMETER_INVALID ); REQUIRE( dsl_ode_action_delete(action_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_list_size() == 0 ); } } WHEN( "When the size parameter is NULL" ) { uint* pSize(NULL); uint ret_label_types[2] = {0}; THEN( "The ODE Actions container is unchanged" ) { REQUIRE( dsl_ode_action_customize_label_get(action_name.c_str(), ret_label_types, pSize) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_action_delete(action_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_list_size() == 0 ); } } } } SCENARIO( "A new Display ODE Action can be created and deleted", "[ode-action-api]" ) { GIVEN( "Attributes for a new Display ODE Action" ) { std::wstring action_name(L"display-action"); std::wstring font(L"arial"); std::wstring fontName(L"arial-20"); uint size(20); std::wstring fontColorName(L"my-font-color"); std::wstring bg_color_name(L"my-bg-color"); double red(0.12), green(0.34), blue(0.56), alpha(0.78); std::wstring format_string(L"Class: %0"); REQUIRE( dsl_display_type_rgba_color_new(fontColorName.c_str(), red, green, blue, alpha) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_display_type_rgba_font_new(fontName.c_str(), font.c_str(), size, fontColorName.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_display_type_rgba_color_new(bg_color_name.c_str(), red, green, blue, alpha) == DSL_RESULT_SUCCESS ); WHEN( "A new Display Action is created" ) { REQUIRE( dsl_ode_action_display_new(action_name.c_str(), format_string.c_str(), 10, 10, fontName.c_str(), true, bg_color_name.c_str()) == DSL_RESULT_SUCCESS ); THEN( "The Display Action can be deleted" ) { REQUIRE( dsl_ode_action_delete(action_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_list_size() == 0 ); REQUIRE( dsl_display_type_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_display_type_list_size() == 0 ); } } WHEN( "A new Display Action is created" ) { REQUIRE( dsl_ode_action_display_new(action_name.c_str(), format_string.c_str(), 10, 10, fontName.c_str(), true, bg_color_name.c_str()) == DSL_RESULT_SUCCESS ); THEN( "A second Display Action of the same names fails to create" ) { REQUIRE( dsl_ode_action_display_new(action_name.c_str(), format_string.c_str(), 10, 10, fontName.c_str(), true, bg_color_name.c_str()) == DSL_RESULT_ODE_ACTION_NAME_NOT_UNIQUE ); REQUIRE( dsl_ode_action_delete(action_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_list_size() == 0 ); REQUIRE( dsl_display_type_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_display_type_list_size() == 0 ); } } } } SCENARIO( "A new Add Display Meta ODE Action can be created and deleted", "[ode-action-api]" ) { GIVEN( "Attributes for a new Add Display Meta ODE Action" ) { std::wstring action_name(L"display-meta-action"); std::wstring font(L"arial"); std::wstring fontName(L"arial-20"); uint size(20); std::wstring fontColorName(L"my-font-color"); std::wstring bg_color_name(L"my-bg-color"); double red(0.12), green(0.34), blue(0.56), alpha(0.78); std::wstring sourceDisplay(L"source-display"); uint x_offset(10), y_offset(10); REQUIRE( dsl_display_type_rgba_color_new(fontColorName.c_str(), red, green, blue, alpha) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_display_type_rgba_font_new(fontName.c_str(), font.c_str(), size, fontColorName.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_display_type_source_name_new(sourceDisplay.c_str(), x_offset, y_offset, fontName.c_str(), false, NULL) == DSL_RESULT_SUCCESS ); WHEN( "A new Add Display Meta Action is created" ) { REQUIRE( dsl_ode_action_display_meta_add_new(action_name.c_str(), sourceDisplay.c_str()) == DSL_RESULT_SUCCESS ); THEN( "The Add Display Meta Action can be deleted" ) { REQUIRE( dsl_ode_action_delete(action_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_list_size() == 0 ); REQUIRE( dsl_display_type_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_display_type_list_size() == 0 ); } } WHEN( "A new Add Display Meta Action is created" ) { REQUIRE( dsl_ode_action_display_meta_add_new(action_name.c_str(), sourceDisplay.c_str()) == DSL_RESULT_SUCCESS ); THEN( "A second Display Action of the same name fails to create" ) { REQUIRE( dsl_ode_action_display_meta_add_new(action_name.c_str(), sourceDisplay.c_str()) == DSL_RESULT_ODE_ACTION_NAME_NOT_UNIQUE ); REQUIRE( dsl_ode_action_delete(action_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_list_size() == 0 ); REQUIRE( dsl_display_type_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_display_type_list_size() == 0 ); } } } } SCENARIO( "A new Add Many Display Meta ODE Action can be created and deleted", "[ode-action-api]" ) { GIVEN( "Attributes for a new Add Many Display Meta ODE Action" ) { std::wstring action_name(L"display-meta-action"); std::wstring font(L"arial"); std::wstring fontName(L"arial-20"); uint size(20); std::wstring fontColorName(L"my-font-color"); std::wstring bg_color_name(L"my-bg-color"); double red(0.12), green(0.34), blue(0.56), alpha(0.78); std::wstring sourceName(L"source-name"); std::wstring sourceNumber(L"source-number"); std::wstring sourceDimensions(L"source-dimensions"); uint x_offset(10), y_offset(10); REQUIRE( dsl_display_type_rgba_color_new(fontColorName.c_str(), red, green, blue, alpha) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_display_type_rgba_font_new(fontName.c_str(), font.c_str(), size, fontColorName.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_display_type_source_name_new(sourceName.c_str(), x_offset, y_offset, fontName.c_str(), false, NULL) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_display_type_source_number_new(sourceNumber.c_str(), x_offset, y_offset+30, fontName.c_str(), false, NULL) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_display_type_source_dimensions_new(sourceDimensions.c_str(), x_offset, y_offset+60, fontName.c_str(), false, NULL) == DSL_RESULT_SUCCESS ); WHEN( "A new Add Display Meta Action is created" ) { const wchar_t* display_types[] = {L"source-name", L"source-number", L"source-dimensions", NULL}; REQUIRE( dsl_ode_action_display_meta_add_many_new(action_name.c_str(), display_types) == DSL_RESULT_SUCCESS ); THEN( "The Add Display Meta Action can be deleted" ) { REQUIRE( dsl_ode_action_delete(action_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_list_size() == 0 ); REQUIRE( dsl_display_type_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_display_type_list_size() == 0 ); } } } } SCENARIO( "A new File ODE Action can be created and deleted", "[ode-action-api]" ) { GIVEN( "Attributes for a new File ODE Action" ) { std::wstring action_name(L"file-action"); std::wstring file_path(L"./file-action.txt"); uint mode(DSL_WRITE_MODE_TRUNCATE); uint format(DSL_EVENT_FILE_FORMAT_TEXT); boolean force_flush(true); WHEN( "A new File Action is created" ) { REQUIRE( dsl_ode_action_file_new(action_name.c_str(), file_path.c_str(), mode, format, force_flush) == DSL_RESULT_SUCCESS ); THEN( "The File Action can be deleted" ) { REQUIRE( dsl_ode_action_delete(action_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_list_size() == 0 ); } } WHEN( "A new File Action is created" ) { REQUIRE( dsl_ode_action_file_new(action_name.c_str(), file_path.c_str(), mode, format, force_flush) == DSL_RESULT_SUCCESS ); THEN( "A second File Action of the same names fails to create" ) { REQUIRE( dsl_ode_action_file_new(action_name.c_str(), file_path.c_str(), mode, format, force_flush) == DSL_RESULT_ODE_ACTION_NAME_NOT_UNIQUE ); REQUIRE( dsl_ode_action_delete(action_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_list_size() == 0 ); } } } } SCENARIO( "Parameters for a new File ODE Action are checked on construction", "[ode-action-api]" ) { GIVEN( "Attributes for a new File ODE Action" ) { std::wstring action_name(L"file-action"); std::wstring file_path(L"./file-action.txt"); boolean force_flush(true); WHEN( "The mode parameter is out of range" ) { uint mode(DSL_WRITE_MODE_TRUNCATE+1); uint format(DSL_EVENT_FILE_FORMAT_TEXT); THEN( "The File Action fails to create" ) { REQUIRE( dsl_ode_action_file_new(action_name.c_str(), file_path.c_str(), mode, format, force_flush) == DSL_RESULT_ODE_ACTION_PARAMETER_INVALID ); REQUIRE( dsl_ode_action_list_size() == 0 ); } } WHEN( "The format parameter is out of range" ) { uint mode(DSL_WRITE_MODE_TRUNCATE); uint format(DSL_EVENT_FILE_FORMAT_CSV+1); THEN( "The File Action fails to create" ) { REQUIRE( dsl_ode_action_file_new(action_name.c_str(), file_path.c_str(), mode, format, force_flush) == DSL_RESULT_ODE_ACTION_PARAMETER_INVALID ); REQUIRE( dsl_ode_action_list_size() == 0 ); } } } } SCENARIO( "A new Fill Frame ODE Action can be created and deleted", "[ode-action-api]" ) { GIVEN( "Attributes for a new Fill Frame ODE Action" ) { std::wstring action_name(L"fill-frame-action"); std::wstring colorName(L"my-color"); double red(0.12), green(0.34), blue(0.56), alpha(0.78); REQUIRE( dsl_display_type_rgba_color_new(colorName.c_str(), red, green, blue, alpha) == DSL_RESULT_SUCCESS ); WHEN( "A new Fill Frame Action is created" ) { REQUIRE( dsl_ode_action_fill_frame_new(action_name.c_str(), colorName.c_str()) == DSL_RESULT_SUCCESS ); THEN( "The Fill Frame Action can be deleted" ) { REQUIRE( dsl_ode_action_delete(action_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_list_size() == 0 ); REQUIRE( dsl_display_type_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_display_type_list_size() == 0 ); } } WHEN( "A new Fill Frame Action is created" ) { REQUIRE( dsl_ode_action_fill_frame_new(action_name.c_str(), colorName.c_str()) == DSL_RESULT_SUCCESS ); THEN( "A second Fill Frame Action of the same name fails to create" ) { REQUIRE( dsl_ode_action_fill_frame_new(action_name.c_str(), colorName.c_str()) == DSL_RESULT_ODE_ACTION_NAME_NOT_UNIQUE ); REQUIRE( dsl_ode_action_delete(action_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_list_size() == 0 ); REQUIRE( dsl_display_type_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_display_type_list_size() == 0 ); } } } } SCENARIO( "A new Fill Surroundings ODE Action can be created and deleted", "[ode-action-api]" ) { GIVEN( "Attributes for a new Fill Surroundings ODE Action" ) { std::wstring action_name(L"fill-frame-action"); std::wstring colorName(L"my-color"); double red(0.12), green(0.34), blue(0.56), alpha(0.78); REQUIRE( dsl_display_type_rgba_color_new(colorName.c_str(), red, green, blue, alpha) == DSL_RESULT_SUCCESS ); WHEN( "A new Fill Surroundings Action is created" ) { REQUIRE( dsl_ode_action_fill_surroundings_new(action_name.c_str(), colorName.c_str()) == DSL_RESULT_SUCCESS ); THEN( "The Fill Frame Action can be deleted" ) { REQUIRE( dsl_ode_action_delete(action_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_list_size() == 0 ); REQUIRE( dsl_display_type_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_display_type_list_size() == 0 ); } } WHEN( "A new Fill Frame Action is created" ) { REQUIRE( dsl_ode_action_fill_surroundings_new(action_name.c_str(), colorName.c_str()) == DSL_RESULT_SUCCESS ); THEN( "A second Fill Frame Action of the same name fails to create" ) { REQUIRE( dsl_ode_action_fill_surroundings_new(action_name.c_str(), colorName.c_str()) == DSL_RESULT_ODE_ACTION_NAME_NOT_UNIQUE ); REQUIRE( dsl_ode_action_delete(action_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_list_size() == 0 ); REQUIRE( dsl_display_type_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_display_type_list_size() == 0 ); } } } } SCENARIO( "A new Handler Disable ODE Action can be created and deleted", "[ode-action-api]" ) { GIVEN( "Attributes for a new Handler Disable ODE Action" ) { std::wstring action_name(L"handler-disable-action"); std::wstring handlerName(L"handler"); WHEN( "A new Handler Disable Action is created" ) { REQUIRE( dsl_ode_action_handler_disable_new(action_name.c_str(), handlerName.c_str()) == DSL_RESULT_SUCCESS ); THEN( "The Handler Disable Action can be deleted" ) { REQUIRE( dsl_ode_action_delete(action_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_list_size() == 0 ); } } WHEN( "A new Handler Disable Action is created" ) { REQUIRE( dsl_ode_action_handler_disable_new(action_name.c_str(), handlerName.c_str()) == DSL_RESULT_SUCCESS ); THEN( "A second Handler Disable Action of the same names fails to create" ) { REQUIRE( dsl_ode_action_handler_disable_new(action_name.c_str(), handlerName.c_str()) == DSL_RESULT_ODE_ACTION_NAME_NOT_UNIQUE ); REQUIRE( dsl_ode_action_delete(action_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_list_size() == 0 ); } } } } SCENARIO( "A new Log ODE Action can be created and deleted", "[ode-action-api]" ) { GIVEN( "Attributes for a new Log ODE Action" ) { std::wstring action_name(L"log-action"); boolean offsetY_with_classId(true); WHEN( "A new Log Action is created" ) { REQUIRE( dsl_ode_action_log_new(action_name.c_str()) == DSL_RESULT_SUCCESS ); THEN( "The Log Action can be deleted" ) { REQUIRE( dsl_ode_action_delete(action_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_list_size() == 0 ); } } WHEN( "A new Log Action is created" ) { REQUIRE( dsl_ode_action_log_new(action_name.c_str()) == DSL_RESULT_SUCCESS ); THEN( "A second Log Action of the same names fails to create" ) { REQUIRE( dsl_ode_action_log_new(action_name.c_str()) == DSL_RESULT_ODE_ACTION_NAME_NOT_UNIQUE ); REQUIRE( dsl_ode_action_delete(action_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_list_size() == 0 ); } } } } SCENARIO( "A new Pause ODE Action can be created and deleted", "[ode-action-api]" ) { GIVEN( "Attributes for a new Pause ODE Action" ) { std::wstring action_name(L"pause-action"); std::wstring pipelineName(L"pipeline"); boolean offsetY_with_classId(true); WHEN( "A new Pause Action is created" ) { REQUIRE( dsl_ode_action_pause_new(action_name.c_str(), pipelineName.c_str()) == DSL_RESULT_SUCCESS ); THEN( "The Pause Action can be deleted" ) { REQUIRE( dsl_ode_action_delete(action_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_list_size() == 0 ); } } WHEN( "A new Pause Action is created" ) { REQUIRE( dsl_ode_action_pause_new(action_name.c_str(), pipelineName.c_str()) == DSL_RESULT_SUCCESS ); THEN( "A second Pause Action of the same names fails to create" ) { REQUIRE( dsl_ode_action_pause_new(action_name.c_str(), pipelineName.c_str()) == DSL_RESULT_ODE_ACTION_NAME_NOT_UNIQUE ); REQUIRE( dsl_ode_action_delete(action_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_list_size() == 0 ); } } } } SCENARIO( "A new Print ODE Action can be created and deleted", "[ode-action-api]" ) { GIVEN( "Attributes for a new Print ODE Action" ) { std::wstring action_name(L"print-action"); WHEN( "A new Print Action is created" ) { REQUIRE( dsl_ode_action_print_new(action_name.c_str(), false) == DSL_RESULT_SUCCESS ); THEN( "The Print Action can be deleted" ) { REQUIRE( dsl_ode_action_delete(action_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_list_size() == 0 ); } } WHEN( "A new Print Action is created" ) { REQUIRE( dsl_ode_action_print_new(action_name.c_str(), false) == DSL_RESULT_SUCCESS ); THEN( "A second Print Action of the same names fails to create" ) { REQUIRE( dsl_ode_action_print_new(action_name.c_str(), false) == DSL_RESULT_ODE_ACTION_NAME_NOT_UNIQUE ); REQUIRE( dsl_ode_action_delete(action_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_list_size() == 0 ); } } } } SCENARIO( "A new Redact ODE Action can be created and deleted", "[ode-action-api]" ) { GIVEN( "Attributes for a new Redact ODE Action" ) { std::wstring action_name(L"redact-action"); WHEN( "A new Redact Action is created" ) { REQUIRE( dsl_ode_action_redact_new(action_name.c_str()) == DSL_RESULT_SUCCESS ); THEN( "The Redact Action can be deleted" ) { REQUIRE( dsl_ode_action_delete(action_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_list_size() == 0 ); } } WHEN( "A new Redact Action is created" ) { REQUIRE( dsl_ode_action_redact_new(action_name.c_str()) == DSL_RESULT_SUCCESS ); THEN( "A second Redact Action of the same names fails to create" ) { REQUIRE( dsl_ode_action_redact_new(action_name.c_str()) == DSL_RESULT_ODE_ACTION_NAME_NOT_UNIQUE ); REQUIRE( dsl_ode_action_delete(action_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_list_size() == 0 ); } } } } SCENARIO( "A new Add Sink ODE Action can be created and deleted", "[ode-action-api]" ) { GIVEN( "Attributes for a new Add Sink ODE Action" ) { std::wstring action_name(L"sink_add-action"); std::wstring pipelineName(L"pipeline"); std::wstring sinkName(L"sink"); WHEN( "A new Add Sink Action is created" ) { REQUIRE( dsl_ode_action_sink_add_new(action_name.c_str(), pipelineName.c_str(), sinkName.c_str()) == DSL_RESULT_SUCCESS ); THEN( "The Add Sink Action can be deleted" ) { REQUIRE( dsl_ode_action_delete(action_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_list_size() == 0 ); } } WHEN( "A new Add Sink Action is created" ) { REQUIRE( dsl_ode_action_sink_add_new(action_name.c_str(), pipelineName.c_str(), sinkName.c_str()) == DSL_RESULT_SUCCESS ); THEN( "A second Add Sink Action of the same names fails to create" ) { REQUIRE( dsl_ode_action_sink_add_new(action_name.c_str(), pipelineName.c_str(), sinkName.c_str()) == DSL_RESULT_ODE_ACTION_NAME_NOT_UNIQUE ); REQUIRE( dsl_ode_action_delete(action_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_list_size() == 0 ); } } } } SCENARIO( "A new Remove Sink ODE Action can be created and deleted", "[ode-action-api]" ) { GIVEN( "Attributes for a new Remove Sink ODE Action" ) { std::wstring action_name(L"sink_add-action"); std::wstring pipelineName(L"pipeline"); std::wstring sinkName(L"sink"); WHEN( "A new Remove Sink Action is created" ) { REQUIRE( dsl_ode_action_sink_remove_new(action_name.c_str(), pipelineName.c_str(), sinkName.c_str()) == DSL_RESULT_SUCCESS ); THEN( "The Remove Sink Action can be deleted" ) { REQUIRE( dsl_ode_action_delete(action_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_list_size() == 0 ); } } WHEN( "A new Remove Sink Action is created" ) { REQUIRE( dsl_ode_action_sink_remove_new(action_name.c_str(), pipelineName.c_str(), sinkName.c_str()) == DSL_RESULT_SUCCESS ); THEN( "A second Remove Sink Action of the same names fails to create" ) { REQUIRE( dsl_ode_action_sink_remove_new(action_name.c_str(), pipelineName.c_str(), sinkName.c_str()) == DSL_RESULT_ODE_ACTION_NAME_NOT_UNIQUE ); REQUIRE( dsl_ode_action_delete(action_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_list_size() == 0 ); } } } } SCENARIO( "A new Add Source ODE Action can be created and deleted", "[ode-action-api]" ) { GIVEN( "Attributes for a new Add Source ODE Action" ) { std::wstring action_name(L"source_add-action"); std::wstring pipelineName(L"pipeline"); std::wstring sourceName(L"source"); WHEN( "A new Add Source Action is created" ) { REQUIRE( dsl_ode_action_source_add_new(action_name.c_str(), pipelineName.c_str(), sourceName.c_str()) == DSL_RESULT_SUCCESS ); THEN( "The Add Source Action can be deleted" ) { REQUIRE( dsl_ode_action_delete(action_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_list_size() == 0 ); } } WHEN( "A new Add Source Action is created" ) { REQUIRE( dsl_ode_action_source_add_new(action_name.c_str(), pipelineName.c_str(), sourceName.c_str()) == DSL_RESULT_SUCCESS ); THEN( "A second Add Source Action of the same names fails to create" ) { REQUIRE( dsl_ode_action_source_add_new(action_name.c_str(), pipelineName.c_str(), sourceName.c_str()) == DSL_RESULT_ODE_ACTION_NAME_NOT_UNIQUE ); REQUIRE( dsl_ode_action_delete(action_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_list_size() == 0 ); } } } } SCENARIO( "A new Remove Source ODE Action can be created and deleted", "[ode-action-api]" ) { GIVEN( "Attributes for a new Remove Source ODE Action" ) { std::wstring action_name(L"source_add-action"); std::wstring pipelineName(L"pipeline"); std::wstring sourceName(L"source"); WHEN( "A new Remove Source Action is created" ) { REQUIRE( dsl_ode_action_source_remove_new(action_name.c_str(), pipelineName.c_str(), sourceName.c_str()) == DSL_RESULT_SUCCESS ); THEN( "The Remove Source Action can be deleted" ) { REQUIRE( dsl_ode_action_delete(action_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_list_size() == 0 ); } } WHEN( "A new Remove Source Action is created" ) { REQUIRE( dsl_ode_action_source_remove_new(action_name.c_str(), pipelineName.c_str(), sourceName.c_str()) == DSL_RESULT_SUCCESS ); THEN( "A second Remove Source Action of the same names fails to create" ) { REQUIRE( dsl_ode_action_source_remove_new(action_name.c_str(), pipelineName.c_str(), sourceName.c_str()) == DSL_RESULT_ODE_ACTION_NAME_NOT_UNIQUE ); REQUIRE( dsl_ode_action_delete(action_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_list_size() == 0 ); } } } } SCENARIO( "A new Reset Trigger ODE Action can be created and deleted", "[ode-action-api]" ) { GIVEN( "Attributes for a new Reset Trigger ODE Action" ) { std::wstring action_name(L"trigger-reset-action"); std::wstring triggerName(L"trigger"); WHEN( "A new Reset Trigger Action is created" ) { REQUIRE( dsl_ode_action_trigger_reset_new(action_name.c_str(), triggerName.c_str()) == DSL_RESULT_SUCCESS ); THEN( "The Reset Trigger Action can be deleted" ) { REQUIRE( dsl_ode_action_delete(action_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_list_size() == 0 ); } } WHEN( "A new Reset Trigger Action is created" ) { REQUIRE( dsl_ode_action_trigger_reset_new(action_name.c_str(), triggerName.c_str()) == DSL_RESULT_SUCCESS ); THEN( "A second Reset Trigger Action of the same names fails to create" ) { REQUIRE( dsl_ode_action_trigger_reset_new(action_name.c_str(), triggerName.c_str()) == DSL_RESULT_ODE_ACTION_NAME_NOT_UNIQUE ); REQUIRE( dsl_ode_action_delete(action_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_list_size() == 0 ); } } } } SCENARIO( "A new Disable Trigger ODE Action can be created and deleted", "[ode-action-api]" ) { GIVEN( "Attributes for a new Disable Trigger ODE Action" ) { std::wstring action_name(L"trigger_disable-action"); std::wstring triggerName(L"trigger"); WHEN( "A new Disable Trigger Action is created" ) { REQUIRE( dsl_ode_action_trigger_disable_new(action_name.c_str(), triggerName.c_str()) == DSL_RESULT_SUCCESS ); THEN( "The Disable Trigger Action can be deleted" ) { REQUIRE( dsl_ode_action_delete(action_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_list_size() == 0 ); } } WHEN( "A new Disable Trigger Action is created" ) { REQUIRE( dsl_ode_action_trigger_disable_new(action_name.c_str(), triggerName.c_str()) == DSL_RESULT_SUCCESS ); THEN( "A second Disable Trigger Action of the same names fails to create" ) { REQUIRE( dsl_ode_action_trigger_disable_new(action_name.c_str(), triggerName.c_str()) == DSL_RESULT_ODE_ACTION_NAME_NOT_UNIQUE ); REQUIRE( dsl_ode_action_delete(action_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_list_size() == 0 ); } } } } SCENARIO( "A new Enable Trigger ODE Action can be created and deleted", "[ode-action-api]" ) { GIVEN( "Attributes for a new Enable Trigger ODE Action" ) { std::wstring action_name(L"trigger-enable-action"); std::wstring triggerName(L"trigger"); WHEN( "A new Enable Trigger Action is created" ) { REQUIRE( dsl_ode_action_trigger_enable_new(action_name.c_str(), triggerName.c_str()) == DSL_RESULT_SUCCESS ); THEN( "The Enable Trigger Action can be deleted" ) { REQUIRE( dsl_ode_action_delete(action_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_list_size() == 0 ); } } WHEN( "A new Enable Trigger Action is created" ) { REQUIRE( dsl_ode_action_trigger_enable_new(action_name.c_str(), triggerName.c_str()) == DSL_RESULT_SUCCESS ); THEN( "A second Enable Trigger Action of the same names fails to create" ) { REQUIRE( dsl_ode_action_trigger_enable_new(action_name.c_str(), triggerName.c_str()) == DSL_RESULT_ODE_ACTION_NAME_NOT_UNIQUE ); REQUIRE( dsl_ode_action_delete(action_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_list_size() == 0 ); } } } } SCENARIO( "A new Disable Action ODE Action can be created and deleted", "[ode-action-api]" ) { GIVEN( "Attributes for a new Disable Action ODE Action" ) { std::wstring action_name(L"action_disable-action"); std::wstring slaveActionName(L"action"); WHEN( "A new Disable Action Action is created" ) { REQUIRE( dsl_ode_action_action_disable_new(action_name.c_str(), slaveActionName.c_str()) == DSL_RESULT_SUCCESS ); THEN( "The Disable Action Action can be deleted" ) { REQUIRE( dsl_ode_action_delete(action_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_list_size() == 0 ); } } WHEN( "A new Disable Action Action is created" ) { REQUIRE( dsl_ode_action_action_disable_new(action_name.c_str(), slaveActionName.c_str()) == DSL_RESULT_SUCCESS ); THEN( "A second Disable Action Action of the same names fails to create" ) { REQUIRE( dsl_ode_action_action_disable_new(action_name.c_str(), slaveActionName.c_str()) == DSL_RESULT_ODE_ACTION_NAME_NOT_UNIQUE ); REQUIRE( dsl_ode_action_delete(action_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_list_size() == 0 ); } } } } SCENARIO( "A new Enable Action ODE Action can be created and deleted", "[ode-action-api]" ) { GIVEN( "Attributes for a new Enable Action ODE Action" ) { std::wstring action_name(L"action-enable-action"); std::wstring slaveActionName(L"action"); WHEN( "A new Enable Action Action is created" ) { REQUIRE( dsl_ode_action_action_enable_new(action_name.c_str(), slaveActionName.c_str()) == DSL_RESULT_SUCCESS ); THEN( "The Enable Action Action can be deleted" ) { REQUIRE( dsl_ode_action_delete(action_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_list_size() == 0 ); } } WHEN( "A new Enable Action Action is created" ) { REQUIRE( dsl_ode_action_action_enable_new(action_name.c_str(), slaveActionName.c_str()) == DSL_RESULT_SUCCESS ); THEN( "A second Enable Action Action of the same names fails to create" ) { REQUIRE( dsl_ode_action_action_enable_new(action_name.c_str(), slaveActionName.c_str()) == DSL_RESULT_ODE_ACTION_NAME_NOT_UNIQUE ); REQUIRE( dsl_ode_action_delete(action_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_list_size() == 0 ); } } } } SCENARIO( "A new Start Record Sink ODE Action can be created and deleted", "[ode-action-api]" ) { GIVEN( "Attributes for a new Start Record Sink ODE Action" ) { std::wstring action_name(L"start-record-action"); std::wstring recordSinkName(L"record-sink"); std::wstring outdir(L"./"); uint container(DSL_CONTAINER_MP4); uint codec(DSL_CODEC_H264); uint bitrate(2000000); uint interval(0); dsl_record_client_listener_cb client_listener; REQUIRE( dsl_sink_record_new(recordSinkName.c_str(), outdir.c_str(), codec, container, bitrate, interval, client_listener) == DSL_RESULT_SUCCESS ); WHEN( "A new Start Record Sink Action is created" ) { REQUIRE( dsl_ode_action_sink_record_start_new(action_name.c_str(), recordSinkName.c_str(), 1, 1, NULL) == DSL_RESULT_SUCCESS ); THEN( "The Start Record Sink Action can be deleted" ) { REQUIRE( dsl_ode_action_delete(action_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_list_size() == 0 ); REQUIRE( dsl_component_delete_all() == DSL_RESULT_SUCCESS ); } } WHEN( "A new Start Record Action is created" ) { REQUIRE( dsl_ode_action_sink_record_start_new(action_name.c_str(), recordSinkName.c_str(), 1, 1, NULL) == DSL_RESULT_SUCCESS ); THEN( "A second Start Record Action of the same names fails to create" ) { REQUIRE( dsl_ode_action_sink_record_start_new(action_name.c_str(), recordSinkName.c_str(), 1, 1, NULL) == DSL_RESULT_ODE_ACTION_NAME_NOT_UNIQUE ); REQUIRE( dsl_ode_action_delete(action_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_list_size() == 0 ); REQUIRE( dsl_component_delete_all() == DSL_RESULT_SUCCESS ); } } } } SCENARIO( "A new Stop Record Sink ODE Action can be created and deleted", "[ode-action-api]" ) { GIVEN( "Attributes for a new Stop Record Sink ODE Action" ) { std::wstring action_name(L"stop-record-action"); std::wstring recordSinkName(L"record-sink"); std::wstring outdir(L"./"); uint container(DSL_CONTAINER_MP4); uint codec(DSL_CODEC_H264); uint bitrate(2000000); uint interval(0); dsl_record_client_listener_cb client_listener; REQUIRE( dsl_sink_record_new(recordSinkName.c_str(), outdir.c_str(), codec, container, bitrate, interval, client_listener) == DSL_RESULT_SUCCESS ); WHEN( "A new Stop Record Sink Action is created" ) { REQUIRE( dsl_ode_action_sink_record_stop_new(action_name.c_str(), recordSinkName.c_str()) == DSL_RESULT_SUCCESS ); THEN( "The Stop Record Sink Action can be deleted" ) { REQUIRE( dsl_ode_action_delete(action_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_list_size() == 0 ); REQUIRE( dsl_component_delete_all() == DSL_RESULT_SUCCESS ); } } WHEN( "A new Stop Record Action is created" ) { REQUIRE( dsl_ode_action_sink_record_stop_new(action_name.c_str(), recordSinkName.c_str()) == DSL_RESULT_SUCCESS ); THEN( "A second Stop Record Action of the same names fails to create" ) { REQUIRE( dsl_ode_action_sink_record_stop_new(action_name.c_str(), recordSinkName.c_str()) == DSL_RESULT_ODE_ACTION_NAME_NOT_UNIQUE ); REQUIRE( dsl_ode_action_delete(action_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_list_size() == 0 ); REQUIRE( dsl_component_delete_all() == DSL_RESULT_SUCCESS ); } } } } SCENARIO( "A new Start Record Tap ODE Action can be created and deleted", "[ode-action-api]" ) { GIVEN( "Attributes for a new Start Record Tap ODE Action" ) { std::wstring action_name(L"start-record-action"); std::wstring recordTapName(L"record-sink"); std::wstring outdir(L"./"); uint container(DSL_CONTAINER_MP4); dsl_record_client_listener_cb client_listener; REQUIRE( dsl_tap_record_new(recordTapName.c_str(), outdir.c_str(), container, client_listener) == DSL_RESULT_SUCCESS ); WHEN( "A new Start Record Sink Action is created" ) { REQUIRE( dsl_ode_action_tap_record_start_new(action_name.c_str(), recordTapName.c_str(), 1, 1, NULL) == DSL_RESULT_SUCCESS ); THEN( "The Start Record Tap Action can be deleted" ) { REQUIRE( dsl_ode_action_delete(action_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_list_size() == 0 ); REQUIRE( dsl_component_delete_all() == DSL_RESULT_SUCCESS ); } } WHEN( "A new Start Record Tap Action is created" ) { REQUIRE( dsl_ode_action_tap_record_start_new(action_name.c_str(), recordTapName.c_str(), 1, 1, NULL) == DSL_RESULT_SUCCESS ); THEN( "A second Start Record Tap Action of the same names fails to create" ) { REQUIRE( dsl_ode_action_tap_record_start_new(action_name.c_str(), recordTapName.c_str(), 1, 1, NULL) == DSL_RESULT_ODE_ACTION_NAME_NOT_UNIQUE ); REQUIRE( dsl_ode_action_delete(action_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_list_size() == 0 ); REQUIRE( dsl_component_delete_all() == DSL_RESULT_SUCCESS ); } } } } SCENARIO( "A new Stop Record Tap ODE Action can be created and deleted", "[ode-action-api]" ) { GIVEN( "Attributes for a new Stop Record Tap ODE Action" ) { std::wstring action_name(L"stop-record-action"); std::wstring recordTapName(L"record-sink"); std::wstring outdir(L"./"); uint container(DSL_CONTAINER_MP4); dsl_record_client_listener_cb client_listener; REQUIRE( dsl_tap_record_new(recordTapName.c_str(), outdir.c_str(), container, client_listener) == DSL_RESULT_SUCCESS ); WHEN( "A new Stop Record Tap Action is created" ) { REQUIRE( dsl_ode_action_tap_record_start_new(action_name.c_str(), recordTapName.c_str(), 1, 1, NULL) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_list_size() == 1 ); THEN( "The Stop Record Tap Action can be deleted" ) { REQUIRE( dsl_ode_action_delete(action_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_list_size() == 0 ); REQUIRE( dsl_component_delete_all() == DSL_RESULT_SUCCESS ); } } WHEN( "A new Stop Record Tap Action is created" ) { REQUIRE( dsl_ode_action_tap_record_start_new(action_name.c_str(), recordTapName.c_str(), 1, 1, NULL) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_list_size() == 1 ); THEN( "A second Stop Record Tap Action of the same names fails to create" ) { REQUIRE( dsl_ode_action_tap_record_start_new(action_name.c_str(), recordTapName.c_str(), 1, 1, NULL) == DSL_RESULT_ODE_ACTION_NAME_NOT_UNIQUE ); REQUIRE( dsl_ode_action_delete(action_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_list_size() == 0 ); REQUIRE( dsl_component_delete_all() == DSL_RESULT_SUCCESS ); } } } } SCENARIO( "A new Tiler Show Source ODE Action can be created and deleted", "[ode-action-api]" ) { GIVEN( "Attributes for a new Tiler Show Source ODE Action" ) { std::wstring action_name(L"tiler-show-source-action"); std::wstring tilerName(L"action"); uint timeout(2); boolean has_precedence(true); WHEN( "A new Tiler Source Show Action is created" ) { REQUIRE( dsl_ode_action_tiler_source_show_new(action_name.c_str(), tilerName.c_str(), timeout, has_precedence) == DSL_RESULT_SUCCESS ); THEN( "The Tiler Show Source Action can be deleted" ) { REQUIRE( dsl_ode_action_delete(action_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_list_size() == 0 ); } } WHEN( "A new Tiler Source Show Action is created" ) { REQUIRE( dsl_ode_action_tiler_source_show_new(action_name.c_str(), tilerName.c_str(), timeout, has_precedence) == DSL_RESULT_SUCCESS ); THEN( "A second Enable Action Action of the same names fails to create" ) { REQUIRE( dsl_ode_action_tiler_source_show_new(action_name.c_str(), tilerName.c_str(), timeout, has_precedence) == DSL_RESULT_ODE_ACTION_NAME_NOT_UNIQUE ); REQUIRE( dsl_ode_action_delete(action_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_action_list_size() == 0 ); } } } } SCENARIO( "The ODE Action API checks for NULL input parameters", "[ode-action-api]" ) { GIVEN( "An empty list of Components" ) { std::wstring action_name = L"test-action"; std::wstring otherName = L"other"; uint interval(0); boolean enabled(0); REQUIRE( dsl_component_list_size() == 0 ); WHEN( "When NULL pointers are used as input" ) { THEN( "The API returns DSL_RESULT_INVALID_INPUT_PARAM in all cases" ) { REQUIRE( dsl_ode_action_custom_new(NULL, NULL, NULL) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_action_custom_new(action_name.c_str(), NULL, NULL) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_action_capture_frame_new(NULL, NULL, true) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_action_capture_frame_new(action_name.c_str(), NULL, true) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_action_capture_object_new(NULL, NULL) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_action_capture_object_new(action_name.c_str(), NULL) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_action_customize_label_new(NULL, NULL, 0) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_action_display_new(NULL, 0, 0, false, NULL, false, NULL) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_action_display_new(action_name.c_str(), 0, 0, false, NULL, false, NULL) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_action_file_new(NULL, NULL, DSL_WRITE_MODE_APPEND, DSL_EVENT_FILE_FORMAT_TEXT, false) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_action_file_new(action_name.c_str(), NULL, DSL_WRITE_MODE_APPEND, DSL_EVENT_FILE_FORMAT_TEXT, false) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_action_fill_frame_new(NULL, NULL) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_action_fill_frame_new(action_name.c_str(), NULL) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_action_fill_surroundings_new(NULL, NULL) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_action_fill_surroundings_new(action_name.c_str(), NULL) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_action_handler_disable_new(NULL, NULL) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_action_handler_disable_new(action_name.c_str(), NULL) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_action_log_new(NULL) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_action_display_meta_add_new(NULL, NULL) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_action_display_meta_add_new(action_name.c_str(), NULL) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_action_pause_new(NULL, NULL) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_action_pause_new(action_name.c_str(), NULL) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_action_print_new(NULL, false) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_action_redact_new(NULL) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_action_sink_add_new(NULL, NULL, NULL) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_action_sink_add_new(action_name.c_str(), NULL, NULL) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_action_sink_add_new(action_name.c_str(), otherName.c_str(), NULL) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_action_sink_remove_new(NULL, NULL, NULL) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_action_sink_remove_new(action_name.c_str(), NULL, NULL) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_action_sink_remove_new(action_name.c_str(), otherName.c_str(), NULL) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_action_sink_record_start_new(NULL, NULL, 0, 0, NULL) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_action_sink_record_start_new(action_name.c_str(), NULL, 0, 0, NULL) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_action_source_add_new(NULL, NULL, NULL) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_action_source_add_new(action_name.c_str(), NULL, NULL) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_action_source_add_new(action_name.c_str(), otherName.c_str(), NULL) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_action_source_remove_new(NULL, NULL, NULL) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_action_source_remove_new(action_name.c_str(), NULL, NULL) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_action_source_remove_new(action_name.c_str(), otherName.c_str(), NULL) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_action_tap_record_start_new(NULL, NULL, 0, 0, NULL) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_action_tap_record_start_new(action_name.c_str(), NULL, 0, 0, NULL) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_action_area_add_new(NULL, NULL, NULL) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_action_area_add_new(action_name.c_str(), NULL, NULL) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_action_area_add_new(action_name.c_str(), otherName.c_str(), NULL) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_action_area_remove_new(NULL, NULL, NULL) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_action_area_remove_new(action_name.c_str(), NULL, NULL) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_action_area_remove_new(action_name.c_str(), otherName.c_str(), NULL) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_action_trigger_disable_new(NULL, NULL) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_action_trigger_disable_new(action_name.c_str(), NULL) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_action_trigger_enable_new(NULL, NULL) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_action_trigger_enable_new(action_name.c_str(), NULL) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_action_trigger_reset_new(NULL, NULL) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_action_trigger_reset_new(action_name.c_str(), NULL) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_action_action_disable_new(NULL, NULL) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_action_action_disable_new(action_name.c_str(), NULL) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_action_action_enable_new(NULL, NULL) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_action_action_enable_new(action_name.c_str(), NULL) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_action_tiler_source_show_new(NULL, NULL, 1, true) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_action_tiler_source_show_new(action_name.c_str(), NULL, 1, true) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_action_enabled_get(NULL, &enabled) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_action_enabled_set(NULL, false) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_action_delete(NULL) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_action_delete_many(NULL) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_component_list_size() == 0 ); } } } } <|start_filename|>test/api/DslOdeTriggerApiTest.cpp<|end_filename|> /* The MIT License Copyright (c) 2019-2021, Prominence AI, Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in- all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "catch.hpp" #include "Dsl.h" #include "DslApi.h" SCENARIO( "The ODE Triggers container is updated correctly on multiple new ODE Triggers", "[ode-trigger-api]" ) { GIVEN( "An empty list of Triggers" ) { std::wstring odeTriggerName1(L"occurrence-1"); std::wstring odeTriggerName2(L"occurrence-2"); std::wstring odeTriggerName3(L"occurrence-3"); uint class_id(0); uint limit(0); REQUIRE( dsl_ode_trigger_list_size() == 0 ); WHEN( "Several new Triggers are created" ) { REQUIRE( dsl_ode_trigger_occurrence_new(odeTriggerName1.c_str(), NULL, class_id, limit) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_occurrence_new(odeTriggerName2.c_str(), NULL, class_id, limit) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_occurrence_new(odeTriggerName3.c_str(), NULL, class_id, limit) == DSL_RESULT_SUCCESS ); THEN( "The list size and events are updated correctly" ) { // TODO complete verification after addition of Iterator API REQUIRE( dsl_ode_trigger_list_size() == 3 ); REQUIRE( dsl_ode_trigger_delete_all() == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_list_size() == 0 ); } } } } SCENARIO( "The Triggers container is updated correctly on ODE Trigger deletion", "[ode-trigger-api]" ) { GIVEN( "A list of Triggers" ) { std::wstring odeTriggerName1(L"occurrence-1"); std::wstring odeTriggerName2(L"occurrence-2"); std::wstring odeTriggerName3(L"occurrence-3"); uint class_id(0); uint limit(0); REQUIRE( dsl_ode_trigger_occurrence_new(odeTriggerName1.c_str(), NULL, class_id, limit) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_occurrence_new(odeTriggerName2.c_str(), NULL, class_id, limit) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_occurrence_new(odeTriggerName3.c_str(), NULL, class_id, limit) == DSL_RESULT_SUCCESS ); WHEN( "When Triggers are deleted" ) { REQUIRE( dsl_ode_trigger_list_size() == 3 ); REQUIRE( dsl_ode_trigger_delete(odeTriggerName1.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_list_size() == 2 ); const wchar_t* eventList[] = {odeTriggerName2.c_str(), odeTriggerName3.c_str(), NULL}; REQUIRE( dsl_ode_trigger_delete_many(eventList) == DSL_RESULT_SUCCESS ); THEN( "The list size and events are updated correctly" ) { REQUIRE( dsl_ode_trigger_list_size() == 0 ); } } } } SCENARIO( "An ODE Trigger's Enabled setting can be set/get", "[ode-trigger-api]" ) { GIVEN( "An ODE Trigger" ) { std::wstring odeTriggerName(L"occurrence"); uint class_id(9); uint limit(0); REQUIRE( dsl_ode_trigger_occurrence_new(odeTriggerName.c_str(), NULL, class_id, limit) == DSL_RESULT_SUCCESS ); boolean ret_enabled(0); REQUIRE( dsl_ode_trigger_enabled_get(odeTriggerName.c_str(), &ret_enabled) == DSL_RESULT_SUCCESS ); REQUIRE( ret_enabled == 1 ); WHEN( "When the ODE Type's Enabled setting is disabled" ) { uint new_enabled(0); REQUIRE( dsl_ode_trigger_enabled_set(odeTriggerName.c_str(), new_enabled) == DSL_RESULT_SUCCESS ); THEN( "The correct value is returned on get" ) { REQUIRE( dsl_ode_trigger_enabled_get(odeTriggerName.c_str(), &ret_enabled) == DSL_RESULT_SUCCESS ); REQUIRE( ret_enabled == new_enabled ); REQUIRE( dsl_ode_trigger_delete_all() == DSL_RESULT_SUCCESS ); } } } } SCENARIO( "An ODE Trigger's Auto-Reset Timeout setting can be set/get", "[ode-trigger-api]" ) { GIVEN( "An ODE Trigger" ) { std::wstring odeTriggerName(L"occurrence"); uint class_id(9); uint limit(0); REQUIRE( dsl_ode_trigger_occurrence_new(odeTriggerName.c_str(), NULL, class_id, limit) == DSL_RESULT_SUCCESS ); uint ret_timeout(99); REQUIRE( dsl_ode_trigger_reset_timeout_get(odeTriggerName.c_str(), &ret_timeout) == DSL_RESULT_SUCCESS ); REQUIRE( ret_timeout == 0 ); WHEN( "When the ODE Type's Enabled setting is disabled" ) { uint new_timeout(44); REQUIRE( dsl_ode_trigger_reset_timeout_set(odeTriggerName.c_str(), new_timeout) == DSL_RESULT_SUCCESS ); THEN( "The correct value is returned on get" ) { REQUIRE( dsl_ode_trigger_reset_timeout_get(odeTriggerName.c_str(), &ret_timeout) == DSL_RESULT_SUCCESS ); REQUIRE( ret_timeout == new_timeout ); REQUIRE( dsl_ode_trigger_delete_all() == DSL_RESULT_SUCCESS ); } } } } SCENARIO( "An ODE Trigger's classId can be set/get", "[ode-trigger-api]" ) { GIVEN( "An ODE Trigger" ) { std::wstring odeTriggerName(L"occurrence"); uint class_id(9); uint limit(0); REQUIRE( dsl_ode_trigger_occurrence_new(odeTriggerName.c_str(), NULL, class_id, limit) == DSL_RESULT_SUCCESS ); uint ret_class_id(0); REQUIRE( dsl_ode_trigger_class_id_get(odeTriggerName.c_str(), &ret_class_id) == DSL_RESULT_SUCCESS ); REQUIRE( ret_class_id == class_id ); WHEN( "When the Trigger's classId is updated" ) { uint new_class_id(4); REQUIRE( dsl_ode_trigger_class_id_set(odeTriggerName.c_str(), new_class_id) == DSL_RESULT_SUCCESS ); THEN( "The correct value is returned on get" ) { REQUIRE( dsl_ode_trigger_class_id_get(odeTriggerName.c_str(), &ret_class_id) == DSL_RESULT_SUCCESS ); REQUIRE( ret_class_id == new_class_id ); REQUIRE( dsl_ode_trigger_delete_all() == DSL_RESULT_SUCCESS ); } } } } SCENARIO( "An ODE Trigger's limit can be set/get", "[ode-trigger-api]" ) { GIVEN( "An ODE Trigger" ) { std::wstring odeTriggerName(L"occurrence"); uint class_id(9); uint limit(0); REQUIRE( dsl_ode_trigger_occurrence_new(odeTriggerName.c_str(), NULL, class_id, limit) == DSL_RESULT_SUCCESS ); uint ret_class_id(0); REQUIRE( dsl_ode_trigger_class_id_get(odeTriggerName.c_str(), &ret_class_id) == DSL_RESULT_SUCCESS ); REQUIRE( ret_class_id == class_id ); uint ret_limit(0); REQUIRE( dsl_ode_trigger_limit_get(odeTriggerName.c_str(), &ret_limit) == DSL_RESULT_SUCCESS ); REQUIRE( ret_limit == limit ); WHEN( "When the Trigger's limit is updated" ) { uint new_limit(44); REQUIRE( dsl_ode_trigger_limit_set(odeTriggerName.c_str(), new_limit) == DSL_RESULT_SUCCESS ); THEN( "The correct value is returned on get" ) { REQUIRE( dsl_ode_trigger_limit_get(odeTriggerName.c_str(), &ret_limit) == DSL_RESULT_SUCCESS ); REQUIRE( ret_limit == new_limit ); REQUIRE( dsl_ode_trigger_delete_all() == DSL_RESULT_SUCCESS ); } } } } SCENARIO( "An ODE Trigger's minimum dimensions can be set/get", "[ode-trigger-api]" ) { GIVEN( "An ODE Trigger" ) { std::wstring odeTriggerName(L"occurrence"); uint limit(0); uint class_id(0); REQUIRE( dsl_ode_trigger_occurrence_new(odeTriggerName.c_str(), NULL, class_id, limit) == DSL_RESULT_SUCCESS ); float min_width(1), min_height(1); REQUIRE( dsl_ode_trigger_dimensions_min_get(odeTriggerName.c_str(), &min_width, &min_height) == DSL_RESULT_SUCCESS ); REQUIRE( min_width == 0 ); REQUIRE( min_height == 0 ); WHEN( "When the Trigger's min dimensions are updated" ) { float new_min_width(300), new_min_height(200); REQUIRE( dsl_ode_trigger_dimensions_min_set(odeTriggerName.c_str(), new_min_width, new_min_height) == DSL_RESULT_SUCCESS ); THEN( "The correct value is returned on get" ) { REQUIRE( dsl_ode_trigger_dimensions_min_get(odeTriggerName.c_str(), &min_width, &min_height) == DSL_RESULT_SUCCESS ); REQUIRE( min_width == new_min_width ); REQUIRE( min_height == new_min_height ); REQUIRE( dsl_ode_trigger_delete_all() == DSL_RESULT_SUCCESS ); } } } } SCENARIO( "An ODE Trigger's maximum dimensions can be set/get", "[ode-trigger-api]" ) { GIVEN( "An ODE Trigger" ) { std::wstring odeTriggerName(L"occurrence"); uint limit(0); uint class_id(0); REQUIRE( dsl_ode_trigger_occurrence_new(odeTriggerName.c_str(), NULL, class_id, limit) == DSL_RESULT_SUCCESS ); float max_width(1), max_height(1); REQUIRE( dsl_ode_trigger_dimensions_max_get(odeTriggerName.c_str(), &max_width, &max_height) == DSL_RESULT_SUCCESS ); REQUIRE( max_width == 0 ); REQUIRE( max_height == 0 ); WHEN( "When the Trigger's max dimensions are updated" ) { uint new_max_width(300), new_max_height(200); REQUIRE( dsl_ode_trigger_dimensions_max_set(odeTriggerName.c_str(), new_max_width, new_max_height) == DSL_RESULT_SUCCESS ); THEN( "The correct value is returned on get" ) { REQUIRE( dsl_ode_trigger_dimensions_max_get(odeTriggerName.c_str(), &max_width, &max_height) == DSL_RESULT_SUCCESS ); REQUIRE( max_width == new_max_width ); REQUIRE( max_height == new_max_height ); REQUIRE( dsl_ode_trigger_delete_all() == DSL_RESULT_SUCCESS ); } } } } SCENARIO( "An ODE Trigger's minimum frame count can be set/get", "[ode-trigger-api]" ) { GIVEN( "An ODE Trigger" ) { std::wstring odeTriggerName(L"first-occurrence"); uint class_id(0); uint limit(0); REQUIRE( dsl_ode_trigger_occurrence_new(odeTriggerName.c_str(), NULL, class_id, limit) == DSL_RESULT_SUCCESS ); uint min_count_n(0), min_count_d(0); REQUIRE( dsl_ode_trigger_frame_count_min_get(odeTriggerName.c_str(), &min_count_n, &min_count_d) == DSL_RESULT_SUCCESS ); REQUIRE( min_count_n == 1 ); REQUIRE( min_count_d == 1 ); WHEN( "When the Trigger's min frame count properties are updated" ) { uint new_min_count_n(300), new_min_count_d(200); REQUIRE( dsl_ode_trigger_frame_count_min_set(odeTriggerName.c_str(), new_min_count_n, new_min_count_d) == DSL_RESULT_SUCCESS ); THEN( "The correct value is returned on get" ) { REQUIRE( dsl_ode_trigger_frame_count_min_get(odeTriggerName.c_str(), &min_count_n, &min_count_d) == DSL_RESULT_SUCCESS ); REQUIRE( min_count_n == new_min_count_n ); REQUIRE( min_count_d == new_min_count_d ); REQUIRE( dsl_ode_trigger_delete_all() == DSL_RESULT_SUCCESS ); } } } } SCENARIO( "An ODE Trigger's interval can be set/get", "[ode-trigger-api]" ) { GIVEN( "An ODE Trigger" ) { std::wstring odeTriggerName(L"occurrence"); uint class_id(9); uint limit(0); REQUIRE( dsl_ode_trigger_occurrence_new(odeTriggerName.c_str(), NULL, class_id, limit) == DSL_RESULT_SUCCESS ); uint ret_interval(99); REQUIRE( dsl_ode_trigger_interval_get(odeTriggerName.c_str(), &ret_interval) == DSL_RESULT_SUCCESS ); REQUIRE( ret_interval == 0 ); WHEN( "When the Trigger's limit is updated" ) { uint new_interval(44); REQUIRE( dsl_ode_trigger_interval_set(odeTriggerName.c_str(), new_interval) == DSL_RESULT_SUCCESS ); THEN( "The correct value is returned on get" ) { REQUIRE( dsl_ode_trigger_interval_get(odeTriggerName.c_str(), &ret_interval) == DSL_RESULT_SUCCESS ); REQUIRE( ret_interval == new_interval ); REQUIRE( dsl_ode_trigger_delete_all() == DSL_RESULT_SUCCESS ); } } } } SCENARIO( "A new Absence Trigger can be created and deleted correctly", "[ode-trigger-api]" ) { GIVEN( "Attributes for a new Absence Trigger" ) { std::wstring odeTriggerName(L"absence"); uint class_id(0); uint limit(0); WHEN( "When the Trigger is created" ) { REQUIRE( dsl_ode_trigger_absence_new(odeTriggerName.c_str(), NULL, class_id, limit) == DSL_RESULT_SUCCESS ); THEN( "The Trigger can be deleted only once" ) { REQUIRE( dsl_ode_trigger_delete(odeTriggerName.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_list_size() == 0 ); REQUIRE( dsl_ode_trigger_delete(odeTriggerName.c_str()) == DSL_RESULT_ODE_TRIGGER_NAME_NOT_FOUND ); } } WHEN( "When the Trigger is created" ) { REQUIRE( dsl_ode_trigger_absence_new(odeTriggerName.c_str(), NULL, class_id, limit) == DSL_RESULT_SUCCESS ); THEN( "A second Trigger with the same name fails to create" ) { REQUIRE( dsl_ode_trigger_absence_new(odeTriggerName.c_str(), NULL, class_id, limit) == DSL_RESULT_ODE_TRIGGER_NAME_NOT_UNIQUE ); REQUIRE( dsl_ode_trigger_delete(odeTriggerName.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_list_size() == 0 ); } } } } SCENARIO( "A new Accumulation Trigger can be created and deleted correctly", "[ode-trigger-api]" ) { GIVEN( "Attributes for a new Accumulation Trigger" ) { std::wstring odeTriggerName(L"accumulation"); uint class_id(0); uint limit(0); WHEN( "When the Trigger is created" ) { REQUIRE( dsl_ode_trigger_accumulation_new(odeTriggerName.c_str(), NULL, class_id, limit) == DSL_RESULT_SUCCESS ); THEN( "The Trigger can be deleted only once" ) { REQUIRE( dsl_ode_trigger_delete(odeTriggerName.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_list_size() == 0 ); REQUIRE( dsl_ode_trigger_delete(odeTriggerName.c_str()) == DSL_RESULT_ODE_TRIGGER_NAME_NOT_FOUND ); } } WHEN( "When the Trigger is created" ) { REQUIRE( dsl_ode_trigger_accumulation_new(odeTriggerName.c_str(), NULL, class_id, limit) == DSL_RESULT_SUCCESS ); THEN( "A second Trigger with the same name fails to create" ) { REQUIRE( dsl_ode_trigger_accumulation_new(odeTriggerName.c_str(), NULL, class_id, limit) == DSL_RESULT_ODE_TRIGGER_NAME_NOT_UNIQUE ); REQUIRE( dsl_ode_trigger_delete(odeTriggerName.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_list_size() == 0 ); } } } } SCENARIO( "A new Instance Trigger can be created and deleted correctly", "[ode-trigger-api]" ) { GIVEN( "Attributes for a new Instance Trigger" ) { std::wstring odeTriggerName(L"instance"); uint class_id(0); uint limit(0); WHEN( "When the Trigger is created" ) { REQUIRE( dsl_ode_trigger_instance_new(odeTriggerName.c_str(), NULL, class_id, limit) == DSL_RESULT_SUCCESS ); THEN( "The Trigger can be deleted only once" ) { REQUIRE( dsl_ode_trigger_delete(odeTriggerName.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_list_size() == 0 ); REQUIRE( dsl_ode_trigger_delete(odeTriggerName.c_str()) == DSL_RESULT_ODE_TRIGGER_NAME_NOT_FOUND ); } } WHEN( "When the Trigger is created" ) { REQUIRE( dsl_ode_trigger_instance_new(odeTriggerName.c_str(), NULL, class_id, limit) == DSL_RESULT_SUCCESS ); THEN( "A second Trigger with the same name fails to create" ) { REQUIRE( dsl_ode_trigger_instance_new(odeTriggerName.c_str(), NULL, class_id, limit) == DSL_RESULT_ODE_TRIGGER_NAME_NOT_UNIQUE ); REQUIRE( dsl_ode_trigger_delete(odeTriggerName.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_list_size() == 0 ); } } } } SCENARIO( "A new Always Trigger can be created and deleted correctly", "[ode-trigger-api]" ) { GIVEN( "Attributes for a new Always Trigger" ) { std::wstring odeTriggerName(L"always"); uint when(DSL_ODE_POST_OCCURRENCE_CHECK); WHEN( "When the Trigger is created" ) { REQUIRE( dsl_ode_trigger_always_new(odeTriggerName.c_str(), NULL, when) == DSL_RESULT_SUCCESS ); THEN( "The Trigger can be deleted only once" ) { REQUIRE( dsl_ode_trigger_delete(odeTriggerName.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_list_size() == 0 ); REQUIRE( dsl_ode_trigger_delete(odeTriggerName.c_str()) == DSL_RESULT_ODE_TRIGGER_NAME_NOT_FOUND ); } } WHEN( "When the Trigger is created" ) { REQUIRE( dsl_ode_trigger_always_new(odeTriggerName.c_str(), NULL, when) == DSL_RESULT_SUCCESS ); THEN( "A second Trigger with the same name fails to create" ) { REQUIRE( dsl_ode_trigger_always_new(odeTriggerName.c_str(), NULL, when) == DSL_RESULT_ODE_TRIGGER_NAME_NOT_UNIQUE ); REQUIRE( dsl_ode_trigger_delete(odeTriggerName.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_list_size() == 0 ); } } WHEN( "When an Invalid 'when' parameter is provided" ) { when += 100; THEN( "A second Trigger with the same name fails to create" ) { REQUIRE( dsl_ode_trigger_always_new(odeTriggerName.c_str(), NULL, when+100) == DSL_RESULT_ODE_TRIGGER_PARAMETER_INVALID ); REQUIRE( dsl_ode_trigger_list_size() == 0 ); } } } } SCENARIO( "A new Count Trigger can be created and deleted correctly", "[ode-trigger-api]" ) { GIVEN( "Attributes for a new Count Trigger" ) { std::wstring odeTriggerName(L"count"); uint class_id(0); uint limit(0); uint minimum(10); uint maximum(30); WHEN( "When the Trigger is created" ) { REQUIRE( dsl_ode_trigger_count_new(odeTriggerName.c_str(), NULL, class_id, limit, minimum, maximum) == DSL_RESULT_SUCCESS ); THEN( "The Trigger can be deleted only once" ) { REQUIRE( dsl_ode_trigger_delete(odeTriggerName.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_list_size() == 0 ); REQUIRE( dsl_ode_trigger_delete(odeTriggerName.c_str()) == DSL_RESULT_ODE_TRIGGER_NAME_NOT_FOUND ); } } WHEN( "When the Trigger is created" ) { REQUIRE( dsl_ode_trigger_count_new(odeTriggerName.c_str(), NULL, class_id, limit, minimum, maximum) == DSL_RESULT_SUCCESS ); THEN( "A second Trigger with the same name fails to create" ) { REQUIRE( dsl_ode_trigger_count_new(odeTriggerName.c_str(), NULL, class_id, limit, minimum, maximum) == DSL_RESULT_ODE_TRIGGER_NAME_NOT_UNIQUE ); REQUIRE( dsl_ode_trigger_delete(odeTriggerName.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_list_size() == 0 ); } } } } SCENARIO( "An ODE Count Trigger's minimum and maximum can be set/get", "[ode-trigger-api]" ) { GIVEN( "An ODE Count Trigger" ) { std::wstring odeTriggerName(L"count"); uint class_id(0); uint limit(0); uint minimum(10); uint maximum(30); REQUIRE( dsl_ode_trigger_count_new(odeTriggerName.c_str(), NULL, class_id, limit, minimum, maximum) == DSL_RESULT_SUCCESS ); uint ret_minimum(1), ret_maximum(1); REQUIRE( dsl_ode_trigger_count_range_get(odeTriggerName.c_str(), &ret_minimum, &ret_maximum) == DSL_RESULT_SUCCESS ); REQUIRE( ret_minimum == minimum ); REQUIRE( ret_maximum == maximum ); WHEN( "When the Count Trigger's minimum and maximum are updated" ) { uint new_minimum(100), new_maximum(200); REQUIRE( dsl_ode_trigger_count_range_set(odeTriggerName.c_str(), new_minimum, new_maximum) == DSL_RESULT_SUCCESS ); THEN( "The correct values are returned on get" ) { REQUIRE( dsl_ode_trigger_count_range_get(odeTriggerName.c_str(), &ret_minimum, &ret_maximum) == DSL_RESULT_SUCCESS ); REQUIRE( new_minimum == ret_minimum ); REQUIRE( new_maximum == ret_maximum ); REQUIRE( dsl_ode_trigger_delete_all() == DSL_RESULT_SUCCESS ); } } // Need to test special case of Maximum = 0 WHEN( "When the Count Trigger's maximum is set to 0" ) { uint new_minimum(100), new_maximum(0); REQUIRE( dsl_ode_trigger_count_range_set(odeTriggerName.c_str(), new_minimum, new_maximum) == DSL_RESULT_SUCCESS ); THEN( "The correct values are returned on get" ) { REQUIRE( dsl_ode_trigger_count_range_get(odeTriggerName.c_str(), &ret_minimum, &ret_maximum) == DSL_RESULT_SUCCESS ); REQUIRE( new_minimum == ret_minimum ); REQUIRE( new_maximum == ret_maximum ); REQUIRE( dsl_ode_trigger_delete_all() == DSL_RESULT_SUCCESS ); } } } } SCENARIO( "A new Summation Trigger can be created and deleted correctly", "[ode-trigger-api]" ) { GIVEN( "Attributes for a new Summation Trigger" ) { std::wstring odeTriggerName(L"summation"); uint class_id(0); uint limit(0); WHEN( "When the Trigger is created" ) { REQUIRE( dsl_ode_trigger_summation_new(odeTriggerName.c_str(), NULL, class_id, limit) == DSL_RESULT_SUCCESS ); THEN( "The Trigger can be deleted only once" ) { REQUIRE( dsl_ode_trigger_delete(odeTriggerName.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_list_size() == 0 ); REQUIRE( dsl_ode_trigger_delete(odeTriggerName.c_str()) == DSL_RESULT_ODE_TRIGGER_NAME_NOT_FOUND ); } } WHEN( "When the Trigger is created" ) { REQUIRE( dsl_ode_trigger_summation_new(odeTriggerName.c_str(), NULL, class_id, limit) == DSL_RESULT_SUCCESS ); THEN( "A second Trigger with the same name fails to create" ) { REQUIRE( dsl_ode_trigger_summation_new(odeTriggerName.c_str(), NULL, class_id, limit) == DSL_RESULT_ODE_TRIGGER_NAME_NOT_UNIQUE ); REQUIRE( dsl_ode_trigger_delete(odeTriggerName.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_list_size() == 0 ); } } } } SCENARIO( "A new Intersection Trigger can be created and deleted correctly", "[ode-trigger-api]" ) { GIVEN( "Attributes for a new Intersection Trigger" ) { std::wstring odeTriggerName(L"intersection"); uint class_id_a(0); uint class_id_b(0); uint limit(0); WHEN( "When the Trigger is created" ) { REQUIRE( dsl_ode_trigger_intersection_new(odeTriggerName.c_str(), NULL, class_id_a, class_id_b, limit) == DSL_RESULT_SUCCESS ); THEN( "The Trigger can be deleted only once" ) { REQUIRE( dsl_ode_trigger_delete(odeTriggerName.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_list_size() == 0 ); REQUIRE( dsl_ode_trigger_delete(odeTriggerName.c_str()) == DSL_RESULT_ODE_TRIGGER_NAME_NOT_FOUND ); } } WHEN( "When the Trigger is created" ) { REQUIRE( dsl_ode_trigger_intersection_new(odeTriggerName.c_str(), NULL, class_id_a, class_id_b, limit) == DSL_RESULT_SUCCESS ); THEN( "A second Trigger with the same name fails to create" ) { REQUIRE( dsl_ode_trigger_intersection_new(odeTriggerName.c_str(), NULL, class_id_a, class_id_b, limit) == DSL_RESULT_ODE_TRIGGER_NAME_NOT_UNIQUE ); REQUIRE( dsl_ode_trigger_delete(odeTriggerName.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_list_size() == 0 ); } } } } SCENARIO( "A new Smallest Trigger can be created and deleted correctly", "[ode-trigger-api]" ) { GIVEN( "Attributes for a new Smallest Trigger" ) { std::wstring odeTriggerName(L"smallest"); uint class_id(0); uint limit(0); WHEN( "When the Trigger is created" ) { REQUIRE( dsl_ode_trigger_smallest_new(odeTriggerName.c_str(), NULL, class_id, limit) == DSL_RESULT_SUCCESS ); THEN( "The Trigger can be deleted only once" ) { REQUIRE( dsl_ode_trigger_delete(odeTriggerName.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_list_size() == 0 ); REQUIRE( dsl_ode_trigger_delete(odeTriggerName.c_str()) == DSL_RESULT_ODE_TRIGGER_NAME_NOT_FOUND ); } } WHEN( "When the Trigger is created" ) { REQUIRE( dsl_ode_trigger_smallest_new(odeTriggerName.c_str(), NULL, class_id, limit) == DSL_RESULT_SUCCESS ); THEN( "A second Trigger with the same name fails to create" ) { REQUIRE( dsl_ode_trigger_smallest_new(odeTriggerName.c_str(), NULL, class_id, limit) == DSL_RESULT_ODE_TRIGGER_NAME_NOT_UNIQUE ); REQUIRE( dsl_ode_trigger_delete(odeTriggerName.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_list_size() == 0 ); } } } } SCENARIO( "A new Largest Trigger can be created and deleted correctly", "[ode-trigger-api]" ) { GIVEN( "Attributes for a new Largest Trigger" ) { std::wstring odeTriggerName(L"largest"); uint class_id(0); uint limit(0); WHEN( "When the Trigger is created" ) { REQUIRE( dsl_ode_trigger_largest_new(odeTriggerName.c_str(), NULL, class_id, limit) == DSL_RESULT_SUCCESS ); THEN( "The Trigger can be deleted only once" ) { REQUIRE( dsl_ode_trigger_delete(odeTriggerName.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_list_size() == 0 ); REQUIRE( dsl_ode_trigger_delete(odeTriggerName.c_str()) == DSL_RESULT_ODE_TRIGGER_NAME_NOT_FOUND ); } } WHEN( "When the Trigger is created" ) { REQUIRE( dsl_ode_trigger_largest_new(odeTriggerName.c_str(), NULL, class_id, limit) == DSL_RESULT_SUCCESS ); THEN( "A second Trigger with the same name fails to create" ) { REQUIRE( dsl_ode_trigger_largest_new(odeTriggerName.c_str(), NULL, class_id, limit) == DSL_RESULT_ODE_TRIGGER_NAME_NOT_UNIQUE ); REQUIRE( dsl_ode_trigger_delete(odeTriggerName.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_list_size() == 0 ); } } } } SCENARIO( "A new Latest Trigger can be created and deleted correctly", "[ode-trigger-api]" ) { GIVEN( "Attributes for a new Latest Trigger" ) { std::wstring odeTriggerName(L"latest"); uint class_id(0); uint limit(0); WHEN( "When the Trigger is created" ) { REQUIRE( dsl_ode_trigger_latest_new(odeTriggerName.c_str(), NULL, class_id, limit) == DSL_RESULT_SUCCESS ); THEN( "The Trigger can be deleted only once" ) { REQUIRE( dsl_ode_trigger_delete(odeTriggerName.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_list_size() == 0 ); REQUIRE( dsl_ode_trigger_delete(odeTriggerName.c_str()) == DSL_RESULT_ODE_TRIGGER_NAME_NOT_FOUND ); } } WHEN( "When the Trigger is created" ) { REQUIRE( dsl_ode_trigger_latest_new(odeTriggerName.c_str(), NULL, class_id, limit) == DSL_RESULT_SUCCESS ); THEN( "A second Trigger with the same name fails to create" ) { REQUIRE( dsl_ode_trigger_latest_new(odeTriggerName.c_str(), NULL, class_id, limit) == DSL_RESULT_ODE_TRIGGER_NAME_NOT_UNIQUE ); REQUIRE( dsl_ode_trigger_delete(odeTriggerName.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_list_size() == 0 ); } } } } SCENARIO( "A new Earliest Trigger can be created and deleted correctly", "[ode-trigger-api]" ) { GIVEN( "Attributes for a new Earliest Trigger" ) { std::wstring odeTriggerName(L"earliest"); uint class_id(0); uint limit(0); WHEN( "When the Trigger is created" ) { REQUIRE( dsl_ode_trigger_earliest_new(odeTriggerName.c_str(), NULL, class_id, limit) == DSL_RESULT_SUCCESS ); THEN( "The Trigger can be deleted only once" ) { REQUIRE( dsl_ode_trigger_delete(odeTriggerName.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_list_size() == 0 ); REQUIRE( dsl_ode_trigger_delete(odeTriggerName.c_str()) == DSL_RESULT_ODE_TRIGGER_NAME_NOT_FOUND ); } } WHEN( "When the Trigger is created" ) { REQUIRE( dsl_ode_trigger_earliest_new(odeTriggerName.c_str(), NULL, class_id, limit) == DSL_RESULT_SUCCESS ); THEN( "A second Trigger with the same name fails to create" ) { REQUIRE( dsl_ode_trigger_earliest_new(odeTriggerName.c_str(), NULL, class_id, limit) == DSL_RESULT_ODE_TRIGGER_NAME_NOT_UNIQUE ); REQUIRE( dsl_ode_trigger_delete(odeTriggerName.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_list_size() == 0 ); } } } } SCENARIO( "A new Persistence Trigger can be created and deleted correctly", "[ode-trigger-api]" ) { GIVEN( "Attributes for a new Persistence Trigger" ) { std::wstring odeTriggerName(L"persistence"); uint class_id(0); uint limit(0); uint minimum(10); uint maximum(30); WHEN( "When the Trigger is created" ) { REQUIRE( dsl_ode_trigger_persistence_new(odeTriggerName.c_str(), NULL, class_id, limit, minimum, maximum) == DSL_RESULT_SUCCESS ); THEN( "The Trigger can be deleted only once" ) { REQUIRE( dsl_ode_trigger_delete(odeTriggerName.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_list_size() == 0 ); REQUIRE( dsl_ode_trigger_delete(odeTriggerName.c_str()) == DSL_RESULT_ODE_TRIGGER_NAME_NOT_FOUND ); } } WHEN( "When the Trigger is created" ) { REQUIRE( dsl_ode_trigger_persistence_new(odeTriggerName.c_str(), NULL, class_id, limit, minimum, maximum) == DSL_RESULT_SUCCESS ); THEN( "A second Trigger with the same name fails to create" ) { REQUIRE( dsl_ode_trigger_persistence_new(odeTriggerName.c_str(), NULL, class_id, limit, minimum, maximum) == DSL_RESULT_ODE_TRIGGER_NAME_NOT_UNIQUE ); REQUIRE( dsl_ode_trigger_delete(odeTriggerName.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_list_size() == 0 ); } } } } SCENARIO( "An ODE Persistence Trigger's minimum and maximum can be set/get", "[ode-trigger-api]" ) { GIVEN( "An ODE Persistence Trigger" ) { std::wstring odeTriggerName(L"persistence"); uint class_id(0); uint limit(0); uint minimum(10); uint maximum(30); REQUIRE( dsl_ode_trigger_persistence_new(odeTriggerName.c_str(), NULL, class_id, limit, minimum, maximum) == DSL_RESULT_SUCCESS ); uint ret_minimum(1), ret_maximum(1); REQUIRE( dsl_ode_trigger_persistence_range_get(odeTriggerName.c_str(), &ret_minimum, &ret_maximum) == DSL_RESULT_SUCCESS ); REQUIRE( ret_minimum == minimum ); REQUIRE( ret_maximum == maximum ); WHEN( "When the Count Trigger's minimum and maximum are updated" ) { uint new_minimum(100), new_maximum(200); REQUIRE( dsl_ode_trigger_persistence_range_set(odeTriggerName.c_str(), new_minimum, new_maximum) == DSL_RESULT_SUCCESS ); THEN( "The correct values are returned on get" ) { REQUIRE( dsl_ode_trigger_persistence_range_get(odeTriggerName.c_str(), &ret_minimum, &ret_maximum) == DSL_RESULT_SUCCESS ); REQUIRE( new_minimum == ret_minimum ); REQUIRE( new_maximum == ret_maximum ); REQUIRE( dsl_ode_trigger_delete_all() == DSL_RESULT_SUCCESS ); } } // need to test special case of maximum = 0 WHEN( "When the Count Trigger's maximum is set to 0" ) { uint new_minimum(100), new_maximum(0); REQUIRE( dsl_ode_trigger_persistence_range_set(odeTriggerName.c_str(), new_minimum, new_maximum) == DSL_RESULT_SUCCESS ); THEN( "The correct values are returned on get" ) { REQUIRE( dsl_ode_trigger_persistence_range_get(odeTriggerName.c_str(), &ret_minimum, &ret_maximum) == DSL_RESULT_SUCCESS ); REQUIRE( new_minimum == ret_minimum ); REQUIRE( new_maximum == ret_maximum ); REQUIRE( dsl_ode_trigger_delete_all() == DSL_RESULT_SUCCESS ); } } } } SCENARIO( "A New High Trigger can be created and deleted correctly", "[ode-trigger-api]" ) { GIVEN( "Attributes for a new High Trigger" ) { std::wstring odeTriggerName(L"new-high"); uint class_id(0); uint limit(0); uint preset(0); WHEN( "When the Trigger is created" ) { REQUIRE( dsl_ode_trigger_new_high_new(odeTriggerName.c_str(), NULL, class_id, limit, preset) == DSL_RESULT_SUCCESS ); THEN( "The Trigger can be deleted only once" ) { REQUIRE( dsl_ode_trigger_delete(odeTriggerName.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_list_size() == 0 ); REQUIRE( dsl_ode_trigger_delete(odeTriggerName.c_str()) == DSL_RESULT_ODE_TRIGGER_NAME_NOT_FOUND ); } } WHEN( "When the Trigger is created" ) { REQUIRE( dsl_ode_trigger_new_high_new(odeTriggerName.c_str(), NULL, class_id, limit, preset) == DSL_RESULT_SUCCESS ); THEN( "A second Trigger with the same name fails to create" ) { REQUIRE( dsl_ode_trigger_new_high_new(odeTriggerName.c_str(), NULL, class_id, limit, preset) == DSL_RESULT_ODE_TRIGGER_NAME_NOT_UNIQUE ); REQUIRE( dsl_ode_trigger_delete(odeTriggerName.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_list_size() == 0 ); } } } } SCENARIO( "A New Low Trigger can be created and deleted correctly", "[ode-trigger-api]" ) { GIVEN( "Attributes for a new Low Trigger" ) { std::wstring odeTriggerName(L"new-low"); uint class_id(0); uint limit(0); uint preset(0); WHEN( "When the Trigger is created" ) { REQUIRE( dsl_ode_trigger_new_low_new(odeTriggerName.c_str(), NULL, class_id, limit, preset) == DSL_RESULT_SUCCESS ); THEN( "The Trigger can be deleted only once" ) { REQUIRE( dsl_ode_trigger_delete(odeTriggerName.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_list_size() == 0 ); REQUIRE( dsl_ode_trigger_delete(odeTriggerName.c_str()) == DSL_RESULT_ODE_TRIGGER_NAME_NOT_FOUND ); } } WHEN( "When the Trigger is created" ) { REQUIRE( dsl_ode_trigger_new_low_new(odeTriggerName.c_str(), NULL, class_id, limit, preset) == DSL_RESULT_SUCCESS ); THEN( "A second Trigger with the same name fails to create" ) { REQUIRE( dsl_ode_trigger_new_low_new(odeTriggerName.c_str(), NULL, class_id, limit, preset) == DSL_RESULT_ODE_TRIGGER_NAME_NOT_UNIQUE ); REQUIRE( dsl_ode_trigger_delete(odeTriggerName.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_list_size() == 0 ); } } } } SCENARIO( "A new Distance Trigger can be created and deleted correctly", "[ode-trigger-api]" ) { GIVEN( "Attributes for a new Distance Trigger" ) { std::wstring odeTriggerName(L"Distance"); uint class_id_a(0); uint class_id_b(0); uint limit(0); uint minimum(10); uint maximum(30); uint test_point(DSL_BBOX_POINT_ANY); uint test_method(DSL_DISTANCE_METHOD_FIXED_PIXELS); WHEN( "When the Trigger is created" ) { REQUIRE( dsl_ode_trigger_distance_new(odeTriggerName.c_str(), NULL, class_id_a, class_id_b, limit, minimum, maximum, test_point, test_method) == DSL_RESULT_SUCCESS ); THEN( "The Trigger can be deleted only once" ) { REQUIRE( dsl_ode_trigger_delete(odeTriggerName.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_list_size() == 0 ); REQUIRE( dsl_ode_trigger_delete(odeTriggerName.c_str()) == DSL_RESULT_ODE_TRIGGER_NAME_NOT_FOUND ); } } WHEN( "When the Trigger is created" ) { REQUIRE( dsl_ode_trigger_distance_new(odeTriggerName.c_str(), NULL, class_id_a, class_id_b, limit, minimum, maximum, test_point, test_method) == DSL_RESULT_SUCCESS ); THEN( "A second Trigger with the same name fails to create" ) { REQUIRE( dsl_ode_trigger_distance_new(odeTriggerName.c_str(), NULL, class_id_a, class_id_b, limit, minimum, maximum, test_point, test_method) == DSL_RESULT_ODE_TRIGGER_NAME_NOT_UNIQUE ); REQUIRE( dsl_ode_trigger_delete(odeTriggerName.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_ode_trigger_list_size() == 0 ); } } } } SCENARIO( "An ODE Distance Trigger's minimum and maximum can be set/get", "[ode-trigger-api]" ) { GIVEN( "An ODE Distance Trigger" ) { std::wstring odeTriggerName(L"Distance"); uint class_id_a(0); uint class_id_b(0); uint limit(0); uint minimum(10); uint maximum(30); uint test_point(DSL_BBOX_POINT_ANY); uint test_method(DSL_DISTANCE_METHOD_FIXED_PIXELS); REQUIRE( dsl_ode_trigger_distance_new(odeTriggerName.c_str(), NULL, class_id_a, class_id_b, limit, minimum, maximum, test_point, test_method) == DSL_RESULT_SUCCESS ); uint ret_minimum(1), ret_maximum(1); REQUIRE( dsl_ode_trigger_distance_range_get(odeTriggerName.c_str(), &ret_minimum, &ret_maximum) == DSL_RESULT_SUCCESS ); REQUIRE( ret_minimum == minimum ); REQUIRE( ret_maximum == maximum ); WHEN( "When the Distance Trigger's minimum and maximum are updated" ) { uint new_minimum(100), new_maximum(200); REQUIRE( dsl_ode_trigger_distance_range_set(odeTriggerName.c_str(), new_minimum, new_maximum) == DSL_RESULT_SUCCESS ); THEN( "The correct values are returned on get" ) { REQUIRE( dsl_ode_trigger_distance_range_get(odeTriggerName.c_str(), &ret_minimum, &ret_maximum) == DSL_RESULT_SUCCESS ); REQUIRE( new_minimum == ret_minimum ); REQUIRE( new_maximum == ret_maximum ); REQUIRE( dsl_ode_trigger_delete_all() == DSL_RESULT_SUCCESS ); } } // maximum = 0 is handled as special case WHEN( "When the Distance Trigger's maximum is set to 0" ) { uint new_minimum(100), new_maximum(0); REQUIRE( dsl_ode_trigger_distance_range_set(odeTriggerName.c_str(), new_minimum, new_maximum) == DSL_RESULT_SUCCESS ); THEN( "The correct values are returned on get" ) { REQUIRE( dsl_ode_trigger_distance_range_get(odeTriggerName.c_str(), &ret_minimum, &ret_maximum) == DSL_RESULT_SUCCESS ); REQUIRE( new_minimum == ret_minimum ); REQUIRE( new_maximum == ret_maximum ); REQUIRE( dsl_ode_trigger_delete_all() == DSL_RESULT_SUCCESS ); } } } } SCENARIO( "An ODE Distance Trigger's test parameters can be set/get", "[ode-trigger-api]" ) { GIVEN( "An ODE Distance Trigger" ) { std::wstring odeTriggerName(L"Distance"); uint class_id_a(0); uint class_id_b(0); uint limit(0); uint minimum(10); uint maximum(30); uint test_point(DSL_BBOX_POINT_ANY); uint test_method(DSL_DISTANCE_METHOD_FIXED_PIXELS); REQUIRE( dsl_ode_trigger_distance_new(odeTriggerName.c_str(), NULL, class_id_a, class_id_b, limit, minimum, maximum, test_point, test_method) == DSL_RESULT_SUCCESS ); uint ret_test_point(1), ret_test_method(1); REQUIRE( dsl_ode_trigger_distance_test_params_get(odeTriggerName.c_str(), &ret_test_point, &ret_test_method) == DSL_RESULT_SUCCESS ); REQUIRE( ret_test_point == test_point ); REQUIRE( ret_test_method == test_method ); WHEN( "When the Distance Trigger's minimum and maximum are updated" ) { uint new_test_point(DSL_BBOX_POINT_CENTER), new_test_method(DSL_DISTANCE_METHOD_PERCENT_HEIGHT_B); REQUIRE( dsl_ode_trigger_distance_test_params_set(odeTriggerName.c_str(), new_test_point, new_test_method) == DSL_RESULT_SUCCESS ); THEN( "The correct values are returned on get" ) { REQUIRE( dsl_ode_trigger_distance_test_params_get(odeTriggerName.c_str(), &ret_test_point, &ret_test_method) == DSL_RESULT_SUCCESS ); REQUIRE( new_test_point == ret_test_point ); REQUIRE( new_test_method == ret_test_method ); REQUIRE( dsl_ode_trigger_delete_all() == DSL_RESULT_SUCCESS ); } } } } SCENARIO( "The ODE Trigger API checks for NULL input parameters", "[ode-trigger-api]" ) { GIVEN( "An empty list of Components" ) { std::wstring triggerName = L"test-trigger"; std::wstring otherName = L"other"; uint class_id(0); const wchar_t* source(NULL); boolean enabled(0), infer(0); float confidence(0), min_height(0), min_width(0), max_height(0), max_width(0); uint minimum(0), maximum(0), test_point(DSL_BBOX_POINT_CENTER), test_method(DSL_DISTANCE_METHOD_PERCENT_HEIGHT_A); dsl_ode_check_for_occurrence_cb callback; REQUIRE( dsl_component_list_size() == 0 ); WHEN( "When NULL pointers are used as input" ) { THEN( "The API returns DSL_RESULT_INVALID_INPUT_PARAM in all cases" ) { REQUIRE( dsl_ode_trigger_always_new(NULL, NULL, 0) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_trigger_occurrence_new(NULL, NULL, 0, 0) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_trigger_instance_new(NULL, NULL, 0, 0) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_trigger_absence_new(NULL, NULL, 0, 0) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_trigger_intersection_new(NULL, NULL, 0, 0, 0) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_trigger_summation_new(NULL, NULL, 0, 0) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_trigger_custom_new(NULL, NULL, 0, 0, NULL, NULL, NULL) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_trigger_custom_new(triggerName.c_str(), NULL, 0, 0, NULL, NULL, NULL) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_trigger_custom_new(triggerName.c_str(), NULL, 0, 0, callback, NULL, NULL) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_trigger_count_new(NULL, NULL, 0, 0, 0, 0) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_trigger_count_range_get(NULL, &minimum, &maximum) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_trigger_count_range_set(NULL, minimum, maximum) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_trigger_distance_new(NULL, NULL, 0, 0, 0, 0, 0, 0, 0) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_trigger_distance_range_get(NULL, &minimum, &maximum) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_trigger_distance_range_set(NULL, minimum, maximum) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_trigger_distance_test_params_get(NULL, &test_point, &test_method) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_trigger_distance_test_params_set(NULL, test_point, test_method) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_trigger_smallest_new(NULL, NULL, 0, 0) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_trigger_largest_new(NULL, NULL, 0, 0) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_trigger_persistence_new(NULL, NULL, 0, 0, 1, 2) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_trigger_persistence_range_get(NULL, &minimum, &maximum) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_trigger_persistence_range_set(NULL, minimum, maximum) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_trigger_new_low_new(NULL, NULL, 0, 0, 0) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_trigger_new_high_new(NULL, NULL, 0, 0, 0) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_trigger_reset(NULL) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_trigger_enabled_get(NULL, &enabled) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_trigger_enabled_set(NULL, enabled) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_trigger_class_id_get(NULL, &class_id) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_trigger_class_id_set(NULL, class_id) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_trigger_class_id_ab_get(NULL, &class_id, &class_id) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_trigger_class_id_ab_set(NULL, class_id, class_id) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_trigger_source_get(NULL, &source) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_trigger_source_set(NULL, source) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_trigger_confidence_min_get(NULL, &confidence) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_trigger_confidence_min_set(NULL, confidence) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_trigger_dimensions_min_get(NULL, &min_width, &min_height) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_trigger_dimensions_min_set(NULL, min_width, min_height) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_trigger_dimensions_max_get(NULL, &max_width, &max_height) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_trigger_dimensions_max_set(NULL, max_width, max_height) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_trigger_infer_done_only_get(NULL, &infer) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_trigger_infer_done_only_set(NULL, infer) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_trigger_action_add(NULL, NULL) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_trigger_action_add(triggerName.c_str(), NULL) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_trigger_action_add_many(NULL, NULL) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_trigger_action_add_many(triggerName.c_str(), NULL) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_trigger_action_remove(NULL, NULL) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_trigger_action_remove(triggerName.c_str(), NULL) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_trigger_action_remove_many(NULL, NULL) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_trigger_action_remove_many(triggerName.c_str(), NULL) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_trigger_action_remove_all(NULL) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_trigger_area_add(NULL, NULL) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_trigger_area_add(triggerName.c_str(), NULL) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_trigger_area_add_many(NULL, NULL) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_trigger_area_add_many(triggerName.c_str(), NULL) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_trigger_area_remove(NULL, NULL) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_trigger_area_remove(triggerName.c_str(), NULL) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_trigger_area_remove_many(NULL, NULL) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_trigger_area_remove_many(triggerName.c_str(), NULL) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_trigger_area_remove_all(NULL) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_trigger_delete(NULL) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_ode_trigger_delete_many(NULL) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_component_list_size() == 0 ); } } } } <|start_filename|>test/api/DslPlayerApiTest.cpp<|end_filename|> /* The MIT License Copyright (c) 2021, Prominence AI, Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in- all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "catch.hpp" #include "Dsl.h" #include "DslApi.h" #define TIME_TO_SLEEP_FOR std::chrono::milliseconds(1000) SCENARIO( "A single Player is created and deleted correctly", "[player-api]" ) { GIVEN( "An empty list of Players" ) { std::wstring player_name = L"player"; std::wstring source_name = L"file-source"; std::wstring file_path = L"./test/streams/sample_1080p_h264.mp4"; std::wstring sinkName = L"window-sink"; uint offsetX(0); uint offsetY(0); uint sinkW(1280); uint sinkH(720); REQUIRE( dsl_source_file_new(source_name.c_str(), file_path.c_str(), false) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_sink_window_new(sinkName.c_str(), offsetX, offsetY, sinkW, sinkH) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_player_list_size() == 0 ); WHEN( "A new Player is created" ) { REQUIRE( dsl_player_new(player_name.c_str(), source_name.c_str(), sinkName.c_str()) == DSL_RESULT_SUCCESS ); THEN( "The list size and contents are updated correctly" ) { REQUIRE( dsl_player_list_size() == 1 ); REQUIRE( dsl_player_delete(player_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_player_list_size() == 0 ); REQUIRE( dsl_component_delete_all() == DSL_RESULT_SUCCESS ); } } } } SCENARIO( "A single Player can Play, Pause, and Stop", "[player-api]" ) { GIVEN( "An empty list of Players" ) { std::wstring player_name = L"player"; std::wstring source_name = L"file-source"; std::wstring file_path = L"./test/streams/sample_1080p_h264.mp4"; std::wstring sinkName = L"window-sink"; uint offsetX(0); uint offsetY(0); uint sinkW(1280); uint sinkH(720); REQUIRE( dsl_source_file_new(source_name.c_str(), file_path.c_str(), false) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_sink_window_new(sinkName.c_str(), offsetX, offsetY, sinkW, sinkH) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_player_list_size() == 0 ); WHEN( "A new Player is created" ) { REQUIRE( dsl_player_new(player_name.c_str(), source_name.c_str(), sinkName.c_str()) == DSL_RESULT_SUCCESS ); THEN( "The list size and contents are updated correctly" ) { REQUIRE( dsl_player_play(player_name.c_str()) == DSL_RESULT_SUCCESS ); std::this_thread::sleep_for(TIME_TO_SLEEP_FOR); REQUIRE( dsl_player_pause(player_name.c_str()) == DSL_RESULT_SUCCESS ); std::this_thread::sleep_for(TIME_TO_SLEEP_FOR); REQUIRE( dsl_player_play(player_name.c_str()) == DSL_RESULT_SUCCESS ); std::this_thread::sleep_for(TIME_TO_SLEEP_FOR); REQUIRE( dsl_player_stop(player_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_player_delete(player_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_component_delete_all() == DSL_RESULT_SUCCESS ); } } } } SCENARIO( "A File Render Player can Play, Pause, and Stop", "[player-api]" ) { GIVEN( "An empty list of Players" ) { std::wstring player_name = L"player"; std::wstring file_path = L"./test/streams/sample_1080p_h264.mp4"; uint offsetX(0); uint offsetY(0); REQUIRE( dsl_player_list_size() == 0 ); WHEN( "A new Player is created" ) { REQUIRE( dsl_player_render_video_new(player_name.c_str(),file_path.c_str(), DSL_RENDER_TYPE_WINDOW, 10, 10, 75, false) == DSL_RESULT_SUCCESS ); THEN( "The list size and contents are updated correctly" ) { REQUIRE( dsl_player_play(player_name.c_str()) == DSL_RESULT_SUCCESS ); std::this_thread::sleep_for(TIME_TO_SLEEP_FOR); REQUIRE( dsl_player_pause(player_name.c_str()) == DSL_RESULT_SUCCESS ); std::this_thread::sleep_for(TIME_TO_SLEEP_FOR); REQUIRE( dsl_player_play(player_name.c_str()) == DSL_RESULT_SUCCESS ); std::this_thread::sleep_for(TIME_TO_SLEEP_FOR); REQUIRE( dsl_player_stop(player_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_player_delete(player_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_component_delete_all() == DSL_RESULT_SUCCESS ); } } } } SCENARIO( "An Image Render Player can Play, Pause, and Stop", "[player-api]" ) { GIVEN( "An empty list of Players" ) { std::wstring player_name = L"player"; std::wstring file_path = L"./test/streams/first-person-occurrence-438.jpeg"; REQUIRE( dsl_player_list_size() == 0 ); WHEN( "A new Player is created" ) { REQUIRE( dsl_player_render_image_new(player_name.c_str(),file_path.c_str(), DSL_RENDER_TYPE_WINDOW, 10, 10, 75, 0) == DSL_RESULT_SUCCESS ); THEN( "The list size and contents are updated correctly" ) { REQUIRE( dsl_player_play(player_name.c_str()) == DSL_RESULT_SUCCESS ); std::this_thread::sleep_for(TIME_TO_SLEEP_FOR); REQUIRE( dsl_player_pause(player_name.c_str()) == DSL_RESULT_SUCCESS ); std::this_thread::sleep_for(TIME_TO_SLEEP_FOR); REQUIRE( dsl_player_play(player_name.c_str()) == DSL_RESULT_SUCCESS ); std::this_thread::sleep_for(TIME_TO_SLEEP_FOR); REQUIRE( dsl_player_stop(player_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_player_delete(player_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_component_delete_all() == DSL_RESULT_SUCCESS ); } } } } SCENARIO( "An Image Render Player's Attributes are updated correctly'", "[player-api]" ) { GIVEN( "A new Image Render Player with Window Sink" ) { std::wstring player_name = L"player"; std::wstring file_path = L"./test/streams/first-person-occurrence-438.jpeg"; uint offsetX(123); uint offsetY(123); uint retOffsetX(0); uint retOffsetY(0); uint zoom(75), retZoom(57); uint timeout(0), retTimeout(444); REQUIRE( dsl_player_list_size() == 0 ); REQUIRE( dsl_player_render_image_new(player_name.c_str(), file_path.c_str(), DSL_RENDER_TYPE_WINDOW, offsetX, offsetY, zoom, timeout) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_player_render_offsets_get(player_name.c_str(), &retOffsetX, &retOffsetY) == DSL_RESULT_SUCCESS ); REQUIRE( retOffsetX == offsetX ); REQUIRE( retOffsetY == offsetY ); REQUIRE( dsl_player_render_zoom_get(player_name.c_str(), &retZoom) == DSL_RESULT_SUCCESS ); REQUIRE( retZoom == zoom ); REQUIRE( dsl_player_render_image_timeout_get(player_name.c_str(), &retTimeout) == DSL_RESULT_SUCCESS ); REQUIRE( retTimeout == timeout ); WHEN( "A the Player's Attributes are Set" ) { uint newOffsetX(321), newOffsetY(321); REQUIRE( dsl_player_render_offsets_set(player_name.c_str(), newOffsetX, newOffsetY) == DSL_RESULT_SUCCESS ); uint newZoom(543); REQUIRE( dsl_player_render_zoom_set(player_name.c_str(), newZoom) == DSL_RESULT_SUCCESS ); uint newTimeout(101); REQUIRE( dsl_player_render_image_timeout_set(player_name.c_str(), newTimeout) == DSL_RESULT_SUCCESS ); THEN( "The correct Attribute values are returned on Get" ) { REQUIRE( dsl_player_render_offsets_get(player_name.c_str(), &retOffsetX, &retOffsetY) == DSL_RESULT_SUCCESS ); REQUIRE( retOffsetX == newOffsetX ); REQUIRE( retOffsetY == newOffsetY ); REQUIRE( dsl_player_render_zoom_get(player_name.c_str(), &retZoom) == DSL_RESULT_SUCCESS ); REQUIRE( retZoom == newZoom ); REQUIRE( dsl_player_render_image_timeout_get(player_name.c_str(), &retTimeout) == DSL_RESULT_SUCCESS ); REQUIRE( retTimeout == newTimeout ); REQUIRE( dsl_player_delete(player_name.c_str()) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_component_delete_all() == DSL_RESULT_SUCCESS ); } } } } SCENARIO( "An Video Render Player's Attributes are updated correctly'", "[mmm]" ) { GIVEN( "A new Video Render Player with Window Sink" ) { std::wstring player_name = L"player"; std::wstring file_path = L"./test/streams/sample_1080p_h264.mp4"; uint offsetX(123); uint offsetY(123); uint retOffsetX(0); uint retOffsetY(0); uint zoom(75), retZoom(57); boolean repeatEnabled(false), retRepeatEnabled(true); REQUIRE( dsl_player_list_size() == 0 ); REQUIRE( dsl_player_render_video_new(player_name.c_str(), file_path.c_str(), DSL_RENDER_TYPE_WINDOW, offsetX, offsetY, zoom, repeatEnabled) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_player_render_offsets_get(player_name.c_str(), &retOffsetX, &retOffsetY) == DSL_RESULT_SUCCESS ); REQUIRE( retOffsetX == offsetX ); REQUIRE( retOffsetY == offsetY ); REQUIRE( dsl_player_render_zoom_get(player_name.c_str(), &retZoom) == DSL_RESULT_SUCCESS ); REQUIRE( retZoom == zoom ); REQUIRE( dsl_player_render_video_repeat_enabled_get(player_name.c_str(), &retRepeatEnabled) == DSL_RESULT_SUCCESS ); REQUIRE( retRepeatEnabled == repeatEnabled ); WHEN( "A the Player's Attributes are Set" ) { std::wstring new_file_path = L"./test/streams/sample_1080p_h265.mp4"; REQUIRE( dsl_player_render_file_path_set(player_name.c_str(), new_file_path.c_str()) == DSL_RESULT_SUCCESS ); uint newOffsetX(321), newOffsetY(321); REQUIRE( dsl_player_render_offsets_set(player_name.c_str(), newOffsetX, newOffsetY) == DSL_RESULT_SUCCESS ); uint newZoom(543); REQUIRE( dsl_player_render_zoom_set(player_name.c_str(), newZoom) == DSL_RESULT_SUCCESS ); boolean newRepeatEnabled(true); REQUIRE( dsl_player_render_video_repeat_enabled_set(player_name.c_str(), newRepeatEnabled) == DSL_RESULT_SUCCESS ); THEN( "The correct Attribute values are returned on Get" ) { REQUIRE( dsl_player_render_offsets_get(player_name.c_str(), &retOffsetX, &retOffsetY) == DSL_RESULT_SUCCESS ); REQUIRE( retOffsetX == newOffsetX ); REQUIRE( retOffsetY == newOffsetY ); REQUIRE( dsl_player_render_zoom_get(player_name.c_str(), &retZoom) == DSL_RESULT_SUCCESS ); REQUIRE( retZoom == newZoom ); REQUIRE( dsl_player_render_video_repeat_enabled_get(player_name.c_str(), &retRepeatEnabled) == DSL_RESULT_SUCCESS ); REQUIRE( retRepeatEnabled == newRepeatEnabled ); REQUIRE( dsl_player_delete(player_name.c_str()) == DSL_RESULT_SUCCESS ); } } } } SCENARIO( "A Players's XWindow Handle can be Set/Get", "[player-api]" ) { GIVEN( "A new Player" ) { std::wstring player_name = L"player"; std::wstring file_path = L"./test/streams/sample_1080p_h264.mp4"; uint offsetX(123); uint offsetY(123); uint zoom(75); boolean repeatEnabled(false); uint64_t handle(0); REQUIRE( dsl_player_render_video_new(player_name.c_str(), file_path.c_str(), DSL_RENDER_TYPE_WINDOW, offsetX, offsetY, zoom, repeatEnabled) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_player_xwindow_handle_get(player_name.c_str(), &handle) == DSL_RESULT_SUCCESS ); // must be initialized false REQUIRE( handle == 0 ); WHEN( "When the Player's XWindow Handle is updated" ) { handle = 0x1234567812345678; REQUIRE( dsl_player_xwindow_handle_set(player_name.c_str(), handle) == DSL_RESULT_SUCCESS ); THEN( "The new handle value is returned on get" ) { uint64_t newHandle(0); REQUIRE( dsl_player_xwindow_handle_get(player_name.c_str(), &newHandle) == DSL_RESULT_SUCCESS ); REQUIRE( handle == newHandle ); REQUIRE( dsl_player_delete(player_name.c_str()) == DSL_RESULT_SUCCESS ); } } } } SCENARIO( "The Player API checks for NULL input parameters", "[player-api]" ) { GIVEN( "An empty list of Players" ) { std::wstring player_name(L"player"); std::wstring source_name(L"file-source"); std::wstring file_path(L"./test/streams/sample_1080p_h264.mp4"); std::wstring sink_name(L"window-sink"); uint offsetX(0); uint offsetY(0); uint sinkW(1280); uint sinkH(720); uint timeout(0); uint zoom(100); boolean repeat_enabled(0); REQUIRE( dsl_source_file_new(source_name.c_str(), file_path.c_str(), false) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_sink_window_new(sink_name.c_str(), offsetX, offsetY, sinkW, sinkH) == DSL_RESULT_SUCCESS ); REQUIRE( dsl_player_list_size() == 0 ); WHEN( "When NULL pointers are used as input" ) { THEN( "The API returns DSL_RESULT_INVALID_INPUT_PARAM in all cases" ) { REQUIRE( dsl_player_new(NULL, source_name.c_str(), sink_name.c_str()) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_player_new(player_name.c_str(), NULL, sink_name.c_str()) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_player_new(player_name.c_str(), source_name.c_str(), NULL) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_player_render_reset(NULL) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_player_render_video_new(NULL, NULL, DSL_RENDER_TYPE_WINDOW, offsetX, offsetY, zoom, repeat_enabled) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_player_render_image_new(NULL, NULL, DSL_RENDER_TYPE_WINDOW, offsetX, offsetY, zoom, timeout) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_sink_render_reset(NULL) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_player_play(NULL) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_player_pause(NULL) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_player_stop(NULL) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_player_state_get(NULL, NULL) == DSL_RESULT_INVALID_INPUT_PARAM ); REQUIRE( dsl_player_list_size() == 0 ); REQUIRE( dsl_component_delete_all() == DSL_RESULT_SUCCESS ); } } } } <|start_filename|>examples/cpp/rtsp_player_to_test_connections.cpp<|end_filename|> #include <iostream> #include <experimental/filesystem> #include <sstream> #include <fstream> #include <dirent.h> #include <regex> #include "DslApi.h" // Set Camera RTSP URI's - these must be set to valid rtsp uri's for camera's on your network // RTSP Source URI std::wstring rtsp_uri_1 = L"rtsp://admin:<PASSWORD>!@10.0.0.37:554/cam/realmonitor?channel=1&subtype=1"; std::wstring rtsp_uri_2 = L"rtsp://admin:Password1!@10.0.0.37:554/cam/realmonitor?channel=2&subtype=1"; int WINDOW_WIDTH = DSL_DEFAULT_STREAMMUX_WIDTH; int WINDOW_HEIGHT = DSL_DEFAULT_STREAMMUX_HEIGHT; // ## // # Function to be called on XWindow KeyRelease event // ## void xwindow_key_event_handler(const wchar_t* in_key, void* client_data) { std::wstring wkey(in_key); std::string key(wkey.begin(), wkey.end()); std::cout << "key released = " << key << std::endl; key = std::toupper(key[0]); if(key == "P"){ dsl_player_pause(L"player"); } else if (key == "R"){ dsl_player_play(L"player"); } else if (key == "Q"){ dsl_main_loop_quit(); } } int main(int argc, char** argv) { DslReturnType retval; // # Since we're not using args, we can Let DSL initialize GST on first call while(true){ // # For each camera, create a new RTSP Source for the specific RTSP URI retval = dsl_source_rtsp_new(L"rtsp-source", rtsp_uri_1.c_str(), DSL_RTP_ALL, DSL_CUDADEC_MEMTYPE_DEVICE, false, 0, 100, 2); if (retval != DSL_RESULT_SUCCESS) return retval; // # New Overlay Sink, 0 x/y offsets and same dimensions as Tiled Display retval = dsl_sink_window_new(L"window-sink", 0, 0, WINDOW_WIDTH, WINDOW_HEIGHT); if (retval != DSL_RESULT_SUCCESS) break; retval = dsl_player_new(L"player", L"rtsp-source", L"window-sink"); if (retval != DSL_RESULT_SUCCESS) break; // # Add the XWindow event handler functions defined above retval = dsl_player_xwindow_key_event_handler_add(L"player", xwindow_key_event_handler, nullptr); if (retval != DSL_RESULT_SUCCESS) break; // # Play the player retval = dsl_player_play(L"player"); if (retval != DSL_RESULT_SUCCESS) break; dsl_main_loop_run(); retval = DSL_RESULT_SUCCESS; break; } // # Print out the final result std::cout << dsl_return_value_to_string(retval) << std::endl; // # Cleanup all DSL/GST resources dsl_delete_all(); std::cout<<"Goodbye!"<<std::endl; return 0; }
gigwegbe/deepstream-services-library
<|start_filename|>platform/darwin/src/MGLRendererConfiguration_Private.h<|end_filename|> #import "MGLRendererConfiguration.h" #include <mbgl/map/glyphs_rasterization_options.hpp> NS_ASSUME_NONNULL_BEGIN @interface MGLRendererConfiguration (Private) - (mbgl::GlyphsRasterizationOptions)glyphsRasterizationOptions; - (mbgl::GlyphsRasterizationOptions)glyphsRasterizationOptionsWithLocalFontFamilyName:(nullable NSString *)fontFamilyName rasterizationMode:(MGLGlyphsRasterizationMode)rasterizationMode; @end NS_ASSUME_NONNULL_END <|start_filename|>scripts/publish_binary_size.js<|end_filename|> #!/usr/bin/env node const jwt = require('jsonwebtoken'); const github = require('@octokit/rest').plugin(require('@octokit/plugin-retry'))({ retry: { doNotRetry: [ /* Empty — retry on any error code. */ ] } }) const zlib = require('zlib'); const AWS = require('aws-sdk'); const SIZE_CHECK_APP_ID = 14028; const SIZE_CHECK_APP_INSTALLATION_ID = 229425; process.on('unhandledRejection', error => { console.log(error); process.exit(1) }); const pk = process.env['SIZE_CHECK_APP_PRIVATE_KEY']; if (!pk) { console.log('Fork PR; not publishing size.'); process.exit(0); } const key = Buffer.from(pk, 'base64').toString('binary'); const payload = { exp: Math.floor(Date.now() / 1000) + 60, iat: Math.floor(Date.now() / 1000), iss: SIZE_CHECK_APP_ID }; const token = jwt.sign(payload, key, {algorithm: 'RS256'}); github.authenticate({type: 'app', token}); // Must be in sync with the definition in metrics/binary-size/index.html on the gh-pages branch. const platforms = [ { 'platform': 'iOS', 'arch': 'armv7' }, { 'platform': 'iOS', 'arch': 'arm64' }, { 'platform': 'iOS', 'arch': 'Dynamic' }, { 'platform': 'Android', 'arch': 'arm-v7' }, { 'platform': 'Android', 'arch': 'arm-v8' }, { 'platform': 'Android', 'arch': 'x86' }, { 'platform': 'Android', 'arch': 'x86_64' } ]; const sizeCheckInfo = []; const rows = []; const date = new Date().toISOString().substring(0, 19); function query(after) { return github.request({ method: 'POST', url: '/graphql', headers: { // https://developer.github.com/changes/2018-07-11-graphql-checks-preview/ accept: 'application/vnd.github.antiope-preview' }, query: `query { repository(owner: "mapbox", name: "mapbox-gl-native-ios") { ref(qualifiedName: "main") { target { ... on Commit { history(first: 100, before: "36c6a8ea79bbd2596abb58ffb58debf65a4ea13d" ${after ? `, after: "${after}"` : ''}) { pageInfo { hasNextPage endCursor } edges { node { oid messageHeadline checkSuites(first: 1, filterBy: {appId: ${SIZE_CHECK_APP_ID}}) { nodes { checkRuns(first: 10) { nodes { name conclusion title summary } } } } } } } } } } } }` }).then((result) => { const history = result.data.data.repository.ref.target.history; for (const edge of history.edges) { const commit = edge.node; const suite = commit.checkSuites.nodes[0]; if (!suite) continue; const allRuns = commit.checkSuites.nodes[0].checkRuns.nodes; const sizeCheckRuns = allRuns.filter(function (run) { return run.name.match(/Size - (\w+) ([\w-]+)/); }); const row = [`${commit.oid.slice(0, 7)} - ${commit.messageHeadline}`]; for (let i = 0; i < platforms.length; i++) { const {platform, arch} = platforms[i]; const run = sizeCheckRuns.find((run) => { const [, p, a] = run.name.match(/Size - (\w+) ([\w-]+)/); return platform === p && arch === a; }); row[i + 1] = run ? +run.summary.match(/is (\d+) bytes/)[1] : undefined; } rows.push(row); } if (history.pageInfo.hasNextPage) { return query(history.pageInfo.endCursor); } else { const latestRun = rows[0] const runSizeMeasurements = latestRun.slice(1) for (let i = 0; i < platforms.length; i++) { const {platform, arch} = platforms[i]; sizeCheckInfo.push(JSON.stringify({ 'sdk': 'maps', 'platform' : platform, 'arch': arch, 'size' : runSizeMeasurements[i], 'created_at': date })); } } }); } github.apps.createInstallationToken({installation_id: SIZE_CHECK_APP_INSTALLATION_ID}) .then(({data}) => { github.authenticate({type: 'token', token: data.token}); return query().then(function() { // Uploads to data source used by // http://mapbox.github.io/mapbox-gl-native/metrics/binary-size/ var firstPromise = new AWS.S3({region: 'us-east-1'}).putObject({ Body: zlib.gzipSync(JSON.stringify(rows.reverse())), Bucket: 'mapbox', Key: 'mapbox-gl-native/metrics/binary-size/data.json', ACL: 'public-read', CacheControl: 'max-age=300', ContentEncoding: 'gzip', ContentType: 'application/json' }).promise(); // Uploads to data source used by Mapbox internal metrics dashboards var secondPromise = new AWS.S3({region: 'us-east-1'}).putObject({ Body: zlib.gzipSync(sizeCheckInfo.join('\n')), Bucket: 'mapbox-loading-dock', Key: `raw/mobile.binarysize/${date.substring(0,10)}/mapbox-maps-ios-android-${process.env['CIRCLE_SHA1']}.json.gz`, CacheControl: 'max-age=300', ContentEncoding: 'gzip', ContentType: 'application/json' }).promise(); return Promise.all([firstPromise, secondPromise]).then(data => { return console.log("Successfully uploaded all binary size metrics to S3"); }).catch(err => { console.log("Error uploading binary size metrics to S3 " + err.message); return err; }); }); }); <|start_filename|>platform/darwin/src/MGLRendererConfiguration.h<|end_filename|> #import "MGLFoundation.h" #import <Foundation/Foundation.h> NS_ASSUME_NONNULL_BEGIN /// Indicates how the map view load glyphs. typedef NS_CLOSED_ENUM(NSUInteger, MGLGlyphsRasterizationMode) { /// The MGLGlyphsRasterizationMode was unset. MGLGlyphsRasterizationModeNone, /// Ideographs are rasterized locally, and they are not loaded from the server. MGLGlyphsRasterizationModeIdeographsRasterizedLocally, /// No glyphs are rasterized locally. All glyphs are loaded from the server. MGLGlyphsRasterizationModeNoGlyphsRasterizedLocally, /// All glyphs are rasterized locally. No glyphs are loaded from the server. MGLGlyphsRasterizationModeAllGlyphsRasterizedLocally }; /** The MGLRendererConfiguration object represents configuration values for the renderer. */ MGL_EXPORT @interface MGLRendererConfiguration : NSObject /** Returns an instance of the current renderer configuration. */ @property (class, nonatomic, readonly) MGLRendererConfiguration *currentConfiguration; /** The scale factor to use. Based on the native scale where available, otherwise the standard screen scale. */ @property (nonatomic, readonly) const float scaleFactor; /** The name of the font family to use for client-side text rendering of CJK ideographs. Set MGLIdeographicFontFamilyName in your containing application's Info.plist to font family name(s) that will be available at run time, such as “PingFang TC” or “Marker Felt”. This plist key accepts: - A string value of a single font family name. - An array of font family names. Fonts will be used in the defined order, eventually falling back to default system font if none are available. - A boolean value NO to disable client-side rendering of CJK glyphs — remote fonts specified in your style will be used instead. */ @property (nonatomic, readonly, nullable) NSString *localFontFamilyName; - (nullable NSString *)localFontFamilyNameWithInfoDictionaryObject:(nullable id)infoDictionaryObject; /** A Boolean value indicating whether symbol layers may enable per-source symbol collision detection. Set `MGLCollisionBehaviorPre4_0` in your containing app's Info.plist or by using `[[NSUserDefaults standardUserDefaults] setObject:@(YES) forKey:@"MGLCollisionBehaviorPre4_0"]`. If both are set, the value from `NSUserDefaults` takes priority. Setting this property to `YES` in the plist results in symbol layers only running collision detection against other symbol layers that are part of the same source. */ @property (nonatomic, readonly) BOOL perSourceCollisions; - (BOOL)perSourceCollisionsWithInfoDictionaryObject:(nullable id)infoDictionaryObject; /** Indicates how the map view load glyphs. Set `MGLGlyphsRasterizationOptions` in your containing app's Info.plist. */ @property (nonatomic, readonly) MGLGlyphsRasterizationMode glyphsRasterizationMode; - (MGLGlyphsRasterizationMode)glyphsRasterizationModeWithInfoDictionaryObject:(nullable id)infoDictionaryObject; @end NS_ASSUME_NONNULL_END
mevo-limited/mapbox-gl-native-ios
<|start_filename|>services/horizon/internal/db2/history/participants_test.go<|end_filename|> package history import ( "testing" sq "github.com/Masterminds/squirrel" "github.com/stellar/go/services/horizon/internal/test" ) type transactionParticipant struct { TransactionID int64 `db:"history_transaction_id"` AccountID int64 `db:"history_account_id"` } func getTransactionParticipants(tt *test.T, q *Q) []transactionParticipant { var participants []transactionParticipant sql := sq.Select("history_transaction_id", "history_account_id"). From("history_transaction_participants"). OrderBy("(history_transaction_id, history_account_id) asc") err := q.Select(tt.Ctx, &participants, sql) if err != nil { tt.T.Fatal(err) } return participants } func TestTransactionParticipantsBatch(t *testing.T) { tt := test.Start(t) defer tt.Finish() test.ResetHorizonDB(t, tt.HorizonDB) q := &Q{tt.HorizonSession()} batch := q.NewTransactionParticipantsBatchInsertBuilder(0) transactionID := int64(1) otherTransactionID := int64(2) accountID := int64(100) for i := int64(0); i < 3; i++ { tt.Assert.NoError(batch.Add(tt.Ctx, transactionID, accountID+i)) } tt.Assert.NoError(batch.Add(tt.Ctx, otherTransactionID, accountID)) tt.Assert.NoError(batch.Exec(tt.Ctx)) participants := getTransactionParticipants(tt, q) tt.Assert.Equal( []transactionParticipant{ transactionParticipant{TransactionID: 1, AccountID: 100}, transactionParticipant{TransactionID: 1, AccountID: 101}, transactionParticipant{TransactionID: 1, AccountID: 102}, transactionParticipant{TransactionID: 2, AccountID: 100}, }, participants, ) } <|start_filename|>support/db/delete_builder.go<|end_filename|> package db import ( "context" "database/sql" "github.com/pkg/errors" ) // Exec executes the query represented by the builder, deleting any rows that // match the queries where clauses. func (delb *DeleteBuilder) Exec(ctx context.Context) (sql.Result, error) { r, err := delb.Table.Session.Exec(ctx, delb.sql) if err != nil { return nil, errors.Wrap(err, "delete failed") } return r, nil } // Where is a passthrough call to the squirrel. See // https://godoc.org/github.com/Masterminds/squirrel#DeleteBuilder.Where func (delb *DeleteBuilder) Where( pred interface{}, args ...interface{}, ) *DeleteBuilder { delb.sql = delb.sql.Where(pred, args...) return delb } <|start_filename|>services/regulated-assets-approval-server/internal/db/dbmigrate/dbmigrate_generated.go<|end_filename|> // Code generated by go-bindata. DO NOT EDIT. // sources: // migrations/2021-05-05.0.initial.sql (162B) // migrations/2021-05-18.0.accounts-kyc-status.sql (414B) // migrations/2021-06-08.0.pending-kyc-status.sql (193B) package dbmigrate import ( "bytes" "compress/gzip" "crypto/sha256" "fmt" "io" "io/ioutil" "os" "path/filepath" "strings" "time" ) func bindataRead(data []byte, name string) ([]byte, error) { gz, err := gzip.NewReader(bytes.NewBuffer(data)) if err != nil { return nil, fmt.Errorf("read %q: %w", name, err) } var buf bytes.Buffer _, err = io.Copy(&buf, gz) clErr := gz.Close() if err != nil { return nil, fmt.Errorf("read %q: %w", name, err) } if clErr != nil { return nil, err } return buf.Bytes(), nil } type asset struct { bytes []byte info os.FileInfo digest [sha256.Size]byte } type bindataFileInfo struct { name string size int64 mode os.FileMode modTime time.Time } func (fi bindataFileInfo) Name() string { return fi.name } func (fi bindataFileInfo) Size() int64 { return fi.size } func (fi bindataFileInfo) Mode() os.FileMode { return fi.mode } func (fi bindataFileInfo) ModTime() time.Time { return fi.modTime } func (fi bindataFileInfo) IsDir() bool { return false } func (fi bindataFileInfo) Sys() interface{} { return nil } var _migrations202105050InitialSql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x54\xcc\xd1\x0d\xc2\x30\x0c\x04\xd0\xff\x4c\x71\xff\x28\x4c\xc1\x08\x30\x80\x01\xa7\xb5\xd4\xda\x91\x6d\xa8\xb2\x3d\x8a\xf8\x40\x7c\xde\xdd\xd3\xd5\x8a\xeb\x2a\x81\x5d\x16\xa7\x14\x53\x34\xd9\x18\x12\x10\x4d\xd6\xd9\xd0\xb6\x0d\xf0\xde\x73\x80\xf4\x39\x27\x42\x13\x8f\x44\x24\x79\x8a\x2e\xe8\x26\x9a\x68\xe6\xa5\x56\xd8\xcb\x7f\x77\x81\x3b\x37\x73\xc6\xc1\x18\x9c\x58\xe9\xcd\x20\xc4\x63\xe5\x9d\xce\x65\xfa\xd3\x17\x33\x6e\xfd\x3f\x5f\xec\xd0\x52\x3e\x01\x00\x00\xff\xff\xd3\x79\x21\xda\xa2\x00\x00\x00") func migrations202105050InitialSqlBytes() ([]byte, error) { return bindataRead( _migrations202105050InitialSql, "migrations/2021-05-05.0.initial.sql", ) } func migrations202105050InitialSql() (*asset, error) { bytes, err := migrations202105050InitialSqlBytes() if err != nil { return nil, err } info := bindataFileInfo{name: "migrations/2021-05-05.0.initial.sql", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xd1, 0xd1, 0x21, 0xe9, 0x6d, 0xe0, 0xfe, 0xb4, 0x8b, 0x78, 0x2, 0xae, 0x5c, 0xd5, 0x8b, 0x41, 0xb8, 0x4b, 0xaa, 0x3a, 0xea, 0x69, 0xf, 0xf3, 0x2f, 0x6c, 0xae, 0x38, 0x46, 0xb, 0x2, 0xfc}} return a, nil } var _migrations202105180AccountsKycStatusSql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x8c\x90\xc1\x4e\x83\x40\x10\x86\xef\xfb\x14\xff\xb1\x8d\xd6\x17\xe8\x09\x05\x13\x23\x42\x43\x20\xa6\x27\x32\x2c\x13\x5d\xbb\x0b\x9b\xdd\xc1\xaa\x4f\x6f\x02\x26\xda\x13\x1e\x27\xf3\xfd\xdf\x4c\xfe\xdd\x0e\x57\xce\xbc\x04\x12\x46\xe3\x95\xba\xab\xb2\xa4\xce\x50\x27\xb7\x79\x06\x3f\x75\xd6\xe8\x1b\xd2\x7a\x9c\x06\x89\xed\xe9\x53\xb7\x51\x48\xa6\x88\x8d\x02\x80\x28\x6c\x2d\x85\x96\xfa\x3e\x70\x8c\x10\xfe\x10\x14\x65\x8d\xa2\xc9\x73\x1c\xaa\x87\xa7\xa4\x3a\xe2\x31\x3b\x5e\xcf\xb8\x26\x6b\x3b\xd2\xa7\xd6\xf4\x97\xe8\xb2\x66\x47\xc6\x5e\xb8\x7e\x62\x81\x49\xb8\x6f\x49\x20\xc6\x71\x14\x72\x1e\x67\x23\xaf\xf3\x88\xaf\x71\xe0\xdf\xa3\x69\x76\x9f\x34\x79\x8d\xa2\x7c\xde\x6c\x97\xfc\xfc\xf6\xd4\x39\x23\x2b\x96\x05\x27\xef\xc3\xf8\xfe\x1f\x32\xf0\x1b\xeb\x15\xa7\xda\xee\x95\xfa\xdb\x72\x3a\x9e\x07\xa5\xd2\xaa\x3c\xac\xb6\xbc\xff\x0e\x00\x00\xff\xff\x68\xde\x80\x57\x9e\x01\x00\x00") func migrations202105180AccountsKycStatusSqlBytes() ([]byte, error) { return bindataRead( _migrations202105180AccountsKycStatusSql, "migrations/2021-05-18.0.accounts-kyc-status.sql", ) } func migrations202105180AccountsKycStatusSql() (*asset, error) { bytes, err := migrations202105180AccountsKycStatusSqlBytes() if err != nil { return nil, err } info := bindataFileInfo{name: "migrations/2021-05-18.0.accounts-kyc-status.sql", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xb0, 0x7b, 0x8c, 0x97, 0xe7, 0x6, 0x27, 0x5f, 0x19, 0xe2, 0xbb, 0x98, 0x73, 0x1e, 0x37, 0x74, 0xf0, 0x4a, 0x7, 0xe7, 0x15, 0x66, 0x90, 0x3c, 0x2, 0xab, 0x16, 0x39, 0x65, 0xf2, 0x8a, 0x1f}} return a, nil } var _migrations202106080PendingKycStatusSql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x94\xcd\x31\x0a\xc2\x30\x14\x06\xe0\xfd\x9d\xe2\xdf\xa5\x5e\xa0\x53\x35\xdd\xa2\x95\xd2\xce\x21\xc6\x50\x83\xe6\x25\x98\x17\x8a\x9e\x5e\x70\x12\x9c\x1c\xbf\xe9\x6b\x1a\x6c\x62\x58\x1e\x56\x3c\xe6\x4c\xd4\xe9\xa9\x1f\x31\x75\x3b\xdd\x23\xd7\xf3\x3d\xb8\xad\x75\x2e\x55\x96\x62\x6e\x4f\x67\x8a\x58\xa9\x85\x00\xa0\x53\x0a\xfb\x41\xcf\x87\x23\xb2\xe7\x4b\xe0\xc5\x58\x81\x84\xe8\x8b\xd8\x98\xb1\x06\xb9\x7e\x88\x57\x62\xdf\x12\x7d\x5f\x2a\xad\xfc\xd7\xa6\xc6\xe1\xf4\xdb\xb5\xf4\x0e\x00\x00\xff\xff\x0b\x35\xb1\x8a\xc1\x00\x00\x00") func migrations202106080PendingKycStatusSqlBytes() ([]byte, error) { return bindataRead( _migrations202106080PendingKycStatusSql, "migrations/2021-06-08.0.pending-kyc-status.sql", ) } func migrations202106080PendingKycStatusSql() (*asset, error) { bytes, err := migrations202106080PendingKycStatusSqlBytes() if err != nil { return nil, err } info := bindataFileInfo{name: "migrations/2021-06-08.0.pending-kyc-status.sql", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x10, 0x1c, 0x6f, 0xa9, 0x5e, 0x89, 0xfa, 0x5b, 0x1f, 0x1e, 0xf2, 0xc6, 0xe0, 0xeb, 0x6f, 0xe5, 0xa5, 0x63, 0x50, 0x6b, 0xd5, 0xdb, 0x54, 0xac, 0xc2, 0x1, 0x82, 0x27, 0xc4, 0x70, 0xcf, 0x9c}} return a, nil } // Asset loads and returns the asset for the given name. // It returns an error if the asset could not be found or // could not be loaded. func Asset(name string) ([]byte, error) { canonicalName := strings.Replace(name, "\\", "/", -1) if f, ok := _bindata[canonicalName]; ok { a, err := f() if err != nil { return nil, fmt.Errorf("Asset %s can't read by error: %v", name, err) } return a.bytes, nil } return nil, fmt.Errorf("Asset %s not found", name) } // AssetString returns the asset contents as a string (instead of a []byte). func AssetString(name string) (string, error) { data, err := Asset(name) return string(data), err } // MustAsset is like Asset but panics when Asset would return an error. // It simplifies safe initialization of global variables. func MustAsset(name string) []byte { a, err := Asset(name) if err != nil { panic("asset: Asset(" + name + "): " + err.Error()) } return a } // MustAssetString is like AssetString but panics when Asset would return an // error. It simplifies safe initialization of global variables. func MustAssetString(name string) string { return string(MustAsset(name)) } // AssetInfo loads and returns the asset info for the given name. // It returns an error if the asset could not be found or // could not be loaded. func AssetInfo(name string) (os.FileInfo, error) { canonicalName := strings.Replace(name, "\\", "/", -1) if f, ok := _bindata[canonicalName]; ok { a, err := f() if err != nil { return nil, fmt.Errorf("AssetInfo %s can't read by error: %v", name, err) } return a.info, nil } return nil, fmt.Errorf("AssetInfo %s not found", name) } // AssetDigest returns the digest of the file with the given name. It returns an // error if the asset could not be found or the digest could not be loaded. func AssetDigest(name string) ([sha256.Size]byte, error) { canonicalName := strings.Replace(name, "\\", "/", -1) if f, ok := _bindata[canonicalName]; ok { a, err := f() if err != nil { return [sha256.Size]byte{}, fmt.Errorf("AssetDigest %s can't read by error: %v", name, err) } return a.digest, nil } return [sha256.Size]byte{}, fmt.Errorf("AssetDigest %s not found", name) } // Digests returns a map of all known files and their checksums. func Digests() (map[string][sha256.Size]byte, error) { mp := make(map[string][sha256.Size]byte, len(_bindata)) for name := range _bindata { a, err := _bindata[name]() if err != nil { return nil, err } mp[name] = a.digest } return mp, nil } // AssetNames returns the names of the assets. func AssetNames() []string { names := make([]string, 0, len(_bindata)) for name := range _bindata { names = append(names, name) } return names } // _bindata is a table, holding each asset generator, mapped to its name. var _bindata = map[string]func() (*asset, error){ "migrations/2021-05-05.0.initial.sql": migrations202105050InitialSql, "migrations/2021-05-18.0.accounts-kyc-status.sql": migrations202105180AccountsKycStatusSql, "migrations/2021-06-08.0.pending-kyc-status.sql": migrations202106080PendingKycStatusSql, } // AssetDir returns the file names below a certain // directory embedded in the file by go-bindata. // For example if you run go-bindata on data/... and data contains the // following hierarchy: // data/ // foo.txt // img/ // a.png // b.png // then AssetDir("data") would return []string{"foo.txt", "img"}, // AssetDir("data/img") would return []string{"a.png", "b.png"}, // AssetDir("foo.txt") and AssetDir("notexist") would return an error, and // AssetDir("") will return []string{"data"}. func AssetDir(name string) ([]string, error) { node := _bintree if len(name) != 0 { canonicalName := strings.Replace(name, "\\", "/", -1) pathList := strings.Split(canonicalName, "/") for _, p := range pathList { node = node.Children[p] if node == nil { return nil, fmt.Errorf("Asset %s not found", name) } } } if node.Func != nil { return nil, fmt.Errorf("Asset %s not found", name) } rv := make([]string, 0, len(node.Children)) for childName := range node.Children { rv = append(rv, childName) } return rv, nil } type bintree struct { Func func() (*asset, error) Children map[string]*bintree } var _bintree = &bintree{nil, map[string]*bintree{ "migrations": &bintree{nil, map[string]*bintree{ "2021-05-05.0.initial.sql": &bintree{migrations202105050InitialSql, map[string]*bintree{}}, "2021-05-18.0.accounts-kyc-status.sql": &bintree{migrations202105180AccountsKycStatusSql, map[string]*bintree{}}, "2021-06-08.0.pending-kyc-status.sql": &bintree{migrations202106080PendingKycStatusSql, map[string]*bintree{}}, }}, }} // RestoreAsset restores an asset under the given directory. func RestoreAsset(dir, name string) error { data, err := Asset(name) if err != nil { return err } info, err := AssetInfo(name) if err != nil { return err } err = os.MkdirAll(_filePath(dir, filepath.Dir(name)), os.FileMode(0755)) if err != nil { return err } err = ioutil.WriteFile(_filePath(dir, name), data, info.Mode()) if err != nil { return err } return os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime()) } // RestoreAssets restores an asset under the given directory recursively. func RestoreAssets(dir, name string) error { children, err := AssetDir(name) // File if err != nil { return RestoreAsset(dir, name) } // Dir for _, child := range children { err = RestoreAssets(dir, filepath.Join(name, child)) if err != nil { return err } } return nil } func _filePath(dir, name string) string { canonicalName := strings.Replace(name, "\\", "/", -1) return filepath.Join(append([]string{dir}, strings.Split(canonicalName, "/")...)...) } <|start_filename|>support/db/batch_insert_builder_test.go<|end_filename|> package db import ( "context" "testing" "github.com/stellar/go/support/db/dbtest" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) type hungerRow struct { Name string `db:"name"` HungerLevel string `db:"hunger_level"` } type invalidHungerRow struct { Name string `db:"name"` HungerLevel string `db:"hunger_level"` LastName string `db:"last_name"` } func TestBatchInsertBuilder(t *testing.T) { db := dbtest.Postgres(t).Load(testSchema) defer db.Close() sess := &Session{DB: db.Open()} defer sess.DB.Close() ctx := context.Background() insertBuilder := &BatchInsertBuilder{ Table: sess.GetTable("people"), } // exec on the empty set should produce no errors assert.NoError(t, insertBuilder.Exec(ctx)) var err error err = insertBuilder.Row(ctx, map[string]interface{}{ "name": "bubba", "hunger_level": "120", }) assert.NoError(t, err) err = insertBuilder.RowStruct(ctx, hungerRow{ Name: "bubba2", HungerLevel: "1202", }) assert.NoError(t, err) // Extra column err = insertBuilder.Row(ctx, map[string]interface{}{ "name": "bubba", "hunger_level": "120", "abc": "def", }) assert.EqualError(t, err, "invalid number of columns (expected=2, actual=3)") // Not enough columns err = insertBuilder.Row(ctx, map[string]interface{}{ "name": "bubba", }) assert.EqualError(t, err, "invalid number of columns (expected=2, actual=1)") // Invalid column err = insertBuilder.Row(ctx, map[string]interface{}{ "name": "bubba", "hello": "120", }) assert.EqualError(t, err, `column "hunger_level" does not exist`) err = insertBuilder.RowStruct(ctx, invalidHungerRow{ Name: "Max", HungerLevel: "500", }) assert.EqualError(t, err, `expected value of type "db.hungerRow" but got "db.invalidHungerRow" value`) err = insertBuilder.Exec(ctx) assert.NoError(t, err) // Check rows var found []person err = sess.SelectRaw(ctx, &found, `SELECT * FROM people WHERE name like 'bubba%'`) require.NoError(t, err) assert.Equal( t, found, []person{ person{Name: "bubba", HungerLevel: "120"}, person{Name: "bubba2", HungerLevel: "1202"}, }, ) err = insertBuilder.Row(ctx, map[string]interface{}{ "name": "bubba", "hunger_level": "1", }) assert.NoError(t, err) err = insertBuilder.Exec(ctx) assert.EqualError( t, err, "error adding values while inserting to people: exec failed: pq:"+ " duplicate key value violates unique constraint \"people_pkey\"", ) insertBuilder.Suffix = "ON CONFLICT (name) DO NOTHING" err = insertBuilder.Row(ctx, map[string]interface{}{ "name": "bubba", "hunger_level": "1", }) assert.NoError(t, err) err = insertBuilder.Exec(ctx) assert.NoError(t, err) err = sess.SelectRaw(ctx, &found, `SELECT * FROM people WHERE name like 'bubba%'`) require.NoError(t, err) assert.Equal( t, found, []person{ person{Name: "bubba", HungerLevel: "120"}, person{Name: "bubba2", HungerLevel: "1202"}, }, ) insertBuilder.Suffix = "ON CONFLICT (name) DO UPDATE SET hunger_level = EXCLUDED.hunger_level" err = insertBuilder.Row(ctx, map[string]interface{}{ "name": "bubba", "hunger_level": "1", }) assert.NoError(t, err) err = insertBuilder.Exec(ctx) assert.NoError(t, err) err = sess.SelectRaw(ctx, &found, `SELECT * FROM people WHERE name like 'bubba%' order by name desc`) require.NoError(t, err) assert.Equal( t, found, []person{ person{Name: "bubba2", HungerLevel: "1202"}, person{Name: "bubba", HungerLevel: "1"}, }, ) } <|start_filename|>services/horizon/internal/corestate/main.go<|end_filename|> package corestate import ( "sync" "github.com/stellar/go/protocols/stellarcore" ) type State struct { Synced bool CurrentProtocolVersion int32 CoreSupportedProtocolVersion int32 CoreVersion string } type Store struct { sync.RWMutex state State } func (c *Store) Set(resp *stellarcore.InfoResponse) { c.Lock() defer c.Unlock() c.state.Synced = resp.IsSynced() c.state.CoreVersion = resp.Info.Build c.state.CurrentProtocolVersion = int32(resp.Info.Ledger.Version) c.state.CoreSupportedProtocolVersion = int32(resp.Info.ProtocolVersion) } func (c *Store) SetState(state State) { c.Lock() defer c.Unlock() c.state = state } func (c *Store) Get() State { c.RLock() defer c.RUnlock() return c.state } <|start_filename|>clients/horizonclient/offer_request.go<|end_filename|> package horizonclient import ( "context" "encoding/json" "fmt" "net/http" "net/url" hProtocol "github.com/stellar/go/protocols/horizon" "github.com/stellar/go/support/errors" ) // BuildURL creates the endpoint to be queried based on the data in the OfferRequest struct. func (or OfferRequest) BuildURL() (endpoint string, err error) { if len(or.OfferID) > 0 { endpoint = fmt.Sprintf("offers/%s", or.OfferID) } else { // backwards compatibility support if len(or.ForAccount) > 0 { endpoint = fmt.Sprintf("accounts/%s/offers", or.ForAccount) queryParams := addQueryParams(cursor(or.Cursor), limit(or.Limit), or.Order) if queryParams != "" { endpoint = fmt.Sprintf("%s?%s", endpoint, queryParams) } } else { query := url.Values{} if len(or.Seller) > 0 { query.Add("seller", or.Seller) } if len(or.Selling) > 0 { query.Add("selling", or.Selling) } if len(or.Buying) > 0 { query.Add("buying", or.Buying) } endpoint = fmt.Sprintf("offers?%s", query.Encode()) pageParams := addQueryParams(cursor(or.Cursor), limit(or.Limit), or.Order) if pageParams != "" { endpoint = fmt.Sprintf("%s&%s", endpoint, pageParams) } } } _, err = url.Parse(endpoint) if err != nil { err = errors.Wrap(err, "failed to parse endpoint") } return endpoint, err } // HTTPRequest returns the http request for the offers endpoint func (or OfferRequest) HTTPRequest(horizonURL string) (*http.Request, error) { endpoint, err := or.BuildURL() if err != nil { return nil, err } return http.NewRequest("GET", horizonURL+endpoint, nil) } // OfferHandler is a function that is called when a new offer is received type OfferHandler func(hProtocol.Offer) // StreamOffers streams offers processed by the Stellar network for an account. Use context.WithCancel // to stop streaming or context.Background() if you want to stream indefinitely. // OfferHandler is a user-supplied function that is executed for each streamed offer received. func (or OfferRequest) StreamOffers(ctx context.Context, client *Client, handler OfferHandler) (err error) { endpoint, err := or.BuildURL() if err != nil { return errors.Wrap(err, "unable to build endpoint for offers request") } url := fmt.Sprintf("%s%s", client.fixHorizonURL(), endpoint) return client.stream(ctx, url, func(data []byte) error { var offer hProtocol.Offer err = json.Unmarshal(data, &offer) if err != nil { return errors.Wrap(err, "error unmarshaling data for offers request") } handler(offer) return nil }) } <|start_filename|>services/regulated-assets-approval-server/internal/serve/kycstatus/delete_handler_test.go<|end_filename|> package kycstatus import ( "context" "net/http" "testing" "github.com/google/uuid" "github.com/stellar/go/keypair" "github.com/stellar/go/services/regulated-assets-approval-server/internal/db/dbtest" "github.com/stellar/go/services/regulated-assets-approval-server/internal/serve/httperror" "github.com/stretchr/testify/require" ) func TestDeleteHandler_validate(t *testing.T) { // database is nil h := DeleteHandler{} err := h.validate() require.EqualError(t, err, "database cannot be nil") // success db := dbtest.Open(t) defer db.Close() conn := db.Open() defer conn.Close() h = DeleteHandler{DB: conn} err = h.validate() require.NoError(t, err) } func TestDeleteHandler_handle_errors(t *testing.T) { db := dbtest.Open(t) defer db.Close() conn := db.Open() defer conn.Close() ctx := context.Background() h := DeleteHandler{DB: conn} // returns "400 - Missing stellar address." if no stellar address is provided in := deleteRequest{} err := h.handle(ctx, in) require.Equal(t, httperror.NewHTTPError(http.StatusBadRequest, "Missing stellar address."), err) // returns "404 - Not found." if the provided address could not be found accountKP := keypair.MustRandom() in = deleteRequest{StellarAddress: accountKP.Address()} err = h.handle(ctx, in) require.Equal(t, httperror.NewHTTPError(http.StatusNotFound, "Not found."), err) } func TestDeleteHandler_handle_success(t *testing.T) { db := dbtest.Open(t) defer db.Close() conn := db.Open() defer conn.Close() ctx := context.Background() h := DeleteHandler{DB: conn} // tests if the delete handler is really deleting a row from the database q := ` INSERT INTO accounts_kyc_status (stellar_address, callback_id, email_address, kyc_submitted_at, approved_at, rejected_at, pending_at) VALUES ($1, $2, $3, NOW(), NOW(), NULL, NULL) ` accountKP := keypair.MustRandom() callbackID := uuid.New().String() emailAddress := "<EMAIL>" _, err := h.DB.ExecContext(ctx, q, accountKP.Address(), callbackID, emailAddress) require.NoError(t, err) in := deleteRequest{StellarAddress: accountKP.Address()} err = h.handle(ctx, in) require.NoError(t, err) q = ` SELECT EXISTS( SELECT stellar_address FROM accounts_kyc_status WHERE stellar_address = $1 ) ` var exists bool err = h.DB.QueryRowContext(ctx, q, accountKP.Address()).Scan(&exists) require.NoError(t, err) require.False(t, exists) } <|start_filename|>services/horizon/internal/db2/history/mock_operation_participant_batch_insert_builder.go<|end_filename|> package history import ( "context" "github.com/stretchr/testify/mock" ) // MockOperationParticipantBatchInsertBuilder OperationParticipantBatchInsertBuilder mock type MockOperationParticipantBatchInsertBuilder struct { mock.Mock } // Add mock func (m *MockOperationParticipantBatchInsertBuilder) Add(ctx context.Context, operationID int64, accountID int64) error { a := m.Called(ctx, operationID, accountID) return a.Error(0) } // Exec mock func (m *MockOperationParticipantBatchInsertBuilder) Exec(ctx context.Context) error { a := m.Called(ctx) return a.Error(0) } <|start_filename|>services/horizon/internal/db2/history/mock_effect_batch_insert_builder.go<|end_filename|> package history import ( "context" "github.com/guregu/null" "github.com/stretchr/testify/mock" ) // MockEffectBatchInsertBuilder mock EffectBatchInsertBuilder type MockEffectBatchInsertBuilder struct { mock.Mock } // Add mock func (m *MockEffectBatchInsertBuilder) Add(ctx context.Context, accountID int64, muxedAccount null.String, operationID int64, order uint32, effectType EffectType, details []byte, ) error { a := m.Called(ctx, accountID, muxedAccount, operationID, order, effectType, details, ) return a.Error(0) } // Exec mock func (m *MockEffectBatchInsertBuilder) Exec(ctx context.Context) error { a := m.Called(ctx) return a.Error(0) } <|start_filename|>services/horizon/internal/db2/history/mock_q_participants.go<|end_filename|> package history import ( "context" "github.com/stretchr/testify/mock" ) // MockQParticipants is a mock implementation of the QParticipants interface type MockQParticipants struct { mock.Mock } func (m *MockQParticipants) CreateAccounts(ctx context.Context, addresses []string, maxBatchSize int) (map[string]int64, error) { a := m.Called(ctx, addresses, maxBatchSize) return a.Get(0).(map[string]int64), a.Error(1) } func (m *MockQParticipants) NewTransactionParticipantsBatchInsertBuilder(maxBatchSize int) TransactionParticipantsBatchInsertBuilder { a := m.Called(maxBatchSize) return a.Get(0).(TransactionParticipantsBatchInsertBuilder) } // MockTransactionParticipantsBatchInsertBuilder is a mock implementation of the // TransactionParticipantsBatchInsertBuilder interface type MockTransactionParticipantsBatchInsertBuilder struct { mock.Mock } func (m *MockTransactionParticipantsBatchInsertBuilder) Add(ctx context.Context, transactionID, accountID int64) error { a := m.Called(ctx, transactionID, accountID) return a.Error(0) } func (m *MockTransactionParticipantsBatchInsertBuilder) Exec(ctx context.Context) error { a := m.Called(ctx) return a.Error(0) } // NewOperationParticipantBatchInsertBuilder mock func (m *MockQParticipants) NewOperationParticipantBatchInsertBuilder(maxBatchSize int) OperationParticipantBatchInsertBuilder { a := m.Called(maxBatchSize) return a.Get(0).(OperationParticipantBatchInsertBuilder) } <|start_filename|>services/horizon/internal/actions/offer.go<|end_filename|> package actions import ( "context" "net/http" "github.com/stellar/go/protocols/horizon" horizonContext "github.com/stellar/go/services/horizon/internal/context" "github.com/stellar/go/services/horizon/internal/db2/history" "github.com/stellar/go/services/horizon/internal/ledger" "github.com/stellar/go/services/horizon/internal/resourceadapter" "github.com/stellar/go/support/errors" "github.com/stellar/go/support/render/hal" ) // AccountOffersQuery query struct for offers end-point type OfferByIDQuery struct { OfferID uint64 `schema:"offer_id" valid:"-"` } // GetOfferByID is the action handler for the /offers/{id} endpoint type GetOfferByID struct{} // GetResource returns an offer by id. func (handler GetOfferByID) GetResource(w HeaderWriter, r *http.Request) (interface{}, error) { ctx := r.Context() qp := OfferByIDQuery{} if err := getParams(&qp, r); err != nil { return nil, err } historyQ, err := horizonContext.HistoryQFromRequest(r) if err != nil { return nil, err } record, err := historyQ.GetOfferByID(r.Context(), int64(qp.OfferID)) if err != nil { return nil, err } ledger := &history.Ledger{} err = historyQ.LedgerBySequence( r.Context(), ledger, int32(record.LastModifiedLedger), ) if historyQ.NoRows(err) { ledger = nil } else if err != nil { return nil, err } var offerResponse horizon.Offer resourceadapter.PopulateOffer(ctx, &offerResponse, record, ledger) return offerResponse, nil } // OffersQuery query struct for offers end-point type OffersQuery struct { SellingBuyingAssetQueryParams `valid:"-"` Seller string `schema:"seller" valid:"accountID,optional"` Sponsor string `schema:"sponsor" valid:"accountID,optional"` } // URITemplate returns a rfc6570 URI template the query struct func (q OffersQuery) URITemplate() string { // building this manually since we don't want to include all the params in SellingBuyingAssetQueryParams return "/offers{?selling,buying,seller,sponsor,cursor,limit,order}" } // Validate runs custom validations. func (q OffersQuery) Validate() error { return q.SellingBuyingAssetQueryParams.Validate() } // GetOffersHandler is the action handler for the /offers endpoint type GetOffersHandler struct { LedgerState *ledger.State } // GetResourcePage returns a page of offers. func (handler GetOffersHandler) GetResourcePage( w HeaderWriter, r *http.Request, ) ([]hal.Pageable, error) { ctx := r.Context() qp := OffersQuery{} err := getParams(&qp, r) if err != nil { return nil, err } pq, err := GetPageQuery(handler.LedgerState, r) if err != nil { return nil, err } selling, err := qp.Selling() if err != nil { return nil, err } buying, err := qp.Buying() if err != nil { return nil, err } query := history.OffersQuery{ PageQuery: pq, SellerID: qp.Seller, Sponsor: qp.Sponsor, Selling: selling, Buying: buying, } historyQ, err := horizonContext.HistoryQFromRequest(r) if err != nil { return nil, err } offers, err := getOffersPage(ctx, historyQ, query) if err != nil { return nil, err } return offers, nil } // AccountOffersQuery query struct for offers end-point type AccountOffersQuery struct { AccountID string `schema:"account_id" valid:"accountID,required"` } // GetAccountOffersHandler is the action handler for the // `/accounts/{account_id}/offers` endpoint when using experimental ingestion. type GetAccountOffersHandler struct { LedgerState *ledger.State } func (handler GetAccountOffersHandler) parseOffersQuery(r *http.Request) (history.OffersQuery, error) { pq, err := GetPageQuery(handler.LedgerState, r) if err != nil { return history.OffersQuery{}, err } qp := AccountOffersQuery{} if err = getParams(&qp, r); err != nil { return history.OffersQuery{}, err } query := history.OffersQuery{ PageQuery: pq, SellerID: qp.AccountID, } return query, nil } // GetResourcePage returns a page of offers for a given account. func (handler GetAccountOffersHandler) GetResourcePage( w HeaderWriter, r *http.Request, ) ([]hal.Pageable, error) { ctx := r.Context() query, err := handler.parseOffersQuery(r) if err != nil { return nil, err } historyQ, err := horizonContext.HistoryQFromRequest(r) if err != nil { return nil, err } offers, err := getOffersPage(ctx, historyQ, query) if err != nil { return nil, err } return offers, nil } func getOffersPage(ctx context.Context, historyQ *history.Q, query history.OffersQuery) ([]hal.Pageable, error) { records, err := historyQ.GetOffers(ctx, query) if err != nil { return nil, err } ledgerCache := history.LedgerCache{} for _, record := range records { ledgerCache.Queue(int32(record.LastModifiedLedger)) } if err := ledgerCache.Load(ctx, historyQ); err != nil { return nil, errors.Wrap(err, "failed to load ledger batch") } var offers []hal.Pageable for _, record := range records { var offerResponse horizon.Offer var ledger *history.Ledger if l, ok := ledgerCache.Records[int32(record.LastModifiedLedger)]; ok { ledger = &l } resourceadapter.PopulateOffer(ctx, &offerResponse, record, ledger) offers = append(offers, offerResponse) } return offers, nil } <|start_filename|>services/keystore/docker/Dockerfile<|end_filename|> FROM golang:1.16.5 as build ADD . /src/keystore WORKDIR /src/keystore RUN go build -o /bin/keystored ./services/keystore/cmd/keystored FROM ubuntu:18.04 RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates ADD ./services/keystore/migrations/ /app/migrations/ COPY --from=build /bin/keystored /app/ EXPOSE 8000 ENTRYPOINT ["/app/keystored"] CMD ["serve"] <|start_filename|>ingest/doc.go<|end_filename|> /* Package ingest provides primitives for building custom ingestion engines. Very often developers need features that are outside of Horizon's scope. While it provides APIs for building the most common apps, it's not possible to add all possible features. This is why this package was created. Ledger Backend Ledger backends are sources of information about Stellar network ledgers. This can be, for example: a Stellar-Core database, (possibly-remote) Captive Stellar-Core instances, or History Archives. Please consult the "ledgerbackend" package docs for more information about each backend. Warning: Ledger backends provide low-level xdr.LedgerCloseMeta that should not be used directly unless the developer really understands this data structure. Read on to understand how to use ledger backend in higher level objects. Readers Readers are objects that wrap ledger backend and provide higher level, developer friendly APIs for reading ledger data. Currently there are three types of readers: * CheckpointChangeReader reads ledger entries from history buckets for a given checkpoint ledger. Allow building state (all accounts, trust lines etc.) at any checkpoint ledger. * LedgerTransactionReader reads transactions for a given ledger sequence. * LedgerChangeReader reads all changes to ledger entries created as a result of transactions (fees and meta) and protocol upgrades in a given ledger. Warning: Readers stream BOTH successful and failed transactions; check transactions status in your application if required. Tutorial Refer to the examples below for simple use cases, or check out the README (and its corresponding tutorial/ subfolder) in the repository for a Getting Started guide: https://github.com/stellar/go/blob/master/ingest/README.md */ package ingest <|start_filename|>services/horizon/internal/db2/history/account_signers_batch_insert_builder.go<|end_filename|> package history import ( "context" ) func (i *accountSignersBatchInsertBuilder) Add(ctx context.Context, signer AccountSigner) error { return i.builder.Row(ctx, map[string]interface{}{ "account_id": signer.Account, "signer": signer.Signer, "weight": signer.Weight, "sponsor": signer.Sponsor, }) } func (i *accountSignersBatchInsertBuilder) Exec(ctx context.Context) error { return i.builder.Exec(ctx) } <|start_filename|>ingest/ledger_change_reader.go<|end_filename|> package ingest import ( "context" "io" "github.com/stellar/go/ingest/ledgerbackend" "github.com/stellar/go/xdr" ) // ChangeReader provides convenient, streaming access to a sequence of Changes. type ChangeReader interface { // Read should return the next `Change` in the leader. If there are no more // changes left it should return an `io.EOF` error. Read() (Change, error) // Close should be called when reading is finished. This is especially // helpful when there are still some changes available so reader can stop // streaming them. Close() error } // ledgerChangeReaderState defines possible states of LedgerChangeReader. type ledgerChangeReaderState int const ( // feeChangesState is active when LedgerChangeReader is reading fee changes. feeChangesState ledgerChangeReaderState = iota // feeChangesState is active when LedgerChangeReader is reading transaction meta changes. metaChangesState // feeChangesState is active when LedgerChangeReader is reading upgrade changes. upgradeChangesState ) // LedgerChangeReader is a ChangeReader which returns Changes from Stellar Core // for a single ledger type LedgerChangeReader struct { *LedgerTransactionReader state ledgerChangeReaderState pending []Change pendingIndex int upgradeIndex int } // Ensure LedgerChangeReader implements ChangeReader var _ ChangeReader = (*LedgerChangeReader)(nil) // NewLedgerChangeReader constructs a new LedgerChangeReader instance bound to the given ledger. // Note that the returned LedgerChangeReader is not thread safe and should not be shared // by multiple goroutines. func NewLedgerChangeReader(ctx context.Context, backend ledgerbackend.LedgerBackend, networkPassphrase string, sequence uint32) (*LedgerChangeReader, error) { transactionReader, err := NewLedgerTransactionReader(ctx, backend, networkPassphrase, sequence) if err != nil { return nil, err } return &LedgerChangeReader{ LedgerTransactionReader: transactionReader, state: feeChangesState, }, nil } // NewLedgerChangeReaderFromLedgerCloseMeta constructs a new LedgerChangeReader instance bound to the given ledger. // Note that the returned LedgerChangeReader is not thread safe and should not be shared // by multiple goroutines. func NewLedgerChangeReaderFromLedgerCloseMeta(networkPassphrase string, ledger xdr.LedgerCloseMeta) (*LedgerChangeReader, error) { transactionReader, err := NewLedgerTransactionReaderFromLedgerCloseMeta(networkPassphrase, ledger) if err != nil { return nil, err } return &LedgerChangeReader{ LedgerTransactionReader: transactionReader, state: feeChangesState, }, nil } // Read returns the next change in the stream. // If there are no changes remaining io.EOF is returned as an error. func (r *LedgerChangeReader) Read() (Change, error) { // Changes within a ledger should be read in the following order: // - fee changes of all transactions, // - transaction meta changes of all transactions, // - upgrade changes. // Because a single transaction can introduce many changes we read all the // changes from a single transaction and save them in r.pending. // When Read() is called we stream pending changes first. We also call Read() // recursively after adding some changes (what will return them from r.pending) // to not duplicate the code. if r.pendingIndex < len(r.pending) { next := r.pending[r.pendingIndex] r.pendingIndex++ if r.pendingIndex == len(r.pending) { r.pendingIndex = 0 r.pending = r.pending[:0] } return next, nil } switch r.state { case feeChangesState, metaChangesState: tx, err := r.LedgerTransactionReader.Read() if err != nil { if err == io.EOF { // If done streaming fee changes rewind to stream meta changes if r.state == feeChangesState { r.LedgerTransactionReader.Rewind() } r.state++ return r.Read() } return Change{}, err } switch r.state { case feeChangesState: r.pending = append(r.pending, tx.GetFeeChanges()...) case metaChangesState: metaChanges, err := tx.GetChanges() if err != nil { return Change{}, err } r.pending = append(r.pending, metaChanges...) } return r.Read() case upgradeChangesState: // Get upgrade changes if r.upgradeIndex < len(r.LedgerTransactionReader.ledgerCloseMeta.V0.UpgradesProcessing) { changes := GetChangesFromLedgerEntryChanges( r.LedgerTransactionReader.ledgerCloseMeta.V0.UpgradesProcessing[r.upgradeIndex].Changes, ) r.pending = append(r.pending, changes...) r.upgradeIndex++ return r.Read() } } return Change{}, io.EOF } // Close should be called when reading is finished. func (r *LedgerChangeReader) Close() error { r.pending = nil return r.LedgerTransactionReader.Close() } <|start_filename|>services/regulated-assets-approval-server/internal/serve/tx_approve_test.go<|end_filename|> package serve import ( "context" "net/http" "testing" "github.com/stellar/go/amount" "github.com/stellar/go/clients/horizonclient" "github.com/stellar/go/keypair" "github.com/stellar/go/network" "github.com/stellar/go/protocols/horizon" "github.com/stellar/go/services/regulated-assets-approval-server/internal/db/dbtest" "github.com/stellar/go/txnbuild" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) func TestTxApproveHandlerValidate(t *testing.T) { // empty issuer KP. h := txApproveHandler{} err := h.validate() require.EqualError(t, err, "issuer keypair cannot be nil") // empty asset code. issuerAccKeyPair := keypair.MustRandom() h = txApproveHandler{ issuerKP: issuerAccKeyPair, } err = h.validate() require.EqualError(t, err, "asset code cannot be empty") // No Horizon client. h = txApproveHandler{ issuerKP: issuerAccKeyPair, assetCode: "FOOBAR", } err = h.validate() require.EqualError(t, err, "horizon client cannot be nil") // No network passphrase. horizonMock := horizonclient.MockClient{} h = txApproveHandler{ issuerKP: issuerAccKeyPair, assetCode: "FOOBAR", horizonClient: &horizonMock, } err = h.validate() require.EqualError(t, err, "network passphrase cannot be empty") // No db. h = txApproveHandler{ issuerKP: issuerAccKeyPair, assetCode: "FOOBAR", horizonClient: &horizonMock, networkPassphrase: network.TestNetworkPassphrase, } err = h.validate() require.EqualError(t, err, "database cannot be nil") // Empty kycThreshold. db := dbtest.Open(t) defer db.Close() conn := db.Open() defer conn.Close() h = txApproveHandler{ issuerKP: issuerAccKeyPair, assetCode: "FOOBAR", horizonClient: &horizonMock, networkPassphrase: network.TestNetworkPassphrase, db: conn, } err = h.validate() require.EqualError(t, err, "kyc threshold cannot be less than or equal to zero") // Negative kycThreshold. h = txApproveHandler{ issuerKP: issuerAccKeyPair, assetCode: "FOOBAR", horizonClient: &horizonMock, networkPassphrase: network.TestNetworkPassphrase, db: conn, kycThreshold: -1, } err = h.validate() require.EqualError(t, err, "kyc threshold cannot be less than or equal to zero") // no baseURL. h = txApproveHandler{ issuerKP: issuerAccKeyPair, assetCode: "FOOBAR", horizonClient: &horizonMock, networkPassphrase: network.TestNetworkPassphrase, db: conn, kycThreshold: 1, } err = h.validate() require.EqualError(t, err, "base url cannot be empty") // Success. h = txApproveHandler{ issuerKP: issuerAccKeyPair, assetCode: "FOOBAR", horizonClient: &horizonMock, networkPassphrase: network.TestNetworkPassphrase, db: conn, kycThreshold: 1, baseURL: "https://example.com", } err = h.validate() require.NoError(t, err) } func TestTxApproveHandler_validateInput(t *testing.T) { h := txApproveHandler{} ctx := context.Background() // rejects if incoming tx is empty in := txApproveRequest{} txApprovalResp, gotTx := h.validateInput(ctx, in) require.Equal(t, NewRejectedTxApprovalResponse("Missing parameter \"tx\"."), txApprovalResp) require.Nil(t, gotTx) // rejects if incoming tx is invalid in = txApproveRequest{Tx: "foobar"} txApprovalResp, gotTx = h.validateInput(ctx, in) require.Equal(t, NewRejectedTxApprovalResponse("Invalid parameter \"tx\"."), txApprovalResp) require.Nil(t, gotTx) // rejects if incoming tx is a fee bump transaction in = txApproveRequest{Tx: "AAAABQAAAAAo/cVyQxyGh7F/Vsj0BzfDYuOJvrwgfHGyqYFpHB5RCAAAAAAAAADIAAAAAgAAAAAo/cVyQxyGh7F/Vsj0BzfDYuOJvrwgfHGyqYFpHB5RCAAAAGQAEfDJAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAAo/cVyQxyGh7F/Vsj0BzfDYuOJvrwgfHGyqYFpHB5RCAAAAAAAAAAAAJiWgAAAAAAAAAAAAAAAAAAAAAA="} txApprovalResp, gotTx = h.validateInput(ctx, in) require.Equal(t, NewRejectedTxApprovalResponse("Invalid parameter \"tx\"."), txApprovalResp) require.Nil(t, gotTx) // rejects if tx source account is the issuer clientKP := keypair.MustRandom() h.issuerKP = keypair.MustRandom() tx, err := txnbuild.NewTransaction(txnbuild.TransactionParams{ SourceAccount: &horizon.Account{ AccountID: h.issuerKP.Address(), Sequence: "1", }, IncrementSequenceNum: true, Timebounds: txnbuild.NewInfiniteTimeout(), BaseFee: 300, Operations: []txnbuild.Operation{ &txnbuild.Payment{ Destination: clientKP.Address(), Amount: "1", Asset: txnbuild.NativeAsset{}, }, }, }) require.NoError(t, err) txe, err := tx.Base64() require.NoError(t, err) in.Tx = txe txApprovalResp, gotTx = h.validateInput(ctx, in) require.Equal(t, NewRejectedTxApprovalResponse("Transaction source account is invalid."), txApprovalResp) require.Nil(t, gotTx) // rejects if there are any operations other than Allowtrust where the source account is the issuer tx, err = txnbuild.NewTransaction(txnbuild.TransactionParams{ SourceAccount: &horizon.Account{ AccountID: clientKP.Address(), Sequence: "1", }, IncrementSequenceNum: true, Timebounds: txnbuild.NewInfiniteTimeout(), BaseFee: 300, Operations: []txnbuild.Operation{ &txnbuild.BumpSequence{}, &txnbuild.Payment{ Destination: clientKP.Address(), Amount: "1.0000000", Asset: txnbuild.NativeAsset{}, SourceAccount: h.issuerKP.Address(), }, }, }) require.NoError(t, err) txe, err = tx.Base64() require.NoError(t, err) in.Tx = txe txApprovalResp, gotTx = h.validateInput(ctx, in) require.Equal(t, NewRejectedTxApprovalResponse("There are one or more unauthorized operations in the provided transaction."), txApprovalResp) require.Nil(t, gotTx) // validation success tx, err = txnbuild.NewTransaction(txnbuild.TransactionParams{ SourceAccount: &horizon.Account{ AccountID: clientKP.Address(), Sequence: "1", }, IncrementSequenceNum: true, Timebounds: txnbuild.NewInfiniteTimeout(), BaseFee: 300, Operations: []txnbuild.Operation{ &txnbuild.Payment{ Destination: clientKP.Address(), Amount: "1.0000000", Asset: txnbuild.NativeAsset{}, }, }, }) require.NoError(t, err) txe, err = tx.Base64() require.NoError(t, err) in.Tx = txe txApprovalResp, gotTx = h.validateInput(ctx, in) require.Nil(t, txApprovalResp) require.Equal(t, gotTx, tx) } func TestTxApproveHandler_handleActionRequiredResponseIfNeeded(t *testing.T) { ctx := context.Background() db := dbtest.Open(t) defer db.Close() conn := db.Open() defer conn.Close() kycThreshold, err := amount.ParseInt64("500") require.NoError(t, err) h := txApproveHandler{ assetCode: "FOO", baseURL: "https://example.com", kycThreshold: kycThreshold, db: conn, } // payments up to the the threshold won't trigger "action_required" clientKP := keypair.MustRandom() paymentOp := &txnbuild.Payment{ Amount: amount.StringFromInt64(kycThreshold), } txApprovalResp, err := h.handleActionRequiredResponseIfNeeded(ctx, clientKP.Address(), paymentOp) require.NoError(t, err) require.Nil(t, txApprovalResp) // payments greater than the threshold will trigger "action_required" paymentOp = &txnbuild.Payment{ Amount: amount.StringFromInt64(kycThreshold + 1), } txApprovalResp, err = h.handleActionRequiredResponseIfNeeded(ctx, clientKP.Address(), paymentOp) require.NoError(t, err) var callbackID string q := `SELECT callback_id FROM accounts_kyc_status WHERE stellar_address = $1` err = conn.QueryRowContext(ctx, q, clientKP.Address()).Scan(&callbackID) require.NoError(t, err) wantResp := &txApprovalResponse{ Status: sep8StatusActionRequired, Message: "Payments exceeding 500.00 FOO require KYC approval. Please provide an email address.", ActionMethod: "POST", StatusCode: http.StatusOK, ActionURL: "https://example.com/kyc-status/" + callbackID, ActionFields: []string{"email_address"}, } require.Equal(t, wantResp, txApprovalResp) // if KYC was previously approved, handleActionRequiredResponseIfNeeded will return nil q = ` UPDATE accounts_kyc_status SET approved_at = NOW(), rejected_at = NULL, pending_at = NULL WHERE stellar_address = $1 ` _, err = conn.ExecContext(ctx, q, clientKP.Address()) require.NoError(t, err) txApprovalResp, err = h.handleActionRequiredResponseIfNeeded(ctx, clientKP.Address(), paymentOp) require.NoError(t, err) require.Nil(t, txApprovalResp) // if KYC was previously rejected, handleActionRequiredResponseIfNeeded will return a "rejected" response q = ` UPDATE accounts_kyc_status SET approved_at = NULL, rejected_at = NOW(), pending_at = NULL WHERE stellar_address = $1 ` _, err = conn.ExecContext(ctx, q, clientKP.Address()) require.NoError(t, err) txApprovalResp, err = h.handleActionRequiredResponseIfNeeded(ctx, clientKP.Address(), paymentOp) require.NoError(t, err) require.Equal(t, NewRejectedTxApprovalResponse("Your KYC was rejected and you're not authorized for operations above 500.00 FOO."), txApprovalResp) // if KYC was previously marked as pending, handleActionRequiredResponseIfNeeded will return a "pending" response q = ` UPDATE accounts_kyc_status SET approved_at = NULL, rejected_at = NULL, pending_at = NOW() WHERE stellar_address = $1 ` _, err = conn.ExecContext(ctx, q, clientKP.Address()) require.NoError(t, err) txApprovalResp, err = h.handleActionRequiredResponseIfNeeded(ctx, clientKP.Address(), paymentOp) require.NoError(t, err) require.Equal(t, NewPendingTxApprovalResponse("Your account could not be verified as approved nor rejected and was marked as pending. You will need staff authorization for operations above 500.00 FOO."), txApprovalResp) } func TestTxApproveHandler_txApprove_rejected(t *testing.T) { ctx := context.Background() db := dbtest.Open(t) defer db.Close() conn := db.Open() defer conn.Close() senderKP := keypair.MustRandom() receiverKP := keypair.MustRandom() issuerKP := keypair.MustRandom() assetGOAT := txnbuild.CreditAsset{ Code: "GOAT", Issuer: issuerKP.Address(), } kycThresholdAmount, err := amount.ParseInt64("500") require.NoError(t, err) horizonMock := horizonclient.MockClient{} horizonMock. On("AccountDetail", horizonclient.AccountRequest{AccountID: senderKP.Address()}). Return(horizon.Account{ AccountID: senderKP.Address(), Sequence: "2", }, nil) handler := txApproveHandler{ issuerKP: issuerKP, assetCode: assetGOAT.GetCode(), horizonClient: &horizonMock, networkPassphrase: network.TestNetworkPassphrase, db: conn, kycThreshold: kycThresholdAmount, baseURL: "https://example.com", } // "rejected" if tx is empty rejectedResponse, err := handler.txApprove(ctx, txApproveRequest{}) require.NoError(t, err) wantRejectedResponse := txApprovalResponse{ Status: "rejected", Error: `Missing parameter "tx".`, StatusCode: http.StatusBadRequest, } assert.Equal(t, &wantRejectedResponse, rejectedResponse) // rejected if contains more than one operation tx, err := txnbuild.NewTransaction( txnbuild.TransactionParams{ SourceAccount: &horizon.Account{ AccountID: senderKP.Address(), Sequence: "2", }, IncrementSequenceNum: true, Operations: []txnbuild.Operation{ &txnbuild.BumpSequence{}, &txnbuild.Payment{ Destination: receiverKP.Address(), Amount: "1", Asset: assetGOAT, }, }, BaseFee: txnbuild.MinBaseFee, Timebounds: txnbuild.NewInfiniteTimeout(), }, ) require.NoError(t, err) txe, err := tx.Base64() require.NoError(t, err) txApprovalResp, err := handler.txApprove(ctx, txApproveRequest{Tx: txe}) require.NoError(t, err) assert.Equal(t, NewRejectedTxApprovalResponse("Please submit a transaction with exactly one operation of type payment."), txApprovalResp) // rejected if the single operation is not a payment tx, err = txnbuild.NewTransaction( txnbuild.TransactionParams{ SourceAccount: &horizon.Account{ AccountID: senderKP.Address(), Sequence: "2", }, IncrementSequenceNum: true, Operations: []txnbuild.Operation{ &txnbuild.BumpSequence{}, }, BaseFee: txnbuild.MinBaseFee, Timebounds: txnbuild.NewInfiniteTimeout(), }, ) require.NoError(t, err) txe, err = tx.Base64() require.NoError(t, err) txApprovalResp, err = handler.txApprove(ctx, txApproveRequest{Tx: txe}) require.NoError(t, err) assert.Equal(t, NewRejectedTxApprovalResponse("There is one or more unauthorized operations in the provided transaction."), txApprovalResp) // rejected if attempting to transfer an asset to its own issuer tx, err = txnbuild.NewTransaction( txnbuild.TransactionParams{ SourceAccount: &horizon.Account{ AccountID: senderKP.Address(), Sequence: "2", }, IncrementSequenceNum: true, Operations: []txnbuild.Operation{ &txnbuild.Payment{ Destination: issuerKP.Address(), // <--- this will trigger the rejection Amount: "1", Asset: txnbuild.CreditAsset{ Code: "FOO", Issuer: keypair.MustRandom().Address(), }, }, }, BaseFee: txnbuild.MinBaseFee, Timebounds: txnbuild.NewInfiniteTimeout(), }, ) require.NoError(t, err) txe, err = tx.Base64() require.NoError(t, err) txApprovalResp, err = handler.txApprove(ctx, txApproveRequest{Tx: txe}) require.NoError(t, err) assert.Equal(t, NewRejectedTxApprovalResponse("Can't transfer asset to its issuer."), txApprovalResp) // rejected if payment asset is not supported tx, err = txnbuild.NewTransaction( txnbuild.TransactionParams{ SourceAccount: &horizon.Account{ AccountID: senderKP.Address(), Sequence: "2", }, IncrementSequenceNum: true, Operations: []txnbuild.Operation{ &txnbuild.Payment{ Destination: receiverKP.Address(), Amount: "1", Asset: txnbuild.CreditAsset{ Code: "FOO", Issuer: keypair.MustRandom().Address(), }, }, }, BaseFee: txnbuild.MinBaseFee, Timebounds: txnbuild.NewInfiniteTimeout(), }, ) require.NoError(t, err) txe, err = tx.Base64() require.NoError(t, err) txApprovalResp, err = handler.txApprove(ctx, txApproveRequest{Tx: txe}) require.NoError(t, err) assert.Equal(t, NewRejectedTxApprovalResponse("The payment asset is not supported by this issuer."), txApprovalResp) // rejected if sequence number is not incremental tx, err = txnbuild.NewTransaction( txnbuild.TransactionParams{ SourceAccount: &horizon.Account{ AccountID: senderKP.Address(), Sequence: "20", }, IncrementSequenceNum: true, Operations: []txnbuild.Operation{ &txnbuild.Payment{ Destination: receiverKP.Address(), Amount: "1", Asset: assetGOAT, }, }, BaseFee: txnbuild.MinBaseFee, Timebounds: txnbuild.NewInfiniteTimeout(), }, ) require.NoError(t, err) txe, err = tx.Base64() require.NoError(t, err) txApprovalResp, err = handler.txApprove(ctx, txApproveRequest{Tx: txe}) require.NoError(t, err) assert.Equal(t, NewRejectedTxApprovalResponse("Invalid transaction sequence number."), txApprovalResp) } func TestTxApproveHandler_txApprove_success(t *testing.T) { ctx := context.Background() db := dbtest.Open(t) defer db.Close() conn := db.Open() defer conn.Close() senderKP := keypair.MustRandom() receiverKP := keypair.MustRandom() issuerKP := keypair.MustRandom() assetGOAT := txnbuild.CreditAsset{ Code: "GOAT", Issuer: issuerKP.Address(), } kycThresholdAmount, err := amount.ParseInt64("500") require.NoError(t, err) horizonMock := horizonclient.MockClient{} horizonMock. On("AccountDetail", horizonclient.AccountRequest{AccountID: senderKP.Address()}). Return(horizon.Account{ AccountID: senderKP.Address(), Sequence: "2", }, nil) handler := txApproveHandler{ issuerKP: issuerKP, assetCode: assetGOAT.GetCode(), horizonClient: &horizonMock, networkPassphrase: network.TestNetworkPassphrase, db: conn, kycThreshold: kycThresholdAmount, baseURL: "https://example.com", } tx, err := txnbuild.NewTransaction( txnbuild.TransactionParams{ SourceAccount: &horizon.Account{ AccountID: senderKP.Address(), Sequence: "2", }, IncrementSequenceNum: true, Operations: []txnbuild.Operation{ &txnbuild.AllowTrust{ Trustor: senderKP.Address(), Type: assetGOAT, Authorize: true, SourceAccount: issuerKP.Address(), }, &txnbuild.AllowTrust{ Trustor: receiverKP.Address(), Type: assetGOAT, Authorize: true, SourceAccount: issuerKP.Address(), }, &txnbuild.Payment{ SourceAccount: senderKP.Address(), Destination: receiverKP.Address(), Amount: "1", Asset: assetGOAT, }, &txnbuild.AllowTrust{ Trustor: receiverKP.Address(), Type: assetGOAT, Authorize: false, SourceAccount: issuerKP.Address(), }, &txnbuild.AllowTrust{ Trustor: senderKP.Address(), Type: assetGOAT, Authorize: false, SourceAccount: issuerKP.Address(), }, }, BaseFee: txnbuild.MinBaseFee, Timebounds: txnbuild.NewInfiniteTimeout(), }, ) require.NoError(t, err) txe, err := tx.Base64() require.NoError(t, err) txApprovalResp, err := handler.txApprove(ctx, txApproveRequest{Tx: txe}) require.NoError(t, err) require.Equal(t, NewSuccessTxApprovalResponse(txApprovalResp.Tx, "Transaction is compliant and signed by the issuer."), txApprovalResp) } func TestTxApproveHandler_txApprove_actionRequired(t *testing.T) { ctx := context.Background() db := dbtest.Open(t) defer db.Close() conn := db.Open() defer conn.Close() senderKP := keypair.MustRandom() receiverKP := keypair.MustRandom() issuerKP := keypair.MustRandom() assetGOAT := txnbuild.CreditAsset{ Code: "GOAT", Issuer: issuerKP.Address(), } kycThresholdAmount, err := amount.ParseInt64("500") require.NoError(t, err) horizonMock := horizonclient.MockClient{} horizonMock. On("AccountDetail", horizonclient.AccountRequest{AccountID: senderKP.Address()}). Return(horizon.Account{ AccountID: senderKP.Address(), Sequence: "2", }, nil) handler := txApproveHandler{ issuerKP: issuerKP, assetCode: assetGOAT.GetCode(), horizonClient: &horizonMock, networkPassphrase: network.TestNetworkPassphrase, db: conn, kycThreshold: kycThresholdAmount, baseURL: "https://example.com", } tx, err := txnbuild.NewTransaction( txnbuild.TransactionParams{ SourceAccount: &horizon.Account{ AccountID: senderKP.Address(), Sequence: "2", }, IncrementSequenceNum: true, Operations: []txnbuild.Operation{ &txnbuild.Payment{ Destination: receiverKP.Address(), Amount: "501", Asset: assetGOAT, }, }, BaseFee: txnbuild.MinBaseFee, Timebounds: txnbuild.NewInfiniteTimeout(), }, ) require.NoError(t, err) txe, err := tx.Base64() require.NoError(t, err) txApprovalResp, err := handler.txApprove(ctx, txApproveRequest{Tx: txe}) require.NoError(t, err) var callbackID string q := `SELECT callback_id FROM accounts_kyc_status WHERE stellar_address = $1` err = conn.QueryRowContext(ctx, q, senderKP.Address()).Scan(&callbackID) require.NoError(t, err) wantResp := &txApprovalResponse{ Status: sep8StatusActionRequired, Message: "Payments exceeding 500.00 GOAT require KYC approval. Please provide an email address.", ActionMethod: "POST", StatusCode: http.StatusOK, ActionURL: "https://example.com/kyc-status/" + callbackID, ActionFields: []string{"email_address"}, } require.Equal(t, wantResp, txApprovalResp) } func TestTxApproveHandler_txApprove_revised(t *testing.T) { ctx := context.Background() db := dbtest.Open(t) defer db.Close() conn := db.Open() defer conn.Close() senderKP := keypair.MustRandom() receiverKP := keypair.MustRandom() issuerKP := keypair.MustRandom() assetGOAT := txnbuild.CreditAsset{ Code: "GOAT", Issuer: issuerKP.Address(), } kycThresholdAmount, err := amount.ParseInt64("500") require.NoError(t, err) horizonMock := horizonclient.MockClient{} horizonMock. On("AccountDetail", horizonclient.AccountRequest{AccountID: senderKP.Address()}). Return(horizon.Account{ AccountID: senderKP.Address(), Sequence: "2", }, nil) handler := txApproveHandler{ issuerKP: issuerKP, assetCode: assetGOAT.GetCode(), horizonClient: &horizonMock, networkPassphrase: network.TestNetworkPassphrase, db: conn, kycThreshold: kycThresholdAmount, baseURL: "https://example.com", } tx, err := txnbuild.NewTransaction( txnbuild.TransactionParams{ SourceAccount: &horizon.Account{ AccountID: senderKP.Address(), Sequence: "2", }, IncrementSequenceNum: true, Operations: []txnbuild.Operation{ &txnbuild.Payment{ Destination: receiverKP.Address(), Amount: "500", Asset: assetGOAT, }, }, BaseFee: txnbuild.MinBaseFee, Timebounds: txnbuild.NewInfiniteTimeout(), }, ) require.NoError(t, err) txe, err := tx.Base64() require.NoError(t, err) txApprovalResp, err := handler.txApprove(ctx, txApproveRequest{Tx: txe}) require.NoError(t, err) require.Equal(t, sep8StatusRevised, txApprovalResp.Status) require.Equal(t, http.StatusOK, txApprovalResp.StatusCode) require.Equal(t, "Authorization and deauthorization operations were added.", txApprovalResp.Message) gotGenericTx, err := txnbuild.TransactionFromXDR(txApprovalResp.Tx) require.NoError(t, err) gotTx, ok := gotGenericTx.Transaction() require.True(t, ok) require.Equal(t, senderKP.Address(), gotTx.SourceAccount().AccountID) require.Equal(t, int64(3), gotTx.SourceAccount().Sequence) require.Len(t, gotTx.Operations(), 5) // AllowTrust op where issuer fully authorizes sender, asset GOAT op0, ok := gotTx.Operations()[0].(*txnbuild.AllowTrust) require.True(t, ok) assert.Equal(t, op0.Trustor, senderKP.Address()) assert.Equal(t, op0.Type.GetCode(), assetGOAT.GetCode()) require.True(t, op0.Authorize) // AllowTrust op where issuer fully authorizes receiver, asset GOAT op1, ok := gotTx.Operations()[1].(*txnbuild.AllowTrust) require.True(t, ok) assert.Equal(t, op1.Trustor, receiverKP.Address()) assert.Equal(t, op1.Type.GetCode(), assetGOAT.GetCode()) require.True(t, op1.Authorize) // Payment from sender to receiver op2, ok := gotTx.Operations()[2].(*txnbuild.Payment) require.True(t, ok) assert.Equal(t, op2.Destination, receiverKP.Address()) assert.Equal(t, op2.Asset, assetGOAT) // AllowTrust op where issuer fully deauthorizes receiver, asset GOAT op3, ok := gotTx.Operations()[3].(*txnbuild.AllowTrust) require.True(t, ok) assert.Equal(t, op3.Trustor, receiverKP.Address()) assert.Equal(t, op3.Type.GetCode(), assetGOAT.GetCode()) require.False(t, op3.Authorize) // AllowTrust op where issuer fully deauthorizes sender, asset GOAT op4, ok := gotTx.Operations()[4].(*txnbuild.AllowTrust) require.True(t, ok) assert.Equal(t, op4.Trustor, senderKP.Address()) assert.Equal(t, op4.Type.GetCode(), assetGOAT.GetCode()) require.False(t, op4.Authorize) } func TestValidateTransactionOperationsForSuccess(t *testing.T) { ctx := context.Background() senderKP := keypair.MustRandom() receiverKP := keypair.MustRandom() issuerKP := keypair.MustRandom() assetGOAT := txnbuild.CreditAsset{ Code: "GOAT", Issuer: issuerKP.Address(), } // rejected if number of operations is unsupported tx, err := txnbuild.NewTransaction(txnbuild.TransactionParams{ SourceAccount: &horizon.Account{ AccountID: senderKP.Address(), Sequence: "5", }, IncrementSequenceNum: true, Operations: []txnbuild.Operation{ &txnbuild.Payment{ SourceAccount: senderKP.Address(), Destination: receiverKP.Address(), Amount: "1", Asset: assetGOAT, }, }, BaseFee: 300, Timebounds: txnbuild.NewTimeout(300), }) require.NoError(t, err) txApprovalResp, paymentOp, paymentSource := validateTransactionOperationsForSuccess(ctx, tx, issuerKP.Address()) assert.Equal(t, NewRejectedTxApprovalResponse("Unsupported number of operations."), txApprovalResp) assert.Nil(t, paymentOp) assert.Empty(t, paymentSource) // rejected if operation at index "2" is not a payment tx, err = txnbuild.NewTransaction(txnbuild.TransactionParams{ SourceAccount: &horizon.Account{ AccountID: senderKP.Address(), Sequence: "5", }, IncrementSequenceNum: true, Operations: []txnbuild.Operation{ &txnbuild.BumpSequence{}, &txnbuild.BumpSequence{}, &txnbuild.BumpSequence{}, &txnbuild.BumpSequence{}, &txnbuild.BumpSequence{}, }, BaseFee: 300, Timebounds: txnbuild.NewTimeout(300), }) require.NoError(t, err) txApprovalResp, paymentOp, paymentSource = validateTransactionOperationsForSuccess(ctx, tx, issuerKP.Address()) assert.Equal(t, NewRejectedTxApprovalResponse("There are one or more unexpected operations in the provided transaction."), txApprovalResp) assert.Nil(t, paymentOp) assert.Empty(t, paymentSource) // rejected if the operations list don't match the expected format [AllowTrust, AllowTrust, Payment, AllowTrust, AllowTrust] tx, err = txnbuild.NewTransaction(txnbuild.TransactionParams{ SourceAccount: &horizon.Account{ AccountID: senderKP.Address(), Sequence: "5", }, IncrementSequenceNum: true, Operations: []txnbuild.Operation{ &txnbuild.BumpSequence{}, &txnbuild.BumpSequence{}, &txnbuild.Payment{ SourceAccount: senderKP.Address(), Destination: receiverKP.Address(), Amount: "1", Asset: assetGOAT, }, &txnbuild.BumpSequence{}, &txnbuild.BumpSequence{}, }, BaseFee: 300, Timebounds: txnbuild.NewTimeout(300), }) require.NoError(t, err) txApprovalResp, paymentOp, paymentSource = validateTransactionOperationsForSuccess(ctx, tx, issuerKP.Address()) assert.Equal(t, NewRejectedTxApprovalResponse("There are one or more unexpected operations in the provided transaction."), txApprovalResp) assert.Nil(t, paymentOp) assert.Empty(t, paymentSource) // rejected if the values inside the operations list don't match the expected format tx, err = txnbuild.NewTransaction(txnbuild.TransactionParams{ SourceAccount: &horizon.Account{ AccountID: senderKP.Address(), Sequence: "5", }, IncrementSequenceNum: true, Operations: []txnbuild.Operation{ &txnbuild.AllowTrust{ Trustor: senderKP.Address(), Type: assetGOAT, Authorize: true, SourceAccount: issuerKP.Address(), }, &txnbuild.AllowTrust{ Trustor: receiverKP.Address(), Type: assetGOAT, Authorize: true, SourceAccount: issuerKP.Address(), }, &txnbuild.Payment{ SourceAccount: senderKP.Address(), Destination: receiverKP.Address(), Amount: "1", Asset: assetGOAT, }, &txnbuild.AllowTrust{ Trustor: receiverKP.Address(), Type: assetGOAT, Authorize: false, SourceAccount: issuerKP.Address(), }, &txnbuild.AllowTrust{ Trustor: senderKP.Address(), Type: assetGOAT, Authorize: true, // <--- this flag is the only wrong value in this transaction SourceAccount: issuerKP.Address(), }, }, BaseFee: 300, Timebounds: txnbuild.NewTimeout(300), }) require.NoError(t, err) txApprovalResp, paymentOp, paymentSource = validateTransactionOperationsForSuccess(ctx, tx, issuerKP.Address()) assert.Equal(t, NewRejectedTxApprovalResponse("There are one or more unexpected operations in the provided transaction."), txApprovalResp) assert.Nil(t, paymentOp) assert.Empty(t, paymentSource) // success tx, err = txnbuild.NewTransaction(txnbuild.TransactionParams{ SourceAccount: &horizon.Account{ AccountID: senderKP.Address(), Sequence: "5", }, IncrementSequenceNum: true, Operations: []txnbuild.Operation{ &txnbuild.AllowTrust{ Trustor: senderKP.Address(), Type: assetGOAT, Authorize: true, SourceAccount: issuerKP.Address(), }, &txnbuild.AllowTrust{ Trustor: receiverKP.Address(), Type: assetGOAT, Authorize: true, SourceAccount: issuerKP.Address(), }, &txnbuild.Payment{ SourceAccount: senderKP.Address(), Destination: receiverKP.Address(), Amount: "1", Asset: assetGOAT, }, &txnbuild.AllowTrust{ Trustor: receiverKP.Address(), Type: assetGOAT, Authorize: false, SourceAccount: issuerKP.Address(), }, &txnbuild.AllowTrust{ Trustor: senderKP.Address(), Type: assetGOAT, Authorize: false, SourceAccount: issuerKP.Address(), }, }, BaseFee: 300, Timebounds: txnbuild.NewTimeout(300), }) require.NoError(t, err) txApprovalResp, paymentOp, paymentSource = validateTransactionOperationsForSuccess(ctx, tx, issuerKP.Address()) assert.Nil(t, txApprovalResp) assert.Equal(t, senderKP.Address(), paymentSource) wantPaymentOp := &txnbuild.Payment{ SourceAccount: senderKP.Address(), Destination: receiverKP.Address(), Amount: "1", Asset: assetGOAT, } assert.Equal(t, wantPaymentOp, paymentOp) } func TestTxApproveHandler_handleSuccessResponseIfNeeded_revisable(t *testing.T) { ctx := context.Background() db := dbtest.Open(t) defer db.Close() conn := db.Open() defer conn.Close() senderKP := keypair.MustRandom() receiverKP := keypair.MustRandom() issuerKP := keypair.MustRandom() assetGOAT := txnbuild.CreditAsset{ Code: "GOAT", Issuer: issuerKP.Address(), } kycThresholdAmount, err := amount.ParseInt64("500") require.NoError(t, err) horizonMock := horizonclient.MockClient{} horizonMock. On("AccountDetail", horizonclient.AccountRequest{AccountID: senderKP.Address()}). Return(horizon.Account{ AccountID: senderKP.Address(), Sequence: "2", }, nil) handler := txApproveHandler{ issuerKP: issuerKP, assetCode: assetGOAT.GetCode(), horizonClient: &horizonMock, networkPassphrase: network.TestNetworkPassphrase, db: conn, kycThreshold: kycThresholdAmount, baseURL: "https://example.com", } revisableTx, err := txnbuild.NewTransaction(txnbuild.TransactionParams{ SourceAccount: &horizon.Account{ AccountID: senderKP.Address(), Sequence: "2", }, IncrementSequenceNum: true, Operations: []txnbuild.Operation{ &txnbuild.Payment{ SourceAccount: senderKP.Address(), Destination: receiverKP.Address(), Amount: "1", Asset: assetGOAT, }, }, BaseFee: 300, Timebounds: txnbuild.NewTimeout(300), }) require.NoError(t, err) txSuccessResponse, err := handler.handleSuccessResponseIfNeeded(ctx, revisableTx) require.NoError(t, err) assert.Nil(t, txSuccessResponse) } func TestTxApproveHandler_handleSuccessResponseIfNeeded_rejected(t *testing.T) { ctx := context.Background() db := dbtest.Open(t) defer db.Close() conn := db.Open() defer conn.Close() senderKP := keypair.MustRandom() receiverKP := keypair.MustRandom() issuerKP := keypair.MustRandom() assetGOAT := txnbuild.CreditAsset{ Code: "GOAT", Issuer: issuerKP.Address(), } kycThresholdAmount, err := amount.ParseInt64("500") require.NoError(t, err) horizonMock := horizonclient.MockClient{} horizonMock. On("AccountDetail", horizonclient.AccountRequest{AccountID: senderKP.Address()}). Return(horizon.Account{ AccountID: senderKP.Address(), Sequence: "2", }, nil) handler := txApproveHandler{ issuerKP: issuerKP, assetCode: assetGOAT.GetCode(), horizonClient: &horizonMock, networkPassphrase: network.TestNetworkPassphrase, db: conn, kycThreshold: kycThresholdAmount, baseURL: "https://example.com", } // rejected if operations don't match the expected format tx, err := txnbuild.NewTransaction(txnbuild.TransactionParams{ SourceAccount: &horizon.Account{ AccountID: senderKP.Address(), Sequence: "2", }, IncrementSequenceNum: true, Operations: []txnbuild.Operation{ &txnbuild.BumpSequence{}, &txnbuild.BumpSequence{}, &txnbuild.Payment{ SourceAccount: senderKP.Address(), Destination: receiverKP.Address(), Amount: "1", Asset: assetGOAT, }, &txnbuild.BumpSequence{}, &txnbuild.BumpSequence{}, }, BaseFee: 300, Timebounds: txnbuild.NewTimeout(300), }) require.NoError(t, err) txApprovalResp, err := handler.handleSuccessResponseIfNeeded(ctx, tx) require.NoError(t, err) assert.Equal(t, NewRejectedTxApprovalResponse("There are one or more unexpected operations in the provided transaction."), txApprovalResp) // rejected if attempting to transfer an asset to its own issuer tx, err = txnbuild.NewTransaction(txnbuild.TransactionParams{ SourceAccount: &horizon.Account{ AccountID: senderKP.Address(), Sequence: "2", }, IncrementSequenceNum: true, Operations: []txnbuild.Operation{ &txnbuild.AllowTrust{ Trustor: senderKP.Address(), Type: assetGOAT, Authorize: true, SourceAccount: issuerKP.Address(), }, &txnbuild.AllowTrust{ Trustor: issuerKP.Address(), Type: assetGOAT, Authorize: true, SourceAccount: issuerKP.Address(), }, &txnbuild.Payment{ SourceAccount: senderKP.Address(), Destination: issuerKP.Address(), // <--- this will trigger the rejection Amount: "1", Asset: assetGOAT, }, &txnbuild.AllowTrust{ Trustor: issuerKP.Address(), Type: assetGOAT, Authorize: false, SourceAccount: issuerKP.Address(), }, &txnbuild.AllowTrust{ Trustor: senderKP.Address(), Type: assetGOAT, Authorize: false, SourceAccount: issuerKP.Address(), }, }, BaseFee: 300, Timebounds: txnbuild.NewTimeout(300), }) require.NoError(t, err) txApprovalResp, err = handler.handleSuccessResponseIfNeeded(ctx, tx) require.NoError(t, err) assert.Equal(t, NewRejectedTxApprovalResponse("Can't transfer asset to its issuer."), txApprovalResp) // rejected if sequence number is not incremental compliantOps := []txnbuild.Operation{ &txnbuild.AllowTrust{ Trustor: senderKP.Address(), Type: assetGOAT, Authorize: true, SourceAccount: issuerKP.Address(), }, &txnbuild.AllowTrust{ Trustor: receiverKP.Address(), Type: assetGOAT, Authorize: true, SourceAccount: issuerKP.Address(), }, &txnbuild.Payment{ SourceAccount: senderKP.Address(), Destination: receiverKP.Address(), Amount: "1", Asset: assetGOAT, }, &txnbuild.AllowTrust{ Trustor: receiverKP.Address(), Type: assetGOAT, Authorize: false, SourceAccount: issuerKP.Address(), }, &txnbuild.AllowTrust{ Trustor: senderKP.Address(), Type: assetGOAT, Authorize: false, SourceAccount: issuerKP.Address(), }, } tx, err = txnbuild.NewTransaction(txnbuild.TransactionParams{ SourceAccount: &horizon.Account{ AccountID: senderKP.Address(), Sequence: "3", }, IncrementSequenceNum: true, Operations: compliantOps, BaseFee: 300, Timebounds: txnbuild.NewTimeout(300), }) require.NoError(t, err) txApprovalResp, err = handler.handleSuccessResponseIfNeeded(ctx, tx) require.NoError(t, err) assert.Equal(t, NewRejectedTxApprovalResponse("Invalid transaction sequence number."), txApprovalResp) } func TestTxApproveHandler_handleSuccessResponseIfNeeded_actionRequired(t *testing.T) { ctx := context.Background() db := dbtest.Open(t) defer db.Close() conn := db.Open() defer conn.Close() senderKP := keypair.MustRandom() receiverKP := keypair.MustRandom() issuerKP := keypair.MustRandom() assetGOAT := txnbuild.CreditAsset{ Code: "GOAT", Issuer: issuerKP.Address(), } kycThresholdAmount, err := amount.ParseInt64("500") require.NoError(t, err) horizonMock := horizonclient.MockClient{} horizonMock. On("AccountDetail", horizonclient.AccountRequest{AccountID: senderKP.Address()}). Return(horizon.Account{ AccountID: senderKP.Address(), Sequence: "2", }, nil) handler := txApproveHandler{ issuerKP: issuerKP, assetCode: assetGOAT.GetCode(), horizonClient: &horizonMock, networkPassphrase: network.TestNetworkPassphrase, db: conn, kycThreshold: kycThresholdAmount, baseURL: "https://example.com", } // compliant operations with a payment above threshold will return "action_required" if the user hasn't gone through KYC yet tx, err := txnbuild.NewTransaction(txnbuild.TransactionParams{ SourceAccount: &horizon.Account{ AccountID: senderKP.Address(), Sequence: "2", }, IncrementSequenceNum: true, Operations: []txnbuild.Operation{ &txnbuild.AllowTrust{ Trustor: senderKP.Address(), Type: assetGOAT, Authorize: true, SourceAccount: issuerKP.Address(), }, &txnbuild.AllowTrust{ Trustor: receiverKP.Address(), Type: assetGOAT, Authorize: true, SourceAccount: issuerKP.Address(), }, &txnbuild.Payment{ SourceAccount: senderKP.Address(), Destination: receiverKP.Address(), Amount: "501", Asset: assetGOAT, }, &txnbuild.AllowTrust{ Trustor: receiverKP.Address(), Type: assetGOAT, Authorize: false, SourceAccount: issuerKP.Address(), }, &txnbuild.AllowTrust{ Trustor: senderKP.Address(), Type: assetGOAT, Authorize: false, SourceAccount: issuerKP.Address(), }, }, BaseFee: 300, Timebounds: txnbuild.NewTimeout(300), }) require.NoError(t, err) txApprovalResponse, err := handler.handleSuccessResponseIfNeeded(ctx, tx) require.NoError(t, err) var callbackID string q := `SELECT callback_id FROM accounts_kyc_status WHERE stellar_address = $1` err = conn.QueryRowContext(ctx, q, senderKP.Address()).Scan(&callbackID) require.NoError(t, err) wantTxApprovalResponse := NewActionRequiredTxApprovalResponse( "Payments exceeding 500.00 GOAT require KYC approval. Please provide an email address.", "https://example.com/kyc-status/"+callbackID, []string{"email_address"}, ) assert.Equal(t, wantTxApprovalResponse, txApprovalResponse) // compliant operations with a payment above threshold will return "rejected" if the user's KYC was rejected query := ` UPDATE accounts_kyc_status SET approved_at = NULL, rejected_at = NOW(), pending_at = NULL WHERE stellar_address = $1 ` _, err = handler.db.ExecContext(ctx, query, senderKP.Address()) require.NoError(t, err) txApprovalResponse, err = handler.handleSuccessResponseIfNeeded(ctx, tx) require.NoError(t, err) assert.Equal(t, NewRejectedTxApprovalResponse("Your KYC was rejected and you're not authorized for operations above 500.00 GOAT."), txApprovalResponse) // compliant operations with a payment above threshold will return "pending" if the user's KYC was marked as pending query = ` UPDATE accounts_kyc_status SET approved_at = NULL, rejected_at = NULL, pending_at = NOW() WHERE stellar_address = $1 ` _, err = handler.db.ExecContext(ctx, query, senderKP.Address()) require.NoError(t, err) txApprovalResponse, err = handler.handleSuccessResponseIfNeeded(ctx, tx) require.NoError(t, err) assert.Equal(t, NewPendingTxApprovalResponse("Your account could not be verified as approved nor rejected and was marked as pending. You will need staff authorization for operations above 500.00 GOAT."), txApprovalResponse) // compliant operations with a payment above threshold will return "success" if the user's KYC was approved query = ` UPDATE accounts_kyc_status SET approved_at = NOW(), rejected_at = NULL, pending_at = NULL WHERE stellar_address = $1 ` _, err = handler.db.ExecContext(ctx, query, senderKP.Address()) require.NoError(t, err) txApprovalResponse, err = handler.handleSuccessResponseIfNeeded(ctx, tx) require.NoError(t, err) assert.Equal(t, NewSuccessTxApprovalResponse(txApprovalResponse.Tx, "Transaction is compliant and signed by the issuer."), txApprovalResponse) } func TestTxApproveHandler_handleSuccessResponseIfNeeded_success(t *testing.T) { ctx := context.Background() db := dbtest.Open(t) defer db.Close() conn := db.Open() defer conn.Close() senderKP := keypair.MustRandom() receiverKP := keypair.MustRandom() issuerKP := keypair.MustRandom() assetGOAT := txnbuild.CreditAsset{ Code: "GOAT", Issuer: issuerKP.Address(), } kycThresholdAmount, err := amount.ParseInt64("500") require.NoError(t, err) horizonMock := horizonclient.MockClient{} horizonMock. On("AccountDetail", horizonclient.AccountRequest{AccountID: senderKP.Address()}). Return(horizon.Account{ AccountID: senderKP.Address(), Sequence: "2", }, nil) handler := txApproveHandler{ issuerKP: issuerKP, assetCode: assetGOAT.GetCode(), horizonClient: &horizonMock, networkPassphrase: network.TestNetworkPassphrase, db: conn, kycThreshold: kycThresholdAmount, baseURL: "https://example.com", } tx, err := txnbuild.NewTransaction(txnbuild.TransactionParams{ SourceAccount: &horizon.Account{ AccountID: senderKP.Address(), Sequence: "2", }, IncrementSequenceNum: true, Operations: []txnbuild.Operation{ &txnbuild.AllowTrust{ Trustor: senderKP.Address(), Type: assetGOAT, Authorize: true, SourceAccount: issuerKP.Address(), }, &txnbuild.AllowTrust{ Trustor: receiverKP.Address(), Type: assetGOAT, Authorize: true, SourceAccount: issuerKP.Address(), }, &txnbuild.Payment{ SourceAccount: senderKP.Address(), Destination: receiverKP.Address(), Amount: "1", Asset: assetGOAT, }, &txnbuild.AllowTrust{ Trustor: receiverKP.Address(), Type: assetGOAT, Authorize: false, SourceAccount: issuerKP.Address(), }, &txnbuild.AllowTrust{ Trustor: senderKP.Address(), Type: assetGOAT, Authorize: false, SourceAccount: issuerKP.Address(), }, }, BaseFee: 300, Timebounds: txnbuild.NewTimeout(300), }) require.NoError(t, err) txApprovalResponse, err := handler.handleSuccessResponseIfNeeded(ctx, tx) require.NoError(t, err) require.Equal(t, NewSuccessTxApprovalResponse(txApprovalResponse.Tx, "Transaction is compliant and signed by the issuer."), txApprovalResponse) gotGenericTx, err := txnbuild.TransactionFromXDR(txApprovalResponse.Tx) require.NoError(t, err) gotTx, ok := gotGenericTx.Transaction() require.True(t, ok) // test transaction params assert.Equal(t, tx.SourceAccount(), gotTx.SourceAccount()) assert.Equal(t, tx.BaseFee(), gotTx.BaseFee()) assert.Equal(t, tx.Timebounds(), gotTx.Timebounds()) assert.Equal(t, tx.SequenceNumber(), gotTx.SequenceNumber()) // test if the operations are as expected resp, _, _ := validateTransactionOperationsForSuccess(ctx, gotTx, issuerKP.Address()) assert.Nil(t, resp) // check if the transaction contains the issuer's signature gotTxHash, err := gotTx.Hash(handler.networkPassphrase) require.NoError(t, err) err = handler.issuerKP.Verify(gotTxHash[:], gotTx.Signatures()[0].Signature) require.NoError(t, err) } func TestConvertAmountToReadableString(t *testing.T) { parsedAmount, err := amount.ParseInt64("500") require.NoError(t, err) assert.Equal(t, int64(5000000000), parsedAmount) readableAmount, err := convertAmountToReadableString(parsedAmount) require.NoError(t, err) assert.Equal(t, "500.00", readableAmount) } <|start_filename|>txnbuild/inflation_test.go<|end_filename|> package txnbuild import "testing" func TestInflationRoundtrip(t *testing.T) { inflation := Inflation{ SourceAccount: "<KEY>", } testOperationsMarshallingRoundtrip(t, []Operation{&inflation}, false) // with muxed accounts inflation = Inflation{ SourceAccount: "<KEY>", } testOperationsMarshallingRoundtrip(t, []Operation{&inflation}, true) } <|start_filename|>ingest/ledgerbackend/remote_captive_core_test.go<|end_filename|> package ledgerbackend import ( "context" "encoding/json" "net/http" "net/http/httptest" "testing" "github.com/stretchr/testify/require" "github.com/stellar/go/xdr" ) func TestGetLedgerSucceeds(t *testing.T) { expectedLedger := xdr.LedgerCloseMeta{ V0: &xdr.LedgerCloseMetaV0{ LedgerHeader: xdr.LedgerHeaderHistoryEntry{ Header: xdr.LedgerHeader{ LedgerSeq: 64, }, }, }, } called := 0 server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { called++ json.NewEncoder(w).Encode(LedgerResponse{ Ledger: Base64Ledger(expectedLedger), }) })) defer server.Close() client, err := NewRemoteCaptive(server.URL) require.NoError(t, err) ledger, err := client.GetLedger(context.Background(), 64) require.NoError(t, err) require.Equal(t, 1, called) require.Equal(t, expectedLedger, ledger) } func TestGetLedgerTakesAWhile(t *testing.T) { expectedLedger := xdr.LedgerCloseMeta{ V0: &xdr.LedgerCloseMetaV0{ LedgerHeader: xdr.LedgerHeaderHistoryEntry{ Header: xdr.LedgerHeader{ LedgerSeq: 64, }, }, }, } called := 0 server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { called++ if called == 1 { // TODO: Check this is what the server really does. w.WriteHeader(http.StatusRequestTimeout) return } json.NewEncoder(w).Encode(LedgerResponse{ Ledger: Base64Ledger(expectedLedger), }) })) defer server.Close() client, err := NewRemoteCaptive(server.URL) require.NoError(t, err) ledger, err := client.GetLedger(context.Background(), 64) require.NoError(t, err) require.Equal(t, 2, called) require.Equal(t, expectedLedger, ledger) } <|start_filename|>ingest/tutorial/example_hello.go<|end_filename|> package main import ( "context" "fmt" backends "github.com/stellar/go/ingest/ledgerbackend" ) func helloworld() { ctx := context.Background() backend, err := backends.NewCaptive(config) panicIf(err) defer backend.Close() // Prepare a single ledger to be ingested, err = backend.PrepareRange(ctx, backends.BoundedRange(123456, 123456)) panicIf(err) // then retrieve it: ledger, err := backend.GetLedger(ctx, 123456) panicIf(err) // Now `ledger` is a raw `xdr.LedgerCloseMeta` object containing the // transactions contained within this ledger. fmt.Printf("\nHello, Sequence %d.\n", ledger.LedgerSequence()) } <|start_filename|>txnbuild/end_sponsoring_future_reserves_test.go<|end_filename|> package txnbuild import "testing" func TestEndSponsoringFutureReservesRoundTrip(t *testing.T) { withoutMuxedAccounts := &EndSponsoringFutureReserves{SourceAccount: "<KEY>"} testOperationsMarshallingRoundtrip(t, []Operation{withoutMuxedAccounts}, false) withMuxedAccounts := &EndSponsoringFutureReserves{SourceAccount: "<KEY>"} testOperationsMarshallingRoundtrip(t, []Operation{withMuxedAccounts}, true) } <|start_filename|>services/regulated-assets-approval-server/internal/serve/httperror/http_error.go<|end_filename|> package httperror import ( "net/http" "github.com/stellar/go/clients/horizonclient" "github.com/stellar/go/support/errors" "github.com/stellar/go/support/render/httpjson" ) type Error struct { ErrorMessage string `json:"error"` Status int `json:"-"` } func (h *Error) Error() string { return h.ErrorMessage } func NewHTTPError(status int, errorMessage string) *Error { return &Error{ ErrorMessage: errorMessage, Status: status, } } func (e *Error) Render(w http.ResponseWriter) { httpjson.RenderStatus(w, e.Status, e, httpjson.JSON) } var InternalServer = &Error{ ErrorMessage: "An error occurred while processing this request.", Status: http.StatusInternalServerError, } var BadRequest = &Error{ ErrorMessage: "The request was invalid in some way.", Status: http.StatusBadRequest, } func ParseHorizonError(err error) error { if err == nil { return nil } rootErr := errors.Cause(err) if hError := horizonclient.GetError(rootErr); hError != nil { resultCode, _ := hError.ResultCodes() err = errors.Wrapf(err, "error submitting transaction: %+v, %+v\n", hError.Problem, resultCode) } else { err = errors.Wrap(err, "error submitting transaction") } return err } <|start_filename|>services/ticker/internal/tickerdb/queries_orderbook.go<|end_filename|> package tickerdb import ( "context" ) // InsertOrUpdateOrderbookStats inserts an OrdebookStats entry on the database (if new), // or updates an existing one func (s *TickerSession) InsertOrUpdateOrderbookStats(ctx context.Context, o *OrderbookStats, preserveFields []string) (err error) { return s.performUpsertQuery(ctx, *o, "orderbook_stats", "orderbook_stats_base_counter_asset_key", preserveFields) } <|start_filename|>ingest/ledger_transaction.go<|end_filename|> package ingest import ( "github.com/stellar/go/support/errors" "github.com/stellar/go/xdr" ) // LedgerTransaction represents the data for a single transaction within a ledger. type LedgerTransaction struct { Index uint32 Envelope xdr.TransactionEnvelope Result xdr.TransactionResultPair // FeeChanges and UnsafeMeta are low level values, do not use them directly unless // you know what you are doing. // Use LedgerTransaction.GetChanges() for higher level access to ledger // entry changes. FeeChanges xdr.LedgerEntryChanges UnsafeMeta xdr.TransactionMeta } func (t *LedgerTransaction) txInternalError() bool { return t.Result.Result.Result.Code == xdr.TransactionResultCodeTxInternalError } // GetFeeChanges returns a developer friendly representation of LedgerEntryChanges // connected to fees. func (t *LedgerTransaction) GetFeeChanges() []Change { return GetChangesFromLedgerEntryChanges(t.FeeChanges) } // GetChanges returns a developer friendly representation of LedgerEntryChanges. // It contains transaction changes and operation changes in that order. If the // transaction failed with TxInternalError, operations and txChangesAfter are // omitted. It doesn't support legacy TransactionMeta.V=0. func (t *LedgerTransaction) GetChanges() ([]Change, error) { var changes []Change // Transaction meta switch t.UnsafeMeta.V { case 0: return changes, errors.New("TransactionMeta.V=0 not supported") case 1: v1Meta := t.UnsafeMeta.MustV1() txChanges := GetChangesFromLedgerEntryChanges(v1Meta.TxChanges) changes = append(changes, txChanges...) // Ignore operations meta if txInternalError https://github.com/stellar/go/issues/2111 if t.txInternalError() { return changes, nil } for _, operationMeta := range v1Meta.Operations { opChanges := GetChangesFromLedgerEntryChanges( operationMeta.Changes, ) changes = append(changes, opChanges...) } case 2: v2Meta := t.UnsafeMeta.MustV2() txChangesBefore := GetChangesFromLedgerEntryChanges(v2Meta.TxChangesBefore) changes = append(changes, txChangesBefore...) // Ignore operations meta and txChangesAfter if txInternalError // https://github.com/stellar/go/issues/2111 if t.txInternalError() { return changes, nil } for _, operationMeta := range v2Meta.Operations { opChanges := GetChangesFromLedgerEntryChanges( operationMeta.Changes, ) changes = append(changes, opChanges...) } txChangesAfter := GetChangesFromLedgerEntryChanges(v2Meta.TxChangesAfter) changes = append(changes, txChangesAfter...) default: return changes, errors.New("Unsupported TransactionMeta version") } return changes, nil } // GetOperationChanges returns a developer friendly representation of LedgerEntryChanges. // It contains only operation changes. func (t *LedgerTransaction) GetOperationChanges(operationIndex uint32) ([]Change, error) { changes := []Change{} // Transaction meta switch t.UnsafeMeta.V { case 0: return changes, errors.New("TransactionMeta.V=0 not supported") case 1: // Ignore operations meta if txInternalError https://github.com/stellar/go/issues/2111 if t.txInternalError() { return changes, nil } v1Meta := t.UnsafeMeta.MustV1() changes = operationChanges(v1Meta.Operations, operationIndex) case 2: // Ignore operations meta if txInternalError https://github.com/stellar/go/issues/2111 if t.txInternalError() { return changes, nil } v2Meta := t.UnsafeMeta.MustV2() changes = operationChanges(v2Meta.Operations, operationIndex) default: return changes, errors.New("Unsupported TransactionMeta version") } return changes, nil } func operationChanges(ops []xdr.OperationMeta, index uint32) []Change { if len(ops) == 0 || int(index) >= len(ops) { return []Change{} } operationMeta := ops[index] return GetChangesFromLedgerEntryChanges( operationMeta.Changes, ) } <|start_filename|>ingest/ledgerbackend/mock_database_backend.go<|end_filename|> package ledgerbackend import ( "context" "github.com/stretchr/testify/mock" "github.com/stellar/go/xdr" ) var _ LedgerBackend = (*MockDatabaseBackend)(nil) type MockDatabaseBackend struct { mock.Mock } func (m *MockDatabaseBackend) GetLatestLedgerSequence(ctx context.Context) (uint32, error) { args := m.Called(ctx) return args.Get(0).(uint32), args.Error(1) } func (m *MockDatabaseBackend) PrepareRange(ctx context.Context, ledgerRange Range) error { args := m.Called(ctx, ledgerRange) return args.Error(0) } func (m *MockDatabaseBackend) IsPrepared(ctx context.Context, ledgerRange Range) (bool, error) { args := m.Called(ctx, ledgerRange) return args.Bool(0), args.Error(1) } func (m *MockDatabaseBackend) GetLedger(ctx context.Context, sequence uint32) (xdr.LedgerCloseMeta, error) { args := m.Called(ctx, sequence) return args.Get(0).(xdr.LedgerCloseMeta), args.Error(1) } func (m *MockDatabaseBackend) Close() error { args := m.Called() return args.Error(0) } <|start_filename|>randxdr/generator.go<|end_filename|> package randxdr import ( "math/rand" goxdr "github.com/xdrpp/goxdr/xdr" ) // Generator generates random XDR values. type Generator struct { // MaxBytesSize configures the upper bound limit for variable length // opaque data and variable length strings // https://tools.ietf.org/html/rfc4506#section-4.10 MaxBytesSize uint32 // MaxVecLen configures the upper bound limit for variable length arrays // https://tools.ietf.org/html/rfc4506#section-4.13 MaxVecLen uint32 // Source is the rand.Source which is used by the Generator to create // random values Source rand.Source } const ( // DefaultMaxBytesSize is the MaxBytesSize value in the Generator returned by NewGenerator() DefaultMaxBytesSize = 1024 // DefaultMaxVecLen is the MaxVecLen value in the Generator returned by NewGenerator() DefaultMaxVecLen = 10 // DefaultSeed is the seed for the Source value in the Generator returned by NewGenerator() DefaultSeed = 99 ) // NewGenerator returns a new Generator instance configured with default settings. // The returned Generator is deterministic but it is not thread-safe. func NewGenerator() Generator { return Generator{ MaxBytesSize: DefaultMaxBytesSize, MaxVecLen: DefaultMaxVecLen, // rand.NewSource returns a source which is *not* safe for concurrent use Source: rand.NewSource(DefaultSeed), } } // Next modifies the given shape and populates it with random value fields. func (g Generator) Next(shape goxdr.XdrType, presets []Preset) { marshaller := &randMarshaller{ rand: rand.New(g.Source), maxBytesSize: g.MaxBytesSize, maxVecLen: g.MaxVecLen, presets: presets, } marshaller.Marshal("", shape) } <|start_filename|>services/ticker/internal/tickerdb/queries_asset.go<|end_filename|> package tickerdb import ( "context" ) // InsertOrUpdateAsset inserts an Asset on the database (if new), // or updates an existing one func (s *TickerSession) InsertOrUpdateAsset(ctx context.Context, a *Asset, preserveFields []string) (err error) { return s.performUpsertQuery(ctx, *a, "assets", "assets_code_issuer_account", preserveFields) } // GetAssetByCodeAndIssuerAccount searches for an Asset with the given code // and public key, and returns its ID in case it is found. func (s *TickerSession) GetAssetByCodeAndIssuerAccount(ctx context.Context, code string, issuerAccount string, ) (found bool, id int32, err error) { var assets []Asset tbl := s.GetTable("assets") err = tbl.Select( &assets, "assets.code = ? AND assets.issuer_account = ?", code, issuerAccount, ).Exec(ctx) if err != nil { return } if len(assets) > 0 { id = assets[0].ID found = true } return } // GetAllValidAssets returns a slice with all assets in the database // with is_valid = true func (s *TickerSession) GetAllValidAssets(ctx context.Context) (assets []Asset, err error) { tbl := s.GetTable("assets") err = tbl.Select( &assets, "assets.is_valid = TRUE", ).Exec(ctx) return } // GetAssetsWithNestedIssuer returns a slice with all assets in the database // with is_valid = true, also adding the nested Issuer attribute func (s *TickerSession) GetAssetsWithNestedIssuer(ctx context.Context) (assets []Asset, err error) { const q = ` SELECT a.code, a.issuer_account, a.type, a.num_accounts, a.auth_required, a.auth_revocable, a.amount, a.asset_controlled_by_domain, a.anchor_asset_code, a.anchor_asset_type, a.is_valid, a.validation_error, a.last_valid, a.last_checked, a.display_decimals, a.name, a.description, a.conditions, a.is_asset_anchored, a.fixed_number, a.max_number, a.is_unlimited, a.redemption_instructions, a.collateral_addresses, a.collateral_address_signatures, a.countries, a.status, a.issuer_id, i.public_key, i.name, i.url, i.toml_url, i.federation_server, i.auth_server, i.transfer_server, i.web_auth_endpoint, i.deposit_server, i.org_twitter FROM assets AS a INNER JOIN issuers AS i ON a.issuer_id = i.id WHERE a.is_valid = TRUE ` rows, err := s.DB.QueryContext(ctx, q) if err != nil { return } for rows.Next() { var ( a Asset i Issuer ) err = rows.Scan( &a.Code, &a.IssuerAccount, &a.Type, &a.NumAccounts, &a.AuthRequired, &a.AuthRevocable, &a.Amount, &a.AssetControlledByDomain, &a.AnchorAssetCode, &a.AnchorAssetType, &a.IsValid, &a.ValidationError, &a.LastValid, &a.LastChecked, &a.DisplayDecimals, &a.Name, &a.Desc, &a.Conditions, &a.IsAssetAnchored, &a.FixedNumber, &a.MaxNumber, &a.IsUnlimited, &a.RedemptionInstructions, &a.CollateralAddresses, &a.CollateralAddressSignatures, &a.Countries, &a.Status, &a.IssuerID, &i.PublicKey, &i.Name, &i.URL, &i.TOMLURL, &i.FederationServer, &i.AuthServer, &i.TransferServer, &i.WebAuthEndpoint, &i.DepositServer, &i.OrgTwitter, ) if err != nil { return } a.Issuer = i assets = append(assets, a) } return } <|start_filename|>txnbuild/clawback_claimable_balance_test.go<|end_filename|> package txnbuild import ( "testing" ) func TestClawbackClaimableBalanceRoundTrip(t *testing.T) { claimClaimableBalance := &ClawbackClaimableBalance{ SourceAccount: "<KEY>", BalanceID: "00000000929b20b72e5890ab51c24f1cc46fa01c4f318d8d33367d24dd614cfdf5491072", } testOperationsMarshallingRoundtrip(t, []Operation{claimClaimableBalance}, false) // with muxed accounts claimClaimableBalance = &ClawbackClaimableBalance{ SourceAccount: "<KEY>", BalanceID: "00000000929b20b72e5890ab51c24f1cc46fa01c4f318d8d33367d24dd614cfdf5491072", } testOperationsMarshallingRoundtrip(t, []Operation{claimClaimableBalance}, false) } <|start_filename|>xdr/ledger_close_meta.go<|end_filename|> package xdr func (l LedgerCloseMeta) LedgerSequence() uint32 { return uint32(l.MustV0().LedgerHeader.Header.LedgerSeq) } func (l LedgerCloseMeta) LedgerHash() Hash { return l.MustV0().LedgerHeader.Hash } func (l LedgerCloseMeta) PreviousLedgerHash() Hash { return l.MustV0().LedgerHeader.Header.PreviousLedgerHash } func (l LedgerCloseMeta) ProtocolVersion() uint32 { return uint32(l.MustV0().LedgerHeader.Header.LedgerVersion) } func (l LedgerCloseMeta) BucketListHash() Hash { return l.MustV0().LedgerHeader.Header.BucketListHash } <|start_filename|>services/horizon/internal/db2/history/mock_q_signers.go<|end_filename|> package history import ( "context" "github.com/stretchr/testify/mock" "github.com/stellar/go/services/horizon/internal/db2" ) type MockQSigners struct { mock.Mock } func (m *MockQSigners) GetLastLedgerIngestNonBlocking(ctx context.Context) (uint32, error) { a := m.Called(ctx) return a.Get(0).(uint32), a.Error(1) } func (m *MockQSigners) GetLastLedgerIngest(ctx context.Context) (uint32, error) { a := m.Called(ctx) return a.Get(0).(uint32), a.Error(1) } func (m *MockQSigners) UpdateLastLedgerIngest(ctx context.Context, ledgerSequence uint32) error { a := m.Called(ctx, ledgerSequence) return a.Error(0) } func (m *MockQSigners) AccountsForSigner(ctx context.Context, signer string, page db2.PageQuery) ([]AccountSigner, error) { a := m.Called(ctx, signer, page) return a.Get(0).([]AccountSigner), a.Error(1) } func (m *MockQSigners) NewAccountSignersBatchInsertBuilder(maxBatchSize int) AccountSignersBatchInsertBuilder { a := m.Called(maxBatchSize) return a.Get(0).(AccountSignersBatchInsertBuilder) } func (m *MockQSigners) CreateAccountSigner(ctx context.Context, account, signer string, weight int32, sponsor *string) (int64, error) { a := m.Called(ctx, account, signer, weight, sponsor) return a.Get(0).(int64), a.Error(1) } func (m *MockQSigners) RemoveAccountSigner(ctx context.Context, account, signer string) (int64, error) { a := m.Called(ctx, account, signer) return a.Get(0).(int64), a.Error(1) } func (m *MockQSigners) SignersForAccounts(ctx context.Context, accounts []string) ([]AccountSigner, error) { a := m.Called(ctx, accounts) return a.Get(0).([]AccountSigner), a.Error(1) } func (m *MockQSigners) CountAccounts(ctx context.Context) (int, error) { a := m.Called(ctx) return a.Get(0).(int), a.Error(1) } <|start_filename|>services/horizon/internal/db2/history/mock_account_signers_batch_insert_builder.go<|end_filename|> package history import ( "context" "github.com/stretchr/testify/mock" ) type MockAccountSignersBatchInsertBuilder struct { mock.Mock } func (m *MockAccountSignersBatchInsertBuilder) Add(ctx context.Context, signer AccountSigner) error { a := m.Called(ctx, signer) return a.Error(0) } func (m *MockAccountSignersBatchInsertBuilder) Exec(ctx context.Context) error { a := m.Called(ctx) return a.Error(0) } <|start_filename|>protocols/horizon/operations/main_test.go<|end_filename|> package operations import ( "errors" "testing" "github.com/stretchr/testify/assert" "github.com/stellar/go/xdr" ) func TestTypeNamesAllCovered(t *testing.T) { for typ, s := range xdr.OperationTypeToStringMap { _, ok := TypeNames[xdr.OperationType(typ)] assert.True(t, ok, s) } } func TestUnmarshalOperationAllCovered(t *testing.T) { mistmatchErr := errors.New("Invalid operation format, unable to unmarshal json response") for typ, s := range xdr.OperationTypeToStringMap { _, err := UnmarshalOperation(typ, []byte{}) assert.Error(t, err, s) // it should be a parsing error, not the default branch assert.NotEqual(t, mistmatchErr, err, s) } // make sure the check works for an unknown operation type _, err := UnmarshalOperation(200000, []byte{}) assert.Error(t, err) assert.Equal(t, mistmatchErr, err) } <|start_filename|>txnbuild/manage_data_test.go<|end_filename|> package txnbuild import ( "testing" "github.com/stellar/go/xdr" "github.com/stretchr/testify/assert" ) func TestManageDataValidateName(t *testing.T) { kp0 := newKeypair0() sourceAccount := NewSimpleAccount(kp0.Address(), int64(3556091187167235)) manageData := ManageData{ Name: "This is a very long name for a field that only accepts 64 characters", Value: []byte(""), } _, err := NewTransaction( TransactionParams{ SourceAccount: &sourceAccount, IncrementSequenceNum: false, Operations: []Operation{&manageData}, BaseFee: MinBaseFee, Timebounds: NewInfiniteTimeout(), }, ) if assert.Error(t, err) { expected := "validation failed for *txnbuild.ManageData operation: Field: Name, Error: maximum length is 64 characters" assert.Contains(t, err.Error(), expected) } } func TestManageDataValidateValue(t *testing.T) { kp0 := newKeypair0() sourceAccount := NewSimpleAccount(kp0.Address(), int64(3556091187167235)) manageData := ManageData{ Name: "cars", Value: []byte("toyota, ford, porsche, lamborghini, hyundai, volkswagen, gmc, kia"), } _, err := NewTransaction( TransactionParams{ SourceAccount: &sourceAccount, IncrementSequenceNum: false, Operations: []Operation{&manageData}, BaseFee: MinBaseFee, Timebounds: NewInfiniteTimeout(), }, ) if assert.Error(t, err) { expected := "validation failed for *txnbuild.ManageData operation: Field: Value, Error: maximum length is 64 bytes" assert.Contains(t, err.Error(), expected) } } func TestManageDataRoundTrip(t *testing.T) { kp0 := newKeypair0() sourceAccount := NewSimpleAccount(kp0.Address(), int64(3556091187167235)) for _, testCase := range []struct { name string value []byte }{ { "nil data", nil, }, { "empty data slice", []byte{}, }, { "non-empty data slice", []byte{1, 2, 3}, }, } { t.Run(testCase.name, func(t *testing.T) { manageData := ManageData{ Name: "key", Value: testCase.value, } tx, err := NewTransaction( TransactionParams{ SourceAccount: &sourceAccount, IncrementSequenceNum: false, Operations: []Operation{&manageData}, BaseFee: MinBaseFee, Timebounds: NewInfiniteTimeout(), }, ) assert.NoError(t, err) envelope := tx.ToXDR() assert.NoError(t, err) assert.Len(t, envelope.Operations(), 1) assert.Equal(t, xdr.String64(manageData.Name), envelope.Operations()[0].Body.ManageDataOp.DataName) if testCase.value == nil { assert.Nil(t, envelope.Operations()[0].Body.ManageDataOp.DataValue) } else { assert.Len(t, []byte(*envelope.Operations()[0].Body.ManageDataOp.DataValue), len(testCase.value)) if len(testCase.value) > 0 { assert.Equal(t, testCase.value, []byte(*envelope.Operations()[0].Body.ManageDataOp.DataValue)) } } txe, err := tx.Base64() if err != nil { assert.NoError(t, err) } parsed, err := TransactionFromXDR(txe) assert.NoError(t, err) tx, _ = parsed.Transaction() assert.Len(t, tx.Operations(), 1) op := tx.Operations()[0].(*ManageData) assert.Equal(t, manageData.Name, op.Name) assert.Len(t, op.Value, len(manageData.Value)) if len(manageData.Value) > 0 { assert.Equal(t, manageData.Value, op.Value) } }) } } func TestManageDataRoundtrip(t *testing.T) { manageData := ManageData{ SourceAccount: "<KEY>", Name: "foo", Value: []byte("bar"), } testOperationsMarshallingRoundtrip(t, []Operation{&manageData}, false) // with muxed accounts manageData = ManageData{ SourceAccount: "<KEY>", Name: "foo", Value: []byte("bar"), } testOperationsMarshallingRoundtrip(t, []Operation{&manageData}, true) } <|start_filename|>services/regulated-assets-approval-server/internal/db/dbmigrate/dbmigrate_test.go<|end_filename|> package dbmigrate import ( "net/http" "os" "strings" "testing" assetfs "github.com/elazarl/go-bindata-assetfs" migrate "github.com/rubenv/sql-migrate" "github.com/shurcooL/httpfs/filter" dbpkg "github.com/stellar/go/services/regulated-assets-approval-server/internal/db" "github.com/stellar/go/services/regulated-assets-approval-server/internal/db/dbtest" supportHttp "github.com/stellar/go/support/http" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) func TestGeneratedAssets(t *testing.T) { localAssets := http.FileSystem(filter.Keep(http.Dir("."), func(path string, fi os.FileInfo) bool { return fi.IsDir() || strings.HasSuffix(path, ".sql") })) generatedAssets := &assetfs.AssetFS{Asset: Asset, AssetDir: AssetDir, AssetInfo: AssetInfo} if !supportHttp.EqualFileSystems(localAssets, generatedAssets, "/") { t.Fatalf("generated migrations does not match local migrations") } } func TestPlanMigration_upApplyOne(t *testing.T) { db := dbtest.OpenWithoutMigrations(t) session, err := dbpkg.Open(db.DSN) require.NoError(t, err) migrations, err := PlanMigration(session, migrate.Up, 1) require.NoError(t, err) wantMigrations := []string{"2021-05-05.0.initial.sql"} assert.Equal(t, wantMigrations, migrations) } func TestPlanMigration_upApplyAll(t *testing.T) { db := dbtest.OpenWithoutMigrations(t) session, err := dbpkg.Open(db.DSN) require.NoError(t, err) migrations, err := PlanMigration(session, migrate.Up, 0) require.NoError(t, err) require.GreaterOrEqual(t, len(migrations), 3) wantAtLeastMigrations := []string{ "2021-05-05.0.initial.sql", "2021-05-18.0.accounts-kyc-status.sql", "2021-06-08.0.pending-kyc-status.sql", } assert.Equal(t, wantAtLeastMigrations, migrations) } func TestPlanMigration_upApplyNone(t *testing.T) { db := dbtest.OpenWithoutMigrations(t) session, err := dbpkg.Open(db.DSN) require.NoError(t, err) n, err := Migrate(session, migrate.Up, 0) require.NoError(t, err) require.Greater(t, n, 1) migrations, err := PlanMigration(session, migrate.Up, 0) require.NoError(t, err) require.Empty(t, migrations) } func TestPlanMigration_downApplyOne(t *testing.T) { db := dbtest.OpenWithoutMigrations(t) session, err := dbpkg.Open(db.DSN) require.NoError(t, err) n, err := Migrate(session, migrate.Up, 2) require.NoError(t, err) require.Equal(t, 2, n) migrations, err := PlanMigration(session, migrate.Down, 1) require.NoError(t, err) wantMigrations := []string{"2021-05-18.0.accounts-kyc-status.sql"} assert.Equal(t, wantMigrations, migrations) } func TestPlanMigration_downApplyTwo(t *testing.T) { db := dbtest.OpenWithoutMigrations(t) session, err := dbpkg.Open(db.DSN) require.NoError(t, err) n, err := Migrate(session, migrate.Up, 3) require.NoError(t, err) require.Equal(t, 3, n) migrations, err := PlanMigration(session, migrate.Down, 0) require.NoError(t, err) wantMigrations := []string{ "2021-06-08.0.pending-kyc-status.sql", "2021-05-18.0.accounts-kyc-status.sql", "2021-05-05.0.initial.sql", } assert.Equal(t, wantMigrations, migrations) } func TestPlanMigration_downApplyNone(t *testing.T) { db := dbtest.OpenWithoutMigrations(t) session, err := dbpkg.Open(db.DSN) require.NoError(t, err) n, err := Migrate(session, migrate.Up, 2) require.NoError(t, err) require.Equal(t, 2, n) n, err = Migrate(session, migrate.Down, 0) require.NoError(t, err) require.Equal(t, 2, n) migrations, err := PlanMigration(session, migrate.Down, 0) require.NoError(t, err) assert.Empty(t, migrations) } func TestMigrate_upApplyOne(t *testing.T) { db := dbtest.OpenWithoutMigrations(t) session, err := dbpkg.Open(db.DSN) require.NoError(t, err) n, err := Migrate(session, migrate.Up, 1) require.NoError(t, err) assert.Equal(t, 1, n) ids := []string{} err = session.Select(&ids, `SELECT id FROM gorp_migrations`) require.NoError(t, err) wantIDs := []string{ "2021-05-05.0.initial.sql", } assert.Equal(t, wantIDs, ids) } func TestMigrate_upApplyAll(t *testing.T) { db := dbtest.OpenWithoutMigrations(t) session, err := dbpkg.Open(db.DSN) require.NoError(t, err) n, err := Migrate(session, migrate.Up, 0) require.NoError(t, err) require.Greater(t, n, 1) ids := []string{} err = session.Select(&ids, `SELECT id FROM gorp_migrations`) require.NoError(t, err) wantIDs := []string{ "2021-05-05.0.initial.sql", "2021-05-18.0.accounts-kyc-status.sql", "2021-06-08.0.pending-kyc-status.sql", } assert.Equal(t, wantIDs, ids) } func TestMigrate_upApplyNone(t *testing.T) { db := dbtest.OpenWithoutMigrations(t) session, err := dbpkg.Open(db.DSN) require.NoError(t, err) n, err := Migrate(session, migrate.Up, 0) require.NoError(t, err) require.Greater(t, n, 1) n, err = Migrate(session, migrate.Up, 0) require.NoError(t, err) require.Zero(t, n) ids := []string{} err = session.Select(&ids, `SELECT id FROM gorp_migrations`) require.NoError(t, err) wantIDs := []string{ "2021-05-05.0.initial.sql", "2021-05-18.0.accounts-kyc-status.sql", "2021-06-08.0.pending-kyc-status.sql", } assert.Equal(t, wantIDs, ids) } func TestMigrate_downApplyOne(t *testing.T) { db := dbtest.OpenWithoutMigrations(t) session, err := dbpkg.Open(db.DSN) require.NoError(t, err) n, err := Migrate(session, migrate.Up, 2) require.NoError(t, err) require.Equal(t, 2, n) n, err = Migrate(session, migrate.Down, 1) require.NoError(t, err) require.Equal(t, 1, n) ids := []string{} err = session.Select(&ids, `SELECT id FROM gorp_migrations`) require.NoError(t, err) wantIDs := []string{ "2021-05-05.0.initial.sql", } assert.Equal(t, wantIDs, ids) } func TestMigrate_downApplyAll(t *testing.T) { db := dbtest.OpenWithoutMigrations(t) session, err := dbpkg.Open(db.DSN) require.NoError(t, err) n, err := Migrate(session, migrate.Up, 2) require.NoError(t, err) require.Equal(t, 2, n) n, err = Migrate(session, migrate.Down, 0) require.NoError(t, err) require.Equal(t, 2, n) ids := []string{} err = session.Select(&ids, `SELECT id FROM gorp_migrations`) require.NoError(t, err) assert.Empty(t, ids) } func TestMigrate_downApplyNone(t *testing.T) { db := dbtest.OpenWithoutMigrations(t) session, err := dbpkg.Open(db.DSN) require.NoError(t, err) n, err := Migrate(session, migrate.Up, 2) require.NoError(t, err) require.Equal(t, 2, n) n, err = Migrate(session, migrate.Down, 0) require.NoError(t, err) require.Equal(t, 2, n) n, err = Migrate(session, migrate.Down, 0) require.NoError(t, err) require.Equal(t, 0, n) ids := []string{} err = session.Select(&ids, `SELECT id FROM gorp_migrations`) require.NoError(t, err) assert.Empty(t, ids) } <|start_filename|>services/horizon/internal/db2/history/mock_q_effects.go<|end_filename|> package history import ( "context" "github.com/stretchr/testify/mock" ) // MockQEffects is a mock implementation of the QEffects interface type MockQEffects struct { mock.Mock } func (m *MockQEffects) NewEffectBatchInsertBuilder(maxBatchSize int) EffectBatchInsertBuilder { a := m.Called(maxBatchSize) return a.Get(0).(EffectBatchInsertBuilder) } func (m *MockQEffects) CreateAccounts(ctx context.Context, addresses []string, maxBatchSize int) (map[string]int64, error) { a := m.Called(ctx, addresses, maxBatchSize) return a.Get(0).(map[string]int64), a.Error(1) }
tamirms/go
<|start_filename|>app/src/main/java/com/gh4a/resolver/UrlLoadTask.java<|end_filename|> package com.gh4a.resolver; import android.app.Dialog; import android.content.Intent; import android.os.AsyncTask; import android.os.Bundle; import androidx.annotation.NonNull; import androidx.fragment.app.DialogFragment; import androidx.fragment.app.FragmentActivity; import android.util.Log; import com.gh4a.Gh4Application; import com.gh4a.R; import com.gh4a.utils.IntentUtils; import com.gh4a.utils.Optional; import com.gh4a.utils.UiUtils; import io.reactivex.Single; public abstract class UrlLoadTask extends AsyncTask<Void, Void, Optional<Intent>> { protected final FragmentActivity mActivity; private ProgressDialogFragment mProgressDialog; private int mIntentFlags; private Runnable completionCallback; public UrlLoadTask(FragmentActivity activity) { super(); mActivity = activity; } public void setIntentFlags(int flags) { mIntentFlags = flags; } /** * Must be called BEFORE executing the task, otherwise the callback might not get executed. */ public void setCompletionCallback(Runnable callback) { completionCallback = callback; } @Override protected void onPreExecute() { super.onPreExecute(); mProgressDialog = new ProgressDialogFragment(); mProgressDialog.show(mActivity.getSupportFragmentManager(), "progress"); } @Override protected Optional<Intent> doInBackground(Void... params) { try { return getSingle().blockingGet(); } catch (Exception e) { Log.e(Gh4Application.LOG_TAG, "Failure during intent resolving", e); return Optional.absent(); } } @Override protected void onPostExecute(Optional<Intent> result) { if (mActivity.isFinishing()) { return; } if (result.isPresent()) { mActivity.startActivity(result.get().setFlags(mIntentFlags)); } else { IntentUtils.launchBrowser(mActivity, mActivity.getIntent().getData(), mIntentFlags); } if (mProgressDialog != null && mProgressDialog.isAdded()) { mProgressDialog.dismissAllowingStateLoss(); } if (completionCallback != null) { completionCallback.run(); } } protected abstract Single<Optional<Intent>> getSingle(); public static class ProgressDialogFragment extends DialogFragment { @NonNull @Override public Dialog onCreateDialog(Bundle savedInstanceState) { return UiUtils.createProgressDialog(getActivity(), R.string.loading_msg); } } } <|start_filename|>app/src/main/java/com/gh4a/widget/LinkSpan.java<|end_filename|> package com.gh4a.widget; import android.net.Uri; import android.text.style.ClickableSpan; import android.view.View; import com.gh4a.resolver.LinkParser; import com.gh4a.utils.IntentUtils; import androidx.annotation.NonNull; import androidx.fragment.app.FragmentActivity; public class LinkSpan extends ClickableSpan { private final String mUrl; public LinkSpan(String url) { mUrl = url; } @Override public void onClick(@NonNull View widget) { Uri clickedUri = Uri.parse(mUrl); FragmentActivity activity = (FragmentActivity) widget.getContext(); LinkParser.ParseResult result = LinkParser.parseUri(activity, clickedUri, null); if (result != null) { launchActivity(result, activity); } else { openWebPage(clickedUri, activity); } } private void launchActivity(LinkParser.ParseResult result, FragmentActivity activity) { if (result.intent != null) { activity.startActivity(result.intent); } else if (result.loadTask != null) { result.loadTask.execute(); } } private void openWebPage(Uri clickedUri, FragmentActivity activity) { String hostname = clickedUri.getHost(); if (hostname.endsWith("github.com") || hostname.endsWith("githubusercontent.com")) { IntentUtils.openInCustomTabOrBrowser(activity, clickedUri); } else { IntentUtils.launchBrowser(activity, clickedUri); } } } <|start_filename|>app/src/main/java/com/gh4a/resolver/ReleaseLoadTask.java<|end_filename|> package com.gh4a.resolver; import android.content.Intent; import androidx.annotation.VisibleForTesting; import androidx.fragment.app.FragmentActivity; import com.gh4a.ServiceFactory; import com.gh4a.activities.ReleaseInfoActivity; import com.gh4a.utils.ApiHelpers; import com.gh4a.utils.Optional; import com.gh4a.utils.RxUtils; import com.meisolsson.githubsdk.model.Release; import com.meisolsson.githubsdk.service.repositories.RepositoryReleaseService; import java.net.HttpURLConnection; import io.reactivex.Single; import retrofit2.Response; public class ReleaseLoadTask extends UrlLoadTask { @VisibleForTesting protected final String mRepoOwner; @VisibleForTesting protected final String mRepoName; @VisibleForTesting protected final String mTagName; @VisibleForTesting protected final long mId; public ReleaseLoadTask(FragmentActivity activity, String repoOwner, String repoName, String tagName) { super(activity); mRepoOwner = repoOwner; mRepoName = repoName; mTagName = tagName; mId = -1; } public ReleaseLoadTask(FragmentActivity activity, String repoOwner, String repoName, long id) { super(activity); mRepoOwner = repoOwner; mRepoName = repoName; mId = id; mTagName = null; } @Override protected Single<Optional<Intent>> getSingle() { RepositoryReleaseService service = ServiceFactory.get(RepositoryReleaseService.class, false); final Single<Response<Release>> releaseSingle; if (mId >= 0) { releaseSingle = service.getRelease(mRepoOwner, mRepoName, mId); } else { releaseSingle = service.getRelaseByTagName(mRepoOwner, mRepoName, mTagName); } return releaseSingle .map(ApiHelpers::throwOnFailure) .map(r -> Optional.of(ReleaseInfoActivity.makeIntent(mActivity, mRepoOwner, mRepoName, r))) .compose(RxUtils.mapFailureToValue(HttpURLConnection.HTTP_NOT_FOUND, Optional.absent())); } }
slapperwan/gh4a
<|start_filename|>docs/schema/Makefile<|end_filename|> default: jsonschema -i ./redshift_example_1.json -i ./pandas_example_1.json records_schema_v1_schema.json <|start_filename|>tests/component/resources/hint_sniffing/delimited-one-column.json<|end_filename|> { "required": { "record-terminator": "\n", "header-row": true }, "initial_hints": { "header-row": true }, "notes": "Python's sniffer doesn't do well on single-column files, meaning we don't get header-row info even if field delimiters are somewhat irrelevant" } <|start_filename|>tests/integration/cli/source_rdir/_schema.json<|end_filename|> {"schema": "bltypes/v1", "fields": {"a": {"type": "integer", "constraints": {"required": false}, "representations": {"origin": {"rep_type": "sql/redshift", "col_ddl": "INTEGER ENCODE lzo", "col_type": "INTEGER", "col_modifiers": "ENCODE lzo"}}, "index": 1}}, "representations": {"origin": {"rep_type": "sql/redshift", "table_ddl": "\nCREATE TABLE vbroz.test_table1 (\n\ta INTEGER ENCODE lzo\n) DISTSTYLE EVEN\n\n"}}, "known_representations": {"origin": {"type": "sql/redshift"}}} <|start_filename|>tests/component/resources/hint_sniffing/delimited-vertica-no-header.json<|end_filename|> { "required": { "field-delimiter": "\u0001", "record-terminator": "\u0002", "quoting": null, "doublequote": false, "escape": null, "header-row": false }, "initial_hints": { "escape": null, "field-delimiter": "\u0001", "record-terminator": "\u0002", "doublequote": false, "header-row": false }, "notes": "Escaping is not currently sniffed. We only sniff common newline types. The Python csv.Sniffer module doesn't work with non-standard newline types." } <|start_filename|>tests/component/resources/hint_sniffing/delimited-zero-bytes.json<|end_filename|> { "required": {}, "raises": "No columns to parse from file", "initial_hints": {}, "notes": "Whatever it figures out is fine so long as it doesn't give an internal error" } <|start_filename|>tests/component/resources/hint_sniffing/delimited-csv-with-header-mac-newlines.json<|end_filename|> { "required": { "header-row": true, "escape": null, "quoting": "minimal", "record-terminator": "\r" }, "initial_hints": { "escape": null }, "notes": "Escaping is not currently sniffed." } <|start_filename|>tests/integration/Dockerfile<|end_filename|> FROM python:3.6 # database connection scripts, psql CLI client for postgres and # Redshift, Vertica vsql client, MySQL client and misc shell tools for # integration tests RUN apt-get update && apt-get install -y netcat jq postgresql-client curl default-mysql-client # google-cloud-sdk for dbcli and bigquery in integration tests RUN echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] http://packages.cloud.google.com/apt cloud-sdk main" | tee -a /etc/apt/sources.list.d/google-cloud-sdk.list && curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key --keyring /usr/share/keyrings/cloud.google.gpg add - && apt-get update -y && apt-get install google-cloud-sdk -y RUN ln -s /bin/zcat /bin/gzcat # # Install Vertica client for mover CLI integration test # RUN cd / && \ wget https://www.vertica.com/client_drivers/9.2.x/9.2.0-0/vertica-client-9.2.0-0.x86_64.tar.gz && \ tar -xzvf vertica-client-9.2.0-0.x86_64.tar.gz && \ rm -fr /vertica-client-9.2.0-0.x86_64.tar.gz /opt/vertica/Python/ /opt/vertica/java /opt/vertica/bin/vsql32 ENV PATH $PATH:/opt/vertica/bin WORKDIR /usr/src/app COPY README.md requirements.txt setup.py /usr/src/app/ RUN mkdir /usr/src/app/records_mover COPY records_mover/version.py /usr/src/app/records_mover RUN pip3 install --no-cache-dir -r requirements.txt -e '/usr/src/app[movercli]' COPY . /usr/src/app # # Allow us to get coverage and quality metrics back out # VOLUME /usr/src/app
cwegrzyn/records-mover
<|start_filename|>conversions/to_jpg.cpp<|end_filename|> // Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #include <stddef.h> #include <string.h> #include "esp_attr.h" #include "soc/efuse_reg.h" #include "esp_heap_caps.h" #include "esp_camera.h" #include "img_converters.h" #include "jpge.h" #include "yuv.h" #include "esp_system.h" #ifdef ESP_IDF_VERSION_MAJOR // IDF 4+ #if CONFIG_IDF_TARGET_ESP32 // ESP32/PICO-D4 #include "esp32/spiram.h" #else #error Target CONFIG_IDF_TARGET is not supported #endif #else // ESP32 Before IDF 4.0 #include "esp_spiram.h" #endif #if defined(ARDUINO_ARCH_ESP32) && defined(CONFIG_ARDUHAL_ESP_LOG) #include "esp32-hal-log.h" #define TAG "" #else #include "esp_log.h" static const char* TAG = "to_jpg"; #endif static void *_malloc(size_t size) { void * res = malloc(size); if(res) { return res; } return heap_caps_malloc(size, MALLOC_CAP_SPIRAM | MALLOC_CAP_8BIT); } static IRAM_ATTR void convert_line_format(uint8_t * src, pixformat_t format, uint8_t * dst, size_t width, size_t in_channels, size_t line) { int i=0, o=0, l=0; if(format == PIXFORMAT_GRAYSCALE) { memcpy(dst, src + line * width, width); } else if(format == PIXFORMAT_RGB888) { l = width * 3; src += l * line; for(i=0; i<l; i+=3) { dst[o++] = src[i+2]; dst[o++] = src[i+1]; dst[o++] = src[i]; } } else if(format == PIXFORMAT_RGB565) { l = width * 2; src += l * line; for(i=0; i<l; i+=2) { dst[o++] = src[i] & 0xF8; dst[o++] = (src[i] & 0x07) << 5 | (src[i+1] & 0xE0) >> 3; dst[o++] = (src[i+1] & 0x1F) << 3; } } else if(format == PIXFORMAT_YUV422) { uint8_t y0, y1, u, v; uint8_t r, g, b; l = width * 2; src += l * line; for(i=0; i<l; i+=4) { y0 = src[i]; u = src[i+1]; y1 = src[i+2]; v = src[i+3]; yuv2rgb(y0, u, v, &r, &g, &b); dst[o++] = r; dst[o++] = g; dst[o++] = b; yuv2rgb(y1, u, v, &r, &g, &b); dst[o++] = r; dst[o++] = g; dst[o++] = b; } } } bool convert_image(uint8_t *src, uint16_t width, uint16_t height, pixformat_t format, uint8_t quality, jpge::output_stream *dst_stream) { int num_channels = 3; jpge::subsampling_t subsampling = jpge::H2V2; if(format == PIXFORMAT_GRAYSCALE) { num_channels = 1; subsampling = jpge::Y_ONLY; } if(!quality) { quality = 1; } else if(quality > 100) { quality = 100; } jpge::params comp_params = jpge::params(); comp_params.m_subsampling = subsampling; comp_params.m_quality = quality; jpge::jpeg_encoder dst_image; if (!dst_image.init(dst_stream, width, height, num_channels, comp_params)) { ESP_LOGE(TAG, "JPG encoder init failed"); return false; } uint8_t* line = (uint8_t*)_malloc(width * num_channels); if(!line) { ESP_LOGE(TAG, "Scan line malloc failed"); return false; } for (int i = 0; i < height; i++) { convert_line_format(src, format, line, width, num_channels, i); if (!dst_image.process_scanline(line)) { ESP_LOGE(TAG, "JPG process line %u failed", i); free(line); return false; } } free(line); if (!dst_image.process_scanline(NULL)) { ESP_LOGE(TAG, "JPG image finish failed"); return false; } dst_image.deinit(); return true; } class callback_stream : public jpge::output_stream { protected: jpg_out_cb ocb; void * oarg; size_t index; public: callback_stream(jpg_out_cb cb, void * arg) : ocb(cb), oarg(arg), index(0) { } virtual ~callback_stream() { } virtual bool put_buf(const void* data, int len) { index += ocb(oarg, index, data, len); return true; } virtual size_t get_size() const { return index; } }; bool fmt2jpg_cb(uint8_t *src, size_t src_len, uint16_t width, uint16_t height, pixformat_t format, uint8_t quality, jpg_out_cb cb, void * arg) { callback_stream dst_stream(cb, arg); return convert_image(src, width, height, format, quality, &dst_stream); } bool frame2jpg_cb(camera_fb_t * fb, uint8_t quality, jpg_out_cb cb, void * arg) { return fmt2jpg_cb(fb->buf, fb->len, fb->width, fb->height, fb->format, quality, cb, arg); } class memory_stream : public jpge::output_stream { protected: uint8_t *out_buf; size_t max_len, index; public: memory_stream(void *pBuf, uint buf_size) : out_buf(static_cast<uint8_t*>(pBuf)), max_len(buf_size), index(0) { } virtual ~memory_stream() { } virtual bool put_buf(const void* pBuf, int len) { if (!pBuf) { //end of image return true; } if ((size_t)len > (max_len - index)) { ESP_LOGW(TAG, "JPG output overflow: %d bytes", len - (max_len - index)); len = max_len - index; } if (len) { memcpy(out_buf + index, pBuf, len); index += len; } return true; } virtual size_t get_size() const { return index; } }; bool fmt2jpg(uint8_t *src, size_t src_len, uint16_t width, uint16_t height, pixformat_t format, uint8_t quality, uint8_t ** out, size_t * out_len) { //todo: allocate proper buffer for holding JPEG data //this should be enough for CIF frame size int jpg_buf_len = 64*1024; uint8_t * jpg_buf = (uint8_t *)_malloc(jpg_buf_len); if(jpg_buf == NULL) { ESP_LOGE(TAG, "JPG buffer malloc failed"); return false; } memory_stream dst_stream(jpg_buf, jpg_buf_len); if(!convert_image(src, width, height, format, quality, &dst_stream)) { free(jpg_buf); return false; } *out = jpg_buf; *out_len = dst_stream.get_size(); return true; } bool frame2jpg(camera_fb_t * fb, uint8_t quality, uint8_t ** out, size_t * out_len) { return fmt2jpg(fb->buf, fb->len, fb->width, fb->height, fb->format, quality, out, out_len); }
wzli/esp32-camera
<|start_filename|>lib/pretty_print_formatter/default.ex<|end_filename|> defmodule PrettyPrintFormatter.Default do @moduledoc """ Default formatter used for all messages that we're not going to format """ # Catch everything that we don't know how to handle def run(message) do message end end <|start_filename|>lib/pretty_print_formatter/phoenix.ex<|end_filename|> defmodule PrettyPrintFormatter.Phoenix do @moduledoc """ Format phoenix's specific log messages """ def run([verb, _, route]) do [verb, " ", route] end # Newer version def run(["Received ", verb, _, route]) do [verb, " ", route] end def run(["Sent", _, http_status, " in ", [time, unit]]) do ["Sent ", http_status, " in ", time, unit] end # Newer version def run(["Sent ", _, http_status, " in ", [time, unit]]) do ["Sent ", http_status, " in ", time, unit] end def run(["Processing with ", controller, _, action, _, _, _, " Parameters: ", params, _, " Pipelines: ", pipelines]) do [:green, " → ", :reset, controller, "#", action, :reset, :faint, " params: ", params, " pipelines: ", pipelines] end # Catch everything that we don't know how to handle def run(message) do message end end
byjord/pretty_print_formatter
<|start_filename|>nodejs/node_modules/speaker/deps/mpg123/src/xfermem.c<|end_filename|> /* xfermem: unidirectional fast pipe copyright ?-2008 by the mpg123 project - free software under the terms of the LGPL 2.1 see COPYING and AUTHORS files in distribution or http://mpg123.org initially written by <NAME> old timestamp: Sun Apr 6 02:26:26 MET DST 1997 See xfermem.h for documentation/description. */ #ifndef NOXFERMEM #include "mpg123app.h" #include <string.h> #include <errno.h> #include <sys/uio.h> #include <sys/mman.h> #include <sys/socket.h> #include <fcntl.h> #ifndef HAVE_MMAP #include <sys/ipc.h> #include <sys/shm.h> #endif #include "debug.h" #if defined (HAVE_MMAP) && defined(MAP_ANONYMOUS) && !defined(MAP_ANON) #define MAP_ANON MAP_ANONYMOUS #endif void xfermem_init (txfermem **xf, size_t bufsize, size_t msize, size_t skipbuf) { size_t regsize = bufsize + msize + skipbuf + sizeof(txfermem); #ifdef HAVE_MMAP # ifdef MAP_ANON if ((*xf = (txfermem *) mmap(0, regsize, PROT_READ | PROT_WRITE, MAP_ANON | MAP_SHARED, -1, 0)) == (txfermem *) -1) { perror ("mmap()"); exit (1); } # else int devzero; if ((devzero = open("/dev/zero", O_RDWR, 0)) == -1) { perror ("open(/dev/zero)"); exit (1); } if ((*xf = (txfermem *) mmap(0, regsize, PROT_READ | PROT_WRITE, MAP_SHARED, devzero, 0)) == (txfermem *) -1) { perror ("mmap()"); exit (1); } close (devzero); # endif #else struct shmid_ds shmemds; int shmemid; if ((shmemid = shmget(IPC_PRIVATE, regsize, IPC_CREAT | 0600)) == -1) { perror ("shmget()"); exit (1); } if ((*xf = (txfermem *) shmat(shmemid, 0, 0)) == (txfermem *) -1) { perror ("shmat()"); shmctl (shmemid, IPC_RMID, &shmemds); exit (1); } if (shmctl(shmemid, IPC_RMID, &shmemds) == -1) { perror ("shmctl()"); xfermem_done (*xf); exit (1); } #endif if (socketpair(AF_UNIX, SOCK_STREAM, 0, (*xf)->fd) < 0) { perror ("socketpair()"); xfermem_done (*xf); exit (1); } (*xf)->freeindex = (*xf)->readindex = 0; (*xf)->wakeme[0] = (*xf)->wakeme[1] = FALSE; (*xf)->data = ((byte *) *xf) + sizeof(txfermem) + msize; (*xf)->metadata = ((byte *) *xf) + sizeof(txfermem); (*xf)->size = bufsize; (*xf)->metasize = msize + skipbuf; (*xf)->justwait = 0; } void xfermem_done (txfermem *xf) { if(!xf) return; #ifdef HAVE_MMAP munmap ((caddr_t) xf, xf->size + xf->metasize + sizeof(txfermem)); #else if (shmdt((void *) xf) == -1) { perror ("shmdt()"); exit (1); } #endif } void xfermem_init_writer (txfermem *xf) { if(xf) close (xf->fd[XF_READER]); } void xfermem_init_reader (txfermem *xf) { if(xf) close (xf->fd[XF_WRITER]); } size_t xfermem_get_freespace (txfermem *xf) { size_t freeindex, readindex; if(!xf) return 0; if ((freeindex = xf->freeindex) < 0 || (readindex = xf->readindex) < 0) return (0); if (readindex > freeindex) return ((readindex - freeindex) - 1); else return ((xf->size - (freeindex - readindex)) - 1); } size_t xfermem_get_usedspace (txfermem *xf) { size_t freeindex, readindex; if(!xf) return 0; if ((freeindex = xf->freeindex) < 0 || (readindex = xf->readindex) < 0) return (0); if (freeindex >= readindex) return (freeindex - readindex); else return (xf->size - (readindex - freeindex)); } int xfermem_getcmd (int fd, int block) { fd_set selfds; byte cmd; for (;;) { struct timeval selto = {0, 0}; FD_ZERO (&selfds); FD_SET (fd, &selfds); #ifdef HPUX switch (select(FD_SETSIZE, (int *) &selfds, NULL, NULL, block ? NULL : &selto)) { #else switch (select(FD_SETSIZE, &selfds, NULL, NULL, block ? NULL : &selto)) { #endif case 0: if (!block) return (0); continue; case -1: if (errno == EINTR) continue; return (-2); case 1: if (FD_ISSET(fd, &selfds)) switch (read(fd, &cmd, 1)) { case 0: /* EOF */ return (-1); case -1: if (errno == EINTR) continue; return (-3); case 1: return (cmd); default: /* ?!? */ return (-4); } else /* ?!? */ return (-5); default: /* ?!? */ return (-6); } } } int xfermem_putcmd (int fd, byte cmd) { for (;;) { switch (write(fd, &cmd, 1)) { case 1: return (1); case -1: if (errno != EINTR) return (-1); } } } int xfermem_block (int readwrite, txfermem *xf) { int myfd = xf->fd[readwrite]; int result; xf->wakeme[readwrite] = TRUE; if (xf->wakeme[1 - readwrite]) xfermem_putcmd (myfd, XF_CMD_WAKEUP); result = xfermem_getcmd(myfd, TRUE); xf->wakeme[readwrite] = FALSE; return ((result <= 0) ? -1 : result); } /* Parallel-safe code to signal a process and wait for it to respond. */ int xfermem_sigblock(int readwrite, txfermem *xf, int pid, int signal) { int myfd = xf->fd[readwrite]; int result; xf->wakeme[readwrite] = TRUE; kill(pid, signal); /* not sure about that block... here */ if (xf->wakeme[1 - readwrite]) xfermem_putcmd (myfd, XF_CMD_WAKEUP); result = xfermem_getcmd(myfd, TRUE); xf->wakeme[readwrite] = FALSE; return ((result <= 0) ? -1 : result); } int xfermem_write(txfermem *xf, byte *buffer, size_t bytes) { if(buffer == NULL || bytes < 1) return FALSE; /* You weren't so braindead to have not allocated enough space at all, right? */ while (xfermem_get_freespace(xf) < bytes) { int cmd = xfermem_block(XF_WRITER, xf); if (cmd == XF_CMD_TERMINATE || cmd < 0) { error("failed to wait for free space"); return TRUE; /* Failure. */ } } /* Now we have enough space. copy the memory, possibly with the wrap. */ if(xf->size - xf->freeindex >= bytes) { /* one block of free memory */ memcpy(xf->data+xf->freeindex, buffer, bytes); } else { /* two blocks */ size_t endblock = xf->size - xf->freeindex; memcpy(xf->data+xf->freeindex, buffer, endblock); memcpy(xf->data, buffer + endblock, bytes-endblock); } /* Advance the free space pointer, including the wrap. */ xf->freeindex = (xf->freeindex + bytes) % xf->size; /* Wake up the buffer process if necessary. */ debug("write waking"); if(xf->wakeme[XF_READER]) return xfermem_putcmd(xf->fd[XF_WRITER], XF_CMD_WAKEUP_INFO) < 0 ? TRUE : FALSE; return FALSE; } #else /* stubs for generic / win32 */ #include "mpg123app.h" #include "xfermem.h" void xfermem_init (txfermem **xf, size_t bufsize, size_t msize, size_t skipbuf) { } void xfermem_done (txfermem *xf) { } void xfermem_init_writer (txfermem *xf) { } void xfermem_init_reader (txfermem *xf) { } size_t xfermem_get_freespace (txfermem *xf) { return 0; } size_t xfermem_get_usedspace (txfermem *xf) { return 0; } int xfermem_write(txfermem *xf, byte *buffer, size_t bytes) { return FALSE; } int xfermem_getcmd (int fd, int block) { return 0; } int xfermem_putcmd (int fd, byte cmd) { return 0; } int xfermem_block (int readwrite, txfermem *xf) { return 0; } int xfermem_sigblock (int readwrite, txfermem *xf, int pid, int signal) { return 0; } #endif /* eof */ <|start_filename|>nodejs/node_modules/rpio/examples/spi-at93c46.js<|end_filename|> var rpio = require('../lib/rpio'); /* * Read data from an SPI-attached AT93C46 EEPROM. */ rpio.spiBegin(); rpio.spiChipSelect(0); /* Use CE0 */ rpio.spiSetCSPolarity(0, rpio.HIGH); /* AT93C46 chip select is active-high */ rpio.spiSetClockDivider(128); /* AT93C46 max is 2MHz, 128 == 1.95MHz */ rpio.spiSetDataMode(0); /* * There are various magic numbers below. A quick overview: * * tx[0] is always 0x3, the EEPROM READ instruction. * tx[1] is set to var i which is the EEPROM address to read from. * tx[2] and tx[3] can be anything, at this point we are only interested in * reading the data back from the EEPROM into our rx buffer. * * Once we have the data returned in rx, we have to do some bit shifting to * get the result in the format we want, as the data is not 8-bit aligned. */ var tx = new Buffer([0x3, 0x0, 0x0, 0x0]); var rx = new Buffer(4); var out; var i, j = 0; for (i = 0; i < 128; i++, ++j) { tx[1] = i; rpio.spiTransfer(tx, rx, 4); out = ((rx[2] << 1) | (rx[3] >> 7)); process.stdout.write(out.toString(16) + ((j % 16 == 0) ? '\n' : ' ')); } rpio.spiEnd(); <|start_filename|>nodejs/node_modules/speaker/deps/mpg123/src/resolver.h<|end_filename|> /* resolver.c: TCP network stuff, for IPv4 and IPv6 copyright 2008 by the mpg123 project - free software under the terms of the LGPL 2.1 see COPYING and AUTHORS files in distribution or http://mpg123.org initially written <NAME> (based on httpget.c) */ #ifndef MPG123_RESOLVER_H #define MPG123_RESOLVER_H #include "mpg123app.h" /* Split an URL into parts of user:password, hostname, port, path on host. There is no name resolution going on here, also no numeric conversion. Return code 1 (TRUE) is fine, 0 (FALSE) is bad. */ int split_url(mpg123_string *url, mpg123_string *auth, mpg123_string *host, mpg123_string *port, mpg123_string *path); /* Open a connection to specified server and port. The arguments are plain strings (hostname or IP, port number as string); any network specific data types are hidden. */ int open_connection(mpg123_string *host, mpg123_string *port); #endif <|start_filename|>nodejs/node_modules/speaker/deps/mpg123/src/libmpg123/synth.h<|end_filename|> /* synth.h: generic synth functions copyright 1995-2008 by the mpg123 project - free software under the terms of the LGPL 2.1 see COPYING and AUTHORS files in distribution or http://mpg123.org initially written by <NAME>, generalized by <NAME> This header is used multiple times to create different variants of these functions. See decode.c and friends. Hint: BLOCK, MONO_NAME, MONO2STEREO_NAME, SYNTH_NAME and SAMPLE_T as well as WRITE_SAMPLE do vary. Thomas looked closely at the decode_1to1, decode_2to1 and decode_4to1 contents, seeing that they are too similar to be separate files. This is what resulted... Basically, you need one set of these functions for each output sample type. That currently means signed short, 8bit or float/double; though unsigned short may come, too. Define NO_AUTOINCREMENT i386 code that shall not rely on autoincrement. Actual benefit of this has to be examined; may apply to specific (old) compilers, only. */ /* Main synth function, uses the plain dct64 or dct64_i386. */ int SYNTH_NAME(real *bandPtr, int channel, mpg123_handle *fr, int final) { #ifndef NO_AUTOINCREMENT #define BACKPEDAL 0x10 /* We use autoincrement and thus need this re-adjustment for window/b0. */ #define MY_DCT64 dct64 #else #define BACKPEDAL 0x00 /* i386 code does not need that. */ #define MY_DCT64 dct64_i386 #endif static const int step = 2; SAMPLE_T *samples = (SAMPLE_T *) (fr->buffer.data + fr->buffer.fill); real *b0, **buf; /* (*buf)[0x110]; */ int clip = 0; int bo1; if(fr->have_eq_settings) do_equalizer(bandPtr,channel,fr->equalizer); if(!channel) { fr->bo--; fr->bo &= 0xf; buf = fr->real_buffs[0]; } else { #ifdef USE_DITHER /* We always go forward 32 dither points (and back again for the second channel), (re)sampling the noise the same way as the original signal. */ fr->ditherindex -= 32; #endif samples++; buf = fr->real_buffs[1]; } #ifdef USE_DITHER /* We check only once for the overflow of dither index here ... this wraps differently than the original i586 dither code, in theory (but when DITHERSIZE % BLOCK/2 == 0 it's the same). */ if(DITHERSIZE-fr->ditherindex < 32) fr->ditherindex = 0; /* And we define a macro for the dither action... */ #define ADD_DITHER(fr,sum) sum+=fr->dithernoise[fr->ditherindex]; fr->ditherindex += 64/BLOCK; #else #define ADD_DITHER(fr,sum) #endif if(fr->bo & 0x1) { b0 = buf[0]; bo1 = fr->bo; MY_DCT64(buf[1]+((fr->bo+1)&0xf),buf[0]+fr->bo,bandPtr); } else { b0 = buf[1]; bo1 = fr->bo+1; MY_DCT64(buf[0]+fr->bo,buf[1]+fr->bo+1,bandPtr); } { register int j; real *window = fr->decwin + 16 - bo1; for(j=(BLOCK/4); j; j--, b0+=0x400/BLOCK-BACKPEDAL, window+=0x800/BLOCK-BACKPEDAL, samples+=step) { real sum; #ifndef NO_AUTOINCREMENT sum = REAL_MUL_SYNTH(*window++, *b0++); sum -= REAL_MUL_SYNTH(*window++, *b0++); sum += REAL_MUL_SYNTH(*window++, *b0++); sum -= REAL_MUL_SYNTH(*window++, *b0++); sum += REAL_MUL_SYNTH(*window++, *b0++); sum -= REAL_MUL_SYNTH(*window++, *b0++); sum += REAL_MUL_SYNTH(*window++, *b0++); sum -= REAL_MUL_SYNTH(*window++, *b0++); sum += REAL_MUL_SYNTH(*window++, *b0++); sum -= REAL_MUL_SYNTH(*window++, *b0++); sum += REAL_MUL_SYNTH(*window++, *b0++); sum -= REAL_MUL_SYNTH(*window++, *b0++); sum += REAL_MUL_SYNTH(*window++, *b0++); sum -= REAL_MUL_SYNTH(*window++, *b0++); sum += REAL_MUL_SYNTH(*window++, *b0++); sum -= REAL_MUL_SYNTH(*window++, *b0++); #else sum = REAL_MUL_SYNTH(window[0x0], b0[0x0]); sum -= REAL_MUL_SYNTH(window[0x1], b0[0x1]); sum += REAL_MUL_SYNTH(window[0x2], b0[0x2]); sum -= REAL_MUL_SYNTH(window[0x3], b0[0x3]); sum += REAL_MUL_SYNTH(window[0x4], b0[0x4]); sum -= REAL_MUL_SYNTH(window[0x5], b0[0x5]); sum += REAL_MUL_SYNTH(window[0x6], b0[0x6]); sum -= REAL_MUL_SYNTH(window[0x7], b0[0x7]); sum += REAL_MUL_SYNTH(window[0x8], b0[0x8]); sum -= REAL_MUL_SYNTH(window[0x9], b0[0x9]); sum += REAL_MUL_SYNTH(window[0xA], b0[0xA]); sum -= REAL_MUL_SYNTH(window[0xB], b0[0xB]); sum += REAL_MUL_SYNTH(window[0xC], b0[0xC]); sum -= REAL_MUL_SYNTH(window[0xD], b0[0xD]); sum += REAL_MUL_SYNTH(window[0xE], b0[0xE]); sum -= REAL_MUL_SYNTH(window[0xF], b0[0xF]); #endif ADD_DITHER(fr,sum) WRITE_SAMPLE(samples,sum,clip); } { real sum; sum = REAL_MUL_SYNTH(window[0x0], b0[0x0]); sum += REAL_MUL_SYNTH(window[0x2], b0[0x2]); sum += REAL_MUL_SYNTH(window[0x4], b0[0x4]); sum += REAL_MUL_SYNTH(window[0x6], b0[0x6]); sum += REAL_MUL_SYNTH(window[0x8], b0[0x8]); sum += REAL_MUL_SYNTH(window[0xA], b0[0xA]); sum += REAL_MUL_SYNTH(window[0xC], b0[0xC]); sum += REAL_MUL_SYNTH(window[0xE], b0[0xE]); ADD_DITHER(fr,sum) WRITE_SAMPLE(samples,sum,clip); samples += step; b0-=0x400/BLOCK; window-=0x800/BLOCK; } window += bo1<<1; for(j=(BLOCK/4)-1; j; j--, b0-=0x400/BLOCK+BACKPEDAL, window-=0x800/BLOCK-BACKPEDAL, samples+=step) { real sum; #ifndef NO_AUTOINCREMENT sum = -REAL_MUL_SYNTH(*(--window), *b0++); sum -= REAL_MUL_SYNTH(*(--window), *b0++); sum -= REAL_MUL_SYNTH(*(--window), *b0++); sum -= REAL_MUL_SYNTH(*(--window), *b0++); sum -= REAL_MUL_SYNTH(*(--window), *b0++); sum -= REAL_MUL_SYNTH(*(--window), *b0++); sum -= REAL_MUL_SYNTH(*(--window), *b0++); sum -= REAL_MUL_SYNTH(*(--window), *b0++); sum -= REAL_MUL_SYNTH(*(--window), *b0++); sum -= REAL_MUL_SYNTH(*(--window), *b0++); sum -= REAL_MUL_SYNTH(*(--window), *b0++); sum -= REAL_MUL_SYNTH(*(--window), *b0++); sum -= REAL_MUL_SYNTH(*(--window), *b0++); sum -= REAL_MUL_SYNTH(*(--window), *b0++); sum -= REAL_MUL_SYNTH(*(--window), *b0++); sum -= REAL_MUL_SYNTH(*(--window), *b0++); #else sum = -REAL_MUL_SYNTH(window[-0x1], b0[0x0]); sum -= REAL_MUL_SYNTH(window[-0x2], b0[0x1]); sum -= REAL_MUL_SYNTH(window[-0x3], b0[0x2]); sum -= REAL_MUL_SYNTH(window[-0x4], b0[0x3]); sum -= REAL_MUL_SYNTH(window[-0x5], b0[0x4]); sum -= REAL_MUL_SYNTH(window[-0x6], b0[0x5]); sum -= REAL_MUL_SYNTH(window[-0x7], b0[0x6]); sum -= REAL_MUL_SYNTH(window[-0x8], b0[0x7]); sum -= REAL_MUL_SYNTH(window[-0x9], b0[0x8]); sum -= REAL_MUL_SYNTH(window[-0xA], b0[0x9]); sum -= REAL_MUL_SYNTH(window[-0xB], b0[0xA]); sum -= REAL_MUL_SYNTH(window[-0xC], b0[0xB]); sum -= REAL_MUL_SYNTH(window[-0xD], b0[0xC]); sum -= REAL_MUL_SYNTH(window[-0xE], b0[0xD]); sum -= REAL_MUL_SYNTH(window[-0xF], b0[0xE]); sum -= REAL_MUL_SYNTH(window[-0x0], b0[0xF]); /* Is that right? 0x0? Just wondering... */ #endif ADD_DITHER(fr,sum) WRITE_SAMPLE(samples,sum,clip); } } if(final) fr->buffer.fill += BLOCK*sizeof(SAMPLE_T); return clip; #undef ADD_DITHER #undef BACKPEDAL #undef MY_DCT64 } <|start_filename|>nodejs/node_modules/speaker/deps/mpg123/src/getlopt.h<|end_filename|> /* getlopt: command line option/parameter parsing copyright ?-2006 by the mpg123 project - free software under the terms of the LGPL 2.1 see COPYING and AUTHORS files in distribution or http://mpg123.org initially written <NAME> old timestamp: Tue Apr 8 07:13:39 MET DST 1997 */ #include <stdlib.h> #include <string.h> #ifndef _MPG123_GETLOPT_H_ #define _MPG123_GETLOPT_H_ extern int loptind; /* index in argv[] */ extern int loptchr; /* index in argv[loptind] */ extern char *loptarg; /* points to argument if present, else to option */ typedef struct { char sname; /* short option name, can be 0 */ char *lname; /* long option name, can be 0 */ int flags; /* see below */ void (*func)(char *); /* called if != 0 (after setting of var) */ void *var; /* type is *long, *char or **char, see below */ long value; } topt; /* ThOr: make this clear; distict long from int (since this is != on my Alpha) and really use a flag for every case (spare the 0 case for .... no flag) */ #define GLO_ARG 1 #define GLO_CHAR 2 #define GLO_INT 4 #define GLO_LONG 8 #define GLO_DOUBLE 16 /* flags: * bit 0 = 0 - no argument * if var != NULL * *var := value or (char)value [see bit 1] * else * loptarg = &option * return ((value != 0) ? value : sname) * bit 0 = 1 - argument required * if var != NULL * *var := atoi(arg) or strdup(arg) [see bit 1] * else * loptarg = &arg * return ((value != 0) ? value : sname) * * bit 1 = 1 - var is a pointer to a char (or string), * and value is interpreted as char * bit 2 = 1 - var is a pointer to int * bit 3 = 1 - var is a pointer to long * * Note: The options definition is terminated by a topt * containing only zeroes. */ #define GLO_END 0 #define GLO_UNKNOWN -1 #define GLO_NOARG -2 #define GLO_CONTINUE -3 int getlopt (int argc, char *argv[], topt *opts); /* return values: * GLO_END (0) end of options * GLO_UNKNOWN (-1) unknown option *loptarg * GLO_NOARG (-2) missing argument * GLO_CONTINUE (-3) (reserved for internal use) * else - return value according to flags (see above) */ #endif <|start_filename|>nodejs/test_youtube.js<|end_filename|> const request = require('request'); const youtubedl=require('youtube-dl'); const Cvlc=require('cvlc'); let player=new Cvlc(); const yturl= 'https://www.youtube.com/watch?v=NwhCsMepR3U'; const ytoptions=['--format=250']; function getYoutubeSearchList(inQuery){ const queryText=inQuery; return new Promise((resolve,reject)=>{ console.log('QueryText:'+queryText); const searchurl='https://www.youtube.com/results?search_query='; const queryUrl=encodeURI(searchurl+queryText); request(queryUrl,(err,res,body)=>{ let splitByWatch=body.split('href=\"\/watch?'); let isFirst=true; let urlList=[]; splitByWatch.forEach((splitText)=>{ if(isFirst===true) isFirst=false; else { let splitByQuot=splitText.split('"'); urlList.push(splitByQuot[0]); } }); resolve(urlList); }); }); }; function getPlayRealUrl(inUrl){ const url=inUrl; return new Promise((resolve,reject)=>{ youtubedl.getInfo(url,ytoptions,function(err,info){ console.log('title:'+info.title); console.log('url:'+info.url); resolve({title:info.title,url:info.url}); }); }); }; const youtubePlayBaseUrl='https://www.youtube.com/watch?'; async function playYoutubeByText(inQuery){ let urls=await getYoutubeSearchList(inQuery); let targetUrl=youtubePlayBaseUrl+urls[0]; console.log('yt url:'+targetUrl); let realPlayUrl=await getPlayRealUrl(targetUrl); console.log('title:'+realPlayUrl.title+' url:'+realPlayUrl.url); player.play(realPlayUrl.url,()=>{ console.log('Music Played'); }); }; playYoutubeByText('싸이'); <|start_filename|>nodejs/node_modules/rpio/examples/blink.js<|end_filename|> var rpio = require('../lib/rpio'); var pin = 11; var buf = new Buffer(1024); rpio.open(pin, rpio.INPUT, rpio.PULL_DOWN); for (var i = 0; i < 5; i++) { /* On for 1 second */ rpio.write(pin, rpio.HIGH); rpio.sleep(1); rpio.msleep(1); rpio.usleep(1); rpio.read(pin); /* Off for half a second (500ms) */ rpio.write(pin, rpio.LOW); rpio.msleep(500); rpio.readbuf(pin, buf); } <|start_filename|>nodejs/node_modules/rpio/examples/button.js<|end_filename|> var rpio = require('../lib/rpio'); /* * Watch a button switch attached to the configured pin for changes. * * This example uses the default P01-P40 numbering, and thus defaults to * P11 / GPIO17. */ var pin = 11; /* * Use the internal pulldown resistor to default to off. Pressing the button * causes the input to go high, releasing it leaves the pulldown resistor to * pull it back down to low. */ rpio.open(pin, rpio.INPUT, rpio.PULL_DOWN); /* * This callback will be called every time a configured event is detected on * the pin. The argument is the pin that triggered the event, so you can use * the same callback for multiple pins. */ function pollcb(cbpin) { /* * It cannot be guaranteed that the current value of the pin is the * same that triggered the event, so the best we can do is notify the * user that an event happened and print what the value is currently * set to. * * Unless you are pressing the button faster than 1ms (the default * setInterval() loop which polls for events) this shouldn't be a * problem. */ var state = rpio.read(cbpin) ? 'pressed' : 'released'; console.log('Button event on P%d (button currently %s)', cbpin, state); /* * By default this program will run forever. If you want to cancel the * poll after the first event and end the program, uncomment this line. */ // rpio.poll(cbpin, null); } /* * Configure the pin for the default set of events. If you wanted to only * watch for high or low events, then you'd use the third argument to specify * either rpio.POLL_LOW or rpio.POLL_HIGH. */ rpio.poll(pin, pollcb); <|start_filename|>nodejs/node_modules/speaker/deps/mpg123/src/output/output.h<|end_filename|> #ifdef __cplusplus extern "C" { #endif #include "mpg123.h" #include "module.h" #include "audio.h" extern mpg123_module_t mpg123_output_module_info; #ifdef __cplusplus } #endif <|start_filename|>nodejs/node_modules/speaker/deps/mpg123/src/win32_support.h<|end_filename|> /* Win32 support helper file This file is only for use with the mpg123 frontend. win32 support helpers for libmpg123 are in src/libmpg123/compat.h */ #ifndef MPG123_WIN32_SUPPORT_H #define MPG123_WIN32_SUPPORT_H #include "config.h" #include "mpg123.h" #ifdef HAVE_WINDOWS_H #define WIN32_LEAN_AND_MEAN 1 #include <stdlib.h> #include <stdio.h> #include <string.h> #include <wchar.h> #include <windows.h> #include <winnls.h> #include <shellapi.h> #include <mmsystem.h> #if defined (HAVE_WS2TCPIP_H) && !defined (__CYGWIN__) #include <winsock2.h> #include <ws2tcpip.h> #endif #if defined (WANT_WIN32_SOCKETS) /*conflict with gethostname and select in select.h and unistd.h */ /* Note: Do not treat return values as valid file/socket handles, they only indicate success/failure. file descriptors are ignored, only the local ws.local_socket is used for storing socket handle, so the socket handle is always associated with the last call to win32_net_http_open */ /** * Opens an http URL * @param[in] url URL to open * @param[out] hd http data info * @return -1 for failure, 1 for success */ int win32_net_http_open(char* url, struct httpdata *hd); /** * Reads from network socket * @param[in] filedes Value is ignored, last open connection is used. * @param[out] buf buffer to store data. * @param[in] nbyte bytes to read. * @return bytes read successfully from socket */ ssize_t win32_net_read (int fildes, void *buf, size_t nbyte); /** * Writes to network socket * @param[in] filedes Value is ignored, last open connection is used. * @param[in] buf buffer to read data from. * @param[in] nbyte bytes to write. * @return bytes written successfully to socket */ ssize_t win32_net_write (int fildes, const void *buf, size_t nbyte); /** * Similar to fgets - get a string from a stream * @param[out] s buffer to Write to * @param[in] n bytes of data to read. * @param[in] stream ignored for compatiblity, last open connection is used. * @return pointer to s if successful, NULL if failture */ char *win32_net_fgets(char *s, int n, int stream); /** * Initialize Winsock 2.2. */ void win32_net_init (void); /** * Shutdown all win32 sockets. */ void win32_net_deinit (void); /** * Close last open socket. * @param[in] sock value is ignored. */ void win32_net_close (int sock); /** * Set reader callback for mpg123_open_fd * @param[in] fr pointer to a mpg123_handle struct. */ void win32_net_replace (mpg123_handle *fr); #endif #ifdef WANT_WIN32_UNICODE /** * Put the windows command line into argv / argc, encoded in UTF-8. * You are supposed to free up resources by calling win32_cmdline_free with the values you got from this one. * @return 0 on success, -1 on error */ int win32_cmdline_utf8(int * argc, char *** argv); /** * Free up cmdline memory (the argv itself, theoretically hidden resources, too). */ void win32_cmdline_free(int argc, char **argv); #endif /* WIN32_WANT_UNICODE */ /** * Set process priority * @param arg -2: Idle, -1, bellow normal, 0, normal (ignored), 1 above normal, 2 highest, 3 realtime */ void win32_set_priority (const int arg); #ifdef WANT_WIN32_FIFO /** * win32_fifo_mkfifo * Creates a named pipe of path. * Should be closed with win32_fifo_close. * @param[in] path Path of pipe, should be in form of "\\.\pipe\pipename". * @return -1 on failure, 0 otherwise. * @see win32_fifo_close */ int win32_fifo_mkfifo(const char *path); /** *win32_fifo_close * Closes previously open pipe */ void win32_fifo_close(void); /** * win32_fifo_read_peek * Checks how many bytes in fifo is pending read operation * Only the tv_sec member in timeval is evaluated! No microsecond precision. * @param[in] tv contains information on block duration * @return bytes available */ DWORD win32_fifo_read_peek(struct timeval *tv); /*** * win32_fifo_read * Read up to nbyte of data from open pipe into buf * @param[in] buf Pointer to buffer. * @param[in] nbyte Number of bytes to read up to. * @return Number of bytes actually read. */ ssize_t win32_fifo_read(void *buf, size_t nbyte); #endif /* #ifdef WANT_WIN32_FIFO */ #endif /* HAVE_WINDOWS_H */ #endif /* MPG123_WIN32_SUPPORT_H */ <|start_filename|>nodejs/node_modules/speaker/deps/mpg123/src/sfifo.h<|end_filename|> /* SFIFO 1.3 Simple portable lock-free FIFO (c) 2000-2002, <NAME> - free software under the terms of the LGPL 2.1 */ /* * Platform support: * gcc / Linux / x86: Works * gcc / Linux / x86 kernel: Works * gcc / FreeBSD / x86: Works * gcc / NetBSD / x86: Works * gcc / Mac OS X / PPC: Works * gcc / Win32 / x86: Works * Borland C++ / DOS / x86RM: Works * Borland C++ / Win32 / x86PM16: Untested * ? / Various Un*ces / ?: Untested * ? / Mac OS / PPC: Untested * gcc / BeOS / x86: Untested * gcc / BeOS / PPC: Untested * ? / ? / Alpha: Untested * * 1.2: Max buffer size halved, to avoid problems with * the sign bit... * * 1.3: Critical buffer allocation bug fixed! For certain * requested buffer sizes, older version would * allocate a buffer of insufficient size, which * would result in memory thrashing. (Amazing that * I've manage to use this to the extent I have * without running into this... *heh*) */ #ifndef _SFIFO_H_ #define _SFIFO_H_ #ifdef __cplusplus extern "C" { #endif #include <errno.h> /* Defining SFIFO_STATIC and then including the sfifo.c will result in local code. */ #ifdef SFIFO_STATIC #define SFIFO_SCOPE static #else #define SFIFO_SCOPE #endif /*------------------------------------------------ "Private" stuff ------------------------------------------------*/ /* * Porting note: * Reads and writes of a variable of this type in memory * must be *atomic*! 'int' is *not* atomic on all platforms. * A safe type should be used, and sfifo should limit the * maximum buffer size accordingly. */ typedef int sfifo_atomic_t; #ifdef __TURBOC__ # define SFIFO_MAX_BUFFER_SIZE 0x7fff #else /* Kludge: Assume 32 bit platform */ # define SFIFO_MAX_BUFFER_SIZE 0x7fffffff #endif typedef struct sfifo_t { char *buffer; int size; /* Number of bytes */ sfifo_atomic_t readpos; /* Read position */ sfifo_atomic_t writepos; /* Write position */ } sfifo_t; #define SFIFO_SIZEMASK(x) ((x)->size - 1) /*------------------------------------------------ API ------------------------------------------------*/ SFIFO_SCOPE int sfifo_init(sfifo_t *f, int size); SFIFO_SCOPE void sfifo_close(sfifo_t *f); SFIFO_SCOPE void sfifo_flush(sfifo_t *f); SFIFO_SCOPE int sfifo_write(sfifo_t *f, const void *buf, int len); SFIFO_SCOPE int sfifo_read(sfifo_t *f, void *buf, int len); #define sfifo_used(x) (((x)->writepos - (x)->readpos) & SFIFO_SIZEMASK(x)) #define sfifo_space(x) ((x)->size - 1 - sfifo_used(x)) #define sfifo_size(x) ((x)->size - 1) #ifdef __cplusplus }; #endif #endif <|start_filename|>nodejs/node_modules/speaker/deps/mpg123/src/httpget.h<|end_filename|> /* httpget: HTTP input routines (the header) copyright 2007 by the mpg123 project - free software under the terms of the LGPL 2.1 see COPYING and AUTHORS files in distribution or http://mpg123.org initially written by <NAME> Note about MIME types: You feed debunk_mime() a MIME string and it classifies it as it is relevant for mpg123. In httpget.c are the MIME class lists, which may be appended to to support more bogus MIME types. */ #ifndef _HTTPGET_H_ #define _HTTPGET_H_ #include "mpg123.h" /* Pulled in by mpg123app.h! */ struct httpdata { mpg123_string content_type; mpg123_string icy_name; mpg123_string icy_url; off_t icy_interval; mpg123_string proxyhost; mpg123_string proxyport; /* Partly dummy for now... later proxy host resolution will be cached (PROXY_ADDR). */ enum { PROXY_UNKNOWN=0, PROXY_NONE, PROXY_HOST, PROXY_ADDR } proxystate; }; void httpdata_init(struct httpdata *e); void httpdata_reset(struct httpdata *e); void httpdata_free(struct httpdata *e); /* There is a whole lot of MIME types for the same thing. the function will reduce it to a combination of these flags */ #define IS_FILE 1 #define IS_LIST 2 #define IS_M3U 4 #define IS_PLS 8 #define HTTP_MAX_RELOCATIONS 20 int debunk_mime(const char* mime); /*Previously static functions, shared for win32_net_support */ int proxy_init(struct httpdata *hd); int translate_url(const char *url, mpg123_string *purl); size_t accept_length(void); int fill_request(mpg123_string *request, mpg123_string *host, mpg123_string *port, mpg123_string *httpauth1, int *try_without_port); void get_header_string(mpg123_string *response, const char *fieldname, mpg123_string *store); char *get_header_val(const char *hname, mpg123_string *response); /* needed for HTTP/1.1 non-pipelining mode */ /* #define CONN_HEAD "Connection: close\r\n" */ #define CONN_HEAD "" #define icy_yes "Icy-MetaData: 1\r\n" #define icy_no "Icy-MetaData: 0\r\n" extern char *proxyurl; extern unsigned long proxyip; /* takes url and content type string address, opens resource, returns fd for data, allocates and sets content type */ extern int http_open (char* url, struct httpdata *hd); extern char *httpauth; #endif <|start_filename|>nodejs/node_modules/speaker/deps/mpg123/src/local.c<|end_filename|> /* local: some stuff for localisation Currently, this is just about determining if we got UTF-8 locale. copyright 2008 by the mpg123 project - free software under the terms of the LGPL 2.1 see COPYING and AUTHORS files in distribution or http://mpg123.org initially written by <NAME>, based on a patch by <NAME>. */ #include "config.h" #ifdef HAVE_LOCALE_H #include <locale.h> #endif #ifdef HAVE_LANGINFO_H #include <langinfo.h> #endif #include "compat.h" #include "mpg123app.h" #include "debug.h" int utf8env = 0; /* Check some language variable for UTF-8-ness. */ static int is_utf8(const char *lang); void check_locale(void) { if(param.force_utf8) utf8env = 1; else { const char *cp; /* Check for env vars in proper oder. */ if((cp = getenv("LC_ALL")) == NULL && (cp = getenv("LC_CTYPE")) == NULL) cp = getenv("LANG"); if(is_utf8(cp)) utf8env = 1; } #if defined(HAVE_SETLOCALE) && defined(LC_CTYPE) /* To query, we need to set from environment... */ if(!utf8env && is_utf8(setlocale(LC_CTYPE, ""))) utf8env = 1; #endif #if defined(HAVE_NL_LANGINFO) && defined(CODESET) /* ...langinfo works after we set a locale, eh? So it makes sense after setlocale, if only. */ if(!utf8env && is_utf8(nl_langinfo(CODESET))) utf8env = 1; #endif debug1("UTF-8 locale: %i", utf8env); } static int is_utf8(const char *lang) { if(lang == NULL) return 0; /* Now, if the variable mentions UTF-8 anywhere, in some variation, the locale is UTF-8. */ if( strstr(lang, "UTF-8") || strstr(lang, "utf-8") || strstr(lang, "UTF8") || strstr(lang, "utf8") ) return 1; else return 0; } <|start_filename|>nodejs/node_modules/speaker/deps/mpg123/src/output/arts.c<|end_filename|> /* arts: audio output via aRts Sound Daemon copyright 2007-8 by the mpg123 project - free software under the terms of the LGPL 2.1 see COPYING and AUTHORS files in distribution or http://mpg123.org initially written by <NAME> (<EMAIL>) */ #include "mpg123app.h" #include <artsc.h> #include "debug.h" typedef struct { arts_stream_t arse; /* That's short for ARts StrEam;-) */ } mpg123_arts_t; static int open_arts(audio_output_t *ao) { short bits = 0; if(!ao) return -1; if(ao->format < 0) { ao->format = MPG123_ENC_SIGNED_16; ao->rate = 44100; ao->channels = 2; } /* Trial and error revealed these two formats to work with aRts. */ if(ao->format == MPG123_ENC_SIGNED_16) bits = 16; else if(ao->format == MPG123_ENC_UNSIGNED_8) bits = 8; else return -1; /* Initialize the aRts lib*/ arts_init(); /* Open a stream to the aRts server */ ((mpg123_arts_t*)ao->userptr)->arse = arts_play_stream( ao->rate, bits, ao->channels, "mpg123" ); /* Yeah, black box and all... it's still a pointer that is NULL on error. */ return (void*)((mpg123_arts_t*)ao->userptr)->arse == NULL ? -1 : 0; } static int get_formats_arts(audio_output_t *ao) { /* aRts runs not everything, but any rate. */ return MPG123_ENC_SIGNED_16|MPG123_ENC_UNSIGNED_8; } static int write_arts(audio_output_t *ao,unsigned char *buf,int len) { /* PIPE the PCM forward to the aRts Sound Daemon */ return arts_write( ((mpg123_arts_t*)ao->userptr)->arse , buf, len); } static int close_arts(audio_output_t *ao) { /* Close the connection! */ arts_close_stream( ((mpg123_arts_t*)ao->userptr)->arse ); /* Free the memory allocated*/ arts_free(); return 0; } static void flush_arts(audio_output_t *ao) { /* aRts doesn't have a flush statement! */ } static int deinit_arts(audio_output_t* ao) { if(ao->userptr) { free(ao->userptr); ao->userptr = NULL; } arts_free(); return 0; } static int init_arts(audio_output_t* ao) { if (ao==NULL) return -1; ao->userptr = malloc(sizeof(mpg123_arts_t)); if(ao->userptr == NULL) { error("Out of memory!"); return -1; } /* clear it to have a consistent state */ memset(ao->userptr, 0, sizeof(mpg123_arts_t)); /* Set callbacks */ ao->open = open_arts; ao->flush = flush_arts; ao->write = write_arts; ao->get_formats = get_formats_arts; ao->close = close_arts; ao->deinit = deinit_arts; /* Success */ return 0; } /* Module information data structure */ mpg123_module_t mpg123_output_module_info = { /* api_version */ MPG123_MODULE_API_VERSION, /* name */ "arts", /* description */ "Output audio using aRts Sound Daemon", /* revision */ "$Rev: $", /* handle */ NULL, /* init_output */ init_arts, }; <|start_filename|>nodejs/node_modules/speaker/deps/mpg123/src/xfermem.h<|end_filename|> /* xfermem: unidirectional fast pipe copyright ?-2006 by the mpg123 project - free software under the terms of the LGPL 2.1 see COPYING and AUTHORS files in distribution or http://mpg123.org initially written by <NAME> old timestamp: Sat Mar 29 04:41:34 MET 1997 This is a stand-alone module which implements a unidirectional, fast pipe using mmap(). Its primary use is to transfer large amounts of data from a parent process to its child process, with a buffer in between which decouples blocking conditions on both sides. Control information is transferred between the processes through a socketpair. See xftest.c for an example on how to use this module. note: xftest not there anymore */ #ifndef _XFERMEM_H_ #define _XFERMEM_H_ #ifndef TRUE #define FALSE 0 #define TRUE 1 #endif typedef struct { size_t freeindex; /* [W] next free index */ size_t readindex; /* [R] next index to read */ int fd[2]; int wakeme[2]; byte *data; byte *metadata; size_t size; size_t metasize; long rate; int channels; int format; int justwait; } txfermem; /* * [W] -- May be written to by the writing process only! * [R] -- May be written to by the reading process only! * All other entries are initialized once. */ void xfermem_init (txfermem **xf, size_t bufsize, size_t msize, size_t skipbuf); void xfermem_init_writer (txfermem *xf); void xfermem_init_reader (txfermem *xf); size_t xfermem_get_freespace (txfermem *xf); size_t xfermem_get_usedspace (txfermem *xf); #define XF_CMD_WAKEUP_INFO 0x04 #define XF_CMD_WAKEUP 0x02 #define XF_CMD_TERMINATE 0x03 #define XF_CMD_AUDIOCAP 0x05 #define XF_CMD_RESYNC 0x06 #define XF_CMD_ABORT 0x07 #define XF_WRITER 0 #define XF_READER 1 int xfermem_getcmd (int fd, int block); int xfermem_putcmd (int fd, byte cmd); int xfermem_block (int fd, txfermem *xf); int xfermem_sigblock (int fd, txfermem *xf, int pid, int signal); /* returns TRUE for being interrupted */ int xfermem_write(txfermem *xf, byte *buffer, size_t bytes); void xfermem_done (txfermem *xf); #define xfermem_done_writer xfermem_init_reader #define xfermem_done_reader xfermem_init_writer #endif <|start_filename|>nodejs/node_modules/speaker/deps/mpg123/src/metaprint.h<|end_filename|> /* metaprint: display of meta data (including filtering of UTF8 to ASCII) copyright 2006-2007 by the mpg123 project - free software under the terms of the LGPL 2.1 see COPYING and AUTHORS files in distribution or http://mpg123.org initially written by <NAME> */ #ifndef MPG123_METAPRINT_H #define MPG123_METAPRINT_H #include "mpg123app.h" void print_id3_tag(mpg123_handle *mh, int long_meta, FILE *out); void print_icy(mpg123_handle *mh, FILE *out); #endif <|start_filename|>nodejs/node_modules/speaker/deps/mpg123/src/audio.h<|end_filename|> /* audio: audio output interface copyright ?-2006 by the mpg123 project - free software under the terms of the LGPL 2.1 see COPYING and AUTHORS files in distribution or http://mpg123.org initially written by <NAME> */ /* * Audio 'LIB' defines */ #ifndef _MPG123_AUDIO_H_ #define _MPG123_AUDIO_H_ #include "compat.h" #include "mpg123.h" #include "module.h" #define AUDIO_OUT_HEADPHONES 0x01 #define AUDIO_OUT_INTERNAL_SPEAKER 0x02 #define AUDIO_OUT_LINE_OUT 0x04 enum { DECODE_TEST, DECODE_AUDIO, DECODE_FILE, DECODE_BUFFER, DECODE_WAV, DECODE_AU, DECODE_CDR, DECODE_AUDIOFILE }; /* 3% rate tolerance */ #define AUDIO_RATE_TOLERANCE 3 typedef struct audio_output_struct { int fn; /* filenumber */ void *userptr; /* driver specific pointer */ /* Callbacks */ int (*open)(struct audio_output_struct *); int (*get_formats)(struct audio_output_struct *); int (*write)(struct audio_output_struct *, unsigned char *,int); void (*flush)(struct audio_output_struct *); int (*close)(struct audio_output_struct *); int (*deinit)(struct audio_output_struct *); /* the module this belongs to */ mpg123_module_t *module; char *device; /* device name */ int flags; /* some bits; namely headphone/speaker/line */ long rate; /* sample rate */ long gain; /* output gain */ int channels; /* number of channels */ int format; /* format flags */ int is_open; /* something opened? */ #define MPG123_OUT_QUIET 1 int auxflags; /* For now just one: quiet mode (for probing). */ } audio_output_t; /* Lazy. */ #define AOQUIET (ao->auxflags & MPG123_OUT_QUIET) struct audio_format_name { int val; char *name; char *sname; }; #define pitch_rate(rate) (param.pitch == 0 ? (rate) : (long) ((param.pitch+1.0)*(rate))) /* ------ Declarations from "audio.c" ------ */ audio_output_t* open_output_module( const char* name ); void close_output_module( audio_output_t* ao ); audio_output_t* alloc_audio_output(); void audio_capabilities(audio_output_t *ao, mpg123_handle *mh); int audio_fit_capabilities(audio_output_t *ao,int c,int r); const char* audio_encoding_name(const int encoding, const int longer); void print_capabilities(audio_output_t *ao, mpg123_handle *mh); int init_output(audio_output_t **ao); void exit_output(audio_output_t *ao, int rude); int flush_output(audio_output_t *ao, unsigned char *bytes, size_t count); int open_output(audio_output_t *ao); void close_output(audio_output_t *ao ); int reset_output(audio_output_t *ao); void output_pause(audio_output_t *ao); /* Prepare output for inactivity. */ void output_unpause(audio_output_t *ao); /* Reactivate output (buffer process). */ void audio_enclist(char** list); /* Make a string of encoding names. */ /* Twiddle audio output rate to yield speedup/down (pitch) effect. The actually achieved pitch value is stored in param.pitch. Returns 1 if pitch setting succeeded, 0 otherwise. */ int set_pitch(mpg123_handle *fr, audio_output_t *ao, double new_pitch); #endif <|start_filename|>nodejs/node_modules/speaker/deps/mpg123/src/streamdump.c<|end_filename|> /* streamdump: Dumping a copy of the input data. copyright 2010 by the mpg123 project - free software under the terms of the LGPL 2.1 see COPYING and AUTHORS files in distribution or http://mpg123.org initially written by <NAME> */ #include "streamdump.h" #include <fcntl.h> #include <errno.h> #include "debug.h" /* Stream dump descriptor. */ static int dump_fd = -1; /* Read data from input, write copy to dump file. */ static ssize_t dump_read(int fd, void *buf, size_t count) { ssize_t ret = read(fd, buf, count); if(ret > 0 && dump_fd > -1) { write(dump_fd, buf, ret); } return ret; } /* Also mirror seeks, to prevent messed up dumps of seekable streams. */ static off_t dump_seek(int fd, off_t pos, int whence) { off_t ret = lseek(fd, pos, whence); if(ret >= 0 && dump_fd > -1) { lseek(dump_fd, pos, whence); } return ret; } /* External API... open and close. */ int dump_open(mpg123_handle *mh) { int ret; if(param.streamdump == NULL) return 0; if(!param.quiet) fprintf(stderr, "Note: Dumping stream to %s\n", param.streamdump); dump_fd = compat_open(param.streamdump, O_CREAT|O_TRUNC|O_RDWR); if(dump_fd < 0) { error1("Failed to open dump file: %s\n", strerror(errno)); return -1; } #ifdef WIN32 _setmode(dump_fd, _O_BINARY); #endif ret = mpg123_replace_reader(mh, dump_read, dump_seek); if(ret != MPG123_OK) { error1("Unable to replace reader for stream dump: %s\n", mpg123_strerror(mh)); dump_close(); return -1; } else return 0; } void dump_close(void) { if(dump_fd > -1) compat_close(dump_fd); dump_fd = -1; } <|start_filename|>nodejs/node_modules/speaker/deps/mpg123/src/output/sgi.c<|end_filename|> /* sgi: audio output on SGI boxen copyright ?-2006 by the mpg123 project - free software under the terms of the LGPL 2.1 see COPYING and AUTHORS files in distribution or http://mpg123.org initially written (as it seems) by <NAME> */ #include <fcntl.h> /* #include <audio.h> */ #include <dmedia/audio.h> #include "mpg123app.h" #include "debug.h" /* Analog output constant */ static const char analog_output_res_name[] = ".AnalogOut"; static int set_rate(audio_output_t *ao, ALconfig config) { int dev = alGetDevice(config); ALpv params[1]; /* Make sure the device is OK */ if (dev < 0) { error1("set_rate: %s",alGetErrorString(oserror())); return 1; } params[0].param = AL_OUTPUT_RATE; params[0].value.ll = alDoubleToFixed(ao->rate); if (alSetParams(dev, params,1) < 0) error1("set_rate: %s",alGetErrorString(oserror())); return 0; } static int set_channels(audio_output_t *ao, ALconfig config) { int ret; if(ao->channels == 2) ret = alSetChannels(config, AL_STEREO); else ret = alSetChannels(config, AL_MONO); if (ret < 0) error1("set_channels : %s",alGetErrorString(oserror())); return 0; } static int set_format(audio_output_t *ao, ALconfig config) { if (alSetSampFmt(config,AL_SAMPFMT_TWOSCOMP) < 0) error1("set_format : %s",alGetErrorString(oserror())); if (alSetWidth(config,AL_SAMPLE_16) < 0) error1("set_format : %s",alGetErrorString(oserror())); return 0; } static int open_sgi(audio_output_t *ao) { int dev = AL_DEFAULT_OUTPUT; ALconfig config = alNewConfig(); ALport port = NULL; /* Test for correct completion */ if (config == 0) { error1("open_sgi: %s",alGetErrorString(oserror())); return -1; } /* Set port parameters */ if(ao->channels == 2) alSetChannels(config, AL_STEREO); else alSetChannels(config, AL_MONO); alSetWidth(config, AL_SAMPLE_16); alSetSampFmt(config,AL_SAMPFMT_TWOSCOMP); alSetQueueSize(config, 131069); /* Setup output device to specified module. If there is no module specified in ao structure, use the default four output */ if ((ao->device) != NULL) { char *dev_name; dev_name=malloc((strlen(ao->device) + strlen(analog_output_res_name) + 1) * sizeof(char)); strcpy(dev_name,ao->device); strcat(dev_name,analog_output_res_name); /* Find the asked device resource */ dev=alGetResourceByName(AL_SYSTEM,dev_name,AL_DEVICE_TYPE); /* Free allocated space */ free(dev_name); if (!dev) { error2("Invalid audio resource: %s (%s)",dev_name, alGetErrorString(oserror())); return -1; } } /* Set the device */ if (alSetDevice(config,dev) < 0) { error1("open_sgi: %s",alGetErrorString(oserror())); return -1; } /* Open the audio port */ port = alOpenPort("mpg123-VSC", "w", config); if(port == NULL) { error1("Unable to open audio channel: %s", alGetErrorString(oserror())); return -1; } ao->userptr = (void*)port; set_format(ao, config); set_channels(ao, config); set_rate(ao, config); alFreeConfig(config); return 1; } static int get_formats_sgi(audio_output_t *ao) { return MPG123_ENC_SIGNED_16; } static int write_sgi(audio_output_t *ao,unsigned char *buf,int len) { ALport port = (ALport)ao->userptr; if(ao->format == MPG123_ENC_SIGNED_8) alWriteFrames(port, buf, len>>1); else alWriteFrames(port, buf, len>>2); return len; } static int close_sgi(audio_output_t *ao) { ALport port = (ALport)ao->userptr; if (port) { while(alGetFilled(port) > 0) sginap(1); alClosePort(port); ao->userptr=NULL; } return 0; } static void flush_sgi(audio_output_t *ao) { } static int init_sgi(audio_output_t* ao) { if (ao==NULL) return -1; /* Set callbacks */ ao->open = open_sgi; ao->flush = flush_sgi; ao->write = write_sgi; ao->get_formats = get_formats_sgi; ao->close = close_sgi; /* Success */ return 0; } /* Module information data structure */ mpg123_module_t mpg123_output_module_info = { /* api_version */ MPG123_MODULE_API_VERSION, /* name */ "sgi", /* description */ "Audio output for SGI.", /* revision */ "$Rev:$", /* handle */ NULL, /* init_output */ init_sgi, }; <|start_filename|>nodejs/test_am2301.js<|end_filename|> const { spawn } = require('child_process'); function readAIMKSEN001(callback){ const prg= spawn('./am2301'); let returnTemp; let returnHumid; let returnCode=200; prg.stdout.on('data', (data) => { returnStr=data.toString(); let dataSplit=returnStr.split('\n'); returnTemp=dataSplit[0].split('=')[1]; returnHumid=dataSplit[1].split('=')[1]; }); prg.stderr.on('data', (data) => { returnCode=500; }); prg.on('close', (code) => { callback(returnCode,returnTemp,returnHumid); }); }; readAIMKSEN001((rc,temp,humid)=>{ console.log('Result:'+rc+', Temperature:'+temp+', humidity:'+humid); }); <|start_filename|>nodejs/node_modules/speaker/deps/mpg123/src/common.h<|end_filename|> /* common: anything can happen here... frame reading, output, messages copyright ?-2006 by the mpg123 project - free software under the terms of the LGPL 2.1 see COPYING and AUTHORS files in distribution or http://mpg123.org initially written by <NAME> */ #ifndef _MPG123_COMMON_H_ #define _MPG123_COMMON_H_ #include "mpg123app.h" void (*catchsignal(int signum, void(*handler)()))(); void print_header(mpg123_handle *); void print_header_compact(mpg123_handle *); void print_stat(mpg123_handle *fr, long offset, long buffsize); void clear_stat(); /* for control_generic */ extern const char* remote_header_help; void print_remote_header(mpg123_handle *mh); void generic_sendmsg (const char *fmt, ...); int split_dir_file(const char *path, char **dname, char **fname); extern const char* rva_name[3]; #endif <|start_filename|>nodejs/node_modules/grpc/deps/grpc/src/core/ext/filters/client_channel/lb_policy.h<|end_filename|> /* * * Copyright 2015 gRPC authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ #ifndef GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_LB_POLICY_H #define GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_LB_POLICY_H #include <grpc/support/port_platform.h> #include "src/core/ext/filters/client_channel/client_channel_channelz.h" #include "src/core/ext/filters/client_channel/client_channel_factory.h" #include "src/core/ext/filters/client_channel/subchannel.h" #include "src/core/lib/gprpp/abstract.h" #include "src/core/lib/gprpp/orphanable.h" #include "src/core/lib/gprpp/ref_counted_ptr.h" #include "src/core/lib/iomgr/combiner.h" #include "src/core/lib/iomgr/polling_entity.h" #include "src/core/lib/transport/connectivity_state.h" extern grpc_core::DebugOnlyTraceFlag grpc_trace_lb_policy_refcount; namespace grpc_core { /// Interface for load balancing policies. /// /// Note: All methods with a "Locked" suffix must be called from the /// combiner passed to the constructor. /// /// Any I/O done by the LB policy should be done under the pollset_set /// returned by \a interested_parties(). class LoadBalancingPolicy : public InternallyRefCountedWithTracing<LoadBalancingPolicy> { public: struct Args { /// The combiner under which all LB policy calls will be run. /// Policy does NOT take ownership of the reference to the combiner. // TODO(roth): Once we have a C++-like interface for combiners, this // API should change to take a smart pointer that does pass ownership // of a reference. grpc_combiner* combiner = nullptr; /// Used to create channels and subchannels. grpc_client_channel_factory* client_channel_factory = nullptr; /// Channel args from the resolver. /// Note that the LB policy gets the set of addresses from the /// GRPC_ARG_LB_ADDRESSES channel arg. grpc_channel_args* args = nullptr; }; /// State used for an LB pick. struct PickState { /// Initial metadata associated with the picking call. grpc_metadata_batch* initial_metadata; /// Bitmask used for selective cancelling. See /// \a CancelMatchingPicksLocked() and \a GRPC_INITIAL_METADATA_* in /// grpc_types.h. uint32_t initial_metadata_flags; /// Storage for LB token in \a initial_metadata, or nullptr if not used. grpc_linked_mdelem lb_token_mdelem_storage; /// Closure to run when pick is complete, if not completed synchronously. /// If null, pick will fail if a result is not available synchronously. grpc_closure* on_complete; /// Will be set to the selected subchannel, or nullptr on failure or when /// the LB policy decides to drop the call. RefCountedPtr<ConnectedSubchannel> connected_subchannel; /// Will be populated with context to pass to the subchannel call, if /// needed. grpc_call_context_element subchannel_call_context[GRPC_CONTEXT_COUNT]; /// Upon success, \a *user_data will be set to whatever opaque information /// may need to be propagated from the LB policy, or nullptr if not needed. // TODO(roth): As part of revamping our metadata APIs, try to find a // way to clean this up and C++-ify it. void** user_data; /// Next pointer. For internal use by LB policy. PickState* next; }; // Not copyable nor movable. LoadBalancingPolicy(const LoadBalancingPolicy&) = delete; LoadBalancingPolicy& operator=(const LoadBalancingPolicy&) = delete; /// Updates the policy with a new set of \a args from the resolver. /// Note that the LB policy gets the set of addresses from the /// GRPC_ARG_LB_ADDRESSES channel arg. virtual void UpdateLocked(const grpc_channel_args& args) GRPC_ABSTRACT; /// Finds an appropriate subchannel for a call, based on data in \a pick. /// \a pick must remain alive until the pick is complete. /// /// If a result is known immediately, returns true, setting \a *error /// upon failure. Otherwise, \a pick->on_complete will be invoked once /// the pick is complete with its error argument set to indicate success /// or failure. /// /// If \a pick->on_complete is null and no result is known immediately, /// a synchronous failure will be returned (i.e., \a *error will be /// set and true will be returned). virtual bool PickLocked(PickState* pick, grpc_error** error) GRPC_ABSTRACT; /// Cancels \a pick. /// The \a on_complete callback of the pending pick will be invoked with /// \a pick->connected_subchannel set to null. virtual void CancelPickLocked(PickState* pick, grpc_error* error) GRPC_ABSTRACT; /// Cancels all pending picks for which their \a initial_metadata_flags (as /// given in the call to \a PickLocked()) matches /// \a initial_metadata_flags_eq when ANDed with /// \a initial_metadata_flags_mask. virtual void CancelMatchingPicksLocked(uint32_t initial_metadata_flags_mask, uint32_t initial_metadata_flags_eq, grpc_error* error) GRPC_ABSTRACT; /// Requests a notification when the connectivity state of the policy /// changes from \a *state. When that happens, sets \a *state to the /// new state and schedules \a closure. virtual void NotifyOnStateChangeLocked(grpc_connectivity_state* state, grpc_closure* closure) GRPC_ABSTRACT; /// Returns the policy's current connectivity state. Sets \a error to /// the associated error, if any. virtual grpc_connectivity_state CheckConnectivityLocked( grpc_error** connectivity_error) GRPC_ABSTRACT; /// Hands off pending picks to \a new_policy. virtual void HandOffPendingPicksLocked(LoadBalancingPolicy* new_policy) GRPC_ABSTRACT; /// Tries to enter a READY connectivity state. /// TODO(roth): As part of restructuring how we handle IDLE state, /// consider whether this method is still needed. virtual void ExitIdleLocked() GRPC_ABSTRACT; /// Resets connection backoff. virtual void ResetBackoffLocked() GRPC_ABSTRACT; /// Populates child_subchannels and child_channels with the uuids of this /// LB policy's referenced children. This is not invoked from the /// client_channel's combiner. The implementation is responsible for /// providing its own synchronization. virtual void FillChildRefsForChannelz(ChildRefsList* child_subchannels, ChildRefsList* child_channels) GRPC_ABSTRACT; void Orphan() override { // Invoke ShutdownAndUnrefLocked() inside of the combiner. GRPC_CLOSURE_SCHED( GRPC_CLOSURE_CREATE(&LoadBalancingPolicy::ShutdownAndUnrefLocked, this, grpc_combiner_scheduler(combiner_)), GRPC_ERROR_NONE); } /// Sets the re-resolution closure to \a request_reresolution. void SetReresolutionClosureLocked(grpc_closure* request_reresolution) { GPR_ASSERT(request_reresolution_ == nullptr); request_reresolution_ = request_reresolution; } grpc_pollset_set* interested_parties() const { return interested_parties_; } GRPC_ABSTRACT_BASE_CLASS protected: GPRC_ALLOW_CLASS_TO_USE_NON_PUBLIC_DELETE explicit LoadBalancingPolicy(const Args& args); virtual ~LoadBalancingPolicy(); grpc_combiner* combiner() const { return combiner_; } grpc_client_channel_factory* client_channel_factory() const { return client_channel_factory_; } /// Shuts down the policy. Any pending picks that have not been /// handed off to a new policy via HandOffPendingPicksLocked() will be /// failed. virtual void ShutdownLocked() GRPC_ABSTRACT; /// Tries to request a re-resolution. void TryReresolutionLocked(grpc_core::TraceFlag* grpc_lb_trace, grpc_error* error); private: static void ShutdownAndUnrefLocked(void* arg, grpc_error* ignored) { LoadBalancingPolicy* policy = static_cast<LoadBalancingPolicy*>(arg); policy->ShutdownLocked(); policy->Unref(); } /// Combiner under which LB policy actions take place. grpc_combiner* combiner_; /// Client channel factory, used to create channels and subchannels. grpc_client_channel_factory* client_channel_factory_; /// Owned pointer to interested parties in load balancing decisions. grpc_pollset_set* interested_parties_; /// Callback to force a re-resolution. grpc_closure* request_reresolution_; // Dummy classes needed for alignment issues. // See https://github.com/grpc/grpc/issues/16032 for context. // TODO(ncteisen): remove this as soon as the issue is resolved. ChildRefsList dummy_list_foo; ChildRefsList dummy_list_bar; }; } // namespace grpc_core #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_LB_POLICY_H */ <|start_filename|>nodejs/node_modules/rpio/examples/pwm-led.js<|end_filename|> var rpio = require('../lib/rpio'); /* * Pulse an LED attached to P12 / GPIO18 5 times. */ var pin = 12; /* P12/GPIO18 */ var range = 1024; /* LEDs can quickly hit max brightness, so only use */ var max = 128; /* the bottom 8th of a larger scale */ var clockdiv = 8; /* Clock divider (PWM refresh rate), 8 == 2.4MHz */ var interval = 5; /* setInterval timer, speed of pulses */ var times = 5; /* How many times to pulse before exiting */ /* * Enable PWM on the chosen pin and set the clock and range. */ rpio.open(pin, rpio.PWM); rpio.pwmSetClockDivider(clockdiv); rpio.pwmSetRange(pin, range); /* * Repeatedly pulse from low to high and back again until times runs out. */ var direction = 1; var data = 0; var pulse = setInterval(function() { rpio.pwmSetData(pin, data); if (data === 0) { direction = 1; if (times-- === 0) { clearInterval(pulse); rpio.open(pin, rpio.INPUT); return; } } else if (data === max) { direction = -1; } data += direction; }, interval, data, direction, times); <|start_filename|>nodejs/node_modules/rpio/src/rpio.cc<|end_filename|> /* * Copyright (c) 2015 <NAME> <<EMAIL>> * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #include <nan.h> #include <unistd.h> /* usleep() */ #include "bcm2835.h" #define RPIO_EVENT_LOW 0x1 #define RPIO_EVENT_HIGH 0x2 using namespace Nan; /* * GPIO function select. Pass through all values supported by bcm2835. */ NAN_METHOD(gpio_function) { if ((info.Length() != 2) || !info[0]->IsNumber() || !info[1]->IsNumber() || (info[1]->NumberValue() > 7)) return ThrowTypeError("Incorrect arguments"); bcm2835_gpio_fsel(info[0]->NumberValue(), info[1]->NumberValue()); } /* * GPIO read/write */ NAN_METHOD(gpio_read) { if ((info.Length() != 1) || (!info[0]->IsNumber())) return ThrowTypeError("Incorrect arguments"); info.GetReturnValue().Set(bcm2835_gpio_lev(info[0]->NumberValue())); } NAN_METHOD(gpio_readbuf) { uint32_t i; char *buf; if ((info.Length() != 3) || !info[0]->IsNumber() || !info[1]->IsObject() || !info[2]->IsNumber()) return ThrowTypeError("Incorrect arguments"); buf = node::Buffer::Data(info[1]->ToObject()); for (i = 0; i < info[2]->NumberValue(); i++) buf[i] = bcm2835_gpio_lev(info[0]->NumberValue()); } NAN_METHOD(gpio_write) { if ((info.Length() != 2) || !info[0]->IsNumber() || !info[1]->IsNumber()) return ThrowTypeError("Incorrect arguments"); bcm2835_gpio_write(info[0]->NumberValue(), info[1]->NumberValue()); } NAN_METHOD(gpio_writebuf) { uint32_t i; char *buf; if ((info.Length() != 3) || !info[0]->IsNumber() || !info[1]->IsObject() || !info[2]->IsNumber()) return ThrowTypeError("Incorrect arguments"); buf = node::Buffer::Data(info[1]->ToObject()); for (i = 0; i < info[2]->NumberValue(); i++) bcm2835_gpio_write(info[0]->NumberValue(), buf[i]); } NAN_METHOD(gpio_pad_read) { if ((info.Length() != 1) || !info[0]->IsNumber()) return ThrowTypeError("Incorrect arguments"); info.GetReturnValue().Set(bcm2835_gpio_pad(info[0]->NumberValue())); } NAN_METHOD(gpio_pad_write) { if ((info.Length() != 2) || !info[0]->IsNumber() || !info[1]->IsNumber()) return ThrowTypeError("Incorrect arguments"); bcm2835_gpio_set_pad(info[0]->NumberValue(), info[1]->NumberValue()); } NAN_METHOD(gpio_pud) { if ((info.Length() != 2) || !info[0]->IsNumber() || !info[1]->IsNumber()) return ThrowTypeError("Incorrect arguments"); /* * We use our own version of bcm2835_gpio_set_pud as that uses * delayMicroseconds() which requires access to the timers and * therefore /dev/mem and root. Our version is identical, except for * using usleep() instead. */ bcm2835_gpio_pud(info[1]->NumberValue()); usleep(10); bcm2835_gpio_pudclk(info[0]->NumberValue(), 1); usleep(10); bcm2835_gpio_pud(BCM2835_GPIO_PUD_OFF); bcm2835_gpio_pudclk(info[0]->NumberValue(), 0); } NAN_METHOD(gpio_event_set) { if ((info.Length() != 2) || !info[0]->IsNumber() || !info[1]->IsNumber()) return ThrowTypeError("Incorrect arguments"); /* Clear all possible trigger events. */ bcm2835_gpio_clr_ren(info[0]->NumberValue()); bcm2835_gpio_clr_fen(info[0]->NumberValue()); bcm2835_gpio_clr_hen(info[0]->NumberValue()); bcm2835_gpio_clr_len(info[0]->NumberValue()); bcm2835_gpio_clr_aren(info[0]->NumberValue()); bcm2835_gpio_clr_afen(info[0]->NumberValue()); /* * Add the requested events, using the synchronous rising and * falling edge detection bits. */ if ((uint32_t)info[1]->NumberValue() & RPIO_EVENT_HIGH) bcm2835_gpio_ren(info[0]->NumberValue()); if ((uint32_t)info[1]->NumberValue() & RPIO_EVENT_LOW) bcm2835_gpio_fen(info[0]->NumberValue()); } NAN_METHOD(gpio_event_poll) { uint32_t rval = 0; if ((info.Length() != 1) || !info[0]->IsNumber()) return ThrowTypeError("Incorrect arguments"); /* * Interrupts are not supported, so this merely reports that an event * happened in the time period since the last poll. There is no way to * know which trigger caused the event. */ if ((rval = bcm2835_gpio_eds_multi(info[0]->NumberValue()))) bcm2835_gpio_set_eds_multi(rval); info.GetReturnValue().Set(rval); } NAN_METHOD(gpio_event_clear) { if ((info.Length() != 1) || !info[0]->IsNumber()) return ThrowTypeError("Incorrect arguments"); bcm2835_gpio_clr_fen(info[0]->NumberValue()); bcm2835_gpio_clr_ren(info[0]->NumberValue()); } /* * i2c setup */ NAN_METHOD(i2c_begin) { bcm2835_i2c_begin(); } NAN_METHOD(i2c_set_clock_divider) { if ((info.Length() != 1) || (!info[0]->IsNumber())) return ThrowTypeError("Incorrect arguments"); bcm2835_i2c_setClockDivider(info[0]->NumberValue()); } NAN_METHOD(i2c_set_baudrate) { if ((info.Length() != 1) || (!info[0]->IsNumber())) return ThrowTypeError("Incorrect arguments"); bcm2835_i2c_set_baudrate(info[0]->NumberValue()); } NAN_METHOD(i2c_set_slave_address) { if ((info.Length() != 1) || (!info[0]->IsNumber())) return ThrowTypeError("Incorrect arguments"); bcm2835_i2c_setSlaveAddress(info[0]->NumberValue()); } NAN_METHOD(i2c_end) { bcm2835_i2c_end(); } /* * i2c read/write. The underlying bcm2835_i2c_read/bcm2835_i2c_write functions * do not return the number of bytes read/written, only a status code. The JS * layer handles ensuring that the buffer is large enough to accommodate the * requested length. */ NAN_METHOD(i2c_read) { uint8_t rval; if ((info.Length() != 2) || (!info[0]->IsObject()) || (!info[1]->IsNumber())) return ThrowTypeError("Incorrect arguments"); rval = bcm2835_i2c_read(node::Buffer::Data(info[0]->ToObject()), info[1]->NumberValue()); info.GetReturnValue().Set(rval); } NAN_METHOD(i2c_write) { uint8_t rval; if ((info.Length() != 2) || (!info[0]->IsObject()) || (!info[1]->IsNumber())) return ThrowTypeError("Incorrect arguments"); rval = bcm2835_i2c_write(node::Buffer::Data(info[0]->ToObject()), info[1]->NumberValue()); info.GetReturnValue().Set(rval); } /* * PWM functions */ NAN_METHOD(pwm_set_clock) { if ((info.Length() != 1) || (!info[0]->IsNumber())) return ThrowTypeError("Incorrect arguments"); bcm2835_pwm_set_clock(info[0]->NumberValue()); } NAN_METHOD(pwm_set_mode) { if ((info.Length() != 3) || (!info[0]->IsNumber()) || (!info[1]->IsNumber()) || (!info[2]->IsNumber())) return ThrowTypeError("Incorrect arguments"); bcm2835_pwm_set_mode(info[0]->NumberValue(), info[1]->NumberValue(), info[2]->NumberValue()); } NAN_METHOD(pwm_set_range) { if ((info.Length() != 2) || (!info[0]->IsNumber()) || (!info[1]->IsNumber())) return ThrowTypeError("Incorrect arguments"); bcm2835_pwm_set_range(info[0]->NumberValue(), info[1]->NumberValue()); } NAN_METHOD(pwm_set_data) { if ((info.Length() != 2) || (!info[0]->IsNumber()) || (!info[1]->IsNumber())) return ThrowTypeError("Incorrect arguments"); bcm2835_pwm_set_data(info[0]->NumberValue(), info[1]->NumberValue()); } /* * SPI functions. */ NAN_METHOD(spi_begin) { bcm2835_spi_begin(); } NAN_METHOD(spi_chip_select) { if ((info.Length() != 1) || (!info[0]->IsNumber())) return ThrowTypeError("Incorrect arguments"); bcm2835_spi_chipSelect(info[0]->NumberValue()); } NAN_METHOD(spi_set_cs_polarity) { if ((info.Length() != 2) || (!info[0]->IsNumber()) || (!info[1]->IsNumber())) return ThrowTypeError("Incorrect arguments"); bcm2835_spi_setChipSelectPolarity(info[0]->NumberValue(), info[1]->NumberValue()); } NAN_METHOD(spi_set_clock_divider) { if ((info.Length() != 1) || (!info[0]->IsNumber())) return ThrowTypeError("Incorrect arguments"); bcm2835_spi_setClockDivider(info[0]->NumberValue()); } NAN_METHOD(spi_set_data_mode) { if ((info.Length() != 1) || (!info[0]->IsNumber())) return ThrowTypeError("Incorrect arguments"); bcm2835_spi_setDataMode(info[0]->NumberValue()); } NAN_METHOD(spi_transfer) { if ((info.Length() != 3) || (!info[0]->IsObject()) || (!info[1]->IsObject()) || (!info[2]->IsNumber())) return ThrowTypeError("Incorrect arguments"); bcm2835_spi_transfernb(node::Buffer::Data(info[0]->ToObject()), node::Buffer::Data(info[1]->ToObject()), info[2]->NumberValue()); } NAN_METHOD(spi_write) { if ((info.Length() != 2) || (!info[0]->IsObject()) || (!info[1]->IsNumber())) return ThrowTypeError("Incorrect arguments"); bcm2835_spi_writenb(node::Buffer::Data(info[0]->ToObject()), info[1]->NumberValue()); } NAN_METHOD(spi_end) { bcm2835_spi_end(); } /* * Initialize the bcm2835 interface and check we have permission to access it. */ NAN_METHOD(rpio_init) { if ((info.Length() != 1) || (!info[0]->IsNumber())) return ThrowTypeError("Incorrect arguments"); if (!bcm2835_init(info[0]->NumberValue())) return ThrowError("Could not initialize bcm2835 GPIO library"); } NAN_METHOD(rpio_close) { bcm2835_close(); } /* * Misc functions useful for simplicity */ NAN_METHOD(rpio_usleep) { if ((info.Length() != 1) || (!info[0]->IsNumber())) return ThrowTypeError("Incorrect arguments"); usleep(info[0]->NumberValue()); } NAN_MODULE_INIT(setup) { NAN_EXPORT(target, rpio_init); NAN_EXPORT(target, rpio_close); NAN_EXPORT(target, rpio_usleep); NAN_EXPORT(target, gpio_function); NAN_EXPORT(target, gpio_read); NAN_EXPORT(target, gpio_readbuf); NAN_EXPORT(target, gpio_write); NAN_EXPORT(target, gpio_writebuf); NAN_EXPORT(target, gpio_pad_read); NAN_EXPORT(target, gpio_pad_write); NAN_EXPORT(target, gpio_pud); NAN_EXPORT(target, gpio_event_set); NAN_EXPORT(target, gpio_event_poll); NAN_EXPORT(target, gpio_event_clear); NAN_EXPORT(target, i2c_begin); NAN_EXPORT(target, i2c_set_clock_divider); NAN_EXPORT(target, i2c_set_baudrate); NAN_EXPORT(target, i2c_set_slave_address); NAN_EXPORT(target, i2c_end); NAN_EXPORT(target, i2c_read); NAN_EXPORT(target, i2c_write); NAN_EXPORT(target, pwm_set_clock); NAN_EXPORT(target, pwm_set_mode); NAN_EXPORT(target, pwm_set_range); NAN_EXPORT(target, pwm_set_data); NAN_EXPORT(target, spi_begin); NAN_EXPORT(target, spi_chip_select); NAN_EXPORT(target, spi_set_cs_polarity); NAN_EXPORT(target, spi_set_clock_divider); NAN_EXPORT(target, spi_set_data_mode); NAN_EXPORT(target, spi_transfer); NAN_EXPORT(target, spi_write); NAN_EXPORT(target, spi_end); } NODE_MODULE(rpio, setup) <|start_filename|>nodejs/node_modules/speaker/deps/mpg123/src/output/esd.c<|end_filename|> /* esd: audio output for ESounD (highly untested nowadays (?)) copyright ?-2006 by the mpg123 project - free software under the terms of the LGPL 2.1 see COPYING and AUTHORS files in distribution or http://mpg123.org initially written by <NAME> ("esd port" should be this file...) */ /* First the common header, including config.h ...this is important for stuff like _FILE_OFFSET_BITS */ #include "mpg123app.h" #include <esd.h> #include <errno.h> #include <assert.h> #ifdef SOLARIS #include <stropts.h> #include <sys/conf.h> #endif #ifdef NETBSD #include <sys/ioctl.h> #include <sys/audioio.h> #endif #include "debug.h" static unsigned esd_rate = 0, esd_format = 0, esd_channels = 0; static int open_esound(audio_output_t *ao) { esd_format_t format = ESD_STREAM | ESD_PLAY; if (!esd_rate) { int esd; esd_server_info_t *info; esd_format_t fmt; if ((esd = esd_open_sound(NULL)) >= 0) { info = esd_get_server_info(esd); esd_rate = info->rate; fmt = info->format; esd_free_server_info(info); esd_close(esd); } else { esd_rate = esd_audio_rate; fmt = esd_audio_format; } esd_format = MPG123_ENC_UNSIGNED_8; if ((fmt & ESD_MASK_BITS) == ESD_BITS16) esd_format |= MPG123_ENC_SIGNED_16; esd_channels = fmt & ESD_MASK_CHAN; } if (ao->format == -1) ao->format = esd_format; else if (!(ao->format & esd_format)) { error1("Unsupported audio format: %d\n", ao->format); errno = EINVAL; return -1; } if (ao->format & MPG123_ENC_SIGNED_16) format |= ESD_BITS16; else if (ao->format & MPG123_ENC_UNSIGNED_8) format |= ESD_BITS8; else assert(0); if (ao->channels == -1) ao->channels = 2; else if (ao->channels <= 0 || ao->channels > esd_channels) { error1("Unsupported no of channels: %d\n", ao->channels); errno = EINVAL; return -1; } if (ao->channels == 1) format |= ESD_MONO; else if (ao->channels == 2) format |= ESD_STEREO; else assert(0); if (ao->rate == -1) ao->rate = esd_rate; else if (ao->rate > esd_rate) return -1; ao->fn = esd_play_stream_fallback(format, ao->rate, ao->device, "mpg123"); return (ao->fn); } static int get_formats_esound (audio_output_t *ao) { if (0 < ao->channels && ao->channels <= esd_channels && 0 < ao->rate && ao->rate <= esd_rate) { return esd_format; } else { return -1; } } static int write_esound(audio_output_t *ao,unsigned char *buf,int len) { return write(ao->fn,buf,len); } static int close_esound(audio_output_t *ao) { close (ao->fn); return 0; } #ifdef SOLARIS static void flush_esound (audio_output_t *ao) { ioctl (ao->fn, I_FLUSH, FLUSHRW); } #else #ifdef NETBSD static void flush_esound (audio_output_t *ao) { ioctl (ao->fn, AUDIO_FLUSH, 0); } #else /* Dunno what to do on Linux and Cygwin, but the func must be at least defined! */ static void flush_esound (audio_output_t *ao) { } #endif #endif static int init_esound(audio_output_t* ao) { if (ao==NULL) return -1; /* Set callbacks */ ao->open = open_esound; ao->flush = flush_esound; ao->write = write_esound; ao->get_formats = get_formats_esound; ao->close = close_esound; /* Success */ return 0; } /* Module information data structure */ mpg123_module_t mpg123_output_module_info = { /* api_version */ MPG123_MODULE_API_VERSION, /* name */ "esd", /* description */ "Output audio using ESounD (The Enlightened Sound Daemon).", /* revision */ "$Rev: 1698 $", /* handle */ NULL, /* init_output */ init_esound, }; <|start_filename|>nodejs/node_modules/speaker/deps/mpg123/src/genre.h<|end_filename|> /* genre: id3 genre definition copyright ?-2007 by the mpg123 project - free software under the terms of the LGPL 2.1 see COPYING and AUTHORS files in distribution or http://mpg123.org initially written by <NAME> */ #ifndef _MPG123_GENRE_H_ #define _MPG123_GENRE_H_ extern char *genre_table[]; extern const int genre_count; #endif
qcuong98/KT-AI-Hackathon
<|start_filename|>vendor/assets/javascripts/pdf.js/viewer_before.js<|end_filename|> // This is a manifest file that'll be compiled into application // listed below. // // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path. // // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the // compiled file. // // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details // about supported directives. // //= require ./web/compatibility //= require ./external/webL10n/l10n //= require ./shared/util //= require ./display/api //= require ./display/metadata //= require ./display/canvas //= require ./display/webgl //= require ./display/pattern_helper //= require ./display/font_loader //= require ./display/annotation_helper <|start_filename|>app/assets/javascripts/application.js<|end_filename|> // This is a manifest file that'll be compiled into application.js, which will include all the files // listed below. // // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path. // // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the // compiled file. // // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details // about supported directives. // //= require jquery //= require jquery-ujs //= require pdfjs-dist //= require pdfjs-dist/build/pdf.worker //= require ev-emitter //= require desandro-matches-selector //= require fizzy-ui-utils //= require get-size //= require outlayer/item //= require outlayer //= require masonry //= require materialize //= require typeahead.js/dist/typeahead.bundle //= require materialize-tags/dist/js/materialize-tags //= require app <|start_filename|>vendor/assets/javascripts/pdf.js/viewer_after.js<|end_filename|> // This is a manifest file that'll be compiled into application // listed below. // // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path. // // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the // compiled file. // // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details // about supported directives. // //= require ./web/ui_utils //= require ./web/default_preferences //= require ./web/preferences //= require ./web/download_manager //= require ./web/view_history //= require ./web/pdf_link_service //= require ./web/pdf_rendering_queue //= require ./web/pdf_page_view //= require ./web/text_layer_builder //= require ./web/annotations_layer_builder //= require ./web/pdf_viewer //= require ./web/pdf_thumbnail_view //= require ./web/pdf_thumbnail_viewer //= require ./web/pdf_outline_view //= require ./web/pdf_attachment_view //= require ./web/pdf_find_bar //= require ./web/pdf_find_controller //= require ./web/pdf_history //= require ./web/secondary_toolbar //= require ./web/pdf_presentation_mode //= require ./web/grab_to_pan //= require ./web/hand_tool //= require ./web/overlay_manager //= require ./web/password_prompt //= require ./web/pdf_document_properties //= require ./web/debugger //= require ./web/viewer <|start_filename|>app/assets/javascripts/app.js.coffee<|end_filename|> $ -> # img の height を可変にしたいので $(window).on "load", -> if $(".grid").length > 0 new Masonry(".grid", { itemSelector: ".grid-item", columnWidth: 250, gutter: 10, fitWidth: true } ) $(".datepicker").pickadate( monthsFull: ["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"], monthsShort: ["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"], format: "yyyy-mm-dd", selectYears: true, selectMonths: true, clear: false ) $('.modal').modal()
onk/sharedoc
<|start_filename|>package.json<|end_filename|> { "name": "stylish-log", "version": "1.0.5", "description": "A beautiful way to see your web console logs", "main": "stylish-log.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, "repository": { "type": "git", "url": "git+https://github.com/jotavejv/stylish-log.git" }, "keywords": [ "console.log", "log", "debug", "console", "logg", "style" ], "author": "jotavejv", "license": "MIT", "bugs": { "url": "https://github.com/jotavejv/stylish-log/issues" }, "homepage": "https://github.com/jotavejv/stylish-log#readme" } <|start_filename|>stylish-log.js<|end_filename|> /*! * Stylish-log * @copyright <NAME> | jotavejv <<EMAIL>> * @license MIT */ 'use strict'; const styles = { default: 'color: gray; font-weight: bold;', info: 'color: blue; font-weight: bold;', warn: 'color: #ffc107;', danger: 'color: lightcoral; font-weight: bold;' } const logg = console.log; function print(style, texts) { let bindArgs = [console]; for (let text of texts) { if (typeof text === "string" && bindArgs.length === 1) { bindArgs.push('%c ' + text, style); } else { bindArgs.push(text); } } return logg.bind(...bindArgs); } let log = { styles, show (...texts) { return print(styles.default, texts); }, info (...texts) { return print(styles.info, texts); }, warn (...texts) { return print(styles.warn, texts); }, danger (...texts) { return print(styles.danger, texts); } }; module.exports = stylishLog;
jotavejv/logg
<|start_filename|>test/mcd_cluster_tests.erl<|end_filename|> -module(mcd_cluster_tests). -include_lib("eunit/include/eunit.hrl"). -define(NAME, mb_test). -define(setup(F), {setup, fun setup/0, fun cleanup/1, F}). all_test_() -> [{"Check MCD cluster", ?setup(fun() -> [check_node_(), add_node_(), check_node_2_(), add_node_dup_(), check_node_2_(), del_node_(), check_node_(), add_node_list_(), check_node_3_(), del_node_list_(), check_node_(), del_node_non_exists_(), check_node_()] end)}]. setup() -> ?assertMatch({ok, _Pid}, mcd_cluster:start_link(?NAME, [{localhost, ["localhost", 2222], 10}])). cleanup(_) -> ?assertEqual({ok, stopped}, mcd_cluster:stop(?NAME)). check_node_() -> ?assertMatch([{localhost, _}], mcd_cluster:nodes(?NAME)). check_node_2_() -> ?assertMatch([{localhost, _}, {localhost2, _}], mcd_cluster:nodes(?NAME)). check_node_3_() -> ?assertMatch([{localhost, _}, {localhost2, _}, {localhost3, _}], mcd_cluster:nodes(?NAME)). add_node_() -> ?assertEqual(ok, mcd_cluster:add(?NAME, {localhost2, ["localhost2", 2222], 10})). add_node_dup_() -> ?assertEqual({error, already_there, [localhost]}, mcd_cluster:add(?NAME, {localhost, ["localhost", 2222], 10})). add_node_list_() -> ?assertEqual(ok, mcd_cluster:add(?NAME, [{localhost2, ["localhost2", 2222], 10}, {localhost3, ["localhost3", 2222], 10}])). del_node_() -> ?assertEqual(ok, mcd_cluster:delete(?NAME, localhost2)). del_node_list_() -> ?assertEqual(ok, mcd_cluster:delete(?NAME, [localhost2, localhost3])). del_node_non_exists_() -> ?assertEqual({error, unknown_nodes, [localhost2]}, mcd_cluster:delete(mb_test, localhost2)). <|start_filename|>test/mcd_SUITE.erl<|end_filename|> %%% vim: set ts=4 sts=4 sw=4 et: -module(mcd_SUITE). -include_lib("common_test/include/ct.hrl"). -export([ all/0, init_per_suite/1, end_per_suite/1 ]). -export([ test_local/1, test_do/1, test_api/1, test_common_errors/1 ]). -define(BUCKET, test). -define(KEY, list_to_binary(?MODULE_STRING ++ "_" ++ "key")). -define(VALUE, <<"value">>). -define(TTL, 1). all() -> [ test_local, test_do, test_api, test_common_errors ]. init_per_suite(Config) -> ok = application:start(dht_ring), ok = application:set_env(mcd, mcd_hosts, [{localhost, ["localhost"]}]), ok = application:set_env(mcd, mcd_buckets, [ {mcd:lserver(), {localhost, 11211}}, {?BUCKET, {localhost, 11211}} ]), ok = application:start(mcd), ok = mcd_test_helper:wait_all(), Config. end_per_suite(_Config) -> ok = application:stop(mcd), ok = application:stop(dht_ring). % Tests test_do(_Config) -> {ok, [_ | _]} = mcd:do(?BUCKET, version), {ok, flushed} = mcd:do(?BUCKET, flush_all), {ok, flushed} = mcd:do(?BUCKET, {flush_all, 10}), {error, notfound} = mcd:do(?BUCKET, get, ?KEY), {error, notfound} = mcd:do(?BUCKET, delete, ?KEY), try {ok, ?VALUE} = mcd:do(?BUCKET, set, ?KEY, ?VALUE), {error, notstored} = mcd:do(?BUCKET, add, ?KEY, ?VALUE), {ok, ?VALUE} = mcd:do(?BUCKET, replace, ?KEY, ?VALUE), {ok, ?VALUE} = mcd:do(?BUCKET, {set, 0, ?TTL}, ?KEY, ?VALUE), {error, notstored} = mcd:do(?BUCKET, {add, 0, ?TTL}, ?KEY, ?VALUE), {ok, ?VALUE} = mcd:do(?BUCKET, {replace, 0, ?TTL}, ?KEY, ?VALUE), {ok, deleted} = mcd:do(?BUCKET, delete, ?KEY) after mcd:do(?BUCKET, delete, ?KEY) end. test_api(_Config) -> {ok, [_ | _]} = mcd:version(?BUCKET), GetFun = fun() -> mcd:get(?BUCKET, ?KEY) end, DeleteFun = fun() -> mcd:delete(?BUCKET, ?KEY) end, test_set(GetFun, DeleteFun, fun() -> mcd:set(?BUCKET, ?KEY, ?VALUE) end), test_set_expiration(GetFun, DeleteFun, fun() -> mcd:set(?BUCKET, ?KEY, ?VALUE, ?TTL) end), test_set_expiration(GetFun, DeleteFun, fun() -> mcd:set(?BUCKET, ?KEY, ?VALUE, ?TTL, 0) end), test_set(GetFun, DeleteFun, fun() -> {ok, mcd:async_set(?BUCKET, ?KEY, ?VALUE)} end), test_set_expiration(GetFun, DeleteFun, fun() -> {ok, mcd:async_set(?BUCKET, ?KEY, ?VALUE, ?TTL)} end), test_set_expiration(GetFun, DeleteFun, fun() -> {ok, mcd:async_set(?BUCKET, ?KEY, ?VALUE, ?TTL, 0)} end). test_common_errors(_Config) -> {_, Pid} = hd(mcd_cluster:nodes(?BUCKET)), {error, timeout} = mcd:version(self()), {error, noproc} = mcd:version(undefined), {ok, [_ | _]} = mcd:version(Pid), {error, not_broken} = mcd:fix_connection(Pid), ok = mcd:break_connection(Pid), try {error, noconn} = mcd:version(Pid) after ok = mcd:fix_connection(Pid), ok = mcd_test_helper:wait_connection(Pid) end, {ok, [_ | _]} = mcd:version(Pid), {error, not_overloaded} = mcd:unload_connection(Pid), ok = mcd:overload_connection(Pid), try {error, overload} = mcd:version(Pid) after ok = mcd:unload_connection(Pid) end, {ok, [_ | _]} = mcd:version(Pid). test_local(_Config) -> GetFun = fun() -> mcd:lget(?KEY) end, DeleteFun = fun() -> mcd:ldelete(?KEY) end, test_set(GetFun, DeleteFun, fun() -> mcd:lset(?KEY, ?VALUE) end), test_set_expiration(GetFun, DeleteFun, fun() -> mcd:lset(?KEY, ?VALUE, ?TTL) end), {error, notfound} = mcd:lget(?KEY), try {ok, ?VALUE} = mcd:lset(?KEY, ?VALUE), {ok, flushed} = mcd:lflush_all(), {error, notfound} = mcd:lget(?KEY) after mcd:ldelete(?KEY) end. % private functions test_set(GetFun, DeleteFun, SetFun) -> {error, notfound} = GetFun(), try {ok, ?VALUE} = SetFun(), {ok, ?VALUE} = GetFun(), {ok, deleted} = DeleteFun(), {error, notfound} = GetFun() after DeleteFun() end. test_set_expiration(GetFun, DeleteFun, SetFun) -> {error, notfound} = GetFun(), try {ok, ?VALUE} = SetFun(), {ok, ?VALUE} = GetFun(), timer:sleep((?TTL + 1) * 1000), {error, notfound} = GetFun() after DeleteFun() end. <|start_filename|>src/mcd_cluster_sup.erl<|end_filename|> %%% vim: ts=4 sts=4 sw=4 expandtab: -module(mcd_cluster_sup). -behaviour(supervisor). -export([init/1]). -export([ start_link/0, reconfigure/0, children_specs/1 ]). % For selftesing -export([ buckets/0 ]). -define(WEIGHT, 200). %% ========================================================== %% API functions %% ========================================================== start_link() -> supervisor:start_link({local, ?MODULE}, ?MODULE, mcd_cluster). children_specs({?MODULE, start_link, []}) -> superman:get_child_specs(?MODULE, mcd_cluster); children_specs({supervisor, start_link, [_, _, {supervisor, Spec}]}) -> superman:get_child_specs(?MODULE, {supervisor, Spec}). reconfigure() -> superman:reconfigure_supervisor_tree_init_args(?MODULE, mcd_cluster). %% ========================================================== %% Supervisor callbacks %% ========================================================== init(mcd_cluster) -> Specs = [cluster_supervisor_spec(C) || C <- clusters()], {ok, {{one_for_one, 10, 10}, Specs}}; init({supervisor, Cluster}) -> lager:info("Starting membase supervisor for ~p cluster", [Cluster]), {ok, {{one_for_one, 10, 10}, [bucket_spec(B) || B <- buckets_by_cluster(Cluster)]}}. %% ========================================================== %% Internal functions %% ========================================================== mcd_bucket(B) -> {ok, Bs} = application:get_env(mcd, mcd_buckets), proplists:get_value(B, Bs). mcd_cluster(C) -> {ok, Cs} = application:get_env(mcd, mcd_hosts), proplists:get_value(C, Cs). buckets() -> {ok, Bs} = application:get_env(mcd, mcd_buckets), lists:usort([B || {B, _} <- Bs]). clusters() -> lists:usort([cluster_by_bucket(B) || B <- buckets()]). cluster_by_bucket(Bucket) -> {Cluster, _Port} = mcd_bucket(Bucket), Cluster. buckets_by_cluster(Cluster) -> [Bucket || Bucket <- buckets(), Cluster == cluster_by_bucket(Bucket)]. cluster_supervisor_spec(Cluster) -> Name = cluster_name(Cluster), {Cluster, {supervisor, start_link, [{local, Name}, ?MODULE, {supervisor, Cluster}]}, permanent, infinity, supervisor, [mcd_cluster_sup]}. bucket_spec(Bucket) -> {Cluster, Port} = mcd_bucket(Bucket), Nodes = mcd_cluster(Cluster), Peers = [{list_to_atom(Node), [Node, Port], ?WEIGHT} || Node <- Nodes], {Bucket, {mcd_cluster, start_link, [Bucket, Peers]}, permanent, 60000, worker, [mcd_cluster]}. cluster_name(Cluster) -> list_to_atom("mcd_cluster_" ++ atom_to_list(Cluster) ++ "_sup"). <|start_filename|>test/mcd_cluster_SUITE.erl<|end_filename|> %%% vim: set ts=4 sts=4 sw=4 expandtab: -module(mcd_cluster_SUITE). -include_lib("common_test/include/ct.hrl"). -export([ all/0, init_per_suite/1, end_per_suite/1 ]). -export([ test_noconn/1, test_all_nodes_down/1 ]). all() -> [ test_noconn, test_all_nodes_down ]. init_per_suite(Config) -> ok = application:start(dht_ring), ok = application:set_env(mcd, mcd_hosts, [{localhost, ["localhost"]}]), ok = application:set_env(mcd, mcd_buckets, [ {host1, {localhost, 11211}}, {host2, {localhost, 11211}} ]), ok = application:start(mcd), ok = mcd_test_helper:wait_all(), Config. end_per_suite(_Config) -> ok = application:stop(mcd), ok = application:stop(dht_ring). % Tests test_noconn(_Config) -> [begin [{NodeName, Pid} | _] = mcd_cluster:nodes(Bucket), io:format("Checking bucket: ~p, NodeName: ~p~n", [Bucket, NodeName]), false = lists:member(Pid, gen_server:call(Bucket, get_pids_down)), io:format("Ok. Node is UP~n"), ok = mcd:break_connection(Pid), try {error, noconn} = mcd:version(Pid), timer:sleep(100), true = lists:member(Pid, gen_server:call(Bucket, get_pids_down)), io:format("Ok. Node is marked as down~n") after ok = mcd:fix_connection(Pid), ok = mcd_test_helper:wait_connection(Pid) end, {ok, _} = mcd:version(Pid), false = lists:member(Pid, gen_server:call(Bucket, get_pids_down)), io:format("Ok. Node is marked as up~n") end || Bucket <- mcd_cluster_sup:buckets()]. test_all_nodes_down(_Config) -> Bucket = hd(mcd_cluster_sup:buckets()), Pids = [Pid || {_, Pid} <- mcd_cluster:nodes(Bucket)], [ok = mcd:break_connection(Pid) || Pid <- Pids], try {error, all_nodes_down} = mcd:version(Bucket) after [ok = mcd:fix_connection(Pid) || Pid <- Pids], [ok = mcd_test_helper:wait_connection(Pid) || Pid <- Pids] end.
fakeNetflix/pinterest-repo-mcd
<|start_filename|>src/util/WickedLasers.cpp<|end_filename|> #include "WickedLasers.h" #include "globals.h" #include "ofxNative.h" #include "LaserdockDeviceManager.h" #include "LaserdockDevice.h" typedef bool (LaserdockDevice::* ReadMethodPtr)(uint32_t*); const uint32_t laser_samples_per_packet = 64; #define ANI_SPEED 5 #define EPS 1E-6 #pragma mark WickedLasersSettingsView #pragma mark Osci WickedLasers::WickedLasers() :bufferSize(512) { laserSamples = (LaserdockSample*)calloc(sizeof(LaserdockSample), laser_samples_per_packet); connected = false; left.loop = false; right.loop = false; left.play(); right.play(); int err = 0; resampleState = src_new(SRC_SINC_FASTEST, 2, &err); resampleThread = thread([&]() {ofxNative::setThreadName("resampling"); processIncomming(); }); resampleThread.detach(); ofAddListener(ofEvents().update, this, &WickedLasers::of_update, OF_EVENT_ORDER_BEFORE_APP); ofAddListener(ofEvents().exit, this, &WickedLasers::of_exit, OF_EVENT_ORDER_BEFORE_APP); } WickedLasers::~WickedLasers() { disconnect(); src_delete(resampleState); free(laserSamples); } //-------------------------------------------------------------- void WickedLasers::addBuffer(float* buffer, int bufferSize, int nChannels, int sampleRate) { this->sampleRate = sampleRate; int pos = 0; const int chunkSize = 256; float temp[2 * chunkSize]; // stereo while (pos < bufferSize) { int len = min(bufferSize - pos, chunkSize); AudioAlgo::copy(temp + 0, 2, buffer + nChannels * pos + 0, nChannels, len); AudioAlgo::copy(temp + 1, 2, buffer + nChannels * pos + 1, nChannels, len); incomming.append(temp, len * 2); pos += len; } } void WickedLasers::die() { exiting = true; if(resampleThread.joinable()) resampleThread.join(); } void WickedLasers::processIncomming() { while (!exiting) { bool didNothing = true; if (shouldResetBuffers) { shouldResetBuffers = false; auto sz = min(left.totalLength, right.totalLength ); left.peel(sz); right.peel(sz); sz = incomming.totalLength / 2; incomming.peel(2 * sz); } if (!connected && incomming.totalLength > 0) { incomming.clear(); ofSleepMillis(1); continue; } int n; float* buffer = incomming.peekHead(n); if (n > 0) { didNothing = false; visualSampleRate = 60000; double ratio = visualSampleRate / (double)sampleRate; if (targetBuffer.size() < visualSampleRate) targetBuffer.resize(visualSampleRate, 0); auto run_resample = [ratio](float* buffer, int num_frames, float* buffer_out, int num_out_frames, SRC_STATE* resampleState, SRC_DATA& resampleData) { src_set_ratio(resampleState, ratio); resampleData.data_in = buffer; resampleData.input_frames = num_frames; resampleData.data_out = buffer_out; resampleData.output_frames = num_out_frames; resampleData.src_ratio = ratio; resampleData.end_of_input = 0; int res = src_process(resampleState, &resampleData); }; run_resample(buffer, n / 2, &targetBuffer.front(), visualSampleRate / 2, resampleState, resampleData); left.append(&targetBuffer.front(), resampleData.output_frames_gen, 2); right.append(&targetBuffer.front() + 1, resampleData.output_frames_gen, 2); incomming.removeHead(); } // copy to laser: // if(scale_arg) buff.scale = args::get(scale_arg); // if(brightness_arg) buff.brightness = args::get(brightness_arg); while (left.totalLength > laser_samples_per_packet) { didNothing = false; float leftBuff[laser_samples_per_packet]; float rightBuff[laser_samples_per_packet]; left.velocity = globals.laserSize; right.velocity = globals.laserSize; left.playbackIndex = 0; right.playbackIndex = 0; left.play(); right.play(); left.copyTo(leftBuff, 1, laser_samples_per_packet); right.copyTo(rightBuff, 1, laser_samples_per_packet); left.peel(laser_samples_per_packet); right.peel(laser_samples_per_packet); lock_guard<mutex> guard(laserDeviceMutex); if (connected) { laser_fill_samples(laserSamples, laser_samples_per_packet, leftBuff, rightBuff); laserDevice->send_samples(laserSamples, laser_samples_per_packet); } } if (didNothing) { ofSleepMillis(2); } } disconnect(); } //-------------------------------------------------------------- void WickedLasers::of_update(ofEventArgs& args) { // ui hidden? if (!connected) { while (left.totalLength >= bufferSize && right.totalLength >= bufferSize) { left.peel(bufferSize); right.peel(bufferSize); } return; } } void WickedLasers::of_exit(ofEventArgs& args) { disconnect(); exiting = true; } void WickedLasers::laser_fill_samples(LaserdockSample* samples, const uint32_t count, float* left, float* right) { if (count == 0) return; // rg = 0x4F4F; // b = 0xFF4F; for (uint32_t i = 0; i < count; i++) { const float limit = 1.0; float fx = ofClamp(left[i], -limit, limit); float fy = ofClamp(right[i], -limit, limit); float sx = ofMap(fy, -1, 1, 1 - globals.laserKeystoneY, 1 + globals.laserKeystoneY, true); float sy = ofMap(fx, -1, 1, 1 - globals.laserKeystoneX, 1 + globals.laserKeystoneX, true); fx *= sx; fx *= sy; fx += globals.laserOffsetX; fy += globals.laserOffsetY; uint16_t x = float_to_laserdock_xy(ofClamp(fx,-1,1)); uint16_t y = float_to_laserdock_xy(ofClamp(fy,-1,1)); float h = globals.hue; ofFloatColor color = h == 360 ? ofFloatColor(1, 1, 1) : ofFloatColor::fromHsb(h / 360.0, 1, 1); uint16_t cr = color.r * globals.laserIntensity * 255; uint16_t cg = color.g * globals.laserIntensity * 255; uint16_t cb = color.b * globals.laserIntensity * 255; uint16_t rg, b; rg = (cg << 8) | cr; b = 0xFF00 | cb; samples[i].x = x; samples[i].y = y; samples[i].rg = rg; samples[i].b = b; } } void WickedLasers::connect() { disconnect(); lock_guard<mutex> guard(laserDeviceMutex); cout << ("Connecting ...") << std::endl; laserDevice = shared_ptr<LaserdockDevice>(LaserdockDeviceManager::getInstance().get_next_available_device()); if (laserDevice) { laserDevice->set_dac_rate(60000); cout << ("connected with 60kbps") << std::endl; shouldResetBuffers = true; connected = true; globals.laserConnected = true; } else { #if defined(TARGET_LINUX) string cmd = "sudo echo ATTRS{idVendor}==\\\"0x1fc9\\\", ATTRS{idProduct}==\\\"0x04d8\\\", TAG+=\\\"uaccess\\\", ENV{ID_MM_DEVICE_IGNORE}=\\\"1\\\" >/etc/udev/rules.d/70-laserdock-dongle"; ofGetWindowPtr()->setClipboardString(cmd); ofSystemAlertDialog("No laserdock device found. \n\nPlease run Oscilloscope as root, \nor add udev rules for libusb (vendor=0x1fc9, product=0x04d8)"); #elif defined(_WIN32) string url = "https://oscilloscopemusic.com/downloads/laserdock-driver.zip"; ofGetWindowPtr()->setClipboardString(url); ofSystemAlertDialog("No laserdock device found. \n\Please install the driver from\n " + url + "\n\n(url copied to clipboard)"); #else ofSystemAlertDialog("No laserdock device found."); #endif connected = false; globals.laserConnected = false; } } void WickedLasers::disconnect() { lock_guard<mutex> guard(laserDeviceMutex); if (connected) { cout << ("Disconnecting ...") << std::endl; connected = false; laserDevice = nullptr; globals.laserConnected = false; } globals.laserConnected = false; } bool WickedLasers::isConnected() { return connected; } void WickedLasers::resetBuffers() { shouldResetBuffers = true; } <|start_filename|>src/version.h<|end_filename|> // // version.h // oscilloscope // // Created by Hansi on 21.09.20. // #ifndef version_h #define version_h const static string app_version = "1.1.0"; #endif /* version_h */ <|start_filename|>src/util/WickedLasers.h<|end_filename|> #pragma once #include "ofxMightyUI.h" #include "util/Audio.h" #include "samplerate.h" #include "OsciMesh.h" class CircleBuffer; class LaserdockDevice; struct LaserdockSample; class WickedLasers { public: WickedLasers(); virtual ~WickedLasers(); void addBuffer(float* buffer, int bufferSize, int nChannels, int sampleRate); void die(); int bufferSize; MonoSample left; MonoSample right; float lx, ly; float s; void connect(); void disconnect(); bool isConnected(); void resetBuffers(); private: void processIncomming(); void laser_fill_samples(LaserdockSample* samples, const uint32_t count, float* left, float* right); void of_update(ofEventArgs& args); void of_exit(ofEventArgs& args); ofVec3f last; float intensity = 1.0; bool invertX = false; bool invertY = false; bool flipXY = false; shared_ptr<LaserdockDevice> laserDevice; LaserdockSample* laserSamples; // we leak this mutex laserDeviceMutex; int visualSampleRate = 60000; vector<float> targetBuffer; thread resampleThread; MonoSample incomming; static const int chunkSize = 1024; int sampleRate = 44100; SRC_STATE* resampleState; SRC_DATA resampleData; bool connected = false; bool shouldResetBuffers = false; bool exiting = false; }; <|start_filename|>src/ui/ConfigView.cpp<|end_filename|> #include "ConfigView.h" #include "../globals.h" #include "MuiL.h" #include "miniaudio.h" #include "../util/WickedLasers.h" ConfigView::ConfigView() : mui::Container(0,0, 500, 220){ bg = ofColor(125, 50); opaque = true; auto make_slider = [](float vmin, float vmax, float val, int dp) { mui::SliderWithLabel* slider = new mui::SliderWithLabel(0, 0, 200, 30, vmin, vmax, val, dp); slider->label->fg = ofColor(255); return slider; }; auto make_label = [](string text, mui::HorizontalAlign al = mui::Left) { mui::Label* label = new mui::Label(text, 0, 0, 200, 30); (al==mui::Left?label->inset.left:label->inset.right) = 5; label->horizontalAlign = al; return label; }; ofAddListener(ofEvents().messageEvent, this, &ConfigView::gotMessage); // pushLabel( "Audio Device"); outDevicePicker = new FDropdown<string>(0, 0, 300, 30); outDevicePicker->dataProvider = [&](FDropdown<string> * menu) { addDeviceOptions(); }; outDevicePicker->dataDisplay = [&](string name, string value) { if (value == "") return string("Default Output"); else return value; }; addDeviceOptions(); ofAddListener(outDevicePicker->menu->onSelectValue, this, &ConfigView::outDevicePickerChanged); add(outDevicePicker); emulationLabel = make_label("Visual Upsampling"); add(emulationLabel); emulationMode = new mui::SegmentedSelect<int>(0,0,200,30); auto lowChoice = emulationMode->addSegment("Off", 0); lowChoice->setProperty("tooltip", string("Disables upsampling. ")); auto highChoice = emulationMode->addSegment("On", 1); highChoice->setProperty("tooltip", string("Enables upsampling. This resembles an analog oscilloscope more closely. ")); emulationMode->equallySizedButtons = true; ofAddListener(emulationMode->onChangeValue, this, &ConfigView::emulationModeChanged); add(emulationMode); laserConnectLabel = make_label("Wickedlasers Ilda-Adapter"); add(laserConnectLabel); laserConnect = new mui::Button("Show config",0,0,100,30); laserConnect->setProperty("tooltip", string("Connect to a wickedlasers ilda-dongle or laserscanner")); ofAddListener(laserConnect->onPress, this, &ConfigView::buttonPressed); add(laserConnect); laserSizeLabel= make_label("Scale", mui::Right); add(laserSizeLabel); laserSize = make_slider(0, 1, 0.5, 2); laserSize->setProperty("tooltip", string("Size of laser output")); add(laserSize); laserIntensityLabel= make_label("Intensity", mui::Right); add(laserIntensityLabel); laserIntensity = make_slider(0, 1, 0, 2); add(laserIntensity); laserOffsetLabel = make_label("Offset", mui::Right); add(laserOffsetLabel); laserOffsetX = make_slider(-1, 1, 0, 2); add(laserOffsetX); laserOffsetY = make_slider(-1, 1, 0, 2); add(laserOffsetY); laserKeystoneLabel = make_label("Keystone", mui::Right); add(laserKeystoneLabel); laserKeystoneX = make_slider(-1, 1, 0, 2); add(laserKeystoneX); laserKeystoneY = make_slider(-1, 1, 0, 2); add(laserKeystoneY); hiddenLaserUi = { laserSizeLabel, laserSize, laserIntensityLabel, laserIntensity, laserOffsetLabel, laserOffsetX, laserOffsetY, laserKeystoneLabel, laserKeystoneX, laserKeystoneY }; for (auto c : hiddenLaserUi) c->visible = false; } //-------------------------------------------------------------- void ConfigView::update(){ auto check = [](float& val, mui::SliderWithLabel* s) { if (s->isMouseOver()) val = s->slider->value; else s->slider->value = val; }; check(globals.laserSize, laserSize); check(globals.laserIntensity, laserIntensity); check(globals.laserKeystoneX, laserKeystoneX); check(globals.laserKeystoneY, laserKeystoneY); check(globals.laserOffsetX, laserOffsetX); check(globals.laserOffsetY, laserOffsetY); } //-------------------------------------------------------------- void ConfigView::draw(){ } //-------------------------------------------------------------- void ConfigView::layout(){ float lw = 180; mui::L(outDevicePicker).posTL(5,5).stretchToRightEdgeOfParent(5); mui::L(emulationLabel).below(outDevicePicker,5); mui::L(emulationMode).rightOf(emulationLabel).alignRightEdgeTo(outDevicePicker); mui::L(laserConnectLabel).below(emulationLabel, 15).width(300); mui::L(laserConnect).rightOf(laserConnectLabel).alignRightEdgeTo(emulationMode); mui::L(laserSizeLabel).below(laserConnectLabel, 5).width(lw); mui::L(laserSize).rightOf(laserSizeLabel).stretchToRightEdgeOfParent(5); mui::L(laserIntensityLabel).below(laserSizeLabel).width(lw); mui::L(laserIntensity).rightOf(laserIntensityLabel).stretchToRightEdgeOfParent(5); mui::L(laserOffsetLabel).below(laserIntensityLabel).width(lw); mui::L(laserOffsetX).rightOf(laserOffsetLabel).stretchToRightEdgeOfParent(5); mui::L(laserOffsetY).below(laserOffsetX).stretchToRightEdgeOfParent(5); mui::L(laserKeystoneLabel).below(laserOffsetY).alignLeftEdgeTo(laserOffsetLabel).width(lw); mui::L(laserKeystoneX).rightOf(laserKeystoneLabel).stretchToRightEdgeOfParent(5); mui::L(laserKeystoneY).below(laserKeystoneX).stretchToRightEdgeOfParent(5); height = getChildBounds().getBottom() + 10; } //-------------------------------------------------------------- void ConfigView::touchDown( ofTouchEventArgs &touch ){ } //-------------------------------------------------------------- void ConfigView::touchMoved( ofTouchEventArgs &touch ){ } //-------------------------------------------------------------- void ConfigView::touchUp( ofTouchEventArgs &touch ){ } //-------------------------------------------------------------- void ConfigView::touchDoubleTap( ofTouchEventArgs &touch ){ } //-------------------------------------------------------------- void ConfigView::fromGlobals(){ outDevicePicker->setSelectedValue( globals.out_requested.name ); emulationMode->setSelected(globals.analogMode==0?0:1); } //-------------------------------------------------------------- void ConfigView::toGlobals(){ globals.out_requested.name = outDevicePicker->getSelectedValueOr(""); globals.analogMode = emulationMode->getSelectedValueOr(1); } //-------------------------------------------------------------- void ConfigView::pushLabel( string text ){ mui::Label * label = new mui::Label( text, 0, 0, 100, 12 ); label->fontSize = 8; add( label ); } //-------------------------------------------------------------- void ConfigView::buttonPressed( const void * sender, ofTouchEventArgs & args ){ if (sender == laserConnect) { if (!showLaserConfig) { for (auto c : hiddenLaserUi) c->visible = true; laserConnect->label->setText("Connect"); MUI_ROOT->handleLayout(); showLaserConfig = true; } else{ if (globals.laserConnected) { globals.laserPtr->disconnect(); } else { globals.laserPtr->connect(); } laserConnect->label->setText(globals.laserConnected ? "Disconnect" : "Connect"); } } } //-------------------------------------------------------------- void ConfigView::outDevicePickerChanged(const void * sender, string & value) { ofSendMessage("out-choice-changed"); } //-------------------------------------------------------------- void ConfigView::emulationModeChanged(const void * sender, int & value){ globals.analogMode = value; } //-------------------------------------------------------------- void ConfigView::gotMessage(const void * sender, ofMessage & msg) { } //-------------------------------------------------------------- void ConfigView::addDeviceOptions() { ma_context & context = *globals.context; ma_device_info* pPlaybackDeviceInfos; ma_uint32 playbackDeviceCount; ma_device_info* pCaptureDeviceInfos; ma_uint32 captureDeviceCount; ma_uint32 iDevice; ma_result result; result = ma_context_get_devices(&context, &pPlaybackDeviceInfos, &playbackDeviceCount, &pCaptureDeviceInfos, &captureDeviceCount); if (result != MA_SUCCESS) { printf("Failed to retrieve device information.\n"); return; } outDevicePicker->addOption("Default Output", ""); printf("Playback Devices\n"); for (iDevice = 0; iDevice < playbackDeviceCount; ++iDevice) { ma_device_info dev = pPlaybackDeviceInfos[iDevice]; ma_context_get_device_info(&context, ma_device_type_playback, &dev.id, ma_share_mode_shared, &dev); auto btn = outDevicePicker->addOption(dev.name, dev.name)->button; btn->setProperty<ma_device_info>(string("ma_device_info"), move(dev)); printf(" %u: %s\n", iDevice, pPlaybackDeviceInfos[iDevice].name); } } <|start_filename|>src/globals.h<|end_filename|> // // globals.h // Oscilloscope // // Created by Hansi on 26.07.15. // // #ifndef __Oscilloscope__globals__ #define __Oscilloscope__globals__ #include <stdio.h> #include "OsciAvAudioPlayer.h" #include "ofxIniSettings.h" extern string ofxToReadWriteableDataPath( string filename ); extern string ofxToReadonlyDataPath( string filename ); extern void setWindowRepresentedFilename( string filename ); string ofxFormatTime(double seconds); enum class ExportFormat{H264=1,IMAGE_SEQUENCE_PNG=2,IMAGE_SEQUENCE_TIFF=3}; class WickedLasers; struct ma_context; #define globals (Globals::instance) class Globals{ public: Globals(){}; void init(); struct AudioConfig { string name; int bufferSize; int sampleRate; }; ma_context * context; // audio settings AudioConfig out_requested{ "",0, 0 }; AudioConfig out_actual{ "",512, 44100 }; bool micActive{ false }; AudioConfig in_requested{ "",0, 0 }; AudioConfig in_actual{ "",512, 44100 }; // display settings float scale{1.0}; bool invertX{false}; bool invertY{false}; bool flipXY{false}; bool zModulation{true}; float strokeWeight{10}; // 1...20 float timeStretch{1}; // 0.1-2.0 float blur{30}; // 0...255 float intensity{0.4f}; // 0...1 float afterglow{0.5f}; // 0...1 int analogMode{0}; // 0=digital, 1=analog, 2=superanalog int numPts{20}; // 1...+inf? float hue{50}; // 0...360 float outputVolume{1}; float inputVolume{1}; int exportWidth{1920}; int exportHeight{1080}; int exportFrameRate{60}; ExportFormat exportFormat{ExportFormat::IMAGE_SEQUENCE_PNG}; float secondsBeforeHidingMenu{0.5}; bool alwaysOnTop{false}; // laser stuff. none of this is ever stored! shared_ptr<WickedLasers> laserPtr{nullptr}; bool laserConnected{ false }; float laserSize{ 0.5 }; float laserIntensity{ 0.0 }; float laserKeystoneX{ 0.0 }; float laserKeystoneY{ 0.0 }; float laserOffsetX{ 0.0 }; float laserOffsetY{ 0.0 }; void loadFromFile(string settingsFile = ofxToReadWriteableDataPath("settings.txt")); void saveToFile(string settingsFile = ofxToReadWriteableDataPath("settings.txt")); // runtime variables (not saved) OsciAvAudioPlayer player; size_t currentlyPlayingItem = 0; // the singleton thing static Globals instance; }; #endif /* defined(__Oscilloscope__globals__) */ <|start_filename|>src/globals.cpp<|end_filename|> // // globals.cpp // Oscilloscope // // Created by Hansi on 26.07.15. // // #include "globals.h" #include "util/WickedLasers.h" #include "util/miniaudio.h" Globals Globals::instance; void Globals::init() { laserPtr = make_shared<WickedLasers>(); context = new ma_context(); if (ma_context_init(NULL, 0, NULL, context) != MA_SUCCESS) { ofSystemAlertDialog("Failed to initialize audio context :("); } } string ofxFormatTime(double seconds) { int total = seconds; int s = total % 60; total = total / 60; int m = total % 60; total = total / 60; int h = total; return ofToString(h, 2, '0') + ":" + ofToString(m, 2, '0') + ":" + ofToString(s, 2, '0'); } void Globals::loadFromFile(string settingsFile) { ofxIniSettings settings = ofxIniSettings(settingsFile); out_requested.bufferSize = settings.get("out_bufferSize", out_requested.bufferSize); out_requested.sampleRate = settings.get("out_sampleRate", out_requested.sampleRate); out_requested.name = settings.get("out_deviceName", out_requested.name); in_requested.bufferSize = settings.get("in_bufferSize", in_requested.sampleRate); in_requested.sampleRate = settings.get("in_sampleRate", in_requested.sampleRate); in_requested.name = settings.get("in_deviceName", in_requested.name); scale = settings.get("scale", scale); flipXY = settings.get("flipXY", flipXY); zModulation = settings.get("zModulation", zModulation); invertX = settings.get("invertX", invertX); invertY = settings.get("invertY", invertY); outputVolume = settings.get("outputVolume", outputVolume); inputVolume = settings.get("inputVolume", inputVolume); strokeWeight = settings.get("strokeWeight", strokeWeight); //timeStretch = settings.get( "timeStretch", timeStretch ); // never load timestretch! blur = settings.get("blur", blur); numPts = settings.get("numPts", numPts); hue = settings.get("hue", hue); intensity = settings.get("intensity", intensity); afterglow = settings.get("afterglow", afterglow); analogMode = settings.get("analogMode", analogMode); exportFrameRate = settings.get("exportFrameRate", exportFrameRate); exportWidth = settings.get("exportWidth", exportWidth); exportHeight = settings.get("exportHeight", exportHeight); exportFormat = (ExportFormat)settings.get("exportFormat", (int)exportFormat); laserOffsetX = settings.get("laserOffsetX", laserOffsetX); laserOffsetY = settings.get("laserOffsetY", laserOffsetY); laserKeystoneX = settings.get("laserKeystoneX", laserKeystoneX); laserKeystoneY = settings.get("laserKeystoneY", laserKeystoneY); //secondsBeforeHidingMenu = settings.get( "secondsBeforeHidingMenu", secondsBeforeHidingMenu ); } void Globals::saveToFile(string settingsFile) { if (!ofFile(settingsFile, ofFile::Reference).exists()) { ofFile file(settingsFile, ofFile::WriteOnly); file << endl; file.close(); } ofxIniSettings settings = ofxIniSettings(settingsFile); //settings.set("out_bufferSize", out_requested.bufferSize); //settings.set("out_sampleRate", out_requested.sampleRate); settings.set("out_deviceName", out_requested.name); //settings.set("in_bufferSize", in_requested.bufferSize); //settings.set("in_sampleRate", in_requested.sampleRate); settings.set("in_deviceName", in_requested.name); settings.set("scale", scale); settings.set("flipXY", flipXY); settings.set("zModulation", zModulation); settings.set("invertX", invertX); settings.set("invertY", invertY); settings.set("outputVolume", outputVolume); settings.set("inputVolume", inputVolume); settings.set("strokeWeight", strokeWeight); // settings.set( "timeStretch", timeStretch ); // never save timestretch! settings.set("blur", blur); settings.set("numPts", numPts); settings.set("hue", hue); settings.set("intensity", intensity); settings.set("afterglow", afterglow); settings.set("analogMode", analogMode); settings.set("exportFrameRate", exportFrameRate); settings.set("exportWidth", exportWidth); settings.set("exportHeight", exportHeight); settings.set("exportFormat", (int)exportFormat); settings.set("laserOffsetX", laserOffsetX); settings.set("laserOffsetY", laserOffsetY); settings.set("laserKeystoneX", laserKeystoneX); settings.set("laserKeystoneY", laserKeystoneY); // settings.set( "secondsBeforeHidingMenu", secondsBeforeHidingMenu ); }
kritzikratzi/Oscilloscope
<|start_filename|>govatar_test.go<|end_filename|> package govatar import ( "image" "image/color" "math/rand" "net/http" "os" "testing" "github.com/stretchr/testify/assert" ) func TestGenerate(t *testing.T) { testCases := map[string]struct { gender Gender err error }{ "male": { gender: MALE, }, "female": { gender: FEMALE, }, "unsupported": { gender: Gender(-1), err: ErrUnsupportedGender, }, } for name, test := range testCases { t.Run(name, func(t *testing.T) { avatar, err := Generate(test.gender) assert.Equal(t, test.err, err) if test.err == nil && assert.NotNil(t, avatar) { bounds := avatar.Bounds() if assert.False(t, bounds.Empty()) { assert.Equal(t, 400, bounds.Dx()) assert.Equal(t, 400, bounds.Dy()) } } }) } } var letterRunes = []rune("abcdefghijklmnopqrstuvwxyz") func randStringRunes(n int) string { b := make([]rune, n) for i := range b { b[i] = letterRunes[rand.Intn(len(letterRunes))] } return string(b) } func TestGenerateFile(t *testing.T) { fileName := randStringRunes(6) testCases := map[string]struct { imageName string mimeType string }{ "jpeg": {imageName: fileName + ".jpeg", mimeType: "image/jpeg"}, "jpg": {imageName: fileName + ".jpg", mimeType: "image/jpeg"}, "png": {imageName: fileName + ".png", mimeType: "image/png"}, "gif": {imageName: fileName + ".gif", mimeType: "image/gif"}, "xyz": {imageName: fileName + ".xyz", mimeType: "image/png"}, } for name, test := range testCases { t.Run(name, func(t *testing.T) { os.Remove(test.imageName) defer os.Remove(test.imageName) err := GenerateFile(MALE, test.imageName) if assert.NoError(t, err) { buf := make([]byte, 512) f, err := os.Open(test.imageName) if assert.NoError(t, err) { defer f.Close() _, err = f.Read(buf) if assert.NoError(t, err) { assert.Equal(t, test.mimeType, http.DetectContentType(buf)) } } } }) } } func TestGenerateFromString(t *testing.T) { testCases := map[string]struct { gender Gender areEqual bool username1 string username2 string err error }{ "equal": { gender: MALE, areEqual: true, username1: "<EMAIL>", username2: "<EMAIL>", }, "not equal": { gender: MALE, areEqual: false, username1: "<EMAIL>", username2: "<EMAIL>", }, "error": { gender: Gender(-1), username1: "<EMAIL>", username2: "<EMAIL>", err: ErrUnsupportedGender, }, } for name, test := range testCases { t.Run(name, func(t *testing.T) { avatar1, err := GenerateForUsername(test.gender, test.username1) assert.Equal(t, test.err, err) if test.err == nil && assert.NotNil(t, avatar1) { bounds := avatar1.Bounds() assert.False(t, bounds.Empty()) assert.Equal(t, 400, bounds.Dx()) assert.Equal(t, 400, bounds.Dy()) avatar2, err := GenerateForUsername(test.gender, test.username2) if assert.NoError(t, err) { assert.Equal(t, test.areEqual, areImagesEqual(avatar1, avatar2)) } } }) } } func TestGenerateFileFromString(t *testing.T) { fileName := randStringRunes(6) testCases := map[string]struct { imageName string mimeType string }{ "jpeg": {imageName: fileName + ".jpeg", mimeType: "image/jpeg"}, "jpg": {imageName: fileName + ".jpg", mimeType: "image/jpeg"}, "png": {imageName: fileName + ".png", mimeType: "image/png"}, "gif": {imageName: fileName + ".gif", mimeType: "image/gif"}, "xyz": {imageName: fileName + ".xyz", mimeType: "image/png"}, } for name, test := range testCases { t.Run(name, func(t *testing.T) { os.Remove(test.imageName) defer os.Remove(test.imageName) err := GenerateFileForUsername(MALE, "<EMAIL>", test.imageName) if assert.NoError(t, err) { buf := make([]byte, 512) f, err := os.Open(test.imageName) if assert.NoError(t, err) { defer f.Close() _, err = f.Read(buf) if assert.NoError(t, err) { assert.Equal(t, test.mimeType, http.DetectContentType(buf)) } } } }) } } func areImagesEqual(a, b image.Image) bool { ab, bb := a.Bounds(), b.Bounds() w, h := ab.Dx(), ab.Dy() if w != bb.Dx() || h != bb.Dy() { return false } n := 0 for y := 0; y < h; y++ { for x := 0; x < w; x++ { d := diffColor(a.At(ab.Min.X+x, ab.Min.Y+y), b.At(bb.Min.X+x, bb.Min.Y+y)) c := color.RGBA{0, 0, 0, 0xff} if d > 0 { c.R = 0xff n++ } } } return n == 0 } func diffColor(c1, c2 color.Color) int64 { r1, g1, b1, a1 := c1.RGBA() r2, g2, b2, a2 := c2.RGBA() var diff int64 diff += abs(int64(r1) - int64(r2)) diff += abs(int64(g1) - int64(g2)) diff += abs(int64(b1) - int64(b2)) diff += abs(int64(a1) - int64(a2)) return diff } func abs(x int64) int64 { if x < 0 { return -x } return x } <|start_filename|>Dockerfile<|end_filename|> FROM alpine:latest as alpine RUN apk --update add ca-certificates RUN apk --update add mailcap FROM scratch COPY --from=alpine /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt COPY --from=alpine /etc/mime.types /etc/mime.types VOLUME /data COPY govatar /govatar ENTRYPOINT [ "/govatar" ] <|start_filename|>utils.go<|end_filename|> package govatar import ( "math/rand" "regexp" "strings" ) // randInt returns random integer func randInt(rnd *rand.Rand, min int, max int) int { return min + rnd.Intn(max-min) } // randStringSliceItem returns random element from slice of string func randStringSliceItem(rnd *rand.Rand, slice []string) string { return slice[randInt(rnd, 0, len(slice))] } type naturalSort []string var r = regexp.MustCompile(`[^0-9]+|[0-9]+`) func (s naturalSort) Len() int { return len(s) } func (s naturalSort) Swap(i, j int) { s[i], s[j] = s[j], s[i] } func (s naturalSort) Less(i, j int) bool { spliti := r.FindAllString(strings.Replace(s[i], " ", "", -1), -1) splitj := r.FindAllString(strings.Replace(s[j], " ", "", -1), -1) for index := 0; index < len(spliti) && index < len(splitj); index++ { if spliti[index] != splitj[index] { // Both slices are numbers if isNumber(spliti[index][0]) && isNumber(splitj[index][0]) { // Remove Leading Zeroes stringi := strings.TrimLeft(spliti[index], "0") stringj := strings.TrimLeft(splitj[index], "0") if len(stringi) == len(stringj) { for indexchar := 0; indexchar < len(stringi); indexchar++ { if stringi[indexchar] != stringj[indexchar] { return stringi[indexchar] < stringj[indexchar] } } return len(spliti[index]) < len(splitj[index]) } return len(stringi) < len(stringj) } // One of the slices is a number (we give precedence to numbers regardless of ASCII table position) if isNumber(spliti[index][0]) || isNumber(splitj[index][0]) { return isNumber(spliti[index][0]) } // Both slices are not numbers return spliti[index] < splitj[index] } } // Fall back for cases where space characters have been annihilated by the replacement call // Here we iterate over the unmolested string and prioritize numbers for index := 0; index < len(s[i]) && index < len(s[j]); index++ { if isNumber(s[i][index]) || isNumber(s[j][index]) { return isNumber(s[i][index]) } } return s[i] < s[j] } func isNumber(input uint8) bool { return input >= '0' && input <= '9' } <|start_filename|>Makefile<|end_filename|> PLATFORMS := linux/amd64 windows/amd64/.exe windows/386/.exe darwin/amd64 temp = $(subst /, ,$@) os = $(word 1, $(temp)) arch = $(word 2, $(temp)) ext = $(word 3, $(temp)) VERSION := $(shell git describe --always --abbrev=6 --tags) .PHONY: build build: clean $(PLATFORMS); clean: rm -rf build/ $(PLATFORMS): GOOS=$(os) GOARCH=$(arch) go build -ldflags "-X main.version=${VERSION}" -o 'build/govatar$(ext)' ./govatar zip 'build/govatar-$(os)-$(arch).$(VERSION).zip' 'build/govatar$(ext)'
princemaple/govatar
<|start_filename|>Frameworks/TestsFoundation/Sources/PrivateHeaders/Classdump/XCTest/Xcode_12_0/Xcode_12_0_MXMInstrumental.h<|end_filename|> #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 140000 && __IPHONE_OS_VERSION_MAX_ALLOWED < 150000 #import "Xcode_12_0_XCTest_CDStructures.h" #import "Xcode_12_0_SharedHeader.h" #import <Foundation/Foundation.h> // // Generated by class-dump 3.5 (64 bit). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by <NAME>. // @protocol MXMInstrumental <NSCopying> - (_Bool)harvestData:(id *)arg1 error:(id *)arg2; @optional - (void)didStopAtContinuousTime:(unsigned long long)arg1 absoluteTime:(unsigned long long)arg2 stopDate:(NSDate *)arg3; - (void)didStartAtContinuousTime:(unsigned long long)arg1 absoluteTime:(unsigned long long)arg2 startDate:(NSDate *)arg3; - (void)didStopAtTime:(unsigned long long)arg1 stopDate:(NSDate *)arg2; - (void)willStop; - (void)didStartAtTime:(unsigned long long)arg1 startDate:(NSDate *)arg2; - (void)willStartAtEstimatedTime:(unsigned long long)arg1; - (_Bool)prepareWithOptions:(NSDictionary *)arg1 error:(id *)arg2; @end #endif <|start_filename|>ci/destinations/ios13.json<|end_filename|> [ { "testDestination": { "deviceType": "iPhone 11 Pro Max", "iOSVersion": "13.7", "iOSVersionShort": "13.7", "iOSVersionLong": "13.7", "deviceTypeId": "com.apple.CoreSimulator.SimDeviceType.iPhone-11-Pro-Max", "runtimeId": "com.apple.CoreSimulator.SimRuntime.iOS-13-7" }, "reportOutput": { "junit": "tests-artifacts/iphone_11_pro_max_ios_137.xml", "tracingReport": "tests-artifacts/iphone_11_pro_max_ios_137.trace" } } ] <|start_filename|>Frameworks/TestsFoundation/Sources/PrivateHeaders/Classdump/XCTest/Xcode_12_0/Xcode_12_0_XCUIApplicationProcess.h<|end_filename|> #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 140000 && __IPHONE_OS_VERSION_MAX_ALLOWED < 150000 #import "Xcode_12_0_XCTest_CDStructures.h" #import "Xcode_12_0_SharedHeader.h" #import "Xcode_12_0_XCTElementSnapshotAttributeDataSource.h" #import "Xcode_12_0_XCUIIssueDiagnosticsProviding.h" #import <Foundation/Foundation.h> @protocol XCTRunnerAutomationSession, XCUIApplicationProcessDelegate, XCUIDevice; @class XCAccessibilityElement, XCElementSnapshot, XCTFuture; // // Generated by class-dump 3.5 (64 bit). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by <NAME>. // @interface XCUIApplicationProcess : NSObject <XCTElementSnapshotAttributeDataSource, XCUIIssueDiagnosticsProviding> { NSObject *_queue; _Bool _accessibilityActive; unsigned long long _applicationState; int _processID; id _token; int _exitCode; _Bool _eventLoopHasIdled; _Bool _animationsHaveFinished; _Bool _hasExitCode; _Bool _hasCrashReport; unsigned long long _alertCount; id <XCTRunnerAutomationSession> _automationSession; XCTFuture *_automationSessionFuture; NSString *_path; NSString *_bundleID; XCElementSnapshot *_lastSnapshot; id <XCUIDevice> _device; id <XCUIApplicationProcessDelegate> _delegate; } + (id)keyPathsForValuesAffectingIsQuiescent; + (_Bool)automaticallyNotifiesObserversForKey:(id)arg1; + (id)keyPathsForValuesAffectingIsProcessIDValid; + (id)keyPathsForValuesAffectingForeground; + (id)keyPathsForValuesAffectingBackground; + (id)keyPathsForValuesAffectingSuspended; + (id)keyPathsForValuesAffectingRunning; + (id)keyPathsForValuesAffectingIsApplicationStateKnown; @property(readonly) id <XCUIApplicationProcessDelegate> delegate; // @synthesize delegate=_delegate; @property(readonly) id <XCUIDevice> device; // @synthesize device=_device; @property(retain) XCElementSnapshot *lastSnapshot; // @synthesize lastSnapshot=_lastSnapshot; @property _Bool hasCrashReport; // @synthesize hasCrashReport=_hasCrashReport; @property _Bool hasExitCode; // @synthesize hasExitCode=_hasExitCode; @property(readonly, copy, nonatomic) NSString *bundleID; // @synthesize bundleID=_bundleID; @property(readonly, copy, nonatomic) NSString *path; // @synthesize path=_path; - (id)diagnosticAttachmentsForError:(id)arg1; - (_Bool)isMacCatalystForPID:(int)arg1; @property(readonly) _Bool hasBannerNotificationIsStickyAttribute; @property(readonly) _Bool usePointTransformationsForFrameConversions; @property(readonly) _Bool supportsHostedViewCoordinateTransformations; - (id)parameterizedAttribute:(id)arg1 forElement:(id)arg2 parameter:(id)arg3 error:(id *)arg4; - (id)valuesForPrivilegedAttributes:(id)arg1 forElement:(id)arg2 error:(id *)arg3; @property(readonly) _Bool providesValuesForPrivilegedAttributes; - (id)attributesForElement:(id)arg1 attributes:(id)arg2 error:(id *)arg3; @property(readonly) _Bool allowsRemoteAccess; - (id)_underlyingDataSourceForElement:(id)arg1; - (_Bool)terminate:(id *)arg1; - (_Bool)waitForViewControllerViewDidDisappearWithTimeout:(double)arg1 error:(id *)arg2; - (void)acquireBackgroundAssertion; @property(readonly) XCTFuture *automationSessionFuture; // @synthesize automationSessionFuture=_automationSessionFuture; - (id)_queue_automationSessionFuture; - (void)waitForAutomationSession; @property(retain, nonatomic) id <XCTRunnerAutomationSession> automationSession; // @synthesize automationSession=_automationSession; - (_Bool)isQuiescent; - (void)_initiateQuiescenceChecksIncludingAnimationsIdle:(_Bool)arg1; - (void)waitForQuiescenceIncludingAnimationsIdle:(_Bool)arg1; - (id)_makeQuiescenceExpectation; - (void)_notifyWhenAnimationsAreIdle:(CDUnknownBlockType)arg1; - (_Bool)_supportsAnimationsIdleNotifications; - (void)_notifyWhenMainRunLoopIsIdle:(CDUnknownBlockType)arg1; - (void)resetAlertCount; - (void)incrementAlertCount; @property(readonly) unsigned long long alertCount; // @synthesize alertCount=_alertCount; @property _Bool animationsHaveFinished; @property _Bool eventLoopHasIdled; @property int exitCode; @property(retain) id token; @property(nonatomic) int processID; @property(readonly, getter=isProcessIDValid) _Bool processIDValid; @property(readonly) _Bool foreground; @property(readonly) _Bool background; @property(readonly) _Bool suspended; @property(readonly) _Bool running; - (_Bool)isApplicationStateKnown; - (void)_awaitKnownApplicationState; @property(nonatomic) unsigned long long applicationState; @property(nonatomic) _Bool accessibilityActive; @property(readonly, copy) XCAccessibilityElement *accessibilityElement; @property(readonly, copy) NSString *shortDescription; - (id)_queue_description; - (id)initWithBundleID:(id)arg1 device:(id)arg2 delegate:(id)arg3; - (id)initWithPath:(id)arg1 bundleID:(id)arg2 device:(id)arg3 delegate:(id)arg4; // Remaining properties @end #endif <|start_filename|>Tests/UnitTests/Support/UnitTests-Bridging-Header.h<|end_filename|> #import "AllTestsSharedBridgingHeader.h" <|start_filename|>Frameworks/Testability/Sources/FakeCells/ObjCInterfacesForFakeCells.h<|end_filename|> #ifdef MIXBOX_ENABLE_IN_APP_SERVICES #import <UIKit/UIKit.h> @interface UICollectionViewCell (ObjCInterfacesForFakeCells) - (BOOL)_isHiddenForReuse; - (BOOL)_setHiddenForReuse:(BOOL)isHiddenForReuse; @end @interface UICollectionView (ObjCInterfacesForFakeCells) - (void)_reuseCell:(UICollectionViewCell *)cell; @end #endif <|start_filename|>Frameworks/TestsFoundation/Sources/PrivateHeaders/Classdump/XCTest/Xcode_12_0/Xcode_12_0_XCUIScreenDataSource.h<|end_filename|> #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 140000 && __IPHONE_OS_VERSION_MAX_ALLOWED < 150000 #import "Xcode_12_0_XCTest_CDStructures.h" #import "Xcode_12_0_SharedHeader.h" #import <Foundation/Foundation.h> // // Generated by class-dump 3.5 (64 bit). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by <NAME>. // @protocol XCUIScreenDataSource <NSObject> - (void)requestScreenshotOfScreenWithID:(long long)arg1 withRect:(struct CGRect)arg2 scale:(double)arg3 formatUTI:(NSString *)arg4 compressionQuality:(double)arg5 withReply:(void (^)(NSData *, NSError *))arg6; - (void)requestScaleForScreenWithIdentifier:(long long)arg1 completion:(void (^)(double, NSError *))arg2; - (void)requestScreenIdentifiersWithCompletion:(void (^)(NSArray *, NSError *))arg1; @end #endif <|start_filename|>Frameworks/Testability/Sources/CommonValues/Support/ObjectiveC/NSObject+TestabilityElement.h<|end_filename|> #ifdef MIXBOX_ENABLE_IN_APP_SERVICES @import UIKit; #import "TestabilityElementType.h" #import "TestabilityElement.h" @interface NSObject (Testability) - (CGRect)mb_testability_frame; - (CGRect)mb_testability_frameRelativeToScreen; - (nonnull NSString *)mb_testability_customClass; - (TestabilityElementType)mb_testability_elementType; - (nullable NSString *)mb_testability_accessibilityIdentifier; - (nullable NSString *)mb_testability_accessibilityLabel; - (nullable NSString *)mb_testability_accessibilityValue; - (nullable NSString *)mb_testability_accessibilityPlaceholderValue; - (nullable NSString *)mb_testability_text; - (nonnull NSString *)mb_testability_uniqueIdentifier; - (BOOL)mb_testability_isDefinitelyHidden; - (BOOL)mb_testability_isEnabled; - (BOOL)mb_testability_hasKeyboardFocus; - (nullable id<TestabilityElement>)mb_testability_parent; - (nonnull NSArray<id<TestabilityElement>> *)mb_testability_children; @end #endif <|start_filename|>Frameworks/TestsFoundation/Sources/PrivateHeaders/Classdump/XCTest/Xcode_12_0/Xcode_12_0_XCTest.h<|end_filename|> #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 140000 && __IPHONE_OS_VERSION_MAX_ALLOWED < 150000 #import "Xcode_12_0_XCTest_CDStructures.h" #import "Xcode_12_0_SharedHeader.h" #import <Foundation/Foundation.h> #import <XCTest/XCTest.h> @class XCTestObservationCenter, XCTestRun; // // Generated by class-dump 3.5 (64 bit). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by <NAME>. // @interface XCTest () { XCTestRun *_testRun; XCTestObservationCenter *_observationCenter; } + (id)languageAgnosticTestClassNameForTestClass:(Class)arg1; - (long long)defaultExecutionOrderCompare:(id)arg1; @property(readonly) NSString *nameForLegacyLogging; @property(readonly) NSString *languageAgnosticTestMethodName; @property(readonly) NSString *languageAgnosticTestClassName; - (void)tearDown; - (void)setUp; - (void)runTest; @property(retain) XCTestObservationCenter *observationCenter; // @synthesize observationCenter=_observationCenter; @property(readonly) Class _requiredTestRunBaseClass; @property(readonly) NSString *_methodNameForReporting; @property(readonly) NSString *_classNameForReporting; - (void)removeTestsWithNames:(id)arg1; @end #endif <|start_filename|>Frameworks/TestsFoundation/Sources/PrivateHeaders/Classdump/XCTest/Xcode_12_0/Xcode_12_0_XCTMetricInstrumentalAdapter.h<|end_filename|> #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 140000 && __IPHONE_OS_VERSION_MAX_ALLOWED < 150000 #import "Xcode_12_0_XCTest_CDStructures.h" #import "Xcode_12_0_MXMInstrumental.h" #import "Xcode_12_0_SharedHeader.h" #import <Foundation/Foundation.h> @protocol XCTMetric; @class XCTPerformanceMeasurementTimestamp; // // Generated by class-dump 3.5 (64 bit). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by <NAME>. // @interface XCTMetricInstrumentalAdapter : NSObject <MXMInstrumental> { XCTPerformanceMeasurementTimestamp *_startTimestamp; XCTPerformanceMeasurementTimestamp *_stopTimestamp; id <XCTMetric> _metric; } + (void)addMetricToMeasurements:(id)arg1 sampleTag:(id)arg2 identifier:(id)arg3 displayName:(id)arg4 measurements:(id)arg5 skipConversion:(_Bool)arg6 polarity:(long long)arg7; @property(retain, nonatomic) id <XCTMetric> metric; // @synthesize metric=_metric; - (_Bool)harvestData:(id *)arg1 error:(id *)arg2; - (void)didStopAtContinuousTime:(unsigned long long)arg1 absoluteTime:(unsigned long long)arg2 stopDate:(id)arg3; - (void)didStopAtTime:(unsigned long long)arg1 stopDate:(id)arg2; - (void)didStartAtContinuousTime:(unsigned long long)arg1 absoluteTime:(unsigned long long)arg2 startDate:(id)arg3; - (void)didStartAtTime:(unsigned long long)arg1 startDate:(id)arg2; - (void)willStartAtEstimatedTime:(unsigned long long)arg1; - (_Bool)prepareWithOptions:(id)arg1 error:(id *)arg2; - (id)copyWithZone:(struct _NSZone *)arg1; - (id)initWithMetric:(id)arg1; @end #endif <|start_filename|>Frameworks/TestsFoundation/Sources/PrivateHeaders/Classdump/XCTest/Xcode_12_0/Xcode_12_0_XCUIInterruptionMonitoring.h<|end_filename|> #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 140000 && __IPHONE_OS_VERSION_MAX_ALLOWED < 150000 #import "Xcode_12_0_XCTest_CDStructures.h" #import "Xcode_12_0_SharedHeader.h" #import <Foundation/Foundation.h> @class XCUIElement; // // Generated by class-dump 3.5 (64 bit). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by <NAME>. // @protocol XCUIInterruptionMonitoring <NSObject> @property _Bool didHandleUIInterruption; - (_Bool)handleInterruptingElement:(XCUIElement *)arg1; - (void)removeInterruptionHandlerWithIdentifier:(id <NSObject>)arg1; - (id <NSObject>)addInterruptionHandlerWithDescription:(NSString *)arg1 block:(_Bool (^)(XCUIElement *))arg2; @end #endif <|start_filename|>Frameworks/SBTUITestTunnelCommon/Sources/SBTRequestMatch.h<|end_filename|> #ifdef MIXBOX_ENABLE_IN_APP_SERVICES // SBTRequestMatch.h // // Copyright (C) 2016 Subito.it S.r.l (www.subito.it) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #import <Foundation/Foundation.h> @interface SBTRequestMatch : NSObject<NSCoding> @property (nullable, nonatomic, readonly) NSString *url; @property (nullable, nonatomic, readonly) NSArray<NSString *> *query; @property (nullable, nonatomic, readonly) NSString *method; /** Note: Given that parameter order isn't guaranteed it is recommended to specify the `query` parameter in the `SBTRequestMatch`'s initializer */ /** * Initializer * * @param url a regex that is matched against the request url */ - (nonnull instancetype)initWithURL:(nonnull NSString *)url; /** * Initializer * * @param url a regex that is matched against the request url * @param query an array of a regex that are matched against the request query (params in GET and DELETE, body in POST and PUT). Instance will match if all regex are fulfilled. You can specify that a certain query should not match by prefixing it with an exclamation mark `!` */ - (nonnull instancetype)initWithURL:(nonnull NSString *)url query:(nonnull NSArray<NSString *> *)query; /** * Initializer * * @param url a regex that is matched against the request url * @param query an array of a regex that are matched against the request query (params in GET and DELETE, body in POST and PUT). Instance will match if all regex are fulfilled. You can specify that a certain query should not match by prefixing it with an exclamation mark `!` * @param method HTTP method */ - (nonnull instancetype)initWithURL:(nonnull NSString *)url query:(nonnull NSArray<NSString *> *)query method:(nonnull NSString *)method; /** * Initializer * * @param url a regex that is matched against the request url * @param method HTTP method */ - (nonnull instancetype)initWithURL:(nonnull NSString *)url method:(nonnull NSString *)method; /** * Initializer * * @param query an array of a regex that are matched against the request query (params in GET and DELETE, body in POST and PUT). Instance will match if all regex are fulfilled. You can specify that a certain query should not match by prefixing it with an exclamation mark `!` */ - (nonnull instancetype)initWithQuery:(nonnull NSArray<NSString *> *)query; /** * Initializer * * @param query an array of a regex that are matched against the request query (params in GET and DELETE, body in POST and PUT). Instance will match if all regex are fulfilled. You can specify that a certain query should not match by prefixing it with an exclamation mark `!` * @param method HTTP method */ - (nonnull instancetype)initWithQuery:(nonnull NSArray<NSString *> *)query method:(nonnull NSString *)method; /** * Initializer * * @param method HTTP method */ - (nonnull instancetype)initWithMethod:(nonnull NSString *)method; @end #endif <|start_filename|>Frameworks/TestsFoundation/Sources/PrivateHeaders/Classdump/XCTest/Xcode_12_0/Xcode_12_0_XCTMeasureOptions.h<|end_filename|> #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 140000 && __IPHONE_OS_VERSION_MAX_ALLOWED < 150000 #import "Xcode_12_0_XCTest_CDStructures.h" #import "Xcode_12_0_SharedHeader.h" #import <Foundation/Foundation.h> #import <XCTest/XCTMeasureOptions.h> // // Generated by class-dump 3.5 (64 bit). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by <NAME>. // @interface XCTMeasureOptions () { _Bool _enableParallelizedSampling; _Bool _scheduleKickOffOnNewThread; _Bool _allowContinuousSampling; _Bool _discardTraceIteration; _Bool _discardFirstIteration; _Bool _traceCollectionEnabled; unsigned long long _invocationOptions; unsigned long long _iterationCount; NSDictionary *_performanceTestConfiguration; double _quiesceCpuIdlePercent; double _quiesceCpuIdleTimeLimit; } @property(nonatomic) double quiesceCpuIdleTimeLimit; // @synthesize quiesceCpuIdleTimeLimit=_quiesceCpuIdleTimeLimit; @property(nonatomic) double quiesceCpuIdlePercent; // @synthesize quiesceCpuIdlePercent=_quiesceCpuIdlePercent; @property(nonatomic) _Bool traceCollectionEnabled; // @synthesize traceCollectionEnabled=_traceCollectionEnabled; @property(nonatomic) _Bool discardFirstIteration; // @synthesize discardFirstIteration=_discardFirstIteration; @property(retain, nonatomic) NSDictionary *performanceTestConfiguration; // @synthesize performanceTestConfiguration=_performanceTestConfiguration; @property(nonatomic) _Bool discardTraceIteration; // @synthesize discardTraceIteration=_discardTraceIteration; @property(nonatomic) _Bool allowContinuousSampling; // @synthesize allowContinuousSampling=_allowContinuousSampling; @property(readonly, nonatomic) unsigned long long instrumentAutomatic; @property(nonatomic) _Bool allowConcurrentIterations; - (void)applyPerformanceTestConfiguration; @property(readonly, nonatomic) NSDictionary *instrumentOptions; - (id)initWithInstrumentOptionsDictionary:(id)arg1; - (id)init; @end #endif <|start_filename|>Frameworks/Foundation/Sources/CurrentAbsoluteTimeProvider/AbsoluteTime/AbsoluteTime.h<|end_filename|> #ifdef MIXBOX_ENABLE_IN_APP_SERVICES #ifndef mixbox_absoluteTime_h #define mixbox_absoluteTime_h #include <stdint.h> #include <limits.h> #include <MacTypes.h> static AbsoluteTime mixbox_absoluteTimeFromUInt32(UInt32 hi, UInt32 lo) { AbsoluteTime absoluteTime; absoluteTime.hi = hi; absoluteTime.lo = lo; return absoluteTime; } static AbsoluteTime mixbox_absoluteTimeFromUInt64(UInt64 time) { UInt32 hi = time >> sizeof(UInt32) * CHAR_BIT; UInt32 lo = time & UINT32_MAX; return mixbox_absoluteTimeFromUInt32(hi, lo); } #endif /* mixbox_absoluteTime_h */ #endif <|start_filename|>Frameworks/TestsFoundation/Sources/PrivateHeaders/Classdump/XCTest/Xcode_12_0/Xcode_12_0__XCTRunnerDaemonSessionDummyExportedObject.h<|end_filename|> #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 140000 && __IPHONE_OS_VERSION_MAX_ALLOWED < 150000 #import "Xcode_12_0_XCTest_CDStructures.h" #import "Xcode_12_0_SharedHeader.h" #import "Xcode_12_0_XCTestManager_TestsInterface.h" #import <Foundation/Foundation.h> // // Generated by class-dump 3.5 (64 bit). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by <NAME>. // @interface _XCTRunnerDaemonSessionDummyExportedObject : NSObject <XCTestManager_TestsInterface> { } - (void)_XCT_receivedAccessibilityNotification:(int)arg1 fromElement:(id)arg2 payload:(id)arg3; - (void)_XCT_receivedAccessibilityNotification:(int)arg1 withPayload:(id)arg2; - (void)_XCT_applicationWithBundleID:(id)arg1 didUpdatePID:(int)arg2 andState:(unsigned long long)arg3; @end #endif <|start_filename|>Frameworks/TestsFoundation/Sources/PrivateHeaders/Classdump/XCTest/Xcode_12_0/Xcode_12_0_XCUICoordinate.h<|end_filename|> #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 140000 && __IPHONE_OS_VERSION_MAX_ALLOWED < 150000 #import "Xcode_12_0_XCTest_CDStructures.h" #import "Xcode_12_0_SharedHeader.h" #import <Foundation/Foundation.h> #import <XCTest/XCUICoordinate.h> @class XCUICoordinate, XCUIElement; // // Generated by class-dump 3.5 (64 bit). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by <NAME>. // @interface XCUICoordinate () { XCUIElement *_element; XCUICoordinate *_coordinate; struct CGVector _normalizedOffset; struct CGVector _pointsOffset; } @property(readonly) struct CGVector pointsOffset; // @synthesize pointsOffset=_pointsOffset; @property(readonly) struct CGVector normalizedOffset; // @synthesize normalizedOffset=_normalizedOffset; @property(readonly) XCUICoordinate *coordinate; // @synthesize coordinate=_coordinate; @property(readonly) XCUIElement *element; // @synthesize element=_element; - (struct CGPoint)_untransformedScreenPoint; - (id)device; - (id)description; - (id)copyWithZone:(struct _NSZone *)arg1; - (id)initWithCoordinate:(id)arg1 pointsOffset:(struct CGVector)arg2; - (id)initWithElement:(id)arg1 normalizedOffset:(struct CGVector)arg2; - (id)init; - (void)doubleTap; - (void)tap; - (void)_pressWithPressure:(double)arg1 pressDuration:(double)arg2 holdDuration:(double)arg3 releaseDuration:(double)arg4 activityTitle:(id)arg5; - (void)pressWithPressure:(double)arg1 duration:(double)arg2; - (void)forcePress; @end #endif <|start_filename|>Frameworks/IoKit/Sources/IOKitExtensions/EnumRawValues.h<|end_filename|> #ifdef MIXBOX_ENABLE_IN_APP_SERVICES #ifndef EnumRawValues_h #define EnumRawValues_h #include "IOHIDEventTypes.h" __BEGIN_DECLS // Added to support initializing enum with rawValue (enums have only failable initializer, even if they are open). IOHIDDigitizerTransducerType IOHIDDigitizerTransducerTypeFromRawValue(uint32_t rawValue); IOHIDEventType IOHIDEventTypeFromRawValue(uint32_t rawValue); __END_DECLS #endif /* EnumRawValues_h */ #endif <|start_filename|>Frameworks/TestsFoundation/Sources/PrivateHeaders/Classdump/XCTest/Xcode_12_0/Xcode_12_0_XCUIPlatformApplicationServicesProviding.h<|end_filename|> #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 140000 && __IPHONE_OS_VERSION_MAX_ALLOWED < 150000 #import "Xcode_12_0_XCTest_CDStructures.h" #import "Xcode_12_0_SharedHeader.h" #import <Foundation/Foundation.h> @protocol XCUIApplicationPlatformServicesProviderDelegate; @class XCUIApplicationSpecifier; // // Generated by class-dump 3.5 (64 bit). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by <NAME>. // @protocol XCUIPlatformApplicationServicesProviding <NSObject> @property __weak id <XCUIApplicationPlatformServicesProviderDelegate> platformApplicationServicesProviderDelegate; - (void)requestApplicationSpecifierForPID:(int)arg1 reply:(void (^)(XCUIApplicationSpecifier *, NSError *))arg2; - (void)terminateApplicationWithBundleID:(NSString *)arg1 pid:(int)arg2 completion:(void (^)(_Bool, NSError *))arg3; - (void)launchApplicationWithPath:(NSString *)arg1 bundleID:(NSString *)arg2 arguments:(NSArray *)arg3 environment:(NSDictionary *)arg4 completion:(void (^)(_Bool, NSError *))arg5; - (void)beginMonitoringApplicationWithSpecifier:(XCUIApplicationSpecifier *)arg1; @end #endif <|start_filename|>Frameworks/IoKit/Sources/PrivateApi/IOKit/hid/IOHIDEventQueue.h<|end_filename|> #ifdef MIXBOX_ENABLE_IN_APP_SERVICES /* IOHIDEventQueue.h ... Header for IOHIDEventQueue*** functions. Copyright (c) 2009 KennyTM~ <<EMAIL>> All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the KennyTM~ nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef IOKIT_HID_IOHIDEVENTQUEUE_H #define IOKIT_HID_IOHIDEVENTQUEUE_H 1 #include <CoreFoundation/CoreFoundation.h> #include "IOHIDEvent.h" __BEGIN_DECLS typedef struct __IOHIDEventQueue #if 0 { CFRuntimeBase base; // 0, 4 IODataQueueMemory* queue; // 8 size_t queueSize; // c int notificationPortType; // 10, 0 -> associate to hidSystem, 1 -> associate to data queue. uint32_t token; // 14 int topBitOfToken; // 18, = token >> 31 } #endif * IOHIDEventQueueRef; #pragma mark - #pragma mark Creators CFTypeID IOHIDEventQueueGetTypeID(void); // Token must be nonzero. IOHIDEventQueueRef IOHIDEventQueueCreateWithToken(CFAllocatorRef allocator, uint32_t token); IOHIDEventQueueRef IOHIDEventQueueCreate(CFAllocatorRef allocator, int notificationPortType, uint32_t token); #pragma mark - #pragma mark Accessors uint32_t IOHIDEventQueueGetToken(IOHIDEventQueueRef queue); void IOHIDEventQueueSetNotificationPort(IOHIDEventQueueRef queue, mach_port_t port); #pragma mark - #pragma mark Actions IOHIDEventRef IOHIDEventQueueDequeueCopy(IOHIDEventQueueRef queue); void IOHIDEventQueueEnqueue(IOHIDEventQueueRef queue, IOHIDEventRef event); // will send a message to the "tickle port" as well. __END_DECLS #endif #endif <|start_filename|>Frameworks/InAppServices/Sources/Support/Windows/UIApplication+StatusBarWindow.h<|end_filename|> #ifdef MIXBOX_ENABLE_IN_APP_SERVICES @import UIKit; @interface UIApplication (MixboxInAppServices_ApplePrivateAPI) - (UIWindow *)statusBarWindow; @end #endif <|start_filename|>Tests/AppForCheckingPureXctest/HidEventsDebugging/AppForCheckingPureXctest-Bridging-Header.h<|end_filename|> #import "PrivateApi.h" <|start_filename|>Frameworks/TestsFoundation/Sources/PrivateHeaders/Classdump/XCTest/Xcode_12_0/Xcode_12_0_XCUIInterruptionMonitor.h<|end_filename|> #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 140000 && __IPHONE_OS_VERSION_MAX_ALLOWED < 150000 #import "Xcode_12_0_XCTest_CDStructures.h" #import "Xcode_12_0_SharedHeader.h" #import "Xcode_12_0_XCUIInterruptionMonitoring.h" #import <Foundation/Foundation.h> // // Generated by class-dump 3.5 (64 bit). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by <NAME>. // @interface XCUIInterruptionMonitor : NSObject <XCUIInterruptionMonitoring> { _Bool _didHandleUIInterruption; long long _platform; } + (CDUnknownBlockType)defaultInterruptionHandler_iOS; @property(readonly) long long platform; // @synthesize platform=_platform; @property _Bool didHandleUIInterruption; // @synthesize didHandleUIInterruption=_didHandleUIInterruption; - (_Bool)handleInterruptingElement:(id)arg1; - (void)removeInterruptionHandlerWithIdentifier:(id)arg1; - (id)addInterruptionHandlerWithDescription:(id)arg1 block:(CDUnknownBlockType)arg2; - (id)initWithPlatform:(long long)arg1; // Remaining properties @end #endif <|start_filename|>Frameworks/TestsFoundation/Sources/PrivateHeaders/Classdump/XCTest/Xcode_12_0/Xcode_12_0_XCUIAccessibilityAction.h<|end_filename|> #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 140000 && __IPHONE_OS_VERSION_MAX_ALLOWED < 150000 #import "Xcode_12_0_XCTest_CDStructures.h" #import "Xcode_12_0_SharedHeader.h" #import <Foundation/Foundation.h> // // Generated by class-dump 3.5 (64 bit). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by <NAME>. // @interface XCUIAccessibilityAction : NSObject { int _actionNumber; } + (id)decrementActionForPlatform:(long long)arg1; + (id)incrementActionForPlatform:(long long)arg1; + (id)scrollToVisibleAction; + (id)detectAnimationsNonActiveAction; + (id)beginMonitoringIdleRunLoopAction; @property(readonly) int actionNumber; // @synthesize actionNumber=_actionNumber; - (id)description; - (id)initWithAXAction:(int)arg1; @end #endif <|start_filename|>ci/destinations/ios14.json<|end_filename|> [ { "testDestination": { "deviceType": "iPhone 12", "iOSVersion": "14.1", "iOSVersionShort": "14.1", "iOSVersionLong": "14.1", "deviceTypeId": "com.apple.CoreSimulator.SimDeviceType.iPhone-12", "runtimeId": "com.apple.CoreSimulator.SimRuntime.iOS-14-1" }, "reportOutput": { "junit": "tests-artifacts/ios_14.xml", "tracingReport": "tests-artifacts/ios_14.trace" } } ] <|start_filename|>Frameworks/TestsFoundation/Sources/PrivateHeaders/Classdump/XCTest/Xcode_12_0/Xcode_12_0_XCTTestWorker.h<|end_filename|> #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 140000 && __IPHONE_OS_VERSION_MAX_ALLOWED < 150000 #import "Xcode_12_0_XCTest_CDStructures.h" #import "Xcode_12_0_SharedHeader.h" #import "Xcode_12_0_XCTTestSchedulerWorker.h" // // Generated by class-dump 3.5 (64 bit). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by <NAME>. // @protocol XCTTestWorker <XCTTestSchedulerWorker> - (void)fetchDiscoveredTestClasses:(void (^)(NSSet *, NSError *))arg1; @end #endif <|start_filename|>Frameworks/IoKit/Sources/PrivateApi/IOKit/hid/IOHIDNotification.h<|end_filename|> #ifdef MIXBOX_ENABLE_IN_APP_SERVICES /* IOHIDNotification ... I/O Kit HID Notifications Copyright (c) 2009 KennyTM~ <<EMAIL>> All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the KennyTM~ nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef IOHID_NOTIFICATION_H #define IOHID_NOTIFICATION_H #include <CoreFoundation/CoreFoundation.h> __BEGIN_DECLS typedef void(*IOHIDNotificationCallback)(void* target, void* refcon); typedef struct __IOHIDNotification #if 0 { CFRuntimeBase _base; // 0, 4 IOHIDNotificationCallback clientCallback; // 8 void* clientTarget; // c void* clientRefcon; // 10 IOHIDNotificationCallback ownerCallback; // 14 void* ownerTarget; // 18 void* ownerRefcon; // 1c } #endif * IOHIDNotificationRef; #pragma mark - #pragma mark Creators CFTypeID IOHIDNotificationGetTypeID(); IOHIDNotificationRef IOHIDNotificationCreate(CFAllocatorRef allocator, IOHIDNotificationCallback ownerCallback, void* ownerTarget, void* ownerRefcon, IOHIDNotificationCallback clientCallback, void* clientTarget, void* clientRefcon); #pragma mark - #pragma mark Accessors IOHIDNotificationCallback IOHIDNotificationGetClientCallback(IOHIDNotificationRef notification); void* IOHIDNotificationGetClientTarget(IOHIDNotificationRef notification); void* IOHIDNotificationGetClientRefcon(IOHIDNotificationRef notification); IOHIDNotificationCallback IOHIDNotificationGetOwnerCallback(IOHIDNotificationRef notification); void* IOHIDNotificationGetOwnerTarget(IOHIDNotificationRef notification); void* IOHIDNotificationGetOwnerRefcon(IOHIDNotificationRef notification); __END_DECLS #endif #endif <|start_filename|>Frameworks/TestsFoundation/Sources/PrivateHeaders/Manual/Disassembled/_XCTCurrentTestCase.h<|end_filename|> // It is possible to rewrite this in Swift: // // @_silgen_name("_XCTCurrentTestCase") // public func _XCTCurrentTestCase() -> AnyObject? // // However, tests were crashing with EXC_BAD_ACCESS on a real app project. id _XCTCurrentTestCase(void); <|start_filename|>Frameworks/Testability/Sources/CommonValues/Support/ObjectiveC/NSObject+AccessibilityPlaceholderValue.h<|end_filename|> @import Foundation; // Exposes private API @interface NSObject (AccessibilityPlaceholderValue) - (id)accessibilityPlaceholderValue; @end <|start_filename|>Frameworks/IoKit/Sources/PrivateApi/IOKit/hid/IOHIDUserDevice.h<|end_filename|> #ifdef MIXBOX_ENABLE_IN_APP_SERVICES /* * * @APPLE_LICENSE_HEADER_START@ * * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in * compliance with the License. Please obtain a copy of the License at * http://www.opensource.apple.com/apsl/ and read it before using this * file. * * The Original Code and all software distributed under the License are * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. * * @APPLE_LICENSE_HEADER_END@ */ #ifndef _IOKIT_HID_IOHIDUSERDEVICE_USER_H #define _IOKIT_HID_IOHIDUSERDEVICE_USER_H #include <CoreFoundation/CoreFoundation.h> #include "IOKitLib.h" __BEGIN_DECLS typedef struct __IOHIDUserDevice * IOHIDUserDeviceRef; /*! @function IOHIDUserDeviceGetTypeID @abstract Returns the type identifier of all IOHIDUserDevice instances. */ CF_EXPORT CFTypeID IOHIDUserDeviceGetTypeID(void); /*! @function IOHIDUserDeviceCreate @abstract Creates an virtual IOHIDDevice in the kernel. @discussion The io_service_t passed in this method must reference an object in the kernel of type IOHIDUserDevice. @param allocator Allocator to be used during creation. @param properties CFDictionaryRef containing device properties index by keys defined in IOHIDKeys.h. @result Returns a new IOHIDUserDeviceRef. */ CF_EXPORT IOHIDUserDeviceRef IOHIDUserDeviceCreate( CFAllocatorRef allocator, CFDictionaryRef properties); /*! @function IOHIDUserDeviceHandleReport @abstract Dispatch a report to the IOHIDUserDevice. */ CF_EXPORT IOReturn IOHIDUserDeviceHandleReport( IOHIDUserDeviceRef device, uint8_t * report, CFIndex reportLength); __END_DECLS #endif /* _IOKIT_HID_IOHIDUSERDEVICE_USER_H */ #endif <|start_filename|>Frameworks/TestsFoundation/Sources/PrivateHeaders/Classdump/XCTest/Xcode_12_0/Xcode_12_0_XCTSymbolicationService.h<|end_filename|> #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 140000 && __IPHONE_OS_VERSION_MAX_ALLOWED < 150000 #import "Xcode_12_0_XCTest_CDStructures.h" #import "Xcode_12_0_SharedHeader.h" #import <Foundation/Foundation.h> // // Generated by class-dump 3.5 (64 bit). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by <NAME>. // @interface XCTSymbolicationService : NSObject { } + (void)pushSharedSymbolicationService:(id)arg1 forScope:(CDUnknownBlockType)arg2; + (void)setSharedService:(id)arg1; + (instancetype)sharedService; @end #endif <|start_filename|>Frameworks/InAppServices/Sources/Support/AccessibilityForTestAutomation/AccessibilityForTestAutomationInitializer/Implementation/ObjectiveC/UIAccessibilityAccessibilityInitializer/UIAccessibilityAccessibilityInitializer.h<|end_filename|> #ifdef MIXBOX_ENABLE_IN_APP_SERVICES @import Foundation; @interface UIAccessibilityAccessibilityInitializer : NSObject - (nullable NSString *)initializeAccessibilityOrReturnError; @end #endif <|start_filename|>Frameworks/TestsFoundation/Sources/PrivateHeaders/Classdump/XCTest/Xcode_12_0/Xcode_12_0__XCTestObservationInternal.h<|end_filename|> #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 140000 && __IPHONE_OS_VERSION_MAX_ALLOWED < 150000 #import "Xcode_12_0_XCTest_CDStructures.h" #import "Xcode_12_0_SharedHeader.h" #import "Xcode_12_0__XCTestObservationPrivate.h" @class XCTestCase, XCTestRun; // // Generated by class-dump 3.5 (64 bit). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by <NAME>. // @protocol _XCTestObservationInternal <_XCTestObservationPrivate> @optional - (void)_testCase:(XCTestRun *)arg1 didMeasureValues:(NSArray *)arg2 forPerformanceMetricID:(NSString *)arg3 name:(NSString *)arg4 unitsOfMeasurement:(NSString *)arg5 baselineName:(NSString *)arg6 baselineAverage:(NSNumber *)arg7 maxPercentRegression:(NSNumber *)arg8 maxPercentRelativeStandardDeviation:(NSNumber *)arg9 maxRegression:(NSNumber *)arg10 maxStandardDeviation:(NSNumber *)arg11 file:(NSString *)arg12 line:(unsigned long long)arg13; - (void)testCase:(XCTestCase *)arg1 wasSkippedWithDescription:(NSString *)arg2 inFile:(NSString *)arg3 atLine:(unsigned long long)arg4; @end #endif <|start_filename|>Frameworks/SBTUITestTunnelCommon/Sources/SBTRewrite.h<|end_filename|> #ifdef MIXBOX_ENABLE_IN_APP_SERVICES // SBTRewrite.h // // Copyright (C) 2018 Subito.it S.r.l (www.subito.it) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // NOTE: The regex format to use is the same as ruby 1.8.7, use www.rubular.com to test #import <Foundation/Foundation.h> @interface SBTRewriteReplacement : NSObject<NSCoding> - (nonnull id)init NS_UNAVAILABLE; /** * Initializer * * @param find a string regex that search for a string * @param replace a string that replaces the string matched by find */ - (nonnull instancetype)initWithFind:(nonnull NSString *)find replace:(nonnull NSString *)replace; /** * Process a string by applying replacement specified in initializer * * @param string string to replace */ - (nonnull NSString *)replace:(nonnull NSString *)string; @end @interface SBTRewrite : NSObject<NSCoding> - (nonnull id)init NS_UNAVAILABLE; #pragma mark - Response /** * Initializer * * @param responseReplacement an array or SBTRewriteReplacement objects that will perform replacements on the response body * @param responseHeadersReplacement a dictionary that represents the response headers. Keys not present will be added while existing keys will be replaced. If the value is empty the key will be removed * @param responseCode the response HTTP code to return */ - (nonnull instancetype)initWithResponseReplacement:(nonnull NSArray<SBTRewriteReplacement *> *)responseReplacement headersReplacement:(nonnull NSDictionary<NSString *, NSString *> *)responseHeadersReplacement responseCode:(NSInteger)responseCode; /** * Initializer * * @param responseReplacement an array or SBTRewriteReplacement objects that will perform replacements on the response body * @param responseHeadersReplacement a dictionary that represents the response headers. Keys not present will be added while existing keys will be replaced. If the value is empty the key will be removed */ - (nonnull instancetype)initWithResponseReplacement:(nonnull NSArray<SBTRewriteReplacement *> *)responseReplacement headersReplacement:(nonnull NSDictionary<NSString *, NSString *> *)responseHeadersReplacement; /** * Initializer * * @param responseReplacement an array or SBTRewriteReplacement objects that will perform replacements on the response body */ - (nonnull instancetype)initWithResponseReplacement:(nonnull NSArray<SBTRewriteReplacement *> *)responseReplacement; /** * Initializer * * @param responseHeadersReplacement a dictionary that represents the response headers. Keys not present will be added while existing keys will be replaced. If the value is empty the key will be removed */ - (nonnull instancetype)initWithResponseHeadersReplacement:(nonnull NSDictionary<NSString *, NSString *> *)responseHeadersReplacement; /** * Initializer * * @param statusCode the response status code to rewrite */ - (nonnull instancetype)initWithResponseStatusCode:(NSInteger)statusCode; #pragma mark - Request /** * Initializer * * @param requestReplacement an array or SBTRewriteReplacement objects that will perform replacements on the request body * @param requestHeadersReplacement a dictionary that represents the request headers. Keys not present will be added while existing keys will be replaced. If the value is empty the key will be removed */ - (nonnull instancetype)initWithRequestReplacement:(nonnull NSArray<SBTRewriteReplacement *> *)requestReplacement requestHeadersReplacement:(nonnull NSDictionary<NSString *, NSString *> *)requestHeadersReplacement; /** * Initializer * * @param requestReplacement an array or SBTRewriteReplacement objects that will perform replacements on the request body */ - (nonnull instancetype)initWithRequestReplacement:(nonnull NSArray<SBTRewriteReplacement *> *)requestReplacement; /** * Initializer * * @param requestHeadersReplacement a dictionary that represents the request headers. Keys not present will be added while existing keys will be replaced. If the value is empty the key will be removed */ - (nonnull instancetype)initWithRequestHeadersReplacement:(nonnull NSDictionary<NSString *, NSString *> *)requestHeadersReplacement; #pragma mark - URL /** * Initializer * * @param urlReplacement an array or SBTRewriteReplacement objects that will perform replacements on the request URL (host + query) */ - (nonnull instancetype)initWithRequestUrlReplacement:(nonnull NSArray<SBTRewriteReplacement *> *)urlReplacement; #pragma mark - Designated /** * Initializer * * @param urlReplacement an array or SBTRewriteReplacement objects that will perform replacements on the request URL (host + query) * @param responseReplacement an array or SBTRewriteReplacement objects that will perform replacements on the response body * @param responseHeadersReplacement a dictionary that represents the response headers. Keys not present will be added while existing keys will be replaced. If the value is empty the key will be removed * @param requestReplacement an array or SBTRewriteReplacement objects that will perform replacements on the request body * @param requestHeadersReplacement a dictionary that represents the request headers. Keys not present will be added while existing keys will be replaced. If the value is empty the key will be removed * @param responseCode the response HTTP code to return */ - (nonnull instancetype)initWithUrlReplacement:(nullable NSArray<SBTRewriteReplacement *> *)urlReplacement requestReplacement:(nullable NSArray<SBTRewriteReplacement *> *)requestReplacement requestHeadersReplacement:(nullable NSDictionary<NSString *, NSString *> *)requestHeadersReplacement responseReplacement:(nullable NSArray<SBTRewriteReplacement *> *)responseReplacement responseHeadersReplacement:(nullable NSDictionary<NSString *, NSString *> *)responseHeadersReplacement responseCode:(NSInteger)responseCode NS_DESIGNATED_INITIALIZER; /** * Process a url by applying replacement specified in initializer * * @param url url to replace */ - (nonnull NSURL *)rewriteUrl:(nonnull NSURL *)url; /** * Process a dictionary of request headers by applying replacement specified in initializer * * @param requestHeaders request headers to replace */ - (nonnull NSDictionary *)rewriteRequestHeaders:(nonnull NSDictionary *)requestHeaders; /** * Process a dictionary of response headers by applying replacement specified in initializer * * @param responseHeaders response headers to replace */ - (nonnull NSDictionary *)rewriteResponseHeaders:(nonnull NSDictionary *)responseHeaders; /** * Process a request body by applying replacement specified in initializer * * @param requestBody request body */ - (nonnull NSData *)rewriteRequestBody:(nonnull NSData *)requestBody; /** * Process a response body by applying replacement specified in initializer * * @param responseBody response body */ - (nonnull NSData *)rewriteResponseBody:(nonnull NSData *)responseBody; /** * Process a status code by applying replacement specified in initializer * * @param statusCode the status code */ - (NSInteger)rewriteStatusCode:(NSInteger)statusCode; @end #endif <|start_filename|>Frameworks/TestsFoundation/Sources/PrivateHeaders/Classdump/XCTAutomationSupport/Xcode_12_0/Xcode_12_0_XCTAutomationTypeMismatchIssue.h<|end_filename|> #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 140000 && __IPHONE_OS_VERSION_MAX_ALLOWED < 150000 #import "Xcode_12_0_XCTAutomationSupport_CDStructures.h" #import "Xcode_12_0_SharedHeader.h" #import "Xcode_12_0_XCTRuntimeIssue.h" #import <Foundation/Foundation.h> @class XCAccessibilityElement; // // Generated by class-dump 3.5 (64 bit). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by <NAME>. // @interface XCTAutomationTypeMismatchIssue : NSObject <XCTRuntimeIssue> { XCAccessibilityElement *_accessibilityElement; unsigned long long _legacyElementType; unsigned long long _elementTypeFromAutomationType; NSDictionary *_accessibilityAttributes; } + (_Bool)supportsSecureCoding; + (id)capability; @property(readonly, copy) NSDictionary *accessibilityAttributes; // @synthesize accessibilityAttributes=_accessibilityAttributes; @property(readonly) unsigned long long elementTypeFromAutomationType; // @synthesize elementTypeFromAutomationType=_elementTypeFromAutomationType; @property(readonly) unsigned long long legacyElementType; // @synthesize legacyElementType=_legacyElementType; @property(readonly, copy) XCAccessibilityElement *accessibilityElement; // @synthesize accessibilityElement=_accessibilityElement; - (_Bool)isEqualForAggregationWith:(id)arg1; - (_Bool)isEqual:(id)arg1; @property(readonly) unsigned long long aggregationHash; @property(readonly) NSString *detailedDescription; @property(readonly) NSString *shortDescription; - (id)initWithCoder:(id)arg1; - (void)encodeWithCoder:(id)arg1; - (id)initForAccessibilityElement:(id)arg1 legacyElementType:(unsigned long long)arg2 elementTypeFromAutomationType:(unsigned long long)arg3 accessibilityAttributes:(id)arg4; // Remaining properties @end #endif <|start_filename|>Frameworks/TestsFoundation/Sources/PrivateHeaders/Classdump/XCTest/Xcode_12_0/Xcode_12_0_XCTWaiterManager.h<|end_filename|> #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 140000 && __IPHONE_OS_VERSION_MAX_ALLOWED < 150000 #import "Xcode_12_0_XCTest_CDStructures.h" #import "Xcode_12_0_SharedHeader.h" #import <Foundation/Foundation.h> // // Generated by class-dump 3.5 (64 bit). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by <NAME>. // @interface XCTWaiterManager : NSObject { NSMutableArray *_waiterStack; NSThread *_thread; NSObject *_queue; } + (id)threadLocalManager; @property(readonly) NSObject *queue; // @synthesize queue=_queue; @property NSThread *thread; // @synthesize thread=_thread; @property(retain) NSMutableArray *waiterStack; // @synthesize waiterStack=_waiterStack; - (void)waiterDidFinishWaiting:(id)arg1; - (void)waiterTimedOutWhileWaiting:(id)arg1; - (void)waiterWillBeginWaiting:(id)arg1; - (id)init; - (void)dealloc; @end #endif <|start_filename|>Frameworks/TestsFoundation/Sources/PrivateHeaders/Classdump/XCTAutomationSupport/Xcode_12_0/Xcode_12_0_XCTAccessibilityFramework.h<|end_filename|> #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 140000 && __IPHONE_OS_VERSION_MAX_ALLOWED < 150000 #import "Xcode_12_0_XCTAutomationSupport_CDStructures.h" #import "Xcode_12_0_SharedHeader.h" #import <Foundation/Foundation.h> @class XCAccessibilityElement; // // Generated by class-dump 3.5 (64 bit). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by <NAME>. // @protocol XCTAccessibilityFramework <NSObject> @property(readonly) _Bool allowsRemoteAccess; - (void)performWithAXTimeout:(double)arg1 block:(void (^)(void))arg2; - (NSArray *)attributes:(NSArray *)arg1 forElement:(/* unknown type (const struct __AXUIElement) was removed in dump.py */ void *)arg2 error:(id *)arg3; - (long long)appOrientationForElement:(/* unknown type (const struct __AXUIElement) was removed in dump.py */ void *)arg1 error:(id *)arg2; - (struct CGRect)frameForElement:(/* unknown type (const struct __AXUIElement) was removed in dump.py */ void *)arg1 error:(id *)arg2; - (/* unknown type (const struct __AXUIElement) was removed in dump.py */ void *)mainWindowForElement:(/* unknown type (const struct __AXUIElement) was removed in dump.py */ void *)arg1 error:(id *)arg2; - (NSDictionary *)userTestingSnapshotForElement:(/* unknown type (const struct __AXUIElement) was removed in dump.py */ void *)arg1 options:(NSDictionary *)arg2 error:(id *)arg3; - (NSDictionary *)attributesForElement:(XCAccessibilityElement *)arg1 attributes:(NSArray *)arg2 error:(id *)arg3; @end #endif #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 140000 && __IPHONE_OS_VERSION_MAX_ALLOWED < 150000 #import "Xcode_12_0_XCTAutomationSupport_CDStructures.h" #import "Xcode_12_0_SharedHeader.h" #import "Xcode_12_0_XCTAccessibilityFramework.h" #import <Foundation/Foundation.h> // // Generated by class-dump 3.5 (64 bit). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by <NAME>. // @interface XCTAccessibilityFramework : NSObject <XCTAccessibilityFramework> { _Bool _allowsRemoteAccess; int _processID; /* unknown type (struct __AXUIElement) was removed in dump.py */ void *_systemWideElement; } + (void)initialize; + (void)_startAXServer; @property /* unknown type (struct __AXUIElement) was removed in dump.py */ void *systemWideElement; // @synthesize systemWideElement=_systemWideElement; @property(readonly) int processID; // @synthesize processID=_processID; @property(readonly) _Bool allowsRemoteAccess; // @synthesize allowsRemoteAccess=_allowsRemoteAccess; - (void)performWithAXTimeout:(double)arg1 block:(CDUnknownBlockType)arg2; - (id)attributes:(id)arg1 forElement:(/* unknown type (struct __AXUIElement) was removed in dump.py */ void *)arg2 error:(id *)arg3; - (long long)appOrientationForElement:(/* unknown type (struct __AXUIElement) was removed in dump.py */ void *)arg1 error:(id *)arg2; - (struct CGRect)frameForElement:(/* unknown type (struct __AXUIElement) was removed in dump.py */ void *)arg1 error:(id *)arg2; - (/* unknown type (const struct __AXUIElement) was removed in dump.py */ void *)mainWindowForElement:(/* unknown type (struct __AXUIElement) was removed in dump.py */ void *)arg1 error:(id *)arg2; - (id)userTestingSnapshotForElement:(/* unknown type (struct __AXUIElement) was removed in dump.py */ void *)arg1 options:(id)arg2 error:(id *)arg3; - (void)_setAXRequestingClient; - (id)attributesForElement:(id)arg1 attributes:(id)arg2 error:(id *)arg3; - (_Bool)_canAccessElement:(/* unknown type (struct __AXUIElement) was removed in dump.py */ void *)arg1 withError:(id *)arg2; - (void)dealloc; - (id)initForLocalAccess; - (id)initForRemoteAccess; - (id)initAllowingRemoteAccess:(_Bool)arg1 processID:(int)arg2; // Remaining properties @end #endif <|start_filename|>Frameworks/TestsFoundation/Sources/PrivateHeaders/Classdump/XCTest/Xcode_12_0/Xcode_12_0_XCTMutableIssue.h<|end_filename|> #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 140000 && __IPHONE_OS_VERSION_MAX_ALLOWED < 150000 #import "Xcode_12_0_XCTest_CDStructures.h" #import "Xcode_12_0_SharedHeader.h" #import <XCTest/XCTIssue.h> @class XCTSourceCodeContext; // // Generated by class-dump 3.5 (64 bit). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by <NAME>. // @interface XCTMutableIssue () { NSMutableArray *_mutableAttachments; } - (id)initWithType:(long long)arg1 compactDescription:(id)arg2 detailedDescription:(id)arg3 sourceCodeContext:(id)arg4 associatedError:(id)arg5 attachments:(id)arg6; // Remaining properties @property(copy) NSDate *timestamp; // @dynamic timestamp; @end #endif <|start_filename|>Frameworks/TestsFoundation/Sources/PrivateHeaders/Classdump/XCTest/Xcode_12_0/Xcode_12_0_XCTIssue.h<|end_filename|> #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 140000 && __IPHONE_OS_VERSION_MAX_ALLOWED < 150000 #import "Xcode_12_0_XCTest_CDStructures.h" #import "Xcode_12_0_SharedHeader.h" #import <Foundation/Foundation.h> #import <XCTest/XCTIssue.h> @class XCTSourceCodeContext; // // Generated by class-dump 3.5 (64 bit). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by <NAME>. // @interface XCTIssue () { // Error parsing type: {atomic_flag="_Value"AB}, name: _failureBreakPointCalled _Bool _didInterruptTest; _Bool _shouldInterruptTest; long long _type; NSString *_compactDescription; NSString *_detailedDescription; XCTSourceCodeContext *_sourceCodeContext; NSError *_associatedError; NSArray *_attachments; NSDate *_timestamp; } + (_Bool)supportsSecureCoding; + (id)issueWithType:(long long)arg1 compactDescription:(id)arg2 callStackAddresses:(id)arg3 filePath:(id)arg4 lineNumber:(long long)arg5; + (id)issueWithException:(id)arg1; + (id)issueWithType:(long long)arg1 compactDescription:(id)arg2 associatedError:(id)arg3; @property _Bool shouldInterruptTest; // @synthesize shouldInterruptTest=_shouldInterruptTest; @property _Bool didInterruptTest; // @synthesize didInterruptTest=_didInterruptTest; // Error parsing type for property failureBreakPointCalled: // Property attributes: T{atomic_flag=AB},V_failureBreakPointCalled @property(copy) NSDate *timestamp; // @synthesize timestamp=_timestamp; - (_Bool)matchesLegacyPropertiesOfIssue:(id)arg1; - (_Bool)isEqual:(id)arg1; - (unsigned long long)hash; - (id)initWithCoder:(id)arg1; - (void)encodeWithCoder:(id)arg1; @property(readonly) _Bool isLegacyExpectedFailure; @property(readonly) _Bool isFailure; - (id)description; - (void)_updateAttachmentsTimestamps; - (id)mutableCopyWithZone:(struct _NSZone *)arg1; - (id)copyWithZone:(struct _NSZone *)arg1; @end #endif <|start_filename|>Frameworks/TestsFoundation/Sources/PrivateHeaders/Classdump/XCTest/Xcode_12_0/Xcode_12_0_XCTMetric_Private.h<|end_filename|> #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 140000 && __IPHONE_OS_VERSION_MAX_ALLOWED < 150000 #import "Xcode_12_0_XCTest_CDStructures.h" #import "Xcode_12_0_SharedHeader.h" #import <XCTest/XCTMetric.h> @class XCTMeasureOptions, XCTPerformanceMeasurementTimestamp; // // Generated by class-dump 3.5 (64 bit). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by <NAME>. // @protocol XCTMetric_Private <XCTMetric> @optional @property(readonly, nonatomic) NSString *instrumentationName; - (void)didStopMeasuringAtTimestamp:(XCTPerformanceMeasurementTimestamp *)arg1; - (void)didStartMeasuringAtTimestamp:(XCTPerformanceMeasurementTimestamp *)arg1; - (void)willBeginMeasuringAtEstimatedTimestamp:(XCTPerformanceMeasurementTimestamp *)arg1; - (void)prepareToMeasureWithOptions:(XCTMeasureOptions *)arg1; @end #endif <|start_filename|>Frameworks/Testability/Sources/CommonValues/Support/ObjectiveC/TestabilityElement.h<|end_filename|> @import UIKit; #import "TestabilityElementType.h" // NOTE: `customValues` is purely a Swift feature. @protocol TestabilityElement - (CGRect)mb_testability_frame; // Note that there is no way to calculate this from fields, because the logic of coordinates conversion // is not constant for every view (and is proprietary for many views). - (CGRect)mb_testability_frameRelativeToScreen; - (nonnull NSString *)mb_testability_customClass; - (TestabilityElementType)mb_testability_elementType; - (nullable NSString *)mb_testability_accessibilityIdentifier; - (nullable NSString *)mb_testability_accessibilityLabel; - (nullable NSString *)mb_testability_accessibilityValue; - (nullable NSString *)mb_testability_accessibilityPlaceholderValue; // Return nil if the concept of text is not applicable to the view (e.g.: UIImageView). // Return visible text, you may not care about the font/color/overlapping. // E.g. if there is a `placeholder` and `text` properties and view is configured to display placeholder, // return `placeholder` property, if it is configured to display text, return `text`. // If it not configured to display text, return "" (not nil, because text is applicable for the view if it might // contain text). // Note that there is no alternative to this in XCUI. XCUI contain "value" and "label" and: // 1. none of these are text // 2. you don't know for sure what to check (and thus you can not check for inequality of text, because // most of the time some property will be not equal to some text, and the problem is more serious with regexes) // // E.g. value = "ABC", label = "", visible text is "ABC" // Equality is simple. You can check both value and label and if one matches then the assertion was successful. // // assert(value == "ABC" || label == "ABC") // // But you should not use || with negative assertions and regexes. // // let regex = "^[^A-Z]*$" (has no letters) // assert(value.matches(regex) || label.matches(regex)) // will succeed, because label "" has no letters. // // So in order to test text properly you have to have a single source of information. // // 3. there are some cases where `label` and `value` seems to be a text (for UIButton). Example: // - There is a UIButton // - It has text "X" for state `normal` // - It has text "" for `selected` (or `disabled`) // - It is in the state `selected` (or `disabled`) // - What user sees on the screen: "" (because it is the text for the current state) // - What XCUI sees in accessibility label: "X" // // TODO: enum instead of optional string? // case notApplicapable // case text(String) // // NOTE: Swift signature: // public func mb_testability_text() -> String? - (nullable NSString *)mb_testability_text; // Unique identifier of the element. Can be used to request info about the element, // for example, percentage of visible area of the view, etc. - (nonnull NSString *)mb_testability_uniqueIdentifier; // true: is hidden, can not be visible even after scrolling. // false: we don't know // // TODO: Rename/refactor. // The name should make the reasons to use the function obvious. // And SRP seems to be violated. // // There are multiple reasons to use this property (1 & 2 are quite same though): // 1. Fast check if view is hidden before performing an expensive check. // 2. Ignore temporary cells in collection view that are used for animations. // 3. Check if we can scroll to the element and then perform check for visibility. // E.g.: isDefinitelyHidden == true => we should not even try to scroll // isDefinitelyHidden == false => we should consider scrolling to the view. // - (BOOL)mb_testability_isDefinitelyHidden; - (BOOL)mb_testability_isEnabled; - (BOOL)mb_testability_hasKeyboardFocus; - (nullable id<TestabilityElement>)mb_testability_parent; - (nonnull NSArray<id<TestabilityElement>> *)mb_testability_children; @end <|start_filename|>Frameworks/InAppServices/Sources/Support/AccessibilityForTestAutomation/AccessibilityForTestAutomationInitializer/Implementation/ObjectiveC/LoadSimulatorRuntimeLibrary.h<|end_filename|> #ifdef MIXBOX_ENABLE_IN_APP_SERVICES @import Foundation; #include <dlfcn.h> // Returns handle (may be nil). // Writes error in `error` (may be nil) static void * loadSimulatorRuntimeLibrary( NSString *path, NSString **errorOut) { char const *const localPath = [path fileSystemRepresentation]; void *handle = dlopen(localPath, RTLD_GLOBAL); if (!handle) { char *error = dlerror(); NSString *suffix = @""; if (error) { suffix = [NSString stringWithFormat: @": %@", [NSString stringWithUTF8String:error]]; } if (errorOut) { *errorOut = [NSString stringWithFormat: @"dlopen couldn't open %@ at path %s%@", [path lastPathComponent], localPath, suffix]; } return NULL; } else { if (errorOut) { *errorOut = nil; } return handle; } } #endif <|start_filename|>Frameworks/InAppServices/Sources/Support/AccessibilityForTestAutomation/AccessibilityForTestAutomationInitializer/Implementation/ObjectiveC/LibAccessibilityAccessibilityInitializer/LibAccessibilityAccessibilityInitializer.h<|end_filename|> #ifdef MIXBOX_ENABLE_IN_APP_SERVICES @import Foundation; @interface LibAccessibilityAccessibilityInitializer : NSObject - (nullable NSString *)initializeAccessibilityOrReturnError; @end #endif <|start_filename|>Frameworks/IoKit/Sources/PrivateApi/IOKit/hid/IOHIDEventField.h<|end_filename|> #ifdef MIXBOX_ENABLE_IN_APP_SERVICES #ifndef IOHIDEventField_h #define IOHIDEventField_h // TODO: Update with: // https://opensource.apple.com/source/IOHIDFamily/IOHIDFamily-700/IOHIDFamily/IOHIDEventTypes.h.auto.html // Note that there is `kIOHIDEventFieldDigitizerOrientationType` that can not be found anywhere // Keys used to set and get individual event fields. typedef NS_ENUM(uint32_t, IOHIDEventField) { // NULL kIOHIDEventFieldIsRelative = IOHIDEventFieldBase(kIOHIDEventTypeNULL), kIOHIDEventFieldIsCollection, kIOHIDEventFieldIsPixelUnits, kIOHIDEventFieldIsCenterOrigin, kIOHIDEventFieldIsBuiltIn, // VendorDefined kIOHIDEventFieldVendorDefinedUsagePage = IOHIDEventFieldBase(kIOHIDEventTypeVendorDefined), kIOHIDEventFieldVendorDefinedUsage, kIOHIDEventFieldVendorDefinedVersion, kIOHIDEventFieldVendorDefinedDataLength, kIOHIDEventFieldVendorDefinedData, // Button kIOHIDEventFieldButtonMask = IOHIDEventFieldBase(kIOHIDEventTypeButton), kIOHIDEventFieldButtonNumber, kIOHIDEventFieldButtonClickCount, kIOHIDEventFieldButtonPressure, // Translation kIOHIDEventFieldTranslationX = IOHIDEventFieldBase(kIOHIDEventTypeTranslation), kIOHIDEventFieldTranslationY, kIOHIDEventFieldTranslationZ, // Rotation kIOHIDEventFieldRotationX = IOHIDEventFieldBase(kIOHIDEventTypeRotation), kIOHIDEventFieldRotationY, kIOHIDEventFieldRotationZ, // Scroll kIOHIDEventFieldScrollX = IOHIDEventFieldBase(kIOHIDEventTypeScroll), kIOHIDEventFieldScrollY, kIOHIDEventFieldScrollZ, kIOHIDEventFieldScrollIsPixels, // Scale kIOHIDEventFieldScaleX = IOHIDEventFieldBase(kIOHIDEventTypeScale), kIOHIDEventFieldScaleY, kIOHIDEventFieldScaleZ, // Velocity kIOHIDEventFieldVelocityX = IOHIDEventFieldBase(kIOHIDEventTypeVelocity), kIOHIDEventFieldVelocityY, kIOHIDEventFieldVelocityZ, // Accelerometer kIOHIDEventFieldAccelerometerX = IOHIDEventFieldBase(kIOHIDEventTypeAccelerometer), kIOHIDEventFieldAccelerometerY, kIOHIDEventFieldAccelerometerZ, kIOHIDEventFieldAccelerometerType, // Mouse kIOHIDEventFieldMouseX = IOHIDEventFieldBase(kIOHIDEventTypeMouse), kIOHIDEventFieldMouseY, kIOHIDEventFieldMouseZ, kIOHIDEventFieldMouseButtonMask, kIOHIDEventFieldMouseNumber, kIOHIDEventFieldMouseClickCount, kIOHIDEventFieldMousePressure, // AmbientLightSensor kIOHIDEventFieldAmbientLightSensorLevel = IOHIDEventFieldBase(kIOHIDEventTypeAmbientLightSensor), kIOHIDEventFieldAmbientLightSensorRawChannel0, kIOHIDEventFieldAmbientLightSensorRawChannel1, kIOHIDEventFieldAmbientLightDisplayBrightnessChanged, // Temperature kIOHIDEventFieldTemperatureLevel = IOHIDEventFieldBase(kIOHIDEventTypeTemperature), // Proximity kIOHIDEventFieldProximityDetectionMask = IOHIDEventFieldBase(kIOHIDEventTypeProximity), // Orientation kIOHIDEventFieldOrientationRadius = IOHIDEventFieldBase(kIOHIDEventTypeOrientation), kIOHIDEventFieldOrientationAzimuth, kIOHIDEventFieldOrientationAltitude, // Keyboard kIOHIDEventFieldKeyboardUsagePage = IOHIDEventFieldBase(kIOHIDEventTypeKeyboard), kIOHIDEventFieldKeyboardUsage, kIOHIDEventFieldKeyboardDown, kIOHIDEventFieldKeyboardRepeat, // Digitizer kIOHIDEventFieldDigitizerX = IOHIDEventFieldBase(kIOHIDEventTypeDigitizer), kIOHIDEventFieldDigitizerY, kIOHIDEventFieldDigitizerZ, kIOHIDEventFieldDigitizerButtonMask, kIOHIDEventFieldDigitizerType, kIOHIDEventFieldDigitizerIndex, kIOHIDEventFieldDigitizerIdentity, kIOHIDEventFieldDigitizerEventMask, kIOHIDEventFieldDigitizerRange, kIOHIDEventFieldDigitizerTouch, kIOHIDEventFieldDigitizerPressure, kIOHIDEventFieldDigitizerAuxiliaryPressure, //BarrelPressure kIOHIDEventFieldDigitizerTwist, kIOHIDEventFieldDigitizerTiltX, kIOHIDEventFieldDigitizerTiltY, kIOHIDEventFieldDigitizerAltitude, kIOHIDEventFieldDigitizerAzimuth, kIOHIDEventFieldDigitizerQuality, kIOHIDEventFieldDigitizerDensity, kIOHIDEventFieldDigitizerIrregularity, kIOHIDEventFieldDigitizerMajorRadius, kIOHIDEventFieldDigitizerMinorRadius, kIOHIDEventFieldDigitizerCollection, kIOHIDEventFieldDigitizerCollectionChord, kIOHIDEventFieldDigitizerChildEventMask, kIOHIDEventFieldDigitizerIsDisplayIntegrated, kIOHIDEventFieldDigitizerQualityRadiiAccuracy, kIOHIDEventFieldDigitizerGenerationCount, kIOHIDEventFieldDigitizerWillUpdateMask, kIOHIDEventFieldDigitizerDidUpdateMask, // Swipe kIOHIDEventFieldSwipeMask = IOHIDEventFieldBase(kIOHIDEventTypeSwipe), // Progress kIOHIDEventFieldProgressEventType = IOHIDEventFieldBase(kIOHIDEventTypeProgress), kIOHIDEventFieldProgressLevel }; #endif /* IOHIDEventField_h */ #endif <|start_filename|>Frameworks/IoKit/Sources/PrivateApi/IOKit/IOKitKeys.h<|end_filename|> #ifdef MIXBOX_ENABLE_IN_APP_SERVICES /* * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved. * * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in * compliance with the License. The rights granted to you under the License * may not be used to create, or enable the creation or redistribution of, * unlawful or unlicensed copies of an Apple operating system, or to * circumvent, violate, or enable the circumvention or violation of, any * terms of an Apple operating system software license agreement. * * Please obtain a copy of the License at * http://www.opensource.apple.com/apsl/ and read it before using this file. * * The Original Code and all software distributed under the License are * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. * * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ */ /* * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. * * Common symbol definitions for IOKit. * * HISTORY * */ #ifndef _IOKIT_IOKITKEYS_H #define _IOKIT_IOKITKEYS_H // properties found in the registry root #define kIOKitBuildVersionKey "IOKitBuildVersion" #define kIOKitDiagnosticsKey "IOKitDiagnostics" // a dictionary keyed by plane name #define kIORegistryPlanesKey "IORegistryPlanes" #define kIOCatalogueKey "IOCatalogue" // registry plane names #define kIOServicePlane "IOService" #define kIOPowerPlane "IOPower" #define kIODeviceTreePlane "IODeviceTree" #define kIOAudioPlane "IOAudio" #define kIOFireWirePlane "IOFireWire" #define kIOUSBPlane "IOUSB" // registry ID number #define kIORegistryEntryIDKey "IORegistryEntryID" // IOService class name #define kIOServiceClass "IOService" // IOResources class name #define kIOResourcesClass "IOResources" // IOService driver probing property names #define kIOClassKey "IOClass" #define kIOProbeScoreKey "IOProbeScore" #define kIOKitDebugKey "IOKitDebug" // IOService matching property names #define kIOProviderClassKey "IOProviderClass" #define kIONameMatchKey "IONameMatch" #define kIOPropertyMatchKey "IOPropertyMatch" #define kIOPathMatchKey "IOPathMatch" #define kIOLocationMatchKey "IOLocationMatch" #define kIOParentMatchKey "IOParentMatch" #define kIOResourceMatchKey "IOResourceMatch" #define kIOMatchedServiceCountKey "IOMatchedServiceCountMatch" #define kIONameMatchedKey "IONameMatched" #define kIOMatchCategoryKey "IOMatchCategory" #define kIODefaultMatchCategoryKey "IODefaultMatchCategory" // IOService default user client class, for loadable user clients #define kIOUserClientClassKey "IOUserClientClass" // key to find IOMappers #define kIOMapperIDKey "IOMapperID" #define kIOUserClientCrossEndianKey "IOUserClientCrossEndian" #define kIOUserClientCrossEndianCompatibleKey "IOUserClientCrossEndianCompatible" #define kIOUserClientSharedInstanceKey "IOUserClientSharedInstance" // diagnostic string describing the creating task #define kIOUserClientCreatorKey "IOUserClientCreator" // IOService notification types #define kIOPublishNotification "IOServicePublish" #define kIOFirstPublishNotification "IOServiceFirstPublish" #define kIOMatchedNotification "IOServiceMatched" #define kIOFirstMatchNotification "IOServiceFirstMatch" #define kIOTerminatedNotification "IOServiceTerminate" // IOService interest notification types #define kIOGeneralInterest "IOGeneralInterest" #define kIOBusyInterest "IOBusyInterest" #define kIOAppPowerStateInterest "IOAppPowerStateInterest" #define kIOPriorityPowerStateInterest "IOPriorityPowerStateInterest" #define kIOPlatformDeviceMessageKey "IOPlatformDeviceMessage" // IOService interest notification types #define kIOCFPlugInTypesKey "IOCFPlugInTypes" // properties found in services that implement command pooling #define kIOCommandPoolSizeKey "IOCommandPoolSize" // (OSNumber) // properties found in services that have transfer constraints #define kIOMaximumBlockCountReadKey "IOMaximumBlockCountRead" // (OSNumber) #define kIOMaximumBlockCountWriteKey "IOMaximumBlockCountWrite" // (OSNumber) #define kIOMaximumByteCountReadKey "IOMaximumByteCountRead" // (OSNumber) #define kIOMaximumByteCountWriteKey "IOMaximumByteCountWrite" // (OSNumber) #define kIOMaximumSegmentCountReadKey "IOMaximumSegmentCountRead" // (OSNumber) #define kIOMaximumSegmentCountWriteKey "IOMaximumSegmentCountWrite" // (OSNumber) #define kIOMaximumSegmentByteCountReadKey "IOMaximumSegmentByteCountRead" // (OSNumber) #define kIOMaximumSegmentByteCountWriteKey "IOMaximumSegmentByteCountWrite" // (OSNumber) #define kIOMinimumSegmentAlignmentByteCountKey "IOMinimumSegmentAlignmentByteCount" // (OSNumber) #define kIOMaximumSegmentAddressableBitCountKey "IOMaximumSegmentAddressableBitCount" // (OSNumber) // properties found in services that wish to describe an icon // // IOIcon = // { // CFBundleIdentifier = "com.example.driver.example"; // IOBundleResourceFile = "example.icns"; // }; // // where IOBundleResourceFile is the filename of the resource #define kIOIconKey "IOIcon" // (OSDictionary) #define kIOBundleResourceFileKey "IOBundleResourceFile" // (OSString) #define kIOBusBadgeKey "IOBusBadge" // (OSDictionary) #define kIODeviceIconKey "IODeviceIcon" // (OSDictionary) // property of root that describes the machine's serial number as a string #define kIOPlatformSerialNumberKey "IOPlatformSerialNumber" // (OSString) // property of root that describes the machine's UUID as a string #define kIOPlatformUUIDKey "IOPlatformUUID" // (OSString) // IODTNVRAM property keys #define kIONVRAMDeletePropertyKey "IONVRAM-DELETE-PROPERTY" #define kIODTNVRAMPanicInfoKey "aapl,panic-info" // keys for complex boot information #define kIOBootDeviceKey "IOBootDevice" // dict | array of dicts #define kIOBootDevicePathKey "IOBootDevicePath" // arch-neutral OSString #define kIOBootDeviceSizeKey "IOBootDeviceSize" // OSNumber of bytes // keys for OS Version information #define kOSBuildVersionKey "OS Build Version" #endif /* ! _IOKIT_IOKITKEYS_H */ #endif <|start_filename|>Frameworks/TestsFoundation/Sources/PrivateHeaders/Classdump/XCTest/Xcode_12_0/Xcode_12_0_XCUIRecorderUtilities.h<|end_filename|> #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 140000 && __IPHONE_OS_VERSION_MAX_ALLOWED < 150000 #import "Xcode_12_0_XCTest_CDStructures.h" #import "Xcode_12_0_SharedHeader.h" #import <Foundation/Foundation.h> @class Bool, XCAccessibilityElement; // // Generated by class-dump 3.5 (64 bit). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by <NAME>. // @interface XCUIRecorderUtilities : NSObject { unsigned long long _language; unsigned long long _platform; unsigned long long _compareSnapshotsLikePlatform; XCAccessibilityElement *_previousFocusedAccessibilityElement; NSMutableString *_previousTyping; } + (id)applicationNodeForLanguage:(unsigned long long)arg1; + (unsigned long long)currentPlatform; @property(retain) NSMutableString *previousTyping; // @synthesize previousTyping=_previousTyping; @property(retain) XCAccessibilityElement *previousFocusedAccessibilityElement; // @synthesize previousFocusedAccessibilityElement=_previousFocusedAccessibilityElement; @property unsigned long long _compareSnapshotsLikePlatform; // @synthesize _compareSnapshotsLikePlatform; @property unsigned long long language; // @synthesize language=_language; - (id)performWithKeyModifiersAndBlockNodeForModifierFlags:(unsigned long long)arg1; - (id)gestureNodesForKeyDownEventWithCharacters:(id)arg1 charactersIgnoringModifiers:(id)arg2 modifierFlags:(unsigned long long)arg3 focusedAccessibilityElement:(id)arg4 didAppendToPreviousString:(_Bool *)arg5; - (id)_stringConstantForString:(id)arg1; - (void)clearPreviousTyping; - (id)nodeToFindElementForSnapshots:(id)arg1; - (id)typeKeyNodeForKey:(id)arg1 modifierFlags:(unsigned long long)arg2; - (id)typeStringNodeForString:(id)arg1; - (id)stringForKeyModifierFlags:(unsigned long long)arg1; - (id)simpleGestureNodeForMethodName:(id)arg1; - (id)assertHasFocusNode; - (id)remoteNodeWithButtonSymbolName:(id)arg1; - (id)commentNodeWithString:(id)arg1; - (id)applicationNode; - (id)adjustedSnapshotForApplicationSnapshot:(id)arg1; - (id)focusedAccessibilityElementForApplicationSnapshot:(id)arg1; - (id)snapshotsForAccessibilityElement:(id)arg1 applicationSnapshot:(id)arg2; - (id)snapshotInTreeStartingWithSnapshot:(id)arg1 forElement:(id)arg2; - (id)_snapshotInTreeStartingWithSnapshot:(id)arg1 passingPredicateBlock:(CDUnknownBlockType)arg2; - (id)nodeForOrientationChangeWithSymbolName:(id)arg1; @property unsigned long long platform; // @synthesize platform=_platform; @end #endif <|start_filename|>Tests/Makefile<|end_filename|> pod: bundle install --gemfile=../ci/gemfiles/Gemfile_cocoapods bundle exec --gemfile=../ci/gemfiles/Gemfile_cocoapods pod install <|start_filename|>Frameworks/TestsFoundation/Sources/PrivateHeaders/Classdump/XCTest/Xcode_12_0/Xcode_12_0_XCTPerformanceMeasurement.h<|end_filename|> #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 140000 && __IPHONE_OS_VERSION_MAX_ALLOWED < 150000 #import "Xcode_12_0_XCTest_CDStructures.h" #import "Xcode_12_0_SharedHeader.h" #import <Foundation/Foundation.h> #import <XCTest/XCTMetric.h> // // Generated by class-dump 3.5 (64 bit). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by <NAME>. // #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wunguarded-availability" @interface XCTPerformanceMeasurement () { NSString *_identifier; NSString *_displayName; NSMeasurement *_value; double _doubleValue; NSString *_unitSymbol; long long _polarity; } + (id)displayFriendlyMeasurement:(id)arg1; @property(readonly) long long polarity; // @synthesize polarity=_polarity; - (id)initWithIdentifier:(id)arg1 displayName:(id)arg2 value:(id)arg3 polarity:(long long)arg4; - (id)initWithIdentifier:(id)arg1 displayName:(id)arg2 doubleValue:(double)arg3 unitSymbol:(id)arg4 polarity:(long long)arg5; @end #endif <|start_filename|>ci/swift/Makefile<|end_filename|> %: ./make.sh $@ .PHONY: % <|start_filename|>Frameworks/IoKit/Sources/PrivateApi/IOKit/pwr_mgt/IOPMLib.h<|end_filename|> #ifdef MIXBOX_ENABLE_IN_APP_SERVICES /* * Copyright (c) 1998-2005 Apple Computer, Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in * compliance with the License. Please obtain a copy of the License at * http://www.opensource.apple.com/apsl/ and read it before using this * file. * * The Original Code and all software distributed under the License are * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. * * @APPLE_LICENSE_HEADER_END@ */ #include <CoreFoundation/CFArray.h> #include "IOKitLib.h" #include "IOPMLibDefs.h" #include "IOPMKeys.h" #include <Availability.h> #ifndef _IOKIT_PWRMGT_IOPMLIB_ #define _IOKIT_PWRMGT_IOPMLIB_ #ifdef __cplusplus extern "C" { #endif /*! @header IOPMLib.h IOPMLib provides access to common power management facilities, like initiating system sleep, getting current idle timer values, registering for sleep/wake notifications, and preventing system sleep. */ /*! @function IOPMFindPowerManagement @abstract Finds the Root Power Domain IOService. @param master_device_port Just pass in MACH_PORT_NULL for master device port. @result Returns a io_connect_t handle on the root domain. Must be released with IOServiceClose() when done. */ io_connect_t IOPMFindPowerManagement( mach_port_t master_device_port ) AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER; /*! @function IOPMSetAggressiveness @abstract Sets one of the aggressiveness factors in IOKit Power Management. @param fb Representation of the Root Power Domain from IOPMFindPowerManagement. @param type Specifies which aggressiveness factor is being set. @param aggressiveness New value of the aggressiveness factor. @result Returns kIOReturnSuccess or an error condition if request failed. */ IOReturn IOPMSetAggressiveness (io_connect_t fb, unsigned long type, unsigned long aggressiveness ) AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER; /*! @function IOPMGetAggressiveness @abstract Retrieves the current value of one of the aggressiveness factors in IOKit Power Management. @param fb Representation of the Root Power Domain from IOPMFindPowerManagement. @param type Specifies which aggressiveness factor is being retrieved. @param aggressiveness Points to where to store the retrieved value of the aggressiveness factor. @result Returns kIOReturnSuccess or an error condition if request failed. */ IOReturn IOPMGetAggressiveness ( io_connect_t fb, unsigned long type, unsigned long * aggressiveness ) AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER; /*! @function IOPMSleepEnabled @abstract Tells whether the system supports full sleep, or just doze @result Returns true if the system supports sleep, false if some hardware prevents full sleep. */ boolean_t IOPMSleepEnabled ( void ) AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER; /*! @function IOPMSleepSystem @abstract Request that the system initiate sleep. @discussion For security purposes, caller must be root or the console user. @param fb Port used to communicate to the kernel, from IOPMFindPowerManagement. @result Returns kIOReturnSuccess or an error condition if request failed. */ IOReturn IOPMSleepSystem ( io_connect_t fb ) AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER; /*! @function IOPMCopyBatteryInfo @abstract Request raw battery data from the system. @discussion WARNING! IOPMCoyBatteryInfo is unsupported on ALL Intel CPU based systems. For PPC CPU based systems, it remains not recommended. For almost all purposes, developers should use the richer IOPowerSources API (with change notifications) instead of using IOPMCopyBatteryInfo. Keys to decipher IOPMCopyBatteryInfo's return CFArray exist in IOPM.h. @param masterPort The master port obtained from IOMasterPort(). Just pass MACH_PORT_NULL. @param info A CFArray of CFDictionaries containing raw battery data. @result Returns kIOReturnSuccess or an error condition if request failed. */ IOReturn IOPMCopyBatteryInfo( mach_port_t masterPort, CFArrayRef * info ) AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER; /*! @functiongroup Notifications */ /*! @function IORegisterApp @abstract Connects the caller to an IOService for the purpose of receiving power state change notifications for the device controlled by the IOService. @discussion IORegisterApp requires that the IOService of interest implement an IOUserClient. In addition, that IOUserClient must implement the allowPowerChange and cancelPowerChange methods defined in IOPMLibDefs.h. If you're interested in receiving power state notifications from a device without an IOUserClient, try using IOServiceAddInterestNotification with interest type gIOGeneralInterest instead. @param refcon Data returned on power state change notifications and not used by the kernel. @param theDriver Representation of the IOService, probably from IOServiceGetMatchingService. @param thePortRef Pointer to a port on which the caller will receive power state change notifications. The port is allocated by the calling application. @param callback A c-function which is called during the notification. @param notifier Pointer to a notifier which caller must keep and pass to subsequent call to IODeregisterApp. @result Returns a io_connect_t session for the IOService or MACH_PORT_NULL if request failed. Caller must close return value via IOServiceClose() after calling IODeregisterApp on the notifier argument. */ io_connect_t IORegisterApp( void * refcon, io_service_t theDriver, IONotificationPortRef * thePortRef, IOServiceInterestCallback callback, io_object_t * notifier ) AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER; /*! @function IORegisterForSystemPower @abstract Connects the caller to the Root Power Domain IOService for the purpose of receiving sleep & wake notifications for the system. Does not provide system shutdown and restart notifications. @discussion Provides sleep/wake notifications to applications. Requires that applications acknowledge some, but not all notifications. Register for sleep/wake notifications will deliver these messages over the sleep/wake lifecycle: - kIOMessageSystemWillSleep is delivered at the point the system is initiating a non-abortable sleep. Callers MUST acknowledge this event by calling @link IOAllowPowerChange @/link. If a caller does not acknowledge the sleep notification, the sleep will continue anyway after a 30 second timeout (resulting in bad user experience). Delivered before any hardware is powered off. - kIOMessageSystemWillPowerOn is delivered at early wakeup time, before most hardware has been powered on. Be aware that any attempts to access disk, network, the display, etc. may result in errors or blocking your process until those resources become available. Caller must NOT acknowledge kIOMessageSystemWillPowerOn; the caller must simply return from its handler. - kIOMessageSystemHasPoweredOn is delivered at wakeup completion time, after all device drivers and hardware have handled the wakeup event. Expect this event 1-5 or more seconds after initiating system wakeup. Caller must NOT acknowledge kIOMessageSystemHasPoweredOn; the caller must simply return from its handler. - kIOMessageCanSystemSleep indicates the system is pondering an idle sleep, but gives apps the chance to veto that sleep attempt. Caller must acknowledge kIOMessageCanSystemSleep by calling @link IOAllowPowerChange @/link or @link IOCancelPowerChange @/link. Calling IOAllowPowerChange will not veto the sleep; any app that calls IOCancelPowerChange will veto the idle sleep. A kIOMessageCanSystemSleep notification will be followed up to 30 seconds later by a kIOMessageSystemWillSleep message. or a kIOMessageSystemWillNotSleep message. - kIOMessageSystemWillNotSleep is delivered when some app client has vetoed an idle sleep request. kIOMessageSystemWillNotSleep may follow a kIOMessageCanSystemSleep notification, but will not otherwise be sent. Caller must NOT acknowledge kIOMessageSystemWillNotSleep; the caller must simply return from its handler. To deregister for sleep/wake notifications, the caller must make two calls, in this order: - Call IODeregisterForSystemPower with the 'notifier' argument returned here. - Then call IONotificationPortDestroy passing the 'thePortRef' argument returned here. @param refcon Caller may provide data to receive s an argument to 'callback' on power state changes. @param thePortRef On return, thePortRef is a pointer to an IONotificationPortRef, which will deliver the power notifications. The port is allocated by this function and must be later released by the caller (after calling <code>@link IODeregisterForSystemPower @/link</code>). The caller should also enable IONotificationPortRef by calling <code>@link IONotificationPortGetRunLoopSource @/link</code>, or <code>@link IONotificationPortGetMachPort @/link</code>, or <code>@link IONotificationPortSetDispatchQueue @/link</code>. @param callback A c-function which is called during the notification. @param notifier On success, returns a pointer to a unique notifier which caller must keep and pass to a subsequent call to IODeregisterForSystemPower. @result Returns a io_connect_t session for the IOPMrootDomain or MACH_PORT_NULL if request failed. Caller must close return value via IOServiceClose() after calling IODeregisterForSystemPower on the notifier argument. */ io_connect_t IORegisterForSystemPower ( void * refcon, IONotificationPortRef * thePortRef, IOServiceInterestCallback callback, io_object_t * notifier ) AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER; /*! @function IODeregisterApp @abstract Disconnects the caller from an IOService after receiving power state change notifications from the IOService. (Caller must also release IORegisterApp's return io_connect_t and returned IONotificationPortRef for complete clean-up). @param notifier An object from IORegisterApp. @result Returns kIOReturnSuccess or an error condition if request failed. */ IOReturn IODeregisterApp ( io_object_t * notifier ) AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER; /*! @function IODeregisterForSystemPower @abstract Disconnects the caller from the Root Power Domain IOService after receiving system power state change notifications. (Caller must also destroy the IONotificationPortRef returned from IORegisterForSystemPower.) @param notifier The object returned from IORegisterForSystemPower. @result Returns kIOReturnSuccess or an error condition if request failed. */ IOReturn IODeregisterForSystemPower ( io_object_t * notifier ) AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER; /*! @function IOAllowPowerChange @abstract The caller acknowledges notification of a power state change on a device it has registered for notifications for via IORegisterForSystemPower or IORegisterApp. @discussion Must be used when handling kIOMessageCanSystemSleep and kIOMessageSystemWillSleep messages from IOPMrootDomain system power. The caller should not call IOAllowPowerChange in response to any messages except for these two. @param kernelPort Port used to communicate to the kernel, from IORegisterApp or IORegisterForSystemPower. @param notificationID A copy of the notification ID which came as part of the power state change notification being acknowledged. @result Returns kIOReturnSuccess or an error condition if request failed. */ IOReturn IOAllowPowerChange ( io_connect_t kernelPort, long notificationID ) AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER; /*! @function IOCancelPowerChange @abstract The caller denies an idle system sleep power state change. @discussion Should only called in response to kIOMessageCanSystemSleep messages from IOPMrootDomain. IOCancelPowerChange has no meaning for responding to kIOMessageSystemWillSleep (which is non-abortable) or any other messages. When an app responds to a kIOMessageCanSystemSleep message by calling IOCancelPowerChange, the app vetoes the idle sleep request. The system will stay awake. The idle timer will elapse again after a period of inactivity, and the system will send out the same kIOMessageCanSystemSleep message, and interested applications will respond gain. @param kernelPort Port used to communicate to the kernel, from IORegisterApp or IORegisterForSystemPower. @param notificationID A copy of the notification ID which came as part of the power state change notification being acknowledged. @result Returns kIOReturnSuccess or an error condition if request failed. */ IOReturn IOCancelPowerChange ( io_connect_t kernelPort, long notificationID ) AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER; /*! @functiongroup ScheduledEvents */ /*! @function IOPMSchedulePowerEvent @abstract Schedule the machine to wake from sleep, power on, go to sleep, or shutdown. @discussion This event will be added to the system's queue of power events and stored persistently on disk. The sleep and shutdown events present a graphical warning and allow a console user to cancel the event. Must be called as root. @param time_to_wake Date and time that the system will power on/off. @param my_id A CFStringRef identifying the calling app by CFBundleIdentifier. May be NULL. @param type The type of power on you desire, either wake from sleep or power on. Choose from: CFSTR(kIOPMAutoWake) == wake machine, CFSTR(kIOPMAutoPowerOn) == power on machine, CFSTR(kIOPMAutoWakeOrPowerOn) == wake or power on, CFSTR(kIOPMAutoSleep) == sleep machine, CFSTR(kIOPMAutoShutdown) == power off machine, CFSTR(kIOPMAutoRestart) == restart the machine. @result kIOReturnSuccess on success, otherwise on failure */ IOReturn IOPMSchedulePowerEvent(CFDateRef time_to_wake, CFStringRef my_id, CFStringRef type); /*! @function IOPMCancelScheduledPowerEvent @abstract Cancel a previously scheduled power event. @discussion Arguments mirror those to IOPMSchedulePowerEvent. All arguments must match the original arguments from when the power on was scheduled. Must be called as root. @param time_to_wake Cancel entry with this date and time. @param my_id Cancel entry with this name. @param type Type to cancel @result kIOReturnSuccess on success, otherwise on failure */ IOReturn IOPMCancelScheduledPowerEvent(CFDateRef time_to_wake, CFStringRef my_id, CFStringRef type); /*! @function IOPMCopyScheduledPowerEvents @abstract List all scheduled system power events @discussion Returns a CFArray of CFDictionaries of power events. Each CFDictionary contains keys for CFSTR(kIOPMPowerEventTimeKey), CFSTR(kIOPMPowerEventAppNameKey), and CFSTR(kIOPMPowerEventTypeKey). @result A CFArray of CFDictionaries of power events. The CFArray must be released by the caller. NULL if there are no scheduled events. */ CFArrayRef IOPMCopyScheduledPowerEvents(void); /*! * @defineblock IOPMAssertionDictionaryKeys * * @discussion Keys into dictionaries describing assertions. */ /*! * @define kIOPMAssertionTimeoutKey * @abstract kIOPMAssertionTimeoutKey specifies an outer bound, in seconds, that this assertion should be asserted. * * @discussion If your application hangs, or is unable to complete its assertion task in a reasonable amount of time, * specifying a timeout allows PM to disable your assertion so the system can resume normal activity. * Once a timeout with the <code>@link kIOPMAssertionTimeoutActionTurnOff@/link</code> assertion fires, the level * will be set to <code>@link kIOPMAssertionTimeoutActionTurnOff@/link</code>. The assertion may be re-armed by calling * <code>@link IOPMAssertionSetLevel@/link</code>. * * * This key may be specified in the dictionary passed to <code>@link IOPMAssertionCreateWithProperties@/link</code>. * * This key may be present in the dictionary returned from <code>@link IOPMAssertionCopyProperties@/link</code>. */ #define kIOPMAssertionTimeoutKey CFSTR("TimeoutSeconds") /*! * @define kIOPMAssertionTimeoutActionKey * * @abstract Specifies the action to take upon timeout expiration. * * @discussion Specifying the timeout action only has meaning if you also specify an <code>@link kIOPMAssertionTimeoutKey@/link</code> * If the caller does not specify a timeout action, the default action is <code>@link kIOPMAssertionTimeoutActionTurnOff@/link</code> * * This key may be specified in the dictionary passed to <code>@link IOPMAssertionCreateWithProperties@/link</code>. * * This key may be present in the dictionary returned from <code>@link IOPMAssertionCopyProperties@/link</code>. */ #define kIOPMAssertionTimeoutActionKey CFSTR("TimeoutAction") /*! * @define kIOPMAssertionTimeoutActionLog * * @abstract A potential value for <code>@link kIOPMAssertionTimeoutActionKey@/link</code> * * @discussion When this timeout action is specified, PM will log the timeout event * but will not turn off or affect the setting of the assertion in any way. * */ #define kIOPMAssertionTimeoutActionLog CFSTR("TimeoutActionLog") /*! * @define kIOPMAssertionTimeoutActionTurnOff * * @discussion When a timeout expires with this action, Power Management will log the timeout event, * and will set the assertion's level to <code>@link kIOPMAssertionLevelOff@/link</code>. */ #define kIOPMAssertionTimeoutActionTurnOff CFSTR("TimeoutActionTurnOff") /*! * @define kIOPMAssertionTimeoutActionRelease * * @discussion When a timeout expires with this action, Power Management will log the timeout event, * and will release the assertion. */ #define kIOPMAssertionTimeoutActionRelease CFSTR("TimeoutActionRelease") /*! * @define kIOPMAssertionRetainCountKey * * @discussion kIOPMAssertionRetainCountKey reflects the CoreFoundation-style retain count on this assertion. * Creating or retaining an assertion increments its retain count. * Release an assertion decrements its retain count. * When the retain count decrements to zero, the OS will destroy the object. * * This key can be found in the dictionary returned from <code>@link IOPMAssertionCopyProperties@/link</code>. */ #define kIOPMAssertionRetainCountKey CFSTR("RetainCount") /*! * @define kIOPMAssertionNameKey * * @abstract The CFDictionary key for assertion name. Setting this key is required when you're creating an assertion. * * @discussion <code>kIOPMAssertionNameKey</code> describes the the activity the assertion is protecting. The creator should * specify a CFString value for this key in the dictionary passed to <code>@link IOPMAssertionCreateWithProperties@/link</code> * * The assertion name is separate from the assertion type's behavior - specify a CFString * like "Checking mail" or "Compiling" that describes the task that this assertion protects. * * The CFString you associate with this key does not have to be localizable (OS X will not attempt to localize it.) * * Describe your assertion as thoroughly as possible. See these other keys that can you can also set to add explanation * to an assertion: * OPTIONAL <code>@link kIOPMAssertionDetailsKey@/link</code> * OPTIONAL <code>@link kIOPMAssertionHumanReadableReasonKey @/link</code> * OPTIONAL <code>@link kIOPMAssertionLocalizationBundlePathKey@/link</code> */ #define kIOPMAssertionNameKey CFSTR("AssertName") /*! * @define kIOPMAssertionDetailsKey * * @abstract You may provide extra, contextual information about an assertion for admins and for debugging * in this key. Setting this key in an assertion dictionary is optional. * @discussion Please name your assertion something unique with <code>@link kIOPMAssertionNameKey@/link</code> first. * If you have more data to describe this assertion, put it here as a CFString. * * ' EXAMPLE: OS X creates an assertion named <code>com.apple.powermanagement.tty</code> to prevent sleep for * remote-logged in users. To identify the cause for these assertions, OS X sets <code>kIOPMAssertionDetailsKey</code> * to the CFString device path of the active remote session(s), e.g. "/dev/ttys000 /dev/ttys004" * * The CFString you associate with this key does not have to be localizable (OS X will not attempt to localize it.) * * Describe your assertion as thoroughly as possible. See these other keys that can you can set to add explanation * to an assertion: * REQUIRED <code>@link kIOPMAssertionNameKey@/link</code> * OPTIONAL <code>@link kIOPMAssertionHumanReadableReasonKey @/link</code> * OPTIONAL <code>@link kIOPMAssertionLocalizationBundlePathKey@/link</code> */ #define kIOPMAssertionDetailsKey CFSTR("Details") /*! * @define kIOPMAssertionHumanReadableReasonKey * * @abstract Optional key that provides a localizable string for OS X to display PM Assertions in the GUI. * * @discussion The caller should specify this string in <code>@link IOPMAssertionCreateWithProperties@/link</code>. * If present, OS X may display this string, localized to the user's language, to explain changes in system * behavior caused by the assertion. * * If set, the caller must also specify a bundle path for the key * <code>@link kIOPMAssertionLocalizationBundlePathKey@/link</code> * The bundle at that path should contain localization info for the specified string. * * This key may be specified in the dictionary passed to <code>@link IOPMAssertionCreateWithProperties@/link</code>. * * This key may be present in the dictionary returned from <code>@link IOPMAssertionCopyProperties@/link</code>. * * Describe your assertion as thoroughly as possible. See these other keys that can you can set to add explanation * to an assertion: * REQUIRED <code>@link kIOPMAssertionNameKey@/link</code> * OPTIONAL <code>@link kIOPMAssertionDetailsKey @/link</code> */ #define kIOPMAssertionHumanReadableReasonKey CFSTR("HumanReadableReason") /*! * @define kIOPMAssertionLocalizationBundlePathKey * * @abstract Refers to a CFURL, as a CFString, identifying the path to the caller's * bundle, which contains localization info. * * @discussion The bundle must contain localizations for * <code>@link kIOPMAssertionHumanReadableReasonKey@/link</code> * * This key may be specified in the dictionary passed to <code>@link IOPMAssertionCreateWithProperties@/link</code>. * * This key may be present in the dictionary returned from <code>@link IOPMAssertionCopyProperties@/link</code>. */ #define kIOPMAssertionLocalizationBundlePathKey CFSTR("BundlePath") /*! * @define kIOPMAssertionFrameworkIDKey * * @abstract Specify if the assertion creator is a framework. * * @discussion If the code that creates the assertion resides in a framework or library, the caller * should specify a CFBundleIdentifier, as a CFString, identifying that bundle here. * This info helps developers and administrators determine the source of an assertion. * * This key may be specified in the dictionary passed to <code>@link IOPMAssertionCreateWithProperties@/link</code>. * * This key may be present in the dictionary returned from <code>@link IOPMAssertionCopyProperties@/link</code>. */ #define kIOPMAssertionFrameworkIDKey CFSTR("FrameworkBundleID") /*! * @define kIOPMAssertionPlugInIDKey * * @abstract Specify if the assertion creator is a plugin. * * @discussion If the code that creates the assertion resides in a plugin, the caller * should specify a CFBundleIdentifier, as a CFString, identifying the plugin's bundle here. * This info helps developers and administrators determine the source of an assertion. * * This key may be specified in the dictionary passed to <code>@link IOPMAssertionCreateWithProperties@/link</code>. * * This key may be present in the dictionary returned from <code>@link IOPMAssertionCopyProperties@/link</code>. */ #define kIOPMAssertionPlugInIDKey CFSTR("PlugInBundleID") /*! * @define kIOPMAssertionTypeKey * * @abstract The CFDictionary key for assertion type in an assertion info dictionary. * * @discussion The value for this key will be a CFStringRef, with the value of the assertion * type specified at creation time. * Note that OS X may substitute a support assertion type string if the caller * specifies a deprecated assertion type; in that case the value for this key could * differ from the caller-provided assertion type. */ #define kIOPMAssertionTypeKey CFSTR("AssertType") /*! * @define kIOPMAssertionLevelKey * * @abstract The CFDictionary key for assertion level in an assertion info dictionary. * * @discussion The value for this key will be a CFNumber, kCFNumberIntType with value * <code>kIOPMAssertionLevelOff</code> or <code>kIOPMAssertionLevelOn</code>. * The level reflects the assertion's level set at creation, or adjusted via * <code>@link IOPMAssertionSetLevel@/link</code> */ #define kIOPMAssertionLevelKey CFSTR("AssertLevel") /*! @/defineblock IOPMAssertionDictionary Keys*/ /*! * @typedef IOPMAssertionID * * @abstract Type for AssertionID arguments to <code>@link IOPMAssertionCreateWithProperties@/link</code> * and <code>@link IOPMAssertionRelease@/link</code> */ typedef uint32_t IOPMAssertionID; /*! * @defineblock IOPMAssertionTypes */ /*! * @define kIOPMAssertionTypePreventUserIdleSystemSleep * * @abstract Prevents the system from sleeping automatically due to a lack of user activity. * * @discussion When asserted and set to level <code>@link kIOPMAssertionLevelOn@/link</code>, * will prevent the system from sleeping due to a period of idle user activity. * * The display may dim and idle sleep while kIOPMAssertionTypePreventUserIdleSystemSleep is * enabled, but the system may not idle sleep. * * The system may still sleep for lid close, Apple menu, low battery, or other sleep reasons. * * This assertion does not put the system into Dark Wake. * * A caller publish the AssertionType in its assertion properties dictionary. * The AssertionType should be a key in the properties dictionary, with a value * of a CFNumber containing the kCFNumberIntegerType value * <code>@link kIOPMAssertionLevelOff@/link</code> or <code>@link kIOPMAssertionLevelOn@/link</code>. */ #define kIOPMAssertionTypePreventUserIdleSystemSleep CFSTR("PreventUserIdleSystemSleep") /*! * @define kIOPMAssertionTypePreventUserIdleDisplaySleep * * @abstract Prevents the display from dimming automatically. * * @discussion When asserted and set to level <code>@link kIOPMAssertionLevelOn@/link</code>, * will prevent the display from turning off due to a period of idle user activity. * Note that the display may still sleep from other reasons, like a user closing a * portable's lid or the machine sleeping. * * While the display is prevented from dimming, the system cannot go into idle sleep. * * This assertion does not put the system into Dark Wake. * * A caller publish the AssertionType in its assertion properties dictionary. * The AssertionType should be a key in the properties dictionary, with a value * of a CFNumber containing the kCFNumberIntegerType value * <code>@link kIOPMAssertionLevelOff@/link</code> or <code>@link kIOPMAssertionLevelOn@/link</code>. */ #define kIOPMAssertionTypePreventUserIdleDisplaySleep CFSTR("PreventUserIdleDisplaySleep") /*! * @define kIOPMAssertionTypePreventSystemSleep * * @abstract Prevents the system from sleeping and allows the system to reside in Dark Wake * for an arbitrary length of time. * * @discussion When asserted and set to level <code>@link kIOPMAssertionLevelOn@/link</code>, * the system will prefer to enter the Dark Wake state, or remain in Dark Wake if * already there, rather than go to sleep. * * Assertions are just suggestions to the OS, and the OS can only honor them * to the best of its ability. In the case of low power or a thermal emergency, * the system may sleep anyway despite the assertion. * * An assertion must publish the AssertionType in its assertion properties dictionary. * The AssertionType should be a key in the properties dictionary, with a value * of a CFNumber containing the kCFNumberIntegerType value * <code>@link kIOPMAssertionLevelOff@/link</code> or <code>@link kIOPMAssertionLevelOn@/link</code>. */ #define kIOPMAssertionTypePreventSystemSleep CFSTR("PreventSystemSleep") /*! * @define kIOPMAssertionTypeNoIdleSleep * * @deprecated Deprecated in 10.7; Please use assertion type <code>@link kIOPMAssertionTypePreventUserIdleSystemSleep@/link</code> instead. * * @abstract Pass as the AssertionType argument to <code>@link IOPMAssertionCreate@/link</code>. * The system will not idle sleep when enabled (display may sleep). Note that the system may sleep * for other reasons. * */ #define kIOPMAssertionTypeNoIdleSleep CFSTR("NoIdleSleepAssertion") /*! * @define kIOPMAssertionTypeNoDisplaySleep * * @deprecated Deprecated in 10.7; Please use assertion type <code>@link kIOPMAssertionTypePreventUserIdleDisplaySleep@/link</code>. * * @abstract Use as AssertionType argument to <code>@link IOPMAssertionCreate@/link</code>. * The idle display will not sleep when enabled, and consequently the system will not idle sleep. */ #define kIOPMAssertionTypeNoDisplaySleep CFSTR("NoDisplaySleepAssertion") /*! * @enum kIOPMNullAssertionID * * @abstract This value represents a non-initialized assertion ID * * @constant kIOPMNullAssertionID * This value represents a non-initialized assertion ID. * */ enum { kIOPMNullAssertionID = 0 }; /*! * @typedef IOPMAssertionLevel * * @abstract Type for AssertionLevel argument to IOPMAssertionCreate * * @discussion Possible values for <code>IOPMAssertionLevel</code> are * <code>@link kIOPMAssertionLevelOff@/link</code> * and <code>@link kIOPMAssertionLevelOn@/link</code> */ typedef uint32_t IOPMAssertionLevel; /*! * @enum Assertion Levels */ enum { /*! * @constant kIOPMAssertionLevelOff * @abstract Level for a disabled assertion, passed as an argument to IOPMAssertionCreate. */ kIOPMAssertionLevelOff = 0, /*! * @constant kIOPMAssertionLevelOn * @abstract Level for an enabled assertion, passed as an argument to IOPMAssertionCreate. */ kIOPMAssertionLevelOn = 255 }; /*! * @functiongroup Assertions */ /*! @function IOPMAssertionCreateWithDescription * * @description Creates an IOPMAssertion. This is the preferred API to call to create an assertion. * It allows the caller to specify the Name, Details, and HumanReadableReason at creation time. * There are other keys that can further describe an assertion, but most developers don't need * to use them. Use <code>@link IOPMAssertionSetProperties @/link</code> or * <code>@link IOPMAssertionCreateWithProperties @/link</code> if you need to specify properties * that aren't avilable here. * * @param AssertionType An assertion type constant. * Caller must specify this argument. * * @param Name A CFString value to correspond to key <code>@link kIOPMAssertionNameKey@/link</code>. * Caller must specify this argument. * * @param Details A CFString value to correspond to key <code>@link kIOPMAssertionDetailsKey@/link</code>. * Caller my pass NULL, but it helps power users and administrators identify the * reasons for this assertion. * * @param HumanReadableReason * A CFString value to correspond to key <code>@link kIOPMAssertionHumanReadableReasonKey@/link</code>. * Caller may pass NULL, but if it's specified OS X may display it to users * to describe the active assertions on their sysstem. * * @param LocalizationBundlePath * A CFString value to correspond to key <code>@link kIOPMAssertionLocalizationBundlePathKey@/link</code>. * This bundle path should include a localization for the string <code>HumanReadableReason</code> * Caller may pass NULL, but this argument is required if caller specifies <code>HumanReadableReason</code> * * @param Timeout Specifies a timeout for this assertion. Pass 0 for no timeout. * * @param TimeoutAction Specifies a timeout action. Caller my pass NULL. If a timeout is specified but a TimeoutAction is not, * the default timeout action is <code>kIOPMAssertionTimeoutActionTurnOff</code> * * @param AssertionID (Output) On successful return, contains a unique reference to a PM assertion. * * @result kIOReturnSuccess, or another IOKit return code on error. */ IOReturn IOPMAssertionCreateWithDescription( CFStringRef AssertionType, CFStringRef Name, CFStringRef Details, CFStringRef HumanReadableReason, CFStringRef LocalizationBundlePath, CFTimeInterval Timeout, CFStringRef TimeoutAction, IOPMAssertionID *AssertionID) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3); /*! * @function IOPMAssertionCreateWithProperties * * @abstract Creates an IOPMAssertion with more flexibility than <code>@link IOPMAssertionCreateWithDescription @/link</code>. * @param AssertionType The CFString assertion type to request from the PM system. * @param AssertionLevel Pass <code>@link kIOPMAssertionLevelOn@/link</code> or <code>@link kIOPMAssertionLevelOff@/link</code>. * @param AssertionProperties Caller must describe the assertion to be created, and the caller itself. * @param AssertionID (Output) On successful return, contains a unique reference to a PM assertion. * * @discussion * Create a new PM assertion - the caller must specify the type of assertion, initial level, and its * properties as @link IOPMAssertionDictionaryKeys@/link keys in the <code>AssertionProperties</code> dictionary. * The following keys are recommend and/or required to be specified in the AssertionProperties * dictionary argument. * <ul> * <li> REQUIRED: Define at least one assertion as a key, with its initial level as a value: * <code>@link kIOPMAssertionTypePreventSystemSleep@/link</code> * or <code>@link kIOPMAssertionTypeNoIdleSleep@/link</code> * or <code>@link kIOPMAssertionTypePreventSystemSleep@/link</code> * * <li> REQUIRED: <code>kIOPMAssertionNameKey</code> Caller must describe the name for the activity that * requires the change in behavior provided by the assertion. * * <li> OPTIONAL: <code>kIOPMAssertionDetailsKey</code> Caller may describe context-specific data about the * assertion. * * <li> OPTIONAL: <code>kIOPMAssertionHumanReadableReasonKey</code> Caller may describe the reason for creating the assertion * in a localizable CFString. This should be a human readable phrase that describes the actions the * calling process is taking while the assertion is held, like "Downloading TV episodes", or "Compiling Projects" * * <li> OPTIONAL: <code>kIOPMAssertionLocalizationBundlePathKey</code> Caller may provide its bundle's path, where OS X * can localize for GUI display the CFString specified by <code>@link kIOPMAssertionHumanReadableReasonKey@/link</code>. * * <li> OPTIONAL: <code>kIOPMAssertionPlugInIDKey</code> if the caller is a plugin with a different identity than the process * it's loaded in. * * <li> OPTIONAL: <code>kIOPMAssertionFrameworkIDKey</code> if the caller is a framework acting on behalf of a process. * * <li> OPTIONAL: The caller may specify a timeout. * </ul> */ IOReturn IOPMAssertionCreateWithProperties( CFDictionaryRef AssertionProperties, IOPMAssertionID *AssertionID) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_3_2); /*! * @function IOPMAssertionRetain * * @abstract Increments the assertion's retain count. * @discussion Increments the retain count according to CoreFoundation style retain/release semantics. * Retain count can be inspected in the assertion's info dictionary at * key <code>@link kIOPMAssertionRetainCountKey@/link</code> * @param theAssertion The assertion ID to retain. */ void IOPMAssertionRetain(IOPMAssertionID theAssertion) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_3_2); /*! * @function IOPMAssertionRelease * * @abstract Decrements the assertion's retain count. * * @discussion If the retain count becomes zero, then this also frees and deactivates * the assertion referred to by <code>assertionID</code> * * Calls to <code>@link IOPMAssertionCreate@/link</code> and <code>@link IOPMAssertionRelease@/link</code> * must each be paired with calls to IOPMAssertionRelease. * * @param AssertionID The assertion_id, returned from IOPMAssertionCreate, to cancel. * * @result Returns kIOReturnSuccess on success. */ IOReturn IOPMAssertionRelease(IOPMAssertionID AssertionID) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; /*! * @function IOPMAssertionCopyProperties * @abstract Copies details about an <code>IOPMAssertion</code. * @discussion Returns a dictionary describing an IOPMAssertion's specifications and current state. * @param theAssertion The assertion ID to copy info about. * @result A dictionary describing the assertion with keys specified in See @link IOPMAssertionDictionaryKeys@/link. * It's the caller's responsibility to release this dictionary. */ CFDictionaryRef IOPMAssertionCopyProperties(IOPMAssertionID theAssertion) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_3_2); /*! * @function IOPMAssertionSetProperty * @abstract Sets a property in the assertion. * @discussion Only the process that created an assertion may change its properties. * @param theAssertion The <code>@link IOPMAssertionID@/link</code> of the assertion to modify. * @param theProperty The CFString key, from <code>@link IOPMAssertionDictionaryKeys@/link</code> to modify. * @param theValue The property to set. It must be a CFNumber or CFString, as specified by the property key named in whichProperty. * @result Returns <code>@link kIOReturnNotPriviliged@/link</code> if the caller doesn't * have permission to modify this assertion. * Returns <code>@link kIOReturnNotFound@/link</code> if PM can't locate this assertion. * Returns <code>@link kIOReturnError@/link</code> upon an unidentified error. * Returns <code>@link kIOReturnSuccess@/link</code> otherwise. */ IOReturn IOPMAssertionSetProperty(IOPMAssertionID theAssertion, CFStringRef theProperty, CFTypeRef theValue) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_3_2); /*! * @function IOPMCopyAssertionsByProcess * * @abstract Returns a dictionary listing all assertions, grouped by their owning process. * * @discussion Notes: One process may have multiple assertions. Several processes may * have asserted the same assertion to different levels. * * @param AssertionsByPID On success, this returns a dictionary of assertions per process. * At the top level, keys to the CFDictionary are pids stored as CFNumbers (kCFNumberIntType). * The value associated with each CFNumber pid is a CFArray of active assertions. * Each entry in the CFArray is an assertion represented as a CFDictionary. See the keys * kIOPMAssertionTypeKey and kIOPMAssertionLevelKey. * Caller must CFRelease() this dictionary when done. * * @result Returns kIOReturnSuccess on success. */ IOReturn IOPMCopyAssertionsByProcess(CFDictionaryRef *AssertionsByPID) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; /*! * @function IOPMCopyAssertionsStatus * * @abstract Returns a list of available assertions and their system-wide levels. * * @discussion The system-wide level is the maximum of all individual assertions' levels. * * @param AssertionsStatus On success, this returns a CFDictionary of all assertions currently available. * The keys in the dictionary are the assertion types, and the value of each is a CFNumber that * represents the aggregate level for that assertion. Caller must CFRelease() this dictionary when done. * * @result Returns kIOReturnSuccess on success. */ IOReturn IOPMCopyAssertionsStatus(CFDictionaryRef *AssertionsStatus) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; /*! * @function IOPMAssertionCreate * * @abstract Dynamically requests a system behavior from the power management system. * * @deprecated IOPMAssertionCreate is deprecated in favor of <code>@link IOPMAssertionCreateWithProperties@/link</code>. * Please use that version of this API instead. * * @discussion No special privileges necessary to make this call - any process may * activate a power assertion. * * @param AssertionType The CFString assertion type to request from the PM system. * @param AssertionLevel Pass kIOPMAssertionLevelOn or kIOPMAssertionLevelOff. * @param AssertionID On success, a unique id will be returned in this parameter. * * @result Returns kIOReturnSuccess on success, any other return indicates * PM could not successfully activate the specified assertion. */ IOReturn IOPMAssertionCreate(CFStringRef AssertionType, IOPMAssertionLevel AssertionLevel, IOPMAssertionID *AssertionID) __OSX_AVAILABLE_BUT_DEPRECATED (__MAC_10_5,__MAC_10_6,__IPHONE_2_0, __IPHONE_2_1); /*! * @function IOPMAssertionCreateWithName * * @abstract Dynamically requests a system behavior from the power management system. * * @deprecated IOPMAssertionCreate is deprecated in favor of <code>@link IOPMAssertionCreateWithProperties@/link</code>. * Please use that version of this API instead. * * @discussion No special privileges are necessary to make this call - any process may * activate a power assertion. Caller must specify an AssertionName - NULL is not * a valid input. * * @param AssertionType The CFString assertion type to request from the PM system. * @param AssertionLevel Pass kIOPMAssertionLevelOn or kIOPMAssertionLevelOff. * @param AssertionName A string that describes the name of the caller and the activity being * handled by this assertion (e.g. "Mail Compacting Mailboxes"). Name may be no longer * than 128 characters. * * @param AssertionID On success, a unique id will be returned in this parameter. * * @result Returns kIOReturnSuccess on success, any other return indicates * PM could not successfully activate the specified assertion. */ IOReturn IOPMAssertionCreateWithName( CFStringRef AssertionType, IOPMAssertionLevel AssertionLevel, CFStringRef AssertionName, IOPMAssertionID *AssertionID) AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER; /*! * @functiongroup IOSystemLoadAdvisory */ /*! @define kIOSystemLoadAdvisoryNotifyName @abstract The notification by this name fires when system "SystemLoadAdvisory" status changes. @discussion Pass this string as an argument to register via notify(3). You can query SystemLoadAdvisory state via notify_get_state() when this notification fires - this is more efficient than calling IOGetSystemLoadAdvisory(), and returns an identical combined SystemLoadAdvisory value. */ #define kIOSystemLoadAdvisoryNotifyName "com.apple.system.powermanagement.SystemLoadAdvisory" /*! @typedef IOSystemLoadAdvisoryLevel @abstract Return type for IOGetSystemLoadAdvisory @discussion Value is one of kIOSystemLoadAdvisoryLevelGreat, kIOSystemLoadAdvisoryLevelOK, or kIOSystemLoadAdvisoryLevelBad. */ typedef int IOSystemLoadAdvisoryLevel; enum { kIOSystemLoadAdvisoryLevelBad = 1, kIOSystemLoadAdvisoryLevelOK = 2, kIOSystemLoadAdvisoryLevelGreat = 3 }; /*! @define kIOSystemLoadAdvisoryUserLevelKey @abstract Key for dictionary returned by IOCopySystemLoadAdvisoryDetailed @discussion Indicates user activity constraints on the current SystemLoadAdvisory level. */ #define kIOSystemLoadAdvisoryUserLevelKey CFSTR("UserLevel") /*! @define kIOSystemLoadAdvisoryBatteryLevelKey @abstract Key for dictionary returned by IOCopySystemLoadAdvisoryDetailed @discussion Indicates battery constraints on the current SystemLoadAdvisory level. */ #define kIOSystemLoadAdvisoryBatteryLevelKey CFSTR("BatteryLevel") /*! @define kIOSystemLoadAdvisoryThermalLevelKey @abstract Key for dictionary returned by IOCopySystemLoadAdvisoryDetailed @discussion Indicates thermal constraints on the current SystemLoadAdvisory level. */ #define kIOSystemLoadAdvisoryThermalLevelKey CFSTR("ThermalLevel") /*! @define kIOSystemLoadAdvisoryCombinedLevelKey @abstract Key for dictionary returned by IOCopySystemLoadAdvisoryDetailed @discussion Provides a combined level based on UserLevel, BatteryLevel, and ThermalLevels; the combined level is the minimum of these levels. In the future, this combined level may represent new levels as well. The combined level is identical to the value returned by IOGetSystemLoadAdvisory(). */ #define kIOSystemLoadAdvisoryCombinedLevelKey CFSTR("CombinedLevel") /*! @function IOGetSystemLoadAdvisory @abstract Returns a hint about whether now would be a good time to perform time-insensitive work. @discussion Based on user and system load, IOGetSystemLoadAdvisory determines "better" and "worse" times to run optional or time-insensitive CPU or disk work. Applications may use this result to avoid degrading the user experience. If it is a "Bad" or "OK" time to perform work, applications should slow down and perform work less aggressively. There is no guarantee that the system will ever be in "Great" condition to perform work - all essential work must still be performed even in "Bad", or "OK" times. Completely optional work, such as updating caches, may be postponed indefinitely. Note: You may more efficiently read the SystemLoadAdvisory level using notify_get_state() instead of IOGetSystemLoadAdvisory. The results are identical. notify_get_state() requires that you pass the token argument received by registering for SystemLoadAdvisory notifications. @return IOSystemLoadAdvisoryLevel - one of: kIOSystemLoadAdvisoryLevelGreat - A Good time to perform time-insensitive work. kIOSystemLoadAdvisoryLevelOK - An OK time to perform time-insensitive work. kIOSystemLoadAdvisoryLevelBad - A Bad time to perform time-insensitive work. */ IOSystemLoadAdvisoryLevel IOGetSystemLoadAdvisory( void ); /*! @function IOCopySystemLoadAdvisoryDetailed @abstract Indicates how user activity, battery level, and thermal level each contribute to the overall "SystemLoadAdvisory" level. In the future, this combined level may represent new levels as well. @discussion See dictionary keys defined above. @return Returns a CFDictionaryRef, or NULL on error. Caller must release the returned dictionary. */ CFDictionaryRef IOCopySystemLoadAdvisoryDetailed(void); /*! * @functiongroup CPU Power & Thermal */ /*! * @define kIOPMCPUPowerNotificationKey * @abstract Key to register for BSD style notifications on CPU power or thermal change. */ #define kIOPMCPUPowerNotificationKey "com.apple.system.power.CPU" /*! * @define kIOPMThermalWarningNotificationKey * @abstract Key to register for BSD style notifications on system thermal warnings. */ #define kIOPMThermalWarningNotificationKey "com.apple.system.power.thermal_warning" /*! * @function IOPMCopyCPUPowerStatus * @abstract Copy status of all current CPU power levels. * @discussion The returned dictionary may define some of these keys, * as defined in IOPM.h: * - kIOPMCPUPowerLimitProcessorSpeedKey * - kIOPMCPUPowerLimitProcessorCountKey * - kIOPMCPUPowerLimitSchedulerTimeKey * @param cpuPowerStatus Upon success, a pointer to a dictionary defining CPU power; * otherwise NULL. Pointer will be populated with a newly created dictionary * upon successful return. Caller must release dictionary. * @result kIOReturnSuccess, or other error report. Returns kIOReturnNotFound if * CPU PowerStatus has not been published. */ IOReturn IOPMCopyCPUPowerStatus(CFDictionaryRef *cpuPowerStatus); /*! * @function IOPMGetThermalWarningLevel * @abstract Get thermal warning level of the system. * @result An integer pointer declaring the power warning level of the system. * The value of the integer is one of (defined in IOPM.h): * kIOPMThermalWarningLevelNormal * kIOPMThermalWarningLevelDanger * kIOPMThermalWarningLevelCrisis * Upon success the thermal level value will be found at the * pointer argument. * @result kIOReturnSuccess, or other error report. Returns kIOReturnNotFound if * thermal warning level has not been published. */ IOReturn IOPMGetThermalWarningLevel(uint32_t *thermalLevel); #ifdef __cplusplus } #endif #endif #endif <|start_filename|>Frameworks/TestsFoundation/Sources/PrivateHeaders/Classdump/XCTest/Xcode_12_0/Xcode_12_0_XCTestExpectation.h<|end_filename|> #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 140000 && __IPHONE_OS_VERSION_MAX_ALLOWED < 150000 #import "Xcode_12_0_XCTest_CDStructures.h" #import "Xcode_12_0_SharedHeader.h" #import <Foundation/Foundation.h> #import <XCTest/XCTestExpectation.h> @protocol XCTestExpectationDelegate; // // Generated by class-dump 3.5 (64 bit). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by <NAME>. // @interface XCTestExpectation () { _Bool _fulfilled; _Bool _hasBeenWaitedOn; _Bool _inverted; _Bool _assertForOverFulfill; id <XCTestExpectationDelegate> _delegate; unsigned long long _fulfillmentToken; NSArray *_fulfillCallStackReturnAddresses; unsigned long long _expectedFulfillmentCount; NSString *_expectationDescription; unsigned long long _numberOfFulfillments; unsigned long long _creationToken; NSArray *_creationCallStackReturnAddresses; } + (id)expectationWithDescription:(id)arg1; + (id)compoundOrExpectationWithSubexpectations:(id)arg1; + (id)compoundAndExpectationWithSubexpectations:(id)arg1; @property(readonly, copy) NSArray *creationCallStackReturnAddresses; // @synthesize creationCallStackReturnAddresses=_creationCallStackReturnAddresses; @property(readonly) unsigned long long creationToken; // @synthesize creationToken=_creationToken; @property unsigned long long numberOfFulfillments; // @synthesize numberOfFulfillments=_numberOfFulfillments; - (void)cleanup; @property _Bool hasBeenWaitedOn; // @synthesize hasBeenWaitedOn=_hasBeenWaitedOn; - (void)on_queue_setHasBeenWaitedOn:(_Bool)arg1; @property __weak id <XCTestExpectationDelegate> delegate; // @synthesize delegate=_delegate; @property(readonly, copy) NSArray *fulfillCallStackReturnAddresses; // @synthesize fulfillCallStackReturnAddresses=_fulfillCallStackReturnAddresses; @property(readonly) _Bool on_queue_fulfilled; @property(readonly) _Bool fulfilled; // @synthesize fulfilled=_fulfilled; @property _Bool hasInverseBehavior; @property(readonly) _Bool on_queue_isInverted; @property(nonatomic) unsigned long long fulfillmentCount; @property(readonly) unsigned long long on_queue_fulfillmentToken; @property(readonly) unsigned long long fulfillmentToken; // @synthesize fulfillmentToken=_fulfillmentToken; - (_Bool)_queue_fulfillWithCallStackReturnAddresses:(id)arg1; - (void)fulfill; - (id)description; - (id)init; @end #endif <|start_filename|>Frameworks/TestsFoundation/Sources/PrivateHeaders/Classdump/XCTest/Xcode_12_0/Xcode_12_0_XCSourceCodeTreeNodeEnumerator.h<|end_filename|> #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 140000 && __IPHONE_OS_VERSION_MAX_ALLOWED < 150000 #import "Xcode_12_0_XCTest_CDStructures.h" #import "Xcode_12_0_SharedHeader.h" #import <Foundation/Foundation.h> // // Generated by class-dump 3.5 (64 bit). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by <NAME>. // @interface XCSourceCodeTreeNodeEnumerator : NSObject { NSMutableArray *_remainingNodes; } @property(retain, nonatomic) NSMutableArray *remainingNodes; // @synthesize remainingNodes=_remainingNodes; - (id)nextObject; - (id)initWithNode:(id)arg1; @end #endif <|start_filename|>Frameworks/TestsFoundation/Sources/PrivateHeaders/Classdump/XCTest/Xcode_12_0/Xcode_12_0_XCTestManager_ProtectedResources.h<|end_filename|> #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 140000 && __IPHONE_OS_VERSION_MAX_ALLOWED < 150000 #import "Xcode_12_0_XCTest_CDStructures.h" #import "Xcode_12_0_SharedHeader.h" // // Generated by class-dump 3.5 (64 bit). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by <NAME>. // @protocol XCTestManager_ProtectedResources - (void)_XCT_resetAuthorizationStatusForBundleIdentifier:(NSString *)arg1 resourceIdentifier:(NSString *)arg2 reply:(void (^)(_Bool, NSError *))arg3; @end #endif <|start_filename|>Tests/GrayBoxUiTests/GrayBoxUiTests-Bridging-Header.h<|end_filename|> #import "AllTestsSharedBridgingHeader.h" #import "TestGetter.h" #import "TestSuiteInfo.h" <|start_filename|>Frameworks/TestsFoundation/Sources/PrivateHeaders/Classdump/XCTest/Xcode_12_0/Xcode_12_0_XCTClockMetric.h<|end_filename|> #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 140000 && __IPHONE_OS_VERSION_MAX_ALLOWED < 150000 #import "Xcode_12_0_XCTest_CDStructures.h" #import "Xcode_12_0_SharedHeader.h" #import "Xcode_12_0_XCTMetric_Private.h" #import <Foundation/Foundation.h> #import <XCTest/XCTMetric.h> @class MXMClockMetric; // // Generated by class-dump 3.5 (64 bit). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by <NAME>. // @interface XCTClockMetric () { NSString *_instrumentationName; MXMClockMetric *__underlyingMetric; } + (id)realTime; + (id)monotonicTime; @property(retain, nonatomic) MXMClockMetric *_underlyingMetric; // @synthesize _underlyingMetric=__underlyingMetric; @property(readonly, nonatomic) NSString *instrumentationName; // @synthesize instrumentationName=_instrumentationName; - (id)reportMeasurementsFromStartTime:(id)arg1 toEndTime:(id)arg2 error:(id *)arg3; - (void)didStopMeasuringAtTimestamp:(id)arg1; - (void)didStartMeasuringAtTimestamp:(id)arg1; - (void)willBeginMeasuringAtEstimatedTimestamp:(id)arg1; - (void)prepareToMeasureWithOptions:(id)arg1; - (id)copyWithZone:(struct _NSZone *)arg1; - (id)initWithUnderlyingMetric:(id)arg1; - (id)init; // Remaining properties @end #endif <|start_filename|>Frameworks/Foundation/Sources/ObjectiveC/Exceptions/ObjectiveCExceptionCatcherHelper.h<|end_filename|> #ifdef MIXBOX_ENABLE_IN_APP_SERVICES @import Foundation; NS_ASSUME_NONNULL_BEGIN NS_INLINE void ObjectiveCExceptionCatcherHelper_try(NS_NOESCAPE void(^tryBlock)(), NS_NOESCAPE void(^catchBlock)(NSException *), NS_NOESCAPE void(^finallyBlock)()) { @try { tryBlock(); } @catch (NSException *exception) { catchBlock(exception); } @finally { finallyBlock(); } } NS_ASSUME_NONNULL_END #endif <|start_filename|>Frameworks/IoKit/Sources/PrivateApi/IOKit/OSKext.h<|end_filename|> #ifdef MIXBOX_ENABLE_IN_APP_SERVICES /* * Copyright (c) 2008 Apple Inc. All rights reserved. * * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in * compliance with the License. The rights granted to you under the License * may not be used to create, or enable the creation or redistribution of, * unlawful or unlicensed copies of an Apple operating system, or to * circumvent, violate, or enable the circumvention or violation of, any * terms of an Apple operating system software license agreement. * * Please obtain a copy of the License at * http://www.opensource.apple.com/apsl/ and read it before using this file. * * The Original Code and all software distributed under the License are * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. * * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ */ #ifndef __OSKEXT_H__ #define __OSKEXT_H__ #include <sys/cdefs.h> __BEGIN_DECLS #include <CoreFoundation/CoreFoundation.h> //#include <System/libkern/OSReturn.h> //#include <System/libkern/OSKextLib.h> //#include <System/libkern/OSKextLibPrivate.h> #include <mach/mach.h> #include <mach-o/arch.h> // xxx - should I use "Clear" everywhere I use "Flush" /*! * @header * @ignore CF_EXPORT * @ignore * * The OSKext library provides a comprehensive interface for creating, * examining, and loading kernel extensions (kexts). * * <b>NOTICE:</b> This library is neither thread-safe nor garbage-collection * safe. You must use your own locking with threads sharing access to OSKext. * You can not use this library in an application with garbage collection. */ #pragma mark Types and Constants /******************************************************************************* * Types and Constants *******************************************************************************/ /*! * @typedef OSKextRef * @abstract A reference to a kernel extension object. * * @discussion * The OSKextRef type refers to a KXKext object, which represents a kernel * extension bundle on disk, from an archive, or loaded into the kernel. * OSKext is an opaque type that defines the characteristics and behavior of * OSKext objects. * * The kernel counterpart of OSKext is the OSKext libkern C++ class. */ typedef struct __OSKext * OSKextRef ; #define kOSKextBundleExtension "kext" #define kOSKextMkextExtension "mkext" /*! * @typedef OSKextDiagnosticsFlags * @constant kOSKextDiagnosticsFlagAll * @constant kOSKextDiagnosticsFlagValidation * @constant kOSKextDiagnosticsFlagAuthentication * @constant kOSKextDiagnosticsFlagDependencies * @constant kOSKextDiagnosticsFlagWarnings */ enum { kOSKextDiagnosticsFlagNone = (UInt32) 0x0U, kOSKextDiagnosticsFlagValidation = (UInt32) 0x1U, kOSKextDiagnosticsFlagAuthentication = (UInt32) 0x2U, kOSKextDiagnosticsFlagDependencies = (UInt32) 0x4U, kOSKextDiagnosticsFlagWarnings = (UInt32) 0x8U, kOSKextDiagnosticsFlagAll = (UInt32)0xFFFFFFFFU, }; typedef UInt32 OSKextDiagnosticsFlags; typedef UInt64 OSKextLogFlags; typedef SInt64 OSKextVersion; typedef kern_return_t OSReturn; typedef uint8_t OSKextExcludeLevel; #define kOSKextExcludeNone (0) #define kOSKextExcludeKext (1) #define kOSKextExcludeAll (2) /* Top-level keys for diagnostics dicts. See @link OSKextCopyDiagnostics@/link. */ // xxx - not sure we need to include these, but it's convenient const CFStringRef kOSKextDiagnosticsValidationKey; const CFStringRef kOSKextDiagnosticsAuthenticationKey; const CFStringRef kOSKextDiagnosticsLinkLoadKey; const CFStringRef kOSKextDiagnosticsDependenciesKey; const CFStringRef kOSKextDiagnosticsWarningsKey; #pragma mark Basic CF Functions /********************************************************************* * Basic CF Functions *********************************************************************/ /*! * @function OSKextGetTypeID * @abstract Returns the type identifier for the OSKext opaque type. * * @result The type identifier for the OSKext opaque type. */ CF_EXPORT CFTypeID OSKextGetTypeID(void) ; #pragma mark Module Configuration /********************************************************************* * Module Configuration *********************************************************************/ /*! * @function OSKextSetArchitecture * @abstract Sets the architecture used for operations on kexts. * * @param anArch * An <code>NXArchInfo</code> pointer with cputype/subtype or name set. * Ownership remains with the caller. * Pass <code>NULL</code> to set the architecture to taht of the running kernel. * * @result * <code>true</code> if the architecture was set as desired, * <code>false</code> if <code>anArch</code> was not found; * if <code>false</code>, the architecture will now be that * of the running kernel. * xxx - should it just be left unchanged instead? * * @discussion * The kext library uses this architecture for any architecture-specific * operation, such as property lookups * (see @link OSKextGetValueForInfoDictionaryKey@/link), * dependency resolution, executable access during validation and linking. * The kext architecture is initially that of the running kernel (not of * the user-space process). * * This function looks up the system <code>NXArchInfo</code> struct * for the struct passed in, first using the cputype/subtype, and if that fails, * the name. You can therefore use this function to set the architecture * from an architecture name alone by passing an <code>NXArchInfo</code> struct * with the desired name, * but the cputype/subtype set to CPU_TYPE_ANY and CPU_SUBTYPE_ANY. * * Changing the kext architecture causes all kexts to flush their load info * and dependencies with @link OSKextFlushLoadInfo@/link. */ // xxx - should this also have a flushDependenciesFlag? CF_EXPORT Boolean OSKextSetArchitecture(const NXArchInfo * archInfo) ; /*! * @function OSKextGetArchitecture * @abstract Gets the architecutre used for operations on kexts. * * @result * The architecture used for operations on kexts. * The caller does not own the returned pointer and should not free it. * * @discussion * The kext library uses this architecture for any architecture-specific * operation, such as property lookups * (see @link OSKextGetValueForInfoDictionaryKey@/link), * dependency resolution, executable access during validation and linking. * The kext architecture is initially that of the running kernel (not of * the user-space process). */ CF_EXPORT const NXArchInfo * OSKextGetArchitecture(void) ; /*! * @function OSKextGetRunningKernelArchitecture * @abstract Returns the architecture of the running kernel. * * @result * The architecture of the running kernel. * The caller does not own the returned pointer and should not free it. * * @discussion * This function consults the kernel task and returns a pointer to the * <code>NXArchInfo</code> struct representing its architecture. * The running kernel's architecture does not necessarily match that * of user space tasks (for example, a 32-bit user space task could be * running with a 64-bit kernel, or vice-versa). */ CF_EXPORT const NXArchInfo * OSKextGetRunningKernelArchitecture(void) ; /*! @function OSKextGetLogFlags @param kext The kext to get the log flags. Pass NULL to get the global flag. */ CF_EXPORT OSKextLogFlags OSKextGetLogFlags(OSKextRef kext); /*! @function OSKextSetLogFlags */ CF_EXPORT void OSKextSetLogFlags(OSKextRef kext, OSKextLogFlags logFlags); /*! * @typedef OSKextLogFunction * @abstract * Prototype of a callback function used to log messages from the library. * * @param format A printf(3) style format string. * * @discussion * The default log function simply prints to <code>stderr</code * if <code>msgLogSpec</code> has any bits set. * If you set the log function to <code>NULL</code>, * no log messages will be printed. * * Log messages have no trailing newline, to accommodate system log facilities. */ /* xxx - no CF_EXPORT, compiler dies */ typedef void (*OSKextLogFunction)( OSKextLogFlags flags, const char * format, ...) ; /*! * @function OSKextSetLogFunction * @abstract Sets the function called to log messages. * * @param funct The log function to set. * * @discussion * The default log function simply prints to stderr. If you set the * log function to <code>NULL</code>, no log messages will be printed. * * Log messages have no trailing newline, to accommodate system log facilities. */ CF_EXPORT void OSKextSetLogFunction(OSKextLogFunction func) ; /*! * @function OSKextSetSimulatedSafeBoot * @abstract Sets whether safe boot mode is simulated in the library. * * @param flag <code>true</code> to simulate safe boot mode, * <code>false</code> to not simulate. * * @discussion * Kexts without a valid OSBundleRequired property are not allowed to load * by the kernel when the system has started in safe boot mode. * If you turn on simulated safe boot, the kext library can * catch non-loadable kexts and present appropriate diagnostics. */ CF_EXPORT void OSKextSetSimulatedSafeBoot(Boolean flag) ; /*! * @function OSKextGetSimulatedSafeBoot * @abstract Returns whether safe boot mode is simulated in the library. * * @result * <code>true</code> if safe boot mode is being simulated, * <code>false</code> if not. * * @discussion * Kexts without a valid OSBundleRequired property are not allowed to load * by the kernel when the system has started in safe boot mode. * When simulated safe boot is on, the kext library can * catch non-loadable kexts and present appropriate diagnostics. */ CF_EXPORT Boolean OSKextGetSimulatedSafeBoot(void) ; /*! * @function OSKextGetActualSafeBoot * @abstract Returns whether safe boot mode is active. * * @result * <code>true</code> if safe boot mode is active, * <code>false</code> if not. * * @discussion * Kexts without a valid OSBundleRequired property are not allowed to load * by the kernel when the system has started in safe boot mode. * The kext library ignores actual safe boot mode, leaving decisions * regarding safe boot to the kernel. * If you want to analyze kexts in safe boot mode using the library, * call @link OSKextSetSimulatedSafeBoot@/link. */ // xxx - we used to disallow kexts w/debug-log flags in safe boot, too CF_EXPORT Boolean OSKextGetActualSafeBoot(void) ; /*! * @function OSKextGetSystemExtensionsFolderURLs * @abstract Returns the standard system extension folder URLs. * * @result * An array containing the standard system extension folder URLs. * Ownership follows the * @link //apple_ref/doc/uid/20001148-SW1 Get Rule@/link. * * @discussion * To open all the kexts normally considered for loading by the system, * pass the return value of this function to * @link OSKextCreateKextsFromURLs@/link. */ CF_EXPORT CFArrayRef OSKextGetSystemExtensionsFolderURLs(void) ; /*! * @function OSKextSetRecordsDiagnostics * @abstract Sets whether kexts record diagnostic information. * * @param flags Indicates which diagnostics to record. * * @discussion * The kext library can record diagnostic information for kexts as * problems are encountered. These diagnostics can consume a fair * amount of memory, and should be generated only when desired. * Recording of diagnostics is set to * @link kOSKextDiagnosticsFlagNone@/link by default. * Use this function to turn diagnostics recording off (or back on) * for particular diagnostic types. * * Turning on diagnostics does not calculate or recalculate * diagnostics. Call the various functions that operate on kexts * to begin accumulating diagnostics. * * Turning diagnostics off does not clear any existing diagnostics. * Use @link OSKextFlushDiagnostics@/link explicitly to clear * any diagnostics currently stored. * * See also @link OSKextCopyDiagnostics@/link, * @link OSKextValidate@/link, * @link OSKextAuthenticate@/link, and * @link OSKextResolveDependencies@/link. */ // Could list a pile of see also's here.... CF_EXPORT void OSKextSetRecordsDiagnostics(OSKextDiagnosticsFlags flags) ; /*! * @function OSKextGetRecordsDiagnostics * @abstract * Returns what kinds of diagnostic information kexts record. * * @result * Flags indicating which types of diagnostics are currently * being recorded. You can bitwise-OR or -AND these with other flags * to add or remove diagnostics being recorded with * @link OSKextSetRecordsDiagnostics@/link. */ CF_EXPORT OSKextDiagnosticsFlags OSKextGetRecordsDiagnostics(void) ; /*! * @function OSKextSetUsesCaches * @abstract Sets whether the kext library uses cache files. * * @param flag * <code>true</code> to use caches, * <code>false</code> to not use caches. * * @discussion * The kext library normally uses caches to speed up reading kexts from * the system extensions folders. * Use this function to turn off use of caches; this will cause reading * of kexts to be dramatically slower. * * See also @link OSKextGetUsesCaches@/link. */ CF_EXPORT void OSKextSetUsesCaches(Boolean flag) ; /*! * @function OSKextGetUsesCaches * @abstract * Returns whether the OSKext library uses cache files. * * @result * <code>true</code> if the library uses caches to speed up reading of kexts, * <code>false</code> if it doesn't. * * @discussion * The kext library normally uses caches to speed up reading kexts from * the system extensions folders. * Use this function to check whether the library is using caches. * * See also @link OSKextGetUsesCaches@/link. */ CF_EXPORT Boolean OSKextGetUsesCaches(void) ; #pragma mark Instance Management /********************************************************************* * Instance Management *********************************************************************/ /*! * @function OSKextCreate * @abstract Read a single kext from an on-disk bundle, without plugins. * * @param allocator * The allocator to use to allocate memory for the new object. * Pass <code>NULL</code> or <code>kCFAllocatorDefault</code> * to use the current default allocator. * @param anURL * The location of the bundle for which to create an OSKext object. * @result * An OSKext object created from the bundle at anURL. * Ownership follows the * @link //apple_ref/doc/uid/20001148-103029 Create Rule@/link. * * Returns <code>NULL</code> if there was a memory allocation problem or * if the bundle doesn't exist at anURL (see Discussion). * May return an existing OSKext object with the reference count incremented. * * @discussion * Once a kext has been created, it is cached in memory; the kext bundle cache * is flushed only periodically. OSKextCreate does not check that a cached kext * bundle still exists in the filesystem. If a kext bundle is deleted * from the filesystem, it is therefore possible for OSKextCreate * to return a cached bundle that has actually been deleted. * * OSKext uses a CFBundle briefly during initialization, but in order * to save memory and allow re-reading of kext bundle contents * from disk, does not retain it. Applications can save further memory * by flushing info dictionaries so that they are read from disk again * when needed; see @link OSKextFlushInfoDictionary@/link. */ CF_EXPORT OSKextRef OSKextCreate( CFAllocatorRef allocator, CFURLRef anURL) ; /*! * @function OSKextCreateKextsFromURL * @abstract Reads all kexts at an on-disk URL along with their plugins. * * @param allocator * The allocator to use to allocate memory for the new objects. * Pass <code>NULL</code> or <code>kCFAllocatorDefault</code> * to use the current default allocator. * @param anURL The URL to scan for kernel extensions. * @result * Returns an array containing the kext objects created, * or <code>NULL</code> on failure. * * @discussion * This function scans <code>anURL</code> for kexts. * If <code>anURL</code> represents a kext, * this function reads that kext and its plugins. * If <code>anURL</code> represents a non-kext directory, * this functions scans the directory's immediate contents for kext bundles * and their plugins. It does not scan recursively; only plugins one level * deep are read. * * If given an URL for a kext that is a plugin of another kext, this * function does not scan for further plugins. * * This function does not scan for or read mkext files. Use * @link OSKextCreateKextsFromMkextFile@/link to read an mkext file. * * See @link OSKextCreate OSKextCreate @/link for information * about kext object caching. */ CFArrayRef OSKextCreateKextsFromURL( CFAllocatorRef allocator, CFURLRef anURL) ; /*! * @function OSKextCreateKextsFromURLs * @abstract Reads all kexts at an array on-disk URLs along with their plugins. * * @param allocator * The allocator to use to allocate memory for the new objects. * Pass <code>NULL</code> or <code>kCFAllocatorDefault</code> * to use the current default allocator. * @param arrayOfURLs The URLs to scan for kernel extensions. * @result * Returns an array containing the kext objects created, * or <code>NULL</code> on failure. * * @discussion * This function scans each URL in <code>arrayOfURLs</code> for kexts. * If a given URL represents a kext, * this function reads that kext and its plugins. * If the URL represents a non-kext directory, this functions scans the * directory's immediate contents for kext bundles and their plugins. * It does not scan recursively; only plugins one level deep are read. * * If given an URL for a kext that is a plugin of another kext, this * function does not scan for further plugins. * * This function does not scan for or read mkext files. Use * @link OSKextCreateKextsFromMkextFile@/link to read an mkext file. * * See @link OSKextCreate@/link for discussion about kext object caching. */ CF_EXPORT CFArrayRef OSKextCreateKextsFromURLs( CFAllocatorRef allocator, CFArrayRef arrayOfURLs) ; /*! * @function OSKextGetAllKexts * @abstract * Returns an array containing all of the kexts currently open in the application. * * @result * A CFArray object containing OSKext objects for each open kext * in the application. Ownership follows the * @link //apple_ref/doc/uid/20001148-SW1 Get Rule@/link. * * @discussion * This function is potentially expensive, so use with care. */ CF_EXPORT CFArrayRef OSKextGetAllKexts(void) ; /*! @function OSKextCopyKextsWithIdentifier */ CF_EXPORT CFArrayRef OSKextCopyKextsWithIdentifier(CFStringRef bundleID); /*! @function OSKextGetKextsWithIdentifiers @discussion Follows Create Rule. */ CF_EXPORT CFArrayRef OSKextGetKextsWithIdentifiers(CFArrayRef bundleIDs); /*! * @function OSKextGetKextWithIdentifierAndVersion * @abstract * Locate a kext given its program-defined identifier and version. * * @param aBundleID * The identifier of the kext to locate. * Note that identifier names are case-sensitive. * @param aVersion * The version of the kext to locate. * @result * An OSKext object, or <code>NULL</code> if the kext was not found. * Ownership follows the * @link //apple_ref/doc/uid/20001148-SW1 Get Rule@/link. * * @discussion * For a kext to be located using its identifier and version, * the kext object must have already been created. * See @link OSKextGetKextWithIdentifierAndVersion@/link for more. */ // xxx - check on same-version ordering with folks CF_EXPORT OSKextRef OSKextGetKextWithIdentifierAndVersion( CFStringRef aBundleID, OSKextVersion aVersion) ; /*! * @function OSKextGetKextsWithIdentifier * @abstract Locate all kexts with a given program-defined identifier. * * @param aBundleID * The identifier of the kext to locate. * Note that identifier names are case-sensitive. * @result * An CFArray of kext objects with the given identifier, * or <code>NULL</code> on error. * Ownership follows the * @link //apple_ref/doc/uid/20001148-103029 Create Rule@/link. * * @discussion * This function is useful for locating duplicates of a given kext. * * See @link OSKextGetKextWithIdentifier@/link for general information * on looking up kexts by identifier. */ CF_EXPORT CFArrayRef OSKextCopyKextsWithIdentifier( CFStringRef aBundleID) ; /*! * @function OSKextGetLoadedKextWithIdentifier * @abstract * Locate the loaded kext with a given program-defined identifier. * * @param aBundleID * The identifier of the kext to locate. * Note that identifier names are case-sensitive. * @result * An OSKext object, or <code>NULL</code> if the kext was not found. * Ownership follows the * @link //apple_ref/doc/uid/20001148-SW1 Get Rule@/link. * * @discussion * You must call @link OSKextReadLoadedKextInfo@/link before calling this * function for it to find anything. * * See @link OSKextGetKextWithIdentifier@/link for general information * on looking up kexts by identifier. */ CF_EXPORT OSKextRef OSKextGetLoadedKextWithIdentifier( CFStringRef aBundleID) ; /*! * @function OSKextGetCompatibleKextWithIdentifier * @abstract * Locate the kext with a given program-defined identifier * that is compatible with a requested version. * * @param aBundleID * The identifier of the kext to locate. * Note that identifier names are case-sensitive. * @param requestedVersion * The version that the kext must be compatible with. * @result * An OSKext object, or <code>NULL</code> if the kext was not found. * Ownership follows the * @link //apple_ref/doc/uid/20001148-SW1 Get Rule@/link. * * @discussion * A kext is compatible with a version if that version lies between * its CFBundleVersion and its OSBundleCompatibleVersion (inclusive). * * See @link OSKextGetKextWithIdentifier@/link for general information * on looking up kexts by identifier. */ CF_EXPORT OSKextRef OSKextGetCompatibleKextWithIdentifier( CFStringRef aBundleID, OSKextVersion requestedVersion) ; #pragma mark Basic Accessors /********************************************************************* * Basic Accessors *********************************************************************/ /*! * @function OSKextGetURL * @abstract Returns the CFURL of a kext bundle. * * @param aKext The kext to get the URL for. * @result A CFURL object. Ownership follows the * @link //apple_ref/doc/uid/20001148-SW1 Get Rule@/link. * * @discussion * This function returns the CFURL that <code>aKext</code> * was originally created with. * It should be resolved to its base for comparison with other kext * URLs. */ CF_EXPORT CFURLRef OSKextGetURL(OSKextRef aKext) ; // always absolute /*! * @function OSKextGetIdentifier * @abstract Returns the bundle identifier from a kext's information property list. * * @param aKext The kext to get the identifier for. * @result * A CFString object containing the kext bundle's identifier, * or <code>NULL</code> if none was specified in the information property list. * Ownership follows the * @link //apple_ref/doc/uid/20001148-SW1 Get Rule@/link. */ CF_EXPORT CFStringRef OSKextGetIdentifier(OSKextRef aKext) ; /*! * @function OSKextGetValueForInfoDictionaryKey * @abstract * Returns a (possibly architecture-specific) value * in a kext's information dictionary. * * @param aKext The kext to get the property for. * @param key The base key identifying the property. * @result * A value corresponding to <code>key</code> in <code>aKext</code>'s * information dictionary. * If available, an architecture-specific value is returned, * otherwise the global value is returned. Ownership follows the * @link //apple_ref/doc/uid/20001148-SW1 Get Rule@/link. * * @discussion * This function first looks for a property value specific to the current kext * architecture, as set with @link OSKextSetArchitecture@/link, * by appending an underscore plus the architecture name to the base key. * If such a value is not found, it looks for the property using the base key. * For example, if the currently set architecture is i386, and * IOKitPersonalities is requested, this function looks up the key * IOKitPersonalities_i386; if that doesn't exist, then it uses * IOKitPersonalities. * * Some properties are not allowed to be made architecture-specific; * if such keys are defined, they are ignored by this function: * * * CFBundleIdentifier * * CFBundleVersion * * CFBundleExecutable * * OSBundleIsInterface * * OSKernelResource * * This function looks up architecture-specific values for generic bundle * properties, such as CFBundlePackageType, but such values are of course * ignored by CFBundle. * * If you want to look up a property with a raw key, get the information * dictionary directly using @link OSKextCopyInfoDictionary@/link or * by opening a CFBundle for the kext's URL. * * This function reads the info dictionary from disk if necessary. * See @link OSKextFlushInfoDictionary@/link. */ CF_EXPORT CFTypeRef OSKextGetValueForInfoDictionaryKey( OSKextRef aKext, CFStringRef key) ; /*! * @function OSKextCopyInfoDictionary * @abstract Returns a copy of a kext's information dictionary. * * @param aKext The kext to get the information dictionary for. * @result * A CFDictionary object containing the data stored in the kext's * information property list. * OSKext may add extra keys to this dictionary for its own use. * Ownership follows the * @link //apple_ref/doc/uid/20001148-103029 Create Rule@/link. * * @discussion * This function uses @link IOCFUnserialize@/link to parse the XML * of the info dictionary, in order to match the parsing used in the kernel. */ CF_EXPORT CFMutableDictionaryRef OSKextCopyInfoDictionary(OSKextRef aKext) ; /*! * @function OSKextFlushInfoDictionary * @abstract Releases a kext's info dictionary. * * @param aKext The kext that should release its info dictionary. * If <code>NULL</code>, all open kexts' info dictionaries * are flushed. * * @discussion * OSKexts accumulate a fair amount of information as they are created * and used; when many kext objects are created the total memory * consumption can be significant. If an application won't be using * kexts for long periods of time, it can flush this information * to save memory; the information will later be re-read from disk * or recreated as necessary. * * Flushing info dictionaries also allows kext objects to synchronize * with updates on disk; they will automatically re-sort in the * internal lookup tables to reflect changed versions, for example. * (xxx - well they will! that's not fully implemented yet) * * See also @link OSKextFlushDependencies@/link, * @link OSKextFlushLoadInfo@/link, * and @link OSKextFlushDiagnostics@/link. * * Kext objects created from an mkext cannot flush their info * dictionaries. */ CF_EXPORT void OSKextFlushInfoDictionary(OSKextRef aKext) ; /*! * @function OSKextGetVersion * @abstract Returns the version of a kext. * * @param aKext The kext to get the version for. * @result The version of the kext as a 64-bit integer. * * @discussion * xxx - needs more info on version format * xxx - need to fix definition of OSKextVersion. */ CF_EXPORT OSKextVersion OSKextGetVersion(OSKextRef aKext) ; /*! * @function OSKextGetCompatibleVersion * @abstract Returns the compatible version of a kext * * @param aKext The kext to get the compatible version for. * @result The compatible version of the kext as a 64-bit integer. * * @discussion * This function returns the value of a kext's OSBundleCompatibleVersion * property, parsed into a 64-bit integer that can be compared using * standard integer comparison operators. * * xxx - needs more info on version format, ref to tn: http://developer.apple.com/technotes/tn/tn1132.html */ CF_EXPORT OSKextVersion OSKextGetCompatibleVersion(OSKextRef aKext) ; /*! * @function OSKextCopyUUIDForArchitecture * @abstract * Returns the compiler-generated UUID of a kext for a given architecture. * * @param aKext The kext to get the UUID for. * @param anArch The architecture desired. * Pass <code>NULL</code> to get the UUID for the * current architecture. * @result * A CFData object containing the UUID of the kext's executable * for <code>anArch</code>, or the currently set architecture if * <code>anArch</code> is <code>NULL</code>. * * @discussion * UUIDs are used in addition to bundle versions to check the identify of * kexts loaded in the kernel. */ CF_EXPORT CFDataRef OSKextCopyUUIDForArchitecture(OSKextRef aKext, const NXArchInfo * anArch) ; /*! * @function OSKextIsKernelComponent * @abstract Returns whether a kext represents a kerne programming interface. * * @param aKext The kext to examine. * @result * <code>true</code> if <code>aKext</code> represents * a kerne programming interface, <code>false</code> otherwise. * * @discussion * A small set of kexts represent interfaces built into the kernel that can * be linked against individually. These are commonly known as * kernel programming interfaces (KPIs), * and the kexts containing them as "pseudokexts". * * If a kext is a kernel component, then it is also always an interface * (see @link OSKextIsInterface@/link). */ CF_EXPORT Boolean OSKextIsKernelComponent(OSKextRef aKext) ; /*! * @function OSKextIsInterface * @abstract * Returns whether a kext acts as a linkage subset for another kext, * also known as a symbol set. * * @param aKext The kext to examine. * @result * <code>true</code> if <code>aKext</code> is an interface kext, * <code>false</code> otherwise. * * @discussion * An interface kext has no actual code in its executable, but merely * re-exports a set of symbols (typically a subset) * from those of its dependencies. * * Currently the only interface kexts are the kernel component kexts * the define the kernel programming interfaces for Mac OS X. */ CF_EXPORT Boolean OSKextIsInterface(OSKextRef aKext) ; /*! * @function OSKextIsLibrary * @abstract Returns whether a kext can be declared as a library. * * @param aKext The kext to examine. * @result * <code>true</code> if <code>aKext</code> is a library kext, <code>false</code> * otherwise. * * @discussion * A kext is a library kext if it has a valid OSBundleCompatibleVersion * property. Another kext can link against a library kext by listing * the library's identifier and required version in its OSBundleLibraries * property. */ CF_EXPORT Boolean OSKextIsLibrary(OSKextRef aKext) ; /*! * @function OSKextDeclaresExecutable * @abstract Returns whether a kext declares a CFBundleExecutable property. * * @param aKext The kext to examine. * @result * <code>true</code> if <code>aKext</code> has a nonempty CFBundleExecutable * property, <code>false</code> otherwise. * * @discussion * A kext with an executable is either a loadable kext with actual executable * code, or an interface kext whose executable serves to restrict linkage * to a subset of the symbols of another kext. See @link OSKextIsInterface@/link * for more on the latter type. */ CF_EXPORT Boolean OSKextDeclaresExecutable(OSKextRef aKext) ; /*! * @function OSKextHasLogOrDebugFlags * @abstract * Returns whether a kext has OSBundleEnableKextLogging set to a true value or * any of its IOKitPersonalities has a nonzero IOKitDebug property. * * @param aKext The kext to examine. * @result * <code>true</code> if <code>aKext</code> has a true OSBundleEnableKextLogging * property or if any personality for the currently set architecture has a * nonzero IOKitDebug property, <code>false</code> otherwise. * * @discussion * Kexts built for distribution should not have any logging or debug flags set. */ CF_EXPORT Boolean OSKextHasLogOrDebugFlags(OSKextRef aKext) ; /*! * @function OSKextIsLoadableInSafeBoot * @abstract Returns whether the kernel will load a kext during safe boot. * * @param aKext The kext to examine. * @result * <code>true</code> if the kernel will allow <code>aKext</code> during * safe boot, <code>false</code> otherwise. * * @discussion * A kext is loadable during safe boot if it has an OSBundleRequired * property for the kernel's architecture with a value of * "Root", "Local-Root", "Network-Root", "Console", or "Safe Boot". * * This function does not generally cover the issue of loadability due * to problems with validation, authentication, or dependency resolution. * To determine whether a kext can actually be loaded, use * @link OSKextIsLoadable@/link. */ CF_EXPORT Boolean OSKextIsLoadableInSafeBoot(OSKextRef aKext) ; /*! * @function OSKextCopyArchitectures * @abstract * Returns a list of <code>NXArchInfo</code> structs for the architectures * found in a kext's executable. * * @param aKext The kext to examine. * @result * A <code>NULL</code>-terminated list of <code>NXArchInfo</code> * struct pointers describing * the architectures supported by <code>aKext</code>, * or <code>NULL</code> if <code>aKext</code> has no executable. * The caller is responsible for freeing the list, but not the individual * <code>NXArchInfo</code> pointers. */ CF_EXPORT const NXArchInfo ** OSKextCopyArchitectures(OSKextRef aKext) ; /*! * @function OSKextSupportsArchitecture * @abstract Returns whether a kext has an executable for a given architecture. * * @param aKext The kext to examine. * @param anArch The <code>NXArchInfo</code> description to check. * If <code>NULL</code>, uses the currently set architecture. * @result * <code>true</code> if <code>aKext</code>'s executable contains code for * <code>anArch</code>. * * @discussion */ // null for current (NOT host) arch Boolean OSKextSupportsArchitecture(OSKextRef aKext, const NXArchInfo * anArch) ; // if NULL, uses current default /*! * @function OSKextCopyPlugins * @abstract Retrieve the plugins of a kext. * * @param aKext The kext to get plugins for. * @result * An array containing the kexts that are plugins of <code>aKext</code>. * * @discussion * This function scans the plugins folder of <code>aKext</code> * and returns an array of the kexts found. * This may result in the creation of new kext objects. * * If <code>aKext</code> is a plugin of another kext * see @link OSKextIsPlugin@/link), * this function returns an empty array. */ CF_EXPORT CFArrayRef OSKextCopyPlugins(OSKextRef aKext) ; /*! * @function OSKextIsPlugin * @abstract Returns whether a kext is a plugin of some other kext. * * @param aKext The kext to examine. * @result * <code>true</code> if <code>aKext</code> is a plugin of another kext, * <code>false</code> otherwise. * * @discussion * This function uses a simple algorithm that just checks for the substring * ".kext/" in the absolute path leading up to the kext's bundle name. */ CF_EXPORT Boolean OSKextIsPlugin(OSKextRef aKext) ; /*! * @function OSKextCopyContainerForPluginKext * @abstract Returns the kext that is the container for a plugin kext. * * @param aKext The kext to find a parent for. * @result * The kext that contains <code>aKext</code> in its PlugIns folder, * or <code>NULL</code> if <code>aKext</code> is not a plugin. * Ownership follows the * @link //apple_ref/doc/uid/20001148-103029 Create Rule@/link. * * @discussion * This function creates a kext object for the longest portion of the * path leading to <code>aKext</code>, then checks to see whether * <code>aKext</code> is a plugin of that kext by <code>CFBundle</code>'s * semantics. If so, that kext is returned. * This may result in the creation of a new kext. */ CF_EXPORT OSKextRef OSKextCopyContainerForPluginKext(OSKextRef aKext) ; /*! * @function OSKextCopyPersonalitiesArray * @abstract Returns the personalities of a kext for the current kext architecture. * * @param aKext The kext to retrieve personalities for. * @result An array of IOKit personality dictionaries. * * @discussion * IOKitPersonalities in kexts require some processing before being sent * to the kernel, and the functions that send personalities expect an array * rather than a dictionary. This function facilitates such use. * * Use @link OSKextGetValueForInfoDictionaryKey@/link to retrieve the raw * personalities dictionary for the current architecture. */ CF_EXPORT CFArrayRef OSKextCopyPersonalitiesArray(OSKextRef aKext) ; // xxx - would it be awful to have a function that takes a CFTypeRef that's // xxx - a single kext, an array of kexts, or NULL for all open kexts? /*! * @function OSKextCopyPersonalitiesOfKexts * @abstract * Returns the personalities of multiple kexts for the current kext architecture. * * @param kextArray The kexts to retrieve personalities for. * Pass <code>NULL</code> to retrieve personalities for all open kexts. * @result An array of IOKit personality dictionaries. * * @discussion * IOKitPersonalities in kexts require some processing before being sent * to the kernel, and the functions that send personalities expect an array * rather than a dictionary. This function facilitates such use. */ CF_EXPORT CFArrayRef OSKextCopyPersonalitiesOfKexts(CFArrayRef kextArray) ; /*! * @function OSKextCopyExecutableForArchitecture * @abstract * Returns a kext's Mach-O executable, thinned to a single architecture * if desired. * * @param aKext The kext to retrieve the executable from. * @param anArch The architecture desired. * Pass <code>NULL</code> to get the whole, unthinned exectuable. * @result * A <code>CFData</code> object containing the code * for the specified architecture, or <code>NULL</code> if it can't be found. * * @discussion * Note that this function does not use the default kext architecture set by * @link OSKextSetArchitecture@/link when given no architecture. */ CF_EXPORT CFDataRef OSKextCopyExecutableForArchitecture(OSKextRef aKext, const NXArchInfo * anArch) ; /*! * @function OSKextCopyResource * @abstract Returns a named resource from a kext's bundle. * * @param aKext The kext to get a resource from. * @param resourceName The name of the requested resource. * @param resourceType The abstract type of the requested resource. * The type is expressed as a filename extension, * such as <code>jpg</code>. * Pass <code>NULL</code> if you don’t need * to search by type. * * @result * A <code>CFData</code> object containing the resource file's contents, * or <code>NULL</code> if the resource can't be found. * * @discussion * For a kext created from an on-disk URL, this function uses CFBundle * semantics to locate the resource file. Note that localized resources * and resource subdirectories are not available to kexts calling * @link //apple_ref/c/func/OSKextRequestResource OSKextRequestResource@/link * from within the kernel (because the process providing them runs as root). * You can store such resources in a kext bundle and use them in applications, * but they will not be available to the kext loaded in kernel. */ CF_EXPORT CFDataRef OSKextCopyResource( OSKextRef aKext, CFStringRef resourceName, CFStringRef resourceType) ; #pragma mark Dependency Resolution /********************************************************************* * Dependency Resolution *********************************************************************/ /*! * @function OSKextResolveDependencies * @abstract Calculate the dependency graph for a kext. * * @param aKext The kext to resolve dependencies for. * @result * <code>true</code> if all dependencies are successfully resolved, * <code>false</code> otherwise. * * @discussion * This function examines the OSBundleLibraries property of <code>aKext</code> * and looks for compatible open kexts. Priority is given to kexts marked as * loaded (see @link OSKextReadLoadedKextInfo@/link and * @link OSKextFlushLoadInfo@/link). Otherwise the most recent * compatible version is used; if multiple kexts with the same identifier and * version exist, the last one created is used. * * Any problems resolving dependencies are stored in a diagnostics dictionary, * which you can retrieve using @link OSKextCopyDiagnostics@/link. * * If a kext's dependencies have already been resolved, this function does * no work and returns <code>true</code>. * If you want to recalculate a kext's dependencies, call * @link OSKextFlushDependencies@/link first. */ // xxx - check on same-version ordering with folks CF_EXPORT Boolean OSKextResolveDependencies(OSKextRef aKext) ; /*! * @function OSKextFlushDependencies * @abstract Clears the dependency graph of a kext. * * @param aKext The kext to flush dependencies for. * Pass <code>NULL</code> to flush dependencies for all kexts. * * @discussion * OSKexts accumulate a fair amount of information as they are created * and used; when many kext objects are created the total memory * consumption can be significant. If an application won't be using * kexts for long periods of time, it can flush this information * to save memory; the information will later be re-read from disk * or recreated as necessary. * * Flushing dependencies is also useful when readling loaded kext * information from the kernel with @link OSKextReadLoadedKextInfo@/link * (in fact, that function takes a flag to do it as part of its work). * Dependency resolution gives priority to kexts marked as loaded, * so it's wise to call flush dependencies before reading load info * and before doing any operation that resolves dependencies. * Conversely, if you want to resolve dependencies without consideration * for which kexts are loaded, call @link OSKextFlushLoadInfo@/link * beforehand (with or without the flag to flush dependencies). * * This function also clears any dependency resolution diagnostics. * See also @link OSKextFlushInfoDictionary@/link, * @link OSKextFlushLoadInfo@/link, * and @link OSKextFlushDiagnostics@/link. */ CF_EXPORT void OSKextFlushDependencies(OSKextRef aKext) ; /*! * @function OSKextCopyDeclaredDependencies * @abstract Returns the kexts identified in a kext's OSBundleLibraries property. * * @param aKext The kext to get dependencies for. * @param needAllFlag If <code>true</code>, the function returns * <code>NULL</code> if any dependency isn't found. * @result * A <code>CFArray</code> containing the kexts found. * If <code>needAllFlag</code> is <code>false</code>, the array may be missing * some kexts. If <code>needAllFlag</code> is <code>true</code> and not all * dependencies are found, this function returns <code>NULL</code>. * * @discussion * This function calls @link OSKextResolveDependencies@/link to find * dependencies. */ CF_EXPORT CFArrayRef OSKextCopyDeclaredDependencies( OSKextRef aKext, Boolean needAllFlag) ; /*! * @function OSKextCopyLinkDependencies * @abstract Returns the kexts that a kext links directly against. * * @param aKext The kext to get dependencies for. * @param needAllFlag If <code>true</code>, the function returns * <code>NULL</code> if any dependency isn't found. * @result * A <code>CFArray</code> containing the kexts found. * If <code>needAllFlag</code> is <code>false</code>, the array may be missing * some kexts. If <code>needAllFlag</code> is <code>true</code> and not all * dependencies are found, this function returns <code>NULL</code>. * * @discussion * Link dependencies are how loaded kext relationships are tracked * in the kernel (as shown by the <code>kextstat(8)</code> program). * Some library kexts contain no executable, merely collecting sets of * other libraries for convenience or compatiblity purposes. * This function follows through such indirect libraries to find kexts * with executables that <code>aKext</code> will actually link against. * * This function calls @link OSKextResolveDependencies@/link to find * dependencies. */ // xxx - need to insert a manpage link on kextstat CF_EXPORT CFArrayRef OSKextCopyLinkDependencies( OSKextRef aKext, Boolean needAllFlag) ; /*! * @function OSKextCopyLoadList * @abstract * Returns the entire list of kexts in the load graph of a kext * (including that kext). * * @param aKext The kext to get the load list for. * @param needAllFlag If <code>true</code>, the function returns * <code>NULL</code> if any dependency isn't found. * @result * A <code>CFArray</code> containing the kexts found. * If <code>needAllFlag</code> is <code>false</code>, the array may be missing * some kexts. If <code>needAllFlag</code> is <code>true</code> and not all * dependencies are found, this function returns <code>NULL</code>. * * @discussion * The fully-resolved load list represents all the kexts needed to load * <code>aKext</code> into the kernel, in an order guaranteed to work for * sequential starting and matching with IOKit personalities. * * This function calls @link OSKextResolveDependencies@/link to find * dependencies. */ CF_EXPORT CFMutableArrayRef OSKextCopyLoadList( OSKextRef aKext, Boolean needAllFlag) ; /*! * @function OSKextCopyLoadListForKexts * @abstract * Returns the entire list of kexts in load order of the merged load graph * of the provided list of kexts (including those kexts). * * @param kexts The kexts to get the load list for. * @param needAllFlag If <code>true</code>, the function returns * <code>NULL</code> if any dependency isn't found. * * @result * A <code>CFArray</code> containing the kexts found. * If <code>needAllFlag</code> is <code>false</code>, the array may be missing * some kexts. If <code>needAllFlag</code> is <code>true</code> and not all * dependencies are found, this function returns <code>NULL</code>. * * @discussion * The fully-resolved load list represents all of the kexts needed to load * every kext in <code>kexts</code> into the kernel, in an order guaranteed to * work for sequential starting and matching with IOKit personalities. * * This function calls @link OSKextResolveDependencies@/link to find * dependencies. */ CF_EXPORT CFMutableArrayRef OSKextCopyLoadListForKexts( CFArrayRef kexts, Boolean needAllFlag) ; /*! * @function OSKextCopyAllDependencies * @abstract * Returns all kexts that a given kexts depends on, directly or indirectly. * * @param aKext The kext to get dependencies for. * @param needAllFlag If <code>true</code>, the function returns * <code>NULL</code> if any dependency isn't found. * @result * A <code>CFArray</code> containing the kexts found. * If <code>needAllFlag</code> is <code>false</code>, the array may be missing * some kexts. If <code>needAllFlag</code> is <code>true</code> and not all * dependencies are found, this function returns <code>NULL</code>. * * @discussion * This function calls @link OSKextResolveDependencies@/link to find * dependencies. */ CF_EXPORT CFMutableArrayRef OSKextCopyAllDependencies( OSKextRef aKext, Boolean needAllFlag) ; /*! * @function OSKextCopyIndirectDependencies * @abstract * Returns all kexts that a given kexts depends on indirectly. * * @param aKext The kext to get dependencies for. * @param needAllFlag If <code>true</code>, the function returns * <code>NULL</code> if any dependency isn't found. * @result * A <code>CFArray</code> containing the kexts found. * If <code>needAllFlag</code> is <code>false</code>, the array may be missing * some kexts. If <code>needAllFlag</code> is <code>true</code> and not all * dependencies are found, this function returns <code>NULL</code>. * * @discussion * Note that the list of indirect dependencies includes all kexts declared * as dependencies by the direct dependencies of <code>aKext</code> - * it may therefore include a direct dependency as well if some other * kext in the load graph declares it. * * This function calls @link OSKextResolveDependencies@/link to find * dependencies. */ // xxx - This one isn't really useful, is it? CFMutableArrayRef OSKextCopyIndirectDependencies( OSKextRef aKext, Boolean needAllFlag) ; /*! * @function OSKextDependsOnKext * @abstract * Returns whether a kext depends on a given library kext, * directly or indirectly. * * @param aKext The kext to examine. * @param libraryKext The possible library kext. * @param directFlag * If <code>true</code>, only checks for a direct declared dependency; * if <code>false</code> check for direct or indirect dependencies. * @result * <code>true</code> if <code>aKext</code> depends on <code>libraryKext</code>, * either directly or indirectly per <code>directFlag</code>. * Returns <code>false</code> otherwise. * * @discussion * This function calls @link OSKextResolveDependencies@/link to find * dependencies. * * This function works with actual dependency resolution, not potential. * If there are multiple kexts with the same bundle identifier, * <code>aKext</code> may not be the one chosen during resolution * and so it might appear that no kexts depend on it, even though they could. */ CF_EXPORT Boolean OSKextDependsOnKext( OSKextRef aKext, OSKextRef libraryKext, Boolean directFlag) ; /*! * @function OSKextCopyDependents * @abstract * Return all kexts that depend on a given kext, directly or indirectly. * * @param aKext The kext to get dependents for. * @param directFlag * <code>true</code> to get only kexts that declare a direct * dependency on <code>aKext</code>, * <code>false</code> to get all dependents, direct or indirect. * @result * An array of all kexts that ultimately depend on <code>aKext</code>, * directly or indirectly according to <code>directFlag</code>. * * @discussion * This function calls @link OSKextResolveDependencies@/link on all open * kexts to find dependencies. This can be somewhat expensive. * * This function works with actual dependency resolution, not potential. * If there are multiple kexts with the same bundle identifier, * <code>aKext</code> may not be the one chosen during resolution * and so it might appear that no kexts depend on it, even though they could. */ CF_EXPORT CFMutableArrayRef OSKextCopyDependents(OSKextRef aKext, Boolean directFlag) ; /*! * @function OSKextIsCompatibleWithVersion * @abstract Returns whether a library kext is compatible with a given version. * * @param aKext The kext to examine. * @param aVersion The kext version to check compatibility with * * @result * <code>truer</code> if <code>aKext</code> has a compatible version and * if <code>aVersion</code> is between the version and compatible version of * <code>aKext</code> (inclusive), <code>false</code> otherwise. * * @discussion */ CF_EXPORT Boolean OSKextIsCompatibleWithVersion( OSKextRef aKext, OSKextVersion aVersion) ; /*! * @function OSKextLogDependencyGraph * @abstract Prints the resolved dependency graph of a kext. * * @param aKext The kext to log the dependency graph of. * @param bundleIDFlag <code>true</code> to log kexts by bundle ID, * <code>false</code> to log them by URL. * @param linkFlag <code>true</code> to log the link graph only, * <code>false</code> to log the full dependency graph. * * @discussion * <code>linkFlag</code> allows you to display the dependencies as they will * be recorded in the kernel when the kext is loaded. * If it is <code>true</code>, then only kexts with executables are included * in the logged dependency graph. If it is <code>false</code>, all kexts * needed to load </code>aKext</code> are included. * * This function calls @link OSKextResolveDependencies@/link to find * dependencies. */ CF_EXPORT void OSKextLogDependencyGraph(OSKextRef aKext, Boolean bundleIDFlag, Boolean linkFlag) ; /*! * @function OSKextFindLinkDependencies * @abstract Finds kexts that define symbols a kext needs resolved. * * @param aKext The kext to examine. * @param nonKPIFlag * <code>false</code> to look in com.apple.kpi.* kernel component * for kernel symbols; * <code>true</code> to look in com.apple.kernel.* kernel components * instead (not recommended for later versions of Mac OS X). * @param allowUnsupportedFlag * <code>false</code> to skip unsupported libraries in the search; * <code>true</code> to include them. * @param onedefSymbolsOut * A dictionary containing symbols that were found once; * keys are the symbols, values are the kexts defining the key symbol. * Ownership follows the Create Rule. * Pass <code>NULL</code> to not retrieve. * @param undefinedSymbolsOut * A dictionary containing symbols that weren't found; * keys are the symbols, values are undefined. * Ownership follows the Create Rule. * Pass <code>NULL</code> to not retrieve. * @param multiplyDefinedSymbolsOut * A dictionary containing symbols found in multiple library kexts; * keys are the symbols, values are the kexts defining the key symbol. * Ownership follows the Create Rule. * Pass <code>NULL</code> to not retrieve. * @param multipleDefinitionLibraries * A array of all library kexts in which multiply defined symbols * were found; sorted by CFBundleIdentifier. * Ownership follows the Create Rule. * Pass <code>NULL</code> to not retrieve. * @result * An array of kexts that export symbols referenced by <code>aKext</code>, * sorted by CFBundleIdentifier. * * @discussion * This function searches in all open kexts for symbols referenced by * <code>aKext</code>, ignoring the OSBundleLibraries property. * You can use this function to find out what you should list * in a kext's OSBundleLibraries property. * * If <code>undefinedSymbolsOut</code> has a nonzero count, * the symbols named by its keys could not be found in any open kext. * * If <code>multiplyDefinedSymbolsOut</code> has a nonzero count, * some of the result kexts define the same symbol, * and if those duplicates are listed * in OSBundleLibraries a link failure will occur. * You can inspect the contents of <code>multiplyDefinedSymbolsOut</code> * and <code>multipleDefinitionLibraries</code> * by hand to sort out which libraries you should actually declare. * * This function is fairly expensive, as it has to search through all open * kexts' information dictionaries, and all library kexts' executables. */ CFArrayRef OSKextFindLinkDependencies( OSKextRef aKext, Boolean nonKPIFlag, Boolean allowUnsupportedFlag, CFDictionaryRef * undefinedSymbolsOut, CFDictionaryRef * onedefSymbolsOut, CFDictionaryRef * multiplyDefinedSymbolsOut, CFArrayRef * multipleDefinitionLibrariesOut) ; #pragma mark Linking and Loading; Other Kernel Operations /********************************************************************* * Linking and Loading; Other Kernel Operations *********************************************************************/ /*! * @function OSKextLoad * @abstract Loads a kext and its dependencies into the kernel. * * @param aKext The kext to load. * @result * kOSReturnSuccess if <code>aKext</code> is successfully loaded * into the kernel, or was already loaded, or an error result if not. * * @discussion * The calling process must have an effective user ID of 0 (root) * to load kexts into the kernel. * * A kext and all its dependencies must pass all validation and authentication * tests to be loadable. See @link OSKextIsLoadable@/link for more information. * * All kexts loaded into the kernel are started, but IOKit personalities * are not sent to the IOCatalogue. * See @link OSKextSendPersonalitiesToKernel@/link. * * This function calls @link OSKextFlushLoadInfo@/link and clears dependencies * for all open kexts. It then calls @link OSKextCopyLoadList@/link * to find dependencies and @link OSKextReadLoadedKextInfo@/link on the * resulting load list. */ // xxx - need to list errors that may be returned CF_EXPORT OSReturn OSKextLoad(OSKextRef aKext) ; /*! * @function OSKextLoadWithOptions * @abstract Loads a kext and its dependencies into the kernel. * * @param aKext The kext to load. * @param startExclusion * <code>kOSKextExcludeAll</code> to omit starting <code>aKext</code> * and any of its dependencies not already started, * <code>kOSKextExcludeKext</code> to start the dependencies of * <code>aKext</code> but not <code>aKext</code> itself, * or <code>kOSKextExcludeNone</code> to start all loaded kexts. * @param addPersonalitiesExclusion * <code>kOSKextExcludeAll</code> to omit sending * IOKitPersonalities to the IOCatalogue for <code>aKext</code> * and any of its dependencies * (though they may already be in the IOCatalogue), * <code>kOSKextExcludeKext</code> to send personalities for the * dependencies of <code>aKext</code> but not <code>aKext</code> itself, * or <code>kOSKextExcludeNone</code> to send all personalities. * @param personalityNames * The names of IOKitPersonalities in <code>aKext</code> to send, * <code>addPersonalitiesExclusion</code> allowing. * If <code>NULL</code> all personalities are sent. * This parameter only affects <code>aKext</code>; if dependency * personalities are sent, they are all sent. * @param delayAutounloadFlag * <code>true</code> to cause the kernel's automatic kext unloader * to skip <code>aKext</code> for one cycle, giving extra time * to set up a debug session. <code>false</code> for normal behavior. * * @result * Returns <code>kOSReturnSuccess</code> on success, other values on failure. * * @discussion * This function allows a kext to be loaded but not started or matched * (for IOKit kexts), which is useful in some debug scenarios. * After calling this function, you may need to call @link OSKextStart@/link * to start <code>aKext</code> (along with its dependencies). * You may also need to call @link OSKextSendPersonalitiesToKernel@/link * for any kexts excluded from matching via * <code>addPersonalitiesExclusion</code>. * * The calling process must have an effective user ID of 0 (root) * to load kexts into the kernel. * * A kext and all its dependencies must pass all validation and authentication * tests to be loadable. See @link OSKextIsLoadable@/link for more information. * * This function calls @link OSKextFlushLoadInfo@/link and clears dependencies * for all open kexts. It then calls @link OSKextCopyLoadList@/link * to find dependencies and @link OSKextReadLoadedKextInfo@/link on the * resulting load list. */ // xxx - need to list errors that may be returned CF_EXPORT OSReturn OSKextLoadWithOptions( OSKextRef aKext, OSKextExcludeLevel startExclusion, OSKextExcludeLevel addPersonalitiesExclusion, CFArrayRef personalityNames, Boolean delayAutounloadFlag) ; /*! * @function OSKextGenerateDebugSymbols * @abstract Generate debug symbols for a kext and its dependencies. * * @param aKext * The kext to generate debug symbols for. * @param kernelImage * The kernel Mach-O or symbol file to use for linking. * If <code>NULL</code>, the running kernel is used. * * @result * A dictionary whose keys are the bundle IDs of the kexts for which symbols * have been generated with ".sym" appended, and whose values are CFData * objects containing the symbol files. Returns <code>NULL</code> on error. * * @discussion * The result includes only non-interface kexts that have an executable * and a load address set. * Load addresses are set by @link OSKextReadLoadedKextInfo@/link or by * @link OSKextSetLoadAddress@/link. * * If using the running kernel for load addresses, the current architecture * set with @link OSKextSetArchitecture@/link must match that of the running * kernel or this function returns <code>NULL</code>. * * This function calls @link OSKextResolveDependencies@/link to find * dependencies. */ CF_EXPORT CFDictionaryRef OSKextGenerateDebugSymbols( OSKextRef aKext, CFDataRef kernelImage) ; /*! * @function OSKextNeedsLoadAddressForDebugSymbols * @abstract * Returns whether a kext needs a load address set to generate debug symbols. * * @param aKext The kext to examine. * @result * <code>true</code> if <code>aKext</code> needs a load address set * in order to generate debug symbols with * @link OSKextGenerateDebugSymbols@/link, <code>false</code> otherwise. */ CF_EXPORT Boolean OSKextNeedsLoadAddressForDebugSymbols(OSKextRef aKext) ; /*! * @function OSKextUnload * @abstract Unloads a kext from the kernel if possible. * * @param aKext The kext to unload. * @param terminateServiceAndRemovePersonalities * If <code>true</code>, and the kext to unload has no kexts loaded * against it, all IOService objects defined by that kext will be * asked to terminate so that the unload can proceed, and the personalities * for the kext will be removed from the IOCatalogue. * * @result * <code>kOSReturnSuccess</code> on success, an error code * (typically <code>kOSKextReturnInUse</code>) on failure. * * @discussion * The calling process must have an effective user ID of 0 (root) * to unload kexts from the kernel. * A kext cannot be unloaded if it has any loaed dependents. * * See also the @link IOCatalogueTerminate@/link function. */ // xxx - need to list errors that may be returned CF_EXPORT OSReturn OSKextUnload(OSKextRef aKext, Boolean terminateServiceAndRemovePersonalities) ; /*! * OSKextUnload * @abstract Unloads a kext from the kernel if possible, based on its * CFBundleIdentifier. * * @param kextIdentifier The CFBundleIDentifier of the kext to unload. * @param terminateServiceAndRemovePersonalities * If <code>true</code>, and the kext to unload has no kexts loaded * against it, all IOService objects defined by that kext will be * asked to terminate so that the unload can proceed, and the personalities * for the kext will be removed from the IOCatalogue. * * @result * <code>kOSReturnSuccess</code> on success, an error code * (typically <code>kOSKextReturnInUse</code>) on failure. * * @discussion * The calling process must have an effective user ID of 0 (root) * to unload kexts from the kernel. * A kext cannot be unloaded if it has any loaed dependents. * * See also the @link IOCatalogueTerminate@/link function. */ // xxx - need to list errors that may be returned CF_EXPORT OSReturn OSKextUnloadKextWithIdentifier(CFStringRef kextIdentifier, Boolean terminateServiceAndRemovePersonalities) ; /*! * @function OSKextIsStarted * @abstract Returns whether a kext loaded in the kernel is started. * * @param aKext The kext to examine. * @result * <code>true</code> if <code>aKext</code> is active and running in the kernel, * <code>false</code> if not loaded or loaded and not started. * * @discussion * This function returns the state recorded the last time * @link OSKextReadLoadedKextInfo@/link was called. */ CF_EXPORT Boolean OSKextIsStarted(OSKextRef aKext) ; /*! * @function OSKextStart * @abstract Starts a kext loaded in the kernel if possible. * * @param aKext The kext to start. * @result * <code>kOSReturnSuccess</code> on success, an error code on failure. * * @discussion * This function allows an application to start a kext that is loaded * in the kernel (typically via @link OSKextLoadWithOptions@/link), * and any of its dependencies that aren't also started. * If the kext is already started, this does nothing. * * To start a kext means to call its start function, which is distinct from * the start method of an IOService object. * * The calling process must have an effective user ID of 0 (root) * to start kexts in the kernel. // xxx - need to list errors that may be returned */ CF_EXPORT OSReturn OSKextStart(OSKextRef aKext) ; /*! * @function OSKextStop * @abstract Stops a kext loaded in the kernel if possible. * * @param aKext The kext to stop. * @result * <code>kOSReturnSuccess</code> on success, an error code on failure. * * @discussion * This function allows an application to stop a kext that is loaded * in the kernel without unloading it. This may be useful in certain * debugging scenarios. * * A kext cannot be stopped via this function if it has any dependents * that reference it, any client references within the kernel, * or any instances of libkern/IOKit C++ classes. * * To stop a kext means to call its stop function, which is distinct from * the stop method of an IOService object. * * The calling process must have an effective user ID of 0 (root) * to stop kexts in the kernel. */ // xxx - should it be allowed to stop a kext with dependents that are // xxx - themselves not started? // xxx - need to list errors that may be returned CF_EXPORT OSReturn OSKextStop(OSKextRef aKext) ; /*! * @function OSKextSendPersonalitiesToKernel * @abstract Sends an array of IOKit personalities to the kernel. * * @param personalities The personalities to send. * @result * <code>kOSReturnSuccess</code> on success, an error code on failure. * * @discussion * This function simply sends an anonymous array of personalities to the * I/O Kit's IOCatalogue object in the kernel. * You can get personalities from kexts using * @link OSKextCopyPersonalitiesArray@/link or * @link OSKextCopyPersonalitiesOfKexts@/link. * * The calling process must have an effective user ID of 0 (root) * to send personalities to the kernel. */ // xxx - need to list errors that may be returned CF_EXPORT OSReturn OSKextSendPersonalitiesToKernel(CFArrayRef personalities) ; /*! * @function OSKextSendKextPersonalitiesToKernel * @abstract * Sends the personalities of a single kext to the kernel, optionally * filtered by name. * * @param aKext The kext whose personalities to send. * @param personalityNames * An array of names. Only personalities from <code>aKext</code> * with these names are sent to the kernel. * @result * <code>kOSReturnSuccess</code> on success, an error code on failure. * * @discussion * If any names in <code>personalityNames</code> are not found, * they are simply skipped rather than causing an error. * * This function may be useful in certain debugging scenarios, * where a particular personality is causing problems. * * The calling process must have an effective user ID of 0 (root) * to send personalities to the kernel. */ // xxx - should names not found cause an error? // xxx - need to list errors that may be returned CF_EXPORT OSReturn OSKextSendKextPersonalitiesToKernel( OSKextRef aKext, CFArrayRef personalityNames) ; /*! * @function OSKextSendPersonalitiesOfKextsToKernel * Sends the personalities of multiple kext to the kernel in a single * operation. * * @param kextArray The kexts whose personalities to send. * @result * <code>kOSReturnSuccess</code> on success, an error code on failure. * * @discussion * This function performs one data transfer to the kernel, collecting * all the personalities of the kexts in <code>kextArray</code>. * * The calling process must have an effective user ID of 0 (root) * to send personalities to the kernel. */ // xxx - need to list errors that may be returned CF_EXPORT OSReturn OSKextSendPersonalitiesOfKextsToKernel(CFArrayRef kextArray) ; /*! * @function OSKextRemoveKextPersonalitiesFromKernel * Removes all personalities for a kext's bundle identifier from the kernel. * * @param aKext The kext whose personalities to remove. * @result * <code>kOSReturnSuccess</code> on success, an error code on failure. * * @discussion * This function removes from the kernel's IOCatalogue all personalities * whose CFBundleIdentifiers match that of <code>aKext</code> so that no * further load requests for <code>aKext</code> will be made. This is * typically done when it is discovered that <code>aKext</code> cannot * be loaded from user space (if it fails to load in the kernel, matching * personalities are automatically removed). * * Note that kexts other than <code>aKext</code> might have published * personalities in the IOCatalogue under <code>aKext</code>'s identifier. * Such personalities will also be removed, since they trigger load requests * for a kext that cannot be loaded. The OSKext library adds an * IOPersonalityPublisher property to such personalities, that gives the * bundle identifier of the originating kext. * * This function differs from * @link OSKextRemovePersonalitiesForIdentifierFromKernel@/link * by having a kext object to check for logging or other purposes. * * The calling process must have an effective user ID of 0 (root) * to remove personalities from the kernel. */ // xxx - need to list errors that may be returned // xxx - this is a not-so-thin shim over IOCatalogueSendData (kIOCatalogueRemoveDrivers) // xxx - might we just want the function to take a bundle ID? // xxx - does IOCatalogueSendData really require root access? CF_EXPORT OSReturn OSKextRemoveKextPersonalitiesFromKernel(OSKextRef aKext) ; /*! * @function OSKextRemovePersonalitiesForIdentifierFromKernel * Removes all personalities for a given bundle identifier from the kernel. * * @param aBundleID The bundle identifier for which to remove personalities. * @result * <code>kOSReturnSuccess</code> on success, an error code on failure. * * @discussion * This function removes from the kernel's IOCatalogue all personalities * whose CFBundleIdentifiers are <code>aBundleID</code> so that no * further load requests for the kext with that identifier will be made. * This is typically done when it is discovered no kext can be found for * <code>aBundleID</code>. * * This function differs from * @link OSKextRemoveKextPersonalitiesFromKernel@/link * by not having a kext object to check for logging or other purposes. * * The calling process must have an effective user ID of 0 (root) * to remove personalities from the kernel. */ // xxx - need to list errors that may be returned // xxx - this is a not-so-thin shim over IOCatalogueSendData (kIOCatalogueRemoveDrivers) // xxx - I want 2 separate functions for logging; a kext can have flags in it // xxx - does IOCatalogueSendData really require root access? CF_EXPORT OSReturn OSKextRemovePersonalitiesForIdentifierFromKernel(CFStringRef aBundleID) ; /*! * @function OSKextCreateLoadedKextInfo * @abstract Returns information about loaded kexts in a dictionary. * * @param kextIdentifiers An array of kext identifiers to read from the kernel. * Pass <code>NULL</code> to read info for all loaded kexts. * @result * An array of dictionaries containing information about loaded kexts. * * @discussion * This function gets information from the kernel without affecting any * kext objects. If you want to update open kext objects to reflect * whether they are loaded in the kernel, use @link OSKextReadLoadedKextInfo@/link. */ // xxx - need to document the keys from OSKextLib.h. CF_EXPORT CFArrayRef OSKextCreateLoadedKextInfo( CFArrayRef kextIdentifiers) ; /*! * @function OSKextReadLoadedKextInfo * @abstract Updates kext objects with load info from the kernel. * * @param kextIdentifiers An array of kext identifiers to read * from the kernel; * all matching kexts have their load info updated. * Pass <code>NULL</code> to update load info for all kexts. * @param flushDependenciesFlag * <code>true</code> to clear dependency information from kexts, * <code>false</code> to leave it in place. * * @result * <code>kOSReturnSuccess</code> if all information is successfully updated, * an error code otherwise. Specifically, if the current architecture set * by @link OSKextSetArchitecture@/link is not that of the running kernel, * this function returns <code>kOSKextReturnExecutableArchNotFound</code>. * * @discussion * The load status of kexts primarily affects dependency resolution in the * kext library, in that kexts marked as loaded are given priority over * all other kexts of the same identifier. * See @link OSKextResolveDependencies@/link for more. * * This function calls @link OSKextFlushLoadInfo@/link on the kexts, * which clears any previous load info for them * (or for all kexts if <code>kextIdentifiers</code> is <code>NULL</code>). * If <code>flushDependenciesFlag</code> is <code>true</code>, * resolved dependencies (which may not match the loaded kexts * in the kernel) are also flushed. * Load addresses are then set from the kernel, * but dependencies are resolved as needed. * * If <code>flushDependenciesFlag</code> is <code>false</code>, * existing dependency graphs are maintained, allowing you to * check whether the dependencies, as resolved before reading * load information, reflect loaded kexts (by getting the load list * via @link OSKextCopyLoadList@/link and checking the kexts in it * with @link OSKextIsLoaded@/link). */ // xxx - need to list errors that may be returned CF_EXPORT OSReturn OSKextReadLoadedKextInfo( CFArrayRef kexts, Boolean flushDependenciesFlag) ; /*! * @function OSKextIsLoaded * @abstract Returns whether a kext is loaded in the kernel. * * @param aKext The kext to examine. * @result * <code>true</code> if a kext with the same identifier, version, and UUID * as <code>aKext</code> is loaded in the kernel, <code>false</code> otherwise. * * @discussion * You must call @link OSKextReadLoadedKextInfo@/link for this flag to be meaningful, * which in turn requires the current library architecture to match that * of the running kernel. * Use @link OSKextOtherVersionIsLoaded@/link to check whether * a different version of <code>aKext</code> is loaded. */ CF_EXPORT Boolean OSKextIsLoaded(OSKextRef aKext) ; /*! * @function OSKextGetLoadAddress * @abstract Returns the actual or simulated kernel load address of a kext. * * @param aKext The kext to examine. * @result * The load address of <code>aKext</code>, whether read from the kernel using * @link OSKextReadLoadedKextInfo@/link or set for symbol generation using * @link OSKextSetLoadAddress@/link. * * @discussion * Load addresses are accessed as 64-bit numbers even for 32-bit architectures; * cast or truncate the value as necessary. * * You must call @link OSKextReadLoadedKextInfo@/link or * @link OSKextSetLoadAddress@/link for the load address to be nonzero. */ CF_EXPORT uint64_t OSKextGetLoadAddress(OSKextRef aKext) ; /*! * @function OSKextSetLoadAddress * @abstract * Sets the simulated kernel load address of a kext for symbol generation. * * @param aKext The kext to set a load address for. * @result * <code>true</code> if the address was set, <code>false</code> if not * (because it's too large for the current architecture). * * @discussion * Load addresses are accessed as 64-bit numbers even for 32-bit architectures. * If you attempt to set a load address that is too large for a 32-bit link, * this function returns <code>false</code>. * See @link OSKextSetArchitecture@/link. * * Setting a load address manually is useful for generating debug symbols * with @link OSKextGenerateDebugSymbols@/link. */ CF_EXPORT Boolean OSKextSetLoadAddress(OSKextRef aKext, uint64_t anAddress) ; /*! * @function OSKextGetLoadTag * @abstract * Returns the load tag of a kext if it's loaded in the kernel. * * @param aKext The kext to examine. * @result * The load tag (also known as the index or kmod id) of <code>aKext</code>, * if it's loaded in the kernel (use @link OSKextIsLoaded@/link to check that). * Returns 0 if <code>aKext</code> is not loaded or if it can't be determined * whether it is loaded. * * @discussion * You must call @link OSKextReadLoadedKextInfo@/link for the load tag * to be meaningful, which in turn requires the current library architecture * to match that of the running kernel. * Use @link OSKextIsLoaded@/link to check whether <code>aKext</code> * is loaded. */ CF_EXPORT uint32_t OSKextGetLoadTag(OSKextRef aKext) ; /*! * @function OSKextFlushLoadInfo * @abstract Clears all load and dependency information from a kext. * * @param aKext * The kext to clear. If <code>NULL</code>, all open * kexts have their load info flushed. * @param flushDependenciesFlag * <code>true</code> to clear dependency information from kexts, * <code>false</code> to leave it in place. * * @discussion * Flushing load information releases the internal load information * structs of a kext, including load flags, the bundle executable, * link/load diagnostics, and if <code>flushDependenciesFlag</code> is true, * the dependencies. * * OSKexts accumulate a fair amount of information as they are created * and used; when many kext objects are created the total memory * consumption can be significant. If an application won't be using * kexts for long periods of time, it can flush this information * to save memory; the information will later be re-read from disk * or recreated as necessary. * * Flushing load info is also useful after readling loaded kext * information from the kernel with @link OSKextReadLoadedKextInfo@/link * or after working with executables. Executables in particular * consume a lot of application memory, often unnecessarily, since * the code is loaded and running in the kernel. * * See also @link OSKextFlushInfoDictionaries@/link, * @link OSKextFlushDependencies@/link, * and @link OSKextFlushDiagnostics@/link. */ CF_EXPORT void OSKextFlushLoadInfo( OSKextRef aKext, Boolean flushDependenciesFlag) ; /*! * @function OSKextCopyAllRequestedIdentifiers * @abstract * Copies the list of all unique bundle identifiers of kext load requests * that the kernel has received since power-on. * * @result * A CFArray object, or <code>NULL</code> if the copy failed. * Ownership follows the * @link //apple_ref/doc/uid/20001148-103029 Create Rule@/link. * */ CF_EXPORT CFArrayRef OSKextCopyAllRequestedIdentifiers(void) ; #pragma mark Sanity Checking and Diagnostics /********************************************************************* * Sanity Checking and Diagnostics *********************************************************************/ /*! * @function OSKextParseVersionCFString * @abstract * Parses a kext version from a CFString. * * @param versionString The kext version string to parse. * @result * The numeric rendering of <code>versionString</code>, which can * compared arithmetically with other valid version numbers. * Returns -1 if the version couldn't be parsed. */ CF_EXPORT OSKextVersion OSKextParseVersionCFString(CFStringRef versionString) ; /*! @function OSKextParseVersionString */ CF_EXPORT OSKextVersion OSKextParseVersionString(const char* versionString); CF_EXPORT void OSKextVersionGetString(OSKextVersion version, char* buffer, size_t bufferLength); /*! * @function OSKextValidate * @abstract * Sanity checks a kext's info dictionary and executable for the currently * set architecture. * * @param aKext The kext to validate. * @result * <code>true</code> if <code>aKext</code> passes all validation tests, * <code>false</code> otherwise. * * @discussion * This function forces full validation of a kext, collecting all * errors found in the validation diagnostics if recording is turned on * (with @link OSKextSetRecordsDiagnostics@/link). You can get the diagnostics * using @link OSKextCopyDiagnostics@/link. * * If safe boot is currently simulated (see * @link OSKextSetSimulatedSafeBoot@/link), * any kext not loadable during safe boot will fail validation. */ // compare with CFBundlePreflightExecutable() CF_EXPORT Boolean OSKextValidate(OSKextRef aKext) ; /*! * @function OSKextIsValid * @abstract * Returns whether a kext is valid or not. * * @param aKext The kext to examine. * @result * <code>true</code> if <code>aKext</code> passes all validation tests, * <code>false</code> otherwise. * * @discussion * This function avoids doing full validation if any problems have been * discovered with the kext during other operations. To perform a full * validation of all possible problems, use @link OSKextValidate@/link. */ CF_EXPORT Boolean OSKextIsValid(OSKextRef aKext) ; /*! * @function OSKextValidateDependencies * @abstract Validates all dependencies of a kext. * * @param aKext The kexts whose dependencies to validate. * @result * <code>true</code> if all dependencies of <code>aKext</code> are valid, * <code>false</code> if any of them are not. * * @discussion * This function calls @link OSKextValidate@/link on <code>aKext</code> and * all the current dependencies of <code>aKext</code>. * Use @link OSKextCopyDiagnostics@/link * with a flag of @link kOSKextDiagnosticsFlagDependencies@/link * to get the dependency-resolution failures caused by invalid dependencies. * * If safe boot is currently simulated (see * @link OSKextSetSimulatedSafeBoot@/link), * any kext not loadable during safe boot will fail validation. * * This function calls @link OSKextResolveDependencies@/link to find * dependencies. */ CF_EXPORT Boolean OSKextValidateDependencies(OSKextRef aKext) ; /*! * @function OSKextAuthenticate * @abstract Authenticates file ownership and permissions of a kext. * * @param aKext The kext to examine. * @result * <code>true</code> if all directories and files in <code>aKext</code>'s * bundle or mkext source have secure ownership and permissions, * <code>false</code> if they do not, or if authentication could not be done. * * @discussion * This function forces full authentication of a kext, collecting all * errors found in the authentication diagnostics, collecting all * errors found in the validation diagnostics if recording is turned on * (with @link OSKextSetRecordsDiagnostics@/link). You can get the diagnostics * using @link OSKextCopyDiagnostics@/link. * * For a kext to be loadable into the kernel, it must be owned by * user root, group wheel, and its constituent files and directories * must be nonwritable by group and other. * A kext created from an mkext file uses that mkext file for authentication * (see @link OSKextCreateKextsFromMkextFile@/link. */ CF_EXPORT Boolean OSKextAuthenticate(OSKextRef aKext) ; /*! * @function OSKextIsAuthentic * @abstract * Returns whether a kext is authentic or not. * * @param aKext The kext to examine. * @result * <code>true</code> if <code>aKext</code> passes all authentication tests, * <code>false</code> otherwise. * * @discussion * This function avoids doing full authentication if any problems have been * discovered with the kext during other operations. To perform a full * validation of all possible problems, use @link OSKextValidate@/link. */ CF_EXPORT Boolean OSKextIsAuthentic(OSKextRef aKext) ; /*! * @function OSKextAuthenticateDependencies * @abstract Authenticates all dependencies of a kext. * * @param aKext The kexts whose dependencies to authenticate. * @result * <code>true</code> if all dependencies of <code>aKext</code> are authentic, * <code>false</code> if any of them are not. * * @discussion * This function calls @link OSKextAuthenticate@/link on <code>aKext</code> * and all the current dependencies of <code>aKext</code>. * Use @link OSKextCopyDiagnostics@/link * with a flag of @link kOSKextDiagnosticsFlagDependencies@/link * to get the dependency-resolution failures caused by inauthentic dependencies. * * This function calls @link OSKextResolveDependencies@/link to find * dependencies. */ CF_EXPORT Boolean OSKextAuthenticateDependencies(OSKextRef aKext) ; /*! * @function OSKextIsLoadable * @abstract * Returns whether a kext appears loadable for the current architecture. * * @param aKext The kext to examine. * @result * <code>true</code> if <code>aKext</code> has no problems with validation, * authentication, or dependency resolution for the current architecture, * and if it's eligible for the current safe boot mode. * Returns <code>false</code> otherwise. * * @discussion * This function resolves dependencies for <code>aKext</code>, * validates and authenticsates <code>aKext</code> and its dependencies, * and if safe boot is simulated also checks the OSBundleRequired property * of <code>aKext</code> and its dependencies. If all these tests pass, * the kext is considered loadable for the current architecture * (which need not match that of the running kernel). * * See @link OSKextSetArchitecture@/link and * @link OSKextSetSimulatedSafeBoot@/link. * * This function calls @link OSKextResolveDependencies@/link to find * dependencies. */ CF_EXPORT Boolean OSKextIsLoadable(OSKextRef aKext) ; /*! * @function OSKextCopyDiagnostics * @abstract Returns diagnostics information for a kext. * * @param aKext The kext to get diagnostics for. * @param typeFlags Flags indicating which diagnostics to retrieve. * @result * A dictionary containing diagnostics for <cod>aKext</code>, suitable * for display in an outline view or printout. * * @discussion * You can use this function after validating, authenticating, resolving * dependencies, or generating debug symbols to get all the problems encountered * with those operations. * * The exact keys and values used for diagnostics are for informational purposes * only, are not formally defined, and may change without warning. * * You can use @link OSKextLogDiagnostics@/link to print nicely-formatted * reports of any problems found with kexts. */ // xxx - need to tie in with the kernel & linker to get link failures CFDictionaryRef OSKextCopyDiagnostics(OSKextRef aKext, OSKextDiagnosticsFlags typeFlags) ; /*! * @function OSKextLogDiagnostics * @abstract Logs specified diagnostics for a kext. * * @param aKext The kext to log diagnostics for. * @param typeFlags Flags indicating which diagnostics to log. * * @discussion * You can use this function after validating, authenticating, resolving * dependencies, or generating debug symbols to display all the problems * encountered with those operations. */ CF_EXPORT void OSKextLogDiagnostics( OSKextRef aKext, OSKextDiagnosticsFlags typeFlags) ; /*! * @function OSKextFlushDiagnostics * @abstract Clears all diagnostics information from a kext. * * @param aKext * The kext to clear diagnostics from. * Pass <code>NULL</code> to flush diagnostics from all open kexts. * @param typeFlags Flags indicating which diagnostics to flush. * * @discussion * OSKexts accumulate a fair amount of information as they are created * and used; when many kext objects are created the total memory * consumption can be significant. If an application won't be using * kexts for long periods of time, it can flush this information * to save memory; the information will later be re-read from disk * or recreated as necessary. * * See also @link OSKextFlushInfoDictionaries@/link, * @link OSKextFlushDependencies@/link, * and @link OSKextFlushLoadInfo@/link. */ CF_EXPORT void OSKextFlushDiagnostics(OSKextRef aKext, OSKextDiagnosticsFlags typeFlags) ; #pragma mark Mkext and Prelinked Kernel Files /********************************************************************* * Mkext and Prelinked Kernel Files *********************************************************************/ // xxx - Use "Flag" or "Mask"? typedef uint32_t OSKextRequiredFlags ; #define kOSKextOSBundleRequiredNone 0x0 #define kOSKextOSBundleRequiredRootFlag 0x1ULL #define kOSKextOSBundleRequiredLocalRootFlag 0x1ULL << 1 #define kOSKextOSBundleRequiredNetworkRootFlag 0x1ULL << 2 #define kOSKextOSBundleRequiredSafeBootFlag 0x1ULL << 3 #define kOSKextOSBundleRequiredConsoleFlag 0x1ULL << 4 /*! * @function OSKextIsFromMkext * @abstract Returns whether a kext was created from an mkext archive. * * @param aKext The kext to examine. * @result * <code>true</code> if <code>aKext</code> was created from an mkext archive, * <code>false</code> if it was created from an on-disk bundle. * * @discussion * A kext created from an mkext will have only its info dictionary, executable, * and any resources listed in its the OSBundleStartupResources property. */ CF_EXPORT Boolean OSKextIsFromMkext(OSKextRef aKext) ; /*! * @function OSKextMatchesRequiredFlags * @abstract * Returns whether a kext matches a given set of flags for inclusion in an * mkext archive. * * @param aKext The kext to examine. * @param requiredFlags * Flags indicating which values of OSBundleRequired * are needed. * @result * <code>true</code> if <code>aKext</code>'s OSBundleRequired property * matches one of the specified flags, <code>false</code> otherwise. * * @discussion * This function is used to select kexts for inclusion in an mkext archive. * See @link OSKextFilterRequiredKexts@/link and * @link OSKextCreateMkext@/link. */ CF_EXPORT Boolean OSKextMatchesRequiredFlags(OSKextRef aKext, OSKextRequiredFlags requiredFlags) ; /*! * @function OSKextFilterRequiredKexts * @abstract * Filters an array of kexts based on a set of flags * for inclusion in an mkext archive. * * @param kextArray * The kexts to filter. * Pass <code>NULL</code> to filter all open kexts. * @param requiredFlags * Flags indicating which values of OSBundleRequired * are needed. * @result * An array of kexts matching <code>requiredFlags</code>. * * @discussion * This function is used to select kexts for inclusion in an mkext archive. * See @link OSKextCreateMkext@/link. * */ CF_EXPORT CFArrayRef OSKextFilterRequiredKexts(CFArrayRef kextArray, OSKextRequiredFlags requiredFlags) ; /*! * @function OSKextCreateMkext * @abstract Create an mkext file from an array of kexts and set of flags. * * @param allocator * The allocator to use to allocate memory for the new object. * Pass <code>NULL</code> or <code>kCFAllocatorDefault</code> * to use the current default allocator. * @param kextArray * The kexts to include in the mkext. * Pass <code>NULL</code> to use all open kexts. * @param volumeRootURL * If non-<code>NULL</code>, kexts with this URL as a prefix * strip it when saving their paths in the mkext. * This allows creation of mkexts for volumes * other than the current startup volume. * @param requiredFlags * A set of flags that filters <code>kextArray</code> to a subset * of kexts required for specific startup scenarios * (typically local disk vs. network). * @param compressFlag * <code>true</code> to compress data in the mkext, * <code>false</code> to include them at full size. * COMPRESSED MKEXTS ARE NOT SUPPORTED IN THE KERNEL YET. * @result * A <code>CFData</code> object containing the mkext file data on success, * <code>NULL</code> on failure. * * @discussion * This function creates a single-architecture mkext file for the currently * set library architecture (see @link OSKextSetArchitecture@/link). Kexts * with executables lacking code for that architecture are not included. * * If you want to create a multi-architecture mkext, create a set of single * architecture mkext files and use lipo(1) or combine them programmatically. * * This function generates mkext files in a new format that only works on * Mac OS X 10.6 or later. */ // xxx - add a version param and generate old-format mkexts? // xxx - add flag to take only most recent version of a given bundle ID? CF_EXPORT CFDataRef OSKextCreateMkext( CFAllocatorRef allocator, CFArrayRef kextArray, CFURLRef volumeRootURL, OSKextRequiredFlags requiredFlags, Boolean compressFlag) ; /*! * @function OSKextCreateKextsFromMkextFile * @abstract Reads all kexts from an mkext file on disk. * * @param alocator * The allocator to use to allocate memory for the new objects. * Pass <code>NULL</code> or <code>kCFAllocatorDefault</code> * to use the current default allocator. * @param mkextURL * The mkext file URL from which to create kexts. * @result * Returns an array containing the kext objects created, * or <code>NULL</code> on failure. * * @discussion * This function creates kext objects from an mkext file rather than from * bundles on disk. Kexts created with this function are authenticated using * the mkext file at <code>mkextURL</code>. * * A kext created from an mkext has only its info dictionary, executable, * and any resources listed in its the OSBundleStartupResources property. * * Kexts created from an mkext are not uniqued using filesystem URLs, * which belong to bundles actually in the filesystem; * @link OSKextCreate@/link will never return a kext extracted from an mkext * that originally had the URL given (even though the new mkext format * stores that original URL). * This also means that if you open the same mkext file multiple times, * you will create distinct, identical copies of the kexts in that mkext file. */ CF_EXPORT CFArrayRef OSKextCreateKextsFromMkextFile(CFAllocatorRef allocator, CFURLRef mkextURL) ; /*! * @function OSKextCreateKextsFromMkextData * @abstract Reads all kexts from an mkext file in memory. * * @param alocator * The allocator to use to allocate memory for the new objects. * Pass <code>NULL</code> or <code>kCFAllocatorDefault</code> * to use the current default allocator. * @param mkextData * The mkext file data from which to create kexts. * @result * Returns an array containing the kext objects created, * or <code>NULL</code> on failure. * * @discussion * This function creates kext objects from an mkext file in memory * rather than from bundles on disk. Lacking any file in the filesystem, * kexts created with this function can not be authenticated. * * A kext created from an mkext has only its info dictionary, executable, * and any resources listed in its the OSBundleStartupResources property. * * Kexts created from an mkext are not uniqued using filesystem URLs, * which belong to bundles actually in the filesystem; * @link OSKextCreate@/link will never return a kext extracted from an mkext * that originally had the URL given (even though the new mkext format * stores that original URL). * This also means that if you open the same mkext file multiple times, * you will create distinct, identical copies of the kexts in that mkext file. */ CF_EXPORT CFArrayRef OSKextCreateKextsFromMkextData(CFAllocatorRef allocator, CFDataRef mkextData) ; /*! * @function OSKextCreatePrelinkedKernel * @abstract Creates a prelinked kernel from a kernel file and all open kexts. * * @param kernelImage The kernel image to use. * @param kextArray * The kexts to include in the prelinked kernel. * Pass <code>NULL</code> to consult the running kernel * for kexts to include from those open; * the current architecture must match the runninng kernel's. * @param volumeRootURL * If non-<code>NULL</code>, kexts with this URL as a prefix * strip it when saving their paths in the prelinked kernel. * This allows creation of prelinked kernels from folders * other than /System/Library/Extensions. * @param needAllFlag * If <code>true</code> and any kext fails to link, * the skipAuthenticationFlag returns <code>NULL</code>. * @param skipAuthenticationFlag * If <code>true</code>, kexts are not authenticated for inclusion * in the prelinked kernel. * @param printDiagnosticsFlag * If <code>true</code>, problems with the kexts that prevent * inclusion of a kext in the prelinked kernel are logged via * @link OSKextLogDiagnostics OSKextLogDiagnostics@/link. * @param symbolsOut * If non-<code>NULL</code> debug symbols for <code>kernelImage</code> * and all kexts included in the result are returned by reference. * * @result * A <code>CFData</code> object containing the prelinked kernel image based * on the running kernel. * Returns <code>NULL</code> if <code>needAllFlag</code> is <code>true</code> * and any kext fails to link. */ CF_EXPORT CFDataRef OSKextCreatePrelinkedKernel( CFDataRef kernelImage, CFArrayRef kextArray, CFURLRef volumeRootURL, Boolean needAllFlag, Boolean skipAuthenticationFlag, Boolean printDiagnosticsFlag, CFDictionaryRef * symbolsOut) ; /*! * @function OSKextotherCFBundleVersionIsLoaded * @abstract * Returns whether another version of a given kext is loaded in the kernel. * * @param aKext The kext to examine. * @result * <code>true</code> if a kext with the same identifier, * but a different version or UUID * from <code>aKext</code>, is loaded in the kernel. * Returns <code>false</code> if <code>aKext</code> is loaded or if * no kext with the same identifier is loaded. * * @discussion * You must call @link OSKextReadLoadedKextInfo@/link for this flag to be meaningful, * which in turn requires the current library architecture to match that * of the running kernel. * Use @link OSKextIsLoaded@/link to check whether <code>aKext</code> * itself is loaded. */ CF_EXPORT Boolean OSKextotherCFBundleVersionIsLoaded(OSKextRef kext, Boolean* uuidFlag); __END_DECLS #endif /* __OSKEXT_H__ */ #endif <|start_filename|>Frameworks/TestsFoundation/Sources/PrivateHeaders/Classdump/XCTest/Xcode_12_0/Xcode_12_0__XCTestObservationPrivate.h<|end_filename|> #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 140000 && __IPHONE_OS_VERSION_MAX_ALLOWED < 150000 #import "Xcode_12_0_XCTest_CDStructures.h" #import "Xcode_12_0_SharedHeader.h" #import <XCTest/XCTestObservation.h> @class XCActivityRecord, XCTContext; // // Generated by class-dump 3.5 (64 bit). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by <NAME>. // @protocol _XCTestObservationPrivate <XCTestObservation> @optional - (void)_context:(XCTContext *)arg1 didFinishActivity:(XCActivityRecord *)arg2; - (void)_context:(XCTContext *)arg1 willStartActivity:(XCActivityRecord *)arg2; @end #endif <|start_filename|>Frameworks/TestsFoundation/Sources/PrivateHeaders/Classdump/XCTest/Xcode_11_0/Xcode_11_0_XCUIDevice.h<|end_filename|> #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000 && __IPHONE_OS_VERSION_MAX_ALLOWED < 140000 #import "Xcode_11_0_XCTest_CDStructures.h" #import "Xcode_11_0_SharedHeader.h" #import <Foundation/Foundation.h> #import <XCTest/XCUIDevice.h> @protocol XCUIAccessibilityInterface, XCUIApplicationAutomationSessionProviding, XCUIApplicationManaging, XCUIApplicationMonitor, XCUIDeviceEventAndStateInterface, XCUIEventSynthesizing, XCUIScreenDataSource, XCUIXcodeApplicationManaging; @class XCUIRemote, XCUISiriService, XCUITestContext; // // Generated by class-dump 3.5 (64 bit). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by <NAME>. // @interface XCUIDevice () { _Bool _isLocal; _Bool _isSimulatorDevice; long long _platform; id <XCUIAccessibilityInterface> _accessibilityInterface; id <XCUIApplicationMonitor> _applicationMonitor; id <XCUIEventSynthesizing> _eventSynthesizer; id <XCUIApplicationManaging> _platformApplicationManager; id <XCUIXcodeApplicationManaging> _xcodeApplicationManager; id <XCUIDeviceEventAndStateInterface> _deviceEventAndStateInterface; id <XCUIApplicationAutomationSessionProviding> _applicationAutomationSessionProvider; /*XCUISiriService **/ id _siriService; id <XCUIScreenDataSource> _screenDataSource; NSString *_uniqueIdentifier; XCUITestContext *_testContext; XCUIRemote *_remote; } + (id)localDevice; - (id)remote; - (id)testContext; - (_Bool)isSimulatorDevice; - (id)uniqueIdentifier; - (id)screenDataSource; - (id)applicationAutomationSessionProvider; - (id)deviceEventAndStateInterface; - (id)xcodeApplicationManager; - (id)platformApplicationManager; - (id)eventSynthesizer; - (id)applicationMonitor; - (id)accessibilityInterface; - (long long)platform; - (_Bool)isLocal; - (void)remoteAutomationSessionDidDisconnect:(id)arg1; - (void)attachLocalizableStringsData; - (void)rotateDigitalCrown:(double)arg1 velocity:(double)arg2; - (void)pressLockButton; - (void)holdHomeButtonForDuration:(double)arg1; - (void)_silentPressButton:(long long)arg1; - (void)_setOrientation:(long long)arg1; - (id)init; - (id)description; - (_Bool)isEqual:(id)arg1; - (unsigned long long)hash; - (id)mainScreen; - (id)screens; - (id)mainScreenOrError:(id *)arg1; - (id)screensOrError:(id *)arg1; - (_Bool)supportsPressureInteraction; - (_Bool)performDeviceEvent:(id)arg1 error:(id *)arg2; - (id)initLocalDeviceWithPlatform:(long long)arg1; @end #endif <|start_filename|>Frameworks/TestsFoundation/Sources/PrivateHeaders/Classdump/XCTAutomationSupport/Xcode_12_0/Xcode_12_0_XCTLocalizableStringInfo.h<|end_filename|> #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 140000 && __IPHONE_OS_VERSION_MAX_ALLOWED < 150000 #import "Xcode_12_0_XCTAutomationSupport_CDStructures.h" #import "Xcode_12_0_SharedHeader.h" #import <Foundation/Foundation.h> // // Generated by class-dump 3.5 (64 bit). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by <NAME>. // @interface XCTLocalizableStringInfo : NSObject <NSSecureCoding> { NSString *_bundleID; NSString *_bundlePath; NSString *_tableName; NSString *_stringKey; struct CGRect _frame; } + (_Bool)supportsSecureCoding; @property struct CGRect frame; // @synthesize frame=_frame; @property(readonly, copy) NSString *stringKey; // @synthesize stringKey=_stringKey; @property(readonly, copy) NSString *tableName; // @synthesize tableName=_tableName; @property(readonly, copy) NSString *bundlePath; // @synthesize bundlePath=_bundlePath; @property(readonly, copy) NSString *bundleID; // @synthesize bundleID=_bundleID; - (id)dictionaryRepresentation; - (id)description; - (_Bool)isEqual:(id)arg1; - (id)copyWithZone:(struct _NSZone *)arg1; - (void)encodeWithCoder:(id)arg1; - (id)initWithCoder:(id)arg1; - (id)initWithBundleID:(id)arg1 bundlePath:(id)arg2 tableName:(id)arg3 stringKey:(id)arg4 frame:(struct CGRect)arg5; @end #endif <|start_filename|>Frameworks/TestsFoundation/Sources/PrivateHeaders/Classdump/XCTest/Xcode_12_0/Xcode_12_0_XCUIInterruptionHandler.h<|end_filename|> #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 140000 && __IPHONE_OS_VERSION_MAX_ALLOWED < 150000 #import "Xcode_12_0_XCTest_CDStructures.h" #import "Xcode_12_0_SharedHeader.h" #import <Foundation/Foundation.h> // // Generated by class-dump 3.5 (64 bit). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by <NAME>. // @interface XCUIInterruptionHandler : NSObject { CDUnknownBlockType _block; NSString *_handlerDescription; NSUUID *_identifier; } @property(readonly, copy) NSUUID *identifier; // @synthesize identifier=_identifier; @property(readonly, copy) NSString *handlerDescription; // @synthesize handlerDescription=_handlerDescription; @property(readonly, copy) CDUnknownBlockType block; // @synthesize block=_block; - (id)initWithBlock:(CDUnknownBlockType)arg1 description:(id)arg2; @end #endif <|start_filename|>Frameworks/InAppServices/Sources/Features/WaitingForQuiescence/CoreAnimation/SurrogateCAAnimationDelegate/SurrogateCAAnimationDelegateObjC.h<|end_filename|> #ifdef MIXBOX_ENABLE_IN_APP_SERVICES @import QuartzCore; // `CAAnimation` has incorrect optionality. Without optionality, the code crashes (note // that this crash is not covered by tests, it only happens in a prorietary client code). // If implementation is in swift code and optionality is correct, this warning is displayed: // // ``` // Parameter of 'animationDidStart' has different optionality than expected by protocol 'CAAnimationDelegate' // ``` // // This wrapper is used to suppress the warning. // It implements protocol with wrong optionality, but in Objective-C process won't crash if non-optional value // is casted to optional value (because there is no cast in runtime). // // All real logic is in `SurrogateCAAnimationDelegateSwift`. // @interface SurrogateCAAnimationDelegateObjC: NSObject<CAAnimationDelegate> - (void)animationDidStart:(CAAnimation *)animation; - (void)animationDidStop:(CAAnimation *)animation finished:(BOOL)finished; - (void)mbswizzled_animationDidStart:(CAAnimation *)animation; - (void)mbswizzled_animationDidStop:(CAAnimation *)animation finished:(BOOL)finished; @end #endif <|start_filename|>Tests/AppForCheckingPureXctest/HidEventsDebugging/PrivateApi.h<|end_filename|> @import Foundation; @import UIKit; typedef struct __IOHIDEvent * IOHIDEventRef; @interface UIEvent(PrivateApi) - (IOHIDEventRef) _hidEvent; @end
Chupik/Mixbox
<|start_filename|>imageloader/src/main/java/me/toptas/imageloader/ImageView.kt<|end_filename|> package me.toptas.imageloader import android.widget.ImageView import coil.load fun ImageView.loadImage(url: String?) { url?.let { load(it) } } <|start_filename|>common/src/main/java/me/toptas/architecture/common/model/ResponseError.kt<|end_filename|> package me.toptas.architecture.common.model data class ResponseError(val errorMessage: String) <|start_filename|>app/src/main/java/me/toptas/architecture/di/ViewModelModule.kt<|end_filename|> package me.toptas.architecture.di import me.toptas.architecture.features.main.MainViewModel import org.koin.android.viewmodel.ext.koin.viewModel import org.koin.dsl.module.module val viewModelModule = module { viewModel { MainViewModel(get()) } } <|start_filename|>app/src/main/java/me/toptas/architecture/features/main/AlbumAdapter.kt<|end_filename|> package me.toptas.architecture.features.main import me.toptas.architecture.R import me.toptas.architecture.base.BaseListAdapter import me.toptas.architecture.common.model.Album import me.toptas.architecture.databinding.RowAlbumBinding import me.toptas.architecture.BR class AlbumAdapter : BaseListAdapter<Album, RowAlbumBinding>() { override fun layoutResource() = R.layout.row_album override fun bindingVariableId() = BR.album } <|start_filename|>network/src/test/java/me/toptas/architecture/network/ApiWrapperTest.kt<|end_filename|> package me.toptas.architecture.network import com.nhaarman.mockitokotlin2.mock import com.nhaarman.mockitokotlin2.whenever import junit.framework.Assert.assertEquals import kotlinx.coroutines.runBlocking import me.toptas.architecture.common.model.AError import me.toptas.architecture.common.model.Album import okhttp3.ResponseBody.Companion.toResponseBody import org.junit.Assert import org.junit.Test import retrofit2.Response import java.net.UnknownHostException import java.util.concurrent.TimeoutException class ApiWrapperTest { private val errorBody = "{ \"errorMessage\": \"Business error\" }" private val api: Api = mock() @Test fun testApiWrapperSuccess() { runBlocking { val albums = listOf(Album("title")) whenever(api.getAlbums()).thenReturn( Response.success(200, albums) ) val response = apiWrapper { api.getAlbums() } Assert.assertEquals(null, response.error) assertEquals(albums, response.success) } } @Test fun testApiWrapperNetworkError() { runBlocking { whenever(api.getAlbums()).thenAnswer { throw UnknownHostException() } val response = apiWrapper { api.getAlbums() } Assert.assertEquals(true, response.error is AError.Network) } } @Test fun testApiWrapperTimeoutError() { runBlocking { whenever(api.getAlbums()).thenAnswer { throw TimeoutException() } val response = apiWrapper { api.getAlbums() } Assert.assertEquals(true, response.error is AError.Timeout) } } @Test fun testApiWrapperGenericError() { runBlocking { whenever(api.getAlbums()).thenAnswer { Exception("failed!!") } val response = apiWrapper { api.getAlbums() } Assert.assertEquals(true, response.error is AError.Network) } } @Test fun testApiWrapperAuthError() { runBlocking { whenever(api.getAlbums()).thenReturn( Response.error(401, errorBody.toResponseBody()) ) val response = apiWrapper { api.getAlbums() } val err = response.error as AError.Authorization Assert.assertEquals("Business error", err.msg) } } @Test fun testApiWrapperInvalidErrorrFormat() { runBlocking { whenever(api.getAlbums()).thenReturn( Response.error(412, "invalid_json".toResponseBody()) ) val response = apiWrapper { api.getAlbums() } val err = response.error as AError.Generic Assert.assertEquals(AError.GENERIC_ERROR_NOT_PARSED, err.code) } } @Test fun testInvalidMessage() { runBlocking { whenever(api.getAlbums()).thenReturn( Response.error(412, "not a json string".toResponseBody()) ) val response = apiWrapper { api.getAlbums() } val err = response.error as AError.Generic assertEquals(AError.GENERIC_ERROR_NOT_PARSED, err.code) } } } <|start_filename|>app/src/main/java/me/toptas/architecture/App.kt<|end_filename|> package me.toptas.architecture import android.app.Application import me.toptas.architecture.common.pref.PreferenceWrapper import me.toptas.architecture.di.modules import org.koin.android.ext.android.inject import org.koin.android.ext.android.startKoin class App : Application() { private val pref: PreferenceWrapper by inject() override fun onCreate() { super.onCreate() startKoin(this, modules) pref.init(this) } } <|start_filename|>network/src/main/java/me/toptas/architecture/network/ApiInterceptor.kt<|end_filename|> package me.toptas.architecture.network import me.toptas.architecture.common.pref.PreferenceWrapper import okhttp3.Interceptor import okhttp3.Response class ApiInterceptor(private val pref: PreferenceWrapper) : Interceptor { override fun intercept(chain: Interceptor.Chain): Response { val request = chain.request() val newRequest = request.newBuilder() .header("Authorization", "Bearer ${pref.token}") .build() return chain.proceed(newRequest) } } <|start_filename|>app/src/androidTest/java/me/toptas/architecture/feature/main/MainActivitySuccessTest.kt<|end_filename|> package me.toptas.architecture.feature.main import android.content.Intent import androidx.test.espresso.Espresso.onView import androidx.test.espresso.assertion.ViewAssertions.matches import androidx.test.espresso.matcher.ViewMatchers.isDisplayed import androidx.test.espresso.matcher.ViewMatchers.withText import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.rule.ActivityTestRule import com.nhaarman.mockitokotlin2.mock import com.nhaarman.mockitokotlin2.whenever import kotlinx.coroutines.runBlocking import me.toptas.architecture.common.model.Album import me.toptas.architecture.common.model.ApiResponse import me.toptas.architecture.data.repository.MainRepository import me.toptas.architecture.features.main.MainActivity import org.junit.Before import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith import org.koin.dsl.module.module import org.koin.standalone.StandAloneContext @RunWith(AndroidJUnit4::class) class MainActivitySuccessTest { @get:Rule val rule = ActivityTestRule(MainActivity::class.java, false, false) private val repo: MainRepository = mock() @Before fun setup() { runBlocking { whenever(repo.getAlbums()).thenReturn(ApiResponse(success = listOf(Album("title")))) } StandAloneContext.loadKoinModules(module { single(override = true) { repo } }) val intent = Intent() rule.launchActivity(intent) } @Test fun testFetchAlbums() { onView(withText("title")).check(matches(isDisplayed())) } } <|start_filename|>network/src/main/java/me/toptas/architecture/network/ApiWrapper.kt<|end_filename|> package me.toptas.architecture.network import com.google.gson.Gson import me.toptas.architecture.common.model.AError import me.toptas.architecture.common.model.ApiResponse import me.toptas.architecture.common.model.ResponseError import retrofit2.Response import java.net.UnknownHostException import java.util.concurrent.TimeoutException import javax.net.ssl.SSLException suspend fun <T> apiWrapper(service: suspend () -> Response<T>): ApiResponse<T> { return try { val response = service() val data = response.body() if (response.isSuccessful && data != null) { ApiResponse(data) } else { val httpStatusCode = response.code() val errorString = response.errorBody()?.string() val error: AError error = try { val errorMsg = parseErrorMessage(errorString) when { httpStatusCode == 401 -> AError.Authorization(errorMsg) !errorMsg.isNullOrEmpty() -> AError.Business(errorMsg) else -> AError.Generic(AError.GENERIC_ERROR_NOT_PARSED) } } catch (e: Exception) { AError.Generic(AError.GENERIC_ERROR_NOT_PARSED) } return ApiResponse(error = error) } } catch (e: Exception) { val error = when (e) { is UnknownHostException -> AError.Network is TimeoutException -> AError.Timeout is SSLException -> AError.SSLError() else -> AError.Network } ApiResponse(error = error) } } private fun parseErrorMessage(body: String?): String? { return Gson().fromJson(body, ResponseError::class.java)?.errorMessage } <|start_filename|>common/src/main/java/me/toptas/architecture/common/pref/StringPref.kt<|end_filename|> package me.toptas.architecture.common.pref import android.content.SharedPreferences import kotlin.properties.ReadWriteProperty import kotlin.reflect.KProperty class StringPref(private val key: String) : ReadWriteProperty<PreferenceWrapper, String> { override fun getValue(thisRef: PreferenceWrapper, property: KProperty<*>) = thisRef.getString(key).orEmpty() override fun setValue(thisRef: PreferenceWrapper, property: KProperty<*>, value: String) { thisRef.setString(key, value) } } fun SharedPreferences.putString(key: String, value: String) { edit().putString(key, value).apply() } <|start_filename|>common/src/main/java/me/toptas/architecture/common/model/AError.kt<|end_filename|> package me.toptas.architecture.common.model sealed class AError { object Network : AError() object Timeout : AError() class SSLError(val code: Int = CODE_SSL) : AError() class Generic(val code: Int) : AError() class Business(val msg: String) : AError() class Authorization(val msg: String? = null) : AError() companion object { const val GENERIC_ERROR_NOT_PARSED = -1 const val CODE_CONNECTION = -2 const val CODE_SSL = -3 } } <|start_filename|>app/src/main/java/me/toptas/architecture/base/BaseViewModel.kt<|end_filename|> package me.toptas.architecture.base import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope import kotlinx.coroutines.launch import me.toptas.architecture.common.ext.postFalse import me.toptas.architecture.common.ext.postTrue import me.toptas.architecture.common.model.AError import me.toptas.architecture.common.model.ApiResponse open class BaseViewModel : ViewModel() { val loadingLive = SingleLiveEvent<Boolean>() val baseErrorLive = SingleLiveEvent<AError>() val finishLive = SingleLiveEvent<Boolean>() val toastLive = SingleLiveEvent<String>() fun showLoading() = loadingLive.postTrue() fun hideLoading() = loadingLive.postFalse() fun postError(err: AError) = baseErrorLive.postValue(err) fun <T> callService( service: suspend () -> ApiResponse<T>, success: (response: T) -> Unit, failure: (err: AError) -> Unit = { err -> postError(err) }, showLoading: Boolean = true ) { if (showLoading) showLoading() viewModelScope.launch { val response = service() hideLoading() if (response.success != null) { success(response.success!!) } else { if (response.error != null) { failure(response.error!!) } else { failure(AError.Generic(AError.GENERIC_ERROR_NOT_PARSED)) } } } } } <|start_filename|>app/src/main/java/me/toptas/architecture/ext/Live.kt<|end_filename|> package me.toptas.architecture.ext import androidx.lifecycle.LifecycleOwner import androidx.lifecycle.LiveData import me.toptas.architecture.base.BaseListAdapter import me.toptas.architecture.common.ext.observeNotNull fun <T> LiveData<List<T>>.asAdapterItems(owner: LifecycleOwner, adapter: BaseListAdapter<T, *>) { observeNotNull(owner, { adapter.setItems(it) }) } <|start_filename|>app/src/test/java/me/toptas/architecture/base/BaseTest.kt<|end_filename|> package me.toptas.architecture.base import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.test.resetMain import kotlinx.coroutines.test.setMain import org.junit.After open class BaseTest { fun setDispatcher() { Dispatchers.setMain(Dispatchers.Unconfined) } @After fun after() { Dispatchers.resetMain() } } <|start_filename|>app/src/main/java/me/toptas/architecture/di/Modules.kt<|end_filename|> package me.toptas.architecture.di import me.toptas.architecture.data.repository.repositoryModule import me.toptas.architecture.network.networkModule val modules = listOf( appModule, networkModule, repositoryModule, viewModelModule ) <|start_filename|>app/src/test/java/me/toptas/architecture/base/Live.kt<|end_filename|> package me.toptas.architecture.base import androidx.lifecycle.LiveData fun <T> LiveData<T>.observedValue(): T? { observeForever { } return value } <|start_filename|>common/src/main/java/me/toptas/architecture/common/model/ApiResponse.kt<|end_filename|> package me.toptas.architecture.common.model data class ApiResponse<T>(val success: T? = null, val error: AError? = null) <|start_filename|>app/src/main/java/me/toptas/architecture/base/BaseActivity.kt<|end_filename|> package me.toptas.architecture.base import android.content.Context import android.os.Bundle import android.util.Log import android.widget.Toast import androidx.appcompat.app.AppCompatActivity import com.google.android.material.dialog.MaterialAlertDialogBuilder import me.toptas.architecture.common.ext.observeIfTrue import me.toptas.architecture.common.ext.observeNotNull import me.toptas.architecture.common.model.AError import me.toptas.architecture.view.LoadingDialog abstract class BaseActivity : AppCompatActivity() { private lateinit var loadingIndicator: LoadingDialog override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) loadingIndicator = LoadingDialog(this) } fun bindViewModel(vm: BaseViewModel) { vm.loadingLive.observeNotNull(this) { if (isFinishing) return@observeNotNull if (it) { loadingIndicator.show() } else { loadingIndicator.hide() } } vm.baseErrorLive.observeNotNull(this, ::showError) vm.finishLive.observeIfTrue(this) { finish() } vm.toastLive.observeNotNull(this) { Toast.makeText(this, it, Toast.LENGTH_SHORT).show() } } /** * All business and networks errors must be handled here */ private fun showError(error: AError) { val msg = when (error) { AError.Network -> "Network error" is AError.Business -> error.msg else -> "Generic error" } showAlert(msg) } private fun showAlert(message: String) { val builder = MaterialAlertDialogBuilder(this).apply { setTitle("Alert") setMessage(message) setCancelable(false) setPositiveButton("Ok") { _, _ -> } } builder.show() } } <|start_filename|>app/src/test/java/me/toptas/architecture/features/main/MainViewModelTest.kt<|end_filename|> package me.toptas.architecture.features.main import androidx.arch.core.executor.testing.InstantTaskExecutorRule import com.nhaarman.mockitokotlin2.mock import com.nhaarman.mockitokotlin2.whenever import junit.framework.Assert.assertEquals import junit.framework.Assert.assertNull import kotlinx.coroutines.runBlocking import me.toptas.architecture.base.BaseTest import me.toptas.architecture.base.observedValue import me.toptas.architecture.common.model.AError import me.toptas.architecture.common.model.Album import me.toptas.architecture.common.model.ApiResponse import me.toptas.architecture.data.repository.MainRepository import org.junit.Before import org.junit.Rule import org.junit.Test class MainViewModelTest : BaseTest() { @get:Rule val rule = InstantTaskExecutorRule() private val repo: MainRepository = mock() private val vm = MainViewModel(repo) @Before fun setup() { setDispatcher() } @Test fun testSuccessfulFetch() { runBlocking { // when whenever(repo.getAlbums()).thenReturn(ApiResponse(success = listOf(Album("title")))) vm.fetchItems() // then assertEquals(vm.albumsLive.observedValue()?.firstOrNull()?.title, "title") } } @Test fun testFailedFetch() { runBlocking { whenever(repo.getAlbums()).thenReturn(ApiResponse(error = AError.Business("Business error"))) vm.fetchItems() assertNull(vm.albumsLive.observedValue()) val error = vm.baseErrorLive.observedValue() as AError.Business assertEquals("Business error", error.msg) } } @Test fun testFailedFetchWithEmptyErrorr() { runBlocking { whenever(repo.getAlbums()).thenReturn(ApiResponse()) vm.fetchItems() assertNull(vm.albumsLive.observedValue()) val error = vm.baseErrorLive.observedValue() as AError.Generic assertEquals(AError.GENERIC_ERROR_NOT_PARSED, error.code) } } } <|start_filename|>data/src/main/java/me/toptas/architecture/data/repository/RepositoryModule.kt<|end_filename|> package me.toptas.architecture.data.repository import org.koin.dsl.module.module val repositoryModule = module { single<MainRepository> { MainRepositoryImpl(get()) } } <|start_filename|>network/src/main/java/me/toptas/architecture/network/NetworkModule.kt<|end_filename|> package me.toptas.architecture.network import com.google.gson.Gson import me.toptas.okmockerwriter.OkMockerWriteInterceptor import me.toptas.okmockerwriter.SdCardWriter import okhttp3.OkHttpClient import okhttp3.logging.HttpLoggingInterceptor import org.koin.dsl.module.module import retrofit2.Retrofit import retrofit2.converter.gson.GsonConverterFactory import java.util.concurrent.TimeUnit private const val BASE_URL = "https://jsonplaceholder.typicode.com/" val networkModule = module { single { Gson() } single { ApiInterceptor(get()) } single(override = true) { val builder = OkHttpClient.Builder() .readTimeout(30, TimeUnit.SECONDS) .connectTimeout(30, TimeUnit.SECONDS) .addInterceptor(get<ApiInterceptor>()) if (BuildConfig.DEBUG) { builder.addInterceptor(HttpLoggingInterceptor().apply { level = HttpLoggingInterceptor.Level.BODY }) } builder.build() } single { Retrofit.Builder() .baseUrl(BASE_URL) .client(get()) .addConverterFactory(GsonConverterFactory.create(get())) .build() } single<Api> { get<Retrofit>().create(Api::class.java) } } <|start_filename|>app/src/main/java/me/toptas/architecture/features/main/MainActivity.kt<|end_filename|> package me.toptas.architecture.features.main import android.os.Bundle import android.util.Log import kotlinx.android.synthetic.main.activity_main.* import me.toptas.architecture.R import me.toptas.architecture.base.BaseActivity import me.toptas.architecture.common.ext.observeNotNull import me.toptas.architecture.ext.asAdapterItems import org.koin.android.viewmodel.ext.android.viewModel class MainActivity : BaseActivity() { private val viewModel: MainViewModel by viewModel() override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) bindViewModel(viewModel) viewModel.fetchItems() val adapter = AlbumAdapter() rv.adapter = adapter viewModel.albumsLive.asAdapterItems(this, adapter) } } <|start_filename|>app/src/test/java/me/toptas/architecture/features/Dummy.kt<|end_filename|> package me.toptas.architecture.features <|start_filename|>common/src/main/java/me/toptas/architecture/common/ext/Live.kt<|end_filename|> package me.toptas.architecture.common.ext import androidx.lifecycle.LifecycleOwner import androidx.lifecycle.LiveData import androidx.lifecycle.MutableLiveData fun MutableLiveData<Boolean>.postTrue() = postValue(true) fun MutableLiveData<Boolean>.postFalse() = postValue(false) fun <T> LiveData<T>.observeNotNull(owner: LifecycleOwner, observer: (t: T) -> Unit) { observe(owner, { it?.apply { observer(this) } }) } fun LiveData<Boolean>.observeIfTrue(owner: LifecycleOwner, observer: () -> Unit) { observe(owner, { if (it == true) observer() }) } <|start_filename|>app/src/androidTest/java/me/toptas/architecture/feature/main/MainActivityFailTest.kt<|end_filename|> package me.toptas.architecture.feature.main import android.content.Intent import androidx.test.espresso.Espresso.onView import androidx.test.espresso.assertion.ViewAssertions.matches import androidx.test.espresso.matcher.ViewMatchers.* import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.rule.ActivityTestRule import com.nhaarman.mockitokotlin2.mock import com.nhaarman.mockitokotlin2.whenever import kotlinx.coroutines.runBlocking import me.toptas.architecture.common.model.AError import me.toptas.architecture.common.model.ApiResponse import me.toptas.architecture.data.repository.MainRepository import me.toptas.architecture.features.main.MainActivity import org.junit.Before import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith import org.koin.dsl.module.module import org.koin.standalone.StandAloneContext @RunWith(AndroidJUnit4::class) class MainActivityFailTest { @get:Rule val rule = ActivityTestRule(MainActivity::class.java, false, false) private val repo: MainRepository = mock() @Before fun setup() { runBlocking { whenever(repo.getAlbums()).thenReturn(ApiResponse(error = AError.Network)) } StandAloneContext.loadKoinModules(module { single(override = true) { repo } }) val intent = Intent() rule.launchActivity(intent) } @Test fun testFetchAlbumsFailed() { onView(withId(android.R.id.message)).check(matches(withText("Network error"))) } } <|start_filename|>data/src/main/java/me/toptas/architecture/data/repository/MainRepository.kt<|end_filename|> package me.toptas.architecture.data.repository import me.toptas.architecture.common.model.Album import me.toptas.architecture.common.model.ApiResponse import me.toptas.architecture.network.Api import me.toptas.architecture.network.apiWrapper interface MainRepository { suspend fun getAlbums(): ApiResponse<List<Album>> } class MainRepositoryImpl(private val api: Api) : MainRepository { override suspend fun getAlbums() = apiWrapper { api.getAlbums() } } <|start_filename|>network/src/main/java/me/toptas/architecture/network/Api.kt<|end_filename|> package me.toptas.architecture.network import me.toptas.architecture.common.model.Album import retrofit2.Response import retrofit2.http.GET interface Api { @GET("photos") suspend fun getAlbums(): Response<List<Album>> } <|start_filename|>common/src/main/java/me/toptas/architecture/common/pref/PreferenceWrapper.kt<|end_filename|> package me.toptas.architecture.common.pref import android.content.Context import android.content.SharedPreferences import androidx.preference.PreferenceManager class PreferenceWrapper { private lateinit var preferences: SharedPreferences fun init(context: Context) { preferences = PreferenceManager.getDefaultSharedPreferences(context) } var token: String by StringPref(TOKEN) fun getString(key: String) = preferences.getString(key, "") fun setString(key: String, value: String) = preferences.putString(key, value) companion object { private const val TOKEN = "token" } } <|start_filename|>common/src/main/java/me/toptas/architecture/common/model/Album.kt<|end_filename|> package me.toptas.architecture.common.model data class Album(val title: String) <|start_filename|>app/src/main/java/me/toptas/architecture/features/main/MainViewModel.kt<|end_filename|> package me.toptas.architecture.features.main import androidx.lifecycle.MutableLiveData import me.toptas.architecture.base.BaseViewModel import me.toptas.architecture.common.model.Album import me.toptas.architecture.data.repository.MainRepository class MainViewModel(private val repo: MainRepository) : BaseViewModel() { val albumsLive = MutableLiveData<List<Album>>() fun fetchItems() { callService({ repo.getAlbums() }, { albumsLive.postValue(it) }) } } <|start_filename|>app/src/main/java/me/toptas/architecture/di/AppModule.kt<|end_filename|> package me.toptas.architecture.di import me.toptas.architecture.common.pref.PreferenceWrapper import org.koin.dsl.module.module val appModule = module { single { PreferenceWrapper() } } <|start_filename|>app/src/main/java/me/toptas/architecture/base/BaseListAdapter.kt<|end_filename|> package me.toptas.architecture.base import android.view.LayoutInflater import android.view.ViewGroup import androidx.databinding.DataBindingUtil import androidx.databinding.ViewDataBinding import androidx.recyclerview.widget.DiffUtil import androidx.recyclerview.widget.RecyclerView abstract class BaseListAdapter<T, in DB : ViewDataBinding> : RecyclerView.Adapter<BaseListAdapter<T, DB>.BaseViewHolder>() { private var items: List<T>? = null var onItemClick: (T) -> Unit = {} var onItemPositionClick: (Int) -> Unit = {} abstract fun layoutResource(): Int abstract fun bindingVariableId(): Int // TODO: DiffUtil can be used here fun setItems(newList: List<T>?) { items = newList notifyDataSetChanged() } fun getItems() = items open fun bind(holder: BaseViewHolder, item: T?) { } override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): BaseViewHolder { val layoutInflater = LayoutInflater.from(parent.context) val binding = DataBindingUtil.inflate<DB>(layoutInflater, layoutResource(), parent, false) return BaseViewHolder(binding, bindingVariableId()) } override fun onBindViewHolder(holder: BaseViewHolder, position: Int) { val item = if (!items.isNullOrEmpty() && position < items!!.size) items!![position] else null holder.bind(item) holder.itemView.setOnClickListener { item?.let { onItemClick(it) } onItemPositionClick(position) } bind(holder, item) } override fun getItemCount() = items?.size ?: 0 inner class BaseViewHolder(val binding: ViewDataBinding, private val variableId: Int) : RecyclerView.ViewHolder(binding.root) { fun bind(item: T?) { binding.setVariable(variableId, item) binding.executePendingBindings() } } }
faruktoptas/mvvm-arch-sample
<|start_filename|>chrome/lib/main.js<|end_filename|> var rules = [ { "s": "ajax.googleapis.com", "t": "ajax.cat.net" }, { "s": "fonts.googleapis.com", "t": "fonts.cat.net" }, ]; chrome.webRequest.onBeforeRequest.addListener( function (request) { var redirectUrl, requestURL = request.url; for (var i in rules) { if (requestURL.indexOf(rules[i].s)) { redirectUrl = requestURL.replace(rules[i].s, rules[i].t); return { redirectUrl: redirectUrl }; } } }, { urls: ["<all_urls>"] }, ["blocking"] ); <|start_filename|>firefox/lib/main.js<|end_filename|> const { Cc, Ci } = require("chrome"); const { newURI } = require('sdk/url/utils'); var rules = [ { "s": "ajax.googleapis.com", "t": "ajax.cat.net" }, { "s": "fonts.googleapis.com", "t": "fonts.cat.net" }, ]; var httpRequestObserver = { observe: function (subject, topic, data) { if (topic == "http-on-modify-request") { var httpChannel = subject.QueryInterface(Ci.nsIHttpChannel); var redirectUrl, requestURL = subject.URI.spec; for (var i in rules) { if (requestURL.indexOf(rules[i].s)) { redirectUrl = requestURL.replace(rules[i].s, rules[i].t); httpChannel.redirectTo(newURI(redirectUrl)); } } } }, get observerService() { return Cc["@mozilla.org/observer-service;1"] .getService(Ci.nsIObserverService); }, register: function () { this.observerService.addObserver(this, "http-on-modify-request", false); }, unregister: function () { this.observerService.removeObserver(this, "http-on-modify-request"); } }; httpRequestObserver.register(); <|start_filename|>firefox/package.json<|end_filename|> { "name": "replacegooglecdn", "title": "ReplaceGoogleCDN", "id": "<EMAIL>googlecdn@wa<EMAIL>", "description": "Replace Google CDN", "author": "waquer", "license": "MPL 2.0", "version": "0.1", "icon": "data/icon-64.png" }
waquer/ReplaceGoogleCDN
<|start_filename|>test/spec.js<|end_filename|> browser.ignoreSynchronization = true; browser.get(browser.baseUrl+'/ajaxzip3.html'); describe('AjaxZip3.zip2addr', function() { describe('郵便番号を3桁-4桁形式で入力される場合', function() { it('住所欄をワンボックスにする場合', function() { element(by.name('yubin01')).sendKeys(100) .then(function(){ element(by.name('yubin02')).sendKeys(8950) .then(function(){ browser.driver.sleep(1000) .then(function(){ expect(element(by.name('addr01')).getAttribute('value')). toEqual('東京都千代田区霞が関'); //東京都千代田区霞が関1丁目2-1 }); }); }); }); it('都道府県 と 以降の住所 に分ける場合', function() { element(by.name('yubin11')).sendKeys(100) .then(function(){ element(by.name('yubin12')).sendKeys(8950) .then(function(){ browser.driver.sleep(1000) .then(function(){ expect(element(by.name('region11')).getAttribute('value')). toEqual('東京都'); expect(element(by.name('addr11')).getAttribute('value')). toEqual('千代田区霞が関'); }); }); }); }); it('都道府県 と 市町村区 と 以降の住所に分ける場合', function() { element(by.name('yubin21')).sendKeys(100) .then(function(){ element(by.name('yubin22')).sendKeys(8950) .then(function(){ browser.driver.sleep(1000) .then(function(){ expect(element(by.name('region21')).getAttribute('value')). toEqual('東京都'); expect(element(by.name('local21')).getAttribute('value')). toEqual('千代田区'); expect(element(by.name('addr21')).getAttribute('value')). toEqual('霞が関'); }); }); }); }); it('都道府県 と 市町村区 と 以降の住所に分ける場合', function() { element(by.name('yubin31')).sendKeys(100) .then(function(){ element(by.name('yubin32')).sendKeys(8950) .then(function(){ browser.driver.sleep(1000) .then(function(){ expect(element(by.name('region31')).getAttribute('value')). toEqual('東京都'); expect(element(by.name('local31')).getAttribute('value')). toEqual('千代田区'); expect(element(by.name('street31')).getAttribute('value')). toEqual('霞が関'); expect(element(by.name('extended31')).getAttribute('value')). toEqual('1丁目2-1'); }); }); }); }); }); describe('ワンボックスで郵便番号7桁を入力させる場合', function() { it('住所欄をワンボックスにする場合', function() { element(by.name('yubin41')).sendKeys(1008950) .then(function(){ browser.driver.sleep(1000) .then(function(){ expect(element(by.name('addr41')).getAttribute('value')). toEqual('東京都千代田区霞が関'); //東京都千代田区霞が関1丁目2-1 }); }); }); it('都道府県 と 以降の住所 に分ける場合', function() { element(by.name('yubin51')).sendKeys(1008950) .then(function(){ browser.driver.sleep(1000) .then(function(){ expect(element(by.name('region51')).getAttribute('value')). toEqual('東京都'); expect(element(by.name('addr51')).getAttribute('value')). toEqual('千代田区霞が関'); }); }); }); it('都道府県 と 市町村区 と 以降の住所に分ける場合', function() { element(by.name('yubin61')).sendKeys(1008950) .then(function(){ browser.driver.sleep(1000) .then(function(){ expect(element(by.name('region61')).getAttribute('value')). toEqual('東京都'); expect(element(by.name('local61')).getAttribute('value')). toEqual('千代田区'); expect(element(by.name('addr61')).getAttribute('value')). toEqual('霞が関'); }); }); }); it('都道府県 と 市町村区 と 以降の住所に分ける場合', function() { element(by.name('yubin71')).sendKeys(1008950) .then(function(){ browser.driver.sleep(1000) .then(function(){ expect(element(by.name('region71')).getAttribute('value')). toEqual('東京都'); expect(element(by.name('local71')).getAttribute('value')). toEqual('千代田区'); expect(element(by.name('street71')).getAttribute('value')). toEqual('霞が関'); expect(element(by.name('extended71')).getAttribute('value')). toEqual('1丁目2-1'); }); }); }); }); }); <|start_filename|>ajaxzip3-source.js<|end_filename|> /* ================================================================ * ajaxzip3.js ---- AjaxZip3 郵便番号→住所変換ライブラリ Copyright (c) 2008-2015 Ninkigumi Co.,Ltd. http://ajaxzip3.github.io/ Copyright (c) 2006-2007 <NAME> <u-suke [at] kawa.net> http://www.kawa.net/works/ajax/AjaxZip2/AjaxZip2.html Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ================================================================ */ AjaxZip3 = function(){}; AjaxZip3.VERSION = '0.51'; AjaxZip3.JSONDATA = 'https://yubinbango.github.io/yubinbango-data/data'; AjaxZip3.CACHE = []; AjaxZip3.prev = ''; AjaxZip3.nzip = ''; AjaxZip3.fzip1 = ''; AjaxZip3.fzip2 = ''; AjaxZip3.fpref = ''; AjaxZip3.addr = ''; AjaxZip3.fstrt = ''; AjaxZip3.farea = ''; AjaxZip3.ffocus = true; AjaxZip3.onSuccess = null; AjaxZip3.onFailure = null; AjaxZip3.PREFMAP = [ null, '北海道', '青森県', '岩手県', '宮城県', '秋田県', '山形県', '福島県', '茨城県', '栃木県', '群馬県', '埼玉県', '千葉県', '東京都', '神奈川県', '新潟県', '富山県', '石川県', '福井県', '山梨県', '長野県', '岐阜県', '静岡県', '愛知県', '三重県', '滋賀県', '京都府', '大阪府', '兵庫県', '奈良県', '和歌山県', '鳥取県', '島根県', '岡山県', '広島県', '山口県', '徳島県', '香川県', '愛媛県', '高知県', '福岡県', '佐賀県', '長崎県', '熊本県', '大分県', '宮崎県', '鹿児島県', '沖縄県' ]; AjaxZip3.zip2addr = function ( azip1, azip2, apref, aaddr, aarea, astrt, afocus ) { AjaxZip3.fzip1 = AjaxZip3.getElementByName(azip1); AjaxZip3.fzip2 = AjaxZip3.getElementByName(azip2,AjaxZip3.fzip1); AjaxZip3.fpref = AjaxZip3.getElementByName(apref,AjaxZip3.fzip1); AjaxZip3.faddr = AjaxZip3.getElementByName(aaddr,AjaxZip3.fzip1); AjaxZip3.fstrt = AjaxZip3.getElementByName(astrt,AjaxZip3.fzip1); AjaxZip3.farea = AjaxZip3.getElementByName(aarea,AjaxZip3.fzip1); AjaxZip3.ffocus = afocus === undefined ? true : afocus; if ( ! AjaxZip3.fzip1 ) return; if ( ! AjaxZip3.fpref ) return; if ( ! AjaxZip3.faddr ) return; // 郵便番号を数字のみ7桁取り出す // var zipoptimize = function(AjaxZip3.fzip1, AjaxZip3.fzip2){ var vzip = AjaxZip3.fzip1.value; if ( AjaxZip3.fzip2 && AjaxZip3.fzip2.value ) vzip += AjaxZip3.fzip2.value; if ( ! vzip ) return; AjaxZip3.nzip = ''; for( var i=0; i<vzip.length; i++ ) { var chr = vzip.charCodeAt(i); if ( chr < 48 ) continue; if ( chr > 57 ) continue; AjaxZip3.nzip += vzip.charAt(i); } if ( AjaxZip3.nzip.length < 7 ) return; // }; // 前回と同じ値&フォームならキャンセル var uniqcheck = function(){ var uniq = AjaxZip3.nzip+AjaxZip3.fzip1.name+AjaxZip3.fpref.name+AjaxZip3.faddr.name; if ( AjaxZip3.fzip1.form ) uniq += AjaxZip3.fzip1.form.id+AjaxZip3.fzip1.form.name+AjaxZip3.fzip1.form.action; if ( AjaxZip3.fzip2 ) uniq += AjaxZip3.fzip2.name; if ( AjaxZip3.fstrt ) uniq += AjaxZip3.fstrt.name; if ( uniq == AjaxZip3.prev ) return; AjaxZip3.prev = uniq; }; // 郵便番号上位3桁でキャッシュデータを確認 var zip3 = AjaxZip3.nzip.substr(0,3); var data = AjaxZip3.CACHE[zip3]; if ( data ) return AjaxZip3.callback( data ); AjaxZip3.zipjsonpquery(); }; AjaxZip3.callback = function(data){ function onFailure( ){ if( typeof AjaxZip3.onFailure === 'function' ) AjaxZip3.onFailure(); } var array = data[AjaxZip3.nzip]; // Opera バグ対策:0x00800000 を超える添字は +0xff000000 されてしまう var opera = (AjaxZip3.nzip-0+0xff000000)+""; if ( ! array && data[opera] ) array = data[opera]; if ( ! array ) { onFailure(); return; } var pref_id = array[0]; // 都道府県ID if ( ! pref_id ) { onFailure(); return; } var jpref = AjaxZip3.PREFMAP[pref_id]; // 都道府県名 if ( ! jpref ) { onFailure(); return; } var jcity = array[1]; if ( ! jcity ) jcity = ''; // 市区町村名 var jarea = array[2]; if ( ! jarea ) jarea = ''; // 町域名 var jstrt = array[3]; if ( ! jstrt ) jstrt = ''; // 番地 var cursor = AjaxZip3.faddr; var jaddr = jcity; // 市区町村名 if ( AjaxZip3.fpref.type == 'select-one' || AjaxZip3.fpref.type == 'select-multiple' ) { // 都道府県プルダウンの場合 var opts = AjaxZip3.fpref.options; for( var i=0; i<opts.length; i++ ) { var vpref = opts[i].value; var tpref = opts[i].text; opts[i].selected = ( vpref == pref_id || vpref == jpref || tpref == jpref ); } } else { if ( AjaxZip3.fpref.name == AjaxZip3.faddr.name ) { // 都道府県名+市区町村名+町域名合体の場合 jaddr = jpref + jaddr; } else { // 都道府県名テキスト入力の場合 AjaxZip3.fpref.value = jpref; } } if ( AjaxZip3.farea ) { cursor = AjaxZip3.farea; AjaxZip3.farea.value = jarea; } else { jaddr += jarea; } if ( AjaxZip3.fstrt ) { cursor = AjaxZip3.fstrt; if ( AjaxZip3.faddr.name == AjaxZip3.fstrt.name ) { // 市区町村名+町域名+番地合体の場合 jaddr = jaddr + jstrt; } else if ( jstrt ) { // 番地テキスト入力欄がある場合 AjaxZip3.fstrt.value = jstrt; } } AjaxZip3.faddr.value = jaddr; if( typeof AjaxZip3.onSuccess === 'function' ) AjaxZip3.onSuccess(); // patch from http://iwa-ya.sakura.ne.jp/blog/2006/10/20/050037 // update http://www.kawa.net/works/ajax/AjaxZip2/AjaxZip2.html#com-2006-12-15T04:41:22Z if ( !AjaxZip3.ffocus ) return; if ( ! cursor ) return; if ( ! cursor.value ) return; var len = cursor.value.length; cursor.focus(); if ( cursor.createTextRange ) { var range = cursor.createTextRange(); range.move('character', len); range.select(); } else if (cursor.setSelectionRange) { cursor.setSelectionRange(len,len); } }; // Safari 文字化け対応 // http://kawa.at.webry.info/200511/article_9.html AjaxZip3.getResponseText = function ( req ) { var text = req.responseText; if ( navigator.appVersion.indexOf('KHTML') > -1 ) { var esc = escape( text ); if ( esc.indexOf('%u') < 0 && esc.indexOf('%') > -1 ) { text = decodeURIComponent( esc ); } } return text; } // フォームnameから要素を取り出す AjaxZip3.getElementByName = function ( elem, sibling ) { if ( typeof(elem) == 'string' ) { var list = document.getElementsByName(elem); if ( ! list ) return null; if ( list.length > 1 && sibling && sibling.form ) { var form = sibling.form.elements; for( var i=0; i<form.length; i++ ) { if ( form[i].name == elem ) { return form[i]; } } } else { return list[0]; } } return elem; } AjaxZip3.zipjsonpquery = function(){ var url = AjaxZip3.JSONDATA+'/'+AjaxZip3.nzip.substr(0,3)+'.js'; var scriptTag = document.createElement("script"); scriptTag.setAttribute("type", "text/javascript"); scriptTag.setAttribute("charset", "UTF-8"); scriptTag.setAttribute("src", url); document.getElementsByTagName("head").item(0).appendChild(scriptTag); }; function $yubin(data){ AjaxZip3.callback(data); };
maisumakun/ajaxzip3.github.io
<|start_filename|>haxelib.json<|end_filename|> { "name": "tink_xml", "license": "MIT", "tags": [ "tink", "cross", "utility", "xml" ], "classPath": "src", "description": "Xml to Haxe objects", "contributors": [ "back2dos" ], "releasenote": "Give control over duplicate nodes.", "version": "0.2.0", "url": "http://haxetink.org/tink_xml", "dependencies": { "tink_macro": "" } }
haxetink/tink_xml
<|start_filename|>hsv_dot_beer/users/templates/hsv_dot_beer/alabama_dot_beer.html<|end_filename|> {% extends 'theme/base.html' %} {% load static %} {% block title %}{{ block.super }}: Welcome{% endblock %} {% block content %} <h1 class="text-2xl">Welcome to the alabama.beer backend page!</h1> {% if user.is_anonymous %} <div>If you're here to enter beers for your taproom, <a class="text-blue-400" href="{% url 'login' %}">log in</a> first.</div> {% else %} <div class="text-red-600">Sorry, your user account is not configured to manage any taprooms. Please ask the alabama.beer admins for help</div> {% endif %} <div>If you just want to play with the API, you can <a class="text-blue-400" href="{% url 'api-root' %}">browse the API<a> and look around.</div> <div>Otherwise, download the apps!</div> <div class="flex"> <div class="flex-1"> <a href="https://apps.apple.com/us/app/id1523704536"><img src="{% static 'hsv_dot_beer/png/apple_app_store.png' %}" title="Apple App Store" alt="Download on the Apple App Store"></a> </div> <div class="flex-1"> <a href="https://play.google.com/store/apps/details?id=org.alabamabrewers.albeertrail"><img src="{% static 'hsv_dot_beer/png/google_play.png' %}" title="Google Play" alt="Download the Android App on Google Play"></a> </div> </div> {% endblock %} <|start_filename|>hsv_dot_beer/users/templates/hsv_dot_beer/home.html<|end_filename|> {% extends 'theme/base.html' %} {% block title %}{{ block.super }}: Welcome{% endblock %} {% block content %} <h1 class="text-2xl">Welcome to the hsv.beer backend page!</h1> {% if user.is_anonymous %} <div>If you're here to enter beers for your taproom, <a class="text-blue-400" href="{% url 'login' %}">log in</a> first.</div> {% else %} <div class="text-red-600">Sorry, your user account is not configured to manage any taprooms. Please ask the HSV.beer admins for help</div> {% endif %} <div>If you just want to play with the API, you can <a class="text-blue-400" href="{% url 'api-root' %}">browse the API<a> and look around.</div> <div>If you're looking to see what's on tap, you want to go to <a href="https://hsv.beer/" class="text-blue-400">HSV.beer</a>.</div> <div>Also don't forget to check us out on <a class="text-blue-400" href="https://twitter.com/hsvdotbeer/">Twitter</a>.</div> {% endblock %} <|start_filename|>taps/templates/taps/tap_form.html<|end_filename|> {% extends "theme/base.html" %} {% load tailwind_filters %} {% block title %}{{ block.super }}: Configure tap {{ tap.tap_number }} at {{ tap.venue }}{% endblock %} {% block content %} <h1 class="text-2xl">Set up tap number {{ tap.tap_number }} for {{ venue }}</h1> <form action="{% url 'edit_tap_save' venue.id tap.tap_number %}" method="post"> {% csrf_token %} <table>{{ form | crispy }}</table> <input class="bg-blue-500 text-white font-bold py-2 px-4 rounded" type="submit" value="Save"> </form> <div class="text-large"> Don't see the beer you're looking for? <a class="text-blue-400" href="{% url 'create_beer' %}">Add it.</a> </div> {% endblock %} <|start_filename|>hsv_dot_beer/users/templates/registration/login.html<|end_filename|> {% extends "theme/base.html" %} {% load tailwind_filters %} {% block title %}{{ block.super }}: Log in{% endblock %} {% block content %} <h2 class="text-2xl">Log in</h2> <form method="post"> {% csrf_token %} {{ form | crispy }} <input class="bg-blue-500 text-white font-bold py-2 px-4 rounded" type="submit" value="Log in"> </form> {% endblock %} <|start_filename|>venues/templates/venues/venue-main.html<|end_filename|> {% extends "theme/base.html" %} {% block title %}{{ block.super }}: What's on tap at {{ venue.name }}{% endblock %} {% block content %} <h1 class="text-3xl">{{ venue.name }}</h1> <div class="flex grid gap-4 grid-cols-1 md:grid-cols-5"> <div class="text-xl">Tap Number</div> <div class="text-xl">Beer</div> <div class="text-xl">Style</div> <div class="text-xl">Time added</div> <div class="text-xl">Actions</div> {% for tap in venue.taps.all %} <div class="tap-number-cell">{{ tap.tap_number }}</div> <div class="beer-cell">{{ tap.beer }}{% if tap.beer %}<br><span class="text-sm">by {{ tap.beer.manufacturer }}{% endif %}</span></div> <div class="style-cell">{% if tap.beer %}{{ tap.beer.style }}{% else %}N/A{% endif %}</div> <div class="timestamp-cell">{% if tap.beer and tap.time_added %}<span title="{{ tap.time_added}} UTC" class="hover:underline" >{{ tap.time_added | timesince }} ago</span>{% else %}N/A{% endif %}</div> <div class="action-cell"> {% comment %}TODO: add an icon here{% endcomment %} <a class="inline-block text-sm px-4 py-2 leading-none border rounded text-white border-blue-600 bg-blue-600 hover:border-blue-600 hover:text-black hover:bg-white mt-4 lg:mt-0" href="{% url 'edit_tap_pick_mfg' venue.id tap.tap_number %}">{% if tap.beer %}Edit tap{% else %}Tap a keg{% endif %}</a> {% if tap.beer %} <a class="inline-block text-sm px-4 py-2 leading-none border rounded text-black border-red-600 bg-white hover:border-red-600 hover:text-white hover:bg-red-600 mt-4 lg:mt-0" href="{% url 'clear_tap' tap.id %}">Clear tap</a> {% endif %} </div> {% endfor %} </div> <div class="text-xl"><a class="text-blue-600" href="{% url 'create_tap_pick_mfg' venue.id %}">Add another tap</a></div> {% endblock %} <|start_filename|>package.json<|end_filename|> { "name": "hsvdotbeer", "version": "1.0.1", "description": "[![Built with](https://img.shields.io/badge/Built_with-Cookiecutter_Django_Rest-F7B633.svg)](https://github.com/agconti/cookiecutter-django-rest)", "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1", "build": "tailwind build theme/static/theme/css/tailwind.css -o theme/static/theme/css/style.css && cleancss -o theme/static/theme/css/style.min.css theme/static/theme/css/style.css" }, "repository": { "type": "git", "url": "git+https://github.com/hsv-dot-beer/hsvdotbeer.git" }, "keywords": [], "author": "", "license": "Apache-2.0", "bugs": { "url": "https://github.com/hsv-dot-beer/hsvdotbeer/issues" }, "homepage": "https://github.com/hsv-dot-beer/hsvdotbeer#readme", "dependencies": { "autoprefixer": "^10.2.5", "clean-css-cli": "^5.3.0", "tailwindcss": "^2.1.2" }, "engines": { "node": "16.x" } } <|start_filename|>Dockerfile<|end_filename|> FROM python:3.9 ENV PYTHONUNBUFFERED 1 # Allows docker to cache installed dependencies between builds RUN pip install pipenv RUN pip install --upgrade pip setuptools wheel # Adds our application code to the image COPY . /code WORKDIR /code RUN bash /code/setup_node_16.sh RUN apt-get update && apt-get -y dist-upgrade && apt-get -y install libmemcached-dev nodejs # the version of node-sass that tailwind uses doesn't work with npm 5.x under node 10.x, which the debian docker image gives us RUN npm install npm@latest -g # even though this is where `which npm` points to, running `npm install` without the absolute path still runs npm 5.x, # but using the absolute path gives us npm 6.x (current latest as of November 2020) ENV NPM_BIN_PATH /usr/local/bin/npm # install deps from Pipfile.lock RUN pipenv install EXPOSE 8000 # Migrates the database, builds CSS, uploads staticfiles, and runs the production server CMD npm run build && pipenv run ./manage.py migrate && \ pipenv run ./manage.py collectstatic --noinput && \ pipenv run newrelic-admin run-program gunicorn --bind 0.0.0.0:$PORT --access-logfile - hsv_dot_beer.wsgi:application <|start_filename|>beers/templates/beers/manufacturer-select.html<|end_filename|> {% extends "theme/base.html" %} {% load tailwind_filters %} {% block title %}{{ block.super }}: Select a Manufacturer{% endblock %} {% block content %} <h1 class="text-2xl">Choose a manufacturer</h1> <form action="{% if tap_number %}{% url 'edit_tap' venue.id tap_number %}{% else %}{% url 'create_tap' venue.id %}{% endif %}" method="post"> {% csrf_token %} <table>{{ form | crispy }}</table> <input class="bg-blue-500 text-white font-bold py-2 px-4 rounded" type="submit" value="Save"> </form> <div class="text-large"> Don't see the manufacturer you're looking for? <a class="text-blue-400" href="mailto:<EMAIL>">Email the admins</a>. </div> {% endblock %} <|start_filename|>beers/templates/beers/beer_form.html<|end_filename|> {% extends "theme/base.html" %} {% load tailwind_filters %} {% block title %}{{ block.super }}: {% if beer %}Edit {{ beer }}{% else %}Create a beer {% endif %}{% endblock %} {% block content %} <h1 class="text-2xl">{% if beer %}Edit{% else %}Create{% endif %} a beer</h1> <form action="{% if beer %}{% url 'edit_beer' beer.id %}{% else %}{% url 'create_beer' %}{% endif %}" method="post"> {% csrf_token %} <table>{{ form | crispy }}</table> <input class="bg-blue-500 text-white font-bold py-2 px-4 rounded" type="submit" value="Save"> </form> <div class="text-large"> Don't see the style you're looking for? <a class="text-blue-400" href="{% url 'create_style' %}">Add it</a>. </div> {% endblock %} <|start_filename|>tap_list_providers/example_data/goat.html<|end_filename|> <html> <head> <link href="https://untappd.akamaized.net/business/assets/menus/standard-f42cff0841089f5595535f492223673c6b383550130ac7a2caaad23174f4f258.css" media="all" rel="stylesheet"/> </head> <body> <div class="ut-menu ut-menu-standard menu-bg-color" style="display: none"> <div class="inner-container"> <!-- Header Info --> <div class="header-bg-color header-font-color divider-color menu-header-hideable menu-header"> <div class="menu-header-logo-hideable"> <img alt="Goat Island Brewing Logo" src="https://utfb-images.untappd.com/logos/57e93a2ef3030d70d3c97e67c2232a7614dc975e.JPG?auto=compress"/> </div> <div class="header-bg-color row location-info location-info-hideable"> <div class="col pull-left padding-left text-left"> <p class="phone-hideable menu-phone"> 2527475556 </p> </div> <div class="col"> <p class="menu-address address-hideable text-center"> 1646 <NAME> Dr SE Cullman, Alabama </p> </div> <div class="col pull-right text-right padding-right"> <p class="menu-website website-hideable"> <a class="link-font-color" href="http://"> </a> </p> </div> </div> </div> <!-- Menu Tabs --> <div class="menu-nav ut-row divider-color flush-bottom"> <div class="menu-list"> <div class="menu-list-item"> <a class="tab-anchor active" data-tab-id="menu-10414" href="javascript:;"> Goat Island Brewing </a> </div> <div class="menu-list-item"> <a class="tab-anchor" data-tab-id="menu-100171" href="javascript:;"> Puget South </a> </div> <div class="menu-list-item"> <a class="tab-anchor" data-tab-id="events" href="javascript:;"> Events </a> </div> </div> </div> <div> <div class="tab-content" data-tab-id="menu-10414" id="menu-10414"> <div class="menu-info divider-color"> <h1 class="h1 menu-title"> Goat Island Brewing </h1> <div class="date-time"> <span> Updated on </span> <time> Jul 19, 12:40 PM CDT </time> </div> </div> <div class="section item-bg-color"> <div class="section-header-bg-color section-title-color section-heading padding-left padding-right"> <div class="section-name"> Goat Island Brewing </div> </div> <div class="section-items-container"> <div class="item-bg-color menu-items-container padding-left padding-right"> <div class="item-bg-color menu-item clearfix"> <div class="beer"> <div class="label-image-hideable beer-label pull-left"> <a class="link-font-color" href="https://untappd.com/b/goat-island-brewing-goatopia/4418085" target="_blank"> <img alt="Goatopia IPA" src="https://beer.untappd.com/labels/4418085"/> </a> </div> <div class="beer-details item-title-color"> <!-- Beer Name + Style --> <p class="beer-name"> <a class="item-title-color" href="https://untappd.com/b/goat-island-brewing-goatopia/4418085" target="_blank"> <span class="tap-number-hideable"> </span> Goatopia IPA </a> <span class="beer-style beer-style-hideable item-title-color"> IPA - New England </span> </p> <!-- Beer Details --> <div class="item-meta item-title-color"> <div class="abv-hideable"> <span class="abv"> 6.2% ABV </span> </div> <div class="ibu-hideable"> <span class="ibu"> 50 IBU </span> </div> <div class="brewery-name-hideable"> <span class="brewery"> <a class="item-title-color" href="https://untappd.com/brewery/262751" target="_blank"> Goat Island Brewing </a> </span> </div> <div class="brewery-location-hideable"> <span class="location"> Cullman, AL </span> </div> </div> <!-- Beer Description --> <!-- Beer Container List --> <div class="container-list item-title-color"> <div class="with-price"> <div class="conatiner-item"> <div class="container-row"> <span class="type"> 16oz Draft </span> <span class="linear-guide"> </span> <span class="price"> <span class="currency-hideable"> \$ </span> 6.00 </span> </div> </div> </div> <div class="no-price"> <p> <strong> Serving Sizes: </strong> 16oz Draft </p> </div> </div> </div> </div> </div> <div class="item-bg-color menu-item clearfix"> <div class="beer"> <div class="label-image-hideable beer-label pull-left"> <a class="link-font-color" href="https://untappd.com/b/goat-island-brewing-giggling-goat/4270307" target="_blank"> <img alt="Giggling Goat Juicy IPA" src="https://utfb-images.untappd.com/45srtp01grxp21igoznbc4b3dhe7?auto=compress"/> </a> </div> <div class="beer-details item-title-color"> <!-- Beer Name + Style --> <p class="beer-name"> <a class="item-title-color" href="https://untappd.com/b/goat-island-brewing-giggling-goat/4270307" target="_blank"> <span class="tap-number-hideable"> </span> Giggling Goat Juicy IPA </a> <span class="beer-style beer-style-hideable item-title-color"> IPA - American </span> </p> <!-- Beer Details --> <div class="item-meta item-title-color"> <div class="abv-hideable"> <span class="abv"> 6.3% ABV </span> </div> <div class="ibu-hideable"> <span class="ibu"> 24 IBU </span> </div> <div class="brewery-name-hideable"> <span class="brewery"> <a class="item-title-color" href="https://untappd.com/brewery/262751" target="_blank"> Goat Island Brewing </a> </span> </div> <div class="brewery-location-hideable"> <span class="location"> Cullman, AL </span> </div> <div class="rating-hideable"> <span class="rating small r375"> </span> </div> </div> <!-- Beer Description --> <div class="item-description-hideable item-description item-title-color"> <a class="link-font-color ut-more hide" href="#"> More Info ▸ </a> <p class="link-font-color show-less item-title-color"> Brewed with the women of Goat Island and the Cullman Brewers Guild, this Pink Boots Society beer uses the Pink Boots 2021 hop blend yielding a refreshing tropical taste and aroma. </p> <a class="ut-less hide link-font-color" href="#"> Less Info ▴ </a> </div> <!-- Beer Container List --> <div class="container-list item-title-color"> <div class="with-price"> <div class="conatiner-item"> <div class="container-row"> <span class="type"> Case of 12oz Cans </span> <span class="linear-guide"> </span> <span class="price"> <span class="currency-hideable"> \$ </span> 48.00 </span> </div> </div> <div class="conatiner-item"> <div class="container-row"> <span class="type"> 12oz Can 6 Pack </span> <span class="linear-guide"> </span> <span class="price"> <span class="currency-hideable"> \$ </span> 12.00 </span> </div> </div> </div> <div class="no-price"> <p> <strong> Serving Sizes: </strong> Case of 12oz Cans, 12oz Can 6 Pack </p> </div> </div> </div> </div> </div> <div class="item-bg-color menu-item clearfix"> <div class="beer"> <div class="label-image-hideable beer-label pull-left"> <a class="link-font-color" href="https://untappd.com/b/goat-island-brewing-big-bridge-ipa/1647286" target="_blank"> <img alt="MangoWeiss " src="https://beer.untappd.com/labels/1647286"/> </a> </div> <div class="beer-details item-title-color"> <!-- Beer Name + Style --> <p class="beer-name"> <a class="item-title-color" href="https://untappd.com/b/goat-island-brewing-big-bridge-ipa/1647286" target="_blank"> <span class="tap-number-hideable"> </span> MangoWeiss </a> <span class="beer-style beer-style-hideable item-title-color"> Mango Wheat Beer </span> </p> <!-- Beer Details --> <div class="item-meta item-title-color"> <div class="abv-hideable"> <span class="abv"> 4.8% ABV </span> </div> <div class="ibu-hideable"> <span class="ibu"> 13 IBU </span> </div> <div class="brewery-name-hideable"> <span class="brewery"> <a class="item-title-color" href="https://untappd.com/brewery/262751" target="_blank"> Goat Island Brewing </a> </span> </div> <div class="brewery-location-hideable"> <span class="location"> Cullman, AL </span> </div> <div class="rating-hideable"> <span class="rating small r375"> </span> </div> </div> <!-- Beer Description --> <div class="item-description-hideable item-description item-title-color"> <a class="link-font-color ut-more hide" href="#"> More Info ▸ </a> <p class="link-font-color show-less item-title-color"> Mouthwatering, tropical fruit flavored wheat beer. </p> <a class="ut-less hide link-font-color" href="#"> Less Info ▴ </a> </div> <!-- Beer Container List --> <div class="container-list item-title-color"> <div class="with-price"> <div class="conatiner-item"> <div class="container-row"> <span class="type"> 16oz </span> <span class="linear-guide"> </span> <span class="price"> <span class="currency-hideable"> \$ </span> 6.00 </span> </div> </div> </div> <div class="no-price"> <p> <strong> Serving Sizes: </strong> 16oz </p> </div> </div> </div> </div> </div> <div class="item-bg-color menu-item clearfix"> <div class="beer"> <div class="label-image-hideable beer-label pull-left"> <a class="link-font-color" href="https://untappd.com/b/goat-island-brewing-sipsey-river-red/1844205" target="_blank"> <img alt="ESB" src="https://utfb-images.untappd.com/tzkqlj5yawfi99k3qvdmufaajvqj?auto=compress"/> </a> </div> <div class="beer-details item-title-color"> <!-- Beer Name + Style --> <p class="beer-name"> <a class="item-title-color" href="https://untappd.com/b/goat-island-brewing-sipsey-river-red/1844205" target="_blank"> <span class="tap-number-hideable"> </span> ESB </a> <span class="beer-style beer-style-hideable item-title-color"> Extra Special Bitter Ale </span> </p> <!-- Beer Details --> <div class="item-meta item-title-color"> <div class="abv-hideable"> <span class="abv"> 6% ABV </span> </div> <div class="ibu-hideable"> <span class="ibu"> 34 IBU </span> </div> <div class="brewery-name-hideable"> <span class="brewery"> <a class="item-title-color" href="https://untappd.com/brewery/262751" target="_blank"> Goat Island Brewing </a> </span> </div> <div class="brewery-location-hideable"> <span class="location"> Cullman, AL </span> </div> <div class="rating-hideable"> <span class="rating small r375"> </span> </div> </div> <!-- Beer Description --> <div class="item-description-hideable item-description item-title-color"> <a class="link-font-color ut-more hide" href="#"> More Info ▸ </a> <p class="link-font-color show-less item-title-color"> Traditional copper colored ESB with a rich malt backbone and slightly spicy with English hop notes. </p> <a class="ut-less hide link-font-color" href="#"> Less Info ▴ </a> </div> <!-- Beer Container List --> <div class="container-list item-title-color"> <div class="with-price"> <div class="conatiner-item"> <div class="container-row"> <span class="type"> 16oz Draft </span> <span class="linear-guide"> </span> <span class="price"> <span class="currency-hideable"> \$ </span> 6.00 </span> </div> </div> </div> <div class="no-price"> <p> <strong> Serving Sizes: </strong> 16oz Draft </p> </div> </div> </div> </div> </div> <div class="item-bg-color menu-item clearfix"> <div class="beer"> <div class="label-image-hideable beer-label pull-left"> <a class="link-font-color" href="https://untappd.com/b/goat-island-brewing-pale-ale/1502649" target="_blank"> <img alt="<NAME>" src="https://beer.untappd.com/labels/1502649"/> </a> </div> <div class="beer-details item-title-color"> <!-- Beer Name + Style --> <p class="beer-name"> <a class="item-title-color" href="https://untappd.com/b/goat-island-brewing-pale-ale/1502649" target="_blank"> <span class="tap-number-hideable"> </span> <NAME> </a> <span class="beer-style beer-style-hideable item-title-color"> Kolsch </span> </p> <!-- Beer Details --> <div class="item-meta item-title-color"> <div class="abv-hideable"> <span class="abv"> 5% ABV </span> </div> <div class="ibu-hideable"> <span class="ibu"> 19 IBU </span> </div> <div class="brewery-name-hideable"> <span class="brewery"> <a class="item-title-color" href="https://untappd.com/brewery/262751" target="_blank"> Goat Island Brewing </a> </span> </div> <div class="brewery-location-hideable"> <span class="location"> Cullman, AL </span> </div> <div class="rating-hideable"> <span class="rating small r375"> </span> </div> </div> <!-- Beer Description --> <div class="item-description-hideable item-description item-title-color"> <a class="link-font-color ut-more hide" href="#"> More Info ▸ </a> <p class="link-font-color show-less item-title-color"> Crisp, light Lager/Ale hybrid. </p> <a class="ut-less hide link-font-color" href="#"> Less Info ▴ </a> </div> <!-- Beer Container List --> <div class="container-list item-title-color"> <div class="with-price"> <div class="conatiner-item"> <div class="container-row"> <span class="type"> 16oz Draft </span> <span class="linear-guide"> </span> <span class="price"> <span class="currency-hideable"> \$ </span> 6.00 </span> </div> </div> </div> <div class="no-price"> <p> <strong> Serving Sizes: </strong> 16oz Draft </p> </div> </div> </div> </div> </div> <div class="item-bg-color menu-item clearfix"> <div class="beer"> <div class="label-image-hideable beer-label pull-left"> <a class="link-font-color" href="https://untappd.com/b/goat-island-brewing-big-bridge-ipa/1647286" target="_blank"> <img alt="Big Bridge IPA" src="https://beer.untappd.com/labels/1647286"/> </a> </div> <div class="beer-details item-title-color"> <!-- Beer Name + Style --> <p class="beer-name"> <a class="item-title-color" href="https://untappd.com/b/goat-island-brewing-big-bridge-ipa/1647286" target="_blank"> <span class="tap-number-hideable"> </span> Big Bridge IPA </a> <span class="beer-style beer-style-hideable item-title-color"> IPA - American </span> </p> <!-- Beer Details --> <div class="item-meta item-title-color"> <div class="abv-hideable"> <span class="abv"> 6.2% ABV </span> </div> <div class="ibu-hideable"> <span class="ibu"> 50 IBU </span> </div> <div class="brewery-name-hideable"> <span class="brewery"> <a class="item-title-color" href="https://untappd.com/brewery/262751" target="_blank"> Goat Island Brewing </a> </span> </div> <div class="brewery-location-hideable"> <span class="location"> Cullman, AL </span> </div> <div class="rating-hideable"> <span class="rating small r375"> </span> </div> </div> <!-- Beer Description --> <div class="item-description-hideable item-description item-title-color"> <a class="link-font-color ut-more hide" href="#"> More Info ▸ </a> <p class="link-font-color show-less item-title-color"> The first thing you’ll notice about this beer is an intense burst of hop flavor and aroma. Although there is no fruit added to this beer you may recognize hints of citrus zest, mango and apricot. The next pleasant surprise is the absence of an overly bitter aftertaste. When you taste this beer, you’ll see why many people say it is the best IPA they have ever encountered. </p> <a class="ut-less hide link-font-color" href="#"> Less Info ▴ </a> </div> <!-- Beer Container List --> <div class="container-list item-title-color"> <div class="with-price"> <div class="conatiner-item"> <div class="container-row"> <span class="type"> 16oz Draft </span> <span class="linear-guide"> </span> <span class="price"> <span class="currency-hideable"> \$ </span> 6.00 </span> </div> </div> </div> <div class="no-price"> <p> <strong> Serving Sizes: </strong> 16oz Draft </p> </div> </div> </div> </div> </div> <div class="item-bg-color menu-item clearfix"> <div class="beer"> <div class="label-image-hideable beer-label pull-left"> <a class="link-font-color" href="https://untappd.com/b/goat-island-brewing-blood-orange-berliner-weisse/2204761" target="_blank"> <img alt="Blood Orange Berliner-Weisse" src="https://beer.untappd.com/labels/2204761"/> </a> </div> <div class="beer-details item-title-color"> <!-- Beer Name + Style --> <p class="beer-name"> <a class="item-title-color" href="https://untappd.com/b/goat-island-brewing-blood-orange-berliner-weisse/2204761" target="_blank"> <span class="tap-number-hideable"> </span> Blood Orange Berliner-Weisse </a> <span class="beer-style beer-style-hideable item-title-color"> Sour - Berliner Weisse </span> </p> <!-- Beer Details --> <div class="item-meta item-title-color"> <div class="abv-hideable"> <span class="abv"> 5.5% ABV </span> </div> <div class="ibu-hideable"> <span class="ibu"> 5 IBU </span> </div> <div class="brewery-name-hideable"> <span class="brewery"> <a class="item-title-color" href="https://untappd.com/brewery/262751" target="_blank"> Goat Island Brewing </a> </span> </div> <div class="brewery-location-hideable"> <span class="location"> Cullman, AL </span> </div> <div class="rating-hideable"> <span class="rating small r375"> </span> </div> </div> <!-- Beer Description --> <div class="item-description-hideable item-description item-title-color"> <a class="link-font-color ut-more hide" href="#"> More Info ▸ </a> <p class="link-font-color show-less item-title-color"> This gorgeous orange-to-pink beer is refreshing and drinkable. A lush sweet orange aroma hits you as you take your first drink. Then, that well crafted wheat ale backbone shines through.Go ahead and indulge yourself - you deserve it! </p> <a class="ut-less hide link-font-color" href="#"> Less Info ▴ </a> </div> <!-- Beer Container List --> <div class="container-list item-title-color"> <div class="with-price"> <div class="conatiner-item"> <div class="container-row"> <span class="type"> 16oz Draft </span> <span class="linear-guide"> </span> <span class="price"> <span class="currency-hideable"> \$ </span> 6.00 </span> </div> </div> </div> <div class="no-price"> <p> <strong> Serving Sizes: </strong> 16oz Draft </p> </div> </div> </div> </div> </div> <div class="item-bg-color menu-item clearfix"> <div class="beer"> <div class="label-image-hideable beer-label pull-left"> <a class="link-font-color" href="https://untappd.com/b/goat-island-brewing-duck-river-dunkel/2596232" target="_blank"> <img alt="Duck River Dunkel" src="https://beer.untappd.com/labels/2596232"/> </a> </div> <div class="beer-details item-title-color"> <!-- Beer Name + Style --> <p class="beer-name"> <a class="item-title-color" href="https://untappd.com/b/goat-island-brewing-duck-river-dunkel/2596232" target="_blank"> <span class="tap-number-hideable"> </span> Duck River Dunkel </a> <span class="beer-style beer-style-hideable item-title-color"> Lager - Munich Dunkel </span> </p> <!-- Beer Details --> <div class="item-meta item-title-color"> <div class="abv-hideable"> <span class="abv"> 5.5% ABV </span> </div> <div class="ibu-hideable"> <span class="ibu"> 20 IBU </span> </div> <div class="brewery-name-hideable"> <span class="brewery"> <a class="item-title-color" href="https://untappd.com/brewery/262751" target="_blank"> Goat Island Brewing </a> </span> </div> <div class="brewery-location-hideable"> <span class="location"> Cullman, AL </span> </div> <div class="rating-hideable"> <span class="rating small r375"> </span> </div> </div> <!-- Beer Description --> <div class="item-description-hideable item-description item-title-color"> <a class="link-font-color ut-more hide" href="#"> More Info ▸ </a> <p class="link-font-color show-less item-title-color"> This smooth, dark Bavarian style lager is all about the malts. It has a medium body and bready malt backbone but finishes dry. It is also our most prestigious beer. It won a silver medal at the Great American beer Festival in Denver in 2018. So you could say this is the 2nd best Dunkel in the United States. We think it’s Number 1! Delicious malty goodness, highly decorated. Taste it for yourself </p> <a class="ut-less hide link-font-color" href="#"> Less Info ▴ </a> </div> <!-- Beer Container List --> <div class="container-list item-title-color"> <div class="with-price"> <div class="conatiner-item"> <div class="container-row"> <span class="type"> 16oz Draft </span> <span class="linear-guide"> </span> <span class="price"> <span class="currency-hideable"> \$ </span> 6.00 </span> </div> </div> </div> <div class="no-price"> <p> <strong> Serving Sizes: </strong> 16oz Draft </p> </div> </div> </div> </div> </div> <div class="item-bg-color menu-item clearfix"> <div class="beer"> <div class="label-image-hideable beer-label pull-left"> <a class="link-font-color" href="https://untappd.com/b/goat-island-brewing-peace-love-and-hippieweizen/2101713" target="_blank"> <img alt="Peace, Love And Hippieweizen" src="https://beer.untappd.com/labels/2101713"/> </a> </div> <div class="beer-details item-title-color"> <!-- Beer Name + Style --> <p class="beer-name"> <a class="item-title-color" href="https://untappd.com/b/goat-island-brewing-peace-love-and-hippieweizen/2101713" target="_blank"> <span class="tap-number-hideable"> </span> Peace, Love And Hippieweizen </a> <span class="beer-style beer-style-hideable item-title-color"> Hefeweizen </span> </p> <!-- Beer Details --> <div class="item-meta item-title-color"> <div class="abv-hideable"> <span class="abv"> 4.8% ABV </span> </div> <div class="ibu-hideable"> <span class="ibu"> 13 IBU </span> </div> <div class="brewery-name-hideable"> <span class="brewery"> <a class="item-title-color" href="https://untappd.com/brewery/262751" target="_blank"> Goat Island Brewing </a> </span> </div> <div class="brewery-location-hideable"> <span class="location"> Cullman, AL </span> </div> <div class="rating-hideable"> <span class="rating small r375"> </span> </div> </div> <!-- Beer Description --> <div class="item-description-hideable item-description item-title-color"> <a class="link-font-color ut-more hide" href="#"> More Info ▸ </a> <p class="link-font-color show-less item-title-color"> One drink of this hazy, golden wheat beer and you’ll find yourself back in the sixties. The german heffeweizen yeast used to ferment this beer give it a smooth groovy flavor with hints of fresh bread and the faint aroma of banana. It is light and refreshing. The perfect beer for our hot Alabama weather. Bring on the summer of I love this beer. Far out! </p> <a class="ut-less hide link-font-color" href="#"> Less Info ▴ </a> </div> <!-- Beer Container List --> <div class="container-list item-title-color"> <div class="with-price"> <div class="conatiner-item"> <div class="container-row"> <span class="type"> 16oz Draft </span> <span class="linear-guide"> </span> <span class="price"> <span class="currency-hideable"> \$ </span> 6.00 </span> </div> </div> </div> <div class="no-price"> <p> <strong> Serving Sizes: </strong> 16oz Draft </p> </div> </div> </div> </div> </div> <div class="item-bg-color menu-item clearfix"> <div class="beer"> <div class="label-image-hideable beer-label pull-left"> <a class="link-font-color" href="https://untappd.com/b/goat-island-brewing-richter-s-pils/1831963" target="_blank"> <img alt="<NAME>" src="https://beer.untappd.com/labels/1831963"/> </a> </div> <div class="beer-details item-title-color"> <!-- Beer Name + Style --> <p class="beer-name"> <a class="item-title-color" href="https://untappd.com/b/goat-island-brewing-richter-s-pils/1831963" target="_blank"> <span class="tap-number-hideable"> </span> <NAME>ilsner </a> <span class="beer-style beer-style-hideable item-title-color"> Pilsner - German </span> </p> <!-- Beer Details --> <div class="item-meta item-title-color"> <div class="abv-hideable"> <span class="abv"> 6% ABV </span> </div> <div class="ibu-hideable"> <span class="ibu"> 30 IBU </span> </div> <div class="brewery-name-hideable"> <span class="brewery"> <a class="item-title-color" href="https://untappd.com/brewery/262751" target="_blank"> Goat Island Brewing </a> </span> </div> <div class="brewery-location-hideable"> <span class="location"> Cullman, AL </span> </div> <div class="rating-hideable"> <span class="rating small r350"> </span> </div> </div> <!-- Beer Description --> <div class="item-description-hideable item-description item-title-color"> <a class="link-font-color ut-more hide" href="#"> More Info ▸ </a> <p class="link-font-color show-less item-title-color"> This antique light golden pilsner won a bronze medal at the 2016 Alabama Craft Beer Championship. It is influenced by German and American traditions, much like the German immigrants that founded Cullman, Alabama in the late 1800’s. A local merchant found a hand written beer recipe in the attic of his old downtown building in Cullman. The recipe was found with other personal items of <NAME>, who owned Richter’s Saloon in the late 1800’s. The mixture of English and Old German was eventually translated and resurrected, and now it is our flagship beer!Availability: Year-round </p> <a class="ut-less hide link-font-color" href="#"> Less Info ▴ </a> </div> <!-- Beer Container List --> <div class="container-list item-title-color"> <div class="with-price"> <div class="conatiner-item"> <div class="container-row"> <span class="type"> 16oz Draft </span> <span class="linear-guide"> </span> <span class="price"> <span class="currency-hideable"> \$ </span> 6.00 </span> </div> </div> </div> <div class="no-price"> <p> <strong> Serving Sizes: </strong> 16oz Draft </p> </div> </div> </div> </div> </div> <div class="item-bg-color menu-item clearfix"> <div class="beer"> <div class="label-image-hideable beer-label pull-left"> <a class="link-font-color" href="https://untappd.com/b/goat-island-brewing-sipsey-river-red/1844205" target="_blank"> <img alt="Sipsey River Red" src="https://beer.untappd.com/labels/1844205"/> </a> </div> <div class="beer-details item-title-color"> <!-- Beer Name + Style --> <p class="beer-name"> <a class="item-title-color" href="https://untappd.com/b/goat-island-brewing-sipsey-river-red/1844205" target="_blank"> <span class="tap-number-hideable"> </span> Sipsey River Red </a> <span class="beer-style beer-style-hideable item-title-color"> Red Ale - American Amber / Red </span> </p> <!-- Beer Details --> <div class="item-meta item-title-color"> <div class="abv-hideable"> <span class="abv"> 5.5% ABV </span> </div> <div class="ibu-hideable"> <span class="ibu"> 32 IBU </span> </div> <div class="brewery-name-hideable"> <span class="brewery"> <a class="item-title-color" href="https://untappd.com/brewery/262751" target="_blank"> Goat Island Brewing </a> </span> </div> <div class="brewery-location-hideable"> <span class="location"> Cullman, AL </span> </div> <div class="rating-hideable"> <span class="rating small r375"> </span> </div> </div> <!-- Beer Description --> <div class="item-description-hideable item-description item-title-color"> <a class="link-font-color ut-more hide" href="#"> More Info ▸ </a> <p class="link-font-color show-less item-title-color"> This beer won a gold medal in the 2016 Alabama Craft Beer Championship! An amber to red ale balanced perfectly with malt and European hops. Smooth, flavorful and colorful. The first thing you'll notice about this beer is the fragrance. It will remind you of walking through the nearby Sipsey River Wilderness area in the spring. </p> <a class="ut-less hide link-font-color" href="#"> Less Info ▴ </a> </div> <!-- Beer Container List --> <div class="container-list item-title-color"> <div class="with-price"> <div class="conatiner-item"> <div class="container-row"> <span class="type"> 16oz Draft </span> <span class="linear-guide"> </span> <span class="price"> <span class="currency-hideable"> \$ </span> 6.00 </span> </div> </div> </div> <div class="no-price"> <p> <strong> Serving Sizes: </strong> 16oz Draft </p> </div> </div> </div> </div> </div> <div class="item-bg-color menu-item clearfix"> <div class="beer"> <div class="label-image-hideable beer-label pull-left"> <a class="link-font-color" href="https://untappd.com/b/goat-island-brewing-thrill-hill-vanilla-porter/1869507" target="_blank"> <img alt="Thrill Hill Vanilla Porter" src="https://beer.untappd.com/labels/1869507"/> </a> </div> <div class="beer-details item-title-color"> <!-- Beer Name + Style --> <p class="beer-name"> <a class="item-title-color" href="https://untappd.com/b/goat-island-brewing-thrill-hill-vanilla-porter/1869507" target="_blank"> <span class="tap-number-hideable"> </span> Thrill Hill Vanilla Porter </a> <span class="beer-style beer-style-hideable item-title-color"> Porter - Other </span> </p> <!-- Beer Details --> <div class="item-meta item-title-color"> <div class="abv-hideable"> <span class="abv"> 7.1% ABV </span> </div> <div class="ibu-hideable"> <span class="ibu"> 23 IBU </span> </div> <div class="brewery-name-hideable"> <span class="brewery"> <a class="item-title-color" href="https://untappd.com/brewery/262751" target="_blank"> Goat Island Brewing </a> </span> </div> <div class="brewery-location-hideable"> <span class="location"> Cullman, AL </span> </div> <div class="rating-hideable"> <span class="rating small r400"> </span> </div> </div> <!-- Beer Description --> <div class="item-description-hideable item-description item-title-color"> <a class="link-font-color ut-more hide" href="#"> More Info ▸ </a> <p class="link-font-color show-less item-title-color"> A dark brown imperial porter with hints of caramel, chocolate and coffee balanced with smooth vanilla and bourbon flavor. It is surprisingly drinkable for such a complex high ABV beer. Flavored with real Madagascar vanilla beans. </p> <a class="ut-less hide link-font-color" href="#"> Less Info ▴ </a> </div> <!-- Beer Container List --> <div class="container-list item-title-color"> <div class="with-price"> <div class="conatiner-item"> <div class="container-row"> <span class="type"> 10oz Draft </span> <span class="linear-guide"> </span> <span class="price"> <span class="currency-hideable"> \$ </span> 6.00 </span> </div> </div> </div> <div class="no-price"> <p> <strong> Serving Sizes: </strong> 10oz Draft </p> </div> </div> </div> </div> </div> </div> <div class="pagination-container"> Displaying <b> all 12 </b> items </div> </div> </div> <div class="section item-bg-color"> <div class="section-header-bg-color section-title-color section-heading padding-left padding-right"> <div class="section-name"> </div> </div> <div class="section-items-container"> <div class="item-bg-color menu-items-container padding-left padding-right"> </div> <div class="pagination-container"> No items found </div> </div> </div> <div class="footer-bg-color divider-color footer-font-color footer-hideable menu-footer text-center"> <p> </p> <p class="powered-ut"> Menu powered by <a class="link-font-color" href="https://untappd.com" target="_blank"> Untappd </a> </p> </div> </div> <div class="tab-content" data-tab-id="menu-100171" id="menu-100171"> <div class="menu-info divider-color"> <h1 class="h1 menu-title"> Puget South </h1> <p> North West IPA </p> <div class="date-time"> <span> Updated on </span> <time> Aug 1, 12:42 PM CDT </time> </div> </div> <div class="section item-bg-color"> <div class="section-header-bg-color section-title-color section-heading padding-left padding-right"> <div class="section-name"> </div> </div> <div class="section-items-container"> <div class="item-bg-color menu-items-container padding-left padding-right"> </div> <div class="pagination-container"> No items found </div> </div> </div> <div class="section item-bg-color"> <div class="section-header-bg-color section-title-color section-heading padding-left padding-right"> <div class="section-name"> On Deck </div> </div> <div class="section-items-container"> <div class="item-bg-color menu-items-container padding-left padding-right"> </div> <div class="pagination-container"> No items found </div> </div> </div> <div class="footer-bg-color divider-color footer-font-color footer-hideable menu-footer text-center"> <p> </p> <p class="powered-ut"> Menu powered by <a class="link-font-color" href="https://untappd.com" target="_blank"> Untappd </a> </p> </div> </div> <div class="tab-content events-tab" data-tab-id="events"> <div class="menu-info divider-color"> <div class="h1"> Events </div> </div> <table class="events-table item-title-color"> <tr data-start-time-date="2021.07.29" id="event-row-540367"> <td> <div class="date-month"> <span class="date"> 29 </span> <br/> <span class="month"> Jul </span> </div> </td> <td> <span class="name"> <a href="https://untappd.com/venue/4373693/event/540367" target="_blank"> Karaoke with <NAME> </a> </span> <br/> <span class="time"> 7:00 PM CDT </span> </td> <td class="description"> </td> <td class="location"> 1646 <NAME> Dr SE <br/> Cullman, AL </td> </tr> <tr data-start-time-date="2021.07.30" id="event-row-545501"> <td> <div class="date-month"> <span class="date"> 30 </span> <br/> <span class="month"> Jul </span> </div> </td> <td> <span class="name"> <a href="https://untappd.com/venue/4373693/event/545501" target="_blank"> Live Music: 347 Band </a> </span> <br/> <span class="time"> 7:00 PM CDT </span> </td> <td class="description"> </td> <td class="location"> 1646 John H Cooper Dr SE <br/> Cullman, AL </td> </tr> <tr data-start-time-date="2021.07.31" id="event-row-545503"> <td> <div class="date-month"> <span class="date"> 31 </span> <br/> <span class="month"> Jul </span> </div> </td> <td> <span class="name"> <a href="https://untappd.com/venue/4373693/event/545503" target="_blank"> <NAME> with Mom &amp; M's Food Truck </a> </span> <br/> <span class="time"> 7:00 PM CDT </span> </td> <td class="description"> </td> <td class="location"> 1646 John H Cooper Dr SE <br/> Cullman, AL </td> </tr> <tr data-start-time-date="2021.08.06" id="event-row-548372"> <td> <div class="date-month"> <span class="date"> 6 </span> <br/> <span class="month"> Aug </span> </div> </td> <td> <span class="name"> <a href="https://untappd.com/venue/4373693/event/548372" target="_blank"> Live Music: Monkey Business </a> </span> <br/> <span class="time"> 7:00 PM CDT </span> </td> <td class="description"> </td> <td class="location"> 1646 John H Cooper Dr SE <br/> Cullman, AL </td> </tr> <tr data-start-time-date="2021.08.07" id="event-row-548373"> <td> <div class="date-month"> <span class="date"> 7 </span> <br/> <span class="month"> Aug </span> </div> </td> <td> <span class="name"> <a href="https://untappd.com/venue/4373693/event/548373" target="_blank"> Live Music: Overtones </a> </span> <br/> <span class="time"> 7:00 PM CDT </span> </td> <td class="description"> </td> <td class="location"> 1646 John H Cooper Dr SE <br/> Cullman, AL </td> </tr> <tr data-start-time-date="2021.08.13" id="event-row-548374"> <td> <div class="date-month"> <span class="date"> 13 </span> <br/> <span class="month"> Aug </span> </div> </td> <td> <span class="name"> <a href="https://untappd.com/venue/4373693/event/548374" target="_blank"> Live Music: Trifecta </a> </span> <br/> <span class="time"> 7:00 PM CDT </span> </td> <td class="description"> </td> <td class="location"> 1646 John H Cooper Dr SE <br/> Cullman, AL </td> </tr> <tr data-start-time-date="2021.08.14" id="event-row-548375"> <td> <div class="date-month"> <span class="date"> 14 </span> <br/> <span class="month"> Aug </span> </div> </td> <td> <span class="name"> <a href="https://untappd.com/venue/4373693/event/548375" target="_blank"> Live Music: Round 2 </a> </span> <br/> <span class="time"> 7:00 PM CDT </span> </td> <td class="description"> </td> <td class="location"> 1646 <NAME> Dr SE <br/> Cullman, AL </td> </tr> <tr data-start-time-date="2021.08.20" id="event-row-548376"> <td> <div class="date-month"> <span class="date"> 20 </span> <br/> <span class="month"> Aug </span> </div> </td> <td> <span class="name"> <a href="https://untappd.com/venue/4373693/event/548376" target="_blank"> Live Music: Avenue G with Dog eat Dawgs Food Truck </a> </span> <br/> <span class="time"> 7:00 PM CDT </span> </td> <td class="description"> </td> <td class="location"> 1646 <NAME> Dr SE <br/> Cullman, AL </td> </tr> <tr data-start-time-date="2021.08.21" id="event-row-548377"> <td> <div class="date-month"> <span class="date"> 21 </span> <br/> <span class="month"> Aug </span> </div> </td> <td> <span class="name"> <a href="https://untappd.com/venue/4373693/event/548377" target="_blank"> Goat Island Luau Party with Matt Prater Band </a> </span> <br/> <span class="time"> 7:00 PM CDT </span> </td> <td class="description"> </td> <td class="location"> 1646 John H Cooper Dr SE <br/> Cullman, AL </td> </tr> <tr data-start-time-date="2021.08.27" id="event-row-548378"> <td> <div class="date-month"> <span class="date"> 27 </span> <br/> <span class="month"> Aug </span> </div> </td> <td> <span class="name"> <a href="https://untappd.com/venue/4373693/event/548378" target="_blank"> Live Music: Natchez Trace </a> </span> <br/> <span class="time"> 7:00 PM CDT </span> </td> <td class="description"> </td> <td class="location"> 1646 John H Cooper Dr SE <br/> Cullman, AL </td> </tr> <tr data-start-time-date="2021.08.28" id="event-row-548379"> <td> <div class="date-month"> <span class="date"> 28 </span> <br/> <span class="month"> Aug </span> </div> </td> <td> <span class="name"> <a href="https://untappd.com/venue/4373693/event/548379" target="_blank"> Trivia night with <NAME> </a> </span> <br/> <span class="time"> 7:00 PM CDT </span> </td> <td class="description"> </td> <td class="location"> 1646 <NAME> Dr SE <br/> Cullman, AL </td> </tr> </table> </div> </div> </div> </div> " </body> </html> <|start_filename|>theme/templates/theme/base.html<|end_filename|> {% load static %} <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta http-equiv="X-UA-Compatible" content="ie=edge" /> <title>{% block title %}{% if alabama_dot_beer %}alabama.beer{% else %}hsv.beer{% endif %}{% endblock %}</title> <meta name="description" content="" /> <meta name="keywords" content="" /> <meta name="author" content="" /> <link rel="stylesheet" href="{% static 'theme/css/style.css' %}" /> </head> <body class="bg-grey-lightest font-serif leading-normal tracking-normal"> <nav class="flex items-center justify-between flex-wrap bg-yellow-400 p-6"> <div class="flex items-center flex-shrink-0 text-black mr-6"> <span class="font-semibold text-xl tracking-tight"> Return to {% if alabama_dot_beer %} <a href="/">alabama.beer</a> {% else %} <a href="https://hsv.beer/">hsv.beer</a> {% endif %} </span> </div> <div class="w-full block flex-grow lg:flex lg:items-center lg:w-auto"> <div class="text-sm lg:flex-grow"> <a href="/" class="block mt-4 lg:inline-block lg:mt-0 text-black hover:text-gray-200 mr-4" > Home </a> <a href="{% url 'api-root' %}" class="block mt-4 lg:inline-block lg:mt-0 text-black hover:text-gray-200 mr-4" > API Browser </a> {% if user.is_staff %} <a href="{% url 'admin:index' %}" class="block mt-4 lg:inline-block lg:mt-0 text-black hover:text-gray-200 mr-4" > Admin </a> {% endif %} </div> <div> <a href="{% if user.is_anonymous %}{% url 'login' %}{% else %}{% url 'logout' %}{% endif %}" class="inline-block text-sm px-4 py-2 leading-none border rounded text-black border-gray-600 hover:border-transparent hover:text-black hover:bg-white mt-4 lg:mt-0" >{% if user.is_anonymous %}Log in{% else %}Log out{% endif %}</a > </div> </div> </nav> <div class="container mx-auto"> {% block messages %} {% if messages %} <ul class="list-none"> {% for message in messages %} <li{% if message.tags %} class="{% if 'success' in message.tags %}bg-green-400 text-white font-medium py-2 px-4 rounded{% else %}{{ message.tags }}{% endif %}"{% endif %}>{{ message }}</li> {% endfor %} </ul> {% endif %} {% endblock %} {% block content %} <section class="flex items-center justify-center h-screen"> <h1 class="text-5xl">Django + Tailwind = ❤️</h1> </section> {% endblock %} </div> </body> </html> <|start_filename|>beers/templates/beers/style_form.html<|end_filename|> {% extends "theme/base.html" %} {% load tailwind_filters %} {% block title %}{{ block.super }}: {% if style %}Edit {{ style }}{% else %}Create a style {% endif %}{% endblock %} {% block content %} <h1 class="text-2xl">{% if style %}Edit{% else %}Create{% endif %} a style</h1> <form action="{% if style %}{% url 'edit_style' style.id %}{% else %}{% url 'create_style' %}{% endif %}" method="post"> {% csrf_token %} <table>{{ form | crispy }}</table> <input class="bg-blue-500 text-white font-bold py-2 px-4 rounded" type="submit" value="Save"> </form> {% endblock %} <|start_filename|>tailwind.config.js<|end_filename|> module.exports = { darkMode: false, // or 'media' or 'class' future: { removeDeprecatedGapUtilities: true, purgeLayersByDefault: true, }, purge: { enabled: true, // set to false for dev content: [ '**/templates/*.html', '**/templates/**/*.html' ] }, theme: { extend: {}, }, variants: {}, plugins: [], } <|start_filename|>venues/templates/venues/venue-list.html<|end_filename|> {% extends "theme/base.html" %} {% block title %}{{ block.super }}: Select a taproom{% endblock %} {% block content %} <h1 class="text-3xl">Pick a taproom</h1> <div class="flex grid gap-4 grid-cols-1 md:grid-cols-2"> <div class="h-12 flex items-center justify-items-start text-2xl">Name</div> <div class="h-12 flex items-center justify-items-start text-2xl">Last updated</div> {% for venue in venues %} <div class="h-12 flex items-center justify-items-start"> <a href="{% url 'venue_table' venue.id %}" class="text-blue-600">{{ venue.name }}</a> </div> <div class="h-12 flex items-center justify-items-start"> {% if venue.tap_list_last_update_time %}<span title="{{ venue.tap_list_last_update_time }} UTC">{{ venue.tap_list_last_update_time | timesince }} ago</span>{% else %}{% endif %} </div> {% endfor %} </div> {% endblock %}
hsv-dot-beer/hsvdotbeer
<|start_filename|>profile.go<|end_filename|> package main import ( "database/sql" "errors" "fmt" "os" "os/user" "path/filepath" "github.com/laurent22/go-sqlkv" _ "github.com/mattn/go-sqlite3" ) const PROFILE_PERM = 0700 var homeDir_ string var profileFolder_ string var config_ *sqlkv.SqlKv var profileDb_ *sql.DB func profileOpen() error { if profileDb_ != nil { return nil } var err error profileDb_, err = sql.Open("sqlite3", profileFile()) if err != nil { return errors.New(fmt.Sprintf("Profile file could not be opened: %s: %s", err, profileFile())) } _, err = profileDb_.Exec("CREATE TABLE IF NOT EXISTS history (id INTEGER NOT NULL PRIMARY KEY, source TEXT, destination TEXT, timestamp INTEGER)") if err != nil { return errors.New(fmt.Sprintf("History table could not be created: %s", err)) } profileDb_.Exec("CREATE INDEX id_index ON history (id)") profileDb_.Exec("CREATE INDEX destination_index ON history (destination)") profileDb_.Exec("CREATE INDEX timestamp_index ON history (timestamp)") config_ = sqlkv.New(profileDb_, "config") return nil } func profileClose() { config_ = nil if profileDb_ != nil { profileDb_.Close() profileDb_ = nil } profileFolder_ = "" } // Used only for debugging func profileDelete() { profileFolder := profileFolder_ // profileFolder_ is going to be cleared in profileClose() profileClose() os.RemoveAll(profileFolder) } func profileFolder() string { if profileFolder_ != "" { return profileFolder_ } if homeDir_ == "" { // By default, use $HOME as it seems to be different from HomeDir in some // systems. In particular it's necessary to pass Homebrew's tests. homeDir_ = os.Getenv("HOME") if homeDir_ == "" { u, err := user.Current() if err != nil { panic(err) } homeDir_ = u.HomeDir } } output := filepath.Join(homeDir_, ".config", APPNAME) err := os.MkdirAll(output, PROFILE_PERM) if err != nil { panic(err) } profileFolder_ = output return profileFolder_ } func profileFile() string { return filepath.Join(profileFolder(), "profile.sqlite") } func handleConfigCommand(opts *CommandLineOptions, args []string) error { if len(args) == 0 { kvs := config_.All() for _, kv := range kvs { fmt.Printf("%s = \"%s\"\n", kv.Name, kv.Value) } return nil } name := args[0] if len(args) == 1 { config_.Del(name) logInfo("Config has been changed: deleted key \"%s\"", name) return nil } value := args[1] config_.SetString(name, value) logInfo("Config has been changed: %s = \"%s\"", name, value) return nil } <|start_filename|>log.go<|end_filename|> package main import ( "fmt" ) var minLogLevel_ int func log(level int, s string, a ...interface{}) { if level < minLogLevel_ { return } fmt.Printf(APPNAME+": "+s+"\n", a...) } func logDebug(s string, a ...interface{}) { log(0, s, a...) } func logInfo(s string, a ...interface{}) { log(1, s, a...) } func logError(s string, a ...interface{}) { log(3, s, a...) } <|start_filename|>undo_test.go<|end_filename|> package main import ( "os" "path/filepath" "testing" ) func Test_handleUndoCommand_noArgs(t *testing.T) { setup(t) defer teardown(t) var opts CommandLineOptions err := handleUndoCommand(&opts, []string{}) if err != nil { t.Fail() } } func Test_handleUndoCommand_notInHistory(t *testing.T) { setup(t) defer teardown(t) var opts CommandLineOptions err := handleUndoCommand(&opts, []string{"one", "two"}) if err != nil { t.Fail() } } func Test_handleUndoCommand(t *testing.T) { setup(t) defer teardown(t) touch(filepath.Join(tempFolder(), "one")) touch(filepath.Join(tempFolder(), "two")) touch(filepath.Join(tempFolder(), "three")) var fileActions []*FileAction var fileAction *FileAction fileAction = NewFileAction() fileAction.oldPath = filepath.Join(tempFolder(), "one") fileAction.newPath = "123" fileActions = append(fileActions, fileAction) fileAction = NewFileAction() fileAction.oldPath = filepath.Join(tempFolder(), "two") fileAction.newPath = "456" fileActions = append(fileActions, fileAction) processFileActions(fileActions, false) var opts CommandLineOptions err := handleUndoCommand(&opts, []string{ filepath.Join(tempFolder(), "123"), filepath.Join(tempFolder(), "456"), }) if err != nil { t.Errorf("Expected no error, got: %s", err) } if !fileExists(filepath.Join(tempFolder(), "one")) || !fileExists(filepath.Join(tempFolder(), "two")) { t.Error("Undo operation did not restore filenames") } historyItems, _ := allHistoryItems() if len(historyItems) > 0 { t.Error("Undo operation did not delete restored history.") } fileActions = []*FileAction{} fileAction = NewFileAction() fileAction.oldPath = filepath.Join(tempFolder(), "one") fileAction.newPath = "123" fileActions = append(fileActions, fileAction) fileAction = NewFileAction() fileAction.oldPath = filepath.Join(tempFolder(), "two") fileAction.newPath = "456" fileActions = append(fileActions, fileAction) processFileActions(fileActions, false) opts = CommandLineOptions{ DryRun: true, } err = handleUndoCommand(&opts, []string{ filepath.Join(tempFolder(), "123"), filepath.Join(tempFolder(), "456"), }) if !fileExists(filepath.Join(tempFolder(), "123")) || !fileExists(filepath.Join(tempFolder(), "456")) { t.Error("Undo operation in dry run mode restored filenames.") } } func Test_handleUndoCommand_fileHasBeenDeleted(t *testing.T) { setup(t) defer teardown(t) var err error touch(filepath.Join(tempFolder(), "one")) touch(filepath.Join(tempFolder(), "two")) touch(filepath.Join(tempFolder(), "three")) var fileActions []*FileAction var fileAction *FileAction fileAction = NewFileAction() fileAction.oldPath = filepath.Join(tempFolder(), "one") fileAction.newPath = "123" fileActions = append(fileActions, fileAction) fileAction = NewFileAction() fileAction.oldPath = filepath.Join(tempFolder(), "two") fileAction.newPath = "456" fileActions = append(fileActions, fileAction) processFileActions(fileActions, false) os.Remove(filepath.Join(tempFolder(), "123")) var opts CommandLineOptions err = handleUndoCommand(&opts, []string{ filepath.Join(tempFolder(), "123"), }) if err == nil { t.Fail() } } func Test_handleUndoCommand_withIntermediateRename(t *testing.T) { setup(t) defer teardown(t) p0 := filepath.Join(tempFolder(), "0") p1 := filepath.Join(tempFolder(), "1") filePutContent(p0, "0") filePutContent(p1, "1") fileActions := []*FileAction{} fileAction := NewFileAction() fileAction.oldPath = p0 fileAction.newPath = "1" fileActions = append(fileActions, fileAction) fileAction = NewFileAction() fileAction.oldPath = p1 fileAction.newPath = "0" fileActions = append(fileActions, fileAction) processFileActions(fileActions, false) var opts CommandLineOptions err := handleUndoCommand(&opts, []string{ p0, p1, }) if err != nil { t.Fail() } if fileGetContent(p0) != "0" { t.Error("File 0 was not restored") } if fileGetContent(p1) != "1" { t.Error("File 1 was not restored") } } <|start_filename|>version.go<|end_filename|> package main import "fmt" const VERSION = "1.5.3" func handleVersionCommand(opts *CommandLineOptions, args []string) error { fmt.Println(VERSION) return nil } <|start_filename|>deploy/win-386.bat<|end_filename|> go build rm -f massren.win-386.zip /c/7-Zip/7z.exe a -tzip -mx=9 massren.win-386.zip massren.exe mkdir -p deploy/releases mv massren.win-386.zip deploy/releases <|start_filename|>vendor/github.com/laurent22/go-trash/recycle.h<|end_filename|> // +build windows int RecycleFiles (char** filenames, int nFiles, int bConfirmed); char** makeCharArray(int size); void setArrayString(char **a, char *s, int n); void freeCharArray(char **a, int size); <|start_filename|>profile_test.go<|end_filename|> package main import ( "os" "path/filepath" "testing" ) func Test_profileOpenClose(t *testing.T) { if profileDb_ != nil { t.Error("profileDb_ should be nil") } pwd, _ := os.Getwd() homeDir_ = filepath.Join(pwd, "homedirtest") err := profileOpen() if err != nil { t.Errorf("Expected no error, got %s", err) } if profileDb_ == nil { t.Error("profileDb_ should be set") } profileClose() if profileDb_ != nil { t.Error("profileDb_ should be nil") } profileDelete() } func Test_profileFolder(t *testing.T) { setup(t) defer teardown(t) profileFolder := profileFolder() stat, err := os.Stat(profileFolder) if err != nil { t.Error(err) } if !stat.IsDir() { t.Errorf("config folder is not a directory: %s", profileFolder) } } func Test_handleConfigCommand_noArgs(t *testing.T) { setup(t) defer teardown(t) var opts CommandLineOptions var err error err = handleConfigCommand(&opts, []string{}) if err != nil { t.Error("Expected no error") } err = handleConfigCommand(&opts, []string{"testing", "123"}) if err != nil { t.Errorf("Expected no error, got %s", err) } if config_.String("testing") != "123" { t.Error("Value not set correctly") } handleConfigCommand(&opts, []string{"testing", "abcd"}) if config_.String("testing") != "abcd" { t.Error("Value has not been changed") } err = handleConfigCommand(&opts, []string{"testing"}) if err != nil { t.Errorf("Expected no error, got %s", err) } if config_.HasKey("testing") { t.Error("Key has not been deleted") } } <|start_filename|>vendor/github.com/laurent22/go-trash/trash_windows.go<|end_filename|> // +build windows package trash /* #include "recycle.h" */ import "C" import ( "errors" ) // Tells whether it is possible to move a file to the trash func IsAvailable() bool { return true } // Move the given file to the trash // filePath must be an absolute path func MoveToTrash(filePath string) (string, error) { files := []string{filePath} C_files := C.makeCharArray(C.int(len(files))) defer C.freeCharArray(C_files, C.int(len(files))) for i, s := range files { C.setArrayString(C_files, C.CString(s), C.int(i)) } success := C.RecycleFiles(C_files, C.int(len(files)), C.int(0)) if success != 1 { return "", errors.New("file could not be recycled") } return "", nil } <|start_filename|>version_test.go<|end_filename|> package main import ( "testing" ) func Test_handleVersionCommand(t *testing.T) { var opts CommandLineOptions err := handleVersionCommand(&opts, []string{}) if err != nil { t.Fail() } } <|start_filename|>history.go<|end_filename|> package main import ( "path/filepath" "time" ) type HistoryItem struct { Source string Dest string Timestamp int64 Id string IntermediatePath string } func normalizePath(p string) string { if p == "" { return "" } output, err := filepath.Abs(filepath.Clean(p)) if err != nil { panic(err) } return output } func clearHistory() error { _, err := profileDb_.Exec("DELETE FROM history") return err } func allHistoryItems() ([]HistoryItem, error) { var output []HistoryItem rows, err := profileDb_.Query("SELECT id, source, destination, timestamp FROM history ORDER BY id") if err != nil { return output, err } for rows.Next() { var item HistoryItem rows.Scan(&item.Id, &item.Source, &item.Dest, &item.Timestamp) output = append(output, item) } return output, nil } func saveHistoryItems(fileActions []*FileAction) error { if len(fileActions) == 0 { return nil } tx, err := profileDb_.Begin() if err != nil { return err } for _, action := range fileActions { if action.kind == KIND_DELETE { // Current, undo is not supported continue } tx.Exec("INSERT INTO history (source, destination, timestamp) VALUES (?, ?, ?)", action.FullOldPath(), action.FullNewPath(), time.Now().Unix()) } return tx.Commit() } func deleteHistoryItems(items []HistoryItem) error { if len(items) == 0 { return nil } sqlOr := "" for _, item := range items { if sqlOr != "" { sqlOr += " OR " } sqlOr += "id = " + item.Id } _, err := profileDb_.Exec("DELETE FROM history WHERE " + sqlOr) return err } func deleteOldHistoryItems(minTimestamp int64) { if profileDb_ != nil { profileDb_.Exec("DELETE FROM history WHERE timestamp < ?", minTimestamp) } } func latestHistoryItemsByDestinations(paths []string) ([]HistoryItem, error) { var output []HistoryItem if len(paths) == 0 { return output, nil } sqlOr := "" var sqlArgs []interface{} for _, p := range paths { sqlArgs = append(sqlArgs, p) if sqlOr != "" { sqlOr += " OR " } sqlOr += "destination = ?" } rows, err := profileDb_.Query("SELECT id, source, destination, timestamp FROM history WHERE "+sqlOr+" ORDER BY timestamp DESC", sqlArgs...) if err != nil { return output, err } doneDestinations := make(map[string]bool) for rows.Next() { var item HistoryItem rows.Scan(&item.Id, &item.Source, &item.Dest, &item.Timestamp) _, done := doneDestinations[item.Dest] if done { continue } output = append(output, item) doneDestinations[item.Dest] = true } return output, nil } <|start_filename|>vendor/github.com/laurent22/go-sqlkv/sqlkv.go<|end_filename|> package sqlkv import ( "database/sql" "strconv" "strings" "time" ) const ( PLACEHOLDER_QUESTION_MARK = 1 PLACEHOLDER_DOLLAR = 2 ) type SqlKv struct { db *sql.DB tableName string driverName string placeholderType int } type SqlKvRow struct { Name string Value string } func New(db *sql.DB, tableName string) *SqlKv { output := new(SqlKv) output.db = db output.tableName = tableName output.placeholderType = PLACEHOLDER_QUESTION_MARK err := output.createTable() if err != nil { panic(err) } return output } func (this *SqlKv) SetDriverName(n string) { this.driverName = n if this.driverName == "postgres" { this.placeholderType = PLACEHOLDER_DOLLAR } else { this.placeholderType = PLACEHOLDER_QUESTION_MARK } } func (this *SqlKv) createTable() error { _, err := this.db.Exec("CREATE TABLE IF NOT EXISTS " + this.tableName + " (name TEXT NOT NULL PRIMARY KEY, value TEXT)") if err != nil { return err } // Ignore error here since there will be one if the index already exists this.db.Exec("CREATE INDEX name_index ON " + this.tableName + " (name)") return nil } func (this *SqlKv) placeholder(index int) string { if this.placeholderType == PLACEHOLDER_QUESTION_MARK { return "?" } else { return "$" + strconv.Itoa(index) } } func (this *SqlKv) rowByName(name string) (*SqlKvRow, error) { row := new(SqlKvRow) query := "SELECT name, value FROM " + this.tableName + " WHERE name = " + this.placeholder(1) err := this.db.QueryRow(query, name).Scan(&row.Name, &row.Value) if err != nil { if err == sql.ErrNoRows { return nil, nil } else { return nil, err } } return row, nil } func (this *SqlKv) All() []SqlKvRow { rows, err := this.db.Query("SELECT name, `value` FROM " + this.tableName) if err != nil { if err == sql.ErrNoRows { return []SqlKvRow{} } else { panic(err) } } var output []SqlKvRow for rows.Next() { var kvRow SqlKvRow rows.Scan(&kvRow.Name, &kvRow.Value) output = append(output, kvRow) } return output } func (this *SqlKv) String(name string) string { row, err := this.rowByName(name) if err == nil && row == nil { return "" } if err != nil { panic(err) } return row.Value } func (this *SqlKv) StringD(name string, defaultValue string) string { if !this.HasKey(name) { return defaultValue } return this.String(name) } func (this *SqlKv) SetString(name string, value string) { row, err := this.rowByName(name) var query string if row == nil && err == nil { query = "INSERT INTO " + this.tableName + " (value, name) VALUES(" + this.placeholder(1) + ", " + this.placeholder(2) + ")" } else { query = "UPDATE " + this.tableName + " SET value = " + this.placeholder(1) + " WHERE name = " + this.placeholder(2) } _, err = this.db.Exec(query, value, name) if err != nil { panic(err) } } func (this *SqlKv) Int(name string) int { s := this.String(name) if s == "" { return 0 } i, err := strconv.Atoi(s) if err != nil { panic(err) } return i } func (this *SqlKv) IntD(name string, defaultValue int) int { if !this.HasKey(name) { return defaultValue } return this.Int(name) } func (this *SqlKv) SetInt(name string, value int) { s := strconv.Itoa(value) this.SetString(name, s) } func (this *SqlKv) Float(name string) float32 { s := this.String(name) if s == "" { return 0 } o, err := strconv.ParseFloat(s, 32) if err != nil { panic(err) } return float32(o) } func (this *SqlKv) FloatD(name string, defaultValue float32) float32 { if !this.HasKey(name) { return defaultValue } return this.Float(name) } func (this *SqlKv) SetFloat(name string, value float32) { s := strconv.FormatFloat(float64(value), 'g', -1, 32) this.SetString(name, s) } func (this *SqlKv) Bool(name string) bool { s := this.String(name) return s == "1" || strings.ToLower(s) == "true" } func (this *SqlKv) BoolD(name string, defaultValue bool) bool { if !this.HasKey(name) { return defaultValue } return this.Bool(name) } func (this *SqlKv) SetBool(name string, value bool) { var s string if value { s = "1" } else { s = "0" } this.SetString(name, s) } func (this *SqlKv) Time(name string) time.Time { s := this.String(name) if s == "" { return time.Time{} } t, err := time.Parse(time.RFC3339Nano, s) if err != nil { panic(err) } return t } func (this *SqlKv) TimeD(name string, defaultValue time.Time) time.Time { if !this.HasKey(name) { return defaultValue } return this.Time(name) } func (this *SqlKv) SetTime(name string, value time.Time) { this.SetString(name, value.Format(time.RFC3339Nano)) } func (this *SqlKv) Del(name string) { query := "DELETE FROM " + this.tableName + " WHERE name = " + this.placeholder(1) _, err := this.db.Exec(query, name) if err != nil { panic(err) } } func (this *SqlKv) Clear() { query := "DELETE FROM " + this.tableName _, err := this.db.Exec(query) if err != nil { panic(err) } } func (this *SqlKv) HasKey(name string) bool { row, err := this.rowByName(name) if row == nil && err == nil { return false } if err != nil { panic(err) } return true } <|start_filename|>main_test.go<|end_filename|> package main import ( "errors" "fmt" "io/ioutil" "os" "path/filepath" "strings" "testing" "time" ) func setup(t *testing.T) { minLogLevel_ = 10 pwd, err := os.Getwd() if err != nil { t.Fatal(err) } homeDir_ = filepath.Join(pwd, "homedirtest") err = os.MkdirAll(homeDir_, 0700) if err != nil { t.Fatal(err) } deleteTempFiles() profileOpen() clearHistory() } func teardown(t *testing.T) { profileDelete() } func touch(filePath string) { ioutil.WriteFile(filePath, []byte("testing"), 0700) } func fileExists(filePath string) bool { _, err := os.Stat(filePath) return err == nil } func createRandomTempFiles() []string { var output []string for i := 0; i < 10; i++ { filePath := filepath.Join(tempFolder(), fmt.Sprintf("testfile%d", i)) ioutil.WriteFile(filePath, []byte("testing"), 0700) output = append(output, filePath) } return output } func fileGetContent(path string) string { o, err := ioutil.ReadFile(path) if err != nil { return "" } return string(o) } func filePutContent(path string, content string) { err := ioutil.WriteFile(path, []byte(content), 0700) if err != nil { panic(err) } } func Test_fileActions(t *testing.T) { var err error type TestCase struct { paths []string content string result []*FileAction } var testCases []TestCase testCases = append(testCases, TestCase{ paths: []string{ "abcd", "efgh", "ijkl", }, content: ` // some header // some header // some header abcd newname // should skip this ijkl // ignore `, result: []*FileAction{ &FileAction{ kind: KIND_RENAME, oldPath: "efgh", newPath: "newname", }, }, }) testCases = append(testCases, TestCase{ paths: []string{ "abcd", "efgh", "ijkl", }, content: ` // some header // some header // some header //abcd efgh ijklmnop `, result: []*FileAction{ &FileAction{ kind: KIND_DELETE, oldPath: "abcd", newPath: "", }, &FileAction{ kind: KIND_RENAME, oldPath: "ijkl", newPath: "ijklmnop", }, }, }) testCases = append(testCases, TestCase{ paths: []string{ "abcd", "efgh", "ijkl", }, content: ` // some header // some header abcd efgh ijkl `, result: []*FileAction{}, }) testCases = append(testCases, TestCase{ paths: []string{ " abcd", "\t efgh\t\t ", }, content: ` abcd efgh `, result: []*FileAction{}, }) testCases = append(testCases, TestCase{ paths: []string{ "abcd", " efgh", " ijkl\t ", }, content: ` // abcd //efgh // ijkl `, result: []*FileAction{ &FileAction{ kind: KIND_DELETE, oldPath: "abcd", newPath: "", }, &FileAction{ kind: KIND_DELETE, oldPath: " efgh", newPath: "", }, &FileAction{ kind: KIND_DELETE, oldPath: " ijkl\t ", newPath: "", }, }, }) testCases = append(testCases, TestCase{ paths: []string{ " abcd", "\t efgh\t\t ", }, content: ` abcd efgh `, result: []*FileAction{}, }) testCases = append(testCases, TestCase{ paths: []string{ "123", "456", }, content: ` 1/23 4/56 `, result: []*FileAction{ &FileAction{ kind: KIND_RENAME, oldPath: "123", newPath: "1/23", }, &FileAction{ kind: KIND_RENAME, oldPath: "456", newPath: "4/56", }, }, }) // Force \n as newline to simplify testing // across platforms. newline_ = "\n" for _, testCase := range testCases { // Note: Run tests with -v in case of error r, _ := fileActions(testCase.paths, testCase.content) if len(testCase.result) != len(r) { t.Errorf("Expected %d, got %d", len(testCase.result), len(r)) t.Log(testCase.result) t.Log(r) continue } for i, r1 := range r { r2 := testCase.result[i] if r1.kind != r2.kind { t.Errorf("Expected kind %d, got %d", r2.kind, r1.kind) } if r1.oldPath != r2.oldPath { t.Errorf("Expected path %s, got %s", r2.oldPath, r1.oldPath) } if r1.newPath != r2.newPath { t.Errorf("Expected path %s, got %s", r2.newPath, r1.newPath) } } } _, err = fileActions([]string{"abcd", "efgh"}, "") if err == nil { t.Error("Expected error, got nil") } _, err = fileActions([]string{"abcd", "efgh"}, "abcd") if err == nil { t.Error("Expected error, got nil") } } func Test_parseEditorCommand(t *testing.T) { type TestCase struct { editorCmd string executable string args []string hasError bool } var testCases []TestCase testCases = append(testCases, TestCase{ editorCmd: "subl", executable: "subl", args: []string{}, hasError: false, }) testCases = append(testCases, TestCase{ editorCmd: "/usr/bin/vim -f", executable: "/usr/bin/vim", args: []string{"-f"}, hasError: false, }) testCases = append(testCases, TestCase{ editorCmd: "\"F:\\Sublime Text 3\\sublime_text.exe\" /n /w", executable: "F:\\Sublime Text 3\\sublime_text.exe", args: []string{"/n", "/w"}, hasError: false, }) testCases = append(testCases, TestCase{ editorCmd: "subl -w --command \"something with spaces\"", executable: "subl", args: []string{"-w", "--command", "something with spaces"}, hasError: false, }) testCases = append(testCases, TestCase{ editorCmd: "notepad.exe /PT", executable: "notepad.exe", args: []string{"/PT"}, hasError: false, }) testCases = append(testCases, TestCase{ editorCmd: "vim -e \"unclosed quote", executable: "", args: []string{}, hasError: true, }) testCases = append(testCases, TestCase{ editorCmd: "subl -e 'unclosed single-quote", executable: "", args: []string{}, hasError: true, }) testCases = append(testCases, TestCase{ editorCmd: "", executable: "", args: []string{}, hasError: true, }) for _, testCase := range testCases { executable, args, err := parseEditorCommand(testCase.editorCmd) if (err != nil && !testCase.hasError) || (err == nil && testCase.hasError) { t.Errorf("Error status did not match: %t: %s", testCase.hasError, err) } if executable != testCase.executable { t.Errorf("Expected '%s', got '%s'", testCase.executable, executable) } if len(args) != len(testCase.args) { t.Errorf("Expected and result args don't have the same length: [%s], [%s]", strings.Join(testCase.args, ", "), strings.Join(args, ", ")) } for i, arg := range testCase.args { if arg != args[i] { t.Errorf("Expected and result args differ: [%s], [%s]", strings.Join(testCase.args, ", "), strings.Join(args, ", ")) } } } } func Test_processFileActions(t *testing.T) { setup(t) defer teardown(t) touch(filepath.Join(tempFolder(), "one")) touch(filepath.Join(tempFolder(), "two")) touch(filepath.Join(tempFolder(), "three")) fileActions := []*FileAction{} fileAction := NewFileAction() fileAction.oldPath = filepath.Join(tempFolder(), "one") fileAction.newPath = "one123" fileActions = append(fileActions, fileAction) fileAction = NewFileAction() fileAction.oldPath = filepath.Join(tempFolder(), "two") fileAction.newPath = "two456" fileActions = append(fileActions, fileAction) processFileActions(fileActions, false) if !fileExists(filepath.Join(tempFolder(), "one123")) { t.Error("File not found") } if !fileExists(filepath.Join(tempFolder(), "two456")) { t.Error("File not found") } if !fileExists(filepath.Join(tempFolder(), "three")) { t.Error("File not found") } fileActions = []*FileAction{} fileAction = NewFileAction() fileAction.oldPath = filepath.Join(tempFolder(), "two456") fileAction.kind = KIND_DELETE fileActions = append(fileActions, fileAction) processFileActions(fileActions, true) if !fileExists(filepath.Join(tempFolder(), "two456")) { t.Error("File should not have been deleted") } processFileActions(fileActions, false) if fileExists(filepath.Join(tempFolder(), "two456")) { t.Error("File should have been deleted") } fileActions = []*FileAction{} fileAction = NewFileAction() fileAction.oldPath = filepath.Join(tempFolder(), "three") fileAction.newPath = "nochange" fileActions = append(fileActions, fileAction) processFileActions(fileActions, true) if !fileExists(filepath.Join(tempFolder(), "three")) { t.Error("File was renamed in dry-run mode") } fileActions = []*FileAction{} touch(filepath.Join(tempFolder(), "abcd")) fileAction = NewFileAction() fileAction.oldPath = filepath.Join(tempFolder(), "abcd") fileAction.newPath = "ab/cd" fileActions = append(fileActions, fileAction) processFileActions(fileActions, false) if !fileExists(filepath.Join(tempFolder(), "ab", "cd")) { t.Error("File was not renamed or not moved to subfolder") } } func Test_processFileActions_noDestinationOverwrite(t *testing.T) { setup(t) defer teardown(t) // Case where a sequence of files such as 0.jpg, 1.jpg is being // renamed to 1.jpg, 2.jpg p0 := filepath.Join(tempFolder(), "0") p1 := filepath.Join(tempFolder(), "1") p2 := filepath.Join(tempFolder(), "2") filePutContent(p0, "0") filePutContent(p1, "1") fileActions := []*FileAction{} fileAction := NewFileAction() fileAction.oldPath = p0 fileAction.newPath = "1" fileActions = append(fileActions, fileAction) fileAction = NewFileAction() fileAction.oldPath = p1 fileAction.newPath = "2" fileActions = append(fileActions, fileAction) err := processFileActions(fileActions, false) if err != nil { t.Errorf("Expected no error, but got an error.") } if fileExists(p0) { t.Error("File 0 should have been renamed") } if !fileExists(p1) { t.Error("File 1 should exist") } if !fileExists(p2) { t.Error("File 2 should exist") } if fileGetContent(p1) != "0" { t.Error("File 1 has wrong content") } if fileGetContent(p2) != "1" { t.Error("File 2 has wrong content") } } func Test_processFileActions_noDestinationOverwrite2(t *testing.T) { setup(t) defer teardown(t) // Case where a file is renamed to the name of // another existing file. touch(filepath.Join(tempFolder(), "0")) touch(filepath.Join(tempFolder(), "1")) originalFilePaths := []string{ filepath.Join(tempFolder(), "0"), } changes := ` 1 ` _, err := fileActions(originalFilePaths, changes) if err == nil { t.Error("Expected an error, but got nil.") } } func Test_processFileActions_swapFilenames(t *testing.T) { setup(t) defer teardown(t) p0 := filepath.Join(tempFolder(), "0") p1 := filepath.Join(tempFolder(), "1") filePutContent(p0, "0") filePutContent(p1, "1") originalFilePaths := []string{ p0, p1, } changes := ` 1 0 ` actions, _ := fileActions(originalFilePaths, changes) err := processFileActions(actions, false) if err != nil { t.Error("Expected no error, but got one.") } if fileGetContent(p0) != "1" { t.Error("File 1 has not been renamed correctly") } if fileGetContent(p1) != "0" { t.Error("File 0 has not been renamed correctly") } } func Test_processFileActions_renameToSameName(t *testing.T) { setup(t) defer teardown(t) touch(filepath.Join(tempFolder(), "0")) touch(filepath.Join(tempFolder(), "1")) originalFilePaths := []string{ filepath.Join(tempFolder(), "0"), filepath.Join(tempFolder(), "1"), } changes := ` 9 9 ` _, err := fileActions(originalFilePaths, changes) if err == nil { t.Error("Expected an error, but got nil.") } } func Test_processFileActions_dontDeleteAfterRename(t *testing.T) { setup(t) defer teardown(t) p0 := filepath.Join(tempFolder(), "0") p1 := filepath.Join(tempFolder(), "1") filePutContent(p0, "0") filePutContent(p1, "1") originalFilePaths := []string{ p0, p1, } changes := ` 1 //1 ` actions, _ := fileActions(originalFilePaths, changes) err := processFileActions(actions, false) if err != nil { t.Error("Expected no error, but got one.") } if fileExists(p0) { t.Error("File 0 should have been renamed but still exists.") } if !fileExists(p1) { t.Error("File 1 should exist.") } if fileGetContent(p1) != "0" { t.Errorf("File 0 has not been renamed correctly - content should be \"%s\", but is \"%s\"", "0", fileGetContent(p1)) } } func Test_stringHash(t *testing.T) { if len(stringHash("aaaa")) != 32 { t.Error("hash should be 32 characters long") } if stringHash("abcd") == stringHash("efgh") || stringHash("") == stringHash("ijkl") { t.Error("hashes should be different") } } func Test_watchFile(t *testing.T) { setup(t) defer teardown(t) filePath := tempFolder() + "watchtest" ioutil.WriteFile(filePath, []byte("testing"), 0700) doneChan := make(chan bool) go func(doneChan chan bool) { defer func() { doneChan <- true }() err := watchFile(filePath) if err != nil { t.Error(err) } }(doneChan) time.Sleep(300 * time.Millisecond) ioutil.WriteFile(filePath, []byte("testing change"), 0700) <-doneChan } func fileListsAreEqual(files1 []string, files2 []string) error { if len(files1) != len(files2) { return errors.New("file count is different") } for _, f1 := range files1 { found := false for _, f2 := range files2 { if filepath.Base(f1) == filepath.Base(f2) { found = true } } if !found { return errors.New("file names do not match") } } return nil } func Test_filePathsFromArgs(t *testing.T) { setup(t) defer teardown(t) tempFiles := createRandomTempFiles() args := []string{ filepath.Join(tempFolder(), "*"), } filePaths, err := filePathsFromArgs(args, true) if err != nil { t.Fatal(err) } err = fileListsAreEqual(filePaths, tempFiles) if err != nil { t.Error(err) } // If no argument is provided, the function should default to "*" // in the current dir. currentDir, err := os.Getwd() if err != nil { panic(err) } err = os.Chdir(tempFolder()) if err != nil { panic(err) } args = []string{} filePaths, err = filePathsFromArgs(args, true) if err != nil { t.Fatal(err) } err = fileListsAreEqual(filePaths, tempFiles) if err != nil { t.Error(err) } os.Chdir(currentDir) } func Test_filePathsFromArgs_noDirectories(t *testing.T) { setup(t) defer teardown(t) f0 := filepath.Join(tempFolder(), "0") f1 := filepath.Join(tempFolder(), "1") d0 := filepath.Join(tempFolder(), "dir0") d1 := filepath.Join(tempFolder(), "dir1") touch(f0) touch(f1) os.Mkdir(d0, 0700) os.Mkdir(d1, 0700) args := []string{ filepath.Join(tempFolder(), "*"), } filePaths, _ := filePathsFromArgs(args, true) err := fileListsAreEqual(filePaths, []string{f0, f1, d0, d1}) if err != nil { t.Error(err) } filePaths, _ = filePathsFromArgs(args, false) err = fileListsAreEqual(filePaths, []string{f0, f1}) if err != nil { t.Error(err) } } func stringListsEqual(s1 []string, s2 []string) bool { for i, s := range s1 { if s != s2[i] { return false } } return true } func Test_filePathsFromString(t *testing.T) { newline_ = "\n" var data []string var expected [][]string data = append(data, "// comment\n\nfile1\nfile2\n//comment\n\n\n") expected = append(expected, []string{"file1", "file2"}) data = append(data, "\n// comment\n\n") expected = append(expected, []string{}) data = append(data, "") expected = append(expected, []string{}) data = append(data, "// comment\n\n file1 \n\tfile2\n\nanother file\t\n//comment\n\n\n") expected = append(expected, []string{" file1 ", "\tfile2", "another file\t"}) for i, d := range data { e := expected[i] r := filePathsFromString(d) if !stringListsEqual(e, r) { t.Error("Expected", e, "got", r) } } } func Test_filePathsFromListFile(t *testing.T) { setup(t) defer teardown(t) ioutil.WriteFile(filepath.Join(tempFolder(), "list.txt"), []byte("one"+newline()+"two"), PROFILE_PERM) filePaths, err := filePathsFromListFile(filepath.Join(tempFolder(), "list.txt")) if err != nil { t.Errorf("Expected no error, got %s", err) } if len(filePaths) != 2 { t.Errorf("Expected 2 paths, got %d", len(filePaths)) } else { if filePaths[0] != "one" || filePaths[1] != "two" { t.Error("Incorrect data") } } os.Remove(filepath.Join(tempFolder(), "list.txt")) _, err = filePathsFromListFile(filepath.Join(tempFolder(), "list.txt")) if err == nil { t.Error("Expected an error, got nil") } } func Test_stripBom(t *testing.T) { data := [][][]byte{ {{239, 187, 191}, {}}, {{239, 187, 191, 239, 187, 191}, {239, 187, 191}}, {{239, 187, 191, 65, 66}, {65, 66}}, {{239, 191, 65, 66}, {239, 191, 65, 66}}, {{}, {}}, {{65, 239, 187, 191}, {65, 239, 187, 191}}, } for _, d := range data { if stripBom(string(d[0])) != string(d[1]) { t.Errorf("Expected %x, got %x", d[0], d[1]) } } } func Test_deleteTempFiles(t *testing.T) { setup(t) defer teardown(t) ioutil.WriteFile(filepath.Join(tempFolder(), "one"), []byte("test1"), PROFILE_PERM) ioutil.WriteFile(filepath.Join(tempFolder(), "two"), []byte("test2"), PROFILE_PERM) deleteTempFiles() tempFiles, _ := filepath.Glob(filepath.Join(tempFolder(), "*")) if len(tempFiles) > 0 { t.Fail() } } func Test_newline(t *testing.T) { newline_ = "" nl := newline() if len(nl) < 1 || len(nl) > 2 { t.Fail() } } func Test_guessEditorCommand(t *testing.T) { editor, err := guessEditorCommand() if err != nil || len(editor) <= 0 { t.Fail() } } func Test_bufferHeader(t *testing.T) { setup(t) defer teardown(t) f0 := filepath.Join(tempFolder(), "0") f1 := filepath.Join(tempFolder(), "1") touch(f0) touch(f1) newline_ = "\n" content := createListFileContent([]string{f0, f1}, true) if strings.Index(content, "//") != 0 { t.Fatal("cannot find header") } content = createListFileContent([]string{f0, f1}, false) if content != "0\n1\n" { t.Fatal("file content is incorrect: " + content) } } <|start_filename|>history_test.go<|end_filename|> package main import ( "path/filepath" "testing" ) func Test_saveHistoryItems(t *testing.T) { setup(t) defer teardown(t) err := saveHistoryItems([]*FileAction{}) if err != nil { t.Errorf("Expected no error, got %s", err) } items, _ := allHistoryItems() if len(items) > 0 { t.Errorf("Expected no items, got %d", len(items)) } var fileActions []*FileAction var fileAction *FileAction fileAction = NewFileAction() fileAction = NewFileAction() fileAction.oldPath = "one" fileAction.newPath = "1" fileActions = append(fileActions, fileAction) fileAction = NewFileAction() fileAction.oldPath = "two" fileAction.newPath = "2" fileActions = append(fileActions, fileAction) saveHistoryItems(fileActions) items, _ = allHistoryItems() if len(items) != 2 { t.Errorf("Expected 2 items, got %d", len(items)) } for _, item := range items { if (filepath.Base(item.Source) == "one" && filepath.Base(item.Dest) != "1") || (filepath.Base(item.Source) == "two" && filepath.Base(item.Dest) != "2") { t.Error("Source and destination do not match.") } } fileActions = []*FileAction{} fileAction = NewFileAction() fileAction.oldPath = "three" fileAction.newPath = "3" fileActions = append(fileActions, fileAction) saveHistoryItems(fileActions) items, _ = allHistoryItems() if len(items) != 3 { t.Errorf("Expected 3 items, got %d", len(items)) } profileDb_.Close() err = saveHistoryItems(fileActions) if err == nil { t.Error("Expected error, got nil") } } func Test_deleteHistoryItems(t *testing.T) { setup(t) defer teardown(t) var fileActions []*FileAction var fileAction *FileAction fileAction = NewFileAction() fileAction.oldPath = "one" fileAction.newPath = "1" fileActions = append(fileActions, fileAction) fileAction = NewFileAction() fileAction.oldPath = "two" fileAction.newPath = "2" fileActions = append(fileActions, fileAction) fileAction = NewFileAction() fileAction.oldPath = "three" fileAction.newPath = "3" fileActions = append(fileActions, fileAction) saveHistoryItems(fileActions) items, _ := allHistoryItems() deleteHistoryItems([]HistoryItem{items[0], items[1]}) items, _ = allHistoryItems() if len(items) != 1 { t.Errorf("Expected 1 item, got %d", len(items)) } else { if filepath.Base(items[0].Source) != "three" { t.Error("Incorrect item in history") } } } func Test_deleteOldHistoryItems(t *testing.T) { setup(t) defer teardown(t) now := 1000 for i := 0; i < 5; i++ { profileDb_.Exec("INSERT INTO history (source, destination, timestamp) VALUES (?, ?, ?)", "a", "b", now+i) } deleteOldHistoryItems(int64(now + 2)) items, _ := allHistoryItems() if len(items) != 3 { t.Errorf("Expected 3 items, got %d", len(items)) } } func Test_latestHistoryItemsByDestinations(t *testing.T) { setup(t) defer teardown(t) now := 1000 for i := 0; i < 5; i++ { profileDb_.Exec("INSERT INTO history (source, destination, timestamp) VALUES (?, ?, ?)", "a", "b", now+i) } items, _ := allHistoryItems() dest := items[0].Dest items, _ = latestHistoryItemsByDestinations([]string{dest}) if len(items) != 1 { t.Errorf("Expected 1 item, got %d", len(items)) } else { if items[0].Timestamp != 1004 { t.Error("Did not get the right item") } } } <|start_filename|>vendor/github.com/laurent22/go-trash/recycle.c<|end_filename|> // +build windows // Slightly modified version of recycle.c from <NAME> - http://www.maddogsw.com/cmdutils/ // Mainly replaced BOOL type by int to make it easier to call the function from Go. // // Also added functions for conversion between Go []string and **char from <NAME>: // https://groups.google.com/forum/#!topic/golang-nuts/pQueMFdY0mk #include <stdio.h> #include <windows.h> #include <stdlib.h> char **makeCharArray(int size) { return calloc(sizeof(char*), size); } void setArrayString(char **a, char *s, int n) { a[n] = s; } void freeCharArray(char **a, int size) { int i; for (i = 0; i < size; i++) free(a[i]); free(a); } int RecycleFiles (char** filenames, int nFiles, int bConfirmed) { SHFILEOPSTRUCT opRecycle; char* pszFilesToRecycle; char* pszNext; int i, len; int success = 1; char szLongBuf[MAX_PATH]; char* lastComponent; //fill filenames to delete len = 0; for (i = 0; i < nFiles; i++) { GetFullPathName (filenames[i], sizeof(szLongBuf), szLongBuf, &lastComponent); len += lstrlen (szLongBuf) + 1; } pszFilesToRecycle = malloc (len + 1); pszNext = pszFilesToRecycle; for (i = 0; i < nFiles; i++) { GetFullPathName (filenames[i], sizeof(szLongBuf), szLongBuf, &lastComponent); lstrcpy (pszNext, szLongBuf); pszNext += lstrlen (pszNext) + 1; //advance past terminator } *pszNext = 0; //double-terminate //fill fileop structure opRecycle.hwnd = NULL; opRecycle.wFunc = FO_DELETE; opRecycle.pFrom = pszFilesToRecycle; opRecycle.pTo = "\0\0"; opRecycle.fFlags = FOF_ALLOWUNDO; if (bConfirmed) opRecycle.fFlags |= FOF_NOCONFIRMATION; opRecycle.lpszProgressTitle = "Recycling files..."; if (0 != SHFileOperation (&opRecycle)) success = 0; if (opRecycle.fAnyOperationsAborted) success = 0; free (pszFilesToRecycle); return success; } <|start_filename|>main.go<|end_filename|> package main import ( "crypto/md5" "errors" "fmt" "io" "io/ioutil" "os" "os/exec" "os/signal" "path/filepath" "runtime" "sort" "strings" "sync" "time" "github.com/jessevdk/go-flags" "github.com/kr/text" "github.com/laurent22/go-trash" "github.com/nu7hatch/gouuid" ) var flagParser_ *flags.Parser var newline_ string const ( APPNAME = "massren" LINE_LENGTH = 80 KIND_RENAME = 1 KIND_DELETE = 2 ) type CommandLineOptions struct { DryRun bool `short:"n" long:"dry-run" description:"Don't rename anything but show the operation that would have been performed."` Verbose bool `short:"v" long:"verbose" description:"Enable verbose output."` Config bool `short:"c" long:"config" description:"Set or list configuration values. For more info, type: massren --config --help"` Undo bool `short:"u" long:"undo" description:"Undo a rename operation. Currently delete operations cannot be undone (though files can be recovered from the trash in OSX and Windows). eg. massren --undo [path]"` Version bool `short:"V" long:"version" description:"Displays version information."` } type FileAction struct { oldPath string newPath string intermediatePath string kind int } type DeleteOperationsFirst []*FileAction func (a DeleteOperationsFirst) Len() int { return len(a) } func (a DeleteOperationsFirst) Swap(i, j int) { a[i], a[j] = a[j], a[i] } func (a DeleteOperationsFirst) Less(i, j int) bool { return a[i].kind == KIND_DELETE } func NewFileAction() *FileAction { output := new(FileAction) output.kind = KIND_RENAME return output } func (this *FileAction) FullOldPath() string { return normalizePath(this.oldPath) } func (this *FileAction) FullNewPath() string { return normalizePath(filepath.Join(filepath.Dir(this.oldPath), filepath.Dir(this.newPath), filepath.Base(this.newPath))) } func (this *FileAction) String() string { return fmt.Sprintf("Kind: %d; Old: \"%s\"; New: \"%s\"", this.kind, this.oldPath, this.newPath) } func stringHash(s string) string { h := md5.New() io.WriteString(h, s) return fmt.Sprintf("%x", h.Sum(nil)) } func tempFolder() string { output := filepath.Join(profileFolder(), "temp") err := os.MkdirAll(output, PROFILE_PERM) if err != nil { panic(err) } return output } func criticalError(err error) { logError("%s", err) logInfo("Run '%s --help' for usage\n", APPNAME) os.Exit(1) } func watchFile(filePath string) error { initialStat, err := os.Stat(filePath) if err != nil { return err } for { stat, err := os.Stat(filePath) if err != nil { return err } if stat.Size() != initialStat.Size() || stat.ModTime() != initialStat.ModTime() { return nil } time.Sleep(1 * time.Second) } } func newline() string { if newline_ != "" { return newline_ } if runtime.GOOS == "windows" { newline_ = "\r\n" } else { newline_ = "\n" } return newline_ } func guessEditorCommand() (string, error) { switch runtime.GOOS { case "windows": // The default editor for a given file extension is stored in a registry key: HKEY_CLASSES_ROOT/.txt/ShellNew/ItemName // See this for hwo to in GO: http://stackoverflow.com/questions/18425465/enumerating-registry-values-in-go-golang return "notepad.exe", nil default: // assumes a POSIX system // Get it from EDITOR environment variable, if present editorEnv := strings.Trim(os.Getenv("EDITOR"), "\n\t\r ") if editorEnv != "" { return editorEnv, nil } // Otherwise, try to detect various text editors editors := []string{ "nano", "vim", "emacs", "vi", "ed", } for _, editor := range editors { err := exec.Command("type", editor).Run() if err == nil { return editor, nil } else { err = exec.Command("sh", "-c", "type "+editor).Run() if err == nil { return editor, nil } } } } return "", errors.New("could not guess editor command") } // Returns the executable path and arguments func parseEditorCommand(editorCmd string) (string, []string, error) { var args []string state := "start" current := "" quote := "\"" for i := 0; i < len(editorCmd); i++ { c := editorCmd[i] if state == "quotes" { if string(c) != quote { current += string(c) } else { args = append(args, current) current = "" state = "start" } continue } if c == '"' || c == '\'' { state = "quotes" quote = string(c) continue } if state == "arg" { if c == ' ' || c == '\t' { args = append(args, current) current = "" state = "start" } else { current += string(c) } continue } if c != ' ' && c != '\t' { state = "arg" current += string(c) } } if state == "quotes" { return "", []string{}, errors.New(fmt.Sprintf("Unclosed quote in command line: %s", editorCmd)) } if current != "" { args = append(args, current) } if len(args) <= 0 { return "", []string{}, errors.New("Empty command line") } if len(args) == 1 { return args[0], []string{}, nil } return args[0], args[1:], nil } func editFile(filePath string) error { var err error editorCmd := config_.String("editor") if editorCmd == "" { editorCmd, err = guessEditorCommand() setupInfo := fmt.Sprintf("Run `%s --config editor \"name-of-editor\"` to set up the editor. eg. `%s --config editor \"vim\"`", APPNAME, APPNAME) if err != nil { criticalError(errors.New(fmt.Sprintf("No text editor defined in configuration, and could not guess a text editor.\n%s", setupInfo))) } else { logInfo("No text editor defined in configuration. Using \"%s\" as default.\n%s", editorCmd, setupInfo) } } commandString, args, err := parseEditorCommand(editorCmd) if err != nil { return err } args = append(args, filePath) // Run the properly formed command cmd := exec.Command(commandString, args[0:]...) cmd.Stdin = os.Stdin cmd.Stdout = os.Stdout err = cmd.Run() if err != nil { return err } return nil } func filePathsFromArgs(args []string, includeDirectories bool) ([]string, error) { var output []string var err error if len(args) == 0 { output, err = filepath.Glob("*") if err != nil { return []string{}, err } } else { for _, arg := range args { if strings.Index(arg, "*") < 0 && strings.Index(arg, "?") < 0 { output = append(output, arg) continue } matches, err := filepath.Glob(arg) if err != nil { return []string{}, err } for _, match := range matches { output = append(output, match) } } } if !includeDirectories { var temp []string for _, path := range output { f, err := os.Stat(path) if err == nil && f.IsDir() { continue } temp = append(temp, path) } output = temp } sort.Strings(output) return output, nil } func stripBom(s string) string { if len(s) < 3 { return s } if s[0] != 239 || s[1] != 187 || s[2] != 191 { return s } return s[3:] } func filePathsFromString(content string) []string { var output []string lines := strings.Split(content, newline()) for i, line := range lines { line := strings.Trim(line, "\n\r") if i == 0 { line = stripBom(line) } if line == "" { continue } if len(line) >= 2 && line[0:2] == "//" { continue } output = append(output, line) } return output } func filePathsFromListFile(filePath string) ([]string, error) { contentB, err := ioutil.ReadFile(filePath) if err != nil { return []string{}, err } return filePathsFromString(string(contentB)), nil } func printHelp(subMenu string) { var info string if subMenu == "" { flagParser_.WriteHelp(os.Stdout) info = ` Examples: Process all the files in the current directory: % APPNAME Process all the JPEGs in the specified directory: % APPNAME /path/to/photos/*.jpg Undo the changes done by the previous operation: % APPNAME --undo /path/to/photos/*.jpg Set VIM as the default text editor: % APPNAME --config editor vim List config values: % APPNAME --config ` } else if subMenu == "config" { info = ` Config commands: Set a value: % APPNAME --config <name> <value> List all the values: % APPNAME --config Delete a value: % APPNAME --config <name> Possible key/values: editor: The editor to use when editing the list of files. Default: auto-detected. use_trash: Whether files should be moved to the trash/recycle bin after deletion. Possible values: 0 or 1. Default: 1. include_directories: Whether to include the directories in the file buffer. Possible values: 0 or 1. Default: 1. include_header: Whether to show the header in the file buffer. Possible values: 0 or 1. Default: 1. Examples: Set Sublime as the default text editor: % APPNAME --config editor "subl -n -w" Don't move files to trash: % APPNAME --config use_trash 0 ` } fmt.Println(strings.Replace(info, "APPNAME", APPNAME, -1)) } func fileActions(originalFilePaths []string, changedContent string) ([]*FileAction, error) { if len(originalFilePaths) == 0 { return []*FileAction{}, nil } lines := strings.Split(changedContent, newline()) fileIndex := 0 var actionKind int var output []*FileAction for i, line := range lines { line := strings.Trim(line, "\n\r") if i == 0 { line = stripBom(line) } if line == "" { continue } oldBasePath := filepath.Base(originalFilePaths[fileIndex]) newBasePath := "" if len(line) >= 2 && line[0:2] == "//" { // Check if it is a comment or a file being deleted. newBasePath = strings.Trim(line[2:], " \t") if newBasePath != strings.Trim(oldBasePath, " \t") { // This is not a file being deleted, it's // just a regular comment. continue } newBasePath = "" actionKind = KIND_DELETE } else { newBasePath = line actionKind = KIND_RENAME } if actionKind == KIND_RENAME && newBasePath == oldBasePath { // Found a match but nothing to actually rename } else { action := NewFileAction() action.kind = actionKind action.oldPath = originalFilePaths[fileIndex] action.newPath = newBasePath output = append(output, action) } fileIndex++ if fileIndex >= len(originalFilePaths) { break } } // Sanity check if fileIndex != len(originalFilePaths) { return []*FileAction{}, errors.New("not all files had a match") } // Loop through the actions and check that rename operations don't // overwrite existing files. for _, action := range output { if action.kind != KIND_RENAME { continue } if fileInfo1, err := os.Stat(action.FullNewPath()); err == nil { // Destination exists. Now check if the destination is also going to be // renamed to something else (in which case, there is no error). Also // OK if existing destination is going to be deleted. ok := false for _, action2 := range output { if action2.kind == KIND_RENAME && action2.FullOldPath() == action.FullNewPath() { ok = true break } if action2.kind == KIND_DELETE && action2.FullOldPath() == action.FullNewPath() { ok = true break } } // Also OK if new path and old path are in fact the same file (for example if // "/path/to/abcd" is going to be renamed to "/path/to/ABCD" on a case // insensitive file system). fileInfo2, err := os.Stat(action.FullOldPath()) if err != nil { return []*FileAction{}, errors.New(fmt.Sprintf("cannot stat \"%s\"", action.FullOldPath())) } if os.SameFile(fileInfo1, fileInfo2) { ok = true } if !ok { return []*FileAction{}, errors.New(fmt.Sprintf("\"%s\" cannot be renamed to \"%s\": destination already exists", action.FullOldPath(), action.FullNewPath())) } } } // Loop through the actions and check that no two files are being // renamed to the same name. duplicateMap := make(map[string]bool) for _, action := range output { if action.kind != KIND_RENAME { continue } if _, ok := duplicateMap[action.FullNewPath()]; ok { return []*FileAction{}, errors.New(fmt.Sprintf("two files are being renamed to the same name: \"%s\"", action.FullNewPath())) } else { duplicateMap[action.FullNewPath()] = true } } return output, nil } func deleteTempFiles() error { tempFiles, err := filepath.Glob(filepath.Join(tempFolder(), "*")) if err != nil { return err } for _, p := range tempFiles { os.Remove(p) } return nil } func processFileActions(fileActions []*FileAction, dryRun bool) error { var doneActions []*FileAction var conflictActions []*FileAction // Actions that need a conflict resolution defer func() { err := saveHistoryItems(doneActions) if err != nil { logError("Could not save history items: %s", err) } }() var deleteWaitGroup sync.WaitGroup var deleteChannel = make(chan int, 100) useTrash := config_.BoolD("use_trash", true) // Do delete operations first to avoid problems when file0 is renamed to // existing file1, then file1 is deleted. sort.Sort(DeleteOperationsFirst(fileActions)) for _, action := range fileActions { switch action.kind { case KIND_RENAME: if dryRun { logInfo("\"%s\" => \"%s\"", action.oldPath, action.newPath) } else { logDebug("\"%s\" => \"%s\"", action.oldPath, action.newPath) if _, err := os.Stat(action.FullNewPath()); err == nil { u, _ := uuid.NewV4() action.intermediatePath = action.FullNewPath() + "-" + u.String() conflictActions = append(conflictActions, action) } else { os.MkdirAll(filepath.Dir(action.FullNewPath()), 0755) err := os.Rename(action.FullOldPath(), action.FullNewPath()) if err != nil { return err } } } break case KIND_DELETE: filePath := action.FullOldPath() if dryRun { logInfo("\"%s\" => <Deleted>", filePath) } else { logDebug("\"%s\" => <Deleted>", filePath) deleteWaitGroup.Add(1) go func(filePath string, deleteChannel chan int, useTrash bool) { var err error deleteChannel <- 1 defer deleteWaitGroup.Done() if useTrash { _, err = trash.MoveToTrash(filePath) } else { err = os.RemoveAll(filePath) } if err != nil { logError("%s", err) } <-deleteChannel }(filePath, deleteChannel, useTrash) } break default: panic("Invalid action type") break } doneActions = append(doneActions, action) } deleteWaitGroup.Wait() // Conflict resolution: // - First rename all the problem paths to an intermediate name // - Then rename all the intermediate one to the final name for _, action := range conflictActions { if action.kind != KIND_RENAME { continue } err := os.Rename(action.FullOldPath(), action.intermediatePath) if err != nil { return err } } for _, action := range conflictActions { if action.kind != KIND_RENAME { continue } err := os.Rename(action.intermediatePath, action.FullNewPath()) if err != nil { return err } doneActions = append(doneActions, action) } return nil } func createListFileContent(filePaths []string, includeHeader bool) string { output := "" header := "" if includeHeader { // NOTE: kr/text.Wrap returns lines separated by \n for all platforms. // So here hard-code \n too. Later it will be changed to \r\n for Windows. header = text.Wrap("Please change the filenames that need to be renamed and save the file. Lines that are not changed will be ignored (no file will be renamed).", LINE_LENGTH-3) header += "\n" header += "\n" + text.Wrap("You may delete a file by putting \"//\" at the beginning of the line. Note that this operation cannot be undone (though the file can be recovered from the trash on Windows and OSX).", LINE_LENGTH-3) header += "\n" header += "\n" + text.Wrap("Please do not swap the order of lines as this is what is used to match the original filenames to the new ones. Also do not delete lines as the rename operation will be cancelled due to a mismatch between the number of filenames before and after saving the file. You may test the effect of the rename operation using the --dry-run parameter.", LINE_LENGTH-3) header += "\n" header += "\n" + text.Wrap("Caveats: "+APPNAME+" expects filenames to be reasonably sane. Filenames that include newlines or non-printable characters for example will probably not work.", LINE_LENGTH-3) headerLines := strings.Split(header, "\n") temp := "" for _, line := range headerLines { if temp != "" { temp += newline() } // If empty line we don't want white-space if line == "" { temp += "//" } else { temp += "// " } temp += line } header = temp + newline() + newline() } for _, filePath := range filePaths { output += filepath.Base(filePath) + newline() } return header + output } func onExit() { deleteTempFiles() deleteOldHistoryItems(time.Now().Unix() - 60*60*24*7) profileClose() } func main() { minLogLevel_ = 1 // ----------------------------------------------------------------------------------- // Handle SIGINT (Ctrl + C) // ----------------------------------------------------------------------------------- signalChan := make(chan os.Signal, 1) signal.Notify(signalChan, os.Interrupt, os.Kill) go func() { <-signalChan logInfo("Operation has been aborted.") onExit() os.Exit(2) }() defer onExit() // ----------------------------------------------------------------------------------- // Parse arguments // ----------------------------------------------------------------------------------- var opts CommandLineOptions flagParser_ = flags.NewParser(&opts, flags.HelpFlag|flags.PassDoubleDash) args, err := flagParser_.Parse() if err != nil { t := err.(*flags.Error).Type if t == flags.ErrHelp { subMenu := "" if opts.Config { subMenu = "config" } printHelp(subMenu) return } else { criticalError(err) } } if opts.Verbose { minLogLevel_ = 0 } err = profileOpen() if err != nil { logError(fmt.Sprintf("%s", err)) } // ----------------------------------------------------------------------------------- // Handle selected command // ----------------------------------------------------------------------------------- var commandName string if opts.Config { commandName = "config" } else if opts.Undo { commandName = "undo" } else if opts.Version { commandName = "version" } else { commandName = "rename" } var commandErr error switch commandName { case "config": commandErr = handleConfigCommand(&opts, args) case "undo": commandErr = handleUndoCommand(&opts, args) case "version": commandErr = handleVersionCommand(&opts, args) } if commandErr != nil { criticalError(commandErr) } if commandName != "rename" { return } filePaths, err := filePathsFromArgs(args, config_.BoolD("include_directories", true)) if err != nil { criticalError(err) } if len(filePaths) == 0 { criticalError(errors.New("no file to rename")) } // ----------------------------------------------------------------------------------- // Build file list // ----------------------------------------------------------------------------------- listFileContent := createListFileContent(filePaths, config_.BoolD("include_header", true)) filenameUuid, _ := uuid.NewV4() listFilePath := filepath.Join(tempFolder(), filenameUuid.String()+".files.txt") ioutil.WriteFile(listFilePath, []byte(listFileContent), PROFILE_PERM) // ----------------------------------------------------------------------------------- // Watch for changes in file list // ----------------------------------------------------------------------------------- waitForFileChange := make(chan bool) waitForCommand := make(chan bool) go func(doneChan chan bool) { defer func() { doneChan <- true }() logInfo("Waiting for file list to be saved... (Press Ctrl + C to abort)") err := watchFile(listFilePath) if err != nil { criticalError(err) } }(waitForFileChange) // ----------------------------------------------------------------------------------- // Launch text editor // ----------------------------------------------------------------------------------- go func(doneChan chan bool) { defer func() { doneChan <- true }() err := editFile(listFilePath) if err != nil { criticalError(err) } }(waitForCommand) <-waitForCommand <-waitForFileChange // ----------------------------------------------------------------------------------- // Check that the filenames have not been changed while the list was being edited // ----------------------------------------------------------------------------------- for _, filePath := range filePaths { if _, err := os.Stat(filePath); os.IsNotExist(err) { criticalError(errors.New("Filenames have been changed or some files have been deleted or moved while the list was being edited. To avoid any data loss, the operation has been aborted. You may resume it by running the same command.")) } } // ----------------------------------------------------------------------------------- // Get new filenames from list file // ----------------------------------------------------------------------------------- changedContent, err := ioutil.ReadFile(listFilePath) if err != nil { criticalError(err) } actions, err := fileActions(filePaths, string(changedContent)) if err != nil { criticalError(err) } // ----------------------------------------------------------------------------------- // Process the files // ----------------------------------------------------------------------------------- err = processFileActions(actions, opts.DryRun) if err != nil { criticalError(err) } } <|start_filename|>vendor/github.com/laurent22/go-trash/trash_unix.go<|end_filename|> // +build linux freebsd package trash import ( "os" "os/exec" ) var isAvailable_ int = -1 var toolName_ string // Tells whether it is possible to move a file to the trash func IsAvailable() bool { if isAvailable_ < 0 { toolName_ = "" isAvailable_ = 0 candidates := []string{ "gvfs-trash", "trash", } for _, candidate := range candidates { err := exec.Command("type", candidate).Run() ok := false if err == nil { ok = true } else { err = exec.Command("sh", "-c", "type "+candidate).Run() if err == nil { ok = true } } if ok { toolName_ = candidate isAvailable_ = 1 return true } } return false } else if isAvailable_ == 1 { return true } return false } // Move the given file to the trash // filePath must be an absolute path func MoveToTrash(filePath string) (string, error) { if IsAvailable() { err := exec.Command(toolName_, filePath).Run() return "", err } os.Remove(filePath) return "", nil } <|start_filename|>vendor/github.com/laurent22/go-trash/trash_osx.go<|end_filename|> // +build darwin package trash import ( "bytes" "errors" "fmt" "os" "os/exec" "os/user" "path/filepath" "strconv" "strings" "time" ) // Adapted from https://github.com/morgant/tools-osx/blob/master/src/trash func haveScriptableFinder() (bool, error) { // Get current user user, err := user.Current() if err != nil { return false, err } // Get processes for current user cmd := exec.Command("ps", "-u", user.Username) output, err := cmd.Output() if err != nil { return false, err } // Find Finder process ID, if it is running finderPid := 0 lines := strings.Split(string(output), "\n") for _, line := range lines { if strings.Index(line, "CoreServices/Finder.app") >= 0 { splitted := strings.Split(line, " ") index := 0 for _, token := range splitted { if token == " " || token == "" { continue } index++ if index == 2 { finderPid, err = strconv.Atoi(token) if err != nil { return false, err } break } } } } if finderPid <= 0 { return false, errors.New("could not find Finder process ID") } // TODO: test with screen if os.Getenv("STY") != "" { return false, errors.New("currently running in screen") } return true, nil } // filePath must be an absolute path func pathVolume(filePath string) string { pieces := strings.Split(filePath[1:], "/") if len(pieces) <= 2 { return "" } if pieces[0] != "Volumes" { return "" } volumeName := pieces[1] cmd := exec.Command("readlink", "/Volumes/"+volumeName) output, _ := cmd.Output() if strings.Trim(string(output), " \t\r\n") == "/" { return "" } return volumeName } func fileTrashPath(filePath string) (string, error) { volumeName := pathVolume(filePath) trashPath := "" if volumeName != "" { trashPath = fmt.Sprintf("/Volumes/%s/.Trashes/%d", volumeName, os.Getuid()) } else { user, err := user.Current() if err != nil { return "", err } trashPath = fmt.Sprintf("/Users/%s/.Trash", user.Username) } return trashPath, nil } func fileExists(filePath string) bool { _, err := os.Stat(filePath) return err == nil } // Tells whether it is possible to move a file to the trash func IsAvailable() bool { return true } // Move the given file to the trash // filePath must be an absolute path func MoveToTrash(filePath string) (string, error) { if !fileExists(filePath) { return "", errors.New("file does not exist or is not accessible") } ok, err := haveScriptableFinder() if ok { // Do this in a loop because Finder sometime randomly fails with this error: // 29:106: execution error: Finder got an error: Handler can’t handle objects of this class. (-10010) // Repeating the operation usually fixes the issue. maxLoop := 3 for i := 0; i < maxLoop; i++ { time.Sleep(time.Duration(i*500) * time.Millisecond) cmd := exec.Command("/usr/bin/osascript", "-e", "tell application \"Finder\" to delete POSIX file \""+filePath+"\"") var stdout bytes.Buffer cmd.Stdout = &stdout var stderr bytes.Buffer cmd.Stderr = &stderr err := cmd.Run() if err != nil { err = errors.New(fmt.Sprintf("%s: %s %s", err, stdout.String(), stderr.String())) } if stderr.Len() > 0 { err = errors.New(fmt.Sprintf("%s, %s", stdout.String(), stderr.String())) } if err != nil { if i >= maxLoop-1 { return "", err } else { continue } } break } } else { return "", errors.New(fmt.Sprintf("scriptable Finder not available: %s", err)) // TODO: maybe based on https://github.com/morgant/tools-osx/blob/master/src/trash, move // the file to trash manually. Problem is that it won't be possible to restore the files // directly from the trash. // volumeName := pathVolume(filePath) // trashPath := "" // if volumeName != "" { // trashPath = fmt.Sprintf("/Volumes/%s/.Trashes/%d", volumeName, os.Getuid()) // } else { // user, err := user.Current() // if err != nil { // return err // } // trashPath = fmt.Sprintf("/Users/%s/.Trash", user.Username) // } // err = os.MkdirAll(trashPath, 0700) // if err != nil { // return err // } } return "", nil // Code below is not working well trashPath, err := fileTrashPath(filePath) if err != nil { return "", err } filename := filepath.Base(filePath) ext := filepath.Ext(filePath) filenameNoExt := filename[0 : len(filename)-len(ext)] possibleFiles, err := filepath.Glob(trashPath + "/" + filenameNoExt + " ??.??.??" + ext) if err != nil { return "", err } latestFile := "" var latestTime int64 for _, f := range possibleFiles { fileInfo, err := os.Stat(f) if err != nil { continue } modTime := fileInfo.ModTime().UnixNano() if modTime > latestTime { latestTime = modTime latestFile = f } } if latestFile == "" { return "", errors.New("could not find path of file in trash") } return latestFile, nil } <|start_filename|>undo.go<|end_filename|> package main import ( "github.com/nu7hatch/gouuid" "os" ) func handleUndoCommand(opts *CommandLineOptions, args []string) error { filePaths, err := filePathsFromArgs(args, true) if err != nil { return err } for i, p := range filePaths { filePaths[i] = normalizePath(p) } items, err := latestHistoryItemsByDestinations(filePaths) if err != nil { return err } var conflictItems []HistoryItem for _, item := range items { if opts.DryRun { logInfo("\"%s\" => \"%s\"", item.Dest, item.Source) } else { logDebug("\"%s\" => \"%s\"", item.Dest, item.Source) if _, err := os.Stat(item.Source); os.IsNotExist(err) { err = os.Rename(item.Dest, item.Source) if err != nil { return err } } else { u, _ := uuid.NewV4() item.IntermediatePath = item.Source + "-" + u.String() conflictItems = append(conflictItems, item) } } } // See conflict resolution in main::processFileActions() for _, item := range conflictItems { err := os.Rename(item.Dest, item.IntermediatePath) if err != nil { return err } } for _, item := range conflictItems { err := os.Rename(item.IntermediatePath, item.Source) if err != nil { return err } } deleteHistoryItems(items) return nil }
laurent22/massren
<|start_filename|>src/qoi/implementation.c<|end_filename|> #define QOI_IMPLEMENTATION #include "phoboslab_qoi/qoi.h"
kodonnell/qoi
<|start_filename|>test/ex2ms_test.exs<|end_filename|> defmodule Ex2msTest do use ExUnit.Case, async: true require Record Record.defrecordp(:user, [:name, :age]) import TestHelpers import Ex2ms test "basic" do assert (fun do x -> x end) == [{:"$1", [], [:"$1"]}] end test "$_" do assert (fun do {x, y} = z -> z end) == [{{:"$1", :"$2"}, [], [:"$_"]}] end test "gproc" do assert (fun do {{:n, :l, {:client, id}}, pid, _} -> {id, pid} end) == [{{{:n, :l, {:client, :"$1"}}, :"$2", :_}, [], [{{:"$1", :"$2"}}]}] end test "gproc with bound variables" do id = 5 assert (fun do {{:n, :l, {:client, ^id}}, pid, _} -> pid end) == [{{{:n, :l, {:client, 5}}, :"$1", :_}, [], [:"$1"]}] end test "gproc with 3 variables" do assert (fun do {{:n, :l, {:client, id}}, pid, third} -> {id, pid, third} end) == [ {{{:n, :l, {:client, :"$1"}}, :"$2", :"$3"}, [], [{{:"$1", :"$2", :"$3"}}]} ] end test "gproc with 1 variable and 2 bound variables" do one = 11 two = 22 ms = fun do {{:n, :l, {:client, ^one}}, pid, ^two} -> {^one, pid} end self_pid = self() assert ms == [{{{:n, :l, {:client, 11}}, :"$1", 22}, [], [{{{:const, 11}, :"$1"}}]}] assert {:ok, {one, self_pid}} === :ets.test_ms({{:n, :l, {:client, 11}}, self_pid, two}, ms) end test "cond" do assert (fun do x when true -> 0 end) == [{:"$1", [true], [0]}] assert (fun do x when true and false -> 0 end) == [{:"$1", [{:andalso, true, false}], [0]}] end test "multiple funs" do ms = fun do x -> 0 y -> y end assert ms == [{:"$1", [], [0]}, {:"$1", [], [:"$1"]}] end test "multiple exprs in body" do ms = fun do x -> x 0 end assert ms == [{:"$1", [], [:"$1", 0]}] end test "custom guard macro" do ms = fun do x when custom_guard(x) -> x end assert ms == [{:"$1", [{:andalso, {:>, :"$1", 3}, {:"/=", :"$1", 5}}], [:"$1"]}] end test "nested custom guard macro" do ms = fun do x when nested_custom_guard(x) -> x end assert ms == [ { :"$1", [ { :andalso, {:andalso, {:>, :"$1", 3}, {:"/=", :"$1", 5}}, {:andalso, {:>, {:+, :"$1", 1}, 3}, {:"/=", {:+, :"$1", 1}, 5}} } ], [:"$1"] } ] end test "map is illegal alone in body" do assert_raise ArgumentError, "illegal expression in matchspec:\n%{x: z}", fn -> delay_compile( fun do {x, z} -> %{x: z} end ) end end test "map in head tuple" do ms = fun do {x, %{a: y, c: z}} -> {y, z} end assert ms == [{{:"$1", %{a: :"$2", c: :"$3"}}, [], [{{:"$2", :"$3"}}]}] end test "map is not allowed in the head of function" do assert_raise ArgumentError, "illegal parameter to matchspec (has to be a single variable or tuple):\n%{x: :\"$1\"}", fn -> delay_compile( fun do %{x: z} -> z end ) end end test "invalid fun args" do assert_raise FunctionClauseError, fn -> delay_compile(fun(123)) end end test "raise on invalid fun head" do assert_raise ArgumentError, "illegal parameter to matchspec (has to be a single variable or tuple):\n[x, y]", fn -> delay_compile( fun do x, y -> 0 end ) end assert_raise ArgumentError, "illegal parameter to matchspec (has to be a single variable or tuple):\ny = z", fn -> delay_compile( fun do {x, y = z} -> 0 end ) end assert_raise ArgumentError, "illegal parameter to matchspec (has to be a single variable or tuple):\n123", fn -> delay_compile( fun do 123 -> 0 end ) end end test "unbound variable" do assert_raise ArgumentError, "variable `y` is unbound in matchspec (use `^` for outer variables and expressions)", fn -> delay_compile( fun do x -> y end ) end end test "invalid expression" do assert_raise ArgumentError, "illegal expression in matchspec:\nx = y", fn -> delay_compile( fun do x -> x = y end ) end assert_raise ArgumentError, "illegal expression in matchspec:\nabc(x)", fn -> delay_compile( fun do x -> abc(x) end ) end end test "record" do ms = fun do user(age: x) = n when x > 18 -> n end assert ms == [{{:user, :_, :"$1"}, [{:>, :"$1", 18}], [:"$_"]}] x = 18 ms = fun do user(name: name, age: ^x) -> name end assert ms == [{{:user, :"$1", 18}, [], [:"$1"]}] # Records nils will be converted to :_, if nils are needed, we should explicitly match on it ms = fun do user(age: age) = n when age == nil -> n end assert ms == [{{:user, :_, :"$1"}, [{:==, :"$1", nil}], [:"$_"]}] end test "action function" do ms = fun do _ -> return_trace() end assert ms == [{:_, [], [{:return_trace}]}] # action functions with arguments get turned into :atom, args... tuples ms = fun do arg when arg == :foo -> set_seq_token(:label, :foo) end assert ms == [{:"$1", [{:==, :"$1", :foo}], [{:set_seq_token, :label, :foo}]}] end test "composite bound variables in guards" do one = {1, 2, 3} ms = fun do arg when arg < ^one -> arg end assert ms == [{:"$1", [{:<, :"$1", {:const, {1, 2, 3}}}], [:"$1"]}] end test "composite bound variables in return value" do bound = {1, 2, 3} ms = fun do arg -> {^bound, arg} end assert ms == [{:"$1", [], [{{{:const, {1, 2, 3}}, :"$1"}}]}] assert {:ok, {bound, {:some, :record}}} === :ets.test_ms({:some, :record}, ms) end test "outer expressions get evaluated" do ms = fun do arg -> {^{1, 1 + 1, 3}, arg} end assert ms == [{:"$1", [], [{{{:const, {1, 2, 3}}, :"$1"}}]}] end defmacro test_contexts(var) do quote do var = {1, 2, 3} fun do {^var, _} -> ^unquote(var) end end end test "contexts are preserved" do var = 42 ms = test_contexts(var) assert {:ok, 42} === :ets.test_ms({{1, 2, 3}, 123}, ms) end doctest Ex2ms end <|start_filename|>lib/ex2ms.ex<|end_filename|> defmodule Ex2ms do @moduledoc """ This module provides the `Ex2ms.fun/1` macro for translating Elixir functions to match specifications. """ @bool_functions [ :is_atom, :is_float, :is_integer, :is_list, :is_number, :is_pid, :is_port, :is_reference, :is_tuple, :is_binary, :is_function, :is_record, :and, :or, :not, :xor ] @extra_guard_functions [ :abs, :element, :hd, :count, :node, :round, :size, :tl, :trunc, :+, :-, :*, :/, :div, :rem, :band, :bor, :bxor, :bnot, :bsl, :bsr, :>, :>=, :<, :<=, :===, :==, :!==, :!=, :self ] @guard_functions @bool_functions ++ @extra_guard_functions @action_functions [ :set_seq_token, :get_seq_token, :message, :return_trace, :exception_trace, :process_dump, :enable_trace, :disable_trace, :trace, :display, :caller, :set_tcw, :silent ] @elixir_erlang [===: :"=:=", !==: :"=/=", !=: :"/=", <=: :"=<", and: :andalso, or: :orelse] Enum.each(@guard_functions, fn atom -> defp is_guard_function(unquote(atom)), do: true end) defp is_guard_function(_), do: false Enum.each(@action_functions, fn atom -> defp is_action_function(unquote(atom)), do: true end) defp is_action_function(_), do: false Enum.each(@elixir_erlang, fn {elixir, erlang} -> defp map_elixir_erlang(unquote(elixir)), do: unquote(erlang) end) defp map_elixir_erlang(atom), do: atom @doc """ Translates an anonymous function to a match specification. ## Examples iex> Ex2ms.fun do {x, y} -> x == 2 end [{{:"$1", :"$2"}, [], [{:==, :"$1", 2}]}] """ defmacro fun(do: clauses) do clauses |> Enum.map(fn {:->, _, clause} -> translate_clause(clause, __CALLER__) end) |> Macro.escape(unquote: true) end defmacrop is_literal(term) do quote do is_atom(unquote(term)) or is_number(unquote(term)) or is_binary(unquote(term)) end end defp translate_clause([head, body], caller) do {head, conds, state} = translate_head(head, caller) case head do %{} -> raise_parameter_error(head) _ -> body = translate_body(body, state) {head, conds, body} end end defp translate_body({:__block__, _, exprs}, state) when is_list(exprs) do Enum.map(exprs, &translate_cond(&1, state)) end defp translate_body(expr, state) do [translate_cond(expr, state)] end defp translate_cond({name, _, context}, state) when is_atom(name) and is_atom(context) do if match_var = state.vars[{name, context}] do :"#{match_var}" else raise ArgumentError, message: "variable `#{name}` is unbound in matchspec (use `^` for outer variables and expressions)" end end defp translate_cond({left, right}, state), do: translate_cond({:{}, [], [left, right]}, state) defp translate_cond({:{}, _, list}, state) when is_list(list) do {list |> Enum.map(&translate_cond(&1, state)) |> List.to_tuple()} end defp translate_cond({:^, _, [var]}, _state) do {:const, {:unquote, [], [var]}} end defp translate_cond(fun_call = {fun, _, args}, state) when is_atom(fun) and is_list(args) do cond do is_guard_function(fun) -> match_args = Enum.map(args, &translate_cond(&1, state)) match_fun = map_elixir_erlang(fun) [match_fun | match_args] |> List.to_tuple() expansion = is_expandable(fun_call, state.caller) -> translate_cond(expansion, state) is_action_function(fun) -> match_args = Enum.map(args, &translate_cond(&1, state)) [fun | match_args] |> List.to_tuple() true -> raise_expression_error(fun_call) end end defp translate_cond(list, state) when is_list(list) do Enum.map(list, &translate_cond(&1, state)) end defp translate_cond(literal, _state) when is_literal(literal) do literal end defp translate_cond(expr, _state), do: raise_expression_error(expr) defp translate_head([{:when, _, [param, cond]}], caller) do {head, state} = translate_param(param, caller) cond = translate_cond(cond, state) {head, [cond], state} end defp translate_head([param], caller) do {head, state} = translate_param(param, caller) {head, [], state} end defp translate_head(expr, _caller), do: raise_parameter_error(expr) defp translate_param(param, caller) do param = Macro.expand(param, %{caller | context: :match}) {param, state} = case param do {:=, _, [{name, _, context}, param]} when is_atom(name) and is_atom(context) -> state = %{vars: %{{name, context} => "$_"}, count: 0, caller: caller} {Macro.expand(param, %{caller | context: :match}), state} {:=, _, [param, {name, _, context}]} when is_atom(name) and is_atom(context) -> state = %{vars: %{{name, context} => "$_"}, count: 0, caller: caller} {Macro.expand(param, %{caller | context: :match}), state} {name, _, context} when is_atom(name) and is_atom(context) -> {param, %{vars: %{}, count: 0, caller: caller}} {:{}, _, list} when is_list(list) -> {param, %{vars: %{}, count: 0, caller: caller}} {:%{}, _, list} when is_list(list) -> {param, %{vars: %{}, count: 0, caller: caller}} {_, _} -> {param, %{vars: %{}, count: 0, caller: caller}} _ -> raise_parameter_error(param) end do_translate_param(param, state) end defp do_translate_param({:_, _, context}, state) when is_atom(context) do {:_, state} end defp do_translate_param({name, _, context}, state) when is_atom(name) and is_atom(context) do if match_var = state.vars[{name, context}] do {:"#{match_var}", state} else match_var = "$#{state.count + 1}" state = %{ state | vars: Map.put(state.vars, {name, context}, match_var), count: state.count + 1 } {:"#{match_var}", state} end end defp do_translate_param({left, right}, state) do do_translate_param({:{}, [], [left, right]}, state) end defp do_translate_param({:{}, _, list}, state) when is_list(list) do {list, state} = Enum.map_reduce(list, state, &do_translate_param(&1, &2)) {List.to_tuple(list), state} end defp do_translate_param({:^, _, [expr]}, state) do {{:unquote, [], [expr]}, state} end defp do_translate_param(list, state) when is_list(list) do Enum.map_reduce(list, state, &do_translate_param(&1, &2)) end defp do_translate_param(literal, state) when is_literal(literal) do {literal, state} end defp do_translate_param({:%{}, _, list}, state) do Enum.reduce(list, {%{}, state}, fn {key, value}, {map, state} -> {key, key_state} = do_translate_param(key, state) {value, value_state} = do_translate_param(value, key_state) {Map.put(map, key, value), value_state} end) end defp do_translate_param(expr, _state), do: raise_parameter_error(expr) defp is_expandable(ast, env) do expansion = Macro.expand_once(ast, env) if ast !== expansion, do: expansion, else: false end defp raise_expression_error(expr) do message = "illegal expression in matchspec:\n#{Macro.to_string(expr)}" raise ArgumentError, message: message end defp raise_parameter_error(expr) do message = "illegal parameter to matchspec (has to be a single variable or tuple):\n" <> Macro.to_string(expr) raise ArgumentError, message: message end end <|start_filename|>test/test_helper.exs<|end_filename|> ExUnit.start() defmodule TestHelpers do defmacro delay_compile(quoted) do quoted = Macro.escape(quoted) quote do Code.eval_quoted(unquote(quoted), [], __ENV__) end end defmacro custom_guard(x) do quote do unquote(x) > 3 and unquote(x) != 5 end end defmacro nested_custom_guard(x) do quote do custom_guard(unquote(x)) and custom_guard(unquote(x) + 1) end end end <|start_filename|>mix.exs<|end_filename|> defmodule Ex2ms.Mixfile do use Mix.Project @version "1.6.1" @github_url "https://github.com/ericmj/ex2ms" def project do [ app: :ex2ms, version: @version, elixir: "~> 1.7", source_url: @github_url, docs: [source_ref: "v#{@version}", main: "readme", extras: ["README.md"]], description: description(), package: package(), deps: deps() ] end def application do [] end defp deps do [{:ex_doc, ">= 0.0.0", only: :dev}] end defp description do """ Translates Elixir functions to match specifications for use with `ets`. """ end defp package do [ maintainers: ["<NAME>"], licenses: ["Apache-2.0"], links: %{"GitHub" => @github_url} ] end end
ericmj/ex2ms
<|start_filename|>combinebitmap/src/main/java/com/othershe/combinebitmap/layout/DingLayoutManager.java<|end_filename|> package com.othershe.combinebitmap.layout; import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.Color; public class DingLayoutManager implements ILayoutManager { @Override public Bitmap combineBitmap(int size, int subSize, int gap, int gapColor, Bitmap[] bitmaps) { Bitmap result = Bitmap.createBitmap(size, size, Bitmap.Config.ARGB_8888); Canvas canvas = new Canvas(result); if (gapColor == 0) { gapColor = Color.WHITE; } canvas.drawColor(gapColor); int count = bitmaps.length; Bitmap subBitmap; int[][] dxy = {{0, 0}, {1, 0}, {1, 1}, {0, 1}}; for (int i = 0; i < count; i++) { if (bitmaps[i] == null) { continue; } subBitmap = Bitmap.createScaledBitmap(bitmaps[i], size, size, true); if (count == 2 || (count == 3 && i == 0)) { subBitmap = Bitmap.createBitmap(subBitmap, (size + gap) / 4, 0, (size - gap) / 2, size); } else if ((count == 3 && (i == 1 || i == 2)) || count == 4) { subBitmap = Bitmap.createBitmap(subBitmap, (size + gap) / 4, (size + gap) / 4, (size - gap) / 2, (size - gap) / 2); } int dx = dxy[i][0]; int dy = dxy[i][1]; canvas.drawBitmap(subBitmap, dx * (size + gap) / 2.0f, dy * (size + gap) / 2.0f, null); } return result; } } <|start_filename|>combinebitmap/src/main/java/com/othershe/combinebitmap/listener/OnSubItemClickListener.java<|end_filename|> package com.othershe.combinebitmap.listener; public interface OnSubItemClickListener { // index和传入的图片资源数据的数组下标一一对应 void onSubItemClick(int index); } <|start_filename|>combinebitmap/src/main/java/com/othershe/combinebitmap/CombineBitmap.java<|end_filename|> package com.othershe.combinebitmap; import android.content.Context; import com.othershe.combinebitmap.helper.Builder; public class CombineBitmap { public static Builder init(Context context) { return new Builder(context); } } <|start_filename|>combinebitmap/src/main/java/com/othershe/combinebitmap/listener/OnHandlerListener.java<|end_filename|> package com.othershe.combinebitmap.listener; import android.graphics.Bitmap; public interface OnHandlerListener { void onComplete(Bitmap[] bitmaps); } <|start_filename|>combinebitmap/src/main/java/com/othershe/combinebitmap/layout/WechatLayoutManager.java<|end_filename|> package com.othershe.combinebitmap.layout; import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.Color; public class WechatLayoutManager implements ILayoutManager { @Override public Bitmap combineBitmap(int size, int subSize, int gap, int gapColor, Bitmap[] bitmaps) { Bitmap result = Bitmap.createBitmap(size, size, Bitmap.Config.ARGB_8888); Canvas canvas = new Canvas(result); if (gapColor == 0) { gapColor = Color.WHITE; } canvas.drawColor(gapColor); int count = bitmaps.length; Bitmap subBitmap; for (int i = 0; i < count; i++) { if (bitmaps[i] == null) { continue; } subBitmap = Bitmap.createScaledBitmap(bitmaps[i], subSize, subSize, true); float x = 0; float y = 0; if (count == 2) { x = gap + i * (subSize + gap); y = (size - subSize) / 2.0f; } else if (count == 3) { if (i == 0) { x = (size - subSize) / 2.0f; y = gap; } else { x = gap + (i - 1) * (subSize + gap); y = subSize + 2 * gap; } } else if (count == 4) { x = gap + (i % 2) * (subSize + gap); if (i < 2) { y = gap; } else { y = subSize + 2 * gap; } } else if (count == 5) { if (i == 0) { x = y = (size - 2 * subSize - gap) / 2.0f; } else if (i == 1) { x = (size + gap) / 2.0f; y = (size - 2 * subSize - gap) / 2.0f; } else if (i > 1) { x = gap + (i - 2) * (subSize + gap); y = (size + gap) / 2.0f; } } else if (count == 6) { x = gap + (i % 3) * (subSize + gap); if (i < 3) { y = (size - 2 * subSize - gap) / 2.0f; } else { y = (size + gap) / 2.0f; } } else if (count == 7) { if (i == 0) { x = (size - subSize) / 2.0f; y = gap; } else if (i < 4) { x = gap + (i - 1) * (subSize + gap); y = subSize + 2 * gap; } else { x = gap + (i - 4) * (subSize + gap); y = gap + 2 * (subSize + gap); } } else if (count == 8) { if (i == 0) { x = (size - 2 * subSize - gap) / 2.0f; y = gap; } else if (i == 1) { x = (size + gap) / 2.0f; y = gap; } else if (i < 5) { x = gap + (i - 2) * (subSize + gap); y = subSize + 2 * gap; } else { x = gap + (i - 5) * (subSize + gap); y = gap + 2 * (subSize + gap); } } else if (count == 9) { x = gap + (i % 3) * (subSize + gap); if (i < 3) { y = gap; } else if (i < 6) { y = subSize + 2 * gap; } else { y = gap + 2 * (subSize + gap); } } canvas.drawBitmap(subBitmap, x, y, null); } return result; } }
RealMoMo/CombineBitmap
<|start_filename|>Dockerfile<|end_filename|> #use latest armv7hf compatible debian version from group resin.io as base image FROM balenalib/armv7hf-debian:stretch #enable building ARM container on x86 machinery on the web (comment out next line if built on Raspberry) RUN [ "cross-build-start" ] #labeling LABEL maintainer="<EMAIL>" \ version="V1.0.0" \ description="Open-PLC - IEC 61131-3 compatible open source PLC" #version ENV HILSCHERNETPI_OPENPLC 1.0.0 #copy files COPY "./init.d/*" /etc/init.d/ #install ssh, give user "root" a password RUN apt-get update \ && apt-get install wget \ && wget https://archive.raspbian.org/raspbian.public.key -O - | apt-key add - \ && echo 'deb http://raspbian.raspberrypi.org/raspbian/ stretch main contrib non-free rpi' | tee -a /etc/apt/sources.list \ && wget -O - http://archive.raspberrypi.org/debian/raspberrypi.gpg.key | sudo apt-key add - \ && echo 'deb http://archive.raspberrypi.org/debian/ stretch main ui' | tee -a /etc/apt/sources.list.d/raspi.list \ && apt-get update \ && apt-get install -y openssh-server \ && echo 'root:root' | chpasswd \ && sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config \ && sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd \ && mkdir /var/run/sshd #install tools RUN apt-get install git \ autotools-dev \ autoconf \ automake \ cmake \ bison \ flex \ build-essential \ python-dev \ python-pip \ wget \ libtool \ pkg-config \ binutils #install needed python software RUN python -m pip install --upgrade pip \ && pip install --upgrade setuptools # && pip install flask \ # && pip install flask_login #get OpenPLC source RUN git clone https://github.com/thiagoralves/OpenPLC_v3.git #copy netPI raspberry hardware layer COPY "./hardware_layer/*" "./OpenPLC_v3/webserver/core/hardware_layers/" #compile OpenPLC RUN cd OpenPLC_v3 \ && ./install.sh rpi #SSH port and default OpenPLC port EXPOSE 22 8080 #set the entrypoint ENTRYPOINT ["/etc/init.d/entrypoint.sh"] #set STOPSGINAL STOPSIGNAL SIGTERM #stop processing ARM emulation (comment out next line if built on Raspberry) RUN [ "cross-build-end" ] <|start_filename|>hardware_layer/raspberrypi.cpp<|end_filename|> //----------------------------------------------------------------------------- // Copyright 2015 <NAME> // // Based on the LDmicro software by <NAME> // This file is part of the OpenPLC Software Stack. // // OpenPLC is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // OpenPLC is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with OpenPLC. If not, see <http://www.gnu.org/licenses/>. //------ // // This file is the hardware layer for the OpenPLC. If you change the platform // where it is running, you may only need to change this file. All the I/O // related stuff is here. Basically it provides functions to read and write // to the OpenPLC internal buffers in order to update I/O state. // <NAME>, Dec 2015 //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- // Modified version of raspberrypi.cpp by // Hilscher Gesellschaft fuer Systemautomation mbH 2018 // Hardware layer in accordance with netPI's 4DI/4DO module NIOT-E-NPIX-4DI4DO //----------------------------------------------------------------------------- #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <wiringPi.h> #include <wiringSerial.h> #include <pthread.h> #include "ladder.h" #include "custom_layer.h" #if !defined(ARRAY_SIZE) #define ARRAY_SIZE(x) (sizeof((x)) / sizeof((x)[0])) #endif #define MAX_INPUT 4 #define MAX_OUTPUT 4 #define MAX_ANALOG_OUT 0 /********************I/O PINS CONFIGURATION********************* * A good source for RaspberryPi I/O pins information is: * http://pinout.xyz * * The buffers below works as an internal mask, so that the * OpenPLC can access each pin sequentially ****************************************************************/ //inBufferPinMask: pin mask for each input, which //means what pin is mapped to that OpenPLC input int inBufferPinMask[MAX_INPUT] = { 7, 15, 16, 0 }; //outBufferPinMask: pin mask for each output, which //means what pin is mapped to that OpenPLC output int outBufferPinMask[MAX_OUTPUT] = { 3, 4, 5, 25 }; //analogOutBufferPinMask: pin mask for the analog PWM //output of the RaspberryPi int analogOutBufferPinMask[MAX_ANALOG_OUT] = { }; //----------------------------------------------------------------------------- // This function is called by the main OpenPLC routine when it is initializing. // Hardware initialization procedures should be here. //----------------------------------------------------------------------------- void initializeHardware() { wiringPiSetup(); //piHiPri(99); //set pins as input for (int i = 0; i < MAX_INPUT; i++) { if (pinNotPresent(ignored_bool_inputs, ARRAY_SIZE(ignored_bool_inputs), i)) { pinMode(inBufferPinMask[i], INPUT); if (i != 0 && i != 1) //pull down can't be enabled on the first two pins { pullUpDnControl(inBufferPinMask[i], PUD_DOWN); //pull down enabled } } } //set pins as output for (int i = 0; i < MAX_OUTPUT; i++) { if (pinNotPresent(ignored_bool_outputs, ARRAY_SIZE(ignored_bool_outputs), i)) pinMode(outBufferPinMask[i], OUTPUT); } //set PWM pins as output for (int i = 0; i < MAX_ANALOG_OUT; i++) { if (pinNotPresent(ignored_int_outputs, ARRAY_SIZE(ignored_int_outputs), i)) pinMode(analogOutBufferPinMask[i], PWM_OUTPUT); } } //----------------------------------------------------------------------------- // This function is called by the OpenPLC in a loop. Here the internal buffers // must be updated to reflect the actual state of the input pins. The mutex buffer_lock // must be used to protect access to the buffers on a threaded environment. //----------------------------------------------------------------------------- void updateBuffersIn() { pthread_mutex_lock(&bufferLock); //lock mutex //INPUT for (int i = 0; i < MAX_INPUT; i++) { if (pinNotPresent(ignored_bool_inputs, ARRAY_SIZE(ignored_bool_inputs), i)) if (bool_input[i/8][i%8] != NULL) *bool_input[i/8][i%8] = digitalRead(inBufferPinMask[i]); } pthread_mutex_unlock(&bufferLock); //unlock mutex } //----------------------------------------------------------------------------- // This function is called by the OpenPLC in a loop. Here the internal buffers // must be updated to reflect the actual state of the output pins. The mutex buffer_lock // must be used to protect access to the buffers on a threaded environment. //----------------------------------------------------------------------------- void updateBuffersOut() { pthread_mutex_lock(&bufferLock); //lock mutex //OUTPUT for (int i = 0; i < MAX_OUTPUT; i++) { if (pinNotPresent(ignored_bool_outputs, ARRAY_SIZE(ignored_bool_outputs), i)) if (bool_output[i/8][i%8] != NULL) digitalWrite(outBufferPinMask[i], *bool_output[i/8][i%8]); } //ANALOG OUT (PWM) for (int i = 0; i < MAX_ANALOG_OUT; i++) { if (pinNotPresent(ignored_int_outputs, ARRAY_SIZE(ignored_int_outputs), i)) if (int_output[i] != NULL) pwmWrite(analogOutBufferPinMask[i], (*int_output[i] / 64)); } pthread_mutex_unlock(&bufferLock); //unlock mutex }
HilscherAutomation/netPI-openplc
<|start_filename|>vendor/github.com/elastic/beats/packetbeat/sniffer/pfring_stub.go<|end_filename|> // +build !linux !havepfring package sniffer import ( "fmt" "github.com/tsg/gopacket" ) type pfringHandle struct { } func newPfringHandle(device string, snaplen int, promisc bool) (*pfringHandle, error) { return nil, fmt.Errorf("Pfring sniffing is not compiled in") } func (h *pfringHandle) ReadPacketData() (data []byte, ci gopacket.CaptureInfo, err error) { return data, ci, fmt.Errorf("Pfring sniffing is not compiled in") } func (h *pfringHandle) SetBPFFilter(expr string) (_ error) { return fmt.Errorf("Pfring sniffing is not compiled in") } func (h *pfringHandle) Enable() (_ error) { return fmt.Errorf("Pfring sniffing is not compiled in") } func (h *pfringHandle) Close() { } <|start_filename|>vendor/github.com/elastic/beats/libbeat/outputs/logstash/sync.go<|end_filename|> package logstash import ( "time" "github.com/elastic/go-lumber/client/v2" "github.com/elastic/beats/libbeat/logp" "github.com/elastic/beats/libbeat/outputs" "github.com/elastic/beats/libbeat/outputs/transport" ) const ( minWindowSize int = 1 defaultStartMaxWindowSize int = 10 ) type client struct { *transport.Client client *v2.SyncClient win window } func newLumberjackClient( conn *transport.Client, compressLevel int, maxWindowSize int, timeout time.Duration, beat string, ) (*client, error) { c := &client{} c.Client = conn c.win.init(defaultStartMaxWindowSize, maxWindowSize) enc, err := makeLogstashEventEncoder(beat) if err != nil { return nil, err } cl, err := v2.NewSyncClientWithConn(conn, v2.JSONEncoder(enc), v2.Timeout(timeout), v2.CompressionLevel(compressLevel)) if err != nil { return nil, err } c.client = cl return c, nil } func (c *client) Connect(timeout time.Duration) error { logp.Debug("logstash", "connect") return c.Client.Connect() } func (c *client) Close() error { logp.Debug("logstash", "close connection") return c.Client.Close() } func (c *client) PublishEvent(data outputs.Data) error { _, err := c.PublishEvents([]outputs.Data{data}) return err } // PublishEvents sends all events to logstash. On error a slice with all events // not published or confirmed to be processed by logstash will be returned. func (c *client) PublishEvents( data []outputs.Data, ) ([]outputs.Data, error) { publishEventsCallCount.Add(1) totalNumberOfEvents := len(data) for len(data) > 0 { n, err := c.publishWindowed(data) debug("%v events out of %v events sent to logstash. Continue sending", n, len(data)) data = data[n:] if err != nil { c.win.shrinkWindow() _ = c.Close() logp.Err("Failed to publish events caused by: %v", err) eventsNotAcked.Add(int64(len(data))) ackedEvents.Add(int64(totalNumberOfEvents - len(data))) return data, err } } ackedEvents.Add(int64(totalNumberOfEvents)) return nil, nil } // publishWindowed published events with current maximum window size to logstash // returning the total number of events sent (due to window size, or acks until // failure). func (c *client) publishWindowed(data []outputs.Data) (int, error) { if len(data) == 0 { return 0, nil } batchSize := len(data) windowSize := c.win.get() debug("Try to publish %v events to logstash with window size %v", batchSize, windowSize) // prepare message payload if batchSize > windowSize { data = data[:windowSize] } n, err := c.sendEvents(data) if err != nil { return n, err } c.win.tryGrowWindow(batchSize) return len(data), nil } func (c *client) sendEvents(data []outputs.Data) (int, error) { if len(data) == 0 { return 0, nil } window := make([]interface{}, len(data)) for i, d := range data { window[i] = d } return c.client.Send(window) } <|start_filename|>vendor/github.com/elastic/beats/packetbeat/protos/amqp/amqp.go<|end_filename|> package amqp import ( "expvar" "strconv" "strings" "time" "github.com/elastic/beats/libbeat/common" "github.com/elastic/beats/libbeat/logp" "github.com/elastic/beats/packetbeat/protos" "github.com/elastic/beats/packetbeat/protos/tcp" "github.com/elastic/beats/packetbeat/publish" ) var ( debugf = logp.MakeDebug("amqp") detailedf = logp.MakeDebug("amqpdetailed") ) type amqpPlugin struct { ports []int sendRequest bool sendResponse bool maxBodyLength int parseHeaders bool parseArguments bool hideConnectionInformation bool transactions *common.Cache transactionTimeout time.Duration results publish.Transactions //map containing functions associated with different method numbers methodMap map[codeClass]map[codeMethod]amqpMethod } var ( unmatchedRequests = expvar.NewInt("amqp.unmatched_requests") unmatchedResponses = expvar.NewInt("amqp.unmatched_responses") ) func init() { protos.Register("amqp", New) } func New( testMode bool, results publish.Transactions, cfg *common.Config, ) (protos.Plugin, error) { p := &amqpPlugin{} config := defaultConfig if !testMode { if err := cfg.Unpack(&config); err != nil { return nil, err } } if err := p.init(results, &config); err != nil { return nil, err } return p, nil } func (amqp *amqpPlugin) init(results publish.Transactions, config *amqpConfig) error { amqp.initMethodMap() amqp.setFromConfig(config) if amqp.hideConnectionInformation == false { amqp.addConnectionMethods() } amqp.transactions = common.NewCache( amqp.transactionTimeout, protos.DefaultTransactionHashSize) amqp.transactions.StartJanitor(amqp.transactionTimeout) amqp.results = results return nil } func (amqp *amqpPlugin) initMethodMap() { amqp.methodMap = map[codeClass]map[codeMethod]amqpMethod{ connectionCode: { connectionClose: connectionCloseMethod, connectionCloseOk: okMethod, }, channelCode: { channelClose: channelCloseMethod, channelCloseOk: okMethod, }, exchangeCode: { exchangeDeclare: exchangeDeclareMethod, exchangeDeclareOk: okMethod, exchangeDelete: exchangeDeleteMethod, exchangeDeleteOk: okMethod, exchangeBind: exchangeBindMethod, exchangeBindOk: okMethod, exchangeUnbind: exchangeUnbindMethod, exchangeUnbindOk: okMethod, }, queueCode: { queueDeclare: queueDeclareMethod, queueDeclareOk: queueDeclareOkMethod, queueBind: queueBindMethod, queueBindOk: okMethod, queueUnbind: queueUnbindMethod, queueUnbindOk: okMethod, queuePurge: queuePurgeMethod, queuePurgeOk: queuePurgeOkMethod, queueDelete: queueDeleteMethod, queueDeleteOk: queueDeleteOkMethod, }, basicCode: { basicConsume: basicConsumeMethod, basicConsumeOk: basicConsumeOkMethod, basicCancel: basicCancelMethod, basicCancelOk: basicCancelOkMethod, basicPublish: basicPublishMethod, basicReturn: basicReturnMethod, basicDeliver: basicDeliverMethod, basicGet: basicGetMethod, basicGetOk: basicGetOkMethod, basicGetEmpty: basicGetEmptyMethod, basicAck: basicAckMethod, basicReject: basicRejectMethod, basicRecover: basicRecoverMethod, basicRecoverOk: okMethod, basicNack: basicNackMethod, }, txCode: { txSelect: txSelectMethod, txSelectOk: okMethod, txCommit: txCommitMethod, txCommitOk: okMethod, txRollback: txRollbackMethod, txRollbackOk: okMethod, }, } } func (amqp *amqpPlugin) GetPorts() []int { return amqp.ports } func (amqp *amqpPlugin) setFromConfig(config *amqpConfig) { amqp.ports = config.Ports amqp.sendRequest = config.SendRequest amqp.sendResponse = config.SendResponse amqp.maxBodyLength = config.MaxBodyLength amqp.parseHeaders = config.ParseHeaders amqp.parseArguments = config.ParseArguments amqp.hideConnectionInformation = config.HideConnectionInformation amqp.transactionTimeout = config.TransactionTimeout } func (amqp *amqpPlugin) addConnectionMethods() { amqp.methodMap[connectionCode][connectionStart] = connectionStartMethod amqp.methodMap[connectionCode][connectionStartOk] = connectionStartOkMethod amqp.methodMap[connectionCode][connectionTune] = connectionTuneMethod amqp.methodMap[connectionCode][connectionTuneOk] = connectionTuneOkMethod amqp.methodMap[connectionCode][connectionOpen] = connectionOpenMethod amqp.methodMap[connectionCode][connectionOpenOk] = okMethod amqp.methodMap[channelCode][channelOpen] = channelOpenMethod amqp.methodMap[channelCode][channelOpenOk] = okMethod amqp.methodMap[channelCode][channelFlow] = channelFlowMethod amqp.methodMap[channelCode][channelFlowOk] = channelFlowOkMethod amqp.methodMap[basicCode][basicQos] = basicQosMethod amqp.methodMap[basicCode][basicQosOk] = okMethod } func (amqp *amqpPlugin) ConnectionTimeout() time.Duration { return amqp.transactionTimeout } func (amqp *amqpPlugin) Parse(pkt *protos.Packet, tcptuple *common.TCPTuple, dir uint8, private protos.ProtocolData) protos.ProtocolData { defer logp.Recover("ParseAmqp exception") detailedf("Parse method triggered") priv := amqpPrivateData{} if private != nil { var ok bool priv, ok = private.(amqpPrivateData) if !ok { priv = amqpPrivateData{} } } if priv.data[dir] == nil { priv.data[dir] = &amqpStream{ data: pkt.Payload, message: &amqpMessage{ts: pkt.Ts}, } } else { // concatenate databytes priv.data[dir].data = append(priv.data[dir].data, pkt.Payload...) if len(priv.data[dir].data) > tcp.TCPMaxDataInStream { debugf("Stream data too large, dropping TCP stream") priv.data[dir] = nil return priv } } stream := priv.data[dir] for len(stream.data) > 0 { if stream.message == nil { stream.message = &amqpMessage{ts: pkt.Ts} } ok, complete := amqp.amqpMessageParser(stream) if !ok { // drop this tcp stream. Will retry parsing with the next // segment in it priv.data[dir] = nil return priv } if !complete { break } amqp.handleAmqp(stream.message, tcptuple, dir) } return priv } func (amqp *amqpPlugin) GapInStream(tcptuple *common.TCPTuple, dir uint8, nbytes int, private protos.ProtocolData) (priv protos.ProtocolData, drop bool) { detailedf("GapInStream called") return private, true } func (amqp *amqpPlugin) ReceivedFin(tcptuple *common.TCPTuple, dir uint8, private protos.ProtocolData) protos.ProtocolData { return private } func (amqp *amqpPlugin) handleAmqpRequest(msg *amqpMessage) { // Add it to the HT tuple := msg.tcpTuple trans := amqp.getTransaction(tuple.Hashable()) if trans != nil { if trans.amqp != nil { debugf("Two requests without a Response. Dropping old request: %s", trans.amqp) unmatchedRequests.Add(1) } } else { trans = &amqpTransaction{tuple: tuple} amqp.transactions.Put(tuple.Hashable(), trans) } trans.ts = msg.ts trans.src = common.Endpoint{ IP: msg.tcpTuple.SrcIP.String(), Port: msg.tcpTuple.SrcPort, Proc: string(msg.cmdlineTuple.Src), } trans.dst = common.Endpoint{ IP: msg.tcpTuple.DstIP.String(), Port: msg.tcpTuple.DstPort, Proc: string(msg.cmdlineTuple.Dst), } if msg.direction == tcp.TCPDirectionReverse { trans.src, trans.dst = trans.dst, trans.src } trans.method = msg.method // get the righ request if len(msg.request) > 0 { trans.request = strings.Join([]string{msg.method, msg.request}, " ") } else { trans.request = msg.method } //length = message + 4 bytes header + frame end octet trans.bytesIn = msg.bodySize + 12 if msg.fields != nil { trans.amqp = msg.fields } else { trans.amqp = common.MapStr{} } //if error or exception, publish it now. sometimes client or server never send //an ack message and the error is lost. Also, if nowait flag set, don't expect //any response and publish if isAsynchronous(trans) { amqp.publishTransaction(trans) debugf("Amqp transaction completed") amqp.transactions.Delete(trans.tuple.Hashable()) return } if trans.timer != nil { trans.timer.Stop() } trans.timer = time.AfterFunc(transactionTimeout, func() { amqp.expireTransaction(trans) }) } func (amqp *amqpPlugin) handleAmqpResponse(msg *amqpMessage) { tuple := msg.tcpTuple trans := amqp.getTransaction(tuple.Hashable()) if trans == nil || trans.amqp == nil { debugf("Response from unknown transaction. Ignoring.") unmatchedResponses.Add(1) return } //length = message + 4 bytes class/method + frame end octet + header trans.bytesOut = msg.bodySize + 12 //merge the both fields from request and response trans.amqp.Update(msg.fields) trans.response = common.OK_STATUS if msg.method == "basic.get-empty" { trans.method = "basic.get-empty" } trans.responseTime = int32(msg.ts.Sub(trans.ts).Nanoseconds() / 1e6) trans.notes = msg.notes amqp.publishTransaction(trans) debugf("Amqp transaction completed") // remove from map amqp.transactions.Delete(trans.tuple.Hashable()) if trans.timer != nil { trans.timer.Stop() } } func (amqp *amqpPlugin) expireTransaction(trans *amqpTransaction) { debugf("Transaction expired") //possibility of a connection.close or channel.close method that didn't get an //ok answer. Let's publish it. if isCloseError(trans) { trans.notes = append(trans.notes, "Close-ok method not received by sender") amqp.publishTransaction(trans) } // remove from map amqp.transactions.Delete(trans.tuple.Hashable()) } //This method handles published messages from clients. Being an async //process, the method, header and body frames are regrouped in one transaction func (amqp *amqpPlugin) handlePublishing(client *amqpMessage) { tuple := client.tcpTuple trans := amqp.getTransaction(tuple.Hashable()) if trans == nil { trans = &amqpTransaction{tuple: tuple} amqp.transactions.Put(client.tcpTuple.Hashable(), trans) } trans.ts = client.ts trans.src = common.Endpoint{ IP: client.tcpTuple.SrcIP.String(), Port: client.tcpTuple.SrcPort, Proc: string(client.cmdlineTuple.Src), } trans.dst = common.Endpoint{ IP: client.tcpTuple.DstIP.String(), Port: client.tcpTuple.DstPort, Proc: string(client.cmdlineTuple.Dst), } trans.method = client.method //for publishing and delivering, bytes in and out represent the length of the //message itself trans.bytesIn = client.bodySize if client.bodySize > uint64(amqp.maxBodyLength) { trans.body = client.body[:amqp.maxBodyLength] } else { trans.body = client.body } trans.toString = isStringable(client) trans.amqp = client.fields amqp.publishTransaction(trans) debugf("Amqp transaction completed") //delete trans from map amqp.transactions.Delete(trans.tuple.Hashable()) } //This method handles delivered messages via basic.deliver and basic.get-ok AND //returned messages to clients. Being an async process, the method, header and //body frames are regrouped in one transaction func (amqp *amqpPlugin) handleDelivering(server *amqpMessage) { tuple := server.tcpTuple trans := amqp.getTransaction(tuple.Hashable()) if trans == nil { trans = &amqpTransaction{tuple: tuple} amqp.transactions.Put(server.tcpTuple.Hashable(), trans) } trans.ts = server.ts trans.src = common.Endpoint{ IP: server.tcpTuple.SrcIP.String(), Port: server.tcpTuple.SrcPort, Proc: string(server.cmdlineTuple.Src), } trans.dst = common.Endpoint{ IP: server.tcpTuple.DstIP.String(), Port: server.tcpTuple.DstPort, Proc: string(server.cmdlineTuple.Dst), } //for publishing and delivering, bytes in and out represent the length of the //message itself trans.bytesOut = server.bodySize if server.bodySize > uint64(amqp.maxBodyLength) { trans.body = server.body[:amqp.maxBodyLength] } else { trans.body = server.body } trans.toString = isStringable(server) if server.method == "basic.get-ok" { trans.method = "basic.get" } else { trans.method = server.method } trans.amqp = server.fields amqp.publishTransaction(trans) debugf("Amqp transaction completed") //delete trans from map amqp.transactions.Delete(trans.tuple.Hashable()) } func (amqp *amqpPlugin) publishTransaction(t *amqpTransaction) { if amqp.results == nil { return } event := common.MapStr{} event["type"] = "amqp" event["method"] = t.method if isError(t) { event["status"] = common.ERROR_STATUS } else { event["status"] = common.OK_STATUS } event["responsetime"] = t.responseTime event["amqp"] = t.amqp event["bytes_out"] = t.bytesOut event["bytes_in"] = t.bytesIn event["@timestamp"] = common.Time(t.ts) event["src"] = &t.src event["dst"] = &t.dst //let's try to convert request/response to a readable format if amqp.sendRequest { if t.method == "basic.publish" { if t.toString { if uint64(len(t.body)) < t.bytesIn { event["request"] = string(t.body) + " [...]" } else { event["request"] = string(t.body) } } else { if uint64(len(t.body)) < t.bytesIn { event["request"] = bodyToString(t.body) + " [...]" } else { event["request"] = bodyToString(t.body) } } } else { event["request"] = t.request } } if amqp.sendResponse { if t.method == "basic.deliver" || t.method == "basic.return" || t.method == "basic.get" { if t.toString { if uint64(len(t.body)) < t.bytesOut { event["response"] = string(t.body) + " [...]" } else { event["response"] = string(t.body) } } else { if uint64(len(t.body)) < t.bytesOut { event["response"] = bodyToString(t.body) + " [...]" } else { event["response"] = bodyToString(t.body) } } } else { event["response"] = t.response } } if len(t.notes) > 0 { event["notes"] = t.notes } amqp.results.PublishTransaction(event) } //function to check if method is async or not func isAsynchronous(trans *amqpTransaction) bool { if val, ok := trans.amqp["no-wait"]; ok && val == true { return true } return trans.method == "basic.reject" || trans.method == "basic.ack" || trans.method == "basic.nack" } //function to convert a body slice into a readable format func bodyToString(data []byte) string { ret := make([]string, len(data)) for i, c := range data { ret[i] = strconv.Itoa(int(c)) } return strings.Join(ret, " ") } //function used to check if a body message can be converted to readable string func isStringable(m *amqpMessage) bool { stringable := false if contentEncoding, ok := m.fields["content-encoding"].(string); ok && contentEncoding != "" { return false } if contentType, ok := m.fields["content-type"].(string); ok { stringable = strings.Contains(contentType, "text") || strings.Contains(contentType, "json") } return stringable } func (amqp *amqpPlugin) getTransaction(k common.HashableTCPTuple) *amqpTransaction { v := amqp.transactions.Get(k) if v != nil { return v.(*amqpTransaction) } return nil } func isError(t *amqpTransaction) bool { return t.method == "basic.return" || t.method == "basic.reject" || isCloseError(t) } func isCloseError(t *amqpTransaction) bool { return (t.method == "connection.close" || t.method == "channel.close") && getReplyCode(t.amqp) >= 300 } func getReplyCode(m common.MapStr) uint16 { code, _ := m["reply-code"].(uint16) return code } <|start_filename|>vendor/github.com/elastic/beats/libbeat/outputs/kafka/kafka.go<|end_filename|> package kafka import ( "errors" "fmt" "strings" "sync" "time" "github.com/Shopify/sarama" metrics "github.com/rcrowley/go-metrics" "github.com/rcrowley/go-metrics/exp" "github.com/elastic/beats/libbeat/common" "github.com/elastic/beats/libbeat/common/op" "github.com/elastic/beats/libbeat/logp" "github.com/elastic/beats/libbeat/outputs" "github.com/elastic/beats/libbeat/outputs/mode" "github.com/elastic/beats/libbeat/outputs/mode/modeutil" "github.com/elastic/beats/libbeat/outputs/outil" ) type kafka struct { config kafkaConfig topic outil.Selector modeRetry mode.ConnectionMode modeGuaranteed mode.ConnectionMode partitioner sarama.PartitionerConstructor } const ( defaultWaitRetry = 1 * time.Second // NOTE: maxWaitRetry has no effect on mode, as logstash client currently does // not return ErrTempBulkFailure defaultMaxWaitRetry = 60 * time.Second ) var kafkaMetricsRegistryInstance metrics.Registry func init() { sarama.Logger = kafkaLogger{} reg := metrics.NewPrefixedRegistry("libbeat.kafka.") // Note: registers /debug/metrics handler for displaying all expvar counters exp.Exp(reg) kafkaMetricsRegistryInstance = reg outputs.RegisterOutputPlugin("kafka", New) } var kafkaMetricsOnce sync.Once func kafkaMetricsRegistry() metrics.Registry { return kafkaMetricsRegistryInstance } var debugf = logp.MakeDebug("kafka") var ( errNoTopicSet = errors.New("No topic configured") errNoHosts = errors.New("No hosts configured") ) var ( compressionModes = map[string]sarama.CompressionCodec{ "none": sarama.CompressionNone, "no": sarama.CompressionNone, "off": sarama.CompressionNone, "gzip": sarama.CompressionGZIP, "snappy": sarama.CompressionSnappy, } kafkaVersions = map[string]sarama.KafkaVersion{ "": sarama.V0_8_2_0, "0.8.2.0": sarama.V0_8_2_0, "0.8.2.1": sarama.V0_8_2_1, "0.8.2.2": sarama.V0_8_2_2, "0.8.2": sarama.V0_8_2_2, "0.8": sarama.V0_8_2_2, "0.9.0.0": sarama.V0_9_0_0, "0.9.0.1": sarama.V0_9_0_1, "0.9.0": sarama.V0_9_0_1, "0.9": sarama.V0_9_0_1, "0.10.0.0": sarama.V0_10_0_0, "0.10.0.1": sarama.V0_10_0_1, "0.10.0": sarama.V0_10_0_1, "0.10": sarama.V0_10_0_1, } ) // New instantiates a new kafka output instance. func New(beatName string, cfg *common.Config, topologyExpire int) (outputs.Outputer, error) { output := &kafka{} err := output.init(cfg) if err != nil { return nil, err } return output, nil } func (k *kafka) init(cfg *common.Config) error { debugf("initialize kafka output") config := defaultConfig if err := cfg.Unpack(&config); err != nil { return err } topic, err := outil.BuildSelectorFromConfig(cfg, outil.Settings{ Key: "topic", MultiKey: "topics", EnableSingleOnly: true, FailEmpty: true, }) if err != nil { return err } partitioner, err := makePartitioner(config.Partition) if err != nil { return err } k.config = config k.partitioner = partitioner k.topic = topic // validate config one more time _, err = k.newKafkaConfig() if err != nil { return err } return nil } func (k *kafka) initMode(guaranteed bool) (mode.ConnectionMode, error) { libCfg, err := k.newKafkaConfig() if err != nil { return nil, err } if guaranteed { libCfg.Producer.Retry.Max = 1000 } worker := 1 if k.config.Worker > 1 { worker = k.config.Worker } var clients []mode.AsyncProtocolClient hosts := k.config.Hosts topic := k.topic for i := 0; i < worker; i++ { client, err := newKafkaClient(hosts, k.config.Key, topic, libCfg) if err != nil { logp.Err("Failed to create kafka client: %v", err) return nil, err } clients = append(clients, client) } maxAttempts := 1 if guaranteed { maxAttempts = 0 } mode, err := modeutil.NewAsyncConnectionMode(clients, modeutil.Settings{ Failover: false, MaxAttempts: maxAttempts, WaitRetry: defaultWaitRetry, Timeout: libCfg.Net.WriteTimeout, MaxWaitRetry: defaultMaxWaitRetry, }) if err != nil { logp.Err("Failed to configure kafka connection: %v", err) return nil, err } return mode, nil } func (k *kafka) getMode(opts outputs.Options) (mode.ConnectionMode, error) { var err error guaranteed := opts.Guaranteed || k.config.MaxRetries == -1 if guaranteed { if k.modeGuaranteed == nil { k.modeGuaranteed, err = k.initMode(true) } return k.modeGuaranteed, err } if k.modeRetry == nil { k.modeRetry, err = k.initMode(false) } return k.modeRetry, err } func (k *kafka) Close() error { var err error if k.modeGuaranteed != nil { err = k.modeGuaranteed.Close() } if k.modeRetry != nil { tmp := k.modeRetry.Close() if err == nil { err = tmp } } return err } func (k *kafka) PublishEvent( signal op.Signaler, opts outputs.Options, data outputs.Data, ) error { mode, err := k.getMode(opts) if err != nil { return err } return mode.PublishEvent(signal, opts, data) } func (k *kafka) BulkPublish( signal op.Signaler, opts outputs.Options, data []outputs.Data, ) error { mode, err := k.getMode(opts) if err != nil { return err } return mode.PublishEvents(signal, opts, data) } func (k *kafka) PublishEvents( signal op.Signaler, opts outputs.Options, data []outputs.Data, ) error { return k.BulkPublish(signal, opts, data) } func (k *kafka) newKafkaConfig() (*sarama.Config, error) { cfg, err := newKafkaConfig(&k.config) if err != nil { return nil, err } cfg.Producer.Partitioner = k.partitioner return cfg, nil } func newKafkaConfig(config *kafkaConfig) (*sarama.Config, error) { k := sarama.NewConfig() // configure network level properties timeout := config.Timeout k.Net.DialTimeout = timeout k.Net.ReadTimeout = timeout k.Net.WriteTimeout = timeout k.Net.KeepAlive = config.KeepAlive k.Producer.Timeout = config.BrokerTimeout tls, err := outputs.LoadTLSConfig(config.TLS) if err != nil { return nil, err } if tls != nil { k.Net.TLS.Enable = true k.Net.TLS.Config = tls.BuildModuleConfig("") } if config.Username != "" { k.Net.SASL.Enable = true k.Net.SASL.User = config.Username k.Net.SASL.Password = <PASSWORD> } // configure metadata update properties k.Metadata.Retry.Max = config.Metadata.Retry.Max k.Metadata.Retry.Backoff = config.Metadata.Retry.Backoff k.Metadata.RefreshFrequency = config.Metadata.RefreshFreq // configure producer API properties if config.MaxMessageBytes != nil { k.Producer.MaxMessageBytes = *config.MaxMessageBytes } if config.RequiredACKs != nil { k.Producer.RequiredAcks = sarama.RequiredAcks(*config.RequiredACKs) } compressionMode, ok := compressionModes[strings.ToLower(config.Compression)] if !ok { return nil, fmt.Errorf("Unknown compression mode: '%v'", config.Compression) } k.Producer.Compression = compressionMode k.Producer.Return.Successes = true // enable return channel for signaling k.Producer.Return.Errors = true // have retries being handled by libbeat, disable retries in sarama library retryMax := config.MaxRetries if retryMax < 0 { retryMax = 1000 } k.Producer.Retry.Max = retryMax // TODO: k.Producer.Retry.Backoff = ? // configure per broker go channel buffering k.ChannelBufferSize = config.ChanBufferSize // configure client ID k.ClientID = config.ClientID if err := k.Validate(); err != nil { logp.Err("Invalid kafka configuration: %v", err) return nil, err } version, ok := kafkaVersions[config.Version] if !ok { return nil, fmt.Errorf("Unknown/unsupported kafka version: %v", config.Version) } k.Version = version k.MetricRegistry = kafkaMetricsRegistry() return k, nil } <|start_filename|>vendor/github.com/elastic/beats/metricbeat/module/docker/cpu/helper.go<|end_filename|> package cpu import ( "strconv" "github.com/elastic/beats/libbeat/common" "github.com/elastic/beats/metricbeat/module/docker" dc "github.com/fsouza/go-dockerclient" ) type CPUCalculator interface { perCpuUsage(stats *dc.Stats) common.MapStr totalUsage(stats *dc.Stats) float64 usageInKernelmode(stats *dc.Stats) float64 usageInUsermode(stats *dc.Stats) float64 } type CPUStats struct { Time common.Time Container *docker.Container PerCpuUsage common.MapStr TotalUsage float64 UsageInKernelmode uint64 UsageInKernelmodePercentage float64 UsageInUsermode uint64 UsageInUsermodePercentage float64 SystemUsage uint64 SystemUsagePercentage float64 } type CPUService struct{} func NewCpuService() *CPUService { return &CPUService{} } func (c *CPUService) getCPUStatsList(rawStats []docker.Stat) []CPUStats { formattedStats := []CPUStats{} for _, stats := range rawStats { formattedStats = append(formattedStats, c.getCpuStats(&stats)) } return formattedStats } func (c *CPUService) getCpuStats(myRawStat *docker.Stat) CPUStats { return CPUStats{ Time: common.Time(myRawStat.Stats.Read), Container: docker.NewContainer(&myRawStat.Container), PerCpuUsage: perCpuUsage(&myRawStat.Stats), TotalUsage: totalUsage(&myRawStat.Stats), UsageInKernelmode: myRawStat.Stats.CPUStats.CPUUsage.UsageInKernelmode, UsageInKernelmodePercentage: usageInKernelmode(&myRawStat.Stats), UsageInUsermode: myRawStat.Stats.CPUStats.CPUUsage.UsageInUsermode, UsageInUsermodePercentage: usageInUsermode(&myRawStat.Stats), SystemUsage: myRawStat.Stats.CPUStats.SystemCPUUsage, SystemUsagePercentage: systemUsage(&myRawStat.Stats), } } func perCpuUsage(stats *dc.Stats) common.MapStr { var output common.MapStr if len(stats.CPUStats.CPUUsage.PercpuUsage) == len(stats.PreCPUStats.CPUUsage.PercpuUsage) { output = common.MapStr{} for index := range stats.CPUStats.CPUUsage.PercpuUsage { cpu := common.MapStr{} cpu["pct"] = calculateLoad(stats.CPUStats.CPUUsage.PercpuUsage[index] - stats.PreCPUStats.CPUUsage.PercpuUsage[index]) cpu["ticks"] = stats.CPUStats.CPUUsage.PercpuUsage[index] output[strconv.Itoa(index)] = cpu } } return output } // TODO: These helper should be merged with the cpu helper in system/cpu func totalUsage(stats *dc.Stats) float64 { return calculateLoad(stats.CPUStats.CPUUsage.TotalUsage - stats.PreCPUStats.CPUUsage.TotalUsage) } func usageInKernelmode(stats *dc.Stats) float64 { return calculateLoad(stats.CPUStats.CPUUsage.UsageInKernelmode - stats.PreCPUStats.CPUUsage.UsageInKernelmode) } func usageInUsermode(stats *dc.Stats) float64 { return calculateLoad(stats.CPUStats.CPUUsage.UsageInUsermode - stats.PreCPUStats.CPUUsage.UsageInUsermode) } func systemUsage(stats *dc.Stats) float64 { return calculateLoad(stats.CPUStats.SystemCPUUsage - stats.PreCPUStats.SystemCPUUsage) } func calculateLoad(value uint64) float64 { return float64(value) / float64(1000000000) } <|start_filename|>vendor/github.com/elastic/beats/libbeat/outputs/elasticsearch/output_test.go<|end_filename|> // +build integration package elasticsearch import ( "fmt" "os" "strconv" "testing" "time" "github.com/elastic/beats/libbeat/common" "github.com/elastic/beats/libbeat/logp" "github.com/elastic/beats/libbeat/outputs" ) var testOptions = outputs.Options{} func createElasticsearchConnection(flushInterval int, bulkSize int) *elasticsearchOutput { index := fmt.Sprintf("packetbeat-int-test-%d", os.Getpid()) esPort, err := strconv.Atoi(GetEsPort()) if err != nil { logp.Err("Invalid port. Cannot be converted to in: %s", GetEsPort()) } config, _ := common.NewConfigFrom(map[string]interface{}{ "save_topology": true, "hosts": []string{GetEsHost()}, "port": esPort, "username": os.Getenv("ES_USER"), "password": os.Getenv("ES_PASS"), "path": "", "index": fmt.Sprintf("%v-%%{+yyyy.MM.dd}", index), "protocol": "http", "flush_interval": flushInterval, "bulk_max_size": bulkSize, "template.enabled": false, }) output := &elasticsearchOutput{beatName: "test"} output.init(config, 10) return output } func TestTopologyInES(t *testing.T) { if testing.Verbose() { logp.LogInit(logp.LOG_DEBUG, "", false, true, []string{"*"}) } elasticsearchOutput1 := createElasticsearchConnection(0, 0) elasticsearchOutput2 := createElasticsearchConnection(0, 0) elasticsearchOutput3 := createElasticsearchConnection(0, 0) elasticsearchOutput1.PublishIPs("proxy1", []string{"10.1.0.4"}) elasticsearchOutput2.PublishIPs("proxy2", []string{"10.1.0.9", "fe80::4e8d:79ff:fef2:de6a"}) elasticsearchOutput3.PublishIPs("proxy3", []string{"10.1.0.10"}) name2 := elasticsearchOutput3.GetNameByIP("10.1.0.9") if name2 != "proxy2" { t.Errorf("Failed to update proxy2 in topology: name=%s", name2) } elasticsearchOutput1.PublishIPs("proxy1", []string{"10.1.0.4"}) elasticsearchOutput2.PublishIPs("proxy2", []string{"10.1.0.9"}) elasticsearchOutput3.PublishIPs("proxy3", []string{"192.168.1.2"}) name3 := elasticsearchOutput3.GetNameByIP("192.168.1.2") if name3 != "proxy3" { t.Errorf("Failed to add a new IP") } name3 = elasticsearchOutput3.GetNameByIP("10.1.0.10") if name3 != "" { t.Errorf("Failed to delete old IP of proxy3: %s", name3) } name2 = elasticsearchOutput3.GetNameByIP("fe80::4e8d:79ff:fef2:de6a") if name2 != "" { t.Errorf("Failed to delete old IP of proxy2: %s", name2) } } func TestOneEvent(t *testing.T) { if testing.Verbose() { logp.LogInit(logp.LOG_DEBUG, "", false, true, []string{"elasticsearch", "output_elasticsearch"}) } ts := time.Now() output := createElasticsearchConnection(0, 0) event := common.MapStr{} event["@timestamp"] = common.Time(ts) event["type"] = "redis" event["status"] = "OK" event["responsetime"] = 34 event["dst_ip"] = "192.168.21.1" event["dst_port"] = 6379 event["src_ip"] = "192.168.22.2" event["src_port"] = 6378 event["name"] = "appserver1" r := common.MapStr{} r["request"] = "MGET key1" r["response"] = "value1" index, _ := output.index.Select(event) debugf("index = %s", index) client := output.randomClient() client.CreateIndex(index, common.MapStr{ "settings": common.MapStr{ "number_of_shards": 1, "number_of_replicas": 0, }, }) err := output.PublishEvent(nil, testOptions, outputs.Data{Event: event}) if err != nil { t.Errorf("Failed to publish the event: %s", err) } // give control to the other goroutine, otherwise the refresh happens // before the refresh. We should find a better solution for this. time.Sleep(200 * time.Millisecond) _, _, err = client.Refresh(index) if err != nil { t.Errorf("Failed to refresh: %s", err) } defer func() { _, _, err = client.Delete(index, "", "", nil) if err != nil { t.Errorf("Failed to delete index: %s", err) } }() params := map[string]string{ "q": "name:appserver1", } _, resp, err := client.SearchURI(index, "", params) if err != nil { t.Errorf("Failed to query elasticsearch for index(%s): %s", index, err) return } debugf("resp = %s", resp) if resp.Hits.Total != 1 { t.Errorf("Wrong number of results: %d", resp.Hits.Total) } } func TestEvents(t *testing.T) { if testing.Verbose() { logp.LogInit(logp.LOG_DEBUG, "", false, true, []string{"topology", "output_elasticsearch"}) } ts := time.Now() output := createElasticsearchConnection(0, 0) event := common.MapStr{} event["@timestamp"] = common.Time(ts) event["type"] = "redis" event["status"] = "OK" event["responsetime"] = 34 event["dst_ip"] = "192.168.21.1" event["dst_port"] = 6379 event["src_ip"] = "192.168.22.2" event["src_port"] = 6378 event["name"] = "appserver1" r := common.MapStr{} r["request"] = "MGET key1" r["response"] = "value1" event["redis"] = r index, _ := output.index.Select(event) output.randomClient().CreateIndex(index, common.MapStr{ "settings": common.MapStr{ "number_of_shards": 1, "number_of_replicas": 0, }, }) err := output.PublishEvent(nil, testOptions, outputs.Data{Event: event}) if err != nil { t.Errorf("Failed to publish the event: %s", err) } r = common.MapStr{} r["request"] = "MSET key1 value1" r["response"] = 0 event["redis"] = r err = output.PublishEvent(nil, testOptions, outputs.Data{Event: event}) if err != nil { t.Errorf("Failed to publish the event: %s", err) } // give control to the other goroutine, otherwise the refresh happens // before the refresh. We should find a better solution for this. time.Sleep(200 * time.Millisecond) output.randomClient().Refresh(index) params := map[string]string{ "q": "name:appserver1", } defer func() { _, _, err = output.randomClient().Delete(index, "", "", nil) if err != nil { t.Errorf("Failed to delete index: %s", err) } }() _, resp, err := output.randomClient().SearchURI(index, "", params) if err != nil { t.Errorf("Failed to query elasticsearch: %s", err) } if resp.Hits.Total != 2 { t.Errorf("Wrong number of results: %d", resp.Hits.Total) } } func testBulkWithParams(t *testing.T, output *elasticsearchOutput) { ts := time.Now() index, _ := output.index.Select(common.MapStr{ "@timestamp": common.Time(ts), }) output.randomClient().CreateIndex(index, common.MapStr{ "settings": common.MapStr{ "number_of_shards": 1, "number_of_replicas": 0, }, }) for i := 0; i < 10; i++ { event := common.MapStr{} event["@timestamp"] = common.Time(time.Now()) event["type"] = "redis" event["status"] = "OK" event["responsetime"] = 34 event["dst_ip"] = "192.168.21.1" event["dst_port"] = 6379 event["src_ip"] = "192.168.22.2" event["src_port"] = 6378 event["shipper"] = "appserver" + strconv.Itoa(i) r := common.MapStr{} r["request"] = "MGET key" + strconv.Itoa(i) r["response"] = "value" + strconv.Itoa(i) event["redis"] = r err := output.PublishEvent(nil, testOptions, outputs.Data{Event: event}) if err != nil { t.Errorf("Failed to publish the event: %s", err) } } // give control to the other goroutine, otherwise the refresh happens // before the index. We should find a better solution for this. time.Sleep(200 * time.Millisecond) output.randomClient().Refresh(index) params := map[string]string{ "q": "type:redis", } defer func() { _, _, err := output.randomClient().Delete(index, "", "", nil) if err != nil { t.Errorf("Failed to delete index: %s", err) } }() _, resp, err := output.randomClient().SearchURI(index, "", params) if err != nil { t.Errorf("Failed to query elasticsearch: %s", err) return } if resp.Hits.Total != 10 { t.Errorf("Wrong number of results: %d", resp.Hits.Total) } } func TestBulkEvents(t *testing.T) { if testing.Verbose() { logp.LogInit(logp.LOG_DEBUG, "", false, true, []string{"topology", "output_elasticsearch", "elasticsearch"}) } testBulkWithParams(t, createElasticsearchConnection(50, 2)) testBulkWithParams(t, createElasticsearchConnection(50, 1000)) testBulkWithParams(t, createElasticsearchConnection(50, 5)) } <|start_filename|>vendor/github.com/elastic/beats/metricbeat/module/mongodb/testing.go<|end_filename|> package mongodb import "os" // Helper functions for testing mongodb metricsets. // GetEnvHost returns the hostname of the Mongodb server to use for testing. // It reads the value from the MONGODB_HOST environment variable and returns // 127.0.0.1 if it is not set. func GetEnvHost() string { host := os.Getenv("MONGODB_HOST") if len(host) == 0 { host = "127.0.0.1" } return host } // GetMongodbEnvPort returns the port of the Mongodb server to use for testing. // It reads the value from the MONGODB_PORT environment variable and returns // 27017 if it is not set. func GetEnvPort() string { port := os.Getenv("MONGODB_PORT") if len(port) == 0 { port = "27017" } return port } <|start_filename|>vendor/github.com/elastic/beats/libbeat/outputs/outputs.go<|end_filename|> package outputs import ( "github.com/elastic/beats/libbeat/common" "github.com/elastic/beats/libbeat/common/op" "github.com/elastic/beats/libbeat/logp" ) type Options struct { Guaranteed bool } // Data contains the Event and additional values shared/populated by outputs // to share state internally in output plugins for example between retries. // // Values of type Data are pushed by value inside the publisher chain up to the // outputs. If multiple outputs are configured, each will receive a copy of Data // elemets. type Data struct { // Holds the beats published event and MUST be used read-only manner only in // output plugins. Event common.MapStr // `Values` can be used to store additional context-dependent metadata // within Data. With `Data` being copied to each output, it is safe to update // `Data.Values` itself in outputs, but access to actually stored values must // be thread-safe: read-only if key might be shared or read/write if value key // is local to output plugin. Values *Values } type Outputer interface { // Publish event PublishEvent(sig op.Signaler, opts Options, data Data) error Close() error } type TopologyOutputer interface { // Register the agent name and its IPs to the topology map PublishIPs(name string, localAddrs []string) error // Get the agent name with a specific IP from the topology map GetNameByIP(ip string) string } // BulkOutputer adds BulkPublish to publish batches of events without looping. // Outputers still might loop on events or use more efficient bulk-apis if present. type BulkOutputer interface { Outputer BulkPublish(sig op.Signaler, opts Options, data []Data) error } // Create and initialize the output plugin type OutputBuilder func(beatName string, config *common.Config, topologyExpire int) (Outputer, error) // Functions to be exported by a output plugin type OutputInterface interface { Outputer TopologyOutputer } type OutputPlugin struct { Name string Config *common.Config Output Outputer } type bulkOutputAdapter struct { Outputer } var outputsPlugins = make(map[string]OutputBuilder) func RegisterOutputPlugin(name string, builder OutputBuilder) { outputsPlugins[name] = builder } func FindOutputPlugin(name string) OutputBuilder { return outputsPlugins[name] } func InitOutputs( beatName string, configs map[string]*common.Config, topologyExpire int, ) ([]OutputPlugin, error) { var plugins []OutputPlugin for name, plugin := range outputsPlugins { config, exists := configs[name] if !exists { continue } if !config.Enabled() { continue } output, err := plugin(beatName, config, topologyExpire) if err != nil { logp.Err("failed to initialize %s plugin as output: %s", name, err) return nil, err } plugin := OutputPlugin{Name: name, Config: config, Output: output} plugins = append(plugins, plugin) logp.Info("Activated %s as output plugin.", name) } return plugins, nil } // CastBulkOutputer casts out into a BulkOutputer if out implements // the BulkOutputer interface. If out does not implement the interface an outputer // wrapper implementing the BulkOutputer interface is returned. func CastBulkOutputer(out Outputer) BulkOutputer { if bo, ok := out.(BulkOutputer); ok { return bo } return &bulkOutputAdapter{out} } func (b *bulkOutputAdapter) BulkPublish( signal op.Signaler, opts Options, data []Data, ) error { signal = op.SplitSignaler(signal, len(data)) for _, d := range data { err := b.PublishEvent(signal, opts, d) if err != nil { return err } } return nil } func (d *Data) AddValue(key, value interface{}) { d.Values = d.Values.Append(key, value) } <|start_filename|>vendor/github.com/elastic/beats/filebeat/harvester/reader/json.go<|end_filename|> package reader import ( "bytes" "encoding/json" "fmt" "github.com/elastic/beats/libbeat/common" "github.com/elastic/beats/libbeat/common/jsontransform" "github.com/elastic/beats/libbeat/logp" ) const ( JsonErrorKey = "json_error" ) type JSON struct { reader Reader cfg *JSONConfig } // NewJSONReader creates a new reader that can decode JSON. func NewJSON(r Reader, cfg *JSONConfig) *JSON { return &JSON{reader: r, cfg: cfg} } // decodeJSON unmarshals the text parameter into a MapStr and // returns the new text column if one was requested. func (r *JSON) decodeJSON(text []byte) ([]byte, common.MapStr) { var jsonFields map[string]interface{} err := unmarshal(text, &jsonFields) if err != nil { logp.Err("Error decoding JSON: %v", err) if r.cfg.AddErrorKey { jsonFields = common.MapStr{JsonErrorKey: fmt.Sprintf("Error decoding JSON: %v", err)} } return text, jsonFields } if len(r.cfg.MessageKey) == 0 { return []byte(""), jsonFields } textValue, ok := jsonFields[r.cfg.MessageKey] if !ok { if r.cfg.AddErrorKey { jsonFields[JsonErrorKey] = fmt.Sprintf("Key '%s' not found", r.cfg.MessageKey) } return []byte(""), jsonFields } textString, ok := textValue.(string) if !ok { if r.cfg.AddErrorKey { jsonFields[JsonErrorKey] = fmt.Sprintf("Value of key '%s' is not a string", r.cfg.MessageKey) } return []byte(""), jsonFields } return []byte(textString), jsonFields } // unmarshal is equivalent with json.Unmarshal but it converts numbers // to int64 where possible, instead of using always float64. func unmarshal(text []byte, fields *map[string]interface{}) error { dec := json.NewDecoder(bytes.NewReader(text)) dec.UseNumber() err := dec.Decode(fields) if err != nil { return err } jsontransform.TransformNumbers(*fields) return nil } // Next decodes JSON and returns the filled Line object. func (r *JSON) Next() (Message, error) { message, err := r.reader.Next() if err != nil { return message, err } var fields common.MapStr message.Content, fields = r.decodeJSON(message.Content) message.AddFields(common.MapStr{"json": fields}) return message, nil } <|start_filename|>vendor/github.com/elastic/beats/filebeat/input/file/file_other.go<|end_filename|> // +build !windows package file import ( "os" "syscall" "github.com/elastic/beats/libbeat/logp" ) type StateOS struct { Inode uint64 `json:"inode,"` Device uint64 `json:"device,"` } // GetOSState returns the FileStateOS for non windows systems func GetOSState(info os.FileInfo) StateOS { stat := info.Sys().(*syscall.Stat_t) // Convert inode and dev to uint64 to be cross platform compatible fileState := StateOS{ Inode: uint64(stat.Ino), Device: uint64(stat.Dev), } return fileState } // IsSame file checks if the files are identical func (fs StateOS) IsSame(state StateOS) bool { return fs.Inode == state.Inode && fs.Device == state.Device } // SafeFileRotate safely rotates an existing file under path and replaces it with the tempfile func SafeFileRotate(path, tempfile string) error { if e := os.Rename(tempfile, path); e != nil { logp.Err("Rotate error: %s", e) return e } return nil } // ReadOpen opens a file for reading only func ReadOpen(path string) (*os.File, error) { flag := os.O_RDONLY perm := os.FileMode(0) return os.OpenFile(path, flag, perm) } <|start_filename|>vendor/github.com/elastic/beats/filebeat/prospector/prospector_test.go<|end_filename|> // +build !integration package prospector import ( "regexp" "testing" "github.com/elastic/beats/filebeat/input/file" "github.com/stretchr/testify/assert" ) func TestProspectorInitInputTypeLogError(t *testing.T) { prospector := Prospector{ config: prospectorConfig{}, } states := file.NewStates() states.SetStates([]file.State{}) err := prospector.Init(*states) // Error should be returned because no path is set assert.Error(t, err) } func TestProspectorFileExclude(t *testing.T) { prospector := Prospector{ config: prospectorConfig{ ExcludeFiles: []*regexp.Regexp{regexp.MustCompile(`\.gz$`)}, }, } p, err := NewProspectorLog(&prospector) assert.NoError(t, err) assert.True(t, p.isFileExcluded("/tmp/log/logw.gz")) assert.False(t, p.isFileExcluded("/tmp/log/logw.log")) } <|start_filename|>vendor/github.com/elastic/beats/metricbeat/module/haproxy/info/info.go<|end_filename|> package info import ( "github.com/elastic/beats/libbeat/common" "github.com/elastic/beats/libbeat/logp" "github.com/elastic/beats/metricbeat/mb" "github.com/elastic/beats/metricbeat/module/haproxy" "github.com/pkg/errors" ) const ( statsMethod = "info" ) var ( debugf = logp.MakeDebug("haproxy-info") ) // init registers the haproxy info MetricSet. func init() { if err := mb.Registry.AddMetricSet("haproxy", "info", New, haproxy.HostParser); err != nil { panic(err) } } // MetricSet for haproxy info. type MetricSet struct { mb.BaseMetricSet } // New creates a haproxy info MetricSet. func New(base mb.BaseMetricSet) (mb.MetricSet, error) { logp.Warn("EXPERIMENTAL: The %v %v metricset is experimental", base.Module().Name(), base.Name()) return &MetricSet{BaseMetricSet: base}, nil } // Fetch fetches info stats from the haproxy service. func (m *MetricSet) Fetch() (common.MapStr, error) { // haproxy doesn't accept a username or password so ignore them if they // are in the URL. hapc, err := haproxy.NewHaproxyClient(m.HostData().SanitizedURI) if err != nil { return nil, errors.Wrap(err, "failed creating haproxy client") } res, err := hapc.GetInfo() if err != nil { return nil, errors.Wrap(err, "failed fetching haproxy info") } return eventMapping(res) } <|start_filename|>vendor/github.com/elastic/beats/vendor/github.com/elastic/gosigar/sys/linux/sysconf_nocgo.go<|end_filename|> // +build !cgo !linux package linux func GetClockTicks() int { return 100 } <|start_filename|>vendor/github.com/elastic/beats/metricbeat/module/mongodb/mongodb.go<|end_filename|> package mongodb import ( "fmt" "net/url" "strings" "github.com/elastic/beats/metricbeat/mb" "github.com/elastic/beats/metricbeat/mb/parse" mgo "gopkg.in/mgo.v2" ) func init() { // Register the ModuleFactory function for the "mongodb" module. if err := mb.Registry.AddModule("mongodb", NewModule); err != nil { panic(err) } } func NewModule(base mb.BaseModule) (mb.Module, error) { // Validate that at least one host has been specified. config := struct { Hosts []string `config:"hosts" validate:"nonzero,required"` }{} if err := base.UnpackConfig(&config); err != nil { return nil, err } return &base, nil } func ParseURL(module mb.Module, host string) (mb.HostData, error) { c := struct { Username string `config:"username"` Password string `config:"password"` }{} if err := module.UnpackConfig(&c); err != nil { return mb.HostData{}, err } if parts := strings.SplitN(host, "://", 2); len(parts) != 2 { // Add scheme. host = fmt.Sprintf("mongodb://%s", host) } // This doesn't use URLHostParserBuilder because MongoDB URLs can contain // multiple hosts separated by commas (mongodb://host1,host2,host3?options). u, err := url.Parse(host) if err != nil { return mb.HostData{}, fmt.Errorf("error parsing URL: %v", err) } parse.SetURLUser(u, c.Username, c.Password) // https://docs.mongodb.com/manual/reference/connection-string/ _, err = mgo.ParseURL(u.String()) if err != nil { return mb.HostData{}, err } return parse.NewHostDataFromURL(u), nil } <|start_filename|>vendor/github.com/elastic/beats/metricbeat/module/mongodb/status/status.go<|end_filename|> package status import ( "github.com/elastic/beats/libbeat/common" "github.com/elastic/beats/libbeat/logp" "github.com/elastic/beats/metricbeat/mb" "github.com/elastic/beats/metricbeat/module/mongodb" "github.com/pkg/errors" "gopkg.in/mgo.v2" "gopkg.in/mgo.v2/bson" ) /* TODOs: * add metricset for "locks" data * add a metricset for "metrics" data */ var debugf = logp.MakeDebug("mongodb.status") func init() { if err := mb.Registry.AddMetricSet("mongodb", "status", New, mongodb.ParseURL); err != nil { panic(err) } } type MetricSet struct { mb.BaseMetricSet dialInfo *mgo.DialInfo } func New(base mb.BaseMetricSet) (mb.MetricSet, error) { dialInfo, err := mgo.ParseURL(base.HostData().URI) if err != nil { return nil, err } dialInfo.Timeout = base.Module().Config().Timeout return &MetricSet{ BaseMetricSet: base, dialInfo: dialInfo, }, nil } func (m *MetricSet) Fetch() (common.MapStr, error) { session, err := mgo.DialWithInfo(m.dialInfo) if err != nil { return nil, err } defer session.Close() session.SetMode(mgo.Monotonic, true) result := map[string]interface{}{} if err := session.DB("admin").Run(bson.D{{"serverStatus", 1}}, &result); err != nil { return nil, errors.Wrap(err, "mongodb fetch failed") } return eventMapping(result), nil } <|start_filename|>vendor/github.com/elastic/beats/vendor/github.com/elastic/gosigar/sys/linux/sysconf_cgo.go<|end_filename|> // +build linux,cgo package linux /* #include <unistd.h> */ import "C" func GetClockTicks() int { return int(C.sysconf(C._SC_CLK_TCK)) } <|start_filename|>vendor/github.com/elastic/beats/libbeat/common/geolite.go<|end_filename|> package common import ( "os" "path/filepath" "github.com/elastic/beats/libbeat/logp" "github.com/nranchev/go-libGeoIP" ) // Geoip represents a string slice of GeoIP paths type Geoip struct { Paths *[]string } func LoadGeoIPData(config Geoip) *libgeo.GeoIP { geoipPaths := []string{} if config.Paths != nil { geoipPaths = *config.Paths } if len(geoipPaths) == 0 { // disabled return nil } logp.Warn("GeoIP lookup support is deprecated and will be removed in version 6.0.") // look for the first existing path var geoipPath string for _, path := range geoipPaths { fi, err := os.Lstat(path) if err != nil { logp.Err("GeoIP path could not be loaded: %s", path) continue } if fi.Mode()&os.ModeSymlink == os.ModeSymlink { // follow symlink geoipPath, err = filepath.EvalSymlinks(path) if err != nil { logp.Warn("Could not load GeoIP data: %s", err.Error()) return nil } } else { geoipPath = path } break } if len(geoipPath) == 0 { logp.Warn("Couldn't load GeoIP database") return nil } geoLite, err := libgeo.Load(geoipPath) if err != nil { logp.Warn("Could not load GeoIP data: %s", err.Error()) } logp.Info("Loaded GeoIP data from: %s", geoipPath) return geoLite } <|start_filename|>vendor/github.com/elastic/beats/metricbeat/module/system/_meta/kibana/dashboard/Metricbeat-processes.json<|end_filename|> { "hits": 0, "timeRestore": false, "description": "", "title": "Metricbeat-processes", "uiStateJSON": "{\"P-1\":{\"vis\":{\"params\":{\"sort\":{\"columnIndex\":null,\"direction\":null}}}},\"P-4\":{\"vis\":{\"params\":{\"sort\":{\"columnIndex\":null,\"direction\":null}}}}}", "panelsJSON": "[{\"col\":1,\"id\":\"System-Navigation\",\"panelIndex\":5,\"row\":1,\"size_x\":3,\"size_y\":3,\"type\":\"visualization\"},{\"col\":1,\"id\":\"Number-of-processes\",\"panelIndex\":7,\"row\":4,\"size_x\":3,\"size_y\":3,\"type\":\"visualization\"},{\"col\":4,\"id\":\"Process-state-by-host\",\"panelIndex\":9,\"row\":1,\"size_x\":5,\"size_y\":3,\"type\":\"visualization\"},{\"col\":9,\"id\":\"Number-of-processes-by-host\",\"panelIndex\":8,\"row\":1,\"size_x\":4,\"size_y\":3,\"type\":\"visualization\"},{\"col\":1,\"id\":\"CPU-usage-per-process\",\"panelIndex\":2,\"row\":7,\"size_x\":6,\"size_y\":8,\"type\":\"visualization\"},{\"col\":7,\"id\":\"Memory-usage-per-process\",\"panelIndex\":3,\"row\":7,\"size_x\":6,\"size_y\":8,\"type\":\"visualization\"},{\"col\":1,\"id\":\"Top-processes-by-memory-usage\",\"panelIndex\":1,\"row\":15,\"size_x\":6,\"size_y\":11,\"type\":\"visualization\"},{\"col\":7,\"id\":\"Top-processes-by-CPU-usage\",\"panelIndex\":4,\"row\":15,\"size_x\":6,\"size_y\":11,\"type\":\"visualization\"},{\"id\":\"Number-of-processes-over-time\",\"type\":\"visualization\",\"panelIndex\":10,\"size_x\":9,\"size_y\":3,\"col\":4,\"row\":4}]", "optionsJSON": "{\"darkTheme\":false}", "version": 1, "kibanaSavedObjectMeta": { "searchSourceJSON": "{\"filter\":[{\"query\":{\"query_string\":{\"analyze_wildcard\":true,\"query\":\"*\"}}}]}" } } <|start_filename|>vendor/github.com/elastic/beats/metricbeat/module/nginx/stubstatus/stubstatus.go<|end_filename|> // Package stubstatus reads server status from nginx host under /server-status, ngx_http_stub_status_module is required. package stubstatus import ( "fmt" "net/http" "github.com/elastic/beats/libbeat/common" "github.com/elastic/beats/libbeat/logp" "github.com/elastic/beats/metricbeat/mb" "github.com/elastic/beats/metricbeat/mb/parse" ) const ( // defaultScheme is the default scheme to use when it is not specified in // the host config. defaultScheme = "http" // defaultPath is the default path to the ngx_http_stub_status_module endpoint on Nginx. defaultPath = "/server-status" ) var ( debugf = logp.MakeDebug("nginx-status") hostParser = parse.URLHostParserBuilder{ DefaultScheme: defaultScheme, PathConfigKey: "server_status_path", DefaultPath: defaultPath, }.Build() ) func init() { if err := mb.Registry.AddMetricSet("nginx", "stubstatus", New, hostParser); err != nil { panic(err) } } // MetricSet for fetching Nginx stub status. type MetricSet struct { mb.BaseMetricSet client *http.Client // HTTP client that is reused across requests. previousNumRequests int // Total number of requests as returned in the previous fetch. } // New creates new instance of MetricSet func New(base mb.BaseMetricSet) (mb.MetricSet, error) { return &MetricSet{ BaseMetricSet: base, client: &http.Client{Timeout: base.Module().Config().Timeout}, }, nil } // Fetch makes an HTTP request to fetch status metrics from the stubstatus endpoint. func (m *MetricSet) Fetch() (common.MapStr, error) { req, err := http.NewRequest("GET", m.HostData().SanitizedURI, nil) if m.HostData().User != "" || m.HostData().Password != "" { req.SetBasicAuth(m.HostData().User, m.HostData().Password) } resp, err := m.client.Do(req) if err != nil { return nil, fmt.Errorf("error making http request: %v", err) } defer resp.Body.Close() if resp.StatusCode != 200 { return nil, fmt.Errorf("HTTP error %d: %s", resp.StatusCode, resp.Status) } return eventMapping(m, resp.Body, m.Host(), m.Name()) } <|start_filename|>vendor/github.com/elastic/beats/filebeat/prospector/prospector_log_windows_test.go<|end_filename|> // +build windows package prospector import ( "regexp" "testing" "github.com/stretchr/testify/assert" ) var matchTestsWindows = []struct { file string paths []string excludeFiles []*regexp.Regexp result bool }{ { "C:\\\\hello\\test\\test.log", // Path are always in windows format []string{"C:\\\\hello/test/*.log"}, // Globs can also be with forward slashes nil, true, }, { "C:\\\\hello\\test\\test.log", // Path are always in windows format []string{"C:\\\\hello\\test/*.log"}, // Globs can also be mixed nil, true, }, } // TestMatchFileWindows test if match works correctly on windows // Separate test are needed on windows because of automated path conversion func TestMatchFileWindows(t *testing.T) { for _, test := range matchTestsWindows { p := ProspectorLog{ config: prospectorConfig{ Paths: test.paths, ExcludeFiles: test.excludeFiles, }, } assert.Equal(t, test.result, p.matchesFile(test.file)) } } <|start_filename|>vendor/github.com/elastic/beats/metricbeat/module/system/cpu/helper_test.go<|end_filename|> // +build !integration // +build darwin freebsd linux openbsd windows package cpu import ( "testing" "github.com/elastic/gosigar" "github.com/stretchr/testify/assert" ) func TestGetCpuTimes(t *testing.T) { stat, err := GetCpuTimes() assert.NotNil(t, stat) assert.Nil(t, err) assert.True(t, (stat.User > 0)) assert.True(t, (stat.Sys > 0)) } func TestCpuPercentage(t *testing.T) { cpu := CPU{} cpu1 := CpuTimes{ Cpu: gosigar.Cpu{ User: 10855311, Nice: 0, Sys: 2021040, Idle: 17657874, Wait: 0, Irq: 0, SoftIrq: 0, Stolen: 0, }, } cpu.AddCpuPercentage(&cpu1) assert.Equal(t, cpu1.UserPercent, 0.0) assert.Equal(t, cpu1.SystemPercent, 0.0) cpu2 := CpuTimes{ Cpu: gosigar.Cpu{ User: 10855693, Nice: 0, Sys: 2021058, Idle: 17657876, Wait: 0, Irq: 0, SoftIrq: 0, Stolen: 0, }, } cpu.AddCpuPercentage(&cpu2) assert.Equal(t, cpu2.UserPercent, 0.9502) assert.Equal(t, cpu2.SystemPercent, 0.0448) } <|start_filename|>vendor/github.com/elastic/beats/metricbeat/module/apache/status/status.go<|end_filename|> // Package status reads Apache HTTPD server status from the mod_status module. package status import ( "fmt" "net/http" "github.com/elastic/beats/libbeat/common" "github.com/elastic/beats/libbeat/logp" "github.com/elastic/beats/metricbeat/mb" "github.com/elastic/beats/metricbeat/mb/parse" ) const ( // defaultScheme is the default scheme to use when it is not specified in // the host config. defaultScheme = "http" // defaultPath is the default path to the mod_status endpoint on the // Apache HTTPD server. defaultPath = "/server-status" // autoQueryParam is a query parameter added to the request so that // mod_status returns machine-readable output. autoQueryParam = "auto" ) var ( debugf = logp.MakeDebug("apache-status") hostParser = parse.URLHostParserBuilder{ DefaultScheme: defaultScheme, PathConfigKey: "server_status_path", DefaultPath: defaultPath, QueryParams: autoQueryParam, }.Build() ) func init() { if err := mb.Registry.AddMetricSet("apache", "status", New, hostParser); err != nil { panic(err) } } // MetricSet for fetching Apache HTTPD server status. type MetricSet struct { mb.BaseMetricSet client *http.Client // HTTP client that is reused across requests. } // New creates new instance of MetricSet. func New(base mb.BaseMetricSet) (mb.MetricSet, error) { return &MetricSet{ BaseMetricSet: base, client: &http.Client{Timeout: base.Module().Config().Timeout}, }, nil } // Fetch makes an HTTP request to fetch status metrics from the mod_status // endpoint. func (m *MetricSet) Fetch() (common.MapStr, error) { req, err := http.NewRequest("GET", m.HostData().SanitizedURI, nil) if m.HostData().User != "" || m.HostData().Password != "" { req.SetBasicAuth(m.HostData().User, m.HostData().Password) } resp, err := m.client.Do(req) if err != nil { return nil, fmt.Errorf("error making http request: %v", err) } defer resp.Body.Close() if resp.StatusCode != 200 { return nil, fmt.Errorf("HTTP error %d: %s", resp.StatusCode, resp.Status) } return eventMapping(resp.Body, m.Host()), nil } <|start_filename|>vendor/github.com/elastic/beats/filebeat/prospector/prospector_stdin.go<|end_filename|> package prospector import ( "fmt" "github.com/elastic/beats/filebeat/harvester" "github.com/elastic/beats/filebeat/input/file" "github.com/elastic/beats/libbeat/logp" ) type ProspectorStdin struct { harvester *harvester.Harvester started bool } // NewProspectorStdin creates a new stdin prospector // This prospector contains one harvester which is reading from stdin func NewProspectorStdin(p *Prospector) (*ProspectorStdin, error) { prospectorer := &ProspectorStdin{} var err error prospectorer.harvester, err = p.createHarvester(file.State{Source: "-"}) if err != nil { return nil, fmt.Errorf("Error initializing stdin harvester: %v", err) } return prospectorer, nil } func (p *ProspectorStdin) Init(states file.States) error { p.started = false return nil } func (p *ProspectorStdin) Run() { // Make sure stdin harvester is only started once if !p.started { reader, err := p.harvester.Setup() if err != nil { logp.Err("Error starting stdin harvester: %s", err) return } go p.harvester.Harvest(reader) p.started = true } } <|start_filename|>vendor/github.com/elastic/beats/libbeat/outputs/mode/lb/lb.go<|end_filename|> package lb import ( "sync" "time" "github.com/elastic/beats/libbeat/common/op" "github.com/elastic/beats/libbeat/logp" "github.com/elastic/beats/libbeat/outputs" "github.com/elastic/beats/libbeat/outputs/mode" ) // LB balances the sending of events between multiple connections. // // The balancing algorithm is mostly pull-based, with multiple workers trying to pull // some amount of work from a shared queue. Workers will try to get a new work item // only if they have a working/active connection. Workers without active connection // do not participate until a connection has been re-established. // Due to the pull based nature the algorithm will load-balance events by random // with workers having less latencies/turn-around times potentially getting more // work items then other workers with higher latencies. Thusly the algorithm // dynamically adapts to resource availability of server events are forwarded to. // // Workers not participating in the load-balancing will continuously try to reconnect // to their configured endpoints. Once a new connection has been established, // these workers will participate in in load-balancing again. // // If a connection becomes unavailable, the events are rescheduled for another // connection to pick up. Rescheduling events is limited to a maximum number of // send attempts. If events have not been send after maximum number of allowed // attempts has been passed, they will be dropped. // // Like network connections, distributing events to workers is subject to // timeout. If no worker is available to pickup a message for sending, the message // will be dropped internally after max_retries. If mode or message requires // guaranteed send, message is retried infinitely. type LB struct { ctx context // waitGroup + signaling channel for handling shutdown wg sync.WaitGroup } var ( debugf = logp.MakeDebug("output") ) func NewSync( clients []mode.ProtocolClient, maxAttempts int, waitRetry, timeout, maxWaitRetry time.Duration, ) (*LB, error) { return New(SyncClients(clients, waitRetry, maxWaitRetry), maxAttempts, timeout) } func NewAsync( clients []mode.AsyncProtocolClient, maxAttempts int, waitRetry, timeout, maxWaitRetry time.Duration, ) (*LB, error) { return New(AsyncClients(clients, waitRetry, maxWaitRetry), maxAttempts, timeout) } // New create a new load balancer connection mode. func New( makeWorkers WorkerFactory, maxAttempts int, timeout time.Duration, ) (*LB, error) { debugf("configure maxattempts: %v", maxAttempts) // maxAttempts signals infinite retry. Convert to -1, so attempts left and // and infinite retry can be more easily distinguished by load balancer if maxAttempts == 0 { maxAttempts = -1 } m := &LB{ ctx: makeContext(makeWorkers.count(), maxAttempts, timeout), } if err := m.start(makeWorkers); err != nil { return nil, err } return m, nil } // Close stops all workers and closes all open connections. In flight events // are signaled as failed. func (m *LB) Close() error { m.ctx.Close() m.wg.Wait() return nil } func (m *LB) start(makeWorkers WorkerFactory) error { var waitStart sync.WaitGroup run := func(w worker) { defer m.wg.Done() waitStart.Done() w.run() } workers, err := makeWorkers.mk(m.ctx) if err != nil { return err } for _, w := range workers { m.wg.Add(1) waitStart.Add(1) go run(w) } waitStart.Wait() return nil } // PublishEvent forwards the event to some load balancing worker. func (m *LB) PublishEvent( signaler op.Signaler, opts outputs.Options, data outputs.Data, ) error { return m.publishEventsMessage(opts, eventsMessage{ worker: -1, signaler: signaler, datum: data, }) } // PublishEvents forwards events to some load balancing worker. func (m *LB) PublishEvents( signaler op.Signaler, opts outputs.Options, data []outputs.Data, ) error { return m.publishEventsMessage(opts, eventsMessage{ worker: -1, signaler: signaler, data: data, }) } func (m *LB) publishEventsMessage(opts outputs.Options, msg eventsMessage) error { m.ctx.pushEvents(msg, opts.Guaranteed) return nil } <|start_filename|>vendor/github.com/elastic/beats/metricbeat/module/system/diskio/doc.go<|end_filename|> /* Package diskio fetches disk IO metrics from the OS. It is implemented for freebsd, linux, and windows. Detailed descriptions of IO stats provided by Linux can be found here: https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/plain/Documentation/iostats.txt?id=refs/tags/v4.6-rc7 */ package diskio
andreiburuntia/cbeat
<|start_filename|>feedcrawler/web/js/feedcrawler.js<|end_filename|> let app = angular.module('crwlApp', []); app.filter('startFrom', function () { return function (input, start) { if (typeof input !== 'undefined') { if (typeof input == 'object') { input = Object.values(input); start = +start; //parse to int return input.slice(start); } else { start = +start; //parse to int return input.slice(start); } } } }); app.filter('secondsToHHmmss', function ($filter) { return function (seconds) { return $filter('date')(new Date(0, 0, 0).setSeconds(seconds), 'HH:mm:ss'); }; }) app.controller('crwlCtrl', function ($scope, $http, $timeout) { $(function () { $('[data-toggle="tooltip"]').tooltip() }); $scope.results = []; $scope.currentPage = 0; $scope.pageSize = 10; $scope.resLength = 0; $scope.numberOfPages = function () { if (typeof $scope.results.bl !== 'undefined') { $scope.resLength = Object.values($scope.results.bl).length; return Math.ceil($scope.resLength / $scope.pageSize); } }; $scope.currentPageLog = 0; $scope.pageSizeLog = 5; $scope.resLengthLog = 0; $scope.numberOfPagesLog = function () { if (typeof $scope.log !== 'undefined') { $scope.resLengthLog = $scope.log.length; let numPagesLog = Math.ceil($scope.resLengthLog / $scope.pageSizeLog); if (($scope.currentPageLog > 0) && (($scope.currentPageLog + 1) > numPagesLog)) { $scope.currentPageLog = numPagesLog - 1; } return numPagesLog; } }; $scope.currentPageMyJD = 0; $scope.pageSizeMyJD = 3; $scope.resLengthMyJD = 0; $scope.numberOfPagesMyJD = function () { if (typeof $scope.myjd_packages !== 'undefined') { $scope.resLengthMyJD = $scope.myjd_packages.length; let numPagesMyJD = Math.ceil($scope.resLengthMyJD / $scope.pageSizeMyJD); if (($scope.currentPageMyJD > 0) && (($scope.currentPageMyJD + 1) > numPagesMyJD)) { $scope.currentPageMyJD = numPagesMyJD - 1; } return numPagesMyJD; } }; $scope.helper_active = false; $scope.helper_available = false; $scope.hostnames = { sj: 'Nicht gesetzt!', dj: 'Nicht gesetzt!', sf: 'Nicht gesetzt!', by: 'Nicht gesetzt!', dw: 'Nicht gesetzt!', fx: 'Nicht gesetzt!', nk: 'Nicht gesetzt!', ww: 'Nicht gesetzt!', bl: 'Nicht gesetzt!', s: 'Nicht gesetzt!', sjbl: 'Nicht gesetzt!' }; $scope.sjbl_enabled = false; $scope.mb_search = [ {value: '1', label: '1 Seite'}, {value: '3', label: '3 Seiten'}, {value: '5', label: '5 Seiten'}, {value: '10', label: '10 Seiten'}, {value: '15', label: '15 Seiten'}, {value: '30', label: '30 Seiten'} ]; $scope.resolutions = [ {value: '480p', label: '480p (SD)'}, {value: '720p', label: '720p (HD)'}, {value: '1080p', label: '1080p (Full-HD)'}, {value: '2160p', label: '2160p (4K)'} ]; $scope.sources = [ {value: 'hdtv|hdtvrip|tvrip', label: 'HDTV'}, {value: 'web|web-dl|webrip|webhd|netflix*|amazon*|itunes*', label: 'WEB'}, {value: 'hdtv|hdtvrip|tvrip|web|web-dl|webrip|webhd|netflix*|amazon*|itunes*', label: 'HDTV/WEB'}, {value: 'bluray|bd|bdrip', label: 'BluRay'}, {value: 'web|web-dl|webrip|webhd|netflix*|amazon*|itunes*|bluray|bd|bdrip', label: 'Web/BluRay'}, { value: 'hdtv|hdtvrip|tvrip|web|web-dl|webrip|webhd|netflix*|amazon*|itunes*|bluray|bd|bdrip', label: 'HDTV/WEB/BluRay' }, { value: 'web.*-(tvs|4sj|tvr)|web-dl.*-(tvs|4sj|tvr)|webrip.*-(tvs|4sj|tvr)|webhd.*-(tvs|4sj|tvr)|netflix.*-(tvs|4sj|tvr)|amazon.*-(tvs|4sj|tvr)|itunes.*-(tvs|4sj|tvr)|bluray|bd|bdrip', label: 'BluRay/WebRetail (TVS/4SJ/TvR)' } ]; $scope.crawltimes = false; $scope.site_status = false; $scope.cnl_active = false; $scope.myjd_connection_error = false; $scope.myjd_collapse_manual = false; $scope.searching = false; $scope.starting = false; $scope.myjd_state = false; $scope.myjd_packages = []; $scope.time = 0; $scope.loglength = 65; $scope.longlog = false; $(window).resize(function () { setAccordionWidth(); }); function setAccordionWidth() { $scope.windowWidth = $(window).width(); if ($scope.windowWidth <= 768) { $scope.accordionlength = 45; } else { $scope.accordionlength = 85; } } $scope.longerLog = function () { $scope.loglength = 999; $scope.longlog = true; }; $scope.shorterLog = function () { $scope.loglength = 65; $scope.longlog = false; }; $scope.init = getAll(); $scope.manualCollapse = function () { manualCollapse(); }; $scope.deleteLog = function () { deleteLog(); }; $scope.deleteLogRow = function (row) { deleteLogRow(row); }; $scope.searchNow = function () { searchNow(); }; $scope.downloadBL = function (payload) { downloadBL(payload); }; $scope.downloadSJ = function (payload) { downloadSJ(payload); }; $scope.saveLists = function () { setLists(); }; $scope.saveSettings = function () { setSettings(); }; $scope.myJDupdate = function () { myJDupdate(); }; $scope.myJDstart = function () { myJDstart(); }; $scope.myJDpause = function (bl) { myJDpause(bl); }; $scope.myJDstop = function () { myJDstop(); }; $scope.getMyJDstate = function () { getMyJDstate(); }; $scope.getMyJD = function () { getMyJD(); }; $scope.startNow = function () { startNow(); }; $scope.myJDmove = function (linkids, uuid) { myJDmove(linkids, uuid); }; $scope.myJDremove = function (linkids, uuid) { myJDremove(linkids, uuid); }; $scope.myJDremove = function (linkids, uuid) { myJDremove(linkids, uuid); }; $scope.internalRemove = function (name) { internalRemove(name); }; $scope.myJDretry = function (linkids, uuid, links) { myJDretry(linkids, uuid, links) }; $scope.myJDcnl = function (uuid) { myJDcnl(uuid) }; $scope.internalCnl = function (name, password) { internalCnl(name, password) }; $scope.getLists = function () { getLists(); } $scope.getSettings = function () { getSettings(); } $scope.getBlockedSites = function () { getBlockedSites(); } function getAll() { getHostNames(); getVersion(); getMyJD(); getLog(); getCrawlTimes(); getSettings(); } function countDown(seconds) { if (seconds === 0) { return; } else { seconds--; } $scope.time = seconds; $timeout(function () { countDown(seconds) }, 1000); } function manualCollapse() { $scope.myjd_collapse_manual = true; } function getLog() { $http.get('api/log/') .then(function (res) { $scope.log = res.data.log; console.log('Log abgerufen!'); }, function () { console.log('Konnte Log nicht abrufen!'); showDanger('Konnte Log nicht abrufen!'); }); } function getSettings() { $http.get('api/settings/') .then(function (res) { $scope.settings = res.data.settings; console.log('Einstellungen abgerufen!'); let year = (new Date).getFullYear(); $("#year").attr("max", year); $scope.myjd_connection_error = !($scope.settings.general.myjd_user && $scope.settings.general.myjd_device && $scope.settings.general.myjd_device); $scope.pageSizeMyJD = $scope.settings.general.packages_per_myjd_page; }, function () { console.log('Konnte Einstellungen nicht abrufen!'); showDanger('Konnte Einstellungen nicht abrufen!'); }); } function getLists() { $http.get('api/lists/') .then(function (res) { $scope.lists = res.data.lists; console.log('Listen abgerufen!'); }, function () { console.log('Konnte Listen nicht abrufen!'); showDanger('Konnte Listen nicht abrufen!'); }); } function getCrawlTimes() { $http.get('api/crawltimes/') .then(function (res) { $scope.starting = false; $scope.crawltimes = res.data.crawltimes; console.log('Laufzeiten abgerufen!'); }, function () { console.log('Konnte Laufzeiten nicht abrufen!'); showDanger('Konnte Laufzeiten nicht abrufen!'); }); } function getHostNames() { $http.get('api/hostnames/') .then(function (res) { $scope.hostnames = res.data.hostnames; not_set = 'Nicht gesetzt!' $scope.sjbl_enabled = !(($scope.hostnames.bl === not_set && $scope.hostnames.s !== not_set) || ($scope.hostnames.bl !== not_set && $scope.hostnames.s === not_set)); console.log('Hostnamen abgerufen!'); }, function () { console.log('Konnte Hostnamen nicht abrufen!'); showDanger('Konnte Hostnamen nicht abrufen!'); }); } function getBlockedSites() { $http.get('api/blocked_sites/') .then(function (res) { $scope.site_status = res.data.site_status; console.log('Blockierte Seiten abgerufen!'); }, function () { console.log('Konnte blockierte Seiten nicht abrufen!'); showDanger('Konnte blockierte Seiten nicht abrufen!'); }); } function getVersion() { $http.get('api/version/') .then(function (res) { $scope.version = res.data.version.ver; console.log('Dies ist der FeedCrawler ' + $scope.version + ' von https://github.com/rix1337'); $scope.update = res.data.version.update_ready; $scope.docker = res.data.version.docker; if ($scope.docker) { $(".docker").prop("disabled", true); } $scope.helper_active = res.data.version.helper_active; if ($scope.helper_active) { $.get("http://127.0.0.1:9666/", function (data) { $scope.helper_available = (data === 'JDownloader'); if ($scope.helper_available) { console.log("Click'n'Load des FeedCrawler Sponsors Helper ist verfügbar!"); } }); } let year = (new Date).getFullYear(); $("#year").attr("max", year); if ($scope.update) { scrollingTitle("FeedCrawler - Update verfügbar! - "); console.log('Update steht bereit! Weitere Informationen unter https://github.com/rix1337/FeedCrawler/releases/latest'); showInfo('Update steht bereit! Weitere Informationen unter <a href="https://github.com/rix1337/FeedCrawler/releases/latest" target="_blank">github.com</a>.'); } console.log('Version abgerufen!'); }, function () { console.log('Konnte Version nicht abrufen!'); showDanger('Konnte Version nicht abrufen!'); }); } function setLists() { spinLists(); $http.post('api/lists/', $scope.lists, 'application/json') .then(function () { console.log('Listen gespeichert! Änderungen werden im nächsten Suchlauf berücksichtigt.'); showSuccess('Listen gespeichert! Änderungen werden im nächsten Suchlauf berücksichtigt.'); getLists(); }, function () { console.log('Konnte Listen nicht speichern!'); showDanger('Konnte Listen nicht speichern!'); }); } function setSettings() { spinSettings(); $http.post('api/settings/', $scope.settings, 'application/json') .then(function () { console.log('Einstellungen gespeichert! Neustart wird dringend empfohlen!'); showSuccess('Einstellungen gespeichert! Neustart wird dringend empfohlen!'); getSettings(); }, function () { getSettings(); console.log('Konnte Einstellungen nicht speichern! Eventuelle Hinweise in der Konsole beachten.'); showDanger('Konnte Einstellungen nicht speichern! Eventuelle Hinweise in der Konsole beachten.'); }); } function downloadBL(payload) { showInfoLong("Starte Download..."); $http.post('api/download_bl/' + payload) .then(function () { console.log('Download gestartet!'); showSuccess('Download gestartet!'); getLists(); $(".alert-info").slideUp(500); }, function () { console.log('Konnte Download nicht starten!'); showDanger('Konnte Download nicht starten!'); $(".alert-info").slideUp(500); }); } function downloadSJ(payload) { showInfoLong("Starte Download..."); $http.post('api/download_sj/' + payload) .then(function () { console.log('Download gestartet!'); showSuccess('Download gestartet!'); getLists(); $(".alert-info").slideUp(500); }, function () { console.log('Konnte Download nicht starten!'); showDanger('Konnte Download nicht starten!'); $(".alert-info").slideUp(500); }); } function deleteLog() { spinLog(); $http.delete('api/log/') .then(function () { console.log('Log geleert!'); showSuccess('Log geleert!'); getLog(); }, function () { console.log('Konnte Log nicht leeren!'); showDanger('Konnte Log nicht leeren!'); }); } function deleteLogRow(title) { title = btoa(title); $http.delete('api/log_entry/' + title) .then(function () { console.log('Logeintrag gelöscht!'); showSuccess('Logeintrag gelöscht!'); getLog(); }, function () { console.log('Konnte Logeintrag nicht löschen!'); showDanger('Konnte Logeintrag nicht löschen!'); }); } function searchNow() { $("#spinner-search").fadeIn(); $scope.currentPage = 0; let title = $scope.search; $scope.searching = true; if (!title) { $scope.results = []; $scope.resLength = 0; $scope.searching = false; } else { $http.get('api/search/' + title) .then(function (res) { $scope.results = res.data.results; $scope.resLength = Object.values($scope.results.bl).length; $scope.search = ""; console.log('Nach ' + title + ' gesucht!'); getLog(); getLists(); $("#spinner-search").fadeOut(); $scope.searching = false; }, function () { console.log('Konnte ' + title + ' nicht suchen!'); showDanger('Konnte ' + title + ' nicht suchen!'); $("#spinner-search").fadeOut(); }); } } function myJDupdate() { $('#myjd_update').addClass('blinking').addClass('isDisabled'); $http.post('api/myjd_update/') .then(function () { getMyJDstate(); console.log('JDownloader geupdatet!'); }, function () { console.log('Konnte JDownloader nicht updaten!'); showDanger('Konnte JDownloader nicht updaten!'); }); } function myJDstart() { $('#myjd_start').addClass('blinking').addClass('isDisabled'); $http.post('api/myjd_start/') .then(function () { getMyJDstate(); console.log('Download gestartet!'); }, function () { console.log('Konnte Downloads nicht starten!'); showDanger('Konnte Downloads nicht starten!'); }); } function myJDpause(bl) { $('#myjd_pause').addClass('blinking').addClass('isDisabled'); $('#myjd_unpause').addClass('blinking').addClass('isDisabled'); $http.post('api/myjd_pause/' + bl) .then(function () { getMyJDstate(); if (bl) { console.log('Download pausiert!'); } else { console.log('Download fortgesetzt!'); } }, function () { console.log('Konnte Downloads nicht fortsetzen!'); showDanger('Konnte Downloads nicht fortsetzen!'); }); } function myJDstop() { $('#myjd_stop').addClass('blinking').addClass('isDisabled'); $http.post('api/myjd_stop/') .then(function () { getMyJDstate(); console.log('Download angehalten!'); }, function () { console.log('Konnte Downloads nicht anhalten!'); showDanger('Konnte Downloads nicht anhalten!'); }); } function getMyJDstate() { $http.get('api/myjd_state/') .then(function (res) { $scope.myjd_state = res.data.downloader_state; $scope.myjd_grabbing = res.data.grabber_collecting; $scope.update_ready = res.data.update_ready; $('#myjd_start').removeClass('blinking').removeClass('isDisabled'); $('#myjd_pause').removeClass('blinking').removeClass('isDisabled'); $('#myjd_unpause').removeClass('blinking').removeClass('isDisabled'); $('#myjd_stop').removeClass('blinking').removeClass('isDisabled'); $('#myjd_update').removeClass('blinking').removeClass('isDisabled'); console.log('JDownloader Status abgerufen!'); }, function () { console.log('Konnte JDownloader nicht erreichen!'); showDanger('Konnte JDownloader nicht erreichen!'); }); } function getMyJD() { $http.get('api/myjd/') .then(function (res) { $scope.myjd_connection_error = false; $scope.myjd_state = res.data.downloader_state; $scope.myjd_downloads = res.data.packages.downloader; $scope.myjd_decrypted = res.data.packages.linkgrabber_decrypted; $scope.myjd_offline = res.data.packages.linkgrabber_offline; $scope.myjd_failed = res.data.packages.linkgrabber_failed; $scope.to_decrypt = res.data.packages.to_decrypt; let uuids = []; if ($scope.myjd_failed) { for (let existing_package of $scope.myjd_failed) { let uuid = existing_package['uuid']; uuids.push(uuid) } const failed_packages = Object.entries(res.data.packages.linkgrabber_failed); for (let failed_package of failed_packages) { let uuid = failed_package[1]['uuid']; if (!uuids.includes(uuid)) { $scope.myjd_failed.push(failed_package[1]) } } } let names = []; if ($scope.to_decrypt) { for (let existing_package of $scope.to_decrypt) { let name = existing_package['name']; names.push(name) } const to_decrypt = Object.entries(res.data.packages.to_decrypt); for (let failed_package of to_decrypt) { let name = failed_package[1]['name']; if (!names.includes(name)) { $scope.to_decrypt.push(failed_package[1]) } } } $scope.myjd_grabbing = res.data.grabber_collecting; if ($scope.myjd_grabbing) { if (!$scope.myjd_collapse_manual && !$scope.settings.general.closed_myjd_tab) { $("#collapseOne").addClass('show'); $("#myjd_collapse").removeClass('collapsed'); } } $scope.update_ready = res.data.update_ready; $scope.myjd_packages = []; if ($scope.myjd_failed) { for (let p of $scope.myjd_failed) { p.type = "failed"; $scope.myjd_packages.push(p); } } if ($scope.to_decrypt) { let first = true; for (let p of $scope.to_decrypt) { p.type = "to_decrypt"; p.first = first; first = false; $scope.myjd_packages.push(p); } } if ($scope.myjd_offline) { for (let p of $scope.myjd_offline) { p.type = "offline"; $scope.myjd_packages.push(p); } } if ($scope.myjd_decrypted) { for (let p of $scope.myjd_decrypted) { p.type = "decrypted"; $scope.myjd_packages.push(p); } } if ($scope.myjd_downloads) { for (let p of $scope.myjd_downloads) { p.type = "online"; $scope.myjd_packages.push(p); } } if ($scope.myjd_packages.length === 0 || (typeof $scope.settings !== 'undefined' && $scope.settings.general.closed_myjd_tab)) { if (!$scope.myjd_collapse_manual) { $("#myjd_collapse").addClass('collapsed'); $("#collapseOne").removeClass('show'); } } else { if (!$scope.myjd_collapse_manual && (typeof $scope.settings !== 'undefined' && !$scope.settings.general.closed_myjd_tab)) { $("#collapseOne").addClass('show'); $("#myjd_collapse").removeClass('collapsed'); } } console.log('JDownloader abgerufen!'); }, function () { $scope.myjd_grabbing = null; $scope.myjd_downloads = null; $scope.myjd_decrypted = null; $scope.myjd_failed = null; $scope.myjd_connection_error = true; console.log('Konnte JDownloader nicht erreichen!'); showDanger('Konnte JDownloader nicht erreichen!'); }); } function startNow() { showInfoLong("Starte Suchlauf..."); $scope.starting = true; $http.post('api/start_now/') .then(function () { $(".alert-info").slideUp(1500); }, function () { $scope.starting = false; console.log('Konnte Suchlauf nicht starten!'); showDanger('Konnte Suchlauf nicht starten!'); $(".alert-info").slideUp(1500); }); } function myJDmove(linkids, uuid) { showInfoLong("Starte Download..."); $http.post('api/myjd_move/' + linkids + "&" + uuid) .then(function () { getMyJD(); $(".alert-info").slideUp(1500); }, function () { console.log('Konnte Download nicht starten!'); showDanger('Konnte Download nicht starten!'); $(".alert-info").slideUp(1500); }); } function myJDremove(linkids, uuid) { showInfoLong("Lösche Download..."); $http.post('api/myjd_remove/' + linkids + "&" + uuid) .then(function () { if ($scope.myjd_failed) { for (let failed_package of $scope.myjd_failed) { let existing_uuid = failed_package['uuid']; if (uuid === existing_uuid) { let index = $scope.myjd_failed.indexOf(failed_package); $scope.myjd_failed.splice(index, 1) } } } getMyJD(); $(".alert-info").slideUp(1500); }, function () { console.log('Konnte Download nicht löschen!'); showDanger('Konnte Download nicht löschen!'); $(".alert-info").slideUp(1500); }); } function internalRemove(name) { showInfoLong("Lösche Download..."); $http.post('api/internal_remove/' + name) .then(function () { if ($scope.to_decrypt) { for (let failed_package of $scope.to_decrypt) { let existing_name = failed_package['name']; if (name === existing_name) { let index = $scope.to_decrypt.indexOf(failed_package); $scope.to_decrypt.splice(index, 1) } } } getMyJD(); $(".alert-info").slideUp(1500); }, function () { console.log('Konnte Download nicht löschen!'); showDanger('Konnte Download nicht löschen!'); $(".alert-info").slideUp(1500); }); } function myJDretry(linkids, uuid, links) { showInfoLong("Füge Download erneut hinzu..."); links = btoa(links); $http.post('api/myjd_retry/' + linkids + "&" + uuid + "&" + links) .then(function () { if ($scope.myjd_failed) { for (let failed_package of $scope.myjd_failed) { let existing_uuid = failed_package['uuid']; if (uuid === existing_uuid) { let index = $scope.myjd_failed.indexOf(failed_package); $scope.myjd_failed.splice(index, 1) } } } getMyJD(); $(".alert-info").slideUp(1500); }, function () { console.log('Konnte Download nicht erneut hinzufügen!'); showDanger('Konnte Download nicht erneut hinzufügen!'); $(".alert-info").slideUp(1500); }); } function myJDcnl(uuid) { showInfoLong("Warte auf Click'n'Load..."); $scope.cnl_active = true; countDown(60); $http.post('api/myjd_cnl/' + uuid) .then(function () { $scope.cnl_active = false; if ($scope.myjd_failed) { for (let failed_package of $scope.myjd_failed) { let existing_uuid = failed_package['uuid']; if (uuid === existing_uuid) { let index = $scope.myjd_failed.indexOf(failed_package); $scope.myjd_failed.splice(index, 1) } } } $(".alert-info").slideUp(500); $scope.time = 0; }).catch(function () { showDanger("Click'n'Load nicht durchgeführt!"); $scope.cnl_active = false; $(".alert-info").slideUp(500); $scope.time = 0; }); } function internalCnl(name, password) { showInfoLong("Warte auf Click'n'Load..."); $scope.cnl_active = true; countDown(60); $http.post('api/internal_cnl/' + name + "&" + password) .then(function () { $scope.cnl_active = false; if ($scope.to_decrypt) { for (let failed_package of $scope.to_decrypt) { let existing_name = failed_package['name']; if (name === existing_name) { let index = $scope.to_decrypt.indexOf(failed_package); $scope.to_decrypt.splice(index, 1) } } } $(".alert-info").slideUp(500); $scope.time = 0; }).catch(function () { showDanger("Click'n'Load nicht durchgeführt!"); $scope.cnl_active = false; $(".alert-info").slideUp(500); $scope.time = 0; }); } function scrollingTitle(titleText) { document.title = titleText; setTimeout(function () { scrollingTitle(titleText.substr(1) + titleText.substr(0, 1)); }, 200); } function showSuccess(message) { $(".alert-success").html(message).fadeTo(3000, 500).slideUp(500, function () { $(".alert-success").slideUp(500); }); } function showInfo(message) { $(".alert-info").html(message).fadeTo(10000, 500).slideUp(500, function () { $(".alert-info").slideUp(500); }); } function showInfoLong(message) { $(".alert-info").html(message).show(); } function showDanger(message) { $(".alert-danger").html(message).fadeTo(5000, 500).slideUp(500, function () { $(".alert-danger").slideUp(500); }); } function spinLog() { $("#spinner-log").fadeIn().delay(1000).fadeOut(); } function spinLists() { $("#spinner-lists").fadeIn().delay(1000).fadeOut(); } function spinSettings() { $("#spinner-settings").fadeIn().delay(1000).fadeOut(); } $scope.updateTime = function () { $timeout(function () { $scope.now = Date.now(); $scope.updateTime(); }, 1000) }; $scope.updateTime(); $scope.checkMyJD = function () { $timeout(function () { if (!$scope.cnl_active) { if (typeof $scope.settings !== 'undefined') { if ($scope.settings.general.myjd_user && $scope.settings.general.myjd_device && $scope.settings.general.myjd_device) { getMyJD(); } } } $scope.checkMyJD(); }, 5000) }; $scope.checkMyJD(); $scope.updateLog = function () { $timeout(function () { if (!$scope.cnl_active) { getLog(); } $scope.updateLog(); }, 5000) }; $scope.updateLog(); $scope.updateCrawlTimes = function () { $timeout(function () { if (!$scope.cnl_active) { getCrawlTimes(); } $scope.updateCrawlTimes(); }, 5000) }; $scope.updateCrawlTimes(); $scope.updateChecker = function () { $timeout(function () { if (!$scope.cnl_active) { getVersion(); } $scope.updateChecker(); }, 300000) }; $scope.updateChecker(); }) ; <|start_filename|>feedcrawler/web/js/helper.js<|end_filename|> let app = angular.module('helperApp', []); app.controller('helperCtrl', function ($scope, $http, $timeout) { $scope.to_decrypt = { name: false, url: false }; $scope.current_to_decrypt = ""; $scope.wnd_to_decrypt = false; $scope.update = function () { spinHelper(); getToDecrypt(); }; function spinHelper() { $("#spinner-helper").fadeIn().delay(1000).fadeOut(); } function getToDecrypt() { $http.get('./api/to_decrypt/') .then(function (res) { $scope.to_decrypt = res.data.to_decrypt; startToDecrypt() }, function (res) { console.log('[FeedCrawler Helper] Konnte Pakete zum Entschlüsseln nicht abrufen!'); }); } function startToDecrypt() { if ($scope.to_decrypt.name !== $scope.current_to_decrypt) { if ($scope.wnd_to_decrypt) { $scope.wnd_to_decrypt.close(); } if ($scope.to_decrypt.name && $scope.to_decrypt.url) { $scope.current_to_decrypt = $scope.to_decrypt.name $scope.wnd_to_decrypt = window.open($scope.to_decrypt.url); } } } getToDecrypt(); $scope.updateToDecrypt = function () { $timeout(function () { spinHelper(); getToDecrypt(); $scope.updateToDecrypt(); }, 30000) }; $scope.updateToDecrypt(); } ) ;
rix1337/RSScrawler
<|start_filename|>flask_superadmin/templates/admin/file/rename.html<|end_filename|> {% extends 'admin/layout.html' %} {% import 'admin/_macros.html' as lib with context %} {% block body %} <h4>{{ _gettext('Please provide new name for %(name)s', name=name) }}</h4> <br>/{{ base_path.split('/')[-1] }}/{% if path %}{{path}}/{% endif %} {{ lib.render_form(form, dir_url) }} {% endblock %} <|start_filename|>flask_superadmin/templates/admin/layout.html<|end_filename|> <!DOCTYPE html> <html> <head>{% block head %} <title>{% block title %}{% if admin_view.category %}{{ admin_view.category }} - {% endif %}{{ admin_view.name }} - {{ admin_view.admin.name }}{% endblock %}</title> {% block head_meta %} <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="description" content=""> <meta name="author" content=""> {% endblock %} {% block head_css %} <link href='//fonts.googleapis.com/css?family=Open+Sans:400,300,600,700' rel='stylesheet' type='text/css'> <link href="{{ url_for('admin.static', filename='bootstrap/css/bootstrap.css') }}" rel="stylesheet"> <link href="{{ url_for('admin.static', filename='bootstrap/css/bootstrap-responsive.css') }}" rel="stylesheet"> <link href="{{ url_for('admin.static', filename='css/admin.css') }}" rel="stylesheet"> <link href="{{ url_for('admin.static', filename='css/forms.css') }}" rel="stylesheet"> <link rel="icon" href="{{ url_for('admin.static', filename='img/favicon.png') }}" type="image/png"> <link rel="shortcut icon" href="{{ url_for('admin.static', filename='img/favicon.png') }}" type="image/png"> {% endblock %} {% endblock %}</head> <body> {% block page_body %} <div class="container"> <div class="row"> <div class="span2"> <ul id="main-nav" class="nav nav-pills nav-stacked"> {% for item in admin_view.admin.menu() %} {% if item.is_category() %} {% set children = item.get_children() %} {% if children %} {% if item.is_active(admin_view) %}<li class="active dropdown">{% else %}<li class="dropdown">{% endif %} <a class="dropdown-toggle" data-toggle="dropdown" href="#">{{ item.name }}<b class="caret"></b></a> <ul class="dropdown-menu"> {% for child in children %} {% if child.is_active(admin_view) %}<li class="active">{% else %}<li>{% endif %} <a href="{{ child.get_url() }}">{{ child.name }}</a> </li> {% endfor %} </ul> </li> {% endif %} {% else %} {% if item.is_accessible() %} {% if item.is_active(admin_view) %}<li class="active">{% else %}<li>{% endif %} <a href="{{ item.get_url() }}">{{ item.name }}</a> </li> {% endif %} {% endif %} {% endfor %} </ul> </div> <div id="content" class="span10"> {% with messages = get_flashed_messages(with_categories=True) %} {% if messages %} {% for category, m in messages %} {% if category == 'error' %} <div class="alert alert-error"> {% else %} <div class="alert"> {% endif %} <a href="#" class="close" data-dismiss="alert">x</a> {{ m }} </div> {% endfor %} {% endif %} {% endwith %} {% block body %}{% endblock %} </div> {% endblock %} </div> </div> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js" type="text/javascript"></script> <script src="{{ url_for('admin.static', filename='bootstrap/js/bootstrap.min.js') }}" type="text/javascript"></script> <script src="{{ url_for('admin.static', filename='chosen/chosen.jquery.min.js') }}" type="text/javascript"></script> <script src="{{ url_for('admin.static', filename='js/jquery.browser.js') }}" type="text/javascript"></script> {% block tail %} {% endblock %} </body> </html> <|start_filename|>flask_superadmin/templates/admin/model/list.html<|end_filename|> {% extends 'admin/layout.html' %} {% import 'admin/_macros.html' as lib with context %} {% set name = admin_view.get_display_name() %} {% block head_css %} <link href="{{ url_for('admin.static', filename='chosen/chosen.css') }}" rel="stylesheet"> <link href="{{ url_for('admin.static', filename='css/datepicker.css') }}" rel="stylesheet"> {{super()}} {% endblock %} {% block body %} <form method="POST" action="#"> {% if csrf_token %} <input id="csrf_token" name="csrf_token" type="hidden" value="{{ csrf_token() }}" /> {% endif %} <h1 id="main-title">{{ _gettext('%(model)s model', model=name|capitalize) }}</h1> {% if admin_view.can_create %} <a class="btn btn-primary btn-title" href="{{ url_for('.add') }}">{{ _gettext('Add %(model)s', model=name) }}</a> {% endif %} <select class="actions btn-title hidden" name="action" data-placeholder="{{ _gettext('Choose action') }}"> <option value=""></option> {% if admin_view.can_delete %} <option value="delete">{{ _gettext('Delete selected') }}</option> {% endif %} </select> <div class="clearfix"></div> <hr /> <div class="total-count">Total count: {{ count }}</div> <div class="page-content"> {% if admin_view.search_fields %} <div class="search"> <div class="clear-btn{% if not search_query %}hide{% endif %}"></div> <input type="text" tabindex="0" autofocus="autofocus" name="q" class="search-input" placeholder="Search" {% if search_query %}value="{{ search_query }}"{% endif %}/> </div> {% endif %} <table class="table model-list"> <thead> <tr> <th class="model-check"><input type="checkbox" name="selected_all_instances" value="all"></th> {% for c in admin_view.list_display %} <th> {% set name = admin_view.field_name(c) %} {% if admin_view.is_sortable(c)%} {% if sort == c %} <a href="{{ admin_view.sort_url(c if not sort_desc else None, True) }}"> {{ name }} {% if sort_desc %} <i class="icon-chevron-up"></i> {% else %} <i class="icon-chevron-down"></i> {% endif %} </a> {% else %} <a href="{{ admin_view.sort_url(c) }}">{{ name }}</a> {% endif %} {% else %} {{ name }} {% endif %} </th> {% else %} <th> {{ name|capitalize }} </th> {% endfor %} </tr> </thead> {% for instance in data %} <tr> <td> {% set pk = admin_view.get_pk(instance) %} <input type="checkbox" name="_selected_action" value="{{ pk }}"> </td> {% for c in admin_view.list_display %} {% if loop.first %} <td><a href="{{ url_for('.edit', pk=pk) }}">{{ admin_view.get_column(instance, c) }}</a></td> {% else %} {% with reference = admin_view.get_reference(admin_view.get_column(instance, c)) %} {% if reference %} <td><a href="{{ reference }}">{{ admin_view.get_column(instance, c) }}</a></td> {% else %} <td>{{ admin_view.get_column(instance, c) }}</td> {% endif %} {% endwith %} {% endif %} {% else %} <td><a href="{{ url_for('.edit', pk=pk) }}">{{ instance|string or 'None' }}</a></td> {% endfor %} </tr> {% endfor %} </table> {{ lib.pager(page, total_pages, admin_view.page_url) }} </div> </form> {% endblock %} {% block tail %} <script src="{{ url_for('admin.static', filename='js/bootstrap-datepicker.js') }}"></script> <script src="{{ url_for('admin.static', filename='js/form.js') }}"></script> <script src="{{ url_for('admin.static', filename='js/filters.js') }}"></script> {% endblock %}
romeojulietthotel/Flask-NotSuperAdmin
<|start_filename|>src/Dashboard/Controllers/WebHookController.cs<|end_filename|> namespace Dashboard.Controllers { using System; using System.IO; using System.Threading.Tasks; using Microsoft.AspNetCore.Authentication.JwtBearer; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Filters; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; using Newtonsoft.Json; using SaaSFulfillmentClient.WebHook; // To test without JWT validation: // Comment out the following line [Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme)] // and include the next line // [AllowAnonymous] [RequireHttps] public class WebHookController : Controller { private readonly ILogger<WebHookController> logger; private readonly IWebhookProcessor webhookProcessor; private readonly DashboardOptions options; public WebHookController( IWebhookProcessor webhookProcessor, IOptionsMonitor<DashboardOptions> optionsMonitor, ILogger<WebHookController> logger) { this.webhookProcessor = webhookProcessor; this.logger = logger; this.options = optionsMonitor.CurrentValue; } [HttpPost] public async Task<IActionResult> Index([FromBody] WebhookPayload payload) { // Options is injected as a singleton. This is not a good hack, but need to pass the host name and port this.options.BaseUrl = $"{this.Request.Scheme}://{this.Request.Host}/"; await this.webhookProcessor.ProcessWebhookNotificationAsync(payload); this.logger.LogInformation($"Received webhook request: {JsonConvert.SerializeObject(payload)}"); return this.Ok(); } } } <|start_filename|>src/Dashboard/Views/Static/Support.cshtml<|end_filename|> @{ ViewData["Title"] = "Support Information"; } <h1>Support Information</h1> <p> For more information on this sample, please visit the Github repository and view the README: <a href="https://github.com/Ercenk/ContosoAMPBasic" title="Ercenk / ContosoAMPBasic | Github" target="_blank">Ercenk / ContosoAMPBasic on Github</a> </p> <|start_filename|>src/Dashboard/Marketplace/MarketplaceSubscription.cs<|end_filename|> namespace Dashboard.Marketplace { using System; using System.ComponentModel.DataAnnotations; using SaaSFulfillmentClient.Models; public class MarketplaceSubscription { public string OfferId { get; set; } public string PlanId { get; set; } public int Quantity { get; set; } public StatusEnum State { get; set; } public Guid SubscriptionId { get; set; } [Display(Name = "Name")] public string SubscriptionName { get; set; } internal static MarketplaceSubscription From(ResolvedSubscription subscription, StatusEnum newState) { return new MarketplaceSubscription { SubscriptionId = subscription.SubscriptionId, OfferId = subscription.OfferId, PlanId = subscription.PlanId, Quantity = subscription.Quantity, SubscriptionName = subscription.SubscriptionName, State = newState }; } internal static MarketplaceSubscription From(Subscription subscription) { return new MarketplaceSubscription { SubscriptionId = subscription.SubscriptionId, OfferId = subscription.OfferId, PlanId = subscription.PlanId, Quantity = subscription.Quantity, SubscriptionName = subscription.Name, State = subscription.SaasSubscriptionStatus }; } } } <|start_filename|>src/Dashboard/NotificationModel.cs<|end_filename|> namespace Dashboard { using System; using SaaSFulfillmentClient.WebHook; public class NotificationModel { public string OfferId { get; set; } public Guid OperationId { get; set; } public string OperationType { get; set; } public string PlanId { get; set; } public string PublisherId { get; set; } public int Quantity { get; set; } public Guid SubscriptionId { get; set; } public static NotificationModel FromWebhookPayload(WebhookPayload payload) { return new NotificationModel { OfferId = payload.OfferId, OperationId = payload.OperationId, PlanId = payload.PlanId, PublisherId = payload.PublisherId, Quantity = payload.Quantity, SubscriptionId = payload.SubscriptionId }; } } } <|start_filename|>src/Dashboard/Models/UpdateSubscriptionViewModel.cs<|end_filename|> namespace Dashboard.Models { using System; using System.Collections.Generic; using SaaSFulfillmentClient.Models; public class UpdateSubscriptionViewModel { public IEnumerable<Plan> AvailablePlans { get; set; } public string CurrentPlan { get; set; } public string NewPlan { get; set; } public bool PendingOperations { get; set; } public Guid SubscriptionId { get; set; } public string SubscriptionName { get; set; } public int CurrentQuantity { get; set; } public int NewQuantity { get; set; } } } <|start_filename|>src/Dashboard/Controllers/LandingPageController.cs<|end_filename|> using System.Linq; using SaaSFulfillmentClient; using SaaSFulfillmentClient.Models; namespace Dashboard.Controllers { using System; using System.Security.Claims; using System.Threading; using System.Threading.Tasks; using Dashboard.Marketplace; using Dashboard.Models; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; [Authorize] public class LandingPageController : Controller { private readonly IFulfillmentClient fulfillmentClient; private readonly IMarketplaceNotificationHandler notificationHandler; private readonly ILogger<LandingPageController> logger; private readonly DashboardOptions options; public LandingPageController( IOptionsMonitor<DashboardOptions> dashboardOptions, IFulfillmentClient fulfillmentClient, IMarketplaceNotificationHandler notificationHandler, ILogger<LandingPageController> logger) { this.fulfillmentClient = fulfillmentClient; this.notificationHandler = notificationHandler; this.logger = logger; this.options = dashboardOptions.CurrentValue; } [HttpPost] [ValidateAntiForgeryToken] public async Task<ActionResult> Index( AzureSubscriptionProvisionModel provisionModel, CancellationToken cancellationToken) { var urlBase = $"{this.Request.Scheme}://{this.Request.Host}"; this.options.BaseUrl = urlBase; try { await this.ProcessLandingPageAsync(provisionModel, cancellationToken); return this.RedirectToAction(nameof(this.Success)); } catch (Exception ex) { return this.BadRequest(ex); } } // GET: LandingPage public async Task<ActionResult> Index(string token, CancellationToken cancellationToken) { if (string.IsNullOrEmpty(token)) { this.ModelState.AddModelError(string.Empty, "Token URL parameter cannot be empty"); return this.View(); } var provisioningModel = await this.BuildLandingPageModel(token, cancellationToken); if (provisioningModel != default) { provisioningModel.FullName = (this.User.Identity as ClaimsIdentity)?.FindFirst("name")?.Value; provisioningModel.Email = this.User.Identity.GetUserEmail(); provisioningModel.BusinessUnitContactEmail = this.User.Identity.GetUserEmail(); return this.View(provisioningModel); } this.ModelState.AddModelError(string.Empty, "Cannot resolve subscription"); return this.View(); } public ActionResult Success() { return this.View(); } private async Task<AzureSubscriptionProvisionModel> BuildLandingPageModel( string token, CancellationToken cancellationToken) { var requestId = Guid.NewGuid(); var correlationId = Guid.NewGuid(); var resolvedSubscription = await this.fulfillmentClient.ResolveSubscriptionAsync( token, requestId, correlationId, cancellationToken); if (resolvedSubscription == default(ResolvedSubscription)) return default; if (!resolvedSubscription.Success) return default; var existingSubscription = await this.fulfillmentClient.GetSubscriptionAsync( resolvedSubscription.SubscriptionId, requestId, correlationId, cancellationToken); var availablePlans = (await this.fulfillmentClient.GetSubscriptionPlansAsync( resolvedSubscription.SubscriptionId, requestId, correlationId, cancellationToken)).Plans.ToList(); var provisioningModel = new AzureSubscriptionProvisionModel { PlanId = resolvedSubscription.PlanId, SubscriptionId = resolvedSubscription.SubscriptionId, OfferId = resolvedSubscription.OfferId, SubscriptionName = resolvedSubscription.SubscriptionName, PurchaserEmail = existingSubscription.Purchaser.EmailId, PurchaserTenantId = existingSubscription.Purchaser.TenantId, // Assuming this will be set to the value the customer already set when subscribing, if we are here after the initial subscription activation // Landing page is used both for initial provisioning and configuration of the subscription. Region = TargetContosoRegionEnum.NorthAmerica, AvailablePlans = availablePlans, SubscriptionStatus = existingSubscription.SaasSubscriptionStatus, PendingOperations = (await this.fulfillmentClient.GetSubscriptionOperationsAsync( resolvedSubscription.SubscriptionId, requestId, correlationId, cancellationToken)).Any( o => o.Status == OperationStatusEnum.InProgress) }; return provisioningModel; } private async Task ProcessLandingPageAsync( AzureSubscriptionProvisionModel provisionModel, CancellationToken cancellationToken) { // A new subscription will have PendingFulfillmentStart as status if (provisionModel.SubscriptionStatus != StatusEnum.Subscribed) { await this.notificationHandler.ProcessActivateAsync(provisionModel, cancellationToken); } else { await this.notificationHandler.ProcessChangePlanAsync(provisionModel, cancellationToken); } } } } <|start_filename|>src/Dashboard/Controllers/SubscriptionsController.cs<|end_filename|> namespace Dashboard.Controllers { using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Threading; using System.Threading.Tasks; using Dashboard.Models; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Options; using SaaSFulfillmentClient; using SaaSFulfillmentClient.Models; [Authorize("DashboardAdmin")] public class SubscriptionsController : Controller { private readonly IFulfillmentClient fulfillmentClient; private readonly IOperationsStore operationsStore; private readonly DashboardOptions options; public SubscriptionsController( IFulfillmentClient fulfillmentClient, IOperationsStore operationsStore, IOptionsMonitor<DashboardOptions> options) { this.fulfillmentClient = fulfillmentClient; this.operationsStore = operationsStore; this.options = options.CurrentValue; } [AllowAnonymous] [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] public IActionResult Error(string viewName = null) { if (viewName != null) return this.View(viewName, new ErrorViewModel { RequestId = Activity.Current?.Id ?? this.HttpContext.TraceIdentifier }); return this.View( new ErrorViewModel { RequestId = Activity.Current?.Id ?? this.HttpContext.TraceIdentifier }); } public async Task<IActionResult> Index(CancellationToken cancellationToken) { var requestId = Guid.NewGuid(); var correlationId = Guid.NewGuid(); var subscriptions = await this.fulfillmentClient.GetSubscriptionsAsync( requestId, correlationId, cancellationToken); var subscriptionsViewModel = subscriptions.Select(SubscriptionViewModel.FromSubscription) .Where(s => s.State != StatusEnum.Unsubscribed || this.options.ShowUnsubscribed); var newViewModel = new List<SubscriptionViewModel>(); foreach (var subscription in subscriptionsViewModel) { // REMOVING THE FOLLOWING FOR THE SAKE OF PERFORMANCE, but keeping them here as reference //subscription.PendingOperations = // (await this.fulfillmentClient.GetSubscriptionOperationsAsync( // requestId, // correlationId, // subscription.SubscriptionId, // cancellationToken)).Any(o => o.Status == OperationStatusEnum.InProgress); var recordedSubscriptionOperations = await this.operationsStore.GetAllSubscriptionRecordsAsync( subscription.SubscriptionId, cancellationToken); // REMOVING THE FOLLOWING FOR THE SAKE OF PERFORMANCE, but keeping them here as reference //var subscriptionOperations = new List<SubscriptionOperation>(); //foreach (var operation in recordedSubscriptionOperations) //{ // var subscriptionOperation = await this.fulfillmentClient.GetSubscriptionOperationAsync( // operation.SubscriptionId, // operation.OperationId, // requestId, // correlationId, // cancellationToken); // if (subscriptionOperation != default(SubscriptionOperation)) // { // subscriptionOperations.Add(subscriptionOperation); // } //} //subscription.PendingOperations |= // subscriptionOperations.Any(o => o.Status == OperationStatusEnum.InProgress); subscription.ExistingOperations = (await this.operationsStore.GetAllSubscriptionRecordsAsync( subscription.SubscriptionId, cancellationToken)).Any(); subscription.OperationCount = recordedSubscriptionOperations.Count(); newViewModel.Add(subscription); } return this.View(newViewModel.OrderByDescending(s => s.SubscriptionName)); } [AllowAnonymous] [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] public IActionResult NotAuthorized() { return this.View(); } public async Task<IActionResult> Operations(Guid subscriptionId, CancellationToken cancellationToken) { var requestId = Guid.NewGuid(); var correlationId = Guid.NewGuid(); var subscriptionOperations = await this.operationsStore.GetAllSubscriptionRecordsAsync(subscriptionId, cancellationToken); var subscription = await this.fulfillmentClient.GetSubscriptionAsync( subscriptionId, requestId, correlationId, cancellationToken); var operations = new List<SubscriptionOperation>(); foreach (var operation in subscriptionOperations) operations.Add( await this.fulfillmentClient.GetSubscriptionOperationAsync( subscriptionId, operation.OperationId, requestId, correlationId, cancellationToken)); return this.View(new OperationsViewModel { SubscriptionName = subscription.Name, Operations = operations }); } public async Task<IActionResult> SubscriptionAction( Guid subscriptionId, ActionsEnum subscriptionAction, CancellationToken cancellationToken) { var requestId = Guid.NewGuid(); var correlationId = Guid.NewGuid(); switch (subscriptionAction) { case ActionsEnum.Activate: break; case ActionsEnum.Update: var availablePlans = (await this.fulfillmentClient.GetSubscriptionPlansAsync( subscriptionId, requestId, correlationId, cancellationToken)).Plans.ToList(); var subscription = await this.fulfillmentClient.GetSubscriptionAsync( subscriptionId, requestId, correlationId, cancellationToken); var updateSubscriptionViewModel = new UpdateSubscriptionViewModel { SubscriptionId = subscriptionId, SubscriptionName = subscription.Name, CurrentPlan = subscription.PlanId, CurrentQuantity = subscription.Quantity, AvailablePlans = availablePlans, PendingOperations = (await this.fulfillmentClient .GetSubscriptionOperationsAsync( subscriptionId, requestId, correlationId, cancellationToken)).Any( o => o.Status == OperationStatusEnum.InProgress) }; return this.View("UpdateSubscription", updateSubscriptionViewModel); case ActionsEnum.Ack: break; case ActionsEnum.Unsubscribe: var unsubscribeResult = await this.fulfillmentClient.DeleteSubscriptionAsync( subscriptionId, requestId, correlationId, cancellationToken); return unsubscribeResult.Success ? this.RedirectToAction("Index") : this.Error(); default: throw new ArgumentOutOfRangeException(nameof(subscriptionAction), subscriptionAction, null); } return this.View(); } [HttpPost] public async Task<IActionResult> UpdateSubscription( UpdateSubscriptionViewModel model, CancellationToken cancellationToken) { var requestId = Guid.NewGuid(); var correlationId = Guid.NewGuid(); if ((await this.fulfillmentClient.GetSubscriptionOperationsAsync( model.SubscriptionId, requestId, correlationId, cancellationToken)) .Any(o => o.Status == OperationStatusEnum.InProgress)) return this.RedirectToAction("Index"); var updateResult = await this.fulfillmentClient.UpdateSubscriptionPlanAsync( model.SubscriptionId, model.NewPlan, requestId, correlationId, cancellationToken); return updateResult.Success ? this.RedirectToAction("Index") : this.Error(); } [HttpPost] public async Task<IActionResult> UpdateSubscriptionQuantity( UpdateSubscriptionViewModel model, CancellationToken cancellationToken) { var requestId = Guid.NewGuid(); var correlationId = Guid.NewGuid(); if ((await this.fulfillmentClient.GetSubscriptionOperationsAsync( model.SubscriptionId, requestId, correlationId, cancellationToken)) .Any(o => o.Status == OperationStatusEnum.InProgress)) return this.RedirectToAction("Index"); var updateResult = await this.fulfillmentClient.UpdateSubscriptionQuantityAsync( model.SubscriptionId, model.NewQuantity, requestId, correlationId, cancellationToken); if (this.operationsStore != default) { await this.operationsStore.RecordAsync(model.SubscriptionId, updateResult, cancellationToken); } return updateResult.Success ? this.RedirectToAction("Index") : this.Error("UpdateSubscription"); } } } <|start_filename|>src/Dashboard/ContosoWebhookHandler.cs<|end_filename|> namespace Dashboard { using System; using System.Threading.Tasks; using SaaSFulfillmentClient.Models; using SaaSFulfillmentClient.WebHook; public class ContosoWebhookHandler : IWebhookHandler { private readonly IMarketplaceNotificationHandler notificationHelper; public ContosoWebhookHandler(IMarketplaceNotificationHandler notificationHelper) { this.notificationHelper = notificationHelper; } public async Task ChangePlanAsync(WebhookPayload payload) { switch (payload.Status) { case OperationStatusEnum.Succeeded: await this.notificationHelper.NotifyChangePlanAsync(NotificationModel.FromWebhookPayload(payload)); break; case OperationStatusEnum.Failed: case OperationStatusEnum.Conflict: await this.notificationHelper.ProcessOperationFailOrConflictAsync( NotificationModel.FromWebhookPayload(payload)); break; } } public async Task ChangeQuantityAsync(WebhookPayload payload) { switch (payload.Status) { case OperationStatusEnum.Succeeded: await this.notificationHelper.ProcessChangeQuantityAsync( NotificationModel.FromWebhookPayload(payload)); break; case OperationStatusEnum.Failed: case OperationStatusEnum.Conflict: await this.notificationHelper.ProcessOperationFailOrConflictAsync( NotificationModel.FromWebhookPayload(payload)); break; } } public async Task ReinstatedAsync(WebhookPayload payload) { switch (payload.Status) { case OperationStatusEnum.Succeeded: await this.notificationHelper.ProcessReinstatedAsync(NotificationModel.FromWebhookPayload(payload)); break; case OperationStatusEnum.Failed: case OperationStatusEnum.Conflict: await this.notificationHelper.ProcessOperationFailOrConflictAsync( NotificationModel.FromWebhookPayload(payload)); break; } } public Task SubscribedAsync(WebhookPayload payload) { throw new NotImplementedException(); } public async Task SuspendedAsync(WebhookPayload payload) { switch (payload.Status) { case OperationStatusEnum.Succeeded: await this.notificationHelper.ProcessSuspendedAsync(NotificationModel.FromWebhookPayload(payload)); break; case OperationStatusEnum.Failed: case OperationStatusEnum.Conflict: await this.notificationHelper.ProcessOperationFailOrConflictAsync( NotificationModel.FromWebhookPayload(payload)); break; } } public async Task UnsubscribedAsync(WebhookPayload payload) { switch (payload.Status) { case OperationStatusEnum.Succeeded: await this.notificationHelper.ProcessUnsubscribedAsync( NotificationModel.FromWebhookPayload(payload)); break; case OperationStatusEnum.Failed: case OperationStatusEnum.Conflict: await this.notificationHelper.ProcessOperationFailOrConflictAsync( NotificationModel.FromWebhookPayload(payload)); break; } } } } <|start_filename|>src/Dashboard/Models/OperationsViewModel.cs<|end_filename|> namespace Dashboard.Models { using System.Collections.Generic; using SaaSFulfillmentClient.Models; public class OperationsViewModel { public List<SubscriptionOperation> Operations { get; set; } public string SubscriptionName { get; set; } } } <|start_filename|>src/Dashboard/Views/Subscriptions/UpdateSubscription.cshtml<|end_filename|> @model UpdateSubscriptionViewModel @{ ViewData["Title"] = "All Offer Subscriptions"; } <h1>Update Subscriptions</h1> <hr /> <span class="text-danger">@Html.ValidationSummary(false)</span> <form method="post"> <div> <dl class="row"> <dt class="col-sm-2"> @Html.DisplayNameFor(model => model.SubscriptionName) </dt> <dd class="col-sm-10"> @Html.DisplayFor(model => model.SubscriptionName) </dd> <dt class="col-sm-2"> @Html.DisplayNameFor(model => model.SubscriptionId) </dt> <dd class="col-sm-10"> @Html.DisplayFor(model => model.SubscriptionId) <input asp-for="SubscriptionId" type="hidden" class="form-control" /> </dd> </dl> </div> <table class="table table-bordered"> <tr> <td>@Html.DisplayNameFor(model => model.CurrentPlan)</td> <td>@Html.DisplayFor(model => model.CurrentPlan)</td> @if (Model.CurrentQuantity > 0) { <td>@Html.DisplayNameFor(model => model.CurrentQuantity)</td> <td>@Html.DisplayFor(model => model.CurrentQuantity)</td> } </tr> <tr> <td>@Html.DisplayNameFor(model => model.AvailablePlans)</td> <td> <select asp-for="NewPlan" asp-items="@(new SelectList(Model.AvailablePlans, "PlanId", "DisplayName"))" class="form-control"> <option value="">Choose a new plan</option> </select> </td> @if (Model.CurrentQuantity > 0) { <td>@Html.DisplayNameFor(model => model.NewQuantity)</td> <td>@Html.EditorFor(model => model.NewQuantity)</td> } </tr> <tr> <td colspan="2"><button asp-action="UpdateSubscription" class="btn btn-primary">Change Plan</button></td> @if (Model.CurrentQuantity > 0) { <td colspan="2"><button asp-action="UpdateSubscriptionQuantity" class="btn btn-primary">Change Quantity</button></td> } </tr> </table> </form> <|start_filename|>src/Dashboard/Models/FulfillmentRequestErrorViewModel.cs<|end_filename|> namespace Dashboard.Models { using System.Net; using SaaSFulfillmentClient.Models; public class FulfillmentRequestErrorViewModel { public string RawResponse { get; set; } public HttpStatusCode StatusCode { get; set; } public static FulfillmentRequestErrorViewModel From(FulfillmentRequestResult result) { return new FulfillmentRequestErrorViewModel { RawResponse = result.RawResponse, StatusCode = result.StatusCode }; } } } <|start_filename|>src/Dashboard/DashboardOptions.cs<|end_filename|> namespace Dashboard { using Dashboard.Mail; public class DashboardOptions { public string BaseUrl { get; set; } public string DashboardAdmin { get; set; } public MailOptions Mail { get; set; } public bool ShowUnsubscribed { get; set; } } } <|start_filename|>src/Dashboard/Views/Subscriptions/NotAuthorized.cshtml<|end_filename|> @{ ViewData["Title"] = "NotAuthorized"; } <h1>NotAuthorized</h1> <p> The user (@User.Identity.GetUserEmail()) is not authorized to use this. Please modify the Dashboard:DashboardAdmin setting to the account you are logging on. </p> <|start_filename|>src/Dashboard/Controllers/MailLinkController.cs<|end_filename|> namespace Dashboard.Controllers { using System; using System.Threading; using System.Threading.Tasks; using Dashboard.Models; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using SaaSFulfillmentClient; using SaaSFulfillmentClient.Models; [Authorize("DashboardAdmin")] public class MailLinkController : Controller { private readonly IFulfillmentClient fulfillmentClient; public MailLinkController(IFulfillmentClient fulfillmentClient) { this.fulfillmentClient = fulfillmentClient; } [HttpGet] public async Task<IActionResult> Activate( NotificationModel notificationModel, CancellationToken cancellationToken) { var result = await this.fulfillmentClient.ActivateSubscriptionAsync( notificationModel.SubscriptionId, new ActivatedSubscription { PlanId = notificationModel.PlanId }, Guid.Empty, Guid.Empty, cancellationToken); return result.Success ? this.View( new ActivateActionViewModel { SubscriptionId = notificationModel.SubscriptionId, PlanId = notificationModel.PlanId }) : this.View("MailActionError", FulfillmentRequestErrorViewModel.From(result)); } [HttpGet] public async Task<IActionResult> QuantityChange( NotificationModel notificationModel, CancellationToken cancellationToken) { var result = await this.UpdateOperationAsync(notificationModel, cancellationToken); return result.Success ? this.View("OperationUpdate", notificationModel) : this.View("MailActionError", FulfillmentRequestErrorViewModel.From(result)); } [HttpGet] public async Task<IActionResult> Reinstate( NotificationModel notificationModel, CancellationToken cancellationToken) { var result = await this.UpdateOperationAsync(notificationModel, cancellationToken); return result.Success ? this.View("OperationUpdate", notificationModel) : this.View("MailActionError", FulfillmentRequestErrorViewModel.From(result)); } [HttpGet] public async Task<IActionResult> SuspendSubscription( NotificationModel notificationModel, CancellationToken cancellationToken) { var result = await this.UpdateOperationAsync(notificationModel, cancellationToken); return result.Success ? this.View("OperationUpdate", notificationModel) : this.View("MailActionError", FulfillmentRequestErrorViewModel.From(result)); } [HttpGet] public async Task<IActionResult> Unsubscribe( NotificationModel notificationModel, CancellationToken cancellationToken) { var result = await this.UpdateOperationAsync(notificationModel, cancellationToken); return result.Success ? this.View("OperationUpdate", notificationModel) : this.View("MailActionError", FulfillmentRequestErrorViewModel.From(result)); } [HttpGet] public async Task<IActionResult> Update(NotificationModel notificationModel) { var result = await this.fulfillmentClient.UpdateSubscriptionPlanAsync( notificationModel.SubscriptionId, notificationModel.PlanId, Guid.Empty, Guid.Empty, CancellationToken.None); return result.Success ? this.View( new ActivateActionViewModel { SubscriptionId = notificationModel.SubscriptionId, PlanId = notificationModel.PlanId }) : this.View("MailActionError", FulfillmentRequestErrorViewModel.From(result)); } private async Task<FulfillmentRequestResult> UpdateOperationAsync( NotificationModel payload, CancellationToken cancellationToken) { return await this.fulfillmentClient.UpdateSubscriptionOperationAsync( payload.SubscriptionId, payload.OperationId, new OperationUpdate { PlanId = payload.PlanId, Quantity = payload.Quantity, Status = OperationUpdateStatusEnum.Success }, Guid.Empty, Guid.Empty, cancellationToken); } } } <|start_filename|>src/Dashboard/Views/Static/Privacy.cshtml<|end_filename|> @{ ViewData["Title"] = "Privacy Policy"; } <h1>Privacy Policy</h1> <p>This is a sample application to test integration with Azure Marketplace. The only data stored relates to the selected subscription levels the user has chosen. Any other data is stored by third-party services and is subject to their privacy policies.</p> <|start_filename|>src/Dashboard/Controllers/StaticController.cs<|end_filename|> using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; namespace Dashboard.Controllers { [AllowAnonymous] public class StaticController : Controller { [Route("privacy")] public ActionResult Privacy() { return View(); } [Route("support")] public ActionResult Support() { return View(); } } } <|start_filename|>src/Dashboard/IMarketplaceNotificationHandler.cs<|end_filename|> namespace Dashboard { using System.Threading; using System.Threading.Tasks; using Dashboard.Models; public interface IMarketplaceNotificationHandler { Task NotifyChangePlanAsync(NotificationModel notificationModel, CancellationToken cancellationToken = default); Task ProcessActivateAsync( AzureSubscriptionProvisionModel provisionModel, CancellationToken cancellationToken = default); Task ProcessChangePlanAsync( AzureSubscriptionProvisionModel provisionModel, CancellationToken cancellationToken = default); Task ProcessChangeQuantityAsync( NotificationModel notificationModel, CancellationToken cancellationToken = default); Task ProcessOperationFailOrConflictAsync( NotificationModel notificationModel, CancellationToken cancellationToken = default); Task ProcessReinstatedAsync(NotificationModel notificationModel, CancellationToken cancellationToken = default); Task ProcessSuspendedAsync(NotificationModel notificationModel, CancellationToken cancellationToken = default); Task ProcessUnsubscribedAsync( NotificationModel notificationModel, CancellationToken cancellationToken = default); } } <|start_filename|>src/Dashboard/Models/ActionsEnum.cs<|end_filename|> namespace Dashboard.Models { public enum ActionsEnum { Activate, Update, Ack, Unsubscribe } } <|start_filename|>src/Dashboard/Views/_ViewImports.cshtml<|end_filename|> @using Dashboard @using Dashboard.Models @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers <|start_filename|>src/Dashboard/appsettings.json<|end_filename|> { // This AD app settings section is for the landing page. It needs to be a multi-tenant application. "AzureAd": { "Instance": "https://login.microsoftonline.com/", "Domain": "CHANGE", // Register a multi-teanant application, and do not change the "TenantId" from common auth endpoint *value should be organizations or common). "TenantId": "common", "ClientId": "CHANGE", "CallbackPath": "/signin-oidc", "SignedOutCallbackPath ": "/signout-callback-oidc", // THIS SAMPLE DOES NOT USE THE CLIENT SECRET "ClientSecret": "SAMPLE DOES NOT USE THIS VALUE" }, "FulfillmentClient": { // This AD app settings section is for Marketplace API access. Register a single tenant "AzureActiveDirectory": { "ClientId": "CHANGE", // DO NOT SET SECRETS HERE IF YOU ARE GOING TO MAKE IT PUBLICLY AVAILABLE "TenantId": "CHANGE", "AppKey": "CHANGE" }, "FulfillmentService": { "BaseUri": "https://marketplaceapi.microsoft.com/api/saas", "ApiVersion": "2018-08-31" }, "OperationsStoreConnectionString": "CHANGE" }, "Dashboard": { "Mail": { "OperationsTeamEmail": "CHANGE", "FromEmail": "<EMAIL>", "ApiKey": "CHANGE" }, "DashboardAdmin": "CHANGE", "ShowUnsubscribed": "true" }, "Logging": { "LogLevel": { "Default": "Trace" } }, "AllowedHosts": "*" } <|start_filename|>src/Dashboard/Mail/MailOptions.cs<|end_filename|> namespace Dashboard.Mail { public class MailOptions { public string OperationsTeamEmail { get; set; } public string ApiKey { get; set; } public string FromEmail { get; set; } } } <|start_filename|>src/Dashboard/StringExtensions.cs<|end_filename|> namespace Dashboard { using System.Net.Mail; public static class StringExtensions { public static string GetDomainNameFromEmail(this string emailString) { try { var email = new MailAddress(emailString); return email.Host; } catch { return "InvalidCustomer"; } } public static bool IsValidEmail(this string email) { try { var addr = new MailAddress(email); return addr.Address == email; } catch { return false; } } } } <|start_filename|>src/Dashboard/Models/AzureSubscriptionProvisionModel.cs<|end_filename|> namespace Dashboard.Models { using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using Microsoft.AspNetCore.Mvc; using Newtonsoft.Json; using Newtonsoft.Json.Converters; using SaaSFulfillmentClient.Models; [BindProperties] public class AzureSubscriptionProvisionModel { [Display(Name = "Available plans")] public IEnumerable<Plan> AvailablePlans { get; set; } [Display(Name = "Business unit contact email")] public string BusinessUnitContactEmail { get; set; } public string Email { get; set; } [Display(Name = "Subscriber full name")] public string FullName { get; set; } [BindProperty] public string NewPlanId { get; set; } [Display(Name = "Offer ID")] public string OfferId { get; set; } public bool PendingOperations { get; set; } [Display(Name = "Current plan")] public string PlanId { get; set; } [JsonConverter(typeof(StringEnumConverter))] public TargetContosoRegionEnum Region { get; set; } [Display(Name = "SaaS Subscription Id")] public Guid SubscriptionId { get; set; } [Display(Name = "Subscription name")] public string SubscriptionName { get; set; } public StatusEnum SubscriptionStatus { get; set; } [Display(Name = "Purchaser email")] public string PurchaserEmail { get; set; } [Display(Name = "Purchaser AAD TenantId")] public Guid PurchaserTenantId { get; set; } } } <|start_filename|>src/Dashboard/DashboardAdminHandler.cs<|end_filename|> namespace Dashboard { using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; public class DashboardAdminHandler : AuthorizationHandler<DashboardAdminRequirement> { protected override Task HandleRequirementAsync( AuthorizationHandlerContext context, DashboardAdminRequirement requirement) { if (context.User == null) return Task.CompletedTask; if (context.User.Identity.GetUserEmail().GetDomainNameFromEmail() == requirement.AdminName.GetDomainNameFromEmail()) context.Succeed(requirement); return Task.CompletedTask; } } }
1iveowl/ContosoAMPBasic
<|start_filename|>lib/src/response.dart<|end_filename|> part of start; class Response { HttpResponse _response; Response(this._response); header(String name, [value]) { if (value == null) { return _response.headers[name]; } _response.headers.set(name, value); return this; } Response get(String name) => header(name); Response set(String name, String value) => header(name, value); Response type(String contentType) => set('Content-Type', contentType); Response cache(String cacheType, [Map<String, String> options]) { if (options == null) { options = {}; } StringBuffer value = new StringBuffer(cacheType); options.forEach((key, val) { value.write(', ${key}=${val}'); }); return set('Cache-Control', value.toString()); } Response status(int code) { _response.statusCode = code; return this; } Response cookie(String name, String val, [Map options]) { var cookie = new Cookie( Uri.encodeQueryComponent(name), Uri.encodeQueryComponent(val)), cookieMirror = reflect(cookie); if (options != null) { options.forEach((option, value) { cookieMirror.setField(new Symbol(option), value); }); } _response.cookies.add(cookie); return this; } Response deleteCookie(String name) { Map options = {'expires': 'Thu, 01-Jan-70 00:00:01 GMT', 'path': '/'}; return cookie(name, '', options); } Response add(String string) { _response.write(string); return this; } Response attachment(String filename) { if (filename != null) { return set('Content-Disposition', 'attachment; filename="${filename}"'); } return this; } Response mime(String path) { var mimeType = lookupMimeType(path); if (mimeType != null) { return type(mimeType); } return this; } Future send(String string) { _response.write(string); return _response.close(); } Future sendFile(String path) { var file = new File(path); return file .exists() .then((found) => found ? found : throw 404) .then((_) => file.length()) .then((length) => header('Content-Length', length)) .then((_) => mime(file.path)) .then((_) => file.openRead().pipe(_response)) .then((_) => _response.close()) .catchError((_) { _response.statusCode = HttpStatus.notFound; return _response.close(); }, test: (e) => e == 404); } Future close() { return _response.close(); } Future json(data) { if (data is Map || data is List) { data = jsonEncode(data); } if (get('Content-Type') == null) { type('application/json'); } return send(data); } Future jsonp(String name, data) { if (data is Map) { data = jsonEncode(data); } return send("$name('$data');"); } Future redirect(String url, [int code = 302]) { _response.statusCode = code; header('Location', url); return _response.close(); } } <|start_filename|>lib/start.dart<|end_filename|> library start; import 'dart:io' hide Socket; import 'dart:async'; import 'dart:convert'; import 'dart:mirrors'; import 'package:logging/logging.dart'; import 'package:http_server/http_server.dart'; import 'package:mime/mime.dart'; import 'src/socket_base.dart'; part 'src/route.dart'; part 'src/request.dart'; part 'src/response.dart'; part 'src/server.dart'; part 'src/socket.dart'; Future<Server> start( {String host: '127.0.0.1', int port: 80, String certificateChain, String privateKey, String password}) { return new Server().listen(host, port, certificateChain: certificateChain, privateKey: privateKey, password: password); } <|start_filename|>test/socket_test.dart<|end_filename|> library socket_test; import 'dart:io' hide Socket; import 'package:test/test.dart'; import 'package:mockito/mockito.dart'; import 'package:start/start.dart'; import 'package:start/src/message.dart'; class MockWebSocket extends Mock implements WebSocket {} void main() { group("Socket", () { MockWebSocket ws; Socket socket; setUp(() { ws = new MockWebSocket(); socket = new Socket(ws); }); test("can send a message", () async { String message = "Test"; socket.send(message); verify(ws.add(message)).called(1); }); test("can send a message with data", () async { String msg_name = "Test"; Map msg_data = { "name": "Bob", "age": 21, "awesome": true, "location": {"city": "Edmonton", "country": "Canada"}, "favourite_things": ['kittens', 'puppies'] }; Message expected_msg = new Message(msg_name, msg_data); socket.send(msg_name, msg_data); verify(ws.add(expected_msg.toPacket())).called(1); }); }); } <|start_filename|>lib/src/message.dart<|end_filename|> library start_message; import 'dart:convert'; class Message { final String name; final Object data; Message(this.name, [this.data]); factory Message.fromPacket(String message) { if (message.isEmpty) { return new Message.empty(); } List<String> parts = message.split(':'); String name = parts.first; var data = null; if (parts.length > 1 && !parts[1].isEmpty) { data = jsonDecode(parts.sublist(1).join(':')); } return new Message(name, data); } Message.empty() : this(''); String toPacket() { if (data == null) { return name; } return '$name:${jsonEncode(data)}'; } }
lvivski/start
<|start_filename|>lib/Layouts/BasicLayout.dart<|end_filename|> import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import '../config/app_config.dart'; class BasicLayout extends StatelessWidget { BasicLayout({ Key key, @required this.child, this.designSize, }) : super(key: key); final Widget child; final Size designSize; @override Widget build(BuildContext context) { return ScreenUtilInit( designSize: designSize ?? AppConfig.screenSize, builder: () { return child; }, ); } } <|start_filename|>lib/pages/SplashPage/SplashPage.dart<|end_filename|> import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import '../../constants/cache_constants.dart'; import '../../routes/routeName.dart'; import '../../config/app_config.dart' show AppConfig; import '../../utils/tool/sp_util.dart'; import 'components/AdPage.dart'; import 'components/WelcomePage.dart'; /// 闪屏页。 class SplashPage extends StatefulWidget { SplashPage({Key key}) : super(key: key); @override _SplashPageState createState() => _SplashPageState(); } class _SplashPageState extends State<SplashPage> { Widget child; @override void initState() { super.initState(); SystemChrome.setEnabledSystemUIOverlays([]); _initAsync(); } @override void dispose() { SystemChrome.setEnabledSystemUIOverlays(SystemUiOverlay.values); super.dispose(); } _initAsync() async { var isNew = await SpUtil.getData<bool>(CacheConstants.guideKey, defValue: !AppConfig.isShowWelcome); setState(() { /// 是否显示引导页。 if (isNew) { SpUtil.setData(CacheConstants.guideKey, false); child = WelcomePage(); } else { child = AdPage(); } }); /// 调试阶段,直接跳过此组件 if (AppConfig.notSplash) { Navigator.pushReplacementNamed(context, RouteName.appMain); } } @override Widget build(BuildContext context) { return Scaffold( body: child, resizeToAvoidBottomInset: false, ); } } <|start_filename|>lib/services/common_service.dart<|end_filename|> import '../utils/request.dart'; /// 请求示例 Future getDemo() async { return Request.get( '/api', queryParameters: {'key': 'value'}, ); } Future postDemo() async { return Request.post('/api', data: {}); } Future putDemo() async { return Request.put('/api', data: {}); } /// 获取APP最新版本号, 演示更新APP组件 Future<Map> getNewVersion([String version]) async { Map resData = { "code": "0", "message": "success", "data": { "version": "2.2.4", "info": ["修复bug提升性能", "增加彩蛋有趣的功能页面", "测试功能"] } }; // TODO: 替换为你的真实请求接口,并返回数据,此处演示直接返回数据 // Map res = await Request.get( // '/api', // queryParameters: {'key': 'value'}, // ).catchError((e) => resData); return resData['data'] ?? {}; } <|start_filename|>lib/utils/dio/interceptors/log_interceptor.dart<|end_filename|> import 'dart:io'; import 'package:dio/dio.dart'; import '../../../config/app_config.dart'; import '../dioErrorUtil.dart'; /* * Log 拦截器 */ class LogsInterceptors extends InterceptorsWrapper { // 请求拦截 @override onRequest(RequestOptions options, handler) async { if (AppConfig.DEBUG) { print( """请求url:${options.baseUrl + options.path}\n请求类型:${options.method}\n请求头:${options.headers.toString()}"""); if (options.data != null) { print('请求参数: ' + options.data.toString()); } } return handler.next(options); } // 响应拦截 @override onResponse(Response response, handler) async { if (AppConfig.DEBUG) { if (response != null) { print('返回参数: ' + response.toString()); } } return handler.next(response); } // 请求失败拦截 @override onError(DioError e, handler) async { if (AppConfig.DEBUG) { print('请求异常: ' + e.toString()); print('请求异常信息: ' + e.response?.toString() ?? ""); } // throw HttpException(DioErrorUtil.handleError(e)); return handler.next(e); } }
qewqewzzz/flutter_flexible
<|start_filename|>src/test/resources/actions/sort/method_call_after.groovy<|end_filename|> dependencies { compile files(org.gradle.internal.jvm.Jvm.current().getToolsJar()) compile fileTree(dir: 'libs', include: '*.jar') compile project(':core') } <|start_filename|>src/test/java/com/github/platan/idea/dependencies/MavenToGradleDependenciesCopyPasteProcessorTest.java<|end_filename|> package com.github.platan.idea.dependencies; import static com.intellij.openapi.actionSystem.IdeActions.ACTION_EDITOR_PASTE; import com.intellij.codeInsight.editorActions.PasteHandler; import com.intellij.ide.DataManager; import com.intellij.openapi.actionSystem.DataContext; import com.intellij.openapi.command.WriteCommandAction; import com.intellij.openapi.editor.actionSystem.EditorActionHandler; import com.intellij.openapi.editor.actionSystem.EditorActionManager; import com.intellij.openapi.fileTypes.FileTypeManager; import com.intellij.testFramework.fixtures.LightPlatformCodeInsightFixtureTestCase; import com.intellij.util.Producer; import org.jetbrains.plugins.groovy.GroovyFileType; import java.awt.Component; import java.awt.datatransfer.StringSelection; import java.awt.datatransfer.Transferable; public class MavenToGradleDependenciesCopyPasteProcessorTest extends LightPlatformCodeInsightFixtureTestCase { @Override protected void setUp() throws Exception { super.setUp(); WriteCommandAction.runWriteCommandAction(this.getProject(), () -> { FileTypeManager fileTypeManager = FileTypeManager.getInstance(); fileTypeManager.associateExtension(GroovyFileType.GROOVY_FILE_TYPE, "gradle"); }); } public void test__convert_maven_to_gradle_while_pasting_to_build_gradle() { myFixture.configureByText("build.gradle", "<caret>"); String toPaste = "<dependency>\n" + " <groupId>org.apache.maven</groupId>\n" + " <artifactId>maven-embedder</artifactId>\n" + " <version>2.0</version>\n" + " <exclusions>\n" + " <exclusion>\n" + " <groupId>org.apache.maven</groupId>\n" + " <artifactId>maven-core</artifactId>\n" + " </exclusion>\n" + " </exclusions>\n" + "</dependency>"; runPasteAction(toPaste); myFixture.checkResult("compile('org.apache.maven:maven-embedder:2.0') {\n" + " exclude group: 'org.apache.maven', module: 'maven-core'\n" + "}"); } public void test__convert_maven_to_gradle_while_pasting_to_any_gradle_file() { myFixture.configureByText("download.gradle", "<caret>"); String toPaste = "<dependency>\n" + "\t<groupId>org.spockframework</groupId>\n" + "\t<artifactId>spock-core</artifactId>\n" + "\t<version>1.0-groovy-2.4</version>\n" + "</dependency>"; runPasteAction(toPaste); myFixture.checkResult("compile 'org.spockframework:spock-core:1.0-groovy-2.4'"); } public void test__do_not_convert_maven_to_gradle_while_pasting_to_non_gradle_file() { myFixture.configureByText("Test.groovy", "<caret>"); String toPaste = "<dependency>\n" + "\t<groupId>org.spockframework</groupId>\n" + "\t<artifactId>spock-core</artifactId>\n" + "\t<version>1.0-groovy-2.4</version>\n" + "</dependency>"; runPasteAction(toPaste); myFixture.checkResult("<dependency>\n" + " <groupId>org.spockframework</groupId>\n" + "\t<artifactId>spock-core</artifactId>\n" + " <version>1.0-groovy-2.4</version>\n" + "</dependency>"); } private void runPasteAction(final String toPaste) { final Producer<Transferable> producer = () -> new StringSelection(toPaste); EditorActionManager actionManager = EditorActionManager.getInstance(); EditorActionHandler pasteActionHandler = actionManager.getActionHandler(ACTION_EDITOR_PASTE); final PasteHandler pasteHandler = new PasteHandler(pasteActionHandler); WriteCommandAction.runWriteCommandAction(getProject(), () -> { Component component = myFixture.getEditor().getComponent(); DataContext dataContext = DataManager.getInstance().getDataContext(component); pasteHandler.execute(myFixture.getEditor(), dataContext, producer); }); } } <|start_filename|>src/test/java/com/github/platan/idea/dependencies/maven/MavenDependencyBuilder.java<|end_filename|> package com.github.platan.idea.dependencies.maven; import java.util.ArrayList; import java.util.List; public class MavenDependencyBuilder { private String groupId; private String artifactId; private String version; private Scope scope = Scope.COMPILE; private List<MavenExclusion> exclusionList = new ArrayList<MavenExclusion>(); public static MavenDependencyBuilder aMavenDependency(String groupId, String artifactId, String version) { return new MavenDependencyBuilder().withGroupId(groupId).withArtifactId(artifactId).withVersion(version); } public MavenDependencyBuilder withGroupId(String groupId) { this.groupId = groupId; return this; } public MavenDependencyBuilder withArtifactId(String artifactId) { this.artifactId = artifactId; return this; } public MavenDependencyBuilder withVersion(String version) { this.version = version; return this; } public MavenDependencyBuilder withScope(Scope scope) { this.scope = scope; return this; } public MavenDependencyBuilder withExclusionList(List<MavenExclusion> exclusionList) { this.exclusionList = exclusionList; return this; } public MavenDependency build() { MavenDependency mavenDependency = new MavenDependency(); mavenDependency.setGroupId(groupId); mavenDependency.setArtifactId(artifactId); mavenDependency.setVersion(version); mavenDependency.setScope(scope); mavenDependency.setExclusions(exclusionList); return mavenDependency; } } <|start_filename|>src/main/java/com/github/platan/idea/dependencies/intentions/StringNotationToMapNotationIntention.java<|end_filename|> package com.github.platan.idea.dependencies.intentions; import com.github.platan.idea.dependencies.gradle.Coordinate; import com.intellij.openapi.editor.Editor; import com.intellij.openapi.project.Project; import com.intellij.psi.PsiElement; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.plugins.groovy.intentions.base.PsiElementPredicate; import org.jetbrains.plugins.groovy.lang.psi.GroovyPsiElementFactory; import org.jetbrains.plugins.groovy.lang.psi.api.statements.arguments.GrArgumentList; import org.jetbrains.plugins.groovy.lang.psi.api.statements.arguments.GrNamedArgument; import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrMethodCall; import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.literals.GrLiteral; import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.literals.GrString; import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.literals.GrStringInjection; import static com.github.platan.idea.dependencies.gradle.Coordinate.isStringNotationCoordinate; import static org.jetbrains.plugins.groovy.lang.psi.util.ErrorUtil.containsError; import static org.jetbrains.plugins.groovy.lang.psi.util.GrStringUtil.DOUBLE_QUOTES; import static org.jetbrains.plugins.groovy.lang.psi.util.GrStringUtil.TRIPLE_DOUBLE_QUOTES; import static org.jetbrains.plugins.groovy.lang.psi.util.GrStringUtil.escapeAndUnescapeSymbols; import static org.jetbrains.plugins.groovy.lang.psi.util.GrStringUtil.getStartQuote; import static org.jetbrains.plugins.groovy.lang.psi.util.GrStringUtil.isStringLiteral; import static org.jetbrains.plugins.groovy.lang.psi.util.GrStringUtil.removeQuotes; public class StringNotationToMapNotationIntention extends SelectionIntention<GrMethodCall> { @Override protected void processIntention(@NotNull PsiElement element, @NotNull Project project, Editor editor) { GrMethodCall found = findElement(element, GrMethodCall.class); PsiElement firstArgument = getFirstArgument(found); if (firstArgument == null) { return; } String quote = getStartQuote(firstArgument.getText()); String stringNotation = removeQuotes(firstArgument.getText()); String mapNotation = Coordinate.parse(stringNotation).toMapNotation(quote); GrArgumentList argumentList = GroovyPsiElementFactory.getInstance(project).createArgumentListFromText(mapNotation); if (isInterpolableString(quote)) { replaceGStringMapValuesToString(argumentList, project); } GrMethodCall callCopy = (GrMethodCall) found.copy(); PsiElement copyFirstArgument = callCopy.getArgumentList().getAllArguments()[0]; for (GrNamedArgument namedArgument : argumentList.getNamedArguments()) { callCopy.addNamedArgument(namedArgument); } copyFirstArgument.delete(); found.replace(callCopy); } @Nullable private PsiElement getFirstArgument(@Nullable GrMethodCall element) { if (element == null) { return null; } if (element.getArgumentList().getAllArguments().length == 0) { return null; } return element.getArgumentList().getAllArguments()[0]; } private boolean isInterpolableString(String quote) { return quote.equals(DOUBLE_QUOTES) || quote.equals(TRIPLE_DOUBLE_QUOTES); } private void replaceGStringMapValuesToString(GrArgumentList map, Project project) { for (PsiElement psiElement : map.getChildren()) { PsiElement lastChild = psiElement.getLastChild(); if (lastChild instanceof GrString && lastChild.getChildren().length == 1 && lastChild.getChildren()[0] instanceof GrStringInjection) { GrStringInjection child = (GrStringInjection) lastChild.getChildren()[0]; if (child.getClosableBlock() == null && child.getExpression() != null) { String text = child.getExpression().getText(); lastChild.replace(GroovyPsiElementFactory.getInstance(project).createExpressionFromText(text)); } } if (lastChild instanceof GrLiteral && !(lastChild instanceof GrString)) { String stringWithoutQuotes = removeQuotes(lastChild.getText()); String unescaped = escapeAndUnescapeSymbols(stringWithoutQuotes, "", "\"$", new StringBuilder()); String string = String.format("'%s'", unescaped); lastChild.replace(GroovyPsiElementFactory.getInstance(project).createExpressionFromText(string)); } } } @NotNull @Override protected PsiElementPredicate getElementPredicate() { return element -> { GrMethodCall found = findElement(element, GrMethodCall.class); PsiElement firstArgument = getFirstArgument(found); if (firstArgument == null) { return false; } return firstArgument instanceof GrLiteral && !found.getInvokedExpression().getText().equals("project") && !containsError(firstArgument) && isStringLiteral((GrLiteral) firstArgument) && isStringNotationCoordinate(removeQuotes(firstArgument.getText())); }; } private <T> T findElement(PsiElement element, Class<T> aClass) { if (aClass.isInstance(element)) { return aClass.cast(element); } if (element.getParent() != null && aClass.isInstance(element.getParent().getParent())) { return aClass.cast(element.getParent().getParent()); } return null; } @NotNull @Override public String getText() { return "Convert to map notation"; } @NotNull @Override public String getFamilyName() { return "Convert string notation to map notation"; } @Override protected Class<GrMethodCall> elementTypeToFindInSelection() { return GrMethodCall.class; } } <|start_filename|>src/test/resources/intentions/mapNotationToStringNotation/convert_dependency_with_closure_after.groovy<|end_filename|> dependencies { compile ('com.google.guava:guava:18.0') { transitive = false } } <|start_filename|>src/test/resources/intentions/stringNotationToMapNotation/convert_gstring_with_escaped_character_after.groovy<|end_filename|> dependencies { compile group: 'com.google.guava', name: 'guava', version: '$guavaVersion' } <|start_filename|>src/test/resources/intentions/mapNotationToStringNotation/convert_gstring_with_special_characters.groovy<|end_filename|> dependencies { compile group: '<caret>com.google.guava', name: 'guava', version: "\$guavaVersion" } <|start_filename|>src/test/resources/actions/sort/dependency_list.groovy<|end_filename|> dependencies { compile 'group2:name1:1' compile 'group5:name1:1' compile 'group3:name1:1', 'group2:name2:1' compile 'group4:name1:1', 'group3:name2:1' compile group: 'group6', name: 'name1', version: '1' compile group: 'group1', name: 'name1', version: '1' } <|start_filename|>src/test/groovy/com/github/platan/idea/dependencies/sort/SortDependenciesTest.groovy<|end_filename|> package com.github.platan.idea.dependencies.sort import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase class SortDependenciesTest extends LightCodeInsightFixtureTestCase { @Override protected String getTestDataPath() { this.getClass().getResource('/actions/sort/').path } void test__already_sorted() { doTest() } void test__simple() { doTest() } void test__ignore_quotation_mark() { doTest() } void test__by_configuration_name() { doTest() } void test__with_comments() { doTest() } void test__remove_empty_lines() { doTest() } void test__with_closure() { doTest() } void test__with_variable() { doTest() } void test__with_method() { doTest() } void test__map_notation() { doTest() } void test__with_quotation_mark() { doTest() } void test__with_escaped_characters() { doTest() } void test__dependency_list() { doTest() } void test__variables() { doTest() } void test__method_call() { doTest() } void test__empty_dependencies_block() { doTest() } void test__empty_file() { doTest() } void test__invalid() { doTest() } void test__build_dependencies_simple() { doTest() } void test__allprojects_dependencies_simple() { doTest() } void test__many_dependencies_blocks() { doTest() } void test__unknown_parent_block() { doTest() } void test__do_not_sort_dependencies_in_block_not_named_dependencies() { doTest() } private doTest() { def fileName = getTestName(false).replaceFirst('__', '') myFixture.configureByFile("${fileName}.groovy") SortDependenciesAction action = new SortDependenciesAction() action.handler.invoke(project, editor, file) myFixture.checkResultByFile("${fileName}_after.groovy") } } <|start_filename|>src/main/java/com/github/platan/idea/dependencies/gradle/Exclusion.java<|end_filename|> package com.github.platan.idea.dependencies.gradle; import com.google.common.base.Objects; public final class Exclusion { private final String group; private final String module; public Exclusion(String group, String module) { this.group = group; this.module = module; } public String getGroup() { return group; } public String getModule() { return module; } @Override public int hashCode() { return Objects.hashCode(group, module); } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null || getClass() != obj.getClass()) { return false; } final Exclusion other = (Exclusion) obj; return Objects.equal(this.group, other.group) && Objects.equal(this.module, other.module); } @Override public String toString() { return "Exclusion{" + "group='" + group + '\'' + ", module='" + module + '\'' + '}'; } } <|start_filename|>src/test/java/com/github/platan/idea/dependencies/gradle/DependencyBuilder.java<|end_filename|> package com.github.platan.idea.dependencies.gradle; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; public class DependencyBuilder { private String group; private String name; private String version; private String classifier = null; private String configuration; private List<Exclusion> exclusions = new ArrayList<Exclusion>(); private boolean transitive = true; private Map<String, String> extraOptions = new HashMap<String, String>(); private boolean optional; private DependencyBuilder() { } public static DependencyBuilder aDependency(String group, String name) { return new DependencyBuilder().withGroup(group).withName(name); } public DependencyBuilder withGroup(String group) { this.group = group; return this; } public DependencyBuilder withName(String name) { this.name = name; return this; } public DependencyBuilder withVersion(String version) { this.version = version; return this; } public DependencyBuilder withClassifier(String classifier) { this.classifier = classifier; return this; } public DependencyBuilder withConfiguration(String configuration) { this.configuration = configuration; return this; } public DependencyBuilder withExclusions(List<Exclusion> exclusions) { this.exclusions = exclusions; return this; } public DependencyBuilder withTransitive(boolean transitive) { this.transitive = transitive; return this; } public DependencyBuilder withExtraOption(String extraOptionKey, String extraOptionValue) { this.extraOptions.put(extraOptionKey, extraOptionValue); return this; } public DependencyBuilder withOptional(boolean optional) { this.optional = optional; return this; } public Dependency build() { return new Dependency(group, name, version, classifier, configuration, exclusions, transitive, extraOptions, optional); } } <|start_filename|>src/test/groovy/com/github/platan/idea/dependencies/gradle/CoordinateTest.groovy<|end_filename|> package com.github.platan.idea.dependencies.gradle import static com.github.platan.idea.dependencies.gradle.Coordinate.CoordinateBuilder.aCoordinate import spock.lang.Specification import spock.lang.Unroll class CoordinateTest extends Specification { @Unroll def 'parse #stringNotation'() { expect: Coordinate.isStringNotationCoordinate(stringNotation) and: Coordinate.parse(stringNotation).equals(dependency) where: stringNotation | dependency ':guava' | aCoordinate('guava').build() ':guava:' | aCoordinate('guava').build() 'com.google.guava:guava' | aCoordinate('guava').withGroup('com.google.guava').build() 'com.google.guava:guava:' | aCoordinate('guava').withGroup('com.google.guava').build() ':guava:18.0' | aCoordinate('guava').withVersion('18.0').build() 'com.google.guava:guava:18.0' | aCoordinate('guava').withGroup('com.google.guava') .withVersion('18.0').build() ':guava:18.0' | aCoordinate('guava').withVersion('18.0').build() 'com.google.guava:guava:18.0:sources' | aCoordinate('guava').withGroup('com.google.guava') .withVersion('18.0').withClassifier('sources').build() 'com.google.guava:guava::sources' | aCoordinate('guava').withGroup('com.google.guava') .withClassifier('sources').build() ':guava::sources' | aCoordinate('guava').withClassifier('sources').build() 'com.google.guava:guava:18.0:sources@jar' | aCoordinate('guava').withGroup('com.google.guava') .withVersion('18.0').withClassifier('sources').withExtension('jar').build() 'com.google.guava:guava:18.0:@jar' | aCoordinate('guava').withGroup('com.google.guava') .withVersion('18.0').withExtension('jar').build() 'com.google.guava:guava:18.0@jar' | aCoordinate('guava').withGroup('com.google.guava') .withVersion('18.0').withExtension('jar').build() ':guava:18.0@jar' | aCoordinate('guava').withVersion('18.0').withExtension('jar').build() ':guava@jar' | aCoordinate('guava').withExtension('jar').build() ':guava:@jar' | aCoordinate('guava').withExtension('jar').build() ':guava:18.0:@jar' | aCoordinate('guava').withVersion('18.0').withExtension('jar').build() 'com.google.guava:guava::@jar' | aCoordinate('guava').withGroup('com.google.guava') .withExtension('jar').build() } @Unroll def 'cannot create coordinate from "#invalidStringCoordinate"'() { when: Coordinate.parse(invalidStringCoordinate) then: thrown IllegalArgumentException where: invalidStringCoordinate | _ ' ' | _ ':' | _ 'guava' | _ 'com.google.guava::18.0' | _ 'com.google.guava::' | _ '::18.0' | _ } @Unroll def '#dependency is not parsable'() { expect: !Coordinate.isStringNotationCoordinate(dependency) where: dependency | _ ' ' | _ ':' | _ 'guava' | _ 'com.google.guava::18.0' | _ 'com.google.guava::' | _ '::18.0' | _ } def 'convert to map notation'() { given: def coordinate = aCoordinate('guava') .withGroup('com.google.guava') .withVersion('18.0') .withClassifier('sources') .withExtension('jar').build() expect: coordinate.toMapNotation("'") == "group: 'com.google.guava', name: 'guava', version: '18.0', classifier: 'sources', ext: 'jar'" } def "build from map"() { given: def coordinateMap = [group: 'com.google.guava', name: 'guava', version: '18.0', classifier: 'sources', ext: 'jar'] when: def coordinate = Coordinate.fromMap(coordinateMap) then: with(coordinate) { name == 'guava' group == Optional.of('com.google.guava') version == Optional.of('18.0') classifier == Optional.of('sources') extension == Optional.of('jar') } } } <|start_filename|>src/test/resources/actions/sort/with_escaped_characters.groovy<|end_filename|> dependencies { compile group: "group\$", name: 'name', version: '14' compile group: 'group$', name: 'name', version: '11' compile "group\$:name:12" compile "group\$:name:16" { transitive = false } compile group: 'group$', name: 'name', version: '17' compile 'group$:name:13' compile 'group$:name:21' { transitive = false } compile "group\$:name:18" compile "group\$:name:22" { transitive = false } compile 'group$:name:19' compile 'group$:name:15' { transitive = false } compile group: "group\$", name: 'name', version: '20' } <|start_filename|>src/test/resources/actions/sort/unknown_parent_block_after.groovy<|end_filename|> myprojects { dependencies { compile 'com.google.guava:guava:18.0' compile 'junit:junit:4.11' } } <|start_filename|>src/test/resources/actions/sort/variables.groovy<|end_filename|> dependencies { compile dependencies.picasso compile dependencies.rxAndroid compile dependencies.circleImageView } <|start_filename|>src/main/java/com/github/platan/idea/dependencies/maven/MavenDependenciesDeserializerImpl.java<|end_filename|> package com.github.platan.idea.dependencies.maven; import jakarta.xml.bind.JAXBContext; import jakarta.xml.bind.JAXBException; import jakarta.xml.bind.Unmarshaller; import org.jetbrains.annotations.NotNull; import org.w3c.dom.Document; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.xml.sax.SAXException; import org.xml.sax.SAXParseException; import javax.xml.XMLConstants; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import javax.xml.validation.Schema; import javax.xml.validation.SchemaFactory; import javax.xml.xpath.XPath; import javax.xml.xpath.XPathConstants; import javax.xml.xpath.XPathExpression; import javax.xml.xpath.XPathExpressionException; import javax.xml.xpath.XPathFactory; import java.io.ByteArrayInputStream; import java.io.IOException; import java.net.URL; import java.util.ArrayList; import java.util.List; import static java.nio.charset.StandardCharsets.UTF_8; public class MavenDependenciesDeserializerImpl implements MavenDependenciesDeserializer { @Override @NotNull public List<MavenDependency> deserialize(@NotNull String mavenDependencyXml) throws UnsupportedContentException { String wrapperMavenDependencyXml = wrapWithRoot(mavenDependencyXml); Document doc = parseDocument(wrapperMavenDependencyXml); NodeList nodeList = findNodes(doc); return unmarshall(nodeList); } private String wrapWithRoot(String mavenDependencyXml) { return String.format("<root>%s</root>", mavenDependencyXml); } private Document parseDocument(String wrapperMavenDependencyXml) throws UnsupportedContentException { try { DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); return builder.parse(new ByteArrayInputStream(wrapperMavenDependencyXml.getBytes(UTF_8))); } catch (ParserConfigurationException | SAXException | IOException e) { throw new UnsupportedContentException(); } } private NodeList findNodes(Document doc) throws UnsupportedContentException { XPath xPath = XPathFactory.newInstance().newXPath(); XPathExpression xPathExpression; try { xPathExpression = xPath.compile("/root/dependency | /root/dependencies/dependency"); } catch (XPathExpressionException e) { throw new IllegalStateException("Invalid XPath expression. ", e); } try { return (NodeList) xPathExpression.evaluate(doc, XPathConstants.NODESET); } catch (XPathExpressionException e) { throw new UnsupportedContentException(); } } private List<MavenDependency> unmarshall(NodeList nodeList) throws UnsupportedContentException { Schema schema = getSchema(); try { JAXBContext jaxbContext = JAXBContext.newInstance("com.github.platan.idea.dependencies.maven", this.getClass().getClassLoader()); Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); unmarshaller.setSchema(schema); List<MavenDependency> dependencies = new ArrayList<>(); for (int i = 0; i < nodeList.getLength(); i++) { MavenDependency dependency = unmarshall(nodeList.item(i), unmarshaller); dependencies.add(dependency); } return dependencies; } catch (JAXBException e) { if (e.getLinkedException() instanceof SAXParseException) { throw new DependencyValidationException(e.getLinkedException().getMessage()); } throw new UnsupportedContentException(); } } private MavenDependency unmarshall(Node node, Unmarshaller unmarshaller) throws JAXBException { return (MavenDependency) unmarshaller.unmarshal(node); } private Schema getSchema() { SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); URL resource = this.getClass().getResource("/dependency.xsd"); Schema schema; try { schema = schemaFactory.newSchema(resource); } catch (SAXException e) { throw new IllegalStateException(e); } return schema; } } <|start_filename|>src/test/groovy/com/github/platan/idea/dependencies/maven/MavenDependenciesDeserializerImplTest.groovy<|end_filename|> package com.github.platan.idea.dependencies.maven import static com.github.platan.idea.dependencies.maven.MavenDependencyBuilder.aMavenDependency import spock.lang.Specification import spock.lang.Unroll class MavenDependenciesDeserializerImplTest extends Specification { private MavenDependenciesDeserializer mavenDependencyParser = new MavenDependenciesDeserializerImpl() def 'parse one dependency with default scope'() { given: def mavenDependency = """<dependency> <groupId>org.spockframework</groupId> <artifactId>spock-core</artifactId> <version>1.0-groovy-2.4</version> </dependency>""" when: def dependencies = mavenDependencyParser.deserialize(mavenDependency) then: dependencies == [aMavenDependency('org.spockframework', 'spock-core', '1.0-groovy-2.4').withScope(Scope.COMPILE).build()] } def 'parse one dependency with exclusions'() { given: def mavenDependency = """<dependency> <groupId>org.spockframework</groupId> <artifactId>spock-core</artifactId> <version>1.0-groovy-2.4</version> <exclusions> <exclusion> <groupId>org.codehaus.groovy</groupId> <artifactId>groovy-all</artifactId> </exclusion> </exclusions> </dependency>""" when: def dependencies = mavenDependencyParser.deserialize(mavenDependency) then: dependencies == [aMavenDependency('org.spockframework', 'spock-core', '1.0-groovy-2.4') .withExclusionList([new MavenExclusion('org.codehaus.groovy', 'groovy-all')]).build()] } @Unroll def 'parse one dependency with scope #scope'() { given: def mavenDependency = """<dependency> <groupId>org.spockframework</groupId> <artifactId>spock-core</artifactId> <version>1.0-groovy-2.4</version> <scope>${scope}</scope> </dependency>""" when: def dependencies = mavenDependencyParser.deserialize(mavenDependency) then: dependencies == [aMavenDependency('org.spockframework', 'spock-core', '1.0-groovy-2.4').withScope(expextedScope).build()] where: scope || expextedScope 'compile' || Scope.COMPILE 'provided' || Scope.PROVIDED 'runtime' || Scope.RUNTIME 'test' || Scope.TEST 'system' || Scope.SYSTEM } def 'throw exception for dependency with invalid scope'() { given: def mavenDependency = """<dependency> <groupId>org.spockframework</groupId> <artifactId>spock-core</artifactId> <version>1.0-groovy-2.4</version> <scope>_unsupported_</scope> </dependency>""" when: mavenDependencyParser.deserialize(mavenDependency) then: thrown Exception } def 'throw exception for dependency with duplicated groupId'() { given: def mavenDependency = """<dependency> <groupId>org.spockframework</groupId> <groupId>org.spockframework</groupId> <artifactId>spock-core</artifactId> <version>1.0-groovy-2.4</version> </dependency>""" when: mavenDependencyParser.deserialize(mavenDependency) then: thrown DependencyValidationException } def 'throw exception for dependency without groupId'() { given: def mavenDependency = """<dependency> <artifactId>spock-core</artifactId> <version>1.0-groovy-2.4</version> </dependency>""" when: mavenDependencyParser.deserialize(mavenDependency) then: thrown DependencyValidationException } def 'parse two dependencies'() { given: def mavenDependencies = """<dependency> <groupId>org.spockframework</groupId> <artifactId>spock-core</artifactId> <version>1.0-groovy-2.4</version> </dependency> <dependency> <groupId>org.codehaus.groovy</groupId> <artifactId>groovy-all</artifactId> <version>2.3.11</version> </dependency>""" when: def dependencies = mavenDependencyParser.deserialize(mavenDependencies) then: dependencies == [aMavenDependency('org.spockframework', 'spock-core', '1.0-groovy-2.4').build(), aMavenDependency('org.codehaus.groovy', 'groovy-all', '2.3.11').build()] } def 'parse two dependencies nested in dependencies element'() { given: def mavenDependencies = """<dependencies> <dependency> <groupId>org.spockframework</groupId> <artifactId>spock-core</artifactId> <version>1.0-groovy-2.4</version> </dependency> <dependency> <groupId>org.codehaus.groovy</groupId> <artifactId>groovy-all</artifactId> <version>2.3.11</version> </dependency> </dependencies>""" when: def dependencies = mavenDependencyParser.deserialize(mavenDependencies) then: dependencies == [aMavenDependency('org.spockframework', 'spock-core', '1.0-groovy-2.4').build(), aMavenDependency('org.codehaus.groovy', 'groovy-all', '2.3.11').build()] } } <|start_filename|>src/main/java/com/github/platan/idea/dependencies/maven/DependencyValidationException.java<|end_filename|> package com.github.platan.idea.dependencies.maven; public class DependencyValidationException extends RuntimeException { public DependencyValidationException(String message) { super(message); } } <|start_filename|>src/test/resources/intentions/mapNotationToStringNotation/convert_interpolated_string_and_string_with_special_character_after.groovy<|end_filename|> dependencies { compile "com.google.guava:\$guava:$guavaVersion" } <|start_filename|>src/test/resources/actions/sort/map_notation.groovy<|end_filename|> dependencies { compile "com.android.support:gridlayout-v7:21.0.2" compile group: 'com.android.support', name: 'cardview-v7', version: '21.0.2' compile group: 'com.android.support', name: 'support-v4', version: '21.0.2' } <|start_filename|>src/main/java/com/github/platan/idea/dependencies/maven/MavenExclusion.java<|end_filename|> package com.github.platan.idea.dependencies.maven; import com.google.common.base.Objects; public class MavenExclusion { private String groupId; private String artifactId; public MavenExclusion() { } public MavenExclusion(String groupId, String artifactId) { this.groupId = groupId; this.artifactId = artifactId; } public String getGroupId() { return groupId; } public void setGroupId(String groupId) { this.groupId = groupId; } public String getArtifactId() { return artifactId; } public void setArtifactId(String artifactId) { this.artifactId = artifactId; } @Override public int hashCode() { return Objects.hashCode(groupId, artifactId); } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null || getClass() != obj.getClass()) { return false; } final MavenExclusion other = (MavenExclusion) obj; return Objects.equal(this.groupId, other.groupId) && Objects.equal(this.artifactId, other.artifactId); } @Override public String toString() { return "MavenExclusion{" + "groupId='" + groupId + '\'' + ", artifactId='" + artifactId + '\'' + '}'; } } <|start_filename|>src/test/resources/intentions/mapNotationToStringNotation/convert_dependency_with_closure.groovy<|end_filename|> dependencies { compile (group: '<caret>com.google.guava', name: 'guava', version: '18.0') { transitive = false } } <|start_filename|>src/test/groovy/com/github/platan/idea/dependencies/intentions/MapNotationToStringNotationIntentionTest.groovy<|end_filename|> package com.github.platan.idea.dependencies.intentions class MapNotationToStringNotationIntentionTest extends IntentionTestBase { @Override protected String getTestDataPath() { this.getClass().getResource('/intentions/mapNotationToStringNotation/').path } MapNotationToStringNotationIntentionTest() { super('Convert to string notation') } void test_convert_map_notation_without_version() { doTextTest('''dependencies { compile group:<caret> 'com.google.guava', name: 'guava' }''', '''dependencies { compile 'com.google.guava:guava' }''') } void test_convert_multiple_map_notation() { doTextTest('''dependencies { <selection><caret>compile (group: 'com.google.guava', name: 'guava', version: '18.0') { transitive = false } testCompile group: 'junit', name: 'junit', version: '4.13'</selection> }''', '''dependencies { compile ('com.google.guava:guava:18.0') { transitive = false } testCompile 'junit:junit:4.13' }''') } void not_supported_test_convert_transitive_dependency() { doTextTest('''dependencies { runtimeOnly group: 'org.hibernate', name: 'hibernate', version: '3.0.5', transitive: true }''', '''dependencies { runtimeOnly ('org.hibernate:hibernate:3.0.5') { transitive = true } }''') } void test_convert_from_selection_only() { doTextTest('''dependencies { <selection><caret>compile group: 'com.google.guava', name: 'guava', version: '18.0' testCompile group: 'junit', name: 'junit', version: '4.13'</selection> testCompile group: 'org.spockframework', name: 'spock-core', version: '1.3-groovy-2.5' }''', '''dependencies { compile 'com.google.guava:guava:18.0' testCompile 'junit:junit:4.13' testCompile group: 'org.spockframework', name: 'spock-core', version: '1.3-groovy-2.5' }''') } void test_convert_partially_selected_elements() { doTextTest('''dependencies { com<selection><caret>pile group: 'com.google.guava', name: 'guava', version: '18.0' testCompile group: 'junit', name: 'junit', </selection>version: '4.13' testCompile group: 'org.spockframework', name: 'spock-core', version: '1.3-groovy-2.5' }''', '''dependencies { compile 'com.google.guava:guava:18.0' testCompile 'junit:junit:4.13' testCompile group: 'org.spockframework', name: 'spock-core', version: '1.3-groovy-2.5' }''') } void test_convert_map_notation_and_string_notation() { doTextTest('''dependencies { <selection><caret>testCompile 'junit:junit:4.12' testCompile group: 'junit', name: 'junit', version: '4.13'</selection> }''', '''dependencies { testCompile 'junit:junit:4.12' testCompile 'junit:junit:4.13' }''') } void test_convert_optional_dependency() { doTextTest('''dependencies { compile group:<caret> 'com.google.guava', name: 'guava', version: '18.0', optional }''', '''dependencies { compile 'com.google.guava:guava:18.0', optional }''') } void test_convert_dependency_caret_at_configuration() { doTextTest('''dependencies { com<caret>pile group: 'com.google.guava', name: 'guava', version: '18.0' }''', '''dependencies { compile 'com.google.guava:guava:18.0' }''') } void test_convert_map_notation_with_classifier() { doTextTest('''dependencies { compile group:<caret> 'com.google.guava', name: 'guava', version: '18.0', classifier: 'sources' }''', '''dependencies { compile 'com.google.guava:guava:18.0:sources' }''') } void test_convert_map_notation_with_variable_as_a_version() { doTextTest('''dependencies { compile group:<caret> 'com.google.guava', name: 'guava', version: guavaVersion }''', '''dependencies { compile "com.google.guava:guava:$guavaVersion" }''') } void test_convert_map_notation_with_instance_property_as_a_version() { doTextTest('''dependencies { compile group:<caret> 'com.google.guava', name: 'guava', version: versions.guava }''', '''dependencies { compile "com.google.guava:guava:${versions.guava}" }''') } void test_convert_map_notation_with_method_call_as_a_version() { doTextTest('''dependencies { compile group:<caret> 'com.google.guava', name: 'guava', version: guavaVersion() }''', '''dependencies { compile "com.google.guava:guava:${guavaVersion()}" }''') } void test_convert_map_notation_with_primitive_value_as_a_version() { doTextTest('''dependencies { compile group:<caret> 'com.google.guava', name: 'guava', version: 19.0 }''', '''dependencies { compile 'com.google.guava:guava:19.0' }''') } void test_convert_map_notation_with_static_method_call_as_a_version() { doTextTest('''dependencies { compile group:<caret> 'com.google.guava', name: 'guava', version: String.valueOf(19.0) }''', '''dependencies { compile "com.google.guava:guava:${String.valueOf(19.0)}" }''') } void test_convert_map_notation_with_concatenated_strings() { doTextTest('''dependencies { compile group:<caret> 'com.google.guava', name: 'guava', version: '19' + '.' + '0' }''', '''dependencies { compile "com.google.guava:guava:${'19' + '.' + '0'}" }''') } void test_convert_map_notation_with_simple_slashy_string() { doTextTest('''dependencies { compile group:<caret> 'com.google.guava', name: 'guava', version: /19.0/ }''', '''dependencies { compile 'com.google.guava:guava:19.0' }''') } void test_convert_map_notation_with_interpolated_slashy_string() { doTextTest('''dependencies { compile group:<caret> 'com.google.guava', name: 'guava', version: /${19.0}/ }''', '''dependencies { compile "com.google.guava:guava:${19.0}" }''') } void test_convert_map_notation_with_classifier_and_ext() { doTextTest('''dependencies { compile group:<caret> 'com.google.guava', name: 'guava', version: '18.0', classifier: 'sources', ext: 'jar' }''', '''dependencies { compile 'com.google.guava:guava:18.0:sources@jar' }''') } void test_convert_map_notation_with_ext() { doTextTest('''dependencies { compile group:<caret> 'com.google.guava', name: 'guava', version: '18.0', ext: 'jar' }''', '''dependencies { compile 'com.google.guava:guava:18.0@jar' }''') } void test_convert_map_notation_with_caret_after_group_semicolon() { doTextTest('''dependencies { compile group:<caret> 'com.google.guava', name: 'guava', version: '18.0' }''', '''dependencies { compile 'com.google.guava:guava:18.0' }''') } void test_convert_map_notation_with_caret_before_group_semicolon() { doTextTest('''dependencies { compile group<caret>: 'com.google.guava', name: 'guava', version: '18.0' }''', '''dependencies { compile 'com.google.guava:guava:18.0' }''') } void test_convert_map_notation_with_caret_on_group() { doTextTest('''dependencies { compile gro<caret>up: 'com.google.guava', name: 'guava', version: '18.0' }''', '''dependencies { compile 'com.google.guava:guava:18.0' }''') } void test_convert_map_notation_with_caret_on_group_value() { doTextTest('''dependencies { compile group: 'com.go<caret>ogle.guava', name: 'guava', version: '18.0' }''', '''dependencies { compile 'com.google.guava:guava:18.0' }''') } void test_convert_map_notation_with_caret_before_group() { doTextTest('''dependencies { compile <caret>group: 'com.google.guava', name: 'guava', version: '18.0' }''', '''dependencies { compile 'com.google.guava:guava:18.0' }''') } void test_convert_map_notation_with_caret_before_configuration() { doTextTest('''dependencies { <caret>compile group: 'com.google.guava', name: 'guava', version: '18.0' }''', '''dependencies { compile 'com.google.guava:guava:18.0' }''') } void test_convert_map_notation_with_caret_after_configuration() { doTextTest('''dependencies { compile<caret> group: 'com.google.guava', name: 'guava', version: '18.0' }''', '''dependencies { compile 'com.google.guava:guava:18.0' }''') } void test_do_not_find_intention_for_single_argument() { doAntiTest('''dependencies { compile 'gu<caret>ava' }''') } void test_do_not_find_intention_for_map_notation_without_required_elements() { doAntiTest('''dependencies { compile name: '<caret>guava', version: '18.0' }''') } void test_do_not_find_intention_for_map_notation_with_unknown_property() { doAntiTest('''dependencies { compile <caret>group: 'com.google.guava', name: 'guava', version: '18.0', unknownProperty: 'cat' }''') } void test_convert_interpolated_string() { doTest() } void test_convert_string_with_special_characters() { doTest() } void test_convert_interpolated_string_dollar_brackets() { doTest() } void test_convert_gstring_with_special_characters() { doTest() } void test_convert_interpolated_triple_quote_string() { doTest() } void test_convert_dependency_with_closure() { doTest() } } <|start_filename|>src/main/java/com/github/platan/idea/dependencies/maven/MavenToGradleMapperImpl.java<|end_filename|> package com.github.platan.idea.dependencies.maven; import com.github.platan.idea.dependencies.gradle.Dependency; import com.github.platan.idea.dependencies.gradle.Exclusion; import org.jetbrains.annotations.NotNull; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.function.Predicate; import static java.util.stream.Collectors.toList; public class MavenToGradleMapperImpl implements MavenToGradleMapper { private static final String ASTERISK = "*"; private static final Predicate<MavenExclusion> IS_WILDCARD_EXCLUDE = mavenExclusion -> mavenExclusion.getGroupId().equals(ASTERISK) && mavenExclusion.getArtifactId().equals(ASTERISK); private static final String SYSTEM_PATH = "systemPath"; private static final String TYPE = "type"; private static final String TRUE = "true"; @Override @NotNull public Dependency map(@NotNull final MavenDependency mavenDependency) { boolean hasWildcardExclude = mavenDependency.getExclusions().stream() .anyMatch(IS_WILDCARD_EXCLUDE); List<Exclusion> excludes = mavenDependency.getExclusions().stream() .filter(IS_WILDCARD_EXCLUDE.negate()) .map(mavenExclusion -> new Exclusion(mavenExclusion.getGroupId(), mavenExclusion.getArtifactId())) .collect(toList()); boolean transitive = !hasWildcardExclude; Map<String, String> extraOptions = createExtraOptions(mavenDependency); boolean optional = isOptional(mavenDependency); return new Dependency(mavenDependency.getGroupId(), mavenDependency.getArtifactId(), mavenDependency.getVersion(), mavenDependency.getClassifier(), getScope(mavenDependency.getScope()), excludes, transitive, extraOptions, optional); } private HashMap<String, String> createExtraOptions(MavenDependency mavenDependency) { HashMap<String, String> extraOptions = new HashMap<>(); if (mavenDependency.getSystemPath() != null) { extraOptions.put(SYSTEM_PATH, mavenDependency.getSystemPath()); } if (mavenDependency.getType() != null) { extraOptions.put(TYPE, mavenDependency.getType()); } return extraOptions; } private boolean isOptional(MavenDependency mavenDependency) { return isEqualTo(mavenDependency.getOptional(), TRUE); } private boolean isEqualTo(String string1, String string2) { return string1 != null && string1.compareTo(string2) == 0; } private String getScope(Scope scope) { if (scope == Scope.TEST) { return "testCompile"; } else { return scope.toString().toLowerCase(); } } } <|start_filename|>src/test/groovy/com/github/platan/idea/dependencies/intentions/MapNotationToStringNotationIntentionUnitTest.groovy<|end_filename|> package com.github.platan.idea.dependencies.intentions import com.intellij.psi.PsiElement import org.jetbrains.plugins.groovy.intentions.base.PsiElementPredicate import spock.lang.Specification import spock.lang.Subject class MapNotationToStringNotationIntentionUnitTest extends Specification { @Subject private PsiElementPredicate predicate = new MapNotationToStringNotationIntention().elementPredicate def "predicate should handle element with getParent() = null"() { given: def element = Stub(PsiElement) { getParent() >> null } expect: !predicate.satisfiedBy(element) } def "predicate should handle element with getParent().getParent() = null"() { given: def element = Stub(PsiElement) { getParent() >> Stub(PsiElement) { getParent() >> null } } expect: !predicate.satisfiedBy(element) } } <|start_filename|>src/jmh/java/com/github/platan/idea/dependencies/ConverterBenchmark.java<|end_filename|> package com.github.platan.idea.dependencies; import com.github.platan.idea.dependencies.gradle.GradleDependenciesSerializerImpl; import com.github.platan.idea.dependencies.maven.MavenDependenciesDeserializerImpl; import com.github.platan.idea.dependencies.maven.MavenToGradleMapperImpl; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.Scope; import org.openjdk.jmh.annotations.State; @State(Scope.Thread) public class ConverterBenchmark { private final MavenToGradleConverter mavenToGradleConverter = new MavenToGradleConverter(new MavenDependenciesDeserializerImpl(), new GradleDependenciesSerializerImpl(), new MavenToGradleMapperImpl()); private static final String MAVEN_DEPENDENCY = "<dependency>\n" + " <groupId>org.spockframework</groupId>\n" + " <artifactId>spock-core</artifactId>\n" + " <version>1.0-groovy-2.4</version>\n" + " </dependency>"; @Benchmark public void convertBenchmark() { mavenToGradleConverter.convert(MAVEN_DEPENDENCY); } } <|start_filename|>src/test/groovy/com/github/platan/idea/dependencies/gradle/CoordinateComparatorTest.groovy<|end_filename|> package com.github.platan.idea.dependencies.gradle import spock.lang.Specification class CoordinateComparatorTest extends Specification { def "compare by group first"() { expect: Coordinate.parse('a:b') == Coordinate.parse('a:b') Coordinate.parse(':b') == Coordinate.parse(':b') and: Coordinate.parse('a:b') < Coordinate.parse('c:b') and: Coordinate.parse('c:b') > Coordinate.parse('a:b') } def "compare by name after group"() { expect: Coordinate.parse('a:b') == Coordinate.parse('a:b') and: Coordinate.parse('a:b') < Coordinate.parse('a:c') and: Coordinate.parse('a:c') > Coordinate.parse('a:b') } def "compare by version after name"() { expect: Coordinate.parse('a:b:1') == Coordinate.parse('a:b:1') and: Coordinate.parse('a:b:1') < Coordinate.parse('a:b:2') and: Coordinate.parse('a:b:3') > Coordinate.parse('a:b:2') } def "compare by classifier after version"() { expect: Coordinate.parse('g:n:1:a') == Coordinate.parse('g:n:1:a') and: Coordinate.parse('g:n:1:a') < Coordinate.parse('g:n:1:b') and: Coordinate.parse('g:n:1:c') > Coordinate.parse('g:n:1:b') } def "compare by extension after classifier"() { expect: Coordinate.parse('g:n:1:e@a') == Coordinate.parse('g:n:1:e@a') Coordinate.parse('g:n:1:e') == Coordinate.parse('g:n:1:e') and: Coordinate.parse('g:n:1:e@a') < Coordinate.parse('g:n:1:e@b') Coordinate.parse('g:n:1:e@') < Coordinate.parse('g:n:1:e@b') and: Coordinate.parse('g:n:1:e@d') > Coordinate.parse('g:n:1:e@c') Coordinate.parse('g:n:1:e@d') > Coordinate.parse('g:n:1:e@') } } <|start_filename|>src/test/resources/actions/sort/many_dependencies_blocks.groovy<|end_filename|> build { dependencies { compile 'junit:junit:4.11' compile 'com.google.guava:guava:17.0' } } allprojects { dependencies { compile 'junit:junit:4.11' compile 'com.google.guava:guava:18.0' } } subprojects { dependencies { compile 'junit:junit:4.11' compile 'com.google.guava:guava:18.0' } } myprojects { dependencies { compile 'junit:junit:4.11' compile 'com.google.guava:guava:18.0' } } dependencies { compile 'junit:junit:4.11' compile 'com.google.guava:guava:19.0' } <|start_filename|>src/test/resources/intentions/mapNotationToStringNotation/convert_interpolated_string_dollar_brackets_after.groovy<|end_filename|> dependencies { compile "com.google.guava:guava:${guavaVersion}" } <|start_filename|>src/test/resources/actions/sort/with_quotation_mark_after.groovy<|end_filename|> dependencies { compile group: 'com.android.support', name: 'cardview-v7', version: '21.0.2' compile group: 'com.android.support', name: 'cardview-v7', version: "22.0.2" compile group: 'com.android.support', name: 'cardview-v7', version: '''23.0.2''' compile group: 'com.android.support', name: 'cardview-v7', version: """24.0.2""" compile group: 'com.android.support', name: 'cardview-v7', version: $/25.0.2/$ compile group: 'com.android.support', name: 'cardview-v7', version: /26.0.2/ compile 'com.android.support:gridlayout-v7:21.0.2' compile "com.android.support:gridlayout-v7:22.0.2" compile """com.android.support:gridlayout-v7:23.0.2""" compile '''com.android.support:gridlayout-v7:24.0.2''' compile 'com.android.support:gridlayout-v7:25.0.2' } <|start_filename|>src/test/resources/actions/sort/with_variable.groovy<|end_filename|> dependencies { def junitVersion = '4.11' compile "junit:junit:$junitVersion" def guavaVersion = '17.0' compile 'com.google.guava:guava:' + guavaVersion } <|start_filename|>src/main/java/com/github/platan/idea/dependencies/gradle/BaseCoordinate.java<|end_filename|> package com.github.platan.idea.dependencies.gradle; import com.google.common.base.Objects; import org.jetbrains.annotations.Nullable; import java.util.Optional; public abstract class BaseCoordinate<T> { protected static final String NAME_KEY = "name"; protected static final String GROUP_KEY = "group"; protected static final String VERSION_KEY = "version"; protected static final String CLASSIFIER_KEY = "classifier"; protected static final String EXT_KEY = "ext"; protected final T group; protected final T name; protected final T version; protected final T classifier; protected final T extension; public BaseCoordinate(@Nullable T group, T name, @Nullable T version, @Nullable T classifier, @Nullable T extension) { this.group = group; this.name = name; this.version = version; this.classifier = classifier; this.extension = extension; } public Optional<T> getGroup() { return Optional.ofNullable(group); } public T getName() { return name; } public Optional<T> getVersion() { return Optional.ofNullable(version); } public Optional<T> getClassifier() { return Optional.ofNullable(classifier); } public Optional<T> getExtension() { return Optional.ofNullable(extension); } @Override public int hashCode() { return Objects.hashCode(group, name, version, classifier, extension); } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null || getClass() != obj.getClass()) { return false; } final BaseCoordinate<?> other = (BaseCoordinate<?>) obj; return Objects.equal(this.group, other.group) && Objects.equal(this.name, other.name) && Objects.equal(this.version, other.version) && Objects.equal(this.classifier, other.classifier) && Objects.equal(this.extension, other.extension); } @Override public String toString() { return "Coordinate{" + "group=" + group + ", name=" + name + ", version=" + version + ", classifier=" + classifier + ", extension=" + extension + '}'; } } <|start_filename|>src/main/java/com/github/platan/idea/dependencies/intentions/SelectionIntention.java<|end_filename|> package com.github.platan.idea.dependencies.intentions; import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.SelectionModel; import com.intellij.openapi.project.Project; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiFile; import com.intellij.psi.util.PsiTreeUtil; import com.intellij.util.IncorrectOperationException; import org.jetbrains.annotations.NotNull; import org.jetbrains.plugins.groovy.intentions.base.Intention; import java.util.Collection; import java.util.Collections; import static java.util.stream.Collectors.toList; public abstract class SelectionIntention<T extends PsiElement> extends Intention { @Override public void invoke(@NotNull Project project, Editor editor, PsiFile file) throws IncorrectOperationException { if (isAvailableForSelection(project, editor, file)) { getElements(editor, file, elementTypeToFindInSelection()).forEach(element -> processIntention(element, project, editor)); } else if (super.isAvailable(project, editor, file)) { super.invoke(project, editor, file); } } protected abstract Class<T> elementTypeToFindInSelection(); protected boolean isAvailableForSelection(Project project, Editor editor, PsiFile file) { return !getElements(editor, file, elementTypeToFindInSelection()).isEmpty(); } @NotNull private Collection<T> getElements(Editor editor, PsiFile file, Class<T> type) { SelectionModel selectionModel = editor.getSelectionModel(); if (selectionModel.hasSelection()) { int startOffset = selectionModel.getSelectionStart(); int endOffset = selectionModel.getSelectionEnd(); PsiElement startingElement = file.getViewProvider().findElementAt(startOffset, file.getLanguage()); PsiElement endingElement = file.getViewProvider().findElementAt(endOffset - 1, file.getLanguage()); if (startingElement != null && endingElement != null) { if (startingElement == endingElement) { // allow org.jetbrains.plugins.groovy.intentions.base.Intention#isAvailable to handle this case return Collections.emptySet(); } PsiElement commonParent = PsiTreeUtil.findCommonParent(startingElement, endingElement); if (commonParent != null) { return PsiTreeUtil.findChildrenOfType(commonParent, type).stream() .filter(element -> getElementPredicate().satisfiedBy(element)) .filter(element -> { int start = element.getTextOffset(); int end = element.getTextOffset() + element.getTextLength(); return isBetween(start, startOffset, endOffset) || isBetween(end, startOffset, endOffset); }) .collect(toList()); } } } return Collections.emptySet(); } private boolean isBetween(int position, int start, int end) { return position >= start && position <= end; } @Override public boolean isAvailable(@NotNull Project project, Editor editor, PsiFile file) { return isAvailableForSelection(project, editor, file) || super.isAvailable(project, editor, file); } } <|start_filename|>src/main/java/com/github/platan/idea/dependencies/maven/Scope.java<|end_filename|> package com.github.platan.idea.dependencies.maven; import jakarta.xml.bind.annotation.XmlEnum; import jakarta.xml.bind.annotation.XmlEnumValue; @XmlEnum public enum Scope { @XmlEnumValue("compile") COMPILE, @XmlEnumValue("provided") PROVIDED, @XmlEnumValue("runtime") RUNTIME, @XmlEnumValue("test") TEST, @XmlEnumValue("system") SYSTEM } <|start_filename|>src/main/java/com/github/platan/idea/dependencies/gradle/GradleFileUtil.java<|end_filename|> package com.github.platan.idea.dependencies.gradle; import static org.jetbrains.plugins.gradle.util.GradleConstants.SETTINGS_FILE_NAME; import com.intellij.psi.PsiFile; import org.jetbrains.annotations.NotNull; import org.jetbrains.plugins.gradle.util.GradleConstants; public final class GradleFileUtil { private static final String DOT_GRADLE = "." + GradleConstants.EXTENSION; private GradleFileUtil() { } public static boolean isGradleFile(@NotNull PsiFile file) { return file.getName().endsWith(DOT_GRADLE); } public static boolean isSettingGradle(@NotNull PsiFile file) { return file.getName().equals(SETTINGS_FILE_NAME); } } <|start_filename|>src/test/groovy/com/github/platan/idea/dependencies/MavenToGradleConverterTest.groovy<|end_filename|> package com.github.platan.idea.dependencies import com.github.platan.idea.dependencies.gradle.GradleDependenciesSerializerImpl import com.github.platan.idea.dependencies.maven.MavenDependenciesDeserializerImpl import com.github.platan.idea.dependencies.maven.MavenToGradleMapperImpl import spock.lang.Specification class MavenToGradleConverterTest extends Specification { private MavenToGradleConverter mavenToGradleConverter = new MavenToGradleConverter(new MavenDependenciesDeserializerImpl(), new GradleDependenciesSerializerImpl(), new MavenToGradleMapperImpl()) def 'xml with one dependency to gradle dsl'() { given: def mavenDependency = """<dependency> <groupId>org.spockframework</groupId> <artifactId>spock-core</artifactId> <version>1.0-groovy-2.4</version> </dependency> """ expect: mavenToGradleConverter.convert(mavenDependency) == "compile 'org.spockframework:spock-core:1.0-groovy-2.4'" } def 'convert maven dependency with variable for version'() { given: def mavenDependency = """<dependency> <groupId>org.spockframework</groupId> <artifactId>spock-core</artifactId> <version>\${version.spock}</version> </dependency> """ expect: mavenToGradleConverter.convert(mavenDependency) == 'compile "org.spockframework:spock-core:\${version.spock}"' } def 'convert maven dependency without version'() { given: def mavenDependency = """<dependency> <groupId>org.spockframework</groupId> <artifactId>spock-core</artifactId> </dependency> """ expect: mavenToGradleConverter.convert(mavenDependency) == "compile 'org.spockframework:spock-core'" } def 'convert maven dependency with classifier'() { given: def mavenDependency = """<dependency> <groupId>com.carrotsearch</groupId> <artifactId>hppc</artifactId> <version>0.5.4</version> <classifier>jdk15</classifier> </dependency> """ expect: mavenToGradleConverter.convert(mavenDependency) == "compile 'com.carrotsearch:hppc:0.5.4:jdk15'" } def 'convert maven dependency with optional'() { given: def mavenDependency = """<dependency> <groupId>joda-time</groupId> <artifactId>joda-time</artifactId> <version>2.8</version> <optional>true</optional> </dependency> """ expect: mavenToGradleConverter.convert(mavenDependency) == "compile 'joda-time:joda-time:2.8', optional" } def 'convert maven dependency with optional and with closure'() { given: def mavenDependency = """<dependency> <groupId>joda-time</groupId> <artifactId>joda-time</artifactId> <version>2.8</version> <optional>true</optional> <exclusions> <exclusion> <groupId>joda-time</groupId> <artifactId>joda-convert</artifactId> </exclusion> </exclusions> </dependency> """ expect: mavenToGradleConverter.convert(mavenDependency) == """compile('joda-time:joda-time:2.8') """ + """{ // optional = true (optional is not supported for dependency with closure) \texclude group: 'joda-time', module: 'joda-convert' }""" } def 'maven dependency with systemPath is not supported yet'() { given: def mavenDependency = """<dependency> <groupId>info.cukes</groupId> <artifactId>gherkin</artifactId> <version>2.12.2</version> <scope>system</scope> <systemPath>\${project.basedir}/lib/gherkin-2.12.2.jar</systemPath> </dependency>""" expect: mavenToGradleConverter.convert(mavenDependency) == "system 'info.cukes:gherkin:2.12.2' " + "// systemPath = \${project.basedir}/lib/gherkin-2.12.2.jar (systemPath is not supported)" } def 'maven dependency with two unsupported elements'() { given: def mavenDependency = """<dependency> <groupId>info.cukes</groupId> <artifactId>gherkin</artifactId> <version>2.12.2</version> <scope>system</scope> <systemPath>\${project.basedir}/lib/gherkin-2.12.2.jar</systemPath> <type>jar</type> </dependency>""" expect: mavenToGradleConverter.convert(mavenDependency) == "system 'info.cukes:gherkin:2.12.2' " + "// systemPath = \${project.basedir}/lib/gherkin-2.12.2.jar (systemPath is not supported), " + "type = jar (type is not supported)" } def 'maven dependency with type is not supported yet'() { given: def mavenDependency = """<dependency> <groupId>org.apache.maven</groupId> <artifactId>apache-maven</artifactId> <version>3.0.1</version> <classifier>bin</classifier> <type>zip</type> </dependency>""" expect: mavenToGradleConverter.convert(mavenDependency) == "compile 'org.apache.maven:apache-maven:3.0.1:bin' " + "// type = zip (type is not supported)" } def 'skip comments during conversion'() { given: def mavenDependency = """<dependency> <groupId>org.spockframework</groupId> <artifactId>spock-core</artifactId> <version>1.0-groovy-2.4</version> </dependency> <!--<dependency>--> <!--<groupId>junit</groupId>--> <!--<artifactId>junit</artifactId>--> <!--<version>4.8.2</version>--> <!--<scope>test</scope>--> <!--</dependency>--> """ expect: mavenToGradleConverter.convert(mavenDependency) == "compile 'org.spockframework:spock-core:1.0-groovy-2.4'" } def 'xml with one test dependency to gradle dsl'() { given: def mavenDependency = """<dependency> <groupId>org.spockframework</groupId> <artifactId>spock-core</artifactId> <version>1.0-groovy-2.4</version> <scope>test</scope> </dependency> """ expect: mavenToGradleConverter.convert(mavenDependency) == "testCompile 'org.spockframework:spock-core:1.0-groovy-2.4'" } def 'XML with maven dependency with exclusions to gradle dependency'() { given: def dependency = """ <dependency> <groupId>org.apache.maven</groupId> <artifactId>maven-embedder</artifactId> <version>2.0</version> <exclusions> <exclusion> <groupId>org.apache.maven</groupId> <artifactId>maven-core</artifactId> </exclusion> </exclusions> </dependency>""" expect: mavenToGradleConverter.convert(dependency) == """compile('org.apache.maven:maven-embedder:2.0') { \texclude group: 'org.apache.maven', module: 'maven-core' }""" } def 'xml with two dependencies to gradle dsl'() { given: def mavenDependency = """<dependencies> <dependency> <groupId>org.spockframework</groupId> <artifactId>spock-core</artifactId> <version>1.0-groovy-2.4</version> </dependency> <dependency> <groupId>org.codehaus.groovy</groupId> <artifactId>groovy-all</artifactId> <version>2.3.11</version> </dependency> </dependencies>""" expect: mavenToGradleConverter.convert(mavenDependency) == """compile 'org.spockframework:spock-core:1.0-groovy-2.4' compile 'org.codehaus.groovy:groovy-all:2.3.11'""" } def 'return original text if it cannot be converted because is not a well formed XML'() { given: def givenNotWellFormedDocument = """<dependency> <groupId>org.spockframework""" when: def converted = mavenToGradleConverter.convert(givenNotWellFormedDocument) then: converted == givenNotWellFormedDocument } def 'return original text if it cannot be converted because is a plain text'() { given: def plainText = 'org.spockframework' when: def converted = mavenToGradleConverter.convert(plainText) then: converted == plainText } } <|start_filename|>config/codenarc/rules.groovy<|end_filename|> ruleset { ruleset('file:config/codenarc/StarterRuleSet-AllRulesByCategory.groovy') { AbcMetric(enabled: false) AbstractClassWithoutAbstractMethod(enabled: false) AbstractClassWithPublicConstructor(enabled: false) ClassJavadoc(enabled: false) ClosureAsLastMethodParameter(enabled: false) CrapMetric(enabled: false) DuplicateNumberLiteral(enabled: false) DuplicateStringLiteral(enabled: false) ExplicitCallToEqualsMethod(enabled: false) FactoryMethodName(enabled: false) GStringExpressionWithinString(enabled: false) JUnitPublicNonTestMethod(enabled: false) JUnitTestMethodWithoutAssert(enabled: false) LineLength(length: 140) MethodName(enabled: false) NoDef(enabled: false) PrivateFieldCouldBeFinal(enabled: false) SpaceAroundMapEntryColon(enabled: false) TrailingComma(enabled: false) UnnecessaryBooleanExpression(enabled: false) UnnecessaryGString(enabled: false) UnusedObject(enabled: false) } } <|start_filename|>src/test/resources/intentions/stringNotationToMapNotation/convert_interpolated_triple_double_quoted_string.groovy<|end_filename|> dependencies { compile """com.google.<caret>guava:guava:$guavaVersion""" } <|start_filename|>src/main/kotlin/com/github/platan/idea/dependencies/sort/SortDependenciesHandler.kt<|end_filename|> package com.github.platan.idea.dependencies.sort import com.github.platan.idea.dependencies.gradle.Coordinate import com.intellij.codeInsight.CodeInsightActionHandler import com.intellij.openapi.command.WriteCommandAction import com.intellij.openapi.editor.Editor import com.intellij.openapi.project.Project import com.intellij.psi.PsiFile import com.intellij.psi.util.PsiTreeUtil import com.intellij.psi.util.PsiTreeUtil.getChildrenOfTypeAsList import org.jetbrains.plugins.groovy.lang.psi.GroovyPsiElementFactory import org.jetbrains.plugins.groovy.lang.psi.api.statements.blocks.GrClosableBlock import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrApplicationStatement import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrCommandArgumentList import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrMethodCall import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrReferenceExpression import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.literals.GrLiteral import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.path.GrMethodCallExpression import java.util.* class SortDependenciesHandler : CodeInsightActionHandler { override fun invoke(project: Project, editor: Editor, file: PsiFile) { WriteCommandAction.writeCommandAction(project, file).run<Exception> { val dependenciesClosures = findDependenciesClosures(file) val factory = GroovyPsiElementFactory.getInstance(project) dependenciesClosures.forEach { dependenciesClosure -> sortDependencies(dependenciesClosure, factory) removeEmptyLines(dependenciesClosure, factory) } } } private fun findDependenciesClosures(psiFile: PsiFile): List<GrClosableBlock> { return PsiTreeUtil.findChildrenOfType(psiFile, GrMethodCall::class.java) .filter { it.invokedExpression.text == "dependencies" } .map { it.closureArguments.first() } } private fun sortDependencies(dependenciesClosure: GrClosableBlock, factory: GroovyPsiElementFactory) { val statements = getChildrenOfTypeAsList(dependenciesClosure, GrMethodCall::class.java) statements.forEach { it.delete() } val byConfigurationName = compareBy<GrMethodCall> { it.firstChild.text } val byArgumentType = compareBy<GrMethodCall> { isCoordinate(it) } val byDependencyValue = compareBy<GrMethodCall> { getComparableValue(it) } statements.sortedWith(byConfigurationName.then(byArgumentType).then(byDependencyValue)) .forEach { dependenciesClosure.addStatementBefore(factory.createStatementFromText(it.text), null) } } private fun isCoordinate(it: GrMethodCall): Boolean { return when (it) { is GrApplicationStatement -> { isCoordinate(it) } is GrMethodCallExpression -> { isCoordinate(it) } else -> false } } private fun isCoordinate(it: GrMethodCallExpression): Boolean { if (it.namedArguments.isNotEmpty()) { return Coordinate.isValidMap(DependencyUtil.toMap(it.namedArguments)) } if (it.expressionArguments.isNotEmpty()) { return Coordinate.isStringNotationCoordinate(it.expressionArguments[0].text) } return false } private fun isCoordinate(it: GrApplicationStatement): Boolean { val argument = it.lastChild return (argument is GrCommandArgumentList && (argument.firstChild is GrLiteral && Coordinate.isStringNotationCoordinate(argument.firstChild.text) || argument.firstChild is GrMethodCall && Coordinate.isStringNotationCoordinate(argument.firstChild.firstChild.text) || Coordinate.isValidMap(DependencyUtil.toMap(argument.namedArguments)))) } private fun getComparableValue(it: GrMethodCall): Comparable<*>? { if (it is GrApplicationStatement) { val argument = it.lastChild if (argument is GrCommandArgumentList) { if (argument.firstChild is GrLiteral && Coordinate.isStringNotationCoordinate(argument.firstChild.text)) { return Coordinate.parse(DependencyUtil.removeQuotesAndUnescape(argument.firstChild)) } if (argument.firstChild is GrMethodCall && Coordinate.isStringNotationCoordinate(argument.firstChild.firstChild.text)) { return Coordinate.parse(DependencyUtil.removeQuotesAndUnescape(argument.firstChild.firstChild)) } if (argument.firstChild is GrMethodCallExpression) { return argument.firstChild.text.toLowerCase(Locale.ENGLISH) } if (argument.firstChild is GrReferenceExpression) { return argument.firstChild.text } if (Coordinate.isValidMap(DependencyUtil.toMap(argument.namedArguments))) { return Coordinate.fromMap(DependencyUtil.toMap(argument.namedArguments)) } } } if (it is GrMethodCallExpression) { if (it.namedArguments.isNotEmpty()) { return Coordinate.fromMap(DependencyUtil.toMap(it.namedArguments)) } if (it.expressionArguments.isNotEmpty()) { return Coordinate.parse(DependencyUtil.removeQuotesAndUnescape(it.expressionArguments[0])) } } return null } private fun removeEmptyLines(dependenciesClosure: GrClosableBlock, factory: GroovyPsiElementFactory) { val dependenciesClosureText = dependenciesClosure.text val withoutEmptyLines = StringUtil.removeEmptyLines(dependenciesClosureText) if (withoutEmptyLines != dependenciesClosureText) { dependenciesClosure.replace(factory.createClosureFromText(withoutEmptyLines)) } } override fun startInWriteAction(): Boolean = false } <|start_filename|>src/main/java/com/github/platan/idea/dependencies/MavenToGradleConverter.java<|end_filename|> package com.github.platan.idea.dependencies; import com.github.platan.idea.dependencies.gradle.Dependency; import com.github.platan.idea.dependencies.gradle.GradleDependenciesSerializer; import com.github.platan.idea.dependencies.maven.DependencyValidationException; import com.github.platan.idea.dependencies.maven.MavenDependenciesDeserializer; import com.github.platan.idea.dependencies.maven.MavenDependency; import com.github.platan.idea.dependencies.maven.MavenToGradleMapper; import com.github.platan.idea.dependencies.maven.UnsupportedContentException; import org.jetbrains.annotations.NotNull; import java.util.List; import static java.util.stream.Collectors.toList; public class MavenToGradleConverter { private final MavenDependenciesDeserializer mavenDependencyParser; private final GradleDependenciesSerializer gradleDependencySerializer; private final MavenToGradleMapper mavenToGradleMapper; public MavenToGradleConverter(MavenDependenciesDeserializer mavenDependencyParser, GradleDependenciesSerializer gradleDependencySerializer, MavenToGradleMapper mavenToGradleMapper) { this.mavenDependencyParser = mavenDependencyParser; this.gradleDependencySerializer = gradleDependencySerializer; this.mavenToGradleMapper = mavenToGradleMapper; } @NotNull public String convert(@NotNull String mavenDependencyXml) { List<MavenDependency> mavenDependencies; try { mavenDependencies = mavenDependencyParser.deserialize(mavenDependencyXml); if (mavenDependencies.isEmpty()) { return mavenDependencyXml; } } catch (UnsupportedContentException | DependencyValidationException e) { return mavenDependencyXml; } List<Dependency> dependencies = mavenDependencies.stream().map(mavenToGradleMapper::map).collect(toList()); return gradleDependencySerializer.serialize(dependencies); } } <|start_filename|>src/test/resources/intentions/stringNotationToMapNotation/convert_single_quoted_string.groovy<|end_filename|> dependencies { compile '''com.google.<caret>guava:guava:18.0''' } <|start_filename|>src/test/resources/actions/sort/with_comments.groovy<|end_filename|> dependencies { // junit compile 'junit:junit:4.11' /* * guava */ compile 'com.google.guava:guava:17.0' } <|start_filename|>src/main/java/com/github/platan/idea/dependencies/gradle/GradleDependenciesSerializerImpl.java<|end_filename|> package com.github.platan.idea.dependencies.gradle; import com.google.common.base.Joiner; import org.jetbrains.annotations.NotNull; import java.util.List; import java.util.Map; import java.util.function.Function; import static java.util.stream.Collectors.joining; import static java.util.stream.Collectors.toList; public class GradleDependenciesSerializerImpl implements GradleDependenciesSerializer { // https://github.com/platan/idea-gradle-dependencies-formatter/issues/3 // We should use \n as a new line separator in texts passed to a editor // See: http://www.jetbrains.org/intellij/sdk/docs/basics/architectural_overview/documents.html private static final char NEW_LINE = '\n'; private static final Joiner NEW_LINE_JOINER = Joiner.on(NEW_LINE); private static final String COMMA_SPACE = ", "; private static final Function<Dependency, String> FORMAT_GRADLE_DEPENDENCY = new Function<Dependency, String>() { @NotNull @Override public String apply(@NotNull Dependency dependency) { String comment = ""; if (dependency.hasExtraOptions()) { comment = createComment(dependency.getExtraOptions()); } if (useClosure(dependency)) { if (dependency.isOptional()) { comment += prepareComment(comment, "optional = true (optional is not supported for dependency with closure)"); } return String.format("%s(%s) {%s%s%s}", dependency.getConfiguration(), toStringNotation(dependency), comment, NEW_LINE, getClosureContent(dependency)); } String optional = dependency.isOptional() ? ", optional" : ""; return String.format("%s %s%s%s", dependency.getConfiguration(), toStringNotation(dependency), optional, comment); } private String prepareComment(String comment, String text) { return comment.isEmpty() ? String.format(" // %s", text) : String.format(", %s", text); } private String createComment(Map<String, String> extraOptions) { String comment = extraOptions.entrySet().stream() .map(extraOption -> String.format("%s = %s (%s is not supported)", extraOption.getKey(), extraOption.getValue(), extraOption.getKey())) .collect(joining(COMMA_SPACE)); return String.format(" // %s", comment); } private boolean useClosure(Dependency dependency) { List<Exclusion> exclusions = dependency.getExclusions(); return !exclusions.isEmpty() || !dependency.isTransitive(); } private String toStringNotation(Dependency dependency) { char quotationMark = dependency.getVersion() != null && dependency.getVersion().contains("${") ? '"' : '\''; StringBuilder result = new StringBuilder(); result.append(quotationMark); result.append(dependency.getGroup()); result.append(':'); result.append(dependency.getName()); appendIf(dependency.getVersion(), result, dependency.hasVersion()); appendIf(dependency.getClassifier(), result, dependency.hasClassifier()); result.append(quotationMark); return result.toString(); } private String getClosureContent(Dependency dependency) { StringBuilder stringBuilder = new StringBuilder(); for (Exclusion exclusion : dependency.getExclusions()) { stringBuilder.append(String.format("\texclude group: '%s', module: '%s'", exclusion.getGroup(), exclusion.getModule())); stringBuilder.append(NEW_LINE); } if (!dependency.isTransitive()) { stringBuilder.append("\ttransitive = false"); stringBuilder.append(NEW_LINE); } return stringBuilder.toString(); } private void appendIf(String value, StringBuilder result, boolean shouldAppend) { if (shouldAppend) { result.append(':'); result.append(value); } } }; @NotNull @Override public String serialize(@NotNull List<Dependency> dependencies) { return NEW_LINE_JOINER.join(dependencies.stream().map(FORMAT_GRADLE_DEPENDENCY).collect(toList())); } } <|start_filename|>src/main/java/com/github/platan/idea/dependencies/gradle/Dependency.java<|end_filename|> package com.github.platan.idea.dependencies.gradle; import com.google.common.base.Objects; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import java.util.List; import java.util.Map; public final class Dependency { private final String group; private final String name; private final String version; private final String classifier; private final String configuration; private final List<Exclusion> exclusions; private final boolean optional; private final boolean transitive; private final Map<String, String> extraOptions; public Dependency(String group, String name, String version, String classifier, String configuration, List<Exclusion> exclusions, boolean transitive, Map<String, String> extraOptions, boolean optional) { this.group = group; this.name = name; this.version = version; this.classifier = classifier; this.configuration = configuration; this.optional = optional; this.extraOptions = ImmutableMap.copyOf(extraOptions); this.exclusions = ImmutableList.copyOf(exclusions); this.transitive = transitive; } public String getGroup() { return group; } public String getName() { return name; } public String getVersion() { return version; } public String getClassifier() { return classifier; } public String getConfiguration() { return configuration; } public List<Exclusion> getExclusions() { return exclusions; } public Map<String, String> getExtraOptions() { return extraOptions; } public boolean hasExtraOptions() { return !extraOptions.isEmpty(); } public boolean isTransitive() { return transitive; } public boolean hasVersion() { return version != null; } public boolean isOptional() { return optional; } @Override public int hashCode() { return Objects.hashCode(group, name, version, classifier, configuration, exclusions, extraOptions, optional, transitive); } public boolean hasClassifier() { return classifier != null; } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null || getClass() != obj.getClass()) { return false; } final Dependency other = (Dependency) obj; return Objects.equal(this.group, other.group) && Objects.equal(this.name, other.name) && Objects.equal(this.version, other.version) && Objects.equal(this.configuration, other.configuration) && Objects.equal(this.classifier, other.classifier) && Objects.equal(this.exclusions, other.exclusions) && Objects.equal(this.extraOptions, other.extraOptions) && Objects.equal(this.optional, other.optional) && Objects.equal(this.transitive, other.transitive); } @Override public String toString() { return "Dependency{" + "group='" + group + '\'' + ", name='" + name + '\'' + ", version='" + version + '\'' + ", classifier=" + classifier + ", configuration='" + configuration + '\'' + ", exclusions=" + exclusions + ", optional=" + optional + ", transitive=" + transitive + ", extraOptions=" + extraOptions + '}'; } } <|start_filename|>src/test/groovy/com/github/platan/idea/dependencies/intentions/IntentionTestBase.groovy<|end_filename|> package com.github.platan.idea.dependencies.intentions import com.intellij.codeInsight.intention.IntentionAction import com.intellij.openapi.util.registry.Registry import com.intellij.psi.impl.source.PostprocessReformattingAspect import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase abstract class IntentionTestBase extends LightCodeInsightFixtureTestCase { protected final String intention IntentionTestBase(String intentionName) { assert intentionName != null this.intention = intentionName Registry.get("ide.check.structural.psi.text.consistency.in.tests").setValue(false) } protected void doTextTest(String given, String expected) { myFixture.configureByText("build.groovy", given) List<IntentionAction> list = myFixture.filterAvailableIntentions(intention) assert list.size() == 1, "An intention '$intention' should be applicable to: \n$given\n" myFixture.launchAction(list.first()) PostprocessReformattingAspect.getInstance(project).doPostponedFormatting() myFixture.checkResult(expected) } protected void doAntiTest(String given) { myFixture.configureByText("build.groovy", given) assert !myFixture.filterAvailableIntentions(intention), "An intention '$intention' should not be applicable to: \n$given\n" } protected void doTest() { def baseName = getTestName(false).replaceFirst('_', '') def extension = ".groovy" def file = baseName + extension myFixture.configureByFile(file) List<IntentionAction> list = myFixture.filterAvailableIntentions(intention) assert list.size() == 1, "An intention '$intention' should be applicable to test case from file: $file\n" myFixture.launchAction(list.first()) PostprocessReformattingAspect.getInstance(project).doPostponedFormatting() myFixture.checkResultByFile(baseName + "_after" + extension) } } <|start_filename|>src/main/java/com/github/platan/idea/dependencies/gradle/PsiElementCoordinate.java<|end_filename|> package com.github.platan.idea.dependencies.gradle; import com.google.common.base.Preconditions; import com.intellij.psi.PsiElement; import org.jetbrains.annotations.Nullable; import org.jetbrains.plugins.groovy.lang.psi.GrReferenceElement; import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.literals.GrLiteral; import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.literals.GrString; import org.jetbrains.plugins.groovy.lang.psi.util.GrStringUtil; import java.util.List; import java.util.Map; import java.util.Objects; import java.util.stream.Stream; import static java.util.stream.Collectors.toList; public class PsiElementCoordinate extends BaseCoordinate<PsiElement> { public PsiElementCoordinate(@Nullable PsiElement group, PsiElement name, @Nullable PsiElement version, @Nullable PsiElement classifier, @Nullable PsiElement extension) { super(group, name, version, classifier, extension); } public String toGrStringNotation() { StringBuilder stringBuilder = new StringBuilder(); if (group != null) { stringBuilder.append(getText(group)); } stringBuilder.append(':'); stringBuilder.append(getText(name)); appendIfNotNull(stringBuilder, ':', version); if (version == null && classifier != null) { stringBuilder.append(':'); } appendIfNotNull(stringBuilder, ':', classifier); appendIfNotNull(stringBuilder, '@', extension); List<PsiElement> allElements = Stream.of(group, name, version, classifier, extension) .filter(java.util.Objects::nonNull).collect(toList()); boolean plainValues = allElements.stream().allMatch(this::isPlainValue); char quote = plainValues ? '\'' : '"'; return String.format("%c%s%c", quote, stringBuilder.toString(), quote); } private boolean isPlainValue(PsiElement element) { return element instanceof GrLiteral && !(element instanceof GrString); } private String getText(PsiElement element) { if (element instanceof GrLiteral) { GrLiteral grLiteral = (GrLiteral) element; if (grLiteral.getValue() != null) { return grLiteral.getValue().toString(); } return GrStringUtil.removeQuotes(element.getText()); } if (element instanceof GrReferenceElement) { GrReferenceElement<?> referenceElement = (GrReferenceElement<?>) element; if (Objects.equals(referenceElement.getQualifiedReferenceName(), referenceElement.getReferenceName())) { return String.format("$%s", element.getText()); } else { return String.format("${%s}", element.getText()); } } return String.format("${%s}", element.getText()); } private void appendIfNotNull(StringBuilder stringBuilder, char separator, PsiElement nullableValue) { if (nullableValue != null) { stringBuilder.append(separator); stringBuilder.append(getText(nullableValue)); } } public static PsiElementCoordinate fromMap(Map<String, PsiElement> map) { PsiElement name = map.get(NAME_KEY); Preconditions.checkArgument(java.util.Objects.nonNull(name), "'name' element is required. "); CoordinateBuilder coordinateBuilder = CoordinateBuilder.aCoordinate(name); if (java.util.Objects.nonNull(map.get(GROUP_KEY))) { coordinateBuilder.withGroup(map.get(GROUP_KEY)); } if (java.util.Objects.nonNull(map.get(VERSION_KEY))) { coordinateBuilder.withVersion(map.get(VERSION_KEY)); } if (java.util.Objects.nonNull(map.get(CLASSIFIER_KEY))) { coordinateBuilder.withClassifier(map.get(CLASSIFIER_KEY)); } if (java.util.Objects.nonNull(map.get(EXT_KEY))) { coordinateBuilder.withExtension(map.get(EXT_KEY)); } return coordinateBuilder.build(); } public static class CoordinateBuilder { private PsiElement group = null; private PsiElement name; private PsiElement version = null; private PsiElement classifier = null; private PsiElement extension = null; private CoordinateBuilder() { } public static CoordinateBuilder aCoordinate(PsiElement name) { CoordinateBuilder coordinateBuilder = new CoordinateBuilder(); coordinateBuilder.name = name; return coordinateBuilder; } public CoordinateBuilder withGroup(PsiElement group) { this.group = group; return this; } public CoordinateBuilder withVersion(PsiElement version) { this.version = version; return this; } public CoordinateBuilder withClassifier(PsiElement classifier) { this.classifier = classifier; return this; } public CoordinateBuilder withExtension(PsiElement extension) { this.extension = extension; return this; } public PsiElementCoordinate build() { return new PsiElementCoordinate(group, name, version, classifier, extension); } } } <|start_filename|>src/test/resources/intentions/stringNotationToMapNotation/convert_interpolated_string.groovy<|end_filename|> dependencies { compile "com.google.<caret>guava:guava:$guavaVersion" } <|start_filename|>src/main/java/com/github/platan/idea/dependencies/maven/MavenDependency.java<|end_filename|> package com.github.platan.idea.dependencies.maven; import com.google.common.base.Objects; import jakarta.xml.bind.annotation.XmlAccessType; import jakarta.xml.bind.annotation.XmlAccessorType; import jakarta.xml.bind.annotation.XmlElement; import jakarta.xml.bind.annotation.XmlElementWrapper; import jakarta.xml.bind.annotation.XmlRootElement; import java.util.ArrayList; import java.util.List; @XmlRootElement(name = "dependency") @XmlAccessorType(XmlAccessType.FIELD) public class MavenDependency { private String groupId; private String artifactId; private String version; private String classifier; private String optional; private Scope scope = Scope.COMPILE; private String systemPath; private String type; @XmlElement(name = "exclusion") @XmlElementWrapper(name = "exclusions") private List<MavenExclusion> exclusionList = new ArrayList<>(); public String getGroupId() { return groupId; } public String getArtifactId() { return artifactId; } public String getVersion() { return version; } public Scope getScope() { return scope; } public void setGroupId(String groupId) { this.groupId = groupId; } public void setArtifactId(String artifactId) { this.artifactId = artifactId; } public void setVersion(String version) { this.version = version; } public void setScope(Scope scope) { this.scope = scope; } public List<MavenExclusion> getExclusions() { return exclusionList; } public void setExclusions(List<MavenExclusion> exclusions) { this.exclusionList = exclusions; } public String getClassifier() { return classifier; } public void setClassifier(String classifier) { this.classifier = classifier; } public String getSystemPath() { return systemPath; } public void setSystemPath(String systemPath) { this.systemPath = systemPath; } public String getType() { return type; } public void setType(String type) { this.type = type; } @Override public int hashCode() { return Objects.hashCode(groupId, artifactId, version, classifier, optional, scope, systemPath, type, exclusionList); } public String getOptional() { return optional; } public void setOptional(String optional) { this.optional = optional; } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null || getClass() != obj.getClass()) { return false; } final MavenDependency other = (MavenDependency) obj; return Objects.equal(this.groupId, other.groupId) && Objects.equal(this.artifactId, other.artifactId) && Objects.equal(this.version, other.version) && Objects.equal(this.classifier, other.classifier) && Objects.equal(this.optional, other.optional) && Objects.equal(this.scope, other.scope) && Objects.equal(this.systemPath, other.systemPath) && Objects.equal(this.type, other.type) && Objects.equal(this.exclusionList, other.exclusionList); } @Override public String toString() { return "MavenDependency{" + "groupId='" + groupId + '\'' + ", artifactId='" + artifactId + '\'' + ", version='" + version + '\'' + ", classifier='" + classifier + '\'' + ", optional='" + optional + '\'' + ", scope=" + scope + ", systemPath='" + systemPath + '\'' + ", type='" + type + '\'' + ", exclusionList=" + exclusionList + '}'; } } <|start_filename|>src/test/groovy/com/github/platan/idea/dependencies/MavenToGradleDependenciesCopyPasteProcessorSpec.groovy<|end_filename|> package com.github.platan.idea.dependencies import com.intellij.openapi.editor.Editor import com.intellij.openapi.editor.RawText import com.intellij.openapi.project.Project import com.intellij.psi.PsiFile import spock.lang.Specification class MavenToGradleDependenciesCopyPasteProcessorSpec extends Specification { def "do not convert maven to gradle while pasting to setting gradle"(){ given: def mavenToGradleConverter = Mock(MavenToGradleConverter) MavenToGradleDependenciesCopyPasteProcessor copyPasteProcessor = new MavenToGradleDependenciesCopyPasteProcessor(mavenToGradleConverter) PsiFile file = Stub(PsiFile) { getName() >> 'settings.gradle' } when: copyPasteProcessor.preprocessOnPaste(Stub(Project), file, Stub(Editor), 'text', new RawText('text')) then: 0 * mavenToGradleConverter.convert(_) } } <|start_filename|>src/main/java/com/github/platan/idea/dependencies/maven/MavenDependenciesDeserializer.java<|end_filename|> package com.github.platan.idea.dependencies.maven; import org.jetbrains.annotations.NotNull; import java.util.List; public interface MavenDependenciesDeserializer { @NotNull List<MavenDependency> deserialize(@NotNull String mavenDependencyXml) throws UnsupportedContentException; } <|start_filename|>src/test/groovy/com/github/platan/idea/dependencies/maven/MavenToGradleMapperTest.groovy<|end_filename|> package com.github.platan.idea.dependencies.maven import static com.github.platan.idea.dependencies.maven.MavenDependencyBuilder.aMavenDependency import com.github.platan.idea.dependencies.gradle.Dependency import com.github.platan.idea.dependencies.gradle.Exclusion import spock.lang.Specification class MavenToGradleMapperTest extends Specification { def 'map maven dependency to gradle dependency'() { given: MavenToGradleMapper mavenToGradleMapper = new MavenToGradleMapperImpl() def dependency = aMavenDependency('org.spockframework', 'spock-core', '1.0-groovy-2.4') .withExclusionList([new MavenExclusion('org.codehaus.groovy', 'groovy-all')]).build() expect: mavenToGradleMapper.map(dependency) == aDependency('org.spockframework', 'spock-core', '1.0-groovy-2.4', 'compile', [new Exclusion('org.codehaus.groovy', 'groovy-all')]) } def 'map maven dependency with wildcard exclusion to gradle non transitive dependency'() { given: MavenToGradleMapper mavenToGradleMapper = new MavenToGradleMapperImpl() def mavenDependency = aMavenDependency('org.spockframework', 'spock-core', '1.0-groovy-2.4') .withExclusionList([new MavenExclusion('*', '*')]) when: def dependency = mavenToGradleMapper.map(mavenDependency.build()) then: !dependency.transitive !dependency.exclusions } private static aDependency(String group, String name, String version, String configuration, List<Exclusion> exclusions) { new Dependency(group, name, version, null, configuration, exclusions, true, [:], false) } } <|start_filename|>src/main/java/com/github/platan/idea/dependencies/intentions/MapNotationToStringNotationIntention.java<|end_filename|> package com.github.platan.idea.dependencies.intentions; import com.github.platan.idea.dependencies.gradle.Coordinate; import com.github.platan.idea.dependencies.gradle.PsiElementCoordinate; import com.intellij.openapi.editor.Editor; import com.intellij.openapi.project.Project; import com.intellij.psi.PsiElement; import org.jetbrains.annotations.NotNull; import org.jetbrains.plugins.groovy.intentions.base.PsiElementPredicate; import org.jetbrains.plugins.groovy.lang.psi.GroovyPsiElementFactory; import org.jetbrains.plugins.groovy.lang.psi.api.statements.arguments.GrArgumentList; import org.jetbrains.plugins.groovy.lang.psi.api.statements.arguments.GrNamedArgument; import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrExpression; import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrMethodCall; import java.util.Map; import static com.github.platan.idea.dependencies.sort.DependencyUtil.toMapWithPsiElementValues; public class MapNotationToStringNotationIntention extends SelectionIntention<GrMethodCall> { @Override protected void processIntention(@NotNull PsiElement element, @NotNull Project project, Editor editor) { GrArgumentList argumentList = getGrArgumentList(element); if (argumentList == null) { return; } toStringNotation(project, argumentList); } private void toStringNotation(@NotNull Project project, GrArgumentList argumentList) { GrNamedArgument[] namedArguments = argumentList.getNamedArguments(); Map<String, PsiElement> map = toMapWithPsiElementValues(namedArguments); PsiElementCoordinate coordinate = PsiElementCoordinate.fromMap(map); String stringNotation = coordinate.toGrStringNotation(); for (GrNamedArgument namedArgument : namedArguments) { namedArgument.delete(); } GrExpression expressionFromText = GroovyPsiElementFactory.getInstance(project).createExpressionFromText(stringNotation); argumentList.add(expressionFromText); } @Override protected Class<GrMethodCall> elementTypeToFindInSelection() { return GrMethodCall.class; } @NotNull @Override protected PsiElementPredicate getElementPredicate() { return element -> { GrArgumentList argumentList = getGrArgumentList(element); if (argumentList == null) { return false; } GrNamedArgument[] namedArguments = argumentList.getNamedArguments(); if (namedArguments.length == 0) { return false; } Map<String, PsiElement> map = toMapWithPsiElementValues(namedArguments); return Coordinate.isValidMap(map); }; } private GrArgumentList getGrArgumentList(@NotNull PsiElement element) { if (element.getParent() == null || element.getParent().getParent() == null) { return null; } else if (element instanceof GrMethodCall) { return ((GrMethodCall) element).getArgumentList(); } else if (element.getParent().getParent() instanceof GrMethodCall) { return ((GrMethodCall) element.getParent().getParent()).getArgumentList(); } else if (element.getParent().getParent().getParent() instanceof GrMethodCall) { return ((GrMethodCall) element.getParent().getParent().getParent()).getArgumentList(); } return null; } @NotNull @Override public String getText() { return "Convert to string notation"; } @NotNull @Override public String getFamilyName() { return "Convert map notation to string notation"; } } <|start_filename|>src/test/resources/intentions/stringNotationToMapNotation/convert_gstring_with_escaped_character.groovy<|end_filename|> dependencies { compile "com.google.<caret>guava:guava:\$guavaVersion" } <|start_filename|>src/main/java/com/github/platan/idea/dependencies/maven/MavenToGradleMapper.java<|end_filename|> package com.github.platan.idea.dependencies.maven; import com.github.platan.idea.dependencies.gradle.Dependency; import org.jetbrains.annotations.NotNull; public interface MavenToGradleMapper { @NotNull Dependency map(@NotNull MavenDependency mavenDependency); } <|start_filename|>src/test/groovy/com/github/platan/idea/dependencies/gradle/GradleDependenciesSerializerImplTest.groovy<|end_filename|> package com.github.platan.idea.dependencies.gradle import static com.github.platan.idea.dependencies.gradle.DependencyBuilder.aDependency import spock.lang.Specification class GradleDependenciesSerializerImplTest extends Specification { def 'serialize dependency with exclusion'() { given: GradleDependenciesSerializer gradleDependenciesSerializer = new GradleDependenciesSerializerImpl() when: def serialized = gradleDependenciesSerializer.serialize([aDependency('org.spockframework', 'spock-core') .withVersion('1.0-groovy-2.4') .withConfiguration('compile') .withExclusions([new Exclusion('org.codehaus.groovy', 'groovy-all')]).build()]) then: serialized == """compile('org.spockframework:spock-core:1.0-groovy-2.4') { \texclude group: 'org.codehaus.groovy', module: 'groovy-all' }""" } def 'serialize dependency with wildcard exclusion'() { given: GradleDependenciesSerializer gradleDependenciesSerializer = new GradleDependenciesSerializerImpl() when: def serialized = gradleDependenciesSerializer.serialize([aDependency('org.spockframework', 'spock-core') .withVersion('1.0-groovy-2.4') .withConfiguration('compile') .withTransitive(false).build()]) then: serialized == """compile('org.spockframework:spock-core:1.0-groovy-2.4') { \ttransitive = false }""" } } <|start_filename|>src/test/groovy/com/github/platan/idea/dependencies/sort/EmptyLineTest.groovy<|end_filename|> package com.github.platan.idea.dependencies.sort import spock.lang.Specification import spock.lang.Unroll class EmptyLineTest extends Specification { @Unroll def "remove empty line"() { expect: StringUtil.removeEmptyLines(stringWithEmptyLine) == cleared where: stringWithEmptyLine | cleared '\n \n' | '\n' '\n \n\n' | '\n' '\n \n \n' | '\n' ' \n \n' | ' \n' '\n \n ' | '\n ' '\n\n' | '\n' ' \n\n' | ' \n' '\n\n ' | '\n ' '\n\t\n' | '\n' '\n\t\n\t' | '\n\t' } @Unroll def "do not modify text without empty line"() { expect: StringUtil.removeEmptyLines(stringWithEmptyLine) == stringWithEmptyLine where: stringWithEmptyLine | _ '\n' | _ ' \n' | _ '\n ' | _ '\na\n' | _ } } <|start_filename|>src/main/java/com/github/platan/idea/dependencies/maven/UnsupportedContentException.java<|end_filename|> package com.github.platan.idea.dependencies.maven; public class UnsupportedContentException extends Exception { } <|start_filename|>src/main/kotlin/com/github/platan/idea/dependencies/sort/SortDependenciesAction.kt<|end_filename|> package com.github.platan.idea.dependencies.sort import com.github.platan.idea.dependencies.gradle.GradleFileUtil.isGradleFile import com.github.platan.idea.dependencies.gradle.GradleFileUtil.isSettingGradle import com.intellij.codeInsight.CodeInsightActionHandler import com.intellij.codeInsight.actions.CodeInsightAction import com.intellij.openapi.editor.Editor import com.intellij.openapi.project.Project import com.intellij.psi.PsiFile class SortDependenciesAction : CodeInsightAction() { override fun getHandler(): CodeInsightActionHandler = SortDependenciesHandler() override fun isValidForFile(project: Project, editor: Editor, file: PsiFile): Boolean { return super.isValidForFile(project, editor, file) && isGradleFile(file) && !isSettingGradle(file) } } <|start_filename|>src/test/resources/intentions/stringNotationToMapNotation/convert_single_quoted_string_after.groovy<|end_filename|> dependencies { compile group: '''com.google.guava''', name: '''guava''', version: '''18.0''' } <|start_filename|>src/test/groovy/com/github/platan/idea/dependencies/intentions/NotationIntentionTest.groovy<|end_filename|> package com.github.platan.idea.dependencies.intentions import com.intellij.codeInsight.intention.IntentionAction import com.intellij.openapi.util.registry.Registry import com.intellij.psi.impl.source.PostprocessReformattingAspect import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase class NotationIntentionTest extends LightCodeInsightFixtureTestCase { NotationIntentionTest() { Registry.get("ide.check.structural.psi.text.consistency.in.tests").setValue(false) } void test_convert_to_map_and_to_string_again() { myFixture.configureByText("build.groovy", '''dependencies { compile 'com.google.<caret>guava:guava:18.0' }''') runIntention('Convert to map notation') myFixture.checkResult('''dependencies { compile group: 'com.google.guava', name: 'guava', version: '18.0' }''' ) runIntention('Convert to string notation') myFixture.checkResult('''dependencies { compile 'com.google.guava:guava:18.0' }''') } void test_convert_to_string_and_to_map_again() { myFixture.configureByText("build.groovy", '''dependencies { compile group: 'co<caret>m.google.guava', name: 'guava', version: '18.0' }''') runIntention('Convert to string notation') myFixture.checkResult('''dependencies { compile 'com.google.guava:guava:18.0' }''' ) runIntention('Convert to map notation') myFixture.checkResult('''dependencies { compile group: 'com.google.guava', name: 'guava', version: '18.0' }''') } protected void runIntention(String intention) { List<IntentionAction> list = myFixture.filterAvailableIntentions(intention) assert list.size() == 1, "An intention '$intention' should be applicable to: \n${myFixture.editor.document.text}\n" myFixture.launchAction(list.first()) PostprocessReformattingAspect.getInstance(project).doPostponedFormatting() } } <|start_filename|>src/test/resources/intentions/mapNotationToStringNotation/convert_gstring_with_special_characters_after.groovy<|end_filename|> dependencies { compile 'com.google.guava:guava:$guavaVersion' } <|start_filename|>src/test/resources/actions/sort/build_dependencies_simple.groovy<|end_filename|> build { dependencies { compile 'junit:junit:4.11' compile 'com.google.guava:guava:17.0' } } <|start_filename|>src/test/resources/actions/sort/ignore_quotation_mark_after.groovy<|end_filename|> dependencies { compile 'com.google.guava:guava:17.0' compile "com.google.truth:truth:0.27" } <|start_filename|>src/main/java/com/github/platan/idea/dependencies/gradle/GradleDependenciesSerializer.java<|end_filename|> package com.github.platan.idea.dependencies.gradle; import org.jetbrains.annotations.NotNull; import java.util.List; public interface GradleDependenciesSerializer { @NotNull String serialize(@NotNull List<Dependency> dependencies); } <|start_filename|>src/test/resources/actions/sort/remove_empty_lines.groovy<|end_filename|> dependencies { compile 'com.android.support:design:23.1.0' compile 'com.android.support:percent:23.1.0' compile 'net.steamcrafted:materialiconlib:1.0.3' compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.4' } <|start_filename|>src/test/groovy/com/github/platan/idea/dependencies/intentions/StringNotationToMapNotationIntentionTest.groovy<|end_filename|> package com.github.platan.idea.dependencies.intentions class StringNotationToMapNotationIntentionTest extends IntentionTestBase { private Random random = new Random() @Override protected String getTestDataPath() { this.getClass().getResource('/intentions/stringNotationToMapNotation/').path } StringNotationToMapNotationIntentionTest() { super('Convert to map notation') } void test_convert_string_notation_with_single_quote() { doTextTest('''dependencies { compile 'com.google.<caret>guava:guava:18.0' }''', '''dependencies { compile group: 'com.google.guava', name: 'guava', version: '18.0' }''') } void test_convert_optional_dependency() { doTextTest('''dependencies { compile 'com.google.<caret>guava:guava:18.0', optional }''', '''dependencies { compile group: 'com.google.guava', name: 'guava', version: '18.0', optional }''') } void test_convert_string_notation_with_ext() { doTextTest('''dependencies { compile 'com.google.<caret>guava:guava:18.0@jar' }''', '''dependencies { compile group: 'com.google.guava', name: 'guava', version: '18.0', ext: 'jar' }''') } void test_convert_string_notation_with_double_quote() { doTextTest('''dependencies { compile "com.google.<caret>guava:guava:18.0" }''', '''dependencies { compile group: 'com.google.guava', name: 'guava', version: '18.0' }''') } void test_convert_string_with_special_characters() { doTest() } void test_convert_string_notation_with_single_quote_and_brackets() { doTextTest('''dependencies { compile('com.google.<caret>guava:guava:18.0') }''', '''dependencies { compile(group: 'com.google.guava', name: 'guava', version: '18.0') }''') } void test_convert_string_notation_with_single_quote_and_brackets_and_closure() { doTextTest('''dependencies { compile('com.google.<caret>guava:guava:18.0') { transitive = false } }''', '''dependencies { compile(group: 'com.google.guava', name: 'guava', version: '18.0') { transitive = false } }''') } void test_convert_map_notation_and_map_notation() { doTextTest('''dependencies { <selection>testCompile 'junit:junit:4.1' testCompile group: 'junit', name: 'junit', version: '4.13'</selection> }''', '''dependencies { testCompile group: 'junit', name: 'junit', version: '4.1' testCompile group: 'junit', name: 'junit', version: '4.13' }''') } void test_convert_interpolated_string() { doTest() } void test_do_not_find_intention() { doAntiTest('''dependencies { compile 'gu<caret>ava' }''') } void test_do_not_find_intention_for_method_call_without_arguments() { doAntiTest('''dependencies { compile(<caret>) }''') } void test_do_not_find_intention_for_variable_with_dependency() { doAntiTest('''dependencies { def guava = 'com.google.<caret>guava:guava:18.0' }''') } void test_do_not_find_intention_for_string_with_errors() { doAntiTest('''dependencies { compile "com.google.<caret>guava:guava:$" }''') } void test_do_not_find_intention_for_project_dependency() { doAntiTest('''dependencies { compile project(":l<caret>ib") }''') } void test_do_not_find_intention_for_project_dependency_with_brackets() { doAntiTest('''dependencies { compile(project(":l<caret>ib")) }''') } void test_do_not_find_intention_for_project_dependency_plus_closure() { doAntiTest('''dependencies { compile(project(":l<caret>ib")) { } }''') } void test_do_not_find_intention_for_dependency_with_project_configuration() { doAntiTest('''dependencies { project("com.google.<caret>guava:guava:18.0'") }''') } void test_convert_gstring_with_escaped_character() { doTest() } void test_convert_interpolated_triple_double_quoted_string() { doTest() } void test_convert_single_quoted_string() { doTest() } void test_convert_interpolated_string_dollar_brackets() { doTest() } void test_convert_dependency_caret_at_configuration() { doTextTest('''dependencies { com<caret>pile 'com.google.guava:guava:18.0' }''', '''dependencies { compile group: 'com.google.guava', name: 'guava', version: '18.0' }''') } void test_convert_dependency_with_variable() { doTextTest('''dependencies { com<caret>pile "com.google.guava:guava:$guavaVersion" }''', '''dependencies { compile group: 'com.google.guava', name: 'guava', version: guavaVersion }''') } void test_convert_dependency_with_object_variable() { doTextTest('''dependencies { com<caret>pile "com.google.guava:guava:$guava.version" }''', '''dependencies { compile group: 'com.google.guava', name: 'guava', version: guava.version }''') } void test_convert_dependency_with_variable_in_braces() { doTextTest('''dependencies { com<caret>pile "com.google.guava:guava:${guavaVersion}" }''', '''dependencies { compile group: 'com.google.guava', name: 'guava', version: "${guavaVersion}" }''') } void test_convert_dependency_with_method_invocation() { doTextTest('''dependencies { com<caret>pile "com.google.guava:guava:${guavaVersion()}" }''', '''dependencies { compile group: 'com.google.guava', name: 'guava', version: "${guavaVersion()}" }''') } void test_convert_multiple_map_notation() { doTextTest('''dependencies { <selection><caret>compile('com.google.guava:guava:18.0') { transitive = false } testCompile 'junit:junit:4.13'</selection> }''', '''dependencies { compile(group: 'com.google.guava', name: 'guava', version: '18.0') { transitive = false } testCompile group: 'junit', name: 'junit', version: '4.13' }''') } void test_convert_selection_with_one_dependency() { doTextTest('''dependencies { <selection><caret>testCompile 'junit:junit:4.13'</selection> }''', '''dependencies { testCompile group: 'junit', name: 'junit', version: '4.13' }''') } void test_convert_all_selected_elements() { doTextTest('''<selection><caret> build { dependencies { compile 'com.google.guava:guava:18.0' } } dependencies { testCompile 'junit:junit:4.13' }</selection>''', ''' build { dependencies { compile group: 'com.google.guava', name: 'guava', version: '18.0' } } dependencies { testCompile group: 'junit', name: 'junit', version: '4.13' }''') } void test_convert_selection_with_one_dependency_configuration_selected() { doTextTest('''dependencies { <selection><caret>t</selection>estCompile 'junit:junit:4.13' }''', '''dependencies { testCompile group: 'junit', name: 'junit', version: '4.13' }''') } void test_do_not_find_intention_with_caret_in_build_gradle_without_dependencies() { def buildGradleContent = getClass().getResource('/intentions/build_no_dependencies.gradle').text for (int i = 0; i < buildGradleContent.length(); i++) { def content = new StringBuilder(buildGradleContent) content.insert(i, '<caret>') doAntiTest(content.toString()) } } void test_do_not_find_intention_with_selection_in_build_gradle_without_dependencies() { def buildGradleContent = getClass().getResource('/intentions/build_no_dependencies.gradle').text def contentLength = buildGradleContent.length() def threshold = 10 * (1 / (contentLength * contentLength)) for (int i = 0; i < contentLength; i++) { for (int j = i; j < contentLength; j++) { if (random.nextDouble() <= threshold) { def content = new StringBuilder(buildGradleContent) content.insert(j, '</selection>') content.insert(i, '<selection><caret>') doAntiTest(content.toString()) } } } } } <|start_filename|>src/main/java/com/github/platan/idea/dependencies/MavenToGradleDependenciesCopyPasteProcessor.java<|end_filename|> package com.github.platan.idea.dependencies; import static com.github.platan.idea.dependencies.gradle.GradleFileUtil.isGradleFile; import static com.github.platan.idea.dependencies.gradle.GradleFileUtil.isSettingGradle; import com.github.platan.idea.dependencies.gradle.GradleDependenciesSerializerImpl; import com.github.platan.idea.dependencies.maven.MavenDependenciesDeserializerImpl; import com.github.platan.idea.dependencies.maven.MavenToGradleMapperImpl; import com.intellij.codeInsight.editorActions.CopyPastePreProcessor; import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.RawText; import com.intellij.openapi.project.Project; import com.intellij.psi.PsiFile; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; public class MavenToGradleDependenciesCopyPasteProcessor implements CopyPastePreProcessor { private final MavenToGradleConverter mavenToGradleConverter; public MavenToGradleDependenciesCopyPasteProcessor() { this(new MavenToGradleConverter(new MavenDependenciesDeserializerImpl(), new GradleDependenciesSerializerImpl(), new MavenToGradleMapperImpl())); } public MavenToGradleDependenciesCopyPasteProcessor(MavenToGradleConverter mavenToGradleConverter) { this.mavenToGradleConverter = mavenToGradleConverter; } @Nullable @Override public String preprocessOnCopy(PsiFile file, int[] startOffsets, int[] endOffsets, String text) { return null; } @NotNull @Override public String preprocessOnPaste(Project project, PsiFile file, Editor editor, String text, RawText rawText) { if (!canPasteForFile(file)) { return text; } return preprocessedText(text); } private boolean canPasteForFile(@NotNull PsiFile file) { return isGradleFile(file) && !isSettingGradle(file); } @NotNull private String preprocessedText(@NotNull String text) { return mavenToGradleConverter.convert(text); } } <|start_filename|>src/test/groovy/com/github/platan/idea/dependencies/sort/SortDependenciesActionTest.groovy<|end_filename|> package com.github.platan.idea.dependencies.sort import com.intellij.codeInsight.actions.CodeInsightAction import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase class SortDependenciesActionTest extends LightCodeInsightFixtureTestCase { void test__action_is_not_active_for_settings_gradle() { myFixture.configureByText("settings.gradle", """dependencies { compile 'junit:junit:4.11' compile 'com.google.guava:guava:17.0' }""") CodeInsightAction action = new SortDependenciesAction() assert !action.isValidForFile(project, myFixture.editor, myFixture.file) } void test__action_is_not_active_for_non_gradle_file() { myFixture.configureByText("test.groovy", """dependencies { compile 'junit:junit:4.11' compile 'com.google.guava:guava:17.0' }""") CodeInsightAction action = new SortDependenciesAction() assert !action.isValidForFile(project, myFixture.editor, myFixture.file) } } <|start_filename|>src/main/java/com/github/platan/idea/dependencies/gradle/Coordinate.java<|end_filename|> package com.github.platan.idea.dependencies.gradle; import com.google.common.base.Preconditions; import com.google.common.base.Splitter; import com.google.common.base.Strings; import com.google.common.collect.ComparisonChain; import com.google.common.collect.ImmutableSet; import com.google.common.collect.Lists; import com.google.common.collect.Sets; import org.jetbrains.annotations.Nullable; import java.util.Comparator; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.function.Function; import java.util.regex.Pattern; import static java.util.stream.Collectors.joining; public class Coordinate extends BaseCoordinate<String> implements Comparable<Coordinate> { private static final ImmutableSet<String> ALL_KEYS = ImmutableSet.of(GROUP_KEY, NAME_KEY, VERSION_KEY, CLASSIFIER_KEY, EXT_KEY); private static final ImmutableSet<String> REQUIRED_KEYS = ImmutableSet.of(GROUP_KEY, NAME_KEY); private static final Splitter ON_SEMICOLON_SPLITTER = Splitter.onPattern(":").limit(4); private static final String COMMA_SPACE = ", "; private static final Comparator<String> COMPARATOR = new NaturalNullFirstOrdering<>(); public Coordinate(@Nullable String group, String name, @Nullable String version, @Nullable String classifier, @Nullable String extension) { super(group, name, version, classifier, extension); } public static Coordinate parse(String stringNotation) { Preconditions.checkArgument(!stringNotation.trim().isEmpty(), "Coordinate is empty!"); List<String> parts = Lists.newArrayList(ON_SEMICOLON_SPLITTER.split(stringNotation)); int numberOfParts = parts.size(); Preconditions.checkArgument(numberOfParts > 1, "Cannot parse coordinate!"); CoordinateBuilder coordinateBuilder = CoordinateBuilder.aCoordinate(getNotEmptyAt(parts, 1)).withGroup(getAt(parts, 0)); if (numberOfParts >= 3) { coordinateBuilder.withVersion(getAt(parts, 2)); } if (numberOfParts == 4) { coordinateBuilder.withClassifier(getAt(parts, 3)); } String last = parts.get(parts.size() - 1); if (last.contains("@")) { coordinateBuilder.withExtension(last.split("@", 2)[1]); } return coordinateBuilder.build(); } public static boolean isStringNotationCoordinate(String stringNotation) { return Pattern.compile("[^:\\s]*:[^:\\s]+(:[^:\\s]*)?(:[^:\\s]+)?(@[^:\\s]+)?").matcher(stringNotation).matches(); } private static String getNotEmptyAt(List<String> list, int index) { Preconditions.checkArgument(!list.get(index).trim().isEmpty(), "Cannot parse coordinate!"); return getAt(list, index); } private static String getAt(List<String> list, int index) { String element = list.get(index); if (isLast(list, index) && element.contains("@")) { return element.split("@", 2)[0]; } return element; } private static boolean isLast(List<String> list, int index) { return list.size() == index + 1; } public String toMapNotation(String quote) { return toMap().entrySet().stream().map(new MapEntryToStringFunction(quote)).collect(joining(COMMA_SPACE)); } public static Coordinate fromMap(Map<String, String> map) { String name = map.get(NAME_KEY); Preconditions.checkArgument(!Strings.isNullOrEmpty(name), "'name' element is required. "); CoordinateBuilder coordinateBuilder = CoordinateBuilder.aCoordinate(name); if (!Strings.isNullOrEmpty(map.get(GROUP_KEY))) { coordinateBuilder.withGroup(map.get(GROUP_KEY)); } if (!Strings.isNullOrEmpty(map.get(VERSION_KEY))) { coordinateBuilder.withVersion(map.get(VERSION_KEY)); } if (!Strings.isNullOrEmpty(map.get(CLASSIFIER_KEY))) { coordinateBuilder.withClassifier(map.get(CLASSIFIER_KEY)); } if (!Strings.isNullOrEmpty(map.get(EXT_KEY))) { coordinateBuilder.withExtension(map.get(EXT_KEY)); } return coordinateBuilder.build(); } private Map<String, String> toMap() { Map<String, String> map = new LinkedHashMap<>(); putIfNotNull(map, group, GROUP_KEY); map.put(NAME_KEY, name); putIfNotNull(map, version, VERSION_KEY); putIfNotNull(map, classifier, CLASSIFIER_KEY); putIfNotNull(map, extension, EXT_KEY); return map; } private void putIfNotNull(Map<String, String> map, String value, String key) { if (value != null) { map.put(key, value); } } public static boolean isValidMap(Map<String, ?> map) { return Sets.difference(map.keySet(), ALL_KEYS).isEmpty() && map.keySet().containsAll(REQUIRED_KEYS); } @Override public int compareTo(Coordinate that) { return ComparisonChain.start() .compare(this.group, that.group, COMPARATOR) .compare(this.name, that.name) .compare(this.version, that.version, COMPARATOR) .compare(this.classifier, that.classifier, COMPARATOR) .compare(this.extension, that.extension, COMPARATOR) .result(); } private static final class NaturalNullFirstOrdering<T extends Comparable<? super T>> implements Comparator<T> { @Override public int compare(T o1, T o2) { if (o1 != null && o2 != null) { return o1.compareTo(o2); } if (o1 == null && o2 == null) { return 0; } if (o1 != null) { return 1; } else { return -1; } } } public static class CoordinateBuilder { private String group = null; private String name; private String version = null; private String classifier = null; private String extension = null; private CoordinateBuilder() { } public static CoordinateBuilder aCoordinate(String name) { CoordinateBuilder coordinateBuilder = new CoordinateBuilder(); coordinateBuilder.name = name; return coordinateBuilder; } public CoordinateBuilder withGroup(String group) { this.group = emptyToNull(group); return this; } private String emptyToNull(String value) { return value == null || value.isEmpty() ? null : value; } public CoordinateBuilder withVersion(String version) { this.version = emptyToNull(version); return this; } public CoordinateBuilder withClassifier(String classifier) { this.classifier = emptyToNull(classifier); return this; } public CoordinateBuilder withExtension(String extension) { this.extension = emptyToNull(extension); return this; } public Coordinate build() { return new Coordinate(group, name, version, classifier, extension); } } private static class MapEntryToStringFunction implements Function<Map.Entry<String, String>, String> { private final String quotationMark; private MapEntryToStringFunction(String quotationMark) { this.quotationMark = quotationMark; } @Override public String apply(Map.Entry<String, String> mapEntry) { return String.format("%s: %s%s%s", mapEntry.getKey(), quotationMark, mapEntry.getValue(), quotationMark); } } } <|start_filename|>src/test/resources/actions/sort/with_closure.groovy<|end_filename|> dependencies { compile 'org.slf4j:slf4j-api:1.7.10' compile(group: 'junit', name: 'junit', version: '4.11') { transitive = false } compile('com.google.truth:truth:0.27') { // disable all transitive dependencies of this dependency transitive = false } compile 'com.google.guava:guava:17.0' { transitive = false } } <|start_filename|>src/main/kotlin/com/github/platan/idea/dependencies/sort/StringUtil.kt<|end_filename|> package com.github.platan.idea.dependencies.sort import kotlin.text.Regex object StringUtil { @JvmStatic fun removeEmptyLines(string: String): String { return string.replace(Regex("\n[ \t]*(?=\n)"), "") } } <|start_filename|>src/test/resources/actions/sort/by_configuration_name_after.groovy<|end_filename|> dependencies { compile 'junit:junit:4.11' testCompile 'junit:junit:4.11' } <|start_filename|>src/main/kotlin/com/github/platan/idea/dependencies/sort/DependencyUtil.kt<|end_filename|> package com.github.platan.idea.dependencies.sort import com.intellij.psi.PsiElement import org.jetbrains.plugins.groovy.lang.psi.api.statements.arguments.GrNamedArgument import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.literals.GrString import org.jetbrains.plugins.groovy.lang.psi.util.GrStringUtil import java.util.* object DependencyUtil { @JvmStatic fun toMap(namedArguments: Array<GrNamedArgument>): Map<String, String> { val map = LinkedHashMap<String, String>() for (namedArgument in namedArguments) { val expression = namedArgument.expression if (namedArgument.label == null || expression == null) { continue } val key = namedArgument.label!!.text val value = removeQuotesAndUnescape(expression) map[key] = value } return map } @JvmStatic fun toMapWithPsiElementValues(namedArguments: Array<GrNamedArgument>): Map<String, PsiElement> { val map = LinkedHashMap<String, PsiElement>() for (namedArgument in namedArguments) { val expression = namedArgument.expression if (namedArgument.label == null || expression == null) { continue } val key = namedArgument.label!!.text map[key] = expression } return map } fun removeQuotesAndUnescape(expression: PsiElement): String { val quote = GrStringUtil.getStartQuote(expression.text) var value = GrStringUtil.removeQuotes(expression.text) if (isInterpolableString(quote) && !isGstring(expression)) { val stringWithoutQuotes = GrStringUtil.removeQuotes(expression.text) value = GrStringUtil.escapeAndUnescapeSymbols(stringWithoutQuotes, "", "\"$", StringBuilder()) } return value } @JvmStatic fun isGstring(element: PsiElement): Boolean { return element is GrString } @JvmStatic fun isInterpolableString(quote: String): Boolean { return quote == GrStringUtil.DOUBLE_QUOTES || quote == GrStringUtil.TRIPLE_DOUBLE_QUOTES } } <|start_filename|>src/test/resources/actions/sort/with_method_after.groovy<|end_filename|> dependencies { compile 'junit:junit:4.11' println 'dependencies' println1 'dependencies' println2('dependencies') runtime 'com.google.guava:guava:17.0' }
platan/idea-gradle-dependencies-formatter
<|start_filename|>tz/checklinks.awk<|end_filename|> # Check links in tz tables. # Contributed by <NAME>. This file is in the public domain. BEGIN { # Special marker indicating that the name is defined as a Zone. # It is a newline so that it cannot match a valid name. # It is not null so that its slot does not appear unset. Zone = "\n" } /^Zone/ { if (defined[$2]) { if (defined[$2] == Zone) { printf "%s: Zone has duplicate definition\n", $2 } else { printf "%s: Link with same name as Zone\n", $2 } status = 1 } defined[$2] = Zone } /^Link/ { if (defined[$3]) { if (defined[$3] == Zone) { printf "%s: Link with same name as Zone\n", $3 } else if (defined[$3] == $2) { printf "%s: Link has duplicate definition\n", $3 } else { printf "%s: Link to both %s and %s\n", $3, defined[$3], $2 } status = 1 } used[$2] = 1 defined[$3] = $2 } END { for (tz in used) { if (defined[tz] != Zone) { printf "%s: Link to non-zone\n", tz status = 1 } } exit status }
karremans9/clock
<|start_filename|>site/resources/public/js/lib/parinfer-codemirror.externs.js<|end_filename|> var parinferCodeMirror = {}; parinferCodeMirror.init; parinferCodeMirror.enable; parinferCodeMirror.disable; parinferCodeMirror.setMode; parinferCodeMirror.setOptions; <|start_filename|>site/src/parinfer_site/editor_ui.cljs<|end_filename|> (ns parinfer-site.editor-ui (:require [parinfer-site.state :refer [state]] [om.core :as om] [sablono.core :refer-macros [html]] [parinfer-site.parinfer :refer [major-version]] [goog.dom :as gdom])) (defn refresh! "Called after settings are updated to cause the editor to reflect them." [cm] ;; update the text by running parinfer on it ; (fix-text! cm) ;; make sure cursor is still visible (let [element (.getWrapperElement cm) cursor (gdom/getElementByClass "CodeMirror-cursors" element)] (aset cursor "style" "visibility" "visible"))) (def smart-caption (list [:em "Smart Mode"] "New experimental behavior, hopefully making it unnecessary to switch between Indent Mode and Paren Mode")) (def indent-caption (list [:em "Indent Mode "] "transforms your code after every edit in order to make Lisp an indentation-based language like Python. It does this by moving around end-of-line close-parens (dimmed in the editor) in a formalized way. This gives us implicit indentation while allowing us to see explicit structure.")) (def paren-caption (list [:em "Paren Mode "] "transforms your code after every edit by constraining indentation to proper thresholds determined by parens. It is a LOOSE pretty-printer in that it respects and preserves your chosen indentation without configuration, as long as it falls within standard thresholds.")) (def cursor-dx-caption (list [:em "cursorDx:"] "We must track how far the open-parens on the right side of the cursor have shifted after each edit. That way we can shift subsequent lines by the same amount to preserve relative indentation. This cursorDx (delta x) value must be determined by the editor and given to Parinfer.")) (def force-balance-caption (list "Employ v1's aggressive rules to ensure parens are always balanced.")) (def mode->caption {:smart-mode smart-caption :indent-mode indent-caption :paren-mode paren-caption}) (defn editor-header [editor] (reify om/IRender (render [_] (html [:div [:h1 "Par" [:em "infer"] [:em (str " v" (major-version))]] [:div.subtitle {:style {:opacity 0.5 :display "inline-block" :margin-left 10}} "(demo editor)"] [:div.subtitle {:style {:margin-top -42 :text-align "right"}} "v" (aget js/window "parinfer" "version") " | " [:a {:href "https://github.com/shaunlebron/parinfer"} "GitHub"]]])))) (defn editor-footer [editor] (reify om/IRender (render [_] (html [:div [:select.mode {:value (name (:mode editor)) :on-mouse-over (fn [e] (om/update! editor :help-caption (mode->caption (:mode editor)))) :on-mouse-out (fn [e] (om/update! editor :help-caption "")) :on-change (fn [e] (let [new-mode (keyword (aget e "target" "value"))] (om/update! editor :help-caption (mode->caption new-mode)) (om/update! editor :mode new-mode) (js/parinferCodeMirror.setMode (:cm editor) ({:indent-mode "indent" :paren-mode "paren" :smart-mode "smart"} new-mode))))} [:option {:value "smart-mode"} "Smart Mode"] [:option {:value "indent-mode"} "Indent Mode"] [:option {:value "paren-mode"} "Paren Mode"]] (when (#{:indent-mode :smart-mode} (:mode editor)) (let [path [:options :force-balance]] [:label.user-option {:on-mouse-over (fn [e] (om/update! editor :help-caption force-balance-caption)) :on-mouse-out (fn [e] (om/update! editor :help-caption ""))} [:input {:type "checkbox" :checked (get-in editor path) :on-change (fn [e] (let [checked (aget e "target" "checked")] (om/update! editor path checked) (js/parinferCodeMirror.setOptions (:cm editor) #js{:forceBalance checked})))}] "forceBalance"])) (let [{:keys [name message] :as error} (get-in editor [:result :error])] (when error [:div.status.error [:div.status-name "Parinfer is suspended: "] [:div.status-msg message]])) [:div.help-caption (:help-caption editor)]])))) (defn prevent-backspace-navigation! "Since the cursor is always showing in the text editor because it's useful to see when cursor position is significant, we disable the backspace key to prevent it from making the browser go back to the previous page." [] (js/window.addEventListener "keydown" (fn [e] (when (= 8 (aget e "keyCode")) (.preventDefault e) false)))) (defn create-ui-section "Start rendering the ui header or footer for the given editor" [editor-key section element-id] (om/root (fn [editors] (reify om/IRender (render [_] (om/build section (get editors editor-key))))) state {:target (js/document.getElementById element-id)})) (defn render! [editor-key] (prevent-backspace-navigation!) (create-ui-section editor-key editor-header "editor-header") (create-ui-section editor-key editor-footer "editor-footer")) <|start_filename|>site/resources/public/parinfer.js<|end_filename|> // // Parinfer 3.12.0 // // Copyright 2015-2017 © <NAME> // MIT License // // Home Page: http://shaunlebron.github.io/parinfer/ // GitHub: https://github.com/shaunlebron/parinfer // // For DOCUMENTATION on this file, please see `doc/code.md`. // Use `sync.sh` to keep the function/var links in `doc/code.md` accurate. // //------------------------------------------------------------------------------ // JS Module Boilerplate //------------------------------------------------------------------------------ (function (root, factory) { if (typeof define === 'function' && define.amd) { define([], factory); } else if (typeof module === 'object' && module.exports) { module.exports = factory(); } else { root.parinfer = factory(); } }(this, function() { // start module anonymous scope "use strict"; //------------------------------------------------------------------------------ // Constants / Predicates //------------------------------------------------------------------------------ // NOTE: this is a performance hack // The main result object uses a lot of "unsigned integer or null" values. // Using a negative integer is faster than actual null because it cuts down on // type coercion overhead. var UINT_NULL = -999; var INDENT_MODE = "INDENT_MODE", PAREN_MODE = "PAREN_MODE"; var BACKSLASH = '\\', BLANK_SPACE = ' ', DOUBLE_SPACE = ' ', DOUBLE_QUOTE = '"', NEWLINE = '\n', SEMICOLON = ';', TAB = '\t'; var LINE_ENDING_REGEX = /\r?\n/; var MATCH_PAREN = { "{": "}", "}": "{", "[": "]", "]": "[", "(": ")", ")": "(" }; // toggle this to check the asserts during development var RUN_ASSERTS = false; function isBoolean(x) { return typeof x === 'boolean'; } function isArray(x) { return Array.isArray(x); } function isInteger(x) { return typeof x === 'number' && isFinite(x) && Math.floor(x) === x; } //------------------------------------------------------------------------------ // Options Structure //------------------------------------------------------------------------------ function transformChange(change) { if (!change) { return undefined; } var newLines = change.newText.split(LINE_ENDING_REGEX); var oldLines = change.oldText.split(LINE_ENDING_REGEX); // single line case: // (defn foo| []) // ^ newEndX, newEndLineNo // +++ // multi line case: // (defn foo // ++++ // "docstring." // ++++++++++++++++ // |[]) // ++^ newEndX, newEndLineNo var lastOldLineLen = oldLines[oldLines.length-1].length; var lastNewLineLen = newLines[newLines.length-1].length; var oldEndX = (oldLines.length === 1 ? change.x : 0) + lastOldLineLen; var newEndX = (newLines.length === 1 ? change.x : 0) + lastNewLineLen; var newEndLineNo = change.lineNo + (newLines.length-1); return { x: change.x, lineNo: change.lineNo, oldText: change.oldText, newText: change.newText, oldEndX: oldEndX, newEndX: newEndX, newEndLineNo: newEndLineNo, lookupLineNo: newEndLineNo, lookupX: newEndX }; } function transformChanges(changes) { if (changes.length === 0) { return null; } var lines = {}; var line, i, change; for (i=0; i<changes.length; i++) { change = transformChange(changes[i]); line = lines[change.lookupLineNo]; if (!line) { line = lines[change.lookupLineNo] = {}; } line[change.lookupX] = change; } return lines; } function parseOptions(options) { options = options || {}; return { cursorX: options.cursorX, cursorLine: options.cursorLine, prevCursorX: options.prevCursorX, prevCursorLine: options.prevCursorLine, selectionStartLine: options.selectionStartLine, changes: options.changes, partialResult: options.partialResult, forceBalance: options.forceBalance, returnParens: options.returnParens }; } //------------------------------------------------------------------------------ // Result Structure //------------------------------------------------------------------------------ // This represents the running result. As we scan through each character // of a given text, we mutate this structure to update the state of our // system. function initialParenTrail() { return { lineNo: UINT_NULL, // [integer] - line number of the last parsed paren trail startX: UINT_NULL, // [integer] - x position of first paren in this range endX: UINT_NULL, // [integer] - x position after the last paren in this range openers: [], // [array of stack elements] - corresponding open-paren for each close-paren in this range clamped: { startX: UINT_NULL, // startX before paren trail was clamped endX: UINT_NULL, // endX before paren trail was clamped openers: [] // openers that were cut out after paren trail was clamped } }; } function getInitialResult(text, options, mode, smart) { var result = { mode: mode, // [enum] - current processing mode (INDENT_MODE or PAREN_MODE) smart: smart, // [boolean] - smart mode attempts special user-friendly behavior origText: text, // [string] - original text origCursorX: UINT_NULL, // [integer] - original cursorX option origCursorLine: UINT_NULL, // [integer] - original cursorLine option inputLines: // [string array] - input lines that we process line-by-line, char-by-char text.split(LINE_ENDING_REGEX), inputLineNo: -1, // [integer] - the current input line number inputX: -1, // [integer] - the current input x position of the current character (ch) lines: [], // [string array] - output lines (with corrected parens or indentation) lineNo: -1, // [integer] - output line number we are on ch: "", // [string] - character we are processing (can be changed to indicate a replacement) x: 0, // [integer] - output x position of the current character (ch) indentX: UINT_NULL, // [integer] - x position of the indentation point if present parenStack: [], // We track where we are in the Lisp tree by keeping a stack (array) of open-parens. // Stack elements are objects containing keys {ch, x, lineNo, indentDelta} // whose values are the same as those described here in this result structure. tabStops: [], // In Indent Mode, it is useful for editors to snap a line's indentation // to certain critical points. Thus, we have a `tabStops` array of objects containing // keys {ch, x, lineNo, argX}, which is just the state of the `parenStack` at the cursor line. parenTrail: initialParenTrail(), // the range of parens at the end of a line parenTrails: [], // [array of {lineNo, startX, endX}] - all non-empty parenTrails to be returned returnParens: false, // [boolean] - determines if we return `parens` described below parens: [], // [array of {lineNo, x, closer, children}] - paren tree if `returnParens` is true cursorX: UINT_NULL, // [integer] - x position of the cursor cursorLine: UINT_NULL, // [integer] - line number of the cursor prevCursorX: UINT_NULL, // [integer] - x position of the previous cursor prevCursorLine: UINT_NULL, // [integer] - line number of the previous cursor selectionStartLine: UINT_NULL, // [integer] - line number of the current selection starting point changes: null, // [object] - mapping change.key to a change object (please see `transformChange` for object structure) isInCode: true, // [boolean] - indicates if we are currently in "code space" (not string or comment) isEscaping: false, // [boolean] - indicates if the next character will be escaped (e.g. `\c`). This may be inside string, comment, or code. isEscaped: false, // [boolean] - indicates if the current character is escaped (e.g. `\c`). This may be inside string, comment, or code. isInStr: false, // [boolean] - indicates if we are currently inside a string isInComment: false, // [boolean] - indicates if we are currently inside a comment commentX: UINT_NULL, // [integer] - x position of the start of comment on current line (if any) quoteDanger: false, // [boolean] - indicates if quotes are imbalanced inside of a comment (dangerous) trackingIndent: false, // [boolean] - are we looking for the indentation point of the current line? skipChar: false, // [boolean] - should we skip the processing of the current character? success: false, // [boolean] - was the input properly formatted enough to create a valid result? partialResult: false, // [boolean] - should we return a partial result when an error occurs? forceBalance: false, // [boolean] - should indent mode aggressively enforce paren balance? maxIndent: UINT_NULL, // [integer] - maximum allowed indentation of subsequent lines in Paren Mode indentDelta: 0, // [integer] - how far indentation was shifted by Paren Mode // (preserves relative indentation of nested expressions) trackingArgTabStop: null, // [string] - enum to track how close we are to the first-arg tabStop in a list // For example a tabStop occurs at `bar` below: // // ` (foo bar` // 00011112222000 <-- state after processing char (enums below) // // 0 null => not searching // 1 'space' => searching for next space // 2 'arg' => searching for arg // // (We create the tabStop when the change from 2->0 happens.) // error: { // if 'success' is false, return this error to the user name: null, // [string] - Parinfer's unique name for this error message: null, // [string] - error message to display lineNo: null, // [integer] - line number of error x: null, // [integer] - start x position of error extra: { name: null, lineNo: null, x: null } }, errorPosCache: {} // [object] - maps error name to a potential error position }; // Make sure no new properties are added to the result, for type safety. // (uncomment only when debugging, since it incurs a perf penalty) // Object.preventExtensions(result); // Object.preventExtensions(result.parenTrail); // merge options if they are valid if (options) { if (isInteger(options.cursorX)) { result.cursorX = options.cursorX; result.origCursorX = options.cursorX; } if (isInteger(options.cursorLine)) { result.cursorLine = options.cursorLine; result.origCursorLine = options.cursorLine; } if (isInteger(options.prevCursorX)) { result.prevCursorX = options.prevCursorX; } if (isInteger(options.prevCursorLine)) { result.prevCursorLine = options.prevCursorLine; } if (isInteger(options.selectionStartLine)) { result.selectionStartLine = options.selectionStartLine; } if (isArray(options.changes)) { result.changes = transformChanges(options.changes); } if (isBoolean(options.partialResult)) { result.partialResult = options.partialResult; } if (isBoolean(options.forceBalance)) { result.forceBalance = options.forceBalance; } if (isBoolean(options.returnParens)) { result.returnParens = options.returnParens; } } return result; } //------------------------------------------------------------------------------ // Possible Errors //------------------------------------------------------------------------------ // `result.error.name` is set to any of these var ERROR_QUOTE_DANGER = "quote-danger"; var ERROR_EOL_BACKSLASH = "eol-backslash"; var ERROR_UNCLOSED_QUOTE = "unclosed-quote"; var ERROR_UNCLOSED_PAREN = "unclosed-paren"; var ERROR_UNMATCHED_CLOSE_PAREN = "unmatched-close-paren"; var ERROR_UNMATCHED_OPEN_PAREN = "unmatched-open-paren"; var ERROR_LEADING_CLOSE_PAREN = "leading-close-paren"; var ERROR_UNHANDLED = "unhandled"; var errorMessages = {}; errorMessages[ERROR_QUOTE_DANGER] = "Quotes must balanced inside comment blocks."; errorMessages[ERROR_EOL_BACKSLASH] = "Line cannot end in a hanging backslash."; errorMessages[ERROR_UNCLOSED_QUOTE] = "String is missing a closing quote."; errorMessages[ERROR_UNCLOSED_PAREN] = "Unclosed open-paren."; errorMessages[ERROR_UNMATCHED_CLOSE_PAREN] = "Unmatched close-paren."; errorMessages[ERROR_UNMATCHED_OPEN_PAREN] = "Unmatched open-paren."; errorMessages[ERROR_LEADING_CLOSE_PAREN] = "Line cannot lead with a close-paren."; errorMessages[ERROR_UNHANDLED] = "Unhandled error."; function cacheErrorPos(result, errorName) { var e = { lineNo: result.lineNo, x: result.x, inputLineNo: result.inputLineNo, inputX: result.inputX }; result.errorPosCache[errorName] = e; return e; } function error(result, name) { var cache = result.errorPosCache[name]; var keyLineNo = result.partialResult ? 'lineNo' : 'inputLineNo'; var keyX = result.partialResult ? 'x' : 'inputX'; var e = { parinferError: true, name: name, message: errorMessages[name], lineNo: cache ? cache[keyLineNo] : result[keyLineNo], x: cache ? cache[keyX] : result[keyX] }; var opener = peek(result.parenStack, 0); if (name === ERROR_UNMATCHED_CLOSE_PAREN) { // extra error info for locating the open-paren that it should've matched cache = result.errorPosCache[ERROR_UNMATCHED_OPEN_PAREN]; if (cache || opener) { e.extra = { name: ERROR_UNMATCHED_OPEN_PAREN, lineNo: cache ? cache[keyLineNo] : opener[keyLineNo], x: cache ? cache[keyX] : opener[keyX] }; } } else if (name === ERROR_UNCLOSED_PAREN) { e.lineNo = opener[keyLineNo]; e.x = opener[keyX]; } return e; } //------------------------------------------------------------------------------ // String Operations //------------------------------------------------------------------------------ function replaceWithinString(orig, start, end, replace) { return ( orig.substring(0, start) + replace + orig.substring(end) ); } if (RUN_ASSERTS) { console.assert(replaceWithinString('aaa', 0, 2, '') === 'a'); console.assert(replaceWithinString('aaa', 0, 1, 'b') === 'baa'); console.assert(replaceWithinString('aaa', 0, 2, 'b') === 'ba'); } function repeatString(text, n) { var i; var result = ""; for (i = 0; i < n; i++) { result += text; } return result; } if (RUN_ASSERTS) { console.assert(repeatString('a', 2) === 'aa'); console.assert(repeatString('aa', 3) === 'aaaaaa'); console.assert(repeatString('aa', 0) === ''); console.assert(repeatString('', 0) === ''); console.assert(repeatString('', 5) === ''); } function getLineEnding(text) { // NOTE: We assume that if the CR char "\r" is used anywhere, // then we should use CRLF line-endings after every line. var i = text.search("\r"); if (i !== -1) { return "\r\n"; } return "\n"; } //------------------------------------------------------------------------------ // Line operations //------------------------------------------------------------------------------ function isCursorAffected(result, start, end) { if (result.cursorX === start && result.cursorX === end) { return result.cursorX === 0; } return result.cursorX >= end; } function shiftCursorOnEdit(result, lineNo, start, end, replace) { var oldLength = end - start; var newLength = replace.length; var dx = newLength - oldLength; if (dx !== 0 && result.cursorLine === lineNo && result.cursorX !== UINT_NULL && isCursorAffected(result, start, end)) { result.cursorX += dx; } } function replaceWithinLine(result, lineNo, start, end, replace) { var line = result.lines[lineNo]; var newLine = replaceWithinString(line, start, end, replace); result.lines[lineNo] = newLine; shiftCursorOnEdit(result, lineNo, start, end, replace); } function insertWithinLine(result, lineNo, idx, insert) { replaceWithinLine(result, lineNo, idx, idx, insert); } function initLine(result) { result.x = 0; result.lineNo++; // reset line-specific state result.indentX = UINT_NULL; result.commentX = UINT_NULL; result.indentDelta = 0; delete result.errorPosCache[ERROR_UNMATCHED_CLOSE_PAREN]; delete result.errorPosCache[ERROR_UNMATCHED_OPEN_PAREN]; delete result.errorPosCache[ERROR_LEADING_CLOSE_PAREN]; result.trackingArgTabStop = null; result.trackingIndent = !result.isInStr; } // if the current character has changed, commit its change to the current line. function commitChar(result, origCh) { var ch = result.ch; if (origCh !== ch) { replaceWithinLine(result, result.lineNo, result.x, result.x + origCh.length, ch); result.indentDelta -= (origCh.length - ch.length); } result.x += ch.length; } //------------------------------------------------------------------------------ // Misc Utils //------------------------------------------------------------------------------ function clamp(val, minN, maxN) { if (minN !== UINT_NULL) { val = Math.max(minN, val); } if (maxN !== UINT_NULL) { val = Math.min(maxN, val); } return val; } if (RUN_ASSERTS) { console.assert(clamp(1, 3, 5) === 3); console.assert(clamp(9, 3, 5) === 5); console.assert(clamp(1, 3, UINT_NULL) === 3); console.assert(clamp(5, 3, UINT_NULL) === 5); console.assert(clamp(1, UINT_NULL, 5) === 1); console.assert(clamp(9, UINT_NULL, 5) === 5); console.assert(clamp(1, UINT_NULL, UINT_NULL) === 1); } function peek(arr, idxFromBack) { var maxIdx = arr.length - 1; if (idxFromBack > maxIdx) { return null; } return arr[maxIdx - idxFromBack]; } if (RUN_ASSERTS) { console.assert(peek(['a'], 0) === 'a'); console.assert(peek(['a'], 1) === null); console.assert(peek(['a', 'b', 'c'], 0) === 'c'); console.assert(peek(['a', 'b', 'c'], 1) === 'b'); console.assert(peek(['a', 'b', 'c'], 5) === null); console.assert(peek([], 0) === null); console.assert(peek([], 1) === null); } //------------------------------------------------------------------------------ // Questions about characters //------------------------------------------------------------------------------ function isOpenParen(ch) { return ch === "{" || ch === "(" || ch === "["; } function isCloseParen(ch) { return ch === "}" || ch === ")" || ch === "]"; } function isValidCloseParen(parenStack, ch) { if (parenStack.length === 0) { return false; } return peek(parenStack, 0).ch === MATCH_PAREN[ch]; } function isWhitespace(result) { var ch = result.ch; return !result.isEscaped && (ch === BLANK_SPACE || ch === DOUBLE_SPACE); } // can this be the last code character of a list? function isClosable(result) { var ch = result.ch; var closer = (isCloseParen(ch) && !result.isEscaped); return result.isInCode && !isWhitespace(result) && ch !== "" && !closer; } //------------------------------------------------------------------------------ // Advanced operations on characters //------------------------------------------------------------------------------ function checkCursorHolding(result) { var opener = peek(result.parenStack, 0); var parent = peek(result.parenStack, 1); var holdMinX = parent ? parent.x+1 : 0; var holdMaxX = opener.x; var holding = ( result.cursorLine === opener.lineNo && holdMinX <= result.cursorX && result.cursorX <= holdMaxX ); var shouldCheckPrev = !result.changes && result.prevCursorLine !== UINT_NULL; if (shouldCheckPrev) { var prevHolding = ( result.prevCursorLine === opener.lineNo && holdMinX <= result.prevCursorX && result.prevCursorX <= holdMaxX ); if (prevHolding && !holding) { throw {releaseCursorHold: true}; } } return holding; } function trackArgTabStop(result, state) { if (state === 'space') { if (result.isInCode && isWhitespace(result)) { result.trackingArgTabStop = 'arg'; } } else if (state === 'arg') { if (!isWhitespace(result)) { var opener = peek(result.parenStack, 0); opener.argX = result.x; result.trackingArgTabStop = null; } } } //------------------------------------------------------------------------------ // Literal character events //------------------------------------------------------------------------------ function onOpenParen(result) { if (result.isInCode) { var opener = { inputLineNo: result.inputLineNo, inputX: result.inputX, lineNo: result.lineNo, x: result.x, ch: result.ch, indentDelta: result.indentDelta, maxChildIndent: UINT_NULL }; if (result.returnParens) { opener.children = []; opener.closer = { lineNo: UINT_NULL, x: UINT_NULL, ch: '' }; var parent = peek(result.parenStack, 0); parent = parent ? parent.children : result.parens; parent.push(opener); } result.parenStack.push(opener); result.trackingArgTabStop = 'space'; } } function setCloser(opener, lineNo, x, ch) { opener.closer.lineNo = lineNo; opener.closer.x = x; opener.closer.ch = ch; } function onMatchedCloseParen(result) { var opener = peek(result.parenStack, 0); if (result.returnParens) { setCloser(opener, result.lineNo, result.x, result.ch); } result.parenTrail.endX = result.x + 1; result.parenTrail.openers.push(opener); if (result.mode === INDENT_MODE && result.smart && checkCursorHolding(result)) { var origStartX = result.parenTrail.startX; var origEndX = result.parenTrail.endX; var origOpeners = result.parenTrail.openers; resetParenTrail(result, result.lineNo, result.x+1); result.parenTrail.clamped.startX = origStartX; result.parenTrail.clamped.endX = origEndX; result.parenTrail.clamped.openers = origOpeners; } result.parenStack.pop(); result.trackingArgTabStop = null; } function onUnmatchedCloseParen(result) { if (result.mode === PAREN_MODE) { var trail = result.parenTrail; var inLeadingParenTrail = trail.lineNo === result.lineNo && trail.startX === result.indentX; var canRemove = result.smart && inLeadingParenTrail; if (!canRemove) { throw error(result, ERROR_UNMATCHED_CLOSE_PAREN); } } else if (result.mode === INDENT_MODE && !result.errorPosCache[ERROR_UNMATCHED_CLOSE_PAREN]) { cacheErrorPos(result, ERROR_UNMATCHED_CLOSE_PAREN); var opener = peek(result.parenStack, 0); if (opener) { var e = cacheErrorPos(result, ERROR_UNMATCHED_OPEN_PAREN); e.inputLineNo = opener.inputLineNo; e.inputX = opener.inputX; } } result.ch = ""; } function onCloseParen(result) { if (result.isInCode) { if (isValidCloseParen(result.parenStack, result.ch)) { onMatchedCloseParen(result); } else { onUnmatchedCloseParen(result); } } } function onTab(result) { if (result.isInCode) { result.ch = DOUBLE_SPACE; } } function onSemicolon(result) { if (result.isInCode) { result.isInComment = true; result.commentX = result.x; result.trackingArgTabStop = null; } } function onNewline(result) { result.isInComment = false; result.ch = ""; } function onQuote(result) { if (result.isInStr) { result.isInStr = false; } else if (result.isInComment) { result.quoteDanger = !result.quoteDanger; if (result.quoteDanger) { cacheErrorPos(result, ERROR_QUOTE_DANGER); } } else { result.isInStr = true; cacheErrorPos(result, ERROR_UNCLOSED_QUOTE); } } function onBackslash(result) { result.isEscaping = true; } function afterBackslash(result) { result.isEscaping = false; result.isEscaped = true; if (result.ch === NEWLINE) { if (result.isInCode) { throw error(result, ERROR_EOL_BACKSLASH); } onNewline(result); } } //------------------------------------------------------------------------------ // Character dispatch //------------------------------------------------------------------------------ function onChar(result) { var ch = result.ch; result.isEscaped = false; if (result.isEscaping) { afterBackslash(result); } else if (isOpenParen(ch)) { onOpenParen(result); } else if (isCloseParen(ch)) { onCloseParen(result); } else if (ch === DOUBLE_QUOTE) { onQuote(result); } else if (ch === SEMICOLON) { onSemicolon(result); } else if (ch === BACKSLASH) { onBackslash(result); } else if (ch === TAB) { onTab(result); } else if (ch === NEWLINE) { onNewline(result); } ch = result.ch; result.isInCode = !result.isInComment && !result.isInStr; if (isClosable(result)) { resetParenTrail(result, result.lineNo, result.x+ch.length); } var state = result.trackingArgTabStop; if (state) { trackArgTabStop(result, state); } } //------------------------------------------------------------------------------ // Cursor functions //------------------------------------------------------------------------------ function isCursorLeftOf(cursorX, cursorLine, x, lineNo) { return ( cursorLine === lineNo && x !== UINT_NULL && cursorX !== UINT_NULL && cursorX <= x // inclusive since (cursorX = x) implies (x-1 < cursor < x) ); } function isCursorRightOf(cursorX, cursorLine, x, lineNo) { return ( cursorLine === lineNo && x !== UINT_NULL && cursorX !== UINT_NULL && cursorX > x ); } function isCursorInComment(result, cursorX, cursorLine) { return isCursorRightOf(cursorX, cursorLine, result.commentX, result.lineNo); } function handleChangeDelta(result) { if (result.changes && (result.smart || result.mode === PAREN_MODE)) { var line = result.changes[result.inputLineNo]; if (line) { var change = line[result.inputX]; if (change) { result.indentDelta += (change.newEndX - change.oldEndX); } } } } //------------------------------------------------------------------------------ // Paren Trail functions //------------------------------------------------------------------------------ function resetParenTrail(result, lineNo, x) { result.parenTrail.lineNo = lineNo; result.parenTrail.startX = x; result.parenTrail.endX = x; result.parenTrail.openers = []; result.parenTrail.clamped.startX = UINT_NULL; result.parenTrail.clamped.endX = UINT_NULL; result.parenTrail.clamped.openers = []; } function isCursorClampingParenTrail(result, cursorX, cursorLine) { return ( isCursorRightOf(cursorX, cursorLine, result.parenTrail.startX, result.lineNo) && !isCursorInComment(result, cursorX, cursorLine) ); } // INDENT MODE: allow the cursor to clamp the paren trail function clampParenTrailToCursor(result) { var startX = result.parenTrail.startX; var endX = result.parenTrail.endX; var clamping = isCursorClampingParenTrail(result, result.cursorX, result.cursorLine); if (clamping) { var newStartX = Math.max(startX, result.cursorX); var newEndX = Math.max(endX, result.cursorX); var line = result.lines[result.lineNo]; var removeCount = 0; var i; for (i = startX; i < newStartX; i++) { if (isCloseParen(line[i])) { removeCount++; } } var openers = result.parenTrail.openers; result.parenTrail.openers = openers.slice(removeCount); result.parenTrail.startX = newStartX; result.parenTrail.endX = newEndX; result.parenTrail.clamped.openers = openers.slice(0, removeCount); result.parenTrail.clamped.startX = startX; result.parenTrail.clamped.endX = endX; } } // INDENT MODE: pops the paren trail from the stack function popParenTrail(result) { var startX = result.parenTrail.startX; var endX = result.parenTrail.endX; if (startX === endX) { return; } var openers = result.parenTrail.openers; while (openers.length !== 0) { result.parenStack.push(openers.pop()); } } // Determine which open-paren (if any) on the parenStack should be considered // the direct parent of the current line (given its indentation point). // This allows Smart Mode to simulate Paren Mode's structure-preserving // behavior by adding its `opener.indentDelta` to the current line's indentation. // (care must be taken to prevent redundant indentation correction, detailed below) function getParentOpenerIndex(result, indentX) { var i; for (i=0; i<result.parenStack.length; i++) { var opener = peek(result.parenStack, i); var currOutside = (opener.x < indentX); var prevIndentX = indentX - result.indentDelta; var prevOutside = (opener.x - opener.indentDelta < prevIndentX); var isParent = false; if (prevOutside && currOutside) { isParent = true; } else if (!prevOutside && !currOutside) { isParent = false; } else if (prevOutside && !currOutside) { // POSSIBLE FRAGMENTATION // (foo --\ // +--- FRAGMENT `(foo bar)` => `(foo) bar` // bar) --/ // 1. PREVENT FRAGMENTATION // ```in // (foo // ++ // bar // ``` // ```out // (foo // bar // ``` if (result.indentDelta === 0) { isParent = true; } // 2. ALLOW FRAGMENTATION // ```in // (foo // bar // -- // ``` // ```out // (foo) // bar // ``` else if (opener.indentDelta === 0) { isParent = false; } else { // TODO: identify legitimate cases where both are nonzero // allow the fragmentation by default isParent = false; // TODO: should we throw to exit instead? either of: // 1. give up, just `throw error(...)` // 2. fallback to paren mode to preserve structure } } else if (!prevOutside && currOutside) { // POSSIBLE ADOPTION // (foo) --\ // +--- ADOPT `(foo) bar` => `(foo bar)` // bar --/ var nextOpener = peek(result.parenStack, i+1); // 1. DISALLOW ADOPTION // ```in // (foo // -- // (bar) // -- // baz) // ``` // ```out // (foo // (bar) // baz) // ``` // OR // ```in // (foo // -- // (bar) // - // baz) // ``` // ```out // (foo // (bar) // baz) // ``` if (nextOpener && nextOpener.indentDelta <= opener.indentDelta) { // we can only disallow adoption if nextOpener.indentDelta will actually // prevent the indentX from being in the opener's threshold. if (indentX + nextOpener.indentDelta > opener.x) { isParent = true; } else { isParent = false; } } // 2. ALLOW ADOPTION // ```in // (foo // (bar) // -- // baz) // ``` // ```out // (foo // (bar // baz)) // ``` // OR // ```in // (foo // - // (bar) // -- // baz) // ``` // ```out // (foo // (bar) // baz) // ``` else if (nextOpener && nextOpener.indentDelta > opener.indentDelta) { isParent = true; } // 3. ALLOW ADOPTION // ```in // (foo) // -- // bar // ``` // ```out // (foo // bar) // ``` // OR // ```in // (foo) // bar // ++ // ``` // ```out // (foo // bar // ``` // OR // ```in // (foo) // + // bar // ++ // ``` // ```out // (foo // bar) // ``` else if (result.indentDelta > opener.indentDelta) { isParent = true; } if (isParent) { // if new parent // Clear `indentDelta` since it is reserved for previous child lines only. opener.indentDelta = 0; } } if (isParent) { break; } } return i; } // INDENT MODE: correct paren trail from indentation function correctParenTrail(result, indentX) { var parens = ""; var index = getParentOpenerIndex(result, indentX); var i; for (i=0; i<index; i++) { var opener = result.parenStack.pop(); result.parenTrail.openers.push(opener); var closeCh = MATCH_PAREN[opener.ch]; parens += closeCh; if (result.returnParens) { setCloser(opener, result.parenTrail.lineNo, result.parenTrail.startX+i, closeCh); } } if (result.parenTrail.lineNo !== UINT_NULL) { replaceWithinLine(result, result.parenTrail.lineNo, result.parenTrail.startX, result.parenTrail.endX, parens); result.parenTrail.endX = result.parenTrail.startX + parens.length; rememberParenTrail(result); } } // PAREN MODE: remove spaces from the paren trail function cleanParenTrail(result) { var startX = result.parenTrail.startX; var endX = result.parenTrail.endX; if (startX === endX || result.lineNo !== result.parenTrail.lineNo) { return; } var line = result.lines[result.lineNo]; var newTrail = ""; var spaceCount = 0; var i; for (i = startX; i < endX; i++) { if (isCloseParen(line[i])) { newTrail += line[i]; } else { spaceCount++; } } if (spaceCount > 0) { replaceWithinLine(result, result.lineNo, startX, endX, newTrail); result.parenTrail.endX -= spaceCount; } } // PAREN MODE: append a valid close-paren to the end of the paren trail function appendParenTrail(result) { var opener = result.parenStack.pop(); var closeCh = MATCH_PAREN[opener.ch]; if (result.returnParens) { setCloser(opener, result.parenTrail.lineNo, result.parenTrail.endX, closeCh); } setMaxIndent(result, opener); insertWithinLine(result, result.parenTrail.lineNo, result.parenTrail.endX, closeCh); result.parenTrail.endX++; result.parenTrail.openers.push(opener); updateRememberedParenTrail(result); } function invalidateParenTrail(result) { result.parenTrail = initialParenTrail(); } function checkUnmatchedOutsideParenTrail(result) { var cache = result.errorPosCache[ERROR_UNMATCHED_CLOSE_PAREN]; if (cache && cache.x < result.parenTrail.startX) { throw error(result, ERROR_UNMATCHED_CLOSE_PAREN); } } function setMaxIndent(result, opener) { if (opener) { var parent = peek(result.parenStack, 0); if (parent) { parent.maxChildIndent = opener.x; } else { result.maxIndent = opener.x; } } } function rememberParenTrail(result) { var trail = result.parenTrail; var openers = trail.clamped.openers.concat(trail.openers); if (openers.length > 0) { var isClamped = trail.clamped.startX !== UINT_NULL; var allClamped = trail.openers.length === 0; var shortTrail = { lineNo: trail.lineNo, startX: isClamped ? trail.clamped.startX : trail.startX, endX: allClamped ? trail.clamped.endX : trail.endX }; result.parenTrails.push(shortTrail); if (result.returnParens) { var i; for (i=0; i<openers.length; i++) { openers[i].closer.trail = shortTrail; } } } } function updateRememberedParenTrail(result) { var trail = result.parenTrails[result.parenTrails.length-1]; if (!trail || trail.lineNo !== result.parenTrail.lineNo) { rememberParenTrail(result); } else { trail.endX = result.parenTrail.endX; if (result.returnParens) { var opener = result.parenTrail.openers[result.parenTrail.openers.length-1]; opener.closer.trail = trail; } } } function finishNewParenTrail(result) { if (result.isInStr) { invalidateParenTrail(result); } else if (result.mode === INDENT_MODE) { clampParenTrailToCursor(result); popParenTrail(result); } else if (result.mode === PAREN_MODE) { setMaxIndent(result, peek(result.parenTrail.openers, 0)); if (result.lineNo !== result.cursorLine) { cleanParenTrail(result); } rememberParenTrail(result); } } //------------------------------------------------------------------------------ // Indentation functions //------------------------------------------------------------------------------ function addIndent(result, delta) { var origIndent = result.x; var newIndent = origIndent + delta; var indentStr = repeatString(BLANK_SPACE, newIndent); replaceWithinLine(result, result.lineNo, 0, origIndent, indentStr); result.x = newIndent; result.indentX = newIndent; result.indentDelta += delta; } function shouldAddOpenerIndent(result, opener) { // Don't add opener.indentDelta if the user already added it. // (happens when multiple lines are indented together) return (opener.indentDelta !== result.indentDelta); } function correctIndent(result) { var origIndent = result.x; var newIndent = origIndent; var minIndent = 0; var maxIndent = result.maxIndent; var opener = peek(result.parenStack, 0); if (opener) { minIndent = opener.x + 1; maxIndent = opener.maxChildIndent; if (shouldAddOpenerIndent(result, opener)) { newIndent += opener.indentDelta; } } newIndent = clamp(newIndent, minIndent, maxIndent); if (newIndent !== origIndent) { addIndent(result, newIndent - origIndent); } } function onIndent(result) { result.indentX = result.x; result.trackingIndent = false; if (result.quoteDanger) { throw error(result, ERROR_QUOTE_DANGER); } if (result.mode === INDENT_MODE) { correctParenTrail(result, result.x); var opener = peek(result.parenStack, 0); if (opener && shouldAddOpenerIndent(result, opener)) { addIndent(result, opener.indentDelta); } } else if (result.mode === PAREN_MODE) { correctIndent(result); } } function checkLeadingCloseParen(result) { if (result.errorPosCache[ERROR_LEADING_CLOSE_PAREN] && result.parenTrail.lineNo === result.lineNo) { throw error(result, ERROR_LEADING_CLOSE_PAREN); } } function onLeadingCloseParen(result) { if (result.mode === INDENT_MODE) { if (!result.forceBalance) { if (result.smart) { throw {leadingCloseParen: true}; } if (!result.errorPosCache[ERROR_LEADING_CLOSE_PAREN]) { cacheErrorPos(result, ERROR_LEADING_CLOSE_PAREN); } } result.skipChar = true; } if (result.mode === PAREN_MODE) { if (!isValidCloseParen(result.parenStack, result.ch)) { if (result.smart) { result.skipChar = true; } else { throw error(result, ERROR_UNMATCHED_CLOSE_PAREN); } } else if (isCursorLeftOf(result.cursorX, result.cursorLine, result.x, result.lineNo)) { resetParenTrail(result, result.lineNo, result.x); onIndent(result); } else { appendParenTrail(result); result.skipChar = true; } } } function onCommentLine(result) { var parenTrailLength = result.parenTrail.openers.length; // restore the openers matching the previous paren trail var j; if (result.mode === PAREN_MODE) { for (j=0; j<parenTrailLength; j++) { result.parenStack.push(peek(result.parenTrail.openers, j)); } } var i = getParentOpenerIndex(result, result.x); var opener = peek(result.parenStack, i); if (opener) { // shift the comment line based on the parent open paren if (shouldAddOpenerIndent(result, opener)) { addIndent(result, opener.indentDelta); } // TODO: store some information here if we need to place close-parens after comment lines } // repop the openers matching the previous paren trail if (result.mode === PAREN_MODE) { for (j=0; j<parenTrailLength; j++) { result.parenStack.pop(); } } } function checkIndent(result) { if (isCloseParen(result.ch)) { onLeadingCloseParen(result); } else if (result.ch === SEMICOLON) { // comments don't count as indentation points onCommentLine(result); result.trackingIndent = false; } else if (result.ch !== NEWLINE && result.ch !== BLANK_SPACE && result.ch !== TAB) { onIndent(result); } } function makeTabStop(result, opener) { var tabStop = { ch: opener.ch, x: opener.x, lineNo: opener.lineNo }; if (opener.argX != null) { tabStop.argX = opener.argX; } return tabStop; } function getTabStopLine(result) { return result.selectionStartLine !== UINT_NULL ? result.selectionStartLine : result.cursorLine; } function setTabStops(result) { if (getTabStopLine(result) !== result.lineNo) { return; } var i; for (i=0; i<result.parenStack.length; i++) { result.tabStops.push(makeTabStop(result, result.parenStack[i])); } if (result.mode === PAREN_MODE) { for (i=result.parenTrail.openers.length-1; i>=0; i--) { result.tabStops.push(makeTabStop(result, result.parenTrail.openers[i])); } } // remove argX if it falls to the right of the next stop for (i=1; i<result.tabStops.length; i++) { var x = result.tabStops[i].x; var prevArgX = result.tabStops[i-1].argX; if (prevArgX != null && prevArgX >= x) { delete result.tabStops[i-1].argX; } } } //------------------------------------------------------------------------------ // High-level processing functions //------------------------------------------------------------------------------ function processChar(result, ch) { var origCh = ch; result.ch = ch; result.skipChar = false; handleChangeDelta(result); if (result.trackingIndent) { checkIndent(result); } if (result.skipChar) { result.ch = ""; } else { onChar(result); } commitChar(result, origCh); } function processLine(result, lineNo) { initLine(result); result.lines.push(result.inputLines[lineNo]); setTabStops(result); var x; for (x = 0; x < result.inputLines[lineNo].length; x++) { result.inputX = x; processChar(result, result.inputLines[lineNo][x]); } processChar(result, NEWLINE); if (!result.forceBalance) { checkUnmatchedOutsideParenTrail(result); checkLeadingCloseParen(result); } if (result.lineNo === result.parenTrail.lineNo) { finishNewParenTrail(result); } } function finalizeResult(result) { if (result.quoteDanger) { throw error(result, ERROR_QUOTE_DANGER); } if (result.isInStr) { throw error(result, ERROR_UNCLOSED_QUOTE); } if (result.parenStack.length !== 0) { if (result.mode === PAREN_MODE) { throw error(result, ERROR_UNCLOSED_PAREN); } } if (result.mode === INDENT_MODE) { initLine(result); onIndent(result); } result.success = true; } function processError(result, e) { result.success = false; if (e.parinferError) { delete e.parinferError; result.error = e; } else { result.error.name = ERROR_UNHANDLED; result.error.message = e.stack; throw e; } } function processText(text, options, mode, smart) { var result = getInitialResult(text, options, mode, smart); try { var i; for (i = 0; i < result.inputLines.length; i++) { result.inputLineNo = i; processLine(result, i); } finalizeResult(result); } catch (e) { if (e.leadingCloseParen || e.releaseCursorHold) { return processText(text, options, PAREN_MODE, smart); } processError(result, e); } return result; } //------------------------------------------------------------------------------ // Public API //------------------------------------------------------------------------------ function publicResult(result) { var lineEnding = getLineEnding(result.origText); var final; if (result.success) { final = { text: result.lines.join(lineEnding), cursorX: result.cursorX, cursorLine: result.cursorLine, success: true, tabStops: result.tabStops, parenTrails: result.parenTrails }; if (result.returnParens) { final.parens = result.parens; } } else { final = { text: result.partialResult ? result.lines.join(lineEnding) : result.origText, cursorX: result.partialResult ? result.cursorX : result.origCursorX, cursorLine: result.partialResult ? result.cursorLine : result.origCursorLine, parenTrails: result.partialResult ? result.parenTrails : null, success: false, error: result.error }; if (result.partialResult && result.returnParens) { final.parens = result.parens; } } if (final.cursorX === UINT_NULL) { delete final.cursorX; } if (final.cursorLine === UINT_NULL) { delete final.cursorLine; } if (final.tabStops && final.tabStops.length === 0) { delete final.tabStops; } return final; } function indentMode(text, options) { options = parseOptions(options); return publicResult(processText(text, options, INDENT_MODE)); } function parenMode(text, options) { options = parseOptions(options); return publicResult(processText(text, options, PAREN_MODE)); } function smartMode(text, options) { options = parseOptions(options); var smart = options.selectionStartLine == null; return publicResult(processText(text, options, INDENT_MODE, smart)); } var API = { version: "3.12.0", indentMode: indentMode, parenMode: parenMode, smartMode: smartMode }; return API; })); // end module anonymous scope <|start_filename|>site/src/parinfer_site/vcr_data.cljs<|end_filename|> (ns parinfer-site.vcr-data "VCR data - editor animations pasted from the 'print' button in devmode") (def intro-indent '{:timescale 2 :changes [{:selections ({:anchor {:line 0, :ch 0}, :head {:line 0, :ch 0}}), :dt 0} {:change {:from {:line 0, :ch 0}, :to {:line 0, :ch 0}, :text ("(defn component []" " (html)" " [:div {:style {:background \"#FFF\"" " :color \"#000\"}}]" " [:h1 \"title\"])"), :origin "paste"}, :dt 912} {:selections ({:anchor {:line 4, :ch 2}, :head {:line 4, :ch 2}}), :dt 1048} {:change {:from {:line 4, :ch 2}, :to {:line 4, :ch 2}, :text (" "), :origin "+input"}, :dt 577} {:selections ({:anchor {:line 4, :ch 3}, :head {:line 4, :ch 3}}), :dt 3} {:change {:from {:line 4, :ch 3}, :to {:line 4, :ch 3}, :text (" "), :origin "+input"}, :dt 187} {:selections ({:anchor {:line 2, :ch 2}, :head {:line 2, :ch 2}}), :dt 1006} {:change {:from {:line 2, :ch 2}, :to {:line 2, :ch 2}, :text (" "), :origin "+input"}, :dt 497} {:selections ({:anchor {:line 2, :ch 3}, :head {:line 2, :ch 3}}), :dt 2} {:change {:from {:line 2, :ch 3}, :to {:line 2, :ch 3}, :text (" "), :origin "+input"}, :dt 285} {:selections ({:anchor {:line 2, :ch 4}, :head {:line 2, :ch 4}}), :dt 2} {:change {:from {:line 2, :ch 3}, :to {:line 2, :ch 4}, :text (""), :origin "+delete"}, :dt 1685} {:selections ({:anchor {:line 2, :ch 3}, :head {:line 2, :ch 3}}), :dt 2} {:change {:from {:line 2, :ch 2}, :to {:line 2, :ch 3}, :text (""), :origin "+delete"}, :dt 210} {:selections ({:anchor {:line 2, :ch 2}, :head {:line 2, :ch 2}}), :dt 2} {:change {:from {:line 2, :ch 1}, :to {:line 2, :ch 2}, :text (""), :origin "+delete"}, :dt 482} {:selections ({:anchor {:line 2, :ch 1}, :head {:line 2, :ch 1}}), :dt 2} {:change {:from {:line 2, :ch 0}, :to {:line 2, :ch 1}, :text (""), :origin "+delete"}, :dt 219} {:selections ({:anchor {:line 2, :ch 0}, :head {:line 2, :ch 0}}), :dt 2} {:change {:from {:line 2, :ch 0}, :to {:line 2, :ch 0}, :text (" "), :origin "+input"}, :dt 1036} {:selections ({:anchor {:line 2, :ch 1}, :head {:line 2, :ch 1}}), :dt 2} {:change {:from {:line 2, :ch 1}, :to {:line 2, :ch 1}, :text (" "), :origin "+input"}, :dt 452} {:selections ({:anchor {:line 2, :ch 2}, :head {:line 2, :ch 2}}), :dt 2}], :init-value "", :last-time 1501268674807, :recording? false}) (def intro-snap '{:timescale 1.3 :changes [{:selections ({:anchor {:line 0, :ch 0}, :head {:line 0, :ch 0}}), :dt 0} {:change {:from {:line 0, :ch 0}, :to {:line 0, :ch 0}, :text ("(ns example.core" " (:require" " [clojure.string :refer [join]]" " [clojure.data :refer [diff]]" " foo))"), :origin "paste"}, :dt 589} {:selections ({:anchor {:line 4, :ch 4}, :head {:line 4, :ch 4}}), :dt 762} {:change {:from {:line 4, :ch 0}, :to {:line 4, :ch 4}, :text (" "), :origin "+indenthack"}, :dt 697} {:selections ({:anchor {:line 4, :ch 5}, :head {:line 4, :ch 5}}), :dt 1} {:change {:from {:line 4, :ch 0}, :to {:line 4, :ch 5}, :text (" "), :origin "+indenthack"}, :dt 341} {:change {:from {:line 4, :ch 0}, :to {:line 4, :ch 18}, :text (" "), :origin "+indenthack"}, :dt 392} {:change {:from {:line 4, :ch 0}, :to {:line 4, :ch 25}, :text (" "), :origin "+indenthack"}, :dt 448} {:selections ({:anchor {:line 4, :ch 26}, :head {:line 4, :ch 26}}), :dt 2} {:change {:from {:line 4, :ch 0}, :to {:line 4, :ch 26}, :text (" "), :origin "+indenthack"}, :dt 1196} {:selections ({:anchor {:line 4, :ch 25}, :head {:line 4, :ch 25}}), :dt 1} {:change {:from {:line 4, :ch 0}, :to {:line 4, :ch 25}, :text (" "), :origin "+indenthack"}, :dt 253} {:change {:from {:line 4, :ch 0}, :to {:line 4, :ch 18}, :text (" "), :origin "+indenthack"}, :dt 248} {:change {:from {:line 4, :ch 0}, :to {:line 4, :ch 5}, :text (" "), :origin "+indenthack"}, :dt 464} {:selections ({:anchor {:line 4, :ch 4}, :head {:line 4, :ch 4}}), :dt 1} {:change {:from {:line 4, :ch 0}, :to {:line 4, :ch 4}, :text (" "), :origin "+indenthack"}, :dt 404} {:selections ({:anchor {:line 4, :ch 2}, :head {:line 4, :ch 2}}), :dt 2} {:change {:from {:line 4, :ch 0}, :to {:line 4, :ch 2}, :text (""), :origin "+indenthack"}, :dt 645} {:selections ({:anchor {:line 4, :ch 0}, :head {:line 4, :ch 0}}), :dt 1}], :init-value "", :last-time 1501270319122, :recording? false}) (def intro-safeguards '{:timescale 2 :changes [{:selections ({:anchor {:line 0, :ch 0}, :head {:line 0, :ch 0}}), :dt 0} {:change {:from {:line 0, :ch 0}, :to {:line 0, :ch 0}, :text ("(cljs/build (sources \"src\")" " {:main 'hello-world.core" " :output-to \"out/main.js\"" " :verbose true})"), :origin "paste"}, :dt 1090} {:selections ({:anchor {:line 0, :ch 12}, :head {:line 0, :ch 12}}), :dt 869} {:selections ({:anchor {:line 0, :ch 12}, :head {:line 0, :ch 11}}), :dt 111} {:selections ({:anchor {:line 0, :ch 12}, :head {:line 0, :ch 10}}), :dt 19} {:selections ({:anchor {:line 0, :ch 12}, :head {:line 0, :ch 9}}), :dt 21} {:selections ({:anchor {:line 0, :ch 12}, :head {:line 0, :ch 8}}), :dt 28} {:selections ({:anchor {:line 0, :ch 12}, :head {:line 0, :ch 7}}), :dt 34} {:selections ({:anchor {:line 0, :ch 12}, :head {:line 0, :ch 6}}), :dt 52} {:selections ({:anchor {:line 0, :ch 12}, :head {:line 0, :ch 5}}), :dt 64} {:selections ({:anchor {:line 0, :ch 12}, :head {:line 0, :ch 4}}), :dt 51} {:selections ({:anchor {:line 0, :ch 12}, :head {:line 0, :ch 3}}), :dt 50} {:selections ({:anchor {:line 0, :ch 12}, :head {:line 0, :ch 2}}), :dt 33} {:selections ({:anchor {:line 0, :ch 12}, :head {:line 0, :ch 1}}), :dt 49} {:change {:from {:line 0, :ch 1}, :to {:line 0, :ch 12}, :text ("b"), :origin "+input"}, :dt 1089} {:change {:from {:line 0, :ch 2}, :to {:line 0, :ch 2}, :text ("u"), :origin "+input"}, :dt 168} {:change {:from {:line 0, :ch 3}, :to {:line 0, :ch 3}, :text ("i"), :origin "+input"}, :dt 80} {:change {:from {:line 0, :ch 4}, :to {:line 0, :ch 4}, :text ("l"), :origin "+input"}, :dt 71} {:change {:from {:line 0, :ch 5}, :to {:line 0, :ch 5}, :text ("d"), :origin "+input"}, :dt 169} {:change {:from {:line 0, :ch 6}, :to {:line 0, :ch 6}, :text (" "), :origin "+input"}, :dt 231} {:selections ({:anchor {:line 1, :ch 7}, :head {:line 1, :ch 7}}), :dt 640} {:selections ({:anchor {:line 1, :ch 7}, :head {:line 1, :ch 7}}), :dt 2} {:selections ({:anchor {:line 0, :ch 7}, :head {:line 0, :ch 7}}), :dt 1099} {:change {:from {:line 0, :ch 0}, :to {:line 0, :ch 0}, :text ("#"), :origin "+input"}, :dt 416} {:selections ({:anchor {:line 0, :ch 1}, :head {:line 0, :ch 1}}), :dt 1} {:change {:from {:line 0, :ch 1}, :to {:line 0, :ch 1}, :text ("_"), :origin "+input"}, :dt 253} {:selections ({:anchor {:line 0, :ch 2}, :head {:line 0, :ch 2}}), :dt 2}] :init-value "", :last-time 1501271565973, :recording? false}) (def intro-compromise '{:timescale 1 :changes [{:selections ({:anchor {:line 0, :ch 0}, :head {:line 0, :ch 0}}), :dt 0} {:change {:from {:line 0, :ch 0}, :to {:line 0, :ch 0}, :text ("(defn foo [my-map]" " (let [{} my-map" " x (+ a b)]" " (println \"sum is\" x)))"), :origin "paste"}, :dt 726} {:selections ({:anchor {:line 1, :ch 9}, :head {:line 1, :ch 9}}), :dt 1085} {:change {:from {:line 1, :ch 9}, :to {:line 1, :ch 9}, :text (":"), :origin "+input"}, :dt 753} {:change {:from {:line 1, :ch 10}, :to {:line 1, :ch 10}, :text ("k"), :origin "+input"}, :dt 208} {:change {:from {:line 1, :ch 11}, :to {:line 1, :ch 11}, :text ("e"), :origin "+input"}, :dt 112} {:change {:from {:line 1, :ch 12}, :to {:line 1, :ch 12}, :text ("y"), :origin "+input"}, :dt 88} {:change {:from {:line 1, :ch 13}, :to {:line 1, :ch 13}, :text ("s"), :origin "+input"}, :dt 136} {:change {:from {:line 1, :ch 14}, :to {:line 1, :ch 14}, :text (" "), :origin "+input"}, :dt 136} {:change {:from {:line 1, :ch 15}, :to {:line 1, :ch 15}, :text ("["), :origin "+input"}, :dt 224} {:change {:from {:line 1, :ch 16}, :to {:line 1, :ch 16}, :text ("a"), :origin "+input"}, :dt 207} {:change {:from {:line 1, :ch 17}, :to {:line 1, :ch 17}, :text (" "), :origin "+input"}, :dt 169} {:change {:from {:line 1, :ch 18}, :to {:line 1, :ch 18}, :text ("b"), :origin "+input"}, :dt 160} {:change {:from {:line 1, :ch 19}, :to {:line 1, :ch 19}, :text ("]"), :origin "+input"}, :dt 232}], :init-value "", :last-time 1501272513450, :recording? false}) (def intro '{:timescale 4 :changes [{:change {:from {:line 0, :ch 0}, :to {:line 0, :ch 0}, :text ("("), :origin "+input"}, :dt 0} {:change {:from {:line 0, :ch 1}, :to {:line 0, :ch 1}, :text ("d"), :origin "+input"}, :dt 180} {:change {:from {:line 0, :ch 2}, :to {:line 0, :ch 2}, :text ("e"), :origin "+input"}, :dt 160} {:change {:from {:line 0, :ch 3}, :to {:line 0, :ch 3}, :text ("f"), :origin "+input"}, :dt 120} {:change {:from {:line 0, :ch 4}, :to {:line 0, :ch 4}, :text ("n"), :origin "+input"}, :dt 200} {:change {:from {:line 0, :ch 5}, :to {:line 0, :ch 5}, :text (" "), :origin "+input"}, :dt 128} {:change {:from {:line 0, :ch 6}, :to {:line 0, :ch 6}, :text ("m"), :origin "+input"}, :dt 185} {:change {:from {:line 0, :ch 7}, :to {:line 0, :ch 7}, :text ("e"), :origin "+input"}, :dt 79} {:change {:from {:line 0, :ch 8}, :to {:line 0, :ch 8}, :text ("s"), :origin "+input"}, :dt 136} {:change {:from {:line 0, :ch 9}, :to {:line 0, :ch 9}, :text ("s"), :origin "+input"}, :dt 152} {:change {:from {:line 0, :ch 10}, :to {:line 0, :ch 10}, :text ("a"), :origin "+input"}, :dt 112} {:change {:from {:line 0, :ch 11}, :to {:line 0, :ch 11}, :text ("g"), :origin "+input"}, :dt 112} {:change {:from {:line 0, :ch 12}, :to {:line 0, :ch 12}, :text ("e"), :origin "+input"}, :dt 111} {:change {:from {:line 0, :ch 13}, :to {:line 0, :ch 13}, :text ("s"), :origin "+input"}, :dt 257} {:change {:from {:line 0, :ch 14}, :to {:line 0, :ch 14}, :text ("-"), :origin "+input"}, :dt 248} {:change {:from {:line 0, :ch 15}, :to {:line 0, :ch 15}, :text ("c"), :origin "+input"}, :dt 216} {:change {:from {:line 0, :ch 16}, :to {:line 0, :ch 16}, :text ("o"), :origin "+input"}, :dt 72} {:change {:from {:line 0, :ch 17}, :to {:line 0, :ch 17}, :text ("m"), :origin "+input"}, :dt 112} {:change {:from {:line 0, :ch 18}, :to {:line 0, :ch 18}, :text ("p"), :origin "+input"}, :dt 71} {:change {:from {:line 0, :ch 19}, :to {:line 0, :ch 19}, :text ("o"), :origin "+input"}, :dt 57} {:change {:from {:line 0, :ch 20}, :to {:line 0, :ch 20}, :text ("n"), :origin "+input"}, :dt 104} {:change {:from {:line 0, :ch 21}, :to {:line 0, :ch 21}, :text ("e"), :origin "+input"}, :dt 79} {:change {:from {:line 0, :ch 22}, :to {:line 0, :ch 22}, :text ("n"), :origin "+input"}, :dt 120} {:change {:from {:line 0, :ch 23}, :to {:line 0, :ch 23}, :text ("t"), :origin "+input"}, :dt 80} {:change {:from {:line 0, :ch 24}, :to {:line 0, :ch 24}, :text ("" ""), :origin "+input"}, :dt 186} {:change {:from {:line 1, :ch 0}, :to {:line 1, :ch 0}, :text (" "), :origin "+input"}, :dt 4} {:change {:from {:line 1, :ch 2}, :to {:line 1, :ch 2}, :text ("["), :origin "+input"}, :dt 226} {:change {:from {:line 1, :ch 3}, :to {:line 1, :ch 3}, :text ("m"), :origin "+input"}, :dt 208} {:change {:from {:line 1, :ch 4}, :to {:line 1, :ch 4}, :text ("e"), :origin "+input"}, :dt 104} {:change {:from {:line 1, :ch 5}, :to {:line 1, :ch 5}, :text ("s"), :origin "+input"}, :dt 80} {:change {:from {:line 1, :ch 6}, :to {:line 1, :ch 6}, :text ("s"), :origin "+input"}, :dt 168} {:change {:from {:line 1, :ch 7}, :to {:line 1, :ch 7}, :text ("a"), :origin "+input"}, :dt 105} {:change {:from {:line 1, :ch 8}, :to {:line 1, :ch 8}, :text ("g"), :origin "+input"}, :dt 136} {:change {:from {:line 1, :ch 9}, :to {:line 1, :ch 9}, :text ("e"), :origin "+input"}, :dt 120} {:change {:from {:line 1, :ch 10}, :to {:line 1, :ch 10}, :text ("s"), :origin "+input"}, :dt 79} {:change {:from {:line 1, :ch 11}, :to {:line 1, :ch 11}, :text ("]"), :origin "+input"}, :dt 224} {:selections ({:anchor {:line 0, :ch 24}, :head {:line 0, :ch 24}}), :dt 1221} {:change {:from {:line 0, :ch 24}, :to {:line 0, :ch 24}, :text ("" ""), :origin "+input"}, :dt 364} {:change {:from {:line 1, :ch 0}, :to {:line 1, :ch 0}, :text (" "), :origin "+input"}, :dt 4} {:change {:from {:line 1, :ch 2}, :to {:line 1, :ch 2}, :text ("\""), :origin "+input"}, :dt 388} {:change {:from {:line 1, :ch 3}, :to {:line 1, :ch 3}, :text ("R"), :origin "+input"}, :dt 631} {:change {:from {:line 1, :ch 4}, :to {:line 1, :ch 4}, :text ("e"), :origin "+input"}, :dt 136} {:change {:from {:line 1, :ch 5}, :to {:line 1, :ch 5}, :text ("n"), :origin "+input"}, :dt 56} {:change {:from {:line 1, :ch 6}, :to {:line 1, :ch 6}, :text ("d"), :origin "+input"}, :dt 106} {:change {:from {:line 1, :ch 7}, :to {:line 1, :ch 7}, :text ("e"), :origin "+input"}, :dt 118} {:change {:from {:line 1, :ch 8}, :to {:line 1, :ch 8}, :text ("r"), :origin "+input"}, :dt 72} {:change {:from {:line 1, :ch 9}, :to {:line 1, :ch 9}, :text (" "), :origin "+input"}, :dt 80} {:change {:from {:line 1, :ch 10}, :to {:line 1, :ch 10}, :text ("m"), :origin "+input"}, :dt 56} {:change {:from {:line 1, :ch 11}, :to {:line 1, :ch 11}, :text ("y"), :origin "+input"}, :dt 111} {:change {:from {:line 1, :ch 12}, :to {:line 1, :ch 12}, :text (" "), :origin "+input"}, :dt 97} {:change {:from {:line 1, :ch 13}, :to {:line 1, :ch 13}, :text ("m"), :origin "+input"}, :dt 48} {:change {:from {:line 1, :ch 14}, :to {:line 1, :ch 14}, :text ("e"), :origin "+input"}, :dt 120} {:change {:from {:line 1, :ch 15}, :to {:line 1, :ch 15}, :text ("s"), :origin "+input"}, :dt 113} {:change {:from {:line 1, :ch 16}, :to {:line 1, :ch 16}, :text ("s"), :origin "+input"}, :dt 175} {:change {:from {:line 1, :ch 17}, :to {:line 1, :ch 17}, :text ("a"), :origin "+input"}, :dt 136} {:change {:from {:line 1, :ch 18}, :to {:line 1, :ch 18}, :text ("g"), :origin "+input"}, :dt 144} {:change {:from {:line 1, :ch 19}, :to {:line 1, :ch 19}, :text ("e"), :origin "+input"}, :dt 88} {:change {:from {:line 1, :ch 20}, :to {:line 1, :ch 20}, :text ("s"), :origin "+input"}, :dt 80} {:change {:from {:line 1, :ch 21}, :to {:line 1, :ch 21}, :text ("."), :origin "+input"}, :dt 353} {:change {:from {:line 1, :ch 22}, :to {:line 1, :ch 22}, :text ("\""), :origin "+input"}, :dt 303} {:selections ({:anchor {:line 2, :ch 12}, :head {:line 2, :ch 12}}), :dt 1333} {:change {:from {:line 2, :ch 12}, :to {:line 2, :ch 12}, :text ("" ""), :origin "+input"}, :dt 331} {:change {:from {:line 3, :ch 0}, :to {:line 3, :ch 0}, :text (" "), :origin "+input"}, :dt 6} {:change {:from {:line 3, :ch 2}, :to {:line 3, :ch 2}, :text ("["), :origin "+input"}, :dt 1115} {:change {:from {:line 3, :ch 3}, :to {:line 3, :ch 3}, :text (":"), :origin "+input"}, :dt 223} {:change {:from {:line 3, :ch 4}, :to {:line 3, :ch 4}, :text ("d"), :origin "+input"}, :dt 137} {:change {:from {:line 3, :ch 5}, :to {:line 3, :ch 5}, :text ("i"), :origin "+input"}, :dt 111} {:change {:from {:line 3, :ch 6}, :to {:line 3, :ch 6}, :text ("v"), :origin "+input"}, :dt 168} {:change {:from {:line 3, :ch 7}, :to {:line 3, :ch 7}, :text ("" ""), :origin "+input"}, :dt 223} {:change {:from {:line 4, :ch 0}, :to {:line 4, :ch 0}, :text (" "), :origin "+input"}, :dt 7} {:change {:from {:line 4, :ch 3}, :to {:line 4, :ch 3}, :text ("["), :origin "+input"}, :dt 242} {:change {:from {:line 4, :ch 4}, :to {:line 4, :ch 4}, :text (":"), :origin "+input"}, :dt 256} {:change {:from {:line 4, :ch 5}, :to {:line 4, :ch 5}, :text ("h"), :origin "+input"}, :dt 216} {:change {:from {:line 4, :ch 6}, :to {:line 4, :ch 6}, :text ("1"), :origin "+input"}, :dt 136} {:change {:from {:line 4, :ch 7}, :to {:line 4, :ch 7}, :text (" "), :origin "+input"}, :dt 200} {:change {:from {:line 4, :ch 8}, :to {:line 4, :ch 8}, :text ("\""), :origin "+input"}, :dt 160} {:change {:from {:line 4, :ch 9}, :to {:line 4, :ch 9}, :text ("M"), :origin "+input"}, :dt 192} {:change {:from {:line 4, :ch 10}, :to {:line 4, :ch 10}, :text ("y"), :origin "+input"}, :dt 448} {:change {:from {:line 4, :ch 11}, :to {:line 4, :ch 11}, :text (" "), :origin "+input"}, :dt 128} {:change {:from {:line 4, :ch 12}, :to {:line 4, :ch 12}, :text ("M"), :origin "+input"}, :dt 176} {:change {:from {:line 4, :ch 13}, :to {:line 4, :ch 13}, :text ("e"), :origin "+input"}, :dt 256} {:change {:from {:line 4, :ch 14}, :to {:line 4, :ch 14}, :text ("s"), :origin "+input"}, :dt 96} {:change {:from {:line 4, :ch 15}, :to {:line 4, :ch 15}, :text ("s"), :origin "+input"}, :dt 248} {:change {:from {:line 4, :ch 16}, :to {:line 4, :ch 16}, :text ("a"), :origin "+input"}, :dt 352} {:change {:from {:line 4, :ch 17}, :to {:line 4, :ch 17}, :text ("g"), :origin "+input"}, :dt 128} {:change {:from {:line 4, :ch 18}, :to {:line 4, :ch 18}, :text ("e"), :origin "+input"}, :dt 112} {:change {:from {:line 4, :ch 19}, :to {:line 4, :ch 19}, :text ("s"), :origin "+input"}, :dt 120} {:change {:from {:line 4, :ch 20}, :to {:line 4, :ch 20}, :text ("\""), :origin "+input"}, :dt 232} {:change {:from {:line 4, :ch 21}, :to {:line 4, :ch 21}, :text ("]"), :origin "+input"}, :dt 736} {:change {:from {:line 4, :ch 22}, :to {:line 4, :ch 22}, :text ("" ""), :origin "+input"}, :dt 174} {:change {:from {:line 5, :ch 0}, :to {:line 5, :ch 0}, :text (" "), :origin "+input"}, :dt 7} {:change {:from {:line 5, :ch 3}, :to {:line 5, :ch 3}, :text ("["), :origin "+input"}, :dt 1131} {:change {:from {:line 5, :ch 4}, :to {:line 5, :ch 4}, :text (":"), :origin "+input"}, :dt 335} {:change {:from {:line 5, :ch 5}, :to {:line 5, :ch 5}, :text ("d"), :origin "+input"}, :dt 273} {:change {:from {:line 5, :ch 6}, :to {:line 5, :ch 6}, :text ("i"), :origin "+input"}, :dt 96} {:change {:from {:line 5, :ch 7}, :to {:line 5, :ch 7}, :text ("v"), :origin "+input"}, :dt 168} {:change {:from {:line 5, :ch 8}, :to {:line 5, :ch 8}, :text ("."), :origin "+input"}, :dt 168} {:change {:from {:line 5, :ch 9}, :to {:line 5, :ch 9}, :text ("m"), :origin "+input"}, :dt 88} {:change {:from {:line 5, :ch 10}, :to {:line 5, :ch 10}, :text ("e"), :origin "+input"}, :dt 121} {:change {:from {:line 5, :ch 11}, :to {:line 5, :ch 11}, :text ("s"), :origin "+input"}, :dt 63} {:change {:from {:line 5, :ch 12}, :to {:line 5, :ch 12}, :text ("s"), :origin "+input"}, :dt 168} {:change {:from {:line 5, :ch 13}, :to {:line 5, :ch 13}, :text ("a"), :origin "+input"}, :dt 104} {:change {:from {:line 5, :ch 14}, :to {:line 5, :ch 14}, :text ("g"), :origin "+input"}, :dt 152} {:change {:from {:line 5, :ch 15}, :to {:line 5, :ch 15}, :text ("e"), :origin "+input"}, :dt 504} {:change {:from {:line 5, :ch 16}, :to {:line 5, :ch 16}, :text (" "), :origin "+input"}, :dt 640} {:change {:from {:line 5, :ch 17}, :to {:line 5, :ch 17}, :text ("("), :origin "+input"}, :dt 192} {:change {:from {:line 5, :ch 18}, :to {:line 5, :ch 18}, :text (":"), :origin "+input"}, :dt 264} {:change {:from {:line 5, :ch 19}, :to {:line 5, :ch 19}, :text ("s"), :origin "+input"}, :dt 288} {:change {:from {:line 5, :ch 20}, :to {:line 5, :ch 20}, :text ("u"), :origin "+input"}, :dt 152} {:change {:from {:line 5, :ch 21}, :to {:line 5, :ch 21}, :text ("b"), :origin "+input"}, :dt 136} {:change {:from {:line 5, :ch 22}, :to {:line 5, :ch 22}, :text ("j"), :origin "+input"}, :dt 256} {:change {:from {:line 5, :ch 23}, :to {:line 5, :ch 23}, :text ("e"), :origin "+input"}, :dt 96} {:change {:from {:line 5, :ch 24}, :to {:line 5, :ch 24}, :text ("c"), :origin "+input"}, :dt 104} {:change {:from {:line 5, :ch 25}, :to {:line 5, :ch 25}, :text ("t"), :origin "+input"}, :dt 200} {:change {:from {:line 5, :ch 26}, :to {:line 5, :ch 26}, :text (" "), :origin "+input"}, :dt 104} {:change {:from {:line 5, :ch 27}, :to {:line 5, :ch 27}, :text ("m"), :origin "+input"}, :dt 168} {:selections ({:anchor {:line 4, :ch 22}, :head {:line 4, :ch 22}}), :dt 1967} {:change {:from {:line 4, :ch 22}, :to {:line 4, :ch 22}, :text ("" ""), :origin "+input"}, :dt 336} {:change {:from {:line 5, :ch 0}, :to {:line 5, :ch 0}, :text (" "), :origin "+input"}, :dt 7} {:change {:from {:line 5, :ch 3}, :to {:line 5, :ch 3}, :text ("["), :origin "+input"}, :dt 321} {:change {:from {:line 5, :ch 4}, :to {:line 5, :ch 4}, :text (":"), :origin "+input"}, :dt 353} {:change {:from {:line 5, :ch 5}, :to {:line 5, :ch 5}, :text ("a"), :origin "+input"}, :dt 288} {:change {:from {:line 5, :ch 6}, :to {:line 5, :ch 6}, :text (" "), :origin "+input"}, :dt 495} {:change {:from {:line 5, :ch 7}, :to {:line 5, :ch 7}, :text ("{"), :origin "+input"}, :dt 344} {:change {:from {:line 5, :ch 8}, :to {:line 5, :ch 8}, :text (":"), :origin "+input"}, :dt 185} {:change {:from {:line 5, :ch 9}, :to {:line 5, :ch 9}, :text ("h"), :origin "+input"}, :dt 224} {:change {:from {:line 5, :ch 10}, :to {:line 5, :ch 10}, :text ("r"), :origin "+input"}, :dt 95} {:change {:from {:line 5, :ch 11}, :to {:line 5, :ch 11}, :text ("e"), :origin "+input"}, :dt 64} {:change {:from {:line 5, :ch 12}, :to {:line 5, :ch 12}, :text ("f"), :origin "+input"}, :dt 248} {:change {:from {:line 5, :ch 13}, :to {:line 5, :ch 13}, :text (" "), :origin "+input"}, :dt 145} {:change {:from {:line 5, :ch 14}, :to {:line 5, :ch 14}, :text ("("), :origin "+input"}, :dt 247} {:change {:from {:line 5, :ch 15}, :to {:line 5, :ch 15}, :text (":"), :origin "+input"}, :dt 633} {:change {:from {:line 5, :ch 16}, :to {:line 5, :ch 16}, :text ("l"), :origin "+input"}, :dt 168} {:change {:from {:line 5, :ch 17}, :to {:line 5, :ch 17}, :text ("i"), :origin "+input"}, :dt 79} {:change {:from {:line 5, :ch 18}, :to {:line 5, :ch 18}, :text ("n"), :origin "+input"}, :dt 88} {:change {:from {:line 5, :ch 19}, :to {:line 5, :ch 19}, :text ("k"), :origin "+input"}, :dt 184} {:change {:from {:line 5, :ch 20}, :to {:line 5, :ch 20}, :text (" "), :origin "+input"}, :dt 136} {:change {:from {:line 5, :ch 21}, :to {:line 5, :ch 21}, :text ("m"), :origin "+input"}, :dt 120} {:change {:from {:line 5, :ch 22}, :to {:line 5, :ch 22}, :text (")"), :origin "+input"}, :dt 512} {:selections ({:anchor {:line 6, :ch 3}, :head {:line 6, :ch 3}}), :dt 2384} {:change {:from {:line 6, :ch 3}, :to {:line 6, :ch 3}, :text (" "), :origin "+input"}, :dt 345} {:change {:from {:line 6, :ch 4}, :to {:line 6, :ch 4}, :text (" "), :origin "+input"}, :dt 183} {:selections ({:anchor {:line 4, :ch 22}, :head {:line 4, :ch 22}}), :dt 1636} {:change {:from {:line 4, :ch 22}, :to {:line 4, :ch 22}, :text ("" ""), :origin "+input"}, :dt 364} {:change {:from {:line 5, :ch 0}, :to {:line 5, :ch 0}, :text (" "), :origin "+input"}, :dt 9} {:change {:from {:line 5, :ch 3}, :to {:line 5, :ch 3}, :text ("("), :origin "+input"}, :dt 407} {:change {:from {:line 5, :ch 4}, :to {:line 5, :ch 4}, :text ("f"), :origin "+input"}, :dt 176} {:change {:from {:line 5, :ch 5}, :to {:line 5, :ch 5}, :text ("o"), :origin "+input"}, :dt 96} {:change {:from {:line 5, :ch 6}, :to {:line 5, :ch 6}, :text ("r"), :origin "+input"}, :dt 152} {:change {:from {:line 5, :ch 7}, :to {:line 5, :ch 7}, :text (" "), :origin "+input"}, :dt 183} {:change {:from {:line 5, :ch 8}, :to {:line 5, :ch 8}, :text ("["), :origin "+input"}, :dt 106} {:change {:from {:line 5, :ch 9}, :to {:line 5, :ch 9}, :text ("m"), :origin "+input"}, :dt 335} {:change {:from {:line 5, :ch 10}, :to {:line 5, :ch 10}, :text (" "), :origin "+input"}, :dt 192} {:change {:from {:line 5, :ch 11}, :to {:line 5, :ch 11}, :text ("m"), :origin "+input"}, :dt 160} {:change {:from {:line 5, :ch 12}, :to {:line 5, :ch 12}, :text ("e"), :origin "+input"}, :dt 88} {:change {:from {:line 5, :ch 13}, :to {:line 5, :ch 13}, :text ("s"), :origin "+input"}, :dt 88} {:change {:from {:line 5, :ch 14}, :to {:line 5, :ch 14}, :text ("s"), :origin "+input"}, :dt 160} {:change {:from {:line 5, :ch 15}, :to {:line 5, :ch 15}, :text ("a"), :origin "+input"}, :dt 96} {:change {:from {:line 5, :ch 16}, :to {:line 5, :ch 16}, :text ("g"), :origin "+input"}, :dt 144} {:change {:from {:line 5, :ch 17}, :to {:line 5, :ch 17}, :text ("e"), :origin "+input"}, :dt 104} {:change {:from {:line 5, :ch 18}, :to {:line 5, :ch 18}, :text ("s"), :origin "+input"}, :dt 128} {:selections ({:anchor {:line 6, :ch 3}, :head {:line 6, :ch 3}}), :dt 1986} {:selections ({:anchor {:line 6, :ch 3}, :head {:line 6, :ch 4}}), :dt 181} {:selections ({:anchor {:line 6, :ch 3}, :head {:line 7, :ch 4}}), :dt 14} {:selections ({:anchor {:line 6, :ch 3}, :head {:line 7, :ch 35}}), :dt 19} {:change {:from {:line 6, :ch 0}, :to {:line 6, :ch 3}, :text (" "), :origin "+input"}, :dt 328} {:change {:from {:line 7, :ch 0}, :to {:line 7, :ch 5}, :text (" "), :origin "+input"}, :dt 10} {:selections ({:anchor {:line 2, :ch 12}, :head {:line 2, :ch 12}}), :dt 1470} {:change {:from {:line 2, :ch 12}, :to {:line 2, :ch 12}, :text ("" ""), :origin "+input"}, :dt 343} {:change {:from {:line 3, :ch 0}, :to {:line 3, :ch 0}, :text (" "), :origin "+input"}, :dt 9} {:change {:from {:line 3, :ch 2}, :to {:line 3, :ch 2}, :text ("("), :origin "+input"}, :dt 240} {:change {:from {:line 3, :ch 3}, :to {:line 3, :ch 3}, :text ("h"), :origin "+input"}, :dt 184} {:change {:from {:line 3, :ch 4}, :to {:line 3, :ch 4}, :text ("t"), :origin "+input"}, :dt 144} {:change {:from {:line 3, :ch 5}, :to {:line 3, :ch 5}, :text ("m"), :origin "+input"}, :dt 176} {:change {:from {:line 3, :ch 6}, :to {:line 3, :ch 6}, :text ("l"), :origin "+input"}, :dt 72} {:selections ({:anchor {:line 4, :ch 2}, :head {:line 4, :ch 2}}), :dt 1347} {:selections ({:anchor {:line 4, :ch 2}, :head {:line 5, :ch 3}}), :dt 190} {:selections ({:anchor {:line 4, :ch 2}, :head {:line 6, :ch 5}}), :dt 16} {:selections ({:anchor {:line 4, :ch 2}, :head {:line 7, :ch 6}}), :dt 17} {:selections ({:anchor {:line 4, :ch 2}, :head {:line 8, :ch 38}}), :dt 17} {:change {:from {:line 4, :ch 0}, :to {:line 4, :ch 2}, :text (" "), :origin "+input"}, :dt 364} {:change {:from {:line 5, :ch 0}, :to {:line 5, :ch 3}, :text (" "), :origin "+input"}, :dt 9} {:change {:from {:line 6, :ch 0}, :to {:line 6, :ch 3}, :text (" "), :origin "+input"}, :dt 7} {:change {:from {:line 7, :ch 0}, :to {:line 7, :ch 5}, :text (" "), :origin "+input"}, :dt 9} {:change {:from {:line 8, :ch 0}, :to {:line 8, :ch 7}, :text (" "), :origin "+input"}, :dt 7} {:selections ({:anchor {:line 8, :ch 41}, :head {:line 8, :ch 41}}), :dt 1624}], :init-value "", :last-time 1443920519747, :recording? false}) (def indent '{:loop-delay 1000 :timescale 2 :changes [{:selections ({:anchor {:line 1, :ch 0}, :head {:line 1, :ch 0}}), :dt 0} {:change {:from {:line 1, :ch 0}, :to {:line 1, :ch 0}, :text (" "), :origin "+input"}, :dt 382} {:change {:from {:line 1, :ch 1}, :to {:line 1, :ch 1}, :text (" "), :origin "+input"}, :dt 214} {:change {:from {:line 1, :ch 1}, :to {:line 1, :ch 2}, :text (""), :origin "+delete"}, :dt 1081} {:change {:from {:line 1, :ch 0}, :to {:line 1, :ch 1}, :text (""), :origin "+delete"}, :dt 256} {:change {:from {:line 1, :ch 0}, :to {:line 1, :ch 0}, :text (" "), :origin "+input"}, :dt 935} {:change {:from {:line 1, :ch 1}, :to {:line 1, :ch 1}, :text (" "), :origin "+input"}, :dt 236} {:change {:from {:line 1, :ch 1}, :to {:line 1, :ch 2}, :text (""), :origin "+delete"}, :dt 1146} {:change {:from {:line 1, :ch 0}, :to {:line 1, :ch 1}, :text (""), :origin "+delete"}, :dt 203}], :init-value "(defn foo [a b])\n(+ a b)", :last-time 1444084526856, :recording? false}) (def indent-far '{:changes [{:selections ({:anchor {:line 1, :ch 0}, :head {:line 1, :ch 0}}), :dt 0} {:change {:from {:line 1, :ch 0}, :to {:line 1, :ch 0}, :text (" "), :origin "+input"}, :dt 566} {:change {:from {:line 1, :ch 1}, :to {:line 1, :ch 1}, :text (" "), :origin "+input"}, :dt 185} {:change {:from {:line 1, :ch 2}, :to {:line 1, :ch 2}, :text (" "), :origin "+input"}, :dt 571} {:change {:from {:line 1, :ch 3}, :to {:line 1, :ch 3}, :text (" "), :origin "+input"}, :dt 169} {:change {:from {:line 1, :ch 4}, :to {:line 1, :ch 4}, :text (" "), :origin "+input"}, :dt 203} {:change {:from {:line 1, :ch 5}, :to {:line 1, :ch 5}, :text (" "), :origin "+input"}, :dt 225} {:change {:from {:line 1, :ch 6}, :to {:line 1, :ch 6}, :text (" "), :origin "+input"}, :dt 889} {:change {:from {:line 1, :ch 7}, :to {:line 1, :ch 7}, :text (" "), :origin "+input"}, :dt 202} {:change {:from {:line 1, :ch 8}, :to {:line 1, :ch 8}, :text (" "), :origin "+input"}, :dt 216} {:change {:from {:line 1, :ch 8}, :to {:line 1, :ch 9}, :text (""), :origin "+delete"}, :dt 799} {:change {:from {:line 1, :ch 7}, :to {:line 1, :ch 8}, :text (""), :origin "+delete"}, :dt 188} {:change {:from {:line 1, :ch 6}, :to {:line 1, :ch 7}, :text (""), :origin "+delete"}, :dt 211} {:change {:from {:line 1, :ch 5}, :to {:line 1, :ch 6}, :text (""), :origin "+delete"}, :dt 636} {:change {:from {:line 1, :ch 4}, :to {:line 1, :ch 5}, :text (""), :origin "+delete"}, :dt 188} {:change {:from {:line 1, :ch 3}, :to {:line 1, :ch 4}, :text (""), :origin "+delete"}, :dt 191} {:change {:from {:line 1, :ch 2}, :to {:line 1, :ch 3}, :text (""), :origin "+delete"}, :dt 213} {:change {:from {:line 1, :ch 1}, :to {:line 1, :ch 2}, :text (""), :origin "+delete"}, :dt 754} {:change {:from {:line 1, :ch 0}, :to {:line 1, :ch 1}, :text (""), :origin "+delete"}, :dt 195}], :init-value "(let [m {:foo 1}])\n:bar 2", :last-time 1444670828840, :recording? false, :loop-delay 1000, :timescale 2}) (def indent-multi '{:changes [{:selections ({:anchor {:line 0, :ch 0}, :head {:line 0, :ch 0}}), :dt 0} {:change {:from {:line 0, :ch 0}, :to {:line 0, :ch 0}, :text ("(defn component []" " (html)" " [:div {:style {:background \"#FFF\"}" " :color \"#000\"}]" " [:h1 \"title\"])"), :origin "paste"}, :dt 592} {:selections ({:anchor {:line 3, :ch 9}, :head {:line 3, :ch 9}}), :dt 1014} {:change {:from {:line 3, :ch 9}, :to {:line 3, :ch 9}, :text (" "), :origin "+input"}, :dt 443} {:change {:from {:line 3, :ch 11}, :to {:line 3, :ch 11}, :text (" "), :origin "+input"}, :dt 213} {:change {:from {:line 3, :ch 13}, :to {:line 3, :ch 13}, :text (" "), :origin "+input"}, :dt 238} {:change {:from {:line 3, :ch 15}, :to {:line 3, :ch 15}, :text (" "), :origin "+input"}, :dt 227} {:selections ({:anchor {:line 2, :ch 2}, :head {:line 2, :ch 2}}), :dt 1395} {:selections ({:anchor {:line 2, :ch 2}, :head {:line 2, :ch 3}}), :dt 82} {:selections ({:anchor {:line 2, :ch 2}, :head {:line 3, :ch 5}}), :dt 21} {:selections ({:anchor {:line 2, :ch 2}, :head {:line 3, :ch 6}}), :dt 16} {:selections ({:anchor {:line 2, :ch 2}, :head {:line 3, :ch 8}}), :dt 17} {:selections ({:anchor {:line 2, :ch 2}, :head {:line 4, :ch 10}}), :dt 19} {:selections ({:anchor {:line 2, :ch 2}, :head {:line 4, :ch 13}}), :dt 16} {:selections ({:anchor {:line 2, :ch 2}, :head {:line 4, :ch 15}}), :dt 17} {:selections ({:anchor {:line 2, :ch 2}, :head {:line 4, :ch 16}}), :dt 17} {:change {:from {:line 2, :ch 0}, :to {:line 2, :ch 2}, :text (" "), :origin "+input"}, :dt 390} {:change {:from {:line 3, :ch 0}, :to {:line 3, :ch 17}, :text (" "), :origin "+input"}, :dt 5} {:change {:from {:line 4, :ch 0}, :to {:line 4, :ch 2}, :text (" "), :origin "+input"}, :dt 4} {:selections ({:anchor {:line 4, :ch 4}, :head {:line 4, :ch 4}}), :dt 1144} {:selections ({:anchor {:line 4, :ch 4}, :head {:line 4, :ch 4}}), :dt 22} {:change {:from {:line 4, :ch 4}, :to {:line 4, :ch 4}, :text (" "), :origin "+input"}, :dt 578}], :init-value "", :last-time 1444670969215, :recording? false, :timescale 2}) (def line '{:changes [{:selections ({:anchor {:line 0, :ch 0}, :head {:line 0, :ch 0}}), :dt 0} {:change {:from {:line 0, :ch 0}, :to {:line 0, :ch 0}, :text ("(ns example.core" " (:require" " [clojure.string :refer [join]]" " [clojure.data :refer [diff]]))"), :origin "paste"}, :dt 504} {:change {:from {:line 3, :ch 34}, :to {:line 3, :ch 34}, :text ("" ""), :origin "+input"}, :dt 498} {:change {:from {:line 4, :ch 0}, :to {:line 4, :ch 0}, :text (" "), :origin "+input"}, :dt 200} {:change {:from {:line 4, :ch 2}, :to {:line 4, :ch 2}, :text (" "), :origin "+input"}, :dt 184} {:change {:from {:line 4, :ch 4}, :to {:line 4, :ch 4}, :text ("e"), :origin "+input"}, :dt 246} {:change {:from {:line 4, :ch 5}, :to {:line 4, :ch 5}, :text ("x"), :origin "+input"}, :dt 220} {:change {:from {:line 4, :ch 6}, :to {:line 4, :ch 6}, :text ("a"), :origin "+input"}, :dt 74} {:change {:from {:line 4, :ch 7}, :to {:line 4, :ch 7}, :text ("m"), :origin "+input"}, :dt 89} {:change {:from {:line 4, :ch 8}, :to {:line 4, :ch 8}, :text ("p"), :origin "+input"}, :dt 36} {:change {:from {:line 4, :ch 9}, :to {:line 4, :ch 9}, :text ("l"), :origin "+input"}, :dt 100} {:change {:from {:line 4, :ch 10}, :to {:line 4, :ch 10}, :text ("e"), :origin "+input"}, :dt 51} {:change {:from {:line 4, :ch 11}, :to {:line 4, :ch 11}, :text ("."), :origin "+input"}, :dt 137} {:change {:from {:line 4, :ch 12}, :to {:line 4, :ch 12}, :text ("b"), :origin "+input"}, :dt 95} {:change {:from {:line 4, :ch 13}, :to {:line 4, :ch 13}, :text ("a"), :origin "+input"}, :dt 117} {:change {:from {:line 4, :ch 14}, :to {:line 4, :ch 14}, :text ("r"), :origin "+input"}, :dt 116} {:selections ({:anchor {:line 4, :ch 17}, :head {:line 4, :ch 17}}), :dt 1117} {:change {:from {:line 4, :ch 17}, :to {:line 4, :ch 17}, :text ("" ""), :origin "+input"}, :dt 418} {:change {:from {:line 5, :ch 0}, :to {:line 5, :ch 0}, :text (" "), :origin "+input"}, :dt 152} {:change {:from {:line 5, :ch 2}, :to {:line 5, :ch 2}, :text (" "), :origin "+input"}, :dt 478} {:change {:from {:line 5, :ch 4}, :to {:line 5, :ch 4}, :text ("e"), :origin "+input"}, :dt 218} {:change {:from {:line 5, :ch 5}, :to {:line 5, :ch 5}, :text ("x"), :origin "+input"}, :dt 217} {:change {:from {:line 5, :ch 6}, :to {:line 5, :ch 6}, :text ("a"), :origin "+input"}, :dt 48} {:change {:from {:line 5, :ch 7}, :to {:line 5, :ch 7}, :text ("m"), :origin "+input"}, :dt 118} {:change {:from {:line 5, :ch 8}, :to {:line 5, :ch 8}, :text ("p"), :origin "+input"}, :dt 42} {:change {:from {:line 5, :ch 9}, :to {:line 5, :ch 9}, :text ("l"), :origin "+input"}, :dt 72} {:change {:from {:line 5, :ch 10}, :to {:line 5, :ch 10}, :text ("e"), :origin "+input"}, :dt 56} {:change {:from {:line 5, :ch 11}, :to {:line 5, :ch 11}, :text ("."), :origin "+input"}, :dt 152} {:change {:from {:line 5, :ch 12}, :to {:line 5, :ch 12}, :text ("b"), :origin "+input"}, :dt 96} {:change {:from {:line 5, :ch 13}, :to {:line 5, :ch 13}, :text ("a"), :origin "+input"}, :dt 117} {:change {:from {:line 5, :ch 14}, :to {:line 5, :ch 14}, :text ("z"), :origin "+input"}, :dt 233} {:selections ({:anchor {:line 5, :ch 12}, :head {:line 5, :ch 12}}), :dt 1184} {:selections ({:anchor {:line 5, :ch 12}, :head {:line 5, :ch 15}}), :dt 120} {:selections ({:anchor {:line 5, :ch 0}, :head {:line 5, :ch 17}}), :dt 145} {:change {:from {:line 5, :ch 0}, :to {:line 5, :ch 17}, :text (""), :origin "+delete"}, :dt 336} {:selections ({:anchor {:line 4, :ch 13}, :head {:line 4, :ch 13}}), :dt 939} {:selections ({:anchor {:line 4, :ch 12}, :head {:line 4, :ch 15}}), :dt 143} {:selections ({:anchor {:line 4, :ch 0}, :head {:line 5, :ch 0}}), :dt 350} {:change {:from {:line 4, :ch 0}, :to {:line 5, :ch 0}, :text (""), :origin "+delete"}, :dt 416}], :init-value "", :last-time 1497819532394, :recording? false, :timescale 2}) (def comment- '{:changes [{:selections ({:anchor {:line 3, :ch 3}, :head {:line 3, :ch 3}}), :dt 0} {:selections ({:anchor {:line 3, :ch 3}, :head {:line 3, :ch 3}}), :dt 3} {:change {:from {:line 3, :ch 3}, :to {:line 3, :ch 3}, :text (";"), :origin "+input"}, :dt 1045} {:change {:from {:line 3, :ch 4}, :to {:line 3, :ch 4}, :text (";"), :origin "+input"}, :dt 186} {:change {:from {:line 3, :ch 4}, :to {:line 3, :ch 5}, :text (""), :origin "+delete"}, :dt 704} {:change {:from {:line 3, :ch 3}, :to {:line 3, :ch 4}, :text (""), :origin "+delete"}, :dt 151} {:change {:from {:line 3, :ch 3}, :to {:line 3, :ch 3}, :text (";"), :origin "+input"}, :dt 829} {:change {:from {:line 3, :ch 4}, :to {:line 3, :ch 4}, :text (";"), :origin "+input"}, :dt 168} {:change {:from {:line 3, :ch 4}, :to {:line 3, :ch 5}, :text (""), :origin "+delete"}, :dt 677} {:change {:from {:line 3, :ch 3}, :to {:line 3, :ch 4}, :text (""), :origin "+delete"}, :dt 171}], :init-value "(cljs.build.api/build \"src\"\n {:main 'hello-world.core\n :output-to \"out/main.js\"\n :verbose true})", :last-time 1455861506898, :recording? false, :timescale 1.2}) (def wrap '{:timescale 2 :changes [{:selections ({:anchor {:line 0, :ch 0}, :head {:line 0, :ch 0}}), :dt 0} {:change {:from {:line 0, :ch 0}, :to {:line 0, :ch 0}, :text ("(foo 1 2 3 4 5 6)"), :origin "paste"}, :dt 543} {:selections ({:anchor {:line 0, :ch 5}, :head {:line 0, :ch 5}}), :dt 924} {:change {:from {:line 0, :ch 5}, :to {:line 0, :ch 5}, :text ("["), :origin "+input"}, :dt 595} {:selections ({:anchor {:line 0, :ch 19}, :head {:line 0, :ch 19}}), :dt 856} {:change {:from {:line 0, :ch 19}, :to {:line 0, :ch 19}, :text ("" ""), :origin "+input"}, :dt 572} {:change {:from {:line 1, :ch 0}, :to {:line 1, :ch 0}, :text ("("), :origin "+input"}, :dt 311} {:change {:from {:line 1, :ch 1}, :to {:line 1, :ch 1}, :text ("b"), :origin "+input"}, :dt 207} {:change {:from {:line 1, :ch 2}, :to {:line 1, :ch 2}, :text ("a"), :origin "+input"}, :dt 169} {:change {:from {:line 1, :ch 3}, :to {:line 1, :ch 3}, :text ("r"), :origin "+input"}, :dt 112} {:change {:from {:line 1, :ch 4}, :to {:line 1, :ch 4}, :text (" "), :origin "+input"}, :dt 79} {:change {:from {:line 1, :ch 5}, :to {:line 1, :ch 5}, :text ("a"), :origin "+input"}, :dt 244} {:change {:from {:line 1, :ch 6}, :to {:line 1, :ch 6}, :text (" "), :origin "+input"}, :dt 83} {:change {:from {:line 1, :ch 7}, :to {:line 1, :ch 7}, :text ("b"), :origin "+input"}, :dt 227} {:change {:from {:line 1, :ch 8}, :to {:line 1, :ch 8}, :text (" "), :origin "+input"}, :dt 181} {:change {:from {:line 1, :ch 9}, :to {:line 1, :ch 9}, :text ("c"), :origin "+input"}, :dt 130}], :init-value "", :last-time 1444574204081, :recording? false}) (def splice '{:timescale 2 :changes [{:selections ({:anchor {:line 0, :ch 0}, :head {:line 0, :ch 0}}), :dt 0} {:change {:from {:line 0, :ch 0}, :to {:line 0, :ch 0}, :text ("(foo [1 2 3 4 5 6])" "(bar a b c)"), :origin "paste"}, :dt 917} {:selections ({:anchor {:line 0, :ch 6}, :head {:line 0, :ch 6}}), :dt 1006} {:change {:from {:line 0, :ch 5}, :to {:line 0, :ch 6}, :text (""), :origin "+delete"}, :dt 746} {:selections ({:anchor {:line 1, :ch 1}, :head {:line 1, :ch 1}}), :dt 970} {:change {:from {:line 1, :ch 0}, :to {:line 1, :ch 1}, :text (""), :origin "+delete"}, :dt 446}], :init-value "", :last-time 1444575352287, :recording? false}) (def barf '{:timescale 2 :changes [{:selections ({:anchor {:line 0, :ch 0}, :head {:line 0, :ch 0}}), :dt 0} {:change {:from {:line 0, :ch 0}, :to {:line 0, :ch 0}, :text ("(foo [1 2 3 4 5 6])" "(bar a b c)"), :origin "paste"}, :dt 1438} {:selections ({:anchor {:line 0, :ch 11}, :head {:line 0, :ch 11}}), :dt 1384} {:change {:from {:line 0, :ch 11}, :to {:line 0, :ch 11}, :text ("]"), :origin "+input"}, :dt 588} {:selections ({:anchor {:line 1, :ch 8}, :head {:line 1, :ch 8}}), :dt 1033} {:change {:from {:line 1, :ch 8}, :to {:line 1, :ch 8}, :text (")"), :origin "+input"}, :dt 889}], :init-value "", :last-time 1444574335406, :recording? false}) (def slurp- '{:timescale 2 :changes [{:selections ({:anchor {:line 0, :ch 0}, :head {:line 0, :ch 0}}), :dt 0} {:change {:from {:line 0, :ch 0}, :to {:line 0, :ch 0}, :text ("(foo [1 2 3] 4 5 6)" "(bar a b) c"), :origin "paste"}, :dt 1109} {:selections ({:anchor {:line 0, :ch 12}, :head {:line 0, :ch 12}}), :dt 918} {:change {:from {:line 0, :ch 11}, :to {:line 0, :ch 12}, :text (""), :origin "+delete"}, :dt 1195} {:selections ({:anchor {:line 0, :ch 18}, :head {:line 0, :ch 18}}), :dt 592} {:selections ({:anchor {:line 1, :ch 9}, :head {:line 1, :ch 9}}), :dt 1709} {:change {:from {:line 1, :ch 8}, :to {:line 1, :ch 9}, :text (""), :origin "+delete"}, :dt 1279} {:selections ({:anchor {:line 1, :ch 11}, :head {:line 1, :ch 11}}), :dt 510}], :init-value "", :last-time 1444643570209, :recording? false}) (def string '{:timescale 2 :changes [{:selections ({:anchor {:line 0, :ch 9}, :head {:line 0, :ch 9}}), :dt 500} {:change {:from {:line 0, :ch 9}, :to {:line 0, :ch 10}, :text (""), :origin "+delete"}, :dt 0} {:change {:from {:line 0, :ch 9}, :to {:line 0, :ch 9}, :text ("" ""), :origin "+input"}, :dt 205} {:change {:from {:line 1, :ch 0}, :to {:line 1, :ch 0}, :text (" "), :origin "+input"}, :dt 3} {:change {:from {:line 1, :ch 2}, :to {:line 1, :ch 2}, :text ("\""), :origin "+input"}, :dt 291} {:change {:from {:line 1, :ch 3}, :to {:line 1, :ch 3}, :text ("m"), :origin "+input"}, :dt 480} {:change {:from {:line 1, :ch 4}, :to {:line 1, :ch 4}, :text ("y"), :origin "+input"}, :dt 180} {:change {:from {:line 1, :ch 5}, :to {:line 1, :ch 5}, :text (" "), :origin "+input"}, :dt 109} {:change {:from {:line 1, :ch 6}, :to {:line 1, :ch 6}, :text ("d"), :origin "+input"}, :dt 186} {:change {:from {:line 1, :ch 7}, :to {:line 1, :ch 7}, :text ("o"), :origin "+input"}, :dt 110} {:change {:from {:line 1, :ch 8}, :to {:line 1, :ch 8}, :text ("c"), :origin "+input"}, :dt 80} {:change {:from {:line 1, :ch 9}, :to {:line 1, :ch 9}, :text ("s"), :origin "+input"}, :dt 123} {:change {:from {:line 1, :ch 10}, :to {:line 1, :ch 10}, :text ("t"), :origin "+input"}, :dt 108} {:change {:from {:line 1, :ch 11}, :to {:line 1, :ch 11}, :text ("r"), :origin "+input"}, :dt 165} {:change {:from {:line 1, :ch 12}, :to {:line 1, :ch 12}, :text ("i"), :origin "+input"}, :dt 42} {:change {:from {:line 1, :ch 13}, :to {:line 1, :ch 13}, :text ("n"), :origin "+input"}, :dt 128} {:change {:from {:line 1, :ch 14}, :to {:line 1, :ch 14}, :text ("g"), :origin "+input"}, :dt 154} {:change {:from {:line 1, :ch 15}, :to {:line 1, :ch 15}, :text ("."), :origin "+input"}, :dt 216} {:change {:from {:line 1, :ch 16}, :to {:line 1, :ch 16}, :text ("\""), :origin "+input"}, :dt 266} {:change {:from {:line 1, :ch 17}, :to {:line 1, :ch 17}, :text ("" ""), :origin "+input"}, :dt 439} {:change {:from {:line 2, :ch 0}, :to {:line 2, :ch 0}, :text (" "), :origin "+input"}, :dt 3} {:selections ({:anchor {:line 3, :ch 2}, :head {:line 3, :ch 2}}), :dt 585} {:change {:from {:line 3, :ch 2}, :to {:line 3, :ch 2}, :text ("("), :origin "+input"}, :dt 613} {:change {:from {:line 3, :ch 3}, :to {:line 3, :ch 3}, :text ("s"), :origin "+input"}, :dt 121} {:change {:from {:line 3, :ch 4}, :to {:line 3, :ch 4}, :text ("t"), :origin "+input"}, :dt 77} {:change {:from {:line 3, :ch 5}, :to {:line 3, :ch 5}, :text ("r"), :origin "+input"}, :dt 198} {:change {:from {:line 3, :ch 6}, :to {:line 3, :ch 6}, :text (" "), :origin "+input"}, :dt 228} {:change {:from {:line 3, :ch 7}, :to {:line 3, :ch 7}, :text ("\""), :origin "+input"}, :dt 267} {:selections ({:anchor {:line 3, :ch 15}, :head {:line 3, :ch 15}}), :dt 1342} {:change {:from {:line 3, :ch 15}, :to {:line 3, :ch 15}, :text (" "), :origin "+input"}, :dt 655} {:change {:from {:line 3, :ch 16}, :to {:line 3, :ch 16}, :text ("i"), :origin "+input"}, :dt 164} {:change {:from {:line 3, :ch 17}, :to {:line 3, :ch 17}, :text ("s"), :origin "+input"}, :dt 125} {:change {:from {:line 3, :ch 18}, :to {:line 3, :ch 18}, :text (" "), :origin "+input"}, :dt 125} {:change {:from {:line 3, :ch 19}, :to {:line 3, :ch 19}, :text ("\""), :origin "+input"}, :dt 236} {:change {:from {:line 3, :ch 20}, :to {:line 3, :ch 20}, :text (" "), :origin "+input"}, :dt 407} {:change {:from {:line 3, :ch 21}, :to {:line 3, :ch 21}, :text ("("), :origin "+input"}, :dt 267} {:change {:from {:line 3, :ch 22}, :to {:line 3, :ch 22}, :text ("+"), :origin "+input"}, :dt 282} {:change {:from {:line 3, :ch 23}, :to {:line 3, :ch 23}, :text (" "), :origin "+input"}, :dt 420} {:change {:from {:line 3, :ch 24}, :to {:line 3, :ch 24}, :text ("a"), :origin "+input"}, :dt 131} {:change {:from {:line 3, :ch 25}, :to {:line 3, :ch 25}, :text (" "), :origin "+input"}, :dt 167} {:change {:from {:line 3, :ch 26}, :to {:line 3, :ch 26}, :text ("b"), :origin "+input"}, :dt 182}], :init-value "(defn foo [a b]\n (+ a b))", :last-time 1444150093903, :recording? false}) (def displaced '{:timescale 2 :changes [{:selections ({:anchor {:line 0, :ch 0}, :head {:line 0, :ch 0}}), :dt 1000} {:change {:from {:line 0, :ch 0}, :to {:line 0, :ch 0}, :text ("(foo [1 2 3" " 4 5 6" " 7 8 9])"), :origin "paste"}, :dt 0} {:selections ({:anchor {:line 0, :ch 11}, :head {:line 0, :ch 11}}), :dt 1168} {:change {:from {:line 0, :ch 11}, :to {:line 0, :ch 11}, :text ("]"), :origin "+input"}, :dt 1522} {:selections ({:anchor {:line 1, :ch 11}, :head {:line 1, :ch 11}}), :dt 2099}], :init-value "", :last-time 1444261412937, :recording? false}) (def not-displaced '{:timescale 2 :changes [{:selections ({:anchor {:line 0, :ch 0}, :head {:line 0, :ch 0}}), :dt 1000} {:change {:from {:line 0, :ch 0}, :to {:line 0, :ch 0}, :text ("(foo [1 2 3" " 4 5 6" " 7 8 9])"), :origin "paste"}, :dt 0} {:selections ({:anchor {:line 0, :ch 11}, :head {:line 0, :ch 11}}), :dt 861} {:change {:from {:line 0, :ch 11}, :to {:line 0, :ch 11}, :text ("]"), :origin "+input"}, :dt 940} {:change {:from {:line 0, :ch 12}, :to {:line 0, :ch 12}, :text (" "), :origin "+input"}, :dt 514} {:change {:from {:line 0, :ch 13}, :to {:line 0, :ch 13}, :text ("x"), :origin "+input"}, :dt 595} {:selections ({:anchor {:line 1, :ch 11}, :head {:line 1, :ch 11}}), :dt 875}], :init-value "", :last-time 1444261858898, :recording? false}) (def warn-bad '{:loop-delay 2500 :changes [{:selections ({:anchor {:line 0, :ch 0}, :head {:line 0, :ch 0}}), :dt 0} {:change {:from {:line 0, :ch 0}, :to {:line 0, :ch 0}, :text ("" "" "(def string \")))))\") ;; <-- corrupted!" "" ";; \" <-- BAD (unclosed string)"), :origin "paste"}, :dt 100} {:selections ({:anchor {:line 0, :ch 0}, :head {:line 0, :ch 0}}), :dt 1082} {:change {:from {:line 0, :ch 0}, :to {:line 0, :ch 0}, :text ("\""), :origin "+input"}, :dt 704} {:change {:from {:line 0, :ch 1}, :to {:line 0, :ch 1}, :text ("\""), :origin "+input"}, :dt 290}], :init-value "", :last-time 1444508331824, :recording? false}) (def warn-good '{:loop-delay 2500 :changes [{:selections ({:anchor {:line 0, :ch 0}, :head {:line 0, :ch 0}}), :dt 0} {:change {:from {:line 0, :ch 0}, :to {:line 0, :ch 0}, :text ("" "" "(def string \")))))\") ;; <-- preserved!" "" ";; \"\" <-- GOOD (balanced quotes)"), :origin "paste"}, :dt 100} {:selections ({:anchor {:line 0, :ch 0}, :head {:line 0, :ch 0}}), :dt 1082} {:change {:from {:line 0, :ch 0}, :to {:line 0, :ch 0}, :text ("\""), :origin "+input"}, :dt 704} {:change {:from {:line 0, :ch 1}, :to {:line 0, :ch 1}, :text ("\""), :origin "+input"}, :dt 290}], :init-value "", :last-time 1444508331824, :recording? false}) (def paren-tune '{:timescale 2 :changes [{:selections ({:anchor {:line 0, :ch 0}, :head {:line 0, :ch 0}}), :dt 0} {:change {:from {:line 0, :ch 0}, :to {:line 0, :ch 0}, :text ("(assoc state" " :foo 1" " :bar 2" " :baz 3)"), :origin "paste"}, :dt 627} {:selections ({:anchor {:line 3, :ch 11}, :head {:line 3, :ch 10}}), :dt 477} {:selections ({:anchor {:line 3, :ch 11}, :head {:line 3, :ch 9}}), :dt 22} {:selections ({:anchor {:line 3, :ch 11}, :head {:line 3, :ch 7}}), :dt 12} {:selections ({:anchor {:line 3, :ch 11}, :head {:line 3, :ch 6}}), :dt 27} {:selections ({:anchor {:line 3, :ch 11}, :head {:line 3, :ch 5}}), :dt 9} {:selections ({:anchor {:line 3, :ch 11}, :head {:line 2, :ch 4}}), :dt 23} {:selections ({:anchor {:line 3, :ch 11}, :head {:line 2, :ch 3}}), :dt 17} {:selections ({:anchor {:line 3, :ch 11}, :head {:line 2, :ch 2}}), :dt 28} {:selections ({:anchor {:line 3, :ch 11}, :head {:line 2, :ch 1}}), :dt 17} {:selections ({:anchor {:line 3, :ch 11}, :head {:line 2, :ch 0}}), :dt 35} {:selections ({:anchor {:line 3, :ch 11}, :head {:line 1, :ch 0}}), :dt 62} {:change {:from {:line 1, :ch 0}, :to {:line 1, :ch 3}, :text (" "), :origin "+indenthack"}, :dt 584} {:change {:from {:line 2, :ch 0}, :to {:line 2, :ch 2}, :text (""), :origin "+indenthack"}, :dt 2} {:change {:from {:line 3, :ch 0}, :to {:line 3, :ch 4}, :text (" "), :origin "+indenthack"}, :dt 2} {:change {:from {:line 1, :ch 0}, :to {:line 1, :ch 1}, :text (""), :origin "+indenthack"}, :dt 451} {:change {:from {:line 2, :ch 0}, :to {:line 2, :ch 1}, :text (""), :origin "+indenthack"}, :dt 3} {:change {:from {:line 3, :ch 0}, :to {:line 3, :ch 2}, :text (""), :origin "+indenthack"}, :dt 2} {:change {:from {:line 1, :ch 0}, :to {:line 1, :ch 1}, :text (" "), :origin "+indenthack"}, :dt 423} {:change {:from {:line 2, :ch 0}, :to {:line 2, :ch 1}, :text (" "), :origin "+indenthack"}, :dt 4} {:change {:from {:line 3, :ch 0}, :to {:line 3, :ch 1}, :text (" "), :origin "+indenthack"}, :dt 3} {:selections ({:anchor {:line 3, :ch 10}, :head {:line 3, :ch 10}}), :dt 819}], :init-value "", :last-time 1445549397039, :recording? false}) (def paren-frac '{:changes [{:selections ({:anchor {:line 0, :ch 0}, :head {:line 0, :ch 0}}), :dt 0} {:change {:from {:line 0, :ch 0}, :to {:line 0, :ch 0}, :text ("(def m {:foo 1" " :bar 2" " :baz 3})"), :origin "paste"}, :dt 480} {:selections ({:anchor {:line 0, :ch 6}, :head {:line 0, :ch 6}}), :dt 883} {:change {:from {:line 0, :ch 6}, :to {:line 0, :ch 6}, :text ("y"), :origin "+input"}, :dt 930} {:change {:from {:line 0, :ch 7}, :to {:line 0, :ch 7}, :text ("-"), :origin "+input"}, :dt 136} {:change {:from {:line 0, :ch 8}, :to {:line 0, :ch 8}, :text ("m"), :origin "+input"}, :dt 112} {:change {:from {:line 0, :ch 9}, :to {:line 0, :ch 9}, :text ("a"), :origin "+input"}, :dt 152} {:change {:from {:line 0, :ch 10}, :to {:line 0, :ch 10}, :text ("p"), :origin "+input"}, :dt 208}], :init-value "", :last-time 1446661662368, :recording? false}) (def intro-paren '{:changes [{:selections ({:anchor {:line 0, :ch 0}, :head {:line 0, :ch 0}}), :dt 0} {:change {:from {:line 0, :ch 0}, :to {:line 0, :ch 0}, :text ("(def m {:foo 1" " :bar 2" " :baz 3})"), :origin "paste"}, :dt 571} {:selections ({:anchor {:line 0, :ch 6}, :head {:line 0, :ch 6}}), :dt 894} {:change {:from {:line 0, :ch 6}, :to {:line 0, :ch 6}, :text ("y"), :origin "+input"}, :dt 423} {:change {:from {:line 0, :ch 7}, :to {:line 0, :ch 7}, :text ("-"), :origin "+input"}, :dt 129} {:change {:from {:line 0, :ch 8}, :to {:line 0, :ch 8}, :text ("m"), :origin "+input"}, :dt 147} {:change {:from {:line 0, :ch 9}, :to {:line 0, :ch 9}, :text ("a"), :origin "+input"}, :dt 101} {:change {:from {:line 0, :ch 10}, :to {:line 0, :ch 10}, :text ("p"), :origin "+input"}, :dt 136} {:change {:from {:line 0, :ch 10}, :to {:line 0, :ch 11}, :text (""), :origin "+delete"}, :dt 812} {:change {:from {:line 0, :ch 9}, :to {:line 0, :ch 10}, :text (""), :origin "+delete"}, :dt 167} {:change {:from {:line 0, :ch 8}, :to {:line 0, :ch 9}, :text (""), :origin "+delete"}, :dt 140} {:change {:from {:line 0, :ch 7}, :to {:line 0, :ch 8}, :text (""), :origin "+delete"}, :dt 144} {:change {:from {:line 0, :ch 6}, :to {:line 0, :ch 7}, :text (""), :origin "+delete"}, :dt 152} {:change {:from {:line 0, :ch 5}, :to {:line 0, :ch 6}, :text (""), :origin "+delete"}, :dt 148} {:change {:from {:line 0, :ch 5}, :to {:line 0, :ch 5}, :text ("f"), :origin "+input"}, :dt 167} {:change {:from {:line 0, :ch 6}, :to {:line 0, :ch 6}, :text ("o"), :origin "+input"}, :dt 115} {:change {:from {:line 0, :ch 7}, :to {:line 0, :ch 7}, :text ("o"), :origin "+input"}, :dt 168}], :init-value "", :last-time 1447143188681, :recording? false}) (def intro-paredit '{:timescale 2 :changes [{:selections ({:anchor {:line 0, :ch 0}, :head {:line 0, :ch 0}}), :dt 0} {:change {:from {:line 0, :ch 0}, :to {:line 0, :ch 0}, :text ("(defn foo a b" " (let x + a b" " (println \"sum is\" x)))"), :origin "paste"}, :dt 1197} {:selections ({:anchor {:line 0, :ch 10}, :head {:line 0, :ch 10}}), :dt 1483} {:change {:from {:line 0, :ch 10}, :to {:line 0, :ch 10}, :text ("["), :origin "+input"}, :dt 683} {:change {:from {:line 0, :ch 10}, :to {:line 0, :ch 11}, :text (""), :origin "+delete"}, :dt 483} {:change {:from {:line 0, :ch 10}, :to {:line 0, :ch 10}, :text ("["), :origin "+input"}, :dt 551} {:change {:from {:line 0, :ch 10}, :to {:line 0, :ch 11}, :text (""), :origin "+delete"}, :dt 786} {:change {:from {:line 0, :ch 10}, :to {:line 0, :ch 10}, :text ("["), :origin "+input"}, :dt 545} {:selections ({:anchor {:line 1, :ch 3}, :head {:line 1, :ch 3}}), :dt 1268} {:change {:from {:line 1, :ch 2}, :to {:line 1, :ch 3}, :text (""), :origin "+delete"}, :dt 1225} {:change {:from {:line 1, :ch 2}, :to {:line 1, :ch 2}, :text ("("), :origin "+input"}, :dt 563} {:change {:from {:line 1, :ch 2}, :to {:line 1, :ch 3}, :text (""), :origin "+delete"}, :dt 472} {:change {:from {:line 1, :ch 2}, :to {:line 1, :ch 2}, :text ("("), :origin "+input"}, :dt 800} {:selections ({:anchor {:line 1, :ch 7}, :head {:line 1, :ch 7}}), :dt 1475} {:change {:from {:line 1, :ch 7}, :to {:line 1, :ch 7}, :text ("["), :origin "+input"}, :dt 1015} {:selections ({:anchor {:line 1, :ch 10}, :head {:line 1, :ch 10}}), :dt 866} {:change {:from {:line 1, :ch 10}, :to {:line 1, :ch 10}, :text ("("), :origin "+input"}, :dt 1070} {:selections ({:anchor {:line 1, :ch 14}, :head {:line 1, :ch 14}}), :dt 1221} {:change {:from {:line 1, :ch 14}, :to {:line 1, :ch 14}, :text (")"), :origin "+input"}, :dt 1114} {:selections ({:anchor {:line 1, :ch 12}, :head {:line 1, :ch 12}}), :dt 1748} {:change {:from {:line 1, :ch 12}, :to {:line 1, :ch 12}, :text (")"), :origin "+input"}, :dt 389} {:change {:from {:line 1, :ch 12}, :to {:line 1, :ch 13}, :text (""), :origin "+delete"}, :dt 1484}], :init-value "", :last-time 1447143951531, :recording? false}) (def paren-comment '{:changes [{:selections ({:anchor {:line 0, :ch 0}, :head {:line 0, :ch 0}}), :dt 0} {:change {:from {:line 0, :ch 0}, :to {:line 0, :ch 0}, :text ("#"), :origin "+input"}, :dt 866} {:change {:from {:line 0, :ch 1}, :to {:line 0, :ch 1}, :text ("_"), :origin "+input"}, :dt 186} {:change {:from {:line 0, :ch 1}, :to {:line 0, :ch 2}, :text (""), :origin "+delete"}, :dt 725} {:change {:from {:line 0, :ch 0}, :to {:line 0, :ch 1}, :text (""), :origin "+delete"}, :dt 223} {:change {:from {:line 0, :ch 0}, :to {:line 0, :ch 0}, :text ("#"), :origin "+input"}, :dt 565} {:change {:from {:line 0, :ch 1}, :to {:line 0, :ch 1}, :text ("_"), :origin "+input"}, :dt 173} {:change {:from {:line 0, :ch 1}, :to {:line 0, :ch 2}, :text (""), :origin "+delete"}, :dt 871} {:change {:from {:line 0, :ch 0}, :to {:line 0, :ch 1}, :text (""), :origin "+delete"}, :dt 186}], :init-value "(defn foo\n [a b]\n (+ a b))", :last-time 1445550928007, :recording? false}) (def paren-wrap '{:timescale 2 :changes [{:selections ({:anchor {:line 0, :ch 0}, :head {:line 0, :ch 0}}), :dt 0} {:change {:from {:line 0, :ch 0}, :to {:line 0, :ch 0}, :text ("[1 2 3" " 4 5 6" " 7 8 9]"), :origin "paste"}, :dt 714} {:selections ({:anchor {:line 0, :ch 0}, :head {:line 0, :ch 0}}), :dt 559} {:change {:from {:line 0, :ch 0}, :to {:line 0, :ch 0}, :text ("("), :origin "+input"}, :dt 804} {:change {:from {:line 0, :ch 1}, :to {:line 0, :ch 1}, :text ("f"), :origin "+input"}, :dt 252} {:change {:from {:line 0, :ch 2}, :to {:line 0, :ch 2}, :text ("o"), :origin "+input"}, :dt 83} {:change {:from {:line 0, :ch 3}, :to {:line 0, :ch 3}, :text ("o"), :origin "+input"}, :dt 154} {:change {:from {:line 0, :ch 4}, :to {:line 0, :ch 4}, :text (" "), :origin "+input"}, :dt 223} {:selections ({:anchor {:line 2, :ch 7}, :head {:line 2, :ch 7}}), :dt 613} {:change {:from {:line 2, :ch 7}, :to {:line 2, :ch 7}, :text (")"), :origin "+input"}, :dt 652}], :init-value "", :last-time 1445552518239, :recording? false}) (def displaced-after-balance '{:changes [{:selections ({:anchor {:line 0, :ch 0}, :head {:line 0, :ch 0}}), :dt 0} {:change {:from {:line 0, :ch 0}, :to {:line 0, :ch 0}, :text ("(foo [a b"), :origin "paste"}, :dt 546} {:change {:from {:line 0, :ch 9}, :to {:line 0, :ch 9}, :text ("" ""), :origin "+input"}, :dt 483} {:change {:from {:line 1, :ch 0}, :to {:line 1, :ch 0}, :text (" "), :origin "+indenthack"}, :dt 3} {:change {:from {:line 1, :ch 6}, :to {:line 1, :ch 6}, :text ("]"), :origin "+input"}, :dt 610} {:change {:from {:line 1, :ch 7}, :to {:line 1, :ch 7}, :text (")"), :origin "+input"}, :dt 913}], :init-value "", :last-time 1448163749775, :recording? false}) (def not-displaced-on-enter '{:changes [{:selections ({:anchor {:line 0, :ch 0}, :head {:line 0, :ch 0}}), :dt 0} {:change {:from {:line 0, :ch 0}, :to {:line 0, :ch 0}, :text ("(foo [a b])"), :origin "paste"}, :dt 446} {:selections ({:anchor {:line 0, :ch 9}, :head {:line 0, :ch 9}}), :dt 664} {:change {:from {:line 0, :ch 9}, :to {:line 0, :ch 9}, :text ("" ""), :origin "+input"}, :dt 807} {:change {:from {:line 1, :ch 0}, ;; NOTE: I had to hack this recording by replacing: ;; :to {:line 1, :ch 0} ---with---> {:line 1, :ch 6} ;; It was adding double indentation for some reason. :to {:line 1, :ch 6}, :text (" "), :origin "+indenthack"}, :dt 2} {:change {:from {:line 1, :ch 6}, :to {:line 1, :ch 6}, :text ("c"), :origin "+input"}, :dt 348} {:change {:from {:line 1, :ch 7}, :to {:line 1, :ch 7}, :text (" "), :origin "+input"}, :dt 136} {:change {:from {:line 1, :ch 8}, :to {:line 1, :ch 8}, :text ("d"), :origin "+input"}, :dt 350} {:selections ({:anchor {:line 1, :ch 11}, :head {:line 1, :ch 11}}), :dt 1285}], :init-value "", :last-time 1448164475550, :recording? false}) (def displaced-after-cursor-leaves '{:changes [{:selections ({:anchor {:line 0, :ch 0}, :head {:line 0, :ch 0}}), :dt 0} {:change {:from {:line 0, :ch 0}, :to {:line 0, :ch 0}, :text ("(foo [a b])"), :origin "paste"}, :dt 484} {:selections ({:anchor {:line 0, :ch 9}, :head {:line 0, :ch 9}}), :dt 700} {:change {:from {:line 0, :ch 9}, :to {:line 0, :ch 9}, :text ("" ""), :origin "+input"}, :dt 1104} {:change {:from {:line 1, :ch 0}, ;; NOTE: I had to hack this recording by replacing: ;; :to {:line 1, :ch 0} ---with---> {:line 1, :ch 6} ;; It was adding double indentation for some reason. :to {:line 1, :ch 6}, :text (" "), :origin "+indenthack"}, :dt 2} {:selections ({:anchor {:line 0, :ch 6}, :head {:line 0, :ch 6}}), :dt 1684}], :init-value "", :last-time 1448163855310, :recording? false}) <|start_filename|>site/resources/public/js/lib/gears.d3.externs.js<|end_filename|> var Gear = { create: function(){}, setPower: function(){}, randomArrange: function(){}, dragBehaviour: function(){}, anyGearCollides: function(){}, gearCollides: function(){}, propagateGears: function(){}, updateGears: function(){}, mesh: function(){}, path: function(){} }; Gear.Utility = { keys: function(){}, distanceSquared: function(){}, angle: function(){}, sign: function(){}, arrayShuffle: function(){}, arrayClone: function(){} }; <|start_filename|>lib/test.js<|end_filename|> // // Parinfer Test 3.12.0 // // Copyright 2015-2017 © <NAME> // MIT License // var parinfer = require('./parinfer'); var LINE_ENDING_REGEX = /\r?\n/; function isOpenParen(c) { return c === "{" || c === "(" || c === "["; } function isCloseParen(c) { return c === "}" || c === ")" || c === "]"; } //------------------------------------------------------------------------------ // String Operations //------------------------------------------------------------------------------ function replaceWithinString(orig, start, end, replace) { return ( orig.substring(0, start) + replace + orig.substring(end) ); } function repeatString(text, n) { var i; var result = ""; for (i = 0; i < n; i++) { result += text; } return result; } //------------------------------------------------------------------------------ // Input Parser //------------------------------------------------------------------------------ function error(lineNo, msg) { return "test parse error at line " + lineNo + ": " + msg; } function parsePrevCursorLine(options, inputLineNo, outputLineNo, input) { var match = input.match(/^\s*\^\s*prevCursor\s*$/); if (!match) { return false; } var x = input.indexOf("^"); if (options.cursorX < x && options.cursorLine == outputLineNo) { x++; } options.prevCursorX = x; options.prevCursorLine = outputLineNo; return true; } function parseCursorFromLine(options, inputLineNo, outputLineNo, input) { var cursorX = input.indexOf("|"); if (cursorX !== -1) { if (options.cursorX) { throw error(inputLineNo, "only one cursor allowed. cursor already found at line", options.cursorLine); } var clean = input.split("|").join(""); if (clean.length < input.length - 1) { throw error(inputLineNo, "only one cursor allowed"); } input = clean; options.cursorX = cursorX; options.cursorLine = outputLineNo; } return input; } function initialDiffState() { var diff = { code: null, // the code that the diff line is annotating codeLineNo: null, prevCode: null, // the code that the previous diff line annotated prevCodeLineNo: null, prevNewlineChar: '', // the previous diff line's newline annotation ('', '-', or '+') merge: null, // the code should be merged with the next code line? mergeOffset: 0 // code growth after merge }; return diff; } function parseDiffLine(options, inputLineNo, input, diff) { // lines with only -/+ chars are considered diff lines. var looseMatch = input.match(/^\s*[-+]+[-+\s]*$/); if (!looseMatch) { return; } var match = input.match(/^((\s*)(-*)(\+*))\s*$/); if (!match) { throw error(inputLineNo, " diff chars must be adjacent with '-'s before '+'s."); } var x = match[2].length; if (!diff.code) { throw error(inputLineNo, " diff lines must be directly below a code line"); } // "open" means current and previous diffs can be connected var prevDiffOpen = ( diff.prevCode && diff.prevNewlineChar !== '' && (diff.prevCodeLineNo === diff.codeLineNo || diff.prevCodeLineNo+1 === diff.codeLineNo) ); var currDiffOpen = x === 0; var change; if (prevDiffOpen && currDiffOpen) { if (diff.prevNewlineChar === '+' && input[0] === '-') { throw error(inputLineNo, "diff line starts with '-', which cannot come after '+' which previous diff line ends with"); } } else { // create a new change since diffs are not connected options.changes = options.changes || []; options.changes.push({ lineNo: diff.codeLineNo, x: x + diff.mergeOffset, oldText: '', newText: '' }); } // get the current active change change = options.changes[options.changes.length-1]; if (match[1].length > diff.code.length+1) { throw error(inputLineNo, "diff line can only extend one character past the previous line length (to annotate the 'newline' char)"); } x += diff.mergeOffset; var oldLen = match[3].length; var newLen = match[4].length; var oldX = x; var newX = x+oldLen; var len = oldLen + newLen; var xEnd = x+len-1; if (options.cursorLine === diff.codeLineNo) { if (x <= options.cursorX && options.cursorX < x+len) { throw error(inputLineNo, "cursor cannot be over a diff annotation"); } else if (options.cursorX < x) { x--; oldX--; newX--; } else { options.cursorX -= oldLen; } } var newlineChar = (diff.code.length === xEnd ? input.charAt(xEnd) : ''); var oldText = diff.code.substring(oldX, oldX+oldLen) + (newlineChar === '-' ? '\n' : ''); var newText = diff.code.substring(newX, newX+newLen) + (newlineChar === '+' ? '\n' : ''); change.oldText += oldText; change.newText += newText; // update diff state diff.prevCode = diff.code; diff.prevCodeLineNo = diff.codeLineNo; diff.merge = newlineChar === '-'; diff.prevNewlineChar = newlineChar; return replaceWithinString(diff.code, oldX, oldX+oldLen, ''); } function handlePostDiffLine(options, inputLineNo, outputLineNo, outputLines, output, diff) { var j = outputLineNo; if (diff.merge) { diff.mergeOffset = outputLines[j-1].length; if (options.cursorLine === j) { options.cursorLine = j-1; options.cursorX += diff.mergeOffset; } outputLines[j-1] += output; } else { diff.mergeOffset = 0; outputLines.push(output); } diff.merge = false; diff.codeLineNo = outputLines.length-1; diff.code = outputLines[diff.codeLineNo]; } function _parseInput(text, extras) { extras = extras || {}; var options = {}; if (extras.forceBalance) { options.forceBalance = true; } if (extras.partialResult) { options.partialResult = true; } if (extras.printParensOnly) { options.returnParens = true; } var inputLines = text.split(LINE_ENDING_REGEX); var outputLines = []; var i, j; // input and output line numbers var input, output; // input and output line text var diff = initialDiffState(); for (i=0; i<inputLines.length; i++) { input = inputLines[i]; j = outputLines.length; if (parsePrevCursorLine(options, i, j-1, input)) { continue; } output = parseDiffLine(options, i, input, diff); if (output != null) { outputLines[j-1] = output; delete diff.code; continue; } output = parseCursorFromLine(options, i, j, input); handlePostDiffLine(options, i, j, outputLines, output, diff); } return { text: outputLines.join("\n"), options: options }; } function parseInput(texts, extras) { if (!Array.isArray(texts)) { return _parseInput(texts, extras); } var changes = []; var resultText; var resultOptions; var i, j; for (i=0; i<texts.length; i++) { var result = _parseInput(texts[i], extras); resultText = result.text; resultOptions = result.options; var newChanges = result.options.changes; if (newChanges) { for (j=0; j<newChanges.length; j++) { changes.push(newChanges[j]); } } } if (changes.length > 0) { resultOptions.changes = changes; } return { text: resultText, options: resultOptions }; } //------------------------------------------------------------------------------ // Output Parser //------------------------------------------------------------------------------ function parseErrorLine(result, inputLineNo, outputLineNo, input) { var match = input.match(/^\s*\^\s*error: ([a-z-]+)\s*$/); if (!match) { return false; } if (result.error) { throw error(inputLineNo, "only one error can be specified"); } var x = input.indexOf("^"); if (result.cursorLine === outputLineNo && result.cursorX < x) { x--; } result.error = { name: match[1], lineNo: outputLineNo, x: x }; return true; } function parseTabStopsLine(result, inputLineNo, outputLineNo, input) { var match = input.match(/^([\^>\s]+)tabStops?\s*$/); if (!match) { return false; } if (result.tabStops) { throw error(inputLineNo, "only one tabStop line can be specified"); } result.tabStops = []; var sym,ch,x,i,tabStop; for (x=0; x<input.length; x++) { sym = input[x]; if (sym === '^') { tabStop = {x:x}; for (i=outputLineNo; i>=0; i--) { ch = result.lines[i][x]; if (isOpenParen(ch)) { tabStop.ch = ch; tabStop.lineNo = i; break; } } if (!tabStop.ch) { throw error(inputLineNo, 'tabStop at ' + x + ' does not point to open paren'); } result.tabStops.push(tabStop); } else if (sym === '>') { tabStop = result.tabStops[result.tabStops.length-1]; if (!tabStop) { throw error(inputLineNo, 'tabStop at ' + x + ' ">" is a dependent on a preceding "^"'); } if (tabStop.argX != null) { throw error(inputLineNo, 'tabStop at ' + x + ' ">" cannot come after another ">"'); } tabStop.argX = x; } } return true; } function parseParenTrailLine(result, inputLineNo, outputLineNo, input) { var match = input.match(/^\s*(\^*)\s*parenTrail\s*$/); if (!match) { return false; } if (result.cursorLine != null) { throw error(inputLineNo, 'parenTrail cannot currently be printed when a cursor is present'); } var trail = match[1]; var startX = input.indexOf("^"); var endX = startX + trail.length; var x; for (x=startX; x<endX; x++) { var ch = result.lines[outputLineNo][x]; if (!isCloseParen(ch)) { throw error(inputLineNo, '^ parenTrail must point to close-parens only'); } } if (!result.parenTrails) { result.parenTrails = []; } result.parenTrails.push({ lineNo: outputLineNo, startX: startX, endX: endX }); return true; } function parseOutput(text) { var lines = text.split(LINE_ENDING_REGEX); var result = { lines: [] }; var i, j; // input and output line numbers var input, output; // input and output line text for (i=0; i<lines.length; i++) { input = lines[i]; j = result.lines.length; if (parseErrorLine(result, i, j-1, input) || parseTabStopsLine(result, i, j-1, input) || parseParenTrailLine(result, i, j-1, input)) { continue; } output = parseCursorFromLine(result, i, j, input); result.lines.push(output); } result.text = result.lines.join("\n"); result.success = result.error == null; delete result.lines; return result; } //------------------------------------------------------------------------------ // Output Printer //------------------------------------------------------------------------------ function printErrorLine(result) { // shift x position back if previous line has cursor before our error caret var x = result.error.x; if (result.cursorLine === result.error.lineNo && result.cursorX <= x) { x++; } return repeatString(" ", x) + "^ error: " + result.error.name; } function printTabStopLine(tabStops) { var i,x; var lastX = -1; var line = ""; var count = 0; for (i=0; i < tabStops.length; i++) { x = tabStops[i].x; line += repeatString(" ", x-lastX-1) + "^"; lastX = x; count++; x = tabStops[i].argX; if (x != null) { line += repeatString(" ", x-lastX-1) + ">"; lastX = x; count++; } } line += " tabStop" + (count > 1 ? "s" :""); return line; } function printParenTrailLine(parenTrail) { return ( repeatString(" ", parenTrail.startX) + repeatString("^", parenTrail.endX - parenTrail.startX) + " parenTrail" ); } function printPadding(lineNo, x, nextLineNo, nextX) { var newlines = nextLineNo - lineNo; var spaces = (nextLineNo > lineNo) ? nextX : nextX - x - 1; return repeatString("\n", newlines) + repeatString(" ", spaces); } function printParen(lineNo, x, opener) { var s = printPadding(lineNo, x, opener.lineNo, opener.x); s += opener.ch; lineNo = opener.lineNo; x = opener.x; s += printParens(lineNo, x, opener.children); var lastChild = opener.children[opener.children.length-1]; if (lastChild) { lineNo = lastChild.closer.lineNo; x = lastChild.closer.x; } s += printPadding(lineNo, x, opener.closer.lineNo, opener.closer.x); s += opener.closer.ch; if (opener.closer.trail) { s += '*'; } return s; } function printParens(lineNo, x, parens) { var s = ""; var i; var opener; for (i=0; i<parens.length; i++) { opener = parens[i]; s += printParen(lineNo, x, opener); lineNo = opener.closer.lineNo; x = opener.closer.x; } return s; } function printOutput(result, extras) { extras = extras || {}; var lines = result.text.split(LINE_ENDING_REGEX); var hasCursor = ( result.cursorX != null && result.cursorLine != null && // could be false if `partialResult` is true and parinfer failed before reaching cursor line result.cursorLine < lines.length ); if (hasCursor) { var line = lines[result.cursorLine]; lines[result.cursorLine] = replaceWithinString(line, result.cursorX, result.cursorX, "|"); } if (result.error) { lines.splice(result.error.lineNo+1, 0, printErrorLine(result)); } else if (extras.printParensOnly) { return printParens(0, 0, result.parens); } else if (extras.printParenTrails && result.parenTrails) { var i, parenTrail; for (i=result.parenTrails.length-1; i>=0; i--) { parenTrail = result.parenTrails[i]; lines.splice(parenTrail.lineNo+1, 0, printParenTrailLine(parenTrail)); } } else if (hasCursor && extras.printTabStops && result.tabStops.length > 0) { lines.splice(result.cursorLine, 0, printTabStopLine(result.tabStops)); } return lines.join("\n"); } //------------------------------------------------------------------------------ // Public API //------------------------------------------------------------------------------ function indentMode(text, extras) { var parsed = parseInput(text, extras); var result = parinfer.indentMode(parsed.text, parsed.options); return printOutput(result, extras); } function parenMode(text, extras) { var parsed = parseInput(text, extras); var result = parinfer.parenMode(parsed.text, parsed.options); return printOutput(result, extras); } function smartMode(text, extras) { var parsed = parseInput(text, extras); var result = parinfer.smartMode(parsed.text, parsed.options); return printOutput(result, extras); } module.exports = { indentMode: indentMode, parenMode: parenMode, smartMode: smartMode, parseInput: parseInput, parseOutput: parseOutput, printOutput: printOutput }; <|start_filename|>site/resources/public/js/lib/jsdiff.externs.js<|end_filename|> var JsDiff = {}; JsDiff.diffChars = function(){}; <|start_filename|>site/src/parinfer_site/toc.cljs<|end_filename|> (ns parinfer-site.toc "Table of contents generator and highlighting" (:require [om.core :as om :include-macros true] [sablono.core :refer-macros [html]] [goog.dom :as gdom])) (defonce state (atom {:sections nil :visible? #{}})) (defn get-sections! "get a list of sections for the table of contents" [] (let [headers (.. js/document (getElementById "app") (querySelectorAll "h2,h3,h4,h5,h6")) result (reduce (fn [{:keys [stack sections] :as result} i] (let [header-elm (aget headers i) section-elm (.-parentElement header-elm) id (.-id section-elm) title (.-textContent header-elm) prefix-elm (gdom/createDom "a" #js {:href (str "#" id) :class "header-link"} "#") level (js/parseInt (subs (.-tagName header-elm) 1)) keep? #(< (:level %) level) stack (vec (take-while keep? stack)) section {:id id :ancestors stack :level level :order i :section-elm section-elm :title title} stack (conj stack section)] (gdom/insertChildAt header-elm prefix-elm 0) {:stack stack :sections (conj sections section)})) {:stack [] :sections []} (range (.-length headers)))] (:sections result))) (defn sibling-section? [current sibling] (= (:ancestors current) (:ancestors sibling))) (defn section-attrs [current active] (let [active? (= active current) ancestor-of-active? (some #{current} (:ancestors active)) child-of-active? (= active (last (:ancestors current))) sibling-of-active-ancestors? (some #(sibling-section? current %) (:ancestors active)) sibling-of-active? (sibling-section? current active) ;; currently unused: show-with-auto-collapse? (or active? ancestor-of-active? child-of-active? sibling-of-active-ancestors? sibling-of-active?)] {:show? true :ancestor-of-active? ancestor-of-active?})) (defn toc-component [{:keys [sections section-map visible?]} owner] (reify om/IRender (render [_this] (let [active (apply min-key :order visible?)] ;; top most visible element is "active" (html [:div (for [{:keys [id level title] :as current} sections] (let [attrs (section-attrs current active) classes (cond-> (str "toc-link toc-level-" level) (= current active) (str " toc-active") (not (:show? attrs)) (str " toc-hide") (:ancestor-of-active? attrs) (str " toc-active-ancestor"))] [:div {:class classes} [:a {:href (str "#" id)} title]]))]))))) (defn track-section-visibility! [] (doseq [s (:sections @state)] (doto (js/scrollMonitor.create (:section-elm s)) (.enterViewport #(swap! state update :visible? conj s)) (.exitViewport #(swap! state update :visible? disj s))))) (defn init! [] (when-not (:sections @state) (swap! state assoc :sections (get-sections!)) (track-section-visibility!) (om/root toc-component state {:target (js/document.getElementById "toc")}))) <|start_filename|>lib/test/cases.js<|end_filename|> //---------------------------------------------------------------------- // Compile tests from Markdown to JSON //---------------------------------------------------------------------- require("./cases/build.js").buildAll(); var indentCases = require("./cases/indent-mode.json"); var parenCases = require("./cases/paren-mode.json"); var smartCases = require("./cases/smart-mode.json"); //---------------------------------------------------------------------- // STRUCTURE TEST // Diff the relevant result properties. //---------------------------------------------------------------------- var parinfer = require("../parinfer.js"); var assert = require("assert"); function assertStructure(actual, expected, description) { assert.strictEqual(actual.text, expected.text); assert.strictEqual(actual.success, expected.success); assert.strictEqual(actual.cursorX, expected.cursorX); assert.strictEqual(actual.cursorLine, expected.cursorLine); assert.strictEqual(actual.error == null, expected.error == null); if (actual.error) { // NOTE: we currently do not test 'message' and 'extra' assert.strictEqual(actual.error.name, expected.error.name); assert.strictEqual(actual.error.lineNo, expected.error.lineNo); assert.strictEqual(actual.error.x, expected.error.x); } if (expected.tabStops) { assert.strictEqual(actual.tabStops == null, false); var i; for (i=0; i<actual.tabStops.length; i++) { assert.strictEqual(actual.tabStops[i].lineNo, expected.tabStops[i].lineNo); assert.strictEqual(actual.tabStops[i].x, expected.tabStops[i].x); assert.strictEqual(actual.tabStops[i].ch, expected.tabStops[i].ch); assert.strictEqual(actual.tabStops[i].argX, expected.tabStops[i].argX); } } if (expected.parenTrails) { assert.deepEqual(actual.parenTrails, expected.parenTrails); } } function testStructure(testCase, mode) { var expected = testCase.result; var text = testCase.text; var options = testCase.options; var actual, actual2, actual3; // We are not yet verifying that the returned paren tree is correct. // We are simply setting it to ensure it is constructed in a way that doesn't // throw an exception. options.returnParens = true; it('should generate the correct result structure', function() { switch (mode) { case "indent": actual = parinfer.indentMode(text, options); break; case "paren": actual = parinfer.parenMode(text, options); break; case "smart": actual = parinfer.smartMode(text, options); break; } assertStructure(actual, expected); // FIXME: not checking paren trails after this main check // (causing problems, and not a priority at time of writing) if (actual.parenTrails) { delete actual.parenTrails; } }); if (expected.error || expected.tabStops || expected.parenTrails || testCase.options.changes) { return; } it('should generate the same result structure on idempotence check', function() { var options2 = { cursorX: actual.cursorX, cursorLine: actual.cursorLine }; switch (mode) { case "indent": actual2 = parinfer.indentMode(actual.text, options2); break; case "paren": actual2 = parinfer.parenMode(actual.text, options2); break; case "smart": actual2 = parinfer.smartMode(actual.text, options2); break; } assertStructure(actual2, actual); }); it('should generate the same result structure on cross-mode check', function() { var hasCursor = expected.cursorX != null; if (!hasCursor) { switch (mode) { case "indent": actual3 = parinfer.parenMode(actual.text); break; case "paren": actual3 = parinfer.indentMode(actual.text); break; case "smart": actual3 = parinfer.parenMode(actual.text); break; } assertStructure(actual3, actual); } }); } //---------------------------------------------------------------------- // STRING TESTS // Diff the annotated text instead of the data for easy reading. // (requires extra parser/printer code that we may not want to port) //---------------------------------------------------------------------- var parinferTest = require("../test.js"); function testString(testCase, mode) { var expected = testCase.result; var source = testCase.source; var prettyOptions = { printTabStops: expected.tabStops, printParenTrails: expected.parenTrails }; var pretty, pretty2, pretty3; it('should generate the correct annotated output', function() { switch (mode) { case "indent": pretty = parinferTest.indentMode(source.in, prettyOptions); break; case "paren": pretty = parinferTest.parenMode(source.in, prettyOptions); break; case "smart": pretty = parinferTest.smartMode(source.in, prettyOptions); break; } assert.strictEqual(pretty, source.out, "\n\nINPUT:\n" + source.in + "\n"); }); if (expected.error || expected.tabStops || expected.parenTrails || testCase.options.changes) { return; } it('should generate the same annotated output on idempotence check', function() { switch (mode) { case "indent": pretty2 = parinferTest.indentMode(pretty, prettyOptions); break; case "paren": pretty2 = parinferTest.parenMode(pretty, prettyOptions); break; case "smart": pretty2 = parinferTest.smartMode(pretty, prettyOptions); break; } assert.strictEqual(pretty2, pretty); }); it('should generate the same annotated output on cross-mode check', function() { var hasCursor = expected.cursorX != null; if (!hasCursor) { switch (mode) { case "indent": pretty3 = parinferTest.parenMode(pretty, prettyOptions); break; case "paren": pretty3 = parinferTest.indentMode(pretty, prettyOptions); break; case "smart": pretty3 = parinferTest.parenMode(pretty, prettyOptions); break; } assert.strictEqual(pretty3, pretty); } }); } //---------------------------------------------------------------------- // Test execution order //---------------------------------------------------------------------- function runTest(testCase, mode, filename) { describe(filename + ":" + testCase.source.lineNo, function(){ testString(testCase, mode); testStructure(testCase, mode); }); } describe("Indent Mode cases from markdown", function(){ for (var i=0; i<indentCases.length; i++) { runTest(indentCases[i], "indent", "cases/indent-mode.md"); } }); describe("Paren Mode cases from markdown", function(){ for (var i=0; i<parenCases.length; i++) { runTest(parenCases[i], "paren", "cases/paren-mode.md"); } }); describe("Smart Mode cases from markdown", function(){ for (var i=0; i<smartCases.length; i++) { runTest(smartCases[i], "smart", "cases/smart-mode.md"); } }); <|start_filename|>site/resources/public/css/2017.css<|end_filename|> * { box-sizing: border-box; } body { font-family: "Open Sans", Arial, freesans, sans-serif; color: #555; background: #F7F7F7; margin: 0; } a.header-link { color: #CCC; position: absolute; left: -1em; border-bottom: 0; } #controls { position: fixed; right: 0; top: 0; background-color: rgba(0,255,255,0.3); margin: 0; padding: 20px; } .interact { padding: 20px; background: #E7EAE9; border-radius: 8px; margin: 32px 0; } .interact img { float: left; height: 58px; margin-right: 20px; } .interact:after { content:''; display:block; clear: both; } .paredit-table { border-collapse: collapse; } .paredit-table th, .paredit-table td { padding: 14px; border: 1px solid #cecece; background: #fefefe; vertical-align: top; } .paredit-table th { color: #888; font-style: italic; background: none; } h1, h2, h3, h4, h5, h6 { color: #222; margin-top:0; margin-bottom: 20px; position: relative; } h1 { margin: 32px 0; text-align: center; font-size: 48px; font-weight: 200; } h1 em { text-decoration: none; font-style: normal; opacity: 0.3; } .subtitle { text-align: center; font-size: 20px; font-weight: bold; margin-top: -18px; margin-bottom: 32px; } .subtitle em { color: #111; border-bottom: 1px solid #111; } .features { color: #888; list-style-type: square; } a { border-bottom: 1px solid #CC3385; color: #CC3385; } a:link, a:visited, a:hover, a:active { text-decoration: none; } p, li { line-height: 1.7em; color: #222; } .sidebar { width: 300px; position: fixed; left: 0; top: 0; padding-left: 20px; padding-bottom: 32px; height: 100%; border-right: 1px solid #DDD; background-color: #f1f1f1; overflow-y: auto; } .credits { font-size: 0.8em; text-align: center; margin-top: -20px; margin-bottom: 20px; } .credits a { opacity: 0.5; color: #333; border-bottom: 0; } #app { display: flex; align-items: center; flex-direction: column; } .wrapper { margin:0; width: 100%; } .wrapper.fold { background: rgba(255, 237, 170, 0.87); border: 0; } .wrapper.fold p { text-align: center; } .wrapper.fold .interact { background: #f7f7f7; border: 1px solid #dedede; } .wrapper.fold .title { font-weight: bold; font-style: italic; } section { width: 862px; margin: 0 auto; padding: 70px; } .wrapper:first-child > section { margin-top: 0; padding-top: 0; border-top: 0; } .caption { padding-top: 20px; margin-bottom: 10px; margin-left: 5px; color: #888; } code { font-family: Menlo, Consolas, 'DejaVu Sans Mono', monospace; font-size: 16px; } .CodeMirror { font-family: Menlo, Consolas, 'DejaVu Sans Mono', monospace; background: #FEFEFE; border: 1px solid #EEE; padding: 5px; margin-bottom: 20px; } .cm-bracket.cm-eol { opacity: 0.4; } .two-col { } .col { float:left; width: 350px; margin-right: 10px; } .two-col:after { content:''; display:block; clear: both; } #cm-code-intro-indent { height: 130px; } #cm-code-intro-snap { height: 130px; } #cm-code-intro-safeguards { height: 130px; } #cm-code-intro-compromise { height: 130px; } #cm-code-inspect span.cm-keyword, #cm-code-inspect span.cm-variable, #cm-code-inspect span.cm-builtin, #cm-code-inspect span.cm-string, #cm-code-inspect span.cm-def, #cm-code-inspect span.cm-atom, #cm-code-inspect span.cm-number, #cm-code-inspect span.cm-comment { opacity: 0.15; color: #000; } .removed { background: #FFBEBE; } .kept { background: #FFE8B0; } .inserted { background: #AAFFC2; } p.centered { text-align: center; } a.img-link { border-bottom: 0; } blockquote.aside { border-left: 5px solid #ddd; margin: 0; margin-top: 60px; padding-left: 20px; opacity: 0.8; } .side-point { font-style: italic; color: #BBB; } td .side-point { margin-top:5px; } .warning { padding: 20px; border-radius: 5px; background: #FFFF7B; } .warning-title { font-weight: bold; margin-bottom: 10px; } .warning-body { margin-left: 34px; color: #333; } .green { color: #63CA63; } .red { color: #E84545; } .question { font-weight: bold; } .question i.fa { color: #5380C7; } .answer { margin-left: 22px; } i.fa { margin-right: 5px; } #cm-code-editor { height: auto; float: left; width: 50%; } #debug-state { overflow-x: auto; width: 50%; white-space: pre; } .state-table { margin-top: 6px;; font: 14px Menlo; } .state-table td { margin: 0; padding: 0px 10px; height: 17px; } .state-table .line-no { opacity: 0.5; } .state-table .line-dy { text-align: right; } .state-table .active-line { background: #FF0; } .gear { opacity: 0.3; transition: opacity 0.2s; } .gear.powered { opacity: 0.8; } .gear.auto-indent-gear { opacity: 0.8; } .gear.auto-indent-gear.invisible { opacity: 0; } .parinfer-gear { opacity: 0.15; } .gearbox { margin-bottom: 80px; } .lego-img { width: 100%; border: 1px solid #EEE; } .math-page { background: #fefefe; border: 1px solid #EEE; padding: 30px; font-family: "Computer Modern Serif"; font-size: 18px; } .math-page ul li { list-style-type: none; } .math-page li { margin-bottom: 5px; } .where-x { display: block; margin: 0 auto; width: 250px; } .math-page .MathJax { font-size: 20px; } .math-page .side-note { float: right; font-style: italic; font-size: 0.8em; color: #BBB; } .only-mobile { display: none; } .parinfer-error { background: #FFBEBE; color: black !important; } body.locus .CodeMirror { line-height: 22px; } .parinfer-locus-paren { visibility: hidden; } .parinfer-locus { opacity: 0.1; pointer-events: none; } <|start_filename|>lib/sandbox.js<|end_filename|> // // Want to know how I quickly tested the latest feature? This is where I do it. // // I have full tests for things, but this file represents a transient sandbox, // an ephemeral space for my latest manual tests for things. // const parinferTest = require('./test'); const parinfer = require('./parinfer'); <|start_filename|>site/resources/public/js/lib/scrollMonitor.externs.js<|end_filename|> /** * @constructor */ var ElementWatcher = function(){}; ElementWatcher.prototype.enterViewport = function(){}; ElementWatcher.prototype.exitViewport = function(){}; ElementWatcher.prototype.isInViewport = function(){}; var scrollMonitor = {}; /** * @return {ElementWatcher} */ scrollMonitor.create = function(){}; scrollMonitor.recalculateLocations = function(){}; <|start_filename|>site/src/parinfer_site/editor_support.cljs<|end_filename|> (ns parinfer-site.editor-support "Connects parinfer mode functions to CodeMirror" (:require [clojure.string :as string :refer [join]] [parinfer-site.parinfer :refer [smart-mode indent-mode paren-mode]] [parinfer-site.state :refer [state]])) (defprotocol IEditor "Custom data/methods for a CodeMirror editor." (cm-key [this]) (get-prev-state [this]) (frame-updated? [this]) (set-frame-updated! [this value]) (record-change! [this thing])) <|start_filename|>site/resources/public/2017.html<|end_filename|> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta http-equiv="x-ua-compatible" content="ie=edge"> <title>Parinfer 2017</title> <meta name="description" content="Parinfer - simpler Lisp editing"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="css/fonts.css"> <link rel="stylesheet" href="css/font-awesome-4.4.0.min.css"> <link rel="stylesheet" href="codemirror/lib/codemirror.css"> <link rel="stylesheet" href="css/lib/keys.css"> <link rel="stylesheet" href="css/2017.css"> <link rel="stylesheet" href="css/theme.css"> </head> <body class="no-mathjax"> <div id="app"> <!------------------------------------------------------------------------------------> <section> <h1>Par<em>infer</em></h1> <div class="subtitle"> latest features memo </div> <div class="credits"> <a href="http://twitter.com/shaunlebron">@shaunlebron</a> | <a href="https://github.com/shaunlebron/parinfer">GitHub</a> </div> </section> <!------------------------------------------------------------------------------------> <div class="wrapper fold"> <section id="introduction"> <p> <strong>Hello,</strong> I'd like your feedback on these new experimental features! </p> <p> Please try them below or in <a href="https://atom.io/packages/parinfer">atom-parinfer</a> under the <em>Smart Mode</em> setting. </p> <p> Porting to other editors can begin after we address your feedback! </p> </section> </div> <!------------------------------------------------------------------------------------> <div class="wrapper"> <section> <p> <strong>Smart Mode</strong> </p> <p> It was difficult to remember when to switch between the different modes. </p> <p> <strong>Indent code without disrupting structure below...</strong> </p> <p> So now, indenting a line in the new <em>Smart Mode</em> will actively prevent any change in structure below it. Thanks <a href="https://twitter.com/rgdelato">Ryan</a>! </p> <textarea id="code-intro-smart"> </textarea> <p> <strong>...but you can still indent the old way.</strong> </p> <p> You sometimes need to be able to correct the indentation of a line without regard to the incorrect structure following a bad copy/paste. Thus, you can still indent a line without preserving structure in <em>Smart Mode</em> by selecting the text you are indenting. Thanks <a href="https://twitter.com/SevereOverfl0w">Dominic</a>! </p> <textarea id="code-intro-paste"> </textarea> </div> <div> <div class="caption"><strong>Structural tab-stops</strong> to important points when pressing Tab or Shift+Tab.</div> <textarea id="code-intro-tabstops"> </textarea> </div> <div> <div class="caption"><strong>Structural safeguards</strong> preserve structure below an edit (and waits on cursor to avoid aggression).</div> <textarea id="code-intro-safeguards"> </textarea> </div> <div> <div class="caption"><strong>Compromise on imbalance</strong> by allowing unmatched close-parens (optional) when it is easier to get you want.</div> <textarea id="code-intro-imbalance"> </textarea> </div> </section> </div> </div><!-- end #app --> <div id="controls-container"></div> <script src="codemirror/lib/codemirror.js"></script> <script src="codemirror/addon/selection/active-line.js"></script> <script src="codemirror/addon/edit/matchbrackets.js"></script> <script src="codemirror/mode/javascript/javascript.js"></script> <script src="codemirror/mode/clojure/clojure.js"></script> <script src="codemirror/mode/clojure/clojure-parinfer.js"></script> <script src="js/lib/scrollMonitor.js"></script> <script> window.parinfer_2017 = true; </script> <script src="parinfer.js"></script> <script src="js/lib/raphael.min.js"></script> <script src="js/lib/parinfer-codemirror.js"></script> <script src="js/compiled/parinfer-site.js"></script> </body> </html> <|start_filename|>site/src/parinfer_site/gears.cljs<|end_filename|> (ns parinfer-site.gears "Animated gears, using https://github.com/liabru/gears-d3-js" (:require-macros [cljs.core.async.macros :refer [go go-loop]]) (:require [cljs.core.async :refer [<! timeout chan alts! close!]] goog.Uri)) (def default-options {:radius 16 :hole-radius 0.4 :addendum 8 :dedendum 3 :thickness 0.7 :profile-slope 0.5}) (defn caption-side-attrs [gear side] (let [datum (.datum gear) r (aget datum "outsideRadius") pad 10 r (+ r pad) [x y] ({:top [0 (- r)] :bottom [0 r] :right [r 0] :left [(- r) 0]} side) anchor ({:top "middle" :bottom "middle" :right "start" :left "end"} side) baseline ({:top "alphabetical" :bottom "hanging" :right "middle" :left "middle"} side)] {:x x :y y :anchor anchor :baseline baseline})) (defn add-gear-caption! [gear {:keys [text side]}] (let [{:keys [x y anchor baseline]} (caption-side-attrs gear side)] (-> gear (.append "text") (.attr "text-anchor" anchor) (.attr "dominant-baseline" baseline) (.attr "x" x) (.attr "y" y) (.text text)))) (defn make-gear [svg drag-behavior {:keys [factor x y angle classes caption addendum dedendum thickness profile-slope hole-radius] :as opts}] (let [radius (/ factor 2) teeth (/ radius 4) inner-radius (- radius addendum dedendum) hole-radius (if (> factor 96) (+ (* inner-radius 0.5) (* inner-radius 0.5 hole-radius)) (* inner-radius hole-radius)) js-opts #js {:radius radius :teeth teeth :x x :y y :angle angle :holeRadius hole-radius :addendum addendum :dedendum dedendum :thickness thickness :profileSlope profile-slope} gear (js/Gear.create svg js-opts)] ;; NOTE: to allow repositioning of the gears, uncomment this: #_(.call gear drag-behavior) (doseq [c classes] (.classed gear c true)) (when caption (add-gear-caption! gear caption)) gear)) (defn tick-svg! [svg] (-> svg (.selectAll ".gear-path") (.attr "transform" (fn [d] (set! (.-angle d) (+ (.-angle d) (.-speed d))) (let [degrees (* (.-angle d) (/ 180 Math/PI))] (str "rotate(" degrees ")")))))) (defn apply-gear-attrs! [gear-obj attrs] (doseq [[k v] attrs] (case k :text (-> gear-obj (.select "text") (.text v)) :power (js/Gear.setPower gear-obj v) :classes (doseq [[style-class enabled?] v] (.classed gear-obj style-class enabled?)) (.attr gear-obj (name k) v)))) (defonce reload-indexes (atom {})) (defn animate-gears! [svg selector gear-map gear-array anim-frames] (let [update-index #(inc (or % 0)) _ (swap! reload-indexes update selector update-index) latest-index #(get @reload-indexes selector) index (latest-index) should-continue? #(= index (latest-index))] (when (seq anim-frames) (go-loop [] (doseq [{:keys [gear-attrs dt]} anim-frames] (doseq [[key- attrs] gear-attrs] (apply-gear-attrs! (gear-map key-) attrs)) (js/Gear.updateGears gear-array) (<! (timeout dt))) (when (should-continue?) (recur))) (js/d3.timer (fn [] (tick-svg! svg) (not (should-continue?))))))) (defn create-gears! [selector {:keys [init-gears mesh-gears anim-frames]} {:keys [width height] :as svg-opts}] (let [container (js/d3.select selector) _ (-> container (.select "svg") (.remove)) svg (-> container (.append "svg") (.attr "viewbox" (str "0 0 " width " " height)) (.attr "width" width) (.attr "height" height)) gear-array #js [] drag-behavior (js/Gear.dragBehaviour gear-array svg) gear-objs (for [[name- opts] init-gears] (make-gear svg drag-behavior (merge default-options opts))) gear-map (zipmap (keys init-gears) gear-objs)] (doseq [g gear-objs] (.push gear-array g)) ;; I think gears are always animating even when offscreen. ;; The "?nogears" query string is a quick fix to disable it if ;; the CPU is choking on some people's machines. (when-not (= "nogears" (.getQuery (goog.Uri. js/document.location))) (animate-gears! svg selector gear-map gear-array anim-frames)))) <|start_filename|>site/resources/public/css/fonts.css<|end_filename|> /*------------------------------------------------------------------------------ * Open Sans *----------------------------------------------------------------------------*/ @font-face { font-family: 'Open Sans'; font-style: normal; font-weight: 300; src: url('../fonts/opensans/OpenSans-Light.eot'); src: local('Open Sans Light'), local('OpenSans-Light'), url('../fonts/opensans/OpenSans-Light.eot') format('embedded-opentype'), url('../fonts/opensans/OpenSans-Light.woff') format('woff'); } @font-face { font-family: 'Open Sans'; font-style: normal; font-weight: 400; src: url('../fonts/opensans/OpenSans.eot'); src: local('Open Sans'), local('OpenSans'), url('../fonts/opensans/OpenSans.eot') format('embedded-opentype'), url('../fonts/opensans/OpenSans.woff') format('woff'); } @font-face { font-family: 'Open Sans'; font-style: normal; font-weight: bold; src: url('../fonts/opensans/OpenSans-Bold.eot'); src: local('Open Sans Bold'), local('OpenSans-Bold'), url('../fonts/opensans/OpenSans-Bold.eot') format('embedded-opentype'), url('../fonts/opensans/OpenSans-Bold.woff') format('woff'); } @font-face { font-family: 'Open Sans'; font-style: italic; font-weight: 300; src: local('Open Sans Light Italic'), local('OpenSansLight-Italic'), url('../fonts/opensans/OpenSansLight-Italic.eot') format('embedded-opentype'), url('../fonts/opensans/OpenSansLight-Italic.woff') format('woff'); } @font-face { font-family: 'Open Sans'; font-style: italic; font-weight: 400; src: local('Open Sans Italic'), local('OpenSans-Italic'), url('../fonts/opensans/OpenSans-Italic.eot') format('embedded-opentype'), url('../fonts/opensans/OpenSans-Italic.woff') format('woff'); } @font-face { font-family: 'Open Sans'; font-style: italic; font-weight: bold; src: local('Open Sans Bold Italic'), local('OpenSans-BoldItalic'), url('../fonts/opensans/OpenSans-BoldItalic.eot') format('embedded-opentype'), url('../fonts/opensans/OpenSans-BoldItalic.woff') format('woff'); } /*------------------------------------------------------------------------------ * Computer Modern Serif *----------------------------------------------------------------------------*/ @font-face { font-family: 'Computer Modern Serif'; src: url('../fonts/serif/cmunrm.eot'); src: url('../fonts/serif/cmunrm.eot?#iefix') format('embedded-opentype'), url('../fonts/serif/cmunrm.woff') format('woff'), url('../fonts/serif/cmunrm.ttf') format('truetype'), url('../fonts/serif/cmunrm.svg#cmunrm') format('svg'); font-weight: normal; font-style: normal; } @font-face { font-family: 'Computer Modern Serif'; src: url('../fonts/serif/cmunbx.eot'); src: url('../fonts/serif/cmunbx.eot?#iefix') format('embedded-opentype'), url('../fonts/serif/cmunbx.woff') format('woff'), url('../fonts/serif/cmunbx.ttf') format('truetype'), url('../fonts/serif/cmunbx.svg#cmunbx') format('svg'); font-weight: bold; font-style: normal; } @font-face { font-family: 'Computer Modern Serif'; src: url('../fonts/serif/cmunti.eot'); src: url('../fonts/serif/cmunti.eot?#iefix') format('embedded-opentype'), url('../fonts/serif/cmunti.woff') format('woff'), url('../fonts/serif/cmunti.ttf') format('truetype'), url('../fonts/serif/cmunti.svg#cmunti') format('svg'); font-weight: normal; font-style: italic; } @font-face { font-family: 'Computer Modern Serif'; src: url('../fonts/serif/cmunbi.eot'); src: url('../fonts/serif/cmunbi.eot?#iefix') format('embedded-opentype'), url('../fonts/serif/cmunbi.woff') format('woff'), url('../fonts/serif/cmunbi.ttf') format('truetype'), url('../fonts/serif/cmunbi.svg#cmunbi') format('svg'); font-weight: bold; font-style: italic; } <|start_filename|>lib/test/cases/build.js<|end_filename|> var fs = require("fs"); var parinferTest = require("../../test.js"); //------------------------------------------------------------------------------ // Result Data //------------------------------------------------------------------------------ function getInitialResult() { var result = { cases: [], currLabel: null, // "in" or "out" currCase: getInitialCase() }; Object.preventExtensions(result); return result; } function getInitialCase() { var testCase = { "in": [], "out": [] }; Object.preventExtensions(testCase); return testCase; } function getInitialCaseBlock(fileLineNo) { // for testCase.in or testCase.out return { "fileLineNo": fileLineNo, "fileText": "" }; } function finalizeCase(testCase) { let text, options, result; const inBlocks = testCase.in; const outBlock = testCase.out[testCase.out.length-1]; try { const input = parinferTest.parseInput(inBlocks.map(b => b.fileText)); text = input.text; options = input.options; } catch (e) { console.log(); console.log("error at input block, line " + block.fileLineNo + ":"); console.log(); console.log(block.fileText); console.log(); throw e; } try { result = parinferTest.parseOutput(outBlock.fileText); } catch (e) { console.log(); console.log("error at output block, line " + outBlock.fileLineNo + ":"); console.log(); console.log(outBlock.fileText); console.log(); throw e; } return { // test input text: text, options: options, // test output result: result, // original test source source: { lineNo: inBlocks[0].fileLineNo, in: inBlocks.map(b => b.fileText), out: outBlock.fileText } }; } //------------------------------------------------------------------------------ // Error Handling //------------------------------------------------------------------------------ function error(fileLineNo, msg) { console.error("error at test-case line #" + (fileLineNo+1) + ": " + msg); process.exit(1); } //------------------------------------------------------------------------------ // Test case parsing //------------------------------------------------------------------------------ function parseLine_endBlock(result, fileLineNo, line) { if (result.currLabel === null) { error(fileLineNo, "opening block must have a name: 'in' or 'out'."); } var isTestCaseDone = (result.currCase.out.length !== 0); if (isTestCaseDone) { result.cases.push(finalizeCase(result.currCase)); result.currLabel = null; result.currCase = getInitialCase(); } else { result.currLabel = null; } } function parseLine_startBlock(result, fileLineNo, line) { if (result.currLabel !== null) { error(fileLineNo, "must close previous block '" + result.currLabel + "' before starting new one."); } var label = line.substring("```".length); if (label !== "in" && label !== "out") { error(fileLineNo, "block name '" + label + "' must be either 'in' or 'out'."); } if (label === "in" && result.currCase.out.length > 0) { error(fileLineNo, "'in' blocks must come before the 'out' block."); } if (label === "out" && result.currCase.in.length === 0) { error(fileLineNo, "must include an 'in' block before an 'out' block."); } if (label === "out" && result.currCase.out.length > 0) { error(fileLineNo, "only one 'out' block allowed."); } result.currLabel = label; const blocks = result.currCase[label]; const newBlock = getInitialCaseBlock(fileLineNo); blocks.push(newBlock); } function parseLine_insideBlock(result, fileLineNo, line) { const blocks = result.currCase[result.currLabel]; const block = blocks[blocks.length-1]; if (block.fileText) { block.fileText += "\n"; } block.fileText += line; } function parseLine_default(result, fileLineNo, line) { return result; } function parseLine(result, fileLineNo, line) { var f; if (line === "```") { f = parseLine_endBlock; } else if (line.startsWith("```")) { f = parseLine_startBlock; } else if (result.currLabel !== null) { f = parseLine_insideBlock; } else { f = parseLine_default; } return f(result, fileLineNo, line); } function parseText(text) { var lines = text.split("\n"); var result = getInitialResult(); var i; for (i=0; i<lines.length; i++) { parseLine(result, i, lines[i]); } if (result.currLabel !== null) { error("EOF", "code block not closed"); } if (result.currCase.in.length > 0 || result.currCase.out.length > 0) { error("EOF", "test case 'out' block not completed"); } return result.cases; } //------------------------------------------------------------------------------ // JSON builder //------------------------------------------------------------------------------ var casesPath = __dirname; function buildJson(name) { // JSON.stringify(data, null, " "); var inFile = casesPath + "/" + name + ".md"; var outFile = casesPath + "/" + name + ".json"; var inText = fs.readFileSync(inFile, "utf8"); console.log( " compiling " + name + ".md" + " --> " + name + ".json" ); var cases = parseText(inText); var outText = JSON.stringify(cases, null, " "); fs.writeFileSync(outFile, outText); } function buildAll() { console.log("\nReading test cases described in Markdown and compiling to JSON..."); buildJson("indent-mode"); buildJson("paren-mode"); buildJson("smart-mode"); console.log(); } //------------------------------------------------------------------------------ // Exports and Entry //------------------------------------------------------------------------------ // export api exports.buildAll = buildAll; // allow running this file directly with Node if (require.main === module) { buildAll(); } <|start_filename|>lib/test/perf.js<|end_filename|> var parinfer = require("../parinfer.js"); var path = require("path"); var fs = require("fs"); function timeProcess(filename, text, options) { var numChars = text.length; var lines = text.split("\n"); console.log("Processing",filename,":", lines.length, "lines,", numChars, "chars"); console.time("indent"); parinfer.indentMode(text, options); console.timeEnd("indent"); console.time("paren"); parinfer.parenMode(text, options); console.timeEnd("paren"); console.time("smart"); parinfer.smartMode(text, options); console.timeEnd("smart"); console.log(); } var perfDir = path.resolve(__dirname, "perf"); var files = fs.readdirSync(perfDir); var i; for (i=0; i<files.length; i++) { var filename = files[i]; var fullpath = path.resolve(perfDir, filename); var text = fs.readFileSync(fullpath, "utf8"); timeProcess(filename, text, {}); } <|start_filename|>site/src/parinfer_site/parinfer.cljs<|end_filename|> (ns parinfer-site.parinfer) (defn major-version [] (aget js/window "parinfer" "version" "0")) (defn- convert-changed-line [e] {:line-no (aget e "lineNo") :line (aget e "line")}) (defn- convert-error [e] (when e {:name (aget e "name") :message (aget e "message") :line-no (aget e "lineNo") :x (aget e "x") :extra (when-let [extra (aget e "extra")] {:name (aget extra "name") :line-no (aget extra "lineNo") :x (aget extra "x")})})) (defn- convert-result [result] {:text (aget result "text") :cursor-x (aget result "cursorX") :success? (aget result "success") :changed-lines (mapv convert-changed-line (aget result "changedLines")) :error (convert-error (aget result "error"))}) (defn- convert-options [options] #js {:cursorX (:cursor-x options) :cursorLine (:cursor-line options) :prevCursorX (:prev-cursor-x options) :prevCursorLine (:prev-cursor-line options) :changes (clj->js (:changes options)) :forceBalance (:force-balance options)}) (def smart-mode* (aget js/window "parinfer" "smartMode")) (def indent-mode* (aget js/window "parinfer" "indentMode")) (def paren-mode* (aget js/window "parinfer" "parenMode")) (defn smart-mode ([text] (convert-result (smart-mode* text))) ([text options] (convert-result (smart-mode* text (convert-options options))))) (defn indent-mode ([text] (convert-result (indent-mode* text))) ([text options] (convert-result (indent-mode* text (convert-options options))))) (defn paren-mode ([text] (convert-result (paren-mode* text))) ([text options] (convert-result (paren-mode* text (convert-options options))))) <|start_filename|>site/src/parinfer_site/util.clj<|end_filename|> (ns parinfer-site.util) ; Case 1: Show the state of a bunch of variables. ; ; > (inspect a b c) ; ; a => 1 ; b => :foo-bar ; c => ["hi" "world"] ; ; Case 2: Print an expression and its result. ; ; > (inspect (+ 1 2 3)) ; ; (+ 1 2 3) => 6 ; (defn- inspect-1 [expr] `(let [result# ~expr] (js/console.info (str (pr-str '~expr) " => " (pr-str result#))) result#)) (defmacro inspect [& exprs] `(do ~@(map inspect-1 exprs)))
parinfer/parinfer
<|start_filename|>src/Interceptors/InstanceInterceptors/InterfaceInterception/InterfaceInterceptorClassGenerator.cs<|end_filename|>  using System; using System.Collections.Generic; using System.Globalization; using System.Linq; using System.IO; using System.Reflection; using System.Reflection.Emit; using Unity.Interception.Interceptors.TypeInterceptors.VirtualMethodInterception.InterceptingClassGeneration; using Unity.Interception.Properties; using Unity.Interception.Utilities; namespace Unity.Interception.Interceptors.InstanceInterceptors.InterfaceInterception { /// <summary> /// A class used to generate proxy classes for doing interception on /// interfaces. /// </summary> public partial class InterfaceInterceptorClassGenerator { private static readonly AssemblyBuilder AssemblyBuilder; private readonly Type _typeToIntercept; private readonly IEnumerable<Type> _additionalInterfaces; private GenericParameterMapper _mainInterfaceMapper; private FieldBuilder _proxyInterceptionPipelineField; private FieldBuilder _targetField; private FieldBuilder _typeToProxyField; private TypeBuilder _typeBuilder; static InterfaceInterceptorClassGenerator() { byte[] pair; using (MemoryStream ms = new MemoryStream()) { typeof(InterfaceInterceptorClassGenerator) .Assembly .GetManifestResourceStream("Unity.Interception.package.snk") .CopyTo(ms); pair = ms.ToArray(); } AssemblyBuilder = AssemblyBuilder.DefineDynamicAssembly( new AssemblyName("Unity_ILEmit_InterfaceProxies") { KeyPair = new StrongNameKeyPair(pair) }, #if DEBUG_SAVE_GENERATED_ASSEMBLY AssemblyBuilderAccess.RunAndSave); #else AssemblyBuilderAccess.Run); #endif } /// <summary> /// Create an instance of <see cref="InterfaceInterceptorClassGenerator"/> that /// can construct an intercepting proxy for the given interface. /// </summary> /// <param name="typeToIntercept">Type of the interface to intercept.</param> /// <param name="additionalInterfaces">Additional interfaces the proxy must implement.</param> public InterfaceInterceptorClassGenerator(Type typeToIntercept, IEnumerable<Type> additionalInterfaces) { var interfaces = additionalInterfaces as Type[] ?? additionalInterfaces.ToArray(); CheckAdditionalInterfaces(interfaces); _typeToIntercept = typeToIntercept; _additionalInterfaces = interfaces; CreateTypeBuilder(); } private static void CheckAdditionalInterfaces(IEnumerable<Type> additionalInterfaces) { if (additionalInterfaces == null) { throw new ArgumentNullException(nameof(additionalInterfaces)); } foreach (var type in additionalInterfaces) { if (type == null) { throw new ArgumentException( Resources.ExceptionContainsNullElement, nameof(additionalInterfaces)); } if (!type.IsInterface) { throw new ArgumentException( string.Format(CultureInfo.CurrentCulture, Resources.ExceptionTypeIsNotInterface, type.Name), nameof(additionalInterfaces)); } if (type.IsGenericTypeDefinition) { throw new ArgumentException( string.Format(CultureInfo.CurrentCulture, Resources.ExceptionTypeIsOpenGeneric, type.Name), nameof(additionalInterfaces)); } } } /// <summary> /// Create the type to proxy the requested interface /// </summary> /// <returns></returns> public Type CreateProxyType() { HashSet<Type> implementedInterfaces = new HashSet<Type>(); int memberCount = new InterfaceImplementation( _typeBuilder, _typeToIntercept, _mainInterfaceMapper, _proxyInterceptionPipelineField, false, _targetField) .Implement(implementedInterfaces, 0); foreach (var @interface in _additionalInterfaces) { memberCount = new InterfaceImplementation( _typeBuilder, @interface, _proxyInterceptionPipelineField, true) .Implement(implementedInterfaces, memberCount); } AddConstructor(); Type result = _typeBuilder.CreateTypeInfo().AsType(); #if DEBUG_SAVE_GENERATED_ASSEMBLY assemblyBuilder.Save("Unity_ILEmit_InterfaceProxies.dll"); #endif return result; } private void AddConstructor() { Type[] paramTypes = Sequence.Collect(_typeToIntercept, typeof(Type)).ToArray(); ConstructorBuilder ctorBuilder = _typeBuilder.DefineConstructor( MethodAttributes.Public, CallingConventions.HasThis, paramTypes); ctorBuilder.DefineParameter(1, ParameterAttributes.None, "target"); ctorBuilder.DefineParameter(2, ParameterAttributes.None, "typeToProxy"); ILGenerator il = ctorBuilder.GetILGenerator(); // Call base class constructor il.Emit(OpCodes.Ldarg_0); il.Emit(OpCodes.Call, ObjectMethods.Constructor); // Initialize pipeline field il.Emit(OpCodes.Ldarg_0); il.Emit(OpCodes.Newobj, InterceptionBehaviorPipelineMethods.Constructor); il.Emit(OpCodes.Stfld, _proxyInterceptionPipelineField); // Initialize the target field il.Emit(OpCodes.Ldarg_0); il.Emit(OpCodes.Ldarg_1); il.Emit(OpCodes.Stfld, _targetField); // Initialize the typeToProxy field il.Emit(OpCodes.Ldarg_0); il.Emit(OpCodes.Ldarg_2); il.Emit(OpCodes.Stfld, _typeToProxyField); il.Emit(OpCodes.Ret); } private void CreateTypeBuilder() { TypeAttributes newAttributes = TypeAttributes.Public | TypeAttributes.Class; ModuleBuilder moduleBuilder = InterceptorClassGenerator.CreateModuleBuilder(AssemblyBuilder); _typeBuilder = moduleBuilder.DefineType(CreateTypeName(), newAttributes); _mainInterfaceMapper = DefineGenericArguments(); _proxyInterceptionPipelineField = InterceptingProxyImplementor.ImplementIInterceptingProxy(_typeBuilder); _targetField = _typeBuilder.DefineField("target", _typeToIntercept, FieldAttributes.Private); _typeToProxyField = _typeBuilder.DefineField("typeToProxy", typeof(Type), FieldAttributes.Private); } private string CreateTypeName() { return "DynamicModule.ns.Wrapped_" + _typeToIntercept.Name + "_" + Guid.NewGuid().ToString("N"); } private GenericParameterMapper DefineGenericArguments() { if (!_typeToIntercept.IsGenericType) { return GenericParameterMapper.DefaultMapper; } Type[] genericArguments = _typeToIntercept.GetGenericArguments(); GenericTypeParameterBuilder[] genericTypes = _typeBuilder.DefineGenericParameters( genericArguments.Select(t => t.Name).ToArray()); for (int i = 0; i < genericArguments.Length; ++i) { genericTypes[i].SetGenericParameterAttributes( genericArguments[i].GenericParameterAttributes & ~GenericParameterAttributes.VarianceMask); var interfaceConstraints = new List<Type>(); foreach (Type constraint in genericArguments[i].GetGenericParameterConstraints()) { if (constraint.IsClass) { genericTypes[i].SetBaseTypeConstraint(constraint); } else { interfaceConstraints.Add(constraint); } } if (interfaceConstraints.Count > 0) { genericTypes[i].SetInterfaceConstraints(interfaceConstraints.ToArray()); } } return new GenericParameterMapper(genericArguments, genericTypes.Cast<Type>().ToArray()); } } }
ENikS/interception
<|start_filename|>src/common/session.h<|end_filename|> #ifndef TRANCE_SRC_COMMON_SESSION_H #define TRANCE_SRC_COMMON_SESSION_H #include <map> #include <string> #include <vector> std::string make_relative(const std::string& from, const std::string& to); namespace trance_pb { class Colour; class PlaylistItem_NextItem; class Session; class System; class Theme; } bool is_image(const std::string& path); bool is_animation(const std::string& path); bool is_font(const std::string& path); bool is_text_file(const std::string& path); bool is_audio_file(const std::string& path); bool is_enabled(const trance_pb::PlaylistItem_NextItem& next_item, const std::map<std::string, std::string>& variables); void search_resources(trance_pb::Session& session, const std::string& root); void search_resources(trance_pb::Theme& theme, const std::string& root); void search_audio_files(std::vector<std::string>& files, const std::string& root); trance_pb::System load_system(const std::string& path); void save_system(const trance_pb::System&, const std::string& path); trance_pb::System get_default_system(); void validate_system(trance_pb::System& session); trance_pb::Session load_session(const std::string& path); void save_session(const trance_pb::Session& session, const std::string& path); trance_pb::Session get_default_session(); void validate_session(trance_pb::Session& session); #endif <|start_filename|>src/common/session.cpp<|end_filename|> #include <common/session.h> #include <common/util.h> #include <algorithm> #include <filesystem> #include <fstream> #pragma warning(push, 0) #include <google/protobuf/text_format.h> #include <common/trance.pb.cc> #pragma warning(pop) namespace { trance_pb::Colour make_colour(float r, float g, float b, float a) { trance_pb::Colour colour; colour.set_r(r / 255); colour.set_g(g / 255); colour.set_b(b / 255); colour.set_a(a / 255); return colour; } std::string split_text_line(const std::string& text) { // Split strings into two lines at the space closest to the middle. This is // sort of ad-hoc. There should probably be a better way that can judge length // and split over more than two lines. auto l = text.length() / 2; auto r = l; while (true) { if (text[r] == ' ') { return text.substr(0, r) + '\n' + text.substr(r + 1); } if (text[l] == ' ') { return text.substr(0, l) + '\n' + text.substr(l + 1); } if (l == 0 || r == text.length() - 1) { break; } --l; ++r; } return text; } void set_default_visual_types(trance_pb::Program& program) { program.clear_visual_type(); auto add = [&](trance_pb::Program::VisualType type_enum) { auto type = program.add_visual_type(); type->set_type(type_enum); type->set_random_weight(1); }; add(trance_pb::Program_VisualType_ACCELERATE); add(trance_pb::Program_VisualType_SLOW_FLASH); add(trance_pb::Program_VisualType_SUB_TEXT); add(trance_pb::Program_VisualType_FLASH_TEXT); add(trance_pb::Program_VisualType_PARALLEL); add(trance_pb::Program_VisualType_SUPER_PARALLEL); add(trance_pb::Program_VisualType_ANIMATION); add(trance_pb::Program_VisualType_SUPER_FAST); } void set_default_program(trance_pb::Session& session, const std::string& name) { auto& program = (*session.mutable_program_map())[name]; set_default_visual_types(program); program.set_global_fps(120); program.set_zoom_intensity(.5f); *program.mutable_spiral_colour_a() = make_colour(255, 150, 200, 50); *program.mutable_spiral_colour_b() = make_colour(0, 0, 0, 50); program.set_reverse_spiral_direction(false); *program.mutable_main_text_colour() = make_colour(255, 150, 200, 224); *program.mutable_shadow_text_colour() = make_colour(0, 0, 0, 192); } void set_default_playlist(trance_pb::Session& session, const std::string& program) { (*session.mutable_playlist())["default"].mutable_standard()->set_program(program); } void validate_colour(trance_pb::Colour& colour) { colour.set_r(std::max(0.f, std::min(1.f, colour.r()))); colour.set_g(std::max(0.f, std::min(1.f, colour.g()))); colour.set_b(std::max(0.f, std::min(1.f, colour.b()))); colour.set_a(std::max(0.f, std::min(1.f, colour.a()))); } void validate_program(trance_pb::Program& program, const trance_pb::Session& session) { for (const auto& deprecated_theme : program.enabled_theme_name()) { auto t = program.add_enabled_theme(); t->set_theme_name(deprecated_theme); t->set_random_weight(1); } program.clear_enabled_theme_name(); uint32_t count = 0; std::string pinned; for (auto& theme : *program.mutable_enabled_theme()) { if (session.theme_map().find(theme.theme_name()) != session.theme_map().end()) { count += theme.random_weight(); if (theme.pinned()) { if (pinned.empty()) { pinned = theme.theme_name(); } else { theme.set_pinned(false); } } } else { theme.set_random_weight(0); theme.set_pinned(false); } } if (!count) { program.clear_enabled_theme(); if (!pinned.empty()) { auto t = program.add_enabled_theme(); t->set_theme_name(pinned); t->set_random_weight(1); } else for (const auto& pair : session.theme_map()) { auto t = program.add_enabled_theme(); t->set_theme_name(pair.first); t->set_random_weight(1); } } count = 0; for (const auto& type : program.visual_type()) { count += type.random_weight(); } if (!count) { set_default_visual_types(program); } program.set_global_fps(std::max(1u, std::min(240u, program.global_fps()))); program.set_zoom_intensity(std::max(0.f, std::min(1.f, program.zoom_intensity()))); validate_colour(*program.mutable_spiral_colour_a()); validate_colour(*program.mutable_spiral_colour_b()); validate_colour(*program.mutable_main_text_colour()); validate_colour(*program.mutable_shadow_text_colour()); } void validate_playlist_item(trance_pb::PlaylistItem& playlist_item, trance_pb::Session& session) { if (!playlist_item.program().empty() || playlist_item.play_time_seconds()) { playlist_item.mutable_standard()->set_program(playlist_item.program()); playlist_item.mutable_standard()->set_play_time_seconds(playlist_item.play_time_seconds()); playlist_item.clear_program(); playlist_item.clear_play_time_seconds(); } if (playlist_item.has_standard()) { auto it = session.program_map().find(playlist_item.standard().program()); if (it == session.program_map().end()) { set_default_program(session, playlist_item.standard().program()); } } if (playlist_item.has_subroutine()) { auto& subroutine = *playlist_item.mutable_subroutine(); for (auto it = subroutine.mutable_playlist_item_name()->begin(); it != subroutine.mutable_playlist_item_name()->end();) { auto jt = session.playlist().find(*it); if (jt == session.playlist().end()) { it = subroutine.mutable_playlist_item_name()->erase(it); } else { ++it; } } } for (auto it = playlist_item.mutable_next_item()->begin(); it != playlist_item.mutable_next_item()->end();) { if (it->random_weight() == 0 || session.playlist().find(it->playlist_item_name()) == session.playlist().end()) { it = playlist_item.mutable_next_item()->erase(it); } else { ++it; } } for (auto& next_item : *playlist_item.mutable_next_item()) { auto variable_it = session.variable_map().find(next_item.condition_variable_name()); if (variable_it == session.variable_map().end()) { next_item.clear_condition_variable_name(); next_item.clear_condition_variable_value(); } else { auto& data = variable_it->second.value(); if (std::find(data.begin(), data.end(), next_item.condition_variable_value()) == data.end()) { next_item.clear_condition_variable_name(); next_item.clear_condition_variable_value(); } } } } void validate_variable(trance_pb::Variable& variable) { if (!variable.value_size()) { variable.add_value("Default"); } bool found_default = false; for (const auto& value : variable.value()) { if (value == variable.default_value()) { found_default = true; } } if (!found_default) { variable.set_default_value(variable.value(0)); } } template <typename T> T load_proto(const std::string& path) { T proto; std::ifstream f{path}; if (f) { std::string str{std::istreambuf_iterator<char>{f}, std::istreambuf_iterator<char>{}}; if (google::protobuf::TextFormat::ParseFromString(str, &proto)) { return proto; } } throw std::runtime_error("couldn't load " + path); } void save_proto(const google::protobuf::Message& proto, const std::string& path) { std::string str; google::protobuf::TextFormat::PrintToString(proto, &str); std::ofstream f{path}; f << str; } std::tr2::sys::path make_relative(const std::tr2::sys::path& from, const std::tr2::sys::path& to) { auto cfrom = std::tr2::sys::canonical(from); auto cto = std::tr2::sys::canonical(to); auto from_it = cfrom.begin(); auto to_it = cto.begin(); while (from_it != cfrom.end() && to_it != cto.end() && *from_it == *to_it) { ++from_it; ++to_it; } if (from_it != cfrom.end()) { return to; } std::tr2::sys::path result = "."; while (to_it != cto.end()) { result.append(*to_it); ++to_it; } return result; } } // anonymous namespace std::string make_relative(const std::string& from, const std::string& to) { return make_relative(std::tr2::sys::path{from}, std::tr2::sys::path{to}).string(); } bool is_image(const std::string& path) { return ext_is(path, "png") || ext_is(path, "bmp") || ext_is(path, "jpg") || ext_is(path, "jpeg"); } bool is_animation(const std::string& path) { // Should really check is_gif_animated(), but it takes far too long. return ext_is(path, "webm") || ext_is(path, "gif"); } bool is_font(const std::string& path) { return ext_is(path, "ttf"); } bool is_text_file(const std::string& path) { return ext_is(path, "txt"); } bool is_audio_file(const std::string& path) { return ext_is(path, "wav") || ext_is(path, "ogg") || ext_is(path, "flac") || ext_is(path, "aiff"); } bool is_enabled(const trance_pb::PlaylistItem_NextItem& next, const std::map<std::string, std::string>& variables) { if (next.condition_variable_name().empty()) { return true; } std::string value; auto it = variables.find(next.condition_variable_name()); if (it != variables.end()) { value = it->second; } return value == next.condition_variable_value(); }; void search_resources(trance_pb::Session& session, const std::string& root) { static const std::string wildcards = "/wildcards/"; auto& themes = *session.mutable_theme_map(); std::tr2::sys::path root_path(root); for (auto it = std::tr2::sys::recursive_directory_iterator(root_path); it != std::tr2::sys::recursive_directory_iterator(); ++it) { if (std::tr2::sys::is_regular_file(it->status())) { auto relative_path = make_relative(root_path, it->path()); auto jt = ++relative_path.begin(); if (jt == relative_path.end()) { continue; } auto theme_name = jt == --relative_path.end() ? wildcards : jt->string(); auto rel_str = relative_path.string(); if (is_font(rel_str)) { themes[theme_name].add_font_path(rel_str); } else if (is_text_file(rel_str)) { std::ifstream f(it->path()); std::string line; while (std::getline(f, line)) { if (!line.length()) { continue; } for (auto& c : line) { c = toupper(c); } themes[theme_name].add_text_line(split_text_line(line)); } } else if (is_animation(rel_str)) { themes[theme_name].add_animation_path(rel_str); } else if (is_image(rel_str)) { themes[theme_name].add_image_path(rel_str); } } } // Merge wildcards theme into all others. for (auto& pair : themes) { if (pair.first == wildcards) { continue; } for (const auto& s : themes[wildcards].image_path()) { pair.second.add_image_path(s); } for (const auto& s : themes[wildcards].animation_path()) { pair.second.add_animation_path(s); } for (const auto& s : themes[wildcards].font_path()) { pair.second.add_font_path(s); } for (const auto& s : themes[wildcards].text_line()) { pair.second.add_text_line(s); } } // Leave wildcards theme if there are no others. themes.erase("default"); if (themes.size() == 1) { themes["default"] = themes[wildcards]; } themes.erase(wildcards); set_default_playlist(session, "default"); auto& program = (*session.mutable_program_map())["default"]; for (auto& pair : themes) { program.add_enabled_theme_name(pair.first); } session.set_first_playlist_item("default"); } void search_resources(trance_pb::Theme& theme, const std::string& root) { std::tr2::sys::path root_path(root); for (auto it = std::tr2::sys::recursive_directory_iterator(root_path); it != std::tr2::sys::recursive_directory_iterator(); ++it) { if (std::tr2::sys::is_regular_file(it->status())) { auto relative_path = make_relative(root_path, it->path()); auto jt = ++relative_path.begin(); if (jt == relative_path.end()) { continue; } auto rel_str = relative_path.string(); if (is_font(rel_str)) { theme.add_font_path(rel_str); } else if (is_animation(rel_str)) { theme.add_animation_path(rel_str); } else if (is_image(rel_str)) { theme.add_image_path(rel_str); } } } } void search_audio_files(std::vector<std::string>& files, const std::string& root) { std::tr2::sys::path root_path(root); for (auto it = std::tr2::sys::recursive_directory_iterator(root_path); it != std::tr2::sys::recursive_directory_iterator(); ++it) { if (std::tr2::sys::is_regular_file(it->status())) { auto relative_path = make_relative(root_path, it->path()); auto jt = ++relative_path.begin(); if (jt == relative_path.end()) { continue; } auto rel_str = relative_path.string(); if (is_audio_file(rel_str)) { files.push_back(rel_str); } } } } trance_pb::System load_system(const std::string& path) { auto system = load_proto<trance_pb::System>(path); validate_system(system); return system; } void save_system(const trance_pb::System& system, const std::string& path) { save_proto(system, path); } trance_pb::System get_default_system() { trance_pb::System system; system.set_enable_vsync(true); system.set_renderer(trance_pb::System::MONITOR); system.mutable_draw_depth()->set_draw_depth(.5f); system.mutable_eye_spacing()->set_eye_spacing(1.f / 16); system.set_image_cache_size(64); system.set_animation_buffer_size(32); system.set_font_cache_size(8); auto& export_settings = *system.mutable_last_export_settings(); export_settings.set_width(1280); export_settings.set_height(720); export_settings.set_fps(30); export_settings.set_length(60); export_settings.set_quality(2); export_settings.set_threads(4); return system; } void validate_system(trance_pb::System& system) { if (!system.has_draw_depth()) { system.mutable_draw_depth()->set_draw_depth(.5f); } system.mutable_draw_depth()->set_draw_depth( std::max(0.f, std::min(1.f, system.draw_depth().draw_depth()))); if (!system.has_eye_spacing()) { system.mutable_eye_spacing()->set_eye_spacing(1.f / 16); } system.mutable_eye_spacing()->set_eye_spacing( std::max(-1.f, std::min(1.f, system.eye_spacing().eye_spacing()))); system.set_image_cache_size(std::max(16u, system.image_cache_size())); system.set_animation_buffer_size(std::max(8u, system.animation_buffer_size())); system.set_font_cache_size(std::max(2u, system.font_cache_size())); } trance_pb::Session load_session(const std::string& path) { auto session = load_proto<trance_pb::Session>(path); validate_session(session); return session; } void save_session(const trance_pb::Session& session, const std::string& path) { save_proto(session, path); } trance_pb::Session get_default_session() { trance_pb::Session session; set_default_playlist(session, "default"); set_default_program(session, "default"); validate_session(session); return session; } void validate_session(trance_pb::Session& session) { if (session.theme_map().empty()) { (*session.mutable_theme_map())["default"]; } if (session.playlist().empty() && session.program_map().empty()) { set_default_playlist(session, "default"); set_default_program(session, "default"); } if (session.playlist().empty()) { set_default_playlist(session, session.program_map().begin()->first); } if (session.program_map().empty()) { set_default_program(session, "default"); } for (auto& pair : *session.mutable_variable_map()) { validate_variable(pair.second); } for (auto& pair : *session.mutable_playlist()) { validate_playlist_item(pair.second, session); } for (auto& pair : *session.mutable_program_map()) { validate_program(pair.second, session); } auto it = session.playlist().find(session.first_playlist_item()); if (it == session.playlist().end()) { session.set_first_playlist_item(session.playlist().begin()->first); } } <|start_filename|>src/creator/export.cpp<|end_filename|> #include <creator/export.h> #include <common/common.h> #include <common/session.h> #include <common/util.h> #include <creator/main.h> #pragma warning(push, 0) #include <common/trance.pb.h> #include <wx/button.h> #include <wx/checkbox.h> #include <wx/filedlg.h> #include <wx/panel.h> #include <wx/sizer.h> #include <wx/slider.h> #include <wx/spinctrl.h> #include <wx/stattext.h> #pragma warning(pop) namespace { const std::string EXPORT_3D_TOOLTIP = "Whether to export side-by-side 3D video."; const std::string WIDTH_TOOLTIP = "Width, in pixels, of the exported video."; const std::string HEIGHT_TOOLTIP = "Height, in pixels, of the exported video."; const std::string FPS_TOOLTIP = "Number of frames per second in the exported video."; const std::string LENGTH_TOOLTIP = "Length, in seconds, of the exported video."; const std::string THREADS_TOOLTIP = "Number of threads to use for rendering the video. " "Increase to make use of all CPU cores."; const std::string QUALITY_TOOLTIP = "Quality of the exported video. 0 is best, 4 is worst. " "Better-quality videos take longer to export."; const std::vector<std::string> EXPORT_FILE_PATTERNS = { "H.264 video (*.h264)|*.h264", "WebM video (*.webm)|*.webm", "JPEG frame-by-frame (*.jpg)|*.jpg", "PNG frame-by-frame (*.png)|*.png", "BMP frame-by-frame (*.bmp)|*.bmp", }; const std::vector<std::string> EXPORT_FILE_EXTENSIONS = { "h264", "webm", "jpg", "png", "bmp", }; } ExportFrame::ExportFrame(CreatorFrame* parent, trance_pb::System& system, const trance_pb::Session& session, const std::string& session_path, const std::string& executable_path) : wxFrame{parent, wxID_ANY, "Export video", wxDefaultPosition, wxDefaultSize, wxCAPTION | wxCLOSE_BOX | wxCLIP_CHILDREN} , _system{system} , _parent{parent} { auto default_path = (executable_path / *--std::tr2::sys::path{session_path}.end()).string(); const auto& settings = system.last_export_settings(); std::tr2::sys::path last_path = settings.path().empty() ? default_path + ".h264" : settings.path(); auto patterns = EXPORT_FILE_PATTERNS; for (std::size_t i = 0; i < patterns.size(); ++i) { for (const auto& ext : EXPORT_FILE_EXTENSIONS) { if (ext_is(patterns[i], ext) && ext_is(last_path.string(), ext)) { std::swap(patterns[0], patterns[i]); } } } std::string pattern_str; bool first = true; for (const auto& p : patterns) { pattern_str += (first ? "" : "|") + p; first = false; } wxFileDialog dialog{parent, "Choose export file", last_path.parent_path().string(), (--last_path.end())->string(), pattern_str, wxFD_SAVE | wxFD_OVERWRITE_PROMPT}; Bind(wxEVT_CLOSE_WINDOW, [&](wxCloseEvent& event) { _parent->ExportClosed(); Destroy(); }); if (dialog.ShowModal() == wxID_CANCEL) { Close(); return; } _path = dialog.GetPath(); bool frame_by_frame = ext_is(_path, "jpg") || ext_is(_path, "png") || ext_is(_path, "bmp"); auto panel = new wxPanel{this}; auto sizer = new wxBoxSizer{wxVERTICAL}; auto top = new wxBoxSizer{wxVERTICAL}; auto bottom = new wxBoxSizer{wxHORIZONTAL}; auto top_inner = new wxStaticBoxSizer{wxVERTICAL, panel, "Export settings for " + _path}; auto quality = new wxBoxSizer{wxHORIZONTAL}; _export_3d = new wxCheckBox{panel, wxID_ANY, "Export 3D"}; _width = new wxSpinCtrl{panel, wxID_ANY}; _height = new wxSpinCtrl{panel, wxID_ANY}; _fps = new wxSpinCtrl{panel, wxID_ANY}; _length = new wxSpinCtrl{panel, wxID_ANY}; _threads = new wxSpinCtrl{panel, wxID_ANY}; _quality = new wxSlider{panel, wxID_ANY, (int) settings.quality(), 0, 4, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_AUTOTICKS | wxSL_VALUE_LABEL}; auto button_export = new wxButton{panel, wxID_ANY, "Export"}; auto button_defaults = new wxButton{panel, wxID_ANY, "Defaults"}; auto button_cancel = new wxButton{panel, wxID_ANY, "Cancel"}; _export_3d->SetToolTip(EXPORT_3D_TOOLTIP); _width->SetToolTip(WIDTH_TOOLTIP); _height->SetToolTip(HEIGHT_TOOLTIP); _fps->SetToolTip(FPS_TOOLTIP); _length->SetToolTip(LENGTH_TOOLTIP); _threads->SetToolTip(THREADS_TOOLTIP); _quality->SetToolTip(QUALITY_TOOLTIP); _width->SetRange(320, 30720); _height->SetRange(240, 17280); _fps->SetRange(1, 120); _length->SetRange(1, 86400); _threads->SetRange(1, 128); _export_3d->SetValue(settings.export_3d()); _width->SetValue(settings.width()); _height->SetValue(settings.height()); _fps->SetValue(settings.fps()); _length->SetValue(settings.length()); _threads->SetValue(settings.threads()); sizer->Add(top, 1, wxEXPAND, 0); sizer->Add(bottom, 0, wxEXPAND, 0); top->Add(top_inner, 1, wxALL | wxEXPAND, DEFAULT_BORDER); top_inner->Add(_export_3d, 0, wxALL, DEFAULT_BORDER); wxStaticText* label = nullptr; label = new wxStaticText{panel, wxID_ANY, "Width:"}; label->SetToolTip(WIDTH_TOOLTIP); top_inner->Add(label, 0, wxALL, DEFAULT_BORDER); top_inner->Add(_width, 0, wxALL | wxEXPAND, DEFAULT_BORDER); label = new wxStaticText{panel, wxID_ANY, "Height:"}; label->SetToolTip(HEIGHT_TOOLTIP); top_inner->Add(label, 0, wxALL, DEFAULT_BORDER); top_inner->Add(_height, 0, wxALL | wxEXPAND, DEFAULT_BORDER); label = new wxStaticText{panel, wxID_ANY, "FPS:"}; label->SetToolTip(FPS_TOOLTIP); top_inner->Add(label, 0, wxALL, DEFAULT_BORDER); top_inner->Add(_fps, 0, wxALL | wxEXPAND, DEFAULT_BORDER); label = new wxStaticText{panel, wxID_ANY, "Length:"}; label->SetToolTip(LENGTH_TOOLTIP); top_inner->Add(label, 0, wxALL, DEFAULT_BORDER); top_inner->Add(_length, 0, wxALL | wxEXPAND, DEFAULT_BORDER); auto qlabel = new wxStaticText{panel, wxID_ANY, "Quality:"}; qlabel->SetToolTip(THREADS_TOOLTIP); top_inner->Add(qlabel, 0, wxALL, DEFAULT_BORDER); auto q0_label = new wxStaticText{panel, wxID_ANY, "Best"}; quality->Add(q0_label, 0, wxALL, DEFAULT_BORDER); quality->Add(_quality, 1, wxALL | wxEXPAND, DEFAULT_BORDER); auto q4_label = new wxStaticText{panel, wxID_ANY, "Worst"}; quality->Add(q4_label, 0, wxALL, DEFAULT_BORDER); top_inner->Add(quality, 0, wxALL | wxEXPAND, DEFAULT_BORDER); auto tlabel = new wxStaticText{panel, wxID_ANY, "Threads:"}; tlabel->SetToolTip(QUALITY_TOOLTIP); top_inner->Add(tlabel, 0, wxALL, DEFAULT_BORDER); top_inner->Add(_threads, 0, wxALL | wxEXPAND, DEFAULT_BORDER); bottom->Add(button_cancel, 1, wxALL, DEFAULT_BORDER); bottom->Add(button_defaults, 1, wxALL, DEFAULT_BORDER); bottom->Add(button_export, 1, wxALL, DEFAULT_BORDER); if (!session.variable_map().empty()) { _configuration.reset(new VariableConfiguration{_system, session, session_path, [] {}, panel}); top->Add(_configuration->Sizer(), 0, wxALL | wxEXPAND, DEFAULT_BORDER); } if (frame_by_frame) { _threads->Enable(false); _quality->Enable(false); q0_label->Enable(false); q4_label->Enable(false); qlabel->Enable(false); tlabel->Enable(false); } panel->SetSizer(sizer); SetClientSize(sizer->GetMinSize()); CentreOnParent(); Show(true); button_export->Bind(wxEVT_COMMAND_BUTTON_CLICKED, [&](wxCommandEvent&) { Export(); Close(); }); button_defaults->Bind(wxEVT_COMMAND_BUTTON_CLICKED, [&](wxCommandEvent&) { ResetDefaults(); }); button_cancel->Bind(wxEVT_COMMAND_BUTTON_CLICKED, [&](wxCommandEvent&) { Close(); }); } void ExportFrame::ResetDefaults() { if (_configuration) { _configuration->ResetDefaults(); } auto defaults = get_default_system().last_export_settings(); _export_3d->SetValue(defaults.export_3d()); _width->SetValue(defaults.width()); _height->SetValue(defaults.height()); _fps->SetValue(defaults.fps()); _length->SetValue(defaults.length()); _quality->SetValue(defaults.quality()); _threads->SetValue(defaults.threads()); } void ExportFrame::Export() { if (_configuration) { _configuration->SaveToSystem(_parent); } auto& settings = *_system.mutable_last_export_settings(); settings.set_path(_path); settings.set_export_3d(_export_3d->GetValue()); settings.set_width(_width->GetValue()); settings.set_height(_height->GetValue()); settings.set_fps(_fps->GetValue()); settings.set_length(_length->GetValue()); settings.set_quality(_quality->GetValue()); settings.set_threads(_threads->GetValue()); _parent->SaveSystem(false); _parent->ExportVideo(_path); } <|start_filename|>src/creator/theme.cpp<|end_filename|> #include <creator/theme.h> #include <common/common.h> #include <common/media/image.h> #include <common/media/streamer.h> #include <common/session.h> #include <creator/item_list.h> #include <creator/main.h> #include <algorithm> #include <ctime> #include <filesystem> #include <iomanip> #include <random> #include <sstream> #include <thread> #pragma warning(push, 0) #include <common/trance.pb.h> #include <wx/button.h> #include <wx/dcclient.h> #include <wx/listctrl.h> #include <wx/radiobut.h> #include <wx/sizer.h> #include <wx/splitter.h> #include <wx/textdlg.h> #include <wx/timer.h> #include <wx/treelist.h> #include <SFML/Graphics.hpp> #pragma warning(pop) namespace { std::mt19937 engine{static_cast<std::mt19937::result_type>(time(0))}; std::string NlToUser(const std::string& nl) { std::string s = nl; std::string r; bool first = true; while (!s.empty()) { auto p = s.find_first_of('\n'); auto q = s.substr(0, p != std::string::npos ? p : s.size()); r += (first ? "" : " / ") + q; first = false; s = s.substr(p != std::string::npos ? 1 + p : s.size()); } return r; } std::string StripUserNls(const std::string& nl) { std::string s = nl; std::string r; bool first = true; while (!s.empty()) { auto p = s.find("\\n"); auto q = s.substr(0, p != std::string::npos ? p : s.size()); r += (first ? "" : "/") + q; first = false; s = s.substr(p != std::string::npos ? 2 + p : s.size()); } return r; } std::string UserToNl(const std::string& user) { std::string s = StripUserNls(user); std::string r; bool first = true; std::replace(s.begin(), s.end(), '\\', '/'); while (!s.empty()) { auto p = s.find_first_of('/'); auto q = s.substr(0, p != std::string::npos ? p : s.size()); while (!q.empty() && q[0] == ' ') { q = q.substr(1); } while (!q.empty() && q[q.size() - 1] == ' ') { q = q.substr(0, q.size() - 1); } if (!q.empty()) { r += (first ? "" : "\n") + q; first = false; } s = s.substr(p != std::string::npos ? 1 + p : s.size()); p = s.find_first_of('/'); } return r; } std::string GetFileSize(const std::string& path) { struct stat stat_buffer; int rc = stat(path.c_str(), &stat_buffer); auto size = rc == 0 ? stat_buffer.st_size : 0; if (size < 1024) { return std::to_string(size) + "B"; } std::stringstream ss; ss << std::fixed << std::setprecision(1); if (size < 1024 * 1024) { ss << static_cast<float>(size) / 1024; return ss.str() + "KB"; } if (size < 1024 * 1024 * 1024) { ss << static_cast<float>(size) / (1024 * 1024); return ss.str() + "MB"; } ss << static_cast<float>(size) / (1024 * 1024 * 1024); return ss.str() + "GB"; } std::vector<std::string> SortedPaths(const trance_pb::Theme& theme) { std::vector<std::string> paths; for (const auto& path : theme.image_path()) { paths.push_back(path); } for (const auto& path : theme.animation_path()) { paths.push_back(path); } for (const auto& path : theme.font_path()) { paths.push_back(path); } std::sort(paths.begin(), paths.end()); return paths; } bool IsUnused(const trance_pb::Session& session, const std::string& path) { for (const auto& pair : session.theme_map()) { const auto& t = pair.second; if (std::find(t.font_path().begin(), t.font_path().end(), path) != t.font_path().end() || std::find(t.image_path().begin(), t.image_path().end(), path) != t.image_path().end() || std::find(t.animation_path().begin(), t.animation_path().end(), path) != t.animation_path().end()) { return false; } } return true; } } class ImagePanel : public wxPanel { public: ImagePanel(wxWindow* parent) : wxPanel{parent, wxID_ANY}, _bitmap{1, 1} { _timer = new wxTimer(this, wxID_ANY); _timer->Start(20); SetBackgroundStyle(wxBG_STYLE_CUSTOM); Bind(wxEVT_TIMER, [&](const wxTimerEvent&) { if (!_streamer || _shutdown) { return; } auto image = _streamer->next_frame(); if (!image) { _streamer->reset(); image = _streamer->next_frame(); } _image = ConvertImage(image); _dirty = true; Refresh(); }, wxID_ANY); Bind(wxEVT_SIZE, [&](const wxSizeEvent&) { _dirty = true; Refresh(); }); Bind(wxEVT_PAINT, [&](const wxPaintEvent&) { wxPaintDC dc{this}; int width = 0; int height = 0; dc.GetSize(&width, &height); if (width && height && _dirty) { wxImage temp_image{width, height}; if (_image) { auto iw = _image->GetWidth(); auto ih = _image->GetHeight(); auto scale = std::min(float(height) / ih, float(width) / iw); auto sw = unsigned(scale * iw); auto sh = unsigned(scale * ih); temp_image.Paste(_image->Scale(sw, sh, wxIMAGE_QUALITY_HIGH), (width - sw) / 2, (height - sh) / 2); } _bitmap = wxBitmap{temp_image}; } dc.DrawBitmap(_bitmap, 0, 0, false); dc.SetFont(*wxNORMAL_FONT); dc.SetTextForeground(*wxWHITE); if (!_info.empty()) { dc.DrawText(std::to_string(_image->GetWidth()) + "x" + std::to_string(_image->GetHeight()) + " [" + _info + "]", 4, 4); } }); } ~ImagePanel() { _timer->Stop(); } void SetAnimation(std::unique_ptr<Streamer> streamer) { _streamer = std::move(streamer); _dirty = true; _frame = 0; Refresh(); } void SetImage(const Image& image) { _image = ConvertImage(image); _streamer.reset(); _dirty = true; _frame = 0; Refresh(); } void SetInfo(const std::string& info) { _info = info; } void Shutdown() { _shutdown = true; } private: std::unique_ptr<wxImage> ConvertImage(const Image& image) { auto ptr = image.get_sf_image(); if (!ptr) { return {}; } auto sf_image = *ptr; std::unique_ptr<wxImage> wx = std::make_unique<wxImage>((int) sf_image.getSize().x, (int) sf_image.getSize().y); for (unsigned y = 0; y < sf_image.getSize().y; ++y) { for (unsigned x = 0; x < sf_image.getSize().x; ++x) { const auto& c = sf_image.getPixel(x, y); wx->SetRGB(x, y, c.r, c.g, c.b); } } return wx; } bool _dirty = true; bool _shutdown = false; std::string _info; std::size_t _frame; std::unique_ptr<wxImage> _image; std::unique_ptr<Streamer> _streamer; wxBitmap _bitmap; wxTimer* _timer; }; ThemePage::ThemePage(wxNotebook* parent, CreatorFrame& creator_frame, trance_pb::Session& session, const std::string& session_path) : wxNotebookPage{parent, wxID_ANY} , _creator_frame{creator_frame} , _session{session} , _session_path{session_path} , _complete_theme{new trance_pb::Theme} , _tree{nullptr} { auto sizer = new wxBoxSizer{wxVERTICAL}; auto splitter = new wxSplitterWindow{this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_THIN_SASH | wxSP_LIVE_UPDATE}; splitter->SetSashGravity(0); splitter->SetMinimumPaneSize(128); auto bottom_panel = new wxPanel{splitter, wxID_ANY}; auto bottom = new wxBoxSizer{wxHORIZONTAL}; auto bottom_splitter = new wxSplitterWindow{bottom_panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_THIN_SASH | wxSP_LIVE_UPDATE}; bottom_splitter->SetSashGravity(0.75); bottom_splitter->SetMinimumPaneSize(128); auto left_panel = new wxPanel{bottom_splitter, wxID_ANY}; auto left = new wxBoxSizer{wxHORIZONTAL}; auto right_panel = new wxPanel{bottom_splitter, wxID_ANY}; auto right = new wxStaticBoxSizer{wxVERTICAL, right_panel, "Text messages"}; auto right_buttons = new wxBoxSizer{wxVERTICAL}; auto left_splitter = new wxSplitterWindow{left_panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_THIN_SASH | wxSP_LIVE_UPDATE}; left_splitter->SetSashGravity(0.5); left_splitter->SetMinimumPaneSize(128); auto leftleft_panel = new wxPanel{left_splitter, wxID_ANY}; auto leftleft = new wxStaticBoxSizer{wxVERTICAL, leftleft_panel, "Included files"}; auto leftleft_row0 = new wxBoxSizer{wxHORIZONTAL}; auto leftleft_row1 = new wxBoxSizer{wxHORIZONTAL}; auto leftleft_row2 = new wxBoxSizer{wxHORIZONTAL}; auto leftright_panel = new wxPanel{left_splitter, wxID_ANY}; auto leftright = new wxStaticBoxSizer{wxVERTICAL, leftright_panel, "Preview"}; _item_list = new ItemList<trance_pb::Theme>{ splitter, *session.mutable_theme_map(), "theme", [&](const std::string& s) { _item_selected = s; auto it = _session.theme_map().find(_item_selected); if (it != _session.theme_map().end()) { _creator_frame.SetStatusText( _item_selected + ": " + std::to_string(it->second.image_path().size()) + " images; " + std::to_string(it->second.animation_path().size()) + " animations; " + std::to_string(it->second.font_path().size()) + " fonts."); } RefreshOurData(); }, std::bind(&CreatorFrame::ThemeCreated, &_creator_frame, std::placeholders::_1), std::bind(&CreatorFrame::ThemeDeleted, &_creator_frame, std::placeholders::_1), std::bind(&CreatorFrame::ThemeRenamed, &_creator_frame, std::placeholders::_1, std::placeholders::_2)}; _tree = new wxTreeListCtrl{leftleft_panel, 0, wxDefaultPosition, wxDefaultSize, wxTL_SINGLE | wxTL_CHECKBOX | wxTL_3STATE | wxTL_NO_HEADER}; _tree->GetView()->SetToolTip( "Images, animations and fonts that are part " "of the currently-selected theme."); _tree->AppendColumn(""); _image_panel = new ImagePanel{leftright_panel}; _image_panel->SetToolTip("Preview of the selected item."); _text_list = new wxListCtrl{right_panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_REPORT | wxLC_NO_HEADER | wxLC_SINGLE_SEL | wxLC_EDIT_LABELS}; _text_list->InsertColumn(0, "Text", wxLIST_FORMAT_LEFT, wxLIST_AUTOSIZE_USEHEADER); _text_list->SetToolTip( "Text messages that are part " "of the currently-selected theme."); _button_new = new wxButton{right_panel, wxID_ANY, "New"}; _button_edit = new wxButton{right_panel, wxID_ANY, "Edit"}; _button_delete = new wxButton{right_panel, wxID_ANY, "Delete"}; _button_open = new wxButton{leftleft_panel, wxID_ANY, "Show in explorer"}; _button_rename = new wxButton{leftleft_panel, wxID_ANY, "Move / rename"}; _button_refresh = new wxButton{leftleft_panel, wxID_ANY, "Refresh directory"}; _button_next_unused = new wxButton{leftleft_panel, wxID_ANY, "Next unused"}; _button_random_unused = new wxButton{leftleft_panel, wxID_ANY, "Random unused"}; _button_next_theme = new wxButton{leftleft_panel, wxID_ANY, "Next in theme"}; _button_show_all = new wxRadioButton{leftleft_panel, wxID_ANY, "All", wxDefaultPosition, wxDefaultSize, wxRB_GROUP}; _button_show_images = new wxRadioButton{leftleft_panel, wxID_ANY, "Images"}; _button_show_animations = new wxRadioButton{leftleft_panel, wxID_ANY, "Animations"}; _button_new->SetToolTip("Create a new text item."); _button_edit->SetToolTip("Edit the selected text item."); _button_delete->SetToolTip("Delete the selected text item."); _button_open->SetToolTip("Open the file in the explorer."); _button_rename->SetToolTip("Move or rename the selected file or directory."); _button_refresh->SetToolTip( "Scan the session directory for available images, animations and fonts."); _button_next_unused->SetToolTip("Jump to the next unused item."); _button_random_unused->SetToolTip("Jump to a random unused item."); _button_next_theme->SetToolTip("Jump to the next item in the current theme."); _button_show_all->SetToolTip("Show all items (images, animations and fonts)."); _button_show_images->SetToolTip("Show images only."); _button_show_animations->SetToolTip("Show animations only."); _button_open->Enable(false); _button_rename->Enable(false); _button_show_all->SetValue(true); _button_show_images->SetValue(false); _button_show_animations->SetValue(false); leftleft->Add(leftleft_row0, 0, wxEXPAND | wxALL, DEFAULT_BORDER); leftleft->Add(_tree, 1, wxEXPAND | wxALL, DEFAULT_BORDER); leftleft->Add(leftleft_row1, 0, wxEXPAND | wxALL, DEFAULT_BORDER); leftleft->Add(leftleft_row2, 0, wxEXPAND | wxALL, DEFAULT_BORDER); leftleft_row0->Add(_button_show_all, 0, wxEXPAND | wxALL, DEFAULT_BORDER); leftleft_row0->Add(_button_show_images, 0, wxEXPAND | wxALL, DEFAULT_BORDER); leftleft_row0->Add(_button_show_animations, 0, wxEXPAND | wxALL, DEFAULT_BORDER); leftleft_row1->Add(_button_open, 1, wxEXPAND | wxALL, DEFAULT_BORDER); leftleft_row1->Add(_button_rename, 1, wxEXPAND | wxALL, DEFAULT_BORDER); leftleft_row1->Add(_button_refresh, 1, wxEXPAND | wxALL, DEFAULT_BORDER); leftleft_row2->Add(_button_next_unused, 1, wxEXPAND | wxALL, DEFAULT_BORDER); leftleft_row2->Add(_button_random_unused, 1, wxEXPAND | wxALL, DEFAULT_BORDER); leftleft_row2->Add(_button_next_theme, 1, wxEXPAND | wxALL, DEFAULT_BORDER); leftleft_panel->SetSizer(leftleft); leftright->Add(_image_panel, 1, wxEXPAND | wxALL, DEFAULT_BORDER); leftright_panel->SetSizer(leftright); left->Add(left_splitter, 1, wxEXPAND, 0); left_splitter->SplitVertically(leftleft_panel, leftright_panel); left_panel->SetSizer(left); right->Add(_text_list, 1, wxEXPAND | wxALL, DEFAULT_BORDER); right->Add(right_buttons, 0, wxEXPAND, 0); right_buttons->Add(_button_new, 0, wxEXPAND | wxALL, DEFAULT_BORDER); right_buttons->Add(_button_edit, 0, wxEXPAND | wxALL, DEFAULT_BORDER); right_buttons->Add(_button_delete, 0, wxEXPAND | wxALL, DEFAULT_BORDER); right_panel->SetSizer(right); bottom->Add(bottom_splitter, 1, wxEXPAND, 0); bottom_splitter->SplitVertically(left_panel, right_panel); bottom_panel->SetSizer(bottom); sizer->Add(splitter, 1, wxEXPAND, 0); splitter->SplitHorizontally(_item_list, bottom_panel); SetSizer(sizer); _text_list->Bind(wxEVT_SIZE, [&](wxSizeEvent&) { _text_list->SetColumnWidth(0, wxLIST_AUTOSIZE_USEHEADER); }, wxID_ANY); _text_list->Bind(wxEVT_LIST_ITEM_SELECTED, [&](wxListEvent& e) { std::string user = _text_list->GetItemText(e.GetIndex()); _current_text_line = UserToNl(user); GenerateFontPreview(); }, wxID_ANY); _text_list->Bind( wxEVT_LIST_END_LABEL_EDIT, [&](wxListEvent& e) { if (e.IsEditCancelled()) { return; } e.Veto(); std::string new_text = e.GetLabel(); new_text = UserToNl(new_text); if (new_text.empty()) { return; } for (int i = 0; i < _text_list->GetItemCount(); ++i) { if (_text_list->GetItemState(i, wxLIST_STATE_SELECTED)) { *(*_session.mutable_theme_map())[_item_selected].mutable_text_line()->Mutable(i) = new_text; } } RefreshOurData(); _current_text_line = new_text; GenerateFontPreview(); _creator_frame.MakeDirty(true); }, wxID_ANY); _button_new->Bind(wxEVT_COMMAND_BUTTON_CLICKED, [&](wxCommandEvent&) { (*_session.mutable_theme_map())[_item_selected].add_text_line("NEW TEXT"); RefreshOurData(); _text_list->SetItemState(_text_list->GetItemCount() - 1, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED); _creator_frame.MakeDirty(true); }); _button_edit->Bind(wxEVT_COMMAND_BUTTON_CLICKED, [&](wxCommandEvent&) { for (int i = 0; i < _text_list->GetItemCount(); ++i) { if (_text_list->GetItemState(i, wxLIST_STATE_SELECTED)) { _text_list->EditLabel(i); return; } } }); _button_delete->Bind(wxEVT_COMMAND_BUTTON_CLICKED, [&](wxCommandEvent&) { int removed = -1; for (int i = 0; i < _text_list->GetItemCount(); ++i) { if (_text_list->GetItemState(i, wxLIST_STATE_SELECTED)) { auto& theme = (*_session.mutable_theme_map())[_item_selected]; theme.mutable_text_line()->erase(i + theme.mutable_text_line()->begin()); removed = i; break; } } RefreshOurData(); if (removed >= 0 && _text_list->GetItemCount()) { _text_list->SetItemState(std::min(_text_list->GetItemCount() - 1, removed), wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED); } _creator_frame.MakeDirty(true); }); _button_open->Bind(wxEVT_COMMAND_BUTTON_CLICKED, [&](wxCommandEvent&) { auto root = std::tr2::sys::path{_session_path}.parent_path().string(); for (const auto& pair : _tree_lookup) { if (pair.second == _tree->GetSelection()) { auto path = root + "\\" + pair.first; _creator_frame.SetStatusText("Opening " + path); wxExecute("explorer /select,\"" + path + "\"", wxEXEC_ASYNC); } } }); _button_rename->Bind(wxEVT_COMMAND_BUTTON_CLICKED, [&](wxCommandEvent&) { auto root = std::tr2::sys::path{_session_path}.parent_path().string(); std::string old_relative_path; for (const auto& pair : _tree_lookup) { if (pair.second == _tree->GetSelection()) { old_relative_path = pair.first; break; } } if (old_relative_path.empty()) { return; } std::unique_ptr<wxTextEntryDialog> dialog{new wxTextEntryDialog( this, "New location (relative to session directory):", "Move / rename", old_relative_path)}; if (dialog->ShowModal() != wxID_OK) { return; } std::string new_relative_path = dialog->GetValue(); if (new_relative_path == old_relative_path) { return; } auto rename_file = [&](const std::string old_abs, const std::string& new_abs) { auto old_path = std::tr2::sys::path{old_abs}; auto new_path = std::tr2::sys::path{new_abs}; std::error_code ec; auto parent = std::tr2::sys::canonical(new_path.parent_path(), ec); if (!std::tr2::sys::is_directory(parent) && (ec || !std::tr2::sys::create_directories(parent))) { wxMessageBox("Couldn't create directory " + parent.string(), "", wxICON_ERROR, this); return false; } bool exists = std::tr2::sys::exists(new_path, ec); if (exists || ec) { wxMessageBox( "Couldn't rename " + old_path.string() + ": " + new_path.string() + " already exists", "", wxICON_ERROR, this); return false; } std::tr2::sys::rename(old_path, new_path, ec); if (ec) { wxMessageBox("Couldn't rename " + old_path.string() + " to " + new_path.string(), "", wxICON_ERROR, this); return false; } for (auto& pair : *session.mutable_theme_map()) { auto& theme = pair.second; auto c = [&](google::protobuf::RepeatedPtrField<std::string>& field) { auto it = std::find(field.begin(), field.end(), make_relative(root, old_abs)); if (it != field.end()) { *field.Add() = make_relative(root, new_abs); } }; c(*theme.mutable_font_path()); c(*theme.mutable_image_path()); c(*theme.mutable_animation_path()); } return true; }; auto old_root = root + "/" + old_relative_path; auto new_root = root + "/" + new_relative_path; if (std::tr2::sys::is_regular_file(old_root)) { rename_file(old_root, new_root); } else { for (auto it = std::tr2::sys::recursive_directory_iterator(old_root); it != std::tr2::sys::recursive_directory_iterator(); ++it) { if (!std::tr2::sys::is_regular_file(it->status())) { continue; } auto rel_rel = make_relative(old_root, it->path().string()); if (!rename_file(old_root + "/" + rel_rel, new_root + "/" + rel_rel)) { break; } } } _creator_frame.RefreshDirectory(); _creator_frame.MakeDirty(true); RefreshOurData(); }); _button_refresh->Bind(wxEVT_COMMAND_BUTTON_CLICKED, [&](wxCommandEvent&) { _creator_frame.RefreshDirectory(); RefreshOurData(); }); _button_next_unused->Bind(wxEVT_COMMAND_BUTTON_CLICKED, [&](wxCommandEvent&) { auto paths = SortedPaths(*_complete_theme); if (paths.empty()) { return; } auto it = std::lower_bound(paths.begin(), paths.end(), _path_selected); std::size_t index = it == paths.end() ? 0 : std::distance(paths.begin(), it); for (std::size_t i = (index + 1) % paths.size(); i != index; i = (i + 1) % paths.size()) { if (!_tree_lookup.count(paths[i])) { continue; } if (IsUnused(session, paths[i])) { _tree->Select(_tree_lookup[paths[i]]); _tree->EnsureVisible(_tree_lookup[paths[i]]); RefreshTree(_tree_lookup[paths[i]]); break; } } }); _button_random_unused->Bind(wxEVT_COMMAND_BUTTON_CLICKED, [&](wxCommandEvent&) { auto paths = SortedPaths(*_complete_theme); if (paths.empty()) { return; } std::size_t unused_count = 0; for (std::size_t i = 0; i < paths.size(); ++i) { if (!_tree_lookup.count(paths[i])) { continue; } if (IsUnused(session, paths[i])) { ++unused_count; } } if (!unused_count) { return; } std::uniform_int_distribution<std::size_t> d{0, unused_count - 1}; auto r = d(engine); unused_count = 0; for (std::size_t i = 0; i < paths.size(); ++i) { if (!_tree_lookup.count(paths[i])) { continue; } if (!IsUnused(session, paths[i])) { continue; } if (r < ++unused_count) { _tree->Select(_tree_lookup[paths[i]]); _tree->EnsureVisible(_tree_lookup[paths[i]]); RefreshTree(_tree_lookup[paths[i]]); break; } } }); _button_next_theme->Bind(wxEVT_COMMAND_BUTTON_CLICKED, [&](wxCommandEvent&) { auto theme_it = _session.mutable_theme_map()->find(_item_selected); if (theme_it == _session.mutable_theme_map()->end()) { return; } std::vector<std::string> paths; for (const auto& path : _complete_theme->image_path()) { paths.push_back(path); } for (const auto& path : _complete_theme->animation_path()) { paths.push_back(path); } for (const auto& path : _complete_theme->font_path()) { paths.push_back(path); } if (paths.empty()) { return; } std::sort(paths.begin(), paths.end()); auto it = std::lower_bound(paths.begin(), paths.end(), _path_selected); std::size_t index = it == paths.end() ? 0 : std::distance(paths.begin(), it); for (std::size_t i = (index + 1) % paths.size(); i != index; i = (i + 1) % paths.size()) { if (!_tree_lookup.count(paths[i])) { continue; } const auto& t = theme_it->second; if (std::find(t.font_path().begin(), t.font_path().end(), paths[i]) != t.font_path().end() || std::find(t.image_path().begin(), t.image_path().end(), paths[i]) != t.image_path().end() || std::find(t.animation_path().begin(), t.animation_path().end(), paths[i]) != t.animation_path().end()) { _tree->Select(_tree_lookup[paths[i]]); _tree->EnsureVisible(_tree_lookup[paths[i]]); RefreshTree(_tree_lookup[paths[i]]); break; } } }); _button_show_all->Bind(wxEVT_RADIOBUTTON, [&](wxCommandEvent&) { _creator_frame.RefreshDirectory(); RefreshOurData(); }); _button_show_images->Bind(wxEVT_RADIOBUTTON, [&](wxCommandEvent&) { _creator_frame.RefreshDirectory(); RefreshOurData(); }); _button_show_animations->Bind(wxEVT_RADIOBUTTON, [&](wxCommandEvent&) { _creator_frame.RefreshDirectory(); RefreshOurData(); }); _tree->Bind(wxEVT_TREELIST_SELECTION_CHANGED, [&](wxTreeListEvent& e) { RefreshTree(e.GetItem()); }, wxID_ANY); _tree->Bind( wxEVT_TREELIST_ITEM_CHECKED, [&](wxTreeListEvent& e) { if (!HandleCheck(e.GetItem())) { e.Veto(); } }, wxID_ANY); _item_list->AddOnDoubleClick([&](const std::string&) { auto it = _tree_lookup.find(_path_selected); if (it == _tree_lookup.end()) { return; } auto checked = _tree->GetCheckedState(it->second); checked = checked == wxCHK_UNCHECKED ? wxCHK_CHECKED : wxCHK_UNCHECKED; _tree->CheckItem(it->second, checked); HandleCheck(it->second); }); } ThemePage::~ThemePage() { } void ThemePage::RefreshOurData() { for (auto item = _tree->GetFirstItem(); item.IsOk(); item = _tree->GetNextItem(item)) { _tree->CheckItem(item, wxCHK_UNCHECKED); } auto select = [&](const std::string& s) { auto it = _tree_lookup.find(s); if (it != _tree_lookup.end()) { _tree->CheckItem(it->second); _tree->UpdateItemParentStateRecursively(it->second); } }; int selected_text = 0; for (int i = 0; i < _text_list->GetItemCount(); ++i) { if (_text_list->GetItemState(i, wxLIST_STATE_SELECTED)) { selected_text = i; break; } } auto it = _session.theme_map().find(_item_selected); if (it != _session.theme_map().end()) { for (const auto& path : it->second.image_path()) { select(path); } for (const auto& path : it->second.animation_path()) { select(path); } for (const auto& path : it->second.font_path()) { select(path); } while (_text_list->GetItemCount() < it->second.text_line_size()) { _text_list->InsertItem(_text_list->GetItemCount(), ""); } while (_text_list->GetItemCount() > it->second.text_line_size()) { _text_list->DeleteItem(_text_list->GetItemCount() - 1); } for (int i = 0; i < it->second.text_line_size(); ++i) { _text_list->SetItemText((long) i, NlToUser(it->second.text_line(i))); } if (it->second.text_line_size()) { _text_list->SetItemState(std::min(selected_text, it->second.text_line_size() - 1), wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED); } } else { _text_list->DeleteAllItems(); } _button_new->Enable(!_item_selected.empty()); _button_edit->Enable(!_item_selected.empty() && it->second.text_line_size()); _button_delete->Enable(!_item_selected.empty() && it->second.text_line_size()); if (!_path_selected.empty() && _tree_lookup.find(_path_selected) != _tree_lookup.end()) { RefreshTree(_tree_lookup[_path_selected]); } } void ThemePage::RefreshData() { _item_list->RefreshData(); RefreshOurData(); } void ThemePage::RefreshDirectory(const std::string& directory) { *_complete_theme = trance_pb::Theme{}; search_resources(*_complete_theme, directory); std::unordered_set<std::string> expanded_items; for (const auto& pair : _tree_lookup) { bool expanded = true; for (auto parent = pair.second; parent != _tree->GetRootItem(); parent = _tree->GetItemParent(parent)) { if (!_tree->IsExpanded(parent)) { expanded = false; break; } } if (expanded && _tree->GetFirstChild(pair.second).IsOk()) { expanded_items.emplace(pair.first); } } _tree->DeleteAllItems(); _tree_lookup.clear(); _tree_lookup["."] = _tree->GetRootItem(); std::vector<std::string> paths; for (const auto& path : _complete_theme->image_path()) { paths.push_back(path); } for (const auto& path : _complete_theme->animation_path()) { paths.push_back(path); } for (const auto& path : _complete_theme->font_path()) { paths.push_back(path); } std::sort(paths.begin(), paths.end()); std::unordered_set<std::string> used_paths; for (const auto& pair : _session.theme_map()) { for (const auto& path : pair.second.image_path()) { used_paths.emplace(path); } for (const auto& path : pair.second.animation_path()) { used_paths.emplace(path); } for (const auto& path : pair.second.font_path()) { used_paths.emplace(path); } } for (auto it = paths.begin(); it != paths.end();) { if ((_button_show_images->GetValue() && !is_image(*it)) || (_button_show_animations->GetValue() && !is_animation(*it))) { it = paths.erase(it); } else { ++it; } } std::size_t file_count = 0; std::size_t unused_count = 0; for (const auto& path_str : paths) { std::tr2::sys::path path{path_str}; for (auto it = ++path.begin(); it != path.end(); ++it) { std::tr2::sys::path component; std::tr2::sys::path parent; for (auto jt = path.begin(); jt != it; ++jt) { component.append(*jt); parent.append(*jt); } component.append(*it); if (_tree_lookup.find(component.string()) == _tree_lookup.end()) { wxClientData* data = nullptr; if (it == --path.end()) { ++file_count; data = new wxStringClientData{component.string()}; } auto is_used = it != --path.end() || used_paths.count(component.string()); auto str = is_used ? it->string() : "[UNUSED] " + it->string(); auto item = _tree->AppendItem(_tree_lookup[parent.string()], str, -1, -1, data); if (!is_used) { ++unused_count; } _tree_lookup[component.string()] = item; } } } const auto& c = *_complete_theme; std::set<std::string> image_set{c.image_path().begin(), c.image_path().end()}; std::set<std::string> animation_set{c.animation_path().begin(), c.animation_path().end()}; std::set<std::string> font_set{c.font_path().begin(), c.font_path().end()}; for (auto& pair : *_session.mutable_theme_map()) { for (auto it = pair.second.mutable_image_path()->begin(); it != pair.second.mutable_image_path()->end();) { it = image_set.count(*it) ? 1 + it : pair.second.mutable_image_path()->erase(it); } for (auto it = pair.second.mutable_animation_path()->begin(); it != pair.second.mutable_animation_path()->end();) { it = animation_set.count(*it) ? 1 + it : pair.second.mutable_animation_path()->erase(it); } for (auto it = pair.second.mutable_font_path()->begin(); it != pair.second.mutable_font_path()->end();) { it = font_set.count(*it) ? 1 + it : pair.second.mutable_font_path()->erase(it); } } for (const auto& pair : _tree_lookup) { if (expanded_items.find(pair.first) != expanded_items.end()) { _tree->Expand(pair.second); } } _creator_frame.SetStatusText( "Scanned " + std::to_string(file_count) + " files in " + directory + " (" + std::to_string(unused_count) + " unused)"); auto it = _tree_lookup.find(_path_selected); if (it == _tree_lookup.end()) { _path_selected.clear(); } else { _tree->Select(it->second); _tree->EnsureVisible(it->second); } } void ThemePage::Shutdown() { _image_panel->Shutdown(); } bool ThemePage::HandleCheck(wxTreeListItem item) { auto it = _session.mutable_theme_map()->find(_item_selected); if (it == _session.mutable_theme_map()->end()) { return false; } auto checked = _tree->GetCheckedState(item); _tree->CheckItemRecursively(item, checked); _tree->UpdateItemParentStateRecursively(item); auto handle = [&](const google::protobuf::RepeatedPtrField<std::string>& c, google::protobuf::RepeatedPtrField<std::string>& t, const std::string& path) { if (std::find(c.begin(), c.end(), path) == c.end()) { return; } auto it = std::find(t.begin(), t.end(), path); if (checked == wxCHK_CHECKED && it == t.end()) { *t.Add() = path; } if (checked == wxCHK_UNCHECKED && it != t.end()) { t.erase(it); } }; std::function<void(const wxTreeListItem&)> recurse = [&](const wxTreeListItem& item) { for (auto c = _tree->GetFirstChild(item); c.IsOk(); c = _tree->GetNextSibling(c)) { recurse(c); } auto data = _tree->GetItemData(item); if (data != nullptr) { std::string path = ((const wxStringClientData*) data)->GetData(); handle(_complete_theme->image_path(), *it->second.mutable_image_path(), path); handle(_complete_theme->animation_path(), *it->second.mutable_animation_path(), path); handle(_complete_theme->font_path(), *it->second.mutable_font_path(), path); } }; recurse(item); _creator_frame.MakeDirty(true); RefreshHighlights(); return true; } void ThemePage::RefreshTree(wxTreeListItem item) { auto data = _tree->GetItemData(item); if (data != nullptr) { std::string path = ((const wxStringClientData*) data)->GetData(); auto root = std::tr2::sys::path{_session_path}.parent_path().string(); const auto& images = _complete_theme->image_path(); const auto& anims = _complete_theme->animation_path(); const auto& fonts = _complete_theme->font_path(); if (_path_selected != path) { auto full_path = root + "/" + path; if (std::find(images.begin(), images.end(), path) != images.end()) { _current_font.clear(); _image_panel->SetImage(load_image(full_path)); _image_panel->SetInfo(GetFileSize(full_path)); } if (std::find(anims.begin(), anims.end(), path) != anims.end()) { _current_font.clear(); _image_panel->SetAnimation(load_animation(full_path)); _image_panel->SetInfo(GetFileSize(full_path)); } if (std::find(fonts.begin(), fonts.end(), path) != fonts.end()) { _current_font = full_path; GenerateFontPreview(); _image_panel->SetInfo(""); } _path_selected = path; } } RefreshHighlights(); _button_open->Enable(true); _button_rename->Enable(true); } void ThemePage::RefreshHighlights() { _item_list->ClearHighlights(); for (const auto& pair : _session.theme_map()) { auto used = [&](const google::protobuf::RepeatedPtrField<std::string>& f) { return std::find(f.begin(), f.end(), _path_selected) != f.end(); }; const auto& theme = pair.second; if (used(theme.image_path()) || used(theme.font_path()) || used(theme.animation_path())) { _item_list->AddHighlight(pair.first); } } } void ThemePage::GenerateFontPreview() { if (_current_font.empty()) { return; } std::string text; if (_current_text_line.empty()) { text = (--std::tr2::sys::path{_current_font}.end())->string(); } else { text = _current_text_line; } static const unsigned border = 32; static const unsigned font_size = 128; // Render in another thread to avoid interfering with OpenGL contexts. std::thread worker([&] { sf::Font font; font.loadFromFile(_current_font); sf::Text text_obj{text, font, font_size}; auto bounds = text_obj.getLocalBounds(); sf::RenderTexture texture; texture.create(border + (unsigned) bounds.width, border + (unsigned) bounds.height); sf::Transform transform; transform.translate(border / 2 - bounds.left, border / 2 - bounds.top); texture.draw(text_obj, transform); texture.display(); _image_panel->SetImage(texture.getTexture().copyToImage()); }); worker.join(); } <|start_filename|>src/creator/main.cpp<|end_filename|> #include <creator/main.h> #include <common/common.h> #include <common/session.h> #include <common/util.h> #include <creator/export.h> #include <creator/launch.h> #include <creator/playlist.h> #include <creator/program.h> #include <creator/settings.h> #include <creator/theme.h> #include <creator/variables.h> #include <filesystem> #pragma warning(push, 0) #include <wx/app.h> #include <wx/cmdline.h> #include <wx/filedlg.h> #include <wx/menu.h> #include <wx/msgdlg.h> #include <wx/notebook.h> #include <wx/panel.h> #include <wx/sizer.h> #include <wx/stdpaths.h> #pragma warning(pop) static const std::string session_file_pattern = "Session files (*.session)|*.session"; static const std::string archive_file_pattern = "Session archives (*.session.archive)|*.session.archive"; CreatorFrame::CreatorFrame(const std::string& executable_path, const std::string& parameter) : wxFrame{nullptr, wxID_ANY, "Creator", wxDefaultPosition, wxSize{640, 640}} , _session_dirty{false} , _executable_path{executable_path} , _settings{nullptr} , _theme_page{nullptr} , _program_page{nullptr} , _playlist_page{nullptr} , _variable_page{nullptr} , _panel{new wxPanel{this}} , _menu_bar{new wxMenuBar} { auto menu_file = new wxMenu; menu_file->Append(wxID_NEW); menu_file->Append(wxID_OPEN); menu_file->Append(wxID_SAVE); menu_file->AppendSeparator(); menu_file->Append(ID_LAUNCH_SESSION, "&Launch session...\tCtrl+L", "Launch the current session"); menu_file->Append(ID_VALIDATE_SESSION, "Vali&date session...\tCtrl+D", "Validate the current session"); menu_file->Append(ID_EXPORT_VIDEO, "Export &video...\tCtrl+V", "Export the current session as a video"); menu_file->Append(ID_EXPORT_ARCHIVE, "Export &archive...\tCtrl+A", "Export the current session as a packed session archive"); menu_file->AppendSeparator(); menu_file->Append(ID_EDIT_SYSTEM_CONFIG, "&Edit system settings...\tCtrl+E", "Edit global system settings that apply to all sessions"); menu_file->AppendSeparator(); menu_file->Append(wxID_EXIT); _menu_bar->Append(menu_file, "&File"); _menu_bar->Enable(wxID_SAVE, false); _menu_bar->Enable(ID_LAUNCH_SESSION, false); _menu_bar->Enable(ID_VALIDATE_SESSION, false); _menu_bar->Enable(ID_EXPORT_VIDEO, false); _menu_bar->Enable(ID_EXPORT_ARCHIVE, false); SetMenuBar(_menu_bar); CreateStatusBar(); std::string status = "Running in " + _executable_path; try { auto system_path = get_system_config_path(executable_path); _system = load_system(system_path); status += "; read " + system_path; } catch (std::runtime_error&) { _system = get_default_system(); } if (_system.last_root_directory().empty()) { _system.set_last_root_directory(executable_path); } SetStatusText(status); _notebook = new wxNotebook{_panel, wxID_ANY}; _theme_page = new ThemePage{_notebook, *this, _session, _session_path}; _program_page = new ProgramPage{_notebook, *this, _session}; _playlist_page = new PlaylistPage{_notebook, *this, _session}; _variable_page = new VariablePage{_notebook, *this, _session}; _notebook->AddPage(_theme_page, "Themes"); _notebook->AddPage(_program_page, "Programs"); _notebook->AddPage(_playlist_page, "Playlist"); _notebook->AddPage(_variable_page, "Variables"); auto sizer = new wxBoxSizer{wxHORIZONTAL}; sizer->Add(_notebook, 1, wxEXPAND, 0); _panel->SetSizer(sizer); _panel->Hide(); Show(true); if (!parameter.empty()) { OpenSession(parameter); } Bind(wxEVT_MENU, [&](wxCommandEvent& event) { if (!ConfirmDiscardChanges()) { return; } wxFileDialog dialog{this, "Choose session location", _system.last_root_directory(), DEFAULT_SESSION_PATH, session_file_pattern, wxFD_SAVE | wxFD_OVERWRITE_PROMPT}; if (dialog.ShowModal() == wxID_CANCEL) { return; } _session = get_default_session(); std::tr2::sys::path path{std::string{dialog.GetPath()}}; search_resources(_session, path.parent_path().string()); SetSessionPath(std::string{dialog.GetPath()}); SetStatusText("Generated default session for " + path.parent_path().string()); MakeDirty(true); }, wxID_NEW); Bind(wxEVT_MENU, [&](wxCommandEvent& event) { if (!ConfirmDiscardChanges()) { return; } wxFileDialog dialog{this, "Open session file", _system.last_root_directory(), "", session_file_pattern, wxFD_OPEN | wxFD_FILE_MUST_EXIST}; if (dialog.ShowModal() == wxID_CANCEL) { return; } OpenSession(std::string(dialog.GetPath())); }, wxID_OPEN); Bind(wxEVT_MENU, [&](wxCommandEvent& event) { save_session(_session, _session_path); MakeDirty(false); SetStatusText("Wrote " + _session_path); _menu_bar->Enable(ID_LAUNCH_SESSION, true); _menu_bar->Enable(ID_VALIDATE_SESSION, true); _menu_bar->Enable(ID_EXPORT_VIDEO, true); _menu_bar->Enable(ID_EXPORT_ARCHIVE, true); }, wxID_SAVE); Bind(wxEVT_MENU, [&](wxCommandEvent& event) { if (!ConfirmDiscardChanges()) { return; } Disable(); _notebook->Disable(); auto frame = new LaunchFrame{this, _system, _session, _session_path}; }, ID_LAUNCH_SESSION); Bind(wxEVT_MENU, [&](wxCommandEvent& event) { if (!ConfirmDiscardChanges()) { return; } ValidateSession(); }, ID_VALIDATE_SESSION); Bind(wxEVT_MENU, [&](wxCommandEvent& event) { if (!ConfirmDiscardChanges()) { return; } Disable(); _notebook->Disable(); auto frame = new ExportFrame{this, _system, _session, _session_path, _executable_path}; }, ID_EXPORT_VIDEO); Bind(wxEVT_MENU, [&](wxCommandEvent& event) { if (!ConfirmDiscardChanges()) { return; } std::tr2::sys::path path = _session_path; wxFileDialog dialog{this, "Choose archive location", path.parent_path().string(), path.filename().string() + ".archive", archive_file_pattern, wxFD_SAVE | wxFD_OVERWRITE_PROMPT}; if (dialog.ShowModal() == wxID_CANCEL) { return; } ExportArchive(std::string{dialog.GetPath()}); }, ID_EXPORT_ARCHIVE); Bind(wxEVT_MENU, [&](wxCommandEvent& event) { if (_settings) { _settings->Raise(); return; } _settings = new SettingsFrame{this, _system}; }, ID_EDIT_SYSTEM_CONFIG); Bind(wxEVT_MENU, [&](wxCommandEvent& event) { Close(false); }, wxID_EXIT); Bind(wxEVT_CLOSE_WINDOW, [&](wxCloseEvent& event) { if (event.CanVeto() && !ConfirmDiscardChanges()) { event.Veto(); return; } _theme_page->Shutdown(); Destroy(); }); } void CreatorFrame::MakeDirty(bool dirty) { _session_dirty = dirty; SetTitle((_session_dirty ? " [*] Creator - " : "Creator - ") + _session_path); } void CreatorFrame::SaveSystem(bool show_status) { auto system_path = get_system_config_path(_executable_path); save_system(_system, system_path); if (show_status) { SetStatusText("Wrote " + system_path); } } void CreatorFrame::Launch() { auto trance_exe_path = get_trance_exe_path(_executable_path); auto system_config_path = get_system_config_path(_executable_path); auto command_line = trance_exe_path + " \"" + _session_path + "\" \"" + system_config_path + "\""; if (!_session.variable_map().empty()) { command_line += " \"--variables=" + EncodeVariables() + "\""; } SetStatusText("Running " + command_line); wxExecute(command_line, wxEXEC_ASYNC | wxEXEC_SHOW_CONSOLE); } void CreatorFrame::ValidateSession() { auto trance_exe_path = get_trance_exe_path(_executable_path); auto system_config_path = get_system_config_path(_executable_path); auto command_line = trance_exe_path + " \"" + _session_path + "\" \"" + system_config_path + "\""; command_line += " \"--validate_session\""; SetStatusText("Running " + command_line); wxExecute(command_line, wxEXEC_ASYNC | wxEXEC_SHOW_CONSOLE); } void CreatorFrame::ExportVideo(const std::string& path) { bool frame_by_frame = ext_is(path, "jpg") || ext_is(path, "png") || ext_is(path, "bmp"); const auto& settings = _system.last_export_settings(); auto trance_exe_path = get_trance_exe_path(_executable_path); auto system_config_path = get_system_config_path(_executable_path); auto command_line = trance_exe_path + " \"" + _session_path + "\" \"" + system_config_path + "\" --export_path=\"" + path + "\" --export_width=" + std::to_string(settings.width()) + " --export_height=" + std::to_string(settings.height()) + " --export_fps=" + std::to_string(settings.fps()) + " --export_length=" + std::to_string(settings.length()); if (settings.export_3d()) { command_line += " --export_3d"; } if (!frame_by_frame) { command_line += " --export_quality=" + std::to_string(settings.quality()) + " --export_threads=" + std::to_string(settings.threads()); } if (!_session.variable_map().empty()) { command_line += " \"--variables=" + EncodeVariables() + "\""; } SetStatusText("Running " + command_line); wxExecute(command_line, wxEXEC_ASYNC | wxEXEC_SHOW_CONSOLE); } void CreatorFrame::ExportArchive(const std::string& path) { auto trance_exe_path = get_trance_exe_path(_executable_path); auto system_config_path = get_system_config_path(_executable_path); auto command_line = trance_exe_path + " \"" + _session_path + "\" --export_archive=\"" + path + "\""; SetStatusText("Running " + command_line); wxExecute(command_line, wxEXEC_ASYNC | wxEXEC_SHOW_CONSOLE); } void CreatorFrame::RefreshDirectory() { auto parent = std::tr2::sys::path{_session_path}.parent_path().string(); _theme_page->RefreshDirectory(parent); _playlist_page->RefreshDirectory(parent); _theme_page->RefreshData(); _program_page->RefreshThemes(); _program_page->RefreshData(); _playlist_page->RefreshProgramsAndPlaylists(); _playlist_page->RefreshData(); _variable_page->RefreshData(); _system.set_last_root_directory(parent); SaveSystem(false); } void CreatorFrame::SettingsClosed() { _settings = nullptr; } void CreatorFrame::ExportClosed() { _notebook->Enable(); Enable(); } void CreatorFrame::LaunchClosed() { _notebook->Enable(); Enable(); } void CreatorFrame::ThemeCreated(const std::string& theme_name) { _program_page->RefreshThemes(); _program_page->RefreshOurData(); SetStatusText("Created theme '" + theme_name + "'"); MakeDirty(true); } void CreatorFrame::ThemeDeleted(const std::string& theme_name) { for (auto& pair : *_session.mutable_program_map()) { auto it = pair.second.mutable_enabled_theme()->begin(); while (it != pair.second.mutable_enabled_theme()->end()) { if (it->theme_name() == theme_name) { it = pair.second.mutable_enabled_theme()->erase(it); } else { ++it; } } } _program_page->RefreshThemes(); _program_page->RefreshOurData(); SetStatusText("Deleted theme '" + theme_name + "'"); MakeDirty(true); } void CreatorFrame::ThemeRenamed(const std::string& old_name, const std::string& new_name) { for (auto& pair : *_session.mutable_program_map()) { for (auto& theme : *pair.second.mutable_enabled_theme()) { if (theme.theme_name() == old_name) { theme.set_theme_name(new_name); } } } _program_page->RefreshThemes(); _program_page->RefreshOurData(); SetStatusText("Renamed theme '" + old_name + "' to '" + new_name + "'"); MakeDirty(true); } void CreatorFrame::ProgramCreated(const std::string& program_name) { _playlist_page->RefreshProgramsAndPlaylists(); _playlist_page->RefreshOurData(); SetStatusText("Created program '" + program_name + "'"); MakeDirty(true); } void CreatorFrame::ProgramDeleted(const std::string& program_name) { for (auto& pair : *_session.mutable_playlist()) { if (pair.second.has_standard() && pair.second.standard().program() == program_name) { if (_session.program_map().empty()) { pair.second.mutable_standard()->set_program(""); } else { pair.second.mutable_standard()->set_program(_session.program_map().begin()->first); } } } _playlist_page->RefreshProgramsAndPlaylists(); _playlist_page->RefreshOurData(); SetStatusText("Deleted program '" + program_name + "'"); MakeDirty(true); } void CreatorFrame::ProgramRenamed(const std::string& old_name, const std::string& new_name) { for (auto& pair : *_session.mutable_playlist()) { if (pair.second.has_standard() && pair.second.standard().program() == old_name) { pair.second.mutable_standard()->set_program(new_name); } } _playlist_page->RefreshProgramsAndPlaylists(); _playlist_page->RefreshOurData(); SetStatusText("Renamed program '" + old_name + "' to '" + new_name + "'"); MakeDirty(true); } void CreatorFrame::PlaylistItemCreated(const std::string& playlist_item_name) { auto& playlist_item = (*_session.mutable_playlist())[playlist_item_name]; if (!_session.program_map().empty() && !playlist_item.has_standard() && !playlist_item.has_subroutine()) { playlist_item.mutable_standard()->set_program(_session.program_map().begin()->first); } _playlist_page->RefreshProgramsAndPlaylists(); _playlist_page->RefreshOurData(); SetStatusText("Created playlist item '" + playlist_item_name + "'"); MakeDirty(true); } void CreatorFrame::PlaylistItemDeleted(const std::string& playlist_item_name) { if (_session.first_playlist_item() == playlist_item_name) { _session.set_first_playlist_item( _session.playlist().empty() ? "" : _session.playlist().begin()->first); } for (auto& pair : *_session.mutable_playlist()) { auto it = pair.second.mutable_next_item()->begin(); while (it != pair.second.mutable_next_item()->end()) { it = it->playlist_item_name() == playlist_item_name ? pair.second.mutable_next_item()->erase(it) : 1 + it; } if (pair.second.has_subroutine()) { auto& subroutine = *pair.second.mutable_subroutine(); for (auto it = subroutine.mutable_playlist_item_name()->begin(); it != subroutine.mutable_playlist_item_name()->end();) { it = *it == playlist_item_name ? subroutine.mutable_playlist_item_name()->erase(it) : 1 + it; } } } _playlist_page->RefreshProgramsAndPlaylists(); _playlist_page->RefreshOurData(); SetStatusText("Deleted playlist item '" + playlist_item_name + "'"); MakeDirty(true); } void CreatorFrame::PlaylistItemRenamed(const std::string& old_name, const std::string& new_name) { if (_session.first_playlist_item() == old_name) { _session.set_first_playlist_item(new_name); } for (auto& pair : *_session.mutable_playlist()) { for (auto& next_item : *pair.second.mutable_next_item()) { if (next_item.playlist_item_name() == old_name) { next_item.set_playlist_item_name(new_name); } } if (pair.second.has_subroutine()) { for (auto& name : *pair.second.mutable_subroutine()->mutable_playlist_item_name()) { if (name == old_name) { name = new_name; } } } } _playlist_page->RefreshProgramsAndPlaylists(); _playlist_page->RefreshOurData(); SetStatusText("Renamed playlist item '" + old_name + "' to '" + new_name + "'"); MakeDirty(true); } void CreatorFrame::VariableCreated(const std::string& variable_name) { static const std::string new_value_name = "Default"; auto& variable = (*_session.mutable_variable_map())[variable_name]; bool has_default = false; bool default_exists = false; for (const auto value : variable.value()) { if (value == new_value_name) { has_default = true; } if (value == variable.default_value()) { default_exists = true; } } if (!default_exists) { if (!has_default) { variable.add_value(new_value_name); } variable.set_default_value(new_value_name); } _variable_page->RefreshOurData(); _playlist_page->RefreshOurData(); MakeDirty(true); } void CreatorFrame::VariableDeleted(const std::string& variable_name) { for (auto& pair : *_session.mutable_playlist()) { for (auto& next_item : *pair.second.mutable_next_item()) { if (next_item.condition_variable_name() == variable_name) { next_item.clear_condition_variable_name(); next_item.clear_condition_variable_value(); } } } _playlist_page->RefreshOurData(); MakeDirty(true); } void CreatorFrame::VariableRenamed(const std::string& old_name, const std::string& new_name) { for (auto& pair : *_session.mutable_playlist()) { for (auto& next_item : *pair.second.mutable_next_item()) { if (next_item.condition_variable_name() == old_name) { next_item.set_condition_variable_name(new_name); } } } _playlist_page->RefreshOurData(); MakeDirty(true); } void CreatorFrame::VariableValueCreated(const std::string& variable_name, const std::string& value_name) { _playlist_page->RefreshOurData(); MakeDirty(true); } void CreatorFrame::VariableValueDeleted(const std::string& variable_name, const std::string& value_name) { for (auto& pair : *_session.mutable_playlist()) { for (auto& next_item : *pair.second.mutable_next_item()) { if (next_item.condition_variable_name() == variable_name && next_item.condition_variable_value() == value_name) { next_item.clear_condition_variable_name(); next_item.clear_condition_variable_value(); } } } _playlist_page->RefreshOurData(); MakeDirty(true); } void CreatorFrame::VariableValueRenamed(const std::string& variable_name, const std::string& old_name, const std::string& new_name) { for (auto& pair : *_session.mutable_playlist()) { for (auto& next_item : *pair.second.mutable_next_item()) { if (next_item.condition_variable_name() == variable_name && next_item.condition_variable_value() == old_name) { next_item.set_condition_variable_value(new_name); } } } _playlist_page->RefreshOurData(); MakeDirty(true); } bool CreatorFrame::ConfirmDiscardChanges() { if (!_session_dirty) { return true; } return wxMessageBox("Current session has unsaved changes! Proceed?", "", wxICON_QUESTION | wxYES_NO, this) == wxYES; } bool CreatorFrame::OpenSession(const std::string& path) { try { _session = load_session(path); SetStatusText("Read " + _session_path); SetSessionPath(path); _menu_bar->Enable(ID_LAUNCH_SESSION, true); _menu_bar->Enable(ID_VALIDATE_SESSION, true); _menu_bar->Enable(ID_EXPORT_VIDEO, true); _menu_bar->Enable(ID_EXPORT_ARCHIVE, true); MakeDirty(false); return true; } catch (const std::exception& e) { wxMessageBox(std::string(e.what()), "", wxICON_ERROR, this); return false; } } void CreatorFrame::SetSessionPath(const std::string& path) { _session_path = path; _menu_bar->Enable(wxID_SAVE, true); RefreshDirectory(); _panel->Layout(); _panel->Show(); } std::string CreatorFrame::EncodeVariables() { auto encode = [](const std::string& s) { std::string r; for (char c : s) { if (c == '\\') { r += "\\\\"; } else if (c == ';') { r += "\\;"; } else if (c == '=') { r += "\\="; } else if (c == '"') { r += "\\\""; } else { r += c; } } return r; }; std::string result; bool first = true; auto it = _system.last_session_map().find(_session_path); for (const auto& pair : _session.variable_map()) { if (first) { first = false; } else { result += ";"; } result += encode(pair.first) + "="; bool found = false; if (it != _system.last_session_map().end()) { auto jt = it->second.variable_map().find(pair.first); if (jt != it->second.variable_map().end()) { result += encode(jt->second); found = true; } } if (!found) { result += encode(pair.second.default_value()); } } return result; } class CreatorApp : public wxApp { public: CreatorApp() : _frame{nullptr} { } bool OnInit() override { wxApp::OnInit(); std::tr2::sys::path path{std::string(wxStandardPaths::Get().GetExecutablePath())}; _frame = new CreatorFrame{path.parent_path().string(), _parameter}; SetTopWindow(_frame); return true; }; int OnExit() override { // Deleting _frame causes a crash. Shrug. return 0; } void OnInitCmdLine(wxCmdLineParser& parser) override { static const wxCmdLineEntryDesc desc[] = { {wxCMD_LINE_PARAM, NULL, NULL, "session file", wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL}, {wxCMD_LINE_NONE}, }; parser.SetDesc(desc); parser.SetSwitchChars("-"); } bool OnCmdLineParsed(wxCmdLineParser& parser) override { if (parser.GetParamCount()) { _parameter = parser.GetParam(0); } return true; } private: std::string _parameter; CreatorFrame* _frame; }; wxIMPLEMENT_APP(CreatorApp); <|start_filename|>src/trance/main.cpp<|end_filename|> #include <common/common.h> #include <common/session.h> #include <common/util.h> #include <trance/director.h> #include <trance/media/audio.h> #include <trance/media/export.h> #include <common/media/image.h> #include <trance/render/oculus.h> #include <trance/render/openvr.h> #include <trance/render/render.h> #include <trance/render/video_export.h> #include <trance/theme_bank.h> #include <chrono> #include <filesystem> #include <iostream> #include <map> #include <set> #include <string> #include <thread> #pragma warning(push, 0) #include <common/trance.pb.h> #include <gflags/gflags.h> #include <SFML/Graphics.hpp> #include <SFML/Window.hpp> #pragma warning(pop) std::string next_playlist_item(const std::map<std::string, std::string>& variables, const trance_pb::PlaylistItem* item) { uint32_t total = 0; for (const auto& next : item->next_item()) { total += (is_enabled(next, variables) ? next.random_weight() : 0); } if (!total) { return {}; } auto r = random(total); total = 0; for (const auto& next : item->next_item()) { total += (is_enabled(next, variables) ? next.random_weight() : 0); if (r < total) { return next.playlist_item_name(); } } return {}; } static const std::string bad_alloc = "OUT OF MEMORY! TRY REDUCING USAGE IN SETTINGS..."; static const uint32_t async_millis = 10; std::thread run_async_thread(std::atomic<bool>& running, ThemeBank& bank) { // Run the asynchronous load/unload thread. return std::thread{[&] { while (running) { try { bank.async_update(); } catch (std::bad_alloc&) { std::cerr << bad_alloc << std::endl; running = false; throw; } std::this_thread::sleep_for(std::chrono::milliseconds(async_millis)); } }}; } void handle_events(std::atomic<bool>& running, sf::RenderWindow& window) { sf::Event event; while (window.pollEvent(event)) { if (event.type == event.Closed || (event.type == event.KeyPressed && event.key.code == sf::Keyboard::Escape)) { running = false; } if (event.type == sf::Event::Resized) { glViewport(0, 0, event.size.width, event.size.height); } } } void print_info(double elapsed_seconds, uint64_t frames, uint64_t total_frames) { float completion = float(frames) / total_frames; auto elapsed = uint64_t(elapsed_seconds + .5); auto eta = uint64_t(.5 + (completion ? elapsed_seconds * (1. / completion - 1.) : 0.)); auto percentage = uint64_t(100 * completion); std::cout << std::endl << "frame: " << frames << " / " << total_frames << " [" << percentage << "%]; elapsed: " << format_time(elapsed, true) << "; eta: " << format_time(eta, true) << std::endl; } void play_session(const std::string& root_path, const trance_pb::Session& session, const trance_pb::System& system, const std::map<std::string, std::string> variables, const exporter_settings& settings) { struct PlayStackEntry { const trance_pb::PlaylistItem* item; int subroutine_step; }; std::vector<PlayStackEntry> stack; stack.push_back({&session.playlist().find(session.first_playlist_item())->second, 0}); auto program = [&]() -> const trance_pb::Program& { static const auto default_session = get_default_session(); static const auto default_program = default_session.program_map().find("default")->second; if (!stack.back().item->has_standard()) { return default_program; } auto it = session.program_map().find(stack.back().item->standard().program()); if (it == session.program_map().end()) { return default_program; } return it->second; }; std::cout << "loading themes" << std::endl; auto theme_bank = std::make_unique<ThemeBank>(root_path, session, system, program()); std::cout << "\nloaded themes" << std::endl; std::unique_ptr<Renderer> renderer; bool realtime = settings.path.empty(); if (!realtime) { renderer.reset(new VideoExportRenderer(settings)); } else if (system.renderer() == trance_pb::System::OPENVR) { auto openvr = new OpenVrRenderer(system); renderer.reset(openvr); if (!openvr->success()) { renderer.reset(); } } else if (system.renderer() == trance_pb::System::OCULUS) { auto oculus = new OculusRenderer(system); renderer.reset(oculus); if (!oculus->success()) { renderer.reset(); } } if (!renderer) { renderer.reset(new ScreenRenderer(system)); } std::cout << "\nloading session" << std::endl; Director director{session, system, *theme_bank, program(), *renderer}; std::cout << "\nloaded session" << std::endl; std::thread async_thread; std::atomic<bool> running = true; std::unique_ptr<Audio> audio; if (realtime) { async_thread = run_async_thread(running, *theme_bank); audio.reset(new Audio{root_path}); audio->TriggerEvents(*stack.back().item); } std::cout << std::endl << "-> " << session.first_playlist_item() << std::endl; try { float update_time = 0.f; float playlist_item_time = 0.f; uint64_t elapsed_export_frames = 0; uint64_t async_update_residual = 0; double elapsed_frames_residual = 0; std::chrono::high_resolution_clock clock; auto true_clock_time = [&] { return std::chrono::duration_cast<std::chrono::milliseconds>(clock.now().time_since_epoch()) .count(); }; auto clock_time = [&] { if (realtime) { return true_clock_time(); } return long long(1000. * elapsed_export_frames / double(settings.fps)); }; const auto true_clock_start = true_clock_time(); auto last_clock_time = clock_time(); auto last_playlist_switch = clock_time(); while (running) { handle_events(running, renderer->window()); // TODO: should sleep rather than spinning. uint32_t frames_this_loop = 0; auto t = clock_time(); auto elapsed_ms = t - last_clock_time; last_clock_time = t; elapsed_frames_residual += double(program().global_fps()) * double(elapsed_ms) / 1000.; while (elapsed_frames_residual >= 1.) { --elapsed_frames_residual; ++frames_this_loop; } ++elapsed_export_frames; if (!realtime) { auto total_export_frames = uint64_t(settings.length) * uint64_t(settings.fps); if (elapsed_export_frames % 8 == 0) { auto elapsed_seconds = double(true_clock_time() - true_clock_start) / 1000.; print_info(elapsed_seconds, elapsed_export_frames, total_export_frames); } if (elapsed_export_frames >= total_export_frames) { running = false; break; } } async_update_residual += uint64_t(1000. * frames_this_loop / double(settings.fps)); while (!realtime && async_update_residual >= async_millis) { async_update_residual -= async_millis; theme_bank->async_update(); } while (true) { auto time_since_switch = clock_time() - last_playlist_switch; auto& entry = stack.back(); // Continue if we're in a standard playlist item. if (entry.item->has_standard() && time_since_switch < 1000 * entry.item->standard().play_time_seconds()) { break; } // Trigger the next item of a subroutine. if (entry.item->has_subroutine() && entry.subroutine_step < entry.item->subroutine().playlist_item_name_size()) { if (stack.size() >= MAXIMUM_STACK) { std::cerr << "error: subroutine stack overflow\n"; entry.subroutine_step = entry.item->subroutine().playlist_item_name_size(); } else { last_playlist_switch = clock_time(); auto name = entry.item->subroutine().playlist_item_name(entry.subroutine_step); stack.push_back({&session.playlist().find(name)->second, 0}); if (realtime) { audio->TriggerEvents(*stack.back().item); } std::cout << "\n-> " << name << std::endl; theme_bank->set_program(program()); director.set_program(program()); ++stack[stack.size() - 2].subroutine_step; continue; } } auto next = next_playlist_item(variables, entry.item); // Finish a subroutine. if (next.empty() && stack.size() > 1) { stack.pop_back(); continue; } else if (next.empty()) { break; } // Trigger the next item of a standard playlist item. last_playlist_switch = clock_time(); stack.back().item = &session.playlist().find(next)->second; stack.back().subroutine_step = 0; if (realtime) { audio->TriggerEvents(*entry.item); } std::cout << "\n-> " << next << std::endl; theme_bank->set_program(program()); director.set_program(program()); } if (theme_bank->swaps_to_match_theme()) { theme_bank->change_themes(); } bool update = false; bool continue_playing = true; while (frames_this_loop > 0) { update = true; --frames_this_loop; continue_playing &= director.update(); theme_bank->advance_frames(); } if (!continue_playing) { break; } if (update || !realtime) { director.render(); } if (realtime) { audio->Update(); } } } catch (std::bad_alloc&) { std::cerr << bad_alloc << std::endl; throw; } if (realtime) { async_thread.join(); } renderer->window().close(); } std::map<std::string, std::string> parse_variables(const std::string& variables) { std::map<std::string, std::string> result; std::vector<std::string> current; current.emplace_back(); bool escaped = false; for (char c : variables) { if (c == '\\' && !escaped) { escaped = true; continue; } if (escaped) { if (c == '\\') { current.back() += '\\'; } else if (c == ';') { current.back() += ';'; } else if (c == '=') { current.back() += '='; } else { std::cerr << "couldn't parse variables: " << variables << std::endl; return {}; } escaped = false; continue; } if (c == '=' && current.size() == 1 && !current.back().empty()) { current.emplace_back(); continue; } if (c == ';' && current.size() == 2 && !current.back().empty()) { result[current.front()] = current.back(); current.clear(); current.emplace_back(); continue; } if (c != '=' && c != ';') { current.back() += c; continue; } std::cerr << "couldn't parse variables: " << variables << std::endl; return {}; } if (current.size() == 2 && !current.back().empty()) { result[current.front()] = current.back(); current.clear(); current.emplace_back(); } if (current.size() == 1 && current.back().empty()) { return result; } std::cerr << "couldn't parse variables: " << variables << std::endl; return {}; } int validate_session(const std::string& root_path, const trance_pb::Session& session) { // TODO: report unused files or incorrect extensions. std::set<std::string> image_paths; std::set<std::string> animation_paths; std::set<std::string> font_paths; for (const auto& pair : session.theme_map()) { for (const auto& path : pair.second.image_path()) { image_paths.insert(root_path + "/" + path); } for (const auto& path : pair.second.animation_path()) { animation_paths.insert(root_path + "/" + path); } for (const auto& path : pair.second.font_path()) { font_paths.insert(root_path + "/" + path); } } std::set<std::string> broken_paths; for (const auto& path : image_paths) { std::cout << "checking " << path << std::endl; Image image = load_image(path); if (!image) { broken_paths.insert(path); std::cerr << path << " failed to load" << std::endl; } } for (const auto& path : animation_paths) { std::cout << "checking " << path << std::endl; auto streamer = load_animation(path); while (true) { if (!streamer->success()) { broken_paths.insert(path); std::cerr << path << " failed to load" << std::endl; break; } if (!streamer->next_frame()) { break; } } } for (const auto& path : font_paths) { std::cout << "checking " << path << std::endl; sf::Font font; if (!font.loadFromFile(path)) { broken_paths.insert(path); std::cerr << path << " failed to load" << std::endl; } } if (!broken_paths.empty()) { std::cout << std::endl; } for (const auto& path : broken_paths) { std::cerr << "FAILED: " << path << std::endl; } std::cout << "press any key to continue..." << std::endl; char c; std::cin >> c; return broken_paths.empty() ? 0 : 1; } int export_archive(const std::string& root_path, const trance_pb::Session& session, const std::string& archive_path) { return 0; } DEFINE_bool(validate_session, false, "validate session"); DEFINE_string(export_archive, "", "export archive to this path"); DEFINE_string(variables, "", "semicolon-separated list of key=value variable assignments"); DEFINE_string(export_path, "", "export video to this path"); DEFINE_bool(export_3d, false, "export side-by-side 3D video"); DEFINE_uint64(export_width, 1280, "export video resolution width"); DEFINE_uint64(export_height, 720, "export video resolution height"); DEFINE_uint64(export_fps, 60, "export video frames per second"); DEFINE_uint64(export_length, 300, "export video length in seconds"); DEFINE_uint64(export_quality, 2, "export video quality (0 to 4, 0 is best)"); DEFINE_uint64(export_threads, 4, "export video threads"); int main(int argc, char** argv) { gflags::ParseCommandLineFlags(&argc, &argv, true); if (argc > 3) { std::cerr << "usage: " << argv[0] << " [session.cfg [system.cfg]]" << std::endl; return 1; } auto variables = parse_variables(FLAGS_variables); for (const auto& pair : variables) { std::cout << "variable " << pair.first << " = " << pair.second << std::endl; } exporter_settings settings{FLAGS_export_path, FLAGS_export_3d, uint32_t(FLAGS_export_width), uint32_t(FLAGS_export_height), uint32_t(FLAGS_export_fps), uint32_t(FLAGS_export_length), std::min(uint32_t(4), uint32_t(FLAGS_export_quality)), uint32_t(FLAGS_export_threads)}; std::string session_path{argc >= 2 ? argv[1] : "./" + DEFAULT_SESSION_PATH}; trance_pb::Session session; try { session = load_session(session_path); } catch (std::runtime_error& e) { std::cerr << e.what() << std::endl; session = get_default_session(); search_resources(session, "."); } std::string system_path{argc >= 3 ? argv[2] : "./" + SYSTEM_CONFIG_PATH}; trance_pb::System system; try { system = load_system(system_path); } catch (std::runtime_error& e) { std::cerr << e.what() << std::endl; system = get_default_system(); save_system(system, system_path); } auto root_path = std::tr2::sys::path{session_path}.parent_path().string(); if (FLAGS_validate_session) { return validate_session(root_path, session); } if (!FLAGS_export_archive.empty()) { return export_archive(root_path, session, FLAGS_export_archive); } play_session(root_path, session, system, variables, settings); return 0; }
kudy85/trance
<|start_filename|>internal/pkg/config/module_test.go<|end_filename|> package config import ( "testing" "github.com/stretchr/testify/assert" ) func TestModule_Validate(t *testing.T) { tests := []struct { name string module Module wantErr bool }{ { name: "empty config", module: Module{}, wantErr: false, }, { name: "variable with no name", module: Module{ Variables: []Variable{ { Name: "", }, }, }, wantErr: true, }, { name: "variable not required but no default", module: Module{ Variables: []Variable{ { Name: "x", Required: false, Default: nil, }, }, }, wantErr: true, }, { name: "variable required but has default", module: Module{ Variables: []Variable{ { Name: "x", Required: true, Default: "blah", }, }, }, wantErr: true, }, { name: "child module without name", module: Module{ Modules: []InnerModule{ { Name: "", }, }, }, wantErr: true, }, { name: "child module without source", module: Module{ Modules: []InnerModule{ { Name: "X", Source: "", }, }, }, wantErr: true, }, { name: "scripts: has install_required but no install", module: Module{ Scripts: Scripts{ InstallRequired: Script{Command: "check"}, }, }, wantErr: true, }, { name: "scripts: has no install_required but has install", module: Module{ Scripts: Scripts{ Install: Script{Command: "check"}, }, }, wantErr: true, }, { name: "scripts: has update_required but no update", module: Module{ Scripts: Scripts{ UpdateRequired: Script{Command: "check"}, }, }, wantErr: true, }, { name: "scripts: has no update_required but has update", module: Module{ Scripts: Scripts{ Update: Script{Command: "check"}, }, }, wantErr: true, }, { name: "scripts: has after_file_change but no files", module: Module{ Scripts: Scripts{ AfterFileChange: Script{Command: "check"}, }, }, wantErr: true, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { err := tt.module.Validate() if tt.wantErr { assert.Error(t, err) } else { assert.NoError(t, err) } }) } } <|start_filename|>internal/pkg/config/module.go<|end_filename|> package config import "fmt" type variableSniff struct { Variables []Variable `yaml:"variables"` } type Module struct { Name string `yaml:"-"` Dir string `yaml:"-"` Path string `yaml:"-"` Variables []Variable `yaml:"variables"` Files []File `yaml:"files"` Modules []InnerModule `yaml:"modules"` Scripts Scripts `yaml:"scripts"` } type Scripts struct { UpdateRequired Script `yaml:"should_update"` Update Script `yaml:"update"` InstallRequired Script `yaml:"should_install"` Install Script `yaml:"install"` AfterFileChange Script `yaml:"after_file_change"` } type Script struct { Command string `yaml:"command"` Sudo bool `yaml:"sudo"` } type InnerModule struct { Name string `yaml:"name"` Source string `yaml:"source"` DependsOn []string `yaml:"depends_on"` Variables map[string]interface{} `yaml:"variables"` Filters Filters `yaml:"filters"` } type Variable struct { Name string `yaml:"name"` Default interface{} `yaml:"default"` Required bool `yaml:"required"` } type File struct { Target string `yaml:"target"` Source string `yaml:"source"` DisableTemplating bool `yaml:"disable_templating"` } func (m *Module) Validate() error { for _, v := range m.Variables { if v.Name == "" { return fmt.Errorf("module '%s' has a variable with no name", m.Name) } if !v.Required && v.Default == nil { return fmt.Errorf("variable '%s' in module '%s' is not required but has no default value set", v.Name, m.Name) } if v.Required && v.Default != nil { return fmt.Errorf("variable '%s' in module '%s' is always required but has a default value set", v.Name, m.Name) } } for _, child := range m.Modules { if child.Name == "" { return fmt.Errorf("module '%s' has a child module with no name", m.Name) } if child.Source == "" { return fmt.Errorf("module '%s' has a child module '%s' with no source", m.Name, child.Name) } } if m.Scripts.InstallRequired.Command != "" && m.Scripts.Install.Command == "" { return fmt.Errorf("module '%s' has a should_install script defined, but no install script", m.Name) } else if m.Scripts.Install.Command != "" && m.Scripts.InstallRequired.Command == "" { return fmt.Errorf("module '%s' has an install script defined, but no should_install script", m.Name) } if m.Scripts.UpdateRequired.Command != "" && m.Scripts.Update.Command == "" { return fmt.Errorf("module '%s' has a should_update script defined, but no update script", m.Name) } else if m.Scripts.Update.Command != "" && m.Scripts.UpdateRequired.Command == "" { return fmt.Errorf("module '%s' has an update script defined, but no should_update script", m.Name) } if m.Scripts.AfterFileChange.Command != "" && len(m.Files) == 0 { return fmt.Errorf("module '%s' has an after_file_change script defined, but has no files configured", m.Name) } return nil } <|start_filename|>internal/pkg/cmd/apply.go<|end_filename|> package cmd import ( "fmt" "github.com/liamg/peridot/internal/pkg/module" "github.com/liamg/tml" "github.com/spf13/cobra" ) func init() { applyCmd := &cobra.Command{ Use: "apply", Short: "Apply all required changes as dictated by the current configuration. You can preview changes first with the 'diff' command.", Args: cobra.ExactArgs(0), Run: func(_ *cobra.Command, _ []string) { root, err := module.LoadRoot() if err != nil { fail(err) } diffs, err := module.Diff(root) if err != nil { fail(err) } changeCount := len(diffs) if changeCount == 0 { tml.Println("<green><bold>Nothing to do, no changes necessary.</bold></green>") return } for _, moduleDiff := range diffs { tml.Printf("<yellow><bold>[Module %s] Applying changes...", moduleDiff.Module().Name()) if err := moduleDiff.Apply(); err != nil { fmt.Println("") fail(err) } tml.Printf("\x1b[2K\r<green>[Module %s] Changes applied.\n", moduleDiff.Module().Name()) } tml.Printf("\n<green><bold>%d modules applied successfully.</bold></green>\n", changeCount) }, } rootCmd.AddCommand(applyCmd) } <|start_filename|>internal/pkg/builtins/apt.go<|end_filename|> package builtin import ( "fmt" "github.com/liamg/peridot/internal/pkg/config" "github.com/liamg/peridot/internal/pkg/module" "github.com/liamg/peridot/internal/pkg/variable" ) func init() { aptBuiltin := module.NewFactory("apt"). WithInputs([]config.Variable{ { Name: "packages", Required: true, }, }). WithRequiresInstallFunc(func(r *module.Runner, vars variable.Collection) (bool, error) { for _, pkg := range vars.Get("packages").AsList().All() { if err := r.Run( fmt.Sprintf( "apt -qq list %s | grep -q '\\[installed\\]'", pkg.AsString(), ), false, ); err != nil { return true, nil } } return false, nil }). WithInstallFunc(func(r *module.Runner, vars variable.Collection) error { if err := r.Run("apt -qq update", true); err != nil { return fmt.Errorf("failed to sync package db: %w", err) } for _, pkg := range vars.Get("packages").AsList().All() { if err := r.Run(fmt.Sprintf("apt -qq list %s | grep -q '\\[installed\\]'", pkg.AsString()), false); err != nil { if err := r.Run(fmt.Sprintf("apt install -y %s", pkg.AsString()), true); err != nil { return err } } } return nil }). Build() module.RegisterBuiltin("apt", aptBuiltin) } <|start_filename|>internal/pkg/config/filters.go<|end_filename|> package config type Filters struct { OperatingSystem []string `yaml:"os"` Distribution []string `yaml:"distro"` Architecture []string `yaml:"arch"` } <|start_filename|>internal/pkg/variable/list.go<|end_filename|> package variable type List []interface{} func (l List) All() []Variable { var vars []Variable for _, v := range l { vars = append(vars, New(v)) } return vars } func (l List) Len() int { return len(l) } <|start_filename|>internal/pkg/variable/variable_test.go<|end_filename|> package variable import ( "testing" "github.com/stretchr/testify/assert" ) func TestNew(t *testing.T) { tests := []struct { name string input interface{} }{ { name: "bool", input: true, }, { name: "int", input: 123, }, { name: "string", input: "hello", }, { name: "nil", input: nil, }, { name: "float", input: 12.3, }, { name: "[]string", input: []string{"a", "b", "c"}, }, { name: "[]int", input: []int{123, 456}, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { v := New(tt.input) assert.Equal(t, tt.input, v.Interface()) }) } } func Test_variable_AsString(t *testing.T) { tests := []struct { name string input interface{} want string }{ { name: "string", input: "hello world", want: "hello world", }, { name: "bool", input: true, want: "true", }, { name: "int", input: 123, want: "123", }, { name: "float", input: 1.234567, want: "1.234567", }, { name: "nil", input: nil, want: "<nil>", }, { name: "[]int", input: []int{1, 2, 3}, want: "[1, 2, 3]", }, { name: "[]float64", input: []float64{1.1, 2.2, 3.3}, want: "[1.100000, 2.200000, 3.300000]", }, { name: "[]string", input: []string{"a", "b", "c"}, want: `["a", "b", "c"]`, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { v := New(tt.input) assert.Equal(t, tt.want, v.AsString()) }) } } func Test_variable_AsInteger(t *testing.T) { tests := []struct { name string input interface{} want int }{ { name: "int", input: 123, want: 123, }, { name: "bool false", input: false, want: 0, }, { name: "bool true", input: true, want: 1, }, { name: "string", input: "123", want: 123, }, { name: "float", input: 1.23, want: 1, }, { name: "nil", input: nil, want: 0, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { v := New(tt.input) assert.Equal(t, tt.want, v.AsInteger()) }) } } func Test_variable_AsBool(t *testing.T) { tests := []struct { name string input interface{} want bool }{ { name: "bool true", input: true, want: true, }, { name: "bool false", input: false, want: false, }, { name: "int == 0", input: 0, want: false, }, { name: "int > 0", input: 123, want: true, }, { name: "string empty", input: "", want: false, }, { name: "string non-empty", input: "lol", want: true, }, { name: "nil", input: nil, want: false, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { v := New(tt.input) assert.Equal(t, tt.want, v.AsBool()) }) } } func Test_variable_AsFloat(t *testing.T) { tests := []struct { name string input interface{} want float64 }{ { name: "float", input: 1.23, want: 1.23, }, { name: "bool false", input: false, want: 0.0, }, { name: "bool true", input: true, want: 1.0, }, { name: "int", input: 123, want: 123.0, }, { name: "string", input: "1.230", want: 1.23, }, { name: "nil", input: nil, want: 0.0, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { v := New(tt.input) assert.Equal(t, tt.want, v.AsFloat64()) }) } } func Test_variable_AsList(t *testing.T) { tests := []struct { name string input interface{} wantLen int wantValues []interface{} }{ { name: "[]string", input: []string{ "a", "b", "c", }, wantLen: 3, wantValues: []interface{}{ "a", "b", "c", }, }, { name: "[]int", input: []int{ 5, 6, 7, }, wantLen: 3, wantValues: []interface{}{ 5, 6, 7, }, }, { name: "[]float64", input: []float64{ 5.1, 6.1, 7.1, }, wantLen: 3, wantValues: []interface{}{ 5.1, 6.1, 7.1, }, }, { name: "[]bool", input: []bool{ true, false, true, }, wantLen: 3, wantValues: []interface{}{ true, false, true, }, }, { name: "[]interface{}", input: []interface{}{ "a", 123, "c", }, wantLen: 3, wantValues: []interface{}{ "a", 123, "c", }, }, { name: "nil", input: nil, wantLen: 0, wantValues: []interface{}{}, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { v := New(tt.input) assert.Equal(t, tt.wantLen, v.AsList().Len()) for i, val := range v.AsList().All() { assert.Equal(t, tt.wantValues[i], val.Interface()) } }) } } func Test_variable_AsCollection(t *testing.T) { tests := []struct { name string input interface{} }{ { name: "msi", input: map[string]interface{}{"hello": "world"}, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { v := New(tt.input) assert.Equal(t, tt.input, v.AsCollection().AsMap()) }) } } <|start_filename|>internal/pkg/template/template.go<|end_filename|> package template import ( "io" "io/ioutil" "text/template" "github.com/liamg/peridot/internal/pkg/variable" ) func Apply(r io.Reader, w io.Writer, vars variable.Collection) error { raw, err := ioutil.ReadAll(r) if err != nil { return err } t, err := template.New("tmp").Parse(string(raw)) if err != nil { return err } err = t.Execute(w, vars.AsMap()) if err != nil { return err } return nil } <|start_filename|>internal/pkg/system/system_test.go<|end_filename|> package system import ( "runtime" "testing" "github.com/stretchr/testify/assert" ) func TestInfo(t *testing.T) { info := Info() assert.Equal(t, runtime.GOOS, info.OperatingSystem) assert.Equal(t, runtime.GOARCH, info.Architecture) } <|start_filename|>internal/pkg/module/validate.go<|end_filename|> package module import ( "fmt" "github.com/liamg/peridot/internal/pkg/config" "github.com/liamg/peridot/internal/pkg/variable" ) func validateVariables(expectedVars []config.Variable, actual variable.Collection) error { for _, expected := range expectedVars { if expected.Required { if !actual.Has(expected.Name) { return fmt.Errorf("required variable '%s' is not defined", expected.Name) } } } return nil } func applyVariableDefaults(expectedVars []config.Variable, actual variable.Collection) variable.Collection { merged := variable.NewCollection(nil) for _, input := range expectedVars { if actual.Has(input.Name) { merged.Set(input.Name, actual.Get(input.Name).Interface()) } else if !input.Required && input.Default != nil { merged.Set(input.Name, input.Default) } } merged.MergeIn(config.BaseVariables()) return merged } <|start_filename|>test/apply_test.go<|end_filename|> package test import ( "fmt" "strings" "testing" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) func TestApplyCommandWithEmptyConfig(t *testing.T) { c, err := startContainer("ubuntu") if err != nil { t.Fatal(err) } defer func() { _ = c.Stop() }() require.NoError(t, c.WriteConfig(``)) output, exit, err := c.RunAsUser("peridot", "apply", "--no-ansi") require.NoError(t, err) assert.Equal(t, 0, exit, output) assert.Contains(t, output, "no changes") } func TestApplyCommandWithInvalidConfig(t *testing.T) { c, err := startContainer("ubuntu") if err != nil { t.Fatal(err) } defer func() { _ = c.Stop() }() require.NoError(t, c.WriteConfig(`this is invalid`)) output, exit, err := c.RunAsUser("peridot", "apply", "--no-ansi") require.NoError(t, err) assert.Equal(t, 1, exit, output) } func TestApplyCommandWithSingleFileChanges(t *testing.T) { c, err := startContainer("ubuntu") if err != nil { t.Fatal(err) } defer func() { _ = c.Stop() }() require.NoError(t, c.WriteHomeFile(".config/peridot/lol.tmpl", `hello world`)) require.NoError(t, c.WriteConfig(` files: - target: "{{ .user_home_dir }}/hello.txt" source: ./lol.tmpl `)) output, exit, err := c.RunAsUser("peridot", "apply", "--no-ansi") require.NoError(t, err) assert.Equal(t, 0, exit, output) actual, err := c.ReadHomeFile("hello.txt") require.NoError(t, err) assert.Equal(t, "hello world", actual) } func TestApplyCommandWhenOnlyFileAlreadyMatches(t *testing.T) { c, err := startContainer("ubuntu") if err != nil { t.Fatal(err) } defer func() { _ = c.Stop() }() require.NoError(t, c.WriteHomeFile(".config/peridot/lol.tmpl", `hello world`)) require.NoError(t, c.WriteHomeFile("hello.txt", `hello world`)) require.NoError(t, c.WriteConfig(` files: - target: "{{ .user_home_dir }}/hello.txt" source: ./lol.tmpl `)) output, exit, err := c.RunAsUser("peridot", "apply", "--no-ansi") require.NoError(t, err) assert.Equal(t, 0, exit, output) assert.Contains(t, output, "no changes") } func TestApplyWithSudoRequired(t *testing.T) { c, err := startContainer("ubuntu") if err != nil { t.Fatal(err) } defer func() { _ = c.Stop() }() // intall sudo and allow default user to sudo without password _, exit, err := c.RunAsRoot("sh", "-c", fmt.Sprintf(`apt update && apt install -y sudo && echo '%s ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers`, defaultUser)) require.NoError(t, err) require.Zero(t, exit) require.NoError(t, c.WriteHomeFile( ".config/peridot/sudo/config.yml", `scripts: should_install: command: true install: command: "echo ok > /installed && chmod 777 /installed" sudo: true `)) require.NoError(t, c.WriteConfig( `modules: - name: sudo source: ./sudo `)) output, exit, err := c.RunAsUser("peridot", "apply", "--no-ansi") require.NoError(t, err) require.Equal(t, 0, exit, output) output, exit, err = c.RunAsUser("cat", "/installed") require.NoError(t, err) require.Zero(t, exit, output) assert.Equal(t, "ok", strings.TrimSpace(output)) output, exit, err = c.RunAsUser("stat", "-c", "%U", "/installed") require.NoError(t, err) require.Zero(t, exit, output) assert.Equal(t, "root", strings.TrimSpace(output)) } <|start_filename|>internal/pkg/variable/variable.go<|end_filename|> package variable import ( "fmt" "strconv" "strings" ) type Variable interface { AsString() string AsInteger() int AsFloat64() float64 AsBool() bool AsCollection() Collection AsList() List Interface() interface{} } type variable struct { raw interface{} } func New(raw interface{}) Variable { return &variable{ raw: raw, } } func (v *variable) Interface() interface{} { return v.raw } func (v *variable) AsBool() bool { switch actual := v.raw.(type) { case bool: return actual case string: return actual != "" case int: return actual > 0 case float64: return actual > 0 } return false } func (v *variable) AsString() string { switch actual := v.raw.(type) { case bool: return fmt.Sprintf("%t", actual) case string: return actual case int: return fmt.Sprintf("%d", actual) case float64: return fmt.Sprintf("%f", actual) case []int: var out []string for _, a := range actual { out = append(out, fmt.Sprintf("%d", a)) } return fmt.Sprintf("[%s]", strings.Join(out, ", ")) case []float64: var out []string for _, a := range actual { out = append(out, fmt.Sprintf("%f", a)) } return fmt.Sprintf("[%s]", strings.Join(out, ", ")) case []string: return fmt.Sprintf(`["%s"]`, strings.Join(actual, `", "`)) } return fmt.Sprintf("%v", v.raw) } func (v *variable) AsInteger() int { switch c := v.raw.(type) { case int: return c case float64: return int(c) case bool: if c { return 1 } case string: if i, err := strconv.Atoi(c); err == nil { return i } } return 0 } func (v *variable) AsFloat64() float64 { switch c := v.raw.(type) { case int: return float64(c) case bool: if c { return 1 } case float64: return c case string: if f, err := strconv.ParseFloat(c, 64); err == nil { return f } } return 0 } func (v *variable) AsCollection() Collection { if m, ok := v.raw.(map[string]interface{}); ok { return NewCollection(m) } return NewCollection(nil) } func (v *variable) AsList() List { switch actual := v.raw.(type) { case []interface{}: return List(actual) case []string: var anon []interface{} for _, s := range actual { anon = append(anon, s) } return List(anon) case []float64: var anon []interface{} for _, s := range actual { anon = append(anon, s) } return List(anon) case []bool: var anon []interface{} for _, s := range actual { anon = append(anon, s) } return List(anon) case []int: var anon []interface{} for _, s := range actual { anon = append(anon, s) } return List(anon) } return List([]interface{}{}) } <|start_filename|>internal/pkg/module/diff.file.go<|end_filename|> package module import ( "fmt" "os" "path/filepath" "strings" "github.com/hexops/gotextdiff" "github.com/hexops/gotextdiff/myers" "github.com/hexops/gotextdiff/span" "github.com/liamg/peridot/internal/pkg/log" "github.com/liamg/tml" ) type FileOperation uint8 const ( OpUnknown FileOperation = iota OpCreate OpUpdate OpDelete ) type fileDiff struct { module Module path string before string after string operation FileOperation } func (d *fileDiff) Module() Module { return d.module } func (d *fileDiff) Path() string { return d.path } func (d *fileDiff) Before() string { return d.before } func (d *fileDiff) After() string { return d.after } func (d *fileDiff) Operation() FileOperation { return d.operation } func (d *fileDiff) Print(withContent bool) { if withContent { tml.Printf("<yellow>[Module %s] Changes required for '%s':</yellow>\n", d.module.Name(), d.path) edits := myers.ComputeEdits(span.URI(d.path), d.before, d.after) for _, line := range strings.Split(fmt.Sprintf("%s", gotextdiff.ToUnified("before", "after", d.before, edits)), "\n") { switch { case len(line) > 0 && line[0] == '+': tml.Printf("<green>%s</green>\n", line) case len(line) > 0 && line[0] == '-': tml.Printf("<red>%s</red>\n", line) default: fmt.Println(line) } } } else { tml.Printf("<yellow>[Module %s] Changes required for '%s'.</yellow>\n", d.module.Name(), d.path) } } func (d *fileDiff) Apply() error { logger := log.NewLogger(d.module.Name()) switch d.operation { case OpDelete: logger.Log("Removing file %s...", d.path) return os.Remove(d.path) default: dir := filepath.Dir(d.path) if err := os.MkdirAll(dir, 0700); err != nil { return err } logger.Log("Writing file %s...", d.path) f, err := os.Create(d.path) if err != nil { return err } defer func() { _ = f.Close() }() if _, err := f.WriteString(d.after); err != nil { return err } } return nil } <|start_filename|>internal/pkg/cmd/validate.go<|end_filename|> package cmd import ( "path/filepath" "github.com/liamg/peridot/internal/pkg/config" "github.com/liamg/peridot/internal/pkg/module" "github.com/liamg/tml" "github.com/spf13/cobra" ) func init() { validateCmd := &cobra.Command{ Use: "validate", Short: "Validate the current configuration, taking no further action.", Args: cobra.ExactArgs(0), Run: func(_ *cobra.Command, _ []string) { root, err := module.LoadRoot() if err != nil { fail(err) } tml.Printf("<green><bold>Configuration at '%s' appears valid.</bold></green>\n", filepath.Join(root.Path(), config.Filename)) }, } rootCmd.AddCommand(validateCmd) } <|start_filename|>internal/pkg/config/variables.go<|end_filename|> package config import ( "os" "github.com/liamg/peridot/internal/pkg/system" "github.com/liamg/peridot/internal/pkg/variable" ) func BaseVariables() variable.Collection { configDir, _ := configRoot() homeDir, _ := os.UserHomeDir() info := system.Info() return variable.NewCollection(map[string]interface{}{ "user_home_dir": homeDir, "user_config_dir": configDir, "sys_os": info.OperatingSystem, "sys_distro": info.Distribution, "sys_arch": info.Architecture, }) } <|start_filename|>test/validate_test.go<|end_filename|> package test import ( "testing" "github.com/stretchr/testify/require" ) func TestValidateCommand(t *testing.T) { c, err := startContainer("ubuntu") if err != nil { t.Fatal(err) } defer func() { _ = c.Stop() }() tests := []struct { name string config string wantErr bool }{ { name: "empty config is valid", config: ``, wantErr: false, }, { name: "invalid config", config: `blah`, wantErr: true, }, { name: "module without name", config: ` modules: - source: builtin:git `, wantErr: true, }, } for _, test := range tests { t.Run(test.name, func(t *testing.T) { require.NoError(t, c.WriteConfig(test.config)) output, exit, err := c.RunAsUser("peridot", "validate", "--no-ansi") require.NoError(t, err) if test.wantErr { require.NotEqual(t, 0, exit, output) } else { require.Equal(t, 0, exit, output) } }) } } <|start_filename|>internal/pkg/module/depends.go<|end_filename|> package module import ( "fmt" "strings" "github.com/liamg/peridot/internal/pkg/config" ) func sortDependencies(modules []config.InnerModule) ([]config.InnerModule, error) { var sorted []config.InnerModule handled := make([]bool, len(modules)) // process all modules without dependences first for i, m := range modules { if len(m.DependsOn) == 0 { sorted = append(sorted, m) handled[i] = true continue } } // process all modules with dependencies satisfied repeatedly until we are done or can go no further for len(sorted) < len(modules) { last := len(sorted) for i, m := range modules { if handled[i] { continue } missingDeps := findUnmetDependencies(m, sorted) if len(missingDeps) == 0 { sorted = append(sorted, m) handled[i] = true } } if last == len(sorted) { if len(sorted) == len(modules) { break } for i, val := range handled { if !val { missingDeps := findUnmetDependencies(modules[i], sorted) for _, missing := range missingDeps { var exists bool for _, each := range modules { if each.Name == missing { exists = true break } } if !exists { return nil, fmt.Errorf("failed to satisfy dependencies for module '%s': module '%s' was requested but does not exist", modules[i].Name, missing) } } return nil, fmt.Errorf("failed to satisfy dependencies for module '%s' (needs unmet: %s)", modules[i].Name, strings.Join(missingDeps, ", ")) } } // should be impossible... return nil, fmt.Errorf("bad dependency chain") } } return sorted, nil } func findUnmetDependencies(m config.InnerModule, met []config.InnerModule) []string { var unmet []string for _, dep := range m.DependsOn { var found bool for _, done := range met { if done.Name == dep { found = true break } } if !found { unmet = append(unmet, dep) } } return unmet } <|start_filename|>internal/pkg/module/register.go<|end_filename|> package module import ( "fmt" "sync" "github.com/liamg/peridot/internal/pkg/variable" ) var moduleRegistry = struct { sync.Mutex modules map[string]BuiltIn }{ modules: make(map[string]BuiltIn), } type BuiltIn interface { Module ApplyVariables(vars variable.Collection) Clone(name string) BuiltIn } func RegisterBuiltin(name string, builtin BuiltIn) { moduleRegistry.Lock() defer moduleRegistry.Unlock() if _, exists := moduleRegistry.modules[name]; exists { panic(fmt.Sprintf("cannot register multiple builtin modules with the same name: '%s'", name)) } moduleRegistry.modules[name] = builtin } func loadBuiltin(builtin, name string, vars variable.Collection) (Module, error) { moduleRegistry.Lock() defer moduleRegistry.Unlock() if m, exists := moduleRegistry.modules[builtin]; exists { clone := m.Clone(name) clone.ApplyVariables(vars) if err := clone.Validate(); err != nil { return nil, err } return clone, nil } return nil, fmt.Errorf("builtin module does not exist: '%s'", name) } <|start_filename|>test/system_test.go<|end_filename|> package test import ( "fmt" "runtime" "strings" "testing" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) func TestSystemCommand(t *testing.T) { c, err := startContainer("ubuntu") if err != nil { t.Fatal(err) } defer func() { _ = c.Stop() }() // run system command output, exit, err := c.RunAsUser("peridot", "system", "--no-ansi") require.NoError(t, err) require.Equal(t, 0, exit, output) required := map[string]bool{ "Operating System": false, "Architecture": false, "Distribution": false, } for _, line := range strings.Split(output, "\n") { parts := strings.Split(line, ":") if len(parts) != 2 { continue } key := strings.TrimSpace(parts[0]) value := strings.TrimSpace(parts[1]) switch key { case "Architecture": assert.Equal(t, runtime.GOARCH, value) case "Operating System": assert.Equal(t, runtime.GOOS, value) case "Distribution": assert.Equal(t, "ubuntu", value) default: t.Errorf("unexpected key: %q", key) continue } required[key] = true } for name, ok := range required { assert.True(t, ok, fmt.Sprintf("missing property '%s'", name)) } } <|start_filename|>internal/pkg/system/system.go<|end_filename|> package system import ( "os" "runtime" "strings" ) type systemInfo struct { OperatingSystem string Distribution string Architecture string } var systemInfoCache *systemInfo func Info() systemInfo { if systemInfoCache == nil { systemInfoCache = &systemInfo{ OperatingSystem: runtime.GOOS, Architecture: runtime.GOARCH, Distribution: getDistro(), } } return *systemInfoCache } func getDistro() string { for _, file := range []string{ "/etc/os-release", "/usr/lib/os-release", "/etc/initrd-release", } { data, err := os.ReadFile(file) if err != nil { continue } for _, line := range strings.Split(string(data), "\n") { line = strings.TrimSpace(line) if strings.HasPrefix(line, "ID=") { return strings.Trim(line[3:], `"'`) } } } return "" } <|start_filename|>main.go<|end_filename|> package main import "github.com/liamg/peridot/internal/pkg/cmd" func main() { cmd.Execute() } <|start_filename|>internal/pkg/variable/collection_test.go<|end_filename|> package variable import ( "testing" "github.com/stretchr/testify/assert" ) func TestNewCollection(t *testing.T) { tests := []struct { name string input map[string]interface{} want map[string]interface{} }{ { name: "basic", input: map[string]interface{}{}, want: map[string]interface{}{}, }, { name: "nil", input: nil, want: map[string]interface{}{}, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { coll := NewCollection(tt.input) assert.Equal(t, tt.want, coll.AsMap()) }) } } func Test_collection_Has(t *testing.T) { tests := []struct { name string input map[string]interface{} key string want bool }{ { name: "does not exist", input: map[string]interface{}{}, key: "x", want: false, }, { name: "exists", input: map[string]interface{}{ "x": "", }, key: "x", want: true, }, { name: "different case exists", input: map[string]interface{}{ "x": "", }, key: "X", want: false, }, { name: "exists as nil", input: map[string]interface{}{ "x": nil, }, key: "x", want: true, }, { name: "exists as map", input: map[string]interface{}{ "x": map[string]interface{}(nil), }, key: "x", want: true, }, { name: "whole map is nil", input: nil, key: "x", want: false, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { coll := NewCollection(tt.input) has := coll.Has(tt.key) assert.Equal(t, tt.want, has) }) } } func Test_collection_Get(t *testing.T) { tests := []struct { name string input map[string]interface{} key string want Variable }{ { name: "exists", input: map[string]interface{}{ "x": 123, }, key: "x", want: New(123), }, { name: "does not exist", input: map[string]interface{}{ "x": 123, }, key: "y", want: New(nil), }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { coll := NewCollection(tt.input) actual := coll.Get(tt.key) assert.Equal(t, tt.want, actual) }) } } func Test_collection_Set(t *testing.T) { tests := []struct { name string input map[string]interface{} key string val string }{ { name: "empty set", input: nil, key: "x", val: "y", }, { name: "overwrite", input: map[string]interface{}{ "hello": "goodbye", }, key: "hello", val: "world", }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { coll := NewCollection(tt.input) coll.Set(tt.key, tt.val) assert.Equal(t, tt.val, coll.AsMap()[tt.key]) }) } } func Test_collection_MergeIn(t *testing.T) { tests := []struct { name string a map[string]interface{} b map[string]interface{} want map[string]interface{} }{ { a: map[string]interface{}{ "x": 1, "y": 2, }, b: map[string]interface{}{ "x": "one", "z": "three", }, want: map[string]interface{}{ "x": "one", "y": 2, "z": "three", }, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { a := NewCollection(tt.a) b := NewCollection(tt.b) a.MergeIn(b) assert.Equal(t, tt.want, a.AsMap()) }) } } <|start_filename|>internal/pkg/builtins/git.go<|end_filename|> package builtin import ( "path/filepath" "github.com/liamg/peridot/internal/pkg/config" "github.com/liamg/peridot/internal/pkg/module" "github.com/liamg/peridot/internal/pkg/variable" ) func init() { git := module.NewFactory("git"). WithInputs([]config.Variable{ { Name: "username", Required: true, }, { Name: "email", Required: true, }, { Name: "editor", Default: "vim", }, { Name: "signingkey", Default: "", }, { Name: "aliases", Default: []interface{}{}, }, { Name: "extra", }, { Name: "ignores", Default: []interface{}{}, }, }). WithFilesFunc(gitFiles). Build() module.RegisterBuiltin("git", git) } var ( gitIgnoreTemplate = `{{ range .ignores }}{{ . }} {{ end }}` gitConfigTemplate = ` [user] name = {{ .username }} email = {{ .email }} {{ if .signingkey }}signingkey = {{ .signingkey }}{{ end }} [commit] gpgsign = {{ if .signingkey }}true{{ else }}false{{ end }} [core] excludesfile = ~/.gitignore {{ if .editor }} editor = {{ .editor }} {{ else }} editor = vim {{ end }} [pull] rebase = true [alias] {{range .aliases}} {{ . }} {{end}} {{ if .extra }}{{ .extra }}{{ end }} ` ) func gitFiles(vars variable.Collection) []module.File { var files []module.File home := vars.Get("user_home_dir").AsString() files = append(files, module.NewMemoryFile( filepath.Join(home, ".gitignore"), gitIgnoreTemplate, true, vars, )) files = append(files, module.NewMemoryFile( filepath.Join(home, ".gitconfig"), gitConfigTemplate, true, vars, )) return files } <|start_filename|>internal/pkg/builtins/fonts.go<|end_filename|> package builtin import ( "fmt" "io/ioutil" "net/http" "net/url" "os" "path" "path/filepath" "strings" "github.com/liamg/peridot/internal/pkg/config" "github.com/liamg/peridot/internal/pkg/module" "github.com/liamg/peridot/internal/pkg/variable" ) func getFontsDir(vars variable.Collection) (string, error) { // sort out a fonts directory var dir string if vars.Has("dir") { dir = vars.Get("dir").AsString() } if dir == "" { home, err := os.UserHomeDir() if err != nil { return "", err } dir = filepath.Join(home, ".local/share/fonts") } return dir, nil } func fontsRequiresInstall(_ *module.Runner, vars variable.Collection) (bool, error) { dir, err := getFontsDir(vars) if err != nil { return false, err } if err := os.MkdirAll(dir, 0700); err != nil { return false, err } for _, file := range vars.Get("files").AsList().All() { var filename string if strings.HasPrefix(file.AsString(), "./") { filename = filepath.Base(file.AsString()) } else if parsed, err := url.Parse(file.AsString()); err == nil && parsed.Host != "" { filename = path.Base(parsed.Path) } expectedPath := filepath.Join(dir, filename) if _, err := os.Stat(expectedPath); os.IsNotExist(err) { return true, nil } } return false, nil } func fontsInstall(r *module.Runner, vars variable.Collection) error { dir, err := getFontsDir(vars) if err != nil { return err } if err := os.MkdirAll(dir, 0700); err != nil { return err } for _, file := range vars.Get("files").AsList().All() { var filename string if strings.HasPrefix(file.AsString(), "./") { filename = filepath.Base(file.AsString()) targetPath := filepath.Join(dir, filename) if _, err := os.Stat(targetPath); !os.IsNotExist(err) { continue } fontData, err := ioutil.ReadFile(file.AsString()) if err != nil { return fmt.Errorf("failed to install font from %s: %w", file.AsString(), err) } if err := ioutil.WriteFile(targetPath, fontData, 0600); err != nil { return err } } else if parsed, err := url.Parse(file.AsString()); err == nil && parsed.Host != "" { filename = path.Base(parsed.Path) targetPath := filepath.Join(dir, filename) if _, err := os.Stat(targetPath); !os.IsNotExist(err) { continue } if err := func() error { resp, err := http.Get(parsed.String()) if err != nil { return err } defer resp.Body.Close() fontData, err := ioutil.ReadAll(resp.Body) if err != nil { return err } if err := ioutil.WriteFile(targetPath, fontData, 0600); err != nil { return err } return nil }(); err != nil { return err } } else { return fmt.Errorf("invalid font file: '%s'", file.AsString()) } } return r.Run("fc-cache -f", false) } func init() { fontsBuiltin := module.NewFactory("fonts"). WithInputs([]config.Variable{ { Name: "files", Required: true, }, { Name: "dir", Default: "", }, }). WithRequiresInstallFunc(fontsRequiresInstall). WithInstallFunc(fontsInstall). Build() module.RegisterBuiltin("fonts", fontsBuiltin) } <|start_filename|>Dockerfile<|end_filename|> FROM scratch COPY peridot / ENTRYPOINT ["/peridot"] <|start_filename|>internal/pkg/module/runner.go<|end_filename|> package module import ( "fmt" "os" "os/exec" "time" "github.com/liamg/peridot/internal/pkg/log" "github.com/liamg/tml" ) type Runner struct { module Module operation string usedSudo *time.Time } // default is 15, so assume 5 is safe for most users // can make this configurable if it's ever a problem const sudoTimeout = time.Minute * 5 func NewRunner(module Module, operation string) *Runner { return &Runner{ module: module, operation: operation, } } func (r *Runner) Run(command string, sudo bool) error { if sudo && (r.usedSudo == nil || time.Since(*r.usedSudo) > sudoTimeout) { tml.Printf("\n<bold><blue>This change requires root access. Please enter your password if prompted.</blue></bold>\n") defer func() { t := time.Now() r.usedSudo = &t }() } var cmd *exec.Cmd if sudo { cmd = exec.Command("sudo", "sh", "-c", command) cmd.Stdin = os.Stdin cmd.Stdout = os.Stdout cmd.Stderr = os.Stderr } else { cmd = exec.Command("sh", "-c", command) output := log.NewPrefixedWriter(r.module.Name(), r.operation) defer output.Flush() _, _ = output.Write([]byte(fmt.Sprintf("Running command: %s\n", command))) cmd.Stdout = output cmd.Stderr = output } cmd.Dir = r.module.Path() return cmd.Run() } <|start_filename|>internal/pkg/log/debug.go<|end_filename|> package log import ( "fmt" "io" "io/ioutil" "os" "github.com/liamg/tml" ) var enabled bool func Enable() { enabled = true } func Debug(format string, args ...interface{}) { if !enabled { return } fmt.Printf(format+"\n", args) } type Logger struct { prefix string recipient io.Writer } func NewLogger(prefix string) *Logger { recipient := ioutil.Discard if enabled { recipient = os.Stdout } return &Logger{ prefix: prefix, recipient: recipient, } } func (l *Logger) Log(format string, args ...interface{}) { fmt.Fprintln( l.recipient, tml.Sprintf( "[<bold><yellow>%s</yellow></bold>] %s", l.prefix, fmt.Sprintf(format, args...), ), ) } <|start_filename|>internal/pkg/module/file.go<|end_filename|> package module import ( "bytes" "io/ioutil" "os" "path/filepath" "strings" "github.com/liamg/peridot/internal/pkg/config" "github.com/liamg/peridot/internal/pkg/template" "github.com/liamg/peridot/internal/pkg/variable" ) type File interface { Target() string RenderTemplate() (string, error) } func NewMemoryFile(target string, template string, enableTemplating bool, vars variable.Collection) File { return &memoryFile{ target: target, template: template, variables: vars, enableTemplating: enableTemplating, } } func (m *memoryFile) Target() string { return m.target } func (m *memoryFile) RenderTemplate() (string, error) { if !m.enableTemplating { return m.template, nil } buffer := bytes.NewBufferString("") if err := template.Apply(strings.NewReader(m.template), buffer, m.variables); err != nil { return "", err } return buffer.String(), nil } type memoryFile struct { target string template string variables variable.Collection enableTemplating bool } type localFile struct { target string sourcePath string variables variable.Collection templating bool } func loadFile(modConf config.Module, fileConf config.File, combined variable.Collection) (File, error) { templatePath := filepath.Join(modConf.Dir, fileConf.Source) return &localFile{ target: fileConf.Target, sourcePath: templatePath, variables: combined, templating: !fileConf.DisableTemplating, }, nil } func (l *localFile) Target() string { return l.target } func (l *localFile) RenderTemplate() (string, error) { f, err := os.Open(l.sourcePath) if err != nil { return "", err } defer func() { _ = f.Close() }() if !l.templating { data, err := ioutil.ReadAll(f) if err != nil { return "", err } return string(data), nil } buffer := bytes.NewBufferString("") if err := template.Apply(f, buffer, l.variables); err != nil { return "", err } return buffer.String(), nil } <|start_filename|>internal/pkg/module/load.go<|end_filename|> package module import ( "fmt" "path/filepath" "strings" "github.com/liamg/peridot/internal/pkg/config" "github.com/liamg/peridot/internal/pkg/variable" ) func LoadRoot() (Module, error) { rootConfig, override, err := config.ParseRoot() if err != nil { return nil, err } rootConfig.Name = "root" return loadModule(*rootConfig, config.BaseVariables(), override) } func loadModule(conf config.Module, combined variable.Collection, override *config.Override) (Module, error) { if conf.Name == "" { conf.Name = filepath.Base(conf.Dir) } mod := module{ conf: conf, variables: combined, } // load and set mod.files for _, f := range conf.Files { file, err := loadFile(conf, f, combined) if err != nil { return nil, err } mod.files = append(mod.files, file) } sorted, err := sortDependencies(conf.Modules) if err != nil { return nil, err } for _, childInfo := range sorted { if !filtersMatch(childInfo.Filters) { continue } child, err := loadModuleFromSource(childInfo, conf, override) if err != nil { return nil, err } mod.children = append(mod.children, child) } if err := mod.Validate(); err != nil { return nil, fmt.Errorf("validation error in module '%s': %w", mod.conf.Name, err) } return &mod, nil } func loadModuleFromSource(info config.InnerModule, parent config.Module, override *config.Override) (Module, error) { var path string combined := variable.NewCollection(info.Variables) if override != nil { overrides := variable.NewCollection(override.Variables).Get(info.Name).AsCollection() combined.MergeIn(overrides) } switch { case strings.HasPrefix(info.Source, "builtin:"): // builtin modules return loadBuiltin(info.Source[8:], info.Name, combined) case strings.HasPrefix(info.Source, "./"): // locally defined modules var err error path, err = filepath.Abs(filepath.Join(parent.Dir, info.Source)) if err != nil { return nil, err } path = filepath.Join(path, config.Filename) return loadModuleFromPath(path, info.Name, combined) default: return nil, fmt.Errorf("invalid module source '%s' - local modules should begin with './'. "+ "To load external modules, use a full URL, or to use built in modules, use 'builtin:NAME'", info.Source) } } func loadModuleFromPath(path string, name string, combined variable.Collection) (Module, error) { variableDefaults, err := config.ParseVariables(path) if err != nil { return nil, err } combined = applyVariableDefaults(variableDefaults, combined) conf, err := config.Parse(path, combined) if err != nil { return nil, err } conf.Name = name return loadModule(*conf, combined, nil) } <|start_filename|>internal/pkg/config/path.go<|end_filename|> package config import ( "fmt" "os" "path/filepath" ) const ( dir = "peridot" Filename = "config.yml" localOverridesFilename = "local.yml" ) func Path() (string, error) { root, err := configRoot() if err != nil { return "", err } return filepath.Abs(filepath.Join(root, dir, Filename)) } func configRoot() (string, error) { if root := os.Getenv("XDG_CONFIG_HOME"); root != "" { return root, nil } if home, err := os.UserHomeDir(); err == nil { return filepath.Join(home, ".config"), nil } return "", fmt.Errorf("cloud not find config directory") } <|start_filename|>internal/pkg/cmd/diff.go<|end_filename|> package cmd import ( "github.com/liamg/peridot/internal/pkg/module" "github.com/liamg/tml" "github.com/spf13/cobra" ) func init() { var simpleDiffs bool diffCmd := &cobra.Command{ Use: "diff", Short: "Compare the desired state as dictated by your peridot templates and config files with the actual local state.", Args: cobra.ExactArgs(0), Run: func(_ *cobra.Command, _ []string) { root, err := module.LoadRoot() if err != nil { fail(err) } diffs, err := module.Diff(root) if err != nil { fail(err) } changeCount := len(diffs) if changeCount == 0 { tml.Println("<green><bold>Nothing to do, no changes necessary.</bold></green>") return } for _, diff := range diffs { diff.Print(!simpleDiffs) } if changeCount == 1 { tml.Printf("\n<yellow><bold>%d module has pending changes.</bold></yellow>\n", changeCount) } else { tml.Printf("\n<yellow><bold>%d modules have pending changes.</bold></yellow>\n", changeCount) } }, } diffCmd.Flags().BoolVarP(&simpleDiffs, "simple", "s", simpleDiffs, "Show simple diffs without file content changes.") rootCmd.AddCommand(diffCmd) } <|start_filename|>test/init_test.go<|end_filename|> package test import ( "testing" "github.com/liamg/peridot/internal/pkg/config" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "gopkg.in/yaml.v3" ) func TestInitCommand(t *testing.T) { c, err := startContainer("ubuntu") if err != nil { t.Fatal(err) } defer func() { _ = c.Stop() }() _, _, err = c.RunAsRoot("sh", "-c", "apt update && apt install -y git") require.NoError(t, err) // run init command output, exit, err := c.RunAsUser("peridot", "init") require.NoError(t, err) require.Equal(t, 0, exit, output) // read in the config file that the init created content, err := c.ReadHomeFile(".config/peridot/config.yml") require.NoError(t, err) // make sure the yaml is valid var out config.Module require.NoError(t, yaml.Unmarshal([]byte(content), &out)) assert.NoError(t, out.Validate()) // make sure we don't have any crap in here by default assert.Len(t, out.Files, 0) assert.Len(t, out.Modules, 0) assert.Len(t, out.Variables, 0) _, err = c.ReadHomeFile(".config/peridot/.git/config") require.NoError(t, err) } func TestInitCommandCannotOverwriteConfigByDefault(t *testing.T) { c, err := startContainer("ubuntu") if err != nil { t.Fatal(err) } defer func() { _ = c.Stop() }() require.NoError(t, c.WriteConfig(``)) _, _, err = c.RunAsRoot("sh", "-c", "apt update && apt install -y git") require.NoError(t, err) // run init command output, exit, err := c.RunAsUser("peridot", "init", "--no-ansi") require.NoError(t, err) // command should fail when config already exists require.Equal(t, 1, exit, output) } func TestInitCommandWithForcedOverwrite(t *testing.T) { c, err := startContainer("ubuntu") if err != nil { t.Fatal(err) } defer func() { _ = c.Stop() }() // place a config require.NoError(t, c.WriteConfig(``)) _, _, err = c.RunAsRoot("sh", "-c", "apt update && apt install -y git") require.NoError(t, err) // run init command with force output, exit, err := c.RunAsUser("peridot", "init", "--force", "--no-ansi") require.NoError(t, err) require.Equal(t, 0, exit, output) // read in the config file that the init created content, err := c.ReadHomeFile(".config/peridot/config.yml") require.NoError(t, err) require.Greater(t, len(content), 0) // make sure the yaml is valid var out config.Module require.NoError(t, yaml.Unmarshal([]byte(content), &out)) assert.NoError(t, out.Validate()) } func TestInitCommandWithForcedOverwriteWhenConfigIsInvalid(t *testing.T) { c, err := startContainer("ubuntu") if err != nil { t.Fatal(err) } defer func() { _ = c.Stop() }() // place a bad config require.NoError(t, c.WriteConfig(`this is invalid`)) _, _, err = c.RunAsRoot("sh", "-c", "apt update && apt install -y git") require.NoError(t, err) // run init command with force output, exit, err := c.RunAsUser("peridot", "init", "--force", "--no-ansi") require.NoError(t, err) require.Equal(t, 0, exit, output) // read in the config file that the init created content, err := c.ReadHomeFile(".config/peridot/config.yml") require.NoError(t, err) require.Greater(t, len(content), 0) // make sure the yaml is valid var out config.Module require.NoError(t, yaml.Unmarshal([]byte(content), &out)) assert.NoError(t, out.Validate()) } <|start_filename|>internal/pkg/config/parse.go<|end_filename|> package config import ( "bytes" "fmt" "os" "path/filepath" "github.com/liamg/peridot/internal/pkg/log" "github.com/liamg/peridot/internal/pkg/template" "github.com/liamg/peridot/internal/pkg/variable" "gopkg.in/yaml.v3" ) func ParseVariables(path string) ([]Variable, error) { var sniff variableSniff f, err := os.Open(path) if err != nil { return nil, err } defer func() { _ = f.Close() }() if err := yaml.NewDecoder(f).Decode(&sniff); err != nil { return nil, fmt.Errorf("error in %s: %w", path, err) } return sniff.Variables, nil } func Parse(path string, variables variable.Collection) (*Module, error) { var m Module f, err := os.Open(path) if err != nil { return nil, err } defer func() { _ = f.Close() }() var output []byte buffer := bytes.NewBuffer(output) if err := template.Apply(f, buffer, variables); err != nil { return nil, err } if err := yaml.Unmarshal(buffer.Bytes(), &m); err != nil { return nil, fmt.Errorf("error in %s: %w", path, err) } logger := log.NewLogger("parser") logger.Log("Validating config at %s...", path) if err := m.Validate(); err != nil { return nil, err } m.Path = path m.Dir = filepath.Dir(path) return &m, nil } <|start_filename|>test/diff_test.go<|end_filename|> package test import ( "testing" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) func TestDiffCommandWithEmptyConfig(t *testing.T) { c, err := startContainer("ubuntu") if err != nil { t.Fatal(err) } defer func() { _ = c.Stop() }() require.NoError(t, c.WriteConfig(``)) output, exit, err := c.RunAsUser("peridot", "diff", "--no-ansi") require.NoError(t, err) assert.Equal(t, 0, exit, output) assert.Contains(t, output, "no changes") } func TestDiffCommandWithInvalidConfig(t *testing.T) { c, err := startContainer("ubuntu") if err != nil { t.Fatal(err) } defer func() { _ = c.Stop() }() require.NoError(t, c.WriteConfig(`this is invalid`)) output, exit, err := c.RunAsUser("peridot", "diff", "--no-ansi") require.NoError(t, err) assert.Equal(t, 1, exit, output) } func TestDiffCommandWithSingleFileChanges(t *testing.T) { c, err := startContainer("ubuntu") if err != nil { t.Fatal(err) } defer func() { _ = c.Stop() }() require.NoError(t, c.WriteHomeFile(".config/peridot/lol.tmpl", `hello world`)) require.NoError(t, c.WriteConfig(` files: - target: /tmp/lol source: ./lol.tmpl `)) output, exit, err := c.RunAsUser("peridot", "diff", "--no-ansi") require.NoError(t, err) assert.Equal(t, 0, exit, output) assert.Contains(t, output, "1 module has pending changes") assert.Contains(t, output, "'/tmp/lol'") } func TestDiffCommandWhenOnlyFileAlreadyMatches(t *testing.T) { c, err := startContainer("ubuntu") if err != nil { t.Fatal(err) } defer func() { _ = c.Stop() }() require.NoError(t, c.WriteHomeFile(".config/peridot/lol.tmpl", `hello world`)) require.NoError(t, c.WriteHomeFile("hello.txt", `hello world`)) require.NoError(t, c.WriteConfig(` files: - target: "{{ .user_home_dir }}/hello.txt" source: ./lol.tmpl `)) output, exit, err := c.RunAsUser("peridot", "diff", "--no-ansi") require.NoError(t, err) assert.Equal(t, 0, exit, output) assert.Contains(t, output, "no changes") } <|start_filename|>internal/pkg/config/init.go<|end_filename|> package config import ( "fmt" "os" "os/exec" "path/filepath" "gopkg.in/yaml.v3" ) var DefaultConfig = Config{ Debug: false, } func Init() (string, error) { path, err := Path() if err != nil { return "", err } dir := filepath.Dir(path) if err := os.MkdirAll(dir, 0700); err != nil { return "", err } f, err := os.Create(path) if err != nil { return "", err } defer f.Close() if _, err := f.Write([]byte("# See https://github.com/liamg/peridot for help configuring peridot\n")); err != nil { return "", err } if err := yaml.NewEncoder(f).Encode(DefaultConfig); err != nil { return "", err } gitPath, err := exec.LookPath("git") if err != nil { return "", fmt.Errorf("git binary not found in path: %w", err) } cmd := exec.Command(gitPath, "init") cmd.Dir = dir if err := cmd.Run(); err != nil { return "", fmt.Errorf("git repository init failed: %w", err) } return path, nil } <|start_filename|>internal/pkg/variable/collection.go<|end_filename|> package variable type Collection interface { Has(name string) bool Get(name string) Variable Set(name string, value interface{}) AsMap() map[string]interface{} MergeIn(Collection) } func NewCollection(data map[string]interface{}) Collection { if data == nil { data = make(map[string]interface{}) } return &collection{ data: data, } } type collection struct { data map[string]interface{} } func (c *collection) Has(name string) bool { _, ok := c.data[name] return ok } func (c *collection) Get(name string) Variable { if value, ok := c.data[name]; ok { return New(value) } return New(nil) } func (c *collection) Set(name string, value interface{}) { c.data[name] = value } func (c *collection) AsMap() map[string]interface{} { return c.data } // MergeIn takes collection c2 and writes all of it's values to c, regardless of whether they already exist func (c *collection) MergeIn(c2 Collection) { for k, v := range c2.AsMap() { c.data[k] = v } } <|start_filename|>internal/pkg/log/prefixed.go<|end_filename|> package log import ( "fmt" "sync" ) type prefixedWriter struct { sync.Mutex logger *Logger buffer string } func NewPrefixedWriter(prefix string, operation string) *prefixedWriter { return &prefixedWriter{ logger: NewLogger(fmt.Sprintf("%s:%s", prefix, operation)), } } func (p *prefixedWriter) Flush() { if p.buffer == "" { return } p.logger.Log("%s", p.buffer) p.buffer = "" } func (p *prefixedWriter) Write(d []byte) (n int, err error) { p.Lock() defer p.Unlock() for _, r := range string(d) { if r == '\n' { p.Flush() continue } p.buffer += string(r) } return len(d), nil } <|start_filename|>internal/pkg/template/template_test.go<|end_filename|> package template import ( "bytes" "strings" "testing" "github.com/liamg/peridot/internal/pkg/variable" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) func TestVariables(t *testing.T) { raw := `hello {{ .test }}` input := variable.NewCollection(map[string]interface{}{ "test": "world", }) var output []byte buffer := bytes.NewBuffer(output) err := Apply(strings.NewReader(raw), buffer, input) require.NoError(t, err) assert.Equal(t, `hello world`, buffer.String()) } <|start_filename|>internal/pkg/module/module.go<|end_filename|> package module import ( "fmt" "github.com/liamg/peridot/internal/pkg/config" "github.com/liamg/peridot/internal/pkg/variable" ) type Module interface { Name() string Path() string Children() []Module Files() []File Validate() error RequiresUpdate() bool RequiresInstall() bool Install() error Update() error AfterFileChange() error } type module struct { conf config.Module children []Module files []File variables variable.Collection } func (m *module) Name() string { return m.conf.Name } func (m *module) Path() string { return m.conf.Dir } func (m *module) Children() []Module { return m.children } func (m *module) Files() []File { return m.files } func runScript(m Module, s config.Script, operation string) error { r := NewRunner(m, operation) return r.Run(s.Command, s.Sudo) } func (m *module) RequiresUpdate() bool { if m.conf.Scripts.UpdateRequired.Command == "" { return false } return runScript( m, m.conf.Scripts.UpdateRequired, "should_update", ) == nil } func (m *module) RequiresInstall() bool { if m.conf.Scripts.InstallRequired.Command == "" { return false } return runScript( m, m.conf.Scripts.InstallRequired, "should_install", ) == nil } func (m *module) Install() error { return runScript( m, m.conf.Scripts.Install, "install", ) } func (m *module) Update() error { return runScript( m, m.conf.Scripts.Update, "update", ) } func (m *module) AfterFileChange() error { if m.conf.Scripts.AfterFileChange.Command == "" { return nil } return runScript( m, m.conf.Scripts.AfterFileChange, "after_file_change", ) } func (m *module) Validate() error { for _, file := range m.conf.Files { if file.Target == "" { return fmt.Errorf("file has no target") } if file.Source == "" { return fmt.Errorf("file has no source") } } for _, v := range m.conf.Variables { if !v.Required { continue } if !m.variables.Has(v.Name) { return fmt.Errorf("module '%s' is missing a required variable '%s'", m.Name(), v.Name) } } return nil } <|start_filename|>internal/pkg/module/diff.module.go<|end_filename|> package module import ( "fmt" "github.com/liamg/peridot/internal/pkg/log" "github.com/liamg/tml" ) type moduleDiff struct { module Module fileDiffs []FileDiff before State after State } func (d *moduleDiff) Files() []FileDiff { return d.fileDiffs } func (d *moduleDiff) Module() Module { return d.module } func (d *moduleDiff) Before() State { return d.before } func (d *moduleDiff) After() State { return d.after } func (d *moduleDiff) Print(withContent bool) { for _, f := range d.fileDiffs { f.Print(withContent) } if d.before != d.after { switch d.after { case StateInstalled: tml.Printf("<green>[Module %s] Requires install.</green>\n", d.module.Name()) case StateUninstalled: tml.Printf("<red>[Module %s] Requires uninstall.</red>\n", d.module.Name()) case StateUpdated: tml.Printf("<yellow>[Module %s] Requires updated.</yellow>\n", d.module.Name()) } } } func (d *moduleDiff) Apply() error { logger := log.NewLogger(d.module.Name()) for _, f := range d.fileDiffs { if err := f.Apply(); err != nil { return err } } if d.after != d.before { switch d.after { case StateInstalled: logger.Log("Installing module...") if err := d.module.Install(); err != nil { return err } case StateUpdated: logger.Log("Updating module...") if err := d.module.Update(); err != nil { return err } case StateUninstalled: logger.Log("Uninstalling module...") return fmt.Errorf("uninstallation is currently not supported") default: return fmt.Errorf("cannot support state 0x%X for module %s", d.after, d.module.Name()) } } if len(d.fileDiffs) > 0 { logger.Log("Finalising module after file changes...") return d.module.AfterFileChange() } logger.Log("Application complete!...") return nil } <|start_filename|>internal/pkg/module/factory_test.go<|end_filename|> package module import ( "testing" "github.com/liamg/peridot/internal/pkg/variable" "github.com/stretchr/testify/assert" ) func TestFactorySetsModuleName(t *testing.T) { factory := NewFactory("example") built := factory.Build() assert.Equal(t, "example", built.Name()) } func TestFactorySetsHandlers(t *testing.T) { factory := NewFactory("example") var requiresInstall, requiresUpdate, install, update, after bool factory.WithRequiresInstallFunc(func(*Runner, variable.Collection) (bool, error) { requiresInstall = true return false, nil }) factory.WithRequiresUpdateFunc(func(*Runner, variable.Collection) (bool, error) { requiresUpdate = true return false, nil }) factory.WithInstallFunc(func(*Runner, variable.Collection) error { install = true return nil }) factory.WithUpdateFunc(func(*Runner, variable.Collection) error { update = true return nil }) factory.WithAfterFileChangeFunc(func(*Runner, variable.Collection) error { after = true return nil }) built := factory.Build() built.RequiresInstall() built.RequiresUpdate() _ = built.Install() _ = built.Update() _ = built.AfterFileChange() assert.True(t, requiresInstall, "RequiresInstall() was not configured") assert.True(t, requiresUpdate, "RequiresUpdate() was not configured") assert.True(t, install, "Install() was not configured") assert.True(t, update, "Update() was not configured") assert.True(t, after, "AfterFileChange() was not configured") } <|start_filename|>internal/pkg/cmd/init.go<|end_filename|> package cmd import ( "fmt" "os" "path/filepath" "github.com/liamg/peridot/internal/pkg/config" "github.com/liamg/tml" "github.com/spf13/cobra" ) func init() { var force bool initCmd := &cobra.Command{ Use: "init", Short: "Initialises a new peridot config for the local user environment.", Args: cobra.ExactArgs(0), Run: func(_ *cobra.Command, _ []string) { configPath, err := config.Path() if err != nil { fail(fmt.Sprintf("Cannot locate config path: %s", err)) } if _, err := os.Stat(configPath); err == nil { if force { if err := os.RemoveAll(filepath.Dir(configPath)); err != nil { fail(err) } } else { fail("Configuration already exists. Use --force to completely remove all peridot config and create a blank config.") } } else if !os.IsNotExist(err) { fail(err) } path, err := config.Init() if err != nil { fail(err) } tml.Printf("<green><bold>New configuration file and git repository initialised at %s</bold></green>\n", path) }, } initCmd.Flags().BoolVarP(&force, "force", "f", force, "Force peridot to overwrite an existing config and reinitialise a fresh one.") rootCmd.AddCommand(initCmd) } <|start_filename|>internal/pkg/cmd/root.go<|end_filename|> package cmd import ( "fmt" "os" _ "github.com/liamg/peridot/internal/pkg/builtins" "github.com/liamg/peridot/internal/pkg/log" "github.com/liamg/tml" "github.com/spf13/cobra" ) var rootCmd = &cobra.Command{ Use: "peridot", Short: "Manage dotfiles and user environments across machines, OSes, users and more.", PersistentPreRun: func(_ *cobra.Command, _ []string) { if disableANSI { tml.DisableFormatting() } if debugMode { log.Enable() } }, } var disableANSI bool var debugMode bool func init() { rootCmd.PersistentFlags().BoolVar(&disableANSI, "no-ansi", disableANSI, "Disable ANSI colour/formatting codes in output.") rootCmd.PersistentFlags().BoolVarP(&debugMode, "debug", "d", debugMode, "Enable debug output.") } func Execute() { if err := rootCmd.Execute(); err != nil { os.Exit(1) } } func fail(reason interface{}) { fmt.Fprintln(os.Stderr, tml.Sprintf("<red><bold>Error: %s</bold></red>", reason)) os.Exit(1) } <|start_filename|>internal/pkg/cmd/system.go<|end_filename|> package cmd import ( "github.com/liamg/peridot/internal/pkg/system" "github.com/liamg/tml" "github.com/spf13/cobra" ) func init() { systemCmd := &cobra.Command{ Use: "system", Short: "", Args: cobra.ExactArgs(0), Run: func(_ *cobra.Command, _ []string) { info := system.Info() tml.Printf("Architecture: <bold>%s</bold>\n", info.Architecture) tml.Printf("Operating System: <bold>%s</bold>\n", info.OperatingSystem) distro := info.Distribution if distro == "" { distro = "n/a" } tml.Printf("Distribution: <bold>%s</bold>\n", distro) }, } rootCmd.AddCommand(systemCmd) } <|start_filename|>test/setup_test.go<|end_filename|> package test import ( "bytes" "context" "errors" "fmt" "io" "io/ioutil" "os" "os/exec" "os/user" "path/filepath" "strings" "testing" "time" "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/container" "github.com/docker/docker/api/types/mount" "github.com/docker/docker/api/types/strslice" "github.com/docker/docker/client" "github.com/docker/docker/pkg/stdcopy" ) var testContainers []*testContainer const defaultUser = "someone" func TestMain(m *testing.M) { exitCode := func() int { cwd, err := os.Getwd() if err != nil { return 2 } cmd := exec.Command("go", "build", ".") cmd.Dir = filepath.Dir(cwd) cmd.Env = append(os.Environ(), "CGO_ENABLED=0") if err := cmd.Run(); err != nil { fmt.Fprintf(os.Stderr, "build failed: %s\n", err) return 1 } return m.Run() }() for _, container := range testContainers { container.Destroy() } os.Exit(exitCode) } type testContainer struct { id string hostDir string client *client.Client } func (t *testContainer) Destroy() { _ = t.client.ContainerRemove(context.Background(), t.id, types.ContainerRemoveOptions{ RemoveVolumes: true, Force: true, }) _ = os.RemoveAll(t.hostDir) } func (t *testContainer) AddPeridot() error { return t.AddFile("../peridot") } func (t *testContainer) AddFile(hostPath string) error { data, err := ioutil.ReadFile(hostPath) if err != nil { return err } target := filepath.Join(t.hostDir, filepath.Base(hostPath)) return ioutil.WriteFile(target, data, 0700) //nolint } func (t *testContainer) ReadHomeFile(relativePath string) (string, error) { _, exit, err := t.RunAsRoot("chmod", "-R", "777", ".") if err != nil { return "", err } if exit > 0 { return "", fmt.Errorf("chmod failed") } data, err := ioutil.ReadFile(filepath.Join(t.hostDir, relativePath)) return string(data), err } func (t *testContainer) WriteConfig(content string) error { return t.WriteHomeFile(".config/peridot/config.yml", content) } func (t *testContainer) WriteHomeFile(relativePath, content string) error { //nolint if err := os.MkdirAll(filepath.Join(t.hostDir, filepath.Dir(relativePath)), 0777); err != nil { return err } //nolint if err := ioutil.WriteFile(filepath.Join(t.hostDir, relativePath), []byte(content), 0777); err != nil { return err } return nil } func (t *testContainer) RunAsUser(cmd string, args ...string) (string, int, error) { return t.run(false, cmd, args...) } func (t *testContainer) RunAsRoot(cmd string, args ...string) (string, int, error) { return t.run(true, cmd, args...) } func (t *testContainer) run(root bool, cmd string, args ...string) (string, int, error) { user := defaultUser home := fmt.Sprintf("/home/%s", user) if root { user = "root" home = "/root" } fmt.Printf("Running command on %s: %s %s\n", t.id[:12], cmd, strings.Join(args, " ")) idResp, err := t.client.ContainerExecCreate(context.Background(), t.id, types.ExecConfig{ User: user, WorkingDir: home, Cmd: append([]string{cmd}, args...), AttachStderr: true, AttachStdout: true, Tty: true, }) if err != nil { return "", 0, err } resp, err := t.client.ContainerExecAttach(context.Background(), idResp.ID, types.ExecStartCheck{}) if err != nil { return "", 0, err } stdout := new(bytes.Buffer) if _, err := stdcopy.StdCopy(stdout, stdout, resp.Reader); err != nil && !errors.Is(err, io.EOF) { return "", 0, fmt.Errorf("copy failed: %w", err) } fmt.Println("Waiting for command...") inspect, err := t.client.ContainerExecInspect(context.Background(), idResp.ID) if err != nil { return "", 0, err } if inspect.Running { return "", 0, fmt.Errorf("command is still running") } if inspect.ExitCode > 0 { return stdout.String(), inspect.ExitCode, nil } return stdout.String(), inspect.ExitCode, nil } func (t *testContainer) Stop() error { timeout := time.Second * 3 return t.client.ContainerStop(context.Background(), t.id, &timeout) } //nolint func startContainer(image string) (*testContainer, error) { cli, err := client.NewClientWithOpts(client.FromEnv) if err != nil { return nil, err } tmpDir, err := ioutil.TempDir(os.TempDir(), "peridot-test") if err != nil { return nil, err } fmt.Printf("Created temp dir at %s for %s container.\n", tmpDir, image) if err := os.Chmod(tmpDir, 0777); err != nil { return nil, err } images, err := cli.ImageList(context.Background(), types.ImageListOptions{ All: true, }) if err != nil { return nil, err } var found bool for _, existing := range images { for _, tag := range existing.RepoTags { if tag == image || tag == fmt.Sprintf("%s:latest", image) { fmt.Printf("Found existing image for %s - no need to pull.\n", tag) found = true break } } } if !found { fmt.Printf("Pulling image '%s'...\n", image) reader, err := cli.ImagePull(context.Background(), image, types.ImagePullOptions{}) if err != nil { return nil, err } _, _ = io.Copy(io.Discard, reader) time.Sleep(time.Second) } containerName := fmt.Sprintf("peridot_%s", image) containers, err := cli.ContainerList(context.Background(), types.ContainerListOptions{All: true}) if err != nil { return nil, err } for _, existing := range containers { for _, name := range existing.Names { if len(name) > 0 && name[1:] == containerName { fmt.Printf("Removing old %s container: %s...\n", image, existing.ID) if err := cli.ContainerRemove(context.Background(), existing.ID, types.ContainerRemoveOptions{ RemoveVolumes: true, Force: true, }); err != nil { return nil, err } } } } fmt.Printf("Creating container for '%s'...\n", image) cont, err := cli.ContainerCreate( context.Background(), &container.Config{ Image: image, Tty: true, Cmd: strslice.StrSlice([]string{"sh"}), }, &container.HostConfig{ Mounts: []mount.Mount{ { Type: mount.TypeBind, Source: tmpDir, Target: fmt.Sprintf("/home/%s", defaultUser), }, }, }, nil, nil, containerName) if err != nil { return nil, err } fmt.Printf("Starting '%s' container...\n", image) if err := cli.ContainerStart(context.Background(), cont.ID, types.ContainerStartOptions{}); err != nil { return nil, err } created := &testContainer{ id: cont.ID, hostDir: tmpDir, client: cli, } testContainers = append(testContainers, created) if err := created.AddPeridot(); err != nil { return nil, err } _, exit, err := created.RunAsRoot("cp", fmt.Sprintf("/home/%s/peridot", defaultUser), "/usr/bin/") if err != nil { return nil, err } if exit > 0 { return nil, fmt.Errorf("failed to install peridot in container") } u, err := user.Current() if err != nil { return nil, err } _, exit, err = created.RunAsRoot("useradd", "-u", u.Uid, defaultUser) if err != nil { return nil, err } if exit > 0 { return nil, fmt.Errorf("failed to add user to container") } _, exit, err = created.RunAsRoot("sh", "-c", fmt.Sprintf(`apt update && apt install -y sudo && usermod -a -G sudo %s`, defaultUser)) if err != nil { return nil, err } if exit > 0 { return nil, fmt.Errorf("failed to add user to sudoers") } return created, nil } <|start_filename|>internal/pkg/module/filter.go<|end_filename|> package module import ( "github.com/liamg/peridot/internal/pkg/config" "github.com/liamg/peridot/internal/pkg/system" ) func filtersMatch(filters config.Filters) bool { sysInfo := system.Info() if len(filters.Architecture) > 0 { var found bool for _, arch := range filters.Architecture { if arch == sysInfo.Architecture { found = true break } } if !found { return false } } if len(filters.OperatingSystem) > 0 { var found bool for _, os := range filters.OperatingSystem { if os == sysInfo.OperatingSystem { found = true break } } if !found { return false } } if len(filters.Distribution) > 0 { var found bool for _, distro := range filters.Distribution { if distro == sysInfo.Distribution { found = true break } } if !found { return false } } return true } <|start_filename|>internal/pkg/module/factory.go<|end_filename|> package module import ( "github.com/liamg/peridot/internal/pkg/config" "github.com/liamg/peridot/internal/pkg/variable" ) type factory struct { base baseBuiltin } func NewFactory(name string) *factory { return &factory{ base: baseBuiltin{ name: name, }, } } func (f *factory) Build() BuiltIn { return &f.base } func (f *factory) WithInputs(inputs []config.Variable) *factory { f.base.inputs = inputs return f } func (f *factory) WithFilesFunc(fnc func(vars variable.Collection) []File) *factory { f.base.filesFunc = fnc return f } func (f *factory) WithRequiresUpdateFunc(fnc func(*Runner, variable.Collection) (bool, error)) *factory { f.base.requiresUpdateFunc = fnc return f } func (f *factory) WithRequiresInstallFunc(fnc func(*Runner, variable.Collection) (bool, error)) *factory { f.base.requiresInstallFunc = fnc return f } func (f *factory) WithUpdateFunc(fnc func(*Runner, variable.Collection) error) *factory { f.base.updateFunc = fnc return f } func (f *factory) WithInstallFunc(fnc func(*Runner, variable.Collection) error) *factory { f.base.installFunc = fnc return f } func (f *factory) WithAfterFileChangeFunc(fnc func(*Runner, variable.Collection) error) *factory { f.base.afterFileChangeFunc = fnc return f } <|start_filename|>internal/pkg/config/root.go<|end_filename|> package config import ( "fmt" "os" "path/filepath" "github.com/liamg/peridot/internal/pkg/log" "gopkg.in/yaml.v3" ) type Config struct { Dir string `yaml:"-"` Path string `yaml:"-"` Debug bool `yaml:"debug"` } type Override struct { Variables map[string]interface{} `yaml:"variables"` } func ParseRoot() (*Module, *Override, error) { logger := log.NewLogger("root") path, err := Path() if err != nil { return nil, nil, err } logger.Log("Using config path: %s", path) var override Override localPath := filepath.Join(filepath.Dir(path), localOverridesFilename) if _, err := os.Stat(localPath); err == nil { logger.Log("Found local overrides: %s", localPath) f, err := os.Open(localPath) if err != nil { return nil, nil, err } defer f.Close() if err := yaml.NewDecoder(f).Decode(&override); err != nil { return nil, nil, fmt.Errorf("error in %s: %w", localPath, err) } } else if !os.IsNotExist(err) { return nil, nil, err } base := BaseVariables() for key, val := range base.AsMap() { logger.Log("Base variable %s => %s", key, val) } mod, err := Parse(path, base) if err != nil { return nil, nil, err } return mod, &override, nil } <|start_filename|>internal/pkg/module/diff.go<|end_filename|> package module import ( "fmt" "io/ioutil" "os" "github.com/liamg/peridot/internal/pkg/log" ) type State uint8 const ( StateUnknown State = iota StateUninstalled StateInstalled StateUpdated ) type ModuleDiff interface { Module() Module Before() State After() State Print(withContent bool) Apply() error Files() []FileDiff } type FileDiff interface { Module() Module Path() string Operation() FileOperation Before() string After() string Print(withContent bool) Apply() error } func Diff(m Module) ([]ModuleDiff, error) { var fileDiffs []FileDiff var moduleDiffs []ModuleDiff logger := log.NewLogger(m.Name()) logger.Log("Checking module for required changes...") for _, file := range m.Files() { logger.Log("Comparing %s...", file.Target()) if err := func() error { diff := fileDiff{ module: m, path: file.Target(), operation: OpCreate, } targetFile, err := os.Open(file.Target()) if err == nil { content, err := ioutil.ReadAll(targetFile) if err != nil { return err } _ = targetFile.Close() diff.before = string(content) diff.operation = OpUpdate } after, err := file.RenderTemplate() if err != nil { return err } diff.after = after if diff.before != diff.after { logger.Log("Changes are required for %s!", diff.Path()) fileDiffs = append(fileDiffs, &diff) } return nil }(); err != nil { return nil, err } } // run scripts.update_required and scripts.install_required to see if update is needed switch { case m.RequiresInstall(): logger.Log("Installation is required!") moduleDiffs = append(moduleDiffs, &moduleDiff{ module: m, before: StateUninstalled, after: StateInstalled, fileDiffs: fileDiffs, }) case m.RequiresUpdate(): logger.Log("Update is required!") moduleDiffs = append(moduleDiffs, &moduleDiff{ module: m, before: StateInstalled, after: StateUpdated, fileDiffs: fileDiffs, }) case len(fileDiffs) > 0: logger.Log("Module has file(s) needing updates!") moduleDiffs = append(moduleDiffs, &moduleDiff{ module: m, before: StateInstalled, after: StateInstalled, fileDiffs: fileDiffs, }) } uniqueChildren := make(map[string]struct{}) for _, mod := range m.Children() { if _, exists := uniqueChildren[mod.Name()]; exists { return nil, fmt.Errorf("error in module '%s': multiple modules defined with the same name ('%s')", m.Name(), mod.Name()) } uniqueChildren[mod.Name()] = struct{}{} m, err := Diff(mod) if err != nil { return nil, err } moduleDiffs = append(moduleDiffs, m...) } var combinedDiffs []FileDiff for _, m := range moduleDiffs { combinedDiffs = append(combinedDiffs, m.Files()...) } filenames := make(map[string]string) for _, diff := range combinedDiffs { if existing, ok := filenames[diff.Path()]; ok { return nil, fmt.Errorf( "file '%s' must only be managed by a single module, but it is managed by both '%s' and '%s'", diff.Path(), existing, diff.Module().Name(), ) } filenames[diff.Path()] = diff.Module().Name() } return moduleDiffs, nil } <|start_filename|>internal/pkg/variable/list_test.go<|end_filename|> package variable import ( "testing" "github.com/stretchr/testify/assert" ) func TestList_All(t *testing.T) { tests := []struct { name string l List want []interface{} }{ { name: "empty", l: make(List, 0), want: []interface{}{}, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { actual := tt.l.All() assert.Equal(t, len(tt.want), len(actual)) for i, a := range actual { assert.Equal(t, tt.want[i], a.Interface()) } }) } } func TestList_Len(t *testing.T) { tests := []struct { name string l List want int }{ { name: "empty list", l: make(List, 0), want: 0, }, { name: "non-empty list", l: make(List, 1337), want: 1337, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if got := tt.l.Len(); got != tt.want { t.Errorf("List.Len() = %v, want %v", got, tt.want) } }) } } <|start_filename|>internal/pkg/module/builtin.go<|end_filename|> package module import ( "fmt" "os" "github.com/liamg/peridot/internal/pkg/config" "github.com/liamg/peridot/internal/pkg/log" "github.com/liamg/peridot/internal/pkg/variable" ) type baseBuiltin struct { name string inputs []config.Variable variables variable.Collection filesFunc func(variable.Collection) []File requiresInstallFunc func(*Runner, variable.Collection) (bool, error) requiresUpdateFunc func(*Runner, variable.Collection) (bool, error) installFunc func(*Runner, variable.Collection) error updateFunc func(*Runner, variable.Collection) error afterFileChangeFunc func(*Runner, variable.Collection) error } func (b *baseBuiltin) Name() string { return b.name } func (b *baseBuiltin) Clone(name string) BuiltIn { if b == nil { return nil } c := *b c.name = name return &c } func (b *baseBuiltin) Path() string { return os.TempDir() } func (b *baseBuiltin) Children() []Module { return nil } func (b *baseBuiltin) Files() []File { if b.filesFunc == nil { return nil } return b.filesFunc(b.variables) } func (b *baseBuiltin) Validate() error { return validateVariables(b.inputs, b.variables) } func (b *baseBuiltin) RequiresUpdate() bool { if b.requiresUpdateFunc == nil { return false } required, err := b.requiresUpdateFunc(NewRunner(b, "should_update"), b.variables) if err != nil { log.Debug("[%s] Non-zero exit checking if update was required: %s", b.Name(), err) } return required } func (b *baseBuiltin) RequiresInstall() bool { if b.requiresInstallFunc == nil { return false } required, err := b.requiresInstallFunc(NewRunner(b, "should_install"), b.variables) if err != nil { log.Debug("[%s] Non-zero exit checking if install was required: %s", b.Name(), err) } return required } func (b *baseBuiltin) Install() error { if b.installFunc == nil { return fmt.Errorf("install handler not implemented") } return b.installFunc(NewRunner(b, "install"), b.variables) } func (b *baseBuiltin) Update() error { if b.updateFunc == nil { return fmt.Errorf("update handler not implemented") } return b.updateFunc(NewRunner(b, "update"), b.variables) } func (b *baseBuiltin) AfterFileChange() error { if b.afterFileChangeFunc == nil { return nil } return b.afterFileChangeFunc(NewRunner(b, "after_file_change"), b.variables) } func (b *baseBuiltin) ApplyVariables(vars variable.Collection) { b.variables = applyVariableDefaults(b.inputs, vars) } <|start_filename|>internal/pkg/builtins/pacman.go<|end_filename|> package builtin import ( "fmt" "github.com/liamg/peridot/internal/pkg/config" "github.com/liamg/peridot/internal/pkg/module" "github.com/liamg/peridot/internal/pkg/variable" ) func init() { pacmanBuiltin := module.NewFactory("pacman"). WithInputs([]config.Variable{ { Name: "packages", Required: true, }, }). WithRequiresInstallFunc(func(r *module.Runner, vars variable.Collection) (bool, error) { for _, pkg := range vars.Get("packages").AsList().All() { if err := r.Run(fmt.Sprintf("pacman -Qi %s >/dev/null", pkg.AsString()), false); err != nil { return true, nil } } return false, nil }). WithInstallFunc(func(r *module.Runner, vars variable.Collection) error { if err := r.Run("pacman -Syy", true); err != nil { return fmt.Errorf("failed to sync package db: %w", err) } for _, pkg := range vars.Get("packages").AsList().All() { if err := r.Run(fmt.Sprintf("pacman -Qi %s >/dev/null", pkg.AsString()), false); err != nil { if err := r.Run(fmt.Sprintf("pacman -S --noconfirm %s", pkg.AsString()), true); err != nil { return err } } } return nil }). Build() module.RegisterBuiltin("pacman", pacmanBuiltin) } <|start_filename|>internal/pkg/builtins/yay.go<|end_filename|> package builtin import ( "fmt" "github.com/liamg/peridot/internal/pkg/config" "github.com/liamg/peridot/internal/pkg/module" "github.com/liamg/peridot/internal/pkg/variable" ) func init() { yayBuiltin := module.NewFactory("yay"). WithInputs([]config.Variable{ { Name: "packages", Required: true, }, }). WithRequiresInstallFunc(func(r *module.Runner, vars variable.Collection) (bool, error) { for _, pkg := range vars.Get("packages").AsList().All() { if err := r.Run(fmt.Sprintf("yay -Qi %s > /dev/null", pkg.AsString()), false); err != nil { return true, nil } } return false, nil }). WithInstallFunc(func(r *module.Runner, vars variable.Collection) error { if err := r.Run("yay -Syy", false); err != nil { return fmt.Errorf("failed to sync package db: %w", err) } for _, pkg := range vars.Get("packages").AsList().All() { if err := r.Run(fmt.Sprintf("yay -Qi %s >/dev/null", pkg.AsString()), false); err != nil { if err := r.Run(fmt.Sprintf("yay -S --noconfirm %s", pkg.AsString()), true); err != nil { return err } } } return nil }). Build() module.RegisterBuiltin("yay", yayBuiltin) }
liamg/peridot
<|start_filename|>src/dk/ative/docjure/core.clj<|end_filename|> (ns dk.ative.docjure.core) <|start_filename|>test/dk/ative/docjure/core_test.clj<|end_filename|> (ns dk.ative.docjure.core-test (:use [dk.ative.docjure.core] :reload-all) (:use [clojure.test]))
fvides/docjure
<|start_filename|>shower/themes/ribbon/styles/slide/content/inline.css<|end_filename|> /* Inline */ .slide a { background-image: linear-gradient( to top, currentColor 0.09em, transparent 0.09em ); background-repeat: repeat-x; color: var(--color-blue); text-decoration: none; } .slide code, .slide kbd, .slide mark, .slide samp { padding: 0.1em 0.3em; border-radius: 0.2em; } .slide code, .slide kbd, .slide samp { background: var(--color-fill); line-height: 1; font-family: 'PT Mono', monospace; } .slide mark { background: var(--color-yellow); } .slide sub, .slide sup { position: relative; vertical-align: baseline; line-height: 0; font-size: 75%; } .slide sub { bottom: -0.25em; } .slide sup { top: -0.5em; } <|start_filename|>shower/themes/material/styles/slide/content/code.css<|end_filename|> /* Code */ .slide pre { margin-top: 0; margin-bottom: 1em; counter-reset: code; white-space: normal; } /* Inner */ .slide pre code { display: block; margin-left: -96px; padding: 0 0 0 96px; width: calc(100% + 96px + 112px); background-color: transparent; line-height: 2; white-space: pre; tab-size: 4; } /* Line Numbers */ .slide pre code:not(:only-child)::before { position: absolute; margin-left: -2em; color: var(--color-light); counter-increment: code; content: counter(code, decimal-leading-zero) '.'; } /* Marked */ .slide pre mark { position: relative; z-index: -1; margin: 0 -0.3em; } /* Important */ .slide pre mark.important { background-color: var(--color-key); color: white; } /* Comment */ .slide pre .comment { color: var(--color-medium); } /* Marked Line */ .slide pre code.mark:not(:only-child) { background-color: var(--color-back); } /* Next Line */ .slide pre code.mark.next:not(:only-child) { visibility: visible; background-color: transparent; } .slide pre code.mark.next.active:not(:only-child) { background-color: var(--color-back); } /* Full */ .shower.full .slide pre code:not(:only-child).mark.next { visibility: visible; background-color: transparent; } .shower.full .slide pre code:not(:only-child).mark.next.active { background-color: var(--color-back); }
OlegPanasyuk/sequelize2
<|start_filename|>ZombustersWindows/MainScreens/GamePlayScreen.cs<|end_filename|> using System; using System.Collections.Generic; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Input; using GameStateManagement; using System.Globalization; using ZombustersWindows.Subsystem_Managers; using Microsoft.Xna.Framework.Input.Touch; using ZombustersWindows.MainScreens; using ZombustersWindows.Localization; using System.Xml.Linq; using ZombustersWindows.GameObjects; using GameAnalyticsSDK.Net; namespace ZombustersWindows { public class GamePlayScreen : BackgroundScreen { private const string FRAME_WIDTH = "FrameWidth"; private const string FRAME_HEIGHT = "FrameHeight"; private const string SHEET_COLUMNS = "SheetColumns"; private const string SHEET_ROWS = "SheetRows"; private const string SPEED = "Speed"; private const int MACHINEGUN_RATE_OF_FIRE = 10; private const int FLAMETHROWER_RATE_OF_FIRE = 15; private const float SHOTGUN_RATE_OF_FIRE = 0.8f; readonly MyGame game; Rectangle uiBounds; MouseState mouseState; readonly InputState input = new InputState(); private readonly GamePlayMenu menu = null; private readonly GameOverMenu gomenu = null; private bool bPaused = false; public Vector2 accumMove, accumFire; public Texture2D Map; public List<Player> PlayersInSession; public Level Level; private LevelType currentLevel; private SubLevel.SubLevelType currentSublevel; Texture2D bullet; Vector2 bulletorigin; Texture2D flamethrowerTexture; Animation flamethrowerAnimation; List<Texture2D> IdleTrunkTexture, IdleLegsTexture, DiedTexture; List<Texture2D> RunEastTexture; List<Texture2D> PistolShotEastTexture, PistolShotNETexture, PistolShotSETexture, PistolShotNorthTexture, PistolShotSouthTexture; List<Texture2D> ShotgunEastTexture, ShotgunNETexture, ShotgunSETexture, ShotgunNorthTexture, ShotgunSouthTexture; List<Vector2> IdleTrunkOrigin, RunEastOrigin; List<Vector2> PistolShotEastOrigin, PistolShotNEOrigin, PistolShotSEOrigin, PistolShotNorthOrigin, PistolShotSouthOrigin; List<Vector2> ShotgunShotEastOrigin, ShotgunNEOrigin, ShotgunSEOrigin, ShotgunNorthOrigin, ShotgunSouthOrigin; List<Animation> IdleTrunkAnimation; List<Animation> RunEastAnimation; List<Animation> PistolShotEastAnimation, PistolShotNEAnimation, PistolShotSEAnimation, PistolShotNorthAnimation, PistolShotSouthAnimation; List<Animation> MachinegunEastAnimation, MachinegunNEAnimation, MachinegunSEAnimation, MachinegunNorthAnimation, MachinegunSouthAnimation; List<Animation> ShotgunShotEastAnimation, ShotgunNEAnimation, ShotgunSEAnimation, ShotgunNorthAnimation, ShotgunSouthAnimation; #if DEBUG Texture2D PositionReference; #endif Texture2D CharacterShadow; Texture2D cursorTexture; private Vector2 cursorPos; Texture2D UIStats, jadeUI, rayUI, peterUI, richardUI, whiteLine; Texture2D UIStatsBlue, UIStatsRed, UIStatsGreen, UIStatsYellow, UIPlayerBlue, UIPlayerRed, UIPlayerGreen, UIPlayerYellow; SpriteFont arcade14, arcade28; SpriteFont MenuHeaderFont, MenuInfoFont, MenuListFont; Texture2D pause_icon; Texture2D left_thumbstick; Texture2D right_thumbstick; public Random random = new Random(16); private float timer, timerplayer; private int subLevelIndex; public Enemies enemies; public GameplayState GamePlayStatus = GameplayState.NotPlaying; public GamePlayScreen(MyGame game, LevelType startingLevel, SubLevel.SubLevelType startingSublevel) : base() { this.game = game; enemies = new Enemies(ref game, ref random); this.currentLevel = startingLevel; this.currentSublevel = startingSublevel; #if DEBUG //this.currentSublevel = CSubLevel.SubLevel.Ten; #endif menu = new GamePlayMenu(); menu.MenuOptionSelected += new EventHandler<MenuSelection>(GameplayMenuOptionSelected); menu.MenuCanceled += new EventHandler<MenuSelection>(GameplayMenuCanceled); gomenu = new GameOverMenu(); gomenu.GameOverMenuOptionSelected += new EventHandler<MenuSelection>(GameOverMenuOptionSelected); } private int activeSeekers; public int ActiveSeekers { get { return activeSeekers; } set { activeSeekers = value; } } void GameplayMenuCanceled(Object sender, MenuSelection selection) { // Do nothing, game will resume on its own } void ConfirmExitMessageBoxAccepted(object sender, PlayerIndexEventArgs e) { QuitToMenu(); } void GameplayMenuOptionSelected(Object sender, MenuSelection selection) { switch (selection.Selection) { case 0: // Resume break; case 1: // Help GameAnalytics.AddDesignEvent("Gameplay:Menu:HowToPlay"); ScreenManager.AddScreen(new HowToPlayScreen()); break; case 2: // Options GameAnalytics.AddDesignEvent("Gameplay:Menu:Options"); game.DisplayOptions(0); break; case 3: // Restart GameAnalytics.AddDesignEvent("Gameplay:Menu:RestartGame"); game.Restart(); timer = 0; bPaused = game.EndPause(); GamePlayStatus = GameplayState.StartLevel; StartNewLevel(true, false); break; case 4: // Quit GameAnalytics.AddDesignEvent("Gameplay:Menu:QuitGame"); MessageBoxScreen confirmExitMessageBox = new MessageBoxScreen(Strings.GPReturnToMainMenuString, Strings.ConfirmReturnMainMenuString); confirmExitMessageBox.Accepted += ConfirmExitMessageBoxAccepted; ScreenManager.AddScreen(confirmExitMessageBox); break; default: break; } } void GameOverMenuOptionSelected(Object sender, MenuSelection selection) { switch (selection.Selection) { case 0: // Restart WAVE GameAnalytics.AddDesignEvent("Gameplay:GameOverMenu:RestartWave"); game.Restart(); timer = 0; bPaused = game.EndPause(); GamePlayStatus = GameplayState.StartLevel; StartNewLevel(true, true); break; case 1: // Restart LEVEL GameAnalytics.AddDesignEvent("Gameplay:GameOverMenu:RestartLevel"); game.Restart(); timer = 0; bPaused = game.EndPause(); GamePlayStatus = GameplayState.StartLevel; StartNewLevel(true, false); break; case 2: // Quit GameAnalytics.AddDesignEvent("Gameplay:GameOverMenu:QuitGame"); MessageBoxScreen confirmExitMessageBox = new MessageBoxScreen(Strings.GPReturnToMainMenuString, Strings.ConfirmReturnMainMenuString); confirmExitMessageBox.Accepted += ConfirmExitMessageBoxAccepted; ScreenManager.AddScreen(confirmExitMessageBox); break; default: break; } } public void QuitToMenu() { foreach (Player player in game.players) { player.avatar.Reset(); player.isReady = false; } GameScreen[] screenList = ScreenManager.GetScreens(); for (int i = screenList.Length -1; i > 0; i--) { screenList[i].ExitScreen(); } } public override void Initialize() { GamePlayStatus = GameplayState.StartLevel; uiBounds = GetTitleSafeArea(); Level = new Level(currentLevel); Level.Initialize(game); StartNewLevel(true, true); base.Initialize(); } public override void LoadContent() { XDocument animationDefinitionDocument = XDocument.Load(AppContext.BaseDirectory + "/Content/AnimationDef.xml"); DiedTexture = new List<Texture2D> { game.Content.Load<Texture2D>(@"InGame/Jade/girl_died"), game.Content.Load<Texture2D>(@"InGame/Egon/egon_died"), game.Content.Load<Texture2D>(@"InGame/Ray/ray_died"), game.Content.Load<Texture2D>(@"InGame/Peter/peter_died") }; JadeIdleTrunkAnimationLoad(animationDefinitionDocument); JadeRunEastAnimationLoad(animationDefinitionDocument); JadePistolShotEastAnimationLoad(animationDefinitionDocument); JadePistolShotNorthEastAnimationLoad(animationDefinitionDocument); JadePistolShotSouthEastAnimationLoad(animationDefinitionDocument); JadePistolShotSouthAnimationLoad(animationDefinitionDocument); JadePistolShotNorthAnimationLoad(animationDefinitionDocument); JadeShotgunShotEastAnimationLoad(animationDefinitionDocument); JadeShotgunShotNorthEastAnimationLoad(animationDefinitionDocument); JadeShotgunShotSouthEastAnimationLoad(animationDefinitionDocument); JadeShotgunShotSouthAnimationLoad(animationDefinitionDocument); JadeShotgunShotNorthAnimationLoad(animationDefinitionDocument); EgonIdleTrunkAnimationLoad(animationDefinitionDocument); EgonRunEastAnimationLoad(animationDefinitionDocument); EgonPistolShotEastAnimationLoad(animationDefinitionDocument); EgonPistolShotNorthEastAnimationLoad(animationDefinitionDocument); EgonPistolShotSouthEastAnimationLoad(animationDefinitionDocument); EgonPistolShotSouthAnimationLoad(animationDefinitionDocument); EgonPistolShotNorthAnimationLoad(animationDefinitionDocument); EgonShotgunShotEastAnimationLoad(animationDefinitionDocument); EgonShotgunShotNorthEastAnimationLoad(animationDefinitionDocument); EgonShotgunShotSouthEastAnimationLoad(animationDefinitionDocument); EgonShotgunShotSouthAnimationLoad(animationDefinitionDocument); EgonShotgunShotNorthAnimationLoad(animationDefinitionDocument); RayIdleTrunkAnimationLoad(animationDefinitionDocument); RayRunEastAnimationLoad(animationDefinitionDocument); RayPistolShotEastAnimationLoad(animationDefinitionDocument); RayPistolShotNorthEastAnimationLoad(animationDefinitionDocument); RayPistolShotSouthEastAnimationLoad(animationDefinitionDocument); RayPistolShotSouthAnimationLoad(animationDefinitionDocument); RayPistolShotNorthAnimationLoad(animationDefinitionDocument); RayShotgunShotEastAnimationLoad(animationDefinitionDocument); RayShotgunShotNorthEastAnimationLoad(animationDefinitionDocument); RayShotgunShotSouthEastAnimationLoad(animationDefinitionDocument); RayShotgunShotSouthAnimationLoad(animationDefinitionDocument); RayShotgunShotNorthAnimationLoad(animationDefinitionDocument); PeterIdleTrunkAnimationLoad(animationDefinitionDocument); PeterRunEastAnimationLoad(animationDefinitionDocument); PeterPistolShotEastAnimationLoad(animationDefinitionDocument); PeterPistolShotNorthEastAnimationLoad(animationDefinitionDocument); PeterPistolShotSouthEastAnimationLoad(animationDefinitionDocument); PeterPistolShotSouthAnimationLoad(animationDefinitionDocument); PeterPistolShotNorthAnimationLoad(animationDefinitionDocument); PeterShotgunShotEastAnimationLoad(animationDefinitionDocument); PeterShotgunShotNorthEastAnimationLoad(animationDefinitionDocument); PeterShotgunShotSouthEastAnimationLoad(animationDefinitionDocument); PeterShotgunShotSouthAnimationLoad(animationDefinitionDocument); PeterShotgunShotNorthAnimationLoad(animationDefinitionDocument); FlamethrowerAnimationLoad(animationDefinitionDocument); FontsLoad(); UIStatsLoad(); UIComponentsLoad(); enemies.LoadContent(game.Content); FurnitureLoad(); base.LoadContent(); } #region Input Processing public override void HandleInput(InputState input) { foreach (Player player in game.players) { if (player.IsPlaying) { player.neutralInput = ProcessPlayer(player, input); } } // Read in our gestures foreach (GestureSample gesture in input.GetGestures()) { // If we have a tap if (gesture.GestureType == GestureType.Tap) { // Pause Game if ((gesture.Position.X >= 1088 && gesture.Position.X <= 1135) && (gesture.Position.Y >= 39 && gesture.Position.Y <= 83)) { if (!bPaused && (GamePlayStatus != GameplayState.StartLevel && GamePlayStatus != GameplayState.StageCleared)) { this.ScreenManager.AddScreen(menu); // Use this to keep from adding more than one menu to the stack bPaused = game.BeginPause(); GamePlayStatus = GameplayState.Pause; } } } } mouseState = Mouse.GetState(); base.HandleInput(input); } private NeutralInput ProcessPlayer(Player player, InputState input) { NeutralInput state = new NeutralInput { GamePadFire = Vector2.Zero }; Vector2 stickLeft = Vector2.Zero; Vector2 stickRight = Vector2.Zero; GamePadState gpState = input.GetCurrentGamePadStates()[(int)player.playerIndex]; // Get gamepad state if (VirtualThumbsticks.LeftThumbstick != Vector2.Zero || VirtualThumbsticks.RightThumbstick != Vector2.Zero) { stickLeft = VirtualThumbsticks.LeftThumbstick; stickRight = VirtualThumbsticks.RightThumbstick; state.GamePadFire = VirtualThumbsticks.RightThumbstick; } else { stickLeft = gpState.ThumbSticks.Left; stickRight = gpState.ThumbSticks.Right; //state.Fire = (gpState.Triggers.Right > 0); state.GamePadFire = gpState.ThumbSticks.Right; } if (player.inputMode == InputMode.Keyboard) { if (input.IsNewKeyPress(Keys.Left)) { stickLeft += new Vector2(-1, 0); } if (input.IsNewKeyPress(Keys.Right)) { stickLeft += new Vector2(1, 0); } if (input.IsNewKeyPress(Keys.Up)) { stickLeft += new Vector2(0, 1); } if (input.IsNewKeyPress(Keys.Down)) { stickLeft += new Vector2(0, -1); } if (input.GetCurrentMouseState().LeftButton == ButtonState.Pressed) { MouseState mouseState = input.GetCurrentMouseState(); if (mouseState.X > player.avatar.position.X && (mouseState.X - player.avatar.position.X >=100)) { state.MouseFire += new Vector2(1, 0); // Right } if (mouseState.Y < player.avatar.position.Y && (player.avatar.position.Y - mouseState.Y >= 100)) { state.MouseFire += new Vector2(0, 1); // Down } if (mouseState.X < player.avatar.position.X && (player.avatar.position.X - mouseState.X >= 100)) { state.MouseFire += new Vector2(-1, 0); // Left } if (mouseState.Y >= player.avatar.position.Y && (mouseState.Y - player.avatar.position.Y >= 100)) { state.MouseFire += new Vector2(0, -1); // Top } } } if (input.IsNewButtonPress(Buttons.Y, player.playerIndex) || (player.inputMode == InputMode.Keyboard && input.IsNewKeyPress(Keys.LeftControl)) || (player.inputMode == InputMode.Keyboard && input.IsNewKeyPress(Keys.E))) { state.ButtonY = true; } else { state.ButtonY = false; } if (input.IsNewButtonPress(Buttons.RightShoulder, player.playerIndex) || input.IsNewKeyPress(Keys.Tab)) { state.ButtonRB = true; } else { state.ButtonRB = false; } state.StickLeftMovement = stickLeft; state.StickRightMovement = stickRight; return state; } #endregion public override void Update(GameTime gameTime, bool otherScreenHasFocus, bool coveredByOtherScreen) { cursorPos = new Vector2(mouseState.X, mouseState.Y); input.Update(); foreach (Player player in game.players) { if ((GamePad.GetState(player.playerIndex).Buttons.Start == ButtonState.Pressed) || input.IsNewKeyPress(Keys.Escape) || input.IsNewKeyPress(Keys.Back)) { if (!bPaused && (GamePlayStatus != GameplayState.StartLevel && GamePlayStatus != GameplayState.StageCleared)) { this.ScreenManager.AddScreen(menu); bPaused = game.BeginPause(); GamePlayStatus = GameplayState.Pause; return; } } } bool hidden = coveredByOtherScreen || otherScreenHasFocus; // If the user covers this screen, pause. if (hidden && !game.IsPaused && (GamePlayStatus != GameplayState.StartLevel && GamePlayStatus != GameplayState.StageCleared)) { bPaused = game.BeginPause(); } if (!hidden && (game.IsPaused)) { bPaused = game.EndPause(); GamePlayStatus = GameplayState.Playing; } if (game.currentGameState == GameState.InGame) { if (GamePlayStatus == GameplayState.Playing) { if (!game.IsPaused) { UpdatePlayerPlaying(gameTime); } UpdatePlayersAnimations(gameTime); flamethrowerAnimation.Update(gameTime); enemies.Update(ref gameTime, game); foreach (Player player in game.players) { if (player.avatar.IsPlayingTheGame) { HandleCollisions(player, game.totalGameSeconds); } } if (CheckIfStageCleared() == true) { GamePlayStatus = GameplayState.StageCleared; GameAnalytics.AddProgressionEvent(EGAProgressionStatus.Complete, currentLevel.ToString(), currentSublevel.ToString()); } } else if (GamePlayStatus == GameplayState.StageCleared) { UpdatePlayerPlaying(gameTime); UpdatePlayersAnimations(gameTime); enemies.Update(ref gameTime, game); foreach (Player player in game.players) { if (player.avatar.IsPlayingTheGame) { HandleCollisions(player, game.totalGameSeconds); } } ChangeGamplayStatusAfterSomeTimeTo(gameTime, GameplayState.StartLevel); } else if (GamePlayStatus == GameplayState.StartLevel) { UpdatePlayerPlaying(gameTime); UpdatePlayersAnimations(gameTime); foreach (Player player in game.players) { if (player.avatar.IsPlayingTheGame) { HandleCollisions(player, game.totalGameSeconds); } } ChangeGamplayStatusAfterSomeTimeTo(gameTime, GameplayState.Playing); } else if (GamePlayStatus == GameplayState.GameOver) { if (currentLevel == LevelType.EndGame) { timer += (float)gameTime.ElapsedGameTime.TotalSeconds; if (timer >= 5.0f) { foreach (Player player in game.players) { if (player.IsPlaying) { if (game.topScoreListContainer != null) { player.SaveLeaderBoard(); } } } QuitToMenu(); ScreenManager.AddScreen(new CreditsScreen(false)); } } else if(currentLevel == LevelType.EndDemo) { foreach (Player player in game.players) { if (player.IsPlaying) { if (game.topScoreListContainer != null) { player.SaveLeaderBoard(); } } } QuitToMenu(); ScreenManager.AddScreen(new DemoEndingScreen()); } } enemies.UpdatePowerUps(ref gameTime, game); foreach (Furniture furniture in Level.furnitureList) { if (furniture.Type == FurnitureType.CocheArdiendo) { furniture.Update(gameTime); } } } base.Update(gameTime, otherScreenHasFocus, coveredByOtherScreen); } private void ChangeGamplayStatusAfterSomeTimeTo(GameTime gameTime, GameplayState gameplayState) { timer += (float)gameTime.ElapsedGameTime.TotalSeconds; if (timer >= 2.0f) { GamePlayStatus = gameplayState; timer = 0; if (gameplayState == GameplayState.StartLevel) { StartNewLevel(false, false); } } } private void UpdatePlayersAnimations(GameTime gameTime) { for (byte i = 0; i < IdleTrunkAnimation.Count; i++) { IdleTrunkAnimation[i].Update(gameTime); PistolShotEastAnimation[i].Update(gameTime); MachinegunEastAnimation[i].Update(gameTime); RunEastAnimation[i].Update(gameTime); PistolShotNEAnimation[i].Update(gameTime); PistolShotSEAnimation[i].Update(gameTime); PistolShotSouthAnimation[i].Update(gameTime); PistolShotNorthAnimation[i].Update(gameTime); MachinegunNEAnimation[i].Update(gameTime); MachinegunSEAnimation[i].Update(gameTime); MachinegunNorthAnimation[i].Update(gameTime); MachinegunSouthAnimation[i].Update(gameTime); ShotgunShotEastAnimation[i].Update(gameTime); ShotgunNEAnimation[i].Update(gameTime); ShotgunSEAnimation[i].Update(gameTime); ShotgunNorthAnimation[i].Update(gameTime); ShotgunSouthAnimation[i].Update(gameTime); } } private void UpdatePlayerPlaying(GameTime gameTime) { foreach (Player player in game.players) { UpdatePlayer(player, game.totalGameSeconds, (float)gameTime.ElapsedGameTime.TotalSeconds, player.neutralInput); } } #region Player-centric code public void UpdatePlayer(Player player, float totalGameSeconds, float elapsedGameSeconds, NeutralInput input) { if ((player.avatar.status == ObjectStatus.Active) || (player.avatar.status == ObjectStatus.Immune)) { ProcessInput(player, totalGameSeconds, elapsedGameSeconds, input); } } public void ProcessInput(Player player, float totalGameSeconds, float elapsedGameSeconds, NeutralInput input) { if (player.inputMode == InputMode.GamePad) { if (input.StickLeftMovement.X > 0) accumMove.X += GameplayHelper.Move(input.StickLeftMovement.X, elapsedGameSeconds); if (input.StickLeftMovement.X < 0) accumMove.X -= GameplayHelper.Move(-input.StickLeftMovement.X, elapsedGameSeconds); if (input.StickLeftMovement.Y > 0) accumMove.Y -= GameplayHelper.Move(input.StickLeftMovement.Y, elapsedGameSeconds); if (input.StickLeftMovement.Y < 0) accumMove.Y += GameplayHelper.Move(-input.StickLeftMovement.Y, elapsedGameSeconds); if (input.StickRightMovement.X > 0) accumFire.X += GameplayHelper.Move(input.StickRightMovement.X, elapsedGameSeconds); if (input.StickRightMovement.X < 0) accumFire.X -= GameplayHelper.Move(-input.StickRightMovement.X, elapsedGameSeconds); if (input.StickRightMovement.Y > 0) accumFire.Y -= GameplayHelper.Move(input.StickRightMovement.Y, elapsedGameSeconds); if (input.StickRightMovement.Y < 0) accumFire.Y += GameplayHelper.Move(-input.StickRightMovement.Y, elapsedGameSeconds); input.GamePadFire.Normalize(); if ((input.GamePadFire.X >= 0 || input.GamePadFire.X <= 0) || (input.GamePadFire.Y >= 0 || input.GamePadFire.Y <= 0)) { //float angle = 0.0f; //angle = (float)Math.Acos(input.Fire.Y); //if (input.Fire.X < 0.0f) // angle = -angle; Vector2 direction = Vector2.Normalize(input.GamePadFire); float angle = (float)Math.Atan2(input.GamePadFire.X, input.GamePadFire.Y); player.avatar.shotAngle = angle; TryFire(player, totalGameSeconds, angle, direction); } } if (player.inputMode == InputMode.Keyboard) { if (Keyboard.GetState().IsKeyDown(Keys.Right) || Keyboard.GetState().IsKeyDown(Keys.D)) accumMove.X += GameplayHelper.Move(1, elapsedGameSeconds); if (Keyboard.GetState().IsKeyDown(Keys.Left) || Keyboard.GetState().IsKeyDown(Keys.A)) accumMove.X -= GameplayHelper.Move(1, elapsedGameSeconds); if (Keyboard.GetState().IsKeyDown(Keys.Down) || Keyboard.GetState().IsKeyDown(Keys.S)) accumMove.Y += GameplayHelper.Move(1, elapsedGameSeconds); if (Keyboard.GetState().IsKeyDown(Keys.Up) || Keyboard.GetState().IsKeyDown(Keys.W)) accumMove.Y -= GameplayHelper.Move(1, elapsedGameSeconds); if (Mouse.GetState().X > 0 && Mouse.GetState().LeftButton == ButtonState.Pressed) accumFire.X += GameplayHelper.Move(Mouse.GetState().X, elapsedGameSeconds); if (Mouse.GetState().X < 0 && Mouse.GetState().LeftButton == ButtonState.Pressed) accumFire.X -= GameplayHelper.Move(-Mouse.GetState().X, elapsedGameSeconds); if (Mouse.GetState().Y > 0 && Mouse.GetState().LeftButton == ButtonState.Pressed) accumFire.Y -= GameplayHelper.Move(Mouse.GetState().Y, elapsedGameSeconds); if (Mouse.GetState().Y < 0 && Mouse.GetState().LeftButton == ButtonState.Pressed) accumFire.Y += GameplayHelper.Move(-Mouse.GetState().Y, elapsedGameSeconds); input.MouseFire.Normalize(); if ((input.MouseFire.X >= 0 || input.MouseFire.X <= 0) || (input.MouseFire.Y >= 0 || input.MouseFire.Y <= 0)) { Vector2 direction = Vector2.Normalize(input.MouseFire); float angle = (float)Math.Atan2(input.MouseFire.X, input.MouseFire.Y); player.avatar.shotAngle = angle; TryFire(player, totalGameSeconds, angle, direction); } } player.avatar.accumFire = accumFire; TryMove(player); if (input.ButtonY == true) { if (player.avatar.currentgun == GunType.pistol) { player.avatar.currentgun = GunType.machinegun; } else if (player.avatar.currentgun == GunType.machinegun) { player.avatar.currentgun = GunType.shotgun; } else if (player.avatar.currentgun == GunType.shotgun) { player.avatar.currentgun = GunType.flamethrower; } else if (player.avatar.currentgun == GunType.flamethrower) { player.avatar.currentgun = GunType.pistol; } else { player.avatar.currentgun = GunType.pistol; } timerplayer = 0; } if (input.ButtonRB == true) { timerplayer = 0; } accumFire = Vector2.Zero; } public void HandleCollisions(Player player, float totalGameSeconds) { if (player.avatar.status == ObjectStatus.Inactive) return; enemies.HandleCollisions(player, totalGameSeconds); if (player.avatar.lives == 0) { GamePlayStatus = GameplayState.GameOver; GameAnalytics.AddProgressionEvent(EGAProgressionStatus.Fail, currentLevel.ToString(), currentSublevel.ToString()); this.ScreenManager.AddScreen(gomenu); } } private void TryMove(Player player) { bool collision = false; player.avatar.accumMove = accumMove; if (accumMove.Length() > .5) { Vector2 move = player.avatar.VerifyMove(accumMove); Vector2 pos = player.avatar.position + move; for (int i = 0; i < Level.gameWorld.Obstacles.Count; i++) { float rangeDistance; if (Level.gameWorld.Obstacles[i].Radius == 5.0f) { rangeDistance = 10.0f; } else if (Level.gameWorld.Obstacles[i].Radius == 10.0f) { rangeDistance = 15.0f; } else if (Level.gameWorld.Obstacles[i].Radius == 20.0f) { rangeDistance = 30.0f; } else { rangeDistance = 45.0f; } if (Vector2.Distance(pos, Level.gameWorld.Obstacles[i].Center) < rangeDistance) { collision = true; } } for (int i = 0; i < Level.gameWorld.Walls.Count; i++) { float actualDistance = GameplayHelper.DistanceLineSegmentToPoint(Level.gameWorld.Walls[i].From, Level.gameWorld.Walls[i].To, pos); if (actualDistance <= 5.0f) { collision = true; } } if (!collision) { PlayerMove(player, pos); } accumMove = Vector2.Zero; } } private void TryFire(Player player, float TotalGameSeconds, float angle, Vector2 direction) { float RateOfFire; if (player.avatar.status != ObjectStatus.Active && player.avatar.status != ObjectStatus.Immune) return; // Check if we have ammo; if not we change the current gun to pistol if (player.avatar.ammo[(int)player.avatar.currentgun] == 0 && player.avatar.currentgun != GunType.pistol) { player.avatar.currentgun = GunType.pistol; timerplayer = 0; } if (player.avatar.currentgun == GunType.machinegun && player.avatar.ammo[(int)GunType.machinegun] > 0) { RateOfFire = MACHINEGUN_RATE_OF_FIRE; } else if (player.avatar.currentgun == GunType.flamethrower && player.avatar.ammo[(int)GunType.flamethrower] > 0) { RateOfFire = FLAMETHROWER_RATE_OF_FIRE; } else if (player.avatar.currentgun == GunType.shotgun && player.avatar.ammo[(int)GunType.shotgun] > 0) { RateOfFire = SHOTGUN_RATE_OF_FIRE; } else { RateOfFire = player.avatar.RateOfFire; } if (player.avatar.currentgun == GunType.pistol || (player.avatar.currentgun != GunType.pistol && player.avatar.ammo[(int)player.avatar.currentgun] > 0)) { if (player.avatar.VerifyFire(TotalGameSeconds, RateOfFire)) { PlayerFire(player, TotalGameSeconds, angle, direction); } } } #endregion public Boolean CheckIfStageCleared() { int enemiesLeft = enemies.Count(); if (enemiesLeft <= 0) { return true; } else { return false; } } public void StartNewLevel(bool restartLevel, bool restartWave) { int howManySpawnZones = 4; List<int> numplayersIngame = new List<int>(); float lIndex = 0.8f; FurnitureComparer furnitureComparer = new FurnitureComparer(); this.random = new Random(16); if (!restartLevel) { if (subLevelIndex == 9) { currentLevel = Level.GetNextLevel(currentLevel); if (currentLevel == LevelType.EndGame || currentLevel == LevelType.EndDemo) { GamePlayStatus = GameplayState.GameOver; GameAnalytics.AddProgressionEvent(EGAProgressionStatus.Undefined, currentLevel.ToString(), currentSublevel.ToString()); } else { Level = new Level(currentLevel); Level.Initialize(game); Map = game.Content.Load<Texture2D>(Level.mapTextureFileName); subLevelIndex = 0; foreach (Furniture furniture in Level.furnitureList) { furniture.Load(game); } Level.furnitureList.Sort(furnitureComparer); // Apply layer index to sorted list foreach (Furniture furniture in Level.furnitureList) { furniture.layerIndex = lIndex; lIndex -= 0.004f; } for (int i = 0; i < game.players.Length - 1; i++) { game.players[i].avatar.position = Level.PlayerSpawnPosition[i]; game.players[i].avatar.entity.Position = Level.PlayerSpawnPosition[i]; } foreach (Player player in game.players) { if (player.IsPlaying) { player.SaveGame(Level.getLevelNumber(currentLevel)); } } } } else { subLevelIndex++; } } else { if (!restartWave) { subLevelIndex = 0; } for (int i = 0; i < game.players.Length; i++) { game.players[i].avatar.position = Level.PlayerSpawnPosition[i]; game.players[i].avatar.entity.Position = Level.PlayerSpawnPosition[i]; } } enemies.Clear(); if (currentLevel != LevelType.EndGame && currentLevel != LevelType.EndDemo) { for (int i = 0; i < game.players.Length; i++) { game.players[i].avatar.behaviors.AddBehavior(new ObstacleAvoidance(ref Level.gameWorld, 15.0f)); if (game.players[i].avatar.status == ObjectStatus.Active || game.players[i].avatar.status == ObjectStatus.Immune) { numplayersIngame.Add(i); } } switch (subLevelIndex) { case 0: currentSublevel = SubLevel.SubLevelType.One; break; case 1: currentSublevel = SubLevel.SubLevelType.Two; break; case 2: currentSublevel = SubLevel.SubLevelType.Three; break; case 3: currentSublevel = SubLevel.SubLevelType.Four; break; case 4: currentSublevel = SubLevel.SubLevelType.Five; break; case 5: currentSublevel = SubLevel.SubLevelType.Six; break; case 6: currentSublevel = SubLevel.SubLevelType.Seven; break; case 7: currentSublevel = SubLevel.SubLevelType.Eight; break; case 8: currentSublevel = SubLevel.SubLevelType.Nine; break; case 9: currentSublevel = SubLevel.SubLevelType.Ten; break; default: currentSublevel = SubLevel.SubLevelType.One; break; } for (int i = 0; i < Level.ZombieSpawnZones.Count - 1; i++) { if (Level.ZombieSpawnZones[i].X == 0 && Level.ZombieSpawnZones[i].Y == 0 && Level.ZombieSpawnZones[i].Z == 0 && Level.ZombieSpawnZones[i].W == 0) { howManySpawnZones--; } } float zombieLife; float zombieSpeed; float ratLife; float ratSpeed; float wolfLife; float wolfSpeed; float minotaurLife = 100.0f; float minotaurSpeed = 3.0f; switch (currentLevel) { case LevelType.One: zombieLife = 1.0f; zombieSpeed = 0.0f; ratLife = 1.0f; ratSpeed = 0.8f; wolfLife = 1.0f; wolfSpeed = 3.0f; break; case LevelType.Two: zombieLife = 1.5f; zombieSpeed = 0.2f; ratLife = 1.0f; ratSpeed = 0.9f; wolfLife = 1.0f; wolfSpeed = 3.0f; break; case LevelType.Three: zombieLife = 2.0f; zombieSpeed = 0.3f; ratLife = 1.5f; ratSpeed = 1.0f; wolfLife = 1.0f; wolfSpeed = 3.1f; break; case LevelType.Four: zombieLife = 2.5f; zombieSpeed = 0.4f; ratLife = 2.0f; ratSpeed = 1.1f; wolfLife = 1.0f; wolfSpeed = 3.1f; break; case LevelType.Five: zombieLife = 3.0f; zombieSpeed = 0.5f; ratLife = 2.5f; ratSpeed = 1.1f; wolfLife = 1.0f; wolfSpeed = 3.2f; break; case LevelType.Six: zombieLife = 3.5f; zombieSpeed = 0.6f; ratLife = 3.0f; ratSpeed = 1.2f; wolfLife = 1.0f; wolfSpeed = 3.2f; break; case LevelType.Seven: zombieLife = 4.0f; zombieSpeed = 0.7f; ratLife = 3.5f; ratSpeed = 1.2f; wolfLife = 1.0f; wolfSpeed = 3.3f; break; case LevelType.Eight: zombieLife = 4.5f; zombieSpeed = 0.8f; ratLife = 4.0f; ratSpeed = 1.3f; wolfLife = 1.0f; wolfSpeed = 3.3f; break; case LevelType.Nine: zombieLife = 5.0f; zombieSpeed = 0.9f; ratLife = 4.5f; ratSpeed = 1.3f; wolfLife = 1.0f; wolfSpeed = 3.4f; break; case LevelType.Ten: zombieLife = 5.5f; zombieSpeed = 1.0f; ratLife = 5.0f; ratSpeed = 1.4f; wolfLife = 1.0f; wolfSpeed = 3.4f; break; default: zombieLife = 1.0f; zombieSpeed = 0.0f; ratLife = 1.0f; ratSpeed = 0.8f; wolfLife = 1.0f; wolfSpeed = 3.0f; break; } enemies.InitializeEnemy( Level.subLevelList[subLevelIndex].enemies.Zombies, EnemyType.Zombie, Level, subLevelIndex, zombieLife, zombieSpeed, numplayersIngame ); enemies.InitializeEnemy( Level.subLevelList[subLevelIndex].enemies.Tanks, EnemyType.Tank, Level, subLevelIndex, zombieLife, zombieSpeed, numplayersIngame ); enemies.InitializeEnemy( Level.subLevelList[subLevelIndex].enemies.Rats, EnemyType.Rat, Level, subLevelIndex, ratLife, ratSpeed, numplayersIngame ); enemies.InitializeEnemy( Level.subLevelList[subLevelIndex].enemies.Wolfs, EnemyType.Wolf, Level, subLevelIndex, wolfLife, wolfSpeed, numplayersIngame ); enemies.InitializeEnemy( Level.subLevelList[subLevelIndex].enemies.Minotaurs, EnemyType.Minotaur, Level, subLevelIndex, minotaurLife, minotaurSpeed, numplayersIngame ); enemies.LoadContent(game.Content); } GameAnalytics.AddProgressionEvent(EGAProgressionStatus.Start, currentLevel.ToString(), currentSublevel.ToString()); } public override void Draw(GameTime gameTime) { base.Draw(gameTime); if (game.currentGameState != GameState.Paused) { Color c = new Color(new Vector4(0, 0, 0, 0)); this.ScreenManager.GraphicsDevice.Clear(c); DrawMap(Map); enemies.DrawPowerUps(this.ScreenManager.SpriteBatch, gameTime); this.ScreenManager.SpriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend); foreach (Player player in game.players) { if (player.avatar.IsPlayingTheGame) { DrawPlayer(player, game.totalGameSeconds, gameTime, Level.furnitureList); } } if (GamePlayStatus == GameplayState.StartLevel || GamePlayStatus == GameplayState.Playing || GamePlayStatus == GameplayState.Pause) { enemies.Draw(this.ScreenManager.SpriteBatch, game.totalGameSeconds, Level.furnitureList, gameTime); } if (GamePlayStatus == GameplayState.StageCleared) { enemies.Draw(this.ScreenManager.SpriteBatch, game.totalGameSeconds, Level.furnitureList, gameTime); } foreach (Furniture furniture in Level.furnitureList) { furniture.Draw(this.ScreenManager.SpriteBatch, MenuInfoFont); } this.ScreenManager.SpriteBatch.End(); foreach (Furniture furniture in Level.furnitureList) { if (furniture.Type == FurnitureType.CocheArdiendo) { //furniture.particleRenderer.RenderEffect(furniture.SmokeEffect); } } foreach (Player player in game.players) { if (player.avatar.IsPlayingTheGame) { DrawShotgunShots(player.avatar.shotgunbullets, game.totalGameSeconds); DrawBullets(player.avatar.bullets, game.totalGameSeconds); } } // Perlin Noise effect draw this.ScreenManager.SpriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, null, null, null, null, Resolution.getTransformationMatrix()); #if DEBUG Level.gameWorld.Draw(this.ScreenManager.SpriteBatch, gameTime, this.ScreenManager.SpriteBatch); #endif this.ScreenManager.SpriteBatch.End(); // end Perlin Noise effect DrawUI(gameTime); if (GamePlayStatus == GameplayState.StageCleared) { DrawStageCleared(); } if (GamePlayStatus == GameplayState.StartLevel) { DrawStartLevel(); } if (GamePlayStatus == GameplayState.GameOver) { DrawGameOver(); } // Draw the Storage Device Icon this.ScreenManager.SpriteBatch.Begin(SpriteSortMode.FrontToBack, BlendState.AlphaBlend, null, null, null, null, Resolution.getTransformationMatrix()); foreach (Player player in game.players) { if (player.inputMode == InputMode.Keyboard) { this.ScreenManager.SpriteBatch.Draw(cursorTexture, cursorPos, Color.White); } } this.ScreenManager.SpriteBatch.End(); } else { this.ScreenManager.SpriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend); this.ScreenManager.SpriteBatch.Draw(game.blackTexture, new Vector2(0, 0), Color.White); this.ScreenManager.SpriteBatch.DrawString(MenuInfoFont, "ZOMBUSTERS " + Strings.Paused.ToUpper(), new Vector2(5, 5), Color.White); this.ScreenManager.SpriteBatch.End(); } } #region Drawing Code private void DrawMap(Texture2D map) { SpriteBatch batch = this.ScreenManager.SpriteBatch; batch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, null, null, null, Resolution.getTransformationMatrix()); batch.Draw(map, new Rectangle(0, 0, 1280, 720), Color.White); batch.End(); } private void DrawStageCleared() { this.ScreenManager.FadeBackBufferToBlack(64); this.ScreenManager.SpriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend); Vector2 UICenter = new Vector2(uiBounds.X + uiBounds.Width / 2, uiBounds.Y + uiBounds.Height / 2); this.ScreenManager.SpriteBatch.Draw(whiteLine, new Vector2(UICenter.X - whiteLine.Width / 2, UICenter.Y - 10), Color.White); this.ScreenManager.SpriteBatch.DrawString(MenuHeaderFont, Strings.ClearedGameplayString.ToUpper(), new Vector2(UICenter.X - Convert.ToInt32(MenuHeaderFont.MeasureString(Strings.ClearedGameplayString.ToUpper()).X)/2, UICenter.Y), Color.White); this.ScreenManager.SpriteBatch.DrawString(MenuListFont, Strings.PrepareNextWaveGameplayString.ToUpper(), new Vector2(UICenter.X - Convert.ToInt32(MenuListFont.MeasureString(Strings.PrepareNextWaveGameplayString.ToUpper()).X) / 2, UICenter.Y + 50), Color.White); this.ScreenManager.SpriteBatch.Draw(whiteLine, new Vector2(UICenter.X - whiteLine.Width / 2, UICenter.Y + 90), Color.White); this.ScreenManager.SpriteBatch.End(); } private void DrawStartLevel() { string levelshowstring; int timeLeftWaitingPlayers; int fixedTimeLeft = 5; this.ScreenManager.FadeBackBufferToBlack(64); this.ScreenManager.SpriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, null, null, null, Resolution.getTransformationMatrix()); Vector2 UICenter = new Vector2(uiBounds.X + uiBounds.Width / 2, uiBounds.Y + uiBounds.Height / 2); this.ScreenManager.SpriteBatch.Draw(whiteLine, new Vector2(UICenter.X - whiteLine.Width /2, UICenter.Y - 10), Color.White); switch (currentLevel) { case LevelType.One: levelshowstring = Strings.LevelSelectMenuString + " " + Strings.NumberOne; break; case LevelType.Two: levelshowstring = Strings.LevelSelectMenuString + " " + Strings.NumberTwo; break; case LevelType.Three: levelshowstring = Strings.LevelSelectMenuString + " " + Strings.NumberThree; break; case LevelType.Four: levelshowstring = Strings.LevelSelectMenuString + " " + Strings.NumberFour; break; case LevelType.Five: levelshowstring = Strings.LevelSelectMenuString + " " + Strings.NumberFive; break; case LevelType.Six: levelshowstring = Strings.LevelSelectMenuString + " " + Strings.NumberSix; break; case LevelType.Seven: levelshowstring = Strings.LevelSelectMenuString + " " + Strings.NumberSeven; break; case LevelType.Eight: levelshowstring = Strings.LevelSelectMenuString + " " + Strings.NumberEight; break; case LevelType.Nine: levelshowstring = Strings.LevelSelectMenuString + " " + Strings.NumberNine; break; case LevelType.Ten: levelshowstring = Strings.LevelSelectMenuString + " " + Strings.NumberTen; break; default: levelshowstring = Strings.LevelSelectMenuString + " " + Strings.NumberOne; break; } this.ScreenManager.SpriteBatch.DrawString(MenuHeaderFont, levelshowstring.ToUpper(), new Vector2(UICenter.X - Convert.ToInt32(MenuHeaderFont.MeasureString(levelshowstring.ToUpper()).X) / 2, UICenter.Y), Color.White); switch (currentSublevel) { case SubLevel.SubLevelType.One: levelshowstring = Strings.WaveGameplayString + " " + Strings.NumberOne; break; case SubLevel.SubLevelType.Two: levelshowstring = Strings.WaveGameplayString + " " + Strings.NumberTwo; break; case SubLevel.SubLevelType.Three: levelshowstring = Strings.WaveGameplayString + " " + Strings.NumberThree; break; case SubLevel.SubLevelType.Four: levelshowstring = Strings.WaveGameplayString + " " + Strings.NumberFour; break; case SubLevel.SubLevelType.Five: levelshowstring = Strings.WaveGameplayString + " " + Strings.NumberFive; break; case SubLevel.SubLevelType.Six: levelshowstring = Strings.WaveGameplayString + " " + Strings.NumberSix; break; case SubLevel.SubLevelType.Seven: levelshowstring = Strings.WaveGameplayString + " " + Strings.NumberSeven; break; case SubLevel.SubLevelType.Eight: levelshowstring = Strings.WaveGameplayString + " " + Strings.NumberEight; break; case SubLevel.SubLevelType.Nine: levelshowstring = Strings.WaveGameplayString + " " + Strings.NumberNine; break; case SubLevel.SubLevelType.Ten: levelshowstring = Strings.WaveGameplayString + " " + Strings.NumberTen; break; default: levelshowstring = Strings.WaveGameplayString + " " + Strings.NumberOne; break; } this.ScreenManager.SpriteBatch.DrawString(MenuListFont, levelshowstring.ToUpper(), new Vector2(UICenter.X - Convert.ToInt32(MenuListFont.MeasureString(levelshowstring.ToUpper()).X) / 2, UICenter.Y + 50), Color.White); this.ScreenManager.SpriteBatch.Draw(whiteLine, new Vector2(UICenter.X - whiteLine.Width / 2, UICenter.Y + 90), Color.White); if (game.currentGameState == GameState.WaitingToBegin) { timeLeftWaitingPlayers = fixedTimeLeft; this.ScreenManager.SpriteBatch.DrawString(MenuInfoFont, Strings.WaitingForPlayersMenuString.ToUpper(), new Vector2(uiBounds.Left, uiBounds.Height), Color.White); this.ScreenManager.SpriteBatch.DrawString(MenuInfoFont, timeLeftWaitingPlayers.ToString(), new Vector2(uiBounds.Left + MenuInfoFont.MeasureString(Strings.WaitingForPlayersMenuString.ToUpper()).X + 5, uiBounds.Height), Color.White); } this.ScreenManager.SpriteBatch.End(); } private void DrawGameOver() { if (currentLevel == LevelType.EndGame) { string levelshowstring; this.ScreenManager.FadeBackBufferToBlack(64); this.ScreenManager.SpriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, null, null, null, Resolution.getTransformationMatrix()); Vector2 UICenter = new Vector2(uiBounds.X + uiBounds.Width / 2, uiBounds.Y + uiBounds.Height / 2); this.ScreenManager.SpriteBatch.Draw(whiteLine, new Vector2(UICenter.X - whiteLine.Width / 2, UICenter.Y - 10), Color.White); levelshowstring = Strings.CongratssEndGameString; this.ScreenManager.SpriteBatch.DrawString(MenuHeaderFont, levelshowstring.ToUpper(), new Vector2(UICenter.X - Convert.ToInt32(MenuHeaderFont.MeasureString(levelshowstring.ToUpper()).X) / 2, UICenter.Y), Color.White); levelshowstring = Strings.YouSavedCityEndGameString; this.ScreenManager.SpriteBatch.DrawString(MenuListFont, levelshowstring.ToUpper(), new Vector2(UICenter.X - Convert.ToInt32(MenuListFont.MeasureString(levelshowstring.ToUpper()).X) / 2, UICenter.Y + 50), Color.White); this.ScreenManager.SpriteBatch.Draw(whiteLine, new Vector2(UICenter.X - whiteLine.Width / 2, UICenter.Y + 90), Color.White); this.ScreenManager.SpriteBatch.End(); } if (currentLevel == LevelType.EndDemo) { } } public bool IsInRange(Avatar state, Furniture furniture) { float distance = Vector2.Distance(state.position, furniture.ObstaclePosition); if (distance < Avatar.CrashRadius + 10.0f) { return true; } return false; } public float GetLayerIndex(Avatar state, List<Furniture> furniturelist) { float furnitureInferior, playerBasePosition, lindex; int n = 0; playerBasePosition = state.position.Y; furnitureInferior = 0.0f; lindex = 0.0f; while (playerBasePosition > furnitureInferior) { if (n < furniturelist.Count) { furnitureInferior = furniturelist[n].Position.Y + furniturelist[n].Texture.Height; lindex = furniturelist[n].layerIndex; } else { return lindex + 0.002f; } n++; } return lindex + 0.002f; } private void DrawPlayer(Player player, double TotalGameSeconds, GameTime gameTime, List<Furniture> furniturelist) { float layerIndex = GetLayerIndex(player.avatar, furniturelist); Vector2 offsetPosition = new Vector2(-20, -55); if (GamePlayStatus == GameplayState.Playing || GamePlayStatus == GameplayState.StageCleared || GamePlayStatus == GameplayState.StartLevel) { timerplayer += (float)gameTime.ElapsedGameTime.TotalSeconds; if (player.avatar.IsPlayingTheGame) { if (timerplayer < Avatar.AmmoDisplayTime) { switch (player.avatar.currentgun) { case GunType.pistol: this.ScreenManager.SpriteBatch.Draw(enemies.pistolammoUI, new Vector2(player.avatar.position.X + IdleTrunkAnimation[0].frameSize.X / 2 - UIPlayerYellow.Width / 2 + offsetPosition.X + 5, player.avatar.position.Y - 20 + offsetPosition.Y), Color.White); break; case GunType.machinegun: this.ScreenManager.SpriteBatch.Draw(enemies.pistolammoUI, new Vector2(player.avatar.position.X + IdleTrunkAnimation[0].frameSize.X / 2 - UIPlayerYellow.Width / 2 + offsetPosition.X - 3, player.avatar.position.Y - 20 + offsetPosition.Y), Color.White); this.ScreenManager.SpriteBatch.Draw(enemies.pistolammoUI, new Vector2(player.avatar.position.X + IdleTrunkAnimation[0].frameSize.X / 2 - UIPlayerYellow.Width / 2 + offsetPosition.X + 5, player.avatar.position.Y - 20 + offsetPosition.Y), Color.White); this.ScreenManager.SpriteBatch.Draw(enemies.pistolammoUI, new Vector2(player.avatar.position.X + IdleTrunkAnimation[0].frameSize.X / 2 - UIPlayerYellow.Width / 2 + offsetPosition.X + 13, player.avatar.position.Y - 20 + offsetPosition.Y), Color.White); break; case GunType.shotgun: this.ScreenManager.SpriteBatch.Draw(enemies.shotgunammoUI, new Vector2(player.avatar.position.X + IdleTrunkAnimation[0].frameSize.X / 2 - UIPlayerYellow.Width / 2 + offsetPosition.X + 3, player.avatar.position.Y - 20 + offsetPosition.Y), Color.White); break; case GunType.grenade: this.ScreenManager.SpriteBatch.Draw(enemies.grenadeammoUI, new Vector2(player.avatar.position.X + IdleTrunkAnimation[0].frameSize.X / 2 - UIPlayerYellow.Width / 2 + offsetPosition.X + 5, player.avatar.position.Y - 20 + offsetPosition.Y), Color.White); break; case GunType.flamethrower: this.ScreenManager.SpriteBatch.Draw(enemies.flamethrowerammoUI, new Vector2(player.avatar.position.X + IdleTrunkAnimation[0].frameSize.X / 2 - UIPlayerYellow.Width / 2 + offsetPosition.X + 5, player.avatar.position.Y - 20 + offsetPosition.Y), Color.White); break; default: break; } } if (player.avatar.color == Color.Blue) { this.ScreenManager.SpriteBatch.Draw(UIPlayerBlue, new Vector2(player.avatar.position.X + IdleTrunkAnimation[0].frameSize.X / 2 - UIPlayerBlue.Width / 2 + offsetPosition.X, player.avatar.position.Y - 20 + offsetPosition.Y), Color.White); } if (player.avatar.color == Color.Red) { this.ScreenManager.SpriteBatch.Draw(UIPlayerRed, new Vector2(player.avatar.position.X + IdleTrunkAnimation[0].frameSize.X / 2 - UIPlayerRed.Width / 2 + offsetPosition.X, player.avatar.position.Y - 20 + offsetPosition.Y), Color.White); } if (player.avatar.color == Color.Green) { this.ScreenManager.SpriteBatch.Draw(UIPlayerGreen, new Vector2(player.avatar.position.X + IdleTrunkAnimation[0].frameSize.X / 2 - UIPlayerGreen.Width / 2 + offsetPosition.X, player.avatar.position.Y - 20 + offsetPosition.Y), Color.White); } if (player.avatar.color == Color.Yellow) { this.ScreenManager.SpriteBatch.Draw(UIPlayerYellow, new Vector2(player.avatar.position.X + IdleTrunkAnimation[0].frameSize.X / 2 - UIPlayerYellow.Width / 2 + offsetPosition.X, player.avatar.position.Y - 20 + offsetPosition.Y), Color.White); } } } else { timerplayer = 0; } switch (player.avatar.status) { case ObjectStatus.Inactive: break; case ObjectStatus.Active: Color color; if (player.avatar.isLoosingLife == true) { color = Color.Red; } else { color = Color.White; } if (player.avatar.accumFire.Length() > .5) { if (Angles.IsNorth(player.avatar.shotAngle)) { switch (player.avatar.currentgun) { case GunType.pistol: if (player.avatar.character == 0) { PistolShotNorthAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X + 7 + offsetPosition.X, player.avatar.position.Y + offsetPosition.Y - 30), SpriteEffects.None, layerIndex, 0f, color); } else { PistolShotNorthAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X + 12 + offsetPosition.X, player.avatar.position.Y + offsetPosition.Y - 30), SpriteEffects.None, layerIndex, 0f, color); } break; case GunType.shotgun: if (player.avatar.character == 0) { ShotgunNorthAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X + 6 + offsetPosition.X, player.avatar.position.Y + offsetPosition.Y - 34), SpriteEffects.None, layerIndex, 0f, color); } else { ShotgunNorthAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X + 12 + offsetPosition.X, player.avatar.position.Y + offsetPosition.Y - 36), SpriteEffects.None, layerIndex, 0f, color); } break; case GunType.machinegun: if (player.avatar.character == 0) { MachinegunNorthAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X + 6 + offsetPosition.X, player.avatar.position.Y + offsetPosition.Y - 34), SpriteEffects.None, layerIndex, 0f, color); } else { MachinegunNorthAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X + 12 + offsetPosition.X, player.avatar.position.Y + offsetPosition.Y - 36), SpriteEffects.None, layerIndex, 0f, color); } break; case GunType.flamethrower: if (player.avatar.character == 0) { this.ScreenManager.SpriteBatch.Draw(ShotgunNorthTexture[player.avatar.character], new Rectangle(Convert.ToInt32(player.avatar.position.X + 6 + offsetPosition.X), Convert.ToInt32(player.avatar.position.Y + offsetPosition.Y - 34), 26, ShotgunNorthTexture[player.avatar.character].Height), new Rectangle(0, 0, 26, ShotgunNorthTexture[player.avatar.character].Height), color, 0.0f, Vector2.Zero, SpriteEffects.None, layerIndex); } else { this.ScreenManager.SpriteBatch.Draw(ShotgunNorthTexture[player.avatar.character], new Rectangle(Convert.ToInt32(player.avatar.position.X + 12 + offsetPosition.X), Convert.ToInt32(player.avatar.position.Y + offsetPosition.Y - 36), 21, ShotgunNorthTexture[player.avatar.character].Height), new Rectangle(0, 0, 21, ShotgunNorthTexture[player.avatar.character].Height), color, 0.0f, Vector2.Zero, SpriteEffects.None, layerIndex); } DrawFlameThrower(player.avatar, layerIndex); break; default: break; } } else if (Angles.IsNorthEast(player.avatar.shotAngle)) { switch (player.avatar.currentgun) { case GunType.pistol: if (player.avatar.character == 0) { PistolShotNEAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X + 7 + offsetPosition.X, player.avatar.position.Y + offsetPosition.Y - 18), SpriteEffects.None, layerIndex, 0f, color); } else { PistolShotNEAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X + 7 + offsetPosition.X, player.avatar.position.Y + offsetPosition.Y - 18), SpriteEffects.None, layerIndex, 0f, color); } break; case GunType.shotgun: if (player.avatar.character == 0) { ShotgunNEAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X + 7 + offsetPosition.X, player.avatar.position.Y + offsetPosition.Y - 14), SpriteEffects.None, layerIndex, 0f, color); } else { ShotgunNEAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X + 10 + offsetPosition.X, player.avatar.position.Y + offsetPosition.Y - 14), SpriteEffects.None, layerIndex, 0f, color); } break; case GunType.machinegun: if (player.avatar.character == 0) { MachinegunNEAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X + 7 + offsetPosition.X, player.avatar.position.Y + offsetPosition.Y - 14), SpriteEffects.None, layerIndex, 0f, color); } else { MachinegunNEAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X + 10 + offsetPosition.X, player.avatar.position.Y + offsetPosition.Y - 14), SpriteEffects.None, layerIndex, 0f, color); } break; case GunType.flamethrower: if (player.avatar.character == 0) { this.ScreenManager.SpriteBatch.Draw(ShotgunNETexture[player.avatar.character], new Rectangle(Convert.ToInt32(player.avatar.position.X + 7 + offsetPosition.X), Convert.ToInt32(player.avatar.position.Y + offsetPosition.Y - 14), 59, ShotgunNETexture[player.avatar.character].Height), new Rectangle(0, 0, 59, ShotgunNETexture[player.avatar.character].Height), color, 0.0f, Vector2.Zero, SpriteEffects.None, layerIndex); } else { this.ScreenManager.SpriteBatch.Draw(ShotgunNETexture[player.avatar.character], new Rectangle(Convert.ToInt32(player.avatar.position.X + 10 + offsetPosition.X), Convert.ToInt32(player.avatar.position.Y + offsetPosition.Y - 14), 53, ShotgunNETexture[player.avatar.character].Height), new Rectangle(0, 0, 53, ShotgunNETexture[player.avatar.character].Height), color, 0.0f, Vector2.Zero, SpriteEffects.None, layerIndex); } DrawFlameThrower(player.avatar, layerIndex); break; default: break; } } else if (Angles.IsEast(player.avatar.shotAngle)) { switch (player.avatar.currentgun) { case GunType.pistol: if (player.avatar.character == 0) { PistolShotEastAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X + 7 + offsetPosition.X, player.avatar.position.Y + offsetPosition.Y + 4), SpriteEffects.None, layerIndex, 0f, color); } else { PistolShotEastAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X + 7 + offsetPosition.X, player.avatar.position.Y + offsetPosition.Y + 1), SpriteEffects.None, layerIndex, 0f, color); } break; case GunType.shotgun: if (player.avatar.character == 0) { ShotgunShotEastAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X + 7 + offsetPosition.X, player.avatar.position.Y + offsetPosition.Y + 4), SpriteEffects.None, layerIndex, 0f, color); } else { ShotgunShotEastAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X + 10 + offsetPosition.X, player.avatar.position.Y + offsetPosition.Y + 1), SpriteEffects.None, layerIndex, 0f, color); } break; case GunType.machinegun: if (player.avatar.character == 0) { MachinegunEastAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X + 7 + offsetPosition.X, player.avatar.position.Y + offsetPosition.Y + 4), SpriteEffects.None, layerIndex, 0f, color); } else { MachinegunEastAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X + 10 + offsetPosition.X, player.avatar.position.Y + offsetPosition.Y + 1), SpriteEffects.None, layerIndex, 0f, color); } break; case GunType.flamethrower: if (player.avatar.character == 0) { this.ScreenManager.SpriteBatch.Draw(ShotgunEastTexture[player.avatar.character], new Rectangle(Convert.ToInt32(player.avatar.position.X + 7 + offsetPosition.X), Convert.ToInt32(player.avatar.position.Y + offsetPosition.Y + 4), 71, ShotgunEastTexture[player.avatar.character].Height), new Rectangle(0, 0, 71, ShotgunEastTexture[player.avatar.character].Height), color, 0.0f, Vector2.Zero, SpriteEffects.None, layerIndex); } else { this.ScreenManager.SpriteBatch.Draw(ShotgunEastTexture[player.avatar.character], new Rectangle(Convert.ToInt32(player.avatar.position.X + 10 + offsetPosition.X), Convert.ToInt32(player.avatar.position.Y + offsetPosition.Y + 1), 69, ShotgunEastTexture[player.avatar.character].Height), new Rectangle(0, 0, 69, ShotgunEastTexture[player.avatar.character].Height), color, 0.0f, Vector2.Zero, SpriteEffects.None, layerIndex); } DrawFlameThrower(player.avatar, layerIndex); break; default: break; } } else if (Angles.IsSouthEast(player.avatar.shotAngle)) { switch (player.avatar.currentgun) { case GunType.pistol: if (player.avatar.character == 0) { PistolShotSEAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X + 7 + offsetPosition.X, player.avatar.position.Y + offsetPosition.Y + 4), SpriteEffects.None, layerIndex, 0f, color); } else { PistolShotSEAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X + 10 + offsetPosition.X, player.avatar.position.Y + offsetPosition.Y + 1), SpriteEffects.None, layerIndex, 0f, color); } break; case GunType.shotgun: if (player.avatar.character == 0) { ShotgunSEAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X + 7 + offsetPosition.X, player.avatar.position.Y + offsetPosition.Y + 4), SpriteEffects.None, layerIndex, 0f, color); } else { ShotgunSEAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X + 10 + offsetPosition.X, player.avatar.position.Y + offsetPosition.Y + 1), SpriteEffects.None, layerIndex, 0f, color); } break; case GunType.machinegun: if (player.avatar.character == 0) { MachinegunSEAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X + 7 + offsetPosition.X, player.avatar.position.Y + offsetPosition.Y + 4), SpriteEffects.None, layerIndex, 0f, color); } else { MachinegunSEAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X + 10 + offsetPosition.X, player.avatar.position.Y + offsetPosition.Y + 1), SpriteEffects.None, layerIndex, 0f, color); } break; case GunType.flamethrower: if (player.avatar.character == 0) { this.ScreenManager.SpriteBatch.Draw(ShotgunSETexture[player.avatar.character], new Rectangle(Convert.ToInt32(player.avatar.position.X + 7 + offsetPosition.X), Convert.ToInt32(player.avatar.position.Y + offsetPosition.Y + 4), 58, ShotgunSETexture[player.avatar.character].Height), new Rectangle(0, 0, 58, ShotgunSETexture[player.avatar.character].Height), color, 0.0f, Vector2.Zero, SpriteEffects.None, layerIndex); } else { this.ScreenManager.SpriteBatch.Draw(ShotgunSETexture[player.avatar.character], new Rectangle(Convert.ToInt32(player.avatar.position.X + 10 + offsetPosition.X), Convert.ToInt32(player.avatar.position.Y + offsetPosition.Y + 1), 54, ShotgunSETexture[player.avatar.character].Height), new Rectangle(0, 0, 54, ShotgunSETexture[player.avatar.character].Height), color, 0.0f, Vector2.Zero, SpriteEffects.None, layerIndex); } DrawFlameThrower(player.avatar, layerIndex); break; default: break; } } else if (Angles.IsSouth(player.avatar.shotAngle)) { switch (player.avatar.currentgun) { case GunType.pistol: if (player.avatar.character == 0) { PistolShotSouthAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X + 7 + offsetPosition.X, player.avatar.position.Y + offsetPosition.Y + 4), SpriteEffects.None, layerIndex, 0f, color); } else { PistolShotSouthAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X + 3 + offsetPosition.X, player.avatar.position.Y + offsetPosition.Y + 1), SpriteEffects.None, layerIndex, 0f, color); } break; case GunType.shotgun: if (player.avatar.character == 0) { ShotgunSouthAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X + 7 + offsetPosition.X, player.avatar.position.Y + offsetPosition.Y + 4), SpriteEffects.None, layerIndex, 0f, color); } else { ShotgunSouthAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X + 10 + offsetPosition.X, player.avatar.position.Y + offsetPosition.Y + 1), SpriteEffects.None, layerIndex, 0f, color); } break; case GunType.machinegun: if (player.avatar.character == 0) { MachinegunSouthAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X + 7 + offsetPosition.X, player.avatar.position.Y + offsetPosition.Y + 4), SpriteEffects.None, layerIndex, 0f, color); } else { MachinegunSouthAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X + 10 + offsetPosition.X, player.avatar.position.Y + offsetPosition.Y + 1), SpriteEffects.None, layerIndex, 0f, color); } break; case GunType.flamethrower: if (player.avatar.character == 0) { this.ScreenManager.SpriteBatch.Draw(ShotgunSouthTexture[player.avatar.character], new Rectangle(Convert.ToInt32(player.avatar.position.X + 7 + offsetPosition.X), Convert.ToInt32(player.avatar.position.Y + offsetPosition.Y + 4), 21, ShotgunSouthTexture[player.avatar.character].Height), new Rectangle(0, 0, 21, ShotgunSouthTexture[player.avatar.character].Height), color, 0.0f, Vector2.Zero, SpriteEffects.None, layerIndex); } else { this.ScreenManager.SpriteBatch.Draw(ShotgunSouthTexture[player.avatar.character], new Rectangle(Convert.ToInt32(player.avatar.position.X + 10 + offsetPosition.X), Convert.ToInt32(player.avatar.position.Y + offsetPosition.Y + 1), 20, ShotgunSouthTexture[player.avatar.character].Height), new Rectangle(0, 0, 20, ShotgunSouthTexture[player.avatar.character].Height), color, 0.0f, Vector2.Zero, SpriteEffects.None, layerIndex); } DrawFlameThrower(player.avatar, layerIndex); break; default: break; } } else if (Angles.IsSouthWest(player.avatar.shotAngle)) { switch (player.avatar.currentgun) { case GunType.pistol: if (player.avatar.character == 0) { PistolShotSEAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X - 6 + offsetPosition.X, player.avatar.position.Y + offsetPosition.Y + 4), SpriteEffects.FlipHorizontally, layerIndex, 0f, color); } else { PistolShotSEAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X + 7 + offsetPosition.X, player.avatar.position.Y + offsetPosition.Y + 1), SpriteEffects.FlipHorizontally, layerIndex, 0f, color); } break; case GunType.shotgun: if (player.avatar.character == 0) { ShotgunSEAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X + 1 + offsetPosition.X, player.avatar.position.Y + offsetPosition.Y + 4), SpriteEffects.FlipHorizontally, layerIndex, 0f, color); } else { ShotgunSEAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X + 4 + offsetPosition.X, player.avatar.position.Y + offsetPosition.Y + 2), SpriteEffects.FlipHorizontally, layerIndex, 0f, color); } break; case GunType.machinegun: if (player.avatar.character == 0) { MachinegunSEAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X + 1 + offsetPosition.X, player.avatar.position.Y + offsetPosition.Y + 4), SpriteEffects.FlipHorizontally, layerIndex, 0f, color); } else { MachinegunSEAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X + 4 + offsetPosition.X, player.avatar.position.Y + offsetPosition.Y + 2), SpriteEffects.FlipHorizontally, layerIndex, 0f, color); } break; case GunType.flamethrower: if (player.avatar.character == 0) { this.ScreenManager.SpriteBatch.Draw(ShotgunSETexture[player.avatar.character], new Rectangle(Convert.ToInt32(player.avatar.position.X + 1 + offsetPosition.X - 29), Convert.ToInt32(player.avatar.position.Y + offsetPosition.Y + 4), 58, ShotgunSETexture[player.avatar.character].Height), new Rectangle(0, 0, 58, ShotgunSETexture[player.avatar.character].Height), color, 0.0f, Vector2.Zero, SpriteEffects.FlipHorizontally, layerIndex); } else { this.ScreenManager.SpriteBatch.Draw(ShotgunSETexture[player.avatar.character], new Rectangle(Convert.ToInt32(player.avatar.position.X + 4 + offsetPosition.X - 27), Convert.ToInt32(player.avatar.position.Y + offsetPosition.Y + 2), 54, ShotgunSETexture[player.avatar.character].Height), new Rectangle(0, 0, 54, ShotgunSETexture[player.avatar.character].Height), color, 0.0f, Vector2.Zero, SpriteEffects.FlipHorizontally, layerIndex); } DrawFlameThrower(player.avatar, layerIndex); break; default: break; } } else if (Angles.IsWest(player.avatar.shotAngle)) { switch (player.avatar.currentgun) { case GunType.pistol: if (player.avatar.character == 0) { PistolShotEastAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X - 6 + offsetPosition.X, player.avatar.position.Y + offsetPosition.Y + 4), SpriteEffects.FlipHorizontally, layerIndex, 0f, color); } else { PistolShotEastAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X + 2 + offsetPosition.X, player.avatar.position.Y + offsetPosition.Y + 1), SpriteEffects.FlipHorizontally, layerIndex, 0f, color); } break; case GunType.shotgun: if (player.avatar.character == 0) { ShotgunShotEastAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X - 6 + offsetPosition.X, player.avatar.position.Y + offsetPosition.Y + 4), SpriteEffects.FlipHorizontally, layerIndex, 0f, color); } else { ShotgunShotEastAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X - 4 + offsetPosition.X, player.avatar.position.Y + offsetPosition.Y + 2), SpriteEffects.FlipHorizontally, layerIndex, 0f, color); } break; case GunType.machinegun: if (player.avatar.character == 0) { MachinegunEastAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X - 6 + offsetPosition.X, player.avatar.position.Y + offsetPosition.Y + 4), SpriteEffects.FlipHorizontally, layerIndex, 0f, color); } else { MachinegunEastAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X - 4 + offsetPosition.X, player.avatar.position.Y + offsetPosition.Y + 2), SpriteEffects.FlipHorizontally, layerIndex, 0f, color); } break; case GunType.flamethrower: if (player.avatar.character == 0) { this.ScreenManager.SpriteBatch.Draw(ShotgunEastTexture[player.avatar.character], new Rectangle(Convert.ToInt32(player.avatar.position.X - 6 + offsetPosition.X - 35), Convert.ToInt32(player.avatar.position.Y + offsetPosition.Y + 4), 71, ShotgunEastTexture[player.avatar.character].Height), new Rectangle(0, 0, 71, ShotgunEastTexture[player.avatar.character].Height), color, 0.0f, Vector2.Zero, SpriteEffects.FlipHorizontally, layerIndex); } else { this.ScreenManager.SpriteBatch.Draw(ShotgunEastTexture[player.avatar.character], new Rectangle(Convert.ToInt32(player.avatar.position.X - 4 + offsetPosition.X - 34), Convert.ToInt32(player.avatar.position.Y + offsetPosition.Y + 2), 69, ShotgunEastTexture[player.avatar.character].Height), new Rectangle(0, 0, 69, ShotgunEastTexture[player.avatar.character].Height), color, 0.0f, Vector2.Zero, SpriteEffects.FlipHorizontally, layerIndex); } DrawFlameThrower(player.avatar, layerIndex); break; default: break; } } else if (Angles.IsNorthWest(player.avatar.shotAngle)) { switch (player.avatar.currentgun) { case GunType.pistol: if (player.avatar.character == 0) { PistolShotNEAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X - 6 + offsetPosition.X, player.avatar.position.Y + offsetPosition.Y - 18), SpriteEffects.FlipHorizontally, layerIndex, 0f, color); } else { PistolShotNEAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X + 2 + offsetPosition.X, player.avatar.position.Y + offsetPosition.Y - 18), SpriteEffects.FlipHorizontally, layerIndex, 0f, color); } break; case GunType.shotgun: if (player.avatar.character == 0) { ShotgunNEAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X + offsetPosition.X, player.avatar.position.Y + offsetPosition.Y - 14), SpriteEffects.FlipHorizontally, layerIndex, 0f, color); } else { ShotgunNEAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X + offsetPosition.X + 4, player.avatar.position.Y + offsetPosition.Y - 13), SpriteEffects.FlipHorizontally, layerIndex, 0f, color); } break; case GunType.machinegun: if (player.avatar.character == 0) { MachinegunNEAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X + offsetPosition.X, player.avatar.position.Y + offsetPosition.Y - 14), SpriteEffects.FlipHorizontally, layerIndex, 0f, color); } else { MachinegunNEAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X + offsetPosition.X + 4, player.avatar.position.Y + offsetPosition.Y - 13), SpriteEffects.FlipHorizontally, layerIndex, 0f, color); } break; case GunType.flamethrower: if (player.avatar.character == 0) { this.ScreenManager.SpriteBatch.Draw(ShotgunNETexture[player.avatar.character], new Rectangle(Convert.ToInt32(player.avatar.position.X + offsetPosition.X - 29), Convert.ToInt32(player.avatar.position.Y + offsetPosition.Y - 14), 59, ShotgunNETexture[player.avatar.character].Height), new Rectangle(0, 0, 59, ShotgunNETexture[player.avatar.character].Height), color, 0.0f, Vector2.Zero, SpriteEffects.FlipHorizontally, layerIndex); } else { this.ScreenManager.SpriteBatch.Draw(ShotgunNETexture[player.avatar.character], new Rectangle(Convert.ToInt32(player.avatar.position.X + offsetPosition.X + 4 - 26), Convert.ToInt32(player.avatar.position.Y + offsetPosition.Y - 13), 53, ShotgunNETexture[player.avatar.character].Height), new Rectangle(0, 0, 53, ShotgunNETexture[player.avatar.character].Height), color, 0.0f, Vector2.Zero, SpriteEffects.FlipHorizontally, layerIndex); } DrawFlameThrower(player.avatar, layerIndex); break; default: break; } } } // Draw Movement LEGS if (player.avatar.accumMove.Length() > .5) { if (player.avatar.character == 0) { if (player.avatar.accumMove.X > 0) { if (player.avatar.accumFire.Length() < .5) { if (player.avatar.currentgun == GunType.pistol) { IdleTrunkAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X + offsetPosition.X, player.avatar.position.Y + offsetPosition.Y), SpriteEffects.None, layerIndex, 0f, color); } else { this.ScreenManager.SpriteBatch.Draw(ShotgunEastTexture[player.avatar.character], new Rectangle(Convert.ToInt32(player.avatar.position.X + 7 + offsetPosition.X), Convert.ToInt32(player.avatar.position.Y + offsetPosition.Y + 4), 71, ShotgunEastTexture[player.avatar.character].Height), new Rectangle(0, 0, 71, ShotgunEastTexture[player.avatar.character].Height), color, 0.0f, Vector2.Zero, SpriteEffects.None, layerIndex); } } RunEastAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X - 7 + offsetPosition.X, player.avatar.position.Y - 26), SpriteEffects.None, layerIndex + 0.001f, 0f, color); } else { if (player.avatar.accumFire.Length() < .5) { if (player.avatar.currentgun == GunType.pistol) { IdleTrunkAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X + offsetPosition.X + 16, player.avatar.position.Y + offsetPosition.Y), SpriteEffects.FlipHorizontally, layerIndex, 0f, color); } else { this.ScreenManager.SpriteBatch.Draw(ShotgunEastTexture[player.avatar.character], new Rectangle(Convert.ToInt32(player.avatar.position.X - 6 + offsetPosition.X - 35), Convert.ToInt32(player.avatar.position.Y + offsetPosition.Y + 4), 71, ShotgunEastTexture[player.avatar.character].Height), new Rectangle(0, 0, 71, ShotgunEastTexture[player.avatar.character].Height), color, 0.0f, Vector2.Zero, SpriteEffects.FlipHorizontally, layerIndex); } } RunEastAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X + 18 + offsetPosition.X, player.avatar.position.Y - 26), SpriteEffects.FlipHorizontally, layerIndex + 0.001f, 0f, color); } } else { if (player.avatar.accumMove.X > 0) { if (player.avatar.accumFire.Length() < .5) { if (player.avatar.currentgun == GunType.pistol) { IdleTrunkAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X + offsetPosition.X + 10, player.avatar.position.Y + offsetPosition.Y + 1), SpriteEffects.None, layerIndex, 0f, color); } else { this.ScreenManager.SpriteBatch.Draw(ShotgunEastTexture[player.avatar.character], new Rectangle(Convert.ToInt32(player.avatar.position.X + 10 + offsetPosition.X), Convert.ToInt32(player.avatar.position.Y + offsetPosition.Y + 1), 69, ShotgunEastTexture[player.avatar.character].Height), new Rectangle(0, 0, 69, ShotgunEastTexture[player.avatar.character].Height), color, 0.0f, Vector2.Zero, SpriteEffects.None, layerIndex); } } RunEastAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X - 4 + offsetPosition.X, player.avatar.position.Y - 24), SpriteEffects.None, layerIndex + 0.001f, 0f, color); } else { if (player.avatar.accumFire.Length() < .5) { if (player.avatar.currentgun == GunType.pistol) { IdleTrunkAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X + offsetPosition.X + 19, player.avatar.position.Y + offsetPosition.Y + 1), SpriteEffects.FlipHorizontally, layerIndex, 0f, color); } else { this.ScreenManager.SpriteBatch.Draw(ShotgunEastTexture[player.avatar.character], new Rectangle(Convert.ToInt32(player.avatar.position.X - 4 + offsetPosition.X - 34), Convert.ToInt32(player.avatar.position.Y + offsetPosition.Y + 2), 69, ShotgunEastTexture[player.avatar.character].Height), new Rectangle(0, 0, 69, ShotgunEastTexture[player.avatar.character].Height), color, 0.0f, Vector2.Zero, SpriteEffects.FlipHorizontally, layerIndex); } } RunEastAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X + 20 + offsetPosition.X, player.avatar.position.Y - 24), SpriteEffects.FlipHorizontally, layerIndex + 0.001f, 0f, color); } } } else { if (player.avatar.accumFire.Length() < .5) { if (player.avatar.character == 0) { if (player.avatar.currentgun == GunType.pistol) { IdleTrunkAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X + offsetPosition.X, player.avatar.position.Y + offsetPosition.Y), SpriteEffects.None, layerIndex, 0f, color); } else { this.ScreenManager.SpriteBatch.Draw(ShotgunEastTexture[player.avatar.character], new Rectangle(Convert.ToInt32(player.avatar.position.X + 7 + offsetPosition.X), Convert.ToInt32(player.avatar.position.Y + offsetPosition.Y + 4), 71, ShotgunEastTexture[player.avatar.character].Height), new Rectangle(0, 0, 71, ShotgunEastTexture[player.avatar.character].Height), color, 0.0f, Vector2.Zero, SpriteEffects.None, layerIndex); } } else { if (player.avatar.currentgun == GunType.pistol) { IdleTrunkAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X + offsetPosition.X + 10, player.avatar.position.Y + offsetPosition.Y + 1), SpriteEffects.None, layerIndex, 0f, color); } else { this.ScreenManager.SpriteBatch.Draw(ShotgunEastTexture[player.avatar.character], new Rectangle(Convert.ToInt32(player.avatar.position.X + 10 + offsetPosition.X), Convert.ToInt32(player.avatar.position.Y + offsetPosition.Y + 1), 69, ShotgunEastTexture[player.avatar.character].Height), new Rectangle(0, 0, 69, ShotgunEastTexture[player.avatar.character].Height), color, 0.0f, Vector2.Zero, SpriteEffects.None, layerIndex); } } } this.ScreenManager.SpriteBatch.Draw(IdleLegsTexture[player.avatar.character], new Rectangle(Convert.ToInt32(player.avatar.position.X + 7 + offsetPosition.X), Convert.ToInt32(player.avatar.position.Y + offsetPosition.Y + 3), IdleLegsTexture[player.avatar.character].Width, IdleLegsTexture[player.avatar.character].Height), new Rectangle(0, 0, IdleLegsTexture[player.avatar.character].Width, IdleLegsTexture[player.avatar.character].Height), color, 0.0f, Vector2.Zero, SpriteEffects.None, layerIndex + 0.001f); } #if DEBUG this.ScreenManager.SpriteBatch.DrawString(MenuInfoFont, layerIndex.ToString(), player.avatar.position, Color.White, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.4f); // Position Reference TEMPORAL this.ScreenManager.SpriteBatch.Draw(PositionReference, new Rectangle(Convert.ToInt32(player.avatar.position.X), Convert.ToInt32(player.avatar.position.Y), PositionReference.Width, PositionReference.Height), new Rectangle(0, 0, PositionReference.Width, PositionReference.Height), Color.White, 0.0f, Vector2.Zero, SpriteEffects.None, 0.1f); #endif // Draw the SHADOW OF THE CHARACTER this.ScreenManager.SpriteBatch.Draw(CharacterShadow, new Rectangle(Convert.ToInt32(player.avatar.position.X + IdleLegsTexture[player.avatar.character].Width / 2 - 5 + offsetPosition.X), Convert.ToInt32(player.avatar.position.Y + IdleLegsTexture[player.avatar.character].Height - 6 + offsetPosition.Y), CharacterShadow.Width, CharacterShadow.Height), new Rectangle(0, 0, CharacterShadow.Width, CharacterShadow.Height), new Color(255, 255, 255, 50), 0.0f, Vector2.Zero, SpriteEffects.None, layerIndex + 0.01f); player.avatar.isLoosingLife = false; break; case ObjectStatus.Dying: if (player.avatar.accumMove.X > 0) { this.ScreenManager.SpriteBatch.Draw(DiedTexture[player.avatar.character], new Rectangle(Convert.ToInt32(player.avatar.position.X + 7 + offsetPosition.X), Convert.ToInt32(player.avatar.position.Y - 27), DiedTexture[player.avatar.character].Width, DiedTexture[player.avatar.character].Height), new Rectangle(0, 0, DiedTexture[player.avatar.character].Width, DiedTexture[player.avatar.character].Height), Color.White, 0.0f, Vector2.Zero, SpriteEffects.FlipHorizontally, layerIndex + 0.001f); } else { this.ScreenManager.SpriteBatch.Draw(DiedTexture[player.avatar.character], new Rectangle(Convert.ToInt32(player.avatar.position.X + 7 + offsetPosition.X), Convert.ToInt32(player.avatar.position.Y - 27), DiedTexture[player.avatar.character].Width, DiedTexture[player.avatar.character].Height), new Rectangle(0, 0, DiedTexture[player.avatar.character].Width, DiedTexture[player.avatar.character].Height), Color.White, 0.0f, Vector2.Zero, SpriteEffects.None, layerIndex + 0.001f); } #if DEBUG // Position Reference TEMPORAL this.ScreenManager.SpriteBatch.Draw(PositionReference, new Rectangle(Convert.ToInt32(player.avatar.position.X), Convert.ToInt32(player.avatar.position.Y), PositionReference.Width, PositionReference.Height), new Rectangle(0, 0, PositionReference.Width, PositionReference.Height), Color.White, 0.0f, Vector2.Zero, SpriteEffects.None, 0.01f); #endif // Draw the SHADOW OF THE CHARACTER this.ScreenManager.SpriteBatch.Draw(CharacterShadow, new Rectangle(Convert.ToInt32(player.avatar.position.X + IdleLegsTexture[player.avatar.character].Width / 2 - 5 + offsetPosition.X), Convert.ToInt32(player.avatar.position.Y + IdleLegsTexture[player.avatar.character].Height - 6 + offsetPosition.Y), CharacterShadow.Width, CharacterShadow.Height), new Rectangle(0, 0, CharacterShadow.Width, CharacterShadow.Height), new Color(255, 255, 255, 50), 0.0f, Vector2.Zero, SpriteEffects.None, layerIndex + 0.01f); break; case ObjectStatus.Immune://blink 5 times per second if (((int)(TotalGameSeconds * 10) % 2) == 0) { // Draws our avatar at the current position with no tinting if (player.avatar.accumFire.Length() > .5) { if (Angles.IsNorth(player.avatar.shotAngle)) { switch (player.avatar.currentgun) { case GunType.pistol: case GunType.shotgun: case GunType.machinegun: if (player.avatar.character == 0) { if (player.avatar.ammo[(int)GunType.machinegun] > 0) { MachinegunNorthAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X + 6 + offsetPosition.X, player.avatar.position.Y + offsetPosition.Y - 34), SpriteEffects.None, layerIndex, 0f, Color.White); } else { PistolShotNorthAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X + 7 + offsetPosition.X, player.avatar.position.Y + offsetPosition.Y - 30), SpriteEffects.None, layerIndex, 0f, Color.White); } } else { if (player.avatar.ammo[(int)GunType.machinegun] > 0) { MachinegunNorthAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X + 12 + offsetPosition.X, player.avatar.position.Y + offsetPosition.Y - 36), SpriteEffects.None, layerIndex, 0f, Color.White); } else { PistolShotNorthAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X + 12 + offsetPosition.X, player.avatar.position.Y + offsetPosition.Y - 30), SpriteEffects.None, layerIndex, 0f, Color.White); } } break; case GunType.flamethrower: if (player.avatar.character == 0) { this.ScreenManager.SpriteBatch.Draw(ShotgunNorthTexture[player.avatar.character], new Rectangle(Convert.ToInt32(player.avatar.position.X + 6 + offsetPosition.X), Convert.ToInt32(player.avatar.position.Y + offsetPosition.Y - 34), 26, ShotgunNorthTexture[player.avatar.character].Height), new Rectangle(0, 0, 26, ShotgunNorthTexture[player.avatar.character].Height), Color.White, 0.0f, Vector2.Zero, SpriteEffects.None, layerIndex); } else { this.ScreenManager.SpriteBatch.Draw(ShotgunNorthTexture[player.avatar.character], new Rectangle(Convert.ToInt32(player.avatar.position.X + 12 + offsetPosition.X), Convert.ToInt32(player.avatar.position.Y + offsetPosition.Y - 36), 21, ShotgunNorthTexture[player.avatar.character].Height), new Rectangle(0, 0, 21, ShotgunNorthTexture[player.avatar.character].Height), Color.White, 0.0f, Vector2.Zero, SpriteEffects.None, layerIndex); } DrawFlameThrower(player.avatar, layerIndex); break; default: break; } } else if (Angles.IsNorthEast(player.avatar.shotAngle)) { switch (player.avatar.currentgun) { case GunType.pistol: case GunType.shotgun: case GunType.machinegun: if (player.avatar.character == 0) { if (player.avatar.ammo[(int)GunType.machinegun] > 0) { MachinegunNEAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X + 7 + offsetPosition.X, player.avatar.position.Y + offsetPosition.Y - 14), SpriteEffects.None, layerIndex, 0f, Color.White); } else { PistolShotNEAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X + 7 + offsetPosition.X, player.avatar.position.Y + offsetPosition.Y - 18), SpriteEffects.None, layerIndex, 0f, Color.White); } } else { if (player.avatar.ammo[(int)GunType.machinegun] > 0) { MachinegunNEAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X + 10 + offsetPosition.X, player.avatar.position.Y + offsetPosition.Y - 14), SpriteEffects.None, layerIndex, 0f, Color.White); } else { PistolShotNEAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X + 7 + offsetPosition.X, player.avatar.position.Y + offsetPosition.Y - 18), SpriteEffects.None, layerIndex, 0f, Color.White); } } break; case GunType.flamethrower: if (player.avatar.character == 0) { this.ScreenManager.SpriteBatch.Draw(ShotgunNETexture[player.avatar.character], new Rectangle(Convert.ToInt32(player.avatar.position.X + 7 + offsetPosition.X), Convert.ToInt32(player.avatar.position.Y + offsetPosition.Y - 14), 59, ShotgunNETexture[player.avatar.character].Height), new Rectangle(0, 0, 59, ShotgunNETexture[player.avatar.character].Height), Color.White, 0.0f, Vector2.Zero, SpriteEffects.None, layerIndex); } else { this.ScreenManager.SpriteBatch.Draw(ShotgunNETexture[player.avatar.character], new Rectangle(Convert.ToInt32(player.avatar.position.X + 10 + offsetPosition.X), Convert.ToInt32(player.avatar.position.Y + offsetPosition.Y - 14), 53, ShotgunNETexture[player.avatar.character].Height), new Rectangle(0, 0, 53, ShotgunNETexture[player.avatar.character].Height), Color.White, 0.0f, Vector2.Zero, SpriteEffects.None, layerIndex); } DrawFlameThrower(player.avatar, layerIndex); break; default: break; } } else if (Angles.IsEast(player.avatar.shotAngle)) { switch (player.avatar.currentgun) { case GunType.pistol: case GunType.shotgun: case GunType.machinegun: if (player.avatar.character == 0) { if (player.avatar.ammo[(int)GunType.machinegun] > 0) { MachinegunEastAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X + 7 + offsetPosition.X, player.avatar.position.Y + offsetPosition.Y + 4), SpriteEffects.None, layerIndex, 0f, Color.White); } else { PistolShotEastAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X + 7 + offsetPosition.X, player.avatar.position.Y + offsetPosition.Y + 4), SpriteEffects.None, layerIndex, 0f, Color.White); } } else { if (player.avatar.ammo[(int)GunType.machinegun] > 0) { MachinegunEastAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X + 10 + offsetPosition.X, player.avatar.position.Y + offsetPosition.Y + 1), SpriteEffects.None, layerIndex, 0f, Color.White); } else { PistolShotEastAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X + 7 + offsetPosition.X, player.avatar.position.Y + offsetPosition.Y + 1), SpriteEffects.None, layerIndex, 0f, Color.White); } } break; case GunType.flamethrower: if (player.avatar.character == 0) { this.ScreenManager.SpriteBatch.Draw(ShotgunEastTexture[player.avatar.character], new Rectangle(Convert.ToInt32(player.avatar.position.X + 7 + offsetPosition.X), Convert.ToInt32(player.avatar.position.Y + offsetPosition.Y + 4), 71, ShotgunEastTexture[player.avatar.character].Height), new Rectangle(0, 0, 71, ShotgunEastTexture[player.avatar.character].Height), Color.White, 0.0f, Vector2.Zero, SpriteEffects.None, layerIndex); } else { this.ScreenManager.SpriteBatch.Draw(ShotgunEastTexture[player.avatar.character], new Rectangle(Convert.ToInt32(player.avatar.position.X + 10 + offsetPosition.X), Convert.ToInt32(player.avatar.position.Y + offsetPosition.Y + 1), 69, ShotgunEastTexture[player.avatar.character].Height), new Rectangle(0, 0, 69, ShotgunEastTexture[player.avatar.character].Height), Color.White, 0.0f, Vector2.Zero, SpriteEffects.None, layerIndex); } DrawFlameThrower(player.avatar, layerIndex); break; default: break; } } else if (Angles.IsSouthEast(player.avatar.shotAngle)) { switch (player.avatar.currentgun) { case GunType.pistol: case GunType.shotgun: case GunType.machinegun: if (player.avatar.character == 0) { if (player.avatar.ammo[(int)GunType.machinegun] > 0) { MachinegunSEAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X + 7 + offsetPosition.X, player.avatar.position.Y + offsetPosition.Y + 4), SpriteEffects.None, layerIndex, 0f, Color.White); } else { PistolShotSEAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X + 7 + offsetPosition.X, player.avatar.position.Y + offsetPosition.Y + 4), SpriteEffects.None, layerIndex, 0f, Color.White); } } else { if (player.avatar.ammo[(int)GunType.machinegun] > 0) { MachinegunSEAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X + 10 + offsetPosition.X, player.avatar.position.Y + offsetPosition.Y + 1), SpriteEffects.None, layerIndex, 0f, Color.White); } else { PistolShotSEAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X + 10 + offsetPosition.X, player.avatar.position.Y + offsetPosition.Y + 1), SpriteEffects.None, layerIndex, 0f, Color.White); } } break; case GunType.flamethrower: if (player.avatar.character == 0) { this.ScreenManager.SpriteBatch.Draw(ShotgunSETexture[player.avatar.character], new Rectangle(Convert.ToInt32(player.avatar.position.X + 7 + offsetPosition.X), Convert.ToInt32(player.avatar.position.Y + offsetPosition.Y + 4), 58, ShotgunSETexture[player.avatar.character].Height), new Rectangle(0, 0, 58, ShotgunSETexture[player.avatar.character].Height), Color.White, 0.0f, Vector2.Zero, SpriteEffects.None, layerIndex); } else { this.ScreenManager.SpriteBatch.Draw(ShotgunSETexture[player.avatar.character], new Rectangle(Convert.ToInt32(player.avatar.position.X + 10 + offsetPosition.X), Convert.ToInt32(player.avatar.position.Y + offsetPosition.Y + 1), 54, ShotgunSETexture[player.avatar.character].Height), new Rectangle(0, 0, 54, ShotgunSETexture[player.avatar.character].Height), Color.White, 0.0f, Vector2.Zero, SpriteEffects.None, layerIndex); } DrawFlameThrower(player.avatar, layerIndex); break; default: break; } } else if (Angles.IsSouth(player.avatar.shotAngle)) { switch (player.avatar.currentgun) { case GunType.pistol: case GunType.shotgun: case GunType.machinegun: if (player.avatar.character == 0) { if (player.avatar.ammo[(int)GunType.machinegun] > 0) { MachinegunSouthAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X + 7 + offsetPosition.X, player.avatar.position.Y + offsetPosition.Y + 4), SpriteEffects.None, layerIndex, 0f, Color.White); } else { PistolShotSouthAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X + 7 + offsetPosition.X, player.avatar.position.Y + offsetPosition.Y + 4), SpriteEffects.None, layerIndex, 0f, Color.White); } } else { if (player.avatar.ammo[(int)GunType.machinegun] > 0) { MachinegunSouthAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X + 10 + offsetPosition.X, player.avatar.position.Y + offsetPosition.Y + 1), SpriteEffects.None, layerIndex, 0f, Color.White); } else { PistolShotSouthAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X + 3 + offsetPosition.X, player.avatar.position.Y + offsetPosition.Y + 1), SpriteEffects.None, layerIndex, 0f, Color.White); } } break; case GunType.flamethrower: if (player.avatar.character == 0) { this.ScreenManager.SpriteBatch.Draw(ShotgunSouthTexture[player.avatar.character], new Rectangle(Convert.ToInt32(player.avatar.position.X + 7 + offsetPosition.X), Convert.ToInt32(player.avatar.position.Y + offsetPosition.Y + 4), 21, ShotgunSouthTexture[player.avatar.character].Height), new Rectangle(0, 0, 21, ShotgunSouthTexture[player.avatar.character].Height), Color.White, 0.0f, Vector2.Zero, SpriteEffects.None, layerIndex); } else { this.ScreenManager.SpriteBatch.Draw(ShotgunSouthTexture[player.avatar.character], new Rectangle(Convert.ToInt32(player.avatar.position.X + 10 + offsetPosition.X), Convert.ToInt32(player.avatar.position.Y + offsetPosition.Y + 1), 20, ShotgunSouthTexture[player.avatar.character].Height), new Rectangle(0, 0, 20, ShotgunSouthTexture[player.avatar.character].Height), Color.White, 0.0f, Vector2.Zero, SpriteEffects.None, layerIndex); } DrawFlameThrower(player.avatar, layerIndex); break; default: break; } } else if (Angles.IsSouthWest(player.avatar.shotAngle)) { switch (player.avatar.currentgun) { case GunType.pistol: case GunType.shotgun: case GunType.machinegun: if (player.avatar.character == 0) { if (player.avatar.ammo[(int)GunType.machinegun] > 0) { MachinegunSEAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X + 1 + offsetPosition.X, player.avatar.position.Y + offsetPosition.Y + 4), SpriteEffects.FlipHorizontally, layerIndex, 0f, Color.White); } else { PistolShotSEAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X - 6 + offsetPosition.X, player.avatar.position.Y + offsetPosition.Y + 4), SpriteEffects.FlipHorizontally, layerIndex, 0f, Color.White); } } else { if (player.avatar.ammo[(int)GunType.machinegun] > 0) { MachinegunSEAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X + 4 + offsetPosition.X, player.avatar.position.Y + offsetPosition.Y + 2), SpriteEffects.FlipHorizontally, layerIndex, 0f, Color.White); } else { PistolShotSEAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X + 7 + offsetPosition.X, player.avatar.position.Y + offsetPosition.Y + 1), SpriteEffects.FlipHorizontally, layerIndex, 0f, Color.White); } } break; case GunType.flamethrower: if (player.avatar.character == 0) { this.ScreenManager.SpriteBatch.Draw(ShotgunSETexture[player.avatar.character], new Rectangle(Convert.ToInt32(player.avatar.position.X + 1 + offsetPosition.X - 29), Convert.ToInt32(player.avatar.position.Y + offsetPosition.Y + 4), 58, ShotgunSETexture[player.avatar.character].Height), new Rectangle(0, 0, 58, ShotgunSETexture[player.avatar.character].Height), Color.White, 0.0f, Vector2.Zero, SpriteEffects.FlipHorizontally, layerIndex); } else { this.ScreenManager.SpriteBatch.Draw(ShotgunSETexture[player.avatar.character], new Rectangle(Convert.ToInt32(player.avatar.position.X + 4 + offsetPosition.X - 27), Convert.ToInt32(player.avatar.position.Y + offsetPosition.Y + 2), 54, ShotgunSETexture[player.avatar.character].Height), new Rectangle(0, 0, 54, ShotgunSETexture[player.avatar.character].Height), Color.White, 0.0f, Vector2.Zero, SpriteEffects.FlipHorizontally, layerIndex); } DrawFlameThrower(player.avatar, layerIndex); break; default: break; } } else if (Angles.IsWest(player.avatar.shotAngle)) { switch (player.avatar.currentgun) { case GunType.pistol: case GunType.shotgun: case GunType.machinegun: if (player.avatar.character == 0) { if (player.avatar.ammo[(int)GunType.machinegun] > 0) { MachinegunEastAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X - 6 + offsetPosition.X, player.avatar.position.Y + offsetPosition.Y + 4), SpriteEffects.FlipHorizontally, layerIndex, 0f, Color.White); } else { PistolShotEastAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X - 6 + offsetPosition.X, player.avatar.position.Y + offsetPosition.Y + 4), SpriteEffects.FlipHorizontally, layerIndex, 0f, Color.White); } } else { if (player.avatar.ammo[(int)GunType.machinegun] > 0) { MachinegunEastAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X - 4 + offsetPosition.X, player.avatar.position.Y + offsetPosition.Y + 2), SpriteEffects.FlipHorizontally, layerIndex, 0f, Color.White); } else { PistolShotEastAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X + 2 + offsetPosition.X, player.avatar.position.Y + offsetPosition.Y + 1), SpriteEffects.FlipHorizontally, layerIndex, 0f, Color.White); } } break; case GunType.flamethrower: if (player.avatar.character == 0) { this.ScreenManager.SpriteBatch.Draw(ShotgunEastTexture[player.avatar.character], new Rectangle(Convert.ToInt32(player.avatar.position.X - 6 + offsetPosition.X - 35), Convert.ToInt32(player.avatar.position.Y + offsetPosition.Y + 4), 71, ShotgunEastTexture[player.avatar.character].Height), new Rectangle(0, 0, 71, ShotgunEastTexture[player.avatar.character].Height), Color.White, 0.0f, Vector2.Zero, SpriteEffects.FlipHorizontally, layerIndex); } else { this.ScreenManager.SpriteBatch.Draw(ShotgunEastTexture[player.avatar.character], new Rectangle(Convert.ToInt32(player.avatar.position.X - 4 + offsetPosition.X - 34), Convert.ToInt32(player.avatar.position.Y + offsetPosition.Y + 2), 69, ShotgunEastTexture[player.avatar.character].Height), new Rectangle(0, 0, 69, ShotgunEastTexture[player.avatar.character].Height), Color.White, 0.0f, Vector2.Zero, SpriteEffects.FlipHorizontally, layerIndex); } DrawFlameThrower(player.avatar, layerIndex); break; default: break; } } else if (Angles.IsNorthWest(player.avatar.shotAngle)) { switch (player.avatar.currentgun) { case GunType.pistol: case GunType.shotgun: case GunType.machinegun: if (player.avatar.character == 0) { if (player.avatar.ammo[(int)GunType.machinegun] > 0) { MachinegunNEAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X + offsetPosition.X, player.avatar.position.Y + offsetPosition.Y - 14), SpriteEffects.FlipHorizontally, layerIndex, 0f, Color.White); } else { PistolShotNEAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X - 6 + offsetPosition.X, player.avatar.position.Y + offsetPosition.Y - 18), SpriteEffects.FlipHorizontally, layerIndex, 0f, Color.White); } } else { if (player.avatar.ammo[(int)GunType.machinegun] > 0) { MachinegunNEAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X + offsetPosition.X + 4, player.avatar.position.Y + offsetPosition.Y - 13), SpriteEffects.FlipHorizontally, layerIndex, 0f, Color.White); } else { PistolShotNEAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X + 2 + offsetPosition.X, player.avatar.position.Y + offsetPosition.Y - 18), SpriteEffects.FlipHorizontally, layerIndex, 0f, Color.White); } } break; case GunType.flamethrower: if (player.avatar.character == 0) { this.ScreenManager.SpriteBatch.Draw(ShotgunNETexture[player.avatar.character], new Rectangle(Convert.ToInt32(player.avatar.position.X + offsetPosition.X - 29), Convert.ToInt32(player.avatar.position.Y + offsetPosition.Y - 14), 59, ShotgunNETexture[player.avatar.character].Height), new Rectangle(0, 0, 59, ShotgunNETexture[player.avatar.character].Height), Color.White, 0.0f, Vector2.Zero, SpriteEffects.FlipHorizontally, layerIndex); } else { this.ScreenManager.SpriteBatch.Draw(ShotgunNETexture[player.avatar.character], new Rectangle(Convert.ToInt32(player.avatar.position.X + offsetPosition.X + 4 - 26), Convert.ToInt32(player.avatar.position.Y + offsetPosition.Y - 13), 53, ShotgunNETexture[player.avatar.character].Height), new Rectangle(0, 0, 53, ShotgunNETexture[player.avatar.character].Height), Color.White, 0.0f, Vector2.Zero, SpriteEffects.FlipHorizontally, layerIndex); } DrawFlameThrower(player.avatar, layerIndex); break; default: break; } } } // Draw Movement LEGS if (player.avatar.accumMove.Length() > .5) { if (player.avatar.character == 0) { if (player.avatar.accumMove.X > 0) { if (player.avatar.accumFire.Length() < .5) { if (player.avatar.currentgun == GunType.pistol) { IdleTrunkAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X + offsetPosition.X, player.avatar.position.Y + offsetPosition.Y), SpriteEffects.None, layerIndex, 0f, Color.White); } else { this.ScreenManager.SpriteBatch.Draw(ShotgunEastTexture[player.avatar.character], new Rectangle(Convert.ToInt32(player.avatar.position.X + 7 + offsetPosition.X), Convert.ToInt32(player.avatar.position.Y + offsetPosition.Y + 4), 71, ShotgunEastTexture[player.avatar.character].Height), new Rectangle(0, 0, 71, ShotgunEastTexture[player.avatar.character].Height), Color.White, 0.0f, Vector2.Zero, SpriteEffects.None, layerIndex); } } RunEastAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X - 7 + offsetPosition.X, player.avatar.position.Y - 26), SpriteEffects.None, layerIndex + 0.001f, 0f, Color.White); } else { if (player.avatar.accumFire.Length() < .5) { if (player.avatar.currentgun == GunType.pistol) { IdleTrunkAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X + offsetPosition.X + 16, player.avatar.position.Y + offsetPosition.Y), SpriteEffects.FlipHorizontally, layerIndex, 0f, Color.White); } else { this.ScreenManager.SpriteBatch.Draw(ShotgunEastTexture[player.avatar.character], new Rectangle(Convert.ToInt32(player.avatar.position.X - 6 + offsetPosition.X - 35), Convert.ToInt32(player.avatar.position.Y + offsetPosition.Y + 4), 71, ShotgunEastTexture[player.avatar.character].Height), new Rectangle(0, 0, 71, ShotgunEastTexture[player.avatar.character].Height), Color.White, 0.0f, Vector2.Zero, SpriteEffects.FlipHorizontally, layerIndex); } } RunEastAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X + 18 + offsetPosition.X, player.avatar.position.Y - 26), SpriteEffects.FlipHorizontally, layerIndex + 0.001f, 0f, Color.White); } } else { if (player.avatar.accumMove.X > 0) { if (player.avatar.accumFire.Length() < .5) { if (player.avatar.currentgun == GunType.pistol) { IdleTrunkAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X + offsetPosition.X + 10, player.avatar.position.Y + offsetPosition.Y + 1), SpriteEffects.None, layerIndex, 0f, Color.White); } else { this.ScreenManager.SpriteBatch.Draw(ShotgunEastTexture[player.avatar.character], new Rectangle(Convert.ToInt32(player.avatar.position.X + 10 + offsetPosition.X), Convert.ToInt32(player.avatar.position.Y + offsetPosition.Y + 1), 69, ShotgunEastTexture[player.avatar.character].Height), new Rectangle(0, 0, 69, ShotgunEastTexture[player.avatar.character].Height), Color.White, 0.0f, Vector2.Zero, SpriteEffects.None, layerIndex); } } RunEastAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X - 4 + offsetPosition.X, player.avatar.position.Y - 24), SpriteEffects.None, layerIndex + 0.001f, 0f, Color.White); } else { if (player.avatar.accumFire.Length() < .5) { if (player.avatar.currentgun == GunType.pistol) { IdleTrunkAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X + offsetPosition.X + 19, player.avatar.position.Y + offsetPosition.Y + 1), SpriteEffects.FlipHorizontally, layerIndex, 0f, Color.White); } else { this.ScreenManager.SpriteBatch.Draw(ShotgunEastTexture[player.avatar.character], new Rectangle(Convert.ToInt32(player.avatar.position.X - 4 + offsetPosition.X - 34), Convert.ToInt32(player.avatar.position.Y + offsetPosition.Y + 2), 69, ShotgunEastTexture[player.avatar.character].Height), new Rectangle(0, 0, 69, ShotgunEastTexture[player.avatar.character].Height), Color.White, 0.0f, Vector2.Zero, SpriteEffects.FlipHorizontally, layerIndex); } } RunEastAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X + 20 + offsetPosition.X, player.avatar.position.Y - 24), SpriteEffects.FlipHorizontally, layerIndex + 0.001f, 0f, Color.White); } } } else { if (player.avatar.accumFire.Length() < .5) { if (player.avatar.character == 0) { if (player.avatar.currentgun == GunType.pistol) { IdleTrunkAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X + offsetPosition.X, player.avatar.position.Y + offsetPosition.Y), SpriteEffects.None, layerIndex, 0f, Color.White); } else { this.ScreenManager.SpriteBatch.Draw(ShotgunEastTexture[player.avatar.character], new Rectangle(Convert.ToInt32(player.avatar.position.X + 7 + offsetPosition.X), Convert.ToInt32(player.avatar.position.Y + offsetPosition.Y + 4), 71, ShotgunEastTexture[player.avatar.character].Height), new Rectangle(0, 0, 71, ShotgunEastTexture[player.avatar.character].Height), Color.White, 0.0f, Vector2.Zero, SpriteEffects.None, layerIndex); } } else { if (player.avatar.currentgun == GunType.pistol) { IdleTrunkAnimation[player.avatar.character].Draw(this.ScreenManager.SpriteBatch, new Vector2(player.avatar.position.X + offsetPosition.X + 10, player.avatar.position.Y + offsetPosition.Y + 1), SpriteEffects.None, layerIndex, 0f, Color.White); } else { this.ScreenManager.SpriteBatch.Draw(ShotgunEastTexture[player.avatar.character], new Rectangle(Convert.ToInt32(player.avatar.position.X + 10 + offsetPosition.X), Convert.ToInt32(player.avatar.position.Y + offsetPosition.Y + 1), 69, ShotgunEastTexture[player.avatar.character].Height), new Rectangle(0, 0, 69, ShotgunEastTexture[player.avatar.character].Height), Color.White, 0.0f, Vector2.Zero, SpriteEffects.None, layerIndex); } } } this.ScreenManager.SpriteBatch.Draw(IdleLegsTexture[player.avatar.character], new Rectangle(Convert.ToInt32(player.avatar.position.X + 7 + offsetPosition.X), Convert.ToInt32(player.avatar.position.Y + offsetPosition.Y + 3), IdleLegsTexture[player.avatar.character].Width, IdleLegsTexture[player.avatar.character].Height), new Rectangle(0, 0, IdleLegsTexture[player.avatar.character].Width, IdleLegsTexture[player.avatar.character].Height), Color.White, 0.0f, Vector2.Zero, SpriteEffects.None, layerIndex + 0.001f); } } // Draw the SHADOW OF THE CHARACTER this.ScreenManager.SpriteBatch.Draw(CharacterShadow, new Rectangle(Convert.ToInt32(player.avatar.position.X + IdleLegsTexture[player.avatar.character].Width / 2 - 5 + offsetPosition.X), Convert.ToInt32(player.avatar.position.Y + IdleLegsTexture[player.avatar.character].Height - 6 + offsetPosition.Y), CharacterShadow.Width, CharacterShadow.Height), new Rectangle(0, 0, CharacterShadow.Width, CharacterShadow.Height), new Color(255, 255, 255, 50), 0.0f, Vector2.Zero, SpriteEffects.None, layerIndex + 0.01f); break; default: break; } } private void DrawFlameThrower(Avatar player, float layerIndex) { if (player.currentgun == GunType.flamethrower && player.ammo[(int)GunType.flamethrower] > 0) { flamethrowerAnimation.Draw(this.ScreenManager.SpriteBatch, player.FlameThrowerPosition, SpriteEffects.None, layerIndex, player.FlameThrowerAngle, Color.White); } } private void DrawShotgunShots(List<ShotgunShell> shotgunbullets, double TotalGameSeconds) { SpriteBatch batch = this.ScreenManager.SpriteBatch; batch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, null, null, null, Resolution.getTransformationMatrix()); Vector2 pos; for (int i = 0; i < shotgunbullets.Count; i++) { for (int j = 0; j < shotgunbullets[i].Pellet.Count; j++) { pos = GameplayHelper.FindShotgunBulletPosition(shotgunbullets[i].Pellet[j], shotgunbullets[i].Angle, j, TotalGameSeconds); if (pos.X < -10 || pos.X > 1290 || pos.Y < -10 || pos.Y > 730) { shotgunbullets[i].Pellet.RemoveAt(j); } else { batch.Draw(bullet, pos, null, Color.White, shotgunbullets[i].Angle, bulletorigin, 1.0f, SpriteEffects.None, 0.6f); } } if (shotgunbullets[i].Pellet.Count == 0) { shotgunbullets.RemoveAt(i); } } batch.End(); } private void DrawBullets(List<Vector4> bullets, double TotalGameSeconds) { SpriteBatch batch = this.ScreenManager.SpriteBatch; batch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, null, null, null, Resolution.getTransformationMatrix()); Vector2 pos; for (int i = 0; i < bullets.Count; i++) { pos = GameplayHelper.FindBulletPosition(bullets[i], TotalGameSeconds); if (pos.X < -10 || pos.X > 1290 || pos.Y < -10 || pos.Y > 730) { bullets.RemoveAt(i); } else { batch.Draw(bullet, pos, null, Color.White, bullets[i].W, bulletorigin, 1.0f, SpriteEffects.None, 0.6f); } } batch.End(); } private void DrawUI(GameTime gameTime) { Vector2 Pos = new Vector2(uiBounds.X+ 10, uiBounds.Y+20); SpriteBatch batch = this.ScreenManager.SpriteBatch; batch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, null, null, null, Resolution.getTransformationMatrix()); foreach (Player player in game.players) { if (player != null) { if (player.avatar.status == ObjectStatus.Active || player.avatar.IsPlayingTheGame) { if (player.avatar.lives != 0) { batch.Draw(UIStats, new Vector2(Pos.X, Pos.Y - 20), Color.White); if (player.avatar.color == Color.Blue) { batch.Draw(UIStatsBlue, new Vector2(Pos.X, Pos.Y - 20), Color.White); } if (player.avatar.color == Color.Red) { batch.Draw(UIStatsRed, new Vector2(Pos.X, Pos.Y - 20), Color.White); } if (player.avatar.color == Color.Green) { batch.Draw(UIStatsGreen, new Vector2(Pos.X, Pos.Y - 20), Color.White); } if (player.avatar.color == Color.Yellow) { batch.Draw(UIStatsYellow, new Vector2(Pos.X, Pos.Y - 20), Color.White); } switch (player.avatar.character) { case 0: batch.Draw(jadeUI, new Rectangle(Convert.ToInt32(Pos.X) - jadeUI.Width / 2 + 5, Convert.ToInt32(Pos.Y - 34), jadeUI.Width, jadeUI.Height), Color.White); break; case 1: batch.Draw(richardUI, new Rectangle(Convert.ToInt32(Pos.X - 48), Convert.ToInt32(Pos.Y - 43), richardUI.Width, richardUI.Height), null, Color.White, 0.0f, Vector2.Zero, SpriteEffects.FlipHorizontally, 1.0f); break; case 2: batch.Draw(rayUI, new Rectangle(Convert.ToInt32(Pos.X - 30), Convert.ToInt32(Pos.Y - 39), rayUI.Width, rayUI.Height), Color.White); break; case 3: batch.Draw(peterUI, new Rectangle(Convert.ToInt32(Pos.X + 20) - peterUI.Width / 2, Convert.ToInt32(Pos.Y - 35), peterUI.Width, peterUI.Height), Color.White); break; } batch.DrawString(arcade14, "x", new Vector2(Pos.X + 40, Pos.Y + 17), Color.White); batch.DrawString(arcade28, player.avatar.lives.ToString(), new Vector2(Pos.X + 60, Pos.Y), Color.White); // Draw Player Life Counter batch.Draw(enemies.heart, new Vector2(Pos.X + 120, Pos.Y + 3), Color.White); batch.DrawString(arcade14, player.avatar.lifecounter.ToString("000"), new Vector2(Pos.X + enemies.heart.Width + 125, Pos.Y), Color.White); switch (player.avatar.currentgun) { case GunType.pistol: batch.Draw(enemies.pistolammoUI, new Vector2(Pos.X + 124, Pos.Y + 23), Color.White); batch.DrawString(arcade14, "- - -", new Vector2(Pos.X + enemies.heart.Width + 130, Pos.Y + 22), Color.Black); break; case GunType.machinegun: batch.Draw(enemies.pistolammoUI, new Vector2(Pos.X + 116, Pos.Y + 23), Color.White); batch.Draw(enemies.pistolammoUI, new Vector2(Pos.X + 124, Pos.Y + 23), Color.White); batch.Draw(enemies.pistolammoUI, new Vector2(Pos.X + 132, Pos.Y + 23), Color.White); batch.DrawString(arcade14, player.avatar.ammo[(int)GunType.machinegun].ToString("000"), new Vector2(Pos.X + enemies.heart.Width + 125, Pos.Y + 20), Color.White); break; case GunType.shotgun: batch.Draw(enemies.shotgunammoUI, new Vector2(Pos.X + 123, Pos.Y + 22), Color.White); batch.DrawString(arcade14, player.avatar.ammo[(int)GunType.shotgun].ToString("000"), new Vector2(Pos.X + enemies.heart.Width + 125, Pos.Y + 20), Color.White); break; case GunType.grenade: batch.Draw(enemies.grenadeammoUI, new Vector2(Pos.X + 122, Pos.Y + 21), Color.White); batch.DrawString(arcade14, player.avatar.ammo[(int)GunType.grenade].ToString("000"), new Vector2(Pos.X + enemies.heart.Width + 125, Pos.Y + 20), Color.White); break; case GunType.flamethrower: batch.Draw(enemies.flamethrowerammoUI, new Vector2(Pos.X + 124, Pos.Y + 23), Color.White); batch.DrawString(arcade14, player.avatar.ammo[(int)GunType.flamethrower].ToString("000"), new Vector2(Pos.X + enemies.heart.Width + 125, Pos.Y + 20), Color.White); break; default: batch.DrawString(arcade14, "000", new Vector2(Pos.X + enemies.heart.Width + 125, Pos.Y + 20), Color.White); break; } batch.DrawString(arcade14, "SC" + player.avatar.score.ToString("0000000"), new Vector2(Pos.X + 13, Pos.Y + 48), Color.White); Pos.X += UIStats.Width + 50; } else { batch.DrawString(MenuInfoFont, Strings.GameOverString, new Vector2(Pos.X, Pos.Y), Color.White); Pos.X += (int)(MenuInfoFont.MeasureString(Strings.GameOverString).X) + 100; } } } } string levelstring; switch (currentLevel) { case LevelType.One: levelstring = Strings.LevelSelectMenuString + " " + Strings.NumberOne; break; case LevelType.Two: levelstring = Strings.LevelSelectMenuString + " " + Strings.NumberTwo; break; case LevelType.Three: levelstring = Strings.LevelSelectMenuString + " " + Strings.NumberThree; break; case LevelType.Four: levelstring = Strings.LevelSelectMenuString + " " + Strings.NumberFour; break; case LevelType.Five: levelstring = Strings.LevelSelectMenuString + " " + Strings.NumberFive; break; case LevelType.Six: levelstring = Strings.LevelSelectMenuString + " " + Strings.NumberSix; break; case LevelType.Seven: levelstring = Strings.LevelSelectMenuString + " " + Strings.NumberSeven; break; case LevelType.Eight: levelstring = Strings.LevelSelectMenuString + " " + Strings.NumberEight; break; case LevelType.Nine: levelstring = Strings.LevelSelectMenuString + " " + Strings.NumberNine; break; case LevelType.Ten: levelstring = Strings.LevelSelectMenuString + " " + Strings.NumberTen; break; default: levelstring = Strings.LevelSelectMenuString + " " + Strings.NumberOne; break; } batch.DrawString(MenuInfoFont, levelstring.ToUpper(), new Vector2(uiBounds.Width - MenuInfoFont.MeasureString(levelstring).X / 2, uiBounds.Height - 20), Color.White); string sublevelstring; switch (currentSublevel) { case SubLevel.SubLevelType.One: sublevelstring = Strings.WaveGameplayString + " " + Strings.NumberOne; break; case SubLevel.SubLevelType.Two: sublevelstring = Strings.WaveGameplayString + " " + Strings.NumberTwo; break; case SubLevel.SubLevelType.Three: sublevelstring = Strings.WaveGameplayString + " " + Strings.NumberThree; break; case SubLevel.SubLevelType.Four: sublevelstring = Strings.WaveGameplayString + " " + Strings.NumberFour; break; case SubLevel.SubLevelType.Five: sublevelstring = Strings.WaveGameplayString + " " + Strings.NumberFive; break; case SubLevel.SubLevelType.Six: sublevelstring = Strings.WaveGameplayString + " " + Strings.NumberSix; break; case SubLevel.SubLevelType.Seven: sublevelstring = Strings.WaveGameplayString + " " + Strings.NumberSeven; break; case SubLevel.SubLevelType.Eight: sublevelstring = Strings.WaveGameplayString + " " + Strings.NumberEight; break; case SubLevel.SubLevelType.Nine: sublevelstring = Strings.WaveGameplayString + " " + Strings.NumberNine; break; case SubLevel.SubLevelType.Ten: sublevelstring = Strings.WaveGameplayString + " " + Strings.NumberTen; break; default: sublevelstring = Strings.WaveGameplayString + " " + Strings.NumberOne; break; } batch.DrawString(MenuInfoFont, sublevelstring.ToUpper(), new Vector2(uiBounds.Width - MenuInfoFont.MeasureString(sublevelstring).X / 2, uiBounds.Height), Color.White); #if DEMO batch.DrawString(MenuInfoFont, Strings.TrialModeMenuString.ToUpper(), new Vector2(uiBounds.Width - MenuInfoFont.MeasureString(Strings.TrialModeMenuString.ToUpper()).X / 2, uiBounds.Height + 20), Color.White); #endif if (game.currentInputMode == InputMode.Touch) { batch.Draw(pause_icon, new Vector2(uiBounds.Width + 70, uiBounds.Y - 30), Color.White); // if the user is touching the screen and the thumbsticks have positions, // draw our thumbstick sprite so the user knows where the centers are if (VirtualThumbsticks.LeftThumbstickCenter.HasValue && !bPaused && GamePlayStatus == GameplayState.Playing) { batch.Draw( left_thumbstick, VirtualThumbsticks.LeftThumbstickCenter.Value - new Vector2(left_thumbstick.Width / 2f, left_thumbstick.Height / 2f), Color.White); } if (VirtualThumbsticks.RightThumbstickCenter.HasValue && !bPaused && GamePlayStatus == GameplayState.Playing) { batch.Draw( right_thumbstick, VirtualThumbsticks.RightThumbstickCenter.Value - new Vector2(right_thumbstick.Width / 2f, right_thumbstick.Height / 2f), Color.White); } } batch.End(); } #endregion public void IncreaseScore(byte player, short amount) { game.players[player].avatar.score += amount; } public void PlayerMove(Player player, Vector2 pos) { player.avatar.position = pos; player.avatar.entity.Position = pos; } public void PlayerFire(Player player, float totalGameSeconds, float angle, Vector2 direction) { if (Angles.IsNorth(angle)) { if (player.avatar.currentgun == GunType.flamethrower) { if (player.avatar.character == 0) { player.avatar.SetFlameThrower(new Vector2(player.avatar.position.X - 27, player.avatar.position.Y - 55), angle); } else { player.avatar.SetFlameThrower(new Vector2(player.avatar.position.X - 25, player.avatar.position.Y - 61), angle); } } else if (player.avatar.currentgun == GunType.shotgun) { player.avatar.shotgunbullets.Add(new ShotgunShell(new Vector2(player.avatar.position.X + 4, player.avatar.position.Y - 60), direction, angle, totalGameSeconds)); } else { if (player.avatar.ammo[(int)GunType.machinegun] > 0 || player.avatar.ammo[(int)GunType.shotgun] > 0) { if (player.avatar.character == 0) { player.avatar.bullets.Add(new Vector4(player.avatar.position.X + 4, player.avatar.position.Y - 55, totalGameSeconds, angle)); } else { player.avatar.bullets.Add(new Vector4(player.avatar.position.X + 6, player.avatar.position.Y - 61, totalGameSeconds, angle)); } } else { if (player.avatar.character == 0) { player.avatar.bullets.Add(new Vector4(player.avatar.position.X + 5, player.avatar.position.Y - 57, totalGameSeconds, angle)); } else { player.avatar.bullets.Add(new Vector4(player.avatar.position.X + 8, player.avatar.position.Y - 63, totalGameSeconds, angle)); } } } } else if (Angles.IsNorthEast(angle)) { if (player.avatar.currentgun == GunType.flamethrower) { if (player.avatar.character == 0) { player.avatar.SetFlameThrower(new Vector2(player.avatar.position.X - 3, player.avatar.position.Y - 67), angle); } else { player.avatar.SetFlameThrower(new Vector2(player.avatar.position.X, player.avatar.position.Y - 70), angle); } } else if (player.avatar.currentgun == GunType.shotgun) { player.avatar.shotgunbullets.Add(new ShotgunShell(new Vector2(player.avatar.position.X + 27, player.avatar.position.Y - 60), direction, angle, totalGameSeconds)); } else { if (player.avatar.ammo[(int)GunType.machinegun] > 0) { player.avatar.bullets.Add(new Vector4(player.avatar.position.X + 33, player.avatar.position.Y - 60, totalGameSeconds, angle)); } else { player.avatar.bullets.Add(new Vector4(player.avatar.position.X + 27, player.avatar.position.Y - 60, totalGameSeconds, angle)); } } } else if (Angles.IsEast(angle)) { if (player.avatar.currentgun == GunType.flamethrower) { if (player.avatar.character == 0) { player.avatar.SetFlameThrower(new Vector2(player.avatar.position.X + 30, player.avatar.position.Y - 58), angle); } else { player.avatar.SetFlameThrower(new Vector2(player.avatar.position.X + 30, player.avatar.position.Y - 60), angle); } } else if (player.avatar.currentgun == GunType.shotgun) { player.avatar.shotgunbullets.Add(new ShotgunShell(new Vector2(player.avatar.position.X + 37, player.avatar.position.Y - 29), direction, angle, totalGameSeconds)); } else { if (player.avatar.ammo[(int)GunType.machinegun] > 0) { if (player.avatar.character == 0) { player.avatar.bullets.Add(new Vector4(new Vector2(player.avatar.position.X + 35, player.avatar.position.Y - 27), totalGameSeconds, angle)); } else { player.avatar.bullets.Add(new Vector4(new Vector2(player.avatar.position.X + 37, player.avatar.position.Y - 29), totalGameSeconds, angle)); } } else { if (player.avatar.character == 0) { player.avatar.bullets.Add(new Vector4(new Vector2(player.avatar.position.X + 35, player.avatar.position.Y - 34), totalGameSeconds, angle)); } else { player.avatar.bullets.Add(new Vector4(new Vector2(player.avatar.position.X + 36, player.avatar.position.Y - 38), totalGameSeconds, angle)); } } } } else if (Angles.IsSouthEast(angle)) { if (player.avatar.currentgun == GunType.flamethrower) { if (player.avatar.character == 0) { player.avatar.SetFlameThrower(new Vector2(player.avatar.position.X + 45, player.avatar.position.Y - 27), angle); } else { player.avatar.SetFlameThrower(new Vector2(player.avatar.position.X + 47, player.avatar.position.Y - 28), angle); } } else if (player.avatar.currentgun == GunType.shotgun) { player.avatar.shotgunbullets.Add(new ShotgunShell(new Vector2(player.avatar.position.X + 32, player.avatar.position.Y), direction, angle, totalGameSeconds)); } else { if (player.avatar.ammo[(int)GunType.machinegun] > 0) { player.avatar.bullets.Add(new Vector4(player.avatar.position.X + 27, player.avatar.position.Y, totalGameSeconds, angle)); } else { player.avatar.bullets.Add(new Vector4(player.avatar.position.X + 32, player.avatar.position.Y - 5, totalGameSeconds, angle)); } } } else if (Angles.IsSouth(angle)) { if (player.avatar.currentgun == GunType.flamethrower) { if (player.avatar.character == 0) { player.avatar.SetFlameThrower(new Vector2(player.avatar.position.X + 35, player.avatar.position.Y + 2), angle); } else { player.avatar.SetFlameThrower(new Vector2(player.avatar.position.X + 37, player.avatar.position.Y + 2), angle); } } else if (player.avatar.currentgun == GunType.shotgun) { player.avatar.shotgunbullets.Add(new ShotgunShell(new Vector2(player.avatar.position.X + 4, player.avatar.position.Y + 7), direction, angle, totalGameSeconds)); } else { if (player.avatar.ammo[(int)GunType.machinegun] > 0) { if (player.avatar.character == 0) { player.avatar.bullets.Add(new Vector4(player.avatar.position.X + 1, player.avatar.position.Y + 5, totalGameSeconds, angle)); } else { player.avatar.bullets.Add(new Vector4(player.avatar.position.X + 4, player.avatar.position.Y + 7, totalGameSeconds, angle)); } } else { if (player.avatar.character == 0) { player.avatar.bullets.Add(new Vector4(player.avatar.position.X + 5, player.avatar.position.Y + 5, totalGameSeconds, angle)); } else { player.avatar.bullets.Add(new Vector4(player.avatar.position.X - 7, player.avatar.position.Y + 5, totalGameSeconds, angle)); } } } } else if (Angles.IsSouthWest(angle)) { if (player.avatar.currentgun == GunType.flamethrower) { if (player.avatar.character == 0) { player.avatar.SetFlameThrower(new Vector2(player.avatar.position.X - 3, player.avatar.position.Y + 19), angle); } else { player.avatar.SetFlameThrower(new Vector2(player.avatar.position.X, player.avatar.position.Y + 19), angle); } } else if (player.avatar.currentgun == GunType.shotgun) { player.avatar.shotgunbullets.Add(new ShotgunShell(new Vector2(player.avatar.position.X - 28, player.avatar.position.Y), direction, angle, totalGameSeconds)); } else { if (player.avatar.ammo[(int)GunType.machinegun] > 0) { player.avatar.bullets.Add(new Vector4(player.avatar.position.X - 28, player.avatar.position.Y, totalGameSeconds, angle)); } else { player.avatar.bullets.Add(new Vector4(player.avatar.position.X - 35, player.avatar.position.Y - 5, totalGameSeconds, angle)); } } } else if (Angles.IsWest(angle)) { if (player.avatar.currentgun == GunType.flamethrower) { if (player.avatar.character == 0) { player.avatar.SetFlameThrower(new Vector2(player.avatar.position.X - 30, player.avatar.position.Y + 6), angle); } else { player.avatar.SetFlameThrower(new Vector2(player.avatar.position.X - 30, player.avatar.position.Y + 6), angle); } } else if (player.avatar.currentgun == GunType.shotgun) { player.avatar.shotgunbullets.Add(new ShotgunShell(new Vector2(player.avatar.position.X - 35, player.avatar.position.Y - 26), direction, angle, totalGameSeconds)); } else { if (player.avatar.ammo[(int)GunType.machinegun] > 0) { player.avatar.bullets.Add(new Vector4(new Vector2(player.avatar.position.X - 35, player.avatar.position.Y - 26), totalGameSeconds, angle)); } else { if (player.avatar.character == 0) { player.avatar.bullets.Add(new Vector4(player.avatar.position.X - 37, player.avatar.position.Y - 34, totalGameSeconds, angle)); } else { player.avatar.bullets.Add(new Vector4(player.avatar.position.X - 36, player.avatar.position.Y - 38, totalGameSeconds, angle)); } } } } else if (Angles.IsNorthWest(angle)) { if (player.avatar.currentgun == GunType.flamethrower) { if (player.avatar.character == 0) { player.avatar.SetFlameThrower(new Vector2(player.avatar.position.X - 46, player.avatar.position.Y - 23), angle); } else { player.avatar.SetFlameThrower(new Vector2(player.avatar.position.X - 44, player.avatar.position.Y - 22), angle); } } else if (player.avatar.currentgun == GunType.shotgun) { player.avatar.shotgunbullets.Add(new ShotgunShell(new Vector2(player.avatar.position.X - 36, player.avatar.position.Y - 57), direction, angle, totalGameSeconds)); } else { if (player.avatar.ammo[(int)GunType.machinegun] > 0) { player.avatar.bullets.Add(new Vector4(player.avatar.position.X - 36, player.avatar.position.Y - 57, totalGameSeconds, angle)); } else { player.avatar.bullets.Add(new Vector4(player.avatar.position.X - 32, player.avatar.position.Y - 60, totalGameSeconds, angle)); } } } if (player.avatar.ammo[(int)player.avatar.currentgun] > 0) { player.avatar.ammo[(int)player.avatar.currentgun] -= 1; } switch (player.avatar.currentgun) { case GunType.pistol: game.audio.PlayShot(); break; case GunType.machinegun: game.audio.PlayMachineGun(); break; case GunType.flamethrower: game.audio.PlayFlameThrower(); break; case GunType.shotgun: game.audio.PlayShotgun(); break; case GunType.grenade: break; default: game.audio.PlayShot(); break; } game.input.PlayShot(player); } private void JadeIdleTrunkAnimationLoad(XDocument doc) { TimeSpan frameInterval; Point sheetSize = new Point(); Point frameSize = new Point(); var definition = doc.Root.Element("JadeIdleTrunkDef"); IdleLegsTexture = new List<Texture2D>(); IdleLegsTexture.Add(game.Content.Load<Texture2D>(@"InGame/Jade/girl_legs_idle")); IdleTrunkTexture = new List<Texture2D>(); IdleTrunkTexture.Add(game.Content.Load<Texture2D>(@"InGame/Jade/girl_anim_idle")); IdleTrunkOrigin = new List<Vector2>(); IdleTrunkOrigin.Add(new Vector2(IdleTrunkTexture[0].Width / 2, IdleTrunkTexture[0].Height / 2)); frameSize.X = int.Parse(definition.Attribute(FRAME_WIDTH).Value, NumberStyles.Integer); frameSize.Y = int.Parse(definition.Attribute(FRAME_HEIGHT).Value, NumberStyles.Integer); sheetSize.X = int.Parse(definition.Attribute(SHEET_COLUMNS).Value, NumberStyles.Integer); sheetSize.Y = int.Parse(definition.Attribute(SHEET_ROWS).Value, NumberStyles.Integer); frameInterval = TimeSpan.FromSeconds(1.0f / int.Parse(definition.Attribute(SPEED).Value, NumberStyles.Integer)); IdleTrunkAnimation = new List<Animation>(); IdleTrunkAnimation.Add(new Animation(IdleTrunkTexture[0], frameSize, sheetSize, frameInterval)); // Define a new Animation instance } private void JadeRunEastAnimationLoad(XDocument doc) { TimeSpan frameInterval; Point sheetSize = new Point(); Point frameSize = new Point(); var definition = doc.Root.Element("JadeRunEDef"); RunEastTexture = new List<Texture2D>(); RunEastTexture.Add(game.Content.Load<Texture2D>(@"InGame/Jade/girl_anim_run_E")); RunEastOrigin = new List<Vector2>(); RunEastOrigin.Add(new Vector2(RunEastTexture[0].Width / 2, RunEastTexture[0].Height / 2)); frameSize.X = int.Parse(definition.Attribute(FRAME_WIDTH).Value, NumberStyles.Integer); frameSize.Y = int.Parse(definition.Attribute(FRAME_HEIGHT).Value, NumberStyles.Integer); sheetSize.X = int.Parse(definition.Attribute(SHEET_COLUMNS).Value, NumberStyles.Integer); sheetSize.Y = int.Parse(definition.Attribute(SHEET_ROWS).Value, NumberStyles.Integer); frameInterval = TimeSpan.FromSeconds(1.0f / int.Parse(definition.Attribute(SPEED).Value, NumberStyles.Integer)); RunEastAnimation = new List<Animation>(); RunEastAnimation.Add(new Animation(RunEastTexture[0], frameSize, sheetSize, frameInterval)); } private void JadePistolShotEastAnimationLoad(XDocument doc) { TimeSpan frameInterval; Point sheetSize = new Point(); Point frameSize = new Point(); var definition = doc.Root.Element("JadePistolShotDef"); PistolShotEastTexture = new List<Texture2D>(); PistolShotEastTexture.Add(game.Content.Load<Texture2D>(@"InGame/Jade/girl_anim_shot_E")); PistolShotEastOrigin = new List<Vector2>(); PistolShotEastOrigin.Add(new Vector2(PistolShotEastTexture[0].Width / 2, PistolShotEastTexture[0].Height / 2)); frameSize.X = int.Parse(definition.Attribute(FRAME_WIDTH).Value, NumberStyles.Integer); frameSize.Y = int.Parse(definition.Attribute(FRAME_HEIGHT).Value, NumberStyles.Integer); sheetSize.X = int.Parse(definition.Attribute(SHEET_COLUMNS).Value, NumberStyles.Integer); sheetSize.Y = int.Parse(definition.Attribute(SHEET_ROWS).Value, NumberStyles.Integer); frameInterval = TimeSpan.FromSeconds(1.0f / int.Parse(definition.Attribute(SPEED).Value, NumberStyles.Integer)); PistolShotEastAnimation = new List<Animation>(); PistolShotEastAnimation.Add(new Animation(PistolShotEastTexture[0], frameSize, sheetSize, frameInterval)); } private void JadePistolShotNorthEastAnimationLoad(XDocument doc) { TimeSpan frameInterval; Point sheetSize = new Point(); Point frameSize = new Point(); var definition = doc.Root.Element("JadePistolShotNEDef"); PistolShotNETexture = new List<Texture2D>(); PistolShotNETexture.Add(game.Content.Load<Texture2D>(@"InGame/Jade/girl_anim_shot_NE")); PistolShotNEOrigin = new List<Vector2>(); PistolShotNEOrigin.Add(new Vector2(PistolShotNETexture[0].Width / 2, PistolShotNETexture[0].Height / 2)); frameSize.X = int.Parse(definition.Attribute(FRAME_WIDTH).Value, NumberStyles.Integer); frameSize.Y = int.Parse(definition.Attribute(FRAME_HEIGHT).Value, NumberStyles.Integer); sheetSize.X = int.Parse(definition.Attribute(SHEET_COLUMNS).Value, NumberStyles.Integer); sheetSize.Y = int.Parse(definition.Attribute(SHEET_ROWS).Value, NumberStyles.Integer); frameInterval = TimeSpan.FromSeconds(1.0f / int.Parse(definition.Attribute(SPEED).Value, NumberStyles.Integer)); PistolShotNEAnimation = new List<Animation>(); PistolShotNEAnimation.Add(new Animation(PistolShotNETexture[0], frameSize, sheetSize, frameInterval)); } private void JadePistolShotSouthEastAnimationLoad(XDocument doc) { TimeSpan frameInterval; Point sheetSize = new Point(); Point frameSize = new Point(); var definition = doc.Root.Element("JadePistolShotSEDef"); PistolShotSETexture = new List<Texture2D>(); PistolShotSETexture.Add(game.Content.Load<Texture2D>(@"InGame/Jade/girl_anim_shot_SE")); PistolShotSEOrigin = new List<Vector2>(); PistolShotSEOrigin.Add(new Vector2(PistolShotSETexture[0].Width / 2, PistolShotSETexture[0].Height / 2)); frameSize.X = int.Parse(definition.Attribute(FRAME_WIDTH).Value, NumberStyles.Integer); frameSize.Y = int.Parse(definition.Attribute(FRAME_HEIGHT).Value, NumberStyles.Integer); sheetSize.X = int.Parse(definition.Attribute(SHEET_COLUMNS).Value, NumberStyles.Integer); sheetSize.Y = int.Parse(definition.Attribute(SHEET_ROWS).Value, NumberStyles.Integer); frameInterval = TimeSpan.FromSeconds(1.0f / int.Parse(definition.Attribute(SPEED).Value, NumberStyles.Integer)); PistolShotSEAnimation = new List<Animation>(); PistolShotSEAnimation.Add(new Animation(PistolShotSETexture[0], frameSize, sheetSize, frameInterval)); } private void JadePistolShotSouthAnimationLoad(XDocument doc) { TimeSpan frameInterval; Point sheetSize = new Point(); Point frameSize = new Point(); var definition = doc.Root.Element("JadePistolShotSouthDef"); PistolShotSouthTexture = new List<Texture2D>(); PistolShotSouthTexture.Add(game.Content.Load<Texture2D>(@"InGame/Jade/girl_anim_shot_S")); PistolShotSouthOrigin = new List<Vector2>(); PistolShotSouthOrigin.Add(new Vector2(PistolShotSouthTexture[0].Width / 2, PistolShotSouthTexture[0].Height / 2)); frameSize.X = int.Parse(definition.Attribute(FRAME_WIDTH).Value, NumberStyles.Integer); frameSize.Y = int.Parse(definition.Attribute(FRAME_HEIGHT).Value, NumberStyles.Integer); sheetSize.X = int.Parse(definition.Attribute(SHEET_COLUMNS).Value, NumberStyles.Integer); sheetSize.Y = int.Parse(definition.Attribute(SHEET_ROWS).Value, NumberStyles.Integer); frameInterval = TimeSpan.FromSeconds(1.0f / int.Parse(definition.Attribute(SPEED).Value, NumberStyles.Integer)); PistolShotSouthAnimation = new List<Animation>(); PistolShotSouthAnimation.Add(new Animation(PistolShotSouthTexture[0], frameSize, sheetSize, frameInterval)); } private void JadePistolShotNorthAnimationLoad(XDocument doc) { TimeSpan frameInterval; Point sheetSize = new Point(); Point frameSize = new Point(); var definition = doc.Root.Element("JadePistolShotNorthDef"); PistolShotNorthTexture = new List<Texture2D>(); PistolShotNorthTexture.Add(game.Content.Load<Texture2D>(@"InGame/Jade/girl_anim_shot_N")); PistolShotNorthOrigin = new List<Vector2>(); PistolShotNorthOrigin.Add(new Vector2(PistolShotNorthTexture[0].Width / 2, PistolShotNorthTexture[0].Height / 2)); frameSize.X = int.Parse(definition.Attribute(FRAME_WIDTH).Value, NumberStyles.Integer); frameSize.Y = int.Parse(definition.Attribute(FRAME_HEIGHT).Value, NumberStyles.Integer); sheetSize.X = int.Parse(definition.Attribute(SHEET_COLUMNS).Value, NumberStyles.Integer); sheetSize.Y = int.Parse(definition.Attribute(SHEET_ROWS).Value, NumberStyles.Integer); frameInterval = TimeSpan.FromSeconds(1.0f / int.Parse(definition.Attribute(SPEED).Value, NumberStyles.Integer)); PistolShotNorthAnimation = new List<Animation>(); PistolShotNorthAnimation.Add(new Animation(PistolShotNorthTexture[0], frameSize, sheetSize, frameInterval)); } private void JadeShotgunShotEastAnimationLoad(XDocument doc) { TimeSpan frameInterval; Point sheetSize = new Point(); Point frameSize = new Point(); var definition = doc.Root.Element("JadeShotgunShotDef"); ShotgunEastTexture = new List<Texture2D>(); ShotgunEastTexture.Add(game.Content.Load<Texture2D>(@"InGame/Jade/girl_anim_shotgun")); ShotgunShotEastOrigin = new List<Vector2>(); ShotgunShotEastOrigin.Add(new Vector2(ShotgunEastTexture[0].Width / 2, PistolShotEastTexture[0].Height / 2)); frameSize.X = int.Parse(definition.Attribute(FRAME_WIDTH).Value, NumberStyles.Integer); frameSize.Y = int.Parse(definition.Attribute(FRAME_HEIGHT).Value, NumberStyles.Integer); sheetSize.X = int.Parse(definition.Attribute(SHEET_COLUMNS).Value, NumberStyles.Integer); sheetSize.Y = int.Parse(definition.Attribute(SHEET_ROWS).Value, NumberStyles.Integer); frameInterval = TimeSpan.FromSeconds(1.0f / int.Parse(definition.Attribute(SPEED).Value, NumberStyles.Integer)); MachinegunEastAnimation = new List<Animation>(); MachinegunEastAnimation.Add(new Animation(ShotgunEastTexture[0], frameSize, sheetSize, frameInterval)); ShotgunShotEastAnimation = new List<Animation>(); ShotgunShotEastAnimation.Add(new Animation(ShotgunEastTexture[0], frameSize, sheetSize, TimeSpan.FromSeconds(0.4f))); } private void JadeShotgunShotNorthEastAnimationLoad(XDocument doc) { TimeSpan frameInterval; Point sheetSize = new Point(); Point frameSize = new Point(); var definition = doc.Root.Element("JadeShotgunShotNEDef"); ShotgunNETexture = new List<Texture2D>(); ShotgunNETexture.Add(game.Content.Load<Texture2D>(@"InGame/Jade/girl_anim_shotgun_NE")); ShotgunNEOrigin = new List<Vector2>(); ShotgunNEOrigin.Add(new Vector2(ShotgunNETexture[0].Width / 2, ShotgunNETexture[0].Height / 2)); frameSize.X = int.Parse(definition.Attribute(FRAME_WIDTH).Value, NumberStyles.Integer); frameSize.Y = int.Parse(definition.Attribute(FRAME_HEIGHT).Value, NumberStyles.Integer); sheetSize.X = int.Parse(definition.Attribute(SHEET_COLUMNS).Value, NumberStyles.Integer); sheetSize.Y = int.Parse(definition.Attribute(SHEET_ROWS).Value, NumberStyles.Integer); frameInterval = TimeSpan.FromSeconds(1.0f / int.Parse(definition.Attribute(SPEED).Value, NumberStyles.Integer)); MachinegunNEAnimation = new List<Animation>(); MachinegunNEAnimation.Add(new Animation(ShotgunNETexture[0], frameSize, sheetSize, frameInterval)); ShotgunNEAnimation = new List<Animation>(); ShotgunNEAnimation.Add(new Animation(ShotgunNETexture[0], frameSize, sheetSize, TimeSpan.FromSeconds(0.4f))); } private void JadeShotgunShotSouthEastAnimationLoad(XDocument doc) { TimeSpan frameInterval; Point sheetSize = new Point(); Point frameSize = new Point(); var definition = doc.Root.Element("JadeShotgunShotSEDef"); ShotgunSETexture = new List<Texture2D>(); ShotgunSETexture.Add(game.Content.Load<Texture2D>(@"InGame/Jade/girl_anim_shotgun_SE")); ShotgunSEOrigin = new List<Vector2>(); ShotgunSEOrigin.Add(new Vector2(ShotgunSETexture[0].Width / 2, ShotgunSETexture[0].Height / 2)); frameSize.X = int.Parse(definition.Attribute(FRAME_WIDTH).Value, NumberStyles.Integer); frameSize.Y = int.Parse(definition.Attribute(FRAME_HEIGHT).Value, NumberStyles.Integer); sheetSize.X = int.Parse(definition.Attribute(SHEET_COLUMNS).Value, NumberStyles.Integer); sheetSize.Y = int.Parse(definition.Attribute(SHEET_ROWS).Value, NumberStyles.Integer); frameInterval = TimeSpan.FromSeconds(1.0f / int.Parse(definition.Attribute(SPEED).Value, NumberStyles.Integer)); MachinegunSEAnimation = new List<Animation>(); MachinegunSEAnimation.Add(new Animation(ShotgunSETexture[0], frameSize, sheetSize, frameInterval)); ShotgunSEAnimation = new List<Animation>(); ShotgunSEAnimation.Add(new Animation(ShotgunSETexture[0], frameSize, sheetSize, TimeSpan.FromSeconds(0.4f))); } private void JadeShotgunShotSouthAnimationLoad(XDocument doc) { TimeSpan frameInterval; Point sheetSize = new Point(); Point frameSize = new Point(); var definition = doc.Root.Element("JadeShotgunShotSouthDef"); ShotgunSouthTexture = new List<Texture2D>(); ShotgunSouthTexture.Add(game.Content.Load<Texture2D>(@"InGame/Jade/girl_anim_shotgun_S")); ShotgunSouthOrigin = new List<Vector2>(); ShotgunSouthOrigin.Add(new Vector2(ShotgunSouthTexture[0].Width / 2, ShotgunSouthTexture[0].Height / 2)); frameSize.X = int.Parse(definition.Attribute(FRAME_WIDTH).Value, NumberStyles.Integer); frameSize.Y = int.Parse(definition.Attribute(FRAME_HEIGHT).Value, NumberStyles.Integer); sheetSize.X = int.Parse(definition.Attribute(SHEET_COLUMNS).Value, NumberStyles.Integer); sheetSize.Y = int.Parse(definition.Attribute(SHEET_ROWS).Value, NumberStyles.Integer); frameInterval = TimeSpan.FromSeconds(1.0f / int.Parse(definition.Attribute(SPEED).Value, NumberStyles.Integer)); MachinegunSouthAnimation = new List<Animation>(); MachinegunSouthAnimation.Add(new Animation(ShotgunSouthTexture[0], frameSize, sheetSize, frameInterval)); ShotgunSouthAnimation = new List<Animation>(); ShotgunSouthAnimation.Add(new Animation(ShotgunSouthTexture[0], frameSize, sheetSize, TimeSpan.FromSeconds(0.4f))); } private void JadeShotgunShotNorthAnimationLoad(XDocument doc) { TimeSpan frameInterval; Point sheetSize = new Point(); Point frameSize = new Point(); var definition = doc.Root.Element("JadeShotgunShotNorthDef"); ShotgunNorthTexture = new List<Texture2D>(); ShotgunNorthTexture.Add(game.Content.Load<Texture2D>(@"InGame/Jade/girl_anim_shotgun_N")); ShotgunNorthOrigin = new List<Vector2>(); ShotgunNorthOrigin.Add(new Vector2(ShotgunNorthTexture[0].Width / 2, ShotgunNorthTexture[0].Height / 2)); frameSize.X = int.Parse(definition.Attribute(FRAME_WIDTH).Value, NumberStyles.Integer); frameSize.Y = int.Parse(definition.Attribute(FRAME_HEIGHT).Value, NumberStyles.Integer); sheetSize.X = int.Parse(definition.Attribute(SHEET_COLUMNS).Value, NumberStyles.Integer); sheetSize.Y = int.Parse(definition.Attribute(SHEET_ROWS).Value, NumberStyles.Integer); frameInterval = TimeSpan.FromSeconds(1.0f / int.Parse(definition.Attribute(SPEED).Value, NumberStyles.Integer)); MachinegunNorthAnimation = new List<Animation>(); MachinegunNorthAnimation.Add(new Animation(ShotgunNorthTexture[0], frameSize, sheetSize, frameInterval)); ShotgunNorthAnimation = new List<Animation>(); ShotgunNorthAnimation.Add(new Animation(ShotgunNorthTexture[0], frameSize, sheetSize, TimeSpan.FromSeconds(0.4f))); } private void EgonIdleTrunkAnimationLoad(XDocument doc) { TimeSpan frameInterval; Point sheetSize = new Point(); Point frameSize = new Point(); var definition = doc.Root.Element("EgonIdleTrunkDef"); IdleLegsTexture.Add(game.Content.Load<Texture2D>(@"InGame/Egon/egon_legs_idle")); IdleTrunkTexture.Add(game.Content.Load<Texture2D>(@"InGame/Egon/egon_idle")); IdleTrunkOrigin.Add(new Vector2(IdleTrunkTexture[1].Width / 2, IdleTrunkTexture[1].Height / 2)); frameSize.X = int.Parse(definition.Attribute(FRAME_WIDTH).Value, NumberStyles.Integer); frameSize.Y = int.Parse(definition.Attribute(FRAME_HEIGHT).Value, NumberStyles.Integer); sheetSize.X = int.Parse(definition.Attribute(SHEET_COLUMNS).Value, NumberStyles.Integer); sheetSize.Y = int.Parse(definition.Attribute(SHEET_ROWS).Value, NumberStyles.Integer); frameInterval = TimeSpan.FromSeconds(1.0f / int.Parse(definition.Attribute(SPEED).Value, NumberStyles.Integer)); IdleTrunkAnimation.Add(new Animation(IdleTrunkTexture[1], frameSize, sheetSize, frameInterval)); } private void EgonRunEastAnimationLoad(XDocument doc) { TimeSpan frameInterval; Point sheetSize = new Point(); Point frameSize = new Point(); var definition = doc.Root.Element("EgonRunEDef"); RunEastTexture.Add(game.Content.Load<Texture2D>(@"InGame/Egon/egon_run_E")); RunEastOrigin.Add(new Vector2(RunEastTexture[1].Width / 2, RunEastTexture[1].Height / 2)); frameSize.X = int.Parse(definition.Attribute(FRAME_WIDTH).Value, NumberStyles.Integer); frameSize.Y = int.Parse(definition.Attribute(FRAME_HEIGHT).Value, NumberStyles.Integer); sheetSize.X = int.Parse(definition.Attribute(SHEET_COLUMNS).Value, NumberStyles.Integer); sheetSize.Y = int.Parse(definition.Attribute(SHEET_ROWS).Value, NumberStyles.Integer); frameInterval = TimeSpan.FromSeconds(1.0f / int.Parse(definition.Attribute(SPEED).Value, NumberStyles.Integer)); RunEastAnimation.Add(new Animation(RunEastTexture[1], frameSize, sheetSize, frameInterval)); } private void EgonPistolShotEastAnimationLoad(XDocument doc) { TimeSpan frameInterval; Point sheetSize = new Point(); Point frameSize = new Point(); var definition = doc.Root.Element("EgonPistolEDef"); PistolShotEastTexture.Add(game.Content.Load<Texture2D>(@"InGame/Egon/egon_pistol_E")); PistolShotEastOrigin.Add(new Vector2(PistolShotEastTexture[1].Width / 2, PistolShotEastTexture[1].Height / 2)); frameSize.X = int.Parse(definition.Attribute(FRAME_WIDTH).Value, NumberStyles.Integer); frameSize.Y = int.Parse(definition.Attribute(FRAME_HEIGHT).Value, NumberStyles.Integer); sheetSize.X = int.Parse(definition.Attribute(SHEET_COLUMNS).Value, NumberStyles.Integer); sheetSize.Y = int.Parse(definition.Attribute(SHEET_ROWS).Value, NumberStyles.Integer); frameInterval = TimeSpan.FromSeconds(1.0f / int.Parse(definition.Attribute(SPEED).Value, NumberStyles.Integer)); PistolShotEastAnimation.Add(new Animation(PistolShotEastTexture[1], frameSize, sheetSize, frameInterval)); } private void EgonPistolShotNorthEastAnimationLoad(XDocument doc) { TimeSpan frameInterval; Point sheetSize = new Point(); Point frameSize = new Point(); var definition = doc.Root.Element("EgonPistolNEDef"); PistolShotNETexture.Add(game.Content.Load<Texture2D>(@"InGame/Egon/egon_pistol_NE")); PistolShotNEOrigin.Add(new Vector2(PistolShotNETexture[1].Width / 2, PistolShotNETexture[1].Height / 2)); frameSize.X = int.Parse(definition.Attribute(FRAME_WIDTH).Value, NumberStyles.Integer); frameSize.Y = int.Parse(definition.Attribute(FRAME_HEIGHT).Value, NumberStyles.Integer); sheetSize.X = int.Parse(definition.Attribute(SHEET_COLUMNS).Value, NumberStyles.Integer); sheetSize.Y = int.Parse(definition.Attribute(SHEET_ROWS).Value, NumberStyles.Integer); frameInterval = TimeSpan.FromSeconds(1.0f / int.Parse(definition.Attribute(SPEED).Value, NumberStyles.Integer)); PistolShotNEAnimation.Add(new Animation(PistolShotNETexture[1], frameSize, sheetSize, frameInterval)); } private void EgonPistolShotSouthEastAnimationLoad(XDocument doc) { TimeSpan frameInterval; Point sheetSize = new Point(); Point frameSize = new Point(); var definition = doc.Root.Element("EgonPistolSEDef"); PistolShotSETexture.Add(game.Content.Load<Texture2D>(@"InGame/Egon/egon_pistol_SE")); PistolShotSEOrigin.Add(new Vector2(PistolShotSETexture[1].Width / 2, PistolShotSETexture[1].Height / 2)); frameSize.X = int.Parse(definition.Attribute(FRAME_WIDTH).Value, NumberStyles.Integer); frameSize.Y = int.Parse(definition.Attribute(FRAME_HEIGHT).Value, NumberStyles.Integer); sheetSize.X = int.Parse(definition.Attribute(SHEET_COLUMNS).Value, NumberStyles.Integer); sheetSize.Y = int.Parse(definition.Attribute(SHEET_ROWS).Value, NumberStyles.Integer); frameInterval = TimeSpan.FromSeconds(1.0f / int.Parse(definition.Attribute(SPEED).Value, NumberStyles.Integer)); PistolShotSEAnimation.Add(new Animation(PistolShotSETexture[1], frameSize, sheetSize, frameInterval)); } private void EgonPistolShotSouthAnimationLoad(XDocument doc) { TimeSpan frameInterval; Point sheetSize = new Point(); Point frameSize = new Point(); var definition = doc.Root.Element("EgonPistolSouthDef"); PistolShotSouthTexture.Add(game.Content.Load<Texture2D>(@"InGame/Egon/egon_pistol_S")); PistolShotSouthOrigin.Add(new Vector2(PistolShotSouthTexture[1].Width / 2, PistolShotSouthTexture[1].Height / 2)); frameSize.X = int.Parse(definition.Attribute(FRAME_WIDTH).Value, NumberStyles.Integer); frameSize.Y = int.Parse(definition.Attribute(FRAME_HEIGHT).Value, NumberStyles.Integer); sheetSize.X = int.Parse(definition.Attribute(SHEET_COLUMNS).Value, NumberStyles.Integer); sheetSize.Y = int.Parse(definition.Attribute(SHEET_ROWS).Value, NumberStyles.Integer); frameInterval = TimeSpan.FromSeconds(1.0f / int.Parse(definition.Attribute(SPEED).Value, NumberStyles.Integer)); PistolShotSouthAnimation.Add(new Animation(PistolShotSouthTexture[1], frameSize, sheetSize, frameInterval)); } private void EgonPistolShotNorthAnimationLoad(XDocument doc) { TimeSpan frameInterval; Point sheetSize = new Point(); Point frameSize = new Point(); var definition = doc.Root.Element("EgonPistolNorthDef"); PistolShotNorthTexture.Add(game.Content.Load<Texture2D>(@"InGame/Egon/egon_pistol_N")); PistolShotNorthOrigin.Add(new Vector2(PistolShotNorthTexture[1].Width / 2, PistolShotNorthTexture[1].Height / 2)); frameSize.X = int.Parse(definition.Attribute(FRAME_WIDTH).Value, NumberStyles.Integer); frameSize.Y = int.Parse(definition.Attribute(FRAME_HEIGHT).Value, NumberStyles.Integer); sheetSize.X = int.Parse(definition.Attribute(SHEET_COLUMNS).Value, NumberStyles.Integer); sheetSize.Y = int.Parse(definition.Attribute(SHEET_ROWS).Value, NumberStyles.Integer); frameInterval = TimeSpan.FromSeconds(1.0f / int.Parse(definition.Attribute(SPEED).Value, NumberStyles.Integer)); PistolShotNorthAnimation.Add(new Animation(PistolShotNorthTexture[1], frameSize, sheetSize, frameInterval)); } private void EgonShotgunShotEastAnimationLoad(XDocument doc) { TimeSpan frameInterval; Point sheetSize = new Point(); Point frameSize = new Point(); var definition = doc.Root.Element("EgonShotgunEDef"); ShotgunEastTexture.Add(game.Content.Load<Texture2D>(@"InGame/Egon/egon_shotgun_E")); ShotgunShotEastOrigin.Add(new Vector2(ShotgunEastTexture[1].Width / 2, PistolShotEastTexture[1].Height / 2)); frameSize.X = int.Parse(definition.Attribute(FRAME_WIDTH).Value, NumberStyles.Integer); frameSize.Y = int.Parse(definition.Attribute(FRAME_HEIGHT).Value, NumberStyles.Integer); sheetSize.X = int.Parse(definition.Attribute(SHEET_COLUMNS).Value, NumberStyles.Integer); sheetSize.Y = int.Parse(definition.Attribute(SHEET_ROWS).Value, NumberStyles.Integer); frameInterval = TimeSpan.FromSeconds(1.0f / int.Parse(definition.Attribute(SPEED).Value, NumberStyles.Integer)); MachinegunEastAnimation.Add(new Animation(ShotgunEastTexture[1], frameSize, sheetSize, frameInterval)); ShotgunShotEastAnimation.Add(new Animation(ShotgunEastTexture[1], frameSize, sheetSize, TimeSpan.FromSeconds(0.4f))); } private void EgonShotgunShotNorthEastAnimationLoad(XDocument doc) { TimeSpan frameInterval; Point sheetSize = new Point(); Point frameSize = new Point(); var definition = doc.Root.Element("EgonShotgunNEDef"); ShotgunNETexture.Add(game.Content.Load<Texture2D>(@"InGame/Egon/egon_shotgun_NE")); ShotgunNEOrigin.Add(new Vector2(ShotgunNETexture[1].Width / 2, ShotgunNETexture[1].Height / 2)); frameSize.X = int.Parse(definition.Attribute(FRAME_WIDTH).Value, NumberStyles.Integer); frameSize.Y = int.Parse(definition.Attribute(FRAME_HEIGHT).Value, NumberStyles.Integer); sheetSize.X = int.Parse(definition.Attribute(SHEET_COLUMNS).Value, NumberStyles.Integer); sheetSize.Y = int.Parse(definition.Attribute(SHEET_ROWS).Value, NumberStyles.Integer); frameInterval = TimeSpan.FromSeconds(1.0f / int.Parse(definition.Attribute(SPEED).Value, NumberStyles.Integer)); MachinegunNEAnimation.Add(new Animation(ShotgunNETexture[1], frameSize, sheetSize, frameInterval)); ShotgunNEAnimation.Add(new Animation(ShotgunNETexture[1], frameSize, sheetSize, TimeSpan.FromSeconds(0.4f))); } private void EgonShotgunShotSouthEastAnimationLoad(XDocument doc) { TimeSpan frameInterval; Point sheetSize = new Point(); Point frameSize = new Point(); var definition = doc.Root.Element("EgonShotgunSEDef"); ShotgunSETexture.Add(game.Content.Load<Texture2D>(@"InGame/Egon/egon_shotgun_SE")); ShotgunSEOrigin.Add(new Vector2(ShotgunSETexture[1].Width / 2, ShotgunSETexture[1].Height / 2)); frameSize.X = int.Parse(definition.Attribute(FRAME_WIDTH).Value, NumberStyles.Integer); frameSize.Y = int.Parse(definition.Attribute(FRAME_HEIGHT).Value, NumberStyles.Integer); sheetSize.X = int.Parse(definition.Attribute(SHEET_COLUMNS).Value, NumberStyles.Integer); sheetSize.Y = int.Parse(definition.Attribute(SHEET_ROWS).Value, NumberStyles.Integer); frameInterval = TimeSpan.FromSeconds(1.0f / int.Parse(definition.Attribute(SPEED).Value, NumberStyles.Integer)); MachinegunSEAnimation.Add(new Animation(ShotgunSETexture[1], frameSize, sheetSize, frameInterval)); ShotgunSEAnimation.Add(new Animation(ShotgunSETexture[1], frameSize, sheetSize, TimeSpan.FromSeconds(0.4f))); } private void EgonShotgunShotSouthAnimationLoad(XDocument doc) { TimeSpan frameInterval; Point sheetSize = new Point(); Point frameSize = new Point(); var definition = doc.Root.Element("EgonShotgunSouthDef"); ShotgunSouthTexture.Add(game.Content.Load<Texture2D>(@"InGame/Egon/egon_shotgun_S")); ShotgunSouthOrigin.Add(new Vector2(ShotgunSouthTexture[1].Width / 2, ShotgunSouthTexture[1].Height / 2)); frameSize.X = int.Parse(definition.Attribute(FRAME_WIDTH).Value, NumberStyles.Integer); frameSize.Y = int.Parse(definition.Attribute(FRAME_HEIGHT).Value, NumberStyles.Integer); sheetSize.X = int.Parse(definition.Attribute(SHEET_COLUMNS).Value, NumberStyles.Integer); sheetSize.Y = int.Parse(definition.Attribute(SHEET_ROWS).Value, NumberStyles.Integer); frameInterval = TimeSpan.FromSeconds(1.0f / int.Parse(definition.Attribute(SPEED).Value, NumberStyles.Integer)); MachinegunSouthAnimation.Add(new Animation(ShotgunSouthTexture[1], frameSize, sheetSize, frameInterval)); ShotgunSouthAnimation.Add(new Animation(ShotgunSouthTexture[1], frameSize, sheetSize, TimeSpan.FromSeconds(0.4f))); } private void EgonShotgunShotNorthAnimationLoad(XDocument doc) { TimeSpan frameInterval; Point sheetSize = new Point(); Point frameSize = new Point(); var definition = doc.Root.Element("EgonShotgunNorthDef"); ShotgunNorthTexture.Add(game.Content.Load<Texture2D>(@"InGame/Egon/egon_shotgun_N")); ShotgunNorthOrigin.Add(new Vector2(ShotgunNorthTexture[1].Width / 2, ShotgunNorthTexture[1].Height / 2)); frameSize.X = int.Parse(definition.Attribute(FRAME_WIDTH).Value, NumberStyles.Integer); frameSize.Y = int.Parse(definition.Attribute(FRAME_HEIGHT).Value, NumberStyles.Integer); sheetSize.X = int.Parse(definition.Attribute(SHEET_COLUMNS).Value, NumberStyles.Integer); sheetSize.Y = int.Parse(definition.Attribute(SHEET_ROWS).Value, NumberStyles.Integer); frameInterval = TimeSpan.FromSeconds(1.0f / int.Parse(definition.Attribute(SPEED).Value, NumberStyles.Integer)); MachinegunNorthAnimation.Add(new Animation(ShotgunNorthTexture[1], frameSize, sheetSize, frameInterval)); ShotgunNorthAnimation.Add(new Animation(ShotgunNorthTexture[1], frameSize, sheetSize, TimeSpan.FromSeconds(0.4f))); } private void RayIdleTrunkAnimationLoad(XDocument doc) { TimeSpan frameInterval; Point sheetSize = new Point(); Point frameSize = new Point(); var definition = doc.Root.Element("RayIdleTrunkDef"); IdleLegsTexture.Add(game.Content.Load<Texture2D>(@"InGame/Ray/ray_legs_idle")); IdleTrunkTexture.Add(game.Content.Load<Texture2D>(@"InGame/Ray/ray_idle")); IdleTrunkOrigin.Add(new Vector2(IdleTrunkTexture[2].Width / 2, IdleTrunkTexture[2].Height / 2)); frameSize.X = int.Parse(definition.Attribute(FRAME_WIDTH).Value, NumberStyles.Integer); frameSize.Y = int.Parse(definition.Attribute(FRAME_HEIGHT).Value, NumberStyles.Integer); sheetSize.X = int.Parse(definition.Attribute(SHEET_COLUMNS).Value, NumberStyles.Integer); sheetSize.Y = int.Parse(definition.Attribute(SHEET_ROWS).Value, NumberStyles.Integer); frameInterval = TimeSpan.FromSeconds(1.0f / int.Parse(definition.Attribute(SPEED).Value, NumberStyles.Integer)); IdleTrunkAnimation.Add(new Animation(IdleTrunkTexture[2], frameSize, sheetSize, frameInterval)); } private void RayRunEastAnimationLoad(XDocument doc) { TimeSpan frameInterval; Point sheetSize = new Point(); Point frameSize = new Point(); var definition = doc.Root.Element("RayRunEDef"); RunEastTexture.Add(game.Content.Load<Texture2D>(@"InGame/Ray/ray_run_E")); RunEastOrigin.Add(new Vector2(RunEastTexture[2].Width / 2, RunEastTexture[2].Height / 2)); frameSize.X = int.Parse(definition.Attribute(FRAME_WIDTH).Value, NumberStyles.Integer); frameSize.Y = int.Parse(definition.Attribute(FRAME_HEIGHT).Value, NumberStyles.Integer); sheetSize.X = int.Parse(definition.Attribute(SHEET_COLUMNS).Value, NumberStyles.Integer); sheetSize.Y = int.Parse(definition.Attribute(SHEET_ROWS).Value, NumberStyles.Integer); frameInterval = TimeSpan.FromSeconds(1.0f / int.Parse(definition.Attribute(SPEED).Value, NumberStyles.Integer)); RunEastAnimation.Add(new Animation(RunEastTexture[2], frameSize, sheetSize, frameInterval)); } private void RayPistolShotEastAnimationLoad(XDocument doc) { TimeSpan frameInterval; Point sheetSize = new Point(); Point frameSize = new Point(); var definition = doc.Root.Element("RayPistolEDef"); PistolShotEastTexture.Add(game.Content.Load<Texture2D>(@"InGame/Ray/ray_pistol_E")); PistolShotEastOrigin.Add(new Vector2(PistolShotEastTexture[2].Width / 2, PistolShotEastTexture[2].Height / 2)); frameSize.X = int.Parse(definition.Attribute(FRAME_WIDTH).Value, NumberStyles.Integer); frameSize.Y = int.Parse(definition.Attribute(FRAME_HEIGHT).Value, NumberStyles.Integer); sheetSize.X = int.Parse(definition.Attribute(SHEET_COLUMNS).Value, NumberStyles.Integer); sheetSize.Y = int.Parse(definition.Attribute(SHEET_ROWS).Value, NumberStyles.Integer); frameInterval = TimeSpan.FromSeconds(1.0f / int.Parse(definition.Attribute(SPEED).Value, NumberStyles.Integer)); PistolShotEastAnimation.Add(new Animation(PistolShotEastTexture[2], frameSize, sheetSize, frameInterval)); } private void RayPistolShotNorthEastAnimationLoad(XDocument doc) { TimeSpan frameInterval; Point sheetSize = new Point(); Point frameSize = new Point(); var definition = doc.Root.Element("RayPistolNEDef"); PistolShotNETexture.Add(game.Content.Load<Texture2D>(@"InGame/Ray/ray_pistol_NE")); PistolShotNEOrigin.Add(new Vector2(PistolShotNETexture[2].Width / 2, PistolShotNETexture[2].Height / 2)); frameSize.X = int.Parse(definition.Attribute(FRAME_WIDTH).Value, NumberStyles.Integer); frameSize.Y = int.Parse(definition.Attribute(FRAME_HEIGHT).Value, NumberStyles.Integer); sheetSize.X = int.Parse(definition.Attribute(SHEET_COLUMNS).Value, NumberStyles.Integer); sheetSize.Y = int.Parse(definition.Attribute(SHEET_ROWS).Value, NumberStyles.Integer); frameInterval = TimeSpan.FromSeconds(1.0f / int.Parse(definition.Attribute(SPEED).Value, NumberStyles.Integer)); PistolShotNEAnimation.Add(new Animation(PistolShotNETexture[2], frameSize, sheetSize, frameInterval)); } private void RayPistolShotSouthEastAnimationLoad(XDocument doc) { TimeSpan frameInterval; Point sheetSize = new Point(); Point frameSize = new Point(); var definition = doc.Root.Element("RayPistolSEDef"); PistolShotSETexture.Add(game.Content.Load<Texture2D>(@"InGame/Ray/ray_pistol_SE")); PistolShotSEOrigin.Add(new Vector2(PistolShotSETexture[2].Width / 2, PistolShotSETexture[2].Height / 2)); frameSize.X = int.Parse(definition.Attribute(FRAME_WIDTH).Value, NumberStyles.Integer); frameSize.Y = int.Parse(definition.Attribute(FRAME_HEIGHT).Value, NumberStyles.Integer); sheetSize.X = int.Parse(definition.Attribute(SHEET_COLUMNS).Value, NumberStyles.Integer); sheetSize.Y = int.Parse(definition.Attribute(SHEET_ROWS).Value, NumberStyles.Integer); frameInterval = TimeSpan.FromSeconds(1.0f / int.Parse(definition.Attribute(SPEED).Value, NumberStyles.Integer)); PistolShotSEAnimation.Add(new Animation(PistolShotSETexture[2], frameSize, sheetSize, frameInterval)); } private void RayPistolShotSouthAnimationLoad(XDocument doc) { TimeSpan frameInterval; Point sheetSize = new Point(); Point frameSize = new Point(); var definition = doc.Root.Element("RayPistolSouthDef"); PistolShotSouthTexture.Add(game.Content.Load<Texture2D>(@"InGame/Ray/ray_pistol_S")); PistolShotSouthOrigin.Add(new Vector2(PistolShotSouthTexture[2].Width / 2, PistolShotSouthTexture[2].Height / 2)); frameSize.X = int.Parse(definition.Attribute(FRAME_WIDTH).Value, NumberStyles.Integer); frameSize.Y = int.Parse(definition.Attribute(FRAME_HEIGHT).Value, NumberStyles.Integer); sheetSize.X = int.Parse(definition.Attribute(SHEET_COLUMNS).Value, NumberStyles.Integer); sheetSize.Y = int.Parse(definition.Attribute(SHEET_ROWS).Value, NumberStyles.Integer); frameInterval = TimeSpan.FromSeconds(1.0f / int.Parse(definition.Attribute(SPEED).Value, NumberStyles.Integer)); PistolShotSouthAnimation.Add(new Animation(PistolShotSouthTexture[2], frameSize, sheetSize, frameInterval)); } private void RayPistolShotNorthAnimationLoad(XDocument doc) { TimeSpan frameInterval; Point sheetSize = new Point(); Point frameSize = new Point(); var definition = doc.Root.Element("RayPistolNorthDef"); PistolShotNorthTexture.Add(game.Content.Load<Texture2D>(@"InGame/Ray/ray_pistol_N")); PistolShotNorthOrigin.Add(new Vector2(PistolShotNorthTexture[2].Width / 2, PistolShotNorthTexture[2].Height / 2)); frameSize.X = int.Parse(definition.Attribute(FRAME_WIDTH).Value, NumberStyles.Integer); frameSize.Y = int.Parse(definition.Attribute(FRAME_HEIGHT).Value, NumberStyles.Integer); sheetSize.X = int.Parse(definition.Attribute(SHEET_COLUMNS).Value, NumberStyles.Integer); sheetSize.Y = int.Parse(definition.Attribute(SHEET_ROWS).Value, NumberStyles.Integer); frameInterval = TimeSpan.FromSeconds(1.0f / int.Parse(definition.Attribute(SPEED).Value, NumberStyles.Integer)); PistolShotNorthAnimation.Add(new Animation(PistolShotNorthTexture[2], frameSize, sheetSize, frameInterval)); } private void RayShotgunShotEastAnimationLoad(XDocument doc) { TimeSpan frameInterval; Point sheetSize = new Point(); Point frameSize = new Point(); var definition = doc.Root.Element("RayShotgunEDef"); ShotgunEastTexture.Add(game.Content.Load<Texture2D>(@"InGame/Ray/ray_shotgun_E")); ShotgunShotEastOrigin.Add(new Vector2(ShotgunEastTexture[2].Width / 2, PistolShotEastTexture[2].Height / 2)); frameSize.X = int.Parse(definition.Attribute(FRAME_WIDTH).Value, NumberStyles.Integer); frameSize.Y = int.Parse(definition.Attribute(FRAME_HEIGHT).Value, NumberStyles.Integer); sheetSize.X = int.Parse(definition.Attribute(SHEET_COLUMNS).Value, NumberStyles.Integer); sheetSize.Y = int.Parse(definition.Attribute(SHEET_ROWS).Value, NumberStyles.Integer); frameInterval = TimeSpan.FromSeconds(1.0f / int.Parse(definition.Attribute(SPEED).Value, NumberStyles.Integer)); MachinegunEastAnimation.Add(new Animation(ShotgunEastTexture[2], frameSize, sheetSize, frameInterval)); ShotgunShotEastAnimation.Add(new Animation(ShotgunEastTexture[2], frameSize, sheetSize, TimeSpan.FromSeconds(0.4f))); } private void RayShotgunShotNorthEastAnimationLoad(XDocument doc) { TimeSpan frameInterval; Point sheetSize = new Point(); Point frameSize = new Point(); var definition = doc.Root.Element("RayShotgunNEDef"); ShotgunNETexture.Add(game.Content.Load<Texture2D>(@"InGame/Ray/ray_shotgun_NE")); ShotgunNEOrigin.Add(new Vector2(ShotgunNETexture[2].Width / 2, ShotgunNETexture[2].Height / 2)); frameSize.X = int.Parse(definition.Attribute(FRAME_WIDTH).Value, NumberStyles.Integer); frameSize.Y = int.Parse(definition.Attribute(FRAME_HEIGHT).Value, NumberStyles.Integer); sheetSize.X = int.Parse(definition.Attribute(SHEET_COLUMNS).Value, NumberStyles.Integer); sheetSize.Y = int.Parse(definition.Attribute(SHEET_ROWS).Value, NumberStyles.Integer); frameInterval = TimeSpan.FromSeconds(1.0f / int.Parse(definition.Attribute(SPEED).Value, NumberStyles.Integer)); MachinegunNEAnimation.Add(new Animation(ShotgunNETexture[2], frameSize, sheetSize, frameInterval)); ShotgunNEAnimation.Add(new Animation(ShotgunNETexture[2], frameSize, sheetSize, TimeSpan.FromSeconds(0.4f))); } private void RayShotgunShotSouthEastAnimationLoad(XDocument doc) { TimeSpan frameInterval; Point sheetSize = new Point(); Point frameSize = new Point(); var definition = doc.Root.Element("RayShotgunSEDef"); ShotgunSETexture.Add(game.Content.Load<Texture2D>(@"InGame/Ray/ray_shotgun_SE")); ShotgunSEOrigin.Add(new Vector2(ShotgunSETexture[2].Width / 2, ShotgunSETexture[2].Height / 2)); frameSize.X = int.Parse(definition.Attribute(FRAME_WIDTH).Value, NumberStyles.Integer); frameSize.Y = int.Parse(definition.Attribute(FRAME_HEIGHT).Value, NumberStyles.Integer); sheetSize.X = int.Parse(definition.Attribute(SHEET_COLUMNS).Value, NumberStyles.Integer); sheetSize.Y = int.Parse(definition.Attribute(SHEET_ROWS).Value, NumberStyles.Integer); frameInterval = TimeSpan.FromSeconds(1.0f / int.Parse(definition.Attribute(SPEED).Value, NumberStyles.Integer)); MachinegunSEAnimation.Add(new Animation(ShotgunSETexture[2], frameSize, sheetSize, frameInterval)); ShotgunSEAnimation.Add(new Animation(ShotgunSETexture[2], frameSize, sheetSize, TimeSpan.FromSeconds(0.4f))); } private void RayShotgunShotSouthAnimationLoad(XDocument doc) { TimeSpan frameInterval; Point sheetSize = new Point(); Point frameSize = new Point(); var definition = doc.Root.Element("RayShotgunSouthDef"); ShotgunSouthTexture.Add(game.Content.Load<Texture2D>(@"InGame/Ray/ray_shotgun_S")); ShotgunSouthOrigin.Add(new Vector2(ShotgunSouthTexture[2].Width / 2, ShotgunSouthTexture[2].Height / 2)); frameSize.X = int.Parse(definition.Attribute(FRAME_WIDTH).Value, NumberStyles.Integer); frameSize.Y = int.Parse(definition.Attribute(FRAME_HEIGHT).Value, NumberStyles.Integer); sheetSize.X = int.Parse(definition.Attribute(SHEET_COLUMNS).Value, NumberStyles.Integer); sheetSize.Y = int.Parse(definition.Attribute(SHEET_ROWS).Value, NumberStyles.Integer); frameInterval = TimeSpan.FromSeconds(1.0f / int.Parse(definition.Attribute(SPEED).Value, NumberStyles.Integer)); MachinegunSouthAnimation.Add(new Animation(ShotgunSouthTexture[2], frameSize, sheetSize, frameInterval)); ShotgunSouthAnimation.Add(new Animation(ShotgunSouthTexture[2], frameSize, sheetSize, TimeSpan.FromSeconds(0.4f))); } private void RayShotgunShotNorthAnimationLoad(XDocument doc) { TimeSpan frameInterval; Point sheetSize = new Point(); Point frameSize = new Point(); var definition = doc.Root.Element("RayShotgunNorthDef"); ShotgunNorthTexture.Add(game.Content.Load<Texture2D>(@"InGame/Ray/ray_shotgun_N")); ShotgunNorthOrigin.Add(new Vector2(ShotgunNorthTexture[2].Width / 2, ShotgunNorthTexture[2].Height / 2)); frameSize.X = int.Parse(definition.Attribute(FRAME_WIDTH).Value, NumberStyles.Integer); frameSize.Y = int.Parse(definition.Attribute(FRAME_HEIGHT).Value, NumberStyles.Integer); sheetSize.X = int.Parse(definition.Attribute(SHEET_COLUMNS).Value, NumberStyles.Integer); sheetSize.Y = int.Parse(definition.Attribute(SHEET_ROWS).Value, NumberStyles.Integer); frameInterval = TimeSpan.FromSeconds(1.0f / int.Parse(definition.Attribute(SPEED).Value, NumberStyles.Integer)); MachinegunNorthAnimation.Add(new Animation(ShotgunNorthTexture[2], frameSize, sheetSize, frameInterval)); ShotgunNorthAnimation.Add(new Animation(ShotgunNorthTexture[2], frameSize, sheetSize, TimeSpan.FromSeconds(0.4f))); } private void PeterIdleTrunkAnimationLoad(XDocument doc) { TimeSpan frameInterval; Point sheetSize = new Point(); Point frameSize = new Point(); var definition = doc.Root.Element("PeterIdleTrunkDef"); IdleLegsTexture.Add(game.Content.Load<Texture2D>(@"InGame/Peter/peter_legs_idle")); IdleTrunkTexture.Add(game.Content.Load<Texture2D>(@"InGame/Peter/peter_idle")); IdleTrunkOrigin.Add(new Vector2(IdleTrunkTexture[3].Width / 2, IdleTrunkTexture[3].Height / 2)); frameSize.X = int.Parse(definition.Attribute(FRAME_WIDTH).Value, NumberStyles.Integer); frameSize.Y = int.Parse(definition.Attribute(FRAME_HEIGHT).Value, NumberStyles.Integer); sheetSize.X = int.Parse(definition.Attribute(SHEET_COLUMNS).Value, NumberStyles.Integer); sheetSize.Y = int.Parse(definition.Attribute(SHEET_ROWS).Value, NumberStyles.Integer); frameInterval = TimeSpan.FromSeconds(1.0f / int.Parse(definition.Attribute(SPEED).Value, NumberStyles.Integer)); IdleTrunkAnimation.Add(new Animation(IdleTrunkTexture[3], frameSize, sheetSize, frameInterval)); // Define a new Animation instance } private void PeterRunEastAnimationLoad(XDocument doc) { TimeSpan frameInterval; Point sheetSize = new Point(); Point frameSize = new Point(); var definition = doc.Root.Element("PeterRunEDef"); RunEastTexture.Add(game.Content.Load<Texture2D>(@"InGame/Peter/peter_run_E")); RunEastOrigin.Add(new Vector2(RunEastTexture[3].Width / 2, RunEastTexture[3].Height / 2)); frameSize.X = int.Parse(definition.Attribute(FRAME_WIDTH).Value, NumberStyles.Integer); frameSize.Y = int.Parse(definition.Attribute(FRAME_HEIGHT).Value, NumberStyles.Integer); sheetSize.X = int.Parse(definition.Attribute(SHEET_COLUMNS).Value, NumberStyles.Integer); sheetSize.Y = int.Parse(definition.Attribute(SHEET_ROWS).Value, NumberStyles.Integer); frameInterval = TimeSpan.FromSeconds(1.0f / int.Parse(definition.Attribute(SPEED).Value, NumberStyles.Integer)); RunEastAnimation.Add(new Animation(RunEastTexture[3], frameSize, sheetSize, frameInterval)); // Define a new Animation instance } private void PeterPistolShotEastAnimationLoad(XDocument doc) { TimeSpan frameInterval; Point sheetSize = new Point(); Point frameSize = new Point(); var definition = doc.Root.Element("PeterPistolEDef"); PistolShotEastTexture.Add(game.Content.Load<Texture2D>(@"InGame/Peter/peter_pistol_E")); PistolShotEastOrigin.Add(new Vector2(PistolShotEastTexture[3].Width / 2, PistolShotEastTexture[3].Height / 2)); frameSize.X = int.Parse(definition.Attribute(FRAME_WIDTH).Value, NumberStyles.Integer); frameSize.Y = int.Parse(definition.Attribute(FRAME_HEIGHT).Value, NumberStyles.Integer); sheetSize.X = int.Parse(definition.Attribute(SHEET_COLUMNS).Value, NumberStyles.Integer); sheetSize.Y = int.Parse(definition.Attribute(SHEET_ROWS).Value, NumberStyles.Integer); frameInterval = TimeSpan.FromSeconds(1.0f / int.Parse(definition.Attribute(SPEED).Value, NumberStyles.Integer)); PistolShotEastAnimation.Add(new Animation(PistolShotEastTexture[3], frameSize, sheetSize, frameInterval)); // Define a new Animation instance } private void PeterPistolShotNorthEastAnimationLoad(XDocument doc) { TimeSpan frameInterval; Point sheetSize = new Point(); Point frameSize = new Point(); var definition = doc.Root.Element("PeterPistolNEDef"); PistolShotNETexture.Add(game.Content.Load<Texture2D>(@"InGame/Peter/peter_pistol_NE")); PistolShotNEOrigin.Add(new Vector2(PistolShotNETexture[3].Width / 2, PistolShotNETexture[3].Height / 2)); frameSize.X = int.Parse(definition.Attribute(FRAME_WIDTH).Value, NumberStyles.Integer); frameSize.Y = int.Parse(definition.Attribute(FRAME_HEIGHT).Value, NumberStyles.Integer); sheetSize.X = int.Parse(definition.Attribute(SHEET_COLUMNS).Value, NumberStyles.Integer); sheetSize.Y = int.Parse(definition.Attribute(SHEET_ROWS).Value, NumberStyles.Integer); frameInterval = TimeSpan.FromSeconds(1.0f / int.Parse(definition.Attribute(SPEED).Value, NumberStyles.Integer)); PistolShotNEAnimation.Add(new Animation(PistolShotNETexture[3], frameSize, sheetSize, frameInterval)); // Define a new Animation instance } private void PeterPistolShotSouthEastAnimationLoad(XDocument doc) { TimeSpan frameInterval; Point sheetSize = new Point(); Point frameSize = new Point(); var definition = doc.Root.Element("PeterPistolSEDef"); PistolShotSETexture.Add(game.Content.Load<Texture2D>(@"InGame/Peter/peter_pistol_SE")); PistolShotSEOrigin.Add(new Vector2(PistolShotSETexture[3].Width / 2, PistolShotSETexture[3].Height / 2)); frameSize.X = int.Parse(definition.Attribute(FRAME_WIDTH).Value, NumberStyles.Integer); frameSize.Y = int.Parse(definition.Attribute(FRAME_HEIGHT).Value, NumberStyles.Integer); sheetSize.X = int.Parse(definition.Attribute(SHEET_COLUMNS).Value, NumberStyles.Integer); sheetSize.Y = int.Parse(definition.Attribute(SHEET_ROWS).Value, NumberStyles.Integer); frameInterval = TimeSpan.FromSeconds(1.0f / int.Parse(definition.Attribute(SPEED).Value, NumberStyles.Integer)); PistolShotSEAnimation.Add(new Animation(PistolShotSETexture[3], frameSize, sheetSize, frameInterval)); // Define a new Animation instance } private void PeterPistolShotSouthAnimationLoad(XDocument doc) { TimeSpan frameInterval; Point sheetSize = new Point(); Point frameSize = new Point(); var definition = doc.Root.Element("PeterPistolSouthDef"); PistolShotSouthTexture.Add(game.Content.Load<Texture2D>(@"InGame/Peter/peter_pistol_S")); PistolShotSouthOrigin.Add(new Vector2(PistolShotSouthTexture[3].Width / 2, PistolShotSouthTexture[3].Height / 2)); frameSize.X = int.Parse(definition.Attribute(FRAME_WIDTH).Value, NumberStyles.Integer); frameSize.Y = int.Parse(definition.Attribute(FRAME_HEIGHT).Value, NumberStyles.Integer); sheetSize.X = int.Parse(definition.Attribute(SHEET_COLUMNS).Value, NumberStyles.Integer); sheetSize.Y = int.Parse(definition.Attribute(SHEET_ROWS).Value, NumberStyles.Integer); frameInterval = TimeSpan.FromSeconds(1.0f / int.Parse(definition.Attribute(SPEED).Value, NumberStyles.Integer)); PistolShotSouthAnimation.Add(new Animation(PistolShotSouthTexture[3], frameSize, sheetSize, frameInterval)); // Define a new Animation instance } private void PeterPistolShotNorthAnimationLoad(XDocument doc) { TimeSpan frameInterval; Point sheetSize = new Point(); Point frameSize = new Point(); var definition = doc.Root.Element("PeterPistolNorthDef"); PistolShotNorthTexture.Add(game.Content.Load<Texture2D>(@"InGame/Peter/peter_pistol_N")); PistolShotNorthOrigin.Add(new Vector2(PistolShotNorthTexture[3].Width / 2, PistolShotNorthTexture[3].Height / 2)); frameSize.X = int.Parse(definition.Attribute(FRAME_WIDTH).Value, NumberStyles.Integer); frameSize.Y = int.Parse(definition.Attribute(FRAME_HEIGHT).Value, NumberStyles.Integer); sheetSize.X = int.Parse(definition.Attribute(SHEET_COLUMNS).Value, NumberStyles.Integer); sheetSize.Y = int.Parse(definition.Attribute(SHEET_ROWS).Value, NumberStyles.Integer); frameInterval = TimeSpan.FromSeconds(1.0f / int.Parse(definition.Attribute(SPEED).Value, NumberStyles.Integer)); PistolShotNorthAnimation.Add(new Animation(PistolShotNorthTexture[3], frameSize, sheetSize, frameInterval)); // Define a new Animation instance } private void PeterShotgunShotEastAnimationLoad(XDocument doc) { TimeSpan frameInterval; Point sheetSize = new Point(); Point frameSize = new Point(); var definition = doc.Root.Element("PeterShotgunEDef"); ShotgunEastTexture.Add(game.Content.Load<Texture2D>(@"InGame/Peter/peter_shotgun_E")); ShotgunShotEastOrigin.Add(new Vector2(ShotgunEastTexture[3].Width / 2, PistolShotEastTexture[3].Height / 2)); frameSize.X = int.Parse(definition.Attribute(FRAME_WIDTH).Value, NumberStyles.Integer); frameSize.Y = int.Parse(definition.Attribute(FRAME_HEIGHT).Value, NumberStyles.Integer); sheetSize.X = int.Parse(definition.Attribute(SHEET_COLUMNS).Value, NumberStyles.Integer); sheetSize.Y = int.Parse(definition.Attribute(SHEET_ROWS).Value, NumberStyles.Integer); frameInterval = TimeSpan.FromSeconds(1.0f / int.Parse(definition.Attribute(SPEED).Value, NumberStyles.Integer)); MachinegunEastAnimation.Add(new Animation(ShotgunEastTexture[3], frameSize, sheetSize, frameInterval)); ShotgunShotEastAnimation.Add(new Animation(ShotgunEastTexture[3], frameSize, sheetSize, TimeSpan.FromSeconds(0.4f))); } private void PeterShotgunShotNorthEastAnimationLoad(XDocument doc) { TimeSpan frameInterval; Point sheetSize = new Point(); Point frameSize = new Point(); var definition = doc.Root.Element("PeterShotgunNEDef"); ShotgunNETexture.Add(game.Content.Load<Texture2D>(@"InGame/Peter/peter_shotgun_NE")); ShotgunNEOrigin.Add(new Vector2(ShotgunNETexture[3].Width / 2, ShotgunNETexture[3].Height / 2)); frameSize.X = int.Parse(definition.Attribute(FRAME_WIDTH).Value, NumberStyles.Integer); frameSize.Y = int.Parse(definition.Attribute(FRAME_HEIGHT).Value, NumberStyles.Integer); sheetSize.X = int.Parse(definition.Attribute(SHEET_COLUMNS).Value, NumberStyles.Integer); sheetSize.Y = int.Parse(definition.Attribute(SHEET_ROWS).Value, NumberStyles.Integer); frameInterval = TimeSpan.FromSeconds(1.0f / int.Parse(definition.Attribute(SPEED).Value, NumberStyles.Integer)); MachinegunNEAnimation.Add(new Animation(ShotgunNETexture[3], frameSize, sheetSize, frameInterval)); ShotgunNEAnimation.Add(new Animation(ShotgunNETexture[3], frameSize, sheetSize, TimeSpan.FromSeconds(0.4f))); } private void PeterShotgunShotSouthEastAnimationLoad(XDocument doc) { TimeSpan frameInterval; Point sheetSize = new Point(); Point frameSize = new Point(); var definition = doc.Root.Element("PeterShotgunSEDef"); ShotgunSETexture.Add(game.Content.Load<Texture2D>(@"InGame/Peter/peter_shotgun_SE")); ShotgunSEOrigin.Add(new Vector2(ShotgunSETexture[3].Width / 2, ShotgunSETexture[3].Height / 2)); frameSize.X = int.Parse(definition.Attribute(FRAME_WIDTH).Value, NumberStyles.Integer); frameSize.Y = int.Parse(definition.Attribute(FRAME_HEIGHT).Value, NumberStyles.Integer); sheetSize.X = int.Parse(definition.Attribute(SHEET_COLUMNS).Value, NumberStyles.Integer); sheetSize.Y = int.Parse(definition.Attribute(SHEET_ROWS).Value, NumberStyles.Integer); frameInterval = TimeSpan.FromSeconds(1.0f / int.Parse(definition.Attribute(SPEED).Value, NumberStyles.Integer)); MachinegunSEAnimation.Add(new Animation(ShotgunSETexture[3], frameSize, sheetSize, frameInterval)); ShotgunSEAnimation.Add(new Animation(ShotgunSETexture[3], frameSize, sheetSize, TimeSpan.FromSeconds(0.4f))); } private void PeterShotgunShotSouthAnimationLoad(XDocument doc) { TimeSpan frameInterval; Point sheetSize = new Point(); Point frameSize = new Point(); var definition = doc.Root.Element("PeterShotgunSouthDef"); ShotgunSouthTexture.Add(game.Content.Load<Texture2D>(@"InGame/Peter/peter_shotgun_S")); ShotgunSouthOrigin.Add(new Vector2(ShotgunSouthTexture[3].Width / 2, ShotgunSouthTexture[3].Height / 2)); frameSize.X = int.Parse(definition.Attribute(FRAME_WIDTH).Value, NumberStyles.Integer); frameSize.Y = int.Parse(definition.Attribute(FRAME_HEIGHT).Value, NumberStyles.Integer); sheetSize.X = int.Parse(definition.Attribute(SHEET_COLUMNS).Value, NumberStyles.Integer); sheetSize.Y = int.Parse(definition.Attribute(SHEET_ROWS).Value, NumberStyles.Integer); frameInterval = TimeSpan.FromSeconds(1.0f / int.Parse(definition.Attribute(SPEED).Value, NumberStyles.Integer)); MachinegunSouthAnimation.Add(new Animation(ShotgunSouthTexture[3], frameSize, sheetSize, frameInterval)); ShotgunSouthAnimation.Add(new Animation(ShotgunSouthTexture[3], frameSize, sheetSize, TimeSpan.FromSeconds(0.4f))); } private void PeterShotgunShotNorthAnimationLoad(XDocument doc) { TimeSpan frameInterval; Point sheetSize = new Point(); Point frameSize = new Point(); var definition = doc.Root.Element("PeterShotgunNorthDef"); ShotgunNorthTexture.Add(game.Content.Load<Texture2D>(@"InGame/Peter/peter_shotgun_N")); ShotgunNorthOrigin.Add(new Vector2(ShotgunNorthTexture[3].Width / 2, ShotgunNorthTexture[3].Height / 2)); frameSize.X = int.Parse(definition.Attribute(FRAME_WIDTH).Value, NumberStyles.Integer); frameSize.Y = int.Parse(definition.Attribute(FRAME_HEIGHT).Value, NumberStyles.Integer); sheetSize.X = int.Parse(definition.Attribute(SHEET_COLUMNS).Value, NumberStyles.Integer); sheetSize.Y = int.Parse(definition.Attribute(SHEET_ROWS).Value, NumberStyles.Integer); frameInterval = TimeSpan.FromSeconds(1.0f / int.Parse(definition.Attribute(SPEED).Value, NumberStyles.Integer)); MachinegunNorthAnimation.Add(new Animation(ShotgunNorthTexture[3], frameSize, sheetSize, frameInterval)); ShotgunNorthAnimation.Add(new Animation(ShotgunNorthTexture[3], frameSize, sheetSize, TimeSpan.FromSeconds(0.4f))); } private void FlamethrowerAnimationLoad(XDocument doc) { TimeSpan frameInterval; Point sheetSize = new Point(); Point frameSize = new Point(); var definition = doc.Root.Element("FlameThrowerDef"); flamethrowerTexture = game.Content.Load<Texture2D>(@"InGame/flamethrower"); frameSize.X = int.Parse(definition.Attribute(FRAME_WIDTH).Value, NumberStyles.Integer); frameSize.Y = int.Parse(definition.Attribute(FRAME_HEIGHT).Value, NumberStyles.Integer); sheetSize.X = int.Parse(definition.Attribute(SHEET_COLUMNS).Value, NumberStyles.Integer); sheetSize.Y = int.Parse(definition.Attribute(SHEET_ROWS).Value, NumberStyles.Integer); frameInterval = TimeSpan.FromSeconds(1.0f / int.Parse(definition.Attribute(SPEED).Value, NumberStyles.Integer)); flamethrowerAnimation = new Animation(flamethrowerTexture, frameSize, sheetSize, frameInterval); } private void UIStatsLoad() { UIStats = game.Content.Load<Texture2D>(@"UI\gameplay_gui_stats"); UIStatsBlue = game.Content.Load<Texture2D>(@"UI\gui_stats_bkg_blue"); UIStatsRed = game.Content.Load<Texture2D>(@"UI\gui_stats_bkg_red"); UIStatsGreen = game.Content.Load<Texture2D>(@"UI\gui_stats_bkg_green"); UIStatsYellow = game.Content.Load<Texture2D>(@"UI\gui_stats_bkg_yellow"); UIPlayerBlue = game.Content.Load<Texture2D>(@"UI\gui_player_blue"); UIPlayerRed = game.Content.Load<Texture2D>(@"UI\gui_player_red"); UIPlayerGreen = game.Content.Load<Texture2D>(@"UI\gui_player_green"); UIPlayerYellow = game.Content.Load<Texture2D>(@"UI\gui_player_yellow"); } private void UIComponentsLoad() { Map = game.Content.Load<Texture2D>(Level.mapTextureFileName); bullet = game.Content.Load<Texture2D>(@"InGame/Photon"); bulletorigin = new Vector2(bullet.Width / 2, bullet.Height / 2); #if DEBUG PositionReference = game.Content.Load<Texture2D>(@"InGame/position_reference_temporal"); #endif CharacterShadow = game.Content.Load<Texture2D>(@"InGame/character_shadow"); Explosion.Texture = game.Content.Load<Texture2D>(@"InGame/Explosion"); cursorTexture = game.Content.Load<Texture2D>(@"InGame/GUI/aimcursor"); jadeUI = game.Content.Load<Texture2D>(@"InGame/GUI/jade_gui"); rayUI = game.Content.Load<Texture2D>(@"InGame/GUI/ray_gui"); peterUI = game.Content.Load<Texture2D>(@"InGame/GUI/peter_gui"); richardUI = game.Content.Load<Texture2D>(@"InGame/GUI/richard_gui"); whiteLine = game.Content.Load<Texture2D>(@"Menu/linea_menu"); pause_icon = game.Content.Load<Texture2D>(@"UI/pause_iconWP"); left_thumbstick = game.Content.Load<Texture2D>(@"UI/left_thumbstick"); right_thumbstick = game.Content.Load<Texture2D>(@"UI/right_thumbstick"); } private void FontsLoad() { arcade14 = game.Content.Load<SpriteFont>(@"InGame/GUI/ArcadeFont14"); arcade28 = game.Content.Load<SpriteFont>(@"InGame/GUI/ArcadeFont28"); MenuHeaderFont = this.ScreenManager.Game.Content.Load<SpriteFont>(@"Menu\ArialMenuHeader"); MenuInfoFont = this.ScreenManager.Game.Content.Load<SpriteFont>(@"Menu\ArialMenuInfo"); MenuListFont = this.ScreenManager.Game.Content.Load<SpriteFont>(@"Menu\ArialMenuList"); } private void FurnitureLoad() { float lIndex = 0.8f; FurnitureComparer furnitureComparer = new FurnitureComparer(); foreach (Furniture furniture in Level.furnitureList) { furniture.Load(game); } Level.furnitureList.Sort(furnitureComparer); // Apply layer index to sorted list foreach (Furniture furniture in Level.furnitureList) { furniture.layerIndex = lIndex; lIndex -= 0.004f; } } } } <|start_filename|>ZombustersWindows/GameStateManagement/NeutralInput.cs<|end_filename|> using Microsoft.Xna.Framework; namespace ZombustersWindows { public struct NeutralInput { public Vector2 StickLeftMovement; public Vector2 StickRightMovement; public Vector2 GamePadFire; public Vector2 MouseFire; public bool DPadLeft; public bool DPadRight; public bool ButtonA; public bool ButtonB; public bool ButtonY; public bool ButtonLT; public bool ButtonRT; public bool ButtonStart; public bool ButtonRB; } } <|start_filename|>ZombustersWindows/GameObjects/Enemies/EnemyType.cs<|end_filename|> namespace ZombustersWindows { public enum EnemyType { Zombie, Tank, Rat, Wolf, Minotaur } } <|start_filename|>ZombustersWindows/OnlineDataSyncManager/IOnlineSyncTarget.cs<|end_filename|> /* Copyright (c) 2010 Spyn Doctor Games (<NAME>). All rights reserved. Redistribution and use in binary forms, with or without modification, and for whatever purpose (including commercial) are permitted. Atribution is not required. If you want to give attribution, use the following text and URL (may be translated where required): Uses source code by Spyn Doctor Games - http://www.spyn-doctor.de Redistribution and use in source forms, with or without modification, are permitted provided that redistributions of source code retain the above copyright notice, this list of conditions and the following disclaimer. THIS SOFTWARE IS PROVIDED BY SPYN DOCTOR GAMES (<NAME>) "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SPYN DOCTOR GAMES (<NAME>) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ namespace ZombustersWindows { public interface IOnlineSyncTarget { /* This method is called by the OnlineDataSyncManager at the very start of the online * synchronization between two peers, right after the network session has been established. * Use it for any initialization that might be necessary to prepare for the synchronization. * * IMPORTANT: The method is called by a separate worker thread. Make sure that it is properly * synched with the normal game main thread where necessary (if the two threads may possibly * access the same data). */ void startSynchronization(); /* This method is called by the OnlineDataSyncManager at the very end of the online * synchronization between two peers, right after the network session has been closed. * Use it for any cleanup that might be necessary after the synchronization. * * IMPORTANT: The method is called by a separate worker thread. Make sure that it is properly * synched with the normal game main thread where necessary (if the two threads may possibly * access the same data). */ void endSynchronization(Player player, TopScoreListContainer mScores); /* This method is called by the OnlineDataSyncManager during the online synchronization * between two peers, right before the local peer starts his own send cycle. * Each peer goes through a send cycle and a receive cycle. One of the peers sends first, * then receives, the other receives first, then sends. * For each of them, this method is called right before the send cycle (so the call might * happen after the receive cycle, depending on which of the two peers this is). * Use it for any initialization that might be necessary to prepare for sending. * * IMPORTANT: The method is called by a separate worker thread. Make sure that it is properly * synched with the normal game main thread where necessary (if the two threads may possibly * access the same data). */ void prepareForSending(); /* This method is called by the OnlineDataSyncManager during the send cycle, to write the next * transfer record (and thus send it to the other peer). * Return "true" if the written record was the record that signals the end of the send cycle, * or "false" if there are more records to transfer. See comment of "readTransferRecord" for * more details. * * IMPORTANT: The method is called by a separate worker thread. Make sure that it is properly * synched with the normal game main thread where necessary (if the two threads may possibly * access the same data). */ #if !WINDOWS_PHONE && !WINDOWS && !NETCOREAPP && !WINDOWS_UAP bool writeTransferRecord(PacketWriter writer); #endif /* This method is called by the OnlineDataSyncManager during the receive cycle, to read the next * transfer record (which the other peer has sent us). * Return "true" if the received record was recognized as the end-of-cycle record, or "false" * if the record was not recognized as the end-of-cycle record (i.e. more records are still * expected). * * It is up to the implementation of "writeTransferRecord" and "readTransferRecord" to define * a protocol that allows the two peers to recognize the end of the transfer cycle. Usually you * would transfer some sort of record marker, for example "1" means "data record" (so the "1" * is then followed by more data bytes) and "0" means "end of data" (not followed by more data * bytes). When the implementation of "writeTransferRecord" writes the end marker "0", it * must then return "true". But if it writes the marker "1" (followed by the actual data bytes) * it must return "false. And when "readTransferRecord" reads the end marker "0", it must also * return "true". But if it reads the marker "1" (and then also reads the following data bytes) * it must return "false". * * IMPORTANT: The method is called by a separate worker thread. Make sure that it is properly * synched with the normal game main thread where necessary (if the two threads may possibly * access the same data). */ #if !WINDOWS_PHONE && !WINDOWS && !NETCOREAPP && !WINDOWS_UAP bool readTransferRecord(PacketReader reader); #endif } } <|start_filename|>ZombustersWindows/ContentManager/Angles.cs<|end_filename|> namespace ZombustersWindows.Subsystem_Managers { public static class Angles { public static readonly float[] NORTH = { -0.3925f, 0.3925f }; public static readonly float[] NORTH_EAST = { 0.3925f, 1.1775f }; public static readonly float[] EAST = { 1.1775f, 1.9625f }; public static readonly float[] SOUTH_EAST = { 1.19625f, 2.7275f }; public static readonly float[] SOUTH = { 2.7275f, -2.7275f }; public static readonly float[] SOUTH_WEST = { -1.9625f, -2.7275f }; public static readonly float[] WEST = { -1.1775f, -1.9625f }; public static readonly float[] NORTH_WEST = { -0.3925f, -1.1775f }; public static bool IsNorth(float angle) { if (angle > NORTH[0] && angle < NORTH[1]) { return true; } else { return false; } } public static bool IsNorthEast(float angle) { if (angle > Angles.NORTH_EAST[0] && angle < Angles.NORTH_EAST[1]) { return true; } else { return false; } } public static bool IsEast(float angle) { if (angle > Angles.EAST[0] && angle < Angles.EAST[1]) { return true; } else { return false; } } public static bool IsSouthEast(float angle) { if (angle > Angles.SOUTH_EAST[0] && angle < Angles.SOUTH_EAST[1]) { return true; } else { return false; } } public static bool IsSouth(float angle) { if (angle > Angles.SOUTH[0] || angle < Angles.SOUTH[1]) { return true; } else { return false; } } public static bool IsSouthWest(float angle) { if (angle < Angles.SOUTH_WEST[0] && angle > Angles.SOUTH_WEST[1]) { return true; } else { return false; } } public static bool IsWest(float angle) { if (angle < Angles.WEST[0] && angle > Angles.WEST[1]) { return true; } else { return false; } } public static bool IsNorthWest(float angle) { if (angle < Angles.NORTH_WEST[0] && angle > Angles.NORTH_WEST[1]) { return true; } else { return false; } } } } <|start_filename|>ZombustersWindows/OnlineDataSyncManager/TopScoreList.cs<|end_filename|> /* Copyright (c) 2010 Spyn Doctor Games (<NAME>). All rights reserved. Redistribution and use in binary forms, with or without modification, and for whatever purpose (including commercial) are permitted. Atribution is not required. If you want to give attribution, use the following text and URL (may be translated where required): Uses source code by Spyn Doctor Games - http://www.spyn-doctor.de Redistribution and use in source forms, with or without modification, are permitted provided that redistributions of source code retain the above copyright notice, this list of conditions and the following disclaimer. THIS SOFTWARE IS PROVIDED BY SPYN DOCTOR GAMES (<NAME>) "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SPYN DOCTOR GAMES (<NAME>) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Last change: 2010-09-16 */ using System.Collections.Generic; using System.IO; using System.Diagnostics; using System.Threading; namespace ZombustersWindows { public class TopScoreList { private int mMaxSize; private List<TopScoreEntry> mEntryList; private List<TopScoreEntry> mFilteredList; private Dictionary<string, TopScoreEntry> mEntryMap; private readonly object SYNC = new object(); public TopScoreList(int maxSize) { mMaxSize = maxSize; mEntryList = new List<TopScoreEntry>(); mFilteredList = new List<TopScoreEntry>(); mEntryMap = new Dictionary<string, TopScoreEntry>(); } public TopScoreList(BinaryReader reader) : this(reader.ReadInt32()) { int count = reader.ReadInt32(); for (int i = 0; i < count; i++) { TopScoreEntry entry = new TopScoreEntry(reader, true); if (entry.isLegal()) { mEntryMap[entry.Gamertag] = entry; mEntryList.Add(entry); } } } public bool containsEntryForGamertag(string gamertag) { lock (SYNC) { for (int i = 0; i < mEntryList.Count; i++) { if (mEntryList[i].Gamertag == gamertag) return true; } return false; } } public int getFullCount() { lock (SYNC) { return mEntryList.Count; } } //public int getFilteredCount(SignedInGamer gamer) //{ // lock (SYNC) // { // initFilteredList(gamer, false); // return mFilteredList.Count; // } //} public void fillPageFromFullList(int pageNumber, TopScoreEntry[] page) { lock (SYNC) { fillPage(mEntryList, true, pageNumber, page); } } //public void fillPageFromFilteredList(int pageNumber, TopScoreEntry[] page, SignedInGamer gamer) //{ // lock (SYNC) // { // initFilteredList(gamer, true); // fillPage(mFilteredList, false, pageNumber, page); // } //} public int fillPageThatContainsGamertagFromFullList(TopScoreEntry[] page, string gamertag) { lock (SYNC) { int indexOfGamertag = 0; for (int i = 0; i < mEntryList.Count; i++) { if (mEntryList[i].Gamertag == gamertag) { indexOfGamertag = i; break; } } int pageNumber = indexOfGamertag / page.Length; fillPage(mEntryList, true, pageNumber, page); return pageNumber; } } //public int fillPageThatContainsGamertagFromFilteredList(TopScoreEntry[] page, SignedInGamer gamer) //{ // lock (SYNC) // { // initFilteredList(gamer, true); // int indexOfGamertag = 0; // for (int i = 0; i < mFilteredList.Count; i++) // { // if (mFilteredList[i].Gamertag == gamer.Gamertag) // { // indexOfGamertag = i; // break; // } // } // int pageNumber = indexOfGamertag / page.Length; // fillPage(mFilteredList, false, pageNumber, page); // return pageNumber; // } //} private void fillPage(List<TopScoreEntry> list, bool initRank, int pageNumber, TopScoreEntry[] page) { int index = pageNumber * page.Length; for (int i = 0; i < page.Length; i++) { if (index >= 0 && index < list.Count) { page[i] = list[index]; if (initRank) page[i].RankAtLastPageFill = index + 1; } else page[i] = null; index++; } } //private void initFilteredList(SignedInGamer gamer, bool initRank) //{ // string gamertag = gamer.Gamertag; // FriendCollection friendsFilter = gamer.GetFriends(); // mFilteredList.Clear(); // for (int i = 0; i < mEntryList.Count; i++) // { // TopScoreEntry entry = mEntryList[i]; // if (entry.Gamertag == gamertag) // { // mFilteredList.Add(entry); // if (initRank) // entry.RankAtLastPageFill = i + 1; // } // else // { // foreach (FriendGamer friend in friendsFilter) // { // if (entry.Gamertag == friend.Gamertag) // { // mFilteredList.Add(entry); // if (initRank) // entry.RankAtLastPageFill = i + 1; // break; // } // } // } // } //} #if WINDOWS_PHONE public void write(BinaryWriter writer) { writer.Write(mMaxSize); writer.Write(mEntryList.Count); foreach (TopScoreEntry entry in mEntryList) entry.write(writer); } #else public void write(BinaryWriter writer) { lock (SYNC) { writer.Write(mMaxSize); writer.Write(mEntryList.Count); foreach (TopScoreEntry entry in mEntryList) entry.write(writer); } } #endif public bool addEntry(TopScoreEntry entry) { if (!entry.isLegal()) return false; lock (SYNC) { string gamertag = entry.Gamertag; if (mEntryMap.ContainsKey(gamertag)) { // Existing entry found for this gamertag TopScoreEntry existingEntry = mEntryMap[gamertag]; int compareValue = entry.compareTo(existingEntry); if (compareValue < 0) { // new entry is smaller: do not insert return false; } else if (compareValue == 0) { // both entries are equal: Keep existing entry but transfer "IsLocal" state existingEntry.IsLocalEntry = entry.IsLocalEntry; return false; } else { // existing entry is smaller: replace with new entry mEntryList.Remove(existingEntry); addNewEntry(entry); // this also replaces existing entry in mEntryMap return true; } } else return addNewEntry(entry); } } private bool addNewEntry(TopScoreEntry entry) { for (int i = 0; i < mEntryList.Count; i++) { if (entry.compareTo(mEntryList[i]) >= 0) { // Found existing smaller entry: Insert this one before mEntryList.Insert(i, entry); mEntryMap[entry.Gamertag] = entry; // Delete last entry if there are now too many if (mEntryList.Count > mMaxSize) { TopScoreEntry removedEntry = mEntryList[mMaxSize]; mEntryList.RemoveAt(mMaxSize); mEntryMap.Remove(removedEntry.Gamertag); } return true; } } // No existing smaller entry found, but still space in list: Add at end if (mEntryList.Count < mMaxSize) { mEntryList.Add(entry); mEntryMap[entry.Gamertag] = entry; return true; } // Entry added at end or No existing smaller entry found and list is full: Do not add return false; } public void initForTransfer() { lock (SYNC) { foreach (TopScoreEntry entry in mEntryList) entry.IsLocalEntry = true; // at the beginning of a transfer, all entries are local } } #if !WINDOWS_PHONE && !WINDOWS && !NETCOREAPP && !WINDOWS_UAP public int writeNextTransferEntry(PacketWriter writer, int myListIndex, int entryIndex) { lock (SYNC) { while (entryIndex < mEntryList.Count) { // While there are still more entries in the current list: // Find a local entry that needs transfer if (mEntryList[entryIndex].IsLocalEntry) { #if WINDOWS Debug.Write("*"); // local entry transferred #endif writer.Write(TopScoreListContainer.MARKER_ENTRY); writer.Write((byte)myListIndex); mEntryList[entryIndex].write(writer); return entryIndex + 1; } else { #if WINDOWS Debug.Write("~"); // remote entry skipped #endif entryIndex++; Thread.Sleep(1); } } return -1; } } public bool readTransferEntry(PacketReader reader) { lock (SYNC) { return addEntry(new TopScoreEntry(reader, false)); } } #endif } } <|start_filename|>ZombustersWindows/MenuScreens/LobbyScreen.cs<|end_filename|> using System; using System.Collections.Generic; using System.Text.RegularExpressions; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Audio; using Microsoft.Xna.Framework.Content; using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Input; #if !WINDOWS_PHONE //using Microsoft.Xna.Framework.Storage; #endif using GameStateManagement; using ZombustersWindows.Subsystem_Managers; #if !WINDOWS_PHONE && !WINDOWS && !NETCOREAPP && !WINDOWS_UAP namespace ZombustersWindows { public class LobbyScreen : BackgroundScreen { Rectangle uiBounds; Rectangle titleBounds; Vector2 selectPos; Texture2D btnA; Texture2D btnB; Texture2D btnStart; Texture2D logoMenu; Texture2D lineaMenu; //Linea de 1px para separar Texture2D lobbyHeaderImage; SpriteFont MenuHeaderFont; SpriteFont MenuInfoFont; SpriteFont MenuListFont; #region Network Settings // Multiplayer event handler public event EventHandler<MenuSelection> MenuGamerCardSelected; public event EventHandler<MenuSelection> MenuInviteSelected; public event EventHandler<MenuSelection> MenuPartySelected; public event EventHandler<MenuSelection> MenuStartGameSelected; Boolean CreateGame = false; static String[] PlaylistSettings = { "STORY MODE", "TIMECRISIS MODE", "HARDCORE MODE" }; //static int CurrentPlaylistSetting = 0; #endregion #region Game Settings public int LevelSettings = 0; public int PrivateSlotsSettings = 0; public int MaxPlayersSettings = 0; #endregion public LobbyScreen(Boolean create) { this.CreateGame = create; } private MenuComponent menu; //private BloomComponent bloom; public override void Initialize() { Viewport view = this.ScreenManager.GraphicsDevice.Viewport; int borderheight = (int)(view.Height * .05); // Deflate 10% to provide for title safe area on CRT TVs uiBounds = GetTitleSafeArea(); titleBounds = new Rectangle(0, 0, 1280, 720); //"Select" text position selectPos = new Vector2(uiBounds.X + 60, uiBounds.Bottom - 30); MenuHeaderFont = this.ScreenManager.Game.Content.Load<SpriteFont>(@"Menu\ArialMenuHeader"); MenuInfoFont = this.ScreenManager.Game.Content.Load<SpriteFont>(@"Menu\ArialMenuInfo"); MenuListFont = this.ScreenManager.Game.Content.Load<SpriteFont>(@"Menu\ArialMenuList"); menu = new MenuComponent(this.ScreenManager.Game, MenuListFont); //bloom = new BloomComponent(this.ScreenManager.Game); //((Game1)this.ScreenManager.Game).gamerManager.UpdateOnline(true, ((Game1)this.ScreenManager.Game).networkSessionManager.networkSession); //Initialize Main Menu menu.Initialize(); /* //Adding Options text for the Menu for ( i=0; i<((Game1)this.ScreenManager.Game).gamerManager.getOnlinePlayerGamertag().Count; i++) //foreach (String gamertag in ((Game1)this.ScreenManager.Game).gamerManager.getOnlinePlayerGamertag()) { String gamertag = ((Game1)this.ScreenManager.Game).gamerManager.getOnlinePlayerGamertag()[i]; menu.AddText(gamertag, gamertag); } */ menu.uiBounds = menu.Extents; //Offset de posicion del menu menu.uiBounds.Offset(uiBounds.X, 300); //menu.SelectedColor = new Color(198,34,40); menu.MenuCanceled += new EventHandler<MenuSelection>(menu_MenuCanceled); menu.MenuConfigSelected += new EventHandler<MenuSelection>(menu_MenuConfigSelected); MenuInviteSelected += new EventHandler<MenuSelection>(menu_InvitePlayers); MenuPartySelected += new EventHandler<MenuSelection>(menu_InviteParty); MenuStartGameSelected += new EventHandler<MenuSelection>(menu_StartGame); MenuGamerCardSelected += new EventHandler<MenuSelection>(menu_MenuShowGamerCard); //Posiciona el menu menu.CenterInXLeftMenu(view); this.PresenceMode = GamerPresenceMode.WaitingInLobby; //bloom.Visible = !bloom.Visible; base.Initialize(); this.isBackgroundOn = true; } #region InputMethods // Invite Players void menu_InvitePlayers(Object sender, MenuSelection selection) { if (!Guide.IsVisible) { Guide.ShowGameInvite(PlayerIndex.One, null); } } // Invite Party void menu_InviteParty(Object sender, MenuSelection selection) { if (!Guide.IsVisible) { // Send invitations to all members of each local network gamer's LIVE party. LocalNetworkGamer gamer = ((Game1)this.ScreenManager.Game).networkSessionManager.networkSession.LocalGamers[0]; // get the party size for the first signed-in gamer. if (gamer.SignedInGamer.PartySize > 1) { gamer.SendPartyInvites(); } //Guide.ShowParty(PlayerIndex.One); } } // Leave match void menu_MenuCanceled(Object sender, MenuSelection selection) { //networkSessionManager.CloseSession(); //currentGameState = GameState.SignIn; MessageBoxScreen confirmExitMessageBox = new MessageBoxScreen(Strings.LobbyMenuString, Strings.ConfirmReturnMainMenuString, true); confirmExitMessageBox.Accepted += ConfirmExitMessageBoxAccepted; ScreenManager.AddScreen(confirmExitMessageBox); } /// <summary> /// Event handler for when the user selects ok on the "are you sure /// you want to exit" message box. /// </summary> void ConfirmExitMessageBoxAccepted(object sender, PlayerIndexEventArgs e) { ((Game1)this.ScreenManager.Game).networkSessionManager.CloseSession(); // If they hit B or Back, go back to Menu Screen ExitScreen(); } // Setup Menu void menu_MenuConfigSelected(Object sender, MenuSelection selection) { // If they hit Start, go to Configuration Screen //((Game1)this.ScreenManager.Game).DisplayOptions(); } // Toggle Ready to the player void menu_StartGame(Object sender, MenuSelection selection) { // Get local gamer LocalNetworkGamer localgamer = ((Game1)this.ScreenManager.Game).networkSessionManager.networkSession.LocalGamers[0]; if (localgamer.IsHost) { //((Game1)this.ScreenManager.Game).networkSessionManager.networkSessionState = NetworkSessionState.Playing; ((Game1)this.ScreenManager.Game).currentGameState = GameState.SelectPlayer; // Send message to other player that we'are starting ((Game1)this.ScreenManager.Game).networkSessionManager.packetWriter.Write((int)MessageType.SelectPlayer); localgamer.SendData(((Game1)this.ScreenManager.Game).networkSessionManager.packetWriter, SendDataOptions.Reliable); //Call StartGame //((Game1)this.ScreenManager.Game).BeginMultiplayerPlayerGame(); ExitScreen(); ((Game1)this.ScreenManager.Game).BeginSelectPlayerScreen(true); } } // Show Gamer Card void menu_MenuShowGamerCard(Object sender, MenuSelection selection) { int i,j; string errorMessage; if (((Game1)this.ScreenManager.Game).networkSessionManager.networkSession != null && !((Game1)this.ScreenManager.Game).networkSessionManager.networkSession.IsDisposed) { // If HOST if (((Game1)this.ScreenManager.Game).networkSessionManager.networkSession.IsHost) { for (i = 0; i < Gamer.SignedInGamers.Count; i++) { if (selection.Selection == i && !Guide.IsVisible) { SignedInGamer gamer = Gamer.SignedInGamers[i]; if (gamer.IsSignedInToLive) { Guide.ShowGamerCard(PlayerIndex.One, Gamer.SignedInGamers[i]); } } } for (i = 0; i < ((Game1)this.ScreenManager.Game).networkSessionManager.networkSession.AllGamers.Count; i++) { NetworkGamer netGamer = ((Game1)this.ScreenManager.Game).networkSessionManager.networkSession.AllGamers[i]; if (!netGamer.IsLocal) { for (j = 0; j < ((Game1)this.ScreenManager.Game).gamerManager.getOnlinePlayerGamertag().Count; j++) { if (((Game1)this.ScreenManager.Game).gamerManager.getOnlinePlayerGamertag()[j] == netGamer.Gamertag) { if (selection.Selection == i && !Guide.IsVisible) { try { Guide.ShowGamerCard(PlayerIndex.One, netGamer); } catch (Exception error) { errorMessage = error.Message; } } } } } } } else { for (i = 0; i < ((Game1)this.ScreenManager.Game).networkSessionManager.networkSession.AllGamers.Count; i++) { NetworkGamer netGamer = ((Game1)this.ScreenManager.Game).networkSessionManager.networkSession.AllGamers[i]; if (!netGamer.IsLocal) { for (j = 0; j < ((Game1)this.ScreenManager.Game).gamerManager.getOnlinePlayerGamertag().Count; j++) { if (((Game1)this.ScreenManager.Game).gamerManager.getOnlinePlayerGamertag()[j] == netGamer.Gamertag) { if (selection.Selection == i && !Guide.IsVisible) { try { Guide.ShowGamerCard(PlayerIndex.One, netGamer); } catch (Exception error) { errorMessage = error.Message; } } } } } } for (i = 0; i < Gamer.SignedInGamers.Count; i++) { if (selection.Selection == (i + ((Game1)this.ScreenManager.Game).networkSessionManager.networkSession.RemoteGamers.Count) && !Guide.IsVisible) { SignedInGamer gamer = Gamer.SignedInGamers[i]; if (gamer.IsSignedInToLive) { Guide.ShowGamerCard(PlayerIndex.One, Gamer.SignedInGamers[i]); } } } } } /* List<String> supportGamertagList = new List<String>(); foreach (SignedInGamer player in Gamer.SignedInGamers) { if (player.IsSignedInToLive) { supportGamertagList.Add(player.Gamertag); } } for (i = 0; i < ((Game1)this.ScreenManager.Game).gamerManager.getOnlinePlayerGamertag().Count; i++) { //if (selection.Selection == i && !Guide.IsVisible && Gamer.SignedInGamers[selection.Selection].IsSignedInToLive) if (selection.Selection == i && !Guide.IsVisible) { for ( j=0; j<Gamer.SignedInGamers.Count; j++) { SignedInGamer gamer = Gamer.SignedInGamers[j]; if (gamer.Gamertag == ((Game1)this.ScreenManager.Game).gamerManager.getOnlinePlayerGamertag()[i]) { if (gamer.IsSignedInToLive) { Guide.ShowGamerCard(PlayerIndex.One, Gamer.SignedInGamers[j]); } } } } } for ( i=0; i<((Game1)this.ScreenManager.Game).networkSessionManager.networkSession.AllGamers.Count; i++ ) //foreach (NetworkGamer networkGamer in ((Game1)this.ScreenManager.Game).networkSessionManager.networkSession.AllGamers) { NetworkGamer networkGamer = ((Game1)this.ScreenManager.Game).networkSessionManager.networkSession.AllGamers[i]; if (supportGamertagList.Contains(networkGamer.Gamertag)) { if (selection.Selection == i && !Guide.IsVisible && Gamer.SignedInGamers[selection.Selection].IsSignedInToLive) { Guide.ShowGamerCard(PlayerIndex.One, Gamer.SignedInGamers[selection.Selection]); } } } */ } #endregion public override void LoadContent() { //Button "A" btnA = this.ScreenManager.Game.Content.Load<Texture2D>("xboxControllerButtonA"); //Button "B" btnB = this.ScreenManager.Game.Content.Load<Texture2D>("xboxControllerButtonB"); //Button "Select" btnStart = this.ScreenManager.Game.Content.Load<Texture2D>("xboxControllerStart"); //Linea blanca separatoria lineaMenu = this.ScreenManager.Game.Content.Load<Texture2D>(@"Menu/linea_menu"); //Logo Menu logoMenu = this.ScreenManager.Game.Content.Load<Texture2D>(@"Menu/logo_menu"); // Lobby Header Image lobbyHeaderImage = this.ScreenManager.Game.Content.Load<Texture2D>(@"Menu/lobby_header_image"); ((Game1)this.ScreenManager.Game).gamerManager.Load(); base.LoadContent(); } public override void HandleInput(InputState input) { if (input.IsNewButtonPress(Buttons.Y)) { if (MenuGamerCardSelected != null) MenuGamerCardSelected(this, new MenuSelection(menu.Selection)); return; } if (input.IsNewButtonPress(Buttons.A)) { MenuStartGameSelected.Invoke(this, new MenuSelection(menu.Selection)); return; } if (input.IsNewButtonPress(Buttons.X)) { MenuInviteSelected.Invoke(this, new MenuSelection(menu.Selection)); return; } if (input.IsNewButtonPress(Buttons.RightShoulder)) { MenuPartySelected.Invoke(this, new MenuSelection(menu.Selection)); return; } menu.HandleInput(input); base.HandleInput(input); } void UpdateMenuLobby() { byte i; menu.RemoveAll(); menu.Initialize(); //Adding Options text for the Menu //Adding Options text for the Menu for (i = 0; i < ((Game1)this.ScreenManager.Game).gamerManager.getOnlinePlayerGamertag().Count; i++) //foreach (String gamertag in ((Game1)this.ScreenManager.Game).gamerManager.getOnlinePlayerGamertag()) { String gamertag = ((Game1)this.ScreenManager.Game).gamerManager.getOnlinePlayerGamertag()[i]; menu.AddText(gamertag, gamertag); } if (((Game1)this.ScreenManager.Game).networkSessionManager.networkSession.IsHost) { this.CreateGame = true; } else { this.CreateGame = false; } } public override void Update(GameTime gameTime, bool otherScreenHasFocus, bool coveredByOtherScreen) { if (!coveredByOtherScreen && !Guide.IsVisible) { menu.Update(gameTime); } if (((Game1)this.ScreenManager.Game).gamerManager.GamerOnlineListHasChanged(true, ((Game1)this.ScreenManager.Game).networkSessionManager.networkSession)) { ((Game1)this.ScreenManager.Game).gamerManager.UpdateOnline(true, ((Game1)this.ScreenManager.Game).networkSessionManager.networkSession); UpdateMenuLobby(); } if (((Game1)this.ScreenManager.Game).gamerManager.getOnlinePlayerGamertag().Count != menu.Count) { UpdateMenuLobby(); } ((Game1)this.ScreenManager.Game).networkSessionManager.ProcessIncomingData(gameTime); ((Game1)this.ScreenManager.Game).networkSessionManager.UpdateNetworkSession(); base.Update(gameTime, otherScreenHasFocus, coveredByOtherScreen); } #region Draw public override void Draw(GameTime gameTime) { base.Draw(gameTime); // Draw Retrowax Logo (No lo dibujamos porque no cabe!) //menu.DrawLogoRetrowaxMenu(this.ScreenManager.SpriteBatch, new Vector2(uiBounds.Width, uiBounds.Height)); //menu.Draw(gameTime); menu.DrawLobby(gameTime, new Vector2(uiBounds.X + uiBounds.Width - 300, 90), ((Game1)this.ScreenManager.Game).gamerManager, MenuInfoFont, ((Game1)this.ScreenManager.Game).networkSessionManager.networkSession); //Draw Context Menu DrawContextMenu(menu, selectPos, this.ScreenManager.SpriteBatch); } //Draw all the Selection buttons on the bottom of the menu private void DrawContextMenu(MenuComponent menu, Vector2 pos, SpriteBatch batch) { string[] lines; Vector2 contextMenuPosition = new Vector2(uiBounds.X + 22, pos.Y - 100); Vector2 MenuTitlePosition = new Vector2(contextMenuPosition.X - 3, contextMenuPosition.Y - 300); batch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend, null, null, null, null, Resolution.getTransformationMatrix()); // Lobby Header Image batch.Draw(lobbyHeaderImage, new Vector2(MenuTitlePosition.X, MenuTitlePosition.Y + 75), Color.White); //Logo Menu batch.Draw(logoMenu, new Vector2(MenuTitlePosition.X - 55, MenuTitlePosition.Y - 5), Color.White); //LOBBY text batch.DrawString(MenuHeaderFont, Strings.LobbyMenuString, MenuTitlePosition, Color.White); //MATCHMAKING fade rotated batch.DrawString(MenuHeaderFont, Strings.MatchmakingMenuString, new Vector2(MenuTitlePosition.X - 10, MenuTitlePosition.Y + 70), new Color(255,255,255, 40), 1.58f, Vector2.Zero, 0.8f, SpriteEffects.None, 1.0f); //Linea divisoria pos.X -= 40; pos.Y -= 270; //batch.Draw(lineaMenu, pos, Color.White); pos.Y += 270; pos.Y -= 115; // Texto ESPERANDO MAS JUGADORES... batch.DrawString(MenuInfoFont, Strings.WaitingForPlayersMenuString.ToUpper(), new Vector2(pos.X, pos.Y - 30), Color.White); batch.Draw(lineaMenu, pos, Color.White); pos.Y += 115; //Texto de contexto del Lobby lines = Regex.Split(Strings.MatchmakingMMString, "\r\n"); foreach (string line in lines) { batch.DrawString(MenuInfoFont, line.Replace(" ", ""), contextMenuPosition, Color.White); contextMenuPosition.Y += 20; } //Linea divisoria pos.Y -= 15; batch.Draw(lineaMenu, pos, Color.White); // Draw context buttons menu.DrawMenuButtons(batch, new Vector2(pos.X + 10, pos.Y + 10), MenuInfoFont, true, this.CreateGame, false); batch.End(); } #endregion } } #endif <|start_filename|>ZombustersWindows/GameObjects/Enemies/Enemies.cs<|end_filename|> using System; using System.Collections.Generic; using GameAnalyticsSDK.Net; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Content; using Microsoft.Xna.Framework.Graphics; using ZombustersWindows.GameObjects; using ZombustersWindows.Subsystem_Managers; namespace ZombustersWindows { public class Enemies { private const int ZOMBIE_SCORE = 10; private const int RAT_SCORE = 15; private const int WOLF_SCORE = 30; private const int MINOTAUR_SCORE = 80; public List<BaseEnemy> EnemiesList = new List<BaseEnemy>(); public List<PowerUp> PowerUpList = new List<PowerUp>(); public Texture2D livePowerUpTexture; private Texture2D extraLivePowerUpTexture; private Texture2D shotgunAmmoPowerUpTexture; private Texture2D machinegunAmmoPowerUpTexture; private Texture2D flamethrowerAmmoPowerUpTexture; private Texture2D immunePowerUpTexture; public Texture2D heart; public Texture2D shotgunammoUI; public Texture2D pistolammoUI; public Texture2D grenadeammoUI; public Texture2D flamethrowerammoUI; private readonly MyGame game; private Random random; public Enemies(ref MyGame myGame, ref Random gameRandom) { game = myGame; random = gameRandom; } public void LoadContent(ContentManager content) { foreach (BaseEnemy enemy in EnemiesList) { enemy.LoadContent(content); } PowerUpsLoad(); } private void PowerUpsLoad() { livePowerUpTexture = game.Content.Load<Texture2D>(@"InGame/live_powerup"); extraLivePowerUpTexture = game.Content.Load<Texture2D>(@"InGame/extralife_powerup"); shotgunAmmoPowerUpTexture = game.Content.Load<Texture2D>(@"InGame/shotgun_ammo_powerup"); machinegunAmmoPowerUpTexture = game.Content.Load<Texture2D>(@"InGame/machinegun_ammo_powerup"); flamethrowerAmmoPowerUpTexture = game.Content.Load<Texture2D>(@"InGame/flamethrower_ammo_powerup"); immunePowerUpTexture = game.Content.Load<Texture2D>(@"InGame/immune_ammo_powerup"); heart = game.Content.Load<Texture2D>(@"InGame/GUI/heart"); shotgunammoUI = game.Content.Load<Texture2D>(@"InGame/GUI/shotgunammo"); pistolammoUI = game.Content.Load<Texture2D>(@"InGame/GUI/pistolammo"); grenadeammoUI = game.Content.Load<Texture2D>(@"InGame/GUI/grenadeammo"); flamethrowerammoUI = game.Content.Load<Texture2D>(@"InGame/GUI/flamethrowerammo"); } public void InitializeEnemy(int quantity, EnemyType enemyType, Level level, int subLevelIndex, float life, float speed, List<int> numplayersIngame) { int i, RandomX, RandomY; int RandomSpawnZone; int howManySpawnZones = 4; for (i = 0; i < quantity; i++) { RandomSpawnZone = this.random.Next(0, howManySpawnZones - 1); RandomX = this.random.Next(Convert.ToInt32(level.ZombieSpawnZones[RandomSpawnZone].X), Convert.ToInt32(level.ZombieSpawnZones[RandomSpawnZone].Y)); RandomY = this.random.Next(Convert.ToInt32(level.ZombieSpawnZones[RandomSpawnZone].Z), Convert.ToInt32(level.ZombieSpawnZones[RandomSpawnZone].W)); float subspeed = subLevelIndex / 10; switch (enemyType) { case EnemyType.Zombie: Zombie zombie = new Zombie(new Vector2(0, 0), new Vector2(RandomX, RandomY), 5.0f, life, speed + subspeed, ref random); zombie.behaviors.AddBehavior(new Pursuit(Arrive.Deceleration.fast, 50.0f)); zombie.behaviors.AddBehavior(new ObstacleAvoidance(ref level.gameWorld, 15.0f)); zombie.playerChased = numplayersIngame[this.random.Next(numplayersIngame.Count)]; EnemiesList.Add(zombie); break; case EnemyType.Tank: Tank tank = new Tank(new Vector2(0, 0), new Vector2(RandomX, RandomY), 5.0f); tank.behaviors.AddBehavior(new Pursuit(Arrive.Deceleration.fast, 50.0f)); tank.behaviors.AddBehavior(new ObstacleAvoidance(ref level.gameWorld, 15.0f)); EnemiesList.Add(tank); break; case EnemyType.Rat: Rat rat = new Rat(new Vector2(RandomX, RandomY), 5.0f, life, speed, ref random); rat.behaviors.AddBehavior(new Pursuit(Arrive.Deceleration.fast, 50.0f)); rat.behaviors.AddBehavior(new ObstacleAvoidance(ref level.gameWorld, 15.0f)); rat.playerChased = numplayersIngame[this.random.Next(numplayersIngame.Count)]; EnemiesList.Add(rat); break; case EnemyType.Wolf: Wolf wolf = new Wolf(new Vector2(RandomX, RandomY), 5.0f, life, speed, ref random); wolf.behaviors.AddBehavior(new Pursuit(Arrive.Deceleration.fast, 50.0f)); wolf.behaviors.AddBehavior(new ObstacleAvoidance(ref level.gameWorld, 15.0f)); wolf.playerChased = numplayersIngame[this.random.Next(numplayersIngame.Count)]; EnemiesList.Add(wolf); break; case EnemyType.Minotaur: Minotaur minotaur = new Minotaur(new Vector2(RandomX, RandomY), 5.0f, life, speed, ref random); minotaur.behaviors.AddBehavior(new Pursuit(Arrive.Deceleration.fast, 50.0f)); minotaur.behaviors.AddBehavior(new ObstacleAvoidance(ref level.gameWorld, 15.0f)); minotaur.playerChased = numplayersIngame[this.random.Next(numplayersIngame.Count)]; EnemiesList.Add(minotaur); break; } } } public void HandleCollisions(Player player, float totalGameSeconds) { HandleEnemiesCollisions(player, totalGameSeconds); HandlePowerUpCollisions(player); } private void HandleEnemiesCollisions(Player player, float totalGameSeconds) { for (int i = 0; i < EnemiesList.Count; i++) { BaseEnemy enemy = EnemiesList[i]; if (enemy.status == ObjectStatus.Active) { if (player.avatar.currentgun == GunType.flamethrower && player.avatar.ammo[(int)player.avatar.currentgun] > 0) { if (player.avatar.accumFire.Length() > .5) { if (player.avatar.FlameThrowerRectangle.Intersects(new Rectangle((int)enemy.entity.Position.X, (int)enemy.entity.Position.Y, 48, (int)enemy.entity.Height))) { if (enemy.lifecounter > 1.0f) { enemy.lifecounter -= 0.2f; enemy.isLoosingLife = true; } else { enemy.Destroy(game.totalGameSeconds, player.avatar.currentgun); SumScore(player, ref enemy); PlayDeathSound(ref enemy); if (player.avatar.score % 8000 == 0) { player.avatar.lives += 1; } if (PowerUpIsInRange(enemy.entity.Position, (int)enemy.entity.Width, (int)enemy.entity.Height)) { SpawnPowerUp(enemy); } } } } } else { for (int l = 0; l < player.avatar.bullets.Count; l++) { if (GameplayHelper.DetectBulletCollision(player.avatar.bullets[l], enemy.entity.Position, totalGameSeconds)) { if (enemy.lifecounter > 1.0f) { enemy.lifecounter -= 1.0f; enemy.isLoosingLife = true; player.avatar.bullets.RemoveAt(l); } else { enemy.Destroy(game.totalGameSeconds, player.avatar.currentgun); SumScore(player, ref enemy); PlayDeathSound(ref enemy); if (player.avatar.score % 8000 == 0) { player.avatar.lives += 1; } player.avatar.bullets.RemoveAt(l); if (PowerUpIsInRange(enemy.entity.Position, (int)enemy.entity.Width, (int)enemy.entity.Height)) { SpawnPowerUp(enemy); } } } } for (int bulletCount = 0; bulletCount < player.avatar.shotgunbullets.Count; bulletCount++) { for (int pelletCount = 0; pelletCount < player.avatar.shotgunbullets[bulletCount].Pellet.Count; pelletCount++) { if (GameplayHelper.DetectPelletCollision(player.avatar.shotgunbullets[bulletCount].Pellet[pelletCount], enemy.entity.Position, player.avatar.shotgunbullets[bulletCount].Angle, pelletCount, totalGameSeconds)) { player.avatar.shotgunbullets[bulletCount].Pellet.RemoveAt(pelletCount); if (enemy.lifecounter > 1.0f) { enemy.lifecounter -= 1.0f; enemy.isLoosingLife = true; } else { enemy.Destroy(game.totalGameSeconds, player.avatar.currentgun); SumScore(player, ref enemy); PlayDeathSound(ref enemy); if (player.avatar.score % 8000 == 0) { player.avatar.lives += 1; } if (PowerUpIsInRange(enemy.entity.Position, (int)enemy.entity.Width, (int)enemy.entity.Height)) { SpawnPowerUp(enemy); } } } } } } } if (GameplayHelper.DetectCrash(player.avatar, enemy.entity.Position)) { if (enemy.status == ObjectStatus.Active) { if (player.avatar.lifecounter <= 0) { player.Destroy(); player.avatar.lifecounter = 100; } else { player.avatar.isLoosingLife = true; player.avatar.lifecounter -= 1; } } } } } private void SumScore(Player player, ref BaseEnemy enemy) { if (enemy.GetType().Name == EnemyType.Zombie.ToString()) { player.avatar.score += ZOMBIE_SCORE; } else if (enemy.GetType().Name == EnemyType.Minotaur.ToString()) { player.avatar.score += MINOTAUR_SCORE; } else if (enemy.GetType().Name == EnemyType.Rat.ToString()) { player.avatar.score += RAT_SCORE; } else if (enemy.GetType().Name == EnemyType.Wolf.ToString()) { player.avatar.score += WOLF_SCORE; } else { player.avatar.score += ZOMBIE_SCORE; } } private void PlayDeathSound(ref BaseEnemy enemy) { if (enemy.GetType().Name == EnemyType.Zombie.ToString()) { game.audio.PlayZombieDying(); } else if (enemy.GetType().Name == EnemyType.Minotaur.ToString()) { game.audio.PlayMinotaurDeath(); } else if (enemy.GetType().Name == EnemyType.Rat.ToString()) { game.audio.PlayRatDeath(); } else if (enemy.GetType().Name == EnemyType.Wolf.ToString()) { game.audio.PlayWolfDeath(); } } private void HandlePowerUpCollisions(Player player) { foreach (PowerUp powerUp in PowerUpList) { if (powerUp.status == ObjectStatus.Active) { if (GameplayHelper.DetectCrash(player.avatar, powerUp.Position)) { if (powerUp.powerUpType == PowerUpType.extralife) { if (player.avatar.lives < 9) { player.avatar.lives++; } powerUp.status = ObjectStatus.Dying; } if (powerUp.powerUpType == PowerUpType.live) { if (player.avatar.lifecounter < 100) { player.avatar.lifecounter += powerUp.Value; if (player.avatar.lifecounter > 100) { player.avatar.lifecounter = 100; } } powerUp.status = ObjectStatus.Dying; } if (powerUp.powerUpType == PowerUpType.machinegun) { player.avatar.ammo[(int)GunType.machinegun] += powerUp.Value; powerUp.status = ObjectStatus.Dying; } if (powerUp.powerUpType == PowerUpType.shotgun) { player.avatar.ammo[(int)GunType.shotgun] += powerUp.Value; powerUp.status = ObjectStatus.Dying; } if (powerUp.powerUpType == PowerUpType.grenade) { player.avatar.ammo[(int)GunType.grenade] += powerUp.Value; powerUp.status = ObjectStatus.Dying; } if (powerUp.powerUpType == PowerUpType.flamethrower) { player.avatar.ammo[(int)GunType.flamethrower] += powerUp.Value; powerUp.status = ObjectStatus.Dying; } if (powerUp.powerUpType == PowerUpType.speedbuff || powerUp.powerUpType == PowerUpType.immunebuff) { //player. += powerup.Value; powerUp.status = ObjectStatus.Dying; } } } } } public int Count() { int enemiesCount = 0; foreach (BaseEnemy enemy in EnemiesList) { if (enemy.status == ObjectStatus.Active) { enemiesCount++; } } return enemiesCount; } public void Clear() { EnemiesList.Clear(); } public void Update(ref GameTime gameTime, MyGame game) { foreach (BaseEnemy enemy in EnemiesList) { enemy.Update(gameTime, game, EnemiesList); } } public void UpdatePowerUps(ref GameTime gameTime, MyGame game) { foreach (PowerUp powerup in PowerUpList) { powerup.Update(gameTime); } } public void Draw(SpriteBatch spriteBatch, float totalGameSeconds, List<Furniture> furnitureList, GameTime gameTime) { foreach (BaseEnemy enemy in EnemiesList) { enemy.Draw(spriteBatch, totalGameSeconds, furnitureList, gameTime); } } public void DrawPowerUps(SpriteBatch spriteBatch, GameTime gameTime) { foreach (PowerUp powerup in PowerUpList) { powerup.Draw(spriteBatch, gameTime); } } private bool PowerUpIsInRange(Vector2 position, int width, int height) { Rectangle ScreenBounds; ScreenBounds = new Rectangle(game.GraphicsDevice.Viewport.X + 60, 60, game.GraphicsDevice.Viewport.Width - 60, game.GraphicsDevice.Viewport.Height - 55); if (ScreenBounds.Intersects(new Rectangle(Convert.ToInt32(position.X), Convert.ToInt32(position.Y), width, height))) { return true; } else { return false; } } private void SpawnPowerUp(BaseEnemy enemy) { bool isPowerUpAdded = false; if (this.random.Next(1, 14) == 8) { isPowerUpAdded = true; PowerUpType powerUpType = (PowerUpType)Enum.ToObject(typeof(PowerUpType), this.random.Next(0, Enum.GetNames(typeof(PowerUpType)).Length - 4)); switch (powerUpType) { case PowerUpType.live: PowerUpList.Add(new PowerUp(livePowerUpTexture, heart, enemy.entity.Position, PowerUpType.live, game.Content)); GameAnalytics.AddDesignEvent("PowerUps:Dropped", (int)PowerUpType.live); break; case PowerUpType.machinegun: PowerUpList.Add(new PowerUp(machinegunAmmoPowerUpTexture, pistolammoUI, enemy.entity.Position, PowerUpType.machinegun, game.Content)); GameAnalytics.AddDesignEvent("PowerUps:Dropped", (int)PowerUpType.machinegun); break; case PowerUpType.flamethrower: PowerUpList.Add(new PowerUp(flamethrowerAmmoPowerUpTexture, flamethrowerammoUI, enemy.entity.Position, PowerUpType.flamethrower, game.Content)); GameAnalytics.AddDesignEvent("PowerUps:Dropped", (int)PowerUpType.flamethrower); break; case PowerUpType.shotgun: PowerUpList.Add(new PowerUp(shotgunAmmoPowerUpTexture, shotgunammoUI, enemy.entity.Position, PowerUpType.shotgun, game.Content)); GameAnalytics.AddDesignEvent("PowerUps:Dropped", (int)PowerUpType.shotgun); break; case PowerUpType.grenade: PowerUpList.Add(new PowerUp(grenadeammoUI, grenadeammoUI, enemy.entity.Position, PowerUpType.grenade, game.Content)); GameAnalytics.AddDesignEvent("PowerUps:Dropped", (int)PowerUpType.grenade); break; case PowerUpType.speedbuff: PowerUpList.Add(new PowerUp(livePowerUpTexture, heart, enemy.entity.Position, PowerUpType.speedbuff, game.Content)); GameAnalytics.AddDesignEvent("PowerUps:Dropped", (int)PowerUpType.speedbuff); break; case PowerUpType.immunebuff: PowerUpList.Add(new PowerUp(immunePowerUpTexture, immunePowerUpTexture, enemy.entity.Position, PowerUpType.immunebuff, game.Content)); GameAnalytics.AddDesignEvent("PowerUps:Dropped", (int)PowerUpType.immunebuff); break; case PowerUpType.extralife: PowerUpList.Add(new PowerUp(extraLivePowerUpTexture, extraLivePowerUpTexture, enemy.entity.Position, PowerUpType.extralife, game.Content)); GameAnalytics.AddDesignEvent("PowerUps:Dropped", (int)PowerUpType.extralife); break; default: PowerUpList.Add(new PowerUp(livePowerUpTexture, heart, enemy.entity.Position, PowerUpType.live, game.Content)); GameAnalytics.AddDesignEvent("PowerUps:Dropped", (int)PowerUpType.live); break; } } if (!isPowerUpAdded) { if (this.random.Next(1, 128) == 12) { GameAnalytics.AddDesignEvent("PowerUps:Dropped", (int)PowerUpType.extralife); PowerUpList.Add(new PowerUp(extraLivePowerUpTexture, extraLivePowerUpTexture, enemy.entity.Position, PowerUpType.extralife, game.Content)); } } } } } <|start_filename|>ZombustersWindows/ContentManager/PowerUp.cs<|end_filename|> using System; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Content; using Microsoft.Xna.Framework.Graphics; namespace ZombustersWindows.Subsystem_Managers { public class PowerUp { private const int EXTRA_LIFE = 1; private const int LIVE_TO_SUM = 30; private const int SHOTGUN_AMMO = 25; private const int MACHINEGUN_AMMO = 50; private const int FLAMETHROWER_AMMO = 25; private const int GRENADES = 5; private const float SPEED_BUFF = 20.0f; private const float IMMUNE_BUFF = 20.0f; private const float TIME_TO_DIE = 1.5f; public Texture2D Texture; public Texture2D UITexture; private SpriteFont font; public Vector2 Position; public int Value; public ObjectStatus status; public PowerUpType powerUpType; public float buffTimer; private float timer; private float dyingtimer; private Color color; public PowerUp(Texture2D texture, Texture2D uitexture, Vector2 position, PowerUpType type, ContentManager content) { this.Texture = texture; this.UITexture = uitexture; this.Position = position; this.status = ObjectStatus.Active; this.color = Color.White; this.powerUpType = type; if (this.powerUpType == PowerUpType.extralife) { Value = EXTRA_LIFE; } if (this.powerUpType == PowerUpType.live) { Value = LIVE_TO_SUM; } if (this.powerUpType == PowerUpType.shotgun) { Value = SHOTGUN_AMMO; } if (this.powerUpType == PowerUpType.machinegun) { Value = MACHINEGUN_AMMO; } if (this.powerUpType == PowerUpType.flamethrower) { Value = FLAMETHROWER_AMMO; } if (this.powerUpType == PowerUpType.grenade) { Value = GRENADES; } if (this.powerUpType == PowerUpType.speedbuff) { // Timer buffTimer = SPEED_BUFF; } if (this.powerUpType == PowerUpType.immunebuff) { // Timer buffTimer = IMMUNE_BUFF; } LoadTextures(ref content); } private void LoadTextures(ref ContentManager content) { font = content.Load<SpriteFont>(@"Menu\ArialMenuInfo"); } public void Update(GameTime gameTime) { if (this.status == ObjectStatus.Active) { timer += (float)gameTime.ElapsedGameTime.TotalSeconds; if (timer >= 20.0f) { this.status = ObjectStatus.Inactive; timer = 0; } } if (this.status == ObjectStatus.Dying) { dyingtimer += (float)gameTime.ElapsedGameTime.TotalSeconds; if (dyingtimer >= TIME_TO_DIE) { this.status = ObjectStatus.Inactive; dyingtimer = 0; } } } public void Draw(SpriteBatch spriteBatch, GameTime gameTime) { String textToShow; Vector2 texturePosition; Vector2 startPosition; spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, null, null, null, Resolution.getTransformationMatrix()); if (this.status == ObjectStatus.Active) { if (timer >= 10.0f) { float interval = 10.0f; // Two second interval float value = (float)Math.Cos(gameTime.TotalGameTime.TotalSeconds * interval); value = (value + 1) / 2; // Shift the sine wave into positive // territory, then back to 0-1 range this.color = new Color(value, value, value, value); } else { this.color = Color.White; } spriteBatch.Draw(this.Texture, this.Position, this.color); } if (this.status == ObjectStatus.Dying) { if (this.powerUpType == PowerUpType.live) { this.color = Color.Red; } if (this.powerUpType == PowerUpType.shotgun) { this.color = Color.LightYellow; } if (this.powerUpType == PowerUpType.machinegun) { this.color = Color.LightYellow; } if (this.powerUpType == PowerUpType.flamethrower) { this.color = Color.LightYellow; } if (this.powerUpType == PowerUpType.grenade) { this.color = Color.LightYellow; } if (this.powerUpType == PowerUpType.speedbuff) { this.color = new Color(95, 172, 226, 255); } if (this.powerUpType == PowerUpType.immunebuff) { this.color = Color.BlueViolet; } if (this.powerUpType == PowerUpType.immunebuff || this.powerUpType == PowerUpType.speedbuff) { textToShow = "+ " + Convert.ToInt32(this.buffTimer).ToString() + "s"; } else { textToShow = "+ " + this.Value.ToString(); } startPosition = new Vector2(this.Position.X - (font.MeasureString(textToShow).X / 2), this.Position.Y); texturePosition = new Vector2(startPosition.X + font.MeasureString(textToShow).X + 2, startPosition.Y); spriteBatch.DrawString(font, textToShow, new Vector2(startPosition.X + 1, startPosition.Y + 1), Color.Black); spriteBatch.DrawString(font, textToShow, startPosition, color); spriteBatch.Draw(this.UITexture, texturePosition, Color.White); } spriteBatch.End(); } } } <|start_filename|>ZombustersWindows/GameObjects/Enemies/Rat.cs<|end_filename|> using System; using System.Collections.Generic; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Content; using Microsoft.Xna.Framework.Graphics; using System.Globalization; using ZombustersWindows.Subsystem_Managers; using ZombustersWindows.GameObjects; using System.Xml.Linq; namespace ZombustersWindows { public class Rat : BaseEnemy { private const int RAT_X_OFFSET = 20; private const int RAT_Y_OFFSET = 48; public float MAX_VELOCITY = 1.5f; public const float MAX_STRENGTH = 0.15f; private Texture2D attackTexture; private Texture2D deathTexture; private Texture2D hitTexture; private Texture2D idleTexture; private Texture2D runTexture; private Texture2D shadowTexture; Animation attackAnimation; Animation deathAnimation; Animation hitAnimation; Animation idleAnimation; Animation runAnimation; public Rat(Vector2 posicion, float boundingRadius, float life, float speed, ref Random gameRandom) { this.entity = new SteeringEntity { Velocity = new Vector2(0, 0), Position = posicion, BoundingRadius = boundingRadius }; this.random = gameRandom; this.entity.MaxSpeed = MAX_VELOCITY + speed; this.status = ObjectStatus.Active; this.invert = true; this.deathTimeTotalSeconds = 0; this.TimeOnScreen = 4.5f; this.speed = speed; this.angle = 1f; this.playerChased = 0; this.lifecounter = life; this.isLoosingLife = false; this.entityYOffset = RAT_Y_OFFSET; behaviors = new SteeringBehaviors(MAX_STRENGTH, CombinationType.prioritized); } override public void LoadContent(ContentManager content) { base.LoadContent(content); LoadTextures(ref content); LoadAnimations(); } private void LoadTextures(ref ContentManager content) { attackTexture = content.Load<Texture2D>(@"InGame/rat/48x48Rat_Attack"); deathTexture = content.Load<Texture2D>(@"InGame/rat/48x48Rat_Death"); hitTexture = content.Load<Texture2D>(@"InGame/rat/48x48Rat_Hit"); idleTexture = content.Load<Texture2D>(@"InGame/rat/48x48Rat_Idle"); runTexture = content.Load<Texture2D>(@"InGame/rat/48x48Rat_Run"); shadowTexture = content.Load<Texture2D>(@"InGame/character_shadow"); } private void LoadAnimations() { XElement definition; TimeSpan frameInterval; Point frameSize = new Point(); Point sheetSize = new Point(); XDocument doc = XDocument.Load(AppContext.BaseDirectory + "/Content/InGame/rat/RatAnimationDef.xml"); definition = doc.Root.Element("RatAttackDef"); frameSize.X = int.Parse(definition.Attribute("FrameWidth").Value, NumberStyles.Integer); frameSize.Y = int.Parse(definition.Attribute("FrameHeight").Value, NumberStyles.Integer); sheetSize.X = int.Parse(definition.Attribute("SheetColumns").Value, NumberStyles.Integer); sheetSize.Y = int.Parse(definition.Attribute("SheetRows").Value, NumberStyles.Integer); frameInterval = TimeSpan.FromSeconds(1.0f / int.Parse(definition.Attribute("Speed").Value, NumberStyles.Integer)); attackAnimation = new Animation(attackTexture, frameSize, sheetSize, frameInterval); definition = doc.Root.Element("RatDeathDef"); frameSize.X = int.Parse(definition.Attribute("FrameWidth").Value, NumberStyles.Integer); frameSize.Y = int.Parse(definition.Attribute("FrameHeight").Value, NumberStyles.Integer); sheetSize.X = int.Parse(definition.Attribute("SheetColumns").Value, NumberStyles.Integer); sheetSize.Y = int.Parse(definition.Attribute("SheetRows").Value, NumberStyles.Integer); frameInterval = TimeSpan.FromSeconds(1.0f / int.Parse(definition.Attribute("Speed").Value, NumberStyles.Integer)); deathAnimation = new Animation(deathTexture, frameSize, sheetSize, frameInterval); definition = doc.Root.Element("RatHitDef"); frameSize.X = int.Parse(definition.Attribute("FrameWidth").Value, NumberStyles.Integer); frameSize.Y = int.Parse(definition.Attribute("FrameHeight").Value, NumberStyles.Integer); sheetSize.X = int.Parse(definition.Attribute("SheetColumns").Value, NumberStyles.Integer); sheetSize.Y = int.Parse(definition.Attribute("SheetRows").Value, NumberStyles.Integer); frameInterval = TimeSpan.FromSeconds(1.0f / int.Parse(definition.Attribute("Speed").Value, NumberStyles.Integer)); hitAnimation = new Animation(hitTexture, frameSize, sheetSize, frameInterval); definition = doc.Root.Element("RatIdleDef"); frameSize.X = int.Parse(definition.Attribute("FrameWidth").Value, NumberStyles.Integer); frameSize.Y = int.Parse(definition.Attribute("FrameHeight").Value, NumberStyles.Integer); sheetSize.X = int.Parse(definition.Attribute("SheetColumns").Value, NumberStyles.Integer); sheetSize.Y = int.Parse(definition.Attribute("SheetRows").Value, NumberStyles.Integer); frameInterval = TimeSpan.FromSeconds(1.0f / int.Parse(definition.Attribute("Speed").Value, NumberStyles.Integer)); idleAnimation = new Animation(idleTexture, frameSize, sheetSize, frameInterval); definition = doc.Root.Element("RatRunDef"); frameSize.X = int.Parse(definition.Attribute("FrameWidth").Value, NumberStyles.Integer); frameSize.Y = int.Parse(definition.Attribute("FrameHeight").Value, NumberStyles.Integer); sheetSize.X = int.Parse(definition.Attribute("SheetColumns").Value, NumberStyles.Integer); sheetSize.Y = int.Parse(definition.Attribute("SheetRows").Value, NumberStyles.Integer); frameInterval = TimeSpan.FromSeconds(1.0f / int.Parse(definition.Attribute("Speed").Value, NumberStyles.Integer)); runAnimation = new Animation(runTexture, frameSize, sheetSize, frameInterval); } override public void Update(GameTime gameTime, MyGame game, List<BaseEnemy> EnemyList) { if (this.status != ObjectStatus.Dying) { runAnimation.Update(gameTime); this.behaviors.Pursuit.Target = game.players[this.playerChased].avatar.position; this.behaviors.Pursuit.UpdateEvaderEntity(game.players[this.playerChased].avatar.entity); this.entity.Velocity += this.behaviors.Update(gameTime, this.entity); this.entity.Velocity = VectorHelper.TruncateVector(this.entity.Velocity, this.entity.MaxSpeed / 1.5f); this.entity.Position += this.entity.Velocity; foreach (BaseEnemy enemy in EnemyList) { if (entity.Position != enemy.entity.Position && enemy.status == ObjectStatus.Active) { Vector2 ToEntity = entity.Position - enemy.entity.Position; float DistFromEachOther = ToEntity.Length(); float AmountOfOverLap = entity.BoundingRadius + 20.0f - DistFromEachOther; if (AmountOfOverLap >= 0) { entity.Position = (entity.Position + (ToEntity / DistFromEachOther) * AmountOfOverLap); } } } if (IsInRange(game.players)) { isInPlayerRange = true; attackAnimation.Update(gameTime); } else { isInPlayerRange = false; } } else { deathAnimation.Update(gameTime); } } override public void Draw(SpriteBatch batch, float TotalGameSeconds, List<Furniture> furniturelist, GameTime gameTime) { Color color; float layerIndex = GetLayerIndex(this.entity, furniturelist); if (this.status == ObjectStatus.Active) { if (this.isLoosingLife == true) { color = Color.Red; } else { color = Color.White; } if (entity.Velocity.X == 0 && entity.Velocity.Y == 0) { idleAnimation.Draw(batch, new Vector2(this.entity.Position.X, this.entity.Position.Y - RAT_Y_OFFSET), SpriteEffects.None, layerIndex, 0f, color); } else { if (isInPlayerRange) { if (entity.Velocity.X > 0) { attackAnimation.Draw(batch, new Vector2(this.entity.Position.X - RAT_X_OFFSET, this.entity.Position.Y - RAT_Y_OFFSET), SpriteEffects.None, layerIndex, 0f, color); } else { attackAnimation.Draw(batch, new Vector2(this.entity.Position.X, this.entity.Position.Y - RAT_Y_OFFSET), SpriteEffects.FlipHorizontally, layerIndex, 0f, color); } } else { if (entity.Velocity.X > 0) { runAnimation.Draw(batch, new Vector2(this.entity.Position.X - RAT_X_OFFSET, this.entity.Position.Y - RAT_Y_OFFSET), SpriteEffects.None, layerIndex, 0f, color); } else { runAnimation.Draw(batch, new Vector2(this.entity.Position.X, this.entity.Position.Y - RAT_Y_OFFSET), SpriteEffects.FlipHorizontally, layerIndex, 0f, color); } } } batch.Draw(this.shadowTexture, new Vector2(this.entity.Position.X - 10, this.entity.Position.Y - 56 + this.idleTexture.Height), null, new Color(255, 255, 255, 50), 0.0f, new Vector2(0, 0), 1.0f, SpriteEffects.None, layerIndex + 0.01f); this.isLoosingLife = false; } else if (this.status == ObjectStatus.Dying) { if (this.currentgun != GunType.flamethrower) { timer += (float)gameTime.ElapsedGameTime.TotalSeconds; if (timer <= 1.2f) { if (this.entity.Velocity.X > 0) { deathAnimation.Draw(batch, new Vector2(this.entity.Position.X - RAT_X_OFFSET, this.entity.Position.Y - RAT_Y_OFFSET), SpriteEffects.None, layerIndex, 0f, Color.White); } else { deathAnimation.Draw(batch, new Vector2(this.entity.Position.X, this.entity.Position.Y - RAT_Y_OFFSET), SpriteEffects.FlipHorizontally, layerIndex, 0f, Color.White); } batch.Draw(this.shadowTexture, new Vector2(this.entity.Position.X - 10, this.entity.Position.Y - 56 + this.idleTexture.Height), null, new Color(255, 255, 255, 50), 0.0f, new Vector2(0, 0), 1.0f, SpriteEffects.None, layerIndex + 0.01f); } } else { timer += (float)gameTime.ElapsedGameTime.TotalSeconds; if (timer <= 1.4f) { if (this.entity.Velocity.X > 0) { deathAnimation.Draw(batch, new Vector2(this.entity.Position.X - RAT_X_OFFSET, this.entity.Position.Y - RAT_Y_OFFSET), SpriteEffects.None, layerIndex, 0f, Color.White); } else { deathAnimation.Draw(batch, new Vector2(this.entity.Position.X, this.entity.Position.Y - RAT_Y_OFFSET), SpriteEffects.FlipHorizontally, layerIndex, 0f, Color.White); } batch.Draw(this.shadowTexture, new Vector2(this.entity.Position.X - 10, this.entity.Position.Y - 56 + this.idleTexture.Height), null, new Color(255, 255, 255, 50), 0.0f, new Vector2(0, 0), 1.0f, SpriteEffects.None, layerIndex + 0.01f); } } int score = 10; if ((TotalGameSeconds < this.deathTimeTotalSeconds + .5) && (this.deathTimeTotalSeconds < TotalGameSeconds)) { batch.DrawString(font, score.ToString(), new Vector2(this.entity.Position.X - font.MeasureString(score.ToString()).X / 2 + 1, this.entity.Position.Y - RAT_Y_OFFSET - 1), Color.Black, 0.0f, Vector2.Zero, 1.0f, SpriteEffects.None, layerIndex); batch.DrawString(font, score.ToString(), new Vector2(this.entity.Position.X - font.MeasureString(score.ToString()).X / 2, this.entity.Position.Y - RAT_Y_OFFSET), Color.White, 0.0f, Vector2.Zero, 1.0f, SpriteEffects.None, layerIndex - 0.1f); } } base.Draw(batch, TotalGameSeconds, furniturelist, gameTime); } } } <|start_filename|>ZombustersWindows/SubsystemManagers/GamerManager.cs<|end_filename|> //using System; //using System.Globalization; //using System.Collections.Generic; //using Microsoft.Xna.Framework; //using Microsoft.Xna.Framework.Audio; //using Microsoft.Xna.Framework.Content; // //using Microsoft.Xna.Framework.Graphics; //using Microsoft.Xna.Framework.Input; //#if !WINDOWS_PHONE //using Microsoft.Xna.Framework.Storage; //#endif //using GameStateManagement; //using System.Xml.Serialization; //using System.Xml; //using System.IO; //namespace ZombustersWindows.Subsystem_Managers //{ // public class GamerManager : DrawableGameComponent // { // Game game; // public List<Texture2D> colorBlock; // public List<Texture2D> colorBlockBig; // public Texture2D grayBlock; // public Texture2D grayBlockShort; // public Texture2D myGroupBKG; // public Texture2D squareFilled; // public Texture2D squareEmpty; // public Texture2D notLoggedInGamerPic; // public Texture2D lineaLobbyPlayers; // public Texture2D connectedIcon; // public Texture2D hostIcon; // List<Texture2D> PlayerIcons, ControllerIdImg; // List<String> PlayerGamertag; // List<Boolean> PlayerSignedIn; // List<Texture2D> OnlinePlayerIcons; // List<String> OnlinePlayerGamertag; // List<Boolean> OnlinePlayerSignedIn, isLocalGamer; // int playersCount; // int playersCountOnline; // Boolean changedFlag; // Boolean changedFlagOnline; // SpriteFont germanFont; // public GamerManager(Game game) // : base(game) // { // this.game = game; // this.Visible = false; // } // public override void Initialize() // { // // Check to see if we have an account that it's signed into LIVE // PlayerIcons = new List<Texture2D>(); // ControllerIdImg = new List<Texture2D>(); // PlayerGamertag = new List<string>(); // PlayerSignedIn = new List<Boolean>(); // colorBlock = new List<Texture2D>(); // colorBlockBig = new List<Texture2D>(); // OnlinePlayerIcons = new List<Texture2D>(); // OnlinePlayerGamertag = new List<string>(); // OnlinePlayerSignedIn = new List<Boolean>(); // isLocalGamer = new List<Boolean>(); // playersCount = 0; // playersCountOnline = 0; // changedFlag = true; // changedFlagOnline = true; // } // public void Load() // { // int i; // //Color Block // //colorBlock = game.Content.Load<Texture2D>(@"Menu/colorBlock"); // colorBlock.Add(game.Content.Load<Texture2D>(@"Menu/colorBlockBlue")); // colorBlock.Add(game.Content.Load<Texture2D>(@"Menu/colorBlockRed")); // colorBlock.Add(game.Content.Load<Texture2D>(@"Menu/colorBlockGreen")); // colorBlock.Add(game.Content.Load<Texture2D>(@"Menu/colorBlockYellow")); // //Color Block Big // colorBlockBig.Add(game.Content.Load<Texture2D>(@"Menu/colorBlockBigBlue")); // colorBlockBig.Add(game.Content.Load<Texture2D>(@"Menu/colorBlockBigRed")); // colorBlockBig.Add(game.Content.Load<Texture2D>(@"Menu/colorBlockBigGreen")); // colorBlockBig.Add(game.Content.Load<Texture2D>(@"Menu/colorBlockBigYellow")); // //Gray Block // grayBlock = game.Content.Load<Texture2D>(@"Menu/grayBlock"); // //Gray Block Short // grayBlockShort = game.Content.Load<Texture2D>(@"Menu/grayBlockShort"); // //Fondo negro fade menu // myGroupBKG = game.Content.Load<Texture2D>(@"Menu/mygroup_bkg"); // //Square Filled // squareFilled = game.Content.Load<Texture2D>(@"Menu/square_filled"); // //Square Empty // squareEmpty = game.Content.Load<Texture2D>(@"Menu/square_empty"); // //Not Logged In Gamer Picture // notLoggedInGamerPic = game.Content.Load<Texture2D>(@"Menu/notLoggedInGamerPicture"); // //Linea blanca lobby player // lineaLobbyPlayers = game.Content.Load<Texture2D>(@"Menu/linea_lobby_players_selected"); // //Player Connected Icon // connectedIcon = game.Content.Load<Texture2D>(@"Menu/connected_icon"); // // Host Icon // hostIcon = game.Content.Load<Texture2D>(@"InGame/immune_ammo_powerup"); // for (i = 0; i < 4; i++) // { // ControllerIdImg.Add(game.Content.Load<Texture2D>(@"Menu\controllerInd_menu_P" + (i + 1))); // } // germanFont = game.Content.Load<SpriteFont>(@"Menu/ArialMusicItalic"); // } // public Boolean GamerListHasChanged() // { // if (playersCount != Gamer.SignedInGamers.Count) // { // changedFlag = true; // playersCount = Gamer.SignedInGamers.Count; // } // return changedFlag; // } //#if !WINDOWS_PHONE && !WINDOWS // public Boolean GamerOnlineListHasChanged(Boolean isInLobby, NetworkSession session) // { // if ((isInLobby == true) && (session != null)) // { // if (playersCountOnline != session.AllGamers.Count) // { // changedFlagOnline = true; // playersCountOnline = session.AllGamers.Count; // } // } // return changedFlagOnline; // } //#endif // public List<Texture2D> getLocalPlayerIcons() // { // return this.PlayerIcons; // } // public List<Texture2D> getOnlinePlayerIcons() // { // return this.OnlinePlayerIcons; // } // public List<Texture2D> getControllerIdImg() // { // return this.ControllerIdImg; // } // public List<String> getLocalPlayerGamertag() // { // return this.PlayerGamertag; // } // public List<String> getOnlinePlayerGamertag() // { // return this.OnlinePlayerGamertag; // } // public List<Boolean> getPlayerSignedIn() // { // return this.PlayerSignedIn; // } // public List<Boolean> getIfIsLocalGamer() // { // return this.isLocalGamer; // } //#if !WINDOWS_PHONE // public void LoadGamerPicture(NetworkGamer gamer) // { // gamer.BeginGetProfile( // delegate(IAsyncResult result) // { // try // { // Gamer clone = result.AsyncState as Gamer; // if (clone != null) // { // GamerProfile profile = clone.EndGetProfile(result); // // Update picture // } // } // catch (GamerPrivilegeException) // { // // Could not access profile, don't update picture // } // }, // gamer // ); // } // public void UpdateOnline(Boolean isInLobby, NetworkSession session) // { // List<String> supportGamertagList = new List<String>(); // GamerProfile profile; // Stream stream; // OnlinePlayerIcons.Clear(); // OnlinePlayerGamertag.Clear(); // OnlinePlayerSignedIn.Clear(); // isLocalGamer.Clear(); // if (isInLobby == true) // { // if (session.AllGamers.Count > 0) // { // foreach (SignedInGamer player in Gamer.SignedInGamers) // { // if (player.IsSignedInToLive) // { // supportGamertagList.Add(player.Gamertag); // } // } ///* // foreach (SignedInGamer player in Gamer.SignedInGamers) // { // //if (player.IsSignedInToLive) // //{ // //supportGamertagList.Add(player.Gamertag); // //} // if (player.IsSignedInToLive) // { // player.BeginGetProfile( // delegate(IAsyncResult result) // { // profile = (result.AsyncState as Gamer).EndGetProfile(result); // stream = profile.GetGamerPicture(); // OnlinePlayerIcons.Add(Texture2D.FromStream(((Game1)this.Game).GraphicsDevice, stream)); //Add Picture of the player to the list. // OnlinePlayerGamertag.Add((result.AsyncState as Gamer).Gamertag); //Add Gamertag to the list. // OnlinePlayerSignedIn.Add(true); // isLocalGamer.Add(true); // }, // player); // } // else // { // OnlinePlayerIcons.Add(game.Content.Load<Texture2D>(@"Menu\notLoggedInGamerPicture")); //Add Picture of the player to the list. // OnlinePlayerGamertag.Add(player.Gamertag); //Add Gamertag to the list. // OnlinePlayerSignedIn.Add(true); // isLocalGamer.Add(true); // } // } // foreach (NetworkGamer networkGamer in session.AllGamers) // { // if (!networkGamer.IsLocal) // { // networkGamer.BeginGetProfile( // delegate(IAsyncResult result) // { // profile = (result.AsyncState as Gamer).EndGetProfile(result); // stream = profile.GetGamerPicture(); // OnlinePlayerIcons.Add(Texture2D.FromStream(((Game1)this.Game).GraphicsDevice, stream)); //Add Picture of the player to the list. // OnlinePlayerGamertag.Add((result.AsyncState as Gamer).Gamertag); //Add Gamertag to the list. // OnlinePlayerSignedIn.Add(true); // isLocalGamer.Add(false); // }, // networkGamer); // } // } //*/ // foreach (NetworkGamer networkGamer in session.AllGamers) // { // if (supportGamertagList.Contains(networkGamer.Gamertag)) // { // networkGamer.BeginGetProfile( // delegate(IAsyncResult result) // { // profile = (result.AsyncState as Gamer).EndGetProfile(result); // stream = profile.GetGamerPicture(); // OnlinePlayerIcons.Add(Texture2D.FromStream(((Game1)this.Game).GraphicsDevice, stream)); //Add Picture of the player to the list. // OnlinePlayerGamertag.Add((result.AsyncState as Gamer).Gamertag); //Add Gamertag to the list. // OnlinePlayerSignedIn.Add(true); // if (supportGamertagList.Contains((result.AsyncState as Gamer).Gamertag)) // { // isLocalGamer.Add(true); // } // else // { // isLocalGamer.Add(false); // } // }, // networkGamer); // //REVISAR!!!! // //OnlinePlayerIcons.Add(networkGamer.GetProfile().GamerPicture); //Add Picture of the player to the list. // } // else // { // OnlinePlayerIcons.Add(game.Content.Load<Texture2D>(@"Menu\notLoggedInGamerPicture")); //Add Picture of the player to the list. // OnlinePlayerGamertag.Add(networkGamer.Gamertag); //Add Gamertag to the list. // OnlinePlayerSignedIn.Add(true); // if (networkGamer.IsLocal) // { // isLocalGamer.Add(true); // } // else // { // isLocalGamer.Add(false); // } // } // } // } // } // changedFlagOnline = false; // } //#endif // public void Update() // { // int i; // GamerProfile profile; // Stream stream; // PlayerIcons.Clear(); // PlayerGamertag.Clear(); // PlayerSignedIn.Clear(); // //BUSCAR SOLUCION AL PROBLEMA DE LOS PERFILES QUE NO SON ONLINE, GAMERPICTURE!!! // if (Gamer.SignedInGamers.Count > 0) // { // foreach (SignedInGamer signedInGamer in Gamer.SignedInGamers) // { // if (signedInGamer.IsSignedInToLive) // { // try // { // signedInGamer.BeginGetProfile( // delegate(IAsyncResult result) // { // profile = (result.AsyncState as Gamer).EndGetProfile(result); // stream = profile.GetGamerPicture(); // PlayerIcons.Add(Texture2D.FromStream(((Game1)this.Game).GraphicsDevice, stream)); //Add Picture of the player to the list. // PlayerGamertag.Add((result.AsyncState as Gamer).Gamertag); //Add Gamertag to the list. // PlayerSignedIn.Add(true); // }, // signedInGamer); // //REVISAR!!! // //PlayerIcons.Add(signedInGamer.GetProfile().GamerPicture); //Add Picture of the player to the list. // } // catch // { // PlayerIcons.Add(game.Content.Load<Texture2D>(@"Menu\notLoggedInGamerPicture")); //Add Picture of the player to the list. // PlayerGamertag.Add(signedInGamer.Gamertag); //Add Gamertag to the list. // PlayerSignedIn.Add(true); // } // } // else // { // PlayerIcons.Add(game.Content.Load<Texture2D>(@"Menu\notLoggedInGamerPicture")); //Add Picture of the player to the list. // PlayerGamertag.Add(signedInGamer.Gamertag); //Add Gamertag to the list. // PlayerSignedIn.Add(true); // } // } // } // for (i = 1; i <= (4 - Gamer.SignedInGamers.Count); i++) // { // if ((i + Gamer.SignedInGamers.Count) == 1) // { // if (GamePad.GetState(PlayerIndex.One).IsConnected) // { // PlayerIcons.Add(game.Content.Load<Texture2D>(@"Menu\notLoggedInGamerPicture")); //Add Picture of the player to the list. // PlayerGamertag.Add("P1 " + Strings.PlayerSignInString); //Add Gamertag to the list. // PlayerSignedIn.Add(false); // } // } // if ((i + Gamer.SignedInGamers.Count) == 2) // { // if (GamePad.GetState(PlayerIndex.Two).IsConnected) // { // PlayerIcons.Add(game.Content.Load<Texture2D>(@"Menu\notLoggedInGamerPicture")); //Add Picture of the player to the list. // PlayerGamertag.Add("P2 " + Strings.PlayerSignInString); //Add Gamertag to the list. // PlayerSignedIn.Add(false); // } // } // if ((i + Gamer.SignedInGamers.Count) == 3) // { // if (GamePad.GetState(PlayerIndex.Three).IsConnected) // { // PlayerIcons.Add(game.Content.Load<Texture2D>(@"Menu\notLoggedInGamerPicture")); //Add Picture of the player to the list. // PlayerGamertag.Add("P3 " + Strings.PlayerSignInString); //Add Gamertag to the list. // PlayerSignedIn.Add(false); // } // } // if ((i + Gamer.SignedInGamers.Count) == 4) // { // if (GamePad.GetState(PlayerIndex.Four).IsConnected) // { // PlayerIcons.Add(game.Content.Load<Texture2D>(@"Menu\notLoggedInGamerPicture")); //Add Picture of the player to the list. // PlayerGamertag.Add("P4 " + Strings.PlayerSignInString); //Add Gamertag to the list. // PlayerSignedIn.Add(false); // } // } // } // changedFlag = false; // //game.PresenceMode = GamerPresenceMode.AtMenu; // } // public void Draw(MenuComponent menu, Vector2 pos, SpriteBatch batch, SpriteFont font, Boolean isMatchmaking //#if !WINDOWS_PHONE // , NetworkSession session //#endif // ) // { // int playersToJoin = 0; // int i = 0; // Vector2 playersToJoinPosition = new Vector2(pos.X - 31, pos.Y); // Vector2 myGroupPosition = new Vector2(pos.X - 60, pos.Y - 40); // Vector2 iconPosition = new Vector2(pos.X, pos.Y); // Vector2 textPosition = new Vector2(pos.X + 5, pos.Y + 5); //uiBounds.Height - 100); // Vector2 controllerPosition = new Vector2(pos.X + 250, pos.Y + 5); // batch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, null, null, null, Resolution.getTransformationMatrix()); // batch.Draw(myGroupBKG, myGroupPosition, Color.White); // batch.DrawString(font, Strings.MyGroupString, new Vector2(myGroupPosition.X + 7, myGroupPosition.Y + 6), Color.White); //#if !WINDOWS_PHONE // if (isMatchmaking && session != null) // { // if (session.IsHost) // { // for (i = 0; i < Gamer.SignedInGamers.Count; i++) // { // for (int j = 0; j < OnlinePlayerGamertag.Count; j++) // { // if (OnlinePlayerGamertag[j] == Gamer.SignedInGamers[i].Gamertag) // { // batch.Draw(OnlinePlayerIcons[j], new Rectangle(Convert.ToInt32(pos.X) - 31, Convert.ToInt32(pos.Y) + (33 * i), 30, 30), Color.White); // if (OnlinePlayerSignedIn[j] == true) // { // //ColorBlock // batch.Draw(colorBlock[i], new Vector2(iconPosition.X, iconPosition.Y + (33 * i)), Color.White); // } // else //Not Logged In but with Controller activated // { // //Gray Block Short // batch.Draw(grayBlockShort, new Vector2(iconPosition.X, iconPosition.Y + (33 * i)), Color.White); // } // //Controller // if (i == 0) // { // batch.Draw(hostIcon, new Vector2(controllerPosition.X + 2, controllerPosition.Y + 2 + (33 * i)), Color.White); // } // else // { // batch.Draw(ControllerIdImg[i], new Vector2(controllerPosition.X, controllerPosition.Y + (33 * i)), Color.White); // } // //Gamertag Text // batch.DrawString(font, OnlinePlayerGamertag[j], new Vector2(textPosition.X, textPosition.Y + (33 * i)), Color.White); // //Players to Join // playersToJoinPosition.Y = playersToJoinPosition.Y + 33; // } // } // } // for (i = 0; i < session.AllGamers.Count; i++) // { // if (!session.AllGamers[i].IsLocal) // { // for (int j = 0; j < OnlinePlayerGamertag.Count; j++) // { // if (OnlinePlayerGamertag[j] == session.AllGamers[i].Gamertag) // { // batch.Draw(OnlinePlayerIcons[j], new Rectangle(Convert.ToInt32(pos.X) - 31, Convert.ToInt32(pos.Y) + (33 * i), 30, 30), Color.White); // if (OnlinePlayerSignedIn[j] == true) // { // //ColorBlock // batch.Draw(colorBlock[i], new Vector2(iconPosition.X, iconPosition.Y + (33 * i)), Color.White); // } // else //Not Logged In but with Controller activated // { // //Gray Block Short // batch.Draw(grayBlockShort, new Vector2(iconPosition.X, iconPosition.Y + (33 * i)), Color.White); // } // //Controller // if (i == 0) // { // batch.Draw(hostIcon, new Vector2(controllerPosition.X + 2, controllerPosition.Y + 2 + (33 * i)), Color.White); // } // else // { // batch.Draw(connectedIcon, new Vector2(controllerPosition.X, controllerPosition.Y + (33 * i)), Color.White); // } // //Gamertag Text // batch.DrawString(font, OnlinePlayerGamertag[j], new Vector2(textPosition.X, textPosition.Y + (33 * i)), Color.White); // //Players to Join // playersToJoinPosition.Y = playersToJoinPosition.Y + 33; // } // } // } // } // } // else // { // for (i = 0; i < session.AllGamers.Count; i++) // { // if (!session.AllGamers[i].IsLocal) // { // for (int j = 0; j < OnlinePlayerGamertag.Count; j++) // { // if (OnlinePlayerGamertag[j] == session.AllGamers[i].Gamertag) // { // batch.Draw(OnlinePlayerIcons[j], new Rectangle(Convert.ToInt32(pos.X) - 31, Convert.ToInt32(pos.Y) + (33 * i), 30, 30), Color.White); // if (OnlinePlayerSignedIn[j] == true) // { // //ColorBlock // batch.Draw(colorBlock[i], new Vector2(iconPosition.X, iconPosition.Y + (33 * i)), Color.White); // } // else //Not Logged In but with Controller activated // { // //Gray Block Short // batch.Draw(grayBlockShort, new Vector2(iconPosition.X, iconPosition.Y + (33 * i)), Color.White); // } // //Controller // if (i == 0) // { // batch.Draw(hostIcon, new Vector2(controllerPosition.X + 2, controllerPosition.Y + 2 + (33 * i)), Color.White); // } // else // { // batch.Draw(connectedIcon, new Vector2(controllerPosition.X, controllerPosition.Y + (33 * i)), Color.White); // } // //Gamertag Text // batch.DrawString(font, OnlinePlayerGamertag[j], new Vector2(textPosition.X, textPosition.Y + (33 * i)), Color.White); // //Players to Join // playersToJoinPosition.Y = playersToJoinPosition.Y + 33; // } // } // } // } // for (i = 0; i < Gamer.SignedInGamers.Count; i++) // { // for (int j = 0; j < PlayerGamertag.Count; j++) // { // if (PlayerGamertag[j] == Gamer.SignedInGamers[i].Gamertag) // { // batch.Draw(PlayerIcons[j], new Rectangle(Convert.ToInt32(pos.X) - 31, Convert.ToInt32(pos.Y) + (33 * (i + session.RemoteGamers.Count)), 30, 30), Color.White); // if (PlayerSignedIn[j] == true) // { // //ColorBlock // batch.Draw(colorBlock[i + session.RemoteGamers.Count], new Vector2(iconPosition.X, iconPosition.Y + (33 * (i + session.RemoteGamers.Count))), Color.White); // } // else //Not Logged In but with Controller activated // { // //Gray Block Short // batch.Draw(grayBlockShort, new Vector2(iconPosition.X, iconPosition.Y + (33 * (i + session.RemoteGamers.Count))), Color.White); // } // // Controller // batch.Draw(ControllerIdImg[i], new Vector2(controllerPosition.X, controllerPosition.Y + (33 * (i + session.RemoteGamers.Count))), Color.White); // //Gamertag Text // batch.DrawString(font, PlayerGamertag[j], new Vector2(textPosition.X, textPosition.Y + (33 * (i + session.RemoteGamers.Count))), Color.White); // //Players to Join // playersToJoinPosition.Y = playersToJoinPosition.Y + 33; // } // } // } // } ///* // for ( i=0; i<OnlinePlayerIcons.Count; i++ ) // { // batch.Draw(OnlinePlayerIcons[i], new Rectangle(Convert.ToInt32(pos.X) - 31, Convert.ToInt32(pos.Y) + (33 * i), 30, 30), Color.White); // if (OnlinePlayerSignedIn[i] == true) // { // //ColorBlock // batch.Draw(colorBlock, new Vector2(iconPosition.X, iconPosition.Y + (33 * i)), Color.White); // } // else //Not Logged In but with Controller activated // { // //Gray Block Short // batch.Draw(grayBlockShort, new Vector2(iconPosition.X, iconPosition.Y + (33 * i)), Color.White); // } // //Controller // if (i == 0) // { // batch.Draw(hostIcon, new Vector2(controllerPosition.X, controllerPosition.Y + (33 * i)), Color.White); // } // else // { // if (getIfIsLocalGamer()[i] == true) // { // batch.Draw(ControllerIdImg[i], new Vector2(controllerPosition.X, controllerPosition.Y + (33 * i)), Color.White); // } // else // { // batch.Draw(connectedIcon, new Vector2(controllerPosition.X, controllerPosition.Y + (33 * i)), Color.White); // } // } // //Gamertag Text // batch.DrawString(font, OnlinePlayerGamertag[i], new Vector2(textPosition.X, textPosition.Y + (33 * i)), Color.White); // //Players to Join // playersToJoinPosition.Y = playersToJoinPosition.Y + 33; // } // */ // //Not Logged In but with Controller activated // if (PlayerIcons.Count != Gamer.SignedInGamers.Count) // { // for (i = 0; i < PlayerIcons.Count - Gamer.SignedInGamers.Count; i++) // { // batch.Draw(notLoggedInGamerPic, new Rectangle(Convert.ToInt32(pos.X) - 31, Convert.ToInt32(pos.Y) + (33 * (i + Gamer.SignedInGamers.Count)), 30, 30), Color.White); // //Gray Block Short // batch.Draw(grayBlockShort, new Vector2(iconPosition.X, iconPosition.Y + (33 * (i + Gamer.SignedInGamers.Count))), Color.White); // // Controller // batch.Draw(ControllerIdImg[(i + Gamer.SignedInGamers.Count)], new Vector2(controllerPosition.X, controllerPosition.Y + (33 * (i + Gamer.SignedInGamers.Count))), Color.White); // //Gamertag Text // batch.DrawString(font, Strings.PlayerSignInString, new Vector2(textPosition.X, textPosition.Y + (33 * (i + Gamer.SignedInGamers.Count))), Color.White); // //Players to Join // playersToJoinPosition.Y = playersToJoinPosition.Y + 33; // } // } // playersToJoin = 4 - PlayerIcons.Count; // if (playersToJoin != 0) // { // for (i = 0; i < playersToJoin; i++) // { // //Gray Block // batch.Draw(grayBlock, new Vector2(playersToJoinPosition.X, playersToJoinPosition.Y + (33 * i)), new Color(255, 255, 255, (byte)MathHelper.Clamp(60, 0, 255))); // //Gray Block // batch.Draw(squareEmpty, new Vector2(playersToJoinPosition.X + 5, playersToJoinPosition.Y + (33 * i) + 5), new Color(255, 255, 255, (byte)MathHelper.Clamp(80, 0, 255))); // //Gamertag Text // batch.DrawString(font, Strings.ConnectControllerToJoinString, new Vector2(playersToJoinPosition.X + 36, playersToJoinPosition.Y + 5 + (33 * i)), new Color(255, 255, 255, (byte)MathHelper.Clamp(80, 0, 255))); // //(i+1+count).ToString() + "P " + // } // } // } // else //#endif // { // for (i = 0; i < Gamer.SignedInGamers.Count; i++) // { // for (int j = 0; j < PlayerGamertag.Count; j++) // { // if (PlayerGamertag[j] == Gamer.SignedInGamers[i].Gamertag) // { // batch.Draw(PlayerIcons[j], new Rectangle(Convert.ToInt32(pos.X) - 31, Convert.ToInt32(pos.Y) + (33 * i), 30, 30), Color.White); // if (PlayerSignedIn[j] == true) // { // //ColorBlock // batch.Draw(colorBlock[i], new Vector2(iconPosition.X, iconPosition.Y + (33 * i)), Color.White); // } // else //Not Logged In but with Controller activated // { // //Gray Block Short // batch.Draw(grayBlockShort, new Vector2(iconPosition.X, iconPosition.Y + (33 * i)), Color.White); // } // // Controller // batch.Draw(ControllerIdImg[i], new Vector2(controllerPosition.X, controllerPosition.Y + (33 * i)), Color.White); // //Gamertag Text // batch.DrawString(font, PlayerGamertag[j], new Vector2(textPosition.X, textPosition.Y + (33 * i)), Color.White); // //Players to Join // playersToJoinPosition.Y = playersToJoinPosition.Y + 33; // } // } // } // //Not Logged In but with Controller activated // if (PlayerIcons.Count != Gamer.SignedInGamers.Count) // { // for (i = 0; i < PlayerIcons.Count - Gamer.SignedInGamers.Count; i++) // { // batch.Draw(notLoggedInGamerPic, new Rectangle(Convert.ToInt32(pos.X) - 31, Convert.ToInt32(pos.Y) + (33 * (i + Gamer.SignedInGamers.Count)), 30, 30), Color.White); // //Gray Block Short // batch.Draw(grayBlockShort, new Vector2(iconPosition.X, iconPosition.Y + (33 * (i + Gamer.SignedInGamers.Count))), Color.White); // // Controller // batch.Draw(ControllerIdImg[(i + Gamer.SignedInGamers.Count)], new Vector2(controllerPosition.X, controllerPosition.Y + (33 * (i + Gamer.SignedInGamers.Count))), Color.White); // //Gamertag Text // batch.DrawString(germanFont, Strings.PlayerSignInString, new Vector2(textPosition.X, textPosition.Y + 2 + (33 * (i + Gamer.SignedInGamers.Count))), Color.White); // //Players to Join // playersToJoinPosition.Y = playersToJoinPosition.Y + 33; // } // } // playersToJoin = 4 - PlayerIcons.Count; // if (playersToJoin != 0) // { // for (i = 0; i < playersToJoin; i++) // { // //Gray Block // batch.Draw(grayBlock, new Vector2(playersToJoinPosition.X, playersToJoinPosition.Y + (33 * i)), new Color(255, 255, 255, (byte)MathHelper.Clamp(60, 0, 255))); // //Gray Block // batch.Draw(squareEmpty, new Vector2(playersToJoinPosition.X + 5, playersToJoinPosition.Y + (33 * i) + 5), new Color(255, 255, 255, (byte)MathHelper.Clamp(80, 0, 255))); // //Gamertag Text // if (CultureInfo.CurrentCulture.TwoLetterISOLanguageName == "de") // { // batch.DrawString(germanFont, Strings.ConnectControllerToJoinString, new Vector2(playersToJoinPosition.X + 36, playersToJoinPosition.Y + 7 + (33 * i)), new Color(255, 255, 255, (byte)MathHelper.Clamp(80, 0, 255))); // } // else // { // batch.DrawString(font, Strings.ConnectControllerToJoinString, new Vector2(playersToJoinPosition.X + 36, playersToJoinPosition.Y + 5 + (33 * i)), new Color(255, 255, 255, (byte)MathHelper.Clamp(80, 0, 255))); // //(i+1+count).ToString() + "P " + // } // } // } // } // batch.End(); // } // } //} <|start_filename|>ZombustersWindows/ContentManager/EnemiesCount.cs<|end_filename|> namespace ZombustersWindows.Subsystem_Managers { public class EnemiesCount { public int Zombies; public int Tanks; public int Rats; public int Wolfs; public int Minotaurs; } } <|start_filename|>ZombustersWindows/SubsystemManagers/AchievementsManager.cs<|end_filename|> using System; using System.Collections.Generic; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; namespace ZombustersWindows.Subsystem_Managers { //this enum must be synched up with the order in the XML file public enum Achievements { Dodger, Unstoppable, QuickDead, EagleEye } //[Serializable] public class Achievement { public int ID; public string Name; public int Points; public string Description; } //[Serializable] public class PlayerAchievement { public int ID; public DateTime DateUnlocked; } //used in AchievementScreen public class AchievementDisplay { public Texture2D Icon; public string Name; public string Points; public string DateUnlocked; } public class AchievementManager { private List<PlayerAchievement> _playerAchievements; private List<Achievement> _achievements; private Game _game; public AchievementManager(Game game, Player player) { #if !WINDOWS_PHONE && !WINDOWS && !NETCOREAPP && !WINDOWS_UAP //load achievements _achievements = new List<Achievement>(); StorageContainer container; // Open a storage container. IAsyncResult result = player.Device.BeginOpenContainer("Zombusters", null, null); // Wait for the WaitHandle to become signaled. result.AsyncWaitHandle.WaitOne(); if (result.IsCompleted) { if (player.Container == null) { container = player.Device.EndOpenContainer(result); } else { container = player.Container; } string filename = "Achievements.xml"; Stream stream = TitleContainer.OpenStream(filename); //Stream stream = container.OpenFile(filename, FileMode.Open, FileAccess.Read); XmlSerializer serializer = new XmlSerializer(typeof(List<Achievement>)); _achievements = (List<Achievement>)serializer.Deserialize(stream); stream.Close(); //load player achievements filename = "playerachievements.xml"; if (container.FileExists(filename)) { stream = container.OpenFile(filename, FileMode.Open, FileAccess.Read); serializer = new XmlSerializer(typeof(List<PlayerAchievement>)); _playerAchievements = (List<PlayerAchievement>)serializer.Deserialize(stream); } stream.Close(); container.Dispose(); } // Close the wait handle. result.AsyncWaitHandle.Close(); /* //load achievements StorageContainer container = player.Device.OpenContainer("Zombusters"); // Get the path of the save game. string filename = Path.Combine(StorageContainer.TitleLocation, "Achievements.xml"); FileStream fs = File.Open(filename, FileMode.Open, FileAccess.Read); //FileStream fs = new FileStream(StorageContainer.TitleLocation + "\\achievements.xml", FileMode.Open); XmlSerializer serializer = new XmlSerializer(typeof(List<Achievement>)); _achievements = (List<Achievement>)serializer.Deserialize(fs); fs.Close(); //load player achievements filename = Path.Combine(container.Path, "playerachievements.xml"); if (File.Exists(filename)) { serializer = new XmlSerializer(typeof(List<PlayerAchievement>)); fs = File.Open(filename, FileMode.Open); //fs = new FileStream(StorageContainer.TitleLocation + "\\playerachievements.xml", FileMode.Open); _playerAchievements = (List<PlayerAchievement>)serializer.Deserialize(fs); } */ _game = game; #endif } public void Save(Player player) { #if !WINDOWS_PHONE && !WINDOWS && !NETCOREAPP && !WINDOWS_UAP // Open a storage container. IAsyncResult result = player.Device.BeginOpenContainer("Zombusters", null, null); if (result.IsCompleted) { StorageContainer container = player.Device.EndOpenContainer(result); string filename = "playerachievements.xml"; //load player achievements Stream stream = container.CreateFile(filename); XmlSerializer serializer = new XmlSerializer(typeof(PlayerAchievement)); serializer.Serialize(stream, _playerAchievements); stream.Close(); container.Dispose(); } #endif /* //achievements XmlSerializer serializer = new XmlSerializer(typeof(PlayerAchievement)); //load achievements StorageContainer container = player.Device.OpenContainer("Zombusters"); // Get the path of the save game. string filename = Path.Combine(container.Path, "playerachievements.xml"); FileStream fs = File.Open(filename, FileMode.Create); //FileStream fs = new FileStream(StorageContainer.TitleLocation + "\\playerachievements.xml", FileMode.Create); serializer.Serialize(fs, _playerAchievements); fs.Close(); */ } public bool PlayerHasAchievements() { if (_playerAchievements != null) return (_playerAchievements.Count > 0); else return false; } public int PlayerAchievementCount() { if (_playerAchievements != null) return _playerAchievements.Count; else return 0; } public List<AchievementDisplay> Achievements() { List<AchievementDisplay> achievements = new List<AchievementDisplay>(); AchievementDisplay display; //ContentManager content = new ContentManager(_game.Services); foreach (Achievement achievement in _achievements) { display = new AchievementDisplay(); display.Icon = ((MyGame)this._game).Content.Load<Texture2D>(@"Achievements/achieve_" + achievement.ID.ToString()); display.Name = achievement.Name; display.Points = achievement.Points.ToString(); display.DateUnlocked = GetDateUnlocked(achievement.ID); achievements.Add(display); } return achievements; } private string GetDateUnlocked(int id) { if (_playerAchievements != null) { foreach (PlayerAchievement achievement in _playerAchievements) if (achievement.ID == id) return achievement.DateUnlocked.ToString(); } return ""; } public void AddAchievement(Achievements type) { PlayerAchievement achievement = new PlayerAchievement(); achievement.DateUnlocked = DateTime.Now; achievement.ID = _achievements[(int)type].ID; if (_playerAchievements == null) _playerAchievements = new List<PlayerAchievement>(); _playerAchievements.Add(achievement); } public bool IsAchievementEarned(Achievements type) { if (_playerAchievements != null) { for (int i = 0; i < _playerAchievements.Count; i++) if (_playerAchievements[i].ID == _achievements[(int)type].ID) return true; } return false; } } } <|start_filename|>ZombustersWindows/OnlineDataSyncManager/TopScoreListContainer.cs<|end_filename|> /* Copyright (c) 2010 Spyn Doctor Games (<NAME>). All rights reserved. Redistribution and use in binary forms, with or without modification, and for whatever purpose (including commercial) are permitted. Atribution is not required. If you want to give attribution, use the following text and URL (may be translated where required): Uses source code by Spyn Doctor Games - http://www.spyn-doctor.de Redistribution and use in source forms, with or without modification, are permitted provided that redistributions of source code retain the above copyright notice, this list of conditions and the following disclaimer. THIS SOFTWARE IS PROVIDED BY SPYN DOCTOR GAMES (<NAME>) "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SPYN DOCTOR GAMES (<NAME>) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Last change: 2010-12-23 */ using System.IO; using System.Diagnostics; namespace ZombustersWindows { public class TopScoreListContainer : IOnlineSyncTarget { public TopScoreList[] scoreList; private bool isChanged; private int transferCurrentListIndex; private int transferCurrentEntryIndex; public const byte MARKER_ENTRY = 0; // bit pattern 00000000 private const byte MARKER_CONTAINER_END = 0x55; // bit pattern 01010101 private readonly object SYNC = new object(); /* User this ctor to create a new empty TopScoreListContainer with "listCount" many top-score * lists, where each list can have up to "listMaxSize" many entries. */ public TopScoreListContainer(int listCount, int listMaxSize) { scoreList = new TopScoreList[listCount]; for (int i = 0; i < listCount; i++) scoreList[i] = new TopScoreList(listMaxSize); } /* Use this ctor to load an existing TopScoreListContainer from file. The BinaryReader * that reads the file must already have been opened on the file (no data must have been * read from the file yet). The ctor will reconstruct all previously saved lists in the * container, with all their entries. */ public TopScoreListContainer(BinaryReader reader) { int listCount = reader.ReadInt32(); scoreList = new TopScoreList[listCount]; for (int i = 0; i < listCount; i++) scoreList[i] = new TopScoreList(reader); } /* Checks if the list with the given index contains an entry for the given gamertag. */ public bool containsEntryForGamertag(int listIndex, string gamertag) { return scoreList[listIndex].containsEntryForGamertag(gamertag); } /* Fills the "page" array with one page from the full top score list with the given index. * "pageNumber" specifies the number of the page that is requested (0-based). * The page size is inferred from the length of the "page" array. * Example: If page.Length == 10, and pageNumber is 0, then the array will be filled with the * entries 1-10 from the list. If pageNumber is 4, then the array will be filled with the * entries 41-50. If not enough entries are available, then the remaining fields of the * array are filled with "null". * After this method returns, each entries actual rank in the *full* score list can be retrieved * from the RankAtLastPageFill property of the entry. */ public void fillPageFromFullList(int listIndex, int pageNumber, TopScoreEntry[] page) { scoreList[listIndex].fillPageFromFullList(pageNumber, page); } /* Fills the "page" array with one page from the filtered top score list with the given index. * The filtered list contains only the entry for the given "gamer" and his friends * and is therefore normally shorter than the full top score list with the same index. * "pageNumber" specifies the number of the page that is requested (0-based). * The page size is inferred from the length of the "page" array. * Example: If page.Length == 10, and pageNumber is 0, then the array will be filled with the * entries 1-10 from the list. If pageNumber is 4, then the array will be filled with the * entries 41-50. If not enough entries are available, then the remaining fields of the * array are filled with "null". * After this method returns, each entries actual rank in the *full* score list can be retrieved * from the RankAtLastPageFill property of the entry. */ //public void fillPageFromFilteredList(int listIndex, int pageNumber, TopScoreEntry[] page, SignedInGamer gamer) //{ // mScoreLists[listIndex].fillPageFromFilteredList(pageNumber, page, gamer); //} /* Fills the "page" array with a specific page from the full top score list with the given index. * The requested page is the one that contains the specified gamertag. If the gamertag is not * present in the full list, then the array is filled with the first page of the full list. * The page size is inferred from the length of the "page" array. * Example: If page.Length == 10, and the specified gamertag is currently at position 37 in the * full list, then the array will be filled with the entries 31-40. If not enough entries are * available, then the remaining fields of the array are filled with "null". * After this method returns, each entries actual rank in the *full* score list can be retrieved * from the RankAtLastPageFill property of the entry. */ public int fillPageThatContainsGamertagFromFullList(int listIndex, TopScoreEntry[] page, string gamertag) { return scoreList[listIndex].fillPageThatContainsGamertagFromFullList(page, gamertag); } /* Fills the "page" array with a specific page from the filtered top score list with the given index. * The filtered list contains only the entry for the given "gamer" and his friends * and is therefore normally shorter than the full top score list with the same index. * The requested page is the one that contains the specified gamertag. If the gamertag is not * present in the filtered list, then the array is filled with the first page of the filtered list. * The page size is inferred from the length of the "page" array. * Example: If page.Length == 10, and the specified gamertag is currently at position 37 in the * filtered list, then the array will be filled with the entries 31-40. If not enough entries are * available, then the remaining fields of the array are filled with "null". * After this method returns, each entries actual rank in the *full* score list can be retrieved * from the RankAtLastPageFill property of the entry. */ //public int fillPageThatContainsGamertagFromFilteredList(int listIndex, TopScoreEntry[] page, SignedInGamer gamer) //{ // return mScoreLists[listIndex].fillPageThatContainsGamertagFromFilteredList(page, gamer); //} #if WINDOWS_PHONE || WINDOWS || NETCOREAPP || WINDOWS_UAP /* Saves the TopScoreListContainer, and all lists and entries in it, into the given BinaryWriter. * Usually you would first open a FileStream on which you then construct the BinaryWriter, so * that the TopScoreListContainer is written to a file. The resulting file can then be used * to later reconstruct the TopScoreListContainer by using the ctor that takes a BinaryReader * as an argument. */ public void save(BinaryWriter writer) { // Lock to make sure there are no changes while saving writer.Write(scoreList.Length); foreach (TopScoreList list in scoreList) list.write(writer); } /* Adds a new entry to the list with the specified index and notifies the * OnlineDataSyncManager about it. */ public void addEntry(int listIndex, TopScoreEntry entry) { // Lock to sync the change with a possible background saving lock (SYNC) { scoreList[listIndex].addEntry(entry); } } #else public void save(BinaryWriter writer) { // Lock to make sure there are no changes while saving lock (SYNC) { writer.Write(mScoreLists.Length); foreach (TopScoreList list in mScoreLists) list.write(writer); } } public void addEntry(int listIndex, TopScoreEntry entry, OnlineDataSyncManager manager) { // Lock to sync the change with a possible background saving lock (SYNC) { if (mScoreLists[listIndex].addEntry(entry) && manager != null) manager.notifyAboutNewLocalEntry(); } } #endif /* Returns the count of entries in the full list with the specified index. */ public int getFullListSize(int listIndex) { return scoreList[listIndex].getFullCount(); } /* Returns the count of entries in the filtered list with the specified index. * The filtered list contains only the entry for the given "gamer" and his friends * and is therefore normally shorter than the full top score list with the same index. */ //public int getFilteredListSize(int listIndex, SignedInGamer gamer) //{ // return mScoreLists[listIndex].getFilteredCount(gamer); //} public void startSynchronization() { isChanged = false; // Lock to sync the change with a possible background saving lock (SYNC) { foreach (TopScoreList list in scoreList) list.initForTransfer(); } } public void endSynchronization(Player player, TopScoreListContainer mScores) { #if !WINDOWS_PHONE && !WINDOWS && !NETCOREAPP && !WINDOWS_UAP if (mChanged) { // TODO: Trigger saving of container here if (player.Device != null) { string filename = "leaderboard.txt"; Stream stream = player.Container.OpenFile(filename, FileMode.OpenOrCreate, FileAccess.ReadWrite); BinaryWriter writer = new BinaryWriter(stream); mScores.save(writer); writer.Close(); stream.Close(); } mChanged = false; } #endif } public void prepareForSending() { transferCurrentListIndex = 0; transferCurrentEntryIndex = 0; } #if !WINDOWS_PHONE && !WINDOWS && !NETCOREAPP && !WINDOWS_UAP public bool readTransferRecord(PacketReader reader) { byte marker = reader.ReadByte(); switch (marker) { case MARKER_ENTRY: int listIndex = reader.ReadByte(); if (listIndex >= 0 && listIndex < mScoreLists.Length) { // Lock to sync the change with a possible background saving lock (SYNC) { mChanged |= mScoreLists[listIndex].readTransferEntry(reader); } #if WINDOWS Debug.Write("o"); // entry received #endif } #if WINDOWS else Debug.Write("."); // entry with illegal list-index or transfer-seq-no skipped #endif break; case MARKER_CONTAINER_END: Debug.WriteLine("\nEnd marker received"); return true; } return false; } public bool writeTransferRecord(PacketWriter writer) { while (true) { TopScoreList list = mScoreLists[mTransferCurrentListIndex]; mTransferCurrentEntryIndex = list.writeNextTransferEntry(writer, mTransferCurrentListIndex, mTransferCurrentEntryIndex); if (mTransferCurrentEntryIndex > -1) return false; // Current list complete: Debug.WriteLine("\nList " + mTransferCurrentListIndex + " complete"); mTransferCurrentListIndex++; if (mTransferCurrentListIndex < mScoreLists.Length) { // Still more lists to go: Reset list index Debug.WriteLine("Starting with list " + mTransferCurrentListIndex); mTransferCurrentEntryIndex = 0; } else { // No more lists to go: write end for container Debug.WriteLine("All lists complete"); writer.Write(MARKER_CONTAINER_END); return true; } } } #endif } } <|start_filename|>ZombustersWindows/GameObjects/ShotgunShell.cs<|end_filename|> using System; using System.Collections.Generic; using Microsoft.Xna.Framework; using ZombustersWindows.Subsystem_Managers; namespace ZombustersWindows { public class ShotgunShell { public List<Vector4> Pellet; public Vector2 Position, Direction, Velocity; public float Angle; protected float radius = 1f; public ShotgunShell(Vector2 position, Vector2 direction, float angle, float totalgameseconds) { this.Position = position; this.Angle = angle; Pellet = new List<Vector4> { new Vector4(this.Position, totalgameseconds, angle), new Vector4(this.Position, totalgameseconds, angle), new Vector4(this.Position, totalgameseconds, angle) }; } } } <|start_filename|>ZombustersWindows/MenuScreens/MenuScreen.cs<|end_filename|> using System; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Input.Touch; using GameStateManagement; using ZombustersWindows.Localization; using ZombustersWindows.Subsystem_Managers; using Steamworks; using GameAnalyticsSDK.Net; namespace ZombustersWindows { public class MenuScreen : BackgroundScreen { MyGame game; Rectangle uiBounds; Vector2 selectPos; SpriteFont MenuInfoFont; SpriteFont MenuListFont; private MenuComponent menu; public MenuScreen() { EnabledGestures = GestureType.Tap; } public override void Initialize() { game = (MyGame)this.ScreenManager.Game; Viewport view = this.ScreenManager.GraphicsDevice.Viewport; int borderheight = (int)(view.Height * .05); uiBounds = GetTitleSafeArea(); selectPos = new Vector2(uiBounds.X + 60, uiBounds.Bottom - 30); MenuInfoFont = game.Content.Load<SpriteFont>(@"Menu\ArialMenuInfo"); MenuListFont = game.Content.Load<SpriteFont>(@"Menu\ArialMenuList"); menu = new MenuComponent(game, MenuListFont); //bloom = new BloomComponent(game); menu.Initialize(); menu.AddText("WPPlayNewGame", "WPPlayNewGameMMString"); menu.AddText("ExtrasMenuString", "ExtrasMMString"); menu.AddText("SettingsMenuString", "ConfigurationString"); #if DEMO menu.AddText("WishListGameMenu", "WishListGameMenuHelp"); #endif //menu.AddText(Strings.ReviewMenuString, Strings.ReviewMMString); /*if (licenseInformation.IsTrial) { menu.AddText(Strings.UnlockFullGameMenuString").ToUpper(), Strings.UnlockFullGameMenuString")); }*/ menu.AddText("QuitGame", "QuitGame"); menu.uiBounds = menu.Extents; menu.uiBounds.Offset(uiBounds.X, uiBounds.Bottom / 2); menu.MenuOptionSelected += new EventHandler<MenuSelection>(OnMenuOptionSelected); menu.MenuCanceled += new EventHandler<MenuSelection>(OnMenuCanceled); menu.MenuConfigSelected += new EventHandler<MenuSelection>(OnMenuConfigSelected); //menu.MenuShowMarketplace += new EventHandler<MenuSelection>(OnShowMarketplace); menu.CenterInXLeftMenu(view); //bloom.Visible = !bloom.Visible; game.isInMenu = true; base.Initialize(); this.isBackgroundOn = true; } void OnMenuCanceled(Object sender, MenuSelection selection) { } void OnMenuConfigSelected(Object sender, MenuSelection selection) { } void OnShowMarketplace(Object sender, MenuSelection selection) { } void ConfirmExitMessageBoxAccepted(object sender, PlayerIndexEventArgs e) { GameAnalytics.EndSession(); try { SteamClient.Shutdown(); } catch {} game.Exit(); // WARNING: This is a workaround because the game is not exiting correctly Environment.Exit(0); } void OnMenuOptionSelected(Object sender, MenuSelection selection) { switch (selection.Selection) { case 0: game.BeginSelectPlayerScreen(false); break; case 1: game.DisplayExtrasMenu(); break; case 2: game.DisplayOptions(0); break; #if DEMO case 3: GameAnalytics.AddDesignEvent("Demo:MainMenu:AddToWishlist"); System.Diagnostics.Process.Start("https://store.steampowered.com/app/1272300/Zombusters/"); break; case 4: ShowConfirmExitMessageBox(); break; #else case 3: ShowConfirmExitMessageBox(); break; #endif default: break; } } public override void LoadContent() { base.LoadContent(); } public override void HandleInput(InputState input) { menu.HandleInput(input); base.HandleInput(input); } public override void Update(GameTime gameTime, bool otherScreenHasFocus, bool coveredByOtherScreen) { if (game.currentGameState != GameState.Paused) { if (!coveredByOtherScreen) { menu.Update(gameTime); } } base.Update(gameTime, otherScreenHasFocus, coveredByOtherScreen); } public override void Draw(GameTime gameTime) { base.Draw(gameTime); if (game.currentGameState != GameState.Paused) { //menu.DrawBuyNow(gameTime); //menu.DrawSocialLogosMenu(this.ScreenManager.SpriteBatch, new Vector2(uiBounds.Width - 200, uiBounds.Height), MenuInfoFont); menu.Draw(gameTime); menu.DrawLogoRetrowaxMenu(this.ScreenManager.SpriteBatch, new Vector2(uiBounds.Width, uiBounds.Height), MenuInfoFont); #if DEMO menu.DrawDemoWIPDisclaimer(this.ScreenManager.SpriteBatch); #endif menu.DrawContextMenu(selectPos, this.ScreenManager.SpriteBatch); } else { this.ScreenManager.SpriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend, null, null, null, null, Resolution.getTransformationMatrix()); this.ScreenManager.SpriteBatch.Draw(game.blackTexture, new Vector2(0, 0), Color.White); this.ScreenManager.SpriteBatch.DrawString(MenuInfoFont, "ZOMBUSTERS " + Strings.Paused.ToUpper(), new Vector2(5, 5), Color.White); this.ScreenManager.SpriteBatch.End(); } } private void ShowConfirmExitMessageBox() { MessageBoxScreen confirmExitMessageBox = new MessageBoxScreen(Strings.QuitGame, Strings.ConfirmQuitGame); confirmExitMessageBox.Accepted += ConfirmExitMessageBoxAccepted; ScreenManager.AddScreen(confirmExitMessageBox); } } } <|start_filename|>ZombustersWindows/MainScreens/StartScreen.cs<|end_filename|> using System; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using GameStateManagement; using ZombustersWindows.Localization; using Microsoft.Xna.Framework.Input; using GameAnalyticsSDK.Net; namespace ZombustersWindows { public class StartScreen : BackgroundScreen { MyGame game; Rectangle uiBounds; Rectangle titleBounds; Vector2 startPos; Vector2 startOrigin; Vector2 rightsPos; Vector2 rightsOrigin; Texture2D title; SpriteFont font; bool Exiting = false; public StartScreen() { } public override void Initialize() { base.Initialize(); this.game = (MyGame)this.ScreenManager.Game; Viewport view = this.ScreenManager.GraphicsDevice.Viewport; int borderheight = (int)(view.Height * .05); uiBounds = GetTitleSafeArea(); titleBounds = new Rectangle(115, 65, 1000, 323); startPos = new Vector2(uiBounds.X + uiBounds.Width / 2, uiBounds.Height * .75f); rightsPos = new Vector2(uiBounds.X + uiBounds.Width / 2, uiBounds.Height + 50); game.musicComponent.Enabled = true; game.musicComponent.StartPlayingMusic(6); game.isInMenu = false; this.isBackgroundOn = true; } public override void LoadContent() { title = game.Content.Load<Texture2D>("title"); font = game.Content.Load<SpriteFont>(@"Menu\ArialMenuInfo"); if (InputManager.CheckIfGamePadIsConnected()) { startOrigin = font.MeasureString(Strings.PressStartString) / 2; } else { startOrigin = font.MeasureString(Strings.PCPressAnyKeyString) / 2; } rightsOrigin = font.MeasureString(Strings.CopyRightString) / 2; base.LoadContent(); } public override void HandleInput(InputState input) { if (!Exiting) { Exiting = true; game.TrySignIn(true, FinishStart); } base.HandleInput(input); } public override void Update(GameTime gameTime, bool otherScreenHasFocus, bool coveredByOtherScreen) { base.Update(gameTime, otherScreenHasFocus, coveredByOtherScreen); } void FinishStart(Object sender, EventArgs e) { MessageBoxScreen confirmExitMessageBox =new MessageBoxScreen(Strings.AutosaveTitleMenuString, Strings.AutosaveStartMenuString, false); confirmExitMessageBox.Accepted += ConfirmExitMessageBoxAccepted; confirmExitMessageBox.Cancelled += ConfirmExitMessageBoxAccepted; ScreenManager.AddScreen(confirmExitMessageBox); } void ConfirmExitMessageBoxAccepted(object sender, PlayerIndexEventArgs e) { InputMode inputMode = InputMode.Keyboard; InputState input = ((MessageBoxScreen)sender).inputState; for (int gamePadIndex = 0; gamePadIndex < input.GetCurrentGamePadStates().Length; gamePadIndex++) { GamePadState gamePadState = input.GetCurrentGamePadStates()[gamePadIndex]; if (gamePadState.IsButtonDown(Buttons.DPadDown) || gamePadState.IsButtonDown(Buttons.LeftThumbstickDown) || gamePadState.IsButtonDown(Buttons.DPadUp) || gamePadState.IsButtonDown(Buttons.LeftThumbstickUp) || gamePadState.IsButtonDown(Buttons.B) || gamePadState.IsButtonDown(Buttons.Back) || gamePadState.IsButtonDown(Buttons.A) || gamePadState.IsButtonDown(Buttons.Start)) { inputMode = InputMode.GamePad; game.players[gamePadIndex].avatar.Activate(); game.players[gamePadIndex].IsPlaying = true; game.players[gamePadIndex].inputMode = inputMode; GameAnalytics.AddDesignEvent("StartGame:InputMode:Gamepad", gamePadIndex); } } if (inputMode == InputMode.Keyboard) { game.players[(int)PlayerIndex.One].avatar.Activate(); game.players[(int)PlayerIndex.One].IsPlaying = true; game.players[(int)PlayerIndex.One].inputMode = inputMode; GameAnalytics.AddDesignEvent("StartGame:InputMode:Keyboard"); } game.currentInputMode = inputMode; this.ScreenManager.AddScreen(new MenuScreen()); ExitScreen(); } public override void Draw(GameTime gameTime) { base.Draw(gameTime); SpriteBatch batch = this.ScreenManager.SpriteBatch; batch.Begin(); batch.Draw(title, titleBounds, Color.White); float interval = 2.0f; // in seconds float value = (float)Math.Cos(gameTime.TotalGameTime.TotalSeconds * interval); value = (value + 1) / 2; // Shift the sine wave into positive Color color = new Color(value, value, value, value); if (InputManager.CheckIfGamePadIsConnected()) { batch.DrawString(font, Strings.PressStartString, startPos, color, 0, startOrigin, 1.0f, SpriteEffects.None, 0.1f); } else { batch.DrawString(font, Strings.PCPressAnyKeyString, startPos, color, 0, startOrigin, 1.0f, SpriteEffects.None, 0.1f); } batch.DrawString(font, Strings.CopyRightString, rightsPos, Color.White, 0, rightsOrigin, 1.0f, SpriteEffects.None, 0.1f); batch.End(); } } } <|start_filename|>ZombustersWindows/GameObjects/Enemies/BaseEnemy.cs<|end_filename|> using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Content; using Microsoft.Xna.Framework.Graphics; using System; using System.Collections.Generic; using ZombustersWindows.GameObjects; using ZombustersWindows.Subsystem_Managers; namespace ZombustersWindows { public class BaseEnemy { private const int ZOMBIE_SCORE = 10; private const int RAT_SCORE = 15; private const int WOLF_SCORE = 30; private const int MINOTAUR_SCORE = 80; public SteeringBehaviors behaviors; public SteeringEntity entity; public ObjectStatus status; public float deathTimeTotalSeconds; public float TimeOnScreen; public bool invert; public float speed; public float angle; public int playerChased; public int entityYOffset; public float lifecounter; public bool isLoosingLife; public Random random; public GunType currentgun; public float timer; public bool isInPlayerRange; public SpriteFont font; #if DEBUG Texture2D PositionReference; SpriteFont DebugFont; bool collision = false; #endif public BaseEnemy() { } public bool IsInRange(Player[] players) { foreach (Player player in players) { float distance = Vector2.Distance(entity.Position, player.avatar.position); if (distance < Avatar.CrashRadius + 20.0f) { #if DEBUG collision = true; #endif return true; } } #if DEBUG collision = false; #endif return false; } virtual public void Destroy(float totalGameSeconds, GunType currentgun) { this.deathTimeTotalSeconds = totalGameSeconds; this.status = ObjectStatus.Dying; this.currentgun = currentgun; } // Destroy the seeker without leaving a powerup virtual public void Crash(float totalGameSeconds) { this.deathTimeTotalSeconds = totalGameSeconds; this.status = ObjectStatus.Inactive; } public float GetLayerIndex(SteeringEntity entity, List<Furniture> furniturelist) { float furnitureInferior, playerBasePosition, lindex; int n = 0; playerBasePosition = entity.Position.Y; furnitureInferior = 0.0f; lindex = 0.0f; while (playerBasePosition > furnitureInferior) { if (n < furniturelist.Count) { furnitureInferior = furniturelist[n].Position.Y + furniturelist[n].Texture.Height; lindex = furniturelist[n].layerIndex; } else { return lindex + 0.002f; } n++; } return lindex + 0.002f; } virtual public void LoadContent(ContentManager content) { font = content.Load<SpriteFont>(@"Menu\ArialMenuInfo"); #if DEBUG PositionReference = content.Load<Texture2D>(@"InGame/position_reference_temporal"); DebugFont = content.Load<SpriteFont>(@"Menu/ArialMenuInfo"); #endif } virtual public void Update(GameTime gameTime, MyGame game, List<BaseEnemy> enemyList) { } virtual public void Draw(SpriteBatch batch, float TotalGameSeconds, List<Furniture> furniturelist, GameTime gameTime) { #if DEBUG batch.Draw(PositionReference, new Rectangle(Convert.ToInt32(this.entity.Position.X), Convert.ToInt32(this.entity.Position.Y), PositionReference.Width, PositionReference.Height), new Rectangle(0, 0, PositionReference.Width, PositionReference.Height), Color.White, 0.0f, Vector2.Zero, SpriteEffects.None, 0.1f); batch.DrawString(DebugFont, collision.ToString(), this.entity.Position, Color.White, 0.0f, Vector2.Zero, 1.0f, SpriteEffects.None, 0.1f); #endif if (this.status == ObjectStatus.Dying) { int score = GetScore(); float layerIndex = GetLayerIndex(this.entity, furniturelist); if ((TotalGameSeconds < this.deathTimeTotalSeconds + .5) && (this.deathTimeTotalSeconds < TotalGameSeconds)) { batch.DrawString(font, score.ToString(), new Vector2(this.entity.Position.X - font.MeasureString(score.ToString()).X / 2 + 1, this.entity.Position.Y - entityYOffset - 1), Color.Black, 0.0f, Vector2.Zero, 1.0f, SpriteEffects.None, layerIndex); batch.DrawString(font, score.ToString(), new Vector2(this.entity.Position.X - font.MeasureString(score.ToString()).X / 2, this.entity.Position.Y - entityYOffset), Color.White, 0.0f, Vector2.Zero, 1.0f, SpriteEffects.None, layerIndex - 0.1f); } } } private int GetScore() { if (GetType().Name == EnemyType.Zombie.ToString()) { return ZOMBIE_SCORE; } else if (GetType().Name == EnemyType.Minotaur.ToString()) { return MINOTAUR_SCORE; } else if (GetType().Name == EnemyType.Rat.ToString()) { return RAT_SCORE; } else if (GetType().Name == EnemyType.Wolf.ToString()) { return WOLF_SCORE; } else { return ZOMBIE_SCORE; } } } } <|start_filename|>ZombustersWindows/MainScreens/OptionsScreen.cs<|end_filename|> using System; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Input; using GameStateManagement; using Microsoft.Xna.Framework.Input.Touch; using ZombustersWindows.Subsystem_Managers; using GameAnalyticsSDK.Net; namespace ZombustersWindows { public class OptionsScreen : BackgroundScreen { readonly MyGame game; MenuComponent menu; SliderComponent volumeSlider; SliderComponent musicSlider; LanguageComponent languageComponent; Vector2 playerStringLoc; Vector2 selectPos; SpriteFont MenuInfoFont; SpriteFont MenuListFont; Rectangle uiBounds; InputMode displayMode; Player player; public OptionsScreen(MyGame game, Player player) { this.player = player; this.game = game; } public override void Initialize() { Viewport view = this.ScreenManager.GraphicsDevice.Viewport; uiBounds = GetTitleSafeArea(); selectPos = new Vector2(uiBounds.X + 60, uiBounds.Bottom - 30); MenuInfoFont = game.Content.Load<SpriteFont>(@"Menu\ArialMenuInfo"); MenuListFont = game.Content.Load<SpriteFont>(@"Menu\ArialMenuList"); menu = new MenuComponent(game, MenuListFont); menu.Initialize(); //menu.AddText("Player Control Scheme"); menu.AddText("SoundEffectVolumeString"); menu.AddText("MusicVolumeString"); menu.AddText("ChangeLanguageOption"); menu.AddText("FullScreenMenuString"); menu.AddText("SaveAndExitString"); menu.MenuOptionSelected += new EventHandler<MenuSelection>(MenuOptionSelected); menu.MenuCanceled += new EventHandler<MenuSelection>(MenuCancelled); // The menu should be situated in the bottom half of the screen, centered menu.uiBounds = menu.Extents; //Offset de posicion del menu menu.uiBounds.Offset(uiBounds.X, 300); //menu.uiBounds.Offset( // uiBounds.X + uiBounds.Width / 2 - menu.uiBounds.Width - 5, // uiBounds.Height / 2 + (menu.uiBounds.Height / 2)); //Posiciona el menu menu.CenterInXLeftMenu(view); //menu.SelectedColor = Color.DodgerBlue; //menu.UnselectedColor = Color.LightBlue; volumeSlider = new SliderComponent(game, this.ScreenManager.SpriteBatch); volumeSlider.Initialize(); Rectangle tempExtent = menu.GetExtent(0); // volume menu item volumeSlider.SliderArea = new Rectangle(menu.uiBounds.Right + 20, tempExtent.Top + 4, 120, tempExtent.Height - 10); volumeSlider.SliderUnits = 10; volumeSlider.SliderSetting = (int) (player.optionsState.FXLevel*volumeSlider.SliderUnits); volumeSlider.SetColor = Color.Cyan; volumeSlider.UnsetColor = Color.DodgerBlue; musicSlider = new SliderComponent(game, this.ScreenManager.SpriteBatch); musicSlider.Initialize(); tempExtent = menu.GetExtent(1); musicSlider.SliderArea = new Rectangle(menu.uiBounds.Right + 20, tempExtent.Top + 4, 120, tempExtent.Height - 10); musicSlider.SliderUnits = 10; musicSlider.SliderSetting = (int)(player.optionsState.MusicLevel*musicSlider.SliderUnits); musicSlider.SetColor = Color.Cyan; musicSlider.UnsetColor = Color.DodgerBlue; languageComponent = new LanguageComponent(game, ScreenManager.SpriteBatch); languageComponent.Initialize(); languageComponent.languageArea = new Rectangle(menu.uiBounds.Right + 20, tempExtent.Top + 4, 120, tempExtent.Height - 10); tempExtent = menu.GetExtent(0); playerStringLoc = new Vector2(menu.uiBounds.Right + 20, tempExtent.Top); //this.PresenceMode = GamerPresenceMode.ConfiguringSettings; base.Initialize(); this.isBackgroundOn = true; } void MenuCancelled(Object sender, MenuSelection selection) { ExitScreen(); } void MenuOptionSelected(Object sender, MenuSelection selection) { if (menu.Selection == 2) { player.optionsState.locale = languageComponent.SwitchLanguage(); } else if (menu.Selection == 3) { ToggleFullScreen(); } else if (menu.Selection == 4) // Save and Exit { ExitScreen(); game.SetOptions(player.optionsState, player); } } public override void LoadContent() { volumeSlider.LoadContent(); musicSlider.LoadContent(); languageComponent.LoadContent(); base.LoadContent(); } public override void HandleInput(InputState input) { // If they press Back or B, exit if (input.IsNewButtonPress(Buttons.Back) || input.IsNewButtonPress(Buttons.B)) ExitScreen(); if (input.IsNewKeyPress(Keys.Escape) || input.IsNewKeyPress(Keys.Back)) { ExitScreen(); } musicSlider.UnsetColor = menu.UnselectedColor; volumeSlider.UnsetColor = menu.UnselectedColor; switch (menu.Selection) { case 0: HandleFXAudio(input, player.playerIndex); volumeSlider.UnsetColor = menu.SelectedColor; break; case 1: HandleMusic(input, player.playerIndex); musicSlider.UnsetColor = menu.SelectedColor; break; default: break; } // Let the menu handle input regarding selection change // and the A/B/Back buttons: if (player.inputMode != InputMode.Touch) { menu.HandleInput(input); } // Read in our gestures foreach (GestureSample gesture in input.GetGestures()) { // If we have a tap if (gesture.GestureType == GestureType.Tap) { // Volume - if ((gesture.Position.X >= 415 && gesture.Position.X <= 523) && (gesture.Position.Y >= 351 && gesture.Position.Y <= 382)) { volumeSlider.SliderSetting--; volumeSlider.UnsetColor = menu.SelectedColor; } // Volume + if ((gesture.Position.X >= 524 && gesture.Position.X <= 629) && (gesture.Position.Y >= 351 && gesture.Position.Y <= 382)) { volumeSlider.SliderSetting++; volumeSlider.UnsetColor = menu.SelectedColor; } // Music - if ((gesture.Position.X >= 415 && gesture.Position.X <= 523) && (gesture.Position.Y >= 384 && gesture.Position.Y <= 428)) { musicSlider.SliderSetting--; musicSlider.UnsetColor = menu.SelectedColor; } // Music + if ((gesture.Position.X >= 524 && gesture.Position.X <= 629) && (gesture.Position.Y >= 384 && gesture.Position.Y <= 428)) { musicSlider.SliderSetting++; musicSlider.UnsetColor = menu.SelectedColor; } // Save and Exit if ((gesture.Position.X >= 156 && gesture.Position.X <= 442) && (gesture.Position.Y >= 614 && gesture.Position.Y <= 650)) { ExitScreen(); game.SetOptions(player.optionsState, player); } // Exit without Saving if ((gesture.Position.X >= 490 && gesture.Position.X <= 774) && (gesture.Position.Y >= 614 && gesture.Position.Y <= 650)) { ExitScreen(); } //// BUY NOW!! //if ((gesture.Position.X >= 0 && gesture.Position.X <= 90) && // (gesture.Position.Y >= 0 && gesture.Position.Y <= 90)) //{ // if (Guide.IsTrialMode) // { // Guide.ShowMarketplace(PlayerIndex.One); // } //} } } base.HandleInput(input); } private void ToggleFullScreen() { Resolution.SetVirtualResolution(game.VIRTUAL_RESOLUTION_WIDTH, game.VIRTUAL_RESOLUTION_HEIGHT); if (player.optionsState.FullScreenMode) { #if !WINDOWS_UAP Resolution.SetResolution(game.VIRTUAL_RESOLUTION_WIDTH, game.VIRTUAL_RESOLUTION_HEIGHT, false); #endif player.optionsState.FullScreenMode = false; game.graphics.IsFullScreen = true; GameAnalytics.AddDesignEvent("ScreenView:Options:FullScreen:false"); } else { int screenWidth = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width; int screenHeight = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height; #if !WINDOWS_UAP Resolution.SetResolution(screenWidth, screenHeight, true); #endif player.optionsState.FullScreenMode = true; game.graphics.IsFullScreen = false; GameAnalytics.AddDesignEvent("ScreenView:Options:FullScreen:true"); } this.game.graphics.ToggleFullScreen(); } private void HandlePlayer(InputState input, PlayerIndex index) { if (input.IsNewButtonPress(Buttons.LeftThumbstickRight, index) || input.IsNewButtonPress(Buttons.DPadRight, index)) { player.optionsState.Player++; if (player.optionsState.Player > InputMode.GamePad) player.optionsState.Player = InputMode.Keyboard; } else if (input.IsNewButtonPress(Buttons.LeftThumbstickLeft, index) || input.IsNewButtonPress(Buttons.DPadLeft, index)) { player.optionsState.Player--; if (player.optionsState.Player < InputMode.Keyboard) player.optionsState.Player = InputMode.GamePad; } displayMode = player.optionsState.Player; } private void HandleFXAudio(InputState input, PlayerIndex index) { if (input.IsNewButtonPress(Buttons.LeftThumbstickRight, index) || input.IsNewButtonPress(Buttons.DPadRight, index)) { volumeSlider.SliderSetting++; } else if (input.IsNewButtonPress(Buttons.LeftThumbstickLeft, index) || input.IsNewButtonPress(Buttons.DPadLeft, index)) { volumeSlider.SliderSetting--; } if (input.IsNewKeyPress(Keys.Right)) { volumeSlider.SliderSetting++; } else if (input.IsNewKeyPress(Keys.Left)) { volumeSlider.SliderSetting--; } GameAnalytics.AddDesignEvent("ScreenView:Options:VolumeSFX", volumeSlider.SliderSetting); } private void HandleMusic(InputState input, PlayerIndex index) { if (input.IsNewButtonPress(Buttons.LeftThumbstickRight, index) || input.IsNewButtonPress(Buttons.DPadRight, index)) { musicSlider.SliderSetting++; } else if (input.IsNewButtonPress(Buttons.LeftThumbstickLeft, index) || input.IsNewButtonPress(Buttons.DPadLeft, index)) { musicSlider.SliderSetting--; } if (input.IsNewKeyPress(Keys.Right)) { musicSlider.SliderSetting++; } else if (input.IsNewKeyPress(Keys.Left)) { musicSlider.SliderSetting--; } GameAnalytics.AddDesignEvent("ScreenView:Options:VolumeMusic", musicSlider.SliderSetting); } public override void Update(GameTime gameTime, bool otherScreenHasFocus, bool coveredByOtherScreen) { player.optionsState.FXLevel = volumeSlider.SliderSetting / (float)musicSlider.SliderUnits; player.optionsState.MusicLevel = musicSlider.SliderSetting / (float)musicSlider.SliderUnits; base.Update(gameTime, otherScreenHasFocus, coveredByOtherScreen); } public override void Draw(GameTime gameTime) { base.Draw(gameTime); menu.Draw(gameTime); volumeSlider.Draw(gameTime); musicSlider.Draw(gameTime); languageComponent.Draw(gameTime); menu.DrawLogoRetrowaxMenu(this.ScreenManager.SpriteBatch, new Vector2(uiBounds.Width, uiBounds.Height), MenuInfoFont); menu.DrawContextMenu(selectPos, this.ScreenManager.SpriteBatch); #if DEMO menu.DrawDemoWIPDisclaimer(this.ScreenManager.SpriteBatch); #endif } } } <|start_filename|>ZombustersWindows/GameObjects/Enemies/Zombie.cs<|end_filename|> using System; using System.Collections.Generic; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Content; using Microsoft.Xna.Framework.Graphics; using System.Globalization; using ZombustersWindows.Subsystem_Managers; using ZombustersWindows.GameObjects; namespace ZombustersWindows { public class Zombie : BaseEnemy { public float MAX_VELOCITY = 1.5f; public const float MAX_STRENGTH = 0.15f; private const int ZOMBIE_Y_OFFSET = 70; private Vector2 ZombieOrigin; public Vector2 BurningZombieOrigin; public Vector2 ZombieDeathOrigin; public Texture2D ZombieTexture; public Texture2D ZombieShadow; public Texture2D BurningZombieTexture; public Texture2D ZombieDeathTexture; Animation ZombieAnimation; Animation BurningZombieAnimation; Animation ZombieDeathAnimation; public Zombie(Vector2 velocidad, Vector2 posicion, float boundingRadius, float life, float speed, ref Random gameRandom) { this.entity = new SteeringEntity { Velocity = velocidad, Position = posicion, BoundingRadius = boundingRadius }; this.random = gameRandom; if (this.random.Next(0, 2) == 0) { speed = 0.0f; } this.entity.MaxSpeed = MAX_VELOCITY + speed; this.status = ObjectStatus.Active; this.invert = true; this.deathTimeTotalSeconds = 0; this.TimeOnScreen = 4.5f; this.speed = 0; this.angle = 1f; this.playerChased = 0; this.lifecounter = life; this.isLoosingLife = false; this.entityYOffset = ZOMBIE_Y_OFFSET; this.ZombieOrigin = new Vector2(0, 0); behaviors = new SteeringBehaviors(MAX_STRENGTH, CombinationType.prioritized); } override public void LoadContent(ContentManager content) { base.LoadContent(content); // Load multiple animations form XML definition System.Xml.Linq.XDocument doc = System.Xml.Linq.XDocument.Load(AppContext.BaseDirectory + "/Content/AnimationDef.xml"); //ZOMBIE ANIMATION // Get the Zombie animation from the XML definition var definition = doc.Root.Element("ZombieDef"); int rand = random.Next(1, 6); ZombieTexture = content.Load<Texture2D>(@"InGame/zombie" + rand.ToString()); ZombieShadow = content.Load<Texture2D>(@"InGame/character_shadow"); ZombieOrigin = new Vector2(ZombieTexture.Width / 2, ZombieTexture.Height / 2); Point frameSize = new Point(); frameSize.X = int.Parse(definition.Attribute("FrameWidth").Value, NumberStyles.Integer); frameSize.Y = int.Parse(definition.Attribute("FrameHeight").Value, NumberStyles.Integer); Point sheetSize = new Point(); sheetSize.X = int.Parse(definition.Attribute("SheetColumns").Value, NumberStyles.Integer); sheetSize.Y = int.Parse(definition.Attribute("SheetRows").Value, NumberStyles.Integer); TimeSpan frameInterval = TimeSpan.FromSeconds(1.0f / int.Parse(definition.Attribute("Speed").Value, NumberStyles.Integer)); // Define a new Animation instance ZombieAnimation = new Animation(ZombieTexture, frameSize, sheetSize, frameInterval); //END ZOMBIE ANIMATION definition = doc.Root.Element("BurningZombieDef"); BurningZombieTexture = content.Load<Texture2D>(@"InGame/burningzombie"); // + rand.ToString()); BurningZombieOrigin = new Vector2(BurningZombieTexture.Width / 2, BurningZombieTexture.Height / 2); frameSize = new Point(); frameSize.X = int.Parse(definition.Attribute("FrameWidth").Value, NumberStyles.Integer); frameSize.Y = int.Parse(definition.Attribute("FrameHeight").Value, NumberStyles.Integer); sheetSize = new Point(); sheetSize.X = int.Parse(definition.Attribute("SheetColumns").Value, NumberStyles.Integer); sheetSize.Y = int.Parse(definition.Attribute("SheetRows").Value, NumberStyles.Integer); frameInterval = TimeSpan.FromSeconds(1.0f / int.Parse(definition.Attribute("Speed").Value, NumberStyles.Integer)); BurningZombieAnimation = new Animation(BurningZombieTexture, frameSize, sheetSize, frameInterval); definition = doc.Root.Element("ZombieDeathDef"); ZombieDeathTexture = content.Load<Texture2D>(@"InGame/zombiedeath" + rand.ToString()); ZombieDeathOrigin = new Vector2(ZombieDeathTexture.Width / 2, ZombieDeathTexture.Height / 2); frameSize = new Point(); frameSize.X = int.Parse(definition.Attribute("FrameWidth").Value, NumberStyles.Integer); frameSize.Y = int.Parse(definition.Attribute("FrameHeight").Value, NumberStyles.Integer); sheetSize = new Point(); sheetSize.X = int.Parse(definition.Attribute("SheetColumns").Value, NumberStyles.Integer); sheetSize.Y = int.Parse(definition.Attribute("SheetRows").Value, NumberStyles.Integer); frameInterval = TimeSpan.FromSeconds(1.0f / int.Parse(definition.Attribute("Speed").Value, NumberStyles.Integer)); ZombieDeathAnimation = new Animation(ZombieDeathTexture, frameSize, sheetSize, frameInterval); } override public void Update(GameTime gameTime, MyGame game, List<BaseEnemy> enemyList) { if (this.status != ObjectStatus.Dying) { ZombieAnimation.Update(gameTime); this.behaviors.Pursuit.Target = game.players[this.playerChased].avatar.position; this.behaviors.Pursuit.UpdateEvaderEntity(game.players[this.playerChased].avatar.entity); this.entity.Velocity += this.behaviors.Update(gameTime, this.entity); this.entity.Velocity = VectorHelper.TruncateVector(this.entity.Velocity, this.entity.MaxSpeed / 1.5f); this.entity.Position += this.entity.Velocity; foreach (BaseEnemy enemy in enemyList) { if (entity.Position != enemy.entity.Position && enemy.status == ObjectStatus.Active) { //calculate the distance between the positions of the entities Vector2 ToEntity = entity.Position - enemy.entity.Position; float DistFromEachOther = ToEntity.Length(); //if this distance is smaller than the sum of their radii then this //entity must be moved away in the direction parallel to the //ToEntity vector float AmountOfOverLap = entity.BoundingRadius + 20.0f - DistFromEachOther; if (AmountOfOverLap >= 0) { //move the entity a distance away equivalent to the amount of overlap. entity.Position = (entity.Position + (ToEntity / DistFromEachOther) * AmountOfOverLap); } } } } else { BurningZombieAnimation.Update(gameTime); ZombieDeathAnimation.Update(gameTime); } } override public void Draw(SpriteBatch batch, float TotalGameSeconds, List<Furniture> furniturelist, GameTime gameTime) { Color color = new Color(); float layerIndex = GetLayerIndex(this.entity, furniturelist); if (this.status == ObjectStatus.Active) { if (this.isLoosingLife == true) { color = Color.Red; } else { color = Color.White; } if (this.entity.Velocity.X > 0) { ZombieAnimation.Draw(batch, new Vector2(this.entity.Position.X, this.entity.Position.Y - 50), SpriteEffects.FlipHorizontally, layerIndex, 0f, color); } else { ZombieAnimation.Draw(batch, new Vector2(this.entity.Position.X - 21, this.entity.Position.Y - 50), SpriteEffects.None, layerIndex, 0f, color); } batch.Draw(this.ZombieShadow, new Vector2(this.entity.Position.X - 10, this.entity.Position.Y - 58 + this.ZombieTexture.Height), null, new Color(255, 255, 255, 50), 0.0f, new Vector2(0, 0), 1.0f, SpriteEffects.None, layerIndex + 0.01f); this.isLoosingLife = false; } else if (this.status == ObjectStatus.Dying) { // Produce animation if (this.currentgun != GunType.flamethrower) { timer += (float)gameTime.ElapsedGameTime.TotalSeconds; if (timer <= 1.2f) { if (this.entity.Velocity.X > 0) { ZombieDeathAnimation.Draw(batch, new Vector2(this.entity.Position.X, this.entity.Position.Y - 50), SpriteEffects.FlipHorizontally, layerIndex, 0f, Color.White); } else { ZombieDeathAnimation.Draw(batch, new Vector2(this.entity.Position.X - 21, this.entity.Position.Y - 50), SpriteEffects.None, layerIndex, 0f, Color.White); } batch.Draw(this.ZombieShadow, new Vector2(this.entity.Position.X - 10, this.entity.Position.Y - 58 + this.ZombieTexture.Height), null, new Color(255, 255, 255, 50), 0.0f, new Vector2(0, 0), 1.0f, SpriteEffects.None, layerIndex + 0.01f); } } else { timer += (float)gameTime.ElapsedGameTime.TotalSeconds; if (timer <= 1.4f) { if (this.entity.Velocity.X > 0) { BurningZombieAnimation.Draw(batch, new Vector2(this.entity.Position.X, this.entity.Position.Y - 50), SpriteEffects.FlipHorizontally, layerIndex, 0f, Color.White); } else { BurningZombieAnimation.Draw(batch, new Vector2(this.entity.Position.X - 21, this.entity.Position.Y - 50), SpriteEffects.None, layerIndex, 0f, Color.White); } batch.Draw(this.ZombieShadow, new Vector2(this.entity.Position.X - 10, this.entity.Position.Y - 58 + this.ZombieTexture.Height), null, new Color(255, 255, 255, 50), 0.0f, new Vector2(0, 0), 1.0f, SpriteEffects.None, layerIndex + 0.01f); } } } base.Draw(batch, TotalGameSeconds, furniturelist, gameTime); } } } <|start_filename|>ZombustersWindows/MainScreens/GameOverMenu.cs<|end_filename|> using GameStateManagement; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Input.Touch; using System; using ZombustersWindows.Localization; using ZombustersWindows.Subsystem_Managers; namespace ZombustersWindows.MainScreens { public class GameOverMenu : GameScreen { MenuComponent menu; public event EventHandler<MenuSelection> GameOverMenuOptionSelected; Texture2D gameover; Texture2D coffinMeme; Vector2 gameoverOrigin; Rectangle uiBounds; public GameOverMenu() { EnabledGestures = GestureType.Tap; this.IsPopup = true; } public override void Initialize() { menu = new MenuComponent(this.ScreenManager.Game, this.ScreenManager.Font, this.ScreenManager.SpriteBatch); menu.AddText("GPRestartCurrentWaveString"); //Restart from current Wave menu.AddText("GPRestartFromBeginningString"); //Restart from beginning menu.AddText("GPReturnToMainMenuString"); //Return to main menu menu.MenuOptionSelected += new EventHandler<MenuSelection>(SelectOption); menu.MenuCanceled += new EventHandler<MenuSelection>(CancelMenu); //menu.MenuConfigSelected += new EventHandler<MenuSelection>(menu_MenuConfigSelected); menu.Initialize(); Viewport view = this.ScreenManager.GraphicsDevice.Viewport; uiBounds = GetTitleSafeArea(); menu.CenterMenu(view); TransitionPosition = 0.5f; base.Initialize(); } public override void LoadContent() { base.LoadContent(); coffinMeme = this.ScreenManager.Game.Content.Load<Texture2D>(@"InGame/coffin_meme"); gameover = this.ScreenManager.Game.Content.Load<Texture2D>(@"InGame/gameover"); gameoverOrigin = new Vector2(gameover.Width / 2, gameover.Height / 2); } void CancelMenu(Object sender, MenuSelection selection) { //MenuCanceled.Invoke(this, new MenuSelection(-1)); //ExitScreen(); } void SelectOption(Object sender, MenuSelection selection) { GameOverMenuOptionSelected.Invoke(this, selection); ExitScreen(); } public override void HandleInput(InputState input) { menu.HandleInput(input); base.HandleInput(input); } public override void Update(GameTime gameTime, bool otherScreenHasFocus, bool coveredByOtherScreen) { base.Update(gameTime, otherScreenHasFocus, coveredByOtherScreen); } public override void Draw(GameTime gameTime) { this.ScreenManager.FadeBackBufferToBlack(127); menu.Draw(gameTime); this.ScreenManager.SpriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, null, null, null, Resolution.getTransformationMatrix()); this.ScreenManager.SpriteBatch.Draw(gameover, new Vector2(uiBounds.X + uiBounds.Width / 2 - 204, uiBounds.Y + 254), null, Color.Black, 0, gameoverOrigin, 1.0f, SpriteEffects.None, 1.0f); this.ScreenManager.SpriteBatch.Draw(gameover, new Vector2(uiBounds.X + uiBounds.Width / 2 - 200, uiBounds.Y + 250), null, Color.AntiqueWhite, 0, gameoverOrigin, 1.0f, SpriteEffects.None, 1.0f); this.ScreenManager.SpriteBatch.Draw(coffinMeme, new Vector2(uiBounds.X + uiBounds.Width / 2 - 75, uiBounds.Y + uiBounds.Height / 2 + 100), null, Color.White, 0, gameoverOrigin, 1.0f, SpriteEffects.None, 1.0f); this.ScreenManager.SpriteBatch.End(); base.Draw(gameTime); } public Rectangle GetTitleSafeArea() { PresentationParameters pp = this.ScreenManager.GraphicsDevice.PresentationParameters; Rectangle retval = new Rectangle(0, 0, pp.BackBufferWidth, pp.BackBufferHeight); int offsetx = (pp.BackBufferWidth + 9) / 10; int offsety = (pp.BackBufferHeight + 9) / 10; retval.Inflate(-offsetx, -offsety); // Deflate the rectangle return retval; } } } <|start_filename|>ZombustersWindows/MenuScreens/CreateFindMenuScreen.cs<|end_filename|> using System; using System.Collections.Generic; using System.Text.RegularExpressions; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Audio; using Microsoft.Xna.Framework.Content; using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Input; #if !WINDOWS_PHONE //using Microsoft.Xna.Framework.Storage; #endif using GameStateManagement; using ZombustersWindows.Subsystem_Managers; #if !WINDOWS && !NETCOREAPP && !WINDOWS_UAP namespace ZombustersWindows { public class CreateFindMenuScreen : BackgroundScreen { Rectangle uiBounds; Rectangle titleBounds; Vector2 selectPos; Texture2D btnA; Texture2D btnB; Texture2D btnStart; Texture2D logoMenu; Texture2D lineaMenu; //Linea de 1px para separar SpriteFont MenuHeaderFont; SpriteFont MenuInfoFont; SpriteFont MenuListFont; #region Network Settings Boolean CreateGame = false; static String[] PlaylistSettings = { "STORY MODE", "TIMECRISIS MODE", "HARDCORE MODE" }; static int CurrentPlaylistSetting = 0; //static String[] NetworkSettings = { "XBOX LIVE", "SYSTEM LINK" }; //static int CurrentNetworkSetting = 0; #endregion #region Game Settings public int LevelSettings = 1; public int PrivateSlotsSettings = 0; public int MaxPlayersSettings = 4; #endregion public CreateFindMenuScreen(Boolean create) { this.CreateGame = create; } private MenuComponent menu; //private BloomComponent bloom; public override void Initialize() { Viewport view = this.ScreenManager.GraphicsDevice.Viewport; int borderheight = (int)(view.Height * .05); // Deflate 10% to provide for title safe area on CRT TVs uiBounds = GetTitleSafeArea(); titleBounds = new Rectangle(0, 0, 1280, 720); //"Select" text position selectPos = new Vector2(uiBounds.X + 60, uiBounds.Bottom - 30); MenuHeaderFont = this.ScreenManager.Game.Content.Load<SpriteFont>(@"Menu\ArialMenuHeader"); MenuInfoFont = this.ScreenManager.Game.Content.Load<SpriteFont>(@"Menu\ArialMenuInfo"); MenuListFont = this.ScreenManager.Game.Content.Load<SpriteFont>(@"Menu\ArialMenuList"); menu = new MenuComponent(this.ScreenManager.Game, MenuListFont); //bloom = new BloomComponent(this.ScreenManager.Game); //Initialize Main Menu menu.Initialize(); //Adding Options text for the Menu if (CreateGame == true) { //CREATE GAME MENU menu.AddText(Strings.LevelSelectMenuString + " : " + LevelSettings, Strings.LevelSelectMMString); // LEVEL menu.AddText(Strings.PrivateSlotsMenuString + " : " + PrivateSlotsSettings, Strings.PrivateSlotsMMString); // PRIVATE SLOTS menu.AddText(Strings.MaxPlayersMenuString + " : " + MaxPlayersSettings, Strings.MaxPlayersMMString); // MAX PLAYERS menu.AddText(Strings.CreateGameMenuString, Strings.CreateGameMMString); // CREATE GAME } else { //FIND SESSION MENU menu.AddText(Strings.LevelSelectMenuString + " : " + LevelSettings, Strings.LevelSelectMMString); // LEVEL menu.AddText(Strings.MaxPlayersMenuString + " : " + MaxPlayersSettings, Strings.MaxPlayersMMString); // MAX PLAYERS menu.AddText(Strings.FindSessionMenuString, Strings.FindSessionMMString); // FIND SESSION } menu.uiBounds = menu.Extents; //Offset de posicion del menu menu.uiBounds.Offset(uiBounds.X, 300); //menu.SelectedColor = new Color(198,34,40); menu.MenuOptionSelected += new EventHandler<MenuSelection>(menu_MenuOptionSelected); menu.MenuCanceled += new EventHandler<MenuSelection>(menu_MenuCanceled); menu.MenuConfigSelected += new EventHandler<MenuSelection>(menu_MenuConfigSelected); //Posiciona el menu menu.CenterInXLeftMenu(view); #if !WINDOWS_PHONE this.PresenceMode = GamerPresenceMode.AtMenu; #endif //bloom.Visible = !bloom.Visible; base.Initialize(); this.isBackgroundOn = true; } void menu_MenuCanceled(Object sender, MenuSelection selection) { // If they hit B or Back, go back to Menu Screen ScreenManager.AddScreen(new MatchmakingMenuScreen()); } void menu_MenuConfigSelected(Object sender, MenuSelection selection) { // If they hit Start, go to Configuration Screen SignedInGamer gamer; if (GamePad.GetState(PlayerIndex.One).IsButtonDown(Buttons.Start)) { #if !WINDOWS_PHONE gamer = NetworkSessionManager.FindGamer(PlayerIndex.One); if (gamer != null) { ((Game1)this.ScreenManager.Game).DisplayOptions(0); } #endif } else if (GamePad.GetState(PlayerIndex.Two).IsButtonDown(Buttons.Start)) { #if !WINDOWS_PHONE gamer = NetworkSessionManager.FindGamer(PlayerIndex.Two); if (gamer != null) { ((Game1)this.ScreenManager.Game).DisplayOptions(1); } #endif } else if (GamePad.GetState(PlayerIndex.Three).IsButtonDown(Buttons.Start)) { #if !WINDOWS_PHONE gamer = NetworkSessionManager.FindGamer(PlayerIndex.Three); if (gamer != null) { ((Game1)this.ScreenManager.Game).DisplayOptions(2); } #endif } else if (GamePad.GetState(PlayerIndex.Four).IsButtonDown(Buttons.Start)) { #if !WINDOWS_PHONE gamer = NetworkSessionManager.FindGamer(PlayerIndex.Four); if (gamer != null) { ((Game1)this.ScreenManager.Game).DisplayOptions(3); } #endif } //((Game1)this.ScreenManager.Game).DisplayOptions(); } void UpdatePlaylistSettings() { CurrentPlaylistSetting++; if (CurrentPlaylistSetting > PlaylistSettings.Length - 1) { CurrentPlaylistSetting = 0; } menu.UpdateText(Strings.PlaylistMatchmakingString + " : " + PlaylistSettings[CurrentPlaylistSetting], Strings.PlaylistMatchmakingMMString, 0); } void UpdateLevelSettings() { LevelSettings++; if (LevelSettings > 10) //ESTA HARDCODED REVISARRRR PUTILLA!!! { LevelSettings = 1; } menu.UpdateText(Strings.LevelSelectMenuString + " : " + LevelSettings, Strings.LevelSelectMMString, 0); } void UpdatePrivateSlotsSettings() { PrivateSlotsSettings++; if (PrivateSlotsSettings > 3) //ESTA HARDCODED REVISARRRR PUTILLA!!! { PrivateSlotsSettings = 0; } menu.UpdateText(Strings.PrivateSlotsMenuString + " : " + PrivateSlotsSettings, Strings.PrivateSlotsMMString, 1); } void UpdateMaxPlayersSettings() { MaxPlayersSettings++; if (MaxPlayersSettings > 4) //ESTA HARDCODED REVISARRRR PUTILLA!!! { MaxPlayersSettings = 0; } if (this.CreateGame == true) { menu.UpdateText(Strings.MaxPlayersMenuString + " : " + MaxPlayersSettings, Strings.MaxPlayersMMString, 2); } else { menu.UpdateText(Strings.MaxPlayersMenuString + " : " + MaxPlayersSettings, Strings.MaxPlayersMMString, 1); } } void menu_MenuOptionSelected(Object sender, MenuSelection selection) { if (this.CreateGame == true) { switch (selection.Selection) { case 0: // LEVEL UpdateLevelSettings(); break; case 1: // PRIVATE SLOTS UpdatePrivateSlotsSettings(); break; case 2: // MAX PLAYERS UpdateMaxPlayersSettings(); break; case 3: // CREATE GAME #if !WINDOWS_PHONE // Stop the Leaderboard Sync Manager Before create a NetworkSession ((Game1)this.ScreenManager.Game).mSyncManager.stop(delegate() { ((Game1)this.ScreenManager.Game).networkSessionManager.CreateSession(((Game1)this.ScreenManager.Game).CurrentNetworkSetting, PrivateSlotsSettings, MaxPlayersSettings); }, true); #endif break; default: break; } } else { switch (selection.Selection) { case 0: // LEVEL UpdateLevelSettings(); break; case 1: // MAX PLAYERS UpdateMaxPlayersSettings(); break; case 2: // FIND SESSION #if !WINDOWS_PHONE //((Game1)this.ScreenManager.Game).DisplayLobby(false); // Stop the Leaderboard Sync Manager Before joining a NetworkSession ((Game1)this.ScreenManager.Game).mSyncManager.stop(delegate() { ((Game1)this.ScreenManager.Game).networkSessionManager.JoinSession(((Game1)this.ScreenManager.Game).CurrentNetworkSetting, MaxPlayersSettings); }, true); #endif break; default: break; } } } public override void LoadContent() { //Button "A" btnA = this.ScreenManager.Game.Content.Load<Texture2D>("xboxControllerButtonA"); //Button "B" btnB = this.ScreenManager.Game.Content.Load<Texture2D>("xboxControllerButtonB"); //Button "Select" btnStart = this.ScreenManager.Game.Content.Load<Texture2D>("xboxControllerStart"); //Linea blanca separatoria lineaMenu = this.ScreenManager.Game.Content.Load<Texture2D>(@"Menu/linea_menu"); //Logo Menu logoMenu = this.ScreenManager.Game.Content.Load<Texture2D>(@"Menu/logo_menu"); base.LoadContent(); } public override void HandleInput(InputState input) { menu.HandleInput(input); base.HandleInput(input); } public override void Update(GameTime gameTime, bool otherScreenHasFocus, bool coveredByOtherScreen) { // Menu update if (!coveredByOtherScreen && !Guide.IsVisible) { menu.Update(gameTime); } // Network Session Manager Update //((Game1)this.ScreenManager.Game).networkSessionManager.UpdateNetworkSession(); #if XBOX // Gamer Manager Update if (((Game1)this.ScreenManager.Game).gamerManager.GamerListHasChanged()) { ((Game1)this.ScreenManager.Game).gamerManager.Update(); } #endif base.Update(gameTime, otherScreenHasFocus, coveredByOtherScreen); } public override void Draw(GameTime gameTime) { base.Draw(gameTime); // Draw Menu menu.Draw(gameTime); // Draw Retrowax Logo menu.DrawLogoRetrowaxMenu(this.ScreenManager.SpriteBatch, new Vector2(uiBounds.Width, uiBounds.Height), MenuInfoFont); // Draw Context Menu DrawContextMenu(menu, selectPos, this.ScreenManager.SpriteBatch); #if XBOX // Draw "My Group" info ((Game1)this.ScreenManager.Game).gamerManager.Draw(menu, new Vector2(uiBounds.X + uiBounds.Width - 300, 90), this.ScreenManager.SpriteBatch, MenuInfoFont, false #if !WINDOWS_PHONE , null #endif ); #endif } //Draw all the Selection buttons on the bottom of the menu private void DrawContextMenu(MenuComponent menu, Vector2 pos, SpriteBatch batch) { string[] lines; Vector2 contextMenuPosition = new Vector2(uiBounds.X + 22, pos.Y - 100); Vector2 MenuTitlePosition = new Vector2(contextMenuPosition.X - 3, contextMenuPosition.Y - 300); batch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend, null, null, null, null, Resolution.getTransformationMatrix()); //Logo Menu batch.Draw(logoMenu, new Vector2(MenuTitlePosition.X - 55, MenuTitlePosition.Y - 5), Color.White); //MATCHMAKING fade rotated batch.DrawString(MenuHeaderFont, Strings.MatchmakingMenuString, new Vector2(MenuTitlePosition.X - 10, MenuTitlePosition.Y + 70), new Color(255, 255, 255, 40), 1.58f, Vector2.Zero, 0.8f, SpriteEffects.None, 1.0f); //Texto de CREATE GAME or FIND GAME if (this.CreateGame == true) { batch.DrawString(MenuHeaderFont, Strings.CreateGameMenuString, MenuTitlePosition, Color.White); } else { batch.DrawString(MenuHeaderFont, Strings.FindSessionMenuString, MenuTitlePosition, Color.White); } //Linea divisoria pos.X -= 40; pos.Y -= 270; batch.Draw(lineaMenu, pos, Color.White); pos.Y += 270; pos.Y -= 115; batch.Draw(lineaMenu, pos, Color.White); pos.Y += 115; //Texto de contexto de menu lines = Regex.Split(menu.HelpText[menu.Selection], "\r\n"); foreach (string line in lines) { batch.DrawString(MenuInfoFont, line.Replace(" ", ""), contextMenuPosition, Color.White); contextMenuPosition.Y += 20; } //Linea divisoria pos.Y -= 15; batch.Draw(lineaMenu, pos, Color.White); #if !WINDOWS_PHONE // Draw context buttons menu.DrawMenuButtons(batch, new Vector2(pos.X + 10, pos.Y + 10), MenuInfoFont, false, false, false); #endif batch.End(); } } } #endif <|start_filename|>ZombustersWindows/GameObjects/GunType.cs<|end_filename|> using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ZombustersWindows.GameObjects { public enum GunType { pistol = 0, shotgun = 1, grenade = 2, flamethrower = 3, machinegun = 4 } } <|start_filename|>ZombustersWindows/SubsystemManagers/AudioManager.cs<|end_filename|> using System; using System.Collections.Generic; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Audio; using Microsoft.Xna.Framework.Media; namespace ZombustersWindows { public class AudioManager : DrawableGameComponent { private float FXVolume; private float MusicVolume; public AudioManager(Game game) : base(game) { FXVolume = 0.7f; MusicVolume = 0.5f; Sounds = new Queue<SoundEffectInstance>(100); random = new Random(); } private SoundEffect Shot; private SoundEffect Shotgun; private SoundEffect Explosion; private SoundEffect ZombieDying; private SoundEffect WomanScream; private SoundEffect ManScream; private SoundEffect MinotaurDeath; private SoundEffectInstance MinotaurDeathInstance; private SoundEffect RatDeath; private SoundEffectInstance RatDeathInstance; private SoundEffect WolfDeath; private SoundEffectInstance WolfDeathInstance; private SoundEffect FlameThrower; private SoundEffectInstance FlameThrowerInstance; private SoundEffect MachineGun; private SoundEffectInstance MachineGunInstance; private SoundEffectInstance ShotInstance; private SoundEffectInstance ShotGunInstance; private SoundEffectInstance ZombieDyingInstance; private SoundEffectInstance WomanScreamInstance; private SoundEffectInstance ManScreamInstance; private readonly Random random; private SoundEffect Splash; public override void Initialize() { base.Initialize(); } protected override void LoadContent() { MediaPlayer.Volume = MusicVolume; MediaPlayer.IsRepeating = true; Shot = Game.Content.Load<SoundEffect>("SoundFX/pistol_shot"); Shotgun = Game.Content.Load<SoundEffect>("SoundFX/shotgun"); Explosion = Game.Content.Load<SoundEffect>("SoundFX/explosion1"); ZombieDying = Game.Content.Load<SoundEffect>("SoundFX/zombiedying"); WomanScream = Game.Content.Load<SoundEffect>("SoundFX/womanscream"); ManScream = Game.Content.Load<SoundEffect>("SoundFX/critedu"); MinotaurDeath = Game.Content.Load<SoundEffect>("SoundFX/minotaurdeath"); RatDeath = Game.Content.Load<SoundEffect>("SoundFX/ratdeath"); WolfDeath = Game.Content.Load<SoundEffect>("SoundFX/wolfdeath"); FlameThrower = Game.Content.Load<SoundEffect>("SoundFX/flamethrower"); FlameThrowerInstance = FlameThrower.CreateInstance(); FlameThrowerInstance.Volume = FXVolume; FlameThrowerInstance.IsLooped = false; MachineGun = Game.Content.Load<SoundEffect>("SoundFX/machinegun"); MachineGunInstance = MachineGun.CreateInstance(); MachineGunInstance.Volume = FXVolume; MachineGunInstance.IsLooped = false; Splash = Game.Content.Load<SoundEffect>("SoundFX/LogoSplashSound"); ShotInstance = Shot.CreateInstance(); ShotInstance.Volume = FXVolume; ShotInstance.IsLooped = false; ShotGunInstance = Shotgun.CreateInstance(); ShotGunInstance.Volume = FXVolume; ShotGunInstance.IsLooped = false; ZombieDyingInstance = ZombieDying.CreateInstance(); ZombieDyingInstance.Volume = FXVolume; ZombieDyingInstance.IsLooped = false; WomanScreamInstance = WomanScream.CreateInstance(); WomanScreamInstance.Volume = FXVolume; WomanScreamInstance.IsLooped = false; ManScreamInstance = ManScream.CreateInstance(); ManScreamInstance.Volume = FXVolume; ManScreamInstance.IsLooped = false; MinotaurDeathInstance = MinotaurDeath.CreateInstance(); MinotaurDeathInstance.Volume = FXVolume; MinotaurDeathInstance.IsLooped = false; RatDeathInstance = RatDeath.CreateInstance(); RatDeathInstance.Volume = FXVolume; RatDeathInstance.IsLooped = false; WolfDeathInstance = WolfDeath.CreateInstance(); WolfDeathInstance.Volume = FXVolume; WolfDeathInstance.IsLooped = false; base.LoadContent(); } public override void Update(GameTime gameTime) { // This will help keep the size of the Queue to a minimum. for (int i = 0; i < Sounds.Count; i++) { if (Sounds.Peek().State == SoundState.Stopped) Sounds.Dequeue(); else break; } base.Update(gameTime); } private Queue<SoundEffectInstance> Sounds; private void AddSound(SoundEffect sound, float volume, float pitch) { SoundEffectInstance handle = sound.CreateInstance(); handle.Volume = volume; handle.Pitch = pitch; handle.Play(); Sounds.Enqueue(handle); } public void PlaySplashSound() { if (!bPaused) AddSound(Splash, 1.0f, 0.0f); } public void PlayShot() { if (!bPaused) { if ((!bPaused) && (ShotInstance.State != SoundState.Playing)) ShotInstance.Play(); } } public void PlayShotgun() { if (!bPaused) { if ((!bPaused) && (ShotGunInstance.State != SoundState.Playing)) ShotGunInstance.Play(); } } public void PlayZombieDying() { if (!bPaused) { if (random.Next(0, 3) == 1) { if ((!bPaused) && (ZombieDyingInstance.State != SoundState.Playing)) ZombieDyingInstance.Play(); } } } public void PlayMinotaurDeath() { if (!bPaused) { if ((!bPaused) && (MinotaurDeathInstance.State != SoundState.Playing)) MinotaurDeathInstance.Play(); } } public void PlayRatDeath() { if (!bPaused) { if ((!bPaused) && (RatDeathInstance.State != SoundState.Playing)) RatDeathInstance.Play(); } } public void PlayWolfDeath() { if (!bPaused) { if ((!bPaused) && (WolfDeathInstance.State != SoundState.Playing)) WolfDeathInstance.Play(); } } public void PlayWomanScream() { if (!bPaused) { if ((!bPaused) && (WomanScreamInstance.State != SoundState.Playing)) WomanScreamInstance.Play(); } } public void PlayManScream() { if (!bPaused) { if ((!bPaused) && (ManScreamInstance.State != SoundState.Playing)) ManScreamInstance.Play(); } } public void PlayFlameThrower() { if ((!bPaused) && (FlameThrowerInstance.State != SoundState.Playing)) FlameThrowerInstance.Play(); } public void StopFlameThrower() { if (FlameThrowerInstance.State == SoundState.Playing) FlameThrowerInstance.Stop(); } public void PlayMachineGun() { if (!bPaused) { if ((!bPaused) && (MachineGunInstance.State != SoundState.Playing)) MachineGunInstance.Play(); } } public void StopMachineGun() { if (MachineGunInstance.State == SoundState.Playing) MachineGunInstance.Stop(); } public void PlayExplosion() { if (!bPaused) AddSound(Explosion, this.FXVolume, 0); } public void PlayMusic() { } public void PlayMenuMusic() { } public void StopMenuMusic() { } private bool bPaused = false; public bool IsPaused { get { return bPaused; } } public void PauseSounds() { bPaused = true; foreach (SoundEffectInstance item in Sounds) { if (item.State == SoundState.Playing) item.Pause(); } } public void PauseAll() { PauseSounds(); MediaPlayer.Pause(); } public void ResumeAll() { if (bPaused) { MediaPlayer.Resume(); foreach (SoundEffectInstance item in Sounds) { if (item.State == SoundState.Paused) item.Resume(); } bPaused = false; } } public void SetOptions(float fxVolume, float musicVolume) { this.FXVolume = fxVolume; this.MusicVolume = musicVolume; MediaPlayer.Volume = this.MusicVolume; foreach (SoundEffectInstance item in Sounds) { item.Volume = this.FXVolume; } if (ShotInstance != null) { ShotInstance.Volume = FXVolume; ZombieDyingInstance.Volume = FXVolume; WomanScreamInstance.Volume = FXVolume; ManScreamInstance.Volume = FXVolume; MachineGunInstance.Volume = FXVolume; FlameThrowerInstance.Volume = FXVolume; } } } } <|start_filename|>ZombustersWindows/GameObjects/Avatar.cs<|end_filename|> using System; using System.Collections.Generic; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ZombustersWindows.GameObjects; namespace ZombustersWindows { public class Avatar { public Vector2 position; public List<Vector4> bullets; public List<ShotgunShell> shotgunbullets; public ObjectStatus status; public int score; public int lives; public List<int> ammo; public int lifecounter; public float deathTimeTotalSeconds; public Color color; public byte character; public float shotAngle; public GunType currentgun; public Vector2 accumMove; public Vector2 accumFire; public bool IsPlayingTheGame { get { return status != ObjectStatus.Inactive; } } public SteeringEntity entity; public SteeringBehaviors behaviors; public const float VELOCIDAD_MAXIMA = 1.0f; public const float FUERZA_MAXIMA = 0.15f; public Vector2 ObjectAvoidCalc = Vector2.Zero; public static float CrashRadius = 20f; public static float RespawnTime = 2.0f; public static float ImmuneTime = 8.0f; public static float AmmoDisplayTime = 2.0f; public static float PixelsPerSecond = 200; public static int bulletmax = 20; public static int pelletmax = 50; public Rectangle ScreenBounds; public int RateOfFire = 2; // per second private float LastShot; public Vector2 FlameThrowerPosition; public float FlameThrowerAngle; public RotatedRectangle FlameThrowerRectangle; public bool isLoosingLife; public Avatar(Color color) { bullets = new List<Vector4>(bulletmax); shotgunbullets = new List<ShotgunShell>(pelletmax); this.color = color; } public void Initialize(Viewport view) { this.entity = new SteeringEntity { Width = 28, Height = 50, Velocity = Vector2.Zero, Position = Vector2.Zero, BoundingRadius = 10.0f, MaxSpeed = VELOCIDAD_MAXIMA }; this.behaviors = new SteeringBehaviors(0.15f, CombinationType.prioritized); ScreenBounds = new Rectangle(view.X + 60, 60, view.Width - 60, view.Height - 55); position = new Vector2(ScreenBounds.Left + (ScreenBounds.Width / 2), ScreenBounds.Bottom - 60); FlameThrowerRectangle = new RotatedRectangle(new Rectangle((int)position.X, (int)position.Y, 88, 43), 0.0f); this.isLoosingLife = false; } public void SetFlameThrower(Vector2 position, float angle) { this.FlameThrowerPosition = position; this.FlameThrowerAngle = angle - MathHelper.ToRadians(90); this.FlameThrowerRectangle.ChangePosition(Convert.ToInt32(position.X), Convert.ToInt32(position.Y)); this.FlameThrowerRectangle.Rotation = this.FlameThrowerAngle; } /// <summary> /// Resets ship state, sets a color, and deactivates ship. /// </summary> /// <param name="color"></param> public void Reset(Color color) { this.color = color; Reset(); } /// <summary> /// Resets ship state and deactivates ship. /// </summary> public void Reset() { Restart(); } /// <summary> /// Resets ship state without deactivating the ship. /// </summary> public void Restart() { int i; position.X = ScreenBounds.X + (ScreenBounds.Width / 2); position.Y = ScreenBounds.Y + (ScreenBounds.Height - 60); deathTimeTotalSeconds = 0; lives = 3; score = 0; lifecounter = 100; currentgun = GunType.pistol; ammo = new List<int>(Enum.GetNames(typeof(GunType)).Length); #if DEBUG for (i = 0; i < Enum.GetNames(typeof(GunType)).Length; i++) { ammo.Add(100); } #else for (i = 0; i < Enum.GetNames(typeof(GunType)).Length; i++) { ammo.Add(0); } #endif bullets.Clear(); shotgunbullets.Clear(); LastShot = 0; } /// <summary> /// Activates ship and assigns it to a player. /// </summary> /// <param name="player"></param> public void Activate() { this.status = ObjectStatus.Active; } /// <summary> /// Deactivates ship. /// </summary> public void Deactivate() { this.status = ObjectStatus.Inactive; } public Vector2 VerifyMove(Vector2 offset) { if ((status != ObjectStatus.Dying) && (status != ObjectStatus.Inactive)) { Vector2 pos = position + offset; pos.X = MathHelper.Clamp(pos.X, ScreenBounds.X, ScreenBounds.Width); pos.Y = MathHelper.Clamp(pos.Y, ScreenBounds.Y, ScreenBounds.Height); return pos - position; // Return the distance allowed to travel } else return position; } public bool VerifyFire(float currentSec, float rateoffire) { if (VerifyFire(currentSec, LastShot, rateoffire)) { LastShot = currentSec; return true; } return false; } private static bool VerifyFire(float currentSec, float lastShot, float RateOfFire) { if ((currentSec - lastShot) > (1f / RateOfFire)) return true; return false; } public void DestroyAvatar(float totalGameSeconds) { deathTimeTotalSeconds = totalGameSeconds; status = ObjectStatus.Dying; } public void Update(GameTime gameTime, float totalGameSeconds) { if (status == ObjectStatus.Dying) { if ((totalGameSeconds > deathTimeTotalSeconds + Avatar.RespawnTime)) { if (lives > 0) { status = ObjectStatus.Immune; } else { status = ObjectStatus.Inactive; } } } else if (status == ObjectStatus.Immune) { if (totalGameSeconds > deathTimeTotalSeconds + Avatar.ImmuneTime) { status = ObjectStatus.Active; } } this.ObjectAvoidCalc = this.behaviors.Update(gameTime, this.entity); } public AvatarState State { get { AvatarState state; state.bullets = this.bullets; state.shotgunbullets = this.shotgunbullets; state.color = this.color; state.deathTimeTotalSeconds = this.deathTimeTotalSeconds; state.lives = this.lives; state.position = this.position; state.score = this.score; state.status = this.status; state.ammo = this.ammo; state.lifecounter = this.lifecounter; state.currentgun = this.currentgun; return state; } set { this.bullets = value.bullets; this.shotgunbullets = value.shotgunbullets; this.color = value.color; this.deathTimeTotalSeconds = value.deathTimeTotalSeconds; this.lives = value.lives; this.position = value.position; this.score = value.score; this.status = value.status; this.ammo = value.ammo; this.lifecounter = value.lifecounter; this.currentgun = value.currentgun; } } } } <|start_filename|>ZombustersWindows/MenuScreens/ExtrasMenuScreen.cs<|end_filename|> using System; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Input; using GameStateManagement; using GameAnalyticsSDK.Net; namespace ZombustersWindows { public class ExtrasMenuScreen : BackgroundScreen { Rectangle uiBounds; Vector2 selectPos; SpriteFont MenuInfoFont; SpriteFont MenuListFont; private MenuComponent menu; public ExtrasMenuScreen() { } public override void Initialize() { Viewport view = this.ScreenManager.GraphicsDevice.Viewport; int borderheight = (int)(view.Height * .05); // Deflate 10% to provide for title safe area on CRT TVs uiBounds = GetTitleSafeArea(); #if WINDOWS_PHONE titleBounds = new Rectangle(0, 0, 800, 480); selectPos = new Vector2(uiBounds.X + 60, uiBounds.Bottom); #else selectPos = new Vector2(uiBounds.X + 60, uiBounds.Bottom - 30); #endif MenuInfoFont = this.ScreenManager.Game.Content.Load<SpriteFont>(@"Menu\ArialMenuInfo"); MenuListFont = this.ScreenManager.Game.Content.Load<SpriteFont>(@"Menu\ArialMenuList"); #if WINDOWS_PHONE menu = new MenuComponent(this.ScreenManager.Game, MenuHeaderFont); #else menu = new MenuComponent(this.ScreenManager.Game, MenuListFont); #endif //bloom = new BloomComponent(this.ScreenManager.Game); menu.Initialize(); menu.AddText("HowToPlayInGameString", "HTPMenuSupportString"); // How To Play menu.AddText("LeaderboardMenuString", "LeaderboardMMString"); // Leaderboard menu.AddText("CreditsMenuString", "CreditsMMString"); // Credits //menu.AddText("StoreMenuString", "StoreMMString"); menu.uiBounds = menu.Extents; menu.uiBounds.Offset(uiBounds.X, 300); menu.MenuOptionSelected += new EventHandler<MenuSelection>(Menu_MenuOptionSelected); menu.MenuCanceled += new EventHandler<MenuSelection>(Menu_MenuCanceled); menu.MenuConfigSelected += new EventHandler<MenuSelection>(Menu_MenuConfigSelected); menu.CenterInXLeftMenu(view); #if !WINDOWS_PHONE && !WINDOWS && !NETCOREAPP && !WINDOWS_UAP this.PresenceMode = GamerPresenceMode.AtMenu; #endif //bloom.Visible = !bloom.Visible; base.Initialize(); this.isBackgroundOn = true; } void Menu_MenuCanceled(Object sender, MenuSelection selection) { // If they hit B or Back, go back to Menu Screen ScreenManager.AddScreen(new MenuScreen()); } void Menu_MenuConfigSelected(Object sender, MenuSelection selection) { // If they hit Start, go to Configuration Screen //SignedInGamer gamer; if (GamePad.GetState(PlayerIndex.One).IsButtonDown(Buttons.Start)) { #if !WINDOWS_PHONE && !WINDOWS && !NETCOREAPP && !WINDOWS_UAP gamer = NetworkSessionManager.FindGamer(PlayerIndex.One); if (gamer != null) { ((Game1)this.ScreenManager.Game).DisplayOptions(0); } #endif } else if (GamePad.GetState(PlayerIndex.Two).IsButtonDown(Buttons.Start)) { #if !WINDOWS_PHONE && !WINDOWS && !NETCOREAPP && !WINDOWS_UAP gamer = NetworkSessionManager.FindGamer(PlayerIndex.Two); if (gamer != null) { ((Game1)this.ScreenManager.Game).DisplayOptions(1); } #endif } else if (GamePad.GetState(PlayerIndex.Three).IsButtonDown(Buttons.Start)) { #if !WINDOWS_PHONE && !WINDOWS && !NETCOREAPP && !WINDOWS_UAP gamer = NetworkSessionManager.FindGamer(PlayerIndex.Three); if (gamer != null) { ((Game1)this.ScreenManager.Game).DisplayOptions(2); } #endif } else if (GamePad.GetState(PlayerIndex.Four).IsButtonDown(Buttons.Start)) { #if !WINDOWS_PHONE && !WINDOWS && !NETCOREAPP && !WINDOWS_UAP gamer = NetworkSessionManager.FindGamer(PlayerIndex.Four); if (gamer != null) { ((Game1)this.ScreenManager.Game).DisplayOptions(3); } #endif } //((Game1)this.ScreenManager.Game).DisplayOptions(); } void Menu_MenuOptionSelected(Object sender, MenuSelection selection) { switch (selection.Selection) { case 0: ((MyGame)this.ScreenManager.Game).DisplayHowToPlay(); break; case 1: ((MyGame)this.ScreenManager.Game).DisplayLeaderBoard(); break; case 2: ((MyGame)this.ScreenManager.Game).DisplayCredits(); break; case 3: //ShowMarketPlace(); break; default: break; } } void ShowMarketPlace() { GameAnalytics.AddDesignEvent("ScreenView:Extras:Marketplace:View"); System.Diagnostics.Process.Start("https://www.redbubble.com/es/people/retrowax/shop"); } public override void LoadContent() { base.LoadContent(); } public override void HandleInput(InputState input) { menu.HandleInput(input); base.HandleInput(input); } public override void Update(GameTime gameTime, bool otherScreenHasFocus, bool coveredByOtherScreen) { // Menu update if (!coveredByOtherScreen #if !WINDOWS && !NETCOREAPP && !WINDOWS_UAP && !Guide.IsVisible #endif ) { menu.Update(gameTime); } #if XBOX // Gamer Manager Update if (((Game1)this.ScreenManager.Game).gamerManager.GamerListHasChanged()) { ((Game1)this.ScreenManager.Game).gamerManager.Update(); } #endif base.Update(gameTime, otherScreenHasFocus, coveredByOtherScreen); } public override void Draw(GameTime gameTime) { base.Draw(gameTime); menu.Draw(gameTime); menu.DrawLogoRetrowaxMenu(this.ScreenManager.SpriteBatch, new Vector2(uiBounds.Width, uiBounds.Height), MenuInfoFont); #if DEMO menu.DrawDemoWIPDisclaimer(this.ScreenManager.SpriteBatch); #endif menu.DrawContextMenu(selectPos, this.ScreenManager.SpriteBatch); #if XBOX // Draw "My Group" info ((Game1)this.ScreenManager.Game).gamerManager.Draw(menu, new Vector2(uiBounds.X + uiBounds.Width - 300, 90), this.ScreenManager.SpriteBatch, MenuInfoFont, false, null); #endif #if WINDOWS_PHONE menu.DrawPhone(gameTime); menu.DrawBackButtonMenu(this.ScreenManager.SpriteBatch, new Vector2(uiBounds.Width + 55, uiBounds.Y - 30), MenuInfoFont); if (Guide.IsTrialMode) { menu.DrawBuyNow(gameTime); } menu.DrawContextMenuWP(menu, selectPos, this.ScreenManager.SpriteBatch); #endif } } } <|start_filename|>ZombustersWindows/Localization/Strings.Designer.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // Este código fue generado por una herramienta. // Versión de runtime:4.0.30319.42000 // // Los cambios en este archivo podrían causar un comportamiento incorrecto y se perderán si // se vuelve a generar el código. // </auto-generated> //------------------------------------------------------------------------------ namespace ZombustersWindows.Localization { using System; /// <summary> /// Clase de recurso fuertemente tipado, para buscar cadenas traducidas, etc. /// </summary> // StronglyTypedResourceBuilder generó automáticamente esta clase // a través de una herramienta como ResGen o Visual Studio. // Para agregar o quitar un miembro, edite el archivo .ResX y, a continuación, vuelva a ejecutar ResGen // con la opción /str o recompile su proyecto de VS. [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Strings { private static global::System.Resources.ResourceManager resourceMan; private static global::System.Globalization.CultureInfo resourceCulture; [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] internal Strings() { } /// <summary> /// Devuelve la instancia de ResourceManager almacenada en caché utilizada por esta clase. /// </summary> [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Resources.ResourceManager ResourceManager { get { if (object.ReferenceEquals(resourceMan, null)) { #if WINDOWS global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ZombustersWindows.Localization.Strings", typeof(Strings).Assembly); #elif LINUX global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ZombustersLinux.Localization.Strings", typeof(Strings).Assembly); #elif NETCOREAPP global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ZombustersMac.Localization.Strings", typeof(Strings).Assembly); #endif resourceMan = temp; } return resourceMan; } } /// <summary> /// Reemplaza la propiedad CurrentUICulture del subproceso actual para todas las /// búsquedas de recursos mediante esta clase de recurso fuertemente tipado. /// </summary> [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Globalization.CultureInfo Culture { get { return resourceCulture; } set { resourceCulture = value; } } /// <summary> /// Busca una cadena traducida similar a CHALLENGES. /// </summary> internal static string AchievementsMenuString { get { return ResourceManager.GetString("AchievementsMenuString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Show challenges list.. /// </summary> internal static string AchievementsMMString { get { return ResourceManager.GetString("AchievementsMMString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Zombusters uses an Autosave feature wich will automatically ///save your progress throughout the title. Autosave will ///overwrite information without confirmation. Do not switch ///off the power when the autosave indication is present.. /// </summary> internal static string AutosaveStartMenuString { get { return ResourceManager.GetString("AutosaveStartMenuString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a AUTOSAVE. /// </summary> internal static string AutosaveTitleMenuString { get { return ResourceManager.GetString("AutosaveTitleMenuString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Back. /// </summary> internal static string BackString { get { return ResourceManager.GetString("BackString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Exit Without Saving. /// </summary> internal static string BackWithoutSavingString { get { return ResourceManager.GetString("BackWithoutSavingString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Cancel. /// </summary> internal static string CancelString { get { return ResourceManager.GetString("CancelString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Change Character. /// </summary> internal static string ChangeCharacterMenuString { get { return ResourceManager.GetString("ChangeCharacterMenuString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Change Language. /// </summary> internal static string ChangeLanguageOption { get { return ResourceManager.GetString("ChangeLanguageOption", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Change Sound/Music Volume. /// </summary> internal static string ChangeSoundVolumeMenuString { get { return ResourceManager.GetString("ChangeSoundVolumeMenuString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a SELECT CHARACTER. /// </summary> internal static string CharacterSelectString { get { return ResourceManager.GetString("CharacterSelectString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a CLEARED. /// </summary> internal static string ClearedGameplayString { get { return ResourceManager.GetString("ClearedGameplayString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Settings. /// </summary> internal static string ConfigurationString { get { return ResourceManager.GetString("ConfigurationString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Are you sure you want to end this session?. /// </summary> internal static string ConfirmEndSession { get { return ResourceManager.GetString("ConfirmEndSession", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Are you sure you want to exit this sample?. /// </summary> internal static string ConfirmExitSample { get { return ResourceManager.GetString("ConfirmExitSample", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Are you sure you want to start the game,. /// </summary> internal static string ConfirmForceStartGame { get { return ResourceManager.GetString("ConfirmForceStartGame", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Are you sure you want to leave this session?. /// </summary> internal static string ConfirmLeaveSession { get { return ResourceManager.GetString("ConfirmLeaveSession", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Online gameplay is not available in trial mode.. /// </summary> internal static string ConfirmMarketplace { get { return ResourceManager.GetString("ConfirmMarketplace", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Are you sure you want to quit this game?. /// </summary> internal static string ConfirmQuitGame { get { return ResourceManager.GetString("ConfirmQuitGame", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a You will return to matchmaking menu. /// </summary> internal static string ConfirmReturnMainMenuMMString { get { return ResourceManager.GetString("ConfirmReturnMainMenuMMString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Are you sure you want to exit?. /// </summary> internal static string ConfirmReturnMainMenuString { get { return ResourceManager.GetString("ConfirmReturnMainMenuString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a CONGRATULATIONS!. /// </summary> internal static string CongratssEndGameString { get { return ResourceManager.GetString("CongratssEndGameString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Connect controller to play. /// </summary> internal static string ConnectControllerToJoinString { get { return ResourceManager.GetString("ConnectControllerToJoinString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a © RETROWAX GAMES. 2011-2020 ALL RIGHTS RESERVED. /// </summary> internal static string CopyRightString { get { return ResourceManager.GetString("CopyRightString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a CREATE GAME. /// </summary> internal static string CreateGameMenuString { get { return ResourceManager.GetString("CreateGameMenuString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Host a game.. /// </summary> internal static string CreateGameMMString { get { return ResourceManager.GetString("CreateGameMMString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Create Session. /// </summary> internal static string CreateSession { get { return ResourceManager.GetString("CreateSession", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a CREDITS. /// </summary> internal static string CreditsMenuString { get { return ResourceManager.GetString("CreditsMenuString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Show creator credits.. /// </summary> internal static string CreditsMMString { get { return ResourceManager.GetString("CreditsMMString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a THANKS FOR PLAYING!. /// </summary> internal static string CreditsThanksForPlayingString { get { return ResourceManager.GetString("CreditsThanksForPlayingString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a CUSTOM MATCH. /// </summary> internal static string CustomMatchMenuString { get { return ResourceManager.GetString("CustomMatchMenuString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Search for a game session to join within a set of ///parameters.. /// </summary> internal static string CustomMatchMMString { get { return ResourceManager.GetString("CustomMatchMMString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a We hope you have enjoyed the Demo. /// </summary> internal static string DemoEndScreenLine1 { get { return ResourceManager.GetString("DemoEndScreenLine1", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Prepare for more kind of enemies, more weapons, more power-ups and more surprises!. /// </summary> internal static string DemoEndScreenLine2 { get { return ResourceManager.GetString("DemoEndScreenLine2", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Be sure to stop by the Steam page and add the game to your Wishlist. /// </summary> internal static string DemoEndScreenLine3 { get { return ResourceManager.GetString("DemoEndScreenLine3", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Zombusters will be released fall 2020. /// </summary> internal static string DemoEndScreenLine4 { get { return ResourceManager.GetString("DemoEndScreenLine4", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a End Session. /// </summary> internal static string EndSession { get { return ResourceManager.GetString("EndSession", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Lost connection to the network session. /// </summary> internal static string ErrorDisconnected { get { return ResourceManager.GetString("ErrorDisconnected", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a You must sign in a suitable gamer profile. /// </summary> internal static string ErrorGamerPrivilege { get { return ResourceManager.GetString("ErrorGamerPrivilege", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Host ended the session. /// </summary> internal static string ErrorHostEndedSession { get { return ResourceManager.GetString("ErrorHostEndedSession", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a There was an error while. /// </summary> internal static string ErrorNetwork { get { return ResourceManager.GetString("ErrorNetwork", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Networking is turned. /// </summary> internal static string ErrorNetworkNotAvailable { get { return ResourceManager.GetString("ErrorNetworkNotAvailable", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Host kicked you out of the session. /// </summary> internal static string ErrorRemovedByHost { get { return ResourceManager.GetString("ErrorRemovedByHost", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a This session is already full. /// </summary> internal static string ErrorSessionFull { get { return ResourceManager.GetString("ErrorSessionFull", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Session not found. It may have ended,. /// </summary> internal static string ErrorSessionNotFound { get { return ResourceManager.GetString("ErrorSessionNotFound", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a You must wait for the host to return to. /// </summary> internal static string ErrorSessionNotJoinable { get { return ResourceManager.GetString("ErrorSessionNotJoinable", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a This functionality is not available in trial mode. /// </summary> internal static string ErrorTrialMode { get { return ResourceManager.GetString("ErrorTrialMode", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a An unknown error occurred. /// </summary> internal static string ErrorUnknown { get { return ResourceManager.GetString("ErrorUnknown", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Exit. /// </summary> internal static string Exit { get { return ResourceManager.GetString("Exit", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a EXTRAS. /// </summary> internal static string ExtrasMenuString { get { return ResourceManager.GetString("ExtrasMenuString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Show the Extras menu. You can check how to play, ///Scoreboards or Credits.. /// </summary> internal static string ExtrasMMString { get { return ResourceManager.GetString("ExtrasMMString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a FIND SESSION. /// </summary> internal static string FindSessionMenuString { get { return ResourceManager.GetString("FindSessionMenuString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Find session to play.. /// </summary> internal static string FindSessionMMString { get { return ResourceManager.GetString("FindSessionMMString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Find Sessions. /// </summary> internal static string FindSessions { get { return ResourceManager.GetString("FindSessions", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a This party is open to friends.. /// </summary> internal static string FriendOpenGroupString { get { return ResourceManager.GetString("FriendOpenGroupString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Toggle full screen mode. /// </summary> internal static string FullScreenMenuString { get { return ResourceManager.GetString("FullScreenMenuString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a GAME OVER. /// </summary> internal static string GameOverString { get { return ResourceManager.GetString("GameOverString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Restart from current wave. /// </summary> internal static string GPRestartCurrentWaveString { get { return ResourceManager.GetString("GPRestartCurrentWaveString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Restart from beginning. /// </summary> internal static string GPRestartFromBeginningString { get { return ResourceManager.GetString("GPRestartFromBeginningString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a You are about to return to the party lobby. Any unsaved progress will be lost.. /// </summary> internal static string GPReturnLobbySupportString { get { return ResourceManager.GetString("GPReturnLobbySupportString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a You are about to return to the main menu. The session will disband, and any unsaved progress will be lost.. /// </summary> internal static string GPReturnMMSupportString { get { return ResourceManager.GetString("GPReturnMMSupportString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Return to Main Menu. /// </summary> internal static string GPReturnToMainMenuString { get { return ResourceManager.GetString("GPReturnToMainMenuString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a (host). /// </summary> internal static string HostSuffix { get { return ResourceManager.GetString("HostSuffix", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a HOW TO PLAY. /// </summary> internal static string HowToPlayInGameString { get { return ResourceManager.GetString("HowToPlayInGameString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a AIM + SHOOT. /// </summary> internal static string HTPAimShootString { get { return ResourceManager.GetString("HTPAimShootString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a CHANGE SONG. /// </summary> internal static string HTPChangeSongString { get { return ResourceManager.GetString("HTPChangeSongString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a CHANGE WEAPON. /// </summary> internal static string HTPChangeWeaponString { get { return ResourceManager.GetString("HTPChangeWeaponString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Use the Left Thumbstick to move your character. ///Use the Right Thumbsitck to fire at the Zombies. ///Shoot the enemies to accumulate points and to get ///PowerUps. Catch the PowerUps to gain a free life ///or a new Weapon.. /// </summary> internal static string HTPExplanationString { get { return ResourceManager.GetString("HTPExplanationString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a GRENADE. /// </summary> internal static string HTPGrenadeString { get { return ResourceManager.GetString("HTPGrenadeString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a How to play Zombusters.. /// </summary> internal static string HTPMenuSupportString { get { return ResourceManager.GetString("HTPMenuSupportString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a MOVE. /// </summary> internal static string HTPMoveString { get { return ResourceManager.GetString("HTPMoveString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a PAUSE GAME. /// </summary> internal static string HTPPauseString { get { return ResourceManager.GetString("HTPPauseString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a REVIVE TEAMMATE. /// </summary> internal static string HTPReviveTeammateString { get { return ResourceManager.GetString("HTPReviveTeammateString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a TAUNT. /// </summary> internal static string HTPTauntString { get { return ResourceManager.GetString("HTPTauntString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Invite. /// </summary> internal static string InviteMenuString { get { return ResourceManager.GetString("InviteMenuString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Join Session. /// </summary> internal static string JoinSession { get { return ResourceManager.GetString("JoinSession", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a LEADERBOARDS. /// </summary> internal static string LeaderboardMenuString { get { return ResourceManager.GetString("LeaderboardMenuString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Check out the score of your friends online or Local. /// </summary> internal static string LeaderboardMMString { get { return ResourceManager.GetString("LeaderboardMMString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a SCORE. /// </summary> internal static string LeaderboardScoreString { get { return ResourceManager.GetString("LeaderboardScoreString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Leave. /// </summary> internal static string LeaveMenuString { get { return ResourceManager.GetString("LeaveMenuString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Leave Session. /// </summary> internal static string LeaveSession { get { return ResourceManager.GetString("LeaveSession", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a LEVEL SELECTION. /// </summary> internal static string LevelSelectionString { get { return ResourceManager.GetString("LevelSelectionString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a LEVEL. /// </summary> internal static string LevelSelectMenuString { get { return ResourceManager.GetString("LevelSelectMenuString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Choose the level to play.. /// </summary> internal static string LevelSelectMMString { get { return ResourceManager.GetString("LevelSelectMMString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Loading.... /// </summary> internal static string Loading { get { return ResourceManager.GetString("Loading", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Lobby. /// </summary> internal static string Lobby { get { return ResourceManager.GetString("Lobby", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a LOBBY. /// </summary> internal static string LobbyMenuString { get { return ResourceManager.GetString("LobbyMenuString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Start a local game. You can play with three more ///players on the same console.. /// </summary> internal static string LocalGameMMString { get { return ResourceManager.GetString("LocalGameMMString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a LOCAL GAME. /// </summary> internal static string LocalGameString { get { return ResourceManager.GetString("LocalGameString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Main Menu. /// </summary> internal static string MainMenu { get { return ResourceManager.GetString("MainMenu", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a In Main Menu Lobby. /// </summary> internal static string MainMenuLobbyString { get { return ResourceManager.GetString("MainMenuLobbyString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a MAIN MENU. /// </summary> internal static string MainMenuString { get { return ResourceManager.GetString("MainMenuString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Would you like to host a new game?. /// </summary> internal static string MatchmakingHostOwnGameString { get { return ResourceManager.GetString("MatchmakingHostOwnGameString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a In Matchmaking Lobby. /// </summary> internal static string MatchmakingLobbyString { get { return ResourceManager.GetString("MatchmakingLobbyString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a MATCHMAKING. /// </summary> internal static string MatchmakingMenuString { get { return ResourceManager.GetString("MatchmakingMenuString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Take your party to Xbox LIVE and into the frenetic ///action of live combat. Up to four players co-operate ///to survive wave after wave of the Zombie horde.. /// </summary> internal static string MatchmakingMMString { get { return ResourceManager.GetString("MatchmakingMMString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a MAX. PLAYERS. /// </summary> internal static string MaxPlayersMenuString { get { return ResourceManager.GetString("MaxPlayersMenuString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a How many players would you like to play?. /// </summary> internal static string MaxPlayersMMString { get { return ResourceManager.GetString("MaxPlayersMMString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a . /// </summary> internal static string MessageBoxUsage { get { return ResourceManager.GetString("MessageBoxUsage", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a {0} joined. /// </summary> internal static string MessageGamerJoined { get { return ResourceManager.GetString("MessageGamerJoined", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a {0} left. /// </summary> internal static string MessageGamerLeft { get { return ResourceManager.GetString("MessageGamerLeft", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Music Volume. /// </summary> internal static string MusicVolumeString { get { return ResourceManager.GetString("MusicVolumeString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a MY PARTY. /// </summary> internal static string MyGroupString { get { return ResourceManager.GetString("MyGroupString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Networking.... /// </summary> internal static string NetworkBusy { get { return ResourceManager.GetString("NetworkBusy", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Choose your Network for the Matchmaking. Play a ///SystemLink or Xbox Live game.. /// </summary> internal static string NetworkMatchmakingMMString { get { return ResourceManager.GetString("NetworkMatchmakingMMString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a NETWORK. /// </summary> internal static string NetworkMatchmakingString { get { return ResourceManager.GetString("NetworkMatchmakingString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a No sessions found. /// </summary> internal static string NoSessionsFound { get { return ResourceManager.GetString("NoSessionsFound", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Eight. /// </summary> internal static string NumberEight { get { return ResourceManager.GetString("NumberEight", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Five. /// </summary> internal static string NumberFive { get { return ResourceManager.GetString("NumberFive", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Four. /// </summary> internal static string NumberFour { get { return ResourceManager.GetString("NumberFour", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Nine. /// </summary> internal static string NumberNine { get { return ResourceManager.GetString("NumberNine", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a One. /// </summary> internal static string NumberOne { get { return ResourceManager.GetString("NumberOne", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Seven. /// </summary> internal static string NumberSeven { get { return ResourceManager.GetString("NumberSeven", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Six. /// </summary> internal static string NumberSix { get { return ResourceManager.GetString("NumberSix", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Ten. /// </summary> internal static string NumberTen { get { return ResourceManager.GetString("NumberTen", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Three. /// </summary> internal static string NumberThree { get { return ResourceManager.GetString("NumberThree", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Two. /// </summary> internal static string NumberTwo { get { return ResourceManager.GetString("NumberTwo", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Player 1 Press Start. /// </summary> internal static string P1PressStartString { get { return ResourceManager.GetString("P1PressStartString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Player 2 Press Start. /// </summary> internal static string P2PressStartString { get { return ResourceManager.GetString("P2PressStartString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Player 3 Press Start. /// </summary> internal static string P3PressStartString { get { return ResourceManager.GetString("P3PressStartString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Player 4 Press Start. /// </summary> internal static string P4PressStartString { get { return ResourceManager.GetString("P4PressStartString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Invite Party. /// </summary> internal static string PartyMenuString { get { return ResourceManager.GetString("PartyMenuString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Paused. /// </summary> internal static string Paused { get { return ResourceManager.GetString("Paused", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Use A,S,D,W or Arrows to move your character. ///Use Left Mouse Button to fire at the Zombies. ///Shoot the enemies to accumulate points and to get ///PowerUps. Catch the PowerUps to gain a free life ///or a new Weapon.. /// </summary> internal static string PCExplanationString { get { return ResourceManager.GetString("PCExplanationString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Press Any Key. /// </summary> internal static string PCPressAnyKeyString { get { return ResourceManager.GetString("PCPressAnyKeyString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Player Four. /// </summary> internal static string PlayerFourString { get { return ResourceManager.GetString("PlayerFourString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a LIVE. /// </summary> internal static string PlayerMatch { get { return ResourceManager.GetString("PlayerMatch", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Player One. /// </summary> internal static string PlayerOneString { get { return ResourceManager.GetString("PlayerOneString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Press GUIDE to Sign In. /// </summary> internal static string PlayerSignInString { get { return ResourceManager.GetString("PlayerSignInString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Player Three. /// </summary> internal static string PlayerThreeString { get { return ResourceManager.GetString("PlayerThreeString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Player Two. /// </summary> internal static string PlayerTwoString { get { return ResourceManager.GetString("PlayerTwoString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Starts playlist for the selected Machmaking configuration.. /// </summary> internal static string PlaylistMatchmakingMMString { get { return ResourceManager.GetString("PlaylistMatchmakingMMString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a PLAYLIST. /// </summary> internal static string PlaylistMatchmakingString { get { return ResourceManager.GetString("PlaylistMatchmakingString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Prepare for the next Wave. /// </summary> internal static string PrepareNextWaveGameplayString { get { return ResourceManager.GetString("PrepareNextWaveGameplayString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Press START button. /// </summary> internal static string PressStartString { get { return ResourceManager.GetString("PressStartString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a PRIVATE SLOTS. /// </summary> internal static string PrivateSlotsMenuString { get { return ResourceManager.GetString("PrivateSlotsMenuString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Select number of private slots.. /// </summary> internal static string PrivateSlotsMMString { get { return ResourceManager.GetString("PrivateSlotsMMString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a QUICK MATCH. /// </summary> internal static string QuickMatchMenuString { get { return ResourceManager.GetString("QuickMatchMenuString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Quickly join another player&apos;s game session.. /// </summary> internal static string QuickMatchMMString { get { return ResourceManager.GetString("QuickMatchMMString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a QUIT GAME. /// </summary> internal static string QuitGame { get { return ResourceManager.GetString("QuitGame", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Quit to Main Menu. /// </summary> internal static string QuitToMainMenuInGameString { get { return ResourceManager.GetString("QuitToMainMenuInGameString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Later. /// </summary> internal static string RateThisAppCancel { get { return ResourceManager.GetString("RateThisAppCancel", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Yes!. /// </summary> internal static string RateThisAppOK { get { return ResourceManager.GetString("RateThisAppOK", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Did you like Zombusters? Please help rating this app in the marketplace. Thank you!. /// </summary> internal static string RateThisAppText { get { return ResourceManager.GetString("RateThisAppText", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Rate this App. /// </summary> internal static string RateThisAppTitle { get { return ResourceManager.GetString("RateThisAppTitle", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a READY. /// </summary> internal static string ReadySelPlayerString { get { return ResourceManager.GetString("ReadySelPlayerString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Please Reconnect Controller. /// </summary> internal static string ReconnectControllerString { get { return ResourceManager.GetString("ReconnectControllerString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Restart Level. /// </summary> internal static string RestartLevelInGameString { get { return ResourceManager.GetString("RestartLevelInGameString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Resume Game. /// </summary> internal static string ResumeGame { get { return ResourceManager.GetString("ResumeGame", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Quit game and return to Xbox Dashboard.. /// </summary> internal static string ReturnToDashboardMMString { get { return ResourceManager.GetString("ReturnToDashboardMMString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a QUIT TO XBOX DASHBOARD. /// </summary> internal static string ReturnToDashboardString { get { return ResourceManager.GetString("ReturnToDashboardString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Return to Lobby. /// </summary> internal static string ReturnToLobby { get { return ResourceManager.GetString("ReturnToLobby", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a REVIEW APP. /// </summary> internal static string ReviewMenuString { get { return ResourceManager.GetString("ReviewMenuString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Please help us and review Zombusters! Thanks!. /// </summary> internal static string ReviewMMString { get { return ResourceManager.GetString("ReviewMMString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Save and Exit. /// </summary> internal static string SaveAndExitString { get { return ResourceManager.GetString("SaveAndExitString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Select. /// </summary> internal static string SelectString { get { return ResourceManager.GetString("SelectString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a SETTINGS. /// </summary> internal static string SettingsMenuString { get { return ResourceManager.GetString("SettingsMenuString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Show Gamer Card. /// </summary> internal static string ShowGamerCardMenuString { get { return ResourceManager.GetString("ShowGamerCardMenuString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Single Player. /// </summary> internal static string SinglePlayer { get { return ResourceManager.GetString("SinglePlayer", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Sound Effect Volume. /// </summary> internal static string SoundEffectVolumeString { get { return ResourceManager.GetString("SoundEffectVolumeString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Start Game. /// </summary> internal static string StartGameMenuString { get { return ResourceManager.GetString("StartGameMenuString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a START MATCHMAKING. /// </summary> internal static string StartMatchmakingMenuString { get { return ResourceManager.GetString("StartMatchmakingMenuString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Starts Matchmaking.. /// </summary> internal static string StartMatchmakingMMString { get { return ResourceManager.GetString("StartMatchmakingMMString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a MARKETPLACE. /// </summary> internal static string StoreMenuString { get { return ResourceManager.GetString("StoreMenuString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Check out our merchandise on our Official Store at Redbubble. /// </summary> internal static string StoreMMString { get { return ResourceManager.GetString("StoreMMString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a even though not all players are ready?. /// </summary> internal static string String { get { return ResourceManager.GetString("String", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Would you like to purchase this game?. /// </summary> internal static string String1 { get { return ResourceManager.GetString("String1", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a in order to access this functionality. /// </summary> internal static string String2 { get { return ResourceManager.GetString("String2", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a accessing the network. /// </summary> internal static string String3 { get { return ResourceManager.GetString("String3", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a off or not connected. /// </summary> internal static string String4 { get { return ResourceManager.GetString("String4", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a or there may be no network connectivity. /// </summary> internal static string String5 { get { return ResourceManager.GetString("String5", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a between the local machine and session host. /// </summary> internal static string String6 { get { return ResourceManager.GetString("String6", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a the lobby before you can join this session. /// </summary> internal static string String7 { get { return ResourceManager.GetString("String7", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a A button, Space, Enter = ok. /// </summary> internal static string String8 { get { return ResourceManager.GetString("String8", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a B button, Esc = cancel. /// </summary> internal static string String9 { get { return ResourceManager.GetString("String9", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Switch Ready. /// </summary> internal static string SwitchReadyMenuString { get { return ResourceManager.GetString("SwitchReadyMenuString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a System Link. /// </summary> internal static string SystemLink { get { return ResourceManager.GetString("SystemLink", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Toggle Ready. /// </summary> internal static string ToggleReadyMenuString { get { return ResourceManager.GetString("ToggleReadyMenuString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Trial Mode. /// </summary> internal static string TrialModeMenuString { get { return ResourceManager.GetString("TrialModeMenuString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Unlock Full Game. /// </summary> internal static string UnlockFullGameMenuString { get { return ResourceManager.GetString("UnlockFullGameMenuString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a For more info and news!. /// </summary> internal static string VisitRetrowaxMenuStringWP { get { return ResourceManager.GetString("VisitRetrowaxMenuStringWP", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Waiting for players.... /// </summary> internal static string WaitingForPlayersMenuString { get { return ResourceManager.GetString("WaitingForPlayersMenuString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a WAVE. /// </summary> internal static string WaveGameplayString { get { return ResourceManager.GetString("WaveGameplayString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a ADD ZOMBUSTERS TO MY WISHLIST. /// </summary> internal static string WishListGameMenu { get { return ResourceManager.GetString("WishListGameMenu", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a If you want to support us we would appreciate if you add Zombusters to your wishlist.. /// </summary> internal static string WishListGameMenuHelp { get { return ResourceManager.GetString("WishListGameMenuHelp", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a PLAY. /// </summary> internal static string WPPlayNewGame { get { return ResourceManager.GetString("WPPlayNewGame", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Start a new game.. /// </summary> internal static string WPPlayNewGameMMString { get { return ResourceManager.GetString("WPPlayNewGameMMString", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Shake your device to change the song currently played. /// </summary> internal static string WPShakeToChangeSong { get { return ResourceManager.GetString("WPShakeToChangeSong", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Tap screen to start. /// </summary> internal static string WPTapScreen { get { return ResourceManager.GetString("WPTapScreen", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a Tip:. /// </summary> internal static string WPTip { get { return ResourceManager.GetString("WPTip", resourceCulture); } } /// <summary> /// Busca una cadena traducida similar a You saved the city! You are the new city Hero!. /// </summary> internal static string YouSavedCityEndGameString { get { return ResourceManager.GetString("YouSavedCityEndGameString", resourceCulture); } } } } <|start_filename|>ZombustersWindows/GameObjects/Player.cs<|end_filename|> using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ZombustersWindows.Subsystem_Managers; namespace ZombustersWindows { public class Player { private static readonly string OPTIONS_FILENAME = "options.xml"; private static readonly string LEADERBOARD_FILENAME = "leaderboard.txt"; private static readonly string SAVE_GAME_FILENAME = "savegame.sav"; public bool IsPlaying; public PlayerIndex playerIndex; public bool IsRemote; public InputMode inputMode = InputMode.NotExistent; public NeutralInput neutralInput; public OptionsState optionsState; public AudioManager audioManager; public bool isReady; public int characterSelected; public int levelsUnlocked; private readonly MyGame game; public Texture2D gamerPicture; public Avatar avatar; public string Name { get; set; } public struct SaveGameData { public string PlayerName; public int Level; } public Player(OptionsState options, AudioManager audio, MyGame game, Color color, string name, Viewport viewport) { this.optionsState = options; this.audioManager = audio; this.game = game; this.avatar = new Avatar(color); this.avatar.Initialize(viewport); this.inputMode = InputMode.NotExistent; this.Name = name; } #region Managing Gamer Presence //GamerPresenceMode previousMode; public void BeginPause() { //if (SignedInGamer != null) //{ // previousMode = this.SignedInGamer.Presence.PresenceMode; // this.SignedInGamer.Presence.PresenceMode = GamerPresenceMode.Paused; //} } public void EndPause() { //if (SignedInGamer != null) // this.SignedInGamer.Presence.PresenceMode = previousMode; } #endregion public void SaveGame(int currentLevelNumber) { SaveGameData data = new SaveGameData { PlayerName = this.Name, Level = currentLevelNumber }; if (this.levelsUnlocked >= currentLevelNumber) return; game.storageDataSource.SaveXMLFile(SAVE_GAME_FILENAME, data); } public void LoadSavedGame() { SaveGameData data = new SaveGameData(); data = (SaveGameData)game.storageDataSource.LoadXMLFile(SAVE_GAME_FILENAME, data); this.levelsUnlocked = (byte)data.Level; } public void SaveOptions() { game.storageDataSource.SaveXMLFile(OPTIONS_FILENAME, optionsState); } public void LoadOptions() { optionsState = new OptionsState { FXLevel = 0.7f, MusicLevel = 0.6f, Player = InputMode.Keyboard, FullScreenMode = false }; optionsState = (OptionsState)game.storageDataSource.LoadXMLFile(OPTIONS_FILENAME, optionsState); audioManager.SetOptions(optionsState.FXLevel, optionsState.MusicLevel); if (optionsState.FullScreenMode && game.graphics.IsFullScreen == false) { int screenWidth = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width; int screenHeight = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height; Resolution.SetResolution(screenWidth, screenHeight, true); optionsState.FullScreenMode = true; game.graphics.IsFullScreen = false; game.graphics.ToggleFullScreen(); } } public void LoadLeaderBoard() { LoadDefaultLeaderBoard(); TopScoreListContainer topScoreListContainer = game.storageDataSource.LoadScoreList(LEADERBOARD_FILENAME); if (topScoreListContainer != null) { game.topScoreListContainer = topScoreListContainer; } } public void SaveLeaderBoard() { TopScoreEntry entry = new TopScoreEntry(Name, avatar.score); game.topScoreListContainer.addEntry(0, entry); game.storageDataSource.SaveScoreListToFile(LEADERBOARD_FILENAME, game.topScoreListContainer.scoreList); } private void LoadDefaultLeaderBoard() { // Create a List and a fake list if (game != null) { game.topScoreListContainer = new TopScoreListContainer(1, 10); string gtag; int fakescore; int i; for (i = 0; i < 10; i++) { switch (i) { case 0: gtag = "<NAME>"; fakescore = 100000; break; case 1: gtag = "<NAME>"; fakescore = 50000; break; case 2: gtag = "<NAME>"; fakescore = 25000; break; case 3: gtag = "<NAME>"; fakescore = 12500; break; case 4: gtag = "<NAME>"; fakescore = 7500; break; case 5: gtag = "<NAME>"; fakescore = 5000; break; case 6: gtag = "<NAME>"; fakescore = 2500; break; case 7: gtag = "<NAME>"; fakescore = 1000; break; case 8: gtag = "<NAME>"; fakescore = 500; break; case 9: gtag = "Lora Craft"; fakescore = 250; break; default: gtag = "Solid Smoke"; fakescore = 100; break; } TopScoreEntry entry = new TopScoreEntry(gtag, fakescore); game.topScoreListContainer.addEntry(0, entry); } } } public void Destroy() { avatar.DestroyAvatar(game.totalGameSeconds); avatar.lives--; if (avatar.character == 0) { game.audio.PlayWomanScream(); } else { game.audio.PlayManScream(); } if (avatar.lives == 0) { if (avatar.IsPlayingTheGame) { if (game.topScoreListContainer != null && avatar.score > 250) { SaveLeaderBoard(); //SaveGame(Level.getLevelNumber(currentLevel)); } } } } } } <|start_filename|>ZombustersWindows/MenuScreens/CreditsScreen.cs<|end_filename|> using System; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using GameStateManagement; using ZombustersWindows.Subsystem_Managers; using Microsoft.Xna.Framework.Input.Touch; using ZombustersWindows.Localization; using GameAnalyticsSDK.Net; namespace ZombustersWindows { public class CreditsScreen : BackgroundScreen { Rectangle uiBounds; Rectangle titleBounds; Vector2 selectPos; Texture2D btnB; Texture2D Title; SpriteFont MenuHeaderFont; SpriteFont MenuInfoFont; SpriteFont MenuListFont; Texture2D submit_button; Texture2D kbEsc; private MenuComponent menu; //private BloomComponent bloom; ScrollingTextManager mText; String Texto; bool canLeaveScreen; public CreditsScreen(bool canLeaveScreen) { this.canLeaveScreen = canLeaveScreen; } public override void Initialize() { Viewport view = this.ScreenManager.GraphicsDevice.Viewport; int borderheight = (int)(view.Height * .05); uiBounds = GetTitleSafeArea(); titleBounds = new Rectangle(115, 65, 1000, 323); selectPos = new Vector2(uiBounds.X + 60, uiBounds.Bottom - 30); MenuHeaderFont = this.ScreenManager.Game.Content.Load<SpriteFont>(@"Menu\ArialMenuHeader"); MenuInfoFont = this.ScreenManager.Game.Content.Load<SpriteFont>(@"Menu\ArialMenuInfo"); MenuListFont = this.ScreenManager.Game.Content.Load<SpriteFont>(@"Menu\ArialMenuList"); menu = new MenuComponent(this.ScreenManager.Game, MenuListFont); menu.Initialize(); menu.uiBounds = menu.Extents; menu.uiBounds.Offset(uiBounds.X, 300); menu.MenuCanceled += new EventHandler<MenuSelection>(menu_MenuCanceled); menu.CenterInXLeftMenu(view); System.IO.Stream stream = TitleContainer.OpenStream(@"LevelXMLs\Credits.txt"); System.IO.StreamReader sreader = new System.IO.StreamReader(stream); Texto = sreader.ReadToEnd(); sreader.Dispose(); stream.Dispose(); //bloom.Visible = !bloom.Visible; base.Initialize(); this.isBackgroundOn = true; GameAnalytics.AddDesignEvent("ScreenView:Extras:Credits:View"); } void menu_MenuCanceled(Object sender, MenuSelection selection) { if (canLeaveScreen == true) { ExitScreen(); } } public override void LoadContent() { Title = this.ScreenManager.Game.Content.Load<Texture2D>("title"); btnB = this.ScreenManager.Game.Content.Load<Texture2D>("xboxControllerButtonB"); kbEsc = this.ScreenManager.Game.Content.Load<Texture2D>(@"Keyboard/key_esc"); submit_button = this.ScreenManager.Game.Content.Load<Texture2D>(@"Menu/submit_button_mobile"); mText = new ScrollingTextManager(new Rectangle(0, 280, 1280, 440), MenuInfoFont, Texto); base.LoadContent(); } public override void HandleInput(InputState input) { foreach (GestureSample gesture in input.GetGestures()) { if (gesture.GestureType == GestureType.Tap) { if ((gesture.Position.X >= 156 && gesture.Position.X <= 442) && (gesture.Position.Y >= 614 && gesture.Position.Y <= 650)) { if (canLeaveScreen == true) { ExitScreen(); } } } } menu.HandleInput(input); base.HandleInput(input); } public override void Update(GameTime gameTime, bool otherScreenHasFocus, bool coveredByOtherScreen) { if (!coveredByOtherScreen) { menu.Update(gameTime); } mText.Update(gameTime); if (mText.endOfLines == true) { canLeaveScreen = true; } base.Update(gameTime, otherScreenHasFocus, coveredByOtherScreen); } public override void Draw(GameTime gameTime) { int distanceBetweenButtonsText = 0; int spaceBetweenButtonAndText = 0; int spaceBetweenButtons = 30; base.Draw(gameTime); this.ScreenManager.SpriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, null, null, null, Resolution.getTransformationMatrix()); this.ScreenManager.SpriteBatch.Draw(Title, titleBounds, Color.White); mText.Draw(this.ScreenManager.SpriteBatch); if (canLeaveScreen) { if (((MyGame)this.ScreenManager.Game).currentInputMode != InputMode.Touch) { if (((MyGame)this.ScreenManager.Game).currentInputMode == InputMode.Keyboard) { spaceBetweenButtonAndText = Convert.ToInt32(kbEsc.Width * 0.7f) + 5; this.ScreenManager.SpriteBatch.Draw(kbEsc, new Vector2(158 + distanceBetweenButtonsText, 613), null, Color.White, 0, Vector2.Zero, 0.7f, SpriteEffects.None, 1.0f); } else { spaceBetweenButtonAndText = Convert.ToInt32(btnB.Width * 0.33f) + 5; this.ScreenManager.SpriteBatch.Draw(btnB, new Vector2(158 + distanceBetweenButtonsText, 613), null, Color.White, 0, Vector2.Zero, 0.33f, SpriteEffects.None, 1.0f); } this.ScreenManager.SpriteBatch.DrawString(MenuInfoFont, Strings.LeaveMenuString, new Vector2(158 + spaceBetweenButtonAndText + distanceBetweenButtonsText, 613 + 4), Color.White); distanceBetweenButtonsText = distanceBetweenButtonsText + Convert.ToInt32(MenuInfoFont.MeasureString(Strings.LeaveMenuString).X) + spaceBetweenButtonAndText + spaceBetweenButtons; } else { Vector2 position = new Vector2(158, 613); this.ScreenManager.SpriteBatch.Draw(submit_button, position, Color.White); this.ScreenManager.SpriteBatch.DrawString(MenuInfoFont, Strings.LeaveMenuString.ToUpper(), new Vector2(position.X + 2 + submit_button.Width / 2 - MenuInfoFont.MeasureString(Strings.LeaveMenuString.ToUpper()).X / 2, position.Y + 9), Color.Black, 0, Vector2.Zero, 1.0f, SpriteEffects.None, 1.0f); this.ScreenManager.SpriteBatch.DrawString(MenuInfoFont, Strings.LeaveMenuString.ToUpper(), new Vector2(position.X + submit_button.Width / 2 - MenuInfoFont.MeasureString(Strings.LeaveMenuString.ToUpper()).X / 2, position.Y + 7), Color.White, 0, Vector2.Zero, 1.0f, SpriteEffects.None, 1.0f); } } if (mText.endOfLines) { this.ScreenManager.SpriteBatch.DrawString(MenuListFont, Strings.CreditsThanksForPlayingString, new Vector2(uiBounds.Center.X - MenuListFont.MeasureString(Strings.CreditsThanksForPlayingString).X / 2, uiBounds.Center.Y + 50), Color.White); } this.ScreenManager.SpriteBatch.End(); menu.DrawLogoRetrowaxMenu(this.ScreenManager.SpriteBatch, new Vector2(uiBounds.Width, uiBounds.Height), MenuInfoFont); } } } <|start_filename|>ZombustersWindows/GameObjects/Enemies/Tank.cs<|end_filename|> using System; using System.Collections.Generic; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Content; using Microsoft.Xna.Framework.Graphics; using System.Globalization; using ZombustersWindows.Subsystem_Managers; namespace ZombustersWindows { public class Tank : BaseEnemy { public const float VELOCIDAD_MAXIMA = 1.0f; public const float FUERZA_MAXIMA = 0.15f; public Texture2D TankTexture, TankShadow; private Vector2 TankOrigin; private Animation TankAnimation; public Tank(Vector2 velocidad, Vector2 posicion, float boundingRadius) { this.entity = new SteeringEntity { Width = this.TankTexture.Width, Height = this.TankTexture.Height, Velocity = velocidad, Position = posicion, BoundingRadius = boundingRadius, MaxSpeed = VELOCIDAD_MAXIMA }; this.status = ObjectStatus.Active; this.deathTimeTotalSeconds = 0; this.speed = 0; this.angle = 1f; this.TankOrigin = new Vector2(0, 0); this.TankAnimation = new Animation(TankTexture, new Point(), new Point(), TimeSpan.FromSeconds(1.0f)); behaviors = new SteeringBehaviors(FUERZA_MAXIMA, CombinationType.prioritized); } override public void LoadContent(ContentManager content) { base.LoadContent(content); // Load multiple animations form XML definition System.Xml.Linq.XDocument doc = System.Xml.Linq.XDocument.Load(AppContext.BaseDirectory + "/Content/AnimationDef.xml"); //ZOMBIE ANIMATION // Get the Zombie animation from the XML definition var definition = doc.Root.Element("ZombieDef"); TankTexture = content.Load<Texture2D>(@"InGame/tank"); TankShadow = content.Load<Texture2D>(@"InGame/character_shadow"); TankOrigin = new Vector2(TankTexture.Width / 2, TankTexture.Height / 2); Point frameSize = new Point(); frameSize.X = int.Parse(definition.Attribute("FrameWidth").Value, NumberStyles.Integer); frameSize.Y = int.Parse(definition.Attribute("FrameHeight").Value, NumberStyles.Integer); Point sheetSize = new Point(); sheetSize.X = int.Parse(definition.Attribute("SheetColumns").Value, NumberStyles.Integer); sheetSize.Y = int.Parse(definition.Attribute("SheetRows").Value, NumberStyles.Integer); TimeSpan frameInterval = TimeSpan.FromSeconds(1.0f / int.Parse(definition.Attribute("Speed").Value, NumberStyles.Integer)); // Define a new Animation instance TankAnimation = new Animation(TankTexture, frameSize, sheetSize, frameInterval); //END ZOMBIE ANIMATION } override public void Update(GameTime gameTime, MyGame game, List<BaseEnemy> enemyList) { // Progress the Zombie animation bool isProgressed = TankAnimation.Update(gameTime); this.behaviors.Pursuit.Target = game.players[0].avatar.position; this.behaviors.Pursuit.UpdateEvaderEntity(game.players[0].avatar.entity); this.entity.Velocity += this.behaviors.Update(gameTime, this.entity); this.entity.Velocity = VectorHelper.TruncateVector(this.entity.Velocity, this.entity.MaxSpeed / 1.5f); this.entity.Position += this.entity.Velocity; } override public void Draw(SpriteBatch batch, float TotalGameSeconds, List<Furniture> furniturelist, GameTime gameTime) { float layerIndex = GetLayerIndex(this.entity, furniturelist); if (this.status == ObjectStatus.Active) { // Produce animation if (this.entity.Velocity.X > 0) { batch.Draw(this.TankTexture, this.entity.Position, null, Color.White, 0.0f, new Vector2(this.TankTexture.Width / 2.0f, this.TankTexture.Width / 2.0f), 1.0f, SpriteEffects.None, 0); } else { batch.Draw(this.TankTexture, this.entity.Position, null, Color.White, 0.0f, new Vector2(this.TankTexture.Width / 2.0f, this.TankTexture.Width / 2.0f), 1.0f, SpriteEffects.FlipHorizontally, 0); } // Draw Tank SHADOW! batch.Draw(this.TankShadow, new Vector2(this.entity.Position.X + 5, this.entity.Position.Y + this.TankTexture.Height), null, new Color(255, 255, 255, 50), 0.0f, new Vector2(0, 0), 1.0f, SpriteEffects.None, layerIndex + 0.1f); } } } } <|start_filename|>ZombustersWindows/MainScreens/SelectPlayerScreen.cs<|end_filename|> using System; using System.Collections.Generic; using System.Text.RegularExpressions; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Input; using Microsoft.Xna.Framework.Input.Touch; using GameStateManagement; using ZombustersWindows.Subsystem_Managers; using ZombustersWindows.Localization; using GameAnalyticsSDK.Net; namespace ZombustersWindows { public class SelectPlayerScreen : BackgroundScreen { private const int LINE_X_OFFSET = 40; private const int MENU_TITLE_Y_OFFSET = 400; MyGame game; Rectangle uiBounds; Vector2 selectPos; Texture2D btnLT; Texture2D btnRT; Texture2D logoMenu; Texture2D lineaMenu; Texture2D arrow; Texture2D myGroupBKG; Texture2D HTPHeaderImage; Texture2D kbUp; Texture2D kbDown; List<Texture2D> avatarTexture; List<Texture2D> avatarPixelatedTexture; List<Texture2D> cardBkgTexture; List<String> avatarNameList; SpriteFont DigitBigFont, DigitLowFont; SpriteFont MenuHeaderFont; SpriteFont MenuInfoFont; SpriteFont MenuListFont; private MenuComponent menu; readonly Boolean isMatchmaking; Boolean isMMandHost; public byte levelSelected; public SelectPlayerScreen(Boolean ismatchmaking) { this.isMatchmaking = ismatchmaking; } public override void Initialize() { this.game = (MyGame)this.ScreenManager.Game; byte i; Viewport view = this.ScreenManager.GraphicsDevice.Viewport; int borderheight = (int)(view.Height * .05); // Deflate 10% to provide for title safe area on CRT TVs uiBounds = GetTitleSafeArea(); //"Select" text position selectPos = new Vector2(uiBounds.X + 60, uiBounds.Bottom - 30); DigitBigFont = game.Content.Load<SpriteFont>(@"Menu\DigitBig"); DigitLowFont = game.Content.Load<SpriteFont>(@"Menu\DigitLow"); MenuHeaderFont = game.Content.Load<SpriteFont>(@"Menu\ArialMenuHeader"); MenuInfoFont = game.Content.Load<SpriteFont>(@"Menu\ArialMenuInfo"); MenuListFont = game.Content.Load<SpriteFont>(@"Menu\ArialMenuList"); HTPHeaderImage = this.ScreenManager.Game.Content.Load<Texture2D>(@"Menu/lobby_header_image"); menu = new MenuComponent(game, MenuListFont); menu.Initialize(); menu.uiBounds = menu.Extents; menu.uiBounds.Offset(uiBounds.X, 300); avatarTexture = new List<Texture2D>(4); avatarPixelatedTexture = new List<Texture2D>(4); cardBkgTexture = new List<Texture2D>(4); for (i = 0; i < game.players.Length; i++) { game.players[i].avatar.character = 0; } avatarNameList = new List<string>(4) { "Tracy", "Charles", "Ryan", "Peter" }; levelSelected = 1; isMMandHost = false; // TODO: Need to load all the saved games for all the players? game.players[0].LoadSavedGame(); base.Initialize(); this.isBackgroundOn = true; GameAnalytics.AddDesignEvent("ScreenView:SelectPlayer:View"); } public override void LoadContent() { byte i; kbUp = game.Content.Load<Texture2D>(@"Keyboard/key_up"); kbDown = game.Content.Load<Texture2D>(@"Keyboard/key_down"); btnLT = game.Content.Load<Texture2D>("xboxControllerLeftTrigger"); btnRT = game.Content.Load<Texture2D>("xboxControllerRightTrigger"); lineaMenu = game.Content.Load<Texture2D>(@"Menu/linea_menu"); logoMenu = game.Content.Load<Texture2D>(@"Menu/logo_menu"); arrow = game.Content.Load<Texture2D>(@"InGame/SelectPlayer/arrowLeft"); myGroupBKG = game.Content.Load<Texture2D>(@"Menu/mygroup_bkg"); for (i=1; i <= game.players.Length; i++) { avatarTexture.Add(game.Content.Load<Texture2D>(@"InGame/SelectPlayer/p" + i.ToString() + "Avatar")); avatarPixelatedTexture.Add(game.Content.Load<Texture2D>(@"InGame/SelectPlayer/p" + i.ToString() + "Avatar_pixel")); } cardBkgTexture.Add(game.Content.Load<Texture2D>(@"InGame/SelectPlayer/selpla_bkg")); cardBkgTexture.Add(game.Content.Load<Texture2D>(@"InGame/SelectPlayer/selpla_border")); cardBkgTexture.Add(game.Content.Load<Texture2D>(@"InGame/SelectPlayer/selpla_gradient")); cardBkgTexture.Add(game.Content.Load<Texture2D>(@"InGame/SelectPlayer/selpla_ready")); base.LoadContent(); } void ToggleReady(Player player) { if (player.isReady == true) { player.isReady = false; } else { GameAnalytics.AddDesignEvent("ScreenView:SelectPlayer:CharacterSelected", player.avatar.character); player.isReady = true; } } void ChangeCharacterSelected(Player player, Boolean directionToRight) { if (directionToRight == true) { if (player.isReady == false) { player.avatar.character += 1; if (player.avatar.character > 3) { player.avatar.character = 0; } } } else { if (player.isReady == false) { player.avatar.character -= 1; if (player.avatar.character < 0 || player.avatar.character > 3) { player.avatar.character = 3; } } } } public override void HandleInput(InputState input) { foreach (Player player in game.players) { player.neutralInput = ProcessPlayer(player, input); } base.HandleInput(input); } private NeutralInput ProcessPlayer(Player player, InputState input) { NeutralInput state = new NeutralInput { GamePadFire = Vector2.Zero }; Vector2 stickLeft = Vector2.Zero; Vector2 stickRight = Vector2.Zero; GamePadState gpState = input.GetCurrentGamePadStates()[(int)player.playerIndex]; if (player.IsPlaying) { if ((input.IsNewButtonPress(Buttons.A, player.playerIndex) && player.inputMode == InputMode.GamePad) || ((input.IsNewKeyPress(Keys.Space, player.playerIndex) && player.inputMode == InputMode.Keyboard))) { ToggleReady(player); state.ButtonA = true; } else { state.ButtonA = false; } if ((input.IsNewButtonPress(Buttons.DPadLeft, player.playerIndex) && player.inputMode == InputMode.GamePad) || ((input.IsNewButtonPress(Buttons.LeftThumbstickLeft, player.playerIndex) && player.inputMode == InputMode.GamePad) || ((input.IsNewKeyPress(Keys.Left, player.playerIndex) && player.inputMode == InputMode.Keyboard)))) { if ((gpState.DPad.Left == ButtonState.Pressed) || (gpState.ThumbSticks.Left.X < 0) || input.IsNewKeyPress(Keys.Left, player.playerIndex) ) { ChangeCharacterSelected(player, false); state.DPadLeft = true; } else { state.DPadLeft = false; } } else { state.DPadLeft = false; } if ((input.IsNewButtonPress(Buttons.DPadRight, player.playerIndex) && player.inputMode == InputMode.GamePad) || ((input.IsNewButtonPress(Buttons.LeftThumbstickRight, player.playerIndex) && player.inputMode == InputMode.GamePad) || ((input.IsNewKeyPress(Keys.Right, player.playerIndex) && player.inputMode == InputMode.Keyboard)))) { if ((gpState.DPad.Right == ButtonState.Pressed) || (gpState.ThumbSticks.Left.X > 0) || input.IsNewKeyPress(Keys.Right, player.playerIndex) ) { ChangeCharacterSelected(player, true); state.DPadRight = true; } else { state.DPadRight = false; } } else { state.DPadRight = false; } if ((input.IsNewButtonPress(Buttons.DPadDown, player.playerIndex) && player.inputMode == InputMode.GamePad) || ((input.IsNewKeyPress(Keys.Down, player.playerIndex) && player.inputMode == InputMode.Keyboard) || ((input.IsNewButtonPress(Buttons.LeftTrigger, player.playerIndex) && player.inputMode == InputMode.GamePad)))) { #if !DEMO if (levelSelected > 1) { levelSelected -= 1; } else { if (player.levelsUnlocked != 0) { levelSelected = (byte)player.levelsUnlocked; } else { levelSelected = 1; } } #endif state.ButtonLT = true; } else { state.ButtonLT = false; } if ((input.IsNewButtonPress(Buttons.DPadUp, player.playerIndex) && player.inputMode == InputMode.GamePad) || ((input.IsNewKeyPress(Keys.Up, player.playerIndex) && player.inputMode == InputMode.Keyboard) || ((input.IsNewButtonPress(Buttons.RightTrigger, player.playerIndex) && player.inputMode == InputMode.Keyboard)))) { #if !DEMO if (levelSelected < player.levelsUnlocked) { levelSelected += 1; } else { levelSelected = 1; } #endif state.ButtonRT = true; } else { state.ButtonRT = false; } stickLeft = gpState.ThumbSticks.Left; stickRight = gpState.ThumbSticks.Right; state.GamePadFire = gpState.ThumbSticks.Right; state.StickLeftMovement = stickLeft; state.StickRightMovement = stickRight; } else { if (input.IsNewButtonPress(Buttons.Start, player.playerIndex) && player.playerIndex != PlayerIndex.One) { player.inputMode = InputMode.GamePad; player.avatar.Activate(); player.IsPlaying = true; player.isReady = false; GameAnalytics.AddDesignEvent("SelectPlayer:NewPlayer:InputMode:Gamepad", (int)player.playerIndex); } if (input.IsNewKeyPress(Keys.Enter, player.playerIndex)) { if (!IsKeyboardAlreadyInUse()) { player.inputMode = InputMode.Keyboard; player.avatar.Activate(); player.IsPlaying = true; player.isReady = false; GameAnalytics.AddDesignEvent("SelectPlayer:NewPlayer:InputMode:Keyboard"); } } } if ((input.IsNewButtonPress(Buttons.B, player.playerIndex) && player.inputMode == InputMode.GamePad) || ((input.IsNewKeyPress(Keys.Escape, player.playerIndex) && player.inputMode == InputMode.Keyboard) || ((input.IsNewKeyPress(Keys.Back, player.playerIndex) && player.inputMode == InputMode.Keyboard)))) { MenuCanceled(this); state.ButtonB = true; } else { state.ButtonB = false; } if ((input.IsNewButtonPress(Buttons.Start, player.playerIndex) && player.inputMode == InputMode.GamePad) || ((input.IsNewKeyPress(Keys.Enter, player.playerIndex) && player.inputMode == InputMode.Keyboard))) { if (CanStartGame()) { switch (levelSelected) { case 1: game.BeginLocalGame(LevelType.One); break; case 2: game.BeginLocalGame(LevelType.Two); break; case 3: game.BeginLocalGame(LevelType.Three); break; case 4: game.BeginLocalGame(LevelType.Four); break; case 5: game.BeginLocalGame(LevelType.Five); break; case 6: game.BeginLocalGame(LevelType.Six); break; case 7: game.BeginLocalGame(LevelType.Seven); break; case 8: game.BeginLocalGame(LevelType.Eight); break; case 9: game.BeginLocalGame(LevelType.Nine); break; case 10: game.BeginLocalGame(LevelType.Ten); break; default: game.BeginLocalGame(LevelType.One); break; } } state.ButtonStart = true; } else { state.ButtonStart = false; } // Read in our gestures foreach (GestureSample gesture in input.GetGestures()) { // If we have a tap if (gesture.GestureType == GestureType.Tap) { // Toggle Ready if ((gesture.Position.X >= 489 && gesture.Position.X <= 775) && (gesture.Position.Y >= 612 && gesture.Position.Y <= 648)) { state.ButtonA = true; } // Toggle Ready CARD if ((gesture.Position.X >= 198 && gesture.Position.X <= 336) && (gesture.Position.Y >= 288 && gesture.Position.Y <= 586)) { state.ButtonA = true; } // Start Game if ((gesture.Position.X >= 815 && gesture.Position.X <= 1104) && (gesture.Position.Y >= 612 && gesture.Position.Y <= 648)) { state.ButtonStart = true; } // Select Player Right if ((gesture.Position.X >= 341 && gesture.Position.X <= 368) && (gesture.Position.Y >= 412 && gesture.Position.Y <= 452)) { state.DPadRight = true; } // Select Player Left if ((gesture.Position.X >= 171 && gesture.Position.X <= 191) && (gesture.Position.Y >= 412 && gesture.Position.Y <= 452)) { state.DPadLeft = true; } // Select Level Left if ((gesture.Position.X >= 907 && gesture.Position.X <= 995) && (gesture.Position.Y >= 75 && gesture.Position.Y <= 176)) { state.ButtonLT = true; } // Select Level Right if ((gesture.Position.X >= 1099 && gesture.Position.X <= 1204) && (gesture.Position.Y >= 75 && gesture.Position.Y <= 176)) { state.ButtonRT = true; } // Go Back Button if ((gesture.Position.X >= 156 && gesture.Position.X <= 442) && (gesture.Position.Y >= 614 && gesture.Position.Y <= 650)) { state.ButtonB = true; } // BUY NOW!! //if ((gesture.Position.X >= 0 && gesture.Position.X <= 90) && // (gesture.Position.Y >= 0 && gesture.Position.Y <= 90)) //{ // if (Guide.IsTrialMode) // { // Guide.ShowMarketplace(PlayerIndex.One); // } //} } } return state; } public override void Update(GameTime gameTime, bool otherScreenHasFocus, bool coveredByOtherScreen) { if (game.currentGameState != GameState.Paused) { CanStartGame(); } base.Update(gameTime, otherScreenHasFocus, coveredByOtherScreen); } public bool CanStartGame() { bool canStart = true; foreach(Player player in game.players) { if (player.IsPlaying && !player.isReady) { canStart = false; } } return canStart; } /// <summary> /// Event handler for when the user selects ok on the "are you sure /// you want to exit" message box. /// </summary> void ConfirmExitMessageBoxAccepted(object sender, PlayerIndexEventArgs e) { ExitScreen(); } // Leave match void MenuCanceled(Object sender) { MessageBoxScreen confirmExitMessageBox = new MessageBoxScreen(Strings.CharacterSelectString, Strings.ConfirmReturnMainMenuString); confirmExitMessageBox.Accepted += ConfirmExitMessageBoxAccepted; if (!IsConfirmationScreenAlreadyShown()) { ScreenManager.AddScreen(confirmExitMessageBox); } } private bool IsKeyboardAlreadyInUse() { bool isKeyboardUsed = false; foreach (Player player in game.players) { if (player.inputMode == InputMode.Keyboard) { isKeyboardUsed = true; } } return isKeyboardUsed; } private bool IsConfirmationScreenAlreadyShown() { bool hasConfirmationScreen = false; GameScreen[] screenList = ScreenManager.GetScreens(); for (int i = screenList.Length - 1; i > 0; i--) { if (screenList[i] is MessageBoxScreen) { hasConfirmationScreen = true; } } return hasConfirmationScreen; } void Menu_ShowMarketPlace(Object sender, MenuSelection selection) { } public override void Draw(GameTime gameTime) { base.Draw(gameTime); if (game.currentGameState != GameState.Paused) { #if !DEMO DrawLevelSelectionMenu(this.ScreenManager.SpriteBatch); #endif DrawSelectCharacters(selectPos, this.ScreenManager.SpriteBatch); DrawContextMenu(menu, selectPos, this.ScreenManager.SpriteBatch); //DrawHowToPlay(this.ScreenManager.SpriteBatch, selectPos); menu.DrawLogoRetrowaxMenu(this.ScreenManager.SpriteBatch, new Vector2(uiBounds.Width, uiBounds.Height), MenuInfoFont); #if DEMO menu.DrawDemoWIPDisclaimer(this.ScreenManager.SpriteBatch); #endif } else { this.ScreenManager.SpriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend, null, null, null, null, Resolution.getTransformationMatrix()); this.ScreenManager.SpriteBatch.Draw(game.blackTexture, new Vector2(0, 0), Color.White); this.ScreenManager.SpriteBatch.DrawString(MenuInfoFont, "ZOMBUSTERS " + Strings.Paused.ToUpper(), new Vector2(5, 5), Color.White); this.ScreenManager.SpriteBatch.End(); } } private void DrawSelectCharacters(Vector2 pos, SpriteBatch batch) { string[] lines; Player player; byte index; Vector2 contextMenuPosition = new Vector2(uiBounds.X + 22, pos.Y - 100); Vector2 MenuTitlePosition = new Vector2(contextMenuPosition.X - 3, contextMenuPosition.Y - 300); Vector2 CharacterPosition = new Vector2(MenuTitlePosition.X + 50, MenuTitlePosition.Y + 70); Vector2 ConnectControlerStringPosition = new Vector2(CharacterPosition.X - 5 + cardBkgTexture[1].Width, CharacterPosition.Y + cardBkgTexture[1].Height / 2); batch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, null, null, null, Resolution.getTransformationMatrix()); for (index = 0; index < game.players.Length; index++) { player = game.players[index]; if (player != null) { if (player.avatar.status == ObjectStatus.Active) { batch.Draw(cardBkgTexture[0], CharacterPosition, Color.White); batch.Draw(cardBkgTexture[1], CharacterPosition, Color.White); batch.Draw(avatarTexture[player.avatar.character], CharacterPosition, Color.White); batch.Draw(cardBkgTexture[2], CharacterPosition, Color.White); if (player.isReady) { batch.Draw(cardBkgTexture[3], CharacterPosition, Color.White); batch.DrawString(DigitLowFont, Strings.ReadySelPlayerString, new Vector2(CharacterPosition.X + cardBkgTexture[0].Width / 2 - Convert.ToInt32(MenuInfoFont.MeasureString(Strings.ReadySelPlayerString).X) / 2, CharacterPosition.Y + cardBkgTexture[0].Height / 2 - Convert.ToInt32(MenuInfoFont.MeasureString(Strings.ReadySelPlayerString).Y)), Color.Black); } batch.Draw(avatarPixelatedTexture[player.avatar.character], new Vector2(CharacterPosition.X + (avatarTexture[player.avatar.character].Width / 2) - avatarPixelatedTexture[player.avatar.character].Width / 2, CharacterPosition.Y + (avatarTexture[player.avatar.character].Height - avatarPixelatedTexture[player.avatar.character].Height)), null, Color.White, 0, Vector2.Zero, 1.0f, SpriteEffects.None, 1.0f); batch.DrawString(MenuInfoFont, player.Name, new Vector2(CharacterPosition.X - Convert.ToInt32(MenuInfoFont.MeasureString(player.Name).Y), CharacterPosition.Y + 2 + cardBkgTexture[1].Height), Color.White, 4.70f, Vector2.Zero, 1.0f, SpriteEffects.None, 1.0f); batch.DrawString(MenuInfoFont, avatarNameList[player.avatar.character], new Vector2(CharacterPosition.X - 5 + cardBkgTexture[1].Width - Convert.ToInt32(MenuInfoFont.MeasureString(avatarNameList[player.avatar.character]).X), CharacterPosition.Y + 3), Color.Black); // Character NOT AVAILABLE /* if (cplayer.character != 0) { batch.DrawString(MenuInfoFont, "NOT", new Vector2(CharacterPosition.X + (pAvatar[cplayer.character].Width / 2) - pAvatarPixelated[cplayer.character].Width / 2, CharacterPosition.Y + (pAvatar[cplayer.character].Height - pAvatarPixelated[cplayer.character].Height)), Color.Black); batch.DrawString(MenuInfoFont, "AVAILABLE", new Vector2(CharacterPosition.X - 30 + (pAvatar[cplayer.character].Width / 2) - pAvatarPixelated[cplayer.character].Width / 2, CharacterPosition.Y + 20 + (pAvatar[cplayer.character].Height - pAvatarPixelated[cplayer.character].Height)), Color.Black); }*/ if (!player.isReady) { batch.Draw(arrow, new Vector2(CharacterPosition.X - arrow.Width, CharacterPosition.Y + cardBkgTexture[1].Height / 2 - arrow.Height / 2), null, Color.White, 0, Vector2.Zero, 0.7f, SpriteEffects.None, 1.0f); batch.Draw(arrow, new Vector2(CharacterPosition.X + 8 + cardBkgTexture[1].Width, CharacterPosition.Y + cardBkgTexture[1].Height / 2 - arrow.Height / 2), null, Color.White, 0, Vector2.Zero, 0.7f, SpriteEffects.FlipHorizontally, 1.0f); } } else { if (GamePad.GetState(player.playerIndex).IsConnected) { batch.Draw(cardBkgTexture[0], CharacterPosition, Color.White); batch.Draw(cardBkgTexture[1], CharacterPosition, Color.White); switch (index) { case 0: lines = Regex.Split(Strings.P1PressStartString, " "); break; case 1: lines = Regex.Split(Strings.P2PressStartString, " "); break; case 2: lines = Regex.Split(Strings.P3PressStartString, " "); break; case 3: lines = Regex.Split(Strings.P4PressStartString, " "); break; default: lines = Regex.Split(Strings.P1PressStartString, " "); break; } foreach (string line in lines) { batch.DrawString(MenuInfoFont, line.Replace(" ", ""), new Vector2(ConnectControlerStringPosition.X - Convert.ToInt32(MenuInfoFont.MeasureString(line).X) / 2 - cardBkgTexture[0].Width / 2, ConnectControlerStringPosition.Y - Convert.ToInt32(MenuInfoFont.MeasureString(line).Y) - 25), Color.Black); ConnectControlerStringPosition.Y += 20; } // Connect Controller to play //batch.DrawString(MenuInfoFont, Strings.ConnectControllerToJoinString, // new Vector2(CharacterPosition.X - 5 + cardBkg[1].Width - Convert.ToInt32(MenuInfoFont.MeasureString(Strings.ConnectControllerToJoinString).X), CharacterPosition.Y + cardBkg[1].Height / 2 - Convert.ToInt32(MenuInfoFont.MeasureString(Strings.ConnectControllerToJoinString).Y)), // Color.Black); } else { lines = Regex.Split(Strings.ConnectControllerToJoinString, " "); foreach (string line in lines) { batch.DrawString(MenuInfoFont, line.Replace(" ", ""), new Vector2(ConnectControlerStringPosition.X - Convert.ToInt32(MenuInfoFont.MeasureString(line).X) / 2 - cardBkgTexture[0].Width / 2, ConnectControlerStringPosition.Y - Convert.ToInt32(MenuInfoFont.MeasureString(line).Y) - 25), Color.White); ConnectControlerStringPosition.Y += 20; } } } } else { // Background Images //batch.Draw(cardBkg[0], CharacterPosition, Color.White); //batch.Draw(cardBkg[1], CharacterPosition, Color.White); //Texto de contexto de menu lines = Regex.Split(Strings.ConnectControllerToJoinString, " "); foreach (string line in lines) { batch.DrawString(MenuInfoFont, line.Replace(" ", ""), new Vector2(ConnectControlerStringPosition.X - Convert.ToInt32(MenuInfoFont.MeasureString(line).X) / 2 - cardBkgTexture[0].Width / 2, ConnectControlerStringPosition.Y - Convert.ToInt32(MenuInfoFont.MeasureString(line).Y) - 25), Color.White); ConnectControlerStringPosition.Y += 20; } // Connect Controller to play //batch.DrawString(MenuInfoFont, Strings.ConnectControllerToJoinString, // new Vector2(CharacterPosition.X - 5 + cardBkg[1].Width - Convert.ToInt32(MenuInfoFont.MeasureString(Strings.ConnectControllerToJoinString).X), CharacterPosition.Y + cardBkg[1].Height / 2 - Convert.ToInt32(MenuInfoFont.MeasureString(Strings.ConnectControllerToJoinString).Y)), // Color.Black); } CharacterPosition.X += 250; ConnectControlerStringPosition.X += 250; ConnectControlerStringPosition.Y = CharacterPosition.Y + cardBkgTexture[1].Height / 2; } batch.End(); } private void DrawLevelSelectionMenu(SpriteBatch batch) { batch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, null, null, null, Resolution.getTransformationMatrix()); batch.Draw(myGroupBKG, new Vector2(uiBounds.X + uiBounds.Width - 260, 50), Color.White); batch.DrawString(MenuInfoFont, Strings.LevelSelectionString, new Vector2(uiBounds.X + uiBounds.Width - MenuInfoFont.MeasureString(Strings.LevelSelectionString).X / 2 - 100, 56), Color.White); batch.DrawString(DigitBigFont, String.Format("{0:00}", levelSelected), new Vector2(uiBounds.X + uiBounds.Width - 135, 90), Color.Salmon); batch.DrawString(DigitLowFont, "-", new Vector2(uiBounds.X + uiBounds.Width - 210, 80), Color.White); if (game.currentInputMode == InputMode.Keyboard) { batch.Draw(kbDown, new Vector2(uiBounds.X + uiBounds.Width - 217, 115), new Rectangle(0, 0, kbDown.Width, kbDown.Height), Color.White, 0.0f, Vector2.Zero, 0.7f, SpriteEffects.None, 0.0f); } else { batch.Draw(btnLT, new Vector2(uiBounds.X + uiBounds.Width - 217, 115), new Rectangle(0, 0, btnLT.Width, btnLT.Height), Color.White, 0.0f, Vector2.Zero, 0.28f, SpriteEffects.None, 0.0f); } batch.DrawString(DigitLowFont, "+", new Vector2(uiBounds.X + uiBounds.Width - 5, 80), Color.White); if (game.currentInputMode == InputMode.Keyboard) { batch.Draw(kbUp, new Vector2(uiBounds.X + uiBounds.Width - 10, 115), new Rectangle(0, 0, kbUp.Width, kbUp.Height), Color.White, 0.0f, Vector2.Zero, 0.7f, SpriteEffects.None, 0.0f); } else { batch.Draw(btnRT, new Vector2(uiBounds.X + uiBounds.Width - 10, 115), new Rectangle(0, 0, btnRT.Width, btnRT.Height), Color.White, 0.0f, Vector2.Zero, 0.28f, SpriteEffects.None, 0.0f); } batch.End(); } private void DrawContextMenu(MenuComponent menu, Vector2 position, SpriteBatch batch) { Vector2 MenuTitlePosition = new Vector2(position.X - LINE_X_OFFSET, position.Y - MENU_TITLE_Y_OFFSET); batch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, null, null, null, Resolution.getTransformationMatrix()); batch.Draw(logoMenu, new Vector2(MenuTitlePosition.X - 55, MenuTitlePosition.Y - 5), Color.White); batch.DrawString(MenuHeaderFont, Strings.CharacterSelectString, MenuTitlePosition, Color.White); if (this.isMatchmaking == true) { batch.DrawString(MenuHeaderFont, Strings.MatchmakingMenuString, new Vector2(MenuTitlePosition.X - 10, MenuTitlePosition.Y + 70), new Color(255, 255, 255, 40), 1.58f, Vector2.Zero, 0.8f, SpriteEffects.None, 1.0f); } else { batch.DrawString(MenuHeaderFont, Strings.LocalGameString, new Vector2(MenuTitlePosition.X - 10, MenuTitlePosition.Y + 70), new Color(255, 255, 255, 40), 1.58f, Vector2.Zero, 0.8f, SpriteEffects.None, 1.0f); } batch.Draw(lineaMenu, new Vector2(position.X - LINE_X_OFFSET, position.Y - 15), Color.White); menu.DrawSelectPlayerButtons(batch, new Vector2(position.X - 30, position.Y - 5), MenuInfoFont, CanStartGame(), true); batch.End(); } public void DrawHowToPlay(SpriteBatch batch, Vector2 position) { Vector2 contextMenuPosition = new Vector2(position.X + 260, position.Y - 105); Vector2 MenuTitlePosition = new Vector2(contextMenuPosition.X - 3, contextMenuPosition.Y - 300); string[] lines; batch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, null, null, null, Resolution.getTransformationMatrix()); // Lobby Header Image batch.Draw(HTPHeaderImage, new Vector2(MenuTitlePosition.X, MenuTitlePosition.Y + 75), Color.White); //Linea divisoria position.X -= 40; position.Y -= 115; batch.Draw(lineaMenu, new Vector2(position.X + 300, position.Y - 40), Color.White); //Texto de contexto del How to Play contextMenuPosition = new Vector2(position.X + 300, position.Y - 30); if (game.currentInputMode == InputMode.Keyboard) { lines = Regex.Split(Strings.PCExplanationString, "\r\n"); } else { lines = Regex.Split(Strings.HTPExplanationString, "\r\n"); } foreach (string line in lines) { batch.DrawString(MenuInfoFont, line.Replace(" ", ""), contextMenuPosition, Color.White); contextMenuPosition.Y += 20; } batch.End(); } } } <|start_filename|>ZombustersWindows/Components/DebugComponent.cs<|end_filename|> #region Using Statements using System; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Input; using GameStateManagement; using ZombustersWindows.Subsystem_Managers; #endregion namespace ZombustersWindows { /// <summary> /// A message box screen, used to display "debug" messages. /// </summary> public class DebugInfoComponent : DrawableGameComponent { readonly MyGame game; SpriteBatch spriteBatch; SpriteFont spriteFont, smallspriteFont; bool stopUpdatingText = false; readonly InputState input = new InputState(); ScrollingTextManager mText; String previousNetDebugText = ""; public String NetDebugText = ""; public DebugInfoComponent(MyGame game) : base(game) { this.game = game; } protected override void LoadContent() { spriteBatch = new SpriteBatch(GraphicsDevice); spriteFont = game.Content.Load<SpriteFont>(@"Menu\ArialMenuInfo"); //content.Load<SpriteFont>(@"Menu/ArialMenuInfo"); smallspriteFont = game.Content.Load<SpriteFont>(@"Menu\ArialMusicItalic"); //Create a Textblock object. This object will calculate the line wraps needs for the //block of text and position the lines of text for scrolling through the display area mText = new ScrollingTextManager(new Rectangle(0, 280, 500, 400), smallspriteFont, NetDebugText); } public virtual void HandleInput(InputState input) { } public void HandleDebugInput(InputState input) { if (input.IsNewButtonPress(Buttons.X)) { if (stopUpdatingText == false) stopUpdatingText = true; else stopUpdatingText = false; return; } this.HandleInput(input); } public override void Update(GameTime gameTime) { input.Update(); this.HandleDebugInput(input); //Update the TextBlock. This will allow the lines of text to scroll. if (NetDebugText != previousNetDebugText) { mText = new ScrollingTextManager(new Rectangle(781, 322, 500, 400), smallspriteFont, NetDebugText); previousNetDebugText = NetDebugText; } if (stopUpdatingText == false) mText.Update(gameTime); } public override void Draw(GameTime gameTime) { int count = 0; Vector2 position = new Vector2(32, 64); spriteBatch.Begin(); #if XBOX spriteBatch.DrawString(spriteFont, "Signed In Gamers: " + Gamer.SignedInGamers.Count.ToString(), position, Color.White); if (mygame.gamerManager.getOnlinePlayerGamertag() != null) { position = new Vector2(position.X, position.Y + 32); spriteBatch.DrawString(spriteFont, "Online Gamertags: " + mygame.gamerManager.getOnlinePlayerGamertag().Count.ToString(), position, Color.White); } if (mygame.gamerManager.getOnlinePlayerIcons() != null) { position = new Vector2(position.X, position.Y + 32); spriteBatch.DrawString(spriteFont, "Online Icons: " + mygame.gamerManager.getOnlinePlayerIcons().Count.ToString(), position, Color.White); } #endif #if !WINDOWS_PHONE && !WINDOWS && !NETCOREAPP && !WINDOWS_UAP if (mygame.networkSessionManager.networkSession != null) { position = new Vector2(position.X, position.Y + 32); spriteBatch.DrawString(spriteFont, "BPS Received: " + mygame.networkSessionManager.networkSession.BytesPerSecondReceived.ToString(), position, Color.White); position = new Vector2(position.X, position.Y + 32); spriteBatch.DrawString(spriteFont, "BPS Sent: " + mygame.networkSessionManager.networkSession.BytesPerSecondSent.ToString(), position, Color.White); position = new Vector2(position.X, position.Y + 32); spriteBatch.DrawString(spriteFont, "Private Slots: " + mygame.networkSessionManager.networkSession.PrivateGamerSlots.ToString(), position, Color.White); position = new Vector2(position.X, position.Y + 32); spriteBatch.DrawString(spriteFont, "Max session Gamers: " + mygame.networkSessionManager.networkSession.MaxGamers.ToString(), position, Color.White); } #endif //position = new Vector2(position.X, position.Y + 32); #if DEMO spriteBatch.DrawString(smallspriteFont, "Demo: ON", new Vector2(position.X + 1, position.Y + 1), Color.Black); spriteBatch.DrawString(smallspriteFont, "Demo: ON", position, Color.White); #else spriteBatch.DrawString(smallspriteFont, "Demo: OFF", new Vector2(position.X + 1, position.Y + 1), Color.Black); spriteBatch.DrawString(smallspriteFont, "Demo: OFF", position, Color.White); #endif count = 0; position = new Vector2(position.X, position.Y + 22); foreach (Player player in game.players) { position = new Vector2(position.X, position.Y + 22); spriteBatch.DrawString(smallspriteFont, "Name: " + player.Name, new Vector2(position.X + 1, position.Y + 1), Color.Black); spriteBatch.DrawString(smallspriteFont, "Name: " + player.Name, position, Color.White); position = new Vector2(position.X, position.Y + 22); spriteBatch.DrawString(smallspriteFont, "Levels" + count.ToString() + ": " + player.levelsUnlocked.ToString(), new Vector2(position.X + 1, position.Y + 1), Color.Black); spriteBatch.DrawString(smallspriteFont, "Levels" + count.ToString() + ": " + player.levelsUnlocked.ToString(), position, Color.White); position = new Vector2(position.X, position.Y + 22); spriteBatch.DrawString(smallspriteFont, "Avatar Status: " + player.avatar.status.ToString(), new Vector2(position.X + 1, position.Y + 1), Color.Black); spriteBatch.DrawString(smallspriteFont, "Avatar Status: " + player.avatar.status.ToString(), position, Color.White); position = new Vector2(position.X, position.Y + 22); spriteBatch.DrawString(smallspriteFont, "Input: " + player.inputMode.ToString(), new Vector2(position.X + 1, position.Y + 1), Color.Black); spriteBatch.DrawString(smallspriteFont, "Input: " + player.inputMode.ToString(), position, Color.White); position = new Vector2(position.X, position.Y + 22); spriteBatch.DrawString(smallspriteFont, "IsPlaying: " + player.IsPlaying.ToString(), new Vector2(position.X + 1, position.Y + 1), Color.Black); spriteBatch.DrawString(smallspriteFont, "IsPlaying: " + player.IsPlaying.ToString(), position, Color.White); position = new Vector2(position.X, position.Y + 22); spriteBatch.DrawString(smallspriteFont, "IsReady: " + player.isReady.ToString(), new Vector2(position.X + 1, position.Y + 1), Color.Black); spriteBatch.DrawString(smallspriteFont, "IsReady: " + player.isReady.ToString(), position, Color.White); position = new Vector2(position.X, position.Y + 22); #if !WINDOWS_PHONE && !WINDOWS && !NETCOREAPP && !WINDOWS_UAP if (avatar.Player.Container != null) { position = new Vector2(position.X, position.Y + 32); spriteBatch.DrawString(spriteFont, "Contner Dispsd: " + avatar.Player.Container.IsDisposed.ToString(), position, Color.White); } #endif count++; } //Now draw the text to be drawn on the screen mText.Draw(spriteBatch); spriteBatch.End(); } } } <|start_filename|>ZombustersWindows/MenuScreens/LeaderBoardScreen.cs<|end_filename|> using System; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using GameStateManagement; using Microsoft.Xna.Framework.Input.Touch; using ZombustersWindows.Localization; using ZombustersWindows.Subsystem_Managers; using GameAnalyticsSDK.Net; namespace ZombustersWindows { public class LeaderBoardScreen : BackgroundScreen { Rectangle uiBounds; Rectangle titleBounds; Vector2 selectPos; Texture2D btnB; Texture2D logoMenu; Texture2D lineaMenu; //Linea de 1px para separar Texture2D kbEsc; Texture2D submit_button; SpriteFont MenuHeaderFont; SpriteFont MenuInfoFont; SpriteFont MenuListFont; // Array to hold one page. Declare as a member, to avoid allocating a new one each time: TopScoreEntry[] page; int pageIndex; public LeaderBoardScreen() { } private MenuComponent menu; //private BloomComponent bloom; public override void Initialize() { Viewport view = this.ScreenManager.GraphicsDevice.Viewport; int borderheight = (int)(view.Height * .05); // Deflate 10% to provide for title safe area on CRT TVs uiBounds = GetTitleSafeArea(); titleBounds = new Rectangle(115, 65, 1000, 323); //"Select" text position selectPos = new Vector2(uiBounds.X + 60, uiBounds.Bottom - 30); MenuHeaderFont = this.ScreenManager.Game.Content.Load<SpriteFont>(@"Menu\ArialMenuHeader"); MenuInfoFont = this.ScreenManager.Game.Content.Load<SpriteFont>(@"Menu\ArialMenuInfo"); MenuListFont = this.ScreenManager.Game.Content.Load<SpriteFont>(@"Menu\ArialMenuList"); menu = new MenuComponent(this.ScreenManager.Game, MenuListFont); //Initialize Main Menu menu.Initialize(); menu.uiBounds = menu.Extents; //Offset de posicion del menu menu.uiBounds.Offset(uiBounds.X, 300); menu.MenuCanceled += new EventHandler<MenuSelection>(menu_MenuCanceled); //Posiciona el menu menu.CenterInXLeftMenu(view); #if !WINDOWS_PHONE && !WINDOWS && !NETCOREAPP && !WINDOWS_UAP this.PresenceMode = GamerPresenceMode.AtMenu; #endif //bloom.Visible = !bloom.Visible; // Array to hold one page. Declare as a member, to avoid allocating a new one each time: page = new TopScoreEntry[10]; pageIndex = 0; if (((MyGame)this.ScreenManager.Game).topScoreListContainer != null) { ((MyGame)this.ScreenManager.Game).topScoreListContainer.fillPageFromFullList(0, pageIndex, page); } base.Initialize(); this.isBackgroundOn = true; GameAnalytics.AddDesignEvent("ScreenView:Extras:Leaderboards:View"); } void menu_MenuCanceled(Object sender, MenuSelection selection) { ExitScreen(); } public override void LoadContent() { #if WINDOWS || NETCOREAPP || WINDOWS_UAP //Key "Scape" kbEsc = this.ScreenManager.Game.Content.Load<Texture2D>(@"Keyboard/key_esc"); #endif //Button "B" btnB = this.ScreenManager.Game.Content.Load<Texture2D>("xboxControllerButtonB"); //Linea blanca separatoria lineaMenu = this.ScreenManager.Game.Content.Load<Texture2D>(@"Menu/linea_menu"); //Logo Menu logoMenu = this.ScreenManager.Game.Content.Load<Texture2D>(@"Menu/logo_menu"); submit_button = this.ScreenManager.Game.Content.Load<Texture2D>(@"Menu/submit_button_mobile"); #if XBOX ((Game1)this.ScreenManager.Game).gamerManager.Load(); #endif base.LoadContent(); } public override void HandleInput(InputState input) { // Read in our gestures foreach (GestureSample gesture in input.GetGestures()) { // If we have a tap if (gesture.GestureType == GestureType.Tap) { // Go Back Button if ((gesture.Position.X >= 156 && gesture.Position.X <= 442) && (gesture.Position.Y >= 614 && gesture.Position.Y <= 650)) { // If they hit B or Back, go back to Menu Screen ExitScreen(); } } } menu.HandleInput(input); base.HandleInput(input); } public override void Update(GameTime gameTime, bool otherScreenHasFocus, bool coveredByOtherScreen) { // Menu Update if (!coveredByOtherScreen #if !WINDOWS && !NETCOREAPP && !WINDOWS_UAP && !Guide.IsVisible #endif ) { menu.Update(gameTime); } #if XBOX // Gamer Manager update if (((Game1)this.ScreenManager.Game).gamerManager.GamerListHasChanged()) { ((Game1)this.ScreenManager.Game).gamerManager.Update(); } #endif base.Update(gameTime, otherScreenHasFocus, coveredByOtherScreen); } public override void Draw(GameTime gameTime) { int distanceBetweenButtonsText = 0; int spaceBetweenButtonAndText = 0; int spaceBetweenButtons = 30; int count = 1; #if WINDOWS_PHONE Vector2 pos = new Vector2(uiBounds.X + 60, uiBounds.Bottom); Vector2 contextMenuPosition = new Vector2(uiBounds.X + 22, pos.Y - 100); Vector2 MenuTitlePosition = new Vector2(contextMenuPosition.X - 3, contextMenuPosition.Y - 225); Vector2 scorespos = new Vector2(selectPos.X, selectPos.Y - 235); #else Vector2 pos = selectPos; Vector2 contextMenuPosition = new Vector2(uiBounds.X + 22, pos.Y - 100); Vector2 MenuTitlePosition = new Vector2(contextMenuPosition.X - 3, contextMenuPosition.Y - 300); Vector2 scorespos = new Vector2(selectPos.X, selectPos.Y - 265); #endif base.Draw(gameTime); this.ScreenManager.SpriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, null, null, null, Resolution.getTransformationMatrix()); // Logo Menu this.ScreenManager.SpriteBatch.Draw(logoMenu, new Vector2(MenuTitlePosition.X - 55, MenuTitlePosition.Y - 5), Color.White); // EXTRAS fade rotated this.ScreenManager.SpriteBatch.DrawString(MenuHeaderFont, Strings.ExtrasMenuString, new Vector2(MenuTitlePosition.X - 10, MenuTitlePosition.Y + 70), new Color(255, 255, 255, 40), 1.58f, Vector2.Zero, 0.8f, SpriteEffects.None, 1.0f); // Texto de LeaderBoards this.ScreenManager.SpriteBatch.DrawString(MenuHeaderFont, Strings.LeaderboardMenuString.ToUpper(), MenuTitlePosition, Color.White); #if !WINDOWS_PHONE // GLOBAL / LOCAL / FRIENDS switch (pageIndex) { case 0: this.ScreenManager.SpriteBatch.DrawString(MenuHeaderFont, "GLOBAL", new Vector2(scorespos.X + 80 + MenuInfoFont.MeasureString("GLOBAL").X/2, scorespos.Y - 60), new Color(255, 255, 255, 40), 0f, Vector2.Zero, 0.5f, SpriteEffects.None, 1.0f); break; case 1: this.ScreenManager.SpriteBatch.DrawString(MenuHeaderFont, "LOCAL", new Vector2(MenuTitlePosition.X - 10, MenuTitlePosition.Y + 70), new Color(255, 255, 255, 40), 0f, Vector2.Zero, 0.8f, SpriteEffects.None, 1.0f); break; case 2: this.ScreenManager.SpriteBatch.DrawString(MenuHeaderFont, "FRIENDS", new Vector2(MenuTitlePosition.X - 10, MenuTitlePosition.Y + 70), new Color(255, 255, 255, 40), 0f, Vector2.Zero, 0.8f, SpriteEffects.None, 1.0f); break; } // Score String this.ScreenManager.SpriteBatch.DrawString(MenuInfoFont, Strings.LeaderboardScoreString, new Vector2(scorespos.X + 165 - MenuInfoFont.MeasureString(Strings.LeaderboardScoreString).X, scorespos.Y - 30), Color.White); #endif // LT - RT String //this.ScreenManager.SpriteBatch.DrawString(MenuInfoFont, "< LT", new Vector2(scorespos.X - 30, scorespos.Y - 30), Color.White); //this.ScreenManager.SpriteBatch.DrawString(MenuInfoFont, "RT >", new Vector2(scorespos.X + 390, scorespos.Y - 30), Color.White); // Linea divisoria pos.X -= 40; pos.Y -= 270; this.ScreenManager.SpriteBatch.Draw(lineaMenu, pos, Color.White); pos.Y += 270; // Display Leaderbord Entries foreach (TopScoreEntry entry in page) { if (entry != null) { // do something with the entry here, to display it this.ScreenManager.SpriteBatch.DrawString(MenuInfoFont, count.ToString() + ".", new Vector2(scorespos.X - MenuInfoFont.MeasureString(count.ToString()).X, scorespos.Y), Color.White); this.ScreenManager.SpriteBatch.DrawString(MenuInfoFont, entry.Score.ToString(), new Vector2(scorespos.X + 165 - MenuInfoFont.MeasureString(entry.Score.ToString()).X, scorespos.Y), Color.White); this.ScreenManager.SpriteBatch.DrawString(MenuInfoFont, entry.Gamertag, new Vector2(scorespos.X + 250, scorespos.Y), Color.White); scorespos.Y += 25; count++; } } //Linea divisoria pos.Y -= 15; this.ScreenManager.SpriteBatch.Draw(lineaMenu, pos, Color.White); // Leave Button if (((MyGame)this.ScreenManager.Game).currentInputMode != InputMode.Touch) { if (((MyGame)this.ScreenManager.Game).currentInputMode == InputMode.Keyboard) { spaceBetweenButtonAndText = Convert.ToInt32(kbEsc.Width * 0.7f) + 5; this.ScreenManager.SpriteBatch.Draw(kbEsc, new Vector2(158 + distanceBetweenButtonsText, 613), null, Color.White, 0, Vector2.Zero, 0.7f, SpriteEffects.None, 1.0f); } else { spaceBetweenButtonAndText = Convert.ToInt32(btnB.Width * 0.33f) + 5; this.ScreenManager.SpriteBatch.Draw(btnB, new Vector2(158 + distanceBetweenButtonsText, 613), null, Color.White, 0, Vector2.Zero, 0.33f, SpriteEffects.None, 1.0f); } this.ScreenManager.SpriteBatch.DrawString(MenuInfoFont, Strings.LeaveMenuString, new Vector2(158 + spaceBetweenButtonAndText + distanceBetweenButtonsText, 613 + 4), Color.White); distanceBetweenButtonsText = distanceBetweenButtonsText + Convert.ToInt32(MenuInfoFont.MeasureString(Strings.LeaveMenuString).X) + spaceBetweenButtonAndText + spaceBetweenButtons; } else { Vector2 position = new Vector2(158, 613); this.ScreenManager.SpriteBatch.Draw(submit_button, position, Color.White); this.ScreenManager.SpriteBatch.DrawString(MenuInfoFont, Strings.LeaveMenuString.ToUpper(), new Vector2(position.X + 2 + submit_button.Width / 2 - MenuInfoFont.MeasureString(Strings.LeaveMenuString.ToUpper()).X / 2, position.Y + 9), Color.Black, 0, Vector2.Zero, 1.0f, SpriteEffects.None, 1.0f); this.ScreenManager.SpriteBatch.DrawString(MenuInfoFont, Strings.LeaveMenuString.ToUpper(), new Vector2(position.X + submit_button.Width / 2 - MenuInfoFont.MeasureString(Strings.LeaveMenuString.ToUpper()).X / 2, position.Y + 7), Color.White, 0, Vector2.Zero, 1.0f, SpriteEffects.None, 1.0f); } this.ScreenManager.SpriteBatch.End(); menu.DrawLogoRetrowaxMenu(this.ScreenManager.SpriteBatch, new Vector2(uiBounds.Width, uiBounds.Height), MenuInfoFont); #if DEMO menu.DrawDemoWIPDisclaimer(this.ScreenManager.SpriteBatch); #endif #if WINDOWS_PHONE menu.DrawBackButtonMenu(this.ScreenManager.SpriteBatch, new Vector2(uiBounds.Width + 55, uiBounds.Y - 30), MenuInfoFont); if (Guide.IsTrialMode) { menu.DrawBuyNow(gameTime); } #endif } } } <|start_filename|>ZombustersWindows/ContentManager/PowerUpType.cs<|end_filename|> namespace ZombustersWindows.Subsystem_Managers { public enum PowerUpType { live = 0, machinegun = 1, flamethrower = 2, shotgun = 3, grenade = 4, speedbuff = 5, immunebuff = 6, extralife = 7 } } <|start_filename|>ZombustersWindows/Localization/Strings1.Designer.cs<|end_filename|> //------------------------------------------------------------------------------ // <auto-generated> // Este código fue generado por una herramienta. // Versión de runtime:4.0.30319.42000 // // Los cambios en este archivo podrían causar un comportamiento incorrecto y se perderán si // se vuelve a generar el código. // </auto-generated> //------------------------------------------------------------------------------ namespace ZombustersWindows.Localization { using System; using System.Reflection; /// <summary> /// Clase de recurso fuertemente tipado, para buscar cadenas traducidas, etc. /// </summary> // StronglyTypedResourceBuilder generó automáticamente esta clase // a través de una herramienta como ResGen o Visual Studio. // Para agregar o quitar un miembro, edite el archivo .ResX y, a continuación, vuelva a ejecutar ResGen // con la opción /str o recompile su proyecto de VS. [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Strings { private static global::System.Resources.ResourceManager resourceMan; private static global::Windows.ApplicationModel.Resources.ResourceLoader resourceLoad; private static global::System.Globalization.CultureInfo resourceCulture; [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] internal Strings() { } /// <summary> /// Devuelve la instancia de ResourceLoader almacenada en caché utilizada por esta clase. /// </summary> [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Resources.ResourceManager ResourceManager { get { if (object.ReferenceEquals(resourceMan, null)) { global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ZombustersWindows.Localization.Strings", typeof(Strings).GetTypeInfo().Assembly); resourceMan = temp; } return resourceMan; } } [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::Windows.ApplicationModel.Resources.ResourceLoader ResourceLoader { get { if (object.ReferenceEquals(resourceLoad, null)) { global::Windows.ApplicationModel.Resources.ResourceLoader temp = Windows.ApplicationModel.Resources.ResourceLoader.GetForCurrentView(); resourceLoad = temp; } return resourceLoad; } } /// <summary> /// Reemplaza la propiedad CurrentUICulture del subproceso actual para todas las /// búsquedas de recursos mediante esta clase de recurso fuertemente tipado. /// </summary> [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Globalization.CultureInfo Culture { get { return resourceCulture; } set { resourceCulture = value; } } /// <summary> /// Busca una cadena traducida similar a CHALLENGES. /// </summary> internal static string AchievementsMenuString { get { return ResourceLoader.GetString("AchievementsMenuString"); } } /// <summary> /// Busca una cadena traducida similar a Show challenges list.. /// </summary> internal static string AchievementsMMString { get { return ResourceLoader.GetString("AchievementsMMString"); } } /// <summary> /// Busca una cadena traducida similar a Zombusters uses an Autosave feature wich will automatically ///save your progress throughout the title. Autosave will ///overwrite information without confirmation. Do not switch ///off the power when the autosave indication is present.. /// </summary> internal static string AutosaveStartMenuString { get { return ResourceLoader.GetString("AutosaveStartMenuString"); } } /// <summary> /// Busca una cadena traducida similar a AUTOSAVE. /// </summary> internal static string AutosaveTitleMenuString { get { return ResourceLoader.GetString("AutosaveTitleMenuString"); } } /// <summary> /// Busca una cadena traducida similar a Back. /// </summary> internal static string BackString { get { return ResourceLoader.GetString("BackString"); } } /// <summary> /// Busca una cadena traducida similar a Exit Without Saving. /// </summary> internal static string BackWithoutSavingString { get { return ResourceLoader.GetString("BackWithoutSavingString"); } } /// <summary> /// Busca una cadena traducida similar a Cancel. /// </summary> internal static string CancelString { get { return ResourceLoader.GetString("CancelString"); } } /// <summary> /// Busca una cadena traducida similar a Change Character. /// </summary> internal static string ChangeCharacterMenuString { get { return ResourceLoader.GetString("ChangeCharacterMenuString"); } } /// <summary> /// Busca una cadena traducida similar a Change Language. /// </summary> internal static string ChangeLanguageOption { get { return ResourceLoader.GetString("ChangeLanguageOption"); } } /// <summary> /// Busca una cadena traducida similar a Change Sound/Music Volume. /// </summary> internal static string ChangeSoundVolumeMenuString { get { return ResourceLoader.GetString("ChangeSoundVolumeMenuString"); } } /// <summary> /// Busca una cadena traducida similar a SELECT CHARACTER. /// </summary> internal static string CharacterSelectString { get { return ResourceLoader.GetString("CharacterSelectString"); } } /// <summary> /// Busca una cadena traducida similar a CLEARED. /// </summary> internal static string ClearedGameplayString { get { return ResourceLoader.GetString("ClearedGameplayString"); } } /// <summary> /// Busca una cadena traducida similar a Settings. /// </summary> internal static string ConfigurationString { get { return ResourceLoader.GetString("ConfigurationString"); } } /// <summary> /// Busca una cadena traducida similar a Are you sure you want to end this session?. /// </summary> internal static string ConfirmEndSession { get { return ResourceLoader.GetString("ConfirmEndSession"); } } /// <summary> /// Busca una cadena traducida similar a Are you sure you want to exit this sample?. /// </summary> internal static string ConfirmExitSample { get { return ResourceLoader.GetString("ConfirmExitSample"); } } /// <summary> /// Busca una cadena traducida similar a Are you sure you want to start the game,. /// </summary> internal static string ConfirmForceStartGame { get { return ResourceLoader.GetString("ConfirmForceStartGame"); } } /// <summary> /// Busca una cadena traducida similar a Are you sure you want to leave this session?. /// </summary> internal static string ConfirmLeaveSession { get { return ResourceLoader.GetString("ConfirmLeaveSession"); } } /// <summary> /// Busca una cadena traducida similar a Online gameplay is not available in trial mode.. /// </summary> internal static string ConfirmMarketplace { get { return ResourceLoader.GetString("ConfirmMarketplace"); } } /// <summary> /// Busca una cadena traducida similar a Are you sure you want to quit this game?. /// </summary> internal static string ConfirmQuitGame { get { return ResourceLoader.GetString("ConfirmQuitGame"); } } /// <summary> /// Busca una cadena traducida similar a You will return to matchmaking menu. /// </summary> internal static string ConfirmReturnMainMenuMMString { get { return ResourceLoader.GetString("ConfirmReturnMainMenuMMString"); } } /// <summary> /// Busca una cadena traducida similar a Are you sure you want to exit?. /// </summary> internal static string ConfirmReturnMainMenuString { get { return ResourceLoader.GetString("ConfirmReturnMainMenuString"); } } /// <summary> /// Busca una cadena traducida similar a CONGRATULATIONS!. /// </summary> internal static string CongratssEndGameString { get { return ResourceLoader.GetString("CongratssEndGameString"); } } /// <summary> /// Busca una cadena traducida similar a Connect controller to play. /// </summary> internal static string ConnectControllerToJoinString { get { return ResourceLoader.GetString("ConnectControllerToJoinString"); } } /// <summary> /// Busca una cadena traducida similar a © RETROWAX GAMES. 2011-2020 ALL RIGHTS RESERVED. /// </summary> internal static string CopyRightString { get { return ResourceLoader.GetString("CopyRightString"); } } /// <summary> /// Busca una cadena traducida similar a CREATE GAME. /// </summary> internal static string CreateGameMenuString { get { return ResourceLoader.GetString("CreateGameMenuString"); } } /// <summary> /// Busca una cadena traducida similar a Host a game.. /// </summary> internal static string CreateGameMMString { get { return ResourceLoader.GetString("CreateGameMMString"); } } /// <summary> /// Busca una cadena traducida similar a Create Session. /// </summary> internal static string CreateSession { get { return ResourceLoader.GetString("CreateSession"); } } /// <summary> /// Busca una cadena traducida similar a CREDITS. /// </summary> internal static string CreditsMenuString { get { return ResourceLoader.GetString("CreditsMenuString"); } } /// <summary> /// Busca una cadena traducida similar a Show creator credits.. /// </summary> internal static string CreditsMMString { get { return ResourceLoader.GetString("CreditsMMString"); } } /// <summary> /// Busca una cadena traducida similar a THANKS FOR PLAYING!. /// </summary> internal static string CreditsThanksForPlayingString { get { return ResourceLoader.GetString("CreditsThanksForPlayingString"); } } /// <summary> /// Busca una cadena traducida similar a CUSTOM MATCH. /// </summary> internal static string CustomMatchMenuString { get { return ResourceLoader.GetString("CustomMatchMenuString"); } } /// <summary> /// Busca una cadena traducida similar a Search for a game session to join within a set of ///parameters.. /// </summary> internal static string CustomMatchMMString { get { return ResourceLoader.GetString("CustomMatchMMString"); } } /// <summary> /// Busca una cadena traducida similar a We hope you have enjoyed the Demo. /// </summary> internal static string DemoEndScreenLine1 { get { return ResourceLoader.GetString("DemoEndScreenLine1"); } } /// <summary> /// Busca una cadena traducida similar a Prepare for more kind of enemies, more weapons, more power-ups and more surprises!. /// </summary> internal static string DemoEndScreenLine2 { get { return ResourceLoader.GetString("DemoEndScreenLine2"); } } /// <summary> /// Busca una cadena traducida similar a Be sure to stop by the Steam page and add the game to your Wishlist. /// </summary> internal static string DemoEndScreenLine3 { get { return ResourceLoader.GetString("DemoEndScreenLine3"); } } /// <summary> /// Busca una cadena traducida similar a Zombusters will be released fall 2020. /// </summary> internal static string DemoEndScreenLine4 { get { return ResourceLoader.GetString("DemoEndScreenLine4"); } } /// <summary> /// Busca una cadena traducida similar a End Session. /// </summary> internal static string EndSession { get { return ResourceLoader.GetString("EndSession"); } } /// <summary> /// Busca una cadena traducida similar a Lost connection to the network session. /// </summary> internal static string ErrorDisconnected { get { return ResourceLoader.GetString("ErrorDisconnected"); } } /// <summary> /// Busca una cadena traducida similar a You must sign in a suitable gamer profile. /// </summary> internal static string ErrorGamerPrivilege { get { return ResourceLoader.GetString("ErrorGamerPrivilege"); } } /// <summary> /// Busca una cadena traducida similar a Host ended the session. /// </summary> internal static string ErrorHostEndedSession { get { return ResourceLoader.GetString("ErrorHostEndedSession"); } } /// <summary> /// Busca una cadena traducida similar a There was an error while. /// </summary> internal static string ErrorNetwork { get { return ResourceLoader.GetString("ErrorNetwork"); } } /// <summary> /// Busca una cadena traducida similar a Networking is turned. /// </summary> internal static string ErrorNetworkNotAvailable { get { return ResourceLoader.GetString("ErrorNetworkNotAvailable"); } } /// <summary> /// Busca una cadena traducida similar a Host kicked you out of the session. /// </summary> internal static string ErrorRemovedByHost { get { return ResourceLoader.GetString("ErrorRemovedByHost"); } } /// <summary> /// Busca una cadena traducida similar a This session is already full. /// </summary> internal static string ErrorSessionFull { get { return ResourceLoader.GetString("ErrorSessionFull"); } } /// <summary> /// Busca una cadena traducida similar a Session not found. It may have ended,. /// </summary> internal static string ErrorSessionNotFound { get { return ResourceLoader.GetString("ErrorSessionNotFound"); } } /// <summary> /// Busca una cadena traducida similar a You must wait for the host to return to. /// </summary> internal static string ErrorSessionNotJoinable { get { return ResourceLoader.GetString("ErrorSessionNotJoinable"); } } /// <summary> /// Busca una cadena traducida similar a This functionality is not available in trial mode. /// </summary> internal static string ErrorTrialMode { get { return ResourceLoader.GetString("ErrorTrialMode"); } } /// <summary> /// Busca una cadena traducida similar a An unknown error occurred. /// </summary> internal static string ErrorUnknown { get { return ResourceLoader.GetString("ErrorUnknown"); } } /// <summary> /// Busca una cadena traducida similar a Exit. /// </summary> internal static string Exit { get { return ResourceLoader.GetString("Exit"); } } /// <summary> /// Busca una cadena traducida similar a EXTRAS. /// </summary> internal static string ExtrasMenuString { get { return ResourceLoader.GetString("ExtrasMenuString"); } } /// <summary> /// Busca una cadena traducida similar a Show the Extras menu. You can check how to play, ///Scoreboards or Credits.. /// </summary> internal static string ExtrasMMString { get { return ResourceLoader.GetString("ExtrasMMString"); } } /// <summary> /// Busca una cadena traducida similar a FIND SESSION. /// </summary> internal static string FindSessionMenuString { get { return ResourceLoader.GetString("FindSessionMenuString"); } } /// <summary> /// Busca una cadena traducida similar a Find session to play.. /// </summary> internal static string FindSessionMMString { get { return ResourceLoader.GetString("FindSessionMMString"); } } /// <summary> /// Busca una cadena traducida similar a Find Sessions. /// </summary> internal static string FindSessions { get { return ResourceLoader.GetString("FindSessions"); } } /// <summary> /// Busca una cadena traducida similar a This party is open to friends.. /// </summary> internal static string FriendOpenGroupString { get { return ResourceLoader.GetString("FriendOpenGroupString"); } } /// <summary> /// Busca una cadena traducida similar a Toggle full screen mode. /// </summary> internal static string FullScreenMenuString { get { return ResourceLoader.GetString("FullScreenMenuString"); } } /// <summary> /// Busca una cadena traducida similar a GAME OVER. /// </summary> internal static string GameOverString { get { return ResourceLoader.GetString("GameOverString"); } } /// <summary> /// Busca una cadena traducida similar a Restart from current wave. /// </summary> internal static string GPRestartCurrentWaveString { get { return ResourceLoader.GetString("GPRestartCurrentWaveString"); } } /// <summary> /// Busca una cadena traducida similar a Restart from beginning. /// </summary> internal static string GPRestartFromBeginningString { get { return ResourceLoader.GetString("GPRestartFromBeginningString"); } } /// <summary> /// Busca una cadena traducida similar a You are about to return to the party lobby. Any unsaved progress will be lost.. /// </summary> internal static string GPReturnLobbySupportString { get { return ResourceLoader.GetString("GPReturnLobbySupportString"); } } /// <summary> /// Busca una cadena traducida similar a You are about to return to the main menu. The session will disband, and any unsaved progress will be lost.. /// </summary> internal static string GPReturnMMSupportString { get { return ResourceLoader.GetString("GPReturnMMSupportString"); } } /// <summary> /// Busca una cadena traducida similar a Return to Main Menu. /// </summary> internal static string GPReturnToMainMenuString { get { return ResourceLoader.GetString("GPReturnToMainMenuString"); } } /// <summary> /// Busca una cadena traducida similar a (host). /// </summary> internal static string HostSuffix { get { return ResourceLoader.GetString("HostSuffix"); } } /// <summary> /// Busca una cadena traducida similar a HOW TO PLAY. /// </summary> internal static string HowToPlayInGameString { get { return ResourceLoader.GetString("HowToPlayInGameString"); } } /// <summary> /// Busca una cadena traducida similar a AIM + SHOOT. /// </summary> internal static string HTPAimShootString { get { return ResourceLoader.GetString("HTPAimShootString"); } } /// <summary> /// Busca una cadena traducida similar a CHANGE SONG. /// </summary> internal static string HTPChangeSongString { get { return ResourceLoader.GetString("HTPChangeSongString"); } } /// <summary> /// Busca una cadena traducida similar a CHANGE WEAPON. /// </summary> internal static string HTPChangeWeaponString { get { return ResourceLoader.GetString("HTPChangeWeaponString"); } } /// <summary> /// Busca una cadena traducida similar a Use the Left Thumbstick to move your character. ///Use the Right Thumbsitck to fire at the Zombies. ///Shoot the enemies to accumulate points and to get ///PowerUps. Catch the PowerUps to gain a free life ///or a new Weapon.. /// </summary> internal static string HTPExplanationString { get { return ResourceLoader.GetString("HTPExplanationString"); } } /// <summary> /// Busca una cadena traducida similar a GRENADE. /// </summary> internal static string HTPGrenadeString { get { return ResourceLoader.GetString("HTPGrenadeString"); } } /// <summary> /// Busca una cadena traducida similar a How to play Zombusters.. /// </summary> internal static string HTPMenuSupportString { get { return ResourceLoader.GetString("HTPMenuSupportString"); } } /// <summary> /// Busca una cadena traducida similar a MOVE. /// </summary> internal static string HTPMoveString { get { return ResourceLoader.GetString("HTPMoveString"); } } /// <summary> /// Busca una cadena traducida similar a PAUSE GAME. /// </summary> internal static string HTPPauseString { get { return ResourceLoader.GetString("HTPPauseString"); } } /// <summary> /// Busca una cadena traducida similar a REVIVE TEAMMATE. /// </summary> internal static string HTPReviveTeammateString { get { return ResourceLoader.GetString("HTPReviveTeammateString"); } } /// <summary> /// Busca una cadena traducida similar a TAUNT. /// </summary> internal static string HTPTauntString { get { return ResourceLoader.GetString("HTPTauntString"); } } /// <summary> /// Busca una cadena traducida similar a Invite. /// </summary> internal static string InviteMenuString { get { return ResourceLoader.GetString("InviteMenuString"); } } /// <summary> /// Busca una cadena traducida similar a Join Session. /// </summary> internal static string JoinSession { get { return ResourceLoader.GetString("JoinSession"); } } /// <summary> /// Busca una cadena traducida similar a LEADERBOARDS. /// </summary> internal static string LeaderboardMenuString { get { return ResourceLoader.GetString("LeaderboardMenuString"); } } /// <summary> /// Busca una cadena traducida similar a Check out the score of your friends online or Local. /// </summary> internal static string LeaderboardMMString { get { return ResourceLoader.GetString("LeaderboardMMString"); } } /// <summary> /// Busca una cadena traducida similar a SCORE. /// </summary> internal static string LeaderboardScoreString { get { return ResourceLoader.GetString("LeaderboardScoreString"); } } /// <summary> /// Busca una cadena traducida similar a Leave. /// </summary> internal static string LeaveMenuString { get { return ResourceLoader.GetString("LeaveMenuString"); } } /// <summary> /// Busca una cadena traducida similar a Leave Session. /// </summary> internal static string LeaveSession { get { return ResourceLoader.GetString("LeaveSession"); } } /// <summary> /// Busca una cadena traducida similar a LEVEL SELECTION. /// </summary> internal static string LevelSelectionString { get { return ResourceLoader.GetString("LevelSelectionString"); } } /// <summary> /// Busca una cadena traducida similar a LEVEL. /// </summary> internal static string LevelSelectMenuString { get { return ResourceLoader.GetString("LevelSelectMenuString"); } } /// <summary> /// Busca una cadena traducida similar a Choose the level to play.. /// </summary> internal static string LevelSelectMMString { get { return ResourceLoader.GetString("LevelSelectMMString"); } } /// <summary> /// Busca una cadena traducida similar a Loading.... /// </summary> internal static string Loading { get { return ResourceLoader.GetString("Loading"); } } /// <summary> /// Busca una cadena traducida similar a Lobby. /// </summary> internal static string Lobby { get { return ResourceLoader.GetString("Lobby"); } } /// <summary> /// Busca una cadena traducida similar a LOBBY. /// </summary> internal static string LobbyMenuString { get { return ResourceLoader.GetString("LobbyMenuString"); } } /// <summary> /// Busca una cadena traducida similar a Start a local game. You can play with three more ///players on the same console.. /// </summary> internal static string LocalGameMMString { get { return ResourceLoader.GetString("LocalGameMMString"); } } /// <summary> /// Busca una cadena traducida similar a LOCAL GAME. /// </summary> internal static string LocalGameString { get { return ResourceLoader.GetString("LocalGameString"); } } /// <summary> /// Busca una cadena traducida similar a Main Menu. /// </summary> internal static string MainMenu { get { return ResourceLoader.GetString("MainMenu"); } } /// <summary> /// Busca una cadena traducida similar a In Main Menu Lobby. /// </summary> internal static string MainMenuLobbyString { get { return ResourceLoader.GetString("MainMenuLobbyString"); } } /// <summary> /// Busca una cadena traducida similar a MAIN MENU. /// </summary> internal static string MainMenuString { get { return ResourceLoader.GetString("MainMenuString"); } } /// <summary> /// Busca una cadena traducida similar a Would you like to host a new game?. /// </summary> internal static string MatchmakingHostOwnGameString { get { return ResourceLoader.GetString("MatchmakingHostOwnGameString"); } } /// <summary> /// Busca una cadena traducida similar a In Matchmaking Lobby. /// </summary> internal static string MatchmakingLobbyString { get { return ResourceLoader.GetString("MatchmakingLobbyString"); } } /// <summary> /// Busca una cadena traducida similar a MATCHMAKING. /// </summary> internal static string MatchmakingMenuString { get { return ResourceLoader.GetString("MatchmakingMenuString"); } } /// <summary> /// Busca una cadena traducida similar a Take your party to Xbox LIVE and into the frenetic ///action of live combat. Up to four players co-operate ///to survive wave after wave of the Zombie horde.. /// </summary> internal static string MatchmakingMMString { get { return ResourceLoader.GetString("MatchmakingMMString"); } } /// <summary> /// Busca una cadena traducida similar a MAX. PLAYERS. /// </summary> internal static string MaxPlayersMenuString { get { return ResourceLoader.GetString("MaxPlayersMenuString"); } } /// <summary> /// Busca una cadena traducida similar a How many players would you like to play?. /// </summary> internal static string MaxPlayersMMString { get { return ResourceLoader.GetString("MaxPlayersMMString"); } } /// <summary> /// Busca una cadena traducida similar a . /// </summary> internal static string MessageBoxUsage { get { return ResourceLoader.GetString("MessageBoxUsage"); } } /// <summary> /// Busca una cadena traducida similar a {0} joined. /// </summary> internal static string MessageGamerJoined { get { return ResourceLoader.GetString("MessageGamerJoined"); } } /// <summary> /// Busca una cadena traducida similar a {0} left. /// </summary> internal static string MessageGamerLeft { get { return ResourceLoader.GetString("MessageGamerLeft"); } } /// <summary> /// Busca una cadena traducida similar a Music Volume. /// </summary> internal static string MusicVolumeString { get { return ResourceLoader.GetString("MusicVolumeString"); } } /// <summary> /// Busca una cadena traducida similar a MY PARTY. /// </summary> internal static string MyGroupString { get { return ResourceLoader.GetString("MyGroupString"); } } /// <summary> /// Busca una cadena traducida similar a Networking.... /// </summary> internal static string NetworkBusy { get { return ResourceLoader.GetString("NetworkBusy"); } } /// <summary> /// Busca una cadena traducida similar a Choose your Network for the Matchmaking. Play a ///SystemLink or Xbox Live game.. /// </summary> internal static string NetworkMatchmakingMMString { get { return ResourceLoader.GetString("NetworkMatchmakingMMString"); } } /// <summary> /// Busca una cadena traducida similar a NETWORK. /// </summary> internal static string NetworkMatchmakingString { get { return ResourceLoader.GetString("NetworkMatchmakingString"); } } /// <summary> /// Busca una cadena traducida similar a No sessions found. /// </summary> internal static string NoSessionsFound { get { return ResourceLoader.GetString("NoSessionsFound"); } } /// <summary> /// Busca una cadena traducida similar a Eight. /// </summary> internal static string NumberEight { get { return ResourceLoader.GetString("NumberEight"); } } /// <summary> /// Busca una cadena traducida similar a Five. /// </summary> internal static string NumberFive { get { return ResourceLoader.GetString("NumberFive"); } } /// <summary> /// Busca una cadena traducida similar a Four. /// </summary> internal static string NumberFour { get { return ResourceLoader.GetString("NumberFour"); } } /// <summary> /// Busca una cadena traducida similar a Nine. /// </summary> internal static string NumberNine { get { return ResourceLoader.GetString("NumberNine"); } } /// <summary> /// Busca una cadena traducida similar a One. /// </summary> internal static string NumberOne { get { return ResourceLoader.GetString("NumberOne"); } } /// <summary> /// Busca una cadena traducida similar a Seven. /// </summary> internal static string NumberSeven { get { return ResourceLoader.GetString("NumberSeven"); } } /// <summary> /// Busca una cadena traducida similar a Six. /// </summary> internal static string NumberSix { get { return ResourceLoader.GetString("NumberSix"); } } /// <summary> /// Busca una cadena traducida similar a Ten. /// </summary> internal static string NumberTen { get { return ResourceLoader.GetString("NumberTen"); } } /// <summary> /// Busca una cadena traducida similar a Three. /// </summary> internal static string NumberThree { get { return ResourceLoader.GetString("NumberThree"); } } /// <summary> /// Busca una cadena traducida similar a Two. /// </summary> internal static string NumberTwo { get { return ResourceLoader.GetString("NumberTwo"); } } /// <summary> /// Busca una cadena traducida similar a Player 1 Press Start. /// </summary> internal static string P1PressStartString { get { return ResourceLoader.GetString("P1PressStartString"); } } /// <summary> /// Busca una cadena traducida similar a Player 2 Press Start. /// </summary> internal static string P2PressStartString { get { return ResourceLoader.GetString("P2PressStartString"); } } /// <summary> /// Busca una cadena traducida similar a Player 3 Press Start. /// </summary> internal static string P3PressStartString { get { return ResourceLoader.GetString("P3PressStartString"); } } /// <summary> /// Busca una cadena traducida similar a Player 4 Press Start. /// </summary> internal static string P4PressStartString { get { return ResourceLoader.GetString("P4PressStartString"); } } /// <summary> /// Busca una cadena traducida similar a Invite Party. /// </summary> internal static string PartyMenuString { get { return ResourceLoader.GetString("PartyMenuString"); } } /// <summary> /// Busca una cadena traducida similar a Paused. /// </summary> internal static string Paused { get { return ResourceLoader.GetString("Paused"); } } /// <summary> /// Busca una cadena traducida similar a Use A,S,D,W or Arrows to move your character. ///Use Left Mouse Button to fire at the Zombies. ///Shoot the enemies to accumulate points and to get ///PowerUps. Catch the PowerUps to gain a free life ///or a new Weapon.. /// </summary> internal static string PCExplanationString { get { return ResourceLoader.GetString("PCExplanationString"); } } /// <summary> /// Busca una cadena traducida similar a Press Any Key. /// </summary> internal static string PCPressAnyKeyString { get { return ResourceLoader.GetString("PCPressAnyKeyString"); } } /// <summary> /// Busca una cadena traducida similar a Player Four. /// </summary> internal static string PlayerFourString { get { return ResourceLoader.GetString("PlayerFourString"); } } /// <summary> /// Busca una cadena traducida similar a LIVE. /// </summary> internal static string PlayerMatch { get { return ResourceLoader.GetString("PlayerMatch"); } } /// <summary> /// Busca una cadena traducida similar a Player One. /// </summary> internal static string PlayerOneString { get { return ResourceLoader.GetString("PlayerOneString"); } } /// <summary> /// Busca una cadena traducida similar a Press GUIDE to Sign In. /// </summary> internal static string PlayerSignInString { get { return ResourceLoader.GetString("PlayerSignInString"); } } /// <summary> /// Busca una cadena traducida similar a Player Three. /// </summary> internal static string PlayerThreeString { get { return ResourceLoader.GetString("PlayerThreeString"); } } /// <summary> /// Busca una cadena traducida similar a Player Two. /// </summary> internal static string PlayerTwoString { get { return ResourceLoader.GetString("PlayerTwoString"); } } /// <summary> /// Busca una cadena traducida similar a Starts playlist for the selected Machmaking configuration.. /// </summary> internal static string PlaylistMatchmakingMMString { get { return ResourceLoader.GetString("PlaylistMatchmakingMMString"); } } /// <summary> /// Busca una cadena traducida similar a PLAYLIST. /// </summary> internal static string PlaylistMatchmakingString { get { return ResourceLoader.GetString("PlaylistMatchmakingString"); } } /// <summary> /// Busca una cadena traducida similar a Prepare for the next Wave. /// </summary> internal static string PrepareNextWaveGameplayString { get { return ResourceLoader.GetString("PrepareNextWaveGameplayString"); } } /// <summary> /// Busca una cadena traducida similar a Press START button. /// </summary> internal static string PressStartString { get { return ResourceLoader.GetString("PressStartString"); } } /// <summary> /// Busca una cadena traducida similar a PRIVATE SLOTS. /// </summary> internal static string PrivateSlotsMenuString { get { return ResourceLoader.GetString("PrivateSlotsMenuString"); } } /// <summary> /// Busca una cadena traducida similar a Select number of private slots.. /// </summary> internal static string PrivateSlotsMMString { get { return ResourceLoader.GetString("PrivateSlotsMMString"); } } /// <summary> /// Busca una cadena traducida similar a QUICK MATCH. /// </summary> internal static string QuickMatchMenuString { get { return ResourceLoader.GetString("QuickMatchMenuString"); } } /// <summary> /// Busca una cadena traducida similar a Quickly join another player&apos;s game session.. /// </summary> internal static string QuickMatchMMString { get { return ResourceLoader.GetString("QuickMatchMMString"); } } /// <summary> /// Busca una cadena traducida similar a QUIT GAME. /// </summary> internal static string QuitGame { get { return ResourceLoader.GetString("QuitGame"); } } /// <summary> /// Busca una cadena traducida similar a Quit to Main Menu. /// </summary> internal static string QuitToMainMenuInGameString { get { return ResourceLoader.GetString("QuitToMainMenuInGameString"); } } /// <summary> /// Busca una cadena traducida similar a Later. /// </summary> internal static string RateThisAppCancel { get { return ResourceLoader.GetString("RateThisAppCancel"); } } /// <summary> /// Busca una cadena traducida similar a Yes!. /// </summary> internal static string RateThisAppOK { get { return ResourceLoader.GetString("RateThisAppOK"); } } /// <summary> /// Busca una cadena traducida similar a Did you like Zombusters? Please help rating this app in the marketplace. Thank you!. /// </summary> internal static string RateThisAppText { get { return ResourceLoader.GetString("RateThisAppText"); } } /// <summary> /// Busca una cadena traducida similar a Rate this App. /// </summary> internal static string RateThisAppTitle { get { return ResourceLoader.GetString("RateThisAppTitle"); } } /// <summary> /// Busca una cadena traducida similar a READY. /// </summary> internal static string ReadySelPlayerString { get { return ResourceLoader.GetString("ReadySelPlayerString"); } } /// <summary> /// Busca una cadena traducida similar a Please Reconnect Controller. /// </summary> internal static string ReconnectControllerString { get { return ResourceLoader.GetString("ReconnectControllerString"); } } /// <summary> /// Busca una cadena traducida similar a Restart Level. /// </summary> internal static string RestartLevelInGameString { get { return ResourceLoader.GetString("RestartLevelInGameString"); } } /// <summary> /// Busca una cadena traducida similar a Resume Game. /// </summary> internal static string ResumeGame { get { return ResourceLoader.GetString("ResumeGame"); } } /// <summary> /// Busca una cadena traducida similar a Quit game and return to Xbox Dashboard.. /// </summary> internal static string ReturnToDashboardMMString { get { return ResourceLoader.GetString("ReturnToDashboardMMString"); } } /// <summary> /// Busca una cadena traducida similar a QUIT TO XBOX DASHBOARD. /// </summary> internal static string ReturnToDashboardString { get { return ResourceLoader.GetString("ReturnToDashboardString"); } } /// <summary> /// Busca una cadena traducida similar a Return to Lobby. /// </summary> internal static string ReturnToLobby { get { return ResourceLoader.GetString("ReturnToLobby"); } } /// <summary> /// Busca una cadena traducida similar a REVIEW APP. /// </summary> internal static string ReviewMenuString { get { return ResourceLoader.GetString("ReviewMenuString"); } } /// <summary> /// Busca una cadena traducida similar a Please help us and review Zombusters! Thanks!. /// </summary> internal static string ReviewMMString { get { return ResourceLoader.GetString("ReviewMMString"); } } /// <summary> /// Busca una cadena traducida similar a Save and Exit. /// </summary> internal static string SaveAndExitString { get { return ResourceLoader.GetString("SaveAndExitString"); } } /// <summary> /// Busca una cadena traducida similar a Select. /// </summary> internal static string SelectString { get { return ResourceLoader.GetString("SelectString"); } } /// <summary> /// Busca una cadena traducida similar a SETTINGS. /// </summary> internal static string SettingsMenuString { get { return ResourceLoader.GetString("SettingsMenuString"); } } /// <summary> /// Busca una cadena traducida similar a Show Gamer Card. /// </summary> internal static string ShowGamerCardMenuString { get { return ResourceLoader.GetString("ShowGamerCardMenuString"); } } /// <summary> /// Busca una cadena traducida similar a Single Player. /// </summary> internal static string SinglePlayer { get { return ResourceLoader.GetString("SinglePlayer"); } } /// <summary> /// Busca una cadena traducida similar a Sound Effect Volume. /// </summary> internal static string SoundEffectVolumeString { get { return ResourceLoader.GetString("SoundEffectVolumeString"); } } /// <summary> /// Busca una cadena traducida similar a Start Game. /// </summary> internal static string StartGameMenuString { get { return ResourceLoader.GetString("StartGameMenuString"); } } /// <summary> /// Busca una cadena traducida similar a START MATCHMAKING. /// </summary> internal static string StartMatchmakingMenuString { get { return ResourceLoader.GetString("StartMatchmakingMenuString"); } } /// <summary> /// Busca una cadena traducida similar a Starts Matchmaking.. /// </summary> internal static string StartMatchmakingMMString { get { return ResourceLoader.GetString("StartMatchmakingMMString"); } } /// <summary> /// Busca una cadena traducida similar a MARKETPLACE. /// </summary> internal static string StoreMenuString { get { return ResourceLoader.GetString("StoreMenuString"); } } /// <summary> /// Busca una cadena traducida similar a Check out our merchandise on our Official Store at Redbubble. /// </summary> internal static string StoreMMString { get { return ResourceLoader.GetString("StoreMMString"); } } /// <summary> /// Busca una cadena traducida similar a even though not all players are ready?. /// </summary> internal static string String { get { return ResourceLoader.GetString("String"); } } /// <summary> /// Busca una cadena traducida similar a Would you like to purchase this game?. /// </summary> internal static string String1 { get { return ResourceLoader.GetString("String1"); } } /// <summary> /// Busca una cadena traducida similar a in order to access this functionality. /// </summary> internal static string String2 { get { return ResourceLoader.GetString("String2"); } } /// <summary> /// Busca una cadena traducida similar a accessing the network. /// </summary> internal static string String3 { get { return ResourceLoader.GetString("String3"); } } /// <summary> /// Busca una cadena traducida similar a off or not connected. /// </summary> internal static string String4 { get { return ResourceLoader.GetString("String4"); } } /// <summary> /// Busca una cadena traducida similar a or there may be no network connectivity. /// </summary> internal static string String5 { get { return ResourceLoader.GetString("String5"); } } /// <summary> /// Busca una cadena traducida similar a between the local machine and session host. /// </summary> internal static string String6 { get { return ResourceLoader.GetString("String6"); } } /// <summary> /// Busca una cadena traducida similar a the lobby before you can join this session. /// </summary> internal static string String7 { get { return ResourceLoader.GetString("String7"); } } /// <summary> /// Busca una cadena traducida similar a A button, Space, Enter = ok. /// </summary> internal static string String8 { get { return ResourceLoader.GetString("String8"); } } /// <summary> /// Busca una cadena traducida similar a B button, Esc = cancel. /// </summary> internal static string String9 { get { return ResourceLoader.GetString("String9"); } } /// <summary> /// Busca una cadena traducida similar a Switch Ready. /// </summary> internal static string SwitchReadyMenuString { get { return ResourceLoader.GetString("SwitchReadyMenuString"); } } /// <summary> /// Busca una cadena traducida similar a System Link. /// </summary> internal static string SystemLink { get { return ResourceLoader.GetString("SystemLink"); } } /// <summary> /// Busca una cadena traducida similar a Toggle Ready. /// </summary> internal static string ToggleReadyMenuString { get { return ResourceLoader.GetString("ToggleReadyMenuString"); } } /// <summary> /// Busca una cadena traducida similar a Trial Mode. /// </summary> internal static string TrialModeMenuString { get { return ResourceLoader.GetString("TrialModeMenuString"); } } /// <summary> /// Busca una cadena traducida similar a Unlock Full Game. /// </summary> internal static string UnlockFullGameMenuString { get { return ResourceLoader.GetString("UnlockFullGameMenuString"); } } /// <summary> /// Busca una cadena traducida similar a For more info and news!. /// </summary> internal static string VisitRetrowaxMenuStringWP { get { return ResourceLoader.GetString("VisitRetrowaxMenuStringWP"); } } /// <summary> /// Busca una cadena traducida similar a Waiting for players.... /// </summary> internal static string WaitingForPlayersMenuString { get { return ResourceLoader.GetString("WaitingForPlayersMenuString"); } } /// <summary> /// Busca una cadena traducida similar a WAVE. /// </summary> internal static string WaveGameplayString { get { return ResourceLoader.GetString("WaveGameplayString"); } } /// <summary> /// Busca una cadena traducida similar a ADD ZOMBUSTERS TO MY WISHLIST. /// </summary> internal static string WishListGameMenu { get { return ResourceLoader.GetString("WishListGameMenu"); } } /// <summary> /// Busca una cadena traducida similar a If you want to support us we would appreciate if you add Zombusters to your wishlist.. /// </summary> internal static string WishListGameMenuHelp { get { return ResourceLoader.GetString("WishListGameMenuHelp"); } } /// <summary> /// Busca una cadena traducida similar a PLAY. /// </summary> internal static string WPPlayNewGame { get { return ResourceLoader.GetString("WPPlayNewGame"); } } /// <summary> /// Busca una cadena traducida similar a Start a new game.. /// </summary> internal static string WPPlayNewGameMMString { get { return ResourceLoader.GetString("WPPlayNewGameMMString"); } } /// <summary> /// Busca una cadena traducida similar a Shake your device to change the song currently played. /// </summary> internal static string WPShakeToChangeSong { get { return ResourceLoader.GetString("WPShakeToChangeSong"); } } /// <summary> /// Busca una cadena traducida similar a Tap screen to start. /// </summary> internal static string WPTapScreen { get { return ResourceLoader.GetString("WPTapScreen"); } } /// <summary> /// Busca una cadena traducida similar a Tip:. /// </summary> internal static string WPTip { get { return ResourceLoader.GetString("WPTip"); } } /// <summary> /// Busca una cadena traducida similar a You saved the city! You are the new city Hero!. /// </summary> internal static string YouSavedCityEndGameString { get { return ResourceLoader.GetString("YouSavedCityEndGameString"); } } } } <|start_filename|>ZombustersWindows/MyGame.cs<|end_filename|> using System; using System.Collections.Generic; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using GameStateManagement; using ZombustersWindows.Subsystem_Managers; using ZombustersWindows.MainScreens; using ZombustersWindows.Localization; using Bugsnag; using GameAnalyticsSDK.Net; using Steamworks; namespace ZombustersWindows { public class MyGame : Game { public int VIRTUAL_RESOLUTION_WIDTH = 1280; public int VIRTUAL_RESOLUTION_HEIGHT = 720; public const int MAX_PLAYERS = 4; private const string ANALYTICS_GAME_KEY = "<KEY>"; private const string ANALYTICS_SEC_KEY = "8924590c2447e4a6e5335aea11e16f5ff8150d04"; private const string BUGSNAG_KEY = "<KEY>"; public GraphicsDeviceManager graphics; public ScreenManager screenManager; public GamePlayScreen playScreen; public Player[] players = new Player[MAX_PLAYERS]; public Color[] playerColors = new Color[MAX_PLAYERS]; public OptionsState options; public AudioManager audio; public InputManager input; public GameState currentGameState; public InputMode currentInputMode = InputMode.Keyboard; public TopScoreListContainer topScoreListContainer; public MusicComponent musicComponent; public Texture2D blackTexture; public Client bugSnagClient; public StorageDataSource storageDataSource; public float totalGameSeconds; //public BloomComponent bloom; //public StorageDeviceManager storageDeviceManager; #if DEBUG public FrameRateCounter FrameRateComponent; public DebugInfoComponent DebugComponent; #endif //int bloomSettingsIndex = 0; public String[] networkSettings = { "XBOX LIVE", "SYSTEM LINK" }; public int currentNetworkSetting; public int maxGamers = 4; public int maxLocalGamers = 4; public bool isInMenu = false; private bool bPaused = false; private bool bStateReady = false; public MyGame() { graphics = new GraphicsDeviceManager(this) { IsFullScreen = false }; Resolution.Init(ref graphics); Content.RootDirectory = "Content"; #if !WINDOWS_UAP Resolution.SetVirtualResolution(VIRTUAL_RESOLUTION_WIDTH, VIRTUAL_RESOLUTION_HEIGHT); Resolution.SetResolution(VIRTUAL_RESOLUTION_WIDTH, VIRTUAL_RESOLUTION_HEIGHT, graphics.IsFullScreen); #endif options = new OptionsState(); screenManager = new ScreenManager(this); Components.Add(screenManager); screenManager.TraceEnabled = true; audio = new AudioManager(this); Components.Add(audio); audio.SetOptions(0.7f, 0.5f); input = new InputManager(this); Components.Add(input); bugSnagClient = new Client(BUGSNAG_KEY); InitSteamClient(); storageDataSource = new StorageDataSource(ref bugSnagClient); currentNetworkSetting = 0; #if DEBUG FrameRateComponent = new FrameRateCounter(this); Components.Add(FrameRateComponent); DebugComponent = new DebugInfoComponent(this); Components.Add(DebugComponent); #endif musicComponent = new MusicComponent(this); Components.Add(musicComponent); musicComponent.Enabled = true; } private void InitPlayers() { players[(int)PlayerIndex.One] = new Player(options, audio, this, Color.Blue, Strings.PlayerOneString, GraphicsDevice.Viewport); players[(int)PlayerIndex.Two] = new Player(options, audio, this, Color.Red, Strings.PlayerTwoString, GraphicsDevice.Viewport); players[(int)PlayerIndex.Three] = new Player(options, audio, this, Color.Green, Strings.PlayerThreeString, GraphicsDevice.Viewport); players[(int)PlayerIndex.Four] = new Player(options, audio, this, Color.Yellow, Strings.PlayerFourString, GraphicsDevice.Viewport); for (int playerIndex = 0; playerIndex < MAX_PLAYERS; playerIndex++) { LoadOptions(players[playerIndex]); } } private void InitSteamClient() { try { #if DEMO SteamClient.Init(1294640); #else SteamClient.Init(1272300); #endif } catch {} } protected override void Initialize() { InitializeMetrics(); base.Initialize(); InitPlayers(); screenManager.AddScreen(new LogoScreen()); currentGameState = GameState.SignIn; } protected override void LoadContent() { blackTexture = new Texture2D(GraphicsDevice, 1280, 720, false, SurfaceFormat.Color); Color[] colors = new Color[1280 * 720]; for (int j = 0; j < colors.Length; j++) { colors[j] = Color.Black; } blackTexture.SetData(colors); } protected override void Update(GameTime gameTime) { if (currentGameState != GameState.Paused) { if (!bPaused && bStateReady) { totalGameSeconds += (float)gameTime.ElapsedGameTime.TotalSeconds; foreach (Player player in players) { if (player.IsPlaying) { player.avatar.Update(gameTime, totalGameSeconds); } } } base.Update(gameTime); } } #region Start Games public void BeginLocalGame(LevelType level) { Reset(); bStateReady = true; this.audio.StopMenuMusic(); currentGameState = GameState.InGame; playScreen = new GamePlayScreen(this, level, SubLevel.SubLevelType.One); screenManager.AddScreen(playScreen); } public void BeginSelectPlayerScreen(Boolean isMatchmaking) { Reset(); bStateReady = true; currentGameState = GameState.InLobby; screenManager.AddScreen(new SelectPlayerScreen(isMatchmaking)); } public void Reset() { totalGameSeconds = 0; for (int playerIndex = 0; playerIndex < MAX_PLAYERS; playerIndex++) { players[playerIndex].avatar.Reset(); } /*avatars[0].Reset(Color.Blue); avatars[1].Reset(Color.Red); avatars[2].Reset(Color.Green); avatars[3].Reset(Color.Yellow); avatars[0].Player = player1; avatars[1].Player = player2; avatars[2].Player = player3; avatars[3].Player = player4;*/ } public void Restart() { for (int playerIndex = 0; playerIndex < MAX_PLAYERS; playerIndex++) { if (players[playerIndex].IsPlaying) { players[playerIndex].avatar.Restart(); players[playerIndex].avatar.Activate(); } } totalGameSeconds = 0; } #endregion #region Extras Menu public void DisplayHowToPlay() { screenManager.AddScreen(new HowToPlayScreen()); } public void DisplayLeaderBoard() { screenManager.AddScreen(new LeaderBoardScreen()); } public void DisplayExtrasMenu() { screenManager.AddScreen(new ExtrasMenuScreen()); } public void DisplayCredits() { screenManager.AddScreen(new CreditsScreen(true)); } public void DisplayAchievementsScreen(Player player) { screenManager.AddScreen(new AchievementsScreen(player)); } #endregion public void TrySignIn(bool isSignedInGamer, EventHandler handler) { LoadInScreen screen = new LoadInScreen(1, false); screen.ScreenFinished += new EventHandler(handler); screenManager.AddScreen(screen); } public void FailToMenu() { foreach (GameScreen item in screenManager.GetScreens()) { screenManager.RemoveScreen(item); } QuitGame(); } public void QuitGame() { playScreen = null; Reset(); bPaused = EndPause(); } #region Setting Options public void DisplayOptions(int player) { screenManager.AddScreen(new OptionsScreen(this, players[player])); } public void SetOptions(OptionsState state, Player player) { this.options = state; player.optionsState = state; audio.SetOptions(state.FXLevel, state.MusicLevel); player.SaveOptions(); } public void LoadOptions(Player player) { player.LoadOptions(); player.LoadLeaderBoard(); } #endregion #region Pausing public bool IsPaused { get { return bPaused; } } public bool BeginPause() { if (!bPaused) { bPaused = true; audio.PauseSounds(); input.BeginPause(); for (int playerIndex = 0; playerIndex < MAX_PLAYERS; playerIndex++) { players[playerIndex].BeginPause(); } } return IsPaused; } public bool EndPause() { if (bPaused) { audio.ResumeAll(); input.EndPause(); for (int playerIndex = 0; playerIndex < MAX_PLAYERS; playerIndex++) { players[playerIndex].EndPause(); } bPaused = false; } return IsPaused; } #endregion protected override void Draw(GameTime gameTime) { graphics.GraphicsDevice.Clear(Color.Black); base.Draw(gameTime); } private void InitializeMetrics() { #if DEBUG GameAnalytics.SetEnabledInfoLog(true); GameAnalytics.SetEnabledVerboseLog(true); #endif #if DEMO GameAnalytics.ConfigureBuild("windows 1.1.0 DEMO"); #else GameAnalytics.ConfigureBuild("windows 1.1.0"); #endif GameAnalytics.Initialize(ANALYTICS_GAME_KEY, ANALYTICS_SEC_KEY); GameAnalytics.StartSession(); } } } <|start_filename|>ZombustersWindows/SubsystemManagers/ResolutionManager.cs<|end_filename|> using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; namespace ZombustersWindows.Subsystem_Managers { static class Resolution { static private GraphicsDeviceManager graphicsDeviceManager = null; static private int width = 800; static private int height = 600; static private int virtualWidth = 1280; static private int virtualHeight = 720; static private Matrix scaleMatrix; static private bool isFullScreen = false; static private bool isDirtyMatrix = true; static public void Init(ref GraphicsDeviceManager device) { width = device.PreferredBackBufferWidth; height = device.PreferredBackBufferHeight; graphicsDeviceManager = device; isDirtyMatrix = true; #if !WINDOWS_UAP ApplyResolutionSettings(); #endif } static public Matrix getTransformationMatrix() { if (isDirtyMatrix) RecreateScaleMatrix(); return scaleMatrix; } static public void SetResolution(int Width, int Height, bool FullScreen) { width = Width; height = Height; isFullScreen = FullScreen; ApplyResolutionSettings(); } static public void SetVirtualResolution(int Width, int Height) { virtualWidth = Width; virtualHeight = Height; isDirtyMatrix = true; } static private void ApplyResolutionSettings() { #if XBOX360 isFullScreen = true; #endif // If we aren't using a full screen mode, the height and width of the window can // be set to anything equal to or smaller than the actual screen size. if (isFullScreen == false) { if ((width <= GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width) && (height <= GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height)) { graphicsDeviceManager.PreferredBackBufferWidth = width; graphicsDeviceManager.PreferredBackBufferHeight = height; graphicsDeviceManager.IsFullScreen = isFullScreen; graphicsDeviceManager.ApplyChanges(); } } else { // If we are using full screen mode, we should check to make sure that the display // adapter can handle the video mode we are trying to set. To do this, we will // iterate through the display modes supported by the adapter and check them against // the mode we want to set. foreach (DisplayMode dm in GraphicsAdapter.DefaultAdapter.SupportedDisplayModes) { // Check the width and height of each mode against the passed values if ((dm.Width == width) && (dm.Height == height)) { // The mode is supported, so set the buffer formats, apply changes and return graphicsDeviceManager.PreferredBackBufferWidth = width; graphicsDeviceManager.PreferredBackBufferHeight = height; graphicsDeviceManager.IsFullScreen = isFullScreen; graphicsDeviceManager.ApplyChanges(); } } } isDirtyMatrix = true; width = graphicsDeviceManager.PreferredBackBufferWidth; height = graphicsDeviceManager.PreferredBackBufferHeight; } /// <summary> /// Sets the device to use the draw pump /// Sets correct aspect ratio /// </summary> static public void BeginDraw() { // Start by reseting viewport to (0,0,1,1) FullViewport(); // Clear to Black graphicsDeviceManager.GraphicsDevice.Clear(Color.Black); // Calculate Proper Viewport according to Aspect Ratio ResetViewport(); // and clear that // This way we are gonna have black bars if aspect ratio requires it and // the clear color on the rest graphicsDeviceManager.GraphicsDevice.Clear(Color.CornflowerBlue); } static private void RecreateScaleMatrix() { isDirtyMatrix = false; scaleMatrix = Matrix.CreateScale( (float)graphicsDeviceManager.GraphicsDevice.Viewport.Width / virtualWidth, (float)graphicsDeviceManager.GraphicsDevice.Viewport.Width / virtualWidth, 1f); } static public void FullViewport() { Viewport viewport = new Viewport(); viewport.X = viewport.Y = 0; viewport.Width = width; viewport.Height = height; graphicsDeviceManager.GraphicsDevice.Viewport = viewport; } /// <summary> /// Get virtual Mode Aspect Ratio /// </summary> /// <returns>aspect ratio</returns> static public float GetVirtualAspectRatio() { return (float)virtualWidth / (float)virtualHeight; } static public void ResetViewport() { float targetAspectRatio = GetVirtualAspectRatio(); // figure out the largest area that fits in this resolution at the desired aspect ratio int width = graphicsDeviceManager.PreferredBackBufferWidth; int height = (int)(width / targetAspectRatio + .5f); bool changed = false; if (height > graphicsDeviceManager.PreferredBackBufferHeight) { height = graphicsDeviceManager.PreferredBackBufferHeight; // PillarBox width = (int)(height * targetAspectRatio + .5f); changed = true; } // set up the new viewport centered in the backbuffer Viewport viewport = new Viewport { X = (graphicsDeviceManager.PreferredBackBufferWidth / 2) - (width / 2), Y = (graphicsDeviceManager.PreferredBackBufferHeight / 2) - (height / 2), Width = width, Height = height, MinDepth = 0, MaxDepth = 1 }; if (changed) { isDirtyMatrix = true; } graphicsDeviceManager.GraphicsDevice.Viewport = viewport; } } }
retrowax/Zombusters
<|start_filename|>experimental/TAO_Transfer_Learning/Dockerfile<|end_filename|> # Copyright (c) 2020 NVIDIA Corporation. All rights reserved. ## To build the docker container, run: $ sudo docker build -t ai-tao:1.0 . ## To run: $ sudo docker run --rm -it --gpus=all -p 8888:8888 -p 8000:8000 ai-tao:1.0 # Finally, open http://127.0.0.1:8888/ # Select Base Image FROM nvcr.io/nvidia/tlt-streamanalytics:v3.0-dp-py3 # Update the repo RUN apt-get update -y # Install required dependencies RUN apt-get install -y git nvidia-modprobe #RUN pip3 install --no-cache-dir jupyter RUN pip3 install jupyterlab # Install required python packages RUN pip3 install ipywidgets RUN pip3 install gdown # TO COPY the data COPY English/ /workspace/tlt-experiments # To Download VOC dataaset #RUN mkdir /workspace/tlt-experiments/data #RUN curl http://host.robots.ox.ac.uk/pascal/VOC/voc2012/VOCtrainval_11-May-2012.tar -o ~/English/tao_experiments/data/VOCtrainval_11-May-2012.tar RUN python3 /workspace/tlt-experiments/source_code/dataset.py ## Uncomment this line to run Jupyter notebook by default #CMD jupyter-lab --no-browser --allow-root --ip=0.0.0.0 --port=8888 --NotebookApp.token="" --notebook-dir=/workspace/tlt-experiments
girihemant19/gpubootcamp
<|start_filename|>wpa_supplicant-2.6/src/eap_peer/eap_noob.h<|end_filename|> #ifndef EAPOOB_H #define EAPOOB_H /* Configuration file */ #define CONF_FILE "eapnoob.conf" /* All the pre-processors of EAP-NOOB */ #define MAX_QUERY_LEN 2048 #define DEFAULT_REALM "eap-noob.net" #define VERSION_ONE 1 #define SUITE_ONE 1 #define DB_NAME "/etc/peer_connection_db" #define NOOB_LEN 16 #define NOOBID_LEN 16 #define NONCE_LEN 32 #define ECDH_SHARED_SECRET_LEN 32 #define ECDH_KDF_MAX (1 << 30) #define MAX_URL_LEN 60 #define ALGORITHM_ID "EAP-NOOB" #define ALGORITHM_ID_LEN 8 #define FORMAT_BASE64URL 1 /* MAX values for the fields */ #define MAX_SUP_VER 1 #define MAX_SUP_CSUITES 1 #define MAX_PEER_ID_LEN 22 #define MAX_CONF_LEN 500 #define MAX_INFO_LEN 500 #define KDF_LEN 320 #define MSK_LEN 64 #define EMSK_LEN 64 #define AMSK_LEN 64 #define METHOD_ID_LEN 32 #define KZ_LEN 32 #define KMS_LEN 32 #define KMP_LEN 32 #define MAC_LEN 32 #define MAX_X25519_LEN 48 #define NUM_OF_STATES 5 #define MAX_MSG_TYPES 8 /* OOB DIRECTIONS */ #define PEER_TO_SERV 1 #define SERV_TO_PEER 2 #define BOTH_DIR 3 #define SUCCESS 1 #define FAILURE -1 #define EMPTY 0 #define INVALID 0 #define VALID 1 /* keywords for json encoding and decoding */ #define TYPE "Type" #define ERRORINFO "ErrorInfo" #define ERRORCODE "ErrorCode" #define VERS "Vers" #define CRYPTOSUITES "Cryptosuites" #define DIRS "Dirs" #define NS "Ns" #define NS2 "Ns2" #define SLEEPTIME "SleepTime" #define PEERID "PeerId" #define PKS "PKs" #define SERVERINFO "ServerInfo" #define MACS "MACs" #define MACS2 "MACs2" #define HINT_PEER "NoobId" #define HINT_SERV "NoobId" #define VERP "Verp" #define CRYPTOSUITEP "Cryptosuitep" #define DIRP "Dirp" #define NP "Np" #define NP2 "Np2" #define PKP "PKp" #define PEERINFO "PeerInfo" #define MACP "MACp" #define MACP2 "MACp2" #define X_COORDINATE "x" #define Y_COORDINATE "y" #define REALM "Realm" #define KEY_TYPE "kty" #define CURVE "crv" #define PEER_SERIAL_NUM "Serial" #define PEER_SSID "SSID" #define PEER_BSSID "BSSID" #define PEER_TYPE "Type" #define PEER_MAKE "Make" /*bit masks to validate message structure*/ #define PEERID_RCVD 0x0001 #define DIRS_RCVD 0x0002 #define CRYPTOSUITES_RCVD 0x0004 #define VERSION_RCVD 0x0008 #define NONCE_RCVD 0x0010 #define MAC_RCVD 0x0020 #define PKEY_RCVD 0x0040 #define INFO_RCVD 0x0080 #define STATE_RCVD 0x0100 #define MINSLP_RCVD 0x0200 #define PEER_MAKE_RCVD 0x0400 #define PEER_ID_NUM_RCVD 0x0800 #define HINT_RCVD 0x1000 #define DEF_MIN_SLEEP_RCVD 0x2000 #define MSG_ENC_FMT_RCVD 0x4000 #define PEER_TYPE_RCVD 0x8000 #define TYPE_ONE_PARAMS (PEERID_RCVD|VERSION_RCVD|CRYPTOSUITES_RCVD|DIRS_RCVD|INFO_RCVD) #define TYPE_TWO_PARAMS (PEERID_RCVD|NONCE_RCVD|PKEY_RCVD) #define TYPE_THREE_PARAMS (PEERID_RCVD) #define TYPE_FOUR_PARAMS (PEERID_RCVD|MAC_RCVD|HINT_RCVD) #define TYPE_FIVE_PARAMS (PEERID_RCVD|CRYPTOSUITES_RCVD|INFO_RCVD) #define TYPE_SIX_PARAMS (PEERID_RCVD|NONCE_RCVD) #define TYPE_SEVEN_PARAMS (PEERID_RCVD|MAC_RCVD) #define TYPE_HINT_PARAMS (PEERID_RCVD) #define CONF_PARAMS (DIRS_RCVD|CRYPTOSUITES_RCVD|VERSION_RCVD|PEER_TYPE_RCVD|PEER_ID_NUM_RCVD|PEER_TYPE_RCVD) #define CREATE_TABLES_EPHEMERALSTATE \ "CREATE TABLE IF NOT EXISTS EphemeralState( \ Ssid TEXT PRIMARY KEY, \ PeerId TEXT, \ Vers TEXT NOT NULL, \ Cryptosuites TEXT NOT NULL, \ Realm TEXT, \ Dirs INTEGER, \ ServerInfo TEXT, \ Ns BLOB, \ Np BLOB, \ Z BLOB, \ MacInput TEXT, \ creation_time BIGINT, \ ErrorCode INT, \ PeerState INTEGER); \ \ CREATE TABLE IF NOT EXISTS EphemeralNoob( \ Ssid TEXT NOT NULL REFERENCES EphemeralState(Ssid), \ PeerId TEXT NOT NULL, \ NoobId TEXT NOT NULL, \ Noob TEXT NOT NULL, \ Hoob TEXT NOT NULL, \ sent_time BIGINT NOT NULL, \ UNIQUE(Peerid,NoobId));" #define CREATE_TABLES_PERSISTENTSTATE \ "CREATE TABLE IF NOT EXISTS PersistentState( \ Ssid TEXT NOT NULL, \ PeerId TEXT NOT NULL, \ Vers TEXT NOT NULL, \ Cryptosuites TEXT NOT NULL, \ Realm TEXT, \ Kz BLOB NOT NULL, \ PeerState INT, \ creation_time BIGINT, \ last_used_time BIGINT)" /* #define DELETE_EPHEMERAL_FOR_SSID \ "DELETE FROM EphemeralNoob WHERE Ssid=?; \ DELETE FROM EphemeralState WHERE Ssid=?;" */ #define DELETE_EPHEMERAL_FOR_ALL \ "DELETE FROM EphemeralNoob; \ DELETE FROM EphemeralState;" #define QUERY_EPHEMERALSTATE \ "SELECT * FROM EphemeralState WHERE Ssid=?;" #define QUERY_EPHEMERALNOOB \ "SELECT * FROM EphemeralNoob WHERE Ssid=?;" #define QUERY_PERSISTENTSTATE \ "SELECT * FROM PersistentState WHERE Ssid=?;" #define EAP_NOOB_FREE(_D) \ if (_D) { \ os_free(_D); \ (_D) = NULL; \ } enum {UNREGISTERED_STATE, WAITING_FOR_OOB_STATE, OOB_RECEIVED_STATE, RECONNECTING_STATE, REGISTERED_STATE}; /* Flag used during KDF and MAC generation */ enum {COMPLETION_EXCHANGE, RECONNECT_EXCHANGE, RECONNECT_EXCHANGE_NEW}; enum {NONE, EAP_NOOB_TYPE_1, EAP_NOOB_TYPE_2, EAP_NOOB_TYPE_3, EAP_NOOB_TYPE_4, EAP_NOOB_TYPE_5, EAP_NOOB_TYPE_6, EAP_NOOB_TYPE_7, EAP_NOOB_HINT}; enum eap_noob_err_code {NO_ERROR, E1001, E1002, E1003, E1004, E1005, E1006, E1007, E2001, E2002, E3001, E3002, E3003, E4001, E5001, E5002, E5003}; enum {MACS_TYPE, MACP_TYPE}; enum {UPDATE_PERSISTENT_STATE, UPDATE_STATE_ERROR, DELETE_SSID}; enum sql_datatypes {TEXT, INT, UNSIGNED_BIG_INT, BLOB}; /* server state vs message type matrix */ const int state_message_check[NUM_OF_STATES][MAX_MSG_TYPES] = { {VALID, VALID, VALID, INVALID, INVALID, INVALID, INVALID, INVALID}, //UNREGISTERED_STATE {VALID, VALID, VALID, VALID, VALID, INVALID, INVALID, INVALID}, //WAITING_FOR_OOB_STATE {VALID, VALID, VALID, INVALID, VALID, INVALID, INVALID, INVALID}, //OOB_RECEIVED_STATE {VALID, INVALID, INVALID, INVALID, INVALID, VALID, VALID, VALID}, //RECONNECT {VALID, INVALID, INVALID, INVALID, VALID, INVALID, INVALID, INVALID}, //REGISTERED_STATE }; struct eap_noob_globle_conf { u32 default_minsleep; u32 oob_enc_fmt; char * peer_type; u32 read_conf; }; struct eap_noob_ecdh_kdf_out { u8 * msk; u8 * emsk; u8 * amsk; u8 * MethodId; u8 * Kms; u8 * Kmp; u8 * Kz; }; struct eap_noob_ecdh_kdf_nonce { u8 * Ns; u8 * Np; }; struct eap_noob_oob_data { char * Noob_b64; char * Hoob_b64; char * NoobId_b64; }; struct eap_noob_ecdh_key_exchange { EVP_PKEY * dh_key; char * x_serv_b64; char * y_serv_b64; char * x_b64; size_t x_len; char * y_b64; size_t y_len; json_t * jwk_serv; json_t * jwk_peer; u8 * shared_key; char * shared_key_b64; size_t shared_key_b64_len; }; struct eap_noob_server_data { u32 version[MAX_SUP_VER]; u32 state; u32 cryptosuite[MAX_SUP_CSUITES]; u32 dir; u32 minsleep; u32 rcvd_params; char * server_info; char * MAC; char * ssid; char * PeerId; char * Realm; json_t * mac_input; char * mac_input_str; enum eap_noob_err_code err_code; Boolean record_present; struct eap_noob_ecdh_key_exchange * ecdh_exchange_data; struct eap_noob_oob_data * oob_data; struct eap_noob_ecdh_kdf_nonce * kdf_nonce_data; struct eap_noob_ecdh_kdf_out * kdf_out; }; struct eap_noob_peer_config_params { char * Peer_name; char * Peer_ID_Num; }; struct eap_noob_peer_data { u32 version; u32 state; u32 cryptosuite; u32 dir; u32 minsleep; u32 config_params; char * PeerId; json_t * PeerInfo; char * MAC; char * Realm; u8 * Kz; struct eap_noob_peer_config_params * peer_config_params; }; struct eap_noob_peer_context { struct eap_noob_peer_data * peer_attr; struct eap_noob_server_data * server_attr; char * db_name; char * db_table_name; sqlite3 * peer_db; int wired; }; const int error_code[] = {0,1001,1002,1003,1004,1005,1006,1007,2001,2002,3001,3002,3003,4001,5001,5002,5003}; const char *error_info[] = { "No error", "Invalid NAI or peer state", "Invalid message structure", "Invalid data", "Unexpected message type", "Unexpected peer identifier", "Unrecognized OOB message identifier", "Invalid ECDH key", "Unwanted peer", "State mismatch, user action required", "No mutually supported protocol version", "No mutually supported cryptosuite", "No mutually supported OOB direction", "MAC verification failure", "Application-specific error", "Invalid server info", "Invalid server URL"}; #endif <|start_filename|>protocolmodel/proverif/Makefile<|end_filename|> # Libraries LIB=lib # Queries QRY=queries # OOB direction 1 (peer-to-server) default: proverif -lib $(LIB)/eap-noob.pvl $(QRY)/eap-noob.pv <|start_filename|>hostapd-2.6/src/eap_server/eap_server_noob.c<|end_filename|> /* * EAP server method: EAP-NOOB * Copyright (c) 2016, Aalto University * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Aalto University nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AALTO UNIVERSITY BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * See CONTRIBUTORS for more information. */ #include <openssl/rand.h> #include <openssl/obj_mac.h> #include <openssl/evp.h> #include <openssl/ec.h> #include <openssl/buffer.h> #include <openssl/bio.h> #include <openssl/err.h> #include <openssl/hmac.h> #include <openssl/x509.h> #include <openssl/pem.h> #include "includes.h" #include "common.h" #include "eap_i.h" #include "eap_server_noob.h" static struct eap_noob_global_conf server_conf; void * os_memdup(const void *src, size_t len) { void *r = os_malloc(len); if (!r) return NULL; os_memcpy(r, src, len); return r; } static inline void eap_noob_set_done(struct eap_noob_server_context * data, int val) { data->peer_attr->is_done = val; } static inline void eap_noob_set_success(struct eap_noob_server_context * data, int val) { data->peer_attr->is_success = val; } static inline void eap_noob_set_error(struct eap_noob_peer_data * peer_attr, int val) { peer_attr->next_req = NONE; peer_attr->err_code = val; } static inline void eap_noob_change_state(struct eap_noob_server_context * data, int val) { data->peer_attr->server_state = val; } /** * eap_noob_verify_peerId : Compares recived PeerId with the assigned one * @data : server context * @return : SUCCESS or FAILURE **/ static int eap_noob_verify_peerId(struct eap_noob_server_context * data) { if (NULL == data || NULL == data->peer_attr) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Server context null in %s", __func__); return FAILURE; } wpa_printf(MSG_DEBUG, "EAP-NOOB: Entering %s", __func__); if (0 != strcmp(data->peer_attr->PeerId, data->peer_attr->peerid_rcvd)) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Verification of PeerId failed, setting error E1005"); eap_noob_set_error(data->peer_attr, E1005); return FAILURE; } return SUCCESS; } /** * eap_noob_Base64Decode : Decodes a base64url string. * @b64message : input base64url string * @buffer : output * Returns : Len of decoded string **/ static int eap_noob_Base64Decode(const char * b64message, unsigned char ** buffer) { BIO * bio = NULL, * b64 = NULL; int decodeLen = 0, len = 0; char * temp = NULL; int i; if (NULL == b64message || NULL == buffer) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Input to %s is null", __func__); return 0; } wpa_printf(MSG_DEBUG, "EAP-NOOB: Entering %s", __func__); len = os_strlen(b64message); /* Convert base64url to base64 encoding. */ int b64pad = 4*((len+3)/4)-len; temp = os_zalloc(len + b64pad); os_memcpy(temp, b64message, len); if (b64pad == 3) { wpa_printf(MSG_DEBUG, "EAP-NOOB Input to %s is incorrect", __func__); return 0; } for (i=0; i < len; i++) { if (temp[i] == '-') temp[i] = '+'; else if (temp[i] == '_') temp[i] = '/'; } for (i=0; i<b64pad; i++) temp[len+i] = '='; decodeLen = (len * 3)/4; *buffer = (unsigned char*)os_zalloc(decodeLen); bio = BIO_new_mem_buf(temp, len+b64pad); b64 = BIO_new(BIO_f_base64()); bio = BIO_push(b64, bio); BIO_set_flags(bio, BIO_FLAGS_BASE64_NO_NL); len = BIO_read(bio, *buffer, os_strlen(b64message)); /* Length should equal decodeLen, else something goes horribly wrong */ if (len != decodeLen) { decodeLen = 0; EAP_NOOB_FREE(*buffer); } os_free(temp); BIO_free_all(bio); return decodeLen; } /** * eap_noob_Base64Encode : Encode an ascii string to base64url. Dealloc b64text * as needed from the caller. * @buffer : input buffer * @length : input buffer length * @b64text : converted base64url text * Returns : SUCCESS/FAILURE **/ int eap_noob_Base64Encode(const unsigned char * buffer, size_t length, char ** b64text) { BIO * bio = NULL, * b64 = NULL; BUF_MEM * bufferPtr = NULL; int i = 0; if (NULL == buffer || NULL == b64text) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Input to %s is null", __func__); return 0; } wpa_printf(MSG_DEBUG, "EAP-NOOB: Entering function %s", __func__); b64 = BIO_new(BIO_f_base64()); bio = BIO_new(BIO_s_mem()); bio = BIO_push(b64, bio); BIO_set_flags(bio, BIO_FLAGS_BASE64_NO_NL); BIO_write(bio, buffer, length); BIO_flush(bio); BIO_get_mem_ptr(bio, &bufferPtr); BIO_set_close(bio, BIO_NOCLOSE); int outlen = bufferPtr->length; *b64text = (char *) os_zalloc(outlen + 1); os_memcpy(*b64text, bufferPtr->data, outlen); (*b64text)[outlen] = '\0'; /* Convert base64 to base64url encoding. */ while (outlen > 0 && (*b64text)[outlen - 1]=='=') { (*b64text)[outlen - 1] = '\0'; outlen--; } for (i = 0; i < outlen; i++) { if ((*b64text)[i] == '+') (*b64text)[i] = '-'; else if ((*b64text)[i] == '/') (*b64text)[i] = '_'; } BIO_free_all(bio); return SUCCESS; } /** * eap_noob_db_statements : execute one or more sql statements that do not return rows * @db : open sqlite3 database handle * @query : query to be executed * Returns : SUCCESS/FAILURE **/ static int eap_noob_db_statements(sqlite3 * db, const char * query) { int nByte = os_strlen(query); sqlite3_stmt * stmt; const char * tail = query; const char * sql_error; int ret = SUCCESS; if (NULL == db || NULL == query) return FAILURE; wpa_printf(MSG_DEBUG, "EAP-NOOB: Entering %s",__func__); /* Loop through multiple SQL statements in sqlite3 */ while (tail < query + nByte) { if (SQLITE_OK != sqlite3_prepare_v2(db, tail, -1, &stmt, &tail) || NULL == stmt) { ret = FAILURE; goto EXIT; } if (SQLITE_DONE != sqlite3_step(stmt)) { ret = FAILURE; goto EXIT; } } EXIT: if (ret == FAILURE) { sql_error = sqlite3_errmsg(db); if (sql_error != NULL) wpa_printf(MSG_DEBUG,"EAP-NOOB: SQL error : %s", sql_error); } /* if (stmt) */ sqlite3_finalize(stmt); wpa_printf(MSG_DEBUG, "EAP-NOOB: Exiting %s, ret %d",__func__, ret); return ret; } static void columns_persistentstate(struct eap_noob_server_context * data, sqlite3_stmt * stmt) { wpa_printf(MSG_DEBUG, "EAP-NOOB: In %s", __func__); data->peer_attr->version = sqlite3_column_int(stmt, 1); data->peer_attr->cryptosuite = sqlite3_column_int(stmt, 2); data->peer_attr->Realm = os_strdup((char *) sqlite3_column_text(stmt, 3)); data->peer_attr->Kz = os_memdup(sqlite3_column_blob(stmt, 4), KZ_LEN); data->peer_attr->server_state = sqlite3_column_int(stmt, 5); data->peer_attr->creation_time = (uint64_t) sqlite3_column_int64(stmt, 6); data->peer_attr->last_used_time = (uint64_t) sqlite3_column_int64(stmt, 7); } static void columns_ephemeralstate(struct eap_noob_server_context * data, sqlite3_stmt * stmt) { data->peer_attr->version = sqlite3_column_int(stmt, 1); data->peer_attr->cryptosuite = sqlite3_column_int(stmt, 2); data->peer_attr->Realm = os_strdup((char *) sqlite3_column_text(stmt, 3)); data->peer_attr->dir = sqlite3_column_int(stmt, 4); data->peer_attr->peerinfo = os_strdup((char *) sqlite3_column_text(stmt, 5)); data->peer_attr->kdf_nonce_data->Ns = os_memdup(sqlite3_column_blob(stmt, 6), NONCE_LEN); data->peer_attr->kdf_nonce_data->Np = os_memdup(sqlite3_column_blob(stmt, 7), NONCE_LEN); data->peer_attr->ecdh_exchange_data->shared_key = os_memdup(sqlite3_column_blob(stmt, 8), ECDH_SHARED_SECRET_LEN); data->peer_attr->mac_input_str = os_strdup((char *) sqlite3_column_text(stmt, 9)); data->peer_attr->creation_time = (uint64_t) sqlite3_column_int64(stmt, 10); data->peer_attr->err_code = sqlite3_column_int(stmt, 11); data->peer_attr->sleep_count = sqlite3_column_int(stmt, 12); data->peer_attr->server_state = sqlite3_column_int(stmt, 13); } static void columns_ephemeralnoob(struct eap_noob_server_context * data, sqlite3_stmt * stmt) { data->peer_attr->oob_data->NoobId_b64 = os_strdup((char *)sqlite3_column_text(stmt, 1)); data->peer_attr->oob_data->Noob_b64 = os_strdup((char *)sqlite3_column_text(stmt, 2)); data->peer_attr->oob_data->sent_time = (uint64_t) sqlite3_column_int64(stmt, 3); } /** * eap_noob_exec_query : Function to execute a sql query. Prepapres, binds and steps. * Takes variable number of arguments (TYPE, VAL). For Blob, (TYPE, LEN, VAL) * @data : Server context * @query : query to be executed * @callback : pointer to callback function * @num_args : number of variable inputs to function * Returns : SUCCESS/FAILURE **/ static int eap_noob_exec_query(struct eap_noob_server_context * data, const char * query, void (*callback)(struct eap_noob_server_context *, sqlite3_stmt *), int num_args, ...) { sqlite3_stmt * stmt = NULL; va_list args; int ret, i, indx = 0, ival, bval_len; char * sval = NULL; u8 * bval = NULL; wpa_printf(MSG_DEBUG, "EAP-NOOB: Entering %s, query - (%s), Number of arguments (%d)", __func__, query, num_args); if (SQLITE_OK != (ret = sqlite3_prepare_v2(data->server_db, query, strlen(query)+1, &stmt, NULL))) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Error preparing statement, ret (%d)", ret); ret = FAILURE; goto EXIT; } va_start(args, num_args); for (i = 0; i < num_args; i+=2, ++indx) { enum sql_datatypes type = va_arg(args, enum sql_datatypes); switch(type) { case INT: ival = va_arg(args, int); if (SQLITE_OK != sqlite3_bind_int(stmt, (indx+1), ival)) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Error binding %d at index %d", ival, i+1); ret = FAILURE; goto EXIT; } break; case UNSIGNED_BIG_INT: /* TODO */ break; case TEXT: sval = va_arg(args, char *); if (SQLITE_OK != sqlite3_bind_text(stmt, (indx+1), sval, strlen(sval), NULL)) { wpa_printf(MSG_DEBUG, "EAP-NOOB:Error binding %s at index %d", sval, i+1); ret = FAILURE; goto EXIT; } break; case BLOB: bval_len = va_arg(args, int); bval = va_arg(args, u8 *); if (SQLITE_OK != sqlite3_bind_blob(stmt, (indx+1), (void *)bval, bval_len, NULL)) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Error binding %.*s at index %d", bval_len, bval, indx+1); ret = FAILURE; goto EXIT; } i++; break; default: wpa_printf(MSG_DEBUG, "EAP-NOOB: Wrong data type"); ret = FAILURE; goto EXIT; } } while(1) { ret = sqlite3_step(stmt); if (ret == SQLITE_DONE) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Done executing the query, ret (%d)\n", ret); ret = SUCCESS; break; } else if (ret != SQLITE_ROW) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Unexpected error in step, ret (%d)", ret); ret = FAILURE; goto EXIT; } if (NULL != callback) callback(data, stmt); } EXIT: wpa_printf(MSG_DEBUG, "EAP-NOOB: Exiting %s, ret %d", __func__, ret); if (ret == FAILURE) { char * sql_error = (char *)sqlite3_errmsg(data->server_db); if (sql_error != NULL) wpa_printf(MSG_DEBUG,"EAP-NOOB: SQL error : %s\n", sql_error); } va_end(args); sqlite3_finalize(stmt); return ret; } /** * eap_noob_db_functions : Execute various DB queries * @data : server context * @type : type of update * Returns : SUCCESS/FAILURE **/ static int eap_noob_db_functions(struct eap_noob_server_context * data, u8 type) { char query[MAX_LINE_SIZE] = {0}; char * dump_str; int ret = FAILURE; if (NULL == data) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Server context is NULL"); return FAILURE; } wpa_printf(MSG_DEBUG, "EAP-NOOB: Entering %s",__func__); switch(type) { case UPDATE_PERSISTENT_STATE: os_snprintf(query, MAX_LINE_SIZE, "UPDATE PersistentState SET ServerState=? where PeerId=?"); ret = eap_noob_exec_query(data, query, NULL, 4, INT, data->peer_attr->server_state, TEXT, data->peer_attr->PeerId); break; case UPDATE_STATE_ERROR: os_snprintf(query, MAX_LINE_SIZE, "UPDATE EphemeralState SET ServerState=?, ErrorCode=? where PeerId=?"); ret = eap_noob_exec_query(data, query, NULL, 6, INT, data->peer_attr->server_state, INT, data->peer_attr->err_code, TEXT, data->peer_attr->PeerId); break; case UPDATE_STATE_MINSLP: os_snprintf(query, MAX_LINE_SIZE, "UPDATE EphemeralState SET ServerState=?, SleepCount =? where PeerId=?"); ret = eap_noob_exec_query(data, query, NULL, 6, INT, data->peer_attr->server_state, INT, data->peer_attr->sleep_count, TEXT, data->peer_attr->PeerId); break; case UPDATE_PERSISTENT_KEYS_SECRET: os_snprintf(query, MAX_LINE_SIZE, "DELETE FROM EphemeralState WHERE PeerId=?"); if (FAILURE == eap_noob_exec_query(data, query, NULL, 2, TEXT, data->peer_attr->PeerId)) wpa_printf(MSG_DEBUG, "EAP-NOOB: Unexpected error in deleting entry in EphemeralState"); os_snprintf(query, MAX_LINE_SIZE, "DELETE FROM EphemeralNoob WHERE PeerId=?"); if (FAILURE == eap_noob_exec_query(data, query, NULL, 2, TEXT, data->peer_attr->PeerId)) wpa_printf(MSG_DEBUG, "EAP-NOOB: Unexpected error in deleting entry in EphemeralNoob"); os_snprintf(query, MAX_LINE_SIZE, "INSERT INTO PersistentState (PeerId, Verp, Cryptosuitep, Realm, Kz, " "ServerState, PeerInfo) VALUES(?, ?, ?, ?, ?, ?, ?)"); ret = eap_noob_exec_query(data, query, NULL, 14, TEXT, data->peer_attr->PeerId, INT, data->peer_attr->version, INT, data->peer_attr->cryptosuite, TEXT, server_conf.realm, BLOB, KZ_LEN, data->peer_attr->kdf_out->Kz, INT, data->peer_attr->server_state, TEXT, data->peer_attr->peerinfo); break; case UPDATE_INITIALEXCHANGE_INFO: dump_str = json_dumps(data->peer_attr->mac_input, JSON_COMPACT|JSON_PRESERVE_ORDER); os_snprintf(query, MAX_LINE_SIZE, "INSERT INTO EphemeralState ( PeerId, Verp, Cryptosuitep, Realm, Dirp, PeerInfo, " "Ns, Np, Z, MacInput, SleepCount, ServerState) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"); ret = eap_noob_exec_query(data, query, NULL, 27, TEXT, data->peer_attr->PeerId, INT, data->peer_attr->version, INT, data->peer_attr->cryptosuite, TEXT, server_conf.realm, INT, data->peer_attr->dir, TEXT, data->peer_attr->peerinfo, BLOB, NONCE_LEN, data->peer_attr->kdf_nonce_data->Ns, BLOB, NONCE_LEN, data->peer_attr->kdf_nonce_data->Np, BLOB, ECDH_SHARED_SECRET_LEN, data->peer_attr->ecdh_exchange_data->shared_key, TEXT, dump_str, INT, data->peer_attr->sleep_count, INT, data->peer_attr->server_state); os_free(dump_str); break; case GET_NOOBID: os_snprintf(query, MAX_LINE_SIZE, "SELECT * FROM EphemeralNoob WHERE PeerId=? AND NoobId=?;"); ret = eap_noob_exec_query(data, query, columns_ephemeralnoob, 4, TEXT, data->peer_attr->PeerId, TEXT, data->peer_attr->oob_data->NoobId_b64); break; default: wpa_printf(MSG_ERROR, "EAP-NOOB: Wrong DB update type"); return FAILURE; } if (FAILURE == ret) { wpa_printf(MSG_ERROR, "EAP-NOOB: DB value update failed"); return FAILURE; } wpa_printf(MSG_DEBUG, "EAP-NOOB: Exiting %s, ret = SUCCESS", __func__); return SUCCESS; } /** * eap_noob_get_next_req : * @data : * Returns : NONE or next req type **/ static int eap_noob_get_next_req(struct eap_noob_server_context * data) { int retval = NONE; if (NULL == data) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Server context is NULL"); return retval; } if (EAP_NOOB_STATE_VALID) { retval = next_request_type[(data->peer_attr->server_state * NUM_OF_STATES) \ + data->peer_attr->peer_state]; } wpa_printf (MSG_DEBUG,"EAP-NOOB:Serv state = %d, Peer state = %d, Next req =%d", data->peer_attr->server_state, data->peer_attr->peer_state, retval); if (retval == EAP_NOOB_TYPE_5) { data->peer_attr->server_state = RECONNECTING_STATE; if (FAILURE == eap_noob_db_functions(data, UPDATE_PERSISTENT_STATE)) wpa_printf(MSG_DEBUG, "EAP-NOOB: Error updating state to Reconnecting"); } if ((data->peer_attr->dir == SERVER_TO_PEER) && (retval == EAP_NOOB_TYPE_4)) { retval = EAP_NOOB_TYPE_8; wpa_printf(MSG_DEBUG,"EAP-NOOB: NoobId Required: True"); } if (retval == EAP_NOOB_TYPE_3) { //checking for max WE count if type is 3 if (server_conf.max_we_count <= data->peer_attr->sleep_count) { eap_noob_set_error(data->peer_attr, E2001); return NONE; } else { data->peer_attr->sleep_count++; if (FAILURE == eap_noob_db_functions(data, UPDATE_STATE_MINSLP)) { wpa_printf(MSG_DEBUG,"EAP-NOOB: Min Sleep DB update Error"); eap_noob_set_error(data->peer_attr,E2001); return NONE; } } } return retval; } /** * eap_noob_parse_NAI: Parse NAI * @data : server context * @NAI : Network Access Identifier * Returns : FAILURE/SUCCESS **/ static int eap_noob_parse_NAI(struct eap_noob_server_context * data, const char * NAI) { char * user_name_peer = NULL, * realm = NULL, * _NAI = NULL; if (NULL == NAI || NULL == data) { eap_noob_set_error(data->peer_attr, E1001); return FAILURE; } wpa_printf(MSG_DEBUG, "EAP-NOOB: Entering %s, parsing NAI (%s)",__func__, NAI); _NAI = (char *)NAI; if (os_strstr(_NAI, RESERVED_DOMAIN) || os_strstr(_NAI, server_conf.realm)) { user_name_peer = strsep(&_NAI, "@"); realm = strsep(&_NAI, "@"); if (strlen(user_name_peer) > (MAX_PEERID_LEN + 3)) { /* plus 3 for '+','s' and state number */ eap_noob_set_error(data->peer_attr,E1001); return FAILURE; } /* Peer State */ if (os_strstr(user_name_peer, "+") && (0 == strcmp(realm, server_conf.realm))) { data->peer_attr->peerid_rcvd = os_strdup(strsep(&user_name_peer, "+")); if (*user_name_peer != 's') { eap_noob_set_error(data->peer_attr, E1001); return FAILURE; } data->peer_attr->peer_state = (int) strtol(user_name_peer+1, NULL, 10); return SUCCESS; } else if (0 == strcmp("noob", user_name_peer) && 0 == strcmp(realm, RESERVED_DOMAIN)) { data->peer_attr->peer_state = UNREGISTERED_STATE; return SUCCESS; } } wpa_printf(MSG_DEBUG, "EAP-NOOB: Exiting %s, setting error E1001",__func__); eap_noob_set_error(data->peer_attr, E1001); return FAILURE; } static int eap_noob_query_ephemeralstate(struct eap_noob_server_context * data) { if (FAILURE == eap_noob_exec_query(data, QUERY_EPHEMERALSTATE, columns_ephemeralstate, 2, TEXT, data->peer_attr->peerid_rcvd)) { wpa_printf(MSG_DEBUG, "Peer not found in ephemeral table"); if (FAILURE == eap_noob_exec_query(data, QUERY_PERSISTENTSTATE, columns_persistentstate, 2, TEXT, data->peer_attr->peerid_rcvd)) { eap_noob_set_error(data->peer_attr, E1005); /* Unexpected peerId */ return FAILURE; } else { eap_noob_set_error(data->peer_attr, E1001); /* Invalid NAI or peer state */ return FAILURE; } } if (data->peer_attr->server_state == OOB_RECEIVED_STATE) { if (FAILURE == eap_noob_exec_query(data, QUERY_EPHEMERALNOOB, columns_ephemeralnoob, 2, TEXT, data->peer_attr->peerid_rcvd)) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Error in retreiving NoobId"); return FAILURE; } wpa_printf(MSG_DEBUG, "EAP-NOOB: PeerId %s", data->peer_attr->peerid_rcvd); } return SUCCESS; } static int eap_noob_query_persistentstate(struct eap_noob_server_context * data) { if (FAILURE == eap_noob_exec_query(data, QUERY_PERSISTENTSTATE, columns_persistentstate, 2, TEXT, data->peer_attr->peerid_rcvd)) { if (FAILURE == eap_noob_exec_query(data, QUERY_EPHEMERALSTATE, columns_ephemeralstate, 2, TEXT, data->peer_attr->peerid_rcvd)) { eap_noob_set_error(data->peer_attr, E1005); return FAILURE; } else { eap_noob_set_error(data->peer_attr, E1001); return FAILURE; } } return SUCCESS; } /** * eap_noob_create_db : Creates a new DB or opens the existing DB and * populates the context * @data : server context * returns : SUCCESS/FAILURE **/ static int eap_noob_create_db(struct eap_noob_server_context * data) { if (NULL == data) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Input to %s is null", __func__); return FAILURE; } wpa_printf(MSG_DEBUG, "EAP-NOOB: Entering %s", __func__); if (SQLITE_OK != sqlite3_open_v2(data->db_name, &data->server_db, SQLITE_OPEN_READWRITE| SQLITE_OPEN_CREATE, NULL)) { wpa_printf(MSG_ERROR, "EAP-NOOB: Failed to open and Create Table"); return FAILURE; } if (FAILURE == eap_noob_db_statements(data->server_db, CREATE_TABLES_EPHEMERALSTATE) || FAILURE == eap_noob_db_statements(data->server_db, CREATE_TABLES_PERSISTENTSTATE) || FAILURE == eap_noob_db_statements(data->server_db, CREATE_TABLES_RADIUS)) { wpa_printf(MSG_ERROR, "EAP-NOOB: Unexpected error in table creation"); return FAILURE; } /* Based on peer_state, decide which table to query */ if (data->peer_attr->peerid_rcvd) { data->peer_attr->PeerId = os_strdup(data->peer_attr->peerid_rcvd); if (data->peer_attr->peer_state <= OOB_RECEIVED_STATE) return eap_noob_query_ephemeralstate(data); else return eap_noob_query_persistentstate(data); } wpa_printf(MSG_DEBUG, "EAP-NOOB: Exiting %s",__func__); return SUCCESS; } /** * eap_noob_assign_config: * @conf_name : * @conf_value : * @data : server context **/ static void eap_noob_assign_config(char * conf_name, char * conf_value, struct eap_noob_server_data * data) { if (NULL == conf_name || NULL == conf_value || NULL == data) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Input to %s is null", __func__); return; } /*TODO : version and csuite are directly converted to integer. * This needs to be changed if more than one csuite or version is supported. */ wpa_printf(MSG_DEBUG, "EAP-NOOB: CONF Name = %s %d", conf_name, (int)strlen(conf_name)); if (0 == strcmp("Version", conf_name)) { data->version[0] = (int) strtol(conf_value, NULL, 10); data->config_params |= VERSION_RCVD; wpa_printf(MSG_DEBUG, "EAP-NOOB: FILE READ= %d", data->version[0]); } else if (0 == strcmp("Csuite",conf_name)) { data->cryptosuite[0] = (int) strtol(conf_value, NULL, 10); data->config_params |= CRYPTOSUITEP_RCVD; wpa_printf(MSG_DEBUG, "EAP-NOOB: FILE READ= %d", data->cryptosuite[0]); } else if (0 == strcmp("OobDirs",conf_name)) { data->dir = (int) strtol(conf_value, NULL, 10); data->config_params |= DIRP_RCVD; wpa_printf(MSG_DEBUG, "EAP-NOOB: FILE READ= %d", data->dir); } else if (0 == strcmp("ServerName", conf_name)) { data->server_config_params->ServerName = os_strdup(conf_value); data->config_params |= SERVER_NAME_RCVD; wpa_printf(MSG_DEBUG, "EAP-NOOB: FILE READ= %s\n", data->server_config_params->ServerName); } else if (0 == strcmp("ServerUrl", conf_name)) { data->server_config_params->ServerURL = os_strdup(conf_value); data->config_params |= SERVER_URL_RCVD; wpa_printf(MSG_DEBUG, "EAP-NOOB: FILE READ= %s", data->server_config_params->ServerURL); } else if (0 == strcmp("Max_WE", conf_name)) { server_conf.max_we_count = (int) strtol(conf_value, NULL, 10); data->config_params |= WE_COUNT_RCVD; wpa_printf(MSG_DEBUG, "EAP-NOOB: FILE READ= %d", server_conf.max_we_count); /* assign some default value if user has given wrong value */ if (server_conf.max_we_count == 0) server_conf.max_we_count = MAX_WAIT_EXCHNG_TRIES; } else if (0 == strcmp("Realm", conf_name)) { EAP_NOOB_FREE(server_conf.realm); server_conf.len_realm = strlen(conf_value); server_conf.realm = (char *) os_strdup(conf_value); data->config_params |= REALM_RCVD; wpa_printf(MSG_DEBUG, "EAP-NOOB: FILE READ= %s", server_conf.realm); } else if (0 == strcmp("OobMessageEncoding", conf_name)) { server_conf.oob_encode = (int) strtol(conf_value, NULL, 10); data->config_params |= ENCODE_RCVD; wpa_printf(MSG_DEBUG, "EAP-NOOB: FILE READ= %d", server_conf.oob_encode); } } /** * eap_noob_parse_config : parse each line from the config file * @buff : read line * @data : * data : server_context **/ static void eap_noob_parse_config(char * buff, struct eap_noob_server_data * data) { char * pos = NULL, * conf_name = NULL, * conf_value = NULL, * token = NULL; if (NULL == buff || NULL == data) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Input to %s is null", __func__); return; } pos = buff; server_conf.read_conf = 1; for (; *pos == ' ' || *pos == '\t' ; pos++); if (*pos == '#') return; if (os_strstr(pos, "=")) { conf_name = strsep(&pos, "="); /* handle if there are any space after the conf item name*/ token = conf_name; for (; (*token != ' ' && *token != 0 && *token != '\t'); token++); *token = '\0'; token = strsep(&pos,"="); /* handle if there are any space before the conf item value*/ for (; (*token == ' ' || *token == '\t' ); token++); /* handle if there are any comments after the conf item value*/ conf_value = token; for (; (*token != '\n' && *token != '\t'); token++); *token = '\0'; eap_noob_assign_config(conf_name,conf_value, data); } } /** * eap_noob_handle_incomplete_conf : assigns defult value if the configuration is incomplete * @data : server config * Returs : FAILURE/SUCCESS **/ static int eap_noob_handle_incomplete_conf(struct eap_noob_server_context * data) { if (NULL == data || NULL == data->server_attr) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Input arguments NULL for function %s",__func__); return FAILURE; } if (0 == (data->server_attr->config_params & SERVER_URL_RCVD) || 0 == (data->server_attr->config_params & SERVER_NAME_RCVD)) { wpa_printf(MSG_ERROR, "EAP-NOOB: ServerName or ServerURL missing"); return FAILURE; } if (0 == (data->server_attr->config_params & ENCODE_RCVD)) { wpa_printf(MSG_ERROR, "EAP-NOOB: Encoding Scheme not specified"); return FAILURE; } /* set default values if not provided via config */ if (0 == (data->server_attr->config_params & VERSION_RCVD)) data->server_attr->version[0] = VERSION_ONE; if (0 == (data->server_attr->config_params & CRYPTOSUITEP_RCVD)) data->server_attr->cryptosuite[0] = SUITE_ONE; if (0 == (data->server_attr->config_params & DIRP_RCVD)) data->server_attr->dir = BOTH_DIRECTIONS; if (0 == (data->server_attr->config_params & WE_COUNT_RCVD)) server_conf.max_we_count = MAX_WAIT_EXCHNG_TRIES; if (0 == (data->server_attr->config_params & REALM_RCVD)) server_conf.realm = os_strdup(RESERVED_DOMAIN); return SUCCESS; } /** * eap_noob_serverinfo: * @data : server config * Returs : json object. Has to be freed using json_decref at the caller. **/ static json_t * eap_noob_serverinfo(struct eap_noob_server_config_params * data) { json_t * info_obj = NULL, * urljson = NULL, * namejson = NULL; char * serverinfo = NULL; int err = 0; if (NULL == data) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Input arguments NULL for function %s",__func__); return NULL; } err -= (NULL == (info_obj = json_object())); err -= (NULL == (namejson = json_string(data->ServerName))); err -= (NULL == (urljson = json_string(data->ServerURL))); err += json_object_set_new(info_obj, SERVERINFO_NAME, namejson); err += json_object_set_new(info_obj, SERVERINFO_URL, urljson); err -= (NULL == (serverinfo = json_dumps(info_obj, JSON_COMPACT|JSON_PRESERVE_ORDER))); if (strlen(serverinfo) > MAX_INFO_LEN) { wpa_printf(MSG_ERROR, "EAP-NOOB: ServerInfo too long."); err--; } if (err < 0) { wpa_printf(MSG_ERROR, "EAP-NOOB: Creation of ServerInfo failed."); json_decref(namejson); json_decref(urljson); json_decref(info_obj); return NULL; } return info_obj; } /** * eap_noob_read_config : read configuraions from config file * @data : server context * Returns : SUCCESS/FAILURE **/ static int eap_noob_read_config(struct eap_noob_server_context * data) { FILE * conf_file = NULL; char * buff = NULL; int ret = SUCCESS; json_t * serverinfo = NULL; if (NULL == data || NULL == data->server_attr) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Input arguments NULL for function %s",__func__); ret = FAILURE; goto ERROR_EXIT; } wpa_printf(MSG_DEBUG, "EAP-NOOB: Entering function %s", __func__); if (NULL == (conf_file = fopen(CONF_FILE, "r"))) { wpa_printf(MSG_ERROR, "EAP-NOOB: Configuration file not found"); ret = FAILURE; goto ERROR_EXIT; } if (NULL == (buff = os_malloc(MAX_CONF_LEN))) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Error in allocating memory."); ret = FAILURE; goto ERROR_EXIT; } if (NULL == (data->server_attr->server_config_params = os_malloc(sizeof(struct eap_noob_server_config_params)))) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Error in allocating memory."); ret = FAILURE; goto ERROR_EXIT; } data->server_attr->config_params = 0; while(!feof(conf_file)) { if (fgets(buff, MAX_CONF_LEN, conf_file)) { eap_noob_parse_config(buff, data->server_attr); memset(buff, 0, MAX_CONF_LEN); } } if ((data->server_attr->version[0] > MAX_SUP_VER) || (data->server_attr->cryptosuite[0] > MAX_SUP_CSUITES) || (data->server_attr->dir > BOTH_DIRECTIONS)) { wpa_printf(MSG_ERROR, "EAP-NOOB: Incorrect confing value"); ret = FAILURE; goto ERROR_EXIT; } if (data->server_attr->config_params != CONF_PARAMS && FAILURE == eap_noob_handle_incomplete_conf(data)) { ret = FAILURE; goto ERROR_EXIT; } serverinfo = eap_noob_serverinfo(data->server_attr->server_config_params); if(serverinfo == NULL){ ret = FAILURE; goto ERROR_EXIT; } data->server_attr->serverinfo = json_dumps(serverinfo, JSON_COMPACT|JSON_PRESERVE_ORDER); json_decref(serverinfo); ERROR_EXIT: if (ret != SUCCESS) EAP_NOOB_FREE(data->server_attr->server_config_params); EAP_NOOB_FREE(buff); fclose(conf_file); return ret; } /** * eap_noob_get_id_peer - generate PEER ID * @str: pointer to PEER ID * @size: PEER ID Length **/ int eap_noob_get_id_peer(char * str, size_t size) { const u8 charset[] = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; time_t t = 0; wpa_printf(MSG_DEBUG, "EAP-NOOB: Generating PeerId"); srand((unsigned)time(&t)); int charset_size = (int)(sizeof(charset) - 1); /* To-Do: Check whether the generated Peer ID is already in db */ if (size) { size_t n; for (n = 0; n < size; n++) { int key = rand() % charset_size; str[n] = charset[key]; } str[n] = '\0'; } if (str != NULL) return 0; return 1; } /** * eap_noob_ECDH_KDF_X9_63: generates KDF * @out: * @outlen: * @Z: * @Zlen: * @alorithm_id: * @alorithm_id_len: * @partyUinfo: * @partyUinfo_len: * @partyVinfo: * @partyVinfo_len * @suppPrivinfo: * @suppPrivinfo_len: * @EVP_MD: * @Returns: **/ int eap_noob_ECDH_KDF_X9_63(unsigned char *out, size_t outlen, const unsigned char * Z, size_t Zlen, const unsigned char * algorithm_id, size_t algorithm_id_len, const unsigned char * partyUinfo, size_t partyUinfo_len, const unsigned char * partyVinfo, size_t partyVinfo_len, const unsigned char * suppPrivinfo, size_t suppPrivinfo_len, const EVP_MD *md) { EVP_MD_CTX * mctx = NULL; unsigned char ctr[4] = {0}; unsigned int i = 0; size_t mdlen = 0; int rv = 0; wpa_printf(MSG_DEBUG, "EAP-NOOB: KDF start"); wpa_hexdump_ascii(MSG_DEBUG, "EAP-NOOB: Value:", Z, Zlen); if (algorithm_id_len > ECDH_KDF_MAX || outlen > ECDH_KDF_MAX || Zlen > ECDH_KDF_MAX || partyUinfo_len > ECDH_KDF_MAX || partyVinfo_len > ECDH_KDF_MAX || suppPrivinfo_len > ECDH_KDF_MAX) return 0; mctx = EVP_MD_CTX_create(); if (mctx == NULL) return 0; mdlen = EVP_MD_size(md); wpa_printf(MSG_DEBUG,"EAP-NOOB: KDF begin %d", (int)mdlen); for (i = 1;; i++) { unsigned char mtmp[EVP_MAX_MD_SIZE]; EVP_DigestInit_ex(mctx, md, NULL); ctr[3] = i & 0xFF; ctr[2] = (i >> 8) & 0xFF; ctr[1] = (i >> 16) & 0xFF; ctr[0] = (i >> 24) & 0xFF; if (!EVP_DigestUpdate(mctx, ctr, sizeof(ctr))) goto err; if (!EVP_DigestUpdate(mctx, Z, Zlen)) goto err; if (!EVP_DigestUpdate(mctx, algorithm_id, algorithm_id_len)) goto err; if (!EVP_DigestUpdate(mctx, partyUinfo, partyUinfo_len)) goto err; if (!EVP_DigestUpdate(mctx, partyVinfo, partyVinfo_len)) goto err; if (suppPrivinfo != NULL) if (!EVP_DigestUpdate(mctx, suppPrivinfo, suppPrivinfo_len)) goto err; if (outlen >= mdlen) { if (!EVP_DigestFinal(mctx, out, NULL)) goto err; outlen -= mdlen; if (outlen == 0) break; out += mdlen; } else { if (!EVP_DigestFinal(mctx, mtmp, NULL)) goto err; memcpy(out, mtmp, outlen); OPENSSL_cleanse(mtmp, mdlen); break; } } rv = 1; err: wpa_printf(MSG_DEBUG,"EAP-NOOB:KDF finished %d",rv); EVP_MD_CTX_destroy(mctx); return rv; } /** * eap_noob_gen_KDF : generates and updates the KDF inside the peer context. * @data : peer context. * @state : EAP_NOOB state * Returns: **/ static int eap_noob_gen_KDF(struct eap_noob_server_context * data, int state) { const EVP_MD * md = EVP_sha256(); unsigned char * out = os_zalloc(KDF_LEN); int counter = 0, len = 0; u8 * Noob; //TODO: Check that these are not null before proceeding to kdf wpa_hexdump_ascii(MSG_DEBUG, "EAP-NOOB: ALGORITH ID:", ALGORITHM_ID, ALGORITHM_ID_LEN); wpa_hexdump_ascii(MSG_DEBUG, "EAP-NOOB: Peer_NONCE:", data->peer_attr->kdf_nonce_data->Np, NONCE_LEN); wpa_hexdump_ascii(MSG_DEBUG, "EAP-NOOB: Serv_NONCE:", data->peer_attr->kdf_nonce_data->Ns, NONCE_LEN); wpa_hexdump_ascii(MSG_DEBUG, "EAP-NOOB: Shared Key:", data->peer_attr->ecdh_exchange_data->shared_key, ECDH_SHARED_SECRET_LEN); if (state == COMPLETION_EXCHANGE) { len = eap_noob_Base64Decode(data->peer_attr->oob_data->Noob_b64, &Noob); if (len != NOOB_LEN) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Failed to decode Noob"); return FAILURE; } wpa_hexdump_ascii(MSG_DEBUG, "EAP-NOOB: NOOB:", Noob, NOOB_LEN); eap_noob_ECDH_KDF_X9_63(out, KDF_LEN, data->peer_attr->ecdh_exchange_data->shared_key, ECDH_SHARED_SECRET_LEN, (unsigned char *)ALGORITHM_ID, ALGORITHM_ID_LEN, data->peer_attr->kdf_nonce_data->Np, NONCE_LEN, data->peer_attr->kdf_nonce_data->Ns, NONCE_LEN, Noob, NOOB_LEN, md); } else { wpa_hexdump_ascii(MSG_DEBUG, "EAP-NOOB: Kz:", data->peer_attr->Kz, KZ_LEN); eap_noob_ECDH_KDF_X9_63(out, KDF_LEN, data->peer_attr->Kz, KZ_LEN, (unsigned char *)ALGORITHM_ID, ALGORITHM_ID_LEN, data->peer_attr->kdf_nonce_data->Np, NONCE_LEN, data->peer_attr->kdf_nonce_data->Ns, NONCE_LEN, NULL,0, md); } wpa_hexdump_ascii(MSG_DEBUG, "EAP-NOOB: KDF", out, KDF_LEN); if (out != NULL) { data->peer_attr->kdf_out->msk = os_zalloc(MSK_LEN); data->peer_attr->kdf_out->emsk = os_zalloc(EMSK_LEN); data->peer_attr->kdf_out->amsk = os_zalloc(AMSK_LEN); data->peer_attr->kdf_out->MethodId = os_zalloc(METHOD_ID_LEN); data->peer_attr->kdf_out->Kms = os_zalloc(KMS_LEN); data->peer_attr->kdf_out->Kmp = os_zalloc(KMP_LEN); data->peer_attr->kdf_out->Kz = os_zalloc(KZ_LEN); memcpy(data->peer_attr->kdf_out->msk, out, MSK_LEN); counter += MSK_LEN; memcpy(data->peer_attr->kdf_out->emsk, out + counter, EMSK_LEN); counter += EMSK_LEN; memcpy(data->peer_attr->kdf_out->amsk, out + counter, AMSK_LEN); counter += AMSK_LEN; memcpy(data->peer_attr->kdf_out->MethodId, out + counter, METHOD_ID_LEN); counter += METHOD_ID_LEN; memcpy(data->peer_attr->kdf_out->Kms, out + counter, KMS_LEN); counter += KMS_LEN; memcpy(data->peer_attr->kdf_out->Kmp, out + counter, KMP_LEN); counter += KMP_LEN; memcpy(data->peer_attr->kdf_out->Kz, out + counter, KZ_LEN); if(state == COMPLETION_EXCHANGE) { data->peer_attr->Kz = os_zalloc(KZ_LEN); memcpy(data->peer_attr->Kz, out + counter, KZ_LEN); } counter += KZ_LEN; os_free(out); } else { wpa_printf(MSG_DEBUG, "EAP-NOOB: Error in allocating memory, %s", __func__); return FAILURE; } return SUCCESS; } static void eap_noob_get_sid(struct eap_sm * sm, struct eap_noob_server_context * data) { char *query = NULL; if ((NULL == sm->rad_attr) || (NULL == sm->rad_attr->calledSID) || (NULL == sm->rad_attr->callingSID) || (NULL == sm->rad_attr->nasId)) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Input to %s is null", __func__); return; } if(NULL == (query = (char *)malloc(500))) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Error allocating memory in %s", __func__); return; } wpa_printf(MSG_DEBUG, "EAP-NOOB: Entering %s, Values Received: %s,%s", __func__, sm->rad_attr->calledSID, sm->rad_attr->callingSID); os_snprintf(query, 500, "INSERT INTO radius (user_name, called_st_id, calling_st_id, NAS_id) VALUES (?, ?, ?, ?)"); if (FAILURE == eap_noob_exec_query(data, query, NULL, 8, TEXT, data->peer_attr->PeerId, TEXT, sm->rad_attr->calledSID, TEXT, sm->rad_attr->callingSID, TEXT, sm->rad_attr->nasId)) { wpa_printf(MSG_ERROR, "EAP-NOOB: DB value insertion failed"); } EAP_NOOB_FREE(sm->rad_attr->callingSID); EAP_NOOB_FREE(sm->rad_attr->calledSID); EAP_NOOB_FREE(sm->rad_attr->nasId); EAP_NOOB_FREE(sm->rad_attr); EAP_NOOB_FREE(query); } static int eap_noob_derive_session_secret(struct eap_noob_server_context * data, size_t * secret_len) { EVP_PKEY_CTX * ctx = NULL; EVP_PKEY * peerkey = NULL; unsigned char * peer_pub_key = NULL; size_t skeylen = 0, len = 0; int ret = SUCCESS; wpa_printf(MSG_DEBUG, "EAP-NOOB: Entering function %s", __func__); if (NULL == data || NULL == secret_len) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Server context is NULL"); return FAILURE; } EAP_NOOB_FREE(data->peer_attr->ecdh_exchange_data->shared_key); len = eap_noob_Base64Decode(data->peer_attr->ecdh_exchange_data->x_peer_b64, &peer_pub_key); if (len == 0) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Failed to decode public key of peer"); ret = FAILURE; goto EXIT; } peerkey = EVP_PKEY_new_raw_public_key(EVP_PKEY_X25519, NULL, peer_pub_key, len); if(peerkey == NULL) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Failed to initialize public key of peer"); ret = FAILURE; goto EXIT; } ctx = EVP_PKEY_CTX_new(data->peer_attr->ecdh_exchange_data->dh_key, NULL); if (!ctx) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Failed to create context"); ret = FAILURE; goto EXIT; } if (EVP_PKEY_derive_init(ctx) <= 0) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Failed to init key derivation"); ret = FAILURE; goto EXIT; } if (EVP_PKEY_derive_set_peer(ctx, peerkey) <= 0) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Failed to set peer key"); ret = FAILURE; goto EXIT; } if (EVP_PKEY_derive(ctx, NULL, &skeylen) <= 0) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Failed to get secret key len"); ret = FAILURE; goto EXIT; } data->peer_attr->ecdh_exchange_data->shared_key = OPENSSL_malloc(skeylen); if (!data->peer_attr->ecdh_exchange_data->shared_key) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Failed to allocate memory for secret"); ret = FAILURE; goto EXIT; } if (EVP_PKEY_derive(ctx, data->peer_attr->ecdh_exchange_data->shared_key, &skeylen) <= 0) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Failed to derive secret key"); ret = FAILURE; goto EXIT; } (*secret_len) = skeylen; wpa_hexdump_ascii(MSG_DEBUG,"EAP-NOOB: Secret Derived", data->peer_attr->ecdh_exchange_data->shared_key, *secret_len); EXIT: if (ctx) EVP_PKEY_CTX_free(ctx); EAP_NOOB_FREE(peer_pub_key); if (ret != SUCCESS) EAP_NOOB_FREE(data->peer_attr->ecdh_exchange_data->shared_key); return ret; } static int eap_noob_get_key(struct eap_noob_server_context * data) { EVP_PKEY_CTX * pctx = NULL; BIO * mem_pub = BIO_new(BIO_s_mem()); unsigned char * pub_key_char = NULL; size_t pub_key_len = 0; int ret = SUCCESS; /* Uncomment the next 6 lines of code for using the test vectors of Curve25519 in RFC 7748. Peer = Bob Server = Alice */ char * priv_key_test_vector = "<KEY>"; BIO* b641 = BIO_new(BIO_f_base64()); BIO* mem1 = BIO_new(BIO_s_mem()); BIO_set_flags(b641,BIO_FLAGS_BASE64_NO_NL); BIO_puts(mem1,priv_key_test_vector); mem1 = BIO_push(b641,mem1); wpa_printf(MSG_DEBUG, "EAP-NOOB: entering %s", __func__); /* Initialize context to generate keys - Curve25519 */ if (NULL == (pctx = EVP_PKEY_CTX_new_id(NID_X25519, NULL))) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Fail to create context for parameter generation."); ret = FAILURE; goto EXIT; } EVP_PKEY_keygen_init(pctx); /* Generate X25519 key pair */ //EVP_PKEY_keygen(pctx, &data->peer_attr->ecdh_exchange_data->dh_key); /* If you are using the RFC 7748 test vector, you do not need to generate a key pair. Instead you use the private key from the RFC. For using the test vector, comment out the line above and uncomment the following line code */ d2i_PrivateKey_bio(mem1,&data->peer_attr->ecdh_exchange_data->dh_key); PEM_write_PrivateKey(stdout, data->peer_attr->ecdh_exchange_data->dh_key, NULL, NULL, 0, NULL, NULL); PEM_write_PUBKEY(stdout, data->peer_attr->ecdh_exchange_data->dh_key); /* Get public key */ if (1 != i2d_PUBKEY_bio(mem_pub, data->peer_attr->ecdh_exchange_data->dh_key)) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Fail to copy public key to bio."); ret = FAILURE; goto EXIT; } pub_key_char = os_zalloc(MAX_X25519_LEN); pub_key_len = BIO_read(mem_pub, pub_key_char, MAX_X25519_LEN); /* * This code removes the openssl internal ASN encoding and only keeps the 32 bytes of curve25519 * public key which is then encoded in the JWK format and sent to the other party. This code may * need to be updated when openssl changes its internal format for public-key encoded in PEM. */ unsigned char * pub_key_char_asn_removed = pub_key_char + (pub_key_len-32); pub_key_len = 32; EAP_NOOB_FREE(data->peer_attr->ecdh_exchange_data->x_b64); eap_noob_Base64Encode(pub_key_char_asn_removed, pub_key_len, &data->peer_attr->ecdh_exchange_data->x_b64); EXIT: if (pctx) EVP_PKEY_CTX_free(pctx); EAP_NOOB_FREE(pub_key_char); BIO_free_all(mem_pub); return ret; } static int eap_noob_get_sleeptime(struct eap_noob_server_context * data) { /* TODO: Include actual implementation for calculating the waiting time. * return \ * (int)((eap_noob_cal_pow(2,data->peer_attr->sleep_count))* (rand()%8) + 1) % 3600 ; */ return 60; } /** * eap_noob_err_msg : prepares error message * @data : server context * @id : response message id * Returns : pointer to message buffer or null **/ static struct wpabuf * eap_noob_err_msg(struct eap_noob_server_context * data, u8 id) { json_t * req_obj = NULL; struct wpabuf *req = NULL; char * req_json = NULL; size_t len = 0 ; int code = 0, err = 0; if (NULL == data || NULL == data->peer_attr || 0 == (code = data->peer_attr->err_code)) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Input to %s is null", __func__); return NULL; } wpa_printf(MSG_DEBUG, "EAP-NOOB: Build error request"); err -= (NULL == (req_obj = json_object())); if (data->peer_attr->PeerId && code != E1001) err += json_object_set_new(req_obj, PEERID, json_string(data->peer_attr->PeerId)); else err += json_object_set_new(req_obj, PEERID, json_string(data->peer_attr->peerid_rcvd)); err += json_object_set_new(req_obj, TYPE, json_integer(NONE)); err += json_object_set_new(req_obj, ERRORCODE, json_integer(error_code[code])); err += json_object_set_new(req_obj, ERRORINFO, json_string(error_info[code])); err -= (NULL == (req_json = json_dumps(req_obj,JSON_COMPACT|JSON_PRESERVE_ORDER))); if (err < 0) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Error forming error message!"); goto EXIT; } len = strlen(req_json)+1; wpa_printf(MSG_DEBUG, "EAP-NOOB: ERROR message = %s == %d", req_json, (int)len); req = eap_msg_alloc(EAP_VENDOR_IETF, EAP_TYPE_NOOB, len, EAP_CODE_REQUEST, id); if (req == NULL) { wpa_printf(MSG_ERROR, "EAP-NOOB: Failed to allocate memory for NOOB ERROR message"); goto EXIT; } if (code != E1001 && FAILURE == eap_noob_db_functions(data, UPDATE_STATE_ERROR)) wpa_printf(MSG_DEBUG,"Fail to Write Error to DB"); wpabuf_put_data(req, req_json, len); eap_noob_set_done(data, DONE); eap_noob_set_success(data, FAILURE); data->peer_attr->err_code = NO_ERROR; EXIT: json_decref(req_obj); EAP_NOOB_FREE(req_json); return req; } /** * eap_noob_gen_MAC : generate a HMAC for authentication. Do not free mac * from the calling function * @data : server context * type : MAC type * @key : key to generate MAC * @keylen: key length * @state : EAP_NOOB state * Returns : MAC on success or NULL on error. **/ static u8 * eap_noob_gen_MAC(struct eap_noob_server_context * data, int type, u8 * key, int keylen, int state) { u8 * mac = NULL; int err = 0; json_t * mac_array, * emptystr = json_string(""); json_error_t error; char * mac_str = os_zalloc(500); if(state == RECONNECT_EXCHANGE) { data->peer_attr->mac_input_str=json_dumps(data->peer_attr->mac_input, JSON_COMPACT|JSON_PRESERVE_ORDER); } if (NULL == data || NULL == data->peer_attr || NULL == data->peer_attr->mac_input_str || NULL == key) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Input to %s is null", __func__); return NULL; } err -= (NULL == (mac_array = json_loads(data->peer_attr->mac_input_str, JSON_COMPACT|JSON_PRESERVE_ORDER, &error))); if (type == MACS_TYPE) err += json_array_set_new(mac_array, 0, json_integer(2)); else err += json_array_set_new(mac_array, 0, json_integer(1)); if(state == RECONNECT_EXCHANGE) { err += json_array_append_new(mac_array, emptystr); } else { err += json_array_append_new(mac_array, json_string(data->peer_attr->oob_data->Noob_b64)); } err -= (NULL == (mac_str = json_dumps(mac_array, JSON_COMPACT|JSON_PRESERVE_ORDER))); if (err < 0) wpa_printf(MSG_DEBUG, "EAP-NOOB: Unexpected error in setting MAC"); wpa_printf(MSG_DEBUG, "EAP-NOOB: Entering %s, MAC len = %d, MAC = %s",__func__, (int)os_strlen(mac_str), mac_str); wpa_hexdump_ascii(MSG_DEBUG, "EAP-NOOB: KEY:", key, keylen); mac = HMAC(EVP_sha256(), key, keylen, (u8 *)mac_str, os_strlen(mac_str), NULL, NULL); wpa_hexdump_ascii(MSG_DEBUG, "EAP-NOOB: MAC", mac, 32); os_free(mac_str); return mac; } /** * eap_noob_req_type_seven : * @data : server context * @id : * Returns : **/ static struct wpabuf * eap_noob_req_type_seven(struct eap_noob_server_context * data, u8 id) { struct wpabuf * req = NULL; char * req_json = NULL, * mac_b64 = NULL; u8 * mac = NULL; json_t * req_obj = NULL; size_t len = 0; int err = 0; wpa_printf(MSG_DEBUG, "EAP-NOOB: Request 3/Fast Reconnect"); if (SUCCESS != eap_noob_gen_KDF(data, RECONNECT_EXCHANGE)) { wpa_printf(MSG_ERROR, "EAP-NOOB: Error in KDF during Request/NOOB-FR"); goto EXIT; } mac = eap_noob_gen_MAC(data, MACS_TYPE, data->peer_attr->kdf_out->Kms, KMS_LEN, RECONNECT_EXCHANGE); wpa_hexdump_ascii(MSG_DEBUG, "EAP-NOOB type 7 request",mac,MAC_LEN); err += (SUCCESS == eap_noob_Base64Encode(mac, MAC_LEN, &mac_b64)); err -= (NULL == (req_obj = json_object())); err += json_object_set_new(req_obj,TYPE, json_integer(EAP_NOOB_TYPE_7)); err += json_object_set_new(req_obj, PEERID, json_string(data->peer_attr->PeerId)); err += json_object_set_new(req_obj, MACS2, json_string(mac_b64)); err -= (NULL == (req_json = json_dumps(req_obj, JSON_COMPACT|JSON_PRESERVE_ORDER))); if (err < 0) { wpa_printf(MSG_ERROR, "EAP-NOOB: Error in JSON"); goto EXIT; } len = strlen(req_json)+1; err -= (NULL == (req = eap_msg_alloc(EAP_VENDOR_IETF, EAP_TYPE_NOOB, len, EAP_CODE_REQUEST, id))); if (err < 0) { wpa_printf(MSG_ERROR, "EAP-NOOB: Failed to allocate memory for Request/NOOB-FR"); goto EXIT; } wpa_printf(MSG_DEBUG, "EAP-NOOB: Request Sending = %s = %d", req_json, (int)strlen(req_json)); wpabuf_put_data(req, req_json, len); EXIT: json_decref(req_obj); EAP_NOOB_FREE(req_json); EAP_NOOB_FREE(mac_b64); return req; } /** * eap_oob_req_type_six - Build the EAP-Request/Fast Reconnect 2. * @sm: Pointer to EAP state machine allocated with eap_peer_sm_init() * @data: Pointer to EAP-NOOB data * @id: EAP packet ID * Returns: Pointer to allocated EAP-Request packet, or NULL if not. **/ static struct wpabuf * eap_noob_req_type_six(struct eap_noob_server_context * data, u8 id) { json_t * req_obj = NULL; struct wpabuf *req = NULL; char * req_json = NULL, * base64_nonce = NULL; size_t len = 0; int rc, err = 0; unsigned long error; wpa_printf(MSG_DEBUG, "EAP-NOOB: Request 2/Fast Reconnect"); if (NULL == data) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Input arguments NULL for function %s",__func__); return NULL; } data->peer_attr->kdf_nonce_data->Ns = os_malloc(NONCE_LEN); rc = RAND_bytes(data->peer_attr->kdf_nonce_data->Ns, NONCE_LEN); error = ERR_get_error(); if (rc != 1) wpa_printf(MSG_DEBUG, "EAP-NOOB: Failed to generate nonce Error Code = %lu", error); wpa_hexdump_ascii(MSG_DEBUG, "EAP-NOOB: Nonce", data->peer_attr->kdf_nonce_data->Ns, NONCE_LEN); err -= (FAILURE == eap_noob_Base64Encode(data->peer_attr->kdf_nonce_data->Ns, NONCE_LEN, &base64_nonce)); wpa_printf(MSG_DEBUG,"EAP-NOOB: Nonce %s", base64_nonce); /* TODO: Based on the previous and the current versions of cryptosuites of peers, * decide whether new public key has to be generated * TODO: change get key params and finally store only base 64 encoded public key */ err -= (NULL == (req_obj = json_object())); err += json_object_set_new(req_obj, TYPE, json_integer(EAP_NOOB_TYPE_6)); err += json_object_set_new(req_obj, PEERID, json_string(data->peer_attr->PeerId)); err += json_object_set_new(req_obj, NS2, json_string(base64_nonce)); err -= (NULL == (req_json = json_dumps(req_obj, JSON_COMPACT|JSON_PRESERVE_ORDER))); if (err < 0) goto EXIT; wpa_printf(MSG_DEBUG, "EAP-NOOB: request %s",req_json); len = strlen(req_json)+1; if (NULL == (req = eap_msg_alloc(EAP_VENDOR_IETF, EAP_TYPE_NOOB, len, EAP_CODE_REQUEST, id))) { wpa_printf(MSG_ERROR, "EAP-NOOB: Failed to allocate memory for Request/NOOB-FR"); goto EXIT; } wpabuf_put_data(req, req_json, len); //err += json_array_set(data->peer_attr->mac_input, 11, data->peer_attr->ecdh_exchange_data->jwk_serv); err += json_array_set_new(data->peer_attr->mac_input, 12, json_string(base64_nonce)); if (err < 0) wpa_printf(MSG_DEBUG, "EAP-NOOB: Error in setting MAC values"); EXIT: json_decref(req_obj); EAP_NOOB_FREE(req_json); return req; } /** * TODO send Cryptosuites only if it has changed; * eap_oob_req_type_five - Build the EAP-Request/Fast Reconnect 1. * @data: Pointer to EAP-NOOB data * @id: EAP packet ID * Returns: Pointer to allocated EAP-Request packet, or NULL if not. **/ static struct wpabuf * eap_noob_req_type_five(struct eap_noob_server_context * data, u8 id) { struct wpabuf * req = NULL; char * req_json = NULL; json_t * Vers = NULL, * macinput = NULL, * req_obj = NULL; json_t * Cryptosuites = NULL, * ServerInfo = NULL, * Realm = NULL; json_t * PeerId = NULL, * emptystr = json_string(""); size_t len = 0; int err = 0, i; if (NULL == data) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Input to %s is null", __func__); return NULL; } wpa_printf(MSG_DEBUG, "EAP-NOOB: Entering func %s", __func__); err -= (NULL == (Vers = json_array())); for (i = 0; i < MAX_SUP_VER ; i++) { if (data->server_attr->version[i] > 0) err += json_array_append_new(Vers, json_integer(data->server_attr->version[i])); } PeerId = json_string(data->peer_attr->PeerId); err -= (NULL == (Cryptosuites = json_array())); for (i = 0; i < MAX_SUP_CSUITES ; i++) { if (data->server_attr->cryptosuite[i] > 0) err += json_array_append_new(Cryptosuites, json_integer(data->server_attr->cryptosuite[i])); } err -= (NULL == (ServerInfo = eap_noob_serverinfo(data->server_attr->server_config_params))); err -= (NULL == (req_obj = json_object())); err += json_object_set_new(req_obj, TYPE, json_integer(EAP_NOOB_TYPE_5)); err += json_object_set_new(req_obj, PEERID, PeerId); err += json_object_set_new(req_obj, CRYPTOSUITES, Cryptosuites); err += json_object_set_new(req_obj, SERVERINFO, ServerInfo); if (0 != strcmp(server_conf.realm, RESERVED_DOMAIN)) { err -= (NULL == (Realm = json_string(server_conf.realm))); err += json_object_set_new(req_obj, REALM, Realm); } else Realm = emptystr; err -= (NULL == (req_json = json_dumps(req_obj, JSON_COMPACT|JSON_PRESERVE_ORDER))); if (err < 0) { wpa_printf(MSG_ERROR, "EAP-NOOB: Unexpected JSON processing error when creating request type 5."); goto EXIT; } wpa_printf(MSG_DEBUG, "EAP-NOOB: Request Sending = %s = %d", req_json, (int)strlen(req_json)); len = strlen(req_json)+1; if (NULL == (req = eap_msg_alloc(EAP_VENDOR_IETF, EAP_TYPE_NOOB, len, EAP_CODE_REQUEST, id))) { wpa_printf(MSG_ERROR, "EAP-NOOB: Failed to allocate memory for Request/NOOB-FR"); goto EXIT; } wpabuf_put_data(req, req_json, len); json_decref(data->peer_attr->mac_input); err -= (NULL == (macinput = json_array())); err += json_array_append(macinput, emptystr); err += json_array_append(macinput, Vers); err += json_array_append(macinput, emptystr); err += json_array_append(macinput, PeerId); err += json_array_append(macinput, Cryptosuites); err += json_array_append(macinput, emptystr); err += json_array_append(macinput, ServerInfo); err += json_array_append(macinput, emptystr); err += json_array_append(macinput, emptystr); err += json_array_append(macinput, Realm); err += json_array_append(macinput, emptystr); err += json_array_append(macinput, emptystr); err += json_array_append(macinput, emptystr); err += json_array_append(macinput, emptystr); err += json_array_append(macinput, emptystr); data->peer_attr->mac_input = macinput; if (err < 0) { wpa_printf(MSG_ERROR, "EAP-NOOB: Unexpected JSON processing error when creating mac input template."); goto EXIT; } EXIT: json_decref(req_obj); json_decref(emptystr); EAP_NOOB_FREE(req_json); if (err < 0) { json_decref(macinput); data->peer_attr->mac_input = NULL; wpabuf_free(req); return NULL; } return req; } /** * eap_oob_req_type_four - Build the EAP-Request * @data: Pointer to EAP-NOOB data * @id: EAP packet ID * Returns: Pointer to allocated EAP-Request packet, or NULL if not. **/ static struct wpabuf * eap_noob_req_type_four(struct eap_noob_server_context * data, u8 id) { json_t * req_obj =NULL; struct wpabuf * req = NULL; char * mac_b64 = NULL, * req_json = NULL; u8 * mac = NULL; size_t len = 0; int err = 0; if (NULL == data) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Server context NULL in %s", __func__); return NULL; } wpa_printf(MSG_DEBUG, "EAP-NOOB: Entering %s", __func__); if (SUCCESS != eap_noob_gen_KDF(data, COMPLETION_EXCHANGE)) { wpa_printf(MSG_ERROR, "EAP-NOOB: Error in KDF during Request/NOOB-CE"); goto EXIT; } if (NULL == (mac = eap_noob_gen_MAC(data, MACS_TYPE, data->peer_attr->kdf_out->Kms, KMS_LEN,COMPLETION_EXCHANGE))) goto EXIT; wpa_hexdump(MSG_DEBUG, "EAP-NOOB: MAC calculated and sending out", mac, 32); err -= (FAILURE == eap_noob_Base64Encode(mac, MAC_LEN, &mac_b64)); err -= (NULL == (req_obj = json_object())); err += json_object_set_new(req_obj, TYPE, json_integer(EAP_NOOB_TYPE_4)); err += json_object_set_new(req_obj, PEERID, json_string(data->peer_attr->PeerId)); err += json_object_set_new(req_obj, NOOBID, json_string(data->peer_attr->oob_data->NoobId_b64)); err += json_object_set_new(req_obj, MACS, json_string(mac_b64)); err -= (NULL == (req_json = json_dumps(req_obj, JSON_COMPACT|JSON_PRESERVE_ORDER))); if (err < 0) goto EXIT; wpa_printf(MSG_DEBUG, "EAP-NOOB: Type 4 request = %s", req_json); wpa_printf(MSG_DEBUG, "EAP-NOOB: Type 4 NoobId = %s", data->peer_attr->oob_data->NoobId_b64); len = strlen(req_json)+1; if (NULL == (req = eap_msg_alloc(EAP_VENDOR_IETF, EAP_TYPE_NOOB, len, EAP_CODE_REQUEST, id))) { wpa_printf(MSG_ERROR, "EAP-NOOB: Failed to allocate memory for Request/NOOB-CE"); goto EXIT; } wpabuf_put_data(req, req_json, len); EXIT: json_decref(req_obj); EAP_NOOB_FREE(req_json); EAP_NOOB_FREE(mac_b64); return req; } /** * eap_oob_req_type_three - Build the EAP-Request * @data: Pointer to EAP-NOOB data * @id: EAP packet ID * Returns: Pointer to allocated EAP-Request packet, or NULL if not. **/ static struct wpabuf * eap_noob_req_type_three(struct eap_noob_server_context * data, u8 id) { json_t * req_obj = NULL; struct wpabuf *req = NULL; char * req_json = NULL; size_t len = 0; int err = 0; struct timespec time; if (NULL == data) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Input to %s is null", __func__); return NULL; } wpa_printf(MSG_DEBUG, "EAP-NOOB: Request 3/Waiting Exchange"); data->peer_attr->sleeptime = eap_noob_get_sleeptime(data); err -= (NULL == (req_obj = json_object())); err += json_object_set_new(req_obj, TYPE, json_integer(EAP_NOOB_TYPE_3)); err += json_object_set_new(req_obj, PEERID, json_string(data->peer_attr->PeerId)); err += json_object_set_new(req_obj, SLEEPTIME, json_integer(data->peer_attr->sleeptime)); clock_gettime(CLOCK_REALTIME, &time); data->peer_attr->last_used_time = time.tv_sec; wpa_printf(MSG_DEBUG, "Current Time is %ld", data->peer_attr->last_used_time); //data->peer_attr->last_used_time = data->peer_attr->last_used_time + data->peer_attr->sleeptime; err -= (NULL == (req_json = json_dumps(req_obj,JSON_COMPACT|JSON_PRESERVE_ORDER))); if (err < 0) goto EXIT; len = strlen(req_json)+1; if (NULL == (req = eap_msg_alloc(EAP_VENDOR_IETF, EAP_TYPE_NOOB,len , EAP_CODE_REQUEST, id))) { wpa_printf(MSG_ERROR, "EAP-NOOB: Failed to allocate memory for Request/NOOB-WE"); goto EXIT; } wpabuf_put_data(req, req_json, len); EXIT: json_decref(req_obj); EAP_NOOB_FREE(req_json); return req; } /** * eap_noob_build_JWK : Builds a JWK object to send in the inband message * @jwk : output json object * @x_64 : x co-ordinate in base64url format * @y_64 : y co-ordinate in base64url format * Returns : FAILURE/SUCCESS **/ int eap_noob_build_JWK(json_t ** jwk, const char * x_b64, const char * y_b64) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Entering %s", __func__); if (NULL != ((*jwk) = json_object())) { json_object_set_new((*jwk), KEY_TYPE, json_string("EC")); json_object_set_new((*jwk), CURVE, json_string("P-256")); } else { wpa_printf(MSG_DEBUG, "EAP-NOOB: Error in JWK"); return FAILURE; } if (NULL == x_b64 || NULL == y_b64) { wpa_printf(MSG_DEBUG, "EAP-NOOB: CO-ORDINATES are NULL!!"); return FAILURE; } json_object_set_new((*jwk), X_COORDINATE, json_string(x_b64)); json_object_set_new((*jwk), Y_COORDINATE, json_string(y_b64)); char * dump_str = json_dumps((*jwk), JSON_COMPACT|JSON_PRESERVE_ORDER); if (dump_str) { wpa_printf(MSG_DEBUG, "JWK Key %s", dump_str); os_free(dump_str); } return SUCCESS; } /** * eap_oob_req_type_two - Build the EAP-Request/Initial Exchange 2. * @sm: Pointer to EAP state machine allocated with eap_peer_sm_init() * @data: Pointer to EAP-NOOB data * @id: EAP packet ID * Returns: Pointer to allocated EAP-Request packet, or NULL if not. **/ static struct wpabuf * eap_noob_req_type_two(struct eap_noob_server_context *data, u8 id) { json_t * req_obj = NULL; struct wpabuf * req = NULL; char * req_json = NULL, * base64_nonce = NULL; size_t len = 0; int rc, err = 0; unsigned long error; wpa_printf(MSG_DEBUG, "EAP-NOOB: Request 2/Initial Exchange"); if (NULL == data || NULL == data->peer_attr) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Input arguments NULL for function %s",__func__); return NULL; } data->peer_attr->kdf_nonce_data->Ns = os_malloc(NONCE_LEN); rc = RAND_bytes(data->peer_attr->kdf_nonce_data->Ns, NONCE_LEN); error = ERR_get_error(); if (rc != 1) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Failed to generate nonce. Error Code = %lu", error); goto EXIT; } wpa_hexdump_ascii(MSG_DEBUG, "EAP-NOOB: Nonce", data->peer_attr->kdf_nonce_data->Ns, NONCE_LEN); eap_noob_Base64Encode(data->peer_attr->kdf_nonce_data->Ns, NONCE_LEN, &base64_nonce); wpa_printf(MSG_DEBUG,"EAP-NOOB: Nonce %s", base64_nonce); /* Generate Key material */ if (eap_noob_get_key(data) == FAILURE) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Failed to generate keys"); eap_noob_set_done(data, DONE); eap_noob_set_success(data, FAILURE); goto EXIT; } if (FAILURE == eap_noob_build_JWK(&data->peer_attr->ecdh_exchange_data->jwk_serv, data->peer_attr->ecdh_exchange_data->x_b64, data->peer_attr->ecdh_exchange_data->y_b64)) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Failed to generate JWK"); goto EXIT; } data->peer_attr->sleeptime = eap_noob_get_sleeptime(data); err -= (NULL == (req_obj = json_object())); err += json_object_set_new(req_obj, TYPE, json_integer(EAP_NOOB_TYPE_2)); err += json_object_set_new(req_obj, PEERID, json_string(data->peer_attr->PeerId)); err += json_object_set_new(req_obj, NS, json_string(base64_nonce)); err += json_object_set(req_obj, PKS, data->peer_attr->ecdh_exchange_data->jwk_serv); err += json_object_set_new(req_obj, SLEEPTIME, json_integer(data->peer_attr->sleeptime)); err -= (NULL == (req_json = json_dumps(req_obj, JSON_COMPACT|JSON_PRESERVE_ORDER))); if (err < 0) goto EXIT; wpa_printf(MSG_DEBUG, "EAP-NOOB: request %s = %d",req_json,(int)strlen(req_json)); len = strlen(req_json)+1; if (NULL == (req = eap_msg_alloc(EAP_VENDOR_IETF, EAP_TYPE_NOOB, len, EAP_CODE_REQUEST, id))) { wpa_printf(MSG_ERROR, "EAP-NOOB: Failed to allocate memory for Request/NOOB-IE"); goto EXIT; } wpabuf_put_data(req, req_json, len); err += json_array_set(data->peer_attr->mac_input, 11, data->peer_attr->ecdh_exchange_data->jwk_serv); err += json_array_set_new(data->peer_attr->mac_input, 12, json_string(base64_nonce)); if (err < 0) wpa_printf(MSG_DEBUG, "EAP-NOOB: Error in setting MAC values"); EXIT: json_decref(req_obj); EAP_NOOB_FREE(req_json); if (err < 0) { wpabuf_free(req); return NULL; } return req; } /** * eap_oob_req_type_one - Build the EAP-Request/Initial Exchange 1. * @sm: Pointer to EAP state machine allocated with eap_peer_sm_init() * @data: Pointer to EAP-NOOB data * @id: EAP packet ID * Returns: Pointer to allocated EAP-Request packet, or NULL if not. **/ static struct wpabuf * eap_noob_req_type_one(struct eap_noob_server_context * data, u8 id) { json_t * req_obj = NULL; struct wpabuf * req = NULL; size_t len = 0; json_t * emptystr = json_string(""); int err = 0; json_t * Vers = NULL, * macinput= NULL; json_t * Cryptosuites, * Dirs,* ServerInfo, * Realm; json_t * PeerId; char * req_json; int i; /* (Type=1, PeerId, CryptoSuites, Dirs ,ServerInfo) */ if (NULL == data || NULL == data->server_attr || NULL == data->peer_attr) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Input arguments NULL for function %s",__func__); return NULL; } wpa_printf(MSG_DEBUG, "EAP-NOOB: Request 1/Initial Exchange"); EAP_NOOB_FREE(data->peer_attr->PeerId); data->peer_attr->PeerId = os_malloc(MAX_PEERID_LEN); if (eap_noob_get_id_peer(data->peer_attr->PeerId, MAX_PEERID_LEN)) { wpa_printf(MSG_ERROR, "EAP-NOOB: Failed to generate PeerId"); return NULL; } err -= (NULL == (Vers = json_array())); for (i = 0; i < MAX_SUP_VER ; i++) { if (data->server_attr->version[i] > 0) err += json_array_append_new(Vers, json_integer(data->server_attr->version[i])); } PeerId = json_string(data->peer_attr->PeerId); err -= (NULL == (Cryptosuites = json_array())); for (i = 0; i < MAX_SUP_CSUITES ; i++) { if (data->server_attr->cryptosuite[i] > 0) err += json_array_append_new(Cryptosuites, json_integer(data->server_attr->cryptosuite[i])); } err -= (NULL == (Dirs = json_integer(data->server_attr->dir))); err -= (NULL == (ServerInfo = eap_noob_serverinfo(data->server_attr->server_config_params))); /* Create request */ err -= (NULL == (req_obj = json_object())); err += json_object_set_new(req_obj, TYPE, json_integer(EAP_NOOB_TYPE_1)); err += json_object_set_new(req_obj, VERS, Vers); err += json_object_set_new(req_obj, PEERID, PeerId); err += json_object_set_new(req_obj, CRYPTOSUITES, Cryptosuites); err += json_object_set_new(req_obj, DIRS, Dirs); err += json_object_set_new(req_obj, SERVERINFO, ServerInfo); if (0 != strcmp(server_conf.realm, RESERVED_DOMAIN)) { err -= (NULL == (Realm = json_string(server_conf.realm))); err += json_object_set_new(req_obj, REALM, Realm); } else Realm = emptystr; err -= (NULL == (req_json = json_dumps(req_obj, JSON_COMPACT|JSON_PRESERVE_ORDER))); if (err < 0) { wpa_printf(MSG_ERROR, "EAP-NOOB: Unexpected JSON processing error when creating request type 1."); goto EXIT; } wpa_printf(MSG_DEBUG, "EAP-NOOB: Request Sending = %s = %d", req_json, (int)strlen(req_json)); len = strlen(req_json); if (NULL == (req = eap_msg_alloc(EAP_VENDOR_IETF, EAP_TYPE_NOOB, len+1, EAP_CODE_REQUEST, id))) { wpa_printf(MSG_ERROR, "EAP-NOOB: Failed to allocate memory for Request/NOOB-IE"); goto EXIT; } wpabuf_put_data(req, req_json, len+1); /* Create MAC imput template */ /* 1/2,Vers,Verp,PeerId,Cryptosuites,Dirs,ServerInfo,Cryptosuitep,Dirp,[Realm],PeerInfo,PKs,Ns,PKp,Np,Noob */ err -= (NULL == (macinput = json_array())); err += json_array_append(macinput, emptystr); err += json_array_append(macinput, Vers); err += json_array_append(macinput, emptystr); err += json_array_append(macinput, PeerId); err += json_array_append(macinput, Cryptosuites); err += json_array_append(macinput, Dirs); err += json_array_append(macinput, ServerInfo); err += json_array_append(macinput, emptystr); err += json_array_append(macinput, emptystr); err += json_array_append(macinput, Realm); err += json_array_append(macinput, emptystr); err += json_array_append(macinput, emptystr); err += json_array_append(macinput, emptystr); err += json_array_append(macinput, emptystr); err += json_array_append(macinput, emptystr); data->peer_attr->mac_input = macinput; if (err < 0) { wpa_printf(MSG_ERROR, "EAP-NOOB: Unexpected JSON processing error when creating mac input template."); goto EXIT; } EXIT: EAP_NOOB_FREE(req_json); json_decref(req_obj); json_decref(emptystr); if (err < 0) { json_decref(macinput); data->peer_attr->mac_input = NULL; wpabuf_free(req); return NULL; } return req; } /** * eap_noob_req_noobid - * @data: Pointer to private EAP-NOOB data * @id: EAP response to be processed (eapRespData) * Returns: Pointer to allocated EAP-Request packet, or NULL if not. **/ static struct wpabuf * eap_noob_req_noobid(struct eap_noob_server_context * data, u8 id) { struct wpabuf * req = NULL; json_t * req_obj = NULL; char * req_json = NULL; size_t len = 0; int err = 0; if (NULL == data) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Input to %s is null", __func__); return NULL; } err -= (NULL == (req_obj = json_object())); err += json_object_set_new(req_obj, TYPE, json_integer(EAP_NOOB_TYPE_8)); err += json_object_set_new(req_obj, PEERID, json_string(data->peer_attr->PeerId)); err -= (NULL == (req_json = json_dumps(req_obj, JSON_COMPACT|JSON_PRESERVE_ORDER))); if (err < 0) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Unexpected error in preapring JSON obj"); goto EXIT; } len = strlen(req_json)+1; wpa_printf(MSG_DEBUG, "EAP-NOOB: REQ Received = %s", req_json); req = eap_msg_alloc(EAP_VENDOR_IETF, EAP_TYPE_NOOB, len, EAP_CODE_REQUEST, id); if (req == NULL) { wpa_printf(MSG_ERROR, "EAP-NOOB: Failed to allocate memory for Request/NOOB-ID"); goto EXIT; } wpabuf_put_data(req, req_json, len); EXIT: json_decref(req_obj); EAP_NOOB_FREE(req_json); return req; } /** * eap_noob_buildReq - Build the EAP-Request packets. * @sm: Pointer to EAP state machine allocated with eap_peer_sm_init() * @priv: Pointer to private EAP-NOOB data * @id: EAP response to be processed (eapRespData) * Returns: Pointer to allocated EAP-Request packet, or NULL if not. **/ static struct wpabuf * eap_noob_buildReq(struct eap_sm * sm, void * priv, u8 id) { wpa_printf(MSG_DEBUG, "EAP-NOOB: BUILDREQ SERVER"); struct eap_noob_server_context *data = NULL; if (NULL == sm || NULL == priv) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Input arguments NULL for function %s",__func__); return NULL; } data = priv; printf("next req = %d\n", data->peer_attr->next_req); //TODO : replce switch case with function pointers. switch (data->peer_attr->next_req) { case NONE: return eap_noob_err_msg(data,id); case EAP_NOOB_TYPE_1: return eap_noob_req_type_one(data, id); case EAP_NOOB_TYPE_2: return eap_noob_req_type_two(data, id); case EAP_NOOB_TYPE_3: return eap_noob_req_type_three(data, id); case EAP_NOOB_TYPE_4: return eap_noob_req_type_four(data, id); case EAP_NOOB_TYPE_5: return eap_noob_req_type_five(data, id); case EAP_NOOB_TYPE_6: return eap_noob_req_type_six(data, id); case EAP_NOOB_TYPE_7: return eap_noob_req_type_seven(data, id); case EAP_NOOB_TYPE_8: return eap_noob_req_noobid(data, id); default: wpa_printf(MSG_DEBUG, "EAP-NOOB: Unknown type in buildReq"); break; } return NULL; } /** * eap_oob_check - Check the EAP-Response is valid. * @sm: Pointer to EAP state machine allocated with eap_peer_sm_init() * @priv: Pointer to private EAP-NOOB data * @respData: EAP response to be processed (eapRespData) * Returns: False if response is valid, True otherwise. **/ static Boolean eap_noob_check(struct eap_sm * sm, void * priv, struct wpabuf * respData) { struct eap_noob_server_context * data = NULL; json_t * resp_obj = NULL, * resp_type = NULL; const u8 * pos = NULL; json_error_t error; u32 state = 0; size_t len = 0; Boolean ret = FALSE; if (NULL == priv || NULL == sm || NULL == respData) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Input to %s is null", __func__); return TRUE; } wpa_printf(MSG_INFO, "EAP-NOOB: Checking EAP-Response packet."); data = priv; state = data->peer_attr->server_state; pos = eap_hdr_validate(EAP_VENDOR_IETF, EAP_TYPE_NOOB, respData, &len); resp_obj = json_loads((char *)pos, JSON_COMPACT|JSON_PRESERVE_ORDER, &error); if ((NULL != resp_obj) && (json_is_object(resp_obj) > 0)) { resp_type = json_object_get(resp_obj, TYPE); if ((NULL != resp_type) && (json_is_integer(resp_type) > 0)) { data->peer_attr->recv_msg = json_integer_value(resp_type); } else { wpa_printf(MSG_DEBUG, "EAP-NOOB: Request with unknown message type"); eap_noob_set_error(data->peer_attr, E1002); ret = TRUE; goto EXIT; } } else { wpa_printf(MSG_DEBUG, "EAP-NOOB: Request with unknown format received"); eap_noob_set_error(data->peer_attr, E1002); ret = TRUE; goto EXIT; } wpa_printf(MSG_DEBUG, "EAP-NOOB: Received frame: opcode = %d", data->peer_attr->recv_msg); wpa_printf(MSG_DEBUG, "STATE = %d",data->peer_attr->server_state); wpa_printf(MSG_DEBUG, "VERIFY STATE SERV = %d PEER = %d", data->peer_attr->server_state, data->peer_attr->peer_state); if ((NONE != data->peer_attr->recv_msg) && ((state >= NUM_OF_STATES) || (data->peer_attr->recv_msg > MAX_MSG_TYPES) || (VALID != state_message_check[state][data->peer_attr->recv_msg]))) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Setting error in received message." "state (%d), message type (%d), state received (%d)", state, data->peer_attr->recv_msg, state_message_check[state][data->peer_attr->recv_msg]); eap_noob_set_error(data->peer_attr,E1004); ret = TRUE; goto EXIT; } EXIT: if (resp_type) json_decref(resp_type); else json_decref(resp_obj); return ret; } /** * eap_noob_del_temp_tuples : * @data : peer context * retures: FAILURE/SUCCESS **/ static int eap_noob_del_temp_tuples(struct eap_noob_server_context * data) { char * query = os_malloc(MAX_LINE_SIZE); int ret = SUCCESS; if (NULL == data || NULL == query) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Input to %s is null or malloc failed.", __func__); ret = FAILURE; goto EXIT; } os_snprintf(query, MAX_LINE_SIZE, "Delete from %s WHERE PeerId=?", DEVICE_TABLE); if (FAILURE == eap_noob_exec_query(data, query, NULL, 2, data->peer_attr->peerid_rcvd)) { wpa_printf(MSG_ERROR, "EAP-NOOB: DB tuple deletion failed"); ret = FAILURE; goto EXIT; } wpa_printf(MSG_DEBUG, "EAP-NOOB: TEMP Tuples removed"); EXIT: EAP_NOOB_FREE(query); return ret; } /** * eap_noob_verify_param_len : verify lengths of string type parameters * @data : peer context **/ static void eap_noob_verify_param_len(struct eap_noob_peer_data * data) { u32 count = 0; u32 pos = 0x01; if (NULL == data) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Input arguments NULL for function %s",__func__); return ; } for (count = 0; count < 32; count++) { if (data->rcvd_params & pos) { switch(pos) { case PEERID_RCVD: if (strlen(data->peerid_rcvd) > MAX_PEERID_LEN) { eap_noob_set_error(data, E1003); } break; case NONCE_RCVD: if (strlen((char *)data->kdf_nonce_data->Np) > NONCE_LEN) { eap_noob_set_error(data, E1003); } break; case MAC_RCVD: if (strlen(data->mac) > MAC_LEN) { eap_noob_set_error(data, E1003); } break; case INFO_RCVD: if (strlen(data->peerinfo) > MAX_INFO_LEN) { eap_noob_set_error(data, E1003); } break; } } pos = pos<<1; } } /** * eap_noob_FindIndex : * @val : * returns: **/ int eap_noob_FindIndex(int value) { int index = 0; while (index < 13 && error_code[index] != value) ++index; return index; } /** * eap_noob_decode_obj : Decode parameters from incoming messages * @data : peer context * @req_obj : incoming json object with message parameters **/ static void eap_noob_decode_obj(struct eap_noob_peer_data * data, json_t * resp_obj) { const char * key = NULL, * retval_char = NULL; char * PKp_str = NULL; json_t * value = NULL; json_error_t error; size_t decode_length = 0; int retval_int = 0; if (NULL == resp_obj || NULL == data) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Input arguments NULL for function %s",__func__); return; } json_object_foreach (resp_obj, key, value) { switch (json_typeof(value)) { case JSON_OBJECT: if (0 == strcmp(key, PKP)) { PKp_str = json_dumps(value, JSON_COMPACT|JSON_PRESERVE_ORDER); data->ecdh_exchange_data->jwk_peer = json_loads(PKp_str, JSON_COMPACT|JSON_PRESERVE_ORDER, &error); os_free(PKp_str); data->rcvd_params |= PKEY_RCVD; } else if (0 == strcmp(key, PEERINFO)) { data->peerinfo = json_dumps(value, JSON_COMPACT|JSON_PRESERVE_ORDER); wpa_printf(MSG_DEBUG, "EAP-NOOB: Peer Info: %s", data->peerinfo); data->rcvd_params |= INFO_RCVD; } eap_noob_decode_obj(data, value); break; case JSON_INTEGER: if (0 == (retval_int = json_integer_value(value)) && (0 != strcmp(key,TYPE))) { eap_noob_set_error(data, E1003); return; } if (0 == strcmp(key, VERP)) { data->version = retval_int; data->rcvd_params |= VERSION_RCVD; } else if (0 == strcmp(key, CRYPTOSUITEP)) { data->cryptosuite = retval_int; data->rcvd_params |= CRYPTOSUITEP_RCVD; } else if (0 == strcmp(key, DIRP)) { data->dir = retval_int; data->rcvd_params |= DIRP_RCVD; } else if (0 == strcmp(key, ERRORCODE)) { eap_noob_set_error(data, eap_noob_FindIndex(retval_int)); } break; case JSON_STRING: if (NULL == (retval_char = json_string_value(value))) { eap_noob_set_error(data,E1003); return; } if (0 == strcmp(key, PEERID)) { EAP_NOOB_FREE(data->peerid_rcvd); data->peerid_rcvd = os_strdup(retval_char); data->rcvd_params |= PEERID_RCVD; } else if (0 == strcmp(key, NOOBID)) { EAP_NOOB_FREE(data->oob_data->NoobId_b64); data->oob_data->NoobId_b64 = os_strdup(retval_char); data->rcvd_params |= NOOBID_RCVD; } else if (0 == strcmp(key, PEERINFO_SERIAL)) { data->peer_snum = os_strdup(retval_char); } else if ((0 == strcmp(key, NP)) || (0 == strcmp(key, NP2))) { data->kdf_nonce_data->nonce_peer_b64 = os_strdup(retval_char); decode_length = eap_noob_Base64Decode((char *)data->kdf_nonce_data->nonce_peer_b64, &data->kdf_nonce_data->Np); if (0 == decode_length) wpa_printf(MSG_DEBUG, "EAP-NOOB: Failed to decode peer nonce"); else data->rcvd_params |= NONCE_RCVD; } else if ((0 == strcmp(key, MACP)) || (0 == strcmp(key, MACP2))) { decode_length = eap_noob_Base64Decode((char *)retval_char, (u8**)&data->mac); if (0 == decode_length) wpa_printf(MSG_DEBUG, "EAP-NOOB: Failed to decode MAC"); else data->rcvd_params |= MAC_RCVD; } else if (0 == strcmp(key, X_COORDINATE)) { data->ecdh_exchange_data->x_peer_b64 = os_strdup(json_string_value(value)); wpa_printf(MSG_DEBUG, "X coordinate %s", data->ecdh_exchange_data->x_peer_b64); } else if (0 == strcmp(key, Y_COORDINATE)) { data->ecdh_exchange_data->y_peer_b64 = os_strdup(json_string_value(value)); wpa_printf(MSG_DEBUG, "Y coordinate %s", data->ecdh_exchange_data->y_peer_b64); } break; case JSON_REAL: case JSON_TRUE: case JSON_FALSE: case JSON_NULL: case JSON_ARRAY: break; } } eap_noob_verify_param_len(data); } /** * eap_oob_rsp_type_seven - Process EAP-Response * @data: Pointer to private EAP-NOOB data * @resp_obj: json object of the response received **/ static void eap_noob_rsp_type_seven(struct eap_noob_server_context * data, json_t * resp_obj) { u8 * mac = NULL; char * mac_b64 = NULL; if (NULL == resp_obj || NULL == data) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Input arguments NULL for function %s", __func__); return; } wpa_printf(MSG_DEBUG, "EAP-NOOB: Response Processed/NOOB-FR-3"); eap_noob_decode_obj(data->peer_attr, resp_obj); /* TODO : validate MAC address along with peerID */ if (data->peer_attr->rcvd_params != TYPE_SEVEN_PARAMS) { eap_noob_set_error(data->peer_attr, E1002); eap_noob_set_done(data, NOT_DONE); return; } if ((data->peer_attr->err_code != NO_ERROR)) { eap_noob_set_done(data, NOT_DONE); return; } if (eap_noob_verify_peerId(data)) { mac = eap_noob_gen_MAC(data, MACP_TYPE, data->peer_attr->kdf_out->Kmp, KMP_LEN, RECONNECT_EXCHANGE); eap_noob_Base64Encode(mac, MAC_LEN, &mac_b64); if (0 != strcmp(data->peer_attr->mac, (char *)mac)) { eap_noob_set_error(data->peer_attr,E4001); eap_noob_set_done(data, NOT_DONE); goto EXIT; } eap_noob_change_state(data, REGISTERED_STATE); if (FAILURE == eap_noob_db_functions(data, UPDATE_PERSISTENT_STATE)) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Updating server state failed "); goto EXIT; } data->peer_attr->next_req = NONE; eap_noob_set_done(data, DONE); eap_noob_set_success(data, SUCCESS); } EXIT: EAP_NOOB_FREE(mac_b64); return; } /** * eap_oob_rsp_type_six - Process EAP-Response/Fast Reconnect 2 * @data: Pointer to private EAP-NOOB data * @resp_obj: json object of the response received **/ static void eap_noob_rsp_type_six(struct eap_noob_server_context * data, json_t * resp_obj) { if (NULL == resp_obj || NULL == data) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Input arguments NULL for function %s",__func__); return ; } wpa_printf(MSG_DEBUG, "EAP-NOOB: Response Processed/NOOB-FR-2"); eap_noob_decode_obj(data->peer_attr, resp_obj); if (data->peer_attr->rcvd_params != TYPE_SIX_PARAMS) { eap_noob_set_error(data->peer_attr, E1002); eap_noob_set_done(data, NOT_DONE); return; } if ((data->peer_attr->err_code != NO_ERROR)) { eap_noob_set_done(data, NOT_DONE); return; } wpa_hexdump_ascii(MSG_DEBUG, "EAP-NOOB: Nonce Peer", data->peer_attr->kdf_nonce_data->Np, NONCE_LEN); if (eap_noob_verify_peerId(data)) { data->peer_attr->next_req = EAP_NOOB_TYPE_7; eap_noob_set_done(data, NOT_DONE); data->peer_attr->rcvd_params = 0; } //json_array_set(data->peer_attr->mac_input, 13, data->peer_attr->ecdh_exchange_data->jwk_peer); json_array_set_new(data->peer_attr->mac_input, 14, json_string(data->peer_attr->kdf_nonce_data->nonce_peer_b64)); } /** * eap_oob_rsp_type_five - Process EAP-Response Type 5 * @data: Pointer to private EAP-NOOB data * @resp_obj: json object of the response received **/ static void eap_noob_rsp_type_five(struct eap_noob_server_context * data, json_t * resp_obj) { json_t * PeerInfo; json_error_t error; int err = 0; if (NULL == resp_obj || NULL == data) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Input arguments NULL for function %s",__func__); return ; } wpa_printf(MSG_DEBUG, "EAP-NOOB: Response Processed/NOOB-FR-1"); /* TODO: Check for the current cryptosuite and the previous to * decide whether new key exchange has to be done. */ eap_noob_decode_obj(data->peer_attr, resp_obj); if ((data->peer_attr->err_code != NO_ERROR)) { eap_noob_set_done(data, NOT_DONE); return; } if (data->peer_attr->rcvd_params != TYPE_FIVE_PARAMS) { eap_noob_set_error(data->peer_attr, E1002); eap_noob_set_done(data, NOT_DONE); return; } if (eap_noob_verify_peerId(data)) data->peer_attr->next_req = EAP_NOOB_TYPE_6; eap_noob_set_done(data, NOT_DONE); data->peer_attr->rcvd_params = 0; err -= (NULL == (PeerInfo = json_loads(data->peer_attr->peerinfo, JSON_COMPACT|JSON_PRESERVE_ORDER, &error))); err += json_array_set_new(data->peer_attr->mac_input, 2, json_integer(data->peer_attr->version)); err += json_array_set_new(data->peer_attr->mac_input, 7, json_integer(data->peer_attr->cryptosuite)); err += json_array_set_new(data->peer_attr->mac_input, 10, PeerInfo); if (err < 0) wpa_printf(MSG_DEBUG, "EAP-NOOB: Unexpected JSON error in MAC input"); } /** * eap_oob_rsp_type_four - Process EAP-Response Type 4 * @data: Pointer to private EAP-NOOB data * @resp_obj: json object of the response received **/ static void eap_noob_rsp_type_four(struct eap_noob_server_context * data, json_t * resp_obj) { u8 * mac = NULL; char * mac_b64 = NULL; int dir = 0; if (NULL == resp_obj || NULL == data) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Input arguments NULL for function %s",__func__); return ; } wpa_printf(MSG_DEBUG, "EAP-NOOB: Entering %s", __func__); dir = (data->server_attr->dir & data->peer_attr->dir); eap_noob_decode_obj(data->peer_attr, resp_obj); /* TODO : validate MAC address along with peerID */ if (data->peer_attr->rcvd_params != TYPE_FOUR_PARAMS) { eap_noob_set_error(data->peer_attr,E1002); eap_noob_set_done(data, NOT_DONE); return; } if ((data->peer_attr->err_code != NO_ERROR)) { eap_noob_set_done(data, NOT_DONE); return; } if (eap_noob_verify_peerId(data)) { mac = eap_noob_gen_MAC(data, MACP_TYPE, data->peer_attr->kdf_out->Kmp, KMP_LEN, COMPLETION_EXCHANGE); eap_noob_Base64Encode(mac, MAC_LEN, &mac_b64); if (0 != strcmp(data->peer_attr->mac, (char *)mac)) { eap_noob_set_error(data->peer_attr,E4001); eap_noob_set_done(data, NOT_DONE); goto EXIT; } eap_noob_change_state(data, REGISTERED_STATE); if (FAILURE == eap_noob_db_functions(data,UPDATE_PERSISTENT_KEYS_SECRET)) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Updating server state failed "); goto EXIT; } if (dir == SERVER_TO_PEER) eap_noob_del_temp_tuples(data); data->peer_attr->next_req = NONE; eap_noob_set_done(data, DONE); eap_noob_set_success(data, SUCCESS); } EXIT: EAP_NOOB_FREE(mac_b64); } /** * eap_oob_rsp_type_three - Process EAP-Response Type 3 * @data: Pointer to private EAP-NOOB data * @resp_obj: json object of the response received **/ static void eap_noob_rsp_type_three(struct eap_noob_server_context * data, json_t * resp_obj) { if (NULL == resp_obj || NULL == data) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Input arguments NULL for function %s",__func__); return ; } wpa_printf(MSG_DEBUG, "EAP-NOOB: Response Processed/NOOB-WE-3"); eap_noob_decode_obj(data->peer_attr,resp_obj); if (data->peer_attr->rcvd_params != TYPE_THREE_PARAMS) { eap_noob_set_error(data->peer_attr,E1002); eap_noob_set_done(data, NOT_DONE); return; } if ((data->peer_attr->err_code != NO_ERROR)) { eap_noob_set_done(data, NOT_DONE); return; } if (eap_noob_verify_peerId(data)) { eap_noob_change_state(data, WAITING_FOR_OOB_STATE); data->peer_attr->next_req = NONE; eap_noob_set_done(data, DONE); eap_noob_set_success(data, FAILURE); } } /** * eap_oob_rsp_type_two - Process EAP-Response/Initial Exchange 2 * @data: Pointer to private EAP-NOOB data * @resp_obj: json object of the response received **/ static void eap_noob_rsp_type_two(struct eap_noob_server_context * data, json_t * resp_obj) { size_t secret_len = ECDH_SHARED_SECRET_LEN; if (NULL == resp_obj || NULL == data) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Input arguments NULL for function %s",__func__); return ; } wpa_printf(MSG_DEBUG, "EAP-NOOB: Response Processed/NOOB-IE-2"); eap_noob_decode_obj(data->peer_attr,resp_obj); if (data->peer_attr->rcvd_params != TYPE_TWO_PARAMS) { eap_noob_set_error(data->peer_attr,E1002); eap_noob_set_done(data, NOT_DONE); return; } wpa_hexdump_ascii(MSG_DEBUG, "EAP-NOOB: Nonce Peer", data->peer_attr->kdf_nonce_data->Np, NONCE_LEN); if ((data->peer_attr->err_code != NO_ERROR)) { eap_noob_set_done(data, NOT_DONE); return; } if (eap_noob_verify_peerId(data)) { wpa_hexdump_ascii(MSG_DEBUG, "EAP-NOOB: Nonce Peer", data->peer_attr->kdf_nonce_data->Np, NONCE_LEN); if (eap_noob_derive_session_secret(data,&secret_len) != SUCCESS) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Error in deriving shared key"); return; } eap_noob_Base64Encode(data->peer_attr->ecdh_exchange_data->shared_key, ECDH_SHARED_SECRET_LEN, &data->peer_attr->ecdh_exchange_data->shared_key_b64); wpa_printf(MSG_DEBUG, "EAP-NOOB: Shared secret %s", data->peer_attr->ecdh_exchange_data->shared_key_b64); eap_noob_change_state(data, WAITING_FOR_OOB_STATE); /* Set MAC input before updating DB */ json_array_set(data->peer_attr->mac_input, 13, data->peer_attr->ecdh_exchange_data->jwk_peer); json_array_set_new(data->peer_attr->mac_input, 14, json_string(data->peer_attr->kdf_nonce_data->nonce_peer_b64)); if (FAILURE == eap_noob_db_functions(data, UPDATE_INITIALEXCHANGE_INFO)) { eap_noob_set_done(data, DONE); eap_noob_set_success(data,FAILURE); return; } data->peer_attr->next_req = NONE; eap_noob_set_done(data, DONE); eap_noob_set_success(data, FAILURE); } } /** * eap_oob_rsp_type_one - Process EAP-Response/Initial Exchange 1 * @data: Pointer to private EAP-NOOB data * @payload: EAP data received from the peer * @payloadlen: Length of the payload **/ static void eap_noob_rsp_type_one(struct eap_sm * sm, struct eap_noob_server_context * data, json_t * resp_obj) { json_error_t error; json_t * PeerInfo; int err = 0; /* Check for the supporting cryptosuites, PeerId, version, direction*/ wpa_printf(MSG_DEBUG, "EAP-NOOB: Response Processed/NOOB-IE-1"); if (NULL == resp_obj || NULL == data || NULL == sm) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Input arguments NULL for function %s",__func__); return ; } eap_noob_decode_obj(data->peer_attr, resp_obj); if ((data->peer_attr->err_code != NO_ERROR)) { eap_noob_set_done(data, NOT_DONE); return; } if (data->peer_attr->rcvd_params != TYPE_ONE_PARAMS) { eap_noob_set_error(data->peer_attr,E1002); eap_noob_set_done(data, NOT_DONE); return; } if (eap_noob_verify_peerId(data)) { data->peer_attr->next_req = EAP_NOOB_TYPE_2; } eap_noob_get_sid(sm, data); eap_noob_set_done(data, NOT_DONE); data->peer_attr->rcvd_params = 0; /* Set mac_input values received from peer in type 1 message */ err -= (NULL == (PeerInfo = json_loads(data->peer_attr->peerinfo, JSON_COMPACT|JSON_PRESERVE_ORDER, &error))); err += json_array_set_new(data->peer_attr->mac_input, 2, json_integer(data->peer_attr->version)); err += json_array_set_new(data->peer_attr->mac_input, 7, json_integer(data->peer_attr->cryptosuite)); err += json_array_set_new(data->peer_attr->mac_input, 8, json_integer(data->peer_attr->dir)); err += json_array_set_new(data->peer_attr->mac_input, 10, PeerInfo); if (err < 0) wpa_printf(MSG_DEBUG, "EAP-NOOB: Unexpected JSON error in MAC input"); } static void eap_noob_rsp_noobid(struct eap_noob_server_context * data, json_t * resp_obj) { eap_noob_decode_obj(data->peer_attr,resp_obj); if ((data->peer_attr->err_code != NO_ERROR)) { eap_noob_set_done(data, NOT_DONE); return; } if (data->peer_attr->rcvd_params != TYPE_EIGHT_PARAMS) { eap_noob_set_error(data->peer_attr,E1002); eap_noob_set_done(data, NOT_DONE); return; } if (!eap_noob_verify_peerId(data)) { eap_noob_set_error(data->peer_attr,E1005); eap_noob_set_done(data, NOT_DONE); return; } if (!eap_noob_db_functions(data, GET_NOOBID) || NULL == data->peer_attr->oob_data->NoobId_b64) { eap_noob_set_error(data->peer_attr,E1006); eap_noob_set_done(data,NOT_DONE); } else { eap_noob_set_done(data, NOT_DONE); data->peer_attr->next_req = EAP_NOOB_TYPE_4; } data->peer_attr->rcvd_params = 0; } /** * eap_oob_process - Control Process EAP-Response. * @sm: Pointer to EAP state machine allocated with eap_peer_sm_init() * @priv: Pointer to private EAP-NOOB data * @respData: EAP response to be processed (eapRespData) **/ static void eap_noob_process(struct eap_sm * sm, void * priv, struct wpabuf * respData) { struct eap_noob_server_context * data = NULL; json_t * resp_obj = NULL; const u8 * pos = NULL; char * dump_str = NULL; size_t len = 0; json_error_t error; wpa_printf(MSG_DEBUG, "EAP-NOOB: PROCESS SERVER"); if (NULL == sm || NULL == priv || NULL == respData) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Input arguments NULL for function %s",__func__); return; } data = priv; pos = eap_hdr_validate(EAP_VENDOR_IETF, EAP_TYPE_NOOB, respData, &len); if (NULL == pos || len < 1) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Error in eap header validation, %s",__func__); return; } if (data->peer_attr->err_code != NO_ERROR) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Error not none, exiting, %s", __func__); return; } json_decref(resp_obj); resp_obj = json_loads((char *)pos, JSON_COMPACT|JSON_PRESERVE_ORDER, &error); if (NULL == resp_obj) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Error allocating json obj, %s", __func__); return; } wpa_printf(MSG_DEBUG, "EAP-NOOB: RECEIVED RESPONSE = %s", pos); /* TODO : replce switch case with function pointers. */ switch (data->peer_attr->recv_msg) { case EAP_NOOB_TYPE_1: wpa_printf(MSG_DEBUG, "EAP-NOOB: ENTERING NOOB PROCESS TYPE 1"); eap_noob_rsp_type_one(sm, data, resp_obj); break; case EAP_NOOB_TYPE_2: dump_str = json_dumps(resp_obj, JSON_COMPACT|JSON_PRESERVE_ORDER); wpa_printf(MSG_DEBUG, "EAP-NOOB: ENTERING NOOB PROCESS TYPE 2 %s", dump_str); os_free(dump_str); eap_noob_rsp_type_two(data, resp_obj); break; case EAP_NOOB_TYPE_3: wpa_printf(MSG_DEBUG, "EAP-NOOB: ENTERING NOOB PROCESS TYPE 3"); eap_noob_rsp_type_three(data, resp_obj); break; case EAP_NOOB_TYPE_4: wpa_printf(MSG_DEBUG, "EAP-NOOB: ENTERING NOOB PROCESS TYPE 4"); eap_noob_rsp_type_four(data, resp_obj); break; case EAP_NOOB_TYPE_5: wpa_printf(MSG_DEBUG, "EAP-NOOB: ENTERING NOOB PROCESS TYPE 5"); eap_noob_rsp_type_five(data, resp_obj); break; case EAP_NOOB_TYPE_6: wpa_printf(MSG_DEBUG, "EAP-NOOB: ENTERING NOOB PROCESS TYPE 6"); eap_noob_rsp_type_six(data, resp_obj); break; case EAP_NOOB_TYPE_7: wpa_printf(MSG_DEBUG, "EAP-NOOB: ENTERING NOOB PROCESS TYPE 7"); eap_noob_rsp_type_seven(data, resp_obj); break; case EAP_NOOB_TYPE_8: wpa_printf(MSG_DEBUG, "EAP-NOOB: ENTERING NOOB PROCESS TYPE NoobId"); eap_noob_rsp_noobid(data, resp_obj); break; case NONE: wpa_printf(MSG_DEBUG, "EAP-NOOB: ERROR received"); eap_noob_decode_obj(data->peer_attr, resp_obj); if (FAILURE == eap_noob_db_functions(data,UPDATE_STATE_ERROR)) { wpa_printf(MSG_DEBUG,"Fail to Write Error to DB"); } eap_noob_set_done(data, DONE); eap_noob_set_success(data, FAILURE); break; } data->peer_attr->recv_msg = 0; json_decref(resp_obj); } static Boolean eap_noob_isDone(struct eap_sm *sm, void *priv) { struct eap_noob_server_context *data = priv; printf("DONE = %d\n",data->peer_attr->is_done); wpa_printf(MSG_DEBUG, "EAP-NOOB: IS Done? %d",(data->peer_attr->is_done == DONE)); return (data->peer_attr->is_done == DONE); } /** * eap_oob_isSuccess - Check EAP-NOOB was successful. * @sm: Pointer to EAP state machine allocated with eap_peer_sm_init() * @priv: Pointer to private EAP-NOOB data * Returns: True if EAP-NOOB is successful, False otherwise. **/ static Boolean eap_noob_isSuccess(struct eap_sm *sm, void *priv) { struct eap_noob_server_context *data = priv; wpa_printf(MSG_DEBUG, "EAP-NOOB: IS SUCCESS? %d",(data->peer_attr->is_success == SUCCESS)); return (data->peer_attr->is_success == SUCCESS); } /** * eap_noob_getKey : gets the msk if available * @sm : eap statemachine context * @priv : eap noob data * @len : msk len * Returns MSK or NULL **/ static u8 * eap_noob_getKey(struct eap_sm * sm, void * priv, size_t * len) { wpa_printf(MSG_DEBUG, "EAP-NOOB: GET KEY"); struct eap_noob_server_context *data = NULL; u8 *key = NULL; if (!priv || !sm || !len) return NULL; data = priv; if ((data->peer_attr->server_state != REGISTERED_STATE) || (!data->peer_attr->kdf_out->msk)) return NULL; //Base64Decode((char *)data->peer_attr->kdf_out->msk_b64, &data->peer_attr->kdf_out->msk, len); if (NULL == (key = os_malloc(MSK_LEN))) return NULL; *len = MSK_LEN; os_memcpy(key, data->peer_attr->kdf_out->msk, MSK_LEN); //memset(key,1,64); wpa_hexdump_ascii(MSG_DEBUG, "EAP-NOOB: MSK Derived", key, MSK_LEN); return key; } /** * eap_noob_get_session_id : gets the session id if available * @sm : eap statemachine context * @priv : eap noob data * @len : session id len * Returns Session Id or NULL **/ static u8 * eap_noob_get_session_id(struct eap_sm *sm, void *priv, size_t *len) { wpa_printf(MSG_DEBUG, "EAP-NOOB:Get Session ID called"); struct eap_noob_server_context *data = NULL; u8 *session_id = NULL; if (!priv || !sm || !len) return NULL; data = priv; if ((data->peer_attr->server_state != REGISTERED_STATE) || (!data->peer_attr->kdf_out->MethodId)) return NULL; if (NULL == (session_id = os_malloc(1 + METHOD_ID_LEN))) return NULL; *len = 1 + METHOD_ID_LEN; session_id[0] = EAP_TYPE_NOOB; os_memcpy(session_id + 1, data->peer_attr->kdf_out->MethodId, METHOD_ID_LEN); wpa_hexdump(MSG_DEBUG, "EAP-NOOB: Derived Session-Id", session_id, *len); return session_id; } /** * eap_noob_get_emsk : gets the msk if available * @sm : eap statemachine context * @priv : eap noob data * @len : msk len * Returns EMSK or NULL **/ static u8 * eap_noob_get_emsk(struct eap_sm * sm, void * priv, size_t * len) { struct eap_noob_server_context * data = NULL; u8 * emsk = NULL; wpa_printf(MSG_DEBUG, "EAP-NOOB:Get EMSK called"); if (!priv || !sm || !len) return NULL; data = priv; if ((data->peer_attr->server_state != REGISTERED_STATE) || (!data->peer_attr->kdf_out->emsk)) return NULL; if (NULL == (emsk = os_malloc(EAP_EMSK_LEN))) return NULL; os_memcpy(emsk, data->peer_attr->kdf_out->emsk, EAP_EMSK_LEN); if (emsk) { *len = EAP_EMSK_LEN; wpa_hexdump(MSG_DEBUG, "EAP-NOOB: Copied EMSK", emsk, EAP_EMSK_LEN); } else wpa_printf(MSG_DEBUG, "EAP-NOOB: Failed to fetch EMSK"); return emsk; } static int eap_noob_getTimeout(struct eap_sm *sm, void *priv) { //struct eap_oob_server_context *data = priv; printf("In function %s\n",__func__); /* Recommended retransmit times: retransmit timeout 5 seconds, * per-message timeout 15 seconds, i.e., 3 tries. */ sm->MaxRetrans = 0; /* total 3 attempts */ return 1; } /** * eap_noob_server_ctxt_alloc : Allocates the subcontexts inside the peer context * @sm : eap method context * @peer : server context * Returns : SUCCESS/FAILURE **/ static int eap_noob_server_ctxt_alloc(struct eap_sm * sm, struct eap_noob_server_context * data) { if (!data || !sm) return FAILURE; if (NULL == (data->peer_attr = \ os_zalloc(sizeof (struct eap_noob_peer_data)))) { return FAILURE; } if ((NULL == (data->server_attr = \ os_zalloc(sizeof (struct eap_noob_server_data))))) { return FAILURE; } if ((NULL == (data->peer_attr->ecdh_exchange_data = \ os_zalloc(sizeof (struct eap_noob_ecdh_key_exchange))))) { return FAILURE; } if ((NULL == (data->peer_attr->oob_data = \ os_zalloc(sizeof (struct eap_noob_oob_data))))) { return FAILURE; } if ((NULL == (data->peer_attr->kdf_out = \ os_zalloc(sizeof (struct eap_noob_ecdh_kdf_out))))) { return FAILURE; } if ((NULL == (data->peer_attr->kdf_nonce_data = \ os_zalloc(sizeof (struct eap_noob_ecdh_kdf_nonce))))) { return FAILURE; } return SUCCESS; } /** * eap_noob_server_ctxt_init -Supporting Initializer for EAP-NOOB Peer Method * Allocates memory for the EAP-NOOB data * @data: Pointer to EAP-NOOB data * @sm : eap method context **/ static int eap_noob_server_ctxt_init(struct eap_noob_server_context * data, struct eap_sm * sm) { char * NAI = NULL; int retval = FAILURE; if (FAILURE == eap_noob_server_ctxt_alloc(sm, data)) return FAILURE; data->peer_attr->server_state = UNREGISTERED_STATE; data->peer_attr->peer_state = UNREGISTERED_STATE; data->peer_attr->err_code = NO_ERROR; data->peer_attr->rcvd_params = 0; data->peer_attr->sleep_count = 0; /* Setup DB. DB file name for the server */ data->db_name = (char *) os_strdup(DB_NAME); if (server_conf.read_conf == 0 && FAILURE == eap_noob_read_config(data)) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Failed to initialize context"); return FAILURE; } if (sm->identity) { NAI = os_zalloc(sm->identity_len+1); if (NULL == NAI) { eap_noob_set_error(data->peer_attr, E1001); return FAILURE; } os_memcpy(NAI, sm->identity, sm->identity_len); strcat(NAI, "\0"); } if (SUCCESS == (retval = eap_noob_parse_NAI(data, NAI))) { if (!(retval = eap_noob_create_db(data))) goto EXIT; if (data->peer_attr->err_code == NO_ERROR) { data->peer_attr->next_req = eap_noob_get_next_req(data); } if (data->peer_attr->server_state == UNREGISTERED_STATE || data->peer_attr->server_state == RECONNECTING_STATE) { if (FAILURE == (retval = eap_noob_read_config(data))) goto EXIT; } } EXIT: EAP_NOOB_FREE(NAI); if (retval == FAILURE) wpa_printf(MSG_DEBUG, "EAP-NOOB: Failed to initialize context"); return retval; } /** * eap_noob_free_ctx : Free up all memory in server context * @data: Pointer to EAP-NOOB data **/ static void eap_noob_free_ctx(struct eap_noob_server_context * data) { if (NULL == data) return; wpa_printf(MSG_DEBUG, "EAP-NOOB: Entering %s", __func__); struct eap_noob_peer_data * peer = data->peer_attr; struct eap_noob_server_data * serv = data->server_attr; if (serv) { EAP_NOOB_FREE(serv->serverinfo); if (serv->server_config_params) { EAP_NOOB_FREE(serv->server_config_params->ServerName); EAP_NOOB_FREE(serv->server_config_params->ServerURL); os_free(serv->server_config_params); serv->server_config_params = NULL; } os_free(serv); serv = NULL; } if (peer) { EAP_NOOB_FREE(peer->PeerId); EAP_NOOB_FREE(peer->peerid_rcvd); EAP_NOOB_FREE(peer->peerinfo); EAP_NOOB_FREE(peer->peer_snum); EAP_NOOB_FREE(peer->mac); if (peer->kdf_nonce_data) { EAP_NOOB_FREE(peer->kdf_nonce_data->Np); EAP_NOOB_FREE(peer->kdf_nonce_data->nonce_peer_b64); EAP_NOOB_FREE(peer->kdf_nonce_data->Ns); //EAP_NOOB_FREE(peer->kdf_nonce_data->nonce_server_b64); os_free(peer->kdf_nonce_data); peer->kdf_nonce_data = NULL; } if (peer->ecdh_exchange_data) { EVP_PKEY_free(peer->ecdh_exchange_data->dh_key); EAP_NOOB_FREE(peer->ecdh_exchange_data->shared_key); EAP_NOOB_FREE(peer->ecdh_exchange_data->shared_key_b64); EAP_NOOB_FREE(peer->ecdh_exchange_data->x_peer_b64); EAP_NOOB_FREE(peer->ecdh_exchange_data->y_peer_b64); EAP_NOOB_FREE(peer->ecdh_exchange_data->x_b64); EAP_NOOB_FREE(peer->ecdh_exchange_data->y_b64); json_decref(peer->ecdh_exchange_data->jwk_serv); json_decref(peer->ecdh_exchange_data->jwk_peer); os_free(peer->ecdh_exchange_data); peer->ecdh_exchange_data = NULL; } if (peer->oob_data) { EAP_NOOB_FREE(peer->oob_data->Noob_b64); EAP_NOOB_FREE(peer->oob_data->NoobId_b64); os_free(peer->oob_data); peer->oob_data = NULL; } if (peer->kdf_out) { EAP_NOOB_FREE(peer->kdf_out->msk); EAP_NOOB_FREE(peer->kdf_out->emsk); EAP_NOOB_FREE(peer->kdf_out->amsk); EAP_NOOB_FREE(peer->kdf_out->MethodId); EAP_NOOB_FREE(peer->kdf_out->Kms); EAP_NOOB_FREE(peer->kdf_out->Kmp); EAP_NOOB_FREE(peer->kdf_out->Kz); os_free(peer->kdf_out); peer->kdf_out = NULL; } os_free(peer); peer = NULL; } if (SQLITE_OK != sqlite3_close_v2(data->server_db)) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Error closing DB"); char * sql_error = (char *)sqlite3_errmsg(data->server_db); if (sql_error != NULL) wpa_printf(MSG_DEBUG,"EAP-NOOB: SQL error : %s\n", sql_error); } EAP_NOOB_FREE(data->db_name); os_free(data); data = NULL; } /** * eap_oob_reset - Release/Reset EAP-NOOB data that is not needed. * @sm: Pointer to EAP state machine allocated with eap_peer_sm_init() * @priv: Pointer to private EAP-NOOB data **/ static void eap_noob_reset(struct eap_sm * sm, void * priv) { wpa_printf(MSG_DEBUG, "EAP-NOOB: RESET SERVER"); struct eap_noob_server_context *data = priv; eap_noob_free_ctx(data); } /** * eap_noob_init - Initialize the EAP-NOOB Peer Method * Allocates memory for the EAP-NOOB data * @sm: Pointer to EAP State Machine data **/ static void * eap_noob_init(struct eap_sm *sm) { struct eap_noob_server_context * data = NULL; wpa_printf(MSG_DEBUG, "EAP-NOOB: INIT SERVER"); if (NULL == (data = os_zalloc( sizeof (struct eap_noob_server_context)))) { wpa_printf(MSG_DEBUG, "EAP-NOOB: INIT SERVER Fail to Allocate Memory"); return NULL; } //TODO: check if hard coded initialization can be avoided if (FAILURE == eap_noob_server_ctxt_init(data,sm) && data->peer_attr->err_code == NO_ERROR) { wpa_printf(MSG_DEBUG,"EAP-NOOB: INIT SERVER Fail to initialize context"); eap_noob_free_ctx(data); return NULL; } return data; } /** * eap_server_noob_register - Register EAP-NOOB as a supported EAP peer method. * Returns: 0 on success, -1 on invalid method, or -2 if a matching EAP * method has already been registered **/ int eap_server_noob_register(void) { struct eap_method *eap = NULL; eap = eap_server_method_alloc(EAP_SERVER_METHOD_INTERFACE_VERSION, EAP_VENDOR_IETF, EAP_TYPE_NOOB, "NOOB"); if (eap == NULL) return -1; eap->init = eap_noob_init; eap->reset = eap_noob_reset; eap->buildReq = eap_noob_buildReq; eap->check = eap_noob_check; eap->process = eap_noob_process; eap->isDone = eap_noob_isDone; eap->getKey = eap_noob_getKey; eap->get_emsk = eap_noob_get_emsk; eap->isSuccess = eap_noob_isSuccess; eap->getSessionId = eap_noob_get_session_id; eap->getTimeout = eap_noob_getTimeout; return eap_server_method_register(eap); } <|start_filename|>nodejs/app/routes.js<|end_filename|> var base64url = require('base64url'); var crypto = require('crypto'); var sqlite3 = require('sqlite3').verbose(); var db; var common = require('../common'); var connMap = common.connMap; var configDB = require('../config/database.js'); var conn_str = configDB.dbPath; var rad_cli_path = configDB.radCliPath; var enableAC = parseInt(configDB.enableAccessControl,10); var OobRetries = parseInt(configDB.OobRetries,10); var noob_timeout = parseInt(configDB.NoobTimeout,10) * 1000; //converting to milliseconds var PythonShell = require('python-shell'); var fs = require('fs'); var lineReader = require('line-reader'); var parse = require('csv-parse'); var multer = require('multer'); var storage = multer.diskStorage({ destination: function (req, file, callback) { callback(null, './uploads'); }, filename: function (req, file, callback) { callback(null, file.fieldname +'.csv'); } }); //var sleep = require('sleep'); var upload = multer({ storage : storage}).single('logFile'); var url = require('url'); var state_array = ['Unregistered','OOB Waiting', 'OOB Received' ,'Reconnect Exchange', 'Registered']; var error_info = [ "No error", "Invalid NAI or peer state", "Invalid message structure", "Invalid data", "Unexpected message type", "Unexpected peer identifier", "Invalid ECDH key", "Unwanted peer", "State mismatch, user action required", "No mutually supported protocol version", "No mutually supported cryptosuite", "No mutually supported OOB direction", "MAC verification failure"]; module.exports = function(app, passport) { // ===================================== // HOME PAGE (with login links) ======== // ===================================== app.get('/', function(req, res) { res.render('index.ejs'); // load the index.ejs file }); // ===================================== // LOGIN =============================== // ===================================== app.get('/login', function(req, res) { // render the page and pass in any flash data if it exists //console.log(req.session.returnTo); res.render('login.ejs', { message: req.flash('loginMessage')}); }); app.get('/getDevices', isLoggedIn, function(req, res) { var device_info = req.query.DeviceInfo; var queryObject = url.parse(req.url,true).query; var len = Object.keys(queryObject).length; if(len != 1 || device_info == undefined) { console.log("Its wrong Query"); //res.json({"error":"Wrong Query."}); res.render('deviceAdd.ejs',{url : configDB.url}); }else{ var deviceDetails = new Array(); var i= 0; var parseJson; var devInfoParam = '%' + device_info + '%'; db = new sqlite3.Database(conn_str); db.all('SELECT p.PeerID, p.PeerInfo FROM peers_connected p where p.peerInfo LIKE ? AND p.serv_state = ? AND p.UserName IS NULL AND p.PeerID NOT IN (SELECT d.PeerID FROM devices d WHERE d.UserName = ?)', devInfoParam, 1,req.user.username, function(err,rows){ //check for error conditions too db.close(); if(!err){ rows.forEach(function(row) { deviceDetails[i] = new Object(); deviceDetails[i].peer_id = row.PeerID; parseJson= JSON.parse(row.PeerInfo); deviceDetails[i].peer_name = parseJson['Make']; deviceDetails[i].peer_num = parseJson['Serial']; deviceDetails[i].peer_ssid = parseJson['SSID']; deviceDetails[i].peer_bssid = parseJson['BSSID']; i++; }); console.log(JSON.stringify(deviceDetails)); res.send(JSON.stringify(deviceDetails)); }else{ console.log("Some error" + err); res.send(JSON.stringify(deviceDetails)); } }); } }); function noobTimeoutCallback (peer_id,noob_id) { console.log('Noob Timeout Called '+peer_id +" "+noob_id); db = new sqlite3.Database(conn_str); db.serialize(function() { var stmt = db.prepare("DELETE FROM devices WHERE PeerID = ? AND Hint = ?"); stmt.run(peer_id,noob_id); stmt.finalize(); }); db.close(); console.log('Noob Timeout Deleted the expired noob'); } app.get('/deletePeers',isLoggedIn,function(req, res) { console.log('Delete peers Called'); db = new sqlite3.Database(conn_str); db.serialize(function() { var stmt = db.prepare("DELETE FROM peers_connected where serv_state != 4 AND serv_state != 3"); stmt.run(); stmt.finalize(); }); db.close(); console.log('Deleted'); res.redirect('/profile'); }); app.post('/control', isLoggedIn, function(req, res) { var query = req._parsedUrl.query; var parts = query.split('&'); var userID; var deviceID; var contentType; var action; var tmpParts; tmpParts = parts[0].split('='); peerID = tmpParts[1]; db = new sqlite3.Database(conn_str); db.get('select deviceId from devicesSocket where peerId = ? AND userName = ?', peerID, req.user.username, function (err,row){ if(err || row == undefined || row.deviceId == undefined){ res.json({'status': 'fail'}); }else{ tmpParts = parts[1].split('='); contentType = tmpParts[1]; tmpParts = parts[2].split('='); action = tmpParts[1]; var softwareName = 'Text File'; var softwareList = []; // var content = base64_encode('file.txt'); // var content; var jsonData = { 'peerID': peerID, 'type': contentType, 'action': action, 'software_list': softwareList, 'software_name': softwareName }; console.log('Ready to send control json' + peerID); console.log(jsonData); connMap[row.deviceId].send(JSON.stringify(jsonData)); res.json({'status': 'success'}); } }); }); app.get('/insertDevice',isLoggedIn,function(req, res) { console.log("InsertDevice"+req); var peer_id = req.query.PeerId; var queryObject = url.parse(req.url,true).query; var len = Object.keys(queryObject).length; if(len != 1 || peer_id == undefined) { res.json({"status":"failed"}); }else{ console.log('req received'); db = new sqlite3.Database(conn_str); db.get('SELECT count(*) AS rowCount, PeerID, serv_state, PeerInfo, errorCode FROM peers_connected WHERE PeerID = ? AND UserName IS NULL', peer_id, function(err, row) { if (err){res.json({"status": "failed"});} else if(row.rowCount != 1) {console.log(row.length);res.json({"status": "refresh"});} else{ db.get('SELECT a.accessLevel AS al1, b.accessLevel AS al2 FROM roleAccessLevel a,fqdnACLevel b WHERE (b.fqdn = (SELECT NAS_id FROM radius WHERE user_name = ?) OR b.fqdn = (SELECT d.fqdn FROM roleBasedAC d WHERE calledSID = (SELECT called_st_id FROM radius WHERE user_name = ?))) and a.role = (SELECT c.role FROM users c WHERE username = ?)', peer_id,peer_id,req.user.username, function(err, row1) { if(err){res.json({"status": "failed"});} else if(enableAC == 0 || row1.al1 >= row1.al2){ var options = { mode: 'text', pythonPath: '/usr/bin/python', pythonOptions: ['-u'], scriptPath: configDB.ooblibPath, args: ['-i', peer_id, '-p', conn_str] }; console.log("Peer id is " + peer_id) var parseJ; PythonShell.run('oobmessage.py', options, function (err,results) { if (err){console.log("error" + err); res.json({"status": "failed"});} else{ parseJ = JSON.parse(results); var noob = parseJ['noob']; var hoob = parseJ['hoob']; var hash = crypto.createHash('sha256'); var hash_str = 'NoobId'+noob; hash.update(hash_str,'utf8'); var digest = new Buffer(hash.digest()); digest = digest.slice(0,16); var hint = base64url.encode(digest); db.get('INSERT INTO devices (PeerID, serv_state, PeerInfo, Noob, Hoob,Hint,errorCode, username) values(?,?,?,?,?,?,?,?)', peer_id, row.serv_state, row.PeerInfo, noob, hoob, hint.slice(0,32),0, req.user.username, function(err, row) { db.close(); if (err){console.log(err);res.json({"status": "failed"});} else { setTimeout(noobTimeoutCallback, noob_timeout, peer_id, hint.slice(0,32)); res.json({"status": "success"}); } }); } }); } else{res.json({"status":"deny"});} });} }); } }); app.get('/python',isLoggedIn, function(req, res) { // render the page and pass in any flash data if it exists //console.log(req.session.returnTo)i; var parseJ; PythonShell.run('oobmessage.py', options, function (err,results) { if (err) console.log (err); res.send("Its Successful"); //parseJ = JSON.parse(results); console.log('results:', results); }); }); // ===================================== // SIGNUP ============================== // ===================================== app.get('/signup', function(req, res) { res.render('signup.ejs', { message: req.flash('signupMessage') }); }); app.post('/logReport',function(req,res){ console.log("RECEIVED LOG"); upload(req,res,function(err) { if(err) { console.log("Error"+err); res.json({"status":"Error uploading file."}); } res.json({"src":"172.16.58.3"}); db = new sqlite3.Database(conn_str); db.serialize(function() { db.run("begin transaction"); //var stmt = db.prepare("insert into data values (?)"); // Three different methods of doing a bulk insert var inputFile = './uploads/logFile.csv' var parser = parse({delimiter: '\t'}, function (err, data) { // when all countries are available,then process them // note: array element at index 0 contains the row of headers that we should skip data.forEach(function(line) { // create country object out of parsed fields db.run("insert or ignore into logs (time,srcMAC,src,dst) values (?,?,?,?)", line[0],line[1],line[2],line[3]); //process.exit(1); console.log(line[3]); }); //sleep.sleep(30); fs.exists(inputFile, function(exists) { if(exists) { //Show in green console.log('File exists. Deleting now ...'); fs.unlink(inputFile); } else { //Show in red console.log('File not found, so not deleting.'); } }); }); // read the inputFile, feed the contents to the parser fs.createReadStream(inputFile).pipe(parser); db.run("commit"); }); }); }); /* app.post('/logReport', function(req, res) { //var file = req.files.file; console.log(req); console.log("Received"); res.json({"status":"Success"}); }); */ // ===================================== // PROFILE SECTION ===================== // ===================================== app.get('/profile', isLoggedIn, function(req, res) { var userDetails = new Array(); var PeerInfo_row, PeerInfo_j, PeerCount = 0; var d = new Date(); var seconds = Math.ceil(d.getTime() / 1000); var val = 0; var dev_status = ['Up to date','Update required','Obsolete', 'Update available!'] var deviceDetails = new Array(); var db; function callback(dDetails, Peers) { deviceDetails.push(dDetails); if (deviceDetails.length == Peers) { db.close(); res.render('profile.ejs', { user : req.user, userInfo :'', deviceInfo : deviceDetails, url : configDB.url, message: req.flash('profileMessage') }); } } db = new sqlite3.Database(conn_str); db.all('SELECT PeerId From UserDevices WHERE Username=?', req.user.username, function(err, rows0) { console.log('1'+rows0.length); if(rows0.length==0) { console.log('inside else added'); db.close(); res.render('profile.ejs', { user : req.user, userInfo :'', deviceInfo : '', url : configDB.url, message: req.flash('profileMessage') }); } else if(!err ) { rows0.forEach(function(row0) { db.all('SELECT PeerInfo From EphemeralState WHERE PeerId=?', row0.PeerId, function(err, rows1) { if (!err && rows1.length == 0) { db.all('SELECT PeerInfo From PersistentState WHERE PeerId=?', row0.PeerId, function(err, rows2) { if (!err && rows2.length == 0) { db.close(); console.log('inside2'); res.render('profile.ejs', { user : req.user, userInfo :'', deviceInfo : '', url : configDB.url, message: req.flash('profileMessage') }); } else if (rows2.length > 0) { console.log('inside 3'); deviceInfo = new Object(); deviceInfo.peer_id = row0.PeerId; PeerInfo_row = rows2; PeerInfo_j= JSON.parse(PeerInfo_row[0]['PeerInfo']); deviceInfo.peer_name = PeerInfo_j['Make']; deviceInfo.peer_num = PeerInfo_j['Serial']; callback(deviceInfo, rows0.length); } else{ console.log('inside else added'); db.close(); res.render('profile.ejs', { user : req.user, userInfo :'', deviceInfo : '', url : configDB.url, message: req.flash('profileMessage') }); } }); } else if (rows1.length > 0 ) { deviceInfo = new Object(); console.log('inside 4'); deviceInfo.peer_id = row0.PeerId; PeerInfo_row = rows1; PeerInfo_j= JSON.parse(PeerInfo_row[0]['PeerInfo']); deviceInfo.peer_name = PeerInfo_j['Make']; deviceInfo.peer_num = PeerInfo_j['Serial']; callback(deviceInfo, rows0.length); } else{ console.log('inside 5'); db.close(); res.render('profile.ejs', { user : req.user, userInfo :'', deviceInfo : '', url : configDB.url, message: req.flash('profileMessage') }); } }); }); } else{ console.log('inside else added'); db.close(); res.render('profile.ejs', { user : req.user, userInfo :'', deviceInfo : '', url : configDB.url, message: req.flash('profileMessage') }); } }); /* res.render('profile.ejs', { user : req.user, userInfo :'', deviceInfo : '', url : configDB.url, message: req.flash('profileMessage') }); */ }); //db.all('SELECT * from EphemeralState WHERE PeerId=?', row0.PeerId, function(err, rows1) { /* if(!err1){ db.close(); rows1.forEach(function(row1) { deviceDetails[j] = new Object(); deviceDetails[j].peer_id = row1.PeerID; parseJson1= JSON.parse(row1.PeerInfo); deviceDetails[j].peer_name = parseJson1['Make']; deviceDetails[j].peer_num = parseJson1['Serial']; //deviceDetails[j].dev_update = dev_status[parseInt(row1.DevUpdate)]; deviceDetails[j].noob = row1.Noob; deviceDetails[j].hoob = row1.Hoob; if(row1.errorCode){ deviceDetails[j].state_num = '0'; deviceDetails[j].state = error_info[parseInt(row.errorCode)]; } else{ deviceDetails[j].state = state_array[parseInt(row1.serv_state,10)]; deviceDetails[j].state_num = row1.serv_state; } deviceDetails[j].sTime = 150; j++; }); rows.forEach(function(row) { userDetails[i] = new Object(); userDetails[i].peer_id = row.PeerID; parseJson= JSON.parse(row.PeerInfo); userDetails[i].peer_num = parseJson['Serial']; userDetails[i].peer_name = parseJson['Make']; //userDetails[i].dev_update = dev_status[parseInt(row.DevUpdate)]; if(row.errorCode){ userDetails[i].state_num = '0'; userDetails[i].state = error_info[parseInt(row.errorCode)]; } else{ userDetails[i].state = state_array[parseInt(row.serv_state,10)]; userDetails[i].state_num = row.serv_state; } if(row.sleepTime) val = parseInt(row.sleepTime) - seconds; if(parseInt(row.serv_state) != 4){ val = 150; userDetails[i].sTime = val; }else{ userDetails[i].sTime = '0'; } i++; }); res.render('profile.ejs', { user : req.user, userInfo : userDetails, deviceInfo : deviceDetails, url : configDB.url, message: req.flash('profileMessage') // get the user out of session and pass to template }); else{ db.close(); res.render('profile.ejs', { user : req.user, userInfo : userDetails, deviceInfo : '', url : configDB.url, message: req.flash('profileMessage') // get the user out of session and pass to template }); } }); }else{ db.close(); res.render('profile.ejs', { user : req.user, userInfo :'', deviceInfo : '', url : configDB.url, message: req.flash('profileMessage') // get the user out of session and pass to template }); } //db.close(); }); //db.close(); }); */ // ===================================== // LOGOUT ============================== // ===================================== app.get('/logout', function(req, res) { req.logout(); res.redirect('/'); }); app.get('/addDevice',isLoggedIn, function(req, res) { res.render('deviceAdd.ejs',{url : configDB.url, user : req.user}); }); app.get('/accessControl',isLoggedIn, isAdmin, function(req, res) { res.render('accessControl.ejs',{url : configDB.url, user : req.user}); }); app.get('/manage',isLoggedIn, isAdmin, function(req, res) { var macs = new Array(); var ip = new Array(); var dest = new Array(); db = new sqlite3.Database(conn_str); db.all('SELECT DISTINCT srcMAC FROM logs', function(err, rows) { //db.close(); if (err){db.close();res.render('management.ejs',{url : configDB.url, user : req.user});} else { macs = rows; //console.log(macs.length); //console.log(macs[0].srcMAC); function ip_loop(row_num,col_num,col,row,count){ if(row >= row_num){res.render('management.ejs',{url : configDB.url, user : req.user, macs : macs, ips : ip, dests : dest}); return ;} db.all('SELECT time,dst FROM logs WHERE src = ?',ip[row][col].src,function(err,rows2){ if(err) {res.render('management.ejs',{url : configDB.url, user : req.user});return;} else{ dest [count] = new Array(); dest[count] = rows2; //console.log(rows2); //console.log(ip[row][col].src); count ++; col ++; if(col >= col_num){ row++; if(row >= row_num){ //console.log(ip) ; //console.log(dest); res.render('management.ejs',{url : configDB.url, user : req.user, macs : macs, ips : ip, dests : dest}); return; } col = 0; col_num = ip[row].length; } return ip_loop(row_num,col_num,col,row,count); } }); } function init_ip_loop(){ return ip_loop(macs.length,ip[0].length,0,0,0); } function macs_loop (low,max){ if(low >= max) return init_ip_loop(); db.all('SELECT DISTINCT src FROM logs WHERE srcMAC = ?',macs[low].srcMAC, function(err, rows1){ if (err){ res.render('management.ejs',{url : configDB.url, user : req.user});return; } else{ ip[low] = new Array(); ip[low] = rows1; //console.log(ip[low]); //console.log(low); low++; return macs_loop(low,macs.length); } }); } macs_loop(0,macs.length); db.close(); //console.log(macs); //res.render('management.ejs',{url : configDB.url, user : req.user, macs : macs, ips : ip, dests : dest}); } }); }); app.get('/configRadClients',isLoggedIn,isAdmin, function(req, res) { var radiusClients = new Array(); var j = 0; var splitStr = new Array(); lineReader.eachLine(rad_cli_path, function(line,last) { if(!line.startsWith('#')){ splitStr = line.split("\t"); radiusClients[j] = new Object(); radiusClients[j].ip_addr = splitStr[0]; radiusClients[j].secret = splitStr[1]; console.log(splitStr[0] + "," +splitStr[1]); j++; } if(last){ res.render('configRadClients.ejs',{url : configDB.url, clients : radiusClients}); } }); }); app.get('/saveRadClients',isLoggedIn,isAdmin, function(req, res) { //need to add length validation for all values console.log(req.query.RadiusClients); var clients = JSON.parse(req.query.RadiusClients); var queryObject = url.parse(req.url,true).query; var len = Object.keys(queryObject).length; if(len != 1 || clients == undefined) { res.json({"status":"failed"}); }else if(clients.length == 0){ var i = 0, n = clients.length; var str = "# RADIUS client configuration for the RADIUS server\n"; var stream = fs.createWriteStream(rad_cli_path); stream.once('open', function(fd) { stream.write(str); stream.end(); res.json({"status":"success"}); }); console.log(str); }else{ var i = 0, n = clients.length; var str = "# RADIUS client configuration for the RADIUS server\n"; for (i = 0; i<n; i++){ str += clients[i].ip_addr + "\t" + clients[i].secret + "\n"; } var stream = fs.createWriteStream("/home/shiva/Desktop/eap-noob/hostapd-2.5/hostapd/hostapd.radius_clients"); stream.once('open', function(fd) { stream.write(str); stream.end(); res.json({"status":"success"}); }); console.log(str); } }); // process the signup form app.post('/signup', passport.authenticate('local-signup', { successRedirect : '/profile', // redirect to the secure profile section failureRedirect : '/signup', // redirect back to the signup page if there is an error failureFlash : true // allow flash messages })); // process the login form app.post('/login', passport.authenticate('local-login', { failureRedirect : '/login', // redirect back to the signup page if there is an error failureFlash : true // allow flash messages }),function (req, res) { if(req.session.returnTo){ res.redirect(req.session.returnTo || '/'); delete req.session.returnTo; }else{ //setTimeout(myFunc, 1500, 'funky', 'fun'); //console.log("Here called"); res.redirect('/profile'); } }); app.get('/regLater', function (req, res) { console.log("Called Later"); if(req.session.returnTo){ var queryObject = url.parse(req.session.returnTo,true).query; delete req.session.returnTo; var peer_id = queryObject["PeerId"]; var noob = queryObject["Noob"]; var hoob = queryObject["Hoob"]; if(Object.keys(queryObject).length != 3 || peer_id == undefined || noob == undefined || hoob == undefined){ req.flash('loginMessage','Wrong OOB query!'); res.redirect('/login'); }else if(noob.length != 22 || hoob.length != 22){ console.log("Updating Error!!!" + peer_id); db = new sqlite3.Database(conn_str); db.serialize(function() { var stmt = db.prepare("UPDATE peers_connected SET OOB_RECEIVED_FLAG = ?, Noob = ?, Hoob = ?, errorCode = ?, serv_state = ? WHERE PeerID = ?"); stmt.run(1234,"","",3,2,peer_id); stmt.finalize(); }); db.close(); req.flash('loginMessage','Invalid Data'); res.redirect('/login'); }else{ db.serialize(function() { var stmt = db.prepare("UPDATE peers_connected SET OOB_RECEIVED_FLAG = ?, Noob = ?, Hoob = ?, serv_state = ? WHERE PeerID = ?"); stmt.run(1234,noob,hoob,2,peer_id); stmt.finalize(); }); db.close(); req.flash('loginMessage','Received Successfully'); res.redirect('/login'); } }else{ req.flash('loginMessage','Wrong OOB query!'); res.redirect('/login'); } }); function myFunc (arg1,arg2) { console.log('arg was => ' + arg1 + arg2); } // process QR-code app.get('/sendOOB/',isLoggedIn, function (req, res) { var peer_id = req.query.P; var noob = req.query.N; var hoob = req.query.H; var queryObject = url.parse(req.url,true).query; var len = Object.keys(queryObject).length; var options; var hash; var hash_str; var hint; if(len != 3 || peer_id == undefined || noob == undefined || hoob == undefined) { req.flash('profileMessage','Wrong query String! Please try again with proper Query!!' ); res.redirect('/profile'); } else if(noob.length != 22 || hoob.length != 22){ console.log("Updating Error!!!" + peer_id); db = new sqlite3.Database(conn_str); db.serialize(function() { var stmt = db.prepare("UPDATE EphemeralState SET ErrorCode = ? WHERE PeerID = ?"); stmt.run(3,peer_id); stmt.finalize(); req.flash('profileMessage','Invalid Data'); res.redirect('/profile'); }); db.close(); } else { //console.log(peer_id +' '+ noob +' ' + hoob); hash = crypto.createHash('sha256'); hash_str = 'NoobId'+noob; hash.update(hash_str,'utf8'); var digest = new Buffer(hash.digest()); digest = digest.slice(0,16); hint = base64url.encode(digest); options = { mode: 'text', pythonPath: '/usr/bin/python', pythonOptions: ['-u'], scriptPath: configDB.ooblibPath, args: ['-i', peer_id, '-p', conn_str,'-n', noob,'-t', OobRetries, '-r',hoob] }; db = new sqlite3.Database(conn_str); db.get('SELECT a.accessLevel AS al1, b.accessLevel AS al2 FROM roleAccessLevel a,fqdnACLevel b WHERE (b.fqdn = (SELECT NAS_id FROM radius WHERE user_name = ?) OR b.fqdn = (SELECT d.fqdn FROM roleBasedAC d WHERE calledSID = (SELECT called_st_id FROM radius WHERE user_name = ?))) and a.role = (SELECT c.role FROM users c WHERE username = ?)', peer_id,peer_id,req.user.username, function(err, row1) { if(err){res.json({"ProfileMessage": "Failed because of Error!"});} else if(enableAC == 0 || row1.al1 >= row1.al2){ db.get('SELECT ServerState, ErrorCode FROM EphemeralState WHERE PeerId = ?', peer_id, function(err, row2) { db.get('SELECT count(*) as rowCount FROM EphemeralNoob WHERE PeerId = ?', peer_id, function(err, row3) { if (!row2 || row3.rowCount != 0){req.flash('profileMessage','Some Error contact admin!');res.redirect('/profile');console.log("Internal Error");} else if(row2.error_code) {req.flash('profileMessage','Error: ' + error_info[parseInt(row2.errorCode)] +'!!');res.redirect('/profile');console.log("Error" + row2.errorCode);} else if(parseInt(row2.ServerState) != 1) {req.flash('profileMessage','Error: state mismatch. Reset device');res.redirect('/profile');console.log("state mismatch");} else { var parseJ; var err_p; var hoob_cmp_res; console.log("HOOB="+hoob); console.log("NOOB="+noob); PythonShell.run('oobmessage.py', options, function (err_pr,results) { if (err_pr){console.log("Error in python:" + err_pr); res.json({"status": "Internal error !!"});} else{ parseJ = JSON.parse(results); err_p = parseJ['err']; hoob_cmp_res = parseJ['res']; if(hoob_cmp_res != '8001'){ if(hoob_cmp_res == '8000'){ req.flash('profileMessage','Max OOB tries reaches!'); res.redirect('/profile'); console.log("Max tries reached"); }else{ req.flash('profileMessage','Wrong OOB received!'); res.redirect('/profile'); console.log(" Unrecognized Hoob received Here"+hoob_cmp_res); } }else{ db.serialize(function() { var stmt = db.prepare("INSERT INTO EphemeralNoob(PeerId, NoobId, Noob, sent_time) VALUES(?,?,?,?)"); stmt.run(peer_id, hint, noob, 1234); stmt.finalize(); }); db.serialize(function() { var stmt = db.prepare("UPDATE EphemeralState SET ServerState= ? WHERE PeerId = ?"); stmt.run(2, peer_id); stmt.finalize(); }); db.serialize(function() { var stmt = db.prepare("INSERT INTO UserDevices(Username, PeerId) VALUES(?,?)"); stmt.run(req.user.username, peer_id); stmt.finalize(); }); db.close(); req.flash('profileMessage','Message Received Successfully'); res.redirect('/profile'); } } }); } }); }); } else{req.flash('profileMessage','Access denied! Please contact admin.'); res.redirect('/profile'); } }); } }); app.get('/stateUpdate',isLoggedIn, function(req, res) { var peer_id = req.query.PeerId; var state = req.query.State; var queryObject = url.parse(req.url,true).query; var len = Object.keys(queryObject).length; if(len != 2 || peer_id == undefined || state == undefined) { console.log("Its wrong Query"); res.json({"error":"Wrong Query."}); }else{ console.log('req received'); db = new sqlite3.Database(conn_str); db.get('SELECT serv_state,errorCode FROM peers_connected WHERE PeerID = ?', peer_id, function(err, row) { db.close(); if (!row){res.json({"state": "No record found.","state_num":"0"});} else if(row.errorCode) { res.json({"state":error_info[parseInt(row.errorCode)], "state_num":"0"}); console.log(row.errorCode) } else if(parseInt(row.serv_state) == parseInt(state)) {res.json({"state":""});} else {res.json({"state": state_array[parseInt(row.serv_state)], "state_num": row.serv_state});} }); } }); app.get('/deleteDeviceTemp',isLoggedIn, function(req, res) { var peer_id = req.query.PeerId; var queryObject = url.parse(req.url,true).query; var len = Object.keys(queryObject).length; console.log(req.user.username + " " + peer_id); if(len != 1 || peer_id == undefined) { res.json({"status":"failed"}); }else{ console.log('req received'); db = new sqlite3.Database(conn_str); db.get('SELECT count(*) AS rowCount FROM devices WHERE PeerID = ? AND UserName = ?', peer_id, req.user.username, function(err, row) { console.log(req.user.username + " " + peer_id); if (err){res.json({"status": "failed"});} else if(row.rowCount != 1) {res.json({"status": "refresh"});} else { db.get('DELETE FROM devices WHERE PeerID = ? AND UserName = ?', peer_id, req.user.username, function(err, row) { db.close(); if (err){res.json({"status": "failed"});} else {res.json({"status": "success"});} }); } }); } }); app.get('/deleteDevice', function(req, res) { //console.log(req); var peer_id = req.query.PeerId; var queryObject = url.parse(req.url,true).query; var len = Object.keys(queryObject).length; if(len != 1 || peer_id == undefined) { res.json({"status":"failed"}); }else{ console.log('req received'); db = new sqlite3.Database(conn_str); db.get('SELECT count(*) AS rowCount FROM peers_connected WHERE PeerID = ?', peer_id, function(err, row) { if (err){res.json({"status": "failed"});} else if(row.rowCount != 1) {res.json({"status": "refresh"});} else { db.get('DELETE FROM peers_connected WHERE PeerID = ?', peer_id, function(err, row) { db.close(); if (err){res.json({"status": "failed"});} else {res.json({"status": "success"});} }); } }); } }); }; // route middleware to make sure a user is logged in function isLoggedIn(req, res, next) { //console.log("called islogged"); // if user is authenticated in the session, carry on if (req.isAuthenticated()) return next(); var str = req.path; var peer_id = req.query.P; var noob = req.query.N; var hoob = req.query.H; if(str == "/sendOOB/") req.flash('loginMessage','Login to register device'); if(peer_id != undefined) str = str + '?P=' + peer_id; if(noob != undefined) str = str + '&N=' + noob; if(hoob != undefined) str = str + '&H=' + hoob; req.session.returnTo = str; res.redirect('/login'); } // route middleware to make sure a user is admin function isAdmin(req, res, next) { //console.log("Called is Admin " + req.user.isAdmin + req.user.username); // if user is authenticated and is admin, carry on if (req.user.isAdmin == "TRUE") return next(); res.redirect('/profile'); } <|start_filename|>nodejs/server.js<|end_filename|> // server.js // set up ====================================================================== // get all the tools we need var express = require('express'); var app = express(); var port = process.env.PORT || 8080; var passport = require('passport'); var flash = require('connect-flash'); var morgan = require('morgan'); var cookieParser = require('cookie-parser'); var bodyParser = require('body-parser'); var session = require('express-session'); var sqlite3 = require('sqlite3').verbose(); var db; var configDB = require('./config/database.js'); var conn_str = configDB.dbPath; var common = require('./common'); var connMap = common.connMap; var fs = require('fs'); var https = require('https'); var options = { key: fs.readFileSync('./ssl/server.key'), cert: fs.readFileSync('./ssl/server.crt'), ca: fs.readFileSync('./ssl/ca.crt'), requestCert: true, rejectUnauthorized: false }; var WebSocketServer = require('ws').Server; var ws = require('nodejs-websocket'); var property = { secure:true, key: fs.readFileSync('./ssl/server.key'), cert: fs.readFileSync('./ssl/server.crt'), ca: fs.readFileSync('./ssl/ca.crt'), requestCert: true, rejectUnauthorized: false }; var server = ws.createServer(property, function (conn) { console.log("==== WebSocket Connection ===="); console.log("New connection requested to: " + conn.path); console.log(conn.path); var connectionID = conn.path.substring(1); console.log(connectionID); connMap[1] = conn; conn.on('close', function (code, reason) { console.log("WebSocket connection closed"); }); // parse received text conn.on('text', function(str) { console.log('WebSocket received text'); console.log(str); msg = JSON.parse(str); if(msg['type'] == "softwareUpdated"){ console.log("Updated received"); var serverDB = new sqlite3.Database(conn_str); //query = 'UPDATE peers_connected set DevUpdate = 0 where PeerId = ?'; // serverDB.run(query, msg['peerId']); } }); var deviceID; var serverDB = new sqlite3.Database(conn_str); serverDB.get('select UserName, PeerID from peers_connected where PeerID = ? AND serv_state = 4', connectionID, function(err, row) { console.log('DeviceID: ' + row.PeerID); if (!err && row != null) { var query = 'INSERT OR IGNORE INTO devicesSocket (peerId,userName) VALUES ("' + row.PeerID + '","' + row.UserName + '")'; var peer_id = row.PeerID; serverDB.run(query, function(err1,data){ if(err1){ console.log("error" + err1); }else{ serverDB.get('select deviceId from devicesSocket where peerId = ?', peer_id, function (err2,data1){ //query = 'UPDATE peers_connected set DevUpdate = 3 where PeerId = "' + peer_id + '"'; // serverDB.run(query); if (data1 != undefined) { console.log("inserted: " + data1.deviceId); connMap[data1.deviceId] = conn; } else { console.log('ERROR: ' + err); } }); } }); }}); }).listen(9000); app.use(express.static(__dirname + '/public')); require('./config/passport')(passport); // pass passport for configuration // set up our express application app.use(morgan('dev')); // log every request to the console app.use(cookieParser()); // read cookies (needed for auth) // get information from html forms app.use(bodyParser.urlencoded({ extended: true })); app.use(bodyParser.json()); app.set('view engine', 'ejs'); // set up ejs for templating // required for passport app.use(session({ secret: 'herehereherehrehrerherherherherherherherhe' })); // session secret app.use(passport.initialize()); app.use(passport.session()); // persistent login sessions app.use(flash()); // use connect-flash for flash messages stored in session // routes ====================================================================== require('./app/routes.js')(app, passport); // load our routes and pass in our app and fully configured passport // launch ====================================================================== db = new sqlite3.Database(conn_str); db.serialize(function() { db.run('DROP TABLE IF EXISTS roles'); db.run('DROP TABLE IF EXISTS roleAccessLevel'); db.run('DROP TABLE IF EXISTS fqdnACLevel'); db.run('DROP TABLE IF EXISTS roleBasedAC'); db.run('DROP TABLE IF EXISTS devicesSocket'); //db.run('DROP TABLE IF EXISTS logs'); //db.run('DROP TABLE IF EXISTS users'); //db.run('UPDATE OR IGNORE peers_connected set DevUpdate = 0'); db.run('CREATE TABLE IF NOT EXISTS devicesSocket ( deviceId INTEGER PRIMARY KEY AUTOINCREMENT, peerId TEXT, userName TEXT, UNIQUE(peerId));'); db.run('CREATE TABLE IF NOT EXISTS logs ( id INTEGER PRIMARY KEY AUTOINCREMENT, time TEXT, srcMAC TEXT, src TEXT, dst TEXT, UNIQUE(srcMAC,dst));'); db.run('CREATE TABLE IF NOT EXISTS roles ( role_id INTEGER PRIMARY KEY, roleDesc TEXT);'); db.run('INSERT INTO roles VALUES (1,"Student")'); db.run('INSERT INTO roles VALUES (2, "Professor")'); db.run('INSERT INTO roles VALUES (3, "Admin")'); db.run('CREATE TABLE IF NOT EXISTS roleAccessLevel ( id INTEGER PRIMARY KEY AUTOINCREMENT, role INTEGER, accessLevel INTEGER, FOREIGN KEY(role) REFERENCES roles(role_id));'); db.run('INSERT INTO roleAccessLevel(role,accessLevel) VALUES (1, 1)'); db.run('INSERT INTO roleAccessLevel(role,accessLevel) VALUES (2, 2)'); db.run('INSERT INTO roleAccessLevel(role,accessLevel) VALUES (3, 4)'); db.run('CREATE TABLE IF NOT EXISTS fqdnACLevel (id INTEGER PRIMARY KEY AUTOINCREMENT, fqdn TEXT, accessLevel INTEGER, FOREIGN KEY(accessLevel) REFERENCES roleAccessLevel(accessLevel))'); db.run('INSERT INTO fqdnACLevel(fqdn,accessLevel) VALUES ("iot.aalto.fi", 2)'); db.run('INSERT INTO fqdnACLevel(fqdn,accessLevel) VALUES ("guest.aalto.fi", 1)'); db.run('CREATE TABLE IF NOT EXISTS roleBasedAC ( id INTEGER PRIMARY KEY AUTOINCREMENT, calledSID TEXT, fqdn TEXT, FOREIGN KEY (fqdn) REFERENCES fqdnACLevel(fqdn));'); db.run('INSERT INTO roleBasedAC(calledSID,fqdn) VALUES ("6C-19-8F-83-C2-90:Noob2","iot.aalto.fi")'); db.run('INSERT INTO roleBasedAC(calledSID,fqdn) VALUES ("6C-19-8F-83-C2-80:Noob1","guest.aalto.fi")'); db.run('CREATE TABLE IF NOT EXISTS radius (called_st_id TEXT, calling_st_id TEXT, NAS_id TEXT, user_name TEXT PRIMARY KEY);'); db.run('CREATE TABLE IF NOT EXISTS users ( id INTEGER PRIMARY KEY AUTOINCREMENT, username TEXT, password <PASSWORD>, role INTEGER DEFAULT 1, isAdmin BOOLEAN DEFAULT FALSE, FOREIGN KEY(role) REFERENCES roles(role_id) );'); db.run('CREATE TABLE IF NOT EXISTS devices (PeerID TEXT, serv_state INTEGER, PeerInfo TEXT, Noob TEXT, Hoob TEXT, Hint TEXT,errorCode INTEGER ,UserName TEXT, PRIMARY KEY (PeerID, UserName));'); db.run('CREATE TABLE IF NOT EXISTS UserDevices (Username TEXT, PeerId TEXT);'); db.close(); }); https.createServer(options, app).listen(8080, function () { console.log('Started!'); }); //app.listen(port); //console.log('App is running on port ' + port); <|start_filename|>hostapd-2.6/src/eap_server/eap_server_noob.h<|end_filename|> #ifndef EAPOOB_H #define EAPOOB_H #include <stdint.h> #include <unistd.h> #include <sqlite3.h> #include <jansson.h> #include <time.h> /* Configuration file */ #define CONF_FILE "eapnoob.conf" /** * All the pre-processors of EAP-NOOB **/ #define RESERVED_DOMAIN "eap-noob.net" #define VERSION_ONE 1 #define SUITE_ONE 1 #define NOOBID_LEN 16 #define NOOB_LEN 16 #define NONCE_LEN 32 #define ECDH_SHARED_SECRET_LEN 32 #define ALGORITHM_ID "EAP-NOOB" #define ALGORITHM_ID_LEN 8 /* MAX values for fields */ #define MAX_SUP_VER 3 #define MAX_SUP_CSUITES 10 #define MAX_CONF_LEN 500 #define MAX_INFO_LEN 500 #define MAX_PEERID_LEN 22 #define MAX_LINE_SIZE 1000 #define KDF_LEN 320 #define MSK_LEN 64 #define EMSK_LEN 64 #define AMSK_LEN 64 #define KZ_LEN 32 #define KMS_LEN 32 #define KMP_LEN 32 #define MAC_LEN 32 #define MAX_X25519_LEN 48 #define HASH_LEN 16 #define METHOD_ID_LEN 32 /* Valid or Invalid states */ #define INVALID 0 #define VALID 1 #define NUM_OF_STATES 5 #define MAX_MSG_TYPES 8 /* OOB DIRECTIONS */ #define PEER_TO_SERVER 1 #define SERVER_TO_PEER 2 #define BOTH_DIRECTIONS 3 #define SUCCESS 1 #define FAILURE -1 #define EMPTY 0 #define DONE 1 #define NOT_DONE 0 /* Maximum allowed waiting exchages */ #define MAX_WAIT_EXCHNG_TRIES 5 /* keywords for json encoding and decoding */ #define TYPE "Type" #define ERRORINFO "ErrorInfo" #define ERRORCODE "ErrorCode" #define VERS "Vers" #define CRYPTOSUITES "Cryptosuites" #define DIRS "Dirs" #define NS "Ns" #define NS2 "Ns2" #define SLEEPTIME "SleepTime" #define PEERID "PeerId" #define PKS "PKs" #define SERVERINFO "ServerInfo" #define MACS "MACs" #define MACS2 "MACs2" #define PEERINFO_SERIAL "Serial" //#define PEERINFO_TYPE "Type" //#define PEERINFO_MAKE "Make" #define VERP "Verp" #define CRYPTOSUITEP "Cryptosuitep" #define DIRP "Dirp" #define NP "Np" #define NP2 "Np2" #define PKP "PKp" #define PEERINFO "PeerInfo" //#define PEERSTATE "state" #define NOOBID "NoobId" #define MACP "MACp" #define MACP2 "MACp2" #define X_COORDINATE "x" #define Y_COORDINATE "y" #define KEY_TYPE "kty" #define CURVE "crv" #define REALM "Realm" #define SERVERINFO_NAME "Name" #define SERVERINFO_URL "Url" #define ECDH_KDF_MAX (1 << 30) #define PEERID_RCVD 0x0001 #define DIRP_RCVD 0x0002 #define CRYPTOSUITEP_RCVD 0x0004 #define VERSION_RCVD 0x0008 #define NONCE_RCVD 0x0010 #define MAC_RCVD 0x0020 #define PKEY_RCVD 0x0040 #define INFO_RCVD 0x0080 #define STATE_RCVD 0x0100 #define MINSLP_RCVD 0x0200 #define SERVER_NAME_RCVD 0x0400 #define SERVER_URL_RCVD 0x0800 #define NOOBID_RCVD 0x1000 #define WE_COUNT_RCVD 0x2000 #define REALM_RCVD 0x4000 #define ENCODE_RCVD 0x8000 #define TYPE_ONE_PARAMS (PEERID_RCVD|VERSION_RCVD|CRYPTOSUITEP_RCVD|DIRP_RCVD|INFO_RCVD) #define TYPE_TWO_PARAMS (PEERID_RCVD|NONCE_RCVD|PKEY_RCVD) #define TYPE_THREE_PARAMS (PEERID_RCVD) #define TYPE_FOUR_PARAMS (PEERID_RCVD|MAC_RCVD) #define TYPE_FIVE_PARAMS (PEERID_RCVD|CRYPTOSUITEP_RCVD|INFO_RCVD) #define TYPE_SIX_PARAMS (PEERID_RCVD|NONCE_RCVD) #define TYPE_SEVEN_PARAMS (PEERID_RCVD|MAC_RCVD) #define TYPE_EIGHT_PARAMS (PEERID_RCVD|NOOBID_RCVD) #define CONF_PARAMS (DIRP_RCVD|CRYPTOSUITEP_RCVD|VERSION_RCVD|SERVER_NAME_RCVD|SERVER_URL_RCVD|WE_COUNT_RCVD|REALM_RCVD|ENCODE_RCVD) #define DB_NAME "/etc/peer_connection_db" #define DEVICE_TABLE "devices" #define CREATE_TABLES_EPHEMERALSTATE \ "CREATE TABLE IF NOT EXISTS EphemeralState( \ PeerId TEXT PRIMARY KEY, \ Verp INTEGER NOT NULL, \ Cryptosuitep INTEGER NOT NULL, \ Realm TEXT, \ Dirp INTEGER, \ PeerInfo TEXT, \ Ns BLOB, \ Np BLOB, \ Z BLOB, \ MacInput TEXT, \ CreationTime BIGINT, \ ErrorCode INTEGER, \ SleepCount INTEGER, \ ServerState INTEGER); \ \ CREATE TABLE IF NOT EXISTS EphemeralNoob( \ PeerId TEXT NOT NULL REFERENCES EphemeralState(PeerId), \ NoobId TEXT NOT NULL, \ Noob TEXT NOT NULL, \ sent_time BIGINT NOT NULL, \ UNIQUE(Peerid,NoobId));" #define CREATE_TABLES_PERSISTENTSTATE \ "CREATE TABLE IF NOT EXISTS PersistentState( \ PeerId TEXT NOT NULL PRIMARY KEY, \ Verp INTEGER NOT NULL CHECK (Verp=1), \ Cryptosuitep INTEGER NOT NULL, \ Realm TEXT, \ Kz BLOB NOT NULL, \ ServerState INT, \ PeerInfo TEXT, \ CreationTime BIGINT, \ last_used_time BIGINT);" #define CREATE_TABLES_RADIUS \ "CREATE TABLE IF NOT EXISTS radius( \ called_st_id TEXT, \ calling_st_id TEXT, \ NAS_id TEXT, \ user_name TEXT PRIMARY KEY)" #define DELETE_EPHEMERAL_FOR_PEERID \ "DELETE FROM EphemeralNoob WHERE PeerId=?; \ DELETE FROM EphemeralState WHERE PeerId=?;" #define DELETE_EPHEMERAL_FOR_ALL \ "DELETE FROM EphemeralNoob; \ DELETE FROM EphemeralState;" #define QUERY_EPHEMERALSTATE \ "SELECT * FROM EphemeralState WHERE PeerId=?;" #define QUERY_EPHEMERALNOOB \ "SELECT * FROM EphemeralNoob \ WHERE PeerId=?;"//AND NoobId=?;" #define QUERY_PERSISTENTSTATE \ "SELECT * FROM PersistentState WHERE PeerId=?;" #define EAP_NOOB_FREE(_D) \ if (_D) { \ os_free(_D); \ (_D) = NULL; \ } /* Flag used during KDF and MAC generation */ enum {COMPLETION_EXCHANGE, RECONNECT_EXCHANGE, RECONNECT_EXCHANGE_NEW}; enum {UNREGISTERED_STATE, WAITING_FOR_OOB_STATE, OOB_RECEIVED_STATE, RECONNECTING_STATE, REGISTERED_STATE}; enum {NONE, EAP_NOOB_TYPE_1, EAP_NOOB_TYPE_2, EAP_NOOB_TYPE_3, EAP_NOOB_TYPE_4, EAP_NOOB_TYPE_5, EAP_NOOB_TYPE_6, EAP_NOOB_TYPE_7, EAP_NOOB_TYPE_8}; enum {UPDATE_PERSISTENT_STATE, UPDATE_STATE_MINSLP, UPDATE_PERSISTENT_KEYS_SECRET, UPDATE_STATE_ERROR, UPDATE_INITIALEXCHANGE_INFO, GET_NOOBID}; enum eap_noob_err_code{NO_ERROR, E1001, E1002, E1003, E1004, E1005, E1006, E1007, E2001, E2002, E3001, E3002, E3003, E4001}; enum {HOOB_TYPE, MACS_TYPE, MACP_TYPE}; enum sql_datatypes {TEXT, INT, UNSIGNED_BIG_INT, BLOB,}; struct eap_noob_global_conf { int read_conf; int max_we_count; char * realm; int len_realm; int oob_encode; }; struct eap_noob_ecdh_kdf_out { u8 * msk; u8 * emsk; u8 * amsk; u8 * MethodId; u8 * Kms; u8 * Kmp; u8 * Kz; }; struct eap_noob_ecdh_kdf_nonce { u8 * Ns; u8 * Np; char * nonce_peer_b64; //Can be removed }; struct eap_noob_oob_data { char * Noob_b64; char * NoobId_b64; time_t sent_time; }; struct eap_noob_ecdh_key_exchange { EVP_PKEY * dh_key; char * x_peer_b64; char * y_peer_b64; char * x_b64; size_t x_len; char * y_b64; size_t y_len; json_t * jwk_serv; json_t * jwk_peer; u8 * shared_key; char * shared_key_b64; size_t shared_key_b64_len; }; struct eap_noob_peer_data { u32 version; u32 cryptosuite; u32 dir; u32 sleeptime; u32 recv_msg; u32 rcvd_params; u32 sleep_count; int oob_recv; u8 peer_state; u8 server_state; u8 next_req; u8 is_done; u8 is_success; char * peerid_rcvd; char * PeerId; char * peerinfo; char * peer_snum; /* Only set, not used */ char * mac; Boolean record_present; Boolean noobid_required; enum eap_noob_err_code err_code; time_t last_used_time; struct eap_noob_ecdh_key_exchange * ecdh_exchange_data; struct eap_noob_oob_data * oob_data; struct eap_noob_ecdh_kdf_nonce * kdf_nonce_data; struct eap_noob_ecdh_kdf_out * kdf_out; json_t * mac_input; char * mac_input_str; char * Realm; u8 * Z; u8 * Ns; u8 * Np; u8 * Kz; time_t creation_time; }; struct eap_noob_server_config_params { char * ServerName; char * ServerURL; }; struct eap_noob_server_data { u32 version[MAX_SUP_VER]; u32 cryptosuite[MAX_SUP_CSUITES]; u32 dir; char * serverinfo; u32 config_params; struct eap_noob_server_config_params * server_config_params; }; struct eap_noob_server_context { struct eap_noob_peer_data * peer_attr; struct eap_noob_server_data * server_attr; char * db_name; sqlite3 * server_db; }; const int error_code[] = {0, 1001, 1002, 1003, 1004, 1005, 1006, 1007, 2001, 2002, 3001, 3002, 3003, 4001}; const char *error_info[] = { "No error", "Invalid NAI or peer state", "Invalid message structure", "Invalid data", "Unexpected message type", "Unexpected peer identifier", "Unrecognized OOB message identifier", "Invalid ECDH key", "Unwanted peer", "State mismatch, user action required", "No mutually supported protocol version", "No mutually supported cryptosuite", "No mutually supported OOB direction", "MAC verification failure" }; /* This 2-D arry is used for state validation. * Cloumn number represents the state of Peer and the row number * represents the server state * The states are in squence as: {UNREGISTERED_STATE, WAITING_FOR_OOB_STATE, * OOB_RECEIVED_STATE, RECONNECTING_STATE, REGISTERED_STATE} * for both peer and server */ const int state_machine[][5] = { {VALID, INVALID, INVALID, INVALID, INVALID}, {VALID, VALID, VALID, INVALID, INVALID}, {VALID, VALID, VALID, INVALID, INVALID}, {VALID, INVALID, INVALID, VALID, VALID}, {VALID, INVALID, INVALID, VALID, INVALID} }; const int next_request_type[] = { EAP_NOOB_TYPE_1, NONE, NONE, NONE, NONE, EAP_NOOB_TYPE_1, EAP_NOOB_TYPE_3, EAP_NOOB_TYPE_4, NONE, NONE, EAP_NOOB_TYPE_1, EAP_NOOB_TYPE_4, EAP_NOOB_TYPE_4, NONE, NONE, EAP_NOOB_TYPE_1, NONE, NONE, EAP_NOOB_TYPE_5, EAP_NOOB_TYPE_5, EAP_NOOB_TYPE_1, NONE, NONE, EAP_NOOB_TYPE_5, NONE }; /*server state vs message type matrix*/ const int state_message_check[NUM_OF_STATES][MAX_MSG_TYPES] = { {VALID, VALID, VALID, INVALID, INVALID, INVALID, INVALID, INVALID}, //UNREGISTERED_STATE {VALID, VALID, VALID, VALID, VALID, INVALID, INVALID, INVALID}, //WAITING_FOR_OOB_STATE {VALID, VALID, VALID, INVALID, VALID, INVALID, INVALID, INVALID}, //OOB_RECEIVED_STATE {VALID, INVALID, INVALID, INVALID, INVALID, VALID, VALID, VALID}, //RECONNECT {VALID, INVALID, INVALID, INVALID, VALID, INVALID, INVALID, INVALID}, //REGISTERED_STATE }; #define EAP_NOOB_STATE_VALID \ (state_machine[data->peer_attr->server_state][data->peer_attr->peer_state] == VALID) \ #endif <|start_filename|>nodejs/config/database.js<|end_filename|> // config/database.js module.exports = { 'ooblibPath' : '', 'dbPath' : '/etc/peer_connection_db', 'url' : '', 'radCliPath' : '/home/cloud-user/testserver/eap-noob/hostapd-2.6/hostapd/hostapd.radius_clients', 'enableAccessControl' : '0', //set '1' to enable 'OobRetries' : '5', //number of times to try sending OOB before sending failure to peer 'NoobTimeout' : '30', //noob timeout in seconds 'NoobInterval' : '1800' //noob interval in seconds(Currently not required as generated on demand.) }; <|start_filename|>EAPNOOBWebView/app/src/main/java/com/sirseni/eapnoobwebview/OobMessage.java<|end_filename|> package com.sirseni.eapnoobwebview; import android.content.Context; import android.content.SharedPreferences; import android.preference.PreferenceManager; import android.util.Log; /** * Created by root on 1/27/17. */ public class OobMessage { private static final String PREF_OOB_MESSAGE = "oob_message"; private static final String DEFAULT_OOB_MESSAGE = null; private static final String TAG = "OobMessage"; //private static String sOobMessage = null; private static final Object sOobLock = new Object(); public static void SetOob(Context c, String s) { synchronized(sOobLock) { Log.i(TAG, "Setting Oob: " + s); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(c); prefs.edit().putString(PREF_OOB_MESSAGE, s).commit(); } } public static String GetAccount(Context c) { synchronized (sOobLock) { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(c); String oob_message = prefs.getString(PREF_OOB_MESSAGE, DEFAULT_OOB_MESSAGE); return oob_message; } } } <|start_filename|>EAPNOOBWebView/app/src/main/java/com/sirseni/eapnoobwebview/WebActivity.java<|end_filename|> package com.sirseni.eapnoobwebview; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.net.http.SslError; import android.os.Bundle; import android.util.Log; import android.webkit.JavascriptInterface; import android.webkit.SslErrorHandler; import android.webkit.WebChromeClient; import android.webkit.WebSettings; import android.webkit.WebView; import android.webkit.WebViewClient; import android.widget.Toast; public class WebActivity extends Activity { static String TAG = "WEB VIEW"; WebView myWebView; String web_url; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_web); Intent intent = getIntent(); web_url = intent.getStringExtra("URL"); myWebView = (WebView) findViewById(R.id.myWebView); myWebView.loadUrl(web_url); myWebView.setWebViewClient(new MyWebViewClient()); myWebView.addJavascriptInterface(new WebAppInterface(this), "Android"); myWebView.setWebChromeClient(new WebChromeClient()); WebSettings webSettings = myWebView.getSettings(); webSettings.setJavaScriptEnabled(true); } // Use When the user clicks a link from a web page in your WebView private class MyWebViewClient extends WebViewClient { @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { if (url.equals(web_url)) { Log.i(TAG, "HERE 1"); OobMessage.SetOob(getApplicationContext(),null); myWebView.clearCache(true); //myWebView.clearHistory(); /*getApplicationContext().deleteDatabase("webview.db"); getApplicationContext().deleteDatabase("webviewCache.db");*/ //return false; } Log.i(TAG, "HERE 2"); myWebView.loadUrl(url); /* Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); startActivity(intent);*/ return true; } @Override public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) { handler.proceed(); // Ignore SSL certificate errors } } public class WebAppInterface { Context mContext; /** Instantiate the interface and set the context */ WebAppInterface(Context c) { mContext = c; } /** Show a toast from the web page */ @JavascriptInterface public void sendOOB(String oob_meesage) { OobMessage.SetOob(getApplicationContext(),oob_meesage); Toast.makeText(mContext, oob_meesage, Toast.LENGTH_SHORT).show(); } } @Override public void onBackPressed() { if (myWebView.canGoBack()) { myWebView.goBack(); } else { super.onBackPressed(); } } } <|start_filename|>nodejs/config/passport.js<|end_filename|> // config/passport.js // load all the things we need var LocalStrategy = require('passport-local').Strategy; var sqlite3 = require('sqlite3').verbose(); var bcrypt = require('bcrypt-nodejs'); // load up the user model var db; var configDB = require('./database.js'); var conn_str = configDB.dbPath; function hashPassword(password) { return bcrypt.hashSync(password, bcrypt.genSaltSync(8), null); } function validPassword(password,original_password){ return bcrypt.compareSync(password, original_password); } // expose this function to our app using module.exports module.exports = function(passport) { // ========================================================================= // passport session setup ================================================== // ========================================================================= // required for persistent login sessions // passport needs ability to serialize and unserialize users out of session // used to serialize the user for the session passport.serializeUser(function(user, done) { done(null, user.id); }); // used to deserialize the user passport.deserializeUser(function(id, done) { db = new sqlite3.Database(conn_str); db.get('SELECT id, username, password, isAdmin FROM users WHERE id = ?', id, function(err, row) { db.close(); if (!row) return done(null, false); return done(null, row); }); }); // ========================================================================= // LOCAL LOGIN ============================================================= // ========================================================================= // we are using named strategies since we have one for login and one for signup // by default, if there was no name, it would just be called 'local' passport.use('local-login', new LocalStrategy({ // by default, local strategy uses username and password, we will override with email usernameField : 'email', passwordField : 'password', passReqToCallback : true // allows us to pass back the entire request to the callback }, function(req, email, password, done) { // callback with email and password from our form // find a user whose email is the same as the forms email // we are checking to see if the user trying to login already exists db = new sqlite3.Database(conn_str); db.get('SELECT id, username, password, isAdmin FROM users WHERE username = ?', email, function(err, row) { db.close(); if(err) return done(err); // if no user is found, return the message if (!row){ return done(null, false, req.flash('loginMessage', 'No user found.')); // req.flash is the way to set flashdata using connect-flash } // if the user is found but the password is wrong if (!validPassword(password,row.password)) return done(null, false, req.flash('loginMessage', 'Oops! Wrong password.')); // create the loginMessage and save it to session as flashdata // all is well, return successful user return done(null, row); }); })); // ========================================================================= // LOCAL SIGNUP ============================================================ // ========================================================================= // we are using named strategies since we have one for login and one for signup // by default, if there was no name, it would just be called 'local' passport.use('local-signup', new LocalStrategy({ // by default, local strategy uses username and password, we will override with email usernameField : 'email', passwordField : 'password', passReqToCallback : true // allows us to pass back the entire request to the callback }, function(req, email, password, done) { // asynchronous // User.findOne wont fire unless data is sent back process.nextTick(function() { // find a user whose email is the same as the forms email // we are checking to see if the user trying to login already exists db = new sqlite3.Database(conn_str); db.get('SELECT id FROM users WHERE username = ?', email, function(err, row) { db.close(); if(err) return done(err); if(row){ return done(null, false, req.flash('signupMessage', 'That email is already taken.')); } if (!row){ var stmt = db.prepare("INSERT INTO users(username,password) VALUES(?,?)"); stmt.run(email,hashPassword(password)); stmt.finalize(); db.get('SELECT id, username, password, isAdmin FROM users WHERE username = ?', email, function(err, row) { if (!row) return done(null, false); else return done(null,row); }); } }); }); })); }; <|start_filename|>nodejs/common.js<|end_filename|> var connMap = {}; exports.connMap = connMap; <|start_filename|>hostapd-2.6/src/radius/radius_server.c<|end_filename|> /* * RADIUS authentication server * Copyright (c) 2005-2009, 2011-2014, <NAME> <<EMAIL>> * * This software may be distributed under the terms of the BSD license. * See README for more details. */ #include "includes.h" #include <net/if.h> #ifdef CONFIG_SQLITE #include <sqlite3.h> #endif /* CONFIG_SQLITE */ #include "common.h" #include "radius.h" #include "eloop.h" #include "eap_server/eap.h" #include "ap/ap_config.h" #include "crypto/tls.h" #include "radius_server.h" #include "../utils/includes.h" #include "../utils/common.h" #include "../utils/eloop.h" /** * RADIUS_SESSION_TIMEOUT - Session timeout in seconds */ #define RADIUS_SESSION_TIMEOUT 60 /** * RADIUS_MAX_SESSION - Maximum number of active sessions */ #define RADIUS_MAX_SESSION 100 /** * RADIUS_MAX_MSG_LEN - Maximum message length for incoming RADIUS messages */ #define RADIUS_MAX_MSG_LEN 3000 //static void radius_store_record(struct radius_msg * , int ); static const struct eapol_callbacks radius_server_eapol_cb; struct radius_client; struct radius_server_data; struct radius_clients_reconfig{ //abcd struct radius_server_data *data; char *client_file; int ipv6; }; /** * struct radius_server_counters - RADIUS server statistics counters */ struct radius_server_counters { u32 access_requests; u32 invalid_requests; u32 dup_access_requests; u32 access_accepts; u32 access_rejects; u32 access_challenges; u32 malformed_access_requests; u32 bad_authenticators; u32 packets_dropped; u32 unknown_types; u32 acct_requests; u32 invalid_acct_requests; u32 acct_responses; u32 malformed_acct_requests; u32 acct_bad_authenticators; u32 unknown_acct_types; }; /** * struct radius_session - Internal RADIUS server data for a session */ struct radius_session { struct radius_session *next; struct radius_client *client; struct radius_server_data *server; unsigned int sess_id; struct eap_sm *eap; struct eap_eapol_interface *eap_if; char *username; /* from User-Name attribute */ char *nas_ip; struct radius_msg *last_msg; char *last_from_addr; int last_from_port; struct sockaddr_storage last_from; socklen_t last_fromlen; u8 last_identifier; struct radius_msg *last_reply; u8 last_authenticator[16]; unsigned int remediation:1; unsigned int macacl:1; struct hostapd_radius_attr *accept_attr; }; /** * struct radius_client - Internal RADIUS server data for a client */ struct radius_client { struct radius_client *next; struct in_addr addr; struct in_addr mask; #ifdef CONFIG_IPV6 struct in6_addr addr6; struct in6_addr mask6; #endif /* CONFIG_IPV6 */ char *shared_secret; int shared_secret_len; struct radius_session *sessions; struct radius_server_counters counters; }; /** * struct radius_server_data - Internal RADIUS server data */ struct radius_server_data { /** * auth_sock - Socket for RADIUS authentication messages */ int auth_sock; /** * acct_sock - Socket for RADIUS accounting messages */ int acct_sock; /** * clients - List of authorized RADIUS clients */ struct radius_client *clients; /** * next_sess_id - Next session identifier */ unsigned int next_sess_id; /** * conf_ctx - Context pointer for callbacks * * This is used as the ctx argument in get_eap_user() calls. */ void *conf_ctx; /** * num_sess - Number of active sessions */ int num_sess; /** * eap_sim_db_priv - EAP-SIM/AKA database context * * This is passed to the EAP-SIM/AKA server implementation as a * callback context. */ void *eap_sim_db_priv; /** * ssl_ctx - TLS context * * This is passed to the EAP server implementation as a callback * context for TLS operations. */ void *ssl_ctx; /** * pac_opaque_encr_key - PAC-Opaque encryption key for EAP-FAST * * This parameter is used to set a key for EAP-FAST to encrypt the * PAC-Opaque data. It can be set to %NULL if EAP-FAST is not used. If * set, must point to a 16-octet key. */ u8 *pac_opaque_encr_key; /** * eap_fast_a_id - EAP-FAST authority identity (A-ID) * * If EAP-FAST is not used, this can be set to %NULL. In theory, this * is a variable length field, but due to some existing implementations * requiring A-ID to be 16 octets in length, it is recommended to use * that length for the field to provide interoperability with deployed * peer implementations. */ u8 *eap_fast_a_id; /** * eap_fast_a_id_len - Length of eap_fast_a_id buffer in octets */ size_t eap_fast_a_id_len; /** * eap_fast_a_id_info - EAP-FAST authority identifier information * * This A-ID-Info contains a user-friendly name for the A-ID. For * example, this could be the enterprise and server names in * human-readable format. This field is encoded as UTF-8. If EAP-FAST * is not used, this can be set to %NULL. */ char *eap_fast_a_id_info; /** * eap_fast_prov - EAP-FAST provisioning modes * * 0 = provisioning disabled, 1 = only anonymous provisioning allowed, * 2 = only authenticated provisioning allowed, 3 = both provisioning * modes allowed. */ int eap_fast_prov; /** * pac_key_lifetime - EAP-FAST PAC-Key lifetime in seconds * * This is the hard limit on how long a provisioned PAC-Key can be * used. */ int pac_key_lifetime; /** * pac_key_refresh_time - EAP-FAST PAC-Key refresh time in seconds * * This is a soft limit on the PAC-Key. The server will automatically * generate a new PAC-Key when this number of seconds (or fewer) of the * lifetime remains. */ int pac_key_refresh_time; /** * eap_sim_aka_result_ind - EAP-SIM/AKA protected success indication * * This controls whether the protected success/failure indication * (AT_RESULT_IND) is used with EAP-SIM and EAP-AKA. */ int eap_sim_aka_result_ind; /** * tnc - Trusted Network Connect (TNC) * * This controls whether TNC is enabled and will be required before the * peer is allowed to connect. Note: This is only used with EAP-TTLS * and EAP-FAST. If any other EAP method is enabled, the peer will be * allowed to connect without TNC. */ int tnc; /** * pwd_group - The D-H group assigned for EAP-pwd * * If EAP-pwd is not used it can be set to zero. */ u16 pwd_group; /** * server_id - Server identity */ const char *server_id; /** * erp - Whether EAP Re-authentication Protocol (ERP) is enabled * * This controls whether the authentication server derives ERP key * hierarchy (rRK and rIK) from full EAP authentication and allows * these keys to be used to perform ERP to derive rMSK instead of full * EAP authentication to derive MSK. */ int erp; const char *erp_domain; struct dl_list erp_keys; /* struct eap_server_erp_key */ unsigned int tls_session_lifetime; /** * wps - Wi-Fi Protected Setup context * * If WPS is used with an external RADIUS server (which is quite * unlikely configuration), this is used to provide a pointer to WPS * context data. Normally, this can be set to %NULL. */ struct wps_context *wps; /** * ipv6 - Whether to enable IPv6 support in the RADIUS server */ int ipv6; /** * start_time - Timestamp of server start */ struct os_reltime start_time; /** * counters - Statistics counters for server operations * * These counters are the sum over all clients. */ struct radius_server_counters counters; /** * get_eap_user - Callback for fetching EAP user information * @ctx: Context data from conf_ctx * @identity: User identity * @identity_len: identity buffer length in octets * @phase2: Whether this is for Phase 2 identity * @user: Data structure for filling in the user information * Returns: 0 on success, -1 on failure * * This is used to fetch information from user database. The callback * will fill in information about allowed EAP methods and the user * password. The password field will be an allocated copy of the * password data and RADIUS server will free it after use. */ int (*get_eap_user)(void *ctx, const u8 *identity, size_t identity_len, int phase2, struct eap_user *user); /** * eap_req_id_text - Optional data for EAP-Request/Identity * * This can be used to configure an optional, displayable message that * will be sent in EAP-Request/Identity. This string can contain an * ASCII-0 character (nul) to separate network infromation per RFC * 4284. The actual string length is explicit provided in * eap_req_id_text_len since nul character will not be used as a string * terminator. */ char *eap_req_id_text; /** * eap_req_id_text_len - Length of eap_req_id_text buffer in octets */ size_t eap_req_id_text_len; /* * msg_ctx - Context data for wpa_msg() calls */ void *msg_ctx; #ifdef CONFIG_RADIUS_TEST char *dump_msk_file; #endif /* CONFIG_RADIUS_TEST */ char *subscr_remediation_url; u8 subscr_remediation_method; #ifdef CONFIG_SQLITE sqlite3 *db; #endif /* CONFIG_SQLITE */ }; #define RADIUS_DEBUG(args...) \ wpa_printf(MSG_DEBUG, "RADIUS SRV: " args) #define RADIUS_ERROR(args...) \ wpa_printf(MSG_ERROR, "RADIUS SRV: " args) #define RADIUS_DUMP(args...) \ wpa_hexdump(MSG_MSGDUMP, "RADIUS SRV: " args) #define RADIUS_DUMP_ASCII(args...) \ wpa_hexdump_ascii(MSG_MSGDUMP, "RADIUS SRV: " args) static void radius_server_session_timeout(void *eloop_ctx, void *timeout_ctx); static void radius_server_session_remove_timeout(void *eloop_ctx, void *timeout_ctx); void srv_log(struct radius_session *sess, const char *fmt, ...) PRINTF_FORMAT(2, 3); void srv_log(struct radius_session *sess, const char *fmt, ...) { va_list ap; char *buf; int buflen; va_start(ap, fmt); buflen = vsnprintf(NULL, 0, fmt, ap) + 1; va_end(ap); buf = os_malloc(buflen); if (buf == NULL) return; va_start(ap, fmt); vsnprintf(buf, buflen, fmt, ap); va_end(ap); RADIUS_DEBUG("[0x%x %s] %s", sess->sess_id, sess->nas_ip, buf); #ifdef CONFIG_SQLITE if (sess->server->db) { char *sql; sql = sqlite3_mprintf("INSERT INTO authlog" "(timestamp,session,nas_ip,username,note)" " VALUES (" "strftime('%%Y-%%m-%%d %%H:%%M:%%f'," "'now'),%u,%Q,%Q,%Q)", sess->sess_id, sess->nas_ip, sess->username, buf); if (sql) { if (sqlite3_exec(sess->server->db, sql, NULL, NULL, NULL) != SQLITE_OK) { RADIUS_ERROR("Failed to add authlog entry into sqlite database: %s", sqlite3_errmsg(sess->server->db)); } sqlite3_free(sql); } } #endif /* CONFIG_SQLITE */ os_free(buf); } static struct radius_client * radius_server_get_client(struct radius_server_data *data, struct in_addr *addr, int ipv6) { struct radius_client *client = data->clients; while (client) { #ifdef CONFIG_IPV6 if (ipv6) { struct in6_addr *addr6; int i; addr6 = (struct in6_addr *) addr; for (i = 0; i < 16; i++) { if ((addr6->s6_addr[i] & client->mask6.s6_addr[i]) != (client->addr6.s6_addr[i] & client->mask6.s6_addr[i])) { i = 17; break; } } if (i == 16) { break; } } #endif /* CONFIG_IPV6 */ if (!ipv6 && (client->addr.s_addr & client->mask.s_addr) == (addr->s_addr & client->mask.s_addr)) { break; } client = client->next; } return client; } static struct radius_session * radius_server_get_session(struct radius_client *client, unsigned int sess_id) { struct radius_session *sess = client->sessions; while (sess) { if (sess->sess_id == sess_id) { break; } sess = sess->next; } return sess; } static void radius_server_session_free(struct radius_server_data *data, struct radius_session *sess) { eloop_cancel_timeout(radius_server_session_timeout, data, sess); eloop_cancel_timeout(radius_server_session_remove_timeout, data, sess); eap_server_sm_deinit(sess->eap); radius_msg_free(sess->last_msg); os_free(sess->last_from_addr); radius_msg_free(sess->last_reply); os_free(sess->username); os_free(sess->nas_ip); os_free(sess); data->num_sess--; } static void radius_server_session_remove(struct radius_server_data *data, struct radius_session *sess) { struct radius_client *client = sess->client; struct radius_session *session, *prev; eloop_cancel_timeout(radius_server_session_remove_timeout, data, sess); prev = NULL; session = client->sessions; while (session) { if (session == sess) { if (prev == NULL) { client->sessions = sess->next; } else { prev->next = sess->next; } radius_server_session_free(data, sess); break; } prev = session; session = session->next; } } static void radius_server_session_remove_timeout(void *eloop_ctx, void *timeout_ctx) { struct radius_server_data *data = eloop_ctx; struct radius_session *sess = timeout_ctx; RADIUS_DEBUG("Removing completed session 0x%x", sess->sess_id); radius_server_session_remove(data, sess); } static void radius_server_session_timeout(void *eloop_ctx, void *timeout_ctx) { struct radius_server_data *data = eloop_ctx; struct radius_session *sess = timeout_ctx; RADIUS_DEBUG("Timing out authentication session 0x%x", sess->sess_id); radius_server_session_remove(data, sess); } static struct radius_session * radius_server_new_session(struct radius_server_data *data, struct radius_client *client) { struct radius_session *sess; if (data->num_sess >= RADIUS_MAX_SESSION) { RADIUS_DEBUG("Maximum number of existing session - no room " "for a new session"); return NULL; } sess = os_zalloc(sizeof(*sess)); if (sess == NULL) return NULL; sess->server = data; sess->client = client; sess->sess_id = data->next_sess_id++; sess->next = client->sessions; client->sessions = sess; eloop_register_timeout(RADIUS_SESSION_TIMEOUT, 0, radius_server_session_timeout, data, sess); data->num_sess++; return sess; } #ifdef CONFIG_TESTING_OPTIONS static void radius_server_testing_options_tls(struct radius_session *sess, const char *tls, struct eap_config *eap_conf) { int test = atoi(tls); switch (test) { case 1: srv_log(sess, "TLS test - break VerifyData"); eap_conf->tls_test_flags = TLS_BREAK_VERIFY_DATA; break; case 2: srv_log(sess, "TLS test - break ServerKeyExchange ServerParams hash"); eap_conf->tls_test_flags = TLS_BREAK_SRV_KEY_X_HASH; break; case 3: srv_log(sess, "TLS test - break ServerKeyExchange ServerParams Signature"); eap_conf->tls_test_flags = TLS_BREAK_SRV_KEY_X_SIGNATURE; break; case 4: srv_log(sess, "TLS test - RSA-DHE using a short 511-bit prime"); eap_conf->tls_test_flags = TLS_DHE_PRIME_511B; break; case 5: srv_log(sess, "TLS test - RSA-DHE using a short 767-bit prime"); eap_conf->tls_test_flags = TLS_DHE_PRIME_767B; break; case 6: srv_log(sess, "TLS test - RSA-DHE using a bogus 15 \"prime\""); eap_conf->tls_test_flags = TLS_DHE_PRIME_15; break; case 7: srv_log(sess, "TLS test - RSA-DHE using a short 58-bit prime in long container"); eap_conf->tls_test_flags = TLS_DHE_PRIME_58B; break; case 8: srv_log(sess, "TLS test - RSA-DHE using a non-prime"); eap_conf->tls_test_flags = TLS_DHE_NON_PRIME; break; default: srv_log(sess, "Unrecognized TLS test"); break; } } #endif /* CONFIG_TESTING_OPTIONS */ static void radius_server_testing_options(struct radius_session *sess, struct eap_config *eap_conf) { #ifdef CONFIG_TESTING_OPTIONS const char *pos; pos = os_strstr(sess->username, "@test-"); if (pos == NULL) return; pos += 6; if (os_strncmp(pos, "tls-", 4) == 0) radius_server_testing_options_tls(sess, pos + 4, eap_conf); else srv_log(sess, "Unrecognized test: %s", pos); #endif /* CONFIG_TESTING_OPTIONS */ } static struct radius_session * radius_server_get_new_session(struct radius_server_data *data, struct radius_client *client, struct radius_msg *msg, const char *from_addr) { u8 *user; size_t user_len; int res; struct radius_session *sess; struct eap_config eap_conf; struct eap_user tmp; RADIUS_DEBUG("Creating a new session"); if (radius_msg_get_attr_ptr(msg, RADIUS_ATTR_USER_NAME, &user, &user_len, NULL) < 0) { RADIUS_DEBUG("Could not get User-Name"); return NULL; } RADIUS_DUMP_ASCII("User-Name", user, user_len); os_memset(&tmp, 0, sizeof(tmp)); res = data->get_eap_user(data->conf_ctx, user, user_len, 0, &tmp); bin_clear_free(tmp.password, tmp.password_len); if (res != 0) { RADIUS_DEBUG("User-Name not found from user database"); return NULL; } RADIUS_DEBUG("Matching user entry found"); sess = radius_server_new_session(data, client); if (sess == NULL) { RADIUS_DEBUG("Failed to create a new session"); return NULL; } sess->accept_attr = tmp.accept_attr; sess->macacl = tmp.macacl; sess->username = os_malloc(user_len * 4 + 1); if (sess->username == NULL) { radius_server_session_free(data, sess); return NULL; } printf_encode(sess->username, user_len * 4 + 1, user, user_len); sess->nas_ip = os_strdup(from_addr); if (sess->nas_ip == NULL) { radius_server_session_free(data, sess); return NULL; } srv_log(sess, "New session created"); os_memset(&eap_conf, 0, sizeof(eap_conf)); eap_conf.ssl_ctx = data->ssl_ctx; eap_conf.msg_ctx = data->msg_ctx; eap_conf.eap_sim_db_priv = data->eap_sim_db_priv; eap_conf.backend_auth = TRUE; eap_conf.eap_server = 1; eap_conf.pac_opaque_encr_key = data->pac_opaque_encr_key; eap_conf.eap_fast_a_id = data->eap_fast_a_id; eap_conf.eap_fast_a_id_len = data->eap_fast_a_id_len; eap_conf.eap_fast_a_id_info = data->eap_fast_a_id_info; eap_conf.eap_fast_prov = data->eap_fast_prov; eap_conf.pac_key_lifetime = data->pac_key_lifetime; eap_conf.pac_key_refresh_time = data->pac_key_refresh_time; eap_conf.eap_sim_aka_result_ind = data->eap_sim_aka_result_ind; eap_conf.tnc = data->tnc; eap_conf.wps = data->wps; eap_conf.pwd_group = data->pwd_group; eap_conf.server_id = (const u8 *) data->server_id; eap_conf.server_id_len = os_strlen(data->server_id); eap_conf.erp = data->erp; eap_conf.tls_session_lifetime = data->tls_session_lifetime; radius_server_testing_options(sess, &eap_conf); sess->eap = eap_server_sm_init(sess, &radius_server_eapol_cb, &eap_conf); if (sess->eap == NULL) { RADIUS_DEBUG("Failed to initialize EAP state machine for the " "new session"); radius_server_session_free(data, sess); return NULL; } sess->eap_if = eap_get_interface(sess->eap); sess->eap_if->eapRestart = TRUE; sess->eap_if->portEnabled = TRUE; RADIUS_DEBUG("New session 0x%x initialized", sess->sess_id); return sess; } static struct radius_msg * radius_server_encapsulate_eap(struct radius_server_data *data, struct radius_client *client, struct radius_session *sess, struct radius_msg *request) { struct radius_msg *msg; int code; unsigned int sess_id; struct radius_hdr *hdr = radius_msg_get_hdr(request); if (sess->eap_if->eapFail) { sess->eap_if->eapFail = FALSE; code = RADIUS_CODE_ACCESS_REJECT; } else if (sess->eap_if->eapSuccess) { sess->eap_if->eapSuccess = FALSE; code = RADIUS_CODE_ACCESS_ACCEPT; } else { sess->eap_if->eapReq = FALSE; code = RADIUS_CODE_ACCESS_CHALLENGE; } msg = radius_msg_new(code, hdr->identifier); if (msg == NULL) { RADIUS_DEBUG("Failed to allocate reply message"); return NULL; } sess_id = htonl(sess->sess_id); if (code == RADIUS_CODE_ACCESS_CHALLENGE && !radius_msg_add_attr(msg, RADIUS_ATTR_STATE, (u8 *) &sess_id, sizeof(sess_id))) { RADIUS_DEBUG("Failed to add State attribute"); } if (sess->eap_if->eapReqData && !radius_msg_add_eap(msg, wpabuf_head(sess->eap_if->eapReqData), wpabuf_len(sess->eap_if->eapReqData))) { RADIUS_DEBUG("Failed to add EAP-Message attribute"); } if (code == RADIUS_CODE_ACCESS_ACCEPT && sess->eap_if->eapKeyData) { int len; #ifdef CONFIG_RADIUS_TEST if (data->dump_msk_file) { FILE *f; char buf[2 * 64 + 1]; f = fopen(data->dump_msk_file, "a"); if (f) { len = sess->eap_if->eapKeyDataLen; if (len > 64) len = 64; len = wpa_snprintf_hex( buf, sizeof(buf), sess->eap_if->eapKeyData, len); buf[len] = '\0'; fprintf(f, "%s\n", buf); fclose(f); } } #endif /* CONFIG_RADIUS_TEST */ if (sess->eap_if->eapKeyDataLen > 64) { len = 32; } else { len = sess->eap_if->eapKeyDataLen / 2; } if (!radius_msg_add_mppe_keys(msg, hdr->authenticator, (u8 *) client->shared_secret, client->shared_secret_len, sess->eap_if->eapKeyData + len, len, sess->eap_if->eapKeyData, len)) { RADIUS_DEBUG("Failed to add MPPE key attributes"); } } #ifdef CONFIG_HS20 if (code == RADIUS_CODE_ACCESS_ACCEPT && sess->remediation && data->subscr_remediation_url) { u8 *buf; size_t url_len = os_strlen(data->subscr_remediation_url); buf = os_malloc(1 + url_len); if (buf == NULL) { radius_msg_free(msg); return NULL; } buf[0] = data->subscr_remediation_method; os_memcpy(&buf[1], data->subscr_remediation_url, url_len); if (!radius_msg_add_wfa( msg, RADIUS_VENDOR_ATTR_WFA_HS20_SUBSCR_REMEDIATION, buf, 1 + url_len)) { RADIUS_DEBUG("Failed to add WFA-HS20-SubscrRem"); } os_free(buf); } else if (code == RADIUS_CODE_ACCESS_ACCEPT && sess->remediation) { u8 buf[1]; if (!radius_msg_add_wfa( msg, RADIUS_VENDOR_ATTR_WFA_HS20_SUBSCR_REMEDIATION, buf, 0)) { RADIUS_DEBUG("Failed to add WFA-HS20-SubscrRem"); } } #endif /* CONFIG_HS20 */ if (radius_msg_copy_attr(msg, request, RADIUS_ATTR_PROXY_STATE) < 0) { RADIUS_DEBUG("Failed to copy Proxy-State attribute(s)"); radius_msg_free(msg); return NULL; } if (code == RADIUS_CODE_ACCESS_ACCEPT) { struct hostapd_radius_attr *attr; for (attr = sess->accept_attr; attr; attr = attr->next) { if (!radius_msg_add_attr(msg, attr->type, wpabuf_head(attr->val), wpabuf_len(attr->val))) { wpa_printf(MSG_ERROR, "Could not add RADIUS attribute"); radius_msg_free(msg); return NULL; } } } if (radius_msg_finish_srv(msg, (u8 *) client->shared_secret, client->shared_secret_len, hdr->authenticator) < 0) { RADIUS_DEBUG("Failed to add Message-Authenticator attribute"); } return msg; } static struct radius_msg * radius_server_macacl(struct radius_server_data *data, struct radius_client *client, struct radius_session *sess, struct radius_msg *request) { struct radius_msg *msg; int code; struct radius_hdr *hdr = radius_msg_get_hdr(request); u8 *pw; size_t pw_len; code = RADIUS_CODE_ACCESS_ACCEPT; if (radius_msg_get_attr_ptr(request, RADIUS_ATTR_USER_PASSWORD, &pw, &pw_len, NULL) < 0) { RADIUS_DEBUG("Could not get User-Password"); code = RADIUS_CODE_ACCESS_REJECT; } else { int res; struct eap_user tmp; os_memset(&tmp, 0, sizeof(tmp)); res = data->get_eap_user(data->conf_ctx, (u8 *) sess->username, os_strlen(sess->username), 0, &tmp); if (res || !tmp.macacl || tmp.password == NULL) { RADIUS_DEBUG("No MAC ACL user entry"); bin_clear_free(tmp.password, tmp.password_len); code = RADIUS_CODE_ACCESS_REJECT; } else { u8 buf[128]; res = radius_user_password_hide( request, tmp.password, tmp.password_len, (u8 *) client->shared_secret, client->shared_secret_len, buf, sizeof(buf)); bin_clear_free(tmp.password, tmp.password_len); if (res < 0 || pw_len != (size_t) res || os_memcmp_const(pw, buf, res) != 0) { RADIUS_DEBUG("Incorrect User-Password"); code = RADIUS_CODE_ACCESS_REJECT; } } } msg = radius_msg_new(code, hdr->identifier); if (msg == NULL) { RADIUS_DEBUG("Failed to allocate reply message"); return NULL; } if (radius_msg_copy_attr(msg, request, RADIUS_ATTR_PROXY_STATE) < 0) { RADIUS_DEBUG("Failed to copy Proxy-State attribute(s)"); radius_msg_free(msg); return NULL; } if (code == RADIUS_CODE_ACCESS_ACCEPT) { struct hostapd_radius_attr *attr; for (attr = sess->accept_attr; attr; attr = attr->next) { if (!radius_msg_add_attr(msg, attr->type, wpabuf_head(attr->val), wpabuf_len(attr->val))) { wpa_printf(MSG_ERROR, "Could not add RADIUS attribute"); radius_msg_free(msg); return NULL; } } } if (radius_msg_finish_srv(msg, (u8 *) client->shared_secret, client->shared_secret_len, hdr->authenticator) < 0) { RADIUS_DEBUG("Failed to add Message-Authenticator attribute"); } return msg; } static int radius_server_reject(struct radius_server_data *data, struct radius_client *client, struct radius_msg *request, struct sockaddr *from, socklen_t fromlen, const char *from_addr, int from_port) { struct radius_msg *msg; int ret = 0; struct eap_hdr eapfail; struct wpabuf *buf; struct radius_hdr *hdr = radius_msg_get_hdr(request); RADIUS_DEBUG("Reject invalid request from %s:%d", from_addr, from_port); msg = radius_msg_new(RADIUS_CODE_ACCESS_REJECT, hdr->identifier); if (msg == NULL) { return -1; } os_memset(&eapfail, 0, sizeof(eapfail)); eapfail.code = EAP_CODE_FAILURE; eapfail.identifier = 0; eapfail.length = host_to_be16(sizeof(eapfail)); if (!radius_msg_add_eap(msg, (u8 *) &eapfail, sizeof(eapfail))) { RADIUS_DEBUG("Failed to add EAP-Message attribute"); } if (radius_msg_copy_attr(msg, request, RADIUS_ATTR_PROXY_STATE) < 0) { RADIUS_DEBUG("Failed to copy Proxy-State attribute(s)"); radius_msg_free(msg); return -1; } if (radius_msg_finish_srv(msg, (u8 *) client->shared_secret, client->shared_secret_len, hdr->authenticator) < 0) { RADIUS_DEBUG("Failed to add Message-Authenticator attribute"); } if (wpa_debug_level <= MSG_MSGDUMP) { radius_msg_dump(msg); } data->counters.access_rejects++; client->counters.access_rejects++; buf = radius_msg_get_buf(msg); if (sendto(data->auth_sock, wpabuf_head(buf), wpabuf_len(buf), 0, (struct sockaddr *) from, sizeof(*from)) < 0) { wpa_printf(MSG_INFO, "sendto[RADIUS SRV]: %s", strerror(errno)); ret = -1; } radius_msg_free(msg); return ret; } static int radius_server_request(struct radius_server_data *data, struct radius_msg *msg, struct sockaddr *from, socklen_t fromlen, struct radius_client *client, const char *from_addr, int from_port, struct radius_session *force_sess) { struct wpabuf *eap = NULL; int res, state_included = 0; u8 statebuf[4]; unsigned int state; struct radius_session *sess; struct radius_msg *reply; int is_complete = 0; if (force_sess) sess = force_sess; else { res = radius_msg_get_attr(msg, RADIUS_ATTR_STATE, statebuf, sizeof(statebuf)); state_included = res >= 0; if (res == sizeof(statebuf)) { state = WPA_GET_BE32(statebuf); sess = radius_server_get_session(client, state); } else { sess = NULL; } } if (sess) { RADIUS_DEBUG("Request for session 0x%x", sess->sess_id); } else if (state_included) { RADIUS_DEBUG("State attribute included but no session found"); radius_server_reject(data, client, msg, from, fromlen, from_addr, from_port); return -1; } else { sess = radius_server_get_new_session(data, client, msg, from_addr); if (sess == NULL) { RADIUS_DEBUG("Could not create a new session"); radius_server_reject(data, client, msg, from, fromlen, from_addr, from_port); return -1; } } if (sess->last_from_port == from_port && sess->last_identifier == radius_msg_get_hdr(msg)->identifier && os_memcmp(sess->last_authenticator, radius_msg_get_hdr(msg)->authenticator, 16) == 0) { RADIUS_DEBUG("Duplicate message from %s", from_addr); data->counters.dup_access_requests++; client->counters.dup_access_requests++; if (sess->last_reply) { struct wpabuf *buf; buf = radius_msg_get_buf(sess->last_reply); res = sendto(data->auth_sock, wpabuf_head(buf), wpabuf_len(buf), 0, (struct sockaddr *) from, fromlen); if (res < 0) { wpa_printf(MSG_INFO, "sendto[RADIUS SRV]: %s", strerror(errno)); } return 0; } RADIUS_DEBUG("No previous reply available for duplicate " "message"); return -1; } eap = radius_msg_get_eap(msg); if (eap == NULL && sess->macacl) { reply = radius_server_macacl(data, client, sess, msg); if (reply == NULL) return -1; goto send_reply; } if (eap == NULL) { RADIUS_DEBUG("No EAP-Message in RADIUS packet from %s", from_addr); data->counters.packets_dropped++; client->counters.packets_dropped++; return -1; } if(sess->eap->currentMethod == EAP_TYPE_NOOB && sess->eap->respId == 0) radius_store_record(msg,sess->eap);//abcd RADIUS_DUMP("Received EAP data", wpabuf_head(eap), wpabuf_len(eap)); /* FIX: if Code is Request, Success, or Failure, send Access-Reject; * RFC3579 Sect. 2.6.2. * Include EAP-Response/Nak with no preferred method if * code == request. * If code is not 1-4, discard the packet silently. * Or is this already done by the EAP state machine? */ wpabuf_free(sess->eap_if->eapRespData); sess->eap_if->eapRespData = eap; sess->eap_if->eapResp = TRUE; eap_server_sm_step(sess->eap); if ((sess->eap_if->eapReq || sess->eap_if->eapSuccess || sess->eap_if->eapFail) && sess->eap_if->eapReqData) { RADIUS_DUMP("EAP data from the state machine", wpabuf_head(sess->eap_if->eapReqData), wpabuf_len(sess->eap_if->eapReqData)); } else if (sess->eap_if->eapFail) { RADIUS_DEBUG("No EAP data from the state machine, but eapFail " "set"); } else if (eap_sm_method_pending(sess->eap)) { radius_msg_free(sess->last_msg); sess->last_msg = msg; sess->last_from_port = from_port; os_free(sess->last_from_addr); sess->last_from_addr = os_strdup(from_addr); sess->last_fromlen = fromlen; os_memcpy(&sess->last_from, from, fromlen); return -2; } else { RADIUS_DEBUG("No EAP data from the state machine - ignore this" " Access-Request silently (assuming it was a " "duplicate)"); data->counters.packets_dropped++; client->counters.packets_dropped++; return -1; } if (sess->eap_if->eapSuccess || sess->eap_if->eapFail) is_complete = 1; if (sess->eap_if->eapFail) srv_log(sess, "EAP authentication failed"); else if (sess->eap_if->eapSuccess) srv_log(sess, "EAP authentication succeeded"); reply = radius_server_encapsulate_eap(data, client, sess, msg); send_reply: if (reply) { struct wpabuf *buf; struct radius_hdr *hdr; RADIUS_DEBUG("Reply to %s:%d", from_addr, from_port); if (wpa_debug_level <= MSG_MSGDUMP) { radius_msg_dump(reply); } switch (radius_msg_get_hdr(reply)->code) { case RADIUS_CODE_ACCESS_ACCEPT: srv_log(sess, "Sending Access-Accept"); data->counters.access_accepts++; client->counters.access_accepts++; break; case RADIUS_CODE_ACCESS_REJECT: srv_log(sess, "Sending Access-Reject"); data->counters.access_rejects++; client->counters.access_rejects++; break; case RADIUS_CODE_ACCESS_CHALLENGE: data->counters.access_challenges++; client->counters.access_challenges++; break; } buf = radius_msg_get_buf(reply); res = sendto(data->auth_sock, wpabuf_head(buf), wpabuf_len(buf), 0, (struct sockaddr *) from, fromlen); if (res < 0) { wpa_printf(MSG_INFO, "sendto[RADIUS SRV]: %s", strerror(errno)); } radius_msg_free(sess->last_reply); sess->last_reply = reply; sess->last_from_port = from_port; hdr = radius_msg_get_hdr(msg); sess->last_identifier = hdr->identifier; os_memcpy(sess->last_authenticator, hdr->authenticator, 16); } else { data->counters.packets_dropped++; client->counters.packets_dropped++; } if (is_complete) { RADIUS_DEBUG("Removing completed session 0x%x after timeout", sess->sess_id); eloop_cancel_timeout(radius_server_session_remove_timeout, data, sess); eloop_register_timeout(10, 0, radius_server_session_remove_timeout, data, sess); } return 0; } static void radius_server_receive_auth(int sock, void *eloop_ctx, void *sock_ctx) { struct radius_server_data *data = eloop_ctx; u8 *buf = NULL; union { struct sockaddr_storage ss; struct sockaddr_in sin; #ifdef CONFIG_IPV6 struct sockaddr_in6 sin6; #endif /* CONFIG_IPV6 */ } from; socklen_t fromlen; int len; struct radius_client *client = NULL; struct radius_msg *msg = NULL; char abuf[50]; int from_port = 0; buf = os_malloc(RADIUS_MAX_MSG_LEN); if (buf == NULL) { goto fail; } fromlen = sizeof(from); len = recvfrom(sock, buf, RADIUS_MAX_MSG_LEN, 0, (struct sockaddr *) &from.ss, &fromlen); if (len < 0) { wpa_printf(MSG_INFO, "recvfrom[radius_server]: %s", strerror(errno)); goto fail; } #ifdef CONFIG_IPV6 if (data->ipv6) { if (inet_ntop(AF_INET6, &from.sin6.sin6_addr, abuf, sizeof(abuf)) == NULL) abuf[0] = '\0'; from_port = ntohs(from.sin6.sin6_port); RADIUS_DEBUG("Received %d bytes from %s:%d", len, abuf, from_port); client = radius_server_get_client(data, (struct in_addr *) &from.sin6.sin6_addr, 1); } #endif /* CONFIG_IPV6 */ if (!data->ipv6) { os_strlcpy(abuf, inet_ntoa(from.sin.sin_addr), sizeof(abuf)); from_port = ntohs(from.sin.sin_port); RADIUS_DEBUG("Received %d bytes from %s:%d", len, abuf, from_port); client = radius_server_get_client(data, &from.sin.sin_addr, 0); } RADIUS_DUMP("Received data", buf, len); if (client == NULL) { RADIUS_DEBUG("Unknown client %s - packet ignored", abuf); data->counters.invalid_requests++; goto fail; } msg = radius_msg_parse(buf, len); if (msg == NULL) { RADIUS_DEBUG("Parsing incoming RADIUS frame failed"); data->counters.malformed_access_requests++; client->counters.malformed_access_requests++; goto fail; } os_free(buf); buf = NULL; if (wpa_debug_level <= MSG_MSGDUMP) { radius_msg_dump(msg); } if (radius_msg_get_hdr(msg)->code != RADIUS_CODE_ACCESS_REQUEST) { RADIUS_DEBUG("Unexpected RADIUS code %d", radius_msg_get_hdr(msg)->code); data->counters.unknown_types++; client->counters.unknown_types++; goto fail; } data->counters.access_requests++; client->counters.access_requests++; if (radius_msg_verify_msg_auth(msg, (u8 *) client->shared_secret, client->shared_secret_len, NULL)) { RADIUS_DEBUG("Invalid Message-Authenticator from %s", abuf); data->counters.bad_authenticators++; client->counters.bad_authenticators++; goto fail; } if (radius_server_request(data, msg, (struct sockaddr *) &from, fromlen, client, abuf, from_port, NULL) == -2) return; /* msg was stored with the session */ fail: radius_msg_free(msg); os_free(buf); } static void radius_server_receive_acct(int sock, void *eloop_ctx, void *sock_ctx) { struct radius_server_data *data = eloop_ctx; u8 *buf = NULL; union { struct sockaddr_storage ss; struct sockaddr_in sin; #ifdef CONFIG_IPV6 struct sockaddr_in6 sin6; #endif /* CONFIG_IPV6 */ } from; socklen_t fromlen; int len, res; struct radius_client *client = NULL; struct radius_msg *msg = NULL, *resp = NULL; char abuf[50]; int from_port = 0; struct radius_hdr *hdr; struct wpabuf *rbuf; buf = os_malloc(RADIUS_MAX_MSG_LEN); if (buf == NULL) { goto fail; } fromlen = sizeof(from); len = recvfrom(sock, buf, RADIUS_MAX_MSG_LEN, 0, (struct sockaddr *) &from.ss, &fromlen); if (len < 0) { wpa_printf(MSG_INFO, "recvfrom[radius_server]: %s", strerror(errno)); goto fail; } #ifdef CONFIG_IPV6 if (data->ipv6) { if (inet_ntop(AF_INET6, &from.sin6.sin6_addr, abuf, sizeof(abuf)) == NULL) abuf[0] = '\0'; from_port = ntohs(from.sin6.sin6_port); RADIUS_DEBUG("Received %d bytes from %s:%d", len, abuf, from_port); client = radius_server_get_client(data, (struct in_addr *) &from.sin6.sin6_addr, 1); } #endif /* CONFIG_IPV6 */ if (!data->ipv6) { os_strlcpy(abuf, inet_ntoa(from.sin.sin_addr), sizeof(abuf)); from_port = ntohs(from.sin.sin_port); RADIUS_DEBUG("Received %d bytes from %s:%d", len, abuf, from_port); client = radius_server_get_client(data, &from.sin.sin_addr, 0); } RADIUS_DUMP("Received data", buf, len); if (client == NULL) { RADIUS_DEBUG("Unknown client %s - packet ignored", abuf); data->counters.invalid_acct_requests++; goto fail; } msg = radius_msg_parse(buf, len); if (msg == NULL) { RADIUS_DEBUG("Parsing incoming RADIUS frame failed"); data->counters.malformed_acct_requests++; client->counters.malformed_acct_requests++; goto fail; } os_free(buf); buf = NULL; if (wpa_debug_level <= MSG_MSGDUMP) { radius_msg_dump(msg); } if (radius_msg_get_hdr(msg)->code != RADIUS_CODE_ACCOUNTING_REQUEST) { RADIUS_DEBUG("Unexpected RADIUS code %d", radius_msg_get_hdr(msg)->code); data->counters.unknown_acct_types++; client->counters.unknown_acct_types++; goto fail; } data->counters.acct_requests++; client->counters.acct_requests++; if (radius_msg_verify_acct_req(msg, (u8 *) client->shared_secret, client->shared_secret_len)) { RADIUS_DEBUG("Invalid Authenticator from %s", abuf); data->counters.acct_bad_authenticators++; client->counters.acct_bad_authenticators++; goto fail; } /* TODO: Write accounting information to a file or database */ hdr = radius_msg_get_hdr(msg); resp = radius_msg_new(RADIUS_CODE_ACCOUNTING_RESPONSE, hdr->identifier); if (resp == NULL) goto fail; radius_msg_finish_acct_resp(resp, (u8 *) client->shared_secret, client->shared_secret_len, hdr->authenticator); RADIUS_DEBUG("Reply to %s:%d", abuf, from_port); if (wpa_debug_level <= MSG_MSGDUMP) { radius_msg_dump(resp); } rbuf = radius_msg_get_buf(resp); data->counters.acct_responses++; client->counters.acct_responses++; res = sendto(data->acct_sock, wpabuf_head(rbuf), wpabuf_len(rbuf), 0, (struct sockaddr *) &from.ss, fromlen); if (res < 0) { wpa_printf(MSG_INFO, "sendto[RADIUS SRV]: %s", strerror(errno)); } fail: radius_msg_free(resp); radius_msg_free(msg); os_free(buf); } static int radius_server_disable_pmtu_discovery(int s) { int r = -1; #if defined(IP_MTU_DISCOVER) && defined(IP_PMTUDISC_DONT) /* Turn off Path MTU discovery on IPv4/UDP sockets. */ int action = IP_PMTUDISC_DONT; r = setsockopt(s, IPPROTO_IP, IP_MTU_DISCOVER, &action, sizeof(action)); if (r == -1) wpa_printf(MSG_ERROR, "Failed to set IP_MTU_DISCOVER: " "%s", strerror(errno)); #endif return r; } static int radius_server_open_socket(int port) { int s; struct sockaddr_in addr; s = socket(PF_INET, SOCK_DGRAM, 0); if (s < 0) { wpa_printf(MSG_INFO, "RADIUS: socket: %s", strerror(errno)); return -1; } radius_server_disable_pmtu_discovery(s); os_memset(&addr, 0, sizeof(addr)); addr.sin_family = AF_INET; addr.sin_port = htons(port); if (bind(s, (struct sockaddr *) &addr, sizeof(addr)) < 0) { wpa_printf(MSG_INFO, "RADIUS: bind: %s", strerror(errno)); close(s); return -1; } return s; } #ifdef CONFIG_IPV6 static int radius_server_open_socket6(int port) { int s; struct sockaddr_in6 addr; s = socket(PF_INET6, SOCK_DGRAM, 0); if (s < 0) { wpa_printf(MSG_INFO, "RADIUS: socket[IPv6]: %s", strerror(errno)); return -1; } os_memset(&addr, 0, sizeof(addr)); addr.sin6_family = AF_INET6; os_memcpy(&addr.sin6_addr, &in6addr_any, sizeof(in6addr_any)); addr.sin6_port = htons(port); if (bind(s, (struct sockaddr *) &addr, sizeof(addr)) < 0) { wpa_printf(MSG_INFO, "RADIUS: bind: %s", strerror(errno)); close(s); return -1; } return s; } #endif /* CONFIG_IPV6 */ static void radius_server_free_sessions(struct radius_server_data *data, struct radius_session *sessions) { struct radius_session *session, *prev; session = sessions; while (session) { prev = session; session = session->next; radius_server_session_free(data, prev); } } static void radius_server_free_clients(struct radius_server_data *data, struct radius_client *clients) { struct radius_client *client, *prev; client = clients; while (client) { prev = client; client = client->next; radius_server_free_sessions(data, prev->sessions); os_free(prev->shared_secret); os_free(prev); } } static struct radius_client * radius_server_read_clients(const char *client_file, int ipv6) { FILE *f; const int buf_size = 1024; char *buf, *pos; struct radius_client *clients, *tail, *entry; int line = 0, mask, failed = 0, i; struct in_addr addr; #ifdef CONFIG_IPV6 struct in6_addr addr6; #endif /* CONFIG_IPV6 */ unsigned int val; f = fopen(client_file, "r"); if (f == NULL) { RADIUS_ERROR("Could not open client file '%s'", client_file); return NULL; } buf = os_malloc(buf_size); if (buf == NULL) { fclose(f); return NULL; } clients = tail = NULL; while (fgets(buf, buf_size, f)) { /* Configuration file format: * 192.168.1.0/24 secret * 192.168.1.2 secret * fe80::211:22ff:fe33:4455/64 secretipv6 */ line++; buf[buf_size - 1] = '\0'; pos = buf; while (*pos != '\0' && *pos != '\n') pos++; if (*pos == '\n') *pos = '\0'; if (*buf == '\0' || *buf == '#') continue; pos = buf; while ((*pos >= '0' && *pos <= '9') || *pos == '.' || (*pos >= 'a' && *pos <= 'f') || *pos == ':' || (*pos >= 'A' && *pos <= 'F')) { pos++; } if (*pos == '\0') { failed = 1; break; } if (*pos == '/') { char *end; *pos++ = '\0'; mask = strtol(pos, &end, 10); if ((pos == end) || (mask < 0 || mask > (ipv6 ? 128 : 32))) { failed = 1; break; } pos = end; } else { mask = ipv6 ? 128 : 32; *pos++ = '\0'; } if (!ipv6 && inet_aton(buf, &addr) == 0) { failed = 1; break; } #ifdef CONFIG_IPV6 if (ipv6 && inet_pton(AF_INET6, buf, &addr6) <= 0) { if (inet_pton(AF_INET, buf, &addr) <= 0) { failed = 1; break; } /* Convert IPv4 address to IPv6 */ if (mask <= 32) mask += (128 - 32); os_memset(addr6.s6_addr, 0, 10); addr6.s6_addr[10] = 0xff; addr6.s6_addr[11] = 0xff; os_memcpy(addr6.s6_addr + 12, (char *) &addr.s_addr, 4); } #endif /* CONFIG_IPV6 */ while (*pos == ' ' || *pos == '\t') { pos++; } if (*pos == '\0') { failed = 1; break; } entry = os_zalloc(sizeof(*entry)); if (entry == NULL) { failed = 1; break; } entry->shared_secret = os_strdup(pos); if (entry->shared_secret == NULL) { failed = 1; os_free(entry); break; } entry->shared_secret_len = os_strlen(entry->shared_secret); if (!ipv6) { entry->addr.s_addr = addr.s_addr; val = 0; for (i = 0; i < mask; i++) val |= 1 << (31 - i); entry->mask.s_addr = htonl(val); } #ifdef CONFIG_IPV6 if (ipv6) { int offset = mask / 8; os_memcpy(entry->addr6.s6_addr, addr6.s6_addr, 16); os_memset(entry->mask6.s6_addr, 0xff, offset); val = 0; for (i = 0; i < (mask % 8); i++) val |= 1 << (7 - i); if (offset < 16) entry->mask6.s6_addr[offset] = val; } #endif /* CONFIG_IPV6 */ if (tail == NULL) { clients = tail = entry; } else { tail->next = entry; tail = entry; } } if (failed) { RADIUS_ERROR("Invalid line %d in '%s'", line, client_file); radius_server_free_clients(NULL, clients); clients = NULL; } os_free(buf); fclose(f); return clients; } void radius_reconfigure_clients(int sig, void *signal_ctx){//abcd printf("####################Signal Received and Updated Radius Clients################################\n"); struct radius_clients_reconfig * reconfig = signal_ctx; //printf("###################File Name = %s################################\n",reconfig->client_file); os_free(reconfig->data->clients); reconfig->data->clients = radius_server_read_clients(reconfig->client_file,reconfig->ipv6); } /** * radius_server_init - Initialize RADIUS server * @conf: Configuration for the RADIUS server * Returns: Pointer to private RADIUS server context or %NULL on failure * * This initializes a RADIUS server instance and returns a context pointer that * will be used in other calls to the RADIUS server module. The server can be * deinitialize by calling radius_server_deinit(). */ struct radius_server_data * radius_server_init(struct radius_server_conf *conf) { struct radius_server_data *data; struct radius_clients_reconfig *reconfig; reconfig = os_zalloc(sizeof(*reconfig)); #ifndef CONFIG_IPV6 if (conf->ipv6) { wpa_printf(MSG_ERROR, "RADIUS server compiled without IPv6 support"); return NULL; } #endif /* CONFIG_IPV6 */ data = os_zalloc(sizeof(*data)); if (data == NULL) return NULL; dl_list_init(&data->erp_keys); os_get_reltime(&data->start_time); data->conf_ctx = conf->conf_ctx; data->eap_sim_db_priv = conf->eap_sim_db_priv; data->ssl_ctx = conf->ssl_ctx; data->msg_ctx = conf->msg_ctx; data->ipv6 = conf->ipv6; if (conf->pac_opaque_encr_key) { data->pac_opaque_encr_key = os_malloc(16); if (data->pac_opaque_encr_key) { os_memcpy(data->pac_opaque_encr_key, conf->pac_opaque_encr_key, 16); } } if (conf->eap_fast_a_id) { data->eap_fast_a_id = os_malloc(conf->eap_fast_a_id_len); if (data->eap_fast_a_id) { os_memcpy(data->eap_fast_a_id, conf->eap_fast_a_id, conf->eap_fast_a_id_len); data->eap_fast_a_id_len = conf->eap_fast_a_id_len; } } if (conf->eap_fast_a_id_info) data->eap_fast_a_id_info = os_strdup(conf->eap_fast_a_id_info); data->eap_fast_prov = conf->eap_fast_prov; data->pac_key_lifetime = conf->pac_key_lifetime; data->pac_key_refresh_time = conf->pac_key_refresh_time; data->get_eap_user = conf->get_eap_user; data->eap_sim_aka_result_ind = conf->eap_sim_aka_result_ind; data->tnc = conf->tnc; data->wps = conf->wps; data->pwd_group = conf->pwd_group; data->server_id = conf->server_id; if (conf->eap_req_id_text) { data->eap_req_id_text = os_malloc(conf->eap_req_id_text_len); if (data->eap_req_id_text) { os_memcpy(data->eap_req_id_text, conf->eap_req_id_text, conf->eap_req_id_text_len); data->eap_req_id_text_len = conf->eap_req_id_text_len; } } data->erp = conf->erp; data->erp_domain = conf->erp_domain; data->tls_session_lifetime = conf->tls_session_lifetime; if (conf->subscr_remediation_url) { data->subscr_remediation_url = os_strdup(conf->subscr_remediation_url); } data->subscr_remediation_method = conf->subscr_remediation_method; #ifdef CONFIG_SQLITE if (conf->sqlite_file) { if (sqlite3_open(conf->sqlite_file, &data->db)) { RADIUS_ERROR("Could not open SQLite file '%s'", conf->sqlite_file); radius_server_deinit(data); return NULL; } } #endif /* CONFIG_SQLITE */ #ifdef CONFIG_RADIUS_TEST if (conf->dump_msk_file) data->dump_msk_file = os_strdup(conf->dump_msk_file); #endif /* CONFIG_RADIUS_TEST */ data->clients = radius_server_read_clients(conf->client_file, conf->ipv6); reconfig->client_file = os_strdup(conf->client_file); reconfig->ipv6 = conf->ipv6; reconfig->data = data; eloop_register_signal(SIGUSR2,radius_reconfigure_clients, reconfig); //abcd if (data->clients == NULL) { wpa_printf(MSG_ERROR, "No RADIUS clients configured"); radius_server_deinit(data); return NULL; } #ifdef CONFIG_IPV6 if (conf->ipv6) data->auth_sock = radius_server_open_socket6(conf->auth_port); else #endif /* CONFIG_IPV6 */ data->auth_sock = radius_server_open_socket(conf->auth_port); if (data->auth_sock < 0) { wpa_printf(MSG_ERROR, "Failed to open UDP socket for RADIUS authentication server"); radius_server_deinit(data); return NULL; } if (eloop_register_read_sock(data->auth_sock, radius_server_receive_auth, data, NULL)) { radius_server_deinit(data); return NULL; } if (conf->acct_port) { #ifdef CONFIG_IPV6 if (conf->ipv6) data->acct_sock = radius_server_open_socket6( conf->acct_port); else #endif /* CONFIG_IPV6 */ data->acct_sock = radius_server_open_socket(conf->acct_port); if (data->acct_sock < 0) { wpa_printf(MSG_ERROR, "Failed to open UDP socket for RADIUS accounting server"); radius_server_deinit(data); return NULL; } if (eloop_register_read_sock(data->acct_sock, radius_server_receive_acct, data, NULL)) { radius_server_deinit(data); return NULL; } } else { data->acct_sock = -1; } //raghu #if 0 sqlite3 * servDB; char * sql_error = NULL; if(SQLITE_OK != sqlite3_open_v2(DB_NAME, &servDB, SQLITE_OPEN_READWRITE,NULL)){ printf("RADIUS: No DB found,new DB willbe created\n"); if(SQLITE_OK != sqlite3_open(DB_NAME, &servDB)){ printf("EAP-NOOB: NEW DB creation failed\n"); return 0; } if(SQLITE_OK != sqlite3_exec(servDB, CREATE_RADIUS_TABLE, NULL,NULL, &sql_error)){ printf("radius creation failed %s\n",sql_error); } } #endif return data; } /** * radius_server_erp_flush - Flush all ERP keys * @data: RADIUS server context from radius_server_init() */ void radius_server_erp_flush(struct radius_server_data *data) { struct eap_server_erp_key *erp; if (data == NULL) return; while ((erp = dl_list_first(&data->erp_keys, struct eap_server_erp_key, list)) != NULL) { dl_list_del(&erp->list); bin_clear_free(erp, sizeof(*erp)); } } /** * radius_server_deinit - Deinitialize RADIUS server * @data: RADIUS server context from radius_server_init() */ void radius_server_deinit(struct radius_server_data *data) { if (data == NULL) return; if (data->auth_sock >= 0) { eloop_unregister_read_sock(data->auth_sock); close(data->auth_sock); } if (data->acct_sock >= 0) { eloop_unregister_read_sock(data->acct_sock); close(data->acct_sock); } radius_server_free_clients(data, data->clients); os_free(data->pac_opaque_encr_key); os_free(data->eap_fast_a_id); os_free(data->eap_fast_a_id_info); os_free(data->eap_req_id_text); #ifdef CONFIG_RADIUS_TEST os_free(data->dump_msk_file); #endif /* CONFIG_RADIUS_TEST */ os_free(data->subscr_remediation_url); #ifdef CONFIG_SQLITE if (data->db) sqlite3_close(data->db); #endif /* CONFIG_SQLITE */ radius_server_erp_flush(data); os_free(data); } /** * radius_server_get_mib - Get RADIUS server MIB information * @data: RADIUS server context from radius_server_init() * @buf: Buffer for returning the MIB data in text format * @buflen: buf length in octets * Returns: Number of octets written into buf */ int radius_server_get_mib(struct radius_server_data *data, char *buf, size_t buflen) { int ret, uptime; unsigned int idx; char *end, *pos; struct os_reltime now; struct radius_client *cli; /* RFC 2619 - RADIUS Authentication Server MIB */ if (data == NULL || buflen == 0) return 0; pos = buf; end = buf + buflen; os_get_reltime(&now); uptime = (now.sec - data->start_time.sec) * 100 + ((now.usec - data->start_time.usec) / 10000) % 100; ret = os_snprintf(pos, end - pos, "RADIUS-AUTH-SERVER-MIB\n" "radiusAuthServIdent=hostapd\n" "radiusAuthServUpTime=%d\n" "radiusAuthServResetTime=0\n" "radiusAuthServConfigReset=4\n", uptime); if (os_snprintf_error(end - pos, ret)) { *pos = '\0'; return pos - buf; } pos += ret; ret = os_snprintf(pos, end - pos, "radiusAuthServTotalAccessRequests=%u\n" "radiusAuthServTotalInvalidRequests=%u\n" "radiusAuthServTotalDupAccessRequests=%u\n" "radiusAuthServTotalAccessAccepts=%u\n" "radiusAuthServTotalAccessRejects=%u\n" "radiusAuthServTotalAccessChallenges=%u\n" "radiusAuthServTotalMalformedAccessRequests=%u\n" "radiusAuthServTotalBadAuthenticators=%u\n" "radiusAuthServTotalPacketsDropped=%u\n" "radiusAuthServTotalUnknownTypes=%u\n" "radiusAccServTotalRequests=%u\n" "radiusAccServTotalInvalidRequests=%u\n" "radiusAccServTotalResponses=%u\n" "radiusAccServTotalMalformedRequests=%u\n" "radiusAccServTotalBadAuthenticators=%u\n" "radiusAccServTotalUnknownTypes=%u\n", data->counters.access_requests, data->counters.invalid_requests, data->counters.dup_access_requests, data->counters.access_accepts, data->counters.access_rejects, data->counters.access_challenges, data->counters.malformed_access_requests, data->counters.bad_authenticators, data->counters.packets_dropped, data->counters.unknown_types, data->counters.acct_requests, data->counters.invalid_acct_requests, data->counters.acct_responses, data->counters.malformed_acct_requests, data->counters.acct_bad_authenticators, data->counters.unknown_acct_types); if (os_snprintf_error(end - pos, ret)) { *pos = '\0'; return pos - buf; } pos += ret; for (cli = data->clients, idx = 0; cli; cli = cli->next, idx++) { char abuf[50], mbuf[50]; #ifdef CONFIG_IPV6 if (data->ipv6) { if (inet_ntop(AF_INET6, &cli->addr6, abuf, sizeof(abuf)) == NULL) abuf[0] = '\0'; if (inet_ntop(AF_INET6, &cli->mask6, mbuf, sizeof(mbuf)) == NULL) mbuf[0] = '\0'; } #endif /* CONFIG_IPV6 */ if (!data->ipv6) { os_strlcpy(abuf, inet_ntoa(cli->addr), sizeof(abuf)); os_strlcpy(mbuf, inet_ntoa(cli->mask), sizeof(mbuf)); } ret = os_snprintf(pos, end - pos, "radiusAuthClientIndex=%u\n" "radiusAuthClientAddress=%s/%s\n" "radiusAuthServAccessRequests=%u\n" "radiusAuthServDupAccessRequests=%u\n" "radiusAuthServAccessAccepts=%u\n" "radiusAuthServAccessRejects=%u\n" "radiusAuthServAccessChallenges=%u\n" "radiusAuthServMalformedAccessRequests=%u\n" "radiusAuthServBadAuthenticators=%u\n" "radiusAuthServPacketsDropped=%u\n" "radiusAuthServUnknownTypes=%u\n" "radiusAccServTotalRequests=%u\n" "radiusAccServTotalInvalidRequests=%u\n" "radiusAccServTotalResponses=%u\n" "radiusAccServTotalMalformedRequests=%u\n" "radiusAccServTotalBadAuthenticators=%u\n" "radiusAccServTotalUnknownTypes=%u\n", idx, abuf, mbuf, cli->counters.access_requests, cli->counters.dup_access_requests, cli->counters.access_accepts, cli->counters.access_rejects, cli->counters.access_challenges, cli->counters.malformed_access_requests, cli->counters.bad_authenticators, cli->counters.packets_dropped, cli->counters.unknown_types, cli->counters.acct_requests, cli->counters.invalid_acct_requests, cli->counters.acct_responses, cli->counters.malformed_acct_requests, cli->counters.acct_bad_authenticators, cli->counters.unknown_acct_types); if (os_snprintf_error(end - pos, ret)) { *pos = '\0'; return pos - buf; } pos += ret; } return pos - buf; } static int radius_server_get_eap_user(void *ctx, const u8 *identity, size_t identity_len, int phase2, struct eap_user *user) { struct radius_session *sess = ctx; struct radius_server_data *data = sess->server; int ret; ret = data->get_eap_user(data->conf_ctx, identity, identity_len, phase2, user); if (ret == 0 && user) { sess->accept_attr = user->accept_attr; sess->remediation = user->remediation; sess->macacl = user->macacl; } if (ret) { RADIUS_DEBUG("%s: User-Name not found from user database", __func__); } return ret; } static const char * radius_server_get_eap_req_id_text(void *ctx, size_t *len) { struct radius_session *sess = ctx; struct radius_server_data *data = sess->server; *len = data->eap_req_id_text_len; return data->eap_req_id_text; } static void radius_server_log_msg(void *ctx, const char *msg) { struct radius_session *sess = ctx; srv_log(sess, "EAP: %s", msg); } #ifdef CONFIG_ERP static const char * radius_server_get_erp_domain(void *ctx) { struct radius_session *sess = ctx; struct radius_server_data *data = sess->server; return data->erp_domain; } static struct eap_server_erp_key * radius_server_erp_get_key(void *ctx, const char *keyname) { struct radius_session *sess = ctx; struct radius_server_data *data = sess->server; struct eap_server_erp_key *erp; dl_list_for_each(erp, &data->erp_keys, struct eap_server_erp_key, list) { if (os_strcmp(erp->keyname_nai, keyname) == 0) return erp; } return NULL; } static int radius_server_erp_add_key(void *ctx, struct eap_server_erp_key *erp) { struct radius_session *sess = ctx; struct radius_server_data *data = sess->server; dl_list_add(&data->erp_keys, &erp->list); return 0; } #endif /* CONFIG_ERP */ static const struct eapol_callbacks radius_server_eapol_cb = { .get_eap_user = radius_server_get_eap_user, .get_eap_req_id_text = radius_server_get_eap_req_id_text, .log_msg = radius_server_log_msg, #ifdef CONFIG_ERP .get_erp_send_reauth_start = NULL, .get_erp_domain = radius_server_get_erp_domain, .erp_get_key = radius_server_erp_get_key, .erp_add_key = radius_server_erp_add_key, #endif /* CONFIG_ERP */ }; /** * radius_server_eap_pending_cb - Pending EAP data notification * @data: RADIUS server context from radius_server_init() * @ctx: Pending EAP context pointer * * This function is used to notify EAP server module that a pending operation * has been completed and processing of the EAP session can proceed. */ void radius_server_eap_pending_cb(struct radius_server_data *data, void *ctx) { struct radius_client *cli; struct radius_session *s, *sess = NULL; struct radius_msg *msg; if (data == NULL) return; for (cli = data->clients; cli; cli = cli->next) { for (s = cli->sessions; s; s = s->next) { if (s->eap == ctx && s->last_msg) { sess = s; break; } } if (sess) break; } if (sess == NULL) { RADIUS_DEBUG("No session matched callback ctx"); return; } msg = sess->last_msg; sess->last_msg = NULL; eap_sm_pending_cb(sess->eap); if (radius_server_request(data, msg, (struct sockaddr *) &sess->last_from, sess->last_fromlen, cli, sess->last_from_addr, sess->last_from_port, sess) == -2) return; /* msg was stored with the session */ radius_msg_free(msg); } <|start_filename|>wpa_supplicant-2.6/src/eap_peer/eap_noob.c<|end_filename|> /* * EAP server method: EAP-NOOB * Copyright (c) 2016, Aalto University * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Aalto University nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AALTO UNIVERSITY BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * See CONTRIBUTORS for more information. */ #include <openssl/err.h> #include <openssl/rand.h> #include <openssl/obj_mac.h> #include <openssl/evp.h> #include <openssl/ec.h> #include <openssl/buffer.h> #include <openssl/bio.h> #include <openssl/hmac.h> #include <openssl/x509.h> #include <openssl/pem.h> #include <signal.h> #include <stdio.h> #include <time.h> #include <unistd.h> #include <string.h> #include <sqlite3.h> #include <jansson.h> #include "common.h" #include "eap_i.h" #include "eap_noob.h" #include "../../wpa_supplicant/config.h" #include "../../wpa_supplicant/wpa_supplicant_i.h" #include "../../wpa_supplicant/blacklist.h" static struct eap_noob_globle_conf eap_noob_globle_conf = {0}; void * os_memdup(const void *src, size_t len) { void *r = os_malloc(len); if (!r) return NULL; os_memcpy(r, src, len); return r; } /** * eap_noob_Base64Decode : Decodes a base64url string. * @b64message : input base64url string * @buffer : output * Returns : Len of decoded string **/ static int eap_noob_Base64Decode(const char * b64message, unsigned char ** buffer) { BIO * bio = NULL, * b64 = NULL; int decodeLen = 0, len = 0; char * temp = NULL; int i; if (NULL == b64message || NULL == buffer) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Input to %s is null", __func__); return 0; } wpa_printf(MSG_DEBUG, "EAP-NOOB: Entering %s", __func__); len = os_strlen(b64message); /* Convert base64url to base64 encoding. */ int b64pad = 4*((len+3)/4)-len; temp = os_zalloc(len + b64pad); os_memcpy(temp, b64message, len); if (b64pad == 3) { wpa_printf(MSG_DEBUG, "EAP-NOOB Input to %s is incorrect", __func__); return 0; } for (i=0; i < len; i++) { if (temp[i] == '-') temp[i] = '+'; else if (temp[i] == '_') temp[i] = '/'; } for (i=0; i<b64pad; i++) temp[len+i] = '='; decodeLen = (len * 3)/4; *buffer = (unsigned char*)os_zalloc(decodeLen); bio = BIO_new_mem_buf(temp, len+b64pad); b64 = BIO_new(BIO_f_base64()); bio = BIO_push(b64, bio); BIO_set_flags(bio, BIO_FLAGS_BASE64_NO_NL); len = BIO_read(bio, *buffer, os_strlen(b64message)); wpa_printf(MSG_DEBUG, "EAP NOOB: Dumping BIO errors, if any"); ERR_print_errors_fp(stdout); /* Length should equal decodeLen, else something goes horribly wrong */ if (len != decodeLen) { wpa_printf(MSG_DEBUG, "EAP-NOOB Unexpected error decoding message. Decoded len (%d)," " expected (%d), input b64message len (%d)", len, decodeLen, (int)os_strlen(b64message)); decodeLen = 0; os_free(*buffer); *buffer = NULL; } os_free(temp); BIO_free_all(bio); return decodeLen; } /** * eap_noob_Base64Encode : Encode an ascii string to base64url. Dealloc b64text * as needed from the caller. * @buffer : input buffer * @length : input buffer length * @b64text : converted base64url text * Returns : SUCCESS/FAILURE **/ int eap_noob_Base64Encode(const unsigned char * buffer, size_t length, char ** b64text) { BIO * bio = NULL, * b64 = NULL; BUF_MEM * bufferPtr = NULL; int i = 0; if (NULL == buffer || NULL == b64text) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Input to %s is null", __func__); return 0; } wpa_printf(MSG_DEBUG, "EAP-NOOB: Entering function %s", __func__); b64 = BIO_new(BIO_f_base64()); bio = BIO_new(BIO_s_mem()); bio = BIO_push(b64, bio); BIO_set_flags(bio, BIO_FLAGS_BASE64_NO_NL); BIO_write(bio, buffer, length); BIO_flush(bio); BIO_get_mem_ptr(bio, &bufferPtr); BIO_set_close(bio, BIO_NOCLOSE); int outlen = bufferPtr->length; *b64text = (char *) os_zalloc(outlen + 1); os_memcpy(*b64text, bufferPtr->data, outlen); (*b64text)[outlen] = '\0'; /* Convert base64 to base64url encoding. */ while (outlen > 0 && (*b64text)[outlen - 1]=='=') { (*b64text)[outlen - 1] = '\0'; outlen--; } for (i = 0; i < outlen; i++) { if ((*b64text)[i] == '+') (*b64text)[i] = '-'; else if ((*b64text)[i] == '/') (*b64text)[i] = '_'; } BIO_free_all(bio); return SUCCESS; } /** *eap_noob_ECDH_KDF_X9_63: generates KDF *@out: *@outlen: * Z: * Zlen: * alorithm_id: * alorithm_id_len: * partyUinfo: * partyUinfo_len: * partyVinfo: * partyVinfo_len * suppPrivinfo: * suppPrivinfo_len: * EVP_MD: * Returns: **/ static int eap_noob_ECDH_KDF_X9_63(unsigned char *out, size_t outlen, const unsigned char * Z, size_t Zlen, const unsigned char * algorithm_id, size_t algorithm_id_len, const unsigned char * partyUinfo, size_t partyUinfo_len, const unsigned char * partyVinfo, size_t partyVinfo_len, const unsigned char * suppPrivinfo, size_t suppPrivinfo_len, const EVP_MD * md) { EVP_MD_CTX * mctx = NULL; unsigned char ctr[4] = {0}; unsigned int i = 0; size_t mdlen = 0; int rv = 0; wpa_printf(MSG_DEBUG, "EAP-NOOB: KDF start"); wpa_hexdump_ascii(MSG_DEBUG, "EAP-NOOB: Value:", Z, Zlen); if (algorithm_id_len > ECDH_KDF_MAX || outlen > ECDH_KDF_MAX || Zlen > ECDH_KDF_MAX || partyUinfo_len > ECDH_KDF_MAX || partyVinfo_len > ECDH_KDF_MAX || suppPrivinfo_len > ECDH_KDF_MAX) return 0; mctx = EVP_MD_CTX_create(); if (mctx == NULL) return 0; mdlen = EVP_MD_size(md); wpa_printf(MSG_DEBUG,"EAP-NOOB: KDF begin %d", (int)mdlen); for (i = 1;; i++) { unsigned char mtmp[EVP_MAX_MD_SIZE]; EVP_DigestInit_ex(mctx, md, NULL); ctr[3] = (i & 0xFF); ctr[2] = ((i >> 8) & 0xFF); ctr[1] = ((i >> 16) & 0xFF); ctr[0] = (i >> 24); if (!EVP_DigestUpdate(mctx, ctr, sizeof(ctr))) goto err; if (!EVP_DigestUpdate(mctx, Z, Zlen)) goto err; if (!EVP_DigestUpdate(mctx, algorithm_id, algorithm_id_len)) goto err; if (!EVP_DigestUpdate(mctx, partyUinfo, partyUinfo_len)) goto err; if (!EVP_DigestUpdate(mctx, partyVinfo, partyVinfo_len)) goto err; if (suppPrivinfo != NULL) if (!EVP_DigestUpdate(mctx, suppPrivinfo, suppPrivinfo_len)) goto err; if (outlen >= mdlen) { if (!EVP_DigestFinal(mctx, out, NULL)) goto err; outlen -= mdlen; if (outlen == 0) break; out += mdlen; } else { if (!EVP_DigestFinal(mctx, mtmp, NULL)) goto err; memcpy(out, mtmp, outlen); OPENSSL_cleanse(mtmp, mdlen); break; } } rv = 1; err: wpa_printf(MSG_DEBUG,"EAP-NOOB:KDF finished %d",rv); EVP_MD_CTX_destroy(mctx); return rv; } /** * eap_noob_gen_KDF : generates and updates the KDF inside the peer context. * @data : peer context. * @state : EAP_NOOB state * Returns: **/ static int eap_noob_gen_KDF(struct eap_noob_peer_context * data, int state) { const EVP_MD * md = EVP_sha256(); unsigned char * out = os_zalloc(KDF_LEN); int counter = 0, len = 0; u8 * Noob; wpa_hexdump_ascii(MSG_DEBUG, "EAP-NOOB: Algorith ID:", ALGORITHM_ID,ALGORITHM_ID_LEN); wpa_hexdump_ascii(MSG_DEBUG, "EAP-NOOB: Nonce_Peer", data->server_attr->kdf_nonce_data->Np, NONCE_LEN); wpa_hexdump_ascii(MSG_DEBUG, "EAP-NOOB: Nonce_Serv", data->server_attr->kdf_nonce_data->Ns, NONCE_LEN); wpa_hexdump_ascii(MSG_DEBUG, "EAP-NOOB: Shared Key", data->server_attr->ecdh_exchange_data->shared_key, ECDH_SHARED_SECRET_LEN); if (state == COMPLETION_EXCHANGE) { len = eap_noob_Base64Decode(data->server_attr->oob_data->Noob_b64, &Noob); if (len != NOOB_LEN) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Failed to decode Noob"); return FAILURE; } wpa_hexdump_ascii(MSG_DEBUG,"EAP-NOOB: Noob", Noob, NOOB_LEN); eap_noob_ECDH_KDF_X9_63(out, KDF_LEN, data->server_attr->ecdh_exchange_data->shared_key, ECDH_SHARED_SECRET_LEN, (unsigned char *)ALGORITHM_ID, ALGORITHM_ID_LEN, data->server_attr->kdf_nonce_data->Np, NONCE_LEN, data->server_attr->kdf_nonce_data->Ns, NONCE_LEN, Noob, NOOB_LEN, md); } else { wpa_hexdump_ascii(MSG_DEBUG,"EAP-NOOB: kz", data->peer_attr->Kz,KZ_LEN); eap_noob_ECDH_KDF_X9_63(out, KDF_LEN, data->peer_attr->Kz, KZ_LEN, (unsigned char *)ALGORITHM_ID, ALGORITHM_ID_LEN, data->server_attr->kdf_nonce_data->Np, NONCE_LEN, data->server_attr->kdf_nonce_data->Ns, NONCE_LEN, NULL, 0, md); } wpa_hexdump_ascii(MSG_DEBUG,"EAP-NOOB: KDF",out,KDF_LEN); if (out != NULL) { data->server_attr->kdf_out->msk = os_zalloc(MSK_LEN); data->server_attr->kdf_out->emsk = os_zalloc(EMSK_LEN); data->server_attr->kdf_out->amsk = os_zalloc(AMSK_LEN); data->server_attr->kdf_out->MethodId = os_zalloc(METHOD_ID_LEN); data->server_attr->kdf_out->Kms = os_zalloc(KMS_LEN); data->server_attr->kdf_out->Kmp = os_zalloc(KMP_LEN); data->server_attr->kdf_out->Kz = os_zalloc(KZ_LEN); memcpy(data->server_attr->kdf_out->msk,out,MSK_LEN); counter += MSK_LEN; memcpy(data->server_attr->kdf_out->emsk, out + counter, EMSK_LEN); counter += EMSK_LEN; memcpy(data->server_attr->kdf_out->amsk, out + counter, AMSK_LEN); counter += AMSK_LEN; memcpy(data->server_attr->kdf_out->MethodId, out + counter, METHOD_ID_LEN); counter += METHOD_ID_LEN; memcpy(data->server_attr->kdf_out->Kms, out + counter, KMS_LEN); counter += KMS_LEN; memcpy(data->server_attr->kdf_out->Kmp, out + counter, KMP_LEN); counter += KMP_LEN; memcpy(data->server_attr->kdf_out->Kz, out + counter, KZ_LEN); //Copy it to the peer_context also. Kz is used reconnect exchange. if(state == COMPLETION_EXCHANGE) { data->peer_attr->Kz = os_zalloc(KZ_LEN); memcpy(data->peer_attr->Kz, out + counter, KZ_LEN); } counter += KZ_LEN; } else { wpa_printf(MSG_DEBUG, "EAP-NOOB: Error in allocating memory, %s", __func__); return FAILURE; } return SUCCESS; } /** * eap_noob_prepare_peer_info_json : Create a Json object for peer information. * @data : peer context. * returns : reference to a new object or NULL. **/ static json_t * eap_noob_prepare_peer_info_json(struct eap_sm * sm, struct eap_noob_peer_config_params * data) { json_t * info_obj = NULL; struct wpa_supplicant * wpa_s = (struct wpa_supplicant *) sm->msg_ctx; char bssid[18] = {0}; int err = 0; if (NULL == data) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Input arguments NULL for function %s",__func__); return NULL; } err -= (NULL == (info_obj = json_object())); err += json_object_set_new(info_obj, PEER_MAKE,json_string(data->Peer_name)); err += json_object_set_new(info_obj, PEER_TYPE,json_string(eap_noob_globle_conf.peer_type)); err += json_object_set_new(info_obj, PEER_SERIAL_NUM,json_string(data->Peer_ID_Num)); err += json_object_set_new(info_obj, PEER_SSID,json_string((char *)wpa_s->current_ssid->ssid)); sprintf(bssid,"%x:%x:%x:%x:%x:%x",wpa_s->current_ssid->bssid[0],wpa_s->current_ssid->bssid[1], wpa_s->current_ssid->bssid[2],wpa_s->current_ssid->bssid[3],wpa_s->current_ssid->bssid[4], wpa_s->current_ssid->bssid[5]); err += json_object_set_new(info_obj,PEER_BSSID,json_string(bssid)); if (err < 0) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Unexpected error in preparing jon object"); json_decref(info_obj); return NULL; } return info_obj; } /** * eap_noob_db_statements : execute one or more sql statements that do not return rows * @db : open sqlite3 database handle * @query : query to be executed * Returns : SUCCESS/FAILURE **/ static int eap_noob_db_statements(sqlite3 * db, const char * query) { int nByte = os_strlen(query); sqlite3_stmt * stmt; const char * tail = query, * sql_error; int ret = SUCCESS; if (NULL == db || NULL == query) return FAILURE; wpa_printf(MSG_DEBUG, "EAP-NOOB: Entering %s",__func__); /* Loop through multiple SQL statements in sqlite3 */ while (tail < query + nByte) { if (SQLITE_OK != sqlite3_prepare_v2(db, tail, -1, &stmt, &tail) || NULL == stmt) { ret = FAILURE; goto EXIT; } if (SQLITE_DONE != sqlite3_step(stmt)) { ret = FAILURE; goto EXIT; } } EXIT: if (ret == FAILURE) { sql_error = sqlite3_errmsg(db); if (sql_error != NULL) wpa_printf(MSG_DEBUG,"EAP-NOOB: SQL error : %s", sql_error); } if (stmt) sqlite3_finalize(stmt); wpa_printf(MSG_DEBUG, "EAP-NOOB: Exiting %s, ret %d",__func__, ret); return ret; } static int eap_noob_encode_vers_cryptosuites(struct eap_noob_peer_context * data, json_t ** Vers, json_t ** Cryptosuites) { int err = 0; if (NULL == Vers || NULL == Cryptosuites) return FAILURE; err -= (NULL == (*Vers = json_array())); for (int i = 0; i < MAX_SUP_VER; ++i) { err += json_array_append_new(*Vers, json_integer(data->server_attr->version[i])); } err -= (NULL == (*Cryptosuites = json_array())); for (int i = 0; i < MAX_SUP_CSUITES ; i++) { err += json_array_append_new(*Cryptosuites, json_integer(data->server_attr->cryptosuite[i])); } if (err < 0) { json_decref(*Vers); json_decref(*Cryptosuites); return FAILURE; } return SUCCESS; } static void eap_noob_decode_vers_cryptosuites(struct eap_noob_peer_context * data, const char * Vers, const char * Cryptosuites) { json_t * Vers_obj, * Cryptosuites_obj, * value; json_error_t error; int err = 0; size_t indx; err -= (NULL == (Vers_obj = json_loads(Vers, JSON_COMPACT|JSON_PRESERVE_ORDER, &error))); err -= (NULL == (Cryptosuites_obj = json_loads(Cryptosuites, JSON_COMPACT|JSON_PRESERVE_ORDER, &error))); if (err < 0) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Unexpected error in allocating json objects"); return; } json_array_foreach(Vers_obj, indx, value) data->server_attr->version[indx] = json_integer_value(value); json_array_foreach(Cryptosuites_obj, indx, value) data->server_attr->cryptosuite[indx] = json_integer_value(value); } static void columns_persistentstate(struct eap_noob_peer_context * data, sqlite3_stmt * stmt) { char * Vers, * Cryptosuites; data->server_attr->ssid = os_strdup((char *)sqlite3_column_text(stmt, 0)); data->server_attr->PeerId = os_strdup((char *)sqlite3_column_text(stmt, 1)); data->peer_attr->PeerId = os_strdup(data->server_attr->PeerId); Vers = os_strdup((char *)sqlite3_column_text(stmt, 2)); Cryptosuites = os_strdup((char *)sqlite3_column_text(stmt, 3)); data->server_attr->Realm = os_strdup((char *) sqlite3_column_text(stmt, 4)); data->peer_attr->Realm = os_strdup(data->server_attr->Realm); data->peer_attr->Kz = os_memdup(sqlite3_column_blob(stmt,5), KZ_LEN); eap_noob_decode_vers_cryptosuites(data, Vers, Cryptosuites); data->server_attr->state = data->peer_attr->state = RECONNECTING_STATE; } static void columns_ephemeralstate(struct eap_noob_peer_context * data, sqlite3_stmt * stmt) { char * Vers, * Cryptosuites; data->server_attr->ssid = os_strdup((char *)sqlite3_column_text(stmt, 0)); data->server_attr->PeerId = os_strdup((char *) sqlite3_column_text(stmt, 1)); data->peer_attr->PeerId = os_strdup(data->server_attr->PeerId); Vers = os_strdup((char *)sqlite3_column_text(stmt, 2)); Cryptosuites = os_strdup((char *)sqlite3_column_text(stmt, 3)); data->server_attr->Realm = os_strdup((char *) sqlite3_column_text(stmt, 4)); data->peer_attr->Realm = os_strdup(data->server_attr->Realm); data->server_attr->dir = sqlite3_column_int(stmt, 5); data->server_attr->server_info = os_strdup((char *) sqlite3_column_text(stmt, 6)); data->server_attr->kdf_nonce_data->Ns = os_memdup(sqlite3_column_blob(stmt, 7), NONCE_LEN); data->server_attr->kdf_nonce_data->Np = os_memdup(sqlite3_column_blob(stmt, 8), NONCE_LEN); data->server_attr->ecdh_exchange_data->shared_key = os_memdup(sqlite3_column_blob(stmt, 9), ECDH_SHARED_SECRET_LEN) ; data->server_attr->mac_input_str = os_strdup((char *) sqlite3_column_text(stmt, 10)); //data->server_attr->creation_time = (uint64_t) sqlite3_column_int64(stmt, 11); data->server_attr->err_code = sqlite3_column_int(stmt, 12); data->server_attr->state = sqlite3_column_int(stmt, 13); eap_noob_decode_vers_cryptosuites(data, Vers, Cryptosuites); } static void columns_ephemeralnoob(struct eap_noob_peer_context * data, sqlite3_stmt * stmt) { data->server_attr->ssid = os_strdup((char *)sqlite3_column_text(stmt, 0)); data->server_attr->PeerId = os_strdup((char *) sqlite3_column_text(stmt, 1)); data->peer_attr->PeerId = os_strdup(data->server_attr->PeerId); data->server_attr->oob_data->NoobId_b64 = os_strdup((char *)sqlite3_column_text(stmt, 2)); data->server_attr->oob_data->Noob_b64 = os_strdup((char *)sqlite3_column_text(stmt, 3)); data->server_attr->oob_data->Hoob_b64 = os_strdup((char *)sqlite3_column_text(stmt, 4)); //sent time } /** * eap_noob_gen_MAC : generate a HMAC for user authentication. * @data : peer context * type : MAC type * @key : key to generate MAC * @keylen: key length * Returns : MAC on success or NULL on error. **/ static u8 * eap_noob_gen_MAC(const struct eap_noob_peer_context * data, int type, u8 * key, int keylen, int state) { u8 * mac = NULL; int err = 0; json_t * mac_array, * emptystr = json_string(""); json_error_t error; char * mac_str = os_zalloc(500); if(state == RECONNECT_EXCHANGE) { data->server_attr->mac_input_str = json_dumps(data->server_attr->mac_input, JSON_COMPACT|JSON_PRESERVE_ORDER); } if (NULL == data || NULL == data->server_attr || NULL == data->server_attr->mac_input_str || NULL == key) return NULL; err -= (NULL == (mac_array = json_loads(data->server_attr->mac_input_str, JSON_COMPACT|JSON_PRESERVE_ORDER, &error))); if (type == MACS_TYPE) err += json_array_set_new(mac_array, 0, json_integer(2)); else err += json_array_set_new(mac_array, 0, json_integer(1)); if(state == RECONNECT_EXCHANGE) { err += json_array_append_new(mac_array, emptystr); } else { err += json_array_append_new(mac_array, json_string(data->server_attr->oob_data->Noob_b64)); } err -= (NULL == (mac_str = json_dumps(mac_array, JSON_COMPACT|JSON_PRESERVE_ORDER))); if (err < 0) wpa_printf(MSG_DEBUG, "EAP-NOOB: Unexpected error in setting MAC"); wpa_printf(MSG_DEBUG, "EAP-NOOB: Func (%s), MAC len = %d, MAC = %s", __func__, (int)os_strlen(mac_str), mac_str); wpa_hexdump_ascii(MSG_DEBUG, "EAP-NOOB: Key:", key, keylen); mac = HMAC(EVP_sha256(), key, keylen, (u8 *)mac_str, os_strlen(mac_str), NULL, NULL); wpa_hexdump_ascii(MSG_DEBUG, "EAP-NOOB: MAC",mac,32); os_free(mac_str); return mac; } static int eap_noob_derive_secret(struct eap_noob_peer_context * data, size_t * secret_len) { EVP_PKEY_CTX * ctx = NULL; EVP_PKEY * serverkey = NULL; unsigned char * server_pub_key = NULL; size_t skeylen = 0, len = 0; int ret = SUCCESS; wpa_printf(MSG_DEBUG, "EAP-NOOB: Entering function %s", __func__); if (NULL == data || NULL == secret_len) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Server context is NULL"); return FAILURE; } EAP_NOOB_FREE(data->server_attr->ecdh_exchange_data->shared_key); len = eap_noob_Base64Decode(data->server_attr->ecdh_exchange_data->x_serv_b64, &server_pub_key); if (len == 0) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Failed to decode"); ret = FAILURE; goto EXIT; } serverkey = EVP_PKEY_new_raw_public_key(EVP_PKEY_X25519, NULL, server_pub_key, len); ctx = EVP_PKEY_CTX_new(data->server_attr->ecdh_exchange_data->dh_key, NULL); if (!ctx) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Failed to create context"); ret = FAILURE; goto EXIT; } if (EVP_PKEY_derive_init(ctx) <= 0) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Failed to init key derivation"); ret = FAILURE; goto EXIT; } if (EVP_PKEY_derive_set_peer(ctx, serverkey) <= 0) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Failed to set peer key"); ret = FAILURE; goto EXIT; } if (EVP_PKEY_derive(ctx, NULL, &skeylen) <= 0) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Failed to get secret key len"); ret = FAILURE; goto EXIT; } data->server_attr->ecdh_exchange_data->shared_key = OPENSSL_malloc(skeylen); if (!data->server_attr->ecdh_exchange_data->shared_key) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Failed to allocate memory for secret"); ret = FAILURE; goto EXIT; } if (EVP_PKEY_derive(ctx, data->server_attr->ecdh_exchange_data->shared_key, &skeylen) <= 0) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Failed to derive secret key"); ret = FAILURE; goto EXIT; } (*secret_len) = skeylen; wpa_hexdump_ascii(MSG_DEBUG,"EAP-NOOB: Secret Derived", data->server_attr->ecdh_exchange_data->shared_key, *secret_len); EXIT: if (ctx) EVP_PKEY_CTX_free(ctx); EAP_NOOB_FREE(server_pub_key); if (ret != SUCCESS) EAP_NOOB_FREE(data->server_attr->ecdh_exchange_data->shared_key); return ret; } static int eap_noob_get_key(struct eap_noob_server_data * data) { EVP_PKEY_CTX * pctx = NULL; BIO * mem_pub = BIO_new(BIO_s_mem()); unsigned char * pub_key_char = NULL; size_t pub_key_len = 0; int ret = SUCCESS; /* Uncomment this code for using the test vectors of Curve25519 in RFC 7748. Peer = Bob Server = Alice */ char * priv_key_test_vector = "<KEY>"; BIO* b641 = BIO_new(BIO_f_base64()); BIO* mem1 = BIO_new(BIO_s_mem()); BIO_set_flags(b641,BIO_FLAGS_BASE64_NO_NL); BIO_puts(mem1,priv_key_test_vector); mem1 = BIO_push(b641,mem1); wpa_printf(MSG_DEBUG, "EAP-NOOB: entering %s", __func__); /* Initialize context to generate keys - Curve25519 */ if (NULL == (pctx = EVP_PKEY_CTX_new_id(NID_X25519, NULL))) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Fail to create context for parameter generation."); ret = FAILURE; goto EXIT; } EVP_PKEY_keygen_init(pctx); /* Generate X25519 key pair */ //EVP_PKEY_keygen(pctx, &data->ecdh_exchange_data->dh_key); /* If you are using the RFC 7748 test vector, you do not need to generate a key pair. Instead you use the private key from the RFC. In this case, comment out the line above and uncomment the following line code */ d2i_PrivateKey_bio(mem1,&data->ecdh_exchange_data->dh_key); PEM_write_PrivateKey(stdout, data->ecdh_exchange_data->dh_key, NULL, NULL, 0, NULL, NULL); PEM_write_PUBKEY(stdout, data->ecdh_exchange_data->dh_key); /* Get public key */ if (1 != i2d_PUBKEY_bio(mem_pub, data->ecdh_exchange_data->dh_key)) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Fail to copy public key to bio."); ret = FAILURE; goto EXIT; } pub_key_char = os_zalloc(MAX_X25519_LEN); pub_key_len = BIO_read(mem_pub, pub_key_char, MAX_X25519_LEN); /* * This code removes the openssl internal ASN encoding and only keeps the 32 bytes of curve25519 * public key which is then encoded in the JWK format and sent to the other party. This code may * need to be updated when openssl changes its internal format for public-key encoded in PEM. */ unsigned char * pub_key_char_asn_removed = pub_key_char + (pub_key_len-32); pub_key_len = 32; EAP_NOOB_FREE(data->ecdh_exchange_data->x_b64); eap_noob_Base64Encode(pub_key_char_asn_removed, pub_key_len, &data->ecdh_exchange_data->x_b64); EXIT: if (pctx) EVP_PKEY_CTX_free(pctx); EAP_NOOB_FREE(pub_key_char); BIO_free_all(mem_pub); return ret; } /** * eap_noob_verify_param_len : verify lengths of string type parameters * @data : peer context **/ static void eap_noob_verify_param_len(struct eap_noob_server_data * data) { u32 count = 0; u32 pos = 0x01; if (NULL == data) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Input arguments NULL for function %s",__func__); return ; } for(count = 0; count < 32; count++) { if (data->rcvd_params & pos) { switch(pos) { case PEERID_RCVD: if (strlen(data->PeerId) > MAX_PEER_ID_LEN) { data->err_code = E1003; } break; case NONCE_RCVD: if (strlen((char *)data->kdf_nonce_data->Ns) > NONCE_LEN) { data->err_code = E1003; } break; case MAC_RCVD: if (strlen(data->MAC) > MAC_LEN) { data->err_code = E1003; } break; case INFO_RCVD: if (strlen(data->server_info) > MAX_INFO_LEN) { data->err_code = E5002; } break; } } pos = pos<<1; } } /** * eap_noob_decode_obj : Decode parameters from incoming messages * @data : peer context * @req_obj : incoming json object with message parameters **/ static void eap_noob_decode_obj(struct eap_noob_server_data * data, json_t * req_obj) { const char * key = NULL; char * retval_char = NULL, * dump_str = NULL; size_t arr_index, decode_length; json_t * arr_value, * value; json_error_t error; int retval_int = 0; if (NULL == req_obj || NULL == data) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Input arguments NULL for function %s", __func__); return; } wpa_printf(MSG_DEBUG, "EAP-NOOB: Entering %s", __func__); json_object_foreach(req_obj, key, value) { switch(json_typeof(value)) { case JSON_OBJECT: if (0 == os_strcmp(key, PKS)) { dump_str = json_dumps(value,JSON_COMPACT|JSON_PRESERVE_ORDER); data->ecdh_exchange_data->jwk_serv = json_loads(dump_str, JSON_COMPACT|JSON_PRESERVE_ORDER, &error); wpa_printf(MSG_DEBUG, "EAP-NOOB:Copy Verify %s", dump_str); os_free(dump_str); if (NULL == data->ecdh_exchange_data->jwk_serv) { data->err_code = E1003; return; } data->rcvd_params |= PKEY_RCVD; } else if (0 == os_strcmp(key, SERVERINFO)) { data->server_info = json_dumps(value,JSON_COMPACT|JSON_PRESERVE_ORDER); if (NULL == data->server_info) { data->err_code = E5002; return; } data->rcvd_params |= INFO_RCVD; wpa_printf(MSG_DEBUG,"EAP-NOOB: Serv Info %s",data->server_info); } eap_noob_decode_obj(data,value); break; case JSON_INTEGER: if ((0 == (retval_int = json_integer_value(value))) && (0 != os_strcmp(key, TYPE)) && (0 != os_strcmp(key, SLEEPTIME))) { data->err_code = E1003; return; } else if (0 == os_strcmp(key, DIRS)) { data->dir = retval_int; data->rcvd_params |= DIRS_RCVD; } else if (0 == os_strcmp(key, SLEEPTIME)) { data->minsleep = retval_int; //data->rcvd_params |= MINSLP_RCVD; } else if (0 == os_strcmp(key, ERRORCODE)) { data->err_code = retval_int; } break; case JSON_STRING: if (NULL == (retval_char = (char *)json_string_value(value))) { data->err_code = E1003; return; } if (0 == os_strcmp(key, PEERID)) { data->PeerId = os_strdup(retval_char); data->rcvd_params |= PEERID_RCVD; } if (0 == os_strcmp(key, REALM)) { EAP_NOOB_FREE(data->Realm); data->Realm = os_strdup(retval_char); wpa_printf(MSG_DEBUG, "EAP-NOOB: Realm %s",data->Realm); } else if ((0 == os_strcmp(key, NS)) || (0 == os_strcmp(key, NS2))) { decode_length = eap_noob_Base64Decode(retval_char, &data->kdf_nonce_data->Ns); if (decode_length) data->rcvd_params |= NONCE_RCVD; } else if (0 == os_strcmp(key, HINT_SERV)) { data->oob_data->NoobId_b64 = os_strdup(retval_char); wpa_printf(MSG_DEBUG, "EAP-NOOB: Received NoobId = %s", data->oob_data->NoobId_b64); data->rcvd_params |= HINT_RCVD; } else if ((0 == os_strcmp(key, MACS)) || (0 == os_strcmp(key, MACS2))) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Received MAC %s", retval_char); decode_length = eap_noob_Base64Decode((char *)retval_char, (u8**)&data->MAC); data->rcvd_params |= MAC_RCVD; } else if (0 == os_strcmp(key, X_COORDINATE)) { data->ecdh_exchange_data->x_serv_b64 = os_strdup(json_string_value(value)); wpa_printf(MSG_DEBUG, "X coordinate %s", data->ecdh_exchange_data->x_serv_b64); } else if (0 == os_strcmp(key, Y_COORDINATE)) { data->ecdh_exchange_data->y_serv_b64 = os_strdup(json_string_value(value)); wpa_printf(MSG_DEBUG, "Y coordinate %s", data->ecdh_exchange_data->y_serv_b64); } break; case JSON_ARRAY: if (0 == os_strcmp(key, VERS)) { json_array_foreach(value, arr_index, arr_value) { if (json_is_integer(arr_value)) { data->version[arr_index] = json_integer_value(arr_value); wpa_printf(MSG_DEBUG, "EAP-NOOB: Version array value = %d", data->version[arr_index]); } else { data->err_code = E1003; return; } } data->rcvd_params |= VERSION_RCVD; } else if (0 == os_strcmp(key,CRYPTOSUITES)) { json_array_foreach(value, arr_index, arr_value) { if (json_is_integer(arr_value)) { data->cryptosuite[arr_index] = json_integer_value(arr_value); wpa_printf(MSG_DEBUG, "EAP-NOOB: Cryptosuites array value = %d", data->version[arr_index]); } else { data->err_code = E1003; return; } } data->rcvd_params |= CRYPTOSUITES_RCVD; } break; case JSON_REAL: case JSON_TRUE: case JSON_FALSE: case JSON_NULL: break; } } eap_noob_verify_param_len(data); } /** * eap_noob_assign_waittime : assign time fow which the SSID should be disabled. * @sm : eap state machine context * data: peer context **/ static void eap_noob_assign_waittime(struct eap_sm * sm, struct eap_noob_peer_context * data) { struct timespec tv; struct wpa_supplicant * wpa_s = (struct wpa_supplicant *) sm->msg_ctx; wpa_printf(MSG_DEBUG, "EAP-NOOB: Entering %s", __func__); clock_gettime(CLOCK_BOOTTIME, &tv); if (0 == data->server_attr->minsleep && 0 != eap_noob_globle_conf.default_minsleep) data->server_attr->minsleep = eap_noob_globle_conf.default_minsleep; wpa_printf(MSG_DEBUG, "EAP-NOOB: Wait time = %d", data->server_attr->minsleep); if (0 == os_strcmp(wpa_s->driver->name,"wired")) { sm->disabled_wired = tv.tv_sec + data->server_attr->minsleep; wpa_printf(MSG_DEBUG, "EAP-NOOB: disabled untill = %ld", sm->disabled_wired); data->wired = 1; return; } sm->disabled_wired = 0; wpa_s->current_ssid->disabled_until.sec = tv.tv_sec + data->server_attr->minsleep; wpa_blacklist_add(wpa_s, wpa_s->current_ssid->bssid); wpa_printf(MSG_DEBUG, "EAP-NOOB: SSID %s, time now : %ld disabled untill = %ld", wpa_s->current_ssid->ssid, tv.tv_sec, wpa_s->current_ssid->disabled_until.sec); } /** * eap_noob_check_compatibility : check peer's compatibility with server. * The type 1 message params are used for making any dicision * @data : peer context * Returns : SUCCESS/FAILURE **/ int eap_noob_check_compatibility(struct eap_noob_peer_context *data) { u32 count = 0; u8 vers_supported = 0; u8 csuite_supp = 0; if (0 == (data->peer_attr->dir & data->server_attr->dir)) { data->server_attr->err_code = E3003; return FAILURE; } for(count = 0; count < MAX_SUP_CSUITES ; count ++) { if (0 != (data->peer_attr->cryptosuite & data->server_attr->cryptosuite[count])) { csuite_supp = 1; break; } } if (csuite_supp == 0) { data->server_attr->err_code = E3002; return FAILURE; } for(count = 0; count < MAX_SUP_VER ; count ++) { if (0 != (data->peer_attr->version & data->server_attr->version[count])) { vers_supported = 1; break; } } if (vers_supported == 0) { data->server_attr->err_code = E3001; return FAILURE; } return SUCCESS; } /** * eap_noob_config_change : write back the content of identity into .conf file * @data : peer context * @sm : eap state machine context. **/ static void eap_noob_config_change(struct eap_sm *sm , struct eap_noob_peer_context *data) { char buff[120] = {0}; size_t len = 0; struct wpa_supplicant * wpa_s = (struct wpa_supplicant *)sm->msg_ctx; if (wpa_s) { snprintf(buff,120,"%s+s%d@%s", data->peer_attr->PeerId, data->server_attr->state, data->peer_attr->Realm); len = os_strlen(buff); os_free(wpa_s->current_ssid->eap.identity); wpa_s->current_ssid->eap.identity = os_malloc(os_strlen(buff)); os_memcpy(wpa_s->current_ssid->eap.identity, buff, len); wpa_s->current_ssid->eap.identity_len = len; wpa_config_write(wpa_s->confname,wpa_s->conf); } } /** * eap_noob_db_entry_check : check for an PeerId entry inside the DB * @priv : server context * @argc : argument count * @argv : argument 2d array * @azColName : colomn name 2d array **/ int eap_noob_db_entry_check(void * priv , int argc, char **argv, char **azColName) { struct eap_noob_server_data * data = priv; if (strtol(argv[0],NULL,10) == 1) { data->record_present = TRUE; } return 0; } /** * eap_noob_exec_query : Function to execute a sql query. Prepapres, binds and steps. * Takes variable number of arguments (TYPE, VAL). For Blob, (TYPE, LEN, VAL) * @data : Server context * @query : query to be executed * @callback : pointer to callback function * @num_args : number of variable inputs to function * Returns : SUCCESS/FAILURE **/ static int eap_noob_exec_query(struct eap_noob_peer_context * data, const char * query, void (*callback)(struct eap_noob_peer_context *, sqlite3_stmt *), int num_args, ...) { sqlite3_stmt * stmt = NULL; va_list args; int ret, i, indx = 0, ival, bval_len; char * sval = NULL; u8 * bval = NULL; u64 bival; int query_type=0; wpa_printf(MSG_DEBUG, "EAP-NOOB: Entering %s, query - (%s), Number of arguments (%d)", __func__, query, num_args); if(os_strstr(query,"SELECT")) query_type=1; if (SQLITE_OK != (ret = sqlite3_prepare_v2(data->peer_db, query, strlen(query)+1, &stmt, NULL))) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Error preparing statement, ret (%d)", ret); ret = FAILURE; goto EXIT; } va_start(args, num_args); for (i = 0; i < num_args; i+=2, ++indx) { enum sql_datatypes type = va_arg(args, enum sql_datatypes); switch(type) { case INT: ival = va_arg(args, int); printf("exec_query int %d, indx %d\n", ival, indx+1); if (SQLITE_OK != sqlite3_bind_int(stmt, (indx+1), ival)) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Error binding %d at index %d", ival, i+1); ret = FAILURE; goto EXIT; } break; case UNSIGNED_BIG_INT: bival = va_arg(args, u64); if (SQLITE_OK != sqlite3_bind_int64(stmt, (indx+1), bival)) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Error binding %lu at index %d", bival, i+1); ret = FAILURE; goto EXIT; } break; case TEXT: sval = va_arg(args, char *); printf("exec_query string %s, indx %d\n", sval, indx+1); if (SQLITE_OK != sqlite3_bind_text(stmt, (indx+1), sval, strlen(sval), NULL)) { wpa_printf(MSG_DEBUG, "EAP-NOOB:Error binding %s at index %d", sval, i+1); ret = FAILURE; goto EXIT; } break; case BLOB: bval_len = va_arg(args, int); bval = va_arg(args, u8 *); if (SQLITE_OK != sqlite3_bind_blob(stmt, (indx+1), (void *)bval, bval_len, NULL)) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Error binding %.*s at index %d", bval_len, bval, indx+1); ret = FAILURE; goto EXIT; } i++; break; default: wpa_printf(MSG_DEBUG, "EAP-NOOB: Wrong data type"); ret = FAILURE; goto EXIT; } } i=0; while(1) { ret = sqlite3_step(stmt); if (ret == SQLITE_DONE) { if(i==0 && query_type==1){ wpa_printf(MSG_DEBUG, "EAP-NOOB: Done executing SELECT query that returned 0 rows, ret (%d)\n", ret); ret = EMPTY; break; } wpa_printf(MSG_DEBUG, "EAP-NOOB: Done executing the query, ret (%d)\n", ret); ret = SUCCESS; break; } else if (ret != SQLITE_ROW) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Unexpected error in step, ret (%d)", ret); ret = FAILURE; goto EXIT; } i++; if (NULL != callback) { callback(data, stmt); } } EXIT: wpa_printf(MSG_DEBUG, "EAP-NOOB: Exiting %s, ret %d", __func__, ret); if (ret == FAILURE) { char * sql_error = (char *)sqlite3_errmsg(data->peer_db); if (sql_error != NULL) wpa_printf(MSG_DEBUG,"EAP-NOOB: SQL error : %s\n", sql_error); } va_end(args); sqlite3_finalize(stmt); return ret; } /** * eap_noob_db_update : prepare a DB update query * @data : peer context * Returns : SUCCESS/FAILURE **/ static int eap_noob_db_update(struct eap_noob_peer_context * data, u8 type) { char * query = os_zalloc(MAX_QUERY_LEN); int ret = FAILURE; switch(type) { case UPDATE_PERSISTENT_STATE: snprintf(query, MAX_QUERY_LEN, "UPDATE PersistentState SET PeerState=? where PeerID=?"); ret = eap_noob_exec_query(data, query, NULL, 4, INT, data->server_attr->state, TEXT, data->server_attr->PeerId); break; case UPDATE_STATE_ERROR: snprintf(query, MAX_QUERY_LEN, "UPDATE EphemeralState SET ErrorCode=? where PeerId=?"); ret = eap_noob_exec_query(data, query, NULL, 4, INT, data->server_attr->err_code, TEXT, data->server_attr->PeerId); break; case DELETE_SSID: snprintf(query, MAX_QUERY_LEN, "DELETE FROM EphemeralState WHERE Ssid=?"); ret = eap_noob_exec_query(data, query, NULL, 2, TEXT, data->server_attr->ssid); snprintf(query, MAX_QUERY_LEN, "DELETE FROM EphemeralNoob WHERE Ssid=?"); ret = eap_noob_exec_query(data, query, NULL, 2, TEXT, data->server_attr->ssid); break; default: wpa_printf(MSG_ERROR, "EAP-NOOB: Wrong DB update type"); return FAILURE; } if (FAILURE == ret) { wpa_printf(MSG_ERROR, "EAP-NOOB: DB update failed"); } os_free(query); return ret; } /** * eap_noob_db_entry : Make an entery of the current SSID context inside the DB * @sm : eap statemachine context * @data : peer context * Returns : FAILURE/SUCCESS **/ static int eap_noob_db_update_initial_exchange_info(struct eap_sm * sm, struct eap_noob_peer_context * data) { struct wpa_supplicant * wpa_s = NULL; char query[MAX_QUERY_LEN] = {0}, * Vers_str, * Cryptosuites_str; json_t * Vers = NULL, * Cryptosuites = NULL; int ret = 0, err = 0; if (NULL == data || NULL == sm) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Input to %s is null", __func__); return FAILURE; } wpa_printf(MSG_DEBUG, "EAP-NOOB: Entering %s",__func__); wpa_s = (struct wpa_supplicant *)sm->msg_ctx; err -= (FAILURE == eap_noob_encode_vers_cryptosuites(data, &Vers, &Cryptosuites)); err -= (NULL == (data->server_attr->mac_input_str = json_dumps(data->server_attr->mac_input, JSON_COMPACT|JSON_PRESERVE_ORDER))); if (data->server_attr->mac_input) wpa_printf(MSG_DEBUG, "EAP-NOOB: MAC str %s", data->server_attr->mac_input_str); err -= (NULL == (Vers_str = json_dumps(Vers, JSON_COMPACT))); err -= (NULL == (Cryptosuites_str = json_dumps(Cryptosuites, JSON_COMPACT|JSON_PRESERVE_ORDER))); if (err < 0) { ret = FAILURE; goto EXIT; } snprintf(query, MAX_QUERY_LEN,"INSERT INTO EphemeralState (Ssid, PeerId, Vers, Cryptosuites, Realm, Dirs, " "ServerInfo, Ns, Np, Z, MacInput, PeerState) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"); ret = eap_noob_exec_query(data, query, NULL, 27, TEXT, wpa_s->current_ssid->ssid, TEXT, data->server_attr->PeerId, TEXT, Vers_str, TEXT, Cryptosuites_str, TEXT, data->server_attr->Realm, INT, data->server_attr->dir, TEXT, data->server_attr->server_info, BLOB, NONCE_LEN, data->server_attr->kdf_nonce_data->Ns, BLOB, NONCE_LEN, data->server_attr->kdf_nonce_data->Np, BLOB, ECDH_SHARED_SECRET_LEN, data->server_attr->ecdh_exchange_data->shared_key, TEXT, data->server_attr->mac_input_str, INT, data->server_attr->state); if (FAILURE == ret) { wpa_printf(MSG_ERROR, "EAP-NOOB: DB value insertion failed"); } EXIT: wpa_printf(MSG_DEBUG, "EAP-NOOB: Exiting %s",__func__); EAP_NOOB_FREE(Vers_str); EAP_NOOB_FREE(Cryptosuites_str); json_decref(Vers); json_decref(Cryptosuites); return ret; } static int eap_noob_update_persistentstate(struct eap_noob_peer_context * data) { char query[MAX_QUERY_LEN] = {0}, * Vers_str, * Cryptosuites_str; json_t * Vers = NULL, * Cryptosuites = NULL; int ret = SUCCESS, err = 0; if (NULL == data) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Input to %s is null", __func__); return FAILURE; } wpa_printf(MSG_DEBUG, "EAP-NOOB: Entering %s",__func__); err -= (FAILURE == eap_noob_db_statements(data->peer_db, DELETE_EPHEMERAL_FOR_ALL)); err -= (FAILURE == eap_noob_encode_vers_cryptosuites(data, &Vers, &Cryptosuites)); err -= (NULL == (Vers_str = json_dumps(Vers, JSON_COMPACT|JSON_PRESERVE_ORDER))); err -= (NULL == (Cryptosuites_str = json_dumps(Cryptosuites, JSON_COMPACT|JSON_PRESERVE_ORDER))); if (err < 0) { ret = FAILURE; goto EXIT; } /* snprintf(query, MAX_QUERY_LEN, "INSERT INTO PersistentState (Ssid, PeerId, Vers, Cryptosuites, Realm, Kz, " "creation_time, last_used_time) VALUES (?, ?, ?, ?, ?, ?, ?, ?)"); */ snprintf(query, MAX_QUERY_LEN, "INSERT INTO PersistentState (Ssid, PeerId, Vers, Cryptosuites, Realm, Kz, PeerState) " "VALUES (?, ?, ?, ?, ?, ?, ?)"); if(data->server_attr->kdf_out->Kz){ wpa_printf(MSG_DEBUG, "NOT NULL and state %d",data->server_attr->state); wpa_hexdump_ascii(MSG_DEBUG, "EAP-NOOB: KZ is", data->server_attr->kdf_out->Kz, KZ_LEN);} else wpa_printf(MSG_DEBUG, "Kz is somehow null and state %d", data->server_attr->state); err -= (FAILURE == eap_noob_exec_query(data, query, NULL, 15, TEXT, data->server_attr->ssid, TEXT, data->server_attr->PeerId, TEXT, Vers_str, TEXT, Cryptosuites_str, TEXT, data->server_attr->Realm, BLOB, KZ_LEN, data->server_attr->kdf_out->Kz, INT, data->server_attr->state)); if (err < 0) { ret = FAILURE; goto EXIT; } EXIT: wpa_printf(MSG_DEBUG, "EAP-NOOB: Exiting %s, return %d",__func__, ret); EAP_NOOB_FREE(Vers_str); EAP_NOOB_FREE(Cryptosuites_str); json_decref(Vers); json_decref(Cryptosuites); return ret; } /** * eap_noob_err_msg : prepares error message * @data : peer context * @id : response message id * Returns : pointer to message buffer or null **/ static struct wpabuf * eap_noob_err_msg(struct eap_noob_peer_context * data, u8 id) { json_t * req_obj = NULL; struct wpabuf * resp = NULL; char * req_json = NULL; size_t len = 0; int err = 0, code = 0; if (NULL == data || NULL == data->peer_attr || 0 == (code = data->server_attr->err_code)) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Input to %s is null", __func__); return NULL; } wpa_printf(MSG_DEBUG, "EAP-NOOB: Build error request"); err -= (NULL == (req_obj = json_object())); if (data->peer_attr->PeerId) err += json_object_set_new(req_obj,PEERID,json_string(data->peer_attr->PeerId)); err += json_object_set_new(req_obj, TYPE, json_integer(NONE)); err += json_object_set_new(req_obj, ERRORCODE, json_integer(error_code[code])); err += json_object_set_new(req_obj, ERRORINFO, json_string(error_info[code])); err -= (NULL == (req_json = json_dumps(req_obj,JSON_COMPACT|JSON_PRESERVE_ORDER))); if (err < 0) goto EXIT; wpa_printf(MSG_DEBUG, "EAP-NOOB: ERROR message = %s == %d", req_json, (int)strlen(req_json)); len = strlen(req_json)+1; if (NULL == (resp = eap_msg_alloc(EAP_VENDOR_IETF, EAP_TYPE_NOOB, len, EAP_CODE_RESPONSE, id))) { wpa_printf(MSG_ERROR, "EAP-NOOB: Failed to allocate memory for NOOB ERROR message"); goto EXIT; } wpabuf_put_data(resp, req_json, len); EXIT: json_decref(req_obj); EAP_NOOB_FREE(req_json); return resp; } /** * eap_noob_verify_PeerId : compares recived PeerId with the assigned one * @data : peer context * @id : response message ID **/ static struct wpabuf * eap_noob_verify_PeerId(struct eap_noob_peer_context * data, u8 id) { if ((data->server_attr->PeerId) && (data->peer_attr->PeerId) && (0 != os_strcmp(data->peer_attr->PeerId, data->server_attr->PeerId))) { data->server_attr->err_code = E1005; return eap_noob_err_msg(data, id); } return NULL; } /** * eap_noob_rsp_type_four : prepares message type four * @data : peer context * @id : response message id * Returns : pointer to message buffer or null **/ static struct wpabuf * eap_noob_rsp_type_four(const struct eap_noob_peer_context * data, u8 id) { json_t * rsp_obj = NULL; struct wpabuf * resp = NULL; char * resp_json = NULL, * mac_b64 = NULL; size_t len = 0; int err = 0; u8 * mac = NULL; if (NULL == data) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Input arguments NULL for function %s",__func__); return NULL; } wpa_printf(MSG_DEBUG, "EAP-NOOB: Entering %s", __func__); mac = eap_noob_gen_MAC(data, MACP_TYPE, data->server_attr->kdf_out->Kmp, KMP_LEN, COMPLETION_EXCHANGE); if (NULL == mac) goto EXIT; err -= (FAILURE == eap_noob_Base64Encode(mac, MAC_LEN, &mac_b64)); err -= (NULL == (rsp_obj = json_object())); err += json_object_set_new(rsp_obj, TYPE, json_integer(EAP_NOOB_TYPE_4)); err += json_object_set_new(rsp_obj, PEERID, json_string(data->server_attr->PeerId)); err += json_object_set_new(rsp_obj, MACP, json_string(mac_b64)); err -= (NULL == (resp_json = json_dumps(rsp_obj,JSON_COMPACT|JSON_PRESERVE_ORDER))); if (err < 0) goto EXIT; wpa_printf(MSG_DEBUG, "EAP-NOOB: Response %s = %d", resp_json, (int)strlen(resp_json)); len = strlen(resp_json)+1; if (NULL == (resp = eap_msg_alloc(EAP_VENDOR_IETF, EAP_TYPE_NOOB, len, EAP_CODE_RESPONSE, id))) { wpa_printf(MSG_ERROR, "EAP-NOOB: Failed to allocate memory for Response/NOOB-IE"); goto EXIT; } wpabuf_put_data(resp,resp_json,len); EXIT: EAP_NOOB_FREE(resp_json); EAP_NOOB_FREE(mac_b64); json_decref(rsp_obj); return resp; } /** * eap_noob_rsp_type_three : prepares message type three * @data : peer context * @id : response message id * Returns : pointer to message buffer or null **/ static struct wpabuf * eap_noob_rsp_type_three(const struct eap_noob_peer_context *data, u8 id) { struct wpabuf * resp = NULL; char * resp_json = NULL; json_t * rsp_obj = NULL; size_t len = 0; int err = 0; wpa_printf(MSG_DEBUG, "EAP-NOOB: OOB BUILD RESP TYPE 3"); if (NULL == data) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Input arguments NULL for function %s",__func__); return NULL; } err -= (NULL == (rsp_obj = json_object())); err += json_object_set_new(rsp_obj, TYPE, json_integer(EAP_NOOB_TYPE_3)); err += json_object_set_new(rsp_obj, PEERID, json_string(data->peer_attr->PeerId)); err -= (NULL == (resp_json = json_dumps(rsp_obj, JSON_COMPACT|JSON_PRESERVE_ORDER))); if (err < 0) goto EXIT; len = strlen(resp_json)+1; err -= (NULL == (resp = eap_msg_alloc(EAP_VENDOR_IETF, EAP_TYPE_NOOB, len, EAP_CODE_RESPONSE, id))); if (err < 0) { wpa_printf(MSG_ERROR, "EAP-NOOB: Failed to allocate memory for Response/NOOB-IE"); goto EXIT; } wpabuf_put_data(resp,resp_json,len); EXIT: EAP_NOOB_FREE(resp_json); json_decref(rsp_obj); return resp; } /** * eap_noob_build_JWK : Builds a JWK object to send in the inband message * @jwk : output json object * @x_64 : x co-ordinate in base64url format * @y_64 : y co-ordinate in base64url format * Returns : FAILURE/SUCCESS **/ static int eap_noob_build_JWK( json_t ** jwk, const char * x_b64) { if (NULL == x_b64) { wpa_printf(MSG_DEBUG, "EAP-NOOB: CO-ORDINATES are NULL!!"); return FAILURE; } if (NULL == ((*jwk) = json_object())) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Error in JWK"); return FAILURE; } json_object_set_new((*jwk), KEY_TYPE, json_string("EC")); json_object_set_new((*jwk), CURVE, json_string("Curve25519")); json_object_set_new((*jwk), X_COORDINATE, json_string(x_b64)); wpa_printf(MSG_DEBUG, "JWK Key %s",json_dumps((*jwk),JSON_COMPACT|JSON_PRESERVE_ORDER)); return SUCCESS; } /** * eap_noob_rsp_type_two : prepares message type two * @data : peer context * @id : response message id * Returns : pointer to message buffer or null **/ static struct wpabuf * eap_noob_rsp_type_two(struct eap_noob_peer_context * data, u8 id) { json_t * rsp_obj = NULL; struct wpabuf *resp = NULL; char * resp_json = NULL, * Np_b64 = NULL, * Ns_b64 = NULL; size_t len = 0 ; size_t secret_len = ECDH_SHARED_SECRET_LEN; int err = 0; if (NULL == data) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Input arguments NULL for function %s",__func__); return NULL; } wpa_printf(MSG_DEBUG, "EAP-NOOB: Entering %s", __func__); data->server_attr->kdf_nonce_data->Np = os_zalloc(NONCE_LEN); int rc = RAND_bytes(data->server_attr->kdf_nonce_data->Np, NONCE_LEN); unsigned long error = ERR_get_error(); if (rc != 1) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Failed to generate nonce Error Code = %lu",error); os_free(data->server_attr->kdf_nonce_data->Np); return NULL; } wpa_hexdump_ascii(MSG_DEBUG, "EAP-NOOB: Nonce", data->server_attr->kdf_nonce_data->Np, NONCE_LEN); /* Generate Key material */ if (FAILURE == eap_noob_get_key(data->server_attr)) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Failed to generate keys"); goto EXIT; } if (FAILURE == eap_noob_build_JWK(&data->server_attr->ecdh_exchange_data->jwk_peer, data->server_attr->ecdh_exchange_data->x_b64)) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Failed to build JWK"); goto EXIT; } eap_noob_Base64Encode(data->server_attr->kdf_nonce_data->Np, NONCE_LEN, &Np_b64); wpa_printf(MSG_DEBUG, "EAP-NOOB: Nonce %s", Np_b64); err -= (NULL == (rsp_obj = json_object())); err += json_object_set_new(rsp_obj,TYPE,json_integer(EAP_NOOB_TYPE_2)); err += json_object_set_new(rsp_obj,PEERID,json_string(data->peer_attr->PeerId)); err += json_object_set_new(rsp_obj,NP,json_string(Np_b64)); err += json_object_set_new(rsp_obj,PKP,data->server_attr->ecdh_exchange_data->jwk_peer); err -= (NULL == (resp_json = json_dumps(rsp_obj, JSON_COMPACT|JSON_PRESERVE_ORDER))); if (err < 0) goto EXIT; len = strlen(resp_json)+1; wpa_printf(MSG_DEBUG, "EAP-NOOB: Response %s = %d", resp_json, (int)strlen(resp_json)); resp = eap_msg_alloc(EAP_VENDOR_IETF, EAP_TYPE_NOOB, len, EAP_CODE_RESPONSE, id); if (resp == NULL) { wpa_printf(MSG_ERROR, "EAP-NOOB: Failed to allocate memory for Response/NOOB-IE"); goto EXIT; } wpabuf_put_data(resp, resp_json, len); eap_noob_derive_secret(data, &secret_len); data->server_attr->ecdh_exchange_data->shared_key_b64_len = \ eap_noob_Base64Encode(data->server_attr->ecdh_exchange_data->shared_key, ECDH_SHARED_SECRET_LEN, &data->server_attr->ecdh_exchange_data->shared_key_b64); /* Update MAC */ eap_noob_Base64Encode(data->server_attr->kdf_nonce_data->Ns, NONCE_LEN, &Ns_b64); err -= (NULL == Ns_b64); err += json_array_set(data->server_attr->mac_input, 10, data->peer_attr->PeerInfo); err += json_array_set(data->server_attr->mac_input, 11, data->server_attr->ecdh_exchange_data->jwk_serv); err += json_array_set_new(data->server_attr->mac_input, 12, json_string(Ns_b64)); err += json_array_set(data->server_attr->mac_input, 13, data->server_attr->ecdh_exchange_data->jwk_peer); err += json_array_set_new(data->server_attr->mac_input, 14, json_string(Np_b64)); if (err < 0) wpa_printf(MSG_DEBUG, "EAP-NOOB: Unexpected error in setting MAC input values"); EXIT: json_decref(rsp_obj); EAP_NOOB_FREE(resp_json); EAP_NOOB_FREE(Np_b64); EAP_NOOB_FREE(Ns_b64); if (err < 0) { wpabuf_free(resp); return NULL; } return resp; } /** * eap_noob_rsp_type_one : prepares message type one * @data : peer context * @id : response message id * Returns : pointer to message buffer or null **/ static struct wpabuf * eap_noob_rsp_type_one(struct eap_sm *sm,const struct eap_noob_peer_context *data, u8 id) { json_t * rsp_obj = NULL; struct wpabuf *resp = NULL; char * resp_json = NULL; size_t len = 0; int err = 0; if (NULL == data) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Input arguments NULL for function %s",__func__); return NULL; } err -= (NULL == (rsp_obj = json_object())); err += json_object_set_new(rsp_obj,TYPE,json_integer(EAP_NOOB_TYPE_1)); err += json_object_set_new(rsp_obj,VERP,json_integer(data->peer_attr->version)); err += json_object_set_new(rsp_obj,PEERID,json_string(data->server_attr->PeerId)); err += json_object_set_new(rsp_obj,CRYPTOSUITEP,json_integer(data->peer_attr->cryptosuite)); err += json_object_set_new(rsp_obj,DIRP,json_integer(data->peer_attr->dir)); err += json_object_set(rsp_obj,PEERINFO,data->peer_attr->PeerInfo); err -= (NULL == (resp_json = json_dumps(rsp_obj, JSON_COMPACT|JSON_PRESERVE_ORDER))); if (err < 0) goto EXIT; len = strlen(resp_json)+1; wpa_printf(MSG_DEBUG, "EAP-NOOB: RESPONSE = %s = %d", resp_json, (int)strlen(resp_json)); if (NULL == (resp = eap_msg_alloc(EAP_VENDOR_IETF, EAP_TYPE_NOOB,len , EAP_CODE_RESPONSE, id))) { wpa_printf(MSG_ERROR, "EAP-NOOB: Failed to allocate memory for Response/NOOB-IE"); return NULL; } wpabuf_put_data(resp,resp_json,len); EXIT: json_decref(rsp_obj); EAP_NOOB_FREE(resp_json); return resp; } static struct wpabuf * eap_noob_rsp_type_eight(const struct eap_noob_peer_context * data, u8 id) { json_t * rsp_obj = NULL; struct wpabuf *resp = NULL; char * resp_json = NULL; size_t len = 0; int err = 0; if (NULL == data) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Input arguments NULL for function %s",__func__); return NULL; } err -= (NULL == (rsp_obj = json_object())); err += json_object_set_new(rsp_obj,TYPE,json_integer(EAP_NOOB_HINT)); err += json_object_set_new(rsp_obj,PEERID,json_string(data->server_attr->PeerId)); err += json_object_set_new(rsp_obj,HINT_PEER,json_string(data->server_attr->oob_data->NoobId_b64)); wpa_printf(MSG_DEBUG, "EAP-NOOB: Hint is %s", data->server_attr->oob_data->NoobId_b64); err -= (NULL == (resp_json = json_dumps(rsp_obj,JSON_COMPACT|JSON_PRESERVE_ORDER))); if (err < 0) goto EXIT; len = strlen(resp_json)+1; wpa_printf(MSG_DEBUG, "EAP-NOOB: RESPONSE = %s", resp_json); if (NULL == (resp = eap_msg_alloc(EAP_VENDOR_IETF, EAP_TYPE_NOOB,len , EAP_CODE_RESPONSE, id))) { wpa_printf(MSG_ERROR, "EAP-NOOB: Failed to allocate memory for Response/NOOB-IE"); return NULL; } wpabuf_put_data(resp,resp_json,len); EXIT: json_decref(rsp_obj); EAP_NOOB_FREE(resp_json); return resp; } /** * eap_noob_rsp_type_five : prepares message type file * @data : peer context * @id : response message id * Returns : pointer to message buffer or null **/ static struct wpabuf * eap_noob_rsp_type_five(struct eap_sm *sm,const struct eap_noob_peer_context *data, u8 id) { json_t * rsp_obj = NULL; struct wpabuf *resp = NULL; char * resp_json = NULL; size_t len = 0; int err = 0; if (NULL == data) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Input arguments NULL for function %s",__func__); return NULL; } err -= (NULL == (rsp_obj = json_object())); err += json_object_set_new(rsp_obj, TYPE, json_integer(EAP_NOOB_TYPE_5)); err += json_object_set_new(rsp_obj, PEERID, json_string(data->server_attr->PeerId)); err += json_object_set_new(rsp_obj, CRYPTOSUITEP, json_integer(data->peer_attr->cryptosuite)); err += json_object_set_new(rsp_obj, PEERINFO, eap_noob_prepare_peer_info_json(sm, data->peer_attr->peer_config_params)); err -= (NULL == (resp_json = json_dumps(rsp_obj, JSON_COMPACT|JSON_PRESERVE_ORDER))); if (err < 0) goto EXIT; len = strlen(resp_json)+1; wpa_printf(MSG_DEBUG, "EAP-NOOB: RESPONSE = %s", resp_json); resp = eap_msg_alloc(EAP_VENDOR_IETF, EAP_TYPE_NOOB, len, EAP_CODE_RESPONSE, id); if (resp == NULL) { wpa_printf(MSG_ERROR, "EAP-NOOB: Failed to allocate memory for Response/NOOB-IE"); return NULL; } wpabuf_put_data(resp,resp_json,len); EXIT: json_decref(rsp_obj); EAP_NOOB_FREE(resp_json); return resp; } /** * To-Do Based on the cryptosuite and server request decide whether new key has to be derived or not * eap_noob_rsp_type_six : prepares message type six * @data : peer context * @id : response message id * Returns : pointer to message buffer or null **/ static struct wpabuf * eap_noob_rsp_type_six(struct eap_noob_peer_context * data, u8 id) { json_t * rsp_obj = NULL; struct wpabuf *resp = NULL; char * resp_json = NULL, * Np_b64 = NULL, * Ns_b64; unsigned long error; size_t len = 0; int err = 0, rc; if (NULL == data) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Input arguments NULL for function %s",__func__); return NULL; } wpa_printf(MSG_DEBUG, "EAP-NOOB: OOB BUILD RESP TYPE 6"); data->server_attr->kdf_nonce_data->Np = os_zalloc(NONCE_LEN); rc = RAND_bytes(data->server_attr->kdf_nonce_data->Np, NONCE_LEN); error = ERR_get_error(); if (rc != 1) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Failed to generate nonce Error Code = %lu", error); os_free(data->server_attr->kdf_nonce_data->Np); return NULL; } wpa_hexdump_ascii(MSG_DEBUG, "EAP-NOOB: Nonce", data->server_attr->kdf_nonce_data->Np, NONCE_LEN); eap_noob_Base64Encode(data->server_attr->kdf_nonce_data->Np, NONCE_LEN, &Np_b64); err -= (NULL == (rsp_obj = json_object())); err += json_object_set_new(rsp_obj,TYPE,json_integer(EAP_NOOB_TYPE_6)); err += json_object_set_new(rsp_obj,PEERID,json_string(data->peer_attr->PeerId)); err += json_object_set_new(rsp_obj,NP2,json_string(Np_b64)); err -= (NULL == (resp_json = json_dumps(rsp_obj, JSON_COMPACT|JSON_PRESERVE_ORDER))); if (err < 0 ) goto EXIT; len = strlen(resp_json)+1; wpa_printf(MSG_DEBUG, "EAP-NOOB: Json %s", resp_json); if (NULL == (resp = eap_msg_alloc(EAP_VENDOR_IETF, EAP_TYPE_NOOB,len , EAP_CODE_RESPONSE, id))) { wpa_printf(MSG_ERROR, "EAP-NOOB: Failed to allocate memory for Response/NOOB-IE"); goto EXIT; } wpabuf_put_data(resp,resp_json,len); eap_noob_Base64Encode(data->server_attr->kdf_nonce_data->Ns, NONCE_LEN, &Ns_b64); err -= (NULL == Ns_b64); err += json_array_set(data->server_attr->mac_input, 10, data->peer_attr->PeerInfo); //err += json_array_set(data->server_attr->mac_input, 11, data->server_attr->ecdh_exchange_data->jwk_serv); err += json_array_set_new(data->server_attr->mac_input, 12, json_string(Ns_b64)); //err += json_array_set(data->server_attr->mac_input, 13, data->server_attr->ecdh_exchange_data->jwk_peer); err += json_array_set_new(data->server_attr->mac_input, 14, json_string(Np_b64)); if (err < 0) wpa_printf(MSG_DEBUG, "EAP-NOOB: Unexpected error in setting MAC input values"); EXIT: json_decref(rsp_obj); EAP_NOOB_FREE(resp_json); EAP_NOOB_FREE(Np_b64); EAP_NOOB_FREE(Ns_b64); if (err < 0) { wpabuf_free(resp); return NULL; } return resp; } /** * eap_noob_rsp_type_seven : prepares message type seven * @data : peer context * @id : response message id * Returns : pointer to message buffer or null **/ static struct wpabuf * eap_noob_rsp_type_seven(const struct eap_noob_peer_context * data, u8 id) { json_t * rsp_obj = NULL; struct wpabuf *resp = NULL; char * resp_json = NULL; size_t len = 0; int err = 0; u8 * mac = NULL; char * mac_b64 = NULL; if (NULL == data) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Input arguments NULL for function %s",__func__); return NULL; } wpa_printf(MSG_DEBUG, "EAP-NOOB: OOB BUILD RESP TYPE 7"); err -= (NULL == (rsp_obj = json_object())); err -= (NULL == (mac = eap_noob_gen_MAC(data,MACP_TYPE,data->server_attr->kdf_out->Kmp, KMP_LEN,RECONNECT_EXCHANGE))); err -= (FAILURE == eap_noob_Base64Encode(mac, MAC_LEN, &mac_b64)); err += json_object_set_new(rsp_obj,TYPE,json_integer(EAP_NOOB_TYPE_7)); err += json_object_set_new(rsp_obj,PEERID,json_string(data->peer_attr->PeerId)); err += json_object_set_new(rsp_obj,MACP2,json_string(mac_b64)); err -= (NULL == (resp_json = json_dumps(rsp_obj,JSON_COMPACT|JSON_PRESERVE_ORDER))); if (err < 0) goto EXIT; len = strlen(resp_json)+1; if (NULL == (resp = eap_msg_alloc(EAP_VENDOR_IETF, EAP_TYPE_NOOB,len , EAP_CODE_RESPONSE, id))) { wpa_printf(MSG_ERROR, "EAP-NOOB: Failed to allocate memory for Response/NOOB-IE"); return NULL; } wpabuf_put_data(resp,resp_json,len); EXIT: json_decref(rsp_obj); EAP_NOOB_FREE(resp_json); return resp; } /** * eap_noob_req_type_seven : Decodes request type seven * @eap_sm : eap statemachine context * @req_obj : received request message object * @data : peer context * @id : response message id * Returns : pointer to message buffer or null **/ static struct wpabuf * eap_noob_req_type_seven(struct eap_sm * sm, json_t * req_obj, struct eap_noob_peer_context * data, u8 id) { struct wpabuf * resp = NULL; u8 * mac = NULL; wpa_printf(MSG_DEBUG, "EAP-NOOB: Entering %s", __func__); if (NULL == req_obj || NULL == data) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Input arguments NULL for function %s",__func__); return NULL; } eap_noob_decode_obj(data->server_attr, req_obj); if (data->server_attr->err_code != NO_ERROR) { resp = eap_noob_err_msg(data,id); return resp; } if (data->server_attr->rcvd_params != TYPE_SEVEN_PARAMS) { data->server_attr->err_code = E1002; resp = eap_noob_err_msg(data,id); return resp; } data->server_attr->rcvd_params = 0; if (NULL != (resp = eap_noob_verify_PeerId(data,id))) return resp; /* Generate KDF and MAC */ if (SUCCESS != eap_noob_gen_KDF(data,RECONNECT_EXCHANGE)) { wpa_printf(MSG_ERROR, "EAP-NOOB: Error in KDF during Request/NOOB-FR"); return NULL; } mac = eap_noob_gen_MAC(data, MACS_TYPE, data->server_attr->kdf_out->Kms, KMS_LEN, RECONNECT_EXCHANGE); if (NULL == mac) return NULL; if (0 != strcmp((char *)mac,data->server_attr->MAC)) { data->server_attr->err_code = E4001; resp = eap_noob_err_msg(data, id); return resp; } resp = eap_noob_rsp_type_seven(data, id); data->server_attr->state = REGISTERED_STATE; eap_noob_config_change(sm, data); if (FAILURE == eap_noob_db_update(data, UPDATE_PERSISTENT_STATE)) { os_free(resp); return NULL; } return resp; } /** * eap_noob_req_type_six : Decodes request type six * @eap_sm : eap statemachine context * @req_obj : received request message object * @data : peer context * @id : response message id * Returns : pointer to message buffer or null **/ static struct wpabuf * eap_noob_req_type_six(struct eap_sm *sm, json_t * req_obj , struct eap_noob_peer_context *data, u8 id) { struct wpabuf * resp = NULL; if (NULL == req_obj || NULL == data) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Input arguments NULL for function %s",__func__); return NULL; } wpa_printf(MSG_DEBUG, "EAP-NOOB: OOB PROCESS REQ TYPE 6"); eap_noob_decode_obj(data->server_attr,req_obj); if (data->server_attr->err_code != NO_ERROR) { resp = eap_noob_err_msg(data,id); return resp; } if (data->server_attr->rcvd_params != TYPE_SIX_PARAMS) { data->server_attr->err_code = E1002; resp = eap_noob_err_msg(data,id); return resp; } if (NULL == (resp = eap_noob_verify_PeerId(data,id))) { resp = eap_noob_rsp_type_six(data,id); } data->server_attr->rcvd_params = 0; return resp; } /** * eap_noob_req_type_five : Decodes request type five * @eap_sm : eap statemachine context * @req_obj : received request message object * @data : peer context * @id : response message id * Returns : pointer to message buffer or null **/ static struct wpabuf * eap_noob_req_type_five(struct eap_sm *sm,json_t * req_obj , struct eap_noob_peer_context * data, u8 id) { struct wpabuf * resp = NULL; int err = 0; json_t * macinput = NULL, * Vers = NULL, * Cryptosuites = NULL, * emptystr = json_string(""); json_error_t error; if (NULL == req_obj || NULL == data) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Input arguments NULL for function %s",__func__); return NULL; } wpa_printf(MSG_DEBUG, "EAP-NOOB: OOB PROCESS REQ TYPE 5"); eap_noob_decode_obj(data->server_attr,req_obj); if (data->server_attr->err_code != NO_ERROR) { resp = eap_noob_err_msg(data,id); return resp; } if (data->server_attr->rcvd_params != TYPE_FIVE_PARAMS) { data->server_attr->err_code = E1002; resp = eap_noob_err_msg(data,id); return resp; } data->peer_attr->PeerId = os_strdup(data->server_attr->PeerId); //TODO: handle eap_noob failure scenario if (SUCCESS == eap_noob_check_compatibility(data)) resp = eap_noob_rsp_type_five(sm,data, id); else resp = eap_noob_err_msg(data,id); err -= (NULL == (Vers = json_array())); for (int i = 0; i < MAX_SUP_VER; ++i) err += json_array_append_new(Vers, json_integer(data->server_attr->version[i])); err -= (NULL == (Cryptosuites = json_array())); for (int i = 0; i < MAX_SUP_CSUITES ; i++) err += json_array_append_new(Cryptosuites, json_integer(data->server_attr->cryptosuite[i])); err -= (NULL == (macinput = json_array())); err += json_array_append(macinput, emptystr); err += json_array_append(macinput, Vers); err += json_array_append_new(macinput, json_integer(data->peer_attr->version)); err += json_array_append_new(macinput, json_string(data->server_attr->PeerId)); err += json_array_append(macinput, Cryptosuites); err += json_array_append(macinput, emptystr); err += json_array_append_new(macinput, json_loads(data->server_attr->server_info, JSON_COMPACT|JSON_PRESERVE_ORDER, &error)); err += json_array_append_new(macinput, json_integer(data->peer_attr->cryptosuite)); err += json_array_append(macinput, emptystr); err += json_array_append_new(macinput, json_string(data->server_attr->Realm)); err += json_array_append(macinput, emptystr); err += json_array_append(macinput, emptystr); err += json_array_append(macinput, emptystr); err += json_array_append(macinput, emptystr); err += json_array_append(macinput, emptystr); data->server_attr->mac_input = macinput; if (err < 0) wpa_printf(MSG_ERROR, "EAP-NOOB: Unexpected JSON processing error when creating mac input template."); data->server_attr->rcvd_params = 0; json_decref(Vers); json_decref(Cryptosuites); json_decref(emptystr); return resp; } static int eap_noob_exec_noobid_queries(struct eap_noob_peer_context * data) { char query[MAX_QUERY_LEN] = {0}; snprintf(query, MAX_QUERY_LEN, "SELECT * from EphemeralNoob WHERE PeerId = ? AND NoobId = ?;"); return eap_noob_exec_query(data, query, columns_ephemeralnoob, 4, TEXT, data->server_attr->PeerId, TEXT, data->server_attr->oob_data->NoobId_b64); } /** * eap_noob_req_type_four : Decodes request type four * @eap_sm : eap statemachine context * @req_obj : received request message object * @data : peer context * @id : response message id * Returns : pointer to message buffer or null **/ static struct wpabuf * eap_noob_req_type_four(struct eap_sm * sm, json_t * req_obj, struct eap_noob_peer_context * data, u8 id) { struct wpabuf * resp = NULL; u8 * mac = NULL; if (NULL == req_obj || NULL == data) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Input arguments NULL for function %s",__func__); return NULL; } wpa_printf(MSG_DEBUG, "EAP-NOOB: Entering %s", __func__); eap_noob_decode_obj(data->server_attr, req_obj); if (data->server_attr->err_code != NO_ERROR) { resp = eap_noob_err_msg(data,id); return resp; } if (data->server_attr->rcvd_params != TYPE_FOUR_PARAMS) { data->server_attr->err_code = E1002; resp = eap_noob_err_msg(data,id); return resp; } data->server_attr->rcvd_params = 0; /* Execute Hint query in peer to server direction */ if (data->peer_attr->dir == PEER_TO_SERV){ int ret = eap_noob_exec_noobid_queries(data); if(ret == FAILURE || ret == EMPTY){ wpa_printf(MSG_DEBUG, "EAP-NOOB: Unrecognized NoobId"); data->server_attr->err_code = E1006; resp = eap_noob_err_msg(data,id); return resp; } } /* generate Keys */ if (SUCCESS != eap_noob_gen_KDF(data, COMPLETION_EXCHANGE)) { wpa_printf(MSG_ERROR, "EAP-NOOB: Error in KDF during Request/NOOB-CE"); return NULL; } if (NULL != (resp = eap_noob_verify_PeerId(data, id))) return resp; mac = eap_noob_gen_MAC(data, MACS_TYPE, data->server_attr->kdf_out->Kms, KMS_LEN, COMPLETION_EXCHANGE); if (NULL == mac) { os_free(resp); return NULL; } wpa_hexdump_ascii(MSG_DEBUG, "EAP-NOOB: MAC received ", data->server_attr->MAC, 32); wpa_hexdump_ascii(MSG_DEBUG, "EAP-NOOB: MAC calculated ", mac, 32); if (0 != os_memcmp(mac, data->server_attr->MAC, MAC_LEN)) { data->server_attr->err_code = E4001; resp = eap_noob_err_msg(data,id); return resp; } resp = eap_noob_rsp_type_four(data, id); data->server_attr->state = REGISTERED_STATE; eap_noob_config_change(sm, data); if (resp == NULL) wpa_printf(MSG_DEBUG, "EAP-NOOB: Null resp 4"); if (FAILURE == eap_noob_update_persistentstate(data)) { os_free(resp); return NULL; } wpa_printf(MSG_DEBUG,"PEER ID IS STILL: %s",data->peer_attr->PeerId); return resp; } /** * eap_noob_req_type_three : Decodes request type three * @eap_sm : eap statemachine context * @req_obj : received request message object * @data : peer context * @id : response message id * Returns : pointer to message buffer or null **/ static struct wpabuf * eap_noob_req_type_three(struct eap_sm * sm, json_t * req_obj, struct eap_noob_peer_context * data, u8 id) { struct wpabuf * resp = NULL; if (NULL == req_obj || NULL == data) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Input arguments NULL for function %s",__func__); return NULL; } wpa_printf(MSG_DEBUG, "EAP-NOOB: Entering %s", __func__); eap_noob_decode_obj(data->server_attr,req_obj); if (data->server_attr->err_code != NO_ERROR) { resp = eap_noob_err_msg(data,id); return resp; } if (data->server_attr->rcvd_params != TYPE_THREE_PARAMS) { data->server_attr->err_code = E1002; resp = eap_noob_err_msg(data,id); return resp; } if (NULL == (resp = eap_noob_verify_PeerId(data,id))) { resp = eap_noob_rsp_type_three(data,id); if (0 != data->server_attr->minsleep) eap_noob_assign_waittime(sm,data); } return resp; } /** * eap_noob_req_type_two : Decodes request type two * @eap_sm : eap statemachine context * @req_obj : received request message object * @data : peer context * @id : pointer to response message buffer or null **/ static struct wpabuf * eap_noob_req_type_two(struct eap_sm *sm, json_t * req_obj , struct eap_noob_peer_context * data, u8 id) { struct wpabuf *resp = NULL; if (NULL == req_obj || NULL == data) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Input arguments NULL for function %s",__func__); return NULL; } wpa_printf(MSG_DEBUG, "Entering %s", __func__); eap_noob_decode_obj(data->server_attr,req_obj); if (data->server_attr->err_code != NO_ERROR) { resp = eap_noob_err_msg(data, id); return resp; } if (data->server_attr->rcvd_params != TYPE_TWO_PARAMS) { data->server_attr->err_code = E1002; resp = eap_noob_err_msg(data,id); return resp; } if (NULL == (resp = eap_noob_verify_PeerId(data,id))) { resp = eap_noob_rsp_type_two(data,id); data->server_attr->state = WAITING_FOR_OOB_STATE; if (SUCCESS == eap_noob_db_update_initial_exchange_info(sm, data)) eap_noob_config_change(sm, data); } if (0!= data->server_attr->minsleep) eap_noob_assign_waittime(sm,data); return resp; } /** * eap_noob_req_type_one : Decodes request type one * @eap_sm : eap statemachine context * @req_obj : received request message object * @data : peer context * @id : response message id * Returns : pointer to message buffer or null **/ static struct wpabuf * eap_noob_req_type_one(struct eap_sm * sm, json_t * req_obj , struct eap_noob_peer_context * data, u8 id) { struct wpabuf * resp = NULL; char * url = NULL; char url_cpy[2 * MAX_URL_LEN] = {0}; int err = 0; json_t * macinput = NULL, * Vers = NULL, * Cryptosuites = NULL, * emptystr = json_string(""); json_error_t error; if (NULL == req_obj || NULL == data) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Input arguments NULL for function %s",__func__); return NULL; } wpa_printf(MSG_DEBUG, "EAP-NOOB: Entering %s", __func__); eap_noob_decode_obj(data->server_attr,req_obj); if (data->server_attr->err_code != NO_ERROR) { resp = eap_noob_err_msg(data,id); return resp; } if (data->server_attr->rcvd_params != TYPE_ONE_PARAMS) { data->server_attr->err_code = E1002; resp = eap_noob_err_msg(data,id); return resp; } /* checks on the received URL */ if ( NULL == (url = os_strstr(data->server_attr->server_info, "https://"))) { data->server_attr->err_code = E5003; resp = eap_noob_err_msg(data,id); return resp; } strcpy(url_cpy,url); url_cpy[strlen(url_cpy)-2] = '\0'; if (NULL == url || strlen(url_cpy) > MAX_URL_LEN ) { data->server_attr->err_code = E5003; resp = eap_noob_err_msg(data,id); return resp; } data->peer_attr->PeerId = os_strdup(data->server_attr->PeerId); if (NULL != data->server_attr->Realm && strlen(data->server_attr->Realm) > 0) { //If the server sent a realm, then add it to the peer attr data->peer_attr->Realm = os_strdup(data->server_attr->Realm); } else { data->peer_attr->Realm = os_strdup(DEFAULT_REALM); data->server_attr->Realm = os_strdup(""); } wpa_printf(MSG_DEBUG, "EAP-NOOB: Realm %s", data->server_attr->Realm); if (SUCCESS == eap_noob_check_compatibility(data)) { resp = eap_noob_rsp_type_one(sm,data, id); } else resp = eap_noob_err_msg(data,id); /* Create MAC imput template */ /* 1/2,Vers,Verp,PeerId,Cryptosuites,Dirs,ServerInfo,Cryptosuitep,Dirp,[Realm],PeerInfo,PKs,Ns,PKp,Np,Noob */ err -= (NULL == (Vers = json_array())); for (int i = 0; i < MAX_SUP_VER; ++i) err += json_array_append_new(Vers, json_integer(data->server_attr->version[i])); err -= (NULL == (Cryptosuites = json_array())); for (int i = 0; i < MAX_SUP_CSUITES ; i++) err += json_array_append_new(Cryptosuites, json_integer(data->server_attr->cryptosuite[i])); err -= (NULL == (macinput = json_array())); err += json_array_append(macinput, emptystr); err += json_array_append(macinput, Vers); err += json_array_append_new(macinput, json_integer(data->peer_attr->version)); err += json_array_append_new(macinput, json_string(data->server_attr->PeerId)); err += json_array_append(macinput, Cryptosuites); err += json_array_append_new(macinput, json_integer(data->server_attr->dir)); err += json_array_append_new(macinput, json_loads(data->server_attr->server_info, JSON_COMPACT|JSON_PRESERVE_ORDER, &error)); err += json_array_append_new(macinput, json_integer(data->peer_attr->cryptosuite)); err += json_array_append_new(macinput, json_integer(data->peer_attr->dir)); // If no realm is assinged, use empty string for mac calculation if (os_strlen(data->server_attr->Realm)>0) err += json_array_append_new(macinput, json_string(data->server_attr->Realm)); else err += json_array_append_new(macinput, emptystr); err += json_array_append(macinput, emptystr); err += json_array_append(macinput, emptystr); err += json_array_append(macinput, emptystr); err += json_array_append(macinput, emptystr); err += json_array_append(macinput, emptystr); data->server_attr->mac_input = macinput; if (err < 0) wpa_printf(MSG_ERROR, "EAP-NOOB: Unexpected JSON processing error when creating mac input template."); data->server_attr->rcvd_params = 0; json_decref(Vers); json_decref(Cryptosuites); json_decref(emptystr); return resp; } static struct wpabuf * eap_noob_req_type_eight(struct eap_sm *sm,json_t * req_obj , struct eap_noob_peer_context * data, u8 id) { struct wpabuf *resp = NULL; eap_noob_decode_obj(data->server_attr,req_obj); if (data->server_attr->err_code != NO_ERROR) { resp = eap_noob_err_msg(data,id); return resp; } if (data->server_attr->rcvd_params != TYPE_HINT_PARAMS) { data->server_attr->err_code = E1002; resp = eap_noob_err_msg(data,id); return resp; } if (NULL == (resp = eap_noob_verify_PeerId(data,id))) { resp = eap_noob_rsp_type_eight(data,id); } return resp; } /** * eap_noob_req_err_handling : handle received error message * @eap_sm : eap statemachine context * @req_obj : received request message object * @data : peer context * @id : response message id * Returns : pointer to message buffer or null **/ static void eap_noob_req_err_handling(struct eap_sm *sm,json_t * req_obj , struct eap_noob_peer_context * data, u8 id) { if (!data->server_attr->err_code) { eap_noob_db_update(data, UPDATE_STATE_ERROR); } } /** * eap_noob_process : Process recieved message * @eap_sm : eap statemachine context * @priv : peer context * @ret : eap method data * @reqData : received request message objecti * Returns : pointer to message buffer or null **/ static struct wpabuf * eap_noob_process(struct eap_sm * sm, void * priv, struct eap_method_ret *ret, const struct wpabuf * reqData) { struct eap_noob_peer_context * data = priv; struct wpabuf * resp = NULL; const u8 * pos; size_t len; json_t * req_obj = NULL; json_t * req_type = NULL; json_error_t error; int msgtype; u8 id =0; wpa_printf(MSG_DEBUG, "EAP-NOOB: Entering %s", __func__); pos = eap_hdr_validate(EAP_VENDOR_IETF, EAP_TYPE_NOOB, reqData, &len); if (pos == NULL || len < 1) { ret->ignore = TRUE; return NULL; } /** * https://tools.ietf.org/html/rfc4137 Not dropping packets if header is valid. * Consider using this for Error messages received when not expected. **/ ret->ignore = FALSE; ret->methodState = METHOD_CONT; ret->decision = DECISION_FAIL; /** * https://tools.ietf.org/html/rfc3748 EAP-NOOB does not use * or handle EAP Notificiation type messages. **/ ret->allowNotifications = FALSE; wpa_printf(MSG_DEBUG, "EAP-NOOB: Received Request = %s", pos); req_obj = json_loads((char *)pos, JSON_COMPACT, &error); id = eap_get_id(reqData); if ((NULL != req_obj) && (json_is_object(req_obj) > 0)) { req_type = json_object_get(req_obj,TYPE); if ((NULL != req_type) && (json_is_integer(req_type) > 0)) { msgtype = json_integer_value(req_type); } else { wpa_printf(MSG_DEBUG, "EAP-NOOB: Request with unknown type received"); data->server_attr->err_code = E1003; resp = eap_noob_err_msg(data,id); goto EXIT; } } else { data->server_attr->err_code = E1003; resp = eap_noob_err_msg(data,id); wpa_printf(MSG_DEBUG, "EAP-NOOB: Request with unknown format received"); goto EXIT; } wpa_printf(MSG_DEBUG, "EAP-NOOB: State :%d, message type = %d",data->server_attr->state, msgtype); if (VALID != state_message_check[data->server_attr->state][msgtype]) { data->server_attr->err_code = E2002; resp = eap_noob_err_msg(data, id); wpa_printf(MSG_DEBUG, "EAP-NOOB: State mismatch"); goto EXIT; } else if ((data->server_attr->state == WAITING_FOR_OOB_STATE || data->server_attr->state == OOB_RECEIVED_STATE) && msgtype == EAP_NOOB_TYPE_1) { if (FAILURE == eap_noob_db_update(data, DELETE_SSID)) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Failed to delete SSID"); goto EXIT; } wpa_printf(MSG_DEBUG, "EAP-NOOB: Deleted SSID"); } switch(msgtype) { case NONE: wpa_printf(MSG_DEBUG, "EAP-NOOB: Error message received"); eap_noob_req_err_handling(sm,req_obj,data, id); break; case EAP_NOOB_TYPE_1: resp = eap_noob_req_type_one(sm,req_obj ,data,id); break; case EAP_NOOB_TYPE_2: resp = eap_noob_req_type_two(sm,req_obj ,data, id); break; case EAP_NOOB_TYPE_3: resp = eap_noob_req_type_three(sm,req_obj ,data, id); break; case EAP_NOOB_TYPE_4: resp = eap_noob_req_type_four(sm,req_obj ,data, id); if(data->server_attr->err_code == NO_ERROR) { ret->methodState = METHOD_MAY_CONT; ret->decision = DECISION_COND_SUCC; } break; case EAP_NOOB_TYPE_5: resp = eap_noob_req_type_five(sm, req_obj, data, id); break; case EAP_NOOB_TYPE_6: resp = eap_noob_req_type_six(sm, req_obj, data, id); break; case EAP_NOOB_TYPE_7: resp = eap_noob_req_type_seven(sm, req_obj, data, id); if(data->server_attr->err_code == NO_ERROR) { ret->methodState = METHOD_MAY_CONT; ret->decision = DECISION_COND_SUCC; } break; case EAP_NOOB_HINT: resp = eap_noob_req_type_eight(sm, req_obj, data, id); break; default: wpa_printf(MSG_DEBUG, "EAP-NOOB: Unknown EAP-NOOB request received"); break; } EXIT: data->server_attr->err_code = NO_ERROR; if (req_type) json_decref(req_type); else if (req_obj) json_decref(req_obj); return resp; } /** * eap_noob_free_ctx : free all the allocations from peer context * @data : peer context * **/ static void eap_noob_free_ctx(struct eap_noob_peer_context * data) { if (NULL == data) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Input to %s is null", __func__); return; } struct eap_noob_peer_data * peer = data->peer_attr; struct eap_noob_server_data * serv = data->server_attr; wpa_printf(MSG_DEBUG, "EAP-NOOB: Entering %s", __func__); if (serv) { wpa_printf(MSG_DEBUG, "EAP_NOOB: Clearing server data"); EAP_NOOB_FREE(serv->server_info); EAP_NOOB_FREE(serv->MAC); EAP_NOOB_FREE(serv->ssid); EAP_NOOB_FREE(serv->PeerId); EAP_NOOB_FREE(serv->Realm); json_decref(serv->mac_input); EAP_NOOB_FREE(serv->mac_input_str); if (serv->ecdh_exchange_data) { EVP_PKEY_free(serv->ecdh_exchange_data->dh_key); EAP_NOOB_FREE(serv->ecdh_exchange_data->x_serv_b64); EAP_NOOB_FREE(serv->ecdh_exchange_data->y_serv_b64); EAP_NOOB_FREE(serv->ecdh_exchange_data->x_b64); EAP_NOOB_FREE(serv->ecdh_exchange_data->y_b64); json_decref(serv->ecdh_exchange_data->jwk_serv); json_decref(serv->ecdh_exchange_data->jwk_peer); EAP_NOOB_FREE(serv->ecdh_exchange_data->shared_key); EAP_NOOB_FREE(serv->ecdh_exchange_data->shared_key_b64); os_free(serv->ecdh_exchange_data); } if (serv->oob_data) { EAP_NOOB_FREE(serv->oob_data->Noob_b64); EAP_NOOB_FREE(serv->oob_data->Hoob_b64); EAP_NOOB_FREE(serv->oob_data->NoobId_b64); os_free(serv->oob_data); } if (serv->kdf_nonce_data) { EAP_NOOB_FREE(serv->kdf_nonce_data->Ns); EAP_NOOB_FREE(serv->kdf_nonce_data->Np); os_free(serv->kdf_nonce_data); } if (serv->kdf_out) { EAP_NOOB_FREE(serv->kdf_out->msk); EAP_NOOB_FREE(serv->kdf_out->emsk); EAP_NOOB_FREE(serv->kdf_out->amsk); EAP_NOOB_FREE(serv->kdf_out->MethodId); EAP_NOOB_FREE(serv->kdf_out->Kms); EAP_NOOB_FREE(serv->kdf_out->Kmp); EAP_NOOB_FREE(serv->kdf_out->Kz); os_free(serv->kdf_out); } os_free(serv); } if (peer) { wpa_printf(MSG_DEBUG, "EAP_NOOB: Clearing peer data"); EAP_NOOB_FREE(peer->PeerId); json_decref(peer->PeerInfo); EAP_NOOB_FREE(peer->MAC); EAP_NOOB_FREE(peer->Realm); if (peer->peer_config_params) { EAP_NOOB_FREE(peer->peer_config_params->Peer_name); EAP_NOOB_FREE(peer->peer_config_params->Peer_ID_Num); os_free(peer->peer_config_params); } os_free(peer); } /* Close DB */ /* TODO check again */ if (data->peer_db) if (SQLITE_OK != sqlite3_close_v2(data->peer_db)) { wpa_printf(MSG_DEBUG, "EAP-NOOB:Error closing DB"); const char * sql_error = sqlite3_errmsg(data->peer_db); if (sql_error != NULL) wpa_printf(MSG_DEBUG,"EAP-NOOB: SQL error : %s", sql_error); } EAP_NOOB_FREE(data->db_name); os_free(data); data = NULL; wpa_printf(MSG_DEBUG, "EAP_NOOB: Exit %s", __func__); } /** * eap_noob_deinit : de initialises the eap method context * @sm : eap statemachine context * @priv : method context **/ static void eap_noob_deinit(struct eap_sm * sm, void * priv) { wpa_printf(MSG_DEBUG, "EAP-NOOB: OOB DEINIT"); struct eap_noob_peer_context * data = priv; eap_noob_free_ctx(data); } /** * eap_noob_create_db : Creates a new DB or opens the existing DB and populates the context * @sm : eap statemachine context * @data : peer context * returns : SUCCESS/FAILURE **/ static int eap_noob_create_db(struct eap_sm *sm, struct eap_noob_peer_context * data) { struct wpa_supplicant * wpa_s = (struct wpa_supplicant *) sm->msg_ctx; if (SQLITE_OK != sqlite3_open_v2(data->db_name, &data->peer_db, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, NULL)) { wpa_printf(MSG_ERROR, "EAP-NOOB: No DB found,new DB willbe created"); return FAILURE; } if (FAILURE == eap_noob_db_statements(data->peer_db, CREATE_TABLES_EPHEMERALSTATE) || FAILURE == eap_noob_db_statements(data->peer_db, CREATE_TABLES_PERSISTENTSTATE)) { wpa_printf(MSG_ERROR, "EAP-NOOB: Unexpected error in table cration"); return FAILURE; } if ((wpa_s->current_ssid->ssid) || (0 == os_strcmp(wpa_s->driver->name,"wired"))) { int ret = eap_noob_exec_query(data, QUERY_EPHEMERALSTATE, columns_ephemeralstate, 2, TEXT, wpa_s->current_ssid->ssid); if (ret == FAILURE || ret == EMPTY ) { ret = eap_noob_exec_query(data, QUERY_PERSISTENTSTATE, columns_persistentstate, 2, TEXT, wpa_s->current_ssid->ssid); if (ret == FAILURE || ret == EMPTY ) { wpa_printf(MSG_DEBUG, "EAP-NOOB: SSID not present in any tables"); return SUCCESS; } else { data->server_attr->state = REGISTERED_STATE; } } else { if (FAILURE != eap_noob_exec_query(data, QUERY_EPHEMERALNOOB, columns_ephemeralnoob, 2, TEXT, wpa_s->current_ssid->ssid)) { wpa_printf(MSG_DEBUG, "EAP-NOOB: WAITING FOR OOB state"); return SUCCESS; } } } if (data->server_attr->PeerId) data->peer_attr->PeerId = os_strdup(data->server_attr->PeerId); return SUCCESS; } /** * eap_noob_assign_config : identify each config item and store the read value * @confname : name of the conf item * @conf_value : value of the conf item * @data : peer context **/ static void eap_noob_assign_config(char * conf_name,char * conf_value,struct eap_noob_peer_data * data) { //TODO : version and csuite are directly converted to integer.This needs to be changed if //more than one csuite or version is supported. wpa_printf(MSG_DEBUG, "EAP-NOOB:CONF Name = %s %d", conf_name, (int)strlen(conf_name)); if (0 == strcmp("Version",conf_name)) { data->version = (int) strtol(conf_value, NULL, 10); data->config_params |= VERSION_RCVD; wpa_printf(MSG_DEBUG, "EAP-NOOB: FILE READ= %d",data->version); } else if (0 == strcmp("Csuite",conf_name)) { data->cryptosuite = (int) strtol(conf_value, NULL, 10); data->config_params |= CRYPTOSUITES_RCVD; wpa_printf(MSG_DEBUG, "EAP-NOOB: FILE READ= %d",data->cryptosuite); } else if (0 == strcmp("OobDirs",conf_name)) { data->dir = (int) strtol(conf_value, NULL, 10); data->config_params |= DIRS_RCVD; wpa_printf(MSG_DEBUG, "EAP-NOOB: FILE READ= %d",data->dir); } else if (0 == strcmp("PeerMake", conf_name)) { data->peer_config_params->Peer_name = os_strdup(conf_value); data->config_params |= PEER_MAKE_RCVD; wpa_printf(MSG_DEBUG, "EAP-NOOB: FILE READ= %s",data->peer_config_params->Peer_name); } else if (0 == strcmp("PeerType", conf_name)) { eap_noob_globle_conf.peer_type = os_strdup(conf_value); data->config_params |= PEER_TYPE_RCVD; wpa_printf(MSG_DEBUG, "EAP-NOOB: FILE READ= %s",eap_noob_globle_conf.peer_type); } else if (0 == strcmp("PeerSNum", conf_name)) { data->peer_config_params->Peer_ID_Num = os_strdup(conf_value); data->config_params |= PEER_ID_NUM_RCVD; wpa_printf(MSG_DEBUG, "EAP-NOOB: FILE READ= %s",data->peer_config_params->Peer_ID_Num); } else if (0 == strcmp("MinSleepDefault", conf_name)) { eap_noob_globle_conf.default_minsleep = (int) strtol(conf_value, NULL, 10); data->config_params |= DEF_MIN_SLEEP_RCVD; wpa_printf(MSG_DEBUG, "EAP-NOOB: FILE READ= %d",eap_noob_globle_conf.default_minsleep); } else if (0 == strcmp("OobMessageEncoding", conf_name)) { eap_noob_globle_conf.oob_enc_fmt = (int) strtol(conf_value, NULL, 10); data->config_params |= MSG_ENC_FMT_RCVD; wpa_printf(MSG_DEBUG, "EAP-NOOB: FILE READ= %d",eap_noob_globle_conf.oob_enc_fmt); } } /** * eap_noob_parse_config : parse eacj line from the config file * @buff : read line * data : peer_context **/ static void eap_noob_parse_config(char * buff,struct eap_noob_peer_data * data) { char * pos = buff; char * conf_name = NULL; char * conf_value = NULL; char * token = NULL; for(; *pos == ' ' || *pos == '\t' ; pos++); if (*pos == '#') return; if (os_strstr(pos, "=")) { conf_name = strsep(&pos,"="); /*handle if there are any space after the conf item name*/ token = conf_name; for(; (*token != ' ' && *token != 0 && *token != '\t'); token++); *token = '\0'; token = strsep(&pos,"="); /*handle if there are any space before the conf item value*/ for(; (*token == ' ' || *token == '\t' ); token++); /*handle if there are any comments after the conf item value*/ //conf_value = strsep(&token,"#"); conf_value = token; for(; (*token != '\n' && *token != '\t'); token++); *token = '\0'; //wpa_printf(MSG_DEBUG, "EAP-NOOB: conf_value = %s token = %s\n",conf_value,token); eap_noob_assign_config(conf_name,conf_value, data); } } /** * eap_noob_handle_incomplete_conf : assigns defult value of the configuration is incomplete * @data : peer config * Returs : FAILURE/SUCCESS **/ static int eap_noob_handle_incomplete_conf(struct eap_noob_peer_context * data) { if (!(data->peer_attr->config_params & PEER_MAKE_RCVD) || !(data->peer_attr->config_params & PEER_ID_NUM_RCVD) || !(data->peer_attr->config_params&PEER_TYPE_RCVD)) { wpa_printf(MSG_ERROR, "EAP-NOOB: Peer Make or Peer Type or Peer Serial number missing"); return FAILURE; } if (! (data->peer_attr->config_params & VERSION_RCVD)) data->peer_attr->version = VERSION_ONE; if (! (data->peer_attr->config_params & CRYPTOSUITES_RCVD)) data->peer_attr->cryptosuite = SUITE_ONE; if (! (data->peer_attr->config_params & DIRS_RCVD)) data->peer_attr->dir = PEER_TO_SERV; if (! (data->peer_attr->config_params & DEF_MIN_SLEEP_RCVD)) eap_noob_globle_conf.default_minsleep = 0; if (! (data->peer_attr->config_params & MSG_ENC_FMT_RCVD)) eap_noob_globle_conf.oob_enc_fmt = FORMAT_BASE64URL; return SUCCESS; } /** * eap_noob_read_config : read configuraions from config file * @data : peer context * Returns : SUCCESS/FAILURE **/ static int eap_noob_read_config(struct eap_sm *sm,struct eap_noob_peer_context * data) { FILE * conf_file = NULL; char * buff = NULL, * PeerInfo_str = NULL; if (NULL == (conf_file = fopen(CONF_FILE,"r"))) { wpa_printf(MSG_ERROR, "EAP-NOOB: Configuration file not found"); return FAILURE; } if ((NULL == (buff = malloc(MAX_CONF_LEN))) || (NULL == (data->peer_attr->peer_config_params = \ malloc(sizeof(struct eap_noob_peer_config_params)))) ) return FAILURE; data->peer_attr->config_params = 0; while(!feof(conf_file)) { if (fgets(buff,MAX_CONF_LEN, conf_file)) { eap_noob_parse_config(buff, data->peer_attr); memset(buff,0,MAX_CONF_LEN); } } free(buff); fclose(conf_file); if ((data->peer_attr->version >MAX_SUP_VER) || (data->peer_attr->cryptosuite > MAX_SUP_CSUITES) || (data->peer_attr->dir > BOTH_DIR)) { wpa_printf(MSG_ERROR, "EAP-NOOB: Incorrect confing value"); return FAILURE; } if (eap_noob_globle_conf.oob_enc_fmt != FORMAT_BASE64URL) { wpa_printf(MSG_ERROR, "EAP-NOOB: Unsupported OOB message encoding format"); return FAILURE; } if (data->peer_attr->config_params != CONF_PARAMS && FAILURE == eap_noob_handle_incomplete_conf(data)) return FAILURE; if (NULL != (data->peer_attr->PeerInfo = eap_noob_prepare_peer_info_json(sm, data->peer_attr->peer_config_params))) { PeerInfo_str = json_dumps(data->peer_attr->PeerInfo, JSON_COMPACT|JSON_PRESERVE_ORDER); if (NULL == PeerInfo_str || os_strlen(PeerInfo_str) > MAX_INFO_LEN) { wpa_printf(MSG_ERROR, "EAP-NOOB: Incorrect or no peer info"); return FAILURE; } } wpa_printf(MSG_DEBUG, "EAP-NOOB: PEER INFO = %s", PeerInfo_str); os_free(PeerInfo_str); return SUCCESS; } /** * eap_noob_peer_ctxt_alloc : Allocates the subcontexts inside the peer context * @sm : eap method context * @peer : peer context * Returns : SUCCESS/FAILURE **/ static int eap_noob_peer_ctxt_alloc(struct eap_sm *sm, struct eap_noob_peer_context * data) { if (NULL == (data->peer_attr = os_zalloc( sizeof (struct eap_noob_peer_data)))) { return FAILURE; } if ((NULL == (data->server_attr = os_zalloc( sizeof (struct eap_noob_server_data))))) { return FAILURE; } if ((NULL == (data->server_attr->ecdh_exchange_data = os_zalloc( sizeof (struct eap_noob_ecdh_key_exchange))))) { return FAILURE; } if ((NULL == (data->server_attr->oob_data = os_zalloc( sizeof (struct eap_noob_oob_data))))) { return FAILURE; } if ((NULL == (data->server_attr->kdf_out = os_zalloc( sizeof (struct eap_noob_ecdh_kdf_out))))) { return FAILURE; } if ((NULL == (data->server_attr->kdf_nonce_data = os_zalloc( sizeof (struct eap_noob_ecdh_kdf_nonce))))) { return FAILURE; } return SUCCESS; } /** * eap_noob_peer_ctxt_init : initialises peer context * @sm : eap statemachine data * @data : peer context * Returns: SUCCESS/FAILURE **/ static int eap_noob_peer_ctxt_init(struct eap_sm * sm, struct eap_noob_peer_context * data) { int retval = FAILURE; if (FAILURE == (retval = eap_noob_peer_ctxt_alloc(sm, data))) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Error in allocating peer context"); goto EXIT; } data->server_attr->state = UNREGISTERED_STATE; data->server_attr->rcvd_params = 0; data->server_attr->err_code = 0; data->db_name = os_strdup(DB_NAME); if (FAILURE == (retval = eap_noob_create_db(sm , data))) goto EXIT; wpa_printf(MSG_DEBUG, "EAP-NOOB: State = %d", data->server_attr->state); if (FAILURE == eap_noob_read_config(sm,data)) { wpa_printf(MSG_ERROR, "EAP-NOOB: Failed to initialize context"); goto EXIT; } EXIT: if (FAILURE == retval) eap_noob_free_ctx(data); return retval; } /** * eap_noob_init : initialise the eap noob method * @sm : eap statemachine context * Returns : eap noob peer context **/ static void * eap_noob_init(struct eap_sm * sm) { struct eap_noob_peer_context * data = NULL; wpa_printf(MSG_DEBUG, "Entering %s", __func__); if (NULL == (data = os_zalloc(sizeof(struct eap_noob_peer_context))) ) return NULL; if (FAILURE == eap_noob_peer_ctxt_init(sm,data)) return NULL; return data; } /** * eap_noob_isKeyAvailable : Checks if the shared key is presesnt * @sm : eap statemachine context * @priv : eap noob data * Returns : TRUE/FALSE */ static Boolean eap_noob_isKeyAvailable(struct eap_sm *sm, void *priv) { struct eap_noob_peer_context * data = priv; Boolean retval = ((data->server_attr->state == REGISTERED_STATE) && (data->server_attr->kdf_out->msk != NULL)); wpa_printf(MSG_DEBUG, "EAP-NOOB: State = %d, Key Available? %d", data->server_attr->state, retval); return retval; } /** * eap_noob_getKey : gets the msk if available * @sm : eap statemachine context * @priv : eap noob data * @len : msk len * Returns MSK or NULL **/ static u8 * eap_noob_getKey(struct eap_sm * sm, void * priv, size_t * len) { struct eap_noob_peer_context * data = priv; u8 * key; wpa_printf(MSG_DEBUG, "EAP-NOOB: GET KEY"); if ((data->server_attr->state != REGISTERED_STATE) || (!data->server_attr->kdf_out->msk)) return NULL; if (NULL == (key = os_malloc(MSK_LEN))) return NULL; *len = MSK_LEN; os_memcpy(key, data->server_attr->kdf_out->msk, MSK_LEN); wpa_hexdump_ascii(MSG_DEBUG,"EAP-NOOB: MSK Derived",key,MSK_LEN); return key; } /** * eap_noob_get_emsk : gets the msk if available * @sm : eap statemachine context * @priv : eap noob data * @len : msk len * Returns EMSK or NULL **/ static u8 * eap_noob_get_emsk(struct eap_sm *sm, void *priv, size_t *len) { struct eap_noob_peer_context *data = priv; u8 *key; wpa_printf(MSG_DEBUG,"EAP-NOOB:Get EMSK Called"); if ((data->server_attr->state != REGISTERED_STATE) || (!data->server_attr->kdf_out->emsk)) return NULL; if (NULL == (key = os_malloc(MSK_LEN))) return NULL; *len = EAP_EMSK_LEN; os_memcpy(key, data->server_attr->kdf_out->emsk, EAP_EMSK_LEN); wpa_hexdump_ascii(MSG_DEBUG,"EAP-NOOB: EMSK",key,EAP_EMSK_LEN); return key; } /** * eap_noob_get_session_id : gets the session id if available * @sm : eap statemachine context * @priv : eap noob data * @len : session id len * Returns Session Id or NULL **/ static u8 * eap_noob_get_session_id(struct eap_sm *sm, void *priv, size_t *len) { struct eap_noob_peer_context *data = priv; u8 *session_id=NULL; wpa_printf(MSG_DEBUG,"EAP-NOOB:Get Session ID Called"); if ((data->server_attr->state != REGISTERED_STATE) || (!data->server_attr->kdf_out->MethodId)) return NULL; *len = 1 + METHOD_ID_LEN; session_id = os_malloc(*len); if (session_id == NULL) return NULL; session_id[0] = EAP_TYPE_NOOB; os_memcpy(session_id + 1, data->server_attr->kdf_out->MethodId, METHOD_ID_LEN); *len = 1 + METHOD_ID_LEN; return session_id; } /** * eap_noob_deinit_for_reauth : release data not needed for fast reauth * @sm : eap statemachine context * @priv : eap noob data */ static void eap_noob_deinit_for_reauth(struct eap_sm *sm, void *priv) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Entering %s", __func__); } /** * eap_noob_init_for_reauth : initialise the reauth context * @sm : eap statemachine context * @priv : eap noob data */ static void * eap_noob_init_for_reauth(struct eap_sm * sm, void * priv) { wpa_printf(MSG_DEBUG, "EAP-NOOB: Entering %s", __func__); struct eap_noob_peer_context * data=priv; data->server_attr->state = RECONNECTING_STATE; return data; } /** * eap_noob_has_reauth_data : Changes the state to RECONNECT. Called by state machine to check if method has enough data to do fast reauth * if the current state is REGISTERED_STATE * @sm : eap statemachine context * @priv : eap noob data */ static Boolean eap_noob_has_reauth_data(struct eap_sm * sm, void * priv) { struct eap_noob_peer_context * data = priv; struct wpa_supplicant * wpa_s = (struct wpa_supplicant *) sm->msg_ctx; wpa_printf(MSG_DEBUG, "EAP-NOOB: Entering %s, Current SSID = %s, Stored SSID = %s", __func__, wpa_s->current_ssid->ssid, data->server_attr->ssid); if ((data->server_attr->state == REGISTERED_STATE || data->server_attr->state == RECONNECTING_STATE) && (0 == strcmp((char *)wpa_s->current_ssid->ssid, data->server_attr->ssid))) { data->server_attr->state = RECONNECTING_STATE; data->peer_attr->state = RECONNECTING_STATE; if(!data->peer_attr->Realm || os_strlen(data->peer_attr->Realm)==0) data->peer_attr->Realm = os_strdup(DEFAULT_REALM); wpa_printf(MSG_DEBUG, "EAP-NOOB: Peer ID and Realm Reauth, %s %s", data->peer_attr->PeerId, data->peer_attr->Realm); eap_noob_config_change(sm, data); eap_noob_db_update(data, UPDATE_PERSISTENT_STATE); return TRUE; } wpa_printf(MSG_DEBUG, "EAP-NOOB: Returning False, %s", __func__); return FALSE; } /** * eap_peer_noob_register : register eap noob method **/ int eap_peer_noob_register(void) { struct eap_method * eap = NULL; wpa_printf(MSG_DEBUG, "EAP-NOOB: NOOB REGISTER"); eap = eap_peer_method_alloc(EAP_PEER_METHOD_INTERFACE_VERSION, EAP_VENDOR_IETF, EAP_TYPE_NOOB, "NOOB"); if (eap == NULL) return -1; eap->init = eap_noob_init; eap->deinit = eap_noob_deinit; eap->process = eap_noob_process; eap->isKeyAvailable = eap_noob_isKeyAvailable; eap->getKey = eap_noob_getKey; eap->get_emsk = eap_noob_get_emsk; eap->getSessionId = eap_noob_get_session_id; eap->has_reauth_data = eap_noob_has_reauth_data; eap->init_for_reauth = eap_noob_init_for_reauth; eap->deinit_for_reauth = eap_noob_deinit_for_reauth; return eap_peer_method_register(eap); } <|start_filename|>EAPNOOBWebView/app/src/main/java/com/sirseni/eapnoobwebview/MainActivity.java<|end_filename|> package com.sirseni.eapnoobwebview; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); final Button button = (Button) findViewById(R.id.button); button.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { EditText editText = (EditText) findViewById(R.id.url); String message = editText.getText().toString(); if (message != null) { Intent intent = new Intent(getApplicationContext(), WebActivity.class); intent.putExtra("URL", message); startActivity(intent); } } }); } } <|start_filename|>wpa_supplicant-2.6/wpa_supplicant/my_reader.c<|end_filename|> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <signal.h> #include <time.h> #include <unistd.h> #include <nfc/nfc.h> //#include "nfc-utils.h" static nfc_device *nfc; static nfc_context *context; static uint8_t CMD_SELECT_HCE[] = {0x00, 0xa4, 0x04, 0x00, 0x05, 0xF2, 0x22, 0x22, 0x22, 0x22}; //static uint8_t SAMPLE[] = {0x00,0x01, 0x02, 0x03,0x04}; static uint8_t SAMPLE[] = "www.gmail.com"; static void stop_communication(int sig) { (void) sig; if(nfc) nfc_abort_command(nfc); nfc_close(nfc); nfc_exit(context); exit(EXIT_FAILURE); } void print_hex(const uint8_t *pbtData, const size_t szBytes) { size_t szPos; for (szPos = 0; szPos < szBytes; szPos++) { printf("%02x ", pbtData[szPos]); } printf("\n"); } void print_nfc_target(const nfc_target *pnt, bool verbose) { char *s; str_nfc_target(&s, pnt, verbose); printf("%s", s); nfc_free(s); } int read_card() { int control = 1; uint8_t *command = NULL; uint8_t response[250]; uint8_t *response_wo_status; int szCommand, szResponse; struct timeval tv; nfc_modulation nmIso14443A = { .nmt = NMT_ISO14443A, .nbr = NBR_106, }; nfc_target ntIso14443A; //printf("waiting for a target ...\n"); while(control){ //gettimeofday(&tv, NULL); //printf("time stamp 1 = %lu:%lu\n", tv.tv_sec,tv.tv_usec); if(nfc_initiator_select_passive_target(nfc, nmIso14443A, NULL, 0, &ntIso14443A)){ //print_nfc_target(&ntIso14443A, false); //gettimeofday(&tv, NULL); //printf("time stamp 2 = %lu:%lu\n", tv.tv_sec,tv.tv_usec); #if 1 //command = CMD_SELECT_AID; command = CMD_SELECT_HCE; szCommand = sizeof(CMD_SELECT_HCE); //printf("Command: %s\n", command); //print_hex(command, szCommand); //gettimeofday(&tv, NULL); //printf("time stamp 3 = %lu:%lu\n", tv.tv_sec,tv.tv_usec); szResponse = nfc_initiator_transceive_bytes(nfc, command, szCommand, response, sizeof(response), 0); response_wo_status = malloc(sizeof(uint8_t)* szResponse-1); strncpy(response_wo_status, response, szResponse-2); response_wo_status[szResponse-2] = '\0'; printf("%s\n", response_wo_status); //gettimeofday(&tv, NULL); //printf("time stamp 4 = %lu:%lu\n", tv.tv_sec,tv.tv_usec); //printf("Response length: %d \n", szResponse); //print_hex(response, szResponse); #endif #if 0 command = SAMPLE; szCommand = sizeof(SAMPLE); printf("Command: %s\n", command); print_hex(command, szCommand); szResponse = nfc_initiator_transceive_bytes(nfc, command, szCommand, response, sizeof(response), 0); printf("Response : %s \n", response); printf("Response length: %d \n", szResponse); print_hex(response, szResponse); #endif //sending something control = 0; } } } int main(int argc, char *argv[]) { nfc_init(&context); if(context == NULL) { //ERR("Unable to init libnfc (malloc) "); exit(EXIT_FAILURE); } // Try to open the NFC device nfc = nfc_open(context, NULL); if(nfc == NULL) { //ERR("Unable to open NFC device. \n"); nfc_exit(context); exit(EXIT_FAILURE); } if(nfc_initiator_init(nfc) < 0) { nfc_perror(nfc, "nfc_initiator_init"); nfc_close(nfc); nfc_exit(context); exit(EXIT_FAILURE); } // Device may go responseless while waiting a tag for a long time // Therefore, let the device only return immediately after a try if(nfc_device_set_property_bool(nfc, NP_INFINITE_SELECT, false) < 0) { nfc_perror(nfc, "nfc_device_set_property_bool"); nfc_close(nfc); nfc_exit(context); exit(EXIT_FAILURE); } //printf("NFC device: %s opened\n", nfc_device_get_name(nfc)); signal(SIGINT, stop_communication); //stop on interrupt // the main loop read_card(); //printf("Terminating DESFire Reader application.\n"); nfc_close(nfc); nfc_exit(context); return 0; } <|start_filename|>protocolmodel/mcrl2/Makefile<|end_filename|> # Translate the mCRL2 specification to an LPS # Generate an LTS from the LPS # Display basic information about the LPS build: mcrl22lps --no-constelm -l regular2 -v eap-noob.mcrl2 eap-noob.lps lps2lts -cached -v eap-noob.lps eap-noob.lts lpsinfo eap-noob.lps # Minimize the LTS (strong trace equivalence) conv: ltsconvert eap-noob.lts eap-noob.lts -e trace # Visualize the LTS as a 2D graph 2D: ltsgraph eap-noob.lts # Visualize the LTS as a 3D model 3D: ltsview eap-noob.lts # Simulate the LPS graphically sim: lpsxsim eap-noob.lps # Run tests test: python3 test.py # Trace error trace: mcrl22lps --no-constelm -l regular2 -v eap-noob.mcrl2 eap-noob.lps lps2lts --verbose --action=LOG_ERROR --trace=1 eap-noob.lps tracepp eap-noob.lps_act_0_LOG_ERROR.trc # Clean build files clean: rm -f -- *.trc rm -f -- *.lps rm -f -- *.lts
tuomaura/eap-noob
<|start_filename|>public/assets/assets/frontend/js/neon-slider.js<|end_filename|> /** * SimpleSlider * * Plugin by: <NAME> * www.arlindnushi.com * * Version: 1.0 * Date: 2/11/14 */ ;(function($, window, undefined){ $.fn.neonSlider = function(opts) { return this.each(function(i) { var // public properties def = { itemSelector: '> .item', activeClass: 'active', autoSwitch: 0, resizeContainerDuration: .5, outDuration: .4, inDuration: .7, outAnimation: { small: { top: -25, opacity: 0 }, h2: { opacity: 0, scale: .8 }, p: { top: 25, opacity: 0 }, img: { opacity: 0 } }, inAnimation: { small: { top: -40, opacity: 0 }, h2: { top: -25, opacity: 0 }, p: { top: -50, opacity: 0 }, img: { opacity: 0, scale: .8 } }, prev: '.prev', next: '.next' }, // private properties p = { items: null, items_length: 0, current: 0, as: {pct: 0}, asInstance: null }, methods = { init: function(opts) { // Extend Options $.extend(def, opts); // Set Container p.container = $(this); p.items = p.container.find(def.itemSelector); p.items_length = p.items.length; p.current = p.items.filter('.' + def.activeClass).index(); if(p.current < 0) p.current = 0; p.items.removeClass(def.activeClass); p.items.eq(p.current).addClass(def.activeClass); // Set Heights p.items.each(function(i, el) { var $slide = $(el); if( ! $slide.hasClass(def.activeClass)) { $slide.data('height', $slide.outerHeight()); $slide.removeClass(def.activeClass); } else { $slide.data('height', $slide.outerHeight()); } }); // Next Prev p.container.find(def.next).on('click', function(ev) { ev.preventDefault(); methods.next(); }); p.container.find(def.prev).on('click', function(ev) { ev.preventDefault(); methods.next(-1); }); // Auto Switch if(def.autoSwitch && typeof def.autoSwitch == 'number') { methods.autoswitch(def.autoSwitch); } }, goTo: function(index) { index = Math.abs(index) % p.items_length; if(index == p.current || p.container.data('is-busy')) return false; var $current = p.items.eq(p.current), $next = p.items.eq(index), _ch = $current.data('height'), _nh = $next.data('height'); p.container.data('is-busy', 1); p.container.height( _ch ); // Resize Container TweenMax.to(p.container, def.resizeContainerDuration, {css: {height: _nh}}); // Hide Slide var $small = $current.find('small'), $h2 = $current.find('h2'), $p = $current.find('p'), $img = $current.find('.slide-image img'); TweenMax.to($small, def.outDuration, {css: def.outAnimation.small, delay: def.inDuration/2}); TweenMax.to($h2, def.outDuration, {css: def.outAnimation.h2, delay: def.inDuration/2}); TweenMax.to($p, def.outDuration, {css: def.outAnimation.p, delay: def.inDuration/2}); TweenMax.to($img, def.outDuration, {css: def.outAnimation.img}); // Next Slide setTimeout(function() { $current.removeClass(def.activeClass); $small.add($h2).add($p).add($img).attr('style', ''); $small = $next.find('small'), $h2 = $next.find('h2'), $p = $next.find('p'), $img = $next.find('.slide-image img'); $next.addClass(def.activeClass); TweenMax.from($small, def.inDuration, {css: def.inAnimation.small, delay: def.inDuration/2}); TweenMax.from($h2, def.inDuration, {css: def.inAnimation.h2, delay: def.inDuration/2}); TweenMax.from($p, def.inDuration, {css: def.inAnimation.p, delay: def.inDuration/2}); TweenMax.from($img, def.inDuration, {css: def.inAnimation.img}); // Animation End setTimeout(function() { p.container.data('is-busy', 0); $small.add($h2).add($p).add($img).attr('style', ''); p.container.css('height', ''); p.current = $next.index(); }, 1000 * (def.inDuration + def.inDuration/2)); }, 1000 * (def.inDuration + .3)); return true; }, next: function(rev) { var next = p.current + 1; if(rev) { next = p.current - 1; if(next < 0) next = p.items_length - 1; } methods.goTo(next); }, autoswitch: function(length) { p.asInstance = TweenMax.to(p.as, length, {pct: 100, onComplete: function() { p.as.pct = 0; p.asInstance.restart(); methods.next(); } }); p.container.hover(function() { p.asInstance.pause(); }, function() { p.asInstance.resume(); }); } }; if(typeof opts == 'object') { methods.init.apply(this, [opts]); } }); } })(jQuery, window); <|start_filename|>public/assets/assets/frontend/js/neon-custom.js<|end_filename|> /** * Neon Main JavaScript File * * Theme by: www.laborator.co **/ ;(function($, window, undefined){ "use strict"; $(document).ready(function() { //$("nav .selectnav").prependTo( $("nav .mobile-menu") ); // Remove last option (from search box) //$("nav .selectnav").find('option:last').remove(); // Menu Hover var $main_menu = $("nav.site-nav .main-menu"); // Mobile Menu var $mobile_menu = $main_menu.clone(); $("body").prepend( $mobile_menu ); $mobile_menu.removeClass('hidden-xs main-menu').addClass('mobile-menu'); $(".menu-trigger").on('click', function(ev) { ev.preventDefault(); $mobile_menu.slideToggle(); }); // Sub Menus $main_menu.find('li:has(> ul)').addClass("has-sub").each(function(i, el) { var $this = $(el), $sub = $this.children('ul'), $sub_sub = $sub.find('> li > ul'); $sub.addClass('visible'); if($sub_sub.length) { $sub_sub.removeClass('visible'); } $this.data('sub-height', $sub.outerHeight()); if($sub_sub.length) { $sub_sub.addClass('visible'); } }); $main_menu.find('.visible').removeClass('visible'); // First Level $main_menu.find('> li:has(> ul)').addClass('is-root').each(function(i, el) { var $this = $(el), $sub = $this.children('ul'); TweenMax.set($sub, {css: {opacity: 0}}); $this.hoverIntent({ over: function() { TweenMax.to($sub, 0.3, {css: {opacity: 1}, onStart: function() { $this.addClass('hover'); }}); $sub.show(); }, out: function() { $sub.hide(); }, timeout: 300, interval: 0 }); $this.on('mouseleave', function() { TweenMax.to($sub, 0.15, {css: {opacity: 0}, onComplete: function() { $this.removeClass('hover'); }}); }); }); $main_menu.find('li:has(> ul)').not('.is-root').each(function(i, el) { var $this = $(el), $sub = $this.children('ul'), height = $this.data('sub-height'); $this.hoverIntent({ over: function() { if( ! $sub.is(':visible')) $sub.css({height: 0}).show(); TweenMax.to($sub, .2, {css: {height: height}, ease: Sine.easeOut, onComplete: function() { $sub.attr('style', '').addClass('visible'); }}); }, out: function() { TweenMax.to($sub, .2, {css: {height: 0}, ease: Sine.easeOut, onComplete: function() { $sub.attr('style', '').removeClass('visible'); }}); }, interval: 150 }); }); // Menu Search var $main_menu = $(".main-menu"), $menu_search = $main_menu.find('li.search .search-form .form-control'); $main_menu.find('li.search a').click(function(ev) { ev.preventDefault(); $main_menu.addClass('search-active'); setTimeout(function(){ $menu_search.focus(); }, 180); }); $menu_search.on('blur', function(ev) { $main_menu.removeClass('search-active'); }); // Clients Logos Carousel $(".client-logos").carousel(); // Testimonials Carousel $(".testimonials").each(function(i, el){ var $this = $(el), items_count = $this.find('.item').length; $this.carousel({ //interval: 7000 }); if(items_count > 1) { var $tnav = $('<div class="testimonials-nav"></div>'); for(var i=0; i<items_count; i++) { $tnav.append('<a href="#" data-index="' + i + '"></a>'); } $tnav.find('a:first').addClass('active'); $this.append($tnav); $tnav.on('click', 'a', function(ev) { ev.preventDefault(); var index = $(this).data('index'); $this.carousel(index); }); $this.on('slide.bs.carousel', function(ev) { var index = $(ev.relatedTarget).index(); $tnav.find('a').removeClass('active'); $($tnav.find('a').get(index)).addClass('active'); }); } }); // Alternate select box $(".alt-select-field").each(function(i, el) { var $this = $(el), $label = $this.find('.btn-label'), $items = $this.find('.dropdown-menu li'), $default = $('<li><a href="#" data-is-default="1">' + $label.html() + '</a></li>'), $current; $label.data('default-text', $label.html()); $current = $items.filter('.active'); $items.parent().prepend($default); if($current.length) { $label.html( $current.find('a').html() ); } // Events $this.find('.dropdown-menu').on('click', 'li a', function(ev) { ev.preventDefault(); var $item = $(this), $li = $item.parent(), isDefault = $item.data('is-default') ? true : false; $this.find('.dropdown-menu li').not($li).removeClass('active'); $li.addClass('active'); $this.trigger('change', [{isDefault: isDefault, el: $item, elParent: $li, index: $li.index()}]); // Set Current $current = $this.find('.dropdown-menu li.active'); $label.html( $current.find('a').html() ); if(isDefault) { $current.addClass('hidden'); } else { $this.find('a[data-is-default]').parent().removeClass('hidden'); } }); }); // Slides var $sliders = $(".slides"); if($sliders.length && $.isFunction($.fn.neonSlider)) { $sliders.neonSlider({ itemSelector: '.slide', autoSwitch: 5 }); } // Enable/Disable Resizable Event var wid = 0; $(window).resize(function() { clearTimeout(wid); wid = setTimeout(trigger_resizable, 200); }); }); })(jQuery, window);
faustinofilho/donadviceTeste
<|start_filename|>source/js/hola.js<|end_filename|> /** * Gitment 配置 * https://imsun.net/posts/gitment-introduction/ */ <|start_filename|>source/css/highlight.css<|end_filename|> /** * highlight.css */ .highlight { border-radius: 1px; } .highlight .line { font-size: 13px !important; height: 20px; } .highlight, pre { overflow: auto; margin: 20px 0; padding: 0; font-size: 13px; color: var(--sub-font-color); background: var(--underline-color); line-height: 1.6; } figure { margin: 1em 40px; } .highlight table { margin: 0; width: auto; border: none; } .highlight td { border: none; padding: 0; } .gutter { -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; } .highlight .gutter pre { padding-left: 10px; padding-right: 10px; color: var(--sub-font-color); text-align: right; background-color: var(--underline-color); } .highlight pre { border: none; margin: 0; padding: 10px 0; } code { padding: 2px 4px; color: var(--sub-font-color); background: var(--underline-color); border-radius: 3px; font-size: 14px; } code, pre { font-family: consolas,Menlo,"PingFang SC","Microsoft YaHei",monospace; } .highlight td { border: none; padding: 0; } caption, td, th { padding: 8px; text-align: left; font-weight: 400; } caption, code, td, th { vertical-align: middle; } .highlight .code pre { padding-left: 10px; padding-right: 10px; background-color: var(--underline-color); } .hljs { display: block; background: white; padding: 0.5em; color: #333333; overflow-x: auto; } .line .comment, .line .meta { color: #969896; } .line .string, .line .variable, .line .template-variable, .line .strong, .line .emphasis, .line .quote { color: #df5000; } .line .keyword, .line .selector-tag, .line .type { color: #a71d5d; } .line .literal, .line .symbol, .line .bullet, .line .attribute { color: #0086b3; } .line .section, .line .name { color: #63a35c; } .line .tag { color: #333333; } .line .title, .line .attr, .line .selector-id, .line .selector-class, .line .selector-attr, .line .selector-pseudo { color: #795da3; } .line .addition { color: #55a532; background-color: #eaffea; } .line .deletion { color: #bd2c00; background-color: #ffecec; } .line .link { text-decoration: underline; }
isecret/Hola
<|start_filename|>f2/src/components/formik/box/index.js<|end_filename|> import React from 'react' import styled from '@emotion/styled' import { cleanProps } from '../../../utils/cleanProps' import { Jumbotron as BaseBox } from 'react-bootstrap' import { fontSize, lineHeight, fontWeight, space, color, width, height, position, } from 'styled-system' const StyledBox = styled(BaseBox, { shouldForwardProp: (prop) => cleanProps(prop), })` margin-top: 1rem; border: 1px solid rgb(174, 174, 174); padding-top: 0.5rem; ${fontSize} ${fontWeight} ${lineHeight} ${space} ${color} ${width} ${height} ${position} ` export const Box = (props) => { return <StyledBox>{props.children}</StyledBox> } <|start_filename|>f2/src/components/formik/datePicker/index.js<|end_filename|> import React from 'react' import styled from '@emotion/styled' import { css } from '@emotion/core' import { Form, Row, Col, Container } from 'react-bootstrap' import { Trans } from '@lingui/macro' import { Field } from 'formik' import { FormRow } from '../row' const hasError = (props) => props.hasError ? css` border-color: #dc3545; ` : null const inputLength = (props) => props.dateType === 'year' ? css` width: 110px; ` : css` width: 70px; ` const DateLabel = styled(Form.Label)` vertical-align: middle; ` const DateColumn = styled(Col)` padding-left: 0rem; ` const DateInput = styled(Form.Control)` margin-top: 0.75rem; &:hover { box-shadow: rgb(213, 213, 213) 0px 0px 0px 2px; border-color: black; } &:focus { box-shadow: rgba(99, 179, 237, 0.6) 0px 0px 4px 1px; outline: none; border-color: black; } ${hasError} ${inputLength} ` const HelpText = styled(Form.Text)` line-height: 1.25; font-size: 1rem; max-width: 600px; display: block; margin-top: 0.25rem; ` const Label = styled(Form.Label)` font-size: 1.25rem; font-weight: 700; margin-bottom: 0.25rem; line-height: 1; margin-left: 0px; max-width: 600px; display: inline-block; ` const DateEntry = ({ field, form, ...props }) => { let length = 2 let dateType = 'day-month' const error = form.errors && form.errors[field.name] && form.touched[field.name] if (props.type === 'year') { length = 4 dateType = 'year' } return ( <DateColumn sm="auto"> <Form.Group controlId={props.id}> <DateLabel>{props.label}</DateLabel> <DateInput haserror={error} datetype={dateType} type="text" {...field} maxLength={length} /> </Form.Group> </DateColumn> ) } export const DatePicker = ({ field, form, ...props }) => { return ( <Container fluid> <Row> <Label>{props.label}</Label> </Row> <Row> <HelpText>{props.helpText}</HelpText> </Row> <FormRow marginTop="0.75rem"> <Field name={field.name + 'Day'} component={DateEntry} id={props.id + 'Day'} onChange={props.handleChange} onBlur={props.handleBlur} label={<Trans id="whenDidItStart.startDay" />} /> <Field name={field.name + 'Month'} component={DateEntry} id={props.id + 'Month'} onChange={props.handleChange} onBlur={props.handleBlur} label={<Trans id="whenDidItStart.startMonth" />} /> <Field name={field.name + 'Year'} component={DateEntry} id={props.id + 'Year'} onChange={props.handleChange} onBlur={props.handleBlur} type="year" label={<Trans id="whenDidItStart.startYear" />} /> </FormRow> </Container> ) } <|start_filename|>f2/src/TrackPageViews.js<|end_filename|> import React, { useEffect } from 'react' import ReactGA from 'react-ga' import { useLocation } from 'react-router-dom' const GA = process.env.REACT_APP_GOOGLE_ANALYTICS_ID // debug dumps info the the console // testMode doesn't connect to Google, but allows us to perform automated testing of the tracker in our code ReactGA.initialize(GA, { debug: false, testMode: process.env.NODE_ENV !== 'production', }) ReactGA.set({ anonymizeIp: true }) const logPageView = path => { if (typeof window === 'object') { ReactGA.pageview(path) } } export const TrackPageViews = () => { const location = useLocation() useEffect(() => { logPageView(location.pathname) }) return <div /> } <|start_filename|>f2/src/HowDidItStartPage.js<|end_filename|> /** @jsx jsx */ import { jsx } from '@emotion/core' import { Route } from 'react-router-dom' import { Trans } from '@lingui/macro' import { H1 } from './components/header' import { Lead } from './components/paragraph' import { HowDidItStartForm } from './forms/HowDidItStartForm' import { Layout } from './components/layout' import { BackButton } from './components/backbutton' import { Stack } from '@chakra-ui/core' import { useStateValue } from './utils/state' import { Page } from './components/Page' import { useLog } from './useLog' export const HowDidItStartPage = () => { const [data, dispatch] = useStateValue() const { doneForms } = data useLog('HowDidStartPage') return ( <Route render={({ history }) => ( <Page> <Layout columns={{ base: 4 / 4, md: 6 / 8, lg: 7 / 12 }}> <Stack spacing={10} shouldWrapChildren> <BackButton /> <H1> <Trans id="howDidItStartPage.title" /> </H1> <Stack spacing={4}> <Lead> <Trans id="howDidItStartPage.intro" /> </Lead> </Stack> <HowDidItStartForm history={history} onSubmit={(data) => { dispatch({ type: 'saveFormData', data: { howdiditstart: data }, }) history.push(doneForms ? '/confirmation' : '/whenDidItHappen') }} /> </Stack> </Layout> </Page> )} /> ) } <|start_filename|>f2/src/utils/__tests__/formatPhoneNumber.test.js<|end_filename|> import { formatPhoneNumber } from '../formatPhoneNumber' describe('formatPhoneNumber', () => { it('turns an empty number into an empty string', () => { expect(formatPhoneNumber('')).toEqual('') expect(formatPhoneNumber(undefined)).toEqual('') }) it('leaves a funny number alone', () => { expect(formatPhoneNumber('hi there')).toEqual('hi there') expect(formatPhoneNumber('123-4567')).toEqual('123-4567') expect(formatPhoneNumber('+1 123 456 7890')).toEqual('+1 123 456 7890') }) it('formats a valid number correctly', () => { expect(formatPhoneNumber('123 456 7890')).toEqual('(123) 456-7890') expect(formatPhoneNumber('123-456-7890')).toEqual('(123) 456-7890') expect(formatPhoneNumber('(123)456-7890')).toEqual('(123) 456-7890') }) }) <|start_filename|>f2/src/theme/style.css<|end_filename|> body { font-family: 'Noto Sans', sans-serif; color: rgb(0, 0, 0); } /*Forms*/ .row { width: 100%; } .form-group { width: 100%; } .form-label { font-size: 1.25rem; font-weight: 700; margin-bottom: 0.25rem; line-height: 1; margin-left: 0px; max-width: 600px; } .form-question { padding-bottom: 1rem; display: grid; } .form-helper-text { margin-top: 0.25rem; line-height: 1.25; font-size: 1rem; margin-left: 0px; max-width: 600px; } .form-section { display: inline-block; margin-bottom: 3rem; width: 100%; } .white-button-link:hover, .black-button-link:hover { text-decoration: none; } .white-button-link:hover { color: rgb(255, 255, 255); } .black-button-link:hover { color: inherit; } /*Checkboxes and Radio Buttons*/ .custom-checkbox .custom-control-label:before { border-radius: 0rem; } .custom-control .custom-control-input:checked ~ .custom-control-label::before { background-color: white; border-color: black; } .custom-control .custom-control-input:checked ~ .custom-control-label::after { justify-content: center; width: 2.5rem; height: 2.5rem; filter: invert(100%) sepia(32%) saturate(0%) hue-rotate(269deg) brightness(101%) contrast(102%); top: 0rem; display: initial; border-color: black; } .custom-control .custom-control-input:focus ~ .custom-control-label::before { background-color: rgb(255, 255, 255); border-color: black; box-shadow: rgba(99, 179, 237, 0.6) 0px 0px 4px 1px; outline: none; } .custom-control .custom-control-input:not(:checked) ~ .custom-control-label::before { background-color: rgb(255, 255, 255); } <|start_filename|>f2/src/components/backbutton/index.js<|end_filename|> /** @jsx jsx **/ import { jsx } from '@emotion/core' import { Icon } from '@chakra-ui/core' import { LinkButton } from '../link' import PropTypes from 'prop-types' import { Route } from 'react-router-dom' import { Trans } from '@lingui/macro' export const BackButton = ({ variant, variants, variantColor, ...props }) => ( <Route render={({ history }) => ( <LinkButton d="inline-flex" alignItems="center" onClick={e => { e.preventDefault() history.goBack() }} href="#" tabindex="0" {...props} > <Icon name="chevron-left" /> <Trans id="backButton.text" /> </LinkButton> )} /> ) BackButton.propTypes = { route: PropTypes.string, children: PropTypes.any, } <|start_filename|>f2/src/components/file-upload/index.js<|end_filename|> /** @jsx jsx */ import PropTypes from 'prop-types' import { jsx } from '@emotion/core' import { Label } from '../label' import { VisuallyHidden } from '@chakra-ui/core' import { Button } from '../button' import { acceptableExtensions } from '../../utils/acceptableFiles' export const FileUpload = ({ onChange, accept, ...props }) => { return ( <Label> <Button {...props} as="div" _focusWithin={{ boxShadow: 'outline', }} > <VisuallyHidden as="input" type="file" id="uploader" name="uploader" accept={acceptableExtensions.join(',')} max-upload={3} onChange={onChange} /> {props.children} </Button> </Label> ) } FileUpload.defaultProps = { accept: undefined, } FileUpload.propTypes = { onChange: PropTypes.func.isRequired, accept: PropTypes.string, } <|start_filename|>f2/src/utils/sanitize.js<|end_filename|> const sanitizeHtml = require('sanitize-html') const sanitize = (input) => sanitizeHtml(input, { allowedTags: [], allowedAttributes: {}, }) module.exports = { sanitize } <|start_filename|>f2/src/components/datePicker/index.js<|end_filename|> import React from 'react' import { Trans } from '@lingui/macro' import { Field } from '../Field' import { Stack } from '@chakra-ui/core' import { TextInput } from '../TextInput' export const DatePicker = (props) => ( <Stack direction="row" spacing="2"> <Field name={props.datePickerName + 'Day'} label={<Trans id="whenDidItStart.startDay" />} component={TextInput} //group={props.group} w={70} maxLength="2" /> <Field name={props.datePickerName + 'Month'} label={<Trans id="whenDidItStart.startMonth" />} component={TextInput} //group={props.group} w={70} maxLength="2" /> <Field name={props.datePickerName + 'Year'} label={<Trans id="whenDidItStart.startYear" />} component={TextInput} //group={props.group} w={110} maxLength="4" /> </Stack> ) export const SingleDatePicker = (props) => { return ( <Stack spacing={4} pb="5"> <Field name={props.name} datePickerName={props.datePickerName} group={props.group} label={props.label} helperText={props.helperText} component={DatePicker} /> </Stack> ) } export const DateRangePicker = (props) => { return ( <React.Fragment> <SingleDatePicker name={props.name + 'Start'} datePickerName="start" group={props.group} label={props.startLabel} helperText={props.helperText} /> <SingleDatePicker name={props.name + 'End'} datePickerName="end" group={props.group} label={props.endLabel} helperText={props.helperText} /> </React.Fragment> ) } <|start_filename|>f2/.storybook/preview.js<|end_filename|> import { configure, addDecorator, addParameters } from '@storybook/react' import { DocsPage, DocsContainer } from '@storybook/addon-docs/blocks' addParameters({ docs: { container: DocsContainer, page: DocsPage, }, options: { storySort: (a, b) => a[1].kind === b[1].kind ? 0 : a[1].id.localeCompare(b[1].id, undefined, { numeric: true }), }, }) <|start_filename|>f2/cypress/integration/common/yourlocation_page_fr.js<|end_filename|> import { When } from 'cypress-cucumber-preprocessor/steps' When('I fill yourLocation page forms', () => { cy.get('form').find('[id="city"]').type('Montreal') cy.get('form').find('[id="province"]').type('Quebec') }) <|start_filename|>f2/src/utils/submitToServer.js<|end_filename|> import fetch from 'isomorphic-fetch' async function postData(url = '', data = {}) { var form_data = new FormData() form_data.append('json', JSON.stringify(data)) // Default options are marked with * const response = await fetch(url, { method: 'POST', mode: 'cors', cache: 'no-cache', credentials: 'same-origin', redirect: 'follow', referrer: 'no-referrer', body: form_data, }) return response } export const submitToServer = async (data) => { console.info('Submitting Feedback:', data) await postData('/submitFeedback', data) } <|start_filename|>f2/src/components/formik/conditionalField/index.js<|end_filename|> import styled from '@emotion/styled' export const ConditionalField = styled('div')` border-left-width: 0.25rem; border-left-color: rgb(174, 174, 174); margin-left: 1.25rem; padding-top: 1rem; padding-left: 1.5rem; width: -webkit-fill-available; ` <|start_filename|>f2/.storybook/formDecorator.js<|end_filename|> import React from 'react' import { Form } from 'react-final-form' const validate = () => { const errors = { email: 'contactinfoForm.email.warning' } return errors } const FormDecorator = (storyFn) => ( <Form initialValues={''} onSubmit={(values) => { props.onSubmit(values) }} validate={validate} render={(values) => storyFn()} /> ) export default FormDecorator <|start_filename|>f2/src/ConfirmCancelPage.js<|end_filename|> /** @jsx jsx */ import { jsx } from '@emotion/core' import { Trans } from '@lingui/macro' import { H1 } from './components/header' import { Layout } from './components/layout' import { Stack, Flex } from '@chakra-ui/core' import { Route } from 'react-router-dom' import { P } from './components/paragraph' import { Button } from './components/button' import { useStateValue } from './utils/state' import { Page } from './components/Page' import { useLog } from './useLog' export const ConfirmCancelPage = () => { const [, dispatch] = useStateValue() useLog('LandingPage') return ( <Route render={({ history }) => ( <Page> <Layout columns={{ base: 4 / 4, md: 6 / 8, lg: 7 / 12 }}> <Stack spacing={10} shouldWrapChildren> <H1> <Trans id="confirmCancelPage.title" /> </H1> <Flex direction="row" align="center" wrap="wrap" mb={10} mt={10}> <P w="100%"> <Trans id="confirmCancelPage.summary" /> </P> <Button id="cancelReport" onClick={() => { dispatch({ type: 'deleteFormData', }) history.push('/cancelled') }} type="submit" w={{ base: '100%', md: 'auto' }} variantColor="red" > <Trans id="confirmCancelPage.cancelButton" /> </Button> <Button onClick={() => history.goBack()} fontSize={{ base: 'lg', md: 'xl' }} color="black" height="3rem" variantColor="gray" textAlign="center" w={{ base: '100%', md: 'auto' }} ml={{ base: 0, md: 4 }} mt={{ base: 4, md: 0 }} > <Trans id="confirmCancelPage.goBack" /> </Button> </Flex> </Stack> </Layout> </Page> )} /> ) } <|start_filename|>f2/cypress/integration/common/common.js<|end_filename|> import { Given, Then } from 'cypress-cucumber-preprocessor/steps' // CLick <continue> button Then('I click {string}', () => { //cy.get('[data-cy=submit]').click({ force: true }) cy.contains('Continue').first().click({ force: true }) }) // Display the next page Given('{string} should be shown', (content) => { cy.contains(content, { timeout: 10000 }).should('be.visible') }) // Take screen shoot at summary page Then('Take summary page screenshot', (content) => { cy.screenshot('reportSummary') cy.wait(10000) }) // Submit report button at summary page Then('I submit report', () => { //cy.get('[data-cy=submit]').click({ force: true }) cy.contains('Submit report').first().click({ force: true }) }) Then('I submit report in French', () => { //cy.get('[data-cy=submit]').click({ force: true }) cy.contains('Soumettre le rapport').first().click({ force: true }) }) <|start_filename|>f2/src/utils/__tests__/formatPostalCode.test.js<|end_filename|> import { formatPostalCode } from '../formatPostalCode' describe('formatPostalCode', () => { it('turns an empty or undefined string into an empty string', () => { expect(formatPostalCode('')).toEqual('') expect(formatPostalCode(undefined)).toEqual('') }) it('leaves correctly formatted postal codes alone', () => { expect(formatPostalCode('A1A 2B2')).toEqual('A1A 2B2') }) it('capitalizes letters', () => { expect(formatPostalCode('a1A 2b2')).toEqual('A1A 2B2') }) it('adds a space in the middle if needed', () => { expect(formatPostalCode('A1A2B2')).toEqual('A1A 2B2') }) }) <|start_filename|>f2/src/pdf/DevicesView.js<|end_filename|> /** @jsx jsx */ import { jsx } from '@emotion/core' import { containsData } from '../utils/containsData' import { testdata } from '../ConfirmationSummary' import { Text, View, Image } from '@react-pdf/renderer' import { pdfStyles } from './pdfStyles' import { DescriptionItemView } from './DescriptionItemView' import line from '../images/line.png' export const DevicesView = (props) => { const lang = props.lang const devices = { ...testdata.formData.devicesInfo, ...props.data.formData.devicesInfo, } return ( <View style={pdfStyles.section}> <Text style={pdfStyles.title}> {lang['confirmationPage.devicesTitle']} </Text> {containsData(devices) ? ( <View> <DescriptionItemView title="confirmationPage.devices.device" description={devices.device} lang={lang} /> <DescriptionItemView title="confirmationPage.devices.account" description={devices.account} lang={lang} /> </View> ) : ( <Text style={pdfStyles.sectionContent}> {lang['confirmationPage.devices.nag']} </Text> )} <Image style={pdfStyles.sectionSeparator} src={line} /> </View> ) } <|start_filename|>f2/src/components/formik/warningModal/index.js<|end_filename|> import React, { useState } from 'react' import { Prompt } from 'react-router-dom' import { Container, Row, Modal } from 'react-bootstrap' import { Route } from 'react-router-dom' import { Trans } from '@lingui/macro' import { DefaultButton } from '../button' export const WarningModal = (props) => { const [showModal, setShowModal] = useState(false) const [confirmNav, setConfirmNav] = useState(false) const confirm = (history) => { setShowModal(false) setConfirmNav(true) history.goBack() } const cancel = () => { setShowModal(false) } const shouldPrompt = (dirty, isSubmitting) => { const alteredForm = dirty && !isSubmitting return alteredForm && !confirmNav } return ( <Route render={({ history }) => ( <React.Fragment> <Prompt when={shouldPrompt(props.dirty, props.isSubmitting)} message={(location, action) => { if (action === 'PUSH') { return true } else { setShowModal(true) return false } }} /> <Modal show={showModal} backdrop="static"> <Modal.Header closeButton> <Modal.Title> <Trans id="warningModal.title" /> </Modal.Title> </Modal.Header> <Modal.Body> <Container> <Row> <Trans id="warningModal.body" /> </Row> </Container> </Modal.Body> <Modal.Footer> <DefaultButton onClick={() => confirm(history)} label={<Trans id="button.ok" />} /> <DefaultButton onClick={cancel} label={<Trans id="button.cancel" />} /> </Modal.Footer> </Modal> </React.Fragment> )} /> ) } <|start_filename|>f2/src/forms/__tests__/LocationInfoForm.test.js<|end_filename|> import React from 'react' import wait from 'waait' import { i18n } from '@lingui/core' import { render, fireEvent, cleanup, act } from '@testing-library/react' import { MemoryRouter } from 'react-router-dom' import { ThemeProvider } from 'emotion-theming' import { I18nProvider } from '@lingui/react' import { LocationInfoForm } from '../LocationInfoForm' import en from '../../locales/en.json' import canada from '../../theme/canada' import { StateProvider, initialState, reducer } from '../../utils/state' i18n.load('en', { en }) i18n.activate('en') const clickOn = (element) => fireEvent.click(element) describe('<LocationInfoForm />', () => { afterEach(cleanup) it('calls the onSubmit function when the form is submitted', async () => { const submitMock = jest.fn() const { getByText } = render( <MemoryRouter initialEntries={['/']}> <ThemeProvider theme={canada}> <I18nProvider i18n={i18n}> <StateProvider initialState={initialState} reducer={reducer}> <LocationInfoForm onSubmit={submitMock} /> </StateProvider> </I18nProvider> </ThemeProvider> </MemoryRouter>, ) // find the next button so we can trigger a form submission const nextButton = getByText(/nextButton/) await act(async () => { // Click the next button to trigger the form submission clickOn(nextButton.parentElement) await wait(0) // Wait for promises to resolve }) expect(submitMock).toHaveBeenCalledTimes(1) }) }) <|start_filename|>f2/src/utils/scanFiles.js<|end_filename|> require('dotenv').config() const clamd = require('clamdjs') const fs = require('fs') var async = require('async') const CognitiveServicesCredentials = require('ms-rest-azure') .CognitiveServicesCredentials const ContentModeratorAPIClient = require('azure-cognitiveservices-contentmoderator') const { getLogger } = require('./winstonLogger') const logger = getLogger(__filename) const SUPPORTED_FILE_TYPES = [ 'image/gif', 'image/jpeg', 'image/png', 'image/bmp', ] let serviceKey = process.env.CONTENT_MODERATOR_SERVICE_KEY if (!serviceKey) console.warn('WARNING: Azure content moderator not configured') let langEn = fs.readFileSync('src/locales/en.json') let langFr = fs.readFileSync('src/locales/fr.json') let langJsonEn = JSON.parse(langEn) let langJsonFr = JSON.parse(langFr) async function scanFiles(data) { try { var scanner = clamd.createScanner(process.env.CLAM_URL, 3310) for (const file of Object.entries(data.evidence.files)) { //scan file for virus var readStream = fs.createReadStream(file[1].path) //set timeout for 10000 await scanner .scanStream(readStream, 10000) .then(function (reply) { file[1].malwareScanDetail = reply file[1].malwareIsClean = clamd.isCleanReply(reply) logger.info({ message: 'Virus scan succeeded for ' + data.reportId, sessionId: data.sessionId, reportId: data.reportId, path: '/submit', response: JSON.stringify(reply, Object.getOwnPropertyNames(reply)), }) }) .catch(function (reply) { let lang //set language to use based report language data.language === 'en' ? (lang = langJsonEn) : (lang = langJsonFr) file[1].malwareScanDetail = lang['fileUpload.virusScanError'] file[1].malwareIsClean = false logger.error({ message: 'Virus scan failed on ' + data.reportId, sessionId: data.sessionId, reportId: data.reportId, path: '/submit', error: JSON.stringify(reply, Object.getOwnPropertyNames(reply)), }) try { let filesDir = '/home/' + data.reportId if (!fs.existsSync(filesDir)) { fs.mkdirSync(filesDir) } fs.copyFileSync(file[1].path, filesDir + '/' + file[1].name) } catch (ex) { console.error('Failed to save uploaded files ' + ex) } }) } } catch (error) { logger.error({ message: 'WARNING: File scanning failed', sessionId: data.sessionId, reportId: data.reportId, path: '/submit', error: JSON.stringify(error, Object.getOwnPropertyNames(error)), }) } } let credentials = serviceKey ? new CognitiveServicesCredentials(serviceKey) : undefined let client = serviceKey ? new ContentModeratorAPIClient( credentials, 'https://canadacentral.api.cognitive.microsoft.com/', ) : undefined const contentModerateFile = (file, callback) => { if (!SUPPORTED_FILE_TYPES.includes(file[1].type)) { let lang //set language to use based report language file[0] === 'en' ? (lang = langJsonEn) : (lang = langJsonFr) console.debug( `Content Moderator File not scanned Azure image moderator doesn't support for file type ${file[1].type}`, ) file[1].adultClassificationScore = lang['fileUpload.fileTypeError'] callback(null, file[1]) return } var readStream = fs.createReadStream(file[1].path) client.imageModeration.evaluateFileInput(readStream, {}, function ( err, _result, _request, response, ) { if (err) { console.warn(`Error in Content Moderator: ${JSON.stringify(err)} `) /*logger.error({ ns: 'server.submit.contentmoderator.error', message: 'Error in Content Moderator', error: err, })*/ file[1].adultClassificationScore = 'Could not scan' } else { try { const contMod = JSON.parse(response.body) file[1].isImageRacyClassified = contMod.IsImageRacyClassified file[1].isImageAdultClassified = contMod.IsImageAdultClassified file[1].adultClassificationScore = contMod.AdultClassificationScore file[1].racyClassificationScore = contMod.RacyClassificationScore } catch (error) { console.warn(`Error in Content Moderator: ${error.stack} `) } } callback(null, file[1]) }) } async function contentModeratorFiles(data, finalCallback) { if (!serviceKey) console.warn('Warning: files not scanned with Content Moderator') else { let files = Object.entries(data.evidence.files).map((file) => { file[0] = data.language return file }) async.map(files, contentModerateFile, function (err, _results) { if (err) console.warn('Content Moderator Error:' + JSON.stringify(err)) finalCallback() }) } } module.exports = { scanFiles, contentModeratorFiles } <|start_filename|>f2/src/summary/InformationSummary.js<|end_filename|> /** @jsx jsx */ import React from 'react' import { jsx } from '@emotion/core' import { Trans } from '@lingui/macro' import { Stack, Flex } from '@chakra-ui/core' import { useStateValue } from '../utils/state' import { testdata } from '../ConfirmationSummary' import { EditButton } from '../components/EditButton' import { H2 } from '../components/header' import { DescriptionListItem } from '../components/DescriptionListItem' import { useLingui } from '@lingui/react' import { Text } from '../components/text' import { formatList } from '../utils/formatList' import { containsData } from '../utils/containsData' export const InformationSummary = (props) => { const [data] = useStateValue() const { i18n } = useLingui() const personalInformation = { ...testdata.formData.personalInformation, ...data.formData.personalInformation, } //push all select entities into the stack and if 'other' is selected, push the value of other. const infoReqSummary = personalInformation.typeOfInfoReq.map((key) => key === 'typeOfInfoReq.other' && personalInformation.infoReqOther !== '' ? personalInformation.infoReqOther : i18n._(key), ) const infoReqLine = formatList(infoReqSummary, { pair: i18n._('default.pair'), middle: i18n._('default.middle'), end: i18n._('default.end'), }) //push all select entities into the stack and if 'other' is selected, push the value of other. const infoObtainedSummary = personalInformation.typeOfInfoObtained.map( (key) => key === 'typeOfInfoObtained.other' && personalInformation.infoObtainedOther !== '' ? personalInformation.infoObtainedOther : i18n._(key), ) const infoObtainedLine = formatList(infoObtainedSummary, { pair: i18n._('default.pair'), middle: i18n._('default.middle'), end: i18n._('default.end'), }) return ( <React.Fragment> {false ? ( <div> {/*: mark the proper ids for lingui */} <Trans id="confirmationPage.personalInformation.typeOfInfoReq" /> <Trans id="confirmationPage.personalInformation.typeOfInfoObtained" /> <Trans id="confirmationPage.personalInformation.title.edit" /> {/**Consider moving this upwards if we want to go towards lingui defaults */} <Trans id="default.pair" /> <Trans id="default.middle" /> <Trans id="default.end" /> </div> ) : null} <Stack className="section" spacing={4} borderBottom="2px" borderColor="gray.300" pb={4} {...props} > <Flex align="baseline"> <H2 fontWeight="normal"> <Trans id="confirmationPage.personalInformation.title" /> </H2> <EditButton path="/information" label="confirmationPage.personalInformation.title.edit" /> </Flex> {containsData(personalInformation) ? ( <Stack as="dl" spacing={4} shouldWrapChildren> <DescriptionListItem descriptionTitle="confirmationPage.personalInformation.typeOfInfoReq" description={infoReqLine} /> <DescriptionListItem descriptionTitle="confirmationPage.personalInformation.typeOfInfoObtained" description={infoObtainedLine} /> </Stack> ) : ( <Text> <Trans id="confirmationPage.personalInformation.nag" /> </Text> )} </Stack> </React.Fragment> ) } <|start_filename|>f2/src/utils/ldap.js<|end_filename|> const ldap = require('ldapjs') const fs = require('fs') const { getLogger } = require('./winstonLogger') require('dotenv').config() const logger = getLogger(__filename) const ldapUrl = process.env.LDAP_URL const ldapQuery = (uid, emailAddresses, uidList) => { var searchOptions = { filter: '(uid=' + uid + ')', scope: 'sub', attributes: ['mail', 'userCertificate;binary'], } const ldapClient = ldap.createClient({ url: ldapUrl, }) ldapClient.search('ou=People,ou=rcmp-grc,o=gc,c=ca', searchOptions, function ( err, res, ) { let entries = [] res.on('searchEntry', function (entry) { entries.push(entry.object) if (entry.object['mail'] && entry.object['userCertificate;binary']) { const emailAddress = entry.object['mail'] let cert = '-----BEGIN CERTIFICATE-----\r\n' + entry.object['userCertificate;binary'].replace(/(.{64})/g, '$1\r\n') if (!cert.endsWith('\n')) cert += '\n' cert += '-----END CERTIFICATE-----' fs.writeFile(certFileName(uid), cert, function (err) { if (err) throw err else { console.info( `ldapQuery: Certificate for ${emailAddress} (${uid}) found`, ) emailAddresses.push(emailAddress) uidList.push(uid) } }) } else { logger.error('User cert or emmail is missing for uid ' + uid) } }) res.on('searchReference', function (referral) { console.info('Encrypted Mail: referral: ' + referral.uris.join()) }) res.on('error', function (err) { console.warn('Encrypted Mail: error: ' + err.message) }) res.on('end', function (result) { if (entries.length === 0) { logger.error('Could not find LDAP entry for uid ' + uid) } if (result.status !== 0) console.info('Encrypted Mail: end status: ' + result.status) ldapClient.destroy() }) }) } function getCertsAndEmail(uids, emailAddresses, uidListFinal) { if (uids) uids.forEach((uid) => { ldapQuery(uid, emailAddresses, uidListFinal) }) else console.warn('ERROR: no HERMIS ids') } const certFileName = (uid) => `${uid}.cer` module.exports = { getCertsAndEmail, certFileName } <|start_filename|>f2/src/utils/selfHarmWordsScan.js<|end_filename|> // 'use strict' const unidecode = require('unidecode') const natural = require('natural') require('dotenv').config() const { getLogger } = require('./winstonLogger') const logger = getLogger(__filename) const selfHarmString = process.env.SELF_HARM_WORDS || 'agilé, lean, mvp, scrum' const selfHarmWords = selfHarmString .split(',') .map((w) => unidecode(w.trim().toLowerCase())) logger.info(`Self harm word list: ${selfHarmWords}`) //Scan form data for self harm key words. const selfHarmWordsScan = (data) => { try { //Patches stem() and tokenizeAndStem() to String as a shortcut to PorterStemmer.stem(token) if (data.language === 'fr') { natural.PorterStemmerFr.attach() } else { natural.PorterStemmer.attach() } let keyWordMatch = [] for (let key in data) { if (typeof data[key] === 'object') { keyWordMatch = keyWordMatch.concat(scanObject(data[key])) } if (typeof data[key] === 'string') { keyWordMatch = keyWordMatch.concat(scanString(data[key])) } } //Only return unique key words. const uniqeKeyWords = [...new Set(keyWordMatch)] return uniqeKeyWords } catch (err) { console.error(`Error scanning form for self-harm key words ${err}`) return [] } } //Scan String for key words. Tokenize and stem to identify root words. const scanString = (str) => { try { let modifiedStr = unidecode(str.toLowerCase()) modifiedStr = modifiedStr .replace(/\r?\n|\r/g, ' ') //Remove newline characters .replace(/[^\w\s']|_/g, ' ') //Remove special characters .replace(/\s+/g, ' ') //Remove any extra sapaces //Attempt to get root for words in String. const formTokens = modifiedStr.tokenizeAndStem() //Create one String with both original and stemmed words. modifiedStr = modifiedStr + ' ' + formTokens.toString().replace(/,/g, ' ') //Compare text to the list of key words. const wordsUsed = selfHarmWords.filter((w) => { const regEx = new RegExp('\\b' + w + '\\b') return regEx.test(modifiedStr) }) return wordsUsed } catch (err) { logger.error({ message: 'Error parsing String for self-harm key words', string: str, error: err, }) return [] } } //Scan object for String values. This assumes one level of nested objects. const scanObject = (obj) => { let objStrings = [] try { for (let key in obj) { if (typeof obj[key] === 'object') { let subObj = obj[key] for (let subKey in subObj) { if (typeof subObj[subKey] === 'string') { objStrings = objStrings.concat(scanString(subObj[subKey])) } } } if (typeof obj[key] === 'string') { objStrings = objStrings.concat(scanString(obj[key])) } } } catch (err) { logger.error({ message: 'Error parsing Object for self-harm key words', object: obj, error: err, }) return [] } return objStrings } module.exports = { selfHarmWordsScan } <|start_filename|>f2/src/utils/__tests__/formatDate.test.js<|end_filename|> import { formatDate } from '../formatDate' describe('formatDate', () => { it('formats a full date correctly', () => { expect(formatDate(20, 11, 2020)).toEqual('2020-11-20') expect(formatDate('20', '11', '2020')).toEqual('2020-11-20') }) it('pads days and months', () => { expect(formatDate(1, 2, 2020)).toEqual('2020-02-01') }) it('formats a month/year correctly', () => { expect(formatDate('', 11, 2020)).toEqual('2020-11') expect(formatDate(undefined, 11, 2020)).toEqual('2020-11') }) it('formats a year correctly', () => { expect(formatDate('', '', 2020)).toEqual('2020') expect(formatDate(undefined, undefined, 2020)).toEqual('2020') }) it('formats empty data correctly', () => { expect(formatDate('', '', '')).toEqual('') expect(formatDate(undefined, undefined, undefined)).toEqual('') }) }) <|start_filename|>f2/src/components/button/Button.stories.js<|end_filename|> import React from 'react' import ThemeDecorator from '../../../.storybook/themeDecorator' import { Button } from '.' import { Stack } from '@chakra-ui/core' export default { title: 'Components/Button', decorators: [ThemeDecorator], } export const textButton = () => ( <Button variantColor="green" variant="solid"> Button </Button> ) export const withIcon = () => ( <Stack spacing={4} direction="row"> <Button variantColor="green" variant="solid" rightIcon="chevron-right"> Start </Button> <Button variantColor="blue" variant="solid" leftIcon="attachment"> Add File </Button> </Stack> ) export const variantColor = () => ( <Stack spacing={4} direction="row"> <Button variantColor="green" variant="solid"> Continue </Button> <Button variantColor="blue" variant="solid"> Primary </Button> <Button variantColor="gray" variant="solid"> Secondary </Button> <Button variantColor="black" variant="solid"> Call to action </Button> <Button variantColor="red" variant="solid"> Danger </Button> </Stack> ) <|start_filename|>f2/src/components/Messages/index.js<|end_filename|> import React from 'react' import PropTypes from 'prop-types' import canada from '../../theme/canada' import { Container } from '../container' import { statuses, Alert as ChakraAlert, AlertIcon } from '@chakra-ui/core' export const Well = ({ variantColor, ...props }) => ( <Container rounded="4px" boxShadow="innerShadow" p={4} border="1px" {...(variantColor && { borderColor: canada.colors[variantColor][400], bg: canada.colors[variantColor][200], boxShadow: `inset 0 1px 1px ${canada.colors[variantColor][300]}`, })} {...props} /> ) Well.defaultProps = { variantColor: 'gray', } Well.propTypes = { variantColor: PropTypes.string, } export const Alert = ({ status, withIcon, ...props }) => { //canada.colors[statuses[status].color][700] //This gets the color of status defined by chakra-ui : // statuses[status].color = statuses[info].color = blue //Then we use it to get a color shade in the theme file: // canada.colors[blue][800] return ( <ChakraAlert status={status} borderLeft="3px" borderColor={canada.colors[statuses[status].color][800]} {...props} > {withIcon && ( <AlertIcon name={`${statuses[status].icon}`} color={canada.colors[statuses[status].color][800]} /> )} {props.children} </ChakraAlert> ) } Alert.defaultProps = {} Alert.propTypes = { status: PropTypes.oneOf(['success', 'info', 'warning', 'error']).isRequired, withIcon: PropTypes.bool, } <|start_filename|>f2/Dockerfile<|end_filename|> FROM node:12.18-alpine AS build-env WORKDIR /app COPY . . ARG REACT_APP_GOOGLE_ANALYTICS_ID ENV REACT_APP_GOOGLE_ANALYTICS_ID $REACT_APP_GOOGLE_ANALYTICS_ID ARG REACT_APP_VERSION ENV REACT_APP_VERSION $REACT_APP_VERSION ARG REACT_APP_GOOGLE_GTM_ID ENV REACT_APP_GOOGLE_GTM_ID $REACT_APP_GOOGLE_GTM_ID ARG REACT_APP_DEV_ENVIRONMENT ENV REACT_APP_DEV_ENVIRONMENT $REACT_APP_DEV_ENVIRONMENT ARG REACT_APP_RECAPTCHA_KEY ENV REACT_APP_RECAPTCHA_KEY $REACT_APP_RECAPTCHA_KEY ENV HUSKY_SKIP_INSTALL true RUN npm ci RUN npm run build FROM node:12.18-alpine LABEL maintainer="<EMAIL>" RUN apk add --no-cache openssl tzdata ENV TZ America/Toronto USER node ENV NODE_ENV production COPY --from=build-env --chown=node /app /app WORKDIR /app EXPOSE 3000 CMD ["node", "server.js"] <|start_filename|>f2/src/components/formik/textArea/index.js<|end_filename|> import styled from '@emotion/styled' import React from 'react' import { Form } from 'react-bootstrap' const HelpText = styled(Form.Text)` line-height: 1.25; font-size: 1rem; ` const Label = styled(Form.Label)` font-size: 1.25rem; font-weight: 700; margin-bottom: 0.25rem; line-height: 1; margin-left: 0px; max-width: 600px; ` const TextField = styled(Form.Control)` margin-top: 0.75rem; min-height: 80px; border-color: rgb(174, 174, 174); width: 100%; max-width: 600px; &:hover { box-shadow: rgb(213, 213, 213) 0px 0px 0px 2px; border-color: black; } &:focus { box-shadow: rgba(99, 179, 237, 0.6) 0px 0px 4px 1px; outline: none; border-color: black; } ` export const TextArea = ({ field, form, ...props }) => { return ( <Form.Group controlId={props.id}> <Label>{props.label}</Label> <HelpText>{props.helpText}</HelpText> <TextField {...field} as="textarea" rows={props.rows} onChange={props.onChange} /> </Form.Group> ) } <|start_filename|>f2/cypress/integration/common/howdiditstart_page.js<|end_filename|> import { When } from 'cypress-cucumber-preprocessor/steps' When('I fill howdiditstart page forms', () => { cy.get('form') .find('[value="howDidTheyReachYou.email"]') .check({ force: true }) cy.get('form').find('[name="email"]').type('<EMAIL>') cy.get('form') .find('[value="howDidTheyReachYou.phone"]') .check({ force: true }) cy.get('form').find('[name="phone"]').type('1-800-000-1111') cy.get('form') .find('[value="howDidTheyReachYou.online"]') .check({ force: true }) cy.get('form').find('[name="online"]').type('http://www.suspectEnglish.com') cy.get('form').find('[value="howDidTheyReachYou.app"]').check({ force: true }) cy.get('form').find('[name="application"]').type('Whatapps') cy.get('form') .find('[value="howDidTheyReachYou.others"]') .check({ force: true }) cy.get('form').find('[name="others"]').type('In Person') }) When('I fill howdiditstartEmail page forms', () => { cy.get('form') .find('[value="howDidTheyReachYou.email"]') .check({ force: true }) cy.get('form').find('[name="email"]').type('<EMAIL>') }) When('I fill howdiditstartPhone page forms', () => { cy.get('form') .find('[value="howDidTheyReachYou.phone"]') .check({ force: true }) cy.get('form').find('[name="phone"]').type('1-800-000-1111') }) When('I fill howdiditstartOnline page forms', () => { cy.get('form') .find('[value="howDidTheyReachYou.online"]') .check({ force: true }) cy.get('form').find('[name="online"]').type('http://www.suspect<EMAIL>') }) When('I fill howdiditstartApplication page forms', () => { cy.get('form').find('[value="howDidTheyReachYou.app"]').check({ force: true }) cy.get('form').find('[name="application"]').type('Whatapps') }) When('I fill howdiditstartOther page forms', () => { cy.get('form') .find('[value="howDidTheyReachYou.others"]') .check({ force: true }) cy.get('form').find('[name="others"]').type('In Person') }) When('I fill howdiditstartMailPhone page forms', () => { cy.get('form') .find('[value="howDidTheyReachYou.email"]') .check({ force: true }) cy.get('form').find('[name="email"]').type('<EMAIL>') cy.get('form') .find('[value="howDidTheyReachYou.phone"]') .check({ force: true }) cy.get('form').find('[name="phone"]').type('1-800-000-1111') }) When('I fill Nohowdiditstart page forms', () => {}) When('I fill howdiditstartInjection page forms', () => { cy.get('form') .find('[value="howDidTheyReachYou.others"]') .check({ force: true }) cy.fixture('form_data.json').then((user) => { var paragraph = user.htmlInjection cy.get('form').find('[name="others"]').type(paragraph) }) }) <|start_filename|>f2/src/components/backbutton/backbutton.stories.js<|end_filename|> import React from 'react' import { BackButton } from '.' import ThemeDecorator from '../../../.storybook/themeDecorator' //Doc Page export default { title: 'Components/Back Button', decorators: [ThemeDecorator], component: BackButton, } //Stories export const backButton = () => <BackButton /> <|start_filename|>f2/src/forms/SuspectCluesForm.js<|end_filename|> /** @jsx jsx */ import React from 'react' import { jsx } from '@emotion/core' import { Trans } from '@lingui/macro' import { TextArea } from '../components/formik/textArea' import { NextCancelButtons } from '../components/formik/button' import { useStateValue } from '../utils/state' import { Formik, FieldArray, Field } from 'formik' import { SuspectCluesFormSchema } from './SuspectCluesFormSchema' import { Form, Container, Row } from 'react-bootstrap' import { WarningModal } from '../components/formik/warningModal' export const SuspectCluesForm = (props) => { const [data] = useStateValue() const suspectClues = { ...data.formData.suspectClues, } const formOptions = [ { name: 'suspectClues1', label: <Trans id="suspectClues.question1" />, helpText: <Trans id="suspectClues.question1Details" />, }, { name: 'suspectClues2', label: <Trans id="suspectClues.question2" />, helpText: <Trans id="suspectClues.question2Details" />, }, { name: 'suspectClues3', label: <Trans id="suspectClues.question3" />, helpText: <Trans id="suspectClues.question3Details" />, }, ] return ( <React.Fragment> {false ? ( // the following trans tags are for analyst email <div> <Trans id="suspectClues.suspectDetails" /> </div> ) : null} <Formik initialValues={suspectClues} validationSchema={SuspectCluesFormSchema()} onSubmit={(values) => props.onSubmit(values)} > {({ handleSubmit, handleChange, handleBlur, dirty, isSubmitting }) => ( <Form onSubmit={handleSubmit}> <WarningModal dirty={dirty} isSubmitting={isSubmitting} /> <Container> <Row className="form-section"> <FieldArray name="suspectClues" className="form-section" render={() => formOptions.map((question) => { return ( <React.Fragment key={question.name}> <Field name={question.name} label={question.label} helpText={question.helpText} component={TextArea} onBlur={handleBlur} onChange={handleChange} id={'text-' + question.name} /> </React.Fragment> ) }) } /> </Row> </Container> <NextCancelButtons submit={<Trans id="suspectClues.nextButton" />} cancel={<Trans id="button.cancelReport" />} label={<Trans id="suspectClues.whatComesNext" />} /> </Form> )} </Formik> </React.Fragment> ) } <|start_filename|>f2/cypress/integration/common/whendidithappen_page.js<|end_filename|> import { When } from 'cypress-cucumber-preprocessor/steps' When('I fill whendidithappenonce page forms', () => { cy.get('form').find('[value="once"]').check({ force: true }) cy.get('form').find('[name="happenedOnceDay"]').type('21') cy.get('form').find('[name="happenedOnceMonth"]').type('7') cy.get('form').find('[name="happenedOnceYear"]').type('2020') }) When('I fill whendidithappenmore page forms', () => { cy.get('form').find('[value="moreThanOnce"]').check({ force: true }) cy.get('form').find('[name="startDay"]').type('2') cy.get('form').find('[name="startMonth"]').type('06') cy.get('form').find('[name="startYear"]').type('2020') cy.get('form').find('[name="endDay"]').type('23') cy.get('form').find('[name="endMonth"]').type('06') cy.get('form').find('[name="endYear"]').type('2020') }) When('I fill whendidithappennotsure page forms', () => { cy.get('form').find('[value="notSure"]').check({ force: true }) cy.get('form') .find('[name="description"]') .type('I think it is about second week of April') }) When('I fill whendidithappennotsureNodescription page forms', () => { cy.get('form').find('[value="notSure"]').check({ force: true }) }) <|start_filename|>f2/server.js<|end_filename|> const express = require('express') const bodyParser = require('body-parser') const path = require('path') const formidable = require('formidable') const helmet = require('helmet') const speakeasy = require('speakeasy') const { unflatten } = require('flat') const { sanitize } = require('./src/utils/sanitize') const { encryptAndSend } = require('./src/utils/encryptedEmail') const { getCertsAndEmail } = require('./src/utils/ldap') const availabilityService = require('./src/utils/checkIfAvailable') const { getData } = require('./src/utils/getData') const { saveRecord } = require('./src/utils/saveRecord') const { saveBlob } = require('./src/utils/saveBlob') const { serverFieldsAreValid } = require('./src/utils/serverFieldsAreValid') const { scanFiles, contentModeratorFiles } = require('./src/utils/scanFiles') const { verifyRecaptcha } = require('./src/utils/verifyRecaptcha') const { getLogger, getExpressLogger } = require('./src/utils/winstonLogger') const { notifyIsSetup, sendConfirmation, submitFeedback, } = require('./src/utils/notify') const { formatAnalystEmail } = require('./src/utils/formatAnalystEmail') const { fileSizePasses, fileExtensionPasses, } = require('./src/utils/acceptableFiles') const { convertImages } = require('./src/utils/imageConversion') // set up rate limiter: maximum of 100 requests per minute (about 12 page loads) var RateLimit = require('express-rate-limit') var limiter = new RateLimit({ windowMs: 1 * 60 * 1000, // 1 minute max: 100, }) require('dotenv').config() const logger = getLogger(__filename) const uidListInitial = process.env.LDAP_UID ? process.env.LDAP_UID.split(',').map((k) => k.trim()) : [] // certs and emails can be fetched in different order than the original uidListInitial let emailList = [] let uidList = [] getCertsAndEmail(uidListInitial, emailList, uidList) // Make sure that everything got loaded. // TODO: have a proper "system is ready" flag that express uses to deal with requests // (ex: tell CAFC we're not ready yet, return error code to /ping) setTimeout(() => { if ( uidListInitial.length === uidList.length && uidListInitial.length === emailList.length ) logger.info(`LDAP certs successfully fetched for: ${emailList}`) else logger.error('Problem fetching certs from LDAP') }, 5000) const app = express() app .use(helmet()) .use(helmet.referrerPolicy({ policy: 'same-origin' })) .use( helmet.featurePolicy({ features: { geolocation: ["'none'"], camera: ["'none'"] }, }), ) .use(getExpressLogger()) const allowedOrigins = [ 'https://dev.antifraudcentre-centreantifraude.ca', 'https://pre.antifraudcentre-centreantifraude.ca', 'https://antifraudcentre-centreantifraude.ca', 'https://centreantifraude-antifraudcentre.ca', 'https://antifraudcentre.ca', 'https://centreantifraude.ca', ] // Moved these out of save() and to their own function so we can block on 'saveBlob' to get the SAS link // without holding up the rest of the 'save' function async function saveBlobAndEmailReport(data) { var converted = await convertImages(data.evidence.files) data.evidence.files.push(...converted.filter((file) => file !== null)) // Await on this because saveBlob generates the SAS link for each file await saveBlob(uidList, data) const analystEmail = formatAnalystEmail(data) encryptAndSend(uidList, emailList, data, analystEmail) } // These can all be done async to avoid holding up the nodejs process? async function save(data, res) { await saveBlobAndEmailReport(data) if (notifyIsSetup && data.contactInfo.email) { sendConfirmation(data.contactInfo.email, data.reportId, data.language) } saveRecord(data, res) } const uploadData = async (req, res, fields, files) => { // Get all the data in the format we want, this function blocks because we need the data var data = await getData(fields, files) // Await here because we also need these results before saving await scanFiles(data) contentModeratorFiles(data, () => save(data, res)) } app.get('/', async function (req, res, next) { // Default to false. This represents if a user entered a valid TOTP code var isTotpValid = false // If the user passed in a TOTP query parm (/?totp=) and the correct // env var is set, then verify the code. if (req.query.totp && process.env.TOTP_SECRET) { // Check the TOTP code against the secret isTotpValid = speakeasy.totp.verify({ secret: process.env.TOTP_SECRET, encoding: 'base32', token: req.query.totp, }) } var referer = req.headers.referer if (isTotpValid || availabilityService.requestAccess(referer)) { logger.info({ message: 'New Request', }) next() } else { logger.info({ message: 'Redirecting to CAFC', }) res.redirect( req.subdomains.includes('signalement') ? 'https://www.antifraudcentre-centreantifraude.ca/report-signalez-fra.htm' : 'https://www.antifraudcentre-centreantifraude.ca/report-signalez-eng.htm', ) } }) app .use(limiter) .use(express.static(path.join(__dirname, 'build'))) .use(bodyParser.json()) .use(function (req, res, next) { var origin = req.headers.origin // Can only set one value of Access-Control-Allow-Origin, so we need some code to set it dynamically if ( origin !== undefined && allowedOrigins.indexOf(origin.toLowerCase()) > -1 ) { res.header('Access-Control-Allow-Origin', origin) res.header( 'Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept', ) } next() }) .get('/ping', function (_req, res) { return res.send('pong') }) .get('/available', function (_req, res) { res.json({ acceptingReports: availabilityService.isAvailable() }) }) .get('/stats', function (_req, res) { var data = availabilityService.getAvailableData() res.json({ acceptingReports: availabilityService.isAvailable(), ...data, }) }) .post('/client-logger', (req, res) => { if (req.body) { if (req.body.level === 'error') { logger.error(req.body) } else if (req.body.level === 'warn') { logger.warn(req.body) } else if (req.body.level === 'info') { logger.info(req.body) } else { logger.debug(req.body) } } res.send('OK') }) .post('/submit', (req, res) => { availabilityService.incrementSubmissions() var form = new formidable.IncomingForm() form.parse(req) let files = [] let fields = {} form.on('field', (fieldName, fieldValue) => { try { const rawValue = JSON.parse(fieldValue) let cleanValue // we have strings and arrays in our data fields if (typeof rawValue === 'object') cleanValue = rawValue.map(sanitize) else cleanValue = sanitize(rawValue) fields[fieldName] = cleanValue } catch (error) { logger.warn( `ERROR in /submit: parsing ${fieldName} value of ${fieldValue}: ${error}`, ) logger.error({ message: `ERROR in /submit: parsing ${fieldName} value of ${fieldValue}`, path: '/submit', error: JSON.stringify(error, Object.getOwnPropertyNames(error)), }) } }) form.on('file', function (name, file) { if (files.length >= 3) logger.warn('ERROR in /submit: number of files more than 3') else if (!fileSizePasses(file.size)) logger.warn( `ERROR in /submit: file ${name} too big (${file.size} bytes)`, ) else if (!fileExtensionPasses(name)) logger.warn( `ERROR in /submit: unauthorized file extension in file ${name}`, ) else files.push(file) }) form.on('end', () => { if (serverFieldsAreValid(fields)) { uploadData(req, res, unflatten(fields, { safe: true }), files) } else { res.status(422).send('invalid fields') // 422 is "Unprocessable Entity" } }) }) .post('/submitFeedback', (req, res) => { new formidable.IncomingForm().parse(req, (err, fields, files) => { if (err) { logger.error('ERROR', err) throw err } submitFeedback(sanitize(fields.json)) }) res.send('thanks') }) .get('/privacystatement', function (_req, res) { res.sendFile(path.join(__dirname, 'build', 'index.html')) }) .get('/termsandconditions', function (_req, res) { res.sendFile(path.join(__dirname, 'build', 'index.html')) }) .post('/checkToken', (req, res) => { new formidable.IncomingForm().parse(req, async (err, fields, files) => { if (err) { logger.error('ERROR', err) throw err } const token = JSON.parse(fields.json).token verifyRecaptcha(token, res) }) // res.send('thanks') }) // uncomment to allow direct loading of arbitrary pages .get('/*', function (_req, res) { res.sendFile(path.join(__dirname, 'build', 'index.html')) }) const port = process.env.PORT || 3000 console.info(`Listening at port ${port}`) app.listen(port) <|start_filename|>f2/src/forms/BusinessInfoForm.js<|end_filename|> /** @jsx jsx */ import PropTypes from 'prop-types' import React from 'react' import { jsx } from '@emotion/core' import { Trans } from '@lingui/macro' import { Form, Container, Row } from 'react-bootstrap' import { Formik, FieldArray, Field, ErrorMessage } from 'formik' import { CheckBoxRadio } from '../components/formik/checkboxRadio' import { Input } from '../components/formik/input' import { useStateValue } from '../utils/state' import { formDefaults } from './defaultValues' import { NextCancelButtons } from '../components/formik/button' import { WarningModal } from '../components/formik/warningModal' export const BusinessInfoForm = (props) => { const [data] = useStateValue() const businessInfo = { ...formDefaults.businessInfo, ...data.formData.businessInfo, } const formOptions = [ { name: 'oneTo99', radioLabel: <Trans id="numberOfEmployee.1To99" />, radioName: 'numberOfEmployee.1To99', radioValue: 'numberOfEmployee.1To99', }, { name: 'oneHundredTo499', radioLabel: <Trans id="numberOfEmployee.100To499" />, radioName: 'numberOfEmployee.100To499', radioValue: 'numberOfEmployee.100To499', }, { name: 'fiveHundredMore', radioLabel: <Trans id="numberOfEmployee.500More" />, radioName: 'numberOfEmployee.500More', radioValue: 'numberOfEmployee.500More', }, ] return ( <React.Fragment> <Formik initialValues={businessInfo} onSubmit={(values) => { props.onSubmit(values) }} > {({ handleSubmit, handleChange, handleBlur, dirty, isSubmitting }) => ( <Form onSubmit={handleSubmit}> <WarningModal dirty={dirty} isSubmitting={isSubmitting} /> <Container> <Row className="form-question"> <ErrorMessage name="businessInfo" component={Error} /> </Row> <Row className="form-section"> <Field name="nameOfBusiness" label={<Trans id="businessPage.nameOfBusiness" />} component={Input} onChange={handleChange} onBlur={handleBlur} id={'name-of-business'} /> <Field name="industry" label={<Trans id="businessPage.industry" />} helpText={<Trans id="businessPage.industryExample" />} component={Input} onChange={handleChange} onBlur={handleBlur} id={'type-of-industry'} /> <Field name="role" label={<Trans id="businessPage.role" />} helpText={<Trans id="businessPage.roleExample" />} component={Input} onChange={handleChange} onBlur={handleBlur} id={'role-of-industry'} /> <Row className="form-label"> <Trans id="numberOfEmployee.label" /> </Row> <Row className="form-helper-text"> <Trans id="numberOfEmployee.labelExample" /> </Row> </Row> <Row className="form-section"> <FieldArray name="numberOfEmployee" className="form-section" render={() => formOptions.map((question) => { return ( <React.Fragment key={question.name}> <Field name="numberOfEmployee" label={question.radioLabel} component={CheckBoxRadio} value={question.radioValue} onChange={handleChange} onBlur={handleBlur} type="radio" id={'radio-' + question.name} /> </React.Fragment> ) }) } /> </Row> <Row> <NextCancelButtons submit={<Trans id="businessInfoPage.nextButton" />} cancel={<Trans id="button.cancelReport" />} label={<Trans id={props.nextpageText} />} /> </Row> </Container> </Form> )} </Formik> </React.Fragment> ) } BusinessInfoForm.propTypes = { onSubmit: PropTypes.func.isRequired, } <|start_filename|>f2/src/ErrorBoundary.js<|end_filename|> import React, { Component } from 'react' const { getLogger } = require('./utils/winstonLoggerClient') const logger = getLogger(__filename) export default class ErrorBoundary extends Component { state = { error: '', errorInfo: '', hasError: false, } static getDerivedStateFromError(error) { // Update state so the next render will show the fallback UI. return { hasError: true } } componentDidCatch(error, info) { // log the error to winston console.log('Something wrong happened') logger.error({ message: 'Client App Error', error: JSON.stringify(error, Object.getOwnPropertyNames(error)), info: JSON.stringify(info, Object.getOwnPropertyNames(info)), }) this.setState({ info }) } render() { if (this.state.hasError) { // We will need a custom fallback UI here return <h1>Something went wrong.</h1> } return this.props.children } } <|start_filename|>f2/src/components/link/index.js<|end_filename|> /** @jsx jsx */ import { jsx } from '@emotion/core' import { Link as ReactRouterLink } from 'react-router-dom' import PropTypes from 'prop-types' import { Button } from '../button' import { Link as ChakraLink } from '@chakra-ui/core' //A link using react-router-dom. Useful for internal links. Takes a "to" attribute export const Link = props => ( <ChakraLink as={ReactRouterLink} color="blue.700" textDecoration="underline" fontSize={['md', null, 'lg', null]} _hover={{ color: 'blue.hover', }} {...props} > {props.children} </ChakraLink> ) Link.propTypes = { children: PropTypes.any, to: PropTypes.any.isRequired, } // Looks like a button, acts as a link export const ButtonLink = props => ( <Button {...props} as={ReactRouterLink} role="button"> {props.children} </Button> ) ButtonLink.propTypes = { children: PropTypes.any, to: PropTypes.any.isRequired, } // Looks like a link, acts as a button export const LinkButton = props => ( <ChakraLink color="blue.700" textDecoration="underline" fontSize={['md', null, 'lg', null]} _hover={{ color: 'blue.hover', }} {...props} tabIndex="0" _active={{ boxShadow: 'outline', }} > {props.children} </ChakraLink> ) LinkButton.propTypes = { children: PropTypes.any, onClick: PropTypes.func.isRequired, } // An anchor link. needs to contain an HREF. Useful for links outside the app export const A = props => ( <ChakraLink color="blue.700" textDecoration="underline" _hover={{ color: 'blue.hover', }} {...props} > {props.children} </ChakraLink> ) A.propTypes = { children: PropTypes.any, href: PropTypes.any.isRequired, } <|start_filename|>f2/src/pdf/InformationView.js<|end_filename|> /** @jsx jsx */ import { jsx } from '@emotion/core' import { containsData } from '../utils/containsData' import { testdata } from '../ConfirmationSummary' import { Text, View, Image } from '@react-pdf/renderer' import { pdfStyles } from './pdfStyles' import { DescriptionItemView } from './DescriptionItemView' import { formatList } from '../utils/formatList' import line from '../images/line.png' export const InformationView = (props) => { const lang = props.lang const personalInformation = { ...testdata.formData.personalInformation, ...props.data.formData.personalInformation, } //push all select entities into the stack and if 'other' is selected, push the value of other. const infoReqSummary = personalInformation.typeOfInfoReq.map((key) => key === 'typeOfInfoReq.other' && personalInformation.infoReqOther !== '' ? personalInformation.infoReqOther : lang[key], ) const infoReqLine = formatList(infoReqSummary, { pair: lang['default.pair'], middle: lang['default.middle'], end: lang['default.end'], }) //push all select entities into the stack and if 'other' is selected, push the value of other. const infoObtainedSummary = personalInformation.typeOfInfoObtained.map( (key) => key === 'typeOfInfoObtained.other' && personalInformation.infoObtainedOther !== '' ? personalInformation.infoObtainedOther : lang[key], ) const infoObtainedLine = formatList(infoObtainedSummary, { pair: lang['default.pair'], middle: lang['default.middle'], end: lang['default.end'], }) return ( <View style={pdfStyles.section}> <Text style={pdfStyles.title}> {lang['confirmationPage.personalInformation.title']} </Text> {containsData(personalInformation) ? ( <View> <DescriptionItemView title="confirmationPage.personalInformation.typeOfInfoReq" description={infoReqLine} lang={lang} /> <DescriptionItemView title="confirmationPage.personalInformation.typeOfInfoObtained" description={infoObtainedLine} lang={lang} /> </View> ) : ( <Text style={pdfStyles.sectionContent}> {lang['confirmationPage.personalInformation.nag']} </Text> )} <Image style={pdfStyles.sectionSeparator} src={line} /> </View> ) } <|start_filename|>f2/cypress.json<|end_filename|> { "projectId": "qe5gas", "testFiles": "**/*.feature", "env": { "production": "https://report.antifraudcentre.ca", "local": "http://localhost:3000/", "staging": "https://report-staging.con.rcmp-grc.gc.ca", "website": "http://localhost:3000/", "dev": "https://report-dev.con.rcmp-grc.gc.ca" } } <|start_filename|>f2/src/pdf/pdfStyles.js<|end_filename|> import { StyleSheet } from '@react-pdf/renderer' export const pdfStyles = StyleSheet.create({ page: { paddingTop: 35, paddingBottom: 65, paddingHorizontal: 35, }, header: { marginBottom: 10, }, topbanner: { marginLeft: 35, height: 25, width: 215, }, footerCanada: { position: 'absolute', marginLeft: 450, bottom: 30, height: 19, width: 60, }, beta: { marginTop: 5, marginLeft: 35, height: 15, width: 33, }, betaText: { fontSize: 10, marginTop: 8, marginLeft: 5, }, rowContainer: { display: 'flex', flexDirection: 'row', }, thankyou: { marginTop: 5, backgroundColor: '#92D68F', borderColor: '#3C9D3F', textAlign: 'center', flexDirection: 'column', }, thankyouTitle: { marginTop: 10, fontSize: 25, fontFamily: 'Helvetica-Bold', fontWeight: 'bold', }, referenceNumber: { marginTop: 20, marginBottom: 10, fontSize: 15, fontFamily: 'Helvetica', fontWeight: 'normal', }, section: { paddingBottom: -5, alignItems: 'stretch', }, sectionSeparator: { marginTop: 5, }, title: { fontSize: 18, fontFamily: 'Helvetica', fontWeight: 'normal', marginLeft: 12, marginTop: 20, marginBottom: 10, }, descriptionItem: { display: 'table', borderStyle: 'none', marginLeft: 12, }, descriptionRow: { flexDirection: 'row', }, descriptionItemTitle: { width: '40%', textAlign: 'left', paddingRight: 25, }, descriptionItemDescription: { width: '60%', textAlign: 'left', }, descriptionContentTitle: { marginTop: 10, fontSize: 12, fontFamily: 'Helvetica-Bold', fontWeight: 'bold', textAlign: 'left', }, descriptionContentDescription: { marginTop: 10, fontSize: 12, fontFamily: 'Helvetica', fontWeight: 'normal', textAlign: 'left', }, sectionContent: { fontSize: 12, fontFamily: 'Helvetica', fontWeight: 'normal', marginLeft: 12, marginTop: 10, }, bottomSection: { paddingTop: 10, alignItems: 'stretch', }, bottomTitle: { fontSize: 15, fontFamily: 'Helvetica', fontWeight: 'bold', marginLeft: 12, marginTop: 10, }, bottomContent: { fontSize: 12, fontFamily: 'Helvetica', fontWeight: 'normal', marginLeft: 12, marginTop: 10, }, bottomLink: { fontSize: 12, fontFamily: 'Helvetica', fontWeight: 'normal', marginLeft: 12, marginTop: 5, color: 'blue', textDecoration: 'underline', }, }) <|start_filename|>f2/src/EvidencePage.js<|end_filename|> /** @jsx jsx */ import { jsx } from '@emotion/core' import { Route } from 'react-router-dom' import { Trans } from '@lingui/macro' import { H1 } from './components/header' import { P, Lead } from './components/paragraph' import { Ul } from './components/unordered-list' import { Li } from './components/list-item' import { EvidenceInfoForm } from './forms/EvidenceInfoForm' import { Layout } from './components/layout' import { BackButton } from './components/backbutton' import { Stack, Box } from '@chakra-ui/core' import { useStateValue } from './utils/state' import { Page } from './components/Page' import { useLog } from './useLog' export const EvidencePage = () => { const [data, dispatch] = useStateValue() const { doneForms } = data const { fyiForm } = data.formData useLog('EvidencePage') return ( <Route render={({ history }) => ( <Page> <Layout columns={{ base: 4 / 4, md: 6 / 8, lg: 7 / 12 }}> <Stack spacing={10} shouldWrapChildren> <BackButton /> <H1> <Trans id="evidencePage.title" /> </H1> {fyiForm ? null : ( <Lead> <Trans id="evidencePage.intro" /> </Lead> )} <Box> <P> <Trans id="evidencePage.details" /> </P> <Ul> <Li> <Trans id="evidencePage.detail1" /> </Li> <Li> <Trans id="evidencePage.detail2" /> </Li> <Li> <Trans id="evidencePage.detail3" /> </Li> </Ul> </Box> <EvidenceInfoForm onSubmit={(data) => { dispatch({ type: 'saveFormData', data: { evidence: data } }) history.push(doneForms ? '/confirmation' : '/location') }} /> </Stack> </Layout> </Page> )} /> ) } <|start_filename|>f2/cypress/integration/common/howwereyourdevicesaffected_page_fr.js<|end_filename|> import { When } from 'cypress-cucumber-preprocessor/steps' When('I fill Howwereyourdevicesaffected in French page forms', () => { cy.get('form').find('[name="device"]').type('Tablette Surface') cy.get('form').find('[name="account"]').type('DisneyPlus') }) When('I fill Howwereyourdevicesaffected1 in French page forms', () => { cy.get('form').find('[name="device"]').type('Tablette Surface') }) <|start_filename|>f2/src/components/topbanner/index.js<|end_filename|> /** @jsx jsx **/ import { LocaleSwitcher } from '../../LocaleSwitcher' import { jsx } from '@emotion/core' import { useLingui } from '@lingui/react' import sigEn from '../../images/sig-blk-en.svg' import sigFr from '../../images/sig-blk-fr.svg' import { Flex, Box, Image } from '@chakra-ui/core' import { Layout } from '../layout' export const TopBanner = (props) => { const { i18n } = useLingui() return ( <Layout {...props}> <Flex align="center" fontFamily="body"> <Box py={4} mr="auto" flexBasis={{ base: 272, md: 360 }}> <Image src={i18n.locale === 'en' ? sigEn : sigFr} width="100%" alt={ i18n.locale === 'en' ? 'Symbol of the Government of Canada - Symbole du Gouvernement du Canada' : 'Symbole du Gouvernement du Canada - Symbol of the Government of Canada' } /> </Box> <Box py={4} pl={4} ml="auto"> <LocaleSwitcher /> </Box> </Flex> </Layout> ) } <|start_filename|>f2/src/forms/__tests__/MidFeedbackForm.test.js<|end_filename|> import React from 'react' import wait from 'waait' import { i18n } from '@lingui/core' import { MemoryRouter } from 'react-router-dom' import { render, fireEvent, cleanup } from '@testing-library/react' import { ThemeProvider } from 'emotion-theming' import { I18nProvider } from '@lingui/react' import en from '../../locales/en.json' import canada from '../../theme/canada' import { MidFeedbackForm } from '../MidFeedbackForm' i18n.load('en', { en }) i18n.activate('en') const clickOn = element => fireEvent.click(element) describe('<MidFeedbackForm />', () => { afterEach(cleanup) it('does not call the onSubmit function when the form is submitted empty', async () => { const submitMock = jest.fn() const { getByText } = render( <MemoryRouter initialEntries={['/']}> <ThemeProvider theme={canada}> <I18nProvider i18n={i18n}> <MidFeedbackForm onSubmit={submitMock} /> </I18nProvider> </ThemeProvider> </MemoryRouter>, ) const openButton = getByText('midFeedback.summary') openButton.click() /// find the next button so we can trigger a form submission const submitButton = getByText(/submit/) // Click the next button to trigger the form submission clickOn(submitButton.parentElement) await wait(0) // Wait for promises to resolve // We expect that sequence of events to have caused our onSubmit mock to get // not executed. No data was entered. expect(submitMock).toHaveBeenCalledTimes(0) }) it('calls the onSubmit function when the form is submitted non-empty', async () => { const submitMock = jest.fn() const { getByText, getByLabelText } = render( <MemoryRouter initialEntries={['/']}> <ThemeProvider theme={canada}> <I18nProvider i18n={i18n}> <MidFeedbackForm onSubmit={submitMock} /> </I18nProvider> </ThemeProvider> </MemoryRouter>, ) const openButton = getByText('midFeedback.summary') openButton.click() // find the next button so we can trigger a form submission const submitButton = getByText(/submit/) //Click on a checkbox const checkbox = getByLabelText('midFeedback.problem.confusing') clickOn(checkbox) // Click the next button to trigger the form submission clickOn(submitButton.parentElement) await wait(0) // Wait for promises to resolve // We expect that sequence of events to have caused our onSubmit mock to get // not executed. No data was entered. expect(submitMock).toHaveBeenCalledTimes(1) }) }) <|start_filename|>f2/src/components/backbutton/_tests_/backbutton.test.js<|end_filename|> import React from 'react' import { i18n } from '@lingui/core' import { I18nProvider } from '@lingui/react' import { render, cleanup } from '@testing-library/react' import { ThemeProvider } from 'emotion-theming' import { MemoryRouter } from 'react-router-dom' import canada from '../../../theme/canada' import { BackButton } from '../' import en from '../../../locales/en.json' i18n.load('en', { en }) i18n.activate('en') describe('<Button />', () => { afterEach(cleanup) it('properly renders child components', () => { const { getAllByText } = render( <MemoryRouter initialEntries={['/']}> <ThemeProvider theme={canada}> <I18nProvider i18n={i18n}> <BackButton /> </I18nProvider> </ThemeProvider> </MemoryRouter>, ) expect(getAllByText(/back/)).toHaveLength(1) }) }) <|start_filename|>f2/cypress/integration/common/yourlocation_page.js<|end_filename|> import { When } from 'cypress-cucumber-preprocessor/steps' When('I fill city and province Location page forms', () => { cy.get('form').find('[name="city"]').type('Ottawa') cy.get('form').find('[name="province"]').type('Ontario') }) When('I fill no Location page forms', () => {}) When('I fill city Location page forms', () => { cy.get('form').find('[name="city"]').type('Montreal') }) When('I fill province Location page forms', () => { cy.get('form').find('[name="province"]').type('Quebec') }) When('I fill postalCode1 page forms', () => { cy.get('form').find('[name="postalCode"]').type('k2j6r2') }) When('I fill postalCode2 page forms', () => { cy.get('form').find('[name="postalCode"]').type('m3h 6a7') }) When('I fill postalCode3 page forms', () => { cy.get('form').find('[name="postalCode"]').type('h3c5x6') }) When('I fill UnusedPostalCode page forms', () => { cy.get('form').find('[name="postalCode"]').type('b0a1a2') }) When('I fill InvalidPostalCode page forms', () => { cy.get('form').find('[name="postalCode"]').type('f2k1W2') }) <|start_filename|>f2/src/pdf/DescriptionItemView.js<|end_filename|> /** @jsx jsx */ import { jsx } from '@emotion/core' import { Text, View } from '@react-pdf/renderer' import { pdfStyles } from './pdfStyles' export const DescriptionItemView = (props) => { if ( typeof props.description === 'undefined' || props.description.length === 0 ) { return null } return ( <View style={pdfStyles.descriptionItem} wrap={false}> <View style={pdfStyles.descriptionRow}> <View style={pdfStyles.descriptionItemTitle}> <Text style={pdfStyles.descriptionContentTitle}> {props.lang[props.title]} </Text> </View> <View style={pdfStyles.descriptionItemDescription}> <Text style={pdfStyles.descriptionContentDescription}> {props.description} </Text> </View> </View> </View> ) } <|start_filename|>f2/src/components/container/index.js<|end_filename|> /** @jsx jsx **/ import React from 'react' import PropTypes from 'prop-types' import { jsx } from '@emotion/core' import { Box, Stack } from '@chakra-ui/core' import { Column } from '../layout' export const Container = props => <Box className="container" {...props} /> export const InfoCard = props => ( <Column columns={props.columns}> <Box rounded="4px" border="1px" p={4} py={8} {...props}> {props.children} </Box> </Column> ) export const LandingBox = props => ( <Column columns={props.columns}> <Stack rounded="4px" d="block" height="100%" bg="gray.300" border="1px" borderColor="gray.400" color="black" p={4} pt={8} marginBottom={4} /* styled system shorthand "mb" not working. Leave */ spacing={4} {...props} > {props.children} </Stack> </Column> ) export const ConditionalForm = ({ ...props }) => ( <React.Fragment> {props.children && ( <Box aria-live="polite" borderLeftWidth={1} borderLeftColor="gray.400" mt={1} ml={5} pl={6} {...props} > {props.children} </Box> )} </React.Fragment> ) ConditionalForm.propTypes = { children: PropTypes.any, } LandingBox.defaultProps = { columns: { base: 4 / 4, md: 4 / 8 }, } InfoCard.defaultProps = { columns: { base: 4 / 4, md: 6 / 8, lg: 5 / 12 }, } <|start_filename|>f2/src/components/next-and-cancel-buttons/index.js<|end_filename|> /** @jsx jsx */ import { jsx } from '@emotion/core' import { Button } from '../button' import { Trans } from '@lingui/macro' import PropTypes from 'prop-types' import { Flex, Icon } from '@chakra-ui/core' import { P } from '../paragraph' import { Route } from 'react-router-dom' import { useForm } from 'react-final-form' export const NextAndCancelButtons = (props) => { const form = useForm() return ( <Flex direction="row" align="center" wrap="wrap" mb={10} mt={10}> <P w="100%">{props.next}</P> <Button type="submit" onClick={(event) => { form.resumeValidation() form.submit() event.preventDefault() }} w={{ base: '100%', md: 'auto' }} > {props.button} <Icon focusable="false" ml={2} mr={-2} name="chevron-right" size="28px" /> </Button> <Route render={({ history }) => ( <Button onClick={() => history.push(props.cancelRoute)} fontSize={{ base: 'lg', md: 'xl' }} color="black" variantColor="gray" to={props.cancelRoute} textAlign="center" w={{ base: '100%', md: 'auto' }} ml={{ base: 0, md: 4 }} mt={{ base: 4, md: 0 }} > <Trans id="button.cancelReport" /> </Button> )} /> </Flex> ) } NextAndCancelButtons.defaultProps = { cancelRoute: '/confirmCancel', } NextAndCancelButtons.propTypes = { children: PropTypes.any, cancelRoute: PropTypes.string, } <|start_filename|>f2/src/components/formik/list/index.js<|end_filename|> import styled from '@emotion/styled' import React from 'react' import { Container, Row, ListGroup } from 'react-bootstrap' import { P } from '../paragraph' import { FormRow } from '../row' const ListItem = styled(ListGroup.Item)` display: list-item; list-style-position: inside; border: 0; padding: 0 0 0.5rem 0; background-color: inherit; ` export const List = (props) => { return ( <Container> <FormRow> {props.label && ( <Row> <P fontSize="md" fontWeight="bold" marginBottom="1rem"> {props.label} </P> </Row> )} <Row> <ListGroup> {props.items.map((item, index) => { return <ListItem key={index}>{item}</ListItem> })} </ListGroup> </Row> </FormRow> </Container> ) } <|start_filename|>f2/src/utils/state.js<|end_filename|> import React, { createContext, useContext, useReducer } from 'react' import { formDefaults } from '../forms/defaultValues' import { whatWasAffectedNavState } from './nextWhatWasAffectedUrl' import { generateSessionId } from './generateSessionId' const sessionId = generateSessionId() export const StateContext = createContext() export const StateProvider = ({ reducer, initialState, children }) => ( <StateContext.Provider value={useReducer(reducer, initialState)}> {children} </StateContext.Provider> ) export const useStateValue = () => useContext(StateContext) export const initialState = { sessionId: sessionId, doneForms: false, formData: { ...formDefaults, sessionId, prodVersion: '1.8.0' }, doneFinalFeedback: false, whatWasAffectedOptions: { ...whatWasAffectedNavState }, } export const reducer = (state, action) => { switch (action.type) { case 'saveFormData': return { ...state, formData: { ...state.formData, ...action.data, }, } case 'deleteFormData': return { ...state, formData: { ...initialState.formData }, doneForms: false, submitted: false, doneFinalFeedback: false, reportId: undefined, whatWasAffectedOptions: { ...initialState.whatWasAffectedOptions }, } case 'saveDoneForms': return { ...state, doneForms: action.data, } case 'saveGoogleRecaptcha': return { ...state, reCaptcha: action.data, } case 'saveSubmitted': return { ...state, submitted: action.data, } case 'saveReportId': return { ...state, reportId: action.data, } default: return state } } <|start_filename|>f2/src/components/formik/input/index.js<|end_filename|> import React from 'react' import PropTypes from 'prop-types' import { Form } from 'react-bootstrap' import { FormRow } from '../row' import styled from '@emotion/styled' const HelpText = styled(Form.Text)` line-height: 1.25; font-size: 1rem; max-width: 600px; ` const Label = styled(Form.Label)` font-size: 1.25rem; font-weight: 700; margin-bottom: 0.25rem; line-height: 1; margin-left: 0px; max-width: 600px; ` const InputField = styled(Form.Control)` margin-top: 0.75rem; max-width: 300px; &:hover { box-shadow: rgb(213, 213, 213) 0px 0px 0px 2px; border-color: black; } &:focus { box-shadow: rgba(99, 179, 237, 0.6) 0px 0px 4px 1px; outline: none; border-color: black; } ` export const Input = ({ field, form, ...props }) => { return ( <FormRow marginLeft="0rem"> <Form.Group controlId={props.id}> <Label>{props.label}</Label> <HelpText>{props.helpText}</HelpText> <InputField type={props.type} {...field} placeholder={props.placeholder} /> </Form.Group> </FormRow> ) } Input.propTypes = { type: PropTypes.oneOf(['text', 'email', 'password']), } Input.defaultProps = { type: 'text', } <|start_filename|>f2/cypress/integration/common/howwereyourmoney_page.js<|end_filename|> import { When } from 'cypress-cucumber-preprocessor/steps' When('I fill Howwereyourmoney page forms', () => { cy.get('form').find('[name="demandedMoney"]').type('$10000 CAD') cy.get('form').find('[name="moneyTaken"]').type('$5000 CAD') cy.get('form') .find('[value="methodPayment.eTransfer"]') .check({ force: true }) cy.get('form') .find('[value="methodPayment.creditCard"]') .check({ force: true }) cy.get('form').find('[value="methodPayment.giftCard"]').check({ force: true }) cy.get('form') .find('[value="methodPayment.cryptocurrency"]') .check({ force: true }) cy.get('form').find('[value="methodPayment.other"]').check({ force: true }) cy.get('form').find('[name="methodOther"]').type('Certified Cheque') cy.get('form').find('[name="transactionDay"]').type('1') cy.get('form').find('[name="transactionMonth"]').type('7') cy.get('form').find('[name="transactionYear"]').type('2019') }) When('I fill Howwereyourmoney1 page forms', () => { cy.get('form').find('[name="demandedMoney"]').type('$10000 US') cy.get('form').find('[name="moneyTaken"]').type('$5000 US') cy.get('form') .find('[value="methodPayment.eTransfer"]') .check({ force: true }) cy.get('form').find('[name="transactionDay"]').type('6') cy.get('form').find('[name="transactionMonth"]').type('6') cy.get('form').find('[name="transactionYear"]').type('2020') }) When('I fill Howwereyourmoney2 page forms', () => { cy.get('form').find('[name="demandedMoney"]').type('$700 bitcoin') cy.get('form').find('[name="moneyTaken"]').type('$700 bitcoin') cy.get('form') .find('[value="methodPayment.creditCard"]') .check({ force: true }) cy.get('form').find('[name="transactionDay"]').type('10') cy.get('form').find('[name="transactionMonth"]').type('7') cy.get('form').find('[name="transactionYear"]').type('2020') }) When('I fill Howwereyourmoney3 page forms', () => { cy.get('form').find('[name="demandedMoney"]').type('$200 EUR') cy.get('form').find('[name="moneyTaken"]').type('$200 EUR') cy.get('form').find('[value="methodPayment.giftCard"]').check({ force: true }) }) When('I fill Howwereyourmoney4 page forms', () => { cy.get('form').find('[name="demandedMoney"]').type('$15000 CAD') cy.get('form').find('[name="moneyTaken"]').type('$7000 CAD') cy.get('form') .find('[value="methodPayment.cryptocurrency"]') .check({ force: true }) }) When('I fill Howwereyourmoney5 page forms', () => { cy.get('form').find('[name="demandedMoney"]').type('$1000 CAD') cy.get('form').find('[name="moneyTaken"]').type('$500 CAD') cy.get('form').find('[value="methodPayment.other"]').check({ force: true }) cy.get('form').find('[name="methodOther"]').type('Certified Cheque') cy.get('form').find('[name="transactionDay"]').type('12') cy.get('form').find('[name="transactionMonth"]').type('07') cy.get('form').find('[name="transactionYear"]').type('2020') }) When('I fill NoHowwereyourmoney page forms', () => {}) When('I fill Howwereyourmoney in French page forms', () => { cy.get('form').find('[name="demandedMoney"]').type('$1000 US') cy.get('form').find('[name="moneyTaken"]').type('$1000 US') cy.get('form') .find('[value="methodPayment.eTransfer"]') .check({ force: true }) cy.get('form') .find('[value="methodPayment.creditCard"]') .check({ force: true }) cy.get('form').find('[value="methodPayment.giftCard"]').check({ force: true }) cy.get('form') .find('[value="methodPayment.cryptocurrency"]') .check({ force: true }) cy.get('form').find('[value="methodPayment.other"]').check({ force: true }) cy.get('form').find('[name="methodOther"]').type('Agent') cy.get('form').find('[name="transactionDay"]').type('28') cy.get('form').find('[name="transactionMonth"]').type('2') cy.get('form').find('[name="transactionYear"]').type('2020') }) <|start_filename|>f2/src/utils/serverFieldsAreValid.js<|end_filename|> const { formDefaults } = require('../forms/defaultValues') const flatten = require('flat') const serverFieldsAreValid = (fields) => { const requiredFields = flatten(formDefaults, { safe: true }) let retval = true // are all the required fields in the submission with the correct type? Object.entries(requiredFields).forEach(([field, value]) => { if (typeof fields[field] === 'undefined') { console.warn(`ERROR: required field ${field} is undefined`) retval = false } else if (typeof fields[field] !== typeof value) { console.warn(`ERROR: field ${field} has an incorrect type`) retval = false } }) // are there extra fields we're not expecting? Object.keys(fields).forEach((field) => { if (typeof requiredFields[field] === 'undefined') { console.warn(`ERROR: extra field ${field} detected`) retval = false } }) return retval } module.exports = { serverFieldsAreValid } <|start_filename|>f2/src/pdf/SuspectCluesView.js<|end_filename|> /** @jsx jsx */ import { jsx } from '@emotion/core' import { containsData } from '../utils/containsData' import { testdata } from '../ConfirmationSummary' import { Text, View, Image } from '@react-pdf/renderer' import { pdfStyles } from './pdfStyles' import { DescriptionItemView } from './DescriptionItemView' import line from '../images/line.png' export const SuspectCluesView = (props) => { const lang = props.lang const suspectClues = { ...testdata.formData.suspectClues, ...props.data.formData.suspectClues, } return ( <View style={pdfStyles.section}> <Text style={pdfStyles.title}> {lang['confirmationPage.suspectClues.title']} </Text> {containsData(suspectClues) ? ( <View> <DescriptionItemView title="confirmationPage.suspectClues.suspectClues1" description={suspectClues.suspectClues1} lang={lang} /> <DescriptionItemView title="confirmationPage.suspectClues.suspectClues2" description={suspectClues.suspectClues2} lang={lang} /> <DescriptionItemView title="confirmationPage.suspectClues.suspectClues3" description={suspectClues.suspectClues3} lang={lang} /> </View> ) : ( <Text style={pdfStyles.sectionContent}> {lang['confirmationPage.suspectClues.nag']} </Text> )} <Image style={pdfStyles.sectionSeparator} src={line} /> </View> ) } <|start_filename|>f2/src/utils/__tests__/nextWhatWasAffectedUrl.test.js<|end_filename|> import { whatWasAffectedPages, pages, nextPage, } from '../nextWhatWasAffectedUrl' describe('nextWhatWasAffectedUrl', () => { const whatWasAffectedOptions = [ whatWasAffectedPages.FINANCIAL.key, whatWasAffectedPages.INFORMATION.key, whatWasAffectedPages.DEVICES.key, whatWasAffectedPages.BUSINESS.key, ] describe('when all options selected', () => { const test1Pages = { ...pages } test1Pages.affectedOptions = whatWasAffectedOptions test1Pages.currentPage = whatWasAffectedPages.FIRST_PAGE it('finds the first page after the how affected page', () => { const result = nextPage(test1Pages, false) expect(result.url).toEqual(whatWasAffectedPages.FINANCIAL.url) }) it('finds the second page after the how affected page', () => { test1Pages.currentPage = whatWasAffectedPages.FINANCIAL const result = nextPage(test1Pages, false) expect(result.url).toEqual(whatWasAffectedPages.INFORMATION.url) }) it('finds the last page after the how affected page', () => { test1Pages.currentPage = whatWasAffectedPages.BUSINESS const result = nextPage(test1Pages, false) expect(result.url).toEqual('whathappened') }) it('defaults to the whathappened page', () => { test1Pages.currentPage = whatWasAffectedPages.WILL_FAIL const result = nextPage(test1Pages, false) expect(result.url).toEqual('whathappened') }) }) describe('when two options selected', () => { const test2Pages = { ...pages } const selectedOptions = [ whatWasAffectedPages.INFORMATION, whatWasAffectedPages.BUSINESS, ] test2Pages.affectedOptions = [ selectedOptions[0].key, selectedOptions[1].key, ] test2Pages.currentPage = whatWasAffectedPages.FIRST_PAGE it('finds the first page after the how affected page', () => { const result = nextPage(test2Pages, false) expect(result.url).toEqual(selectedOptions[0].url) }) it('finds the second page after the how affected page', () => { test2Pages.currentPage = whatWasAffectedPages.INFORMATION const result = nextPage(test2Pages, false) expect(result.url).toEqual(selectedOptions[1].url) }) it('finds the last page after the how affected page', () => { test2Pages.currentPage = whatWasAffectedPages.BUSINESS const result = nextPage(test2Pages) expect(result.url).toEqual('whathappened') }) }) describe('when no options selected', () => { const test3Pages = { ...pages } test3Pages.affectedOptions = [] test3Pages.currentPage = whatWasAffectedPages.FIRST_PAGE it('skips to the whatHappened page', () => { const result = nextPage(test3Pages, false) expect(result.url).toEqual('whathappened') }) }) }) <|start_filename|>f2/cypress/integration/CancelAtPrivacy/cancelAtPrivacy.js<|end_filename|> import { Given, After, When, And, Then, } from 'cypress-cucumber-preprocessor/steps' // Hooks for repeated commands/rules After(() => { cy.reportA11y() }) Given('I open the report home page', () => { cy.visit(Cypress.env('dev')) }) When('I click on create a report button', () => { cy.contains('Report now').first().click({ force: true }) }) Then('I read before you start instructions', () => { cy.contains('Start report').first().click({ force: true }) }) And('I click continue without checking consent', () => { cy.contains('Continue').first().click({ force: true }) }) Given('{string} should be shown', (content) => { cy.contains(content, { timeout: 10000 }).should('be.visible') }) Then('I click {string}', () => { cy.contains('Cancel report').first().click({ force: true }) }) Given('{string} should be shown', (content) => { cy.contains(content, { timeout: 10000 }).should('be.visible') }) When('I confirm the cancellation', () => { cy.get('button').contains('Cancel report').first().click({ force: true }) //cy.contains("Cancel report").first().click({force: true}); }) Given('{string} should be shown', (content) => { cy.contains(content, { timeout: 10000 }).should('be.visible') }) When('I click on Tell us more', () => { cy.contains('Tell us more').first().click({ force: true }) // Do nothing }) When('I give the feedback', () => { cy.get('form') .find('[value="finalFeedback.wasServiceHard.neutral"]') .check({ force: true }) cy.get('form') .find('[value="finalFeedback.wouldYouUseAgain.yes"]') .check({ force: true }) cy.get('form') .find('[name="howCanWeDoBetter"]') .type('testing on cancellation feeback') cy.contains('Submit').first().click({ force: true }) }) Then('{string} should be shown', (content) => { cy.contains(content, { timeout: 10000 }).should('be.visible') }) <|start_filename|>f2/src/LocaleSwitcher.js<|end_filename|> /** @jsx jsx */ import { jsx } from '@emotion/core' import { useEffect } from 'react' import { useLingui } from '@lingui/react' import { locales, activate } from './i18n.config' import { Box } from '@chakra-ui/core' import { A } from './components/link' const Toggler = (props) => { const { locale } = props return ( <A key={locale} padding={0} onClick={(e) => { e.preventDefault() activate(locale) }} href="#" tabindex="0" > {locales[locale]} </A> ) } export function LocaleSwitcher() { const { i18n } = useLingui() useEffect(() => { const title = i18n.locale === 'fr' ? 'signaler une fraude' : 'Report a scam' document.title = title document.documentElement.setAttribute('lang', i18n.locale) }) return ( <Box> {i18n.locale === 'en' && <Toggler locale="fr" />} {i18n.locale === 'fr' && <Toggler locale="en" />} </Box> ) } <|start_filename|>f2/src/FinalFeedbackThanksPage.js<|end_filename|> /** @jsx jsx */ import { jsx } from '@emotion/core' import { Trans } from '@lingui/macro' import { H1 } from './components/header' import { TrackPageViews } from './TrackPageViews' import { Layout } from './components/layout' import { Stack, Box, Icon } from '@chakra-ui/core' import { Alert } from './components/Messages' import { Route } from 'react-router-dom' import { Link } from './components/link' import { MidFeedbackForm } from './forms/MidFeedbackForm' import { submitToServer } from './utils/submitToServer' import { useStateValue } from './utils/state' export const FinalFeedbackThanksPage = () => { const [, dispatch] = useStateValue() return ( <Layout> <TrackPageViews /> <Stack spacing={10} shouldWrapChildren> <H1> <Trans id="finalFeedbackThanks.title" /> </H1> <Alert status="success" withIcon> <Trans id="thankYouPage.safelyCloseWindow" /> </Alert> <Box mb="auto"> <Route render={({ history }) => ( <Link onClick={() => { dispatch({ type: 'deleteFormData', }) }} to="/" > <Trans id="thankYouPage.createNewReport" /> </Link> )} /> <Icon color="blue" focusable="false" ml={2} mr={-2} name="chevron-right" size="24px" /> </Box> <MidFeedbackForm onSubmit={(data) => { submitToServer(data) }} /> </Stack> </Layout> ) } <|start_filename|>f2/src/components/header/presets.js<|end_filename|> import React from 'react' import { Heading as Header } from '@chakra-ui/core' import PropTypes from 'prop-types' export const H1 = props => ( <Header as="h1" fontSize={{ base: '4xl', md: '5xl' }} fontFamily="heading" lineHeight={1.15} {...props} > {props.children} </Header> ) H1.propTypes = { children: PropTypes.any, } export const H2 = props => ( <Header as="h2" fontSize="3xl" fontFamily="heading" lineHeight={1.5} {...props} > {props.children} </Header> ) H2.propTypes = { children: PropTypes.any, } export const H3 = props => ( <Header as="h3" fontSize="xl" fontFamily="heading" lineHeight={1.5} {...props} > {props.children} </Header> ) H3.propTypes = { children: PropTypes.any, } export const H4 = props => ( <Header as="h4" fontSize="lg" fontFamily="heading" lineHeight={1.5} color="gray.700" {...props} > {props.children} </Header> ) H4.propTypes = { children: PropTypes.any, } export const H5 = props => ( <Header as="h5" fontSize="lg" fontFamily="heading" lineHeight={1.5} color="gray.600" {...props} > {props.children} </Header> ) H5.propTypes = { children: PropTypes.any, } export const H6 = props => ( <Header as="h6" fontSize="lg" fontFamily="heading" lineHeight={1.5} color="gray.500" {...props} > {props.children} </Header> ) H6.propTypes = { children: PropTypes.any, } <|start_filename|>f2/src/components/FormHelperText/index.js<|end_filename|> import styled from '@emotion/styled' import { FormHelperText as ChakraFormHelperText } from '@chakra-ui/core' export const FormHelperText = styled(ChakraFormHelperText)() FormHelperText.defaultProps = { as: 'p', mt: 1, mb: 0, fontSize: 'md', color: 'black', fontFamily: 'body', lineHeight: 1.25, maxW: '600px', } <|start_filename|>f2/src/pdf/PdfDocument.js<|end_filename|> import React from 'react' import { Page, Text, Link, View, Document, Image } from '@react-pdf/renderer' import { pdfStyles } from './pdfStyles' import { testdata } from '../ConfirmationSummary' import topBannerEn from '../images/topbanner-en.png' import topBannerFr from '../images/topbanner-fr.png' import footerCanada from '../images/footerCanada.png' import betaEn from '../images/beta-en.png' import betaFr from '../images/beta-fr.png' import langEn from '../locales/en.json' import langFr from '../locales/fr.json' import { WhoAreYouReportForView } from './WhoAreYouReportForView' import { AnonymousView } from './AnonymousView' import { ContactInfoView } from './ContactInfoView' import { HowDidItStartView } from './HowDidItStartView' import { WhenDidItHappenView } from './WhenDidItHappenView' import { WhatWasAffectedView } from './WhatWasAffectedView' import { MoneyLostInfoView } from './MoneyLostInfoView' import { InformationView } from './InformationView' import { DevicesView } from './DevicesView' import { BusinessInfoView } from './BusinessInfoView' import { WhatHappenedView } from './WhatHappenedView' import { SuspectCluesView } from './SuspectCluesView' import { EvidenceInfoView } from './EvidenceInfoView' import { LocationInfoView } from './LocationInfoView' export const PdfDocument = (props) => { const lang = props.locale === 'fr' ? langFr : langEn const impact = { affectedOptions: [], ...testdata.formData.whatWasAffected, ...props.data.formData.whatWasAffected, } const anonymous = { ...testdata.formData.anonymous, ...props.data.formData.anonymous, } const { fyiForm } = props.data.formData return ( <Document> <Page size="A4" style={pdfStyles.page}> <View style={pdfStyles.header} fixed> <View style={pdfStyles.rowContainer}> <Image style={pdfStyles.topbanner} src={props.locale === 'en' ? topBannerEn : topBannerFr} /> <Image style={pdfStyles.beta} src={props.locale === 'en' ? betaEn : betaFr} /> <Text style={pdfStyles.betaText}>{lang['pdf.betaText']}</Text> </View> </View> <View style={pdfStyles.thankyou}> <Text style={pdfStyles.thankyouTitle}>{lang['pdf.thankyou']}</Text> <Text style={pdfStyles.referenceNumber}> {lang['pdf.referenceNumber'] + props.data.reportId} </Text> </View> {fyiForm ? null : ( <View> <WhoAreYouReportForView data={props.data} lang={lang} /> <HowDidItStartView data={props.data} lang={lang} /> <WhenDidItHappenView data={props.data} lang={lang} /> <WhatWasAffectedView data={props.data} lang={lang} /> {impact.affectedOptions.includes( 'whatWasAffectedForm.financial', ) && <MoneyLostInfoView data={props.data} lang={lang} />} {impact.affectedOptions.includes( 'whatWasAffectedForm.personalInformation', ) && <InformationView data={props.data} lang={lang} />} {impact.affectedOptions.includes('whatWasAffectedForm.devices') && ( <DevicesView data={props.data} lang={lang} /> )} {impact.affectedOptions.includes( 'whatWasAffectedForm.business_assets', ) && <BusinessInfoView data={props.data} lang={lang} />} </View> )} <WhatHappenedView data={props.data} lang={lang} /> {fyiForm ? null : <SuspectCluesView data={props.data} lang={lang} />} <EvidenceInfoView data={props.data} lang={lang} /> <LocationInfoView data={props.data} lang={lang} /> {anonymous.anonymousOptions.includes('anonymousPage.yes') ? ( <AnonymousView data={props.data} lang={lang} /> ) : ( <ContactInfoView data={props.data} lang={lang} /> )} <View style={pdfStyles.bottomSection}> <Text style={pdfStyles.bottomTitle}>{lang['pdf.next.title']}</Text> <Text style={pdfStyles.bottomContent}> {lang['pdf.next.content']} </Text> </View> <View style={pdfStyles.bottomSection}> <Text style={pdfStyles.bottomTitle}> {lang['pdf.websites.title']} </Text> <Text style={pdfStyles.bottomContent}> {lang['pdf.bottom.site1']} </Text> <Link style={pdfStyles.bottomLink}> www.antifraudcentre-centreantifraude.ca </Link> <Text style={pdfStyles.bottomContent}> {lang['pdf.bottom.site2']} </Text> <Link style={pdfStyles.bottomLink}>www.rcmp-grc.gc.ca</Link> <Text style={pdfStyles.bottomContent}> {lang['pdf.bottom.site3']} </Text> <Link style={pdfStyles.bottomLink}>www.rcmp-grc.gc.ca/en/nc3</Link> <Text style={pdfStyles.bottomContent}> {lang['pdf.bottom.site4']} </Text> <Link style={pdfStyles.bottomLink}>www.getcybersafe.gc.ca</Link> </View> <Image style={pdfStyles.footerCanada} src={footerCanada} fixed /> </Page> </Document> ) } <|start_filename|>f2/src/components/FormArrayControl/__tests__/FormArrayControl.test.js<|end_filename|> import React from 'react' import { ThemeProvider } from 'emotion-theming' import canada from '../../../theme/canada' import { render, cleanup } from '@testing-library/react' import { FormArrayControl } from '../' import { Form } from 'react-final-form' describe('<FormArrayControl />', () => { afterEach(cleanup) it('renders children', () => { const submitMock = jest.fn() const { getAllByText } = render( <ThemeProvider theme={canada}> <Form initialValues="" onSubmit={submitMock} render={() => ( <FormArrayControl name="foo" label="bar" helperText="help"> <p>all</p> </FormArrayControl> )} /> </ThemeProvider>, ) const label = getAllByText(/bar/) const help = getAllByText(/help/) const test = getAllByText(/all/) expect(label).toHaveLength(1) expect(help).toHaveLength(1) expect(test).toHaveLength(1) }) }) <|start_filename|>f2/src/PageNotFound.js<|end_filename|> import React from 'react' import { Trans } from '@lingui/macro' import { H1 } from './components/header' import { P } from './components/paragraph' import { Layout } from './components/layout' import { Page } from './components/Page' export const PageNotFound = () => ( <Page> <Layout columns={{ base: 4 / 4, md: 6 / 8, lg: 7 / 12 }}> <H1> <Trans id="pageNotFound.header" /> </H1> <P> <Trans id="pageNotFound.message" /> </P> </Layout> </Page> ) <|start_filename|>f2/src/ConfirmationPage.js<|end_filename|> /** @jsx jsx */ import { jsx } from '@emotion/core' import { useLingui } from '@lingui/react' import { Route } from 'react-router-dom' import fetch from 'isomorphic-fetch' import { Trans } from '@lingui/macro' import flatten from 'flat' import { H1 } from './components/header' import { P } from './components/paragraph' import { Layout } from './components/layout' import { ConfirmationSummary } from './ConfirmationSummary' import { ConfirmationForm } from './forms/ConfirmationForm' import { BackButton } from './components/backbutton' import { Stack } from '@chakra-ui/core' import { useStateValue } from './utils/state' import { Page } from './components/Page' import { formDefaults } from './forms/defaultValues' import { useLog } from './useLog' const { getLogger } = require('./utils/winstonLoggerClient') const logger = getLogger(__filename) async function postData(url = '', data = {}) { // Building a multi-part form for file upload! // Stick all our collected data into a single form element called json // Maybe there's a better way to generate form fields from json? // add the files to the formdata object after. const flattenedData = flatten(data, { safe: true }) var form_data = new FormData() Object.keys(flattenedData).forEach((key) => { form_data.append(key, JSON.stringify(flattenedData[key])) }) if (data.evidence) data.evidence.files.forEach((f) => form_data.append(f.name, f, f.name)) // Default options are marked with * const response = await fetch(url, { method: 'POST', mode: 'cors', cache: 'no-cache', credentials: 'same-origin', redirect: 'follow', referrer: 'no-referrer', body: form_data, }).catch(function (error) { console.log({ error }) }) return response ? response.text() : 'fetch failed' } const prepFormData = (formDataOrig, language) => { Object.keys(formDataOrig).forEach((form) => { if (formDefaults[form]) { formDataOrig[form] = { ...formDefaults[form], ...formDataOrig[form], } } }) //this allows us to go directly to the confirmation page during debugging const formData = { ...formDefaults, ...formDataOrig, } formData.appVersion = process.env.REACT_APP_VERSION ? process.env.REACT_APP_VERSION.slice(0, 7) : 'no version' if (formData.anonymous.anonymousOptions.includes('anonymousPage.yes')) { formData.contactInfo = formDefaults.contactInfo } else { formData.anonymous.anonymousOptions = ['anonymousPage.no'] } if ( formData.whatWasAffected && !formData.whatWasAffected.affectedOptions.includes( 'whatWasAffectedForm.financial', ) ) { formData.moneyLost = formDefaults.moneyLost } if ( formData.whatWasAffected && !formData.whatWasAffected.affectedOptions.includes( 'whatWasAffectedForm.personalInformation', ) ) { formData.personalInformation = formDefaults.personalInformation } if ( formData.whatWasAffected && !formData.whatWasAffected.affectedOptions.includes( 'whatWasAffectedForm.devices', ) ) { formData.devicesInfo = formDefaults.devicesInfo } if ( formData.whatWasAffected && !formData.whatWasAffected.affectedOptions.includes( 'whatWasAffectedForm.business_assets', ) ) { formData.businessInfo = formDefaults.businessInfo } return { ...formData, language, } } const submitToServer = async (data, dispatch) => { console.log('Submitting data:', data) logger.info({ sessionId: data.sessionId, message: 'Submiting report to server', }) const reportId = await postData('/submit', data) logger.info({ sessionId: data.sessionId, reportId: reportId, message: 'Submitted report to server', }) const submitted = reportId && reportId.startsWith('NCFRS-') dispatch({ type: 'saveReportId', data: reportId }) dispatch({ type: 'saveSubmitted', data: submitted }) } export const ConfirmationPage = () => { const [{ formData }, dispatch] = useStateValue() // eslint-disable-line no-unused-vars const { i18n } = useLingui() useLog('ConfirmationPage') return ( <Route render={({ history }) => ( <Page> <Layout columns={{ base: 4 / 4, md: 6 / 8, lg: 7 / 12 }} mb={10}> <Stack spacing={10} shouldWrapChildren> <BackButton /> <H1> <Trans id="confirmationPage.title" /> </H1> <P> <Trans id="confirmationPage.intro" /> </P> </Stack> </Layout> <Layout columns={{ base: 4 / 4, md: 8 / 8, lg: 9 / 12 }}> <ConfirmationSummary /> <ConfirmationForm onSubmit={() => { dispatch({ type: 'saveReportId', data: undefined }) dispatch({ type: 'saveSubmitted', data: undefined }) submitToServer(prepFormData(formData, i18n.locale), dispatch) history.push('/thankYouPage') }} /> </Layout> </Page> )} /> ) } <|start_filename|>f2/src/forms/WhoAreYouReportForFormSchema.js<|end_filename|> import React from 'react' import * as Yup from 'yup' import { Trans } from '@lingui/macro' const whoAreYouReportFormSchema = Yup.object().shape({ whoYouReportFor: Yup.string().required( <Trans id="whoAreYouReportForPage.hasValidationErrors" />, ), }) export const WhoAreYouReportForFormSchema = () => { return whoAreYouReportFormSchema } <|start_filename|>f2/src/CancelPage.js<|end_filename|> /** @jsx jsx */ import { jsx } from '@emotion/core' import { Trans } from '@lingui/macro' import { H1, H2 } from './components/header' import { P } from './components/paragraph' import { Layout, Row } from './components/layout' import { Stack, Box, Icon } from '@chakra-ui/core' import { Route } from 'react-router-dom' import { Ul } from './components/unordered-list' import { Li } from './components/list-item' import { A, Link, ButtonLink } from './components/link' import { useLingui } from '@lingui/react' import { useStateValue } from './utils/state' import { Page } from './components/Page' import { LandingBox } from './components/container' import { Alert } from './components/Messages' import { useLog } from './useLog' export const CancelPage = () => { const { i18n } = useLingui() const [, dispatch] = useStateValue() useLog('CancelPage') return ( <Page> <Layout columns={{ base: 4 / 4, md: 6 / 8, lg: 7 / 12 }}> <Stack spacing={10} w="100%"> <H1 mb={6}> <Trans id="cancelPage.title" /> </H1> <P> <Trans id="cancelPage.summary" /> </P> <Row> <LandingBox spacing={10} columns={{ base: 4 / 4, md: 6 / 8 }}> <H2 mb={2}> <Trans id="cancelPage.feedback" /> </H2> <ButtonLink mt="auto" variantColor="black" title={i18n._('thankYouPage.feedbackButton.aria')} to="/finalFeedback" > <Trans id="cancelPage.feedbackButton" /> <Icon focusable="false" ml={2} mr={-2} name="chevron-right" size="28px" /> </ButtonLink> </LandingBox> </Row> <Stack spacing={4} shouldWrapChildren> <H2 mb={2}> <Trans id="thankYouPage.helpResource" /> </H2> <Ul> <Li> <A href={ i18n.locale === 'en' ? 'https://www.getcybersafe.gc.ca/index-en.aspx' : 'https://www.pensezcybersecurite.gc.ca/index-fr.aspx' } isExternal > <Trans id="thankYouPage.helpResource1" /> </A> </Li> <Li> <A href={ i18n.locale === 'en' ? 'https://antifraudcentre-centreantifraude.ca/protect-protegez-eng.htm' : 'https://antifraudcentre-centreantifraude.ca/protect-protegez-fra.htm' } isExternal > <Trans id="thankYouPage.helpResource2" /> </A> </Li> <Li> <A href={ i18n.locale === 'en' ? 'http://www.rcmp-grc.gc.ca/to-ot/tis-set/cyber-tips-conseils-eng.htm' : 'http://www.rcmp-grc.gc.ca/to-ot/tis-set/cyber-tips-conseils-fra.htm' } isExternal > <Trans id="thankYouPage.helpResource3" /> </A> </Li> </Ul> </Stack> <Stack spacing={6}> <Alert status="success" withIcon> <Trans id="thankYouPage.safelyCloseWindow" /> </Alert> <Box mb="auto"> <Route render={({ history }) => ( <Link onClick={() => { dispatch({ type: 'deleteFormData', }) }} to="/" > <Trans id="thankYouPage.createNewReport" /> </Link> )} /> </Box> </Stack> </Stack> </Layout> </Page> ) } <|start_filename|>f2/src/forms/WhatHappenedForm.js<|end_filename|> /** @jsx jsx */ import PropTypes from 'prop-types' import { jsx } from '@emotion/core' import { Trans } from '@lingui/macro' import { TextArea } from '../components/formik/textArea' import { useStateValue } from '../utils/state' import { formDefaults } from './defaultValues' import { Form, Container, Row } from 'react-bootstrap' import { Formik, Field } from 'formik' import { NextCancelButtons } from '../components/formik/button' import { WarningModal } from '../components/formik/warningModal' import { HiddenText } from '../components/formik/paragraph' export const WhatHappenedForm = (props) => { const [data] = useStateValue() const whatHappened = { ...formDefaults.whatHappened, ...data.formData.whatHappened, } const { fyiForm } = data.formData let formLabel = <Trans id="whatHappenedPage.summary" /> let formHelpText = <Trans id="whatHappenedPage.hint" /> let nextPage = <Trans id="whatHappenedPage.nextPage" /> let formHelpText2 if (fyiForm) { formLabel = <Trans id="whatHappenedPage.fyi.summary" /> formHelpText = <Trans id="whatHappenedPage.fyi.hint" /> formHelpText2 = <Trans id="whatHappenedPage.fyi.hint2" /> nextPage = <Trans id="fyiForm.nextPage2" /> } return ( <Formik initialValues={whatHappened} onSubmit={(values) => { props.onSubmit(values) }} > {({ handleSubmit, handleChange, handleBlur, dirty, isSubmitting }) => ( <Form onSubmit={handleSubmit}> <WarningModal dirty={dirty} isSubmitting={isSubmitting} /> <Container> <Row className="form-question"> <Row className="form-label">{formLabel}</Row> <Row className="form-helper-text"> {formHelpText} {formHelpText2 ? ( <p> <br /> {formHelpText2} </p> ) : null} </Row> </Row> <Row className="form-section"> <Field name="whatHappened" component={TextArea} onChange={handleChange} onBlur={handleBlur} label={<HiddenText>{formLabel}</HiddenText>} rows="12" id="textarea-whatHappened" ></Field> </Row> <Row> <NextCancelButtons submit={<Trans id="whatHappenedPage.nextButton" />} cancel={<Trans id="button.cancelReport" />} label={nextPage} /> </Row> </Container> </Form> )} </Formik> ) } WhatHappenedForm.propTypes = { onSubmit: PropTypes.func.isRequired, } <|start_filename|>f2/src/LandingPage.js<|end_filename|> /* eslint-disable react/no-unescaped-entities */ import React from 'react' import { useLingui } from '@lingui/react' import { Route } from 'react-router-dom' import { GoogleReCaptcha } from 'react-google-recaptcha-v3' import PropTypes from 'prop-types' import { Trans } from '@lingui/macro' import { P } from './components/paragraph' import { ButtonLink } from './components/link' import { H1, H2 } from './components/header' import { Ul } from './components/unordered-list' import { Li } from './components/list-item' import { A } from './components/link' import { Layout } from './components/layout' import { Stack, Icon } from '@chakra-ui/core' import { useStateValue } from './utils/state' import { Page } from './components/Page' import { Well } from './components/Messages' import { CovidWell } from './Covid19Page' import { LandingBox } from './components/container' import { removeBeforeUnloadWarning } from './utils/navigationWarning' import { useLog } from './useLog' const { getLogger } = require('./utils/winstonLoggerClient') const logger = getLogger(__filename) function checkToken(url = '', dispatch, data = {}) { var form_data = new FormData() form_data.append('json', JSON.stringify(data)) // Default options are marked with * fetch(url, { method: 'POST', mode: 'cors', cache: 'no-cache', credentials: 'same-origin', redirect: 'follow', referrer: 'no-referrer', body: form_data, }) .then((response) => { if (response.ok) { return response.json() } else { console.error(response) throw Error(response.statusText) } }) .then((score) => { console.log(`Score from google reCaptcha ${JSON.stringify(score)}`) dispatch({ type: 'saveGoogleRecaptcha', data: score }) }) .catch((error) => console.error(error)) } export const LandingPage = (props) => { const { i18n } = useLingui() const [state, dispatch] = useStateValue() const { fyiForm } = state.formData useLog('LandingPage') if (state.doneForms) { dispatch({ type: 'saveDoneForms', data: false }) } logger.info({ sessionId: state.sessionId, message: 'This is information at landing page', }) logger.warn({ sessionId: state.sessionId, message: 'This is warning at landing page', }) logger.error({ sessionId: state.sessionId, message: 'This is error at landing page', }) //throw new Error('This is a fake error') removeBeforeUnloadWarning() return ( <React.Fragment> <GoogleReCaptcha onVerify={async (token) => { console.log(token) checkToken('/checkToken', dispatch, { token }) let textarea = document.getElementById('g-recaptcha-response-100000') if (textarea) { textarea.setAttribute('aria-hidden', 'true') textarea.setAttribute('aria-label', 'do not use') textarea.setAttribute('aria-readonly', 'true') } }} /> <Route render={({ history }) => ( <Page> <CovidWell /> <Layout columns={{ base: 4 / 4, md: 6 / 8, lg: 7 / 12 }}> <Stack spacing={10} shouldWrapChildren> <H1> <Trans id="landingPage.title" /> </H1> <P> <Trans id="landingPage.intro"> <A href={ i18n.locale === 'en' ? 'http://www.rcmp-grc.gc.ca/en/nc3' : 'http://www.rcmp-grc.gc.ca/fr/gnc3' } isExternal /> <A href={ i18n.locale === 'en' ? 'http://www.antifraudcentre-centreantifraude.ca/index-eng.htm' : 'http://www.antifraudcentre-centreantifraude.ca/index-fra.htm' } isExternal /> </Trans> </P> <Stack alignItems="flex-start"> <H2> <Trans id="landingPage.reportOnline" /> </H2> <LandingBox spacing={10} columns={{ base: 4 / 4, md: 6 / 7 }} marginLeft={'-0.5rem'} > <P mb={2}> <Trans id="landingPage.fullReport.description" /> </P> <ButtonLink onClick={() => { if (fyiForm) { dispatch({ type: 'deleteFormData', }) } dispatch({ type: 'saveFormData', data: { fyiForm: '' }, }) }} to="/startPage" className="white-button-link" > <Trans id="landingPage.fullReport.button" /> <Icon focusable="false" ml={2} mr={-2} name="chevron-right" size="28px" /> </ButtonLink> </LandingBox> <LandingBox spacing={10} columns={{ base: 4 / 4, md: 6 / 7 }} marginLeft={'-0.5rem'} > <P mb={2}> <Trans id="landingPage.fyiReport.description" /> </P> <ButtonLink onClick={() => { if (!fyiForm) { dispatch({ type: 'deleteFormData', }) } dispatch({ type: 'saveFormData', data: { fyiForm: 'yes' }, }) }} to="/privacyconsent" className="white-button-link" > <Trans id="landingPage.fyiReport.button" /> <Icon focusable="false" ml={2} mr={-2} name="chevron-right" size="28px" /> </ButtonLink> </LandingBox> </Stack> <Well variantColor="blue"> <Trans id="landingPage.warning" /> </Well> <H2> <Trans id="landingPage.reportingOptions" /> </H2> <Ul> <Li> <Trans id="landingPage.reportingOptions0" /> <A href={ 'tel:' + i18n._('landingPage.reportingOptions0.phoneNumber') } > <Trans id="landingPage.reportingOptions0.phoneNumber" /> </A> <Trans id="landingPage.reportingOptions0.period" /> </Li> <Li> <Trans id="landingPage.reportingOptions1"> <A href={ i18n.locale === 'en' ? 'https://www.cybertip.ca/app/en/report' : 'https://www.cybertip.ca/app/fr/report' } isExternal // Opens new tab /> </Trans> </Li> <Li> <Trans id="landingPage.reportingOptions2"> <A href={ i18n.locale === 'en' ? 'https://www.consumer.equifax.ca/fr/c/portal/update_language?p_l_id=23&redirect=%2Ffr%2Fpersonnel%2F&languageId=en_US' : 'https://www.consumer.equifax.ca/en/c/portal/update_language?p_l_id=23&redirect=%2Fen%2Fpersonal%2F&languageId=fr_FR' } isExternal // Opens new tab /> <A href={ i18n.locale === 'en' ? 'https://www.transunion.ca/' : 'https://www.transunion.ca/fr' } isExternal // Opens new tab /> </Trans> </Li> <Li> <Trans id="landingPage.reportingOptions3" /> </Li> </Ul> </Stack> </Layout> </Page> )} /> </React.Fragment> ) } LandingPage.propTypes = { location: PropTypes.object, } <|start_filename|>f2/src/forms/ContactInfoFormSchema.js<|end_filename|> import React from 'react' import { Trans } from '@lingui/macro' import { formatPhoneNumber } from '../utils/formatPhoneNumber' import * as Yup from 'yup' import { yupSchema } from '../utils/yupSchema' const contactInfoFormValidation = Yup.object().shape({ email: yupSchema().emailSchema, phone: yupSchema().phoneSchema, extension: yupSchema().phoneExtensionSchema, }) const contactFormOptions = { fullName: { name: 'fullName', value: 'fullName', id: 'enterContactDetails-Fullname', label: <Trans id="contactinfoPage.fullName" />, errorMessage: <Trans id="contactinfoForm.fullName.warning" />, }, email: { name: 'email', value: 'email', id: 'enterContactDetails-Email', label: <Trans id="contactinfoPage.emailAddress" />, errorMessage: <Trans id="contactinfoForm.email.warning" />, }, phone: { name: 'phone', value: 'phone', id: 'enterContactDetails-Phone', label: <Trans id="contactinfoPage.phoneNumber" />, errorMessage: <Trans id="contactinfoForm.phone.warning" />, }, extension: { name: 'extension', value: 'extension', id: 'enterContactDetails-Extension', label: <Trans id="contactinfoPage.phoneExtension" />, errorMessage: <Trans id="contactinfoForm.phoneExtension.warning" />, }, } const createErrorSummary = (errors) => { const errorSummary = {} if (errors.fullName) { errorSummary['fullName'] = { label: contactFormOptions.fullName.label, message: contactFormOptions.fullName.errorMessage, } } if (errors.email) { errorSummary['email'] = { label: contactFormOptions.email.label, message: contactFormOptions.email.errorMessage, } } if (errors.phone) { errorSummary['phone'] = { label: contactFormOptions.phone.label, message: contactFormOptions.phone.errorMessage, } } if (errors.extension) { errorSummary['extension'] = { label: contactFormOptions.extension.label, message: contactFormOptions.extension.errorMessage, } } if (errors.emailOrPhone) { errorSummary['emailOrPhone'] = { label: <Trans id="contactinfoPage.emailORphone" />, message: <Trans id="contactinfoForm.emailORphone.warning" />, } } return errorSummary } const onSubmitValidation = async (values) => { const errors = {} if (!values.fullName || values.fullName === '') { errors['fullName'] = true } if (values.email) { await contactInfoFormValidation .validate({ email: values.email }) .catch((err) => { errors['email'] = true }) } if (values.phone) { await contactInfoFormValidation .validate({ phone: values.phone }) .catch((err) => { errors['phone'] = true }) values.phone = errors['phone'] ? values.phone : formatPhoneNumber(values.phone) } if (values.extension) { await contactInfoFormValidation .validate({ extension: values.extension }) .catch((err) => { errors['extension'] = true }) } if (!values.email && !values.phone) { errors['emailOrPhone'] = true } return errors } export const ContactInfoFormSchema = { CONTACT_INFO: contactFormOptions, ON_SUBMIT_VALIDATION: onSubmitValidation, CREATE_ERROR_SUMMARY: createErrorSummary, } <|start_filename|>f2/src/components/formik/link/index.js<|end_filename|> import styled from '@emotion/styled' import { fontSize } from 'styled-system' export const A = styled.a` color: ${(props) => (props.color ? props.color : null)} !important; text-decoration: underline; cursor: pointer; &:focus { outline: 0px; box-shadow: 0 0 0 4px rgba(99, 179, 237, 0.6); } ${fontSize}; ` <|start_filename|>f2/src/forms/PrivacyConsentInfoForm.js<|end_filename|> import React from 'react' import { Trans } from '@lingui/macro' import { useStateValue } from '../utils/state' import { A } from '../components/formik/link' import { Form, Container, Row } from 'react-bootstrap' import { Formik, Field } from 'formik' import { CheckBoxRadio } from '../components/formik/checkboxRadio' import { NextCancelButtons } from '../components/formik/button' import { useLingui } from '@lingui/react' import { ErrorSummary } from '../components/formik/alert' import { PrivacyConsentInfoFormSchema } from './PrivacyConsentInfoFormSchema' import { WarningModal } from '../components/formik/warningModal' import { FormRow } from '../components/formik/row' const createErrorSummary = (errors) => { const errorSummary = {} if (errors.consentOptions) { errorSummary['consentOptions'] = { label: <Trans id="privacyConsentInfoPage.linkOut" />, message: <Trans id="privacyConsentInfoForm.newWarning" />, } } return errorSummary } export const PrivacyConsentInfoForm = (props) => { const { i18n } = useLingui() const [data] = useStateValue() const whetherConsent = { ...data.formData.consent, } const { fyiForm } = data.formData return ( <React.Fragment> {false ? ( // mark ids for lingui <div> <Trans id="privacyConsentInfoForm.consent" /> </div> ) : null} <Formik initialValues={whetherConsent} onSubmit={(values) => { props.onSubmit(values) }} validationSchema={PrivacyConsentInfoFormSchema()} > {({ handleSubmit, handleChange, handleBlur, errors, submitCount, dirty, isSubmitting, }) => ( <Form onSubmit={handleSubmit}> <WarningModal dirty={dirty} isSubmitting={isSubmitting} /> <Container> <FormRow paddingBottom="1rem"> {Object.keys(errors).length > 0 && ( <ErrorSummary errors={createErrorSummary(errors)} submissions={submitCount} title={ <Trans id="privacyConsentInfoForm.hasValidationErrors" /> } /> )} </FormRow> <FormRow marginBottom="3rem"> <Field name="consentOptions" label={ <Trans id="privacyConsentInfoForm.yes.withExternalLink"> <A color="#0000ff" target="_blank" href={'/privacystatement?lang=' + i18n.locale} /> </Trans> } component={CheckBoxRadio} value="privacyConsentInfoForm.yes" onChange={handleChange} onBlur={handleBlur} type="checkbox" id="consentOptions" ></Field> </FormRow> <Row> <NextCancelButtons submit={<Trans id="privacyConsentInfoForm.nextButton" />} cancel={<Trans id="button.cancelReport" />} label={ fyiForm ? ( <Trans id="fyiForm.nextPage1" /> ) : ( <Trans id="privacyConsentInfoForm.nextPage" /> ) } /> </Row> </Container> </Form> )} </Formik> </React.Fragment> ) } <|start_filename|>f2/cypress/integration/common/howyourbusinessaffected_page_fr.js<|end_filename|> import { When } from 'cypress-cucumber-preprocessor/steps' When('I fill Howyourbusinessaffected in French page forms', () => { cy.get('form') .find('[name="nameOfBusiness"]') .type('Health & Wellness Bedford') cy.get('form').find('[name="industry"]').type('Clinique de Santé') cy.get('form').find('[name="role"]').type('Expert en Informatique') cy.get('form') .find('[value="numberOfEmployee.500More"]') .check({ force: true }) }) <|start_filename|>f2/src/components/EditButton/__tests__/EditButton.test.js<|end_filename|> import React from 'react' import { render, cleanup } from '@testing-library/react' import { ThemeProvider } from 'emotion-theming' import canada from '../../../theme/canada' import { EditButton } from '../' import { I18nProvider } from '@lingui/react' import { i18n } from '@lingui/core' import en from '../../../locales/en.json' import { MemoryRouter } from 'react-router-dom' import { StateProvider, initialState, reducer } from '../../../utils/state' i18n.load('en', { en }) i18n.activate('en') describe('<EditButton />', () => { afterEach(cleanup) it('renders', () => { render( <MemoryRouter> <StateProvider initialState={initialState} reducer={reducer}> <I18nProvider i18n={i18n}> <ThemeProvider theme={canada}> <EditButton path="/" label="foo" /> </ThemeProvider> </I18nProvider> </StateProvider> </MemoryRouter>, ) }) it('shows the edit button if not submitted', () => { const { queryAllByText } = render( <MemoryRouter> <StateProvider initialState={initialState} reducer={reducer}> <I18nProvider i18n={i18n}> <ThemeProvider theme={canada}> <EditButton path="/" label="foo" /> </ThemeProvider> </I18nProvider> </StateProvider> </MemoryRouter>, ) const editButtons = queryAllByText(/button.edit/) expect(editButtons).toHaveLength(1) }) it('hides the edit button if submitted', () => { const { queryAllByText } = render( <MemoryRouter> <StateProvider initialState={{ submitted: true }} reducer={reducer}> <I18nProvider i18n={i18n}> <ThemeProvider theme={canada}> <EditButton path="/" label="foo" /> </ThemeProvider> </I18nProvider> </StateProvider> </MemoryRouter>, ) const editButtons = queryAllByText(/button.edit/) expect(editButtons).toHaveLength(0) }) }) <|start_filename|>f2/cypress/integration/common/home.js<|end_filename|> import { When, Then, Given } from 'cypress-cucumber-preprocessor/steps' // Test accessibility //After(() => { // cy.reportA11y() //}) Given('I open the report home page', () => { cy.visit(Cypress.env('local')) }) // Start page in English When('I click on create a report button', () => { cy.contains('Start a full report').first().click({ force: true }) }) When('I click on submit a tip', () => { cy.contains('Submit a general tip').first().click({ force: true }) }) // Start page in French When('I change the language', () => { cy.contains('Français').first().click({ force: true }) cy.wait(3000) cy.contains('Commencer un rapport complet').first().click({ force: true }) }) When('I change the language and click Soumettre un renseignement', () => { cy.contains('Français').first().click({ force: true }) cy.wait(3000) cy.contains('Soumettre un renseignement').first().click({ force: true }) }) // Second page - Before you start Then('I read before you start instructions', () => { cy.contains('Start report').first().click({ force: true }) cy.contains('Continue').first().click({ force: true }) //cy.get('[data-cy=submit]').click({ force: true }) }) Then('I read before you start instructions in French', () => { cy.contains('Commencer le rapport').first().click({ force: true }) cy.contains('Continuer').first().click({ force: true }) //cy.get('[data-cy=submit]').click({ force: true }) }) <|start_filename|>f2/src/components/Field/index.js<|end_filename|> /** @jsx jsx */ import { jsx } from '@emotion/core' import PropTypes from 'prop-types' import { FormControl } from '@chakra-ui/core' import { FormHelperText } from '../FormHelperText' import { FormLabel } from '../FormLabel' import { FormErrorMessage } from '../FormErrorMessage' import { Field as FieldAdapter, useField } from 'react-final-form' import { UniqueID } from '../unique-id' import { Input } from '../input' import { Trans } from '@lingui/react' import { Text } from '../text' export const Field = (props) => { const { meta: { invalid, submitFailed }, } = useField(props.name, { subscription: { invalid: true, submitFailed: true, }, }) return ( <UniqueID> {(id) => { return ( <FormControl aria-labelledby={id} isInvalid={submitFailed && invalid}> <FormLabel id={id} htmlFor={props.name}> {props.label}{' '} <Text as="span" fontWeight="normal"> {props.required && <Trans id="default.requiredField" />} </Text> </FormLabel> {props.helperText && ( <FormHelperText>{props.helperText}</FormHelperText> )} {props.errorMessage && ( <FormErrorMessage>{props.errorMessage}</FormErrorMessage> )} <FieldAdapter mt={3} name={props.name} id={props.name} component={props.component} {...props} /> </FormControl> ) }} </UniqueID> ) } Field.defaultProps = { component: Input, } Field.propTypes = { component: PropTypes.elementType, children: PropTypes.any, name: PropTypes.string, label: PropTypes.any, helperText: PropTypes.any, errorMessage: PropTypes.any, required: PropTypes.bool, } <|start_filename|>f2/src/utils/__tests__/sanitize.test.js<|end_filename|> import { sanitize } from '../sanitize' describe('sanitize', () => { it('strips tags', () => { expect(sanitize('<h1>hi</h1>')).toEqual('hi') expect(sanitize('<em>hi</em>')).toEqual('hi') }) it('deletes scripts', () => { expect(sanitize('<script>alert(1)</script>')).toEqual('') }) it('leaves normal text alone', () => { expect(sanitize('Some text!')).toEqual('Some text!') }) it('formats non-tags appropriately', () => { expect(sanitize('1 < 2')).toEqual('1 &lt; 2') expect(sanitize('1 & 2')).toEqual('1 &amp; 2') }) }) <|start_filename|>f2/src/summary/AnonymousSummary.js<|end_filename|> /** @jsx jsx */ import React from 'react' import { jsx } from '@emotion/core' import { Trans } from '@lingui/macro' import { Stack, Flex } from '@chakra-ui/core' import { useStateValue } from '../utils/state' import { testdata } from '../ConfirmationSummary' import { EditButton } from '../components/EditButton' import { H2 } from '../components/header' import { Text } from '../components/text' export const AnonymousSummary = (props) => { const [data] = useStateValue() const anonymous = { ...testdata.formData.anonymous, ...data.formData.anonymous, } return ( <React.Fragment> <Stack spacing={4} borderBottom="2px" borderColor="gray.300" pb={4} {...props} > <Flex align="baseline"> <H2 fontWeight="normal"> <Trans id="confirmationPage.anonymous.title" /> </H2> <EditButton label="confirmationPage.anonymous.title.edit" path="/anonymous" /> </Flex> <Text>{anonymous.anonymousOption}</Text> <Text> <Trans id="confirmationPage.anonymous.nag" /> </Text> </Stack> </React.Fragment> ) } <|start_filename|>f2/src/components/button/index.js<|end_filename|> import React from 'react' import PropTypes from 'prop-types' import { Button as ChakraButton, Flex } from '@chakra-ui/core' import canada from '../../theme/canada' export const Button = ({ variant, variants, variantColor, ...props }) => ( <ChakraButton {...canada.variants.buttons.default} variantColor={variantColor} variant={variant} _hover={{ boxShadow: 'outlineHover', }} {...(variant === 'solid' && variantColor !== 'gray' && { borderColor: canada.colors[variantColor][800], bg: canada.colors[variantColor][700], _active: { bg: canada.colors[variantColor][800], }, })} {...(variant === 'solid' && { bg: canada.colors[variantColor][700], _active: { bg: canada.colors[variantColor][800], }, })} {...(variantColor === 'black' && { color: 'white', bg: canada.colors.gray[700], borderColor: canada.colors.gray[800], _active: { bg: canada.colors.gray[800], }, })} {...(variantColor === 'gray' && { bg: canada.colors[variantColor][200], borderColor: canada.colors[variantColor][300], _active: { bg: canada.colors[variantColor][300], }, })} {...(variantColor === 'yellow' && { bg: canada.colors[variantColor][500], borderColor: canada.colors[variantColor][600], color: canada.colors.black, _active: { bg: canada.colors[variantColor][600], }, })} {...props} > <Flex align="center">{props.children}</Flex> </ChakraButton> ) Button.propTypes = { children: PropTypes.node, } Button.defaultProps = { variantColor: 'green', variant: 'solid', } <|start_filename|>f2/utils/checkTranslations.js<|end_filename|> var fs = require('fs') const LinguiDataFails = (data, file) => { let returnValue = false for (const [key, value] of Object.entries(data)) { // "plural" auto-generates keys with { in them if (key !== '' && !key.includes('{') && (key === value || value === '')) { console.warn(`Missing Translation in ${file}: ${key}`) returnValue = true } } return returnValue } let linguiFr = JSON.parse(fs.readFileSync('src/locales/fr.json')) let linguiEn = JSON.parse(fs.readFileSync('src/locales/en.json')) let linguiFails = false linguiFails = linguiFails || LinguiDataFails(linguiFr, 'fr.json') linguiFails = linguiFails || LinguiDataFails(linguiEn, 'en.json') if (linguiFails) { throw new Error('Lingui check failed') } else { console.info('Lingui check passed') } <|start_filename|>f2/src/WhatHappenedPage.js<|end_filename|> /** @jsx jsx */ import { jsx } from '@emotion/core' import React from 'react' import { Route } from 'react-router-dom' import { Trans } from '@lingui/macro' import { H1 } from './components/header' import { Ul } from './components/unordered-list' import { Lead, P } from './components/paragraph' import { WhatHappenedForm } from './forms/WhatHappenedForm' import { Layout } from './components/layout' import { BackButton } from './components/backbutton' import { Stack } from '@chakra-ui/core' import { useStateValue } from './utils/state' import { Page } from './components/Page' import { Li } from './components/list-item' import { formDefaults } from './forms/defaultValues' import { useLog } from './useLog' export const WhatHappenedPage = () => { const [data, dispatch] = useStateValue() const { doneForms } = data const { fyiForm } = data.formData const whatWasAffected = { ...formDefaults.whatWasAffected, ...data.formData.whatWasAffected, } useLog('WhatHappenedPage') return ( <Route render={({ history }) => ( <Page> <Layout columns={{ base: 4 / 4, md: 6 / 8, lg: 7 / 12 }}> <Stack spacing={10} shouldWrapChildren> <BackButton /> <H1> {fyiForm ? ( <Trans id="whatHappenedPage.fyi.title" /> ) : ( <Trans id="whatHappenedPage.title" /> )} </H1> {fyiForm ? null : ( <React.Fragment> <Stack spacing={4}> <Lead> <Trans id="whatHappenedPage.intro1" /> </Lead> <P mt={8}> <Trans id="whatHappenedPage.thinkAbout" /> </P> <Ul> <Li> <Trans id="whatHappenedPage.thinkAbout.default1" /> </Li> {whatWasAffected.affectedOptions.includes( 'whatWasAffectedForm.other', ) && ( <Li> <Trans id="whatHappenedPage.thinkAbout.other" /> </Li> )} {whatWasAffected.affectedOptions.includes( 'whatWasAffectedForm.financial', ) && ( <Li> <Trans id="whatHappenedPage.thinkAbout.money" /> </Li> )} {whatWasAffected.affectedOptions.includes( 'whatWasAffectedForm.personalInformation', ) && ( <Li> <Trans id="whatHappenedPage.thinkAbout.personalInfo" /> </Li> )} {whatWasAffected.affectedOptions.includes( 'whatWasAffectedForm.devices', ) && ( <Li> <Trans id="whatHappenedPage.thinkAbout.devices" /> </Li> )} {whatWasAffected.affectedOptions.includes( 'whatWasAffectedForm.business_assets', ) && ( <Li> <Trans id="whatHappenedPage.thinkAbout.business" /> </Li> )} </Ul> </Stack> </React.Fragment> )} <WhatHappenedForm onSubmit={(data) => { dispatch({ type: 'saveFormData', data: { whatHappened: data }, }) if (doneForms) { history.push('/confirmation') } else { history.push(fyiForm ? '/evidence' : '/suspectclues') } }} /> </Stack> </Layout> </Page> )} /> ) } <|start_filename|>f2/src/forms/WhenDidItHappenForm.js<|end_filename|> import React from 'react' import PropTypes from 'prop-types' import { Trans } from '@lingui/macro' import { useStateValue } from '../utils/state' import { Form, Container, Row } from 'react-bootstrap' import { Formik, Field, FieldArray } from 'formik' import { CheckBoxRadio } from '../components/formik/checkboxRadio' import { DatePicker } from '../components/formik/datePicker' import { NextCancelButtons } from '../components/formik/button' import { Info, ErrorSummary } from '../components/formik/alert' import { TextArea } from '../components/formik/textArea' import { whenDidItHappenFormSchema } from './WhenDidItHappenFormSchema' import { WarningModal } from '../components/formik/warningModal' import { ErrorText } from '../components/formik/paragraph' export const WhenDidItHappenForm = (props) => { const [data] = useStateValue() const whenDidItHappen = { ...data.formData.whenDidItHappen, } const incidentFrequency = whenDidItHappenFormSchema.QUESTIONS.incidentFrequency const once = whenDidItHappenFormSchema.QUESTIONS.once const moreThanOnce = whenDidItHappenFormSchema.QUESTIONS.moreThanOnce const notSure = whenDidItHappenFormSchema.QUESTIONS.notSure const formOptions = [once, moreThanOnce, notSure] const realTimeValidation = whenDidItHappenFormSchema.REAL_TIME_VALIDATION const onSubmitValidation = whenDidItHappenFormSchema.ON_SUBMIT_VALIDATION const createErrorSummary = whenDidItHappenFormSchema.CREATE_ERROR_SUMMARY const clearHappenedOnce = (values) => { values.happenedOnceDay = '' values.happenedOnceMonth = '' values.happenedOnceYear = '' } const clearDateRange = (values) => { values.startDay = '' values.startMonth = '' values.startYear = '' values.endDay = '' values.endMonth = '' values.endYear = '' } const clearDescription = (values) => { values.description = '' } const clearData = (values) => { if (values.incidentFrequency === 'once') { clearDateRange(values) clearDescription(values) } else if (values.incidentFrequency === 'moreThanOnce') { clearHappenedOnce(values) clearDescription(values) } else { clearHappenedOnce(values) clearDateRange(values) } } return ( <React.Fragment> <Formik initialValues={whenDidItHappen} validate={(values) => { return realTimeValidation(values) }} onSubmit={async (values, { setErrors }) => { const errors = onSubmitValidation(values) if (errors.fields) { setErrors(errors.fields) } else { await clearData(values) props.onSubmit(values) } }} > {({ handleSubmit, handleChange, handleBlur, submitCount, errors, dirty, isSubmitting, }) => ( <Form onSubmit={handleSubmit}> <WarningModal dirty={dirty} isSubmitting={isSubmitting} /> <Container> <Row className="form-question"> {Object.keys(errors).length > 0 && ( <ErrorSummary errors={createErrorSummary(errors)} submissions={submitCount} title={<Trans id="default.hasValidationErrors" />} /> )} <Row className="form-label" id="incidentFrequency"> <Trans id="whenDidItHappenPage.question" /> </Row> </Row> <Row className="form-section"> {errors && errors.incidentFrequency && ( <ErrorText>{incidentFrequency.errorMessage}</ErrorText> )} <FieldArray name="incidentFrequency" className="form-section" render={() => formOptions.map((question) => { return ( <React.Fragment key={question.name}> <Field name="incidentFrequency" label={question.radioLabel} component={CheckBoxRadio} value={question.value} onChange={handleChange} onBlur={handleBlur} type="radio" id={question.id} > {question.value === 'once' && ( <div id={question.name}> {errors && errors.happenedOnce && ( <ErrorText> {question.datePicker.errorMessage} </ErrorText> )} <Field name={question.name} label={question.datePicker.label} helpText={question.datePicker.helpText} component={DatePicker} onBlur={handleBlur} onChange={handleChange} id={question.datePicker.id} /> </div> )} {question.value === 'moreThanOnce' && ( <React.Fragment> <div id="start"> {errors && errors.start && ( <ErrorText> {question.datePickerStart.errorMessage} </ErrorText> )} <Field name="start" label={question.datePickerStart.label} helpText={question.datePickerStart.helpText} component={DatePicker} onBlur={handleBlur} onChange={handleChange} id={question.datePickerStart.id} /> </div> <div id="end"> {errors && errors.end && ( <ErrorText> {question.datePickerEnd.errorMessage} </ErrorText> )} <Field name="end" label={question.datePickerEnd.label} helpText={question.datePickerEnd.helpText} component={DatePicker} onBlur={handleBlur} onChange={handleChange} id={question.datePickerEnd.id} /> </div> </React.Fragment> )} {question.value === 'notSure' && ( <Field name={question.name} label={question.descriptionLabel} helpText={question.descriptionHelpText} component={TextArea} onBlur={handleBlur} onChange={handleChange} /> )} </Field> </React.Fragment> ) }) } /> </Row> <Row className="form-section"> <Info> <Trans id="howDidItStartPage.tip" /> </Info> </Row> <Row> <NextCancelButtons submit={<Trans id="howDidItStartPage.nextButton" />} cancel={<Trans id="button.cancelReport" />} label={<Trans id="whenDidItHappenPage.nextPage" />} /> </Row> </Container> </Form> )} </Formik> </React.Fragment> ) } WhenDidItHappenForm.propTypes = { onSubmit: PropTypes.func.isRequired, } <|start_filename|>f2/src/utils/focusTarget.js<|end_filename|> //Source: https://github.com/alphagov/govuk-frontend/blob/master/src/govuk/components/error-summary/error-summary.js export const focusTarget = target => { // If the element that was clicked was not a link, return early if (target.tagName !== 'A' || target.href === false) { return false } let inputId = getFragmentFromUrl(target.href) let input = document.getElementById(inputId) if (!input) { return false } let legendOrLabel = getAssociatedLegendOrLabel(input) if (!legendOrLabel) { return false } // Scroll the legend or label into view *before* calling focus on the input to // avoid extra scrolling in browsers that don't support `preventScroll` (which // at time of writing is most of them...) legendOrLabel.scrollIntoView() input.focus({ preventScroll: true }) return true } const getFragmentFromUrl = url => { if (url.indexOf('#') === -1) { return false } return url.split('#').pop() } const getAssociatedLegendOrLabel = input => { var fieldset = input.closest('fieldset') if (fieldset) { var legends = fieldset.getElementsByTagName('legend') if (legends.length) { var candidateLegend = legends[0] // If the input type is radio or checkbox, always use the legend if there // is one. if (input.type === 'checkbox' || input.type === 'radio') { return candidateLegend } // For other input types, only scroll to the fieldset’s legend (instead of // the label associated with the input) if the input would end up in the // top half of the screen. // // This should avoid situations where the input either ends up off the // screen, or obscured by a software keyboard. var legendTop = candidateLegend.getBoundingClientRect().top var inputRect = input.getBoundingClientRect() // If the browser doesn't support Element.getBoundingClientRect().height // or window.innerHeight (like IE8), bail and just link to the label. if (inputRect.height && window.innerHeight) { var inputBottom = inputRect.top + inputRect.height if (inputBottom - legendTop < window.innerHeight / 2) { return candidateLegend } } } } return ( document.querySelector("label[for='" + input.getAttribute('id') + "']") || input.closest('label') ) } <|start_filename|>f2/src/forms/WhatWasAffectedFormSchema.js<|end_filename|> import * as Yup from 'yup' const whatWasAffectedFormSchema = Yup.object().shape({ affectedOptions: Yup.array().required(), }) export const WhatWasAffectedFormSchema = () => { return whatWasAffectedFormSchema } <|start_filename|>f2/src/forms/WhenDidItHappenFormSchema.js<|end_filename|> import React from 'react' import { Trans } from '@lingui/macro' import { evalDate, evalDateRange } from '../utils/validateDate' /* Define form questions */ const formQuestions = { incidentFrequency: { label: <Trans id="whenDidItHappenPage.question" />, errorMessage: <Trans id="whenDidItHappenForm.error" />, }, once: { name: 'happenedOnce', value: 'once', id: 'incidentFrequency-Once', radioLabel: <Trans id="whenDidItHappenPage.options.once" />, datePicker: { label: <Trans id="whenDidItHappenPage.singleDate.label" />, helpText: <Trans id="whenDidItStart.labelExample" />, id: 'happenedOnceDatePicker', errorMessage: <Trans id="whenDidItHappenForm.dateError" />, }, }, moreThanOnce: { name: 'happenedMoreThanOnce', value: 'moreThanOnce', id: 'happenedMoreThanOnce', radioLabel: <Trans id="whenDidItHappenPage.options.moreThanOnce" />, datePickerStart: { label: <Trans id="whenDidItHappenPage.dateRange.start.label" />, helpText: <Trans id="whenDidItStart.labelExample" />, id: 'happenedMoreThanOnceStart', errorMessage: <Trans id="whenDidItHappenForm.dateError" />, }, datePickerEnd: { label: <Trans id="whenDidItHappenPage.dateRange.end.label" />, helpText: <Trans id="whenDidItStart.labelExample" />, id: 'happenedMoreThanOnceEnd', errorMessage: <Trans id="whenDidItHappenForm.dateError" />, }, }, notSure: { name: 'description', value: 'notSure', id: 'incidentFrequency-NotSure', radioLabel: <Trans id="whenDidItHappenPage.options.notSure" />, descriptionLabel: <Trans id="whenDidItHappenPage.notSure.label" />, descriptionHelpText: <Trans id="whenDidItHappenPage.notSure.helperText" />, }, } /* Evaluate fields as the user enters data. */ const realTimeValidation = (values) => { let errors = {} if (values.incidentFrequency === 'once') { let happenedOnceError = {} happenedOnceError = evalDate( values.happenedOnceDay, values.happenedOnceMonth, values.happenedOnceYear, ) if (Object.keys(happenedOnceError).length > 0) { errors['happenedOnceDay'] = happenedOnceError.day ? happenedOnceError.day : null errors['happenedOnceMonth'] = happenedOnceError.month ? happenedOnceError.month : null errors['happenedOnceYear'] = happenedOnceError.year ? happenedOnceError.year : null errors['happenedOnce'] = true } } else if (values.incidentFrequency === 'moreThanOnce') { const dateRangeErrors = evalDateRange(values) if (dateRangeErrors.startError) { errors['startDay'] = dateRangeErrors.startError.day ? dateRangeErrors.startError.day : null errors['startMonth'] = dateRangeErrors.startError.month ? dateRangeErrors.startError.month : null errors['startYear'] = dateRangeErrors.startError.year ? dateRangeErrors.startError.year : null errors['start'] = true } if (dateRangeErrors.endError) { errors['endDay'] = dateRangeErrors.endError.day ? dateRangeErrors.endError.day : null errors['endMonth'] = dateRangeErrors.endError.month ? dateRangeErrors.endError.month : null errors['endYear'] = dateRangeErrors.endError.year ? dateRangeErrors.endError.year : null errors['end'] = true } } return errors } /* Evaluate fields on submit. Every field is validated independantly. We are simply checking for empty fields here as content is evaluated in real time. */ const onSubmitValidation = (values) => { const errors = {} const fields = {} if (values.incidentFrequency === 'once') { if ( values.happenedOnceDay || values.happenedOnceMonth || values.happenedOnceYear ) { fields['happenedOnceDay'] = !values.happenedOnceDay fields['happenedOnceMonth'] = !values.happenedOnceMonth fields['happenedOnceYear'] = !values.happenedOnceYear const hasError = fields['happenedOnceDay'] || fields['happenedOnceMonth'] || fields['happenedOnceYear'] if (hasError) { fields['happenedOnce'] = true errors['fields'] = fields } } } else if (values.incidentFrequency === 'moreThanOnce') { if (values.startDay || values.startMonth || values.startYear) { fields['startDay'] = !values.startDay fields['startMonth'] = !values.startMonth fields['startYear'] = !values.startYear const hasStartError = fields['startDay'] || fields['startMonth'] || fields['startYear'] if (hasStartError) { fields['start'] = true errors['fields'] = fields } } if (values.endDay || values.endMonth || values.endYear) { fields['endDay'] = !values.endDay fields['endMonth'] = !values.endMonth fields['endYear'] = !values.endYear const hasEndError = fields['endDay'] || fields['endMonth'] || fields['endYear'] if (hasEndError) { fields['end'] = true errors['fields'] = fields } } } return errors } /* Create an error summary to display at the top of the page. */ const createErrorSummary = (errors) => { const errorSummary = {} const happenedOnce = errors.happenedOnce || errors.happenedOnceDay || errors.happenedOnceMonth || errors.happenedOnceYear const start = errors.start || errors.startDay || errors.startMonth || errors.startYear const end = errors.end || errors.endDay || errors.endMonth || errors.endYear const incidentFrequency = errors.incidentFrequency if (happenedOnce) { errorSummary['happenedOnce'] = { label: formQuestions.once.datePicker.label, message: formQuestions.once.datePicker.errorMessage, } } if (start) { errorSummary['start'] = { label: formQuestions.moreThanOnce.datePickerStart.label, message: formQuestions.moreThanOnce.datePickerStart.errorMessage, } } if (end) { errorSummary['end'] = { label: formQuestions.moreThanOnce.datePickerEnd.label, message: formQuestions.moreThanOnce.datePickerEnd.errorMessage, } } if (incidentFrequency) { errorSummary['incidentFrequency'] = { label: <Trans id="whenDidItHappenPage.question" />, message: <Trans id="whenDidItHappenForm.error" />, } } return errorSummary } export const whenDidItHappenFormSchema = { QUESTIONS: formQuestions, REAL_TIME_VALIDATION: realTimeValidation, ON_SUBMIT_VALIDATION: onSubmitValidation, CREATE_ERROR_SUMMARY: createErrorSummary, } <|start_filename|>f2/src/pdf/LocationInfoView.js<|end_filename|> /** @jsx jsx */ import { jsx } from '@emotion/core' import { containsData } from '../utils/containsData' import { testdata } from '../ConfirmationSummary' import { Text, View, Image } from '@react-pdf/renderer' import { pdfStyles } from './pdfStyles' import { DescriptionItemView } from './DescriptionItemView' import line from '../images/line.png' export const LocationInfoView = (props) => { const lang = props.lang const location = { ...testdata.formData.location, ...props.data.formData.location, } return ( <View style={pdfStyles.section}> <Text style={pdfStyles.title}> {lang['confirmationPage.location.title']} </Text> {containsData(location) ? ( <View> <DescriptionItemView title="confirmationPage.location.city" description={location.city} lang={lang} /> <DescriptionItemView title="confirmationPage.location.province" description={location.province} lang={lang} /> <DescriptionItemView title="confirmationPage.location.postalCode" description={location.postalCode} lang={lang} /> </View> ) : ( <Text style={pdfStyles.sectionContent}> {lang['confirmationPage.location.nag']} </Text> )} <Image style={pdfStyles.sectionSeparator} src={line} /> </View> ) } <|start_filename|>f2/src/pdf/BusinessInfoView.js<|end_filename|> /** @jsx jsx */ import { jsx } from '@emotion/core' import { containsData } from '../utils/containsData' import { testdata } from '../ConfirmationSummary' import { Text, View, Image } from '@react-pdf/renderer' import { pdfStyles } from './pdfStyles' import { DescriptionItemView } from './DescriptionItemView' import line from '../images/line.png' export const BusinessInfoView = (props) => { const lang = props.lang const businessInfo = { ...testdata.formData.businessInfo, ...props.data.formData.businessInfo, } return ( <View style={pdfStyles.section}> <Text style={pdfStyles.title}> {lang['confirmationPage.businessInfo.title']} </Text> {containsData(businessInfo) ? ( <View> <DescriptionItemView title="confirmationPage.businessInfo.nameOfBusiness" description={businessInfo.nameOfBusiness} lang={lang} /> <DescriptionItemView title="confirmationPage.businessInfo.industry" description={businessInfo.industry} lang={lang} /> <DescriptionItemView title="confirmationPage.businessInfo.role" description={businessInfo.role} lang={lang} /> <DescriptionItemView title="confirmationPage.businessInfo.numberOfEmployee" description={lang[businessInfo.numberOfEmployee]} lang={lang} /> </View> ) : ( <Text style={pdfStyles.sectionContent}> {lang['confirmationPage.businessInfo.nag']} </Text> )} <Image style={pdfStyles.sectionSeparator} src={line} /> </View> ) } <|start_filename|>f2/src/utils/validationSchema.js<|end_filename|> const phoneRegExp = /^\(?([0-9]{3})\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})$/ const postalCodeRegex = /^([A-Za-z]\d[A-Za-z][-]?\d[A-Za-z]\d)/ export const phone = () => { return phoneRegExp } export const postalCode = () => { return postalCodeRegex } <|start_filename|>f2/src/theme/canada.js<|end_filename|> import { theme as chakraTheme } from '@chakra-ui/core' import { generateAlphaColors } from '@chakra-ui/core/dist/theme/colors-utils' const colors = { green: { 50: '#F2FFF0', 100: '#C3EEBF', 200: '#92D68F', 300: '#5CB95B', 400: '#3C9D3F', 500: '#2D8133', 600: '#24672B', 700: '#1F5126', 800: '#183C1F', 900: '#102715', }, gray: { 50: '#FAFAFA', 100: '#F2F2F2', 200: '#E8E8E8', 300: '#D5D5D5', 400: '#AEAEAE', 500: '#808080', 600: '#555555', 700: '#373737', 800: '#202020', 900: '#191919', }, yellow: { 50: '#FFFDF0', 100: '#FEF1BF', 200: '#FADE89', 300: '#F6C95E', 400: '#ECB64B', 500: '#D6962E', 600: '#B7761F', 700: '#975A16', 800: '#744210', 900: '#5F370E', }, blue: { ...chakraTheme.colors.blue, hover: '#00F', }, } const fonts = { heading: '"Noto Sans", sans-serif', body: '"Noto Sans", sans-serif', mono: 'Noto Mono,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace', } const fontSizes = { xs: '0.75rem', sm: '0.875rem', md: '1rem', lg: '1.125rem', xl: '1.25rem', '2xl': '1.5rem', '3xl': '1.875rem', '4xl': '2.25rem', '5xl': '3rem', '6xl': '4rem', } const borders = { '3px': '3px solid', } const borderWidths = { '0': '0', '1': '0.25rem', '2': '0.5rem', '3': '0.75rem', '4': '1rem', } const space = { '7': '1.75rem', } const outlineColor = { focus: generateAlphaColors(chakraTheme.colors.blue[300])[700], invalid: generateAlphaColors(chakraTheme.colors.red[300])[700], } const shadows = { outline: `0 0 0 4px ${outlineColor.focus}`, outlineInput: `0 0 4px 1px ${outlineColor.focus}`, //outline: 'inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(102,175,233,.6)', outlineHover: `0 0 0 2px ${colors.gray[300]}`, outlineLeft: `-2px 0 0 0 ${colors.gray[300]}, 2px 0 0 0 inset ${colors.gray[300]}`, } const inputDefaults = { borderWidth: '1px', borderColor: 'gray.400', bg: 'white', _hover: { boxShadow: 'outlineHover', borderColor: 'gray.700', }, _focus: { outline: 'none', bg: 'white', boxShadow: 'outlineInput', borderColor: 'blue.600', }, _invalid: { borderColor: 'red.700', boxShadow: `0 0 4px 1px ${outlineColor.invalid}`, '&:focus': { borderColor: 'blue.600', boxShadow: `0 0 4px 1px ${outlineColor.focus}`, }, }, } const variants = { inputs: { checkboxes: { ...inputDefaults, size: 10, _checked: { border: '3px', borderColor: 'black', }, _checkedAndHover: { boxShadow: 'outlineHover', }, }, radios: { ...inputDefaults, rounded: 'full', size: 10, _checked: { border: '3px', borderColor: 'black', }, _checkedAndHover: { boxShadow: 'outlineHover', }, }, inputs: { ...inputDefaults, rounded: '4px', p: 2, maxW: '300px', transition: '0', }, }, buttons: { default: { fontSize: { base: 'lg', md: 'xl' }, fontWeight: 'normal', size: 'lg', rounded: '4px', bg: 'gray.200', border: '1px', borderStyle: 'outset', borderColor: 'gray.300', _hover: { boxShadow: 'outlineHover', }, _active: { bg: 'gray.300', }, }, solid: { border: '1px', borderStyle: 'outset', borderColor: 'blue.500', _active: { bg: 'blue.800', }, }, }, } // Final Theme output const canada = { ...chakraTheme, shadows: { ...chakraTheme.shadows, ...shadows, }, fontSizes, fonts: { ...chakraTheme.fonts, ...fonts, }, colors: { ...chakraTheme.colors, ...colors, }, borders: { ...chakraTheme.borders, ...borders, }, borderWidths: { ...chakraTheme.borderWidths, ...borderWidths, }, space: { ...chakraTheme.space, ...space, }, variants, } export default canada <|start_filename|>utils/loadTestingSubmitFile.js<|end_filename|> import { check, fail, sleep } from "k6"; import http from "k6/http"; const loadTestingUrl = `${__ENV.LOAD_TESTING_BASE_URL}`; if (loadTestingUrl === "undefined") { fail("ERROR: Environment variable LOAD_TESTING_BASE_URL not defined"); } const flattenedData = { language: "", prodVersion: "", appVersion: "", "consent.consentOptions": [], "anonymous.anonymousOptions": ["anonymousPage.no"], "howdiditstart.howDidTheyReachYou": [], "howdiditstart.email": "", "howdiditstart.phone": "", "howdiditstart.online": "", "howdiditstart.application": "", "howdiditstart.others": "", "howdiditstart.howManyTimes": "", "howdiditstart.startDay": "", "howdiditstart.startMonth": "", "howdiditstart.startYear": "", "whatWasAffected.affectedOptions": [], "moneyLost.demandedMoney": "", "moneyLost.moneyTaken": "", "moneyLost.methodPayment": [], "moneyLost.transactionDay": "", "moneyLost.transactionMonth": "", "moneyLost.transactionYear": "", "moneyLost.methodOther": "", "personalInformation.typeOfInfoReq": [], "personalInformation.typeOfInfoObtained": [], "personalInformation.infoReqOther": "", "personalInformation.infoObtainedOther": "", "devicesInfo.device": "", "devicesInfo.account": "", "businessInfo.nameOfBusiness": "", "businessInfo.industry": "", "businessInfo.role": "", "businessInfo.numberOfEmployee": "", "whatHappened.whatHappened": "", "suspectClues.suspectClues1": "", "suspectClues.suspectClues2": "", "suspectClues.suspectClues3": "", "evidence.files": [], "evidence.fileDescriptions": [], "location.postalCode": "", "location.city": "", "location.province": "", "contactInfo.fullName": "<NAME>", "contactInfo.email": "", "contactInfo.phone": "", }; let preparedData = {}; Object.entries(flattenedData).forEach(([key, value]) => { preparedData[key] = JSON.stringify(value); }); let binFile = open("bread.jpg", "b"); export default function () { // var data = { // field: "this is a field", // bread: http.file(binFile, "test.bin"), // }; preparedData["bread.jpg"] = http.file(binFile, "bread.jpg"); var res = http.post(`${loadTestingUrl}/submit`, preparedData); check(res, { "is status 200": (r) => r.status === 200, }); sleep(1); } <|start_filename|>f2/src/components/route/__tests__/RedirectRoute.test.js<|end_filename|> import React from 'react' import { render, cleanup } from '@testing-library/react' import { ThemeProvider } from 'emotion-theming' import canada from '../../../theme/canada' import { Router, Route } from 'react-router-dom' import { StateProvider, initialState, reducer } from '../../../utils/state' import { RedirectRoute } from '../' import { createMemoryHistory } from 'history' describe('<RedirectRoute />', () => { afterEach(cleanup) it('Renders children if consented', () => { initialState.formData.consent.consentOptions.push('yes') const mhistory = createMemoryHistory() mhistory.push('/howdiditstart') const { getAllByText } = render( <Router history={mhistory}> <ThemeProvider theme={canada}> <StateProvider initialState={initialState} reducer={reducer}> <RedirectRoute path="/howdiditstart">ABC</RedirectRoute> </StateProvider> </ThemeProvider> </Router>, ) expect(getAllByText(/ABC/)).toHaveLength(1) }) it('Renders to / if not consented', () => { initialState.formData.consent.consentOptions.pop() const mhistory = createMemoryHistory() mhistory.push('/howdiditstart') const { getAllByText } = render( <Router history={mhistory}> <ThemeProvider theme={canada}> <StateProvider initialState={initialState} reducer={reducer}> <RedirectRoute path="/howdiditstart">ABC</RedirectRoute> <Route exact path="/"> DEF </Route> </StateProvider> </ThemeProvider> </Router>, ) expect(getAllByText(/DEF/)).toHaveLength(1) }) }) <|start_filename|>f2/src/forms/InformationForm.js<|end_filename|> /** @jsx jsx */ import React from 'react' import PropTypes from 'prop-types' import { jsx } from '@emotion/core' import { useLingui } from '@lingui/react' import { Trans } from '@lingui/macro' import { useStateValue } from '../utils/state' import { Error, Info } from '../components/formik/alert' import { A } from '../components/formik/link' import { P } from '../components/formik/paragraph' import { formDefaults } from './defaultValues' import { Form, Container, Row } from 'react-bootstrap' import { Formik, FieldArray, Field, ErrorMessage } from 'formik' import { CheckBoxRadio } from '../components/formik/checkboxRadio' import { Input } from '../components/formik/input' import { NextCancelButtons } from '../components/formik/button' import { WarningModal } from '../components/formik/warningModal' export const InformationForm = (props) => { const [data] = useStateValue() const information = { ...formDefaults.personalInformation, ...data.formData.personalInformation, } const { i18n } = useLingui() const formOptionsReq = [ { name: 'creditCardReq', checkboxLabel: <Trans id="typeOfInfoReq.creditCard" />, checkboxValue: 'typeOfInfoReq.creditCard', }, { name: 'dobReq', checkboxLabel: <Trans id="typeOfInfoReq.dob" />, checkboxValue: 'typeOfInfoReq.dob', }, { name: 'homeAddressReq', checkboxLabel: <Trans id="typeOfInfoReq.homeAddress" />, checkboxValue: 'typeOfInfoReq.homeAddress', }, { name: 'sinReq', checkboxLabel: <Trans id="typeOfInfoReq.sin" />, checkboxValue: 'typeOfInfoReq.sin', }, { name: 'otherReq', checkboxLabel: <Trans id="typeOfInfoReq.other" />, checkboxValue: 'typeOfInfoReq.other', }, ] const formOptionsObtained = [ { name: 'creditCardObtained', checkboxLabel: <Trans id="typeOfInfoObtained.creditCard" />, checkboxValue: 'typeOfInfoObtained.creditCard', }, { name: 'dobObtained', checkboxLabel: <Trans id="typeOfInfoObtained.dob" />, checkboxValue: 'typeOfInfoObtained.dob', }, { name: 'homeAddressObtained', checkboxLabel: <Trans id="typeOfInfoObtained.homeAddress" />, checkboxValue: 'typeOfInfoObtained.homeAddress', }, { name: 'sinObtained', checkboxLabel: <Trans id="typeOfInfoObtained.sin" />, checkboxValue: 'typeOfInfoObtained.sin', }, { name: 'otherObtained', checkboxLabel: <Trans id="typeOfInfoObtained.other" />, checkboxValue: 'typeOfInfoObtained.other', }, ] return ( <React.Fragment> <Formik initialValues={information} onSubmit={(values) => { if (!values.typeOfInfoReq.includes('typeOfInfoReq.other')) { values.infoReqOther = '' } if (!values.typeOfInfoObtained.includes('typeOfInfoObtained.other')) { values.infoObtainedOther = '' } props.onSubmit(values) }} > {({ values, handleSubmit, handleChange, handleBlur, dirty, isSubmitting, }) => ( <Form onSubmit={handleSubmit}> <WarningModal dirty={dirty} isSubmitting={isSubmitting} /> <Container> <Row className="form-question" lg={1}> <Row className="form-label"> <Trans id="informationPage.typeOfInfoReq" /> </Row> <Row className="form-helper-text"> <Trans id="informationPage.typeOfInfoReqExample" /> </Row> <ErrorMessage name="informationReq" component={Error} /> </Row> <Row className="form-section"> <FieldArray name="typeOfInfoReq" className="form-section" render={() => formOptionsReq.map((question) => { return ( <React.Fragment key={question.name}> <Field name="typeOfInfoReq" label={question.checkboxLabel} component={CheckBoxRadio} value={question.checkboxValue} onChange={handleChange} onBlur={handleBlur} type="checkbox" id={'checkbox-' + question.name} > {question.checkboxValue === 'typeOfInfoReq.other' && values.typeOfInfoReq.includes( 'typeOfInfoReq.other', ) && ( <Field name="infoReqOther" component={Input} onChange={handleChange} onBlur={handleBlur} id={'input-infoReqOther'} /> )} </Field> </React.Fragment> ) }) } /> </Row> <Row className="form-question" lg={1}> <Row className="form-label"> <Trans id="informationPage.typeOfInfoObtained" /> </Row> <Row className="form-helper-text"> <Trans id="informationPage.typeOfInfoObtainedExample" /> </Row> <ErrorMessage name="informationObtained" component={Error} /> </Row> <Row className="form-section"> <FieldArray name="typeOfInfoObtained" className="form-section" render={() => formOptionsObtained.map((question) => { return ( <React.Fragment key={question.name}> <Field name="typeOfInfoObtained" label={question.checkboxLabel} component={CheckBoxRadio} value={question.checkboxValue} onChange={handleChange} onBlur={handleBlur} type="checkbox" id={'checkbox-' + question.name} > {question.checkboxValue === 'typeOfInfoObtained.other' && values.typeOfInfoObtained.includes( 'typeOfInfoObtained.other', ) && ( <Field name="infoObtainedOther" component={Input} onChange={handleChange} onBlur={handleBlur} id={'input-infoObtainedOther'} /> )} </Field> </React.Fragment> ) }) } /> </Row> <Row> <Info> <P fontSize="md" mb={0}> <Trans id="informationPage.tip"> <A color="#0000ff" target="_blank" href={ i18n.locale === 'en' ? 'https://www.consumer.equifax.ca/fr/c/portal/update_language?p_l_id=23&redirect=%2Ffr%2Fpersonnel%2F&languageId=en_US' : 'https://www.consumer.equifax.ca/en/c/portal/update_language?p_l_id=23&redirect=%2Fen%2Fpersonal%2F&languageId=fr_FR' } /> <A color="#0000ff" target="_blank" href={ i18n.locale === 'en' ? 'https://www.transunion.ca/' : 'https://www.transunion.ca/fr' } /> </Trans> </P> </Info> </Row> <Row> <NextCancelButtons submit={<Trans id="informationPage.nextButton" />} cancel={<Trans id="button.cancelReport" />} label={<Trans id={props.nextpageText} />} /> </Row> </Container> </Form> )} </Formik> </React.Fragment> ) } InformationForm.propTypes = { onSubmit: PropTypes.func.isRequired, } <|start_filename|>f2/src/components/text-area/index.js<|end_filename|> import React from 'react' import { Textarea as ChakraTextarea } from '@chakra-ui/core' import canada from '../../theme/canada' export const TextArea = props => ( <ChakraTextarea {...canada.variants.inputs.inputs} maxW="600px" {...props.input} {...props} /> ) <|start_filename|>f2/src/components/route/index.js<|end_filename|> /** @jsx jsx */ import { jsx } from '@emotion/core' import { Route } from 'react-router-dom' import { useStateValue } from '../../utils/state' import { Redirect } from 'react-router-dom' export const RedirectRoute = ({ children, ...rest }) => { let consented = true const [state] = useStateValue() if (state.formData.consent.consentOptions.length === 0) { consented = false } return ( <Route {...rest} render={({ location }) => consented ? ( children ) : ( <Redirect to={{ pathname: '/', }} /> ) } /> ) } <|start_filename|>f2/src/forms/LocationAnonymousInfoForm.js<|end_filename|> /** @jsx jsx */ import React from 'react' import PropTypes from 'prop-types' import { jsx } from '@emotion/core' import { Trans } from '@lingui/macro' import { useStateValue } from '../utils/state' import { Form, Container, Row } from 'react-bootstrap' import { Formik, Field } from 'formik' import { NextCancelButtons } from '../components/formik/button' import { Input } from '../components/formik/input' import { WarningModal } from '../components/formik/warningModal' export const LocationAnonymousInfoForm = (props) => { const [data] = useStateValue() const location = { ...data.formData.location, } return ( <React.Fragment> <Formik initialValues={location} onSubmit={(values) => { props.onSubmit(values) }} > {({ handleSubmit, handleChange, handleBlur, dirty, isSubmitting }) => ( <Form onSubmit={handleSubmit}> <WarningModal dirty={dirty} isSubmitting={isSubmitting} /> <Container> <Row> <Field name="city" label={<Trans id="LocationAnonymousInfoForm.city" />} component={Input} onChange={handleChange} onBlur={handleBlur} id="city" type="text" /> </Row> <Row> <Field name="province" label={<Trans id="LocationAnonymousInfoForm.province" />} component={Input} onChange={handleChange} onBlur={handleBlur} id="province" type="text" /> </Row> <Row> <NextCancelButtons submit={<Trans id="LocationAnonymousInfoForm.nextButton" />} cancel={<Trans id="button.cancelReport" />} label={<Trans id="LocationAnonymousInfoForm.nextPage" />} /> </Row> </Container> </Form> )} </Formik> </React.Fragment> ) } LocationAnonymousInfoForm.propTypes = { onSubmit: PropTypes.func.isRequired, } <|start_filename|>f2/cypress/integration/common/howwaspersonalinformationaffected_page_fr.js<|end_filename|> import { When } from 'cypress-cucumber-preprocessor/steps' When('I fill Howwaspersonalinformationaffected in French page forms', () => { cy.get('form') .find('[value="typeOfInfoReq.creditCard"]') .check({ force: true }) cy.get('form').find('[value="typeOfInfoReq.dob"]').check({ force: true }) cy.get('form') .find('[value="typeOfInfoReq.homeAddress"]') .check({ force: true }) cy.get('form').find('[value="typeOfInfoReq.sin"]').check({ force: true }) cy.get('form').find('[value="typeOfInfoReq.other"]').check({ force: true }) //cy.get('form').find('[name="infoReqOther"]').type('Permis de conduire') cy.get('form') .find('[value="typeOfInfoObtained.creditCard"]') .check({ force: true }) cy.get('form').find('[value="typeOfInfoObtained.dob"]').check({ force: true }) cy.get('form') .find('[value="typeOfInfoObtained.homeAddress"]') .check({ force: true }) cy.get('form').find('[value="typeOfInfoObtained.sin"]').check({ force: true }) cy.get('form') .find('[value="typeOfInfoObtained.other"]') .check({ force: true }) //cy.get('form').find('[name="infoObtainedOther"]').type('Permis de conduire') }) When('I fill Howwaspersonalinformationaffected123 in French page forms', () => { cy.get('form') .find('[value="typeOfInfoReq.creditCard"]') .check({ force: true }) cy.get('form').find('[value="typeOfInfoReq.dob"]').check({ force: true }) cy.get('form') .find('[value="typeOfInfoReq.homeAddress"]') .check({ force: true }) cy.get('form') .find('[value="typeOfInfoObtained.creditCard"]') .check({ force: true }) cy.get('form').find('[value="typeOfInfoObtained.dob"]').check({ force: true }) cy.get('form') .find('[value="typeOfInfoObtained.homeAddress"]') .check({ force: true }) }) <|start_filename|>f2/cypress/integration/common/addsuspectclues_page.js<|end_filename|> import { When } from 'cypress-cucumber-preprocessor/steps' When('I fill Addsuspectclues page forms', () => { cy.get('form').find('[name="suspectClues1"]').type('Suspect Name Anonymous') cy.get('form').find('[name="suspectClues2"]').type('234 TallWood Cresent') cy.get('form') .find('[name="suspectClues3"]') .type('suspect clues - Tell More') }) When('I fill NoAddsuspectclues page forms', () => {}) When('I fill Addsuspectclues1 page forms', () => { cy.get('form').find('[name="suspectClues1"]').type('Suspect Name Anonymous') }) When('I fill Addsuspectclues3 page forms', () => { cy.get('form') .find('[name="suspectClues3"]') .type('suspect clues - Tell More') }) When('I fill Addsuspectclues3Inject page forms', () => { cy.fixture('form_data.json').then((user) => { var paragraph = user.sqpInjection1 cy.get('form').find('[name="suspectClues3"]').type(paragraph) }) }) When('I fill Addsuspectclues12 page forms', () => { cy.get('form').find('[name="suspectClues1"]').type('Suspect Name Anonymous') cy.get('form').find('[name="suspectClues2"]').type('234 TallWood Cresent') }) When('I fill Addsuspectclues13 page forms', () => { cy.get('form').find('[name="suspectClues1"]').type('Suspect Name Anonymous') cy.get('form') .find('[name="suspectClues3"]') .type('suspect clues - Tell More') }) When('I fill Addsuspectclues23 page forms', () => { cy.get('form').find('[name="suspectClues2"]').type('234 TallWood Cresent') cy.get('form') .find('[name="suspectClues3"]') .type('suspect clues - Tell More') }) <|start_filename|>f2/cypress/integration/common/yourcontactdetails_page.js<|end_filename|> import { When } from 'cypress-cucumber-preprocessor/steps' When('I fill yourContactDetails page forms', () => { cy.get('form').find('[name="fullName"]').type('FirstName LastName') cy.get('form').find('[name="email"]').type('<EMAIL>') cy.get('form').find('[name="phone"]').type('6131115634') }) When('I fill yourContactDetailsMail page forms', () => { cy.get('form').find('[name="fullName"]').type('FirstName LastName') cy.get('form').find('[name="email"]').type('<EMAIL>') }) When('I fill yourContactDetailsPhone page forms', () => { cy.get('form').find('[name="fullName"]').type('FirstName LastName') cy.get('form').find('[name="phone"]').type('6131115634') }) When('I fill yourContactDetailsName page forms', () => { cy.get('form').find('[name="fullName"]').type('FirstName LastName') }) When('I fill noyourContactDetailsName page forms', () => {}) <|start_filename|>f2/src/forms/ContactInfoForm.js<|end_filename|> /** @jsx jsx */ import React from 'react' import PropTypes from 'prop-types' import { jsx } from '@emotion/core' import { Trans } from '@lingui/macro' import { useStateValue } from '../utils/state' import { Form, Container, Row, Col } from 'react-bootstrap' import { P, ErrorText } from '../components/formik/paragraph' import { formDefaults } from './defaultValues' import { Formik, FieldArray, Field } from 'formik' import { Input } from '../components/formik/input' import { SkipButton, NextCancelButtons } from '../components/formik/button' import { FormRow } from '../components/formik/row' import { ErrorSummary } from '../components/formik/alert' import { ContactInfoFormSchema } from './ContactInfoFormSchema' import { WarningModal } from '../components/formik/warningModal' export const ContactInfoForm = (props) => { const [, dispatch] = useStateValue() const [data] = useStateValue() const contactInfo = { ...formDefaults.contactInfo, ...data.formData.contactInfo, } const FULL_NAME = ContactInfoFormSchema.CONTACT_INFO.fullName const EMAIL = ContactInfoFormSchema.CONTACT_INFO.email const PHONE = ContactInfoFormSchema.CONTACT_INFO.phone const EXTENSION = ContactInfoFormSchema.CONTACT_INFO.extension const createErrorSummary = ContactInfoFormSchema.CREATE_ERROR_SUMMARY const validationSchema = ContactInfoFormSchema.ON_SUBMIT_VALIDATION function RemoveData() { return dispatch({ type: 'saveFormData', data: { contactInfo: { fullName: '', email: '', phone: '', }, }, }) } return ( <React.Fragment> {false ? ( // mark ids for lingui <div> <Trans id="contactInfoPage.victimDetail" /> </div> ) : null} <Formik initialValues={contactInfo} validate={validationSchema} validateOnChange={false} onSubmit={(values) => { props.onSubmit(values) }} > {({ handleSubmit, handleChange, handleBlur, errors, submitCount, dirty, isSubmitting, }) => ( <Form onSubmit={handleSubmit}> <WarningModal dirty={dirty} isSubmitting={isSubmitting} /> {Object.keys(errors).length > 0 && ( <ErrorSummary errors={createErrorSummary(errors)} submissions={submitCount} title={<Trans id="contactinfoPage.hasValidationErrors" />} /> )} <Container> <FormRow> <P w="100%"> <Trans id="contactinfoPage.skipInfo" /> </P> </FormRow> <FormRow marginBottom="2rem"> <SkipButton label={<Trans id="contactinfoPage.skipButton" />} onClick={() => { RemoveData() }} to="/confirmation" /> </FormRow> <FormRow> <FieldArray name="contactInfo" className="form-section" render={() => { return ( <React.Fragment> {errors && errors.fullName && ( <ErrorText>{FULL_NAME.errorMessage}</ErrorText> )} <Field name={FULL_NAME.name} label={FULL_NAME.label} component={Input} onBlur={handleBlur} onChange={handleChange} id="fullName" /> {errors.emailOrPhone && ( <Container> <FormRow id="emailOrPhone"> <ErrorText> <Trans id="contactinfoForm.emailORphone.warning" /> </ErrorText> </FormRow> </Container> )} {errors.email && ( <ErrorText>{EMAIL.errorMessage}</ErrorText> )} <Field name={EMAIL.name} label={EMAIL.label} component={Input} onBlur={handleBlur} onChange={handleChange} id="email" /> {errors.phone && ( <ErrorText>{PHONE.errorMessage}</ErrorText> )} {errors.extension && ( <ErrorText>{EXTENSION.errorMessage}</ErrorText> )} <FormRow> <Col> <Field name={PHONE.name} label={PHONE.label} component={Input} onBlur={handleBlur} onChange={handleChange} id="phone" /> </Col> <Col lg="4"> <Field name={EXTENSION.name} label={EXTENSION.label} component={Input} onBlur={handleBlur} onChange={handleChange} id="extension" /> </Col> </FormRow> </React.Fragment> ) }} /> </FormRow> <Row> <NextCancelButtons submit={<Trans id="contactinfoPage.nextButton" />} cancel={<Trans id="button.cancelReport" />} label={<Trans id="contactinfoPage.nextInfo" />} /> </Row> </Container> </Form> )} </Formik> </React.Fragment> ) } ContactInfoForm.propTypes = { onSubmit: PropTypes.func.isRequired, } <|start_filename|>f2/src/forms/FinalFeedbackForm.js<|end_filename|> import React from 'react' import { Trans } from '@lingui/macro' import PropTypes from 'prop-types' import { Formik, FieldArray, Field } from 'formik' import { Error } from '../components/formik/alert' import { Form, Container, Row } from 'react-bootstrap' import { CheckBoxRadio } from '../components/formik/checkboxRadio' import { TextArea } from '../components/formik/textArea' import { FeedbackButton } from '../components/formik/button' export const FinalFeedbackForm = (props) => { const formOptions = [ { name: 'veryHard', radioLabel: <Trans id="finalFeedback.wasServiceHard.veryHard" />, radioValue: 'finalFeedback.wasServiceHard.veryHard', }, { name: 'hard', radioLabel: <Trans id="finalFeedback.wasServiceHard.hard" />, radioValue: 'finalFeedback.wasServiceHard.hard', }, { name: 'neutral', radioLabel: <Trans id="finalFeedback.wasServiceHard.neutral" />, radioValue: 'finalFeedback.wasServiceHard.neutral', }, { name: 'easy', radioLabel: <Trans id="finalFeedback.wasServiceHard.easy" />, radioValue: 'finalFeedback.wasServiceHard.easy', }, { name: 'veryEasy', radioLabel: <Trans id="finalFeedback.wasServiceHard.veryEasy" />, radioValue: 'finalFeedback.wasServiceHard.veryEasy', }, ] return ( <Formik initialValues={{ wasServiceHard: '', howCanWeDoBetter: '', }} initialStatus={{ showWarning: false }} onSubmit={(values, { setStatus }) => { if ( values.wasServiceHard.length === 0 && values.howCanWeDoBetter.length === 0 ) { setStatus({ showWarning: true }) } else { props.onSubmit(values) } }} > {({ handleSubmit, handleChange, handleBlur, status }) => ( <Form onSubmit={handleSubmit}> <Container> <Row className="form-question"> {status.showWarning ? ( <Error> <Trans id="finalFeedback.warning" /> </Error> ) : null} </Row> <Row className="form-question"> <Row className="form-label"> <Trans id="finalFeedback.wasServiceHard.label" /> </Row> </Row> <Row className="form-section"> <FieldArray name="wasServiceHard" className="form-section" render={() => formOptions.map((question) => { return ( <React.Fragment key={question.name}> <Field name="wasServiceHard" label={question.radioLabel} component={CheckBoxRadio} value={question.radioValue} onChange={handleChange} onBlur={handleBlur} type="radio" id={'radio-' + question.name} /> </React.Fragment> ) }) } /> </Row> <Row className="form-section"> <Field name="howCanWeDoBetter" label={<Trans id="finalFeedback.howCanWeDoBetter.label" />} helpText={<Trans id="finalFeedback.howCanWeDoBetter.helper" />} component={TextArea} onBlur={handleBlur} onChange={handleChange} id="textarea-whatHappened" /> </Row> <Row> <FeedbackButton label={<Trans id="finalFeedback.submit" />} /> </Row> </Container> </Form> )} </Formik> ) } FinalFeedbackForm.propTypes = { onSubmit: PropTypes.func.isRequired, } <|start_filename|>f2/src/pdf/ContactInfoView.js<|end_filename|> /** @jsx jsx */ import { jsx } from '@emotion/core' import { containsData } from '../utils/containsData' import { testdata } from '../ConfirmationSummary' import { Text, View, Image } from '@react-pdf/renderer' import { pdfStyles } from './pdfStyles' import { DescriptionItemView } from './DescriptionItemView' import line from '../images/line.png' export const ContactInfoView = (props) => { const lang = props.lang const contactInfo = { ...testdata.formData.contactInfo, ...props.data.formData.contactInfo, } return ( <View style={pdfStyles.section}> <Text style={pdfStyles.title}> {lang['confirmationPage.contactTitle']} </Text> {containsData(contactInfo) ? ( <View> <DescriptionItemView title="confirmationPage.contactInfo.fullName" description={contactInfo.fullName} lang={lang} /> <DescriptionItemView title="confirmationPage.contactInfo.email" description={contactInfo.email} lang={lang} /> <DescriptionItemView title="confirmationPage.contactInfo.phone" description={contactInfo.phone} lang={lang} /> <DescriptionItemView title="confirmationPage.contactInfo.extension" description={contactInfo.extension} lang={lang} /> </View> ) : ( <Text style={pdfStyles.sectionContent}> {lang['confirmationPage.contactIntro']} </Text> )} <Image style={pdfStyles.sectionSeparator} src={line} /> </View> ) } <|start_filename|>f2/src/theme/index.js<|end_filename|> const FONT_SIZES = [ '12rem', '14px', '16px', '19px', '24px', '27px', '36px', '48px', '80px', ] const LINE_HEIGHTS = [ 15 / 12, 20 / 14, 20 / 16, 25 / 19, 30 / 24, 30 / 27, 40 / 36, 50 / 48, 80 / 80, ] const SPACING = ['0px', '5px', '10px', '15px', '20px', '30px', '40px', '50px'] export const BREAKPOINTS = ['320px', '641px', '769px'] const colors = { white: '#FFF', black: '#000', blue: '#003a66', lightBlue: '#2b8cc4', purple: '#4c2c92', yellow: '#ffbf47', focusColor: '#ffbf47', infoCard: '#e8e8e8', crimson: '#dc143c', green: '#008000', darkGreen: '#00692f', darkGray: '#767676', } const theme = { fontSans: 'robotoregular, sans-serif', fontSizes: FONT_SIZES, lineHeights: LINE_HEIGHTS, space: SPACING, breakpoints: BREAKPOINTS, checkboxes: { size: '24px', labelSize: '28px', }, radioButtons: { size: '24px', labelSize: '28px', }, colors: colors, textStyles: { caps: { textTransform: 'uppercase', letterSpacing: '0.2em', }, }, colorStyles: { link: { color: colors.blue, '&:focus': { backgroundColor: colors.focusColor, outline: `3px solid ${colors.focusColor}`, }, '&:visited': { color: colors.purple, }, '&:hover': { color: colors.lightBlue, }, }, /*button: { //cursor: 'pointer', color: colors.white, backgroundColor: colors.green, '&:focus': { outline: `3px solid ${colors.focusColor}`, }, '&:hover': { backgroundColor: colors.darkGreen, }, },*/ footerLink: { color: '#FFF', '&:focus': { outline: `3px solid ${colors.focusColor}`, }, }, textArea: { color: colors.black, '&:focus': { outline: `3px solid ${colors.focusColor}`, }, }, }, } export default theme <|start_filename|>f2/src/components/layout/index.js<|end_filename|> import React, { useEffect } from 'react' import PropTypes from 'prop-types' import { Container } from '../container' import { Flex, Stack } from '@chakra-ui/core' export const Layout = props => { // scroll to the top of the page when this Layout renders useEffect(() => { window.scrollTo(0, 0) }) return ( <Container {...(props.fluid ? { w: '100%' } : { maxW: { sm: 540, md: 768, lg: 960, xl: 1200 }, mx: 'auto', px: 4, w: '100%', })} {...props} > <Row> <Column columns={props.columns}>{props.children}</Column> </Row> </Container> ) } Layout.propTypes = { fluid: PropTypes.bool, columns: PropTypes.any, noEffect: PropTypes.bool, } Layout.defaultProps = { noEffect: false, fluid: false, columns: { base: 1 }, } export const Column = props => { const col = {} //Turn fractions into % Object.keys(props.columns).map(key => { return (col[key] = props.columns[key] * 100 + '%') }) // Keep width and mx after props to prevent them being overwritten return ( <Stack className="col" flexShrink="0" flexGrow="0" flexBasis={col} maxW={col} px={2} {...props} > {props.children} </Stack> ) } export const Row = props => { return ( <Flex {...props} mx={-2} wrap="wrap" className="row"> {props.children} </Flex> ) } Column.defaultProps = { columns: { base: 1 }, } <|start_filename|>f2/src/components/datePicker/__tests__/DatePicker.test.js<|end_filename|> import React from 'react' import { ThemeProvider } from 'emotion-theming' import canada from '../../../theme/canada' import { render, cleanup, screen } from '@testing-library/react' import { DatePicker, SingleDatePicker, DateRangePicker } from '../' import { Form } from 'react-final-form' import { I18nProvider } from '@lingui/react' import { i18n } from '@lingui/core' import en from '../../../locales/en.json' i18n.load('en', { en }) i18n.activate('en') describe('<DatePicker />', () => { afterEach(cleanup) it('properly renders DatePicker components', () => { const submitMock = jest.fn() const { getAllByText } = render( <I18nProvider i18n={i18n}> <ThemeProvider theme={canada}> <Form initialValues="" onSubmit={submitMock} render={() => <DatePicker datePickerName="test" />} /> </ThemeProvider> </I18nProvider>, ) screen.debug() const testDay = getAllByText(/whenDidItStart.startDay/) expect(testDay).toHaveLength(1) const testMonth = getAllByText(/whenDidItStart.startMonth/) expect(testMonth).toHaveLength(1) const testYear = getAllByText(/whenDidItStart.startYear/) expect(testYear).toHaveLength(1) }) it('properly renders SingleDatePicker components', () => { const submitMock = jest.fn() const { getAllByText } = render( <I18nProvider i18n={i18n}> <ThemeProvider theme={canada}> <Form initialValues="" onSubmit={submitMock} render={() => ( <SingleDatePicker label="singleDatePickerTest" name="singleDatePickerTest" /> )} /> </ThemeProvider> </I18nProvider>, ) const testSingleDatePicker = getAllByText(/singleDatePickerTest/) expect(testSingleDatePicker).toHaveLength(1) }) it('properly renders DateRangePicker components', () => { const submitMock = jest.fn() const { getAllByText } = render( <I18nProvider i18n={i18n}> <ThemeProvider theme={canada}> <Form initialValues="" onSubmit={submitMock} render={() => ( <DateRangePicker datePickerName="dateRangePickertest" startLabel="startDateLabel" endLabel="endDateLabel" /> )} /> </ThemeProvider> </I18nProvider>, ) const testStartDate = getAllByText(/startDateLabel/) expect(testStartDate).toHaveLength(1) const testEndDate = getAllByText(/endDateLabel/) expect(testEndDate).toHaveLength(1) }) }) <|start_filename|>f2/src/forms/ConfirmationForm.js<|end_filename|> /** @jsx jsx */ import PropTypes from 'prop-types' import React from 'react' import { Trans } from '@lingui/macro' import { jsx } from '@emotion/core' import { useStateValue } from '../utils/state' import { Form } from 'react-bootstrap' import { Formik } from 'formik' import { NextCancelButtons } from '../components/formik/button' import { Info } from '../components/formik/alert' export const ConfirmationForm = (props) => { const [{ reportId, submitted }] = useStateValue() return ( <React.Fragment> {false ? ( // the following trans tags are for analyst email <div> <Trans id="analystReport.reportNumber" /> <Trans id="analystReport.dateReceived" /> <Trans id="analystReport.reportLanguage" /> <Trans id="analystReport.reportVersion" /> <Trans id="analystReport.fyiForm" /> <Trans id="analystReport.fieldsMissing.warning" /> <Trans id="analystReport.flagged" /> <Trans id="analystReport.noData" /> <Trans id="analystReport.reportInformation" /> <Trans id="analystReport.consent.yes" /> <Trans id="analystReport.consent.no" /> <Trans id="analystReport.narrative" /> <Trans id="analystReport.methodOfComms.email" /> <Trans id="analystReport.methodOfComms.phone" /> <Trans id="analystReport.methodOfComms.online" /> <Trans id="analystReport.methodOfComms.app" /> <Trans id="analystReport.methodOfComms.others" /> <Trans id="analystReport.numberOfEmployee.100To499" /> <Trans id="analystReport.numberOfEmployee.1To99" /> <Trans id="analystReport.numberOfEmployee.500More" /> <Trans id="analystReport.potentialOffensiveImageInEmailSubject" /> <Trans id="analystReport.selfHarmStringInEmailSubject" /> <Trans id="analystReport.affected.financial" /> <Trans id="analystReport.affected.personalinformation" /> <Trans id="analystReport.affected.business_assets" /> <Trans id="analystReport.affected.devices" /> <Trans id="analystReport.affected.other" /> <Trans id="analystReport.selfHarmString" /> <Trans id="analystReport.selfHarmWord" /> <Trans id="analystReport.incidentInformation" /> </div> ) : null} <Formik initialValues={{}} onSubmit={() => { props.onSubmit() }} > {({ handleSubmit }) => ( <Form onSubmit={handleSubmit}> {submitted ? ( <Info> <Trans id="confirmationPage.thankyou" values={{ reference: reportId }} /> </Info> ) : ( <NextCancelButtons submit={<Trans id="confirmationPage.nextButton" />} cancel={<Trans id="button.cancelReport" />} /> )} </Form> )} </Formik> </React.Fragment> ) } ConfirmationForm.propTypes = { onSubmit: PropTypes.func.isRequired, } <|start_filename|>f2/src/AnonymousPage.js<|end_filename|> /** @jsx jsx */ import { jsx } from '@emotion/core' import { Route } from 'react-router-dom' import { Trans } from '@lingui/macro' import { H1 } from './components/header' import { Lead } from './components/paragraph' import { AnonymousInfoForm } from './forms/AnonymousInfoForm' import { Layout } from './components/layout' import { BackButton } from './components/backbutton' import { Stack } from '@chakra-ui/core' import { useStateValue } from './utils/state' import { Page } from './components/Page' import { useLog } from './useLog' export const AnonymousPage = () => { const [state, dispatch] = useStateValue() const { doneForms } = state const anonymous = { ...state.formData.anonymous, } useLog('AnonymousPage') return ( <Route render={({ history }) => ( <Page> <Layout columns={{ base: 4 / 4, md: 6 / 8, lg: 7 / 12 }}> <Stack spacing={10} shouldWrapChildren> <BackButton /> <H1> <Trans id="anonymousPage.title" /> </H1> <Lead> <Trans id="anonymousPage.intro" /> </Lead> <AnonymousInfoForm onSubmit={(data) => { dispatch({ type: 'saveFormData', data: { anonymous: data }, }) let isChanged = JSON.stringify(anonymous.anonymousOptions) !== JSON.stringify(data.anonymousOptions) let destination = doneForms ? isChanged ? '/location' : '/confirmation' : '/whoAreYouReportFor' history.push(destination, { from: 'anonymous' }) }} /> </Stack> </Layout> </Page> )} /> ) } <|start_filename|>f2/src/utils/imageConversion.js<|end_filename|> const Jimp = require('jimp') const crypto = require('crypto') const { getFileExtension } = require('./filenameUtils') const fs = require('fs') function png2jpeg(png, jpg) { return Jimp.read(png) .then((image) => { return image.quality(50).writeAsync(jpg) }) .then((done) => {}) .catch((err) => { console.log(err) }) } async function convertImages(files) { return Promise.all( files .filter((file) => file.malwareIsClean) .map(async (file) => { let fileExtension = getFileExtension(file.name) if (fileExtension.endsWith('png')) { let jpgPath = file.path.substr(0, file.path.lastIndexOf('.')) + '.jpg' await png2jpeg(file.path, jpgPath) var shasum = crypto.createHash('sha1') let imageData = fs.readFileSync(jpgPath) shasum.update(imageData) const sha1Hash = shasum.digest('hex') let jsonFile = {} Object.assign(jsonFile, file) jsonFile.name = file.name.substr(0, file.name.lastIndexOf('.')) + '.jpg' jsonFile.type = 'image/jpeg' jsonFile.path = jpgPath jsonFile.size = imageData.length jsonFile.sha1 = sha1Hash return jsonFile } else { return null } }), ) } module.exports = { convertImages } <|start_filename|>f2/src/utils/verifyRecaptcha.js<|end_filename|> const fetch = require('isomorphic-unfetch') let url = 'https://www.google.com/recaptcha/api/siteverify' let secret = process.env.REACT_APP_RECAPTCHA_SECRET_KEY const verifyRecaptcha = (token, res) => { console.info('Verifying Google Recaptcha:', token) var form_data = `secret=${secret}&response=${token}` fetch(url, { method: 'POST', mode: 'cors', cache: 'no-cache', credentials: 'same-origin', redirect: 'follow', referrer: 'no-referrer', headers: { 'Content-Type': 'application/x-www-form-urlencoded', }, body: form_data, }) .then((response) => { if (response.ok) { return response.json() } else { console.error(response) throw Error(response.statusText) } }) .then((score) => { console.log(`Score from google reCaptcha ${JSON.stringify(score)}`) res.send(score) }) .catch((error) => { console.error(error) res.statusCode = 500 res.statusMessage = 'Error validating google reCaptcha' res.send(JSON.stringify(error)) }) } module.exports = { verifyRecaptcha } <|start_filename|>f2/src/forms/SuspectCluesFormSchema.js<|end_filename|> import * as Yup from 'yup' const suspectCluesFormSchema = Yup.object().shape({}) export const SuspectCluesFormSchema = () => { return suspectCluesFormSchema } <|start_filename|>f2/src/utils/winstonLoggerClient.js<|end_filename|> // Keep this logger separate from winstonLogger, this will be solely used by React client require('dotenv').config() const winston = require('winston') const { createLogger, format } = require('winston') const { combine, timestamp } = format const prettyPrint = process.env.LOGGING_PRETTY_PRINT const transports = [] const consoleTransport = new winston.transports.Console({ level: 'debug', handleExceptions: true, }) const url = new URL(window.location.href) const httpTransport = new winston.transports.Http({ host: url.hostname, port: url.port, ssl: url.protocol === 'http:' ? false : true, path: '/client-logger', }) transports.push(consoleTransport) transports.push(httpTransport) const getLogger = (fileName) => { return createLogger({ transports: transports, format: combine( timestamp(), prettyPrint ? format.prettyPrint() : format.json(), ), exitOnError: false, }) } module.exports = { getLogger } <|start_filename|>f2/.storybook/themeDecorator.js<|end_filename|> import React from 'react' import { ThemeProvider, CSSReset, Box } from '@chakra-ui/core' import theme from '../src/theme/canada' import { Global, css } from '@emotion/core' import { MemoryRouter } from 'react-router-dom' import { I18nProvider } from '@lingui/react' import { i18n } from '@lingui/core' import { activate } from '../src/i18n.config' import { StateProvider, initialState, reducer } from '../src/utils/state' import 'bootstrap/dist/css/bootstrap.min.css' import '../src/theme/style.css' const ThemeDecorator = (storyFn) => { activate('en') return ( <MemoryRouter> <StateProvider initialState={initialState} reducer={reducer}> <I18nProvider i18n={i18n}> <ThemeProvider theme={theme}> <CSSReset /> <Global styles={css` @import url('https://fonts.googleapis.com/css?family=Noto+Sans:400,400i,700,700i&display=swap'); `} /> {storyFn()} </ThemeProvider> </I18nProvider> </StateProvider> </MemoryRouter> ) } export default ThemeDecorator <|start_filename|>f2/src/components/list-item/presets.js<|end_filename|> import React from 'react' import { ListItem } from '@chakra-ui/core' import PropTypes from 'prop-types' export const Li = (props) => ( <ListItem fontSize={['lg', null, 'xl', null]} lineHeight={1.25} mb={4} fontFamily="body" color="black" {...props} > {props.children} </ListItem> ) Li.propTypes = { children: PropTypes.any, } <|start_filename|>f2/src/utils/yupSchema.js<|end_filename|> import React from 'react' import * as Yup from 'yup' import { regexDef } from './regex' import { Trans } from '@lingui/macro' export const yupSchema = () => { return { phoneSchema: Yup.string() .transform((value) => value.replace(/[\s()+-.]|ext/gi, '')) .matches(/\d/) .trim() .matches(regexDef().internationalPhonenumberRegex, { excludeEmptyString: true, message: 'Please enter a valid phone number', }), emailSchema: Yup.string().email( <Trans id="contactinfoForm.email.warning" />, ), postalCodeSchema: Yup.string().matches(regexDef().postalCodeRegex, { message: <Trans id="locationInfoForm.Warning" />, }), phoneExtensionSchema: Yup.string().matches(regexDef().phoneExtensionRegex, { excludeEmptyString: true, message: 'Please enter a valid phone extension number', }), dateSchema: { DAY: Yup.number().min(1).max(31), MONTH: Yup.number().min(1).max(12), YEAR: Yup.number().min(1000).max(9999), }, } } <|start_filename|>f2/src/useLog.js<|end_filename|> import { useEffect } from 'react' import { useStateValue } from './utils/state' const { getLogger } = require('./utils/winstonLoggerClient') const logger = getLogger(__filename) export const useLog = (page) => { const [state] = useStateValue() useEffect(() => { let startDate = new Date() return () => { const timeSinceLoad = (new Date().getTime() - startDate.getTime()) / 1000 logger.info({ sessionId: state.sessionId, message: 'PageViewTime', page: page, viewTime: timeSinceLoad, }) } // eslint-disable-next-line react-hooks/exhaustive-deps }, []) } <|start_filename|>f2/src/utils/checkIfAvailable.js<|end_filename|> require('dotenv').config() const { getLogger } = require('./winstonLogger') const { getReportCount } = require('./saveRecord') const submissionsPerDay = process.env.SUBMISSIONS_PER_DAY const secondsBetweenRequests = process.env.SECONDS_BETWEEN_REQUESTS const checkReferer = process.env.CHECK_REFERER const logger = getLogger(__filename) const allowedReferrers = [ 'antifraudcentre-centreantifraude.ca', 'centreantifraude-antifraudcentre.ca', 'antifraudcentre.ca', 'centreantifraude.ca', ] let availableData = { numberOfSubmissions: 0, numberOfRequests: 0, lastRequested: undefined, } if (!submissionsPerDay || !secondsBetweenRequests) { logger.error({ message: 'SUBMISSIONS_PER_DAY or SECONDS_BETWEEN_REQUESTS not configured.' + 'The Server will constantly report unavailable as a result.', SUBMISSIONS_PER_DAY: `${submissionsPerDay}`, SECONDS_BETWEEN_REQUESTS: `${secondsBetweenRequests}`, }) } const updateAvailableData = async () => { await getReportCount(availableData) } const getAvailableData = () => { return availableData } const isAvailable = () => { try { /* If submissions per day or seconds between requests have not been set, or we have reach the maximum number of submissions, the app is not available. */ if (!submissionsPerDay || !secondsBetweenRequests) { return false } if (availableData.numberOfSubmissions >= submissionsPerDay) { return false } //If we do not have a record of the last request, the app is available. if (!availableData.lastRequested) { return true } else { const currentTime = new Date() const lastRequested = new Date(availableData.lastRequested.getTime()) const timeSinceLastRequest = currentTime - lastRequested //If the last request was not received today the app is available. if ( currentTime.setHours(0, 0, 0, 0) !== lastRequested.setHours(0, 0, 0, 0) ) { availableData.numberOfSubmissions = 0 return true } //If enough time has elepsed since the last request, the app is available. if (timeSinceLastRequest > secondsBetweenRequests * 1000) return true } } catch (error) { logger.error({ message: `ERROR in isAvailable: ${error}` }) } return false } const requestAccess = (referer) => { try { updateAvailableData() var validReferer = false //Only check referer if the environment variable is set if (checkReferer) { validReferer = referer ? allowedReferrers.includes(new URL(referer).host.toLowerCase()) : referer } else { validReferer = true } var maxSubmissions = availableData.numberOfSubmissions >= submissionsPerDay var availabilityCheck = { SUBMISSIONS_PER_DAY: submissionsPerDay, NUMBER_OF_SUBMISSIONS: availableData.numberOfSubmissions, MAX_SUBMISSIONS: maxSubmissions, CHECK_REFERER: checkReferer, REFERER: referer, VALID_REFERER: validReferer, } logger.info({ message: 'Availability Check', availabilityCheck: availabilityCheck, }) /* If referer is not on the approved list or we have reached maximum number of submissions, the app is not available. */ if (maxSubmissions || !validReferer) { return false } else { availableData.numberOfRequests += 1 availableData.lastRequested = new Date() logger.info({ message: 'Request Access Complete', availableData: availableData, }) return true } } catch (error) { logger.error({ message: `ERROR in requestAccess: ${error}` }) return false } } const incrementSubmissions = () => { availableData.numberOfSubmissions++ } updateAvailableData() module.exports = { isAvailable, requestAccess, incrementSubmissions, getAvailableData, } <|start_filename|>f2/src/utils/generateSessionId.js<|end_filename|> const generate = require('nanoid/generate') module.exports = { generateSessionId() { const alphabet = '0123456789abcdefghkmnpqrstwxyz' const length = 11 return 'JSESSION-' + generate(alphabet, length) }, } <|start_filename|>f2/cypress/integration/virus-upload/virus-upload.js<|end_filename|> import { When, Given, Then } from 'cypress-cucumber-preprocessor/steps' Given('I open the report home page', () => { cy.visit(Cypress.env('staging')) }) When('I click on create a report button', () => { cy.contains('Report now').first().click({ force: true }) }) When('I read before you start instructions', () => { cy.contains('Start report').first().click({ force: true }) }) When('I click continue without checking consent', () => { cy.contains('Continue').first().click({ force: true }) }) When('{string} should be shown', (content) => { cy.contains(content, { timeout: 10000 }).should('be.visible') }) When('I check the consent checkbox', () => { cy.get('form').find('[name="consentOptions"]').check({ force: true }) cy.contains('Continue').first().click({ force: true }) }) Then('{string} should be shown', (content) => { cy.contains(content, { timeout: 10000 }).should('be.visible') }) When('I navigate to howdiditstart page and click continue', () => { cy.get('form').find('[value="howManyTimes.once"]').check({ force: true }) cy.contains('Continue').first().click({ force: true }) }) When('I navigate to Whatcouldbeaffected page and click continue', () => { cy.get('form') .find('[value="whatWasAffectedForm.other"]') .check({ force: true }) cy.contains('Continue').first().click({ force: true }) }) When('I navigate to Whathappened page and click continue', () => { cy.contains('Continue').first().click({ force: true }) }) When('I navigate to Addsuspectclues page and click continue', () => { cy.contains('Continue').first().click({ force: true }) }) When('upload the virus file', () => { const virusFile = 'scan.txt' cy.get('#uploader').uploadFile(virusFile, 'txt') cy.wait(1000) cy.contains('Continue').first().click({ force: true }) }) When('I navigate to yourLocation page and click continue', () => { cy.contains('Continue').first().click({ force: true }) }) When('I navigate to yourContactDetails page and click continue', () => { cy.contains('Continue').first().click({ force: true }) }) When('I navigate to summary page and click Submit', () => { cy.contains('Submit report').first().click({ force: true }) }) <|start_filename|>f2/cypress/integration/common/WhoAreYouReporting_page.js<|end_filename|> import { When } from 'cypress-cucumber-preprocessor/steps' // In English When('I fill WhoAreYouReportingMyself page forms', () => { cy.get('form') .find('[value="whoAreYouReportForPage.options.myself"]') .check({ force: true }) }) When('I fill WhoAreYouReportingSomeOne page forms', () => { cy.get('form') .find('[value="whoAreYouReportForPage.options.someone"]') .check({ force: true }) cy.get('form') .find('[name="someoneDescription"]') .type('I am reporting for my friend and her name is <NAME>') }) When('I fill WhoAreYouReportingBusiness page forms', () => { cy.get('form') .find('[value="whoAreYouReportForPage.options.business"]') .check({ force: true }) cy.get('form') .find('[name="businessDescription"]') .type('Bed Bath & Beyond, https://bedbathandbeyond.ca/ ,613-823-4262') }) // In french When('I fill WhoAreYouReportingSomeOne in French page forms', () => { cy.get('form') .find('[value="whoAreYouReportForPage.options.someone"]') .check({ force: true }) cy.get('form') .find('[name="someoneDescription"]') .type('Je fais un reportage pour mon amie et son nom est <NAME>') }) When('I fill WhoAreYouReportingBusiness in French page forms', () => { cy.get('form') .find('[value="whoAreYouReportForPage.options.business"]') .check({ force: true }) cy.get('form') .find('[name="businessDescription"]') .type( 'Cromwell Management Inc, 3488 Chemin de la Côte-des-Neiges, Montréal, Quebec +1 514-844-7275', ) }) <|start_filename|>f2/src/components/EditButton/index.js<|end_filename|> import React from 'react' import PropTypes from 'prop-types' import { Trans } from '@lingui/macro' import { useLingui } from '@lingui/react' import { Link } from '../link' import { useStateValue } from '../../utils/state' export const EditButton = ({ path, label }) => { const { i18n } = useLingui() const [{ submitted }] = useStateValue() return submitted ? null : ( <Link to={path} aria-label={i18n._(label)} ml={4}> <Trans id="button.edit" /> </Link> ) } EditButton.propTypes = { path: PropTypes.string.isRequired, label: PropTypes.string.isRequired, } <|start_filename|>f2/src/Covid19Page.js<|end_filename|> import React from 'react' import { useLingui } from '@lingui/react' import { Trans } from '@lingui/macro' import { H1, H2 } from './components/header' import { P, Lead } from './components/paragraph' import { Layout } from './components/layout' import { Icon, Stack } from '@chakra-ui/core' import { Page } from './components/Page' import { Ul } from './components/unordered-list' import { Li } from './components/list-item' import { ButtonLink, A } from './components/link' import { Well } from './components/Messages' import { Link } from './components/link' import { BackButton } from './components/backbutton' import { LandingBox } from './components/container' import { useStateValue } from './utils/state' import { Route } from 'react-router-dom' import { useLog } from './useLog' export const Covid19Page = () => { const [state, dispatch] = useStateValue() const { i18n } = useLingui() const { fyiForm } = state.formData useLog('Covid19Page') return ( <Route render={({ history }) => ( <Page> <Layout columns={{ base: 4 / 4, md: 6 / 8, lg: 7 / 12 }}> <Stack spacing={20}> <BackButton /> <H1> <Trans id="covid19.title" /> </H1> <Lead> <Trans id="covid19.text1"> <b /> </Trans> </Lead> <Stack spacing={4}> <H2> <Trans id="covid19.protect" /> </H2> <Ul> <Li> <Trans id="covid19.protect.list1" /> </Li> <Li> <Trans id="covid19.protect.list2" /> </Li> <Li> <Trans id="covid19.protect.list3" /> </Li> <Li> <Trans id="covid19.protect.list4" /> </Li> <Li> <Trans id="covid19.protect.list5" /> </Li> </Ul> </Stack> <Stack alignItems="flex-start"> <H2> <Trans id="landingPage.reportOnline" /> </H2> <LandingBox spacing={10} columns={{ base: 4 / 4, md: 6 / 7 }} marginLeft={'-0.5rem'} height="fit-content" > <P mb={2}> <Trans id="covid19.report" /> </P> <ButtonLink onClick={() => { if (fyiForm) { dispatch({ type: 'deleteFormData', }) } dispatch({ type: 'saveFormData', data: { fyiForm: '' }, }) }} to="/startPage" > <Trans id="landingPage.fullReport.button" /> <Icon focusable="false" ml={2} mr={-2} name="chevron-right" size="28px" /> </ButtonLink> </LandingBox> <LandingBox spacing={10} columns={{ base: 4 / 4, md: 6 / 7 }} marginLeft={'-0.5rem'} height="fit-content" > <P mb={2}> <Trans id="landingPage.fyiReport.description" /> </P> <ButtonLink onClick={() => { if (!fyiForm) { dispatch({ type: 'deleteFormData', }) } dispatch({ type: 'saveFormData', data: { fyiForm: 'yes' }, }) }} to="/privacyconsent" > <Trans id="landingPage.fyiReport.button" /> <Icon focusable="false" ml={2} mr={-2} name="chevron-right" size="28px" /> </ButtonLink> </LandingBox> </Stack> <Stack spacing={4}> <H2> <Trans id="covid19.resources" /> </H2> <Ul> <Li> <Trans id="covid19.resources.list1"> <A href={ i18n.locale === 'en' ? 'https://www.antifraudcentre-centreantifraude.ca/features-vedette/2020/covid-19-eng.htm' : 'https://www.antifraudcentre-centreantifraude.ca/features-vedette/2020/covid-19-fra.htm' } isExternal /> </Trans> </Li> <Li> <Trans id="covid19.resources.list2"> <A href={ i18n.locale === 'en' ? 'https://cyber.gc.ca/en/guidance/cyber-hygiene-covid-19' : 'https://cyber.gc.ca/fr/orientation/pratiques-exemplaires-en-cybersecurite-pour-la-covid-19' } isExternal /> </Trans> </Li> </Ul> </Stack> </Stack> </Layout> </Page> )} /> ) } export const CovidWell = (props) => { return ( <Layout mb={10} columns={{ base: 4 / 4, lg: 9 / 12, xl: 7 / 12 }}> <Well variantColor="yellow"> <Link to="/covid-19" color="yellow.900"> <Trans id="covid19.know" /> </Link> </Well> </Layout> ) } <|start_filename|>f2/cypress/integration/common/howwaspersonalinformationaffected_page.js<|end_filename|> import { When } from 'cypress-cucumber-preprocessor/steps' When('I fill Howwaspersonalinformationaffected forms', () => { cy.get('form') .find('[value="typeOfInfoReq.creditCard"]') .check({ force: true }) cy.get('form').find('[value="typeOfInfoReq.dob"]').check({ force: true }) cy.get('form') .find('[value="typeOfInfoReq.homeAddress"]') .check({ force: true }) cy.get('form').find('[value="typeOfInfoReq.sin"]').check({ force: true }) cy.get('form').find('[value="typeOfInfoReq.other"]').check({ force: true }) cy.get('form').find('[name="infoReqOther"]').type('Passport') cy.get('form') .find('[value="typeOfInfoObtained.creditCard"]') .check({ force: true }) cy.get('form').find('[value="typeOfInfoObtained.dob"]').check({ force: true }) cy.get('form') .find('[value="typeOfInfoObtained.homeAddress"]') .check({ force: true }) cy.get('form').find('[value="typeOfInfoObtained.sin"]').check({ force: true }) cy.get('form') .find('[value="typeOfInfoObtained.other"]') .check({ force: true }) cy.get('form').find('[name="infoObtainedOther"]').type('Passport') }) When('I fill Howwaspersonalinformationaffected123 forms', () => { cy.get('form') .find('[value="typeOfInfoReq.creditCard"]') .check({ force: true }) cy.get('form').find('[value="typeOfInfoReq.dob"]').check({ force: true }) cy.get('form') .find('[value="typeOfInfoReq.homeAddress"]') .check({ force: true }) cy.get('form') .find('[value="typeOfInfoObtained.creditCard"]') .check({ force: true }) }) When('I fill Howwaspersonalinformationaffected45 forms', () => { cy.get('form').find('[value="typeOfInfoReq.sin"]').check({ force: true }) cy.get('form').find('[value="typeOfInfoReq.other"]').check({ force: true }) cy.get('form').find('[name="infoReqOther"]').type('Passport') cy.get('form').find('[value="typeOfInfoObtained.sin"]').check({ force: true }) cy.get('form') .find('[value="typeOfInfoObtained.other"]') .check({ force: true }) cy.get('form').find('[name="infoObtainedOther"]').type('Passport') }) When('I fill Howwaspersonalinformationaffected23 forms', () => { cy.get('form').find('[value="typeOfInfoReq.dob"]').check({ force: true }) cy.get('form') .find('[value="typeOfInfoReq.homeAddress"]') .check({ force: true }) cy.get('form') .find('[value="typeOfInfoObtained.homeAddress"]') .check({ force: true }) }) When('I fill Howwaspersonalinformationaffected5 forms', () => { cy.get('form').find('[name="infoReqOther"]').type('Passport') cy.get('form').find('[name="infoObtainedOther"]').type('Passport') }) When('I fill NoHowwaspersonalinformationaffected forms', () => {}) <|start_filename|>f2/src/utils/__tests__/clientFieldsAreValid.test.js<|end_filename|> import { clientFieldsAreValid } from '../clientFieldsAreValid' describe('clientFieldsAreValid', () => { it('returns true if no fields', () => { const data = {} const defaults = { a: 0, b: 12, c: 4 } expect(clientFieldsAreValid(data, defaults)).toEqual(true) }) it('returns true if field is valid', () => { const data = { a: 1, b: 2 } const defaults = { a: 0, b: 12, c: 4 } expect(clientFieldsAreValid(data, defaults)).toEqual(true) }) it('returns false if a field is not valid', () => { const data = { a: 1, d: 2 } const defaults = { a: 0, b: 12, c: 4 } expect(clientFieldsAreValid(data, defaults)).toEqual(false) }) }) <|start_filename|>f2/src/WhatWasAffected.js<|end_filename|> import { Route } from 'react-router-dom' import React from 'react' import { Trans } from '@lingui/macro' import { H1 } from './components/header' import { Lead } from './components/paragraph' import { Layout } from './components/layout' import { WhatWasAffectedForm } from './forms/WhatWasAffectedForm' import { BackButton } from './components/backbutton' import { Stack } from '@chakra-ui/core' import { useStateValue } from './utils/state' import { nextPage, whatWasAffectedPages, orderSelection, } from './utils/nextWhatWasAffectedUrl' import { Page } from './components/Page' import { useLog } from './useLog' export const WhatWasAffectedPage = () => { const [data, dispatch] = useStateValue() const { doneForms } = data const whatWasAffectedNavState = data.whatWasAffectedOptions const originalSelection = data.formData.whatWasAffected.affectedOptions whatWasAffectedNavState.currentPage = whatWasAffectedPages.FIRST_PAGE if (doneForms) { whatWasAffectedNavState.editOptions = true } const updateSelection = (whatWasAffected) => { //Selections in order of checked, order the selections to keep page navigation consistent const orderedSelection = orderSelection(whatWasAffected) if (doneForms) { whatWasAffectedNavState.affectedOptions = orderedSelection.filter( (option) => !originalSelection.includes(option), ) } else { whatWasAffectedNavState.affectedOptions = [...orderedSelection] } //Remove Other from selections as there is no page to display. if ( whatWasAffectedNavState.affectedOptions.includes( whatWasAffectedPages.OTHER.key, ) ) { const otherIndex = whatWasAffectedNavState.affectedOptions.indexOf( whatWasAffectedPages.OTHER.key, ) whatWasAffectedNavState.affectedOptions.splice(otherIndex, 1) } whatWasAffectedNavState.nextPage = nextPage( whatWasAffectedNavState, doneForms, ) } useLog('WhatWasAffectedPage') return ( <Route render={({ history }) => ( <Page> <Layout columns={{ base: 4 / 4, md: 6 / 8, lg: 7 / 12 }}> <Stack spacing={10} shouldWrapChildren> <BackButton /> <H1> <Trans id="whatWasAffectedPage.title" /> </H1> <Lead> <Trans id="whatWasAffectedPage.intro" /> </Lead> <WhatWasAffectedForm onSubmit={(data) => { updateSelection(data.affectedOptions) dispatch({ type: 'saveFormData', data: { whatWasAffected: data }, }) history.push(whatWasAffectedNavState.nextPage.url) }} /> </Stack> </Layout> </Page> )} /> ) } <|start_filename|>f2/src/components/formik/checkboxRadio/index.js<|end_filename|> import React from 'react' import PropTypes from 'prop-types' import styled from '@emotion/styled' import { css } from '@emotion/core' import { Form } from 'react-bootstrap' import { FormRow } from '../row' import { ConditionalField } from '../conditionalField' import { cleanProps } from '../../../utils/cleanProps' const conditionalFieldStyle = (props) => { if (props.checked && props.haschildren) { return css` border-left-width: 0.25rem; border-left-color: #aeaeae; margin-left: -0.25rem; ` } } const HelpText = styled(Form.Text, { shouldForwardProp: (prop) => cleanProps(prop), })` padding-left: 1.5rem; font-size: 0.875rem; margin-bottom: -0.25rem; line-height: 1.5; margin-top: 0rem; ${conditionalFieldStyle} ` const Label = styled(Form.Check.Label, { shouldForwardProp: (prop) => cleanProps(prop), })` padding-left: 1.5rem; font-size: 1.25rem; line-height: 1.5rem; padding-top: 0.5rem; &:active { &:before { border-color: black; box-shadow: rgba(99, 179, 237, 0.6) 0px 0px 4px 1px; } } &:before { width: 2.5rem; height: 2.5rem; top: 0rem; } ${conditionalFieldStyle} ` const Input = styled(Form.Check.Input)` width: 2.5rem; height: 2.5rem; z-index: auto; ` export const CheckBoxRadio = ({ field, form, ...props }) => { const paddingBottom = props.helpText ? '0rem' : '1rem' const hasChildren = props.children ? props.children : undefined return ( <FormRow paddingBottom={paddingBottom} paddingLeft="1rem"> <Form.Check id={props.id} type={props.type} custom> <Input type={props.type} {...field} value={props.value} /> <Label haschildren={hasChildren}>{props.label}</Label> <HelpText haschildren={hasChildren}>{props.helpText}</HelpText> </Form.Check> {field.checked && hasChildren && ( <ConditionalField>{props.children}</ConditionalField> )} </FormRow> ) } CheckBoxRadio.propTypes = { type: PropTypes.oneOf(['checkbox', 'radio']), } <|start_filename|>f2/cypress/integration/common/consent_page.js<|end_filename|> import { When, And, Given } from 'cypress-cucumber-preprocessor/steps' And('I click continue without checking consent', () => { //cy.get('[data-cy=submit]').first().click({ force: true }) cy.contains('Continue').first().click({ force: true }) }) Given('{string} should be shown', (content) => { cy.contains(content, { timeout: 10000 }).should('be.visible') }) When('I check the consent checkbox', () => { cy.get('form') .find('[value="privacyConsentInfoForm.yes"]') .check({ force: true }) }) <|start_filename|>f2/cypress/integration/common/howwereyourdevicesaffected_page.js<|end_filename|> import { When } from 'cypress-cucumber-preprocessor/steps' When('I fill Howwereyourdevicesaffected page forms', () => { cy.get('form').find('[name="device"]').type('Personal Computer') cy.get('form').find('[name="account"]').type('FaceBook') }) When('I fill Howwereyourdevicesaffected1 page forms', () => { cy.get('form').find('[name="device"]').type('Personal Computer') }) When('I fill Howwereyourdevicesaffected2 page forms', () => { cy.get('form').find('[name="account"]').type('FaceBook') }) When('I fill NoHowwereyourdevicesaffected page forms', () => {}) <|start_filename|>f2/src/components/Page/index.js<|end_filename|> /** @jsx jsx */ import React from 'react' import { jsx } from '@emotion/core' import PropTypes from 'prop-types' import { MidFeedbackForm } from '../../forms/MidFeedbackForm' import { TrackPageViews } from '../../TrackPageViews' import { Layout } from '../layout' import { submitToServer } from '../../utils/submitToServer' export const Page = (props) => ( <React.Fragment> <TrackPageViews /> {props.children} <Layout mt={10} columns={{ base: 4 / 4, lg: 9 / 12, xl: 7 / 12 }}> <MidFeedbackForm onSubmit={(data) => { submitToServer(data) }} /> </Layout> </React.Fragment> ) Page.propTypes = { children: PropTypes.node, } <|start_filename|>f2/src/forms/MoneyLostInfoForm.js<|end_filename|> /** @jsx jsx */ import React from 'react' import PropTypes from 'prop-types' import { jsx } from '@emotion/core' import { Trans } from '@lingui/macro' import { Input } from '../components/formik/input' import { useStateValue } from '../utils/state' import { formDefaults } from './defaultValues' import { NextCancelButtons } from '../components/formik/button' import { Formik, FieldArray, Field } from 'formik' import { realTimeValidation, createErrorSummary, } from './MoneyLostInfoFormSchema' import { Form, Container, Row } from 'react-bootstrap' import { CheckBoxRadio } from '../components/formik/checkboxRadio' import { DatePicker } from '../components/formik/datePicker' import { ErrorText } from '../components/formik/paragraph' import { ErrorSummary } from '../components/formik/alert' import { WarningModal } from '../components/formik/warningModal' export const MoneyLostInfoForm = (props) => { const [data] = useStateValue() const errorSummary = createErrorSummary const moneyLost = { ...formDefaults.moneyLost, ...data.formData.moneyLost, } const formOptions = [ { name: 'eTransfer', value: 'methodPayment.eTransfer', checkboxLabel: <Trans id="methodPayment.eTransfer" />, }, { name: 'creditCard', value: 'methodPayment.creditCard', checkboxLabel: <Trans id="methodPayment.creditCard" />, }, { name: 'giftCard', value: 'methodPayment.giftCard', checkboxLabel: <Trans id="methodPayment.giftCard" />, }, { name: 'cryptocurrency', value: 'methodPayment.cryptocurrency', checkboxLabel: <Trans id="methodPayment.cryptocurrency" />, }, { name: 'other', value: 'methodPayment.other', checkboxLabel: <Trans id="methodPayment.other" />, }, ] return ( <React.Fragment> {false ? ( // mark ids for lingui <div> <Trans id="transactionDate.error.notDay" /> <Trans id="transactionDate.error.notMonth" /> <Trans id="transactionDate.error.isFuture" /> <Trans id="transactionDate.error.notYear" /> <Trans id="transactionDate.error.yearLength" /> <Trans id="transactionDate.error.hasNoYear" /> <Trans id="transactionDate.error.hasNoMonth" /> <Trans id="transactionDate.error.hasNoDay" /> <Trans id="moneyLostPage.financialTransactions" /> <Trans id="previousPageofMoneyLost.nextPage" /> <Trans id="previousPageofInformation.nextPage" /> <Trans id="previousPageofDevices.nextPage" /> <Trans id="previousPageofBusiness.nextPage" /> <Trans id="previousPageofWhathappened.nextPage" /> <Trans id="previousPageofConfirmation.nextPage" /> </div> ) : null} <Formik initialValues={moneyLost} validate={(values) => { return realTimeValidation(values) }} onSubmit={(values) => { props.onSubmit(values) }} > {({ handleSubmit, handleChange, handleBlur, submitCount, errors, dirty, isSubmitting, }) => ( <Form onSubmit={handleSubmit}> <WarningModal dirty={dirty} isSubmitting={isSubmitting} /> <Container> <Row className="form-question"> {Object.keys(errors).length > 0 && ( <ErrorSummary errors={errorSummary(errors)} submissions={submitCount} title={<Trans id="default.hasValidationErrors" />} /> )} </Row> <Row className="form-section"> <Field name="demandedMoney" label={<Trans id="moneyLostPage.demandedMoney" />} helpText={<Trans id="moneyLostPage.demandedMoneyExample" />} component={Input} onChange={handleChange} onBlur={handleBlur} id={'demanded-money'} /> <Field name="moneyTaken" label={<Trans id="moneyLostPage.moneyTaken" />} helpText={<Trans id="moneyLostPage.moneyTakenExample" />} component={Input} onChange={handleChange} onBlur={handleBlur} id={'money-taken'} /> </Row> <Row className="form-question" lg={1}> <Row className="form-label"> <Trans id="moneyLostPage.methodPayment" /> </Row> <Row className="form-helper-text"> <Trans id="moneyLostPage.selectMethod" /> </Row> </Row> <Row className="form-section"> <FieldArray name="methodPayment" className="form-section" render={() => formOptions.map((question) => { return ( <React.Fragment key={question.name}> <Field name="methodPayment" label={question.checkboxLabel} component={CheckBoxRadio} value={question.value} onChange={handleChange} onBlur={handleBlur} type="checkbox" id={'checkbox-' + question.name} > {question.name === 'other' && ( <Field name="methodOther" label={question.descriptionLabel} helpText={question.descriptionHelpText} component={Input} onBlur={handleBlur} onChange={handleChange} /> )} </Field> </React.Fragment> ) }) } /> </Row> <Row className="form-section"> {errors && errors.transaction && ( <ErrorText> <Trans id="moneyLostPage.transactionDateErrorSummaryMessage" /> </ErrorText> )} <Field name="transaction" label={<Trans id="moneyLostPage.transactionDate" />} helpText={<Trans id="moneyLostPage.transactionDateExample" />} component={DatePicker} onBlur={handleBlur} onChange={handleChange} id="transaction" /> </Row> <Row> <NextCancelButtons submit={<Trans id="businessInfoPage.nextButton" />} cancel={<Trans id="button.cancelReport" />} label={<Trans id={props.nextpageText} />} /> </Row> </Container> </Form> )} </Formik> </React.Fragment> ) } MoneyLostInfoForm.propTypes = { onSubmit: PropTypes.func.isRequired, } <|start_filename|>f2/src/components/file-upload/__tests__/FileUpload.test.js<|end_filename|> import React from 'react' import { ThemeProvider } from 'emotion-theming' import theme from '../../../theme' import { render, cleanup, fireEvent } from '@testing-library/react' import { FileUpload } from '../' describe('<FileUpload />', () => { afterEach(cleanup) it('renders', () => { const onChange = jest.fn() const { getAllByText } = render( <form> <ThemeProvider theme={theme}> <FileUpload onChange={onChange}>foo</FileUpload> </ThemeProvider> </form>, ) const test = getAllByText(/foo/) expect(test).toHaveLength(1) }) test('chooses a file', async () => { const onChange = jest.fn() const file = new File(['test'], 'testfile') const { getByLabelText } = render( <form> <ThemeProvider theme={theme}> <FileUpload onChange={onChange}>Upload File</FileUpload> </ThemeProvider> </form>, ) const formElement = getByLabelText('Upload File') Object.defineProperty(formElement, 'files', { value: [file] }) fireEvent.change(formElement) expect(onChange).toBeCalled() }) }) <|start_filename|>f2/src/PrivacyStatementPage.js<|end_filename|> import React from 'react' import { Trans } from '@lingui/macro' import { H1, H2 } from './components/header' import { P } from './components/paragraph' import { Layout } from './components/layout' import { Stack } from '@chakra-ui/core' import { A } from './components/link' import { useLingui } from '@lingui/react' import { Page } from './components/Page' import { useLog } from './useLog' export const PrivacyStatementPage = () => { const { i18n } = useLingui() // eslint-disable-line no-unused-vars useLog('PrivacyStatementPage') return ( <Page> <Layout columns={{ base: 4 / 4, md: 6 / 8, lg: 7 / 12 }}> <Stack spacing={20}> <H1> <Trans id="privacyStatementPage.title" /> </H1> <Stack spacing={4}> <H2> <Trans id="privacyStatementPage.whoHeading" /> </H2> <P> <Trans id="privacyStatementPage.whoText1"> <A href={ i18n.locale === 'en' ? 'http://www.rcmp-grc.gc.ca/en/nc3' : 'http://www.rcmp-grc.gc.ca/fr/gnc3' } isExternal /> <A href={ i18n.locale === 'en' ? 'http://www.antifraudcentre-centreantifraude.ca/index-eng.htm' : 'http://www.antifraudcentre-centreantifraude.ca/index-fra.htm' } isExternal /> </Trans> </P> <P> <Trans id="privacyStatementPage.whoText2"> <A href={ i18n.locale === 'en' ? 'http://www.rcmp-grc.gc.ca/en/home' : 'http://www.rcmp-grc.gc.ca/fr/accueil' } isExternal /> <A href={ i18n.locale === 'en' ? 'https://www.cyber.gc.ca/en/' : 'https://www.cyber.gc.ca/fr/' } isExternal /> </Trans> </P> </Stack> <Stack spacing={4}> <H2> <Trans id="privacyStatementPage.whathappensHeading" /> </H2> <P> <Trans id="privacyStatementPage.whathappensText" /> </P> </Stack> <Stack spacing={4}> <H2> <Trans id="privacyStatementPage.informationHeading" /> </H2> <P> <Trans id="privacyStatementPage.informationText1"> <A href={ i18n.locale === 'en' ? 'https://www.rcmp-grc.gc.ca/atip-aiprp/infosource/pib-frp-eng.htm#ppu005' : 'https://www.rcmp-grc.gc.ca/atip-aiprp/infosource/pib-frp-fra.htm#ppu005' } isExternal /> </Trans> </P> <P> <Trans id="privacyStatementPage.informationText2"> <A href={ i18n.locale === 'en' ? 'https://digital.canada.ca' : 'https://numerique.canada.ca' } isExternal /> </Trans> </P> </Stack> <Stack spacing={4}> <H2> <Trans id="privacyStatementPage.authorizationHeading" /> </H2> <P> <Trans id="privacyStatementPage.authorizationText1" /> </P> </Stack> <Stack spacing={4}> <H2> <Trans id="privacyStatementPage.webAnalyticsHeading" /> </H2> <P> <Trans id="privacyStatementPage.webAnalyticsText1" /> </P> <P> <Trans id="privacyStatementPage.webAnalyticsText2"> <A href={ i18n.locale === 'en' ? 'https://www.rcmp-grc.gc.ca/en/terms-conditions' : 'https://www.rcmp-grc.gc.ca/fr/avis' } isExternal /> </Trans> </P> </Stack> <Stack spacing={4}> <H2> <Trans id="privacyStatementPage.toinquireHeading" /> </H2> <P> <Trans id="privacyStatementPage.toinquireText1" /> <A href={ 'tel:' + i18n._('privacyStatementPage.toinquireText1.phoneNumber') } > <Trans id="privacyStatementPage.toinquireText1.phoneNumber" /> </A> <Trans id="privacyStatementPage.toinquireText1.lastPeriod" /> </P> <P> <Trans id="privacyStatementPage.toinquireText2"> <A href="mailto:<EMAIL>" isExternal /> </Trans> <A href={ 'tel:' + i18n._('privacyStatementPage.toinquireText2.phoneNumber1') } > <Trans id="privacyStatementPage.toinquireText2.phoneNumber1" /> </A> <Trans id="privacyStatementPage.toinquireText2.or"></Trans> <A href={ 'tel:' + i18n._('privacyStatementPage.toinquireText2.phoneNumber2') } > <Trans id="privacyStatementPage.toinquireText2.phoneNumber2" /> </A> <Trans id="privacyStatementPage.toinquireText2.lastPeriod" /> </P> <P> <Trans id="privacyStatementPage.toinquireText3"> <A href="mailto:<EMAIL>" isExternal /> </Trans> <A href={ 'tel:' + i18n._('privacyStatementPage.toinquireText3.phoneNumber') } > <Trans id="privacyStatementPage.toinquireText3.phoneNumber" /> </A> <Trans id="privacyStatementPage.toinquireText3.lastPeriod" /> </P> </Stack> </Stack> </Layout> </Page> ) } <|start_filename|>f2/src/forms/defaultValues.js<|end_filename|> const formDefaults = { sessionId: '', language: '', prodVersion: '', appVersion: '', consent: { consentOptions: [] }, anonymous: { anonymousOptions: [] }, whoAreYouReportFor: { whoYouReportFor: '', someoneDescription: '', businessDescription: '', }, howdiditstart: { howDidTheyReachYou: [], email: '', phone: '', online: '', application: '', others: '', }, whenDidItHappen: { incidentFrequency: '', startDay: '', startMonth: '', startYear: '', endDay: '', endMonth: '', endYear: '', happenedOnceDay: '', happenedOnceMonth: '', happenedOnceYear: '', description: '', }, whatWasAffected: { affectedOptions: [], }, moneyLost: { demandedMoney: '', moneyTaken: '', methodPayment: [], transactionDay: '', transactionMonth: '', transactionYear: '', methodOther: '', }, personalInformation: { typeOfInfoReq: [], typeOfInfoObtained: [], infoReqOther: '', infoObtainedOther: '', }, devicesInfo: { device: '', account: '' }, businessInfo: { nameOfBusiness: '', industry: '', role: '', numberOfEmployee: '', }, whatHappened: { whatHappened: '' }, suspectClues: { suspectClues1: '', suspectClues2: '', suspectClues3: '', }, evidence: { files: [], fileDescriptions: [], }, location: { postalCode: '', city: '', province: '' }, contactInfo: { fullName: '', email: '', phone: '', extension: '' }, fyiForm: '', } module.exports = { formDefaults } <|start_filename|>f2/cypress/integration/common/anonymous_page.js<|end_filename|> import { When } from 'cypress-cucumber-preprocessor/steps' When('I fill ReportAnonymously page forms', () => { cy.get('form').find('[value="anonymousPage.yes"]').check({ force: true }) }) When('I fill NoReportAnonymously page forms', () => { //cy.get('form').find('[value="anonymousPage.no"]').check({ force: true }) }) <|start_filename|>f2/src/summary/WhoAreYouReportForSummary.js<|end_filename|> /** @jsx jsx */ import React from 'react' import { jsx } from '@emotion/core' import { Trans } from '@lingui/macro' import { Stack, Flex } from '@chakra-ui/core' import { useStateValue } from '../utils/state' import { containsData } from '../utils/containsData' import { testdata } from '../ConfirmationSummary' import { EditButton } from '../components/EditButton' import { H2 } from '../components/header' import { Text } from '../components/text' import { DescriptionListItem } from '../components/DescriptionListItem' export const WhoAreYouReportForSummary = (props) => { const [data] = useStateValue() const whoAreYouReportFor = { ...testdata.formData.whoAreYouReportFor, ...data.formData.whoAreYouReportFor, } let whoYouReportForString if ( whoAreYouReportFor.whoYouReportFor === 'whoAreYouReportForPage.options.myself' ) { whoYouReportForString = <Trans id="whoAreYouReportForPage.options.myself" /> } else if ( whoAreYouReportFor.whoYouReportFor === 'whoAreYouReportForPage.options.someone' ) { whoYouReportForString = ( <Trans id="whoAreYouReportForPage.options.someone" /> ) } else { whoYouReportForString = ( <Trans id="whoAreYouReportForPage.options.business" /> ) } return ( <React.Fragment> {false ? ( <div> {/*: mark the proper ids for lingui */} <Trans id="confirmationPage.whoAreYouReportFor.title.edit" /> <Trans id="whoAreYouReportForPage.details" /> <Trans id="confirmationPage.youAreReportingFor" /> </div> ) : null} <Stack spacing={4} borderBottom="2px" borderColor="gray.300" pb={4} {...props} > <Flex align="baseline"> <H2 fontWeight="normal"> <Trans id="whoAreYouReportForPage.title" /> </H2> <EditButton path="/whoAreYouReportFor" label="confirmationPage.whoAreYouReportFor.title.edit" /> </Flex> {containsData(whoAreYouReportFor) ? ( <React.Fragment> <Stack as="dl" spacing={4}> <DescriptionListItem descriptionTitle="confirmationPage.youAreReportingFor" description={whoYouReportForString} /> {containsData(whoAreYouReportFor.someoneDescription) ? ( <DescriptionListItem descriptionTitle="whoAreYouReportForPage.details" description={whoAreYouReportFor.someoneDescription} /> ) : null} {containsData(whoAreYouReportFor.businessDescription) ? ( <DescriptionListItem descriptionTitle="whoAreYouReportForPage.details" description={whoAreYouReportFor.businessDescription} /> ) : null} </Stack> </React.Fragment> ) : ( <Text> <Trans id="confirmationPage.whoAreYouReportFor.nag" /> </Text> )} </Stack> </React.Fragment> ) } <|start_filename|>f2/src/forms/HowDidItStartForm.js<|end_filename|> import React from 'react' import { Trans } from '@lingui/macro' import { useStateValue } from '../utils/state' import { Form, Container, Row } from 'react-bootstrap' import { Formik, FieldArray, Field, ErrorMessage } from 'formik' import { CheckBoxRadio } from '../components/formik/checkboxRadio' import { TextArea } from '../components/formik/textArea' import { NextCancelButtons } from '../components/formik/button' import { Error, Info } from '../components/formik/alert' import { WarningModal } from '../components/formik/warningModal' export const HowDidItStartForm = (props) => { const [data] = useStateValue() const howDidItStart = { ...data.formData.howdiditstart, } const formOptions = [ { name: 'email', checkboxLabel: <Trans id="howDidTheyReachYou.email" />, checkboxName: 'howDidTheyReachYou.email', questionLabel: <Trans id="howDidTheyReachYouLabel.question1" />, helpText: <Trans id="howDidTheyReachYouLabel.hint1" />, }, { name: 'phone', checkboxLabel: <Trans id="howDidTheyReachYou.phone" />, checkboxName: 'howDidTheyReachYou.phone', questionLabel: <Trans id="howDidTheyReachYouLabel.question2" />, helpText: <Trans id="howDidTheyReachYouLabel.hint2" />, }, { name: 'online', checkboxLabel: <Trans id="howDidTheyReachYou.online" />, checkboxName: 'howDidTheyReachYou.online', questionLabel: <Trans id="howDidTheyReachYouLabel.question3" />, helpText: <Trans id="howDidTheyReachYouLabel.hint3" />, }, { name: 'application', checkboxLabel: <Trans id="howDidTheyReachYou.app" />, checkboxName: 'howDidTheyReachYou.app', questionLabel: <Trans id="howDidTheyReachYouLabel.question4" />, helpText: <Trans id="howDidTheyReachYouLabel.hint4" />, }, { name: 'others', checkboxLabel: <Trans id="howDidTheyReachYou.others" />, checkboxName: 'howDidTheyReachYou.others', questionLabel: <Trans id="howDidTheyReachYouLabel.question5" />, helpText: <Trans id="howDidTheyReachYouLabel.hint5" />, }, ] return ( <React.Fragment> <Formik initialValues={howDidItStart} onSubmit={(values) => { formOptions.forEach((question) => { if (!values.howDidTheyReachYou.includes(question.checkboxName)) { values[question.name] = '' } }) props.onSubmit(values) }} > {({ handleSubmit, handleChange, handleBlur, dirty, isSubmitting }) => ( <Form onSubmit={handleSubmit}> <WarningModal dirty={dirty} isSubmitting={isSubmitting} /> <Container> <Row className="form-question"> <Row className="form-label"> <Trans id="howDidTheyReachYou.question" /> </Row> <Row className="form-helper-text"> <Trans id="howDidTheyReachYou.reminder" /> </Row> <ErrorMessage name="howDidTheyReachYou" component={Error} /> </Row> <Row className="form-section"> <FieldArray name="howDidTheyReachYou" className="form-section" render={() => formOptions.map((question) => { return ( <React.Fragment key={question.name}> <Field name="howDidTheyReachYou" label={question.checkboxLabel} component={CheckBoxRadio} value={question.checkboxName} onChange={handleChange} onBlur={handleBlur} type="checkbox" id={'checkbox-' + question.name} > <ErrorMessage name={question.name} component={Error} /> <Field className="conditional-field" name={question.name} label={question.questionLabel} helpText={question.helpText} component={TextArea} onBlur={handleBlur} onChange={handleChange} id={'text-' + question.name} /> </Field> </React.Fragment> ) }) } /> </Row> <Row className="form-section"> <Info> <Trans id="howDidItStartPage.tip" /> </Info> </Row> <Row> <NextCancelButtons submit={<Trans id="howDidItStartPage.nextButton" />} cancel={<Trans id="button.cancelReport" />} label={<Trans id="howDidItStartPage.nextPage" />} /> </Row> </Container> </Form> )} </Formik> </React.Fragment> ) } <|start_filename|>f2/cypress/integration/common/attachsupportingevidence_page.js<|end_filename|> import { When } from 'cypress-cucumber-preprocessor/steps' When('I fill AttachSupportingEvidence page forms', () => { const fileName1 = 'fake.jpg' const fileName2 = 'fake.jpg' const fileName3 = 'GithubDesktopDocumentation forInstallation_Tutorial.docx' cy.get('#uploader').uploadFile(fileName1, 'image/jpeg') cy.wait(1000) cy.get('#uploader').uploadFile(fileName2, 'image/jpeg') cy.wait(1000) cy.get('#uploader').uploadFile( fileName3, 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', ) cy.wait(1000) }) When('I fill AttachSupportingEvidenceSensitive page forms', () => { const fileName1 = 'girl.jpg' const fileName2 = 'gun-picture.jpg' const fileName3 = 'CJIM_5.9_UFS_Option_Analysis_DRAFT.xlsx' cy.get('#uploader').uploadFile(fileName1, 'image/jpeg') cy.wait(1000) cy.get('#uploader').uploadFile(fileName2, 'image/jpeg') cy.wait(1000) cy.get('#uploader').uploadFile( fileName3, 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', ) cy.wait(1000) }) <|start_filename|>f2/cypress/integration/common/addsuspectclues_page_fr.js<|end_filename|> import { When } from 'cypress-cucumber-preprocessor/steps' When('I fill Addsuspectclues in French page forms', () => { cy.get('form').find('[name="suspectClues1"]').type('Nom du suspect') cy.get('form').find('[name="suspectClues2"]').type('Adresse du suspect') cy.get('form') .find('[name="suspectClues3"]') .type('Détail qui pourrait aider à identifier le suspect') }) When('I fill Addsuspectclues3 in French page forms', () => { cy.get('form') .find('[name="suspectClues3"]') .type('Détail qui pourrait aider à identifier le suspect') }) When('I fill Addsuspectclues1and2 in French page forms', () => { cy.get('form').find('[name="suspectClues1"]').type('Nom du suspect') cy.get('form').find('[name="suspectClues2"]').type('Adresse du suspect') }) <|start_filename|>f2/src/utils/__tests__/serverFieldsAreValid.test.js<|end_filename|> import { serverFieldsAreValid } from '../serverFieldsAreValid' const { formDefaults } = require('../../forms/defaultValues') const flatten = require('flat') console.warn = jest.fn() // surpress warning messages describe('serverFieldsAreValid', () => { it('passes valid fields', () => { const requiredFields = flatten(formDefaults, { safe: true }) expect(serverFieldsAreValid(requiredFields)).toEqual(true) }) it('fails if there are extra fields', () => { let requiredFields = flatten(formDefaults, { safe: true }) requiredFields.extraTestField = 'extra' expect(serverFieldsAreValid(requiredFields)).toEqual(false) }) it('fails if there is a missing field', () => { let requiredFields = flatten(formDefaults, { safe: true }) delete requiredFields['consent.consentOptions'] expect(serverFieldsAreValid(requiredFields)).toEqual(false) }) it('fails if an expected field has the wrong type', () => { let requiredFields = flatten(formDefaults, { safe: true }) requiredFields['consent.consentOptions'] = 'string' expect(serverFieldsAreValid(requiredFields)).toEqual(false) }) }) <|start_filename|>f2/src/FinalFeedbackPage.js<|end_filename|> /** @jsx jsx */ import { jsx } from '@emotion/core' import { Route } from 'react-router-dom' import fetch from 'isomorphic-fetch' import { Trans } from '@lingui/macro' import { H1 } from './components/header' import { TrackPageViews } from './TrackPageViews' import { Layout } from './components/layout' import { FinalFeedbackForm } from './forms/FinalFeedbackForm' import { Stack } from '@chakra-ui/core' import { useStateValue } from './utils/state' import { useLog } from './useLog' async function postData(url = '', data = {}) { var form_data = new FormData() form_data.append('json', JSON.stringify(data)) // Default options are marked with * const response = await fetch(url, { method: 'POST', mode: 'cors', cache: 'no-cache', credentials: 'same-origin', redirect: 'follow', referrer: 'no-referrer', body: form_data, }) return await response } const submitToServer = async (data) => { console.log('Submitting finalFeedback:', data) await postData('/submitFeedback', data) } export const FinalFeedbackPage = () => { const [state, setState] = useStateValue() useLog('FinalFeedbackPage') return ( <Route render={({ history }) => ( <Layout columns={{ base: 4 / 4, md: 6 / 8, lg: 7 / 12 }}> <TrackPageViews /> <Stack spacing={10} shouldWrapChildren> <H1> <Trans id="finalFeedback.title" /> </H1> <FinalFeedbackForm onSubmit={(data) => { submitToServer(data) setState((state.doneFinalFeedback = true)) history.push('/finalfeedbackthanks') }} /> </Stack> </Layout> )} /> ) } <|start_filename|>f2/src/components/input/index.js<|end_filename|> /** @jsx jsx **/ import { jsx } from '@emotion/core' import { Input as ChakraInput } from '@chakra-ui/core' import canada from '../../theme/canada' export const Input = (props) => ( <ChakraInput onKeyPress={(e) => { e.key === 'Enter' && e.preventDefault() }} autoComplete="off" {...canada.variants.inputs.inputs} {...props.input} {...props} /> ) <|start_filename|>f2/src/pdf/WhenDidItHappenView.js<|end_filename|> /** @jsx jsx */ import { jsx } from '@emotion/core' import { containsData } from '../utils/containsData' import { testdata } from '../ConfirmationSummary' import { Text, View, Image } from '@react-pdf/renderer' import { pdfStyles } from './pdfStyles' import { DescriptionItemView } from './DescriptionItemView' import { formatDate } from '../utils/formatDate' import line from '../images/line.png' export const WhenDidItHappenView = (props) => { const lang = props.lang const whenDidItHappen = { ...testdata.formData.whenDidItHappen, ...props.data.formData.whenDidItHappen, } let freqString if (whenDidItHappen.incidentFrequency === 'once') { freqString = lang['whenDidItHappenPage.options.once'] } else if (whenDidItHappen.incidentFrequency === 'moreThanOnce') { freqString = lang['whenDidItHappenPage.options.moreThanOnce'] } else { freqString = lang['whenDidItHappenPage.options.notSure'] } return ( <View style={pdfStyles.section}> <Text style={pdfStyles.title}>{lang['whenDidItHappenPage.title']}</Text> {containsData(whenDidItHappen) ? ( <View> <DescriptionItemView title="confirmationPage.howManyTimes" description={freqString} lang={lang} /> <DescriptionItemView title="whenDidItHappenPage.singleDate.label" description={formatDate( whenDidItHappen.happenedOnceDay, whenDidItHappen.happenedOnceMonth, whenDidItHappen.happenedOnceYear, )} lang={lang} /> <DescriptionItemView title="whenDidItHappenPage.dateRange.start.label" description={formatDate( whenDidItHappen.startDay, whenDidItHappen.startMonth, whenDidItHappen.startYear, )} lang={lang} /> <DescriptionItemView title="whenDidItHappenPage.dateRange.end.label" description={formatDate( whenDidItHappen.endDay, whenDidItHappen.endMonth, whenDidItHappen.endYear, )} lang={lang} /> {containsData(whenDidItHappen.description) ? ( <DescriptionItemView title="whenDidItHappenPage.details" description={whenDidItHappen.description} lang={lang} /> ) : null} </View> ) : ( <Text style={pdfStyles.sectionContent}> {lang['confirmationPage.howDidItStart.nag']} </Text> )} <Image style={pdfStyles.sectionSeparator} src={line} /> </View> ) } <|start_filename|>f2/src/components/formik/fileUpload/index.js<|end_filename|> import React from 'react' import styled from '@emotion/styled' import { FormFile } from 'react-bootstrap' import { UploadButton } from '../button' import { acceptableExtensions } from '../../../utils/acceptableFiles' import { FormRow } from '../row' const FileInput = styled(FormFile)` display: none; ` export const FileUpload = ({ field, form, onChange, ...props }) => { const selectFileInput = () => { document.getElementById(props.id).click() } return ( <FormRow> <FileInput id={props.id} custom> <FormFile.Input accept={acceptableExtensions} onChange={onChange} /> <FormFile.Label>{props.label}</FormFile.Label> </FileInput> <UploadButton label={props.label} onClick={selectFileInput} /> </FormRow> ) } <|start_filename|>f2/src/components/formik/alert/index.js<|end_filename|> import React, { useRef, useEffect } from 'react' import styled from '@emotion/styled' import { css } from '@emotion/core' import PropTypes from 'prop-types' import { Row, Container, Alert as BaseAlert } from 'react-bootstrap' import { A } from '../link' import { AiOutlineInfoCircle } from 'react-icons/ai' import { IoIosWarning } from 'react-icons/io' import { IoIosCheckmarkCircleOutline } from 'react-icons/io' import { cleanProps } from '../../../utils/cleanProps' import { border } from 'styled-system' import { FormRow } from '../row' const Alert = styled(BaseAlert, { shouldForwardProp: (prop) => cleanProps(prop), })` display: inline-flex; width: 100%; margin-top: 0.5rem; margin-bottom: 0.5rem; align-items: center; ${border} ` const Summary = styled(BaseAlert, { shouldForwardProp: (prop) => cleanProps(prop), })` width: 100%; border-left: 3px solid; ` const iconStyle = () => css` height: 1.5rem; width: 1.5rem; margin-left: -0.5rem; margin-right: 0.5rem; align-self: center; flex: none; ` const InfoIcon = styled(AiOutlineInfoCircle)` ${iconStyle} ` const WarningIcon = styled(IoIosWarning)` ${iconStyle} ` const SuccessIcon = styled(IoIosCheckmarkCircleOutline)` ${iconStyle} ` export const Error = (props) => { return ( <Alert variant="danger" borderLeft="3px solid"> {props.children} </Alert> ) } export const Info = (props) => { return ( <Alert variant="info"> <InfoIcon /> {props.children} </Alert> ) } export const Warning = (props) => { return ( <Alert variant="warning" borderLeft="3px solid"> <WarningIcon /> {props.children} </Alert> ) } export const Success = (props) => { return ( <Alert variant="success"> <SuccessIcon /> {props.children} </Alert> ) } export const ErrorSummary = (props) => { const errorSummaryRef = useRef(null) const scrollToRef = (ref) => window.scrollTo(0, ref.current.offsetTop) useEffect(() => { /* If user has attempted to submit scroll to the summary, otherwise simply display it. */ if (props.submissions > 0) { scrollToRef(errorSummaryRef) } }, [props.submissions]) const focusElement = (id) => { const element = document.getElementById(id) if (element) { element.scrollIntoView() } } return ( <Container> <Row> <Summary variant="danger" ref={errorSummaryRef}> <FormRow color="#000" fontWeight="700"> {props.title} </FormRow> <Row> <Container> {Object.entries(props.errors).map(([key, error]) => { return ( <React.Fragment key={key}> <Row> <A href={`#${key}`} marginBottom="0.5rem" color="initial" onClick={(e) => { e.preventDefault() focusElement(key) }} > {error.label} - {error.message} </A> </Row> </React.Fragment> ) })} </Container> </Row> </Summary> </Row> </Container> ) } ErrorSummary.propTypes = { children: PropTypes.any, } Error.propTypes = { children: PropTypes.any, } <|start_filename|>f2/src/forms/WhatWasAffectedForm.js<|end_filename|> import React from 'react' import PropTypes from 'prop-types' import { Trans } from '@lingui/macro' import { Form, Container, Row } from 'react-bootstrap' import { Formik, FieldArray, Field } from 'formik' import { CheckBoxRadio } from '../components/formik/checkboxRadio' import { useStateValue } from '../utils/state' import { formDefaults } from './defaultValues' import { ErrorSummary } from '../components/formik/alert' import { NextCancelButtons } from '../components/formik/button' import { WhatWasAffectedFormSchema } from './WhatWasAffectedFormSchema' import { ErrorText } from '../components/formik/paragraph' import { whatWasAffectedPages } from '../utils/nextWhatWasAffectedUrl' import { WarningModal } from '../components/formik/warningModal' const createErrorSummary = (errors) => { const errorSummary = {} if (errors.affectedOptions) { errorSummary['affectedOptions'] = { label: <Trans id="whatWasAffectedForm.optionsTitle" />, message: <Trans id="whatWasAffectedForm.hasValidationErrors" />, } } return errorSummary } export const WhatWasAffectedForm = (props) => { const [data] = useStateValue() const whatWasAffected = { ...formDefaults.whatWasAffected, ...data.formData.whatWasAffected, } const formOptions = [ { name: 'financial', checkboxLabel: <Trans id="whatWasAffectedForm.financial" />, checkboxHelpText: <Trans id="whatWasAffectedForm.financial.example" />, checkboxValue: whatWasAffectedPages.FINANCIAL.key, }, { name: 'personalInformation', checkboxLabel: <Trans id="whatWasAffectedForm.personalInformation" />, checkboxHelpText: ( <Trans id="whatWasAffectedForm.personalInformation.example" /> ), checkboxValue: whatWasAffectedPages.INFORMATION.key, }, { name: 'devices', checkboxLabel: <Trans id="whatWasAffectedForm.devices" />, checkboxHelpText: <Trans id="whatWasAffectedForm.devices.example" />, checkboxValue: whatWasAffectedPages.DEVICES.key, }, { name: 'businessAssets', checkboxLabel: <Trans id="whatWasAffectedForm.business_assets" />, checkboxHelpText: ( <Trans id="whatWasAffectedForm.business_assets.example" /> ), checkboxValue: whatWasAffectedPages.BUSINESS.key, }, { name: 'other', checkboxLabel: <Trans id="whatWasAffectedForm.other" />, checkboxHelpText: '', checkboxValue: whatWasAffectedPages.OTHER.key, }, ] return ( <React.Fragment> <Formik initialValues={whatWasAffected} onSubmit={(values) => { props.onSubmit(values) }} validationSchema={WhatWasAffectedFormSchema()} > {({ handleSubmit, handleChange, handleBlur, errors, submitCount, dirty, isSubmitting, }) => ( <Form onSubmit={handleSubmit}> <WarningModal dirty={dirty} isSubmitting={isSubmitting} /> <Container> <Row className="form-question"> <Row className="form-label"> <Trans id="whatWasAffectedForm.optionsTitle" /> </Row> <Row className="form-helper-text"> <Trans id="whatWasAffectedForm.optionsHelpText" /> </Row> {Object.keys(errors).length > 0 && ( <ErrorSummary errors={createErrorSummary(errors)} submissions={submitCount} title={<Trans id="default.hasValidationErrors" />} /> )} </Row> <Row className="form-section" id="affectedOptions"> {errors && errors.affectedOptions && ( <ErrorText> <Trans id="whatWasAffectedForm.warning" /> </ErrorText> )} <FieldArray name="affectedOptions" className="form-section" render={() => formOptions.map((question) => { return ( <React.Fragment key={question.name}> <Field name="affectedOptions" label={question.checkboxLabel} helpText={question.checkboxHelpText} component={CheckBoxRadio} value={question.checkboxValue} onChange={handleChange} onBlur={handleBlur} type="checkbox" id={'checkbox-' + question.name} /> </React.Fragment> ) }) } /> </Row> <Row> <NextCancelButtons submit={<Trans id="whatWasAffectedForm.nextButton" />} cancel={<Trans id="button.cancelReport" />} label={<Trans id="whatWasAffectedForm.nextPage" />} /> </Row> </Container> </Form> )} </Formik> </React.Fragment> ) } WhatWasAffectedForm.propTypes = { onSubmit: PropTypes.func.isRequired, } <|start_filename|>f2/src/forms/MoneyLostInfoFormSchema.js<|end_filename|> import React from 'react' import { evalDate } from '../utils/validateDate' import { Trans } from '@lingui/macro' export const realTimeValidation = (values) => { let errors = {} let transactionError = {} transactionError = evalDate( values.transactionDay, values.transactionMonth, values.transactionYear, ) if (Object.keys(transactionError).length > 0) { errors['transactionDay'] = transactionError.day ? transactionError.day : null errors['transactionMonth'] = transactionError.month ? transactionError.month : null errors['transactionYear'] = transactionError.year ? transactionError.year : null errors['transaction'] = true } return errors } export const createErrorSummary = (errors) => { const errorSummary = {} const transaction = errors.transaction || errors.transactionDay || errors.transactionMonth || errors.transactionYear if (transaction) { errorSummary['transaction'] = { label: <Trans id="moneyLostPage.transactionDateErrorSummaryLabel" />, message: <Trans id="moneyLostPage.transactionDateErrorSummaryMessage" />, } } return errorSummary } export const onSubmitValidation = (values) => { const errors = {} const fields = {} if (!values.transactionDay) { fields['transactionDay'] = true } if (!values.ransactionMonth) { fields['transactionMonth'] = true } if (!values.ransactionYear) { fields['transactionYear'] = true } if (Object.keys(fields).length > 0) { fields['transaction'] = true errors['fields'] = fields } return errors } export const MoneyLostInfoFormSchema = () => {} <|start_filename|>f2/src/components/formik/header/index.js<|end_filename|> import styled from '@emotion/styled' import { cleanProps } from '../../../utils/cleanProps' import { fontSize, lineHeight, fontWeight, space, color, width, height, position, } from 'styled-system' export const H1 = styled('h1', { shouldForwardProp: (prop) => cleanProps(prop), })` font-size: 3rem; font-weight: 700; ${fontSize}; ${fontWeight}; ${lineHeight}; ${space}; ${color}; ${width}; ${height}; ${position}; ` export const H2 = styled('h2', { shouldForwardProp: (prop) => cleanProps(prop), })` font-size: 1.875rem; font-weight: 700; ${fontSize}; ${fontWeight}; ${lineHeight}; ${space}; ${color}; ${width}; ${height}; ${position}; ` <|start_filename|>f2/src/forms/LocationInfoForm.js<|end_filename|> /** @jsx jsx */ import React from 'react' import PropTypes from 'prop-types' import { jsx } from '@emotion/core' import { Trans } from '@lingui/macro' import { useStateValue } from '../utils/state' import { Form, Container, Row } from 'react-bootstrap' import { FormRow } from '../components/formik/row' import { Formik, Field } from 'formik' import { NextCancelButtons, SkipButton } from '../components/formik/button' import { LocationInfoFormSchema } from './LocationInfoFormSchema' import { ErrorText } from '../components/formik/paragraph' import { Input } from '../components/formik/input' import { ErrorSummary } from '../components/formik/alert' import { formDefaults } from './defaultValues' import { WarningModal } from '../components/formik/warningModal' export const LocationInfoForm = (props) => { const [, dispatch] = useStateValue() const [data] = useStateValue() const locationInfo = { ...formDefaults.location, ...data.formData.location, } const errorDescription = { postalCode: { label: <Trans id="locationinfoPage.postalCode" />, message: <Trans id="locationInfoForm.Warning" />, }, } function RemoveData() { return dispatch({ type: 'saveFormData', data: { location: { postalCode: '', city: '', province: '', }, }, }) } return ( <React.Fragment> {false ? ( // mark ids for lingui <div> <Trans id="locationinfoPage.postalCity" /> <Trans id="locationinfoPage.postalCity.notFoundWarning" /> <Trans id="locationinfoPage.postalProv" /> <Trans id="locationinfoPage.postalProv.notFoundWarning" /> </div> ) : null} <Formik initialValues={locationInfo} validateOnChange={false} validationSchema={LocationInfoFormSchema()} onSubmit={(values) => { props.onSubmit(values) }} > {({ handleSubmit, handleChange, handleBlur, errors, submitCount, dirty, isSubmitting, }) => ( <Form onSubmit={handleSubmit}> <WarningModal dirty={dirty} isSubmitting={isSubmitting} /> {errors.postalCode && ( <ErrorSummary errors={errorDescription} submissions={submitCount} title={<Trans id="default.hasValidationErrors" />} /> )} <Container> <FormRow> <Trans id="locationinfoPage.skipInfo" /> </FormRow> <FormRow marginBottom="1rem"> <SkipButton label={<Trans id="locationinfoPage.skipButton" />} onClick={() => { RemoveData() }} to="/contactinfo" /> </FormRow> <FormRow> {errors.postalCode && ( <ErrorText>{errors.postalCode}</ErrorText> )} </FormRow> <FormRow> <Field name="postalCode" label={<Trans id="locationinfoPage.postalCode" />} component={Input} onChange={handleChange} onBlur={handleBlur} id="postalCode" type="text" helpText={<Trans id="locationinfoPage.postalCodeExample" />} /> </FormRow> <Row> <NextCancelButtons submit={<Trans id="locationPage.nextButton" />} cancel={<Trans id="button.cancelReport" />} label={<Trans id="locationinfoPage.nextPage" />} /> </Row> </Container> </Form> )} </Formik> </React.Fragment> ) } LocationInfoForm.propTypes = { onSubmit: PropTypes.func.isRequired, } <|start_filename|>f2/src/components/ErrorSummary/index.js<|end_filename|> /** @jsx jsx **/ import React from 'react' import { jsx } from '@emotion/core' import PropTypes from 'prop-types' import { Trans } from '@lingui/macro' import { Stack } from '@chakra-ui/core' import { Text } from '../text' import { Ol } from '../ordered-list' import { Li } from '../list-item' import { A } from '../link' import { useForm } from 'react-final-form' import { Alert } from '../Messages' import { focusTarget } from '../../utils/focusTarget' import { useEffect } from 'react' export const ErrorSummary = (props) => { const { errors } = useForm().getState() useForm().pauseValidation() useEffect(() => { const summary = document .getElementById('error-summary') .getBoundingClientRect() window.scrollTo(0, summary.y - 16) }) let errorLength = Object.keys(errors).length return ( <Alert id="error-summary" status="error" aria-atomic> <Stack> <Text fontSize="md" fontWeight="bold"> {props.children} </Text> <Ol {...(errorLength <= 1 && { listStyleType: 'none', ml: 0 })}> {Object.keys(errors).map((key) => { // Omit all errors set to true from showing in ErrorSummary console.log(key) console.log(errors) return errors[key] !== true ? ( <Li key={key} fontSize="md"> <A fontSize="md" fontWeight="bold" color="blue.900" href={`#${key}`} onClick={(event) => { let target = event.target if (focusTarget(target)) { event.preventDefault() } }} > {Array.isArray(errors[key]) ? ( errors[key].map((msg) => ( <React.Fragment> <Trans key={msg} id={msg} />{' '} </React.Fragment> )) ) : ( <Trans id={errors[key]} /> )} </A> </Li> ) : null })} </Ol> </Stack> </Alert> ) } ErrorSummary.defaultProps = { children: <Trans id="default.hasValidationErrors" />, } ErrorSummary.propTypes = { children: PropTypes.any, } <|start_filename|>f2/src/utils/winstonLogger.js<|end_filename|> require('dotenv').config() const winston = require('winston') const expressWinston = require('express-winston') require('winston-daily-rotate-file') const { createLogger, format } = require('winston') const { combine, timestamp, label } = format const logDir = process.env.LOGGING_DIRECTORY const ignoreRoutes = process.env.LOGGING_IGNORE_ROUTE const prettyPrint = process.env.LOGGING_PRETTY_PRINT const ignoreRoutesArr = ignoreRoutes ? ignoreRoutes.replace(/\s/g, '').split(',') : [] const transports = [] const consoleTransport = new winston.transports.Console({ level: 'debug', handleExceptions: true, }) transports.push(consoleTransport) if (logDir) { const fileTransport = new winston.transports.DailyRotateFile({ dirname: logDir, filename: 'app-log-%DATE%.json', datePattern: 'YYYY-MM-DD', zippedArchive: true, maxSize: '20m', maxFiles: '14d', level: 'debug', handleExceptions: true, }) transports.push(fileTransport) } const getLogger = (fileName) => { return createLogger({ transports: transports, format: combine( label({ label: `${fileName}`, message: true }), timestamp(), prettyPrint ? format.prettyPrint() : format.json(), ), exitOnError: false, }) } const getExpressLogger = () => { return expressWinston.logger({ transports: transports, format: prettyPrint ? format.prettyPrint() : format.json(), dynamicMeta: (req, res) => { const httpRequest = {} const meta = {} if (req) { meta.httpRequest = httpRequest httpRequest.remoteIpv4andv6 = req.ip // this includes both ipv6 and ipv4 addresses separated by ':' httpRequest.remoteIpv4 = req.ip.indexOf(':') >= 0 ? req.ip.substring(req.ip.lastIndexOf(':') + 1) : req.ip // just ipv4 httpRequest.requestSize = req.socket.bytesRead httpRequest.referrer = req.get('Referrer') } return meta }, ignoreRoute: (req, res) => { const requestPath = req.path.split('/')[1] const ignoreRoute = ignoreRoutesArr.includes(requestPath) if (ignoreRoute) { return true } else { return false } }, }) } module.exports = { getLogger, getExpressLogger } <|start_filename|>f2/src/forms/AnonymousInfoForm.js<|end_filename|> import React from 'react' import PropTypes from 'prop-types' import { Trans } from '@lingui/macro' import { useStateValue } from '../utils/state' import { Form, Container, Row } from 'react-bootstrap' import { Formik, Field } from 'formik' import { CheckBoxRadio } from '../components/formik/checkboxRadio' import { Warning } from '../components/formik/alert' import { NextCancelButtons } from '../components/formik/button' import { WarningModal } from '../components/formik/warningModal' export const AnonymousInfoForm = (props) => { const [data] = useStateValue() const anonymous = { ...data.formData.anonymous, } return ( <Formik initialValues={anonymous} onSubmit={(values) => { if ( JSON.stringify(values.anonymousOptions) === JSON.stringify(['anonymousPage.yes']) ) { data.formData.location.postalCode = '' } else { data.formData.location.city = '' data.formData.location.province = '' } props.onSubmit(values) }} > {({ values, handleSubmit, handleChange, handleBlur, dirty, isSubmitting, }) => ( <Form onSubmit={handleSubmit}> <WarningModal dirty={dirty} isSubmitting={isSubmitting} /> <Container> <Row className="form-section"> <Field name="anonymousOptions" label={<Trans id="anonymousPage.yes" />} component={CheckBoxRadio} value="anonymousPage.yes" onChange={handleChange} onBlur={handleBlur} type="checkbox" id="checkbox-anonymous-option" /> {values.anonymousOptions.includes('anonymousPage.yes') && ( <Warning> <Trans id="anonymousPage.warning" /> </Warning> )} </Row> <Row> <NextCancelButtons submit={<Trans id="anonymousPage.nextButton" />} cancel={<Trans id="button.cancelReport" />} label={<Trans id="anonymousPage.nextPage" />} /> </Row> </Container> </Form> )} </Formik> ) } AnonymousInfoForm.propTypes = { onSubmit: PropTypes.func.isRequired, } <|start_filename|>f2/src/components/radio/index.js<|end_filename|> /** @jsx jsx */ import React from 'react' import PropTypes from 'prop-types' import { jsx } from '@emotion/core' import { Text } from '../text' import { UniqueID } from '../unique-id' import { Box, VisuallyHidden, ControlBox, Flex } from '@chakra-ui/core' import { useField } from 'react-final-form' import { ConditionalForm } from '../container' import canada from '../../theme/canada' export const RadioAdapter = ({ name, value, defaultIsChecked, children, ...props }) => { const { input: { checked, ...input }, meta: { error, touched }, } = useField(name, { type: 'radio', value, defaultIsChecked, }) return ( <Radio input={input} isChecked={checked} isInvalid={error && touched} conditionalField={props.conditionalField} > {children} </Radio> ) } export const Radio = ({ input, label, isChecked, conditionalField, ...props }) => { const isCheckedAndHasCondition = isChecked && conditionalField return ( <UniqueID> {(id) => { return ( <React.Fragment> <Flex as="label" id={id} align="start" d="inline-flex"> <VisuallyHidden {...input} as="input" type="radio" defaultChecked={isChecked ? 'true' : ''} {...input} /> <ControlBox type="radio" {...canada.variants.inputs.radios}> <Box size="20px" bg="black" rounded="full" /> </ControlBox> <Text ml={2} pt={2} htmlFor={id} lineHeight="1.5rem"> {props.children} </Text> </Flex> {isCheckedAndHasCondition && ( <ConditionalForm>{conditionalField}</ConditionalForm> )} </React.Fragment> ) }} </UniqueID> ) } Radio.propTypes = { children: PropTypes.any, conditionalField: PropTypes.object, } <|start_filename|>f2/src/forms/EvidenceInfoForm.js<|end_filename|> /** @jsx jsx */ import React, { useState, useEffect } from 'react' import PropTypes from 'prop-types' import { Trans, Plural } from '@lingui/macro' import { useLingui } from '@lingui/react' import { jsx } from '@emotion/core' import { useStateValue } from '../utils/state' import { fileExtensionPasses } from '../utils/acceptableFiles' import { Form, Container } from 'react-bootstrap' import { Formik, Field, FieldArray } from 'formik' import { Info, Warning } from '../components/formik/alert' import { List } from '../components/formik/list' import { P, HiddenText } from '../components/formik/paragraph' import { A } from '../components/formik/link' import { NextCancelButtons, DefaultButton } from '../components/formik/button' import { FileUpload } from '../components/formik/fileUpload' import { TextArea } from '../components/formik/textArea' import { FormRow } from '../components/formik/row' import { Modal } from 'react-bootstrap' import { WarningModal } from '../components/formik/warningModal' export const EvidenceInfoForm = (props) => { const [data] = useStateValue() const cached = { ...data.formData.evidence, } const { i18n } = useLingui() const allowedFilesList = [ <Trans id="evidencePage.fileTypes1" />, <Trans id="evidencePage.fileTypes2" />, <Trans id="evidencePage.fileTypes3" />, ] const [files, setFiles] = useState(cached.files) const [fileDescriptions, setFileDescriptions] = useState( cached.fileDescriptions, ) const [status, setStatus] = useState('') const [showModal, setShowModal] = useState(false) const [filesDirty, setFilesDirty] = useState(false) //Place file descriptions into an object to be used by Formik. const fileDescriptionsObj = {} const setFormValues = () => { fileDescriptions.forEach((description, index) => { fileDescriptionsObj[`file-description-${index}`] = description }) } setFormValues() const isDirty = (formDirty) => { return formDirty || filesDirty } useEffect(() => { const element = document.getElementById('status') if (status === 'fileUpload.added' || status === 'fileUpload.removed') { element.focus() } }, [status]) const displayFileCount = files.length > 0 const maxFiles = files.length >= 3 const onFilesChange = (e) => { const file = e.target.files[0] if (file.size > 4194304) { // 4MB in bytes is 4194304. setStatus('fileUpload.maxSizeError') setShowModal(true) e.target.value = '' // clear the file input target, to allow the file to be chosen again return } else if (file.size === 0) { setStatus('fileUpload.zeroSizeError') setShowModal(true) e.target.value = '' // clear the file input target, to allow the file to be chosen again return } if (!fileExtensionPasses(file.name)) { setStatus('evidencePage.supportedFiles') setShowModal(true) e.target.value = '' // clear the file input target, to allow the file to be chosen again return } if (file.type.indexOf('image') !== -1) { let img = new Image() img.src = window.URL.createObjectURL(file) img.onload = () => { if (img.width < 128 || img.height < 128) { setStatus('fileUpload.imageTooSmallError') setShowModal(true) } else { setStatus('fileUpload.added') setFiles(files.concat(file)) setFileDescriptions(fileDescriptions.concat('')) } } e.target.value = '' } else { setStatus('fileUpload.added') setFilesDirty(true) setFiles(files.concat(e.target.files[0])) setFileDescriptions(fileDescriptions.concat('')) e.target.value = '' // clear the file input target, to allow the file to be removed then added again } } const onFileDescriptionChange = (description, index) => { fileDescriptions[index] = description setFileDescriptions(fileDescriptions) } const removeFile = (index) => { let newFiles = files.filter((_, fileIndex) => index !== fileIndex) let newFileDescriptions = fileDescriptions.filter( (_, fileIndex) => index !== fileIndex, ) setFiles(newFiles) setFileDescriptions(newFileDescriptions) setStatus('fileUpload.removed') setFilesDirty(true) } const handleClose = () => setShowModal(false) return ( <React.Fragment> {false ? ( // mark ids for lingui <div> <Trans id="fileUpload.removed" /> <Trans id="fileUpload.added" /> <Trans id="fileUpload.fileName" /> <Trans id="fileUpload.fileDescription" /> <Trans id="fileUpload.fileSize" /> <Trans id="fileUpload.CosmosDBFile" /> <Trans id="fileUpload.classification.title" /> <Trans id="fileUpload.classification.cannotscan" /> <Trans id="fileUpload.malwareScan" /> <Trans id="fileUpload.malwareScan.clean" /> <Trans id="fileUpload.isAdult" /> <Trans id="fileUpload.adultScore" /> <Trans id="fileUpload.isRacy" /> <Trans id="fileUpload.isRacy.false" /> <Trans id="fileUpload.isRacy.true" /> <Trans id="fileUpload.racyScore" /> <Trans id="fileUpload.fileAttachment" /> <Trans id="fileUpload.fileAttachment.offensivewarning" /> <Trans id="fileUpload.fileAttachment.offensivewarning.block" /> <Trans id="fileUpload.virusScanError" /> <Trans id="fileUpload.fileTypeError" /> <Trans id="fileUpload.noFiles" /> </div> ) : null} {status ? ( <HiddenText tabIndex={-1} id="status"> {i18n._(status)} </HiddenText> ) : null} <Modal show={showModal} onHide={handleClose} backdrop="static"> <Modal.Header closeButton> <Modal.Title> <Trans id="fileUpload.errorModal.title" /> </Modal.Title> </Modal.Header> <Modal.Body> <Container> {status === 'fileUpload.maxSizeError' && ( <FormRow> <Trans id="fileUpload.maxSizeError" /> </FormRow> )} {status === 'fileUpload.zeroSizeError' && ( <FormRow> <Trans id="fileUpload.zeroSizeError" /> </FormRow> )} {status === 'evidencePage.supportedFiles' && ( <List label={<Trans id="evidencePage.supportedFiles" />} items={allowedFilesList} /> )} {status === 'fileUpload.imageTooSmallError' && ( <FormRow> <Trans id="fileUpload.imageTooSmallError" /> </FormRow> )} </Container> </Modal.Body> <Modal.Footer> <DefaultButton onClick={handleClose} label={<Trans id="button.ok" />} /> </Modal.Footer> </Modal> <Formik initialValues={fileDescriptionsObj} enableReinitialize={true} onSubmit={() => { const data = { files, fileDescriptions, } props.onSubmit(data) }} > {({ handleSubmit, handleChange, dirty, isSubmitting }) => ( <Form onSubmit={handleSubmit}> <WarningModal dirty={isDirty(dirty)} isSubmitting={isSubmitting} /> <Container> {!maxFiles && ( <FormRow> <P fontSize="md" borderBottom="2px" borderColor="rgb(232, 232, 232)" marginBottom="1rem" paddingBottom="1rem" width="100%" > <Trans id="evidencePage.fileSize" /> </P> </FormRow> )} {displayFileCount && ( <React.Fragment> <FormRow> <P fontSize="1.25rem" lineHeight="1.33" marginBottom="1rem"> <Plural id="evidencePage.numberOfFilesAttached" value={files.length} one="# file attached" other="# files attached" /> </P> </FormRow> <FieldArray name="fileDescriptions" render={() => files.map((f, index) => { return ( <FormRow key={index} separator="true" marginTop="1rem" paddingTop="1.5rem" paddingBottom="1.5rem" > <P fontSize="1.25rem" lineHeight="1.5rem" marginBottom="1rem" > {f.name} </P> <Field label={ <Trans id="evidencePage.fileDescription" /> } name={`file-description-${index}`} id={`file-description-${index}`} onChange={(e) => { handleChange(e) onFileDescriptionChange(e.target.value, index) }} component={TextArea} /> <A onClick={() => { removeFile(index) setFormValues() }} color="red" fontSize="1.125rem" > <Trans id="evidencePage.removeFileButton" /> </A> </FormRow> ) }) } /> </React.Fragment> )} {maxFiles && ( <FormRow> <Warning> <Trans id="evidencePage.maxFileWarning" /> </Warning> </FormRow> )} {!maxFiles && ( <React.Fragment> <FileUpload id="uploader" label={<Trans id="evidencePage.addFileButton" />} onChange={onFilesChange} /> <List label={<Trans id="evidencePage.supportedFiles" />} items={allowedFilesList} /> </React.Fragment> )} <FormRow> <Info> <Trans id="evidencePage.fileWarning" /> </Info> </FormRow> <FormRow> <NextCancelButtons submit={<Trans id="button.continue" />} cancel={<Trans id="button.cancelReport" />} label={<Trans id="evidencePage.nextPage" />} /> </FormRow> </Container> </Form> )} </Formik> </React.Fragment> ) } EvidenceInfoForm.propTypes = { onSubmit: PropTypes.func.isRequired, } <|start_filename|>f2/src/ConfirmationSummary.js<|end_filename|> /** @jsx jsx */ import { jsx } from '@emotion/core' import React from 'react' import { useEffect } from 'react' import { Stack } from '@chakra-ui/core' import { useStateValue } from './utils/state' import { formDefaults } from './forms/defaultValues' import { HowDidItStartSummary } from './summary/HowDidItStartSummary' import { BusinessInfoSummary } from './summary/BusinessInfoSummary' import { ContactInfoSummary } from './summary/ContactInfoSummary' import { DevicesSummary } from './summary/DevicesSummary' import { EvidenceInfoSummary } from './summary/EvidenceInfoSummary' import { InformationSummary } from './summary/InformationSummary' import { LocationInfoSummary } from './summary/LocationInfoSummary' import { MoneyLostInfoSummary } from './summary/MoneyLostInfoSummary' import { SuspectCluesSummary } from './summary/SuspectCluesSummary' import { WhatHappenedSummary } from './summary/WhatHappenedSummary' import { WhatWasAffectedSummary } from './summary/WhatWasAffectedSummary' import { AnonymousSummary } from './summary/AnonymousSummary' import { WhenDidItHappenSummary } from './summary/WhenDidItHappenSummary' import { WhoAreYouReportForSummary } from './summary/WhoAreYouReportForSummary' import { useLog } from './useLog' export const testdata = { doneForms: true, formData: formDefaults, } export const ConfirmationSummary = () => { const [data, dispatch] = useStateValue() const impact = { affectedOptions: [], ...testdata.formData.whatWasAffected, ...data.formData.whatWasAffected, } const anonymous = { ...testdata.formData.anonymous, ...data.formData.anonymous, } const { fyiForm } = data.formData useLog('ConfirmationSummaryPage') useEffect(() => { if (!data.doneForms) { dispatch({ type: 'saveDoneForms', data: true }) } }) return ( <React.Fragment> <Stack spacing={12}> {fyiForm ? null : ( <Stack spacing={12}> <WhoAreYouReportForSummary /> <HowDidItStartSummary /> <WhenDidItHappenSummary /> <WhatWasAffectedSummary /> {impact.affectedOptions.includes( 'whatWasAffectedForm.financial', ) && <MoneyLostInfoSummary />} {impact.affectedOptions.includes( 'whatWasAffectedForm.personalInformation', ) && <InformationSummary />} {impact.affectedOptions.includes('whatWasAffectedForm.devices') && ( <DevicesSummary /> )} {impact.affectedOptions.includes( 'whatWasAffectedForm.business_assets', ) && <BusinessInfoSummary />} </Stack> )} <WhatHappenedSummary /> {fyiForm ? null : <SuspectCluesSummary />} <EvidenceInfoSummary /> <LocationInfoSummary /> {anonymous.anonymousOptions.includes('anonymousPage.yes') ? ( <AnonymousSummary /> ) : ( <ContactInfoSummary /> )} </Stack> </React.Fragment> ) } <|start_filename|>f2/cypress/integration/Consent/consent.js<|end_filename|> import { After, When, Given, Then } from 'cypress-cucumber-preprocessor/steps' // Hooks for repeated commands/rules After(() => { cy.reportA11y() }) Given('I open the report home page', () => { cy.visit(Cypress.env('local')) }) Then('Inject axe and check for accessibility issues', () => { cy.reportA11y() }) When('I click on create a report button', () => { cy.contains('Report now').first().click({ force: true }) }) When('I read before you start instructions', () => { cy.contains('Start report').first().click({ force: true }) }) When('I click continue without checking the consent', () => { cy.contains('Continue').first().click({ force: true }) }) Then('{string} should be shown', (content) => { cy.contains(content, { timeout: 10000 }).should('be.visible') }) Then('check for accessibility issues', () => { cy.reportA11y() }) When('I check the consent checkbox', () => { cy.get('form').get('input[name="consentOptions"]').check({ force: true }) cy.contains('Continue').first().click({ force: true }) }) Then('{string} should be shown', (content) => { cy.contains(content, { timeout: 10000 }).should('be.visible') }) Then('check for accessibility issues', () => { cy.reportA11y() }) <|start_filename|>f2/src/components/ordered-list/presets.js<|end_filename|> import React from 'react' import { List } from '@chakra-ui/core' import PropTypes from 'prop-types' export const Ol = props => { const { listStyleType, ...rest } = props return ( <List as="ol" stylePos="outside" styleType={listStyleType} ml={5} spacing={2} {...rest} > {props.children} </List> ) } Ol.defaultProps = { listStyleType: 'decimal', } Ol.propTypes = { listStyleType: PropTypes.string, children: PropTypes.any, } <|start_filename|>f2/src/forms/LocationInfoFormSchema.js<|end_filename|> import * as Yup from 'yup' import { yupSchema } from '../utils/yupSchema' const locationInfoFormSchema = Yup.object().shape({ postalCode: yupSchema().postalCodeSchema, }) export const LocationInfoFormSchema = () => { return locationInfoFormSchema } <|start_filename|>f2/src/utils/__tests__/containsData.test.js<|end_filename|> import { containsData } from '../containsData' describe('containsData', () => { it('returns false for an empty object', () => { const x = {} expect(containsData(x)).toEqual(false) }) it('returns false for an empty list', () => { const x = [] expect(containsData(x)).toEqual(false) }) it('returns false for an empty string', () => { const x = '' expect(containsData(x)).toEqual(false) }) it('returns false for an object with empty things in it', () => { const x = { a: { aa: '', aaa: {} }, b: '', c: ['', {}, { a: [] }], } expect(containsData(x)).toEqual(false) }) it('returns true for a non-empty string', () => { const x = 'hi' expect(containsData(x)).toEqual(true) }) it('returns true for numbers', () => { expect(containsData(3.4)).toEqual(true) expect(containsData(0)).toEqual(true) }) it('returns true for boolean', () => { expect(containsData(true)).toEqual(true) expect(containsData(false)).toEqual(true) }) it('returns true for a list that contains things that are non-empty', () => { const x = ['a', {}] expect(containsData(x)).toEqual(true) }) it('returns true for an object that contains things that are non-empty', () => { const x = { a: 'hi', b: '' } expect(containsData(x)).toEqual(true) }) }) <|start_filename|>f2/src/components/FormArrayControl/index.js<|end_filename|> /** @jsx jsx */ import PropTypes from 'prop-types' import { jsx } from '@emotion/core' import React from 'react' import { FormControl, Stack } from '@chakra-ui/core' import { useField, useForm } from 'react-final-form' import { FormLabel } from '../FormLabel' import { FormHelperText } from '../FormHelperText' import { FormErrorMessage } from '../FormErrorMessage' import { UniqueID } from '../unique-id' import { Trans } from '@lingui/macro' export const FormArrayControl = (props) => { const { meta: { submitFailed, invalid }, } = useField(props.name, { subscription: { submitFailed: true, invalid: true }, }) const { errors } = useForm(props.onSubmit).getState() return ( <UniqueID> {(id) => { return ( <FormControl id={props.name} borderLeft={submitFailed && invalid ? '3px' : null} pl={submitFailed && invalid ? 4 : null} borderLeftColor={submitFailed && invalid ? 'red.700' : null} as="fieldset" aria-labelledby={id} isInvalid={submitFailed && invalid} {...props} > <Stack spacing={1} pb={4}> <FormLabel id={id} as="legend" htmlFor={props.name} mb={props.label && 0} > {props.label} </FormLabel> {props.helperText && ( <FormHelperText>{props.helperText}</FormHelperText> )} {props.errorMessage && ( <FormErrorMessage>{props.errorMessage}</FormErrorMessage> )} {props.errors && ( <FormErrorMessage> {Array.isArray(errors[props.name]) ? ( errors[props.name].map((msg) => ( <React.Fragment> <Trans key={msg} id={msg} />{' '} </React.Fragment> )) ) : ( <Trans id={errors[props.name]} /> )} </FormErrorMessage> )} </Stack> {/** This component comes with a group attribute. We don't need to use Chakra's <CheckboxGroup> or <RadioGroup> as per the Chakra docs */} <Stack shouldWrapChildren spacing={4}> {props.children} </Stack> </FormControl> ) }} </UniqueID> ) } FormArrayControl.propTypes = { label: PropTypes.any, helperText: PropTypes.any, errorMessage: PropTypes.any, name: PropTypes.string, children: PropTypes.any, } <|start_filename|>f2/src/utils/getData.js<|end_filename|> // Prep the data for save. const fs = require('fs') const crypto = require('crypto') const { selfHarmWordsScan } = require('./selfHarmWordsScan') const { generateReportId } = require('./generateReportId') const { formatDate } = require('./formatDate') const { getLogger } = require('./winstonLogger') const logger = getLogger(__filename) const padNumber = (x) => `${x}`.padStart(2, 0) const getFileExtension = (filename) => { const a = filename.split('.') if (a.length === 1 || (a[0] === '' && a.length === 2)) { return '' } return a.pop().toLowerCase() } async function getData(data, files) { data.reportId = generateReportId() // Clean up the file info we're saving to MongoDB, and record the SHA1 hash so we can find the file in blob storage const filesToJson = [] var i = 0 for (const file of Object.entries(files)) { // Generate and record the SHA1 hash for the file. This way we can find it in blob storage var shasum = crypto.createHash('sha1') shasum.update(fs.readFileSync(file[1].path)) const sha1Hash = shasum.digest('hex') const fileExtension = getFileExtension(file[1].name) const newFilePath = fileExtension !== '' ? `${file[1].path}.${fileExtension}` : file[1].path if (file[1].path !== newFilePath) fs.renameSync(file[1].path, newFilePath) // Record all the file related fields together in one JSON object for simplicity filesToJson.push({ name: file[1].name, type: file[1].type, size: file[1].size, fileDescription: data.evidence.fileDescriptions[i], path: newFilePath, sha1: sha1Hash, // MongoDB had a 16MB document size limit, but CosmosDB only has a 2MB limit so this isn't going to work. //blob: Binary(fs.readFileSync(file[1].path)), }) i++ } // Overwrite the empty files array with the file json we built above data.evidence.files = filesToJson const selfHarmWords = selfHarmWordsScan(data) if (selfHarmWords && selfHarmWords.length > 0) { logger.warn({ message: `Self harm words detected: ${selfHarmWords}`, sessionId: data.sessionId, reportId: data.reportId, }) } data.selfHarmWords = selfHarmWords const now = new Date() const timeZoneOffset = now.getTimezoneOffset() / 60 // convert to hours data.submissionDate = padNumber(now.getDate()) + '/' + padNumber(now.getMonth() + 1) + '/' + `${now.getFullYear()}` const dateString = formatDate( now.getDate(), now.getMonth() + 1, now.getFullYear(), ) const timeString = padNumber(now.getHours()) + ':' + padNumber(now.getMinutes()) data.submissionTime = `${dateString} ${timeString} UTC-${timeZoneOffset}` return data } module.exports = { getData, getFileExtension } <|start_filename|>f2/src/components/formik/paragraph/index.js<|end_filename|> import React from 'react' import styled from '@emotion/styled' import { cleanProps } from '../../../utils/cleanProps' import { typography, space, layout, border, position, color, } from 'styled-system' export const P = styled('p', { shouldForwardProp: (prop) => cleanProps(prop), })` ${typography} ${space} ${layout} ${border} ${position} ${color} ` export const ErrorText = (props) => { return ( <P color="#dc3545" fontSize="1.25rem" marginBottom="0.5rem"> {props.children} </P> ) } //This component can be used to render hidden text to be used by a screen reader. export const HiddenText = styled.p` opacity: 0; height: 0rem; ` <|start_filename|>f2/src/components/formik/button/index.js<|end_filename|> import React from 'react' import styled from '@emotion/styled' import { css } from '@emotion/core' import { Button as BaseButton, Container, Row, Col } from 'react-bootstrap' import { GoChevronRight } from 'react-icons/go' import { Route } from 'react-router-dom' import { FiPaperclip } from 'react-icons/fi' import { cleanProps } from '../../../utils/cleanProps' import { space, border, layout, typography } from 'styled-system' import { P } from '../paragraph' const buttonTypes = { SUBMIT: { backGround: '#1f5126', color: '#FFF', borderColor: '#00692f', active: { backGround: '#183c1f', color: '#FFF', }, }, DEFAULT: { backGround: '#e8e8e8', color: '#000', borderColor: '#d5d5d5', active: { backGround: '#d5d5d5', color: '#000', }, }, UPLOAD: { backGround: '#153e75', color: '#FFF', borderColor: '#153e75', active: { backGround: '#003a66', color: '#FFF', }, }, SKIP: { backGround: '#aeaeae', color: '#000', borderColor: '#808080', active: { backGround: '#d5d5d5', color: '#000', }, }, FEEDBACK: { backGround: '#1e4e8c', color: '#FFF', borderColor: '#1e4e8c', active: { backGround: '#1e4e8c', color: '#FFF', }, }, } const buttonStyle = (props) => { let buttonProps = props.buttonstyle if (buttonProps) { return css` background-color: ${buttonProps.backGround}; color: ${buttonProps.color}; border-color: ${buttonProps.borderColor}; &:hover, &:focus { background-color: ${buttonProps.backGround}; color: ${buttonProps.color}; box-shadow: #d5d5d5 0px 0px 0px 2px; } &:not(:disabled):not(.disabled):active { background-color: ${buttonProps.active.backGround}; color: ${buttonProps.active.color}; } ` } } const ButtonLabel = styled('span', { shouldForwardProp: (prop) => cleanProps(prop), })` padding-left: 1.5rem; padding-right: 1.5rem; font-size: 1.125rem; font-weight: 400; display: inline-flex; align-items: center; cursor: pointer; ${space} ${typography} ` const Button = styled(BaseButton, { shouldForwardProp: (prop) => cleanProps(prop), })` height: 3rem; -webkit-box-pack: center; border-style: outset; min-width: 10rem; padding-left: 0rem; padding-right: 0rem; align-items: center; z-index: 1; ${space} ${border} ${layout} ${buttonStyle} ` const RightArrowIcon = styled(GoChevronRight)` margin-left: 0.5rem; margin-right: -0.5rem; ` const PaperClipIcon = styled(FiPaperclip)` margin-left: -0.5rem; margin-right: 0.5rem; ` const ButtonContainer = styled(Container)` margin-bottom: 2.5rem; margin-top: 2.5rem; ` const ButtonCol = styled(Col)` padding-left: 0rem; padding-right: 0rem; ` export const DefaultButton = (props) => { return ( <Button buttonstyle={buttonTypes.DEFAULT} onClick={props.onClick}> <ButtonLabel>{props.label}</ButtonLabel> </Button> ) } export const MidFormFeedbackButton = (props) => { return ( <Button buttonstyle={buttonTypes.DEFAULT} border="1px solid" padding="1rem 1.5rem" marginLeft="0rem" borderStyle="outset" height="inherit" onClick={props.onClick} > <ButtonLabel fontSize="1.25rem" paddingLeft="0rem" paddingRight="0rem"> {props.label} </ButtonLabel> </Button> ) } export const SubmitButton = (props) => { return ( <Button buttonstyle={buttonTypes.SUBMIT} type="submit"> <ButtonLabel> {props.label} <RightArrowIcon /> </ButtonLabel> </Button> ) } export const CancelButton = (props) => { return ( <Route render={({ history }) => ( <Button buttonstyle={buttonTypes.DEFAULT} onClick={() => history.push('/confirmCancel')} > <ButtonLabel>{props.label}</ButtonLabel> </Button> )} /> ) } export const NextCancelButtons = (props) => { return ( <ButtonContainer> <Row> <P marginBottom="1rem" fontSize="1.25rem" lineHeight="1.5rem"> {props.label} </P> </Row> <Row> <ButtonCol xs="auto"> <SubmitButton label={props.submit} /> </ButtonCol> <ButtonCol xs="1"></ButtonCol> <ButtonCol xs="auto"> <CancelButton label={props.cancel} /> </ButtonCol> </Row> </ButtonContainer> ) } /* This is just a button, to handle file uploads use the FileUpload component from f2\src\components\formik\fileUpload\index.js */ export const UploadButton = (props) => { return ( <Button buttonstyle={buttonTypes.UPLOAD} onClick={props.onClick}> <ButtonLabel> <PaperClipIcon /> {props.label} </ButtonLabel> </Button> ) } export const FeedbackButton = (props) => { return ( <Button buttonstyle={buttonTypes.FEEDBACK} type="submit"> <ButtonLabel>{props.label}</ButtonLabel> </Button> ) } export const SkipButton = (props) => { return ( <Route render={({ history }) => ( <Button buttonstyle={buttonTypes.SKIP} onClick={() => { if (props.onClick) { props.onClick() } history.push(props.to) }} > <ButtonLabel> {props.label} <RightArrowIcon /> </ButtonLabel> </Button> )} /> ) } <|start_filename|>f2/src/components/formik/test/TESTFORM.js<|end_filename|> import React from 'react' import { useStateValue } from '../../../utils/state' import { Form, Container } from 'react-bootstrap' import { Formik } from 'formik' import { FormRow } from '../row' import { P, ErrorText } from '../paragraph' export const TestForm = (props) => { const [data] = useStateValue() return ( <React.Fragment> <Formik initialValues={data.formData} validate={(values) => { console.log(values) }} onSubmit={(values) => { props.onSubmit(values) }} render={({ values, handleSubmit, handleChange, handleBlur }) => ( <Form onSubmit={handleSubmit}> <Container> <FormRow> <P fontWeight="700">---Default Text---</P> <P> Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. </P> </FormRow> <FormRow> <P fontWeight="700">---Error Text---</P> <ErrorText> Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. </ErrorText> </FormRow> <FormRow> <P fontWeight="700">---Modified Text---</P> <P fontSize="12px" color="#fc03e3" marginTop="1rem" paddingLeft="1rem" > Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. </P> </FormRow> </Container> </Form> )} /> </React.Fragment> ) } <|start_filename|>f2/src/utils/encryptedEmail.js<|end_filename|> // 'use strict' const nodemailer = require('nodemailer') const fs = require('fs') const exec = require('child_process').exec const nanoid = require('nanoid') const { certFileName } = require('./ldap') const { getLogger } = require('./winstonLogger') require('dotenv').config() const logger = getLogger(__filename) const mailHost = process.env.MAIL_HOST const mailUser = process.env.MAIL_USER const mailPass = process.env.MAIL_PASS const mailFrom = process.env.MAIL_FROM const ANALYST_GROUP_MAIL = process.env.ANALYST_GROUP_MAIL let lang let langEn = fs.readFileSync('src/locales/en.json') let langFr = fs.readFileSync('src/locales/fr.json') let langJsonEn = JSON.parse(langEn) let langJsonFr = JSON.parse(langFr) const prepareUnencryptedReportEmail = (message, data, callback) => { data.language === 'en' ? (lang = langJsonEn) : (lang = langJsonFr) let transporter = nodemailer.createTransport({ streamTransport: true, newline: 'unix', buffer: true, }) /* Disabling attachments for now, let's try sending a SAS link instead let attachments = data.evidence.files .filter((file) => file.malwareIsClean) .map((file) => ({ filename: file.name, path: file.path, })) */ transporter.sendMail( { from: mailFrom, to: data.contactInfo.email, subject: `NCFRS report ${data.reportId}`, text: `Please find NCFRS Report ${data.reportId} attached to this message`, attachments: [ { filename: `${data.reportId}.htm`, content: message, }, ], }, (err, info) => { if (err) console.warn(`ERROR in prepareUnencryptedReportEmail: ${err}`) else { callback(info.message.toString()) } }, ) } const getEmailWarning = (data) => data.evidence.files.some( (file) => file.isImageRacyClassified || file.isImageAdultClassified, ) ? lang['analystReport.potentialOffensiveImageInEmailSubject'] : '' const getSelfHarmWord = (data) => data.selfHarmWords.length ? lang['analystReport.selfHarmStringInEmailSubject'] : '' const encryptMessage = (uidList, emailAddress, message, data, sendMail) => { const openssl = 'openssl smime -des3 -encrypt' const messageFile = `message_${nanoid()}.txt` const encryptedFile = messageFile + '.encrypted' const subjectSuffix = getEmailWarning(data) + getSelfHarmWord(data) let certList = uidList.map((uid) => certFileName(uid)) fs.writeFile(messageFile, message, function (err) { if (err) throw err exec( `${openssl} -in ${messageFile} -out ${encryptedFile} -subject "NCFRS report ${ data.reportId } ${subjectSuffix}", ${certList.join(' ')}`, { cwd: process.cwd() }, function (error, _stdout, stderr) { if (error) throw error else if (stderr) console.warn(stderr) else { console.log('Encrypted Mail: Message encrypted') logger.info({ message: 'Encrypted Mail: Message encrypted', reportId: data.reportId, sessionId: data.sessionId, }) const attachment = fs.readFileSync(encryptedFile) fs.unlink(messageFile, () => {}) fs.unlink(encryptedFile, () => {}) sendMail(emailAddress, attachment, data.reportId, subjectSuffix) } }, ) }) } async function sendMail(emailAddress, attachment, reportId, emailSuffix) { if (!emailAddress) return let transporter = nodemailer.createTransport({ host: mailHost, port: 465, secure: true, auth: { user: mailUser, pass: <PASSWORD>, }, }) //data.language === 'en' ? (lang = langJsonEn) : (lang = langJsonFr) // With encrypted e-mail, just pass the raw output of openssl to nodemailer. // This is because the output of openssl's "smime" command is already a valid RFC822 message const message = { envelope: { from: mailFrom, to: emailAddress, }, raw: attachment, } let info = await transporter.sendMail(message) logger.info({ message: `Encrypted Mail: Message sent to ${emailAddress}: ${info.messageId}`, reportId: reportId, }) } const encryptAndSend = async (uidList, emailList, data, message) => { if (uidList.length > 0 && emailList.length > 0) { if (ANALYST_GROUP_MAIL) { prepareUnencryptedReportEmail(message, data, (m) => encryptMessage(uidList, ANALYST_GROUP_MAIL, m, data, sendMail), ) } else { console.error( 'Environmental variable ANALYST_GROUP_MAIL is not defined, so encrypted email is not sent!', ) } } else if (process.env.MAIL_LOCAL) { console.warn('Encrypted Mail: No certs to encrypt with!') const subjectSuffix = getEmailWarning(data) + getSelfHarmWord(data) prepareUnencryptedReportEmail(message, data, (m) => sendMail(process.env.MAIL_LOCAL, m, data.reportId, subjectSuffix), ) } else { console.warn('Encrypted Mail: No certs to encrypt with!') const subjectSuffix = getEmailWarning(data) + getSelfHarmWord(data) prepareUnencryptedReportEmail(message, data, (m) => sendMail(data.contactInfo.email, m, data.reportId, subjectSuffix), ) } } module.exports = { encryptAndSend } <|start_filename|>f2/src/utils/__tests__/saveBlob.test.js<|end_filename|> import { saveBlob } from '../saveBlob' describe('saveBlob', () => { it('logs an error if no blob storage keys, but does not crash', () => { console.warn = jest.fn() saveBlob([], {}) expect(console.warn).toHaveBeenCalled() }) }) <|start_filename|>f2/.storybook/formikDecorator.js<|end_filename|> import React from 'react' import { Formik } from 'formik' const validate = () => { const errors = { email: 'contactinfoForm.email.warning' } return errors } const FormikDecorator = (storyFn) => ( <Formik initialValues={{ testDay: '' }} onSubmit={(values) => { props.onSubmit(values) }} validate={validate} > {({ values }) => storyFn()} </Formik> ) export default FormikDecorator <|start_filename|>f2/cypress/integration/common/howyourbusinessaffected_page.js<|end_filename|> import { When } from 'cypress-cucumber-preprocessor/steps' When('I fill to Howyourbusinessaffected forms', () => { cy.get('form').find('[name="nameOfBusiness"]').type('<NAME>') cy.get('form').find('[name="industry"]').type('Financial Advisor') cy.get('form').find('[name="role"]').type('Expert Advisor') cy.get('form').find('[value="numberOfEmployee.1To99"]').check({ force: true }) }) When('I fill to Howyourbusinessaffected100 forms', () => { cy.get('form').find('[name="nameOfBusiness"]').type('<NAME>') cy.get('form').find('[name="industry"]').type('Business Consulting') cy.get('form') .find('[value="numberOfEmployee.100To499"]') .check({ force: true }) }) When('I fill to Howyourbusinessaffected500 forms', () => { cy.get('form').find('[name="nameOfBusiness"]').type('Rastcom Canada') cy.get('form').find('[name="role"]').type('Owner') cy.get('form') .find('[value="numberOfEmployee.500More"]') .check({ force: true }) }) When('I fill to NoHowyourbusinessaffected forms', () => {}) <|start_filename|>f2/src/utils/formatPostalCode.js<|end_filename|> export const formatPostalCode = (s) => { if (typeof s === 'string' && s.length > 0) { let s2 = s.toUpperCase().replace(/\s/g, '') return s2.substring(0, 3) + ' ' + s2.substring(3) } else return '' } <|start_filename|>f2/src/utils/regex.js<|end_filename|> export const regexDef = () => { return { phoneRegExp: /^(\+?\d{0,4})?\s?-?\s?(\(?\d{3}\)?)\s?-?\s?(\(?\d{3}\)?)\s?-?\s?(\(?\d{4}\)?)?$/, postalCodeRegex: /^[ABCEGHJKLMNPRSTVXY]\d[ABCEGHJKLMNPRSTVWXYZ]( )?\d[ABCEGHJKLMNPRSTVWXYZ]\d$/i, internationalPhonenumberRegex: /^\d{10,15}$/, phoneExtensionRegex: /^\d{1,8}$/, } } <|start_filename|>f2/src/components/link/__tests__/Link.test.js<|end_filename|> import React from 'react' import ReactDOM from 'react-dom' import { render, cleanup, fireEvent } from '@testing-library/react' import { MemoryRouter } from 'react-router-dom' import { ThemeProvider } from 'emotion-theming' import theme from '../../../theme' import { Link, A, LinkButton, ButtonLink } from '..' const clickOn = element => fireEvent.click(element) describe('Links', () => { afterEach(cleanup) const example = 'example' it('Renders a Link and A component without crashing', () => { const div = document.createElement('div') ReactDOM.render( <MemoryRouter initialEntries={['/']}> <ThemeProvider theme={theme}> <Link to="/">{example}</Link> </ThemeProvider> </MemoryRouter>, div, ) ReactDOM.render( <MemoryRouter initialEntries={['/']}> <ThemeProvider theme={theme}> <A href="http://www.google.com">{example}</A> </ThemeProvider> </MemoryRouter>, div, ) }) it('Renders accessible ButtonLink component without crashing', () => { const { getByRole } = render( <MemoryRouter initialEntries={['/']}> <ThemeProvider theme={theme}> <ButtonLink to="/">buttonlink</ButtonLink> </ThemeProvider> </MemoryRouter>, ) expect(getByRole('button')).not.toHaveProperty('href', undefined) }) it('Renders accessible LinkButton component without crashing', () => { const onClickMock = jest.fn() const { getAllByText } = render( <MemoryRouter initialEntries={['/']}> <ThemeProvider theme={theme}> <LinkButton onClick={onClickMock}>linkbutton</LinkButton> </ThemeProvider> </MemoryRouter>, ) const button = getAllByText('linkbutton') expect(button).toHaveLength(1) clickOn(button[0]) expect(onClickMock).toHaveBeenCalledTimes(1) }) }) <|start_filename|>f2/cypress/integration/common/attachsupportingevidence_page_fr.js<|end_filename|> import { When } from 'cypress-cucumber-preprocessor/steps' When('I fill AttachSupportingEvidence in French page forms', () => { const fileName1 = 'sample.txt' const fileName2 = 'testFile.pdf' const fileName3 = 'version.png' cy.get('#uploader').uploadFile(fileName1, 'text/plain') cy.wait(1000) cy.get('#uploader').uploadFile(fileName2, 'application/pdf') cy.wait(1000) cy.get('#uploader').uploadFile(fileName3, 'image/png') cy.wait(1000) //cy.screenshot() }) <|start_filename|>f2/src/setupTests.js<|end_filename|> import 'core-js/stable' import 'regenerator-runtime/runtime' import '@testing-library/jest-dom/extend-expect' import { configure } from 'enzyme' import Adapter from 'enzyme-adapter-react-16' import { matchers } from 'jest-emotion' expect.extend(matchers) configure({ adapter: new Adapter() }) process.env.GOOGLE_ANALYTICS_ID = 'UA-something' <|start_filename|>f2/src/ThankYouPage.js<|end_filename|> /** @jsx jsx */ import React from 'react' import { jsx } from '@emotion/core' import { useLingui } from '@lingui/react' import { Trans } from '@lingui/macro' import { H1, H2 } from './components/header' import { A, ButtonLink } from './components/link' import { Link } from './components/link' import { Ul } from './components/unordered-list' import { Li } from './components/list-item' import { InfoCard, LandingBox } from './components/container' import { Layout, Row } from './components/layout' import { Text } from './components/text' import { Stack, Box, Icon } from '@chakra-ui/core' import { useStateValue } from './utils/state' import { P } from './components/paragraph' import { Route } from 'react-router-dom' import { Page } from './components/Page' import { Alert } from './components/Messages' import { PdfReportPage } from './PdfReportPage' import { useLog } from './useLog' export const ThankYouPage = () => { const { i18n } = useLingui() const [state, dispatch] = useStateValue() const contactInfo = { ...state.formData.contactInfo, } // Message displayed on Thank you Page const reportId = state.reportId const submitted = state.submitted const submissionInProgress = !reportId || reportId === '' const submissionSucceeded = !submissionInProgress && reportId.startsWith('NCFRS-') const submissionFailed = !submissionInProgress && !submissionSucceeded let thankYouMessage let thankYouTitle if (submissionInProgress) { thankYouTitle = <Trans id="thankYouPage.title" /> thankYouMessage = <Trans id="thankYouPage.reportSubmission" /> } else if (submissionSucceeded) { thankYouTitle = <Trans id="thankYouPage.title" /> thankYouMessage = ( <Trans id="thankYouPage.referenceNumber" values={{ reference: reportId }}> <Text as="span" d="block" id="NCFRS" aria-live="polite" /> </Trans> ) } else { thankYouTitle = <Trans id="thankYouPage.titleError" /> thankYouMessage = ( <Text as="span" d="block" fontSize="xl" id="NCFRSError" aria-live="assertive" > <Trans id="thankYouPage.reportSubmissionError1" /> <A href={ 'tel:' + i18n._('thankYouPage.reportSubmissionError.phoneNumber') } > <Trans id="thankYouPage.reportSubmissionError.phoneNumber" /> </A> <Trans id="thankYouPage.reportSubmissionError2" /> </Text> ) } useLog('ThankYouPage') return ( <Page> <Layout columns={{ base: 4 / 4, md: 6 / 8, lg: 7 / 12 }} mb={-10} zIndex={1} > {state.doneFinalFeedback && ( <Alert status="success" withIcon> <Trans id="thankYouPage.feedback.success" /> </Alert> )} <Row> <InfoCard {...(submissionInProgress || submissionSucceeded ? { bg: 'green.200', borderColor: 'green.400' } : { bg: 'yellow.300', borderColor: 'yellow.400' })} color="black" spacing={6} columns={{ base: 4 / 4, md: 6 / 7 }} > <H1 mb={6}>{thankYouTitle}</H1> <P fontSize="2xl">{thankYouMessage}</P> {submissionFailed && ( <ButtonLink mt="auto" variantColor="yellow" title={i18n._('thankYouPage.confirmationPageButton')} to="/confirmation" className="white-button-link" > <Icon focusable="false" mr={2} ml={-2} name="chevron-left" size="28px" /> <Trans id="thankYouPage.confirmationPageButton" /> </ButtonLink> )} {submitted && <PdfReportPage />} </InfoCard> </Row> <Row> <LandingBox spacing={10} columns={{ base: 4 / 4, md: 6 / 7 }}> {state.doneFinalFeedback ? ( <Box> <H2 mb={2}> <Trans id="finalFeedbackThanks.title" /> </H2> <Trans id="thankYouPage.feedback.new" /> </Box> ) : ( <H2 mb={2}> <Trans id="thankYouPage.feedback" /> </H2> )} <ButtonLink mt="auto" variantColor="black" title={i18n._('thankYouPage.feedbackButton')} to="/finalFeedback" className="white-button-link" > <Trans id="thankYouPage.feedbackButton" /> <Icon focusable="false" ml={2} mr={-2} name="chevron-right" size="28px" /> </ButtonLink> </LandingBox> </Row> </Layout> <Box bg="gray.100" py={10}> <Layout columns={{ base: 4 / 4, md: 6 / 8, lg: 7 / 12 }} pt={10}> <Stack spacing={4} shouldWrapChildren> {submissionInProgress || (submissionSucceeded && ( <React.Fragment> <H2> <Trans id="thankYouPage.whatNextHeading" /> </H2> <P> {contactInfo.email && <Trans id="thankYouPage.summary" />} <Trans id="thankYouPage.whatNextParagraph" /> </P> <P> <Trans id="thankYouPage.whatNextParagraph2" /> <A href={ 'tel:' + i18n._('thankYouPage.whatNextParagraph2.phoneNumber') } > <Trans id="thankYouPage.whatNextParagraph2.phoneNumber" /> </A> <Trans id="thankYouPage.whatNextParagraph2.period" /> </P> </React.Fragment> ))} <H2> <Trans id="thankYouPage.helpResource" /> </H2> <Ul> <Li> <A href={ i18n.locale === 'en' ? 'https://www.rcmp-grc.gc.ca/en/cyber-safety/staying-cyber-healthy' : 'https://www.rcmp-grc.gc.ca/fr/cybersecurite/assurer-sa-securite-ligne' } isExternal > <Trans id="thankYouPage.helpResource0" /> </A> </Li> <Li> <A href={ i18n.locale === 'en' ? 'https://www.getcybersafe.gc.ca/index-en.aspx' : 'https://www.pensezcybersecurite.gc.ca/index-fr.aspx' } isExternal > <Trans id="thankYouPage.helpResource1" /> </A> </Li> <Li> <A href={ i18n.locale === 'en' ? 'https://antifraudcentre-centreantifraude.ca/protect-protegez-eng.htm' : 'https://antifraudcentre-centreantifraude.ca/protect-protegez-fra.htm' } isExternal > <Trans id="thankYouPage.helpResource2" /> </A> </Li> <Li> <A href={ i18n.locale === 'en' ? 'http://www.rcmp-grc.gc.ca/to-ot/tis-set/cyber-tips-conseils-eng.htm' : 'http://www.rcmp-grc.gc.ca/to-ot/tis-set/cyber-tips-conseils-fra.htm' } isExternal > <Trans id="thankYouPage.helpResource3" /> </A> </Li> </Ul> </Stack> </Layout> </Box> {/* After help section*/} <Layout pt={10} columns={{ base: 4 / 4, lg: 7 / 12 }}> <Stack spacing={6}> {submissionSucceeded && ( <Alert status="success" withIcon> <Trans id="thankYouPage.safelyCloseWindow" /> </Alert> )} {submissionSucceeded && ( <Box mb="auto"> <Route render={({ history }) => ( <Link onClick={() => { dispatch({ type: 'deleteFormData', }) }} to="/" > <Trans id="thankYouPage.createNewReport" /> </Link> )} /> </Box> )} </Stack> </Layout> </Page> ) } <|start_filename|>f2/src/utils/nextWhatWasAffectedUrl.js<|end_filename|> export const whatWasAffectedPages = { FINANCIAL: { key: 'whatWasAffectedForm.financial', url: 'moneylost', nextPageTextInPreviousPage: 'previousPageofMoneyLost.nextPage', }, INFORMATION: { key: 'whatWasAffectedForm.personalInformation', url: 'information', nextPageTextInPreviousPage: 'previousPageofInformation.nextPage', }, DEVICES: { key: 'whatWasAffectedForm.devices', url: 'devices', nextPageTextInPreviousPage: 'previousPageofDevices.nextPage', }, BUSINESS: { key: 'whatWasAffectedForm.business_assets', url: 'business', nextPageTextInPreviousPage: 'previousPageofBusiness.nextPage', }, OTHER: { key: 'whatWasAffectedForm.other', url: '', nextPageTextInPreviousPage: '', }, FIRST_PAGE: { key: 'whatWasAffectedForm', url: 'whatwasaffected', nextPageTextInPreviousPage: '', }, LAST_PAGE: { key: '', url: 'whathappened', nextPageTextInPreviousPage: 'previousPageofWhathappened.nextPage', }, CONFIRMATION: { key: '', url: 'confirmation', nextPageTextInPreviousPage: 'previousPageofConfirmation.nextPage', }, } export const whatWasAffectedNavState = { affectedOptions: [], currentPage: whatWasAffectedPages.FIRST_PAGE, nextPage: '', editOptions: false, } export const orderSelection = (selection) => { //Get ordered array of pages const pageOrder = Object.values(whatWasAffectedPages).map((page) => { return page.key }) //Order selection using ordered pages const orderedSelection = pageOrder.filter((page) => { return selection.includes(page) }) return orderedSelection } export const nextPage = (navObject, doneForms) => { try { const selectedOptions = navObject.affectedOptions const lastSelection = selectedOptions.slice(-1)[0] let nextPage let index //If there are no more pages to display proceed to What Happened or Confirmation. if ( navObject.currentPage.key === lastSelection || selectedOptions.length === 0 ) { return doneForms ? whatWasAffectedPages.CONFIRMATION : whatWasAffectedPages.LAST_PAGE } if (navObject.currentPage.key === whatWasAffectedPages.FIRST_PAGE.key) { //Leaving What Was Affected, proceed to first selection. index = selectedOptions[0] } else { //Get next selection. const currentIndex = selectedOptions.indexOf(navObject.currentPage.key) index = selectedOptions[currentIndex + 1] } nextPage = Object.values(whatWasAffectedPages).filter((page) => { return page.key === index })[0] return nextPage } catch (error) { //If an error occurs default to What Happened return doneForms ? whatWasAffectedPages.CONFIRMATION : whatWasAffectedPages.LAST_PAGE } } export const updateNavigation = (doneForms, whatWasAffectedNavState) => { if (doneForms && !whatWasAffectedNavState.editOptions) { whatWasAffectedNavState.nextPage = whatWasAffectedPages.CONFIRMATION } else { whatWasAffectedNavState.nextPage = nextPage( whatWasAffectedNavState, doneForms, ) } if (whatWasAffectedNavState.nextPage === whatWasAffectedPages.CONFIRMATION) { whatWasAffectedNavState.editOptions = false } } <|start_filename|>f2/src/summary/WhenDidItHappenSummary.js<|end_filename|> /** @jsx jsx */ import React from 'react' import { jsx } from '@emotion/core' import { Trans } from '@lingui/macro' import { Stack, Flex } from '@chakra-ui/core' import { useStateValue } from '../utils/state' import { containsData } from '../utils/containsData' import { formatDate } from '../utils/formatDate' import { testdata } from '../ConfirmationSummary' import { EditButton } from '../components/EditButton' import { H2 } from '../components/header' import { DescriptionListItem } from '../components/DescriptionListItem' import { Text } from '../components/text' export const WhenDidItHappenSummary = (props) => { const [data] = useStateValue() const whenDidItHappen = { ...testdata.formData.whenDidItHappen, ...data.formData.whenDidItHappen, } let freqString if (whenDidItHappen.incidentFrequency === 'once') { freqString = <Trans id="whenDidItHappenPage.options.once" /> } else if (whenDidItHappen.incidentFrequency === 'moreThanOnce') { freqString = <Trans id="whenDidItHappenPage.options.moreThanOnce" /> } else { freqString = <Trans id="whenDidItHappenPage.options.notSure" /> } return ( <React.Fragment> {false ? ( <div> {/*: mark the proper ids for lingui */} <Trans id="confirmationPage.howDidItStart.overviewPrefix" /> <Trans id="whenDidItHappenPage.dateRange.start.label" /> <Trans id="whenDidItHappenPage.dateRange.end.label" /> <Trans id="whenDidItHappenPage.singleDate.label" /> <Trans id="confirmationPage.howManyTimes" /> <Trans id="whenDidItHappenPage.options.notSure.details" /> <Trans id="whenDidItHappenPage.details" /> </div> ) : null} <Stack spacing={4} borderBottom="2px" borderColor="gray.300" pb={4} {...props} > <Flex align="baseline"> <H2 fontWeight="normal"> <Trans id="whenDidItHappenPage.title" /> </H2> <EditButton path="/whenDidItHappen" label="confirmationPage.howDidItStart.title.edit" /> </Flex> {containsData(whenDidItHappen) ? ( <React.Fragment> <Stack as="dl" spacing={4}> <DescriptionListItem descriptionTitle="confirmationPage.howManyTimes" description={freqString} /> <DescriptionListItem descriptionTitle="whenDidItHappenPage.singleDate.label" description={formatDate( whenDidItHappen.happenedOnceDay, whenDidItHappen.happenedOnceMonth, whenDidItHappen.happenedOnceYear, )} /> <DescriptionListItem descriptionTitle="whenDidItHappenPage.dateRange.start.label" description={formatDate( whenDidItHappen.startDay, whenDidItHappen.startMonth, whenDidItHappen.startYear, )} /> <DescriptionListItem descriptionTitle="whenDidItHappenPage.dateRange.end.label" description={formatDate( whenDidItHappen.endDay, whenDidItHappen.endMonth, whenDidItHappen.endYear, )} /> {containsData(whenDidItHappen.description) ? ( <DescriptionListItem descriptionTitle="whenDidItHappenPage.details" description={whenDidItHappen.description} /> ) : null} </Stack> </React.Fragment> ) : ( <Text> <Trans id="confirmationPage.howDidItStart.nag" /> </Text> )} </Stack> </React.Fragment> ) } <|start_filename|>f2/src/components/warning-banner/index.js<|end_filename|> /* eslint-disable react/no-unescaped-entities */ /** @jsx jsx **/ import { jsx } from '@emotion/core' import PropTypes from 'prop-types' import { Alert, AlertIcon, AlertDescription, Box } from '@chakra-ui/core' import { Layout } from '../layout' export const WarningBanner = (props) => { return ( <Box bg={`${props.bg}.400`}> <Layout> <Alert px={0} py={10} status={props.status} bg={`${props.bg}.400`} fontFamily="body" > <AlertIcon mt={0} color="black" /> <AlertDescription color="black">{props.children}</AlertDescription> </Alert> </Layout> </Box> ) } WarningBanner.propTypes = { bg: PropTypes.string, } WarningBanner.defaultProps = { bg: 'yellow', status: 'warning', } <|start_filename|>f2/src/utils/filenameUtils.js<|end_filename|> const getFileExtension = (filename) => { const a = filename.split('.') if (a.length === 1 || (a[0] === '' && a.length === 2)) { return '' } return a.pop().toLowerCase() } module.exports = { getFileExtension } <|start_filename|>f2/src/pdf/EvidenceInfoView.js<|end_filename|> /** @jsx jsx */ import { jsx } from '@emotion/core' import { testdata } from '../ConfirmationSummary' import { Text, View, Image } from '@react-pdf/renderer' import { pdfStyles } from './pdfStyles' import line from '../images/line.png' export const EvidenceInfoView = (props) => { const lang = props.lang const evidence = { files: [], fileDescriptions: [], ...testdata.formData.evidence, ...props.data.formData.evidence, } return ( <View style={pdfStyles.section}> <Text style={pdfStyles.title}> {lang['confirmationPage.evidence.title']} </Text> {evidence.files && evidence.files.length > 0 ? ( <View> {evidence.files ? ( <View> {evidence.files.map((file, index) => ( <View> <Text style={pdfStyles.sectionContent}> {index + 1}. &nbsp; <Text style={pdfStyles.descriptionContentTitle}> {file.name} </Text> </Text> <Text style={{ fontSize: 12, marginTop: 8, marginBottom: 10, marginLeft: 28, }} > {evidence.fileDescriptions[index]} </Text> </View> ))} </View> ) : null} </View> ) : ( <Text style={pdfStyles.sectionContent}> {lang['confirmationPage.evidence.nag']} </Text> )} <Image style={pdfStyles.sectionSeparator} src={line} /> </View> ) } <|start_filename|>f2/src/components/checkbox/index.js<|end_filename|> /** @jsx jsx */ import React from 'react' import PropTypes from 'prop-types' import { jsx } from '@emotion/core' import { Text } from '../text' import { UniqueID } from '../unique-id' import { VisuallyHidden, ControlBox, Icon, Flex } from '@chakra-ui/core' import { useField } from 'react-final-form' import { ConditionalForm } from '../container' import canada from '../../theme/canada' export const CheckboxAdapter = ({ name, value, defaultIsChecked, children, ...props }) => { const { input: { checked, ...input }, meta: { error, touched }, } = useField(name, { type: 'checkbox', // important for RFF to manage the checked prop value, // important for RFF to manage list of strings defaultIsChecked, }) return ( <Checkbox input={input} isChecked={checked || defaultIsChecked} isInvalid={error && touched} conditionalField={props.conditionalField} > {children} </Checkbox> ) } export const Checkbox = ({ input, label, isChecked, ...props }) => { const isCheckedAndHasCondition = isChecked && props.conditionalField return ( <UniqueID> {id => { return ( <React.Fragment> <Flex as="label" id={id} align="start" d="inline-flex"> <VisuallyHidden as="input" type="checkbox" defaultChecked={isChecked ? 'true' : ''} {...input} /> <ControlBox {...canada.variants.inputs.checkboxes}> <Icon name="check" size="24px" /> </ControlBox> <Text as="div" ml={2} pt={2} htmlFor={id} lineHeight="1.5rem"> {props.children} </Text> </Flex> {isCheckedAndHasCondition && ( <ConditionalForm>{props.conditionalField}</ConditionalForm> )} </React.Fragment> ) }} </UniqueID> ) } Checkbox.propTypes = { conditionalField: PropTypes.any, children: PropTypes.any, } CheckboxAdapter.propTypes = { name: PropTypes.string, value: PropTypes.string, defaultIsChecked: PropTypes.bool, conditionalField: PropTypes.any, children: PropTypes.any, } <|start_filename|>f2/src/utils/navigationWarning.js<|end_filename|> const naviagationWarning = (e) => { e.preventDefault() e.returnValue = '' } //Add event listener to warn user if they navigate away from page. export const setBeforeUnloadWarning = () => { window.addEventListener('beforeunload', naviagationWarning) } export const removeBeforeUnloadWarning = () => { //Remove the event listener as the user has submitted and will not lose data by navigating away. window.removeEventListener('beforeunload', naviagationWarning) } <|start_filename|>f2/src/forms/MidFeedbackForm.js<|end_filename|> /** @jsx jsx */ import React, { useState } from 'react' import PropTypes from 'prop-types' import { jsx } from '@emotion/core' import { H1, H2 } from '../components/formik/header' import { FeedbackButton, MidFormFeedbackButton, } from '../components/formik/button' import { useLocation } from 'react-router-dom' import { Trans } from '@lingui/macro' import { Form, Container, Row } from 'react-bootstrap' import { Formik, FieldArray, Field } from 'formik' import { CheckBoxRadio } from '../components/formik/checkboxRadio' import { TextArea } from '../components/formik/textArea' import { Box } from '../components/formik/box' import { Error, Info } from '../components/formik/alert' import { WarningModal } from '../components/formik/warningModal' export const MidFeedbackForm = (props) => { const [isSubmit, setIsSubmit] = useState('') const [isOpen, setIsOpen] = useState(false) const location = useLocation() const midFeedback = [ { name: 'confuseProblem', checkboxLabel: <Trans id="midFeedback.problem.confusing" />, checkboxValue: 'midFeedback.problem.confusing', }, { name: 'brokenProblem', checkboxLabel: <Trans id="midFeedback.problem.broken" />, checkboxValue: 'midFeedback.problem.broken', }, { name: 'adaptiveProblem', checkboxLabel: <Trans id="midFeedback.problem.adaptive" />, checkboxValue: 'midFeedback.problem.adaptive', }, { name: 'worryProblem', checkboxLabel: <Trans id="midFeedback.problem.worry" />, checkboxValue: 'midFeedback.problem.worry', }, { name: 'otherProblem', checkboxLabel: <Trans id="midFeedback.problem.other" />, checkboxValue: 'midFeedback.problem.other', }, ] return ( <React.Fragment> {isSubmit ? ( <Info> <H2> <Trans id="midFeedback.thankYou" /> </H2> </Info> ) : ( <Container> <Row> <MidFormFeedbackButton onClick={() => setIsOpen(!isOpen)} label={<Trans id="midFeedback.summary" />} /> </Row> {isOpen && ( <Row> <Box color="rgb(232, 232, 232)"> <Row> <H1> <Trans id="midFeedback.title" /> </H1> </Row> <Formik initialValues={{ page: location.pathname, midFeedback: [], problemDescription: '', }} initialStatus={{ showWarning: false }} onSubmit={(values, { setStatus }) => { if ( values.midFeedback.length === 0 && values.problemDescription.length === 0 ) { setStatus({ showWarning: true }) } else { setIsSubmit('feedback.submitted') props.onSubmit(values) } }} > {({ handleSubmit, handleChange, handleBlur, status, dirty, isSubmitting, }) => ( <Form onSubmit={handleSubmit}> <WarningModal dirty={dirty} isSubmitting={isSubmitting} /> <Row className="form-question"> {status.showWarning ? ( <Error> <Trans id="finalFeedback.warning" /> </Error> ) : null} </Row> <Row className="form-question"> <Row className="form-label" style={{ marginTop: '1rem' }} > <Trans id="midFeedback.problem.label" /> </Row> <Row className="form-helper-text"> <Trans id="midFeedback.problem.helperText" /> </Row> </Row> <Row className="form-section"> <FieldArray name="midFeedback" className="form-section" render={() => midFeedback.map((question) => { return ( <React.Fragment key={question.name}> <Field name="midFeedback" label={question.checkboxLabel} component={CheckBoxRadio} value={question.checkboxValue} onChange={handleChange} onBlur={handleBlur} type="checkbox" id={'checkbox-' + question.name} ></Field> </React.Fragment> ) }) } /> </Row> <Row className="form-section"> <Field name="problemDescription" label={<Trans id="midFeedback.description.label" />} helpText={ <Trans id="midFeedback.description.helperText" /> } component={TextArea} onChange={handleChange} onBlur={handleBlur} id="problemDescription" type="text" /> </Row> <Row> <FeedbackButton label={<Trans id="finalFeedback.submit" />} /> </Row> </Form> )} </Formik> </Box> </Row> )} </Container> )} </React.Fragment> ) } MidFeedbackForm.propTypes = { onSubmit: PropTypes.func.isRequired, } <|start_filename|>f2/src/forms/PrivacyConsentInfoFormSchema.js<|end_filename|> import React from 'react' import * as Yup from 'yup' import { Trans } from '@lingui/macro' const privacyConsentInfoFormSchema = Yup.object().shape({ consentOptions: Yup.string().required( <Trans id="privacyConsentInfoForm.hasValidationErrors" />, ), }) export const PrivacyConsentInfoFormSchema = () => { return privacyConsentInfoFormSchema } <|start_filename|>f2/src/utils/notify.js<|end_filename|> const fs = require('fs') const NotifyClient = require('notifications-node-client').NotifyClient const key = process.env.NOTIFY_API_KEY const baseUrl = process.env.NOTIFY_API_BASE_URL let langJson = fs.readFileSync('src/locales/en.json') let lang = JSON.parse(langJson) const notifyEnvVars = [ 'NOTIFY_API_KEY', 'NOTIFY_API_BASE_URL', 'NOTIFY_ENGLISH_CONFIRMATION_TEMPLATE_ID', 'NOTIFY_FRENCH_CONFIRMATION_TEMPLATE_ID', ] let notifyIsSetup = true notifyEnvVars.forEach((k) => { if (!process.env[`${k}`]) { notifyIsSetup = false console.warn( `ERROR: Notify environment variable ${k} is missing. Emailing links will probably not work.`, ) } }) const notifyClient = process.env.NODE_ENV !== 'test' && key && baseUrl ? new NotifyClient(baseUrl, key) : false if (notifyClient) console.info('Notify client created') else console.warn('ERROR: Notify client not created') const sendConfirmation = async (email, reportId, language) => { let templateId if (language === 'fr') templateId = process.env.NOTIFY_FRENCH_CONFIRMATION_TEMPLATE_ID else templateId = process.env.NOTIFY_ENGLISH_CONFIRMATION_TEMPLATE_ID if (!email || !templateId) { console.warn('ERROR: could not send confirmation email') return false } try { const response = notifyClient.sendEmail(templateId, email, { personalisation: { reportId }, }) console.info('Notify: confirmation email (probably) sent!') return response.body } catch (err) { console.warn(`ERROR: Notify confirmation email error: ${err.message}`) return false } } const submitFeedback = async (data) => { const templateId = process.env.NOTIFY_FEEDBACK_TEMPLATE_ID const email = process.env.FEEDBACK_EMAIL if (!email || !templateId) { console.warn( `WARNING: no Notify report template ID or email was passed for feedback ${data}`, ) return false } try { let feedbacks = JSON.parse(data) let question1Str = 'Was service hard?' let answer1Str = lang[feedbacks.wasServiceHard] === undefined? '' : lang[feedbacks.wasServiceHard] let question2Str = 'How can we do better?' let answer2Str = feedbacks.howCanWeDoBetter let question3Str = '' let answer3Str = '' if (data.includes('midFeedback')){ question1Str = 'Page:' answer1Str = feedbacks.page question2Str = 'What kind of problem is happening?' answer2Str = '' for(let feedback of feedbacks.midFeedback) { answer2Str += lang[feedback] answer2Str += '\n' } question3Str = 'Problem discription:' answer3Str = feedbacks.problemDescription } const response = notifyClient.sendEmail(templateId, email, { personalisation: { question1: question1Str, answer1: answer1Str, question2: question2Str, answer2: answer2Str, question3: question3Str, answer3: answer3Str} }) console.info('Notify: feedback email (probably) sent!') return response.body } catch (err) { console.warn(`Notify feedback email error: ${err.message}`) return false } } module.exports = { notifyIsSetup, sendConfirmation, submitFeedback, } <|start_filename|>f2/cypress/support/index.js<|end_filename|> // *********************************************************** // This example support/index.js is processed and // loaded automatically before your test files. // // This is a great place to put global configuration and // behavior that modifies Cypress. // // You can change the location of this file or turn off // automatically serving support files with the // 'supportFile' configuration option. // // You can read more here: // https://on.cypress.io/configuration // *********************************************************** // Import commands.js using ES2015 syntax: import './commands' const { A11yReporter } = require ('@cdssnc/a11y-tracker-client'); A11yReporter.configure({ trackerURI: undefined, revision: '<local>', project: 'report-cyber-crime', }); if (process.env.NODE_ENV !== 'production' && process.env.GITHUB_REF === 'refs/heads/master') { A11yReporter.configure({ trackerURI: process.env.A11Y_TRACKER_URI || 'https://a11y-tracker.herokuapp.com/', revision: process.env.GITHUB_GIT_HASH, key: process.env.A11Y_TRACKER_KEY, project: 'report-cyber-crime', }); } A11yReporter.setupCypress(); <|start_filename|>f2/src/components/formik/row/index.js<|end_filename|> import { Row } from 'react-bootstrap' import styled from '@emotion/styled' import { css } from '@emotion/core' import { cleanProps } from '../../../utils/cleanProps' import { space, color, display, border, borderColor, width, height, position, zIndex, typography, } from 'styled-system' const separator = (props) => props.separator ? css` border-bottom: 2px solid; border-color: rgb(232, 232, 232); ` : null export const FormRow = styled(Row, { shouldForwardProp: (prop) => cleanProps(prop), })` ${separator} margin-bottom: 1rem; width: 100%; ${space}; ${color}; ${display}; ${border}; ${borderColor}; ${width}; ${height}; ${position}; ${zIndex}; ${typography} ` <|start_filename|>f2/src/utils/formatDate.js<|end_filename|> module.exports = { formatDate(day, month, year) { const paddedMonth = month ? month.toString().padStart(2, '0') : '00' const paddedDay = day ? day.toString().padStart(2, '0') : '00' return `${year}-${paddedMonth}-${paddedDay}` .replace(/undefined/g, '') .replace(/-00/g, '') }, } <|start_filename|>f2/src/forms/WhoAreYouReportForForm.js<|end_filename|> import React from 'react' import PropTypes from 'prop-types' import { Trans } from '@lingui/macro' import { useStateValue } from '../utils/state' import { Form, Container, Row } from 'react-bootstrap' import { Formik, FieldArray, Field, ErrorMessage } from 'formik' import { Error } from '../components/formik/alert' import { CheckBoxRadio } from '../components/formik/checkboxRadio' import { TextArea } from '../components/formik/textArea' import { P, ErrorText } from '../components/formik/paragraph' import { NextCancelButtons } from '../components/formik/button' import { formDefaults } from './defaultValues' import { WhoAreYouReportForFormSchema } from './WhoAreYouReportForFormSchema' import { ErrorSummary } from '../components/formik/alert' import { WarningModal } from '../components/formik/warningModal' const createErrorSummary = (errors) => { const errorSummary = {} if (errors.whoYouReportFor) { errorSummary['whoYouReportFor'] = { label: <Trans id="whoAreYouReportForPage.title" />, message: <Trans id="whoAreYouReportForPage.hasValidationErrors" />, } } return errorSummary } export const WhoAreYouReportForForm = (props) => { const [data] = useStateValue() const whoAreYouReportFor = { ...formDefaults.whoAreYouReportFor, ...data.formData.whoAreYouReportFor, } const optionsList = [ { name: 'someoneDescription', value: 'whoAreYouReportForPage.options.someone', label: <Trans id="whoAreYouReportForPage.someone.label" />, hint: <Trans id="whoAreYouReportForPage.someone.helperText" />, }, { name: 'businessDescription', value: 'whoAreYouReportForPage.options.business', label: <Trans id="whoAreYouReportForPage.business.label" />, hint: <Trans id="whoAreYouReportForPage.business.helperText" />, }, ] return ( <React.Fragment> <Formik initialValues={whoAreYouReportFor} onSubmit={(values) => { optionsList.forEach((question) => { if (values.whoYouReportFor !== question.value) { values[question.name] = '' } }) props.onSubmit(values) }} validationSchema={WhoAreYouReportForFormSchema()} > {({ handleSubmit, handleChange, handleBlur, errors, submitCount, dirty, isSubmitting, }) => ( <Form onSubmit={handleSubmit}> <WarningModal dirty={dirty} isSubmitting={isSubmitting} /> <Container> <Row className="form-question"> {Object.keys(errors).length > 0 && ( <ErrorSummary errors={createErrorSummary(errors)} submissions={submitCount} title={<Trans id="default.hasValidationErrors" />} /> )} </Row> <Row className="form-section" id="whoYouReportFor"> {errors && errors.whoYouReportFor && ( <ErrorText> <Trans id="whoAreYouReportForPage.hasValidationErrors" /> </ErrorText> )} <React.Fragment key="myselfDescription"> <Field name="whoYouReportFor" label={<Trans id="whoAreYouReportForPage.options.myself" />} component={CheckBoxRadio} value="whoAreYouReportForPage.options.myself" onChange={handleChange} onBlur={handleBlur} type="radio" id={'radio-myselfDescription'} /> </React.Fragment> <React.Fragment key="Or"> <P ml="0.5rem" mb="0.5rem" fontSize="1.25rem"> <Trans id="whoAreYouReportForPage.or" /> </P> </React.Fragment> <FieldArray name="whoYouReportFor" className="form-section" render={() => optionsList.map((question) => { return ( <React.Fragment key={question.name}> <Field name="whoYouReportFor" label={<Trans id={question.value} />} component={CheckBoxRadio} value={question.value} onChange={handleChange} onBlur={handleBlur} type="radio" id={'radio-' + question.name} > <ErrorMessage name={question.name} component={Error} /> <Field name={question.name} label={question.label} helpText={question.hint} component={TextArea} onBlur={handleBlur} onChange={handleChange} /> </Field> </React.Fragment> ) }) } /> </Row> <Row> <NextCancelButtons submit={<Trans id="whoAreYouReportForPage.nextButton" />} cancel={<Trans id="button.cancelReport" />} label={<Trans id="whoAreYouReportForPage.nextPage" />} /> </Row> </Container> </Form> )} </Formik> </React.Fragment> ) } WhoAreYouReportForForm.propTypes = { onSubmit: PropTypes.func.isRequired, } <|start_filename|>f2/src/utils/__tests__/acceptableFiles.test.js<|end_filename|> import { fileExtensionPasses, fileSizePasses } from '../acceptableFiles' describe('fileExtensionPasses', () => { it('passes if extension allowed', () => { expect(fileExtensionPasses('file.jpg')).toEqual(true) expect(fileExtensionPasses('anotherfile.test.txt')).toEqual(true) }) it('fails if extension not allowed', () => { expect(fileExtensionPasses('file.nope')).toEqual(false) expect(fileExtensionPasses('anotherfile')).toEqual(false) }) }) describe('fileSizePasses', () => { it('passes if file size small', () => { expect(fileSizePasses(10)).toEqual(true) }) it('fails if file size zero', () => { expect(fileSizePasses(0)).toEqual(false) }) it('fails if file size too big', () => { expect(fileSizePasses(5 * 1024 * 1024)).toEqual(false) }) }) <|start_filename|>f2/cypress/integration/homepage/homepage.js<|end_filename|> import { Given, Then } from 'cypress-cucumber-preprocessor/steps' Given('I open the report home page', () => { cy.visit(Cypress.env('dev')) }) Then('Inject axe and check for accessibility issues', () => { cy.reportA11y() }) <|start_filename|>f2/src/components/FormErrorMessage/__tests__/FormErrorMessage.test.js<|end_filename|> import React from 'react' import { FormErrorMessage } from '../' import ReactDOM from 'react-dom' import { ThemeProvider } from 'emotion-theming' import canada from '../../../theme/canada' import { render, fireEvent, cleanup } from '@testing-library/react' import { Form } from 'react-final-form' import { Field } from '../../Field' import { I18nProvider } from '@lingui/react' import { i18n } from '@lingui/core' import en from '../../../locales/en.json' import wait from 'waait' i18n.load('en', { en }) i18n.activate('en') const clickOn = (element) => fireEvent.click(element) describe('<FormErrorMessage />', () => { afterEach(cleanup) it('renders without crashing', () => { const FormArrayControl = document.createElement('FormArrayControl') ReactDOM.render(<FormErrorMessage />, FormArrayControl) }) it('does not render if validation passes', () => { const submitMock = jest.fn() const validate = (values) => { const errors = {} //condition for an error to occur: append a lingui id to the list of error if (!values.foo) { errors.foo = 'bar' } return errors } const { queryByText } = render( <I18nProvider i18n={i18n}> <ThemeProvider theme={canada}> <Form initialValues="" validate={validate} onSubmit={(values) => { submitMock(values) }} render={({ handleSubmit, values, errors }) => ( <form onSubmit={handleSubmit}> <FormErrorMessage onSubmit={handleSubmit} errors={errors} /> <Field name="foo" initialValue="baz" /> </form> )} /> </ThemeProvider> </I18nProvider>, ) expect(queryByText(/bar/)).toBeNull() }) it('displays an error message', async () => { const submitMock = jest.fn() const validate = (values) => { const errors = {} //condition for an error to occur: append a lingui id to the list of error if (values.foo === 'baz') { errors.foo = 'bar' } return errors } const { queryAllByText, getByText } = render( <I18nProvider i18n={i18n}> <ThemeProvider theme={canada}> <Form initialValues="" validate={validate} onSubmit={(values) => { submitMock(values) }} render={({ handleSubmit, values, errors, submitFailed, hasValidationErrors, }) => ( <form onSubmit={handleSubmit}> {submitFailed && hasValidationErrors ? ( <FormErrorMessage onSubmit={handleSubmit} errors={errors} /> ) : null} <Field name="foo" label="label" helperText="heeeelp" errorMessage="bar" initialValue="baz" /> <button type="submit">Submit</button> </form> )} /> </ThemeProvider> </I18nProvider>, ) //Errors should display on submit. At first expect to have no error message expect(queryAllByText(/bar/)).toHaveLength(0) await wait(0) // Wait for promises to resolve //get the submit button, then click on it. Error message renders only on submit const context = document.querySelector('[type="submit"]').textContent const submitButton = getByText(context) clickOn(submitButton) await wait(0) // Wait for promises to resolve expect(queryAllByText(/bar/)).toHaveLength(1) }) }) <|start_filename|>f2/cypress/integration/common/whathappened_page_fr.js<|end_filename|> import { When } from 'cypress-cucumber-preprocessor/steps' When('I fill Whathappened in French page forms', () => { cy.fixture('form_data.json').then((user) => { var paragraph = user.small_fr cy.get('form').find('[name="whatHappened"]').type(paragraph) }) }) When('I fill WhathappenedHarmful in French page forms', () => { cy.fixture('form_data.json').then((user) => { var paragraph = user.harmful_fr cy.get('form').find('[name="whatHappened"]').type(paragraph) }) }) <|start_filename|>f2/src/components/Field/__tests__/Field.test.js<|end_filename|> import React from 'react' import { ThemeProvider } from 'emotion-theming' import canada from '../../../theme/canada' import { render, cleanup } from '@testing-library/react' import { Field } from '../' import { Form } from 'react-final-form' describe('<Field />', () => { afterEach(cleanup) it('renders', () => { const submitMock = jest.fn() render( <ThemeProvider theme={canada}> <Form initialValues="" onSubmit={submitMock} render={() => <Field name="name" label="foo" helperText="help" />} /> </ThemeProvider>, ) }) }) <|start_filename|>f2/src/utils/validateDate.js<|end_filename|> //import isExists from 'date-fns/isExists' import isFuture from 'date-fns/isFuture' import getDaysInMonth from 'date-fns/getDaysInMonth' import { containsData } from './containsData' import moment from 'moment' export const validateDate = (y, m, d) => { const year = parseInt(y, 10) const monthIndex = parseInt(m, 10) - 1 // 0 indexed months const day = parseInt(d, 10) const date = new Date(year, monthIndex, day) let validate = [] let isYear, isMonth, isDay const hasYear = containsData(year) const hasMonth = containsData(monthIndex) const hasDay = containsData(day) // 1. Date must contain a day a month and a year // 2. Date must be in the past // 3. Field ...X is not valid // day is between 1 and the month's last day. // Requires a date to validate against. // new Date with year and month to prevent date-forwarding (jan 32 == feb 1) if (day > getDaysInMonth(new Date(year, monthIndex)) || day < 1) isDay = 'notDay' // month is between 0 and 11 if (monthIndex > 11 || monthIndex < 0) isMonth = 'notMonth' // is not in the future, while all fields are valid !isMonth && !isDay && !isYear && isFuture(date) && validate.push('isFuture') //Year is over 1867 :eyes: year < 1867 && validate.push('notYear') // number of digits in year is 4 if (y && y.length < 4 && y.length > 0) isYear = 'yearLength' // Missing fields these are ONLY ok if no other errors exist !hasYear && validate.push('hasNoYear') !hasMonth && validate.push('hasNoMonth') !hasDay && validate.push('hasNoDay') //Remove the missing fields errors only if ALL are missing if (!hasYear && !hasMonth && !hasDay) validate = validate.filter((error) => !error.includes('hasNo')) // Pushing values to validate[] isYear && validate.push(isYear) isMonth && validate.push(isMonth) isDay && validate.push(isDay) return validate } //Assumes Date objects passed as params export const validateDateRange = (startDate, endDate) => { let dateRange = [] if (startDate >= endDate) { dateRange.push('whenDidItHappen.endBeforeStart') } return dateRange } export const evalDate = (day, month, year) => { let errors = {} if (!day && !month && !year) { //Do not validate empty input return errors } if (!isFinite(day) || day > 31 || day === '00') { errors['day'] = 'invalid input' } if (!isFinite(month) || month > 12 || month === '00') { errors['month'] = 'invalid input' } if (!isFinite(year) || year === '0000') { errors['year'] = 'invalid input' } if (day && month && year) { const date = moment(`${month} ${day} ${year}`, 'MM DD YYYY') if (!date.isValid()) { errors['date'] = 'invalid date' } else if (year && date.isAfter(moment.now())) { errors['future'] = 'invalid date' } } return errors } export const evalDateRange = (values) => { let errors = {} let startError = {} let endError = {} let startDate let endDate startError = evalDate(values.startDay, values.startMonth, values.startYear) if (Object.keys(startError).length > 0) { errors['startError'] = startError } else { startDate = moment( `${values.startMonth} ${values.startDay} ${values.startYear}`, 'MM DD YYYY', ) } endError = evalDate(values.endDay, values.endMonth, values.endYear) if (Object.keys(endError).length > 0) { errors['endError'] = endError } else { endDate = moment( `${values.endMonth} ${values.endDay} ${values.endYear}`, 'MM DD YYYY', ) } if (startDate && endDate) { if (startDate.isAfter(endDate)) { errors['endError'] = 'End date must be after start date' } } return errors } <|start_filename|>f2/src/utils/submitReportToServer.js<|end_filename|> var fs = require('fs') const flatten = require('flat') const fetch = require('isomorphic-fetch') const FormData = require('form-data') const { formDefaults } = require('../forms/defaultValues') async function submitReportToServer(url = '', data = {}) { const flattenedData = flatten(data, { safe: true }) console.log(flattenedData) var form_data = new FormData() Object.keys(flattenedData).forEach((key) => { form_data.append(key, JSON.stringify(flattenedData[key])) }) if (data.evidence) data.evidence.files.forEach((f) => form_data.append(f.name, f, f.name)) form_data.append( 'bread.jpg', fs.createReadStream( '/Users/stephen/Git/report-a-cybercrime/utils/bread.jpg', ), ) const response = await fetch(url, { method: 'POST', mode: 'cors', cache: 'no-cache', credentials: 'same-origin', redirect: 'follow', referrer: 'no-referrer', body: form_data, }) console.log(`${response.status} (${response.statusText})`) } let data = JSON.parse(JSON.stringify(formDefaults)) data.contactInfo.fullName = 'Mallory' // data.contactInfo.extra = 'extra field!' submitReportToServer('http://localhost:3000/submit', data) <|start_filename|>f2/src/utils/acceptableFiles.js<|end_filename|> const { getFileExtension } = require('./filenameUtils') const acceptableExtensions = '.png, .jpg, .jpeg, .doc, .docx, .xls, .xlsx, .pdf, .txt, .rtf' .split(',') .map((ext) => ext.trim()) const fileExtensionPasses = (fileName) => { return acceptableExtensions.indexOf('.' + getFileExtension(fileName)) > -1 } const fileSizePasses = (fileSize) => fileSize > 0 && fileSize <= 4 * 1024 * 1024 module.exports = { acceptableExtensions, fileExtensionPasses, fileSizePasses } <|start_filename|>f2/src/utils/formatAnalystEmail.js<|end_filename|> // 'use strict' const { getFileExtension } = require('./filenameUtils') const fs = require('fs') const { formatDate } = require('./formatDate') var zipcodes = require('zipcodes') const unCamel = (text) => text.replace(/([A-Z])|([\d]+)/g, ' $1$2').toLowerCase() const formatLineHtml = (label, text) => text && text !== '' ? `<tr><td style="width:300px">${label}</td><td>${text}</td></tr>\n` : '' const formatTable = (rows) => `<table><tbody>\n${rows}</tbody></table>\n\n` const formatDownloadLink = (filename, url) => `<tr><td colspan='2'><a href='${url}'>Download ${filename}</a></tr></td>\n` const formatSection = (title, rows) => `<h2>${title}</h2>\n` + (rows !== '' ? formatTable(rows) : lang['analystReport.noData']) let lang let langEn = fs.readFileSync('src/locales/en.json') let langFr = fs.readFileSync('src/locales/fr.json') let langJsonEn = JSON.parse(langEn) let langJsonFr = JSON.parse(langFr) const formatReportInfo = (data) => { //set language to use based report language data.language === 'en' ? (lang = langJsonEn) : (lang = langJsonFr) let selfHarmString = data.language === 'en' ? 'None' : 'Aucun' let returnString = '' if (data.selfHarmWords.length) { selfHarmString = lang['analystReport.selfHarmString'] returnString = `\n\n<h1 style="background-color:yellow;">` + lang['analystReport.selfHarmWord'] + `${data.selfHarmWords}</h1>` } let origAnonymousFromObj = data.anonymous.anonymousOptions[0].replace( 'anonymousPage.', '', ) let isAnonymous if (origAnonymousFromObj === 'yes') { isAnonymous = data.language === 'en' ? 'Yes' : 'Oui' } else { isAnonymous = data.language === 'en' ? 'No' : 'Non' } let reportLanguage = data.language === 'fr' ? 'Français' : 'English' let fyiForm if (data.fyiForm === 'yes') { fyiForm = data.language === 'en' ? 'Quick Tip' : 'soumettre des renseignements' } else { fyiForm = data.language === 'en' ? 'Full Report' : 'Rapport complet' } returnString += '<h2>' + lang['analystReport.reportInformation'] + '</h2>' + formatTable( formatLineHtml(lang['analystReport.reportNumber'], data.reportId) + formatLineHtml( lang['analystReport.dateReceived'], data.submissionTime, ) + formatLineHtml(lang['analystReport.reportLanguage'], reportLanguage) + formatLineHtml(lang['analystReport.reportVersion'], data.prodVersion) + formatLineHtml(lang['confirmationPage.anonymous.title'], isAnonymous) + formatLineHtml(lang['analystReport.fyiForm'], fyiForm) + formatLineHtml(lang['analystReport.flagged'], selfHarmString), ) // we delete the parts of the data object that we've displayed, so that at the end we can display the rest and ensure that we didn't miss anything delete data.anonymous.anonymousOptions delete data.reportId delete data.submissionTime delete data.language delete data.appVersion // git hash not used in report delete data.prodVersion delete data.selfHarmWords delete data.submissionDate delete data.prodVersion return returnString } const formatVictimDetails = (data) => { const origConsentString = data.consent.consentOptions .map((option) => option.replace('privacyConsentInfoForm.', '')) .join(', ') let consentString = origConsentString === 'yes' ? lang['analystReport.consent.yes'] : lang['analystReport.consent.no'] let postalCity = '' let postalProv = '' try { let location = zipcodes.lookup(data.location.postalCode) if (data.location.postalCode) { if (location === undefined) { postalCity = lang['locationinfoPage.postalCity.notFoundWarning'] //'Location lookup is not found' postalProv = lang['locationinfoPage.postalProv.notFoundWarning'] //ocation lookup is not found' } else { postalCity = location.city postalProv = location.state } } } catch (error) { //logging console.error(error) } const rows = formatLineHtml( lang['contactinfoPage.fullName'], data.contactInfo.fullName, ) + formatLineHtml( lang['contactinfoPage.emailAddress'], data.contactInfo.email, ) + formatLineHtml( lang['contactinfoPage.phoneNumber'], data.contactInfo.phone, ) + formatLineHtml( lang['contactinfoPage.phoneExtension'], data.contactInfo.extension, ) + formatLineHtml(lang['LocationAnonymousInfoForm.city'], data.location.city) + formatLineHtml( lang['LocationAnonymousInfoForm.province'], data.location.province, ) + formatLineHtml( lang['locationinfoPage.postalCode'], data.location.postalCode, ) + formatLineHtml(lang['locationinfoPage.postalCity'], postalCity) + formatLineHtml(lang['locationinfoPage.postalProv'], postalProv) + formatLineHtml(lang['privacyConsentInfoForm.consent'], consentString) + formatLineHtml( lang['whoAreYouReportForPage.title'], lang[data.whoAreYouReportFor.whoYouReportFor], ) + formatLineHtml( lang['whoAreYouReportForPage.details'], data.whoAreYouReportFor.someoneDescription, ) + formatLineHtml( lang['whoAreYouReportForPage.details'], data.whoAreYouReportFor.businessDescription, ) delete data.contactInfo.fullName delete data.contactInfo.email delete data.contactInfo.phone delete data.contactInfo.extension delete data.location.city delete data.location.province delete data.location.postalCode delete data.consent.consentOptions delete data.whoAreYouReportFor.whoYouReportFor delete data.whoAreYouReportFor.someoneDescription delete data.whoAreYouReportFor.businessDescription return formatSection(lang['contactInfoPage.victimDetail'], rows) } const formatIncidentInformation = (data) => { const freq = data.whenDidItHappen.incidentFrequency let occurenceLine = '' if (freq === 'once') { const occurenceString = formatDate( data.whenDidItHappen.happenedOnceDay, data.whenDidItHappen.happenedOnceMonth, data.whenDidItHappen.happenedOnceYear, ) occurenceLine = formatLineHtml( lang['confirmationPage.howManyTimes'], lang['whenDidItHappenPage.options.once'], ) + formatLineHtml( lang['whenDidItHappenPage.singleDate.label'], occurenceString, ) } else if (freq === 'moreThanOnce') { const startDateString = formatDate( data.whenDidItHappen.startDay, data.whenDidItHappen.startMonth, data.whenDidItHappen.startYear, ) const endtDateString = formatDate( data.whenDidItHappen.endDay, data.whenDidItHappen.endMonth, data.whenDidItHappen.endYear, ) occurenceLine = formatLineHtml( lang['confirmationPage.howManyTimes'], lang['whenDidItHappenPage.options.moreThanOnce'], ) + formatLineHtml( lang['whenDidItHappenPage.dateRange.start.label'], startDateString, ) + formatLineHtml( lang['whenDidItHappenPage.dateRange.end.label'], endtDateString, ) } else if (freq === 'notSure') { const textAreaString = data.whenDidItHappen.description occurenceLine = formatLineHtml( lang['confirmationPage.howManyTimes'], lang['whenDidItHappenPage.options.notSure'], ) + formatLineHtml( lang['whenDidItHappenPage.options.notSure.details'], textAreaString, ) } const OrigMethodOfCommsString = data.howdiditstart.howDidTheyReachYou .map((how) => unCamel(how.replace('howDidTheyReachYou.', ''))) .join(', ') let methodOfCommsString = OrigMethodOfCommsString let languageAdjustedAvailableMethodOfComms = { email: lang['analystReport.methodOfComms.email'], phone: lang['analystReport.methodOfComms.phone'], online: lang['analystReport.methodOfComms.online'], app: lang['analystReport.methodOfComms.app'], others: lang['analystReport.methodOfComms.others'], } for (var key_mc in languageAdjustedAvailableMethodOfComms) { if (methodOfCommsString.includes(key_mc)) { methodOfCommsString = methodOfCommsString.replace( key_mc, languageAdjustedAvailableMethodOfComms[key_mc], ) } } const OrigAffectedString = data.whatWasAffected.affectedOptions .map((option) => unCamel(option.replace('whatWasAffectedForm.', ''))) .filter((option) => option !== 'other') .join(', ') let affectedString = OrigAffectedString let languageAdjustedAffectedString = { financial: lang['analystReport.affected.financial'], 'personal information': lang['analystReport.affected.personalinformation'], business_assets: lang['analystReport.affected.business_assets'], devices: lang['analystReport.affected.devices'], other: lang['analystReport.affected.other'], } for (var key_as in languageAdjustedAffectedString) { if (affectedString.includes(key_as)) { affectedString = affectedString.replace( key_as, languageAdjustedAffectedString[key_as], ) } } const rows = formatLineHtml(lang['howDidTheyReachYou.question'], methodOfCommsString) + occurenceLine + formatLineHtml(lang['confirmationPage.ImpactTitle'], affectedString) delete data.howdiditstart.startDay delete data.howdiditstart.startMonth delete data.howdiditstart.startYear delete data.howdiditstart.howManyTimes delete data.whenDidItHappen.happenedOnceDay delete data.whenDidItHappen.happenedOnceMonth delete data.whenDidItHappen.happenedOnceYear delete data.whenDidItHappen.startDay delete data.whenDidItHappen.startMonth delete data.whenDidItHappen.startYear delete data.whenDidItHappen.endDay delete data.whenDidItHappen.endMonth delete data.whenDidItHappen.endYear delete data.whenDidItHappen.incidentFrequency delete data.whenDidItHappen.description delete data.howdiditstart.howDidTheyReachYou delete data.whatWasAffected.affectedOptions delete data.fyiForm return formatSection(lang['analystReport.incidentInformation'], rows) } const formatNarrative = (data) => { const origInfoReqString = data.personalInformation.typeOfInfoReq .map((info) => unCamel(info.replace('typeOfInfoReq.', ''))) .map((info) => info === 'other' && data.personalInformation.infoReqOther && data.personalInformation.infoReqOther !== '' ? data.personalInformation.infoReqOther : info, ) .join(', ') let infoReqString = origInfoReqString let languageAdjustedAvailableInfoReqString = { 'credit card': lang['typeOfInfoReq.creditCard'], dob: lang['typeOfInfoReq.dob'], 'home address': lang['typeOfInfoReq.homeAddress'], sin: lang['typeOfInfoReq.sin'], other: lang['typeOfInfoReq.other'], } for (var key_ir in languageAdjustedAvailableInfoReqString) { if (infoReqString.includes(key_ir)) { infoReqString = infoReqString.replace( key_ir, languageAdjustedAvailableInfoReqString[key_ir], ) } } const origInfoObtainedString = data.personalInformation.typeOfInfoObtained .map((info) => unCamel(info.replace('typeOfInfoObtained.', ''))) .map((info) => info === 'other' && data.personalInformation.infoObtainedOther && data.personalInformation.infoObtainedOther !== '' ? data.personalInformation.infoObtainedOther : info, ) .join(', ') let infoObtainedString = origInfoObtainedString let languageAdjustedInfoObtainedString = { 'credit card': lang['typeOfInfoObtained.creditCard'], dob: lang['typeOfInfoObtained.dob'], 'home address': lang['typeOfInfoObtained.homeAddress'], sin: lang['typeOfInfoObtained.sin'], other: lang['typeOfInfoObtained.other'], } for (var key_io in languageAdjustedInfoObtainedString) { if (infoObtainedString.includes(key_io)) { infoObtainedString = infoObtainedString.replace( key_io, languageAdjustedInfoObtainedString[key_io], ) } } const origNumberofEmployeeString = data.businessInfo.numberOfEmployee.replace( 'numberOfEmployee.', '', ) let numberofEmployeeString = origNumberofEmployeeString let languageAdjustedNumberofEmployeeString = { '1To99': lang['analystReport.numberOfEmployee.1To99'], '100To499': lang['analystReport.numberOfEmployee.100To499'], '500More': lang['analystReport.numberOfEmployee.500More'], } for (var key_ne in languageAdjustedNumberofEmployeeString) { if (numberofEmployeeString.includes(key_ne)) { numberofEmployeeString = numberofEmployeeString.replace( key_ne, languageAdjustedNumberofEmployeeString[key_ne], ) } } const rows = formatLineHtml( lang['whatHappenedPage.title'], data.whatHappened.whatHappened, ) + formatLineHtml( lang['confirmationPage.moneyLost.demandedMoney'], data.moneyLost.demandedMoney, ) + formatLineHtml( lang['confirmationPage.personalInformation.typeOfInfoReq'], infoReqString, ) + formatLineHtml( lang['confirmationPage.moneyLost.moneyTaken'], data.moneyLost.moneyTaken, ) + formatLineHtml( lang['confirmationPage.personalInformation.typeOfInfoObtained'], infoObtainedString, ) + formatLineHtml( lang['confirmationPage.devices.device'], data.devicesInfo.device, ) + formatLineHtml( lang['confirmationPage.devices.account'], data.devicesInfo.account, ) + formatLineHtml( lang['businessPage.nameOfBusiness'], data.businessInfo.nameOfBusiness, ) + formatLineHtml( lang['confirmationPage.businessInfo.industry'], data.businessInfo.industry, ) + formatLineHtml( lang['confirmationPage.businessInfo.role'], data.businessInfo.role, ) + formatLineHtml( lang['confirmationPage.businessInfo.numberOfEmployee'], numberofEmployeeString, ) + formatLineHtml( lang['confirmationPage.suspectClues.suspectClues3'], data.suspectClues.suspectClues3, ) delete data.personalInformation.typeOfInfoReq delete data.personalInformation.typeOfInfoObtained delete data.whatHappened.whatHappened delete data.personalInformation.infoReqOther delete data.personalInformation.infoObtainedOther delete data.devicesInfo.device delete data.devicesInfo.account delete data.businessInfo.business delete data.businessInfo.nameOfBusiness delete data.businessInfo.industry delete data.businessInfo.role delete data.businessInfo.numberOfEmployee delete data.suspectClues.suspectClues3 return formatSection(lang['analystReport.narrative'], rows) } const formatSuspectDetails = (data) => { const rows = formatLineHtml( lang['confirmationPage.suspectClues.suspectClues1'], data.suspectClues.suspectClues1, ) + formatLineHtml( lang['confirmationPage.howDidItStart.email'], data.howdiditstart.email, ) + formatLineHtml( lang['confirmationPage.howDidItStart.phone'], data.howdiditstart.phone, ) + formatLineHtml( lang['confirmationPage.howDidItStart.online'], data.howdiditstart.online, ) + formatLineHtml( lang['confirmationPage.howDidItStart.application'], data.howdiditstart.application, ) + formatLineHtml( lang['confirmationPage.suspectClues.suspectClues2'], data.suspectClues.suspectClues2, ) + formatLineHtml( lang['confirmationPage.howDidItStart.others'], data.howdiditstart.others, ) delete data.suspectClues.suspectClues1 delete data.howdiditstart.email delete data.howdiditstart.phone delete data.howdiditstart.online delete data.howdiditstart.application delete data.suspectClues.suspectClues2 delete data.howdiditstart.others return formatSection(lang['suspectClues.suspectDetails'], rows) } const formatFinancialTransactions = (data) => { const methods = data.moneyLost.methodPayment const origPaymentString = methods .filter((method) => method !== 'methodPayment.other') .map((method) => unCamel(method.replace('methodPayment.', ''))) .join(', ') let paymentString = data.moneyLost.methodOther && data.moneyLost.methodOther.length > 0 ? String(origPaymentString) + ', ' + [data.moneyLost.methodOther] : String(origPaymentString) let languageAdjustedPaymentString = { 'e transfer': lang['methodPayment.eTransfer'], eTransfer: lang['methodPayment.eTransfer'], 'credit card': lang['methodPayment.creditCard'], creditCard: lang['methodPayment.creditCard'], 'gift card': lang['methodPayment.giftCard'], giftCard: lang['methodPayment.giftCard'], cryptocurrency: lang['methodPayment.cryptocurrency'], other: lang['methodPayment.other'], } for (var key_ps in languageAdjustedPaymentString) { if (paymentString.includes(key_ps)) { paymentString = paymentString.replace( key_ps, languageAdjustedPaymentString[key_ps], ) } } const transactionDate = formatDate( data.moneyLost.transactionDay, data.moneyLost.transactionMonth, data.moneyLost.transactionYear, ) const rows = formatLineHtml( lang['confirmationPage.moneyLost.demandedMoney'], data.moneyLost.demandedMoney, ) + formatLineHtml( lang['confirmationPage.moneyLost.moneyTaken'], data.moneyLost.moneyTaken, ) + formatLineHtml( lang['confirmationPage.moneyLost.methodPayment'], paymentString, //data.moneyLost.paymentString, // methodOther, ) + formatLineHtml( lang['confirmationPage.moneyLost.transactionDate'], transactionDate, ) delete data.moneyLost.methodOther delete data.moneyLost.methodPayment delete data.moneyLost.demandedMoney delete data.moneyLost.moneyTaken delete data.moneyLost.transactionDay delete data.moneyLost.transactionMonth delete data.moneyLost.transactionYear return formatSection(lang['moneyLostPage.financialTransactions'], rows) } const formatFileAttachments = (data) => { const returnString = data.evidence.files .map((file) => { // Don't include png in the e-mail. They are converted to JPG and those will be included let fileExtension = getFileExtension(file.name) if (fileExtension.endsWith('png')) { return '' } const offensive = file.isImageAdultClassified || file.isImageRacyClassified const moderatorString = file.adultClassificationScore === 'Could not scan' ? formatLineHtml( lang['fileUpload.classification.title'], lang['fileUpload.classification.cannotscan'], ) : formatLineHtml( lang['fileUpload.isAdult'], file.isImageAdultClassified, ) + formatLineHtml( lang['fileUpload.adultScore'], file.adultClassificationScore, ) + formatLineHtml( lang['fileUpload.isRacy'], file.isImageRacyClassified ? lang['fileUpload.isRacy.true'] : lang['fileUpload.isRacy.false'], ) + formatLineHtml( lang['fileUpload.racyScore'], file.racyClassificationScore, ) const downloadLink = file.malwareIsClean ? formatDownloadLink(file.name, file.sasUrl) : '' let offensiveWarningBlockedString = '<b>' + lang['fileUpload.fileAttachment.offensivewarning.block'] + '</b>' let offensiveWarningMessageString = '<b>' + lang['fileUpload.fileAttachment.offensivewarning'] + '</b>' return ( formatLineHtml( offensiveWarningBlockedString, offensive ? offensiveWarningMessageString : '', ) + formatLineHtml(lang['fileUpload.fileName'], file.name) + formatLineHtml( lang['fileUpload.fileDescription'], file.fileDescription, ) + formatLineHtml(lang['fileUpload.fileSize'], file.size + ' bytes') + formatLineHtml(lang['fileUpload.CosmosDBFile'], file.sha1) + formatLineHtml( lang['fileUpload.malwareScan'], file.malwareIsClean ? lang['fileUpload.malwareScan.clean'] : file.malwareScanDetail, ) + moderatorString + downloadLink ) }) .join('<tr><td>&nbsp;</td></tr>') delete data.evidence.files delete data.evidence.fileDescriptions return ( '<h2>' + lang['fileUpload.fileAttachment'] + '</h2>\n' + (returnString !== '' ? formatTable(returnString) : lang['fileUpload.noFiles']) ) } const formatAnalystEmail = (dataOrig) => { let returnString = '' let reportInfoString = '' let missingFields let data try { data = JSON.parse(JSON.stringify(dataOrig)) reportInfoString = formatReportInfo(data) } catch (error) { const errorMessage = `ERROR in formatAnalystEmail (report ${dataOrig.reportId}): ${error}` console.error(errorMessage) return errorMessage } try { returnString = reportInfoString + formatVictimDetails(data) + formatIncidentInformation(data) + formatNarrative(data) + formatSuspectDetails(data) + formatFinancialTransactions(data) + formatFileAttachments(data) // take data object and delete any objects that are now empty, and display the rest Object.keys(data).forEach((key) => { if (Object.keys(data[key]).length === 0) delete data[key] }) let fieldsMissingWarningString = '\n<h2>' + lang['analystReport.fieldsMissing.warning'] + '</h2>\n' missingFields = Object.keys(data).length ? fieldsMissingWarningString + `<p>${JSON.stringify(data, null, ' ')}</p>\n` : '' } catch (error) { const errorMessage = reportInfoString + `\nERROR in formatAnalystEmail (report ${dataOrig.reportId}): ${error}` console.error(errorMessage) return errorMessage } return returnString + missingFields } module.exports = { formatAnalystEmail } <|start_filename|>f2/src/utils/__tests__/getData.test.js<|end_filename|> import { getFileExtension } from '../getData' describe('getFileExtension', () => { it('finds an extension', () => { expect(getFileExtension('test.JPG')).toEqual('jpg') }) it('is empty if there is no extension', () => { expect(getFileExtension('')).toEqual('') expect(getFileExtension('test')).toEqual('') expect(getFileExtension('.JPG')).toEqual('') }) }) <|start_filename|>f2/src/utils/clientFieldsAreValid.js<|end_filename|> const clientFieldsAreValid = (data, defaults) => { let valid = true Object.keys(data).forEach((field) => { if (Object.keys(defaults).indexOf(field) === -1) { valid = false console.log( `ERROR: field ${field} not in defaults ${Object.keys(defaults)}`, ) } }) return valid } module.exports = { clientFieldsAreValid } <|start_filename|>f2/src/components/FormHelperText/__tests__/FormHelperText.test.js<|end_filename|> import React from 'react' import { FormHelperText } from '../' import ReactDOM from 'react-dom' import { ThemeProvider } from 'emotion-theming' import canada from '../../../theme/canada' import { render, cleanup } from '@testing-library/react' describe('<FormHelperText />', () => { afterEach(cleanup) it('renders without crashing', () => { const FormArrayControl = document.createElement('FormArrayControl') ReactDOM.render(<FormHelperText />, FormArrayControl) }) it('properly renders child components', () => { const { getAllByText } = render( <ThemeProvider theme={canada}> <FormHelperText>foo</FormHelperText> </ThemeProvider>, ) const test = getAllByText(/foo/) expect(test).toHaveLength(1) }) }) <|start_filename|>f2/src/components/formik/test/TESTPAGE.js<|end_filename|> /** @jsx jsx */ import { jsx } from '@emotion/core' import { Route } from 'react-router-dom' import { H1 } from '../../header' import { Layout } from '../../layout' import { BackButton } from '../../backbutton' import { Stack } from '@chakra-ui/core' import { useStateValue } from '../../../utils/state' import { Page } from '../../Page' import { TestForm } from './TESTFORM' export const TestPage = () => { const [dispatch] = useStateValue() return ( <Route render={({ history }) => ( <Page> <Layout columns={{ base: 4 / 4, md: 6 / 8, lg: 7 / 12 }}> <Stack spacing={10} shouldWrapChildren> <BackButton /> <H1>TEST PAGE</H1> <TestForm onSubmit={(data) => { dispatch({ type: 'saveFormData', data: data, }) history.push('moneylost') }} /> </Stack> </Layout> </Page> )} /> ) } <|start_filename|>f2/src/components/FormErrorMessage/index.js<|end_filename|> import React from 'react' import { Text, useFormControl } from '@chakra-ui/core' export const FormErrorMessage = (props) => { const formControl = useFormControl(props) if (!formControl.isInvalid) { return null } return <Text {...props}>{props.children}</Text> } FormErrorMessage.defaultProps = { fontSize: 'md', fontWeight: 'bold', color: 'red.700', fontFamily: 'body', lineHeight: 1.25, mt: 1, maxW: '600px', } <|start_filename|>f2/src/components/next-and-cancel-buttons/_tests_/next-and-cancel-buttons.test.js<|end_filename|> import React from 'react' import { i18n } from '@lingui/core' import { I18nProvider } from '@lingui/react' import { render, cleanup } from '@testing-library/react' import { ThemeProvider } from 'emotion-theming' import canada from '../../../theme/canada' import { MemoryRouter } from 'react-router-dom' import { NextAndCancelButtons } from '../' import en from '../../../locales/en.json' import { Form } from 'react-final-form' i18n.load('en', { en }) i18n.activate('en') describe('<NextAndCancelButtons />', () => { afterEach(cleanup) const submitMock = jest.fn() it('properly renders next button with cancel button beside', () => { const { getAllByText, getAllByRole } = render( <MemoryRouter initialEntries={['/']}> <ThemeProvider theme={canada}> <I18nProvider i18n={i18n}> <Form onSubmit={submitMock} render={({ handleSubmit }) => ( <form onSubmit={handleSubmit}> <NextAndCancelButtons button="Next: Confirm information" /> </form> )} ></Form> </I18nProvider> </ThemeProvider> </MemoryRouter>, ) //Expect to find 2 buttons expect(getAllByRole('button')).toHaveLength(2) const submitButton = getAllByRole('button')[0] const cancelButton = getAllByRole('button')[1] //There is only one next and one cancel button expect(getAllByText(/Next/)).toHaveLength(1) expect(getAllByText(/button.cancelReport/)).toHaveLength(1) //expect these properties to exist expect(submitButton).toHaveProperty('type', 'submit') expect(cancelButton).toHaveProperty('type', 'button') }) }) <|start_filename|>f2/cypress/integration/common/howdiditstart_page_fr.js<|end_filename|> import { When } from 'cypress-cucumber-preprocessor/steps' When('I fill howdiditstart in French page forms', () => { cy.get('form') .find('[value="howDidTheyReachYou.email"]') .check({ force: true }) cy.get('form').find('[name="email"]').type('<EMAIL>') cy.get('form') .find('[value="howDidTheyReachYou.phone"]') .check({ force: true }) cy.get('form').find('[name="phone"]').type('1-800-000-0001') cy.get('form') .find('[value="howDidTheyReachYou.online"]') .check({ force: true }) cy.get('form') .find('[name="online"]') .type('http://www.suspectFrenchAnonymous.com') cy.get('form').find('[value="howDidTheyReachYou.app"]').check({ force: true }) cy.get('form') .find('[name="application"]') .type('noms d’applications où vous avez communiqué Application') cy.get('form') .find('[value="howDidTheyReachYou.others"]') .check({ force: true }) cy.get('form').find('[name="others"]').type('Une publicité') }) <|start_filename|>f2/src/StartPage.js<|end_filename|> /* eslint-disable react/no-unescaped-entities */ import React from 'react' import { Route } from 'react-router-dom' import { GoogleReCaptcha } from 'react-google-recaptcha-v3' import PropTypes from 'prop-types' import { Trans } from '@lingui/macro' import { P } from './components/paragraph' import { Button } from './components/button' import { H1 } from './components/header' import { Ul } from './components/unordered-list' import { Li } from './components/list-item' import { Layout } from './components/layout' import { Stack, Icon } from '@chakra-ui/core' import { useStateValue } from './utils/state' import { BackButton } from './components/backbutton' import { Page } from './components/Page' import { Well } from './components/Messages' import { useLog } from './useLog' export const StartPage = (props) => { const [state, dispatch] = useStateValue() if (state.doneForms) { dispatch({ type: 'saveDoneForms', data: false }) } useLog('StartPage') return ( <React.Fragment> <GoogleReCaptcha onVerify={(token) => { console.log(`The token is ${token}`) let textarea = document.getElementById('g-recaptcha-response-100000') if (textarea) { textarea.setAttribute('aria-hidden', 'true') textarea.setAttribute('aria-label', 'do not use') textarea.setAttribute('aria-readonly', 'true') } }} /> <Route render={({ history }) => ( <Page> <Layout columns={{ base: 4 / 4, md: 6 / 8, lg: 7 / 12 }}> <Stack spacing={10} shouldWrapChildren> <BackButton /> <H1> <Trans id="startPage.title" /> </H1> <Stack spacing={4}> <P> <Trans id="startPage.intro" /> </P> <Ul> <Li> <Trans id="startPage.requirement1" /> </Li> <Li> <Trans id="startPage.requirement2" /> </Li> <Li> <Trans id="startPage.requirement3" /> </Li> <Li> <Trans id="startPage.requirement4" /> </Li> </Ul> </Stack> <Button onClick={() => { history.push('/privacyconsent') }} > <Trans id="startPage.nextButton" /> <Icon focusable="false" ml={2} mr={-2} name="chevron-right" size="28px" /> </Button> <Well variantColor="blue"> <Trans id="startPage.warning" /> </Well> </Stack> </Layout> </Page> )} /> </React.Fragment> ) } StartPage.propTypes = { location: PropTypes.object, } <|start_filename|>f2/src/components/DescriptionListItem/index.js<|end_filename|> /** @jsx jsx **/ import { jsx } from '@emotion/core' import { Flex } from '@chakra-ui/core' import PropTypes from 'prop-types' import { Text } from '../text' import { Trans } from '@lingui/macro' export const DescriptionListItem = ({ description, descriptionTitle }) => { if (typeof description === 'undefined') console.warn( `Warning! description undefined for descriptionTitle=${descriptionTitle}`, ) if (typeof description === 'undefined' || description.length === 0) { return null } return ( <Flex wrap="wrap"> <Text as="dt" fontWeight="bold" w={{ base: '100%', md: '40%' }} pr={4} pb={2} > <Trans id={descriptionTitle} /> </Text> <Text as="dd" w={{ base: '100%', md: '60%' }} pb={2}> {description} </Text> </Flex> ) } DescriptionListItem.propTypes = { description: PropTypes.any.isRequired, descriptionTitle: PropTypes.string.isRequired, } <|start_filename|>f2/src/i18n.config.js<|end_filename|> import { i18n } from '@lingui/core' import { getUserLocale } from 'get-user-locale' export const locales = { en: 'English', fr: 'Français', } export async function activate(locale) { let catalog try { catalog = await import( /* webpackChunkName: "i18n-[index]" */ `@lingui/loader!./locales/${locale}.json` ) } catch (e) { // this fails only during tests due to webpack errors. } i18n.load(locale, catalog) i18n.activate(locale) } let params = new URL(document.location).searchParams let lang = params.get('lang') let userLocale = getUserLocale() if (lang === 'fr') { activate('fr') } else if (lang === 'en') { activate('en') } else if (window.location.hostname.indexOf('signalement') > -1) { activate('fr') } else if (window.location.hostname.indexOf('report') > -1) { activate('en') } else if (userLocale && ['en', 'fr'].includes(userLocale.substr(0, 2))) { activate(userLocale.substr(0, 2)) } else { activate('en') } <|start_filename|>f2/src/utils/saveBlob.js<|end_filename|> const { BlobServiceClient, StorageSharedKeyCredential, generateBlobSASQueryParameters, ContainerSASPermissions, SASProtocol, } = require('@azure/storage-blob') const { getLogger } = require('./winstonLogger') const fs = require('fs') const exec = require('child_process').exec const { certFileName } = require('./ldap') require('dotenv').config() const logger = getLogger(__filename) const account = process.env.BLOB_STORAGE_NAME const accountKey = process.env.BLOB_STORAGE_KEY const sasExpiryDays = process.env.BLOB_SAS_DAYS_EXPIRY const sasIpRangeLower = process.env.BLOB_SAS_IP_LOWER const sasIpRangeUpper = process.env.BLOB_SAS_IP_UPPER // Use StorageSharedKeyCredential with storage account and account key // StorageSharedKeyCredential is only avaiable in Node.js runtime, not in browsers let blobServiceClient let sharedKeyCredential try { sharedKeyCredential = new StorageSharedKeyCredential(account, accountKey) blobServiceClient = new BlobServiceClient( `https://${account}.blob.core.windows.net`, sharedKeyCredential, ) } catch (error) { console.warn('WARNING: File storage not configured') } /* Given 'data' , find all the files, encrypt and save to cloud */ async function saveBlob(uidList, data) { try { if (!blobServiceClient && data.evidence.files.length > 0) { console.warn(`WARNING: Report ${data.reportId} not able to save files`) return } if (data.evidence.files.length > 0) { const containerName = data.reportId.replace('-', '').toLowerCase() const containerClient = blobServiceClient.getContainerClient( containerName, ) let errorCode = (await containerClient.create()).errorCode if (errorCode) console.warn( `ERROR creating container ${containerName}: error code ${errorCode}`, ) else { logger.info({ message: `Created container ${containerName} successfully`, sessionId: data.sessionId, reportId: data.reportId, }) } // Generate service level SAS for a container const containerSAS = generateBlobSASQueryParameters( { containerName, permissions: ContainerSASPermissions.parse('r'), // Read Only startsOn: new Date(), // Starting today expiresOn: new Date(new Date().valueOf() + 86400000 * sasExpiryDays), // Expires in 'sasExpiryDays' days (86400000 = 1 day) ipRange: { start: sasIpRangeLower, end: sasIpRangeUpper }, // Restrict the SAS link to requests from this IP range protocol: SASProtocol.Https, // Restrict SAS to HTTPS requests only }, sharedKeyCredential, ).toString() data.evidence.files.forEach((file) => { if (file.malwareIsClean) { // Use SHA1 hash as file name to avoid collisions in blob storage, keep file extension let blobName = file.sha1 + '.' + file.name.split('.').pop() // Add p7m extension if we are encrypting file. Entrust on RCMP computer will recognize p7m as encrypted file blobName = uidList.length > 0 ? blobName + '.p7m' : blobName const blockBlobClient = containerClient.getBlockBlobClient(blobName) // Create a callback function for use with encryptFile let uploadFile = (file, content) => { let errorCode = blockBlobClient.upload(content, content.length) .errorCode if (errorCode) console.warn( `ERROR: Upload report ${data.reportId} file ${file.name}, blob ${blobName}: error code ${errorCode}`, ) else logger.info({ message: `Uploaded file ${file.name} to blob ${blobName} successfully`, sessionId: data.sessionId, reportId: data.reportId, }) } // If running in a test environment with no HRMIS, upload the raw file instead of encrypting if (uidList.length > 0) { encryptFile(uidList, file, uploadFile) } else { uploadFile(file, fs.readFileSync(file.path)) } // Add the SAS URL to the file data structure file.sasUrl = blockBlobClient.url + '?' + containerSAS.toString() } else { console.warn( `Skipping saving report ${data.reportId} file ${file.name} due to malware.`, ) } }) } } catch (error) { console.warn(`ERROR in saveBlob: ${error}`) } } /* Encrypts the file at file.path for user specified by uid. Calls the 'callback' function after with encrypted file. */ const encryptFile = (uids, file, callback) => { const openssl = 'openssl smime -des3 -encrypt -binary' const messageFile = `${file.path}` const encryptedFile = messageFile + '.p7m' const cerFileList = [] uids.forEach((uid) => { cerFileList.push(certFileName(uid)) }) const certFiles = cerFileList.join(' ') exec( `${openssl} -in ${messageFile} -out ${encryptedFile} ${certFiles}`, { cwd: process.cwd() }, function (error, _stdout, stderr) { if (error) throw error else if (stderr) console.warn(stderr) else { console.log('Encrypted File: ' + file.path) const attachment = fs.readFileSync(encryptedFile) fs.unlink(messageFile, () => {}) fs.unlink(encryptedFile, () => {}) callback(file, attachment) } }, ) } module.exports = { saveBlob } <|start_filename|>f2/src/PdfReportPage.js<|end_filename|> import React from 'react' import { BlobProvider } from '@react-pdf/renderer' import { PdfDocument } from './pdf/PdfDocument' import { Trans } from '@lingui/macro' import { useLingui } from '@lingui/react' import { A } from './components/formik/link' import { useStateValue } from './utils/state' export const PdfReportPage = (props) => { const [data] = useStateValue() const { i18n } = useLingui() return ( <React.Fragment> {false ? ( <div> <Trans id="pdf.betaText" /> <Trans id="pdf.bottom.site1" /> <Trans id="pdf.bottom.site2" /> <Trans id="pdf.bottom.site3" /> <Trans id="pdf.bottom.site4" /> <Trans id="pdf.getPdfReport" /> <Trans id="pdf.next.title" /> <Trans id="pdf.next.content" /> <Trans id="pdf.referenceNumber" /> <Trans id="pdf.thankyou" /> <Trans id="pdf.websites.title" /> </div> ) : null} <BlobProvider document={<PdfDocument data={data} locale={i18n.locale} />}> {({ blob, url, loading, error }) => { return ( <A href={url} target="_blank" fontSize="xl"> <Trans id="pdf.getPdfReport" /> </A> ) }} </BlobProvider> </React.Fragment> ) } <|start_filename|>utils/totp/generatesecret.js<|end_filename|> /* A run-once node js script to generate a TOTP code that can be used with Authenticator apps (Google Authenticator, Authy, Microsoft Authenticator) Simply: cd /utils/totp npm i node generatesecret.js This will create two files. 'secret' is a text file with the TOTP secret. This goes in the TOTP_SECRET environment variable for our app If this is for a production, protect this like you would a password! 'code.html' is a HTML file you can open with a browser to get a QR code. Scan this code with your authenticator app of choice to start generating TOTP codes. */ var speakeasy = require("speakeasy"); var QRCode = require("qrcode"); var path = require("path"); var fs = require("fs"); var secret = speakeasy.generateSecret(); QRCode.toDataURL(secret.otpauth_url, function (err, data_url) { fs.writeFile( path.join(__dirname, "code.html"), '<img src="' + data_url + '">', function (err, file) { if (err) throw err; } ); }); fs.writeFile(path.join(__dirname, "secret"), secret.base32, function ( err, file ) { if (err) throw err; }); <|start_filename|>f2/cypress/integration/common/whathappened_page.js<|end_filename|> import { When } from 'cypress-cucumber-preprocessor/steps' When('I fill to Whathappened page forms', () => { cy.fixture('form_data.json').then((user) => { var paragraph = user.small_en cy.get('form').find('[name="whatHappened"]').type(paragraph) }) }) When('I fill WhathappenedHarmful page forms', () => { cy.fixture('form_data.json').then((user) => { var paragraph = user.harmful_en cy.get('form').find('[name="whatHappened"]').type(paragraph) }) }) When('I fill WhathappenedInjection page forms', () => { cy.fixture('form_data.json').then((user) => { var paragraph = user.xssInjection1 cy.get('form').find('[name="whatHappened"]').type(paragraph) }) }) <|start_filename|>f2/src/utils/__tests__/validateDate.test.js<|end_filename|> import { validateDate } from '../validateDate' import { cleanup } from '@testing-library/react' describe('validation', () => { afterEach(cleanup) let expected = [] it('passes correct start day', () => { expected = [] expect(validateDate('2010', '10', '10')).toEqual( expect.arrayContaining(expected), ) expect(validateDate('2010', '1', '10')).toEqual( expect.arrayContaining(expected), ) expect(validateDate('2010', '20', '10')).toEqual( expect.arrayContaining(expected), ) expect(validateDate('2010', '28', '10')).toEqual( expect.arrayContaining(expected), ) }) it('fails incorrect start day', () => { expected = ['notDay'] expect(validateDate('2010', '11', '31')).toEqual( expect.arrayContaining(expected), ) expect(validateDate('2010', '10', '32')).toEqual( expect.arrayContaining(expected), ) expect(validateDate('2010', '10', '0')).toEqual( expect.arrayContaining(expected), ) expect(validateDate('2010', '10', '00')).toEqual( expect.arrayContaining(expected), ) }) it('passes correct start month', () => { expected = [] expect(validateDate('2010', '1', '10')).toEqual( expect.arrayContaining(expected), ) expect(validateDate('2010', '01', '10')).toEqual( expect.arrayContaining(expected), ) expect(validateDate('2010', '12', '10')).toEqual( expect.arrayContaining(expected), ) }) it('fails incorrect start month', () => { expected = ['notMonth'] expect(validateDate('2010', '0', '10')).toEqual( expect.arrayContaining(expected), ) expect(validateDate('2010', '00', '10')).toEqual( expect.arrayContaining(expected), ) expect(validateDate('2010', '13', '10')).toEqual( expect.arrayContaining(expected), ) }) it('passes correct start year', () => { expected = [] expect(validateDate('2000', '1', '10')).toEqual( expect.arrayContaining(expected), ) expect(validateDate('1900', '1', '10')).toEqual( expect.arrayContaining(expected), ) }) it('fails incorrect start year', () => { //4 digit years expected = ['notYear'] expect(validateDate('0000', '1', '10')).toEqual( expect.arrayContaining(expected), ) // less than 4 digit years expected = ['yearLength'] expect(validateDate('000', '1', '10')).toEqual( expect.arrayContaining(expected), ) expect(validateDate('330', '1', '10')).toEqual( expect.arrayContaining(expected), ) expect(validateDate('20', '1', '10')).toEqual( expect.arrayContaining(expected), ) expect(validateDate('1', '1', '10')).toEqual( expect.arrayContaining(expected), ) }) it('passes correct start date in Leap year', () => { expected = [] expect(validateDate('2020', '2', '29')).toEqual( expect.arrayContaining(expected), ) expect(validateDate('2016', '02', '29')).toEqual( expect.arrayContaining(expected), ) }) it('fails incorrect transaction date in Leap year', () => { expected = ['notDay'] expect(validateDate('2019', '2', '29')).toEqual( expect.arrayContaining(expected), ) expect(validateDate('2017', '02', '29')).toEqual( expect.arrayContaining(expected), ) }) it('passes correct transaction date in non-Leap year', () => { expected = [] expect(validateDate('2017', '2', '28')).toEqual( expect.arrayContaining(expected), ) expect(validateDate('2019', '02', '28')).toEqual( expect.arrayContaining(expected), ) }) it('fails incorrect transaction date in non-Leap year', () => { expected = ['notDay'] expect(validateDate('2017', '2', '29')).toEqual( expect.arrayContaining(expected), ) expect(validateDate('2019', '02', '29')).toEqual( expect.arrayContaining(expected), ) }) }) <|start_filename|>f2/src/utils/containsData.js<|end_filename|> export const containsData = (x) => { switch (typeof x) { case 'string': return x !== '' case 'object': // includes arrays return Object.values(x).some(containsData) case 'number': return !isNaN(x) default: // numbers, boolean return true } } <|start_filename|>f2/src/utils/saveRecord.js<|end_filename|> const MongoClient = require('mongodb').MongoClient const { getLogger } = require('./winstonLogger') const logger = getLogger(__filename) const dbName = process.env.COSMOSDB_NAME const dbKey = process.env.COSMOSDB_KEY let cosmosDbConfigured = dbName && dbKey if (!cosmosDbConfigured) { console.warn( 'Warning: CosmosDB not configured. Data will not be saved to CosmosDB database. Please set the environment variables COSMOSDB_NAME and COSMOSDB_KEY', ) } const url = `mongodb://${dbName}:${dbKey}@${dbName}.documents.azure.com:10255/mean-dev?ssl=true&sslverifycertificate=false` async function saveRecord(data, res) { if (cosmosDbConfigured) { MongoClient.connect(url, function (err, db) { if (err) { console.warn(`ERROR in MongoClient.connect: ${err}`) res.statusCode = 502 res.statusMessage = 'Error saving to CosmosDB' res.send(res.statusMessage) } else { var dbo = db.db('cybercrime') dbo.collection('reports').insertOne(data, function (err, result) { if (err) { console.warn(`ERROR in Report ${data.reportId} insertOne: ${err}`) res.statusCode = 502 res.statusMessage = 'Error saving to CosmosDB' res.send(res.statusMessage) } else { db.close() logger.info({ message: `Report ${data.reportId} saved to CosmosDB`, reportId: data.reportId, sessionId: data.sessionId, }) res.statusMessage = data.reportId res.send(res.statusMessage) } }) } }) } else { res.statusCode = 500 res.statusMessage = 'CosmosDB not configured' res.send('CosmosDB not configured') } } async function getReportCount(availableData) { const date = new Date() const currentDate = (date.getDate() > 9 ? date.getDate() : '0' + date.getDate()) + '/' + (date.getMonth() > 8 ? date.getMonth() + 1 : '0' + (date.getMonth() + 1)) + '/' + date.getFullYear() if (cosmosDbConfigured) { MongoClient.connect(url, function (err, db) { if (err) { console.warn(`ERROR in MongoClient.connect: ${err}`) } else { var dbo = db.db('cybercrime') dbo .collection('reports') .find({ submissionDate: { $eq: currentDate, }, }) .toArray(function (err, result) { if (err) { console.warn(`ERROR in find: ${err}`) } else { db.close() availableData.numberOfSubmissions = result.length } }) } }) } } module.exports = { saveRecord, getReportCount } <|start_filename|>f2/src/pdf/HowDidItStartView.js<|end_filename|> /** @jsx jsx */ import { jsx } from '@emotion/core' import { containsData } from '../utils/containsData' import { testdata } from '../ConfirmationSummary' import { Text, View, Image } from '@react-pdf/renderer' import { pdfStyles } from './pdfStyles' import { formatList } from '../utils/formatList' import { DescriptionItemView } from './DescriptionItemView' import line from '../images/line.png' export const HowDidItStartView = (props) => { const lang = props.lang const summary = [] let methodOfContact = ' ' const howdiditstart = { ...testdata.formData.howdiditstart, ...props.data.formData.howdiditstart, } if (howdiditstart.howDidTheyReachYou.length > 0) { howdiditstart.howDidTheyReachYou.map((key) => summary.push( key === 'howDidTheyReachYou.others' && howdiditstart.others !== '' ? howdiditstart.others : lang[key].toLowerCase(), ), ) methodOfContact = formatList(summary, { pair: lang['default.pair'], middle: lang['default.middle'], end: lang['default.end'], }) } return ( <View style={pdfStyles.section}> <Text style={pdfStyles.title}> {lang['confirmationPage.howDidItStart.title']} </Text> {containsData(howdiditstart) ? ( <View> <DescriptionItemView title="confirmationPage.howDidItStart.overviewPrefix" description={methodOfContact} lang={lang} /> <DescriptionItemView title="confirmationPage.howDidItStart.email" description={howdiditstart.email} lang={lang} /> <DescriptionItemView title="confirmationPage.howDidItStart.phone" description={howdiditstart.phone} lang={lang} /> <DescriptionItemView title="confirmationPage.howDidItStart.online" description={howdiditstart.online} lang={lang} /> <DescriptionItemView title="confirmationPage.howDidItStart.application" description={howdiditstart.application} lang={lang} /> <DescriptionItemView title="confirmationPage.howDidItStart.others" description={howdiditstart.others} lang={lang} /> </View> ) : ( <Text style={pdfStyles.sectionContent}> {lang['confirmationPage.howDidItStart.nag']} </Text> )} <Image style={pdfStyles.sectionSeparator} src={line} /> </View> ) } <|start_filename|>f2/src/components/Messages/__tests__/Messages.test.js<|end_filename|> import React from 'react' import { render, cleanup } from '@testing-library/react' import { ThemeProvider } from 'emotion-theming' import theme from '../../../theme' import { Alert, Well } from '..' describe('<Alert>', () => { const foo = 'bar' it('Renders an Alert element', () => { const { getAllByText } = render( <ThemeProvider theme={theme}> <Alert status="success">{foo}</Alert> </ThemeProvider>, ) const test = getAllByText(/bar/) expect(test).toHaveLength(1) }) it('Has Alert styling properties', () => { const { getByText } = render( <ThemeProvider theme={theme}> <Alert status="success">{foo}</Alert> </ThemeProvider>, ) const test = getByText(/bar/) expect(test).toHaveStyleRule('background-color', expect.any(String)) expect(test).toHaveStyleRule('border-left', '3px') expect(test).not.toHaveStyleRule('border-radius') }) }) describe('<Well>', () => { afterEach(cleanup) const foo = 'bar' it('Renders a Well element', () => { const { getAllByText } = render( <ThemeProvider theme={theme}> <Well>{foo}</Well> </ThemeProvider>, ) const test = getAllByText(/bar/) expect(test).toHaveLength(1) }) it('Has Well styling properties', () => { const { getByText } = render( <ThemeProvider theme={theme}> <Well>{foo}</Well> </ThemeProvider>, ) const test = getByText(/bar/) expect(test).toHaveStyleRule('background-color', expect.any(String)) expect(test).toHaveStyleRule('box-shadow', expect.any(String)) expect(test).toHaveStyleRule('box-shadow', expect.any(String)) expect(test).toHaveStyleRule('border', expect.any(String)) expect(test).toHaveStyleRule('border-radius', expect.any(String)) }) }) <|start_filename|>f2/src/utils/formatPhoneNumber.js<|end_filename|> module.exports = { formatPhoneNumber(s) { if (!s || s === '') return '' const digitsOnly = s.replace(/\D/g, '') if (digitsOnly.length !== 10) return s const areaCode = digitsOnly.substring(0, 3) const prefix = digitsOnly.substring(3, 6) const lineNumber = digitsOnly.substring(6, 10) return `(${areaCode}) ${prefix}-${lineNumber}` }, } <|start_filename|>f2/src/utils/__tests__/formatAnalystEmail.test.js<|end_filename|> import { formatAnalystEmail } from '../formatAnalystEmail' describe('formatAnalystEmail', () => { it('returns an error message if there is missing data', () => { const data = {} console.error = jest.fn() const s = formatAnalystEmail(data) expect(s).toEqual(expect.stringMatching(/ERROR/)) expect(console.error).toHaveBeenCalled() }) it('flags self harm words prominently if present', () => { const data = { selfHarmWords: 'agile', anonymous: { anonymousOptions: ['anonymousPage.no'] }, } console.error = jest.fn() const s = formatAnalystEmail(data) expect(s).toEqual( expect.stringMatching(/\n\n<h1 style="background-color:yellow;">/), ) expect(console.error).toHaveBeenCalled() }) }) <|start_filename|>f2/cypress/integration/common/whatcouldbeaffected_page.js<|end_filename|> import { When } from 'cypress-cucumber-preprocessor/steps' When('I fill Whatcouldbeaffected page forms', () => { cy.get('form') .find('[value="whatWasAffectedForm.financial"]') .check({ force: true }) cy.get('form') .find('[value="whatWasAffectedForm.personalInformation"]') .check({ force: true }) cy.get('form') .find('[value="whatWasAffectedForm.devices"]') .check({ force: true }) cy.get('form') .find('[value="whatWasAffectedForm.business_assets"]') .check({ force: true }) cy.get('form') .find('[value="whatWasAffectedForm.other"]') .check({ force: true }) }) When('I fill Whatcouldbeaffected12 page forms', () => { cy.get('form') .find('[value="whatWasAffectedForm.financial"]') .check({ force: true }) cy.get('form') .find('[value="whatWasAffectedForm.personalInformation"]') .check({ force: true }) }) When('I fill Whatcouldbeaffected1 page forms', () => { cy.get('form') .find('[value="whatWasAffectedForm.financial"]') .check({ force: true }) }) When('I fill Whatcouldbeaffected2 page forms', () => { cy.get('form') .find('[value="whatWasAffectedForm.personalInformation"]') .check({ force: true }) }) When('I fill Whatcouldbeaffected3 page forms', () => { cy.get('form') .find('[value="whatWasAffectedForm.devices"]') .check({ force: true }) }) When('I fill Whatcouldbeaffected4 page forms', () => { cy.get('form') .find('[value="whatWasAffectedForm.business_assets"]') .check({ force: true }) }) When('I fill Whatcouldbeaffected5 page forms', () => { cy.get('form') .find('[value="whatWasAffectedForm.other"]') .check({ force: true }) })
cds-snc/report-a-cybercrime
<|start_filename|>cache/https---github.com-facebook-react-native-blame-master-Libraries-WebSocket-WebSocketBase.js<|end_filename|> <!DOCTYPE html> <html lang="en" class=""> <head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# object: http://ogp.me/ns/object# article: http://ogp.me/ns/article# profile: http://ogp.me/ns/profile#"> <meta charset='utf-8'> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="Content-Language" content="en"> <meta name="viewport" content="width=1020"> <title>react-native/Libraries/WebSocket/WebSocketBase.js at master · facebook/react-native · GitHub</title> <link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="GitHub"> <link rel="fluid-icon" href="https://github.com/fluidicon.png" title="GitHub"> <link rel="apple-touch-icon" sizes="57x57" href="/apple-touch-icon-114.png"> <link rel="apple-touch-icon" sizes="114x114" href="/apple-touch-icon-114.png"> <link rel="apple-touch-icon" sizes="72x72" href="/apple-touch-icon-144.png"> <link rel="apple-touch-icon" sizes="144x144" href="/apple-touch-icon-144.png"> <meta property="fb:app_id" content="1401488693436528"> <meta content="@github" name="twitter:site" /><meta content="summary" name="twitter:card" /><meta content="facebook/react-native" name="twitter:title" /><meta content="react-native - A framework for building native apps with React." name="twitter:description" /><meta content="https://avatars2.githubusercontent.com/u/69631?v=3&amp;s=400" name="twitter:image:src" /> <meta content="GitHub" property="og:site_name" /><meta content="object" property="og:type" /><meta content="https://avatars2.githubusercontent.com/u/69631?v=3&amp;s=400" property="og:image" /><meta content="facebook/react-native" property="og:title" /><meta content="https://github.com/facebook/react-native" property="og:url" /><meta content="react-native - A framework for building native apps with React." property="og:description" /> <meta name="browser-stats-url" content="https://api.github.com/_private/browser/stats"> <meta name="browser-errors-url" content="https://api.github.com/_private/browser/errors"> <link rel="assets" href="https://assets-cdn.github.com/"> <meta name="pjax-timeout" content="1000"> <meta name="msapplication-TileImage" content="/windows-tile.png"> <meta name="msapplication-TileColor" content="#ffffff"> <meta name="selected-link" value="repo_source" data-pjax-transient> <meta name="google-site-verification" content="<KEY>"> <meta name="google-analytics" content="UA-3769691-2"> <meta content="collector.githubapp.com" name="octolytics-host" /><meta content="github" name="octolytics-app-id" /><meta content="A2E429B6:19DE:1B57F065:565DFD26" name="octolytics-dimension-request_id" /> <meta content="/&lt;user-name&gt;/&lt;repo-name&gt;/blob/blame" data-pjax-transient="true" name="analytics-location" /> <meta content="Rails, view, blob#blame" data-pjax-transient="true" name="analytics-event" /> <meta class="js-ga-set" name="dimension1" content="Logged Out"> <meta class="js-ga-set" name="dimension4" content="New repo nav"> <meta name="is-dotcom" content="true"> <meta name="hostname" content="github.com"> <meta name="user-login" content=""> <link rel="mask-icon" href="https://assets-cdn.github.com/pinned-octocat.svg" color="#4078c0"> <link rel="icon" type="image/x-icon" href="https://assets-cdn.github.com/favicon.ico"> <meta content="281ddab5f923f3b75accfb7b07f1991e29567b16" name="form-nonce" /> <link crossorigin="anonymous" href="https://assets-cdn.github.com/assets/github-5e2d1232bc97970f293f259bcb6ab137945cb5635b398c2a81027bf21f0255c8.css" media="all" rel="stylesheet" /> <link crossorigin="anonymous" href="https://assets-cdn.github.com/assets/github2-bcce22057877160838a39c51a6270cf95fb927fc317253965cdbc182f32be960.css" media="all" rel="stylesheet" /> <meta http-equiv="x-pjax-version" content="3cf195f8aa0cc4097aecade8ff90cc36"> <meta name="description" content="react-native - A framework for building native apps with React."> <meta name="go-import" content="github.com/facebook/react-native git https://github.com/facebook/react-native.git"> <meta content="69631" name="octolytics-dimension-user_id" /><meta content="facebook" name="octolytics-dimension-user_login" /><meta content="29028775" name="octolytics-dimension-repository_id" /><meta content="facebook/react-native" name="octolytics-dimension-repository_nwo" /><meta content="true" name="octolytics-dimension-repository_public" /><meta content="false" name="octolytics-dimension-repository_is_fork" /><meta content="29028775" name="octolytics-dimension-repository_network_root_id" /><meta content="facebook/react-native" name="octolytics-dimension-repository_network_root_nwo" /> <link href="https://github.com/facebook/react-native/commits/master.atom" rel="alternate" title="Recent Commits to react-native:master" type="application/atom+xml"> </head> <body class="logged_out env-production vis-public"> <a href="#start-of-content" tabindex="1" class="accessibility-aid js-skip-to-content">Skip to content</a> <div class="header header-logged-out" role="banner"> <div class="container clearfix"> <a class="header-logo-wordmark" href="https://github.com/" data-ga-click="(Logged out) Header, go to homepage, icon:logo-wordmark"> <span class="mega-octicon octicon-logo-github"></span> </a> <div class="header-actions" role="navigation"> <a class="btn btn-primary" href="/join" data-ga-click="(Logged out) Header, clicked Sign up, text:sign-up">Sign up</a> <a class="btn" href="/login?return_to=%2Ffacebook%2Freact-native%2Fblame%2Fmaster%2FLibraries%2FWebSocket%2FWebSocketBase.js" data-ga-click="(Logged out) Header, clicked Sign in, text:sign-in">Sign in</a> </div> <div class="site-search repo-scope js-site-search" role="search"> <!-- </textarea> --><!-- '"` --><form accept-charset="UTF-8" action="/facebook/react-native/search" class="js-site-search-form" data-global-search-url="/search" data-repo-search-url="/facebook/react-native/search" method="get"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="&#x2713;" /></div> <label class="js-chromeless-input-container form-control"> <div class="scope-badge">This repository</div> <input type="text" class="js-site-search-focus js-site-search-field is-clearable chromeless-input" data-hotkey="s" name="q" placeholder="Search" aria-label="Search this repository" data-global-scope-placeholder="Search GitHub" data-repo-scope-placeholder="Search" tabindex="1" autocapitalize="off"> </label> </form> </div> <ul class="header-nav left" role="navigation"> <li class="header-nav-item"> <a class="header-nav-link" href="/explore" data-ga-click="(Logged out) Header, go to explore, text:explore">Explore</a> </li> <li class="header-nav-item"> <a class="header-nav-link" href="/features" data-ga-click="(Logged out) Header, go to features, text:features">Features</a> </li> <li class="header-nav-item"> <a class="header-nav-link" href="https://enterprise.github.com/" data-ga-click="(Logged out) Header, go to enterprise, text:enterprise">Enterprise</a> </li> <li class="header-nav-item"> <a class="header-nav-link" href="/pricing" data-ga-click="(Logged out) Header, go to pricing, text:pricing">Pricing</a> </li> </ul> </div> </div> <div id="start-of-content" class="accessibility-aid"></div> <div id="js-flash-container"> </div> <div role="main" class="main-content"> <div itemscope itemtype="http://schema.org/WebPage"> <div id="js-repo-pjax-container" class="context-loader-container js-repo-nav-next" data-pjax-container> <div class="pagehead repohead instapaper_ignore readability-menu experiment-repo-nav"> <div class="container repohead-details-container"> <ul class="pagehead-actions"> <li> <a href="/login?return_to=%2Ffacebook%2Freact-native" class="btn btn-sm btn-with-count tooltipped tooltipped-n" aria-label="You must be signed in to watch a repository" rel="nofollow"> <span class="octicon octicon-eye"></span> Watch </a> <a class="social-count" href="/facebook/react-native/watchers"> 1,621 </a> </li> <li> <a href="/login?return_to=%2Ffacebook%2Freact-native" class="btn btn-sm btn-with-count tooltipped tooltipped-n" aria-label="You must be signed in to star a repository" rel="nofollow"> <span class="octicon octicon-star"></span> Star </a> <a class="social-count js-social-count" href="/facebook/react-native/stargazers"> 23,212 </a> </li> <li> <a href="/login?return_to=%2Ffacebook%2Freact-native" class="btn btn-sm btn-with-count tooltipped tooltipped-n" aria-label="You must be signed in to fork a repository" rel="nofollow"> <span class="octicon octicon-repo-forked"></span> Fork </a> <a href="/facebook/react-native/network" class="social-count"> 3,760 </a> </li> </ul> <h1 itemscope itemtype="http://data-vocabulary.org/Breadcrumb" class="entry-title public "> <span class="octicon octicon-repo"></span> <span class="author"><a href="/facebook" class="url fn" itemprop="url" rel="author"><span itemprop="title">facebook</span></a></span><!-- --><span class="path-divider">/</span><!-- --><strong><a href="/facebook/react-native" data-pjax="#js-repo-pjax-container">react-native</a></strong> <span class="page-context-loader"> <img alt="" height="16" src="https://assets-cdn.github.com/images/spinners/octocat-spinner-32.gif" width="16" /> </span> </h1> </div> <div class="container"> <nav class="reponav js-repo-nav js-sidenav-container-pjax js-octicon-loaders" role="navigation" data-pjax="#js-repo-pjax-container" data-issue-count-url="/facebook/react-native/issues/counts"> <a href="/facebook/react-native" aria-label="Code" aria-selected="true" class="js-selected-navigation-item selected reponav-item" data-hotkey="g c" data-selected-links="repo_source repo_downloads repo_commits repo_releases repo_tags repo_branches /facebook/react-native"> <span class="octicon octicon-code"></span> Code </a> <a href="/facebook/react-native/issues" class="js-selected-navigation-item reponav-item" data-hotkey="g i" data-selected-links="repo_issues repo_labels repo_milestones /facebook/react-native/issues"> <span class="octicon octicon-issue-opened"></span> Issues <span class="counter">853</span> </a> <a href="/facebook/react-native/pulls" class="js-selected-navigation-item reponav-item" data-hotkey="g p" data-selected-links="repo_pulls /facebook/react-native/pulls"> <span class="octicon octicon-git-pull-request"></span> Pull requests <span class="counter">189</span> </a> <a href="/facebook/react-native/pulse" class="js-selected-navigation-item reponav-item" data-selected-links="pulse /facebook/react-native/pulse"> <span class="octicon octicon-pulse"></span> Pulse </a> <a href="/facebook/react-native/graphs" class="js-selected-navigation-item reponav-item" data-selected-links="repo_graphs repo_contributors /facebook/react-native/graphs"> <span class="octicon octicon-graph"></span> Graphs </a> </nav> </div> </div> <div class="container repo-container new-discussion-timeline experiment-repo-nav"> <div class="repository-content"> <a href="/facebook/react-native/blame/b0e39d26aecce2b5aa33888ca3172205a879ed98/Libraries/WebSocket/WebSocketBase.js" class="hidden js-permalink-shortcut" data-hotkey="y">Permalink</a> <div class="breadcrumb css-truncate blame-breadcrumb js-zeroclipboard-container"> <span class="css-truncate-target js-zeroclipboard-target"><span class="repo-root js-repo-root"><span itemscope="" itemtype="http://data-vocabulary.org/Breadcrumb"><a href="/facebook/react-native" class="" data-branch="master" data-pjax="true" itemscope="url"><span itemprop="title">react-native</span></a></span></span><span class="separator">/</span><span itemscope="" itemtype="http://data-vocabulary.org/Breadcrumb"><a href="/facebook/react-native/tree/master/Libraries" class="" data-branch="master" data-pjax="true" itemscope="url"><span itemprop="title">Libraries</span></a></span><span class="separator">/</span><span itemscope="" itemtype="http://data-vocabulary.org/Breadcrumb"><a href="/facebook/react-native/tree/master/Libraries/WebSocket" class="" data-branch="master" data-pjax="true" itemscope="url"><span itemprop="title">WebSocket</span></a></span><span class="separator">/</span><strong class="final-path">WebSocketBase.js</strong></span> <button aria-label="Copy file path to clipboard" class="js-zeroclipboard btn btn-sm zeroclipboard-button tooltipped tooltipped-s" data-copied-hint="Copied!" type="button"><span class="octicon octicon-clippy"></span></button> </div> <div class="line-age-legend"> <span>Newer</span> <ol> <li class="heat" data-heat="1"></li> <li class="heat" data-heat="2"></li> <li class="heat" data-heat="3"></li> <li class="heat" data-heat="4"></li> <li class="heat" data-heat="5"></li> <li class="heat" data-heat="6"></li> <li class="heat" data-heat="7"></li> <li class="heat" data-heat="8"></li> <li class="heat" data-heat="9"></li> <li class="heat" data-heat="10"></li> </ol> <span>Older</span> </div> <div class="file"> <div class="file-header"> <div class="file-actions"> <div class="btn-group"> <a href="/facebook/react-native/raw/master/Libraries/WebSocket/WebSocketBase.js" class="btn btn-sm" id="raw-url">Raw</a> <a href="/facebook/react-native/blob/master/Libraries/WebSocket/WebSocketBase.js" class="btn btn-sm js-update-url-with-hash">Normal view</a> <a href="/facebook/react-native/commits/master/Libraries/WebSocket/WebSocketBase.js" class="btn btn-sm" rel="nofollow">History</a> </div> </div> <div class="file-info"> <span class="octicon octicon-file-text"></span> <span class="file-mode" title="File Mode">100644</span> <span class="file-info-divider"></span> 106 lines (86 sloc) <span class="file-info-divider"></span> 2.36 KB </div> </div> <div class="blob-wrapper"> <table class="blame-container highlight data js-file-line-container"> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="13"> <a href="/facebook/react-native/commit/babdc2161445f839e76c35365dfa35b199d60dbe" class="blame-sha">babdc21</a> <img alt="@hharnisc" class="avatar blame-commit-avatar" height="32" src="https://avatars2.githubusercontent.com/u/1388079?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/babdc2161445f839e76c35365dfa35b199d60dbe" class="blame-commit-title" title="WebSocket polyfill Summary: - Added as a library in /Libraries/WebSocket - Drag and drop to add to project (similar to adding Geolocation polyfill) - Exposed as `window.WebSocket` which conforms with https://developer.mozilla.org/en-US/docs/Web/API/WebSocket specs Closes https://github.com/facebook/react-native/pull/890 Github Author: <NAME> &lt;<EMAIL>&gt; Test Plan: Imported from GitHub, without a `Test Plan:` line.">WebSocket polyfill</a> <div class="blame-commit-meta"> <a href="/hharnisc" class="muted-link" rel="contributor">hharnisc</a> authored <time datetime="2015-05-14T16:28:09Z" is="relative-time">May 14, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L1">1</td> <td class="blob-code blob-code-inner js-file-line" id="LC1"><span class="pl-c">/**</span></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L2">2</td> <td class="blob-code blob-code-inner js-file-line" id="LC2"><span class="pl-c"> * Copyright (c) 2015-present, Facebook, Inc.</span></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L3">3</td> <td class="blob-code blob-code-inner js-file-line" id="LC3"><span class="pl-c"> * All rights reserved.</span></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L4">4</td> <td class="blob-code blob-code-inner js-file-line" id="LC4"><span class="pl-c"> *</span></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L5">5</td> <td class="blob-code blob-code-inner js-file-line" id="LC5"><span class="pl-c"> * This source code is licensed under the BSD-style license found in the</span></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L6">6</td> <td class="blob-code blob-code-inner js-file-line" id="LC6"><span class="pl-c"> * LICENSE file in the root directory of this source tree. An additional grant</span></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L7">7</td> <td class="blob-code blob-code-inner js-file-line" id="LC7"><span class="pl-c"> * of patent rights can be found in the PATENTS file in the same directory.</span></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L8">8</td> <td class="blob-code blob-code-inner js-file-line" id="LC8"><span class="pl-c"> *</span></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L9">9</td> <td class="blob-code blob-code-inner js-file-line" id="LC9"><span class="pl-c"> * @providesModule WebSocketBase</span></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L10">10</td> <td class="blob-code blob-code-inner js-file-line" id="LC10"><span class="pl-c"> */</span></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L11">11</td> <td class="blob-code blob-code-inner js-file-line" id="LC11"><span class="pl-s"><span class="pl-pds">&#39;</span>use strict<span class="pl-pds">&#39;</span></span>;</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L12">12</td> <td class="blob-code blob-code-inner js-file-line" id="LC12"></td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="3"> <a href="/facebook/react-native/commit/626b551ff2e09f2770bac71a5d14d139f1b09226" class="blame-sha">626b551</a> <img alt="@leeyeh" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/175227?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/626b551ff2e09f2770bac71a5d14d139f1b09226" class="blame-commit-title" title="Implement EventTarget interface for WebSocket. Summary: close #2583Closes https://github.com/facebook/react-native/pull/2599 Reviewed By: @​svcscm Differential Revision: D2498641 Pulled By: @vjeux">Implement EventTarget interface for WebSocket.</a> <div class="blame-commit-meta"> <a href="/leeyeh" class="muted-link" rel="contributor">leeyeh</a> authored <time datetime="2015-10-02T00:38:40Z" is="relative-time">Oct 1, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="2"></td> <td class="blob-num blame-blob-num js-line-number" id="L13">13</td> <td class="blob-code blob-code-inner js-file-line" id="LC13"><span class="pl-k">var</span> EventTarget <span class="pl-k">=</span> <span class="pl-c1">require</span>(<span class="pl-s"><span class="pl-pds">&#39;</span>event-target-shim<span class="pl-pds">&#39;</span></span>);</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="2"></td> <td class="blob-num blame-blob-num js-line-number" id="L14">14</td> <td class="blob-code blob-code-inner js-file-line" id="LC14"></td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="4"> <a href="/facebook/react-native/commit/babdc2161445f839e76c35365dfa35b199d60dbe" class="blame-sha">babdc21</a> <img alt="@hharnisc" class="avatar blame-commit-avatar" height="32" src="https://avatars2.githubusercontent.com/u/1388079?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/babdc2161445f839e76c35365dfa35b199d60dbe" class="blame-commit-title" title="WebSocket polyfill Summary: - Added as a library in /Libraries/WebSocket - Drag and drop to add to project (similar to adding Geolocation polyfill) - Exposed as `window.WebSocket` which conforms with https://developer.mozilla.org/en-US/docs/Web/API/WebSocket specs Closes https://github.com/facebook/react-native/pull/890 Github Author: <NAME> &lt;<EMAIL>&gt; Test Plan: Imported from GitHub, without a `Test Plan:` line.">WebSocket polyfill</a> <div class="blame-commit-meta"> <a href="/hharnisc" class="muted-link" rel="contributor">hharnisc</a> authored <time datetime="2015-05-14T16:28:09Z" is="relative-time">May 14, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L15">15</td> <td class="blob-code blob-code-inner js-file-line" id="LC15"><span class="pl-c">/**</span></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L16">16</td> <td class="blob-code blob-code-inner js-file-line" id="LC16"><span class="pl-c"> * Shared base for platform-specific WebSocket implementations.</span></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L17">17</td> <td class="blob-code blob-code-inner js-file-line" id="LC17"><span class="pl-c"> */</span></td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/626b551ff2e09f2770bac71a5d14d139f1b09226" class="blame-sha">626b551</a> <img alt="@leeyeh" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/175227?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/626b551ff2e09f2770bac71a5d14d139f1b09226" class="blame-commit-title" title="Implement EventTarget interface for WebSocket. Summary: close #2583Closes https://github.com/facebook/react-native/pull/2599 Reviewed By: @​svcscm Differential Revision: D2498641 Pulled By: @vjeux">Implement EventTarget interface for WebSocket.</a> <div class="blame-commit-meta"> <a href="/leeyeh" class="muted-link" rel="contributor">leeyeh</a> authored <time datetime="2015-10-02T00:38:40Z" is="relative-time">Oct 2, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="2"></td> <td class="blob-num blame-blob-num js-line-number" id="L18">18</td> <td class="blob-code blob-code-inner js-file-line" id="LC18"><span class="pl-k">class</span> <span class="pl-en">WebSocketBase</span> <span class="pl-k">extends</span> <span class="pl-en">EventTarget</span> {</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="19"> <a href="/facebook/react-native/commit/babdc2161445f839e76c35365dfa35b199d60dbe" class="blame-sha">babdc21</a> <img alt="@hharnisc" class="avatar blame-commit-avatar" height="32" src="https://avatars2.githubusercontent.com/u/1388079?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/babdc2161445f839e76c35365dfa35b199d60dbe" class="blame-commit-title" title="WebSocket polyfill Summary: - Added as a library in /Libraries/WebSocket - Drag and drop to add to project (similar to adding Geolocation polyfill) - Exposed as `window.WebSocket` which conforms with https://developer.mozilla.org/en-US/docs/Web/API/WebSocket specs Closes https://github.com/facebook/react-native/pull/890 Github Author: <NAME> &lt;<EMAIL>&gt; Test Plan: Imported from GitHub, without a `Test Plan:` line.">WebSocket polyfill</a> <div class="blame-commit-meta"> <a href="/hharnisc" class="muted-link" rel="contributor">hharnisc</a> authored <time datetime="2015-05-14T16:28:09Z" is="relative-time">May 14, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L19">19</td> <td class="blob-code blob-code-inner js-file-line" id="LC19"> CONNECTING<span class="pl-k">:</span> number;</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L20">20</td> <td class="blob-code blob-code-inner js-file-line" id="LC20"> OPEN<span class="pl-k">:</span> number;</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L21">21</td> <td class="blob-code blob-code-inner js-file-line" id="LC21"> CLOSING<span class="pl-k">:</span> number;</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L22">22</td> <td class="blob-code blob-code-inner js-file-line" id="LC22"> CLOSED<span class="pl-k">:</span> number;</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L23">23</td> <td class="blob-code blob-code-inner js-file-line" id="LC23"></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L24">24</td> <td class="blob-code blob-code-inner js-file-line" id="LC24"> onclose<span class="pl-k">:</span> <span class="pl-k">?</span><span class="pl-c1">Function</span>;</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L25">25</td> <td class="blob-code blob-code-inner js-file-line" id="LC25"> onerror<span class="pl-k">:</span> <span class="pl-k">?</span><span class="pl-c1">Function</span>;</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L26">26</td> <td class="blob-code blob-code-inner js-file-line" id="LC26"> onmessage<span class="pl-k">:</span> <span class="pl-k">?</span><span class="pl-c1">Function</span>;</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L27">27</td> <td class="blob-code blob-code-inner js-file-line" id="LC27"> onopen<span class="pl-k">:</span> <span class="pl-k">?</span><span class="pl-c1">Function</span>;</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L28">28</td> <td class="blob-code blob-code-inner js-file-line" id="LC28"></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L29">29</td> <td class="blob-code blob-code-inner js-file-line" id="LC29"> binaryType<span class="pl-k">:</span> <span class="pl-k">?</span>string;</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L30">30</td> <td class="blob-code blob-code-inner js-file-line" id="LC30"> bufferedAmount<span class="pl-k">:</span> number;</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L31">31</td> <td class="blob-code blob-code-inner js-file-line" id="LC31"> extension<span class="pl-k">:</span> <span class="pl-k">?</span>string;</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L32">32</td> <td class="blob-code blob-code-inner js-file-line" id="LC32"> protocol<span class="pl-k">:</span> <span class="pl-k">?</span>string;</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L33">33</td> <td class="blob-code blob-code-inner js-file-line" id="LC33"> readyState<span class="pl-k">:</span> number;</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L34">34</td> <td class="blob-code blob-code-inner js-file-line" id="LC34"> url<span class="pl-k">:</span> <span class="pl-k">?</span>string;</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L35">35</td> <td class="blob-code blob-code-inner js-file-line" id="LC35"></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L36">36</td> <td class="blob-code blob-code-inner js-file-line" id="LC36"> <span class="pl-en">constructor</span>(<span class="pl-smi">url</span>: <span class="pl-smi">string</span>, <span class="pl-smi">protocols</span>: ?<span class="pl-smi">any</span>) {</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/626b551ff2e09f2770bac71a5d14d139f1b09226" class="blame-sha">626b551</a> <img alt="@leeyeh" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/175227?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/626b551ff2e09f2770bac71a5d14d139f1b09226" class="blame-commit-title" title="Implement EventTarget interface for WebSocket. Summary: close #2583Closes https://github.com/facebook/react-native/pull/2599 Reviewed By: @​svcscm Differential Revision: D2498641 Pulled By: @vjeux">Implement EventTarget interface for WebSocket.</a> <div class="blame-commit-meta"> <a href="/leeyeh" class="muted-link" rel="contributor">leeyeh</a> authored <time datetime="2015-10-02T00:38:40Z" is="relative-time">Oct 2, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="2"></td> <td class="blob-num blame-blob-num js-line-number" id="L37">37</td> <td class="blob-code blob-code-inner js-file-line" id="LC37"> <span class="pl-v">super</span>();</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="10"> <a href="/facebook/react-native/commit/babdc2161445f839e76c35365dfa35b199d60dbe" class="blame-sha">babdc21</a> <img alt="@hharnisc" class="avatar blame-commit-avatar" height="32" src="https://avatars2.githubusercontent.com/u/1388079?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/babdc2161445f839e76c35365dfa35b199d60dbe" class="blame-commit-title" title="WebSocket polyfill Summary: - Added as a library in /Libraries/WebSocket - Drag and drop to add to project (similar to adding Geolocation polyfill) - Exposed as `window.WebSocket` which conforms with https://developer.mozilla.org/en-US/docs/Web/API/WebSocket specs Closes https://github.com/facebook/react-native/pull/890 Github Author: <NAME> &lt;<EMAIL>&gt; Test Plan: Imported from GitHub, without a `Test Plan:` line.">WebSocket polyfill</a> <div class="blame-commit-meta"> <a href="/hharnisc" class="muted-link" rel="contributor">hharnisc</a> authored <time datetime="2015-05-14T16:28:09Z" is="relative-time">May 14, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L38">38</td> <td class="blob-code blob-code-inner js-file-line" id="LC38"> <span class="pl-smi">this</span>.<span class="pl-c1">CONNECTING</span> <span class="pl-k">=</span> <span class="pl-c1">0</span>;</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L39">39</td> <td class="blob-code blob-code-inner js-file-line" id="LC39"> <span class="pl-smi">this</span>.<span class="pl-c1">OPEN</span> <span class="pl-k">=</span> <span class="pl-c1">1</span>;</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L40">40</td> <td class="blob-code blob-code-inner js-file-line" id="LC40"> <span class="pl-smi">this</span>.<span class="pl-c1">CLOSING</span> <span class="pl-k">=</span> <span class="pl-c1">2</span>;</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L41">41</td> <td class="blob-code blob-code-inner js-file-line" id="LC41"> <span class="pl-smi">this</span>.<span class="pl-c1">CLOSED</span> <span class="pl-k">=</span> <span class="pl-c1">3</span>;</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L42">42</td> <td class="blob-code blob-code-inner js-file-line" id="LC42"></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L43">43</td> <td class="blob-code blob-code-inner js-file-line" id="LC43"> <span class="pl-k">if</span> (<span class="pl-k">!</span>protocols) {</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L44">44</td> <td class="blob-code blob-code-inner js-file-line" id="LC44"> protocols <span class="pl-k">=</span> [];</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L45">45</td> <td class="blob-code blob-code-inner js-file-line" id="LC45"> }</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L46">46</td> <td class="blob-code blob-code-inner js-file-line" id="LC46"></td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/e6372719eafa5675e39f0e0f32f17dda1f458397" class="blame-sha">e637271</a> <img alt="@kenwheeler" class="avatar blame-commit-avatar" height="32" src="https://avatars2.githubusercontent.com/u/286616?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/e6372719eafa5675e39f0e0f32f17dda1f458397" class="blame-commit-title" title="Fixes #3846 Summary: This fixes a leak in regards to web sockets, detailed in #3846 . The connection state constants referenced the class rather than the instance and were coming back undefined. cc brentvatne stephenelliot Closes https://github.com/facebook/react-native/pull/3896 Reviewed By: svcscm Differential Revision: D2626399 Pulled By: vjeux fb-gh-sync-id: f42670003b68ed5b86f078d7ed74c2695f30fc69">Fixes #3846</a> <div class="blame-commit-meta"> <a href="/kenwheeler" class="muted-link" rel="contributor">kenwheeler</a> authored <time datetime="2015-11-06T19:23:29Z" is="relative-time">Nov 6, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="1"></td> <td class="blob-num blame-blob-num js-line-number" id="L47">47</td> <td class="blob-code blob-code-inner js-file-line" id="LC47"> <span class="pl-smi">this</span>.<span class="pl-c1">readyState</span> <span class="pl-k">=</span> <span class="pl-smi">this</span>.<span class="pl-c1">CONNECTING</span>;</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="5"> <a href="/facebook/react-native/commit/babdc2161445f839e76c35365dfa35b199d60dbe" class="blame-sha">babdc21</a> <img alt="@hharnisc" class="avatar blame-commit-avatar" height="32" src="https://avatars2.githubusercontent.com/u/1388079?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/babdc2161445f839e76c35365dfa35b199d60dbe" class="blame-commit-title" title="WebSocket polyfill Summary: - Added as a library in /Libraries/WebSocket - Drag and drop to add to project (similar to adding Geolocation polyfill) - Exposed as `window.WebSocket` which conforms with https://developer.mozilla.org/en-US/docs/Web/API/WebSocket specs Closes https://github.com/facebook/react-native/pull/890 Github Author: <NAME> &lt;<EMAIL>&gt; Test Plan: Imported from GitHub, without a `Test Plan:` line.">WebSocket polyfill</a> <div class="blame-commit-meta"> <a href="/hharnisc" class="muted-link" rel="contributor">hharnisc</a> authored <time datetime="2015-05-14T16:28:09Z" is="relative-time">May 14, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L48">48</td> <td class="blob-code blob-code-inner js-file-line" id="LC48"> <span class="pl-smi">this</span>.<span class="pl-en">connectToSocketImpl</span>(url);</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L49">49</td> <td class="blob-code blob-code-inner js-file-line" id="LC49"> }</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L50">50</td> <td class="blob-code blob-code-inner js-file-line" id="LC50"></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L51">51</td> <td class="blob-code blob-code-inner js-file-line" id="LC51"> <span class="pl-en">close</span>()<span class="pl-k">:</span> <span class="pl-k">void</span> {</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="3"> <a href="/facebook/react-native/commit/e6372719eafa5675e39f0e0f32f17dda1f458397" class="blame-sha">e637271</a> <img alt="@kenwheeler" class="avatar blame-commit-avatar" height="32" src="https://avatars2.githubusercontent.com/u/286616?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/e6372719eafa5675e39f0e0f32f17dda1f458397" class="blame-commit-title" title="Fixes #3846 Summary: This fixes a leak in regards to web sockets, detailed in #3846 . The connection state constants referenced the class rather than the instance and were coming back undefined. cc brentvatne stephenelliot Closes https://github.com/facebook/react-native/pull/3896 Reviewed By: svcscm Differential Revision: D2626399 Pulled By: vjeux fb-gh-sync-id: f42670003b68ed5b86f078d7ed74c2695f30fc69">Fixes #3846</a> <div class="blame-commit-meta"> <a href="/kenwheeler" class="muted-link" rel="contributor">kenwheeler</a> authored <time datetime="2015-11-06T19:23:29Z" is="relative-time">Nov 6, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="1"></td> <td class="blob-num blame-blob-num js-line-number" id="L52">52</td> <td class="blob-code blob-code-inner js-file-line" id="LC52"> <span class="pl-k">if</span> (<span class="pl-smi">this</span>.<span class="pl-c1">readyState</span> <span class="pl-k">===</span> <span class="pl-smi">this</span>.<span class="pl-c1">CLOSING</span> <span class="pl-k">||</span></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="1"></td> <td class="blob-num blame-blob-num js-line-number" id="L53">53</td> <td class="blob-code blob-code-inner js-file-line" id="LC53"> <span class="pl-smi">this</span>.<span class="pl-c1">readyState</span> <span class="pl-k">===</span> <span class="pl-smi">this</span>.<span class="pl-c1">CLOSED</span>) {</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="4"> <a href="/facebook/react-native/commit/babdc2161445f839e76c35365dfa35b199d60dbe" class="blame-sha">babdc21</a> <img alt="@hharnisc" class="avatar blame-commit-avatar" height="32" src="https://avatars2.githubusercontent.com/u/1388079?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/babdc2161445f839e76c35365dfa35b199d60dbe" class="blame-commit-title" title="WebSocket polyfill Summary: - Added as a library in /Libraries/WebSocket - Drag and drop to add to project (similar to adding Geolocation polyfill) - Exposed as `window.WebSocket` which conforms with https://developer.mozilla.org/en-US/docs/Web/API/WebSocket specs Closes https://github.com/facebook/react-native/pull/890 Github Author: <NAME> &lt;<EMAIL>&gt; Test Plan: Imported from GitHub, without a `Test Plan:` line.">WebSocket polyfill</a> <div class="blame-commit-meta"> <a href="/hharnisc" class="muted-link" rel="contributor">hharnisc</a> authored <time datetime="2015-05-14T16:28:09Z" is="relative-time">May 14, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L54">54</td> <td class="blob-code blob-code-inner js-file-line" id="LC54"> <span class="pl-k">return</span>;</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L55">55</td> <td class="blob-code blob-code-inner js-file-line" id="LC55"> }</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L56">56</td> <td class="blob-code blob-code-inner js-file-line" id="LC56"></td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/e6372719eafa5675e39f0e0f32f17dda1f458397" class="blame-sha">e637271</a> <img alt="@kenwheeler" class="avatar blame-commit-avatar" height="32" src="https://avatars2.githubusercontent.com/u/286616?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/e6372719eafa5675e39f0e0f32f17dda1f458397" class="blame-commit-title" title="Fixes #3846 Summary: This fixes a leak in regards to web sockets, detailed in #3846 . The connection state constants referenced the class rather than the instance and were coming back undefined. cc brentvatne stephenelliot Closes https://github.com/facebook/react-native/pull/3896 Reviewed By: svcscm Differential Revision: D2626399 Pulled By: vjeux fb-gh-sync-id: f42670003b68ed5b86f078d7ed74c2695f30fc69">Fixes #3846</a> <div class="blame-commit-meta"> <a href="/kenwheeler" class="muted-link" rel="contributor">kenwheeler</a> authored <time datetime="2015-11-06T19:23:29Z" is="relative-time">Nov 6, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="1"></td> <td class="blob-num blame-blob-num js-line-number" id="L57">57</td> <td class="blob-code blob-code-inner js-file-line" id="LC57"> <span class="pl-k">if</span> (<span class="pl-smi">this</span>.<span class="pl-c1">readyState</span> <span class="pl-k">===</span> <span class="pl-smi">this</span>.<span class="pl-c1">CONNECTING</span>) {</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="4"> <a href="/facebook/react-native/commit/babdc2161445f839e76c35365dfa35b199d60dbe" class="blame-sha">babdc21</a> <img alt="@hharnisc" class="avatar blame-commit-avatar" height="32" src="https://avatars2.githubusercontent.com/u/1388079?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/babdc2161445f839e76c35365dfa35b199d60dbe" class="blame-commit-title" title="WebSocket polyfill Summary: - Added as a library in /Libraries/WebSocket - Drag and drop to add to project (similar to adding Geolocation polyfill) - Exposed as `window.WebSocket` which conforms with https://developer.mozilla.org/en-US/docs/Web/API/WebSocket specs Closes https://github.com/facebook/react-native/pull/890 Github Author: <NAME> &lt;<EMAIL>&gt; Test Plan: Imported from GitHub, without a `Test Plan:` line.">WebSocket polyfill</a> <div class="blame-commit-meta"> <a href="/hharnisc" class="muted-link" rel="contributor">hharnisc</a> authored <time datetime="2015-05-14T16:28:09Z" is="relative-time">May 14, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L58">58</td> <td class="blob-code blob-code-inner js-file-line" id="LC58"> <span class="pl-smi">this</span>.<span class="pl-en">cancelConnectionImpl</span>();</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L59">59</td> <td class="blob-code blob-code-inner js-file-line" id="LC59"> }</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L60">60</td> <td class="blob-code blob-code-inner js-file-line" id="LC60"></td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/e6372719eafa5675e39f0e0f32f17dda1f458397" class="blame-sha">e637271</a> <img alt="@kenwheeler" class="avatar blame-commit-avatar" height="32" src="https://avatars2.githubusercontent.com/u/286616?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/e6372719eafa5675e39f0e0f32f17dda1f458397" class="blame-commit-title" title="Fixes #3846 Summary: This fixes a leak in regards to web sockets, detailed in #3846 . The connection state constants referenced the class rather than the instance and were coming back undefined. cc brentvatne stephenelliot Closes https://github.com/facebook/react-native/pull/3896 Reviewed By: svcscm Differential Revision: D2626399 Pulled By: vjeux fb-gh-sync-id: f42670003b68ed5b86f078d7ed74c2695f30fc69">Fixes #3846</a> <div class="blame-commit-meta"> <a href="/kenwheeler" class="muted-link" rel="contributor">kenwheeler</a> authored <time datetime="2015-11-06T19:23:29Z" is="relative-time">Nov 6, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="1"></td> <td class="blob-num blame-blob-num js-line-number" id="L61">61</td> <td class="blob-code blob-code-inner js-file-line" id="LC61"> <span class="pl-smi">this</span>.<span class="pl-c1">readyState</span> <span class="pl-k">=</span> <span class="pl-smi">this</span>.<span class="pl-c1">CLOSING</span>;</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="5"> <a href="/facebook/react-native/commit/babdc2161445f839e76c35365dfa35b199d60dbe" class="blame-sha">babdc21</a> <img alt="@hharnisc" class="avatar blame-commit-avatar" height="32" src="https://avatars2.githubusercontent.com/u/1388079?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/babdc2161445f839e76c35365dfa35b199d60dbe" class="blame-commit-title" title="WebSocket polyfill Summary: - Added as a library in /Libraries/WebSocket - Drag and drop to add to project (similar to adding Geolocation polyfill) - Exposed as `window.WebSocket` which conforms with https://developer.mozilla.org/en-US/docs/Web/API/WebSocket specs Closes https://github.com/facebook/react-native/pull/890 Github Author: <NAME> &lt;<EMAIL>&gt; Test Plan: Imported from GitHub, without a `Test Plan:` line.">WebSocket polyfill</a> <div class="blame-commit-meta"> <a href="/hharnisc" class="muted-link" rel="contributor">hharnisc</a> authored <time datetime="2015-05-14T16:28:09Z" is="relative-time">May 14, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L62">62</td> <td class="blob-code blob-code-inner js-file-line" id="LC62"> <span class="pl-smi">this</span>.<span class="pl-en">closeConnectionImpl</span>();</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L63">63</td> <td class="blob-code blob-code-inner js-file-line" id="LC63"> }</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L64">64</td> <td class="blob-code blob-code-inner js-file-line" id="LC64"></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L65">65</td> <td class="blob-code blob-code-inner js-file-line" id="LC65"> <span class="pl-c1">send</span>(data<span class="pl-k">:</span> any)<span class="pl-k">:</span> <span class="pl-k">void</span> {</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/e6372719eafa5675e39f0e0f32f17dda1f458397" class="blame-sha">e637271</a> <img alt="@kenwheeler" class="avatar blame-commit-avatar" height="32" src="https://avatars2.githubusercontent.com/u/286616?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/e6372719eafa5675e39f0e0f32f17dda1f458397" class="blame-commit-title" title="Fixes #3846 Summary: This fixes a leak in regards to web sockets, detailed in #3846 . The connection state constants referenced the class rather than the instance and were coming back undefined. cc brentvatne stephenelliot Closes https://github.com/facebook/react-native/pull/3896 Reviewed By: svcscm Differential Revision: D2626399 Pulled By: vjeux fb-gh-sync-id: f42670003b68ed5b86f078d7ed74c2695f30fc69">Fixes #3846</a> <div class="blame-commit-meta"> <a href="/kenwheeler" class="muted-link" rel="contributor">kenwheeler</a> authored <time datetime="2015-11-06T19:23:29Z" is="relative-time">Nov 6, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="1"></td> <td class="blob-num blame-blob-num js-line-number" id="L66">66</td> <td class="blob-code blob-code-inner js-file-line" id="LC66"> <span class="pl-k">if</span> (<span class="pl-smi">this</span>.<span class="pl-c1">readyState</span> <span class="pl-k">===</span> <span class="pl-smi">this</span>.<span class="pl-c1">CONNECTING</span>) {</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="34"> <a href="/facebook/react-native/commit/babdc2161445f839e76c35365dfa35b199d60dbe" class="blame-sha">babdc21</a> <img alt="@hharnisc" class="avatar blame-commit-avatar" height="32" src="https://avatars2.githubusercontent.com/u/1388079?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/babdc2161445f839e76c35365dfa35b199d60dbe" class="blame-commit-title" title="WebSocket polyfill Summary: - Added as a library in /Libraries/WebSocket - Drag and drop to add to project (similar to adding Geolocation polyfill) - Exposed as `window.WebSocket` which conforms with https://developer.mozilla.org/en-US/docs/Web/API/WebSocket specs Closes https://github.com/facebook/react-native/pull/890 Github Author: <NAME> &lt;<EMAIL>&gt; Test Plan: Imported from GitHub, without a `Test Plan:` line.">WebSocket polyfill</a> <div class="blame-commit-meta"> <a href="/hharnisc" class="muted-link" rel="contributor">hharnisc</a> authored <time datetime="2015-05-14T16:28:09Z" is="relative-time">May 14, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L67">67</td> <td class="blob-code blob-code-inner js-file-line" id="LC67"> <span class="pl-k">throw</span> <span class="pl-k">new</span> <span class="pl-en">Error</span>(<span class="pl-s"><span class="pl-pds">&#39;</span>INVALID_STATE_ERR<span class="pl-pds">&#39;</span></span>);</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L68">68</td> <td class="blob-code blob-code-inner js-file-line" id="LC68"> }</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L69">69</td> <td class="blob-code blob-code-inner js-file-line" id="LC69"></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L70">70</td> <td class="blob-code blob-code-inner js-file-line" id="LC70"> <span class="pl-k">if</span> (<span class="pl-k">typeof</span> data <span class="pl-k">===</span> <span class="pl-s"><span class="pl-pds">&#39;</span>string<span class="pl-pds">&#39;</span></span>) {</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L71">71</td> <td class="blob-code blob-code-inner js-file-line" id="LC71"> <span class="pl-smi">this</span>.<span class="pl-en">sendStringImpl</span>(data);</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L72">72</td> <td class="blob-code blob-code-inner js-file-line" id="LC72"> } <span class="pl-k">else</span> <span class="pl-k">if</span> (data <span class="pl-k">instanceof</span> ArrayBuffer) {</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L73">73</td> <td class="blob-code blob-code-inner js-file-line" id="LC73"> <span class="pl-smi">this</span>.<span class="pl-en">sendArrayBufferImpl</span>(data);</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L74">74</td> <td class="blob-code blob-code-inner js-file-line" id="LC74"> } <span class="pl-k">else</span> {</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L75">75</td> <td class="blob-code blob-code-inner js-file-line" id="LC75"> <span class="pl-k">throw</span> <span class="pl-k">new</span> <span class="pl-en">Error</span>(<span class="pl-s"><span class="pl-pds">&#39;</span>Not supported data type<span class="pl-pds">&#39;</span></span>);</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L76">76</td> <td class="blob-code blob-code-inner js-file-line" id="LC76"> }</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L77">77</td> <td class="blob-code blob-code-inner js-file-line" id="LC77"> }</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L78">78</td> <td class="blob-code blob-code-inner js-file-line" id="LC78"></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L79">79</td> <td class="blob-code blob-code-inner js-file-line" id="LC79"> <span class="pl-en">closeConnectionImpl</span>()<span class="pl-k">:</span> <span class="pl-k">void</span> {</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L80">80</td> <td class="blob-code blob-code-inner js-file-line" id="LC80"> <span class="pl-k">throw</span> <span class="pl-k">new</span> <span class="pl-en">Error</span>(<span class="pl-s"><span class="pl-pds">&#39;</span>Subclass must define closeConnectionImpl method<span class="pl-pds">&#39;</span></span>);</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L81">81</td> <td class="blob-code blob-code-inner js-file-line" id="LC81"> }</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L82">82</td> <td class="blob-code blob-code-inner js-file-line" id="LC82"></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L83">83</td> <td class="blob-code blob-code-inner js-file-line" id="LC83"> <span class="pl-en">connectToSocketImpl</span>()<span class="pl-k">:</span> <span class="pl-k">void</span> {</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L84">84</td> <td class="blob-code blob-code-inner js-file-line" id="LC84"> <span class="pl-k">throw</span> <span class="pl-k">new</span> <span class="pl-en">Error</span>(<span class="pl-s"><span class="pl-pds">&#39;</span>Subclass must define connectToSocketImpl method<span class="pl-pds">&#39;</span></span>);</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L85">85</td> <td class="blob-code blob-code-inner js-file-line" id="LC85"> }</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L86">86</td> <td class="blob-code blob-code-inner js-file-line" id="LC86"></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L87">87</td> <td class="blob-code blob-code-inner js-file-line" id="LC87"> <span class="pl-en">cancelConnectionImpl</span>()<span class="pl-k">:</span> <span class="pl-k">void</span> {</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L88">88</td> <td class="blob-code blob-code-inner js-file-line" id="LC88"> <span class="pl-k">throw</span> <span class="pl-k">new</span> <span class="pl-en">Error</span>(<span class="pl-s"><span class="pl-pds">&#39;</span>Subclass must define cancelConnectionImpl method<span class="pl-pds">&#39;</span></span>);</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L89">89</td> <td class="blob-code blob-code-inner js-file-line" id="LC89"> }</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L90">90</td> <td class="blob-code blob-code-inner js-file-line" id="LC90"></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L91">91</td> <td class="blob-code blob-code-inner js-file-line" id="LC91"> <span class="pl-en">sendStringImpl</span>()<span class="pl-k">:</span> <span class="pl-k">void</span> {</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L92">92</td> <td class="blob-code blob-code-inner js-file-line" id="LC92"> <span class="pl-k">throw</span> <span class="pl-k">new</span> <span class="pl-en">Error</span>(<span class="pl-s"><span class="pl-pds">&#39;</span>Subclass must define sendStringImpl method<span class="pl-pds">&#39;</span></span>);</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L93">93</td> <td class="blob-code blob-code-inner js-file-line" id="LC93"> }</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L94">94</td> <td class="blob-code blob-code-inner js-file-line" id="LC94"></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L95">95</td> <td class="blob-code blob-code-inner js-file-line" id="LC95"> <span class="pl-en">sendArrayBufferImpl</span>()<span class="pl-k">:</span> <span class="pl-k">void</span> {</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L96">96</td> <td class="blob-code blob-code-inner js-file-line" id="LC96"> <span class="pl-k">throw</span> <span class="pl-k">new</span> <span class="pl-en">Error</span>(<span class="pl-s"><span class="pl-pds">&#39;</span>Subclass must define sendArrayBufferImpl method<span class="pl-pds">&#39;</span></span>);</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L97">97</td> <td class="blob-code blob-code-inner js-file-line" id="LC97"> }</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L98">98</td> <td class="blob-code blob-code-inner js-file-line" id="LC98">}</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L99">99</td> <td class="blob-code blob-code-inner js-file-line" id="LC99"></td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="6"> <a href="/facebook/react-native/commit/e6372719eafa5675e39f0e0f32f17dda1f458397" class="blame-sha">e637271</a> <img alt="@kenwheeler" class="avatar blame-commit-avatar" height="32" src="https://avatars2.githubusercontent.com/u/286616?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/e6372719eafa5675e39f0e0f32f17dda1f458397" class="blame-commit-title" title="Fixes #3846 Summary: This fixes a leak in regards to web sockets, detailed in #3846 . The connection state constants referenced the class rather than the instance and were coming back undefined. cc brentvatne stephenelliot Closes https://github.com/facebook/react-native/pull/3896 Reviewed By: svcscm Differential Revision: D2626399 Pulled By: vjeux fb-gh-sync-id: f42670003b68ed5b86f078d7ed74c2695f30fc69">Fixes #3846</a> <div class="blame-commit-meta"> <a href="/kenwheeler" class="muted-link" rel="contributor">kenwheeler</a> authored <time datetime="2015-11-06T19:23:29Z" is="relative-time">Nov 6, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="1"></td> <td class="blob-num blame-blob-num js-line-number" id="L100">100</td> <td class="blob-code blob-code-inner js-file-line" id="LC100"><span class="pl-smi">WebSocketBase</span>.<span class="pl-c1">CONNECTING</span> <span class="pl-k">=</span> <span class="pl-c1">0</span>;</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="1"></td> <td class="blob-num blame-blob-num js-line-number" id="L101">101</td> <td class="blob-code blob-code-inner js-file-line" id="LC101"><span class="pl-smi">WebSocketBase</span>.<span class="pl-c1">OPEN</span> <span class="pl-k">=</span> <span class="pl-c1">1</span>;</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="1"></td> <td class="blob-num blame-blob-num js-line-number" id="L102">102</td> <td class="blob-code blob-code-inner js-file-line" id="LC102"><span class="pl-smi">WebSocketBase</span>.<span class="pl-c1">CLOSING</span> <span class="pl-k">=</span> <span class="pl-c1">2</span>;</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="1"></td> <td class="blob-num blame-blob-num js-line-number" id="L103">103</td> <td class="blob-code blob-code-inner js-file-line" id="LC103"><span class="pl-smi">WebSocketBase</span>.<span class="pl-c1">CLOSED</span> <span class="pl-k">=</span> <span class="pl-c1">3</span>;</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="1"></td> <td class="blob-num blame-blob-num js-line-number" id="L104">104</td> <td class="blob-code blob-code-inner js-file-line" id="LC104"></td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/babdc2161445f839e76c35365dfa35b199d60dbe" class="blame-sha">babdc21</a> <img alt="@hharnisc" class="avatar blame-commit-avatar" height="32" src="https://avatars2.githubusercontent.com/u/1388079?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/babdc2161445f839e76c35365dfa35b199d60dbe" class="blame-commit-title" title="WebSocket polyfill Summary: - Added as a library in /Libraries/WebSocket - Drag and drop to add to project (similar to adding Geolocation polyfill) - Exposed as `window.WebSocket` which conforms with https://developer.mozilla.org/en-US/docs/Web/API/WebSocket specs Closes https://github.com/facebook/react-native/pull/890 Github Author: <NAME> &lt;<EMAIL>&gt; Test Plan: Imported from GitHub, without a `Test Plan:` line.">WebSocket polyfill</a> <div class="blame-commit-meta"> <a href="/hharnisc" class="muted-link" rel="contributor">hharnisc</a> authored <time datetime="2015-05-14T16:28:09Z" is="relative-time">May 14, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L105">105</td> <td class="blob-code blob-code-inner js-file-line" id="LC105"><span class="pl-smi">module</span>.<span class="pl-smi">exports</span> <span class="pl-k">=</span> WebSocketBase;</td> </tr> </table> </div> </div> </div> <div class="modal-backdrop"></div> </div> </div> </div> </div> <div class="container"> <div class="site-footer" role="contentinfo"> <ul class="site-footer-links right"> <li><a href="https://status.github.com/" data-ga-click="Footer, go to status, text:status">Status</a></li> <li><a href="https://developer.github.com" data-ga-click="Footer, go to api, text:api">API</a></li> <li><a href="https://training.github.com" data-ga-click="Footer, go to training, text:training">Training</a></li> <li><a href="https://shop.github.com" data-ga-click="Footer, go to shop, text:shop">Shop</a></li> <li><a href="https://github.com/blog" data-ga-click="Footer, go to blog, text:blog">Blog</a></li> <li><a href="https://github.com/about" data-ga-click="Footer, go to about, text:about">About</a></li> <li><a href="https://github.com/pricing" data-ga-click="Footer, go to pricing, text:pricing">Pricing</a></li> </ul> <a href="https://github.com" aria-label="Homepage"> <span class="mega-octicon octicon-mark-github" title="GitHub"></span> </a> <ul class="site-footer-links"> <li>&copy; 2015 <span title="0.10986s from github-fe131-cp1-prd.iad.github.net">GitHub</span>, Inc.</li> <li><a href="https://github.com/site/terms" data-ga-click="Footer, go to terms, text:terms">Terms</a></li> <li><a href="https://github.com/site/privacy" data-ga-click="Footer, go to privacy, text:privacy">Privacy</a></li> <li><a href="https://github.com/security" data-ga-click="Footer, go to security, text:security">Security</a></li> <li><a href="https://github.com/contact" data-ga-click="Footer, go to contact, text:contact">Contact</a></li> <li><a href="https://help.github.com" data-ga-click="Footer, go to help, text:help">Help</a></li> </ul> </div> </div> <div id="ajax-error-message" class="flash flash-error"> <span class="octicon octicon-alert"></span> <button type="button" class="flash-close js-flash-close js-ajax-error-dismiss" aria-label="Dismiss error"> <span class="octicon octicon-x"></span> </button> Something went wrong with that request. Please try again. </div> <script crossorigin="anonymous" src="https://assets-cdn.github.com/assets/frameworks-ca4183ce112a8e8984270469e316f4700bbe45a08e1545d359a2df9ba18a85b6.js"></script> <script async="async" crossorigin="anonymous" src="https://assets-cdn.github.com/assets/github-07413b5e0147434fe39f7f96545ef359ef45ca5051a44ec3b8e8d410a4a47988.js"></script> <div class="js-stale-session-flash stale-session-flash flash flash-warn flash-banner hidden"> <span class="octicon octicon-alert"></span> <span class="signed-in-tab-flash">You signed in with another tab or window. <a href="">Reload</a> to refresh your session.</span> <span class="signed-out-tab-flash">You signed out in another tab or window. <a href="">Reload</a> to refresh your session.</span> </div> </body> </html> <|start_filename|>message.js<|end_filename|> /** * Copyright (c) 2015-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @flow */ 'use strict'; module.exports = function( reviewers: Array<string>, mentionSentenceBuilder: (reviewers: Array<string>) => string, defaultMessageGenerator: (reviewers: Array<string>) => string ): string { // This file is a place where you can change the way the message the bot // uses to comment. For example: // // return 'Please review this ' + mentionSentenceBuilder(reviewers); // // will print // // Please review this @georgecodes and @vjeux return defaultMessageGenerator(reviewers); }; <|start_filename|>cache/https---github.com-facebook-react-native-blame-master-website-server-extractDocs.js<|end_filename|> <!DOCTYPE html> <html lang="en" class=""> <head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# object: http://ogp.me/ns/object# article: http://ogp.me/ns/article# profile: http://ogp.me/ns/profile#"> <meta charset='utf-8'> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="Content-Language" content="en"> <meta name="viewport" content="width=1020"> <title>react-native/website/server/extractDocs.js at master · facebook/react-native · GitHub</title> <link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="GitHub"> <link rel="fluid-icon" href="https://github.com/fluidicon.png" title="GitHub"> <link rel="apple-touch-icon" sizes="57x57" href="/apple-touch-icon-114.png"> <link rel="apple-touch-icon" sizes="114x114" href="/apple-touch-icon-114.png"> <link rel="apple-touch-icon" sizes="72x72" href="/apple-touch-icon-144.png"> <link rel="apple-touch-icon" sizes="144x144" href="/apple-touch-icon-144.png"> <meta property="fb:app_id" content="1401488693436528"> <meta content="@github" name="twitter:site" /><meta content="summary" name="twitter:card" /><meta content="facebook/react-native" name="twitter:title" /><meta content="react-native - A framework for building native apps with React." name="twitter:description" /><meta content="https://avatars2.githubusercontent.com/u/69631?v=3&amp;s=400" name="twitter:image:src" /> <meta content="GitHub" property="og:site_name" /><meta content="object" property="og:type" /><meta content="https://avatars2.githubusercontent.com/u/69631?v=3&amp;s=400" property="og:image" /><meta content="facebook/react-native" property="og:title" /><meta content="https://github.com/facebook/react-native" property="og:url" /><meta content="react-native - A framework for building native apps with React." property="og:description" /> <meta name="browser-stats-url" content="https://api.github.com/_private/browser/stats"> <meta name="browser-errors-url" content="https://api.github.com/_private/browser/errors"> <link rel="assets" href="https://assets-cdn.github.com/"> <meta name="pjax-timeout" content="1000"> <meta name="msapplication-TileImage" content="/windows-tile.png"> <meta name="msapplication-TileColor" content="#ffffff"> <meta name="selected-link" value="repo_source" data-pjax-transient> <meta name="google-site-verification" content="<KEY>"> <meta name="google-analytics" content="UA-3769691-2"> <meta content="collector.githubapp.com" name="octolytics-host" /><meta content="github" name="octolytics-app-id" /><meta content="A2E429B6:26A8:6B80E83:565DFBC7" name="octolytics-dimension-request_id" /> <meta content="/&lt;user-name&gt;/&lt;repo-name&gt;/blob/blame" data-pjax-transient="true" name="analytics-location" /> <meta content="Rails, view, blob#blame" data-pjax-transient="true" name="analytics-event" /> <meta class="js-ga-set" name="dimension1" content="Logged Out"> <meta class="js-ga-set" name="dimension4" content="New repo nav"> <meta name="is-dotcom" content="true"> <meta name="hostname" content="github.com"> <meta name="user-login" content=""> <link rel="mask-icon" href="https://assets-cdn.github.com/pinned-octocat.svg" color="#4078c0"> <link rel="icon" type="image/x-icon" href="https://assets-cdn.github.com/favicon.ico"> <meta content="e19e7d81d06359c08cb26489b65cf6ca68bd7c7b" name="form-nonce" /> <link crossorigin="anonymous" href="https://assets-cdn.github.com/assets/github-5e2d1232bc97970f293f259bcb6ab137945cb5635b398c2a81027bf21f0255c8.css" media="all" rel="stylesheet" /> <link crossorigin="anonymous" href="https://assets-cdn.github.com/assets/github2-bcce22057877160838a39c51a6270cf95fb927fc317253965cdbc182f32be960.css" media="all" rel="stylesheet" /> <meta http-equiv="x-pjax-version" content="3cf195f8aa0cc4097aecade8ff90cc36"> <meta name="description" content="react-native - A framework for building native apps with React."> <meta name="go-import" content="github.com/facebook/react-native git https://github.com/facebook/react-native.git"> <meta content="69631" name="octolytics-dimension-user_id" /><meta content="facebook" name="octolytics-dimension-user_login" /><meta content="29028775" name="octolytics-dimension-repository_id" /><meta content="facebook/react-native" name="octolytics-dimension-repository_nwo" /><meta content="true" name="octolytics-dimension-repository_public" /><meta content="false" name="octolytics-dimension-repository_is_fork" /><meta content="29028775" name="octolytics-dimension-repository_network_root_id" /><meta content="facebook/react-native" name="octolytics-dimension-repository_network_root_nwo" /> <link href="https://github.com/facebook/react-native/commits/master.atom" rel="alternate" title="Recent Commits to react-native:master" type="application/atom+xml"> </head> <body class="logged_out env-production vis-public"> <a href="#start-of-content" tabindex="1" class="accessibility-aid js-skip-to-content">Skip to content</a> <div class="header header-logged-out" role="banner"> <div class="container clearfix"> <a class="header-logo-wordmark" href="https://github.com/" data-ga-click="(Logged out) Header, go to homepage, icon:logo-wordmark"> <span class="mega-octicon octicon-logo-github"></span> </a> <div class="header-actions" role="navigation"> <a class="btn btn-primary" href="/join" data-ga-click="(Logged out) Header, clicked Sign up, text:sign-up">Sign up</a> <a class="btn" href="/login?return_to=%2Ffacebook%2Freact-native%2Fblame%2Fmaster%2Fwebsite%2Fserver%2FextractDocs.js" data-ga-click="(Logged out) Header, clicked Sign in, text:sign-in">Sign in</a> </div> <div class="site-search repo-scope js-site-search" role="search"> <!-- </textarea> --><!-- '"` --><form accept-charset="UTF-8" action="/facebook/react-native/search" class="js-site-search-form" data-global-search-url="/search" data-repo-search-url="/facebook/react-native/search" method="get"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="&#x2713;" /></div> <label class="js-chromeless-input-container form-control"> <div class="scope-badge">This repository</div> <input type="text" class="js-site-search-focus js-site-search-field is-clearable chromeless-input" data-hotkey="s" name="q" placeholder="Search" aria-label="Search this repository" data-global-scope-placeholder="Search GitHub" data-repo-scope-placeholder="Search" tabindex="1" autocapitalize="off"> </label> </form> </div> <ul class="header-nav left" role="navigation"> <li class="header-nav-item"> <a class="header-nav-link" href="/explore" data-ga-click="(Logged out) Header, go to explore, text:explore">Explore</a> </li> <li class="header-nav-item"> <a class="header-nav-link" href="/features" data-ga-click="(Logged out) Header, go to features, text:features">Features</a> </li> <li class="header-nav-item"> <a class="header-nav-link" href="https://enterprise.github.com/" data-ga-click="(Logged out) Header, go to enterprise, text:enterprise">Enterprise</a> </li> <li class="header-nav-item"> <a class="header-nav-link" href="/pricing" data-ga-click="(Logged out) Header, go to pricing, text:pricing">Pricing</a> </li> </ul> </div> </div> <div id="start-of-content" class="accessibility-aid"></div> <div id="js-flash-container"> </div> <div role="main" class="main-content"> <div itemscope itemtype="http://schema.org/WebPage"> <div id="js-repo-pjax-container" class="context-loader-container js-repo-nav-next" data-pjax-container> <div class="pagehead repohead instapaper_ignore readability-menu experiment-repo-nav"> <div class="container repohead-details-container"> <ul class="pagehead-actions"> <li> <a href="/login?return_to=%2Ffacebook%2Freact-native" class="btn btn-sm btn-with-count tooltipped tooltipped-n" aria-label="You must be signed in to watch a repository" rel="nofollow"> <span class="octicon octicon-eye"></span> Watch </a> <a class="social-count" href="/facebook/react-native/watchers"> 1,621 </a> </li> <li> <a href="/login?return_to=%2Ffacebook%2Freact-native" class="btn btn-sm btn-with-count tooltipped tooltipped-n" aria-label="You must be signed in to star a repository" rel="nofollow"> <span class="octicon octicon-star"></span> Star </a> <a class="social-count js-social-count" href="/facebook/react-native/stargazers"> 23,212 </a> </li> <li> <a href="/login?return_to=%2Ffacebook%2Freact-native" class="btn btn-sm btn-with-count tooltipped tooltipped-n" aria-label="You must be signed in to fork a repository" rel="nofollow"> <span class="octicon octicon-repo-forked"></span> Fork </a> <a href="/facebook/react-native/network" class="social-count"> 3,760 </a> </li> </ul> <h1 itemscope itemtype="http://data-vocabulary.org/Breadcrumb" class="entry-title public "> <span class="octicon octicon-repo"></span> <span class="author"><a href="/facebook" class="url fn" itemprop="url" rel="author"><span itemprop="title">facebook</span></a></span><!-- --><span class="path-divider">/</span><!-- --><strong><a href="/facebook/react-native" data-pjax="#js-repo-pjax-container">react-native</a></strong> <span class="page-context-loader"> <img alt="" height="16" src="https://assets-cdn.github.com/images/spinners/octocat-spinner-32.gif" width="16" /> </span> </h1> </div> <div class="container"> <nav class="reponav js-repo-nav js-sidenav-container-pjax js-octicon-loaders" role="navigation" data-pjax="#js-repo-pjax-container" data-issue-count-url="/facebook/react-native/issues/counts"> <a href="/facebook/react-native" aria-label="Code" aria-selected="true" class="js-selected-navigation-item selected reponav-item" data-hotkey="g c" data-selected-links="repo_source repo_downloads repo_commits repo_releases repo_tags repo_branches /facebook/react-native"> <span class="octicon octicon-code"></span> Code </a> <a href="/facebook/react-native/issues" class="js-selected-navigation-item reponav-item" data-hotkey="g i" data-selected-links="repo_issues repo_labels repo_milestones /facebook/react-native/issues"> <span class="octicon octicon-issue-opened"></span> Issues <span class="counter">853</span> </a> <a href="/facebook/react-native/pulls" class="js-selected-navigation-item reponav-item" data-hotkey="g p" data-selected-links="repo_pulls /facebook/react-native/pulls"> <span class="octicon octicon-git-pull-request"></span> Pull requests <span class="counter">189</span> </a> <a href="/facebook/react-native/pulse" class="js-selected-navigation-item reponav-item" data-selected-links="pulse /facebook/react-native/pulse"> <span class="octicon octicon-pulse"></span> Pulse </a> <a href="/facebook/react-native/graphs" class="js-selected-navigation-item reponav-item" data-selected-links="repo_graphs repo_contributors /facebook/react-native/graphs"> <span class="octicon octicon-graph"></span> Graphs </a> </nav> </div> </div> <div class="container repo-container new-discussion-timeline experiment-repo-nav"> <div class="repository-content"> <a href="/facebook/react-native/blame/b0e39d26aecce2b5aa33888ca3172205a879ed98/website/server/extractDocs.js" class="hidden js-permalink-shortcut" data-hotkey="y">Permalink</a> <div class="breadcrumb css-truncate blame-breadcrumb js-zeroclipboard-container"> <span class="css-truncate-target js-zeroclipboard-target"><span class="repo-root js-repo-root"><span itemscope="" itemtype="http://data-vocabulary.org/Breadcrumb"><a href="/facebook/react-native" class="" data-branch="master" data-pjax="true" itemscope="url"><span itemprop="title">react-native</span></a></span></span><span class="separator">/</span><span itemscope="" itemtype="http://data-vocabulary.org/Breadcrumb"><a href="/facebook/react-native/tree/master/website" class="" data-branch="master" data-pjax="true" itemscope="url"><span itemprop="title">website</span></a></span><span class="separator">/</span><span itemscope="" itemtype="http://data-vocabulary.org/Breadcrumb"><a href="/facebook/react-native/tree/master/website/server" class="" data-branch="master" data-pjax="true" itemscope="url"><span itemprop="title">server</span></a></span><span class="separator">/</span><strong class="final-path">extractDocs.js</strong></span> <button aria-label="Copy file path to clipboard" class="js-zeroclipboard btn btn-sm zeroclipboard-button tooltipped tooltipped-s" data-copied-hint="Copied!" type="button"><span class="octicon octicon-clippy"></span></button> </div> <div class="line-age-legend"> <span>Newer</span> <ol> <li class="heat" data-heat="1"></li> <li class="heat" data-heat="2"></li> <li class="heat" data-heat="3"></li> <li class="heat" data-heat="4"></li> <li class="heat" data-heat="5"></li> <li class="heat" data-heat="6"></li> <li class="heat" data-heat="7"></li> <li class="heat" data-heat="8"></li> <li class="heat" data-heat="9"></li> <li class="heat" data-heat="10"></li> </ol> <span>Older</span> </div> <div class="file"> <div class="file-header"> <div class="file-actions"> <div class="btn-group"> <a href="/facebook/react-native/raw/master/website/server/extractDocs.js" class="btn btn-sm" id="raw-url">Raw</a> <a href="/facebook/react-native/blob/master/website/server/extractDocs.js" class="btn btn-sm js-update-url-with-hash">Normal view</a> <a href="/facebook/react-native/commits/master/website/server/extractDocs.js" class="btn btn-sm" rel="nofollow">History</a> </div> </div> <div class="file-info"> <span class="octicon octicon-file-text"></span> <span class="file-mode" title="File Mode">100644</span> <span class="file-info-divider"></span> 281 lines (245 sloc) <span class="file-info-divider"></span> 8.52 KB </div> </div> <div class="blob-wrapper"> <table class="blame-container highlight data js-file-line-container"> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="10"> <a href="/facebook/react-native/commit/e811181034a3a90170f7cd73c4b8e09a40ef4976" class="blame-sha">e811181</a> <img alt="@vjeux" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/197597?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/e811181034a3a90170f7cd73c4b8e09a40ef4976" class="blame-commit-title" title="Add copyright header on website files">Add copyright header on website files</a> <div class="blame-commit-meta"> <a href="/vjeux" class="muted-link" rel="contributor">vjeux</a> authored <time datetime="2015-03-23T17:55:49Z" is="relative-time">Mar 23, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L1">1</td> <td class="blob-code blob-code-inner js-file-line" id="LC1"><span class="pl-c">/**</span></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L2">2</td> <td class="blob-code blob-code-inner js-file-line" id="LC2"><span class="pl-c"> * Copyright (c) 2015-present, Facebook, Inc.</span></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L3">3</td> <td class="blob-code blob-code-inner js-file-line" id="LC3"><span class="pl-c"> * All rights reserved.</span></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L4">4</td> <td class="blob-code blob-code-inner js-file-line" id="LC4"><span class="pl-c"> *</span></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L5">5</td> <td class="blob-code blob-code-inner js-file-line" id="LC5"><span class="pl-c"> * This source code is licensed under the BSD-style license found in the</span></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L6">6</td> <td class="blob-code blob-code-inner js-file-line" id="LC6"><span class="pl-c"> * LICENSE file in the root directory of this source tree. An additional grant</span></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L7">7</td> <td class="blob-code blob-code-inner js-file-line" id="LC7"><span class="pl-c"> * of patent rights can be found in the PATENTS file in the same directory.</span></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L8">8</td> <td class="blob-code blob-code-inner js-file-line" id="LC8"><span class="pl-c"> */</span></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L9">9</td> <td class="blob-code blob-code-inner js-file-line" id="LC9"></td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="3"> <a href="/facebook/react-native/commit/d5f670d19cde39aaa5064e9c12a2731feaaa8566" class="blame-sha">d5f670d</a> <img alt="@fkling" class="avatar blame-commit-avatar" height="32" src="https://avatars1.githubusercontent.com/u/179026?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/d5f670d19cde39aaa5064e9c12a2731feaaa8566" class="blame-commit-title" title="Add logic to show style props in docs">Add logic to show style props in docs</a> <div class="blame-commit-meta"> <a href="/fkling" class="muted-link" rel="contributor">fkling</a> authored <time datetime="2015-03-19T21:05:07Z" is="relative-time">Mar 19, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L10">10</td> <td class="blob-code blob-code-inner js-file-line" id="LC10"><span class="pl-k">var</span> docgen <span class="pl-k">=</span> <span class="pl-c1">require</span>(<span class="pl-s"><span class="pl-pds">&#39;</span>react-docgen<span class="pl-pds">&#39;</span></span>);</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L11">11</td> <td class="blob-code blob-code-inner js-file-line" id="LC11"><span class="pl-k">var</span> docgenHelpers <span class="pl-k">=</span> <span class="pl-c1">require</span>(<span class="pl-s"><span class="pl-pds">&#39;</span>./docgenHelpers<span class="pl-pds">&#39;</span></span>);</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="4"> <a href="/facebook/react-native/commit/70f28332b662c7f8b4292db9129fabd4be07f0ca" class="blame-sha">70f2833</a> <img alt="@vjeux" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/197597?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/70f28332b662c7f8b4292db9129fabd4be07f0ca" class="blame-commit-title" title="Initial version of the automatically generated docs">Initial version of the automatically generated docs</a> <div class="blame-commit-meta"> <a href="/facebook/react-native/commit/70f28332b662c7f8b4292db9129fabd4be07f0ca#comments"><span class="right octicon octicon-comment"></span></a> <a href="/vjeux" class="muted-link" rel="contributor">vjeux</a> authored <time datetime="2015-02-12T22:43:41Z" is="relative-time">Feb 12, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L12">12</td> <td class="blob-code blob-code-inner js-file-line" id="LC12"><span class="pl-k">var</span> fs <span class="pl-k">=</span> <span class="pl-c1">require</span>(<span class="pl-s"><span class="pl-pds">&#39;</span>fs<span class="pl-pds">&#39;</span></span>);</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L13">13</td> <td class="blob-code blob-code-inner js-file-line" id="LC13"><span class="pl-k">var</span> path <span class="pl-k">=</span> <span class="pl-c1">require</span>(<span class="pl-s"><span class="pl-pds">&#39;</span>path<span class="pl-pds">&#39;</span></span>);</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L14">14</td> <td class="blob-code blob-code-inner js-file-line" id="LC14"><span class="pl-k">var</span> slugify <span class="pl-k">=</span> <span class="pl-c1">require</span>(<span class="pl-s"><span class="pl-pds">&#39;</span>../core/slugify<span class="pl-pds">&#39;</span></span>);</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/28aa691d135e9fd201f86816a0a2d635361c5b64" class="blame-sha">28aa691</a> <img alt="@vjeux" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/197597?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/28aa691d135e9fd201f86816a0a2d635361c5b64" class="blame-commit-title" title="Updates from Fri 13 Mar - [ReactNative] Oss ActionSheet | Tadeu Zagallo - [ReactNative] Fix ScrollView.scrollTo() | <NAME> - [catalyst|madman] fix location observer | <NAME> - [ReactNative] Remove keyboardDismissMode from static | <NAME> - [ReactNative] Fix RCTMapManager retaining cycle | <NAME> - [ReactNative] Support loading sourcemaps from sourceMappingURL | <NAME> - [catalyst] set up directory specific rql transform | <NAME> - [React Native] Add .done() to terminate promise chains | <NAME> - [React Native] add support for reading tracking bit | <NAME>">Updates from Fri 13 Mar</a> <div class="blame-commit-meta"> <a href="/vjeux" class="muted-link" rel="contributor">vjeux</a> authored <time datetime="2015-03-13T22:30:31Z" is="relative-time">Mar 13, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L15">15</td> <td class="blob-code blob-code-inner js-file-line" id="LC15"><span class="pl-k">var</span> jsDocs <span class="pl-k">=</span> <span class="pl-c1">require</span>(<span class="pl-s"><span class="pl-pds">&#39;</span>../jsdocs/jsdocs.js<span class="pl-pds">&#39;</span></span>);</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/70f28332b662c7f8b4292db9129fabd4be07f0ca" class="blame-sha">70f2833</a> <img alt="@vjeux" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/197597?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/70f28332b662c7f8b4292db9129fabd4be07f0ca" class="blame-commit-title" title="Initial version of the automatically generated docs">Initial version of the automatically generated docs</a> <div class="blame-commit-meta"> <a href="/facebook/react-native/commit/70f28332b662c7f8b4292db9129fabd4be07f0ca#comments"><span class="right octicon octicon-comment"></span></a> <a href="/vjeux" class="muted-link" rel="contributor">vjeux</a> authored <time datetime="2015-02-12T22:43:41Z" is="relative-time">Feb 12, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L16">16</td> <td class="blob-code blob-code-inner js-file-line" id="LC16"></td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="9"> <a href="/facebook/react-native/commit/42eb5464fd8a65ed84b799de5d4dc225349449be" class="blame-sha">42eb546</a> <img alt="@mkonicek" class="avatar blame-commit-avatar" height="32" src="https://avatars1.githubusercontent.com/u/346214?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/42eb5464fd8a65ed84b799de5d4dc225349449be" class="blame-commit-title" title="Release React Native for Android This is an early release and there are several things that are known not to work if you&#39;re porting your iOS app to Android. See the Known Issues guide on the website. We will work with the community to reach platform parity with iOS.">Release React Native for Android</a> <div class="blame-commit-meta"> <a href="/facebook/react-native/commit/42eb5464fd8a65ed84b799de5d4dc225349449be#comments"><span class="right octicon octicon-comment"></span></a> <a href="/mkonicek" class="muted-link" rel="contributor">mkonicek</a> authored <time datetime="2015-09-14T14:35:58Z" is="relative-time">Sep 14, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="3"></td> <td class="blob-num blame-blob-num js-line-number" id="L17">17</td> <td class="blob-code blob-code-inner js-file-line" id="LC17"><span class="pl-k">var</span> <span class="pl-c1">ANDROID_SUFFIX</span> <span class="pl-k">=</span> <span class="pl-s"><span class="pl-pds">&#39;</span>android<span class="pl-pds">&#39;</span></span>;</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="3"></td> <td class="blob-num blame-blob-num js-line-number" id="L18">18</td> <td class="blob-code blob-code-inner js-file-line" id="LC18"><span class="pl-k">var</span> <span class="pl-c1">CROSS_SUFFIX</span> <span class="pl-k">=</span> <span class="pl-s"><span class="pl-pds">&#39;</span>cross<span class="pl-pds">&#39;</span></span>;</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="3"></td> <td class="blob-num blame-blob-num js-line-number" id="L19">19</td> <td class="blob-code blob-code-inner js-file-line" id="LC19"><span class="pl-k">var</span> <span class="pl-c1">IOS_SUFFIX</span> <span class="pl-k">=</span> <span class="pl-s"><span class="pl-pds">&#39;</span>ios<span class="pl-pds">&#39;</span></span>;</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="3"></td> <td class="blob-num blame-blob-num js-line-number" id="L20">20</td> <td class="blob-code blob-code-inner js-file-line" id="LC20"></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="3"></td> <td class="blob-num blame-blob-num js-line-number" id="L21">21</td> <td class="blob-code blob-code-inner js-file-line" id="LC21"><span class="pl-k">function</span> <span class="pl-en">endsWith</span>(<span class="pl-smi">str</span>, <span class="pl-smi">suffix</span>) {</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="3"></td> <td class="blob-num blame-blob-num js-line-number" id="L22">22</td> <td class="blob-code blob-code-inner js-file-line" id="LC22"> <span class="pl-k">return</span> <span class="pl-smi">str</span>.<span class="pl-c1">indexOf</span>(suffix, <span class="pl-smi">str</span>.<span class="pl-c1">length</span> <span class="pl-k">-</span> <span class="pl-smi">suffix</span>.<span class="pl-c1">length</span>) <span class="pl-k">!==</span> <span class="pl-k">-</span><span class="pl-c1">1</span>;</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="3"></td> <td class="blob-num blame-blob-num js-line-number" id="L23">23</td> <td class="blob-code blob-code-inner js-file-line" id="LC23">}</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="3"></td> <td class="blob-num blame-blob-num js-line-number" id="L24">24</td> <td class="blob-code blob-code-inner js-file-line" id="LC24"></td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="6"> <a href="/facebook/react-native/commit/70f28332b662c7f8b4292db9129fabd4be07f0ca" class="blame-sha">70f2833</a> <img alt="@vjeux" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/197597?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/70f28332b662c7f8b4292db9129fabd4be07f0ca" class="blame-commit-title" title="Initial version of the automatically generated docs">Initial version of the automatically generated docs</a> <div class="blame-commit-meta"> <a href="/facebook/react-native/commit/70f28332b662c7f8b4292db9129fabd4be07f0ca#comments"><span class="right octicon octicon-comment"></span></a> <a href="/vjeux" class="muted-link" rel="contributor">vjeux</a> authored <time datetime="2015-02-12T22:43:41Z" is="relative-time">Feb 12, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L25">25</td> <td class="blob-code blob-code-inner js-file-line" id="LC25"><span class="pl-k">function</span> <span class="pl-en">getNameFromPath</span>(<span class="pl-smi">filepath</span>) {</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L26">26</td> <td class="blob-code blob-code-inner js-file-line" id="LC26"> <span class="pl-k">var</span> ext <span class="pl-k">=</span> <span class="pl-c1">null</span>;</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L27">27</td> <td class="blob-code blob-code-inner js-file-line" id="LC27"> <span class="pl-k">while</span> (ext <span class="pl-k">=</span> <span class="pl-smi">path</span>.<span class="pl-en">extname</span>(filepath)) {</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L28">28</td> <td class="blob-code blob-code-inner js-file-line" id="LC28"> filepath <span class="pl-k">=</span> <span class="pl-smi">path</span>.<span class="pl-en">basename</span>(filepath, ext);</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L29">29</td> <td class="blob-code blob-code-inner js-file-line" id="LC29"> }</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/b8ca4e450b2fdff5eed68dbb3e1b4ca00b7d4a9c" class="blame-sha">b8ca4e4</a> <img alt="@brentvatne" class="avatar blame-commit-avatar" height="32" src="https://avatars1.githubusercontent.com/u/90494?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/b8ca4e450b2fdff5eed68dbb3e1b4ca00b7d4a9c" class="blame-commit-title" title="Add TransformPropTypes to docs">Add TransformPropTypes to docs</a> <div class="blame-commit-meta"> <a href="/brentvatne" class="muted-link" rel="contributor">brentvatne</a> authored <time datetime="2015-05-07T19:16:48Z" is="relative-time">May 7, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L30">30</td> <td class="blob-code blob-code-inner js-file-line" id="LC30"></td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="3"> <a href="/facebook/react-native/commit/c676e9dccc383daf959c7443c0f0574a6774400c" class="blame-sha">c676e9d</a> <img alt="@vjeux" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/197597?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/c676e9dccc383daf959c7443c0f0574a6774400c" class="blame-commit-title" title="Rename LayoutPropTypes to Flexbox">Rename LayoutPropTypes to Flexbox</a> <div class="blame-commit-meta"> <a href="/vjeux" class="muted-link" rel="contributor">vjeux</a> authored <time datetime="2015-03-23T22:22:47Z" is="relative-time">Mar 23, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L31">31</td> <td class="blob-code blob-code-inner js-file-line" id="LC31"> <span class="pl-k">if</span> (filepath <span class="pl-k">===</span> <span class="pl-s"><span class="pl-pds">&#39;</span>LayoutPropTypes<span class="pl-pds">&#39;</span></span>) {</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L32">32</td> <td class="blob-code blob-code-inner js-file-line" id="LC32"> <span class="pl-k">return</span> <span class="pl-s"><span class="pl-pds">&#39;</span>Flexbox<span class="pl-pds">&#39;</span></span>;</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="4"> <a href="/facebook/react-native/commit/b8ca4e450b2fdff5eed68dbb3e1b4ca00b7d4a9c" class="blame-sha">b8ca4e4</a> <img alt="@brentvatne" class="avatar blame-commit-avatar" height="32" src="https://avatars1.githubusercontent.com/u/90494?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/b8ca4e450b2fdff5eed68dbb3e1b4ca00b7d4a9c" class="blame-commit-title" title="Add TransformPropTypes to docs">Add TransformPropTypes to docs</a> <div class="blame-commit-meta"> <a href="/brentvatne" class="muted-link" rel="contributor">brentvatne</a> authored <time datetime="2015-05-07T19:16:48Z" is="relative-time">May 7, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L33">33</td> <td class="blob-code blob-code-inner js-file-line" id="LC33"> } <span class="pl-k">else</span> <span class="pl-k">if</span> (filepath <span class="pl-k">===</span> <span class="pl-s"><span class="pl-pds">&#39;</span>TransformPropTypes<span class="pl-pds">&#39;</span></span>) {</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L34">34</td> <td class="blob-code blob-code-inner js-file-line" id="LC34"> <span class="pl-k">return</span> <span class="pl-s"><span class="pl-pds">&#39;</span>Transforms<span class="pl-pds">&#39;</span></span>;</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L35">35</td> <td class="blob-code blob-code-inner js-file-line" id="LC35"> } <span class="pl-k">else</span> <span class="pl-k">if</span> (filepath <span class="pl-k">===</span> <span class="pl-s"><span class="pl-pds">&#39;</span>TabBarItemIOS<span class="pl-pds">&#39;</span></span>) {</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/9ee6cd61682c19d3373a388474b9071ed729078b" class="blame-sha">9ee6cd6</a> <img alt="@brentvatne" class="avatar blame-commit-avatar" height="32" src="https://avatars1.githubusercontent.com/u/90494?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/9ee6cd61682c19d3373a388474b9071ed729078b" class="blame-commit-title" title="[Docs] Add TabBarIOS.Item to docs">[Docs] Add TabBarIOS.Item to docs</a> <div class="blame-commit-meta"> <a href="/brentvatne" class="muted-link" rel="contributor">brentvatne</a> authored <time datetime="2015-04-21T17:19:36Z" is="relative-time">Apr 21, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L36">36</td> <td class="blob-code blob-code-inner js-file-line" id="LC36"> <span class="pl-k">return</span> <span class="pl-s"><span class="pl-pds">&#39;</span>TabBarIOS.Item<span class="pl-pds">&#39;</span></span>;</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="3"> <a href="/facebook/react-native/commit/00ceec9def0dff134d9fbfcb2104a64686720789" class="blame-sha">00ceec9</a> <img alt="@vjeux" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/197597?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/00ceec9def0dff134d9fbfcb2104a64686720789" class="blame-commit-title" title="Fix website with Animated Animated.js has been renamed (and moved) to AnimatedImplementation.js, so we need to update the path and add another translation rule.">Fix website with Animated</a> <div class="blame-commit-meta"> <a href="/vjeux" class="muted-link" rel="contributor">vjeux</a> authored <time datetime="2015-09-22T19:54:04Z" is="relative-time">Sep 22, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="3"></td> <td class="blob-num blame-blob-num js-line-number" id="L37">37</td> <td class="blob-code blob-code-inner js-file-line" id="LC37"> } <span class="pl-k">else</span> <span class="pl-k">if</span> (filepath <span class="pl-k">===</span> <span class="pl-s"><span class="pl-pds">&#39;</span>AnimatedImplementation<span class="pl-pds">&#39;</span></span>) {</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="3"></td> <td class="blob-num blame-blob-num js-line-number" id="L38">38</td> <td class="blob-code blob-code-inner js-file-line" id="LC38"> <span class="pl-k">return</span> <span class="pl-s"><span class="pl-pds">&#39;</span>Animated<span class="pl-pds">&#39;</span></span>;</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/c676e9dccc383daf959c7443c0f0574a6774400c" class="blame-sha">c676e9d</a> <img alt="@vjeux" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/197597?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/c676e9dccc383daf959c7443c0f0574a6774400c" class="blame-commit-title" title="Rename LayoutPropTypes to Flexbox">Rename LayoutPropTypes to Flexbox</a> <div class="blame-commit-meta"> <a href="/vjeux" class="muted-link" rel="contributor">vjeux</a> authored <time datetime="2015-03-23T22:22:47Z" is="relative-time">Mar 23, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L39">39</td> <td class="blob-code blob-code-inner js-file-line" id="LC39"> }</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="4"> <a href="/facebook/react-native/commit/70f28332b662c7f8b4292db9129fabd4be07f0ca" class="blame-sha">70f2833</a> <img alt="@vjeux" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/197597?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/70f28332b662c7f8b4292db9129fabd4be07f0ca" class="blame-commit-title" title="Initial version of the automatically generated docs">Initial version of the automatically generated docs</a> <div class="blame-commit-meta"> <a href="/facebook/react-native/commit/70f28332b662c7f8b4292db9129fabd4be07f0ca#comments"><span class="right octicon octicon-comment"></span></a> <a href="/vjeux" class="muted-link" rel="contributor">vjeux</a> authored <time datetime="2015-02-12T22:43:41Z" is="relative-time">Feb 12, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L40">40</td> <td class="blob-code blob-code-inner js-file-line" id="LC40"> <span class="pl-k">return</span> filepath;</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L41">41</td> <td class="blob-code blob-code-inner js-file-line" id="LC41">}</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L42">42</td> <td class="blob-code blob-code-inner js-file-line" id="LC42"></td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="6"> <a href="/facebook/react-native/commit/42eb5464fd8a65ed84b799de5d4dc225349449be" class="blame-sha">42eb546</a> <img alt="@mkonicek" class="avatar blame-commit-avatar" height="32" src="https://avatars1.githubusercontent.com/u/346214?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/42eb5464fd8a65ed84b799de5d4dc225349449be" class="blame-commit-title" title="Release React Native for Android This is an early release and there are several things that are known not to work if you&#39;re porting your iOS app to Android. See the Known Issues guide on the website. We will work with the community to reach platform parity with iOS.">Release React Native for Android</a> <div class="blame-commit-meta"> <a href="/facebook/react-native/commit/42eb5464fd8a65ed84b799de5d4dc225349449be#comments"><span class="right octicon octicon-comment"></span></a> <a href="/mkonicek" class="muted-link" rel="contributor">mkonicek</a> authored <time datetime="2015-09-14T14:35:58Z" is="relative-time">Sep 14, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="3"></td> <td class="blob-num blame-blob-num js-line-number" id="L43">43</td> <td class="blob-code blob-code-inner js-file-line" id="LC43"><span class="pl-k">function</span> <span class="pl-en">getPlatformFromPath</span>(<span class="pl-smi">filepath</span>) {</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="3"></td> <td class="blob-num blame-blob-num js-line-number" id="L44">44</td> <td class="blob-code blob-code-inner js-file-line" id="LC44"> <span class="pl-k">var</span> ext <span class="pl-k">=</span> <span class="pl-c1">null</span>;</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="3"></td> <td class="blob-num blame-blob-num js-line-number" id="L45">45</td> <td class="blob-code blob-code-inner js-file-line" id="LC45"> <span class="pl-k">while</span> (ext <span class="pl-k">=</span> <span class="pl-smi">path</span>.<span class="pl-en">extname</span>(filepath)) {</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="3"></td> <td class="blob-num blame-blob-num js-line-number" id="L46">46</td> <td class="blob-code blob-code-inner js-file-line" id="LC46"> filepath <span class="pl-k">=</span> <span class="pl-smi">path</span>.<span class="pl-en">basename</span>(filepath, ext);</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="3"></td> <td class="blob-num blame-blob-num js-line-number" id="L47">47</td> <td class="blob-code blob-code-inner js-file-line" id="LC47"> }</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/00ceec9def0dff134d9fbfcb2104a64686720789" class="blame-sha">00ceec9</a> <img alt="@vjeux" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/197597?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/00ceec9def0dff134d9fbfcb2104a64686720789" class="blame-commit-title" title="Fix website with Animated Animated.js has been renamed (and moved) to AnimatedImplementation.js, so we need to update the path and add another translation rule.">Fix website with Animated</a> <div class="blame-commit-meta"> <a href="/vjeux" class="muted-link" rel="contributor">vjeux</a> authored <time datetime="2015-09-22T19:54:04Z" is="relative-time">Sep 22, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="3"></td> <td class="blob-num blame-blob-num js-line-number" id="L48">48</td> <td class="blob-code blob-code-inner js-file-line" id="LC48"></td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="10"> <a href="/facebook/react-native/commit/42eb5464fd8a65ed84b799de5d4dc225349449be" class="blame-sha">42eb546</a> <img alt="@mkonicek" class="avatar blame-commit-avatar" height="32" src="https://avatars1.githubusercontent.com/u/346214?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/42eb5464fd8a65ed84b799de5d4dc225349449be" class="blame-commit-title" title="Release React Native for Android This is an early release and there are several things that are known not to work if you&#39;re porting your iOS app to Android. See the Known Issues guide on the website. We will work with the community to reach platform parity with iOS.">Release React Native for Android</a> <div class="blame-commit-meta"> <a href="/facebook/react-native/commit/42eb5464fd8a65ed84b799de5d4dc225349449be#comments"><span class="right octicon octicon-comment"></span></a> <a href="/mkonicek" class="muted-link" rel="contributor">mkonicek</a> authored <time datetime="2015-09-14T14:35:58Z" is="relative-time">Sep 14, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="3"></td> <td class="blob-num blame-blob-num js-line-number" id="L49">49</td> <td class="blob-code blob-code-inner js-file-line" id="LC49"> <span class="pl-k">if</span> (<span class="pl-en">endsWith</span>(filepath, <span class="pl-s"><span class="pl-pds">&#39;</span>Android<span class="pl-pds">&#39;</span></span>)) {</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="3"></td> <td class="blob-num blame-blob-num js-line-number" id="L50">50</td> <td class="blob-code blob-code-inner js-file-line" id="LC50"> <span class="pl-k">return</span> <span class="pl-c1">ANDROID_SUFFIX</span>;</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="3"></td> <td class="blob-num blame-blob-num js-line-number" id="L51">51</td> <td class="blob-code blob-code-inner js-file-line" id="LC51"> } <span class="pl-k">else</span> <span class="pl-k">if</span> (<span class="pl-en">endsWith</span>(filepath, <span class="pl-s"><span class="pl-pds">&#39;</span>IOS<span class="pl-pds">&#39;</span></span>)) {</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="3"></td> <td class="blob-num blame-blob-num js-line-number" id="L52">52</td> <td class="blob-code blob-code-inner js-file-line" id="LC52"> <span class="pl-k">return</span> <span class="pl-c1">IOS_SUFFIX</span>;</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="3"></td> <td class="blob-num blame-blob-num js-line-number" id="L53">53</td> <td class="blob-code blob-code-inner js-file-line" id="LC53"> }</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="3"></td> <td class="blob-num blame-blob-num js-line-number" id="L54">54</td> <td class="blob-code blob-code-inner js-file-line" id="LC54"> <span class="pl-k">return</span> <span class="pl-c1">CROSS_SUFFIX</span>;</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="3"></td> <td class="blob-num blame-blob-num js-line-number" id="L55">55</td> <td class="blob-code blob-code-inner js-file-line" id="LC55">}</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="3"></td> <td class="blob-num blame-blob-num js-line-number" id="L56">56</td> <td class="blob-code blob-code-inner js-file-line" id="LC56"></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="3"></td> <td class="blob-num blame-blob-num js-line-number" id="L57">57</td> <td class="blob-code blob-code-inner js-file-line" id="LC57"><span class="pl-k">function</span> <span class="pl-en">getExample</span>(<span class="pl-smi">componentName</span>, <span class="pl-smi">componentPlatform</span>) {</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="3"> <a href="/facebook/react-native/commit/a4a551c5718eb8f6d0e60fe477ac0c69fd571020" class="blame-sha">a4a551c</a> <img alt="@vjeux" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/197597?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/a4a551c5718eb8f6d0e60fe477ac0c69fd571020" class="blame-commit-title" title="Add examples at the end of the doc pages">Add examples at the end of the doc pages</a> <div class="blame-commit-meta"> <a href="/vjeux" class="muted-link" rel="contributor">vjeux</a> authored <time datetime="2015-03-31T19:28:26Z" is="relative-time">Mar 31, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L58">58</td> <td class="blob-code blob-code-inner js-file-line" id="LC58"> <span class="pl-k">var</span> path <span class="pl-k">=</span> <span class="pl-s"><span class="pl-pds">&#39;</span>../Examples/UIExplorer/<span class="pl-pds">&#39;</span></span> <span class="pl-k">+</span> componentName <span class="pl-k">+</span> <span class="pl-s"><span class="pl-pds">&#39;</span>Example.js<span class="pl-pds">&#39;</span></span>;</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L59">59</td> <td class="blob-code blob-code-inner js-file-line" id="LC59"> <span class="pl-k">if</span> (<span class="pl-k">!</span><span class="pl-smi">fs</span>.<span class="pl-en">existsSync</span>(path)) {</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/42eb5464fd8a65ed84b799de5d4dc225349449be" class="blame-sha">42eb546</a> <img alt="@mkonicek" class="avatar blame-commit-avatar" height="32" src="https://avatars1.githubusercontent.com/u/346214?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/42eb5464fd8a65ed84b799de5d4dc225349449be" class="blame-commit-title" title="Release React Native for Android This is an early release and there are several things that are known not to work if you&#39;re porting your iOS app to Android. See the Known Issues guide on the website. We will work with the community to reach platform parity with iOS.">Release React Native for Android</a> <div class="blame-commit-meta"> <a href="/facebook/react-native/commit/42eb5464fd8a65ed84b799de5d4dc225349449be#comments"><span class="right octicon octicon-comment"></span></a> <a href="/mkonicek" class="muted-link" rel="contributor">mkonicek</a> authored <time datetime="2015-09-14T14:35:58Z" is="relative-time">Sep 14, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="3"></td> <td class="blob-num blame-blob-num js-line-number" id="L60">60</td> <td class="blob-code blob-code-inner js-file-line" id="LC60"> path <span class="pl-k">=</span> <span class="pl-s"><span class="pl-pds">&#39;</span>../Examples/UIExplorer/<span class="pl-pds">&#39;</span></span> <span class="pl-k">+</span> componentName <span class="pl-k">+</span> <span class="pl-s"><span class="pl-pds">&#39;</span>Example.<span class="pl-pds">&#39;</span></span><span class="pl-k">+</span> componentPlatform <span class="pl-k">+</span><span class="pl-s"><span class="pl-pds">&#39;</span>.js<span class="pl-pds">&#39;</span></span>;</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="4"> <a href="/facebook/react-native/commit/427d902e48ed964d8ac4614f2ed75b1fdd8fc87a" class="blame-sha">427d902</a> <img alt="@vjeux" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/197597?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/427d902e48ed964d8ac4614f2ed75b1fdd8fc87a" class="blame-commit-title" title="Support .ios.js examples">Support .ios.js examples</a> <div class="blame-commit-meta"> <a href="/vjeux" class="muted-link" rel="contributor">vjeux</a> authored <time datetime="2015-03-31T21:05:15Z" is="relative-time">Mar 31, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L61">61</td> <td class="blob-code blob-code-inner js-file-line" id="LC61"> <span class="pl-k">if</span> (<span class="pl-k">!</span><span class="pl-smi">fs</span>.<span class="pl-en">existsSync</span>(path)) {</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L62">62</td> <td class="blob-code blob-code-inner js-file-line" id="LC62"> <span class="pl-k">return</span>;</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L63">63</td> <td class="blob-code blob-code-inner js-file-line" id="LC63"> }</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="3"> <a href="/facebook/react-native/commit/a4a551c5718eb8f6d0e60fe477ac0c69fd571020" class="blame-sha">a4a551c</a> <img alt="@vjeux" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/197597?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/a4a551c5718eb8f6d0e60fe477ac0c69fd571020" class="blame-commit-title" title="Add examples at the end of the doc pages">Add examples at the end of the doc pages</a> <div class="blame-commit-meta"> <a href="/vjeux" class="muted-link" rel="contributor">vjeux</a> authored <time datetime="2015-03-31T19:28:26Z" is="relative-time">Mar 31, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L64">64</td> <td class="blob-code blob-code-inner js-file-line" id="LC64"> }</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L65">65</td> <td class="blob-code blob-code-inner js-file-line" id="LC65"> <span class="pl-k">return</span> {</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/115b2a3fde535bf3f0a56a7496ba400c5eef3dc3" class="blame-sha">115b2a3</a> <img alt="@vjeux" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/197597?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/115b2a3fde535bf3f0a56a7496ba400c5eef3dc3" class="blame-commit-title" title="fix ../">fix ../</a> <div class="blame-commit-meta"> <a href="/vjeux" class="muted-link" rel="contributor">vjeux</a> authored <time datetime="2015-03-31T19:31:37Z" is="relative-time">Mar 31, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L66">66</td> <td class="blob-code blob-code-inner js-file-line" id="LC66"> path<span class="pl-k">:</span> <span class="pl-smi">path</span>.<span class="pl-c1">replace</span>(<span class="pl-sr"><span class="pl-pds">/</span><span class="pl-k">^</span><span class="pl-cce">\.\.\/</span><span class="pl-pds">/</span></span>, <span class="pl-s"><span class="pl-pds">&#39;</span><span class="pl-pds">&#39;</span></span>),</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="5"> <a href="/facebook/react-native/commit/a4a551c5718eb8f6d0e60fe477ac0c69fd571020" class="blame-sha">a4a551c</a> <img alt="@vjeux" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/197597?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/a4a551c5718eb8f6d0e60fe477ac0c69fd571020" class="blame-commit-title" title="Add examples at the end of the doc pages">Add examples at the end of the doc pages</a> <div class="blame-commit-meta"> <a href="/vjeux" class="muted-link" rel="contributor">vjeux</a> authored <time datetime="2015-03-31T19:28:26Z" is="relative-time">Mar 31, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L67">67</td> <td class="blob-code blob-code-inner js-file-line" id="LC67"> content<span class="pl-k">:</span> <span class="pl-smi">fs</span>.<span class="pl-en">readFileSync</span>(path).<span class="pl-c1">toString</span>(),</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L68">68</td> <td class="blob-code blob-code-inner js-file-line" id="LC68"> };</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L69">69</td> <td class="blob-code blob-code-inner js-file-line" id="LC69">}</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L70">70</td> <td class="blob-code blob-code-inner js-file-line" id="LC70"></td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="11"> <a href="/facebook/react-native/commit/5af8849aa45e92da20d3ffb62cb2aa5b5868299f" class="blame-sha">5af8849</a> <img alt="@jsierles" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/82?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/5af8849aa45e92da20d3ffb62cb2aa5b5868299f" class="blame-commit-title" title="[Docs] Add a &#39;run this example&#39; link to AlertIOS docs, plus supporting code to add more links progressively">[Docs] Add a &#39;run this example&#39; link to AlertIOS docs, plus supportin…</a> <div class="blame-commit-meta"> <a href="/jsierles" class="muted-link" rel="contributor">jsierles</a> authored <time datetime="2015-06-30T21:39:49Z" is="relative-time">Jun 30, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="5"></td> <td class="blob-num blame-blob-num js-line-number" id="L71">71</td> <td class="blob-code blob-code-inner js-file-line" id="LC71"><span class="pl-c">// Determines whether a component should have a link to a runnable example</span></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="5"></td> <td class="blob-num blame-blob-num js-line-number" id="L72">72</td> <td class="blob-code blob-code-inner js-file-line" id="LC72"></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="5"></td> <td class="blob-num blame-blob-num js-line-number" id="L73">73</td> <td class="blob-code blob-code-inner js-file-line" id="LC73"><span class="pl-k">function</span> <span class="pl-en">isRunnable</span>(<span class="pl-smi">componentName</span>) {</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="5"></td> <td class="blob-num blame-blob-num js-line-number" id="L74">74</td> <td class="blob-code blob-code-inner js-file-line" id="LC74"> <span class="pl-k">if</span> (componentName <span class="pl-k">===</span> <span class="pl-s"><span class="pl-pds">&#39;</span>AlertIOS<span class="pl-pds">&#39;</span></span>) {</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="5"></td> <td class="blob-num blame-blob-num js-line-number" id="L75">75</td> <td class="blob-code blob-code-inner js-file-line" id="LC75"> <span class="pl-k">return</span> <span class="pl-c1">true</span>;</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="5"></td> <td class="blob-num blame-blob-num js-line-number" id="L76">76</td> <td class="blob-code blob-code-inner js-file-line" id="LC76"> }</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="5"></td> <td class="blob-num blame-blob-num js-line-number" id="L77">77</td> <td class="blob-code blob-code-inner js-file-line" id="LC77"></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="5"></td> <td class="blob-num blame-blob-num js-line-number" id="L78">78</td> <td class="blob-code blob-code-inner js-file-line" id="LC78"> <span class="pl-k">return</span> <span class="pl-c1">false</span>;</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="5"></td> <td class="blob-num blame-blob-num js-line-number" id="L79">79</td> <td class="blob-code blob-code-inner js-file-line" id="LC79">}</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="5"></td> <td class="blob-num blame-blob-num js-line-number" id="L80">80</td> <td class="blob-code blob-code-inner js-file-line" id="LC80"></td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="28"> <a href="/facebook/react-native/commit/debd5b0942736f1c9a72c4aad3458a9c17db6eee" class="blame-sha">debd5b0</a> <img alt="@brentvatne" class="avatar blame-commit-avatar" height="32" src="https://avatars1.githubusercontent.com/u/90494?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/debd5b0942736f1c9a72c4aad3458a9c17db6eee" class="blame-commit-title" title="[Docs] Remove Transforms from sidebar, add to Style">[Docs] Remove Transforms from sidebar, add to Style</a> <div class="blame-commit-meta"> <a href="/brentvatne" class="muted-link" rel="contributor">brentvatne</a> authored <time datetime="2015-05-07T23:05:30Z" is="relative-time">May 7, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L81">81</td> <td class="blob-code blob-code-inner js-file-line" id="LC81"><span class="pl-c">// Hide a component from the sidebar by making it return false from</span></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L82">82</td> <td class="blob-code blob-code-inner js-file-line" id="LC82"><span class="pl-c">// this function</span></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L83">83</td> <td class="blob-code blob-code-inner js-file-line" id="LC83"><span class="pl-k">function</span> <span class="pl-en">shouldDisplayInSidebar</span>(<span class="pl-smi">componentName</span>) {</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L84">84</td> <td class="blob-code blob-code-inner js-file-line" id="LC84"> <span class="pl-k">if</span> (componentName <span class="pl-k">===</span> <span class="pl-s"><span class="pl-pds">&#39;</span>Transforms<span class="pl-pds">&#39;</span></span>) {</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L85">85</td> <td class="blob-code blob-code-inner js-file-line" id="LC85"> <span class="pl-k">return</span> <span class="pl-c1">false</span>;</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L86">86</td> <td class="blob-code blob-code-inner js-file-line" id="LC86"> }</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L87">87</td> <td class="blob-code blob-code-inner js-file-line" id="LC87"></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L88">88</td> <td class="blob-code blob-code-inner js-file-line" id="LC88"> <span class="pl-k">return</span> <span class="pl-c1">true</span>;</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L89">89</td> <td class="blob-code blob-code-inner js-file-line" id="LC89">}</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L90">90</td> <td class="blob-code blob-code-inner js-file-line" id="LC90"></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L91">91</td> <td class="blob-code blob-code-inner js-file-line" id="LC91"><span class="pl-k">function</span> <span class="pl-en">getNextComponent</span>(<span class="pl-smi">i</span>) {</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L92">92</td> <td class="blob-code blob-code-inner js-file-line" id="LC92"> <span class="pl-k">var</span> next;</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L93">93</td> <td class="blob-code blob-code-inner js-file-line" id="LC93"> <span class="pl-k">var</span> filepath <span class="pl-k">=</span> all[i];</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L94">94</td> <td class="blob-code blob-code-inner js-file-line" id="LC94"></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L95">95</td> <td class="blob-code blob-code-inner js-file-line" id="LC95"> <span class="pl-k">if</span> (all[i <span class="pl-k">+</span> <span class="pl-c1">1</span>]) {</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L96">96</td> <td class="blob-code blob-code-inner js-file-line" id="LC96"> <span class="pl-k">var</span> nextComponentName <span class="pl-k">=</span> <span class="pl-en">getNameFromPath</span>(all[i <span class="pl-k">+</span> <span class="pl-c1">1</span>]);</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L97">97</td> <td class="blob-code blob-code-inner js-file-line" id="LC97"></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L98">98</td> <td class="blob-code blob-code-inner js-file-line" id="LC98"> <span class="pl-k">if</span> (<span class="pl-en">shouldDisplayInSidebar</span>(nextComponentName)) {</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L99">99</td> <td class="blob-code blob-code-inner js-file-line" id="LC99"> <span class="pl-k">return</span> <span class="pl-en">slugify</span>(nextComponentName);</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L100">100</td> <td class="blob-code blob-code-inner js-file-line" id="LC100"> } <span class="pl-k">else</span> {</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L101">101</td> <td class="blob-code blob-code-inner js-file-line" id="LC101"> <span class="pl-k">return</span> <span class="pl-en">getNextComponent</span>(i <span class="pl-k">+</span> <span class="pl-c1">1</span>);</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L102">102</td> <td class="blob-code blob-code-inner js-file-line" id="LC102"> }</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L103">103</td> <td class="blob-code blob-code-inner js-file-line" id="LC103"> } <span class="pl-k">else</span> {</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L104">104</td> <td class="blob-code blob-code-inner js-file-line" id="LC104"> <span class="pl-k">return</span> <span class="pl-s"><span class="pl-pds">&#39;</span>network<span class="pl-pds">&#39;</span></span>;</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L105">105</td> <td class="blob-code blob-code-inner js-file-line" id="LC105"> }</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L106">106</td> <td class="blob-code blob-code-inner js-file-line" id="LC106">}</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L107">107</td> <td class="blob-code blob-code-inner js-file-line" id="LC107"></td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/d5f670d19cde39aaa5064e9c12a2731feaaa8566" class="blame-sha">d5f670d</a> <img alt="@fkling" class="avatar blame-commit-avatar" height="32" src="https://avatars1.githubusercontent.com/u/179026?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/d5f670d19cde39aaa5064e9c12a2731feaaa8566" class="blame-commit-title" title="Add logic to show style props in docs">Add logic to show style props in docs</a> <div class="blame-commit-meta"> <a href="/fkling" class="muted-link" rel="contributor">fkling</a> authored <time datetime="2015-03-19T21:05:07Z" is="relative-time">Mar 19, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L108">108</td> <td class="blob-code blob-code-inner js-file-line" id="LC108"><span class="pl-k">function</span> <span class="pl-en">componentsToMarkdown</span>(<span class="pl-smi">type</span>, <span class="pl-smi">json</span>, <span class="pl-smi">filepath</span>, <span class="pl-smi">i</span>, <span class="pl-smi">styles</span>) {</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/70f28332b662c7f8b4292db9129fabd4be07f0ca" class="blame-sha">70f2833</a> <img alt="@vjeux" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/197597?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/70f28332b662c7f8b4292db9129fabd4be07f0ca" class="blame-commit-title" title="Initial version of the automatically generated docs">Initial version of the automatically generated docs</a> <div class="blame-commit-meta"> <a href="/facebook/react-native/commit/70f28332b662c7f8b4292db9129fabd4be07f0ca#comments"><span class="right octicon octicon-comment"></span></a> <a href="/vjeux" class="muted-link" rel="contributor">vjeux</a> authored <time datetime="2015-02-12T22:43:41Z" is="relative-time">Feb 12, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L109">109</td> <td class="blob-code blob-code-inner js-file-line" id="LC109"> <span class="pl-k">var</span> componentName <span class="pl-k">=</span> <span class="pl-en">getNameFromPath</span>(filepath);</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/42eb5464fd8a65ed84b799de5d4dc225349449be" class="blame-sha">42eb546</a> <img alt="@mkonicek" class="avatar blame-commit-avatar" height="32" src="https://avatars1.githubusercontent.com/u/346214?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/42eb5464fd8a65ed84b799de5d4dc225349449be" class="blame-commit-title" title="Release React Native for Android This is an early release and there are several things that are known not to work if you&#39;re porting your iOS app to Android. See the Known Issues guide on the website. We will work with the community to reach platform parity with iOS.">Release React Native for Android</a> <div class="blame-commit-meta"> <a href="/facebook/react-native/commit/42eb5464fd8a65ed84b799de5d4dc225349449be#comments"><span class="right octicon octicon-comment"></span></a> <a href="/mkonicek" class="muted-link" rel="contributor">mkonicek</a> authored <time datetime="2015-09-14T14:35:58Z" is="relative-time">Sep 14, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="3"></td> <td class="blob-num blame-blob-num js-line-number" id="L110">110</td> <td class="blob-code blob-code-inner js-file-line" id="LC110"> <span class="pl-k">var</span> componentPlatform <span class="pl-k">=</span> <span class="pl-en">getPlatformFromPath</span>(filepath);</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/b9ab60719767bda61ca55e0f8e86a60bdebc9ec3" class="blame-sha">b9ab607</a> <img alt="@vjeux" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/197597?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/b9ab60719767bda61ca55e0f8e86a60bdebc9ec3" class="blame-commit-title" title="Use docs/ComponentName.md at the end of the component docs">Use docs/ComponentName.md at the end of the component docs</a> <div class="blame-commit-meta"> <a href="/vjeux" class="muted-link" rel="contributor">vjeux</a> authored <time datetime="2015-03-05T05:03:24Z" is="relative-time">Mar 4, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L111">111</td> <td class="blob-code blob-code-inner js-file-line" id="LC111"> <span class="pl-k">var</span> docFilePath <span class="pl-k">=</span> <span class="pl-s"><span class="pl-pds">&#39;</span>../docs/<span class="pl-pds">&#39;</span></span> <span class="pl-k">+</span> componentName <span class="pl-k">+</span> <span class="pl-s"><span class="pl-pds">&#39;</span>.md<span class="pl-pds">&#39;</span></span>;</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/00ceec9def0dff134d9fbfcb2104a64686720789" class="blame-sha">00ceec9</a> <img alt="@vjeux" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/197597?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/00ceec9def0dff134d9fbfcb2104a64686720789" class="blame-commit-title" title="Fix website with Animated Animated.js has been renamed (and moved) to AnimatedImplementation.js, so we need to update the path and add another translation rule.">Fix website with Animated</a> <div class="blame-commit-meta"> <a href="/vjeux" class="muted-link" rel="contributor">vjeux</a> authored <time datetime="2015-09-22T19:54:04Z" is="relative-time">Sep 22, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="3"></td> <td class="blob-num blame-blob-num js-line-number" id="L112">112</td> <td class="blob-code blob-code-inner js-file-line" id="LC112"></td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="4"> <a href="/facebook/react-native/commit/b9ab60719767bda61ca55e0f8e86a60bdebc9ec3" class="blame-sha">b9ab607</a> <img alt="@vjeux" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/197597?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/b9ab60719767bda61ca55e0f8e86a60bdebc9ec3" class="blame-commit-title" title="Use docs/ComponentName.md at the end of the component docs">Use docs/ComponentName.md at the end of the component docs</a> <div class="blame-commit-meta"> <a href="/vjeux" class="muted-link" rel="contributor">vjeux</a> authored <time datetime="2015-03-05T05:03:24Z" is="relative-time">Mar 5, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L113">113</td> <td class="blob-code blob-code-inner js-file-line" id="LC113"> <span class="pl-k">if</span> (<span class="pl-smi">fs</span>.<span class="pl-en">existsSync</span>(docFilePath)) {</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L114">114</td> <td class="blob-code blob-code-inner js-file-line" id="LC114"> <span class="pl-smi">json</span>.<span class="pl-smi">fullDescription</span> <span class="pl-k">=</span> <span class="pl-smi">fs</span>.<span class="pl-en">readFileSync</span>(docFilePath).<span class="pl-c1">toString</span>();</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L115">115</td> <td class="blob-code blob-code-inner js-file-line" id="LC115"> }</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/33bfb322ad49654db50078af101bee90a5e7f46b" class="blame-sha">33bfb32</a> <img alt="@vjeux" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/197597?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/33bfb322ad49654db50078af101bee90a5e7f46b" class="blame-commit-title" title="Wire up jsdocs for apis">Wire up jsdocs for apis</a> <div class="blame-commit-meta"> <a href="/vjeux" class="muted-link" rel="contributor">vjeux</a> authored <time datetime="2015-03-12T18:03:32Z" is="relative-time">Mar 12, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L116">116</td> <td class="blob-code blob-code-inner js-file-line" id="LC116"> <span class="pl-smi">json</span>.<span class="pl-c1">type</span> <span class="pl-k">=</span> type;</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="3"> <a href="/facebook/react-native/commit/536b4669a3c37db57727a5be0b944d84cdc5de95" class="blame-sha">536b466</a> <img alt="@vjeux" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/197597?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/536b4669a3c37db57727a5be0b944d84cdc5de95" class="blame-commit-title" title="Add Edit on Github link on pages. cc @DMortens">Add Edit on Github link on pages. cc @DMortens</a> <div class="blame-commit-meta"> <a href="/facebook/react-native/commit/536b4669a3c37db57727a5be0b944d84cdc5de95#comments"><span class="right octicon octicon-comment"></span></a> <a href="/vjeux" class="muted-link" rel="contributor">vjeux</a> authored <time datetime="2015-03-31T17:10:05Z" is="relative-time">Mar 31, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L117">117</td> <td class="blob-code blob-code-inner js-file-line" id="LC117"> <span class="pl-smi">json</span>.<span class="pl-smi">filepath</span> <span class="pl-k">=</span> <span class="pl-smi">filepath</span>.<span class="pl-c1">replace</span>(<span class="pl-sr"><span class="pl-pds">/</span><span class="pl-k">^</span><span class="pl-cce">\.\.\/</span><span class="pl-pds">/</span></span>, <span class="pl-s"><span class="pl-pds">&#39;</span><span class="pl-pds">&#39;</span></span>);</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L118">118</td> <td class="blob-code blob-code-inner js-file-line" id="LC118"> <span class="pl-smi">json</span>.<span class="pl-smi">componentName</span> <span class="pl-k">=</span> componentName;</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/42eb5464fd8a65ed84b799de5d4dc225349449be" class="blame-sha">42eb546</a> <img alt="@mkonicek" class="avatar blame-commit-avatar" height="32" src="https://avatars1.githubusercontent.com/u/346214?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/42eb5464fd8a65ed84b799de5d4dc225349449be" class="blame-commit-title" title="Release React Native for Android This is an early release and there are several things that are known not to work if you&#39;re porting your iOS app to Android. See the Known Issues guide on the website. We will work with the community to reach platform parity with iOS.">Release React Native for Android</a> <div class="blame-commit-meta"> <a href="/facebook/react-native/commit/42eb5464fd8a65ed84b799de5d4dc225349449be#comments"><span class="right octicon octicon-comment"></span></a> <a href="/mkonicek" class="muted-link" rel="contributor">mkonicek</a> authored <time datetime="2015-09-14T14:35:58Z" is="relative-time">Sep 14, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="3"></td> <td class="blob-num blame-blob-num js-line-number" id="L119">119</td> <td class="blob-code blob-code-inner js-file-line" id="LC119"> <span class="pl-smi">json</span>.<span class="pl-smi">componentPlatform</span> <span class="pl-k">=</span> componentPlatform;</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="4"> <a href="/facebook/react-native/commit/d5f670d19cde39aaa5064e9c12a2731feaaa8566" class="blame-sha">d5f670d</a> <img alt="@fkling" class="avatar blame-commit-avatar" height="32" src="https://avatars1.githubusercontent.com/u/179026?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/d5f670d19cde39aaa5064e9c12a2731feaaa8566" class="blame-commit-title" title="Add logic to show style props in docs">Add logic to show style props in docs</a> <div class="blame-commit-meta"> <a href="/fkling" class="muted-link" rel="contributor">fkling</a> authored <time datetime="2015-03-19T21:05:07Z" is="relative-time">Mar 19, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L120">120</td> <td class="blob-code blob-code-inner js-file-line" id="LC120"> <span class="pl-k">if</span> (styles) {</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L121">121</td> <td class="blob-code blob-code-inner js-file-line" id="LC121"> <span class="pl-smi">json</span>.<span class="pl-smi">styles</span> <span class="pl-k">=</span> styles;</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L122">122</td> <td class="blob-code blob-code-inner js-file-line" id="LC122"> }</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/42eb5464fd8a65ed84b799de5d4dc225349449be" class="blame-sha">42eb546</a> <img alt="@mkonicek" class="avatar blame-commit-avatar" height="32" src="https://avatars1.githubusercontent.com/u/346214?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/42eb5464fd8a65ed84b799de5d4dc225349449be" class="blame-commit-title" title="Release React Native for Android This is an early release and there are several things that are known not to work if you&#39;re porting your iOS app to Android. See the Known Issues guide on the website. We will work with the community to reach platform parity with iOS.">Release React Native for Android</a> <div class="blame-commit-meta"> <a href="/facebook/react-native/commit/42eb5464fd8a65ed84b799de5d4dc225349449be#comments"><span class="right octicon octicon-comment"></span></a> <a href="/mkonicek" class="muted-link" rel="contributor">mkonicek</a> authored <time datetime="2015-09-14T14:35:58Z" is="relative-time">Sep 14, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="3"></td> <td class="blob-num blame-blob-num js-line-number" id="L123">123</td> <td class="blob-code blob-code-inner js-file-line" id="LC123"> <span class="pl-smi">json</span>.<span class="pl-smi">example</span> <span class="pl-k">=</span> <span class="pl-en">getExample</span>(componentName, componentPlatform);</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/b9ab60719767bda61ca55e0f8e86a60bdebc9ec3" class="blame-sha">b9ab607</a> <img alt="@vjeux" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/197597?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/b9ab60719767bda61ca55e0f8e86a60bdebc9ec3" class="blame-commit-title" title="Use docs/ComponentName.md at the end of the component docs">Use docs/ComponentName.md at the end of the component docs</a> <div class="blame-commit-meta"> <a href="/vjeux" class="muted-link" rel="contributor">vjeux</a> authored <time datetime="2015-03-05T05:03:24Z" is="relative-time">Mar 5, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L124">124</td> <td class="blob-code blob-code-inner js-file-line" id="LC124"></td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="5"> <a href="/facebook/react-native/commit/debd5b0942736f1c9a72c4aad3458a9c17db6eee" class="blame-sha">debd5b0</a> <img alt="@brentvatne" class="avatar blame-commit-avatar" height="32" src="https://avatars1.githubusercontent.com/u/90494?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/debd5b0942736f1c9a72c4aad3458a9c17db6eee" class="blame-commit-title" title="[Docs] Remove Transforms from sidebar, add to Style">[Docs] Remove Transforms from sidebar, add to Style</a> <div class="blame-commit-meta"> <a href="/brentvatne" class="muted-link" rel="contributor">brentvatne</a> authored <time datetime="2015-05-07T23:05:30Z" is="relative-time">May 7, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L125">125</td> <td class="blob-code blob-code-inner js-file-line" id="LC125"> <span class="pl-c">// Put Flexbox into the Polyfills category</span></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L126">126</td> <td class="blob-code blob-code-inner js-file-line" id="LC126"> <span class="pl-k">var</span> category <span class="pl-k">=</span> (type <span class="pl-k">===</span> <span class="pl-s"><span class="pl-pds">&#39;</span>style<span class="pl-pds">&#39;</span></span> <span class="pl-k">?</span> <span class="pl-s"><span class="pl-pds">&#39;</span>Polyfills<span class="pl-pds">&#39;</span></span> <span class="pl-k">:</span> type <span class="pl-k">+</span> <span class="pl-s"><span class="pl-pds">&#39;</span>s<span class="pl-pds">&#39;</span></span>);</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L127">127</td> <td class="blob-code blob-code-inner js-file-line" id="LC127"> <span class="pl-k">var</span> next <span class="pl-k">=</span> <span class="pl-en">getNextComponent</span>(i);</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L128">128</td> <td class="blob-code blob-code-inner js-file-line" id="LC128"></td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="5"> <a href="/facebook/react-native/commit/70f28332b662c7f8b4292db9129fabd4be07f0ca" class="blame-sha">70f2833</a> <img alt="@vjeux" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/197597?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/70f28332b662c7f8b4292db9129fabd4be07f0ca" class="blame-commit-title" title="Initial version of the automatically generated docs">Initial version of the automatically generated docs</a> <div class="blame-commit-meta"> <a href="/facebook/react-native/commit/70f28332b662c7f8b4292db9129fabd4be07f0ca#comments"><span class="right octicon octicon-comment"></span></a> <a href="/vjeux" class="muted-link" rel="contributor">vjeux</a> authored <time datetime="2015-02-12T22:43:41Z" is="relative-time">Feb 12, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L129">129</td> <td class="blob-code blob-code-inner js-file-line" id="LC129"> <span class="pl-k">var</span> res <span class="pl-k">=</span> [</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L130">130</td> <td class="blob-code blob-code-inner js-file-line" id="LC130"> <span class="pl-s"><span class="pl-pds">&#39;</span>---<span class="pl-pds">&#39;</span></span>,</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L131">131</td> <td class="blob-code blob-code-inner js-file-line" id="LC131"> <span class="pl-s"><span class="pl-pds">&#39;</span>id: <span class="pl-pds">&#39;</span></span> <span class="pl-k">+</span> <span class="pl-en">slugify</span>(componentName),</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L132">132</td> <td class="blob-code blob-code-inner js-file-line" id="LC132"> <span class="pl-s"><span class="pl-pds">&#39;</span>title: <span class="pl-pds">&#39;</span></span> <span class="pl-k">+</span> componentName,</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/d935f4554b83cef5a144dbdd33eb9e978d0266c0" class="blame-sha">d935f45</a> <img alt="@vjeux" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/197597?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/d935f4554b83cef5a144dbdd33eb9e978d0266c0" class="blame-commit-title" title="Improvements in the docs generation">Improvements in the docs generation</a> <div class="blame-commit-meta"> <a href="/facebook/react-native/commit/d935f4554b83cef5a144dbdd33eb9e978d0266c0#comments"><span class="right octicon octicon-comment"></span></a> <a href="/vjeux" class="muted-link" rel="contributor">vjeux</a> authored <time datetime="2015-03-05T02:10:12Z" is="relative-time">Mar 4, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L133">133</td> <td class="blob-code blob-code-inner js-file-line" id="LC133"> <span class="pl-s"><span class="pl-pds">&#39;</span>layout: autodocs<span class="pl-pds">&#39;</span></span>,</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/debd5b0942736f1c9a72c4aad3458a9c17db6eee" class="blame-sha">debd5b0</a> <img alt="@brentvatne" class="avatar blame-commit-avatar" height="32" src="https://avatars1.githubusercontent.com/u/90494?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/debd5b0942736f1c9a72c4aad3458a9c17db6eee" class="blame-commit-title" title="[Docs] Remove Transforms from sidebar, add to Style">[Docs] Remove Transforms from sidebar, add to Style</a> <div class="blame-commit-meta"> <a href="/brentvatne" class="muted-link" rel="contributor">brentvatne</a> authored <time datetime="2015-05-07T23:05:30Z" is="relative-time">May 7, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L134">134</td> <td class="blob-code blob-code-inner js-file-line" id="LC134"> <span class="pl-s"><span class="pl-pds">&#39;</span>category: <span class="pl-pds">&#39;</span></span> <span class="pl-k">+</span> category,</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/70f28332b662c7f8b4292db9129fabd4be07f0ca" class="blame-sha">70f2833</a> <img alt="@vjeux" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/197597?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/70f28332b662c7f8b4292db9129fabd4be07f0ca" class="blame-commit-title" title="Initial version of the automatically generated docs">Initial version of the automatically generated docs</a> <div class="blame-commit-meta"> <a href="/facebook/react-native/commit/70f28332b662c7f8b4292db9129fabd4be07f0ca#comments"><span class="right octicon octicon-comment"></span></a> <a href="/vjeux" class="muted-link" rel="contributor">vjeux</a> authored <time datetime="2015-02-12T22:43:41Z" is="relative-time">Feb 12, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L135">135</td> <td class="blob-code blob-code-inner js-file-line" id="LC135"> <span class="pl-s"><span class="pl-pds">&#39;</span>permalink: docs/<span class="pl-pds">&#39;</span></span> <span class="pl-k">+</span> <span class="pl-en">slugify</span>(componentName) <span class="pl-k">+</span> <span class="pl-s"><span class="pl-pds">&#39;</span>.html<span class="pl-pds">&#39;</span></span>,</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/42eb5464fd8a65ed84b799de5d4dc225349449be" class="blame-sha">42eb546</a> <img alt="@mkonicek" class="avatar blame-commit-avatar" height="32" src="https://avatars1.githubusercontent.com/u/346214?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/42eb5464fd8a65ed84b799de5d4dc225349449be" class="blame-commit-title" title="Release React Native for Android This is an early release and there are several things that are known not to work if you&#39;re porting your iOS app to Android. See the Known Issues guide on the website. We will work with the community to reach platform parity with iOS.">Release React Native for Android</a> <div class="blame-commit-meta"> <a href="/facebook/react-native/commit/42eb5464fd8a65ed84b799de5d4dc225349449be#comments"><span class="right octicon octicon-comment"></span></a> <a href="/mkonicek" class="muted-link" rel="contributor">mkonicek</a> authored <time datetime="2015-09-14T14:35:58Z" is="relative-time">Sep 14, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="3"></td> <td class="blob-num blame-blob-num js-line-number" id="L136">136</td> <td class="blob-code blob-code-inner js-file-line" id="LC136"> <span class="pl-s"><span class="pl-pds">&#39;</span>platform: <span class="pl-pds">&#39;</span></span> <span class="pl-k">+</span> componentPlatform,</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="3"> <a href="/facebook/react-native/commit/debd5b0942736f1c9a72c4aad3458a9c17db6eee" class="blame-sha">debd5b0</a> <img alt="@brentvatne" class="avatar blame-commit-avatar" height="32" src="https://avatars1.githubusercontent.com/u/90494?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/debd5b0942736f1c9a72c4aad3458a9c17db6eee" class="blame-commit-title" title="[Docs] Remove Transforms from sidebar, add to Style">[Docs] Remove Transforms from sidebar, add to Style</a> <div class="blame-commit-meta"> <a href="/brentvatne" class="muted-link" rel="contributor">brentvatne</a> authored <time datetime="2015-05-07T23:05:30Z" is="relative-time">May 7, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L137">137</td> <td class="blob-code blob-code-inner js-file-line" id="LC137"> <span class="pl-s"><span class="pl-pds">&#39;</span>next: <span class="pl-pds">&#39;</span></span> <span class="pl-k">+</span> next,</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L138">138</td> <td class="blob-code blob-code-inner js-file-line" id="LC138"> <span class="pl-s"><span class="pl-pds">&#39;</span>sidebar: <span class="pl-pds">&#39;</span></span> <span class="pl-k">+</span> <span class="pl-en">shouldDisplayInSidebar</span>(componentName),</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/5af8849aa45e92da20d3ffb62cb2aa5b5868299f" class="blame-sha">5af8849</a> <img alt="@jsierles" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/82?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/5af8849aa45e92da20d3ffb62cb2aa5b5868299f" class="blame-commit-title" title="[Docs] Add a &#39;run this example&#39; link to AlertIOS docs, plus supporting code to add more links progressively">[Docs] Add a &#39;run this example&#39; link to AlertIOS docs, plus supportin…</a> <div class="blame-commit-meta"> <a href="/jsierles" class="muted-link" rel="contributor">jsierles</a> authored <time datetime="2015-06-30T21:39:49Z" is="relative-time">Jun 30, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="5"></td> <td class="blob-num blame-blob-num js-line-number" id="L139">139</td> <td class="blob-code blob-code-inner js-file-line" id="LC139"> <span class="pl-s"><span class="pl-pds">&#39;</span>runnable:<span class="pl-pds">&#39;</span></span> <span class="pl-k">+</span> <span class="pl-en">isRunnable</span>(componentName),</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/70f28332b662c7f8b4292db9129fabd4be07f0ca" class="blame-sha">70f2833</a> <img alt="@vjeux" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/197597?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/70f28332b662c7f8b4292db9129fabd4be07f0ca" class="blame-commit-title" title="Initial version of the automatically generated docs">Initial version of the automatically generated docs</a> <div class="blame-commit-meta"> <a href="/facebook/react-native/commit/70f28332b662c7f8b4292db9129fabd4be07f0ca#comments"><span class="right octicon octicon-comment"></span></a> <a href="/vjeux" class="muted-link" rel="contributor">vjeux</a> authored <time datetime="2015-02-12T22:43:41Z" is="relative-time">Feb 12, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L140">140</td> <td class="blob-code blob-code-inner js-file-line" id="LC140"> <span class="pl-s"><span class="pl-pds">&#39;</span>---<span class="pl-pds">&#39;</span></span>,</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/d935f4554b83cef5a144dbdd33eb9e978d0266c0" class="blame-sha">d935f45</a> <img alt="@vjeux" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/197597?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/d935f4554b83cef5a144dbdd33eb9e978d0266c0" class="blame-commit-title" title="Improvements in the docs generation">Improvements in the docs generation</a> <div class="blame-commit-meta"> <a href="/facebook/react-native/commit/d935f4554b83cef5a144dbdd33eb9e978d0266c0#comments"><span class="right octicon octicon-comment"></span></a> <a href="/vjeux" class="muted-link" rel="contributor">vjeux</a> authored <time datetime="2015-03-05T02:10:12Z" is="relative-time">Mar 5, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L141">141</td> <td class="blob-code blob-code-inner js-file-line" id="LC141"> <span class="pl-smi">JSON</span>.<span class="pl-en">stringify</span>(json, <span class="pl-c1">null</span>, <span class="pl-c1">2</span>),</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="5"> <a href="/facebook/react-native/commit/70f28332b662c7f8b4292db9129fabd4be07f0ca" class="blame-sha">70f2833</a> <img alt="@vjeux" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/197597?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/70f28332b662c7f8b4292db9129fabd4be07f0ca" class="blame-commit-title" title="Initial version of the automatically generated docs">Initial version of the automatically generated docs</a> <div class="blame-commit-meta"> <a href="/facebook/react-native/commit/70f28332b662c7f8b4292db9129fabd4be07f0ca#comments"><span class="right octicon octicon-comment"></span></a> <a href="/vjeux" class="muted-link" rel="contributor">vjeux</a> authored <time datetime="2015-02-12T22:43:41Z" is="relative-time">Feb 12, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L142">142</td> <td class="blob-code blob-code-inner js-file-line" id="LC142"> ].<span class="pl-en">filter</span>(<span class="pl-k">function</span>(<span class="pl-smi">line</span>) { <span class="pl-k">return</span> line; }).<span class="pl-c1">join</span>(<span class="pl-s"><span class="pl-pds">&#39;</span><span class="pl-cce">\n</span><span class="pl-pds">&#39;</span></span>);</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L143">143</td> <td class="blob-code blob-code-inner js-file-line" id="LC143"> <span class="pl-k">return</span> res;</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L144">144</td> <td class="blob-code blob-code-inner js-file-line" id="LC144">}</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L145">145</td> <td class="blob-code blob-code-inner js-file-line" id="LC145"></td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="9"> <a href="/facebook/react-native/commit/4681da54205b3c2e682850c4b5b5fcb655a296c4" class="blame-sha">4681da5</a> <img alt="@vjeux" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/197597?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/4681da54205b3c2e682850c4b5b5fcb655a296c4" class="blame-commit-title" title="Add geolocation polyfill">Add geolocation polyfill</a> <div class="blame-commit-meta"> <a href="/vjeux" class="muted-link" rel="contributor">vjeux</a> authored <time datetime="2015-03-25T04:13:55Z" is="relative-time">Mar 24, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L146">146</td> <td class="blob-code blob-code-inner js-file-line" id="LC146"><span class="pl-k">var</span> n;</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L147">147</td> <td class="blob-code blob-code-inner js-file-line" id="LC147"></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L148">148</td> <td class="blob-code blob-code-inner js-file-line" id="LC148"><span class="pl-k">function</span> <span class="pl-en">renderComponent</span>(<span class="pl-smi">filepath</span>) {</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L149">149</td> <td class="blob-code blob-code-inner js-file-line" id="LC149"> <span class="pl-k">var</span> json <span class="pl-k">=</span> <span class="pl-smi">docgen</span>.<span class="pl-c1">parse</span>(</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L150">150</td> <td class="blob-code blob-code-inner js-file-line" id="LC150"> <span class="pl-smi">fs</span>.<span class="pl-en">readFileSync</span>(filepath),</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L151">151</td> <td class="blob-code blob-code-inner js-file-line" id="LC151"> <span class="pl-smi">docgenHelpers</span>.<span class="pl-smi">findExportedOrFirst</span>,</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L152">152</td> <td class="blob-code blob-code-inner js-file-line" id="LC152"> <span class="pl-smi">docgen</span>.<span class="pl-smi">defaultHandlers</span>.<span class="pl-c1">concat</span>(<span class="pl-smi">docgenHelpers</span>.<span class="pl-smi">stylePropTypeHandler</span>)</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L153">153</td> <td class="blob-code blob-code-inner js-file-line" id="LC153"> );</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/731d4a061085558a302c3e76304140973e7b57b4" class="blame-sha">731d4a0</a> <img alt="@brentvatne" class="avatar blame-commit-avatar" height="32" src="https://avatars1.githubusercontent.com/u/90494?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/731d4a061085558a302c3e76304140973e7b57b4" class="blame-commit-title" title="Remove the deprecated transform propTypes">Remove the deprecated transform propTypes</a> <div class="blame-commit-meta"> <a href="/brentvatne" class="muted-link" rel="contributor">brentvatne</a> authored <time datetime="2015-05-07T19:50:41Z" is="relative-time">May 7, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L154">154</td> <td class="blob-code blob-code-inner js-file-line" id="LC154"></td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="10"> <a href="/facebook/react-native/commit/4681da54205b3c2e682850c4b5b5fcb655a296c4" class="blame-sha">4681da5</a> <img alt="@vjeux" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/197597?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/4681da54205b3c2e682850c4b5b5fcb655a296c4" class="blame-commit-title" title="Add geolocation polyfill">Add geolocation polyfill</a> <div class="blame-commit-meta"> <a href="/vjeux" class="muted-link" rel="contributor">vjeux</a> authored <time datetime="2015-03-25T04:13:55Z" is="relative-time">Mar 25, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L155">155</td> <td class="blob-code blob-code-inner js-file-line" id="LC155"> <span class="pl-k">return</span> <span class="pl-en">componentsToMarkdown</span>(<span class="pl-s"><span class="pl-pds">&#39;</span>component<span class="pl-pds">&#39;</span></span>, json, filepath, n<span class="pl-k">++</span>, styleDocs);</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L156">156</td> <td class="blob-code blob-code-inner js-file-line" id="LC156">}</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L157">157</td> <td class="blob-code blob-code-inner js-file-line" id="LC157"></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L158">158</td> <td class="blob-code blob-code-inner js-file-line" id="LC158"><span class="pl-k">function</span> <span class="pl-en">renderAPI</span>(<span class="pl-smi">type</span>) {</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L159">159</td> <td class="blob-code blob-code-inner js-file-line" id="LC159"> <span class="pl-k">return</span> <span class="pl-k">function</span>(<span class="pl-smi">filepath</span>) {</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L160">160</td> <td class="blob-code blob-code-inner js-file-line" id="LC160"> <span class="pl-k">var</span> json;</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L161">161</td> <td class="blob-code blob-code-inner js-file-line" id="LC161"> <span class="pl-k">try</span> {</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L162">162</td> <td class="blob-code blob-code-inner js-file-line" id="LC162"> json <span class="pl-k">=</span> <span class="pl-en">jsDocs</span>(<span class="pl-smi">fs</span>.<span class="pl-en">readFileSync</span>(filepath).<span class="pl-c1">toString</span>());</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L163">163</td> <td class="blob-code blob-code-inner js-file-line" id="LC163"> } <span class="pl-k">catch</span>(e) {</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/126928b0b4d06b9850f5e53582420d224b2a40ce" class="blame-sha">126928b</a> <img alt="@sahrens" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/1509831?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/126928b0b4d06b9850f5e53582420d224b2a40ce" class="blame-commit-title" title="[Docs] Expand API parsing and rendering The `Animated` module exposes a lot of functionality, including internal classes. This diff extracts properties and classes from modules and renders them recursively. This also adds `Animated` to the autogen docs now that they more capable, although it needs way more docblocks and such which will come later.">[Docs] Expand API parsing and rendering</a> <div class="blame-commit-meta"> <a href="/sahrens" class="muted-link" rel="contributor">sahrens</a> authored <time datetime="2015-09-01T19:41:51Z" is="relative-time">Sep 1, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="3"></td> <td class="blob-num blame-blob-num js-line-number" id="L164">164</td> <td class="blob-code blob-code-inner js-file-line" id="LC164"> <span class="pl-en">console</span>.<span class="pl-c1">error</span>(<span class="pl-s"><span class="pl-pds">&#39;</span>Cannot parse file<span class="pl-pds">&#39;</span></span>, filepath, e);</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="13"> <a href="/facebook/react-native/commit/4681da54205b3c2e682850c4b5b5fcb655a296c4" class="blame-sha">4681da5</a> <img alt="@vjeux" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/197597?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/4681da54205b3c2e682850c4b5b5fcb655a296c4" class="blame-commit-title" title="Add geolocation polyfill">Add geolocation polyfill</a> <div class="blame-commit-meta"> <a href="/vjeux" class="muted-link" rel="contributor">vjeux</a> authored <time datetime="2015-03-25T04:13:55Z" is="relative-time">Mar 25, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L165">165</td> <td class="blob-code blob-code-inner js-file-line" id="LC165"> json <span class="pl-k">=</span> {};</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L166">166</td> <td class="blob-code blob-code-inner js-file-line" id="LC166"> }</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L167">167</td> <td class="blob-code blob-code-inner js-file-line" id="LC167"> <span class="pl-k">return</span> <span class="pl-en">componentsToMarkdown</span>(type, json, filepath, n<span class="pl-k">++</span>);</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L168">168</td> <td class="blob-code blob-code-inner js-file-line" id="LC168"> };</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L169">169</td> <td class="blob-code blob-code-inner js-file-line" id="LC169">}</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L170">170</td> <td class="blob-code blob-code-inner js-file-line" id="LC170"></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L171">171</td> <td class="blob-code blob-code-inner js-file-line" id="LC171"><span class="pl-k">function</span> <span class="pl-en">renderStyle</span>(<span class="pl-smi">filepath</span>) {</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L172">172</td> <td class="blob-code blob-code-inner js-file-line" id="LC172"> <span class="pl-k">var</span> json <span class="pl-k">=</span> <span class="pl-smi">docgen</span>.<span class="pl-c1">parse</span>(</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L173">173</td> <td class="blob-code blob-code-inner js-file-line" id="LC173"> <span class="pl-smi">fs</span>.<span class="pl-en">readFileSync</span>(filepath),</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L174">174</td> <td class="blob-code blob-code-inner js-file-line" id="LC174"> <span class="pl-smi">docgenHelpers</span>.<span class="pl-smi">findExportedObject</span>,</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L175">175</td> <td class="blob-code blob-code-inner js-file-line" id="LC175"> [<span class="pl-smi">docgen</span>.<span class="pl-smi">handlers</span>.<span class="pl-smi">propTypeHandler</span>]</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L176">176</td> <td class="blob-code blob-code-inner js-file-line" id="LC176"> );</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/731d4a061085558a302c3e76304140973e7b57b4" class="blame-sha">731d4a0</a> <img alt="@brentvatne" class="avatar blame-commit-avatar" height="32" src="https://avatars1.githubusercontent.com/u/90494?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/731d4a061085558a302c3e76304140973e7b57b4" class="blame-commit-title" title="Remove the deprecated transform propTypes">Remove the deprecated transform propTypes</a> <div class="blame-commit-meta"> <a href="/brentvatne" class="muted-link" rel="contributor">brentvatne</a> authored <time datetime="2015-05-07T19:50:41Z" is="relative-time">May 7, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L177">177</td> <td class="blob-code blob-code-inner js-file-line" id="LC177"></td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/debd5b0942736f1c9a72c4aad3458a9c17db6eee" class="blame-sha">debd5b0</a> <img alt="@brentvatne" class="avatar blame-commit-avatar" height="32" src="https://avatars1.githubusercontent.com/u/90494?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/debd5b0942736f1c9a72c4aad3458a9c17db6eee" class="blame-commit-title" title="[Docs] Remove Transforms from sidebar, add to Style">[Docs] Remove Transforms from sidebar, add to Style</a> <div class="blame-commit-meta"> <a href="/brentvatne" class="muted-link" rel="contributor">brentvatne</a> authored <time datetime="2015-05-07T23:05:30Z" is="relative-time">May 7, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L178">178</td> <td class="blob-code blob-code-inner js-file-line" id="LC178"> <span class="pl-c">// Remove deprecated transform props from docs</span></td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="7"> <a href="/facebook/react-native/commit/731d4a061085558a302c3e76304140973e7b57b4" class="blame-sha">731d4a0</a> <img alt="@brentvatne" class="avatar blame-commit-avatar" height="32" src="https://avatars1.githubusercontent.com/u/90494?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/731d4a061085558a302c3e76304140973e7b57b4" class="blame-commit-title" title="Remove the deprecated transform propTypes">Remove the deprecated transform propTypes</a> <div class="blame-commit-meta"> <a href="/brentvatne" class="muted-link" rel="contributor">brentvatne</a> authored <time datetime="2015-05-07T19:50:41Z" is="relative-time">May 7, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L179">179</td> <td class="blob-code blob-code-inner js-file-line" id="LC179"> <span class="pl-k">if</span> (filepath <span class="pl-k">===</span> <span class="pl-s"><span class="pl-pds">&quot;</span>../Libraries/StyleSheet/TransformPropTypes.js<span class="pl-pds">&quot;</span></span>) {</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L180">180</td> <td class="blob-code blob-code-inner js-file-line" id="LC180"> [<span class="pl-s"><span class="pl-pds">&#39;</span>rotation<span class="pl-pds">&#39;</span></span>, <span class="pl-s"><span class="pl-pds">&#39;</span>scaleX<span class="pl-pds">&#39;</span></span>, <span class="pl-s"><span class="pl-pds">&#39;</span>scaleY<span class="pl-pds">&#39;</span></span>, <span class="pl-s"><span class="pl-pds">&#39;</span>translateX<span class="pl-pds">&#39;</span></span>, <span class="pl-s"><span class="pl-pds">&#39;</span>translateY<span class="pl-pds">&#39;</span></span>].<span class="pl-en">forEach</span>(<span class="pl-k">function</span>(<span class="pl-smi">key</span>) {</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L181">181</td> <td class="blob-code blob-code-inner js-file-line" id="LC181"> <span class="pl-k">delete</span> json[<span class="pl-s"><span class="pl-pds">&#39;</span>props<span class="pl-pds">&#39;</span></span>][key];</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L182">182</td> <td class="blob-code blob-code-inner js-file-line" id="LC182"> });</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L183">183</td> <td class="blob-code blob-code-inner js-file-line" id="LC183"> }</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L184">184</td> <td class="blob-code blob-code-inner js-file-line" id="LC184"></td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="4"> <a href="/facebook/react-native/commit/4681da54205b3c2e682850c4b5b5fcb655a296c4" class="blame-sha">4681da5</a> <img alt="@vjeux" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/197597?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/4681da54205b3c2e682850c4b5b5fcb655a296c4" class="blame-commit-title" title="Add geolocation polyfill">Add geolocation polyfill</a> <div class="blame-commit-meta"> <a href="/vjeux" class="muted-link" rel="contributor">vjeux</a> authored <time datetime="2015-03-25T04:13:55Z" is="relative-time">Mar 25, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L185">185</td> <td class="blob-code blob-code-inner js-file-line" id="LC185"> <span class="pl-k">return</span> <span class="pl-en">componentsToMarkdown</span>(<span class="pl-s"><span class="pl-pds">&#39;</span>style<span class="pl-pds">&#39;</span></span>, json, filepath, n<span class="pl-k">++</span>);</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L186">186</td> <td class="blob-code blob-code-inner js-file-line" id="LC186">}</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L187">187</td> <td class="blob-code blob-code-inner js-file-line" id="LC187"></td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/70f28332b662c7f8b4292db9129fabd4be07f0ca" class="blame-sha">70f2833</a> <img alt="@vjeux" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/197597?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/70f28332b662c7f8b4292db9129fabd4be07f0ca" class="blame-commit-title" title="Initial version of the automatically generated docs">Initial version of the automatically generated docs</a> <div class="blame-commit-meta"> <a href="/facebook/react-native/commit/70f28332b662c7f8b4292db9129fabd4be07f0ca#comments"><span class="right octicon octicon-comment"></span></a> <a href="/vjeux" class="muted-link" rel="contributor">vjeux</a> authored <time datetime="2015-02-12T22:43:41Z" is="relative-time">Feb 12, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L188">188</td> <td class="blob-code blob-code-inner js-file-line" id="LC188"><span class="pl-k">var</span> components <span class="pl-k">=</span> [</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/b9ab60719767bda61ca55e0f8e86a60bdebc9ec3" class="blame-sha">b9ab607</a> <img alt="@vjeux" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/197597?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/b9ab60719767bda61ca55e0f8e86a60bdebc9ec3" class="blame-commit-title" title="Use docs/ComponentName.md at the end of the component docs">Use docs/ComponentName.md at the end of the component docs</a> <div class="blame-commit-meta"> <a href="/vjeux" class="muted-link" rel="contributor">vjeux</a> authored <time datetime="2015-03-05T05:03:24Z" is="relative-time">Mar 5, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L189">189</td> <td class="blob-code blob-code-inner js-file-line" id="LC189"> <span class="pl-s"><span class="pl-pds">&#39;</span>../Libraries/Components/ActivityIndicatorIOS/ActivityIndicatorIOS.ios.js<span class="pl-pds">&#39;</span></span>,</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/83581cfe6bf046c6d659d96cb0b25f62e0e9da00" class="blame-sha">83581cf</a> <img alt="@vjeux" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/197597?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/83581cfe6bf046c6d659d96cb0b25f62e0e9da00" class="blame-commit-title" title="Initial import of the lib to parse javascript code, in the same vein as we parse React proptypes">Initial import of the lib to parse javascript code, in the same vein …</a> <div class="blame-commit-meta"> <a href="/vjeux" class="muted-link" rel="contributor">vjeux</a> authored <time datetime="2015-03-10T20:55:54Z" is="relative-time">Mar 10, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L190">190</td> <td class="blob-code blob-code-inner js-file-line" id="LC190"> <span class="pl-s"><span class="pl-pds">&#39;</span>../Libraries/Components/DatePicker/DatePickerIOS.ios.js<span class="pl-pds">&#39;</span></span>,</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/42eb5464fd8a65ed84b799de5d4dc225349449be" class="blame-sha">42eb546</a> <img alt="@mkonicek" class="avatar blame-commit-avatar" height="32" src="https://avatars1.githubusercontent.com/u/346214?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/42eb5464fd8a65ed84b799de5d4dc225349449be" class="blame-commit-title" title="Release React Native for Android This is an early release and there are several things that are known not to work if you&#39;re porting your iOS app to Android. See the Known Issues guide on the website. We will work with the community to reach platform parity with iOS.">Release React Native for Android</a> <div class="blame-commit-meta"> <a href="/facebook/react-native/commit/42eb5464fd8a65ed84b799de5d4dc225349449be#comments"><span class="right octicon octicon-comment"></span></a> <a href="/mkonicek" class="muted-link" rel="contributor">mkonicek</a> authored <time datetime="2015-09-14T14:35:58Z" is="relative-time">Sep 14, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="3"></td> <td class="blob-num blame-blob-num js-line-number" id="L191">191</td> <td class="blob-code blob-code-inner js-file-line" id="LC191"> <span class="pl-s"><span class="pl-pds">&#39;</span>../Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js<span class="pl-pds">&#39;</span></span>,</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/f77d9f8bae5344c5f69de305ccfe14b5a0c8a528" class="blame-sha">f77d9f8</a> <img alt="@fkling" class="avatar blame-commit-avatar" height="32" src="https://avatars1.githubusercontent.com/u/179026?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/f77d9f8bae5344c5f69de305ccfe14b5a0c8a528" class="blame-commit-title" title="Update react-docgen">Update react-docgen</a> <div class="blame-commit-meta"> <a href="/fkling" class="muted-link" rel="contributor">fkling</a> authored <time datetime="2015-03-03T01:31:26Z" is="relative-time">Mar 2, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L192">192</td> <td class="blob-code blob-code-inner js-file-line" id="LC192"> <span class="pl-s"><span class="pl-pds">&#39;</span>../Libraries/Image/Image.ios.js<span class="pl-pds">&#39;</span></span>,</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/a66fad52b65874abcfc1ac79da81057279dd5dac" class="blame-sha">a66fad5</a> <img alt="@vjeux" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/197597?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/a66fad52b65874abcfc1ac79da81057279dd5dac" class="blame-commit-title" title="Updates from Fri 20 Mar - declare timeoutID | <NAME> - [react-packager] Allow entry point extensions like .ios.js | <NAME> - [react-native] Use SpreadProperty to make react-docgen happy | <NAME> - clean Examples/2048 | <NAME> - [ReactNative] Adjust packager default root when running from within node_modules | <NAME> - [ReactNative] Add missing websocket dependency | <NAME> - [react-packager] change all but one `ix` to `require` | <NAME>">Updates from Fri 20 Mar</a> <div class="blame-commit-meta"> <a href="/vjeux" class="muted-link" rel="contributor">vjeux</a> authored <time datetime="2015-03-21T17:07:45Z" is="relative-time">Mar 21, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L193">193</td> <td class="blob-code blob-code-inner js-file-line" id="LC193"> <span class="pl-s"><span class="pl-pds">&#39;</span>../Libraries/CustomComponents/ListView/ListView.js<span class="pl-pds">&#39;</span></span>,</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/28aa691d135e9fd201f86816a0a2d635361c5b64" class="blame-sha">28aa691</a> <img alt="@vjeux" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/197597?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/28aa691d135e9fd201f86816a0a2d635361c5b64" class="blame-commit-title" title="Updates from Fri 13 Mar - [ReactNative] Oss ActionSheet | <NAME>lo - [ReactNative] Fix ScrollView.scrollTo() | <NAME> - [catalyst|madman] fix location observer | <NAME> - [ReactNative] Remove keyboardDismissMode from static | <NAME> - [ReactNative] Fix RCTMapManager retaining cycle | <NAME> - [ReactNative] Support loading sourcemaps from sourceMappingURL | <NAME> - [catalyst] set up directory specific rql transform | <NAME> - [React Native] Add .done() to terminate promise chains | <NAME> - [React Native] add support for reading tracking bit | <NAME>">Updates from Fri 13 Mar</a> <div class="blame-commit-meta"> <a href="/vjeux" class="muted-link" rel="contributor">vjeux</a> authored <time datetime="2015-03-13T22:30:31Z" is="relative-time">Mar 13, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L194">194</td> <td class="blob-code blob-code-inner js-file-line" id="LC194"> <span class="pl-s"><span class="pl-pds">&#39;</span>../Libraries/Components/MapView/MapView.js<span class="pl-pds">&#39;</span></span>,</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/51b1f399be6e119aeeab12c4c17c682f11c93f57" class="blame-sha">51b1f39</a> <img alt="@sahrens" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/1509831?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/51b1f399be6e119aeeab12c4c17c682f11c93f57" class="blame-commit-title" title="Update auto gen docs * docgen -&gt; v2.0.1 to support ES6 classes. * Add `&lt;Modal&gt;` and `&lt;ProgressViewIOS&gt;` components to docs.">Update auto gen docs</a> <div class="blame-commit-meta"> <a href="/sahrens" class="muted-link" rel="contributor">sahrens</a> authored <time datetime="2015-08-31T19:23:11Z" is="relative-time">Aug 31, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="3"></td> <td class="blob-num blame-blob-num js-line-number" id="L195">195</td> <td class="blob-code blob-code-inner js-file-line" id="LC195"> <span class="pl-s"><span class="pl-pds">&#39;</span>../Libraries/Modal/Modal.js<span class="pl-pds">&#39;</span></span>,</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/fab8e38759f620f242557e1219c2e6c8c5766f1f" class="blame-sha">fab8e38</a> <img alt="@spicyj" class="avatar blame-commit-avatar" height="32" src="https://avatars2.githubusercontent.com/u/6820?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/fab8e38759f620f242557e1219c2e6c8c5766f1f" class="blame-commit-title" title="Fix ABC order of docs nav">Fix ABC order of docs nav</a> <div class="blame-commit-meta"> <a href="/spicyj" class="muted-link" rel="contributor">spicyj</a> authored <time datetime="2015-11-26T05:26:32Z" is="relative-time">Nov 25, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="1"></td> <td class="blob-num blame-blob-num js-line-number" id="L196">196</td> <td class="blob-code blob-code-inner js-file-line" id="LC196"> <span class="pl-s"><span class="pl-pds">&#39;</span>../Libraries/CustomComponents/Navigator/Navigator.js<span class="pl-pds">&#39;</span></span>,</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/70f28332b662c7f8b4292db9129fabd4be07f0ca" class="blame-sha">70f2833</a> <img alt="@vjeux" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/197597?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/70f28332b662c7f8b4292db9129fabd4be07f0ca" class="blame-commit-title" title="Initial version of the automatically generated docs">Initial version of the automatically generated docs</a> <div class="blame-commit-meta"> <a href="/facebook/react-native/commit/70f28332b662c7f8b4292db9129fabd4be07f0ca#comments"><span class="right octicon octicon-comment"></span></a> <a href="/vjeux" class="muted-link" rel="contributor">vjeux</a> authored <time datetime="2015-02-12T22:43:41Z" is="relative-time">Feb 12, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L197">197</td> <td class="blob-code blob-code-inner js-file-line" id="LC197"> <span class="pl-s"><span class="pl-pds">&#39;</span>../Libraries/Components/Navigation/NavigatorIOS.ios.js<span class="pl-pds">&#39;</span></span>,</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/28aa691d135e9fd201f86816a0a2d635361c5b64" class="blame-sha">28aa691</a> <img alt="@vjeux" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/197597?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/28aa691d135e9fd201f86816a0a2d635361c5b64" class="blame-commit-title" title="Updates from Fri 13 Mar - [ReactNative] Oss ActionSheet | <NAME> - [ReactNative] Fix ScrollView.scrollTo() | <NAME> - [catalyst|madman] fix location observer | <NAME> - [ReactNative] Remove keyboardDismissMode from static | <NAME> - [ReactNative] Fix RCTMapManager retaining cycle | <NAME> - [ReactNative] Support loading sourcemaps from sourceMappingURL | <NAME> - [catalyst] set up directory specific rql transform | <NAME> - [React Native] Add .done() to terminate promise chains | <NAME> - [React Native] add support for reading tracking bit | <NAME>">Updates from Fri 13 Mar</a> <div class="blame-commit-meta"> <a href="/vjeux" class="muted-link" rel="contributor">vjeux</a> authored <time datetime="2015-03-13T22:30:31Z" is="relative-time">Mar 13, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L198">198</td> <td class="blob-code blob-code-inner js-file-line" id="LC198"> <span class="pl-s"><span class="pl-pds">&#39;</span>../Libraries/Picker/PickerIOS.ios.js<span class="pl-pds">&#39;</span></span>,</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/42eb5464fd8a65ed84b799de5d4dc225349449be" class="blame-sha">42eb546</a> <img alt="@mkonicek" class="avatar blame-commit-avatar" height="32" src="https://avatars1.githubusercontent.com/u/346214?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/42eb5464fd8a65ed84b799de5d4dc225349449be" class="blame-commit-title" title="Release React Native for Android This is an early release and there are several things that are known not to work if you&#39;re porting your iOS app to Android. See the Known Issues guide on the website. We will work with the community to reach platform parity with iOS.">Release React Native for Android</a> <div class="blame-commit-meta"> <a href="/facebook/react-native/commit/42eb5464fd8a65ed84b799de5d4dc225349449be#comments"><span class="right octicon octicon-comment"></span></a> <a href="/mkonicek" class="muted-link" rel="contributor">mkonicek</a> authored <time datetime="2015-09-14T14:35:58Z" is="relative-time">Sep 14, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="3"></td> <td class="blob-num blame-blob-num js-line-number" id="L199">199</td> <td class="blob-code blob-code-inner js-file-line" id="LC199"> <span class="pl-s"><span class="pl-pds">&#39;</span>../Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.android.js<span class="pl-pds">&#39;</span></span>,</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/51b1f399be6e119aeeab12c4c17c682f11c93f57" class="blame-sha">51b1f39</a> <img alt="@sahrens" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/1509831?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/51b1f399be6e119aeeab12c4c17c682f11c93f57" class="blame-commit-title" title="Update auto gen docs * docgen -&gt; v2.0.1 to support ES6 classes. * Add `&lt;Modal&gt;` and `&lt;ProgressViewIOS&gt;` components to docs.">Update auto gen docs</a> <div class="blame-commit-meta"> <a href="/sahrens" class="muted-link" rel="contributor">sahrens</a> authored <time datetime="2015-08-31T19:23:11Z" is="relative-time">Aug 31, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="3"></td> <td class="blob-num blame-blob-num js-line-number" id="L200">200</td> <td class="blob-code blob-code-inner js-file-line" id="LC200"> <span class="pl-s"><span class="pl-pds">&#39;</span>../Libraries/Components/ProgressViewIOS/ProgressViewIOS.ios.js<span class="pl-pds">&#39;</span></span>,</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/f87b0cb495470e3ca28599a82233d57a2dce9eb9" class="blame-sha">f87b0cb</a> <img alt="@vjeux" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/197597?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/f87b0cb495470e3ca28599a82233d57a2dce9eb9" class="blame-commit-title" title="[Website] Add a link when composing prop types">[Website] Add a link when composing prop types</a> <div class="blame-commit-meta"> <a href="/vjeux" class="muted-link" rel="contributor">vjeux</a> authored <time datetime="2015-03-09T18:49:58Z" is="relative-time">Mar 9, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L201">201</td> <td class="blob-code blob-code-inner js-file-line" id="LC201"> <span class="pl-s"><span class="pl-pds">&#39;</span>../Libraries/Components/ScrollView/ScrollView.js<span class="pl-pds">&#39;</span></span>,</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/1c05aff424be56206daac12a540c7b925b7a76ce" class="blame-sha">1c05aff</a> <img alt="@umhan35" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/3271612?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/1c05aff424be56206daac12a540c7b925b7a76ce" class="blame-commit-title" title="Add SegmentedControlIOS documentation to website">Add SegmentedControlIOS documentation to website</a> <div class="blame-commit-meta"> <a href="/umhan35" class="muted-link" rel="contributor">umhan35</a> authored <time datetime="2015-05-15T03:22:31Z" is="relative-time">May 14, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L202">202</td> <td class="blob-code blob-code-inner js-file-line" id="LC202"> <span class="pl-s"><span class="pl-pds">&#39;</span>../Libraries/Components/SegmentedControlIOS/SegmentedControlIOS.ios.js<span class="pl-pds">&#39;</span></span>,</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/5ebe0ed7179ff5c3513a08121004c6fe8b957a8b" class="blame-sha">5ebe0ed</a> <img alt="@vjeux" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/197597?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/5ebe0ed7179ff5c3513a08121004c6fe8b957a8b" class="blame-commit-title" title="Bust jest caching and fix tests">Bust jest caching and fix tests</a> <div class="blame-commit-meta"> <a href="/vjeux" class="muted-link" rel="contributor">vjeux</a> authored <time datetime="2015-08-11T17:25:39Z" is="relative-time">Aug 11, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="4"></td> <td class="blob-num blame-blob-num js-line-number" id="L203">203</td> <td class="blob-code blob-code-inner js-file-line" id="LC203"> <span class="pl-s"><span class="pl-pds">&#39;</span>../Libraries/Components/SliderIOS/SliderIOS.ios.js<span class="pl-pds">&#39;</span></span>,</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/42eb5464fd8a65ed84b799de5d4dc225349449be" class="blame-sha">42eb546</a> <img alt="@mkonicek" class="avatar blame-commit-avatar" height="32" src="https://avatars1.githubusercontent.com/u/346214?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/42eb5464fd8a65ed84b799de5d4dc225349449be" class="blame-commit-title" title="Release React Native for Android This is an early release and there are several things that are known not to work if you&#39;re porting your iOS app to Android. See the Known Issues guide on the website. We will work with the community to reach platform parity with iOS.">Release React Native for Android</a> <div class="blame-commit-meta"> <a href="/facebook/react-native/commit/42eb5464fd8a65ed84b799de5d4dc225349449be#comments"><span class="right octicon octicon-comment"></span></a> <a href="/mkonicek" class="muted-link" rel="contributor">mkonicek</a> authored <time datetime="2015-09-14T14:35:58Z" is="relative-time">Sep 14, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="3"></td> <td class="blob-num blame-blob-num js-line-number" id="L204">204</td> <td class="blob-code blob-code-inner js-file-line" id="LC204"> <span class="pl-s"><span class="pl-pds">&#39;</span>../Libraries/Components/SwitchAndroid/SwitchAndroid.android.js<span class="pl-pds">&#39;</span></span>,</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="3"> <a href="/facebook/react-native/commit/83581cfe6bf046c6d659d96cb0b25f62e0e9da00" class="blame-sha">83581cf</a> <img alt="@vjeux" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/197597?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/83581cfe6bf046c6d659d96cb0b25f62e0e9da00" class="blame-commit-title" title="Initial import of the lib to parse javascript code, in the same vein as we parse React proptypes">Initial import of the lib to parse javascript code, in the same vein …</a> <div class="blame-commit-meta"> <a href="/vjeux" class="muted-link" rel="contributor">vjeux</a> authored <time datetime="2015-03-10T20:55:54Z" is="relative-time">Mar 10, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L205">205</td> <td class="blob-code blob-code-inner js-file-line" id="LC205"> <span class="pl-s"><span class="pl-pds">&#39;</span>../Libraries/Components/SwitchIOS/SwitchIOS.ios.js<span class="pl-pds">&#39;</span></span>,</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L206">206</td> <td class="blob-code blob-code-inner js-file-line" id="LC206"> <span class="pl-s"><span class="pl-pds">&#39;</span>../Libraries/Components/TabBarIOS/TabBarIOS.ios.js<span class="pl-pds">&#39;</span></span>,</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/9ee6cd61682c19d3373a388474b9071ed729078b" class="blame-sha">9ee6cd6</a> <img alt="@brentvatne" class="avatar blame-commit-avatar" height="32" src="https://avatars1.githubusercontent.com/u/90494?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/9ee6cd61682c19d3373a388474b9071ed729078b" class="blame-commit-title" title="[Docs] Add TabBarIOS.Item to docs">[Docs] Add TabBarIOS.Item to docs</a> <div class="blame-commit-meta"> <a href="/brentvatne" class="muted-link" rel="contributor">brentvatne</a> authored <time datetime="2015-04-21T17:19:36Z" is="relative-time">Apr 21, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L207">207</td> <td class="blob-code blob-code-inner js-file-line" id="LC207"> <span class="pl-s"><span class="pl-pds">&#39;</span>../Libraries/Components/TabBarIOS/TabBarItemIOS.ios.js<span class="pl-pds">&#39;</span></span>,</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/f77d9f8bae5344c5f69de305ccfe14b5a0c8a528" class="blame-sha">f77d9f8</a> <img alt="@fkling" class="avatar blame-commit-avatar" height="32" src="https://avatars1.githubusercontent.com/u/179026?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/f77d9f8bae5344c5f69de305ccfe14b5a0c8a528" class="blame-commit-title" title="Update react-docgen">Update react-docgen</a> <div class="blame-commit-meta"> <a href="/fkling" class="muted-link" rel="contributor">fkling</a> authored <time datetime="2015-03-03T01:31:26Z" is="relative-time">Mar 3, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L208">208</td> <td class="blob-code blob-code-inner js-file-line" id="LC208"> <span class="pl-s"><span class="pl-pds">&#39;</span>../Libraries/Text/Text.js<span class="pl-pds">&#39;</span></span>,</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/ed7b5cb1876ec5b85e93d6b112f9e7dd1c592841" class="blame-sha">ed7b5cb</a> <img alt="@vjeux" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/197597?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/ed7b5cb1876ec5b85e93d6b112f9e7dd1c592841" class="blame-commit-title" title="Fix docs">Fix docs</a> <div class="blame-commit-meta"> <a href="/vjeux" class="muted-link" rel="contributor">vjeux</a> authored <time datetime="2015-03-31T16:46:45Z" is="relative-time">Mar 31, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L209">209</td> <td class="blob-code blob-code-inner js-file-line" id="LC209"> <span class="pl-s"><span class="pl-pds">&#39;</span>../Libraries/Components/TextInput/TextInput.js<span class="pl-pds">&#39;</span></span>,</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/42eb5464fd8a65ed84b799de5d4dc225349449be" class="blame-sha">42eb546</a> <img alt="@mkonicek" class="avatar blame-commit-avatar" height="32" src="https://avatars1.githubusercontent.com/u/346214?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/42eb5464fd8a65ed84b799de5d4dc225349449be" class="blame-commit-title" title="Release React Native for Android This is an early release and there are several things that are known not to work if you&#39;re porting your iOS app to Android. See the Known Issues guide on the website. We will work with the community to reach platform parity with iOS.">Release React Native for Android</a> <div class="blame-commit-meta"> <a href="/facebook/react-native/commit/42eb5464fd8a65ed84b799de5d4dc225349449be#comments"><span class="right octicon octicon-comment"></span></a> <a href="/mkonicek" class="muted-link" rel="contributor">mkonicek</a> authored <time datetime="2015-09-14T14:35:58Z" is="relative-time">Sep 14, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="3"></td> <td class="blob-num blame-blob-num js-line-number" id="L210">210</td> <td class="blob-code blob-code-inner js-file-line" id="LC210"> <span class="pl-s"><span class="pl-pds">&#39;</span>../Libraries/Components/ToolbarAndroid/ToolbarAndroid.android.js<span class="pl-pds">&#39;</span></span>,</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/70f28332b662c7f8b4292db9129fabd4be07f0ca" class="blame-sha">70f2833</a> <img alt="@vjeux" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/197597?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/70f28332b662c7f8b4292db9129fabd4be07f0ca" class="blame-commit-title" title="Initial version of the automatically generated docs">Initial version of the automatically generated docs</a> <div class="blame-commit-meta"> <a href="/facebook/react-native/commit/70f28332b662c7f8b4292db9129fabd4be07f0ca#comments"><span class="right octicon octicon-comment"></span></a> <a href="/vjeux" class="muted-link" rel="contributor">vjeux</a> authored <time datetime="2015-02-12T22:43:41Z" is="relative-time">Feb 12, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L211">211</td> <td class="blob-code blob-code-inner js-file-line" id="LC211"> <span class="pl-s"><span class="pl-pds">&#39;</span>../Libraries/Components/Touchable/TouchableHighlight.js<span class="pl-pds">&#39;</span></span>,</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/42eb5464fd8a65ed84b799de5d4dc225349449be" class="blame-sha">42eb546</a> <img alt="@mkonicek" class="avatar blame-commit-avatar" height="32" src="https://avatars1.githubusercontent.com/u/346214?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/42eb5464fd8a65ed84b799de5d4dc225349449be" class="blame-commit-title" title="Release React Native for Android This is an early release and there are several things that are known not to work if you&#39;re porting your iOS app to Android. See the Known Issues guide on the website. We will work with the community to reach platform parity with iOS.">Release React Native for Android</a> <div class="blame-commit-meta"> <a href="/facebook/react-native/commit/42eb5464fd8a65ed84b799de5d4dc225349449be#comments"><span class="right octicon octicon-comment"></span></a> <a href="/mkonicek" class="muted-link" rel="contributor">mkonicek</a> authored <time datetime="2015-09-14T14:35:58Z" is="relative-time">Sep 14, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="3"></td> <td class="blob-num blame-blob-num js-line-number" id="L212">212</td> <td class="blob-code blob-code-inner js-file-line" id="LC212"> <span class="pl-s"><span class="pl-pds">&#39;</span>../Libraries/Components/Touchable/TouchableNativeFeedback.android.js<span class="pl-pds">&#39;</span></span>,</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/b9ab60719767bda61ca55e0f8e86a60bdebc9ec3" class="blame-sha">b9ab607</a> <img alt="@vjeux" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/197597?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/b9ab60719767bda61ca55e0f8e86a60bdebc9ec3" class="blame-commit-title" title="Use docs/ComponentName.md at the end of the component docs">Use docs/ComponentName.md at the end of the component docs</a> <div class="blame-commit-meta"> <a href="/vjeux" class="muted-link" rel="contributor">vjeux</a> authored <time datetime="2015-03-05T05:03:24Z" is="relative-time">Mar 5, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L213">213</td> <td class="blob-code blob-code-inner js-file-line" id="LC213"> <span class="pl-s"><span class="pl-pds">&#39;</span>../Libraries/Components/Touchable/TouchableOpacity.js<span class="pl-pds">&#39;</span></span>,</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/70f28332b662c7f8b4292db9129fabd4be07f0ca" class="blame-sha">70f2833</a> <img alt="@vjeux" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/197597?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/70f28332b662c7f8b4292db9129fabd4be07f0ca" class="blame-commit-title" title="Initial version of the automatically generated docs">Initial version of the automatically generated docs</a> <div class="blame-commit-meta"> <a href="/facebook/react-native/commit/70f28332b662c7f8b4292db9129fabd4be07f0ca#comments"><span class="right octicon octicon-comment"></span></a> <a href="/vjeux" class="muted-link" rel="contributor">vjeux</a> authored <time datetime="2015-02-12T22:43:41Z" is="relative-time">Feb 12, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L214">214</td> <td class="blob-code blob-code-inner js-file-line" id="LC214"> <span class="pl-s"><span class="pl-pds">&#39;</span>../Libraries/Components/Touchable/TouchableWithoutFeedback.js<span class="pl-pds">&#39;</span></span>,</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/472c287cd3a05953020ef73cc7cd88da9982ee84" class="blame-sha">472c287</a> <img alt="@fkling" class="avatar blame-commit-avatar" height="32" src="https://avatars1.githubusercontent.com/u/179026?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/472c287cd3a05953020ef73cc7cd88da9982ee84" class="blame-commit-title" title="Update react-docgen and ignore pages with no header">Update react-docgen and ignore pages with no header</a> <div class="blame-commit-meta"> <a href="/fkling" class="muted-link" rel="contributor">fkling</a> authored <time datetime="2015-02-19T00:39:28Z" is="relative-time">Feb 18, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L215">215</td> <td class="blob-code blob-code-inner js-file-line" id="LC215"> <span class="pl-s"><span class="pl-pds">&#39;</span>../Libraries/Components/View/View.js<span class="pl-pds">&#39;</span></span>,</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/b39b97546ac0e493723d73149c6950b04c2f203c" class="blame-sha">b39b975</a> <img alt="@brentvatne" class="avatar blame-commit-avatar" height="32" src="https://avatars1.githubusercontent.com/u/90494?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/b39b97546ac0e493723d73149c6950b04c2f203c" class="blame-commit-title" title="[Docs] Add ViewPagerAndroid to extractDocs">[Docs] Add ViewPagerAndroid to extractDocs</a> <div class="blame-commit-meta"> <a href="/brentvatne" class="muted-link" rel="contributor">brentvatne</a> authored <time datetime="2015-10-17T02:25:43Z" is="relative-time">Oct 16, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="2"></td> <td class="blob-num blame-blob-num js-line-number" id="L216">216</td> <td class="blob-code blob-code-inner js-file-line" id="LC216"> <span class="pl-s"><span class="pl-pds">&#39;</span>../Libraries/Components/ViewPager/ViewPagerAndroid.android.js<span class="pl-pds">&#39;</span></span>,</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/55598f913caef4e7c8a7cd47e9ec354f6aeb2dde" class="blame-sha">55598f9</a> <img alt="@vjeux" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/197597?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/55598f913caef4e7c8a7cd47e9ec354f6aeb2dde" class="blame-commit-title" title="[website] Expose all the functions exported by react-native in the docs">[website] Expose all the functions exported by react-native in the docs</a> <div class="blame-commit-meta"> <a href="/vjeux" class="muted-link" rel="contributor">vjeux</a> authored <time datetime="2015-03-18T03:41:06Z" is="relative-time">Mar 17, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L217">217</td> <td class="blob-code blob-code-inner js-file-line" id="LC217"> <span class="pl-s"><span class="pl-pds">&#39;</span>../Libraries/Components/WebView/WebView.ios.js<span class="pl-pds">&#39;</span></span>,</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="3"> <a href="/facebook/react-native/commit/70f28332b662c7f8b4292db9129fabd4be07f0ca" class="blame-sha">70f2833</a> <img alt="@vjeux" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/197597?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/70f28332b662c7f8b4292db9129fabd4be07f0ca" class="blame-commit-title" title="Initial version of the automatically generated docs">Initial version of the automatically generated docs</a> <div class="blame-commit-meta"> <a href="/facebook/react-native/commit/70f28332b662c7f8b4292db9129fabd4be07f0ca#comments"><span class="right octicon octicon-comment"></span></a> <a href="/vjeux" class="muted-link" rel="contributor">vjeux</a> authored <time datetime="2015-02-12T22:43:41Z" is="relative-time">Feb 12, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L218">218</td> <td class="blob-code blob-code-inner js-file-line" id="LC218">];</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L219">219</td> <td class="blob-code blob-code-inner js-file-line" id="LC219"></td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/83581cfe6bf046c6d659d96cb0b25f62e0e9da00" class="blame-sha">83581cf</a> <img alt="@vjeux" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/197597?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/83581cfe6bf046c6d659d96cb0b25f62e0e9da00" class="blame-commit-title" title="Initial import of the lib to parse javascript code, in the same vein as we parse React proptypes">Initial import of the lib to parse javascript code, in the same vein …</a> <div class="blame-commit-meta"> <a href="/vjeux" class="muted-link" rel="contributor">vjeux</a> authored <time datetime="2015-03-10T20:55:54Z" is="relative-time">Mar 10, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L220">220</td> <td class="blob-code blob-code-inner js-file-line" id="LC220"><span class="pl-k">var</span> apis <span class="pl-k">=</span> [</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/13579d9dfd1b2f8876c843a9be6497cdf510ee12" class="blame-sha">13579d9</a> <img alt="@umhan35" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/3271612?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/13579d9dfd1b2f8876c843a9be6497cdf510ee12" class="blame-commit-title" title="Add ActionSheetIOS to website">Add ActionSheetIOS to website</a> <div class="blame-commit-meta"> <a href="/umhan35" class="muted-link" rel="contributor">umhan35</a> authored <time datetime="2015-06-11T03:41:21Z" is="relative-time">Jun 10, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="6"></td> <td class="blob-num blame-blob-num js-line-number" id="L221">221</td> <td class="blob-code blob-code-inner js-file-line" id="LC221"> <span class="pl-s"><span class="pl-pds">&#39;</span>../Libraries/ActionSheetIOS/ActionSheetIOS.js<span class="pl-pds">&#39;</span></span>,</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/55598f913caef4e7c8a7cd47e9ec354f6aeb2dde" class="blame-sha">55598f9</a> <img alt="@vjeux" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/197597?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/55598f913caef4e7c8a7cd47e9ec354f6aeb2dde" class="blame-commit-title" title="[website] Expose all the functions exported by react-native in the docs">[website] Expose all the functions exported by react-native in the docs</a> <div class="blame-commit-meta"> <a href="/vjeux" class="muted-link" rel="contributor">vjeux</a> authored <time datetime="2015-03-18T03:41:06Z" is="relative-time">Mar 18, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L222">222</td> <td class="blob-code blob-code-inner js-file-line" id="LC222"> <span class="pl-s"><span class="pl-pds">&#39;</span>../Libraries/Utilities/AlertIOS.js<span class="pl-pds">&#39;</span></span>,</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/00ceec9def0dff134d9fbfcb2104a64686720789" class="blame-sha">00ceec9</a> <img alt="@vjeux" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/197597?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/00ceec9def0dff134d9fbfcb2104a64686720789" class="blame-commit-title" title="Fix website with Animated Animated.js has been renamed (and moved) to AnimatedImplementation.js, so we need to update the path and add another translation rule.">Fix website with Animated</a> <div class="blame-commit-meta"> <a href="/vjeux" class="muted-link" rel="contributor">vjeux</a> authored <time datetime="2015-09-22T19:54:04Z" is="relative-time">Sep 22, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="3"></td> <td class="blob-num blame-blob-num js-line-number" id="L223">223</td> <td class="blob-code blob-code-inner js-file-line" id="LC223"> <span class="pl-s"><span class="pl-pds">&#39;</span>../Libraries/Animated/src/AnimatedImplementation.js<span class="pl-pds">&#39;</span></span>,</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="3"> <a href="/facebook/react-native/commit/28aa691d135e9fd201f86816a0a2d635361c5b64" class="blame-sha">28aa691</a> <img alt="@vjeux" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/197597?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/28aa691d135e9fd201f86816a0a2d635361c5b64" class="blame-commit-title" title="Updates from Fri 13 Mar - [ReactNative] Oss ActionSheet | <NAME> - [ReactNative] Fix ScrollView.scrollTo() | <NAME> - [catalyst|madman] fix location observer | <NAME> - [ReactNative] Remove keyboardDismissMode from static | <NAME> - [ReactNative] Fix RCTMapManager retaining cycle | <NAME> - [ReactNative] Support loading sourcemaps from sourceMappingURL | <NAME> - [catalyst] set up directory specific rql transform | <NAME> - [React Native] Add .done() to terminate promise chains | <NAME> - [React Native] add support for reading tracking bit | <NAME>">Updates from Fri 13 Mar</a> <div class="blame-commit-meta"> <a href="/vjeux" class="muted-link" rel="contributor">vjeux</a> authored <time datetime="2015-03-13T22:30:31Z" is="relative-time">Mar 13, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L224">224</td> <td class="blob-code blob-code-inner js-file-line" id="LC224"> <span class="pl-s"><span class="pl-pds">&#39;</span>../Libraries/AppRegistry/AppRegistry.js<span class="pl-pds">&#39;</span></span>,</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L225">225</td> <td class="blob-code blob-code-inner js-file-line" id="LC225"> <span class="pl-s"><span class="pl-pds">&#39;</span>../Libraries/AppStateIOS/AppStateIOS.ios.js<span class="pl-pds">&#39;</span></span>,</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/38398bc6a3e4e7d1b011769d8e143cc3077653a2" class="blame-sha">38398bc</a> <img alt="@chirag04" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/954063?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/38398bc6a3e4e7d1b011769d8e143cc3077653a2" class="blame-commit-title" title="fix website build after asyncstorage changes.">fix website build after asyncstorage changes.</a> <div class="blame-commit-meta"> <a href="/chirag04" class="muted-link" rel="contributor">chirag04</a> authored <time datetime="2015-10-27T18:10:59Z" is="relative-time">Oct 27, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="2"></td> <td class="blob-num blame-blob-num js-line-number" id="L226">226</td> <td class="blob-code blob-code-inner js-file-line" id="LC226"> <span class="pl-s"><span class="pl-pds">&#39;</span>../Libraries/Storage/AsyncStorage.js<span class="pl-pds">&#39;</span></span>,</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/42eb5464fd8a65ed84b799de5d4dc225349449be" class="blame-sha">42eb546</a> <img alt="@mkonicek" class="avatar blame-commit-avatar" height="32" src="https://avatars1.githubusercontent.com/u/346214?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/42eb5464fd8a65ed84b799de5d4dc225349449be" class="blame-commit-title" title="Release React Native for Android This is an early release and there are several things that are known not to work if you&#39;re porting your iOS app to Android. See the Known Issues guide on the website. We will work with the community to reach platform parity with iOS.">Release React Native for Android</a> <div class="blame-commit-meta"> <a href="/facebook/react-native/commit/42eb5464fd8a65ed84b799de5d4dc225349449be#comments"><span class="right octicon octicon-comment"></span></a> <a href="/mkonicek" class="muted-link" rel="contributor">mkonicek</a> authored <time datetime="2015-09-14T14:35:58Z" is="relative-time">Sep 14, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="3"></td> <td class="blob-num blame-blob-num js-line-number" id="L227">227</td> <td class="blob-code blob-code-inner js-file-line" id="LC227"> <span class="pl-s"><span class="pl-pds">&#39;</span>../Libraries/Utilities/BackAndroid.android.js<span class="pl-pds">&#39;</span></span>,</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/33bfb322ad49654db50078af101bee90a5e7f46b" class="blame-sha">33bfb32</a> <img alt="@vjeux" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/197597?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/33bfb322ad49654db50078af101bee90a5e7f46b" class="blame-commit-title" title="Wire up jsdocs for apis">Wire up jsdocs for apis</a> <div class="blame-commit-meta"> <a href="/vjeux" class="muted-link" rel="contributor">vjeux</a> authored <time datetime="2015-03-12T18:03:32Z" is="relative-time">Mar 12, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L228">228</td> <td class="blob-code blob-code-inner js-file-line" id="LC228"> <span class="pl-s"><span class="pl-pds">&#39;</span>../Libraries/CameraRoll/CameraRoll.js<span class="pl-pds">&#39;</span></span>,</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/36f015c0dd402c690c6fa14b9408d51a1502663e" class="blame-sha">36f015c</a> <img alt="@brentvatne" class="avatar blame-commit-avatar" height="32" src="https://avatars1.githubusercontent.com/u/90494?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/36f015c0dd402c690c6fa14b9408d51a1502663e" class="blame-commit-title" title="[Docs] Add Dimensions to API docs">[Docs] Add Dimensions to API docs</a> <div class="blame-commit-meta"> <a href="/brentvatne" class="muted-link" rel="contributor">brentvatne</a> authored <time datetime="2015-10-09T21:44:36Z" is="relative-time">Oct 9, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="2"></td> <td class="blob-num blame-blob-num js-line-number" id="L229">229</td> <td class="blob-code blob-code-inner js-file-line" id="LC229"> <span class="pl-s"><span class="pl-pds">&#39;</span>../Libraries/Utilities/Dimensions.js<span class="pl-pds">&#39;</span></span>,</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/55598f913caef4e7c8a7cd47e9ec354f6aeb2dde" class="blame-sha">55598f9</a> <img alt="@vjeux" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/197597?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/55598f913caef4e7c8a7cd47e9ec354f6aeb2dde" class="blame-commit-title" title="[website] Expose all the functions exported by react-native in the docs">[website] Expose all the functions exported by react-native in the docs</a> <div class="blame-commit-meta"> <a href="/vjeux" class="muted-link" rel="contributor">vjeux</a> authored <time datetime="2015-03-18T03:41:06Z" is="relative-time">Mar 18, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L230">230</td> <td class="blob-code blob-code-inner js-file-line" id="LC230"> <span class="pl-s"><span class="pl-pds">&#39;</span>../Libraries/Interaction/InteractionManager.js<span class="pl-pds">&#39;</span></span>,</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/480b5c9e2e8716355e5451395a6d3717c82f3919" class="blame-sha">480b5c9</a> <img alt="@mkonicek" class="avatar blame-commit-avatar" height="32" src="https://avatars1.githubusercontent.com/u/346214?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/480b5c9e2e8716355e5451395a6d3717c82f3919" class="blame-commit-title" title="[website] Fix website generation">[website] Fix website generation</a> <div class="blame-commit-meta"> <a href="/mkonicek" class="muted-link" rel="contributor">mkonicek</a> authored <time datetime="2015-08-25T18:23:41Z" is="relative-time">Aug 25, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="4"></td> <td class="blob-num blame-blob-num js-line-number" id="L231">231</td> <td class="blob-code blob-code-inner js-file-line" id="LC231"> <span class="pl-s"><span class="pl-pds">&#39;</span>../Libraries/LayoutAnimation/LayoutAnimation.js<span class="pl-pds">&#39;</span></span>,</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/df7d9c27f906f3e03a1e6a0b113a85ebdd775412" class="blame-sha">df7d9c2</a> <img alt="@tadeuzagallo" class="avatar blame-commit-avatar" height="32" src="https://avatars0.githubusercontent.com/u/764414?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/df7d9c27f906f3e03a1e6a0b113a85ebdd775412" class="blame-commit-title" title="[ReactNative][Docs] Add docs to LinkingIOS">[ReactNative][Docs] Add docs to LinkingIOS</a> <div class="blame-commit-meta"> <a href="/tadeuzagallo" class="muted-link" rel="contributor">tadeuzagallo</a> authored <time datetime="2015-03-26T16:32:35Z" is="relative-time">Mar 26, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L232">232</td> <td class="blob-code blob-code-inner js-file-line" id="LC232"> <span class="pl-s"><span class="pl-pds">&#39;</span>../Libraries/LinkingIOS/LinkingIOS.js<span class="pl-pds">&#39;</span></span>,</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/2d7747ecb7a21caccd30c15cd254cb2325e94b3c" class="blame-sha">2d7747e</a> <img alt="@mkonicek" class="avatar blame-commit-avatar" height="32" src="https://avatars1.githubusercontent.com/u/346214?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/2d7747ecb7a21caccd30c15cd254cb2325e94b3c" class="blame-commit-title" title="Add NativeMethodsMixin docs to website">Add NativeMethodsMixin docs to website</a> <div class="blame-commit-meta"> <a href="/facebook/react-native/commit/2d7747ecb7a21caccd30c15cd254cb2325e94b3c#comments"><span class="right octicon octicon-comment"></span></a> <a href="/mkonicek" class="muted-link" rel="contributor">mkonicek</a> authored <time datetime="2015-10-07T17:04:42Z" is="relative-time">Oct 7, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="2"></td> <td class="blob-num blame-blob-num js-line-number" id="L233">233</td> <td class="blob-code blob-code-inner js-file-line" id="LC233"> <span class="pl-s"><span class="pl-pds">&#39;</span>../Libraries/ReactIOS/NativeMethodsMixin.js<span class="pl-pds">&#39;</span></span>,</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/55598f913caef4e7c8a7cd47e9ec354f6aeb2dde" class="blame-sha">55598f9</a> <img alt="@vjeux" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/197597?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/55598f913caef4e7c8a7cd47e9ec354f6aeb2dde" class="blame-commit-title" title="[website] Expose all the functions exported by react-native in the docs">[website] Expose all the functions exported by react-native in the docs</a> <div class="blame-commit-meta"> <a href="/vjeux" class="muted-link" rel="contributor">vjeux</a> authored <time datetime="2015-03-18T03:41:06Z" is="relative-time">Mar 18, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L234">234</td> <td class="blob-code blob-code-inner js-file-line" id="LC234"> <span class="pl-s"><span class="pl-pds">&#39;</span>../Libraries/Network/NetInfo.js<span class="pl-pds">&#39;</span></span>,</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/d7d7e99c7d46c2a5019d8ff0052e614ce48a5fc4" class="blame-sha">d7d7e99</a> <img alt="@vjeux" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/197597?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/d7d7e99c7d46c2a5019d8ff0052e614ce48a5fc4" class="blame-commit-title" title="Add new files to docs">Add new files to docs</a> <div class="blame-commit-meta"> <a href="/vjeux" class="muted-link" rel="contributor">vjeux</a> authored <time datetime="2015-03-25T03:38:29Z" is="relative-time">Mar 24, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L235">235</td> <td class="blob-code blob-code-inner js-file-line" id="LC235"> <span class="pl-s"><span class="pl-pds">&#39;</span>../Libraries/vendor/react/browser/eventPlugins/PanResponder.js<span class="pl-pds">&#39;</span></span>,</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/33bfb322ad49654db50078af101bee90a5e7f46b" class="blame-sha">33bfb32</a> <img alt="@vjeux" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/197597?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/33bfb322ad49654db50078af101bee90a5e7f46b" class="blame-commit-title" title="Wire up jsdocs for apis">Wire up jsdocs for apis</a> <div class="blame-commit-meta"> <a href="/vjeux" class="muted-link" rel="contributor">vjeux</a> authored <time datetime="2015-03-12T18:03:32Z" is="relative-time">Mar 12, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L236">236</td> <td class="blob-code blob-code-inner js-file-line" id="LC236"> <span class="pl-s"><span class="pl-pds">&#39;</span>../Libraries/Utilities/PixelRatio.js<span class="pl-pds">&#39;</span></span>,</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/d7d7e99c7d46c2a5019d8ff0052e614ce48a5fc4" class="blame-sha">d7d7e99</a> <img alt="@vjeux" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/197597?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/d7d7e99c7d46c2a5019d8ff0052e614ce48a5fc4" class="blame-commit-title" title="Add new files to docs">Add new files to docs</a> <div class="blame-commit-meta"> <a href="/vjeux" class="muted-link" rel="contributor">vjeux</a> authored <time datetime="2015-03-25T03:38:29Z" is="relative-time">Mar 25, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L237">237</td> <td class="blob-code blob-code-inner js-file-line" id="LC237"> <span class="pl-s"><span class="pl-pds">&#39;</span>../Libraries/PushNotificationIOS/PushNotificationIOS.js<span class="pl-pds">&#39;</span></span>,</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="3"> <a href="/facebook/react-native/commit/33bfb322ad49654db50078af101bee90a5e7f46b" class="blame-sha">33bfb32</a> <img alt="@vjeux" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/197597?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/33bfb322ad49654db50078af101bee90a5e7f46b" class="blame-commit-title" title="Wire up jsdocs for apis">Wire up jsdocs for apis</a> <div class="blame-commit-meta"> <a href="/vjeux" class="muted-link" rel="contributor">vjeux</a> authored <time datetime="2015-03-12T18:03:32Z" is="relative-time">Mar 12, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L238">238</td> <td class="blob-code blob-code-inner js-file-line" id="LC238"> <span class="pl-s"><span class="pl-pds">&#39;</span>../Libraries/Components/StatusBar/StatusBarIOS.ios.js<span class="pl-pds">&#39;</span></span>,</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L239">239</td> <td class="blob-code blob-code-inner js-file-line" id="LC239"> <span class="pl-s"><span class="pl-pds">&#39;</span>../Libraries/StyleSheet/StyleSheet.js<span class="pl-pds">&#39;</span></span>,</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/42eb5464fd8a65ed84b799de5d4dc225349449be" class="blame-sha">42eb546</a> <img alt="@mkonicek" class="avatar blame-commit-avatar" height="32" src="https://avatars1.githubusercontent.com/u/346214?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/42eb5464fd8a65ed84b799de5d4dc225349449be" class="blame-commit-title" title="Release React Native for Android This is an early release and there are several things that are known not to work if you&#39;re porting your iOS app to Android. See the Known Issues guide on the website. We will work with the community to reach platform parity with iOS.">Release React Native for Android</a> <div class="blame-commit-meta"> <a href="/facebook/react-native/commit/42eb5464fd8a65ed84b799de5d4dc225349449be#comments"><span class="right octicon octicon-comment"></span></a> <a href="/mkonicek" class="muted-link" rel="contributor">mkonicek</a> authored <time datetime="2015-09-14T14:35:58Z" is="relative-time">Sep 14, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="3"></td> <td class="blob-num blame-blob-num js-line-number" id="L240">240</td> <td class="blob-code blob-code-inner js-file-line" id="LC240"> <span class="pl-s"><span class="pl-pds">&#39;</span>../Libraries/Components/ToastAndroid/ToastAndroid.android.js<span class="pl-pds">&#39;</span></span>,</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/55598f913caef4e7c8a7cd47e9ec354f6aeb2dde" class="blame-sha">55598f9</a> <img alt="@vjeux" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/197597?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/55598f913caef4e7c8a7cd47e9ec354f6aeb2dde" class="blame-commit-title" title="[website] Expose all the functions exported by react-native in the docs">[website] Expose all the functions exported by react-native in the docs</a> <div class="blame-commit-meta"> <a href="/vjeux" class="muted-link" rel="contributor">vjeux</a> authored <time datetime="2015-03-18T03:41:06Z" is="relative-time">Mar 18, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L241">241</td> <td class="blob-code blob-code-inner js-file-line" id="LC241"> <span class="pl-s"><span class="pl-pds">&#39;</span>../Libraries/Vibration/VibrationIOS.ios.js<span class="pl-pds">&#39;</span></span>,</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="3"> <a href="/facebook/react-native/commit/83581cfe6bf046c6d659d96cb0b25f62e0e9da00" class="blame-sha">83581cf</a> <img alt="@vjeux" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/197597?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/83581cfe6bf046c6d659d96cb0b25f62e0e9da00" class="blame-commit-title" title="Initial import of the lib to parse javascript code, in the same vein as we parse React proptypes">Initial import of the lib to parse javascript code, in the same vein …</a> <div class="blame-commit-meta"> <a href="/vjeux" class="muted-link" rel="contributor">vjeux</a> authored <time datetime="2015-03-10T20:55:54Z" is="relative-time">Mar 10, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L242">242</td> <td class="blob-code blob-code-inner js-file-line" id="LC242">];</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L243">243</td> <td class="blob-code blob-code-inner js-file-line" id="LC243"></td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="3"> <a href="/facebook/react-native/commit/d5f670d19cde39aaa5064e9c12a2731feaaa8566" class="blame-sha">d5f670d</a> <img alt="@fkling" class="avatar blame-commit-avatar" height="32" src="https://avatars1.githubusercontent.com/u/179026?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/d5f670d19cde39aaa5064e9c12a2731feaaa8566" class="blame-commit-title" title="Add logic to show style props in docs">Add logic to show style props in docs</a> <div class="blame-commit-meta"> <a href="/fkling" class="muted-link" rel="contributor">fkling</a> authored <time datetime="2015-03-19T21:05:07Z" is="relative-time">Mar 19, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L244">244</td> <td class="blob-code blob-code-inner js-file-line" id="LC244"><span class="pl-k">var</span> styles <span class="pl-k">=</span> [</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L245">245</td> <td class="blob-code blob-code-inner js-file-line" id="LC245"> <span class="pl-s"><span class="pl-pds">&#39;</span>../Libraries/StyleSheet/LayoutPropTypes.js<span class="pl-pds">&#39;</span></span>,</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/b8ca4e450b2fdff5eed68dbb3e1b4ca00b7d4a9c" class="blame-sha">b8ca4e4</a> <img alt="@brentvatne" class="avatar blame-commit-avatar" height="32" src="https://avatars1.githubusercontent.com/u/90494?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/b8ca4e450b2fdff5eed68dbb3e1b4ca00b7d4a9c" class="blame-commit-title" title="Add TransformPropTypes to docs">Add TransformPropTypes to docs</a> <div class="blame-commit-meta"> <a href="/brentvatne" class="muted-link" rel="contributor">brentvatne</a> authored <time datetime="2015-05-07T19:16:48Z" is="relative-time">May 7, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L246">246</td> <td class="blob-code blob-code-inner js-file-line" id="LC246"> <span class="pl-s"><span class="pl-pds">&#39;</span>../Libraries/StyleSheet/TransformPropTypes.js<span class="pl-pds">&#39;</span></span>,</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="6"> <a href="/facebook/react-native/commit/d5f670d19cde39aaa5064e9c12a2731feaaa8566" class="blame-sha">d5f670d</a> <img alt="@fkling" class="avatar blame-commit-avatar" height="32" src="https://avatars1.githubusercontent.com/u/179026?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/d5f670d19cde39aaa5064e9c12a2731feaaa8566" class="blame-commit-title" title="Add logic to show style props in docs">Add logic to show style props in docs</a> <div class="blame-commit-meta"> <a href="/fkling" class="muted-link" rel="contributor">fkling</a> authored <time datetime="2015-03-19T21:05:07Z" is="relative-time">Mar 19, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L247">247</td> <td class="blob-code blob-code-inner js-file-line" id="LC247"> <span class="pl-s"><span class="pl-pds">&#39;</span>../Libraries/Components/View/ViewStylePropTypes.js<span class="pl-pds">&#39;</span></span>,</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L248">248</td> <td class="blob-code blob-code-inner js-file-line" id="LC248"> <span class="pl-s"><span class="pl-pds">&#39;</span>../Libraries/Text/TextStylePropTypes.js<span class="pl-pds">&#39;</span></span>,</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L249">249</td> <td class="blob-code blob-code-inner js-file-line" id="LC249"> <span class="pl-s"><span class="pl-pds">&#39;</span>../Libraries/Image/ImageStylePropTypes.js<span class="pl-pds">&#39;</span></span>,</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L250">250</td> <td class="blob-code blob-code-inner js-file-line" id="LC250">];</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L251">251</td> <td class="blob-code blob-code-inner js-file-line" id="LC251"></td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/4681da54205b3c2e682850c4b5b5fcb655a296c4" class="blame-sha">4681da5</a> <img alt="@vjeux" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/197597?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/4681da54205b3c2e682850c4b5b5fcb655a296c4" class="blame-commit-title" title="Add geolocation polyfill">Add geolocation polyfill</a> <div class="blame-commit-meta"> <a href="/vjeux" class="muted-link" rel="contributor">vjeux</a> authored <time datetime="2015-03-25T04:13:55Z" is="relative-time">Mar 25, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L252">252</td> <td class="blob-code blob-code-inner js-file-line" id="LC252"><span class="pl-k">var</span> polyfills <span class="pl-k">=</span> [</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/846585941159785a3a685db152001d849d60bc75" class="blame-sha">8465859</a> <img alt="@sahrens" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/1509831?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/846585941159785a3a685db152001d849d60bc75" class="blame-commit-title" title="Fix doc generation for Geolocation">Fix doc generation for Geolocation</a> <div class="blame-commit-meta"> <a href="/sahrens" class="muted-link" rel="contributor">sahrens</a> authored <time datetime="2015-04-24T20:14:24Z" is="relative-time">Apr 24, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L253">253</td> <td class="blob-code blob-code-inner js-file-line" id="LC253"> <span class="pl-s"><span class="pl-pds">&#39;</span>../Libraries/GeoLocation/Geolocation.js<span class="pl-pds">&#39;</span></span>,</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="5"> <a href="/facebook/react-native/commit/4681da54205b3c2e682850c4b5b5fcb655a296c4" class="blame-sha">4681da5</a> <img alt="@vjeux" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/197597?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/4681da54205b3c2e682850c4b5b5fcb655a296c4" class="blame-commit-title" title="Add geolocation polyfill">Add geolocation polyfill</a> <div class="blame-commit-meta"> <a href="/vjeux" class="muted-link" rel="contributor">vjeux</a> authored <time datetime="2015-03-25T04:13:55Z" is="relative-time">Mar 25, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L254">254</td> <td class="blob-code blob-code-inner js-file-line" id="LC254">];</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L255">255</td> <td class="blob-code blob-code-inner js-file-line" id="LC255"></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L256">256</td> <td class="blob-code blob-code-inner js-file-line" id="LC256"><span class="pl-k">var</span> all <span class="pl-k">=</span> components</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L257">257</td> <td class="blob-code blob-code-inner js-file-line" id="LC257"> .<span class="pl-c1">concat</span>(apis)</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/b8ca4e450b2fdff5eed68dbb3e1b4ca00b7d4a9c" class="blame-sha">b8ca4e4</a> <img alt="@brentvatne" class="avatar blame-commit-avatar" height="32" src="https://avatars1.githubusercontent.com/u/90494?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/b8ca4e450b2fdff5eed68dbb3e1b4ca00b7d4a9c" class="blame-commit-title" title="Add TransformPropTypes to docs">Add TransformPropTypes to docs</a> <div class="blame-commit-meta"> <a href="/brentvatne" class="muted-link" rel="contributor">brentvatne</a> authored <time datetime="2015-05-07T19:16:48Z" is="relative-time">May 7, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L258">258</td> <td class="blob-code blob-code-inner js-file-line" id="LC258"> .<span class="pl-c1">concat</span>(<span class="pl-smi">styles</span>.<span class="pl-c1">slice</span>(<span class="pl-c1">0</span>, <span class="pl-c1">2</span>))</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="3"> <a href="/facebook/react-native/commit/4681da54205b3c2e682850c4b5b5fcb655a296c4" class="blame-sha">4681da5</a> <img alt="@vjeux" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/197597?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/4681da54205b3c2e682850c4b5b5fcb655a296c4" class="blame-commit-title" title="Add geolocation polyfill">Add geolocation polyfill</a> <div class="blame-commit-meta"> <a href="/vjeux" class="muted-link" rel="contributor">vjeux</a> authored <time datetime="2015-03-25T04:13:55Z" is="relative-time">Mar 25, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L259">259</td> <td class="blob-code blob-code-inner js-file-line" id="LC259"> .<span class="pl-c1">concat</span>(polyfills);</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L260">260</td> <td class="blob-code blob-code-inner js-file-line" id="LC260"></td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/b8ca4e450b2fdff5eed68dbb3e1b4ca00b7d4a9c" class="blame-sha">b8ca4e4</a> <img alt="@brentvatne" class="avatar blame-commit-avatar" height="32" src="https://avatars1.githubusercontent.com/u/90494?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/b8ca4e450b2fdff5eed68dbb3e1b4ca00b7d4a9c" class="blame-commit-title" title="Add TransformPropTypes to docs">Add TransformPropTypes to docs</a> <div class="blame-commit-meta"> <a href="/brentvatne" class="muted-link" rel="contributor">brentvatne</a> authored <time datetime="2015-05-07T19:16:48Z" is="relative-time">May 7, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L261">261</td> <td class="blob-code blob-code-inner js-file-line" id="LC261"><span class="pl-k">var</span> styleDocs <span class="pl-k">=</span> <span class="pl-smi">styles</span>.<span class="pl-c1">slice</span>(<span class="pl-c1">2</span>).<span class="pl-en">reduce</span>(<span class="pl-k">function</span>(<span class="pl-smi">docs</span>, <span class="pl-smi">filepath</span>) {</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="5"> <a href="/facebook/react-native/commit/d5f670d19cde39aaa5064e9c12a2731feaaa8566" class="blame-sha">d5f670d</a> <img alt="@fkling" class="avatar blame-commit-avatar" height="32" src="https://avatars1.githubusercontent.com/u/179026?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/d5f670d19cde39aaa5064e9c12a2731feaaa8566" class="blame-commit-title" title="Add logic to show style props in docs">Add logic to show style props in docs</a> <div class="blame-commit-meta"> <a href="/fkling" class="muted-link" rel="contributor">fkling</a> authored <time datetime="2015-03-19T21:05:07Z" is="relative-time">Mar 19, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L262">262</td> <td class="blob-code blob-code-inner js-file-line" id="LC262"> docs[<span class="pl-smi">path</span>.<span class="pl-en">basename</span>(filepath).<span class="pl-c1">replace</span>(<span class="pl-smi">path</span>.<span class="pl-en">extname</span>(filepath), <span class="pl-s"><span class="pl-pds">&#39;</span><span class="pl-pds">&#39;</span></span>)] <span class="pl-k">=</span></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L263">263</td> <td class="blob-code blob-code-inner js-file-line" id="LC263"> <span class="pl-smi">docgen</span>.<span class="pl-c1">parse</span>(</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L264">264</td> <td class="blob-code blob-code-inner js-file-line" id="LC264"> <span class="pl-smi">fs</span>.<span class="pl-en">readFileSync</span>(filepath),</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L265">265</td> <td class="blob-code blob-code-inner js-file-line" id="LC265"> <span class="pl-smi">docgenHelpers</span>.<span class="pl-smi">findExportedObject</span>,</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/627d5a8e7e33673b675a04bcd6d4b0ce34144f45" class="blame-sha">627d5a8</a> <img alt="@browniefed" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/1714673?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/627d5a8e7e33673b675a04bcd6d4b0ce34144f45" class="blame-commit-title" title="Fix documentation by adding propTypeCompositionHandler">Fix documentation by adding propTypeCompositionHandler</a> <div class="blame-commit-meta"> <a href="/browniefed" class="muted-link" rel="contributor">browniefed</a> authored <time datetime="2015-09-12T16:53:01Z" is="relative-time">Sep 12, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="3"></td> <td class="blob-num blame-blob-num js-line-number" id="L266">266</td> <td class="blob-code blob-code-inner js-file-line" id="LC266"> [<span class="pl-smi">docgen</span>.<span class="pl-smi">handlers</span>.<span class="pl-smi">propTypeHandler</span>, <span class="pl-smi">docgen</span>.<span class="pl-smi">handlers</span>.<span class="pl-smi">propTypeCompositionHandler</span>]</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/d5f670d19cde39aaa5064e9c12a2731feaaa8566" class="blame-sha">d5f670d</a> <img alt="@fkling" class="avatar blame-commit-avatar" height="32" src="https://avatars1.githubusercontent.com/u/179026?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/d5f670d19cde39aaa5064e9c12a2731feaaa8566" class="blame-commit-title" title="Add logic to show style props in docs">Add logic to show style props in docs</a> <div class="blame-commit-meta"> <a href="/fkling" class="muted-link" rel="contributor">fkling</a> authored <time datetime="2015-03-19T21:05:07Z" is="relative-time">Mar 19, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L267">267</td> <td class="blob-code blob-code-inner js-file-line" id="LC267"> );</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/77a3190606ea6fdf22f3de70567e50b9456ed22f" class="blame-sha">77a3190</a> <img alt="@brentvatne" class="avatar blame-commit-avatar" height="32" src="https://avatars1.githubusercontent.com/u/90494?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/77a3190606ea6fdf22f3de70567e50b9456ed22f" class="blame-commit-title" title="[Docs] Remove deprecated styleProps - rotation, scaleX/Y, translateX/Y all belong under transform from ViewStylePropTypes">[Docs] Remove deprecated styleProps</a> <div class="blame-commit-meta"> <a href="/brentvatne" class="muted-link" rel="contributor">brentvatne</a> authored <time datetime="2015-05-05T22:27:43Z" is="relative-time">May 5, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L268">268</td> <td class="blob-code blob-code-inner js-file-line" id="LC268"></td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="3"> <a href="/facebook/react-native/commit/d5f670d19cde39aaa5064e9c12a2731feaaa8566" class="blame-sha">d5f670d</a> <img alt="@fkling" class="avatar blame-commit-avatar" height="32" src="https://avatars1.githubusercontent.com/u/179026?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/d5f670d19cde39aaa5064e9c12a2731feaaa8566" class="blame-commit-title" title="Add logic to show style props in docs">Add logic to show style props in docs</a> <div class="blame-commit-meta"> <a href="/fkling" class="muted-link" rel="contributor">fkling</a> authored <time datetime="2015-03-19T21:05:07Z" is="relative-time">Mar 19, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L269">269</td> <td class="blob-code blob-code-inner js-file-line" id="LC269"> <span class="pl-k">return</span> docs;</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L270">270</td> <td class="blob-code blob-code-inner js-file-line" id="LC270">}, {});</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/33bfb322ad49654db50078af101bee90a5e7f46b" class="blame-sha">33bfb32</a> <img alt="@vjeux" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/197597?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/33bfb322ad49654db50078af101bee90a5e7f46b" class="blame-commit-title" title="Wire up jsdocs for apis">Wire up jsdocs for apis</a> <div class="blame-commit-meta"> <a href="/vjeux" class="muted-link" rel="contributor">vjeux</a> authored <time datetime="2015-03-12T18:03:32Z" is="relative-time">Mar 12, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L271">271</td> <td class="blob-code blob-code-inner js-file-line" id="LC271"></td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/70f28332b662c7f8b4292db9129fabd4be07f0ca" class="blame-sha">70f2833</a> <img alt="@vjeux" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/197597?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/70f28332b662c7f8b4292db9129fabd4be07f0ca" class="blame-commit-title" title="Initial version of the automatically generated docs">Initial version of the automatically generated docs</a> <div class="blame-commit-meta"> <a href="/facebook/react-native/commit/70f28332b662c7f8b4292db9129fabd4be07f0ca#comments"><span class="right octicon octicon-comment"></span></a> <a href="/vjeux" class="muted-link" rel="contributor">vjeux</a> authored <time datetime="2015-02-12T22:43:41Z" is="relative-time">Feb 12, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L272">272</td> <td class="blob-code blob-code-inner js-file-line" id="LC272"><span class="pl-c1">module</span>.<span class="pl-en">exports</span> <span class="pl-k">=</span> <span class="pl-k">function</span>() {</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/4681da54205b3c2e682850c4b5b5fcb655a296c4" class="blame-sha">4681da5</a> <img alt="@vjeux" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/197597?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/4681da54205b3c2e682850c4b5b5fcb655a296c4" class="blame-commit-title" title="Add geolocation polyfill">Add geolocation polyfill</a> <div class="blame-commit-meta"> <a href="/vjeux" class="muted-link" rel="contributor">vjeux</a> authored <time datetime="2015-03-25T04:13:55Z" is="relative-time">Mar 25, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L273">273</td> <td class="blob-code blob-code-inner js-file-line" id="LC273"> n <span class="pl-k">=</span> <span class="pl-c1">0</span>;</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/33bfb322ad49654db50078af101bee90a5e7f46b" class="blame-sha">33bfb32</a> <img alt="@vjeux" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/197597?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/33bfb322ad49654db50078af101bee90a5e7f46b" class="blame-commit-title" title="Wire up jsdocs for apis">Wire up jsdocs for apis</a> <div class="blame-commit-meta"> <a href="/vjeux" class="muted-link" rel="contributor">vjeux</a> authored <time datetime="2015-03-12T18:03:32Z" is="relative-time">Mar 12, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L274">274</td> <td class="blob-code blob-code-inner js-file-line" id="LC274"> <span class="pl-k">return</span> [].<span class="pl-c1">concat</span>(</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="3"> <a href="/facebook/react-native/commit/4681da54205b3c2e682850c4b5b5fcb655a296c4" class="blame-sha">4681da5</a> <img alt="@vjeux" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/197597?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/4681da54205b3c2e682850c4b5b5fcb655a296c4" class="blame-commit-title" title="Add geolocation polyfill">Add geolocation polyfill</a> <div class="blame-commit-meta"> <a href="/vjeux" class="muted-link" rel="contributor">vjeux</a> authored <time datetime="2015-03-25T04:13:55Z" is="relative-time">Mar 25, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L275">275</td> <td class="blob-code blob-code-inner js-file-line" id="LC275"> <span class="pl-smi">components</span>.<span class="pl-en">map</span>(renderComponent),</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L276">276</td> <td class="blob-code blob-code-inner js-file-line" id="LC276"> <span class="pl-smi">apis</span>.<span class="pl-en">map</span>(<span class="pl-en">renderAPI</span>(<span class="pl-s"><span class="pl-pds">&#39;</span>api<span class="pl-pds">&#39;</span></span>)),</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/b8ca4e450b2fdff5eed68dbb3e1b4ca00b7d4a9c" class="blame-sha">b8ca4e4</a> <img alt="@brentvatne" class="avatar blame-commit-avatar" height="32" src="https://avatars1.githubusercontent.com/u/90494?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/b8ca4e450b2fdff5eed68dbb3e1b4ca00b7d4a9c" class="blame-commit-title" title="Add TransformPropTypes to docs">Add TransformPropTypes to docs</a> <div class="blame-commit-meta"> <a href="/brentvatne" class="muted-link" rel="contributor">brentvatne</a> authored <time datetime="2015-05-07T19:16:48Z" is="relative-time">May 7, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L277">277</td> <td class="blob-code blob-code-inner js-file-line" id="LC277"> <span class="pl-smi">styles</span>.<span class="pl-c1">slice</span>(<span class="pl-c1">0</span>, <span class="pl-c1">2</span>).<span class="pl-en">map</span>(renderStyle),</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/4681da54205b3c2e682850c4b5b5fcb655a296c4" class="blame-sha">4681da5</a> <img alt="@vjeux" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/197597?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/4681da54205b3c2e682850c4b5b5fcb655a296c4" class="blame-commit-title" title="Add geolocation polyfill">Add geolocation polyfill</a> <div class="blame-commit-meta"> <a href="/vjeux" class="muted-link" rel="contributor">vjeux</a> authored <time datetime="2015-03-25T04:13:55Z" is="relative-time">Mar 25, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L278">278</td> <td class="blob-code blob-code-inner js-file-line" id="LC278"> <span class="pl-smi">polyfills</span>.<span class="pl-en">map</span>(<span class="pl-en">renderAPI</span>(<span class="pl-s"><span class="pl-pds">&#39;</span>Polyfill<span class="pl-pds">&#39;</span></span>))</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/33bfb322ad49654db50078af101bee90a5e7f46b" class="blame-sha">33bfb32</a> <img alt="@vjeux" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/197597?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/33bfb322ad49654db50078af101bee90a5e7f46b" class="blame-commit-title" title="Wire up jsdocs for apis">Wire up jsdocs for apis</a> <div class="blame-commit-meta"> <a href="/vjeux" class="muted-link" rel="contributor">vjeux</a> authored <time datetime="2015-03-12T18:03:32Z" is="relative-time">Mar 12, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L279">279</td> <td class="blob-code blob-code-inner js-file-line" id="LC279"> );</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/70f28332b662c7f8b4292db9129fabd4be07f0ca" class="blame-sha">70f2833</a> <img alt="@vjeux" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/197597?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/70f28332b662c7f8b4292db9129fabd4be07f0ca" class="blame-commit-title" title="Initial version of the automatically generated docs">Initial version of the automatically generated docs</a> <div class="blame-commit-meta"> <a href="/facebook/react-native/commit/70f28332b662c7f8b4292db9129fabd4be07f0ca#comments"><span class="right octicon octicon-comment"></span></a> <a href="/vjeux" class="muted-link" rel="contributor">vjeux</a> authored <time datetime="2015-02-12T22:43:41Z" is="relative-time">Feb 12, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L280">280</td> <td class="blob-code blob-code-inner js-file-line" id="LC280">};</td> </tr> </table> </div> </div> </div> <div class="modal-backdrop"></div> </div> </div> </div> </div> <div class="container"> <div class="site-footer" role="contentinfo"> <ul class="site-footer-links right"> <li><a href="https://status.github.com/" data-ga-click="Footer, go to status, text:status">Status</a></li> <li><a href="https://developer.github.com" data-ga-click="Footer, go to api, text:api">API</a></li> <li><a href="https://training.github.com" data-ga-click="Footer, go to training, text:training">Training</a></li> <li><a href="https://shop.github.com" data-ga-click="Footer, go to shop, text:shop">Shop</a></li> <li><a href="https://github.com/blog" data-ga-click="Footer, go to blog, text:blog">Blog</a></li> <li><a href="https://github.com/about" data-ga-click="Footer, go to about, text:about">About</a></li> <li><a href="https://github.com/pricing" data-ga-click="Footer, go to pricing, text:pricing">Pricing</a></li> </ul> <a href="https://github.com" aria-label="Homepage"> <span class="mega-octicon octicon-mark-github" title="GitHub"></span> </a> <ul class="site-footer-links"> <li>&copy; 2015 <span title="0.10132s from github-fe135-cp1-prd.iad.github.net">GitHub</span>, Inc.</li> <li><a href="https://github.com/site/terms" data-ga-click="Footer, go to terms, text:terms">Terms</a></li> <li><a href="https://github.com/site/privacy" data-ga-click="Footer, go to privacy, text:privacy">Privacy</a></li> <li><a href="https://github.com/security" data-ga-click="Footer, go to security, text:security">Security</a></li> <li><a href="https://github.com/contact" data-ga-click="Footer, go to contact, text:contact">Contact</a></li> <li><a href="https://help.github.com" data-ga-click="Footer, go to help, text:help">Help</a></li> </ul> </div> </div> <div id="ajax-error-message" class="flash flash-error"> <span class="octicon octicon-alert"></span> <button type="button" class="flash-close js-flash-close js-ajax-error-dismiss" aria-label="Dismiss error"> <span class="octicon octicon-x"></span> </button> Something went wrong with that request. Please try again. </div> <script crossorigin="anonymous" src="https://assets-cdn.github.com/assets/frameworks-ca4183ce112a8e8984270469e316f4700bbe45a08e1545d359a2df9ba18a85b6.js"></script> <script async="async" crossorigin="anonymous" src="https://assets-cdn.github.com/assets/github-07413b5e0147434fe39f7f96545ef359ef45ca5051a44ec3b8e8d410a4a47988.js"></script> <div class="js-stale-session-flash stale-session-flash flash flash-warn flash-banner hidden"> <span class="octicon octicon-alert"></span> <span class="signed-in-tab-flash">You signed in with another tab or window. <a href="">Reload</a> to refresh your session.</span> <span class="signed-out-tab-flash">You signed out in another tab or window. <a href="">Reload</a> to refresh your session.</span> </div> </body> </html> <|start_filename|>cache/https---github.com-facebook-react-native-blame-master-Libraries-ReactIOS-NativeMethodsMixin.js<|end_filename|> <!DOCTYPE html> <html lang="en" class=""> <head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# object: http://ogp.me/ns/object# article: http://ogp.me/ns/article# profile: http://ogp.me/ns/profile#"> <meta charset='utf-8'> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="Content-Language" content="en"> <meta name="viewport" content="width=1020"> <title>react-native/Libraries/ReactIOS/NativeMethodsMixin.js at master · facebook/react-native · GitHub</title> <link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="GitHub"> <link rel="fluid-icon" href="https://github.com/fluidicon.png" title="GitHub"> <link rel="apple-touch-icon" sizes="57x57" href="/apple-touch-icon-114.png"> <link rel="apple-touch-icon" sizes="114x114" href="/apple-touch-icon-114.png"> <link rel="apple-touch-icon" sizes="72x72" href="/apple-touch-icon-144.png"> <link rel="apple-touch-icon" sizes="144x144" href="/apple-touch-icon-144.png"> <meta property="fb:app_id" content="1401488693436528"> <meta content="@github" name="twitter:site" /><meta content="summary" name="twitter:card" /><meta content="facebook/react-native" name="twitter:title" /><meta content="react-native - A framework for building native apps with React." name="twitter:description" /><meta content="https://avatars2.githubusercontent.com/u/69631?v=3&amp;s=400" name="twitter:image:src" /> <meta content="GitHub" property="og:site_name" /><meta content="object" property="og:type" /><meta content="https://avatars2.githubusercontent.com/u/69631?v=3&amp;s=400" property="og:image" /><meta content="facebook/react-native" property="og:title" /><meta content="https://github.com/facebook/react-native" property="og:url" /><meta content="react-native - A framework for building native apps with React." property="og:description" /> <meta name="browser-stats-url" content="https://api.github.com/_private/browser/stats"> <meta name="browser-errors-url" content="https://api.github.com/_private/browser/errors"> <link rel="assets" href="https://assets-cdn.github.com/"> <meta name="pjax-timeout" content="1000"> <meta name="msapplication-TileImage" content="/windows-tile.png"> <meta name="msapplication-TileColor" content="#ffffff"> <meta name="selected-link" value="repo_source" data-pjax-transient> <meta name="google-site-verification" content="KT5gs8h0wvaagLKAVWq8bbeNwnZZK1r1XQysX3xurLU"> <meta name="google-analytics" content="UA-3769691-2"> <meta content="collector.githubapp.com" name="octolytics-host" /><meta content="github" name="octolytics-app-id" /><meta content="A2E429B6:26AB:140741C4:565DFBC6" name="octolytics-dimension-request_id" /> <meta content="/&lt;user-name&gt;/&lt;repo-name&gt;/blob/blame" data-pjax-transient="true" name="analytics-location" /> <meta content="Rails, view, blob#blame" data-pjax-transient="true" name="analytics-event" /> <meta class="js-ga-set" name="dimension1" content="Logged Out"> <meta class="js-ga-set" name="dimension4" content="New repo nav"> <meta name="is-dotcom" content="true"> <meta name="hostname" content="github.com"> <meta name="user-login" content=""> <link rel="mask-icon" href="https://assets-cdn.github.com/pinned-octocat.svg" color="#4078c0"> <link rel="icon" type="image/x-icon" href="https://assets-cdn.github.com/favicon.ico"> <meta content="bd526cada6815af38b2286a4f5fef38fad17b9d8" name="form-nonce" /> <link crossorigin="anonymous" href="https://assets-cdn.github.com/assets/github-5e2d1232bc97970f293f259bcb6ab137945cb5635b398c2a81027bf21f0255c8.css" media="all" rel="stylesheet" /> <link crossorigin="anonymous" href="https://assets-cdn.github.com/assets/github2-bcce22057877160838a39c51a6270cf95fb927fc317253965cdbc182f32be960.css" media="all" rel="stylesheet" /> <meta http-equiv="x-pjax-version" content="3cf195f8aa0cc4097aecade8ff90cc36"> <meta name="description" content="react-native - A framework for building native apps with React."> <meta name="go-import" content="github.com/facebook/react-native git https://github.com/facebook/react-native.git"> <meta content="69631" name="octolytics-dimension-user_id" /><meta content="facebook" name="octolytics-dimension-user_login" /><meta content="29028775" name="octolytics-dimension-repository_id" /><meta content="facebook/react-native" name="octolytics-dimension-repository_nwo" /><meta content="true" name="octolytics-dimension-repository_public" /><meta content="false" name="octolytics-dimension-repository_is_fork" /><meta content="29028775" name="octolytics-dimension-repository_network_root_id" /><meta content="facebook/react-native" name="octolytics-dimension-repository_network_root_nwo" /> <link href="https://github.com/facebook/react-native/commits/master.atom" rel="alternate" title="Recent Commits to react-native:master" type="application/atom+xml"> </head> <body class="logged_out env-production vis-public"> <a href="#start-of-content" tabindex="1" class="accessibility-aid js-skip-to-content">Skip to content</a> <div class="header header-logged-out" role="banner"> <div class="container clearfix"> <a class="header-logo-wordmark" href="https://github.com/" data-ga-click="(Logged out) Header, go to homepage, icon:logo-wordmark"> <span class="mega-octicon octicon-logo-github"></span> </a> <div class="header-actions" role="navigation"> <a class="btn btn-primary" href="/join" data-ga-click="(Logged out) Header, clicked Sign up, text:sign-up">Sign up</a> <a class="btn" href="/login?return_to=%2Ffacebook%2Freact-native%2Fblame%2Fmaster%2FLibraries%2FReactIOS%2FNativeMethodsMixin.js" data-ga-click="(Logged out) Header, clicked Sign in, text:sign-in">Sign in</a> </div> <div class="site-search repo-scope js-site-search" role="search"> <!-- </textarea> --><!-- '"` --><form accept-charset="UTF-8" action="/facebook/react-native/search" class="js-site-search-form" data-global-search-url="/search" data-repo-search-url="/facebook/react-native/search" method="get"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="&#x2713;" /></div> <label class="js-chromeless-input-container form-control"> <div class="scope-badge">This repository</div> <input type="text" class="js-site-search-focus js-site-search-field is-clearable chromeless-input" data-hotkey="s" name="q" placeholder="Search" aria-label="Search this repository" data-global-scope-placeholder="Search GitHub" data-repo-scope-placeholder="Search" tabindex="1" autocapitalize="off"> </label> </form> </div> <ul class="header-nav left" role="navigation"> <li class="header-nav-item"> <a class="header-nav-link" href="/explore" data-ga-click="(Logged out) Header, go to explore, text:explore">Explore</a> </li> <li class="header-nav-item"> <a class="header-nav-link" href="/features" data-ga-click="(Logged out) Header, go to features, text:features">Features</a> </li> <li class="header-nav-item"> <a class="header-nav-link" href="https://enterprise.github.com/" data-ga-click="(Logged out) Header, go to enterprise, text:enterprise">Enterprise</a> </li> <li class="header-nav-item"> <a class="header-nav-link" href="/pricing" data-ga-click="(Logged out) Header, go to pricing, text:pricing">Pricing</a> </li> </ul> </div> </div> <div id="start-of-content" class="accessibility-aid"></div> <div id="js-flash-container"> </div> <div role="main" class="main-content"> <div itemscope itemtype="http://schema.org/WebPage"> <div id="js-repo-pjax-container" class="context-loader-container js-repo-nav-next" data-pjax-container> <div class="pagehead repohead instapaper_ignore readability-menu experiment-repo-nav"> <div class="container repohead-details-container"> <ul class="pagehead-actions"> <li> <a href="/login?return_to=%2Ffacebook%2Freact-native" class="btn btn-sm btn-with-count tooltipped tooltipped-n" aria-label="You must be signed in to watch a repository" rel="nofollow"> <span class="octicon octicon-eye"></span> Watch </a> <a class="social-count" href="/facebook/react-native/watchers"> 1,621 </a> </li> <li> <a href="/login?return_to=%2Ffacebook%2Freact-native" class="btn btn-sm btn-with-count tooltipped tooltipped-n" aria-label="You must be signed in to star a repository" rel="nofollow"> <span class="octicon octicon-star"></span> Star </a> <a class="social-count js-social-count" href="/facebook/react-native/stargazers"> 23,212 </a> </li> <li> <a href="/login?return_to=%2Ffacebook%2Freact-native" class="btn btn-sm btn-with-count tooltipped tooltipped-n" aria-label="You must be signed in to fork a repository" rel="nofollow"> <span class="octicon octicon-repo-forked"></span> Fork </a> <a href="/facebook/react-native/network" class="social-count"> 3,760 </a> </li> </ul> <h1 itemscope itemtype="http://data-vocabulary.org/Breadcrumb" class="entry-title public "> <span class="octicon octicon-repo"></span> <span class="author"><a href="/facebook" class="url fn" itemprop="url" rel="author"><span itemprop="title">facebook</span></a></span><!-- --><span class="path-divider">/</span><!-- --><strong><a href="/facebook/react-native" data-pjax="#js-repo-pjax-container">react-native</a></strong> <span class="page-context-loader"> <img alt="" height="16" src="https://assets-cdn.github.com/images/spinners/octocat-spinner-32.gif" width="16" /> </span> </h1> </div> <div class="container"> <nav class="reponav js-repo-nav js-sidenav-container-pjax js-octicon-loaders" role="navigation" data-pjax="#js-repo-pjax-container" data-issue-count-url="/facebook/react-native/issues/counts"> <a href="/facebook/react-native" aria-label="Code" aria-selected="true" class="js-selected-navigation-item selected reponav-item" data-hotkey="g c" data-selected-links="repo_source repo_downloads repo_commits repo_releases repo_tags repo_branches /facebook/react-native"> <span class="octicon octicon-code"></span> Code </a> <a href="/facebook/react-native/issues" class="js-selected-navigation-item reponav-item" data-hotkey="g i" data-selected-links="repo_issues repo_labels repo_milestones /facebook/react-native/issues"> <span class="octicon octicon-issue-opened"></span> Issues <span class="counter">853</span> </a> <a href="/facebook/react-native/pulls" class="js-selected-navigation-item reponav-item" data-hotkey="g p" data-selected-links="repo_pulls /facebook/react-native/pulls"> <span class="octicon octicon-git-pull-request"></span> Pull requests <span class="counter">189</span> </a> <a href="/facebook/react-native/pulse" class="js-selected-navigation-item reponav-item" data-selected-links="pulse /facebook/react-native/pulse"> <span class="octicon octicon-pulse"></span> Pulse </a> <a href="/facebook/react-native/graphs" class="js-selected-navigation-item reponav-item" data-selected-links="repo_graphs repo_contributors /facebook/react-native/graphs"> <span class="octicon octicon-graph"></span> Graphs </a> </nav> </div> </div> <div class="container repo-container new-discussion-timeline experiment-repo-nav"> <div class="repository-content"> <a href="/facebook/react-native/blame/b0e39d26aecce2b5aa33888ca3172205a879ed98/Libraries/ReactIOS/NativeMethodsMixin.js" class="hidden js-permalink-shortcut" data-hotkey="y">Permalink</a> <div class="breadcrumb css-truncate blame-breadcrumb js-zeroclipboard-container"> <span class="css-truncate-target js-zeroclipboard-target"><span class="repo-root js-repo-root"><span itemscope="" itemtype="http://data-vocabulary.org/Breadcrumb"><a href="/facebook/react-native" class="" data-branch="master" data-pjax="true" itemscope="url"><span itemprop="title">react-native</span></a></span></span><span class="separator">/</span><span itemscope="" itemtype="http://data-vocabulary.org/Breadcrumb"><a href="/facebook/react-native/tree/master/Libraries" class="" data-branch="master" data-pjax="true" itemscope="url"><span itemprop="title">Libraries</span></a></span><span class="separator">/</span><span itemscope="" itemtype="http://data-vocabulary.org/Breadcrumb"><a href="/facebook/react-native/tree/master/Libraries/ReactIOS" class="" data-branch="master" data-pjax="true" itemscope="url"><span itemprop="title">ReactIOS</span></a></span><span class="separator">/</span><strong class="final-path">NativeMethodsMixin.js</strong></span> <button aria-label="Copy file path to clipboard" class="js-zeroclipboard btn btn-sm zeroclipboard-button tooltipped tooltipped-s" data-copied-hint="Copied!" type="button"><span class="octicon octicon-clippy"></span></button> </div> <div class="line-age-legend"> <span>Newer</span> <ol> <li class="heat" data-heat="1"></li> <li class="heat" data-heat="2"></li> <li class="heat" data-heat="3"></li> <li class="heat" data-heat="4"></li> <li class="heat" data-heat="5"></li> <li class="heat" data-heat="6"></li> <li class="heat" data-heat="7"></li> <li class="heat" data-heat="8"></li> <li class="heat" data-heat="9"></li> <li class="heat" data-heat="10"></li> </ol> <span>Older</span> </div> <div class="file"> <div class="file-header"> <div class="file-actions"> <div class="btn-group"> <a href="/facebook/react-native/raw/master/Libraries/ReactIOS/NativeMethodsMixin.js" class="btn btn-sm" id="raw-url">Raw</a> <a href="/facebook/react-native/blob/master/Libraries/ReactIOS/NativeMethodsMixin.js" class="btn btn-sm js-update-url-with-hash">Normal view</a> <a href="/facebook/react-native/commits/master/Libraries/ReactIOS/NativeMethodsMixin.js" class="btn btn-sm" rel="nofollow">History</a> </div> </div> <div class="file-info"> <span class="octicon octicon-file-text"></span> <span class="file-mode" title="File Mode">100644</span> <span class="file-info-divider"></span> 191 lines (175 sloc) <span class="file-info-divider"></span> 5.8 KB </div> </div> <div class="blob-wrapper"> <table class="blame-container highlight data js-file-line-container"> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/efae175a8e1b05c976cc5a1cbd492da71eb3bb12" class="blame-sha">efae175</a> <img alt="@sahrens" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/1509831?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/efae175a8e1b05c976cc5a1cbd492da71eb3bb12" class="blame-commit-title" title="[react-packager][streamline oss] Move open sourced JS source to react-native-github">[react-packager][streamline oss] Move open sourced JS source to react…</a> <div class="blame-commit-meta"> <a href="/sahrens" class="muted-link" rel="contributor">sahrens</a> authored <time datetime="2015-02-20T04:10:52Z" is="relative-time">Feb 19, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L1">1</td> <td class="blob-code blob-code-inner js-file-line" id="LC1"><span class="pl-c">/**</span></td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="7"> <a href="/facebook/react-native/commit/e1ef0328d9e8aa5437bb3b2b9602247d41fe9465" class="blame-sha">e1ef032</a> <img alt="@vjeux" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/197597?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/e1ef0328d9e8aa5437bb3b2b9602247d41fe9465" class="blame-commit-title" title="[ReactNative] Expanded license on js files">[ReactNative] Expanded license on js files</a> <div class="blame-commit-meta"> <a href="/vjeux" class="muted-link" rel="contributor">vjeux</a> authored <time datetime="2015-03-23T20:35:08Z" is="relative-time">Mar 23, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L2">2</td> <td class="blob-code blob-code-inner js-file-line" id="LC2"><span class="pl-c"> * Copyright (c) 2015-present, Facebook, Inc.</span></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L3">3</td> <td class="blob-code blob-code-inner js-file-line" id="LC3"><span class="pl-c"> * All rights reserved.</span></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L4">4</td> <td class="blob-code blob-code-inner js-file-line" id="LC4"><span class="pl-c"> *</span></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L5">5</td> <td class="blob-code blob-code-inner js-file-line" id="LC5"><span class="pl-c"> * This source code is licensed under the BSD-style license found in the</span></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L6">6</td> <td class="blob-code blob-code-inner js-file-line" id="LC6"><span class="pl-c"> * LICENSE file in the root directory of this source tree. An additional grant</span></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L7">7</td> <td class="blob-code blob-code-inner js-file-line" id="LC7"><span class="pl-c"> * of patent rights can be found in the PATENTS file in the same directory.</span></td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="3"> <a href="/facebook/react-native/commit/efae175a8e1b05c976cc5a1cbd492da71eb3bb12" class="blame-sha">efae175</a> <img alt="@sahrens" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/1509831?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/efae175a8e1b05c976cc5a1cbd492da71eb3bb12" class="blame-commit-title" title="[react-packager][streamline oss] Move open sourced JS source to react-native-github">[react-packager][streamline oss] Move open sourced JS source to react…</a> <div class="blame-commit-meta"> <a href="/sahrens" class="muted-link" rel="contributor">sahrens</a> authored <time datetime="2015-02-20T04:10:52Z" is="relative-time">Feb 20, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L8">8</td> <td class="blob-code blob-code-inner js-file-line" id="LC8"><span class="pl-c"> *</span></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L9">9</td> <td class="blob-code blob-code-inner js-file-line" id="LC9"><span class="pl-c"> * @providesModule NativeMethodsMixin</span></td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/7ffa7942aac63767372a632f98a2e12b8847b09a" class="blame-sha">7ffa794</a> <img alt="@mroch" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/3012?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/7ffa7942aac63767372a632f98a2e12b8847b09a" class="blame-commit-title" title="flowify Libraries/ReactIOS">flowify Libraries/ReactIOS</a> <div class="blame-commit-meta"> <a href="/mroch" class="muted-link" rel="contributor">mroch</a> authored <time datetime="2015-03-26T00:49:46Z" is="relative-time">Mar 25, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L10">10</td> <td class="blob-code blob-code-inner js-file-line" id="LC10"><span class="pl-c"> * @flow</span></td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="4"> <a href="/facebook/react-native/commit/efae175a8e1b05c976cc5a1cbd492da71eb3bb12" class="blame-sha">efae175</a> <img alt="@sahrens" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/1509831?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/efae175a8e1b05c976cc5a1cbd492da71eb3bb12" class="blame-commit-title" title="[react-packager][streamline oss] Move open sourced JS source to react-native-github">[react-packager][streamline oss] Move open sourced JS source to react…</a> <div class="blame-commit-meta"> <a href="/sahrens" class="muted-link" rel="contributor">sahrens</a> authored <time datetime="2015-02-20T04:10:52Z" is="relative-time">Feb 20, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L11">11</td> <td class="blob-code blob-code-inner js-file-line" id="LC11"><span class="pl-c"> */</span></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L12">12</td> <td class="blob-code blob-code-inner js-file-line" id="LC12"><span class="pl-s"><span class="pl-pds">&#39;</span>use strict<span class="pl-pds">&#39;</span></span>;</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L13">13</td> <td class="blob-code blob-code-inner js-file-line" id="LC13"></td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/6c5024ec585662cfba8391f98d23cb12ed8256ad" class="blame-sha">6c5024e</a> <img alt="@sebmarkbage" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/63648?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/6c5024ec585662cfba8391f98d23cb12ed8256ad" class="blame-commit-title" title="Refactor Attribute Processing (Step 1) Summary: Concolidate the creation of the &quot;update payload&quot; into ReactNativeAttributePayload which now has a create and a diff version. The create version can be used by both mountComponent and setNativeProps. This means that diffRawProperties moves into ReactNativeAttributePayload. Instead of storing previousFlattenedStyle as memoized state in the component tree, I recalculate it every time. This allows better use of the generational GC. However, it is still probably a fairly expensive technique so I will follow it up with a diff that walks both nested array trees to do the diffing in a follow up. This is the first diff of several steps. @​public Reviewed By: @vjeux Differential Revision: D2440644 fb-gh-sync-id: 1d0da4f6e2bf716f33e119df947c044abb918471">Refactor Attribute Processing (Step 1)</a> <div class="blame-commit-meta"> <a href="/sebmarkbage" class="muted-link" rel="contributor">sebmarkbage</a> authored <time datetime="2015-10-06T02:19:16Z" is="relative-time">Oct 5, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="2"></td> <td class="blob-num blame-blob-num js-line-number" id="L14">14</td> <td class="blob-code blob-code-inner js-file-line" id="LC14"><span class="pl-k">var</span> ReactNativeAttributePayload <span class="pl-k">=</span> <span class="pl-c1">require</span>(<span class="pl-s"><span class="pl-pds">&#39;</span>ReactNativeAttributePayload<span class="pl-pds">&#39;</span></span>);</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/efae175a8e1b05c976cc5a1cbd492da71eb3bb12" class="blame-sha">efae175</a> <img alt="@sahrens" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/1509831?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/efae175a8e1b05c976cc5a1cbd492da71eb3bb12" class="blame-commit-title" title="[react-packager][streamline oss] Move open sourced JS source to react-native-github">[react-packager][streamline oss] Move open sourced JS source to react…</a> <div class="blame-commit-meta"> <a href="/sahrens" class="muted-link" rel="contributor">sahrens</a> authored <time datetime="2015-02-20T04:10:52Z" is="relative-time">Feb 20, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L15">15</td> <td class="blob-code blob-code-inner js-file-line" id="LC15"><span class="pl-k">var</span> TextInputState <span class="pl-k">=</span> <span class="pl-c1">require</span>(<span class="pl-s"><span class="pl-pds">&#39;</span>TextInputState<span class="pl-pds">&#39;</span></span>);</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/60db876f666e256eba8527251ce7035cfbca6014" class="blame-sha">60db876</a> <img alt="@nicklockwood" class="avatar blame-commit-avatar" height="32" src="https://avatars1.githubusercontent.com/u/546885?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/60db876f666e256eba8527251ce7035cfbca6014" class="blame-commit-title" title="Wrapped UIManager native module for better abstraction Summary: public RCTUIManager is a public module with several useful methods, however, unlike most such modules, it does not have a JS wrapper that would allow it to be required directly. Besides making it more cumbersome to use, this also makes it impossible to modify the UIManager API, or smooth over differences between platforms in the JS layer without breaking all of the call sites. This diff adds a simple JS wrapper file for the UIManager module to make it easier to work with. Reviewed By: tadeuzagallo Differential Revision: D2700348 fb-gh-sync-id: dd9030eface100b1baf756da11bae355dc0f266f">Wrapped UIManager native module for better abstraction</a> <div class="blame-commit-meta"> <a href="/nicklockwood" class="muted-link" rel="contributor">nicklockwood</a> authored <time datetime="2015-11-27T13:39:00Z" is="relative-time">Nov 27, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="1"></td> <td class="blob-num blame-blob-num js-line-number" id="L16">16</td> <td class="blob-code blob-code-inner js-file-line" id="LC16"><span class="pl-k">var</span> UIManager <span class="pl-k">=</span> <span class="pl-c1">require</span>(<span class="pl-s"><span class="pl-pds">&#39;</span>UIManager<span class="pl-pds">&#39;</span></span>);</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/efae175a8e1b05c976cc5a1cbd492da71eb3bb12" class="blame-sha">efae175</a> <img alt="@sahrens" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/1509831?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/efae175a8e1b05c976cc5a1cbd492da71eb3bb12" class="blame-commit-title" title="[react-packager][streamline oss] Move open sourced JS source to react-native-github">[react-packager][streamline oss] Move open sourced JS source to react…</a> <div class="blame-commit-meta"> <a href="/sahrens" class="muted-link" rel="contributor">sahrens</a> authored <time datetime="2015-02-20T04:10:52Z" is="relative-time">Feb 20, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L17">17</td> <td class="blob-code blob-code-inner js-file-line" id="LC17"></td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/a0440daf98d525f77e21148c1702b92c577b7592" class="blame-sha">a0440da</a> <img alt="@spicyj" class="avatar blame-commit-avatar" height="32" src="https://avatars2.githubusercontent.com/u/6820?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/a0440daf98d525f77e21148c1702b92c577b7592" class="blame-commit-title" title="[react-native] Codemod .getNodeHandle, .getNativeNode to React.findNodeHandle">[react-native] Codemod .getNodeHandle, .getNativeNode to React.findNo…</a> <div class="blame-commit-meta"> <a href="/spicyj" class="muted-link" rel="contributor">spicyj</a> authored <time datetime="2015-05-13T01:55:13Z" is="relative-time">May 12, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L18">18</td> <td class="blob-code blob-code-inner js-file-line" id="LC18"><span class="pl-k">var</span> findNodeHandle <span class="pl-k">=</span> <span class="pl-c1">require</span>(<span class="pl-s"><span class="pl-pds">&#39;</span>findNodeHandle<span class="pl-pds">&#39;</span></span>);</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="3"> <a href="/facebook/react-native/commit/efae175a8e1b05c976cc5a1cbd492da71eb3bb12" class="blame-sha">efae175</a> <img alt="@sahrens" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/1509831?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/efae175a8e1b05c976cc5a1cbd492da71eb3bb12" class="blame-commit-title" title="[react-packager][streamline oss] Move open sourced JS source to react-native-github">[react-packager][streamline oss] Move open sourced JS source to react…</a> <div class="blame-commit-meta"> <a href="/sahrens" class="muted-link" rel="contributor">sahrens</a> authored <time datetime="2015-02-20T04:10:52Z" is="relative-time">Feb 20, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L19">19</td> <td class="blob-code blob-code-inner js-file-line" id="LC19"><span class="pl-k">var</span> invariant <span class="pl-k">=</span> <span class="pl-c1">require</span>(<span class="pl-s"><span class="pl-pds">&#39;</span>invariant<span class="pl-pds">&#39;</span></span>);</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L20">20</td> <td class="blob-code blob-code-inner js-file-line" id="LC20"></td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="17"> <a href="/facebook/react-native/commit/7ffa7942aac63767372a632f98a2e12b8847b09a" class="blame-sha">7ffa794</a> <img alt="@mroch" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/3012?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/7ffa7942aac63767372a632f98a2e12b8847b09a" class="blame-commit-title" title="flowify Libraries/ReactIOS">flowify Libraries/ReactIOS</a> <div class="blame-commit-meta"> <a href="/mroch" class="muted-link" rel="contributor">mroch</a> authored <time datetime="2015-03-26T00:49:46Z" is="relative-time">Mar 26, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L21">21</td> <td class="blob-code blob-code-inner js-file-line" id="LC21">type MeasureOnSuccessCallback <span class="pl-k">=</span> (</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L22">22</td> <td class="blob-code blob-code-inner js-file-line" id="LC22"> x<span class="pl-k">:</span> number,</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L23">23</td> <td class="blob-code blob-code-inner js-file-line" id="LC23"> y<span class="pl-k">:</span> number,</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L24">24</td> <td class="blob-code blob-code-inner js-file-line" id="LC24"> width<span class="pl-k">:</span> number,</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L25">25</td> <td class="blob-code blob-code-inner js-file-line" id="LC25"> height<span class="pl-k">:</span> number,</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L26">26</td> <td class="blob-code blob-code-inner js-file-line" id="LC26"> pageX<span class="pl-k">:</span> number,</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L27">27</td> <td class="blob-code blob-code-inner js-file-line" id="LC27"> pageY<span class="pl-k">:</span> number</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L28">28</td> <td class="blob-code blob-code-inner js-file-line" id="LC28">) <span class="pl-k">=&gt;</span> <span class="pl-k">void</span></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L29">29</td> <td class="blob-code blob-code-inner js-file-line" id="LC29"></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L30">30</td> <td class="blob-code blob-code-inner js-file-line" id="LC30">type MeasureLayoutOnSuccessCallback <span class="pl-k">=</span> (</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L31">31</td> <td class="blob-code blob-code-inner js-file-line" id="LC31"> left<span class="pl-k">:</span> number,</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L32">32</td> <td class="blob-code blob-code-inner js-file-line" id="LC32"> top<span class="pl-k">:</span> number,</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L33">33</td> <td class="blob-code blob-code-inner js-file-line" id="LC33"> width<span class="pl-k">:</span> number,</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L34">34</td> <td class="blob-code blob-code-inner js-file-line" id="LC34"> height<span class="pl-k">:</span> number</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L35">35</td> <td class="blob-code blob-code-inner js-file-line" id="LC35">) <span class="pl-k">=&gt;</span> <span class="pl-k">void</span></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L36">36</td> <td class="blob-code blob-code-inner js-file-line" id="LC36"></td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="13"> <a href="/facebook/react-native/commit/2ea3b9378498913b85691c69bad29acd89c08334" class="blame-sha">2ea3b93</a> <img alt="@sebmarkbage" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/63648?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/2ea3b9378498913b85691c69bad29acd89c08334" class="blame-commit-title" title="Add warning to setNativeProps and Animated for non-nested styles Summary: These were accidentally supported because they were merged at a lower level. That&#39;s an implementation detail. setNativeProps should still normalize the API. I fixed some callers. Setting props the normal way used to ignore these. Unfortunately we can&#39;t warn for those cases because lots of extra props are spread. (The classic transferPropsTo issue.) @​public Reviewed By: @vjeux Differential Revision: D2514228 fb-gh-sync-id: 00ed6073827dc1924da20f3d80cbdf68d8a8a8fc">Add warning to setNativeProps and Animated for non-nested styles</a> <div class="blame-commit-meta"> <a href="/sebmarkbage" class="muted-link" rel="contributor">sebmarkbage</a> authored <time datetime="2015-10-06T22:19:58Z" is="relative-time">Oct 6, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="2"></td> <td class="blob-num blame-blob-num js-line-number" id="L37">37</td> <td class="blob-code blob-code-inner js-file-line" id="LC37"><span class="pl-k">function</span> <span class="pl-en">warnForStyleProps</span>(<span class="pl-smi">props</span>, <span class="pl-smi">validAttributes</span>) {</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="2"></td> <td class="blob-num blame-blob-num js-line-number" id="L38">38</td> <td class="blob-code blob-code-inner js-file-line" id="LC38"> <span class="pl-k">for</span> (<span class="pl-k">var</span> key <span class="pl-k">in</span> <span class="pl-smi">validAttributes</span>.<span class="pl-c1">style</span>) {</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="2"></td> <td class="blob-num blame-blob-num js-line-number" id="L39">39</td> <td class="blob-code blob-code-inner js-file-line" id="LC39"> <span class="pl-k">if</span> (<span class="pl-k">!</span>(validAttributes[key] <span class="pl-k">||</span> props[key] <span class="pl-k">===</span> <span class="pl-c1">undefined</span>)) {</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="2"></td> <td class="blob-num blame-blob-num js-line-number" id="L40">40</td> <td class="blob-code blob-code-inner js-file-line" id="LC40"> <span class="pl-en">console</span>.<span class="pl-c1">error</span>(</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="2"></td> <td class="blob-num blame-blob-num js-line-number" id="L41">41</td> <td class="blob-code blob-code-inner js-file-line" id="LC41"> <span class="pl-s"><span class="pl-pds">&#39;</span>You are setting the style `{ <span class="pl-pds">&#39;</span></span> <span class="pl-k">+</span> key <span class="pl-k">+</span> <span class="pl-s"><span class="pl-pds">&#39;</span>: ... }` as a prop. You <span class="pl-pds">&#39;</span></span> <span class="pl-k">+</span></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="2"></td> <td class="blob-num blame-blob-num js-line-number" id="L42">42</td> <td class="blob-code blob-code-inner js-file-line" id="LC42"> <span class="pl-s"><span class="pl-pds">&#39;</span>should nest it in a style object. <span class="pl-pds">&#39;</span></span> <span class="pl-k">+</span></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="2"></td> <td class="blob-num blame-blob-num js-line-number" id="L43">43</td> <td class="blob-code blob-code-inner js-file-line" id="LC43"> <span class="pl-s"><span class="pl-pds">&#39;</span>E.g. `{ style: { <span class="pl-pds">&#39;</span></span> <span class="pl-k">+</span> key <span class="pl-k">+</span> <span class="pl-s"><span class="pl-pds">&#39;</span>: ... } }`<span class="pl-pds">&#39;</span></span></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="2"></td> <td class="blob-num blame-blob-num js-line-number" id="L44">44</td> <td class="blob-code blob-code-inner js-file-line" id="LC44"> );</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="2"></td> <td class="blob-num blame-blob-num js-line-number" id="L45">45</td> <td class="blob-code blob-code-inner js-file-line" id="LC45"> }</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="2"></td> <td class="blob-num blame-blob-num js-line-number" id="L46">46</td> <td class="blob-code blob-code-inner js-file-line" id="LC46"> }</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="2"></td> <td class="blob-num blame-blob-num js-line-number" id="L47">47</td> <td class="blob-code blob-code-inner js-file-line" id="LC47">}</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="2"></td> <td class="blob-num blame-blob-num js-line-number" id="L48">48</td> <td class="blob-code blob-code-inner js-file-line" id="LC48"></td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="13"> <a href="/facebook/react-native/commit/381e2acd184fc4ba80a240ba3d7dda0464c6416b" class="blame-sha">381e2ac</a> <img alt="@corbt" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/176426?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/381e2acd184fc4ba80a240ba3d7dda0464c6416b" class="blame-commit-title" title="Document NativeMethodsMixin Summary: This is related to the discussion in #3155. I&#39;ve documented the methods in this mixin, and pointed to other appropriate documentation where necessary as well. I didn&#39;t end up adding any examples. I wanted to add a `focus()`/`blur()` example to the UIExplorer app, but the app seems to be broken on master at the moment (`Requiring unknown module &quot;event-target-shim&quot;`) and I didn&#39;t bother trying to fix it. I think the last thing necessary for making the usage of these methods clear is an example of calling one or more of them on a `ref` or view captured in some other way. However, `setNativeProps` is well documented in the &quot;Direct Manipulation&quot; guide, which I link to from this page, so by extension it should be possible to figure out the functionality of the other methods. cc @mkonicek @​astreet Closes https://github.com/facebook/react-native/pull/3238 Reviewed By: @​svcscm Differential Revision: D2517187 Pulled By: @mkonicek fb-gh-sync-id: 4e68b2bc44ace83f06ae2e364ca0c23a7c461b20">Document NativeMethodsMixin</a> <div class="blame-commit-meta"> <a href="/corbt" class="muted-link" rel="contributor">corbt</a> authored <time datetime="2015-10-07T16:32:35Z" is="relative-time">Oct 7, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="2"></td> <td class="blob-num blame-blob-num js-line-number" id="L49">49</td> <td class="blob-code blob-code-inner js-file-line" id="LC49"><span class="pl-c">/**</span></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="2"></td> <td class="blob-num blame-blob-num js-line-number" id="L50">50</td> <td class="blob-code blob-code-inner js-file-line" id="LC50"><span class="pl-c"> * `NativeMethodsMixin` provides methods to access the underlying native</span></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="2"></td> <td class="blob-num blame-blob-num js-line-number" id="L51">51</td> <td class="blob-code blob-code-inner js-file-line" id="LC51"><span class="pl-c"> * component directly. This can be useful in cases when you want to focus</span></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="2"></td> <td class="blob-num blame-blob-num js-line-number" id="L52">52</td> <td class="blob-code blob-code-inner js-file-line" id="LC52"><span class="pl-c"> * a view or measure its on-screen dimensions, for example.</span></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="2"></td> <td class="blob-num blame-blob-num js-line-number" id="L53">53</td> <td class="blob-code blob-code-inner js-file-line" id="LC53"><span class="pl-c"> *</span></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="2"></td> <td class="blob-num blame-blob-num js-line-number" id="L54">54</td> <td class="blob-code blob-code-inner js-file-line" id="LC54"><span class="pl-c"> * The methods described here are available on most of the default components</span></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="2"></td> <td class="blob-num blame-blob-num js-line-number" id="L55">55</td> <td class="blob-code blob-code-inner js-file-line" id="LC55"><span class="pl-c"> * provided by React Native. Note, however, that they are *not* available on</span></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="2"></td> <td class="blob-num blame-blob-num js-line-number" id="L56">56</td> <td class="blob-code blob-code-inner js-file-line" id="LC56"><span class="pl-c"> * composite components that aren&#39;t directly backed by a native view. This will</span></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="2"></td> <td class="blob-num blame-blob-num js-line-number" id="L57">57</td> <td class="blob-code blob-code-inner js-file-line" id="LC57"><span class="pl-c"> * generally include most components that you define in your own app. For more</span></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="2"></td> <td class="blob-num blame-blob-num js-line-number" id="L58">58</td> <td class="blob-code blob-code-inner js-file-line" id="LC58"><span class="pl-c"> * information, see [Direct</span></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="2"></td> <td class="blob-num blame-blob-num js-line-number" id="L59">59</td> <td class="blob-code blob-code-inner js-file-line" id="LC59"><span class="pl-c"> * Manipulation](/react-native/docs/direct-manipulation.html).</span></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="2"></td> <td class="blob-num blame-blob-num js-line-number" id="L60">60</td> <td class="blob-code blob-code-inner js-file-line" id="LC60"><span class="pl-c"> */</span></td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/efae175a8e1b05c976cc5a1cbd492da71eb3bb12" class="blame-sha">efae175</a> <img alt="@sahrens" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/1509831?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/efae175a8e1b05c976cc5a1cbd492da71eb3bb12" class="blame-commit-title" title="[react-packager][streamline oss] Move open sourced JS source to react-native-github">[react-packager][streamline oss] Move open sourced JS source to react…</a> <div class="blame-commit-meta"> <a href="/sahrens" class="muted-link" rel="contributor">sahrens</a> authored <time datetime="2015-02-20T04:10:52Z" is="relative-time">Feb 20, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L61">61</td> <td class="blob-code blob-code-inner js-file-line" id="LC61"><span class="pl-k">var</span> NativeMethodsMixin <span class="pl-k">=</span> {</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="18"> <a href="/facebook/react-native/commit/381e2acd184fc4ba80a240ba3d7dda0464c6416b" class="blame-sha">381e2ac</a> <img alt="@corbt" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/176426?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/381e2acd184fc4ba80a240ba3d7dda0464c6416b" class="blame-commit-title" title="Document NativeMethodsMixin Summary: This is related to the discussion in #3155. I&#39;ve documented the methods in this mixin, and pointed to other appropriate documentation where necessary as well. I didn&#39;t end up adding any examples. I wanted to add a `focus()`/`blur()` example to the UIExplorer app, but the app seems to be broken on master at the moment (`Requiring unknown module &quot;event-target-shim&quot;`) and I didn&#39;t bother trying to fix it. I think the last thing necessary for making the usage of these methods clear is an example of calling one or more of them on a `ref` or view captured in some other way. However, `setNativeProps` is well documented in the &quot;Direct Manipulation&quot; guide, which I link to from this page, so by extension it should be possible to figure out the functionality of the other methods. cc @mkonicek @​astreet Closes https://github.com/facebook/react-native/pull/3238 Reviewed By: @​svcscm Differential Revision: D2517187 Pulled By: @mkonicek fb-gh-sync-id: 4e68b2bc44ace83f06ae2e364ca0c23a7c461b20">Document NativeMethodsMixin</a> <div class="blame-commit-meta"> <a href="/corbt" class="muted-link" rel="contributor">corbt</a> authored <time datetime="2015-10-07T16:32:35Z" is="relative-time">Oct 7, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="2"></td> <td class="blob-num blame-blob-num js-line-number" id="L62">62</td> <td class="blob-code blob-code-inner js-file-line" id="LC62"> <span class="pl-c">/**</span></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="2"></td> <td class="blob-num blame-blob-num js-line-number" id="L63">63</td> <td class="blob-code blob-code-inner js-file-line" id="LC63"><span class="pl-c"> * Determines the location on screen, width, and height of the given view and</span></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="2"></td> <td class="blob-num blame-blob-num js-line-number" id="L64">64</td> <td class="blob-code blob-code-inner js-file-line" id="LC64"><span class="pl-c"> * returns the values via an async callback. If successful, the callback will</span></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="2"></td> <td class="blob-num blame-blob-num js-line-number" id="L65">65</td> <td class="blob-code blob-code-inner js-file-line" id="LC65"><span class="pl-c"> * be called with the following arguments:</span></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="2"></td> <td class="blob-num blame-blob-num js-line-number" id="L66">66</td> <td class="blob-code blob-code-inner js-file-line" id="LC66"><span class="pl-c"> *</span></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="2"></td> <td class="blob-num blame-blob-num js-line-number" id="L67">67</td> <td class="blob-code blob-code-inner js-file-line" id="LC67"><span class="pl-c"> * - x</span></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="2"></td> <td class="blob-num blame-blob-num js-line-number" id="L68">68</td> <td class="blob-code blob-code-inner js-file-line" id="LC68"><span class="pl-c"> * - y</span></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="2"></td> <td class="blob-num blame-blob-num js-line-number" id="L69">69</td> <td class="blob-code blob-code-inner js-file-line" id="LC69"><span class="pl-c"> * - width</span></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="2"></td> <td class="blob-num blame-blob-num js-line-number" id="L70">70</td> <td class="blob-code blob-code-inner js-file-line" id="LC70"><span class="pl-c"> * - height</span></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="2"></td> <td class="blob-num blame-blob-num js-line-number" id="L71">71</td> <td class="blob-code blob-code-inner js-file-line" id="LC71"><span class="pl-c"> * - pageX</span></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="2"></td> <td class="blob-num blame-blob-num js-line-number" id="L72">72</td> <td class="blob-code blob-code-inner js-file-line" id="LC72"><span class="pl-c"> * - pageY</span></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="2"></td> <td class="blob-num blame-blob-num js-line-number" id="L73">73</td> <td class="blob-code blob-code-inner js-file-line" id="LC73"><span class="pl-c"> *</span></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="2"></td> <td class="blob-num blame-blob-num js-line-number" id="L74">74</td> <td class="blob-code blob-code-inner js-file-line" id="LC74"><span class="pl-c"> * Note that these measurements are not available until after the rendering</span></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="2"></td> <td class="blob-num blame-blob-num js-line-number" id="L75">75</td> <td class="blob-code blob-code-inner js-file-line" id="LC75"><span class="pl-c"> * has been completed in native. If you need the measurements as soon as</span></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="2"></td> <td class="blob-num blame-blob-num js-line-number" id="L76">76</td> <td class="blob-code blob-code-inner js-file-line" id="LC76"><span class="pl-c"> * possible, consider using the [`onLayout`</span></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="2"></td> <td class="blob-num blame-blob-num js-line-number" id="L77">77</td> <td class="blob-code blob-code-inner js-file-line" id="LC77"><span class="pl-c"> * prop](/react-native/docs/view.html#onlayout) instead.</span></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="2"></td> <td class="blob-num blame-blob-num js-line-number" id="L78">78</td> <td class="blob-code blob-code-inner js-file-line" id="LC78"><span class="pl-c"> */</span></td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/7ffa7942aac63767372a632f98a2e12b8847b09a" class="blame-sha">7ffa794</a> <img alt="@mroch" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/3012?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/7ffa7942aac63767372a632f98a2e12b8847b09a" class="blame-commit-title" title="flowify Libraries/ReactIOS">flowify Libraries/ReactIOS</a> <div class="blame-commit-meta"> <a href="/mroch" class="muted-link" rel="contributor">mroch</a> authored <time datetime="2015-03-26T00:49:46Z" is="relative-time">Mar 26, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L79">79</td> <td class="blob-code blob-code-inner js-file-line" id="LC79"> <span class="pl-en">measure</span><span class="pl-k">:</span> <span class="pl-k">function</span>(<span class="pl-smi">callback</span>: <span class="pl-smi">MeasureOnSuccessCallback</span>) {</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/60db876f666e256eba8527251ce7035cfbca6014" class="blame-sha">60db876</a> <img alt="@nicklockwood" class="avatar blame-commit-avatar" height="32" src="https://avatars1.githubusercontent.com/u/546885?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/60db876f666e256eba8527251ce7035cfbca6014" class="blame-commit-title" title="Wrapped UIManager native module for better abstraction Summary: public RCTUIManager is a public module with several useful methods, however, unlike most such modules, it does not have a JS wrapper that would allow it to be required directly. Besides making it more cumbersome to use, this also makes it impossible to modify the UIManager API, or smooth over differences between platforms in the JS layer without breaking all of the call sites. This diff adds a simple JS wrapper file for the UIManager module to make it easier to work with. Reviewed By: tadeuzagallo Differential Revision: D2700348 fb-gh-sync-id: dd9030eface100b1baf756da11bae355dc0f266f">Wrapped UIManager native module for better abstraction</a> <div class="blame-commit-meta"> <a href="/nicklockwood" class="muted-link" rel="contributor">nicklockwood</a> authored <time datetime="2015-11-27T13:39:00Z" is="relative-time">Nov 27, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="1"></td> <td class="blob-num blame-blob-num js-line-number" id="L80">80</td> <td class="blob-code blob-code-inner js-file-line" id="LC80"> <span class="pl-smi">UIManager</span>.<span class="pl-en">measure</span>(</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="4"> <a href="/facebook/react-native/commit/6e179fb7cd68c92f8abd94d381f85c41298c828c" class="blame-sha">6e179fb</a> <img alt="@sahrens" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/1509831?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/6e179fb7cd68c92f8abd94d381f85c41298c828c" class="blame-commit-title" title="[ReactNative] introduce mountSafeCallback Summary: `mountSafeCallback` simply wraps a callback in an `isMounted()` check to prevent crashes when old callbacks are called on unmounted components. @public Test Plan: Added logging and made sure callbacks were getting called through `mountSafeCallback` and that things worked (e.g. photo viewer rotation etc).">[ReactNative] introduce mountSafeCallback</a> <div class="blame-commit-meta"> <a href="/sahrens" class="muted-link" rel="contributor">sahrens</a> authored <time datetime="2015-05-14T01:33:43Z" is="relative-time">May 13, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L81">81</td> <td class="blob-code blob-code-inner js-file-line" id="LC81"> <span class="pl-en">findNodeHandle</span>(<span class="pl-v">this</span>),</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L82">82</td> <td class="blob-code blob-code-inner js-file-line" id="LC82"> <span class="pl-en">mountSafeCallback</span>(<span class="pl-v">this</span>, callback)</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L83">83</td> <td class="blob-code blob-code-inner js-file-line" id="LC83"> );</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="3"> <a href="/facebook/react-native/commit/efae175a8e1b05c976cc5a1cbd492da71eb3bb12" class="blame-sha">efae175</a> <img alt="@sahrens" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/1509831?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/efae175a8e1b05c976cc5a1cbd492da71eb3bb12" class="blame-commit-title" title="[react-packager][streamline oss] Move open sourced JS source to react-native-github">[react-packager][streamline oss] Move open sourced JS source to react…</a> <div class="blame-commit-meta"> <a href="/sahrens" class="muted-link" rel="contributor">sahrens</a> authored <time datetime="2015-02-20T04:10:52Z" is="relative-time">Feb 20, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L84">84</td> <td class="blob-code blob-code-inner js-file-line" id="LC84"> },</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L85">85</td> <td class="blob-code blob-code-inner js-file-line" id="LC85"></td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="9"> <a href="/facebook/react-native/commit/381e2acd184fc4ba80a240ba3d7dda0464c6416b" class="blame-sha">381e2ac</a> <img alt="@corbt" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/176426?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/381e2acd184fc4ba80a240ba3d7dda0464c6416b" class="blame-commit-title" title="Document NativeMethodsMixin Summary: This is related to the discussion in #3155. I&#39;ve documented the methods in this mixin, and pointed to other appropriate documentation where necessary as well. I didn&#39;t end up adding any examples. I wanted to add a `focus()`/`blur()` example to the UIExplorer app, but the app seems to be broken on master at the moment (`Requiring unknown module &quot;event-target-shim&quot;`) and I didn&#39;t bother trying to fix it. I think the last thing necessary for making the usage of these methods clear is an example of calling one or more of them on a `ref` or view captured in some other way. However, `setNativeProps` is well documented in the &quot;Direct Manipulation&quot; guide, which I link to from this page, so by extension it should be possible to figure out the functionality of the other methods. cc @mkonicek @​astreet Closes https://github.com/facebook/react-native/pull/3238 Reviewed By: @​svcscm Differential Revision: D2517187 Pulled By: @mkonicek fb-gh-sync-id: 4e68b2bc44ace83f06ae2e364ca0c23a7c461b20">Document NativeMethodsMixin</a> <div class="blame-commit-meta"> <a href="/corbt" class="muted-link" rel="contributor">corbt</a> authored <time datetime="2015-10-07T16:32:35Z" is="relative-time">Oct 7, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="2"></td> <td class="blob-num blame-blob-num js-line-number" id="L86">86</td> <td class="blob-code blob-code-inner js-file-line" id="LC86"> <span class="pl-c">/**</span></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="2"></td> <td class="blob-num blame-blob-num js-line-number" id="L87">87</td> <td class="blob-code blob-code-inner js-file-line" id="LC87"><span class="pl-c"> * Like [`measure()`](#measure), but measures the view relative an ancestor,</span></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="2"></td> <td class="blob-num blame-blob-num js-line-number" id="L88">88</td> <td class="blob-code blob-code-inner js-file-line" id="LC88"><span class="pl-c"> * specified as `relativeToNativeNode`. This means that the returned x, y</span></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="2"></td> <td class="blob-num blame-blob-num js-line-number" id="L89">89</td> <td class="blob-code blob-code-inner js-file-line" id="LC89"><span class="pl-c"> * are relative to the origin x, y of the ancestor view.</span></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="2"></td> <td class="blob-num blame-blob-num js-line-number" id="L90">90</td> <td class="blob-code blob-code-inner js-file-line" id="LC90"><span class="pl-c"> *</span></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="2"></td> <td class="blob-num blame-blob-num js-line-number" id="L91">91</td> <td class="blob-code blob-code-inner js-file-line" id="LC91"><span class="pl-c"> * As always, to obtain a native node handle for a component, you can use</span></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="2"></td> <td class="blob-num blame-blob-num js-line-number" id="L92">92</td> <td class="blob-code blob-code-inner js-file-line" id="LC92"><span class="pl-c"> * `React.findNodeHandle(component)`.</span></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="2"></td> <td class="blob-num blame-blob-num js-line-number" id="L93">93</td> <td class="blob-code blob-code-inner js-file-line" id="LC93"><span class="pl-c"> */</span></td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="6"> <a href="/facebook/react-native/commit/7ffa7942aac63767372a632f98a2e12b8847b09a" class="blame-sha">7ffa794</a> <img alt="@mroch" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/3012?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/7ffa7942aac63767372a632f98a2e12b8847b09a" class="blame-commit-title" title="flowify Libraries/ReactIOS">flowify Libraries/ReactIOS</a> <div class="blame-commit-meta"> <a href="/mroch" class="muted-link" rel="contributor">mroch</a> authored <time datetime="2015-03-26T00:49:46Z" is="relative-time">Mar 26, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L94">94</td> <td class="blob-code blob-code-inner js-file-line" id="LC94"> <span class="pl-en">measureLayout</span><span class="pl-k">:</span> <span class="pl-k">function</span>(</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L95">95</td> <td class="blob-code blob-code-inner js-file-line" id="LC95"> <span class="pl-smi">relativeToNativeNode</span>: <span class="pl-smi">number</span>,</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L96">96</td> <td class="blob-code blob-code-inner js-file-line" id="LC96"> <span class="pl-smi">onSuccess</span>: <span class="pl-smi">MeasureLayoutOnSuccessCallback</span>,</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L97">97</td> <td class="blob-code blob-code-inner js-file-line" id="LC97"> <span class="pl-smi">onFail</span>: () <span class="pl-k">=&gt;</span> <span class="pl-k">void</span> <span class="pl-c">/* currently unused */</span></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L98">98</td> <td class="blob-code blob-code-inner js-file-line" id="LC98"> ) {</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/60db876f666e256eba8527251ce7035cfbca6014" class="blame-sha">60db876</a> <img alt="@nicklockwood" class="avatar blame-commit-avatar" height="32" src="https://avatars1.githubusercontent.com/u/546885?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/60db876f666e256eba8527251ce7035cfbca6014" class="blame-commit-title" title="Wrapped UIManager native module for better abstraction Summary: public RCTUIManager is a public module with several useful methods, however, unlike most such modules, it does not have a JS wrapper that would allow it to be required directly. Besides making it more cumbersome to use, this also makes it impossible to modify the UIManager API, or smooth over differences between platforms in the JS layer without breaking all of the call sites. This diff adds a simple JS wrapper file for the UIManager module to make it easier to work with. Reviewed By: tadeuzagallo Differential Revision: D2700348 fb-gh-sync-id: dd9030eface100b1baf756da11bae355dc0f266f">Wrapped UIManager native module for better abstraction</a> <div class="blame-commit-meta"> <a href="/nicklockwood" class="muted-link" rel="contributor">nicklockwood</a> authored <time datetime="2015-11-27T13:39:00Z" is="relative-time">Nov 27, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="1"></td> <td class="blob-num blame-blob-num js-line-number" id="L99">99</td> <td class="blob-code blob-code-inner js-file-line" id="LC99"> <span class="pl-smi">UIManager</span>.<span class="pl-en">measureLayout</span>(</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/a0440daf98d525f77e21148c1702b92c577b7592" class="blame-sha">a0440da</a> <img alt="@spicyj" class="avatar blame-commit-avatar" height="32" src="https://avatars2.githubusercontent.com/u/6820?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/a0440daf98d525f77e21148c1702b92c577b7592" class="blame-commit-title" title="[react-native] Codemod .getNodeHandle, .getNativeNode to React.findNodeHandle">[react-native] Codemod .getNodeHandle, .getNativeNode to React.findNo…</a> <div class="blame-commit-meta"> <a href="/spicyj" class="muted-link" rel="contributor">spicyj</a> authored <time datetime="2015-05-13T01:55:13Z" is="relative-time">May 13, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L100">100</td> <td class="blob-code blob-code-inner js-file-line" id="LC100"> <span class="pl-en">findNodeHandle</span>(<span class="pl-v">this</span>),</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/efae175a8e1b05c976cc5a1cbd492da71eb3bb12" class="blame-sha">efae175</a> <img alt="@sahrens" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/1509831?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/efae175a8e1b05c976cc5a1cbd492da71eb3bb12" class="blame-commit-title" title="[react-packager][streamline oss] Move open sourced JS source to react-native-github">[react-packager][streamline oss] Move open sourced JS source to react…</a> <div class="blame-commit-meta"> <a href="/sahrens" class="muted-link" rel="contributor">sahrens</a> authored <time datetime="2015-02-20T04:10:52Z" is="relative-time">Feb 20, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L101">101</td> <td class="blob-code blob-code-inner js-file-line" id="LC101"> relativeToNativeNode,</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="3"> <a href="/facebook/react-native/commit/6e179fb7cd68c92f8abd94d381f85c41298c828c" class="blame-sha">6e179fb</a> <img alt="@sahrens" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/1509831?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/6e179fb7cd68c92f8abd94d381f85c41298c828c" class="blame-commit-title" title="[ReactNative] introduce mountSafeCallback Summary: `mountSafeCallback` simply wraps a callback in an `isMounted()` check to prevent crashes when old callbacks are called on unmounted components. @public Test Plan: Added logging and made sure callbacks were getting called through `mountSafeCallback` and that things worked (e.g. photo viewer rotation etc).">[ReactNative] introduce mountSafeCallback</a> <div class="blame-commit-meta"> <a href="/sahrens" class="muted-link" rel="contributor">sahrens</a> authored <time datetime="2015-05-14T01:33:43Z" is="relative-time">May 14, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L102">102</td> <td class="blob-code blob-code-inner js-file-line" id="LC102"> <span class="pl-en">mountSafeCallback</span>(<span class="pl-v">this</span>, onFail),</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L103">103</td> <td class="blob-code blob-code-inner js-file-line" id="LC103"> <span class="pl-en">mountSafeCallback</span>(<span class="pl-v">this</span>, onSuccess)</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="5"> <a href="/facebook/react-native/commit/efae175a8e1b05c976cc5a1cbd492da71eb3bb12" class="blame-sha">efae175</a> <img alt="@sahrens" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/1509831?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/efae175a8e1b05c976cc5a1cbd492da71eb3bb12" class="blame-commit-title" title="[react-packager][streamline oss] Move open sourced JS source to react-native-github">[react-packager][streamline oss] Move open sourced JS source to react…</a> <div class="blame-commit-meta"> <a href="/sahrens" class="muted-link" rel="contributor">sahrens</a> authored <time datetime="2015-02-20T04:10:52Z" is="relative-time">Feb 20, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L104">104</td> <td class="blob-code blob-code-inner js-file-line" id="LC104"> );</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L105">105</td> <td class="blob-code blob-code-inner js-file-line" id="LC105"> },</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L106">106</td> <td class="blob-code blob-code-inner js-file-line" id="LC106"></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L107">107</td> <td class="blob-code blob-code-inner js-file-line" id="LC107"> <span class="pl-c">/**</span></td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="5"> <a href="/facebook/react-native/commit/381e2acd184fc4ba80a240ba3d7dda0464c6416b" class="blame-sha">381e2ac</a> <img alt="@corbt" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/176426?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/381e2acd184fc4ba80a240ba3d7dda0464c6416b" class="blame-commit-title" title="Document NativeMethodsMixin Summary: This is related to the discussion in #3155. I&#39;ve documented the methods in this mixin, and pointed to other appropriate documentation where necessary as well. I didn&#39;t end up adding any examples. I wanted to add a `focus()`/`blur()` example to the UIExplorer app, but the app seems to be broken on master at the moment (`Requiring unknown module &quot;event-target-shim&quot;`) and I didn&#39;t bother trying to fix it. I think the last thing necessary for making the usage of these methods clear is an example of calling one or more of them on a `ref` or view captured in some other way. However, `setNativeProps` is well documented in the &quot;Direct Manipulation&quot; guide, which I link to from this page, so by extension it should be possible to figure out the functionality of the other methods. cc @mkonicek @​astreet Closes https://github.com/facebook/react-native/pull/3238 Reviewed By: @​svcscm Differential Revision: D2517187 Pulled By: @mkonicek fb-gh-sync-id: 4e68b2bc44ace83f06ae2e364ca0c23a7c461b20">Document NativeMethodsMixin</a> <div class="blame-commit-meta"> <a href="/corbt" class="muted-link" rel="contributor">corbt</a> authored <time datetime="2015-10-07T16:32:35Z" is="relative-time">Oct 7, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="2"></td> <td class="blob-num blame-blob-num js-line-number" id="L108">108</td> <td class="blob-code blob-code-inner js-file-line" id="LC108"><span class="pl-c"> * This function sends props straight to native. They will not participate in</span></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="2"></td> <td class="blob-num blame-blob-num js-line-number" id="L109">109</td> <td class="blob-code blob-code-inner js-file-line" id="LC109"><span class="pl-c"> * future diff process - this means that if you do not include them in the</span></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="2"></td> <td class="blob-num blame-blob-num js-line-number" id="L110">110</td> <td class="blob-code blob-code-inner js-file-line" id="LC110"><span class="pl-c"> * next render, they will remain active (see [Direct</span></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="2"></td> <td class="blob-num blame-blob-num js-line-number" id="L111">111</td> <td class="blob-code blob-code-inner js-file-line" id="LC111"><span class="pl-c"> * Manipulation](/react-native/docs/direct-manipulation.html)).</span></td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/efae175a8e1b05c976cc5a1cbd492da71eb3bb12" class="blame-sha">efae175</a> <img alt="@sahrens" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/1509831?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/efae175a8e1b05c976cc5a1cbd492da71eb3bb12" class="blame-commit-title" title="[react-packager][streamline oss] Move open sourced JS source to react-native-github">[react-packager][streamline oss] Move open sourced JS source to react…</a> <div class="blame-commit-meta"> <a href="/sahrens" class="muted-link" rel="contributor">sahrens</a> authored <time datetime="2015-02-20T04:10:52Z" is="relative-time">Feb 20, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L112">112</td> <td class="blob-code blob-code-inner js-file-line" id="LC112"><span class="pl-c"> */</span></td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/7ffa7942aac63767372a632f98a2e12b8847b09a" class="blame-sha">7ffa794</a> <img alt="@mroch" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/3012?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/7ffa7942aac63767372a632f98a2e12b8847b09a" class="blame-commit-title" title="flowify Libraries/ReactIOS">flowify Libraries/ReactIOS</a> <div class="blame-commit-meta"> <a href="/mroch" class="muted-link" rel="contributor">mroch</a> authored <time datetime="2015-03-26T00:49:46Z" is="relative-time">Mar 26, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L113">113</td> <td class="blob-code blob-code-inner js-file-line" id="LC113"> <span class="pl-en">setNativeProps</span><span class="pl-k">:</span> <span class="pl-k">function</span>(<span class="pl-smi">nativeProps</span>: <span class="pl-smi">Object</span>) {</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="5"> <a href="/facebook/react-native/commit/2ea3b9378498913b85691c69bad29acd89c08334" class="blame-sha">2ea3b93</a> <img alt="@sebmarkbage" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/63648?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/2ea3b9378498913b85691c69bad29acd89c08334" class="blame-commit-title" title="Add warning to setNativeProps and Animated for non-nested styles Summary: These were accidentally supported because they were merged at a lower level. That&#39;s an implementation detail. setNativeProps should still normalize the API. I fixed some callers. Setting props the normal way used to ignore these. Unfortunately we can&#39;t warn for those cases because lots of extra props are spread. (The classic transferPropsTo issue.) @​public Reviewed By: @vjeux Differential Revision: D2514228 fb-gh-sync-id: 00ed6073827dc1924da20f3d80cbdf68d8a8a8fc">Add warning to setNativeProps and Animated for non-nested styles</a> <div class="blame-commit-meta"> <a href="/sebmarkbage" class="muted-link" rel="contributor">sebmarkbage</a> authored <time datetime="2015-10-06T22:19:58Z" is="relative-time">Oct 6, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="2"></td> <td class="blob-num blame-blob-num js-line-number" id="L114">114</td> <td class="blob-code blob-code-inner js-file-line" id="LC114"> <span class="pl-k">if</span> (__DEV__) {</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="2"></td> <td class="blob-num blame-blob-num js-line-number" id="L115">115</td> <td class="blob-code blob-code-inner js-file-line" id="LC115"> <span class="pl-en">warnForStyleProps</span>(nativeProps, <span class="pl-smi">this</span>.<span class="pl-smi">viewConfig</span>.<span class="pl-smi">validAttributes</span>);</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="2"></td> <td class="blob-num blame-blob-num js-line-number" id="L116">116</td> <td class="blob-code blob-code-inner js-file-line" id="LC116"> }</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="2"></td> <td class="blob-num blame-blob-num js-line-number" id="L117">117</td> <td class="blob-code blob-code-inner js-file-line" id="LC117"></td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="3"> <a href="/facebook/react-native/commit/6c5024ec585662cfba8391f98d23cb12ed8256ad" class="blame-sha">6c5024e</a> <img alt="@sebmarkbage" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/63648?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/6c5024ec585662cfba8391f98d23cb12ed8256ad" class="blame-commit-title" title="Refactor Attribute Processing (Step 1) Summary: Concolidate the creation of the &quot;update payload&quot; into ReactNativeAttributePayload which now has a create and a diff version. The create version can be used by both mountComponent and setNativeProps. This means that diffRawProperties moves into ReactNativeAttributePayload. Instead of storing previousFlattenedStyle as memoized state in the component tree, I recalculate it every time. This allows better use of the generational GC. However, it is still probably a fairly expensive technique so I will follow it up with a diff that walks both nested array trees to do the diffing in a follow up. This is the first diff of several steps. @​public Reviewed By: @vjeux Differential Revision: D2440644 fb-gh-sync-id: 1d0da4f6e2bf716f33e119df947c044abb918471">Refactor Attribute Processing (Step 1)</a> <div class="blame-commit-meta"> <a href="/sebmarkbage" class="muted-link" rel="contributor">sebmarkbage</a> authored <time datetime="2015-10-06T02:19:16Z" is="relative-time">Oct 6, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="2"></td> <td class="blob-num blame-blob-num js-line-number" id="L118">118</td> <td class="blob-code blob-code-inner js-file-line" id="LC118"> <span class="pl-k">var</span> updatePayload <span class="pl-k">=</span> <span class="pl-smi">ReactNativeAttributePayload</span>.<span class="pl-en">create</span>(</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="2"></td> <td class="blob-num blame-blob-num js-line-number" id="L119">119</td> <td class="blob-code blob-code-inner js-file-line" id="LC119"> nativeProps,</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="3"> <a href="/facebook/react-native/commit/9a2d05d9b2aea459ef3b3e92376cf15bca4d17fa" class="blame-sha">9a2d05d</a> <img alt="@a2" class="avatar blame-commit-avatar" height="32" src="https://avatars2.githubusercontent.com/u/241156?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/9a2d05d9b2aea459ef3b3e92376cf15bca4d17fa" class="blame-commit-title" title="Move color processing to JS Reviewed By: @vjeux Differential Revision: D2346353">Move color processing to JS</a> <div class="blame-commit-meta"> <a href="/a2" class="muted-link" rel="contributor">a2</a> authored <time datetime="2015-09-17T15:36:08Z" is="relative-time">Sep 17, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="3"></td> <td class="blob-num blame-blob-num js-line-number" id="L120">120</td> <td class="blob-code blob-code-inner js-file-line" id="LC120"> <span class="pl-smi">this</span>.<span class="pl-smi">viewConfig</span>.<span class="pl-smi">validAttributes</span></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="3"></td> <td class="blob-num blame-blob-num js-line-number" id="L121">121</td> <td class="blob-code blob-code-inner js-file-line" id="LC121"> );</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/efae175a8e1b05c976cc5a1cbd492da71eb3bb12" class="blame-sha">efae175</a> <img alt="@sahrens" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/1509831?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/efae175a8e1b05c976cc5a1cbd492da71eb3bb12" class="blame-commit-title" title="[react-packager][streamline oss] Move open sourced JS source to react-native-github">[react-packager][streamline oss] Move open sourced JS source to react…</a> <div class="blame-commit-meta"> <a href="/sahrens" class="muted-link" rel="contributor">sahrens</a> authored <time datetime="2015-02-20T04:10:52Z" is="relative-time">Feb 20, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L122">122</td> <td class="blob-code blob-code-inner js-file-line" id="LC122"></td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/60db876f666e256eba8527251ce7035cfbca6014" class="blame-sha">60db876</a> <img alt="@nicklockwood" class="avatar blame-commit-avatar" height="32" src="https://avatars1.githubusercontent.com/u/546885?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/60db876f666e256eba8527251ce7035cfbca6014" class="blame-commit-title" title="Wrapped UIManager native module for better abstraction Summary: public RCTUIManager is a public module with several useful methods, however, unlike most such modules, it does not have a JS wrapper that would allow it to be required directly. Besides making it more cumbersome to use, this also makes it impossible to modify the UIManager API, or smooth over differences between platforms in the JS layer without breaking all of the call sites. This diff adds a simple JS wrapper file for the UIManager module to make it easier to work with. Reviewed By: tadeuzagallo Differential Revision: D2700348 fb-gh-sync-id: dd9030eface100b1baf756da11bae355dc0f266f">Wrapped UIManager native module for better abstraction</a> <div class="blame-commit-meta"> <a href="/nicklockwood" class="muted-link" rel="contributor">nicklockwood</a> authored <time datetime="2015-11-27T13:39:00Z" is="relative-time">Nov 27, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="1"></td> <td class="blob-num blame-blob-num js-line-number" id="L123">123</td> <td class="blob-code blob-code-inner js-file-line" id="LC123"> <span class="pl-smi">UIManager</span>.<span class="pl-en">updateView</span>(</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/a0440daf98d525f77e21148c1702b92c577b7592" class="blame-sha">a0440da</a> <img alt="@spicyj" class="avatar blame-commit-avatar" height="32" src="https://avatars2.githubusercontent.com/u/6820?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/a0440daf98d525f77e21148c1702b92c577b7592" class="blame-commit-title" title="[react-native] Codemod .getNodeHandle, .getNativeNode to React.findNodeHandle">[react-native] Codemod .getNodeHandle, .getNativeNode to React.findNo…</a> <div class="blame-commit-meta"> <a href="/spicyj" class="muted-link" rel="contributor">spicyj</a> authored <time datetime="2015-05-13T01:55:13Z" is="relative-time">May 13, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L124">124</td> <td class="blob-code blob-code-inner js-file-line" id="LC124"> <span class="pl-en">findNodeHandle</span>(<span class="pl-v">this</span>),</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/efae175a8e1b05c976cc5a1cbd492da71eb3bb12" class="blame-sha">efae175</a> <img alt="@sahrens" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/1509831?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/efae175a8e1b05c976cc5a1cbd492da71eb3bb12" class="blame-commit-title" title="[react-packager][streamline oss] Move open sourced JS source to react-native-github">[react-packager][streamline oss] Move open sourced JS source to react…</a> <div class="blame-commit-meta"> <a href="/sahrens" class="muted-link" rel="contributor">sahrens</a> authored <time datetime="2015-02-20T04:10:52Z" is="relative-time">Feb 20, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L125">125</td> <td class="blob-code blob-code-inner js-file-line" id="LC125"> <span class="pl-smi">this</span>.<span class="pl-smi">viewConfig</span>.<span class="pl-smi">uiViewClassName</span>,</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/6c5024ec585662cfba8391f98d23cb12ed8256ad" class="blame-sha">6c5024e</a> <img alt="@sebmarkbage" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/63648?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/6c5024ec585662cfba8391f98d23cb12ed8256ad" class="blame-commit-title" title="Refactor Attribute Processing (Step 1) Summary: Concolidate the creation of the &quot;update payload&quot; into ReactNativeAttributePayload which now has a create and a diff version. The create version can be used by both mountComponent and setNativeProps. This means that diffRawProperties moves into ReactNativeAttributePayload. Instead of storing previousFlattenedStyle as memoized state in the component tree, I recalculate it every time. This allows better use of the generational GC. However, it is still probably a fairly expensive technique so I will follow it up with a diff that walks both nested array trees to do the diffing in a follow up. This is the first diff of several steps. @​public Reviewed By: @vjeux Differential Revision: D2440644 fb-gh-sync-id: 1d0da4f6e2bf716f33e119df947c044abb918471">Refactor Attribute Processing (Step 1)</a> <div class="blame-commit-meta"> <a href="/sebmarkbage" class="muted-link" rel="contributor">sebmarkbage</a> authored <time datetime="2015-10-06T02:19:16Z" is="relative-time">Oct 6, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="2"></td> <td class="blob-num blame-blob-num js-line-number" id="L126">126</td> <td class="blob-code blob-code-inner js-file-line" id="LC126"> updatePayload</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="4"> <a href="/facebook/react-native/commit/efae175a8e1b05c976cc5a1cbd492da71eb3bb12" class="blame-sha">efae175</a> <img alt="@sahrens" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/1509831?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/efae175a8e1b05c976cc5a1cbd492da71eb3bb12" class="blame-commit-title" title="[react-packager][streamline oss] Move open sourced JS source to react-native-github">[react-packager][streamline oss] Move open sourced JS source to react…</a> <div class="blame-commit-meta"> <a href="/sahrens" class="muted-link" rel="contributor">sahrens</a> authored <time datetime="2015-02-20T04:10:52Z" is="relative-time">Feb 20, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L127">127</td> <td class="blob-code blob-code-inner js-file-line" id="LC127"> );</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L128">128</td> <td class="blob-code blob-code-inner js-file-line" id="LC128"> },</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L129">129</td> <td class="blob-code blob-code-inner js-file-line" id="LC129"></td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="5"> <a href="/facebook/react-native/commit/381e2acd184fc4ba80a240ba3d7dda0464c6416b" class="blame-sha">381e2ac</a> <img alt="@corbt" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/176426?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/381e2acd184fc4ba80a240ba3d7dda0464c6416b" class="blame-commit-title" title="Document NativeMethodsMixin Summary: This is related to the discussion in #3155. I&#39;ve documented the methods in this mixin, and pointed to other appropriate documentation where necessary as well. I didn&#39;t end up adding any examples. I wanted to add a `focus()`/`blur()` example to the UIExplorer app, but the app seems to be broken on master at the moment (`Requiring unknown module &quot;event-target-shim&quot;`) and I didn&#39;t bother trying to fix it. I think the last thing necessary for making the usage of these methods clear is an example of calling one or more of them on a `ref` or view captured in some other way. However, `setNativeProps` is well documented in the &quot;Direct Manipulation&quot; guide, which I link to from this page, so by extension it should be possible to figure out the functionality of the other methods. cc @mkonicek @​astreet Closes https://github.com/facebook/react-native/pull/3238 Reviewed By: @​svcscm Differential Revision: D2517187 Pulled By: @mkonicek fb-gh-sync-id: 4e68b2bc44ace83f06ae2e364ca0c23a7c461b20">Document NativeMethodsMixin</a> <div class="blame-commit-meta"> <a href="/corbt" class="muted-link" rel="contributor">corbt</a> authored <time datetime="2015-10-07T16:32:35Z" is="relative-time">Oct 7, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="2"></td> <td class="blob-num blame-blob-num js-line-number" id="L130">130</td> <td class="blob-code blob-code-inner js-file-line" id="LC130"> <span class="pl-c">/**</span></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="2"></td> <td class="blob-num blame-blob-num js-line-number" id="L131">131</td> <td class="blob-code blob-code-inner js-file-line" id="LC131"><span class="pl-c"> * Requests focus for the given input or view. The exact behavior triggered</span></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="2"></td> <td class="blob-num blame-blob-num js-line-number" id="L132">132</td> <td class="blob-code blob-code-inner js-file-line" id="LC132"><span class="pl-c"> * will depend on the platform and type of view.</span></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="2"></td> <td class="blob-num blame-blob-num js-line-number" id="L133">133</td> <td class="blob-code blob-code-inner js-file-line" id="LC133"><span class="pl-c"> */</span></td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/efae175a8e1b05c976cc5a1cbd492da71eb3bb12" class="blame-sha">efae175</a> <img alt="@sahrens" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/1509831?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/efae175a8e1b05c976cc5a1cbd492da71eb3bb12" class="blame-commit-title" title="[react-packager][streamline oss] Move open sourced JS source to react-native-github">[react-packager][streamline oss] Move open sourced JS source to react…</a> <div class="blame-commit-meta"> <a href="/sahrens" class="muted-link" rel="contributor">sahrens</a> authored <time datetime="2015-02-20T04:10:52Z" is="relative-time">Feb 20, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L134">134</td> <td class="blob-code blob-code-inner js-file-line" id="LC134"> <span class="pl-en">focus</span><span class="pl-k">:</span> <span class="pl-k">function</span>() {</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/a0440daf98d525f77e21148c1702b92c577b7592" class="blame-sha">a0440da</a> <img alt="@spicyj" class="avatar blame-commit-avatar" height="32" src="https://avatars2.githubusercontent.com/u/6820?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/a0440daf98d525f77e21148c1702b92c577b7592" class="blame-commit-title" title="[react-native] Codemod .getNodeHandle, .getNativeNode to React.findNodeHandle">[react-native] Codemod .getNodeHandle, .getNativeNode to React.findNo…</a> <div class="blame-commit-meta"> <a href="/spicyj" class="muted-link" rel="contributor">spicyj</a> authored <time datetime="2015-05-13T01:55:13Z" is="relative-time">May 13, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L135">135</td> <td class="blob-code blob-code-inner js-file-line" id="LC135"> <span class="pl-smi">TextInputState</span>.<span class="pl-en">focusTextInput</span>(<span class="pl-en">findNodeHandle</span>(<span class="pl-v">this</span>));</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="3"> <a href="/facebook/react-native/commit/efae175a8e1b05c976cc5a1cbd492da71eb3bb12" class="blame-sha">efae175</a> <img alt="@sahrens" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/1509831?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/efae175a8e1b05c976cc5a1cbd492da71eb3bb12" class="blame-commit-title" title="[react-packager][streamline oss] Move open sourced JS source to react-native-github">[react-packager][streamline oss] Move open sourced JS source to react…</a> <div class="blame-commit-meta"> <a href="/sahrens" class="muted-link" rel="contributor">sahrens</a> authored <time datetime="2015-02-20T04:10:52Z" is="relative-time">Feb 20, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L136">136</td> <td class="blob-code blob-code-inner js-file-line" id="LC136"> },</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L137">137</td> <td class="blob-code blob-code-inner js-file-line" id="LC137"></td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="4"> <a href="/facebook/react-native/commit/381e2acd184fc4ba80a240ba3d7dda0464c6416b" class="blame-sha">381e2ac</a> <img alt="@corbt" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/176426?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/381e2acd184fc4ba80a240ba3d7dda0464c6416b" class="blame-commit-title" title="Document NativeMethodsMixin Summary: This is related to the discussion in #3155. I&#39;ve documented the methods in this mixin, and pointed to other appropriate documentation where necessary as well. I didn&#39;t end up adding any examples. I wanted to add a `focus()`/`blur()` example to the UIExplorer app, but the app seems to be broken on master at the moment (`Requiring unknown module &quot;event-target-shim&quot;`) and I didn&#39;t bother trying to fix it. I think the last thing necessary for making the usage of these methods clear is an example of calling one or more of them on a `ref` or view captured in some other way. However, `setNativeProps` is well documented in the &quot;Direct Manipulation&quot; guide, which I link to from this page, so by extension it should be possible to figure out the functionality of the other methods. cc @mkonicek @​astreet Closes https://github.com/facebook/react-native/pull/3238 Reviewed By: @​svcscm Differential Revision: D2517187 Pulled By: @mkonicek fb-gh-sync-id: 4e68b2bc44ace83f06ae2e364ca0c23a7c461b20">Document NativeMethodsMixin</a> <div class="blame-commit-meta"> <a href="/corbt" class="muted-link" rel="contributor">corbt</a> authored <time datetime="2015-10-07T16:32:35Z" is="relative-time">Oct 7, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="2"></td> <td class="blob-num blame-blob-num js-line-number" id="L138">138</td> <td class="blob-code blob-code-inner js-file-line" id="LC138"> <span class="pl-c">/**</span></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="2"></td> <td class="blob-num blame-blob-num js-line-number" id="L139">139</td> <td class="blob-code blob-code-inner js-file-line" id="LC139"><span class="pl-c"> * Removes focus from an input or view. This is the opposite of `focus()`.</span></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="2"></td> <td class="blob-num blame-blob-num js-line-number" id="L140">140</td> <td class="blob-code blob-code-inner js-file-line" id="LC140"><span class="pl-c"> */</span></td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/efae175a8e1b05c976cc5a1cbd492da71eb3bb12" class="blame-sha">efae175</a> <img alt="@sahrens" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/1509831?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/efae175a8e1b05c976cc5a1cbd492da71eb3bb12" class="blame-commit-title" title="[react-packager][streamline oss] Move open sourced JS source to react-native-github">[react-packager][streamline oss] Move open sourced JS source to react…</a> <div class="blame-commit-meta"> <a href="/sahrens" class="muted-link" rel="contributor">sahrens</a> authored <time datetime="2015-02-20T04:10:52Z" is="relative-time">Feb 20, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L141">141</td> <td class="blob-code blob-code-inner js-file-line" id="LC141"> <span class="pl-en">blur</span><span class="pl-k">:</span> <span class="pl-k">function</span>() {</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/a0440daf98d525f77e21148c1702b92c577b7592" class="blame-sha">a0440da</a> <img alt="@spicyj" class="avatar blame-commit-avatar" height="32" src="https://avatars2.githubusercontent.com/u/6820?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/a0440daf98d525f77e21148c1702b92c577b7592" class="blame-commit-title" title="[react-native] Codemod .getNodeHandle, .getNativeNode to React.findNodeHandle">[react-native] Codemod .getNodeHandle, .getNativeNode to React.findNo…</a> <div class="blame-commit-meta"> <a href="/spicyj" class="muted-link" rel="contributor">spicyj</a> authored <time datetime="2015-05-13T01:55:13Z" is="relative-time">May 13, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L142">142</td> <td class="blob-code blob-code-inner js-file-line" id="LC142"> <span class="pl-smi">TextInputState</span>.<span class="pl-en">blurTextInput</span>(<span class="pl-en">findNodeHandle</span>(<span class="pl-v">this</span>));</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="18"> <a href="/facebook/react-native/commit/efae175a8e1b05c976cc5a1cbd492da71eb3bb12" class="blame-sha">efae175</a> <img alt="@sahrens" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/1509831?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/efae175a8e1b05c976cc5a1cbd492da71eb3bb12" class="blame-commit-title" title="[react-packager][streamline oss] Move open sourced JS source to react-native-github">[react-packager][streamline oss] Move open sourced JS source to react…</a> <div class="blame-commit-meta"> <a href="/sahrens" class="muted-link" rel="contributor">sahrens</a> authored <time datetime="2015-02-20T04:10:52Z" is="relative-time">Feb 20, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L143">143</td> <td class="blob-code blob-code-inner js-file-line" id="LC143"> }</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L144">144</td> <td class="blob-code blob-code-inner js-file-line" id="LC144">};</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L145">145</td> <td class="blob-code blob-code-inner js-file-line" id="LC145"></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L146">146</td> <td class="blob-code blob-code-inner js-file-line" id="LC146"><span class="pl-k">function</span> <span class="pl-en">throwOnStylesProp</span>(<span class="pl-smi">component</span>, <span class="pl-smi">props</span>) {</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L147">147</td> <td class="blob-code blob-code-inner js-file-line" id="LC147"> <span class="pl-k">if</span> (<span class="pl-smi">props</span>.<span class="pl-smi">styles</span> <span class="pl-k">!==</span> <span class="pl-c1">undefined</span>) {</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L148">148</td> <td class="blob-code blob-code-inner js-file-line" id="LC148"> <span class="pl-k">var</span> owner <span class="pl-k">=</span> <span class="pl-smi">component</span>.<span class="pl-smi">_owner</span> <span class="pl-k">||</span> <span class="pl-c1">null</span>;</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L149">149</td> <td class="blob-code blob-code-inner js-file-line" id="LC149"> <span class="pl-k">var</span> name <span class="pl-k">=</span> <span class="pl-smi">component</span>.<span class="pl-c1">constructor</span>.<span class="pl-smi">displayName</span>;</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L150">150</td> <td class="blob-code blob-code-inner js-file-line" id="LC150"> <span class="pl-k">var</span> msg <span class="pl-k">=</span> <span class="pl-s"><span class="pl-pds">&#39;</span>`styles` is not a supported property of `<span class="pl-pds">&#39;</span></span> <span class="pl-k">+</span> name <span class="pl-k">+</span> <span class="pl-s"><span class="pl-pds">&#39;</span>`, did <span class="pl-pds">&#39;</span></span> <span class="pl-k">+</span></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L151">151</td> <td class="blob-code blob-code-inner js-file-line" id="LC151"> <span class="pl-s"><span class="pl-pds">&#39;</span>you mean `style` (singular)?<span class="pl-pds">&#39;</span></span>;</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L152">152</td> <td class="blob-code blob-code-inner js-file-line" id="LC152"> <span class="pl-k">if</span> (owner <span class="pl-k">&amp;&amp;</span> <span class="pl-smi">owner</span>.<span class="pl-c1">constructor</span> <span class="pl-k">&amp;&amp;</span> <span class="pl-smi">owner</span>.<span class="pl-c1">constructor</span>.<span class="pl-smi">displayName</span>) {</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L153">153</td> <td class="blob-code blob-code-inner js-file-line" id="LC153"> msg <span class="pl-k">+=</span> <span class="pl-s"><span class="pl-pds">&#39;</span><span class="pl-cce">\n\n</span>Check the `<span class="pl-pds">&#39;</span></span> <span class="pl-k">+</span> <span class="pl-smi">owner</span>.<span class="pl-c1">constructor</span>.<span class="pl-smi">displayName</span> <span class="pl-k">+</span> <span class="pl-s"><span class="pl-pds">&#39;</span>` parent <span class="pl-pds">&#39;</span></span> <span class="pl-k">+</span></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L154">154</td> <td class="blob-code blob-code-inner js-file-line" id="LC154"> <span class="pl-s"><span class="pl-pds">&#39;</span> component.<span class="pl-pds">&#39;</span></span>;</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L155">155</td> <td class="blob-code blob-code-inner js-file-line" id="LC155"> }</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L156">156</td> <td class="blob-code blob-code-inner js-file-line" id="LC156"> <span class="pl-k">throw</span> <span class="pl-k">new</span> <span class="pl-en">Error</span>(msg);</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L157">157</td> <td class="blob-code blob-code-inner js-file-line" id="LC157"> }</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L158">158</td> <td class="blob-code blob-code-inner js-file-line" id="LC158">}</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L159">159</td> <td class="blob-code blob-code-inner js-file-line" id="LC159"><span class="pl-k">if</span> (__DEV__) {</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="5"> <a href="/facebook/react-native/commit/7ffa7942aac63767372a632f98a2e12b8847b09a" class="blame-sha">7ffa794</a> <img alt="@mroch" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/3012?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/7ffa7942aac63767372a632f98a2e12b8847b09a" class="blame-commit-title" title="flowify Libraries/ReactIOS">flowify Libraries/ReactIOS</a> <div class="blame-commit-meta"> <a href="/mroch" class="muted-link" rel="contributor">mroch</a> authored <time datetime="2015-03-26T00:49:46Z" is="relative-time">Mar 26, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L160">160</td> <td class="blob-code blob-code-inner js-file-line" id="LC160"> <span class="pl-c">// hide this from Flow since we can&#39;t define these properties outside of</span></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L161">161</td> <td class="blob-code blob-code-inner js-file-line" id="LC161"> <span class="pl-c">// __DEV__ without actually implementing them (setting them to undefined</span></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L162">162</td> <td class="blob-code blob-code-inner js-file-line" id="LC162"> <span class="pl-c">// isn&#39;t allowed by ReactClass)</span></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L163">163</td> <td class="blob-code blob-code-inner js-file-line" id="LC163"> <span class="pl-k">var</span> NativeMethodsMixin_DEV <span class="pl-k">=</span> (NativeMethodsMixin<span class="pl-k">:</span> any);</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/efae175a8e1b05c976cc5a1cbd492da71eb3bb12" class="blame-sha">efae175</a> <img alt="@sahrens" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/1509831?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/efae175a8e1b05c976cc5a1cbd492da71eb3bb12" class="blame-commit-title" title="[react-packager][streamline oss] Move open sourced JS source to react-native-github">[react-packager][streamline oss] Move open sourced JS source to react…</a> <div class="blame-commit-meta"> <a href="/sahrens" class="muted-link" rel="contributor">sahrens</a> authored <time datetime="2015-02-20T04:10:52Z" is="relative-time">Feb 20, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L164">164</td> <td class="blob-code blob-code-inner js-file-line" id="LC164"> <span class="pl-en">invariant</span>(</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="3"> <a href="/facebook/react-native/commit/7ffa7942aac63767372a632f98a2e12b8847b09a" class="blame-sha">7ffa794</a> <img alt="@mroch" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/3012?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/7ffa7942aac63767372a632f98a2e12b8847b09a" class="blame-commit-title" title="flowify Libraries/ReactIOS">flowify Libraries/ReactIOS</a> <div class="blame-commit-meta"> <a href="/mroch" class="muted-link" rel="contributor">mroch</a> authored <time datetime="2015-03-26T00:49:46Z" is="relative-time">Mar 26, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L165">165</td> <td class="blob-code blob-code-inner js-file-line" id="LC165"> <span class="pl-k">!</span><span class="pl-smi">NativeMethodsMixin_DEV</span>.<span class="pl-smi">componentWillMount</span> <span class="pl-k">&amp;&amp;</span></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L166">166</td> <td class="blob-code blob-code-inner js-file-line" id="LC166"> <span class="pl-k">!</span><span class="pl-smi">NativeMethodsMixin_DEV</span>.<span class="pl-smi">componentWillReceiveProps</span>,</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="3"> <a href="/facebook/react-native/commit/efae175a8e1b05c976cc5a1cbd492da71eb3bb12" class="blame-sha">efae175</a> <img alt="@sahrens" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/1509831?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/efae175a8e1b05c976cc5a1cbd492da71eb3bb12" class="blame-commit-title" title="[react-packager][streamline oss] Move open sourced JS source to react-native-github">[react-packager][streamline oss] Move open sourced JS source to react…</a> <div class="blame-commit-meta"> <a href="/sahrens" class="muted-link" rel="contributor">sahrens</a> authored <time datetime="2015-02-20T04:10:52Z" is="relative-time">Feb 20, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L167">167</td> <td class="blob-code blob-code-inner js-file-line" id="LC167"> <span class="pl-s"><span class="pl-pds">&#39;</span>Do not override existing functions.<span class="pl-pds">&#39;</span></span></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L168">168</td> <td class="blob-code blob-code-inner js-file-line" id="LC168"> );</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/7ffa7942aac63767372a632f98a2e12b8847b09a" class="blame-sha">7ffa794</a> <img alt="@mroch" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/3012?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/7ffa7942aac63767372a632f98a2e12b8847b09a" class="blame-commit-title" title="flowify Libraries/ReactIOS">flowify Libraries/ReactIOS</a> <div class="blame-commit-meta"> <a href="/mroch" class="muted-link" rel="contributor">mroch</a> authored <time datetime="2015-03-26T00:49:46Z" is="relative-time">Mar 26, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L169">169</td> <td class="blob-code blob-code-inner js-file-line" id="LC169"> <span class="pl-c1">NativeMethodsMixin_DEV</span>.<span class="pl-en">componentWillMount</span> <span class="pl-k">=</span> <span class="pl-k">function</span> () {</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="3"> <a href="/facebook/react-native/commit/efae175a8e1b05c976cc5a1cbd492da71eb3bb12" class="blame-sha">efae175</a> <img alt="@sahrens" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/1509831?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/efae175a8e1b05c976cc5a1cbd492da71eb3bb12" class="blame-commit-title" title="[react-packager][streamline oss] Move open sourced JS source to react-native-github">[react-packager][streamline oss] Move open sourced JS source to react…</a> <div class="blame-commit-meta"> <a href="/sahrens" class="muted-link" rel="contributor">sahrens</a> authored <time datetime="2015-02-20T04:10:52Z" is="relative-time">Feb 20, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L170">170</td> <td class="blob-code blob-code-inner js-file-line" id="LC170"> <span class="pl-en">throwOnStylesProp</span>(<span class="pl-v">this</span>, <span class="pl-smi">this</span>.<span class="pl-smi">props</span>);</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L171">171</td> <td class="blob-code blob-code-inner js-file-line" id="LC171"> };</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/7ffa7942aac63767372a632f98a2e12b8847b09a" class="blame-sha">7ffa794</a> <img alt="@mroch" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/3012?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/7ffa7942aac63767372a632f98a2e12b8847b09a" class="blame-commit-title" title="flowify Libraries/ReactIOS">flowify Libraries/ReactIOS</a> <div class="blame-commit-meta"> <a href="/mroch" class="muted-link" rel="contributor">mroch</a> authored <time datetime="2015-03-26T00:49:46Z" is="relative-time">Mar 26, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="8"></td> <td class="blob-num blame-blob-num js-line-number" id="L172">172</td> <td class="blob-code blob-code-inner js-file-line" id="LC172"> <span class="pl-c1">NativeMethodsMixin_DEV</span>.<span class="pl-en">componentWillReceiveProps</span> <span class="pl-k">=</span> <span class="pl-k">function</span> (<span class="pl-smi">newProps</span>) {</td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="5"> <a href="/facebook/react-native/commit/efae175a8e1b05c976cc5a1cbd492da71eb3bb12" class="blame-sha">efae175</a> <img alt="@sahrens" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/1509831?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/efae175a8e1b05c976cc5a1cbd492da71eb3bb12" class="blame-commit-title" title="[react-packager][streamline oss] Move open sourced JS source to react-native-github">[react-packager][streamline oss] Move open sourced JS source to react…</a> <div class="blame-commit-meta"> <a href="/sahrens" class="muted-link" rel="contributor">sahrens</a> authored <time datetime="2015-02-20T04:10:52Z" is="relative-time">Feb 20, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L173">173</td> <td class="blob-code blob-code-inner js-file-line" id="LC173"> <span class="pl-en">throwOnStylesProp</span>(<span class="pl-v">this</span>, newProps);</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L174">174</td> <td class="blob-code blob-code-inner js-file-line" id="LC174"> };</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L175">175</td> <td class="blob-code blob-code-inner js-file-line" id="LC175">}</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L176">176</td> <td class="blob-code blob-code-inner js-file-line" id="LC176"></td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="14"> <a href="/facebook/react-native/commit/4771806c449f0cb9f861055819de8d883cbd845b" class="blame-sha">4771806</a> <img alt="@sahrens" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/1509831?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/4771806c449f0cb9f861055819de8d883cbd845b" class="blame-commit-title" title="[ReactNative] Fix some mount callback issues">[ReactNative] Fix some mount callback issues</a> <div class="blame-commit-meta"> <a href="/sahrens" class="muted-link" rel="contributor">sahrens</a> authored <time datetime="2015-05-15T17:54:25Z" is="relative-time">May 15, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L177">177</td> <td class="blob-code blob-code-inner js-file-line" id="LC177"><span class="pl-c">/**</span></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L178">178</td> <td class="blob-code blob-code-inner js-file-line" id="LC178"><span class="pl-c"> * In the future, we should cleanup callbacks by cancelling them instead of</span></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L179">179</td> <td class="blob-code blob-code-inner js-file-line" id="LC179"><span class="pl-c"> * using this.</span></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L180">180</td> <td class="blob-code blob-code-inner js-file-line" id="LC180"><span class="pl-c"> */</span></td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L181">181</td> <td class="blob-code blob-code-inner js-file-line" id="LC181"><span class="pl-k">var</span> <span class="pl-en">mountSafeCallback</span> <span class="pl-k">=</span> <span class="pl-k">function</span>(<span class="pl-smi">context</span>: <span class="pl-smi">ReactComponent</span>, <span class="pl-smi">callback</span>: ?<span class="pl-smi">Function</span>)<span class="pl-k">:</span> any {</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L182">182</td> <td class="blob-code blob-code-inner js-file-line" id="LC182"> <span class="pl-k">return</span> <span class="pl-k">function</span>() {</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L183">183</td> <td class="blob-code blob-code-inner js-file-line" id="LC183"> <span class="pl-k">if</span> (<span class="pl-k">!</span>callback <span class="pl-k">||</span> (<span class="pl-smi">context</span>.<span class="pl-smi">isMounted</span> <span class="pl-k">&amp;&amp;</span> <span class="pl-k">!</span><span class="pl-smi">context</span>.<span class="pl-en">isMounted</span>())) {</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L184">184</td> <td class="blob-code blob-code-inner js-file-line" id="LC184"> <span class="pl-k">return</span>;</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L185">185</td> <td class="blob-code blob-code-inner js-file-line" id="LC185"> }</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L186">186</td> <td class="blob-code blob-code-inner js-file-line" id="LC186"> <span class="pl-k">return</span> <span class="pl-smi">callback</span>.<span class="pl-c1">apply</span>(context, arguments);</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L187">187</td> <td class="blob-code blob-code-inner js-file-line" id="LC187"> };</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L188">188</td> <td class="blob-code blob-code-inner js-file-line" id="LC188">};</td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="7"></td> <td class="blob-num blame-blob-num js-line-number" id="L189">189</td> <td class="blob-code blob-code-inner js-file-line" id="LC189"></td> </tr> <tr class="blame-commit"> <td class="blame-commit-info" rowspan="2"> <a href="/facebook/react-native/commit/efae175a8e1b05c976cc5a1cbd492da71eb3bb12" class="blame-sha">efae175</a> <img alt="@sahrens" class="avatar blame-commit-avatar" height="32" src="https://avatars3.githubusercontent.com/u/1509831?v=3&amp;s=64" width="32" /> <a href="/facebook/react-native/commit/efae175a8e1b05c976cc5a1cbd492da71eb3bb12" class="blame-commit-title" title="[react-packager][streamline oss] Move open sourced JS source to react-native-github">[react-packager][streamline oss] Move open sourced JS source to react…</a> <div class="blame-commit-meta"> <a href="/sahrens" class="muted-link" rel="contributor">sahrens</a> authored <time datetime="2015-02-20T04:10:52Z" is="relative-time">Feb 20, 2015</time> </div> </td> </tr> <tr class="blame-line"> <td class="line-age heat" data-heat="9"></td> <td class="blob-num blame-blob-num js-line-number" id="L190">190</td> <td class="blob-code blob-code-inner js-file-line" id="LC190"><span class="pl-smi">module</span>.<span class="pl-smi">exports</span> <span class="pl-k">=</span> NativeMethodsMixin;</td> </tr> </table> </div> </div> </div> <div class="modal-backdrop"></div> </div> </div> </div> </div> <div class="container"> <div class="site-footer" role="contentinfo"> <ul class="site-footer-links right"> <li><a href="https://status.github.com/" data-ga-click="Footer, go to status, text:status">Status</a></li> <li><a href="https://developer.github.com" data-ga-click="Footer, go to api, text:api">API</a></li> <li><a href="https://training.github.com" data-ga-click="Footer, go to training, text:training">Training</a></li> <li><a href="https://shop.github.com" data-ga-click="Footer, go to shop, text:shop">Shop</a></li> <li><a href="https://github.com/blog" data-ga-click="Footer, go to blog, text:blog">Blog</a></li> <li><a href="https://github.com/about" data-ga-click="Footer, go to about, text:about">About</a></li> <li><a href="https://github.com/pricing" data-ga-click="Footer, go to pricing, text:pricing">Pricing</a></li> </ul> <a href="https://github.com" aria-label="Homepage"> <span class="mega-octicon octicon-mark-github" title="GitHub"></span> </a> <ul class="site-footer-links"> <li>&copy; 2015 <span title="0.05716s from github-fe134-cp1-prd.iad.github.net">GitHub</span>, Inc.</li> <li><a href="https://github.com/site/terms" data-ga-click="Footer, go to terms, text:terms">Terms</a></li> <li><a href="https://github.com/site/privacy" data-ga-click="Footer, go to privacy, text:privacy">Privacy</a></li> <li><a href="https://github.com/security" data-ga-click="Footer, go to security, text:security">Security</a></li> <li><a href="https://github.com/contact" data-ga-click="Footer, go to contact, text:contact">Contact</a></li> <li><a href="https://help.github.com" data-ga-click="Footer, go to help, text:help">Help</a></li> </ul> </div> </div> <div id="ajax-error-message" class="flash flash-error"> <span class="octicon octicon-alert"></span> <button type="button" class="flash-close js-flash-close js-ajax-error-dismiss" aria-label="Dismiss error"> <span class="octicon octicon-x"></span> </button> Something went wrong with that request. Please try again. </div> <script crossorigin="anonymous" src="https://assets-cdn.github.com/assets/frameworks-ca4183ce112a8e8984270469e316f4700bbe45a08e1545d359a2df9ba18a85b6.js"></script> <script async="async" crossorigin="anonymous" src="https://assets-cdn.github.com/assets/github-07413b5e0147434fe39f7f96545ef359ef45ca5051a44ec3b8e8d410a4a47988.js"></script> <div class="js-stale-session-flash stale-session-flash flash flash-warn flash-banner hidden"> <span class="octicon octicon-alert"></span> <span class="signed-in-tab-flash">You signed in with another tab or window. <a href="">Reload</a> to refresh your session.</span> <span class="signed-out-tab-flash">You signed out in another tab or window. <a href="">Reload</a> to refresh your session.</span> </div> </body> </html> <|start_filename|>app.json<|end_filename|> { "name": "mention-bot", "description": "Automatically mention potential reviewers on pull requests.", "repository": "https://github.com/facebook/mention-bot", "logo": "https://avatars0.githubusercontent.com/u/15710697", "keywords": ["node", "express", "github", "pull requests"], "env": { "GITHUB_TOKEN": { "description": "A token generated for the account which will comment on your pull requests.", "required": true }, "GITHUB_USER": { "description": "If you want mention-bot to work with private repos, you need to add your github login", "required": false }, "GITHUB_PASSWORD": { "description": "Password for Github account.", "required": false } } }
sparkbox/mention-bot
<|start_filename|>include/camp/resource/sycl.hpp<|end_filename|> /* Copyright (c) 2016-18, Lawrence Livermore National Security, LLC. Produced at the Lawrence Livermore National Laboratory Maintained by <NAME> <<EMAIL>> CODE-756261, All rights reserved. This file is part of camp. For details about use and distribution, please read LICENSE and NOTICE from http://github.com/llnl/camp */ #ifndef __CAMP_SYCL_HPP #define __CAMP_SYCL_HPP #include "camp/defines.hpp" #include "camp/resource/event.hpp" #include "camp/resource/platform.hpp" #ifdef CAMP_ENABLE_SYCL #include <CL/sycl.hpp> #include <map> using namespace cl; namespace camp { namespace resources { inline namespace v1 { class SyclEvent { public: SyclEvent(sycl::queue *qu) { m_event = sycl::event(); } bool check() const { return true; } void wait() const { getSyclEvent_t().wait(); } sycl::event getSyclEvent_t() const { return m_event; } private: sycl::event m_event; }; class Sycl { static sycl::queue *get_a_queue(sycl::context &syclContext, int num, bool useContext) { static sycl::gpu_selector gpuSelector; static sycl::property_list propertyList = sycl::property_list(sycl::property::queue::in_order()); static sycl::context privateContext; static sycl::context *contextInUse = NULL; static std::map<sycl::context *, std::array<sycl::queue, 16>> queueMap; static std::mutex m_mtx; m_mtx.lock(); // User passed a context, use it if (useContext) { contextInUse = &syclContext; if (queueMap.find(contextInUse) == queueMap.end()) { queueMap[contextInUse] = { sycl::queue(*contextInUse, gpuSelector, propertyList), sycl::queue(*contextInUse, gpuSelector, propertyList), sycl::queue(*contextInUse, gpuSelector, propertyList), sycl::queue(*contextInUse, gpuSelector, propertyList), sycl::queue(*contextInUse, gpuSelector, propertyList), sycl::queue(*contextInUse, gpuSelector, propertyList), sycl::queue(*contextInUse, gpuSelector, propertyList), sycl::queue(*contextInUse, gpuSelector, propertyList), sycl::queue(*contextInUse, gpuSelector, propertyList), sycl::queue(*contextInUse, gpuSelector, propertyList), sycl::queue(*contextInUse, gpuSelector, propertyList), sycl::queue(*contextInUse, gpuSelector, propertyList), sycl::queue(*contextInUse, gpuSelector, propertyList), sycl::queue(*contextInUse, gpuSelector, propertyList), sycl::queue(*contextInUse, gpuSelector, propertyList), sycl::queue(*contextInUse, gpuSelector, propertyList)}; } } else { // User did not pass context, use last used or private one if (contextInUse == NULL) { contextInUse = &privateContext; queueMap[contextInUse] = { sycl::queue(*contextInUse, gpuSelector, propertyList), sycl::queue(*contextInUse, gpuSelector, propertyList), sycl::queue(*contextInUse, gpuSelector, propertyList), sycl::queue(*contextInUse, gpuSelector, propertyList), sycl::queue(*contextInUse, gpuSelector, propertyList), sycl::queue(*contextInUse, gpuSelector, propertyList), sycl::queue(*contextInUse, gpuSelector, propertyList), sycl::queue(*contextInUse, gpuSelector, propertyList), sycl::queue(*contextInUse, gpuSelector, propertyList), sycl::queue(*contextInUse, gpuSelector, propertyList), sycl::queue(*contextInUse, gpuSelector, propertyList), sycl::queue(*contextInUse, gpuSelector, propertyList), sycl::queue(*contextInUse, gpuSelector, propertyList), sycl::queue(*contextInUse, gpuSelector, propertyList), sycl::queue(*contextInUse, gpuSelector, propertyList), sycl::queue(*contextInUse, gpuSelector, propertyList)}; } } m_mtx.unlock(); static int previous = 0; static std::once_flag m_onceFlag; if (num < 0) { m_mtx.lock(); previous = (previous + 1) % 16; m_mtx.unlock(); return &queueMap[contextInUse][previous]; } return &queueMap[contextInUse][num % 16]; } public: Sycl(int group = -1) { sycl::context temp; qu = get_a_queue(temp, group, false); } Sycl(sycl::context &syclContext, int group = -1) : qu(get_a_queue(syclContext, group, true)) { } // Methods Platform get_platform() { return Platform::sycl; } static Sycl get_default() { static Sycl h; return h; } SyclEvent get_event() { return SyclEvent(get_queue()); } Event get_event_erased() { return Event{SyclEvent(get_queue())}; } void wait() { qu->wait(); } void wait_for(Event *e) { auto *sycl_event = e->try_get<SyclEvent>(); if (sycl_event) { (sycl_event->getSyclEvent_t()).wait(); } else { e->wait(); } } // Memory template <typename T> T *allocate(size_t size, MemoryAccess ma = MemoryAccess::Device) { T *ret = nullptr; if (size > 0) { ret = sycl::malloc_shared<T>(size, *qu); switch (ma) { case MemoryAccess::Unknown: case MemoryAccess::Device: ret = sycl::malloc_device<T>(size, *qu); break; case MemoryAccess::Pinned: ret = sycl::malloc_host<T>(size, *qu); break; case MemoryAccess::Managed: ret = sycl::malloc_shared<T>(size, *qu); break; } } return ret; } void *calloc(size_t size, MemoryAccess ma = MemoryAccess::Device) { void *p = allocate<char>(size, ma); this->memset(p, 0, size); return p; } void deallocate(void *p, MemoryAccess ma = MemoryAccess::Device) { sycl::free(p, *qu); } void memcpy(void *dst, const void *src, size_t size) { if (size > 0) { qu->memcpy(dst, src, size).wait(); } } void memset(void *p, int val, size_t size) { if (size > 0) { qu->memset(p, val, size).wait(); } } sycl::queue *get_queue() { return qu; } private: sycl::queue *qu; }; } // namespace v1 } // namespace resources } // namespace camp #endif //#ifdef CAMP_ENABLE_SYCL #endif /* __CAMP_SYCL_HPP */ <|start_filename|>Dockerfile<|end_filename|> ############################################################################### # Copyright (c) 2016-21, Lawrence Livermore National Security, LLC # and RAJA project contributors. See the RAJA/COPYRIGHT file for details. # # SPDX-License-Identifier: (BSD-3-Clause) ############################################################################### ARG BASE_IMG=gcc ARG COMPILER=g++ ARG VER=latest ARG PRE_CMD="true" ARG BUILD_TYPE=RelWithDebInfo ARG CTEST_EXTRA="-E '(.*offload|blt.*smoke)'" ARG CTEST_OPTIONS="${CTEST_EXTRA} -T test -V " ARG CMAKE_EXTRA="" ARG CMAKE_OPTIONS="-G Ninja -B build ${CMAKE_EXTRA} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DENABLE_WARNINGS=On" ARG PARALLEL=4 ARG BUILD_EXTRA="" ARG CMAKE_BUILD_OPTS="--build build --verbose --parallel ${PARALLEL} ${BUILD_EXTRA}" ARG CUDA_IMG_SUFFIX="-devel-ubuntu18.04" FROM ubuntu:bionic AS clang_base RUN apt-get update && apt-get install -y --no-install-recommends gpg gpg-agent wget curl software-properties-common unzip && apt-get clean && rm -rf /var/lib/apt/lists/* ### start compiler base images ### # there is no official container in the hub, but there is an official script # to install clang/llvm by version, installs a bit more than we need, but we # do not have to maintain it, so I'm alright with that FROM clang_base AS clang ARG VER ADD ./scripts/get-llvm.sh get-llvm.sh RUN ./get-llvm.sh $VER bah FROM gcc:${VER} AS gcc FROM nvidia/cuda:${VER}${CUDA_IMG_SUFFIX} AS nvcc FROM nvcr.io/nvidia/nvhpc:21.9-devel-cuda11.4-ubuntu20.04 AS nvhpc FROM rocm/dev-ubuntu-20.04:${VER} AS rocm # use the runtime container and then have it install the compiler, # save us a few gigabytes every time FROM intel/oneapi-runtime:${VER} AS oneapi ARG DEBIAN_FRONTEND=noninteractive ARG APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 RUN apt-get update -y && \ apt-get install -y --no-install-recommends \ intel-oneapi-compiler-dpcpp-cpp && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* # inject all setvars stuff into environment file RUN bash -c 'echo . /opt/intel/oneapi/setvars.sh >> ~/setup_env.sh' ### end compiler base images ### FROM ${BASE_IMG} AS base ARG VER ARG BASE_IMG ENV GTEST_COLOR=1 COPY --chown=axom:axom ./scripts/ /scripts/ WORKDIR /home/ RUN /scripts/get-deps.sh # This is duplicative, but allows us to cache the dep installation while # changing the sources and scripts, saves time in the development loop COPY --chown=axom:axom . /home/ FROM base AS test ARG PRE_CMD ARG CTEST_OPTIONS ARG CMAKE_OPTIONS ARG CMAKE_BUILD_OPTS ARG COMPILER ENV COMPILER=${COMPILER:-g++} ENV HCC_AMDGPU_TARGET=gfx900 RUN /bin/bash -c "[[ -f ~/setup_env.sh ]] && source ~/setup_env.sh ; ${PRE_CMD} && cmake ${CMAKE_OPTIONS} -DCMAKE_CXX_COMPILER=${COMPILER} ." RUN /bin/bash -c "[[ -f ~/setup_env.sh ]] && source ~/setup_env.sh ; ${PRE_CMD} && cmake ${CMAKE_BUILD_OPTS}" RUN /bin/bash -c "[[ -f ~/setup_env.sh ]] && source ~/setup_env.sh ; ${PRE_CMD} && cd build && ctest ${CTEST_OPTIONS}" # this is here to stop azure from downloading oneapi for every test FROM alpine AS download_fast
LLNL/camp
<|start_filename|>staash-core/src/main/java/com/netflix/paas/dao/DaoSchema.java<|end_filename|> /******************************************************************************* * /*** * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * ******************************************************************************/ package com.netflix.paas.dao; import java.util.Collection; public interface DaoSchema { /** * Create the underlying storage for the schema. Does not create the Daos */ public void createSchema(); /** * Delete store for the schema and all child daos */ public void dropSchema(); /** * Get a dao for this type * @param type * @return */ public <T> Dao<T> getDao(Class<T> type); /** * Retrive all Daos managed by this schema * @return */ public Collection<Dao<?>> listDaos(); /** * Determine if the storage for this schema exists * @return */ public boolean isExists(); } <|start_filename|>staash-web/src/test/java/com/netflix/staash/test/core/RequiresKeyspace.java<|end_filename|> package com.netflix.staash.test.core; import org.apache.cassandra.locator.AbstractReplicationStrategy; import org.apache.cassandra.locator.SimpleStrategy; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.TYPE, ElementType.METHOD}) public @interface RequiresKeyspace { String ksName(); int replication() default 1; Class<? extends AbstractReplicationStrategy> strategy() default SimpleStrategy.class; String strategyOptions() default ""; } <|start_filename|>staash-core/src/main/java/com/netflix/paas/resources/BootstrapResource.java<|end_filename|> /******************************************************************************* * /*** * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * ******************************************************************************/ package com.netflix.paas.resources; import java.util.List; import javax.ws.rs.Path; import com.google.common.base.Function; import com.google.common.collect.Collections2; import com.google.common.collect.Lists; import com.google.inject.Inject; import com.google.inject.Singleton; import com.netflix.paas.SchemaNames; import com.netflix.paas.dao.Dao; import com.netflix.paas.dao.DaoSchema; import com.netflix.paas.dao.DaoSchemaProvider; import com.netflix.paas.dao.DaoProvider; import com.netflix.paas.dao.DaoStatus; import com.netflix.paas.exceptions.NotFoundException; @Path("/1/setup") @Singleton /** * API to set up storage for the PAAS application * * @author elandau */ public class BootstrapResource { private DaoProvider daoProvider; @Inject public BootstrapResource(DaoProvider daoProvider) { this.daoProvider = daoProvider; } @Path("storage/create") public void createStorage() throws NotFoundException { DaoSchema schema = daoProvider.getSchema(SchemaNames.CONFIGURATION.name()); if (!schema.isExists()) { schema.createSchema(); } for (Dao<?> dao : schema.listDaos()) { dao.createTable(); } } @Path("storage/status") public List<DaoStatus> getStorageStatus() throws NotFoundException { return Lists.newArrayList(Collections2.transform( daoProvider.getSchema(SchemaNames.CONFIGURATION.name()).listDaos(), new Function<Dao<?>, DaoStatus>() { @Override public DaoStatus apply(Dao<?> dao) { return dao; } })); } } <|start_filename|>staash-mesh/src/main/java/com/netflix/staash/mesh/db/Topic.java<|end_filename|> /******************************************************************************* * /*** * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * ******************************************************************************/ package com.netflix.staash.mesh.db; public interface Topic { /** * Insert an entry into the topic * @param tuple * @return */ public boolean upsert(Entry tuple); /** * Read an entry from the topic * @param key * @return */ public Entry read(String key); /** * Delete an entry from the topic * @param tuple * @return */ public boolean delete(Entry tuple); /** * Get the topic name * @return */ public String getName(); /** * Get the deleted time of the topic. * @return Time topic was deleted of 0 if it was not */ public long getDeletedTime(); /** * Get the time when the topic was created * @return */ public long getCreatedTime(); /** * Get the number of entries in the topic * @return */ public long getEntryCount(); /** * Make the topic as having been deleted. Delete will only apply * if the topic last modified timestamp is less than the deleted time * @param timestamp * @return */ public boolean deleteTopic(long timestamp); } <|start_filename|>staash-core/src/main/java/com/netflix/paas/tasks/TaskContext.java<|end_filename|> /******************************************************************************* * /*** * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * ******************************************************************************/ package com.netflix.paas.tasks; import java.util.Map; public class TaskContext { private final Map<String, Object> parameters; private final String className; public TaskContext(Class<?> className, Map<String, Object> arguments) { this.className = className.getCanonicalName(); this.parameters = arguments; } public Object getParamater(String key) { return this.parameters.get(key); } public String getStringParameter(String key) { return (String)getParamater(key); } public String getStringParameter(String key, String defaultValue) { Object value = getParamater(key); return (value == null) ? defaultValue : (String)value; } public Boolean getBooleanParameter(String key) { return (Boolean)getParamater(key); } public Boolean getBooleanParameter(String key, Boolean defaultValue) { Object value = getParamater(key); return (value == null) ? defaultValue : (Boolean)value; } public Integer getIntegerParameter(String key) { return (Integer)getParamater(key); } public Integer getIntegerParameter(String key, Integer defaultValue) { Object value = getParamater(key); return (value == null) ? defaultValue : (Integer)value; } public Long getLongParameter(String key) { return (Long)getParamater(key); } public Long getLongParameter(String key, Long defaultValue) { Object value = getParamater(key); return (value == null) ? defaultValue : (Long)value; } public String getClassName(String className) { return this.className; } public String getKey() { if (parameters == null || !parameters.containsKey("key")) return className; return className + "$" + parameters.get("key"); } } <|start_filename|>staash-astyanax/src/main/java/com/netflix/paas/cassandra/provider/impl/DefaultAstyanaxClusterClientProvider.java<|end_filename|> /******************************************************************************* * /*** * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * ******************************************************************************/ package com.netflix.paas.cassandra.provider.impl; import java.util.Map; import java.util.concurrent.atomic.AtomicLong; import org.apache.commons.configuration.AbstractConfiguration; import com.google.common.base.Preconditions; import com.google.common.collect.Maps; import com.google.inject.Inject; import com.netflix.astyanax.AstyanaxContext; import com.netflix.astyanax.Cluster; import com.netflix.astyanax.thrift.ThriftFamilyFactory; import com.netflix.paas.cassandra.keys.ClusterKey; import com.netflix.paas.cassandra.provider.AstyanaxConfigurationProvider; import com.netflix.paas.cassandra.provider.AstyanaxConnectionPoolConfigurationProvider; import com.netflix.paas.cassandra.provider.AstyanaxConnectionPoolMonitorProvider; import com.netflix.paas.cassandra.provider.ClusterClientProvider; import com.netflix.paas.cassandra.provider.HostSupplierProvider; public class DefaultAstyanaxClusterClientProvider implements ClusterClientProvider { /** * Track cluster references * * @author elandau * */ public static class ClusterContextHolder { private AstyanaxContext<Cluster> context; private AtomicLong refCount = new AtomicLong(0); public ClusterContextHolder(AstyanaxContext<Cluster> context) { this.context = context; } public Cluster getKeyspace() { return context.getClient(); } public void start() { context.start(); } public void shutdown() { context.shutdown(); } public long addRef() { return refCount.incrementAndGet(); } public long releaseRef() { return refCount.decrementAndGet(); } } private final Map<String, ClusterContextHolder> contextMap = Maps.newHashMap(); private final AstyanaxConfigurationProvider configurationProvider; private final AstyanaxConnectionPoolConfigurationProvider cpProvider; private final AstyanaxConnectionPoolMonitorProvider monitorProvider; private final Map<String, HostSupplierProvider> hostSupplierProviders; private final AbstractConfiguration configuration; @Inject public DefaultAstyanaxClusterClientProvider( AbstractConfiguration configuration, Map<String, HostSupplierProvider> hostSupplierProviders, AstyanaxConfigurationProvider configurationProvider, AstyanaxConnectionPoolConfigurationProvider cpProvider, AstyanaxConnectionPoolMonitorProvider monitorProvider) { this.configurationProvider = configurationProvider; this.cpProvider = cpProvider; this.monitorProvider = monitorProvider; this.hostSupplierProviders = hostSupplierProviders; this.configuration = configuration; } @Override public synchronized Cluster acquireCluster(ClusterKey clusterKey) { String clusterName = clusterKey.getClusterName().toLowerCase(); Preconditions.checkNotNull(clusterName, "Invalid cluster name 'null'"); ClusterContextHolder holder = contextMap.get(clusterName); if (holder == null) { HostSupplierProvider hostSupplierProvider = hostSupplierProviders.get(clusterKey.getDiscoveryType()); Preconditions.checkNotNull(hostSupplierProvider, String.format("Unknown host supplier provider '%s' for cluster '%s'", clusterKey.getDiscoveryType(), clusterName)); AstyanaxContext<Cluster> context = new AstyanaxContext.Builder() .forCluster(clusterName) .withAstyanaxConfiguration(configurationProvider.get(clusterName)) .withConnectionPoolConfiguration(cpProvider.get(clusterName)) .withConnectionPoolMonitor(monitorProvider.get(clusterName)) .withHostSupplier(hostSupplierProvider.getSupplier(clusterName)) .buildCluster(ThriftFamilyFactory.getInstance()); holder = new ClusterContextHolder(context); holder.start(); } holder.addRef(); return holder.getKeyspace(); } @Override public synchronized void releaseCluster(ClusterKey clusterKey) { String clusterName = clusterKey.getClusterName().toLowerCase(); ClusterContextHolder holder = contextMap.get(clusterName); if (holder.releaseRef() == 0) { contextMap.remove(clusterName); holder.shutdown(); } } } <|start_filename|>staash-web/src/test/java/com/netflix/staash/test/core/StaashDeamon.java<|end_filename|> package com.netflix.staash.test.core; import org.apache.cassandra.service.CassandraDaemon; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.IOException; public class StaashDeamon extends CassandraDaemon { private static final Logger logger = LoggerFactory.getLogger(StaashDeamon.class); private static final StaashDeamon instance = new StaashDeamon(); public static void main(String[] args) { System.setProperty("cassandra-foreground", "true"); System.setProperty("log4j.defaultInitOverride", "true"); System.setProperty("log4j.configuration", "log4j.properties"); instance.activate(); } @Override protected void setup() { super.setup(); } @Override public void init(String[] arguments) throws IOException { super.init(arguments); } @Override public void start() { super.start(); } @Override public void stop() { super.stop(); } } <|start_filename|>staash-core/src/main/java/com/netflix/paas/dao/DaoKey.java<|end_filename|> /******************************************************************************* * /*** * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * ******************************************************************************/ package com.netflix.paas.dao; /** * Unique identified for a DAO and it's entity. The key makes it possible * to have the same entity class stored in different schemas * * @author elandau * */ public class DaoKey<T> implements Comparable<DaoKey>{ private final String schema; private final Class<T> type; public DaoKey(String schema, Class<T> type) { this.schema = schema; this.type = type; } public String getSchema() { return schema; } public Class<T> getType() { return type; } @Override public int compareTo(DaoKey o) { int schemaCompare = schema.compareTo(o.schema); if (schemaCompare != 0) return schemaCompare; return this.type.getCanonicalName().compareTo(o.getType().getCanonicalName()); } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((schema == null) ? 0 : schema.hashCode()); result = prime * result + ((type == null) ? 0 : type.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (getClass() != obj.getClass()) return false; DaoKey other = (DaoKey) obj; if (!schema.equals(other.schema)) return false; if (!type.equals(other.type)) return false; return true; } } <|start_filename|>staash-eureka/src/main/java/com/netflix/paas/cassandra/discovery/EurekaAstyanaxHostSupplier.java<|end_filename|> /******************************************************************************* * /*** * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * ******************************************************************************/ package com.netflix.paas.cassandra.discovery; import java.util.List; import org.apache.commons.lang.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.google.common.base.Function; import com.google.common.base.Preconditions; import com.google.common.base.Predicate; import com.google.common.base.Supplier; import com.google.common.collect.Collections2; import com.google.common.collect.Lists; import com.netflix.appinfo.AmazonInfo; import com.netflix.appinfo.InstanceInfo; import com.netflix.appinfo.AmazonInfo.MetaDataKey; import com.netflix.astyanax.connectionpool.Host; import com.netflix.discovery.DiscoveryClient; import com.netflix.discovery.DiscoveryManager; import com.netflix.discovery.shared.Application; import com.netflix.paas.cassandra.provider.HostSupplierProvider; public class EurekaAstyanaxHostSupplier implements HostSupplierProvider { private static final Logger LOG = LoggerFactory.getLogger(EurekaAstyanaxHostSupplier.class); private final DiscoveryClient eurekaClient; public EurekaAstyanaxHostSupplier() { this.eurekaClient = DiscoveryManager.getInstance().getDiscoveryClient(); Preconditions.checkNotNull(this.eurekaClient); } @Override public Supplier<List<Host>> getSupplier(final String clusterName) { return new Supplier<List<Host>>() { @Override public List<Host> get() { Application app = eurekaClient.getApplication(clusterName.toUpperCase()); List<Host> hosts = Lists.newArrayList(); if (app == null) { LOG.warn("Cluster '{}' not found in eureka", new Object[]{clusterName}); } else { List<InstanceInfo> ins = app.getInstances(); if (ins != null && !ins.isEmpty()) { hosts = Lists.newArrayList(Collections2.transform( Collections2.filter(ins, new Predicate<InstanceInfo>() { @Override public boolean apply(InstanceInfo input) { return input.getStatus() == InstanceInfo.InstanceStatus.UP; } }), new Function<InstanceInfo, Host>() { @Override public Host apply(InstanceInfo info) { String[] parts = StringUtils.split( StringUtils.split(info.getHostName(), ".")[0], '-'); Host host = new Host(info.getHostName(), info.getPort()) .addAlternateIpAddress( StringUtils.join(new String[] { parts[1], parts[2], parts[3], parts[4] }, ".")) .addAlternateIpAddress(info.getIPAddr()) .setId(info.getId()); try { if (info.getDataCenterInfo() instanceof AmazonInfo) { AmazonInfo amazonInfo = (AmazonInfo)info.getDataCenterInfo(); host.setRack(amazonInfo.get(MetaDataKey.availabilityZone)); } } catch (Throwable t) { LOG.error("Error getting rack for host " + host.getName(), t); } return host; } })); } else { LOG.warn("Cluster '{}' found in eureka but has no instances", new Object[]{clusterName}); } } return hosts; } }; } } <|start_filename|>staash-astyanax/src/main/java/com/netflix/paas/cassandra/provider/ClusterClientProvider.java<|end_filename|> /******************************************************************************* * /*** * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * ******************************************************************************/ package com.netflix.paas.cassandra.provider; import com.netflix.astyanax.Cluster; import com.netflix.paas.cassandra.keys.ClusterKey; /** * Provider for cluster level client. For now the cluster level client is used * mostly for admin purposes * * @author elandau * */ public interface ClusterClientProvider { /** * Acquire a cassandra cluster by name. Must call releaseCluster once done. * The concrete provider must implement it's own reference counting and * garbage collection to shutdown Cluster clients that are not longer in use. * * @param clusterName */ public Cluster acquireCluster(ClusterKey clusterName); /** * Release a cassandra cluster that was acquired using acquireCluster * * @param clusterName */ public void releaseCluster(ClusterKey clusterName); } <|start_filename|>staash-core/src/main/java/com/netflix/paas/entity/PassGroupConfigEntity.java<|end_filename|> /******************************************************************************* * /*** * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * ******************************************************************************/ package com.netflix.paas.entity; import java.util.Collection; import java.util.Set; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import com.google.common.collect.Sets; @Entity public class PassGroupConfigEntity { public static class Builder { private PassGroupConfigEntity entity = new PassGroupConfigEntity(); public Builder withName(String name) { entity.deploymentName = name; return this; } public Builder withSchemas(Collection<String> names) { if (entity.schemas == null) { entity.schemas = Sets.newHashSet(); } entity.schemas.addAll(names); return this; } public Builder addSchema(String vschemaName) { if (entity.schemas == null) { entity.schemas = Sets.newHashSet(); } entity.schemas.add(vschemaName); return this; } public PassGroupConfigEntity build() { return entity; } } public static Builder builder() { return new Builder(); } @Id private String deploymentName; @Column private Set<String> schemas; public String getDeploymentName() { return deploymentName; } public void setDeploymentName(String deploymentName) { this.deploymentName = deploymentName; } public Set<String> getSchemas() { return schemas; } public void setSchemas(Set<String> schemas) { this.schemas = schemas; } @Override public String toString() { return "PassGroupConfigEntity [deploymentName=" + deploymentName + ", schemas=" + schemas + "]"; } } <|start_filename|>staash-astyanax/src/main/java/com/netflix/paas/cassandra/CassandraPaasModule.java<|end_filename|> /******************************************************************************* * /*** * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * ******************************************************************************/ package com.netflix.paas.cassandra; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.google.inject.AbstractModule; import com.google.inject.Scopes; import com.google.inject.assistedinject.FactoryModuleBuilder; import com.google.inject.multibindings.MapBinder; import com.netflix.paas.cassandra.admin.CassandraClusterAdminResource; import com.netflix.paas.cassandra.admin.CassandraClusterAdminResourceFactory; import com.netflix.paas.cassandra.admin.CassandraSystemAdminResource; import com.netflix.paas.cassandra.discovery.ClusterDiscoveryService; import com.netflix.paas.cassandra.discovery.LocalClusterDiscoveryService; import com.netflix.paas.cassandra.provider.AstyanaxConfigurationProvider; import com.netflix.paas.cassandra.provider.AstyanaxConnectionPoolConfigurationProvider; import com.netflix.paas.cassandra.provider.AstyanaxConnectionPoolMonitorProvider; import com.netflix.paas.cassandra.provider.CassandraTableResourceFactory; import com.netflix.paas.cassandra.provider.ClusterClientProvider; import com.netflix.paas.cassandra.provider.HostSupplierProvider; import com.netflix.paas.cassandra.provider.KeyspaceClientProvider; import com.netflix.paas.cassandra.provider.impl.DefaultAstyanaxConfigurationProvider; import com.netflix.paas.cassandra.provider.impl.DefaultAstyanaxConnectionPoolConfigurationProvider; import com.netflix.paas.cassandra.provider.impl.DefaultAstyanaxConnectionPoolMonitorProvider; import com.netflix.paas.cassandra.provider.impl.DefaultAstyanaxClusterClientProvider; import com.netflix.paas.cassandra.provider.impl.DefaultKeyspaceClientProvider; import com.netflix.paas.cassandra.provider.impl.LocalHostSupplierProvider; import com.netflix.paas.cassandra.resources.admin.AstyanaxThriftClusterAdminResource; import com.netflix.paas.cassandra.tasks.ClusterDiscoveryTask; import com.netflix.paas.cassandra.tasks.ClusterRefreshTask; import com.netflix.paas.dao.DaoSchemaProvider; import com.netflix.paas.dao.astyanax.AstyanaxDaoSchemaProvider; import com.netflix.paas.provider.TableDataResourceFactory; import com.netflix.paas.resources.impl.JerseySchemaDataResourceImpl; public class CassandraPaasModule extends AbstractModule { private static final Logger LOG = LoggerFactory.getLogger(CassandraPaasModule.class); @Override protected void configure() { LOG.info("Loading CassandraPaasModule"); // There will be a different TableResourceProvider for each persistence technology MapBinder<String, TableDataResourceFactory> tableResourceProviders = MapBinder.newMapBinder(binder(), String.class, TableDataResourceFactory.class); tableResourceProviders.addBinding("cassandra").to(CassandraTableResourceFactory.class).in(Scopes.SINGLETON); // Binding to enable DAOs using astyanax MapBinder<String, DaoSchemaProvider> daoManagers = MapBinder.newMapBinder(binder(), String.class, DaoSchemaProvider.class); daoManagers.addBinding("astyanax").to(AstyanaxDaoSchemaProvider.class).in(Scopes.SINGLETON); bind(AstyanaxConfigurationProvider.class) .to(DefaultAstyanaxConfigurationProvider.class).in(Scopes.SINGLETON); bind(AstyanaxConnectionPoolConfigurationProvider.class).to(DefaultAstyanaxConnectionPoolConfigurationProvider.class).in(Scopes.SINGLETON); bind(AstyanaxConnectionPoolMonitorProvider.class) .to(DefaultAstyanaxConnectionPoolMonitorProvider.class).in(Scopes.SINGLETON); bind(KeyspaceClientProvider.class) .to(DefaultKeyspaceClientProvider.class).in(Scopes.SINGLETON); bind(ClusterClientProvider.class) .to(DefaultAstyanaxClusterClientProvider.class).in(Scopes.SINGLETON); install(new FactoryModuleBuilder() .implement(CassandraClusterAdminResource.class, AstyanaxThriftClusterAdminResource.class) .build(CassandraClusterAdminResourceFactory.class)); // REST resources bind(ClusterDiscoveryService.class).to(LocalClusterDiscoveryService.class); bind(CassandraSystemAdminResource.class).in(Scopes.SINGLETON); bind(JerseySchemaDataResourceImpl.class).in(Scopes.SINGLETON); MapBinder<String, HostSupplierProvider> hostSuppliers = MapBinder.newMapBinder(binder(), String.class, HostSupplierProvider.class); hostSuppliers.addBinding("local").to(LocalHostSupplierProvider.class).in(Scopes.SINGLETON); // Tasks bind(ClusterDiscoveryTask.class); bind(ClusterRefreshTask.class); } } <|start_filename|>staash-core/src/main/java/com/netflix/paas/service/SchemaService.java<|end_filename|> /******************************************************************************* * /*** * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * ******************************************************************************/ package com.netflix.paas.service; import java.util.List; import com.netflix.paas.entity.DbEntity; import com.netflix.paas.entity.TableEntity; /** * Abstraction for registry of schemas and tables visible to this deployment * @author elandau * */ public interface SchemaService { /** * List schemas that are available to this instance * * @return */ List<DbEntity> listSchema(); /** * List all tables in the schema * * @param schemaName * @return */ List<TableEntity> listSchemaTables(String schemaName); /** * List all tables */ List<TableEntity> listAllTables(); /** * Refresh from storage */ public void refresh(); } <|start_filename|>staash-svc/src/main/java/com/netflix/staash/connection/AstyanaxCassandraConnection.java<|end_filename|> /******************************************************************************* * /* * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * * * ******************************************************************************/ package com.netflix.staash.connection; import java.io.ByteArrayOutputStream; import java.io.InputStream; import java.util.HashMap; import java.util.Map; import org.apache.log4j.Logger; import com.google.common.collect.ImmutableMap; import com.netflix.astyanax.AstyanaxContext; import com.netflix.astyanax.Keyspace; import com.netflix.astyanax.connectionpool.NodeDiscoveryType; import com.netflix.astyanax.connectionpool.OperationResult; import com.netflix.astyanax.connectionpool.exceptions.ConnectionException; import com.netflix.astyanax.connectionpool.impl.ConnectionPoolConfigurationImpl; import com.netflix.astyanax.connectionpool.impl.ConnectionPoolType; import com.netflix.astyanax.connectionpool.impl.CountingConnectionPoolMonitor; import com.netflix.astyanax.cql.CqlStatementResult; import com.netflix.astyanax.impl.AstyanaxConfigurationImpl; import com.netflix.astyanax.recipes.storage.CassandraChunkedStorageProvider; import com.netflix.astyanax.recipes.storage.ChunkedStorage; import com.netflix.astyanax.recipes.storage.ChunkedStorageProvider; import com.netflix.astyanax.recipes.storage.ObjectMetadata; import com.netflix.astyanax.thrift.ThriftFamilyFactory; import com.netflix.staash.cassandra.discovery.EurekaAstyanaxHostSupplier; import com.netflix.staash.common.query.QueryFactory; import com.netflix.staash.common.query.QueryType; import com.netflix.staash.common.query.QueryUtils; import com.netflix.staash.json.JsonObject; import com.netflix.staash.model.StorageType; public class AstyanaxCassandraConnection implements PaasConnection { private Keyspace keyspace; private static Logger logger = Logger .getLogger(AstyanaxCassandraConnection.class); public AstyanaxCassandraConnection(String cluster, String db, EurekaAstyanaxHostSupplier supplier) { this.keyspace = createAstyanaxKeyspace(cluster, db, supplier); } private Keyspace createAstyanaxKeyspace(String clustername, String db, EurekaAstyanaxHostSupplier supplier) { String clusterNameOnly = "localhost"; String clusterPortOnly = "9160"; String[] clusterinfo = clustername.split(":"); if (clusterinfo != null && clusterinfo.length == 2) { clusterNameOnly = clusterinfo[0]; } else { clusterNameOnly = clustername; } AstyanaxContext<Keyspace> keyspaceContext; if (supplier!=null) { keyspaceContext = new AstyanaxContext.Builder() .forCluster("Casss_Paas") .forKeyspace(db) .withAstyanaxConfiguration( new AstyanaxConfigurationImpl() .setDiscoveryType( NodeDiscoveryType.DISCOVERY_SERVICE) .setConnectionPoolType( ConnectionPoolType.TOKEN_AWARE) .setDiscoveryDelayInSeconds(60) .setTargetCassandraVersion("1.2") .setCqlVersion("3.0.0")) .withHostSupplier(supplier.getSupplier(clustername)) .withConnectionPoolConfiguration( new ConnectionPoolConfigurationImpl(clusterNameOnly + "_" + db) .setSocketTimeout(10000) .setPort(7102) .setMaxConnsPerHost(10).setInitConnsPerHost(3) .setSeeds(null)) .withConnectionPoolMonitor(new CountingConnectionPoolMonitor()) .buildKeyspace(ThriftFamilyFactory.getInstance()); } else { keyspaceContext = new AstyanaxContext.Builder() .forCluster(clusterNameOnly) .forKeyspace(db) .withAstyanaxConfiguration( new AstyanaxConfigurationImpl() .setDiscoveryType( NodeDiscoveryType.RING_DESCRIBE) .setConnectionPoolType( ConnectionPoolType.TOKEN_AWARE) .setDiscoveryDelayInSeconds(60) .setTargetCassandraVersion("1.2") .setCqlVersion("3.0.0")) //.withHostSupplier(hs.getSupplier(clustername)) .withConnectionPoolConfiguration( new ConnectionPoolConfigurationImpl(clusterNameOnly + "_" + db) .setSocketTimeout(11000) .setConnectTimeout(2000) .setMaxConnsPerHost(10).setInitConnsPerHost(3) .setSeeds(clusterNameOnly+":"+clusterPortOnly)) .buildKeyspace(ThriftFamilyFactory.getInstance()); } keyspaceContext.start(); Keyspace keyspace; keyspace = keyspaceContext.getClient(); return keyspace; } public String insert(String db, String table, JsonObject payload) { try { // if (payload.getString("type").equals("kv")) { // String str = Hex.bytesToHex(payload.getBinary("value")); // String stmt = "insert into " + db + "." + table // + "(key, value)" + " values('" // + payload.getString("key") + "' , '" + str + "');"; // keyspace.prepareCqlStatement().withCql(stmt).execute(); // } else { String query = QueryFactory.BuildQuery(QueryType.INSERT, StorageType.CASSANDRA); keyspace.prepareCqlStatement() .withCql( String.format(query, db + "." + table, payload.getString("columns"), payload.getValue("values"))).execute(); // } } catch (ConnectionException e) { e.printStackTrace(); throw new RuntimeException(e.getMessage()); } catch (Exception e) { e.printStackTrace(); throw new RuntimeException(e.getMessage()); } return "{\"message\":\"ok\"}"; } public String writeChunked(String db, String table, String objectName, InputStream is) { ChunkedStorageProvider provider = new CassandraChunkedStorageProvider( keyspace, table); ObjectMetadata meta; try { // if (is!=null) is.reset(); meta = ChunkedStorage.newWriter(provider, objectName, is) .withChunkSize(0x40000).withConcurrencyLevel(8) .withMaxWaitTime(10).call(); if (meta != null && meta.getObjectSize() <= 0) throw new RuntimeException("Object does not exist"); } catch (Exception e) { e.printStackTrace(); throw new RuntimeException(e.getMessage()); } return "{\"msg\":\"ok\"}"; } public ByteArrayOutputStream readChunked(String db, String table, String objName) { ChunkedStorageProvider provider = new CassandraChunkedStorageProvider( keyspace, table); ObjectMetadata meta; ByteArrayOutputStream os = null; try { meta = ChunkedStorage.newInfoReader(provider, objName).call(); os = new ByteArrayOutputStream(meta.getObjectSize().intValue()); meta = ChunkedStorage.newReader(provider, objName, os) .withConcurrencyLevel(8).withMaxWaitTime(10) .withBatchSize(10).call(); } catch (Exception e) { e.printStackTrace(); throw new RuntimeException(e.getMessage()); } return os; } public String createDB(String dbInfo) { JsonObject dbJson = new JsonObject(dbInfo); try { String rfString = dbJson.getString("rf"); String strategy = dbJson.getString("strategy"); String[] rfs = rfString.split(","); Map<String, Object> strategyMap = new HashMap<String, Object>(); for (int i = 0; i < rfs.length; i++) { String[] rfparams = rfs[i].split(":"); strategyMap.put(rfparams[0], (Object) rfparams[1]); } keyspace.createKeyspace(ImmutableMap.<String, Object> builder() .put("strategy_options", strategyMap) .put("strategy_class", strategy).build()); } catch (Exception e) { logger.info("DB Exists, Skipping"); } return "{\"message\":\"ok\"}"; } public String createTable(JsonObject payload) { String sql = String .format(QueryFactory.BuildQuery(QueryType.CREATETABLE, StorageType.CASSANDRA), payload.getString("db") + "." + payload.getString("name"), QueryUtils.formatColumns( payload.getString("columns"), StorageType.CASSANDRA), payload.getString("primarykey")); try { keyspace.prepareCqlStatement().withCql(sql + ";").execute(); } catch (ConnectionException e) { logger.info("Table Exists, Skipping"); } return "{\"message\":\"ok\"}"; } public String read(String db, String table, String keycol, String key, String... keyvals) { try { if (keyvals != null && keyvals.length == 2) { String query = QueryFactory.BuildQuery(QueryType.SELECTEVENT, StorageType.CASSANDRA); return QueryUtils.formatQueryResult( keyspace.prepareCqlStatement() .withCql( String.format(query, db + "." + table, keycol, key, keyvals[0], keyvals[1])).execute() .getResult(), table); } else { String query = QueryFactory.BuildQuery(QueryType.SELECTALL, StorageType.CASSANDRA); OperationResult<CqlStatementResult> rs; if (keycol != null && !keycol.equals("")) { rs = keyspace .prepareCqlStatement() .withCql( String.format(query, db + "." + table, keycol, key)).execute(); } else { rs = keyspace .prepareCqlStatement() .withCql( String.format("select * from %s", db + "." + table)).execute(); } if (rs != null) return QueryUtils.formatQueryResult(rs.getResult(), table); return "{\"msg\":\"Nothing is found\"}"; } } catch (Exception e) { throw new RuntimeException(e.getMessage()); } } public String createRowIndexTable(JsonObject payload) { return null; } public void closeConnection() { // TODO Auto-generated method stub // No API exists for this in current implementation todo:investigate } } <|start_filename|>staash-svc/src/main/java/com/netflix/staash/rest/dao/CqlMetaDaoImpl.java<|end_filename|> /******************************************************************************* * /* * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * * * ******************************************************************************/ package com.netflix.staash.rest.dao; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import com.datastax.driver.core.Cluster; import com.datastax.driver.core.ColumnDefinitions; import com.datastax.driver.core.ResultSet; import com.datastax.driver.core.Row; import com.datastax.driver.core.Session; import com.datastax.driver.core.exceptions.AlreadyExistsException; import com.datastax.driver.core.exceptions.DriverException; import com.google.inject.Inject; import com.google.inject.name.Named; import com.netflix.staash.json.JsonArray; import com.netflix.staash.json.JsonObject; import com.netflix.staash.rest.meta.entity.Entity; import com.netflix.staash.rest.meta.entity.PaasDBEntity; import com.netflix.staash.rest.meta.entity.PaasStorageEntity; import com.netflix.staash.rest.meta.entity.PaasTableEntity; import com.netflix.staash.rest.meta.entity.PaasTimeseriesEntity; import com.netflix.staash.rest.util.MetaConstants; import com.netflix.staash.rest.util.PaasUtils; import com.netflix.staash.rest.util.Pair; import com.netflix.staash.storage.service.MySqlService; import static com.datastax.driver.core.querybuilder.QueryBuilder.*; public class CqlMetaDaoImpl implements MetaDao { private Cluster cluster; Session session; private static boolean schemaCreated = false; static final String metaks = "paasmetaks"; static final String metacf = "metacf"; private Set<String> dbHolder = new HashSet<String>(); private Map<String,List<String>> dbToTableMap = new HashMap<String,List<String>>(); private Map<String,List<String>> dbToTimeseriesMap = new HashMap<String,List<String>>(); private Map<String, String> tableToStorageMap = new HashMap<String, String>(); private JsonObject jsonStorage = new JsonObject(); @Inject public CqlMetaDaoImpl(@Named("metacluster") Cluster cluster) { // Cluster cluster = Cluster.builder().addContactPoint("localhost") // .build(); this.cluster = cluster; this.session = this.cluster.connect(); maybeCreateMetaSchema(); LoadDbNames(); LoadDbToTableMap(); LoadDbToTimeSeriesMap(); LoadStorage(); LoadTableToStorage(); } private void LoadTableToStorage() { ResultSet rs = session .execute("select column1, value from "+MetaConstants.META_KEY_SPACE+"."+MetaConstants.META_COLUMN_FAMILY+ " where key='"+MetaConstants.STAASH_TABLE_ENTITY_TYPE+"';"); List<Row> rows = rs.all(); for (Row row : rows) { String field = row.getString(0); JsonObject val = new JsonObject(row.getString(1)); String storage = val.getField("storage"); tableToStorageMap.put(field, storage); } } public Map<String,JsonObject> LoadStorage() { ResultSet rs = session .execute("select column1, value from "+MetaConstants.META_KEY_SPACE+"."+MetaConstants.META_COLUMN_FAMILY+ " where key='"+MetaConstants.STAASH_STORAGE_TYPE_ENTITY+"';"); List<Row> rows = rs.all(); Map<String,JsonObject> storageMap = new HashMap<String,JsonObject>(); for (Row row : rows) { String field = row.getString(0); JsonObject val = new JsonObject(row.getString(1)); jsonStorage.putObject(field, val); storageMap.put(field, val); } return storageMap; } private void LoadDbNames() { ResultSet rs = session .execute("select column1 from "+MetaConstants.META_KEY_SPACE+"."+MetaConstants.META_COLUMN_FAMILY+ " where key='com.test.entity.type.paas.db';"); List<Row> rows = rs.all(); for (Row row : rows) { dbHolder.add(row.getString(0)); } } private void LoadDbToTableMap() { ResultSet rs = session .execute("select column1 from "+MetaConstants.META_KEY_SPACE+"."+MetaConstants.META_COLUMN_FAMILY+ " where key='com.test.entity.type.paas.table';"); List<Row> rows = rs.all(); for (Row row : rows) { String key = row.getString(0).split("\\.")[0]; String table = row.getString(0).split("\\.")[1]; List<String> currval = null; currval = dbToTableMap.get(key); if (currval == null) { currval = new ArrayList<String>(); } currval.add(table); dbToTableMap.put(key, currval); } } private void LoadDbToTimeSeriesMap() { ResultSet rs = session .execute("select column1 from "+MetaConstants.META_KEY_SPACE+"."+MetaConstants.META_COLUMN_FAMILY+ " where key='com.test.entity.type.paas.timeseries';"); List<Row> rows = rs.all(); for (Row row : rows) { String key = row.getString(0).split("\\.")[0]; String table = row.getString(0).split("\\.")[1]; List<String> currval = null; currval = dbToTimeseriesMap.get(key); if (currval == null) { currval = new ArrayList<String>(); } currval.add(table); dbToTimeseriesMap.put(key, currval); } } public String writeMetaEntityOnly(Entity entity) { session.execute(String.format(PaasUtils.INSERT_FORMAT, MetaConstants.META_KEY_SPACE + "." + MetaConstants.META_COLUMN_FAMILY, entity.getRowKey(), entity.getName(), entity.getPayLoad())); return "ok"; } public String writeMetaEntity(Entity entity) { try { if (dbHolder.contains(entity.getName())) { JsonObject obj = new JsonObject( "{\"status\":\"error\",\"message\":\"db names must be unique\"}"); return obj.toString(); } session.execute(String.format(PaasUtils.INSERT_FORMAT, MetaConstants.META_KEY_SPACE + "." + MetaConstants.META_COLUMN_FAMILY, entity.getRowKey(), entity.getName(), entity.getPayLoad())); if (entity instanceof PaasDBEntity) dbHolder.add(entity.getName()); if (entity instanceof PaasStorageEntity) jsonStorage.putObject(entity.getName(), new JsonObject(entity.getPayLoad())); } catch (AlreadyExistsException e) { // It's ok, ignore } if (entity instanceof PaasTableEntity) { // first create/check if schema db exists PaasTableEntity tableEnt = (PaasTableEntity) entity; String schemaName = tableEnt.getSchemaName(); String storage = tableEnt.getStorage(); try { // String payLoad = tableEnt.getPayLoad(); if (storage!=null && storage.contains("mysql")) { MySqlService.createDbInMySql(schemaName); } //else { session.execute(String.format( PaasUtils.CREATE_KEYSPACE_SIMPLE_FORMAT, schemaName, 1)); //}//create counterpart in cassandra } catch (AlreadyExistsException e) { // It's ok, ignore } // if schema/db already exists now create the table try { Thread.sleep(10); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } String query = BuildQuery(tableEnt); Print(query); if (storage!=null && storage.contains("mysql")) { MySqlService.createTableInDb(schemaName, query); } else { storage="cassandra"; session.execute(query); } List<String> tables = dbToTableMap.get(tableEnt.getSchemaName()); if (tables==null) tables = new ArrayList<String>(); tables.add(tableEnt.getName()); tableToStorageMap.put(tableEnt.getName(), storage); // List<String> primaryKeys = entity.getPrimaryKey(); } if (entity instanceof PaasTimeseriesEntity) { // first create/check if schema db exists PaasTimeseriesEntity tableEnt = (PaasTimeseriesEntity) entity; try { String schemaName = tableEnt.getSchemaName(); session.execute(String.format( PaasUtils.CREATE_KEYSPACE_SIMPLE_FORMAT, schemaName, 1)); } catch (AlreadyExistsException e) { // It's ok, ignore } // if schema/db already exists now create the table try { Thread.sleep(10); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } String query = BuildQuery(tableEnt); Print(query); session.execute(query); List<String> tables = dbToTimeseriesMap.get(tableEnt.getSchemaName()); if (tables==null) tables = new ArrayList<String>(); tables.add(tableEnt.getName().substring(tableEnt.getName().indexOf(".")+1)); // List<String> primaryKeys = entity.getPrimaryKey(); } JsonObject obj = new JsonObject("{\"status\":\"ok\"}"); return obj.toString(); } public String writeRow(String db, String table, JsonObject rowObj) { String query = BuildRowInsertQuery(db, table, rowObj); Print(query); String storage = tableToStorageMap.get(db+"."+table); if (storage!=null && storage.equals("mysql")) { MySqlService.insertRowIntoTable(db, table, query); } else { session.execute(query); } JsonObject obj = new JsonObject("{\"status\":\"ok\"}"); return obj.toString(); } private String BuildRowInsertQuery(String db, String table, JsonObject rowObj) { // TODO Auto-generated method stub String columns = rowObj.getString("columns"); String values = rowObj.getString("values"); String storage = tableToStorageMap.get(db+"."+table); if (storage!=null && storage.equals("mysql")) { return "INSERT INTO" + " " + table + "(" + columns + ")" + " VALUES(" + values + ");"; }else { return "INSERT INTO" + " " + db + "." + table + "(" + columns + ")" + " VALUES(" + values + ");"; } } private void Print(String str) { // TODO Auto-generated method stub System.out.println(str); } private String BuildQuery(PaasTableEntity tableEnt) { // TODO Auto-generated method stub String storage = tableEnt.getStorage(); if (storage!=null && storage.equals("mysql")) { String schema = tableEnt.getSchemaName(); String tableName = tableEnt.getName().split("\\.")[1]; List<Pair<String, String>> columns = tableEnt.getColumns(); String colStrs = ""; for (Pair<String, String> colPair : columns) { colStrs = colStrs + colPair.getRight() + " " + colPair.getLeft() + ", "; } String primarykeys = tableEnt.getPrimarykey(); String PRIMARYSTR = "PRIMARY KEY(" + primarykeys + ")"; return "CREATE TABLE " + tableName + " (" + colStrs + " " + PRIMARYSTR + ");"; } else { String schema = tableEnt.getSchemaName(); String tableName = tableEnt.getName().split("\\.")[1]; List<Pair<String, String>> columns = tableEnt.getColumns(); String colStrs = ""; for (Pair<String, String> colPair : columns) { colStrs = colStrs + colPair.getRight() + " " + colPair.getLeft() + ", "; } String primarykeys = tableEnt.getPrimarykey(); String PRIMARYSTR = "PRIMARY KEY(" + primarykeys + ")"; return "CREATE TABLE " + schema + "." + tableName + " (" + colStrs + " " + PRIMARYSTR + ");"; } } private String BuildQuery(PaasTimeseriesEntity tableEnt) { // TODO Auto-generated method stub String schema = tableEnt.getSchemaName(); String tableName = tableEnt.getName().split("\\.")[1]; List<Pair<String, String>> columns = tableEnt.getColumns(); String colStrs = ""; for (Pair<String, String> colPair : columns) { colStrs = colStrs + colPair.getRight() + " " + colPair.getLeft() + ", "; } String primarykeys = tableEnt.getPrimarykey(); String PRIMARYSTR = "PRIMARY KEY(" + primarykeys + ")"; return "CREATE TABLE " + schema + "." + tableName + " (" + colStrs + " " + PRIMARYSTR + ");"; } public void maybeCreateMetaSchema() { try { if (schemaCreated) return; try { session.execute(String.format( PaasUtils.CREATE_KEYSPACE_SIMPLE_FORMAT, metaks, 1)); } catch (AlreadyExistsException e) { // It's ok, ignore } session.execute("USE " + metaks); for (String tableDef : getTableDefinitions()) { try { session.execute(tableDef); } catch (AlreadyExistsException e) { // It's ok, ignore } } schemaCreated = true; } catch (DriverException e) { throw e; } } protected Collection<String> getTableDefinitions() { String metaDynamic = "CREATE TABLE metacf (\n" + " key text,\n" + " column1 text,\n" + " value text,\n" + " PRIMARY KEY (key, column1)\n" + ") WITH COMPACT STORAGE;"; List<String> allDefs = new ArrayList<String>(); allDefs.add(metaDynamic); return allDefs; } public Entity readMetaEntity(String rowKey) { // TODO Auto-generated method stub return null; } public String listRow(String db, String table, String keycol, String key) { // TODO Auto-generated method stub String query = select().all().from(db, table).where(eq(keycol, key)) .getQueryString(); ResultSet rs = session.execute(query); return convertResultSet(rs); } private String convertResultSet(ResultSet rs) { // TODO Auto-generated method stub String colStr = ""; String rowStr = ""; JsonObject response = new JsonObject(); List<Row> rows = rs.all(); if (!rows.isEmpty() && rows.size() == 1) { rowStr = rows.get(0).toString(); } ColumnDefinitions colDefs = rs.getColumnDefinitions(); colStr = colDefs.toString(); response.putString("columns", colStr.substring(8, colStr.length() - 1)); response.putString("values", rowStr.substring(4, rowStr.length() - 1)); return response.toString(); } public String listSchemas() { // TODO Auto-generated method stub JsonObject obj = new JsonObject(); JsonArray arr = new JsonArray(); for (String db: dbHolder) { arr.addString(db); } obj.putArray("schemas", arr); return obj.toString(); } public String listTablesInSchema(String schemaname) { // TODO Auto-generated method stub JsonObject obj = new JsonObject(); JsonArray arr = new JsonArray(); List<String> tblNames = dbToTableMap.get(schemaname); for (String name: tblNames) { arr.addString(name); } obj.putArray(schemaname, arr); return obj.toString(); } public String listTimeseriesInSchema(String schemaname) { // TODO Auto-generated method stub JsonObject obj = new JsonObject(); JsonArray arr = new JsonArray(); List<String> tblNames = dbToTimeseriesMap.get(schemaname); for (String name: tblNames) { arr.addString(name); } obj.putArray(schemaname, arr); return obj.toString(); } public String listStorage() { // TODO Auto-generated method stub return jsonStorage.toString(); } public Map<String, String> getTableToStorageMap() { return tableToStorageMap; } public Map<String, String> getStorageMap() { // TODO Auto-generated method stub return tableToStorageMap; } public Map<String, JsonObject> runQuery(String key, String col) { // TODO Auto-generated method stub ResultSet rs = session .execute("select column1, value from "+MetaConstants.META_KEY_SPACE+"."+MetaConstants.META_COLUMN_FAMILY+ " where key='"+key+"' and column1='"+col+"';"); List<Row> rows = rs.all(); Map<String,JsonObject> storageMap = new HashMap<String,JsonObject>(); for (Row row : rows) { String field = row.getString(0); JsonObject val = new JsonObject(row.getString(1)); storageMap.put(field, val); } return storageMap; } } <|start_filename|>staash-core/src/main/java/com/netflix/paas/resources/SchemaAdminResource.java<|end_filename|> /******************************************************************************* * /*** * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * ******************************************************************************/ package com.netflix.paas.resources; import javax.ws.rs.Consumes; import javax.ws.rs.DELETE; import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.core.MediaType; import com.netflix.paas.entity.DbEntity; import com.netflix.paas.entity.TableEntity; /** * Admin resource for managing schemas */ @Path("/v1/admin") public interface SchemaAdminResource { /** * List all schemas */ @GET public String listSchemas(); /** * Create a new schema */ @POST @Consumes(MediaType.TEXT_PLAIN) // @Path("/db") public void createSchema(String payLd); /** * Delete an existing schema * @param schemaName */ @DELETE @Path("{schema}") public void deleteSchema(@PathParam("schema") String schemaName); /** * Update an existing schema * @param schemaName * @param schema */ @POST @Path("{schema}") public void updateSchema(@PathParam("schema") String schemaName, DbEntity schema); /** * Get details for a schema * @param schemaName * @return */ @GET @Path("{schema}") public DbEntity getSchema(@PathParam("schema") String schemaName); /** * Get details for a subtable of schema * @param schemaName * @param tableName */ @GET @Path("{schema}/tables/{table}") public TableEntity getTable(@PathParam("schema") String schemaName, @PathParam("table") String tableName); /** * Remove a table from the schema * @param schemaName * @param tableName */ @DELETE @Path("{schema}/tables/{table}") public void deleteTable(@PathParam("schema") String schemaName, @PathParam("table") String tableName); /** * Create a table in the schema * @param schemaName * @param table */ @POST @Path("{schema}") @Consumes(MediaType.TEXT_PLAIN) public void createTable(@PathParam("schema") String schemaName, String table); /** * Update an existing table in the schema * @param schemaName * @param tableName * @param table */ @POST @Path("{schema}/tables/{table}") public void updateTable(@PathParam("schema") String schemaName, @PathParam("table") String tableName, TableEntity table); } <|start_filename|>staash-core/src/main/java/com/netflix/paas/resources/DataResource.java<|end_filename|> /******************************************************************************* * /*** * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * ******************************************************************************/ package com.netflix.paas.resources; import java.util.HashMap; import java.util.Map; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.google.common.base.Preconditions; import com.google.common.collect.Maps; import com.google.common.eventbus.Subscribe; import com.google.inject.Inject; import com.netflix.paas.events.SchemaChangeEvent; import com.netflix.paas.exceptions.NotFoundException; import com.netflix.paas.provider.TableDataResourceFactory; @Path("/v1/datares") public class DataResource { private static final Logger LOG = LoggerFactory.getLogger(DataResource.class); private volatile HashMap<String, DbDataResource> schemaResources = Maps.newHashMap(); private final Map<String, TableDataResourceFactory> tableDataResourceFactories; @Inject public DataResource(Map<String, TableDataResourceFactory> tableDataResourceFactories) { LOG.info("Creating DataResource"); this.tableDataResourceFactories = tableDataResourceFactories; Preconditions.checkArgument(!tableDataResourceFactories.isEmpty(), "No TableDataResourceFactory instances exists."); } /** * Notification that a schema change was auto identified. We recreate the entire schema * structure for the REST API. * @param event */ @Subscribe public synchronized void schemaChangeEvent(SchemaChangeEvent event) { LOG.info("Schema changed " + event.getSchema().getName()); DbDataResource resource = new DbDataResource(event.getSchema(), tableDataResourceFactories); HashMap<String, DbDataResource> newResources = Maps.newHashMap(schemaResources); newResources.put(event.getSchema().getName(), resource); schemaResources = newResources; } // Root API // @GET // public List<SchemaEntity> listSchemas() { //// LOG.info(""); //// LOG.info("listSchemas"); //// return Lists.newArrayList(schemaService.listSchema()); // return null; // } @GET @Produces("text/plain") public String hello() { return "hello"; } @Path("{schema}") public DbDataResource getSchemaDataResource( @PathParam("schema") String schemaName ) throws NotFoundException { DbDataResource resource = schemaResources.get(schemaName); if (resource == null) { throw new NotFoundException(DbDataResource.class, schemaName); } return resource; } } <|start_filename|>staash-svc/src/main/java/com/netflix/staash/rest/dao/CqlMetaDaoImplNew.java<|end_filename|> /******************************************************************************* * /* * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * * * ******************************************************************************/ package com.netflix.staash.rest.dao; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import com.datastax.driver.core.Cluster; import com.datastax.driver.core.ResultSet; import com.datastax.driver.core.Row; import com.datastax.driver.core.Session; import com.datastax.driver.core.exceptions.AlreadyExistsException; import com.datastax.driver.core.exceptions.DriverException; import com.netflix.staash.json.JsonArray; import com.netflix.staash.json.JsonObject; import com.netflix.staash.rest.meta.entity.Entity; import com.netflix.staash.rest.meta.entity.EntityType; import com.netflix.staash.rest.util.MetaConstants; import com.netflix.staash.rest.util.PaasUtils; public class CqlMetaDaoImplNew implements MetaDao { private Cluster cluster; private Session session; // List<String> dbHolder = new ArrayList<String>(); // Map<String, String> tableToStorageMap = new ConcurrentHashMap<String, String>(); // Map<String,JsonObject> storageMap = new ConcurrentHashMap<String,JsonObject>(); // Map<String, List<String>> dbToTableMap = new ConcurrentHashMap<String, List<String>>(); // Map<String, List<String>> dbToTimeseriesMap = new ConcurrentHashMap<String, List<String>>(); private boolean schemaCreated = false; public CqlMetaDaoImplNew(Cluster cluster) { this.cluster = cluster; this.session = this.cluster.connect(); // LoadStorage(); // LoadDbNames(); // LoadDbToTableMap(); // LoadDbToTimeSeriesMap(); // LoadTableToStorage(); // TODO Auto-generated constructor stub } private void maybeCreateMetaSchema() { try { if (schemaCreated) return; try { session.execute(String.format( PaasUtils.CREATE_KEYSPACE_SIMPLE_FORMAT, MetaConstants.META_KEY_SPACE, 1)); } catch (AlreadyExistsException e) { // It's ok, ignore } session.execute("USE " + MetaConstants.META_KEY_SPACE); for (String tableDef : getTableDefinitions()) { try { session.execute(tableDef); } catch (AlreadyExistsException e) { // It's ok, ignore } } schemaCreated = true; } catch (DriverException e) { throw e; } } protected Collection<String> getTableDefinitions() { String metaDynamic = "CREATE TABLE metacf (\n" + " key text,\n" + " column1 text,\n" + " value text,\n" + " PRIMARY KEY (key, column1)\n" + ") WITH COMPACT STORAGE;"; List<String> allDefs = new ArrayList<String>(); allDefs.add(metaDynamic); return allDefs; } public String writeMetaEntity(Entity entity) { session.execute(String.format(PaasUtils.INSERT_FORMAT, MetaConstants.META_KEY_SPACE + "." + MetaConstants.META_COLUMN_FAMILY, entity.getRowKey(), entity.getName(), entity.getPayLoad())); //addEntityToCache(entity.getRowKey(), entity); return "{\"msg\":\"ok\""; } // public String listStorage() { // Set<String> allStorage = storageMap.keySet(); // JsonObject obj = new JsonObject(); // JsonArray arr = new JsonArray(); // for (String storage: allStorage) { // arr.addString(storage); // } // obj.putArray("storages", arr); // return obj.toString(); // } // public String listSchemas(){ // JsonObject obj = new JsonObject(); // JsonArray arr = new JsonArray(); // for (String db: dbHolder) { // arr.addString(db); // } // obj.putArray("schemas", arr); // return obj.toString(); // } // public String listTablesInSchema(String db) { // List<String> tables = dbToTableMap.get(db); // JsonObject obj = new JsonObject(); // JsonArray arr = new JsonArray(); // for (String table: tables) { // arr.addString(table); // } // obj.putArray(db, arr); // return obj.toString(); // } // public String listTimeseriesInSchema(String db) { // List<String> tables = dbToTimeseriesMap.get(db); // JsonObject obj = new JsonObject(); // JsonArray arr = new JsonArray(); // for (String table: tables) { // arr.addString(table); // } // obj.putArray(db, arr); // return obj.toString(); // } // private void addEntityToCache(String rowkey, Entity entity) { // switch (EntityType.valueOf(rowkey)) { // case STORAGE: // storageMap.put(entity.getName(), new JsonObject(entity.getPayLoad())); // break; // case DB: // dbHolder.add(entity.getName()); // break; // case TABLE: // JsonObject payobject = new JsonObject(entity.getPayLoad()); // tableToStorageMap.put(entity.getName(), payobject.getString("storage")); // String db = payobject.getString("db"); // List<String> tables = dbToTableMap.get(db); // if (tables == null || tables.size() == 0) { // tables = new ArrayList<String>(); // tables.add(entity.getName()); // } else { // tables.add(entity.getName()); // } // dbToTableMap.put(db, tables); // break; // // case SERIES: // JsonObject tsobject = new JsonObject(entity.getPayLoad()); // tableToStorageMap.put(entity.getName(), tsobject.getString("storage")); // String dbname = tsobject.getString("db"); // List<String> alltables = dbToTableMap.get(dbname); // if (alltables == null || alltables.size() == 0) { // alltables = new ArrayList<String>(); // alltables.add(entity.getName()); // } else { // alltables.add(entity.getName()); // } // dbToTimeseriesMap.put(dbname, alltables); // break; // } // } // private void LoadTableToStorage() { // ResultSet rs = session // .execute("select column1, value from paasmetaks.metacf where key='"+MetaConstants.PAAS_TABLE_ENTITY_TYPE+"';"); // List<Row> rows = rs.all(); // for (Row row : rows) { // String field = row.getString(0); // JsonObject val = new JsonObject(row.getString(1)); // String storage = val.getField("storage"); // tableToStorageMap.put(field, storage); // } // } // public Map<String,JsonObject> LoadStorage() { // ResultSet rs = session // .execute("select column1, value from paasmetaks.metacf where key='"+MetaConstants.PAAS_STORAGE_TYPE_ENTITY+"';"); // List<Row> rows = rs.all(); // for (Row row : rows) { // String field = row.getString(0); // JsonObject val = new JsonObject(row.getString(1)); // storageMap.put(field, val); // } // return storageMap; // } // // private void LoadDbNames() { // ResultSet rs = session // .execute("select column1 from paasmetaks.metacf where key='com.test.entity.type.paas.db';"); // List<Row> rows = rs.all(); // for (Row row : rows) { // dbHolder.add(row.getString(0)); // } // } // private void LoadDbToTableMap() { // ResultSet rs = session // .execute("select column1 from paasmetaks.metacf where key='com.test.entity.type.paas.table';"); // List<Row> rows = rs.all(); // for (Row row : rows) { // String key = row.getString(0).split("\\.")[0]; // String table = row.getString(0).split("\\.")[1]; // List<String> currval = null; // currval = dbToTableMap.get(key); // if (currval == null) { // currval = new ArrayList<String>(); // } // currval.add(table); // dbToTableMap.put(key, currval); // } // } // private void LoadDbToTimeSeriesMap() { // ResultSet rs = session // .execute("select column1 from paasmetaks.metacf where key='com.test.entity.type.paas.timeseries';"); // List<Row> rows = rs.all(); // for (Row row : rows) { // String key = row.getString(0).split("\\.")[0]; // String table = row.getString(0).split("\\.")[1]; // List<String> currval = null; // currval = dbToTimeseriesMap.get(key); // if (currval == null) { // currval = new ArrayList<String>(); // } // currval.add(table); // dbToTimeseriesMap.put(key, currval); // } // } // public Entity readMetaEntity(String rowKey) { // // TODO Auto-generated method stub // return null; // } // // public String writeRow(String db, String table, JsonObject rowObj) { // // TODO Auto-generated method stub // return null; // } // // public String listRow(String db, String table, String keycol, String key) { // // TODO Auto-generated method stub // return null; // } // public Map<String, String> getStorageMap() { // TODO Auto-generated method stub return null; } public Map<String, JsonObject> runQuery(String key, String col) { // TODO Auto-generated method stub ResultSet rs; if (col!=null && !col.equals("*")) { rs = session .execute("select column1, value from "+MetaConstants.META_KEY_SPACE+"."+MetaConstants.META_COLUMN_FAMILY+ " where key='"+key+"' and column1='"+col+"';"); } else { rs = session .execute("select column1, value from "+MetaConstants.META_KEY_SPACE+"."+MetaConstants.META_COLUMN_FAMILY+ " where key='"+key+"';"); } List<Row> rows = rs.all(); Map<String,JsonObject> storageMap = new HashMap<String,JsonObject>(); for (Row row : rows) { String field = row.getString(0); JsonObject val = new JsonObject(row.getString(1)); storageMap.put(field, val); } return storageMap; } } <|start_filename|>staash-web/src/test/java/com/netflix/staash/web/tests/TableTest.java<|end_filename|> package com.netflix.staash.web.tests; import org.junit.Assert; import org.junit.BeforeClass; import org.junit.Test; import org.junit.runner.RunWith; import com.google.inject.Guice; import com.google.inject.Injector; import com.netflix.staash.json.JsonObject; import com.netflix.staash.service.PaasDataService; import com.netflix.staash.service.PaasMetaService; import com.netflix.staash.test.core.CassandraRunner; import com.netflix.staash.test.modules.TestStaashModule; @RunWith(CassandraRunner.class) public class TableTest { public static PaasMetaService metasvc; public static PaasDataService datasvc; public static final String db = "unitdb1"; public static final String table = "table1"; public static final String tblpay = "{\"name\":\"table1\",\"columns\":\"username,friends,wall,status\",\"primarykey\":\"username\",\"storage\":\"cassandratest\"}"; public static final String insertPay1 = "{\"columns\":\"username,friends,wall,status\",\"values\":\"'rogerfederer','rafa#haas#tommy#sachin#beckham','getting ready for my next#out of wimbledon#out of french','looking fwd to my next match'\"}"; public static final String insertPay2 = "{\"columns\":\"username,friends,wall,status\",\"values\":\"'rafaelnadal','rafa#haas#tommy#sachin#beckham','getting ready for my next#out of wimbledon#out of french','looking fwd to my next match'\"}"; public static final String responseText1 = "{\"1\":{\"username\":\"rogerfederer\",\"friends\":\"rafa#haas#tommy#sachin#beckham\",\"status\":\"looking fwd to my next match\",\"wall\":\"getting ready for my next#out of wimbledon#out of french\"}}"; public static final String responseText2 = "{\"1\":{\"username\":\"rafaelnadal\",\"friends\":\"rafa#haas#tommy#sachin#beckham\",\"status\":\"looking fwd to my next match\",\"wall\":\"getting ready for my next#out of wimbledon#out of french\"}}"; @BeforeClass public static void setup() { TestStaashModule pmod = new TestStaashModule(); Injector inj = Guice.createInjector(pmod); metasvc = inj.getInstance(PaasMetaService.class); datasvc = inj.getInstance(PaasDataService.class); StaashTestHelper.createTestStorage(metasvc); StaashTestHelper.createTestDB(metasvc); StaashTestHelper.createTestTable(metasvc,tblpay); System.out.println("Done:"); } @Test public void testTableWriteRead() { datasvc.writeRow(db, table, new JsonObject(insertPay1)); datasvc.writeRow(db, table, new JsonObject(insertPay2)); readRows(); } private void readRows() { String out = ""; out = datasvc.listRow(db, table, "username", "rogerfederer"); Assert.assertTrue("Did Not Get What Was Expected", out!=null?out.equals(responseText1):false); System.out.println("out= "+out); out = datasvc.listRow(db, table, "username", "rafaelnadal"); Assert.assertTrue("Did Not Get What Was Expected", out!=null?out.equals(responseText2):false); System.out.println("out= "+out); } } <|start_filename|>staash-mesh/src/main/java/com/netflix/staash/mesh/endpoints/ChordEndpointPolicy.java<|end_filename|> /******************************************************************************* * /*** * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * ******************************************************************************/ package com.netflix.staash.mesh.endpoints; import java.util.Collections; import java.util.List; import com.google.common.collect.Lists; import com.netflix.staash.mesh.CompareInstanceInfoByUuid; import com.netflix.staash.mesh.InstanceInfo; /** * Return a list of endpoints that are of exponential distance from the current position * * Example, * * pos + 1 * pos + 2 * pos + 4 * pos + 8 * ... * * @author elandau * */ public class ChordEndpointPolicy implements EndpointPolicy { private static final CompareInstanceInfoByUuid comparator = new CompareInstanceInfoByUuid(); private static double LOG_2 = Math.log(2); @Override public List<InstanceInfo> getEndpoints(InstanceInfo current, List<InstanceInfo> instances) { int position = Collections.binarySearch(instances, current, comparator); int size = instances.size(); int count = (int)Math.ceil(Math.log(size) / LOG_2); List<InstanceInfo> endpoints = Lists.newArrayListWithCapacity(count); int offset = 1; for (int i = 0; i < count; i++) { endpoints.add(instances.get((position + offset) % size)); offset *= 2; } return endpoints; } } <|start_filename|>staash-svc/src/main/java/com/netflix/staash/connection/MySqlConnection.java<|end_filename|> /******************************************************************************* * /* * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * * * ******************************************************************************/ package com.netflix.staash.connection; import java.io.ByteArrayOutputStream; import java.io.InputStream; import java.io.OutputStream; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import com.netflix.staash.common.query.QueryFactory; import com.netflix.staash.common.query.QueryType; import com.netflix.staash.common.query.QueryUtils; import com.netflix.staash.json.JsonObject; import com.netflix.staash.model.StorageType; public class MySqlConnection implements PaasConnection{ private Connection conn; public MySqlConnection(Connection conn) { this.conn = conn; } public Connection getConnection() { return conn; } public String insert(String db, String table, JsonObject payload) { String query = QueryFactory.BuildQuery(QueryType.INSERT, StorageType.MYSQL); try { Statement stmt = conn.createStatement(); stmt.executeUpdate("USE "+db); stmt.executeUpdate(String.format(query, table,payload.getString("columns"),payload.getValue("values"))); } catch (SQLException e) { throw new RuntimeException(e); } return "\"message\":\"ok\""; } public String createDB(String dbname) { String sql = String.format(QueryFactory.BuildQuery(QueryType.CREATEDB, StorageType.MYSQL), dbname);; Statement stmt = null; try { stmt = conn.createStatement(); stmt.executeUpdate(sql); } catch (SQLException e) { throw new RuntimeException(e); } return "\"message\":\"ok\""; } public String createTable(JsonObject payload) { Statement stmt = null; String sql = String.format(QueryFactory.BuildQuery(QueryType.SWITCHDB, StorageType.MYSQL), payload.getString("db")); try { stmt = conn.createStatement(); stmt.executeUpdate(sql); } catch (SQLException e) { e.printStackTrace(); throw new RuntimeException(e); } String createTblQry = String.format(QueryFactory.BuildQuery(QueryType.CREATETABLE, StorageType.MYSQL), payload.getString("name"),QueryUtils.formatColumns(payload.getString("columns"),StorageType.MYSQL),payload.getString("primarykey")); try { stmt.executeUpdate(createTblQry); } catch (SQLException e) { } return "\"message\":\"ok\""; } public String read(String db, String table, String keycol, String key, String... values) { String query = QueryFactory.BuildQuery(QueryType.SELECTALL, StorageType.MYSQL); try { Statement stmt = conn.createStatement(); stmt.executeUpdate("USE "+db); ResultSet rs; if (keycol!=null && !keycol.equals("")) rs = stmt.executeQuery(String.format(query, table,keycol,key)); else rs = stmt.executeQuery(String.format("select * from %s", table)); return QueryUtils.formatQueryResult(rs); } catch (SQLException e) { throw new RuntimeException(e); } } public void closeConnection() { if (conn!=null) try { conn.close(); } catch (SQLException e) { throw new RuntimeException(e.getMessage()); } } public ByteArrayOutputStream readChunked(String db, String table, String objectName) { return null; } public String writeChunked(String db, String table, String objectName, InputStream is) { return null; } } <|start_filename|>staash-astyanax/src/main/java/com/netflix/paas/cassandra/admin/CassandraClusterAdminResource.java<|end_filename|> /******************************************************************************* * /*** * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * ******************************************************************************/ package com.netflix.paas.cassandra.admin; import java.util.Collection; import javax.ws.rs.DELETE; import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import com.netflix.paas.cassandra.entity.CassandraClusterEntity; import com.netflix.paas.cassandra.entity.ColumnFamilyEntity; import com.netflix.paas.cassandra.entity.KeyspaceEntity; import com.netflix.paas.exceptions.NotFoundException; import com.netflix.paas.exceptions.PaasException; public interface CassandraClusterAdminResource { @GET public CassandraClusterEntity getClusterDetails(); @GET @Path("ks") public Collection<KeyspaceEntity> listKeyspaces(); @POST @Path("ks") public void createKeyspace(KeyspaceEntity keyspace) throws PaasException; @GET @Path("ks/{keyspace}") public KeyspaceEntity getKeyspace(@PathParam("keyspace") String keyspaceName) throws NotFoundException; @POST @Path("ks/{keyspace}") public void updateKeyspace(@PathParam("keyspace") String keyspaceName, KeyspaceEntity keyspace) throws PaasException; @DELETE @Path("ks/{keyspace}") public void deleteKeyspace(@PathParam("keyspace") String keyspaceName) throws PaasException; @POST @Path("ks/{keyspace}/cf") public void createColumnFamily(@PathParam("keyspace") String keyspaceName, ColumnFamilyEntity columnFamily) throws PaasException; @POST @Path("ks/{keyspace}/cf/{columnfamily}") public void updateColumnFamily(@PathParam("keyspace") String keyspaceName, String columnFamilyName, ColumnFamilyEntity columnFamily) throws PaasException; @GET @Path("ks/{keyspace}/cf/{columnfamily}") public ColumnFamilyEntity getColumnFamily(@PathParam("keyspace") String keyspaceName, String columnFamilyName) throws NotFoundException; @DELETE @Path("ks/{keyspace}/cf/{columnfamily}") public void deleteColumnFamily(@PathParam("keyspace") String keyspaceName, String columnFamilyName) throws PaasException; @GET @Path("cf") public Collection<ColumnFamilyEntity> listColumnFamilies(); @GET @Path("names/ks") public Collection<String> listKeyspaceNames(); @GET @Path("names/cf") public Collection<String> listColumnFamilyNames(); } <|start_filename|>staash-astyanax/src/main/java/com/netflix/paas/dao/astyanax/MetaDaoImpl.java<|end_filename|> /******************************************************************************* * /*** * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * ******************************************************************************/ package com.netflix.paas.dao.astyanax; import com.google.inject.Inject; import com.netflix.astyanax.Keyspace; import com.netflix.astyanax.MutationBatch; import com.netflix.astyanax.connectionpool.OperationResult; import com.netflix.astyanax.connectionpool.exceptions.ConnectionException; import com.netflix.astyanax.model.ColumnFamily; import com.netflix.astyanax.serializers.StringSerializer; import com.netflix.paas.json.JsonObject; import com.netflix.paas.meta.dao.MetaDao; import com.netflix.paas.meta.entity.Entity; import com.netflix.paas.meta.entity.PaasTableEntity; import com.netflix.paas.cassandra.provider.KeyspaceClientProvider; public class MetaDaoImpl implements MetaDao{ KeyspaceClientProvider kscp; public static ColumnFamily<String, String> dbcf = ColumnFamily .newColumnFamily( "db", StringSerializer.get(), StringSerializer.get()); @Inject public MetaDaoImpl(KeyspaceClientProvider kscp) { this.kscp = kscp; } @Override public void writeMetaEntity(Entity entity) { // TODO Auto-generated method stub Keyspace ks = kscp.acquireKeyspace("meta"); ks.prepareMutationBatch(); MutationBatch m; OperationResult<Void> result; m = ks.prepareMutationBatch(); m.withRow(dbcf, entity.getRowKey()).putColumn(entity.getName(), entity.getPayLoad(), null); try { result = m.execute(); if (entity instanceof PaasTableEntity) { String schemaName = ((PaasTableEntity)entity).getSchemaName(); Keyspace schemaks = kscp.acquireKeyspace(schemaName); ColumnFamily<String, String> cf = ColumnFamily.newColumnFamily(entity.getName(), StringSerializer.get(), StringSerializer.get()); schemaks.createColumnFamily(cf, null); } int i = 0; } catch (ConnectionException e) { // TODO Auto-generated catch block e.printStackTrace(); } } @Override public Entity readMetaEntity(String rowKey) { // TODO Auto-generated method stub return null; } @Override public void writeRow(String db, String table, JsonObject rowObj) { // TODO Auto-generated method stub } @Override public String listRow(String db, String table, String keycol, String key) { // TODO Auto-generated method stub return null; } } <|start_filename|>staash-astyanax/src/main/java/com/netflix/paas/cassandra/resources/AstyanaxThriftDataTableResource.java<|end_filename|> /******************************************************************************* * /*** * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * ******************************************************************************/ package com.netflix.paas.cassandra.resources; import java.nio.ByteBuffer; import java.util.Map; import java.util.Map.Entry; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.google.common.collect.Iterables; import com.google.common.collect.Maps; import com.netflix.astyanax.ColumnListMutation; import com.netflix.astyanax.Keyspace; import com.netflix.astyanax.MutationBatch; import com.netflix.astyanax.SerializerPackage; import com.netflix.astyanax.connectionpool.exceptions.ConnectionException; import com.netflix.astyanax.model.Column; import com.netflix.astyanax.model.ColumnFamily; import com.netflix.astyanax.model.ColumnList; import com.netflix.astyanax.model.Row; import com.netflix.astyanax.model.Rows; import com.netflix.astyanax.partitioner.Partitioner; import com.netflix.astyanax.query.RowQuery; import com.netflix.astyanax.serializers.ByteBufferSerializer; import com.netflix.astyanax.util.RangeBuilder; import com.netflix.paas.data.QueryResult; import com.netflix.paas.data.RowData; import com.netflix.paas.data.SchemalessRows; import com.netflix.paas.exceptions.NotFoundException; import com.netflix.paas.exceptions.PaasException; import com.netflix.paas.json.JsonObject; import com.netflix.paas.resources.TableDataResource; /** * Column family REST resource * @author elandau * */ public class AstyanaxThriftDataTableResource implements TableDataResource { private static Logger LOG = LoggerFactory.getLogger(AstyanaxThriftDataTableResource.class); private final Keyspace keyspace; private final ColumnFamily<ByteBuffer, ByteBuffer> columnFamily; private volatile SerializerPackage serializers; public AstyanaxThriftDataTableResource(Keyspace keyspace, String name) { this.keyspace = keyspace; this.columnFamily = ColumnFamily.newColumnFamily(name, ByteBufferSerializer.get(), ByteBufferSerializer.get()); } @Override public QueryResult listRows(String cursor, Integer rowLimit, Integer columnLimit) throws PaasException { try { invariant(); // Execute the query Partitioner partitioner = keyspace.getPartitioner(); Rows<ByteBuffer, ByteBuffer> result = keyspace .prepareQuery(columnFamily) .getKeyRange(null, null, cursor != null ? cursor : partitioner.getMinToken(), partitioner.getMaxToken(), rowLimit) .execute() .getResult(); // Convert raw data into a simple sparse tree SchemalessRows.Builder builder = SchemalessRows.builder(); for (Row<ByteBuffer, ByteBuffer> row : result) { Map<String, String> columns = Maps.newHashMap(); for (Column<ByteBuffer> column : row.getColumns()) { columns.put(serializers.columnAsString(column.getRawName()), serializers.valueAsString(column.getRawName(), column.getByteBufferValue())); } builder.addRow(serializers.keyAsString(row.getKey()), columns); } QueryResult dr = new QueryResult(); dr.setSrows(builder.build()); if (!result.isEmpty()) { dr.setCursor(partitioner.getTokenForKey(Iterables.getLast(result).getKey())); } return dr; } catch (ConnectionException e) { // TODO Auto-generated catch block e.printStackTrace(); } return null; } @Override public void truncateRows() { } @Override public QueryResult readRow(String key, Integer columnCount, String startColumn, String endColumn, Boolean reversed) throws PaasException { invariant(); try { // Construct the query RowQuery<ByteBuffer, ByteBuffer> query = keyspace .prepareQuery(this.columnFamily) .getRow(serializers.keyAsByteBuffer(key)); RangeBuilder range = new RangeBuilder(); if (columnCount != null && columnCount > 0) { range.setLimit(columnCount); } if (startColumn != null && !startColumn.isEmpty()) { range.setStart(serializers.columnAsByteBuffer(startColumn)); } if (endColumn != null && !endColumn.isEmpty()) { range.setEnd(serializers.columnAsByteBuffer(endColumn)); } range.setReversed(reversed); query.withColumnRange(range.build()); // Execute the query ColumnList<ByteBuffer> result = query.execute().getResult(); // Convert raw data into a simple sparse tree SchemalessRows.Builder builder = SchemalessRows.builder(); Map<String, String> columns = Maps.newHashMap(); if (!result.isEmpty()) { for (Column<ByteBuffer> column : result) { columns.put(serializers.columnAsString(column.getRawName()), serializers.valueAsString(column.getRawName(), column.getByteBufferValue())); } builder.addRow(key, columns); } QueryResult dr = new QueryResult(); dr.setSrows(builder.build()); return dr; } catch (ConnectionException e) { throw new PaasException( String.format("Failed to read row '%s' in column family '%s.%s'" , key, this.keyspace.getKeyspaceName(), this.columnFamily.getName()), e); } } @Override public void deleteRow(String key) throws PaasException { invariant(); MutationBatch mb = keyspace.prepareMutationBatch(); mb.withRow(this.columnFamily, serializers.keyAsByteBuffer(key)).delete(); try { mb.execute(); } catch (ConnectionException e) { throw new PaasException( String.format("Failed to update row '%s' in column family '%s.%s'" , key, this.keyspace.getKeyspaceName(), this.columnFamily.getName()), e); } } public void updateRow(String key, RowData rowData) throws PaasException { LOG.info("Update row: " + rowData.toString()); invariant(); MutationBatch mb = keyspace.prepareMutationBatch(); if (rowData.hasSchemalessRows()) { ColumnListMutation<ByteBuffer> mbRow = mb.withRow(this.columnFamily, serializers.keyAsByteBuffer(key)); for (Entry<String, Map<String, String>> row : rowData.getSrows().getRows().entrySet()) { for (Entry<String, String> column : row.getValue().entrySet()) { mbRow.putColumn(serializers.columnAsByteBuffer(column.getKey()), serializers.valueAsByteBuffer(column.getKey(), column.getValue())); } } } try { mb.execute(); } catch (ConnectionException e) { throw new PaasException( String.format("Failed to update row '%s' in column family '%s.%s'" , key, this.keyspace.getKeyspaceName(), this.columnFamily.getName()), e); } } @Override public QueryResult readColumn(String key, String column) throws NotFoundException, PaasException { invariant(); try { Column<ByteBuffer> result = keyspace .prepareQuery(this.columnFamily) .getRow(serializers.keyAsByteBuffer(key)) .getColumn(serializers.columnAsByteBuffer(column)) .execute() .getResult(); // Convert raw data into a simple sparse tree SchemalessRows.Builder builder = SchemalessRows.builder(); Map<String, String> columns = Maps.newHashMap(); columns.put(serializers.columnAsString(result.getRawName()), serializers.valueAsString(result.getRawName(), result.getByteBufferValue())); builder.addRow(key, columns); QueryResult dr = new QueryResult(); dr.setSrows(builder.build()); return dr; } catch (com.netflix.astyanax.connectionpool.exceptions.NotFoundException e) { throw new NotFoundException( "column", String.format("%s.%s.%s.%s", key, column, this.keyspace.getKeyspaceName(), this.columnFamily.getName())); } catch (ConnectionException e) { throw new PaasException( String.format("Failed to read row '%s' in column family '%s.%s'" , key, this.keyspace.getKeyspaceName(), this.columnFamily.getName()), e); } } @Override public void updateColumn(String key, String column, String value) throws NotFoundException, PaasException { LOG.info("Update row"); invariant(); MutationBatch mb = keyspace.prepareMutationBatch(); ColumnListMutation<ByteBuffer> mbRow = mb.withRow(this.columnFamily, serializers.keyAsByteBuffer(key)); mbRow.putColumn(serializers.columnAsByteBuffer(column), serializers.valueAsByteBuffer(column, value)); try { mb.execute(); } catch (ConnectionException e) { throw new PaasException( String.format("Failed to update row '%s' in column family '%s.%s'" , key, this.keyspace.getKeyspaceName(), this.columnFamily.getName()), e); } } @Override public void deleteColumn(String key, String column) throws PaasException { LOG.info("Update row"); invariant(); MutationBatch mb = keyspace.prepareMutationBatch(); ColumnListMutation<ByteBuffer> mbRow = mb.withRow(this.columnFamily, serializers.keyAsByteBuffer(key)); mbRow.deleteColumn(serializers.columnAsByteBuffer(column)); try { mb.execute(); } catch (ConnectionException e) { throw new PaasException( String.format("Failed to update row '%s' in column family '%s.%s'" , key, this.keyspace.getKeyspaceName(), this.columnFamily.getName()), e); } } private void invariant() throws PaasException { if (this.serializers == null) refreshSerializers(); } private void refreshSerializers() throws PaasException { try { this.serializers = this.keyspace.getSerializerPackage(this.columnFamily.getName(), true); } catch (Exception e) { LOG.error("Failed to get serializer package for column family '{}.{}'", new Object[]{keyspace.getKeyspaceName(), this.columnFamily.getName(), e}); throw new PaasException( String.format("Failed to get serializer package for column family '%s.%s' in keyspace", this.keyspace.getKeyspaceName(), this.columnFamily.getName()), e); } } @Override @POST @Path("{db}/{table}") public void updateRow(@PathParam("db") String db, @PathParam("table") String table, JsonObject rowData) throws PaasException { // TODO Auto-generated method stub } } <|start_filename|>staash-svc/src/test/java/com/netflix/paas/rest/test/TestPaasRest.java<|end_filename|> package com.netflix.paas.rest.test; import java.util.Random; import org.junit.Before; import org.junit.Ignore; import org.junit.Test; import com.google.inject.Guice; import com.google.inject.Injector; import com.netflix.staash.cassandra.discovery.EurekaModule; import com.netflix.staash.exception.StorageDoesNotExistException; import com.netflix.staash.json.JsonObject; import com.netflix.staash.rest.meta.entity.EntityType; import com.netflix.staash.service.PaasDataService; import com.netflix.staash.service.PaasMetaService; public class TestPaasRest { PaasMetaService metasvc; PaasDataService datasvc; @Before public void setup() { // metasvc = new PaasMetaService(new CqlMetaDaoImplNew(Cluster.builder().addContactPoint("localhost").build())); EurekaModule em = new EurekaModule(); Injector einj = Guice.createInjector(em); TestPaasPropertiesModule pmod = new TestPaasPropertiesModule(); Injector inj = Guice.createInjector(pmod); metasvc = inj.getInstance(PaasMetaService.class); // datasvc = new PaasDataService(metasvc, Guice.createInjector(pmod).getInstance(ConnectionFactory.class)); datasvc = inj.getInstance(PaasDataService.class); } @Test @Ignore public void createStorage() { String payload = "{\"name\": \"social_nosql_storage\",\"type\": \"cassandra\",\"cluster\": \"cass_social\",\"replicate\":\"another\"}"; String s; try { s = metasvc.writeMetaEntity(EntityType.STORAGE, payload); } catch (StorageDoesNotExistException e) { // TODO Auto-generated catch block e.printStackTrace(); } // Print(s); } private void Print(String s) { System.out.println(s); } @Test @Ignore public void testCreateDb() { //name //meta.writerow(dbentity) String payload = "{\"name\":\"unitdb1\"}"; try { metasvc.writeMetaEntity(EntityType.DB, payload); } catch (StorageDoesNotExistException e) { // TODO Auto-generated catch block e.printStackTrace(); } } @Test @Ignore public void testCreateTable() { String storage = "{\"name\": \"unit.mysql\",\"type\": \"mysql\",\"jdbcurl\": \"jdbc:mysql://localhost:3306/\",\"host\":\"localhost\",\"user\":\"netflix\",\"password\":\"\",\"oss\":\"another\"}"; try { metasvc.writeMetaEntity(EntityType.STORAGE, storage); } catch (StorageDoesNotExistException e) { // TODO Auto-generated catch block e.printStackTrace(); } String dbpay = "{\"name\":\"unitdb2\"}"; try { metasvc.writeMetaEntity(EntityType.DB, dbpay); } catch (StorageDoesNotExistException e) { // TODO Auto-generated catch block e.printStackTrace(); } String tblpay = "{\"name\":\"unittbl2\",\"columns\":\"col1,col2,col3\",\"primarykey\":\"col1\",\"storage\":\"unit.mysql\"}"; String db = "unitdb2"; JsonObject pload = new JsonObject(tblpay); pload.putString("db", db); try { metasvc.writeMetaEntity(EntityType.TABLE, pload.toString()); } catch (StorageDoesNotExistException e) { // TODO Auto-generated catch block e.printStackTrace(); } } @Test @Ignore public void testCreateTableCass() { String storage = "{\"name\": \"unit.cassandra\",\"type\": \"cassandra\",\"cluster\": \"localhost\",\"replicate\":\"another\"}"; try { metasvc.writeMetaEntity(EntityType.STORAGE, storage); } catch (StorageDoesNotExistException e) { // TODO Auto-generated catch block e.printStackTrace(); } String dbpay = "{\"name\":\"unitdb2\"}"; try { metasvc.writeMetaEntity(EntityType.DB, dbpay); } catch (StorageDoesNotExistException e) { // TODO Auto-generated catch block e.printStackTrace(); } String tblpay = "{\"name\":\"tst2\",\"columns\":\"col1,col2,col3\",\"primarykey\":\"col1\",\"storage\":\"unit.cassandra\"}"; String db = "unitdb2"; JsonObject pload = new JsonObject(tblpay); pload.putString("db", db); try { metasvc.writeMetaEntity(EntityType.TABLE, pload.toString()); } catch (StorageDoesNotExistException e) { // TODO Auto-generated catch block e.printStackTrace(); } } @Test @Ignore public void listTablesInaSchema() { } @Test @Ignore public void testInsertRow() { String storage = "{\"name\": \"unit.cassandra\",\"type\": \"cassandra\",\"cluster\": \"localhost\",\"replicate\":\"another\"}"; try { metasvc.writeMetaEntity(EntityType.STORAGE, storage); } catch (StorageDoesNotExistException e) { // TODO Auto-generated catch block e.printStackTrace(); } String dbpay = "{\"name\":\"unitcass\"}"; try { metasvc.writeMetaEntity(EntityType.DB, dbpay); } catch (StorageDoesNotExistException e) { // TODO Auto-generated catch block e.printStackTrace(); } String tblpay = "{\"name\":\"casstable1\",\"columns\":\"col1,col2,col3\",\"primarykey\":\"col1\",\"storage\":\"unit.cassandra\"}"; String db = "unitcass"; JsonObject pload = new JsonObject(tblpay); pload.putString("db", db); try { metasvc.writeMetaEntity(EntityType.TABLE, pload.toString()); } catch (StorageDoesNotExistException e) { // TODO Auto-generated catch block e.printStackTrace(); } String insertPay = "{\"columns\":\"col1,col2,col3\",\"values\":\"'val1','val2','val3'\"}"; datasvc.writeRow(db, "casstable1", new JsonObject(insertPay)); } @Test @Ignore public void testInsertRowMySql() { String storage = "{\"name\": \"unit.mysql\",\"type\": \"mysql\",\"jdbcurl\": \"jdbc:mysql://localhost:3306/\",\"host\":\"localhost\",\"user\":\"dummy\",\"password\":\"\",\"dummy\":\"another\"}"; try { metasvc.writeMetaEntity(EntityType.STORAGE, storage); } catch (StorageDoesNotExistException e) { // TODO Auto-generated catch block e.printStackTrace(); } String dbpay = "{\"name\":\"unitdb3\"}"; try { metasvc.writeMetaEntity(EntityType.DB, dbpay); } catch (StorageDoesNotExistException e) { // TODO Auto-generated catch block e.printStackTrace(); } String tblpay = "{\"name\":\"my2\",\"columns\":\"col1,col2,col3\",\"primarykey\":\"col1\",\"storage\":\"unit.mysql\"}"; String db = "unitdb3"; JsonObject pload = new JsonObject(tblpay); pload.putString("db", db); try { metasvc.writeMetaEntity(EntityType.TABLE, pload.toString()); } catch (StorageDoesNotExistException e) { // TODO Auto-generated catch block e.printStackTrace(); } String insertPay = "{\"columns\":\"col1,col2,col3\",\"values\":\"'val1','val2','val3'\"}"; datasvc.writeRow(db, "my2", new JsonObject(insertPay)); } @Test @Ignore public void testInsertRowMySqlRemote() { String storage = "{\"name\": \"unit.mysqlremote\",\"type\": \"mysql\",\"jdbcurl\": \"jdbc:mysql://test.ceqg1dgfu0mp.useast1.rds.amazonaws.com:3306/\",\"host\":\"test.ceqg1dgfu0mp.useast-1.rds.amazonaws.com\",\"user\":\"dummy\",\"password\":\"<PASSWORD>\",\"replicate\":\"another\"}"; try { metasvc.writeMetaEntity(EntityType.STORAGE, storage); } catch (StorageDoesNotExistException e) { // TODO Auto-generated catch block e.printStackTrace(); } String dbpay = "{\"name\":\"unitdb3\"}"; try { metasvc.writeMetaEntity(EntityType.DB, dbpay); } catch (StorageDoesNotExistException e) { // TODO Auto-generated catch block e.printStackTrace(); } String tblpay = "{\"name\":\"my2\",\"columns\":\"col1,col2,col3\",\"primarykey\":\"col1\",\"storage\":\"unit.mysqlremote\"}"; String db = "unitdb3"; JsonObject pload = new JsonObject(tblpay); pload.putString("db", db); try { metasvc.writeMetaEntity(EntityType.TABLE, pload.toString()); } catch (StorageDoesNotExistException e) { // TODO Auto-generated catch block e.printStackTrace(); } String insertPay = "{\"columns\":\"col1,col2,col3\",\"values\":\"'val1','val2','val3'\"}"; datasvc.writeRow(db, "my2", new JsonObject(insertPay)); } @Test @Ignore public void testRemoteJoin() { long start = System.currentTimeMillis(); String clustername = "ec2-54-242-127-138.compute-1.amazonaws.com"; String storage = "{\"name\": \"unit.remotecassandra\",\"type\": \"cassandra\",\"cluster\": \"ec2-54-242-127-138.compute-1.amazonaws.com:7102\",\"replicate\":\"another\"}"; try { metasvc.writeMetaEntity(EntityType.STORAGE, storage); } catch (StorageDoesNotExistException e) { // TODO Auto-generated catch block e.printStackTrace(); } Print("Storage:"+(System.currentTimeMillis() - start)); String dbpay = "{\"name\":\"jointest\"}"; try { metasvc.writeMetaEntity(EntityType.DB, dbpay); } catch (StorageDoesNotExistException e) { // TODO Auto-generated catch block e.printStackTrace(); } Print("db:"+(System.currentTimeMillis() - start)); String table1="cassjoin"+ new Random().nextInt(200); String tblpay = "{\"name\":\""+table1+"\",\"columns\":\"username,friends,wall,status\",\"primarykey\":\"username\",\"storage\":\"unit.remotecassandra\"}"; String db = "jointest"; JsonObject pload = new JsonObject(tblpay); pload.putString("db", db); try { metasvc.writeMetaEntity(EntityType.TABLE, pload.toString()); } catch (StorageDoesNotExistException e) { // TODO Auto-generated catch block e.printStackTrace(); } Print("table:"+(System.currentTimeMillis() - start)); String insertPay = "{\"columns\":\"username,friends,wall,status\",\"values\":\"'federer','rafa#haas#tommy#sachin#beckham','getting ready for my next#out of wimbledon#out of french','looking fwd to my next match'\"}"; datasvc.writeRow(db, table1, new JsonObject(insertPay)); Print("insert cass:"+(System.currentTimeMillis() - start)); String table2="mysqljoin" + new Random().nextInt(200);; tblpay = "{\"name\":\""+table2+"\",\"columns\":\"username,first,last,lastlogin,paid,address,email\",\"primarykey\":\"username\",\"storage\":\"unit.mysqlremote\"}"; pload = new JsonObject(tblpay); pload.putString("db", db); try { metasvc.writeMetaEntity(EntityType.TABLE, pload.toString()); } catch (StorageDoesNotExistException e) { // TODO Auto-generated catch block e.printStackTrace(); } Print("create mysql table:"+(System.currentTimeMillis() - start)); insertPay = "{\"columns\":\"username,first,last,lastlogin,paid,address,email\",\"values\":\"'federer','Roger','Federer','july first','paid','1 swiss drive','<EMAIL>'\"}"; datasvc.writeRow(db, table2, new JsonObject(insertPay)); Print("insert mysql row:"+(System.currentTimeMillis() - start)); String str = datasvc.doJoin(db, table1, table2, "username", "rogerfederer"); Print("Join:"+(System.currentTimeMillis() - start)); Print("Join is"); Print(str); } @Test @Ignore public void testjoin1() { String str = datasvc.doJoin("jointest", "mysqljoin43", "cassjoin78", "username", "federer"); // Print("Join:"+(System.currentTimeMillis() - start)); Print("Join is"); Print(str); } @Test @Ignore public void testJoin() { // String clustername = "localhost"; // String storage = "{\"name\": \"unit.cassandra\",\"type\": \"cassandra\",\"cluster\": \"localhost\",\"replicate\":\"another\"}"; // metasvc.writeMetaEntity(EntityType.STORAGE, storage); String dbpay = "{\"name\":\"ljointest\"}"; try { metasvc.writeMetaEntity(EntityType.DB, dbpay); } catch (StorageDoesNotExistException e) { // TODO Auto-generated catch block e.printStackTrace(); } String table1="join1"; String tblpay = "{\"name\":\"join1\",\"columns\":\"username,friends,wall,status\",\"primarykey\":\"username\",\"storage\":\"unit.cassandra\"}"; String db = "jointest"; JsonObject pload = new JsonObject(tblpay); pload.putString("db", db); try { metasvc.writeMetaEntity(EntityType.TABLE, pload.toString()); } catch (StorageDoesNotExistException e) { // TODO Auto-generated catch block e.printStackTrace(); } String insertPay = "{\"columns\":\"username,friends,wall,status\",\"values\":\"'rogerfederer','rafa#haas#tommy#sachin#beckham','getting ready for my next#out of wimbledon#out of french','looking fwd to my next match'\"}"; datasvc.writeRow(db, "join1", new JsonObject(insertPay)); String table2="join2"; tblpay = "{\"name\":\"join2\",\"columns\":\"username,first,last,lastlogin,paid,address,email\",\"primarykey\":\"username\",\"storage\":\"unit.mysql\"}"; pload = new JsonObject(tblpay); pload.putString("db", db); try { metasvc.writeMetaEntity(EntityType.TABLE, pload.toString()); } catch (StorageDoesNotExistException e) { // TODO Auto-generated catch block e.printStackTrace(); } String str = datasvc.doJoin(db, table1, table2, "username", "rogerfederer"); Print(str); } @Test @Ignore public void testCreateTimeseriesTable() { String tblpay = "{\"name\":\"timeseries1\",\"periodicity\":\"10000\",\"prefix\":\"server1\",\"storage\":\"unit.cassandra\"}"; String db = "unitdb2"; JsonObject pload = new JsonObject(tblpay); pload.putString("db", db); try { metasvc.writeMetaEntity(EntityType.SERIES, pload.toString()); } catch (StorageDoesNotExistException e) { // TODO Auto-generated catch block e.printStackTrace(); } } @Test @Ignore public void insertEvent() { String db = "unitdb2"; String table = "timeseries1"; String payload1="{\"time\":11000,\"event\":\"hello 11k event\"}"; String payload2="{\"time\":21000,\"event\":\"hi 21k event\"}"; datasvc.writeEvent(db, table, new JsonObject(payload1)); datasvc.writeEvent(db, table, new JsonObject(payload2)); } @Test @Ignore public void readEvent() { String evtime = "11000"; String db = "unitdb2"; String table = "timeseries1"; String out; out = datasvc.readEvent(db, table, evtime); out = datasvc.readEvent(db, table, "21000"); out = datasvc.readEvent(db, table, "100000"); int i = 0; } @Test @Ignore public void listStorage() { String out = metasvc.listStorage(); Print(out); } @Test @Ignore public void listSchemas() { String out = metasvc.listSchemas(); Print(out); } @Test @Ignore public void listTablesInSchema() { String out = metasvc.listTablesInSchema("unitdb2"); Print(out); } @Test @Ignore public void listTimeseriesInSchema() { String out = metasvc.listTimeseriesInSchema("unitdb2"); Print(out); } @Test @Ignore public void testInsertColumn() { } @Test @Ignore public void testUpdateRow() { } @Test @Ignore public void testDeleteRow() { } @Test @Ignore public void testDeleteColumn() { } @Test @Ignore public void testQuery() { } @Test @Ignore public void runMrJob() { } } <|start_filename|>staash-astyanax/src/main/java/com/netflix/paas/cassandra/provider/impl/DefaultKeyspaceClientProvider.java<|end_filename|> /******************************************************************************* * /*** * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * ******************************************************************************/ package com.netflix.paas.cassandra.provider.impl; import java.util.Map; import java.util.concurrent.atomic.AtomicLong; import org.apache.commons.configuration.AbstractConfiguration; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.google.inject.Inject; import com.netflix.astyanax.AstyanaxContext; import com.netflix.astyanax.Keyspace; import com.netflix.astyanax.connectionpool.exceptions.ConnectionException; import com.netflix.astyanax.thrift.ThriftFamilyFactory; import com.netflix.paas.cassandra.keys.KeyspaceKey; import com.netflix.paas.cassandra.provider.AstyanaxConfigurationProvider; import com.netflix.paas.cassandra.provider.AstyanaxConnectionPoolConfigurationProvider; import com.netflix.paas.cassandra.provider.AstyanaxConnectionPoolMonitorProvider; import com.netflix.paas.cassandra.provider.HostSupplierProvider; import com.netflix.paas.cassandra.provider.KeyspaceClientProvider; public class DefaultKeyspaceClientProvider implements KeyspaceClientProvider { private static final Logger LOG = LoggerFactory.getLogger(DefaultKeyspaceClientProvider.class); private static final String DISCOVERY_TYPE_FORMAT = "com.netflix.paas.schema.%s.discovery"; private static final String CLUSTER_NAME_FORMAT = "com.netflix.paas.schema.%s.cluster"; private static final String KEYSPACE_NAME__FORMAT = "com.netflix.paas.schema.%s.keyspace"; ImmutableMap<String, Object> defaultKsOptions = ImmutableMap.<String, Object>builder() .put("strategy_options", ImmutableMap.<String, Object>builder() .put("replication_factor", "1") .build()) .put("strategy_class", "SimpleStrategy") .build(); public static class KeyspaceContextHolder { private AstyanaxContext<Keyspace> context; private AtomicLong refCount = new AtomicLong(0); public KeyspaceContextHolder(AstyanaxContext<Keyspace> context) { this.context = context; } public Keyspace getKeyspace() { return context.getClient(); } public void start() { context.start(); } public void shutdown() { context.shutdown(); } public long addRef() { return refCount.incrementAndGet(); } public long releaseRef() { return refCount.decrementAndGet(); } } private final Map<String, KeyspaceContextHolder> contextMap = Maps.newHashMap(); private final AstyanaxConfigurationProvider configurationProvider; private final AstyanaxConnectionPoolConfigurationProvider cpProvider; private final AstyanaxConnectionPoolMonitorProvider monitorProvider; private final Map<String, HostSupplierProvider> hostSupplierProviders; private final AbstractConfiguration configuration; @Inject public DefaultKeyspaceClientProvider( AbstractConfiguration configuration, Map<String, HostSupplierProvider> hostSupplierProviders, AstyanaxConfigurationProvider configurationProvider, AstyanaxConnectionPoolConfigurationProvider cpProvider, AstyanaxConnectionPoolMonitorProvider monitorProvider) { this.configurationProvider = configurationProvider; this.cpProvider = cpProvider; this.monitorProvider = monitorProvider; this.hostSupplierProviders = hostSupplierProviders; this.configuration = configuration; } @Override public synchronized Keyspace acquireKeyspace(String schemaName) { schemaName = schemaName.toLowerCase(); Preconditions.checkNotNull(schemaName, "Invalid schema name 'null'"); KeyspaceContextHolder holder = contextMap.get(schemaName); if (holder == null) { LOG.info("Creating schema for '{}'", new Object[]{schemaName}); String clusterName = configuration.getString(String.format(CLUSTER_NAME_FORMAT, schemaName)); String keyspaceName = configuration.getString(String.format(KEYSPACE_NAME__FORMAT, schemaName)); String discoveryType = configuration.getString(String.format(DISCOVERY_TYPE_FORMAT, schemaName)); if (clusterName==null || clusterName.equals("")) clusterName = configuration.getString(String.format(CLUSTER_NAME_FORMAT, "configuration")); if (keyspaceName == null || keyspaceName.equals("")) keyspaceName = schemaName; if (discoveryType==null || discoveryType.equals("")) discoveryType = configuration.getString(String.format(DISCOVERY_TYPE_FORMAT, "configuration")); Preconditions.checkNotNull(clusterName, "Missing cluster name for schema " + schemaName + " " + String.format(CLUSTER_NAME_FORMAT,schemaName)); Preconditions.checkNotNull(keyspaceName, "Missing cluster name for schema " + schemaName + " " + String.format(KEYSPACE_NAME__FORMAT,schemaName)); Preconditions.checkNotNull(discoveryType, "Missing cluster name for schema " + schemaName + " " + String.format(DISCOVERY_TYPE_FORMAT,schemaName)); HostSupplierProvider hostSupplierProvider = hostSupplierProviders.get(discoveryType); Preconditions.checkNotNull(hostSupplierProvider, String.format("Unknown host supplier provider '%s' for schema '%s'", discoveryType, schemaName)); AstyanaxContext<Keyspace> context = new AstyanaxContext.Builder() .forCluster(clusterName) .forKeyspace(keyspaceName) .withAstyanaxConfiguration(configurationProvider.get(schemaName)) .withConnectionPoolConfiguration(cpProvider.get(schemaName)) .withConnectionPoolMonitor(monitorProvider.get(schemaName)) .withHostSupplier(hostSupplierProvider.getSupplier(clusterName)) .buildKeyspace(ThriftFamilyFactory.getInstance()); context.start(); try { context.getClient().createKeyspace(defaultKsOptions); } catch (ConnectionException e) { // TODO Auto-generated catch block e.printStackTrace(); } holder = new KeyspaceContextHolder(context); contextMap.put(schemaName, holder); holder.start(); } holder.addRef(); return holder.getKeyspace(); } @Override public synchronized void releaseKeyspace(String schemaName) { KeyspaceContextHolder holder = contextMap.get(schemaName); if (holder.releaseRef() == 0) { contextMap.remove(schemaName); holder.shutdown(); } } @Override public Keyspace acquireKeyspace(KeyspaceKey key) { String schemaName = key.getSchemaName().toLowerCase(); Preconditions.checkNotNull(schemaName, "Invalid schema name 'null'"); KeyspaceContextHolder holder = contextMap.get(schemaName); if (holder == null) { Preconditions.checkNotNull(key.getClusterName(), "Missing cluster name for schema " + schemaName); Preconditions.checkNotNull(key.getKeyspaceName(), "Missing cluster name for schema " + schemaName); Preconditions.checkNotNull(key.getDiscoveryType(), "Missing cluster name for schema " + schemaName); HostSupplierProvider hostSupplierProvider = hostSupplierProviders.get(key.getDiscoveryType()); Preconditions.checkNotNull(hostSupplierProvider, "Unknown host supplier provider " + key.getDiscoveryType()); AstyanaxContext<Keyspace> context = new AstyanaxContext.Builder() .forCluster(key.getClusterName()) .forKeyspace(key.getKeyspaceName()) .withAstyanaxConfiguration(configurationProvider.get(schemaName)) .withConnectionPoolConfiguration(cpProvider.get(schemaName)) .withConnectionPoolMonitor(monitorProvider.get(schemaName)) .withHostSupplier(hostSupplierProvider.getSupplier(key.getClusterName())) .buildKeyspace(ThriftFamilyFactory.getInstance()); holder = new KeyspaceContextHolder(context); contextMap.put(schemaName, holder); holder.start(); } holder.addRef(); return holder.getKeyspace(); } } <|start_filename|>staash-eureka/src/main/java/com/netflix/paas/cassandra/discovery/EurekaClusterDiscoveryService.java<|end_filename|> /******************************************************************************* * /*** * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * ******************************************************************************/ package com.netflix.paas.cassandra.discovery; import java.util.Collection; import java.util.regex.Matcher; import java.util.regex.Pattern; import javax.annotation.PostConstruct; import javax.annotation.PreDestroy; import org.apache.commons.configuration.AbstractConfiguration; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.google.common.base.Function; import com.google.common.base.Predicate; import com.google.common.collect.Collections2; import com.google.inject.Inject; import com.netflix.discovery.DiscoveryClient; import com.netflix.discovery.DiscoveryManager; import com.netflix.discovery.shared.Application; /** * Implementation of a cluster discovery service using Eureka * * @author elandau * */ public class EurekaClusterDiscoveryService implements ClusterDiscoveryService { private static final Logger LOG = LoggerFactory.getLogger(EurekaClusterDiscoveryService.class); private static final String PROPERTY_MATCH = "com.netflix.paas.discovery.eureka.match"; private DiscoveryClient client; private AbstractConfiguration config; @Inject public EurekaClusterDiscoveryService(AbstractConfiguration config) { this.config = config; initialize(); } @PostConstruct public void initialize() { LOG.info("Initializing Eureka client"); client = DiscoveryManager.getInstance().getDiscoveryClient(); } @PreDestroy public void shutdown() { // TODO: Move this somewhere else LOG.info("Shutting down Eureka client"); DiscoveryManager.getInstance().shutdownComponent(); client = null; } @Override public Collection<String> getClusterNames() { final Pattern regex = Pattern.compile(this.config.getString(PROPERTY_MATCH)); return Collections2.filter( Collections2.transform(client.getApplications().getRegisteredApplications(), new Function<Application, String>() { @Override public String apply(Application app) { return app.getName(); } }), new Predicate<String>() { @Override public boolean apply(String clusterName) { Matcher m = regex.matcher(clusterName); return m.matches(); } }); } @Override public String getName() { return "eureka"; } } <|start_filename|>staash-svc/src/main/java/com/netflix/staash/rest/util/Pair.java<|end_filename|> /******************************************************************************* * /* * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * * * ******************************************************************************/ package com.netflix.staash.rest.util; import org.apache.commons.lang.Validate; import org.apache.commons.lang.builder.EqualsBuilder; import org.apache.commons.lang.builder.HashCodeBuilder; public class Pair<L, R> { private final L left; private final R right; /** * @param left * @param right */ public Pair(L left, R right) { Validate.notNull(left); this.left = left; Validate.notNull(right); this.right = right; } /** * @return L */ public L getLeft() { return left; } /** * @return R */ public R getRight() { return right; } /* (non-Javadoc) * @see java.lang.Object#equals(java.lang.Object) */ @Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof Pair)) return false; Pair<?,?> that = (Pair<?,?>) other; return new EqualsBuilder(). append(this.left, that.left). append(this.right, that.left). isEquals(); } /* (non-Javadoc) * @see java.lang.Object#hashCode() */ @Override public int hashCode() { return new HashCodeBuilder(). append(this.left). append(this.right). toHashCode(); } /* (non-Javadoc) * @see java.lang.Object#toString() */ @Override public String toString() { StringBuffer sb = new StringBuffer(); sb.append("("). append(this.left). append(","). append(this.right). append(")"); return sb.toString(); } } <|start_filename|>staash-svc/src/main/java/com/netflix/staash/common/query/QueryFactory.java<|end_filename|> /******************************************************************************* * /* * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * * * ******************************************************************************/ package com.netflix.staash.common.query; import com.netflix.staash.model.StorageType; public class QueryFactory { public static final String INSERT_FORMAT = "INSERT INTO %s(%s) VALUES (%s)"; public static final String CREATE_DB_FORMAT_MYSQL = "CREATE DATABASE %s"; public static final String CREATE_DB_FORMAT_CASS = "CREATE KEYSPACE %s WITH replication = { 'class' : 'SimpleStrategy', 'replication_factor' : %d }"; public static final String CREATE_TABLE_FORMAT = "CREATE TABLE %s(%s PRIMARY KEY(%s))"; public static final String SWITCH_DB_FORMAT = "USE %s"; public static final String SELECT_ALL = "SELECT * FROM %s WHERE %s='%s';"; public static final String SELECT_EVENT = "SELECT * FROM %s WHERE %s='%s' AND %s=%s;"; public static String BuildQuery(QueryType qType,StorageType sType) { switch (sType) { case CASSANDRA: switch (qType) { case INSERT: return INSERT_FORMAT; case CREATEDB: return CREATE_DB_FORMAT_CASS; case CREATETABLE: return CREATE_TABLE_FORMAT; case SWITCHDB: return SWITCH_DB_FORMAT; case SELECTALL: return SELECT_ALL; case SELECTEVENT: return SELECT_EVENT; } case MYSQL: switch (qType) { case INSERT: return INSERT_FORMAT; case CREATEDB: return CREATE_DB_FORMAT_MYSQL; case CREATETABLE: return CREATE_TABLE_FORMAT; case SWITCHDB: return SWITCH_DB_FORMAT; case SELECTALL: return SELECT_ALL; } } return null; } // //needs to be modified // public static String BuildCreateTableQuery(PaasTableEntity tableEnt, StorageType type) { // // TODO Auto-generated method stub // String storage = tableEnt.getStorage(); // if (type!=null && type.getCannonicalName().equals(StorageType.MYSQL.getCannonicalName())) { // String schema = tableEnt.getSchemaName(); // String tableName = tableEnt.getName().split("\\.")[1]; // List<Pair<String, String>> columns = tableEnt.getColumns(); // String colStrs = ""; // for (Pair<String, String> colPair : columns) { // colStrs = colStrs + colPair.getRight() + " " + colPair.getLeft() // + ", "; // } // String primarykeys = tableEnt.getPrimarykey(); // String PRIMARYSTR = "PRIMARY KEY(" + primarykeys + ")"; // return "CREATE TABLE " + tableName + " (" + colStrs // + " " + PRIMARYSTR + ");"; // } else { // String schema = tableEnt.getSchemaName(); // String tableName = tableEnt.getName().split("\\.")[1]; // List<Pair<String, String>> columns = tableEnt.getColumns(); // String colStrs = ""; // for (Pair<String, String> colPair : columns) { // colStrs = colStrs + colPair.getRight() + " " + colPair.getLeft() // + ", "; // } // String primarykeys = tableEnt.getPrimarykey(); // String PRIMARYSTR = "PRIMARY KEY(" + primarykeys + ")"; // return "CREATE TABLE " + schema + "." + tableName + " (" + colStrs // + " " + PRIMARYSTR + ");"; // } // } } <|start_filename|>staash-tomcat/src/main/java/com/netflix/staash/embedded/Tomcat7Server.java<|end_filename|> package com.netflix.staash.embedded; import org.apache.catalina.core.AprLifecycleListener; import org.apache.catalina.core.StandardServer; public class Tomcat7Server { // public static void main(String[] args) throws Exception { // String appBase = "src/main"; // Integer port = 8080; // // Tomcat tomcat = new Tomcat(); // tomcat.setPort(port); // // tomcat.setBaseDir("."); // tomcat.getHost().setAppBase(appBase); // // String contextPath = ""; // // // Add AprLifecycleListener // //StandardServer server = (StandardServer)tomcat.getServer(); // //AprLifecycleListener listener = new AprLifecycleListener(); // // server.addLifecycleListener(listener); // //server.addLifecycleListener(listener); // // tomcat.addWebapp(contextPath, appBase); // tomcat.start(); // tomcat.getServer().await(); // } } <|start_filename|>staash-svc/src/main/java/com/netflix/staash/connection/PaasConnectionFactory.java<|end_filename|> /******************************************************************************* * /* * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * * * ******************************************************************************/ package com.netflix.staash.connection; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import com.datastax.driver.core.Cluster; import com.datastax.driver.core.policies.RoundRobinPolicy; import com.datastax.driver.core.policies.TokenAwarePolicy; import com.netflix.staash.cassandra.discovery.EurekaAstyanaxHostSupplier; import com.netflix.staash.json.JsonObject; import com.netflix.staash.model.CassandraStorage; import com.netflix.staash.model.MySqlStorage; import com.netflix.staash.service.CLIENTTYPE; public class PaasConnectionFactory implements ConnectionFactory{ private String clientType = "astyanax"; private EurekaAstyanaxHostSupplier hs; public PaasConnectionFactory(String clientType, EurekaAstyanaxHostSupplier hs) { this.clientType = clientType; this.hs = hs; } public PaasConnection createConnection(JsonObject storageConf, String db) { String type = storageConf.getString("type"); if (type.equals("mysql")) { MySqlStorage mysqlStorageConf = new MySqlStorage(storageConf); try { Class.forName("com.mysql.jdbc.Driver"); Connection connection = DriverManager .getConnection(mysqlStorageConf.getJdbcurl(),mysqlStorageConf.getUser(), mysqlStorageConf.getPassword()); return new MySqlConnection(connection); } catch (ClassNotFoundException e) { e.printStackTrace(); throw new RuntimeException(e); } catch (SQLException e) { e.printStackTrace(); throw new RuntimeException(e); } } else { CassandraStorage cassStorage = new CassandraStorage(storageConf); if (clientType.equals(CLIENTTYPE.ASTYANAX.getType())) { return new AstyanaxCassandraConnection(cassStorage.getCluster(), db, hs); } else { Cluster cluster = Cluster.builder().withLoadBalancingPolicy(new TokenAwarePolicy(new RoundRobinPolicy())).addContactPoint(cassStorage.getCluster()).build(); return new CassandraConnection(cluster); } } } } <|start_filename|>staash-web/src/test/java/com/netflix/staash/web/tests/StaashTestHelper.java<|end_filename|> /******************************************************************************* * /* * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * * * ******************************************************************************/ package com.netflix.staash.web.tests; import com.netflix.staash.exception.StorageDoesNotExistException; import com.netflix.staash.json.JsonObject; import com.netflix.staash.rest.meta.entity.EntityType; import com.netflix.staash.service.MetaService; import com.netflix.staash.service.PaasDataService; public class StaashTestHelper { public static final String ServerUrl = "http://localhost:8080"; public static final String CreateDBUrl = "/paas/v1/admin"; public static final String CreateDBPayload = "{name: testdb}"; public static final String ListDBUrl = "/paas/v1/admin"; public static final String CreateStorageUrl = "http://localhost:8080/paas/v1/admin/storage"; public static final String CreateStoragePayloadCassandra = "{name:testStorageCass, type: cassandra, cluster:local, replicateto:newcluster"; public static final String ListStorage = "/paas/v1/admin/storage"; public static final String CreateTableUrl = "/paas/v1/admin/testdb"; public static final String CreateTablePayload = "{name:testtable, columns:user,friends,wall,status, primarykey:user, storage: teststoagecass}"; public static final String ListTablesUrl = "/paas/v1/admin/testdb"; public static final String InsertRowUrl = "/paas/v1/data/testdb/testtable"; public static final String InserRowUrlPayload = "{columns:user,friends,wall,status,values:rogerfed,rafanad,blahblah,blahblahblah}"; public static final String ReadRowUrl = "/paas/v1/data/testdb/testtable/username/rogerfed"; public static final String CreateTimeSeriesUrl = "/paa/v1/admin/timeseries/testdb"; public static final String CreateTimeSeriesPayload = "{\"name\":\"testseries\",\"msperiodicity\":10000,\"prefix\":\"rogerfed\"}"; public static final String ListTimeSeriesUrl = "/paas/v1/admin/timeseries/testdb"; public static final String CreateEventUrl = "/paas/v1/admin/timeseries/testdb/testseries"; public static final String CreateEventPayload = "{\"time\":1000000,\"event\":\"{tweet: enjoying a cruise}}\""; public static final String ReadEventUrl = "/paas/v1/data/timeseries/testdb/testseries/time/100000/prefix/rogerfed"; public static final String storagePayload = "{\"name\": \"cassandratest\",\"type\": \"cassandra\",\"cluster\": \"localhost\",\"rf\":\"replication_factor:1\",\"strategy\":\"SimpleStrategy\"}"; public static final String dbPayload = "{\"name\":\"unitdb1\",\"rf\":\"replication_factor:1\",\"strategy\":\"SimpleStrategy\"}"; public static final String db = "unitdb1"; public static final String timeseries = "timeseries1"; public static final String storage = "cassandratest"; public static void createTestStorage(MetaService metasvc) { try { metasvc.writeMetaEntity(EntityType.STORAGE, storagePayload); } catch (StorageDoesNotExistException e) { e.printStackTrace(); } } public static void createTestDB(MetaService metasvc) { try { metasvc.writeMetaEntity(EntityType.DB, dbPayload); } catch (StorageDoesNotExistException e) { e.printStackTrace(); } } public static void createTestTimeSeries(MetaService metasvc, String tblpay) { JsonObject pload = new JsonObject(tblpay); pload.putString("db", db); try { metasvc.writeMetaEntity(EntityType.SERIES, pload.toString()); } catch (StorageDoesNotExistException e) { e.printStackTrace(); } } public static void writeEvent(PaasDataService datasvc, JsonObject evPayload) { datasvc.writeEvent(db, timeseries, evPayload); } public static void readEvent() { } /* * Table Test */ public static void createTestTable(MetaService metasvc, String tblpay) { JsonObject pload = new JsonObject(tblpay); pload.putString("db", db); try { metasvc.writeMetaEntity(EntityType.TABLE, pload.toString()); } catch (StorageDoesNotExistException e) { e.printStackTrace(); } } } <|start_filename|>staash-mesh/src/test/java/com/netflix/paas/ptp/TestDriver.java<|end_filename|> /******************************************************************************* * /*** * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * ******************************************************************************/ package com.netflix.paas.ptp; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; import com.netflix.staash.mesh.InstanceRegistry; import com.netflix.staash.mesh.client.ClientFactory; import com.netflix.staash.mesh.client.memory.MemoryClientFactory; import com.netflix.staash.mesh.db.Entry; import com.netflix.staash.mesh.db.TopicRegistry; import com.netflix.staash.mesh.db.memory.MemoryTopicFactory; import com.netflix.staash.mesh.endpoints.ChordEndpointPolicy; import com.netflix.staash.mesh.endpoints.EndpointPolicy; import com.netflix.staash.mesh.server.Server; public class TestDriver { public static void main(String[] args) { final ScheduledExecutorService executor = Executors.newScheduledThreadPool(10); final TopicRegistry topics = new TopicRegistry(new MemoryTopicFactory()); final InstanceRegistry registry = new InstanceRegistry(); final ClientFactory factory = new MemoryClientFactory(); final EndpointPolicy endpointPolicy = new ChordEndpointPolicy(); topics.createTopic("test"); topics.addEntry("test", new Entry("Key1", "Value1", System.currentTimeMillis())); topics.addEntry("test", new Entry("Key2", "Value2", System.currentTimeMillis())); final AtomicInteger counter = new AtomicInteger(); final int instanceCount = 10; final int asgCount = 10; final long asgCreateDelay = 5; // // Thread to add random server // executor.execute(new Runnable() { // @Override // public void run() { // long id = counter.incrementAndGet(); // if (id < asgCount) { // for (int i = 0; i < instanceCount; i++) { // try { // Server server = new Server(registry, factory, endpointPolicy, "" + (id * instanceCount + i)); // server.start(); // } // catch (Exception e) { // e.printStackTrace(); // } // } // executor.schedule(this, asgCreateDelay, TimeUnit.SECONDS); // } // } // }); // // executor.scheduleAtFixedRate(new Runnable() { // @Override // public void run() { // } // }, 10, 10, TimeUnit.SECONDS); // // try { // Thread.sleep(100000); // } catch (InterruptedException e) { // } } } <|start_filename|>staash-astyanax/src/main/java/com/netflix/paas/cassandra/MetaCassandraBootstrap.java<|end_filename|> /******************************************************************************* * /*** * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * ******************************************************************************/ package com.netflix.paas.cassandra; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.google.inject.Inject; import com.netflix.paas.PaasBootstrap; import com.netflix.paas.SchemaNames; import com.netflix.paas.cassandra.entity.CassandraClusterEntity; import com.netflix.paas.dao.Dao; import com.netflix.paas.dao.DaoProvider; import com.netflix.paas.dao.DaoSchema; public class MetaCassandraBootstrap { private static final Logger LOG = LoggerFactory.getLogger(PaasBootstrap.class); @Inject public MetaCassandraBootstrap(DaoProvider daoProvider) throws Exception { LOG.info("Bootstrap Meta Cassandra"); DaoSchema schemaDao = daoProvider.getSchema(SchemaNames.META.name()); if (!schemaDao.isExists()) { schemaDao.createSchema(); } Dao<CassandraClusterEntity> clusterDao = daoProvider.getDao(SchemaNames.META.name(), CassandraClusterEntity.class); if (!clusterDao.isExists()) { clusterDao.createTable(); } } } <|start_filename|>staash-svc/src/main/java/com/netflix/staash/rest/resources/StaashAdminResourceImpl.java<|end_filename|> /******************************************************************************* * /* * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * * * ******************************************************************************/ package com.netflix.staash.rest.resources; import javax.ws.rs.Consumes; import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import com.google.inject.Inject; import com.netflix.staash.exception.StorageDoesNotExistException; import com.netflix.staash.json.JsonObject; import com.netflix.staash.rest.meta.entity.EntityType; import com.netflix.staash.service.MetaService; import com.sun.jersey.spi.container.ResourceFilters; @Path("/staash/v1/admin") public class StaashAdminResourceImpl { private final MetaService metasvc; @Inject public StaashAdminResourceImpl(MetaService meta) { this.metasvc = meta; } @GET @Produces(MediaType.APPLICATION_JSON) @Path("/db") @ResourceFilters(StaashAuditFilter.class) public String listSchemas() { String schemas = metasvc.listSchemas(); return schemas; } @GET @Produces(MediaType.APPLICATION_JSON) @Path("/storage") @ResourceFilters(StaashAuditFilter.class) public String listStorage() { String storages = metasvc.listStorage(); return storages; } @GET @Produces(MediaType.APPLICATION_JSON) @Path("/db/{schema}") @ResourceFilters(StaashAuditFilter.class) public String listTables(@PathParam("schema") String schema) { String schemas = metasvc.listTablesInSchema(schema); return schemas; } @GET @Produces(MediaType.APPLICATION_JSON) @Path("/timeseries/{schema}") @ResourceFilters(StaashAuditFilter.class) public String listTimeseries(@PathParam("schema") String schema) { String schemas = metasvc.listTimeseriesInSchema(schema); return schemas; } @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("/db") @ResourceFilters(StaashAuditFilter.class) public String createSchema(String payLoad) { if (payLoad!=null) { try { return metasvc.writeMetaEntity(EntityType.DB, payLoad); } catch (StorageDoesNotExistException e) { e.printStackTrace(); } } JsonObject obj = new JsonObject("{\"message\":\"payload can not be null must conform to: {name:<name>,cluster:<cluster>}\""); return obj.toString(); } @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("/storage") @ResourceFilters(StaashAuditFilter.class) public String createStorage(String payload) { if (payload!=null) { try { return metasvc.writeMetaEntity(EntityType.STORAGE, payload); } catch (StorageDoesNotExistException e) { e.printStackTrace(); } } JsonObject obj = new JsonObject("{\"message\":\"payload can not be null must conform to: {name:<name>,cluster:<cluster>}\""); return obj.toString(); } @POST @Path("{schema}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @ResourceFilters(StaashAuditFilter.class) public String createTable(@PathParam("schema") String schemaName, String payload) { JsonObject msg; try { if (payload!=null) { JsonObject obj; obj = new JsonObject(payload).putString("db", schemaName); return metasvc.writeMetaEntity(EntityType.TABLE, obj.toString()); } msg = new JsonObject("{\"message\":\"payload can not be null must conform to: {name:<name>,cluster:<cluster>}\""); } catch (StorageDoesNotExistException e) { msg = new JsonObject("\"message\":\"Storage Does Not Exist\""); } return msg.toString(); } @POST @Path("/timeseries/{schema}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @ResourceFilters(StaashAuditFilter.class) public String createTimeseries(@PathParam("schema") String schemaName, String payload) { JsonObject msg; try { if (payload!=null) { JsonObject obj = new JsonObject(payload).putString("db", schemaName); return metasvc.writeMetaEntity(EntityType.SERIES, obj.toString()); } msg = new JsonObject("{\"message\":\"payload can not be null must conform to: {name:<name>,cluster:<cluster>}\""); } catch (StorageDoesNotExistException e) { msg = new JsonObject("\"message\":\"Storage Does Not Exist\""); } return msg.toString(); } } <|start_filename|>staash-core/src/main/java/com/netflix/paas/PaasBootstrap.java<|end_filename|> /******************************************************************************* * /*** * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * ******************************************************************************/ package com.netflix.paas; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.google.inject.Inject; import com.netflix.paas.dao.Dao; import com.netflix.paas.dao.DaoProvider; import com.netflix.paas.dao.DaoSchema; import com.netflix.paas.entity.PassGroupConfigEntity; import com.netflix.paas.entity.DbEntity; import com.netflix.paas.resources.DataResource; public class PaasBootstrap { private static final Logger LOG = LoggerFactory.getLogger(PaasBootstrap.class); @Inject public PaasBootstrap(DaoProvider daoProvider) throws Exception { LOG.info("Bootstrapping PAAS"); DaoSchema schemaDao = daoProvider.getSchema(SchemaNames.CONFIGURATION.name()); if (!schemaDao.isExists()) { schemaDao.createSchema(); } Dao<DbEntity> vschemaDao = daoProvider.getDao(SchemaNames.CONFIGURATION.name(), DbEntity.class); if (!vschemaDao.isExists()) { vschemaDao.createTable(); } Dao<PassGroupConfigEntity> groupDao = daoProvider.getDao(SchemaNames.CONFIGURATION.name(), PassGroupConfigEntity.class); if (!groupDao.isExists()) { groupDao.createTable(); } } } <|start_filename|>staash-core/src/main/java/com/netflix/paas/exceptions/NotFoundException.java<|end_filename|> /******************************************************************************* * /*** * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * ******************************************************************************/ package com.netflix.paas.exceptions; import javax.persistence.PersistenceException; public class NotFoundException extends PersistenceException { private static final long serialVersionUID = 1320561942271503959L; private final String type; private final String id; public NotFoundException(Class<?> clazz, String id) { this(clazz.getName(), id); } public NotFoundException(String type, String id) { super(String.format("Cannot find %s:%s", type, id)); this.type = type; this.id = id; } public String getType() { return type; } public String getId() { return id; } } <|start_filename|>staash-astyanax/src/main/java/com/netflix/paas/dao/meta/CqlMetaDaoImpl.java<|end_filename|> /******************************************************************************* * /*** * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * ******************************************************************************/ package com.netflix.paas.dao.meta; import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.List; import java.util.Map; import org.apache.cassandra.config.ColumnDefinition; import org.apache.cassandra.cql3.ColumnSpecification; import org.apache.cassandra.thrift.CqlResult; import org.apache.cassandra.thrift.CqlRow; import org.apache.cassandra.transport.messages.ResultMessage; import com.datastax.driver.core.Cluster; import com.datastax.driver.core.ColumnDefinitions; import com.datastax.driver.core.ColumnDefinitions.Definition; import com.datastax.driver.core.ResultSet; import com.datastax.driver.core.Row; import com.datastax.driver.core.Session; import com.datastax.driver.core.exceptions.AlreadyExistsException; import com.datastax.driver.core.exceptions.DriverException; import com.google.inject.Inject; import com.netflix.paas.json.JsonObject; import com.netflix.paas.meta.dao.MetaDao; import com.netflix.paas.meta.entity.Entity; import com.netflix.paas.meta.entity.PaasDBEntity; import com.netflix.paas.meta.entity.PaasTableEntity; import com.netflix.paas.util.Pair; import static com.datastax.driver.core.querybuilder.QueryBuilder.*; public class CqlMetaDaoImpl implements MetaDao{ private Cluster cluster; private Session session; private static boolean schemaCreated = false; private static final String metaks = "paasmetaks"; private static final String metacf = "metacf"; @Inject public CqlMetaDaoImpl(Cluster cluster) { this.cluster = cluster; this.session = this.cluster.connect(); maybeCreateMetaSchema(); } @Override public void writeMetaEntity(Entity entity) { //if (entity instanceof PaasDBEntity) { //implies its a create request //insert into the meta some values for this dbentity //wait for creation of the actual keyspace try { session.execute(String.format(PaasUtils.INSERT_FORMAT, metaks+"."+metacf, entity.getRowKey(),entity.getName(),entity.getPayLoad())); } catch (AlreadyExistsException e) { // It's ok, ignore } //} if (entity instanceof PaasTableEntity) { //first create/check if schema db exists PaasTableEntity tableEnt = (PaasTableEntity)entity; try { String schemaName = tableEnt.getSchemaName(); session.execute(String.format(PaasUtils.CREATE_KEYSPACE_SIMPLE_FORMAT, schemaName, 1)); } catch (AlreadyExistsException e) { // It's ok, ignore } //if schema/db already exists now create the table String query = BuildQuery(tableEnt); Print(query); session.execute(query); //List<String> primaryKeys = entity.getPrimaryKey(); } } public void writeRow(String db, String table,JsonObject rowObj) { String query = BuildRowInsertQuery(db, table, rowObj); Print(query); session.execute(query); } private String BuildRowInsertQuery(String db, String table, JsonObject rowObj) { // TODO Auto-generated method stub String columns = rowObj.getString("columns"); String values = rowObj.getString("values"); return "INSERT INTO"+" "+db+"."+table+"("+columns+")"+" VALUES("+values+");"; } private void Print(String str) { // TODO Auto-generated method stub System.out.println(str); } private String BuildQuery(PaasTableEntity tableEnt) { // TODO Auto-generated method stub String schema = tableEnt.getSchemaName(); String tableName = tableEnt.getName(); List<Pair<String, String>> columns = tableEnt.getColumns(); String primary = tableEnt.getPrimarykey(); String colStrs = ""; for (Pair<String, String> colPair:columns) { colStrs = colStrs+colPair.getRight()+" "+colPair.getLeft()+", "; } String primarykeys = tableEnt.getPrimarykey(); String PRIMARYSTR = "PRIMARY KEY("+primarykeys+")"; return "CREATE TABLE "+schema+"."+tableName+" ("+colStrs+" "+PRIMARYSTR+");"; } public void maybeCreateMetaSchema() { try { if (schemaCreated) return; try { session.execute(String.format(PaasUtils.CREATE_KEYSPACE_SIMPLE_FORMAT, metaks, 1)); } catch (AlreadyExistsException e) { // It's ok, ignore } session.execute("USE " + metaks); for (String tableDef : getTableDefinitions()) { try { session.execute(tableDef); } catch (AlreadyExistsException e) { // It's ok, ignore } } schemaCreated = true; } catch (DriverException e) { throw e; } } protected Collection<String> getTableDefinitions() { // String sparse = "CREATE TABLE sparse (\n" // + " k text,\n" // + " c1 int,\n" // + " c2 float,\n" // + " l list<text>,\n" // + " v int,\n" // + " PRIMARY KEY (k, c1, c2)\n" // + ");"; // // String st = "CREATE TABLE static (\n" // + " k text,\n" // + " i int,\n" // + " m map<text, timeuuid>,\n" // + " v int,\n" // + " PRIMARY KEY (k)\n" // + ");"; // // String compactStatic = "CREATE TABLE compact_static (\n" // + " k text,\n" // + " i int,\n" // + " t timeuuid,\n" // + " v int,\n" // + " PRIMARY KEY (k)\n" // + ") WITH COMPACT STORAGE;"; //similar to old paas.db table, contains only the metadata about the paas entities String metaDynamic = "CREATE TABLE metacf (\n" + " key text,\n" + " column1 text,\n" + " value text,\n" + " PRIMARY KEY (key, column1)\n" + ") WITH COMPACT STORAGE;"; // String compactComposite = "CREATE TABLE compact_composite (\n" // + " k text,\n" // + " c1 int,\n" // + " c2 float,\n" // + " c3 double,\n" // + " v timeuuid,\n" // + " PRIMARY KEY (k, c1, c2, c3)\n" // + ") WITH COMPACT STORAGE;"; // String withOptions = "CREATE TABLE with_options (\n" // + " k text,\n" // + " i int,\n" // + " PRIMARY KEY (k)\n" // + ") WITH read_repair_chance = 0.5\n" // + " AND dclocal_read_repair_chance = 0.6\n" // + " AND replicate_on_write = true\n" // + " AND gc_grace_seconds = 42\n" // + " AND bloom_filter_fp_chance = 0.01\n" // + " AND caching = ALL\n" // + " AND comment = 'My awesome table'\n" // + " AND compaction = { 'class' : 'org.apache.cassandra.db.compaction.LeveledCompactionStrategy', 'sstable_size_in_mb' : 15 }\n" // + " AND compression = { 'sstable_compression' : 'org.apache.cassandra.io.compress.SnappyCompressor', 'chunk_length_kb' : 128 };"; List<String> allDefs = new ArrayList<String>(); allDefs.add(metaDynamic); return allDefs; } @Override public Entity readMetaEntity(String rowKey) { // TODO Auto-generated method stub return null; } @Override public String listRow(String db, String table, String keycol, String key) { // TODO Auto-generated method stub String query = select().all().from(db, table).where(eq(keycol,key)).getQueryString(); ResultSet rs = session.execute(query); return convertResultSet(rs); } private String convertResultSet(ResultSet rs) { // TODO Auto-generated method stub String colStr = ""; String rowStr = ""; JsonObject response = new JsonObject(); List<Row> rows = rs.all(); if (!rows.isEmpty() && rows.size()==1) { rowStr = rows.get(0).toString(); } ColumnDefinitions colDefs = rs.getColumnDefinitions(); colStr = colDefs.toString(); response.putString("columns", colStr.substring(8,colStr.length()-1)); response.putString("values", rowStr.substring(4,rowStr.length()-1)); return response.toString(); // for (Row ro:rows) { // Print(ro.toString()); //// ro.getColumnDefinitions() // } // return null; // if (rm.kind == ResultMessage.Kind.ROWS) { // //ToDo maybe processInternal // boolean bSwitch = true; // if (bSwitch) { // ResultMessage.Rows cqlRows = (ResultMessage.Rows) rm; // List<ColumnSpecification> columnSpecs = cqlRows.result.metadata.names; // // for (List<ByteBuffer> row : cqlRows.result.rows) { // Map<String,Object> map = new HashMap<String,Object>(); // int i = 0; // for (ByteBuffer bytes : row) { // ColumnSpecification specs = columnSpecs.get(i++); // if (specs.name!=null && specs.type!=null && bytes!=null && bytes.hasRemaining()) { // System.out.println("name = "+specs.name.toString()+" ,type= "+specs.type.compose(bytes)); // map.put(specs.name.toString(), specs.type.compose(bytes)); // } // } // returnRows.add(map); // } // } else { // boolean convert = true;; // CqlResult result = rm.toThriftResult(); // List<CqlRow> rows = result.getRows(); // for (CqlRow row: rows) { // List<org.apache.cassandra.thrift.Column> columns = row.getColumns(); // for (org.apache.cassandra.thrift.Column c: columns){ // HashMap<String,Object> m = new HashMap<String,Object>(); // if (convert) { // m.put("name" , TypeHelper.getCqlTyped(result.schema.name_types.get(c.name), c.name) ); // m.put("value" , TypeHelper.getCqlTyped(result.schema.name_types.get(c.name), c.value) ); // } else { // m.put("value", TypeHelper.getBytes(c.value)); // m.put("name", TypeHelper.getBytes(c.name)); // } // returnRows.add(m); // } // } // } // } // JsonObject response = new JsonObject(); // JsonArray array = new JsonArray(); // for (Map<String,Object> m : returnRows) { // array.add(new JsonObject(m)); // } // response.putString(Long.toString(counter.incrementAndGet()), "OK"); // response.putArray(Long.toString(counter.incrementAndGet()), array); // String testQry = "CREATE KEYSPACE testdb WITH REPLICATION = {'class' : 'SimpleStrategy', 'replication_factor': 1};"; //// create("testdb",1); // return response.toString(); // return null; // } } } <|start_filename|>staash-astyanax/src/main/java/com/netflix/paas/cassandra/entity/ColumnFamilyEntity.java<|end_filename|> /******************************************************************************* * /*** * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * ******************************************************************************/ package com.netflix.paas.cassandra.entity; import java.util.Map; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.PostLoad; import javax.persistence.PrePersist; import com.google.common.base.Preconditions; @Entity public class ColumnFamilyEntity { public static class Builder { private final ColumnFamilyEntity entity = new ColumnFamilyEntity(); public Builder withName(String name) { entity.name = name; return this; } public Builder withKeyspace(String name) { entity.keyspaceName = name; return this; } public Builder withCluster(String name) { entity.clusterName = name; return this; } public Builder withOptions(Map<String, String> options) { entity.setOptions(options); return this; } public ColumnFamilyEntity build() { Preconditions.checkNotNull(entity.name); return this.entity; } } public static Builder builder() { return new Builder(); } @PrePersist private void prePersist() { this.id = String.format("%s.%s.%s", clusterName, keyspaceName, name); } @PostLoad private void postLoad() { this.id = String.format("%s.%s.%s", clusterName, keyspaceName, name); } @Id private String id; @Column(name="name") private String name; @Column(name="keyspace") private String keyspaceName; @Column(name="cluster") private String clusterName; /** * Low level Cassandra column family configuration parameters */ @Column(name="options") private Map<String, String> options; public String getKeyspaceName() { return keyspaceName; } public void setKeyspaceName(String keyspaceName) { this.keyspaceName = keyspaceName; } public String getClusterName() { return clusterName; } public void setClusterName(String clusterName) { this.clusterName = clusterName; } public String getName() { return name; } public void setName(String name) { this.name = name; } public Map<String, String> getOptions() { return options; } public void setOptions(Map<String, String> options) { this.options = options; } } <|start_filename|>staash-astyanax/src/main/java/com/netflix/paas/cassandra/resources/admin/AstyanaxThriftClusterAdminResource.java<|end_filename|> /******************************************************************************* * /*** * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * ******************************************************************************/ package com.netflix.paas.cassandra.resources.admin; import java.util.Collection; import java.util.Properties; import java.util.concurrent.ScheduledExecutorService; import javax.annotation.PostConstruct; import javax.annotation.PreDestroy; import javax.persistence.PersistenceException; import javax.ws.rs.PathParam; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.google.common.base.Preconditions; import com.google.common.eventbus.EventBus; import com.google.inject.Inject; import com.google.inject.assistedinject.Assisted; import com.google.inject.name.Named; import com.netflix.astyanax.Cluster; import com.netflix.astyanax.connectionpool.exceptions.ConnectionException; import com.netflix.paas.cassandra.admin.CassandraClusterAdminResource; import com.netflix.paas.cassandra.discovery.ClusterDiscoveryService; import com.netflix.paas.cassandra.entity.CassandraClusterEntity; import com.netflix.paas.cassandra.entity.ColumnFamilyEntity; import com.netflix.paas.cassandra.entity.KeyspaceEntity; import com.netflix.paas.cassandra.events.ColumnFamilyDeleteEvent; import com.netflix.paas.cassandra.events.ColumnFamilyUpdateEvent; import com.netflix.paas.cassandra.events.KeyspaceUpdateEvent; import com.netflix.paas.cassandra.keys.ClusterKey; import com.netflix.paas.cassandra.keys.ColumnFamilyKey; import com.netflix.paas.cassandra.keys.KeyspaceKey; import com.netflix.paas.cassandra.provider.ClusterClientProvider; import com.netflix.paas.dao.Dao; import com.netflix.paas.dao.DaoProvider; import com.netflix.paas.dao.astyanax.DaoKeys; import com.netflix.paas.exceptions.NotFoundException; import com.netflix.paas.exceptions.PaasException; /** * Implementation of a Cassandra Cluster Admin interface using Astyanax and Thrift. * Since this is the admin interface only one connection is actually needed to the cluster * * @author elandau */ public class AstyanaxThriftClusterAdminResource implements CassandraClusterAdminResource { private static final Logger LOG = LoggerFactory.getLogger(AstyanaxThriftClusterAdminResource.class); private final ClusterKey clusterKey; private final Cluster cluster; private final DaoProvider daoProvider; private final EventBus eventBus; @Inject public AstyanaxThriftClusterAdminResource( EventBus eventBus, DaoProvider daoProvider, @Named("tasks") ScheduledExecutorService taskExecutor, ClusterDiscoveryService discoveryService, ClusterClientProvider clusterProvider, @Assisted ClusterKey clusterKey) { this.clusterKey = clusterKey; this.cluster = clusterProvider.acquireCluster(clusterKey); this.daoProvider = daoProvider; this.eventBus = eventBus; } @PostConstruct public void initialize() { } @PreDestroy public void shutdown() { } @Override public CassandraClusterEntity getClusterDetails() throws PersistenceException { return daoProvider.getDao(DaoKeys.DAO_CASSANDRA_CLUSTER_ENTITY).read(clusterKey.getCanonicalName()); } @Override public KeyspaceEntity getKeyspace(String keyspaceName) throws PersistenceException { Dao<KeyspaceEntity> dao = daoProvider.getDao(DaoKeys.DAO_KEYSPACE_ENTITY); return dao.read(keyspaceName); } @Override public void createKeyspace(KeyspaceEntity keyspace) throws PaasException { LOG.info("Creating keyspace '{}'", new Object[] {keyspace.getName()}); Preconditions.checkNotNull(keyspace, "Missing keyspace entity definition"); Properties props = new Properties(); props.putAll(getDefaultKeyspaceProperties()); if (keyspace.getOptions() != null) { props.putAll(keyspace.getOptions()); } props.setProperty("name", keyspace.getName()); keyspace.setClusterName(clusterKey.getClusterName()); try { cluster.createKeyspace(props); eventBus.post(new KeyspaceUpdateEvent(new KeyspaceKey(clusterKey, keyspace.getName()))); } catch (ConnectionException e) { throw new PaasException(String.format("Error creating keyspace '%s' from cluster '%s'", keyspace.getName(), clusterKey.getClusterName()), e); } } @Override public void updateKeyspace(@PathParam("keyspace") String keyspaceName, KeyspaceEntity keyspace) throws PaasException { try { if (keyspace.getOptions() == null) { return; // Nothing to do } // Add them as existing values to the properties object Properties props = new Properties(); props.putAll(cluster.getKeyspaceProperties(keyspaceName)); props.putAll(keyspace.getOptions()); props.setProperty("name", keyspace.getName()); keyspace.setClusterName(clusterKey.getClusterName()); cluster.updateKeyspace(props); eventBus.post(new KeyspaceUpdateEvent(new KeyspaceKey(clusterKey, keyspace.getName()))); } catch (ConnectionException e) { throw new PaasException(String.format("Error creating keyspace '%s' from cluster '%s'", keyspace.getName(), clusterKey.getClusterName()), e); } } @Override public void deleteKeyspace(String keyspaceName) throws PaasException { LOG.info("Dropping keyspace"); try { cluster.dropKeyspace(keyspaceName); } catch (ConnectionException e) { throw new PaasException(String.format("Error deleting keyspace '%s' from cluster '%s'", keyspaceName, clusterKey.getClusterName()), e); } } @Override public ColumnFamilyEntity getColumnFamily(String keyspaceName, String columnFamilyName) throws NotFoundException { Dao<ColumnFamilyEntity> dao = daoProvider.getDao(DaoKeys.DAO_COLUMN_FAMILY_ENTITY); return dao.read(new ColumnFamilyKey(clusterKey, keyspaceName, columnFamilyName).getCanonicalName()); } @Override public void deleteColumnFamily(String keyspaceName, String columnFamilyName) throws PaasException { LOG.info("Deleting column family: '{}.{}.{}'", new Object[] {clusterKey.getClusterName(), keyspaceName, columnFamilyName}); try { cluster.dropColumnFamily(keyspaceName, columnFamilyName); } catch (ConnectionException e) { throw new PaasException(String.format("Error creating column family '%s.%s' on cluster '%s'", keyspaceName, columnFamilyName, clusterKey.getClusterName()), e); } eventBus.post(new ColumnFamilyDeleteEvent(new ColumnFamilyKey(clusterKey, keyspaceName, columnFamilyName))); } @Override public void createColumnFamily(@PathParam("keyspace") String keyspaceName, ColumnFamilyEntity columnFamily) throws PaasException { LOG.info("Creating column family: '{}.{}.{}'", new Object[] {clusterKey.getClusterName(), keyspaceName, columnFamily.getName()}); columnFamily.setKeyspaceName(keyspaceName); columnFamily.setClusterName(clusterKey.getClusterName()); Properties props = new Properties(); props.putAll(getDefaultColumnFamilyProperties()); if (columnFamily.getOptions() != null) { props.putAll(columnFamily.getOptions()); } props.setProperty("name", columnFamily.getName()); props.setProperty("keyspace", columnFamily.getKeyspaceName()); try { cluster.createColumnFamily(props); eventBus.post(new ColumnFamilyUpdateEvent(new ColumnFamilyKey(new KeyspaceKey(clusterKey, keyspaceName), columnFamily.getName()))); } catch (ConnectionException e) { throw new PaasException(String.format("Error creating column family '%s.%s' on cluster '%s'", keyspaceName, columnFamily.getName(), clusterKey.getClusterName()), e); } } @Override public void updateColumnFamily(@PathParam("keyspace") String keyspaceName, String columnFamilyName, ColumnFamilyEntity columnFamily) throws PaasException { LOG.info("Updating column family: '{}.{}.{}'", new Object[] {clusterKey.getClusterName(), keyspaceName, columnFamily.getName()}); columnFamily.setKeyspaceName(keyspaceName); columnFamily.setClusterName(clusterKey.getClusterName()); try { Properties props = new Properties(); props.putAll(cluster.getColumnFamilyProperties(keyspaceName, columnFamilyName)); if (columnFamily.getOptions() != null) { props.putAll(columnFamily.getOptions()); } props.setProperty("name", columnFamily.getName()); props.setProperty("keyspace", columnFamily.getKeyspaceName()); cluster.createColumnFamily(props); eventBus.post(new ColumnFamilyUpdateEvent(new ColumnFamilyKey(new KeyspaceKey(clusterKey, keyspaceName), columnFamily.getName()))); } catch (ConnectionException e) { throw new PaasException(String.format("Error creating column family '%s.%s' on cluster '%s'", keyspaceName, columnFamily.getName(), clusterKey.getClusterName()), e); } } @Override public Collection<ColumnFamilyEntity> listColumnFamilies() { // TODO Auto-generated method stub return null; } @Override public Collection<String> listKeyspaceNames() { // TODO Auto-generated method stub return null; } @Override public Collection<String> listColumnFamilyNames() { // TODO Auto-generated method stub return null; } private Properties getDefaultKeyspaceProperties() { // TODO: Read from configuration return new Properties(); } private Properties getDefaultColumnFamilyProperties() { return new Properties(); } @Override public Collection<KeyspaceEntity> listKeyspaces() { // TODO Auto-generated method stub return null; } } <|start_filename|>staash-mesh/src/test/java/com/netflix/paas/ptp/TestPtpGuiceModule.java<|end_filename|> /******************************************************************************* * /*** * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * ******************************************************************************/ package com.netflix.paas.ptp; import com.google.inject.AbstractModule; import com.netflix.staash.mesh.InstanceRegistry; import com.netflix.staash.mesh.client.ClientFactory; import com.netflix.staash.mesh.client.memory.MemoryClientFactory; import com.netflix.staash.mesh.db.TopicRegistry; import com.netflix.staash.mesh.endpoints.ChordEndpointPolicy; import com.netflix.staash.mesh.endpoints.EndpointPolicy; import com.netflix.staash.mesh.seed.TopicSeed; public class TestPtpGuiceModule extends AbstractModule { @Override protected void configure() { bind(TopicSeed.class).to(DummyTopicSeed.class); bind(TopicRegistry.class).asEagerSingleton(); bind(InstanceRegistry.class).asEagerSingleton(); bind(ClientFactory.class).to(MemoryClientFactory.class).asEagerSingleton(); bind(EndpointPolicy.class).to(ChordEndpointPolicy.class).asEagerSingleton(); // bind(TopicFactory.class).to(MemoryTopicFactory()); } } <|start_filename|>staash-svc/src/main/java/com/netflix/staash/model/CassandraStorage.java<|end_filename|> /******************************************************************************* * /* * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * * * ******************************************************************************/ package com.netflix.staash.model; import com.netflix.staash.json.JsonObject; public class CassandraStorage extends Storage{ private String cluster; public CassandraStorage(JsonObject conf) { this.name = conf.getString("name"); this.cluster = conf.getString("cluster"); this.replicateTo = conf.getString("replicateto"); this.type = StorageType.CASSANDRA; } public String getName() { return name; } public String getCluster() { return cluster; } public StorageType getType() { return type; } public String getReplicateTo() { return replicateTo; } } <|start_filename|>staash-svc/src/main/java/com/netflix/staash/rest/util/HostSupplier.java<|end_filename|> /******************************************************************************* * /* * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * * * ******************************************************************************/ package com.netflix.staash.rest.util; import java.util.ArrayList; import java.util.List; import com.google.common.base.Supplier; import com.netflix.astyanax.connectionpool.Host; public class HostSupplier implements Supplier<List<Host>> { public List<Host> get() { // TODO Auto-generated method stub List<Host> list = new ArrayList<Host>(); // Host h1 = new Host("ec2-54-235-224-8.compute-1.amazonaws.com",7102); Host h1 = new Host("192.168.127.12",7102); // Host h2 = new Host("ec2-54-224-106-243.compute-1.amazonaws.com",7102); Host h2 = new Host("172.16.58.3",7102); // Host h3 = new Host("ec2-54-242-127-138.compute-1.amazonaws.com",7102); Host h3 = new Host("172.16.58.3",7102); list.add(h1); list.add(h2); list.add(h3); return list; } } <|start_filename|>staash-svc/src/main/java/com/netflix/staash/dao/factory/PaasDaoFactory.java<|end_filename|> /******************************************************************************* * /* * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * * * ******************************************************************************/ package com.netflix.staash.dao.factory; import java.util.HashMap; import java.util.Map; import com.datastax.driver.core.Cluster; import com.google.inject.Inject; import com.google.inject.name.Named; import com.netflix.staash.connection.ConnectionFactory; import com.netflix.staash.rest.dao.AstyanaxDataDaoImpl; import com.netflix.staash.rest.dao.CqlDataDaoImpl; import com.netflix.staash.rest.dao.CqlMetaDaoImpl; import com.netflix.staash.rest.dao.DataDao; import com.netflix.staash.rest.dao.MetaDao; public class PaasDaoFactory { static Map<String, DataDao> DaoMap = new HashMap<String, DataDao>(); static String clientType = "cql"; public MetaDao metaDao; public ConnectionFactory factory; @Inject public PaasDaoFactory(MetaDao metaDao, ConnectionFactory factory) { this.metaDao = metaDao; this.factory = factory; } public DataDao getDataDao(String storage, String clientType) { String storageType = getStorageType(storage); String cluster = getCluster(storage); // String hostName = getHostName(cluster); if (DaoMap.containsKey(cluster)) return DaoMap.get(cluster); if (storageType.equals("cassandra") && clientType.equals("cql")) { DataDao dataDao = DaoMap.get(cluster); if (dataDao==null) { // dataDao = new CqlDataDaoImpl(factory.getDataCluster(cluster),metaDao); } DaoMap.put(cluster, dataDao); return dataDao; } else if (storageType.equals("cassandra") && clientType.equals("astyanax")) { DataDao dataDao = DaoMap.get(cluster); if (dataDao==null) { dataDao = new AstyanaxDataDaoImpl();//factory.getDataCluster(cluster),metaDao); } DaoMap.put(cluster, dataDao); return dataDao; } else if (storageType.equals("mysql") && clientType==null) { } return null; } public MetaDao getMetaDao() { return metaDao; } private String getStorageType(String storage) { return "cassandra"; } private String getCluster(String storage) { return "localhost"; } private String getHostName(String cluster) { //eureka name resolution return "localhost"; } } <|start_filename|>staash-core/src/main/java/com/netflix/paas/resources/TableDataResource.java<|end_filename|> /******************************************************************************* * /*** * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * ******************************************************************************/ package com.netflix.paas.resources; import javax.ws.rs.Consumes; import javax.ws.rs.DELETE; import javax.ws.rs.DefaultValue; import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.QueryParam; import javax.ws.rs.core.MediaType; import com.netflix.paas.data.QueryResult; import com.netflix.paas.data.RowData; import com.netflix.paas.exceptions.NotFoundException; import com.netflix.paas.exceptions.PaasException; import com.netflix.paas.json.JsonObject; /** * Interface for access to a table. Concrete implementation may implement a table * on top of any persistence technology. * * @author elandau * */ //@Path("/v1/data") public interface TableDataResource { // Table level API @GET public QueryResult listRows( String cursor, Integer rowLimit, Integer columnLimit ) throws PaasException; @DELETE public void truncateRows( ) throws PaasException; // Row level API @GET @Path("{key}") public QueryResult readRow( @PathParam("key") String key, @QueryParam("count") @DefaultValue("0") Integer columnCount, @QueryParam("start") @DefaultValue("") String startColumn, @QueryParam("end") @DefaultValue("") String endColumn, @QueryParam("reversed") @DefaultValue("false") Boolean reversed ) throws PaasException; @DELETE @Path("{key}") public void deleteRow( @PathParam("key") String key ) throws PaasException; @POST @Path("{db}/{table}") @Consumes(MediaType.TEXT_PLAIN) public void updateRow( @PathParam("db") String db, @PathParam("table") String table, JsonObject rowData ) throws PaasException ; // Row level API @GET @Path("{key}/{column}") public QueryResult readColumn( @PathParam("key") String key, @PathParam("column") String column ) throws PaasException, NotFoundException; @POST @Path("{key}/{column}") public void updateColumn( @PathParam("key") String key, @PathParam("column") String column, String value ) throws PaasException, NotFoundException; @DELETE @Path("{key}/{column}") public void deleteColumn( @PathParam("key") String key, @PathParam("column") String column ) throws PaasException; // TODO: Batch operations // TODO: Pagination // TODO: Index search } <|start_filename|>staash-astyanax/src/main/java/com/netflix/paas/cassandra/keys/ClusterKey.java<|end_filename|> /******************************************************************************* * /*** * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * ******************************************************************************/ package com.netflix.paas.cassandra.keys; import org.apache.commons.lang.StringUtils; public class ClusterKey { private final String clusterName; private final String discoveryType; public ClusterKey(String clusterName, String discoveryType) { this.clusterName = clusterName; this.discoveryType = discoveryType; } public String getDiscoveryType() { return discoveryType; } public String getClusterName() { return this.clusterName; } public String getCanonicalName() { return StringUtils.join(new String[]{this.discoveryType, this.clusterName}, "."); } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((clusterName == null) ? 0 : clusterName.hashCode()); result = prime * result + ((discoveryType == null) ? 0 : discoveryType.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; ClusterKey other = (ClusterKey) obj; if (clusterName == null) { if (other.clusterName != null) return false; } else if (!clusterName.equals(other.clusterName)) return false; if (discoveryType == null) { if (other.discoveryType != null) return false; } else if (!discoveryType.equals(other.discoveryType)) return false; return true; } } <|start_filename|>staash-svc/src/main/java/com/netflix/staash/service/MetaService.java<|end_filename|> /******************************************************************************* * /* * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * * * ******************************************************************************/ package com.netflix.staash.service; import java.util.Map; import com.netflix.staash.exception.PaasException; import com.netflix.staash.exception.StorageDoesNotExistException; import com.netflix.staash.json.JsonObject; import com.netflix.staash.rest.dao.DataDao; import com.netflix.staash.rest.dao.MetaDao; import com.netflix.staash.rest.meta.entity.Entity; import com.netflix.staash.rest.meta.entity.EntityType; public interface MetaService { public String writeMetaEntity(EntityType etype, String entity) throws StorageDoesNotExistException; // public Entity readMetaEntity(String rowKey); // public String writeRow(String db, String table, JsonObject rowObj); // public String listRow(String db, String table, String keycol, String key); public String listSchemas(); public String listTablesInSchema(String schemaname); public String listTimeseriesInSchema(String schemaname); public String listStorage(); public Map<String,String> getStorageMap(); public String CreateDB(); public String createTable(); public JsonObject runQuery(EntityType etype, String col); public JsonObject getStorageForTable(String table); } <|start_filename|>staash-astyanax/src/main/java/com/netflix/paas/cassandra/resources/CassandraKeyspaceHolder.java<|end_filename|> /******************************************************************************* * /*** * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * ******************************************************************************/ package com.netflix.paas.cassandra.resources; import java.util.concurrent.ConcurrentMap; import com.google.common.collect.Maps; import com.netflix.astyanax.AstyanaxContext; import com.netflix.astyanax.Keyspace; import com.netflix.paas.exceptions.AlreadyExistsException; import com.netflix.paas.exceptions.NotFoundException; import com.netflix.paas.resources.TableDataResource; /** * Tracks a keyspace and column families that are accessible on it to this instance * * @author elandau * */ public class CassandraKeyspaceHolder { private final AstyanaxContext<Keyspace> context; private final ConcurrentMap<String, TableDataResource> columnFamilies = Maps.newConcurrentMap(); public CassandraKeyspaceHolder(AstyanaxContext<Keyspace> context) { this.context = context; } /** * Register a column family on this keyspace and create the appropriate DataTableResource * to read from it. * * @param columnFamily * @throws AlreadyExistsException */ public synchronized void registerColumnFamily(String columnFamily) throws AlreadyExistsException { if (columnFamilies.containsKey(columnFamily)) throw new AlreadyExistsException("columnfamily", columnFamily); columnFamilies.put(columnFamily, new AstyanaxThriftDataTableResource(context.getClient(), columnFamily)); } /** * Unregister a column family so that it is no longer available * @param columnFamily * @throws NotFoundException */ public synchronized void unregisterColumnFamily(String columnFamily) throws NotFoundException { columnFamilies.remove(columnFamily); } /** * Retrieve a register column family resource * * @param columnFamily * @return * @throws NotFoundException */ public TableDataResource getColumnFamilyDataResource(String columnFamily) throws NotFoundException { TableDataResource resource = columnFamilies.get(columnFamily); if (resource == null) throw new NotFoundException("columnfamily", columnFamily); return resource; } public void shutdown() { this.context.shutdown(); } public void initialize() { this.context.start(); } } <|start_filename|>staash-astyanax/src/main/java/com/netflix/paas/cassandra/provider/impl/DefaultAstyanaxConfigurationProvider.java<|end_filename|> /******************************************************************************* * /*** * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * ******************************************************************************/ package com.netflix.paas.cassandra.provider.impl; import com.netflix.astyanax.AstyanaxConfiguration; import com.netflix.astyanax.connectionpool.NodeDiscoveryType; import com.netflix.astyanax.connectionpool.impl.ConnectionPoolType; import com.netflix.astyanax.impl.AstyanaxConfigurationImpl; import com.netflix.paas.cassandra.provider.AstyanaxConfigurationProvider; public class DefaultAstyanaxConfigurationProvider implements AstyanaxConfigurationProvider { @Override public AstyanaxConfiguration get(String name) { return new AstyanaxConfigurationImpl() .setDiscoveryType(NodeDiscoveryType.NONE) .setConnectionPoolType(ConnectionPoolType.ROUND_ROBIN) .setDiscoveryDelayInSeconds(60000) .setCqlVersion("3.0.0"); } } <|start_filename|>staash-astyanax/src/main/java/com/netflix/paas/cassandra/admin/CassandraSystemAdminResource.java<|end_filename|> /******************************************************************************* * /*** * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * ******************************************************************************/ package com.netflix.paas.cassandra.admin; import java.util.Map; import java.util.Set; import java.util.concurrent.ConcurrentMap; import javax.annotation.PostConstruct; import javax.annotation.PreDestroy; import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.google.common.base.Function; import com.google.common.collect.Maps; import com.google.common.collect.Sets; import com.google.inject.Inject; import com.netflix.paas.SchemaNames; import com.netflix.paas.cassandra.discovery.ClusterDiscoveryService; import com.netflix.paas.cassandra.entity.CassandraClusterEntity; import com.netflix.paas.cassandra.tasks.ClusterDiscoveryTask; import com.netflix.paas.dao.Dao; import com.netflix.paas.dao.DaoProvider; import com.netflix.paas.exceptions.NotFoundException; import com.netflix.paas.tasks.TaskManager; @Path("/v1/cassandra") public class CassandraSystemAdminResource { private static final Logger LOG = LoggerFactory.getLogger(CassandraSystemAdminResource.class); private final Dao<CassandraClusterEntity> dao; private final CassandraClusterAdminResourceFactory clusterResourceFactory; private final ClusterDiscoveryService clusterDiscovery; private final TaskManager taskManager; private final ConcurrentMap<String, CassandraClusterAdminResource> clusters = Maps.newConcurrentMap(); private static class CassandraClusterEntityToName implements Function<CassandraClusterEntity, String> { @Override public String apply(CassandraClusterEntity cluster) { return cluster.getClusterName(); } } @Inject public CassandraSystemAdminResource( TaskManager taskManager, DaoProvider daoProvider, ClusterDiscoveryService clusterDiscovery, CassandraClusterAdminResourceFactory clusterResourceFactory) throws Exception { this.clusterResourceFactory = clusterResourceFactory; this.dao = daoProvider.getDao(SchemaNames.CONFIGURATION.name(), CassandraClusterEntity.class); this.clusterDiscovery = clusterDiscovery; this.taskManager = taskManager; } @PostConstruct public void initialize() { } @PreDestroy public void shutdown() { } @Path("clusters/{id}") public CassandraClusterAdminResource getCluster(@PathParam("id") String clusterName) throws NotFoundException { CassandraClusterAdminResource resource = clusters.get(clusterName); if (resource == null) { throw new NotFoundException(CassandraClusterAdminResource.class, clusterName); } return resource; } @GET @Path("clusters") public Set<String> listClusters() { return clusters.keySet(); } @GET @Path("discover") public void discoverClusters() { taskManager.submit(ClusterDiscoveryTask.class); // Set<String> foundNames = Sets.newHashSet(clusterDiscovery.getClusterNames()); // Map<String, CassandraClusterEntity> current = Maps.uniqueIndex(dao.list(), new CassandraClusterEntityToName()); // // // Look for new clusters (may contain clusters that are disabled) // for (String clusterName : Sets.difference(foundNames, current.keySet())) { //// CassandraClusterEntity entity = CassandraClusterEntity.builder(); // } // // // Look for clusters that were removed // for (String clusterName : Sets.difference(current.keySet(), foundNames)) { // } } @POST @Path("clusters") public void refreshClusterList() { // Map<String, CassandraClusterEntity> newList = Maps.uniqueIndex(dao.list(), new CassandraClusterEntityToName()); // // // Look for new clusters (may contain clusters that are disabled) // for (String clusterName : Sets.difference(newList.keySet(), clusters.keySet())) { // CassandraClusterEntity entity = newList.get(clusterName); // if (entity.isEnabled()) { // CassandraClusterAdminResource resource = clusterResourceFactory.get(clusterName); // if (null == clusters.putIfAbsent(clusterName, resource)) { // // TODO: Start it // } // } // } // // // Look for clusters that were removed // for (String clusterName : Sets.difference(clusters.keySet(), newList.keySet())) { // CassandraClusterAdminResource resource = clusters.remove(clusterName); // if (resource != null) { // // TODO: Shut it down // } // } // // // Look for clusters that may have been disabled // for (String clusterName : Sets.intersection(clusters.keySet(), newList.keySet())) { // CassandraClusterEntity entity = newList.get(clusterName); // if (!entity.isEnabled()) { // CassandraClusterAdminResource resource = clusters.remove(clusterName); // if (resource != null) { // // TODO: Shut it down // } // } // } } } <|start_filename|>staash-astyanax/src/main/java/com/netflix/paas/dao/astyanax/AstyanaxDao.java<|end_filename|> /******************************************************************************* * /*** * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * ******************************************************************************/ package com.netflix.paas.dao.astyanax; import java.util.Collection; import java.util.List; import javax.persistence.PersistenceException; import org.apache.commons.lang.StringUtils; import com.google.common.base.CaseFormat; import com.google.common.base.Function; import com.google.common.collect.Lists; import com.netflix.astyanax.Keyspace; import com.netflix.astyanax.connectionpool.exceptions.ConnectionException; import com.netflix.astyanax.entitystore.DefaultEntityManager; import com.netflix.astyanax.entitystore.EntityManager; import com.netflix.astyanax.model.ColumnFamily; import com.netflix.astyanax.model.Row; import com.netflix.astyanax.recipes.reader.AllRowsReader; import com.netflix.astyanax.serializers.StringSerializer; import com.netflix.paas.dao.Dao; /** * Simple implementation of a Dao on top of the astyanax EntityManager API * @author elandau * * @param <T> */ public class AstyanaxDao<T> implements Dao<T> { private final static String DAO_NAME = "astyanax"; private final EntityManager<T, String> manager; private final Keyspace keyspace; private final ColumnFamily<String, String> columnFamily; private final String entityName; private final String prefix; private static String entityNameFromClass(Class<?> entityType) { return CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, StringUtils.removeEnd(StringUtils.substringAfterLast(entityType.getName(), "."), "Entity")); } public AstyanaxDao(Keyspace keyspace, Class<T> entityType) { this.keyspace = keyspace; this.entityName = entityNameFromClass(entityType); this.columnFamily = new ColumnFamily<String, String>(this.entityName, StringSerializer.get(), StringSerializer.get()); this.prefix = ""; manager = new DefaultEntityManager.Builder<T, String>() .withKeyspace(keyspace) .withColumnFamily(columnFamily) .withEntityType(entityType) .build(); } public AstyanaxDao(Keyspace keyspace, Class<T> entityType, String columnFamilyName) { this.keyspace = keyspace; this.entityName = entityNameFromClass(entityType); this.columnFamily = new ColumnFamily<String, String>(columnFamilyName, StringSerializer.get(), StringSerializer.get()); this.prefix = this.entityName + ":"; manager = new DefaultEntityManager.Builder<T, String>() .withKeyspace(keyspace) .withColumnFamily(columnFamily) .withEntityType(entityType) .build(); } @Override public T read(String id) throws PersistenceException { return this.manager.get(id); } @Override public void write(T entity) throws PersistenceException { this.manager.put(entity); } @Override public Collection<T> list() throws PersistenceException{ return this.manager.getAll(); } @Override public void delete(String id) throws PersistenceException{ this.manager.delete(id); } @Override public void createTable() throws PersistenceException { try { keyspace.createColumnFamily(columnFamily, null); } catch (ConnectionException e) { throw new PersistenceException("Failed to create column family : " + columnFamily.getName(), e); } } @Override public void deleteTable() throws PersistenceException{ try { keyspace.dropColumnFamily(columnFamily); } catch (ConnectionException e) { throw new PersistenceException("Failed to drop column family : " + columnFamily.getName(), e); } } @Override public String getEntityType() { return this.entityName; } @Override public String getDaoType() { return DAO_NAME; } @Override public Boolean healthcheck() { return isExists(); } @Override public Boolean isExists() { try { return keyspace.describeKeyspace().getColumnFamily(columnFamily.getName()) != null; } catch (Throwable t) { return false; } } @Override public void shutdown() { } @Override public Collection<String> listIds() throws PersistenceException { final List<String> ids = Lists.newArrayList(); try { new AllRowsReader.Builder<String, String>(keyspace, columnFamily) .withIncludeEmptyRows(false) .forEachRow(new Function<Row<String,String>, Boolean>() { @Override public Boolean apply(Row<String, String> row) { ids.add(row.getKey()); return true; } }) .build() .call(); } catch (Exception e) { throw new PersistenceException("Error trying to fetch row ids", e); } return ids; } @Override public Collection<T> read(Collection<String> keys) throws PersistenceException { return this.manager.get(keys); } } <|start_filename|>staash-web/src/test/java/com/netflix/staash/test/modules/TestStaashModule.java<|end_filename|> package com.netflix.staash.test.modules; import com.google.inject.AbstractModule; import com.google.inject.Provides; import com.google.inject.Singleton; import com.google.inject.name.Named; import com.netflix.astyanax.AstyanaxContext; import com.netflix.astyanax.Keyspace; import com.netflix.astyanax.connectionpool.NodeDiscoveryType; import com.netflix.astyanax.connectionpool.impl.ConnectionPoolConfigurationImpl; import com.netflix.astyanax.connectionpool.impl.ConnectionPoolType; import com.netflix.astyanax.connectionpool.impl.CountingConnectionPoolMonitor; import com.netflix.astyanax.impl.AstyanaxConfigurationImpl; import com.netflix.astyanax.thrift.ThriftFamilyFactory; import com.netflix.staash.cassandra.discovery.EurekaAstyanaxHostSupplier; import com.netflix.staash.connection.ConnectionFactory; import com.netflix.staash.connection.PaasConnectionFactory; import com.netflix.staash.rest.dao.AstyanaxMetaDaoImpl; import com.netflix.staash.rest.dao.MetaDao; import com.netflix.staash.rest.util.MetaConstants; import com.netflix.staash.service.CacheService; import com.netflix.staash.service.DataService; import com.netflix.staash.service.MetaService; import com.netflix.staash.service.PaasDataService; import com.netflix.staash.service.PaasMetaService; public class TestStaashModule extends AbstractModule { @Provides @Named("astmetaks") @Singleton Keyspace provideKeyspace() { AstyanaxContext<Keyspace> keyspaceContext = new AstyanaxContext.Builder() .forCluster("test cluster") .forKeyspace(MetaConstants.META_KEY_SPACE) .withAstyanaxConfiguration( new AstyanaxConfigurationImpl() .setDiscoveryType( NodeDiscoveryType.NONE) .setConnectionPoolType( ConnectionPoolType.ROUND_ROBIN) .setTargetCassandraVersion("1.2") .setCqlVersion("3.0.0")) // .withHostSupplier(hs.getSupplier(clustername)) .withConnectionPoolConfiguration( new ConnectionPoolConfigurationImpl("localpool" + "_" + MetaConstants.META_KEY_SPACE) .setSocketTimeout(30000) .setMaxTimeoutWhenExhausted(20000) .setMaxConnsPerHost(3).setInitConnsPerHost(1) .setSeeds("localhost"+":"+"9160")) //uncomment for localhost // .withConnectionPoolMonitor(new CountingConnectionPoolMonitor()) .buildKeyspace(ThriftFamilyFactory.getInstance()); keyspaceContext.start(); Keyspace keyspace; keyspace = keyspaceContext.getClient(); return keyspace; } @Provides @Named("newmetadao") @Singleton MetaDao provideCqlMetaDaoNew(@Named("astmetaks") Keyspace keyspace) { return new AstyanaxMetaDaoImpl(keyspace); } @Provides MetaService providePaasMetaService(@Named("newmetadao") MetaDao metad, CacheService cache) { ConnectionFactory fac = new PaasConnectionFactory("astyanax", null); PaasMetaService metasvc = new PaasMetaService(metad, fac, cache); return metasvc; } @Provides ConnectionFactory provideConnectionFactory() { return new PaasConnectionFactory("astyanax", null); } @Provides DataService providePaasDataService( MetaService metasvc) { ConnectionFactory fac = new PaasConnectionFactory("astyanax", null); PaasDataService datasvc = new PaasDataService(metasvc, fac); return datasvc; } @Provides CacheService provideCacheService(@Named("newmetadao") MetaDao metad) { return new CacheService(metad); } @Override protected void configure() { } } <|start_filename|>staash-svc/src/main/java/com/netflix/staash/rest/resources/StaashAuditFilter.java<|end_filename|> package com.netflix.staash.rest.resources; import java.util.List; import java.util.Map.Entry; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.core.Response; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.netflix.staash.json.JsonObject; import com.netflix.staash.rest.util.StaashRequestContext; import com.sun.jersey.spi.container.ContainerRequest; import com.sun.jersey.spi.container.ContainerRequestFilter; import com.sun.jersey.spi.container.ContainerResponse; import com.sun.jersey.spi.container.ContainerResponseFilter; import com.sun.jersey.spi.container.ResourceFilter; /** * Class the encapsulates pre and post filters that should be executed when serving requests via jersey resources. * * @author poberai * */ public class StaashAuditFilter implements ResourceFilter, ContainerRequestFilter, ContainerResponseFilter { private static final Logger Logger = LoggerFactory.getLogger(StaashAuditFilter.class); @Context HttpServletRequest request; @Context HttpServletResponse response; public ContainerRequestFilter getRequestFilter() { return this; } public ContainerResponseFilter getResponseFilter() { return this; } public ContainerRequest filter(ContainerRequest cReq) { Logger.info("StaashAuditFilter PRE"); StaashRequestContext.resetRequestContext(); StaashRequestContext.recordRequestStart(); StaashRequestContext.logDate(); StaashRequestContext.addContext("PATH", cReq.getPath(true)); StaashRequestContext.addContext("METHOD", cReq.getMethod()); Logger.info("Adding headers to request context"); addRequestHeaders(cReq); Logger.info("Adding query params to request context"); addQueryParameters(cReq); return cReq; } public ContainerResponse filter(ContainerRequest request, ContainerResponse response) { Logger.info("StaashAuditFilter POST"); StaashRequestContext.addContext("STATUS", String.valueOf(response.getStatus())); StaashRequestContext.recordRequestEnd(); StaashRequestContext.flushRequestContext(); // Add RequestId to response addRequestIdToResponse(response); return response; } /** * Private helper that adds the request-id to the response payload. * @param response */ private void addRequestIdToResponse(ContainerResponse response) { // The request-id to be injected in the response String requestId = StaashRequestContext.getRequestId(); // The key response attributes int status = response.getStatus(); MediaType mediaType = response.getMediaType(); if (mediaType.equals(MediaType.APPLICATION_JSON_TYPE)) { String message = (String)response.getEntity(); JsonObject json = new JsonObject(message); json.putString("request-id", requestId); Response newJerseyResponse = Response.status(status).type(mediaType).entity(json.toString()).build(); response.setResponse(newJerseyResponse); } // Add the request id to the response regardless of the media type, // this allows non json responses to have a request id in the response response.getHttpHeaders().add("x-nflx-staash-request-id", requestId); } private void addRequestHeaders(ContainerRequest cReq) { MultivaluedMap<String, String> headers = cReq.getRequestHeaders(); for (Entry<String, List<String>> e : headers.entrySet()) { StaashRequestContext.addContext("H__" + e.getKey(), e.getValue().toString()); } } private void addQueryParameters(ContainerRequest cReq) { MultivaluedMap<String, String> params = cReq.getQueryParameters(); for (Entry<String, List<String>> e : params.entrySet()) { StaashRequestContext.addContext("Q__" + e.getKey(), e.getValue().toString()); } } } <|start_filename|>staash-svc/src/main/java/com/netflix/staash/rest/util/StaashConstants.java<|end_filename|> package com.netflix.staash.rest.util; public interface StaashConstants { public static final int MAX_FILE_UPLOAD_SIZE_IN_KB = 5000; public static final int CHUNK_SIZE_IN_KB = 256; } <|start_filename|>staash-core/src/main/java/com/netflix/paas/resources/DbDataResource.java<|end_filename|> /******************************************************************************* * /*** * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * ******************************************************************************/ package com.netflix.paas.resources; import java.util.Collection; import java.util.Map; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableMap; import com.netflix.paas.entity.DbEntity; import com.netflix.paas.entity.TableEntity; import com.netflix.paas.exceptions.NotFoundException; import com.netflix.paas.provider.TableDataResourceFactory; /** * REST interface to a specific schema. This interface provides access to multiple tables * * @author elandau */ public class DbDataResource { private static final Logger LOG = LoggerFactory.getLogger(DbDataResource.class); private final Map<String, TableDataResourceFactory> tableDataResourceFactories; private final DbEntity schemaEntity; private final ImmutableMap<String, TableDataResource> tables; public DbDataResource(DbEntity schemaEntity, Map<String, TableDataResourceFactory> tableDataResourceFactories) { this.tableDataResourceFactories = tableDataResourceFactories; this.schemaEntity = schemaEntity; ImmutableMap.Builder<String, TableDataResource> builder = ImmutableMap.builder(); for (TableEntity table : schemaEntity.getTables().values()) { LOG.info("Adding table '{}' to schema '{}'", new Object[]{table.getTableName(), schemaEntity.getName()}); try { Preconditions.checkNotNull(table.getStorageType()); TableDataResourceFactory tableDataResourceFactory = tableDataResourceFactories.get(table.getStorageType()); if (tableDataResourceFactory == null) { throw new NotFoundException(TableDataResourceFactory.class, table.getStorageType()); } builder.put(table.getTableName(), tableDataResourceFactory.getTableDataResource(table)); } catch (Exception e) { LOG.error("Failed to create storage for table '{}' in schema '{}", new Object[]{table.getTableName(), schemaEntity.getName(), e}); } } tables = builder.build(); } @GET public Collection<TableEntity> listTables() { return schemaEntity.getTables().values(); } @Path("{table}") public TableDataResource getTableSubresource(@PathParam("table") String tableName) throws NotFoundException { TableDataResource resource = tables.get(tableName); if (resource == null) { throw new NotFoundException(TableDataResource.class, tableName); } return resource; } } <|start_filename|>staash-mesh/src/main/java/com/netflix/staash/mesh/db/memory/MemoryTopic.java<|end_filename|> /******************************************************************************* * /*** * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * ******************************************************************************/ package com.netflix.staash.mesh.db.memory; import java.util.concurrent.ConcurrentMap; import java.util.concurrent.atomic.AtomicLong; import com.google.common.collect.Maps; import com.netflix.staash.mesh.db.Entry; import com.netflix.staash.mesh.db.Topic; public class MemoryTopic implements Topic { private final String name; private final ConcurrentMap<String, EntryHolder> rows; private volatile long deletedTimestamp; private AtomicLong size = new AtomicLong(0); public MemoryTopic(String name) { this.name = name; rows = Maps.newConcurrentMap(); } @Override public boolean deleteTopic(long timestamp) { if (timestamp < deletedTimestamp) { return false; } deletedTimestamp = timestamp; for (java.util.Map.Entry<String, EntryHolder> entry : rows.entrySet()) { if (entry.getValue().delete(deletedTimestamp)) { size.incrementAndGet(); } } return true; } @Override public boolean upsert(Entry entry) { EntryHolder existing = rows.putIfAbsent(entry.getKey(), new EntryHolder(entry)); if (existing != null) { return existing.set(entry); } size.incrementAndGet(); return true; } @Override public Entry read(String key) { EntryHolder holder = rows.get(key); if (holder == null) { return null; } return holder.getEntry(); } @Override public boolean delete(Entry entry) { EntryHolder holder = rows.get(entry.getKey()); if (holder != null) { if (holder.delete(entry.getTimestamp())) { size.decrementAndGet(); return true; } } return false; } @Override public String getName() { return name; } @Override public long getCreatedTime() { return 0; } @Override public long getEntryCount() { return size.get(); } @Override public long getDeletedTime() { return 0; } } <|start_filename|>staash-astyanax/src/main/java/com/netflix/paas/cassandra/tasks/ClusterRefreshTask.java<|end_filename|> /******************************************************************************* * /*** * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * ******************************************************************************/ package com.netflix.paas.cassandra.tasks; import java.nio.ByteBuffer; import java.util.List; import java.util.Map; import java.util.Set; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.google.common.collect.Lists; import com.google.common.collect.MapDifference; import com.google.common.collect.Maps; import com.google.common.collect.Sets; import com.google.common.collect.Sets.SetView; import com.google.inject.Inject; import com.netflix.astyanax.Cluster; import com.netflix.astyanax.ddl.ColumnDefinition; import com.netflix.astyanax.ddl.ColumnFamilyDefinition; import com.netflix.astyanax.ddl.FieldMetadata; import com.netflix.astyanax.ddl.KeyspaceDefinition; import com.netflix.paas.JsonSerializer; import com.netflix.paas.SchemaNames; import com.netflix.paas.cassandra.entity.CassandraClusterEntity; import com.netflix.paas.cassandra.entity.MapStringToObject; import com.netflix.paas.cassandra.keys.ClusterKey; import com.netflix.paas.cassandra.provider.ClusterClientProvider; import com.netflix.paas.dao.Dao; import com.netflix.paas.dao.DaoProvider; import com.netflix.paas.tasks.Task; import com.netflix.paas.tasks.TaskContext; /** * Refresh the information for a cluster * * @author elandau * */ public class ClusterRefreshTask implements Task { private static Logger LOG = LoggerFactory.getLogger(ClusterRefreshTask.class); private final ClusterClientProvider provider; private final Dao<CassandraClusterEntity> clusterDao; @Inject public ClusterRefreshTask(ClusterClientProvider provider, DaoProvider daoProvider) throws Exception { this.provider = provider; this.clusterDao = daoProvider.getDao(SchemaNames.CONFIGURATION.name(), CassandraClusterEntity.class); } @Override public void execte(TaskContext context) throws Exception{ // Get parameters from the context String clusterName = context.getStringParameter("cluster"); Boolean ignoreSystem = context.getBooleanParameter("ignoreSystem", true); CassandraClusterEntity entity = (CassandraClusterEntity)context.getParamater("entity"); LOG.info("Refreshing cluster " + clusterName); // Read the current state from the DAO // CassandraClusterEntity entity = clusterDao.read(clusterName); Map<String, String> existingKeyspaces = entity.getKeyspaces(); if (existingKeyspaces == null) { existingKeyspaces = Maps.newHashMap(); entity.setKeyspaces(existingKeyspaces); } Map<String, String> existingColumnFamilies = entity.getColumnFamilies(); if (existingColumnFamilies == null) { existingColumnFamilies = Maps.newHashMap(); entity.setColumnFamilies(existingColumnFamilies); } Set<String> foundKeyspaces = Sets.newHashSet(); Set<String> foundColumnFamilies = Sets.newHashSet(); Cluster cluster = provider.acquireCluster(new ClusterKey(entity.getClusterName(), entity.getDiscoveryType())); boolean changed = false; // // Iterate found keyspaces try { for (KeyspaceDefinition keyspace : cluster.describeKeyspaces()) { // Extract data from the KeyspaceDefinition String ksName = keyspace.getName(); MapStringToObject keyspaceOptions = getKeyspaceOptions(keyspace); if (existingKeyspaces.containsKey(ksName)) { MapStringToObject previousOptions = JsonSerializer.fromString(existingKeyspaces.get(ksName), MapStringToObject.class); MapDifference keyspaceDiff = Maps.difference(keyspaceOptions, previousOptions); if (keyspaceDiff.areEqual()) { LOG.info("Keyspace '{}' didn't change", new Object[]{ksName}); } else { changed = true; LOG.info("CF Changed: " + keyspaceDiff.entriesDiffering()); } } else { changed = true; } String strKeyspaceOptions = JsonSerializer.toString(keyspaceOptions); // // Keep track of keyspace foundKeyspaces.add(keyspace.getName()); existingKeyspaces.put(ksName, strKeyspaceOptions); LOG.info("Found keyspace '{}|{}' : {}", new Object[]{entity.getClusterName(), ksName, keyspaceOptions}); // // Iterate found column families for (ColumnFamilyDefinition cf : keyspace.getColumnFamilyList()) { // Extract data from the ColumnFamilyDefinition String cfName = String.format("%s|%s", keyspace.getName(), cf.getName()); MapStringToObject cfOptions = getColumnFamilyOptions(cf); String strCfOptions = JsonSerializer.toString(cfOptions); // // // Check for changes if (existingColumnFamilies.containsKey(cfName)) { MapStringToObject previousOptions = JsonSerializer.fromString(existingColumnFamilies.get(cfName), MapStringToObject.class); LOG.info("Old options: " + previousOptions); MapDifference cfDiff = Maps.difference(cfOptions, previousOptions); if (cfDiff.areEqual()) { LOG.info("CF '{}' didn't change", new Object[]{cfName}); } else { changed = true; LOG.info("CF Changed: " + cfDiff.entriesDiffering()); } } else { changed = true; } // // // Keep track of the cf foundColumnFamilies.add(cfName); existingColumnFamilies.put(cfName, strCfOptions); LOG.info("Found column family '{}|{}|{}' : {}", new Object[]{entity.getClusterName(), keyspace.getName(), cf.getName(), strCfOptions}); } } } catch (Exception e) { LOG.info("Error refreshing cluster: " + entity.getClusterName(), e); entity.setEnabled(false); } SetView<String> ksRemoved = Sets.difference(existingKeyspaces.keySet(), foundKeyspaces); LOG.info("Keyspaces removed: " + ksRemoved); SetView<String> cfRemoved = Sets.difference(existingColumnFamilies.keySet(), foundColumnFamilies); LOG.info("CF removed: " + cfRemoved); clusterDao.write(entity); } private MapStringToObject getKeyspaceOptions(KeyspaceDefinition keyspace) { MapStringToObject result = new MapStringToObject(); for (FieldMetadata field : keyspace.getFieldsMetadata()) { result.put(field.getName(), keyspace.getFieldValue(field.getName())); } result.remove("CF_DEFS"); return result; } private MapStringToObject getColumnFamilyOptions(ColumnFamilyDefinition cf) { MapStringToObject result = new MapStringToObject(); for (FieldMetadata field : cf.getFieldsMetadata()) { if (field.getName().equals("COLUMN_METADATA")) { // // This will get handled below } else { Object value = cf.getFieldValue(field.getName()); if (value instanceof ByteBuffer) { result.put(field.getName(), ((ByteBuffer)value).array()); } else { result.put(field.getName(), value); } } } // // Hack to get the column metadata List<MapStringToObject> columns = Lists.newArrayList(); for (ColumnDefinition column : cf.getColumnDefinitionList()) { MapStringToObject map = new MapStringToObject(); for (FieldMetadata field : column.getFieldsMetadata()) { Object value = column.getFieldValue(field.getName()); if (value instanceof ByteBuffer) { result.put(field.getName(), ((ByteBuffer)value).array()); } else { map.put(field.getName(), value); } } columns.add(map); } result.put("COLUMN_METADATA", columns); return result; } } <|start_filename|>staash-core/src/main/java/com/netflix/paas/config/ConfigurationFactory.java<|end_filename|> /******************************************************************************* * /*** * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * ******************************************************************************/ package com.netflix.paas.config; import org.apache.commons.configuration.AbstractConfiguration; import com.netflix.config.DynamicPropertyFactory; /** * Interface for creating a proxied Configuration of an interface which * uses the Configuration annotation * * @author elandau */ public interface ConfigurationFactory { /** * Create an instance of the configuration interface using the default DynamicPropertyFactory and AbstractConfiguration * * @param configClass * @return * @throws Exception */ public <T> T get(Class<T> configClass) throws Exception; /** * Create an instance of the configuration interface * * @param configClass * @param propertyFactory * @param configuration * @return * @throws Exception */ public <T> T get(Class<T> configClass, DynamicPropertyFactory propertyFactory, AbstractConfiguration configuration) throws Exception; } <|start_filename|>staash-tomcat/src/main/java/com/netflix/staash/embedded/TomcatServer.java<|end_filename|> package com.netflix.staash.embedded; import org.apache.catalina.Engine; import org.apache.catalina.Host; import org.apache.catalina.LifecycleException; import org.apache.catalina.connector.Connector; import org.apache.catalina.core.StandardContext; import org.apache.catalina.startup.Embedded; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class TomcatServer { private Embedded tomcat; private int port; private boolean isRunning; private static final Logger LOG = LoggerFactory.getLogger(TomcatServer.class); private static final boolean isInfo = LOG.isInfoEnabled(); public TomcatServer(String contextPath, int port, String appBase, boolean shutdownHook) { if(contextPath == null || appBase == null || appBase.length() == 0) { throw new IllegalArgumentException("Context path or appbase should not be null"); } if(!contextPath.startsWith("/")) { contextPath = "/" + contextPath; } this.port = port; tomcat = new Embedded(); tomcat.setName("TomcatEmbeddedtomcat"); Host localHost = tomcat.createHost("localhost", appBase); localHost.setAutoDeploy(false); StandardContext rootContext = (StandardContext) tomcat.createContext(contextPath, "webapp"); rootContext.setDefaultWebXml("web.xml"); localHost.addChild(rootContext); Engine engine = tomcat.createEngine(); engine.setDefaultHost(localHost.getName()); engine.setName("TomcatEngine"); engine.addChild(localHost); tomcat.addEngine(engine); Connector connector = tomcat.createConnector(localHost.getName(), port, false); tomcat.addConnector(connector); // register shutdown hook if(shutdownHook) { Runtime.getRuntime().addShutdownHook(new Thread() { public void run() { if(isRunning) { if(isInfo) LOG.info("Stopping the Tomcat tomcat, through shutdown hook"); try { if (tomcat != null) { tomcat.stop(); } } catch (LifecycleException e) { LOG.error("Error while stopping the Tomcat tomcat, through shutdown hook", e); } } } }); } } /** * Start the tomcat embedded tomcat */ public void start() throws LifecycleException { if(isRunning) { LOG.warn("Tomcat tomcat is already running @ port={}; ignoring the start", port); return; } if(isInfo) LOG.info("Starting the Tomcat tomcat @ port={}", port); tomcat.setAwait(true); tomcat.start(); isRunning = true; } /** * Stop the tomcat embedded tomcat */ public void stop() throws LifecycleException { if(!isRunning) { LOG.warn("Tomcat tomcat is not running @ port={}", port); return; } if(isInfo) LOG.info("Stopping the Tomcat tomcat"); tomcat.stop(); isRunning = false; } public boolean isRunning() { return isRunning; } public static void main(String[] args) throws Exception{ TomcatServer tomcat = new TomcatServer("staash.war", 8080, "src/main", true); tomcat.start(); Thread.sleep(1000000); // TODO Auto-generated catch block } } <|start_filename|>staash-astyanax/src/main/java/com/netflix/paas/cassandra/provider/KeyspaceClientProvider.java<|end_filename|> /******************************************************************************* * /*** * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * ******************************************************************************/ package com.netflix.paas.cassandra.provider; import com.netflix.astyanax.Keyspace; import com.netflix.paas.cassandra.keys.KeyspaceKey; /** * Abstraction for getting a keyspace. The implementation will handle lifecycle * management for the keyspace. * * @author elandau * */ public interface KeyspaceClientProvider { /** * Get a keyspace by name. Will create one if one does not exist. The provider * will internally keep track of references to the keyspace and will auto remove * it once releaseKeyspace is called and the reference count goes down to 0. * * @param keyspaceName Globally unique keyspace name * * @return A new or previously created keyspace. */ public Keyspace acquireKeyspace(String schemaName); /** * Get a keyspace by key. * @param key * @return */ public Keyspace acquireKeyspace(KeyspaceKey key); /** * Release a previously acquried keyspace * @param keyspace */ public void releaseKeyspace(String schemaName); } <|start_filename|>staash-svc/src/main/java/com/netflix/staash/service/DataService.java<|end_filename|> /******************************************************************************* * /* * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * * * ******************************************************************************/ package com.netflix.staash.service; import java.io.InputStream; import com.netflix.staash.json.JsonArray; import com.netflix.staash.json.JsonObject; public interface DataService { public String writeRow(String db, String table, JsonObject rowObj); public String listRow(String db, String table, String keycol, String key); public String writeEvent(String db, String table, JsonObject rowObj); public String writeEvents(String db, String table, JsonArray rowObj); public String readEvent(String db, String table, String eventTime); public String readEvent(String db, String table, String prefix,String eventTime); public String readEvent(String db, String table, String prefix,String startTime, String endTime); public String doJoin(String db, String table1, String table2, String joincol, String value); public String writeToKVStore(String db, String table, JsonObject obj); public byte[] fetchValueForKey(String db, String table, String keycol, String key); public byte[] readChunked(String db, String table, String objectName); public String writeChunked(String db, String table, String objectName, InputStream is); } <|start_filename|>staash-svc/src/main/java/com/netflix/staash/connection/CassandraConnection.java<|end_filename|> /******************************************************************************* * /* * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * * * ******************************************************************************/ package com.netflix.staash.connection; import java.io.ByteArrayOutputStream; import java.io.InputStream; import java.io.OutputStream; import com.datastax.driver.core.Cluster; import com.datastax.driver.core.ResultSet; import com.datastax.driver.core.Session; import com.netflix.staash.common.query.QueryFactory; import com.netflix.staash.common.query.QueryType; import com.netflix.staash.common.query.QueryUtils; import com.netflix.staash.json.JsonObject; import com.netflix.staash.model.StorageType; public class CassandraConnection implements PaasConnection { private Cluster cluster; private Session session; public CassandraConnection(Cluster cluster) { this.cluster = cluster; session = this.cluster.connect(); } public Session getSession() { return cluster.connect(); } public String insert(String db, String table, JsonObject payload) { String query = QueryFactory.BuildQuery(QueryType.INSERT, StorageType.CASSANDRA); session.execute(String.format(query, db + "." + table, payload.getString("columns"), payload.getValue("values"))); return "{\"message\":\"ok\"}"; } public String createDB(String dbname) { String sql = String.format(QueryFactory.BuildQuery(QueryType.CREATEDB, StorageType.CASSANDRA), dbname, 1); ; session.execute(sql); return "{\"message\":\"ok\"}"; } public String createTable(JsonObject payload) { String sql = String .format(QueryFactory.BuildQuery(QueryType.CREATETABLE, StorageType.CASSANDRA), payload.getString("db") + "." + payload.getString("name"), QueryUtils.formatColumns( payload.getString("columns"), StorageType.CASSANDRA), payload.getString("primarykey")); session.execute(sql + ";"); return "{\"message\":\"ok\"}"; } public String read(String db, String table, String keycol, String key, String... keyvals) { if (keyvals != null && keyvals.length == 2) { String query = QueryFactory.BuildQuery(QueryType.SELECTEVENT, StorageType.CASSANDRA); return QueryUtils.formatQueryResult(session.execute(String.format( query, db + "." + table, keycol, key, keyvals[0], keyvals[1]))); } else { String query = QueryFactory.BuildQuery(QueryType.SELECT, StorageType.CASSANDRA); ResultSet rs = session.execute(String.format(query, db + "." + table, keycol, key)); if (rs != null && rs.all().size() > 0) return QueryUtils.formatQueryResult(rs); return "{\"msg\":\"Nothing is found\"}"; } } public void closeConnection() { //Implement as per driver choice } public ByteArrayOutputStream readChunked(String db, String table, String objectName) { return null; } public String writeChunked(String db, String table, String objectName, InputStream is) { return null; } } <|start_filename|>staash-svc/src/main/java/com/netflix/staash/rest/util/StaashRequestContext.java<|end_filename|> package com.netflix.staash.rest.util; import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.atomic.AtomicLong; import org.joda.time.DateTime; import org.joda.time.format.DateTimeFormat; import org.joda.time.format.DateTimeFormatter; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * Simple class that encapsulates a ThreadLocal of a map of context. * This context can be used by various classes that service the request and * can store vital info that can be used for debugging. * * @author poberai * */ public class StaashRequestContext { private static final Logger Logger = LoggerFactory.getLogger(StaashRequestContext.class); private static final DateTimeFormatter dateFormat = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss.SSS z"); private static final ThreadLocal<StaashRequestContext> requestContext = new ThreadLocal<StaashRequestContext>() { @Override protected StaashRequestContext initialValue() { return new StaashRequestContext(); } }; public static void resetRequestContext() { requestContext.set(new StaashRequestContext()); } public static void flushRequestContext() { Logger.info(requestContext.get().getMapContents()); } public static void addContext(String key, String value) { requestContext.get().addContextToMap(key, value); } public static void logDate() { requestContext.get().addDateToMap(); } public static void recordRequestStart() { requestContext.get().startTime.set(System.currentTimeMillis()); } public static void recordRequestEnd() { Long begin = requestContext.get().startTime.get(); Long now = System.currentTimeMillis(); requestContext.get().addContextToMap("Duration", String.valueOf(now - begin)); } public static String getRequestId() { return requestContext.get().requestId; } private final ConcurrentHashMap<String, String> map = new ConcurrentHashMap<String, String>(); private final AtomicLong startTime = new AtomicLong(0L); private final String requestId = UUID.randomUUID().toString(); private StaashRequestContext() { map.put("request-id", requestId); } private void addContextToMap(String key, String value) { map.put(key, value); } private void addDateToMap() { DateTime dt = new DateTime(); map.put("Date", dateFormat.print(dt)); } private String getMapContents() { if (map == null) { return null; } StringBuilder sb = new StringBuilder("\n========================STAASH REQUEST CONTEXT==========================================="); for (String key : map.keySet()) { sb.append("\n").append(key).append(":").append(map.get(key)); } sb.append("\n======================================================================================"); return sb.toString(); } } <|start_filename|>staash-svc/src/test/java/com/netflix/paas/rest/test/PaasTestHelper.java<|end_filename|> /******************************************************************************* * /* * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * * * ******************************************************************************/ package com.netflix.paas.rest.test; public class PaasTestHelper { public static final String ServerUrl = "http://localhost:8080"; public static final String CreateDBUrl = "/staash/v1/admin"; public static final String CreateDBPayload = "{name: testdb}"; public static final String ListDBUrl = "/staash/v1/admin"; public static final String CreateStorageUrl = "http://localhost:8080/paas/v1/admin/storage"; public static final String CreateStoragePayloadCassandra = "{name:testStorageCass, type: cassandra, cluster:local, replicateto:newcluster"; public static final String ListStorage = "/staash/v1/admin/storage"; public static final String CreateTableUrl = "/staash/v1/admin/testdb"; public static final String CreateTablePayload = "{name:testtable, columns:user,friends,wall,status, primarykey:user, storage: teststoagecass}"; public static final String ListTablesUrl = "/staash/v1/admin/testdb"; public static final String InsertRowUrl = "/staash/v1/data/testdb/testtable"; public static final String InserRowUrlPayload = "{columns:user,friends,wall,status,values:rogerfed,rafanad,blahblah,blahblahblah}"; public static final String ReadRowUrl = "/staash/v1/data/testdb/testtable/username/rogerfed"; public static final String CreateTimeSeriesUrl = "/staash/v1/admin/timeseries/testdb"; public static final String CreateTimeSeriesPayload = "{\"name\":\"testseries\",\"msperiodicity\":10000,\"prefix\":\"rogerfed\"}"; public static final String ListTimeSeriesUrl = "/staash/v1/admin/timeseries/testdb"; public static final String CreateEventUrl = "/staash/v1/admin/timeseries/testdb/testseries"; public static final String CreateEventPayload = "{\"time\":1000000,\"event\":\"{tweet: enjoying a cruise}}\""; public static final String ReadEventUrl = "/staash/v1/data/timeseries/testdb/testseries/time/100000/prefix/rogerfed"; } <|start_filename|>staash-astyanax/src/main/java/com/netflix/paas/cassandra/entity/KeyspaceEntity.java<|end_filename|> /******************************************************************************* * /*** * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * ******************************************************************************/ package com.netflix.paas.cassandra.entity; import java.util.HashSet; import java.util.Map; import java.util.Set; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.PostLoad; import javax.persistence.PrePersist; import javax.persistence.Transient; import com.google.common.base.Preconditions; import com.netflix.paas.exceptions.NotFoundException; @Entity public class KeyspaceEntity { public static class Builder { private final KeyspaceEntity entity = new KeyspaceEntity(); public Builder withName(String name) { entity.name = name; return this; } public Builder addColumnFamily(String columnFamilyName) { if (entity.getColumnFamilies() == null) { entity.setColumnFamilies(new HashSet<String>()); } entity.getColumnFamilies().add(columnFamilyName); return this; } public Builder withOptions(Map<String, String> options) { entity.setOptions(options); return this; } public KeyspaceEntity build() { return this.entity; } } public static Builder builder() { return new Builder(); } @Id private String id; @Column(name="name") private String name; @Column(name="cluster") private String clusterName; @Column(name="options") private Map<String, String> options; @Column(name="cfs") private Set<String> columnFamilies; @Transient private Map<String, ColumnFamilyEntity> columnFamilyEntities; @PrePersist private void prePersist() { this.id = String.format("%s.%s", clusterName, name); } @PostLoad private void postLoad() { this.id = String.format("%s.%s", clusterName, name); } public String getName() { return name; } public void setName(String name) { this.name = name; } public Map<String, ColumnFamilyEntity> getColumnFamilyEntities() { return columnFamilyEntities; } public void setColumnFamilyEntities(Map<String, ColumnFamilyEntity> columnFamilyEntities) { this.columnFamilyEntities = columnFamilyEntities; } public Map<String, String> getOptions() { return options; } public void setOptions(Map<String, String> options) { this.options = options; } public String getClusterName() { return clusterName; } public void setClusterName(String clusterName) { this.clusterName = clusterName; } public Set<String> getColumnFamilies() { return columnFamilies; } public void setColumnFamilies(Set<String> columnFamilies) { this.columnFamilies = columnFamilies; } public ColumnFamilyEntity getColumnFamily(String columnFamilyName) throws NotFoundException { ColumnFamilyEntity entity = columnFamilyEntities.get(columnFamilyName); if (entity == null) throw new NotFoundException("columnfamily", columnFamilyName); return entity; } } <|start_filename|>staash-astyanax/src/test/java/com/netflix/paas/cassandra/provider/AstyanaxThriftTest.java<|end_filename|> /******************************************************************************* * /*** * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * ******************************************************************************/ package com.netflix.paas.cassandra.provider; import junit.framework.Assert; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Ignore; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.google.common.collect.ImmutableMap; import com.google.inject.AbstractModule; import com.google.inject.Injector; import com.google.inject.Scopes; import com.google.inject.name.Names; import com.netflix.astyanax.Keyspace; import com.netflix.astyanax.util.SingletonEmbeddedCassandra; import com.netflix.governator.guice.LifecycleInjector; import com.netflix.governator.lifecycle.LifecycleManager; import com.netflix.paas.PaasBootstrap; import com.netflix.paas.PaasModule; import com.netflix.paas.cassandra.CassandraPaasModule; import com.netflix.paas.cassandra.PaasCassandraBootstrap; import com.netflix.paas.cassandra.admin.CassandraClusterAdminResource; import com.netflix.paas.cassandra.admin.CassandraClusterAdminResourceFactory; import com.netflix.paas.cassandra.discovery.ClusterDiscoveryService; import com.netflix.paas.cassandra.discovery.LocalClusterDiscoveryService; import com.netflix.paas.cassandra.entity.ColumnFamilyEntity; import com.netflix.paas.cassandra.entity.KeyspaceEntity; import com.netflix.paas.cassandra.keys.ClusterKey; import com.netflix.paas.cassandra.keys.KeyspaceKey; import com.netflix.paas.cassandra.provider.KeyspaceClientProvider; import com.netflix.paas.cassandra.resources.AstyanaxThriftDataTableResource; import com.netflix.paas.data.QueryResult; import com.netflix.paas.data.RowData; import com.netflix.paas.data.SchemalessRows; import com.netflix.paas.resources.TableDataResource; public class AstyanaxThriftTest { private static final Logger LOG = LoggerFactory.getLogger(AstyanaxThriftTest.class) ; private static Injector injector; private static final String CLUSTER_NAME = "local"; private static final String KEYSPACE_NAME = "Keyspace1"; private static final String CF_NAME = "ColumnFamily1"; private static final String LOCAL_DISCOVERY_TYPE = "local"; // @BeforeClass // @Ignore // public static void initialize() throws Exception { // // System.setProperty("com.netflix.paas.title", "HelloPaas"); // System.setProperty("com.netflix.paas.cassandra.dcs", "us-east"); // System.setProperty("com.netflix.paas.schema.configuration.type", "astyanax"); // System.setProperty("com.netflix.paas.schema.configuration.discovery", "local"); // System.setProperty("com.netflix.paas.schema.configuration.cluster", "cass_sandbox"); // System.setProperty("com.netflix.paas.schema.configuration.keyspace", "paas"); // System.setProperty("com.netflix.paas.schema.configuration.strategy_options.replication_factor", "1"); // System.setProperty("com.netflix.paas.schema.configuration.strategy_class", "SimpleStrategy"); // System.setProperty("com.netflix.paas.schema.audit", "configuration"); // // SingletonEmbeddedCassandra.getInstance(); // // // Create the injector // injector = LifecycleInjector.builder() // .withModules( // new PaasModule(), // new CassandraPaasModule(), // new AbstractModule() { // @Override // protected void configure() { // bind(String.class).annotatedWith(Names.named("groupName")).toInstance("UnitTest1"); // bind(ClusterDiscoveryService.class).to(LocalClusterDiscoveryService.class).in(Scopes.SINGLETON); // // bind(PaasBootstrap.class).asEagerSingleton(); // bind(PaasCassandraBootstrap.class).asEagerSingleton(); // } // }) // .createInjector(); // // LifecycleManager manager = injector.getInstance(LifecycleManager.class); // manager.start(); // // CassandraClusterAdminResourceFactory factory = injector.getInstance(CassandraClusterAdminResourceFactory.class); // // // Create Keyspace // CassandraClusterAdminResource admin = factory.get(new ClusterKey(CLUSTER_NAME, "local")); // admin.createKeyspace(KeyspaceEntity.builder() // .withName(KEYSPACE_NAME) // .withOptions(ImmutableMap.<String, String>builder() // .put("strategy_class", "SimpleStrategy") // .put("strategy_options.replication_factor", "1") // .build()) // .build()); // // // Create column family // admin.createColumnFamily(KEYSPACE_NAME, ColumnFamilyEntity.builder() // .withName(CF_NAME) // .withOptions(ImmutableMap.<String, String>builder() // .put("comparator_type", "LongType") // .put("key_validation_class", "LongType") // .build()) // .build()); // // // Create DB from cluster // // } @AfterClass public static void shutdown() { } @Test @Ignore public void testReadData() throws Exception { KeyspaceClientProvider clientProvider = injector.getInstance(KeyspaceClientProvider.class); Keyspace keyspace = clientProvider.acquireKeyspace(new KeyspaceKey(new ClusterKey(LOCAL_DISCOVERY_TYPE, CLUSTER_NAME), KEYSPACE_NAME)); // // // Create the keyspace and column family // keyspace.createKeyspace(new Properties()); // Properties props = new Properties(); // props.setProperty("name", CF_NAME); // props.setProperty("comparator_type", "LongType"); // props.setProperty("key_validation_class", "LongType"); // keyspace.createColumnFamily(props); // // // Add some data TableDataResource thriftDataTableResource = new AstyanaxThriftDataTableResource(keyspace, CF_NAME); String rowKey = "100"; SchemalessRows.Builder builder = SchemalessRows.builder(); builder.addRow(rowKey, ImmutableMap.<String, String>builder().put("1", "11").put("2", "22").build()); RowData dr = new RowData(); dr.setSrows(builder.build()); // thriftDataTableResource.updateRow(rowKey, dr); QueryResult result; result = thriftDataTableResource.readRow(rowKey, 1, null, null, false); // Assert.assertEquals(1, Iterables.getFirst(result.getSrows().getRows(), null).getColumns().size()); LOG.info(result.toString()); result = thriftDataTableResource.readRow(rowKey, 10, null, null, false); // Assert.assertEquals(2, Iterables.getFirst(result.getRows(), null).getColumns().size()); LOG.info(result.toString()); } @Test @Ignore public void testAdmin() { } } <|start_filename|>staash-core/src/main/java/com/netflix/paas/data/SchemalessRows.java<|end_filename|> /******************************************************************************* * /*** * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * ******************************************************************************/ package com.netflix.paas.data; import java.util.Map; import com.google.common.collect.Maps; /** * Representation of rows as a sparse tree of rows to column value pairs * * @author elandau * */ public class SchemalessRows { public static class Builder { private SchemalessRows rows = new SchemalessRows(); public Builder() { rows.rows = Maps.newHashMap(); } public Builder addRow(String row, Map<String, String> columns) { rows.rows.put(row, columns); return this; } public SchemalessRows build() { return rows; } } public static Builder builder() { return new Builder(); } private Map<String, Map<String, String>> rows; public Map<String, Map<String, String>> getRows() { return rows; } public void setRows(Map<String, Map<String, String>> rows) { this.rows = rows; } @Override public String toString() { return "SchemalessRows [rows=" + rows + "]"; } } <|start_filename|>staash-web/src/test/java/com/netflix/staash/web/tests/TimeSeriesTest.java<|end_filename|> package com.netflix.staash.web.tests; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; import org.junit.runner.RunWith; import com.google.inject.Guice; import com.google.inject.Injector; import com.netflix.staash.json.JsonObject; import com.netflix.staash.service.PaasDataService; import com.netflix.staash.service.PaasMetaService; import com.netflix.staash.test.modules.TestStaashModule; import com.netflix.staash.test.core.CassandraRunner; //@RequiresKeyspace(ksName = "paasmetaks") //@RequiresColumnFamily(ksName = "paasmetaks", cfName = "metacf", comparator = "org.apache.cassandra.db.marshal.UTF8Type", keyValidator = "org.apache.cassandra.db.marshal.UTF8Type") //@SuppressWarnings({ "rawtypes", "unchecked" }) @RunWith(CassandraRunner.class) public class TimeSeriesTest { public static PaasMetaService metasvc; public static PaasDataService datasvc; public static final String db = "unitdb1"; public static final String timeseries = "testtimeseries1"; public static String timeseriespay = "{\"name\":\"timeseries1\",\"periodicity\":\"10000\",\"prefix\":\"server1\",\"storage\":\"cassandratest\"}"; @BeforeClass public static void setup() { TestStaashModule pmod = new TestStaashModule(); Injector inj = Guice.createInjector(pmod); metasvc = inj.getInstance(PaasMetaService.class); datasvc = inj.getInstance(PaasDataService.class); StaashTestHelper.createTestStorage(metasvc); StaashTestHelper.createTestDB(metasvc); StaashTestHelper.createTestTimeSeries(metasvc, timeseriespay); System.out.println("Done:"); } @Test public void testTimeseriesWriteRead() { String payload1="{\"timestamp\":11000,\"event\":\"hi 11k event\",\"prefix\":\"source1\"}"; String payload2="{\"timestamp\":21000,\"event\":\"hi 21k event\",\"prefix\":\"source1\"}"; String payload3="{\"timestamp\":121000,\"event\":\"hi 121k event\",\"prefix\":\"source2\"}"; StaashTestHelper.writeEvent(datasvc, new JsonObject(payload1)); StaashTestHelper.writeEvent(datasvc, new JsonObject(payload2)); StaashTestHelper.writeEvent(datasvc, new JsonObject(payload3)); readTimeSeries(); } private void readTimeSeries() { String db = "unitdb1"; String table = "timeseries1"; String out = ""; out = datasvc.readEvent(db, table, "source2","121000"); assert out.equals("{\"1 Jan 1970 00:02:01 GMT\":\"hi 121k event\"}"); System.out.println("out= "+out); out = datasvc.readEvent(db, table, "source1", "21000"); assert out.equals("{\"1 Jan 1970 00:00:21 GMT\":\"hi 21k event\"}"); System.out.println("out= "+out); out = datasvc.readEvent(db, table, "source1", "11000"); assert out.equals("{\"1 Jan 1970 00:00:11 GMT\":\"hi 11k event\"}"); System.out.println("out= "+out); } } <|start_filename|>staash-mesh/src/main/java/com/netflix/staash/mesh/InstanceRegistry.java<|end_filename|> /******************************************************************************* * /*** * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * ******************************************************************************/ package com.netflix.staash.mesh; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Map; import java.util.UUID; import java.util.concurrent.atomic.AtomicReference; import com.google.common.collect.Lists; import com.google.common.collect.Maps; /** * Registry for all active instances. Keeps track of a sorted list of instances. * * @author elandau * */ public class InstanceRegistry { private final Map<UUID, InstanceInfo> members = Maps.newHashMap(); private final AtomicReference<List<InstanceInfo>> ring = new AtomicReference<List<InstanceInfo>>(new ArrayList<InstanceInfo>()); private static final CompareInstanceInfoByUuid comparator = new CompareInstanceInfoByUuid(); /** * A new instance has joined the ring * @param node */ public synchronized void join(InstanceInfo node) { members.put(node.getUuid(), node); update(); } /** * An instance was removed from the the ring * @param node */ public synchronized void leave(InstanceInfo node) { members.remove(node.getUuid()); update(); } /** * Resort the ring */ private void update() { List<InstanceInfo> list = Lists.newArrayList(members.values()); Collections.sort(list, comparator); ring.set(list); } /** * Return a sorted list of InstanceInfo. Sorted by UUID. * @return */ public List<InstanceInfo> getMembers() { return ring.get(); } } <|start_filename|>staash-core/src/main/java/com/netflix/paas/tasks/InlineTaskManager.java<|end_filename|> /******************************************************************************* * /*** * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * ******************************************************************************/ package com.netflix.paas.tasks; import java.util.Map; import java.util.Map.Entry; import java.util.concurrent.ExecutionException; import java.util.concurrent.Executor; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.google.common.eventbus.EventBus; import com.google.common.util.concurrent.ListenableFuture; import com.google.inject.Binding; import com.google.inject.Inject; import com.google.inject.Injector; import com.google.inject.Key; public class InlineTaskManager implements TaskManager { private final static Logger LOG = LoggerFactory.getLogger(InlineTaskManager.class); private final Injector injector; public static class SyncListenableFuture implements ListenableFuture<Void> { private final Exception exception; public SyncListenableFuture(Exception exception) { this.exception = exception; } @Override public boolean cancel(boolean mayInterruptIfRunning) { return false; } @Override public Void get() throws InterruptedException, ExecutionException { if (exception != null) throw new ExecutionException("Very bad", exception); return null; } @Override public Void get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException { if (exception != null) throw new ExecutionException("Very bad", exception); return get(); } @Override public boolean isCancelled() { return false; } @Override public boolean isDone() { return true; } @Override public void addListener(Runnable listener, Executor executor) { } } @Inject public InlineTaskManager(Injector injector, EventBus eventBus) { this.injector = injector; LOG.info("SyncTaskManager " + this.injector); for (Entry<Key<?>, Binding<?>> key : this.injector.getBindings().entrySet()) { LOG.info("SyncTaskManager " + key.toString()); } } @Override public ListenableFuture<Void> submit(Class<?> clazz, Map<String, Object> args) { Task task; Exception exception = null; TaskContext context = new TaskContext(clazz, args); try { LOG.info(clazz.getCanonicalName()); task = (Task) injector.getInstance(clazz); task.execte(context); } catch (Exception e) { LOG.warn("Failed to execute task '{}'. '{}'", new Object[]{context.getKey(), e.getMessage(), e}); exception = e; } return new SyncListenableFuture(exception); } @Override public ListenableFuture<Void> submit(Class<?> clazz) { return submit(clazz, null); } } <|start_filename|>staash-astyanax/src/main/java/com/netflix/paas/cassandra/keys/KeyspaceKey.java<|end_filename|> /******************************************************************************* * /*** * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * ******************************************************************************/ package com.netflix.paas.cassandra.keys; import org.apache.commons.lang.StringUtils; import com.google.common.base.Preconditions; /** * Global unique keyspace identifier * @author elandau * */ public class KeyspaceKey { private final ClusterKey clusterKey; private final String keyspaceName; private final String schemaName; public KeyspaceKey(String schemaName) { String parts[] = StringUtils.split(schemaName, "."); Preconditions.checkState(parts.length == 2, String.format("Schema name must have format <cluster>.<keyspace> ('%s')", schemaName)); this.clusterKey = new ClusterKey(parts[0], null); // TODO this.keyspaceName = parts[1]; this.schemaName = schemaName; } public KeyspaceKey(ClusterKey clusterKey, String keyspaceName) { this.clusterKey = clusterKey; this.keyspaceName = keyspaceName; this.schemaName = StringUtils.join(new String[]{clusterKey.getClusterName(), keyspaceName}, "."); } public ClusterKey getClusterKey() { return clusterKey; } public String getClusterName() { return clusterKey.getClusterName(); } public String getKeyspaceName() { return this.keyspaceName; } public String getDiscoveryType() { return this.clusterKey.getDiscoveryType(); } public String getSchemaName() { return this.schemaName; } public String getCanonicalName() { return StringUtils.join(new String[]{this.clusterKey.getCanonicalName(), getKeyspaceName()}, "."); } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((clusterKey == null) ? 0 : clusterKey.hashCode()); result = prime * result + ((keyspaceName == null) ? 0 : keyspaceName.hashCode()); result = prime * result + ((schemaName == null) ? 0 : schemaName.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; KeyspaceKey other = (KeyspaceKey) obj; if (clusterKey == null) { if (other.clusterKey != null) return false; } else if (!clusterKey.equals(other.clusterKey)) return false; if (keyspaceName == null) { if (other.keyspaceName != null) return false; } else if (!keyspaceName.equals(other.keyspaceName)) return false; if (schemaName == null) { if (other.schemaName != null) return false; } else if (!schemaName.equals(other.schemaName)) return false; return true; } } <|start_filename|>staash-astyanax/src/main/java/com/netflix/paas/cassandra/provider/impl/AnnotatedAstyanaxConfiguration.java<|end_filename|> /******************************************************************************* * /*** * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * ******************************************************************************/ package com.netflix.paas.cassandra.provider.impl; import java.util.concurrent.ExecutorService; import com.netflix.astyanax.AstyanaxConfiguration; import com.netflix.astyanax.Clock; import com.netflix.astyanax.connectionpool.NodeDiscoveryType; import com.netflix.astyanax.connectionpool.impl.ConnectionPoolType; import com.netflix.astyanax.model.ConsistencyLevel; import com.netflix.astyanax.partitioner.Partitioner; import com.netflix.astyanax.retry.RetryPolicy; import com.netflix.astyanax.retry.RunOnce; import com.netflix.governator.annotations.Configuration; public class AnnotatedAstyanaxConfiguration implements AstyanaxConfiguration { @Configuration("${prefix}.${name}.retryPolicy") private RetryPolicy retryPolicy = RunOnce.get(); @Configuration("${prefix}.${name}.defaultReadConsistencyLevel") private ConsistencyLevel defaultReadConsistencyLevel = ConsistencyLevel.CL_ONE; @Configuration("${prefix}.${name}.defaultWriteConsistencyLevel") private ConsistencyLevel defaultWriteConsistencyLevel = ConsistencyLevel.CL_ONE; @Configuration("${prefix}.${name}.clock") private String clockName = null; @Configuration("${prefix}.${name}.discoveryDelayInSeconds") private int discoveryDelayInSeconds; @Configuration("${prefix}.${name}.discoveryType") private NodeDiscoveryType discoveryType; @Configuration("${prefix}.${name}.connectionPoolType") private ConnectionPoolType getConnectionPoolType; @Configuration("${prefix}.${name}.cqlVersion") private String cqlVersion; private Clock clock; void initialize() { } void cleanup() { } @Override public RetryPolicy getRetryPolicy() { return retryPolicy; } @Override public ConsistencyLevel getDefaultReadConsistencyLevel() { return this.defaultReadConsistencyLevel; } @Override public ConsistencyLevel getDefaultWriteConsistencyLevel() { return this.defaultWriteConsistencyLevel; } @Override public Clock getClock() { return this.clock; } @Override public ExecutorService getAsyncExecutor() { return null; } @Override public int getDiscoveryDelayInSeconds() { // TODO Auto-generated method stub return 0; } @Override public NodeDiscoveryType getDiscoveryType() { // TODO Auto-generated method stub return null; } @Override public ConnectionPoolType getConnectionPoolType() { // TODO Auto-generated method stub return null; } @Override public String getCqlVersion() { // TODO Auto-generated method stub return null; } @Override public String getTargetCassandraVersion() { // TODO Auto-generated method stub return null; } @Override public Partitioner getPartitioner(String partitionerName) throws Exception { // TODO Auto-generated method stub return null; } } <|start_filename|>staash-svc/src/main/java/com/netflix/staash/storage/service/MySqlService.java<|end_filename|> /******************************************************************************* * /* * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * * * ******************************************************************************/ package com.netflix.staash.storage.service; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; public class MySqlService { public static void createDbInMySql(String dbName) { System.out.println("-------- MySQL JDBC Connection Testing ------------"); try { Class.forName("com.mysql.jdbc.Driver"); } catch (ClassNotFoundException e) { System.out.println("Where is your MySQL JDBC Driver?"); e.printStackTrace(); return; } System.out.println("MySQL JDBC Driver Registered!"); Connection connection = null; Statement stmt = null; try { connection = DriverManager .getConnection("jdbc:mysql://localhost:3306/","root", ""); String sql = "CREATE DATABASE "+dbName; stmt = connection.createStatement(); stmt.executeUpdate(sql); System.out.println("Database created successfully..."); } catch (SQLException e) { System.out.println("Connection Failed! Check output console"); e.printStackTrace(); return; } } public static void createTableInDb(String schema, String query) { try { Class.forName("com.mysql.jdbc.Driver"); System.out.println("Connecting to a selected database..."); Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/"+schema,"root", ""); System.out.println("Connected database successfully..."); System.out.println("Creating table in given database..."); Statement stmt = conn.createStatement(); // String sql = "CREATE TABLE REGISTRATION " + // "(id INTEGER not NULL, " + // " first VARCHAR(255), " + // " last VARCHAR(255), " + // " age INTEGER, " + // " PRIMARY KEY ( id ))"; stmt.executeUpdate(query); } catch (ClassNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public static void insertRowIntoTable(String db, String table, String query) { try { Class.forName("com.mysql.jdbc.Driver"); System.out.println("Connecting to a selected database..."); Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/"+db,"root", ""); System.out.println("Connected database successfully..."); System.out.println("Creating table in given database..."); Statement stmt = conn.createStatement(); // String sql = "CREATE TABLE REGISTRATION " + // "(id INTEGER not NULL, " + // " first VARCHAR(255), " + // " last VARCHAR(255), " + // " age INTEGER, " + // " PRIMARY KEY ( id ))"; stmt.executeUpdate(query); } catch (ClassNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public static ResultSet executeRead(String db, String query) { // TODO Auto-generated method stub try { Class.forName("com.mysql.jdbc.Driver"); Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/"+db,"root", ""); Statement stmt = conn.createStatement(); return stmt.executeQuery(query); } catch (ClassNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } return null; } } <|start_filename|>staash-jetty/src/main/java/com/netflix/staash/jetty/NewPaasGuiceServletConfig.java<|end_filename|> /******************************************************************************* * /*** * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * ******************************************************************************/ package com.netflix.staash.jetty; import com.google.inject.AbstractModule; import com.google.inject.Injector; import com.google.inject.servlet.GuiceServletContextListener; import com.netflix.governator.guice.LifecycleInjector; import com.netflix.paas.cassandra.MetaCassandraBootstrap; import com.netflix.paas.cassandra.MetaModule; import com.sun.jersey.guice.JerseyServletModule; import com.sun.jersey.guice.spi.container.servlet.GuiceContainer; public class NewPaasGuiceServletConfig extends GuiceServletContextListener { @Override protected Injector getInjector() { return LifecycleInjector.builder() .withModules( new MetaModule(), //new EurekaModule(), new JerseyServletModule() { @Override protected void configureServlets() { // Route all requests through GuiceContainer bind(GuiceContainer.class).asEagerSingleton(); serve("/*").with(GuiceContainer.class); } }, new AbstractModule() { @Override protected void configure() { bind(MetaCassandraBootstrap.class).asEagerSingleton(); } } ) .createInjector(); } } <|start_filename|>staash-core/src/test/java/com/netflix/paas/TrieTest.java<|end_filename|> /******************************************************************************* * /*** * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * ******************************************************************************/ package com.netflix.paas; import java.text.CharacterIterator; import java.text.StringCharacterIterator; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentMap; import java.util.concurrent.atomic.AtomicReference; import org.apache.commons.lang.StringUtils; import org.junit.Test; import com.google.common.collect.Lists; import com.google.common.collect.Maps; public class TrieTest { public static interface TrieNodeVisitor { void visit(TrieNode node); } public static interface TrieNode { public TrieNode getOrCreateChild(Character c); public TrieNode getChild(Character c); public Character getCharacter(); public void setIsWord(boolean isWord); public boolean isWord(); public void accept(TrieNodeVisitor visitor); } public static class HashMapTrieNode implements TrieNode { private final ConcurrentMap<Character, TrieNode> children = Maps.newConcurrentMap(); private final Character character; private volatile boolean isWord = false; public HashMapTrieNode(Character ch) { this.character = ch; } public TrieNode getChild(Character c) { return children.get(c); } public TrieNode getOrCreateChild(Character c) { TrieNode node = children.get(c); if (node == null) { TrieNode newNode = new HashMapTrieNode(c); System.out.println("Create child : " + c); node = children.putIfAbsent(c, newNode); if (node == null) return newNode; } return node; } public void setIsWord(boolean isWord) { this.isWord = isWord; } public boolean isWord() { return isWord; } @Override public Character getCharacter() { return this.character; } public void accept(TrieNodeVisitor visitor) { List<TrieNode> nodes = Lists.newArrayList(children.values()); Collections.sort(nodes, new Comparator<TrieNode>() { @Override public int compare(TrieNode arg0, TrieNode arg1) { return arg0.getCharacter().compareTo(arg1.getCharacter()); } }); for (TrieNode node : nodes) { visitor.visit(node); } } } public static class AtomicTrieNode implements TrieNode { private final AtomicReference<Map<Character, TrieNode>> children = new AtomicReference<Map<Character, TrieNode>>(); private final Character character; private volatile boolean isWord = false; public AtomicTrieNode(Character ch) { this.children.set(new HashMap<Character, TrieNode>()); this.character = ch; } public TrieNode getChild(Character c) { return children.get().get(c); } public TrieNode getOrCreateChild(Character c) { TrieNode node = children.get().get(c); if (node == null) { Map<Character, TrieNode> newChs; do { Map<Character, TrieNode> chs = children.get(); node = chs.get(c); if (node != null) { break; } newChs = Maps.newHashMap(chs); node = new AtomicTrieNode(c); newChs.put(c, node); if (children.compareAndSet(chs, newChs)) { break; } } while (true); } return node; } public void setIsWord(boolean isWord) { this.isWord = isWord; } public boolean isWord() { return isWord; } @Override public Character getCharacter() { return this.character; } public void accept(TrieNodeVisitor visitor) { List<TrieNode> nodes = Lists.newArrayList(children.get().values()); Collections.sort(nodes, new Comparator<TrieNode>() { @Override public int compare(TrieNode arg0, TrieNode arg1) { return arg0.getCharacter().compareTo(arg1.getCharacter()); } }); for (TrieNode node : nodes) { visitor.visit(node); } } } public static class Trie { private TrieNode root = new AtomicTrieNode(null); public boolean addWord(String word) { word = word.toUpperCase(); StringCharacterIterator iter = new StringCharacterIterator(word); TrieNode current = root; for (Character ch = iter.first(); ch != CharacterIterator.DONE; ch = iter.next()) { current = current.getOrCreateChild(ch); } current.setIsWord(true); return true; } public boolean containsWord(String word) { word = word.toUpperCase(); StringCharacterIterator iter = new StringCharacterIterator(word); TrieNode current = root; for (Character ch = iter.first(); ch != CharacterIterator.DONE; ch = iter.next()) { current = current.getChild(ch); if (current == null) return false; } return current.isWord(); } public void accept(TrieNodeVisitor visitor) { visitor.visit(root); } } public static class SimpleTriePrinter implements TrieNodeVisitor { private String prefix = ""; @Override public void visit(TrieNode node) { System.out.println(prefix + node.getCharacter()); prefix += " "; node.accept(this); prefix = StringUtils.substring(prefix, 1); } } @Test public void testTrie() { String[] common = {"the","of","and","a","to","in","is","you","that","it","he","was","for","on","are","as","with","his","they","I","at","be","this","have","from","or","one","had","by","word","but","not","what","all","were","we","when","your","can","said","there","use","an","each","which","she","do","how","their","if","will","up","other","about","out","many","then","them","these","so","some","her","would","make","like","him","into","time","has","look","two","more","write","go","see","number","no","way","could","people","my","than","first","water","been","call","who","oil","its","now","find","long","down","day","did","get","come","made","may","part"}; Trie trie = new Trie(); for (String word : common) { trie.addWord(word); } trie.accept(new SimpleTriePrinter()); } } <|start_filename|>staash-web/src/test/java/com/netflix/staash/web/tests/TestChunking.java<|end_filename|> /******************************************************************************* * /* * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * * * ******************************************************************************/ package com.netflix.staash.web.tests; import java.io.BufferedInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.Arrays; import org.junit.Assert; import org.junit.Before; import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import com.netflix.astyanax.AstyanaxContext; import com.netflix.astyanax.Keyspace; import com.netflix.astyanax.connectionpool.NodeDiscoveryType; import com.netflix.astyanax.connectionpool.impl.ConnectionPoolConfigurationImpl; import com.netflix.astyanax.connectionpool.impl.CountingConnectionPoolMonitor; import com.netflix.astyanax.impl.AstyanaxConfigurationImpl; import com.netflix.astyanax.recipes.storage.CassandraChunkedStorageProvider; import com.netflix.astyanax.recipes.storage.ChunkedStorage; import com.netflix.astyanax.recipes.storage.ChunkedStorageProvider; import com.netflix.astyanax.recipes.storage.ObjectMetadata; import com.netflix.astyanax.thrift.ThriftFamilyFactory; import com.netflix.staash.test.core.RequiresColumnFamily; import com.netflix.staash.test.core.RequiresKeyspace; import com.netflix.staash.test.core.CassandraRunner; @RunWith(CassandraRunner.class) @RequiresKeyspace(ksName = "myks") @RequiresColumnFamily(ksName = "myks", cfName = "chunks", comparator = "org.apache.cassandra.db.marshal.UTF8Type", keyValidator = "org.apache.cassandra.db.marshal.UTF8Type") @SuppressWarnings({ "rawtypes", "unchecked" }) public class TestChunking { Keyspace keyspace; private static final String KS = "myks"; private static final String CF = "chunks"; private static final String ENC1 = "SHA-1"; private static final String ENC2 = "MD5";// optional, less strength private static final String OBJASC = "testascii"; private static final String OBJBIN = "testbinary"; private static final String FILEASC = "chunktest.html"; private static final String FILEBIN = "test.exe"; @Before public void setup() { AstyanaxContext<Keyspace> context = new AstyanaxContext.Builder() .forCluster("Test Cluster") .forKeyspace(KS) .withAstyanaxConfiguration( new AstyanaxConfigurationImpl() .setDiscoveryType(NodeDiscoveryType.RING_DESCRIBE)) .withConnectionPoolConfiguration( new ConnectionPoolConfigurationImpl("MyConnectionPool") .setPort(9160).setMaxConnsPerHost(1) .setSeeds("127.0.0.1:9160")) .withConnectionPoolMonitor(new CountingConnectionPoolMonitor()) .buildKeyspace(ThriftFamilyFactory.getInstance()); context.start(); keyspace = context.getClient(); } @Test @Ignore public void chunktestbinary() throws IOException { ChunkedStorageProvider provider = new CassandraChunkedStorageProvider( keyspace, CF); InputStream fis = null; InputStream bis = null; try { fis = this.getClass().getClassLoader().getResource(FILEBIN) .openStream(); ObjectMetadata meta = ChunkedStorage .newWriter(provider, OBJBIN, fis).withChunkSize(0x1000) .withConcurrencyLevel(8).withTtl(60) // Optional TTL for the // entire object .call(); Long writesize = meta.getObjectSize(); // Long readsize = readChunked("myks","chunks","test1"); byte[] written = new byte[writesize.intValue()]; bis = this.getClass().getClassLoader().getResource(FILEBIN).openStream(); int i1 = ((BufferedInputStream)bis).read(written, 0, writesize.intValue()); System.out.println("length read = "+i1); byte[] read = readChunked(KS, CF, OBJBIN); boolean cmp = compareMD5(written, read); Assert.assertTrue(cmp == true); Thread.sleep(1000); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); Assert.fail(e.getMessage()); } finally { if (fis != null) fis.close(); if (bis!=null) bis.close(); } } @Test public void chunktestascii() throws IOException { ChunkedStorageProvider provider = new CassandraChunkedStorageProvider( keyspace, CF); InputStream fis = null; InputStream bis = null; try { fis = this.getClass().getClassLoader().getResource(FILEASC) .openStream(); ObjectMetadata meta = ChunkedStorage .newWriter(provider, OBJASC, fis).withChunkSize(0x1000) .withConcurrencyLevel(8).withTtl(60) // Optional TTL for the // entire object .call(); Long writesize = meta.getObjectSize(); // Long readsize = readChunked("myks","chunks","test1"); byte[] written = new byte[writesize.intValue()]; bis = this.getClass().getClassLoader().getResource("chunktest.html").openStream(); int i1 = ((BufferedInputStream)bis).read(written, 0, writesize.intValue()); System.out.println("length read = "+i1); byte[] read = readChunked(KS, CF, OBJASC); boolean cmp = compareMD5(written, read); Assert.assertTrue(cmp == true); Thread.sleep(1000); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); Assert.fail(e.getMessage()); } finally { if (fis != null) fis.close(); if (bis!=null) bis.close(); } } public boolean compareMD5(byte[] written, byte[] read) { try { MessageDigest md = MessageDigest.getInstance(ENC1); byte[] wdigest = md.digest(written); byte[] rdigest = md.digest(read); return Arrays.equals(wdigest, rdigest); } catch (NoSuchAlgorithmException e) { // TODO Auto-generated catch block throw new RuntimeException(e.getCause()); } } public byte[] readChunked(String db, String table, String objName) throws Exception { ChunkedStorageProvider provider = new CassandraChunkedStorageProvider( keyspace, table); ObjectMetadata meta = ChunkedStorage.newInfoReader(provider, objName) .call(); ByteArrayOutputStream os = new ByteArrayOutputStream(meta .getObjectSize().intValue()); meta = ChunkedStorage.newReader(provider, objName, os) .withBatchSize(10).call(); return (os != null) ? os.toByteArray() : new byte[0]; } } <|start_filename|>staash-svc/src/main/java/com/netflix/staash/rest/resources/StaashDataResourceImpl.java<|end_filename|> /******************************************************************************* * /* * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * * * ******************************************************************************/ package com.netflix.staash.rest.resources; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.UUID; import javax.ws.rs.Consumes; import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import com.google.common.io.Files; import com.google.inject.Inject; import com.netflix.staash.json.JsonArray; import com.netflix.staash.json.JsonObject; import com.netflix.staash.rest.util.StaashConstants; import com.netflix.staash.rest.util.StaashRequestContext; import com.netflix.staash.service.DataService; import com.sun.jersey.core.header.FormDataContentDisposition; import com.sun.jersey.multipart.FormDataParam; import com.sun.jersey.spi.container.ResourceFilters; @Path("/staash/v1/data") public class StaashDataResourceImpl { private DataService datasvc; @Inject public StaashDataResourceImpl(DataService data) { this.datasvc = data; } @GET @Path("{db}/{table}") @Produces(MediaType.APPLICATION_JSON) @ResourceFilters(StaashAuditFilter.class) public String listAllRow(@PathParam("db") String db, @PathParam("table") String table) { return datasvc.listRow(db, table, "", ""); } @GET @Path("{db}/{table}/{keycol}/{key}") @Produces(MediaType.APPLICATION_JSON) @ResourceFilters(StaashAuditFilter.class) public String listRow(@PathParam("db") String db, @PathParam("table") String table, @PathParam("keycol") String keycol, @PathParam("key") String key) { return datasvc.listRow(db, table, keycol, key); } @GET @Path("/join/{db}/{table1}/{table2}/{joincol}/{value}") @Produces(MediaType.APPLICATION_JSON) @ResourceFilters(StaashAuditFilter.class) public String doJoin(@PathParam("db") String db, @PathParam("table1") String table1, @PathParam("table2") String table2, @PathParam("joincol") String joincol, @PathParam("value") String value) { return datasvc.doJoin(db, table1, table2, joincol, value); } @GET @Path("/timeseries/{db}/{table}/{eventtime}") @Produces(MediaType.APPLICATION_JSON) @ResourceFilters(StaashAuditFilter.class) public String readEvent(@PathParam("db") String db, @PathParam("table") String table, @PathParam("eventtime") String time) { String out; try { out = datasvc.readEvent(db, table, time); } catch (RuntimeException e) { out = "{\"msg\":\"" + e.getMessage() + "\"}"; } return out; } @GET @Path("/timeseries/{db}/{table}/{prefix}/{eventtime}") @Produces(MediaType.APPLICATION_JSON) @ResourceFilters(StaashAuditFilter.class) public String readEvent(@PathParam("db") String db, @PathParam("table") String table, @PathParam("prefix") String prefix, @PathParam("eventtime") String time) { String out; try { out = datasvc.readEvent(db, table, prefix, time); } catch (RuntimeException e) { out = "{\"msg\":\"" + e.getMessage() + "\"}"; } return out; } @GET @Path("/timeseries/{db}/{table}/{prefix}/{starttime}/{endtime}") @Produces(MediaType.APPLICATION_JSON) @ResourceFilters(StaashAuditFilter.class) public String readEvent(@PathParam("db") String db, @PathParam("table") String table, @PathParam("prefix") String prefix, @PathParam("starttime") String starttime, @PathParam("endtime") String endtime) { String out; try { out = datasvc.readEvent(db, table, prefix, starttime, endtime); } catch (RuntimeException e) { out = "{\"msg\":\"" + e.getMessage() + "\"}"; } return out; } @POST @Path("{db}/{table}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @ResourceFilters(StaashAuditFilter.class) public String updateRow(@PathParam("db") String db, @PathParam("table") String table, String rowObject) { return datasvc.writeRow(db, table, new JsonObject(rowObject)); } @POST @Path("/timeseries/{db}/{table}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @ResourceFilters(StaashAuditFilter.class) public String insertEvent(@PathParam("db") String db, @PathParam("table") String table, String rowStr) { JsonArray eventsArr = new JsonArray(rowStr); return datasvc.writeEvents(db, table, eventsArr); } @GET @Path("/kvstore/{key}") @Produces(MediaType.APPLICATION_OCTET_STREAM) @ResourceFilters(StaashAuditFilter.class) public byte[] getObject(@PathParam("key") String key) { byte[] value = datasvc.readChunked("kvstore", "kvmap", key); StaashRequestContext.addContext("N-BYTES", String.valueOf(value.length)); return value; } @POST @Path("/kvstore") @Consumes(MediaType.MULTIPART_FORM_DATA) @Produces(MediaType.APPLICATION_JSON) @ResourceFilters(StaashAuditFilter.class) public String storeFile( @FormDataParam("value") InputStream uploadedInputStream, @FormDataParam("value") FormDataContentDisposition fileDetail) { try { writeToChunkedKVStore(uploadedInputStream, fileDetail.getFileName()); } catch (IOException e) { e.printStackTrace(); return "{\"msg\":\"file could not be uploaded\"}"; } return "{\"msg\":\"file successfully uploaded\"}"; } @POST @Path("/kvstore/name/{name}") @Consumes(MediaType.MULTIPART_FORM_DATA) @Produces(MediaType.APPLICATION_JSON) @ResourceFilters(StaashAuditFilter.class) public String storeNamedFile( @FormDataParam("value") InputStream uploadedInputStream, @PathParam("name") String name) { try { writeToChunkedKVStore(uploadedInputStream, name); } catch (IOException e) { e.printStackTrace(); return "{\"msg\":\"file could not be uploaded\"}"; } return "{\"msg\":\"file successfully uploaded\"}"; } private void writeToChunkedKVStore(InputStream is, String objectName) throws IOException { InputStream input = null; File tmpFile = null; try { String uploadedFileLocation = "/tmp/" + "staashFile-" + UUID.randomUUID(); tmpFile = new File(uploadedFileLocation); OutputStream out = new FileOutputStream(tmpFile); int read = 0; byte[] bytes = new byte[1024]; out = new FileOutputStream(new File(uploadedFileLocation)); while ((read = is.read(bytes)) != -1) { out.write(bytes, 0, read); } out.flush(); out.close(); byte[] fbytes = Files.toByteArray(new File(uploadedFileLocation)); StaashRequestContext.addContext("N-BYTES", String.valueOf(fbytes.length)); if (fbytes!=null && fbytes.length>StaashConstants.MAX_FILE_UPLOAD_SIZE_IN_KB*1000) { throw new RuntimeException("File is too large to upload, max size supported is 2MB"); } input = new FileInputStream(new File(uploadedFileLocation)); datasvc.writeChunked("kvstore", "kvmap", objectName, input); } catch (IOException e) { throw new RuntimeException(e.getMessage()); } finally { if (input!=null) input.close(); if (tmpFile!=null) { tmpFile.delete(); } } } // // private void writeToKVStore(InputStream uploadedInputStream, // String uploadedFileName) { // // try { // String uploadedFileLocation = "/tmp/" + uploadedFileName; // OutputStream out = new FileOutputStream(new File( // uploadedFileLocation)); // int read = 0; // byte[] bytes = new byte[1024]; // // out = new FileOutputStream(new File(uploadedFileLocation)); // while ((read = uploadedInputStream.read(bytes)) != -1) { // out.write(bytes, 0, read); // } // out.flush(); // out.close(); // byte[] fbytes = Files.toByteArray(new File(uploadedFileLocation)); // if (fbytes!=null && fbytes.length>StaashConstants.MAX_FILE_UPLOAD_SIZE_IN_KB*1000) { // throw new RuntimeException("File is too large to upload, max size supported is 2MB"); // } // JsonObject obj = new JsonObject(); // obj.putString("key", uploadedFileName); // obj.putBinary("value", fbytes); // datasvc.writeToKVStore("kvstore", "kvmapnochunks", obj); // // } catch (IOException e) { // throw new RuntimeException(e.getMessage()); // } // } } <|start_filename|>staash-core/src/main/java/com/netflix/paas/data/SchemaRows.java<|end_filename|> /******************************************************************************* * /*** * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * ******************************************************************************/ package com.netflix.paas.data; import java.util.List; /** * Collection of rows using arrays to represent the data. All rows must * have the same number of columns. * * @author elandau */ public class SchemaRows { /** * Names of the columns */ private List<String> names; /** * Data types for columns (ex. int, vchar, ...) */ private List<String> types; /** * Data rows as a list of column values. Index of column position must match * index position in 'names' and 'types' */ private List<List<String>> rows; public List<String> getNames() { return names; } public void setNames(List<String> names) { this.names = names; } public List<String> getTypes() { return types; } public void setTypes(List<String> types) { this.types = types; } public List<List<String>> getRows() { return rows; } public void setRows(List<List<String>> rows) { this.rows = rows; } @Override public String toString() { return "SchemaRows [names=" + names + ", types=" + types + ", rows=" + rows + "]"; } } <|start_filename|>staash-astyanax/src/test/java/com/netflix/paas/cassandra/provider/SingletonEmbeddedCassandra.java<|end_filename|> /******************************************************************************* * /*** * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * ******************************************************************************/ package com.netflix.paas.cassandra.provider; import com.netflix.astyanax.test.EmbeddedCassandra; public class SingletonEmbeddedCassandra { private final EmbeddedCassandra cassandra; private static class Holder { private final static SingletonEmbeddedCassandra instance = new SingletonEmbeddedCassandra(); } public static SingletonEmbeddedCassandra getInstance() { return Holder.instance; } public SingletonEmbeddedCassandra() { try { cassandra = new EmbeddedCassandra(); cassandra.start(); } catch (Exception e) { throw new RuntimeException("Failed to start embedded cassandra", e); } } public void finalize() { try { cassandra.stop(); } catch (Exception e) { } } } <|start_filename|>staash-core/src/main/java/com/netflix/paas/dao/Dao.java<|end_filename|> /******************************************************************************* * /*** * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * ******************************************************************************/ package com.netflix.paas.dao; import java.util.Collection; import javax.persistence.PersistenceException; /** * Generic DAO interface * @author elandau * * @param <T> */ public interface Dao<T> extends DaoStatus { /** * Read a single entity by key * * @param key * @return */ public T read(String key) throws PersistenceException; /** * Read entities for a set of keys * @param keys * @return * @throws PersistenceException */ public Collection<T> read(Collection<String> keys) throws PersistenceException; /** * Write a single entity * @param entity */ public void write(T entity) throws PersistenceException; /** * List all entities * * @return * * @todo */ public Collection<T> list() throws PersistenceException; /** * List all ids without necessarily retrieving all the entities * @return * @throws PersistenceException */ public Collection<String> listIds() throws PersistenceException; /** * Delete a row by key * @param key */ public void delete(String key) throws PersistenceException; /** * Create the underlying storage for this dao * @throws PersistenceException */ public void createTable() throws PersistenceException; /** * Delete the storage for this dao * @throws PersistenceException */ public void deleteTable() throws PersistenceException; /** * Cleanup resources used by this dao as part of the shutdown process */ public void shutdown(); } <|start_filename|>staash-astyanax/src/main/java/com/netflix/paas/dao/astyanax/AstyanaxDaoSchemaProvider.java<|end_filename|> /******************************************************************************* * /*** * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * ******************************************************************************/ package com.netflix.paas.dao.astyanax; import java.util.Collection; import java.util.IdentityHashMap; import java.util.Map; import java.util.Properties; import javax.annotation.PostConstruct; import javax.annotation.PreDestroy; import org.apache.commons.configuration.AbstractConfiguration; import org.apache.commons.configuration.Configuration; import org.apache.commons.configuration.ConfigurationConverter; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.google.inject.Inject; import com.netflix.astyanax.Keyspace; import com.netflix.astyanax.connectionpool.exceptions.BadRequestException; import com.netflix.astyanax.connectionpool.exceptions.ConnectionException; import com.netflix.paas.cassandra.provider.KeyspaceClientProvider; import com.netflix.paas.dao.Dao; import com.netflix.paas.dao.DaoSchemaProvider; import com.netflix.paas.dao.DaoSchema; import com.netflix.paas.exceptions.NotFoundException; /** * Astyanax based Dao factory for persisting PAAS state * * @author elandau * */ public class AstyanaxDaoSchemaProvider implements DaoSchemaProvider { private final Logger LOG = LoggerFactory.getLogger(AstyanaxDaoSchemaProvider.class); private final static String CONFIG_PREFIX_FORMAT = "com.netflix.paas.schema.%s"; private final KeyspaceClientProvider keyspaceProvider; private final Map<String, DaoSchema> schemas = Maps.newHashMap(); private final AbstractConfiguration configuration; public class AstyanaxDaoSchema implements DaoSchema { private final IdentityHashMap<Class<?>, Dao<?>> daos = Maps.newIdentityHashMap(); private final Keyspace keyspace; private final String schemaName; public AstyanaxDaoSchema(String schemaName, Keyspace keyspace) { this.keyspace = keyspace; this.schemaName = schemaName; Configuration config = configuration.subset(String.format(CONFIG_PREFIX_FORMAT, schemaName.toLowerCase())); if (config.getBoolean("autocreate", false)) { try { createSchema(); } catch (Exception e) { LOG.error("Error creating column keyspace", e); } } } @Override public synchronized void createSchema() { final Properties props = ConfigurationConverter.getProperties(configuration.subset(String.format(CONFIG_PREFIX_FORMAT, schemaName.toLowerCase()))); try { props.setProperty("name", props.getProperty("keyspace")); LOG.info("Creating schema: " + schemaName + " " + props); this.keyspace.createKeyspace(props); } catch (ConnectionException e) { LOG.error("Failed to create schema '{}' with properties '{}'", new Object[]{schemaName, props.toString(), e}); throw new RuntimeException("Failed to create keyspace " + keyspace.getKeyspaceName(), e); } } @Override public synchronized void dropSchema() { try { this.keyspace.dropKeyspace(); } catch (ConnectionException e) { throw new RuntimeException("Failed to drop keyspace " + keyspace.getKeyspaceName(), e); } } @Override public synchronized Collection<Dao<?>> listDaos() { return Lists.newArrayList(daos.values()); } @Override public boolean isExists() { try { this.keyspace.describeKeyspace(); return true; } catch (BadRequestException e) { return false; } catch (Exception e) { throw new RuntimeException("Failed to determine if keyspace " + keyspace.getKeyspaceName() + " exists", e); } } @Override public synchronized <T> Dao<T> getDao(Class<T> type) { Dao<?> dao = daos.get(type); if (dao == null) { dao = new AstyanaxDao<T>(keyspace, type); daos.put(type, dao); } return (Dao<T>) dao; } } @Inject public AstyanaxDaoSchemaProvider(KeyspaceClientProvider keyspaceProvider, AbstractConfiguration configuration) { this.keyspaceProvider = keyspaceProvider; this.configuration = configuration; } @PostConstruct public void start() { } @PreDestroy public void stop() { } @Override public synchronized Collection<DaoSchema> listSchemas() { return Lists.newArrayList(schemas.values()); } @Override public synchronized DaoSchema getSchema(String schemaName) throws NotFoundException { AstyanaxDaoSchema schema = (AstyanaxDaoSchema)schemas.get(schemaName); if (schema == null) { LOG.info("Creating schema '{}'", new Object[]{schemaName}); Keyspace keyspace = keyspaceProvider.acquireKeyspace(schemaName); schema = new AstyanaxDaoSchema(schemaName, keyspace); schemas.put(schemaName, schema); } return schema; } } <|start_filename|>staash-astyanax/src/main/java/com/netflix/paas/cassandra/tasks/ClusterDiscoveryTask.java<|end_filename|> /******************************************************************************* * /*** * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * ******************************************************************************/ package com.netflix.paas.cassandra.tasks; import java.util.Collection; import java.util.Map; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.google.common.base.Function; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Maps; import com.google.common.collect.Sets; import com.google.inject.Inject; import com.netflix.paas.SchemaNames; import com.netflix.paas.cassandra.discovery.ClusterDiscoveryService; import com.netflix.paas.cassandra.entity.CassandraClusterEntity; import com.netflix.paas.dao.Dao; import com.netflix.paas.dao.DaoProvider; import com.netflix.paas.exceptions.NotFoundException; import com.netflix.paas.tasks.Task; import com.netflix.paas.tasks.TaskContext; import com.netflix.paas.tasks.TaskManager; /** * Task to compare the list of clusters in the Dao and the list of clusters from the discovery * service and add/remove/update in response to any changes. * * @author elandau * */ public class ClusterDiscoveryTask implements Task { private static final Logger LOG = LoggerFactory.getLogger(ClusterDiscoveryTask.class); private final ClusterDiscoveryService discoveryService; private final Dao<CassandraClusterEntity> clusterDao; private final TaskManager taskManager; @Inject public ClusterDiscoveryTask( ClusterDiscoveryService discoveryService, DaoProvider daoProvider, TaskManager taskManager) throws NotFoundException{ this.discoveryService = discoveryService; this.clusterDao = daoProvider.getDao(SchemaNames.CONFIGURATION.name(), CassandraClusterEntity.class); this.taskManager = taskManager; } @Override public void execte(TaskContext context) throws Exception { // Get complete set of existing clusters from the discovery service Collection<String> clusters = Sets.newHashSet(discoveryService.getClusterNames()); LOG.info(clusters.toString()); // Load entire list of previously known clusters to a map of <ClusterName> => <ClusterEntity> Map<String, CassandraClusterEntity> existingClusters = Maps.uniqueIndex( this.clusterDao.list(), new Function<CassandraClusterEntity, String>() { @Override public String apply(CassandraClusterEntity cluster) { LOG.info("Found existing cluster : " + cluster.getClusterName()); return cluster.getClusterName(); } }); // Iterate through new list of clusters and look for changes for (String clusterName : clusters) { CassandraClusterEntity entity = existingClusters.get(clusterName); // This is a new cluster if (entity == null) { LOG.info("Found new cluster : " + clusterName); entity = CassandraClusterEntity.builder() .withName(clusterName) .withIsEnabled(true) .withDiscoveryType(discoveryService.getName()) .build(); try { clusterDao.write(entity); } catch (Exception e) { LOG.warn("Failed to persist cluster info for '{}'", new Object[]{clusterName, e}); } updateCluster(entity); } // We knew about it before and it is disabled else if (!entity.isEnabled()) { LOG.info("Cluster '{}' is disabled and will not be refreshed", new Object[]{clusterName}); } // Refresh the info for an existing cluster else { LOG.info("Cluster '{}' is being refreshed", new Object[]{clusterName}); if (entity.getDiscoveryType() == null) { entity.setDiscoveryType(discoveryService.getName()); try { clusterDao.write(entity); } catch (Exception e) { LOG.warn("Failed to persist cluster info for '{}'", new Object[]{clusterName, e}); } } updateCluster(entity); } } } private void updateCluster(CassandraClusterEntity entity) { LOG.info("Need to update cluster " + entity.getClusterName()); try { taskManager.submit(ClusterRefreshTask.class, ImmutableMap.<String, Object>builder() .put("entity", entity) .build()); } catch (Exception e) { LOG.warn("Failed to create ClusterRefreshTask for " + entity.getClusterName(), e); } } } <|start_filename|>staash-svc/src/main/java/com/netflix/staash/common/query/QueryException.java<|end_filename|> /******************************************************************************* * /* * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * * * ******************************************************************************/ package com.netflix.staash.common.query; public class QueryException extends Exception { private final int errorCode; private final String sqlState; public QueryException(final String message) { super(message); this.errorCode = -1; this.sqlState = "HY0000"; } public QueryException(final String message, final short errorCode, final String sqlState) { super(message); this.errorCode = errorCode; this.sqlState = sqlState; } public QueryException(final String message, final int errorCode, final String sqlState, final Throwable cause) { super(message, cause); this.errorCode = errorCode; this.sqlState = sqlState; } public final int getErrorCode() { return errorCode; } public final String getSqlState() { return sqlState; } } <|start_filename|>staash-core/src/main/java/com/netflix/paas/config/base/ConfigurationProxyUtils.java<|end_filename|> /******************************************************************************* * /*** * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * ******************************************************************************/ package com.netflix.paas.config.base; import java.lang.reflect.Method; import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; import java.util.Map; import org.apache.commons.lang.StringUtils; import com.google.common.base.Supplier; import com.google.common.base.Suppliers; import com.google.common.collect.Maps; import com.netflix.config.DynamicPropertyFactory; import com.netflix.config.PropertyWrapper; import com.netflix.governator.annotations.Configuration; import com.netflix.paas.config.annotations.DefaultValue; import com.netflix.paas.config.annotations.Dynamic; import java.lang.reflect.Field; import org.apache.commons.configuration.AbstractConfiguration; /** * Utility class used by ConfigurationProxyFactory implementations to proxy methods of a * configuration interface using information from the Configuration annotation * * @author elandau */ public class ConfigurationProxyUtils { public static class PropertyWrapperSupplier<T> implements Supplier<T> { private final PropertyWrapper<T> wrapper; public PropertyWrapperSupplier(PropertyWrapper<T> wrapper) { this.wrapper = wrapper; } @Override public T get() { return this.wrapper.getValue(); } } static Supplier<?> getDynamicSupplier(Class<?> type, String key, String defaultValue, DynamicPropertyFactory propertyFactory) { if (type.isAssignableFrom(String.class)) { return new PropertyWrapperSupplier<String>( propertyFactory.getStringProperty( key, defaultValue)); } else if (type.isAssignableFrom(Integer.class)) { return new PropertyWrapperSupplier<Integer>( propertyFactory.getIntProperty( key, defaultValue == null ? 0 : Integer.parseInt(defaultValue))); } else if (type.isAssignableFrom(Double.class)) { return new PropertyWrapperSupplier<Double>( propertyFactory.getDoubleProperty( key, defaultValue == null ? 0.0 : Double.parseDouble(defaultValue))); } else if (type.isAssignableFrom(Long.class)) { return new PropertyWrapperSupplier<Long>( propertyFactory.getLongProperty( key, defaultValue == null ? 0L : Long.parseLong(defaultValue))); } else if (type.isAssignableFrom(Boolean.class)) { return new PropertyWrapperSupplier<Boolean>( propertyFactory.getBooleanProperty( key, defaultValue == null ? false : Boolean.parseBoolean(defaultValue))); } throw new RuntimeException("Unsupported value type " + type.getCanonicalName()); } static Supplier<?> getStaticSupplier(Class<?> type, String key, String defaultValue, AbstractConfiguration configuration) { if (type.isAssignableFrom(String.class)) { return Suppliers.ofInstance( configuration.getString( key, defaultValue)); } else if (type.isAssignableFrom(Integer.class)) { return Suppliers.ofInstance( configuration.getInteger( key, defaultValue == null ? 0 : Integer.parseInt(defaultValue))); } else if (type.isAssignableFrom(Double.class)) { return Suppliers.ofInstance( configuration.getDouble( key, defaultValue == null ? 0.0 : Double.parseDouble(defaultValue))); } else if (type.isAssignableFrom(Long.class)) { return Suppliers.ofInstance( configuration.getLong( key, defaultValue == null ? 0L : Long.parseLong(defaultValue))); } else if (type.isAssignableFrom(Boolean.class)) { return Suppliers.ofInstance( configuration.getBoolean( key, defaultValue == null ? false : Boolean.parseBoolean(defaultValue))); } throw new RuntimeException("Unsupported value type " + type.getCanonicalName()); } static String getPropertyName(Method method, Configuration c) { String name = c.value(); if (name.isEmpty()) { name = method.getName(); name = StringUtils.removeStart(name, "is"); name = StringUtils.removeStart(name, "get"); name = name.toLowerCase(); } return name; } static String getPropertyName(Field field, Configuration c) { String name = c.value(); if (name.isEmpty()) { return field.getName(); } return name; } static <T> Map<String, Supplier<?>> getMethodSuppliers(Class<T> configClass, DynamicPropertyFactory propertyFactory, AbstractConfiguration configuration) { final Map<String, Supplier<?>> properties = Maps.newHashMap(); for (Method method : configClass.getMethods()) { Configuration c = method.getAnnotation(Configuration.class); if (c == null) continue; String defaultValue = null; DefaultValue dv = method.getAnnotation(DefaultValue.class); if (dv != null) defaultValue = dv.value(); String name = getPropertyName(method, c); if (method.getReturnType().isAssignableFrom(Supplier.class)) { Type returnType = method.getGenericReturnType(); if(returnType instanceof ParameterizedType){ ParameterizedType type = (ParameterizedType) returnType; Class<?> actualType = (Class<?>)type.getActualTypeArguments()[0]; properties.put(method.getName(), method.getAnnotation(Dynamic.class) != null ? Suppliers.ofInstance(getDynamicSupplier(actualType, name, defaultValue, propertyFactory)) : Suppliers.ofInstance(getStaticSupplier(actualType, name, defaultValue, configuration))); } else { throw new RuntimeException("We'll get to this later"); } } else { properties.put(method.getName(), method.getAnnotation(Dynamic.class) != null ? getDynamicSupplier(method.getReturnType(), name, defaultValue, propertyFactory) : getStaticSupplier (method.getReturnType(), name, defaultValue, configuration)); } } return properties; } static void assignFieldValues(final Object obj, Class<?> type, DynamicPropertyFactory propertyFactory, AbstractConfiguration configuration) throws Exception { // Iterate through all fields and set initial value as well as set up dynamic properties // where necessary for (final Field field : type.getFields()) { Configuration c = field.getAnnotation(Configuration.class); if (c == null) continue; String defaultValue = field.get(obj).toString(); String name = ConfigurationProxyUtils.getPropertyName(field, c); Supplier<?> supplier = ConfigurationProxyUtils.getStaticSupplier(field.getType(), name, defaultValue, configuration); field.set(obj, supplier.get()); if (field.getAnnotation(Dynamic.class) != null) { final PropertyWrapper<?> property; if (field.getType().isAssignableFrom(String.class)) { property = propertyFactory.getStringProperty( name, defaultValue); } else if (field.getType().isAssignableFrom(Integer.class)) { property = propertyFactory.getIntProperty( name, defaultValue == null ? 0 : Integer.parseInt(defaultValue)); } else if (field.getType().isAssignableFrom(Double.class)) { property = propertyFactory.getDoubleProperty( name, defaultValue == null ? 0.0 : Double.parseDouble(defaultValue)); } else if (field.getType().isAssignableFrom(Long.class)) { property = propertyFactory.getLongProperty( name, defaultValue == null ? 0L : Long.parseLong(defaultValue)); } else if (field.getType().isAssignableFrom(Boolean.class)) { property = propertyFactory.getBooleanProperty( name, defaultValue == null ? false : Boolean.parseBoolean(defaultValue)); } else { throw new RuntimeException("Unsupported type " + field.getType()); } property.addCallback(new Runnable() { @Override public void run() { try { field.set(obj, property.getValue()); } catch (Exception e) { e.printStackTrace(); } } }); } } } } <|start_filename|>staash-astyanax/src/main/java/com/netflix/paas/cassandra/MetaModule.java<|end_filename|> /******************************************************************************* * /*** * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * ******************************************************************************/ package com.netflix.paas.cassandra; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.datastax.driver.core.Cluster; import com.google.inject.AbstractModule; import com.google.inject.Provides; import com.google.inject.name.Named; import com.netflix.paas.PaasModule; import com.netflix.paas.dao.astyanax.MetaDaoImpl; import com.netflix.paas.dao.meta.CqlMetaDaoImpl; import com.netflix.paas.meta.dao.MetaDao; public class MetaModule extends AbstractModule{ private static final Logger LOG = LoggerFactory.getLogger(MetaModule.class); @Override protected void configure() { // TODO Auto-generated method stub // bind(MetaDao.class).to(MetaDaoImpl.class).asEagerSingleton(); bind(MetaDao.class).to(CqlMetaDaoImpl.class).asEagerSingleton(); } @Provides Cluster provideCluster(@Named("clustername") String clustername) { //String nodes = eureka.getNodes(clustername); //get nodes in the cluster, to pass as parameters to the underlying apis Cluster cluster = Cluster.builder().addContactPoint("localhost").build(); return cluster; } } <|start_filename|>staash-mesh/src/main/java/com/netflix/staash/mesh/db/memory/EntryHolder.java<|end_filename|> /******************************************************************************* * /*** * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * ******************************************************************************/ package com.netflix.staash.mesh.db.memory; import com.netflix.staash.mesh.db.Entry; public class EntryHolder { private Entry tuple; public EntryHolder(Entry tuple) { this.tuple = tuple; } public synchronized boolean delete(long timestamp) { if (timestamp > tuple.getTimestamp()) { this.tuple = new Entry(tuple.getKey(), null, timestamp); return true; } return false; } public synchronized boolean set(Entry tuple) { if (tuple.getTimestamp() > this.tuple.getTimestamp()) { this.tuple = tuple; return true; } return false; } public synchronized boolean isDeleted() { return this.tuple.getValue() == null; } public synchronized Entry getEntry() { return tuple; } } <|start_filename|>staash-astyanax/src/main/java/com/netflix/paas/cassandra/resources/CassandraClusterHolder.java<|end_filename|> /******************************************************************************* * /*** * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * ******************************************************************************/ package com.netflix.paas.cassandra.resources; import java.util.concurrent.ConcurrentMap; import com.google.common.base.Preconditions; import com.google.common.collect.Maps; import com.netflix.astyanax.AstyanaxContext; import com.netflix.astyanax.connectionpool.NodeDiscoveryType; import com.netflix.astyanax.connectionpool.impl.ConnectionPoolConfigurationImpl; import com.netflix.astyanax.connectionpool.impl.ConnectionPoolType; import com.netflix.astyanax.connectionpool.impl.Slf4jConnectionPoolMonitorImpl; import com.netflix.astyanax.impl.AstyanaxConfigurationImpl; import com.netflix.astyanax.thrift.ThriftFamilyFactory; import com.netflix.paas.exceptions.AlreadyExistsException; import com.netflix.paas.exceptions.NotFoundException; /** * Tracks accessible keyspaces for this cluster * * @author elandau */ public class CassandraClusterHolder { private final String clusterName; private final ConcurrentMap<String, CassandraKeyspaceHolder> keyspaces = Maps.newConcurrentMap(); public CassandraClusterHolder(String clusterName) { this.clusterName = clusterName; } /** * Register a keyspace such that a client is created for it and it is now accessible to * this instance * * @param keyspaceName * @throws AlreadyExistsException */ public synchronized void registerKeyspace(String keyspaceName) throws AlreadyExistsException { Preconditions.checkNotNull(keyspaceName); if (keyspaces.containsKey(keyspaceName)) { throw new AlreadyExistsException("keyspace", keyspaceName); } CassandraKeyspaceHolder keyspace = new CassandraKeyspaceHolder(new AstyanaxContext.Builder() .forCluster(clusterName) .forKeyspace(keyspaceName) .withAstyanaxConfiguration( new AstyanaxConfigurationImpl() .setDiscoveryType(NodeDiscoveryType.RING_DESCRIBE) .setConnectionPoolType(ConnectionPoolType.ROUND_ROBIN) .setDiscoveryDelayInSeconds(60000)) .withConnectionPoolConfiguration( new ConnectionPoolConfigurationImpl( clusterName + "_" + keyspaceName) .setSeeds("localhost:9160")) .withConnectionPoolMonitor(new Slf4jConnectionPoolMonitorImpl()) .buildKeyspace(ThriftFamilyFactory.getInstance())); try { keyspace.initialize(); } finally { keyspaces.put(keyspaceName, keyspace); } } /** * Unregister a keyspace so that it is no longer accessible to this instance * @param keyspaceName */ public void unregisterKeyspace(String keyspaceName) { Preconditions.checkNotNull(keyspaceName); CassandraKeyspaceHolder keyspace = keyspaces.remove(keyspaceName); if (keyspace != null) { keyspace.shutdown(); } } /** * Get the Keyspace holder for the specified keyspace name * * @param keyspaceName * @return * @throws NotFoundException */ public CassandraKeyspaceHolder getKeyspace(String keyspaceName) throws NotFoundException { Preconditions.checkNotNull(keyspaceName); CassandraKeyspaceHolder keyspace = keyspaces.get(keyspaceName); if (keyspace == null) throw new NotFoundException("keyspace", keyspaceName); return keyspace; } public String getClusterName() { return this.clusterName; } public void shutdown() { // TODO } public void initialize() { // TODO } } <|start_filename|>staash-astyanax/src/main/java/com/netflix/paas/cassandra/keys/ColumnFamilyKey.java<|end_filename|> /******************************************************************************* * /*** * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * ******************************************************************************/ package com.netflix.paas.cassandra.keys; import org.apache.commons.lang.StringUtils; public class ColumnFamilyKey { private final KeyspaceKey keyspaceKey; private final String columnFamilyName; public ColumnFamilyKey(KeyspaceKey keyspaceKey, String columnFamilyName) { super(); this.keyspaceKey = keyspaceKey; this.columnFamilyName = columnFamilyName; } public ColumnFamilyKey(ClusterKey clusterKey, String keyspaceName, String columnFamilyName) { this.keyspaceKey = new KeyspaceKey(clusterKey, keyspaceName); this.columnFamilyName = columnFamilyName; } public KeyspaceKey getKeyspaceKey() { return keyspaceKey; } public String getColumnFamilyName() { return columnFamilyName; } public String getCanonicalName() { return StringUtils.join(new String[]{keyspaceKey.getCanonicalName(), columnFamilyName}, "."); } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((columnFamilyName == null) ? 0 : columnFamilyName.hashCode()); result = prime * result + ((keyspaceKey == null) ? 0 : keyspaceKey.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; ColumnFamilyKey other = (ColumnFamilyKey) obj; if (columnFamilyName == null) { if (other.columnFamilyName != null) return false; } else if (!columnFamilyName.equals(other.columnFamilyName)) return false; if (keyspaceKey == null) { if (other.keyspaceKey != null) return false; } else if (!keyspaceKey.equals(other.keyspaceKey)) return false; return true; } } <|start_filename|>staash-core/src/main/java/com/netflix/paas/meta/impl/MetaConstants.java<|end_filename|> /******************************************************************************* * /*** * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * ******************************************************************************/ package com.netflix.paas.meta.impl; public interface MetaConstants { public static final String CASSANDRA_KEYSPACE_ENTITY_TYPE = "com.test.entity.type.cassandra.keyspace"; public static final String PAAS_TABLE_ENTITY_TYPE = "com.test.entity.type.paas.table"; public static final String PAAS_DB_ENTITY_TYPE = "com.test.entity.type.paas.db"; public static final String CASSANDRA_CF_TYPE = "com.test.entity.type.cassandra.columnfamily"; public static final String CASSANDRA_TIMESERIES_TYPE = "com.test.entity.type.cassandra.timeseries"; public static final String PAAS_CLUSTER_ENTITY_TYPE = "com.test.entity.type.paas.table"; public static final String STORAGE_TYPE = "com.test.trait.type.storagetype"; public static final String RESOLUTION_TYPE = "com.test.trait.type.resolutionstring"; public static final String NAME_TYPE = "com.test.trait.type.name"; public static final String RF_TYPE = "com.test.trait.type.replicationfactor"; public static final String STRATEGY_TYPE = "com.test.trait.type.strategy"; public static final String COMPARATOR_TYPE = "com.test.trait.type.comparator"; public static final String KEY_VALIDATION_CLASS_TYPE = "com.test.trait.type.key_validation_class"; public static final String COLUMN_VALIDATION_CLASS_TYPE = "com.test.trait.type.validation_class"; public static final String DEFAULT_VALIDATION_CLASS_TYPE = "com.test.trait.type.default_validation_class"; public static final String COLUMN_NAME_TYPE = "com.test.trait.type.colum_name"; public static final String CONTAINS_TYPE = "com.test.relation.type.contains"; } <|start_filename|>staash-svc/src/main/java/com/netflix/staash/json/JsonArray.java<|end_filename|> /* * Copyright 2011-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.staash.json; import java.util.*; import com.netflix.staash.json.impl.Base64; import com.netflix.staash.json.impl.Json; import java.lang.Iterable; /** * Represents a JSON array * * @author <a href="http://tfox.org"><NAME></a> */ public class JsonArray extends JsonElement implements Iterable<Object> { final List<Object> list; public JsonArray(List<Object> array) { this.list = array; } public JsonArray(Object[] array) { this.list = Arrays.asList(array); } public JsonArray() { this.list = new ArrayList<Object>(); } public JsonArray(String jsonString) { list = Json.decodeValue(jsonString, List.class); } public JsonArray addString(String str) { list.add(str); return this; } public JsonArray addObject(JsonObject value) { list.add(value.map); return this; } public JsonArray addArray(JsonArray value) { list.add(value.list); return this; } public JsonArray addElement(JsonElement value) { if (value.isArray()) { return addArray(value.asArray()); } return addObject(value.asObject()); } public JsonArray addNumber(Number value) { list.add(value); return this; } public JsonArray addBoolean(Boolean value) { list.add(value); return this; } public JsonArray addBinary(byte[] value) { String encoded = Base64.encodeBytes(value); list.add(encoded); return this; } public JsonArray add(Object obj) { if (obj instanceof JsonObject) { obj = ((JsonObject) obj).map; } else if (obj instanceof JsonArray) { obj = ((JsonArray) obj).list; } list.add(obj); return this; } public int size() { return list.size(); } public <T> T get(final int index) { return convertObject(list.get(index)); } public Iterator<Object> iterator() { return new Iterator<Object>() { Iterator<Object> iter = list.iterator(); public boolean hasNext() { return iter.hasNext(); } public Object next() { return convertObject(iter.next()); } public void remove() { iter.remove(); } }; } public boolean contains(Object value) { return list.contains(value); } public String encode() throws EncodeException { return Json.encode(this.list); } public JsonArray copy() { return new JsonArray(encode()); } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; JsonArray that = (JsonArray) o; if (this.list.size() != that.list.size()) return false; Iterator<?> iter = that.list.iterator(); for (Object entry : this.list) { Object other = iter.next(); if (!entry.equals(other)) { return false; } } return true; } public Object[] toArray() { return convertList(list).toArray(); } @SuppressWarnings("unchecked") static List<Object> convertList(List<?> list) { List<Object> arr = new ArrayList<Object>(list.size()); for (Object obj : list) { if (obj instanceof Map) { arr.add(JsonObject.convertMap((Map<String, Object>) obj)); } else if (obj instanceof JsonObject) { arr.add(((JsonObject) obj).toMap()); } else if (obj instanceof List) { arr.add(convertList((List<?>) obj)); } else { arr.add(obj); } } return arr; } @SuppressWarnings("unchecked") private static <T> T convertObject(final Object obj) { Object retVal = obj; if (obj != null) { if (obj instanceof List) { retVal = new JsonArray((List<Object>) obj); } else if (obj instanceof Map) { retVal = new JsonObject((Map<String, Object>) obj); } } return (T)retVal; } } <|start_filename|>staash-mesh/src/main/java/com/netflix/staash/mesh/db/TopicRegistry.java<|end_filename|> /******************************************************************************* * /*** * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * ******************************************************************************/ package com.netflix.staash.mesh.db; import java.util.concurrent.ConcurrentMap; import com.google.common.collect.Maps; public class TopicRegistry { private ConcurrentMap<String, Topic> topics = Maps.newConcurrentMap(); private TopicFactory topicFactory; public TopicRegistry(TopicFactory topicFactory) { this.topicFactory = topicFactory; } public boolean createTopic(String topicName) { Topic topic = topicFactory.create(topicName); if (null == topics.putIfAbsent(topicName, topic)) { return true; } return false; } public boolean removeTopic(String topicName, long timestamp) { Topic topic = topics.get(topicName); if (topic != null) { return topic.deleteTopic(timestamp); } return false; } public boolean addEntry(String topicName, Entry tuple) { Topic topic = topics.get(topicName); if (topic != null) { return topic.upsert(tuple); } return false; } public Iterable<String> listTopics() { return topics.keySet(); } } <|start_filename|>staash-astyanax/src/main/java/com/netflix/paas/dao/astyanax/DaoKeys.java<|end_filename|> /******************************************************************************* * /*** * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * ******************************************************************************/ package com.netflix.paas.dao.astyanax; import com.netflix.paas.SchemaNames; import com.netflix.paas.cassandra.entity.CassandraClusterEntity; import com.netflix.paas.cassandra.entity.ColumnFamilyEntity; import com.netflix.paas.cassandra.entity.KeyspaceEntity; import com.netflix.paas.dao.DaoKey; import com.netflix.paas.entity.ClusterEntity; public class DaoKeys { public final static DaoKey<KeyspaceEntity> DAO_KEYSPACE_ENTITY = new DaoKey<KeyspaceEntity> (SchemaNames.CONFIGURATION.name(), KeyspaceEntity.class); public final static DaoKey<CassandraClusterEntity> DAO_CASSANDRA_CLUSTER_ENTITY = new DaoKey<CassandraClusterEntity>(SchemaNames.CONFIGURATION.name(), CassandraClusterEntity.class); public final static DaoKey<ColumnFamilyEntity> DAO_COLUMN_FAMILY_ENTITY = new DaoKey<ColumnFamilyEntity> (SchemaNames.CONFIGURATION.name(), ColumnFamilyEntity.class); } <|start_filename|>staash-svc/src/main/java/com/netflix/staash/service/PaasMetaService.java<|end_filename|> /******************************************************************************* * /* * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * * * ******************************************************************************/ package com.netflix.staash.service; import java.util.Map; import com.google.inject.Inject; import com.google.inject.name.Named; import com.netflix.staash.connection.ConnectionFactory; import com.netflix.staash.connection.PaasConnection; import com.netflix.staash.exception.StorageDoesNotExistException; import com.netflix.staash.json.JsonObject; import com.netflix.staash.rest.dao.MetaDao; import com.netflix.staash.rest.meta.entity.EntityType; import com.netflix.staash.rest.meta.entity.PaasDBEntity; import com.netflix.staash.rest.meta.entity.PaasStorageEntity; import com.netflix.staash.rest.meta.entity.PaasTableEntity; import com.netflix.staash.rest.meta.entity.PaasTimeseriesEntity; public class PaasMetaService implements MetaService { private MetaDao meta; private ConnectionFactory cfactory; private CacheService cache; @Inject public PaasMetaService(@Named("newmetadao") MetaDao meta, ConnectionFactory fac, CacheService cache) { this.meta = meta; // this.cfactory = new PaasConnectionFactory(CLIENTTYPE.ASTYANAX.getType()); this.cfactory = fac; // this.cache = new CacheService(meta); this.cache = cache; } public String writeMetaEntity(EntityType etype, String payload) throws StorageDoesNotExistException{ // TODO Auto-generated method stub if (payload != null) { switch (etype) { case STORAGE: PaasStorageEntity pse = PaasStorageEntity.builder() .withJsonPayLoad(new JsonObject(payload)).build(); String retsto = meta.writeMetaEntity(pse); cache.addEntityToCache(EntityType.STORAGE, pse); return retsto; case DB: PaasDBEntity pdbe = PaasDBEntity.builder() .withJsonPayLoad(new JsonObject(payload)).build(); String retdb = meta.writeMetaEntity(pdbe); cache.addEntityToCache(EntityType.DB, pdbe); return retdb; case TABLE: String schema = new JsonObject(payload).getString("db"); PaasTableEntity pte = PaasTableEntity.builder() .withJsonPayLoad(new JsonObject(payload), schema) .build(); createDBTable(pte.getPayLoad()); String rettbl = meta.writeMetaEntity(pte); cache.addEntityToCache(EntityType.TABLE, pte); return rettbl; case SERIES: String tsschema = new JsonObject(payload).getString("db"); PaasTimeseriesEntity ptse = PaasTimeseriesEntity.builder() .withJsonPayLoad(new JsonObject(payload), tsschema) .build(); createDBTable(ptse.getPayLoad()); String retseries = meta.writeMetaEntity(ptse); cache.addEntityToCache(EntityType.SERIES, ptse); return retseries; } } return null; } private void createDBTable(String payload ) throws StorageDoesNotExistException { // String payload = pte.getPayLoad(); JsonObject obj = new JsonObject(payload); String schema = obj.getString("db"); String storage = obj.getString("storage"); String index_row_keys = obj.getString("indexrowkeys"); Map<String, JsonObject> sMap = meta.runQuery( EntityType.STORAGE.getId(), storage); JsonObject storageConfig = sMap.get(storage); String strategy = storageConfig.getString("strategy"); String rf = storageConfig.getString("rf"); if (strategy==null || strategy.equals("") || strategy.equalsIgnoreCase("network")) strategy = "NetworkTopologyStrategy"; if (rf==null || rf.equals("")) rf = "us-east:3"; Map<String,JsonObject> dbMap = meta.runQuery(EntityType.DB.getId(), schema); JsonObject dbConfig = dbMap.get(schema); if (dbConfig.getString("strategy")==null || dbConfig.getString("strategy").equals("") || dbConfig.getString("rf")==null || dbConfig.getString("rf").equals("")) { dbConfig.putString("strategy", strategy); dbConfig.putString("rf", rf); } if (storageConfig == null) throw new StorageDoesNotExistException(); PaasConnection conn = cfactory.createConnection(storageConfig, schema); try { if (storageConfig.getString("type").equals("mysql")) conn.createDB(dbConfig.getString("name")); else conn.createDB(dbConfig.toString()); } catch (Exception e) { // TODO: handle exception } try { conn.createTable(obj); if (index_row_keys!=null && index_row_keys.equals("true")) { JsonObject idxObj = new JsonObject(); idxObj.putString("db", schema); idxObj.putString("name", obj.getString("name")+"ROWKEYS"); idxObj.putString("columns", "key,column1,value"); idxObj.putString("primarykey", "key,column1"); conn.createTable(idxObj); //conn.createRowIndexTable(obj) } } catch (Exception e) { // TODO: handle exception } } // public Entity readMetaEntity(String rowKey) { // // TODO Auto-generated method stub // return meta.readMetaEntity(rowKey); // } // // public String writeRow(String db, String table, JsonObject rowObj) { // // TODO Auto-generated method stub // return meta.writeRow(db, table, rowObj); // } // // public String listRow(String db, String table, String keycol, String key) { // // TODO Auto-generated method stub // return meta.listRow(db, table, keycol, key); // } public String listSchemas() { // TODO Auto-generated method stub return cache.listSchemas(); } public String listTablesInSchema(String schemaname) { // TODO Auto-generated method stub return cache.listTablesInSchema(schemaname); } public String listTimeseriesInSchema(String schemaname) { // TODO Auto-generated method stub return cache.listTimeseriesInSchema(schemaname); } public String listStorage() { // TODO Auto-generated method stub return cache.listStorage(); } public Map<String, String> getStorageMap() { // TODO Auto-generated method stub return null; } public String CreateDB() { // TODO Auto-generated method stub return null; } public String createTable() { // TODO Auto-generated method stub return null; } public JsonObject getStorageForTable(String table) { return cache.getStorageForTable(table); } public JsonObject runQuery(EntityType etype, String col) { return meta.runQuery(etype.getId(), col).get(col); } } <|start_filename|>staash-core/src/main/java/com/netflix/paas/dao/DaoProvider.java<|end_filename|> /******************************************************************************* * /*** * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * ******************************************************************************/ package com.netflix.paas.dao; import java.util.Map; import org.apache.commons.configuration.AbstractConfiguration; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.google.common.base.Preconditions; import com.google.common.collect.Maps; import com.google.inject.Inject; import com.netflix.paas.exceptions.NotFoundException; /** * Return an implementation of a DAO by schemaName and type. The schema name makes is possible * to have separates daos for the same type. * * @author elandau */ public class DaoProvider { private static final Logger LOG = LoggerFactory.getLogger(DaoProvider.class); private static final String DAO_TYPE_FORMAT = "com.netflix.paas.schema.%s.type"; private final Map<String, DaoSchemaProvider> schemaTypes; private final Map<String, DaoSchema> schemas; private final AbstractConfiguration configuration; @Inject public DaoProvider(Map<String, DaoSchemaProvider> schemaTypes, AbstractConfiguration configuration) { this.schemaTypes = schemaTypes; this.schemas = Maps.newHashMap(); this.configuration = configuration; } public <T> Dao<T> getDao(String schemaName, Class<T> type) throws NotFoundException { return getDao(new DaoKey<T>(schemaName, type)); } public synchronized <T> Dao<T> getDao(DaoKey<T> key) throws NotFoundException { return getSchema(key.getSchema()).getDao(key.getType()); } public synchronized DaoSchema getSchema(String schemaName) throws NotFoundException { DaoSchema schema = schemas.get(schemaName); if (schema == null) { String propertyName = String.format(DAO_TYPE_FORMAT, schemaName.toLowerCase()); String daoType = configuration.getString(propertyName); Preconditions.checkNotNull(daoType, "No DaoType specified for " + schemaName + " (" + propertyName + ")"); DaoSchemaProvider provider = schemaTypes.get(daoType); if (provider == null) { LOG.warn("Unable to find DaoManager for schema " + schemaName + "(" + daoType + ")"); throw new NotFoundException(DaoSchemaProvider.class, daoType); } schema = provider.getSchema(schemaName); schemas.put(schemaName, schema); LOG.info("Created DaoSchema for " + schemaName); } return schema; } } <|start_filename|>staash-svc/src/test/java/com/netflix/paas/rest/test/PaasEurekaNodeDiscoveryTest.java<|end_filename|> /******************************************************************************* * /* * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * * * ******************************************************************************/ package com.netflix.paas.rest.test; import java.util.List; import org.junit.Ignore; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.google.common.base.Supplier; import com.google.common.collect.Lists; import com.google.inject.AbstractModule; import com.google.inject.Injector; import com.google.inject.name.Names; import com.netflix.astyanax.connectionpool.Host; import com.netflix.governator.guice.LifecycleInjector; import com.netflix.staash.cassandra.discovery.EurekaAstyanaxHostSupplier; import com.netflix.staash.cassandra.discovery.EurekaModule; public class PaasEurekaNodeDiscoveryTest { Logger LOG = LoggerFactory.getLogger(PaasEurekaNodeDiscoveryTest.class); @Test @Ignore public void testSupplier() { List<AbstractModule> modules = Lists.newArrayList( new AbstractModule() { @Override protected void configure() { bind(String.class).annotatedWith(Names.named("groupName")).toInstance("testgroup"); } }, new EurekaModule() ); // Create the injector Injector injector = LifecycleInjector.builder() .withModules(modules) .createInjector(); EurekaAstyanaxHostSupplier supplier = injector.getInstance(EurekaAstyanaxHostSupplier.class); // EurekaAstyanaxHostSupplier supplier = new EurekaAstyanaxHostSupplier(); Supplier<List<Host>> list1 = supplier.getSupplier("c_sandbox"); List<Host> hosts = list1.get(); LOG.info("cass_sandbox"); for (Host host:hosts) { LOG.info(host.getHostName()); } // Supplier<List<Host>> list2 = supplier.getSupplier("ABCLOUD"); // hosts = list2.get(); // LOG.info("ABCLOUD"); // for (Host host:hosts) { // LOG.info(host.getHostName()); // } Supplier<List<Host>> list3 = supplier.getSupplier("C_PAAS"); hosts = list3.get(); LOG.info("c_paas"); for (Host host:hosts) { LOG.info(host.getHostName()); } } } <|start_filename|>staash-astyanax/src/main/java/com/netflix/paas/cassandra/provider/CassandraTableResourceFactory.java<|end_filename|> /******************************************************************************* * /*** * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * ******************************************************************************/ package com.netflix.paas.cassandra.provider; //import org.mortbay.log.Log; import com.google.common.base.Preconditions; import com.google.inject.Inject; import com.netflix.astyanax.Keyspace; import com.netflix.paas.cassandra.keys.ClusterKey; import com.netflix.paas.cassandra.keys.KeyspaceKey; import com.netflix.paas.cassandra.resources.AstyanaxThriftDataTableResource; import com.netflix.paas.entity.TableEntity; import com.netflix.paas.exceptions.NotFoundException; import com.netflix.paas.provider.TableDataResourceFactory; import com.netflix.paas.resources.TableDataResource; public class CassandraTableResourceFactory implements TableDataResourceFactory { private final KeyspaceClientProvider clientProvider; @Inject public CassandraTableResourceFactory(KeyspaceClientProvider clientProvider) { this.clientProvider = clientProvider; } @Override public TableDataResource getTableDataResource(TableEntity table) throws NotFoundException { //Log.info(table.toString()); String clusterName = table.getOption("cassandra.cluster"); String keyspaceName = table.getOption("cassandra.keyspace"); String columnFamilyName = table.getOption("cassandra.columnfamily"); String discoveryType = table.getOption("discovery"); if (discoveryType == null) discoveryType = "eureka"; Preconditions.checkNotNull(clusterName, "Must specify cluster name for table " + table.getTableName()); Preconditions.checkNotNull(keyspaceName, "Must specify keyspace name for table " + table.getTableName()); Preconditions.checkNotNull(columnFamilyName, "Must specify column family name for table " + table.getTableName()); Preconditions.checkNotNull(discoveryType, "Must specify discovery type for table " + table.getTableName()); Keyspace keyspace = clientProvider.acquireKeyspace(new KeyspaceKey(new ClusterKey(clusterName, discoveryType), keyspaceName)); return new AstyanaxThriftDataTableResource(keyspace, columnFamilyName); } } <|start_filename|>staash-jetty/src/main/java/com/netflix/staash/jetty/PaasLauncher.java<|end_filename|> /******************************************************************************* * /*** * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * ******************************************************************************/ package com.netflix.staash.jetty; import org.eclipse.jetty.server.Server; import com.google.inject.servlet.GuiceFilter; import org.eclipse.jetty.servlet.DefaultServlet; import org.eclipse.jetty.servlet.ServletContextHandler; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class PaasLauncher { private static final Logger LOG = LoggerFactory.getLogger(PaasLauncher.class); private static final int DEFAULT_PORT = 8080; public static void main(String[] args) throws Exception { LOG.info("Starting PAAS"); // Create the server. Server server = new Server(DEFAULT_PORT); // Create a servlet context and add the jersey servlet. ServletContextHandler sch = new ServletContextHandler(server, "/"); // Add our Guice listener that includes our bindings sch.addEventListener(new PaasGuiceServletConfig()); // Then add GuiceFilter and configure the server to // reroute all requests through this filter. sch.addFilter(GuiceFilter.class, "/*", null); // Must add DefaultServlet for embedded Jetty. // Failing to do this will cause 404 errors. // This is not needed if web.xml is used instead. sch.addServlet(DefaultServlet.class, "/"); // Start the server server.start(); server.join(); LOG.info("Stopping PAAS"); } } <|start_filename|>staash-svc/src/main/java/com/netflix/staash/rest/dao/AstyanaxMetaDaoImpl.java<|end_filename|> /******************************************************************************* * /* * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * * * ******************************************************************************/ package com.netflix.staash.rest.dao; import java.util.HashMap; import java.util.Map; import org.apache.log4j.Logger; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap.Builder; import com.google.inject.Inject; import com.google.inject.name.Named; import com.netflix.astyanax.Keyspace; import com.netflix.astyanax.connectionpool.Host; import com.netflix.astyanax.connectionpool.OperationResult; import com.netflix.astyanax.connectionpool.exceptions.ConnectionException; import com.netflix.astyanax.cql.CqlStatementResult; import com.netflix.astyanax.model.ColumnFamily; import com.netflix.astyanax.model.ColumnList; import com.netflix.astyanax.model.Row; import com.netflix.astyanax.serializers.StringSerializer; import com.netflix.config.DynamicPropertyFactory; import com.netflix.config.DynamicStringProperty; import com.netflix.staash.json.JsonObject; import com.netflix.staash.rest.meta.entity.Entity; import com.netflix.staash.rest.util.MetaConstants; import com.netflix.staash.rest.util.PaasUtils; import com.netflix.staash.rest.util.StaashRequestContext; public class AstyanaxMetaDaoImpl implements MetaDao { private Keyspace keyspace; private Logger logger = Logger.getLogger(AstyanaxMetaDaoImpl.class); private static final DynamicStringProperty METASTRATEGY = DynamicPropertyFactory .getInstance().getStringProperty("staash.metastrategy", "NetworkTopologyStrategy"); private static final DynamicStringProperty METARF = DynamicPropertyFactory .getInstance().getStringProperty("staash.metareplicationfactor", "us-east:3"); static ColumnFamily<String, String> METACF = ColumnFamily.newColumnFamily( MetaConstants.META_COLUMN_FAMILY, StringSerializer.get(), StringSerializer.get()); @Inject public AstyanaxMetaDaoImpl(@Named("astmetaks") Keyspace keyspace) { this.keyspace = keyspace; try { keyspace.describeKeyspace(); logger.info("keyspaces for staash exists already"); StaashRequestContext.addContext("Meta_Init", "keyspace already existed"); } catch (ConnectionException ex) { StaashRequestContext.addContext("Meta_Init", "Keyspace did not exist , creating keyspace "+MetaConstants.META_KEY_SPACE ); maybecreateschema(); } } private Map<String, Object> populateMap() { Builder<String, Object> rfMap = ImmutableMap.<String, Object> builder(); String rfStr = METARF.getValue(); String[] pairs = rfStr.split(","); for (String pair : pairs) { String[] kv = pair.split(":"); rfMap.put(kv[0], kv[1]); } return rfMap.build(); } private void maybecreateschema() { try { boolean b = true; logger.info("Strategy: " + METASTRATEGY.getValue() + " RF: " + METARF.getValue()); try { b = keyspace.getConnectionPool().hasHost( new Host("localhost:9160", 9160)); } catch (ConnectionException ex) { } if (b) { keyspace.createKeyspace(ImmutableMap .<String, Object> builder() .put("strategy_options", ImmutableMap.<String, Object> builder() .put("replication_factor", "1").build()) .put("strategy_class", "SimpleStrategy").build()); } else { // keyspace.createKeyspace(ImmutableMap // .<String, Object> builder() // .put("strategy_options", // ImmutableMap.<String, Object> builder() // .put("us-east", "3").build()) // .put("strategy_class", METASTRATEGY).build()); keyspace.createKeyspace(ImmutableMap.<String, Object> builder() .put("strategy_options", populateMap()) .put("strategy_class", METASTRATEGY.getValue()).build()); } StaashRequestContext.addContext("Meta_Init", "Keyspace did not exist , created keyspace "+MetaConstants.META_KEY_SPACE +" with rf:" + METARF.getValue()); } catch (ConnectionException e) { // If we are here that means the meta artifacts already exist logger.info("keyspaces for staash exists already"); StaashRequestContext.addContext("Meta_Init", "keyspace already existed"); } try { String metaDynamic = "CREATE TABLE " + MetaConstants.META_COLUMN_FAMILY +"(\n" + " key text,\n" + " column1 text,\n" + " value text,\n" + " PRIMARY KEY (key, column1)\n" + ") WITH COMPACT STORAGE;"; keyspace.prepareCqlStatement().withCql(metaDynamic).execute(); StaashRequestContext .addContext("Meta_Init", "Columnfamily did not exist , created column family "+MetaConstants.META_COLUMN_FAMILY + " in keyspace "+MetaConstants.META_KEY_SPACE); } catch (ConnectionException e) { // if we are here means meta artifacts already exists, ignore logger.info("staash column family exists"); StaashRequestContext.addContext("Meta_Init", "Columnfamily already existed"); } } public String writeMetaEntity(Entity entity) { try { String stmt = String.format(PaasUtils.INSERT_FORMAT, MetaConstants.META_KEY_SPACE + "." + MetaConstants.META_COLUMN_FAMILY, entity.getRowKey(), entity.getName(), entity.getPayLoad()); keyspace.prepareCqlStatement().withCql(stmt).execute(); StaashRequestContext.addContext("Meta_Write", "write succeeded on meta: "+ entity!=null?entity.getPayLoad():null); } catch (ConnectionException e) { logger.info("Write of the entity failed "+entity!=null?entity.getPayLoad():null); StaashRequestContext.addContext("Meta_Write", "write failed on meta: "+ entity!=null?entity.getPayLoad():null); throw new RuntimeException(e.getMessage()); } return "{\"msg\":\"ok\"}"; } public Map<String, String> getStorageMap() { return null; } public Map<String, JsonObject> runQuery(String key, String col) { OperationResult<CqlStatementResult> rs; Map<String, JsonObject> resultMap = new HashMap<String, JsonObject>(); try { String queryStr = ""; if (col != null && !col.equals("*")) { queryStr = "select column1, value from "+MetaConstants.META_KEY_SPACE + "." + MetaConstants.META_COLUMN_FAMILY +" where key='" + key + "' and column1='" + col + "';"; } else { queryStr = "select column1, value from "+MetaConstants.META_KEY_SPACE + "." + MetaConstants.META_COLUMN_FAMILY +" where key='" + key + "';"; } rs = keyspace.prepareCqlStatement().withCql(queryStr).execute(); for (Row<String, String> row : rs.getResult().getRows(METACF)) { ColumnList<String> columns = row.getColumns(); String key1 = columns.getStringValue("column1", null); String val1 = columns.getStringValue("value", null); resultMap.put(key1, new JsonObject(val1)); } } catch (ConnectionException e) { e.printStackTrace(); throw new RuntimeException(e.getMessage()); } return resultMap; } } <|start_filename|>staash-svc/src/test/java/com/netflix/paas/rest/test/TestPaasApis.java<|end_filename|> package com.netflix.paas.rest.test; import org.junit.Test; import com.netflix.staash.json.JsonArray; import com.netflix.staash.json.JsonObject; public class TestPaasApis { @Test public void testJsonArr() { String eventsStr = "[{\"name\":\"me\"},{\"name\":\"you\"}]"; String eventStr = "{\"name\":\"me\"}"; try { JsonObject jObj = new JsonObject(eventStr); int i = 0; System.out.println(jObj.isArray()); }catch (Exception e) { e.printStackTrace(); } JsonArray evts1 = new JsonArray(eventsStr); JsonArray events = new JsonArray(); events.addString(eventsStr); // if (events.isArray()) { // JsonArray eventsArr = events.asArray(); // JsonObject obj; // for (int i=0;obj = events.get(i); i++) { // JsonObject obj = (JsonObject) event; // } // } Object obj1 = evts1.get(0); Object obj2 = evts1.get(1); int len = evts1.size(); int i = 0; } } <|start_filename|>staash-svc/src/main/java/com/netflix/staash/json/impl/Json.java<|end_filename|> /* * Copyright 2011-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.staash.json.impl; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.netflix.staash.json.DecodeException; import com.netflix.staash.json.EncodeException; /** * @author <a href="http://tfox.org"><NAME></a> */ public class Json { // private static final Logger log = LoggerFactory.getLogger(Json.class); private final static ObjectMapper mapper = new ObjectMapper(); private final static ObjectMapper prettyMapper = new ObjectMapper(); static { // Non-standard JSON but we allow C style comments in our JSON mapper.configure(JsonParser.Feature.ALLOW_COMMENTS, true); } public static String encode(Object obj) throws EncodeException { try { return mapper.writeValueAsString(obj); } catch (Exception e) { throw new EncodeException("Failed to encode as JSON: " + e.getMessage()); } } public static String encodePrettily(Object obj) throws EncodeException { try { return prettyMapper.writeValueAsString(obj); } catch (Exception e) { throw new EncodeException("Failed to encode as JSON: " + e.getMessage()); } } @SuppressWarnings("unchecked") public static <T> T decodeValue(String str, Class<?> clazz) throws DecodeException { try { return (T)mapper.readValue(str, clazz); } catch (Exception e) { throw new DecodeException("Failed to decode:" + e.getMessage()); } } static { prettyMapper.configure(SerializationFeature.INDENT_OUTPUT, true); } } <|start_filename|>staash-core/src/main/java/com/netflix/paas/resources/impl/JerseySchemaAdminResourceImpl.java<|end_filename|> /******************************************************************************* * /*** * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * ******************************************************************************/ package com.netflix.paas.resources.impl; import javax.ws.rs.DELETE; import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import com.google.inject.Inject; import com.netflix.paas.dao.DaoProvider; import com.netflix.paas.entity.DbEntity; import com.netflix.paas.entity.TableEntity; import com.netflix.paas.json.JsonObject; import com.netflix.paas.meta.dao.MetaDao; import com.netflix.paas.meta.entity.PaasDBEntity; import com.netflix.paas.meta.entity.PaasTableEntity; import com.netflix.paas.resources.SchemaAdminResource; public class JerseySchemaAdminResourceImpl implements SchemaAdminResource { private DaoProvider provider; private MetaDao metadao; @Inject public JerseySchemaAdminResourceImpl(DaoProvider provider, MetaDao meta) { this.provider = provider; this.metadao = meta; } @Override @GET public String listSchemas() { // TODO Auto-generated method stub return "hello"; } @Override public void createSchema(String payLoad) { // TODO Auto-generated method stub if (payLoad!=null) { JsonObject jsonPayLoad = new JsonObject(payLoad); PaasDBEntity pdbe = PaasDBEntity.builder().withJsonPayLoad(jsonPayLoad).build(); metadao.writeMetaEntity(pdbe); // Dao<DbEntity> dbDao = provider.getDao("configuration", DbEntity.class); // DbEntity dbe = DbEntity.builder().withName(schema.getString("name")).build(); // boolean exists = dbDao.isExists(); // dbDao.write(dbe); // System.out.println("schema created"); // System.out.println("schema name is "+schema.getFieldNames()+" "+schema.toString()); } } @Override @DELETE @Path("{schema}") public void deleteSchema(@PathParam("schema") String schemaName) { // TODO Auto-generated method stub } @Override @POST @Path("{schema}") public void updateSchema(@PathParam("schema") String schemaName, DbEntity schema) { // TODO Auto-generated method stub } @Override @GET @Path("{schema}") public DbEntity getSchema(@PathParam("schema") String schemaName) { // TODO Auto-generated method stub return null; } @Override @GET @Path("{schema}/tables/{table}") public TableEntity getTable(@PathParam("schema") String schemaName, @PathParam("table") String tableName) { // TODO Auto-generated method stub return null; } @Override @DELETE @Path("{schema}/tables/{table}") public void deleteTable(@PathParam("schema") String schemaName, @PathParam("table") String tableName) { // TODO Auto-generated method stub } @Override public void createTable(@PathParam("schema") String schemaName, String payLoad) { // TODO Auto-generated method stub if (payLoad!=null) { JsonObject jsonPayLoad = new JsonObject(payLoad); PaasTableEntity ptbe = PaasTableEntity.builder().withJsonPayLoad(jsonPayLoad, schemaName).build(); metadao.writeMetaEntity(ptbe); //create new ks //create new cf } } @Override @POST @Path("{schema}/tables/{table}") public void updateTable(@PathParam("schema") String schemaName, @PathParam("table") String tableName, TableEntity table) { // TODO Auto-generated method stub } } <|start_filename|>staash-jetty/src/test/java/com/netflix/staash/TestSchemaData.java<|end_filename|> /******************************************************************************* * /*** * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * ******************************************************************************/ package com.netflix.staash; import java.util.List; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Ignore; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.google.common.base.Supplier; import com.google.common.collect.Lists; import com.google.inject.AbstractModule; import com.google.inject.Injector; import com.google.inject.name.Names; import com.netflix.astyanax.connectionpool.Host; import com.netflix.governator.guice.LifecycleInjector; import com.netflix.paas.cassandra.discovery.EurekaAstyanaxHostSupplier; import com.netflix.paas.cassandra.discovery.EurekaModule; public class TestSchemaData { private static final Logger LOG = LoggerFactory.getLogger(TestSchemaData.class); private static final String groupName = "UnitTest2"; @BeforeClass public static void startup() { //SingletonEmbeddedCassandra.getInstance(); } @AfterClass public static void shutdown() { } @Test @Ignore public void test() throws Exception { List<AbstractModule> modules = Lists.newArrayList( new AbstractModule() { @Override protected void configure() { bind(String.class).annotatedWith(Names.named("groupName")).toInstance(groupName); } }, // new CassandraPaasModule(), new EurekaModule() // new PaasModule(), // new JerseyServletModule() { // @Override // protected void configureServlets() { // // Route all requests through GuiceContainer // bind(GuiceContainer.class).asEagerSingleton(); // serve("/*").with(GuiceContainer.class); // } // }, // new AbstractModule() { // @Override // protected void configure() { // bind(PaasBootstrap.class).asEagerSingleton(); // bind(PaasCassandraBootstrap.class).asEagerSingleton(); // } // } ); // Create the injector Injector injector = LifecycleInjector.builder() .withModules(modules) .createInjector(); // LifecycleManager manager = injector.getInstance(LifecycleManager.class); // manager.start(); // // SchemaService schema = injector.getInstance(SchemaService.class); // Assert.assertNotNull(schema); // final String schemaName = "vschema1"; // final String tableName = "vt_CASS_SANDBOX_AstyanaxUnitTests_AstyanaxUnitTests|users"; // // // DataResource dataResource = injector .getInstance (DataResource.class); // Assert.assertNotNull(dataResource); // // SchemaDataResource schemaResource = dataResource .getSchemaDataResource(schemaName); // Assert.assertNotNull(schemaResource); // // TableDataResource tableResource = schemaResource.getTableSubresource (tableName); // tableResource.listRows(null, 10, 10); // ClusterDiscoveryService discoveryService = injector.getInstance(ClusterDiscoveryService.class); // LOG.info("Clusters: " + discoveryService.getClusterNames()); EurekaAstyanaxHostSupplier supplier = injector.getInstance(EurekaAstyanaxHostSupplier.class); Supplier<List<Host>> list1 = supplier.getSupplier("cass_sandbox"); List<Host> hosts = list1.get(); LOG.info("cass_sandbox"); for (Host host:hosts) { LOG.info(host.getHostName()); } Supplier<List<Host>> list2 = supplier.getSupplier("ABCLOUD"); hosts = list2.get(); LOG.info("ABCLOUD"); for (Host host:hosts) { LOG.info(host.getHostName()); } Supplier<List<Host>> list3 = supplier.getSupplier("CASSS_PAAS"); hosts = list3.get(); LOG.info("casss_paas"); for (Host host:hosts) { LOG.info(host.getHostName()); } // CassandraSystemAdminResource admin = injector.getInstance(CassandraSystemAdminResource.class); // admin.discoverClusters(); LOG.info("starting cluster discovery task"); // TaskManager taskManager = injector.getInstance(TaskManager.class); // taskManager.submit(ClusterDiscoveryTask.class); // // PassGroupConfigEntity.Builder groupBuilder = PassGroupConfigEntity.builder().withName(groupName); // // String keyspaceName = "AstyanaxUnitTests"; // int i = 0; // String vschemaName = "vschema1"; // DbEntity.Builder virtualSchemaBuilder = DbEntity.builder() // .withName(vschemaName); // // // LOG.info("running cluster dao"); // DaoProvider daoManager = injector.getInstance(Key.get(DaoProvider.class)); // DaoKeys key; // Dao<CassandraClusterEntity> cassClusterDAO = daoManager.getDao(DaoKeys.DAO_CASSANDRA_CLUSTER_ENTITY); // Collection<CassandraClusterEntity> cassClusterColl = cassClusterDAO.list(); // for (CassandraClusterEntity cse: cassClusterColl) { // LOG.info(cse.getClusterName()); // } // for (String cfName : cassCluster.getKeyspaceColumnFamilyNames(keyspaceName)) { // LOG.info(cfName); // TableEntity table = TableEntity.builder() // .withTableName(StringUtils.join(Lists.newArrayList("vt", clusterName, keyspaceName, cfName), "_")) // .withStorageType("cassandra") // .withOption("cassandra.cluster", clusterName) // .withOption("cassandra.keyspace", keyspaceName) // .withOption("cassandra.columnfamily", cfName) // .build(); // // virtualSchemaBuilder.addTable(table); // } // // vschemaDao.write(virtualSchemaBuilder.build()); // // groupDao.write(groupBuilder.build()); // DaoManager daoManager = injector.getInstance(Key.get(DaoManager.class, Names.named("configuration"))); // Dao<VirtualSchemaEntity> schemaDao = daoManager.getDao(VirtualSchemaEntity.class); // // List<Dao<?>> daos = daoManager.listDaos(); // Assert.assertEquals(1, daos.size()); // // for (Dao<?> dao : daos) { // LOG.info("Have DAO " + dao.getDaoType() + ":" + dao.getEntityType()); // dao.createStorage(); // } // // DaoSchemaRegistry schemaService = injector.getInstance(DaoSchemaRegistry.class); // schemaService.listSchema(); // // DaoManager daoFactory = injector.getInstance(DaoManager.class); // //// Dao<SchemaEntity> schemaEntityDao = daoFactory.getDao(SchemaEntity.class); //// schemaEntityDao.createStorage(); //// schemaEntityDao.write(SchemaEntity.builder() //// .withName("schema1") //// .addTable(TableEntity.builder() //// .withStorageType("cassandra") //// .withTableName("table1") //// .withSchemaName("schema1") //// .withOption("clusterName", "local") //// .withOption("keyspaceName", "Keyspace1") //// .withOption("columnFamilyName", "ColumnFamily1") //// .build()) //// .build()); // //// Iterable<SchemaEntity> schemas = schemaEntityDao.list(); //// for (SchemaEntity entity : schemas) { //// System.out.println(entity.toString()); //// } // manager.close(); } } <|start_filename|>staash-web/src/test/java/com/netflix/staash/test/core/CassandraRunner.java<|end_filename|> package com.netflix.staash.test.core; import java.io.File; import java.lang.annotation.Annotation; import java.util.ArrayList; import java.util.List; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; import org.apache.cassandra.config.CFMetaData; import org.apache.cassandra.config.KSMetaData; import org.apache.cassandra.db.ColumnFamilyType; import org.apache.cassandra.db.marshal.CounterColumnType; import org.apache.cassandra.db.marshal.TypeParser; import org.apache.cassandra.exceptions.AlreadyExistsException; import org.apache.cassandra.service.MigrationManager; import org.apache.cassandra.service.StorageProxy; import org.apache.cassandra.service.StorageService; import org.junit.runner.notification.RunNotifier; import org.junit.runners.BlockJUnit4ClassRunner; import org.junit.runners.model.FrameworkMethod; import org.junit.runners.model.InitializationError; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class CassandraRunner extends BlockJUnit4ClassRunner { private static final Logger logger = LoggerFactory.getLogger(CassandraRunner.class); static StaashDeamon staashDaemon; static ExecutorService executor = Executors.newSingleThreadExecutor(); public CassandraRunner(Class<?> klass) throws InitializationError { super(klass); logger.debug("CassandraRunner constructed with class {}", klass.getName()); } @Override protected void runChild(FrameworkMethod method, RunNotifier notifier) { logger.debug("runChild invoked on method: " + method.getName()); RequiresKeyspace rk = method.getAnnotation(RequiresKeyspace.class); RequiresColumnFamily rcf = method.getAnnotation(RequiresColumnFamily.class); if ( rk != null ) { maybeCreateKeyspace(rk, rcf); } else if ( rcf != null ) { maybeCreateColumnFamily(rcf); } super.runChild(method, notifier); } @Override public void run(RunNotifier notifier) { startCassandra(); RequiresKeyspace rk = null; RequiresColumnFamily rcf = null; for (Annotation ann : getTestClass().getAnnotations() ) { if ( ann instanceof RequiresKeyspace ) { rk = (RequiresKeyspace)ann; } else if ( ann instanceof RequiresColumnFamily ) { rcf = (RequiresColumnFamily)ann; } } if ( rk != null ) { maybeCreateKeyspace(rk, rcf); } else if ( rcf != null ) { maybeCreateColumnFamily(rcf); } super.run(notifier); } private void maybeCreateKeyspace(RequiresKeyspace rk, RequiresColumnFamily rcf) { logger.debug("RequiresKeyspace annotation has keyspace name: {}", rk.ksName()); List<CFMetaData> cfs = extractColumnFamily(rcf); try { MigrationManager .announceNewKeyspace(KSMetaData.newKeyspace(rk.ksName(), rk.strategy(), KSMetaData.optsWithRF(rk.replication()), false, cfs)); } catch (AlreadyExistsException aee) { logger.info("using existing Keyspace for " + rk.ksName()); if ( cfs.size() > 0 ) { maybeTruncateSafely(rcf); } } catch (Exception ex) { throw new RuntimeException("Failure creating keyspace for " + rk.ksName(),ex); } } private List<CFMetaData> extractColumnFamily(RequiresColumnFamily rcf) { logger.debug("RequiresColumnFamily has name: {} for ks: {}", rcf.cfName(), rcf.ksName()); List<CFMetaData> cfms = new ArrayList<CFMetaData>(); if ( rcf != null ) { try { cfms.add(new CFMetaData(rcf.ksName(), rcf.cfName(), ColumnFamilyType.Standard, TypeParser.parse(rcf.comparator()), null)); } catch (Exception ex) { throw new RuntimeException("unable to create column family for: " + rcf.cfName(), ex); } } return cfms; } private void maybeCreateColumnFamily(RequiresColumnFamily rcf) { try { CFMetaData cfMetaData; if ( rcf.isCounter() ) { cfMetaData = new CFMetaData(rcf.ksName(), rcf.cfName(), ColumnFamilyType.Standard, TypeParser.parse(rcf.comparator()), null) .replicateOnWrite(false).defaultValidator(CounterColumnType.instance); } else { cfMetaData = new CFMetaData(rcf.ksName(), rcf.cfName(), ColumnFamilyType.Standard, TypeParser.parse(rcf.comparator()), null); } MigrationManager.announceNewColumnFamily(cfMetaData); } catch(AlreadyExistsException aee) { logger.info("CF already exists for " + rcf.cfName()); maybeTruncateSafely(rcf); } catch (Exception ex) { throw new RuntimeException("Could not create CF for: " + rcf.cfName(), ex); } } private void maybeTruncateSafely(RequiresColumnFamily rcf) { if ( rcf != null && rcf.truncateExisting() ) { try { StorageProxy.truncateBlocking(rcf.ksName(), rcf.cfName()); } catch (Exception ex) { throw new RuntimeException("Could not truncate column family: " + rcf.cfName(),ex); } } } private void startCassandra() { if ( staashDaemon != null ) { return; } deleteRecursive(new File("/tmp/staash_cache")); deleteRecursive(new File ("/tmp/staash_data")); deleteRecursive(new File ("/tmp/staash_log")); System.setProperty("cassandra-foreground", "true"); System.setProperty("log4j.defaultInitOverride","true"); System.setProperty("log4j.configuration", "log4j.properties"); System.setProperty("cassandra.ring_delay_ms","1000"); System.setProperty("cassandra.start_rpc","true"); System.setProperty("cassandra.start_native_transport","true"); executor.execute(new Runnable() { public void run() { staashDaemon = new StaashDeamon(); staashDaemon.activate(); } }); try { TimeUnit.SECONDS.sleep(3); } catch (InterruptedException e) { throw new AssertionError(e); } Runtime.getRuntime().addShutdownHook(new Thread() { @Override public void run() { try { logger.error("In shutdownHook"); stopCassandra(); } catch (Exception ex) { ex.printStackTrace(); } } }); } private void stopCassandra() throws Exception { if (staashDaemon != null) { staashDaemon.deactivate(); StorageService.instance.stopClient(); } executor.shutdown(); executor.shutdownNow(); } private static boolean deleteRecursive(File path) { if (!path.exists()) return false; boolean ret = true; if (path.isDirectory()){ for (File f : path.listFiles()){ ret = ret && deleteRecursive(f); } } return ret && path.delete(); } } <|start_filename|>staash-core/src/main/java/com/netflix/paas/config/base/JavaAssistArchaeusConfigurationFactory.java<|end_filename|> /******************************************************************************* * /*** * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * ******************************************************************************/ package com.netflix.paas.config.base; import java.lang.reflect.InvocationHandler; import java.lang.reflect.Method; import java.lang.reflect.Proxy; import java.util.Map; import net.sf.cglib.proxy.Enhancer; import org.apache.commons.configuration.AbstractConfiguration; import com.google.common.base.Supplier; import com.netflix.config.ConfigurationManager; import com.netflix.config.DynamicPropertyFactory; import com.netflix.paas.config.ConfigurationFactory; public class JavaAssistArchaeusConfigurationFactory implements ConfigurationFactory { @Override public <T> T get(Class<T> configClass) throws Exception { return get(configClass, DynamicPropertyFactory.getInstance(), ConfigurationManager.getConfigInstance()); } @SuppressWarnings({ "unchecked", "static-access" }) public <T> T get(Class<T> configClass, DynamicPropertyFactory propertyFactory, AbstractConfiguration configuration) throws Exception { final Map<String, Supplier<?>> methods = ConfigurationProxyUtils.getMethodSuppliers(configClass, propertyFactory, configuration); if (configClass.isInterface()) { Class<?> proxyClass = Proxy.getProxyClass( configClass.getClassLoader(), new Class[] { configClass }); return (T) proxyClass .getConstructor(new Class[] { InvocationHandler.class }) .newInstance(new Object[] { new InvocationHandler() { @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { Supplier<?> supplier = (Supplier<?>)methods.get(method.getName()); if (supplier == null) { return method.invoke(proxy, args); } return supplier.get(); } }}); } else { final Enhancer enhancer = new Enhancer(); final Object obj = (T) enhancer.create(configClass, new net.sf.cglib.proxy.InvocationHandler() { @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { Supplier<?> supplier = (Supplier<?>)methods.get(method.getName()); if (supplier == null) { return method.invoke(proxy, args); } return supplier.get(); } }); ConfigurationProxyUtils.assignFieldValues(obj, configClass, propertyFactory, configuration); return (T)obj; } } } <|start_filename|>staash-web/src/test/java/com/netflix/staash/test/core/SampleTest.java<|end_filename|> package com.netflix.staash.test.core; import java.util.Map; import org.apache.cassandra.config.CFMetaData; import org.apache.cassandra.config.KSMetaData; import org.apache.cassandra.config.Schema; import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; @RunWith(CassandraRunner.class) @RequiresKeyspace(ksName = "myks") @RequiresColumnFamily(ksName = "myks", cfName = "uuidtest", comparator = "org.apache.cassandra.db.marshal.UTF8Type", keyValidator = "org.apache.cassandra.db.marshal.UUIDType") @SuppressWarnings({ "rawtypes", "unchecked" }) @Ignore public class SampleTest { @Test @Ignore public void mytest2() { System.out.println("Hello World!"); for (String ks :Schema.instance.getTables()) { KSMetaData ksm = Schema.instance.getKSMetaData(ks); Map<String, CFMetaData> cfm = ksm.cfMetaData(); } } } <|start_filename|>staash-svc/src/main/java/com/netflix/staash/common/query/QueryType.java<|end_filename|> /******************************************************************************* * /* * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * * * ******************************************************************************/ package com.netflix.staash.common.query; public enum QueryType { REPLACE, INSERT, SELECT, UPDATE, DELETE, ALTER, UNCLASSIFIABLE,CREATEDB,CREATETABLE,CREATESERIES,SWITCHDB,SELECTALL,SELECTEVENT; public static QueryType classifyQuery(final String query) { final String lowerCaseQuery = query.toLowerCase(); if (lowerCaseQuery.startsWith("select")) { return QueryType.SELECT; } else if (lowerCaseQuery.startsWith("update")) { return QueryType.UPDATE; } else if (lowerCaseQuery.startsWith("insert")) { return QueryType.INSERT; } else if (lowerCaseQuery.startsWith("alter")) { return QueryType.ALTER; } else if (lowerCaseQuery.startsWith("delete")) { return QueryType.DELETE; } else if (lowerCaseQuery.startsWith("replace")) { return QueryType.REPLACE; } else if (lowerCaseQuery.startsWith("createdb")) { return QueryType.CREATEDB; } else if (lowerCaseQuery.startsWith("createtable")) { return QueryType.CREATETABLE; } else if (lowerCaseQuery.startsWith("switchdb")) { return QueryType.SWITCHDB; } else if (lowerCaseQuery.startsWith("selectall")) { return QueryType.SELECTALL; } else if (lowerCaseQuery.startsWith("createseries")) { return QueryType.CREATESERIES; } else if (lowerCaseQuery.startsWith("selectevent")) { return QueryType.SELECTEVENT; } else { return QueryType.UNCLASSIFIABLE; } } } <|start_filename|>staash-core/src/main/java/com/netflix/paas/data/RowData.java<|end_filename|> /******************************************************************************* * /*** * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * ******************************************************************************/ package com.netflix.paas.data; public class RowData { private SchemaRows rows; private SchemalessRows srows; public SchemaRows getRows() { return rows; } public void setRows(SchemaRows rows) { this.rows = rows; } public SchemalessRows getSrows() { return srows; } public void setSrows(SchemalessRows srows) { this.srows = srows; } public boolean hasSchemalessRows() { return this.srows != null; } public boolean hasSchemaRows() { return this.rows != null; } @Override public String toString() { return "RowData [rows=" + rows + ", srows=" + srows + "]"; } } <|start_filename|>staash-astyanax/src/main/java/com/netflix/paas/dao/astyanax/SimpleReverseIndexer.java<|end_filename|> /******************************************************************************* * /*** * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * ******************************************************************************/ package com.netflix.paas.dao.astyanax; import java.util.Collection; import java.util.Map; import java.util.Map.Entry; import java.util.Set; import java.util.UUID; import com.google.common.base.Function; import com.google.common.collect.Collections2; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Maps; import com.google.common.collect.Sets; import com.netflix.astyanax.ColumnListMutation; import com.netflix.astyanax.Keyspace; import com.netflix.astyanax.MutationBatch; import com.netflix.astyanax.annotations.Component; import com.netflix.astyanax.connectionpool.exceptions.ConnectionException; import com.netflix.astyanax.model.Column; import com.netflix.astyanax.model.ColumnFamily; import com.netflix.astyanax.model.ColumnList; import com.netflix.astyanax.model.Row; import com.netflix.astyanax.serializers.AnnotatedCompositeSerializer; import com.netflix.astyanax.serializers.StringSerializer; import com.netflix.astyanax.util.TimeUUIDUtils; /** * Very very very simple and inefficient tagger that stores a single row per tag. * Use this when storing and tagging a relatively small number of 'documents'. * The tagger works on equality and does not provide prefix or wildcard searches * * RowKey: <TagName> * Column: <ForeignKey><VersionUUID> * * @author elandau * */ public class SimpleReverseIndexer implements Indexer { private final static String ID_PREFIX = "$"; /** * Composite entry within the index CF * @author elandau * */ public static class IndexEntry { public IndexEntry() { } public IndexEntry(String id, UUID uuid) { this.id = id; this.version = uuid; } @Component(ordinal = 0) public String id; @Component(ordinal = 1) public UUID version; } private static final AnnotatedCompositeSerializer<IndexEntry> EntrySerializer = new AnnotatedCompositeSerializer<IndexEntry>(IndexEntry.class); /** * Builder pattern * @author elandau */ public static class Builder { private Keyspace keyspace; private String columnFamily; public Builder withKeyspace(Keyspace keyspace) { this.keyspace = keyspace; return this; } public Builder withColumnFamily(String columnFamily) { this.columnFamily = columnFamily; return this; } public SimpleReverseIndexer build() { return new SimpleReverseIndexer(this); } } public static Builder builder() { return new Builder(); } private Keyspace keyspace; private ColumnFamily<String, IndexEntry> indexCf; private ColumnFamily<String, String> dataCf; private SimpleReverseIndexer(Builder builder) { indexCf = new ColumnFamily<String, IndexEntry>(builder.columnFamily + "_idx", StringSerializer.get(), EntrySerializer); dataCf = new ColumnFamily<String, String> (builder.columnFamily + "_data", StringSerializer.get(), StringSerializer.get()); keyspace = builder.keyspace; } @Override public Collection<String> findUnion(Map<String, String> tags) throws IndexerException { Set<String> ids = Sets.newHashSet(); MutationBatch mb = keyspace.prepareMutationBatch(); try { for (Row<String, IndexEntry> row : keyspace.prepareQuery(indexCf).getKeySlice(fieldsToSet(tags)).execute().getResult()) { ColumnListMutation<IndexEntry> mrow = null; IndexEntry previousEntry = null; for (Column<IndexEntry> column : row.getColumns()) { IndexEntry entry = column.getName(); if (previousEntry != null && entry.id == previousEntry.id) { if (mrow == null) mrow = mb.withRow(indexCf, row.getKey()); mrow.deleteColumn(previousEntry); } ids.add(entry.id); } } } catch (ConnectionException e) { throw new IndexerException("Failed to get tags : " + tags, e); } finally { try { mb.execute(); } catch (Exception e) { // OK to ignore } } return ids; } private Collection<String> fieldsToSet(Map<String, String> tags) { return Collections2.transform(tags.entrySet(), new Function<Entry<String, String>, String>() { public String apply(Entry<String, String> entry) { return entry.getKey() + "=" + entry.getValue(); } }); } @Override public Collection<String> findIntersection(Map<String, String> tags) throws IndexerException { Set<String> ids = Sets.newHashSet(); MutationBatch mb = keyspace.prepareMutationBatch(); try { boolean first = true; Set<Entry<String, String>> elements = tags.entrySet(); for (Row<String, IndexEntry> row : keyspace.prepareQuery(indexCf).getKeySlice(fieldsToSet(tags)).execute().getResult()) { Set<String> rowIds = Sets.newHashSet(); ColumnListMutation<IndexEntry> mrow = null; IndexEntry previousEntry = null; for (Column<IndexEntry> column : row.getColumns()) { IndexEntry entry = column.getName(); if (previousEntry != null && entry.id == previousEntry.id) { if (mrow == null) mrow = mb.withRow(indexCf, row.getKey()); mrow.deleteColumn(previousEntry); } rowIds.add(entry.id); } if (first) { first = false; ids = rowIds; } else { ids = Sets.intersection(ids, rowIds); if (ids.isEmpty()) return ids; } } } catch (ConnectionException e) { throw new IndexerException("Failed to get tags : " + tags, e); } finally { try { mb.execute(); } catch (ConnectionException e) { // OK to ignore } } return ids; } @Override public Collection<String> find(String field, String value) throws IndexerException { Set<String> ids = Sets.newHashSet(); String indexRowKey = field + "=" + value; MutationBatch mb = keyspace.prepareMutationBatch(); try { boolean first = true; ColumnList<IndexEntry> row = keyspace.prepareQuery(indexCf).getRow(indexRowKey).execute().getResult(); IndexEntry previousEntry = null; for (Column<IndexEntry> column : row) { IndexEntry entry = column.getName(); ColumnListMutation<IndexEntry> mrow = null; if (previousEntry != null && entry.id == previousEntry.id) { if (mrow == null) mrow = mb.withRow(indexCf, indexRowKey); mrow.deleteColumn(previousEntry); } else { ids.add(entry.id); } } } catch (ConnectionException e) { throw new IndexerException("Failed to get tag : " + indexRowKey, e); } finally { try { mb.execute(); } catch (ConnectionException e) { // OK to ignore } } return ids; } @Override public void tagId(String id, Map<String, String> tags) throws IndexerException { MutationBatch mb = keyspace.prepareMutationBatch(); ColumnListMutation<String> idRow = mb.withRow(dataCf, id); UUID uuid = TimeUUIDUtils.getUniqueTimeUUIDinMicros(); for (Map.Entry<String, String> tag : tags.entrySet()) { String rowkey = tag.getKey() + "=" + tag.getValue(); System.out.println("Rowkey: " + rowkey); mb.withRow(indexCf, tag.getKey() + "=" + tag.getValue()) .putEmptyColumn(new IndexEntry(id, uuid)); // idRow.putColumn(tag.getKey(), tag.getValue()); } try { mb.execute(); } catch (ConnectionException e) { throw new IndexerException("Failed to store tags : " + tags + " for id " + id, e); } } @Override public void removeId(String id) throws IndexerException { // TODO Auto-generated method stub } @Override public void createStorage() throws IndexerException { try { keyspace.createColumnFamily(indexCf, ImmutableMap.<String, Object>builder() .put("comparator_type", "CompositeType(UTF8Type, TimeUUIDType)") .build()); } catch (ConnectionException e) { e.printStackTrace(); } try { keyspace.createColumnFamily(dataCf, ImmutableMap.<String, Object>builder() .put("default_validation_class", "LongType") .put("key_validation_class", "UTF8Type") .put("comparator_type", "UTF8Type") .build()); } catch (ConnectionException e) { e.printStackTrace(); } } @Override public Map<String, String> getTags(String id) throws IndexerException { try { ColumnList<String> fields = keyspace.prepareQuery(dataCf).getRow(id).execute().getResult(); Map<String, String> mapped = Maps.newHashMap(); for (Column<String> column : fields) { mapped.put(column.getName(), column.getStringValue()); } return mapped; } catch (ConnectionException e) { throw new IndexerException("Failed to get tags for id " + id, e); } } } <|start_filename|>staash-core/src/main/java/com/netflix/paas/PaasModule.java<|end_filename|> /******************************************************************************* * /*** * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * ******************************************************************************/ package com.netflix.paas; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import org.apache.commons.configuration.AbstractConfiguration; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.google.common.eventbus.EventBus; import com.google.inject.AbstractModule; import com.google.inject.Scopes; import com.google.inject.TypeLiteral; import com.google.inject.matcher.Matchers; import com.google.inject.name.Names; import com.google.inject.spi.InjectionListener; import com.google.inject.spi.TypeEncounter; import com.google.inject.spi.TypeListener; import com.netflix.config.ConfigurationManager; import com.netflix.paas.config.ArchaeusPaasConfiguration; import com.netflix.paas.config.PaasConfiguration; import com.netflix.paas.dao.DaoProvider; import com.netflix.paas.resources.DataResource; import com.netflix.paas.resources.SchemaAdminResource; import com.netflix.paas.resources.impl.JerseySchemaAdminResourceImpl; import com.netflix.paas.service.SchemaService; import com.netflix.paas.services.impl.DaoSchemaService; import com.netflix.paas.tasks.InlineTaskManager; import com.netflix.paas.tasks.TaskManager; /** * Core bindings for PAAS. Anything configurable will be loaded by different modules * @author elandau * */ public class PaasModule extends AbstractModule { private static final Logger LOG = LoggerFactory.getLogger(PaasModule.class); private final EventBus eventBus = new EventBus("Default EventBus"); @Override protected void configure() { LOG.info("Loading PaasModule"); bind(EventBus.class).toInstance(eventBus); bindListener(Matchers.any(), new TypeListener() { public <I> void hear(TypeLiteral<I> typeLiteral, TypeEncounter<I> typeEncounter) { typeEncounter.register(new InjectionListener<I>() { public void afterInjection(I i) { eventBus.register(i); } }); } }); bind(TaskManager.class).to(InlineTaskManager.class); // Constants bind(String.class).annotatedWith(Names.named("namespace")).toInstance("com.netflix.pass."); bind(String.class).annotatedWith(Names.named("appname" )).toInstance("paas"); bind(AbstractConfiguration.class).toInstance(ConfigurationManager.getConfigInstance()); // Configuration bind(PaasConfiguration.class).to(ArchaeusPaasConfiguration.class).in(Scopes.SINGLETON); // Stuff bind(ScheduledExecutorService.class).annotatedWith(Names.named("tasks")).toInstance(Executors.newScheduledThreadPool(10)); bind(DaoProvider.class).in(Scopes.SINGLETON); // Rest resources bind(DataResource.class).in(Scopes.SINGLETON); bind(SchemaAdminResource.class).to(JerseySchemaAdminResourceImpl.class).in(Scopes.SINGLETON); bind(SchemaService.class).to(DaoSchemaService.class).in(Scopes.SINGLETON); } } <|start_filename|>staash-mesh/src/main/java/com/netflix/staash/mesh/jersey/MeshServerResource.java<|end_filename|> /******************************************************************************* * /*** * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * ******************************************************************************/ package com.netflix.staash.mesh.jersey; import java.util.List; import javax.ws.rs.DELETE; import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.PathParam; @Path("/1/mesh") public class MeshServerResource { /** * Return the list of topics and their metadata * @return */ @GET @Path("topic") public List<String> getTopics() { return null; } @GET @Path("topic/{name}") public void getTopicData(@PathParam("name") String topicName) { } /** * * @param topicName */ @POST @Path("topic/{name}") public void postTopic(@PathParam("name") String topicName) { } @POST @Path("topic/{name}/{key}") public void postTopicKey(@PathParam("name") String topicName, @PathParam("key") String key) { } @DELETE @Path("topic/{name}") public void deleteTopic(@PathParam("name") String topicName) { } @DELETE @Path("topic/{name}/{key}") public void deleteTopicKey(@PathParam("name") String topicName, @PathParam("key") String key) { } } <|start_filename|>staash-mesh/src/main/java/com/netflix/staash/mesh/endpoints/CircularEndpointPolicy.java<|end_filename|> /******************************************************************************* * /*** * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * ******************************************************************************/ package com.netflix.staash.mesh.endpoints; import java.util.Collections; import java.util.List; import com.google.common.collect.Lists; import com.netflix.staash.mesh.CompareInstanceInfoByUuid; import com.netflix.staash.mesh.InstanceInfo; public class CircularEndpointPolicy implements EndpointPolicy { private static final CompareInstanceInfoByUuid comparator = new CompareInstanceInfoByUuid(); private final int replicationFactor; public CircularEndpointPolicy(int replicationFactor) { this.replicationFactor = replicationFactor; } @Override public List<InstanceInfo> getEndpoints(InstanceInfo current, List<InstanceInfo> instances) { int position = Collections.binarySearch(instances, current, comparator); int size = instances.size(); List<InstanceInfo> endpoints = Lists.newArrayListWithCapacity(replicationFactor); int count = Math.max(size-1, replicationFactor); for (int i = 0; i < count; i++) { endpoints.add(instances.get((position + i) % size)); } return endpoints; } } <|start_filename|>staash-core/src/main/java/com/netflix/paas/entity/ClusterEntity.java<|end_filename|> /******************************************************************************* * /*** * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * ******************************************************************************/ package com.netflix.paas.entity; import java.util.Set; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import com.google.common.collect.Sets; @Entity(name="cluster") public class ClusterEntity { public static class Builder { private ClusterEntity entity = new ClusterEntity(); public Builder withName(String name) { entity.name = name; return this; } public Builder withNodes(Set<String> nodes) { entity.nodes = nodes; return this; } public Builder addNode(String node) { if (entity.nodes == null) entity.nodes = Sets.newHashSet(); entity.nodes.add(node); return this; } public ClusterEntity build() { return entity; } } public static Builder builder() { return new Builder(); } @Id @Column private String name; @Column private Set<String> nodes; public String getName() { return name; } public void setName(String name) { this.name = name; } public Set<String> getNodes() { return nodes; } public void setNodes(Set<String> nodes) { this.nodes = nodes; } } <|start_filename|>staash-core/src/main/java/com/netflix/paas/events/SchemaChangeEvent.java<|end_filename|> /******************************************************************************* * /*** * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * ******************************************************************************/ package com.netflix.paas.events; import com.netflix.paas.entity.DbEntity; /** * Event notifying that a schema has either been added, changed or removed * * @author elandau */ public class SchemaChangeEvent { private final DbEntity schema; private final boolean removed; public SchemaChangeEvent(DbEntity schema, boolean removed) { this.schema = schema; this.removed = removed; } public DbEntity getSchema() { return this.schema; } public boolean isExists() { return removed; } } <|start_filename|>staash-core/src/main/java/com/netflix/paas/entity/TableEntity.java<|end_filename|> /******************************************************************************* * /*** * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * ******************************************************************************/ package com.netflix.paas.entity; import java.util.Map; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import com.google.common.collect.Maps; /** * Definition for a table in the system. This definition provides this system will * all the information for connecting to the target persistence implementation * * @author elandau * */ @Entity public class TableEntity { public static class Builder { private TableEntity entity = new TableEntity(); public Builder withStorageType(String type) { entity.storageType = type; return this; } public Builder withTableName(String tableName) { entity.tableName = tableName; return this; } public Builder withSchemaName(String schema) { entity.schema = schema; return this; } public Builder withOptions(Map<String, String> options) { entity.options = options; return this; } public Builder withOption(String key, String value) { if (entity.options == null) { entity.options = Maps.newHashMap(); } entity.options.put(key, value); return this; } public TableEntity build() { return entity; } } public static Builder builder() { return new Builder(); } /** * Unique table name within the schema */ @Id private String tableName; /** * Type of storage for this table. (ex. cassandra) */ @Column(name="type") private String storageType; /** * Parent schema */ @Column(name="schema") private String schema; /** * Additional configuration options for the table. These parameters are normally * specific to the underlying persistence technology */ @Column(name="options") private Map<String, String> options; public String getTableName() { return tableName; } public void setTableName(String tableName) { this.tableName = tableName; } public String getStorageType() { return storageType; } public void setStorageType(String storageType) { this.storageType = storageType; } public Map<String, String> getOptions() { return options; } public void setOptions(Map<String, String> options) { this.options = options; } public String getOption(String option) { return getOption(option, null); } public String getOption(String key, String defaultValue) { if (this.options == null) return defaultValue; String value = options.get(key); if (value == null) return defaultValue; return value; } public String getSchema() { return schema; } public void setSchema(String schema) { this.schema = schema; } @Override public String toString() { return "VirtualTableEntity [tableName=" + tableName + ", storageType=" + storageType + ", schema=" + schema + ", options=" + options + "]"; } } <|start_filename|>staash-web/src/main/java/com/netflix/staash/web/GuiceServletConfig.java<|end_filename|> /******************************************************************************* * /* * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * * * ******************************************************************************/ package com.netflix.staash.web; import com.google.inject.Injector; import com.google.inject.servlet.GuiceServletContextListener; import com.netflix.governator.guice.LifecycleInjector; import com.netflix.staash.cassandra.discovery.EurekaModule; import com.netflix.staash.rest.modules.PaasPropertiesModule; import com.netflix.staash.rest.resources.StaashAdminResourceImpl; import com.netflix.staash.rest.resources.StaashDataResourceImpl; import com.sun.jersey.guice.JerseyServletModule; import com.sun.jersey.guice.spi.container.servlet.GuiceContainer; public class GuiceServletConfig extends GuiceServletContextListener { @Override protected Injector getInjector() { return LifecycleInjector.builder() .withModules( new EurekaModule(), new PaasPropertiesModule(), new JerseyServletModule() { @Override protected void configureServlets() { bind(GuiceContainer.class).asEagerSingleton(); bind(StaashAdminResourceImpl.class); bind(StaashDataResourceImpl.class); serve("/*").with(GuiceContainer.class); } } ) .createInjector(); } } <|start_filename|>staash-core/src/main/java/com/netflix/paas/entity/DbEntity.java<|end_filename|> /******************************************************************************* * /*** * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * ******************************************************************************/ package com.netflix.paas.entity; import java.util.Map; import java.util.Set; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.PrePersist; import javax.persistence.Transient; import com.google.common.collect.Maps; /** * Definition of a global schema in the system. A schema may contain * tables that are implemented using different technologies. * * @author elandau */ @Entity(name="db") public class DbEntity { public static class Builder { private DbEntity entity = new DbEntity(); public Builder withName(String name) { entity.name = name; return this; } public Builder addTable(TableEntity table) throws Exception { if (null == entity.getTables()) { entity.tables = Maps.newHashMap(); } entity.tables.put(table.getTableName(), table); return this; } public Builder withOptions(Map<String, String> options) { entity.options = options; return this; } public Builder addOption(String name, String value) { if (null == entity.getOptions()) { entity.options = Maps.newHashMap(); } entity.options.put(name, value); return this; } public DbEntity build() { return entity; } } public static Builder builder() { return new Builder(); } @Id private String name; @Column private Set<String> tableNames; @Column private Map<String, String> options; @Transient private Map<String, TableEntity> tables; public Map<String, String> getOptions() { return options; } public void setOptions(Map<String, String> options) { this.options = options; } @PrePersist private void prePersist() { } public void setName(String name) { this.name = name; } public String getName() { return name; } public void setTables(Map<String, TableEntity> tables) { this.tables = tables; } public Map<String, TableEntity> getTables() { return tables; } public void setTableNames(Set<String> tableNames) { this.tableNames = tableNames; } public Set<String> getTableNames() { return tableNames; } public boolean hasTables() { return this.tables != null && !this.tables.isEmpty(); } @Override public String toString() { return "SchemaEntity [name=" + name + ", tables=" + tables + "]"; } } <|start_filename|>staash-astyanax/src/main/java/com/netflix/paas/cassandra/entity/CassandraClusterEntity.java<|end_filename|> /******************************************************************************* * /*** * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * ******************************************************************************/ package com.netflix.paas.cassandra.entity; import java.util.Collection; import java.util.Map; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import org.apache.commons.lang.StringUtils; import com.google.common.base.Preconditions; import com.google.common.base.Predicate; import com.google.common.collect.Collections2; import com.google.common.collect.Lists; @Entity public class CassandraClusterEntity { public static class Builder { private final CassandraClusterEntity entity = new CassandraClusterEntity(); public Builder withName(String name) { entity.clusterName = name; return this; } public Builder withIsEnabled(Boolean enabled) { entity.enabled = enabled; return this; } public Builder withDiscoveryType(String discoveryType) { entity.discoveryType = discoveryType; return this; } public CassandraClusterEntity build() { Preconditions.checkNotNull(entity.clusterName); return this.entity; } } public static Builder builder() { return new Builder(); } @Id private String clusterName; @Column private Map<String, String> keyspaces; @Column private Map<String, String> columnFamilies; @Column(name="enabled") private boolean enabled = true; @Column(name="discovery") private String discoveryType; public String getClusterName() { return clusterName; } public void setClusterName(String clusterName) { this.clusterName = clusterName; } public Map<String, String> getKeyspaces() { return keyspaces; } public void setKeyspaces(Map<String, String> keyspaces) { this.keyspaces = keyspaces; } public boolean isEnabled() { return enabled; } public void setEnabled(boolean enabled) { this.enabled = enabled; } public Collection<String> getColumnFamilyNames() { if (this.columnFamilies == null) return Lists.newArrayList(); return columnFamilies.keySet(); } public Collection<String> getKeyspaceNames() { if (this.keyspaces == null) return Lists.newArrayList(); return keyspaces.keySet(); } public Collection<String> getKeyspaceColumnFamilyNames(final String keyspaceName) { return Collections2.filter(this.columnFamilies.keySet(), new Predicate<String>() { @Override public boolean apply(String cfName) { return StringUtils.startsWith(cfName, keyspaceName + "|"); } }); } public Map<String, String> getColumnFamilies() { return columnFamilies; } public void setColumnFamilies(Map<String, String> columnFamilies) { this.columnFamilies = columnFamilies; } public String getDiscoveryType() { return discoveryType; } public void setDiscoveryType(String discoveryType) { this.discoveryType = discoveryType; } } <|start_filename|>staash-svc/src/test/java/com/netflix/paas/rest/test/TestPaasPropertiesModule.java<|end_filename|> package com.netflix.paas.rest.test; import java.net.URL; import java.util.Properties; import com.datastax.driver.core.Cluster; import com.datastax.driver.core.policies.RoundRobinPolicy; import com.datastax.driver.core.policies.TokenAwarePolicy; import com.google.inject.AbstractModule; import com.google.inject.Provides; import com.google.inject.Singleton; import com.google.inject.name.Named; import com.google.inject.name.Names; import com.netflix.astyanax.AstyanaxContext; import com.netflix.astyanax.Keyspace; import com.netflix.astyanax.connectionpool.NodeDiscoveryType; import com.netflix.astyanax.connectionpool.impl.ConnectionPoolConfigurationImpl; import com.netflix.astyanax.connectionpool.impl.ConnectionPoolType; import com.netflix.astyanax.connectionpool.impl.CountingConnectionPoolMonitor; import com.netflix.astyanax.impl.AstyanaxConfigurationImpl; import com.netflix.astyanax.thrift.ThriftFamilyFactory; import com.netflix.staash.cassandra.discovery.EurekaAstyanaxHostSupplier; import com.netflix.staash.connection.ConnectionFactory; import com.netflix.staash.connection.PaasConnectionFactory; import com.netflix.staash.rest.dao.AstyanaxDataDaoImpl; import com.netflix.staash.rest.dao.AstyanaxMetaDaoImpl; import com.netflix.staash.rest.dao.CqlDataDaoImpl; import com.netflix.staash.rest.dao.CqlMetaDaoImpl; import com.netflix.staash.rest.dao.CqlMetaDaoImplNew; import com.netflix.staash.rest.dao.DataDao; import com.netflix.staash.rest.dao.MetaDao; import com.netflix.staash.rest.util.HostSupplier; import com.netflix.staash.rest.util.MetaConstants; import com.netflix.staash.service.CacheService; import com.netflix.staash.service.DataService; import com.netflix.staash.service.MetaService; import com.netflix.staash.service.PaasDataService; import com.netflix.staash.service.PaasMetaService; public class TestPaasPropertiesModule extends AbstractModule { @Override protected void configure() { try { Properties props = loadProperties(); Names.bindProperties(binder(), props); } catch (Exception e) { e.printStackTrace(); } } private static Properties loadProperties() throws Exception { Properties properties = new Properties(); ClassLoader loader = TestPaasPropertiesModule.class.getClassLoader(); URL url = loader.getResource("paas.properties"); properties.load(url.openStream()); return properties; } @Provides @Named("metacluster") Cluster provideCluster(@Named("paas.cassclient") String clientType,@Named("paas.metacluster") String clustername) { if (clientType.equals("cql")) { Cluster cluster = Cluster.builder().addContactPoint(clustername).build(); return cluster; } else return null; } @Provides HostSupplier provideHostSupplier(@Named("paas.metacluster") String clustername) { return null; } @Provides @Named("astmetaks") @Singleton Keyspace provideKeyspace(@Named("paas.metacluster") String clustername) { String clusterNameOnly = ""; String clusterPortOnly = ""; String[] clusterinfo = clustername.split(":"); if (clusterinfo != null && clusterinfo.length == 2) { clusterNameOnly = clusterinfo[0]; clusterPortOnly = clusterinfo[1]; } else { clusterNameOnly = clustername; clusterPortOnly = "9160"; } // hs = new EurekaAstyanaxHostSupplier(); AstyanaxContext<Keyspace> keyspaceContext = new AstyanaxContext.Builder() .forCluster(clusterNameOnly) .forKeyspace(MetaConstants.META_KEY_SPACE) .withAstyanaxConfiguration( new AstyanaxConfigurationImpl() .setDiscoveryType( NodeDiscoveryType.RING_DESCRIBE) .setConnectionPoolType( ConnectionPoolType.TOKEN_AWARE) .setDiscoveryDelayInSeconds(60000) .setTargetCassandraVersion("1.1") .setCqlVersion("3.0.0")) // .withHostSupplier(hs.getSupplier(clustername)) .withConnectionPoolConfiguration( new ConnectionPoolConfigurationImpl(clusterNameOnly + "_" + MetaConstants.META_KEY_SPACE) .setSocketTimeout(3000) .setMaxTimeoutWhenExhausted(2000) .setMaxConnsPerHost(3).setInitConnsPerHost(1) .setSeeds(clusterNameOnly+":"+clusterPortOnly)) //uncomment for localhost .withConnectionPoolMonitor(new CountingConnectionPoolMonitor()) .buildKeyspace(ThriftFamilyFactory.getInstance()); keyspaceContext.start(); Keyspace keyspace; keyspace = keyspaceContext.getClient(); return keyspace; } @Provides @Named("datacluster") Cluster provideDataCluster(@Named("paas.datacluster") String clustername) { Cluster cluster = Cluster.builder().addContactPoint(clustername).build(); return cluster; } @Provides @Singleton MetaDao provideCqlMetaDao(@Named("paas.cassclient") String clientType, @Named("metacluster") Cluster cluster,@Named("astmetaks") Keyspace keyspace) { if (clientType.equals("cql")) return new CqlMetaDaoImpl(cluster ); else return new AstyanaxMetaDaoImpl(keyspace); } @Provides DataDao provideCqlDataDao(@Named("paas.cassclient") String clientType, @Named("datacluster") Cluster cluster, MetaDao meta) { if (clientType.equals("cql")) return new CqlDataDaoImpl(cluster, meta); else return new AstyanaxDataDaoImpl(); } @Provides @Named("pooledmetacluster") Cluster providePooledCluster(@Named("paas.cassclient") String clientType,@Named("paas.metacluster") String clustername) { if (clientType.equals("cql")) { Cluster cluster = Cluster.builder().withLoadBalancingPolicy(new TokenAwarePolicy(new RoundRobinPolicy())).addContactPoint(clustername).build(); // Cluster cluster = Cluster.builder().addContactPoint(clustername).build(); return cluster; }else { return null; } } @Provides @Named("newmetadao") @Singleton MetaDao provideCqlMetaDaoNew(@Named("paas.cassclient") String clientType, @Named("metacluster") Cluster cluster, @Named("astmetaks") Keyspace keyspace) { if (clientType.equals("cql")) return new CqlMetaDaoImplNew(cluster ); else return new AstyanaxMetaDaoImpl(keyspace); } @Provides MetaService providePaasMetaService(@Named("newmetadao") MetaDao metad, ConnectionFactory fac, CacheService cache) { PaasMetaService metasvc = new PaasMetaService(metad, fac, cache); return metasvc; } @Provides DataService providePaasDataService( MetaService metasvc, ConnectionFactory fac) { PaasDataService datasvc = new PaasDataService(metasvc, fac); return datasvc; } @Provides CacheService provideCacheService(@Named("newmetadao") MetaDao metad) { return new CacheService(metad); } @Provides ConnectionFactory provideConnectionFactory(@Named("paas.cassclient") String clientType, EurekaAstyanaxHostSupplier hs) { return new PaasConnectionFactory(clientType, hs); } } <|start_filename|>staash-svc/src/main/java/com/netflix/staash/rest/util/MetaConstants.java<|end_filename|> /******************************************************************************* * /* * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * * * ******************************************************************************/ package com.netflix.staash.rest.util; public interface MetaConstants { public static final String CASSANDRA_KEYSPACE_ENTITY_TYPE = "com.netflix.entity.type.cassandra.keyspace"; public static final String STAASH_TABLE_ENTITY_TYPE = "com.netflix.entity.type.staash.table"; public static final String STAASH_STORAGE_TYPE_ENTITY = "com.netflix.entity.type.staash.storage"; public static final String STAASH_DB_ENTITY_TYPE = "com.netflix.entity.type.staash.db"; public static final String STAASH_TS_ENTITY_TYPE = "com.netflix.entity.type.staash.timeseries"; public static final String STAASH_KV_ENTITY_TYPE = "com.netflix.entity.type.staash.keyvaluestore"; public static final String CASSANDRA_CF_TYPE = "com.netflix.entity.type.cassandra.columnfamily"; public static final String CASSANDRA_TIMESERIES_TYPE = "com.netflix.entity.type.cassandra.timeseries"; public static final String PAAS_CLUSTER_ENTITY_TYPE = "com.netflix.entity.type.staash.table"; public static final String STORAGE_TYPE = "com.netflix.trait.type.storagetype"; public static final String RESOLUTION_TYPE = "com.netflix.trait.type.resolutionstring"; public static final String NAME_TYPE = "com.netflix.trait.type.name"; public static final String RF_TYPE = "com.netflix.trait.type.replicationfactor"; public static final String STRATEGY_TYPE = "com.netflix.trait.type.strategy"; public static final String COMPARATOR_TYPE = "com.netflix.trait.type.comparator"; public static final String KEY_VALIDATION_CLASS_TYPE = "com.netflix.trait.type.key_validation_class"; public static final String COLUMN_VALIDATION_CLASS_TYPE = "com.netflix.trait.type.validation_class"; public static final String DEFAULT_VALIDATION_CLASS_TYPE = "com.netflix.trait.type.default_validation_class"; public static final String COLUMN_NAME_TYPE = "com.netflix.trait.type.colum_name"; public static final String CONTAINS_TYPE = "com.netflix.relation.type.contains"; public static final String PERIOD_TIME_SERIES = "period"; public static final String PREFIX_TIME_SERIES = "prefix"; public static final String META_KEY_SPACE = "staashmetaks_cde"; public static final String META_COLUMN_FAMILY = "staashmetacf_cde"; } <|start_filename|>staash-core/src/test/java/com/netflix/paas/ArchaeusPassConfigurationTest.java<|end_filename|> /******************************************************************************* * /*** * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * ******************************************************************************/ package com.netflix.paas; import java.lang.reflect.Method; import org.apache.commons.lang.time.StopWatch; import org.junit.Ignore; import org.junit.Test; import com.google.inject.AbstractModule; import com.google.inject.Guice; import com.google.inject.Injector; import com.google.inject.ProvidedBy; import com.google.inject.Provider; import com.netflix.config.ConfigurationManager; import com.netflix.paas.config.annotations.Configuration; import com.netflix.paas.config.annotations.DefaultValue; import com.netflix.paas.config.annotations.Dynamic; import com.netflix.paas.config.base.CglibArchaeusConfigurationFactory; import com.netflix.paas.config.base.DynamicProxyArchaeusConfigurationFactory; import com.netflix.paas.config.base.JavaAssistArchaeusConfigurationFactory; public class ArchaeusPassConfigurationTest { public class TestProxyProvider<T> implements Provider<T> { private Class<T> type; public TestProxyProvider(Class<T> type) { this.type = type; } @Override public T get() { System.out.println("TestProxyProvider " + type.getCanonicalName()); return null; } } public interface MyConfig { @Configuration(value="test.property.dynamic.string") @Dynamic @DefaultValue("DefaultA") String getDynamicString(); @Configuration(value="test.property.dynamic.int") @DefaultValue("123") @Dynamic Integer getDynamicInt(); @Configuration(value="test.property.dynamic.boolean") @DefaultValue("true") @Dynamic Boolean getDynamicBoolean(); @Configuration(value="test.property.dynamic.long") @DefaultValue("456") @Dynamic Long getDynamicLong(); @Configuration(value="test.property.dynamic.double") @DefaultValue("1.2") @Dynamic Double getDynamicDouble(); // @Configuration(value="test.property.supplier.string", defaultValue="suppliedstring", dynamic=true) // Supplier<String> getDynamicStringSupplier(); @Configuration(value="test.property.static.string") @DefaultValue("DefaultA") String getStaticString(); @Configuration(value="test.property.static.int") @DefaultValue("123") Integer getStaticInt(); @Configuration(value="test.property.static.boolean") @DefaultValue("true") Boolean getStaticBoolean(); @Configuration(value="test.property.static.long") @DefaultValue("456") Long getStaticLong(); @Configuration(value="test.property.static.double") @DefaultValue("1.2") Double getStaticDouble(); } @Test @Ignore public void test() throws Exception { MyConfig config = new DynamicProxyArchaeusConfigurationFactory().get(MyConfig.class); System.out.println("----- BEFORE -----"); printContents(config); ConfigurationManager.getConfigInstance().setProperty("test.property.dynamic.string", "NewA"); ConfigurationManager.getConfigInstance().setProperty("test.property.dynamic.int", "321"); ConfigurationManager.getConfigInstance().setProperty("test.property.dynamic.boolean", "false"); ConfigurationManager.getConfigInstance().setProperty("test.property.dynamic.long", "654"); ConfigurationManager.getConfigInstance().setProperty("test.property.dynamic.double", "2.1"); ConfigurationManager.getConfigInstance().setProperty("test.property.static.string", "NewA"); ConfigurationManager.getConfigInstance().setProperty("test.property.static.int", "321"); ConfigurationManager.getConfigInstance().setProperty("test.property.static.boolean", "false"); ConfigurationManager.getConfigInstance().setProperty("test.property.static.long", "654"); ConfigurationManager.getConfigInstance().setProperty("test.property.static.double", "2.1"); System.out.println("----- AFTER -----"); printContents(config); // Supplier<String> supplier = config.getDynamicStringSupplier(); // System.out.println("Supplier value : " + supplier.get()); int count = 1000000; MyConfig configDynamicProxy = new DynamicProxyArchaeusConfigurationFactory().get(MyConfig.class); MyConfig configJavaAssixt = new JavaAssistArchaeusConfigurationFactory().get(MyConfig.class); MyConfig configCglib = new CglibArchaeusConfigurationFactory().get(MyConfig.class); for (int i = 0; i < 10; i++) { System.out.println("==== Run " + i + " ===="); timeConfig(configDynamicProxy, "Dynamic Proxy", count); timeConfig(configJavaAssixt, "Java Assist ", count); timeConfig(configCglib, "CGLIB ", count); } } @Test @Ignore public void testWithInjection() { Injector injector = Guice.createInjector(new AbstractModule() { @Override protected void configure() { bind(MyConfig.class).toProvider(new TestProxyProvider<MyConfig>(MyConfig.class)); } }); MyConfig config = injector.getInstance(MyConfig.class); } void timeConfig(MyConfig config, String name, int count) { StopWatch sw = new StopWatch(); sw.start(); for (int i = 0; i < count; i++) { for (Method method : MyConfig.class.getMethods()) { try { Object value = method.invoke(config); // System.out.println(name + " " + method.getName() + " " + value); } catch (Exception e) { e.printStackTrace(); } } } System.out.println(name + " took " + sw.getTime()); } void printContents(MyConfig config) { for (Method method : MyConfig.class.getMethods()) { try { System.out.println(method.getName() + " " + method.invoke(config)); } catch (Exception e) { e.printStackTrace(); } } } } <|start_filename|>staash-mesh/src/test/java/com/netflix/paas/ptp/DummyTopicSeed.java<|end_filename|> /******************************************************************************* * /*** * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * ******************************************************************************/ package com.netflix.paas.ptp; import com.netflix.staash.mesh.db.Entry; import com.netflix.staash.mesh.db.TopicRegistry; import com.netflix.staash.mesh.db.memory.MemoryTopicFactory; import com.netflix.staash.mesh.seed.TopicSeed; public class DummyTopicSeed implements TopicSeed { private static final String TOPIC_NAME = "test"; public DummyTopicSeed() { final TopicRegistry topics = new TopicRegistry(new MemoryTopicFactory()); topics.createTopic(TOPIC_NAME); topics.addEntry(TOPIC_NAME, new Entry("Key1", "Value1", System.currentTimeMillis())); topics.addEntry(TOPIC_NAME, new Entry("Key2", "Value2", System.currentTimeMillis())); } } <|start_filename|>staash-svc/src/test/java/com/netflix/paas/rest/test/TimeSeriesTest.java<|end_filename|> package com.netflix.paas.rest.test; import org.junit.Before; import org.junit.Test; public class TimeSeriesTest { public static final String STAASH_URL = "http://localhost:8080/staash/v1/data/timeseries"; public static final String TIME_SERIES = "timeseries"; public static final String DB = "timeseriesdb"; public static final Integer INSERTION_SIZE = 10000; public static final Integer PERIODICITY = 3600000; public static final String START_DATE = "01-01-2014"; public static final String Start_Time = "00:00:00"; public static final String End_Time = "23:59:59"; @Before public void setup() { } @Test public void insert() { } @Test public void read() { } } <|start_filename|>staash-core/src/main/java/com/netflix/paas/resources/impl/JerseySchemaDataResourceImpl.java<|end_filename|> /******************************************************************************* * /*** * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * ******************************************************************************/ package com.netflix.paas.resources.impl; import javax.ws.rs.Consumes; import javax.ws.rs.DELETE; import javax.ws.rs.DefaultValue; import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.QueryParam; import javax.ws.rs.core.MediaType; import com.google.inject.Inject; import com.netflix.paas.dao.DaoProvider; import com.netflix.paas.data.QueryResult; import com.netflix.paas.data.RowData; import com.netflix.paas.exceptions.NotFoundException; import com.netflix.paas.exceptions.PaasException; import com.netflix.paas.json.JsonObject; import com.netflix.paas.meta.dao.MetaDao; import com.netflix.paas.resources.PaasDataResource; import com.netflix.paas.resources.TableDataResource; public class JerseySchemaDataResourceImpl implements PaasDataResource { private DaoProvider provider; private MetaDao metadao; @Inject public JerseySchemaDataResourceImpl(DaoProvider provider, MetaDao meta) { this.provider = provider; this.metadao = meta; } @Override @GET public String listSchemas() { // TODO Auto-generated method stub return "hello data"; } @Override @GET @Path("{db}/{table}/{keycol}/{key}") public String listRow(@PathParam("db") String db, @PathParam("table") String table, @PathParam("keycol") String keycol,@PathParam("key") String key) { return metadao.listRow(db, table, keycol, key); } @Override @POST @Path("{db}/{table}") @Consumes(MediaType.TEXT_PLAIN) public void updateRow(@PathParam("db") String db, @PathParam("table") String table, String rowObject) { metadao.writeRow(db, table, new JsonObject(rowObject)); // TODO Auto-generated method stub } } <|start_filename|>staash-svc/src/main/java/com/netflix/staash/cassandra/discovery/EurekaModule.java<|end_filename|> /******************************************************************************* * /* * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * * * ******************************************************************************/ package com.netflix.staash.cassandra.discovery; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.google.inject.AbstractModule; import com.google.inject.multibindings.MapBinder; import com.netflix.appinfo.CloudInstanceConfig; import com.netflix.discovery.DefaultEurekaClientConfig; import com.netflix.discovery.DiscoveryManager; public class EurekaModule extends AbstractModule { private static final Logger LOG = LoggerFactory.getLogger(EurekaModule.class); @Override protected void configure() { LOG.info("Configuring EurekaModule"); DiscoveryManager.getInstance().initComponent( new CloudInstanceConfig(), new DefaultEurekaClientConfig()); // Eureka - Astyanax integration MapBinder<String, HostSupplierProvider> hostSuppliers = MapBinder.newMapBinder(binder(), String.class, HostSupplierProvider.class); hostSuppliers.addBinding("eureka").to(EurekaAstyanaxHostSupplier.class).asEagerSingleton(); //bind(ClusterDiscoveryService.class).to(EurekaClusterDiscoveryService.class).asEagerSingleton(); } } <|start_filename|>staash-svc/src/main/java/com/netflix/staash/common/query/QueryUtils.java<|end_filename|> /******************************************************************************* * /* * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * * * ******************************************************************************/ package com.netflix.staash.common.query; import java.sql.ResultSet; import java.sql.ResultSetMetaData; import java.sql.SQLException; import java.util.Collection; import java.util.List; import java.lang.RuntimeException; import com.datastax.driver.core.ColumnDefinitions; import com.datastax.driver.core.Row; import com.netflix.astyanax.cql.CqlStatementResult; import com.netflix.astyanax.model.ColumnFamily; import com.netflix.astyanax.model.ColumnList; import com.netflix.astyanax.model.Rows; import com.netflix.astyanax.serializers.StringSerializer; import com.netflix.staash.json.JsonObject; import com.netflix.staash.model.StorageType; public class QueryUtils { public static String formatColumns(String columnswithtypes, StorageType stype) { // TODO Auto-generated method stub String[] allCols = columnswithtypes.split(","); String outputCols = ""; for (String col:allCols) { String type; String name; if (!col.contains(":")) { if (stype!=null && stype.getCannonicalName().equals(StorageType.MYSQL.getCannonicalName())) type = "varchar(256)"; else type="text"; name=col; } else { name = col.split(":")[0]; type = col.split(":")[1]; } outputCols = outputCols + name + " " + type +","; } return outputCols; } public static String formatQueryResult(ResultSet rs) { try { JsonObject fullResponse = new JsonObject(); int rcount = 1; while (rs.next()) { ResultSetMetaData rsmd = rs.getMetaData(); String columns =""; String values = ""; int count = rsmd.getColumnCount(); for (int i=1;i<=count;i++) { String colName = rsmd.getColumnName(i); columns = columns + colName + ","; String value = rs.getString(i); values = values + value +","; } JsonObject response = new JsonObject(); response.putString("columns", columns.substring(0, columns.length()-1)); response.putString("values", values.substring(0, values.length()-1)); fullResponse.putObject("row"+rcount++, response); } return fullResponse.toString(); } catch (SQLException e) { // TODO Auto-generated catch block //e.printStackTrace(); throw new RuntimeException(e); } } public static String formatQueryResult(com.datastax.driver.core.ResultSet rs) { // TODO Auto-generated method stub String colStr = ""; String rowStr = ""; JsonObject response = new JsonObject(); List<Row> rows = rs.all(); if (!rows.isEmpty() && rows.size() == 1) { rowStr = rows.get(0).toString(); } ColumnDefinitions colDefs = rs.getColumnDefinitions(); colStr = colDefs.toString(); response.putString("columns", colStr.substring(8, colStr.length() - 1)); response.putString("values", rowStr.substring(4, rowStr.length() - 1)); return response.toString(); } public static String formatQueryResult(CqlStatementResult rs, String cfname) { // TODO Auto-generated method stub String value = ""; JsonObject response = new JsonObject(); ColumnFamily<String, String> cf = ColumnFamily .newColumnFamily(cfname, StringSerializer.get(), StringSerializer.get()); Rows<String, String> rows = rs.getRows(cf); int rcount = 1; for (com.netflix.astyanax.model.Row<String, String> row : rows) { ColumnList<String> columns = row.getColumns(); Collection<String> colnames = columns.getColumnNames(); String rowStr = ""; String colStr = ""; if (colnames.contains("key") && colnames.contains("column1")) { colStr = colStr + columns.getDateValue("column1", null).toGMTString(); rowStr = rowStr + columns.getStringValue("value", null); response.putString(colStr, rowStr); } else { JsonObject rowObj = new JsonObject(); for (String colName:colnames) { //colStr = colStr+colname+","; value = columns.getStringValue(colName, null); //rowStr=rowStr+value+","; rowObj.putString(colName, value); } //rowobj.putString("columns", colStr); //rowobj.putString("values", rowStr); response.putObject(""+rcount++, rowObj); } } return response.toString(); } } <|start_filename|>staash-core/src/main/java/com/netflix/paas/resources/PaasDataResource.java<|end_filename|> /******************************************************************************* * /*** * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * ******************************************************************************/ package com.netflix.paas.resources; import javax.ws.rs.Consumes; import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.core.MediaType; import com.netflix.paas.exceptions.PaasException; import com.netflix.paas.json.JsonObject; @Path("/v1/data") public interface PaasDataResource { @POST @Path("{db}/{table}") @Consumes(MediaType.TEXT_PLAIN) public void updateRow( @PathParam("db") String db, @PathParam("table") String table, String rowData ) ; @GET @Path("{db}/{table}/{keycol}/{key}") public String listRow(@PathParam("db") String db, @PathParam("table") String table, @PathParam("keycol") String keycol,@PathParam("key") String key); String listSchemas(); } <|start_filename|>staash-core/src/main/java/com/netflix/paas/services/impl/DaoSchemaService.java<|end_filename|> /******************************************************************************* * /*** * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * ******************************************************************************/ package com.netflix.paas.services.impl; import java.util.Collection; import java.util.List; import java.util.Map; import java.util.Map.Entry; import javax.annotation.PostConstruct; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.google.common.eventbus.EventBus; import com.google.inject.Inject; import com.google.inject.name.Named; import com.netflix.paas.SchemaNames; import com.netflix.paas.dao.Dao; import com.netflix.paas.dao.DaoProvider; import com.netflix.paas.entity.PassGroupConfigEntity; import com.netflix.paas.entity.DbEntity; import com.netflix.paas.entity.TableEntity; import com.netflix.paas.events.SchemaChangeEvent; import com.netflix.paas.resources.DataResource; import com.netflix.paas.service.SchemaService; /** * Schema registry using a persistent DAO * * @author elandau * */ public class DaoSchemaService implements SchemaService { private final static Logger LOG = LoggerFactory.getLogger(DaoSchemaService.class); private final DaoProvider daoProvider; private final String groupName; private final EventBus eventBus; private Dao<PassGroupConfigEntity> groupDao; private Dao<DbEntity> schemaDao; private Map<String, DbEntity> schemas; @Inject public DaoSchemaService(@Named("groupName") String groupName, DataResource dataResource, DaoProvider daoProvider, EventBus eventBus) { this.daoProvider = daoProvider; this.groupName = groupName; this.eventBus = eventBus; } @PostConstruct public void initialize() throws Exception { LOG.info("Initializing"); groupDao = daoProvider.getDao(SchemaNames.CONFIGURATION.name(), PassGroupConfigEntity.class); schemaDao = daoProvider.getDao(SchemaNames.CONFIGURATION.name(), DbEntity.class); try { refresh(); } catch (Exception e) { LOG.error("Error refreshing schema list", e); } } @Override public List<DbEntity> listSchema() { // return ImmutableList.copyOf(this.dao.list()); return null; } @Override public List<TableEntity> listSchemaTables(String schemaName) { return null; } @Override public List<TableEntity> listAllTables() { return null; } /** * Refresh the schema list from the DAO */ @Override public void refresh() { LOG.info("Refreshing schema list for group: " + groupName); PassGroupConfigEntity group = groupDao.read(groupName); if (group == null) { LOG.error("Failed to load configuration for group: " + groupName); } else { Collection<DbEntity> foundEntities = schemaDao.read(group.getSchemas()); if (foundEntities.isEmpty()) { LOG.warn("Not virtual schemas associated with group: " + groupName); } else { for (DbEntity entity : foundEntities) { LOG.info("Found schema : " + entity.getName()); if (entity.hasTables()) { for (Entry<String, TableEntity> table : entity.getTables().entrySet()) { LOG.info(" Found table : " + table.getKey()); } } eventBus.post(new SchemaChangeEvent(entity, false)); } } } } } <|start_filename|>staash-mesh/src/main/java/com/netflix/staash/mesh/server/MemoryServer.java<|end_filename|> /******************************************************************************* * /*** * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * ******************************************************************************/ package com.netflix.staash.mesh.server; import java.util.Collections; import java.util.List; import java.util.Map; import java.util.SortedMap; import java.util.UUID; import java.util.Map.Entry; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.atomic.AtomicLong; import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.google.inject.Inject; import com.netflix.staash.mesh.CompareInstanceInfoByUuid; import com.netflix.staash.mesh.InstanceInfo; import com.netflix.staash.mesh.InstanceRegistry; import com.netflix.staash.mesh.client.Client; import com.netflix.staash.mesh.client.ClientFactory; import com.netflix.staash.mesh.db.TopicRegistry; import com.netflix.staash.mesh.db.memory.MemoryTopicFactory; import com.netflix.staash.mesh.endpoints.EndpointPolicy; import com.netflix.staash.mesh.messages.AsyncResponse; import com.netflix.staash.mesh.messages.Message; import com.netflix.staash.mesh.messages.RequestHandler; import com.netflix.staash.mesh.messages.Verb; import com.netflix.staash.mesh.server.handlers.DataPushHandler; import com.netflix.staash.mesh.server.handlers.DataRequestHandler; import com.netflix.staash.mesh.server.handlers.DataResponseHandler; import com.netflix.staash.mesh.server.handlers.DigestRequestHandler; import com.netflix.staash.mesh.server.handlers.DigestResponseHandler; public class MemoryServer implements Server, RequestHandler { private static final CompareInstanceInfoByUuid comparator = new CompareInstanceInfoByUuid(); private static final AtomicLong changeCounter = new AtomicLong(); private final InstanceRegistry instanceRegistry; private final ClientFactory clientFactory; private final ScheduledExecutorService executor = Executors.newScheduledThreadPool(2); private final InstanceInfo instanceInfo; private final EndpointPolicy endpointPolicy; private final SortedMap<InstanceInfo, Client> peers = Maps.newTreeMap(comparator); private long generationCounter = 0; private Map<Verb, RequestHandler> verbHandlers = Maps.newEnumMap(Verb.class); private TopicRegistry topics = new TopicRegistry(new MemoryTopicFactory()); @Inject public MemoryServer(InstanceRegistry instanceRegistry, ClientFactory clientFactory, EndpointPolicy endpointPolicy, String id) { this.instanceRegistry = instanceRegistry; this.clientFactory = clientFactory; this.instanceInfo = new InstanceInfo(id, UUID.randomUUID()); this.endpointPolicy = endpointPolicy; verbHandlers.put(Verb.DATA_PUSH, new DataPushHandler()); verbHandlers.put(Verb.DATA_REQUEST, new DataRequestHandler()); verbHandlers.put(Verb.DATA_RESPONSE, new DataResponseHandler()); verbHandlers.put(Verb.DIGEST_REQUEST, new DigestRequestHandler()); verbHandlers.put(Verb.DIGEST_RESPONSE, new DigestResponseHandler()); } public void start() { System.out.println("Starting " + instanceInfo); this.instanceRegistry.join(instanceInfo); // executor.scheduleAtFixedRate( // new RefreshRingRunnable(this, instanceRegistry), // 10, 10, TimeUnit.SECONDS); } public void stop() { System.out.println("Stopping " + instanceInfo); this.instanceRegistry.leave(instanceInfo); } /** * Update the list of all members in the ring * @param ring */ public void setMembers(List<InstanceInfo> ring) { List<InstanceInfo> instances = endpointPolicy.getEndpoints(instanceInfo, ring); Collections.sort(instances, comparator); List<InstanceInfo> toRemove = Lists.newArrayList(); List<InstanceInfo> toAdd = Lists.newArrayList(); List<InstanceInfo> toDisconnect = Lists.newArrayList(); int changeCount = 0; for (Entry<InstanceInfo, Client> peer : peers.entrySet()) { // Determine if peers have been removed from the ring if (Collections.binarySearch(ring, peer.getKey(), comparator) < 0) { toRemove.add(peer.getKey()); changeCount++; } // Determine if peers are no longer appropriate else if (Collections.binarySearch(instances, peer.getKey(), comparator) < 0) { toDisconnect.add(peer.getKey()); changeCount++; } } // Add new peers for (InstanceInfo peer : instances) { if (!peers.containsKey(peer)) { toAdd.add(peer); changeCount++; } } for (InstanceInfo ii : toRemove) { removePeer(ii); } for (InstanceInfo ii : toDisconnect) { disconnectPeer(ii); } for (InstanceInfo ii : toAdd) { addPeer(ii); } generationCounter++; if (generationCounter > 1 && changeCount != 0) printPeers(changeCount); } /** * Remove a peer that is no longer in the ring. * @param instanceInfo */ private void removePeer(InstanceInfo instanceInfo) { System.out.println("Removing peer " + this.instanceInfo + " -> " + instanceInfo); Client client = peers.remove(instanceInfo); client.shutdown(); } /** * Add a new peer connection * @param instanceInfo */ private void addPeer(InstanceInfo instanceInfo) { // System.out.println("Adding peer " + this.instanceInfo + " -> " + instanceInfo); Client client = clientFactory.createClient(instanceInfo); peers.put(instanceInfo, client); boostrapClient(client); } /** * Disconnect a peer that is no longer in our path * @param instanceInfo */ private void disconnectPeer(InstanceInfo instanceInfo) { System.out.println("Disconnect peer " + this.instanceInfo + " -> " + instanceInfo); Client client = peers.remove(instanceInfo); if (client != null) { client.shutdown(); } else { System.out.println(instanceInfo + " > " + peers); } } /** * List all peers to which this server is connected * @return */ public Iterable<InstanceInfo> listPeers() { return peers.keySet(); } private void boostrapClient(Client client) { } private void printPeers(int changeCount) { changeCounter.addAndGet(changeCount); StringBuilder sb = new StringBuilder(); sb.append(">>> " + instanceInfo + " (" + changeCount + " of " + peers.size() + " / " + changeCounter.get() + ") gen=" + generationCounter + "\n"); // for (Entry<InstanceInfo, Client> peer : peers.entrySet()) { // sb.append(" " + peer.getKey()).append("\n"); // } // System.out.print(sb.toString()); } @Override public void onMessage(Message message, AsyncResponse response) { try { RequestHandler handler = verbHandlers.get(message.getVerb()); if (handler != null) { handler.onMessage(message, response); } } catch (Exception e) { // Notify error } } } <|start_filename|>staash-svc/src/main/java/com/netflix/staash/service/PaasDataService.java<|end_filename|> /******************************************************************************* * /* * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * * * ******************************************************************************/ package com.netflix.staash.service; import java.io.ByteArrayOutputStream; import java.io.InputStream; import java.util.concurrent.Executors; import com.google.common.util.concurrent.ListeningExecutorService; import com.google.common.util.concurrent.MoreExecutors; import com.google.inject.Inject; import com.netflix.staash.connection.ConnectionFactory; import com.netflix.staash.connection.PaasConnection; import com.netflix.staash.json.JsonArray; import com.netflix.staash.json.JsonObject; import com.netflix.staash.rest.meta.entity.EntityType; public class PaasDataService implements DataService{ private MetaService meta; private ConnectionFactory fac; ListeningExecutorService service = MoreExecutors.listeningDecorator(Executors.newFixedThreadPool(10)); @Inject public PaasDataService(MetaService meta, ConnectionFactory fac){ this.meta = meta; this.fac = fac; } public String writeRow(String db, String table, JsonObject rowObj) { JsonObject storageConf = meta.getStorageForTable(db+"."+table); PaasConnection conn = fac.createConnection(storageConf, db); return conn.insert(db,table,rowObj); } public String writeToKVStore(String db, String table, JsonObject rowObj) { JsonObject storageConf = meta.getStorageForTable(db+"."+table); PaasConnection conn = fac.createConnection(storageConf, db); rowObj.putString("type", "kv"); return conn.insert(db, table, rowObj); } public String listRow(String db, String table, String keycol, String key) { JsonObject storageConf = meta.getStorageForTable(db+"."+table); if (storageConf == null) return "{\"msg\":\"the requested table does not exist in paas\"}"; PaasConnection conn = fac.createConnection(storageConf,db); return conn.read(db,table,keycol,key); } public String writeEvents(String db, String table, JsonArray events) { for (Object event: events) { JsonObject obj = (JsonObject) event; writeEvent(db, table, obj); } return "{\"msg\":\"ok\"}"; } public String writeEvent(String db, String table, JsonObject rowObj) { JsonObject tbl = meta.runQuery(EntityType.SERIES, db+"."+table); if (tbl == null) throw new RuntimeException("Table "+table+" does not exist"); JsonObject storageConf = meta.getStorageForTable(db+"."+table); if (storageConf == null) throw new RuntimeException("Storage for "+table+" does not exist"); PaasConnection conn = fac.createConnection(storageConf,db); String periodicity = tbl.getString("periodicity"); Long time = rowObj.getLong("timestamp"); if (time == null || time <= 0) { time = System.currentTimeMillis(); } String prefix = rowObj.getString("prefix"); if (prefix != null && !prefix.equals("")) prefix = prefix+":"; else prefix = ""; Long rowkey = (time/Long.parseLong(periodicity))*Long.parseLong(periodicity); rowObj.putString("columns", "key,column1,value"); rowObj.putString("values","'"+prefix+String.valueOf(rowkey)+"',"+time+",'"+rowObj.getString("event")+"'"); return conn.insert(db,table,rowObj); } public String readEvent(String db, String table, String eventTime) { JsonObject tbl = meta.runQuery(EntityType.SERIES, db+"."+table); if (tbl == null) throw new RuntimeException("Table "+table+" does not exist"); JsonObject storageConf = meta.getStorageForTable(db+"."+table); if (storageConf == null) throw new RuntimeException("Storage for "+table+" does not exist"); PaasConnection conn = fac.createConnection(storageConf,db); String periodicity = tbl.getString("periodicity"); Long time = Long.parseLong(eventTime); Long rowkey = (time/Long.parseLong(periodicity))*Long.parseLong(periodicity); return conn.read(db,table,"key",String.valueOf(rowkey),"column1",String.valueOf(eventTime)); } public String readEvent(String db, String table, String prefix,String eventTime) { JsonObject tbl = meta.runQuery(EntityType.SERIES, db+"."+table); if (tbl == null) throw new RuntimeException("Table "+table+" does not exist"); JsonObject storageConf = meta.getStorageForTable(db+"."+table); if (storageConf == null) throw new RuntimeException("Storage for "+table+" does not exist"); PaasConnection conn = fac.createConnection(storageConf,db); String periodicity = tbl.getString("periodicity"); Long time = Long.parseLong(eventTime); Long rowkey = (time/Long.parseLong(periodicity))*Long.parseLong(periodicity); if (prefix != null && !prefix.equals("")) prefix = prefix+":"; else prefix = ""; return conn.read(db,table,"key",prefix+String.valueOf(rowkey),"column1",String.valueOf(eventTime)); } public String readEvent(String db, String table, String prefix,String startTime, String endTime) { JsonObject tbl = meta.runQuery(EntityType.SERIES, db+"."+table); if (tbl == null) throw new RuntimeException("Table "+table+" does not exist"); JsonObject storageConf = meta.getStorageForTable(db+"."+table); if (storageConf == null) throw new RuntimeException("Storage for "+table+" does not exist"); PaasConnection conn = fac.createConnection(storageConf,db); String periodicity = tbl.getString("periodicity"); Long time = Long.parseLong(startTime); Long startTimekey = (time/Long.parseLong(periodicity))*Long.parseLong(periodicity); Long endTimeL = Long.parseLong(endTime); Long endTimeKey = (endTimeL/Long.parseLong(periodicity))*Long.parseLong(periodicity); if (prefix != null && !prefix.equals("")) prefix = prefix+":"; else prefix = ""; JsonObject response = new JsonObject(); for (Long current = startTimekey; current < endTimeKey;current = current+Long.parseLong(periodicity) ) { JsonObject slice = new JsonObject(conn.read(db,table,"key",prefix+String.valueOf(current))); for (String field:slice.getFieldNames()) { response.putString(field, slice.getString(field)); } } return response.toString(); } public String doJoin(String db, String table1, String table2, String joincol, String value) { String res1 = listRow(db,table1,joincol,value); String res2 = listRow(db,table2,joincol,value); return "{\""+table1+"\":"+res1+",\""+table2+"\":"+res2+"}"; } public byte[] fetchValueForKey(String db, String table, String keycol, String key) { JsonObject storageConf = meta.getStorageForTable(db+"."+table); if (storageConf == null) return "{\"msg\":\"the requested table does not exist in paas\"}".getBytes(); PaasConnection conn = fac.createConnection(storageConf,db); String ret = conn.read(db,table,keycol,key); JsonObject keyval = new JsonObject(ret).getObject("1"); String val = keyval.getString("value"); return val.getBytes(); } public byte[] readChunked(String db, String table, String objectName) { JsonObject storageConf = meta.getStorageForTable(db+"."+table); if (storageConf == null) return "{\"msg\":\"the requested table does not exist in paas\"}".getBytes(); PaasConnection conn = fac.createConnection(storageConf,db); ByteArrayOutputStream os = conn.readChunked(db, table, objectName); return os.toByteArray(); } public String writeChunked(String db, String table, String objectName, InputStream is) { // TODO Auto-generated method stub JsonObject storageConf = meta.getStorageForTable(db+"."+table); if (storageConf == null) return "{\"msg\":\"the requested table does not exist in paas\"}"; PaasConnection conn = fac.createConnection(storageConf,db); return conn.writeChunked(db, table, objectName, is); } } <|start_filename|>staash-svc/src/main/java/com/netflix/staash/json/PaasJson.java<|end_filename|> /******************************************************************************* * /* * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * * * ******************************************************************************/ package com.netflix.staash.json; public class PaasJson { public static final String CASS_STORAGE = new JsonObject().putString("name", "name") .putString("type", "cassandra") .putString("cluster", "cluster") .putString("port", "port") .putString("replicationfactor", "3") .putString("strategy", "NetworkTopologyStrategy") .putString("asyncreplicate", "") .putString("poolsize", "3") .toString(); public static final String MYSQL_STORAGE = new JsonObject().putString("name", "name") .putString("type", "mysql") .putString("host", "host") .putString("jdbcurl", "jdbc:mysql://localhost:3306/") .putString("user", "user") .putString("port", "port") .putString("asyncreplicate", "") .toString(); public static final String PASS_DB = new JsonObject().putString("name", "name").toString(); public static final String PASS_TABLE = new JsonObject().putString("name","name") .putString("columns", "column1,column2") .putString("storage", "storagename") .putString("indexrowkeys", "true") .toString(); public static final String PASS_TIMESERIES = new JsonObject().putString("name", "name") .putString("periodicity", "milliseconds") .putString("prefix", "yesorno") .toString(); public static final String TABLE_INSERT_ROW = new JsonObject().putString("columns", "col1,col2,col3") .putString("values", "value1,value2,value3") .toString(); public static final String TS_INSERT_EVENT = new JsonObject().putString("time", "milliseconds") .putString("event", "event payload") .putString("prefix", "prefix") .toString(); public static final String READ_EVENT_URL = "http://hostname:8080/paas/v1/data/time/100000"; public static final String READ_ROW_URL = "http://hostname:8080/paas/v1/data"; public static final String LIST_SCHEMAS_URL = "http://hostname:8080/paas/v1/admin"; public static final String LIST_STORAGE_URL = "http://hostname:8080/paas/v1/admin/storage"; public static final String LIST_TABLES_URL = "http://hostname:8080/paas/v1/admin/db"; public static final String CREATE_DB_URL = "http://hostname:8080/paas/v1/admin"; public static final String CREATE_TABLE_URL = "http://hostname:8080/paas/v1/admin/db"; public static final String CREATE_TS_URL = "http://hostname:8080/paas/v1/admin/db/timeseries"; public static final String CREATE_STORAGE_URL = "http://hostname:8080/paas/v1/admin/storage"; public static final String LIST_TS_URL = "http://hostname:8080/paas/v1/admin/db/timeseries"; public static final String INSERT_EVENT_URL = "http://hostname:8080/paas/v1/data/db/timeseries"; public static final String WRITE_ROW_URL = "http://hostname:8080/paas/v1/data/db/table"; } <|start_filename|>staash-svc/src/main/java/com/netflix/staash/rest/modules/PaasPropertiesModule.java<|end_filename|> /******************************************************************************* * /* * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * * * ******************************************************************************/ package com.netflix.staash.rest.modules; import java.net.URL; import java.util.Properties; import com.datastax.driver.core.Cluster; import com.datastax.driver.core.policies.RoundRobinPolicy; import com.datastax.driver.core.policies.TokenAwarePolicy; import com.google.inject.AbstractModule; import com.google.inject.Provides; import com.google.inject.Singleton; import com.google.inject.name.Named; import com.google.inject.name.Names; import com.netflix.astyanax.AstyanaxContext; import com.netflix.astyanax.Keyspace; import com.netflix.astyanax.connectionpool.NodeDiscoveryType; import com.netflix.astyanax.connectionpool.impl.ConnectionPoolConfigurationImpl; import com.netflix.astyanax.connectionpool.impl.ConnectionPoolType; import com.netflix.astyanax.connectionpool.impl.CountingConnectionPoolMonitor; import com.netflix.astyanax.impl.AstyanaxConfigurationImpl; import com.netflix.astyanax.thrift.ThriftFamilyFactory; import com.netflix.staash.cassandra.discovery.EurekaAstyanaxHostSupplier; import com.netflix.staash.connection.ConnectionFactory; import com.netflix.staash.connection.PaasConnectionFactory; import com.netflix.staash.rest.dao.AstyanaxDataDaoImpl; import com.netflix.staash.rest.dao.AstyanaxMetaDaoImpl; import com.netflix.staash.rest.dao.CqlDataDaoImpl; import com.netflix.staash.rest.dao.CqlMetaDaoImpl; import com.netflix.staash.rest.dao.CqlMetaDaoImplNew; import com.netflix.staash.rest.dao.DataDao; import com.netflix.staash.rest.dao.MetaDao; import com.netflix.staash.rest.util.HostSupplier; import com.netflix.staash.rest.util.MetaConstants; import com.netflix.staash.service.CacheService; import com.netflix.staash.service.DataService; import com.netflix.staash.service.MetaService; import com.netflix.staash.service.PaasDataService; import com.netflix.staash.service.PaasMetaService; public class PaasPropertiesModule extends AbstractModule { @Override protected void configure() { try { Properties props = loadProperties(); Names.bindProperties(binder(), props); } catch (Exception e) { e.printStackTrace(); } } private static Properties loadProperties() throws Exception { Properties properties = new Properties(); ClassLoader loader = PaasPropertiesModule.class.getClassLoader(); URL url = loader.getResource("staash.properties"); properties.load(url.openStream()); return properties; } @Provides @Named("metacluster") Cluster provideCluster(@Named("staash.cassclient") String clientType,@Named("staash.metacluster") String clustername) { if (clientType.equals("cql")) { Cluster cluster = Cluster.builder().addContactPoint(clustername).build(); return cluster; } else return null; } @Provides HostSupplier provideHostSupplier(@Named("staash.metacluster") String clustername) { return null; } @Provides @Named("astmetaks") Keyspace provideKeyspace(@Named("staash.metacluster") String clustername,EurekaAstyanaxHostSupplier hs) { String clusterNameOnly = ""; String[] clusterinfo = clustername.split(":"); if (clusterinfo != null && clusterinfo.length == 2) { clusterNameOnly = clusterinfo[0]; } else { clusterNameOnly = clustername; } AstyanaxContext<Keyspace> keyspaceContext = new AstyanaxContext.Builder() .forCluster(clusterNameOnly) .forKeyspace(MetaConstants.META_KEY_SPACE) .withAstyanaxConfiguration( new AstyanaxConfigurationImpl() .setDiscoveryType( NodeDiscoveryType.RING_DESCRIBE) .setConnectionPoolType( ConnectionPoolType.TOKEN_AWARE) .setDiscoveryDelayInSeconds(60) .setTargetCassandraVersion("1.2") .setCqlVersion("3.0.0")) .withHostSupplier(hs.getSupplier(clustername)) .withConnectionPoolConfiguration( new ConnectionPoolConfigurationImpl(clusterNameOnly + "_" + MetaConstants.META_KEY_SPACE) .setSocketTimeout(11000) .setConnectTimeout(2000) .setMaxConnsPerHost(10).setInitConnsPerHost(3)) .withConnectionPoolMonitor(new CountingConnectionPoolMonitor()) .buildKeyspace(ThriftFamilyFactory.getInstance()); keyspaceContext.start(); Keyspace keyspace; keyspace = keyspaceContext.getClient(); return keyspace; } @Provides @Named("datacluster") Cluster provideDataCluster(@Named("staash.datacluster") String clustername) { Cluster cluster = Cluster.builder().addContactPoint(clustername).build(); return cluster; } @Provides MetaDao provideCqlMetaDao(@Named("staash.cassclient") String clientType, @Named("metacluster") Cluster cluster,@Named("astmetaks") Keyspace keyspace) { if (clientType.equals("cql")) return new CqlMetaDaoImpl(cluster ); else return new AstyanaxMetaDaoImpl(keyspace); } @Provides DataDao provideCqlDataDao(@Named("staash.cassclient") String clientType, @Named("datacluster") Cluster cluster, MetaDao meta) { if (clientType.equals("cql")) return new CqlDataDaoImpl(cluster, meta); else return new AstyanaxDataDaoImpl(); } @Provides @Named("pooledmetacluster") Cluster providePooledCluster(@Named("staash.cassclient") String clientType,@Named("staash.metacluster") String clustername) { if (clientType.equals("cql")) { Cluster cluster = Cluster.builder().withLoadBalancingPolicy(new TokenAwarePolicy(new RoundRobinPolicy())).addContactPoint(clustername).build(); return cluster; }else { return null; } } @Provides @Named("newmetadao") MetaDao provideCqlMetaDaoNew(@Named("staash.cassclient") String clientType, @Named("metacluster") Cluster cluster, @Named("astmetaks") Keyspace keyspace) { if (clientType.equals("cql")) return new CqlMetaDaoImplNew(cluster ); else return new AstyanaxMetaDaoImpl(keyspace); } @Provides MetaService providePaasMetaService(@Named("newmetadao") MetaDao metad, ConnectionFactory fac, CacheService cache) { PaasMetaService metasvc = new PaasMetaService(metad, fac, cache); return metasvc; } @Provides DataService providePaasDataService( MetaService metasvc, ConnectionFactory fac) { PaasDataService datasvc = new PaasDataService(metasvc, fac); return datasvc; } @Provides CacheService provideCacheService(@Named("newmetadao") MetaDao metad) { return new CacheService(metad); } @Provides ConnectionFactory provideConnectionFactory(@Named("staash.cassclient") String clientType,EurekaAstyanaxHostSupplier hs) { return new PaasConnectionFactory(clientType, hs); } } <|start_filename|>staash-mesh/src/test/java/com/netflix/paas/ptp/RandomServerProvider.java<|end_filename|> /******************************************************************************* * /*** * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * ******************************************************************************/ package com.netflix.paas.ptp; import java.util.concurrent.atomic.AtomicLong; import com.google.inject.Inject; import com.google.inject.Provider; import com.netflix.staash.mesh.InstanceInfo; import com.netflix.staash.mesh.InstanceRegistry; import com.netflix.staash.mesh.client.ClientFactory; import com.netflix.staash.mesh.endpoints.EndpointPolicy; import com.netflix.staash.mesh.server.MemoryServer; import com.netflix.staash.mesh.server.Server; import com.netflix.staash.mesh.server.ServerFactory; public class RandomServerProvider implements ServerFactory { private final InstanceRegistry instanceRegistry; private final ClientFactory clientFactory; private final EndpointPolicy endpointPolicy; private final AtomicLong counter = new AtomicLong(); @Inject public RandomServerProvider(InstanceRegistry instanceRegistry, ClientFactory clientFactory, EndpointPolicy endpointPolicy) { this.instanceRegistry = instanceRegistry; this.clientFactory = clientFactory; this.endpointPolicy = endpointPolicy; } @Override public Server createServer(InstanceInfo ii) { return new MemoryServer(instanceRegistry, clientFactory, endpointPolicy, "" + counter.incrementAndGet()); } } <|start_filename|>staash-core/src/main/java/com/netflix/paas/JsonSerializer.java<|end_filename|> /******************************************************************************* * /*** * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * ******************************************************************************/ package com.netflix.paas; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import org.codehaus.jackson.map.ObjectMapper; import org.codehaus.jackson.map.annotate.JsonSerialize; import org.codehaus.jackson.map.module.SimpleModule; public class JsonSerializer { final static ObjectMapper mapper = new ObjectMapper(); { mapper.getSerializationConfig().setSerializationInclusion(JsonSerialize.Inclusion.NON_NULL); mapper.enableDefaultTyping(); } public static <T> String toString(T entity) throws Exception { ByteArrayOutputStream baos = new ByteArrayOutputStream(); mapper.writeValue(baos, entity); baos.flush(); return baos.toString(); } public static <T> T fromString(String data, Class<T> clazz) throws Exception { return (T) mapper.readValue( new ByteArrayInputStream(data.getBytes()), clazz); } } <|start_filename|>staash-core/src/main/java/com/netflix/paas/config/ArchaeusPaasConfiguration.java<|end_filename|> /******************************************************************************* * /*** * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * ******************************************************************************/ package com.netflix.paas.config; import java.io.IOException; import java.util.concurrent.ConcurrentMap; import javax.annotation.PostConstruct; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.google.inject.Inject; import com.google.inject.name.Named; import com.netflix.config.ConfigurationManager; import com.netflix.config.DynamicPropertyFactory; import com.netflix.config.DynamicStringProperty; import com.netflix.config.PropertyWrapper; public class ArchaeusPaasConfiguration implements PaasConfiguration { private static final Logger LOG = LoggerFactory.getLogger(ArchaeusPaasConfiguration.class); private static final DynamicStringProperty PAAS_PROPS_FILE = DynamicPropertyFactory.getInstance().getStringProperty("paas.client.props", "paas"); private final String namespace; private static ConcurrentMap<String, PropertyWrapper<?>> parameters; @Inject public ArchaeusPaasConfiguration(@Named("namespace") String namespace) { LOG.info("Created"); this.namespace = namespace; } @PostConstruct public void initialize() { LOG.info("Initializing"); String filename = PAAS_PROPS_FILE.get(); try { ConfigurationManager.loadCascadedPropertiesFromResources(filename); } catch (IOException e) { LOG.warn( "Cannot find the properties specified : {}. This may be okay if there are other environment specific properties or the configuration is installed with a different mechanism.", filename); } } @Override public Integer getInteger(GenericProperty name) { PropertyWrapper<Integer> prop = (PropertyWrapper<Integer>)parameters.get(name.getName()); if (prop == null) { PropertyWrapper<Integer> newProp = DynamicPropertyFactory.getInstance().getIntProperty(namespace + name, Integer.parseInt(name.getDefault())); prop = (PropertyWrapper<Integer>) parameters.putIfAbsent(name.getName(), newProp); if (prop == null) prop = newProp; } return prop.getValue(); } @Override public String getString(GenericProperty name) { PropertyWrapper<String> prop = (PropertyWrapper<String>)parameters.get(name.getName()); if (prop == null) { PropertyWrapper<String> newProp = DynamicPropertyFactory.getInstance().getStringProperty(namespace + name, name.getDefault()); prop = (PropertyWrapper<String>) parameters.putIfAbsent(name.getName(), newProp); if (prop == null) prop = newProp; } return prop.getValue(); } @Override public Boolean getBoolean(GenericProperty name) { PropertyWrapper<Boolean> prop = (PropertyWrapper<Boolean>)parameters.get(name.getName()); if (prop == null) { PropertyWrapper<Boolean> newProp = DynamicPropertyFactory.getInstance().getBooleanProperty(namespace + name, Boolean.parseBoolean(name.getDefault())); prop = (PropertyWrapper<Boolean>) parameters.putIfAbsent(name.getName(), newProp); if (prop == null) prop = newProp; } return prop.getValue(); } @Override public Long getLong(GenericProperty name) { PropertyWrapper<Long> prop = (PropertyWrapper<Long>)parameters.get(name.getName()); if (prop == null) { PropertyWrapper<Long> newProp = DynamicPropertyFactory.getInstance().getLongProperty(namespace + name, Long.parseLong(name.getDefault())); prop = (PropertyWrapper<Long>) parameters.putIfAbsent(name.getName(), newProp); if (prop == null) prop = newProp; } return prop.getValue(); } @Override public Double getDouble(GenericProperty name) { PropertyWrapper<Double> prop = (PropertyWrapper<Double>)parameters.get(name.getName()); if (prop == null) { PropertyWrapper<Double> newProp = DynamicPropertyFactory.getInstance().getDoubleProperty(namespace + name, Double.parseDouble(name.getDefault())); prop = (PropertyWrapper<Double>) parameters.putIfAbsent(name.getName(), newProp); if (prop == null) prop = newProp; } return prop.getValue(); } } <|start_filename|>staash-svc/src/main/java/com/netflix/staash/service/CacheService.java<|end_filename|> /******************************************************************************* * /* * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * * * ******************************************************************************/ package com.netflix.staash.service; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Map; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import com.netflix.staash.json.JsonArray; import com.netflix.staash.json.JsonObject; import com.netflix.staash.rest.dao.MetaDao; import com.netflix.staash.rest.meta.entity.Entity; import com.netflix.staash.rest.meta.entity.EntityType; import com.netflix.staash.rest.util.MetaConstants; public class CacheService { List<String> dbHolder = new ArrayList<String>(); Map<String, String> tableToStorageMap = new ConcurrentHashMap<String, String>(); Map<String, JsonObject> storageMap = new ConcurrentHashMap<String, JsonObject>(); Map<String, List<String>> dbToTableMap = new ConcurrentHashMap<String, List<String>>(); Map<String, List<String>> dbToTimeseriesMap = new ConcurrentHashMap<String, List<String>>(); private MetaDao meta; public CacheService(MetaDao meta) { this.meta = meta; // LoadStorage(); // LoadDbNames(); // LoadTableMaps(); // LoadDbToTimeSeriesMap(); } private void LoadTableMaps() { Map<String, JsonObject> tblmap = meta.runQuery( MetaConstants.STAASH_TABLE_ENTITY_TYPE, "*"); for (String tableName : tblmap.keySet()) { JsonObject tblPay = tblmap.get(tableName); String storage = tblPay.getString("storage"); tableToStorageMap.put(tableName, storage); String key = tableName.split("\\.")[0]; String table = tableName.split("\\.")[1]; List<String> currval = null; currval = dbToTableMap.get(key); if (currval == null) { currval = new ArrayList<String>(); } currval.add(table); dbToTableMap.put(key, currval); } } public void LoadStorage() { storageMap = meta.runQuery(MetaConstants.STAASH_STORAGE_TYPE_ENTITY, "*"); } private void LoadDbNames() { Map<String, JsonObject> dbmap = meta.runQuery( MetaConstants.STAASH_DB_ENTITY_TYPE, "*"); for (String key : dbmap.keySet()) { dbHolder.add(key); } } private void LoadDbToTimeSeriesMap() { Map<String, JsonObject> tblmap = meta.runQuery( MetaConstants.STAASH_TS_ENTITY_TYPE, "*"); for (String tableName : tblmap.keySet()) { JsonObject tblPay = tblmap.get(tableName); String storage = tblPay.getString("storage"); if (storage != null && storage.length() > 0) tableToStorageMap.put(tableName, storage); String key = tableName.split("\\.")[0]; String table = tableName.split("\\.")[1]; List<String> currval = null; currval = dbToTimeseriesMap.get(key); if (currval == null) { currval = new ArrayList<String>(); } currval.add(table); dbToTimeseriesMap.put(key, currval); } } // public void updateMaps(EntityType etype, JsonObject obj) { // switch (etype) { // case STORAGE: // storageMap.put(obj.getString("name"), obj); // break; // case DB: // String dbname = obj.getString("name"); // dbHolder.add(dbname); // break; // case TABLE: // String tblname = obj.getString("name"); // List<String> currval = dbToTableMap.get(tblname); // if (currval == null) { // currval = new ArrayList<String>(); // } // currval.add(tblname); // dbToTableMap.put(tblname, currval); // String storage = obj.getString("storage"); // tableToStorageMap.put(tblname, storage); // break; // case SERIES: // String seriesname = obj.getString("name"); // List<String> currseries = dbToTimeseriesMap.get(seriesname); // if (currseries == null) { // currseries = new ArrayList<String>(); // } // currseries.add(seriesname); // dbToTimeseriesMap.put(seriesname, currseries); // String tsstorage = obj.getString("storage"); // tableToStorageMap.put(seriesname, tsstorage); // break; // } // } public boolean checkUniqueDbName(String dbName) { // return dbHolder.contains(dbName); Map<String,JsonObject> names = meta.runQuery(MetaConstants.STAASH_DB_ENTITY_TYPE, dbName); if (names!=null && !names.isEmpty()) return names.containsKey(dbName); else return false; } public List<String> getDbNames() { // return dbHolder; Map<String,JsonObject> dbmap = meta.runQuery(MetaConstants.STAASH_DB_ENTITY_TYPE, "*"); List<String> dbNames = new ArrayList<String>(); for (String key : dbmap.keySet()) { dbNames.add(key); } return dbNames; } public List<String> getTableNames(String db) { Map<String, JsonObject> tblmap = meta.runQuery( MetaConstants.STAASH_TABLE_ENTITY_TYPE, "*"); List<String> tableNames = new ArrayList<String>(); for (String tableName : tblmap.keySet()) { if (tableName.startsWith(db+".")) { String table = tableName.split("\\.")[1]; tableNames.add(table); } } return tableNames; } public Set<String> getStorageNames() { // return storageMap.keySet(); Map<String, JsonObject> storages = meta.runQuery(MetaConstants.STAASH_STORAGE_TYPE_ENTITY, "*"); if (storages != null) return storages.keySet(); else return Collections.emptySet(); } public JsonObject getStorage(String storage) { // return storageMap.get(storage); Map<String, JsonObject> storages = meta.runQuery(MetaConstants.STAASH_STORAGE_TYPE_ENTITY, "*"); if (storages != null) return storages.get(storage); else return null; } public List<String> getSeriesNames(String db) { // return dbToTimeseriesMap.get(db); Map<String, JsonObject> tblmap = meta.runQuery( MetaConstants.STAASH_TS_ENTITY_TYPE, "*"); List<String> tableNames = new ArrayList<String>(); for (String tableName : tblmap.keySet()) { if (tableName.startsWith(db+".")) { String table = tableName.split("\\.")[1]; tableNames.add(table); } } return tableNames; } public void addEntityToCache(EntityType etype, Entity entity) { // switch (etype) { // case STORAGE: // storageMap.put(entity.getName(), // new JsonObject(entity.getPayLoad())); // break; // case DB: // dbHolder.add(entity.getName()); // break; // case TABLE: // JsonObject payobject = new JsonObject(entity.getPayLoad()); // tableToStorageMap.put(entity.getName(), // payobject.getString("storage")); // String db = payobject.getString("db"); // List<String> tables = dbToTableMap.get(db); // if (tables == null || tables.size() == 0) { // tables = new ArrayList<String>(); // tables.add(payobject.getString("name")); // } else { // tables.add(payobject.getString("name")); // } // dbToTableMap.put(db, tables); // break; // // case SERIES: // JsonObject tsobject = new JsonObject(entity.getPayLoad()); // tableToStorageMap.put(entity.getName(), // tsobject.getString("storage")); // String dbname = tsobject.getString("db"); // List<String> alltables = dbToTableMap.get(dbname); // if (alltables == null || alltables.size() == 0) { // alltables = new ArrayList<String>(); // alltables.add(entity.getName()); // } else { // alltables.add(entity.getName()); // } // dbToTimeseriesMap.put(dbname, alltables); // break; // } } public JsonObject getStorageForTable(String tableParam) { Map<String, JsonObject> tblmap = meta.runQuery( MetaConstants.STAASH_TABLE_ENTITY_TYPE, "*"); List<String> tableNames = new ArrayList<String>(); for (String tableName : tblmap.keySet()) { if (tableName.equals(tableParam)) { JsonObject tblPayload = tblmap.get(tableParam); String storage = tblPayload.getString("storage"); return getStorage(storage); } } tblmap = meta.runQuery( MetaConstants.STAASH_TS_ENTITY_TYPE, "*"); tableNames = new ArrayList<String>(); for (String tableName : tblmap.keySet()) { if (tableName.equals(tableParam)) { JsonObject tblPayload = tblmap.get(tableParam); String storage = tblPayload.getString("storage"); return getStorage(storage); } } return null; // String storage = tableToStorageMap.get(table); // JsonObject storageConf = storageMap.get(storage); // return storageConf; } public String listStorage() { // Set<String> allStorage = storageMap.keySet(); Set<String> allStorage = getStorageNames(); JsonObject obj = new JsonObject(); JsonArray arr = new JsonArray(); for (String storage : allStorage) { arr.addString(storage); } obj.putArray("storages", arr); return obj.toString(); } public String listSchemas() { JsonObject obj = new JsonObject(); JsonArray arr = new JsonArray(); List<String> allDbNames = getDbNames(); for (String db : allDbNames) { arr.addString(db); } obj.putArray("schemas", arr); return obj.toString(); } public String listTablesInSchema(String db) { List<String> tables = getTableNames(db); JsonObject obj = new JsonObject(); JsonArray arr = new JsonArray(); for (String table : tables) { arr.addString(table); } obj.putArray(db, arr); return obj.toString(); } public String listTimeseriesInSchema(String db) { List<String> tables = getSeriesNames(db); JsonObject obj = new JsonObject(); JsonArray arr = new JsonArray(); obj.putArray(db, arr); if (tables != null) { for (String table : tables) { arr.addString(table); } obj.putArray(db, arr); } return obj.toString(); } } <|start_filename|>staash-svc/src/main/java/com/netflix/staash/rest/dao/CqlDataDaoImpl.java<|end_filename|> /******************************************************************************* * /* * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * * * ******************************************************************************/ package com.netflix.staash.rest.dao; import static com.datastax.driver.core.querybuilder.QueryBuilder.eq; import static com.datastax.driver.core.querybuilder.QueryBuilder.select; import java.sql.ResultSetMetaData; import java.sql.SQLException; import java.util.List; import com.datastax.driver.core.Cluster; import com.datastax.driver.core.ColumnDefinitions; import com.datastax.driver.core.ResultSet; import com.datastax.driver.core.Row; import com.datastax.driver.core.Session; import com.google.inject.Inject; import com.google.inject.name.Named; import com.netflix.staash.json.JsonObject; import com.netflix.staash.rest.meta.entity.PaasTableEntity; import com.netflix.staash.rest.util.Pair; import com.netflix.staash.service.CacheService; import com.netflix.staash.storage.service.MySqlService; public class CqlDataDaoImpl implements DataDao { private MetaDao meta; private Cluster cluster; private Session session; @Inject public CqlDataDaoImpl(@Named("datacluster") Cluster cluster, MetaDao meta) { this.cluster = cluster; this.meta = meta; this.session = this.cluster.connect(); //from the meta get the name of the cluster for this db } public String writeRow(String db, String table, JsonObject rowObj) { String query = BuildRowInsertQuery(db, table, rowObj); Print(query); //String storage = rowObj.getField("storage"); String storage = meta.runQuery("com.netflix.test.storage",db+"."+table).get(db+"."+table).getString("storage"); if (storage!=null && storage.equals("mysql")) { MySqlService.insertRowIntoTable(db, table, query); } else { session.execute(query); } JsonObject obj = new JsonObject("{\"status\":\"ok\"}"); return obj.toString(); } private String BuildRowInsertQuery(String db, String table, JsonObject rowObj) { // TODO Auto-generated method stub String columns = rowObj.getString("columns"); String values = rowObj.getString("values"); //String storage = rowObj.getField("storage"); String storage = meta.runQuery("com.netflix.test.storage",db+"."+table).get(db+"."+table).getString("storage"); if (storage!=null && storage.contains("mysql")) return "INSERT INTO" + " " + table + "(" + columns + ")" + " VALUES(" + values + ");";else return "INSERT INTO" + " " + db + "." + table + "(" + columns + ")" + " VALUES(" + values + ");"; } private void Print(String str) { // TODO Auto-generated method stub System.out.println(str); } private String BuildQuery(PaasTableEntity tableEnt) { // TODO Auto-generated method stub String schema = tableEnt.getSchemaName(); String tableName = tableEnt.getName(); List<Pair<String, String>> columns = tableEnt.getColumns(); String colStrs = ""; for (Pair<String, String> colPair : columns) { colStrs = colStrs + colPair.getRight() + " " + colPair.getLeft() + ", "; } String primarykeys = tableEnt.getPrimarykey(); String PRIMARYSTR = "PRIMARY KEY(" + primarykeys + ")"; return "CREATE TABLE " + schema + "." + tableName + " (" + colStrs + " " + PRIMARYSTR + ");"; } public String listRow(String db, String table, String keycol, String key) { // TODO Auto-generated method stub String storage = meta.runQuery("com.netflix.test.storage",db+"."+table).get(db+"."+table).getString("storage"); if (storage!=null && storage.contains("mysql")) { String query = "select * from "+table+" where "+keycol+"=\'"+key+"\'"; Print(query); java.sql.ResultSet rs = MySqlService.executeRead(db, query); try { while (rs.next()) { ResultSetMetaData rsmd = rs.getMetaData(); String columns =""; String values = ""; int count = rsmd.getColumnCount(); for (int i=1;i<=count;i++) { String colName = rsmd.getColumnName(i); columns = columns + colName + ","; String value = rs.getString(i); values = values + value +","; } JsonObject response = new JsonObject(); response.putString("columns", columns.substring(0, columns.length()-1)); response.putString("values", values.substring(0, values.length()-1)); return response.toString(); } } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } } String query = select().all().from(db, table).where(eq(keycol, key)) .getQueryString(); Cluster cluster = Cluster.builder().addContactPoints("localhost").build(); Session session = cluster.connect(db); ResultSet rs = session.execute(query); return convertResultSet(rs); } private String convertResultSet(ResultSet rs) { // TODO Auto-generated method stub String colStr = ""; String rowStr = ""; JsonObject response = new JsonObject(); List<Row> rows = rs.all(); if (!rows.isEmpty() && rows.size() == 1) { rowStr = rows.get(0).toString(); } ColumnDefinitions colDefs = rs.getColumnDefinitions(); colStr = colDefs.toString(); response.putString("columns", colStr.substring(8, colStr.length() - 1)); response.putString("values", rowStr.substring(4, rowStr.length() - 1)); return response.toString(); } public String writeEvent(String db, String table, JsonObject rowObj) { // TODO Auto-generated method stub Long evTime = rowObj.getLong("time"); String value = rowObj.getString("event"); Long periodicity = 100L; Long rowKey = (evTime/periodicity)*periodicity; String INSERTSTR = "insert into "+db+"."+table+"(key,column1,value) values('"+rowKey.toString()+"',"+evTime+",'"+ value+"');"; Print(INSERTSTR); session.execute(INSERTSTR); JsonObject obj = new JsonObject("{\"status\":\"ok\"}"); return obj.toString(); } public String readEvent(String db, String table, String evTime) { // TODO Auto-generated method stub Long periodicity = 100L; Long rowKey = (Long.valueOf(evTime)/periodicity)*periodicity; String query = select().all().from(db, table).where(eq("key", String.valueOf(rowKey))).and(eq("column1",Long.valueOf(evTime))) .getQueryString(); Cluster cluster = Cluster.builder().addContactPoints("localhost").build(); Session session = cluster.connect(db); ResultSet rs = session.execute(query); return convertResultSet(rs); } public String doJoin(String db, String table1, String table2, String joincol, String value) { String res1 = listRow(db,table1,joincol,value); String res2 = listRow(db,table2,joincol,value); return "{\""+table1+"\":"+res1+",\""+table2+"\":"+res2+"}"; } } <|start_filename|>staash-web/src/test/java/com/netflix/staash/test/core/RequiresColumnFamily.java<|end_filename|> package com.netflix.staash.test.core; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.TYPE, ElementType.METHOD}) public @interface RequiresColumnFamily { String ksName(); String cfName(); boolean isCounter() default false; String comparator() default "UTF8Type"; String defaultValidator() default "UTF8Type"; String keyValidator() default "UTF8Type"; boolean truncateExisting() default false; } <|start_filename|>staash-core/src/main/java/com/netflix/paas/meta/entity/PaasTableEntity.java<|end_filename|> /******************************************************************************* * /*** * * * * Copyright 2013 Netflix, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * ******************************************************************************/ package com.netflix.paas.meta.entity; import java.util.ArrayList; import java.util.List; import com.netflix.paas.json.JsonObject; import com.netflix.paas.meta.impl.MetaConstants; import com.netflix.paas.util.Pair; public class PaasTableEntity extends Entity{ private String schemaName; private List<Pair<String, String>> columns = new ArrayList<Pair<String, String>>(); private String primarykey; public static class Builder { private PaasTableEntity entity = new PaasTableEntity(); public Builder withJsonPayLoad(JsonObject payLoad, String schemaName) { entity.setRowKey(MetaConstants.PAAS_TABLE_ENTITY_TYPE); entity.setSchemaName(schemaName); String payLoadName = payLoad.getString("name"); String load = payLoad.toString(); entity.setName(payLoadName); String columnswithtypes = payLoad.getString("columns"); String[] allCols = columnswithtypes.split(","); for (String col:allCols) { String type; String name; if (!col.contains(":")) { type="text"; name=col; } else { name = col.split(":")[0]; type = col.split(":")[1]; } Pair<String, String> p = new Pair<String, String>(type, name); entity.addColumn(p); } entity.setPrimarykey(payLoad.getString("primarykey")); entity.setPayLoad(load); return this; } public PaasTableEntity build() { return entity; } } public static Builder builder() { return new Builder(); } public String getSchemaName() { return schemaName; } private void setSchemaName(String schemaname) { this.schemaName = schemaname; } private void addColumn(Pair<String, String> pair) { columns.add(pair); } public List<Pair<String,String>> getColumns() { return columns; } public String getPrimarykey() { return primarykey; } private void setPrimarykey(String primarykey) { this.primarykey = primarykey; } }
Netflix/staash
<|start_filename|>playlists/pretty/0NaXa68Xyo4wmMiun5Lqgm.json<|end_filename|> { "description": "Turn your commute into a karaoke party. Stay tuned for the next edition. This time: Rock Ballads.", "name": "<NAME>", "num_followers": 170, "owner": { "name": "Spotify", "url": "https://open.spotify.com/user/spotify" }, "snapshot_id": "MTcsNjU2OGE3MzA4MjdhZWEwNzcwNTI5OWQ4NjJmZjJhNzk2MzY3MTQ0OQ==", "tracks": [], "url": "https://open.spotify.com/playlist/0NaXa68Xyo4wmMiun5Lqgm" } <|start_filename|>playlists/pretty/7iUOaMP7iKI22rBNflBwjX.json<|end_filename|> { "description": "", "name": "<NAME>", "num_followers": 66, "owner": { "name": "Spotify", "url": "https://open.spotify.com/user/spotify" }, "snapshot_id": "MSxkMDJhYTQxNWIzMDA2YzMzMjFiOTRkMzE4ODZkNWYwYmE4ZjcwYmNh", "tracks": [], "url": "https://open.spotify.com/playlist/7iUOaMP7iKI22rBNflBwjX" } <|start_filename|>playlists/pretty/2k9EArKbf7N3QUmuNJHSo8.json<|end_filename|> { "description": "Stj\u00e4rnskottet <NAME> ber\u00e4ttar historien bakom sin uppm\u00e4rksammade debutsingel \"Younger\", och presenterar den nya versionen av l\u00e5ten som sl\u00e4pps exklusivt p\u00e5 Spotify. ", "name": "<NAME> <NAME>", "num_followers": 7, "owner": { "name": "Spotify", "url": "https://open.spotify.com/user/spotify" }, "snapshot_id": "Nyw0ODBkMjVjOGRhYTA5YzE2Y2ZkM2ZjOTJkNDA3YTI1ZWJkZjQxMmZk", "tracks": [ { "added_at": "2014-06-13 12:15:10", "album": { "name": "<NAME> <NAME>", "url": "https://open.spotify.com/album/51nt0ZuKUaMIRKw9vvJrqG" }, "artists": [ { "name": "Various Artists", "url": "https://open.spotify.com/artist/0LyfQWJT6nXafLPZqxe9Of" } ], "duration_ms": 366000, "name": "<NAME> om \"Younger\"", "url": "https://open.spotify.com/track/1qEmpsU2VdulB4WcaIiLVF" }, { "added_at": "2014-06-13 12:15:43", "album": { "name": "Younger (Spotify Exclusive)", "url": "https://open.spotify.com/album/5vDC8ASHSs0jRt6uli8Nv9" }, "artists": [ { "name": "<NAME>", "url": "https://open.spotify.com/artist/4X0v8sFoDZ6rIfkeOeVm2i" } ], "duration_ms": 252476, "name": "Younger - Acoustic Version", "url": "https://open.spotify.com/track/4uSCwM7Ny6jvGLX12pDq5X" }, { "added_at": "2014-06-13 12:16:34", "album": { "name": "Younger", "url": "https://open.spotify.com/album/2IS5tnhr28NddRYPXRo7pm" }, "artists": [ { "name": "<NAME>", "url": "https://open.spotify.com/artist/4X0v8sFoDZ6rIfkeOeVm2i" } ], "duration_ms": 213973, "name": "Younger", "url": "https://open.spotify.com/track/5gQuh120SIYBEtodVIOd4Q" } ], "url": "https://open.spotify.com/playlist/2k9EArKbf7N3QUmuNJHSo8" }
masudissa0210/spotify-playlist-archive